⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_cpu_c.lis

📁 ucos如何移植到单片机mega128
💻 LIS
📖 第 1 页 / 共 3 页
字号:
 01D2           ; *     1) Interrupts are disabled during this call.
 01D2           ; *     2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB
 01D2           ; *             of the task that will be 'switched in' (i.e. the highest priority task)
 01D2           ; *             and, 'OSTCBCur' points to the task being switched out (i.e. the 
 01D2           ; *             preempted task).
 01D2           ; ********************************************************************************
 01D2           ; */
 01D2           ; void OSTaskSwHook (void)
 01D2           ; {
 01D2                   .dbline -2
 01D2           L6:
 01D2                   .dbline 0 ; func end
 01D2 0895              ret
 01D4                   .dbend
 01D4                   .dbfunc e OSTaskStatHook _OSTaskStatHook fV
                        .even
 01D4           _OSTaskStatHook::
 01D4                   .dbline -1
 01D4                   .dbline 192
 01D4           ; }
 01D4           ; 
 01D4           ; /*
 01D4           ; ********************************************************************************
 01D4           ; *                       STATISTIC TASK HOOK
 01D4           ; *
 01D4           ; * Description:
 01D4           ; *     This function is called every second by uC/OS-II's statistics task.  This 
 01D4           ; *     allows your application to add functionality to the statistics task.
 01D4           ; *
 01D4           ; * Arguments:  none
 01D4           ; ********************************************************************************
 01D4           ; */
 01D4           ; void OSTaskStatHook (void)
 01D4           ; {
 01D4                   .dbline -2
 01D4           L7:
 01D4                   .dbline 0 ; func end
 01D4 0895              ret
 01D6                   .dbend
 01D6                   .dbfunc e OSTimeTickHook _OSTimeTickHook fV
                        .even
 01D6           _OSTimeTickHook::
 01D6                   .dbline -1
 01D6                   .dbline 207
 01D6           ; }
 01D6           ; 
 01D6           ; /*
 01D6           ; ********************************************************************************
 01D6           ; *                 TICK HOOK
 01D6           ; *
 01D6           ; * Description: This function is called every tick.
 01D6           ; *
 01D6           ; * Arguments  : none
 01D6           ; *
 01D6           ; * Note(s)    : 1) Interrupts may or may not be ENABLED during this call.
 01D6           ; ********************************************************************************
 01D6           ; */
 01D6           ; void OSTimeTickHook (void)
 01D6           ; {
 01D6                   .dbline -2
 01D6           L8:
 01D6                   .dbline 0 ; func end
 01D6 0895              ret
 01D8                   .dbend
 01D8                   .dbfunc e port_init _port_init fV
                        .even
 01D8           _port_init::
 01D8                   .dbline -1
 01D8                   .dbline 231
 01D8           ; }
 01D8           ; 
 01D8           ; /*
 01D8           ; ********************************************************************************
 01D8           ; *                 IDLE HOOK
 01D8           ; *
 01D8           ; * Description: 将cpu置于低功耗模式,而当接收到中断时,CPU就会退出低功耗模式
 01D8           ; *
 01D8           ; * Arguments  : none
 01D8           ; *
 01D8           ; * Note(s)    : 1) Interrupts may or may not be ENABLED during this call.
 01D8           ; ********************************************************************************
 01D8           ; */
 01D8           ; 
 01D8           ; #endif
 01D8           ; //ICC-AVR application builder : 2007-10-25 15:04:28
 01D8           ; // Target : M16
 01D8           ; // Crystal: 4.0000Mhz
 01D8           ; 
 01D8           ; #include <iom128v.h>
 01D8           ; #include <macros.h>
 01D8           ; 
 01D8           ; void port_init(void)
 01D8           ; {
 01D8                   .dbline 232
 01D8           ;  PORTA = 0x00;
 01D8 2224              clr R2
 01DA 2BBA              out 0x1b,R2
 01DC                   .dbline 233
 01DC           ;  DDRA  = 0x00;
 01DC 2ABA              out 0x1a,R2
 01DE                   .dbline 234
 01DE           ;  PORTB = 0x00;
 01DE 28BA              out 0x18,R2
 01E0                   .dbline 235
 01E0           ;  DDRB  = 0x00;
 01E0 27BA              out 0x17,R2
 01E2                   .dbline 236
 01E2           ;  PORTC = 0x00; //m103 output only
 01E2 25BA              out 0x15,R2
 01E4                   .dbline 237
 01E4           ;  DDRC  = 0x00;
 01E4 24BA              out 0x14,R2
 01E6                   .dbline 238
 01E6           ;  PORTD = 0x00;
 01E6 22BA              out 0x12,R2
 01E8                   .dbline 239
 01E8           ;  DDRD  = 0x00;
 01E8 21BA              out 0x11,R2
 01EA                   .dbline -2
 01EA           L9:
 01EA                   .dbline 0 ; func end
 01EA 0895              ret
 01EC                   .dbend
 01EC                   .dbfunc e uart0_init _uart0_init fV
                        .even
 01EC           _uart0_init::
 01EC                   .dbline -1
 01EC                   .dbline 248
 01EC           ; }
 01EC           ; 
 01EC           ; //UART0 initialize
 01EC           ; // desired baud rate: 4800
 01EC           ; // actual: baud rate:4808 (0.2%)
 01EC           ; // char size: 8 bits
 01EC           ; // parity: Disabled
 01EC           ; void uart0_init(void)
 01EC           ; {
 01EC                   .dbline 249
 01EC           ;       UCSR0B = 0x00; //disable while setting baud rate
 01EC 2224              clr R2
 01EE 2AB8              out 0xa,R2
 01F0                   .dbline 250
 01F0           ;       UCSR0A = 0x00;
 01F0 2BB8              out 0xb,R2
 01F2                   .dbline 251
 01F2           ;       UCSR0C = 0x06;
 01F2 86E0              ldi R24,6
 01F4 80939500          sts 149,R24
 01F8                   .dbline 252
 01F8           ;       UBRR0L = 0x33;
 01F8 83E3              ldi R24,51
 01FA 89B9              out 0x9,R24
 01FC                   .dbline 253
 01FC           ;       UBRR0H = 0x00;
 01FC 20929000          sts 144,R2
 0200                   .dbline 254
 0200           ;       UCSR0B = 0x18;
 0200 88E1              ldi R24,24
 0202 8AB9              out 0xa,R24
 0204                   .dbline -2
 0204           L10:
 0204                   .dbline 0 ; func end
 0204 0895              ret
 0206                   .dbend
 0206                   .dbfunc e TC2_Init _TC2_Init fV
                        .even
 0206           _TC2_Init::
 0206                   .dbline -1
 0206                   .dbline 261
 0206           ; }
 0206           ; 
 0206           ; //*****************************************************************************
 0206           ; //                    TickISR
 0206           ; //*****************************************************************************
 0206           ; // Init Timer/Counter2 fuer Takterzeugung
 0206           ; void TC2_Init (void){ 
 0206                   .dbline 265
 0206           ;       /* Only uses TIMER2 overflow for tick interrupt. Timer compare
 0206           ;      * can also be used.
 0206           ;      */
 0206           ;       TIMSK &= ~(BIT(TOIE2)/* | BIT(OCIE2) */);       //disable TC2 interrupts
 0206 87B7              in R24,0x37
 0208 8F7B              andi R24,191
 020A 87BF              out 0x37,R24
 020C                   .dbline 266
 020C           ;       TCCR2 = 0x05;           // interner Takt, /1024
 020C 85E0              ldi R24,5
 020E 85BD              out 0x25,R24
 0210                   .dbline 267
 0210           ;       TCNT2 = 256-39;         // Counter ruecksetzen, 10ms @ 4MHz
 0210 89ED              ldi R24,217
 0212 84BD              out 0x24,R24
 0214                   .dbline 272
 0214           ;       // OCR2 = 180;                  // OutputCompareRegister
 0214           ; //    TIMSK |= BIT(TOIE2);    // enable OVF-interrupt
 0214           ; 
 0214           ;  
 0214           ;  MCUCR = 0x00;
 0214 2224              clr R2
 0216 25BE              out 0x35,R2
 0218                   .dbline 274
 0218           ; // GICR  = 0x00;
 0218           ;  TIMSK = 0x40; //timer interrupt sources                                                                                                                                //TIMSK |= OCIE2;             // enable COMP-interrupt
 0218 80E4              ldi R24,64
 021A 87BF              out 0x37,R24
 021C                   .dbline 276
 021C           ;       
 021C           ;     SEI();    // enable global interrupt     
 021C 7894              sei
 021E                   .dbline -2
 021E           L11:
 021E                   .dbline 0 ; func end
 021E 0895              ret
 0220                   .dbend
                        .area vector(rom, abs)
                        .org 40
 0028 0C940000          jmp _OSTickISR
                        .area text(rom, con, rel)
 0220                   .dbfile E:\study\ucos_ii\ucos2_iccavr\iccavr\ucos2_with_cpu\os_cpu_c.c
 0220                   .dbfunc e OSTaskIdleHook _OSTaskIdleHook fV
                        .even
 0220           _OSTaskIdleHook::
 0220                   .dbline -1
 0220                   .dbline 306
 0220           ; }
 0220           ; 
 0220           ; //*****************************************************************************
 0220           ; // Interrupt Timer/Counter0 Overflow
 0220           ; // OVF_Takt:  4MHz / 1024 / 39 = 10ms
 0220           ; #pragma interrupt_handler OSTickISR:11
 0220           ; 
 0220           ;       // Funktion siehe OS_CPU_A.S
 0220           ; /*
 0220           ; void OSTickISR (void){                //overflow interrupt vector
 0220           ; 
 0220           ; 
 0220           ; }
 0220           ; //*/
 0220           ; 
 0220           ; /*
 0220           ; *********************************************************************************************************
 0220           ; *                                                                               IDLE TASK HOOK
 0220           ; *
 0220           ; * Description: This function is called by the idle task.  This hook has been added to allow you to do  
 0220           ; *                such things as STOP the CPU to conserve power.
 0220           ; *
 0220           ; * Arguments  : none
 0220           ; *
 0220           ; * Note(s)    : 1) Interrupts are enabled during this call.
 0220           ; *********************************************************************************************************
 0220           ; */
 0220           ; #if OS_CPU_HOOKS_EN > 0 && OS_VERSION >= 251
 0220           ; void OSTaskIdleHook(void)
 0220           ; {
 0220                   .dbline -2
 0220           L12:
 0220                   .dbline 0 ; func end
 0220 0895              ret
 0222                   .dbend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -