forked from xuos/xiuos
optimize code standards
This commit is contained in:
parent
34383bdcde
commit
b4e108d620
|
@ -22,14 +22,14 @@ class Animal //parent class
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void eat()
|
virtual void Eat()
|
||||||
{
|
{
|
||||||
|
|
||||||
KPrintf("eat\n");
|
KPrintf("eat\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sleep()
|
void Sleep()
|
||||||
{
|
{
|
||||||
KPrintf("sleep\n");
|
KPrintf("sleep\n");
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ class Fish :public Animal //subclass
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void eat()
|
void Eat()
|
||||||
{
|
{
|
||||||
KPrintf("fish eat\n");
|
KPrintf("fish eat\n");
|
||||||
|
|
||||||
|
@ -50,33 +50,28 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void doeat(Animal& animal)
|
void Doeat(Animal& animal)
|
||||||
{
|
{
|
||||||
animal.eat();
|
animal.Eat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MemTest2()
|
||||||
void mem_test2()
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *ptr = NULL; /* memory pointer */
|
char *ptr = NULL; /* memory pointer */
|
||||||
|
|
||||||
for (i = 0; ; i++)
|
for (i = 0; ; i++) {
|
||||||
{
|
|
||||||
/* allocate (1<<i) bytes memory every single time */
|
/* allocate (1<<i) bytes memory every single time */
|
||||||
ptr = (char *)operator new(1 << i);
|
ptr = (char *)operator new(1 << i);
|
||||||
|
|
||||||
/* if allocate successfully */
|
/* if allocate successfully */
|
||||||
if (ptr != NULL)
|
if (ptr != NULL) {
|
||||||
{
|
|
||||||
KPrintf("get memory :%d byte\n", (1 << i));
|
KPrintf("get memory :%d byte\n", (1 << i));
|
||||||
/* release the memory */
|
/* release the memory */
|
||||||
operator delete(ptr);
|
operator delete(ptr);
|
||||||
KPrintf("free memory :%d byte\n", (1 << i));
|
KPrintf("free memory :%d byte\n", (1 << i));
|
||||||
ptr = NULL;
|
ptr = NULL;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
KPrintf("try to get %d byte memory failed!\n", (1 << i));
|
KPrintf("try to get %d byte memory failed!\n", (1 << i));
|
||||||
break;
|
break;
|
||||||
//return 0;
|
//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);
|
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);
|
KPrintf("output is 2 int number: %d and %d\n", a,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void myswap(T& a, T& b)
|
void MySwap(T& a, T& b)
|
||||||
{
|
{
|
||||||
T temp = a;
|
T temp = a;
|
||||||
a = b;
|
a = b;
|
||||||
|
@ -104,19 +100,17 @@ void myswap(T& a, T& b)
|
||||||
|
|
||||||
extern "C" int cppmain(void)
|
extern "C" int cppmain(void)
|
||||||
{
|
{
|
||||||
mem_test2();
|
MemTest2();
|
||||||
|
|
||||||
class Fish fish;
|
class Fish fish;
|
||||||
doeat(fish);
|
Doeat(fish);
|
||||||
|
|
||||||
int a = 3;
|
int a = 3;
|
||||||
int b = 5;
|
int b = 5;
|
||||||
void overload_test(int a, int b);
|
void OverLoadTestDouble(int a, int b);
|
||||||
overload_test(a, b);
|
OverLoadTestDouble(a, b);
|
||||||
myswap(a,b);
|
MySwap(a,b);
|
||||||
KPrintf("with template the output is: %d and %d\n", a,b);
|
KPrintf("with template the output is: %d and %d\n", a,b);
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @description: Read a PM1.0
|
* @description: Read a PM1.0
|
||||||
* @return 0
|
* @return 0
|
||||||
*/
|
*/
|
||||||
void Pm1_0Ps5308(void)
|
void Pm10Ps5308(void)
|
||||||
{
|
{
|
||||||
struct SensorQuantity *pm1_0 = SensorQuantityFind(SENSOR_QUANTITY_PS5308_PM1_0, SENSOR_QUANTITY_PM);
|
struct SensorQuantity *pm1_0 = SensorQuantityFind(SENSOR_QUANTITY_PS5308_PM1_0, SENSOR_QUANTITY_PM);
|
||||||
SensorQuantityOpen(pm1_0);
|
SensorQuantityOpen(pm1_0);
|
||||||
|
|
|
@ -26,7 +26,7 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
|
||||||
{
|
{
|
||||||
int ret ;
|
int ret ;
|
||||||
int pid ;
|
int pid ;
|
||||||
utask_x task ;
|
UtaskType task ;
|
||||||
task.func_entry = start_routine ;
|
task.func_entry = start_routine ;
|
||||||
task.func_param = arg ;
|
task.func_param = arg ;
|
||||||
memcpy(task.name , "utask", 6);
|
memcpy(task.name , "utask", 6);
|
||||||
|
|
|
@ -56,11 +56,11 @@ struct utask
|
||||||
int32_t stack_size;
|
int32_t stack_size;
|
||||||
uint8_t prio;
|
uint8_t prio;
|
||||||
};
|
};
|
||||||
typedef struct utask utask_x;
|
typedef struct utask UtaskType;
|
||||||
|
|
||||||
typedef void DIR;
|
typedef void DIR;
|
||||||
|
|
||||||
int32_t UserTaskCreate(utask_x utask);
|
int32_t UserTaskCreate(UtaskType utask);
|
||||||
|
|
||||||
x_err_t UserTaskStartup(int32_t id);
|
x_err_t UserTaskStartup(int32_t id);
|
||||||
x_err_t UserTaskDelete(int32_t id);
|
x_err_t UserTaskDelete(int32_t id);
|
||||||
|
@ -178,8 +178,8 @@ struct utask
|
||||||
int32_t stack_size;
|
int32_t stack_size;
|
||||||
uint8_t prio;
|
uint8_t prio;
|
||||||
};
|
};
|
||||||
typedef struct utask utask_x;
|
typedef struct utask UtaskType;
|
||||||
int32_t UserTaskCreate(utask_x utask);
|
int32_t UserTaskCreate(UtaskType utask);
|
||||||
|
|
||||||
#define UserTaskStartup StartupKTask
|
#define UserTaskStartup StartupKTask
|
||||||
#define UserTaskDelete KTaskDelete
|
#define UserTaskDelete KTaskDelete
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
*
|
*
|
||||||
* @return EOK on success; ENOMEMORY/EEMPTY on failure
|
* @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);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ void IsrEntry()
|
||||||
uintptr_t *Svcall(unsigned int ipsr , uintptr_t* contex )
|
uintptr_t *Svcall(unsigned int ipsr , uintptr_t* contex )
|
||||||
{
|
{
|
||||||
#ifdef TASK_ISOLATION
|
#ifdef TASK_ISOLATION
|
||||||
__svcall(contex);
|
_svcall(contex);
|
||||||
#endif
|
#endif
|
||||||
return contex;
|
return contex;
|
||||||
}
|
}
|
|
@ -46,7 +46,7 @@ static void SvcDispatch(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void __svcall(uintptr_t* contex)
|
void _svcall(uintptr_t* contex)
|
||||||
{
|
{
|
||||||
uint32_t svc_number;
|
uint32_t svc_number;
|
||||||
KTaskDescriptorType tid;
|
KTaskDescriptorType tid;
|
||||||
|
|
|
@ -1292,7 +1292,7 @@ int Stm32HwCh438Init(void)
|
||||||
serial_dev_0.haldev.private_data = (void *)&dev_param_0;
|
serial_dev_0.haldev.private_data = (void *)&dev_param_0;
|
||||||
ret = Stm32Ch438DevRegister(&serial_dev_0, CH438_DEVICE_NAME_0);
|
ret = Stm32Ch438DevRegister(&serial_dev_0, CH438_DEVICE_NAME_0);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("hw_ch438_init Stm32Ch438DevRegister error %d\n", ret);
|
KPrintf("Stm32HwCh438Init Stm32Ch438DevRegister error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1302,7 +1302,7 @@ int Stm32HwCh438Init(void)
|
||||||
serial_dev_1.haldev.private_data = (void *)&dev_param_1;
|
serial_dev_1.haldev.private_data = (void *)&dev_param_1;
|
||||||
ret = Stm32Ch438DevRegister(&serial_dev_1, CH438_DEVICE_NAME_1);
|
ret = Stm32Ch438DevRegister(&serial_dev_1, CH438_DEVICE_NAME_1);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("hw_ch438_init Stm32Ch438DevRegister error %d\n", ret);
|
KPrintf("Stm32HwCh438Init Stm32Ch438DevRegister error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1312,7 +1312,7 @@ int Stm32HwCh438Init(void)
|
||||||
serial_dev_2.haldev.private_data = (void *)&dev_param_2;
|
serial_dev_2.haldev.private_data = (void *)&dev_param_2;
|
||||||
ret = Stm32Ch438DevRegister(&serial_dev_2, CH438_DEVICE_NAME_2);
|
ret = Stm32Ch438DevRegister(&serial_dev_2, CH438_DEVICE_NAME_2);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("hw_ch438_init Stm32Ch438DevRegister error %d\n", ret);
|
KPrintf("Stm32HwCh438Init Stm32Ch438DevRegister error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1322,7 +1322,7 @@ int Stm32HwCh438Init(void)
|
||||||
serial_dev_3.haldev.private_data = (void *)&dev_param_3;
|
serial_dev_3.haldev.private_data = (void *)&dev_param_3;
|
||||||
ret = Stm32Ch438DevRegister(&serial_dev_3, CH438_DEVICE_NAME_3);
|
ret = Stm32Ch438DevRegister(&serial_dev_3, CH438_DEVICE_NAME_3);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("hw_ch438_init Stm32Ch438DevRegister error %d\n", ret);
|
KPrintf("Stm32HwCh438Init Stm32Ch438DevRegister error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1332,7 +1332,7 @@ int Stm32HwCh438Init(void)
|
||||||
serial_dev_4.haldev.private_data = (void *)&dev_param_4;
|
serial_dev_4.haldev.private_data = (void *)&dev_param_4;
|
||||||
ret = Stm32Ch438DevRegister(&serial_dev_4, CH438_DEVICE_NAME_4);
|
ret = Stm32Ch438DevRegister(&serial_dev_4, CH438_DEVICE_NAME_4);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("hw_ch438_init Stm32Ch438DevRegister error %d\n", ret);
|
KPrintf("Stm32HwCh438Init Stm32Ch438DevRegister error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1342,7 +1342,7 @@ int Stm32HwCh438Init(void)
|
||||||
serial_dev_5.haldev.private_data = (void *)&dev_param_5;
|
serial_dev_5.haldev.private_data = (void *)&dev_param_5;
|
||||||
ret = Stm32Ch438DevRegister(&serial_dev_5, CH438_DEVICE_NAME_5);
|
ret = Stm32Ch438DevRegister(&serial_dev_5, CH438_DEVICE_NAME_5);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("hw_ch438_init Stm32Ch438DevRegister error %d\n", ret);
|
KPrintf("Stm32HwCh438Init Stm32Ch438DevRegister error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1352,7 +1352,7 @@ int Stm32HwCh438Init(void)
|
||||||
serial_dev_6.haldev.private_data = (void *)&dev_param_6;
|
serial_dev_6.haldev.private_data = (void *)&dev_param_6;
|
||||||
ret = Stm32Ch438DevRegister(&serial_dev_6, CH438_DEVICE_NAME_6);
|
ret = Stm32Ch438DevRegister(&serial_dev_6, CH438_DEVICE_NAME_6);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("hw_ch438_init Stm32Ch438DevRegister error %d\n", ret);
|
KPrintf("Stm32HwCh438Init Stm32Ch438DevRegister error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1362,7 +1362,7 @@ int Stm32HwCh438Init(void)
|
||||||
serial_dev_7.haldev.private_data = (void *)&dev_param_7;
|
serial_dev_7.haldev.private_data = (void *)&dev_param_7;
|
||||||
ret = Stm32Ch438DevRegister(&serial_dev_7, CH438_DEVICE_NAME_7);
|
ret = Stm32Ch438DevRegister(&serial_dev_7, CH438_DEVICE_NAME_7);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("hw_ch438_init Stm32Ch438DevRegister error %d\n", ret);
|
KPrintf("Stm32HwCh438Init Stm32Ch438DevRegister error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -288,6 +288,6 @@
|
||||||
|
|
||||||
void CH438RegTest(unsigned char num);
|
void CH438RegTest(unsigned char num);
|
||||||
void Set485Input(uint8 ch_no);
|
void Set485Input(uint8 ch_no);
|
||||||
void set_485_output(uint8 ch_no);
|
void Set485Output(uint8 ch_no);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -55,7 +55,7 @@ extern void entry(void);
|
||||||
extern void SecondaryCpuCStart(void);
|
extern void SecondaryCpuCStart(void);
|
||||||
extern void ShutdownCpu(void);
|
extern void ShutdownCpu(void);
|
||||||
extern int IoConfigInit(void);
|
extern int IoConfigInit(void);
|
||||||
extern int hw_ch438_init(void);
|
extern int HwCh438Init(void);
|
||||||
extern int HwSpiInit(void);
|
extern int HwSpiInit(void);
|
||||||
extern int HwLcdInit(void);
|
extern int HwLcdInit(void);
|
||||||
extern int HwWdtInit(void);
|
extern int HwWdtInit(void);
|
||||||
|
@ -138,7 +138,7 @@ struct InitSequenceDesc _board_init[] =
|
||||||
#endif
|
#endif
|
||||||
#ifdef BSP_USING_CH438
|
#ifdef BSP_USING_CH438
|
||||||
|
|
||||||
{ "hw_extuart", hw_ch438_init },
|
{ "hw_extuart", HwCh438Init },
|
||||||
#endif
|
#endif
|
||||||
#ifdef BSP_USING_SPI
|
#ifdef BSP_USING_SPI
|
||||||
{ "hw_spi", HwSpiInit },
|
{ "hw_spi", HwSpiInit },
|
||||||
|
|
|
@ -1173,20 +1173,20 @@ static uint32 Ch438DevRegister(struct SerialHardwareDevice *serial_dev, char *de
|
||||||
serial_dev->ext_serial_mode = RET_TRUE;
|
serial_dev->ext_serial_mode = RET_TRUE;
|
||||||
ret = SerialDeviceRegister(serial_dev, NONE, dev_name);
|
ret = SerialDeviceRegister(serial_dev, NONE, dev_name);
|
||||||
if (ret != EOK) {
|
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 ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = SerialDeviceAttachToBus(dev_name, CH438_BUS_NAME);
|
ret = SerialDeviceAttachToBus(dev_name, CH438_BUS_NAME);
|
||||||
if (ret != EOK) {
|
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 ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hw_ch438_init(void)
|
int HwCh438Init(void)
|
||||||
{
|
{
|
||||||
static struct SerialBus serial_bus;
|
static struct SerialBus serial_bus;
|
||||||
static struct SerialDriver serial_drv;
|
static struct SerialDriver serial_drv;
|
||||||
|
@ -1195,20 +1195,20 @@ int hw_ch438_init(void)
|
||||||
|
|
||||||
ret = SerialBusInit(&serial_bus, CH438_BUS_NAME);
|
ret = SerialBusInit(&serial_bus, CH438_BUS_NAME);
|
||||||
if (ret != EOK) {
|
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;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_drv.configure = &Ch438DrvConfigure;
|
serial_drv.configure = &Ch438DrvConfigure;
|
||||||
ret = SerialDriverInit(&serial_drv, CH438_DRIVER_NAME);
|
ret = SerialDriverInit(&serial_drv, CH438_DRIVER_NAME);
|
||||||
if (ret != EOK) {
|
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;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = SerialDriverAttachToBus(CH438_DRIVER_NAME, CH438_BUS_NAME);
|
ret = SerialDriverAttachToBus(CH438_DRIVER_NAME, CH438_BUS_NAME);
|
||||||
if (ret != EOK) {
|
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;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1218,7 +1218,7 @@ int hw_ch438_init(void)
|
||||||
serial_dev_0.haldev.private_data = (void *)&dev_param_0;
|
serial_dev_0.haldev.private_data = (void *)&dev_param_0;
|
||||||
ret = Ch438DevRegister(&serial_dev_0, CH438_DEVICE_NAME_0);
|
ret = Ch438DevRegister(&serial_dev_0, CH438_DEVICE_NAME_0);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("hw_ch438_init Ch438DevRegister error %d\n", ret);
|
KPrintf("HwCh438Init Ch438DevRegister error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1228,7 +1228,7 @@ int hw_ch438_init(void)
|
||||||
serial_dev_1.haldev.private_data = (void *)&dev_param_1;
|
serial_dev_1.haldev.private_data = (void *)&dev_param_1;
|
||||||
ret = Ch438DevRegister(&serial_dev_1, CH438_DEVICE_NAME_1);
|
ret = Ch438DevRegister(&serial_dev_1, CH438_DEVICE_NAME_1);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("hw_ch438_init Ch438DevRegister error %d\n", ret);
|
KPrintf("HwCh438Init Ch438DevRegister error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1238,7 +1238,7 @@ int hw_ch438_init(void)
|
||||||
serial_dev_2.haldev.private_data = (void *)&dev_param_2;
|
serial_dev_2.haldev.private_data = (void *)&dev_param_2;
|
||||||
ret = Ch438DevRegister(&serial_dev_2, CH438_DEVICE_NAME_2);
|
ret = Ch438DevRegister(&serial_dev_2, CH438_DEVICE_NAME_2);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("hw_ch438_init Ch438DevRegister error %d\n", ret);
|
KPrintf("HwCh438Init Ch438DevRegister error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1248,7 +1248,7 @@ int hw_ch438_init(void)
|
||||||
serial_dev_3.haldev.private_data = (void *)&dev_param_3;
|
serial_dev_3.haldev.private_data = (void *)&dev_param_3;
|
||||||
ret = Ch438DevRegister(&serial_dev_3, CH438_DEVICE_NAME_3);
|
ret = Ch438DevRegister(&serial_dev_3, CH438_DEVICE_NAME_3);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("hw_ch438_init Ch438DevRegister error %d\n", ret);
|
KPrintf("HwCh438Init Ch438DevRegister error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1258,7 +1258,7 @@ int hw_ch438_init(void)
|
||||||
serial_dev_4.haldev.private_data = (void *)&dev_param_4;
|
serial_dev_4.haldev.private_data = (void *)&dev_param_4;
|
||||||
ret = Ch438DevRegister(&serial_dev_4, CH438_DEVICE_NAME_4);
|
ret = Ch438DevRegister(&serial_dev_4, CH438_DEVICE_NAME_4);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("hw_ch438_init Ch438DevRegister error %d\n", ret);
|
KPrintf("HwCh438Init Ch438DevRegister error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1268,7 +1268,7 @@ int hw_ch438_init(void)
|
||||||
serial_dev_5.haldev.private_data = (void *)&dev_param_5;
|
serial_dev_5.haldev.private_data = (void *)&dev_param_5;
|
||||||
ret = Ch438DevRegister(&serial_dev_5, CH438_DEVICE_NAME_5);
|
ret = Ch438DevRegister(&serial_dev_5, CH438_DEVICE_NAME_5);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("hw_ch438_init Ch438DevRegister error %d\n", ret);
|
KPrintf("HwCh438Init Ch438DevRegister error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1278,7 +1278,7 @@ int hw_ch438_init(void)
|
||||||
serial_dev_6.private_data = (void *)&dev_param_6;
|
serial_dev_6.private_data = (void *)&dev_param_6;
|
||||||
ret = Ch438DevRegister(&serial_dev_6, CH438_DEVICE_NAME_6);
|
ret = Ch438DevRegister(&serial_dev_6, CH438_DEVICE_NAME_6);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("hw_ch438_init Ch438DevRegister error %d\n", ret);
|
KPrintf("HwCh438Init Ch438DevRegister error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1288,7 +1288,7 @@ int hw_ch438_init(void)
|
||||||
serial_dev_7.private_data = (void *)&dev_param_7;
|
serial_dev_7.private_data = (void *)&dev_param_7;
|
||||||
ret = Ch438DevRegister(&serial_dev_7, CH438_DEVICE_NAME_7);
|
ret = Ch438DevRegister(&serial_dev_7, CH438_DEVICE_NAME_7);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("hw_ch438_init Ch438DevRegister error %d\n", ret);
|
KPrintf("HwCh438Init Ch438DevRegister error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -254,6 +254,6 @@
|
||||||
#define Fpclk 1843200 /* Define the internal clock frequency */
|
#define Fpclk 1843200 /* Define the internal clock frequency */
|
||||||
|
|
||||||
void Set485Input(uint8 ch_no);
|
void Set485Input(uint8 ch_no);
|
||||||
void set_485_output(uint8 ch_no);
|
void Set485Output(uint8 ch_no);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -336,7 +336,7 @@ static void ATAgentReceiveProcess(void *param)
|
||||||
static int ATAgentInit(ATAgentType agent)
|
static int ATAgentInit(ATAgentType agent)
|
||||||
{
|
{
|
||||||
int result = EOK;
|
int result = EOK;
|
||||||
utask_x at_utask;
|
UtaskType at_utask;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
agent->maintain_len = 0;
|
agent->maintain_len = 0;
|
||||||
|
|
|
@ -105,7 +105,7 @@ int ZigbeeReceive(struct Adapter *padapter, char* rev_buffer, int buffer_len,int
|
||||||
x_err_t ret = EOK;
|
x_err_t ret = EOK;
|
||||||
/* Set callback function */
|
/* Set callback function */
|
||||||
/* Create thread serial */
|
/* Create thread serial */
|
||||||
utask_x recv;
|
UtaskType recv;
|
||||||
recv.name[0] = 'z';
|
recv.name[0] = 'z';
|
||||||
recv.func_entry = SerialThreadEntry;
|
recv.func_entry = SerialThreadEntry;
|
||||||
recv.func_param = NONE;
|
recv.func_param = NONE;
|
||||||
|
|
|
@ -71,7 +71,7 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
|
||||||
|
|
||||||
result = ioctl(sdev->fd, OPE_INT, &cfg);
|
result = ioctl(sdev->fd, OPE_INT, &cfg);
|
||||||
|
|
||||||
utask_x active_task;
|
UtaskType active_task;
|
||||||
const char name[NAME_NUM_MAX] = "ps5308_task";
|
const char name[NAME_NUM_MAX] = "ps5308_task";
|
||||||
|
|
||||||
strncpy(active_task.name, name, strlen(name));
|
strncpy(active_task.name, name, strlen(name));
|
||||||
|
|
|
@ -71,7 +71,7 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
|
||||||
|
|
||||||
result = ioctl(sdev->fd, OPE_INT, &cfg);
|
result = ioctl(sdev->fd, OPE_INT, &cfg);
|
||||||
|
|
||||||
utask_x active_task;
|
UtaskType active_task;
|
||||||
const char name[NAME_NUM_MAX] = "d124_task";
|
const char name[NAME_NUM_MAX] = "d124_task";
|
||||||
|
|
||||||
strncpy(active_task.name, name, strlen(name));
|
strncpy(active_task.name, name, strlen(name));
|
||||||
|
|
|
@ -56,11 +56,11 @@ struct utask
|
||||||
int32_t stack_size;
|
int32_t stack_size;
|
||||||
uint8_t prio;
|
uint8_t prio;
|
||||||
};
|
};
|
||||||
typedef struct utask utask_x;
|
typedef struct utask UtaskType;
|
||||||
|
|
||||||
typedef void DIR;
|
typedef void DIR;
|
||||||
|
|
||||||
int32_t UserTaskCreate(utask_x utask);
|
int32_t UserTaskCreate(UtaskType utask);
|
||||||
|
|
||||||
x_err_t UserTaskStartup(int32_t id);
|
x_err_t UserTaskStartup(int32_t id);
|
||||||
x_err_t UserTaskDelete(int32_t id);
|
x_err_t UserTaskDelete(int32_t id);
|
||||||
|
@ -178,8 +178,8 @@ struct utask
|
||||||
int32_t stack_size;
|
int32_t stack_size;
|
||||||
uint8_t prio;
|
uint8_t prio;
|
||||||
};
|
};
|
||||||
typedef struct utask utask_x;
|
typedef struct utask UtaskType;
|
||||||
int32_t UserTaskCreate(utask_x utask);
|
int32_t UserTaskCreate(UtaskType utask);
|
||||||
|
|
||||||
#define UserTaskStartup StartupKTask
|
#define UserTaskStartup StartupKTask
|
||||||
#define UserTaskDelete KTaskDelete
|
#define UserTaskDelete KTaskDelete
|
||||||
|
|
|
@ -37,16 +37,14 @@ void InitCmpts(void);
|
||||||
extern int VfsInit(void);
|
extern int VfsInit(void);
|
||||||
extern int WorkSysWorkQueueInit(void);
|
extern int WorkSysWorkQueueInit(void);
|
||||||
extern int FlashW25qxxSpiDeviceInit(void);
|
extern int FlashW25qxxSpiDeviceInit(void);
|
||||||
extern int sal_mbedtls_proto_init(void);
|
|
||||||
extern int FatfsInit(void);
|
extern int FatfsInit(void);
|
||||||
extern int Ch376fsInit(void);
|
extern int Ch376fsInit(void);
|
||||||
extern int LibcSystemInit(void);
|
extern int LibcSystemInit(void);
|
||||||
extern int sal_init(void);
|
|
||||||
extern int RtcNtpSyncInit(void);
|
extern int RtcNtpSyncInit(void);
|
||||||
extern int MountSDCard(void);
|
extern int MountSDCard(void);
|
||||||
extern int dfs_mount_table(void);
|
extern int DfsMountTable(void);
|
||||||
extern int userShellInit(void);
|
extern int userShellInit(void);
|
||||||
extern int stm32_sdcard_mount(void);
|
extern int Stm32SdcardMount(void);
|
||||||
extern int STM32USBHostRegister(void);
|
extern int STM32USBHostRegister(void);
|
||||||
extern int WorkSysWorkQueueInit(void);
|
extern int WorkSysWorkQueueInit(void);
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,6 @@ enum QUEUE_TYPE
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void *g_queue_done[];
|
extern void *g_queue_done[];
|
||||||
extern void queuemanager_done_register();
|
extern void QueuemanagerDoneRegister();
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -48,24 +48,12 @@ struct WaitqueueNode
|
||||||
};
|
};
|
||||||
typedef struct WaitqueueNode WaitqueueNodeType;
|
typedef struct WaitqueueNode WaitqueueNodeType;
|
||||||
|
|
||||||
int __WqueueDefaultWake(struct WaitqueueNode *wait, void *key);
|
|
||||||
void InitWqueue(WaitQueueType *queue);
|
void InitWqueue(WaitQueueType *queue);
|
||||||
void WqueueAdd(WaitQueueType *queue, struct WaitqueueNode *node);
|
void WqueueAdd(WaitQueueType *queue, struct WaitqueueNode *node);
|
||||||
void WqueueRemove(struct WaitqueueNode *node);
|
void WqueueRemove(struct WaitqueueNode *node);
|
||||||
int WqueueWait(WaitQueueType *queue, x_ticks_t tick);
|
int WqueueWait(WaitQueueType *queue, x_ticks_t tick);
|
||||||
void WakeupWqueue(WaitQueueType *queue, void *key);
|
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
|
typedef struct
|
||||||
{
|
{
|
||||||
void (*InitWqueue)(WaitQueueType *queue);
|
void (*InitWqueue)(WaitQueueType *queue);
|
||||||
|
|
|
@ -647,8 +647,8 @@ struct utask
|
||||||
int32_t stack_size;
|
int32_t stack_size;
|
||||||
uint8_t prio;
|
uint8_t prio;
|
||||||
};
|
};
|
||||||
typedef struct utask utask_x;
|
typedef struct utask UtaskType;
|
||||||
int32_t UserTaskCreate(utask_x utask)
|
int32_t UserTaskCreate(UtaskType utask)
|
||||||
{
|
{
|
||||||
return KTaskCreate(utask.name, utask.func_entry, utask.func_param,utask.stack_size,utask.prio);
|
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;
|
uint8 temp[4],ret=0;
|
||||||
MdelayKTask(15);
|
MdelayKTask(15);
|
||||||
ret = WriteReg(i2c_bus->owner_haldev); //reset
|
ret = WriteReg(i2c_bus->owner_haldev); //reset
|
||||||
if(EOK != ret){
|
if(EOK != ret){
|
||||||
KPrintf("read_temp_humi WriteReg failed!\n");
|
KPrintf("ReadTempHumi WriteReg failed!\n");
|
||||||
}
|
}
|
||||||
MdelayKTask(50);
|
MdelayKTask(50);
|
||||||
ret = ReadRegs(i2c_bus->owner_haldev, 4, temp); /* get sensor data */
|
ret = ReadRegs(i2c_bus->owner_haldev, 4, temp); /* get sensor data */
|
||||||
if(EOK != ret){
|
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 */
|
*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 */
|
*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 */
|
/* find I2C device and get I2C handle */
|
||||||
i2c_bus = BusFind(bus_name);
|
i2c_bus = BusFind(bus_name);
|
||||||
if (NONE == i2c_bus){
|
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{
|
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);
|
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);
|
KPrintf("i2c match drv %s %p dev %s %p error\n", drv_name, i2c_bus->owner_driver, dev_name, i2c_bus->owner_haldev);
|
||||||
}
|
}
|
||||||
else{
|
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->write,
|
||||||
i2c_bus->owner_haldev->dev_done->read);
|
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)
|
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)
|
void Hs300xRead(Hs300xDataType *Hs300xDataType)
|
||||||
{
|
{
|
||||||
float humidity = 0.0, temperature = 0.0;
|
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_high = (int)humidity;
|
||||||
Hs300xDataType->humi_low = (int)(humidity*10)%10;
|
Hs300xDataType->humi_low = (int)(humidity*10)%10;
|
||||||
if( temperature >= 0 ) {
|
if( temperature >= 0 ) {
|
||||||
|
@ -140,7 +140,7 @@ void Hs300xRead(Hs300xDataType *Hs300xDataType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tsk_hs300x_test()
|
void TskHs300xTest()
|
||||||
{
|
{
|
||||||
memset(&g_hs300x_data, 0, sizeof(Hs300xDataType));
|
memset(&g_hs300x_data, 0, sizeof(Hs300xDataType));
|
||||||
KPrintf("Tsk create successfully!\n");
|
KPrintf("Tsk create successfully!\n");
|
||||||
|
@ -167,7 +167,7 @@ void Hs300xI2cTest(void)
|
||||||
MdelayKTask(1000);
|
MdelayKTask(1000);
|
||||||
|
|
||||||
x_err_t flag;
|
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);
|
flag = StartupKTask(Tsk_hs300x);
|
||||||
if (EOK != flag){
|
if (EOK != flag){
|
||||||
KPrintf("Hs300xI2cTest StartupKTask failed!\n");
|
KPrintf("Hs300xI2cTest StartupKTask failed!\n");
|
||||||
|
|
|
@ -57,11 +57,11 @@ struct utask
|
||||||
uint32 stack_size;
|
uint32 stack_size;
|
||||||
uint8 prio;
|
uint8 prio;
|
||||||
};
|
};
|
||||||
typedef struct utask utask_x;
|
typedef struct utask UtaskType;
|
||||||
|
|
||||||
typedef void DIR;
|
typedef void DIR;
|
||||||
|
|
||||||
int32 UserTaskCreate(utask_x utask);
|
int32 UserTaskCreate(UtaskType utask);
|
||||||
|
|
||||||
x_err_t UserTaskStartup(int32 id);
|
x_err_t UserTaskStartup(int32 id);
|
||||||
x_err_t UserTaskDelete(int32 id);
|
x_err_t UserTaskDelete(int32 id);
|
||||||
|
@ -170,8 +170,8 @@ struct utask
|
||||||
int32_t stack_size;
|
int32_t stack_size;
|
||||||
uint8_t prio;
|
uint8_t prio;
|
||||||
};
|
};
|
||||||
typedef struct utask utask_x;
|
typedef struct utask UtaskType;
|
||||||
int32_t UserTaskCreate(utask_x utask);
|
int32_t UserTaskCreate(UtaskType utask);
|
||||||
|
|
||||||
#define UserTaskStartup StartupKTask
|
#define UserTaskStartup StartupKTask
|
||||||
#define UserTaskDelete KTaskDelete
|
#define UserTaskDelete KTaskDelete
|
||||||
|
|
|
@ -44,7 +44,7 @@ extern void CreateKServiceKTask(void);
|
||||||
extern int main(void);
|
extern int main(void);
|
||||||
void InitBoardHardware(void);
|
void InitBoardHardware(void);
|
||||||
extern int hook_init(void);
|
extern int hook_init(void);
|
||||||
int cplusplus_system_init(void);
|
int CplusplusSystemInit(void);
|
||||||
|
|
||||||
#ifdef KERNEL_COMPONENTS_INIT
|
#ifdef KERNEL_COMPONENTS_INIT
|
||||||
#ifdef USER_APPLICATION
|
#ifdef USER_APPLICATION
|
||||||
|
@ -64,7 +64,7 @@ struct InitSequenceDesc prev_cmpts_init[] =
|
||||||
{ "vfs", VfsInit },
|
{ "vfs", VfsInit },
|
||||||
#endif
|
#endif
|
||||||
#ifdef LIB_CPLUSPLUS
|
#ifdef LIB_CPLUSPLUS
|
||||||
{ "cplusplus_system", cplusplus_system_init },
|
{ "cplusplus_system", CplusplusSystemInit },
|
||||||
#endif
|
#endif
|
||||||
#ifdef KERNEL_HOOK
|
#ifdef KERNEL_HOOK
|
||||||
{ "hook", hook_init },
|
{ "hook", hook_init },
|
||||||
|
@ -86,9 +86,6 @@ struct InitSequenceDesc device_init[] =
|
||||||
};
|
};
|
||||||
struct InitSequenceDesc components_init[] =
|
struct InitSequenceDesc components_init[] =
|
||||||
{
|
{
|
||||||
#ifdef CONNECTION_AT_SAL_USING_TLS
|
|
||||||
{"sal_mbedtls_proto", sal_mbedtls_proto_init},
|
|
||||||
#endif
|
|
||||||
#ifdef FS_VFS_FATFS
|
#ifdef FS_VFS_FATFS
|
||||||
{ "fatfs", FatfsInit },
|
{ "fatfs", FatfsInit },
|
||||||
#endif
|
#endif
|
||||||
|
@ -96,9 +93,6 @@ struct InitSequenceDesc components_init[] =
|
||||||
{ "ch376", Ch376fsInit },
|
{ "ch376", Ch376fsInit },
|
||||||
#endif
|
#endif
|
||||||
{ "libc_system", LibcSystemInit },
|
{ "libc_system", LibcSystemInit },
|
||||||
#ifdef CONNECTION_AT_OS_USING_SAL
|
|
||||||
// { "sal_init", sal_init },
|
|
||||||
#endif
|
|
||||||
#ifdef RTC_SYNC_USING_NTP
|
#ifdef RTC_SYNC_USING_NTP
|
||||||
{ "rtc_ntp_sync",RtcNtpSyncInit},
|
{ "rtc_ntp_sync",RtcNtpSyncInit},
|
||||||
#endif
|
#endif
|
||||||
|
@ -112,7 +106,7 @@ struct InitSequenceDesc env_init[] =
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef FS_VFS_MNTTABLE
|
#ifdef FS_VFS_MNTTABLE
|
||||||
{ "dfs_mount_table", dfs_mount_table },
|
{ "DfsMountTable", DfsMountTable },
|
||||||
#endif
|
#endif
|
||||||
#ifdef TOOL_SHELL
|
#ifdef TOOL_SHELL
|
||||||
{ "letter-shell system", userShellInit },
|
{ "letter-shell system", userShellInit },
|
||||||
|
@ -122,7 +116,7 @@ struct InitSequenceDesc env_init[] =
|
||||||
struct InitSequenceDesc communication_init[] =
|
struct InitSequenceDesc communication_init[] =
|
||||||
{
|
{
|
||||||
// #ifdef BSP_USING_SDIO
|
// #ifdef BSP_USING_SDIO
|
||||||
// { "stm32_sdcard_mount",stm32_sdcard_mount },
|
// { "Stm32SdcardMount",Stm32SdcardMount },
|
||||||
// #endif
|
// #endif
|
||||||
#ifdef BSP_USING_USBH
|
#ifdef BSP_USING_USBH
|
||||||
{ "STM32USBHostRegister", STM32USBHostRegister },
|
{ "STM32USBHostRegister", STM32USBHostRegister },
|
||||||
|
@ -201,7 +195,7 @@ int XiUOSStartup(void)
|
||||||
DISABLE_INTERRUPT();
|
DISABLE_INTERRUPT();
|
||||||
|
|
||||||
#ifdef KERNEL_QUEUEMANAGE
|
#ifdef KERNEL_QUEUEMANAGE
|
||||||
queuemanager_done_register();
|
QueuemanagerDoneRegister();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef KERNEL_BANNER
|
#ifdef KERNEL_BANNER
|
||||||
|
|
|
@ -44,7 +44,7 @@ extern int GetCpuId(void);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void incIsrCounter()
|
void IncIsrCounter()
|
||||||
{
|
{
|
||||||
#ifdef ARCH_SMP
|
#ifdef ARCH_SMP
|
||||||
isrManager.isr_count[GetCpuId()] ++ ;
|
isrManager.isr_count[GetCpuId()] ++ ;
|
||||||
|
@ -54,7 +54,7 @@ extern int GetCpuId(void);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void decIsrCounter()
|
void DecIsrCounter()
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef ARCH_SMP
|
#ifdef ARCH_SMP
|
||||||
|
@ -65,7 +65,7 @@ extern int GetCpuId(void);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
x_bool Is_InIsr()
|
x_bool IsInIsr()
|
||||||
{
|
{
|
||||||
#ifdef ARCH_SMP
|
#ifdef ARCH_SMP
|
||||||
return ( isrManager.isr_count[GetCpuId()] != 0 ? RET_TRUE : RET_FALSE ) ;
|
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
|
#ifdef ARCH_SMP
|
||||||
|
@ -166,7 +166,7 @@ void IsrCommon(uint32 irq_num)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearIsrSwitchTrigerFlag()
|
void ClearIsrSwitchTrigerFlag()
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef ARCH_SMP
|
#ifdef ARCH_SMP
|
||||||
|
@ -176,7 +176,7 @@ void IsrCommon(uint32 irq_num)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 getIsrSwitchTrigerFlag()
|
uint8 GetIsrSwitchTrigerFlag()
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef ARCH_SMP
|
#ifdef ARCH_SMP
|
||||||
|
@ -188,18 +188,18 @@ void IsrCommon(uint32 irq_num)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct IsrDone isrDone = {
|
struct IsrDone isrDone = {
|
||||||
Is_InIsr,
|
IsInIsr,
|
||||||
RegisterHwIrq ,
|
RegisterHwIrq ,
|
||||||
FreeHwIrq,
|
FreeHwIrq,
|
||||||
EnableHwIrq,
|
EnableHwIrq,
|
||||||
DisableHwIrq,
|
DisableHwIrq,
|
||||||
IsrCommon,
|
IsrCommon,
|
||||||
GetIsrCounter,
|
GetIsrCounter,
|
||||||
incIsrCounter,
|
IncIsrCounter,
|
||||||
decIsrCounter,
|
DecIsrCounter,
|
||||||
getIsrSwitchTrigerFlag,
|
GetIsrSwitchTrigerFlag,
|
||||||
setIsrSwitchTrigerFlag,
|
SetIsrSwitchTrigerFlag,
|
||||||
clearIsrSwitchTrigerFlag
|
ClearIsrSwitchTrigerFlag
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
void SysInitIsrManager()
|
void SysInitIsrManager()
|
||||||
|
|
|
@ -29,7 +29,7 @@ void KSerciveKTaskIdle(void)
|
||||||
InitIdleKTask();
|
InitIdleKTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
void xz_KServiceKTaskRecycle()
|
void KServiceKTaskRecycle()
|
||||||
{
|
{
|
||||||
ZombieTaskRecycleInit();
|
ZombieTaskRecycleInit();
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ void xz_KServiceKTaskRecycle()
|
||||||
void CreateKServiceKTask(void)
|
void CreateKServiceKTask(void)
|
||||||
{
|
{
|
||||||
/* create zombie recycle task */
|
/* create zombie recycle task */
|
||||||
xz_KServiceKTaskRecycle();
|
KServiceKTaskRecycle();
|
||||||
|
|
||||||
/* create idle task */
|
/* create idle task */
|
||||||
KSerciveKTaskIdle();
|
KSerciveKTaskIdle();
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
void* g_queue_done[QUEUE_MAX];
|
void* g_queue_done[QUEUE_MAX];
|
||||||
|
|
||||||
void queuemanager_done_register()
|
void QueuemanagerDoneRegister()
|
||||||
{
|
{
|
||||||
DataQueueDoneType* pdata_queue_done = (DataQueueDoneType*)x_malloc(sizeof(DataQueueDoneType));
|
DataQueueDoneType* pdata_queue_done = (DataQueueDoneType*)x_malloc(sizeof(DataQueueDoneType));
|
||||||
pdata_queue_done->InitDataqueue = InitDataqueue;
|
pdata_queue_done->InitDataqueue = InitDataqueue;
|
||||||
|
|
|
@ -31,7 +31,7 @@ Modification:
|
||||||
1. support cppinit function
|
1. support cppinit function
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
int cplusplus_system_init(void)
|
int CplusplusSystemInit(void)
|
||||||
|
|
||||||
{
|
{
|
||||||
typedef void(*pfunc)();
|
typedef void(*pfunc)();
|
||||||
|
|
|
@ -207,7 +207,7 @@ err:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cmd_cp(int argc, char *argv[])
|
int CmdCp(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (argc != 3) {
|
if (argc != 3) {
|
||||||
KPrintf("Usage: cp SOURCE DEST\n");
|
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,
|
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)
|
static void RmRecursive(char *file_name, int recursive)
|
||||||
|
@ -255,7 +255,7 @@ static void RmRecursive(char *file_name, int recursive)
|
||||||
unlink(file_name);
|
unlink(file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cmd_mv(int argc, char *argv[])
|
int CmdMv(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (argc != 3) {
|
if (argc != 3) {
|
||||||
KPrintf("Usage: mv SOURCE DEST\n");
|
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,
|
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)
|
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,
|
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.);
|
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);
|
KPrintf("%s\n", working_dir);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_DISABLE_RETURN,
|
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
|
#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.);
|
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);
|
extern int gzip(int argc, char **argv);
|
||||||
gzip(argc, argv);
|
gzip(argc, argv);
|
||||||
|
@ -547,10 +547,10 @@ int cmd_gzip(int argc, char **argv)
|
||||||
|
|
||||||
SHELL_EXPORT_CMD(
|
SHELL_EXPORT_CMD(
|
||||||
SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_DISABLE_RETURN,
|
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);
|
extern int gunzip(int argc, char **argv);
|
||||||
gunzip(argc, 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,
|
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);
|
extern int unzip(int argc, char **argv);
|
||||||
unzip(argc, 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,
|
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)
|
int cmd_bzip2(int argc, char **argv)
|
||||||
|
|
Loading…
Reference in New Issue