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

📄 os_cpu_c.lst

📁 ucos-II 在英飞凌xc164的移植
💻 LST
📖 第 1 页 / 共 2 页
字号:
  223         void OSInitHookBegin(void)
  224         {}
  225         
  226         void OSInitHookEnd(void)
  227         {}
  228         
  229         void OSTaskIdleHook(void)
  230         {}
  231         
  232         void OSTCBInitHook(OS_TCB *ptcb)
  233         {
  234  1       ptcb=ptcb;
  235  1      }
C166 COMPILER V6.04, OS_CPU_C                                                              09/04/2006 10:03:40 PAGE 5   

  236         
  237         
  238         #endif
  239         
  240         /*
  241         *********************************************************************************************************
  242         *                                        BUILD A TASK'S STACK AREA
  243         *
  244         * Description: This function is called by OSTaskStkInit to initialise the
  245         *              stack frame of the task being created.
  246         *
  247         * Arguments  : page          is a pointer to the current task user stack page.
  248         *
  249         *              offset        is a pointer to the current task user stack offset.
  250         *
  251         *              datapag       is a pointer to a user supplied data area page when the task first executes.
  252         *
  253         *              datapof       is a pointer to a user supplied data area offset when the task first executes
             -.
  254         *
  255         *                                                TASK STACK AREA                              (High Memory
             -)
  256         *                                             0
  257         *                                           -02  R[1 ..15] General Purpose registers of task
  258         *                                           -20  CP     Context pointer of task
  259         *                                           -22  DPP3   Data page pointer 3 of task
  260         *                                           -24  DPP2   Data page pointer 1 of task
  261         *                                           -26  DPP0   Data page pointer 0 of task
  262         *                                           -28  MDC    Multiply/Divide Control of task
  263         *                                           -2A  MDH    Multiply/Divide High register of task
  264         *                                           -2C  MDL    Multiply/Divide Low register of task  (Low Memory)
  265         *                                           -2E  PSW    OF the interrupting task to preserve the MULIP fla
             -g
  266         *
  267         * Returns    : None
  268         *********************************************************************************************************
  269         */
  270         void OSTaskBuildStk (INT16U page, INT16U offset, INT16U datapag, INT16U datapof)
  271         {
  272  1          page=page;                              // The compiler assign page to R8
  273  1          offset=offset;                          // The compiler assign offset to R9
  274  1          datapag=datapag;                        // The compiler assign datapag to R10
  275  1          datapof=datapof;                        // The compiler assign datapof to R11
  276  1      
  277  1      #pragma asm
  278  1                                                  ; SAVE USED REGISTERS
  279  1          PUSH   R1
  280  1          PUSH   R2
  281  1          PUSH   R3
  282  1          PUSH   R4
  283  1          PUSH   R10
  284  1          PUSH   R11
  285  1          PUSH   R12
  286  1      
  287  1                                                  ; LOAD INITIAL TASK STACK.
  288  1          MOV    R4,R9                            ; Get pointer to Task Stack
  289  1      
  290  1          MOV    R2,R10                           ; Page pointer to passed parameter
  291  1          MOV    R3,R11                           ; Offset pointer to passed parameter
  292  1      
  293  1                                                  ; ADJUST THE TASK USER OFFSET POINTER
  294  1          EXTP   R8,#1
C166 COMPILER V6.04, OS_CPU_C                                                              09/04/2006 10:03:40 PAGE 6   

  295  1          MOV    R1,[R4+#0x0A]                    ; Get initial user offset pointer
  296  1          SUB    R1,#0x2E                         ; adjust user offset pointer to save task registers
  297  1          EXTP   R8,#1
  298  1          MOV    [R4+#0x0A],R1                     ; Save true user offset pointer
  299  1      
  300  1                                                  ; INITIALISE REGISTER VALUES
  301  1          MOV    R9 ,#0x1111                      ; R1 initialised to 1111
  302  1          MOV    R10,#0x2222                      ; R2 initialised to 2222
  303  1          MOV    R11,#0x3333                      ; R3 initialised to 3333
  304  1          MOV    R12,#0x4444                      ; R4 initialised to 4444
  305  1          EXTP   R8,#4
  306  1          MOV    [-R4],R9
  307  1          MOV    [-R4],R10
  308  1          MOV    [-R4],R11
  309  1          MOV    [-R4],R12
  310  1      
  311  1          MOV    R9, #0x5555                      ; R5 initialised to 5555
  312  1          MOV    R10,#0x6666                      ; R6 initialised to 6666
  313  1          MOV    R11,#0x7777                      ; R7 initialised to 7777
  314  1          MOV    R12,R3                           ; R8 initialised to point @ POF of pdata
  315  1          EXTP   R8,#4
  316  1          MOV    [-R4],R9
  317  1          MOV    [-R4],R10
  318  1          MOV    [-R4],R11
  319  1          MOV    [-R4],R12
  320  1      
  321  1          MOV    R9 ,R2                           ; R9  initialised to point @ PAG of pdata
  322  1          MOV    R10,#0xAAAA                      ; R10 initialised to AAAA
  323  1          MOV    R11,#0xBBBB                      ; R11 initialised to BBBB
  324  1          MOV    R12,#0xCCCC                      ; R12 initialised to CCCC
  325  1          EXTP   R8,#4
  326  1          MOV    [-R4],R9
  327  1          MOV    [-R4],R10
  328  1          MOV    [-R4],R11
  329  1          MOV    [-R4],R12
  330  1      
  331  1          MOV    R9 ,#0xDDDD                      ; R13 initialised to DDDD
  332  1          MOV    R10,#0xEEEE                      ; R14 initialised to EEEE
  333  1          MOV    R11,#0xFFFF                      ; R15 initialised to FFFF
  334  1          MOV    R12,CP                           ; Get the Context Pointer (CP)
  335  1          EXTP   R8,#4
  336  1          MOV    [-R4],R9
  337  1          MOV    [-R4],R10
  338  1          MOV    [-R4],R11
  339  1          MOV    [-R4],R12
  340  1      
  341  1          MOV    R9 ,DPP3                         ; Get Data Page Pointer 3 (DPP3)
  342  1          MOV    R10,DPP2                         ; Get Data Page Pointer 2 (DPP2)
  343  1          MOV    R11,DPP0                         ; Get Data Page Pointer 0 (DPP0)
  344  1          EXTP   R8,#3
  345  1          MOV    [-R4],R9                         ; Put it on the user stack
  346  1          MOV    [-R4],R10                        ; Put it on the user stack
  347  1          MOV    [-R4],R11                        ; Put it on the user stack
  348  1      
  349  1          MOV    R9,#0x00                         ; R10 initialised to 0
  350  1          EXTP   R8,#4
  351  1          MOV    [-R4],R9                         ; Set Multiply/Divide Control (MDC)
  352  1          MOV    [-R4],R9                         ; Set Multiply/Divide High (MDH)
  353  1          MOV    [-R4],R9                         ; Set Multiply/Divide Low (MDL)
  354  1          MOV    [-R4],R9                         ; Set Temporary PSW (Cleared)
  355  1      
  356  1                                                  ; RESTORE USED REGISTERS
C166 COMPILER V6.04, OS_CPU_C                                                              09/04/2006 10:03:40 PAGE 7   

  357  1          POP    R12
  358  1          POP    R11
  359  1          POP    R10
  360  1          POP    R4
  361  1          POP    R3
  362  1          POP    R2
  363  1          POP    R1
  364  1       #pragma endasm
  365  1      }
  366         
  367         /*$PAGE*/
  368         /*
  369         *********************************************************************************************************
  370         *                                       INITIALIZE SYSTEM TICK
  371         *
  372         * Description: This function is called to initialize and configure the system interrupt tick.
  373         *
  374         * Arguments  : none
  375         *********************************************************************************************************
  376         */
  377         void  OSTickISRInit (void)
  378         {
  379  1        
  380  1       
  381  1      
  382  1        ///  -----------------------------------------------------------------------
  383  1        ///  Configuration of Timer Block Prescaler 1:
  384  1        ///  -----------------------------------------------------------------------
  385  1        ///  - prescaler for timer block 1 is 8
  386  1      
  387  1      
  388  1        ///  -----------------------------------------------------------------------
  389  1        ///  Configuration of the GPT1 Core Timer 3:
  390  1        ///  -----------------------------------------------------------------------
  391  1        ///  - timer 3 works in timer mode
  392  1        ///  - external up/down control is disabled
  393  1        ///  - prescaler factor is 8
  394  1        ///  - up/down control bit is reset
  395  1        ///  - alternate output function T3OUT (P3.3) is disabled
  396  1        ///  - timer 3 output toggle latch (T3OTL) is set to 0
  397  1        ///  - timer 3 run bit is reset
  398  1      
  399  1        GPT12E_T3CON   =  0x0000;      // load timer 3 control register
  400  1        GPT12E_T3      =  0x0000;      // load timer 3 register
  401  1      
  402  1        ///  -----------------------------------------------------------------------
  403  1        ///  Configuration of the GPT1 Auxiliary Timer 2:
  404  1        ///  -----------------------------------------------------------------------
  405  1        ///  - timer 2 works in timer mode
  406  1        ///  - external up/down control is disabled
  407  1        ///  - prescaler factor is 16
  408  1        ///  - up/down control bit is reset
  409  1      
  410  1        GPT12E_T2CON   =  0x0001;      // load timer 2 control register
  411  1        GPT12E_T2      =  0x0000;      // load timer 2 register
  412  1      
  413  1        ///  -----------------------------------------------------------------------
  414  1        ///  Configuration of the GPT1 Auxiliary Timer 4:
  415  1        ///  -----------------------------------------------------------------------
  416  1        ///  - timer 4 works in timer mode
  417  1        ///  - external up/down control is disabled
  418  1        ///  - prescaler factor is 8
C166 COMPILER V6.04, OS_CPU_C                                                              09/04/2006 10:03:40 PAGE 8   

  419  1        ///  - up/down control bit is reset
  420  1        ///  - timer 4 run bit is reset
  421  1      
  422  1        GPT12E_T4CON   =  0x0000;      // load timer 4 control register
  423  1        GPT12E_T4      =  0x0000;      // load timer 4 register
  424  1      
  425  1        ///  -----------------------------------------------------------------------
  426  1        ///  Configuration of the used GPT1 Port Pins:
  427  1        ///  -----------------------------------------------------------------------
  428  1      
  429  1      
  430  1        ///  -----------------------------------------------------------------------
  431  1        ///  Configuration of the used GPT1 Interrupts:
  432  1        ///  -----------------------------------------------------------------------
  433  1        ///  timer 2 service request node configuration:
  434  1        ///  - timer 2 interrupt priority level (ILVL) = 13
  435  1        ///  - timer 2 interrupt group level (GLVL) = 1
  436  1        ///  - timer 2 group priority extension (GPX) = 0
  437  1      
  438  1        GPT12E_T2IC    =  0x0075;     
  439  1      
  440  1      
  441  1        // USER CODE BEGIN (GPT1_Function,3)
  442  1      
  443  1        // USER CODE END
  444  1      
  445  1        GPT12E_T2CON_T2R  =  1;        // set timer 2 run bit
  446  1      
  447  1      } //  End of function GPT1_vInit
  448         
  449         
  450                  
  451         

C166 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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