From a089537b0210206bf6e6a6d39286b08a45ff14c0 Mon Sep 17 00:00:00 2001 From: Richard Barry Date: Mon, 11 Jul 2011 12:06:57 +0000 Subject: [PATCH] Comment K60 demo code, ready for release. --- .../FreeRTOSConfig.h | 35 ++- Demo/CORTEX_Kinetis_K60_Tower_IAR/ParTest.c | 3 +- .../CORTEX_Kinetis_K60_Tower_IAR/RTOSDemo.ewd | 2 +- .../CORTEX_Kinetis_K60_Tower_IAR/RTOSDemo.ewp | 6 +- Demo/CORTEX_Kinetis_K60_Tower_IAR/main-full.c | 262 +++++++++--------- .../main_blinky.c | 73 +++-- Demo/CORTEX_Kinetis_K60_Tower_IAR/uIP_Task.c | 13 +- .../webserver/EMAC.c | 34 +-- 8 files changed, 217 insertions(+), 211 deletions(-) diff --git a/Demo/CORTEX_Kinetis_K60_Tower_IAR/FreeRTOSConfig.h b/Demo/CORTEX_Kinetis_K60_Tower_IAR/FreeRTOSConfig.h index 2b54877c8..0a346017e 100644 --- a/Demo/CORTEX_Kinetis_K60_Tower_IAR/FreeRTOSConfig.h +++ b/Demo/CORTEX_Kinetis_K60_Tower_IAR/FreeRTOSConfig.h @@ -80,14 +80,13 @@ #define configTICK_RATE_HZ ( ( portTickType ) 1000 ) #define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 90 ) -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 60 * 1024 ) ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 30 * 1024 ) ) #define configMAX_TASK_NAME_LEN ( 10 ) #define configUSE_TRACE_FACILITY 1 #define configUSE_16_BIT_TICKS 0 #define configIDLE_SHOULD_YIELD 1 #define configUSE_MUTEXES 1 -#define configQUEUE_REGISTRY_SIZE 0 -#define configGENERATE_RUN_TIME_STATS 1 +#define configQUEUE_REGISTRY_SIZE 8 #define configCHECK_FOR_STACK_OVERFLOW 2 #define configUSE_RECURSIVE_MUTEXES 1 #define configUSE_MALLOC_FAILED_HOOK 1 @@ -114,34 +113,54 @@ to exclude the API function. */ #define INCLUDE_vTaskDelayUntil 1 #define INCLUDE_vTaskDelay 1 -#ifdef __ICCARM__ /* Stop these prototypes being included in the asm files. */ +/* Run time stats gathering definitions. */ +#ifdef __ICCARM__ + /* The #ifdef just prevents this C specific syntax from being included in + assembly files. */ void vMainConfigureTimerForRunTimeStats( void ); unsigned long ulMainGetRunTimeCounterValue( void ); #endif +#define configGENERATE_RUN_TIME_STATS 1 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vMainConfigureTimerForRunTimeStats() #define portGET_RUN_TIME_COUNTER_VALUE() ulMainGetRunTimeCounterValue() -/* Use the system definition, if there is one */ +/* Cortex-M specific definitions. */ #ifdef __NVIC_PRIO_BITS + /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ #define configPRIO_BITS __NVIC_PRIO_BITS #else #define configPRIO_BITS 4 /* 15 priority levels */ #endif +/* The lowest interrupt priority that can be used in a call to a "set priority" +function. */ #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf + +/* The highest interrupt priority that can be used by any interrupt service +routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL +INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER +PRIORITY THAN THIS! (higher priorities are lower numeric values. */ #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 -/* The lowest priority. */ -#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) -/* Priority 5, or 160 as only the top three bits are implemented. */ +/* Interrupt priorities used by the kernel port layer itself. These are generic +to all Cortex-M ports, and do not rely on any particular library functions. */ +#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) +/* Normal assert() semantics without relying on the provision of an assert.h +header file. */ #define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); } +/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS +standard names. */ #define vPortSVCHandler SVC_Handler #define xPortPendSVHandler PendSV_Handler #define xPortSysTickHandler SysTick_Handler +/****************************************************************************** + * Network configuration constants follow from here. + *****************************************************************************/ + /* MAC address configuration. */ #define configMAC_ADDR0 0x00 #define configMAC_ADDR1 0x12 diff --git a/Demo/CORTEX_Kinetis_K60_Tower_IAR/ParTest.c b/Demo/CORTEX_Kinetis_K60_Tower_IAR/ParTest.c index 2e2d96275..7ae69bcac 100644 --- a/Demo/CORTEX_Kinetis_K60_Tower_IAR/ParTest.c +++ b/Demo/CORTEX_Kinetis_K60_Tower_IAR/ParTest.c @@ -52,7 +52,7 @@ */ /*----------------------------------------------------------- - * Simple parallel port IO routines. + * Simple GPIO (parallel port) IO routines. *-----------------------------------------------------------*/ /* Kernel includes. */ @@ -68,6 +68,7 @@ /* Only the LEDs on one of the two seven segment displays are used. */ #define partstMAX_LEDS 4 +/* The bits used to control the LEDs on the TWR-K60N512. */ const unsigned long ulLEDs[ partstMAX_LEDS ] = { ( 1UL << 10UL ), ( 1UL << 29UL ), ( 1UL << 28UL ), ( 1UL << 11UL ) }; /*-----------------------------------------------------------*/ diff --git a/Demo/CORTEX_Kinetis_K60_Tower_IAR/RTOSDemo.ewd b/Demo/CORTEX_Kinetis_K60_Tower_IAR/RTOSDemo.ewd index 377fbfad8..999e00c69 100644 --- a/Demo/CORTEX_Kinetis_K60_Tower_IAR/RTOSDemo.ewd +++ b/Demo/CORTEX_Kinetis_K60_Tower_IAR/RTOSDemo.ewd @@ -839,7 +839,7 @@ $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin - 0 + 1 $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin diff --git a/Demo/CORTEX_Kinetis_K60_Tower_IAR/RTOSDemo.ewp b/Demo/CORTEX_Kinetis_K60_Tower_IAR/RTOSDemo.ewp index 7c5e038e1..884a29c5d 100644 --- a/Demo/CORTEX_Kinetis_K60_Tower_IAR/RTOSDemo.ewp +++ b/Demo/CORTEX_Kinetis_K60_Tower_IAR/RTOSDemo.ewp @@ -226,7 +226,7 @@