W5500 is supported on the xidatong riscv64 ch438 is supported on the xidatong arm32 lora and bluetooth is supported on the xidatong arm32 from Tian_chunyu

it is OK
This commit is contained in:
xuedongliang
2022-08-29 11:59:06 +08:00
53 changed files with 13795 additions and 67 deletions
@@ -55,9 +55,30 @@ if ADD_NUTTX_FETURES
endif
if ADD_RTTHREAD_FETURES
config ADAPTER_HC08_DRIVER
string "HC08 device uart driver path"
default "/dev/uart4"
config ADAPTER_HC08_RECV_BUFFER_SIZE
int "HC08 recv data buffer size"
default "128"
config ADAPTER_HC08_WORK_ROLE
string "HC08 work role M(MASTER) or S(SLAVER)"
default "M"
config ADAPTER_HC08_DRIVER_EXTUART
bool "Using extra uart to support bluetooth"
default n
config ADAPTER_HC08_DRIVER
string "HC08 device uart driver path"
default "/dev/dev2"
depends on !ADAPTER_HC08_DRIVER_EXTUART
if ADAPTER_HC08_DRIVER_EXTUART
config ADAPTER_HC08_DRIVER
string "HC08 device extra uart driver path"
default "/dev/dev2"
config ADAPTER_HC08_DRIVER_EXT_PORT
int "if HC08 device using extuart, choose port"
default "2"
endif
endif
@@ -189,6 +189,30 @@ static int Hc08AtConfigure(ATAgentType agent, enum Hc08AtCmd hc08_at_cmd, void *
AtSetReplyCharNum(agent, 13);
ATOrderSend(agent, REPLY_TIME_OUT, reply, cmd_str);
reply_ok_flag = 0;
break;
case HC08_AT_CMD_GET_SUUID:
AtSetReplyCharNum(agent, 13);
ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_GET_SUUID_CMD);
reply_ok_flag = 0;
break;
case HC08_AT_CMD_SET_SUUID:
luuid = *(unsigned int *)param;
sprintf(cmd_str, HC08_SET_SUUID_CMD, luuid);
AtSetReplyCharNum(agent, 13);
ATOrderSend(agent, REPLY_TIME_OUT, reply, cmd_str);
reply_ok_flag = 0;
break;
case HC08_AT_CMD_GET_TUUID:
AtSetReplyCharNum(agent, 13);
ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_GET_TUUID_CMD);
reply_ok_flag = 0;
break;
case HC08_AT_CMD_SET_TUUID:
luuid = *(unsigned int *)param;
sprintf(cmd_str, HC08_SET_TUUID_CMD, luuid);
AtSetReplyCharNum(agent, 13);
ATOrderSend(agent, REPLY_TIME_OUT, reply, cmd_str);
reply_ok_flag = 0;
break;
default:
printf("hc08 do not support no.%d cmd\n", hc08_at_cmd);
@@ -310,7 +334,8 @@ static int Hc08Ioctl(struct Adapter *adapter, int cmd, void *args)
return 0;
}
#else
#else
static int Hc08Ioctl(struct Adapter *adapter, int cmd, void *args)
{
if (OPE_INT != cmd) {
@@ -362,27 +387,45 @@ static int Hc08Ioctl(struct Adapter *adapter, int cmd, void *args)
}
PrivTaskDelay(500);
#ifdef ADD_RTTHREAD_FETURES
//Step3 : show hc08 device info, hc08_get send "AT+RX" response device info
// char device_info[HC08_RESP_DEFAULT_SIZE * 2] = {0};
// if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_GET_DEVICE_INFO, NULL, device_info) < 0) {
// return -1;
// }
char device_info[HC08_RESP_DEFAULT_SIZE * 2] = {0};
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_GET_DEVICE_INFO, NULL, device_info) < 0) {
return -1;
}
#endif
//Step4 : set LUUID、SUUID、TUUID, slave and master need to have same uuid param
luuid = 1234;
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_SET_LUUID, &luuid, NULL) < 0) {
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_SET_LUUID, &luuid, NULL) < 0) {
return -1;
}
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_GET_LUUID, NULL, NULL) < 0) {
return -1;
}
#ifdef ADD_RTTHREAD_FETURES
uint32_t suuid=1234;
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_SET_SUUID, &luuid, NULL) < 0) {
return -1;
}
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_GET_SUUID, NULL, NULL) < 0) {
return -1;
}
uint32_t tuuid=1234;
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_SET_TUUID, &tuuid, NULL) < 0) {
return -1;
}
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_GET_TUUID, NULL, NULL) < 0) {
return -1;
}
#endif
ADAPTER_DEBUG("Hc08 ioctl done\n");
return 0;
}
#endif
static int Hc08SetAddr(struct Adapter *adapter, const char *ip, const char *gateway, const char *netmask)