123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507 |
- extern "C" {
- enum BLE_L2CAP_SVCS
- {
- SD_BLE_L2CAP_CH_SETUP = BLE_L2CAP_SVC_BASE + 0,
- SD_BLE_L2CAP_CH_RELEASE = BLE_L2CAP_SVC_BASE + 1,
- SD_BLE_L2CAP_CH_RX = BLE_L2CAP_SVC_BASE + 2,
- SD_BLE_L2CAP_CH_TX = BLE_L2CAP_SVC_BASE + 3,
- SD_BLE_L2CAP_CH_FLOW_CONTROL = BLE_L2CAP_SVC_BASE + 4,
- };
- enum BLE_L2CAP_EVTS
- {
- BLE_L2CAP_EVT_CH_SETUP_REQUEST = BLE_L2CAP_EVT_BASE + 0,
- BLE_L2CAP_EVT_CH_SETUP_REFUSED = BLE_L2CAP_EVT_BASE + 1,
- BLE_L2CAP_EVT_CH_SETUP = BLE_L2CAP_EVT_BASE + 2,
- BLE_L2CAP_EVT_CH_RELEASED = BLE_L2CAP_EVT_BASE + 3,
- BLE_L2CAP_EVT_CH_SDU_BUF_RELEASED = BLE_L2CAP_EVT_BASE + 4,
- BLE_L2CAP_EVT_CH_CREDIT = BLE_L2CAP_EVT_BASE + 5,
- BLE_L2CAP_EVT_CH_RX = BLE_L2CAP_EVT_BASE + 6,
- BLE_L2CAP_EVT_CH_TX = BLE_L2CAP_EVT_BASE + 7,
- };
-
-
- typedef struct
- {
- uint16_t rx_mps;
- uint16_t tx_mps;
- uint8_t rx_queue_size;
- uint8_t tx_queue_size;
- uint8_t ch_count;
- } ble_l2cap_conn_cfg_t;
- typedef struct
- {
- uint16_t rx_mtu;
- uint16_t rx_mps;
- ble_data_t sdu_buf;
- } ble_l2cap_ch_rx_params_t;
- typedef struct
- {
- ble_l2cap_ch_rx_params_t rx_params;
- uint16_t le_psm;
- uint16_t status;
- } ble_l2cap_ch_setup_params_t;
- typedef struct
- {
- uint16_t tx_mtu;
- uint16_t peer_mps;
- uint16_t tx_mps;
- uint16_t credits;
- } ble_l2cap_ch_tx_params_t;
- typedef struct
- {
- ble_l2cap_ch_tx_params_t tx_params;
- uint16_t le_psm;
- } ble_l2cap_evt_ch_setup_request_t;
- typedef struct
- {
- uint8_t source;
- uint16_t status;
- } ble_l2cap_evt_ch_setup_refused_t;
- typedef struct
- {
- ble_l2cap_ch_tx_params_t tx_params;
- } ble_l2cap_evt_ch_setup_t;
- typedef struct
- {
- ble_data_t sdu_buf;
- } ble_l2cap_evt_ch_sdu_buf_released_t;
- typedef struct
- {
- uint16_t credits;
- } ble_l2cap_evt_ch_credit_t;
- typedef struct
- {
- uint16_t sdu_len;
- ble_data_t sdu_buf;
- } ble_l2cap_evt_ch_rx_t;
- typedef struct
- {
- ble_data_t sdu_buf;
- } ble_l2cap_evt_ch_tx_t;
- typedef struct
- {
- uint16_t conn_handle;
- uint16_t local_cid;
- union
- {
- ble_l2cap_evt_ch_setup_request_t ch_setup_request;
- ble_l2cap_evt_ch_setup_refused_t ch_setup_refused;
- ble_l2cap_evt_ch_setup_t ch_setup;
- ble_l2cap_evt_ch_sdu_buf_released_t ch_sdu_buf_released;
- ble_l2cap_evt_ch_credit_t credit;
- ble_l2cap_evt_ch_rx_t rx;
- ble_l2cap_evt_ch_tx_t tx;
- } params;
- } ble_l2cap_evt_t;
- SVCALL(SD_BLE_L2CAP_CH_SETUP, uint32_t, sd_ble_l2cap_ch_setup(uint16_t conn_handle, uint16_t *p_local_cid, ble_l2cap_ch_setup_params_t const *p_params));
- SVCALL(SD_BLE_L2CAP_CH_RELEASE, uint32_t, sd_ble_l2cap_ch_release(uint16_t conn_handle, uint16_t local_cid));
- SVCALL(SD_BLE_L2CAP_CH_RX, uint32_t, sd_ble_l2cap_ch_rx(uint16_t conn_handle, uint16_t local_cid, ble_data_t const *p_sdu_buf));
- SVCALL(SD_BLE_L2CAP_CH_TX, uint32_t, sd_ble_l2cap_ch_tx(uint16_t conn_handle, uint16_t local_cid, ble_data_t const *p_sdu_buf));
- SVCALL(SD_BLE_L2CAP_CH_FLOW_CONTROL, uint32_t, sd_ble_l2cap_ch_flow_control(uint16_t conn_handle, uint16_t local_cid, uint16_t credits, uint16_t *p_credits));
- }
|