#include "partest.h"\r
\r
/*-----------------------------------------------------------\r
- * Simple parallel port IO routines for the LED's - which are\r
- * connected to the second nibble of GPIO port 1.\r
+ * Simple parallel port IO routines for the LED's \r
*-----------------------------------------------------------*/\r
\r
-#define partstLED_3 0x0080\r
-#define partstLED_2 0x0040\r
-#define partstLED_1 0x0020\r
-#define partstLED_0 0x0010\r
-#define partstON_BOARD 0x0100 /* The LED built onto the KickStart board. */\r
-\r
-#define partstALL_LEDs ( partstLED_0 | partstLED_1 | partstLED_2 | partstLED_3 | partstON_BOARD )\r
-\r
-#define partstFIRST_LED_BIT 4\r
-\r
-/* This demo application uses files that are common to all port demo\r
-applications. These files assume 6 LED's are available, whereas I have\r
-only 5 (including the LED built onto the development board). To prevent\r
-two tasks trying to use the same LED a bit of remapping is performed.\r
-The ComTest tasks will try and use LED's 6 and 7. LED 6 is ignored and\r
-has no effect, LED 7 is mapped to LED3. The LED usage is described in\r
-the port documentation available from the FreeRTOS.org WEB site. */\r
-#define partstCOM_TEST_LED 7\r
-#define partstRX_CHAR_LED 3\r
-\r
#define partstNUM_LEDS 4\r
\r
typedef struct GPIOMAP\r
{ ( GPIO_TypeDef * )GPIO1_BASE, GPIO_Pin_1, 0UL },\r
{ ( GPIO_TypeDef * )GPIO0_BASE, GPIO_Pin_16, 0UL },\r
{ ( GPIO_TypeDef * )GPIO2_BASE, GPIO_Pin_18, 0UL }, \r
- { ( GPIO_TypeDef * )GPIO2_BASE, GPIO_Pin_19, 0UL }\r
- \r
+ { ( GPIO_TypeDef * )GPIO2_BASE, GPIO_Pin_19, 0UL } \r
};\r
\r
/*-----------------------------------------------------------*/\r
-GPIO_InitTypeDef GPIO_InitStructure ;\r
\r
void vParTestInitialise( void )\r
{ \r
+GPIO_InitTypeDef GPIO_InitStructure ;\r
+\r
/* Configure the bits used to flash LED's on port 1 as output. */\r
- /* Configure LED3 */\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_16;\r
- GPIO_Init(GPIO0,&GPIO_InitStructure);\r
- /* Configure LED2 */\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;\r
- GPIO_Init(GPIO1, &GPIO_InitStructure);\r
- /* Configure LED4 and LED5 */\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_18 | GPIO_Pin_19;\r
- GPIO_Init(GPIO2, &GPIO_InitStructure);\r
+\r
+ /* Configure LED3 */\r
+ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;\r
+ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_16;\r
+ GPIO_Init(GPIO0,&GPIO_InitStructure);\r
+\r
+ /* Configure LED2 */\r
+ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;\r
+ GPIO_Init(GPIO1, &GPIO_InitStructure);\r
+\r
+ /* Configure LED4 and LED5 */\r
+ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_18 | GPIO_Pin_19;\r
+ GPIO_Init(GPIO2, &GPIO_InitStructure);\r
\r
vParTestSetLED( 0, 0 );\r
vParTestSetLED( 1, 0 );\r
{\r
if( uxLED < partstNUM_LEDS )\r
{\r
- if( xValue )\r
- {\r
- GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_RESET );\r
- xLEDMap[ uxLED ].ulValue = 0;\r
- }\r
- else\r
+ portENTER_CRITICAL();\r
{\r
- GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_SET );\r
- xLEDMap[ uxLED ].ulValue = 1; \r
+ if( xValue )\r
+ {\r
+ GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_RESET );\r
+ xLEDMap[ uxLED ].ulValue = 0;\r
+ }\r
+ else\r
+ {\r
+ GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_SET );\r
+ xLEDMap[ uxLED ].ulValue = 1; \r
+ }\r
}\r
+ portEXIT_CRITICAL();\r
}\r
}\r
/*-----------------------------------------------------------*/\r
{\r
if( uxLED < partstNUM_LEDS )\r
{\r
- if( xLEDMap[ uxLED ].ulValue == 1 )\r
- {\r
- GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_RESET );\r
- xLEDMap[ uxLED ].ulValue = 0;\r
- }\r
- else\r
+ portENTER_CRITICAL();\r
{\r
- GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_SET );\r
- xLEDMap[ uxLED ].ulValue = 1; \r
+ if( xLEDMap[ uxLED ].ulValue == 1 )\r
+ {\r
+ GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_RESET );\r
+ xLEDMap[ uxLED ].ulValue = 0;\r
+ }\r
+ else\r
+ {\r
+ GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_SET );\r
+ xLEDMap[ uxLED ].ulValue = 1; \r
+ }\r
}\r
+ portEXIT_CRITICAL();\r
}\r
}\r
\r