Browse Source

optimize code standards

crypto_algorithm
Liu_Weichao 1 year ago
parent
commit
b4e108d620
  1. 42
      applications/cppmain.cpp
  2. 2
      applications/sensor_app/pm1_0_ps5308.c
  3. 2
      applications/user_api/posix_support/pthread.c
  4. 8
      applications/user_api/switch_api/user_api.h
  5. 2
      applications/user_api/switch_api/user_task.c
  6. 2
      arch/arm/cortex-m4/interrupt.c
  7. 2
      arch/arm/cortex-m4/svc_handle.c
  8. 16
      board/aiit-arm32-board/third_party_driver/ch438/connect_ch438.c
  9. 4
      board/aiit-arm32-board/third_party_driver/include/connect_ch438.h
  10. 4
      board/aiit-riscv64-board/board.c
  11. 30
      board/aiit-riscv64-board/third_party_driver/ch438/connect_ch438.c
  12. 2
      board/aiit-riscv64-board/third_party_driver/include/connect_ch438.h
  13. 2
      framework/connection/Adapter/src/xs_adapter_at_agent.c
  14. 2
      framework/connection/Adapter/zigbee/xs_adapter_zigbee.c
  15. 2
      framework/perception/pm/ps5308/ps5308.c
  16. 2
      framework/perception/voice/d124/d124.c
  17. 8
      kernel/include/user_api.h
  18. 6
      kernel/include/xs_init.h
  19. 2
      kernel/include/xs_queue_manager.h
  20. 12
      kernel/include/xs_waitqueue.h
  21. 4
      kernel/kernel_service/xs_service.c
  22. 22
      kernel/kernel_test/test_i2c.c
  23. 8
      kernel/kernel_test/user_api.h
  24. 16
      kernel/thread/init.c
  25. 24
      kernel/thread/isr.c
  26. 4
      kernel/thread/kservicetask.c
  27. 2
      kernel/thread/queue_manager.c
  28. 2
      lib/libcpp/cppinit.c
  29. 24
      tool/shell/letter-shell/file_ext/msh_file.c

42
applications/cppmain.cpp

