📄 os_cpu_c.s
字号:
subi R20,1
sbci R21,0
movw R4,R22
mov R4,R5
clr R5
movw R30,R2
std z+0,R4
.dbline 118
; *stk = (INT8U)(tmp);
movw R30,R20
std z+0,R22
.dbline 119
; return ((void *)stk);
movw R16,R30
.dbline -2
L3:
xcall pop_gset3
.dbline 0 ; func end
ret
.dbsym r stks 10 pc
.dbsym r tmp 22 i
.dbsym r stk 20 pc
.dbsym l opt 8 i
.dbsym l ptos 6 pc
.dbsym r pdata 18 pV
.dbsym r task 16 pfV
.dbend
.dbfunc e OSTaskCreateHook _OSTaskCreateHook fV
.dbstruct 0 10 .2
.dbfield 0 OSFlagNodeNext pV
.dbfield 2 OSFlagNodePrev pV
.dbfield 4 OSFlagNodeTCB pV
.dbfield 6 OSFlagNodeFlagGrp pV
.dbfield 8 OSFlagNodeFlags c
.dbfield 9 OSFlagNodeWaitType c
.dbend
.dbstruct 0 18 os_tcb
.dbfield 0 OSTCBStkPtr pc
.dbfield 2 OSTCBNext pS[os_tcb]
.dbfield 4 OSTCBPrev pS[os_tcb]
.dbfield 6 OSTCBFlagNode pS[.2]
.dbfield 8 OSTCBFlagsRdy c
.dbfield 9 OSTCBDly i
.dbfield 11 OSTCBStat c
.dbfield 12 OSTCBPrio c
.dbfield 13 OSTCBX c
.dbfield 14 OSTCBY c
.dbfield 15 OSTCBBitX c
.dbfield 16 OSTCBBitY c
.dbfield 17 OSTCBDelReq c
.dbend
; ptcb -> R16,R17
.even
_OSTaskCreateHook::
.dbline -1
.dbline 136
; }
;
; #if OS_CPU_HOOKS_EN
; /*
; ********************************************************************************
; * TASK CREATION HOOK
; *
; * Description: This function is called when a task is created.
; *
; * Arguments:
; * ptcb is a pointer to the task control block of the task being created.
; *
; * Note(s): 1) Interrupts are disabled during this call.
; ********************************************************************************
; */
; void OSTaskCreateHook (OS_TCB *ptcb)
; {
.dbline 137
; ptcb = ptcb; // Prevent compiler warning
.dbline -2
L4:
.dbline 0 ; func end
ret
.dbsym r ptcb 16 pS[os_tcb]
.dbend
.dbfunc e OSTaskDelHook _OSTaskDelHook fV
; ptcb -> R16,R17
.even
_OSTaskDelHook::
.dbline -1
.dbline 154
; }
;
;
; /*
; ********************************************************************************
; * TASK DELETION HOOK
; *
; * Description: This function is called when a task is deleted.
; *
; * Arguments:
; * ptcb is a pointer to the task control block of the task being deleted.
; *
; * Note(s): 1) Interrupts are disabled during this call.
; ********************************************************************************
; */
; void OSTaskDelHook (OS_TCB *ptcb)
; {
.dbline 155
; ptcb = ptcb; // Prevent compiler warning
.dbline -2
L5:
.dbline 0 ; func end
ret
.dbsym r ptcb 16 pS[os_tcb]
.dbend
.dbfunc e OSTaskSwHook _OSTaskSwHook fV
.even
_OSTaskSwHook::
.dbline -1
.dbline 177
; }
;
; /*
; ********************************************************************************
; * TASK SWITCH HOOK
; *
; * Description:
; * This function is called when a task switch is performed. This allows you to
; * perform other operations during a context switch.
; *
; * Arguments: none
; *
; * Note(s):
; * 1) Interrupts are disabled during this call.
; * 2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB
; * of the task that will be 'switched in' (i.e. the highest priority task)
; * and, 'OSTCBCur' points to the task being switched out (i.e. the
; * preempted task).
; ********************************************************************************
; */
; void OSTaskSwHook (void)
; {
.dbline -2
L6:
.dbline 0 ; func end
ret
.dbend
.dbfunc e OSTaskStatHook _OSTaskStatHook fV
.even
_OSTaskStatHook::
.dbline -1
.dbline 192
; }
;
; /*
; ********************************************************************************
; * STATISTIC TASK HOOK
; *
; * Description:
; * This function is called every second by uC/OS-II's statistics task. This
; * allows your application to add functionality to the statistics task.
; *
; * Arguments: none
; ********************************************************************************
; */
; void OSTaskStatHook (void)
; {
.dbline -2
L7:
.dbline 0 ; func end
ret
.dbend
.dbfunc e OSTimeTickHook _OSTimeTickHook fV
.even
_OSTimeTickHook::
.dbline -1
.dbline 207
; }
;
; /*
; ********************************************************************************
; * TICK HOOK
; *
; * Description: This function is called every tick.
; *
; * Arguments : none
; *
; * Note(s) : 1) Interrupts may or may not be ENABLED during this call.
; ********************************************************************************
; */
; void OSTimeTickHook (void)
; {
.dbline -2
L8:
.dbline 0 ; func end
ret
.dbend
.dbfunc e port_init _port_init fV
.even
_port_init::
.dbline -1
.dbline 231
; }
;
; /*
; ********************************************************************************
; * IDLE HOOK
; *
; * Description: 将cpu置于低功耗模式,而当接收到中断时,CPU就会退出低功耗模式
; *
; * Arguments : none
; *
; * Note(s) : 1) Interrupts may or may not be ENABLED during this call.
; ********************************************************************************
; */
;
; #endif
; //ICC-AVR application builder : 2007-10-25 15:04:28
; // Target : M16
; // Crystal: 4.0000Mhz
;
; #include <iom128v.h>
; #include <macros.h>
;
; void port_init(void)
; {
.dbline 232
; PORTA = 0x00;
clr R2
out 0x1b,R2
.dbline 233
; DDRA = 0x00;
out 0x1a,R2
.dbline 234
; PORTB = 0x00;
out 0x18,R2
.dbline 235
; DDRB = 0x00;
out 0x17,R2
.dbline 236
; PORTC = 0x00; //m103 output only
out 0x15,R2
.dbline 237
; DDRC = 0x00;
out 0x14,R2
.dbline 238
; PORTD = 0x00;
out 0x12,R2
.dbline 239
; DDRD = 0x00;
out 0x11,R2
.dbline -2
L9:
.dbline 0 ; func end
ret
.dbend
.dbfunc e uart0_init _uart0_init fV
.even
_uart0_init::
.dbline -1
.dbline 248
; }
;
; //UART0 initialize
; // desired baud rate: 4800
; // actual: baud rate:4808 (0.2%)
; // char size: 8 bits
; // parity: Disabled
; void uart0_init(void)
; {
.dbline 249
; UCSR0B = 0x00; //disable while setting baud rate
clr R2
out 0xa,R2
.dbline 250
; UCSR0A = 0x00;
out 0xb,R2
.dbline 251
; UCSR0C = 0x06;
ldi R24,6
sts 149,R24
.dbline 252
; UBRR0L = 0x33;
ldi R24,51
out 0x9,R24
.dbline 253
; UBRR0H = 0x00;
sts 144,R2
.dbline 254
; UCSR0B = 0x18;
ldi R24,24
out 0xa,R24
.dbline -2
L10:
.dbline 0 ; func end
ret
.dbend
.dbfunc e TC2_Init _TC2_Init fV
.even
_TC2_Init::
.dbline -1
.dbline 261
; }
;
; //*****************************************************************************
; // TickISR
; //*****************************************************************************
; // Init Timer/Counter2 fuer Takterzeugung
; void TC2_Init (void){
.dbline 265
; /* Only uses TIMER2 overflow for tick interrupt. Timer compare
; * can also be used.
; */
; TIMSK &= ~(BIT(TOIE2)/* | BIT(OCIE2) */); //disable TC2 interrupts
in R24,0x37
andi R24,191
out 0x37,R24
.dbline 266
; TCCR2 = 0x05; // interner Takt, /1024
ldi R24,5
out 0x25,R24
.dbline 267
; TCNT2 = 256-39; // Counter ruecksetzen, 10ms @ 4MHz
ldi R24,217
out 0x24,R24
.dbline 272
; // OCR2 = 180; // OutputCompareRegister
; // TIMSK |= BIT(TOIE2); // enable OVF-interrupt
;
;
; MCUCR = 0x00;
clr R2
out 0x35,R2
.dbline 274
; // GICR = 0x00;
; TIMSK = 0x40; //timer interrupt sources //TIMSK |= OCIE2; // enable COMP-interrupt
ldi R24,64
out 0x37,R24
.dbline 276
;
; SEI(); // enable global interrupt
sei
.dbline -2
L11:
.dbline 0 ; func end
ret
.dbend
.area vector(rom, abs)
.org 40
jmp _OSTickISR
.area text(rom, con, rel)
.dbfile E:\study\ucos_ii\ucos2_iccavr\iccavr\ucos2_with_cpu\os_cpu_c.c
.dbfunc e OSTaskIdleHook _OSTaskIdleHook fV
.even
_OSTaskIdleHook::
.dbline -1
.dbline 306
; }
;
; //*****************************************************************************
; // Interrupt Timer/Counter0 Overflow
; // OVF_Takt: 4MHz / 1024 / 39 = 10ms
; #pragma interrupt_handler OSTickISR:11
;
; // Funktion siehe OS_CPU_A.S
; /*
; void OSTickISR (void){ //overflow interrupt vector
;
;
; }
; //*/
;
; /*
; *********************************************************************************************************
; * IDLE TASK HOOK
; *
; * Description: This function is called by the idle task. This hook has been added to allow you to do
; * such things as STOP the CPU to conserve power.
; *
; * Arguments : none
; *
; * Note(s) : 1) Interrupts are enabled during this call.
; *********************************************************************************************************
; */
; #if OS_CPU_HOOKS_EN > 0 && OS_VERSION >= 251
; void OSTaskIdleHook(void)
; {
.dbline -2
L12:
.dbline 0 ; func end
ret
.dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -