1 /** @file notification.c
2 * @brief User Notification Definition File
6 * This file defines empty notification routines.
7 * The user needs to remove the while loop and define
14 //#include "ti_drv_esm.h"
15 //#include "sys_selftest.h"
16 //#include "ti_drv_adc.h"
17 //#include "ti_drv_can.h"
18 //#include "ti_drv_gio.h"
19 //#include "ti_drv_lin.h"
20 //#include "ti_drv_mibspi.h"
21 //#include "ti_drv_sci.h"
22 //#include "ti_drv_het.h"
23 //#include "ti_drv_i2c.h"
24 /* USER CODE BEGIN (0) */
25 //#include "FreeRTOS.h"
26 //#include "os_semphr.h"
27 //#include "os_task.h"
33 void esmGroup1Notification(uint32_t channel)
35 /* enter user code and remove the while loop... */
37 /* USER CODE BEGIN (1) */
42 /* USER CODE BEGIN (2) */
45 void esmGroup2Notification(uint32_t channel)
47 /* enter user code and remove the while loop... */
49 /* USER CODE BEGIN (3) */
54 /* USER CODE BEGIN (4) */
57 void memoryPort0TestFailNotification(uint32_t groupSelect, uint32_t dataSelect, uint32_t address, uint32_t data)
59 /* enter user code and remove the while loop... */
61 /* USER CODE BEGIN (5) */
66 /* USER CODE BEGIN (6) */
69 void memoryPort1TestFailNotification(uint32_t groupSelect, uint32_t dataSelect, uint32_t address, uint32_t data)
71 /* enter user code and remove the while loop... */
73 /* USER CODE BEGIN (7) */
78 /* USER CODE BEGIN (8) */
81 /* USER CODE BEGIN (12) */
82 /** @brief Semaphore blocking task when it waits for interrupt signaling message receive
85 // FIXME It seems that all this are test application specific, because no one
86 // else in the library uses this variables. The functionality the notification
87 // provides could be replaced with a proper interface between subsystems.
88 // This where called extern on the file, which is not a good approach to include
89 // application specific variables in lower layers, coupling bidireccionally both
91 // This was moved from cmd_can.c
92 /** Semaphore used for blocking task until message is received */
93 xSemaphoreHandle canMsgReceived;
94 /** Semaphore used for blocking task until message is sent */
95 xSemaphoreHandle canMsgSent;
96 /** Pointer to Destination CAN registers */
98 /** Pointer to Source CAN registers */
100 /** Can message box for received messages */
102 /** Error counter for errors in sending */
103 uint32_t canSendError;
104 /** Error counter for errors in receiving */
105 uint32_t canRecError;
108 void canErrorNotification(canBASE_t *node, uint32_t notification)
110 /* USER CODE BEGIN (13) */
112 if (node == canSrc) {
113 canSendError = notification;
114 xSemaphoreGiveFromISR(canMsgSent, NULL);
116 if (node == canDst) {
117 canRecError = notification;
118 xSemaphoreGiveFromISR(canMsgReceived, NULL);
125 /* USER CODE BEGIN (14) */
128 void canMessageNotification(canBASE_t *node, uint32_t messageBox)
130 /* USER CODE BEGIN (15) */
132 if (messageBox == canMsgBox)
134 if (node == canDst) {
135 // node 2 - receive testloopback message complete
136 while(!canIsRxMessageArrived(node, canMsgBox))
138 xSemaphoreGiveFromISR(canMsgReceived, NULL);
140 if (node == canSrc) {
141 xSemaphoreGiveFromISR(canMsgSent, NULL);
147 /* USER CODE BEGIN (16) */
149 void gioNotification(int bit)
151 /* enter user code and remove the while loop... */
153 /* USER CODE BEGIN (19) */
158 /* USER CODE BEGIN (20) */
160 void i2cNotification(i2cBASE_t *i2c, uint32_t flags)
162 /* enter user code and remove the while loop... */
164 /* USER CODE BEGIN (21) */
169 /* USER CODE BEGIN (24) */
171 void mibspiNotification(mibspiBASE_t *mibspi, uint32_t flags)
173 /* enter user code and remove the while loop... */
175 /* USER CODE BEGIN (25) */
180 /* USER CODE BEGIN (26) */
183 void mibspiGroupNotification(mibspiBASE_t *mibspi, uint32_t group)
185 /* enter user code and remove the while loop... */
187 /* USER CODE BEGIN (27) */
191 /* USER CODE BEGIN (28) */
194 void sciNotification(sciBASE_t *sci, uint32_t flags)
196 /* USER CODE BEGIN (29) */
198 if (flags & SCI_RX_INT) {
199 sciReceive(sci, 1, NULL); // Restart receiving
206 /* USER CODE BEGIN (30) */
208 void pwmNotification(hetBASE_t * hetREG,uint32_t pwm, uint32_t notification)
210 /* enter user code and remove the while loop... */
212 /* USER CODE BEGIN (33) */
217 /* USER CODE BEGIN (34) */
220 void edgeNotification(hetBASE_t * hetREG,uint32_t edge)
222 /* enter user code and remove the while loop... */
224 /* USER CODE BEGIN (35) */
229 /* USER CODE BEGIN (36) */
232 void hetNotification(hetBASE_t *het, uint32_t offset)
234 /* enter user code and remove the while loop... */
236 /* USER CODE BEGIN (37) */
241 /** Semaphore used to stop command, until message is received */
242 xSemaphoreHandle linMsgReceived;
243 /** Semaphore used to stop command, until ID is received */
244 xSemaphoreHandle linIDReceived;
245 void linNotification(linBASE_t *lin, uint32_t flags)
247 /* FIXME Moved code from somewhere else. It was in cmd_lin.c
248 * It seems that nobody in the library uses this.
249 * sys/ti_drv_lin.c calls this function from linLowLevelInterrupt()
250 * The function prototipe is in sys/ti_drv_lin.h, so maybe it should be
251 * better to move it there, but because it is a "high-level" notification
254 if (flags & LIN_ID_INT) {
255 xSemaphoreGiveFromISR(linIDReceived, NULL);
257 if (flags & LIN_RX_INT) {
258 lin->FLR |= (1 << 9);
259 xSemaphoreGiveFromISR(linMsgReceived, NULL);
264 #pragma INTERRUPT(EMACCore0RxIsr, FIQ)
265 void EMACCore0RxIsr(void)
267 /* FIXME was in cmd_emac.c and should move somewhere else.
270 // We know we have only one RX Packet Buffer descriptor --
271 // so we write it in CP to disable interrupt
272 EMACRxCPWrite(emacBase, channel, (unsigned int)rx_desc);
273 EMACCoreIntAck(emacBase, EMAC_INT_CORE0_RX);
277 #pragma INTERRUPT(EMACCore0TxIsr, FIQ)
278 void EMACCore0TxIsr(void)
280 /* FIXME Was in cmd_emac.c and should move somewhere else
282 // If is not being processed by the EMAC anymore
283 if (!(fr1.PktFlgLen & EMAC_DSC_FLAG_OWNER)) {
284 EMACTxCPWrite(emacBase, channel, (unsigned int)&fr1);
285 EMACCoreIntAck(emacBase, EMAC_INT_CORE0_TX);
291 /* USER CODE BEGIN (38) */