\r
#include "FreeRTOS.h"\r
#include "task.h"\r
+#include "semphr.h"\r
\r
#define diceMIN 1\r
#define diceMAX 6\r
\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
{ 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
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
{\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
}\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
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
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
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
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
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
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
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
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
$other\r
-Xset_rora\r
$time\r
-1233316909\r
+1233330876\r
$end\r
$3\r
-dt s,d,r,a\r
-Xdof\r
$other\r
$time\r
-1233316440\r
+1233330876\r
$end\r
$4\r
-Xdof\r
\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
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
#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