[fix][common] fix some macro redefinitions

This commit is contained in:
jzlv 2021-08-25 16:56:00 +08:00
parent 1171218ca7
commit dea22ca51a
5 changed files with 24 additions and 26 deletions

View file

@ -53,7 +53,7 @@ int device_register(struct device *dev, const char *name)
}
}
strncpy(dev->name, name, NAME_MAX);
strncpy(dev->name, name, DEVICE_NAME_MAX);
dlist_insert_after(&device_head, &(dev->list));
dev->status = DEVICE_REGISTERED;
@ -86,7 +86,7 @@ int device_unregister(const char *name)
if (!dev) {
return -DEVICE_ENODEV;
}
dev->status = DEVICE_UNREGISTER;
/* remove from old list */
dlist_remove(&(dev->list));
return DEVICE_EOK;
@ -108,7 +108,7 @@ struct device *device_find(const char *name)
{
dev = dlist_entry(node, struct device, list);
if (strncmp(dev->name, name, NAME_MAX) == 0) {
if (strncmp(dev->name, name, DEVICE_NAME_MAX) == 0) {
return dev;
}
}

View file

@ -26,7 +26,7 @@
#include "drv_list.h"
#include "bflb_platform.h"
#define NAME_MAX 20 /* max device name*/
#define DEVICE_NAME_MAX 20 /* max device name*/
#define DEVICE_OFLAG_DEFAULT 0x000 /* open with default */
#define DEVICE_OFLAG_STREAM_TX 0x001 /* open with poll tx */
@ -107,7 +107,7 @@ enum device_status_type {
};
struct device {
char name[NAME_MAX]; /*name of device */
char name[DEVICE_NAME_MAX]; /*name of device */
dlist_t list; /*list node of device */
enum device_status_type status; /*status of device */
enum device_class_type type; /*type of device */

View file

@ -48,7 +48,7 @@
* We support allocations of sizes up to (1 << MMHEAP_FL_INDEX_MAX) bits.
* However, because we linearly subdivide the second-level lists, and
* our minimum size granularity is 4 bytes, it doesn't make sense to
* create first-level lists for sizes smaller than K_MMHEAP_SL_INDEX_COUNT * 4,
* create first-level lists for sizes smaller than MMHEAP_SL_INDEX_COUNT * 4,
* or (1 << (K_MMHEAP_SL_INDEX_COUNT_LOG2 + 2)) bytes, as there we will be
* trying to split size ranges into more slots than we have available.
* Instead, we calculate the minimum threshold size, and place all

View file

@ -66,15 +66,6 @@
#endif
#define NORETURN __attribute__((noreturn))
/* alignment value should be a power of 2 */
#define ALIGN(num, align) MASK(num, (typeof(num))align - 1)
#define ALIGN_2(num) ALIGN(num, 2)
#define ALIGN_4(num) ALIGN(num, 4)
#define ALIGN_8(num) ALIGN(num, 8)
#define ALIGN_16(num) ALIGN(num, 16)
#define ALIGN_32(num) ALIGN(num, 32)
#else /* __GNUC__ */
#define WARN_UNUSED_RET

View file

@ -77,18 +77,25 @@
}
/* Std driver attribute macro*/
#define ATTR_CLOCK_SECTION __attribute__((section(".sclock_rlt_code")))
#define ATTR_CLOCK_CONST_SECTION __attribute__((section(".sclock_rlt_const")))
#define ATTR_TCM_SECTION __attribute__((section(".tcm_code")))
#define ATTR_TCM_CONST_SECTION __attribute__((section(".tcm_const")))
#define ATTR_DTCM_SECTION __attribute__((section(".tcm_data")))
#define ATTR_HSRAM_SECTION __attribute__((section(".hsram_code")))
#define ATTR_DMA_RAM_SECTION __attribute__((section(".system_ram")))
#define ATTR_EALIGN(x) __attribute((aligned(x)))
#define ATTR_FALLTHROUGH() __attribute__((fallthrough))
#define ATTR_USED __attribute__((__used__))
#define ATTR_CLOCK_SECTION __attribute__((section(".sclock_rlt_code")))
#define ATTR_CLOCK_CONST_SECTION __attribute__((section(".sclock_rlt_const")))
#define ATTR_TCM_SECTION __attribute__((section(".tcm_code")))
#define ATTR_TCM_CONST_SECTION __attribute__((section(".tcm_const")))
#define ATTR_DTCM_SECTION __attribute__((section(".tcm_data")))
#define ATTR_HSRAM_SECTION __attribute__((section(".hsram_code")))
#define ATTR_DMA_RAM_SECTION __attribute__((section(".system_ram")))
#define ATTR_HBN_RAM_SECTION __attribute__((section(".hbn_ram_code")))
#define ATTR_HBN_RAM_CONST_SECTION __attribute__((section(".hbn_ram_data")))
#define ATTR_EALIGN(x) __attribute((aligned(x)))
#define ATTR_FALLTHROUGH() __attribute__((fallthrough))
#define ATTR_USED __attribute__((__used__))
#define BIT(x) (1 << (x))
#ifdef BIT
#undef BIT
#define BIT(n) (1UL << (n))
#else
#define BIT(n) (1UL << (n))
#endif
/**
* @brief Error type definition