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

📄 lib_mem.lst

📁 编译环境是 iar EWARM ,STM32 下的UCOSII
💻 LST
📖 第 1 页 / 共 5 页
字号:
   \   0000004A   521E               SUBS     R2,R2,#+1
    303              }
   \                     ??Mem_Set_7:
   \   0000004C   FBD1               BNE.N    ??Mem_Set_8
   \                     ??Mem_Set_0:
   \   0000004E   30BD               POP      {R4,R5,PC}       ;; return
    304          }
    305          
    306          
    307          /*$PAGE*/
    308          /*
    309          *********************************************************************************************************
    310          *                                             Mem_Copy()
    311          *
    312          * Description : Copy data octets from one memory buffer to another memory buffer.
    313          *
    314          * Argument(s) : pdest       Pointer to destination memory buffer.
    315          *
    316          *               psrc        Pointer to source      memory buffer.
    317          *
    318          *               size        Number of data buffer octets to copy.
    319          *
    320          * Return(s)   : none.
    321          *
    322          * Caller(s)   : Application.
    323          *
    324          * Note(s)     : (1) Null copies allowed (i.e. 0-octet size).
    325          *
    326          *               (2) Memory buffers NOT checked for overlapping.
    327          *
    328          *               (3) For best CPU performance, optimized to copy data buffer using 'CPU_ALIGN'-sized data
    329          *                   words.
    330          *
    331          *                   (a) Since many word-aligned processors REQUIRE that multi-octet words be accessed on
    332          *                       word-aligned addresses, 'CPU_ALIGN'-sized words MUST be accessed on 'CPU_ALIGN'd
    333          *                       addresses.
    334          *
    335          *               (4) Modulo arithmetic is used to determine whether a memory buffer starts on a 'CPU_ALIGN'
    336          *                   address boundary.
    337          *
    338          *                   Modulo arithmetic in ANSI-C REQUIREs operations performed on integer values.  Thus,
    339          *                   address values MUST be cast to an appropriately-sized integer value PRIOR to any
    340          *                   mem_align_modulo arithmetic operation.
    341          *********************************************************************************************************
    342          */
    343          /*$PAGE*/
    344          #if ((!defined(uC_CFG_OPTIMIZE_ASM_EN)) || \
    345               ((defined(uC_CFG_OPTIMIZE_ASM_EN)) && \
    346                        (uC_CFG_OPTIMIZE_ASM_EN   != DEF_ENABLED)))
    347          void  Mem_Copy (void        *pdest,
    348                          void        *psrc,
    349                          CPU_SIZE_T   size)
    350          {
    351              CPU_SIZE_T    size_rem;
    352              CPU_ALIGN    *pmem_align_dest;
    353              CPU_ALIGN    *pmem_align_src;
    354              CPU_INT08U   *pmem_08_dest;
    355              CPU_INT08U   *pmem_08_src;
    356              CPU_INT08U    i;
    357              CPU_INT08U    mem_align_modulo_dest;
    358              CPU_INT08U    mem_align_modulo_src;
    359              CPU_BOOLEAN   mem_aligned;
    360          
    361          
    362              if (size < 1) {                                             /* See Note #1.                                         */
    363                  return;
    364              }
    365              if (pdest == (void *)0) {
    366                  return;
    367              }
    368              if (psrc  == (void *)0) {
    369                  return;
    370              }
    371          
    372          
    373              size_rem              = (CPU_SIZE_T  )size;
    374          
    375              pmem_08_dest          = (CPU_INT08U *)pdest;
    376              pmem_08_src           = (CPU_INT08U *)psrc;
    377                                                                          /* See Note #4.                                         */
    378              mem_align_modulo_dest = (CPU_INT08U  )((CPU_ADDR)pmem_08_dest % sizeof(CPU_ALIGN));
    379              mem_align_modulo_src  = (CPU_INT08U  )((CPU_ADDR)pmem_08_src  % sizeof(CPU_ALIGN));
    380          
    381              mem_aligned           = (mem_align_modulo_dest == mem_align_modulo_src) ? DEF_YES : DEF_NO;
    382          
    383              if (mem_aligned == DEF_YES) {                               /* If mem bufs' alignment offset equal, ...             */
    384                                                                          /* ... optimize copy for mem buf alignment.             */
    385                  if (mem_align_modulo_dest != 0) {                       /* If leading octets avail,                   ...       */
    386                      i = mem_align_modulo_dest;
    387                      while ((size_rem   >  0) &&                         /* ... start mem buf copy with leading octets ...       */
    388                             (i          <  sizeof(CPU_ALIGN ))) {        /* ... until next CPU_ALIGN word boundary.              */
    389                         *pmem_08_dest++ = *pmem_08_src++;
    390                          size_rem      -=  sizeof(CPU_INT08U);
    391                          i++;
    392                      }
    393                  }
    394          
    395                  pmem_align_dest = (CPU_ALIGN *)pmem_08_dest;            /* See Note #3a.                                        */
    396                  pmem_align_src  = (CPU_ALIGN *)pmem_08_src;
    397                  while (size_rem      >=  sizeof(CPU_ALIGN)) {           /* While mem bufs aligned on CPU_ALIGN word boundaries, */
    398                     *pmem_align_dest++ = *pmem_align_src++;              /* ... copy psrc to pdest with CPU_ALIGN-sized words.   */
    399                      size_rem         -=  sizeof(CPU_ALIGN);
    400                  }
    401          
    402                  pmem_08_dest = (CPU_INT08U *)pmem_align_dest;
    403                  pmem_08_src  = (CPU_INT08U *)pmem_align_src;
    404              }
    405          
    406              while (size_rem > 0) {                                      /* For unaligned mem bufs or trailing octets, ...       */
    407                 *pmem_08_dest++ = *pmem_08_src++;                        /* ... copy psrc to pdest by octets.                    */
    408                  size_rem      -=  sizeof(CPU_INT08U);
    409              }
    410          }
    411          #endif
    412          
    413          
    414          /*$PAGE*/
    415          /*
    416          *********************************************************************************************************
    417          *                                              Mem_Cmp()
    418          *
    419          * Description : Verify that ALL data octets in two memory buffers are identical in sequence.
    420          *
    421          * Argument(s) : p1_mem      Pointer to first  memory buffer.
    422          *
    423          *               p2_mem      Pointer to second memory buffer.
    424          *
    425          *               size        Number of data buffer octets to compare.
    426          *
    427          * Return(s)   : DEF_YES, if 'size' number of data octets are identical in both memory buffers.
    428          *
    429          *               DEF_NO,  otherwise.
    430          *
    431          * Caller(s)   : Application.
    432          *
    433          * Note(s)     : (1) Null compares allowed (i.e. 0-octet size); 'DEF_YES' returned to indicate identical
    434          *                   null compare.
    435          *
    436          *               (2) Many memory buffer comparisons vary ONLY in the least significant octets -- e.g.
    437          *                   network address buffers.  Consequently, memory buffer comparison is more efficient
    438          *                   if the comparison starts from the end of the memory buffers which will abort sooner
    439          *                   on dissimilar memory buffers that vary only in the least significant octets.
    440          *
    441          *               (3) For best CPU performance, optimized to compare data buffers using 'CPU_ALIGN'-sized
    442          *                   data words.
    443          *
    444          *                   (a) Since many word-aligned processors REQUIRE that multi-octet words be accessed on
    445          *                       word-aligned addresses, 'CPU_ALIGN'-sized words MUST be accessed on 'CPU_ALIGN'd
    446          *                       addresses.
    447          *
    448          *               (4) Modulo arithmetic is used to determine whether a memory buffer starts on a 'CPU_ALIGN'
    449          *                   address boundary.
    450          *
    451          *                   Modulo arithmetic in ANSI-C REQUIREs operations performed on integer values.  Thus,
    452          *                   address values MUST be cast to an appropriately-sized integer value PRIOR to any
    453          *                   mem_align_modulo arithmetic operation.
    454          ********************************************************************************************************
    455          */
    456          /*$PAGE*/

   \                                 In segment CODE, align 4, keep-with-next
    457          CPU_BOOLEAN  Mem_Cmp (void        *p1_mem,
    458                                void        *p2_mem,
    459                                CPU_SIZE_T   size)
    460          {
   \                     Mem_Cmp:
   \   00000000   2DE9F041           PUSH     {R4-R8,LR}
   \   00000004   0500               MOVS     R5,R0
   \   00000006   0C00               MOVS     R4,R1
    461              CPU_SIZE_T    size_rem;
    462              CPU_ALIGN    *p1_mem_align;
    463              CPU_ALIGN    *p2_mem_align;
    464              CPU_INT08U   *p1_mem_08;
    465              CPU_INT08U   *p2_mem_08;
    466              CPU_INT08U    i;
    467              CPU_INT08U    mem_align_modulo_1;
    468              CPU_INT08U    mem_align_modulo_2;
    469              CPU_BOOLEAN   mem_aligned;
    470              CPU_BOOLEAN   mem_cmp;
    471          
    472          
    473              if (size < 1) {                                             /* See Note #1.                                         */
   \   00000008   002A               CMP      R2,#+0
   \   0000000A   01D1               BNE.N    ??Mem_Cmp_0
    474                  return (DEF_YES);
   \   0000000C   0120               MOVS     R0,#+1
   \   0000000E   4CE0               B.N      ??Mem_Cmp_1
    475              }
    476              if (p1_mem == (void *)0) {
   \                     ??Mem_Cmp_0:
   \   00000010   002D               CMP      R5,#+0
   \   00000012   01D1               BNE.N    ??Mem_Cmp_2
    477                  return (DEF_NO);
   \                     ??Mem_Cmp_3:
   \   00000014   0020               MOVS     R0,#+0
   \   00000016   48E0               B.N      ??Mem_Cmp_1
    478              }
    479              if (p2_mem == (void *)0) {
   \                     ??Mem_Cmp_2:
   \   00000018   002C               CMP      R4,#+0
   \   0000001A   FBD0               BEQ.N    ??Mem_Cmp_3
    480                  return (DEF_NO);
    481              }
    482          
    483          
    484              mem_cmp            =  DEF_YES;                              /* Assume mem bufs are identical until cmp fails.       */
   \   0000001C   0120               MOVS     R0,#+1
   \   0000001E   8046               MOV      R8,R0
    485              size_rem           =  size;

⌨️ 快捷键说明

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