Mistake on this page?
Report an issue in GitHub or email us
shci_tl.h
Go to the documentation of this file.
1 /**
2  ******************************************************************************
3  * @file shci_tl.h
4  * @author MCD Application Team
5  * @brief System HCI command header for the system channel
6  ******************************************************************************
7  * @attention
8  *
9  * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
10  * All rights reserved.</center></h2>
11  *
12  * This software component is licensed by ST under BSD 3-Clause license,
13  * the "License"; You may not use this file except in compliance with the
14  * License. You may obtain a copy of the License at:
15  * opensource.org/licenses/BSD-3-Clause
16  *
17  ******************************************************************************
18  */
19 
20 
21 #ifndef __SHCI_TL_H_
22 #define __SHCI_TL_H_
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #include "tl.h"
29 
30 /* Exported defines -----------------------------------------------------------*/
31 typedef enum
32 {
33  SHCI_TL_UserEventFlow_Disable,
34  SHCI_TL_UserEventFlow_Enable,
35 } SHCI_TL_UserEventFlowStatus_t;
36 
37 typedef enum
38 {
39  SHCI_TL_CmdBusy,
40  SHCI_TL_CmdAvailable
41 } SHCI_TL_CmdStatus_t;
42 
43 /**
44  * @brief Structure used to manage the BUS IO operations.
45  * All the structure fields will point to functions defined at user level.
46  * @{
47  */
48 typedef struct
49 {
50  int32_t (* Init) (void* pConf); /**< Pointer to SHCI TL function for the IO Bus initialization */
51  int32_t (* DeInit) (void); /**< Pointer to SHCI TL function for the IO Bus de-initialization */
52  int32_t (* Reset) (void); /**< Pointer to SHCI TL function for the IO Bus reset */
53  int32_t (* Receive) (uint8_t*, uint16_t); /**< Pointer to SHCI TL function for the IO Bus data reception */
54  int32_t (* Send) (uint8_t*, uint16_t); /**< Pointer to SHCI TL function for the IO Bus data transmission */
55  int32_t (* DataAck) (uint8_t*, uint16_t* len); /**< Pointer to SHCI TL function for the IO Bus data ack reception */
56  int32_t (* GetTick) (void); /**< Pointer to BSP function for getting the HAL time base timestamp */
57 } tSHciIO;
58 /**
59  * @}
60  */
61 
62 /**
63  * @brief Contain the SHCI context
64  * @{
65  */
66 typedef struct
67 {
68  tSHciIO io; /**< Manage the BUS IO operations */
69  void (* UserEvtRx) (void * pData); /**< User System events callback function pointer */
70 } tSHciContext;
71 
72 typedef struct
73 {
74  SHCI_TL_UserEventFlowStatus_t status;
75  TL_EvtPacket_t *pckt;
77 
78 typedef struct
79 {
80  uint8_t *p_cmdbuffer;
81  void (* StatusNotCallBack) (SHCI_TL_CmdStatus_t status);
83 
84 /**
85  * shci_send
86  * @brief Send an System HCI Command
87  *
88  * @param : cmd_code = Opcode of the command
89  * @param : len_cmd_payload = Length of the command payload
90  * @param : p_cmd_payload = Address of the command payload
91  * @param : p_rsp_status = Address of the full buffer holding the command complete event
92  * @retval : None
93  */
94 void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payload, TL_EvtPacket_t * p_rsp_status );
95 
96 /**
97  * @brief Register IO bus services.
98  * @param fops The SHCI IO structure managing the IO BUS
99  * @retval None
100  */
101 void shci_register_io_bus(tSHciIO* fops);
102 
103 /**
104  * @brief Interrupt service routine that must be called when the system channel
105  * reports a packet has been received
106  *
107  * @param pdata Packet or event pointer
108  * @retval None
109  */
110 void shci_notify_asynch_evt(void* pdata);
111 
112 /**
113  * @brief This function resume the User Event Flow which has been stopped on return
114  * from UserEvtRx() when the User Event has not been processed.
115  *
116  * @param None
117  * @retval None
118  */
119 void shci_resume_flow(void);
120 
121 
122 /**
123  * @brief This function is called when an System HCI Command is sent to the CPU2 and the response is waited.
124  * It is called from the same context the System HCI command has been sent.
125  * It shall not return until the command response notified by shci_cmd_resp_release() is received.
126  * A weak implementation is available in shci_tl.c based on polling mechanism
127  * The user may re-implement this function in the application to improve performance :
128  * - It may use UTIL_SEQ_WaitEvt() API when using the Sequencer
129  * - It may use a semaphore when using cmsis_os interface
130  *
131  * @param timeout: Waiting timeout
132  * @retval None
133  */
134 void shci_cmd_resp_wait(uint32_t timeout);
135 
136 /**
137  * @brief This function is called when an System HCI command is received from the CPU2.
138  * A weak implementation is available in shci_tl.c based on polling mechanism
139  * The user may re-implement this function in the application to improve performance :
140  * - It may use UTIL_SEQ_SetEvt() API when using the Sequencer
141  * - It may use a semaphore when using cmsis_os interface
142  *
143  *
144  * @param flag: Release flag
145  * @retval None
146  */
147 void shci_cmd_resp_release(uint32_t flag);
148 
149 
150 /**
151  * @brief This process shall be called each time the shci_notify_asynch_evt notification is received
152  *
153  * @param None
154  * @retval None
155  */
156 
157 void shci_user_evt_proc(void);
158 
159 /**
160  * @brief Initialize the System Host Controller Interface.
161  * This function must be called before any communication on the System Channel
162  *
163  * @param pData: System events callback function pointer
164  * This callback is triggered when an user event is received on
165  * the System Channel from CPU2.
166  * @param pConf: Configuration structure pointer
167  * @retval None
168  */
169 void shci_init(void(* UserEvtRx)(void* pData), void* pConf);
170 
171 #ifdef __cplusplus
172 }
173 #endif
174 
175 #endif /* __SHCI_TL_H_ */
Structure used to manage the BUS IO operations.
Definition: shci_tl.h:48
void shci_register_io_bus(tSHciIO *fops)
Register IO bus services.
void shci_resume_flow(void)
This function resume the User Event Flow which has been stopped on return from UserEvtRx() when the U...
void shci_send(uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t *p_cmd_payload, TL_EvtPacket_t *p_rsp_status)
shci_send
void shci_user_evt_proc(void)
This process shall be called each time the shci_notify_asynch_evt notification is received...
void shci_notify_asynch_evt(void *pdata)
Interrupt service routine that must be called when the system channel reports a packet has been recei...
Contain the SHCI context.
Definition: shci_tl.h:66
tSHciIO io
Manage the BUS IO operations.
Definition: shci_tl.h:68
Header for tl module.
void shci_init(void(*UserEvtRx)(void *pData), void *pConf)
Initialize the System Host Controller Interface.
void shci_cmd_resp_wait(uint32_t timeout)
This function is called when an System HCI Command is sent to the CPU2 and the response is waited...
void shci_cmd_resp_release(uint32_t flag)
This function is called when an System HCI command is received from the CPU2.
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.