1 /** @file notification.c
\r
2 * @brief User Notification Definition File
\r
6 * This file defines empty notification routines.
\r
7 * The user needs to remove the while loop and define
\r
14 #include "ti_drv_esm.h"
\r
15 #include "sys_selftest.h"
\r
16 #include "ti_drv_adc.h"
\r
17 #include "ti_drv_can.h"
\r
18 #include "ti_drv_gio.h"
\r
19 #include "ti_drv_lin.h"
\r
20 #include "ti_drv_mibspi.h"
\r
21 #include "ti_drv_sci.h"
\r
22 #include "ti_drv_het.h"
\r
23 #include "ti_drv_i2c.h"
\r
24 /* USER CODE BEGIN (0) */
\r
25 //#include "FreeRTOS.h"
\r
26 //#include "os_semphr.h"
\r
27 //#include "os_task.h"
\r
29 /** @brief Semaphore blocking task when it waits for interrupt signaling message receive
\r
31 * Defined in commands.c */
\r
32 //extern xSemaphoreHandle canMsgReceived;
\r
33 //extern xSemaphoreHandle canMsgSent;
\r
35 /** @brief Data structure containing converted data from ADC
\r
37 * Defined in commands.c */
\r
38 //extern canBASE_t *canDst;
\r
39 //extern canBASE_t *canSrc;
\r
40 //extern uint32_t canMsgBox;
\r
41 //extern uint32_t canSendError;
\r
42 //extern uint32_t canRecError;
\r
45 void esmGroup1Notification(uint32_t channel)
\r
47 /* enter user code and remove the while loop... */
\r
49 /* USER CODE BEGIN (1) */
\r
54 /* USER CODE BEGIN (2) */
\r
57 void esmGroup2Notification(uint32_t channel)
\r
59 /* enter user code and remove the while loop... */
\r
61 /* USER CODE BEGIN (3) */
\r
66 /* USER CODE BEGIN (4) */
\r
69 void memoryPort0TestFailNotification(uint32_t groupSelect, uint32_t dataSelect, uint32_t address, uint32_t data)
\r
71 /* enter user code and remove the while loop... */
\r
73 /* USER CODE BEGIN (5) */
\r
78 /* USER CODE BEGIN (6) */
\r
81 void memoryPort1TestFailNotification(uint32_t groupSelect, uint32_t dataSelect, uint32_t address, uint32_t data)
\r
83 /* enter user code and remove the while loop... */
\r
85 /* USER CODE BEGIN (7) */
\r
90 /* USER CODE BEGIN (8) */
\r
93 /* USER CODE BEGIN (12) */
\r
95 void canErrorNotification(canBASE_t *node, uint32_t notification)
\r
97 /* USER CODE BEGIN (13) */
\r
98 /* FIXME Move this implementation and header somewhere else
\r
99 if (node == canSrc) {
\r
100 canSendError = notification;
\r
101 xSemaphoreGiveFromISR(canMsgSent, NULL);
\r
103 if (node == canDst) {
\r
104 canRecError = notification;
\r
105 xSemaphoreGiveFromISR(canMsgReceived, NULL);
\r
108 /* USER CODE END */
\r
112 /* USER CODE BEGIN (14) */
\r
113 /* USER CODE END */
\r
115 void canMessageNotification(canBASE_t *node, uint32_t messageBox)
\r
117 /* USER CODE BEGIN (15) */
\r
118 /* FIXME Move this implementation and header somewhere else
\r
119 if (messageBox == canMsgBox)
\r
121 if (node == canDst) {
\r
122 // node 2 - receive testloopback message complete
\r
123 while(!canIsRxMessageArrived(node, canMsgBox))
\r
125 xSemaphoreGiveFromISR(canMsgReceived, NULL);
\r
127 if (node == canSrc) {
\r
128 xSemaphoreGiveFromISR(canMsgSent, NULL);
\r
133 /* USER CODE END */
\r
137 /* USER CODE BEGIN (16) */
\r
138 /* USER CODE END */
\r
139 void gioNotification(int bit)
\r
141 /* enter user code and remove the while loop... */
\r
143 /* USER CODE BEGIN (19) */
\r
144 /* USER CODE END */
\r
148 /* USER CODE BEGIN (20) */
\r
149 /* USER CODE END */
\r
150 void i2cNotification(i2cBASE_t *i2c, uint32_t flags)
\r
152 /* enter user code and remove the while loop... */
\r
154 /* USER CODE BEGIN (21) */
\r
155 /* USER CODE END */
\r
159 /* USER CODE BEGIN (24) */
\r
160 /* USER CODE END */
\r
161 void mibspiNotification(mibspiBASE_t *mibspi, uint32_t flags)
\r
163 /* enter user code and remove the while loop... */
\r
165 /* USER CODE BEGIN (25) */
\r
166 /* USER CODE END */
\r
170 /* USER CODE BEGIN (26) */
\r
171 /* USER CODE END */
\r
173 void mibspiGroupNotification(mibspiBASE_t *mibspi, uint32_t group)
\r
175 /* enter user code and remove the while loop... */
\r
177 /* USER CODE BEGIN (27) */
\r
178 /* USER CODE END */
\r
181 /* USER CODE BEGIN (28) */
\r
182 /* USER CODE END */
\r
184 void sciNotification(sciBASE_t *sci, uint32_t flags)
\r
186 /* USER CODE BEGIN (29) */
\r
187 if (sci == sciREG) {
\r
188 if (flags & SCI_RX_INT) {
\r
189 sciReceive(sci, 1, NULL); // Restart receiving
\r
192 /* USER CODE END */
\r
196 /* USER CODE BEGIN (30) */
\r
197 /* USER CODE END */
\r
198 void pwmNotification(hetBASE_t * hetREG,uint32_t pwm, uint32_t notification)
\r
200 /* enter user code and remove the while loop... */
\r
202 /* USER CODE BEGIN (33) */
\r
203 /* USER CODE END */
\r
207 /* USER CODE BEGIN (34) */
\r
208 /* USER CODE END */
\r
210 void edgeNotification(hetBASE_t * hetREG,uint32_t edge)
\r
212 /* enter user code and remove the while loop... */
\r
214 /* USER CODE BEGIN (35) */
\r
215 /* USER CODE END */
\r
219 /* USER CODE BEGIN (36) */
\r
220 /* USER CODE END */
\r
222 void hetNotification(hetBASE_t *het, uint32_t offset)
\r
224 /* enter user code and remove the while loop... */
\r
226 /* USER CODE BEGIN (37) */
\r
227 /* USER CODE END */
\r
231 /** Semaphore used to stop command, until message is received */
\r
232 //xSemaphoreHandle linMsgReceived;
\r
233 /** Semaphore used to stop command, until ID is received */
\r
234 //xSemaphoreHandle linIDReceived;
\r
235 void linNotification(linBASE_t *lin, uint32_t flags)
\r
237 /* FIXME Move this code somewhere else. It was in cmd_lin.c
\r
238 if (flags & LIN_ID_INT) {
\r
239 xSemaphoreGiveFromISR(linIDReceived, NULL);
\r
241 if (flags & LIN_RX_INT) {
\r
242 lin->FLR |= (1 << 9);
\r
243 xSemaphoreGiveFromISR(linMsgReceived, NULL);
\r
249 #pragma INTERRUPT(EMACCore0RxIsr, FIQ)
\r
250 void EMACCore0RxIsr(void)
\r
252 /* FIXME was in cmd_emac.c and should move somewhere else.
\r
255 // We know we have only one RX Packet Buffer descriptor --
\r
256 // so we write it in CP to disable interrupt
\r
257 EMACRxCPWrite(emacBase, channel, (unsigned int)rx_desc);
\r
258 EMACCoreIntAck(emacBase, EMAC_INT_CORE0_RX);
\r
262 #pragma INTERRUPT(EMACCore0TxIsr, FIQ)
\r
263 void EMACCore0TxIsr(void)
\r
265 /* FIXME Was in cmd_emac.c and should move somewhere else
\r
267 // If is not being processed by the EMAC anymore
\r
268 if (!(fr1.PktFlgLen & EMAC_DSC_FLAG_OWNER)) {
\r
269 EMACTxCPWrite(emacBase, channel, (unsigned int)&fr1);
\r
270 EMACCoreIntAck(emacBase, EMAC_INT_CORE0_TX);
\r
276 /* USER CODE BEGIN (38) */
\r
277 /* USER CODE END */
\r