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