]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blob - source/notification.c
5f23ae74fea48b7e3109bdcbc4bba97aa4e81dd6
[pes-rpp/rpp-test-sw.git] / source / 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 "esm.h"\r
15 #include "sys_selftest.h"\r
16 #include "adc.h"\r
17 #include "can.h"\r
18 #include "gio.h"\r
19 #include "lin.h"\r
20 #include "mibspi.h"\r
21 #include "sci.h"\r
22 #include "het.h"\r
23 /* USER CODE BEGIN (0) */\r
24 #include "FreeRTOS.h"\r
25 #include "os_semphr.h"\r
26 #include "os_task.h"\r
27 \r
28 /** @brief Semaphore blocking task when it waits for interrupt signaling message receive\r
29  *\r
30  * Defined in commands.c */\r
31 extern xSemaphoreHandle canMsgReceived;\r
32 extern xSemaphoreHandle canMsgSent;\r
33 /** @brief Semaphore blocking task when it waits for interrupt signaling end of the conversion\r
34  *\r
35  * Defined in commands.c */\r
36 extern xSemaphoreHandle adcDataConverted;\r
37 \r
38 \r
39 extern xSemaphoreHandle linMsgReceived;\r
40 extern xSemaphoreHandle linIDReceived;\r
41 \r
42 /** @brief Data structure containing converted data from ADC\r
43  *\r
44  *      Defined in commands.c */\r
45 extern ADCData_t adcData;\r
46 extern canBASE_t *canDst;\r
47 extern canBASE_t *canSrc;\r
48 extern uint32_t canMsgBox;\r
49 /* USER CODE END */\r
50 \r
51 void esmGroup1Notification(uint32_t channel)\r
52 {\r
53 /*  enter user code and remove the while loop... */\r
54     while(1);\r
55 /* USER CODE BEGIN (1) */\r
56 /* USER CODE END */\r
57 \r
58 }\r
59 \r
60 /* USER CODE BEGIN (2) */\r
61 /* USER CODE END */\r
62 \r
63 void esmGroup2Notification(uint32_t channel)\r
64 {\r
65 /*  enter user code and remove the while loop... */\r
66     while(1);\r
67 /* USER CODE BEGIN (3) */\r
68 /* USER CODE END */\r
69 \r
70 }\r
71 \r
72 /* USER CODE BEGIN (4) */\r
73 /* USER CODE END */\r
74 \r
75 void memoryPort0TestFailNotification(uint32_t groupSelect, uint32_t dataSelect, uint32_t address, uint32_t data)\r
76 {\r
77 /*  enter user code and remove the while loop... */\r
78     while(1);\r
79 /* USER CODE BEGIN (5) */\r
80 /* USER CODE END */\r
81 \r
82 }\r
83 \r
84 /* USER CODE BEGIN (6) */\r
85 /* USER CODE END */\r
86 \r
87 void memoryPort1TestFailNotification(uint32_t groupSelect, uint32_t dataSelect, uint32_t address, uint32_t data)\r
88 {\r
89 /*  enter user code and remove the while loop... */\r
90     while(1);\r
91 /* USER CODE BEGIN (7) */\r
92 /* USER CODE END */\r
93 \r
94 }\r
95 \r
96 /* USER CODE BEGIN (8) */\r
97 /* USER CODE END */\r
98 void adcNotification(adcBASE_t *adc, uint32_t group)\r
99 {\r
100 /* USER CODE BEGIN (11) */\r
101         // Group selected by group selector has been read\r
102         if (adc->GxINTFLG[group] & 8) {\r
103                 uint32_t ch_count;\r
104                 ch_count = adcGetData(adc, group, &adcData.adc_data[0]);\r
105                 adcData.flags |= (ch_count == adcData.ch_count) ? 0 : BAD_CHANNELS_COUNT;\r
106                 xSemaphoreGiveFromISR(adcDataConverted, NULL);\r
107         }\r
108         // Memory overrun detected - set flag\r
109         if (adc->GxINTFLG[group] & 2) {\r
110                 adcData.flags |= MEM_OVERRUN;\r
111                 adc->GxFIFORESETCR[1] = 1;\r
112         }\r
113         /* USER CODE END */\r
114 \r
115 }\r
116 \r
117 /* USER CODE BEGIN (12) */\r
118 /* USER CODE END */\r
119 void canErrorNotification(canBASE_t *node, uint32_t notification)\r
120 {\r
121 /* USER CODE BEGIN (13) */\r
122         if (node == canSrc) {\r
123                 xSemaphoreGiveFromISR(canMsgSent, NULL);\r
124         }\r
125         if (node == canDst) {\r
126                 xSemaphoreGiveFromISR(canMsgReceived, NULL);\r
127         }\r
128 /* USER CODE END */\r
129 \r
130 }\r
131 \r
132 /* USER CODE BEGIN (14) */\r
133 /* USER CODE END */\r
134 \r
135 void canMessageNotification(canBASE_t *node, uint32_t messageBox)  \r
136 {\r
137 /* USER CODE BEGIN (15) */\r
138 \r
139         if (messageBox == canMsgBox)\r
140         {\r
141                 if (node == canDst) {\r
142                         /* node 2 - receive testloopback message complete */\r
143                          while(!canIsRxMessageArrived(node, canMsgBox))\r
144                                  ;\r
145                          xSemaphoreGiveFromISR(canMsgReceived, NULL);\r
146                 }\r
147                 if (node == canSrc) {\r
148                          xSemaphoreGiveFromISR(canMsgSent, NULL);\r
149                 }\r
150         }\r
151 \r
152 /* USER CODE END */\r
153 \r
154 }\r
155 \r
156 /* USER CODE BEGIN (16) */\r
157 /* USER CODE END */\r
158 void gioNotification(int bit)\r
159 {\r
160 /*  enter user code and remove the while loop... */\r
161     while(1);\r
162 /* USER CODE BEGIN (19) */\r
163 /* USER CODE END */\r
164 \r
165 }\r
166 \r
167 /* USER CODE BEGIN (20) */\r
168 /* USER CODE END */\r
169 void linNotification(linBASE_t *lin, uint32_t flags)      \r
170 {\r
171 /* USER CODE BEGIN (23) */\r
172                 if (flags & LIN_ID_INT) {\r
173                         xSemaphoreGiveFromISR(linIDReceived, NULL);\r
174                 }\r
175                 if (flags & LIN_RX_INT) {\r
176                         lin->FLR |= (1 << 9);\r
177                         xSemaphoreGiveFromISR(linMsgReceived, NULL);\r
178                 }\r
179 /* USER CODE END */\r
180 \r
181 }\r
182 \r
183 /* USER CODE BEGIN (24) */\r
184 /* USER CODE END */\r
185 void mibspiNotification(mibspiBASE_t *mibspi, uint32_t flags)\r
186 {\r
187 /*  enter user code and remove the while loop... */\r
188     while(1);\r
189 /* USER CODE BEGIN (25) */\r
190 /* USER CODE END */\r
191 \r
192 }\r
193 \r
194 /* USER CODE BEGIN (26) */\r
195 /* USER CODE END */\r
196 \r
197 void mibspiGroupNotification(mibspiBASE_t *mibspi, uint32_t group)\r
198 {\r
199 /*  enter user code and remove the while loop... */\r
200     while(1);\r
201 /* USER CODE BEGIN (27) */\r
202 /* USER CODE END */\r
203 \r
204 }\r
205 /* USER CODE BEGIN (28) */\r
206 /* USER CODE END */\r
207 \r
208 void sciNotification(sciBASE_t *sci, uint32_t flags)     \r
209 {\r
210 /* USER CODE BEGIN (29) */\r
211         if (sci == sciREG) {\r
212                 if (flags & SCI_RX_INT) {\r
213                         sciReceive(sci, 1, NULL);       // Restart receiving\r
214                 }\r
215         }\r
216 /* USER CODE END */\r
217 \r
218 }\r
219 \r
220 /* USER CODE BEGIN (30) */\r
221 /* USER CODE END */\r
222 void pwmNotification(hetBASE_t * hetREG,uint32_t pwm, uint32_t notification)\r
223 {\r
224 /*  enter user code and remove the while loop... */\r
225     while(1);\r
226 /* USER CODE BEGIN (33) */\r
227 /* USER CODE END */\r
228 \r
229 }\r
230 \r
231 /* USER CODE BEGIN (34) */\r
232 /* USER CODE END */\r
233 \r
234 void edgeNotification(hetBASE_t * hetREG,uint32_t edge)\r
235 {\r
236 /*  enter user code and remove the while loop... */\r
237     while(1);\r
238 /* USER CODE BEGIN (35) */\r
239 /* USER CODE END */\r
240 \r
241 }\r
242 \r
243 /* USER CODE BEGIN (36) */\r
244 /* USER CODE END */\r
245 \r
246 void hetNotification(hetBASE_t *het, uint32_t offset)\r
247 {\r
248 /*  enter user code and remove the while loop... */\r
249     while(1);\r
250 /* USER CODE BEGIN (37) */\r
251 /* USER CODE END */\r
252 \r
253 }\r
254 \r
255 /* USER CODE BEGIN (38) */\r
256 /* USER CODE END */\r