@ -22,14 +22,14 @@ class Animal //parent class
public:
virtual void eat()
virtual void Eat()
{
KPrintf("eat\n");
}
void sleep()
void Sleep()
{
KPrintf("sleep\n");
}
@ -42,7 +42,7 @@ class Fish :public Animal //subclass
public:
void eat()
void Eat()
{
KPrintf("fish eat\n");
@ -50,33 +50,28 @@ public:
}
};
void doeat(Animal& animal)
void Doeat(Animal& animal)
{
animal.eat();
animal.Eat();
}
void mem_test2()
void MemTest2()
{
int i;
char *ptr = NULL; /* memory pointer */
for (i = 0; ; i++)
{
for (i = 0; ; i++) {
/* allocate (1<<i) bytes memory every single time */
ptr = (char *)operator new(1 << i);
/* if allocate successfully */
if (ptr != NULL)
{
if (ptr != NULL) {
KPrintf("get memory :%d byte\n", (1 << i));
/* release the memory */
operator delete(ptr);
KPrintf("free memory :%d byte\n", (1 << i));
ptr = NULL;
}
else
{
} else {
KPrintf("try to get %d byte memory failed!\n", (1 << i));
break;
//return 0;
@ -85,17 +80,18 @@ void mem_test2()
}
void overload_test(int a)
void OverLoadTest(int a)
{
KPrintf("output is a int number: %d\n", a);
}
void overload_test(int a,int b )
void OverLoadTestDouble(int a,int b )
{
KPrintf("output is 2 int number: %d and %d\n", a,b);
}
template<typename T>
void myswap(T& a, T& b)
void MySwap(T& a, T& b)
{
T temp = a;
a = b;
@ -104,19 +100,17 @@ void myswap(T& a, T& b)
extern "C" int cppmain(void)
{
mem_test2();
MemTest2();
class Fish fish;
doeat(fish);
Doeat(fish);
int a = 3;
int b = 5;
void overload_test(int a, int b);
overload_test(a, b);
myswap(a,b);
void OverLoadTestDouble(int a, int b);
OverLoadTestDouble(a, b);
MySwap(a,b);
KPrintf("with template the output is: %d and %d\n", a,b);
return 0;
}

2
applications/sensor_app/pm1_0_ps5308.c

@ -25,7 +25,7 @@
* @description: Read a PM1.0
* @return 0
*/
void Pm1_0Ps5308(void)
void Pm10Ps5308(void)
{
struct SensorQuantity *pm1_0 = SensorQuantityFind(SENSOR_QUANTITY_PS5308_PM1_0, SENSOR_QUANTITY_PM);
SensorQuantityOpen(pm1_0);

2
applications/user_api/posix_support/pthread.c

@ -26,7 +26,7 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
{
int ret ;
int pid ;
utask_x task ;
UtaskType task ;
task.func_entry = start_routine ;
task.func_param = arg ;
memcpy(task.name , "utask", 6);

8
applications/user_api/switch_api/user_api.h

@ -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

2
applications/user_api/switch_api/user_task.c

@ -34,7 +34,7 @@
*
* @return EOK on success; ENOMEMORY/EEMPTY on failure
*/
int32_t UserTaskCreate(utask_x utask){
int32_t UserTaskCreate(UtaskType utask){
return (int32_t) KSwitch5(KS_USER_TASK_CREATE,(uintptr_t)utask.name,(uintptr_t)utask.func_entry,(uintptr_t)utask.func_param,(uintptr_t)utask.stack_size,(uintptr_t)utask.prio);
}

2
arch/arm/cortex-m4/interrupt.c

@ -82,7 +82,7 @@ void IsrEntry()
uintptr_t *Svcall(unsigned int ipsr , uintptr_t* contex )
{
#ifdef TASK_ISOLATION
__svcall(contex);
_svcall(contex);
#endif
return contex;
}

2
arch/arm/cortex-m4/svc_handle.c

@ -46,7 +46,7 @@ static void SvcDispatch(void)
}
void __svcall(uintptr_t* contex)
void _svcall(uintptr_t* contex)
{
uint32_t svc_number;
KTaskDescriptorType tid;

16
board/aiit-arm32-board/third_party_driver/ch438/connect_ch438.c

@ -1292,7 +1292,7 @@ int Stm32HwCh438Init(void)
serial_dev_0.haldev.private_data = (void *)&dev_param_0;
ret = Stm32Ch438DevRegister(&serial_dev_0, CH438_DEVICE_NAME_0);
if (ret != EOK) {
KPrintf("hw_ch438_init Stm32Ch438DevRegister error %d\n", ret);
KPrintf("Stm32HwCh438Init Stm32Ch438DevRegister error %d\n", ret);
return ERROR;
}
@ -1302,7 +1302,7 @@ int Stm32HwCh438Init(void)
serial_dev_1.haldev.private_data = (void *)&dev_param_1;
ret = Stm32Ch438DevRegister(&serial_dev_1, CH438_DEVICE_NAME_1);
if (ret != EOK) {
KPrintf("hw_ch438_init Stm32Ch438DevRegister error %d\n", ret);
KPrintf("Stm32HwCh438Init Stm32Ch438DevRegister error %d\n", ret);
return ERROR;
}
@ -1312,7 +1312,7 @@ int Stm32HwCh438Init(void)
serial_dev_2.haldev.private_data = (void *)&dev_param_2;
ret = Stm32Ch438DevRegister(&serial_dev_2, CH438_DEVICE_NAME_2);
if (ret != EOK) {
KPrintf("hw_ch438_init Stm32Ch438DevRegister error %d\n", ret);
KPrintf("Stm32HwCh438Init Stm32Ch438DevRegister error %d\n", ret);
return ERROR;
}
@ -1322,7 +1322,7 @@ int Stm32HwCh438Init(void)
serial_dev_3.haldev.private_data = (void *)&dev_param_3;
ret = Stm32Ch438DevRegister(&serial_dev_3, CH438_DEVICE_NAME_3);
if (ret != EOK) {
KPrintf("hw_ch438_init Stm32Ch438DevRegister error %d\n", ret);
KPrintf("Stm32HwCh438Init Stm32Ch438DevRegister error %d\n", ret);
return ERROR;
}
@ -1332,7 +1332,7 @@ int Stm32HwCh438Init(void)
serial_dev_4.haldev.private_data = (void *)&dev_param_4;
ret = Stm32Ch438DevRegister(&serial_dev_4, CH438_DEVICE_NAME_4);
if (ret != EOK) {
KPrintf("hw_ch438_init Stm32Ch438DevRegister error %d\n", ret);
KPrintf("Stm32HwCh438Init Stm32Ch438DevRegister error %d\n", ret);
return ERROR;
}
@ -1342,7 +1342,7 @@ int Stm32HwCh438Init(void)
serial_dev_5.haldev.private_data = (void *)&dev_param_5;
ret = Stm32Ch438DevRegister(&serial_dev_5, CH438_DEVICE_NAME_5);
if (ret != EOK) {
KPrintf("hw_ch438_init Stm32Ch438DevRegister error %d\n", ret);
KPrintf("Stm32HwCh438Init Stm32Ch438DevRegister error %d\n", ret);
return ERROR;
}
@ -1352,7 +1352,7 @@ int Stm32HwCh438Init(void)
serial_dev_6.haldev.private_data = (void *)&dev_param_6;
ret = Stm32Ch438DevRegister(&serial_dev_6, CH438_DEVICE_NAME_6);
if (ret != EOK) {
KPrintf("hw_ch438_init Stm32Ch438DevRegister error %d\n", ret);
KPrintf("Stm32HwCh438Init Stm32Ch438DevRegister error %d\n", ret);
return ERROR;
}
@ -1362,7 +1362,7 @@ int Stm32HwCh438Init(void)
serial_dev_7.haldev.private_data = (void *)&dev_param_7;
ret = Stm32Ch438DevRegister(&serial_dev_7, CH438_DEVICE_NAME_7);
if (ret != EOK) {
KPrintf("hw_ch438_init Stm32Ch438DevRegister error %d\n", ret);
KPrintf("Stm32HwCh438Init Stm32Ch438DevRegister error %d\n", ret);
return ERROR;
}

4
board/aiit-arm32-board/third_party_driver/include/connect_ch438.h

@ -287,7 +287,7 @@
#define DIR_485CH3_PIN 123 //485ch3 = ext_uart7
void CH438RegTest(unsigned char num);
void Set485Input(uint8 ch_no);
void set_485_output(uint8 ch_no);
void Set485Input(uint8 ch_no);
void Set485Output(uint8 ch_no);
#endif

4
board/aiit-riscv64-board/board.c

@ -55,7 +55,7 @@ extern void entry(void);
extern void SecondaryCpuCStart(void);
extern void ShutdownCpu(void);
extern int IoConfigInit(void);
extern int hw_ch438_init(void);
extern int HwCh438Init(void);
extern int HwSpiInit(void);
extern int HwLcdInit(void);
extern int HwWdtInit(void);
@ -138,7 +138,7 @@ struct InitSequenceDesc _board_init[] =
#endif
#ifdef BSP_USING_CH438
{ "hw_extuart", hw_ch438_init },
{ "hw_extuart", HwCh438Init },
#endif
#ifdef BSP_USING_SPI
{ "hw_spi", HwSpiInit },

30
board/aiit-riscv64-board/third_party_driver/ch438/connect_ch438.c

@ -184,7 +184,7 @@ void Set485Input(uint8 ch_no)
}
}
void Set485Output(uint8 ch_no)
void Set485Output(uint8 ch_no)
{
struct PinStat pin_stat;
struct BusBlockWriteParam write_param;
@ -1173,20 +1173,20 @@ static uint32 Ch438DevRegister(struct SerialHardwareDevice *serial_dev, char *de
serial_dev->ext_serial_mode = RET_TRUE;
ret = SerialDeviceRegister(serial_dev, NONE, dev_name);
if (ret != EOK) {
KPrintf("hw_ch438_init Serial device %s register error %d\n", dev_name, ret);
KPrintf("HwCh438Init Serial device %s register error %d\n", dev_name, ret);
return ERROR;
}
ret = SerialDeviceAttachToBus(dev_name, CH438_BUS_NAME);
if (ret != EOK) {
KPrintf("hw_ch438_init Serial device %s register error %d\n", dev_name, ret);
KPrintf("HwCh438Init Serial device %s register error %d\n", dev_name, ret);
return ERROR;
}
return ret;
}
int hw_ch438_init(void)
int HwCh438Init(void)
{
static struct SerialBus serial_bus;
static struct SerialDriver serial_drv;
@ -1195,20 +1195,20 @@ int hw_ch438_init(void)
ret = SerialBusInit(&serial_bus, CH438_BUS_NAME);
if (ret != EOK) {
KPrintf("hw_ch438_init Serial bus init error %d\n", ret);
KPrintf("HwCh438Init Serial bus init error %d\n", ret);
return ERROR;
}
serial_drv.configure = &Ch438DrvConfigure;
ret = SerialDriverInit(&serial_drv, CH438_DRIVER_NAME);
if (ret != EOK) {
KPrintf("hw_ch438_init Serial driver init error %d\n", ret);
KPrintf("HwCh438Init Serial driver init error %d\n", ret);
return ERROR;
}
ret = SerialDriverAttachToBus(CH438_DRIVER_NAME, CH438_BUS_NAME);
if (ret != EOK) {
KPrintf("hw_ch438_init Serial driver attach error %d\n", ret);
KPrintf("HwCh438Init Serial driver attach error %d\n", ret);
return ERROR;
}
@ -1218,7 +1218,7 @@ int hw_ch438_init(void)
serial_dev_0.haldev.private_data = (void *)&dev_param_0;
ret = Ch438DevRegister(&serial_dev_0, CH438_DEVICE_NAME_0);
if (ret != EOK) {
KPrintf("hw_ch438_init Ch438DevRegister error %d\n", ret);
KPrintf("HwCh438Init Ch438DevRegister error %d\n", ret);
return ERROR;
}
@ -1228,7 +1228,7 @@ int hw_ch438_init(void)
serial_dev_1.haldev.private_data = (void *)&dev_param_1;
ret = Ch438DevRegister(&serial_dev_1, CH438_DEVICE_NAME_1);
if (ret != EOK) {
KPrintf("hw_ch438_init Ch438DevRegister error %d\n", ret);
KPrintf("HwCh438Init Ch438DevRegister error %d\n", ret);
return ERROR;
}
@ -1238,7 +1238,7 @@ int hw_ch438_init(void)
serial_dev_2.haldev.private_data = (void *)&dev_param_2;
ret = Ch438DevRegister(&serial_dev_2, CH438_DEVICE_NAME_2);
if (ret != EOK) {
KPrintf("hw_ch438_init Ch438DevRegister error %d\n", ret);
KPrintf("HwCh438Init Ch438DevRegister error %d\n", ret);
return ERROR;
}
@ -1248,7 +1248,7 @@ int hw_ch438_init(void)
serial_dev_3.haldev.private_data = (void *)&dev_param_3;
ret = Ch438DevRegister(&serial_dev_3, CH438_DEVICE_NAME_3);
if (ret != EOK) {
KPrintf("hw_ch438_init Ch438DevRegister error %d\n", ret);
KPrintf("HwCh438Init Ch438DevRegister error %d\n", ret);
return ERROR;
}
@ -1258,7 +1258,7 @@ int hw_ch438_init(void)
serial_dev_4.haldev.private_data = (void *)&dev_param_4;
ret = Ch438DevRegister(&serial_dev_4, CH438_DEVICE_NAME_4);
if (ret != EOK) {
KPrintf("hw_ch438_init Ch438DevRegister error %d\n", ret);
KPrintf("HwCh438Init Ch438DevRegister error %d\n", ret);
return ERROR;
}
@ -1268,7 +1268,7 @@ int hw_ch438_init(void)
serial_dev_5.haldev.private_data = (void *)&dev_param_5;
ret = Ch438DevRegister(&serial_dev_5, CH438_DEVICE_NAME_5);
if (ret != EOK) {
KPrintf("hw_ch438_init Ch438DevRegister error %d\n", ret);
KPrintf("HwCh438Init Ch438DevRegister error %d\n", ret);
return ERROR;
}
@ -1278,7 +1278,7 @@ int hw_ch438_init(void)
serial_dev_6.private_data = (void *)&dev_param_6;
ret = Ch438DevRegister(&serial_dev_6, CH438_DEVICE_NAME_6);
if (ret != EOK) {
KPrintf("hw_ch438_init Ch438DevRegister error %d\n", ret);
KPrintf("HwCh438Init Ch438DevRegister error %d\n", ret);
return ERROR;
}
@ -1288,7 +1288,7 @@ int hw_ch438_init(void)
serial_dev_7.private_data = (void *)&dev_param_7;
ret = Ch438DevRegister(&serial_dev_7, CH438_DEVICE_NAME_7);
if (ret != EOK) {
KPrintf("hw_ch438_init Ch438DevRegister error %d\n", ret);
KPrintf("HwCh438Init Ch438DevRegister error %d\n", ret);
return ERROR;
}

2
board/aiit-riscv64-board/third_party_driver/include/connect_ch438.h

@ -254,6 +254,6 @@
#define Fpclk 1843200 /* Define the internal clock frequency */
void Set485Input(uint8 ch_no);
void set_485_output(uint8 ch_no);
void Set485Output(uint8 ch_no);
#endif

2
framework/connection/Adapter/src/xs_adapter_at_agent.c

@ -336,7 +336,7 @@ static void ATAgentReceiveProcess(void *param)
static int ATAgentInit(ATAgentType agent)
{
int result = EOK;
utask_x at_utask;
UtaskType at_utask;
do
{
agent->maintain_len = 0;

2
framework/connection/Adapter/zigbee/xs_adapter_zigbee.c

@ -105,7 +105,7 @@ int ZigbeeReceive(struct Adapter *padapter, char* rev_buffer, int buffer_len,int
x_err_t ret = EOK;
/* Set callback function */
/* Create thread serial */
utask_x recv;
UtaskType recv;
recv.name[0] = 'z';
recv.func_entry = SerialThreadEntry;
recv.func_param = NONE;

2
framework/perception/pm/ps5308/ps5308.c

@ -71,7 +71,7 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
result = ioctl(sdev->fd, OPE_INT, &cfg);
utask_x active_task;
UtaskType active_task;
const char name[NAME_NUM_MAX] = "ps5308_task";
strncpy(active_task.name, name, strlen(name));

2
framework/perception/voice/d124/d124.c

@ -71,7 +71,7 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
result = ioctl(sdev->fd, OPE_INT, &cfg);
utask_x active_task;
UtaskType active_task;
const char name[NAME_NUM_MAX] = "d124_task";
strncpy(active_task.name, name, strlen(name));

8
kernel/include/user_api.h

@ -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

6
kernel/include/xs_init.h

@ -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);

2
kernel/include/xs_queue_manager.h

@ -42,6 +42,6 @@ enum QUEUE_TYPE
};
extern void *g_queue_done[];
extern void queuemanager_done_register();
extern void QueuemanagerDoneRegister();
#endif

12
kernel/include/xs_waitqueue.h

@ -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);

4
kernel/kernel_service/xs_service.c

@ -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);
}

22
kernel/kernel_test/test_i2c.c

@ -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");

8
kernel/kernel_test/user_api.h

@ -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

16
kernel/thread/init.c

@ -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

24
kernel/thread/isr.c

@ -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()

4
kernel/thread/kservicetask.c

@ -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();

2
kernel/thread/queue_manager.c

@ -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;

2
lib/libcpp/cppinit.c

@ -31,7 +31,7 @@ Modification:
1. support cppinit function
*************************************************/
int cplusplus_system_init(void)
int CplusplusSystemInit(void)
{
typedef void(*pfunc)();

24
tool/shell/letter-shell/file_ext/msh_file.c

@ -207,7 +207,7 @@ err:
return -1;
}
int cmd_cp(int argc, char *argv[])
int CmdCp(int argc, char *argv[])
{
if (argc != 3) {
KPrintf("Usage: cp SOURCE DEST\n");
@ -223,7 +223,7 @@ int cmd_cp(int argc, char *argv[])
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_DISABLE_RETURN,
cp,cmd_cp, Copy source to dest.);
cp,CmdCp, Copy source to dest.);
static void RmRecursive(char *file_name, int recursive)
@ -255,7 +255,7 @@ static void RmRecursive(char *file_name, int recursive)
unlink(file_name);
}
int cmd_mv(int argc, char *argv[])
int CmdMv(int argc, char *argv[])
{
if (argc != 3) {
KPrintf("Usage: mv SOURCE DEST\n");
@ -272,7 +272,7 @@ int cmd_mv(int argc, char *argv[])
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_DISABLE_RETURN,
mv,cmd_mv, Move frome source to dest.);
mv,CmdMv, Move frome source to dest.);
void cat(const char *filename)
@ -367,14 +367,14 @@ int cmd_cd(int argc, char **argv)
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_DISABLE_RETURN,
cd,cmd_cd, Chage the shell wroking directory.);
int cmd_pwd(int argc, char **argv)
int CmdPwd(int argc, char **argv)
{
KPrintf("%s\n", working_dir);
return 0;
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_DISABLE_RETURN,
pwd,cmd_pwd, print the name of the current working directory.);
pwd,CmdPwd, print the name of the current working directory.);
#endif
@ -537,7 +537,7 @@ SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHE
tar,cmd_tar,create or extarct tar archive.);
int cmd_gzip(int argc, char **argv)
int CmdGzip(int argc, char **argv)
{
extern int gzip(int argc, char **argv);
gzip(argc, argv);
@ -547,10 +547,10 @@ int cmd_gzip(int argc, char **argv)
SHELL_EXPORT_CMD(
SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_DISABLE_RETURN,
gzip,cmd_gzip, creat or extart gzip compressed files);
gzip,CmdGzip, creat or extart gzip compressed files);
int cmd_gunzip(int argc, char **argv)
int CmdGunzip(int argc, char **argv)
{
extern int gunzip(int argc, char **argv);
gunzip(argc, argv);
@ -560,9 +560,9 @@ int cmd_gunzip(int argc, char **argv)
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_DISABLE_RETURN,
gunzip,cmd_gunzip,decompress gzip files.);
gunzip,CmdGunzip,decompress gzip files.);
int cmd_unzip(int argc, char **argv)
int CmdUnzip(int argc, char **argv)
{
extern int unzip(int argc, char **argv);
unzip(argc, argv);
@ -571,7 +571,7 @@ int cmd_unzip(int argc, char **argv)
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_DISABLE_RETURN,
unzip,cmd_unzip, decompress zip files.);
unzip,CmdUnzip, decompress zip files.);
int cmd_bzip2(int argc, char **argv)

Loading…
Cancel
Save