zephyr: replace zephyr integer types with C99 types

git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2020-05-27 11:26:57 -05:00 committed by Kumar Gala
commit a1b77fd589
2364 changed files with 32505 additions and 32505 deletions

View file

@ -44,8 +44,8 @@ static struct gsm_modem {
struct modem_context context;
struct modem_cmd_handler_data cmd_handler_data;
u8_t cmd_read_buf[GSM_CMD_READ_BUF];
u8_t cmd_match_buf[GSM_CMD_READ_BUF];
uint8_t cmd_read_buf[GSM_CMD_READ_BUF];
uint8_t cmd_match_buf[GSM_CMD_READ_BUF];
struct k_sem sem_response;
struct modem_iface_uart_data gsm_data;
@ -53,7 +53,7 @@ static struct gsm_modem {
char gsm_isr_buf[PPP_MRU];
char gsm_rx_rb_buf[PPP_MRU * 3];
u8_t *ppp_recv_buf;
uint8_t *ppp_recv_buf;
size_t ppp_recv_buf_len;
enum setup_state state;

View file

@ -25,7 +25,7 @@ LOG_MODULE_REGISTER(modem_cmd_handler, CONFIG_MODEM_LOG_LEVEL);
* Parsing Functions
*/
static bool is_crlf(u8_t c)
static bool is_crlf(uint8_t c)
{
if (c == '\n' || c == '\r') {
return true;
@ -44,11 +44,11 @@ static void skipcrlf(struct modem_cmd_handler_data *data)
}
}
static u16_t findcrlf(struct modem_cmd_handler_data *data,
struct net_buf **frag, u16_t *offset)
static uint16_t findcrlf(struct modem_cmd_handler_data *data,
struct net_buf **frag, uint16_t *offset)
{
struct net_buf *buf = data->rx_buf;
u16_t len = 0U, pos = 0U;
uint16_t len = 0U, pos = 0U;
while (buf && !is_crlf(*(buf->data + pos))) {
if (pos + 1 >= buf->len) {
@ -107,7 +107,7 @@ static inline struct net_buf *read_rx_allocator(k_timeout_t timeout,
/* return scanned length for params */
static int parse_params(struct modem_cmd_handler_data *data, size_t match_len,
struct modem_cmd *cmd,
u8_t **argv, size_t argv_len, u16_t *argc)
uint8_t **argv, size_t argv_len, uint16_t *argc)
{
int i, count = 0;
size_t begin, end;
@ -173,8 +173,8 @@ static int process_cmd(struct modem_cmd *cmd, size_t match_len,
struct modem_cmd_handler_data *data)
{
int parsed_len = 0, ret = 0;
u8_t *argv[CONFIG_MODEM_CMD_HANDLER_MAX_PARAM_COUNT];
u16_t argc = 0U;
uint8_t *argv[CONFIG_MODEM_CMD_HANDLER_MAX_PARAM_COUNT];
uint16_t argc = 0U;
/* reset params */
memset(argv, 0, sizeof(argv[0]) * ARRAY_SIZE(argv));
@ -264,7 +264,7 @@ static void cmd_handler_process(struct modem_cmd_handler *cmd_handler,
struct net_buf *frag = NULL;
size_t match_len, rx_len, bytes_read = 0;
int ret;
u16_t offset, len;
uint16_t offset, len;
if (!cmd_handler || !cmd_handler->cmd_handler_data ||
!iface || !iface->read) {
@ -440,7 +440,7 @@ static int _modem_cmd_send(struct modem_iface *iface,
struct modem_cmd_handler *handler,
struct modem_cmd *handler_cmds,
size_t handler_cmds_len,
const u8_t *buf, struct k_sem *sem,
const uint8_t *buf, struct k_sem *sem,
k_timeout_t timeout, bool no_tx_lock)
{
struct modem_cmd_handler_data *data;
@ -511,7 +511,7 @@ int modem_cmd_send_nolock(struct modem_iface *iface,
struct modem_cmd_handler *handler,
struct modem_cmd *handler_cmds,
size_t handler_cmds_len,
const u8_t *buf, struct k_sem *sem,
const uint8_t *buf, struct k_sem *sem,
k_timeout_t timeout)
{
return _modem_cmd_send(iface, handler, handler_cmds, handler_cmds_len,
@ -521,7 +521,7 @@ int modem_cmd_send_nolock(struct modem_iface *iface,
int modem_cmd_send(struct modem_iface *iface,
struct modem_cmd_handler *handler,
struct modem_cmd *handler_cmds, size_t handler_cmds_len,
const u8_t *buf, struct k_sem *sem, k_timeout_t timeout)
const uint8_t *buf, struct k_sem *sem, k_timeout_t timeout)
{
return _modem_cmd_send(iface, handler, handler_cmds, handler_cmds_len,
buf, sem, timeout, false);

View file

@ -22,12 +22,12 @@ extern "C" {
#endif
#define MODEM_CMD_DEFINE(name_) \
static int name_(struct modem_cmd_handler_data *data, u16_t len, \
u8_t **argv, u16_t argc)
static int name_(struct modem_cmd_handler_data *data, uint16_t len, \
uint8_t **argv, uint16_t argc)
#define MODEM_CMD(cmd_, func_cb_, acount_, adelim_) { \
.cmd = cmd_, \
.cmd_len = (u16_t)sizeof(cmd_)-1, \
.cmd_len = (uint16_t)sizeof(cmd_)-1, \
.func = func_cb_, \
.arg_count = acount_, \
.delim = adelim_, \
@ -38,7 +38,7 @@ static int name_(struct modem_cmd_handler_data *data, u16_t len, \
#define MODEM_CMD_DIRECT(cmd_, func_cb_) { \
.cmd = cmd_, \
.cmd_len = (u16_t)sizeof(cmd_)-1, \
.cmd_len = (uint16_t)sizeof(cmd_)-1, \
.func = func_cb_, \
.arg_count = 0, \
.delim = "", \
@ -53,12 +53,12 @@ static int name_(struct modem_cmd_handler_data *data, u16_t len, \
struct modem_cmd_handler_data;
struct modem_cmd {
int (*func)(struct modem_cmd_handler_data *data, u16_t len,
u8_t **argv, u16_t argc);
int (*func)(struct modem_cmd_handler_data *data, uint16_t len,
uint8_t **argv, uint16_t argc);
const char *cmd;
const char *delim;
u16_t cmd_len;
u16_t arg_count;
uint16_t cmd_len;
uint16_t arg_count;
bool direct;
};
@ -153,7 +153,7 @@ int modem_cmd_send_nolock(struct modem_iface *iface,
struct modem_cmd_handler *handler,
struct modem_cmd *handler_cmds,
size_t handler_cmds_len,
const u8_t *buf, struct k_sem *sem,
const uint8_t *buf, struct k_sem *sem,
k_timeout_t timeout);
/**
@ -170,7 +170,7 @@ int modem_cmd_send_nolock(struct modem_iface *iface,
int modem_cmd_send(struct modem_iface *iface,
struct modem_cmd_handler *handler,
struct modem_cmd *handler_cmds, size_t handler_cmds_len,
const u8_t *buf, struct k_sem *sem, k_timeout_t timeout);
const uint8_t *buf, struct k_sem *sem, k_timeout_t timeout);
/**
* @brief send a series of AT commands

View file

@ -39,7 +39,7 @@ char *modem_context_sprint_ip_addr(const struct sockaddr *addr)
return buf;
}
int modem_context_get_addr_port(const struct sockaddr *addr, u16_t *port)
int modem_context_get_addr_port(const struct sockaddr *addr, uint16_t *port)
{
if (!addr || !port) {
return -EINVAL;

View file

@ -33,9 +33,9 @@ extern "C" {
struct modem_iface {
struct device *dev;
int (*read)(struct modem_iface *iface, u8_t *buf, size_t size,
int (*read)(struct modem_iface *iface, uint8_t *buf, size_t size,
size_t *bytes_read);
int (*write)(struct modem_iface *iface, const u8_t *buf, size_t size);
int (*write)(struct modem_iface *iface, const uint8_t *buf, size_t size);
/* implementation data */
void *iface_data;
@ -95,7 +95,7 @@ char *modem_context_sprint_ip_addr(const struct sockaddr *addr);
*
* @retval 0 if ok, < 0 if error.
*/
int modem_context_get_addr_port(const struct sockaddr *addr, u16_t *port);
int modem_context_get_addr_port(const struct sockaddr *addr, uint16_t *port);
/**
* @brief Gets modem context by id.
@ -127,9 +127,9 @@ struct modem_context *modem_context_from_iface_dev(struct device *dev);
int modem_context_register(struct modem_context *ctx);
/* pin config functions */
int modem_pin_read(struct modem_context *ctx, u32_t pin);
int modem_pin_write(struct modem_context *ctx, u32_t pin, u32_t value);
int modem_pin_config(struct modem_context *ctx, u32_t pin, bool enable);
int modem_pin_read(struct modem_context *ctx, uint32_t pin);
int modem_pin_write(struct modem_context *ctx, uint32_t pin, uint32_t value);
int modem_pin_config(struct modem_context *ctx, uint32_t pin, bool enable);
int modem_pin_init(struct modem_context *ctx);
#ifdef __cplusplus

View file

@ -30,7 +30,7 @@ LOG_MODULE_REGISTER(modem_iface_uart, CONFIG_MODEM_LOG_LEVEL);
*/
static void modem_iface_uart_flush(struct modem_iface *iface)
{
u8_t c;
uint8_t c;
while (uart_fifo_read(iface->dev, &c, 1) > 0) {
continue;
@ -84,7 +84,7 @@ static void modem_iface_uart_isr(struct device *uart_dev)
}
static int modem_iface_uart_read(struct modem_iface *iface,
u8_t *buf, size_t size, size_t *bytes_read)
uint8_t *buf, size_t size, size_t *bytes_read)
{
struct modem_iface_uart_data *data;
@ -104,7 +104,7 @@ static int modem_iface_uart_read(struct modem_iface *iface,
}
static int modem_iface_uart_write(struct modem_iface *iface,
const u8_t *buf, size_t size)
const uint8_t *buf, size_t size)
{
if (!iface || !iface->iface_data) {
return -EINVAL;

View file

@ -16,7 +16,7 @@
#include "modem_context.h"
int modem_pin_read(struct modem_context *ctx, u32_t pin)
int modem_pin_read(struct modem_context *ctx, uint32_t pin)
{
if (pin >= ctx->pins_len) {
return -ENODEV;
@ -26,7 +26,7 @@ int modem_pin_read(struct modem_context *ctx, u32_t pin)
ctx->pins[pin].pin);
}
int modem_pin_write(struct modem_context *ctx, u32_t pin, u32_t value)
int modem_pin_write(struct modem_context *ctx, uint32_t pin, uint32_t value)
{
if (pin >= ctx->pins_len) {
return -ENODEV;
@ -36,7 +36,7 @@ int modem_pin_write(struct modem_context *ctx, u32_t pin, u32_t value)
ctx->pins[pin].pin, value);
}
int modem_pin_config(struct modem_context *ctx, u32_t pin, bool enable)
int modem_pin_config(struct modem_context *ctx, uint32_t pin, bool enable)
{
if (pin >= ctx->pins_len) {
return -ENODEV;

View file

@ -81,7 +81,7 @@ static int mdm_receiver_get(struct mdm_receiver_context *ctx)
*/
static void mdm_receiver_flush(struct mdm_receiver_context *ctx)
{
u8_t c;
uint8_t c;
__ASSERT(ctx, "invalid ctx");
__ASSERT(ctx->uart_dev, "invalid ctx device");
@ -105,7 +105,7 @@ static void mdm_receiver_isr(struct device *uart_dev)
{
struct mdm_receiver_context *ctx;
int rx, ret;
static u8_t read_buf[MAX_READ_SIZE];
static uint8_t read_buf[MAX_READ_SIZE];
/* lookup the device */
ctx = context_from_dev(uart_dev);
@ -160,7 +160,7 @@ struct mdm_receiver_context *mdm_receiver_context_from_id(int id)
}
int mdm_receiver_recv(struct mdm_receiver_context *ctx,
u8_t *buf, size_t size, size_t *bytes_read)
uint8_t *buf, size_t size, size_t *bytes_read)
{
if (!ctx) {
return -EINVAL;
@ -176,7 +176,7 @@ int mdm_receiver_recv(struct mdm_receiver_context *ctx,
}
int mdm_receiver_send(struct mdm_receiver_context *ctx,
const u8_t *buf, size_t size)
const uint8_t *buf, size_t size)
{
if (!ctx) {
return -EINVAL;
@ -214,7 +214,7 @@ int mdm_receiver_wake(struct mdm_receiver_context *ctx)
int mdm_receiver_register(struct mdm_receiver_context *ctx,
const char *uart_dev_name,
u8_t *buf, size_t size)
uint8_t *buf, size_t size)
{
int ret;

View file

@ -56,7 +56,7 @@ struct mdm_receiver_context *mdm_receiver_context_from_id(int id);
* @retval 0 if ok, < 0 if error.
*/
int mdm_receiver_recv(struct mdm_receiver_context *ctx,
u8_t *buf, size_t size, size_t *bytes_read);
uint8_t *buf, size_t size, size_t *bytes_read);
/**
* @brief Sends the data over specified receiver context.
@ -68,7 +68,7 @@ int mdm_receiver_recv(struct mdm_receiver_context *ctx,
* @retval 0 if ok, < 0 if error.
*/
int mdm_receiver_send(struct mdm_receiver_context *ctx,
const u8_t *buf, size_t size);
const uint8_t *buf, size_t size);
/**
* @brief Registers receiver context.
@ -84,7 +84,7 @@ int mdm_receiver_send(struct mdm_receiver_context *ctx,
*/
int mdm_receiver_register(struct mdm_receiver_context *ctx,
const char *uart_dev_name,
u8_t *buf, size_t size);
uint8_t *buf, size_t size);
int mdm_receiver_sleep(struct mdm_receiver_context *ctx);

View file

@ -19,10 +19,10 @@
* Packet Size Support Functions
*/
u16_t modem_socket_next_packet_size(struct modem_socket_config *cfg,
uint16_t modem_socket_next_packet_size(struct modem_socket_config *cfg,
struct modem_socket *sock)
{
u16_t total = 0U;
uint16_t total = 0U;
k_sem_take(&cfg->sem_lock, K_FOREVER);
@ -37,10 +37,10 @@ exit:
return total;
}
static u16_t modem_socket_packet_get_total(struct modem_socket *sock)
static uint16_t modem_socket_packet_get_total(struct modem_socket *sock)
{
int i;
u16_t total = 0U;
uint16_t total = 0U;
if (!sock || !sock->packet_count) {
return 0U;
@ -74,7 +74,7 @@ static int modem_socket_packet_drop_first(struct modem_socket *sock)
int modem_socket_packet_size_update(struct modem_socket_config *cfg,
struct modem_socket *sock, int new_total)
{
u16_t old_total = 0U;
uint16_t old_total = 0U;
if (!sock) {
return -EINVAL;
@ -261,7 +261,7 @@ int modem_socket_poll(struct modem_socket_config *cfg,
{
struct modem_socket *sock;
int ret, i;
u8_t found_count = 0;
uint8_t found_count = 0;
if (!cfg) {
return -EINVAL;

View file

@ -33,8 +33,8 @@ __net_socket struct modem_socket {
int sock_fd;
/** packet data */
u16_t packet_sizes[CONFIG_MODEM_SOCKET_PACKET_COUNT];
u16_t packet_count;
uint16_t packet_sizes[CONFIG_MODEM_SOCKET_PACKET_COUNT];
uint16_t packet_count;
/** data ready semaphore */
struct k_sem sem_data_ready;
@ -61,7 +61,7 @@ struct modem_socket_config {
};
/* return size of the first packet */
u16_t modem_socket_next_packet_size(struct modem_socket_config *cfg,
uint16_t modem_socket_next_packet_size(struct modem_socket_config *cfg,
struct modem_socket *sock);
int modem_socket_packet_size_update(struct modem_socket_config *cfg,
struct modem_socket *sock, int new_total);

View file

@ -121,23 +121,23 @@ struct socket_read_data {
char *recv_buf;
size_t recv_buf_len;
struct sockaddr *recv_addr;
u16_t recv_read_len;
uint16_t recv_read_len;
};
/* driver data */
struct modem_data {
struct net_if *net_iface;
u8_t mac_addr[6];
uint8_t mac_addr[6];
/* modem interface */
struct modem_iface_uart_data iface_data;
u8_t iface_isr_buf[MDM_RECV_BUF_SIZE];
u8_t iface_rb_buf[MDM_MAX_DATA_LENGTH];
uint8_t iface_isr_buf[MDM_RECV_BUF_SIZE];
uint8_t iface_rb_buf[MDM_MAX_DATA_LENGTH];
/* modem cmds */
struct modem_cmd_handler_data cmd_handler_data;
u8_t cmd_read_buf[MDM_RECV_BUF_SIZE];
u8_t cmd_match_buf[MDM_RECV_BUF_SIZE + 1];
uint8_t cmd_read_buf[MDM_RECV_BUF_SIZE];
uint8_t cmd_match_buf[MDM_RECV_BUF_SIZE + 1];
/* socket data */
struct modem_socket_config socket_config;
@ -304,7 +304,7 @@ static ssize_t send_socket_data(struct modem_socket *sock,
{
int ret;
char send_buf[sizeof("AT+USO**=#,!###.###.###.###!,#####,####\r\n")];
u16_t dst_port = 0U;
uint16_t dst_port = 0U;
if (!sock) {
return -EINVAL;
@ -577,7 +577,7 @@ MODEM_CMD_DEFINE(on_cmd_sockwrite)
/* Common code for +USOR[D|F]: "<data>" */
static int on_cmd_sockread_common(int socket_id,
struct modem_cmd_handler_data *data,
int socket_data_length, u16_t len)
int socket_data_length, uint16_t len)
{
struct modem_socket *sock = NULL;
struct socket_read_data *sock_data;
@ -631,7 +631,7 @@ static int on_cmd_sockread_common(int socket_id,
}
ret = net_buf_linearize(sock_data->recv_buf, sock_data->recv_buf_len,
data->rx_buf, 0, (u16_t)socket_data_length);
data->rx_buf, 0, (uint16_t)socket_data_length);
data->rx_buf = net_buf_skip(data->rx_buf, ret);
sock_data->recv_read_len = ret;
if (ret != socket_data_length) {
@ -1149,7 +1149,7 @@ static int create_socket(struct modem_socket *sock, const struct sockaddr *addr)
int ret;
struct modem_cmd cmd = MODEM_CMD("+USOCR: ", on_cmd_sockcreate, 1U, "");
char buf[sizeof("AT+USOCR=#,#####\r")];
u16_t local_port = 0U, proto = 6U;
uint16_t local_port = 0U, proto = 6U;
if (addr) {
if (addr->sa_family == AF_INET6) {
@ -1254,7 +1254,7 @@ static int offload_connect(void *obj, const struct sockaddr *addr,
struct modem_socket *sock = (struct modem_socket *)obj;
int ret;
char buf[sizeof("AT+USOCO=#,!###.###.###.###!,#####,#\r")];
u16_t dst_port = 0U;
uint16_t dst_port = 0U;
if (!addr) {
errno = EINVAL;
@ -1564,7 +1564,7 @@ static int offload_getaddrinfo(const char *node, const char *service,
struct addrinfo **res)
{
struct modem_cmd cmd = MODEM_CMD("+UDNSRN: ", on_cmd_dns, 1U, ",");
u32_t port = 0U;
uint32_t port = 0U;
int ret;
/* DNS command + 128 bytes for domain name parameter */
char sendbuf[sizeof("AT+UDNSRN=#,'[]'\r") + 128];
@ -1653,9 +1653,9 @@ static struct net_offload modem_net_offload = {
};
#define HASH_MULTIPLIER 37
static u32_t hash32(char *str, int len)
static uint32_t hash32(char *str, int len)
{
u32_t h = 0;
uint32_t h = 0;
int i;
for (i = 0; i < len; ++i) {
@ -1665,10 +1665,10 @@ static u32_t hash32(char *str, int len)
return h;
}
static inline u8_t *modem_get_mac(struct device *dev)
static inline uint8_t *modem_get_mac(struct device *dev)
{
struct modem_data *data = dev->driver_data;
u32_t hash_value;
uint32_t hash_value;
data->mac_addr[0] = 0x00;
data->mac_addr[1] = 0x10;
@ -1676,7 +1676,7 @@ static inline u8_t *modem_get_mac(struct device *dev)
/* use IMEI for mac_addr */
hash_value = hash32(mdata.mdm_imei, strlen(mdata.mdm_imei));
UNALIGNED_PUT(hash_value, (u32_t *)(data->mac_addr + 2));
UNALIGNED_PUT(hash_value, (uint32_t *)(data->mac_addr + 2));
return data->mac_addr;
}

View file

@ -131,7 +131,7 @@ static const struct mdm_control_pinconfig pinconfig[] = {
#define CMD_HANDLER(cmd_, cb_) { \
.cmd = cmd_, \
.cmd_len = (u16_t)sizeof(cmd_)-1, \
.cmd_len = (uint16_t)sizeof(cmd_)-1, \
.func = on_cmd_ ## cb_ \
}
@ -145,7 +145,7 @@ static const struct mdm_control_pinconfig pinconfig[] = {
NET_BUF_POOL_DEFINE(mdm_recv_pool, MDM_RECV_MAX_BUF, MDM_RECV_BUF_SIZE,
0, NULL);
static u8_t mdm_recv_buf[MDM_MAX_DATA_LENGTH];
static uint8_t mdm_recv_buf[MDM_MAX_DATA_LENGTH];
/* RX thread structures */
K_THREAD_STACK_DEFINE(wncm14a2a_rx_stack,
@ -179,7 +179,7 @@ struct wncm14a2a_socket {
struct wncm14a2a_iface_ctx {
struct net_if *iface;
u8_t mac_addr[6];
uint8_t mac_addr[6];
/* GPIO PORT devices */
struct device *gpio_port_dev[MAX_MDM_CONTROL_PINS];
@ -211,8 +211,8 @@ struct wncm14a2a_iface_ctx {
struct cmd_handler {
const char *cmd;
u16_t cmd_len;
void (*func)(struct net_buf **buf, u16_t len);
uint16_t cmd_len;
void (*func)(struct net_buf **buf, uint16_t len);
};
static struct wncm14a2a_iface_ctx ictx;
@ -221,11 +221,11 @@ static void wncm14a2a_read_rx(struct net_buf **buf);
/*** Verbose Debugging Functions ***/
#if defined(ENABLE_VERBOSE_MODEM_RECV_HEXDUMP)
static inline void hexdump(const u8_t *packet, size_t length)
static inline void hexdump(const uint8_t *packet, size_t length)
{
char output[sizeof("xxxxyyyy xxxxyyyy")];
int n = 0, k = 0;
u8_t byte;
uint8_t byte;
while (length--) {
if (n % 16 == 0) {
@ -344,7 +344,7 @@ char *wncm14a2a_sprint_ip_addr(const struct sockaddr *addr)
/* Send an AT command with a series of response handlers */
static int send_at_cmd(struct wncm14a2a_socket *sock,
const u8_t *data, int timeout)
const uint8_t *data, int timeout)
{
int ret;
@ -414,7 +414,7 @@ static int send_data(struct wncm14a2a_socket *sock, struct net_pkt *pkt)
/*** NET_BUF HELPERS ***/
static bool is_crlf(u8_t c)
static bool is_crlf(uint8_t c)
{
if (c == '\n' || c == '\r') {
return true;
@ -434,10 +434,10 @@ static void net_buf_skipcrlf(struct net_buf **buf)
}
}
static u16_t net_buf_findcrlf(struct net_buf *buf, struct net_buf **frag,
u16_t *offset)
static uint16_t net_buf_findcrlf(struct net_buf *buf, struct net_buf **frag,
uint16_t *offset)
{
u16_t len = 0U, pos = 0U;
uint16_t len = 0U, pos = 0U;
while (buf && !is_crlf(*(buf->data + pos))) {
if (pos + 1 >= buf->len) {
@ -470,7 +470,7 @@ static int pkt_setup_ip_data(struct net_pkt *pkt,
struct wncm14a2a_socket *sock)
{
int hdr_len = 0;
u16_t src_port = 0U, dst_port = 0U;
uint16_t src_port = 0U, dst_port = 0U;
#if defined(CONFIG_NET_IPV6)
if (net_pkt_family(pkt) == AF_INET6) {
@ -546,7 +546,7 @@ static int pkt_setup_ip_data(struct net_pkt *pkt,
/*** MODEM RESPONSE HANDLERS ***/
/* Last Socket ID Handler */
static void on_cmd_atcmdecho(struct net_buf **buf, u16_t len)
static void on_cmd_atcmdecho(struct net_buf **buf, uint16_t len)
{
char value[2];
/* make sure only a single digit is picked up for socket_id */
@ -555,13 +555,13 @@ static void on_cmd_atcmdecho(struct net_buf **buf, u16_t len)
}
/* Echo Handler for commands without related sockets */
static void on_cmd_atcmdecho_nosock(struct net_buf **buf, u16_t len)
static void on_cmd_atcmdecho_nosock(struct net_buf **buf, uint16_t len)
{
/* clear last_socket_id */
ictx.last_socket_id = 0;
}
static void on_cmd_atcmdinfo_manufacturer(struct net_buf **buf, u16_t len)
static void on_cmd_atcmdinfo_manufacturer(struct net_buf **buf, uint16_t len)
{
size_t out_len;
@ -572,7 +572,7 @@ static void on_cmd_atcmdinfo_manufacturer(struct net_buf **buf, u16_t len)
LOG_INF("Manufacturer: %s", ictx.mdm_manufacturer);
}
static void on_cmd_atcmdinfo_model(struct net_buf **buf, u16_t len)
static void on_cmd_atcmdinfo_model(struct net_buf **buf, uint16_t len)
{
size_t out_len;
@ -583,7 +583,7 @@ static void on_cmd_atcmdinfo_model(struct net_buf **buf, u16_t len)
LOG_INF("Model: %s", ictx.mdm_model);
}
static void on_cmd_atcmdinfo_revision(struct net_buf **buf, u16_t len)
static void on_cmd_atcmdinfo_revision(struct net_buf **buf, uint16_t len)
{
size_t out_len;
@ -594,10 +594,10 @@ static void on_cmd_atcmdinfo_revision(struct net_buf **buf, u16_t len)
LOG_INF("Revision: %s", ictx.mdm_revision);
}
static void on_cmd_atcmdecho_nosock_imei(struct net_buf **buf, u16_t len)
static void on_cmd_atcmdecho_nosock_imei(struct net_buf **buf, uint16_t len)
{
struct net_buf *frag = NULL;
u16_t offset;
uint16_t offset;
size_t out_len;
/* make sure IMEI data is received */
@ -629,7 +629,7 @@ static void on_cmd_atcmdecho_nosock_imei(struct net_buf **buf, u16_t len)
}
/* Handler: %MEAS: RSSI:Reported= -68, Ant0= -63, Ant1= -251 */
static void on_cmd_atcmdinfo_rssi(struct net_buf **buf, u16_t len)
static void on_cmd_atcmdinfo_rssi(struct net_buf **buf, uint16_t len)
{
int start = 0, i = 0;
size_t value_size;
@ -670,7 +670,7 @@ static void on_cmd_atcmdinfo_rssi(struct net_buf **buf, u16_t len)
}
/* Handler: OK */
static void on_cmd_sockok(struct net_buf **buf, u16_t len)
static void on_cmd_sockok(struct net_buf **buf, uint16_t len)
{
struct wncm14a2a_socket *sock = NULL;
@ -684,7 +684,7 @@ static void on_cmd_sockok(struct net_buf **buf, u16_t len)
}
/* Handler: ERROR */
static void on_cmd_sockerror(struct net_buf **buf, u16_t len)
static void on_cmd_sockerror(struct net_buf **buf, uint16_t len)
{
struct wncm14a2a_socket *sock = NULL;
@ -698,7 +698,7 @@ static void on_cmd_sockerror(struct net_buf **buf, u16_t len)
}
/* Handler: @EXTERR:<exterror_id> */
static void on_cmd_sockexterror(struct net_buf **buf, u16_t len)
static void on_cmd_sockexterror(struct net_buf **buf, uint16_t len)
{
char value[8];
size_t out_len;
@ -718,7 +718,7 @@ static void on_cmd_sockexterror(struct net_buf **buf, u16_t len)
}
/* Handler: @SOCKDIAL:<status> */
static void on_cmd_sockdial(struct net_buf **buf, u16_t len)
static void on_cmd_sockdial(struct net_buf **buf, uint16_t len)
{
char value[8];
size_t out_len;
@ -730,7 +730,7 @@ static void on_cmd_sockdial(struct net_buf **buf, u16_t len)
}
/* Handler: @SOCKCREAT:<socket_id> */
static void on_cmd_sockcreat(struct net_buf **buf, u16_t len)
static void on_cmd_sockcreat(struct net_buf **buf, uint16_t len)
{
char value[2];
struct wncm14a2a_socket *sock = NULL;
@ -746,7 +746,7 @@ static void on_cmd_sockcreat(struct net_buf **buf, u16_t len)
}
/* Handler: @SOCKWRITE:<actual_length> */
static void on_cmd_sockwrite(struct net_buf **buf, u16_t len)
static void on_cmd_sockwrite(struct net_buf **buf, uint16_t len)
{
char value[8];
size_t out_len;
@ -786,10 +786,10 @@ static void sockreadrecv_cb_work(struct k_work *work)
}
/* Handler: @SOCKREAD:<actual_length>,"<hex encoded binary>" */
static void on_cmd_sockread(struct net_buf **buf, u16_t len)
static void on_cmd_sockread(struct net_buf **buf, uint16_t len)
{
struct wncm14a2a_socket *sock = NULL;
u8_t c = 0U;
uint8_t c = 0U;
int i, actual_length, hdr_len = 0;
size_t value_size;
char value[10];
@ -904,7 +904,7 @@ static void on_cmd_sockread(struct net_buf **buf, u16_t len)
}
/* Handler: @SOCKDATAIND: <socket_id>,<session_status>,<left_bytes> */
static void on_cmd_sockdataind(struct net_buf **buf, u16_t len)
static void on_cmd_sockdataind(struct net_buf **buf, uint16_t len)
{
int socket_id, session_status, left_bytes;
size_t out_len;
@ -966,7 +966,7 @@ static void on_cmd_sockdataind(struct net_buf **buf, u16_t len)
}
}
static void on_cmd_socknotifyev(struct net_buf **buf, u16_t len)
static void on_cmd_socknotifyev(struct net_buf **buf, uint16_t len)
{
char value[40];
size_t out_len;
@ -1026,10 +1026,10 @@ static void on_cmd_socknotifyev(struct net_buf **buf, u16_t len)
}
}
static int net_buf_ncmp(struct net_buf *buf, const u8_t *s2, size_t n)
static int net_buf_ncmp(struct net_buf *buf, const uint8_t *s2, size_t n)
{
struct net_buf *frag = buf;
u16_t offset = 0U;
uint16_t offset = 0U;
while ((n > 0) && (*(frag->data + offset) == *s2) && (*s2 != '\0')) {
if (offset == frag->len) {
@ -1057,10 +1057,10 @@ static inline struct net_buf *read_rx_allocator(k_timeout_t timeout,
static void wncm14a2a_read_rx(struct net_buf **buf)
{
u8_t uart_buffer[MDM_RECV_BUF_SIZE];
uint8_t uart_buffer[MDM_RECV_BUF_SIZE];
size_t bytes_read = 0;
int ret;
u16_t rx_len;
uint16_t rx_len;
/* read all of the data from mdm_receiver */
while (true) {
@ -1102,7 +1102,7 @@ static void wncm14a2a_rx(void)
struct net_buf *rx_buf = NULL;
struct net_buf *frag = NULL;
int i;
u16_t offset, len;
uint16_t offset, len;
static const struct cmd_handler handlers[] = {
/* NON-SOCKET COMMAND ECHOES to clear last_socket_id */
@ -1592,11 +1592,11 @@ static int offload_connect(struct net_context *context,
const struct sockaddr *addr,
socklen_t addrlen,
net_context_connect_cb_t cb,
s32_t timeout,
int32_t timeout,
void *user_data)
{
int ret, dst_port = -1;
s32_t timeout_sec = -1; /* if not changed, this will be min timeout */
int32_t timeout_sec = -1; /* if not changed, this will be min timeout */
char buf[sizeof("AT@SOCKCONN=#,###.###.###.###,#####,#####\r")];
struct wncm14a2a_socket *sock;
@ -1670,7 +1670,7 @@ static int offload_connect(struct net_context *context,
static int offload_accept(struct net_context *context,
net_tcp_accept_cb_t cb,
s32_t timeout,
int32_t timeout,
void *user_data)
{
/* NOT IMPLEMENTED */
@ -1681,7 +1681,7 @@ static int offload_sendto(struct net_pkt *pkt,
const struct sockaddr *dst_addr,
socklen_t addrlen,
net_context_send_cb_t cb,
s32_t timeout,
int32_t timeout,
void *user_data)
{
struct net_context *context = net_pkt_context(pkt);
@ -1714,7 +1714,7 @@ static int offload_sendto(struct net_pkt *pkt,
static int offload_send(struct net_pkt *pkt,
net_context_send_cb_t cb,
s32_t timeout,
int32_t timeout,
void *user_data)
{
struct net_context *context = net_pkt_context(pkt);
@ -1741,7 +1741,7 @@ static int offload_send(struct net_pkt *pkt,
static int offload_recv(struct net_context *context,
net_context_recv_cb_t cb,
s32_t timeout,
int32_t timeout,
void *user_data)
{
struct wncm14a2a_socket *sock;
@ -1817,7 +1817,7 @@ static struct net_offload offload_funcs = {
.put = offload_put,
};
static inline u8_t *wncm14a2a_get_mac(struct device *dev)
static inline uint8_t *wncm14a2a_get_mac(struct device *dev)
{
struct wncm14a2a_iface_ctx *ctx = dev->driver_data;
@ -1825,7 +1825,7 @@ static inline u8_t *wncm14a2a_get_mac(struct device *dev)
ctx->mac_addr[1] = 0x10;
UNALIGNED_PUT(sys_cpu_to_be32(sys_rand32_get()),
(u32_t *)(ctx->mac_addr + 2));
(uint32_t *)(ctx->mac_addr + 2));
return ctx->mac_addr;
}