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

📄 cpu_core.lst

📁 stm32+ucos-ii
💻 LST
📖 第 1 页 / 共 5 页
字号:
    336          *
    337          * Description : Set CPU host name.
    338          *
    339          * Argument(s) : p_name      Pointer to CPU host name to set.
    340          *
    341          *               p_err       Pointer to variable that will receive the return error code from this function :
    342          *
    343          *                               CPU_ERR_NONE                    CPU host name successfully set.
    344          *                               CPU_ERR_NULL_PTR                Argument 'p_name' passed a NULL pointer.
    345          *                               CPU_ERR_NAME_SIZE               Invalid CPU host name size (see Note #1).
    346          *
    347          * Return(s)   : none.
    348          *
    349          * Caller(s)   : Application.
    350          *
    351          *               This function is a CPU module application interface (API) function & MAY be called by
    352          *               application function(s).
    353          *
    354          * Note(s)     : (1) 'p_name' ASCII string size, including the terminating NULL character, MUST be less
    355          *                    than or equal to CPU_CFG_NAME_SIZE.
    356          *********************************************************************************************************
    357          */
    358          
    359          #if (CPU_CFG_NAME_EN == DEF_ENABLED)

   \                                 In section .text, align 2, keep-with-next
    360          void  CPU_NameSet (CPU_CHAR  *p_name,
    361                             CPU_ERR   *p_err)
    362          {
   \                     CPU_NameSet:
   \   00000000   2DE9F041           PUSH     {R4-R8,LR}
   \   00000004   0400               MOVS     R4,R0
   \   00000006   0D00               MOVS     R5,R1
    363              CPU_SIZE_T  len;
    364              CPU_SR_ALLOC();
   \   00000008   0027               MOVS     R7,#+0
    365          
    366          
    367              if (p_err == (CPU_ERR *)0) {
   \   0000000A   002D               CMP      R5,#+0
   \   0000000C   01D1               BNE.N    ??CPU_NameSet_0
    368                  CPU_SW_EXCEPTION(;);
   \   0000000E   ........           BL       CPU_SW_Exception
    369              }
    370          
    371              if (p_name == (CPU_CHAR *)0) {
   \                     ??CPU_NameSet_0:
   \   00000012   002C               CMP      R4,#+0
   \   00000014   02D1               BNE.N    ??CPU_NameSet_1
    372                 *p_err = CPU_ERR_NULL_PTR;
   \   00000016   0A20               MOVS     R0,#+10
   \   00000018   2880               STRH     R0,[R5, #+0]
    373                  return;
   \   0000001A   18E0               B.N      ??CPU_NameSet_2
    374              }
    375          
    376              len = Str_Len_N((CPU_CHAR *)p_name,
    377                              (CPU_SIZE_T)CPU_CFG_NAME_SIZE);
   \                     ??CPU_NameSet_1:
   \   0000001C   1021               MOVS     R1,#+16
   \   0000001E   2000               MOVS     R0,R4
   \   00000020   ........           BL       Str_Len_N
   \   00000024   0600               MOVS     R6,R0
    378              if (len < CPU_CFG_NAME_SIZE) {                              /* If       cfg name len < max name size, ...           */
   \   00000026   102E               CMP      R6,#+16
   \   00000028   0ED2               BCS.N    ??CPU_NameSet_3
    379                  CPU_CRITICAL_ENTER();
   \   0000002A   ........           BL       CPU_SR_Save
   \   0000002E   0700               MOVS     R7,R0
    380                 (void)Str_Copy_N((CPU_CHAR *)&CPU_Name[0],               /* ... copy cfg name to CPU host name.                  */
    381                                  (CPU_CHAR *) p_name,
    382                                  (CPU_SIZE_T) CPU_CFG_NAME_SIZE);
   \   00000030   1022               MOVS     R2,#+16
   \   00000032   2100               MOVS     R1,R4
   \   00000034   ....               LDR.N    R0,??DataTable2
   \   00000036   ........           BL       Str_Copy_N
   \   0000003A   8046               MOV      R8,R0
    383                  CPU_CRITICAL_EXIT();
   \   0000003C   3800               MOVS     R0,R7
   \   0000003E   ........           BL       CPU_SR_Restore
    384                 *p_err = CPU_ERR_NONE;
   \   00000042   0020               MOVS     R0,#+0
   \   00000044   2880               STRH     R0,[R5, #+0]
   \   00000046   02E0               B.N      ??CPU_NameSet_4
    385          
    386              } else {
    387                 *p_err = CPU_ERR_NAME_SIZE;
   \                     ??CPU_NameSet_3:
   \   00000048   4FF47A70           MOV      R0,#+1000
   \   0000004C   2880               STRH     R0,[R5, #+0]
    388              }
    389          }
   \                     ??CPU_NameSet_4:
   \                     ??CPU_NameSet_2:
   \   0000004E   BDE8F081           POP      {R4-R8,PC}       ;; return
    390          #endif
    391          
    392          
    393          /*$PAGE*/
    394          /*
    395          *********************************************************************************************************
    396          *                                           CPU_TS_Get32()
    397          *
    398          * Description : Get current 32-bit CPU timestamp.
    399          *
    400          * Argument(s) : none.
    401          *
    402          * Return(s)   : Current 32-bit CPU timestamp (in timestamp timer counts).
    403          *
    404          * Caller(s)   : Application.
    405          *
    406          *               This function is a CPU module application interface (API) function & MAY be called by
    407          *               application function(s).
    408          *
    409          * Note(s)     : (1) When applicable, the amount of time measured by CPU timestamps is calculated by
    410          *                   either of the following equations :
    411          *
    412          *                       (a) Time measured  =  Number timer counts  *  Timer period
    413          *
    414          *                               where
    415          *
    416          *                                   Number timer counts     Number of timer counts measured
    417          *                                   Timer period            Timer's period in some units of
    418          *                                                               (fractional) seconds
    419          *                                   Time measured           Amount of time measured, in same
    420          *                                                               units of (fractional) seconds
    421          *                                                               as the Timer period
    422          *
    423          *                                              Number timer counts
    424          *                       (b) Time measured  =  ---------------------
    425          *                                                Timer frequency
    426          *
    427          *                               where
    428          *
    429          *                                   Number timer counts     Number of timer counts measured
    430          *                                   Timer frequency         Timer's frequency in some units
    431          *                                                               of counts per second
    432          *                                   Time measured           Amount of time measured, in seconds
    433          *
    434          *                   See also 'cpu_core.h  FUNCTION PROTOTYPES  CPU_TS_TmrRd()  Note #2c1'.
    435          *
    436          *               (2) In case the CPU timestamp timer has lower precision than the 32-bit CPU timestamp;
    437          *                   its precision is extended via periodic updates by accumulating the deltas of the
    438          *                   timestamp timer count values into the higher-precision 32-bit CPU timestamp.
    439          *
    440          *               (3) After initialization, 'CPU_TS_32_Accum' & 'CPU_TS_32_TmrPrev' MUST ALWAYS
    441          *                   be accessed AND updated exclusively with interrupts disabled -- but NOT
    442          *                   with critical sections.
    443          *********************************************************************************************************
    444          */
    445          
    446          #if (CPU_CFG_TS_32_EN == DEF_ENABLED)
    447          CPU_TS32  CPU_TS_Get32 (void)
    448          {
    449              CPU_TS32    ts;
    450          #if (CPU_CFG_TS_TMR_SIZE <  CPU_WORD_SIZE_32)
    451              CPU_TS_TMR  tmr_cur;
    452              CPU_TS_TMR  tmr_delta;
    453              CPU_SR_ALLOC();
    454          #endif
    455          
    456          
    457          #if (CPU_CFG_TS_TMR_SIZE >= CPU_WORD_SIZE_32)
    458              ts = (CPU_TS32)CPU_TS_TmrRd();                                  /* Get cur ts tmr val (in 32-bit ts cnts).          */
    459          
    460          #else
    461              CPU_INT_DIS();
    462              tmr_cur            = (CPU_TS_TMR) CPU_TS_TmrRd();               /* Get cur ts tmr val (in ts tmr cnts).             */
    463              tmr_delta          = (CPU_TS_TMR)(tmr_cur - CPU_TS_32_TmrPrev); /* Calc      delta ts tmr cnts.                     */
    464              CPU_TS_32_Accum   += (CPU_TS32  ) tmr_delta;                    /* Inc ts by delta ts tmr cnts (see Note #2).       */
    465              CPU_TS_32_TmrPrev  = (CPU_TS_TMR) tmr_cur;                      /* Save cur ts tmr cnts for next update.            */
    466              ts                 = (CPU_TS32  ) CPU_TS_32_Accum;
    467              CPU_INT_EN();
    468          #endif
    469          
    470              return (ts);
    471          }
    472          #endif
    473          
    474          
    475          /*$PAGE*/
    476          /*
    477          *********************************************************************************************************
    478          *                                           CPU_TS_Get64()
    479          *
    480          * Description : Get current 64-bit CPU timestamp.
    481          *
    482          * Argument(s) : none.
    483          *
    484          * Return(s)   : Current 64-bit CPU timestamp (in timestamp timer counts).
    485          *
    486          * Caller(s)   : Application.
    487          *
    488          *               This function is a CPU module application interface (API) function & MAY be called by
    489          *               application function(s).
    490          *
    491          * Note(s)     : (1) When applicable, the amount of time measured by CPU timestamps is calculated by
    492          *                   either of the following equations :
    493          *
    494          *                       (a) Time measured  =  Number timer counts  *  Timer period
    495          *
    496          *                               where
    497          *
    498          *                                   Number timer counts     Number of timer counts measured
    499          *                                   Timer period            Timer's period in some units of
    500          *                                                               (fractional) seconds
    501          *                                   Time measured           Amount of time measured, in same
    502          *                                                               units of (fractional) seconds
    503          *                                                               as the Timer period
    504          *
    505          *                                              Number timer counts
    506          *                       (b) Time measured  =  ---------------------
    507          *                                                Timer frequency
    508          *
    509          *                               where
    510          *
    511          *                                   Number timer counts     Number of timer counts measured
    512          *                                   Timer frequency         Timer's frequency in some units
    513          *                                                               of counts per second

⌨️ 快捷键说明

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