forked from xuos/xiuos
feat support bluetooth and 4g framework on xidatong board
it is OK
This commit is contained in:
commit
677457daac
|
@ -3,6 +3,11 @@ config ADAPTER_4G_EC200T
|
|||
default "ec200t"
|
||||
|
||||
if ADD_XIZI_FETURES
|
||||
config ADAPTER_EC200T_USING_PWRKEY
|
||||
bool "EC200T using PWRKEY pin number"
|
||||
default n
|
||||
|
||||
if ADAPTER_EC200T_USING_PWRKEY
|
||||
config ADAPTER_EC200T_PWRKEY
|
||||
int "EC200T PWRKEY pin number"
|
||||
default "97"
|
||||
|
@ -10,6 +15,7 @@ if ADD_XIZI_FETURES
|
|||
config ADAPTER_EC200T_PIN_DRIVER
|
||||
string "EC200T device pin driver path"
|
||||
default "/dev/pin_dev"
|
||||
endif
|
||||
|
||||
config ADAPTER_EC200T_DRIVER_EXTUART
|
||||
bool "Using extra uart to support 4G"
|
||||
|
|
|
@ -43,6 +43,7 @@ static void Ec200tPowerSet(void){ return; }
|
|||
#else
|
||||
static void Ec200tPowerSet(void)
|
||||
{
|
||||
#ifdef ADAPTER_EC200T_USING_PWRKEY
|
||||
int pin_fd;
|
||||
pin_fd = PrivOpen(ADAPTER_EC200T_PIN_DRIVER, O_RDWR);
|
||||
if (pin_fd < 0) {
|
||||
|
@ -73,6 +74,7 @@ static void Ec200tPowerSet(void)
|
|||
PrivClose(pin_fd);
|
||||
|
||||
PrivTaskDelay(10000);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -178,7 +178,6 @@ int ATOrderSend(ATAgentType agent, uint32_t timeout_s, ATReplyType reply, const
|
|||
}
|
||||
|
||||
__out:
|
||||
// agent->reply = NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -306,7 +305,6 @@ int EntmRecv(ATAgentType agent, char *rev_buffer, int buffer_len, int timeout_s)
|
|||
}
|
||||
PrivMutexObtain(&agent->lock);
|
||||
|
||||
|
||||
printf("EntmRecv once len %d.\n", agent->entm_recv_len);
|
||||
|
||||
memcpy(rev_buffer, agent->entm_recv_buf, agent->entm_recv_len);
|
||||
|
@ -335,29 +333,24 @@ static int GetCompleteATReply(ATAgentType agent)
|
|||
|
||||
PrivMutexAbandon(&agent->lock);
|
||||
|
||||
while (1)
|
||||
{
|
||||
while (1) {
|
||||
PrivRead(agent->fd, &ch, 1);
|
||||
#ifdef CONNECTION_FRAMEWORK_DEBUG
|
||||
if(ch != 0){
|
||||
if(ch != 0) {
|
||||
printf(" %c (0x%x)\n", ch, ch);
|
||||
}
|
||||
#endif
|
||||
|
||||
PrivMutexObtain(&agent->lock);
|
||||
if (agent->receive_mode == ENTM_MODE)
|
||||
{
|
||||
if (agent->entm_recv_len < ENTM_RECV_MAX)
|
||||
{
|
||||
if (agent->receive_mode == ENTM_MODE) {
|
||||
if (agent->entm_recv_len < ENTM_RECV_MAX) {
|
||||
agent->entm_recv_buf[agent->entm_recv_len] = ch;
|
||||
agent->entm_recv_len++;
|
||||
|
||||
if(agent->entm_recv_len < agent->read_len){
|
||||
if(agent->entm_recv_len < agent->read_len) {
|
||||
PrivMutexAbandon(&agent->lock);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
printf("ENTM_MODE recv %d Bytes done.\n",agent->entm_recv_len);
|
||||
agent->receive_mode = DEFAULT_MODE;
|
||||
PrivSemaphoreAbandon(&agent->entm_rx_notice);
|
||||
|
@ -367,12 +360,9 @@ static int GetCompleteATReply(ATAgentType agent)
|
|||
printf("entm_recv_buf is_full ...\n");
|
||||
}
|
||||
}
|
||||
else if (agent->receive_mode == AT_MODE)
|
||||
{
|
||||
if (read_len < agent->maintain_max)
|
||||
{
|
||||
if(ch != 0) ///< if the char is null then do not save it to the buff
|
||||
{
|
||||
else if (agent->receive_mode == AT_MODE) {
|
||||
if (read_len < agent->maintain_max) {
|
||||
if(ch != 0) { ///< if the char is null then do not save it to the buff
|
||||
agent->maintain_buffer[read_len] = ch;
|
||||
read_len++;
|
||||
agent->maintain_len = read_len;
|
||||
|
@ -386,7 +376,7 @@ static int GetCompleteATReply(ATAgentType agent)
|
|||
if (((ch == '\n') && (last_ch == '\r') && (agent->reply_lr_end)) ||
|
||||
((ch == agent->reply_end_char) && (agent->reply_end_char) &&
|
||||
(last_ch == agent->reply_end_last_char) && (agent->reply_end_last_char)) ||
|
||||
((read_len == agent->reply_char_num) && (agent->reply_char_num))){
|
||||
((read_len == agent->reply_char_num) && (agent->reply_char_num))) {
|
||||
if (is_full) {
|
||||
printf("read line failed. The line data length is out of buffer size(%d)!", agent->maintain_max);
|
||||
memset(agent->maintain_buffer, 0x00, agent->maintain_max);
|
||||
|
@ -471,10 +461,9 @@ static void *ATAgentReceiveProcess(void *param)
|
|||
const struct at_urc *urc;
|
||||
|
||||
while (1) {
|
||||
if (GetCompleteATReply(agent) > 0)
|
||||
{
|
||||
if (GetCompleteATReply(agent) > 0) {
|
||||
PrivMutexObtain(&agent->lock);
|
||||
if (agent->reply != NULL){
|
||||
if (agent->reply != NULL) {
|
||||
ATReplyType reply = agent->reply;
|
||||
|
||||
agent->maintain_buffer[agent->maintain_len] = '\0';
|
||||
|
@ -513,13 +502,13 @@ static int ATAgentInit(ATAgentType agent)
|
|||
printf("ATAgentInit create entm sem error\n");
|
||||
goto __out;
|
||||
}
|
||||
printf("create entm_rx_notice_sem %d\n ",agent->entm_rx_notice);
|
||||
|
||||
result = PrivSemaphoreCreate(&agent->rsp_sem, 0, 0);
|
||||
if (result < 0) {
|
||||
printf("ATAgentInit create rsp sem error\n");
|
||||
goto __out;
|
||||
}
|
||||
printf("create rsp_sem %d\n ",agent->rsp_sem);
|
||||
|
||||
if(PrivMutexCreate(&agent->lock, 0) < 0) {
|
||||
printf("AdapterFrameworkInit mutex create failed.\n");
|
||||
goto __out;
|
||||
|
@ -539,7 +528,7 @@ static int ATAgentInit(ATAgentType agent)
|
|||
#endif
|
||||
|
||||
PrivTaskCreate(&agent->at_handler, &attr, ATAgentReceiveProcess, agent);
|
||||
printf("create agent->at_handler = %d\n",agent->at_handler);
|
||||
|
||||
return result;
|
||||
|
||||
__out:
|
||||
|
|
|
@ -90,12 +90,15 @@ int AdapterBlueToothTest(void)
|
|||
|
||||
#ifdef ADAPTER_HC08
|
||||
AdapterDeviceOpen(adapter);
|
||||
|
||||
//if bluetooth master and slave have already match, no need to AdapterDeviceControl and AdapterDeviceConnect
|
||||
AdapterDeviceControl(adapter, OPE_INT, &baud_rate);
|
||||
//AdapterDeviceConnect(adapter, adapter->net_role, NULL, NULL, 0);
|
||||
|
||||
len = strlen(bluetooth_msg);
|
||||
|
||||
while (1) {
|
||||
AdapterDeviceRecv(adapter, bluetooth_recv_msg, 128);
|
||||
AdapterDeviceRecv(adapter, bluetooth_recv_msg, 8);
|
||||
printf("bluetooth_recv_msg %s\n", bluetooth_recv_msg);
|
||||
AdapterDeviceSend(adapter, bluetooth_msg, len);
|
||||
printf("send %s after recv\n", bluetooth_msg);
|
||||
|
@ -111,5 +114,5 @@ int AdapterBlueToothTest(void)
|
|||
MSH_CMD_EXPORT(AdapterBlueToothTest,a bt adpter sample);
|
||||
#endif
|
||||
#ifdef ADD_XIZI_FETURES
|
||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0)|SHELL_CMD_DISABLE_RETURN, AdapterWifiTest, AdapterWifiTest, show adapter wifi information);
|
||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0)|SHELL_CMD_DISABLE_RETURN, AdapterBlueToothTest, AdapterBlueToothTest, show adapter bluetooth information);
|
||||
#endif
|
|
@ -37,6 +37,12 @@
|
|||
#define HC08_SET_ADDR_CMD "AT+ADDR=%s"
|
||||
#define HC08_GET_NAME_CMD "AT+NAME=%s"
|
||||
#define HC08_SET_NAME_CMD "AT+NAME=?"
|
||||
#define HC08_GET_LUUID_CMD "AT+LUUID=?"
|
||||
#define HC08_SET_LUUID_CMD "AT+LUUID=%u"
|
||||
#define HC08_GET_SUUID_CMD "AT+SUUID=?"
|
||||
#define HC08_SET_SUUID_CMD "AT+SUUID=%u"
|
||||
#define HC08_GET_TUUID_CMD "AT+TUUID=?"
|
||||
#define HC08_SET_TUUID_CMD "AT+TUUID=%u"
|
||||
|
||||
#define HC08_OK_RESP "OK"
|
||||
|
||||
|
@ -60,6 +66,12 @@ enum Hc08AtCmd
|
|||
HC08_AT_CMD_GET_ADDR,
|
||||
HC08_AT_CMD_SET_NAME,
|
||||
HC08_AT_CMD_GET_NAME,
|
||||
HC08_AT_CMD_SET_LUUID,
|
||||
HC08_AT_CMD_GET_LUUID,
|
||||
HC08_AT_CMD_SET_SUUID,
|
||||
HC08_AT_CMD_GET_SUUID,
|
||||
HC08_AT_CMD_SET_TUUID,
|
||||
HC08_AT_CMD_GET_TUUID,
|
||||
HC08_AT_CMD_END,
|
||||
};
|
||||
|
||||
|
@ -85,7 +97,7 @@ static int Hc08AtConfigure(ATAgentType agent, enum Hc08AtCmd hc08_at_cmd, void *
|
|||
{
|
||||
const char *result_buf;
|
||||
char *connectable, *role;
|
||||
unsigned int baudrate;
|
||||
unsigned int baudrate, luuid;
|
||||
char reply_ok_flag = 1;
|
||||
char cmd_str[HC08_CMD_STR_DEFAULT_SIZE] = {0};
|
||||
|
||||
|
@ -166,6 +178,18 @@ static int Hc08AtConfigure(ATAgentType agent, enum Hc08AtCmd hc08_at_cmd, void *
|
|||
ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_GET_NAME_CMD);
|
||||
reply_ok_flag = 0;
|
||||
break;
|
||||
case HC08_AT_CMD_GET_LUUID:
|
||||
AtSetReplyCharNum(agent, 13);
|
||||
ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_GET_LUUID_CMD);
|
||||
reply_ok_flag = 0;
|
||||
break;
|
||||
case HC08_AT_CMD_SET_LUUID:
|
||||
luuid = *(unsigned int *)param;
|
||||
sprintf(cmd_str, HC08_SET_LUUID_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);
|
||||
DeleteATReply(reply);
|
||||
|
@ -205,10 +229,29 @@ static int Hc08Open(struct Adapter *adapter)
|
|||
return -1;
|
||||
}
|
||||
|
||||
struct SerialDataCfg serial_cfg;
|
||||
memset(&serial_cfg, 0 ,sizeof(struct SerialDataCfg));
|
||||
serial_cfg.serial_baud_rate = 9600;
|
||||
serial_cfg.serial_data_bits = DATA_BITS_8;
|
||||
serial_cfg.serial_stop_bits = STOP_BITS_1;
|
||||
serial_cfg.serial_buffer_size = SERIAL_RB_BUFSZ;
|
||||
serial_cfg.serial_parity_mode = PARITY_NONE;
|
||||
serial_cfg.serial_bit_order = STOP_BITS_1;
|
||||
serial_cfg.serial_invert_mode = NRZ_NORMAL;
|
||||
#ifdef ADAPTER_HC08_DRIVER_EXT_PORT
|
||||
serial_cfg.ext_uart_no = ADAPTER_HC08_DRIVER_EXT_PORT;
|
||||
serial_cfg.port_configure = PORT_CFG_INIT;
|
||||
#endif
|
||||
|
||||
struct PrivIoctlCfg ioctl_cfg;
|
||||
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
||||
ioctl_cfg.args = &serial_cfg;
|
||||
PrivIoctl(adapter->fd, OPE_INT, &ioctl_cfg);
|
||||
|
||||
//step2: init AT agent
|
||||
if (!adapter->agent) {
|
||||
char *agent_name = "bluetooth_uart_client";
|
||||
printf("InitATAgent agent_name %s fd %u\n", agent_name, adapter->fd);
|
||||
|
||||
if (0 != InitATAgent(agent_name, adapter->fd, 512)) {
|
||||
printf("at agent init failed !\n");
|
||||
return -1;
|
||||
|
@ -274,8 +317,8 @@ static int Hc08Ioctl(struct Adapter *adapter, int cmd, void *args)
|
|||
return -1;
|
||||
}
|
||||
|
||||
char hc08_baudrate[HC08_RESP_DEFAULT_SIZE] = {0};
|
||||
uint32_t baud_rate = *((uint32_t *)args);
|
||||
uint32_t luuid;
|
||||
|
||||
struct SerialDataCfg serial_cfg;
|
||||
memset(&serial_cfg, 0 ,sizeof(struct SerialDataCfg));
|
||||
|
@ -291,6 +334,8 @@ static int Hc08Ioctl(struct Adapter *adapter, int cmd, void *args)
|
|||
serial_cfg.port_configure = PORT_CFG_INIT;
|
||||
#endif
|
||||
|
||||
serial_cfg.serial_timeout = -1;
|
||||
|
||||
struct PrivIoctlCfg ioctl_cfg;
|
||||
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
||||
ioctl_cfg.args = &serial_cfg;
|
||||
|
@ -306,11 +351,29 @@ static int Hc08Ioctl(struct Adapter *adapter, int cmd, void *args)
|
|||
return -1;
|
||||
}
|
||||
|
||||
PrivTaskDelay(200);
|
||||
//Step3 : clear hc08 configure
|
||||
if (MASTER == adapter->net_role) {
|
||||
PrivTaskDelay(300);
|
||||
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_CLEAR, NULL, NULL) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
PrivTaskDelay(500);
|
||||
|
||||
//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) {
|
||||
// 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;
|
||||
// }
|
||||
|
||||
//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) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_GET_LUUID, NULL, NULL) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,6 +87,17 @@ static const struct WdtDevDone dev_done =
|
|||
NONE,
|
||||
};
|
||||
|
||||
/**
|
||||
* @description: Watchdog function
|
||||
* @return success: EOK, failure: other
|
||||
*/
|
||||
int StartWatchdog(void)
|
||||
{
|
||||
//add feed watchdog task function
|
||||
|
||||
return EOK;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function Watchdog initialization
|
||||
*
|
||||
|
|
|
@ -65,6 +65,17 @@ static const struct WdtDevDone dev_done =
|
|||
NONE,
|
||||
};
|
||||
|
||||
/**
|
||||
* @description: Watchdog function
|
||||
* @return success: EOK, failure: other
|
||||
*/
|
||||
int StartWatchdog(void)
|
||||
{
|
||||
//add feed watchdog task function
|
||||
|
||||
return EOK;
|
||||
}
|
||||
|
||||
int HwWdtInit(void)
|
||||
{
|
||||
wdt_device_number_t id;
|
||||
|
|
|
@ -118,6 +118,7 @@ static uint32 SerialInit(struct SerialDriver *serial_drv, struct BusConfigureInf
|
|||
|
||||
struct SerialHardwareDevice *serial_dev = (struct SerialHardwareDevice *)serial_drv->driver.owner_bus->owner_haldev;
|
||||
struct SerialDevParam *dev_param = (struct SerialDevParam *)serial_dev->haldev.private_data;
|
||||
struct SerialCfgParam *serial_cfg = (struct SerialCfgParam *)serial_drv->private_data;
|
||||
|
||||
// config serial receive sem timeout
|
||||
dev_param->serial_timeout = serial_cfg->data_cfg.serial_timeout;
|
||||
|
|
|
@ -119,6 +119,7 @@ static uint32 SerialInit(struct SerialDriver *serial_drv, struct BusConfigureInf
|
|||
|
||||
struct SerialHardwareDevice *serial_dev = (struct SerialHardwareDevice *)serial_drv->driver.owner_bus->owner_haldev;
|
||||
struct SerialDevParam *dev_param = (struct SerialDevParam *)serial_dev->haldev.private_data;
|
||||
struct SerialCfgParam *serial_cfg = (struct SerialCfgParam *)serial_drv->private_data;
|
||||
|
||||
// config serial receive sem timeout
|
||||
dev_param->serial_timeout = serial_cfg->data_cfg.serial_timeout;
|
||||
|
|
|
@ -66,6 +66,17 @@ static const struct WdtDevDone dev_done =
|
|||
NONE,
|
||||
};
|
||||
|
||||
/**
|
||||
* @description: Watchdog function
|
||||
* @return success: EOK, failure: other
|
||||
*/
|
||||
int StartWatchdog(void)
|
||||
{
|
||||
//add feed watchdog task function
|
||||
|
||||
return EOK;
|
||||
}
|
||||
|
||||
int HwWdtInit(void)
|
||||
{
|
||||
wdt_device_number_t id;
|
||||
|
|
|
@ -66,6 +66,17 @@ static const struct WdtDevDone dev_done =
|
|||
NONE,
|
||||
};
|
||||
|
||||
/**
|
||||
* @description: Watchdog function
|
||||
* @return success: EOK, failure: other
|
||||
*/
|
||||
int StartWatchdog(void)
|
||||
{
|
||||
//add feed watchdog task function
|
||||
|
||||
return EOK;
|
||||
}
|
||||
|
||||
int HwWdtInit(void)
|
||||
{
|
||||
wdt_device_number_t id;
|
||||
|
|
|
@ -86,6 +86,17 @@ static const struct WdtDevDone dev_done =
|
|||
NONE,
|
||||
};
|
||||
|
||||
/**
|
||||
* @description: Watchdog function
|
||||
* @return success: EOK, failure: other
|
||||
*/
|
||||
int StartWatchdog(void)
|
||||
{
|
||||
//add feed watchdog task function
|
||||
|
||||
return EOK;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function Watchdog initialization
|
||||
*
|
||||
|
|
|
@ -1027,15 +1027,15 @@ static uint32 ImxrtCh438ReadData(void *dev, struct BusBlockReadParam *read_param
|
|||
if (EOK == result) {
|
||||
gInterruptStatus = ReadCH438Data(REG_SSR_ADDR);
|
||||
if (!gInterruptStatus) {
|
||||
// dat = ReadCH438Data(REG_LCR0_ADDR);
|
||||
// dat = ReadCH438Data(REG_IER0_ADDR);
|
||||
// dat = ReadCH438Data(REG_MCR0_ADDR);
|
||||
// dat = ReadCH438Data(REG_LSR0_ADDR);
|
||||
// dat = ReadCH438Data(REG_MSR0_ADDR);
|
||||
// dat = ReadCH438Data(REG_RBR0_ADDR);
|
||||
// dat = ReadCH438Data(REG_THR0_ADDR);
|
||||
// dat = ReadCH438Data(REG_IIR0_ADDR);
|
||||
// dat = dat;
|
||||
dat = ReadCH438Data(REG_LCR0_ADDR);
|
||||
dat = ReadCH438Data(REG_IER0_ADDR);
|
||||
dat = ReadCH438Data(REG_MCR0_ADDR);
|
||||
dat = ReadCH438Data(REG_LSR0_ADDR);
|
||||
dat = ReadCH438Data(REG_MSR0_ADDR);
|
||||
dat = ReadCH438Data(REG_RBR0_ADDR);
|
||||
dat = ReadCH438Data(REG_THR0_ADDR);
|
||||
dat = ReadCH438Data(REG_IIR0_ADDR);
|
||||
dat = dat;
|
||||
interrupt_done = 0;
|
||||
} else {
|
||||
if (gInterruptStatus & interrupt_num[dev_param->ext_uart_no]) { /* check which uart port triggers interrupt*/
|
||||
|
@ -1053,17 +1053,26 @@ static uint32 ImxrtCh438ReadData(void *dev, struct BusBlockReadParam *read_param
|
|||
|
||||
InterruptStatus = ReadCH438Data( REG_IIR_ADDR ) & 0x0f; /* read the status of the uart port*/
|
||||
|
||||
if ((INT_RCV_OVERTIME == InterruptStatus) || (INT_RCV_SUCCESS == InterruptStatus)) {
|
||||
switch( InterruptStatus )
|
||||
{
|
||||
case INT_NOINT: /* NO INTERRUPT */
|
||||
break;
|
||||
case INT_THR_EMPTY: /* THR EMPTY INTERRUPT */
|
||||
break;
|
||||
case INT_RCV_OVERTIME: /* RECV OVERTIME INTERRUPT */
|
||||
case INT_RCV_SUCCESS: /* RECV INTERRUPT SUCCESSFULLY */
|
||||
rcv_num = Ch438UartRcv(dev_param->ext_uart_no, (uint8 *)read_param->buffer, read_param->size);
|
||||
read_param->read_length = rcv_num;
|
||||
|
||||
interrupt_done = 1;
|
||||
|
||||
// int i;
|
||||
// uint8 *buffer = (uint8 *)read_param->buffer;
|
||||
// for (i = 0; i < rcv_num; i ++) {
|
||||
// KPrintf("Ch438UartRcv i %u data 0x%x\n", i, buffer[i]);
|
||||
// }
|
||||
break;
|
||||
case INT_RCV_LINES: /* RECV LINES INTERRUPT */
|
||||
ReadCH438Data( REG_LSR_ADDR );
|
||||
break;
|
||||
case INT_MODEM_CHANGE: /* MODEM CHANGE INTERRUPT */
|
||||
ReadCH438Data( REG_MSR_ADDR );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1094,6 +1094,21 @@ void BOARD_InitUartPins(void)
|
|||
IOMUXC_GPIO_AD_B1_03_LPUART2_RX,
|
||||
0x10B0u);
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_LPUART8
|
||||
IOMUXC_SetPinMux(
|
||||
IOMUXC_GPIO_AD_B1_10_LPUART8_TX,
|
||||
0U);
|
||||
IOMUXC_SetPinMux(
|
||||
IOMUXC_GPIO_AD_B1_11_LPUART8_RX,
|
||||
0U);
|
||||
IOMUXC_SetPinConfig(
|
||||
IOMUXC_GPIO_AD_B1_10_LPUART8_TX,
|
||||
0x10B0u);
|
||||
IOMUXC_SetPinConfig(
|
||||
IOMUXC_GPIO_AD_B1_11_LPUART8_RX,
|
||||
0x10B0u);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* FUNCTION ************************************************************************************************************
|
||||
|
@ -1191,30 +1206,6 @@ void BOARD_InitPins(void)
|
|||
Pull Up / Down Config. Field: 100K Ohm Pull Up
|
||||
Hyst. Enable Field: Hysteresis Disabled */
|
||||
|
||||
#if UART_DEBUG
|
||||
IOMUXC_SetPinConfig(
|
||||
IOMUXC_GPIO_AD_B0_12_LPUART1_TX, /* GPIO_AD_B0_12 PAD functional properties : */
|
||||
0x10B0u); /* Slew Rate Field: Slow Slew Rate
|
||||
Drive Strength Field: R0/6
|
||||
Speed Field: medium(100MHz)
|
||||
Open Drain Enable Field: Open Drain Disabled
|
||||
Pull / Keep Enable Field: Pull/Keeper Enabled
|
||||
Pull / Keep Select Field: Keeper
|
||||
Pull Up / Down Config. Field: 100K Ohm Pull Down
|
||||
Hyst. Enable Field: Hysteresis Disabled */
|
||||
IOMUXC_SetPinConfig(
|
||||
IOMUXC_GPIO_AD_B0_13_LPUART1_RX, /* GPIO_AD_B0_13 PAD functional properties : */
|
||||
0x10B0u); /* Slew Rate Field: Slow Slew Rate
|
||||
Drive Strength Field: R0/6
|
||||
Speed Field: medium(100MHz)
|
||||
Open Drain Enable Field: Open Drain Disabled
|
||||
Pull / Keep Enable Field: Pull/Keeper Enabled
|
||||
Pull / Keep Select Field: Keeper
|
||||
Pull Up / Down Config. Field: 100K Ohm Pull Down
|
||||
Hyst. Enable Field: Hysteresis Disabled */
|
||||
|
||||
#endif
|
||||
|
||||
IOMUXC_SetPinConfig(
|
||||
IOMUXC_GPIO_B1_04_ENET_RX_DATA00, /* GPIO_B1_04 PAD functional properties : */
|
||||
0xB0E9u); /* Slew Rate Field: Fast Slew Rate
|
||||
|
@ -1317,8 +1308,6 @@ void BOARD_InitPins(void)
|
|||
Hyst. Enable Field: Hysteresis Disabled */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* EOF
|
||||
**********************************************************************************************************************/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
config BSP_USING_LPUART1
|
||||
bool "Enable LPUART1"
|
||||
default y
|
||||
if BSP_USING_LPUART1
|
||||
bool "Enable LPUART1"
|
||||
default y
|
||||
if BSP_USING_LPUART1
|
||||
config SERIAL_BUS_NAME_1
|
||||
string "serial bus 1 name"
|
||||
default "uart1"
|
||||
|
@ -11,12 +11,12 @@ if BSP_USING_LPUART1
|
|||
config SERIAL_1_DEVICE_NAME_0
|
||||
string "serial bus 1 device name"
|
||||
default "uart1_dev1"
|
||||
endif
|
||||
endif
|
||||
|
||||
config BSP_USING_LPUART2
|
||||
bool "Enable LPUART2"
|
||||
default y
|
||||
if BSP_USING_LPUART2
|
||||
bool "Enable LPUART2"
|
||||
default y
|
||||
if BSP_USING_LPUART2
|
||||
config SERIAL_BUS_NAME_2
|
||||
string "serial bus 2 name"
|
||||
default "uart2"
|
||||
|
@ -26,4 +26,19 @@ if BSP_USING_LPUART2
|
|||
config SERIAL_2_DEVICE_NAME_0
|
||||
string "serial bus 2 device name"
|
||||
default "uart2_dev2"
|
||||
endif
|
||||
endif
|
||||
|
||||
config BSP_USING_LPUART8
|
||||
bool "Enable LPUART8"
|
||||
default n
|
||||
if BSP_USING_LPUART8
|
||||
config SERIAL_BUS_NAME_8
|
||||
string "serial bus 8 name"
|
||||
default "uart8"
|
||||
config SERIAL_DRV_NAME_8
|
||||
string "serial bus 8 driver name"
|
||||
default "uart8_drv"
|
||||
config SERIAL_8_DEVICE_NAME_0
|
||||
string "serial bus 8 device name"
|
||||
default "uart8_dev8"
|
||||
endif
|
||||
|
|
|
@ -66,6 +66,23 @@ void LPUART2_IRQHandler(int irqn, void *arg)
|
|||
DECLARE_HW_IRQ(UART2_IRQn, LPUART2_IRQHandler, NONE);
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_LPUART8
|
||||
struct SerialBus serial_bus_8;
|
||||
struct SerialDriver serial_driver_8;
|
||||
struct SerialHardwareDevice serial_device_8;
|
||||
|
||||
void LPUART8_IRQHandler(int irqn, void *arg)
|
||||
{
|
||||
|
||||
DisableIRQ(LPUART8_IRQn);
|
||||
|
||||
UartIsr(&serial_bus_8, &serial_driver_8, &serial_device_8);
|
||||
EnableIRQ(LPUART8_IRQn);
|
||||
|
||||
}
|
||||
DECLARE_HW_IRQ(LPUART8_IRQn, LPUART8_IRQHandler, NONE);
|
||||
#endif
|
||||
|
||||
static void SerialCfgParamCheck(struct SerialCfgParam *serial_cfg_default, struct SerialCfgParam *serial_cfg_new)
|
||||
{
|
||||
struct SerialDataCfg *data_cfg_default = &serial_cfg_default->data_cfg;
|
||||
|
@ -426,5 +443,38 @@ int Imxrt1052HwUartInit(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_LPUART8
|
||||
static struct SerialCfgParam serial_cfg_8;
|
||||
memset(&serial_cfg_8, 0, sizeof(struct SerialCfgParam));
|
||||
|
||||
static struct SerialDevParam serial_dev_param_8;
|
||||
memset(&serial_dev_param_8, 0, sizeof(struct SerialDevParam));
|
||||
|
||||
serial_driver_8.drv_done = &drv_done;
|
||||
serial_driver_8.configure = &SerialDrvConfigure;
|
||||
serial_device_8.hwdev_done = &hwdev_done;
|
||||
|
||||
serial_cfg_8.data_cfg = data_cfg_init;
|
||||
|
||||
serial_cfg_8.hw_cfg.private_data = (void *)LPUART8;
|
||||
serial_cfg_8.hw_cfg.serial_irq_interrupt = LPUART8_IRQn;
|
||||
serial_driver_8.private_data = (void *)&serial_cfg_8;
|
||||
|
||||
serial_dev_param_8.serial_work_mode = SIGN_OPER_INT_RX;
|
||||
serial_device_8.haldev.private_data = (void *)&serial_dev_param_8;
|
||||
|
||||
ret = BoardSerialBusInit(&serial_bus_8, &serial_driver_8, SERIAL_BUS_NAME_8, SERIAL_DRV_NAME_8);
|
||||
if (EOK != ret) {
|
||||
KPrintf("Imxrt1052HwUartInit uart error ret %u\n", ret);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
ret = BoardSerialDevBend(&serial_device_8, (void *)&serial_cfg_8, SERIAL_BUS_NAME_8, SERIAL_8_DEVICE_NAME_0);
|
||||
if (EOK != ret) {
|
||||
KPrintf("Imxrt1052HwUartInit uart error ret %u\n", ret);
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -24,31 +24,31 @@ void PollAdd(WaitQueueType *wq, pollreqType *req)
|
|||
}
|
||||
|
||||
|
||||
struct rt_poll_node;
|
||||
struct poll_node;
|
||||
|
||||
struct rt_poll_table
|
||||
struct poll_table
|
||||
{
|
||||
pollreqType req;
|
||||
uint32 triggered;
|
||||
KTaskDescriptorType polling_thread;
|
||||
struct rt_poll_node *nodes;
|
||||
struct poll_node *nodes;
|
||||
};
|
||||
|
||||
struct rt_poll_node
|
||||
struct poll_node
|
||||
{
|
||||
struct WaitqueueNode wqn;
|
||||
struct rt_poll_table *pt;
|
||||
struct rt_poll_node *next;
|
||||
struct poll_table *pt;
|
||||
struct poll_node *next;
|
||||
};
|
||||
|
||||
static int WqueuePollWake(struct WaitqueueNode *wait, void *key)
|
||||
{
|
||||
struct rt_poll_node *pn;
|
||||
struct poll_node *pn;
|
||||
|
||||
if (key && !((x_ubase)key & wait->key))
|
||||
return -1;
|
||||
|
||||
pn =CONTAINER_OF(wait, struct rt_poll_node, wqn);
|
||||
pn =CONTAINER_OF(wait, struct poll_node, wqn);
|
||||
pn->pt->triggered = 1;
|
||||
|
||||
return 0;
|
||||
|
@ -56,14 +56,14 @@ static int WqueuePollWake(struct WaitqueueNode *wait, void *key)
|
|||
|
||||
static void _poll_add(WaitQueueType *wq, pollreqType *req)
|
||||
{
|
||||
struct rt_poll_table *pt;
|
||||
struct rt_poll_node *node;
|
||||
struct poll_table *pt;
|
||||
struct poll_node *node;
|
||||
|
||||
node = (struct rt_poll_node *)x_malloc(sizeof(struct rt_poll_node));
|
||||
node = (struct poll_node *)x_malloc(sizeof(struct poll_node));
|
||||
if (node == NONE)
|
||||
return;
|
||||
|
||||
pt =CONTAINER_OF(req, struct rt_poll_table, req);
|
||||
pt =CONTAINER_OF(req, struct poll_table, req);
|
||||
|
||||
node->wqn.key = req->_key;
|
||||
InitDoubleLinkList(&(node->wqn.list));
|
||||
|
@ -77,7 +77,7 @@ static void _poll_add(WaitQueueType *wq, pollreqType *req)
|
|||
|
||||
|
||||
|
||||
static int PollWaitTimeout(struct rt_poll_table *pt, int msec)
|
||||
static int PollWaitTimeout(struct poll_table *pt, int msec)
|
||||
{
|
||||
int32 timeout;
|
||||
int ret = 0;
|
||||
|
@ -135,7 +135,7 @@ static int DoPollFd(struct pollfd *pollfd, pollreqType *req)
|
|||
return mask;
|
||||
}
|
||||
|
||||
static int PollDo(struct pollfd *fds, NfdsType nfds, struct rt_poll_table *pt, int msec)
|
||||
static int PollDo(struct pollfd *fds, NfdsType nfds, struct poll_table *pt, int msec)
|
||||
{
|
||||
int num;
|
||||
int istimeout = 0;
|
||||
|
@ -175,8 +175,8 @@ static int PollDo(struct pollfd *fds, NfdsType nfds, struct rt_poll_table *pt, i
|
|||
int poll(struct pollfd *fds, NfdsType nfds, int timeout)
|
||||
{
|
||||
int num;
|
||||
struct rt_poll_table table;
|
||||
struct rt_poll_node *node, *temp;
|
||||
struct poll_table table;
|
||||
struct poll_node *node, *temp;
|
||||
|
||||
table.req._proc = _poll_add;
|
||||
table.triggered = 0;
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
#include "connect_usb.h"
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_WDT
|
||||
#include "connect_wdt.h"
|
||||
#endif
|
||||
|
||||
#ifdef KERNEL_USER_MAIN
|
||||
#ifndef MAIN_KTASK_STACK_SIZE
|
||||
#define MAIN_KTASK_STACK_SIZE 2048
|
||||
|
@ -44,6 +40,10 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_WDT
|
||||
extern int StartWatchdog(void);
|
||||
#endif
|
||||
|
||||
extern void CreateKServiceKTask(void);
|
||||
extern int main(void);
|
||||
void InitBoardHardware(void);
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#ifndef __SYS_ARCH__
|
||||
#define __SYS_ATCH__
|
||||
#define __SYS_ARCH__
|
||||
|
||||
#include <lwip/opt.h>
|
||||
#include <lwip/arch.h>
|
||||
|
|
Loading…
Reference in New Issue