callbacks.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 NXP
3  * All rights reserved.
4  *
5  * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
6  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
7  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
8  * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
9  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
10  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
11  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
12  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
13  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
14  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
15  * THE POSSIBILITY OF SUCH DAMAGE.
16  */
17 
18 #ifndef CALLBACKS_H
19 #define CALLBACKS_H
20 #include <stdint.h>
31  #include <stdint.h>
32 
33 /*******************************************************************************
34  * Definitions
35  ******************************************************************************/
36 
44 typedef enum
45 {
52 
60 typedef enum
61 {
64 
65 
66 /* Callback for all peripherals which supports I2C features for slave mode */
67 typedef void (*i2c_slave_callback_t)(i2c_slave_event_t event, void *userData);
68 
69 /* Callback for all peripherals which supports I2C features for master mode */
70 typedef void (*i2c_master_callback_t)(i2c_master_event_t event, void *userData);
71 
72 /* Define the enum of the events which can trigger SPI callback
73  * This enum should include the events for all platforms
74  */
75 typedef enum
76 {
78 } spi_event_t;
79 
80 /* Callback for all peripherals which supports SPI features */
81 typedef void (*spi_callback_t)(void *driverState, spi_event_t event, void *userData);
82 
90 typedef enum
91 {
95  UART_EVENT_ERROR = 0x03U,
96 } uart_event_t;
97 
103 typedef void (*uart_callback_t)(void *driverState, uart_event_t event, void *userData);
104 
105 
106 /* Callback for all peripherals which support TIMING features */
107 typedef void (*timer_callback_t)(void *userData);
108 
109 
110 /* Define the structure for input parameter to the callback functions for ADC PAL
111  */
112 typedef struct
113 {
114  uint32_t groupIndex;
115  uint16_t resultBufferTail;
117 
118 typedef void (* const adc_callback_t)(const adc_callback_info_t * const callbackInfo, void * userData);
119 
120 /* I2S */
121 /* Define the enum of the events which can trigger i2s callback */
122 /* Events for all peripherals which support i2s
123  *
124  * Implements : i2s_event_t_Class
125  */
126 typedef enum
127 {
135  I2S_EVENT_ERROR = 0x03U,
136 } i2s_event_t;
137 
138 /* Callback for all peripherals which support i2s
139  *
140  * Implements : i2s_callback_t_Class
141  */
142 typedef void (*i2s_callback_t)(i2s_event_t event, void *userData);
143 
144 /* Define the enum of the events which can trigger CAN callback
145  * This enum should include the events for all platforms
146  *
147  * Implements : can_event_t_Class
148  */
149 typedef enum {
152 } can_event_t;
153 
154 /* Callback for all peripherals which support CAN features
155  *
156  * Implements : can_callback_t_Class
157  */
158 typedef void (*can_callback_t)(uint32_t instance,
159  can_event_t eventType,
160  uint32_t objIdx,
161  void *driverState);
162 
168 typedef void (*security_callback_t)(uint32_t completedCmd, void *callbackParam);
169 
170 /* Define the enum of the events which can trigger the output compare callback */
171 typedef enum
172 {
174 } oc_event_t;
175 
176 /* Callback for all peripherals which support OC feature */
177 typedef void (*oc_callback_t)(oc_event_t event, void *userData);
178 /* Define the enum of the events which can trigger the input capture callback */
179 typedef enum
180 {
182 } ic_event_t;
183 
184 /* Callback for all peripherals which support IC feature */
185 typedef void (*ic_callback_t)(ic_event_t event, void *userData);
186 
187 #endif /* CALLBACKS_H */
188 
189 /*******************************************************************************
190  * EOF
191  ******************************************************************************/
i2c_slave_event_t
Define the enum of the events which can trigger I2C slave callback.
Definition: callbacks.h:44
void(* spi_callback_t)(void *driverState, spi_event_t event, void *userData)
Definition: callbacks.h:81
oc_event_t
Definition: callbacks.h:171
void(* i2c_master_callback_t)(i2c_master_event_t event, void *userData)
Definition: callbacks.h:70
ic_event_t
Definition: callbacks.h:179
void(* can_callback_t)(uint32_t instance, can_event_t eventType, uint32_t objIdx, void *driverState)
Definition: callbacks.h:158
void(* security_callback_t)(uint32_t completedCmd, void *callbackParam)
Callback for security modules.
Definition: callbacks.h:168
void(* ic_callback_t)(ic_event_t event, void *userData)
Definition: callbacks.h:185
i2c_master_event_t
Define the enum of the events which can trigger I2C master callback.
Definition: callbacks.h:60
uint32_t groupIndex
Definition: callbacks.h:114
i2s_event_t
Definition: callbacks.h:126
void(* i2s_callback_t)(i2s_event_t event, void *userData)
Definition: callbacks.h:142
void(* oc_callback_t)(oc_event_t event, void *userData)
Definition: callbacks.h:177
void(* i2c_slave_callback_t)(i2c_slave_event_t event, void *userData)
Definition: callbacks.h:67
spi_event_t
Definition: callbacks.h:75
void(* uart_callback_t)(void *driverState, uart_event_t event, void *userData)
Callback for all peripherals which support UART features.
Definition: callbacks.h:103
uart_event_t
Define the enum of the events which can trigger UART callback.
Definition: callbacks.h:90
uint16_t resultBufferTail
Definition: callbacks.h:115
void(* timer_callback_t)(void *userData)
Definition: callbacks.h:107
void(*const adc_callback_t)(const adc_callback_info_t *const callbackInfo, void *userData)
Definition: callbacks.h:118
can_event_t
Definition: callbacks.h:149