+ +
+ + +µC/OS is a full-featured embedded operating system originally developed by Micriµm. +It features support for TCP/IP, USB, CAN bus, and Modbus, as well as a robust file system. + +---------- + +.. raw:: HTML + + ++ +
+ + +Founded by a team of former Micrium employees, Weston Embedded Solutions is the official custodian for the µC/™ RTOS software repository to ensure it remains the trusted choice for embedded engineers around the world. + +---------- + +.. raw:: html + + ++ +
+ + +Since its founding in 1999 as a private company, Micriµm™ and its team of engineers have offered world-class embedded software components for the most critical and demanding real-time applications. Recognized as having some of the cleanest code in the industry, with easy-to-understand documentation, the Micrium real-time kernels, and software components have successfully been deployed in thousands of products worldwide across a broad range of industries. Micrium’s µC/OS™ kernel has been certified for use in safety-critical applications and remains a respected favorite in the medical, aerospace, and industrial markets. It continues to be the RTOS of choice for engineers requiring the most reliable and trusted solution for their mission-critical applications. + +---------- + +Product Documentation +*************** +https://micrium.atlassian.net/ + +Technical Support +***************** +https://weston-embedded.com/micrium-support + +Example Projects +********* +https://weston-embedded.com/micrium-examples + +Commercial Licensing Option +********* +https://weston-embedded.com/products/cesium + +Who to Contact +********* +https://weston-embedded.com/company/contact diff --git a/lib_ascii.c b/lib_ascii.c index 902b7ac..a43bd98 100644 --- a/lib_ascii.c +++ b/lib_ascii.c @@ -3,7 +3,7 @@ * uC/LIB * Custom Library Modules * -* Copyright 2004-2020 Silicon Laboratories Inc. www.silabs.com +* Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com * * SPDX-License-Identifier: APACHE-2.0 * @@ -20,7 +20,7 @@ * ASCII CHARACTER OPERATIONS * * Filename : lib_ascii.c -* Version : V1.39.00 +* Version : V1.39.01 ********************************************************************************************************* * Note(s) : (1) NO compiler-supplied standard library functions are used in library or product software. * @@ -641,4 +641,3 @@ CPU_BOOLEAN ASCII_Cmp (CPU_CHAR c1, return (cmp); } - diff --git a/lib_ascii.h b/lib_ascii.h index 5602102..e7bfbe8 100644 --- a/lib_ascii.h +++ b/lib_ascii.h @@ -3,7 +3,7 @@ * uC/LIB * Custom Library Modules * -* Copyright 2004-2020 Silicon Laboratories Inc. www.silabs.com +* Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com * * SPDX-License-Identifier: APACHE-2.0 * @@ -20,7 +20,7 @@ * ASCII CHARACTER OPERATIONS * * Filename : lib_ascii.h -* Version : V1.39.00 +* Version : V1.39.01 ********************************************************************************************************* * Note(s) : (1) NO compiler-supplied standard library functions are used in library or product software. * @@ -830,4 +830,3 @@ CPU_BOOLEAN ASCII_Cmp (CPU_CHAR c1, */ #endif /* End of lib ascii module include. */ - diff --git a/lib_def.h b/lib_def.h index 541395a..090d63f 100644 --- a/lib_def.h +++ b/lib_def.h @@ -3,7 +3,7 @@ * uC/LIB * Custom Library Modules * -* Copyright 2004-2020 Silicon Laboratories Inc. www.silabs.com +* Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com * * SPDX-License-Identifier: APACHE-2.0 * @@ -20,7 +20,7 @@ * CORE CUSTOM LIBRARY MODULE * * Filename : lib_def.h -* Version : V1.39.00 +* Version : V1.39.01 ********************************************************************************************************* * Note(s) : (1) Assumes the following versions (or more recent) of software modules are included in * the project build : @@ -85,7 +85,7 @@ ********************************************************************************************************* */ -#define LIB_VERSION 13900u /* See Note #1. */ +#define LIB_VERSION 13901u /* See Note #1. */ /* @@ -478,8 +478,9 @@ typedef enum lib_err { LIB_MEM_ERR_HEAP_EMPTY = 10210u, /* Heap seg empty; i.e. NO avail mem in heap. */ LIB_MEM_ERR_HEAP_OVF = 10211u, /* Heap seg ovf; i.e. req'd mem ovfs rem mem in heap. */ - LIB_MEM_ERR_HEAP_NOT_FOUND = 10215u /* Heap seg NOT found. */ + LIB_MEM_ERR_HEAP_NOT_FOUND = 10215u, /* Heap seg NOT found. */ + LIB_MEM_ERR_ADDR_OVF = 10300u /* Memory allocation exceeds address space. */ } LIB_ERR; @@ -1357,4 +1358,3 @@ typedef enum lib_err { */ #endif /* End of lib def module include. */ - diff --git a/lib_math.c b/lib_math.c index 0a2ab5a..9a10607 100644 --- a/lib_math.c +++ b/lib_math.c @@ -3,7 +3,7 @@ * uC/LIB * Custom Library Modules * -* Copyright 2004-2020 Silicon Laboratories Inc. www.silabs.com +* Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com * * SPDX-License-Identifier: APACHE-2.0 * @@ -20,7 +20,7 @@ * MATHEMATIC OPERATIONS * * Filename : lib_math.c -* Version : V1.39.00 +* Version : V1.39.01 ********************************************************************************************************* * Note(s) : (1) NO compiler-supplied standard library functions are used in library or product software. * @@ -267,4 +267,3 @@ RAND_NBR Math_RandSeed (RAND_NBR seed) return (rand_nbr); } - diff --git a/lib_math.h b/lib_math.h index 7f5e6f4..ae6cf99 100644 --- a/lib_math.h +++ b/lib_math.h @@ -3,7 +3,7 @@ * uC/LIB * Custom Library Modules * -* Copyright 2004-2020 Silicon Laboratories Inc. www.silabs.com +* Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com * * SPDX-License-Identifier: APACHE-2.0 * @@ -20,7 +20,7 @@ * MATHEMATIC OPERATIONS * * Filename : lib_math.h -* Version : V1.39.00 +* Version : V1.39.01 ********************************************************************************************************* * Note(s) : (1) NO compiler-supplied standard library functions are used in library or product software. * @@ -284,4 +284,3 @@ RAND_NBR Math_RandSeed (RAND_NBR seed); */ #endif /* End of lib math module include. */ - diff --git a/lib_mem.c b/lib_mem.c index 91524a8..192c5e7 100644 --- a/lib_mem.c +++ b/lib_mem.c @@ -3,7 +3,7 @@ * uC/LIB * Custom Library Modules * -* Copyright 2004-2020 Silicon Laboratories Inc. www.silabs.com +* Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com * * SPDX-License-Identifier: APACHE-2.0 * @@ -20,7 +20,7 @@ * STANDARD MEMORY OPERATIONS * * Filename : lib_mem.c -* Version : V1.39.00 +* Version : V1.39.01 ********************************************************************************************************* * Note(s) : (1) NO compiler-supplied standard library functions are used in library or product software. * @@ -1316,6 +1316,7 @@ void *Mem_SegAllocHW (const CPU_CHAR *p_name, * LIB_MEM_ERR_INVALID_BLK_SIZE Invalid block size specified. * LIB_MEM_ERR_INVALID_SEG_SIZE Invalid segment size. * LIB_MEM_ERR_HEAP_EMPTY No more memory available on heap. +* LIB_MEM_ERR_ADDR_OVF Memory allocation exceeds address space. * * ---------------RETURNED BY Mem_SegOverlapChkCritical()---------------- * LIB_MEM_ERR_INVALID_SEG_EXISTS Segment already exists. @@ -1355,6 +1356,7 @@ void Mem_PoolCreate (MEM_POOL *p_pool, MEM_SEG *p_seg; void *p_pool_mem; CPU_SIZE_T pool_size; + CPU_SIZE_T tbl_size; CPU_SIZE_T blk_size_align; CPU_ADDR pool_addr_end; MEM_POOL_BLK_QTY blk_ix; @@ -1453,11 +1455,18 @@ void Mem_PoolCreate (MEM_POOL *p_pool, CPU_CRITICAL_EXIT(); } - /* ---------------- ALLOC MEM FOR POOL ---------------- */ /* Calc blk size with align. */ blk_size_align = MATH_ROUND_INC_UP_PWR2(blk_size, blk_align); pool_size = blk_size_align * blk_nbr; /* Calc required size for pool. */ + tbl_size = blk_nbr * sizeof(void *); /* Calc required size for free block table. */ + + /* Detect integer overflows in the size calculations. */ + if ((blk_size_align > (DEF_INT_CPU_U_MAX_VAL / blk_nbr )) || + (blk_nbr > (DEF_INT_CPU_U_MAX_VAL / sizeof(void *)))) { + *p_err = LIB_MEM_ERR_ADDR_OVF; + return; + } /* Alloc mem for pool. */ p_pool_mem = (void *)Mem_SegAllocInternal("Unnamed static pool", @@ -1474,7 +1483,7 @@ void Mem_PoolCreate (MEM_POOL *p_pool, /* ------------ ALLOC MEM FOR FREE BLK TBL ------------ */ p_pool->BlkFreeTbl = (void **)Mem_SegAllocInternal("Unnamed static pool free blk tbl", &Mem_SegHeap, - blk_nbr * sizeof(void *), + tbl_size, sizeof(CPU_ALIGN), LIB_MEM_PADDING_ALIGN_NONE, p_bytes_reqd, @@ -1822,6 +1831,7 @@ MEM_POOL_BLK_QTY Mem_PoolBlkGetNbrAvail (MEM_POOL *p_pool, * LIB_MEM_ERR_INVALID_MEM_SIZE Invalid memory block size specified. * LIB_MEM_ERR_NULL_PTR Error or segment data pointer NULL. * LIB_MEM_ERR_SEG_OVF Allocation would overflow memory segment. +* LIB_MEM_ERR_ADDR_OVF Memory allocation exceeds address space. * * Return(s) : None. * @@ -1894,6 +1904,7 @@ void Mem_DynPoolCreate (const CPU_CHAR *p_name, * LIB_MEM_ERR_INVALID_MEM_SIZE Invalid memory block size specified. * LIB_MEM_ERR_NULL_PTR Error or segment data pointer NULL. * LIB_MEM_ERR_SEG_OVF Allocation would overflow memory segment. +* LIB_MEM_ERR_ADDR_OVF Memory allocation exceeds address space. * * Return(s) : None. * @@ -2688,6 +2699,7 @@ static void Mem_SegAllocTrackCritical (const CPU_CHAR *p_name, * LIB_MEM_ERR_INVALID_BLK_SIZE Invalid requested block size. * LIB_MEM_ERR_INVALID_BLK_NBR Invalid requested block quantity max. * LIB_MEM_ERR_NULL_PTR Pool data pointer NULL. +* LIB_MEM_ERR_ADDR_OVF Memory allocation exceeds address space. * * ------------------RETURNED BY Mem_SegAllocInternal()------------------- * LIB_MEM_ERR_INVALID_MEM_ALIGN Invalid memory block alignment requested. @@ -2716,6 +2728,7 @@ static void Mem_DynPoolCreateInternal (const CPU_CHAR *p_name, LIB_ERR *p_err) { CPU_INT08U *p_blks = DEF_NULL; + CPU_SIZE_T seg_size; CPU_SIZE_T blk_size_align; CPU_SIZE_T blk_align_worst = DEF_MAX(blk_align, blk_padding_align); @@ -2757,9 +2770,17 @@ static void Mem_DynPoolCreateInternal (const CPU_CHAR *p_name, if (blk_qty_init != 0u) { /* Alloc init blks. */ CPU_SIZE_T i; + + seg_size = blk_size_align * blk_qty_init; /* Calc required size for pool. */ + /* Detect integer overflow in the seg_size calculation. */ + if (blk_size_align > (DEF_INT_CPU_U_MAX_VAL / blk_qty_init)) { + *p_err = LIB_MEM_ERR_ADDR_OVF; + return; + } + p_blks = (CPU_INT08U *)Mem_SegAllocInternal(p_name, p_seg, - blk_size_align * blk_qty_init, + seg_size, DEF_MAX(blk_align, sizeof(void *)), LIB_MEM_PADDING_ALIGN_NONE, DEF_NULL, diff --git a/lib_mem.h b/lib_mem.h index fcd87e4..fffc561 100644 --- a/lib_mem.h +++ b/lib_mem.h @@ -3,7 +3,7 @@ * uC/LIB * Custom Library Modules * -* Copyright 2004-2020 Silicon Laboratories Inc. www.silabs.com +* Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com * * SPDX-License-Identifier: APACHE-2.0 * @@ -20,7 +20,7 @@ * STANDARD MEMORY OPERATIONS * * Filename : lib_mem.h -* Version : V1.39.00 +* Version : V1.39.01 ********************************************************************************************************* * Note(s) : (1) NO compiler-supplied standard library functions are used in library or product software. * @@ -782,36 +782,57 @@ typedef struct mem_dyn_pool { /* ------------- #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG) -#define MEM_VAL_COPY_GET_INT08U_BIG(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); } while (0) - -#define MEM_VAL_COPY_GET_INT16U_BIG(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); \ - (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 1)); } while (0) - -#define MEM_VAL_COPY_GET_INT24U_BIG(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); \ - (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \ - (*(((CPU_INT08U *)(addr_dest)) + 2)) = (*(((CPU_INT08U *)(addr_src)) + 2)); } while (0) - -#define MEM_VAL_COPY_GET_INT32U_BIG(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); \ - (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \ - (*(((CPU_INT08U *)(addr_dest)) + 2)) = (*(((CPU_INT08U *)(addr_src)) + 2)); \ - (*(((CPU_INT08U *)(addr_dest)) + 3)) = (*(((CPU_INT08U *)(addr_src)) + 3)); } while (0) - - - -#define MEM_VAL_COPY_GET_INT08U_LITTLE(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); } while (0) - -#define MEM_VAL_COPY_GET_INT16U_LITTLE(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \ - (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 0)); } while (0) - -#define MEM_VAL_COPY_GET_INT24U_LITTLE(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 2)); \ - (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \ - (*(((CPU_INT08U *)(addr_dest)) + 2)) = (*(((CPU_INT08U *)(addr_src)) + 0)); } while (0) - -#define MEM_VAL_COPY_GET_INT32U_LITTLE(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 3)); \ - (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 2)); \ - (*(((CPU_INT08U *)(addr_dest)) + 2)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \ - (*(((CPU_INT08U *)(addr_dest)) + 3)) = (*(((CPU_INT08U *)(addr_src)) + 0)); } while (0) - +#define MEM_VAL_COPY_GET_INT08U_BIG(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*((destptr) + 0)) = (*((srcptr) + 0)); } while (0) + +#define MEM_VAL_COPY_GET_INT16U_BIG(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*((destptr) + 0)) = (*((srcptr) + 0)); \ + (*((destptr) + 1)) = (*((srcptr) + 1)); } while (0) + +#define MEM_VAL_COPY_GET_INT24U_BIG(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*((destptr) + 0)) = (*((srcptr) + 0)); \ + (*((destptr) + 1)) = (*((srcptr) + 1)); \ + (*((destptr) + 2)) = (*((srcptr) + 2)); } while (0) + +#define MEM_VAL_COPY_GET_INT32U_BIG(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*((destptr) + 0)) = (*((srcptr) + 0)); \ + (*((destptr) + 1)) = (*((srcptr) + 1)); \ + (*((destptr) + 2)) = (*((srcptr) + 2)); \ + (*((destptr) + 3)) = (*((srcptr) + 3)); } while (0) + +#define MEM_VAL_COPY_GET_INT08U_LITTLE(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*((destptr) + 0)) = (*((srcptr) + 0)); } while (0) + +#define MEM_VAL_COPY_GET_INT16U_LITTLE(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*((destptr) + 0)) = (*((srcptr) + 1)); \ + (*((destptr) + 1)) = (*((srcptr) + 0)); } while (0) + +#define MEM_VAL_COPY_GET_INT24U_LITTLE(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*((destptr) + 0)) = (*((srcptr) + 2)); \ + (*((destptr) + 1)) = (*((srcptr) + 1)); \ + (*((destptr) + 2)) = (*((srcptr) + 0)); } while (0) + +#define MEM_VAL_COPY_GET_INT32U_LITTLE(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*((destptr) + 0)) = (*((srcptr) + 3)); \ + (*((destptr) + 1)) = (*((srcptr) + 2)); \ + (*((destptr) + 2)) = (*((srcptr) + 1)); \ + (*((destptr) + 3)) = (*((srcptr) + 0)); } while (0) #define MEM_VAL_COPY_GET_INT08U(addr_dest, addr_src) MEM_VAL_COPY_GET_INT08U_BIG((addr_dest), (addr_src)) #define MEM_VAL_COPY_GET_INT16U(addr_dest, addr_src) MEM_VAL_COPY_GET_INT16U_BIG((addr_dest), (addr_src)) @@ -822,35 +843,57 @@ typedef struct mem_dyn_pool { /* ------------- #elif (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_LITTLE) -#define MEM_VAL_COPY_GET_INT08U_BIG(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); } while (0) - -#define MEM_VAL_COPY_GET_INT16U_BIG(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \ - (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 0)); } while (0) - -#define MEM_VAL_COPY_GET_INT24U_BIG(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 2)); \ - (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \ - (*(((CPU_INT08U *)(addr_dest)) + 2)) = (*(((CPU_INT08U *)(addr_src)) + 0)); } while (0) - -#define MEM_VAL_COPY_GET_INT32U_BIG(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 3)); \ - (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 2)); \ - (*(((CPU_INT08U *)(addr_dest)) + 2)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \ - (*(((CPU_INT08U *)(addr_dest)) + 3)) = (*(((CPU_INT08U *)(addr_src)) + 0)); } while (0) - - - -#define MEM_VAL_COPY_GET_INT08U_LITTLE(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); } while (0) - -#define MEM_VAL_COPY_GET_INT16U_LITTLE(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); \ - (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 1)); } while (0) - -#define MEM_VAL_COPY_GET_INT24U_LITTLE(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); \ - (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \ - (*(((CPU_INT08U *)(addr_dest)) + 2)) = (*(((CPU_INT08U *)(addr_src)) + 2)); } while (0) - -#define MEM_VAL_COPY_GET_INT32U_LITTLE(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); \ - (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \ - (*(((CPU_INT08U *)(addr_dest)) + 2)) = (*(((CPU_INT08U *)(addr_src)) + 2)); \ - (*(((CPU_INT08U *)(addr_dest)) + 3)) = (*(((CPU_INT08U *)(addr_src)) + 3)); } while (0) +#define MEM_VAL_COPY_GET_INT08U_BIG(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*((destptr) + 0)) = (*((srcptr) + 0)); } while (0) + +#define MEM_VAL_COPY_GET_INT16U_BIG(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U * srcptr = (CPU_INT08U *)(addr_src); \ + (*((destptr) + 0)) = (*((srcptr) + 1)); \ + (*((destptr) + 1)) = (*((srcptr) + 0)); } while (0) + +#define MEM_VAL_COPY_GET_INT24U_BIG(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*((destptr) + 0)) = (*((srcptr) + 2)); \ + (*((destptr) + 1)) = (*((srcptr) + 1)); \ + (*((destptr) + 2)) = (*((srcptr) + 0)); } while (0) + +#define MEM_VAL_COPY_GET_INT32U_BIG(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*((destptr) + 0)) = (*((srcptr) + 3)); \ + (*((destptr) + 1)) = (*((srcptr) + 2)); \ + (*((destptr) + 2)) = (*((srcptr) + 1)); \ + (*((destptr) + 3)) = (*((srcptr) + 0)); } while (0) + +#define MEM_VAL_COPY_GET_INT08U_LITTLE(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*((destptr) + 0)) = (*((srcptr) + 0)); } while (0) + +#define MEM_VAL_COPY_GET_INT16U_LITTLE(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*((destptr) + 0)) = (*((srcptr) + 0)); \ + (*((destptr) + 1)) = (*((srcptr) + 1)); } while (0) + +#define MEM_VAL_COPY_GET_INT24U_LITTLE(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*((destptr) + 0)) = (*((srcptr) + 0)); \ + (*((destptr) + 1)) = (*((srcptr) + 1)); \ + (*((destptr) + 2)) = (*((srcptr) + 2)); } while (0) + +#define MEM_VAL_COPY_GET_INT32U_LITTLE(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*((destptr) + 0)) = (*((srcptr) + 0)); \ + (*((destptr) + 1)) = (*((srcptr) + 1)); \ + (*((destptr) + 2)) = (*((srcptr) + 2)); \ + (*((destptr) + 3)) = (*((srcptr) + 3)); } while (0) #define MEM_VAL_COPY_GET_INT08U(addr_dest, addr_src) MEM_VAL_COPY_GET_INT08U_LITTLE((addr_dest), (addr_src)) @@ -1197,28 +1240,40 @@ typedef struct mem_dyn_pool { /* ------------- ********************************************************************************************************* */ -#define MEM_VAL_COPY_08(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); } while (0) - -#define MEM_VAL_COPY_16(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); \ - (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 1)); } while (0) - -#define MEM_VAL_COPY_24(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); \ - (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \ - (*(((CPU_INT08U *)(addr_dest)) + 2)) = (*(((CPU_INT08U *)(addr_src)) + 2)); } while (0) - -#define MEM_VAL_COPY_32(addr_dest, addr_src) do { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); \ - (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \ - (*(((CPU_INT08U *)(addr_dest)) + 2)) = (*(((CPU_INT08U *)(addr_src)) + 2)); \ - (*(((CPU_INT08U *)(addr_dest)) + 3)) = (*(((CPU_INT08U *)(addr_src)) + 3)); } while (0) - - -#define MEM_VAL_COPY(addr_dest, addr_src, val_size) do { \ - CPU_SIZE_T _i; \ - \ - for (_i = 0; _i < (val_size); _i++) { \ - (*(((CPU_INT08U *)(addr_dest)) +_i)) = (*(((CPU_INT08U *)(addr_src)) +_i)); \ - } \ - } while (0) +#define MEM_VAL_COPY_08(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*(destptr + 0)) = (*(srcptr + 0)); } while (0) + +#define MEM_VAL_COPY_16(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*(destptr + 0)) = (*(srcptr + 0)); \ + (*(destptr + 1)) = (*(srcptr + 1)); } while (0) + +#define MEM_VAL_COPY_24(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*(destptr + 0)) = (*(srcptr + 0)); \ + (*(destptr + 1)) = (*(srcptr + 1)); \ + (*(destptr + 2)) = (*(srcptr + 2)); } while (0) + +#define MEM_VAL_COPY_32(addr_dest, addr_src) do { \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + (*(destptr + 0)) = (*(srcptr + 0)); \ + (*(destptr + 1)) = (*(srcptr + 1)); \ + (*(destptr + 2)) = (*(srcptr + 2)); \ + (*(destptr + 3)) = (*(srcptr + 3));} while (0) + +#define MEM_VAL_COPY(addr_dest, addr_src, val_size) do { \ + CPU_SIZE_T _i; \ + CPU_INT08U *destptr = (CPU_INT08U *)(addr_dest); \ + CPU_INT08U *srcptr = (CPU_INT08U *)(addr_src); \ + for (_i = 0; _i < (val_size); _i++) { \ + (*(destptr +_i)) = (*(srcptr +_i)); \ + } \ + } while (0) /* diff --git a/lib_str.c b/lib_str.c index 1208dbf..3ac3bfd 100644 --- a/lib_str.c +++ b/lib_str.c @@ -3,7 +3,7 @@ * uC/LIB * Custom Library Modules * -* Copyright 2004-2020 Silicon Laboratories Inc. www.silabs.com +* Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com * * SPDX-License-Identifier: APACHE-2.0 * @@ -20,7 +20,7 @@ * ASCII STRING MANAGEMENT * * Filename : lib_str.c -* Version : V1.39.00 +* Version : V1.39.01 ********************************************************************************************************* * Note(s) : (1) NO compiler-supplied standard library functions are used in library or product software. * @@ -4028,4 +4028,3 @@ static CPU_INT32U Str_ParseNbr_Int32 (const CPU_CHAR *pstr, return (nbr); } - diff --git a/lib_str.h b/lib_str.h index 24dddaa..8e1ed7f 100644 --- a/lib_str.h +++ b/lib_str.h @@ -3,7 +3,7 @@ * uC/LIB * Custom Library Modules * -* Copyright 2004-2020 Silicon Laboratories Inc. www.silabs.com +* Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com * * SPDX-License-Identifier: APACHE-2.0 * @@ -20,7 +20,7 @@ * ASCII STRING MANAGEMENT * * Filename : lib_str.h -* Version : V1.39.00 +* Version : V1.39.01 ********************************************************************************************************* * Note(s) : (1) NO compiler-supplied standard library functions are used in library or product software. * @@ -415,4 +415,3 @@ CPU_INT32S Str_ParseNbr_Int32S(const CPU_CHAR *pstr, */ #endif /* End of lib str module include. */ - diff --git a/readme.md b/readme.md deleted file mode 100644 index 3aecd49..0000000 --- a/readme.md +++ /dev/null @@ -1,5 +0,0 @@ -# uC/LIB - -Designed with Micrium’s renowned quality, scalability and reliability, the purpose of µC/LIB is to provide a clean, organized ANSI C implementation of the most common standard library functions, macros, and constants. - -## For the complete documentation, visit https://doc.micrium.com/display/ucos/ \ No newline at end of file