37 #ifdef CONF_WINC_USE_UART 47 for(i = 0; i < sz; i++)
92 M2M_INFO(
"Built-in WINCxx00 UART Found\n");
97 M2M_INFO(
"WINCxx00 Serial Bridge Found\n");
102 M2M_INFO(
"WINCxx00 Serial Bridge + AT CMD app Found\n");
106 M2M_INFO(
"failed to read Serial Bridge ID response\n");
110 M2M_INFO(
"Non Serial Bridge Found\n");
117 M2M_ERR(
"failed to send Serial Bridge ID Query\n");
122 s8Ret = (
sint8)onchip;
151 M2M_ERR(
"failed to send reboot cmd\n");
171 b[5] = (
uint8)(u32Addr & 0x000000ff);
172 b[6] = (
uint8)((u32Addr & 0x0000ff00)>>8);
173 b[7] = (
uint8)((u32Addr & 0x00ff0000)>>16);
174 b[8] = (
uint8)((u32Addr & 0xff000000)>>24);
180 b[2] = get_cs(&b[1],HDR_SZ);
184 strUart.
u16Sz =
sizeof(b);
188 if(!nm_bus_get_chip_type())
197 M2M_DBG(
"Successfully sent the command\n");
220 M2M_ERR(
"failed to send cfg bytes\n");
224 *pu32RetVal = ((
uint32)b[0] << 24) | ((
uint32)b[1] << 16) | ((
uint32)b[2] << 8) | b[3];
270 b[5] = (
uint8)(u32Addr & 0x000000ff);
271 b[6] = (
uint8)((u32Addr & 0x0000ff00)>>8);
272 b[7] = (
uint8)((u32Addr & 0x00ff0000)>>16);
273 b[8] = (
uint8)((u32Addr & 0xff000000)>>24);
274 b[9] = (
uint8)(u32Val & 0x000000ff);
275 b[10] = (
uint8)((u32Val & 0x0000ff00)>>8);
276 b[11] = (
uint8)((u32Val & 0x00ff0000)>>16);
277 b[12] = (
uint8)((u32Val & 0xff000000)>>24);
279 b[2] = get_cs(&b[1],HDR_SZ);
281 get_cs(&b[1],HDR_SZ);
284 strUart.
u16Sz =
sizeof(b);
293 if(!nm_bus_get_chip_type())
303 M2M_DBG(
"Successfully sent the reg write command\n");
335 uint8 au8Buf[HDR_SZ+1];
340 au8Buf[3] = (
uint8)(u16Sz & 0x00ff);
341 au8Buf[4] = (
uint8)((u16Sz & 0xff00)>>8);
342 au8Buf[5] = (
uint8)(u32Addr & 0x000000ff);
343 au8Buf[6] = (
uint8)((u32Addr & 0x0000ff00)>>8);
344 au8Buf[7] = (
uint8)((u32Addr & 0x00ff0000)>>16);
345 au8Buf[8] = (
uint8)((u32Addr & 0xff000000)>>24);
351 au8Buf[2] = get_cs(&au8Buf[1],HDR_SZ);
354 strUart.
u16Sz =
sizeof(au8Buf);
363 if(!nm_bus_get_chip_type())
371 if(au8Buf[0] == 0xAC)
373 M2M_DBG(
"Successfully sent the block read command\n");
375 strUart.
u16Sz = u16Sz;
385 M2M_ERR(
"write error (Error sending the block read command)\n");
392 strUart.
u16Sz = u16Sz;
423 static uint8 au8Buf[HDR_SZ+1];
428 au8Buf[3] = (
uint8)(u16Sz & 0x00ff);
429 au8Buf[4] = (
uint8)((u16Sz & 0xff00)>>8);
430 au8Buf[5] = (
uint8)(u32Addr & 0x000000ff);
431 au8Buf[6] = (
uint8)((u32Addr & 0x0000ff00)>>8);
432 au8Buf[7] = (
uint8)((u32Addr & 0x00ff0000)>>16);
433 au8Buf[8] = (
uint8)((u32Addr & 0xff000000)>>24);
439 au8Buf[2] = get_cs(&au8Buf[1],HDR_SZ);
442 strUart.
u16Sz =
sizeof(au8Buf);
451 if(!nm_bus_get_chip_type())
459 if(au8Buf[0] == 0xAC)
461 M2M_DBG(
"Successfully sent the block Write command\n");
463 strUart.
u16Sz = u16Sz;
479 if(au8Buf[0] == 0xAC)
481 M2M_DBG(
"Successfully sent the data payload\n");
492 M2M_ERR(
"write error (Error sending the block write command)\n");
499 strUart.
u16Sz = u16Sz;
543 b[9] = (
uint8)((*(
unsigned long *)ptr) & 0x000000ff);
544 b[10] = (
uint8)(((*(
unsigned long *)ptr) & 0x0000ff00)>>8);
545 b[11] = (
uint8)(((*(
unsigned long *)ptr) & 0x00ff0000)>>16);
546 b[12] = (
uint8)(((*(
unsigned long *)ptr) & 0xff000000)>>24);
548 b[2] = get_cs(&b[1],HDR_SZ);
550 get_cs(&b[1],HDR_SZ);
553 strUart.
u16Sz =
sizeof(b);
562 if(!nm_bus_get_chip_type())
572 M2M_DBG(
"Successfully sent the UART reconfigure command\n");
sint8 nm_uart_reboot_cmd(void)
Sends a command to the MCU to force the reboot of the WINC.
This module contains common APIs declarations.
signed char sint8
Range of values between -128 to 127.
sint8 nm_uart_read_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz)
sint8 nm_uart_read_reg_with_ret(uint32 u32Addr, uint32 *pu32RetVal)
This module contains WINC3400 bus wrapper APIs declarations.
unsigned short uint16
Range of values between 0 to 65535.
sint8 nm_uart_write_reg(uint32 u32Addr, uint32 u32Val)
sint8 nm_uart_write_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz)
sint8 nm_uart_reconfigure(void *ptr)
This module contains WINC3400 UART protocol bus APIs implementation.
unsigned long uint32
Range of values between 0 to 4294967295.
unsigned char uint8
Range of values between 0 to 255.
uint32 nm_uart_read_reg(uint32 u32Addr)
sint8 nm_bus_ioctl(uint8 u8Cmd, void *pvParameter)
Structure holding UART default operation parameters.
sint8 nm_uart_sync_cmd(void)