mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Replace use of legacy portTYPE macros from old demos and standard demo files.
This commit is contained in:
parent
3e20aa7d60
commit
b54158d1dc
|
@ -110,13 +110,13 @@
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* Constants to setup I/O and processor. */
|
/* Constants to setup I/O and processor. */
|
||||||
#define mainTX_ENABLE ( ( unsigned portLONG ) 0x00010000 ) /* UART1. */
|
#define mainTX_ENABLE ( ( unsigned long ) 0x00010000 ) /* UART1. */
|
||||||
#define mainRX_ENABLE ( ( unsigned portLONG ) 0x00040000 ) /* UART1. */
|
#define mainRX_ENABLE ( ( unsigned long ) 0x00040000 ) /* UART1. */
|
||||||
#define mainBUS_CLK_FULL ( ( unsigned portCHAR ) 0x01 )
|
#define mainBUS_CLK_FULL ( ( unsigned char ) 0x01 )
|
||||||
#define mainLED_TO_OUTPUT ( ( unsigned portLONG ) 0xff0000 )
|
#define mainLED_TO_OUTPUT ( ( unsigned long ) 0xff0000 )
|
||||||
|
|
||||||
/* Constants for the ComTest demo application tasks. */
|
/* Constants for the ComTest demo application tasks. */
|
||||||
#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 115200 )
|
#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 )
|
||||||
#define mainCOM_TEST_LED ( 3 )
|
#define mainCOM_TEST_LED ( 3 )
|
||||||
|
|
||||||
/* Priorities for the demo application tasks. */
|
/* Priorities for the demo application tasks. */
|
||||||
|
@ -142,7 +142,7 @@ then an error has been detected in at least one of the demo application tasks. *
|
||||||
* Checks that all the demo application tasks are still executing without error
|
* Checks that all the demo application tasks are still executing without error
|
||||||
* - as described at the top of the file.
|
* - as described at the top of the file.
|
||||||
*/
|
*/
|
||||||
static portLONG prvCheckOtherTasksAreStillRunning( void );
|
static long prvCheckOtherTasksAreStillRunning( void );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The task that executes at the highest priority and calls
|
* The task that executes at the highest priority and calls
|
||||||
|
@ -249,9 +249,9 @@ static void prvSetupHardware( void )
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static portLONG prvCheckOtherTasksAreStillRunning( void )
|
static long prvCheckOtherTasksAreStillRunning( void )
|
||||||
{
|
{
|
||||||
portLONG lReturn = pdPASS;
|
long lReturn = pdPASS;
|
||||||
|
|
||||||
/* Check all the demo tasks (other than the flash tasks) to ensure
|
/* Check all the demo tasks (other than the flash tasks) to ensure
|
||||||
that they are all still running, and that none of them have detected
|
that they are all still running, and that none of them have detected
|
||||||
|
|
|
@ -69,9 +69,9 @@
|
||||||
/* Demo application includes. */
|
/* Demo application includes. */
|
||||||
#include "partest.h"
|
#include "partest.h"
|
||||||
|
|
||||||
#define partstFIRST_IO ( ( unsigned portLONG ) 0x01 )
|
#define partstFIRST_IO ( ( unsigned long ) 0x01 )
|
||||||
#define partstNUM_LEDS ( 8 )
|
#define partstNUM_LEDS ( 8 )
|
||||||
#define partstALL_OUTPUTS_OFF ( ( unsigned portLONG ) 0xff )
|
#define partstALL_OUTPUTS_OFF ( ( unsigned long ) 0xff )
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
* Simple parallel port IO routines.
|
* Simple parallel port IO routines.
|
||||||
|
@ -91,12 +91,12 @@ void vParTestInitialise( void )
|
||||||
|
|
||||||
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulLED = partstFIRST_IO;
|
unsigned long ulLED = partstFIRST_IO;
|
||||||
|
|
||||||
if( uxLED < partstNUM_LEDS )
|
if( uxLED < partstNUM_LEDS )
|
||||||
{
|
{
|
||||||
/* Rotate to the wanted bit of port */
|
/* Rotate to the wanted bit of port */
|
||||||
ulLED <<= ( unsigned portLONG ) uxLED;
|
ulLED <<= ( unsigned long ) uxLED;
|
||||||
|
|
||||||
/* Set of clear the output. */
|
/* Set of clear the output. */
|
||||||
if( xValue )
|
if( xValue )
|
||||||
|
@ -113,13 +113,13 @@ unsigned portLONG ulLED = partstFIRST_IO;
|
||||||
|
|
||||||
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulLED = partstFIRST_IO, ulCurrentState;
|
unsigned long ulLED = partstFIRST_IO, ulCurrentState;
|
||||||
|
|
||||||
if( uxLED < partstNUM_LEDS )
|
if( uxLED < partstNUM_LEDS )
|
||||||
{
|
{
|
||||||
/* Rotate to the wanted bit of port 0. Only P10 to P13 have an LED
|
/* Rotate to the wanted bit of port 0. Only P10 to P13 have an LED
|
||||||
attached. */
|
attached. */
|
||||||
ulLED <<= ( unsigned portLONG ) uxLED;
|
ulLED <<= ( unsigned long ) uxLED;
|
||||||
|
|
||||||
/* If this bit is already set, clear it, and vice versa. */
|
/* If this bit is already set, clear it, and vice versa. */
|
||||||
ulCurrentState = FIO2PIN;
|
ulCurrentState = FIO2PIN;
|
||||||
|
@ -137,9 +137,9 @@ unsigned portLONG ulLED = partstFIRST_IO, ulCurrentState;
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
unsigned portBASE_TYPE uxParTextGetLED( unsigned portBASE_TYPE uxLED )
|
unsigned portBASE_TYPE uxParTextGetLED( unsigned portBASE_TYPE uxLED )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulLED = partstFIRST_IO;
|
unsigned long ulLED = partstFIRST_IO;
|
||||||
|
|
||||||
ulLED <<= ( unsigned portLONG ) uxLED;
|
ulLED <<= ( unsigned long ) uxLED;
|
||||||
|
|
||||||
return ( FIO2PIN & ulLED );
|
return ( FIO2PIN & ulLED );
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,22 +117,22 @@
|
||||||
#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||||
|
|
||||||
/* Constants to setup the PLL. */
|
/* Constants to setup the PLL. */
|
||||||
#define mainPLL_MUL ( ( unsigned portLONG ) ( 8 - 1 ) )
|
#define mainPLL_MUL ( ( unsigned long ) ( 8 - 1 ) )
|
||||||
#define mainPLL_DIV ( ( unsigned portLONG ) 0x0000 )
|
#define mainPLL_DIV ( ( unsigned long ) 0x0000 )
|
||||||
#define mainCPU_CLK_DIV ( ( unsigned portLONG ) 0x0003 )
|
#define mainCPU_CLK_DIV ( ( unsigned long ) 0x0003 )
|
||||||
#define mainPLL_ENABLE ( ( unsigned portLONG ) 0x0001 )
|
#define mainPLL_ENABLE ( ( unsigned long ) 0x0001 )
|
||||||
#define mainPLL_CONNECT ( ( ( unsigned portLONG ) 0x0002 ) | mainPLL_ENABLE )
|
#define mainPLL_CONNECT ( ( ( unsigned long ) 0x0002 ) | mainPLL_ENABLE )
|
||||||
#define mainPLL_FEED_BYTE1 ( ( unsigned portLONG ) 0xaa )
|
#define mainPLL_FEED_BYTE1 ( ( unsigned long ) 0xaa )
|
||||||
#define mainPLL_FEED_BYTE2 ( ( unsigned portLONG ) 0x55 )
|
#define mainPLL_FEED_BYTE2 ( ( unsigned long ) 0x55 )
|
||||||
#define mainPLL_LOCK ( ( unsigned portLONG ) 0x4000000 )
|
#define mainPLL_LOCK ( ( unsigned long ) 0x4000000 )
|
||||||
#define mainPLL_CONNECTED ( ( unsigned portLONG ) 0x2000000 )
|
#define mainPLL_CONNECTED ( ( unsigned long ) 0x2000000 )
|
||||||
#define mainOSC_ENABLE ( ( unsigned portLONG ) 0x20 )
|
#define mainOSC_ENABLE ( ( unsigned long ) 0x20 )
|
||||||
#define mainOSC_STAT ( ( unsigned portLONG ) 0x40 )
|
#define mainOSC_STAT ( ( unsigned long ) 0x40 )
|
||||||
#define mainOSC_SELECT ( ( unsigned portLONG ) 0x01 )
|
#define mainOSC_SELECT ( ( unsigned long ) 0x01 )
|
||||||
|
|
||||||
/* Constants to setup the MAM. */
|
/* Constants to setup the MAM. */
|
||||||
#define mainMAM_TIM_3 ( ( unsigned portCHAR ) 0x03 )
|
#define mainMAM_TIM_3 ( ( unsigned char ) 0x03 )
|
||||||
#define mainMAM_MODE_FULL ( ( unsigned portCHAR ) 0x02 )
|
#define mainMAM_MODE_FULL ( ( unsigned char ) 0x02 )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The task that handles the uIP stack. All TCP/IP processing is performed in
|
* The task that handles the uIP stack. All TCP/IP processing is performed in
|
||||||
|
@ -191,7 +191,7 @@ void vApplicationTickHook( void )
|
||||||
{
|
{
|
||||||
unsigned portBASE_TYPE uxColumn = 0;
|
unsigned portBASE_TYPE uxColumn = 0;
|
||||||
static xLCDMessage xMessage = { 0, "PASS" };
|
static xLCDMessage xMessage = { 0, "PASS" };
|
||||||
static unsigned portLONG ulTicksSinceLastDisplay = 0;
|
static unsigned long ulTicksSinceLastDisplay = 0;
|
||||||
static portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
static portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
/* Called from every tick interrupt. Have enough ticks passed to make it
|
/* Called from every tick interrupt. Have enough ticks passed to make it
|
||||||
|
|
|
@ -171,7 +171,7 @@ extern void ( vEMAC_ISR_Wrapper )( void );
|
||||||
{
|
{
|
||||||
MAC_INTENABLE = INT_RX_DONE;
|
MAC_INTENABLE = INT_RX_DONE;
|
||||||
VICIntEnable |= 0x00200000;
|
VICIntEnable |= 0x00200000;
|
||||||
VICVectAddr21 = ( portLONG ) vEMAC_ISR_Wrapper;
|
VICVectAddr21 = ( long ) vEMAC_ISR_Wrapper;
|
||||||
prvSetMACAddress();
|
prvSetMACAddress();
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL();
|
portEXIT_CRITICAL();
|
||||||
|
@ -281,10 +281,10 @@ struct uip_eth_addr xAddr;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vApplicationProcessFormInput( portCHAR *pcInputString, portBASE_TYPE xInputLength )
|
void vApplicationProcessFormInput( char *pcInputString, portBASE_TYPE xInputLength )
|
||||||
{
|
{
|
||||||
char *c, *pcText;
|
char *c, *pcText;
|
||||||
static portCHAR cMessageForDisplay[ 32 ];
|
static char cMessageForDisplay[ 32 ];
|
||||||
extern xQueueHandle xLCDQueue;
|
extern xQueueHandle xLCDQueue;
|
||||||
xLCDMessage xLCDMessage;
|
xLCDMessage xLCDMessage;
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ extern void ( vEMAC_ISR_Wrapper )( void );
|
||||||
{
|
{
|
||||||
IntEnable = INT_RX_DONE;
|
IntEnable = INT_RX_DONE;
|
||||||
VICIntEnable |= 0x00200000;
|
VICIntEnable |= 0x00200000;
|
||||||
VICVectAddr21 = ( portLONG ) vEMAC_ISR_Wrapper;
|
VICVectAddr21 = ( long ) vEMAC_ISR_Wrapper;
|
||||||
prvSetMACAddress();
|
prvSetMACAddress();
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL();
|
portEXIT_CRITICAL();
|
||||||
|
@ -292,10 +292,10 @@ struct uip_eth_addr xAddr;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vApplicationProcessFormInput( portCHAR *pcInputString, portBASE_TYPE xInputLength )
|
void vApplicationProcessFormInput( char *pcInputString, portBASE_TYPE xInputLength )
|
||||||
{
|
{
|
||||||
char *c, *pcText;
|
char *c, *pcText;
|
||||||
static portCHAR cMessageForDisplay[ 32 ];
|
static char cMessageForDisplay[ 32 ];
|
||||||
extern xQueueHandle xLCDQueue;
|
extern xQueueHandle xLCDQueue;
|
||||||
xLCDMessage xLCDMessage;
|
xLCDMessage xLCDMessage;
|
||||||
|
|
||||||
|
|
|
@ -51,15 +51,15 @@
|
||||||
* Simple parallel port IO routines.
|
* Simple parallel port IO routines.
|
||||||
*-----------------------------------------------------------*/
|
*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#define partstALL_OUTPUTS_OFF ( ( unsigned portCHAR ) 0x00 )
|
#define partstALL_OUTPUTS_OFF ( ( unsigned char ) 0x00 )
|
||||||
#if( BOARD==EVK1100 )
|
#if( BOARD==EVK1100 )
|
||||||
# define partstMAX_OUTPUT_LED ( ( unsigned portCHAR ) 8 )
|
# define partstMAX_OUTPUT_LED ( ( unsigned char ) 8 )
|
||||||
|
|
||||||
#elif( BOARD==EVK1101 )
|
#elif( BOARD==EVK1101 )
|
||||||
# define partstMAX_OUTPUT_LED ( ( unsigned portCHAR ) 4 )
|
# define partstMAX_OUTPUT_LED ( ( unsigned char ) 4 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static volatile unsigned portCHAR ucCurrentOutputValue = partstALL_OUTPUTS_OFF; /*lint !e956 File scope parameters okay here. */
|
static volatile unsigned char ucCurrentOutputValue = partstALL_OUTPUTS_OFF; /*lint !e956 File scope parameters okay here. */
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -71,14 +71,14 @@ void vParTestInitialise( void )
|
||||||
|
|
||||||
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
||||||
{
|
{
|
||||||
unsigned portCHAR ucBit;
|
unsigned char ucBit;
|
||||||
|
|
||||||
if( uxLED >= partstMAX_OUTPUT_LED )
|
if( uxLED >= partstMAX_OUTPUT_LED )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ucBit = ( ( unsigned portCHAR ) 1 ) << uxLED;
|
ucBit = ( ( unsigned char ) 1 ) << uxLED;
|
||||||
|
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
{
|
{
|
||||||
|
@ -99,14 +99,14 @@ unsigned portCHAR ucBit;
|
||||||
|
|
||||||
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
||||||
{
|
{
|
||||||
unsigned portCHAR ucBit;
|
unsigned char ucBit;
|
||||||
|
|
||||||
if( uxLED >= partstMAX_OUTPUT_LED )
|
if( uxLED >= partstMAX_OUTPUT_LED )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ucBit = ( ( unsigned portCHAR ) 1 ) << uxLED;
|
ucBit = ( ( unsigned char ) 1 ) << uxLED;
|
||||||
|
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
{
|
{
|
||||||
|
|
|
@ -133,7 +133,7 @@
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
//! Baud rate used by the serial port tasks.
|
//! Baud rate used by the serial port tasks.
|
||||||
#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 57600 )
|
#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 57600 )
|
||||||
|
|
||||||
//! LED used by the serial port tasks. This is toggled on each character Tx,
|
//! LED used by the serial port tasks. This is toggled on each character Tx,
|
||||||
//! and mainCOM_TEST_LED + 1 is toggled on each character Rx.
|
//! and mainCOM_TEST_LED + 1 is toggled on each character Rx.
|
||||||
|
@ -157,7 +157,7 @@
|
||||||
/*! \name Constants used by the vMemCheckTask() task.
|
/*! \name Constants used by the vMemCheckTask() task.
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
#define mainCOUNT_INITIAL_VALUE ( ( unsigned portLONG ) 0 )
|
#define mainCOUNT_INITIAL_VALUE ( ( unsigned long ) 0 )
|
||||||
#define mainNO_TASK ( 0 )
|
#define mainNO_TASK ( 0 )
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
@ -244,8 +244,8 @@ int main( void )
|
||||||
*/
|
*/
|
||||||
static void vErrorChecks( void *pvParameters )
|
static void vErrorChecks( void *pvParameters )
|
||||||
{
|
{
|
||||||
static volatile unsigned portLONG ulDummyVariable = 3UL;
|
static volatile unsigned long ulDummyVariable = 3UL;
|
||||||
unsigned portLONG ulMemCheckTaskRunningCount;
|
unsigned long ulMemCheckTaskRunningCount;
|
||||||
xTaskHandle xCreatedTask;
|
xTaskHandle xCreatedTask;
|
||||||
portBASE_TYPE bSuicidalTask = 0;
|
portBASE_TYPE bSuicidalTask = 0;
|
||||||
|
|
||||||
|
@ -394,9 +394,9 @@ static portBASE_TYPE xErrorHasOccurred = pdFALSE;
|
||||||
*/
|
*/
|
||||||
static void vMemCheckTask( void *pvParameters )
|
static void vMemCheckTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
unsigned portLONG *pulMemCheckTaskRunningCounter;
|
unsigned long *pulMemCheckTaskRunningCounter;
|
||||||
void *pvMem1, *pvMem2, *pvMem3;
|
void *pvMem1, *pvMem2, *pvMem3;
|
||||||
static portLONG lErrorOccurred = pdFALSE;
|
static long lErrorOccurred = pdFALSE;
|
||||||
|
|
||||||
/* This task is dynamically created then deleted during each cycle of the
|
/* This task is dynamically created then deleted during each cycle of the
|
||||||
vErrorChecks task to check the operation of the memory allocator. Each time
|
vErrorChecks task to check the operation of the memory allocator. Each time
|
||||||
|
@ -409,7 +409,7 @@ static portLONG lErrorOccurred = pdFALSE;
|
||||||
pulMemCheckTaskRunningCounter is incremented each cycle to indicate to the
|
pulMemCheckTaskRunningCounter is incremented each cycle to indicate to the
|
||||||
vErrorChecks() task that this task is still executing without error. */
|
vErrorChecks() task that this task is still executing without error. */
|
||||||
|
|
||||||
pulMemCheckTaskRunningCounter = ( unsigned portLONG * ) pvParameters;
|
pulMemCheckTaskRunningCounter = ( unsigned long * ) pvParameters;
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
|
|
|
@ -88,9 +88,9 @@ static void vprvSerialCreateQueues( unsigned portBASE_TYPE uxQueueLength,
|
||||||
static portBASE_TYPE prvUSART_ISR_NonNakedBehaviour( void )
|
static portBASE_TYPE prvUSART_ISR_NonNakedBehaviour( void )
|
||||||
{
|
{
|
||||||
/* Now we can declare the local variables. */
|
/* Now we can declare the local variables. */
|
||||||
signed portCHAR cChar;
|
signed char cChar;
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
unsigned portLONG ulStatus;
|
unsigned long ulStatus;
|
||||||
volatile avr32_usart_t *usart = serialPORT_USART;
|
volatile avr32_usart_t *usart = serialPORT_USART;
|
||||||
portBASE_TYPE retstatus;
|
portBASE_TYPE retstatus;
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ static void vUSART_ISR( void )
|
||||||
/*
|
/*
|
||||||
* Init the serial port for the Minimal implementation.
|
* Init the serial port for the Minimal implementation.
|
||||||
*/
|
*/
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
static const gpio_map_t USART_GPIO_MAP =
|
static const gpio_map_t USART_GPIO_MAP =
|
||||||
{
|
{
|
||||||
|
@ -184,7 +184,7 @@ int cd; /* USART Clock Divider. */
|
||||||
/* Configure USART. */
|
/* Configure USART. */
|
||||||
if( ( xRxedChars != serINVALID_QUEUE ) &&
|
if( ( xRxedChars != serINVALID_QUEUE ) &&
|
||||||
( xCharsForTx != serINVALID_QUEUE ) &&
|
( xCharsForTx != serINVALID_QUEUE ) &&
|
||||||
( ulWantedBaud != ( unsigned portLONG ) 0 ) )
|
( ulWantedBaud != ( unsigned long ) 0 ) )
|
||||||
{
|
{
|
||||||
portENTER_CRITICAL();
|
portENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
|
@ -290,7 +290,7 @@ int cd; /* USART Clock Divider. */
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* The port handle is not required as this driver only supports UART0. */
|
/* The port handle is not required as this driver only supports UART0. */
|
||||||
( void ) pxPort;
|
( void ) pxPort;
|
||||||
|
@ -308,9 +308,9 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcR
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vSerialPutString( xComPortHandle pxPort, const signed portCHAR * const pcString, unsigned portSHORT usStringLength )
|
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )
|
||||||
{
|
{
|
||||||
signed portCHAR *pxNext;
|
signed char *pxNext;
|
||||||
|
|
||||||
/* NOTE: This implementation does not handle the queue being full as no
|
/* NOTE: This implementation does not handle the queue being full as no
|
||||||
block time is used! */
|
block time is used! */
|
||||||
|
@ -319,7 +319,7 @@ signed portCHAR *pxNext;
|
||||||
( void ) pxPort;
|
( void ) pxPort;
|
||||||
|
|
||||||
/* Send each character in the string, one at a time. */
|
/* Send each character in the string, one at a time. */
|
||||||
pxNext = ( signed portCHAR * ) pcString;
|
pxNext = ( signed char * ) pcString;
|
||||||
while( *pxNext )
|
while( *pxNext )
|
||||||
{
|
{
|
||||||
xSerialPutChar( pxPort, *pxNext, serNO_BLOCK );
|
xSerialPutChar( pxPort, *pxNext, serNO_BLOCK );
|
||||||
|
@ -328,7 +328,7 @@ signed portCHAR *pxNext;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
volatile avr32_usart_t *usart = serialPORT_USART;
|
volatile avr32_usart_t *usart = serialPORT_USART;
|
||||||
|
|
||||||
|
@ -362,8 +362,8 @@ void vSerialClose( xComPortHandle xPort )
|
||||||
static void vprvSerialCreateQueues( unsigned portBASE_TYPE uxQueueLength, xQueueHandle *pxRxedChars, xQueueHandle *pxCharsForTx )
|
static void vprvSerialCreateQueues( unsigned portBASE_TYPE uxQueueLength, xQueueHandle *pxRxedChars, xQueueHandle *pxCharsForTx )
|
||||||
{
|
{
|
||||||
/* Create the queues used to hold Rx and Tx characters. */
|
/* Create the queues used to hold Rx and Tx characters. */
|
||||||
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
|
|
||||||
/* Pass back a reference to the queues so the serial API file can
|
/* Pass back a reference to the queues so the serial API file can
|
||||||
post/receive characters. */
|
post/receive characters. */
|
||||||
|
|
|
@ -115,7 +115,7 @@ static xQueueHandle xCharsForTx;
|
||||||
/*
|
/*
|
||||||
* See the serial2.h header file.
|
* See the serial2.h header file.
|
||||||
*/
|
*/
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
/* Baud is set in IoInitScif2(), called in prvSetupHardware() in main.c. */
|
/* Baud is set in IoInitScif2(), called in prvSetupHardware() in main.c. */
|
||||||
( void ) ulWantedBaud;
|
( void ) ulWantedBaud;
|
||||||
|
@ -175,7 +175,7 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedC
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned portSHORT usStringLength )
|
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )
|
||||||
{
|
{
|
||||||
signed char *pxNext;
|
signed char *pxNext;
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
/* The set frequency of the interrupt. Deviations from this are measured as
|
/* The set frequency of the interrupt. Deviations from this are measured as
|
||||||
the jitter. */
|
the jitter. */
|
||||||
#define timerINTERRUPT_FREQUENCY ( ( unsigned portSHORT ) 20000 )
|
#define timerINTERRUPT_FREQUENCY ( ( unsigned short ) 20000 )
|
||||||
|
|
||||||
/* The expected time between each of the timer interrupts - if the jitter was
|
/* The expected time between each of the timer interrupts - if the jitter was
|
||||||
zero. */
|
zero. */
|
||||||
|
@ -90,7 +90,7 @@ void vSetupTimerTest( void );
|
||||||
CY_ISR_PROTO(vTimer20KHzISR);
|
CY_ISR_PROTO(vTimer20KHzISR);
|
||||||
|
|
||||||
/* Stores the value of the maximum recorded jitter between interrupts. */
|
/* Stores the value of the maximum recorded jitter between interrupts. */
|
||||||
volatile unsigned portSHORT usMaxJitter = 0;
|
volatile unsigned short usMaxJitter = 0;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void vSetupTimerTest( void )
|
void vSetupTimerTest( void )
|
||||||
|
|
|
@ -98,7 +98,7 @@ tick hook. */
|
||||||
#define mainCOM_LED ( 3 )
|
#define mainCOM_LED ( 3 )
|
||||||
|
|
||||||
/* The number of nano seconds between each processor clock. */
|
/* The number of nano seconds between each processor clock. */
|
||||||
#define mainNS_PER_CLOCK ( ( unsigned portLONG ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
||||||
|
|
||||||
/* Task priorities. */
|
/* Task priorities. */
|
||||||
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||||
|
@ -224,7 +224,7 @@ unsigned long ulRow = 0;
|
||||||
portTickType xDelay = 0;
|
portTickType xDelay = 0;
|
||||||
unsigned short usErrorCode = 0;
|
unsigned short usErrorCode = 0;
|
||||||
unsigned long ulIteration = 0;
|
unsigned long ulIteration = 0;
|
||||||
extern unsigned portSHORT usMaxJitter;
|
extern unsigned short usMaxJitter;
|
||||||
|
|
||||||
/* Intialise the sleeper. */
|
/* Intialise the sleeper. */
|
||||||
xDelay = xTaskGetTickCount();
|
xDelay = xTaskGetTickCount();
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
/* The set frequency of the interrupt. Deviations from this are measured as
|
/* The set frequency of the interrupt. Deviations from this are measured as
|
||||||
the jitter. */
|
the jitter. */
|
||||||
#define timerINTERRUPT_FREQUENCY ( ( unsigned portSHORT ) 20000 )
|
#define timerINTERRUPT_FREQUENCY ( ( unsigned short ) 20000 )
|
||||||
|
|
||||||
/* The expected time between each of the timer interrupts - if the jitter was
|
/* The expected time between each of the timer interrupts - if the jitter was
|
||||||
zero. */
|
zero. */
|
||||||
|
@ -90,7 +90,7 @@ void vSetupTimerTest( void );
|
||||||
CY_ISR_PROTO(vTimer20KHzISR);
|
CY_ISR_PROTO(vTimer20KHzISR);
|
||||||
|
|
||||||
/* Stores the value of the maximum recorded jitter between interrupts. */
|
/* Stores the value of the maximum recorded jitter between interrupts. */
|
||||||
volatile unsigned portSHORT usMaxJitter = 0;
|
volatile unsigned short usMaxJitter = 0;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void vSetupTimerTest( void )
|
void vSetupTimerTest( void )
|
||||||
|
|
|
@ -98,7 +98,7 @@ tick hook. */
|
||||||
#define mainCOM_LED ( 3 )
|
#define mainCOM_LED ( 3 )
|
||||||
|
|
||||||
/* The number of nano seconds between each processor clock. */
|
/* The number of nano seconds between each processor clock. */
|
||||||
#define mainNS_PER_CLOCK ( ( unsigned portLONG ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
||||||
|
|
||||||
/* Task priorities. */
|
/* Task priorities. */
|
||||||
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||||
|
@ -224,7 +224,7 @@ unsigned long ulRow = 0;
|
||||||
portTickType xDelay = 0;
|
portTickType xDelay = 0;
|
||||||
unsigned short usErrorCode = 0;
|
unsigned short usErrorCode = 0;
|
||||||
unsigned long ulIteration = 0;
|
unsigned long ulIteration = 0;
|
||||||
extern unsigned portSHORT usMaxJitter;
|
extern unsigned short usMaxJitter;
|
||||||
|
|
||||||
/* Intialise the sleeper. */
|
/* Intialise the sleeper. */
|
||||||
xDelay = xTaskGetTickCount();
|
xDelay = xTaskGetTickCount();
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
/* The set frequency of the interrupt. Deviations from this are measured as
|
/* The set frequency of the interrupt. Deviations from this are measured as
|
||||||
the jitter. */
|
the jitter. */
|
||||||
#define timerINTERRUPT_FREQUENCY ( ( unsigned portSHORT ) 20000 )
|
#define timerINTERRUPT_FREQUENCY ( ( unsigned short ) 20000 )
|
||||||
|
|
||||||
/* The expected time between each of the timer interrupts - if the jitter was
|
/* The expected time between each of the timer interrupts - if the jitter was
|
||||||
zero. */
|
zero. */
|
||||||
|
@ -90,7 +90,7 @@ void vSetupTimerTest( void );
|
||||||
CY_ISR_PROTO(vTimer20KHzISR);
|
CY_ISR_PROTO(vTimer20KHzISR);
|
||||||
|
|
||||||
/* Stores the value of the maximum recorded jitter between interrupts. */
|
/* Stores the value of the maximum recorded jitter between interrupts. */
|
||||||
volatile unsigned portSHORT usMaxJitter = 0;
|
volatile unsigned short usMaxJitter = 0;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void vSetupTimerTest( void )
|
void vSetupTimerTest( void )
|
||||||
|
|
|
@ -98,7 +98,7 @@ tick hook. */
|
||||||
#define mainCOM_LED ( 3 )
|
#define mainCOM_LED ( 3 )
|
||||||
|
|
||||||
/* The number of nano seconds between each processor clock. */
|
/* The number of nano seconds between each processor clock. */
|
||||||
#define mainNS_PER_CLOCK ( ( unsigned portLONG ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
||||||
|
|
||||||
/* Task priorities. */
|
/* Task priorities. */
|
||||||
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||||
|
@ -224,7 +224,7 @@ unsigned long ulRow = 0;
|
||||||
portTickType xDelay = 0;
|
portTickType xDelay = 0;
|
||||||
unsigned short usErrorCode = 0;
|
unsigned short usErrorCode = 0;
|
||||||
unsigned long ulIteration = 0;
|
unsigned long ulIteration = 0;
|
||||||
extern unsigned portSHORT usMaxJitter;
|
extern unsigned short usMaxJitter;
|
||||||
|
|
||||||
/* Intialise the sleeper. */
|
/* Intialise the sleeper. */
|
||||||
xDelay = xTaskGetTickCount();
|
xDelay = xTaskGetTickCount();
|
||||||
|
|
|
@ -172,7 +172,7 @@ void vEMACInit( void )
|
||||||
{
|
{
|
||||||
int iData;
|
int iData;
|
||||||
extern int periph_clk_khz;
|
extern int periph_clk_khz;
|
||||||
const unsigned portCHAR ucMACAddress[] =
|
const unsigned char ucMACAddress[] =
|
||||||
{
|
{
|
||||||
configMAC_ADDR0, configMAC_ADDR1, configMAC_ADDR2, configMAC_ADDR3, configMAC_ADDR4, configMAC_ADDR5
|
configMAC_ADDR0, configMAC_ADDR1, configMAC_ADDR2, configMAC_ADDR3, configMAC_ADDR4, configMAC_ADDR5
|
||||||
};
|
};
|
||||||
|
@ -264,7 +264,7 @@ const unsigned portCHAR ucMACAddress[] =
|
||||||
{
|
{
|
||||||
/* Half duplex */
|
/* Half duplex */
|
||||||
ENET_RCR |= ENET_RCR_DRT_MASK;
|
ENET_RCR |= ENET_RCR_DRT_MASK;
|
||||||
ENET_TCR &= (unsigned portLONG)~ENET_TCR_FDEN_MASK;
|
ENET_TCR &= (unsigned long)~ENET_TCR_FDEN_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( iData & emacPHY_SPEED_STATUS )
|
if( iData & emacPHY_SPEED_STATUS )
|
||||||
|
|
|
@ -199,7 +199,7 @@ static void vCommsRxTask( void * pvParameters );
|
||||||
* The co-routine that periodically initiates the transmission of the string on
|
* The co-routine that periodically initiates the transmission of the string on
|
||||||
* the UART.
|
* the UART.
|
||||||
*/
|
*/
|
||||||
static void vSerialTxCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
static void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes a string the the LCD.
|
* Writes a string the the LCD.
|
||||||
|
@ -428,7 +428,7 @@ static char cRxedChar, cExpectedChar;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void vSerialTxCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
static void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
portTickType xDelayPeriod;
|
portTickType xDelayPeriod;
|
||||||
static unsigned long *pulRandomBytes = mainFIRST_PROGRAM_BYTES;
|
static unsigned long *pulRandomBytes = mainFIRST_PROGRAM_BYTES;
|
||||||
|
|
|
@ -197,13 +197,13 @@ static void vLCDTask( void * pvParameters );
|
||||||
/*
|
/*
|
||||||
* The task that receives the characters from UART 0.
|
* The task that receives the characters from UART 0.
|
||||||
*/
|
*/
|
||||||
static void vCommsRxCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
static void vCommsRxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The co-routine that periodically initiates the transmission of the string on
|
* The co-routine that periodically initiates the transmission of the string on
|
||||||
* the UART.
|
* the UART.
|
||||||
*/
|
*/
|
||||||
static void vSerialTxCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
static void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes a string the the LCD.
|
* Writes a string the the LCD.
|
||||||
|
@ -383,7 +383,7 @@ const char *pcStringsToDisplay[] = {
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void vCommsRxCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
static void vCommsRxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
static char cRxedChar, cExpectedChar = mainFIRST_TX_CHAR;
|
static char cRxedChar, cExpectedChar = mainFIRST_TX_CHAR;
|
||||||
portBASE_TYPE xResult;
|
portBASE_TYPE xResult;
|
||||||
|
@ -436,7 +436,7 @@ portBASE_TYPE xResult;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void vSerialTxCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
static void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
portTickType xDelayPeriod;
|
portTickType xDelayPeriod;
|
||||||
static unsigned long *pulRandomBytes = mainFIRST_PROGRAM_BYTES;
|
static unsigned long *pulRandomBytes = mainFIRST_PROGRAM_BYTES;
|
||||||
|
|
|
@ -199,7 +199,7 @@ static void vCommsRxTask( void * pvParameters );
|
||||||
* The co-routine that periodically initiates the transmission of the string on
|
* The co-routine that periodically initiates the transmission of the string on
|
||||||
* the UART.
|
* the UART.
|
||||||
*/
|
*/
|
||||||
static void vSerialTxCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
static void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes a string the the LCD.
|
* Writes a string the the LCD.
|
||||||
|
@ -428,7 +428,7 @@ static char cRxedChar, cExpectedChar;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void vSerialTxCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
static void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
portTickType xDelayPeriod;
|
portTickType xDelayPeriod;
|
||||||
static unsigned long *pulRandomBytes = mainFIRST_PROGRAM_BYTES;
|
static unsigned long *pulRandomBytes = mainFIRST_PROGRAM_BYTES;
|
||||||
|
|
|
@ -199,7 +199,7 @@ static void vCommsRxTask( void * pvParameters );
|
||||||
* The co-routine that periodically initiates the transmission of the string on
|
* The co-routine that periodically initiates the transmission of the string on
|
||||||
* the UART.
|
* the UART.
|
||||||
*/
|
*/
|
||||||
static void vSerialTxCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
static void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes a string the the LCD.
|
* Writes a string the the LCD.
|
||||||
|
@ -429,7 +429,7 @@ static char cRxedChar, cExpectedChar;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void vSerialTxCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
static void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
portTickType xDelayPeriod;
|
portTickType xDelayPeriod;
|
||||||
static unsigned long *pulRandomBytes = mainFIRST_PROGRAM_BYTES;
|
static unsigned long *pulRandomBytes = mainFIRST_PROGRAM_BYTES;
|
||||||
|
|
|
@ -197,13 +197,13 @@ static void vLCDTask( void * pvParameters );
|
||||||
/*
|
/*
|
||||||
* The task that receives the characters from UART 0.
|
* The task that receives the characters from UART 0.
|
||||||
*/
|
*/
|
||||||
static void vCommsRxCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
static void vCommsRxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The co-routine that periodically initiates the transmission of the string on
|
* The co-routine that periodically initiates the transmission of the string on
|
||||||
* the UART.
|
* the UART.
|
||||||
*/
|
*/
|
||||||
static void vSerialTxCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
static void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes a string the the LCD.
|
* Writes a string the the LCD.
|
||||||
|
@ -384,7 +384,7 @@ const char *pcStringsToDisplay[] = {
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void vCommsRxCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
static void vCommsRxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
static char cRxedChar, cExpectedChar = mainFIRST_TX_CHAR;
|
static char cRxedChar, cExpectedChar = mainFIRST_TX_CHAR;
|
||||||
portBASE_TYPE xResult;
|
portBASE_TYPE xResult;
|
||||||
|
@ -437,7 +437,7 @@ portBASE_TYPE xResult;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void vSerialTxCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
static void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
portTickType xDelayPeriod;
|
portTickType xDelayPeriod;
|
||||||
static unsigned long *pulRandomBytes = mainFIRST_PROGRAM_BYTES;
|
static unsigned long *pulRandomBytes = mainFIRST_PROGRAM_BYTES;
|
||||||
|
|
|
@ -142,8 +142,8 @@ static xQueueHandle xDelayQueue;
|
||||||
static void prvSetupHardware( void );
|
static void prvSetupHardware( void );
|
||||||
|
|
||||||
/* The co-routines as described at the top of the file. */
|
/* The co-routines as described at the top of the file. */
|
||||||
static void vI2CCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
static void vI2CCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
static void vFlashCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
static void vFlashCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ static void prvSetupHardware( void )
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void vI2CCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
static void vI2CCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
portTickType xADCResult;
|
portTickType xADCResult;
|
||||||
static portBASE_TYPE xResult = 0, xMilliSecs, xLED;
|
static portBASE_TYPE xResult = 0, xMilliSecs, xLED;
|
||||||
|
@ -247,7 +247,7 @@ static portBASE_TYPE xResult = 0, xMilliSecs, xLED;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void vFlashCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
static void vFlashCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xResult, xNothing;
|
portBASE_TYPE xResult, xNothing;
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ void vSerialInit( void )
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vSerialTxCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
portTickType xDelayPeriod;
|
portTickType xDelayPeriod;
|
||||||
static unsigned long *pulRandomBytes = commsFIRST_PROGRAM_BYTES;
|
static unsigned long *pulRandomBytes = commsFIRST_PROGRAM_BYTES;
|
||||||
|
|
|
@ -80,7 +80,7 @@ void vCommsRxTask( void * pvParameters );
|
||||||
* The co-routine that periodically initiates the transmission of the string on
|
* The co-routine that periodically initiates the transmission of the string on
|
||||||
* the UART.
|
* the UART.
|
||||||
*/
|
*/
|
||||||
void vSerialTxCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
unsigned portBASE_TYPE uxGetCommsStatus( void );
|
unsigned portBASE_TYPE uxGetCommsStatus( void );
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ static void prvLCDMessageTask( void * pvParameters );
|
||||||
* The co-routine that reads the ADC and sends messages for display on the
|
* The co-routine that reads the ADC and sends messages for display on the
|
||||||
* bottom row of the LCD.
|
* bottom row of the LCD.
|
||||||
*/
|
*/
|
||||||
static void prvADCCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
static void prvADCCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function to simply set a known value into the general purpose registers
|
* Function to simply set a known value into the general purpose registers
|
||||||
|
@ -378,7 +378,7 @@ const unsigned char ucCFGData[] = {
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvADCCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
static void prvADCCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
static unsigned long ulADCValue;
|
static unsigned long ulADCValue;
|
||||||
static char cMessageBuffer[ mainMAX_ADC_STRING_LEN ];
|
static char cMessageBuffer[ mainMAX_ADC_STRING_LEN ];
|
||||||
|
|
|
@ -161,8 +161,8 @@ static void vButtonHandlerTask( void *pvParameters );
|
||||||
static void vPrintTask( void *pvParameter );
|
static void vPrintTask( void *pvParameter );
|
||||||
|
|
||||||
/* String that is transmitted on the UART. */
|
/* String that is transmitted on the UART. */
|
||||||
static portCHAR *cMessage = "Task woken by button interrupt! --- ";
|
static char *cMessage = "Task woken by button interrupt! --- ";
|
||||||
static volatile portCHAR *pcNextChar;
|
static volatile char *pcNextChar;
|
||||||
|
|
||||||
/* The semaphore used to wake the button handler task from within the GPIO
|
/* The semaphore used to wake the button handler task from within the GPIO
|
||||||
interrupt handler. */
|
interrupt handler. */
|
||||||
|
@ -184,7 +184,7 @@ int main( void )
|
||||||
xSemaphoreTake( xButtonSemaphore, 0 );
|
xSemaphoreTake( xButtonSemaphore, 0 );
|
||||||
|
|
||||||
/* Create the queue used to pass message to vPrintTask. */
|
/* Create the queue used to pass message to vPrintTask. */
|
||||||
xPrintQueue = xQueueCreate( mainQUEUE_SIZE, sizeof( portCHAR * ) );
|
xPrintQueue = xQueueCreate( mainQUEUE_SIZE, sizeof( char * ) );
|
||||||
|
|
||||||
/* Start the standard demo tasks. */
|
/* Start the standard demo tasks. */
|
||||||
vStartIntegerMathTasks( tskIDLE_PRIORITY );
|
vStartIntegerMathTasks( tskIDLE_PRIORITY );
|
||||||
|
@ -211,8 +211,8 @@ static void vCheckTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xErrorOccurred = pdFALSE;
|
portBASE_TYPE xErrorOccurred = pdFALSE;
|
||||||
portTickType xLastExecutionTime;
|
portTickType xLastExecutionTime;
|
||||||
const portCHAR *pcPassMessage = "PASS";
|
const char *pcPassMessage = "PASS";
|
||||||
const portCHAR *pcFailMessage = "FAIL";
|
const char *pcFailMessage = "FAIL";
|
||||||
|
|
||||||
/* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
|
/* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
|
||||||
works correctly. */
|
works correctly. */
|
||||||
|
@ -305,7 +305,7 @@ static void prvSetupHardware( void )
|
||||||
|
|
||||||
static void vButtonHandlerTask( void *pvParameters )
|
static void vButtonHandlerTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
const portCHAR *pcInterruptMessage = "Int";
|
const char *pcInterruptMessage = "Int";
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
|
@ -340,7 +340,7 @@ const portCHAR *pcInterruptMessage = "Int";
|
||||||
|
|
||||||
void vUART_ISR(void)
|
void vUART_ISR(void)
|
||||||
{
|
{
|
||||||
unsigned portLONG ulStatus;
|
unsigned long ulStatus;
|
||||||
|
|
||||||
/* What caused the interrupt. */
|
/* What caused the interrupt. */
|
||||||
ulStatus = UARTIntStatus( UART0_BASE, pdTRUE );
|
ulStatus = UARTIntStatus( UART0_BASE, pdTRUE );
|
||||||
|
@ -380,7 +380,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
static void vPrintTask( void *pvParameters )
|
static void vPrintTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
portCHAR *pcMessage;
|
char *pcMessage;
|
||||||
unsigned portBASE_TYPE uxLine = 0, uxRow = 0;
|
unsigned portBASE_TYPE uxLine = 0, uxRow = 0;
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
|
|
|
@ -161,8 +161,8 @@ static void vButtonHandlerTask( void *pvParameters );
|
||||||
static void vPrintTask( void *pvParameter );
|
static void vPrintTask( void *pvParameter );
|
||||||
|
|
||||||
/* String that is transmitted on the UART. */
|
/* String that is transmitted on the UART. */
|
||||||
static portCHAR *cMessage = "Task woken by button interrupt! --- ";
|
static char *cMessage = "Task woken by button interrupt! --- ";
|
||||||
static volatile portCHAR *pcNextChar;
|
static volatile char *pcNextChar;
|
||||||
|
|
||||||
/* The semaphore used to wake the button handler task from within the GPIO
|
/* The semaphore used to wake the button handler task from within the GPIO
|
||||||
interrupt handler. */
|
interrupt handler. */
|
||||||
|
@ -184,7 +184,7 @@ int main( void )
|
||||||
xSemaphoreTake( xButtonSemaphore, 0 );
|
xSemaphoreTake( xButtonSemaphore, 0 );
|
||||||
|
|
||||||
/* Create the queue used to pass message to vPrintTask. */
|
/* Create the queue used to pass message to vPrintTask. */
|
||||||
xPrintQueue = xQueueCreate( mainQUEUE_SIZE, sizeof( portCHAR * ) );
|
xPrintQueue = xQueueCreate( mainQUEUE_SIZE, sizeof( char * ) );
|
||||||
|
|
||||||
/* Start the standard demo tasks. */
|
/* Start the standard demo tasks. */
|
||||||
vStartIntegerMathTasks( tskIDLE_PRIORITY );
|
vStartIntegerMathTasks( tskIDLE_PRIORITY );
|
||||||
|
@ -211,8 +211,8 @@ static void vCheckTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xErrorOccurred = pdFALSE;
|
portBASE_TYPE xErrorOccurred = pdFALSE;
|
||||||
portTickType xLastExecutionTime;
|
portTickType xLastExecutionTime;
|
||||||
const portCHAR *pcPassMessage = "PASS";
|
const char *pcPassMessage = "PASS";
|
||||||
const portCHAR *pcFailMessage = "FAIL";
|
const char *pcFailMessage = "FAIL";
|
||||||
|
|
||||||
/* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
|
/* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
|
||||||
works correctly. */
|
works correctly. */
|
||||||
|
@ -305,7 +305,7 @@ static void prvSetupHardware( void )
|
||||||
|
|
||||||
static void vButtonHandlerTask( void *pvParameters )
|
static void vButtonHandlerTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
const portCHAR *pcInterruptMessage = "Int";
|
const char *pcInterruptMessage = "Int";
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
|
@ -340,7 +340,7 @@ const portCHAR *pcInterruptMessage = "Int";
|
||||||
|
|
||||||
void vUART_ISR(void)
|
void vUART_ISR(void)
|
||||||
{
|
{
|
||||||
unsigned portLONG ulStatus;
|
unsigned long ulStatus;
|
||||||
|
|
||||||
/* What caused the interrupt. */
|
/* What caused the interrupt. */
|
||||||
ulStatus = UARTIntStatus( UART0_BASE, pdTRUE );
|
ulStatus = UARTIntStatus( UART0_BASE, pdTRUE );
|
||||||
|
@ -379,7 +379,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
static void vPrintTask( void *pvParameters )
|
static void vPrintTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
portCHAR *pcMessage;
|
char *pcMessage;
|
||||||
unsigned portBASE_TYPE uxLine = 0, uxRow = 0;
|
unsigned portBASE_TYPE uxLine = 0, uxRow = 0;
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
|
|
|
@ -174,7 +174,7 @@ time. */
|
||||||
|
|
||||||
/* The period of the system clock in nano seconds. This is used to calculate
|
/* The period of the system clock in nano seconds. This is used to calculate
|
||||||
the jitter time in nano seconds. */
|
the jitter time in nano seconds. */
|
||||||
#define mainNS_PER_CLOCK ( ( unsigned portLONG ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
||||||
|
|
||||||
/* Constants used when writing strings to the display. */
|
/* Constants used when writing strings to the display. */
|
||||||
#define mainCHARACTER_HEIGHT ( 9 )
|
#define mainCHARACTER_HEIGHT ( 9 )
|
||||||
|
@ -222,10 +222,10 @@ void vApplicationIdleHook( void ) __attribute__((naked));
|
||||||
xQueueHandle xOLEDQueue;
|
xQueueHandle xOLEDQueue;
|
||||||
|
|
||||||
/* The welcome text. */
|
/* The welcome text. */
|
||||||
const portCHAR * const pcWelcomeMessage = " www.FreeRTOS.org";
|
const char * const pcWelcomeMessage = " www.FreeRTOS.org";
|
||||||
|
|
||||||
/* Variables used to detect the test in the idle hook failing. */
|
/* Variables used to detect the test in the idle hook failing. */
|
||||||
unsigned portLONG ulIdleError = pdFALSE;
|
unsigned long ulIdleError = pdFALSE;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ void prvSetupHardware( void )
|
||||||
void vApplicationTickHook( void )
|
void vApplicationTickHook( void )
|
||||||
{
|
{
|
||||||
static xOLEDMessage xMessage = { "PASS" };
|
static xOLEDMessage xMessage = { "PASS" };
|
||||||
static unsigned portLONG ulTicksSinceLastDisplay = 0;
|
static unsigned long ulTicksSinceLastDisplay = 0;
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
/* Called from every tick interrupt. Have enough ticks passed to make it
|
/* Called from every tick interrupt. Have enough ticks passed to make it
|
||||||
|
@ -375,17 +375,17 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
void vOLEDTask( void *pvParameters )
|
void vOLEDTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
xOLEDMessage xMessage;
|
xOLEDMessage xMessage;
|
||||||
unsigned portLONG ulY, ulMaxY;
|
unsigned long ulY, ulMaxY;
|
||||||
static portCHAR cMessage[ mainMAX_MSG_LEN ];
|
static char cMessage[ mainMAX_MSG_LEN ];
|
||||||
extern volatile unsigned portLONG ulMaxJitter;
|
extern volatile unsigned long ulMaxJitter;
|
||||||
unsigned portBASE_TYPE uxUnusedStackOnEntry, uxUnusedStackNow;
|
unsigned portBASE_TYPE uxUnusedStackOnEntry, uxUnusedStackNow;
|
||||||
const unsigned portCHAR *pucImage;
|
const unsigned char *pucImage;
|
||||||
|
|
||||||
/* Functions to access the OLED. The one used depends on the dev kit
|
/* Functions to access the OLED. The one used depends on the dev kit
|
||||||
being used. */
|
being used. */
|
||||||
void ( *vOLEDInit )( unsigned portLONG ) = NULL;
|
void ( *vOLEDInit )( unsigned long ) = NULL;
|
||||||
void ( *vOLEDStringDraw )( const portCHAR *, unsigned portLONG, unsigned portLONG, unsigned portCHAR ) = NULL;
|
void ( *vOLEDStringDraw )( const char *, unsigned long, unsigned long, unsigned char ) = NULL;
|
||||||
void ( *vOLEDImageDraw )( const unsigned portCHAR *, unsigned portLONG, unsigned portLONG, unsigned portLONG, unsigned portLONG ) = NULL;
|
void ( *vOLEDImageDraw )( const unsigned char *, unsigned long, unsigned long, unsigned long, unsigned long ) = NULL;
|
||||||
void ( *vOLEDClear )( void ) = NULL;
|
void ( *vOLEDClear )( void ) = NULL;
|
||||||
|
|
||||||
/* Just for demo purposes. */
|
/* Just for demo purposes. */
|
||||||
|
@ -451,7 +451,7 @@ void ( *vOLEDClear )( void ) = NULL;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed portCHAR *pcTaskName )
|
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
|
||||||
{
|
{
|
||||||
for( ;; );
|
for( ;; );
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,12 +97,12 @@ zero. */
|
||||||
void Timer0IntHandler( void );
|
void Timer0IntHandler( void );
|
||||||
|
|
||||||
/* Stores the value of the maximum recorded jitter between interrupts. */
|
/* Stores the value of the maximum recorded jitter between interrupts. */
|
||||||
volatile unsigned portLONG ulMaxJitter = 0UL;
|
volatile unsigned long ulMaxJitter = 0UL;
|
||||||
|
|
||||||
/* Counts the total number of times that the high frequency timer has 'ticked'.
|
/* Counts the total number of times that the high frequency timer has 'ticked'.
|
||||||
This value is used by the run time stats function to work out what percentage
|
This value is used by the run time stats function to work out what percentage
|
||||||
of CPU time each task is taking. */
|
of CPU time each task is taking. */
|
||||||
volatile unsigned portLONG ulHighFrequencyTimerTicks = 0UL;
|
volatile unsigned long ulHighFrequencyTimerTicks = 0UL;
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vSetupHighFrequencyTimer( void )
|
void vSetupHighFrequencyTimer( void )
|
||||||
|
@ -139,9 +139,9 @@ unsigned long ulFrequency;
|
||||||
|
|
||||||
void Timer0IntHandler( void )
|
void Timer0IntHandler( void )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulDifference;
|
unsigned long ulDifference;
|
||||||
volatile unsigned portLONG ulCurrentCount;
|
volatile unsigned long ulCurrentCount;
|
||||||
static unsigned portLONG ulMaxDifference = 0, ulLastCount = 0;
|
static unsigned long ulMaxDifference = 0, ulLastCount = 0;
|
||||||
|
|
||||||
/* We use the timer 1 counter value to measure the clock cycles between
|
/* We use the timer 1 counter value to measure the clock cycles between
|
||||||
the timer 0 interrupts. */
|
the timer 0 interrupts. */
|
||||||
|
|
|
@ -105,16 +105,16 @@ xSemaphoreHandle xMACInterruptSemaphore = NULL;
|
||||||
|
|
||||||
/* The buffer used by the uIP stack. In this case the pointer is used to
|
/* The buffer used by the uIP stack. In this case the pointer is used to
|
||||||
point to one of the Rx buffers. */
|
point to one of the Rx buffers. */
|
||||||
unsigned portCHAR *uip_buf;
|
unsigned char *uip_buf;
|
||||||
|
|
||||||
/* Buffers into which Rx data is placed. */
|
/* Buffers into which Rx data is placed. */
|
||||||
static unsigned portCHAR ucRxBuffers[ emacNUM_RX_BUFFERS ][ UIP_BUFSIZE + ( 4 * emacFRAM_SIZE_BYTES ) ];
|
static unsigned char ucRxBuffers[ emacNUM_RX_BUFFERS ][ UIP_BUFSIZE + ( 4 * emacFRAM_SIZE_BYTES ) ];
|
||||||
|
|
||||||
/* The length of the data within each of the Rx buffers. */
|
/* The length of the data within each of the Rx buffers. */
|
||||||
static unsigned portLONG ulRxLength[ emacNUM_RX_BUFFERS ];
|
static unsigned long ulRxLength[ emacNUM_RX_BUFFERS ];
|
||||||
|
|
||||||
/* Used to keep a track of the number of bytes to transmit. */
|
/* Used to keep a track of the number of bytes to transmit. */
|
||||||
static unsigned portLONG ulNextTxSpace;
|
static unsigned long ulNextTxSpace;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ void vInitialiseSend( void )
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vIncrementTxLength( unsigned portLONG ulLength )
|
void vIncrementTxLength( unsigned long ulLength )
|
||||||
{
|
{
|
||||||
ulNextTxSpace += ulLength;
|
ulNextTxSpace += ulLength;
|
||||||
}
|
}
|
||||||
|
@ -199,11 +199,11 @@ void vIncrementTxLength( unsigned portLONG ulLength )
|
||||||
void vSendBufferToMAC( void )
|
void vSendBufferToMAC( void )
|
||||||
{
|
{
|
||||||
unsigned long *pulSource;
|
unsigned long *pulSource;
|
||||||
unsigned portSHORT * pus;
|
unsigned short * pus;
|
||||||
unsigned portLONG ulNextWord;
|
unsigned long ulNextWord;
|
||||||
|
|
||||||
/* Locate the data to be send. */
|
/* Locate the data to be send. */
|
||||||
pus = ( unsigned portSHORT * ) uip_buf;
|
pus = ( unsigned short * ) uip_buf;
|
||||||
|
|
||||||
/* Add in the size of the data. */
|
/* Add in the size of the data. */
|
||||||
pus--;
|
pus--;
|
||||||
|
@ -215,9 +215,9 @@ unsigned portLONG ulNextWord;
|
||||||
vTaskDelay( macWAIT_SEND_TIME );
|
vTaskDelay( macWAIT_SEND_TIME );
|
||||||
}
|
}
|
||||||
|
|
||||||
pulSource = ( unsigned portLONG * ) pus;
|
pulSource = ( unsigned long * ) pus;
|
||||||
|
|
||||||
for( ulNextWord = 0; ulNextWord < ulNextTxSpace; ulNextWord += sizeof( unsigned portLONG ) )
|
for( ulNextWord = 0; ulNextWord < ulNextTxSpace; ulNextWord += sizeof( unsigned long ) )
|
||||||
{
|
{
|
||||||
HWREG(ETH_BASE + MAC_O_DATA) = *pulSource;
|
HWREG(ETH_BASE + MAC_O_DATA) = *pulSource;
|
||||||
pulSource++;
|
pulSource++;
|
||||||
|
@ -231,7 +231,7 @@ unsigned portLONG ulNextWord;
|
||||||
void vEMAC_ISR( void )
|
void vEMAC_ISR( void )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
unsigned portLONG ulTemp;
|
unsigned long ulTemp;
|
||||||
|
|
||||||
/* Clear the interrupt. */
|
/* Clear the interrupt. */
|
||||||
ulTemp = EthernetIntStatus( ETH_BASE, pdFALSE );
|
ulTemp = EthernetIntStatus( ETH_BASE, pdFALSE );
|
||||||
|
@ -252,9 +252,9 @@ unsigned portLONG ulTemp;
|
||||||
void vMACHandleTask( void *pvParameters )
|
void vMACHandleTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
unsigned long ulLen = 0, i;
|
unsigned long ulLen = 0, i;
|
||||||
unsigned portLONG ulLength, ulInt;
|
unsigned long ulLength, ulInt;
|
||||||
unsigned long *pulBuffer;
|
unsigned long *pulBuffer;
|
||||||
static unsigned portLONG ulNextRxBuffer = 0;
|
static unsigned long ulNextRxBuffer = 0;
|
||||||
portBASE_TYPE xSwitchRequired = pdFALSE;
|
portBASE_TYPE xSwitchRequired = pdFALSE;
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
|
@ -286,7 +286,7 @@ portBASE_TYPE xSwitchRequired = pdFALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read out the data into our buffer. */
|
/* Read out the data into our buffer. */
|
||||||
for( i = 0; i < ulLength; i += sizeof( unsigned portLONG ) )
|
for( i = 0; i < ulLength; i += sizeof( unsigned long ) )
|
||||||
{
|
{
|
||||||
*pulBuffer = HWREG( ETH_BASE + MAC_O_DATA );
|
*pulBuffer = HWREG( ETH_BASE + MAC_O_DATA );
|
||||||
pulBuffer++;
|
pulBuffer++;
|
||||||
|
|
|
@ -258,7 +258,7 @@ static void prvENET_Send(void)
|
||||||
|
|
||||||
static void prvSetMACAddress( void )
|
static void prvSetMACAddress( void )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulUser0, ulUser1;
|
unsigned long ulUser0, ulUser1;
|
||||||
unsigned char pucMACArray[8];
|
unsigned char pucMACArray[8];
|
||||||
struct uip_eth_addr xAddr;
|
struct uip_eth_addr xAddr;
|
||||||
|
|
||||||
|
@ -286,10 +286,10 @@ struct uip_eth_addr xAddr;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vApplicationProcessFormInput( portCHAR *pcInputString, portBASE_TYPE xInputLength )
|
void vApplicationProcessFormInput( char *pcInputString, portBASE_TYPE xInputLength )
|
||||||
{
|
{
|
||||||
char *c, *pcText;
|
char *c, *pcText;
|
||||||
static portCHAR cMessageForDisplay[ 32 ];
|
static char cMessageForDisplay[ 32 ];
|
||||||
extern xQueueHandle xOLEDQueue;
|
extern xQueueHandle xOLEDQueue;
|
||||||
xOLEDMessage xOLEDMessage;
|
xOLEDMessage xOLEDMessage;
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ time. */
|
||||||
|
|
||||||
/* The period of the system clock in nano seconds. This is used to calculate
|
/* The period of the system clock in nano seconds. This is used to calculate
|
||||||
the jitter time in nano seconds. */
|
the jitter time in nano seconds. */
|
||||||
#define mainNS_PER_CLOCK ( ( unsigned portLONG ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
||||||
|
|
||||||
/* Constants used when writing strings to the display. */
|
/* Constants used when writing strings to the display. */
|
||||||
#define mainCHARACTER_HEIGHT ( 9 )
|
#define mainCHARACTER_HEIGHT ( 9 )
|
||||||
|
@ -221,7 +221,7 @@ extern void vSetupHighFrequencyTimer( void );
|
||||||
/*
|
/*
|
||||||
* Hook functions that can get called by the kernel.
|
* Hook functions that can get called by the kernel.
|
||||||
*/
|
*/
|
||||||
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed portCHAR *pcTaskName );
|
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName );
|
||||||
void vApplicationTickHook( void );
|
void vApplicationTickHook( void );
|
||||||
|
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ void vApplicationTickHook( void );
|
||||||
xQueueHandle xOLEDQueue;
|
xQueueHandle xOLEDQueue;
|
||||||
|
|
||||||
/* The welcome text. */
|
/* The welcome text. */
|
||||||
const portCHAR * const pcWelcomeMessage = " www.FreeRTOS.org";
|
const char * const pcWelcomeMessage = " www.FreeRTOS.org";
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ void prvSetupHardware( void )
|
||||||
void vApplicationTickHook( void )
|
void vApplicationTickHook( void )
|
||||||
{
|
{
|
||||||
static xOLEDMessage xMessage = { "PASS" };
|
static xOLEDMessage xMessage = { "PASS" };
|
||||||
static unsigned portLONG ulTicksSinceLastDisplay = 0;
|
static unsigned long ulTicksSinceLastDisplay = 0;
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
/* Called from every tick interrupt. Have enough ticks passed to make it
|
/* Called from every tick interrupt. Have enough ticks passed to make it
|
||||||
|
@ -395,16 +395,16 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
void vOLEDTask( void *pvParameters )
|
void vOLEDTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
xOLEDMessage xMessage;
|
xOLEDMessage xMessage;
|
||||||
unsigned portLONG ulY, ulMaxY;
|
unsigned long ulY, ulMaxY;
|
||||||
static portCHAR cMessage[ mainMAX_MSG_LEN ];
|
static char cMessage[ mainMAX_MSG_LEN ];
|
||||||
extern volatile unsigned portLONG ulMaxJitter;
|
extern volatile unsigned long ulMaxJitter;
|
||||||
const unsigned portCHAR *pucImage;
|
const unsigned char *pucImage;
|
||||||
|
|
||||||
/* Functions to access the OLED. The one used depends on the dev kit
|
/* Functions to access the OLED. The one used depends on the dev kit
|
||||||
being used. */
|
being used. */
|
||||||
void ( *vOLEDInit )( unsigned portLONG ) = NULL;
|
void ( *vOLEDInit )( unsigned long ) = NULL;
|
||||||
void ( *vOLEDStringDraw )( const portCHAR *, unsigned portLONG, unsigned portLONG, unsigned portCHAR ) = NULL;
|
void ( *vOLEDStringDraw )( const char *, unsigned long, unsigned long, unsigned char ) = NULL;
|
||||||
void ( *vOLEDImageDraw )( const unsigned portCHAR *, unsigned portLONG, unsigned portLONG, unsigned portLONG, unsigned portLONG ) = NULL;
|
void ( *vOLEDImageDraw )( const unsigned char *, unsigned long, unsigned long, unsigned long, unsigned long ) = NULL;
|
||||||
void ( *vOLEDClear )( void ) = NULL;
|
void ( *vOLEDClear )( void ) = NULL;
|
||||||
|
|
||||||
/* Map the OLED access functions to the driver functions that are appropriate
|
/* Map the OLED access functions to the driver functions that are appropriate
|
||||||
|
@ -468,7 +468,7 @@ void ( *vOLEDClear )( void ) = NULL;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed portCHAR *pcTaskName )
|
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
|
||||||
{
|
{
|
||||||
( void ) pxTask;
|
( void ) pxTask;
|
||||||
( void ) pcTaskName;
|
( void ) pcTaskName;
|
||||||
|
|
|
@ -90,7 +90,7 @@ zero. */
|
||||||
|
|
||||||
/* Misc defines. */
|
/* Misc defines. */
|
||||||
#define timerMAX_32BIT_VALUE ( 0xffffffffUL )
|
#define timerMAX_32BIT_VALUE ( 0xffffffffUL )
|
||||||
#define timerTIMER_1_COUNT_VALUE ( * ( ( volatile unsigned long * ) ( ( unsigned portLONG ) TIMER1_BASE + 0x48UL ) ) )
|
#define timerTIMER_1_COUNT_VALUE ( * ( ( volatile unsigned long * ) ( ( unsigned long ) TIMER1_BASE + 0x48UL ) ) )
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ zero. */
|
||||||
void Timer0IntHandler( void );
|
void Timer0IntHandler( void );
|
||||||
|
|
||||||
/* Stores the value of the maximum recorded jitter between interrupts. */
|
/* Stores the value of the maximum recorded jitter between interrupts. */
|
||||||
volatile unsigned portLONG ulMaxJitter = 0;
|
volatile unsigned long ulMaxJitter = 0;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -136,9 +136,9 @@ unsigned long ulFrequency;
|
||||||
|
|
||||||
void Timer0IntHandler( void )
|
void Timer0IntHandler( void )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulDifference;
|
unsigned long ulDifference;
|
||||||
volatile unsigned portLONG ulCurrentCount;
|
volatile unsigned long ulCurrentCount;
|
||||||
static unsigned portLONG ulMaxDifference = 0, ulLastCount = 0;
|
static unsigned long ulMaxDifference = 0, ulLastCount = 0;
|
||||||
|
|
||||||
/* We use the timer 1 counter value to measure the clock cycles between
|
/* We use the timer 1 counter value to measure the clock cycles between
|
||||||
the timer 0 interrupts. */
|
the timer 0 interrupts. */
|
||||||
|
|
|
@ -105,20 +105,20 @@ xSemaphoreHandle xMACInterruptSemaphore = NULL;
|
||||||
|
|
||||||
/* The buffer used by the uIP stack. In this case the pointer is used to
|
/* The buffer used by the uIP stack. In this case the pointer is used to
|
||||||
point to one of the Rx buffers. */
|
point to one of the Rx buffers. */
|
||||||
unsigned portCHAR *uip_buf;
|
unsigned char *uip_buf;
|
||||||
|
|
||||||
/* Buffers into which Rx data is placed. */
|
/* Buffers into which Rx data is placed. */
|
||||||
static union
|
static union
|
||||||
{
|
{
|
||||||
unsigned portLONG ulJustForAlignment;
|
unsigned long ulJustForAlignment;
|
||||||
unsigned portCHAR ucRxBuffers[ emacNUM_RX_BUFFERS ][ UIP_BUFSIZE + ( 4 * emacFRAM_SIZE_BYTES ) ];
|
unsigned char ucRxBuffers[ emacNUM_RX_BUFFERS ][ UIP_BUFSIZE + ( 4 * emacFRAM_SIZE_BYTES ) ];
|
||||||
} uxRxBuffers;
|
} uxRxBuffers;
|
||||||
|
|
||||||
/* The length of the data within each of the Rx buffers. */
|
/* The length of the data within each of the Rx buffers. */
|
||||||
static unsigned portLONG ulRxLength[ emacNUM_RX_BUFFERS ];
|
static unsigned long ulRxLength[ emacNUM_RX_BUFFERS ];
|
||||||
|
|
||||||
/* Used to keep a track of the number of bytes to transmit. */
|
/* Used to keep a track of the number of bytes to transmit. */
|
||||||
static unsigned portLONG ulNextTxSpace;
|
static unsigned long ulNextTxSpace;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ void vInitialiseSend( void )
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vIncrementTxLength( unsigned portLONG ulLength )
|
void vIncrementTxLength( unsigned long ulLength )
|
||||||
{
|
{
|
||||||
ulNextTxSpace += ulLength;
|
ulNextTxSpace += ulLength;
|
||||||
}
|
}
|
||||||
|
@ -203,11 +203,11 @@ void vIncrementTxLength( unsigned portLONG ulLength )
|
||||||
void vSendBufferToMAC( void )
|
void vSendBufferToMAC( void )
|
||||||
{
|
{
|
||||||
unsigned long *pulSource;
|
unsigned long *pulSource;
|
||||||
unsigned portSHORT * pus;
|
unsigned short * pus;
|
||||||
unsigned portLONG ulNextWord;
|
unsigned long ulNextWord;
|
||||||
|
|
||||||
/* Locate the data to be send. */
|
/* Locate the data to be send. */
|
||||||
pus = ( unsigned portSHORT * ) uip_buf;
|
pus = ( unsigned short * ) uip_buf;
|
||||||
|
|
||||||
/* Add in the size of the data. */
|
/* Add in the size of the data. */
|
||||||
pus--;
|
pus--;
|
||||||
|
@ -219,9 +219,9 @@ unsigned portLONG ulNextWord;
|
||||||
vTaskDelay( macWAIT_SEND_TIME );
|
vTaskDelay( macWAIT_SEND_TIME );
|
||||||
}
|
}
|
||||||
|
|
||||||
pulSource = ( unsigned portLONG * ) pus;
|
pulSource = ( unsigned long * ) pus;
|
||||||
|
|
||||||
for( ulNextWord = 0; ulNextWord < ulNextTxSpace; ulNextWord += sizeof( unsigned portLONG ) )
|
for( ulNextWord = 0; ulNextWord < ulNextTxSpace; ulNextWord += sizeof( unsigned long ) )
|
||||||
{
|
{
|
||||||
HWREG(ETH_BASE + MAC_O_DATA) = *pulSource;
|
HWREG(ETH_BASE + MAC_O_DATA) = *pulSource;
|
||||||
pulSource++;
|
pulSource++;
|
||||||
|
@ -235,7 +235,7 @@ unsigned portLONG ulNextWord;
|
||||||
void vEMAC_ISR( void )
|
void vEMAC_ISR( void )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
unsigned portLONG ulTemp;
|
unsigned long ulTemp;
|
||||||
|
|
||||||
/* Clear the interrupt. */
|
/* Clear the interrupt. */
|
||||||
ulTemp = EthernetIntStatus( ETH_BASE, pdFALSE );
|
ulTemp = EthernetIntStatus( ETH_BASE, pdFALSE );
|
||||||
|
@ -256,9 +256,9 @@ unsigned portLONG ulTemp;
|
||||||
void vMACHandleTask( void *pvParameters )
|
void vMACHandleTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
unsigned long i, ulInt;
|
unsigned long i, ulInt;
|
||||||
unsigned portLONG ulLength;
|
unsigned long ulLength;
|
||||||
unsigned long *pulBuffer;
|
unsigned long *pulBuffer;
|
||||||
static unsigned portLONG ulNextRxBuffer = 0;
|
static unsigned long ulNextRxBuffer = 0;
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
|
@ -289,7 +289,7 @@ static unsigned portLONG ulNextRxBuffer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read out the data into our buffer. */
|
/* Read out the data into our buffer. */
|
||||||
for( i = 0; i < ulLength; i += sizeof( unsigned portLONG ) )
|
for( i = 0; i < ulLength; i += sizeof( unsigned long ) )
|
||||||
{
|
{
|
||||||
*pulBuffer = HWREG( ETH_BASE + MAC_O_DATA );
|
*pulBuffer = HWREG( ETH_BASE + MAC_O_DATA );
|
||||||
pulBuffer++;
|
pulBuffer++;
|
||||||
|
|
|
@ -269,7 +269,7 @@ static void prvENET_Send(void)
|
||||||
|
|
||||||
static void prvSetMACAddress( void )
|
static void prvSetMACAddress( void )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulUser0, ulUser1;
|
unsigned long ulUser0, ulUser1;
|
||||||
unsigned char pucMACArray[8];
|
unsigned char pucMACArray[8];
|
||||||
struct uip_eth_addr xAddr;
|
struct uip_eth_addr xAddr;
|
||||||
|
|
||||||
|
@ -297,10 +297,10 @@ struct uip_eth_addr xAddr;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vApplicationProcessFormInput( portCHAR *pcInputString, portBASE_TYPE xInputLength )
|
void vApplicationProcessFormInput( char *pcInputString, portBASE_TYPE xInputLength )
|
||||||
{
|
{
|
||||||
char *c, *pcText;
|
char *c, *pcText;
|
||||||
static portCHAR cMessageForDisplay[ 32 ];
|
static char cMessageForDisplay[ 32 ];
|
||||||
extern xQueueHandle xOLEDQueue;
|
extern xQueueHandle xOLEDQueue;
|
||||||
xOLEDMessage xOLEDMessage;
|
xOLEDMessage xOLEDMessage;
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ xOLEDMessage xOLEDMessage;
|
||||||
|
|
||||||
/* Write the message to the LCD. */
|
/* Write the message to the LCD. */
|
||||||
strcpy( cMessageForDisplay, pcText );
|
strcpy( cMessageForDisplay, pcText );
|
||||||
xOLEDMessage.pcMessage = ( signed portCHAR * ) cMessageForDisplay;
|
xOLEDMessage.pcMessage = ( signed char * ) cMessageForDisplay;
|
||||||
xQueueSend( xOLEDQueue, &xOLEDMessage, portMAX_DELAY );
|
xQueueSend( xOLEDQueue, &xOLEDMessage, portMAX_DELAY );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,10 +92,10 @@
|
||||||
#define configUSE_TICK_HOOK 1
|
#define configUSE_TICK_HOOK 1
|
||||||
#define configUSE_TRACE_FACILITY 0
|
#define configUSE_TRACE_FACILITY 0
|
||||||
#define configUSE_16_BIT_TICKS 0
|
#define configUSE_16_BIT_TICKS 0
|
||||||
#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 50000000 ) /* Timer clock. */
|
#define configCPU_CLOCK_HZ ( ( unsigned long ) 50000000 ) /* Timer clock. */
|
||||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||||
#define configMAX_PRIORITIES ( 8 )
|
#define configMAX_PRIORITIES ( 8 )
|
||||||
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 128 )
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 )
|
||||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) 32768 )
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) 32768 )
|
||||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||||
#define configIDLE_SHOULD_YIELD 1
|
#define configIDLE_SHOULD_YIELD 1
|
||||||
|
|
|
@ -213,7 +213,7 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedC
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned portSHORT usStringLength )
|
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )
|
||||||
{
|
{
|
||||||
signed char *pxNext;
|
signed char *pxNext;
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
#define partstMAX_OUTPUT_LED ( 4 )
|
#define partstMAX_OUTPUT_LED ( 4 )
|
||||||
#define partstFIRST_LED GPIO_Pin_6
|
#define partstFIRST_LED GPIO_Pin_6
|
||||||
|
|
||||||
static unsigned portSHORT usOutputValue = 0;
|
static unsigned short usOutputValue = 0;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
|
|
||||||
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usBit;
|
unsigned short usBit;
|
||||||
|
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
{
|
{
|
||||||
|
@ -106,7 +106,7 @@ unsigned portSHORT usBit;
|
||||||
|
|
||||||
if( xValue == pdFALSE )
|
if( xValue == pdFALSE )
|
||||||
{
|
{
|
||||||
usBit ^= ( unsigned portSHORT ) 0xffff;
|
usBit ^= ( unsigned short ) 0xffff;
|
||||||
usOutputValue &= usBit;
|
usOutputValue &= usBit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -123,7 +123,7 @@ unsigned portSHORT usBit;
|
||||||
|
|
||||||
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usBit;
|
unsigned short usBit;
|
||||||
|
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
#define partstMAX_OUTPUT_LED ( 4 )
|
#define partstMAX_OUTPUT_LED ( 4 )
|
||||||
#define partstFIRST_LED GPIO_Pin_6
|
#define partstFIRST_LED GPIO_Pin_6
|
||||||
|
|
||||||
static unsigned portSHORT usOutputValue = 0;
|
static unsigned short usOutputValue = 0;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
|
|
||||||
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usBit;
|
unsigned short usBit;
|
||||||
|
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
{
|
{
|
||||||
|
@ -106,7 +106,7 @@ unsigned portSHORT usBit;
|
||||||
|
|
||||||
if( xValue == pdFALSE )
|
if( xValue == pdFALSE )
|
||||||
{
|
{
|
||||||
usBit ^= ( unsigned portSHORT ) 0xffff;
|
usBit ^= ( unsigned short ) 0xffff;
|
||||||
usOutputValue &= usBit;
|
usOutputValue &= usBit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -123,7 +123,7 @@ unsigned portSHORT usBit;
|
||||||
|
|
||||||
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usBit;
|
unsigned short usBit;
|
||||||
|
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
{
|
{
|
||||||
|
|
|
@ -150,7 +150,7 @@ time. */
|
||||||
#define mainCHECK_DELAY ( ( portTickType ) 5000 / portTICK_RATE_MS )
|
#define mainCHECK_DELAY ( ( portTickType ) 5000 / portTICK_RATE_MS )
|
||||||
|
|
||||||
/* The number of nano seconds between each processor clock. */
|
/* The number of nano seconds between each processor clock. */
|
||||||
#define mainNS_PER_CLOCK ( ( unsigned portLONG ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
||||||
|
|
||||||
/* Baud rate used by the comtest tasks. */
|
/* Baud rate used by the comtest tasks. */
|
||||||
#define mainCOM_TEST_BAUD_RATE ( 115200 )
|
#define mainCOM_TEST_BAUD_RATE ( 115200 )
|
||||||
|
@ -257,7 +257,7 @@ xLCDMessage xMessage;
|
||||||
|
|
||||||
/* Initialise the LCD and display a startup message. */
|
/* Initialise the LCD and display a startup message. */
|
||||||
prvConfigureLCD();
|
prvConfigureLCD();
|
||||||
LCD_DrawMonoPict( ( unsigned portLONG * ) pcBitmap );
|
LCD_DrawMonoPict( ( unsigned long * ) pcBitmap );
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
|
@ -265,7 +265,7 @@ xLCDMessage xMessage;
|
||||||
while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS );
|
while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS );
|
||||||
|
|
||||||
/* Display the message. Print each message to a different position. */
|
/* Display the message. Print each message to a different position. */
|
||||||
printf( ( portCHAR const * ) xMessage.pcMessage );
|
printf( ( char const * ) xMessage.pcMessage );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -274,8 +274,8 @@ static void vCheckTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
portTickType xLastExecutionTime;
|
portTickType xLastExecutionTime;
|
||||||
xLCDMessage xMessage;
|
xLCDMessage xMessage;
|
||||||
static signed portCHAR cPassMessage[ mainMAX_MSG_LEN ];
|
static signed char cPassMessage[ mainMAX_MSG_LEN ];
|
||||||
extern unsigned portSHORT usMaxJitter;
|
extern unsigned short usMaxJitter;
|
||||||
|
|
||||||
xLastExecutionTime = xTaskGetTickCount();
|
xLastExecutionTime = xTaskGetTickCount();
|
||||||
xMessage.pcMessage = cPassMessage;
|
xMessage.pcMessage = cPassMessage;
|
||||||
|
@ -317,7 +317,7 @@ extern unsigned portSHORT usMaxJitter;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf( ( portCHAR * ) cPassMessage, "PASS [%uns]\n", ( ( unsigned portLONG ) usMaxJitter ) * mainNS_PER_CLOCK );
|
sprintf( ( char * ) cPassMessage, "PASS [%uns]\n", ( ( unsigned long ) usMaxJitter ) * mainNS_PER_CLOCK );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send the message to the LCD gatekeeper for display. */
|
/* Send the message to the LCD gatekeeper for display. */
|
||||||
|
@ -340,7 +340,7 @@ static void prvSetupHardware( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 2 wait states required on the flash. */
|
/* 2 wait states required on the flash. */
|
||||||
*( ( unsigned portLONG * ) 0x40022000 ) = 0x02;
|
*( ( unsigned long * ) 0x40022000 ) = 0x02;
|
||||||
|
|
||||||
/* HCLK = SYSCLK */
|
/* HCLK = SYSCLK */
|
||||||
RCC_HCLKConfig( RCC_SYSCLK_Div1 );
|
RCC_HCLKConfig( RCC_SYSCLK_Div1 );
|
||||||
|
@ -418,8 +418,8 @@ GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
|
|
||||||
int fputc( int ch, FILE *f )
|
int fputc( int ch, FILE *f )
|
||||||
{
|
{
|
||||||
static unsigned portSHORT usColumn = 0, usRefColumn = mainCOLUMN_START;
|
static unsigned short usColumn = 0, usRefColumn = mainCOLUMN_START;
|
||||||
static unsigned portCHAR ucLine = 0;
|
static unsigned char ucLine = 0;
|
||||||
|
|
||||||
if( ( usColumn == 0 ) && ( ucLine == 0 ) )
|
if( ( usColumn == 0 ) && ( ucLine == 0 ) )
|
||||||
{
|
{
|
||||||
|
@ -463,7 +463,7 @@ static unsigned portCHAR ucLine = 0;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
/* Keep the linker happy. */
|
/* Keep the linker happy. */
|
||||||
void assert_failed( unsigned portCHAR* pcFile, unsigned portLONG ulLine )
|
void assert_failed( unsigned char* pcFile, unsigned long ulLine )
|
||||||
{
|
{
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,7 +100,7 @@ void vUARTInterruptHandler( void );
|
||||||
/*
|
/*
|
||||||
* See the serial2.h header file.
|
* See the serial2.h header file.
|
||||||
*/
|
*/
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
xComPortHandle xReturn;
|
xComPortHandle xReturn;
|
||||||
USART_InitTypeDef USART_InitStructure;
|
USART_InitTypeDef USART_InitStructure;
|
||||||
|
@ -108,8 +108,8 @@ NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
GPIO_InitTypeDef GPIO_InitStructure;
|
GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
|
|
||||||
/* Create the queues used to hold Rx/Tx characters. */
|
/* Create the queues used to hold Rx/Tx characters. */
|
||||||
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
|
|
||||||
/* If the queue/semaphore was created correctly then setup the serial port
|
/* If the queue/semaphore was created correctly then setup the serial port
|
||||||
hardware. */
|
hardware. */
|
||||||
|
@ -163,7 +163,7 @@ GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* The port handle is not required as this driver only supports one port. */
|
/* The port handle is not required as this driver only supports one port. */
|
||||||
( void ) pxPort;
|
( void ) pxPort;
|
||||||
|
@ -181,9 +181,9 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcR
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vSerialPutString( xComPortHandle pxPort, const signed portCHAR * const pcString, unsigned portSHORT usStringLength )
|
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )
|
||||||
{
|
{
|
||||||
signed portCHAR *pxNext;
|
signed char *pxNext;
|
||||||
|
|
||||||
/* A couple of parameters that this port does not use. */
|
/* A couple of parameters that this port does not use. */
|
||||||
( void ) usStringLength;
|
( void ) usStringLength;
|
||||||
|
@ -196,7 +196,7 @@ signed portCHAR *pxNext;
|
||||||
( void ) pxPort;
|
( void ) pxPort;
|
||||||
|
|
||||||
/* Send each character in the string, one at a time. */
|
/* Send each character in the string, one at a time. */
|
||||||
pxNext = ( signed portCHAR * ) pcString;
|
pxNext = ( signed char * ) pcString;
|
||||||
while( *pxNext )
|
while( *pxNext )
|
||||||
{
|
{
|
||||||
xSerialPutChar( pxPort, *pxNext, serNO_BLOCK );
|
xSerialPutChar( pxPort, *pxNext, serNO_BLOCK );
|
||||||
|
@ -205,7 +205,7 @@ signed portCHAR *pxNext;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
signed portBASE_TYPE xReturn;
|
signed portBASE_TYPE xReturn;
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ void vSerialClose( xComPortHandle xPort )
|
||||||
void vUARTInterruptHandler( void )
|
void vUARTInterruptHandler( void )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
portCHAR cChar;
|
char cChar;
|
||||||
|
|
||||||
if( USART_GetITStatus( USART1, USART_IT_TXE ) == SET )
|
if( USART_GetITStatus( USART1, USART_IT_TXE ) == SET )
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
|
|
||||||
/* The set frequency of the interrupt. Deviations from this are measured as
|
/* The set frequency of the interrupt. Deviations from this are measured as
|
||||||
the jitter. */
|
the jitter. */
|
||||||
#define timerINTERRUPT_FREQUENCY ( ( unsigned portSHORT ) 20000 )
|
#define timerINTERRUPT_FREQUENCY ( ( unsigned short ) 20000 )
|
||||||
|
|
||||||
/* The expected time between each of the timer interrupts - if the jitter was
|
/* The expected time between each of the timer interrupts - if the jitter was
|
||||||
zero. */
|
zero. */
|
||||||
|
@ -102,7 +102,7 @@ void vSetupTimerTest( void );
|
||||||
void vTimer2IntHandler( void );
|
void vTimer2IntHandler( void );
|
||||||
|
|
||||||
/* Stores the value of the maximum recorded jitter between interrupts. */
|
/* Stores the value of the maximum recorded jitter between interrupts. */
|
||||||
volatile unsigned portSHORT usMaxJitter = 0;
|
volatile unsigned short usMaxJitter = 0;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
|
|
||||||
/* Time base configuration for timer 2 - which generates the interrupts. */
|
/* Time base configuration for timer 2 - which generates the interrupts. */
|
||||||
ulFrequency = configCPU_CLOCK_HZ / timerINTERRUPT_FREQUENCY;
|
ulFrequency = configCPU_CLOCK_HZ / timerINTERRUPT_FREQUENCY;
|
||||||
TIM_TimeBaseStructure.TIM_Period = ( unsigned portSHORT ) ( ulFrequency & 0xffffUL );
|
TIM_TimeBaseStructure.TIM_Period = ( unsigned short ) ( ulFrequency & 0xffffUL );
|
||||||
TIM_TimeBaseStructure.TIM_Prescaler = 0x0;
|
TIM_TimeBaseStructure.TIM_Prescaler = 0x0;
|
||||||
TIM_TimeBaseStructure.TIM_ClockDivision = 0x0;
|
TIM_TimeBaseStructure.TIM_ClockDivision = 0x0;
|
||||||
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
|
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
|
||||||
|
@ -134,7 +134,7 @@ NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
|
|
||||||
/* Configuration for timer 3 which is used as a high resolution time
|
/* Configuration for timer 3 which is used as a high resolution time
|
||||||
measurement. */
|
measurement. */
|
||||||
TIM_TimeBaseStructure.TIM_Period = ( unsigned portSHORT ) 0xffff;
|
TIM_TimeBaseStructure.TIM_Period = ( unsigned short ) 0xffff;
|
||||||
TIM_TimeBaseInit( TIM3, &TIM_TimeBaseStructure );
|
TIM_TimeBaseInit( TIM3, &TIM_TimeBaseStructure );
|
||||||
TIM_ARRPreloadConfig( TIM3, ENABLE );
|
TIM_ARRPreloadConfig( TIM3, ENABLE );
|
||||||
|
|
||||||
|
@ -154,8 +154,8 @@ NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
|
|
||||||
void vTimer2IntHandler( void )
|
void vTimer2IntHandler( void )
|
||||||
{
|
{
|
||||||
static unsigned portSHORT usLastCount = 0, usSettleCount = 0, usMaxDifference = 0;
|
static unsigned short usLastCount = 0, usSettleCount = 0, usMaxDifference = 0;
|
||||||
unsigned portSHORT usThisCount, usDifference;
|
unsigned short usThisCount, usDifference;
|
||||||
|
|
||||||
/* Capture the free running timer 3 value as we enter the interrupt. */
|
/* Capture the free running timer 3 value as we enter the interrupt. */
|
||||||
usThisCount = TIM3->CNT;
|
usThisCount = TIM3->CNT;
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
#define partstMAX_OUTPUT_LED ( 4 )
|
#define partstMAX_OUTPUT_LED ( 4 )
|
||||||
#define partstFIRST_LED GPIO_Pin_6
|
#define partstFIRST_LED GPIO_Pin_6
|
||||||
|
|
||||||
static unsigned portSHORT usOutputValue = 0;
|
static unsigned short usOutputValue = 0;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
|
|
||||||
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usBit;
|
unsigned short usBit;
|
||||||
|
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
{
|
{
|
||||||
|
@ -106,7 +106,7 @@ unsigned portSHORT usBit;
|
||||||
|
|
||||||
if( xValue == pdFALSE )
|
if( xValue == pdFALSE )
|
||||||
{
|
{
|
||||||
usBit ^= ( unsigned portSHORT ) 0xffff;
|
usBit ^= ( unsigned short ) 0xffff;
|
||||||
usOutputValue &= usBit;
|
usOutputValue &= usBit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -123,7 +123,7 @@ unsigned portSHORT usBit;
|
||||||
|
|
||||||
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usBit;
|
unsigned short usBit;
|
||||||
|
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
{
|
{
|
||||||
|
|
|
@ -150,7 +150,7 @@ time. */
|
||||||
#define mainCHECK_DELAY ( ( portTickType ) 5000 / portTICK_RATE_MS )
|
#define mainCHECK_DELAY ( ( portTickType ) 5000 / portTICK_RATE_MS )
|
||||||
|
|
||||||
/* The number of nano seconds between each processor clock. */
|
/* The number of nano seconds between each processor clock. */
|
||||||
#define mainNS_PER_CLOCK ( ( unsigned portLONG ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
||||||
|
|
||||||
/* Baud rate used by the comtest tasks. */
|
/* Baud rate used by the comtest tasks. */
|
||||||
#define mainCOM_TEST_BAUD_RATE ( 115200 )
|
#define mainCOM_TEST_BAUD_RATE ( 115200 )
|
||||||
|
@ -257,7 +257,7 @@ xLCDMessage xMessage;
|
||||||
|
|
||||||
/* Initialise the LCD and display a startup message. */
|
/* Initialise the LCD and display a startup message. */
|
||||||
prvConfigureLCD();
|
prvConfigureLCD();
|
||||||
LCD_DrawMonoPict( ( unsigned portLONG * ) pcBitmap );
|
LCD_DrawMonoPict( ( unsigned long * ) pcBitmap );
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
|
@ -265,7 +265,7 @@ xLCDMessage xMessage;
|
||||||
while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS );
|
while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS );
|
||||||
|
|
||||||
/* Display the message. Print each message to a different position. */
|
/* Display the message. Print each message to a different position. */
|
||||||
printf( ( portCHAR const * ) xMessage.pcMessage );
|
printf( ( char const * ) xMessage.pcMessage );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -274,8 +274,8 @@ static void vCheckTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
portTickType xLastExecutionTime;
|
portTickType xLastExecutionTime;
|
||||||
xLCDMessage xMessage;
|
xLCDMessage xMessage;
|
||||||
static signed portCHAR cPassMessage[ mainMAX_MSG_LEN ];
|
static signed char cPassMessage[ mainMAX_MSG_LEN ];
|
||||||
extern unsigned portSHORT usMaxJitter;
|
extern unsigned short usMaxJitter;
|
||||||
|
|
||||||
xLastExecutionTime = xTaskGetTickCount();
|
xLastExecutionTime = xTaskGetTickCount();
|
||||||
xMessage.pcMessage = cPassMessage;
|
xMessage.pcMessage = cPassMessage;
|
||||||
|
@ -317,7 +317,7 @@ extern unsigned portSHORT usMaxJitter;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf( ( portCHAR * ) cPassMessage, "PASS [%uns]\n", ( ( unsigned portLONG ) usMaxJitter ) * mainNS_PER_CLOCK );
|
sprintf( ( char * ) cPassMessage, "PASS [%uns]\n", ( ( unsigned long ) usMaxJitter ) * mainNS_PER_CLOCK );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send the message to the LCD gatekeeper for display. */
|
/* Send the message to the LCD gatekeeper for display. */
|
||||||
|
@ -340,7 +340,7 @@ static void prvSetupHardware( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 2 wait states required on the flash. */
|
/* 2 wait states required on the flash. */
|
||||||
*( ( unsigned portLONG * ) 0x40022000 ) = 0x02;
|
*( ( unsigned long * ) 0x40022000 ) = 0x02;
|
||||||
|
|
||||||
/* HCLK = SYSCLK */
|
/* HCLK = SYSCLK */
|
||||||
RCC_HCLKConfig( RCC_SYSCLK_Div1 );
|
RCC_HCLKConfig( RCC_SYSCLK_Div1 );
|
||||||
|
@ -418,8 +418,8 @@ GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
|
|
||||||
int fputc( int ch, FILE *f )
|
int fputc( int ch, FILE *f )
|
||||||
{
|
{
|
||||||
static unsigned portSHORT usColumn = 0, usRefColumn = mainCOLUMN_START;
|
static unsigned short usColumn = 0, usRefColumn = mainCOLUMN_START;
|
||||||
static unsigned portCHAR ucLine = 0;
|
static unsigned char ucLine = 0;
|
||||||
|
|
||||||
if( ( usColumn == 0 ) && ( ucLine == 0 ) )
|
if( ( usColumn == 0 ) && ( ucLine == 0 ) )
|
||||||
{
|
{
|
||||||
|
@ -463,7 +463,7 @@ static unsigned portCHAR ucLine = 0;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
/* Keep the linker happy. */
|
/* Keep the linker happy. */
|
||||||
void assert_failed( unsigned portCHAR* pcFile, unsigned portLONG ulLine )
|
void assert_failed( unsigned char* pcFile, unsigned long ulLine )
|
||||||
{
|
{
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,7 +100,7 @@ void vUARTInterruptHandler( void );
|
||||||
/*
|
/*
|
||||||
* See the serial2.h header file.
|
* See the serial2.h header file.
|
||||||
*/
|
*/
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
xComPortHandle xReturn;
|
xComPortHandle xReturn;
|
||||||
USART_InitTypeDef USART_InitStructure;
|
USART_InitTypeDef USART_InitStructure;
|
||||||
|
@ -108,8 +108,8 @@ NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
GPIO_InitTypeDef GPIO_InitStructure;
|
GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
|
|
||||||
/* Create the queues used to hold Rx/Tx characters. */
|
/* Create the queues used to hold Rx/Tx characters. */
|
||||||
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
|
|
||||||
/* If the queue/semaphore was created correctly then setup the serial port
|
/* If the queue/semaphore was created correctly then setup the serial port
|
||||||
hardware. */
|
hardware. */
|
||||||
|
@ -163,7 +163,7 @@ GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* The port handle is not required as this driver only supports one port. */
|
/* The port handle is not required as this driver only supports one port. */
|
||||||
( void ) pxPort;
|
( void ) pxPort;
|
||||||
|
@ -181,9 +181,9 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcR
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vSerialPutString( xComPortHandle pxPort, const signed portCHAR * const pcString, unsigned portSHORT usStringLength )
|
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )
|
||||||
{
|
{
|
||||||
signed portCHAR *pxNext;
|
signed char *pxNext;
|
||||||
|
|
||||||
/* A couple of parameters that this port does not use. */
|
/* A couple of parameters that this port does not use. */
|
||||||
( void ) usStringLength;
|
( void ) usStringLength;
|
||||||
|
@ -196,7 +196,7 @@ signed portCHAR *pxNext;
|
||||||
( void ) pxPort;
|
( void ) pxPort;
|
||||||
|
|
||||||
/* Send each character in the string, one at a time. */
|
/* Send each character in the string, one at a time. */
|
||||||
pxNext = ( signed portCHAR * ) pcString;
|
pxNext = ( signed char * ) pcString;
|
||||||
while( *pxNext )
|
while( *pxNext )
|
||||||
{
|
{
|
||||||
xSerialPutChar( pxPort, *pxNext, serNO_BLOCK );
|
xSerialPutChar( pxPort, *pxNext, serNO_BLOCK );
|
||||||
|
@ -205,7 +205,7 @@ signed portCHAR *pxNext;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
signed portBASE_TYPE xReturn;
|
signed portBASE_TYPE xReturn;
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ void vSerialClose( xComPortHandle xPort )
|
||||||
void vUARTInterruptHandler( void )
|
void vUARTInterruptHandler( void )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
portCHAR cChar;
|
char cChar;
|
||||||
|
|
||||||
if( USART_GetITStatus( USART1, USART_IT_TXE ) == SET )
|
if( USART_GetITStatus( USART1, USART_IT_TXE ) == SET )
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
|
|
||||||
/* The set frequency of the interrupt. Deviations from this are measured as
|
/* The set frequency of the interrupt. Deviations from this are measured as
|
||||||
the jitter. */
|
the jitter. */
|
||||||
#define timerINTERRUPT_FREQUENCY ( ( unsigned portSHORT ) 20000 )
|
#define timerINTERRUPT_FREQUENCY ( ( unsigned short ) 20000 )
|
||||||
|
|
||||||
/* The expected time between each of the timer interrupts - if the jitter was
|
/* The expected time between each of the timer interrupts - if the jitter was
|
||||||
zero. */
|
zero. */
|
||||||
|
@ -102,7 +102,7 @@ void vSetupTimerTest( void );
|
||||||
void vTimer2IntHandler( void );
|
void vTimer2IntHandler( void );
|
||||||
|
|
||||||
/* Stores the value of the maximum recorded jitter between interrupts. */
|
/* Stores the value of the maximum recorded jitter between interrupts. */
|
||||||
volatile unsigned portSHORT usMaxJitter = 0;
|
volatile unsigned short usMaxJitter = 0;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
|
|
||||||
/* Time base configuration for timer 2 - which generates the interrupts. */
|
/* Time base configuration for timer 2 - which generates the interrupts. */
|
||||||
ulFrequency = configCPU_CLOCK_HZ / timerINTERRUPT_FREQUENCY;
|
ulFrequency = configCPU_CLOCK_HZ / timerINTERRUPT_FREQUENCY;
|
||||||
TIM_TimeBaseStructure.TIM_Period = ( unsigned portSHORT ) ( ulFrequency & 0xffffUL );
|
TIM_TimeBaseStructure.TIM_Period = ( unsigned short ) ( ulFrequency & 0xffffUL );
|
||||||
TIM_TimeBaseStructure.TIM_Prescaler = 0x0;
|
TIM_TimeBaseStructure.TIM_Prescaler = 0x0;
|
||||||
TIM_TimeBaseStructure.TIM_ClockDivision = 0x0;
|
TIM_TimeBaseStructure.TIM_ClockDivision = 0x0;
|
||||||
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
|
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
|
||||||
|
@ -134,7 +134,7 @@ NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
|
|
||||||
/* Configuration for timer 3 which is used as a high resolution time
|
/* Configuration for timer 3 which is used as a high resolution time
|
||||||
measurement. */
|
measurement. */
|
||||||
TIM_TimeBaseStructure.TIM_Period = ( unsigned portSHORT ) 0xffff;
|
TIM_TimeBaseStructure.TIM_Period = ( unsigned short ) 0xffff;
|
||||||
TIM_TimeBaseInit( TIM3, &TIM_TimeBaseStructure );
|
TIM_TimeBaseInit( TIM3, &TIM_TimeBaseStructure );
|
||||||
TIM_ARRPreloadConfig( TIM3, ENABLE );
|
TIM_ARRPreloadConfig( TIM3, ENABLE );
|
||||||
|
|
||||||
|
@ -154,8 +154,8 @@ NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
|
|
||||||
void vTimer2IntHandler( void )
|
void vTimer2IntHandler( void )
|
||||||
{
|
{
|
||||||
static unsigned portSHORT usLastCount = 0, usSettleCount = 0, usMaxDifference = 0;
|
static unsigned short usLastCount = 0, usSettleCount = 0, usMaxDifference = 0;
|
||||||
unsigned portSHORT usThisCount, usDifference;
|
unsigned short usThisCount, usDifference;
|
||||||
|
|
||||||
/* Capture the free running timer 3 value as we enter the interrupt. */
|
/* Capture the free running timer 3 value as we enter the interrupt. */
|
||||||
usThisCount = TIM3->CNT;
|
usThisCount = TIM3->CNT;
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
#define partstMAX_OUTPUT_LED ( 2 )
|
#define partstMAX_OUTPUT_LED ( 2 )
|
||||||
#define partstFIRST_LED GPIO_Pin_8
|
#define partstFIRST_LED GPIO_Pin_8
|
||||||
|
|
||||||
static unsigned portSHORT usOutputValue = 0;
|
static unsigned short usOutputValue = 0;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
|
|
||||||
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usBit;
|
unsigned short usBit;
|
||||||
|
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
{
|
{
|
||||||
|
@ -107,7 +107,7 @@ unsigned portSHORT usBit;
|
||||||
|
|
||||||
if( xValue == pdFALSE )
|
if( xValue == pdFALSE )
|
||||||
{
|
{
|
||||||
usBit ^= ( unsigned portSHORT ) 0xffff;
|
usBit ^= ( unsigned short ) 0xffff;
|
||||||
usOutputValue &= usBit;
|
usOutputValue &= usBit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -124,7 +124,7 @@ unsigned portSHORT usBit;
|
||||||
|
|
||||||
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usBit;
|
unsigned short usBit;
|
||||||
|
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
{
|
{
|
||||||
|
|
|
@ -173,7 +173,7 @@ these can require a larger stack. */
|
||||||
#define mainFLASH_DELAY ( ( portTickType ) 1000 / portTICK_RATE_MS )
|
#define mainFLASH_DELAY ( ( portTickType ) 1000 / portTICK_RATE_MS )
|
||||||
|
|
||||||
/* The number of nano seconds between each processor clock. */
|
/* The number of nano seconds between each processor clock. */
|
||||||
#define mainNS_PER_CLOCK ( ( unsigned portLONG ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )
|
||||||
|
|
||||||
/* The two types of message that can be sent to the LCD task. */
|
/* The two types of message that can be sent to the LCD task. */
|
||||||
#define mainUPDATE_BALL_MESSAGE ( 0 )
|
#define mainUPDATE_BALL_MESSAGE ( 0 )
|
||||||
|
@ -279,9 +279,9 @@ int main( void )
|
||||||
void prvLCDTask( void *pvParameters )
|
void prvLCDTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
xLCDMessage xMessage;
|
xLCDMessage xMessage;
|
||||||
portCHAR cY = mainLCD_CHAR_HEIGHT;
|
char cY = mainLCD_CHAR_HEIGHT;
|
||||||
const portCHAR * const pcString = "www.FreeRTOS.org";
|
const char * const pcString = "www.FreeRTOS.org";
|
||||||
const portCHAR * const pcBlankLine = " ";
|
const char * const pcBlankLine = " ";
|
||||||
|
|
||||||
DRAW_Init();
|
DRAW_Init();
|
||||||
|
|
||||||
|
@ -330,8 +330,8 @@ static void prvCheckTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
portTickType xLastExecutionTime;
|
portTickType xLastExecutionTime;
|
||||||
xLCDMessage xMessage;
|
xLCDMessage xMessage;
|
||||||
static signed portCHAR cPassMessage[ mainMAX_MSG_LEN ];
|
static signed char cPassMessage[ mainMAX_MSG_LEN ];
|
||||||
extern unsigned portSHORT usMaxJitter;
|
extern unsigned short usMaxJitter;
|
||||||
|
|
||||||
/* Initialise the xLastExecutionTime variable on task entry. */
|
/* Initialise the xLastExecutionTime variable on task entry. */
|
||||||
xLastExecutionTime = xTaskGetTickCount();
|
xLastExecutionTime = xTaskGetTickCount();
|
||||||
|
@ -374,7 +374,7 @@ extern unsigned portSHORT usMaxJitter;
|
||||||
with the max measured jitter time also included (as per the
|
with the max measured jitter time also included (as per the
|
||||||
fast interrupt test described at the top of this file and on
|
fast interrupt test described at the top of this file and on
|
||||||
the online documentation page for this demo application). */
|
the online documentation page for this demo application). */
|
||||||
sprintf( ( portCHAR * ) cPassMessage, "PASS [%uns]", ( ( unsigned portLONG ) usMaxJitter ) * mainNS_PER_CLOCK );
|
sprintf( ( char * ) cPassMessage, "PASS [%uns]", ( ( unsigned long ) usMaxJitter ) * mainNS_PER_CLOCK );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send the message to the LCD gatekeeper for display. */
|
/* Send the message to the LCD gatekeeper for display. */
|
||||||
|
@ -385,7 +385,7 @@ extern unsigned portSHORT usMaxJitter;
|
||||||
|
|
||||||
void vApplicationTickHook( void )
|
void vApplicationTickHook( void )
|
||||||
{
|
{
|
||||||
static unsigned portLONG ulCallCount;
|
static unsigned long ulCallCount;
|
||||||
static const xLCDMessage xMemsMessage = { mainUPDATE_BALL_MESSAGE, NULL };
|
static const xLCDMessage xMemsMessage = { mainUPDATE_BALL_MESSAGE, NULL };
|
||||||
static portBASE_TYPE xHigherPriorityTaskWoken;
|
static portBASE_TYPE xHigherPriorityTaskWoken;
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ static void prvSetupHardware( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 2 wait states required on the flash. */
|
/* 2 wait states required on the flash. */
|
||||||
*( ( unsigned portLONG * ) 0x40022000 ) = 0x02;
|
*( ( unsigned long * ) 0x40022000 ) = 0x02;
|
||||||
|
|
||||||
/* HCLK = SYSCLK */
|
/* HCLK = SYSCLK */
|
||||||
RCC_HCLKConfig( RCC_SYSCLK_Div1 );
|
RCC_HCLKConfig( RCC_SYSCLK_Div1 );
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
|
|
||||||
/* The set frequency of the interrupt. Deviations from this are measured as
|
/* The set frequency of the interrupt. Deviations from this are measured as
|
||||||
the jitter. */
|
the jitter. */
|
||||||
#define timerINTERRUPT_FREQUENCY ( ( unsigned portSHORT ) 20000 )
|
#define timerINTERRUPT_FREQUENCY ( ( unsigned short ) 20000 )
|
||||||
|
|
||||||
/* The expected time between each of the timer interrupts - if the jitter was
|
/* The expected time between each of the timer interrupts - if the jitter was
|
||||||
zero. */
|
zero. */
|
||||||
|
@ -102,7 +102,7 @@ void vSetupTimerTest( void );
|
||||||
void vTimer2IntHandler( void );
|
void vTimer2IntHandler( void );
|
||||||
|
|
||||||
/* Stores the value of the maximum recorded jitter between interrupts. */
|
/* Stores the value of the maximum recorded jitter between interrupts. */
|
||||||
volatile unsigned portSHORT usMaxJitter = 0;
|
volatile unsigned short usMaxJitter = 0;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
|
|
||||||
/* Time base configuration for timer 2 - which generates the interrupts. */
|
/* Time base configuration for timer 2 - which generates the interrupts. */
|
||||||
ulFrequency = configCPU_CLOCK_HZ / timerINTERRUPT_FREQUENCY;
|
ulFrequency = configCPU_CLOCK_HZ / timerINTERRUPT_FREQUENCY;
|
||||||
TIM_TimeBaseStructure.TIM_Period = ( unsigned portSHORT ) ( ulFrequency & 0xffffUL );
|
TIM_TimeBaseStructure.TIM_Period = ( unsigned short ) ( ulFrequency & 0xffffUL );
|
||||||
TIM_TimeBaseStructure.TIM_Prescaler = 0x0;
|
TIM_TimeBaseStructure.TIM_Prescaler = 0x0;
|
||||||
TIM_TimeBaseStructure.TIM_ClockDivision = 0x0;
|
TIM_TimeBaseStructure.TIM_ClockDivision = 0x0;
|
||||||
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
|
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
|
||||||
|
@ -134,7 +134,7 @@ NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
|
|
||||||
/* Configuration for timer 3 which is used as a high resolution time
|
/* Configuration for timer 3 which is used as a high resolution time
|
||||||
measurement. */
|
measurement. */
|
||||||
TIM_TimeBaseStructure.TIM_Period = ( unsigned portSHORT ) 0xffff;
|
TIM_TimeBaseStructure.TIM_Period = ( unsigned short ) 0xffff;
|
||||||
TIM_TimeBaseInit( TIM3, &TIM_TimeBaseStructure );
|
TIM_TimeBaseInit( TIM3, &TIM_TimeBaseStructure );
|
||||||
TIM_ARRPreloadConfig( TIM3, ENABLE );
|
TIM_ARRPreloadConfig( TIM3, ENABLE );
|
||||||
|
|
||||||
|
@ -154,8 +154,8 @@ NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
|
|
||||||
void vTimer2IntHandler( void )
|
void vTimer2IntHandler( void )
|
||||||
{
|
{
|
||||||
static unsigned portSHORT usLastCount = 0, usSettleCount = 0, usMaxDifference = 0;
|
static unsigned short usLastCount = 0, usSettleCount = 0, usMaxDifference = 0;
|
||||||
unsigned portSHORT usThisCount, usDifference;
|
unsigned short usThisCount, usDifference;
|
||||||
|
|
||||||
/* Capture the free running timer 3 value as we enter the interrupt. */
|
/* Capture the free running timer 3 value as we enter the interrupt. */
|
||||||
usThisCount = TIM3->CNT;
|
usThisCount = TIM3->CNT;
|
||||||
|
|
|
@ -104,15 +104,15 @@ static xQueueHandle xCharsForTx;
|
||||||
/*
|
/*
|
||||||
* See the serial2.h header file.
|
* See the serial2.h header file.
|
||||||
*/
|
*/
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
USART_InitTypeDef USART_InitStructure;
|
USART_InitTypeDef USART_InitStructure;
|
||||||
xComPortHandle xReturn;
|
xComPortHandle xReturn;
|
||||||
NVIC_InitTypeDef NVIC_InitStructure;
|
NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
|
|
||||||
/* Create the queues used to hold Rx/Tx characters. */
|
/* Create the queues used to hold Rx/Tx characters. */
|
||||||
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
|
|
||||||
/* If the queues were created correctly then setup the serial port
|
/* If the queues were created correctly then setup the serial port
|
||||||
hardware. */
|
hardware. */
|
||||||
|
@ -147,7 +147,7 @@ NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* The port handle is not required as this driver only supports one port. */
|
/* The port handle is not required as this driver only supports one port. */
|
||||||
( void ) pxPort;
|
( void ) pxPort;
|
||||||
|
@ -165,9 +165,9 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcR
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vSerialPutString( xComPortHandle pxPort, const signed portCHAR * const pcString, unsigned portSHORT usStringLength )
|
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )
|
||||||
{
|
{
|
||||||
signed portCHAR *pxNext;
|
signed char *pxNext;
|
||||||
|
|
||||||
/* A couple of parameters that this port does not use. */
|
/* A couple of parameters that this port does not use. */
|
||||||
( void ) usStringLength;
|
( void ) usStringLength;
|
||||||
|
@ -180,7 +180,7 @@ signed portCHAR *pxNext;
|
||||||
( void ) pxPort;
|
( void ) pxPort;
|
||||||
|
|
||||||
/* Send each character in the string, one at a time. */
|
/* Send each character in the string, one at a time. */
|
||||||
pxNext = ( signed portCHAR * ) pcString;
|
pxNext = ( signed char * ) pcString;
|
||||||
while( *pxNext )
|
while( *pxNext )
|
||||||
{
|
{
|
||||||
xSerialPutChar( pxPort, *pxNext, serNO_BLOCK );
|
xSerialPutChar( pxPort, *pxNext, serNO_BLOCK );
|
||||||
|
@ -189,7 +189,7 @@ signed portCHAR *pxNext;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
signed portBASE_TYPE xReturn;
|
signed portBASE_TYPE xReturn;
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ void vSerialClose( xComPortHandle xPort )
|
||||||
void USART3_IRQHandler( void )
|
void USART3_IRQHandler( void )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
portCHAR cChar;
|
char cChar;
|
||||||
|
|
||||||
if( USART_GetITStatus( USART3, USART_IT_TXE ) == SET )
|
if( USART_GetITStatus( USART3, USART_IT_TXE ) == SET )
|
||||||
{
|
{
|
||||||
|
|
|
@ -111,7 +111,7 @@ __declspec(interrupt:0) void vPIT0InterruptHandler( void );
|
||||||
*/
|
*/
|
||||||
void vApplicationSetupInterrupts( void )
|
void vApplicationSetupInterrupts( void )
|
||||||
{
|
{
|
||||||
const unsigned portSHORT usCompareMatchValue = ( ( configCPU_CLOCK_HZ / portPRESCALE_VALUE ) / configTICK_RATE_HZ );
|
const unsigned short usCompareMatchValue = ( ( configCPU_CLOCK_HZ / portPRESCALE_VALUE ) / configTICK_RATE_HZ );
|
||||||
|
|
||||||
/* Configure interrupt priority and level and unmask interrupt for PIT0. */
|
/* Configure interrupt priority and level and unmask interrupt for PIT0. */
|
||||||
MCF_INTC0_ICR55 = ( 1 | ( configKERNEL_INTERRUPT_PRIORITY << 3 ) );
|
MCF_INTC0_ICR55 = ( 1 | ( configKERNEL_INTERRUPT_PRIORITY << 3 ) );
|
||||||
|
@ -132,7 +132,7 @@ const unsigned portSHORT usCompareMatchValue = ( ( configCPU_CLOCK_HZ / portPRES
|
||||||
|
|
||||||
__declspec(interrupt:0) void vPIT0InterruptHandler( void )
|
__declspec(interrupt:0) void vPIT0InterruptHandler( void )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulSavedInterruptMask;
|
unsigned long ulSavedInterruptMask;
|
||||||
|
|
||||||
/* Clear the PIT0 interrupt. */
|
/* Clear the PIT0 interrupt. */
|
||||||
MCF_PIT0_PCSR |= MCF_PIT_PCSR_PIF;
|
MCF_PIT0_PCSR |= MCF_PIT_PCSR_PIF;
|
||||||
|
|
|
@ -117,7 +117,7 @@ error have been detected. */
|
||||||
#define mainCHECK_LED ( 3 )
|
#define mainCHECK_LED ( 3 )
|
||||||
|
|
||||||
/* ComTest constants - there is no free LED for the comtest tasks. */
|
/* ComTest constants - there is no free LED for the comtest tasks. */
|
||||||
#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 19200 )
|
#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 19200 )
|
||||||
#define mainCOM_TEST_LED ( 5 )
|
#define mainCOM_TEST_LED ( 5 )
|
||||||
|
|
||||||
/* Task priorities. */
|
/* Task priorities. */
|
||||||
|
@ -157,7 +157,7 @@ static void vRegTest2Task( void *pvParameters );
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* Counters used to detect errors within the reg test tasks. */
|
/* Counters used to detect errors within the reg test tasks. */
|
||||||
static volatile unsigned portLONG ulRegTest1Counter = 0x11111111, ulRegTest2Counter = 0x22222222;
|
static volatile unsigned long ulRegTest1Counter = 0x11111111, ulRegTest2Counter = 0x22222222;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ int main( void )
|
||||||
|
|
||||||
static void prvCheckTask( void *pvParameters )
|
static void prvCheckTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulTicksToWait = mainNO_ERROR_PERIOD, ulError = 0, ulLastRegTest1Count = 0, ulLastRegTest2Count = 0;
|
unsigned long ulTicksToWait = mainNO_ERROR_PERIOD, ulError = 0, ulLastRegTest1Count = 0, ulLastRegTest2Count = 0;
|
||||||
portTickType xLastExecutionTime;
|
portTickType xLastExecutionTime;
|
||||||
volatile unsigned portBASE_TYPE uxUnusedStack;
|
volatile unsigned portBASE_TYPE uxUnusedStack;
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ void prvSetupHardware( void )
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed portCHAR *pcTaskName )
|
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
|
||||||
{
|
{
|
||||||
/* This will get called if a stack overflow is detected during the context
|
/* This will get called if a stack overflow is detected during the context
|
||||||
switch. Set configCHECK_FOR_STACK_OVERFLOWS to 2 to also check for stack
|
switch. Set configCHECK_FOR_STACK_OVERFLOWS to 2 to also check for stack
|
||||||
|
|
|
@ -82,14 +82,14 @@ an example of an efficient driver. */
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
|
|
||||||
/* Hardware definitions. */
|
/* Hardware definitions. */
|
||||||
#define serNO_PARITY ( ( unsigned portCHAR ) 0x02 << 3 )
|
#define serNO_PARITY ( ( unsigned char ) 0x02 << 3 )
|
||||||
#define ser8DATA_BITS ( ( unsigned portCHAR ) 0x03 )
|
#define ser8DATA_BITS ( ( unsigned char ) 0x03 )
|
||||||
#define ser1STOP_BIT ( ( unsigned portCHAR ) 0x07 )
|
#define ser1STOP_BIT ( ( unsigned char ) 0x07 )
|
||||||
#define serSYSTEM_CLOCK ( ( unsigned portCHAR ) 0xdd )
|
#define serSYSTEM_CLOCK ( ( unsigned char ) 0xdd )
|
||||||
#define serTX_ENABLE ( ( unsigned portCHAR ) 0x04 )
|
#define serTX_ENABLE ( ( unsigned char ) 0x04 )
|
||||||
#define serRX_ENABLE ( ( unsigned portCHAR ) 0x01 )
|
#define serRX_ENABLE ( ( unsigned char ) 0x01 )
|
||||||
#define serTX_INT ( ( unsigned portCHAR ) 0x01 )
|
#define serTX_INT ( ( unsigned char ) 0x01 )
|
||||||
#define serRX_INT ( ( unsigned portCHAR ) 0x02 )
|
#define serRX_INT ( ( unsigned char ) 0x02 )
|
||||||
|
|
||||||
|
|
||||||
/* The queues used to communicate between tasks and ISR's. */
|
/* The queues used to communicate between tasks and ISR's. */
|
||||||
|
@ -101,13 +101,13 @@ static portBASE_TYPE xTxHasEnded = pdTRUE;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
const unsigned portLONG ulBaudRateDivisor = ( configCPU_CLOCK_HZ / ( 32UL * ulWantedBaud ) );
|
const unsigned long ulBaudRateDivisor = ( configCPU_CLOCK_HZ / ( 32UL * ulWantedBaud ) );
|
||||||
|
|
||||||
/* Create the queues used by the com test task. */
|
/* Create the queues used by the com test task. */
|
||||||
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
|
|
||||||
xTxHasEnded = pdTRUE;
|
xTxHasEnded = pdTRUE;
|
||||||
|
|
||||||
|
@ -127,8 +127,8 @@ const unsigned portLONG ulBaudRateDivisor = ( configCPU_CLOCK_HZ / ( 32UL * ulWa
|
||||||
MCF_UART0_UMR2 = ser1STOP_BIT;
|
MCF_UART0_UMR2 = ser1STOP_BIT;
|
||||||
MCF_UART0_UCSR = serSYSTEM_CLOCK;
|
MCF_UART0_UCSR = serSYSTEM_CLOCK;
|
||||||
|
|
||||||
MCF_UART0_UBG1 = ( unsigned portCHAR ) ( ( ulBaudRateDivisor >> 8UL ) & 0xffUL );
|
MCF_UART0_UBG1 = ( unsigned char ) ( ( ulBaudRateDivisor >> 8UL ) & 0xffUL );
|
||||||
MCF_UART0_UBG2 = ( unsigned portCHAR ) ( ulBaudRateDivisor & 0xffUL );
|
MCF_UART0_UBG2 = ( unsigned char ) ( ulBaudRateDivisor & 0xffUL );
|
||||||
|
|
||||||
/* Turn it on. */
|
/* Turn it on. */
|
||||||
MCF_UART0_UCR = serTX_ENABLE | serRX_ENABLE;
|
MCF_UART0_UCR = serTX_ENABLE | serRX_ENABLE;
|
||||||
|
@ -146,7 +146,7 @@ const unsigned portLONG ulBaudRateDivisor = ( configCPU_CLOCK_HZ / ( 32UL * ulWa
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* Only one port is supported. */
|
/* Only one port is supported. */
|
||||||
( void ) pxPort;
|
( void ) pxPort;
|
||||||
|
@ -164,7 +164,7 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcR
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* Only one port is supported. */
|
/* Only one port is supported. */
|
||||||
( void ) pxPort;
|
( void ) pxPort;
|
||||||
|
@ -195,7 +195,7 @@ void vSerialClose( xComPortHandle xPort )
|
||||||
|
|
||||||
__declspec(interrupt:0) void vUART0InterruptHandler( void )
|
__declspec(interrupt:0) void vUART0InterruptHandler( void )
|
||||||
{
|
{
|
||||||
unsigned portCHAR ucChar;
|
unsigned char ucChar;
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE, xDoneSomething = pdTRUE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE, xDoneSomething = pdTRUE;
|
||||||
|
|
||||||
while( xDoneSomething != pdFALSE )
|
while( xDoneSomething != pdFALSE )
|
||||||
|
|
|
@ -110,7 +110,7 @@
|
||||||
*/
|
*/
|
||||||
void vApplicationSetupInterrupts( void )
|
void vApplicationSetupInterrupts( void )
|
||||||
{
|
{
|
||||||
const unsigned portSHORT usCompareMatchValue = ( ( configCPU_CLOCK_HZ / portPRESCALE_VALUE ) / configTICK_RATE_HZ );
|
const unsigned short usCompareMatchValue = ( ( configCPU_CLOCK_HZ / portPRESCALE_VALUE ) / configTICK_RATE_HZ );
|
||||||
|
|
||||||
/* Configure interrupt priority and level and unmask interrupt for PIT0. */
|
/* Configure interrupt priority and level and unmask interrupt for PIT0. */
|
||||||
MCF_INTC0_ICR55 = ( 1 | ( configKERNEL_INTERRUPT_PRIORITY << 3 ) );
|
MCF_INTC0_ICR55 = ( 1 | ( configKERNEL_INTERRUPT_PRIORITY << 3 ) );
|
||||||
|
@ -131,7 +131,7 @@ const unsigned portSHORT usCompareMatchValue = ( ( configCPU_CLOCK_HZ / portPRES
|
||||||
|
|
||||||
void __attribute__ ((interrupt)) __cs3_isr_interrupt_119( void )
|
void __attribute__ ((interrupt)) __cs3_isr_interrupt_119( void )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulSavedInterruptMask;
|
unsigned long ulSavedInterruptMask;
|
||||||
|
|
||||||
/* Clear the PIT0 interrupt. */
|
/* Clear the PIT0 interrupt. */
|
||||||
MCF_PIT0_PCSR |= MCF_PIT_PCSR_PIF;
|
MCF_PIT0_PCSR |= MCF_PIT_PCSR_PIF;
|
||||||
|
|
|
@ -112,7 +112,7 @@ void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
||||||
{
|
{
|
||||||
taskENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
if( ( MCF_GPIO_PORTTC & ( 1 << uxLED ) ) == ( unsigned portCHAR ) 0 )
|
if( ( MCF_GPIO_PORTTC & ( 1 << uxLED ) ) == ( unsigned char ) 0 )
|
||||||
{
|
{
|
||||||
MCF_GPIO_PORTTC |= ( 1 << uxLED );
|
MCF_GPIO_PORTTC |= ( 1 << uxLED );
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,11 +153,11 @@ static void vRegTest2Task( void *pvParameters );
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* Counters used to detect errors within the reg test tasks. */
|
/* Counters used to detect errors within the reg test tasks. */
|
||||||
static volatile unsigned portLONG ulRegTest1Counter = 0x11111111, ulRegTest2Counter = 0x22222222;
|
static volatile unsigned long ulRegTest1Counter = 0x11111111, ulRegTest2Counter = 0x22222222;
|
||||||
|
|
||||||
/* Any errors that the check task finds in any tasks are latched into
|
/* Any errors that the check task finds in any tasks are latched into
|
||||||
ulErrorCode, and then displayed via the WEB server. */
|
ulErrorCode, and then displayed via the WEB server. */
|
||||||
static unsigned portLONG ulErrorCode = 0UL;
|
static unsigned long ulErrorCode = 0UL;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ portTickType xLastExecutionTime;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
unsigned portLONG ulGetErrorCode( void )
|
unsigned long ulGetErrorCode( void )
|
||||||
{
|
{
|
||||||
/* Returns the error code for display via the WEB server. */
|
/* Returns the error code for display via the WEB server. */
|
||||||
return ulErrorCode;
|
return ulErrorCode;
|
||||||
|
@ -323,7 +323,7 @@ static const unsigned long _cfm[6] = {
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed portCHAR *pcTaskName )
|
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
|
||||||
{
|
{
|
||||||
/* This will get called if a stack overflow is detected during the context
|
/* This will get called if a stack overflow is detected during the context
|
||||||
switch. Set configCHECK_FOR_STACK_OVERFLOWS to 2 to also check for stack
|
switch. Set configCHECK_FOR_STACK_OVERFLOWS to 2 to also check for stack
|
||||||
|
|
|
@ -100,16 +100,16 @@ xSemaphoreHandle xFECSemaphore = NULL, xTxSemaphore = NULL;
|
||||||
|
|
||||||
/* The buffer used by the uIP stack. In this case the pointer is used to
|
/* The buffer used by the uIP stack. In this case the pointer is used to
|
||||||
point to one of the Rx buffers to effect a zero copy policy. */
|
point to one of the Rx buffers to effect a zero copy policy. */
|
||||||
unsigned portCHAR *uip_buf;
|
unsigned char *uip_buf;
|
||||||
|
|
||||||
/* The DMA descriptors. This is a char array to allow us to align it correctly. */
|
/* The DMA descriptors. This is a char array to allow us to align it correctly. */
|
||||||
static unsigned portCHAR xFECTxDescriptors_unaligned[ ( fecNUM_FEC_TX_BUFFERS * sizeof( FECBD ) ) + 16 ];
|
static unsigned char xFECTxDescriptors_unaligned[ ( fecNUM_FEC_TX_BUFFERS * sizeof( FECBD ) ) + 16 ];
|
||||||
static unsigned portCHAR xFECRxDescriptors_unaligned[ ( configNUM_FEC_RX_BUFFERS * sizeof( FECBD ) ) + 16 ];
|
static unsigned char xFECRxDescriptors_unaligned[ ( configNUM_FEC_RX_BUFFERS * sizeof( FECBD ) ) + 16 ];
|
||||||
static FECBD *xFECTxDescriptors;
|
static FECBD *xFECTxDescriptors;
|
||||||
static FECBD *xFECRxDescriptors;
|
static FECBD *xFECRxDescriptors;
|
||||||
|
|
||||||
/* The DMA buffers. These are char arrays to allow them to be aligned correctly. */
|
/* The DMA buffers. These are char arrays to allow them to be aligned correctly. */
|
||||||
static unsigned portCHAR ucFECRxBuffers[ ( configNUM_FEC_RX_BUFFERS * configFEC_BUFFER_SIZE ) + 16 ];
|
static unsigned char ucFECRxBuffers[ ( configNUM_FEC_RX_BUFFERS * configFEC_BUFFER_SIZE ) + 16 ];
|
||||||
static unsigned portBASE_TYPE uxNextRxBuffer = 0, uxIndexToBufferOwner = 0;
|
static unsigned portBASE_TYPE uxNextRxBuffer = 0, uxIndexToBufferOwner = 0;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -214,7 +214,7 @@ uint32 eimr;
|
||||||
* If after a suitable amount of time the event isn't triggered, a
|
* If after a suitable amount of time the event isn't triggered, a
|
||||||
* value of 0 is returned.
|
* value of 0 is returned.
|
||||||
*/
|
*/
|
||||||
static int fec_mii_read( int phy_addr, int reg_addr, unsigned portSHORT* data )
|
static int fec_mii_read( int phy_addr, int reg_addr, unsigned short* data )
|
||||||
{
|
{
|
||||||
int timeout, iReturn;
|
int timeout, iReturn;
|
||||||
uint32 eimr;
|
uint32 eimr;
|
||||||
|
@ -274,10 +274,10 @@ uint32 eimr;
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* The 6 most significant bits of the 32-bit CRC result
|
* The 6 most significant bits of the 32-bit CRC result
|
||||||
*/
|
*/
|
||||||
static unsigned portCHAR fec_hash_address( const unsigned portCHAR* addr )
|
static unsigned char fec_hash_address( const unsigned char* addr )
|
||||||
{
|
{
|
||||||
unsigned portLONG crc;
|
unsigned long crc;
|
||||||
unsigned portCHAR byte;
|
unsigned char byte;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
crc = 0xFFFFFFFF;
|
crc = 0xFFFFFFFF;
|
||||||
|
@ -300,7 +300,7 @@ int i, j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (unsigned portCHAR)(crc >> 26);
|
return (unsigned char)(crc >> 26);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
|
@ -314,9 +314,9 @@ int i, j;
|
||||||
* ch FEC channel
|
* ch FEC channel
|
||||||
* pa Physical (Hardware) Address for the selected FEC
|
* pa Physical (Hardware) Address for the selected FEC
|
||||||
*/
|
*/
|
||||||
static void fec_set_address( const unsigned portCHAR *pa )
|
static void fec_set_address( const unsigned char *pa )
|
||||||
{
|
{
|
||||||
unsigned portCHAR crc;
|
unsigned char crc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the Physical Address
|
* Set the Physical Address
|
||||||
|
@ -332,11 +332,11 @@ static void fec_set_address( const unsigned portCHAR *pa )
|
||||||
crc = fec_hash_address( pa );
|
crc = fec_hash_address( pa );
|
||||||
if( crc >= 32 )
|
if( crc >= 32 )
|
||||||
{
|
{
|
||||||
MCF_FEC_IAUR |= (unsigned portLONG)(1 << (crc - 32));
|
MCF_FEC_IAUR |= (unsigned long)(1 << (crc - 32));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MCF_FEC_IALR |= (unsigned portLONG)(1 << crc);
|
MCF_FEC_IALR |= (unsigned long)(1 << crc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -344,11 +344,11 @@ static void fec_set_address( const unsigned portCHAR *pa )
|
||||||
static void prvInitialiseFECBuffers( void )
|
static void prvInitialiseFECBuffers( void )
|
||||||
{
|
{
|
||||||
unsigned portBASE_TYPE ux;
|
unsigned portBASE_TYPE ux;
|
||||||
unsigned portCHAR *pcBufPointer;
|
unsigned char *pcBufPointer;
|
||||||
|
|
||||||
/* Correctly align the Tx descriptor pointer. */
|
/* Correctly align the Tx descriptor pointer. */
|
||||||
pcBufPointer = &( xFECTxDescriptors_unaligned[ 0 ] );
|
pcBufPointer = &( xFECTxDescriptors_unaligned[ 0 ] );
|
||||||
while( ( ( unsigned portLONG ) pcBufPointer & 0x0fUL ) != 0 )
|
while( ( ( unsigned long ) pcBufPointer & 0x0fUL ) != 0 )
|
||||||
{
|
{
|
||||||
pcBufPointer++;
|
pcBufPointer++;
|
||||||
}
|
}
|
||||||
|
@ -357,7 +357,7 @@ unsigned portCHAR *pcBufPointer;
|
||||||
|
|
||||||
/* Likewise the Rx descriptor pointer. */
|
/* Likewise the Rx descriptor pointer. */
|
||||||
pcBufPointer = &( xFECRxDescriptors_unaligned[ 0 ] );
|
pcBufPointer = &( xFECRxDescriptors_unaligned[ 0 ] );
|
||||||
while( ( ( unsigned portLONG ) pcBufPointer & 0x0fUL ) != 0 )
|
while( ( ( unsigned long ) pcBufPointer & 0x0fUL ) != 0 )
|
||||||
{
|
{
|
||||||
pcBufPointer++;
|
pcBufPointer++;
|
||||||
}
|
}
|
||||||
|
@ -378,7 +378,7 @@ unsigned portCHAR *pcBufPointer;
|
||||||
/* Setup the Rx buffers and descriptors, having first ensured correct
|
/* Setup the Rx buffers and descriptors, having first ensured correct
|
||||||
alignment. */
|
alignment. */
|
||||||
pcBufPointer = &( ucFECRxBuffers[ 0 ] );
|
pcBufPointer = &( ucFECRxBuffers[ 0 ] );
|
||||||
while( ( ( unsigned portLONG ) pcBufPointer & 0x0fUL ) != 0 )
|
while( ( ( unsigned long ) pcBufPointer & 0x0fUL ) != 0 )
|
||||||
{
|
{
|
||||||
pcBufPointer++;
|
pcBufPointer++;
|
||||||
}
|
}
|
||||||
|
@ -401,12 +401,12 @@ unsigned portCHAR *pcBufPointer;
|
||||||
|
|
||||||
void vFECInit( void )
|
void vFECInit( void )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usData;
|
unsigned short usData;
|
||||||
struct uip_eth_addr xAddr;
|
struct uip_eth_addr xAddr;
|
||||||
unsigned portBASE_TYPE ux;
|
unsigned portBASE_TYPE ux;
|
||||||
|
|
||||||
/* The MAC address is set at the foot of FreeRTOSConfig.h. */
|
/* The MAC address is set at the foot of FreeRTOSConfig.h. */
|
||||||
const unsigned portCHAR ucMACAddress[6] =
|
const unsigned char ucMACAddress[6] =
|
||||||
{
|
{
|
||||||
configMAC_0, configMAC_1,configMAC_2, configMAC_3, configMAC_4, configMAC_5
|
configMAC_0, configMAC_1,configMAC_2, configMAC_3, configMAC_4, configMAC_5
|
||||||
};
|
};
|
||||||
|
@ -518,13 +518,13 @@ const unsigned portCHAR ucMACAddress[6] =
|
||||||
|
|
||||||
if( ( usData & PHY_ANLPAR_100BTX_FDX ) || ( usData & PHY_ANLPAR_10BTX_FDX ) )
|
if( ( usData & PHY_ANLPAR_100BTX_FDX ) || ( usData & PHY_ANLPAR_10BTX_FDX ) )
|
||||||
{
|
{
|
||||||
MCF_FEC_RCR &= (unsigned portLONG)~MCF_FEC_RCR_DRT;
|
MCF_FEC_RCR &= (unsigned long)~MCF_FEC_RCR_DRT;
|
||||||
MCF_FEC_TCR |= MCF_FEC_TCR_FDEN;
|
MCF_FEC_TCR |= MCF_FEC_TCR_FDEN;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MCF_FEC_RCR |= MCF_FEC_RCR_DRT;
|
MCF_FEC_RCR |= MCF_FEC_RCR_DRT;
|
||||||
MCF_FEC_TCR &= (unsigned portLONG)~MCF_FEC_TCR_FDEN;
|
MCF_FEC_TCR &= (unsigned long)~MCF_FEC_TCR_FDEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear the Individual and Group Address Hash registers */
|
/* Clear the Individual and Group Address Hash registers */
|
||||||
|
@ -537,19 +537,19 @@ const unsigned portCHAR ucMACAddress[6] =
|
||||||
fec_set_address( ucMACAddress );
|
fec_set_address( ucMACAddress );
|
||||||
|
|
||||||
/* Set Rx Buffer Size */
|
/* Set Rx Buffer Size */
|
||||||
MCF_FEC_EMRBR = (unsigned portSHORT)configFEC_BUFFER_SIZE;
|
MCF_FEC_EMRBR = (unsigned short)configFEC_BUFFER_SIZE;
|
||||||
|
|
||||||
/* Point to the start of the circular Rx buffer descriptor queue */
|
/* Point to the start of the circular Rx buffer descriptor queue */
|
||||||
MCF_FEC_ERDSR = ( volatile unsigned portLONG ) &( xFECRxDescriptors[ 0 ] );
|
MCF_FEC_ERDSR = ( volatile unsigned long ) &( xFECRxDescriptors[ 0 ] );
|
||||||
|
|
||||||
/* Point to the start of the circular Tx buffer descriptor queue */
|
/* Point to the start of the circular Tx buffer descriptor queue */
|
||||||
MCF_FEC_ETSDR = ( volatile unsigned portLONG ) &( xFECTxDescriptors[ 0 ] );
|
MCF_FEC_ETSDR = ( volatile unsigned long ) &( xFECTxDescriptors[ 0 ] );
|
||||||
|
|
||||||
/* Mask all FEC interrupts */
|
/* Mask all FEC interrupts */
|
||||||
MCF_FEC_EIMR = ( unsigned portLONG ) -1;
|
MCF_FEC_EIMR = ( unsigned long ) -1;
|
||||||
|
|
||||||
/* Clear all FEC interrupt events */
|
/* Clear all FEC interrupt events */
|
||||||
MCF_FEC_EIR = ( unsigned portLONG ) -1;
|
MCF_FEC_EIR = ( unsigned long ) -1;
|
||||||
|
|
||||||
/* Initialize the Receive Control Register */
|
/* Initialize the Receive Control Register */
|
||||||
MCF_FEC_RCR = MCF_FEC_RCR_MAX_FL(ETH_MAX_FRM) | MCF_FEC_RCR_FCE;
|
MCF_FEC_RCR = MCF_FEC_RCR_MAX_FL(ETH_MAX_FRM) | MCF_FEC_RCR_FCE;
|
||||||
|
@ -638,7 +638,7 @@ portBASE_TYPE x;
|
||||||
|
|
||||||
unsigned short usFECGetRxedData( void )
|
unsigned short usFECGetRxedData( void )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usLen;
|
unsigned short usLen;
|
||||||
|
|
||||||
/* Obtain the size of the packet and put it into the "len" variable. */
|
/* Obtain the size of the packet and put it into the "len" variable. */
|
||||||
usLen = xFECRxDescriptors[ uxNextRxBuffer ].length;
|
usLen = xFECRxDescriptors[ uxNextRxBuffer ].length;
|
||||||
|
@ -717,7 +717,7 @@ void vFECSendData( void )
|
||||||
|
|
||||||
void vFEC_ISR( void )
|
void vFEC_ISR( void )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulEvent;
|
unsigned long ulEvent;
|
||||||
portBASE_TYPE xHighPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHighPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
/* This handler is called in response to any of the many separate FEC
|
/* This handler is called in response to any of the many separate FEC
|
||||||
|
|
|
@ -111,7 +111,7 @@ __declspec(interrupt:0) void vPIT0InterruptHandler( void );
|
||||||
*/
|
*/
|
||||||
void vApplicationSetupInterrupts( void )
|
void vApplicationSetupInterrupts( void )
|
||||||
{
|
{
|
||||||
const unsigned portSHORT usCompareMatchValue = ( ( configCPU_CLOCK_HZ / portPRESCALE_VALUE ) / configTICK_RATE_HZ );
|
const unsigned short usCompareMatchValue = ( ( configCPU_CLOCK_HZ / portPRESCALE_VALUE ) / configTICK_RATE_HZ );
|
||||||
|
|
||||||
/* Configure interrupt priority and level and unmask interrupt for PIT0. */
|
/* Configure interrupt priority and level and unmask interrupt for PIT0. */
|
||||||
MCF_INTC0_ICR55 = ( 1 | ( configKERNEL_INTERRUPT_PRIORITY << 3 ) );
|
MCF_INTC0_ICR55 = ( 1 | ( configKERNEL_INTERRUPT_PRIORITY << 3 ) );
|
||||||
|
@ -132,7 +132,7 @@ const unsigned portSHORT usCompareMatchValue = ( ( configCPU_CLOCK_HZ / portPRES
|
||||||
|
|
||||||
__declspec(interrupt:0) void vPIT0InterruptHandler( void )
|
__declspec(interrupt:0) void vPIT0InterruptHandler( void )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulSavedInterruptMask;
|
unsigned long ulSavedInterruptMask;
|
||||||
|
|
||||||
/* Clear the PIT0 interrupt. */
|
/* Clear the PIT0 interrupt. */
|
||||||
MCF_PIT0_PCSR |= MCF_PIT_PCSR_PIF;
|
MCF_PIT0_PCSR |= MCF_PIT_PCSR_PIF;
|
||||||
|
|
|
@ -139,11 +139,11 @@ static void vProcessConnection( struct netconn *pxNetCon );
|
||||||
*/
|
*/
|
||||||
static void vProcessConnection( struct netconn *pxNetCon )
|
static void vProcessConnection( struct netconn *pxNetCon )
|
||||||
{
|
{
|
||||||
static portCHAR cDynamicPage[webMAX_PAGE_SIZE], cPageHits[11];
|
static char cDynamicPage[webMAX_PAGE_SIZE], cPageHits[11];
|
||||||
struct netbuf *pxRxBuffer;
|
struct netbuf *pxRxBuffer;
|
||||||
portCHAR *pcRxString;
|
char *pcRxString;
|
||||||
unsigned portSHORT usLength;
|
unsigned short usLength;
|
||||||
static unsigned portLONG ulPageHits = 0;
|
static unsigned long ulPageHits = 0;
|
||||||
|
|
||||||
/* We expect to immediately get data. */
|
/* We expect to immediately get data. */
|
||||||
pxRxBuffer = netconn_recv( pxNetCon );
|
pxRxBuffer = netconn_recv( pxNetCon );
|
||||||
|
|
|
@ -126,7 +126,7 @@ error have been detected. */
|
||||||
#define mainCHECK_LED ( 3 )
|
#define mainCHECK_LED ( 3 )
|
||||||
|
|
||||||
/* ComTest constants - there is no free LED for the comtest tasks. */
|
/* ComTest constants - there is no free LED for the comtest tasks. */
|
||||||
#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 19200 )
|
#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 19200 )
|
||||||
#define mainCOM_TEST_LED ( 5 )
|
#define mainCOM_TEST_LED ( 5 )
|
||||||
|
|
||||||
/* Task priorities. */
|
/* Task priorities. */
|
||||||
|
@ -160,7 +160,7 @@ static void vRegTest2Task( void *pvParameters );
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* Counters used to detect errors within the reg test tasks. */
|
/* Counters used to detect errors within the reg test tasks. */
|
||||||
static volatile unsigned portLONG ulRegTest1Counter = 0x11111111, ulRegTest2Counter = 0x22222222;
|
static volatile unsigned long ulRegTest1Counter = 0x11111111, ulRegTest2Counter = 0x22222222;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ void prvSetupHardware( void )
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed portCHAR *pcTaskName )
|
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
|
||||||
{
|
{
|
||||||
/* This will get called if a stack overflow is detected during the context
|
/* This will get called if a stack overflow is detected during the context
|
||||||
switch. Set configCHECK_FOR_STACK_OVERFLOWS to 2 to also check for stack
|
switch. Set configCHECK_FOR_STACK_OVERFLOWS to 2 to also check for stack
|
||||||
|
|
|
@ -110,7 +110,7 @@
|
||||||
*/
|
*/
|
||||||
void vApplicationSetupInterrupts( void )
|
void vApplicationSetupInterrupts( void )
|
||||||
{
|
{
|
||||||
const unsigned portSHORT usCompareMatchValue = ( ( configCPU_CLOCK_HZ / portPRESCALE_VALUE ) / configTICK_RATE_HZ );
|
const unsigned short usCompareMatchValue = ( ( configCPU_CLOCK_HZ / portPRESCALE_VALUE ) / configTICK_RATE_HZ );
|
||||||
|
|
||||||
/* Configure interrupt priority and level and unmask interrupt for PIT0. */
|
/* Configure interrupt priority and level and unmask interrupt for PIT0. */
|
||||||
MCF_INTC0_ICR55 = ( 1 | ( configKERNEL_INTERRUPT_PRIORITY << 3 ) );
|
MCF_INTC0_ICR55 = ( 1 | ( configKERNEL_INTERRUPT_PRIORITY << 3 ) );
|
||||||
|
@ -131,7 +131,7 @@ const unsigned portSHORT usCompareMatchValue = ( ( configCPU_CLOCK_HZ / portPRES
|
||||||
|
|
||||||
void __attribute__ ((interrupt)) __cs3_isr_interrupt_119( void )
|
void __attribute__ ((interrupt)) __cs3_isr_interrupt_119( void )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulSavedInterruptMask;
|
unsigned long ulSavedInterruptMask;
|
||||||
|
|
||||||
/* Clear the PIT0 interrupt. */
|
/* Clear the PIT0 interrupt. */
|
||||||
MCF_PIT0_PCSR |= MCF_PIT_PCSR_PIF;
|
MCF_PIT0_PCSR |= MCF_PIT_PCSR_PIF;
|
||||||
|
|
|
@ -73,8 +73,8 @@
|
||||||
|
|
||||||
void vInitialiseTimerForIntQueueTest( void )
|
void vInitialiseTimerForIntQueueTest( void )
|
||||||
{
|
{
|
||||||
const unsigned portSHORT usCompareMatchValue1 = ( unsigned portSHORT ) ( ( configCPU_CLOCK_HZ / timerPRESCALE_VALUE ) / timerINTERRUPT1_FREQUENCY );
|
const unsigned short usCompareMatchValue1 = ( unsigned short ) ( ( configCPU_CLOCK_HZ / timerPRESCALE_VALUE ) / timerINTERRUPT1_FREQUENCY );
|
||||||
const unsigned portSHORT usCompareMatchValue2 = ( unsigned portSHORT ) ( ( configCPU_CLOCK_HZ / timerPRESCALE_VALUE ) / timerINTERRUPT2_FREQUENCY );
|
const unsigned short usCompareMatchValue2 = ( unsigned short ) ( ( configCPU_CLOCK_HZ / timerPRESCALE_VALUE ) / timerINTERRUPT2_FREQUENCY );
|
||||||
|
|
||||||
/* Configure interrupt priority and level and unmask interrupt. */
|
/* Configure interrupt priority and level and unmask interrupt. */
|
||||||
MCF_INTC0_ICR56 = ( ( configMAX_SYSCALL_INTERRUPT_PRIORITY - 1 ) << 3 );
|
MCF_INTC0_ICR56 = ( ( configMAX_SYSCALL_INTERRUPT_PRIORITY - 1 ) << 3 );
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
#define LED2_POS 0x01
|
#define LED2_POS 0x01
|
||||||
#define LED3_POS 0x04
|
#define LED3_POS 0x04
|
||||||
|
|
||||||
static const unsigned portCHAR ucLEDDefinitions[ partstNUM_LEDs ] = { LED0_POS, LED1_POS, LED2_POS, LED3_POS };
|
static const unsigned char ucLEDDefinitions[ partstNUM_LEDs ] = { LED0_POS, LED1_POS, LED2_POS, LED3_POS };
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
* Simple parallel port IO routines.
|
* Simple parallel port IO routines.
|
||||||
|
@ -140,7 +140,7 @@ void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
||||||
{
|
{
|
||||||
taskENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
if( ( MCF_GPIO_PORTTD & ucLEDDefinitions[ uxLED ] ) == ( unsigned portCHAR ) 0 )
|
if( ( MCF_GPIO_PORTTD & ucLEDDefinitions[ uxLED ] ) == ( unsigned char ) 0 )
|
||||||
{
|
{
|
||||||
MCF_GPIO_PORTTD |= ucLEDDefinitions[ uxLED ];
|
MCF_GPIO_PORTTD |= ucLEDDefinitions[ uxLED ];
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
||||||
{
|
{
|
||||||
taskENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
if( ( MCF_GPIO_PORTTC & ucLEDDefinitions[ uxLED ] ) == ( unsigned portCHAR ) 0 )
|
if( ( MCF_GPIO_PORTTC & ucLEDDefinitions[ uxLED ] ) == ( unsigned char ) 0 )
|
||||||
{
|
{
|
||||||
MCF_GPIO_PORTTC |= ucLEDDefinitions[ uxLED ];
|
MCF_GPIO_PORTTC |= ucLEDDefinitions[ uxLED ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ error have been detected. */
|
||||||
#define mainCHECK_LED ( 3 )
|
#define mainCHECK_LED ( 3 )
|
||||||
|
|
||||||
/* ComTest constants - there is no free LED for the comtest tasks. */
|
/* ComTest constants - there is no free LED for the comtest tasks. */
|
||||||
#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 19200 )
|
#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 19200 )
|
||||||
#define mainCOM_TEST_LED ( 5 )
|
#define mainCOM_TEST_LED ( 5 )
|
||||||
|
|
||||||
/* Task priorities. */
|
/* Task priorities. */
|
||||||
|
@ -155,7 +155,7 @@ static void vRegTest2Task( void *pvParameters );
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* Counters used to detect errors within the reg test tasks. */
|
/* Counters used to detect errors within the reg test tasks. */
|
||||||
static volatile unsigned portLONG ulRegTest1Counter = 0x11111111, ulRegTest2Counter = 0x22222222;
|
static volatile unsigned long ulRegTest1Counter = 0x11111111, ulRegTest2Counter = 0x22222222;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ portTickType xLastExecutionTime;
|
||||||
|
|
||||||
void prvSetupHardware( void )
|
void prvSetupHardware( void )
|
||||||
{
|
{
|
||||||
extern void mcf5xxx_wr_cacr( unsigned portLONG );
|
extern void mcf5xxx_wr_cacr( unsigned long );
|
||||||
|
|
||||||
portDISABLE_INTERRUPTS();
|
portDISABLE_INTERRUPTS();
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ extern void mcf5xxx_wr_cacr( unsigned portLONG );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed portCHAR *pcTaskName )
|
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
|
||||||
{
|
{
|
||||||
/* This will get called if a stack overflow is detected during the context
|
/* This will get called if a stack overflow is detected during the context
|
||||||
switch. Set configCHECK_FOR_STACK_OVERFLOWS to 2 to also check for stack
|
switch. Set configCHECK_FOR_STACK_OVERFLOWS to 2 to also check for stack
|
||||||
|
|
|
@ -82,16 +82,16 @@ an example of an efficient driver. */
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
|
|
||||||
/* Hardware definitions. */
|
/* Hardware definitions. */
|
||||||
#define serNO_PARITY ( ( unsigned portCHAR ) 0x02 << 3 )
|
#define serNO_PARITY ( ( unsigned char ) 0x02 << 3 )
|
||||||
#define ser8DATA_BITS ( ( unsigned portCHAR ) 0x03 )
|
#define ser8DATA_BITS ( ( unsigned char ) 0x03 )
|
||||||
#define ser1STOP_BIT ( ( unsigned portCHAR ) 0x07 )
|
#define ser1STOP_BIT ( ( unsigned char ) 0x07 )
|
||||||
#define serSYSTEM_CLOCK ( ( unsigned portCHAR ) 0xdd )
|
#define serSYSTEM_CLOCK ( ( unsigned char ) 0xdd )
|
||||||
#define serTX_OUTPUT ( ( unsigned portCHAR ) 0x04 )
|
#define serTX_OUTPUT ( ( unsigned char ) 0x04 )
|
||||||
#define serRX_INPUT ( ( unsigned portCHAR ) 0x08 )
|
#define serRX_INPUT ( ( unsigned char ) 0x08 )
|
||||||
#define serTX_ENABLE ( ( unsigned portCHAR ) 0x04 )
|
#define serTX_ENABLE ( ( unsigned char ) 0x04 )
|
||||||
#define serRX_ENABLE ( ( unsigned portCHAR ) 0x01 )
|
#define serRX_ENABLE ( ( unsigned char ) 0x01 )
|
||||||
#define serTX_INT ( ( unsigned portCHAR ) 0x01 )
|
#define serTX_INT ( ( unsigned char ) 0x01 )
|
||||||
#define serRX_INT ( ( unsigned portCHAR ) 0x02 )
|
#define serRX_INT ( ( unsigned char ) 0x02 )
|
||||||
|
|
||||||
|
|
||||||
/* The queues used to communicate between tasks and ISR's. */
|
/* The queues used to communicate between tasks and ISR's. */
|
||||||
|
@ -108,13 +108,13 @@ void __attribute__( ( interrupt ) ) __cs3_isr_interrupt_78( void );
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
const unsigned portLONG ulBaudRateDivisor = ( configCPU_CLOCK_HZ / ( 32UL * ulWantedBaud ) );
|
const unsigned long ulBaudRateDivisor = ( configCPU_CLOCK_HZ / ( 32UL * ulWantedBaud ) );
|
||||||
|
|
||||||
/* Create the queues used by the com test task. */
|
/* Create the queues used by the com test task. */
|
||||||
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
|
|
||||||
xTxHasEnded = pdTRUE;
|
xTxHasEnded = pdTRUE;
|
||||||
|
|
||||||
|
@ -133,8 +133,8 @@ const unsigned portLONG ulBaudRateDivisor = ( configCPU_CLOCK_HZ / ( 32UL * ulWa
|
||||||
MCF_UART1_UMR2 = ser1STOP_BIT;
|
MCF_UART1_UMR2 = ser1STOP_BIT;
|
||||||
MCF_UART1_UCSR = serSYSTEM_CLOCK;
|
MCF_UART1_UCSR = serSYSTEM_CLOCK;
|
||||||
|
|
||||||
MCF_UART1_UBG1 = ( unsigned portCHAR ) ( ( ulBaudRateDivisor >> 8UL ) & 0xffUL );
|
MCF_UART1_UBG1 = ( unsigned char ) ( ( ulBaudRateDivisor >> 8UL ) & 0xffUL );
|
||||||
MCF_UART1_UBG2 = ( unsigned portCHAR ) ( ulBaudRateDivisor & 0xffUL );
|
MCF_UART1_UBG2 = ( unsigned char ) ( ulBaudRateDivisor & 0xffUL );
|
||||||
|
|
||||||
/* Turn it on. */
|
/* Turn it on. */
|
||||||
MCF_UART1_UCR = serTX_ENABLE | serRX_ENABLE;
|
MCF_UART1_UCR = serTX_ENABLE | serRX_ENABLE;
|
||||||
|
@ -152,7 +152,7 @@ const unsigned portLONG ulBaudRateDivisor = ( configCPU_CLOCK_HZ / ( 32UL * ulWa
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* Only one port is supported. */
|
/* Only one port is supported. */
|
||||||
( void ) pxPort;
|
( void ) pxPort;
|
||||||
|
@ -170,7 +170,7 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcR
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* Only one port is supported. */
|
/* Only one port is supported. */
|
||||||
( void ) pxPort;
|
( void ) pxPort;
|
||||||
|
@ -201,7 +201,7 @@ void vSerialClose( xComPortHandle xPort )
|
||||||
|
|
||||||
void __cs3_isr_interrupt_78( void )
|
void __cs3_isr_interrupt_78( void )
|
||||||
{
|
{
|
||||||
unsigned portCHAR ucChar;
|
unsigned char ucChar;
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE, xDoneSomething = pdTRUE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE, xDoneSomething = pdTRUE;
|
||||||
|
|
||||||
while( xDoneSomething != pdFALSE )
|
while( xDoneSomething != pdFALSE )
|
||||||
|
|
|
@ -108,7 +108,7 @@ typedef struct BLOCKING_QUEUE_PARAMETERS
|
||||||
{
|
{
|
||||||
xQueueHandle xQueue; /*< The queue to be used by the task. */
|
xQueueHandle xQueue; /*< The queue to be used by the task. */
|
||||||
portTickType xBlockTime; /*< The block time to use on queue reads/writes. */
|
portTickType xBlockTime; /*< The block time to use on queue reads/writes. */
|
||||||
volatile portSHORT *psCheckVariable; /*< Incremented on each successful cycle to check the task is still running. */
|
volatile short *psCheckVariable; /*< Incremented on each successful cycle to check the task is still running. */
|
||||||
} xBlockingQueueParameters;
|
} xBlockingQueueParameters;
|
||||||
|
|
||||||
/* Task function that creates an incrementing number and posts it on a queue. */
|
/* Task function that creates an incrementing number and posts it on a queue. */
|
||||||
|
@ -121,11 +121,11 @@ static portTASK_FUNCTION_PROTO( vBlockingQueueConsumer, pvParameters );
|
||||||
/* Variables which are incremented each time an item is removed from a queue, and
|
/* Variables which are incremented each time an item is removed from a queue, and
|
||||||
found to be the expected value.
|
found to be the expected value.
|
||||||
These are used to check that the tasks are still running. */
|
These are used to check that the tasks are still running. */
|
||||||
static volatile portSHORT sBlockingConsumerCount[ blckqNUM_TASK_SETS ] = { ( unsigned portSHORT ) 0, ( unsigned portSHORT ) 0, ( unsigned portSHORT ) 0 };
|
static volatile short sBlockingConsumerCount[ blckqNUM_TASK_SETS ] = { ( unsigned short ) 0, ( unsigned short ) 0, ( unsigned short ) 0 };
|
||||||
|
|
||||||
/* Variable which are incremented each time an item is posted on a queue. These
|
/* Variable which are incremented each time an item is posted on a queue. These
|
||||||
are used to check that the tasks are still running. */
|
are used to check that the tasks are still running. */
|
||||||
static volatile portSHORT sBlockingProducerCount[ blckqNUM_TASK_SETS ] = { ( unsigned portSHORT ) 0, ( unsigned portSHORT ) 0, ( unsigned portSHORT ) 0 };
|
static volatile short sBlockingProducerCount[ blckqNUM_TASK_SETS ] = { ( unsigned short ) 0, ( unsigned short ) 0, ( unsigned short ) 0 };
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ const portTickType xDontBlock = ( portTickType ) 0;
|
||||||
|
|
||||||
/* Create the queue used by the first two tasks to pass the incrementing number.
|
/* Create the queue used by the first two tasks to pass the incrementing number.
|
||||||
Pass a pointer to the queue in the parameter structure. */
|
Pass a pointer to the queue in the parameter structure. */
|
||||||
pxQueueParameters1->xQueue = xQueueCreate( uxQueueSize1, ( unsigned portBASE_TYPE ) sizeof( unsigned portSHORT ) );
|
pxQueueParameters1->xQueue = xQueueCreate( uxQueueSize1, ( unsigned portBASE_TYPE ) sizeof( unsigned short ) );
|
||||||
|
|
||||||
/* The consumer is created first so gets a block time as described above. */
|
/* The consumer is created first so gets a block time as described above. */
|
||||||
pxQueueParameters1->xBlockTime = xBlockTime;
|
pxQueueParameters1->xBlockTime = xBlockTime;
|
||||||
|
@ -180,7 +180,7 @@ const portTickType xDontBlock = ( portTickType ) 0;
|
||||||
the same mechanism but reverses the task priorities. */
|
the same mechanism but reverses the task priorities. */
|
||||||
|
|
||||||
pxQueueParameters3 = ( xBlockingQueueParameters * ) pvPortMalloc( sizeof( xBlockingQueueParameters ) );
|
pxQueueParameters3 = ( xBlockingQueueParameters * ) pvPortMalloc( sizeof( xBlockingQueueParameters ) );
|
||||||
pxQueueParameters3->xQueue = xQueueCreate( uxQueueSize1, ( unsigned portBASE_TYPE ) sizeof( unsigned portSHORT ) );
|
pxQueueParameters3->xQueue = xQueueCreate( uxQueueSize1, ( unsigned portBASE_TYPE ) sizeof( unsigned short ) );
|
||||||
pxQueueParameters3->xBlockTime = xDontBlock;
|
pxQueueParameters3->xBlockTime = xDontBlock;
|
||||||
pxQueueParameters3->psCheckVariable = &( sBlockingProducerCount[ 1 ] );
|
pxQueueParameters3->psCheckVariable = &( sBlockingProducerCount[ 1 ] );
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ const portTickType xDontBlock = ( portTickType ) 0;
|
||||||
/* Create the last two tasks as described above. The mechanism is again just
|
/* Create the last two tasks as described above. The mechanism is again just
|
||||||
the same. This time both parameter structures are given a block time. */
|
the same. This time both parameter structures are given a block time. */
|
||||||
pxQueueParameters5 = ( xBlockingQueueParameters * ) pvPortMalloc( sizeof( xBlockingQueueParameters ) );
|
pxQueueParameters5 = ( xBlockingQueueParameters * ) pvPortMalloc( sizeof( xBlockingQueueParameters ) );
|
||||||
pxQueueParameters5->xQueue = xQueueCreate( uxQueueSize5, ( unsigned portBASE_TYPE ) sizeof( unsigned portSHORT ) );
|
pxQueueParameters5->xQueue = xQueueCreate( uxQueueSize5, ( unsigned portBASE_TYPE ) sizeof( unsigned short ) );
|
||||||
pxQueueParameters5->xBlockTime = xBlockTime;
|
pxQueueParameters5->xBlockTime = xBlockTime;
|
||||||
pxQueueParameters5->psCheckVariable = &( sBlockingProducerCount[ 2 ] );
|
pxQueueParameters5->psCheckVariable = &( sBlockingProducerCount[ 2 ] );
|
||||||
|
|
||||||
|
@ -213,14 +213,14 @@ const portTickType xDontBlock = ( portTickType ) 0;
|
||||||
|
|
||||||
static portTASK_FUNCTION( vBlockingQueueProducer, pvParameters )
|
static portTASK_FUNCTION( vBlockingQueueProducer, pvParameters )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usValue = 0;
|
unsigned short usValue = 0;
|
||||||
xBlockingQueueParameters *pxQueueParameters;
|
xBlockingQueueParameters *pxQueueParameters;
|
||||||
portSHORT sErrorEverOccurred = pdFALSE;
|
short sErrorEverOccurred = pdFALSE;
|
||||||
|
|
||||||
#ifdef USE_STDIO
|
#ifdef USE_STDIO
|
||||||
void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );
|
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||||
|
|
||||||
const portCHAR * const pcTaskStartMsg = "Alt blocking queue producer task started.\r\n";
|
const char * const pcTaskStartMsg = "Alt blocking queue producer task started.\r\n";
|
||||||
|
|
||||||
/* Queue a message for printing to say the task has started. */
|
/* Queue a message for printing to say the task has started. */
|
||||||
vPrintDisplayMessage( &pcTaskStartMsg );
|
vPrintDisplayMessage( &pcTaskStartMsg );
|
||||||
|
@ -253,14 +253,14 @@ portSHORT sErrorEverOccurred = pdFALSE;
|
||||||
|
|
||||||
static portTASK_FUNCTION( vBlockingQueueConsumer, pvParameters )
|
static portTASK_FUNCTION( vBlockingQueueConsumer, pvParameters )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usData, usExpectedValue = 0;
|
unsigned short usData, usExpectedValue = 0;
|
||||||
xBlockingQueueParameters *pxQueueParameters;
|
xBlockingQueueParameters *pxQueueParameters;
|
||||||
portSHORT sErrorEverOccurred = pdFALSE;
|
short sErrorEverOccurred = pdFALSE;
|
||||||
|
|
||||||
#ifdef USE_STDIO
|
#ifdef USE_STDIO
|
||||||
void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );
|
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||||
|
|
||||||
const portCHAR * const pcTaskStartMsg = "Alt blocking queue consumer task started.\r\n";
|
const char * const pcTaskStartMsg = "Alt blocking queue consumer task started.\r\n";
|
||||||
|
|
||||||
/* Queue a message for printing to say the task has started. */
|
/* Queue a message for printing to say the task has started. */
|
||||||
vPrintDisplayMessage( &pcTaskStartMsg );
|
vPrintDisplayMessage( &pcTaskStartMsg );
|
||||||
|
@ -300,8 +300,8 @@ portSHORT sErrorEverOccurred = pdFALSE;
|
||||||
/* This is called to check that all the created tasks are still running. */
|
/* This is called to check that all the created tasks are still running. */
|
||||||
portBASE_TYPE xAreAltBlockingQueuesStillRunning( void )
|
portBASE_TYPE xAreAltBlockingQueuesStillRunning( void )
|
||||||
{
|
{
|
||||||
static portSHORT sLastBlockingConsumerCount[ blckqNUM_TASK_SETS ] = { ( unsigned portSHORT ) 0, ( unsigned portSHORT ) 0, ( unsigned portSHORT ) 0 };
|
static short sLastBlockingConsumerCount[ blckqNUM_TASK_SETS ] = { ( unsigned short ) 0, ( unsigned short ) 0, ( unsigned short ) 0 };
|
||||||
static portSHORT sLastBlockingProducerCount[ blckqNUM_TASK_SETS ] = { ( unsigned portSHORT ) 0, ( unsigned portSHORT ) 0, ( unsigned portSHORT ) 0 };
|
static short sLastBlockingProducerCount[ blckqNUM_TASK_SETS ] = { ( unsigned short ) 0, ( unsigned short ) 0, ( unsigned short ) 0 };
|
||||||
portBASE_TYPE xReturn = pdPASS, xTasks;
|
portBASE_TYPE xReturn = pdPASS, xTasks;
|
||||||
|
|
||||||
/* Not too worried about mutual exclusion on these variables as they are 16
|
/* Not too worried about mutual exclusion on these variables as they are 16
|
||||||
|
|
|
@ -140,9 +140,9 @@ portTickType xTimeWhenBlocking;
|
||||||
portTickType xTimeToBlock, xBlockedTime;
|
portTickType xTimeToBlock, xBlockedTime;
|
||||||
|
|
||||||
#ifdef USE_STDIO
|
#ifdef USE_STDIO
|
||||||
void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );
|
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||||
|
|
||||||
const portCHAR * const pcTaskStartMsg = "Alt primary block time test started.\r\n";
|
const char * const pcTaskStartMsg = "Alt primary block time test started.\r\n";
|
||||||
|
|
||||||
/* Queue a message for printing to say the task has started. */
|
/* Queue a message for printing to say the task has started. */
|
||||||
vPrintDisplayMessage( &pcTaskStartMsg );
|
vPrintDisplayMessage( &pcTaskStartMsg );
|
||||||
|
@ -419,9 +419,9 @@ portTickType xTimeWhenBlocking, xBlockedTime;
|
||||||
portBASE_TYPE xData;
|
portBASE_TYPE xData;
|
||||||
|
|
||||||
#ifdef USE_STDIO
|
#ifdef USE_STDIO
|
||||||
void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );
|
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||||
|
|
||||||
const portCHAR * const pcTaskStartMsg = "Alt secondary block time test started.\r\n";
|
const char * const pcTaskStartMsg = "Alt secondary block time test started.\r\n";
|
||||||
|
|
||||||
/* Queue a message for printing to say the task has started. */
|
/* Queue a message for printing to say the task has started. */
|
||||||
vPrintDisplayMessage( &pcTaskStartMsg );
|
vPrintDisplayMessage( &pcTaskStartMsg );
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
Changes from V2.0.0
|
Changes from V2.0.0
|
||||||
|
|
||||||
+ Delay periods are now specified using variables and constants of
|
+ Delay periods are now specified using variables and constants of
|
||||||
portTickType rather than unsigned portLONG.
|
portTickType rather than unsigned long.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -126,7 +126,7 @@ void vStartAltPolledQueueTasks( unsigned portBASE_TYPE uxPriority )
|
||||||
static xQueueHandle xPolledQueue;
|
static xQueueHandle xPolledQueue;
|
||||||
|
|
||||||
/* Create the queue used by the producer and consumer. */
|
/* Create the queue used by the producer and consumer. */
|
||||||
xPolledQueue = xQueueCreate( pollqQUEUE_SIZE, ( unsigned portBASE_TYPE ) sizeof( unsigned portSHORT ) );
|
xPolledQueue = xQueueCreate( pollqQUEUE_SIZE, ( unsigned portBASE_TYPE ) sizeof( unsigned short ) );
|
||||||
|
|
||||||
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
||||||
in use. The queue registry is provided as a means for kernel aware
|
in use. The queue registry is provided as a means for kernel aware
|
||||||
|
@ -145,13 +145,13 @@ static xQueueHandle xPolledQueue;
|
||||||
|
|
||||||
static portTASK_FUNCTION( vPolledQueueProducer, pvParameters )
|
static portTASK_FUNCTION( vPolledQueueProducer, pvParameters )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usValue = ( unsigned portSHORT ) 0;
|
unsigned short usValue = ( unsigned short ) 0;
|
||||||
signed portBASE_TYPE xError = pdFALSE, xLoop;
|
signed portBASE_TYPE xError = pdFALSE, xLoop;
|
||||||
|
|
||||||
#ifdef USE_STDIO
|
#ifdef USE_STDIO
|
||||||
void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );
|
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||||
|
|
||||||
const portCHAR * const pcTaskStartMsg = "Alt polling queue producer task started.\r\n";
|
const char * const pcTaskStartMsg = "Alt polling queue producer task started.\r\n";
|
||||||
|
|
||||||
/* Queue a message for printing to say the task has started. */
|
/* Queue a message for printing to say the task has started. */
|
||||||
vPrintDisplayMessage( &pcTaskStartMsg );
|
vPrintDisplayMessage( &pcTaskStartMsg );
|
||||||
|
@ -193,13 +193,13 @@ signed portBASE_TYPE xError = pdFALSE, xLoop;
|
||||||
|
|
||||||
static portTASK_FUNCTION( vPolledQueueConsumer, pvParameters )
|
static portTASK_FUNCTION( vPolledQueueConsumer, pvParameters )
|
||||||
{
|
{
|
||||||
unsigned portSHORT usData, usExpectedValue = ( unsigned portSHORT ) 0;
|
unsigned short usData, usExpectedValue = ( unsigned short ) 0;
|
||||||
signed portBASE_TYPE xError = pdFALSE;
|
signed portBASE_TYPE xError = pdFALSE;
|
||||||
|
|
||||||
#ifdef USE_STDIO
|
#ifdef USE_STDIO
|
||||||
void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );
|
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||||
|
|
||||||
const portCHAR * const pcTaskStartMsg = "Alt blocking queue consumer task started.\r\n";
|
const char * const pcTaskStartMsg = "Alt blocking queue consumer task started.\r\n";
|
||||||
|
|
||||||
/* Queue a message for printing to say the task has started. */
|
/* Queue a message for printing to say the task has started. */
|
||||||
vPrintDisplayMessage( &pcTaskStartMsg );
|
vPrintDisplayMessage( &pcTaskStartMsg );
|
||||||
|
|
|
@ -127,11 +127,11 @@ static portBASE_TYPE xErrorDetected = pdFALSE;
|
||||||
|
|
||||||
/* Counters that are incremented on each cycle of a test. This is used to
|
/* Counters that are incremented on each cycle of a test. This is used to
|
||||||
detect a stalled task - a test that is no longer running. */
|
detect a stalled task - a test that is no longer running. */
|
||||||
static volatile unsigned portLONG ulLoopCounter = 0;
|
static volatile unsigned long ulLoopCounter = 0;
|
||||||
static volatile unsigned portLONG ulLoopCounter2 = 0;
|
static volatile unsigned long ulLoopCounter2 = 0;
|
||||||
|
|
||||||
/* The variable that is guarded by the mutex in the mutex demo tasks. */
|
/* The variable that is guarded by the mutex in the mutex demo tasks. */
|
||||||
static volatile unsigned portLONG ulGuardedVariable = 0;
|
static volatile unsigned long ulGuardedVariable = 0;
|
||||||
|
|
||||||
/* Handles used in the mutext test to suspend and resume the high and medium
|
/* Handles used in the mutext test to suspend and resume the high and medium
|
||||||
priority mutex test tasks. */
|
priority mutex test tasks. */
|
||||||
|
@ -146,7 +146,7 @@ xSemaphoreHandle xMutex;
|
||||||
|
|
||||||
/* Create the queue that we are going to use for the
|
/* Create the queue that we are going to use for the
|
||||||
prvSendFrontAndBackTest demo. */
|
prvSendFrontAndBackTest demo. */
|
||||||
xQueue = xQueueCreate( genqQUEUE_LENGTH, sizeof( unsigned portLONG ) );
|
xQueue = xQueueCreate( genqQUEUE_LENGTH, sizeof( unsigned long ) );
|
||||||
|
|
||||||
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
||||||
in use. The queue registry is provided as a means for kernel aware
|
in use. The queue registry is provided as a means for kernel aware
|
||||||
|
@ -183,13 +183,13 @@ xSemaphoreHandle xMutex;
|
||||||
|
|
||||||
static void prvSendFrontAndBackTest( void *pvParameters )
|
static void prvSendFrontAndBackTest( void *pvParameters )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulData, ulData2;
|
unsigned long ulData, ulData2;
|
||||||
xQueueHandle xQueue;
|
xQueueHandle xQueue;
|
||||||
|
|
||||||
#ifdef USE_STDIO
|
#ifdef USE_STDIO
|
||||||
void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );
|
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||||
|
|
||||||
const portCHAR * const pcTaskStartMsg = "Alt queue SendToFront/SendToBack/Peek test started.\r\n";
|
const char * const pcTaskStartMsg = "Alt queue SendToFront/SendToBack/Peek test started.\r\n";
|
||||||
|
|
||||||
/* Queue a message for printing to say the task has started. */
|
/* Queue a message for printing to say the task has started. */
|
||||||
vPrintDisplayMessage( &pcTaskStartMsg );
|
vPrintDisplayMessage( &pcTaskStartMsg );
|
||||||
|
@ -414,9 +414,9 @@ static void prvLowPriorityMutexTask( void *pvParameters )
|
||||||
xSemaphoreHandle xMutex = ( xSemaphoreHandle ) pvParameters;
|
xSemaphoreHandle xMutex = ( xSemaphoreHandle ) pvParameters;
|
||||||
|
|
||||||
#ifdef USE_STDIO
|
#ifdef USE_STDIO
|
||||||
void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );
|
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||||
|
|
||||||
const portCHAR * const pcTaskStartMsg = "Fast mutex with priority inheritance test started.\r\n";
|
const char * const pcTaskStartMsg = "Fast mutex with priority inheritance test started.\r\n";
|
||||||
|
|
||||||
/* Queue a message for printing to say the task has started. */
|
/* Queue a message for printing to say the task has started. */
|
||||||
vPrintDisplayMessage( &pcTaskStartMsg );
|
vPrintDisplayMessage( &pcTaskStartMsg );
|
||||||
|
@ -561,7 +561,7 @@ xSemaphoreHandle xMutex = ( xSemaphoreHandle ) pvParameters;
|
||||||
/* This is called to check that all the created tasks are still running. */
|
/* This is called to check that all the created tasks are still running. */
|
||||||
portBASE_TYPE xAreAltGenericQueueTasksStillRunning( void )
|
portBASE_TYPE xAreAltGenericQueueTasksStillRunning( void )
|
||||||
{
|
{
|
||||||
static unsigned portLONG ulLastLoopCounter = 0, ulLastLoopCounter2 = 0;
|
static unsigned long ulLastLoopCounter = 0, ulLastLoopCounter2 = 0;
|
||||||
|
|
||||||
/* If the demo task is still running then we expect the loopcounters to
|
/* If the demo task is still running then we expect the loopcounters to
|
||||||
have incremented since this function was last called. */
|
have incremented since this function was last called. */
|
||||||
|
|
|
@ -150,7 +150,7 @@ have been found. Used to detect an error or stall in the test cycling. */
|
||||||
static volatile unsigned long ulSetBitCycles = 0, ulWaitBitCycles = 0;
|
static volatile unsigned long ulSetBitCycles = 0, ulWaitBitCycles = 0;
|
||||||
|
|
||||||
/* The event group used by all the tests. */
|
/* The event group used by all the tests. */
|
||||||
static xEventGroupHandle xEventBits = NULL;
|
static EventGroupHandle_t xEventBits = NULL;
|
||||||
|
|
||||||
/* Handles to the tasks that only take part in the synchronisation calls. */
|
/* Handles to the tasks that only take part in the synchronisation calls. */
|
||||||
static xTaskHandle xSyncTask1 = NULL, xSyncTask2 = NULL;
|
static xTaskHandle xSyncTask1 = NULL, xSyncTask2 = NULL;
|
||||||
|
@ -179,11 +179,11 @@ xTaskHandle xWaitBitsTaskHandle;
|
||||||
|
|
||||||
static void prvSyncTask( void *pvParameters )
|
static void prvSyncTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
xEventBitsType uxSynchronisationBit, uxReturned;
|
EventBits_t uxSynchronisationBit, uxReturned;
|
||||||
|
|
||||||
/* The bit to use to indicate this task is at the synchronisation point is
|
/* The bit to use to indicate this task is at the synchronisation point is
|
||||||
passed in as the task parameter. */
|
passed in as the task parameter. */
|
||||||
uxSynchronisationBit = ( xEventBitsType ) pvParameters;
|
uxSynchronisationBit = ( EventBits_t ) pvParameters;
|
||||||
|
|
||||||
/* A few tests are performed before entering the main demo loop. */
|
/* A few tests are performed before entering the main demo loop. */
|
||||||
prvPreSyncSelectiveWakeTest();
|
prvPreSyncSelectiveWakeTest();
|
||||||
|
@ -218,7 +218,7 @@ xEventBitsType uxSynchronisationBit, uxReturned;
|
||||||
|
|
||||||
static void prvWaitBitsTask( void *pvParameters )
|
static void prvWaitBitsTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
xEventBitsType uxReturned;
|
EventBits_t uxReturned;
|
||||||
portBASE_TYPE xError = pdFALSE;
|
portBASE_TYPE xError = pdFALSE;
|
||||||
|
|
||||||
/* Avoid compiler warnings. */
|
/* Avoid compiler warnings. */
|
||||||
|
@ -346,7 +346,7 @@ portBASE_TYPE xError = pdFALSE;
|
||||||
|
|
||||||
static void prvSetBitsTask( void *pvParameters )
|
static void prvSetBitsTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
xEventBitsType uxBits;
|
EventBits_t uxBits;
|
||||||
portBASE_TYPE xError;
|
portBASE_TYPE xError;
|
||||||
|
|
||||||
/* The handle to the other task is passed in as the task parameter. */
|
/* The handle to the other task is passed in as the task parameter. */
|
||||||
|
@ -669,7 +669,7 @@ xTaskHandle xWaitBitsTaskHandle = ( xTaskHandle ) pvParameters;
|
||||||
|
|
||||||
static void prvPreSyncSelectiveWakeTest( void )
|
static void prvPreSyncSelectiveWakeTest( void )
|
||||||
{
|
{
|
||||||
xEventBitsType uxPendBits, uxReturned;
|
EventBits_t uxPendBits, uxReturned;
|
||||||
|
|
||||||
if( xTaskGetCurrentTaskHandle() == xSyncTask1 )
|
if( xTaskGetCurrentTaskHandle() == xSyncTask1 )
|
||||||
{
|
{
|
||||||
|
@ -685,7 +685,7 @@ xEventBitsType uxPendBits, uxReturned;
|
||||||
vTaskSuspend( NULL );
|
vTaskSuspend( NULL );
|
||||||
uxReturned = xEventGroupWaitBits( xEventBits, uxPendBits, pdTRUE, pdFALSE, portMAX_DELAY );
|
uxReturned = xEventGroupWaitBits( xEventBits, uxPendBits, pdTRUE, pdFALSE, portMAX_DELAY );
|
||||||
|
|
||||||
if( uxReturned == ( xEventBitsType ) 0 )
|
if( uxReturned == ( EventBits_t ) 0 )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -696,7 +696,7 @@ xEventBitsType uxPendBits, uxReturned;
|
||||||
static portBASE_TYPE prvTestSelectiveBits( void )
|
static portBASE_TYPE prvTestSelectiveBits( void )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xError = pdFALSE;
|
portBASE_TYPE xError = pdFALSE;
|
||||||
xEventBitsType uxBit;
|
EventBits_t uxBit;
|
||||||
|
|
||||||
/* Both tasks should start in the suspended state. */
|
/* Both tasks should start in the suspended state. */
|
||||||
if( eTaskGetState( xSyncTask1 ) != eSuspended )
|
if( eTaskGetState( xSyncTask1 ) != eSuspended )
|
||||||
|
|
|
@ -129,11 +129,11 @@ static volatile portBASE_TYPE xErrorDetected = pdFALSE;
|
||||||
|
|
||||||
/* Counters that are incremented on each cycle of a test. This is used to
|
/* Counters that are incremented on each cycle of a test. This is used to
|
||||||
detect a stalled task - a test that is no longer running. */
|
detect a stalled task - a test that is no longer running. */
|
||||||
static volatile unsigned portLONG ulLoopCounter = 0;
|
static volatile unsigned long ulLoopCounter = 0;
|
||||||
static volatile unsigned portLONG ulLoopCounter2 = 0;
|
static volatile unsigned long ulLoopCounter2 = 0;
|
||||||
|
|
||||||
/* The variable that is guarded by the mutex in the mutex demo tasks. */
|
/* The variable that is guarded by the mutex in the mutex demo tasks. */
|
||||||
static volatile unsigned portLONG ulGuardedVariable = 0;
|
static volatile unsigned long ulGuardedVariable = 0;
|
||||||
|
|
||||||
/* Handles used in the mutext test to suspend and resume the high and medium
|
/* Handles used in the mutext test to suspend and resume the high and medium
|
||||||
priority mutex test tasks. */
|
priority mutex test tasks. */
|
||||||
|
@ -148,7 +148,7 @@ xSemaphoreHandle xMutex;
|
||||||
|
|
||||||
/* Create the queue that we are going to use for the
|
/* Create the queue that we are going to use for the
|
||||||
prvSendFrontAndBackTest demo. */
|
prvSendFrontAndBackTest demo. */
|
||||||
xQueue = xQueueCreate( genqQUEUE_LENGTH, sizeof( unsigned portLONG ) );
|
xQueue = xQueueCreate( genqQUEUE_LENGTH, sizeof( unsigned long ) );
|
||||||
|
|
||||||
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
||||||
in use. The queue registry is provided as a means for kernel aware
|
in use. The queue registry is provided as a means for kernel aware
|
||||||
|
@ -185,13 +185,13 @@ xSemaphoreHandle xMutex;
|
||||||
|
|
||||||
static void prvSendFrontAndBackTest( void *pvParameters )
|
static void prvSendFrontAndBackTest( void *pvParameters )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulData, ulData2;
|
unsigned long ulData, ulData2;
|
||||||
xQueueHandle xQueue;
|
xQueueHandle xQueue;
|
||||||
|
|
||||||
#ifdef USE_STDIO
|
#ifdef USE_STDIO
|
||||||
void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );
|
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||||
|
|
||||||
const portCHAR * const pcTaskStartMsg = "Queue SendToFront/SendToBack/Peek test started.\r\n";
|
const char * const pcTaskStartMsg = "Queue SendToFront/SendToBack/Peek test started.\r\n";
|
||||||
|
|
||||||
/* Queue a message for printing to say the task has started. */
|
/* Queue a message for printing to say the task has started. */
|
||||||
vPrintDisplayMessage( &pcTaskStartMsg );
|
vPrintDisplayMessage( &pcTaskStartMsg );
|
||||||
|
@ -416,9 +416,9 @@ static void prvLowPriorityMutexTask( void *pvParameters )
|
||||||
xSemaphoreHandle xMutex = ( xSemaphoreHandle ) pvParameters;
|
xSemaphoreHandle xMutex = ( xSemaphoreHandle ) pvParameters;
|
||||||
|
|
||||||
#ifdef USE_STDIO
|
#ifdef USE_STDIO
|
||||||
void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );
|
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||||
|
|
||||||
const portCHAR * const pcTaskStartMsg = "Mutex with priority inheritance test started.\r\n";
|
const char * const pcTaskStartMsg = "Mutex with priority inheritance test started.\r\n";
|
||||||
|
|
||||||
/* Queue a message for printing to say the task has started. */
|
/* Queue a message for printing to say the task has started. */
|
||||||
vPrintDisplayMessage( &pcTaskStartMsg );
|
vPrintDisplayMessage( &pcTaskStartMsg );
|
||||||
|
@ -574,7 +574,7 @@ xSemaphoreHandle xMutex = ( xSemaphoreHandle ) pvParameters;
|
||||||
/* This is called to check that all the created tasks are still running. */
|
/* This is called to check that all the created tasks are still running. */
|
||||||
portBASE_TYPE xAreGenericQueueTasksStillRunning( void )
|
portBASE_TYPE xAreGenericQueueTasksStillRunning( void )
|
||||||
{
|
{
|
||||||
static unsigned portLONG ulLastLoopCounter = 0, ulLastLoopCounter2 = 0;
|
static unsigned long ulLastLoopCounter = 0, ulLastLoopCounter2 = 0;
|
||||||
|
|
||||||
/* If the demo task is still running then we expect the loopcounters to
|
/* If the demo task is still running then we expect the loopcounters to
|
||||||
have incremented since this function was last called. */
|
have incremented since this function was last called. */
|
||||||
|
|
|
@ -202,8 +202,8 @@ xTaskHandle xHighPriorityNormallyEmptyTask1, xHighPriorityNormallyEmptyTask2, xH
|
||||||
the array position of the value is set to a the identifier of the task or
|
the array position of the value is set to a the identifier of the task or
|
||||||
interrupt that accessed the queue. This way missing or duplicate values can be
|
interrupt that accessed the queue. This way missing or duplicate values can be
|
||||||
detected. */
|
detected. */
|
||||||
static unsigned portCHAR ucNormallyEmptyReceivedValues[ intqNUM_VALUES_TO_LOG ] = { 0 };
|
static unsigned char ucNormallyEmptyReceivedValues[ intqNUM_VALUES_TO_LOG ] = { 0 };
|
||||||
static unsigned portCHAR ucNormallyFullReceivedValues[ intqNUM_VALUES_TO_LOG ] = { 0 };
|
static unsigned char ucNormallyFullReceivedValues[ intqNUM_VALUES_TO_LOG ] = { 0 };
|
||||||
|
|
||||||
/* The test tasks themselves. */
|
/* The test tasks themselves. */
|
||||||
static void prvLowerPriorityNormallyEmptyTask( void *pvParameters );
|
static void prvLowerPriorityNormallyEmptyTask( void *pvParameters );
|
||||||
|
|
|
@ -110,7 +110,7 @@ static volatile portBASE_TYPE xErrorDetected = pdFALSE;
|
||||||
|
|
||||||
/* Counter that is incremented on each cycle of a test. This is used to
|
/* Counter that is incremented on each cycle of a test. This is used to
|
||||||
detect a stalled task - a test that is no longer running. */
|
detect a stalled task - a test that is no longer running. */
|
||||||
static volatile unsigned portLONG ulLoopCounter = 0;
|
static volatile unsigned long ulLoopCounter = 0;
|
||||||
|
|
||||||
/* Handles to the test tasks. */
|
/* Handles to the test tasks. */
|
||||||
xTaskHandle xMediumPriorityTask, xHighPriorityTask, xHighestPriorityTask;
|
xTaskHandle xMediumPriorityTask, xHighPriorityTask, xHighestPriorityTask;
|
||||||
|
@ -121,7 +121,7 @@ void vStartQueuePeekTasks( void )
|
||||||
xQueueHandle xQueue;
|
xQueueHandle xQueue;
|
||||||
|
|
||||||
/* Create the queue that we are going to use for the test/demo. */
|
/* Create the queue that we are going to use for the test/demo. */
|
||||||
xQueue = xQueueCreate( qpeekQUEUE_LENGTH, sizeof( unsigned portLONG ) );
|
xQueue = xQueueCreate( qpeekQUEUE_LENGTH, sizeof( unsigned long ) );
|
||||||
|
|
||||||
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
||||||
in use. The queue registry is provided as a means for kernel aware
|
in use. The queue registry is provided as a means for kernel aware
|
||||||
|
@ -144,13 +144,13 @@ xQueueHandle xQueue;
|
||||||
static void prvHighestPriorityPeekTask( void *pvParameters )
|
static void prvHighestPriorityPeekTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
||||||
unsigned portLONG ulValue;
|
unsigned long ulValue;
|
||||||
|
|
||||||
#ifdef USE_STDIO
|
#ifdef USE_STDIO
|
||||||
{
|
{
|
||||||
void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );
|
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||||
|
|
||||||
const portCHAR * const pcTaskStartMsg = "Queue peek test started.\r\n";
|
const char * const pcTaskStartMsg = "Queue peek test started.\r\n";
|
||||||
|
|
||||||
/* Queue a message for printing to say the task has started. */
|
/* Queue a message for printing to say the task has started. */
|
||||||
vPrintDisplayMessage( &pcTaskStartMsg );
|
vPrintDisplayMessage( &pcTaskStartMsg );
|
||||||
|
@ -253,7 +253,7 @@ unsigned portLONG ulValue;
|
||||||
static void prvHighPriorityPeekTask( void *pvParameters )
|
static void prvHighPriorityPeekTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
||||||
unsigned portLONG ulValue;
|
unsigned long ulValue;
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
|
@ -308,7 +308,7 @@ unsigned portLONG ulValue;
|
||||||
static void prvMediumPriorityPeekTask( void *pvParameters )
|
static void prvMediumPriorityPeekTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
||||||
unsigned portLONG ulValue;
|
unsigned long ulValue;
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
|
@ -349,7 +349,7 @@ unsigned portLONG ulValue;
|
||||||
static void prvLowPriorityPeekTask( void *pvParameters )
|
static void prvLowPriorityPeekTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
||||||
unsigned portLONG ulValue;
|
unsigned long ulValue;
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
|
@ -455,7 +455,7 @@ unsigned portLONG ulValue;
|
||||||
/* This is called to check that all the created tasks are still running. */
|
/* This is called to check that all the created tasks are still running. */
|
||||||
portBASE_TYPE xAreQueuePeekTasksStillRunning( void )
|
portBASE_TYPE xAreQueuePeekTasksStillRunning( void )
|
||||||
{
|
{
|
||||||
static unsigned portLONG ulLastLoopCounter = 0;
|
static unsigned long ulLastLoopCounter = 0;
|
||||||
|
|
||||||
/* If the demo task is still running then we expect the loopcounter to
|
/* If the demo task is still running then we expect the loopcounter to
|
||||||
have incremented since this function was last called. */
|
have incremented since this function was last called. */
|
||||||
|
|
|
@ -252,9 +252,9 @@ static void prvCountingSemaphoreTask( void *pvParameters )
|
||||||
xCountSemStruct *pxParameter;
|
xCountSemStruct *pxParameter;
|
||||||
|
|
||||||
#ifdef USE_STDIO
|
#ifdef USE_STDIO
|
||||||
void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );
|
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||||
|
|
||||||
const portCHAR * const pcTaskStartMsg = "Counting semaphore demo started.\r\n";
|
const char * const pcTaskStartMsg = "Counting semaphore demo started.\r\n";
|
||||||
|
|
||||||
/* Queue a message for printing to say the task has started. */
|
/* Queue a message for printing to say the task has started. */
|
||||||
vPrintDisplayMessage( &pcTaskStartMsg );
|
vPrintDisplayMessage( &pcTaskStartMsg );
|
||||||
|
|
|
@ -118,12 +118,12 @@ created. */
|
||||||
/*
|
/*
|
||||||
* The 'fixed delay' co-routine as described at the top of the file.
|
* The 'fixed delay' co-routine as described at the top of the file.
|
||||||
*/
|
*/
|
||||||
static void prvFixedDelayCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
static void prvFixedDelayCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The 'flash' co-routine as described at the top of the file.
|
* The 'flash' co-routine as described at the top of the file.
|
||||||
*/
|
*/
|
||||||
static void prvFlashCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
static void prvFlashCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
/* The queue used to pass data between the 'fixed delay' co-routines and the
|
/* The queue used to pass data between the 'fixed delay' co-routines and the
|
||||||
'flash' co-routine. */
|
'flash' co-routine. */
|
||||||
|
@ -163,7 +163,7 @@ unsigned portBASE_TYPE uxIndex;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvFixedDelayCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
static void prvFixedDelayCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
/* Even though this is a co-routine the xResult variable does not need to be
|
/* Even though this is a co-routine the xResult variable does not need to be
|
||||||
static as we do not need it to maintain its state between blocks. */
|
static as we do not need it to maintain its state between blocks. */
|
||||||
|
@ -204,7 +204,7 @@ static const portTickType xFlashRates[ crfMAX_FLASH_TASKS ] = { 150 / portTICK_R
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvFlashCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
static void prvFlashCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
/* Even though this is a co-routine the variable do not need to be
|
/* Even though this is a co-routine the variable do not need to be
|
||||||
static as we do not need it to maintain their state between blocks. */
|
static as we do not need it to maintain their state between blocks. */
|
||||||
|
|
|
@ -115,7 +115,7 @@ posted to the 'hook' co-routines. */
|
||||||
/*
|
/*
|
||||||
* The co-routine function itself.
|
* The co-routine function itself.
|
||||||
*/
|
*/
|
||||||
static void prvHookCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
static void prvHookCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -217,7 +217,7 @@ signed portBASE_TYPE xIndex, xCoRoutineWoken;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvHookCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
static void prvHookCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
static unsigned portBASE_TYPE uxReceivedValue[ hookNUM_HOOK_CO_ROUTINES ];
|
static unsigned portBASE_TYPE uxReceivedValue[ hookNUM_HOOK_CO_ROUTINES ];
|
||||||
portBASE_TYPE xResult;
|
portBASE_TYPE xResult;
|
||||||
|
|
|
@ -157,7 +157,7 @@ static err_t low_level_output(struct netif *netif, struct pbuf *p)
|
||||||
{
|
{
|
||||||
struct pbuf *q;
|
struct pbuf *q;
|
||||||
u32_t l = 0;
|
u32_t l = 0;
|
||||||
unsigned portCHAR *pcTxData;
|
unsigned char *pcTxData;
|
||||||
|
|
||||||
#if ETH_PAD_SIZE
|
#if ETH_PAD_SIZE
|
||||||
pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
|
pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
|
||||||
|
|
|
@ -123,12 +123,12 @@ to PDR09 (SEG1) are used by the prvFlashCoRoutine() and PDR00 (SEG2) are used by
|
||||||
/*
|
/*
|
||||||
* The 'fixed delay' co-routine as described at the top of the file.
|
* The 'fixed delay' co-routine as described at the top of the file.
|
||||||
*/
|
*/
|
||||||
static void prvFixedDelayCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
static void prvFixedDelayCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The 'flash' co-routine as described at the top of the file.
|
* The 'flash' co-routine as described at the top of the file.
|
||||||
*/
|
*/
|
||||||
static void prvFlashCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
static void prvFlashCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
/* The queue used to pass data between the 'fixed delay' co-routines and the
|
/* The queue used to pass data between the 'fixed delay' co-routines and the
|
||||||
'flash' co-routine. */
|
'flash' co-routine. */
|
||||||
|
@ -168,7 +168,7 @@ unsigned portBASE_TYPE uxIndex;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvFixedDelayCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
static void prvFixedDelayCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
/* Even though this is a co-routine the xResult variable does not need to be
|
/* Even though this is a co-routine the xResult variable does not need to be
|
||||||
static as we do not need it to maintain its state between blocks. */
|
static as we do not need it to maintain its state between blocks. */
|
||||||
|
@ -209,7 +209,7 @@ static const portTickType xFlashRates[ crfMAX_FLASH_TASKS ] = { 150 / portTICK_R
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvFlashCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
static void prvFlashCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
/* Even though this is a co-routine the variable do not need to be
|
/* Even though this is a co-routine the variable do not need to be
|
||||||
static as we do not need it to maintain their state between blocks. */
|
static as we do not need it to maintain their state between blocks. */
|
||||||
|
|
|
@ -130,7 +130,7 @@
|
||||||
#define mainGENERIC_QUEUE_PRIORITY ( tskIDLE_PRIORITY )
|
#define mainGENERIC_QUEUE_PRIORITY ( tskIDLE_PRIORITY )
|
||||||
|
|
||||||
/* Baud rate used by the COM test tasks. */
|
/* Baud rate used by the COM test tasks. */
|
||||||
#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 19200 )
|
#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 19200 )
|
||||||
|
|
||||||
/* The frequency at which the 'Check' tasks executes. See the comments at the
|
/* The frequency at which the 'Check' tasks executes. See the comments at the
|
||||||
top of the page. When the system is operating error free the 'Check' task
|
top of the page. When the system is operating error free the 'Check' task
|
||||||
|
@ -167,7 +167,7 @@ static void prvErrorChecks( void *pvParameters );
|
||||||
* Called by the Check task. Returns pdPASS if all the other tasks are found
|
* Called by the Check task. Returns pdPASS if all the other tasks are found
|
||||||
* to be operating without error - otherwise returns pdFAIL.
|
* to be operating without error - otherwise returns pdFAIL.
|
||||||
*/
|
*/
|
||||||
static portSHORT prvCheckOtherTasksAreStillRunning( void );
|
static short prvCheckOtherTasksAreStillRunning( void );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setup the microcontroller as used by this demo.
|
* Setup the microcontroller as used by this demo.
|
||||||
|
@ -187,7 +187,7 @@ static void vSecondRegisterTestTask( void *pvParameters );
|
||||||
|
|
||||||
/* The variable that is set to true should an error be found in one of the
|
/* The variable that is set to true should an error be found in one of the
|
||||||
register test tasks. */
|
register test tasks. */
|
||||||
unsigned portLONG ulRegTestError = pdFALSE;
|
unsigned long ulRegTestError = pdFALSE;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ portTickType xDelayPeriod = mainNO_ERROR_CHECK_DELAY, xLastExecutionTime;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static portSHORT prvCheckOtherTasksAreStillRunning( void )
|
static short prvCheckOtherTasksAreStillRunning( void )
|
||||||
{
|
{
|
||||||
portBASE_TYPE lReturn = pdPASS;
|
portBASE_TYPE lReturn = pdPASS;
|
||||||
|
|
||||||
|
@ -405,7 +405,7 @@ static void prvSetupHardware( void )
|
||||||
|
|
||||||
static void vFirstRegisterTestTask( void *pvParameters )
|
static void vFirstRegisterTestTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
extern volatile unsigned portLONG ulCriticalNesting;
|
extern volatile unsigned long ulCriticalNesting;
|
||||||
|
|
||||||
/* Fills the registers with known values (different to the values
|
/* Fills the registers with known values (different to the values
|
||||||
used in vSecondRegisterTestTask()), then checks that the registers still
|
used in vSecondRegisterTestTask()), then checks that the registers still
|
||||||
|
@ -503,7 +503,7 @@ extern volatile unsigned portLONG ulCriticalNesting;
|
||||||
|
|
||||||
static void vSecondRegisterTestTask( void *pvParameters )
|
static void vSecondRegisterTestTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
extern volatile unsigned portLONG ulCriticalNesting;
|
extern volatile unsigned long ulCriticalNesting;
|
||||||
|
|
||||||
/* Fills the registers with known values (different to the values
|
/* Fills the registers with known values (different to the values
|
||||||
used in vFirstRegisterTestTask()), then checks that the registers still
|
used in vFirstRegisterTestTask()), then checks that the registers still
|
||||||
|
|
|
@ -70,8 +70,8 @@
|
||||||
|
|
||||||
#define partstNUM_LEDs 8
|
#define partstNUM_LEDs 8
|
||||||
|
|
||||||
static unsigned portCHAR sState[ partstNUM_LEDs ] = { pdFALSE };
|
static unsigned char sState[ partstNUM_LEDs ] = { pdFALSE };
|
||||||
static unsigned portCHAR sState1[ partstNUM_LEDs ] = { pdFALSE };
|
static unsigned char sState1[ partstNUM_LEDs ] = { pdFALSE };
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -87,17 +87,17 @@ static xQueueHandle xRxedChars;
|
||||||
/* The queue used to hold characters waiting transmission. */
|
/* The queue used to hold characters waiting transmission. */
|
||||||
static xQueueHandle xCharsForTx;
|
static xQueueHandle xCharsForTx;
|
||||||
|
|
||||||
static volatile portSHORT sTHREEmpty;
|
static volatile short sTHREEmpty;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
portENTER_CRITICAL();
|
portENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
/* Create the queues used by the com test task. */
|
/* Create the queues used by the com test task. */
|
||||||
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
|
|
||||||
/* Initialize UART asynchronous mode */
|
/* Initialize UART asynchronous mode */
|
||||||
BGR02 = configPER_CLOCK_HZ / ulWantedBaud;
|
BGR02 = configPER_CLOCK_HZ / ulWantedBaud;
|
||||||
|
@ -120,7 +120,7 @@ xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* Get the next character from the buffer. Return false if no characters
|
/* Get the next character from the buffer. Return false if no characters
|
||||||
are available, or arrive before xBlockTime expires. */
|
are available, or arrive before xBlockTime expires. */
|
||||||
|
@ -135,7 +135,7 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcR
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
signed portBASE_TYPE xReturn;
|
signed portBASE_TYPE xReturn;
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ signed portBASE_TYPE xReturn;
|
||||||
*/
|
*/
|
||||||
__interrupt void UART2_RxISR (void)
|
__interrupt void UART2_RxISR (void)
|
||||||
{
|
{
|
||||||
signed portCHAR cChar;
|
signed char cChar;
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
/* Get the character from the UART and post it on the queue of Rxed
|
/* Get the character from the UART and post it on the queue of Rxed
|
||||||
|
@ -216,7 +216,7 @@ signed portBASE_TYPE xReturn;
|
||||||
*/
|
*/
|
||||||
__interrupt void UART2_TxISR (void)
|
__interrupt void UART2_TxISR (void)
|
||||||
{
|
{
|
||||||
signed portCHAR cChar;
|
signed char cChar;
|
||||||
signed portBASE_TYPE xTaskWoken = pdFALSE;
|
signed portBASE_TYPE xTaskWoken = pdFALSE;
|
||||||
|
|
||||||
/* The previous character has been transmitted. See if there are any
|
/* The previous character has been transmitted. See if there are any
|
||||||
|
|
|
@ -63,7 +63,7 @@ char Getch5( void ) /* waits for and returns incomming char */
|
||||||
|
|
||||||
void Puts5( const char *Name5 ) /* Puts a String to UART */
|
void Puts5( const char *Name5 ) /* Puts a String to UART */
|
||||||
{
|
{
|
||||||
volatile portSHORT i, len;
|
volatile short i, len;
|
||||||
len = strlen( Name5 );
|
len = strlen( Name5 );
|
||||||
|
|
||||||
for( i = 0; i < len; i++ ) /* go through string */
|
for( i = 0; i < len; i++ ) /* go through string */
|
||||||
|
@ -79,7 +79,7 @@ void Puts5( const char *Name5 ) /* Puts a String to UART */
|
||||||
|
|
||||||
void Puthex5( unsigned long n, unsigned char digits )
|
void Puthex5( unsigned long n, unsigned char digits )
|
||||||
{
|
{
|
||||||
unsigned portCHAR digit = 0, div = 0, i;
|
unsigned char digit = 0, div = 0, i;
|
||||||
|
|
||||||
div = ( 4 * (digits - 1) ); /* init shift divisor */
|
div = ( 4 * (digits - 1) ); /* init shift divisor */
|
||||||
for( i = 0; i < digits; i++ )
|
for( i = 0; i < digits; i++ )
|
||||||
|
@ -92,8 +92,8 @@ void Puthex5( unsigned long n, unsigned char digits )
|
||||||
|
|
||||||
void Putdec5( unsigned long x, int digits )
|
void Putdec5( unsigned long x, int digits )
|
||||||
{
|
{
|
||||||
portSHORT i;
|
short i;
|
||||||
portCHAR buf[10], sign = 1;
|
char buf[10], sign = 1;
|
||||||
|
|
||||||
if( digits < 0 )
|
if( digits < 0 )
|
||||||
{ /* should be print of zero? */
|
{ /* should be print of zero? */
|
||||||
|
@ -139,10 +139,10 @@ void vUtilityStartTraceTask( unsigned portBASE_TYPE uxPriority )
|
||||||
|
|
||||||
static void vUART5Task( void *pvParameters )
|
static void vUART5Task( void *pvParameters )
|
||||||
{
|
{
|
||||||
static portCHAR buff[ 900 ] = { 0 };
|
static char buff[ 900 ] = { 0 };
|
||||||
unsigned portLONG trace_len, j;
|
unsigned long trace_len, j;
|
||||||
|
|
||||||
unsigned portCHAR ch;
|
unsigned char ch;
|
||||||
|
|
||||||
SSR05_RIE = 1;
|
SSR05_RIE = 1;
|
||||||
Puts5( "\n -------------MB91467D FreeRTOS DEMO Task List and Trace Utility----------- \n" );
|
Puts5( "\n -------------MB91467D FreeRTOS DEMO Task List and Trace Utility----------- \n" );
|
||||||
|
@ -210,7 +210,7 @@ static void vUART5Task( void *pvParameters )
|
||||||
|
|
||||||
__interrupt void UART5_RxISR( void )
|
__interrupt void UART5_RxISR( void )
|
||||||
{
|
{
|
||||||
unsigned portCHAR ch;
|
unsigned char ch;
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
ch = RDR05;
|
ch = RDR05;
|
||||||
|
|
|
@ -49,7 +49,7 @@ static void prvWatchdogTask ( void *pvParameters )
|
||||||
* The below function creates hardware watchdog task.
|
* The below function creates hardware watchdog task.
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
#if WATCHDOG == WTC_IN_TASK
|
#if WATCHDOG == WTC_IN_TASK
|
||||||
void vStartWatchdogTask( unsigned portSHORT uxPriority )
|
void vStartWatchdogTask( unsigned short uxPriority )
|
||||||
{
|
{
|
||||||
xTaskCreate( prvWatchdogTask , "KickWTC", portMINIMAL_STACK_SIZE, ( void * ) NULL, uxPriority, ( xTaskHandle * ) NULL );
|
xTaskCreate( prvWatchdogTask , "KickWTC", portMINIMAL_STACK_SIZE, ( void * ) NULL, uxPriority, ( xTaskHandle * ) NULL );
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,12 +123,12 @@ to PDR09 (SEG1) are used by the prvFlashCoRoutine() and PDR00 (SEG2) are used by
|
||||||
/*
|
/*
|
||||||
* The 'fixed delay' co-routine as described at the top of the file.
|
* The 'fixed delay' co-routine as described at the top of the file.
|
||||||
*/
|
*/
|
||||||
static void prvFixedDelayCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
static void prvFixedDelayCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The 'flash' co-routine as described at the top of the file.
|
* The 'flash' co-routine as described at the top of the file.
|
||||||
*/
|
*/
|
||||||
static void prvFlashCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
|
static void prvFlashCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
/* The queue used to pass data between the 'fixed delay' co-routines and the
|
/* The queue used to pass data between the 'fixed delay' co-routines and the
|
||||||
'flash' co-routine. */
|
'flash' co-routine. */
|
||||||
|
@ -168,7 +168,7 @@ unsigned portBASE_TYPE uxIndex;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvFixedDelayCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
static void prvFixedDelayCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
/* Even though this is a co-routine the xResult variable does not need to be
|
/* Even though this is a co-routine the xResult variable does not need to be
|
||||||
static as we do not need it to maintain its state between blocks. */
|
static as we do not need it to maintain its state between blocks. */
|
||||||
|
@ -209,7 +209,7 @@ static const portTickType xFlashRates[ crfMAX_FLASH_TASKS ] = { 150 / portTICK_R
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvFlashCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
static void prvFlashCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
{
|
{
|
||||||
/* Even though this is a co-routine the variable do not need to be
|
/* Even though this is a co-routine the variable do not need to be
|
||||||
static as we do not need it to maintain their state between blocks. */
|
static as we do not need it to maintain their state between blocks. */
|
||||||
|
|
|
@ -70,8 +70,8 @@
|
||||||
|
|
||||||
#define partstNUM_LEDs 8
|
#define partstNUM_LEDs 8
|
||||||
|
|
||||||
static unsigned portCHAR sState[ partstNUM_LEDs ] = { pdFALSE };
|
static unsigned char sState[ partstNUM_LEDs ] = { pdFALSE };
|
||||||
static unsigned portCHAR sState1[ partstNUM_LEDs ] = { pdFALSE };
|
static unsigned char sState1[ partstNUM_LEDs ] = { pdFALSE };
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -85,19 +85,19 @@ static xQueueHandle xRxedChars;
|
||||||
/* The queue used to hold characters waiting transmission. */
|
/* The queue used to hold characters waiting transmission. */
|
||||||
static xQueueHandle xCharsForTx;
|
static xQueueHandle xCharsForTx;
|
||||||
|
|
||||||
static volatile portSHORT sTHREEmpty;
|
static volatile short sTHREEmpty;
|
||||||
|
|
||||||
static volatile portSHORT queueFail = pdFALSE;
|
static volatile short queueFail = pdFALSE;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
/* Initialise the hardware. */
|
/* Initialise the hardware. */
|
||||||
portENTER_CRITICAL();
|
portENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
/* Create the queues used by the com test task. */
|
/* Create the queues used by the com test task. */
|
||||||
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof(signed portCHAR) );
|
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof(signed char) );
|
||||||
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof(signed portCHAR) );
|
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof(signed char) );
|
||||||
|
|
||||||
if( xRxedChars == 0 )
|
if( xRxedChars == 0 )
|
||||||
{
|
{
|
||||||
|
@ -129,7 +129,7 @@ xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* Get the next character from the buffer. Return false if no characters
|
/* Get the next character from the buffer. Return false if no characters
|
||||||
are available, or arrive before xBlockTime expires. */
|
are available, or arrive before xBlockTime expires. */
|
||||||
|
@ -144,7 +144,7 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcR
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
signed portBASE_TYPE xReturn;
|
signed portBASE_TYPE xReturn;
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ signed portBASE_TYPE xReturn;
|
||||||
*/
|
*/
|
||||||
__interrupt void UART0_RxISR( void )
|
__interrupt void UART0_RxISR( void )
|
||||||
{
|
{
|
||||||
volatile signed portCHAR cChar;
|
volatile signed char cChar;
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
/* Get the character from the UART and post it on the queue of Rxed
|
/* Get the character from the UART and post it on the queue of Rxed
|
||||||
|
@ -223,7 +223,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
*/
|
*/
|
||||||
__interrupt void UART0_TxISR( void )
|
__interrupt void UART0_TxISR( void )
|
||||||
{
|
{
|
||||||
signed portCHAR cChar;
|
signed char cChar;
|
||||||
signed portBASE_TYPE xTaskWoken = pdFALSE;
|
signed portBASE_TYPE xTaskWoken = pdFALSE;
|
||||||
|
|
||||||
/* The previous character has been transmitted. See if there are any
|
/* The previous character has been transmitted. See if there are any
|
||||||
|
|
|
@ -69,7 +69,7 @@ char Getch0( void ) /* waits for and returns incomming char */
|
||||||
|
|
||||||
void Puts0( const char *Name1 ) /* Puts a String to UART */
|
void Puts0( const char *Name1 ) /* Puts a String to UART */
|
||||||
{
|
{
|
||||||
volatile portSHORT i, len;
|
volatile short i, len;
|
||||||
len = strlen( Name1 );
|
len = strlen( Name1 );
|
||||||
|
|
||||||
for( i = 0; i < len; i++ ) /* go through string */
|
for( i = 0; i < len; i++ ) /* go through string */
|
||||||
|
@ -85,7 +85,7 @@ void Puts0( const char *Name1 ) /* Puts a String to UART */
|
||||||
|
|
||||||
void Puthex0( unsigned long n, unsigned char digits )
|
void Puthex0( unsigned long n, unsigned char digits )
|
||||||
{
|
{
|
||||||
unsigned portCHAR digit = 0, div = 0, i;
|
unsigned char digit = 0, div = 0, i;
|
||||||
|
|
||||||
div = ( 4 * (digits - 1) ); /* init shift divisor */
|
div = ( 4 * (digits - 1) ); /* init shift divisor */
|
||||||
for( i = 0; i < digits; i++ )
|
for( i = 0; i < digits; i++ )
|
||||||
|
@ -98,8 +98,8 @@ void Puthex0( unsigned long n, unsigned char digits )
|
||||||
|
|
||||||
void Putdec0( unsigned long x, int digits )
|
void Putdec0( unsigned long x, int digits )
|
||||||
{
|
{
|
||||||
portSHORT i;
|
short i;
|
||||||
portCHAR buf[10], sign = 1;
|
char buf[10], sign = 1;
|
||||||
|
|
||||||
if( digits < 0 )
|
if( digits < 0 )
|
||||||
{ /* should be print of zero? */
|
{ /* should be print of zero? */
|
||||||
|
@ -144,11 +144,11 @@ void vUtilityStartTraceTask( unsigned portBASE_TYPE uxPriority )
|
||||||
|
|
||||||
static void vUART0Task( void *pvParameters )
|
static void vUART0Task( void *pvParameters )
|
||||||
{
|
{
|
||||||
static portCHAR buff[ 800 ] = { 0 };
|
static char buff[ 800 ] = { 0 };
|
||||||
unsigned portLONG trace_len;
|
unsigned long trace_len;
|
||||||
signed portLONG i, j, l = 0;
|
signed long i, j, l = 0;
|
||||||
|
|
||||||
unsigned portCHAR ch;
|
unsigned char ch;
|
||||||
( void ) pvParameters;
|
( void ) pvParameters;
|
||||||
|
|
||||||
SSR0_RIE = 1;
|
SSR0_RIE = 1;
|
||||||
|
@ -221,7 +221,7 @@ static void vUART0Task( void *pvParameters )
|
||||||
|
|
||||||
__interrupt void UART0_TraceRxISR( void )
|
__interrupt void UART0_TraceRxISR( void )
|
||||||
{
|
{
|
||||||
unsigned portCHAR ch;
|
unsigned char ch;
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
ch = RDR0;
|
ch = RDR0;
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
#define partstTOTAL_NUM_LEDs 16
|
#define partstTOTAL_NUM_LEDs 16
|
||||||
#define partstNUM_LEDs_PER_DISPLAY 8
|
#define partstNUM_LEDs_PER_DISPLAY 8
|
||||||
|
|
||||||
volatile unsigned char *pucDisplayOutput[ 2 ] = { ( unsigned portCHAR * ) 3, ( unsigned portCHAR * ) 5 };
|
volatile unsigned char *pucDisplayOutput[ 2 ] = { ( unsigned char * ) 3, ( unsigned char * ) 5 };
|
||||||
|
|
||||||
void vParTestInitialise( void )
|
void vParTestInitialise( void )
|
||||||
{
|
{
|
||||||
|
|
|
@ -99,7 +99,7 @@
|
||||||
static void vLEDFlashTask( void *pvParameters );
|
static void vLEDFlashTask( void *pvParameters );
|
||||||
|
|
||||||
/* The co-routine that is created 7 times. */
|
/* The co-routine that is created 7 times. */
|
||||||
static void prvFixedDelayCoRoutine( xCoRoutineHandle xHandle, unsigned short usIndex );
|
static void prvFixedDelayCoRoutine( CoRoutineHandle_t xHandle, unsigned short usIndex );
|
||||||
|
|
||||||
/* This task is created once, but itself creates 7 co-routines. */
|
/* This task is created once, but itself creates 7 co-routines. */
|
||||||
static void vLEDCoRoutineControlTask( void *pvParameters );
|
static void vLEDCoRoutineControlTask( void *pvParameters );
|
||||||
|
@ -228,7 +228,7 @@ unsigned short usCoroutine;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvFixedDelayCoRoutine( xCoRoutineHandle xHandle, unsigned short usIndex )
|
static void prvFixedDelayCoRoutine( CoRoutineHandle_t xHandle, unsigned short usIndex )
|
||||||
{
|
{
|
||||||
/* The usIndex parameter of the co-routine function is used as an index into
|
/* The usIndex parameter of the co-routine function is used as an index into
|
||||||
the xFlashRates array to obtain the delay period to use. */
|
the xFlashRates array to obtain the delay period to use. */
|
||||||
|
|
|
@ -95,9 +95,9 @@ static xQueueHandle xCharsForTx;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulBaudRateCount;
|
unsigned long ulBaudRateCount;
|
||||||
|
|
||||||
/* Initialise the hardware. */
|
/* Initialise the hardware. */
|
||||||
|
|
||||||
|
@ -117,11 +117,11 @@ unsigned portLONG ulBaudRateCount;
|
||||||
UCA1CTL1 = UCSSEL0 | UCSSEL1;
|
UCA1CTL1 = UCSSEL0 | UCSSEL1;
|
||||||
|
|
||||||
/* Setup baud rate low byte. */
|
/* Setup baud rate low byte. */
|
||||||
UCA1BR0 = ( unsigned portCHAR ) ( ulBaudRateCount & ( unsigned long ) 0xff );
|
UCA1BR0 = ( unsigned char ) ( ulBaudRateCount & ( unsigned long ) 0xff );
|
||||||
|
|
||||||
/* Setup baud rate high byte. */
|
/* Setup baud rate high byte. */
|
||||||
ulBaudRateCount >>= 8UL;
|
ulBaudRateCount >>= 8UL;
|
||||||
UCA1BR1 = ( unsigned portCHAR ) ( ulBaudRateCount & ( unsigned long ) 0xff );
|
UCA1BR1 = ( unsigned char ) ( ulBaudRateCount & ( unsigned long ) 0xff );
|
||||||
|
|
||||||
/* UCLISTEN sets loopback mode! */
|
/* UCLISTEN sets loopback mode! */
|
||||||
UCA1STAT = UCLISTEN;
|
UCA1STAT = UCLISTEN;
|
||||||
|
@ -140,7 +140,7 @@ unsigned portLONG ulBaudRateCount;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* Get the next character from the buffer. Return false if no characters
|
/* Get the next character from the buffer. Return false if no characters
|
||||||
are available, or arrive before xBlockTime expires. */
|
are available, or arrive before xBlockTime expires. */
|
||||||
|
@ -155,7 +155,7 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcR
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
signed portBASE_TYPE xReturn;
|
signed portBASE_TYPE xReturn;
|
||||||
|
|
||||||
|
|
|
@ -95,9 +95,9 @@ static xQueueHandle xCharsForTx;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
unsigned portLONG ulBaudRateCount;
|
unsigned long ulBaudRateCount;
|
||||||
|
|
||||||
/* Initialise the hardware. */
|
/* Initialise the hardware. */
|
||||||
|
|
||||||
|
@ -107,8 +107,8 @@ unsigned portLONG ulBaudRateCount;
|
||||||
portENTER_CRITICAL();
|
portENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
/* Create the queues used by the com test task. */
|
/* Create the queues used by the com test task. */
|
||||||
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
|
|
||||||
/* Reset UART. */
|
/* Reset UART. */
|
||||||
UCA1CTL1 |= UCSWRST;
|
UCA1CTL1 |= UCSWRST;
|
||||||
|
@ -117,11 +117,11 @@ unsigned portLONG ulBaudRateCount;
|
||||||
UCA1CTL1 = UCSSEL0 | UCSSEL1;
|
UCA1CTL1 = UCSSEL0 | UCSSEL1;
|
||||||
|
|
||||||
/* Setup baud rate low byte. */
|
/* Setup baud rate low byte. */
|
||||||
UCA1BR0 = ( unsigned portCHAR ) ( ulBaudRateCount & ( unsigned portLONG ) 0xff );
|
UCA1BR0 = ( unsigned char ) ( ulBaudRateCount & ( unsigned long ) 0xff );
|
||||||
|
|
||||||
/* Setup baud rate high byte. */
|
/* Setup baud rate high byte. */
|
||||||
ulBaudRateCount >>= 8UL;
|
ulBaudRateCount >>= 8UL;
|
||||||
UCA1BR1 = ( unsigned portCHAR ) ( ulBaudRateCount & ( unsigned portLONG ) 0xff );
|
UCA1BR1 = ( unsigned char ) ( ulBaudRateCount & ( unsigned long ) 0xff );
|
||||||
|
|
||||||
/* UCLISTEN sets loopback mode! */
|
/* UCLISTEN sets loopback mode! */
|
||||||
UCA1STAT = UCLISTEN;
|
UCA1STAT = UCLISTEN;
|
||||||
|
@ -140,7 +140,7 @@ unsigned portLONG ulBaudRateCount;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* Get the next character from the buffer. Return false if no characters
|
/* Get the next character from the buffer. Return false if no characters
|
||||||
are available, or arrive before xBlockTime expires. */
|
are available, or arrive before xBlockTime expires. */
|
||||||
|
@ -155,7 +155,7 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcR
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
signed portBASE_TYPE xReturn;
|
signed portBASE_TYPE xReturn;
|
||||||
|
|
||||||
|
|
|
@ -163,13 +163,13 @@ static short sRegTestStatus = pdPASS;
|
||||||
|
|
||||||
/* 78K0R Option Byte Definition. Watchdog disabled, LVI enabled, OCD interface
|
/* 78K0R Option Byte Definition. Watchdog disabled, LVI enabled, OCD interface
|
||||||
enabled. */
|
enabled. */
|
||||||
__root __far const unsigned portCHAR OptionByte[] @ 0x00C0 =
|
__root __far const unsigned char OptionByte[] @ 0x00C0 =
|
||||||
{
|
{
|
||||||
WATCHDOG_DISABLED, LVI_ENABLED, RESERVED_FF, OCD_ENABLED
|
WATCHDOG_DISABLED, LVI_ENABLED, RESERVED_FF, OCD_ENABLED
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Security byte definition */
|
/* Security byte definition */
|
||||||
__root __far const unsigned portCHAR SecuIDCode[] @ 0x00C4 =
|
__root __far const unsigned char SecuIDCode[] @ 0x00C4 =
|
||||||
{
|
{
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
|
||||||
};
|
};
|
||||||
|
@ -283,7 +283,7 @@ portTickType xToggleRate = mainNO_ERROR_TOGGLE_PERIOD, xLastWakeTime;
|
||||||
|
|
||||||
int __low_level_init(void)
|
int __low_level_init(void)
|
||||||
{
|
{
|
||||||
unsigned portCHAR ucResetFlag = RESF;
|
unsigned char ucResetFlag = RESF;
|
||||||
|
|
||||||
portDISABLE_INTERRUPTS();
|
portDISABLE_INTERRUPTS();
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ unsigned portCHAR ucResetFlag = RESF;
|
||||||
|
|
||||||
/* Set clock speed. */
|
/* Set clock speed. */
|
||||||
CSS = 0;
|
CSS = 0;
|
||||||
CKC &= (unsigned portCHAR)~0x07;
|
CKC &= (unsigned char)~0x07;
|
||||||
CKC |= 0x00;
|
CKC |= 0x00;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -68,14 +68,14 @@
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* Called by the startup code to initialise the run time system. */
|
/* Called by the startup code to initialise the run time system. */
|
||||||
unsigned portCHAR __low_level_init(void);
|
unsigned char __low_level_init(void);
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
unsigned portCHAR __low_level_init(void)
|
unsigned char __low_level_init(void)
|
||||||
{
|
{
|
||||||
unsigned portCHAR resetflag = RESF;
|
unsigned char resetflag = RESF;
|
||||||
unsigned portCHAR psval = 0;
|
unsigned char psval = 0;
|
||||||
unsigned portBASE_TYPE i = 0;
|
unsigned portBASE_TYPE i = 0;
|
||||||
|
|
||||||
/* Setup provided by NEC. */
|
/* Setup provided by NEC. */
|
||||||
|
|
|
@ -68,14 +68,14 @@
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* Called by the startup code to initialise the run time system. */
|
/* Called by the startup code to initialise the run time system. */
|
||||||
unsigned portCHAR __low_level_init(void);
|
unsigned char __low_level_init(void);
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
unsigned portCHAR __low_level_init(void)
|
unsigned char __low_level_init(void)
|
||||||
{
|
{
|
||||||
unsigned portCHAR resetflag = RESF;
|
unsigned char resetflag = RESF;
|
||||||
unsigned portCHAR psval = 0;
|
unsigned char psval = 0;
|
||||||
|
|
||||||
/* Setup provided by NEC. */
|
/* Setup provided by NEC. */
|
||||||
|
|
||||||
|
|
|
@ -68,13 +68,13 @@
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* Called by the startup code to initialise the run time system. */
|
/* Called by the startup code to initialise the run time system. */
|
||||||
unsigned portCHAR __low_level_init( void );
|
unsigned char __low_level_init( void );
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
unsigned portCHAR __low_level_init( void )
|
unsigned char __low_level_init( void )
|
||||||
{
|
{
|
||||||
unsigned portCHAR resetflag = RESF;
|
unsigned char resetflag = RESF;
|
||||||
unsigned portBASE_TYPE i = 0;
|
unsigned portBASE_TYPE i = 0;
|
||||||
|
|
||||||
portDISABLE_INTERRUPTS(); /* disable global interrupts */
|
portDISABLE_INTERRUPTS(); /* disable global interrupts */
|
||||||
|
|
|
@ -148,7 +148,7 @@ extern void vRegTest2( void *pvParameters );
|
||||||
|
|
||||||
/* A variable that will get set to fail if a RegTest task finds an error. The
|
/* A variable that will get set to fail if a RegTest task finds an error. The
|
||||||
variable is inspected by the 'Check' task. */
|
variable is inspected by the 'Check' task. */
|
||||||
static volatile portLONG lRegTestStatus = pdPASS;
|
static volatile long lRegTestStatus = pdPASS;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -116,14 +116,14 @@ static volatile unsigned long ulTxInProgress = pdFALSE;
|
||||||
/*
|
/*
|
||||||
* See the serial2.h header file.
|
* See the serial2.h header file.
|
||||||
*/
|
*/
|
||||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||||
{
|
{
|
||||||
xComPortHandle xReturn = serHANDLE;
|
xComPortHandle xReturn = serHANDLE;
|
||||||
const unsigned portLONG ulFuclk = ( configCPU_CLOCK_HZ / 2 ) / 8UL;
|
const unsigned long ulFuclk = ( configCPU_CLOCK_HZ / 2 ) / 8UL;
|
||||||
|
|
||||||
/* Create the queues used to hold Rx and Tx characters. */
|
/* Create the queues used to hold Rx and Tx characters. */
|
||||||
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||||
|
|
||||||
/* If the queues were created correctly then setup the serial port
|
/* If the queues were created correctly then setup the serial port
|
||||||
hardware. */
|
hardware. */
|
||||||
|
@ -161,7 +161,7 @@ const unsigned portLONG ulFuclk = ( configCPU_CLOCK_HZ / 2 ) / 8UL;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
/* The port handle is not required as this driver only supports one port. */
|
/* The port handle is not required as this driver only supports one port. */
|
||||||
( void ) pxPort;
|
( void ) pxPort;
|
||||||
|
@ -179,9 +179,9 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcR
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vSerialPutString( xComPortHandle pxPort, const signed portCHAR * const pcString, unsigned portSHORT usStringLength )
|
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )
|
||||||
{
|
{
|
||||||
signed portCHAR *pxNext;
|
signed char *pxNext;
|
||||||
|
|
||||||
/* A couple of parameters that this port does not use. */
|
/* A couple of parameters that this port does not use. */
|
||||||
( void ) usStringLength;
|
( void ) usStringLength;
|
||||||
|
@ -194,7 +194,7 @@ signed portCHAR *pxNext;
|
||||||
( void ) pxPort;
|
( void ) pxPort;
|
||||||
|
|
||||||
/* Send each character in the string, one at a time. */
|
/* Send each character in the string, one at a time. */
|
||||||
pxNext = ( signed portCHAR * ) pcString;
|
pxNext = ( signed char * ) pcString;
|
||||||
while( *pxNext )
|
while( *pxNext )
|
||||||
{
|
{
|
||||||
xSerialPutChar( pxPort, *pxNext, serNO_BLOCK );
|
xSerialPutChar( pxPort, *pxNext, serNO_BLOCK );
|
||||||
|
@ -203,7 +203,7 @@ signed portCHAR *pxNext;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xReturn = pdPASS;
|
portBASE_TYPE xReturn = pdPASS;
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
/* Rx interrupt handler. This is called from the asm file wrapper. */
|
/* Rx interrupt handler. This is called from the asm file wrapper. */
|
||||||
void vUARTRxISRHandler( void )
|
void vUARTRxISRHandler( void )
|
||||||
{
|
{
|
||||||
portCHAR cChar;
|
char cChar;
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
/* Send the received character to the Rx queue. */
|
/* Send the received character to the Rx queue. */
|
||||||
|
|
|
@ -87,12 +87,12 @@ static void prvSetupLCD( void );
|
||||||
/*
|
/*
|
||||||
* Move to the first (0) or second (1) row of the LCD.
|
* Move to the first (0) or second (1) row of the LCD.
|
||||||
*/
|
*/
|
||||||
static void prvLCDGotoRow( unsigned portSHORT usRow );
|
static void prvLCDGotoRow( unsigned short usRow );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write a string of text to the LCD.
|
* Write a string of text to the LCD.
|
||||||
*/
|
*/
|
||||||
static void prvLCDPutString( portCHAR *pcString );
|
static void prvLCDPutString( char *pcString );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clear the LCD.
|
* Clear the LCD.
|
||||||
|
@ -137,7 +137,7 @@ xQueueHandle xStartLCDTask( void )
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvLCDGotoRow( unsigned portSHORT usRow )
|
static void prvLCDGotoRow( unsigned short usRow )
|
||||||
{
|
{
|
||||||
if( usRow == 0 )
|
if( usRow == 0 )
|
||||||
{
|
{
|
||||||
|
@ -154,7 +154,7 @@ static void prvLCDGotoRow( unsigned portSHORT usRow )
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvLCDPutString( portCHAR *pcString )
|
static void prvLCDPutString( char *pcString )
|
||||||
{
|
{
|
||||||
/* Write out each character with appropriate delay between each. */
|
/* Write out each character with appropriate delay between each. */
|
||||||
while( *pcString )
|
while( *pcString )
|
||||||
|
@ -206,7 +206,7 @@ static void prvSetupLCD( void )
|
||||||
static void vLCDTask( void *pvParameters )
|
static void vLCDTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
xLCDMessage xMessage;
|
xLCDMessage xMessage;
|
||||||
unsigned portSHORT usRow = 0;
|
unsigned short usRow = 0;
|
||||||
|
|
||||||
/* Remove compiler warnigns. */
|
/* Remove compiler warnigns. */
|
||||||
( void ) pvParameters;
|
( void ) pvParameters;
|
||||||
|
|
|
@ -91,11 +91,11 @@ static void prvCalculateAndStoreJitter( void );
|
||||||
|
|
||||||
/* The maximum time (in processor clocks) between two consecutive timer
|
/* The maximum time (in processor clocks) between two consecutive timer
|
||||||
interrupts so far. */
|
interrupts so far. */
|
||||||
unsigned portSHORT usMaxJitter = 0;
|
unsigned short usMaxJitter = 0;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vSetupTimerTest( unsigned portSHORT usFrequencyHz )
|
void vSetupTimerTest( unsigned short usFrequencyHz )
|
||||||
{
|
{
|
||||||
/* T2 is used to generate interrupts. T4 is used to provide an accurate
|
/* T2 is used to generate interrupts. T4 is used to provide an accurate
|
||||||
time measurement. */
|
time measurement. */
|
||||||
|
@ -105,10 +105,10 @@ void vSetupTimerTest( unsigned portSHORT usFrequencyHz )
|
||||||
TMR4 = 0;
|
TMR4 = 0;
|
||||||
|
|
||||||
/* Timer 2 is going to interrupt at usFrequencyHz Hz. */
|
/* Timer 2 is going to interrupt at usFrequencyHz Hz. */
|
||||||
PR2 = ( unsigned portSHORT ) ( configCPU_CLOCK_HZ / ( unsigned portLONG ) usFrequencyHz );
|
PR2 = ( unsigned short ) ( configCPU_CLOCK_HZ / ( unsigned long ) usFrequencyHz );
|
||||||
|
|
||||||
/* Timer 4 is going to free run from minimum to maximum value. */
|
/* Timer 4 is going to free run from minimum to maximum value. */
|
||||||
PR4 = ( unsigned portSHORT ) timerMAX_COUNT;
|
PR4 = ( unsigned short ) timerMAX_COUNT;
|
||||||
|
|
||||||
/* Setup timer 2 interrupt priority to be above the kernel priority so
|
/* Setup timer 2 interrupt priority to be above the kernel priority so
|
||||||
the timer jitter is not effected by the kernel activity. */
|
the timer jitter is not effected by the kernel activity. */
|
||||||
|
@ -128,8 +128,8 @@ void vSetupTimerTest( unsigned portSHORT usFrequencyHz )
|
||||||
|
|
||||||
static void prvCalculateAndStoreJitter( void )
|
static void prvCalculateAndStoreJitter( void )
|
||||||
{
|
{
|
||||||
static unsigned portSHORT usLastCount = 0, usSettleCount = 0;
|
static unsigned short usLastCount = 0, usSettleCount = 0;
|
||||||
unsigned portSHORT usThisCount, usDifference;
|
unsigned short usThisCount, usDifference;
|
||||||
|
|
||||||
/* Capture the timer value as we enter the interrupt. */
|
/* Capture the timer value as we enter the interrupt. */
|
||||||
usThisCount = TMR4;
|
usThisCount = TMR4;
|
||||||
|
|
|
@ -125,11 +125,11 @@ static void vFlopTest2( void *pvParameters );
|
||||||
|
|
||||||
/* Buffers into which the flop registers will be saved. There is a buffer for
|
/* Buffers into which the flop registers will be saved. There is a buffer for
|
||||||
both tasks. */
|
both tasks. */
|
||||||
static volatile unsigned portLONG ulFlopRegisters[ flopNUMBER_OF_TASKS ][ portNO_FLOP_REGISTERS_TO_SAVE ];
|
static volatile unsigned long ulFlopRegisters[ flopNUMBER_OF_TASKS ][ portNO_FLOP_REGISTERS_TO_SAVE ];
|
||||||
|
|
||||||
/* Variables that are incremented by the tasks to indicate that they are still
|
/* Variables that are incremented by the tasks to indicate that they are still
|
||||||
running. */
|
running. */
|
||||||
static volatile unsigned portLONG ulFlop1CycleCount = 0, ulFlop2CycleCount = 0;
|
static volatile unsigned long ulFlop1CycleCount = 0, ulFlop2CycleCount = 0;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ portBASE_TYPE xAreFlopRegisterTestsStillRunning( void )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xReturn = pdPASS;
|
portBASE_TYPE xReturn = pdPASS;
|
||||||
unsigned portBASE_TYPE x, y, z = flopSTART_VALUE;
|
unsigned portBASE_TYPE x, y, z = flopSTART_VALUE;
|
||||||
static unsigned portLONG ulLastFlop1CycleCount = 0, ulLastFlop2CycleCount = 0;
|
static unsigned long ulLastFlop1CycleCount = 0, ulLastFlop2CycleCount = 0;
|
||||||
|
|
||||||
/* Called from the 'check' task.
|
/* Called from the 'check' task.
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue