Updated rx function prototypes.
Signed-off-by: Yilin Sun <imi415@imi.moe>
This commit is contained in:
parent
7e1f11ab84
commit
ce71f8dcff
|
@ -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
|
||||
|
|
|
@ -278,11 +278,11 @@ static void nh_shared_if_dispatch_if_priv(nh_shared_if_t *shared_if, nh_xfer_pri
|
|||
nh_event_init_t evt_init;
|
||||
nh_event_parse_init(&evt_init, payload);
|
||||
|
||||
if (!shared_if->cb.init) {
|
||||
if (!shared_if->cb_event.init) {
|
||||
return;
|
||||
}
|
||||
|
||||
shared_if->cb.init(shared_if->user_data, &evt_init);
|
||||
shared_if->cb_event.init(shared_if->user_data, &evt_init);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue