forked from xuos/xiuos
optimize code standard
This commit is contained in:
@@ -31,8 +31,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MERGE_FLAG(src, flag) *(src) |= flag
|
||||
#define CLEAR_FLAG(src, flag) *(src) &= ~flag
|
||||
#define MERGE_FLAG(src, flag) (*(src) |= flag)
|
||||
#define CLEAR_FLAG(src, flag) (*(src) &= ~flag)
|
||||
|
||||
extern struct Assign Assign;
|
||||
|
||||
|
||||
@@ -30,13 +30,14 @@
|
||||
#define TASK_DELAY_INACTIVE 0
|
||||
#define TASK_DELAY_ACTIVE 1
|
||||
|
||||
struct Delay {
|
||||
struct Delay
|
||||
{
|
||||
struct TaskDescriptor *task;
|
||||
x_ticks_t ticks;
|
||||
uint8 status;
|
||||
DoubleLinklistType link;
|
||||
};
|
||||
typedef struct Delay *delay_t;
|
||||
typedef struct Delay *DelayType;
|
||||
|
||||
x_err_t KTaskSetDelay(struct TaskDescriptor *task, x_ticks_t ticks);
|
||||
x_err_t KTaskUnSetDelay(struct TaskDescriptor *task);
|
||||
|
||||
@@ -36,54 +36,54 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define OSIGN_OPER_CLOSE (0U << 0)
|
||||
#define OSIGN_OPER_RDONLY (1U << 0)
|
||||
#define OSIGN_OPER_WRONLY (1U << 1)
|
||||
#define OSIGN_OPER_RDWR (OSIGN_OPER_WRONLY| OSIGN_OPER_RDONLY )
|
||||
#define OSIGN_OPER_OPEN (1U << 3)
|
||||
#define OSIGN_OPER_MASK 0xf0f
|
||||
#define OSIGN_OPER_CLOSE (0U << 0)
|
||||
#define OSIGN_OPER_RDONLY (1U << 0)
|
||||
#define OSIGN_OPER_WRONLY (1U << 1)
|
||||
#define OSIGN_OPER_RDWR (OSIGN_OPER_WRONLY| OSIGN_OPER_RDONLY )
|
||||
#define OSIGN_OPER_OPEN (1U << 3)
|
||||
#define OSIGN_OPER_MASK 0xf0f
|
||||
|
||||
#define SIGN_OPER_DEACTIVATE (0U << 0)
|
||||
#define SIGN_OPER_RDONLY (1U << 0)
|
||||
#define SIGN_OPER_WRONLY (1U << 1)
|
||||
#define SIGN_OPER_RDWR (SIGN_OPER_RDONLY|SIGN_OPER_WRONLY)
|
||||
#define SIGN_OPER_REMOVABLE (1U << 2)
|
||||
#define SIGN_OPER_STANDALONE (1U << 3)
|
||||
#define SIGN_OPER_ACTIVATED (1U << 4)
|
||||
#define SIGN_OPER_SUSPENDED (1U << 5)
|
||||
#define SIGN_OPER_STREAM (1U << 6)
|
||||
#define SIGN_OPER_INT_RX (1U << 8)
|
||||
#define SIGN_OPER_DMA_RX (1U << 9)
|
||||
#define SIGN_OPER_INT_TX (1U << 10)
|
||||
#define SIGN_OPER_DMA_TX (1U << 11)
|
||||
#define SIGN_OPER_DEACTIVATE (0U << 0)
|
||||
#define SIGN_OPER_RDONLY (1U << 0)
|
||||
#define SIGN_OPER_WRONLY (1U << 1)
|
||||
#define SIGN_OPER_RDWR (SIGN_OPER_RDONLY|SIGN_OPER_WRONLY)
|
||||
#define SIGN_OPER_REMOVABLE (1U << 2)
|
||||
#define SIGN_OPER_STANDALONE (1U << 3)
|
||||
#define SIGN_OPER_ACTIVATED (1U << 4)
|
||||
#define SIGN_OPER_SUSPENDED (1U << 5)
|
||||
#define SIGN_OPER_STREAM (1U << 6)
|
||||
#define SIGN_OPER_INT_RX (1U << 8)
|
||||
#define SIGN_OPER_DMA_RX (1U << 9)
|
||||
#define SIGN_OPER_INT_TX (1U << 10)
|
||||
#define SIGN_OPER_DMA_TX (1U << 11)
|
||||
|
||||
enum SIGN_OPER
|
||||
enum SIGN_OPER
|
||||
{
|
||||
OPER_RESUME = 0x01,
|
||||
OPER_SUSPEND = 0x02,
|
||||
OPER_CONFIG = 0x03,
|
||||
OPER_SET_INT = 0x10,
|
||||
OPER_CLR_INT = 0x11,
|
||||
OPER_GET_INT = 0x12,
|
||||
OPER_CHAR_STREAM = 0x10,
|
||||
OPER_BLK_GETGEOME = 0x10,
|
||||
OPER_BLK_SYNC = 0x11,
|
||||
OPER_BLK_ERASE = 0x12,
|
||||
OPER_BLK_AUTOREFRESH = 0x13,
|
||||
OPER_NETIF_GETMAC = 0x10,
|
||||
OPER_MTD_FORMAT = 0x10,
|
||||
OPER_RTC_GET_TIME = 0x10,
|
||||
OPER_RTC_SET_TIME = 0x11,
|
||||
OPER_RTC_GET_ALARM = 0x12,
|
||||
OPER_RTC_SET_ALARM = 0x13,
|
||||
OPER_RESUME = 0x01,
|
||||
OPER_SUSPEND = 0x02,
|
||||
OPER_CONFIG = 0x03,
|
||||
OPER_SET_INT = 0x10,
|
||||
OPER_CLR_INT = 0x11,
|
||||
OPER_GET_INT = 0x12,
|
||||
OPER_CHAR_STREAM = 0x10,
|
||||
OPER_BLK_GETGEOME = 0x10,
|
||||
OPER_BLK_SYNC = 0x11,
|
||||
OPER_BLK_ERASE = 0x12,
|
||||
OPER_BLK_AUTOREFRESH = 0x13,
|
||||
OPER_NETIF_GETMAC = 0x10,
|
||||
OPER_MTD_FORMAT = 0x10,
|
||||
OPER_RTC_GET_TIME = 0x10,
|
||||
OPER_RTC_SET_TIME = 0x11,
|
||||
OPER_RTC_GET_ALARM = 0x12,
|
||||
OPER_RTC_SET_ALARM = 0x13,
|
||||
};
|
||||
|
||||
struct DeviceBlockArrange
|
||||
{
|
||||
uint32 bank_num;
|
||||
uint32 size_perbank;
|
||||
uint32 block_size;
|
||||
uint16 bank_start;
|
||||
uint32 size_perbank;
|
||||
uint32 block_size;
|
||||
uint16 bank_start;
|
||||
uint16 bank_end;
|
||||
};
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ struct TaskDyncSchedMember {
|
||||
uint8 bitmap_row;
|
||||
#endif
|
||||
uint32 bitmap_column;
|
||||
delay_t delay;
|
||||
DelayType delay;
|
||||
};
|
||||
typedef struct TaskDyncSchedMember TaskDyncSchedMembeType;
|
||||
|
||||
|
||||
@@ -100,16 +100,16 @@ enum KernelService
|
||||
KS_USER_END
|
||||
|
||||
};
|
||||
#define SERVICETABLE ((struct Kernel_Service*)SERVICE_TABLE_ADDRESS)
|
||||
#define SERVICETABLE ((struct KernelService*)SERVICE_TABLE_ADDRESS)
|
||||
#endif
|
||||
|
||||
typedef uintptr_t (*kservice)(uint32_t knum,uintptr_t *param,uint8_t param_num);
|
||||
struct Kernel_Service
|
||||
struct KernelService
|
||||
{
|
||||
const kservice fun;
|
||||
const uint8_t param_num;
|
||||
};
|
||||
|
||||
extern struct Kernel_Service g_service_table[] ;
|
||||
extern struct KernelService g_service_table[] ;
|
||||
|
||||
#endif
|
||||
@@ -45,16 +45,16 @@ struct SpinLock
|
||||
HwSpinlock lock;
|
||||
};
|
||||
|
||||
struct Spin_Lockfileops
|
||||
{ //定义自旋锁
|
||||
struct SpinLock node_lock; //原有的自旋锁结构体
|
||||
void (*SPinLock)(struct Spin_Lockfileops *spinlock);
|
||||
void (*UnlockSpinLock)(struct Spin_Lockfileops *spinlock);
|
||||
void (*UnlockSpinLockIrqRestore)(struct Spin_Lockfileops *spinlock, x_base level);
|
||||
x_base (*SpinLockIrqSave)(struct Spin_Lockfileops *spinlock);
|
||||
struct SpinLockfileOps
|
||||
{ //define spin lock
|
||||
struct SpinLock node_lock; //last spin lock node struct
|
||||
void (*SPinLock)(struct SpinLockfileOps *spinlock);
|
||||
void (*UnlockSpinLock)(struct SpinLockfileOps *spinlock);
|
||||
void (*UnlockSpinLockIrqRestore)(struct SpinLockfileOps *spinlock, x_base level);
|
||||
x_base (*SpinLockIrqSave)(struct SpinLockfileOps *spinlock);
|
||||
};
|
||||
|
||||
extern struct Spin_Lockfileops spinlock;
|
||||
extern struct SpinLockfileOps spinlock;
|
||||
extern HwSpinlock _CriticalLock;
|
||||
|
||||
void InitHwSpinlock(HwSpinlock *lock);
|
||||
@@ -82,11 +82,11 @@ void ExecSecondaryCpuIdleKtask(void);
|
||||
#ifdef ARCH_SMP
|
||||
struct SpinLock;
|
||||
|
||||
void InitSpinLock(struct Spin_Lockfileops * spinlock);
|
||||
void _SpinLock(struct Spin_Lockfileops * spinlock);
|
||||
void _UnlockSpinLock(struct Spin_Lockfileops * spinlock);
|
||||
x_base _SpinLockIrqSave(struct Spin_Lockfileops * spinlock);
|
||||
void _UnlockSpinLockIrqRestore(struct Spin_Lockfileops * spinlock, x_base level);
|
||||
void InitSpinLock(struct SpinLockfileOps * spinlock);
|
||||
void _SpinLock(struct SpinLockfileOps * spinlock);
|
||||
void _UnlockSpinLock(struct SpinLockfileOps * spinlock);
|
||||
x_base _SpinLockIrqSave(struct SpinLockfileOps * spinlock);
|
||||
void _UnlockSpinLockIrqRestore(struct SpinLockfileOps * spinlock, x_base level);
|
||||
|
||||
#else
|
||||
#define InitSpinLock(lock) /* nothing */
|
||||
|
||||
Reference in New Issue
Block a user