tvm
|
MicroTVM RPC Server. More...
#include <stdlib.h>
#include <sys/types.h>
#include <tvm/runtime/crt/error_codes.h>
#include "../../../../src/support/ssize.h"
Go to the source code of this file.
Typedefs | |
typedef ssize_t(* | microtvm_rpc_channel_write_t) (void *context, const uint8_t *data, size_t num_bytes) |
TVM RPC channel write function. More... | |
typedef void * | microtvm_rpc_server_t |
Opaque pointer type to TVM RPC Server. More... | |
Functions | |
microtvm_rpc_server_t | MicroTVMRpcServerInit (microtvm_rpc_channel_write_t write_func, void *write_func_ctx) |
Initialize the TVM RPC Server. More... | |
tvm_crt_error_t | MicroTVMRpcServerLoop (microtvm_rpc_server_t server, uint8_t **new_data, size_t *new_data_size_bytes) |
Do any tasks suitable for the main thread, and maybe process new incoming data. More... | |
MicroTVM RPC Server.
typedef ssize_t(* microtvm_rpc_channel_write_t) (void *context, const uint8_t *data, size_t num_bytes) |
TVM RPC channel write function.
Tries to write num_bytes
from data
to the underlying channel.
context | The context. |
data | Pointer to data to write. |
num_bytes | Number of bytes avaiable in data. |
typedef void* microtvm_rpc_server_t |
Opaque pointer type to TVM RPC Server.
microtvm_rpc_server_t MicroTVMRpcServerInit | ( | microtvm_rpc_channel_write_t | write_func, |
void * | write_func_ctx | ||
) |
Initialize the TVM RPC Server.
Call this on device startup before calling anyother microtvm_rpc_server_ functions.
write_func | A callback function invoked by the TVM RPC Server to write data back to the host. Internally, the TVM RPC Server will block until all data in a reply packet has been written. |
write_func_ctx | An opaque pointer passed to write_func when it is called. |
tvm_crt_error_t MicroTVMRpcServerLoop | ( | microtvm_rpc_server_t | server, |
uint8_t ** | new_data, | ||
size_t * | new_data_size_bytes | ||
) |
Do any tasks suitable for the main thread, and maybe process new incoming data.
server | The TVM RPC Server pointer. |
new_data | If not nullptr, a pointer to a buffer pointer, which should point at new input data to process. On return, updated to point past data that has been consumed. |
new_data_size_bytes | Points to the number of valid bytes in new_data . On return, updated to the number of unprocessed bytes remaining in new_data (usually 0). |