]> begriffs open source - freertos/blob - Demo/MB91460_Softune/SRC/partest/partest.c
(no commit message)
[freertos] / Demo / MB91460_Softune / SRC / partest / partest.c
1 /* THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS. FUJITSU */\r
2 /* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */\r
3 /* ELIGIBILITY FOR ANY PURPOSES.                                                                                         */\r
4 /*                               (C) Fujitsu Microelectronics Europe GmbH                                 */\r
5 /*------------------------------------------------------------------------\r
6   MAIN.C\r
7   - description\r
8   - See README.TXT for project description and disclaimer.\r
9 -------------------------------------------------------------------------*/\r
10 /*************************@INCLUDE_START************************/\r
11 \r
12 \r
13 /* TODO: Add comment here regarding the behaviour of the demo. */\r
14 \r
15 \r
16 /* Hardware specific includes. */\r
17 #include "mb91467d.h"\r
18 \r
19 /* Scheduler includes. */\r
20 #include "FreeRTOS.h"\r
21 \r
22 \r
23 static unsigned portSHORT sState[ ledNUMBER_OF_LEDS ] = { pdFALSE };\r
24 static unsigned portSHORT sState1[ ledNUMBER_OF_LEDS ] = { pdFALSE };\r
25 \r
26 /*-----------------------------------------------------------*/\r
27 static void vPartestInitialise( void )\r
28 {\r
29         DDR16=0xFF;\r
30         DDR25=0xFF;\r
31 }\r
32 /*-----------------------------------------------------------*/\r
33 \r
34 void vParTestToggleLED( unsigned portBASE_TYPE uxLED )\r
35 {\r
36         if (uxLED < ledNUMBER_OF_LEDS)\r
37         {\r
38                 vTaskSuspendAll();\r
39                 \r
40                 /* Toggle the state of the single genuine on board LED. */\r
41                 if( sState[uxLED])      \r
42                 {\r
43                         PDR25 |= (1 << uxLED);\r
44                 }\r
45                 else\r
46                 {\r
47                         PDR25 &= ~(1 << uxLED);\r
48                 }\r
49         \r
50                 sState[uxLED] = !(sState[uxLED]);\r
51                 \r
52                 xTaskResumeAll();\r
53         }\r
54         else\r
55         {\r
56                 uxLED -= ledNUMBER_OF_LEDS;\r
57                 \r
58                 vTaskSuspendAll();\r
59                 \r
60                 /* Toggle the state of the single genuine on board LED. */\r
61                 if( sState1[uxLED])     \r
62                 {\r
63                         PDR16 |= (1 << uxLED);\r
64                 }\r
65                 else\r
66                 {\r
67                         PDR16 &= ~(1 << uxLED);\r
68                 }\r
69         \r
70                 sState1[uxLED] = !(sState1[uxLED]);\r
71                 \r
72                 xTaskResumeAll();\r
73         }\r
74 }\r
75 /*-----------------------------------------------------------*/\r
76 \r
77 void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )\r
78 {\r
79         /* Set or clear the output [in this case show or hide the '*' character. */\r
80         if( uxLED < ledNUMBER_OF_LEDS )\r
81         {\r
82                 vTaskSuspendAll();\r
83                 {\r
84                         if( xValue )\r
85                         {\r
86                                 PDR25 |= (1 << uxLED);\r
87                                 sState[uxLED] = 1;\r
88                         }\r
89                         else\r
90                         {\r
91                                 PDR25 &= ~(1 << uxLED);\r
92                                 sState[uxLED] = 0;\r
93                         }\r
94                 }\r
95                 xTaskResumeAll();\r
96         }\r
97         else \r
98         {\r
99                 uxLED -= ledNUMBER_OF_LEDS;\r
100                 vTaskSuspendAll();\r
101                 {\r
102                         if( xValue )\r
103                         {\r
104                                 PDR16 |= (1 << uxLED);\r
105                                 sState1[uxLED] = 1;\r
106                         }\r
107                         else\r
108                         {\r
109                                 PDR16 &= ~(1 << uxLED);\r
110                                 sState1[uxLED] = 0;\r
111                         }\r
112                 }\r
113                 xTaskResumeAll();\r
114         }\r
115 }\r
116 /*-----------------------------------------------------------*/\r
117 \r