1 /* -------------------------------------------------------------------------- */
2 /*                           Copyright 2021-2022 NXP                          */
3 /*                            All rights reserved.                            */
4 /*                    SPDX-License-Identifier: BSD-3-Clause                   */
5 /* -------------------------------------------------------------------------- */
6 
7 #ifndef _FWK_PLATFORM_HDLC_H_
8 #define _FWK_PLATFORM_HDLC_H_
9 
10 /* -------------------------------------------------------------------------- */
11 /*                                  Includes                                  */
12 /* -------------------------------------------------------------------------- */
13 #include <stdint.h>
14 
15 /* -------------------------------------------------------------------------- */
16 /*                                Public types                                */
17 /* -------------------------------------------------------------------------- */
18 
19 typedef void (*platform_hdlc_rx_callback_t)(uint8_t *data, uint16_t len, void *param);
20 
21 /* -------------------------------------------------------------------------- */
22 /*                              Public functions                              */
23 /* -------------------------------------------------------------------------- */
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /*!
29  * \brief Initializes HDLC interface
30  *
31  * \param[in] callback Callback called by PLATFORM layer when a HDLC message has been received
32  * \param[in] param Optional parameter passed to the callback
33  * \return int return status: >=0 for success, <0 for errors
34  */
35 int PLATFORM_InitHdlcInterface(platform_hdlc_rx_callback_t callback, void *param);
36 
37 /*!
38  * \brief Terminates HDLC interface
39  *
40  * \return int return status: >=0 for success, <0 for errors
41  */
42 int PLATFORM_TerminateHdlcInterface(void);
43 
44 /*!
45  * \brief Hard reset of the HDLC Interface
46  *
47  * \return int return status: >=0 for success, <0 for errors
48  */
49 int PLATFORM_ResetHdlcInterface(void);
50 
51 /*!
52  * \brief Sends a Spinel HDLC message to Controller.
53  *        This allows complete abstraction of physical transport layers from one
54  *        platform to another.
55  *
56  * \param[in] msg pointer to Spinel HDLC message buffer
57  * \param[in] len size of the message
58  * \return int return status: >=0 for success, <0 for errors
59  */
60 int PLATFORM_SendHdlcMessage(uint8_t *msg, uint32_t len);
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 
66 #endif /* _FWK_PLATFORM_HDLC_H_ */