标题:
uC/OS-II???±??×÷???????????????¨??????????????°?·?·¨??????
[打印本页]
作者:
zing
时间:
2005-9-16 16:26
标题:
uC/OS-II???±??×÷???????????????¨??????????????°?·?·¨??????
×÷?????????ó?§?? ????????????????×?
????
---???±??×÷?????????????????ò????????????????????·??????§???·±????¨????????????±??????¤????????·???
??C/OS-II???????ù?????????????±?à???????????????????????????????????¨????????????????????????C/OS-II?????÷??????????????????±????????????¤??
????C/OS-II??·????÷?????????é????????±?????????????·?????±í??????????????????·??????????????????????????ù?????????ò??·??¤????????°?±???????????·?×????ù???è????????????
±????ò????TMS320C6711 DSP??????????????????·???????C/OS-II??????????·????¨??????????????°?·?·¨??????????C/OS-II???????ù±????è
?????¨?????????¨????·??¤?????ó????????C/OS-II???????¤×÷????°??è??×????????????????è??
?? ?????????ù??????????????
?? ·????ù??????C??????·??¤????????
?? ±à???????ú??
?? ??????????????
?? ????????????·????¨??·?×°·???????
?¨?à??80x86°?±???PC.C??PC.H??
????????
?????????ù????????????????MCU??DSP??MPU????????C/OS-II???????±???ù?è????×????????????à?ü????
?×???????????????????í?ú????????????????±?????????·?±????°????????×???????????????????·????í?????ò??????????????????????·?????
?????????è??×??????????????÷???????ú?????????????????·???????????????¤·??ò???????ú????????????????
??±???????????????TMS320C6711 DSP??????TI????6000?????????????????????????????±??????·???????????????????????×??¨VLIW???á?????àRISC?????????à???÷???????????ù???????????à?±???ó?????¨???è±??????????í?????????÷??·???????×???·?????????
??C6711??????????3???à??????????????????±??????¨NMI????????±??????¨INT4-INT15????????±???????CSR?????÷????????????????????????IER?????÷·?±???????????????C6711?????????í?????ú?????ù????C/OS-II???????????è??±à??????ר??????????????
??????C6711??????ר????????·??????????ú?????????????ù???à?????????????ú???ù?è±à???ê???????????????àRISC??????C6711???????á??????????A0-A15??B0-B15????×é32bit???¨???????÷??
C??????·??¤??
?????ù??????????????????????C??????·??¤????????C/OS-II??±???????????
×??ò????????????????·??¤???????á???é????±?????C?????÷???????à??·?±?±à?????à??×???????·??§??????????±à?????????ó???ù????·??§???°interrupt?±·?±ê×????ü×??ù?÷??????????????·??§????±à?ú????±í(list)????????????
?????????ù???????????á????????????·????????à±?????TI??C??????·??¤??CCS for C6000??°ü?????????ù????????
???????ù????????????????????????·??¤????????????????????±????????ó???????????¤×÷??
?×????????C±à???÷???°??±à?ú????±í(list)?±?????????ù±à???÷???á??????C???????????ú????????????±à?ú????????
??CCS??·??·??????·?·¨???????????°/Project/Build options?±???°Feedback?±?????????°Interlisting??Opt/C and ASM(-s)?±???ò???????????±????CCS??C±à???ü???????????°-s?±??????
???ó·?±?±à???????ò????????????±à????±???C???ú????±à???ú??????±à?ú??????????
void FUNC_TEMP (void)
{
Func_tmp2(); //?÷????????????
}
??CCS??±à???ó?ú????ASM?ú??????
.asg B15, SP // ?ê?¨??
_FUNC_TEMP:
STW B3,*SP--(8) // ????
NOP 2
CALL _ Func_tmp2 //-----------
MVKL BACK, B3 // ?????÷??
MVKH BACK, B3 //-----------
NOP 3
BACK: LDW *++SP(8),B3 // ????
NOP 4
RET B3 // ????·???
NOP 5
????????????CCS±à???÷?????ò????B15?????÷±???×÷???????????????¨??????????????????×÷??????????????±?????8×???????????±???
??????B3?????÷±?????±????????÷???±??·??????·???????????????°?è??????±??¤???±??????·????°????????
?±????CCS??C±à???÷?????????¨???????÷???????¨????????????????C/OS-II??????????????????????????×???????
×??ó????±à?????????°interrupt?±???ü×??ù?÷????????
interrupt void ISR_TEMP (void)
{
int a;
a=0;
}
?ú????ASM?ú??????
_ISR_TEMP:
STW B4,*SP--(8) // ????
NOP 2
ZERO B4 //---------
STW B4,*+SP(4) // a=0
NOP 2 //----------
B IRP // ????·???
LDW *++SP(8),B4 // ????
NOP 4
???°?????ú???à±?????????????????±à????????????????
?? ??????·??????·????????B3?????÷???à?????????è??B3???????¨IRP?????÷??×???±???????·??ú?±?????ò???·??
?? ±à???÷?á×????????????????ù???????????÷????????????????????????????????±??¤???????????????ò??????????????B4?????÷??
±à???????ú??
????????????????????????·??¤?????ù??????????±à???????ú?????¤×÷???à??±????ò??????
??C/OS-II×??í???ú?????ó??·???????ANSI C±à???????????ú?????????á????·????????????¨?à?????????ú????????????OS_CPU_A.ASM??OS_CPU_C.C???°OS_CPU.H???????????±????
?????????±?ò???á???°?????????è???????????????????ù±???°??????????????±??×÷??????C/OS-II?·???é???à??????????????×???????????
??????????????????????·??¤?????§???ò±???????????????????°????á?????????í·?·¨???????????è????±?×???????C6711????????????
?? ??????????????±????????ê?¨??????
#define OS_ENTER_CRITICAL() Disable_int()
#define OS_EXIT_CRITICAL() Enable_int()
Disable_int??Enable_int??????±à????±à??????????????????????????????×????????÷(CSR)??????????????CSR????????????????????GIE????????????????PGIE??????????±??????°??GIE×?????
?ò????Disable_int??????GIE????????PGIE?????ó????GIE??0????±???????????Enable_int???ò??PGIE????????????GIE???????????????°???????è????
???ù????????±??????????????ê????????±?????????????×????????????????????????????ò????±?????±???×÷????????·?·¨??????
?? ????????????
?°????????C6711???????í?????ú?????ù?????????????è??????±à????×???±à??????????_OSCtxSw????????????
#define OS_TASK_SW() OSCtxSw()
??C6711???è??????±??¤???????÷°ü?¨A0-A15??B0-B15??CSR??IER??IRP??AMR?????????????±?°?????ò???·?????????????????è??????±?????
_OSCtxSw?????????è????·??ú?????????????ù???????????????????????ó????±??¤????????TCB?????????????????????????????????ê????????????
?è????±?×???????????????OS_TASK_SW??×÷???????÷???????ù?????°???ù?????÷???±???±?°???ò???·??±?????B3?????÷???????????????????????¤???±??·??????·??
?? ??????±à????
???°???ù???????????°interrupt?±???ü×??ù?÷??????CCS??±à???±???á×??????????????????????????÷??????????±??¤??
?????????á?????÷??????·??ú?±???????????????÷???à????????????C/OS-II???á?????????í?ó?????ò????C/OS-II???ó????·??ú?±????????×÷??????·??ú?????????±?ê?????ù?????????á????
?ò???????????±???ù????C/OS-II??????·??±?????????±?????°interrupt?±???ü×??????????????á??±à????????????
void OSTickISR (void)
{
DSP_C6x_Save(); // ·?????????????
OSIntEnter();
if (OSIntNesting == 1) // v2.51°?±???????
{
OSTCBCur->OSTCBStkPtr
=(OS_STK*) DSP_C6x_GetCurrentSP(); // ·???????
} // ?????±?°SP????
// ???í???????× ?ò????????????
OSTimeTick();
OSIntExit();
DSP_C6x_Resume(); // ·?????????????
}
DSP_C6x_Save??DSP_C6x_Resume??????·?????????·?±??ê??????????????????×÷???ü????OS_TASK_SW????????±???????????·??ú?±???±?°???ò???·??×???±?????IRP?????÷??????????×÷??????·??????·??????????B3????????DSP_C6x_Resume?????????????á·????????????????ù???????????ó???ü???±????×?????????·??ú?°?????ò???·??????????????
??????????????
??±à???ê???ù?????????ú?????ó????????±à???????ò???????????ò?????????????ó????????·????????è?????????à??×???±????ê?????????????à×÷×???????
·?×°·???????
×??ó???????è???ù?ù?????×±???????????????±????????ú?????ò?à???×???¤????????????????
??C/OS-II????×÷???????¨?é?????ú??·??·????????????????±?????×??????ù?????ú??????°??????·???á????????
uCOS-II
???¤SOURCE // ???¨?????ú??
?? OS_CORE.C
?? ......
???¤TI_C6711 // ????????
???¤CCS // ??·??¤??
?? OS_CPU.H
?? OS_CPU_A.ASM
?? OS_CPU_C.C
??
???¤ DSP_C6x_Service // ·???????
?? DSP_C6x_ Service.H
?? DSP_C6x_ Service.ASM
??
???¤ TEST // ????????·??????ú??
OS_CFG.H
INCLUDES.H
TEST.C ......
??????DSP_C6x_Service????·??????????à??????×÷???á????80x86°?±?????PC.C??PC.H????????±???????×?????·????????ò°ü?¨???????á?°???????à???????????°??????????????DSP_C6x_SystemInit()???±????????????DSP_C6x_TimerInit()????
??????????·??????ú?????ò????·?±????°/TI_C6711?±?·???????¨×????????????????????????????°TEST?±???????????è????×???C/OS-II?????ú????·?????????
????????????±?????±?????±à???í?ó????±?????·??????????¤??
欢迎光临 我要委托设计网论坛 (http://51odm.com/fourms/)
Powered by Discuz! 5.5.0