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