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

📄 os_cpu_c.lst

📁 ucos-II 在英飞凌xc164的移植
💻 LST
📖 第 1 页 / 共 2 页
字号:
C166 COMPILER V6.04, OS_CPU_C                                                              09/04/2006 10:03:40 PAGE 1   


C166 COMPILER V6.04, COMPILATION OF MODULE OS_CPU_C
NO OBJECT MODULE REQUESTED
COMPILER INVOKED BY: C:\Keil\C166\BIN\C166.EXE OS_CPU_C.C MODV2 LARGE OPTIMIZE(8,SPEED) BROWSE MODV2 MODV2 DEBUG CODE SR
                    -C(.\OS_CPU_C.SRC) 

 stmt lvl     source

    1         /*---------------------------------------------------------------------------
    2         //
    3         //  FILE          : $Workfile: Os_cpu_c.c $
    4         //
    5         //  ORIGINATOR    : Martin Rodier
    6         //  CREATION DATE : March, 7 2002
    7         //      REVISION      : 1.10
    8         //  PURPOSE       : This uC/OS-II port is intended for Infineon Technologies and ST10R167
    9         //                  C16x Extended Architecture Micro Controller Targets (C167CR-LM)
   10         //  PART OF       : uC/OS-II version 2.00
   11         //  COMPILE WITH  : KEIL C166/ST10 V4.20 Ansi C Compiler
   12         //
   13         //---------------------------------------------------------------------------
   14         //                               uC/OS-II
   15         //                         The Real-Time Kernel
   16         //                        Infineon  C16x/C167CR
   17         //                   Extended Architecture Specific Code
   18         //                          HLARGE MEMORY MODEL
   19         //---------------------------------------------------------------------------
   20         //
   21         // Revision history:
   22         //
   23         // $Log: /.../UCOS-II/C167/Os_cpu_c.c $
   24          * 
   25          * 5     3/07/02 3:49p Mrodier
   26          * Revised Version of the port that include a copy of the interrupting
   27          * task PSW to fix the problem of the multiplication when the interrupted
   28          * task had a multiplication in progress and the interrupting task do not
   29          * return to it.
   30          * 
   31          * Addition into OSTaskBuildStk of the PSW at position -2E of the task
   32          * stack to let the interrupting task memorize the state of PSW into the
   33          * task stack.
   34          *
   35          * 4     6/13/01 10:42a Mrodier
   36          * Revised to final version as relased in uCOSII port
   37         //
   38         //-------------------------------------------------------------------------
   39         */
   40         
   41         
   42         
   43         #define  OS_CPU_GLOBALS
   44         #include "includes.h"
   45         #include <intrins.h>
   46         
   47         
   48         #pragma SRC
   49         /*
   50         *********************************************************************************************************
   51         *                                        INITIALISE A TASK'S STACK
   52         *
   53         * Description: This function is called by either OSTaskCreate() or OSTaskCreateExt() to initialise the
   54         *              stack frame of the task being created.  This function is highly processor specific.
C166 COMPILER V6.04, OS_CPU_C                                                              09/04/2006 10:03:40 PAGE 2   

   55         *
   56         * Arguments  : task          is a pointer to the task code
   57         *
   58         *              pdata         is a pointer to a user supplied data area that will be passed to the task
   59         *                            when the task first executes.
   60         *
   61         *              ptos          is a pointer to the top of stack.  It is assumed that 'ptos' points to
   62         *                            a 'free' entry on the task stack.  If OS_STK_GROWTH is set to 1 then
   63         *                            'ptos' will contain the HIGHEST valid address of the stack.  Similarly, if
   64         *                            OS_STK_GROWTH is set to 0, the 'ptos' will contains the LOWEST valid address
   65         *                            of the stack.
   66         *
   67         *              opt           specifies options that can be used to alter the behavior of OSTaskStkInit().
   68         *
   69         *                                                TASK STACK AREA                              (High Memory
             -)
   70         *                                           +14  TASK DATA PARAMETER SEGMENT pointer of task
   71         *                                           +12  TASK DATA PARAMETER OFFSET pointer of task
   72         *                                           +10  SEGMENT of task code address
   73         *                                           +0E  OFFSET  of task code address
   74         *                                           +0C  SP of System stack of task
   75         *                                           +0A  USER STACK OFFSET POINTER (R0) of task
   76         *                                           +08  USER STACK PAGE POINTER (DPP2) of task
   77         *                                           +06  PSW of task
   78         *                                           +04  OFFSET  of task return address (IP)
   79         *                                           +02  SEGMENT of task return address (CSP)
   80         *                                             0                                               (Low Memory)
   81         *
   82         * Returns    : Always returns the location of the new top-of-stack' once the processor registers have
   83         *              been placed on the stack in the proper order.
   84         *
   85         * Note(s)    : Interrupts are enabled when your task starts executing. You can change this by setting the
   86         *              PSW to 0x0800 instead.  In this case, interrupts would be disabled upon task startup.  The
   87         *              application code would be responsible for enabling interrupts at the beginning of the task
   88         *              code.  You will need to modify OSTaskIdle() and OSTaskStat() so that they enable
   89         *              interrupts.  Failure to do this will make your system crash!
   90         *
   91         *********************************************************************************************************
   92         */
   93         OS_STK *OSTaskStkInit (void (*task)(void *pd), void *pdata, OS_STK *ptos, INT16U opt)
   94         {
   95  1          INT16U  *stk;
   96  1          INT32U   usr;
   97  1          INT16U   page;
   98  1          INT16U   offset;
   99  1          INT16U   data_seg;
  100  1          INT16U   data_sof;
  101  1      
  102  1          opt      = opt;                                          /* 'opt' is not used, prevent warning     */
  103  1          data_seg = (INT16U)((INT32U)pdata >> 16);
  104  1          data_sof = ((INT16U) pdata & 0xFFFF);
  105  1          stk      = (INT16U *)ptos;                               /* Load stack pointer                     */
  106  1      
  107  1          *stk--   = data_seg;                                     /* TASK DATA PARAMETER SEGMENT pointer of tas
             -k   */
  108  1          *stk--   = data_sof;                                     /* TASK DATA PARAMETER OFFSET pointer of task
             - */
  109  1          *stk--   = (INT16U)((INT32U)task >> 16);                 /* Task segment start address             */
  110  1          *stk--   = ((INT16U)task & 0xFFFF);                      /* Task offset start address              */
  111  1          *stk--   = (INT16U)0xFC00;                               /* Task SP of System stack of task        */
  112  1      
  113  1          usr      = (INT32U)stk;                                  /* Keep a copy of STACK OFFSET POINTER locati
C166 COMPILER V6.04, OS_CPU_C                                                              09/04/2006 10:03:40 PAGE 3   

             -on */
  114  1      
  115  1          offset   = (INT16U)((((usr) & 0x3FFF) - 0x0A) | 0x4000); /* First adress of stack offset pointer of th
             -e task */
  116  1          *stk--   = offset;                                       /* Task user stack offset R0              */
  117  1      
  118  1          page     = (INT16U)(usr >> 0x000E);                      /* Task user stack page   DPP2            */
  119  1          *stk--   = page;                                         /* Task user stack page   DPP2            */
  120  1      
  121  1          *stk--   = (INT16U)0x0800;                               /* Task PSW = Interrupt enabled           */
  122  1          *stk--   = ((INT16U)task & 0xFFFF);                      /* Task offset return address             */
  123  1          *stk--   = (INT16U)((INT32U)task >> 16);                 /* Task segment return address            */
  124  1      
  125  1          OSTaskBuildStk(page, offset, data_seg, data_sof);
  126  1      
  127  1          return ((OS_STK *)stk);
  128  1      }
  129         
  130         
  131         /*$PAGE*/
  132         #if OS_CPU_HOOKS_EN
  133         /*
  134         *********************************************************************************************************
  135         *                                          TASK CREATION HOOK
  136         *
  137         * Description: This function is called when a task is created.
  138         *
  139         * Arguments  : ptcb   is a pointer to the task control block of the task being created.
  140         *
  141         * Note(s)    : 1) Interrupts are disabled during this call.
  142         *********************************************************************************************************
  143         */
  144         void OSTaskCreateHook (OS_TCB *ptcb)
  145         {
  146  1          ptcb = ptcb;                       /* Prevent compiler warning                                     */
  147  1      }
  148         
  149         
  150         /*
  151         *********************************************************************************************************
  152         *                                           TASK DELETION HOOK
  153         *
  154         * Description: This function is called when a task is deleted.
  155         *
  156         * Arguments  : ptcb   is a pointer to the task control block of the task being deleted.
  157         *
  158         * Note(s)    : 1) Interrupts are disabled during this call.
  159         *********************************************************************************************************
  160         */
  161         void OSTaskDelHook (OS_TCB *ptcb)
  162         {
  163  1          ptcb = ptcb;                       /* Prevent compiler warning                                     */
  164  1      }
  165         
  166         /*
  167         *********************************************************************************************************
  168         *                                           TASK SWITCH HOOK
  169         *
  170         * Description: This function is called when a task switch is performed.  This allows you to perform other
  171         *              operations during a context switch.
  172         *
  173         * Arguments  : none
C166 COMPILER V6.04, OS_CPU_C                                                              09/04/2006 10:03:40 PAGE 4   

  174         *
  175         * Note(s)    : 1) Interrupts are disabled during this call.
  176         *              2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
  177         *                 will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the
  178         *                 task being switched out (i.e. the preempted task).
  179         *********************************************************************************************************
  180         */
  181         void OSTaskSwHook (void)
  182         {
  183  1      }
  184         
  185         /*
  186         *********************************************************************************************************
  187         *                                           STATISTIC TASK HOOK
  188         *
  189         * Description: This function is called every second by uC/OS-II's statistics task.  This allows your
  190         *              application to add functionality to the statistics task.
  191         *
  192         * Arguments  : none
  193         *********************************************************************************************************
  194         */
  195         void OSTaskStatHook (void)
  196         {
  197  1      }
  198         
  199         /*
  200         *********************************************************************************************************
  201         *                                               TICK HOOK
  202         *
  203         * Description: This function is called every tick.
  204         *
  205         * Arguments  : none
  206         *
  207         * Note(s)    : 1) Interrupts may or may not be ENABLED during this call.
  208         *********************************************************************************************************
  209         */
  210         void OSTimeTickHook (void)
  211         {}
  212         
  213         /*
  214         *********************************************************************************************************
  215         *
  216         *Description :Those function is added by donghegang
  217         *
  218         *Notes       :There are not those function at  the  version before 200.
  219         *
  220         *********************************************************************************************************
  221         */
  222         

⌨️ 快捷键说明

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