forked from xuos/xiuos
optimize code standards
This commit is contained in:
@@ -56,11 +56,11 @@ struct utask
|
||||
int32_t stack_size;
|
||||
uint8_t prio;
|
||||
};
|
||||
typedef struct utask utask_x;
|
||||
typedef struct utask UtaskType;
|
||||
|
||||
typedef void DIR;
|
||||
|
||||
int32_t UserTaskCreate(utask_x utask);
|
||||
int32_t UserTaskCreate(UtaskType utask);
|
||||
|
||||
x_err_t UserTaskStartup(int32_t id);
|
||||
x_err_t UserTaskDelete(int32_t id);
|
||||
@@ -178,8 +178,8 @@ struct utask
|
||||
int32_t stack_size;
|
||||
uint8_t prio;
|
||||
};
|
||||
typedef struct utask utask_x;
|
||||
int32_t UserTaskCreate(utask_x utask);
|
||||
typedef struct utask UtaskType;
|
||||
int32_t UserTaskCreate(UtaskType utask);
|
||||
|
||||
#define UserTaskStartup StartupKTask
|
||||
#define UserTaskDelete KTaskDelete
|
||||
|
||||
@@ -37,16 +37,14 @@ void InitCmpts(void);
|
||||
extern int VfsInit(void);
|
||||
extern int WorkSysWorkQueueInit(void);
|
||||
extern int FlashW25qxxSpiDeviceInit(void);
|
||||
extern int sal_mbedtls_proto_init(void);
|
||||
extern int FatfsInit(void);
|
||||
extern int Ch376fsInit(void);
|
||||
extern int LibcSystemInit(void);
|
||||
extern int sal_init(void);
|
||||
extern int RtcNtpSyncInit(void);
|
||||
extern int MountSDCard(void);
|
||||
extern int dfs_mount_table(void);
|
||||
extern int DfsMountTable(void);
|
||||
extern int userShellInit(void);
|
||||
extern int stm32_sdcard_mount(void);
|
||||
extern int Stm32SdcardMount(void);
|
||||
extern int STM32USBHostRegister(void);
|
||||
extern int WorkSysWorkQueueInit(void);
|
||||
|
||||
|
||||
@@ -42,6 +42,6 @@ enum QUEUE_TYPE
|
||||
};
|
||||
|
||||
extern void *g_queue_done[];
|
||||
extern void queuemanager_done_register();
|
||||
extern void QueuemanagerDoneRegister();
|
||||
|
||||
#endif
|
||||
@@ -48,24 +48,12 @@ struct WaitqueueNode
|
||||
};
|
||||
typedef struct WaitqueueNode WaitqueueNodeType;
|
||||
|
||||
int __WqueueDefaultWake(struct WaitqueueNode *wait, void *key);
|
||||
void InitWqueue(WaitQueueType *queue);
|
||||
void WqueueAdd(WaitQueueType *queue, struct WaitqueueNode *node);
|
||||
void WqueueRemove(struct WaitqueueNode *node);
|
||||
int WqueueWait(WaitQueueType *queue, x_ticks_t tick);
|
||||
void WakeupWqueue(WaitQueueType *queue, void *key);
|
||||
|
||||
#define DEFINE_WAIT_FUNC(name, function) \
|
||||
struct WaitqueueNode name = { \
|
||||
os_running_task, \
|
||||
DOUBLE_LINKLIST_OBJ_INIT(((name).list)), \
|
||||
\
|
||||
function, \
|
||||
0 \
|
||||
}
|
||||
|
||||
#define DEFINE_WAIT(name) DEFINE_WAIT_FUNC(name, __WqueueDefaultWake)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void (*InitWqueue)(WaitQueueType *queue);
|
||||
|
||||
@@ -647,8 +647,8 @@ struct utask
|
||||
int32_t stack_size;
|
||||
uint8_t prio;
|
||||
};
|
||||
typedef struct utask utask_x;
|
||||
int32_t UserTaskCreate(utask_x utask)
|
||||
typedef struct utask UtaskType;
|
||||
int32_t UserTaskCreate(UtaskType utask)
|
||||
{
|
||||
return KTaskCreate(utask.name, utask.func_entry, utask.func_param,utask.stack_size,utask.prio);
|
||||
}
|
||||
|
||||
@@ -76,18 +76,18 @@ static x_err_t ReadRegs(struct HardwareDev *dev, uint8 len, uint8 *buf)
|
||||
}
|
||||
}
|
||||
|
||||
static void read_temp_humi(float *cur_temp, float *cur_humi)
|
||||
static void ReadTempHumi(float *cur_temp, float *cur_humi)
|
||||
{
|
||||
uint8 temp[4],ret=0;
|
||||
MdelayKTask(15);
|
||||
ret = WriteReg(i2c_bus->owner_haldev); //reset
|
||||
if(EOK != ret){
|
||||
KPrintf("read_temp_humi WriteReg failed!\n");
|
||||
KPrintf("ReadTempHumi WriteReg failed!\n");
|
||||
}
|
||||
MdelayKTask(50);
|
||||
ret = ReadRegs(i2c_bus->owner_haldev, 4, temp); /* get sensor data */
|
||||
if(EOK != ret){
|
||||
KPrintf("read_temp_humi ReadRegs failed\n");
|
||||
KPrintf("ReadTempHumi ReadRegs failed\n");
|
||||
}
|
||||
|
||||
*cur_humi = ((temp[0] <<8 | temp[1] )& 0x3fff ) * 100.0 / ( (1 << 14) - 1); /* humidity data */
|
||||
@@ -95,15 +95,15 @@ static void read_temp_humi(float *cur_temp, float *cur_humi)
|
||||
*cur_temp = ((temp[2] << 8 | temp[3]) >> 2) * 165.0 /( (1 << 14) - 1) - 40.0; /* temperature data */
|
||||
}
|
||||
|
||||
static void _HS3000Init(const char *bus_name, const char *dev_name, const char *drv_name)
|
||||
static void HS3000Init(const char *bus_name, const char *dev_name, const char *drv_name)
|
||||
{
|
||||
/* find I2C device and get I2C handle */
|
||||
i2c_bus = BusFind(bus_name);
|
||||
if (NONE == i2c_bus){
|
||||
KPrintf("_HS3000Init can't find %s bus!\n", bus_name);
|
||||
KPrintf("HS3000Init can't find %s bus!\n", bus_name);
|
||||
}
|
||||
else{
|
||||
KPrintf("_HS3000Init find %s bus!\n", bus_name);
|
||||
KPrintf("HS3000Init find %s bus!\n", bus_name);
|
||||
}
|
||||
|
||||
i2c_bus->owner_haldev = BusFindDevice(i2c_bus, dev_name);
|
||||
@@ -113,7 +113,7 @@ static void _HS3000Init(const char *bus_name, const char *dev_name, const char
|
||||
KPrintf("i2c match drv %s %p dev %s %p error\n", drv_name, i2c_bus->owner_driver, dev_name, i2c_bus->owner_haldev);
|
||||
}
|
||||
else{
|
||||
KPrintf("_HS3000Init successfully!write %p read %p\n",
|
||||
KPrintf("HS3000Init successfully!write %p read %p\n",
|
||||
i2c_bus->owner_haldev->dev_done->write,
|
||||
i2c_bus->owner_haldev->dev_done->read);
|
||||
}
|
||||
@@ -121,13 +121,13 @@ static void _HS3000Init(const char *bus_name, const char *dev_name, const char
|
||||
|
||||
void Hs300xInit(void)
|
||||
{
|
||||
_HS3000Init(HS_I2C_BUS_NAME, HS_I2C_DEV_NAME, HS_I2C_DRV_NAME); /* init sensor */
|
||||
HS3000Init(HS_I2C_BUS_NAME, HS_I2C_DEV_NAME, HS_I2C_DRV_NAME); /* init sensor */
|
||||
}
|
||||
|
||||
void Hs300xRead(Hs300xDataType *Hs300xDataType)
|
||||
{
|
||||
float humidity = 0.0, temperature = 0.0;
|
||||
read_temp_humi(&temperature, &humidity); /* read temperature and humidity sensor data */
|
||||
ReadTempHumi(&temperature, &humidity); /* read temperature and humidity sensor data */
|
||||
Hs300xDataType->humi_high = (int)humidity;
|
||||
Hs300xDataType->humi_low = (int)(humidity*10)%10;
|
||||
if( temperature >= 0 ) {
|
||||
@@ -140,7 +140,7 @@ void Hs300xRead(Hs300xDataType *Hs300xDataType)
|
||||
}
|
||||
}
|
||||
|
||||
void Tsk_hs300x_test()
|
||||
void TskHs300xTest()
|
||||
{
|
||||
memset(&g_hs300x_data, 0, sizeof(Hs300xDataType));
|
||||
KPrintf("Tsk create successfully!\n");
|
||||
@@ -167,7 +167,7 @@ void Hs300xI2cTest(void)
|
||||
MdelayKTask(1000);
|
||||
|
||||
x_err_t flag;
|
||||
int32 Tsk_hs300x = KTaskCreate("Tsk_hs300x", Tsk_hs300x_test, NONE, 2048, 10);
|
||||
int32 Tsk_hs300x = KTaskCreate("Tsk_hs300x", TskHs300xTest, NONE, 2048, 10);
|
||||
flag = StartupKTask(Tsk_hs300x);
|
||||
if (EOK != flag){
|
||||
KPrintf("Hs300xI2cTest StartupKTask failed!\n");
|
||||
|
||||
@@ -57,11 +57,11 @@ struct utask
|
||||
uint32 stack_size;
|
||||
uint8 prio;
|
||||
};
|
||||
typedef struct utask utask_x;
|
||||
typedef struct utask UtaskType;
|
||||
|
||||
typedef void DIR;
|
||||
|
||||
int32 UserTaskCreate(utask_x utask);
|
||||
int32 UserTaskCreate(UtaskType utask);
|
||||
|
||||
x_err_t UserTaskStartup(int32 id);
|
||||
x_err_t UserTaskDelete(int32 id);
|
||||
@@ -170,8 +170,8 @@ struct utask
|
||||
int32_t stack_size;
|
||||
uint8_t prio;
|
||||
};
|
||||
typedef struct utask utask_x;
|
||||
int32_t UserTaskCreate(utask_x utask);
|
||||
typedef struct utask UtaskType;
|
||||
int32_t UserTaskCreate(UtaskType utask);
|
||||
|
||||
#define UserTaskStartup StartupKTask
|
||||
#define UserTaskDelete KTaskDelete
|
||||
|
||||
@@ -44,7 +44,7 @@ extern void CreateKServiceKTask(void);
|
||||
extern int main(void);
|
||||
void InitBoardHardware(void);
|
||||
extern int hook_init(void);
|
||||
int cplusplus_system_init(void);
|
||||
int CplusplusSystemInit(void);
|
||||
|
||||
#ifdef KERNEL_COMPONENTS_INIT
|
||||
#ifdef USER_APPLICATION
|
||||
@@ -64,7 +64,7 @@ struct InitSequenceDesc prev_cmpts_init[] =
|
||||
{ "vfs", VfsInit },
|
||||
#endif
|
||||
#ifdef LIB_CPLUSPLUS
|
||||
{ "cplusplus_system", cplusplus_system_init },
|
||||
{ "cplusplus_system", CplusplusSystemInit },
|
||||
#endif
|
||||
#ifdef KERNEL_HOOK
|
||||
{ "hook", hook_init },
|
||||
@@ -86,9 +86,6 @@ struct InitSequenceDesc device_init[] =
|
||||
};
|
||||
struct InitSequenceDesc components_init[] =
|
||||
{
|
||||
#ifdef CONNECTION_AT_SAL_USING_TLS
|
||||
{"sal_mbedtls_proto", sal_mbedtls_proto_init},
|
||||
#endif
|
||||
#ifdef FS_VFS_FATFS
|
||||
{ "fatfs", FatfsInit },
|
||||
#endif
|
||||
@@ -96,9 +93,6 @@ struct InitSequenceDesc components_init[] =
|
||||
{ "ch376", Ch376fsInit },
|
||||
#endif
|
||||
{ "libc_system", LibcSystemInit },
|
||||
#ifdef CONNECTION_AT_OS_USING_SAL
|
||||
// { "sal_init", sal_init },
|
||||
#endif
|
||||
#ifdef RTC_SYNC_USING_NTP
|
||||
{ "rtc_ntp_sync",RtcNtpSyncInit},
|
||||
#endif
|
||||
@@ -112,7 +106,7 @@ struct InitSequenceDesc env_init[] =
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FS_VFS_MNTTABLE
|
||||
{ "dfs_mount_table", dfs_mount_table },
|
||||
{ "DfsMountTable", DfsMountTable },
|
||||
#endif
|
||||
#ifdef TOOL_SHELL
|
||||
{ "letter-shell system", userShellInit },
|
||||
@@ -122,7 +116,7 @@ struct InitSequenceDesc env_init[] =
|
||||
struct InitSequenceDesc communication_init[] =
|
||||
{
|
||||
// #ifdef BSP_USING_SDIO
|
||||
// { "stm32_sdcard_mount",stm32_sdcard_mount },
|
||||
// { "Stm32SdcardMount",Stm32SdcardMount },
|
||||
// #endif
|
||||
#ifdef BSP_USING_USBH
|
||||
{ "STM32USBHostRegister", STM32USBHostRegister },
|
||||
@@ -201,7 +195,7 @@ int XiUOSStartup(void)
|
||||
DISABLE_INTERRUPT();
|
||||
|
||||
#ifdef KERNEL_QUEUEMANAGE
|
||||
queuemanager_done_register();
|
||||
QueuemanagerDoneRegister();
|
||||
#endif
|
||||
|
||||
#ifdef KERNEL_BANNER
|
||||
|
||||
@@ -44,7 +44,7 @@ extern int GetCpuId(void);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void incIsrCounter()
|
||||
void IncIsrCounter()
|
||||
{
|
||||
#ifdef ARCH_SMP
|
||||
isrManager.isr_count[GetCpuId()] ++ ;
|
||||
@@ -54,7 +54,7 @@ extern int GetCpuId(void);
|
||||
return ;
|
||||
}
|
||||
|
||||
void decIsrCounter()
|
||||
void DecIsrCounter()
|
||||
{
|
||||
|
||||
#ifdef ARCH_SMP
|
||||
@@ -65,7 +65,7 @@ extern int GetCpuId(void);
|
||||
return ;
|
||||
}
|
||||
|
||||
x_bool Is_InIsr()
|
||||
x_bool IsInIsr()
|
||||
{
|
||||
#ifdef ARCH_SMP
|
||||
return ( isrManager.isr_count[GetCpuId()] != 0 ? RET_TRUE : RET_FALSE ) ;
|
||||
@@ -155,7 +155,7 @@ void IsrCommon(uint32 irq_num)
|
||||
|
||||
}
|
||||
|
||||
void setIsrSwitchTrigerFlag()
|
||||
void SetIsrSwitchTrigerFlag()
|
||||
{
|
||||
|
||||
#ifdef ARCH_SMP
|
||||
@@ -166,7 +166,7 @@ void IsrCommon(uint32 irq_num)
|
||||
|
||||
}
|
||||
|
||||
void clearIsrSwitchTrigerFlag()
|
||||
void ClearIsrSwitchTrigerFlag()
|
||||
{
|
||||
|
||||
#ifdef ARCH_SMP
|
||||
@@ -176,7 +176,7 @@ void IsrCommon(uint32 irq_num)
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8 getIsrSwitchTrigerFlag()
|
||||
uint8 GetIsrSwitchTrigerFlag()
|
||||
{
|
||||
|
||||
#ifdef ARCH_SMP
|
||||
@@ -188,18 +188,18 @@ void IsrCommon(uint32 irq_num)
|
||||
}
|
||||
|
||||
struct IsrDone isrDone = {
|
||||
Is_InIsr,
|
||||
IsInIsr,
|
||||
RegisterHwIrq ,
|
||||
FreeHwIrq,
|
||||
EnableHwIrq,
|
||||
DisableHwIrq,
|
||||
IsrCommon,
|
||||
GetIsrCounter,
|
||||
incIsrCounter,
|
||||
decIsrCounter,
|
||||
getIsrSwitchTrigerFlag,
|
||||
setIsrSwitchTrigerFlag,
|
||||
clearIsrSwitchTrigerFlag
|
||||
IncIsrCounter,
|
||||
DecIsrCounter,
|
||||
GetIsrSwitchTrigerFlag,
|
||||
SetIsrSwitchTrigerFlag,
|
||||
ClearIsrSwitchTrigerFlag
|
||||
} ;
|
||||
|
||||
void SysInitIsrManager()
|
||||
|
||||
@@ -29,7 +29,7 @@ void KSerciveKTaskIdle(void)
|
||||
InitIdleKTask();
|
||||
}
|
||||
|
||||
void xz_KServiceKTaskRecycle()
|
||||
void KServiceKTaskRecycle()
|
||||
{
|
||||
ZombieTaskRecycleInit();
|
||||
}
|
||||
@@ -37,7 +37,7 @@ void xz_KServiceKTaskRecycle()
|
||||
void CreateKServiceKTask(void)
|
||||
{
|
||||
/* create zombie recycle task */
|
||||
xz_KServiceKTaskRecycle();
|
||||
KServiceKTaskRecycle();
|
||||
|
||||
/* create idle task */
|
||||
KSerciveKTaskIdle();
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
void* g_queue_done[QUEUE_MAX];
|
||||
|
||||
void queuemanager_done_register()
|
||||
void QueuemanagerDoneRegister()
|
||||
{
|
||||
DataQueueDoneType* pdata_queue_done = (DataQueueDoneType*)x_malloc(sizeof(DataQueueDoneType));
|
||||
pdata_queue_done->InitDataqueue = InitDataqueue;
|
||||
|
||||
Reference in New Issue
Block a user