--- /dev/null
+/*\r
+ FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+ All rights reserved\r
+\r
+ VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS provides completely free yet professionally developed, *\r
+ * robust, strictly quality controlled, supported, and cross *\r
+ * platform software that has become a de facto standard. *\r
+ * *\r
+ * Help yourself get started quickly and support the FreeRTOS *\r
+ * project by purchasing a FreeRTOS tutorial book, reference *\r
+ * manual, or both from: http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ * Thank you! *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+ >>! NOTE: The modification to the GPL is included to allow you to !<<\r
+ >>! distribute a combined work that includes FreeRTOS without being !<<\r
+ >>! obliged to provide the source code for proprietary components !<<\r
+ >>! outside of the FreeRTOS kernel. !<<\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+ FOR A PARTICULAR PURPOSE. Full license text is available from the following\r
+ link: http://www.freertos.org/a00114.html\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * Having a problem? Start by reading the FAQ "My application does *\r
+ * not run, what could be wrong?" *\r
+ * *\r
+ * http://www.FreeRTOS.org/FAQHelp.html *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
+ license and Real Time Engineers Ltd. contact details.\r
+\r
+ http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+ including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+ compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+ http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+ Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS\r
+ licenses offer ticketed support, indemnification and middleware.\r
+\r
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+ engineered and independently SIL3 certified version for use in safety and\r
+ mission critical applications that require provable dependability.\r
+\r
+ 1 tab == 4 spaces!\r
+*/\r
+\r
+/* Variables used by scheduler */\r
+ .extern _pxCurrentTCB\r
+ .extern _usCriticalNesting\r
+\r
+/*\r
+ * portSAVE_CONTEXT MACRO\r
+ * Saves the context of the general purpose registers, CS and ES (only in far\r
+ * memory mode) registers the usCriticalNesting Value and the Stack Pointer\r
+ * of the active Task onto the task stack\r
+ */\r
+ .macro portSAVE_CONTEXT\r
+\r
+ SEL RB0\r
+\r
+ /* Save AX Register to stack. */\r
+ PUSH AX\r
+ PUSH HL\r
+ /* Save CS register. */\r
+ MOV A, CS\r
+ XCH A, X\r
+ /* Save ES register. */\r
+ MOV A, ES\r
+ PUSH AX\r
+ /* Save the remaining general purpose registers from bank 0. */\r
+ PUSH DE\r
+ PUSH BC\r
+ /* Save the other register banks - only necessary in the GCC port. */\r
+ SEL RB1\r
+ PUSH AX\r
+ PUSH BC\r
+ PUSH DE\r
+ PUSH HL\r
+ SEL RB2\r
+ PUSH AX\r
+ PUSH BC\r
+ PUSH DE\r
+ PUSH HL\r
+ /* Registers in bank 3 are for ISR use only so don't need saving. */\r
+ SEL RB0\r
+ /* Save the usCriticalNesting value. */\r
+ MOVW AX, !_usCriticalNesting\r
+ PUSH AX\r
+ /* Save the Stack pointer. */\r
+ MOVW AX, !_pxCurrentTCB\r
+ MOVW HL, AX\r
+ MOVW AX, SP\r
+ MOVW [HL], AX\r
+ /* Switch stack pointers. */\r
+ movw sp,#_stack /* Set stack pointer */\r
+\r
+ .endm\r
+\r
+\r
+/*\r
+ * portRESTORE_CONTEXT MACRO\r
+ * Restores the task Stack Pointer then use this to restore usCriticalNesting,\r
+ * general purpose registers and the CS and ES (only in far memory mode)\r
+ * of the selected task from the task stack\r
+ */\r
+.macro portRESTORE_CONTEXT MACRO\r
+ SEL RB0\r
+ /* Restore the Stack pointer. */\r
+ MOVW AX, !_pxCurrentTCB\r
+ MOVW HL, AX\r
+ MOVW AX, [HL]\r
+ MOVW SP, AX\r
+ /* Restore usCriticalNesting value. */\r
+ POP AX\r
+ MOVW !_usCriticalNesting, AX\r
+ /* Restore the alternative register banks - only necessary in the GCC\r
+ port. Register bank 3 is dedicated for interrupts use so is not saved or\r
+ restored. */\r
+ SEL RB2\r
+ POP HL\r
+ POP DE\r
+ POP BC\r
+ POP AX\r
+ SEL RB1\r
+ POP HL\r
+ POP DE\r
+ POP BC\r
+ POP AX\r
+ SEL RB0\r
+ /* Restore the necessary general purpose registers. */\r
+ POP BC\r
+ POP DE\r
+ /* Restore the ES register. */\r
+ POP AX\r
+ MOV ES, A\r
+ /* Restore the CS register. */\r
+ XCH A, X\r
+ MOV CS, A\r
+ /* Restore general purpose register HL. */\r
+ POP HL\r
+ /* Restore AX. */\r
+ POP AX\r
+\r
+ .endm\r
+\r
--- /dev/null
+/*\r
+ FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+ All rights reserved\r
+\r
+ VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS provides completely free yet professionally developed, *\r
+ * robust, strictly quality controlled, supported, and cross *\r
+ * platform software that has become a de facto standard. *\r
+ * *\r
+ * Help yourself get started quickly and support the FreeRTOS *\r
+ * project by purchasing a FreeRTOS tutorial book, reference *\r
+ * manual, or both from: http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ * Thank you! *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+ >>! NOTE: The modification to the GPL is included to allow you to !<<\r
+ >>! distribute a combined work that includes FreeRTOS without being !<<\r
+ >>! obliged to provide the source code for proprietary components !<<\r
+ >>! outside of the FreeRTOS kernel. !<<\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+ FOR A PARTICULAR PURPOSE. Full license text is available from the following\r
+ link: http://www.freertos.org/a00114.html\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * Having a problem? Start by reading the FAQ "My application does *\r
+ * not run, what could be wrong?" *\r
+ * *\r
+ * http://www.FreeRTOS.org/FAQHelp.html *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
+ license and Real Time Engineers Ltd. contact details.\r
+\r
+ http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+ including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+ compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+ http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+ Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS\r
+ licenses offer ticketed support, indemnification and middleware.\r
+\r
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+ engineered and independently SIL3 certified version for use in safety and\r
+ mission critical applications that require provable dependability.\r
+\r
+ 1 tab == 4 spaces!\r
+*/\r
+\r
+/* Scheduler includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+\r
+/* The critical nesting value is initialised to a non zero value to ensure\r
+interrupts don't accidentally become enabled before the scheduler is started. */\r
+#define portINITIAL_CRITICAL_NESTING ( ( uint16_t ) 10 )\r
+\r
+/* Initial PSW value allocated to a newly created task.\r
+ * 11000110\r
+ * ||||||||-------------- Fill byte\r
+ * |||||||--------------- Carry Flag cleared\r
+ * |||||----------------- In-service priority Flags set to low level\r
+ * ||||------------------ Register bank Select 0 Flag cleared\r
+ * |||------------------- Auxiliary Carry Flag cleared\r
+ * ||-------------------- Register bank Select 1 Flag cleared\r
+ * |--------------------- Zero Flag set\r
+ * ---------------------- Global Interrupt Flag set (enabled)\r
+ */\r
+#define portPSW ( 0xc6UL )\r
+\r
+/* Each task maintains a count of the critical section nesting depth. Each time\r
+a critical section is entered the count is incremented. Each time a critical\r
+section is exited the count is decremented - with interrupts only being\r
+re-enabled if the count is zero.\r
+\r
+usCriticalNesting will get set to zero when the scheduler starts, but must\r
+not be initialised to zero as that could cause problems during the startup\r
+sequence. */\r
+volatile uint16_t usCriticalNesting = portINITIAL_CRITICAL_NESTING;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * Sets up the periodic ISR used for the RTOS tick.\r
+ */\r
+__attribute__((weak)) void vApplicationSetupTimerInterrupt( void );\r
+\r
+/*\r
+ * Starts the scheduler by loading the context of the first task to run.\r
+ * (defined in portasm.S).\r
+ */\r
+extern void vPortStartFirstTask( void );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * Initialise the stack of a task to look exactly as if a call to\r
+ * portSAVE_CONTEXT had been called.\r
+ *\r
+ * See the header file portable.h.\r
+ */\r
+StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )\r
+{\r
+uint32_t *pulLocal;\r
+\r
+ /* Stack type and pointers to the stack type are both 2 bytes. */\r
+\r
+ /* Parameters are passed in on the stack, and written using a 32bit value\r
+ hence a space is left for the second two bytes. */\r
+ pxTopOfStack--;\r
+\r
+ /* Write in the parameter value. */\r
+ pulLocal = ( uint32_t * ) pxTopOfStack;\r
+ *pulLocal = ( StackType_t ) pvParameters;\r
+ pxTopOfStack--;\r
+\r
+ /* The return address, leaving space for the first two bytes of the\r
+ 32-bit value. */\r
+ pxTopOfStack--;\r
+ pulLocal = ( uint32_t * ) pxTopOfStack;\r
+ *pulLocal = ( uint32_t ) 0;\r
+ pxTopOfStack--;\r
+\r
+ /* The start address / PSW value is also written in as a 32bit value,\r
+ so leave a space for the second two bytes. */\r
+ pxTopOfStack--;\r
+\r
+ /* Task function start address combined with the PSW. */\r
+ pulLocal = ( uint32_t * ) pxTopOfStack;\r
+ *pulLocal = ( ( ( uint32_t ) pxCode ) | ( portPSW << 24UL ) );\r
+ pxTopOfStack--;\r
+\r
+ /* An initial value for the AX register. */\r
+ *pxTopOfStack = ( StackType_t ) 0x1111;\r
+ pxTopOfStack--;\r
+\r
+ /* An initial value for the HL register. */\r
+ *pxTopOfStack = ( StackType_t ) 0x2222;\r
+ pxTopOfStack--;\r
+\r
+ /* CS and ES registers. */\r
+ *pxTopOfStack = ( StackType_t ) 0x0F00;\r
+ pxTopOfStack--;\r
+\r
+ /* The remaining general purpose registers bank 0 (DE and BC) and the other\r
+ two register banks...register bank 3 is dedicated for use by interrupts so\r
+ is not saved as part of the task context. */\r
+ pxTopOfStack -= 10;\r
+\r
+ /* Finally the critical section nesting count is set to zero when the task\r
+ first starts. */\r
+ *pxTopOfStack = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING;\r
+\r
+ /* Return a pointer to the top of the stack that has beene generated so it\r
+ can be stored in the task control block for the task. */\r
+ return pxTopOfStack;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+portBASE_TYPE xPortStartScheduler( void )\r
+{\r
+ /* Setup the hardware to generate the tick. Interrupts are disabled when\r
+ this function is called. */\r
+ vApplicationSetupTimerInterrupt();\r
+\r
+ /* Restore the context of the first task that is going to run. */\r
+ vPortStartFirstTask();\r
+\r
+ /* Execution should not reach here as the tasks are now running! */\r
+ return pdTRUE;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vPortEndScheduler( void )\r
+{\r
+ /* It is unlikely that the RL78 port will get stopped. */\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+__attribute__((weak)) void vApplicationSetupTimerInterrupt( void )\r
+{\r
+const uint16_t usClockHz = 15000UL; /* Internal clock. */\r
+const uint16_t usCompareMatch = ( usClockHz / configTICK_RATE_HZ ) + 1UL;\r
+\r
+ /* Use the internal 15K clock. */\r
+ OSMC = ( unsigned char ) 0x16;\r
+\r
+ #ifdef RTCEN\r
+ {\r
+ /* Supply the interval timer clock. */\r
+ RTCEN = ( unsigned char ) 1U;\r
+\r
+ /* Disable INTIT interrupt. */\r
+ ITMK = ( unsigned char ) 1;\r
+\r
+ /* Disable ITMC operation. */\r
+ ITMC = ( unsigned char ) 0x0000;\r
+\r
+ /* Clear INIT interrupt. */\r
+ ITIF = ( unsigned char ) 0;\r
+\r
+ /* Set interval and enable interrupt operation. */\r
+ ITMC = usCompareMatch | 0x8000U;\r
+\r
+ /* Enable INTIT interrupt. */\r
+ ITMK = ( unsigned char ) 0;\r
+ }\r
+ #endif\r
+\r
+ #ifdef TMKAEN\r
+ {\r
+ /* Supply the interval timer clock. */\r
+ TMKAEN = ( unsigned char ) 1U;\r
+\r
+ /* Disable INTIT interrupt. */\r
+ TMKAMK = ( unsigned char ) 1;\r
+\r
+ /* Disable ITMC operation. */\r
+ ITMC = ( unsigned char ) 0x0000;\r
+\r
+ /* Clear INIT interrupt. */\r
+ TMKAIF = ( unsigned char ) 0;\r
+\r
+ /* Set interval and enable interrupt operation. */\r
+ ITMC = usCompareMatch | 0x8000U;\r
+\r
+ /* Enable INTIT interrupt. */\r
+ TMKAMK = ( unsigned char ) 0;\r
+ }\r
+ #endif\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
--- /dev/null
+/*\r
+ FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+ All rights reserved\r
+\r
+ VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS provides completely free yet professionally developed, *\r
+ * robust, strictly quality controlled, supported, and cross *\r
+ * platform software that has become a de facto standard. *\r
+ * *\r
+ * Help yourself get started quickly and support the FreeRTOS *\r
+ * project by purchasing a FreeRTOS tutorial book, reference *\r
+ * manual, or both from: http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ * Thank you! *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+ >>! NOTE: The modification to the GPL is included to allow you to !<<\r
+ >>! distribute a combined work that includes FreeRTOS without being !<<\r
+ >>! obliged to provide the source code for proprietary components !<<\r
+ >>! outside of the FreeRTOS kernel. !<<\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+ FOR A PARTICULAR PURPOSE. Full license text is available from the following\r
+ link: http://www.freertos.org/a00114.html\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * Having a problem? Start by reading the FAQ "My application does *\r
+ * not run, what could be wrong?" *\r
+ * *\r
+ * http://www.FreeRTOS.org/FAQHelp.html *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
+ license and Real Time Engineers Ltd. contact details.\r
+\r
+ http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+ including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+ compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+ http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+ Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS\r
+ licenses offer ticketed support, indemnification and middleware.\r
+\r
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+ engineered and independently SIL3 certified version for use in safety and\r
+ mission critical applications that require provable dependability.\r
+\r
+ 1 tab == 4 spaces!\r
+*/\r
+\r
+#include "FreeRTOSConfig.h"\r
+#include "ISR_Support.h"\r
+\r
+ .global _vPortYield\r
+ .global _vPortStartFirstTask\r
+ .global _vPortTickISR\r
+\r
+ .extern _vTaskSwitchContext\r
+ .extern _xTaskIncrementTick\r
+\r
+ .text\r
+ .align 2\r
+\r
+/* FreeRTOS yield handler. This is installed as the BRK software interrupt\r
+handler. */\r
+_vPortYield:\r
+ /* Save the context of the current task. */\r
+ portSAVE_CONTEXT\r
+ /* Call the scheduler to select the next task. */\r
+ call !!_vTaskSwitchContext\r
+ /* Restore the context of the next task to run. */\r
+ portRESTORE_CONTEXT\r
+ retb\r
+\r
+\r
+/* Starts the scheduler by restoring the context of the task that will execute\r
+first. */\r
+ .align 2\r
+_vPortStartFirstTask:\r
+ /* Restore the context of whichever task will execute first. */\r
+ portRESTORE_CONTEXT\r
+ /* An interrupt stack frame is used so the task is started using RETI. */\r
+ reti\r
+\r
+/* FreeRTOS tick handler. This is installed as the interval timer interrupt\r
+handler. */\r
+ .align 2\r
+_vPortTickISR:\r
+\r
+ /* Save the context of the currently executing task. */\r
+ portSAVE_CONTEXT\r
+ /* Call the RTOS tick function. */\r
+ call !!_xTaskIncrementTick\r
+#if configUSE_PREEMPTION == 1\r
+ /* Select the next task to run. */\r
+ call !!_vTaskSwitchContext\r
+#endif\r
+ /* Retore the context of whichever task will run next. */\r
+ portRESTORE_CONTEXT\r
+ reti\r
+\r
+ .end\r
+\r
--- /dev/null
+/*\r
+ FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+ All rights reserved\r
+\r
+ VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS provides completely free yet professionally developed, *\r
+ * robust, strictly quality controlled, supported, and cross *\r
+ * platform software that has become a de facto standard. *\r
+ * *\r
+ * Help yourself get started quickly and support the FreeRTOS *\r
+ * project by purchasing a FreeRTOS tutorial book, reference *\r
+ * manual, or both from: http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ * Thank you! *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+ >>! NOTE: The modification to the GPL is included to allow you to !<<\r
+ >>! distribute a combined work that includes FreeRTOS without being !<<\r
+ >>! obliged to provide the source code for proprietary components !<<\r
+ >>! outside of the FreeRTOS kernel. !<<\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+ FOR A PARTICULAR PURPOSE. Full license text is available from the following\r
+ link: http://www.freertos.org/a00114.html\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * Having a problem? Start by reading the FAQ "My application does *\r
+ * not run, what could be wrong?" *\r
+ * *\r
+ * http://www.FreeRTOS.org/FAQHelp.html *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
+ license and Real Time Engineers Ltd. contact details.\r
+\r
+ http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+ including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+ compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+ http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+ Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS\r
+ licenses offer ticketed support, indemnification and middleware.\r
+\r
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+ engineered and independently SIL3 certified version for use in safety and\r
+ mission critical applications that require provable dependability.\r
+\r
+ 1 tab == 4 spaces!\r
+*/\r
+\r
+#ifndef PORTMACRO_H\r
+#define PORTMACRO_H\r
+\r
+/*-----------------------------------------------------------\r
+ * Port specific definitions.\r
+ *\r
+ * The settings in this file configure FreeRTOS correctly for the\r
+ * given hardware and compiler.\r
+ *\r
+ * These settings should not be altered.\r
+ *-----------------------------------------------------------\r
+ */\r
+\r
+/* Type definitions. */\r
+\r
+#define portCHAR char\r
+#define portFLOAT float\r
+#define portDOUBLE double\r
+#define portLONG long\r
+#define portSHORT short\r
+#define portSTACK_TYPE uint16_t\r
+#define portBASE_TYPE short\r
+#define portPOINTER_SIZE_TYPE uint16_t\r
+\r
+typedef portSTACK_TYPE StackType_t;\r
+typedef short BaseType_t;\r
+typedef unsigned short UBaseType_t;\r
+\r
+#if( configUSE_16_BIT_TICKS == 1 )\r
+ typedef uint16_t TickType_t;\r
+ #define portMAX_DELAY ( TickType_t ) 0xffff\r
+#else\r
+ typedef uint32_t TickType_t;\r
+ #define portMAX_DELAY ( TickType_t ) 0xffffffffUL\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Interrupt control macros. */\r
+#define portDISABLE_INTERRUPTS() __asm volatile ( "DI" )\r
+#define portENABLE_INTERRUPTS() __asm volatile ( "EI" )\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Critical section control macros. */\r
+#define portNO_CRITICAL_SECTION_NESTING ( ( unsigned short ) 0 )\r
+\r
+#define portENTER_CRITICAL() \\r
+{ \\r
+extern volatile uint16_t usCriticalNesting; \\r
+ \\r
+ portDISABLE_INTERRUPTS(); \\r
+ \\r
+ /* Now interrupts are disabled ulCriticalNesting can be accessed */ \\r
+ /* directly. Increment ulCriticalNesting to keep a count of how many */ \\r
+ /* times portENTER_CRITICAL() has been called. */ \\r
+ usCriticalNesting++; \\r
+}\r
+\r
+#define portEXIT_CRITICAL() \\r
+{ \\r
+extern volatile uint16_t usCriticalNesting; \\r
+ \\r
+ if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \\r
+ { \\r
+ /* Decrement the nesting count as we are leaving a critical section. */ \\r
+ usCriticalNesting--; \\r
+ \\r
+ /* If the nesting level has reached zero then interrupts should be */ \\r
+ /* re-enabled. */ \\r
+ if( usCriticalNesting == portNO_CRITICAL_SECTION_NESTING ) \\r
+ { \\r
+ portENABLE_INTERRUPTS(); \\r
+ } \\r
+ } \\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Task utilities. */\r
+#define portYIELD() __asm volatile ( "BRK" )\r
+#define portYIELD_FROM_ISR( xHigherPriorityTaskWoken ) if( xHigherPriorityTaskWoken ) vTaskSwitchContext()\r
+#define portNOP() __asm volatile ( "NOP" )\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Hardwware specifics. */\r
+#define portBYTE_ALIGNMENT 2\r
+#define portSTACK_GROWTH ( -1 )\r
+#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Task function macros as described on the FreeRTOS.org WEB site. */\r
+#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )\r
+#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )\r
+\r
+#endif /* PORTMACRO_H */\r
+\r