|
|
|
@ -14,6 +14,9 @@ typedef nh_ret_t (*nh_shared_if_ops_hs_poll_t)(void *handle, uint32_t timeout_ms
|
|
|
|
|
/* Event callbacks */
|
|
|
|
|
typedef void (*nh_shared_if_cb_event_init_t)(void *handle, nh_event_init_t *init_event);
|
|
|
|
|
|
|
|
|
|
/* Data callbacks */
|
|
|
|
|
typedef void (*nh_shared_if_cb_rx_t)(void *handle, uint8_t *rx_data, uint32_t len);
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
nh_shared_if_ops_spi_xfer_t xfer;
|
|
|
|
|
nh_shared_if_ops_reset_t reset;
|
|
|
|
@ -23,21 +26,23 @@ typedef struct {
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
nh_shared_if_cb_event_init_t init;
|
|
|
|
|
} nh_shared_if_cb_t;
|
|
|
|
|
} nh_shared_if_cb_event_t;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
nh_shared_if_ops_t ops;
|
|
|
|
|
nh_shared_if_cb_t cb;
|
|
|
|
|
void *user_data;
|
|
|
|
|
nh_shared_if_ops_t ops;
|
|
|
|
|
nh_shared_if_cb_event_t cb_event;
|
|
|
|
|
void *user_data;
|
|
|
|
|
|
|
|
|
|
nh_osa_t *osa;
|
|
|
|
|
|
|
|
|
|
/* Private states */
|
|
|
|
|
nh_osa_semaphore_t p_semaphore_xfer_req;
|
|
|
|
|
nh_osa_queue_t p_queue_transfer_request;
|
|
|
|
|
|
|
|
|
|
nh_osa_queue_t p_queue_tx;
|
|
|
|
|
nh_osa_queue_t p_queue_rx_data;
|
|
|
|
|
nh_osa_queue_t p_queue_rx_serial;
|
|
|
|
|
nh_osa_semaphore_t p_semaphore_tx;
|
|
|
|
|
|
|
|
|
|
nh_shared_if_cb_rx_t p_cb_rx_serial;
|
|
|
|
|
nh_shared_if_cb_rx_t p_cb_rx_sta;
|
|
|
|
|
nh_shared_if_cb_rx_t p_cb_rx_ap;
|
|
|
|
|
|
|
|
|
|
uint8_t *p_buf_frame_tx; /* SPI TX frame */
|
|
|
|
|
uint8_t *p_buf_frame_rx; /* SPI RX frame */
|
|
|
|
@ -49,8 +54,12 @@ void nh_shared_if_inject_data_ready(nh_shared_if_t *shared_if);
|
|
|
|
|
|
|
|
|
|
/* Internal APIs */
|
|
|
|
|
nh_ret_t nh_shared_if_serial_if_send(nh_shared_if_t *shared_if, uint8_t *tx_payload, uint32_t len, uint32_t timeout_ms);
|
|
|
|
|
nh_ret_t nh_shared_if_serial_if_recv(nh_shared_if_t *shared_if, nh_serial_ep_type_t *ep_type, uint8_t **rx_payload,
|
|
|
|
|
uint32_t *len, uint32_t timeout_ms);
|
|
|
|
|
nh_ret_t nh_shared_if_serial_if_free(nh_shared_if_t *shared_if, uint8_t *rx_payload);
|
|
|
|
|
nh_ret_t nh_shared_if_serial_if_set_rx_cb(nh_shared_if_t *shared_if, nh_shared_if_cb_rx_t rx_cb);
|
|
|
|
|
|
|
|
|
|
nh_ret_t nh_shared_if_sta_if_send(nh_shared_if_t *shared_if, uint8_t *tx_payload, uint32_t len, uint32_t timeout_ms);
|
|
|
|
|
nh_ret_t nh_shared_if_sta_if_set_rx_cb(nh_shared_if_t *shared_if, nh_shared_if_cb_rx_t rx_cb);
|
|
|
|
|
|
|
|
|
|
nh_ret_t nh_shared_if_ap_if_send(nh_shared_if_t *shared_if, uint8_t *tx_payload, uint32_t len, uint32_t timeout_ms);
|
|
|
|
|
nh_ret_t nh_shared_if_ap_if_set_rx_cb(nh_shared_if_t *shared_if, nh_shared_if_cb_rx_t rx_cb);
|
|
|
|
|
|
|
|
|
|
#endif // NH_SHARED_IF_H
|
|
|
|
|