Mistake on this page?
Report an issue in GitHub or email us
chci_api.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Controller HCI transport API.
6  *
7  * Copyright (c) 2013-2018 Arm Ltd. All Rights Reserved.
8  *
9  * Copyright (c) 2019-2020 Packetcraft, Inc.
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 /*************************************************************************************************/
24 
25 #ifndef CHCI_API_H
26 #define CHCI_API_H
27 
28 #include "wsf_types.h"
29 #include "wsf_os.h"
30 #include "cfg_mac.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /*! \brief Protocols that source and sink messages. */
37 enum
38 {
39  CHCI_TR_PROT_BLE = 0, /*!< BLE protocol. */
40  CHCI_TR_PROT_BOOT = 1, /*!< Boot protocol. */
41  CHCI_TR_PROT_15P4 = 2, /*!< 802.15.4 protocol */
42  CHCI_TR_PROT_CAL = 3, /*!< Radio Calibration protocol */
43  CHCI_TR_PROT_NUM /*!< Number of protocols. */
44 };
45 
46 /*! \brief Type of message. */
47 enum
48 {
49  CHCI_TR_TYPE_CMD = 0, /*!< Command message (receive only). */
50  CHCI_TR_TYPE_ACL, /*!< ACL data message (send or receive). */
51  CHCI_TR_TYPE_EVT, /*!< Event message (send only). */
52  CHCI_TR_TYPE_ISO, /*!< ISO data message (send or receive). */
53  CHCI_TR_TYPE_NUM /*!< Number of types. */
54 };
55 
56 /*! \brief Error codes. */
57 enum
58 {
59  CHCI_TR_CODE_INVALID_DATA = 0xA0, /*!< Invalid data received. */
60  CHCI_TR_CODE_INVALID_DATA_LEN = 0xA1, /*!< Invalid data length. */
61  CHCI_TR_CODE_OUT_OF_MEMORY = 0xA2 /*!< Out of memory. */
62 };
63 
64 /*! \brief 802.15.4 protocol command type. */
65 #define CHCI_15P4_CMD_TYPE 0x80
66 
67 /*! \brief 802.15.4 protocol data type. */
68 #define CHCI_15P4_DATA_TYPE 0x81
69 
70 /*! \brief Radio calibration command type. */
71 #define CHCI_CAL_CMD_TYPE 0xF1
72 
73 /*! \brief Radio calibration signal type. */
74 #define CHCI_CAL_SIG_TYPE 0xF2
75 
76 /*! \brief Radio calibration event type. */
77 #define CHCI_CAL_EVT_TYPE 0xF4
78 
79 /*! \brief 802.15.4 protocol header length. */
80 #define CHCI_15P4_HDR_LEN 3
81 
82 /*! \brief Radio calibration header length. */
83 #define CHCI_CAL_HDR_LEN 3
84 
85 /*! \brief Message received callback. */
86 typedef void (*ChciTrRecvCback_t)(uint8_t type, uint8_t *pBuf);
87 
88 /*! \brief Message send complete callback. */
89 typedef void (*ChciTrSendCompleteCback_t)(uint8_t type, uint8_t *pBuf);
90 
91 /*! \brief Service callback. */
92 typedef bool_t (*ChciTrServiceCback_t)(uint8_t *pType, uint16_t *pLen, uint8_t **pBuf);
93 
94 /*! \brief Send hardware error callback. */
95 typedef void (*ChciTrSendHwErrorCback_t)(uint8_t code);
96 
97 /**************************************************************************************************
98  Function Declarations
99 **************************************************************************************************/
100 
101 /*************************************************************************************************/
102 /*!
103  * \brief Initialize the transport handler.
104  *
105  * \param handlerId Handler ID.
106  * \param maxAclLen Maximum ACL data length.
107  * \param maxIsoSduLen Maximum ISO data length.
108  */
109 /*************************************************************************************************/
110 void ChciTrHandlerInit(wsfHandlerId_t handlerId, uint16_t maxAclLen, uint16_t maxIsoSduLen);
111 
112 /*************************************************************************************************/
113 /*!
114  * \brief Controller HCI transport message dispatch handler.
115  *
116  * \param event WSF event.
117  * \param pMsg WSF message.
118  */
119 /*************************************************************************************************/
120 void ChciTrHandler(wsfEventMask_t event, wsfMsgHdr_t *pMsg);
121 
122 /*************************************************************************************************/
123 /*!
124  * \brief Set callbacks for a protocol.
125  *
126  * \param prot Protocol.
127  * \param recvCback Message received callback.
128  * \param sendCompleteCback Message send complete callback.
129  * \param serviceCback Service callback.
130  */
131 /*************************************************************************************************/
132 void ChciTrSetCbacks(uint8_t prot, ChciTrRecvCback_t recvCback, ChciTrSendCompleteCback_t sendCompleteCback,
133  ChciTrServiceCback_t serviceCback);
134 
135 /*************************************************************************************************/
136 /*!
137  * \brief Set send hardware error callback.
138  *
139  * \param sendHwErrorCback Send hardware error callback.
140  */
141 /*************************************************************************************************/
143 
144 /*************************************************************************************************/
145 /*!
146  * \brief Flag protocol for needing service.
147  *
148  * \param prot Protocol.
149  */
150 /*************************************************************************************************/
151 void ChciTrNeedsService(uint8_t prot);
152 
153 #ifdef __cplusplus
154 };
155 #endif
156 
157 #endif /* CHCI_API_H */
uint16_t wsfEventMask_t
Event handler event mask data type.
Definition: wsf_os.h:83
MAC system configuration.
void ChciTrNeedsService(uint8_t prot)
Flag protocol for needing service.
void ChciTrSetSendHwErrorCback(ChciTrSendHwErrorCback_t sendHwErrorCback)
Set send hardware error callback.
void ChciTrHandlerInit(wsfHandlerId_t handlerId, uint16_t maxAclLen, uint16_t maxIsoSduLen)
Initialize the transport handler.
void(* ChciTrRecvCback_t)(uint8_t type, uint8_t *pBuf)
Message received callback.
Definition: chci_api.h:86
Platform-independent data types.
uint8_t wsfHandlerId_t
Event handler ID data type.
Definition: wsf_os.h:80
void ChciTrHandler(wsfEventMask_t event, wsfMsgHdr_t *pMsg)
Controller HCI transport message dispatch handler.
void ChciTrSetCbacks(uint8_t prot, ChciTrRecvCback_t recvCback, ChciTrSendCompleteCback_t sendCompleteCback, ChciTrServiceCback_t serviceCback)
Set callbacks for a protocol.
Software foundation OS API.
Common message structure passed to event handler.
Definition: wsf_os.h:106
void(* ChciTrSendCompleteCback_t)(uint8_t type, uint8_t *pBuf)
Message send complete callback.
Definition: chci_api.h:89
void(* ChciTrSendHwErrorCback_t)(uint8_t code)
Send hardware error callback.
Definition: chci_api.h:95
bool_t(* ChciTrServiceCback_t)(uint8_t *pType, uint16_t *pLen, uint8_t **pBuf)
Service callback.
Definition: chci_api.h:92
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.