]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - rpp/src/sys/notification.c
Just renamed some folders.
[pes-rpp/rpp-lib.git] / rpp / src / sys / notification.c
1 /** @file notification.c\r
2 *   @brief User Notification Definition File\r
3 *   @date 15.Mar.2012\r
4 *   @version 03.01.00\r
5 *\r
6 *   This file  defines  empty  notification  routines.\r
7 *   The user needs to remove the while loop and define\r
8 *   the sequence.\r
9 *\r
10 */\r
11 \r
12 /* Include Files */\r
13 \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
28 \r
29 /** @brief Semaphore blocking task when it waits for interrupt signaling message receive\r
30  *\r
31  * Defined in commands.c */\r
32 //extern xSemaphoreHandle canMsgReceived;\r
33 //extern xSemaphoreHandle canMsgSent;\r
34 \r
35 /** @brief Data structure containing converted data from ADC\r
36  *\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
43 /* USER CODE END */\r
44 \r
45 void esmGroup1Notification(uint32_t channel)\r
46 {\r
47 /*  enter user code and remove the while loop... */\r
48     while(1);\r
49 /* USER CODE BEGIN (1) */\r
50 /* USER CODE END */\r
51 \r
52 }\r
53 \r
54 /* USER CODE BEGIN (2) */\r
55 /* USER CODE END */\r
56 \r
57 void esmGroup2Notification(uint32_t channel)\r
58 {\r
59 /*  enter user code and remove the while loop... */\r
60     while(1);\r
61 /* USER CODE BEGIN (3) */\r
62 /* USER CODE END */\r
63 \r
64 }\r
65 \r
66 /* USER CODE BEGIN (4) */\r
67 /* USER CODE END */\r
68 \r
69 void memoryPort0TestFailNotification(uint32_t groupSelect, uint32_t dataSelect, uint32_t address, uint32_t data)\r
70 {\r
71 /*  enter user code and remove the while loop... */\r
72     while(1);\r
73 /* USER CODE BEGIN (5) */\r
74 /* USER CODE END */\r
75 \r
76 }\r
77 \r
78 /* USER CODE BEGIN (6) */\r
79 /* USER CODE END */\r
80 \r
81 void memoryPort1TestFailNotification(uint32_t groupSelect, uint32_t dataSelect, uint32_t address, uint32_t data)\r
82 {\r
83 /*  enter user code and remove the while loop... */\r
84     while(1);\r
85 /* USER CODE BEGIN (7) */\r
86 /* USER CODE END */\r
87 \r
88 }\r
89 \r
90 /* USER CODE BEGIN (8) */\r
91 /* USER CODE END */\r
92 \r
93 /* USER CODE BEGIN (12) */\r
94 /* USER CODE END */\r
95 void canErrorNotification(canBASE_t *node, uint32_t notification)\r
96 {\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
102     }\r
103     if (node == canDst) {\r
104         canRecError = notification;\r
105         xSemaphoreGiveFromISR(canMsgReceived, NULL);\r
106     }\r
107     */\r
108 /* USER CODE END */\r
109 \r
110 }\r
111 \r
112 /* USER CODE BEGIN (14) */\r
113 /* USER CODE END */\r
114 \r
115 void canMessageNotification(canBASE_t *node, uint32_t messageBox)\r
116 {\r
117 /* USER CODE BEGIN (15) */\r
118     /* FIXME Move this implementation and header somewhere else\r
119     if (messageBox == canMsgBox)\r
120     {\r
121         if (node == canDst) {\r
122              // node 2 - receive testloopback message complete\r
123              while(!canIsRxMessageArrived(node, canMsgBox))\r
124                  ;\r
125              xSemaphoreGiveFromISR(canMsgReceived, NULL);\r
126         }\r
127         if (node == canSrc) {\r
128              xSemaphoreGiveFromISR(canMsgSent, NULL);\r
129         }\r
130     }\r
131     */\r
132 \r
133 /* USER CODE END */\r
134 \r
135 }\r
136 \r
137 /* USER CODE BEGIN (16) */\r
138 /* USER CODE END */\r
139 void gioNotification(int bit)\r
140 {\r
141 /*  enter user code and remove the while loop... */\r
142     while(1);\r
143 /* USER CODE BEGIN (19) */\r
144 /* USER CODE END */\r
145 \r
146 }\r
147 \r
148 /* USER CODE BEGIN (20) */\r
149 /* USER CODE END */\r
150 void i2cNotification(i2cBASE_t *i2c, uint32_t flags)\r
151 {\r
152 /*  enter user code and remove the while loop... */\r
153     while(1);\r
154 /* USER CODE BEGIN (21) */\r
155 /* USER CODE END */\r
156 \r
157 }\r
158 \r
159 /* USER CODE BEGIN (24) */\r
160 /* USER CODE END */\r
161 void mibspiNotification(mibspiBASE_t *mibspi, uint32_t flags)\r
162 {\r
163 /*  enter user code and remove the while loop... */\r
164     while(1);\r
165 /* USER CODE BEGIN (25) */\r
166 /* USER CODE END */\r
167 \r
168 }\r
169 \r
170 /* USER CODE BEGIN (26) */\r
171 /* USER CODE END */\r
172 \r
173 void mibspiGroupNotification(mibspiBASE_t *mibspi, uint32_t group)\r
174 {\r
175 /*  enter user code and remove the while loop... */\r
176     while(1);\r
177 /* USER CODE BEGIN (27) */\r
178 /* USER CODE END */\r
179 \r
180 }\r
181 /* USER CODE BEGIN (28) */\r
182 /* USER CODE END */\r
183 \r
184 void sciNotification(sciBASE_t *sci, uint32_t flags)\r
185 {\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
190         }\r
191     }\r
192 /* USER CODE END */\r
193 \r
194 }\r
195 \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
199 {\r
200 /*  enter user code and remove the while loop... */\r
201     while(1);\r
202 /* USER CODE BEGIN (33) */\r
203 /* USER CODE END */\r
204 \r
205 }\r
206 \r
207 /* USER CODE BEGIN (34) */\r
208 /* USER CODE END */\r
209 \r
210 void edgeNotification(hetBASE_t * hetREG,uint32_t edge)\r
211 {\r
212 /*  enter user code and remove the while loop... */\r
213     while(1);\r
214 /* USER CODE BEGIN (35) */\r
215 /* USER CODE END */\r
216 \r
217 }\r
218 \r
219 /* USER CODE BEGIN (36) */\r
220 /* USER CODE END */\r
221 \r
222 void hetNotification(hetBASE_t *het, uint32_t offset)\r
223 {\r
224 /*  enter user code and remove the while loop... */\r
225     while(1);\r
226 /* USER CODE BEGIN (37) */\r
227 /* USER CODE END */\r
228 \r
229 }\r
230 \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
236 {\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
240         }\r
241         if (flags & LIN_RX_INT) {\r
242             lin->FLR |= (1 << 9);\r
243             xSemaphoreGiveFromISR(linMsgReceived, NULL);\r
244         }\r
245      */\r
246 }\r
247 \r
248 \r
249 #pragma INTERRUPT(EMACCore0RxIsr, FIQ)\r
250 void EMACCore0RxIsr(void)\r
251 {\r
252     /* FIXME was in cmd_emac.c and should move somewhere else.\r
253     rx_irq_cnt++;\r
254 \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
259     */\r
260 }\r
261 \r
262 #pragma INTERRUPT(EMACCore0TxIsr, FIQ)\r
263 void EMACCore0TxIsr(void)\r
264 {\r
265     /* FIXME Was in cmd_emac.c and should move somewhere else\r
266     tx_irq_cnt++;\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
271     }\r
272     */\r
273 }\r
274 \r
275 \r
276 /* USER CODE BEGIN (38) */\r
277 /* USER CODE END */\r