]> git.sur5r.net Git - freertos/commitdiff
Continue FX16 demo development.
authorRichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 31 Jan 2009 10:31:21 +0000 (10:31 +0000)
committerRichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 31 Jan 2009 10:31:21 +0000 (10:31 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@656 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/MB96350_Softune_Dice_Kit/DiceTask.c
Demo/MB96350_Softune_Dice_Kit/dicekit16fx_dice2-v10.prj
Demo/MB96350_Softune_Dice_Kit/dicekit16fx_dice2-v10.wsp
Demo/MB96350_Softune_Dice_Kit/main.c
Demo/MB96350_Softune_Dice_Kit/options.dat
Demo/MB96350_Softune_Dice_Kit/vectors.c

index 11ae2b5496c8db33a7f82d05d05e7912df654930..849b4b723fd53dc014c722a7fa202dc5b0d65bbc 100644 (file)
@@ -49,6 +49,7 @@
 \r
 #include "FreeRTOS.h"\r
 #include "task.h"\r
+#include "semphr.h"\r
 \r
 #define diceMIN    1\r
 #define diceMAX    6\r
@@ -63,7 +64,7 @@
 \r
 #define dice7SEG_Value( x )            *( pucDisplayOutput[ x ] )\r
 \r
-static unsigned char prvButtonHit( unsigned char ucIndex );\r
+#define prvButtonHit( ucIndex, xTicksToWait ) xSemaphoreTake( xSemaphores[ ucIndex ], xTicksToWait )\r
 \r
 static const char cDisplaySegments[ 2 ][ 11 ] =\r
 {\r
@@ -71,6 +72,8 @@ static const char cDisplaySegments[ 2 ][ 11 ] =
        { 0xa0, 0xf3, 0xc4, 0xc1, 0x93, 0x89, 0x88, 0xe3, 0x80, 0x81, 0x7f }\r
 };\r
 \r
+static xSemaphoreHandle xSemaphores[ 2 ] = { 0 };\r
+\r
 extern volatile unsigned char *pucDisplayOutput[ 2 ];\r
 \r
 /*-----------------------------------------------------------*/\r
@@ -83,6 +86,8 @@ unsigned long ulDiceRunTime, ulDiceDelay, ulDiceDelayReload;
 extern void vToggleFlashTaskSuspendState( void );\r
 \r
        ucIndex = ( unsigned char ) pvParameters;\r
+       vSemaphoreCreateBinary( xSemaphores[ ucIndex ] );\r
+       srand( ( unsigned char ) diceRUN_MIN );\r
 \r
        for( ;; )\r
        {\r
@@ -90,38 +95,17 @@ extern void vToggleFlashTaskSuspendState( void );
                {\r
                        case diceSTATE_STOPPED:\r
 \r
-                               if( prvButtonHit( ucIndex ) == pdTRUE )\r
-                               {\r
-                                       ulDiceRunTime = diceRUN_MIN;\r
-                                       srand( ( unsigned char ) ulDiceRunTime );\r
-                                       cDiceState = diceSTATE_STARTUP;\r
-                               }\r
-\r
-                               break;\r
-\r
-                       case diceSTATE_STARTUP:\r
-\r
-                               if( ulDiceRunTime < diceRUN_MAX )     // variable running time\r
+                               prvButtonHit( ucIndex, portMAX_DELAY );\r
+                               ulDiceRunTime = diceRUN_MIN;                            \r
+                               cDiceState = diceSTATE_RUNNING;\r
+                               ulDiceDelay = 1;\r
+                               ulDiceDelayReload = 1;\r
+                               cDiceState = diceSTATE_RUNNING;\r
+                               if( ucIndex == 0 )\r
                                {\r
-                                       ulDiceRunTime++;\r
+                                       vToggleFlashTaskSuspendState();\r
                                }\r
-                               else\r
-                               {\r
-                                       ulDiceRunTime = diceRUN_MIN;\r
-                               }\r
-\r
-                               if( prvButtonHit( ucIndex ) == pdFALSE )\r
-                               {\r
-                                       if( ucIndex == 0 )\r
-                                       {\r
-                                               vToggleFlashTaskSuspendState();\r
-                                       }\r
 \r
-                                       ulDiceDelay = 1;\r
-                                       ulDiceDelayReload = 1;\r
-                                       cDiceState = diceSTATE_RUNNING;\r
-                               }   \r
-                                      \r
                                break;\r
 \r
                        case diceSTATE_RUNNING:\r
@@ -156,22 +140,36 @@ extern void vToggleFlashTaskSuspendState( void );
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static unsigned char prvButtonHit( unsigned char ucIndex )\r
+__interrupt void vExternalInt8Handler( void )\r
 {\r
-       if( ( ucIndex == 0 ) && PDR00_P0 )\r
-       {\r
-               return pdTRUE;\r
-       }\r
-       else if( ( ucIndex == 1 ) && PDR00_P1 )\r
+short sHigherPriorityTaskWoken = pdFALSE;\r
+\r
+       /* Reset the interrupt. */\r
+       EIRR1_ER8 = 0;\r
+\r
+       xSemaphoreGiveFromISR( xSemaphores[ 0 ], &sHigherPriorityTaskWoken );\r
+\r
+       if( sHigherPriorityTaskWoken != pdFALSE )\r
        {\r
-               return pdTRUE;\r
+               portYIELD_FROM_ISR();\r
        }\r
-       else\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+__interrupt void vExternalInt9Handler( void )\r
+{\r
+short sHigherPriorityTaskWoken = pdFALSE;\r
+\r
+       /* Reset the interrupt. */\r
+       EIRR1_ER9 = 0;\r
+\r
+       xSemaphoreGiveFromISR( xSemaphores[ 1 ], &sHigherPriorityTaskWoken );\r
+\r
+       if( sHigherPriorityTaskWoken != pdFALSE )\r
        {\r
-               return pdFALSE;\r
+               portYIELD_FROM_ISR();\r
        }\r
 }\r
-/*-----------------------------------------------------------*/\r
 \r
 \r
 \r
index 55040c630a18d5fc07f969633462fcba510048dd..87222be821e19660d1eb09f9787d33c3435ef4de 100644 (file)
@@ -17,7 +17,7 @@ PrjInfo-0=Debug
 Active=Debug\r
 \r
 [MEMBER]\r
-F0=15\r
+F0=17\r
 F1=0 f Include Files\r
 F2=0 f FreeRTOS Source\r
 F3=0 c ..\..\Source\portable\Softune\MB96340\__STD_LIB_sbrk.c\r
@@ -29,10 +29,12 @@ F8=0 c ..\..\Source\queue.c
 F9=0 c ..\..\Source\tasks.c\r
 F10=0 f Demo Source\r
 F11=0 c DiceTask.c\r
-F12=0 c main.c\r
-F13=0 a mb96356rs.asm\r
-F14=0 a START.ASM\r
-F15=0 c vectors.c\r
+F12=0 c flash.c\r
+F13=0 c main.c\r
+F14=0 a mb96356rs.asm\r
+F15=0 c ParTest\ParTest.c\r
+F16=0 a START.ASM\r
+F17=0 c vectors.c\r
 \r
 [OPTIONFILE]\r
 FILE=options.dat\r
@@ -49,12 +51,12 @@ LST=LST\
 OPT=OPT\\r
 \r
 [MEMBER-Debug]\r
-F0=13\r
+F0=15\r
 F1=0 m 1 ABS\RTOSDemo.abs\r
 F2=2 c 1 vectors.c\r
 F2-1=- mb96356rs.h\r
 F2-2=- FreeRTOSConfig.h\r
-F3=10 c 1 main.c\r
+F3=12 c 1 main.c\r
 F3-1=- mb96356rs.h\r
 F3-2=- ..\..\Source\Include\FreeRTOS.h\r
 F3-3=- ..\..\..\..\..\..\devtools\Softune\LIB\907\INCLUDE\stddef.h\r
@@ -65,6 +67,8 @@ F3-7=- ..\..\Source\portable\Softune\MB96340\portmacro.h
 F3-8=- DiceTask.h\r
 F3-9=- ..\..\Source\Include\task.h\r
 F3-10=- ..\..\Source\Include\list.h\r
+F3-11=- ..\Common\Include\ParTest.h\r
+F3-12=- ..\Common\Include\Flash.h\r
 F4=0 a 1 mb96356rs.asm\r
 F5=0 a 1 START.ASM\r
 F6=14 c 1 ..\..\Source\tasks.c\r
@@ -152,6 +156,30 @@ F13-6=- ..\..\Source\Include\portable.h
 F13-7=- ..\..\Source\portable\Softune\MB96340\portmacro.h\r
 F13-8=- ..\..\Source\Include\task.h\r
 F13-9=- ..\..\Source\Include\list.h\r
+F14=10 c 1 ParTest\ParTest.c\r
+F14-1=- ..\..\Source\Include\FreeRTOS.h\r
+F14-2=- ..\..\..\..\..\..\devtools\Softune\LIB\907\INCLUDE\stddef.h\r
+F14-3=- ..\..\Source\Include\projdefs.h\r
+F14-4=- FreeRTOSConfig.h\r
+F14-5=- mb96356rs.h\r
+F14-6=- ..\..\Source\Include\portable.h\r
+F14-7=- ..\..\Source\portable\Softune\MB96340\portmacro.h\r
+F14-8=- ..\..\Source\Include\task.h\r
+F14-9=- ..\..\Source\Include\list.h\r
+F14-10=- ..\Common\Include\ParTest.h\r
+F15=12 c 1 flash.c\r
+F15-1=- ..\..\..\..\..\..\devtools\Softune\LIB\907\INCLUDE\stdlib.h\r
+F15-2=- ..\..\..\..\..\..\devtools\Softune\LIB\907\INCLUDE\stddef.h\r
+F15-3=- ..\..\Source\Include\FreeRTOS.h\r
+F15-4=- ..\..\Source\Include\projdefs.h\r
+F15-5=- FreeRTOSConfig.h\r
+F15-6=- mb96356rs.h\r
+F15-7=- ..\..\Source\Include\portable.h\r
+F15-8=- ..\..\Source\portable\Softune\MB96340\portmacro.h\r
+F15-9=- ..\..\Source\Include\task.h\r
+F15-10=- ..\..\Source\Include\list.h\r
+F15-11=- ..\Common\Include\ParTest.h\r
+F15-12=- ..\Common\Include\Flash.h\r
 \r
 [BUILDMODE-Debug]\r
 kernel=0\r
index b4c841d26f4c05aa59a15ec33efdaee2a5597ce4..4f681a80245712db5342daa531cf5563a83ff928 100644 (file)
@@ -18,5 +18,6 @@ AutoLoad=1
 WSP=C:\E\Dev\FreeRTOS\WorkingCopy3\Demo\MB96350_Softune_Dice_Kit\\r
 \r
 [EditState]\r
-Count=0\r
+STATE-1=vectors.c:40\r
+Count=1\r
 \r
index 6a42d0130ba9a0ede65e69d63703eb3b6bec9a2b..d5b63e92e57597876f5810f0d429abbcdf20c80f 100644 (file)
@@ -93,26 +93,9 @@ static void prvSetupHardware( void )
        portDISABLE_INTERRUPTS();\r
        __set_il( 7 );  \r
 \r
-       /* Enable P00_0/INT8 and P00_1/INT9 as input. */\r
-       PIER00 = 0x03;\r
-       PDR00  = 0x00;\r
-       DDR00  = 0xfc;\r
-\r
        /* Set Port3 as output (7Segment Display). */\r
        DDR03  = 0xff;\r
 \r
-       /* Enable P04_2/RX as input. */\r
-       PIER04 = 0x04;\r
-\r
-       /* CAN TX = 1. */\r
-       PDR04  = 0x08;\r
-\r
-       /* CAN RX = input. */\r
-       DDR04  = 0xfb;\r
-\r
-       /* All inputs are disabled on this port. */\r
-       PIER05 = 0x00;\r
-\r
        /* Use Port 5 as I/O-Port. */\r
        ADER1  = 0;\r
        PDR05  = 0x7f;\r
@@ -126,8 +109,35 @@ static void prvSetupHardware( void )
        DDR02  = 0xff;\r
        PIER03 = 0x00;\r
        PDR03  = 0xff;\r
+       PIER05 = 0x00;\r
+       PDR05  = 0x00;\r
        PIER06 = 0x00;\r
        PDR06  = 0x00;\r
        DDR06  = 0xff;\r
+\r
+       /* Enable P00_0/INT8 and P00_1/INT9 as input. */\r
+       PIER00 = 0x03;\r
+\r
+       /* Enable external interrupt 8. */\r
+       PIER00_IE0 = 1;\r
+       \r
+       /* LB0, LA0 = 11 -> falling edge. */\r
+       ELVRL1_LB8 = 1;\r
+       ELVRL1_LA8 = 1;\r
+\r
+       /* Reset and enable the interrupt request. */\r
+       EIRR1_ER8 = 0;\r
+       ENIR1_EN8 = 1;\r
+\r
+       /* Enable external interrupt 9. */\r
+       PIER00_IE1 = 1;\r
+       \r
+       /* LB1, LA1 = 11 -> falling edge. */\r
+       ELVRL1_LB9 = 1;\r
+       ELVRL1_LA9 = 1;\r
+\r
+       /* Reset and enable the interrput request. */\r
+       EIRR1_ER9 = 0;\r
+       ENIR1_EN9 = 1;  \r
 }\r
 \r
index e3b558dbb0b40a400c6d2be95ee31dc160bad723..71a62ee483f1c87f263be96970423c9e81607407 100644 (file)
@@ -60,7 +60,7 @@ $2
 $other\r
 -Xset_rora\r
 $time\r
-1233316909\r
+1233330876\r
 $end\r
 $3\r
 -dt s,d,r,a\r
@@ -70,7 +70,7 @@ $3
 -Xdof\r
 $other\r
 $time\r
-1233316440\r
+1233330876\r
 $end\r
 $4\r
 -Xdof\r
index 509287e43a9ff1fe320bdae07fd6f10b20a2028d..193db79c8969f5d7114523a99d9b1cd53896babc 100644 (file)
@@ -36,6 +36,8 @@ void InitIrqLevels(void)
 \r
        ICR = ( (54 & 0xFF) << 8 ) | configKERNEL_INTERRUPT_PRIORITY;                   /* Reload Timer 0 */\r
        ICR = ( (12 & 0xFF) << 8 ) | configKERNEL_INTERRUPT_PRIORITY;                   /* Delayed interrupt of 16FX Family */\r
+       ICR = ( (24 & 0xFF) << 8 ) | ( configKERNEL_INTERRUPT_PRIORITY - 1 );   /* INT8 */\r
+       ICR = ( (25 & 0xFF) << 8 ) | ( configKERNEL_INTERRUPT_PRIORITY - 1 );   /* INT9 */      \r
 }\r
 \r
 /*---------------------------------------------------------------------------\r
@@ -48,6 +50,8 @@ __interrupt void              DefaultIRQHandler( void );
 extern __interrupt void prvRLT0_TICKISR( void );\r
 extern __interrupt void vPortYield( void );\r
 extern __interrupt void vPortYieldDelayed( void );\r
+extern __interrupt void vExternalInt8Handler( void );\r
+extern __interrupt void vExternalInt9Handler( void );\r
 \r
 /*---------------------------------------------------------------------------\r
    Vector definiton for MB9635x\r
@@ -73,8 +77,8 @@ extern __interrupt void vPortYieldDelayed( void );
 #pragma intvect DefaultIRQHandler 21   /* EXT4                         */\r
 #pragma intvect DefaultIRQHandler 22   /* EXT5                         */\r
 #pragma intvect DefaultIRQHandler 23   /* EXT7                         */\r
-#pragma intvect DefaultIRQHandler 24   /* EXT8                         */\r
-#pragma intvect DefaultIRQHandler 25   /* EXT9                         */\r
+#pragma intvect vExternalInt8Handler 24   /* EXT8                         */\r
+#pragma intvect vExternalInt9Handler 25   /* EXT9                         */\r
 #pragma intvect DefaultIRQHandler 26   /* EXT10                        */\r
 #pragma intvect DefaultIRQHandler 27   /* EXT11                        */\r
 #pragma intvect DefaultIRQHandler 28   /* EXT12                        */\r