+++ /dev/null
-; FreeRTOS.org V5.1.1 - Copyright (C) 2003-2008 Richard Barry.\r
-;\r
-; This file is part of the FreeRTOS.org distribution.\r
-;\r
-; FreeRTOS.org is free software; you can redistribute it and/or modify\r
-; it under the terms of the GNU General Public License as published by\r
-; the Free Software Foundation; either version 2 of the License, or\r
-; (at your option) any later version.\r
-;\r
-; FreeRTOS.org is distributed in the hope that it will be useful,\r
-; but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-; GNU General Public License for more details.\r
-;\r
-; You should have received a copy of the GNU General Public License\r
-; along with FreeRTOS.org; if not, write to the Free Software\r
-; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
-;\r
-; A special exception to the GPL can be applied should you wish to distribute\r
-; a combined work that includes FreeRTOS.org, without being obliged to provide\r
-; the source code for any proprietary components. See the licensing section\r
-; of http://www.FreeRTOS.org for full details of how and when the exception\r
-; can be applied.\r
-;\r
-; ***************************************************************************\r
-; See http://www.FreeRTOS.org for documentation, latest information, license\r
-; and contact details. Please ensure to read the configuration and relevant\r
-; port sections of the online documentation.\r
-; ***************************************************************************\r
-;\r
-;------------------------------------------------------------------------------\r
-; Note: Select the correct include files for the device used by the application. \r
-#include "FreeRTOSConfig.h"\r
-;------------------------------------------------------------------------------\r
-\r
-; Functions used by scheduler\r
-;------------------------------------------------------------------------------ \r
- EXTERN vTaskSwitchContext\r
- EXTERN vTaskIncrementTick\r
-\r
-; Variables used by scheduler\r
-;------------------------------------------------------------------------------ \r
- EXTERN pxCurrentTCB\r
- EXTERN usCriticalNesting\r
-\r
-; Functions implemented in this file\r
-;------------------------------------------------------------------------------\r
- PUBLIC vPortYield\r
- PUBLIC vPortStart\r
-\r
-; Security ID definition\r
-;------------------------------------------------------------------------------ \r
-#define CG_SECURITY0 0FFH\r
-#define CG_SECURITY1 0FFH\r
-#define CG_SECURITY2 0FFH\r
-#define CG_SECURITY3 0FFH\r
-#define CG_SECURITY4 0FFH\r
-#define CG_SECURITY5 0FFH\r
-#define CG_SECURITY6 0FFH\r
-#define CG_SECURITY7 0FFH\r
-#define CG_SECURITY8 0FFH\r
-#define CG_SECURITY9 0FFH\r
-\r
-; Option Byte definitions\r
-;------------------------------------------------------------------------------\r
-#define CG_OPTION7A 0x00\r
-#define CG_OPTION7B 0x04\r
-#define OPT7C 0x00\r
-#define OPT7D 0x00\r
-#define OPT7E 0x00\r
-#define OPT7F 0x00\r
-\r
-; Tick ISR Prototype\r
-;------------------------------------------------------------------------------\r
- PUBWEAK `??MD_INTTM0EQ0??INTVEC 608`\r
- PUBLIC MD_INTTM0EQ0\r
-\r
-MD_INTTM0EQ0 SYMBOL "MD_INTTM0EQ0"\r
-`??MD_INTTM0EQ0??INTVEC 608` SYMBOL "??INTVEC 608", MD_INTTM0EQ0\r
-\r
-;------------------------------------------------------------------------------\r
-; portSAVE_CONTEXT MACRO\r
-; Saves the context of the remaining general purpose registers\r
-; and the usCriticalNesting Value of the active Task onto the task stack\r
-; saves stack pointer to the TCB\r
-;------------------------------------------------------------------------------\r
-portSAVE_CONTEXT MACRO \r
-#if configDATA_MODE == 1 ; Using the Tiny data model\r
- prepare {r20,r21,r22,r23,r24,r25,r26,r27,r28,r29,r30},76,sp ; save general purpose registers\r
- sst.w r19,72[ep]\r
- sst.w r18,68[ep]\r
- sst.w r17,64[ep]\r
- sst.w r16,60[ep]\r
- sst.w r15,56[ep]\r
- sst.w r14,52[ep]\r
- sst.w r13,48[ep]\r
- sst.w r12,44[ep]\r
- sst.w r11,40[ep]\r
- sst.w r10,36[ep]\r
- sst.w r9,32[ep]\r
- sst.w r8,28[ep]\r
- sst.w r7,24[ep]\r
- sst.w r6,20[ep]\r
- sst.w r5,16[ep]\r
- sst.w r4,12[ep]\r
-#else ; Using the Small/Large data model\r
- prepare {r20,r21,r22,r23,r24,r26,r27,r28,r29,r30},72,sp ; save general purpose registers\r
- sst.w r19,68[ep]\r
- sst.w r18,64[ep]\r
- sst.w r17,60[ep]\r
- sst.w r16,56[ep]\r
- sst.w r15,52[ep]\r
- sst.w r14,48[ep]\r
- sst.w r13,44[ep]\r
- sst.w r12,40[ep]\r
- sst.w r11,36[ep]\r
- sst.w r10,32[ep]\r
- sst.w r9,28[ep]\r
- sst.w r8,24[ep]\r
- sst.w r7,20[ep]\r
- sst.w r6,16[ep]\r
- sst.w r5,12[ep]\r
-#endif /* configDATA_MODE */\r
- sst.w r2,8[ep]\r
- sst.w r1,4[ep]\r
- MOVHI hi1(usCriticalNesting),r0,r1 ; save usCriticalNesting value to stack \r
- ld.w lw1(usCriticalNesting)[r1],r2\r
- sst.w r2,0[ep]\r
- MOVHI hi1(pxCurrentTCB),r0,r1 ; save SP to top of current TCB\r
- ld.w lw1(pxCurrentTCB)[r1],r2\r
- st.w sp,0[r2]\r
- ENDM\r
-;------------------------------------------------------------------------------\r
-\r
-;------------------------------------------------------------------------------\r
-; portRESTORE_CONTEXT MACRO\r
-; Gets stack pointer from the current TCB\r
-; Restores the context of the usCriticalNesting value and general purpose\r
-; registers of the selected task from the task stack \r
-;------------------------------------------------------------------------------\r
-portRESTORE_CONTEXT MACRO\r
- MOVHI hi1(pxCurrentTCB),r0,r1 ; get Stackpointer address\r
- ld.w lw1(pxCurrentTCB)[r1],sp\r
- MOV sp,r1\r
- ld.w 0[r1],sp ; load stackpointer\r
- MOV sp,ep ; set stack pointer to element pointer\r
- sld.w 0[ep],r1 ; load usCriticalNesting value from stack\r
- MOVHI hi1(usCriticalNesting),r0,r2\r
- st.w r1,lw1(usCriticalNesting)[r2]\r
- sld.w 4[ep],r1 ; restore general purpose registers\r
- sld.w 8[ep],r2 \r
-#if configDATA_MODE == 1 ; Using Tiny data model\r
- sld.w 12[ep],r4\r
- sld.w 16[ep],r5\r
- sld.w 20[ep],r6\r
- sld.w 24[ep],r7\r
- sld.w 28[ep],r8\r
- sld.w 32[ep],r9\r
- sld.w 36[ep],r10\r
- sld.w 40[ep],r11\r
- sld.w 44[ep],r12\r
- sld.w 48[ep],r13\r
- sld.w 52[ep],r14\r
- sld.w 56[ep],r15\r
- sld.w 60[ep],r16\r
- sld.w 64[ep],r17\r
- sld.w 68[ep],r18\r
- sld.w 72[ep],r19\r
- dispose 76,{r20,r21,r22,r23,r24,r25,r26,r27,r28,r29,r30}\r
-#else ; Using Small/Large data model\r
- sld.w 12[ep],r5\r
- sld.w 16[ep],r6\r
- sld.w 20[ep],r7\r
- sld.w 24[ep],r8\r
- sld.w 28[ep],r9\r
- sld.w 32[ep],r10\r
- sld.w 36[ep],r11\r
- sld.w 40[ep],r12\r
- sld.w 44[ep],r13\r
- sld.w 48[ep],r14\r
- sld.w 52[ep],r15\r
- sld.w 56[ep],r16\r
- sld.w 60[ep],r17\r
- sld.w 64[ep],r18\r
- sld.w 68[ep],r19\r
- dispose 72,{r20,r21,r22,r23,r24,r26,r27,r28,r29,r30}\r
-#endif /* configDATA_MODE */ \r
- ENDM\r
-;------------------------------------------------------------------------------\r
-\r
-;------------------------------------------------------------------------------\r
-; Restore the context of the first task that is going to run.\r
-;\r
-; Input: NONE\r
-;\r
-; Call: CALL vPortStart\r
-;\r
-; Output: NONE\r
-;------------------------------------------------------------------------------ \r
- RSEG CODE:CODE\r
-vPortStart:\r
- portRESTORE_CONTEXT ; Restore the context of whichever task the ...\r
- ld.w 0[sp],lp \r
- ldsr lp,5 ; restore PSW\r
- DI\r
- ld.w 4[sp],lp ; restore LP\r
- ld.w 8[sp],lp ; restore LP\r
- ADD 0x0C,sp ; set SP to right position\r
- EI\r
- jmp [lp]\r
-;------------------------------------------------------------------------------ \r
-\r
-;------------------------------------------------------------------------------\r
-; Port Yield function to check for a Task switch in the cooperative and \r
-; preemptive mode\r
-;\r
-; Input: NONE\r
-;\r
-; Call: CALL vPortYield\r
-;\r
-; Output: NONE\r
-;------------------------------------------------------------------------------\r
- RSEG CODE:CODE\r
-vPortYield:\r
- DI\r
- ADD -0x0C,sp ; prepare stack to save necessary values\r
- st.w lp,8[sp] ; save LP to stack\r
- st.w lp,4[sp] ; save LP to stack\r
- stsr 5,lp\r
- st.w lp,0[sp] ; save PSW to stack\r
- portSAVE_CONTEXT ; Save the context of the current task.\r
- jarl vTaskSwitchContext,lp ; Call the scheduler.\r
- portRESTORE_CONTEXT ; Restore the context of whichever task the ...\r
- ld.w 0[sp],lp ; restore EIPSW\r
- ldsr lp,1\r
- ld.w 4[sp],lp ; restore PIPC\r
- ldsr lp,0\r
- ld.w 8[sp],lp ; restore LP\r
- add 0x0C,sp \r
- RETI\r
-;------------------------------------------------------------------------------\r
-\r
-;------------------------------------------------------------------------------\r
-; Perform the necessary steps of the Tick Count Increment and Task Switch\r
-; depending on the chosen kernel configuration \r
-;\r
-; Input: NONE\r
-;\r
-; Call: ISR \r
-;\r
-; Output: NONE\r
-;------------------------------------------------------------------------------ \r
-#if configUSE_PREEMPTION == 1 ; use preemptive kernel mode\r
-\r
-MD_INTTM0EQ0:\r
- \r
- add -0x0C,sp ; prepare stack to save necessary values\r
- st.w lp,8[sp] ; store LP to stack\r
- stsr 0,r31\r
- st.w lp,4[sp] ; store EIPC to stack\r
- stsr 1,lp\r
- st.w lp,0[sp] ; store EIPSW to stack\r
- portSAVE_CONTEXT ; Save the context of the current task.\r
- jarl vTaskIncrementTick,lp ; Call the timer tick function.\r
- jarl vTaskSwitchContext,lp ; Call the scheduler.\r
- portRESTORE_CONTEXT ; Restore the context of whichever task the ...\r
- ; ... scheduler decided should run.\r
- ld.w 0[sp],lp ; restore EIPSW from stack\r
- ldsr lp,1\r
- ld.w 4[sp],lp ; restore EIPC from stack\r
- ldsr lp,0\r
- ld.w 8[sp],lp ; restore LP from stack\r
- add 0x0C,sp ; set SP to right position\r
-\r
- RETI \r
-;------------------------------------------------------------------------------ \r
-#else ; use cooperative kernel mode\r
-\r
-MD_INTTM0EQ0:\r
- prepare {lp,ep},8,sp\r
- sst.w r1,4[ep]\r
- sst.w r5,0[ep]\r
- jarl vTaskIncrementTick,lp ; Call the timer tick function.\r
- sld.w 0[ep],r5\r
- sld.w 4[ep],r1\r
- dispose 8,{lp,ep}\r
- RETI \r
-#endif /* configUSE_PREEMPTION */\r
-\r
-;------------------------------------------------------------------------------\r
- COMMON INTVEC:CODE:ROOT(2)\r
- ORG 608\r
-`??MD_INTTM0EQ0??INTVEC 608`:\r
- JR MD_INTTM0EQ0\r
-\r
- RSEG NEAR_ID:CONST:SORT:NOROOT(2)\r
-`?<Initializer for usCriticalNesting>`:\r
- DW 10\r
- \r
-;------------------------------------------------------------------------------ \r
-; set microcontroller security ID\r
-\r
- COMMON INTVEC:CODE:ROOT(2)\r
- ORG 70H\r
-`SECUID`:\r
- DB CG_SECURITY0\r
- DB CG_SECURITY1\r
- DB CG_SECURITY2\r
- DB CG_SECURITY3\r
- DB CG_SECURITY4\r
- DB CG_SECURITY5\r
- DB CG_SECURITY6\r
- DB CG_SECURITY7\r
- DB CG_SECURITY8\r
- DB CG_SECURITY9\r
-\r
-;------------------------------------------------------------------------------ \r
-; set microcontroller option bytes\r
-\r
- COMMON INTVEC:CODE:ROOT(2)\r
- ORG 7AH\r
-`OPTBYTES`:\r
- DB CG_OPTION7A\r
- DB CG_OPTION7B\r
- DB OPT7C\r
- DB OPT7D\r
- DB OPT7E\r
- DB OPT7F\r
- \r
- END
\ No newline at end of file