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

📄 cpu_core.lst

📁 stm32+ucos-ii
💻 LST
📖 第 1 页 / 共 5 页
字号:
    733          *
    734          * Argument(s) : none.
    735          *
    736          * Return(s)   : Current maximum interrupts disabled time (in CPU timestamp timer counts).
    737          *
    738          *               See also 'cpu_core.h  FUNCTION PROTOTYPES  CPU_TS_TmrRd()      Note #2c'
    739          *                      & 'cpu_core.h  FUNCTION PROTOTYPES  CPU_TSxx_to_uSec()  Note #2'.
    740          *
    741          * Caller(s)   : CPU_IntDisMeasMaxCurReset(),
    742          *               Application.
    743          *
    744          *               This function is a CPU module application interface (API) function & MAY be called
    745          *               by application function(s).
    746          *
    747          * Note(s)     : (1) After initialization, 'CPU_IntDisMeasMaxCur_cnts' MUST ALWAYS be accessed
    748          *                   exclusively with interrupts disabled -- but NOT with critical sections.
    749          *********************************************************************************************************
    750          */
    751          
    752          #ifdef  CPU_CFG_INT_DIS_MEAS_EN
    753          CPU_TS_TMR  CPU_IntDisMeasMaxCurGet (void)
    754          {
    755              CPU_TS_TMR  time_tot_cnts;
    756              CPU_TS_TMR  time_max_cnts;
    757              CPU_SR_ALLOC();
    758          
    759          
    760              CPU_INT_DIS();
    761              time_tot_cnts = CPU_IntDisMeasMaxCur_cnts;
    762              CPU_INT_EN();
    763              time_max_cnts = CPU_IntDisMeasMaxCalc(time_tot_cnts);
    764          
    765              return (time_max_cnts);
    766          }
    767          #endif
    768          
    769          
    770          /*$PAGE*/
    771          /*
    772          *********************************************************************************************************
    773          *                                       CPU_IntDisMeasMaxGet()
    774          *
    775          * Description : Get (non-resetable) maximum interrupts disabled time.
    776          *
    777          * Argument(s) : none.
    778          *
    779          * Return(s)   : (Non-resetable) maximum interrupts disabled time (in CPU timestamp timer counts).
    780          *
    781          *               See also 'cpu_core.h  FUNCTION PROTOTYPES  CPU_TS_TmrRd()      Note #2c'
    782          *                      & 'cpu_core.h  FUNCTION PROTOTYPES  CPU_TSxx_to_uSec()  Note #2'.
    783          *
    784          * Caller(s)   : CPU_IntDisMeasInit(),
    785          *               Application.
    786          *
    787          *               This function is a CPU module application interface (API) function & MAY be called
    788          *               by application function(s).
    789          *
    790          * Note(s)     : (1) After initialization, 'CPU_IntDisMeasMax_cnts' MUST ALWAYS be accessed
    791          *                   exclusively with interrupts disabled -- but NOT with critical sections.
    792          *********************************************************************************************************
    793          */
    794          
    795          #ifdef  CPU_CFG_INT_DIS_MEAS_EN
    796          CPU_TS_TMR  CPU_IntDisMeasMaxGet (void)
    797          {
    798              CPU_TS_TMR  time_tot_cnts;
    799              CPU_TS_TMR  time_max_cnts;
    800              CPU_SR_ALLOC();
    801          
    802          
    803              CPU_INT_DIS();
    804              time_tot_cnts = CPU_IntDisMeasMax_cnts;
    805              CPU_INT_EN();
    806              time_max_cnts = CPU_IntDisMeasMaxCalc(time_tot_cnts);
    807          
    808              return (time_max_cnts);
    809          }
    810          #endif
    811          
    812          
    813          /*$PAGE*/
    814          /*
    815          *********************************************************************************************************
    816          *                                        CPU_IntDisMeasStart()
    817          *
    818          * Description : Start interrupts disabled time measurement.
    819          *
    820          * Argument(s) : none.
    821          *
    822          * Return(s)   : none.
    823          *
    824          * Caller(s)   : CPU_CRITICAL_ENTER().
    825          *
    826          *               This function is an INTERNAL CPU module function & MUST NOT be called by application
    827          *               function(s).
    828          *
    829          * Note(s)     : none.
    830          *********************************************************************************************************
    831          */
    832          
    833          #ifdef  CPU_CFG_INT_DIS_MEAS_EN
    834          void  CPU_IntDisMeasStart (void)
    835          {
    836              CPU_IntDisMeasCtr++;
    837              if (CPU_IntDisNestCtr == 0u) {                                  /* If ints NOT yet dis'd, ...                       */
    838                  CPU_IntDisMeasStart_cnts = CPU_TS_TmrRd();                  /* ... get ints dis'd start time.                   */
    839              }
    840              CPU_IntDisNestCtr++;
    841          }
    842          #endif
    843          
    844          
    845          /*$PAGE*/
    846          /*
    847          *********************************************************************************************************
    848          *                                        CPU_IntDisMeasStop()
    849          *
    850          * Description : Stop interrupts disabled time measurement.
    851          *
    852          * Argument(s) : none.
    853          *
    854          * Return(s)   : none.
    855          *
    856          * Caller(s)   : CPU_CRITICAL_EXIT().
    857          *
    858          *               This function is an INTERNAL CPU module function & MUST NOT be called by application
    859          *               function(s).
    860          *
    861          * Note(s)     : (1) (a) The total amount of time interrupts are disabled by system &/or application code
    862          *                       during critical sections is calculated by the following equations :
    863          *
    864          *                       (1) When interrupts disabled time measurements are disabled :
    865          *
    866          *
    867          *                               |   CRITICAL  |                           |   CRITICAL  |
    868          *                               |<- SECTION ->|                           |<- SECTION ->|
    869          *                               |    ENTER    |                           |    EXIT     |
    870          *
    871          *                            Disable                                    Enable
    872          *                           Interrupts                                Interrupts
    873          *
    874          *                               ||           ||                           ||           ||
    875          *                               ||           ||                           ||           ||
    876          *                               ||       |   ||<------------------------->||       |   ||
    877          *                               ||       |<->||             |             ||<----->|   ||
    878          *                               ||       | | ||             |             ||   |   |   ||
    879          *                                        | |                |                  |   |
    880          *                                   interrupts            time                 interrupts
    881          *                                    disabled                 interrupts       |enabled
    882          *                                          |                   disabled        |
    883          *                                          |              (via application)    |
    884          *                                       time                                 time
    885          *                                           interrupts                           interrupts
    886          *                                         disabled ovrhd                        enabled ovrhd
    887          *
    888          *
    889          *                           (A) time            =  [ time            -  time           ]  -  time
    890          *                                   interrupts     [     interrupts         interrupts ]         total
    891          *                                    disabled      [      enabled            disabled  ]         ovrhd
    892          *                               (via application)
    893          *
    894          *
    895          *                           (B) time       =  time              +  time
    896          *                                   total         interrupts           interrupts
    897          *                                   ovrhd        enabled ovrhd       disabled ovrhd
    898          *
    899          *
    900          *                                   where
    901          *
    902          *                                           time                    time interrupts are disabled between
    903          *                                               interrupts              first critical section enter &
    904          *                                                disabled               last  critical section exit (i.e.
    905          *                                           (via application)           minus total overhead time)
    906          *
    907          *                                           time                    time when interrupts are disabled
    908          *                                               interrupts
    909          *                                                disabled
    910          *
    911          *                                           time                    time when interrupts are  enabled
    912          *                                               interrupts
    913          *                                                enabled
    914          *
    915          *
    916          *                                           time                    total overhead time to disable/enable
    917          *                                               total                   interrupts during critical section
    918          *                                               ovrhd                   enter & exit
    919          *
    920          *                                           time                    total overhead time to disable interrupts
    921          *                                               interrupts              during critical section enter
    922          *                                             disabled ovrhd
    923          *
    924          *                                           time                    total overhead time to enable  interrupts
    925          *                                               interrupts              during critical section exit
    926          *                                              enabled ovrhd
    927          *
    928          *$PAGE*
    929          *
    930          *                       (2) When interrupts disabled time measurements are enabled :
    931          *
    932          *
    933          *        |                                    |                           |                                       |
    934          *        |<----- CRITICAL SECTION ENTER ----->|                           |<------- CRITICAL SECTION EXIT ------->|
    935          *        |                                    |                           |                                       |
    936          *
    937          *                   Time                                                 Time
    938          *     Disable    Measurement                                          Measurement                  Enable
    939          *    Interrupts     Start                                                Stop                    Interrupts
    940          *
    941          *        ||           |                      ||                           ||                         |           ||
    942          *        ||           |                      ||                           ||                         |           ||
    943          *        ||           |        |             ||<------------------------->||               |         |           ||
    944          *        ||       |   |        |<----------->||             |             ||<------------->|         |       |   ||
    945          *        ||       |   |        |      |      ||             |             ||       |       |         |       |   ||
    946          *                 |            |      |                     |                      |       |                 |
    947          *            interrupts       get     |                   time                     |      get            interrupts
    948          *             disabled    start time  |                       interrupts           |   stop time          enabled
    949          *                            meas     |                        disabled         

⌨️ 快捷键说明

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