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"
29 #include "rpp/RppConfig.h"
35 void esmGroup1Notification(uint32_t channel)
37 /* enter user code and remove the while loop... */
39 /* USER CODE BEGIN (1) */
44 /* USER CODE BEGIN (2) */
47 void esmGroup2Notification(uint32_t channel)
49 /* enter user code and remove the while loop... */
51 /* USER CODE BEGIN (3) */
56 /* USER CODE BEGIN (4) */
59 void memoryPort0TestFailNotification(uint32_t groupSelect, uint32_t dataSelect, uint32_t address, uint32_t data)
61 /* enter user code and remove the while loop... */
63 /* USER CODE BEGIN (5) */
68 /* USER CODE BEGIN (6) */
71 void memoryPort1TestFailNotification(uint32_t groupSelect, uint32_t dataSelect, uint32_t address, uint32_t data)
73 /* enter user code and remove the while loop... */
75 /* USER CODE BEGIN (7) */
80 /* USER CODE BEGIN (8) */
83 /* USER CODE BEGIN (12) */
84 /** @brief Semaphore blocking task when it waits for interrupt signaling message receive
87 // FIXME It seems that all the following are test application specific, because no one
88 // else in the library uses this variables. The functionality the notification
89 // provides could be replaced with a proper interface between subsystems.
90 // This where called extern on the file, which is not a good approach to include
91 // application specific variables in lower layers, coupling bidireccionally both
93 // This was moved from cmd_can.c
94 /** Semaphore used for blocking task until message is received */
95 xSemaphoreHandle canMsgReceived;
96 /** Semaphore used for blocking task until message is sent */
97 xSemaphoreHandle canMsgSent;
98 /** Pointer to Destination CAN registers */
100 /** Pointer to Source CAN registers */
102 /** Can message box for received messages */
104 /** Error counter for errors in sending */
105 uint32_t canSendError;
106 /** Error counter for errors in receiving */
107 uint32_t canRecError;
110 void canErrorNotification(canBASE_t *node, uint32_t notification)
112 /* USER CODE BEGIN (13) */
114 if (node == canSrc) {
115 canSendError = notification;
116 xSemaphoreGiveFromISR(canMsgSent, NULL);
118 if (node == canDst) {
119 canRecError = notification;
120 xSemaphoreGiveFromISR(canMsgReceived, NULL);
127 /* USER CODE BEGIN (14) */
130 void canMessageNotification(canBASE_t *node, uint32_t messageBox)
132 /* USER CODE BEGIN (15) */
134 if (messageBox == canMsgBox)
136 if (node == canDst) {
137 // node 2 - receive testloopback message complete
138 while(!canIsRxMessageArrived(node, canMsgBox))
140 xSemaphoreGiveFromISR(canMsgReceived, NULL);
142 if (node == canSrc) {
143 xSemaphoreGiveFromISR(canMsgSent, NULL);
149 /* USER CODE BEGIN (16) */
151 void gioNotification(int bit)
153 /* enter user code and remove the while loop... */
155 /* USER CODE BEGIN (19) */
160 /* USER CODE BEGIN (20) */
162 void i2cNotification(i2cBASE_t *i2c, uint32_t flags)
164 /* enter user code and remove the while loop... */
166 /* USER CODE BEGIN (21) */
171 /* USER CODE BEGIN (24) */
173 void mibspiNotification(mibspiBASE_t *mibspi, uint32_t flags)
175 /* enter user code and remove the while loop... */
177 /* USER CODE BEGIN (25) */
182 /* USER CODE BEGIN (26) */
185 void mibspiGroupNotification(mibspiBASE_t *mibspi, uint32_t group)
187 /* enter user code and remove the while loop... */
189 /* USER CODE BEGIN (27) */
193 /* USER CODE BEGIN (28) */
196 /* USER CODE BEGIN (30) */
198 void pwmNotification(hetBASE_t * hetREG,uint32_t pwm, uint32_t notification)
200 /* enter user code and remove the while loop... */
202 /* USER CODE BEGIN (33) */
207 /* USER CODE BEGIN (34) */
210 void edgeNotification(hetBASE_t * hetREG,uint32_t edge)
212 /* enter user code and remove the while loop... */
214 /* USER CODE BEGIN (35) */
219 /* USER CODE BEGIN (36) */
222 void hetNotification(hetBASE_t *het, uint32_t offset)
224 /* enter user code and remove the while loop... */
226 /* USER CODE BEGIN (37) */
231 /** Semaphore used to stop command, until message is received */
232 xSemaphoreHandle linMsgReceived;
233 /** Semaphore used to stop command, until ID is received */
234 xSemaphoreHandle linIDReceived;
235 void linNotification(linBASE_t *lin, uint32_t flags)
237 /* FIXME Moved code from somewhere else. It was in cmd_lin.c
238 * It seems that nobody in the library uses this.
239 * sys/ti_drv_lin.c calls this function from linLowLevelInterrupt()
240 * The function prototipe is in sys/ti_drv_lin.h, so maybe it should be
241 * better to move it there, but because it is a "high-level" notification
244 if (flags & LIN_ID_INT) {
245 xSemaphoreGiveFromISR(linIDReceived, NULL);
247 if (flags & LIN_RX_INT) {
248 lin->FLR |= (1 << 9);
249 xSemaphoreGiveFromISR(linMsgReceived, NULL);
253 #ifndef FREERTOS_POSIX
254 extern boolean_t HostPendErrHandler(void);
255 #if PHY_LINK_MONITOR_INT
256 extern boolean_t LinkIntHandler(void);
258 #pragma INTERRUPT(MDIOMiscInt, IRQ)
259 void MDIOMiscInt(void)
261 if(HostPendErrHandler())return;
262 #if PHY_LINK_MONITOR_INT
263 if(LinkIntHandler())return;
267 extern void RxIntHandler(uint32_t instNum);
268 extern void TxIntHandler(uint32_t instNum);
270 volatile int countEMACCore0RxIsr = 0;
271 #pragma INTERRUPT(EMACCore0RxIsr, IRQ)
272 void EMACCore0RxIsr(void)
274 countEMACCore0RxIsr++;
276 /* FIXME was in emac_cmd.c/eth.c and should move somewhere else.
279 // We know we have only one RX Packet Buffer descriptor --
280 // so we write it in CP to disable interrupt
281 EMACRxCPWrite(emacBase, channel, (unsigned int)rx_desc);
282 EMACCoreIntAck(emacBase, EMAC_INT_CORE0_RX);
286 volatile int countEMACCore0TxIsr = 0;
287 #pragma INTERRUPT(EMACCore0TxIsr, IRQ)
288 void EMACCore0TxIsr(void)
290 countEMACCore0TxIsr++;
292 /* FIXME Was in emac_cmd.c/eth.c and should move somewhere else
294 // If is not being processed by the EMAC anymore
295 if (!(fr1.PktFlgLen & EMAC_DSC_FLAG_OWNER)) {
296 EMACTxCPWrite(emacBase, channel, (unsigned int)&fr1);
297 EMACCoreIntAck(emacBase, EMAC_INT_CORE0_TX);
303 /* USER CODE BEGIN (38) */