/****************************************************************************
* Public Functions
****************************************************************************/
-struct ap_info_t
-{
+struct ap_info_t {
char ssid[32];
char security[32];
char pwd[64];
https_server = http_server_init(https_port);
if (https_server == NULL) {
- printf ("Error: Cannot allocate server structure!!\n");
+ printf("Error: Cannot allocate server structure!!\n");
return -1;
}
/* THIS CODE SHOULD BE REMOVED AFTER USING SSS KEY AND CERT */
if ((ret = see_setup_key(sss_da_rsa_ca, sizeof(sss_da_rsa_ca),
SECURE_STORAGE_TYPE_KEY_RSA, EASY_CA_KEY_INDEX)) != 0) {
- printf( "Error: see_setup_key ca 0x%x\n\n", ret);
+ printf("Error: see_setup_key ca 0x%x\n\n", ret);
return -1;
}
if ((ret = see_setup_key(sss_da_rsa_dev, sizeof(sss_da_rsa_dev),
SECURE_STORAGE_TYPE_KEY_RSA, EASY_DEV_KEY_INDEX)) != 0) {
- printf( "Error: see_setup_key dev 0x%x\n\n", ret);
+ printf("Error: see_setup_key dev 0x%x\n\n", ret);
return -1;
}
if ((ret = see_set_certificate(sss_ca_crt, sizeof(sss_ca_crt),
EASY_CA_CERT_INDEX, CERT_PEM)) != 0) {
- printf ("Error: set_cert fail %d\n", ret);
+ printf("Error: set_cert fail %d\n", ret);
return -1;
}
if ((ret = see_set_certificate(sss_dev_crt, sizeof(sss_dev_crt),
EASY_DEV_CERT_INDEX, CERT_PEM)) != 0) {
- printf ("Error: set_cert fail %d\n", ret);
+ printf("Error: set_cert fail %d\n", ret);
return -1;
}
return -1;
}
- http_server_register_cb (https_server, HTTP_METHOD_GET, root_uri, http_get_cb);
+ http_server_register_cb(https_server, HTTP_METHOD_GET, root_uri, http_get_cb);
http_server_register_cb(https_server, HTTP_METHOD_POST, network_uri, http_post_cb);
http_server_register_cb(https_server, HTTP_METHOD_POST, control_uri, http_post_ctrl_cb);
- http_server_start (https_server);
+ http_server_start(https_server);
return 0;
}
static int stop_webserver(void)
{
- http_server_deregister_cb (https_server, HTTP_METHOD_GET, root_uri);
+ http_server_deregister_cb(https_server, HTTP_METHOD_GET, root_uri);
http_server_deregister_cb(https_server, HTTP_METHOD_POST, network_uri);
http_server_deregister_cb(https_server, HTTP_METHOD_POST, control_uri);
http_server_stop(https_server);
- http_server_release (&https_server);
+ http_server_release(&https_server);
#if defined(CONFIG_HW_RSA)
see_free();
printf("DHCP Client Start ::");
print_laptime();
g_stop_easysetup = 0;
- if (start_webserver() !=0) {
+ if (start_webserver() != 0) {
printf("webserver start fail\n");
return -1;
}
sec_type, sizeof(SLSI_WIFI_SECURITY_OPEN)) == 0) {
ret = 0;
} else if (strncmp(SLSI_WIFI_SECURITY_WEP_OPEN,
- sec_type, sizeof(SLSI_WIFI_SECURITY_WEP_OPEN)) == 0 ) {
+ sec_type, sizeof(SLSI_WIFI_SECURITY_WEP_OPEN)) == 0) {
ret = 0;
} else if (strncmp(SLSI_WIFI_SECURITY_WEP_SHARED,
- sec_type, sizeof(SLSI_WIFI_SECURITY_WEP_SHARED)) == 0 ) {
+ sec_type, sizeof(SLSI_WIFI_SECURITY_WEP_SHARED)) == 0) {
ret = 0;
} else if (strncmp(SLSI_WIFI_SECURITY_WPA_MIXED,
- sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_MIXED)) == 0 ) {
+ sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_MIXED)) == 0) {
ret = 0;
} else if (strncmp(SLSI_WIFI_SECURITY_WPA_TKIP,
- sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_TKIP)) == 0 ) {
+ sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_TKIP)) == 0) {
ret = 0;
} else if (strncmp(SLSI_WIFI_SECURITY_WPA_AES,
- sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_AES)) == 0 ) {
+ sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_AES)) == 0) {
ret = 0;
} else if (strncmp(SLSI_WIFI_SECURITY_WPA2_MIXED,
- sec_type, sizeof(SLSI_WIFI_SECURITY_WPA2_MIXED)) == 0 ) {
+ sec_type, sizeof(SLSI_WIFI_SECURITY_WPA2_MIXED)) == 0) {
ret = 0;
} else if (strncmp(SLSI_WIFI_SECURITY_WPA2_TKIP,
- sec_type, sizeof(SLSI_WIFI_SECURITY_WPA2_TKIP)) == 0 ) {
+ sec_type, sizeof(SLSI_WIFI_SECURITY_WPA2_TKIP)) == 0) {
ret = 0;
} else if (strncmp(SLSI_WIFI_SECURITY_WPA2_AES,
- sec_type, sizeof(SLSI_WIFI_SECURITY_WPA2_AES)) == 0 ) {
+ sec_type, sizeof(SLSI_WIFI_SECURITY_WPA2_AES)) == 0) {
ret = 0;
}
{
slsi_security_config_t *ret = NULL;
if (strncmp(SLSI_WIFI_SECURITY_OPEN,
- sec_type, sizeof(SLSI_WIFI_SECURITY_OPEN)) != 0 ) {
+ sec_type, sizeof(SLSI_WIFI_SECURITY_OPEN)) != 0) {
ret = (slsi_security_config_t *)zalloc(sizeof(slsi_security_config_t));
if (ret) {
if (strncmp(SLSI_WIFI_SECURITY_WEP_OPEN,
sec_type, sizeof(SLSI_WIFI_SECURITY_WEP_SHARED)) == 0) {
ret->secmode = SLSI_SEC_MODE_WEP_SHARED;
} else if (strncmp(SLSI_WIFI_SECURITY_WPA_MIXED,
- sec_type,sizeof(SLSI_WIFI_SECURITY_WPA_MIXED)) == 0) {
+ sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_MIXED)) == 0) {
ret->secmode = SLSI_SEC_MODE_WPA_MIXED;
} else if (strncmp(SLSI_WIFI_SECURITY_WPA_TKIP,
- sec_type,sizeof(SLSI_WIFI_SECURITY_WPA_TKIP)) == 0) {
+ sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_TKIP)) == 0) {
ret->secmode = SLSI_SEC_MODE_WPA_TKIP;
} else if (strncmp(SLSI_WIFI_SECURITY_WPA_AES,
- sec_type,sizeof(SLSI_WIFI_SECURITY_WPA_AES)) == 0) {
+ sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_AES)) == 0) {
ret->secmode = SLSI_SEC_MODE_WPA_CCMP;
} else if (strncmp(SLSI_WIFI_SECURITY_WPA2_MIXED,
- sec_type,sizeof(SLSI_WIFI_SECURITY_WPA2_MIXED)) == 0) {
+ sec_type, sizeof(SLSI_WIFI_SECURITY_WPA2_MIXED)) == 0) {
ret->secmode = SLSI_SEC_MODE_WPA2_MIXED;
} else if (strncmp(SLSI_WIFI_SECURITY_WPA2_TKIP,
sec_type, sizeof(SLSI_WIFI_SECURITY_WPA2_TKIP)) == 0) {
{
if (reason) {
printf("Disconnected from network reason_code: %d %s\n", reason->reason_code,
- reason->locally_generated ? "(locally_generated)": "");
+ reason->locally_generated ? "(locally_generated)" : "");
} else {
printf("Disconnected from network\n");
}
gnet_if->dhcp = NULL;
}
- printf( " netic hwaddr_len %d\n"
+ printf(" netic hwaddr_len %d\n"
" netic hwaddr %x%x%x%x%x%x\n"
" netic mtu %d\n"
" netic flags %x\n",
/* By default all output goes to stdout */
test->outfile = stdout;
- if (sem_init(&(test->sem_iperf_api),0 ,1) != OK) {
+ if (sem_init(&(test->sem_iperf_api), 0, 1) != OK) {
printf("iperf_new_test : failed on sem_init\n");
}
#define MQTT_CLIENT_PUB_COMMAND_NAME "mqtt_pub"
#define MQTT_ID_MAX_LENGTH 23
-#define MQTT_PUB_STACK_SIZE 20480
-#define MQTT_PUB_SCHED_PRI 100
-#define MQTT_PUB_SCHED_POLICY SCHED_RR
+#define MQTT_PUB_STACK_SIZE 20480
+#define MQTT_PUB_SCHED_PRI 100
+#define MQTT_PUB_SCHED_POLICY SCHED_RR
-#define MQTT_PUB_DEBUG_PRINT(client_handle,...) \
+#define MQTT_PUB_DEBUG_PRINT(client_handle, ...) \
do { \
if (client_handle && (client_handle)->config && (client_handle)->config->debug) \
printf(__VA_ARGS__); \
#define MQTT_CLIENT_SUB_COMMAND_NAME "mqtt_sub"
#define MQTT_ID_MAX_LENGTH 23
-#define MQTT_SUB_STACK_SIZE 20480
-#define MQTT_SUB_SCHED_PRI 100
-#define MQTT_SUB_SCHED_POLICY SCHED_RR
+#define MQTT_SUB_STACK_SIZE 20480
+#define MQTT_SUB_SCHED_PRI 100
+#define MQTT_SUB_SCHED_POLICY SCHED_RR
-#define MQTT_SUB_DEBUG_PRINT(client_handle,...) \
+#define MQTT_SUB_DEBUG_PRINT(client_handle, ...) \
do { \
if (client_handle && (client_handle)->config && (client_handle)->config->debug) \
printf(__VA_ARGS__); \
static int8_t tc = 1;
#define TESTPRINT(fmt, ...) \
- printf("\n\n**************************************************************************\n" \
- "[TESTCASE %d] " fmt "\n**************************************************************************\n" \
- ,tc++, ##__VA_ARGS__)
+ printf("\n\n**************************************************************************\n" \
+ "[TESTCASE %d] " fmt "\n**************************************************************************\n" \
+ , tc++, ##__VA_ARGS__)
#define PING_MAX_TRY_COUNTER 10
#endif
#define EXAMPLES_SMART_BUFSIZE \
- (CONFIG_RAMMTD_ERASESIZE * CONFIG_EXAMPLES_SMART_NEBLOCKS)
+ (CONFIG_RAMMTD_ERASESIZE * CONFIG_EXAMPLES_SMART_NEBLOCKS)
#endif
#ifndef CONFIG_EXAMPLES_SMART_MAXNAME
opt.arc4 = MBEDTLS_SSL_ARC4_ENABLED;
}
}
-
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
- /*
- * Unhexify the pre-shared key if any is given
- */
- if( strlen( opt.psk ) )
- {
- unsigned char c;
- size_t j;
-
- if( strlen( opt.psk ) % 2 != 0 )
- {
- mbedtls_printf("pre-shared key not valid hex\n");
- goto exit;
- }
-
- psk_len = strlen( opt.psk ) / 2;
-
- for( j = 0; j < strlen( opt.psk ); j += 2 )
- {
- c = opt.psk[j];
- if( c >= '0' && c <= '9' )
- c -= '0';
- else if( c >= 'a' && c <= 'f' )
- c -= 'a' - 10;
- else if( c >= 'A' && c <= 'F' )
- c -= 'A' - 10;
- else
- {
- mbedtls_printf("pre-shared key not valid hex\n");
- goto exit;
- }
- psk[ j / 2 ] = c << 4;
-
- c = opt.psk[j + 1];
- if( c >= '0' && c <= '9' )
- c -= '0';
- else if( c >= 'a' && c <= 'f' )
- c -= 'a' - 10;
- else if( c >= 'A' && c <= 'F' )
- c -= 'A' - 10;
- else
- {
- mbedtls_printf("pre-shared key not valid hex\n");
- goto exit;
- }
- psk[ j / 2 ] |= c;
- }
- }
-#endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */
+ /*
+ * Unhexify the pre-shared key if any is given
+ */
+ if (strlen(opt.psk)) {
+ unsigned char c;
+ size_t j;
+
+ if (strlen(opt.psk) % 2 != 0) {
+ mbedtls_printf("pre-shared key not valid hex\n");
+ goto exit;
+ }
+
+ psk_len = strlen(opt.psk) / 2;
+
+ for (j = 0; j < strlen(opt.psk); j += 2) {
+ c = opt.psk[j];
+ if (c >= '0' && c <= '9') {
+ c -= '0';
+ } else if (c >= 'a' && c <= 'f') {
+ c -= 'a' - 10;
+ } else if (c >= 'A' && c <= 'F') {
+ c -= 'A' - 10;
+ } else {
+ mbedtls_printf("pre-shared key not valid hex\n");
+ goto exit;
+ }
+ psk[j / 2] = c << 4;
+
+ c = opt.psk[j + 1];
+ if (c >= '0' && c <= '9') {
+ c -= '0';
+ } else if (c >= 'a' && c <= 'f') {
+ c -= 'a' - 10;
+ } else if (c >= 'A' && c <= 'F') {
+ c -= 'A' - 10;
+ } else {
+ mbedtls_printf("pre-shared key not valid hex\n");
+ goto exit;
+ }
+ psk[j / 2] |= c;
+ }
+ }
+#endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */
#if defined(MBEDTLS_SSL_ALPN)
if (opt.alpn_string != NULL) {
#ifdef CONFIG_EXAMPLES_TLS_ARTIK_KEY
unsigned int cert_buflen = SEE_MAX_BUF_SIZE;
char *cert_buf = NULL;
- const char cert_start[2] = {0x30, 0x82};
+ const char cert_start[2] = { 0x30, 0x82 };
cert_buf = (char *)malloc(SEE_MAX_BUF_SIZE);
goto exit;
}
- char *cert_offset[3] = {NULL, NULL, NULL};
+ char *cert_offset[3] = { NULL, NULL, NULL };
cert_offset[0] = cert_buf + 4;
cert_offset[1] = strstr(cert_offset[0] + 4, cert_start);
*/
const mbedtls_pk_info_t *pk_info;
- if((pk_info = mbedtls_pk_info_from_type(MBEDTLS_PK_ECKEY))== NULL) {
+ if ((pk_info = mbedtls_pk_info_from_type(MBEDTLS_PK_ECKEY)) == NULL) {
mbedtls_printf(" failed\n ! mbedtls_pk_info_from_type -0x%x\n", -ret);
goto exit;
}
- if((ret = mbedtls_pk_setup(&pkey, pk_info)) != 0) {
+ if ((ret = mbedtls_pk_setup(&pkey, pk_info)) != 0) {
mbedtls_printf(" failed\n ! mbedtls_pk_setup -0x%x\n", -ret);
goto exit;
}
goto exit;
}
#endif
-#endif /* EXAMPLES_ARTIK_KEY */
+#endif /* EXAMPLES_ARTIK_KEY */
mbedtls_printf(" . Connecting to %s/%s/%s...", opt.transport == MBEDTLS_SSL_TRANSPORT_STREAM ? "tcp" : "udp", opt.server_addr, opt.server_port);
fflush(stdout);
#endif
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
- if( ( ret = mbedtls_ssl_conf_psk( &conf, psk, psk_len,
- (const unsigned char *) opt.psk_identity,
- strlen( opt.psk_identity ) ) ) != 0 )
- {
- mbedtls_printf( " failed\n ! mbedtls_ssl_conf_psk returned %d\n\n", ret );
- goto exit;
- }
+ if ((ret = mbedtls_ssl_conf_psk(&conf, psk, psk_len, (const unsigned char *)opt.psk_identity, strlen(opt.psk_identity))) != 0) {
+ mbedtls_printf(" failed\n ! mbedtls_ssl_conf_psk returned %d\n\n", ret);
+ goto exit;
+ }
#endif
if (opt.min_version != DFL_MIN_VERSION) {
if (opt.max_version != DFL_MAX_VERSION) {
mbedtls_ssl_conf_max_version(&conf, MBEDTLS_SSL_MAJOR_VERSION_3, opt.max_version);
}
-
#if defined(MBEDTLS_SSL_FALLBACK_SCSV)
if (opt.fallback != DFL_FALLBACK) {
mbedtls_ssl_conf_fallback(&conf, opt.fallback);
#define TLS_SELFTEST_SCHED_POLICY SCHED_RR
-#define DO_TLS_TEST(func, v) \
-if ((ret = func(v)) != 0) { \
- printf("fail %d\n", ret); \
- fail_cnt++; \
+#define DO_TLS_TEST(func, v) \
+if ((ret = func(v)) != 0) { \
+ printf("fail %d\n", ret); \
+ fail_cnt++; \
}
pthread_addr_t tls_selftest_cb(void *args)
#define NET_DEVNAME "wl1"
-#define WAKAAMA_CHECK_ARG() do {\
- if (opt >= argc) { \
- app_print_usage(); \
- return 0; \
- } \
-} \
-while (0);
+#define WAKAAMA_CHECK_ARG() \
+ do {\
+ if (opt >= argc) { \
+ app_print_usage(); \
+ return 0; \
+ } \
+ } while (0);
#if defined(CONFIG_NET_LWIP_DHCPC) && !defined(CONFIG_NETUTILS_DHCPC)
#include <apps/netutils/dhcpc.h>
#include <apps/netutils/netlib.h>
-#if defined (CONFIG_NETDB_DNSCLIENT) && defined (CONFIG_NETDB_DNSSERVER_BY_DHCP)
+#if defined(CONFIG_NETDB_DNSCLIENT) && defined(CONFIG_NETDB_DNSSERVER_BY_DHCP)
#include <tinyara/net/dns.h>
#endif
/****************************************************************************
ndbg("Got default router %d.%d.%d.%d\n", (presult->default_router.s_addr) & 0xff, (presult->default_router.s_addr >> 8) & 0xff, (presult->default_router.s_addr >> 16) & 0xff, (presult->default_router.s_addr >> 24) & 0xff);
ndbg("Lease expires in %d seconds\n", presult->lease_time);
-#if defined (CONFIG_NETDB_DNSCLIENT) && defined (CONFIG_NETDB_DNSSERVER_BY_DHCP)
+#if defined(CONFIG_NETDB_DNSCLIENT) && defined(CONFIG_NETDB_DNSSERVER_BY_DHCP)
struct sockaddr_in dns;
if (presult->dnsaddr.s_addr != 0) {
ndbg("Set DNS IP address via dns_add_nameserver\n");
#include <stdio.h>
#define PRINTF(...) printf(__VA_ARGS__)
#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15])
-#define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5])
+#define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]", (lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3], (lladdr)->addr[4], (lladdr)->addr[5])
#else
#define PRINTF(...)
#define PRINT6ADDR(addr)
}
#define FILL_QN_ENTRY(rr, _name, _type, _unicast_query) \
- rr->name = _name; \
- rr->type = _type; \
- rr->unicast_query = _unicast_query; \
- rr->rr_class = 1;
+ rr->name = _name; \
+ rr->type = _type; \
+ rr->unicast_query = _unicast_query; \
+ rr->rr_class = 1;
#define FILL_RR_ENTRY(rr, _name, _type) \
- rr->name = _name; \
- rr->type = _type; \
- rr->ttl = DEFAULT_TTL; \
- rr->cache_flush = 1; \
- rr->rr_class = 1;
+ rr->name = _name; \
+ rr->type = _type; \
+ rr->ttl = DEFAULT_TTL; \
+ rr->cache_flush = 1; \
+ rr->rr_class = 1;
struct rr_entry *qn_create(uint8_t *name, enum rr_type type, int unicast_query)
{
return off;
}
-#if MDNS_DEBUG_PRINTF==1 && MDNS_MEMORY_DEBUG==1
+#if (MDNS_DEBUG_PRINTF == 1) && (MDNS_MEMORY_DEBUG == 1)
struct mdns_meminfo_node {
char *func;
int line;
#include "mdns.h"
#include <apps/netutils/mdnsd.h>
-#if MDNS_DEBUG_PRINTF==1 && MDNS_RR_DEBUG==1
+#if (MDNS_DEBUG_PRINTF == 1) && (MDNS_RR_DEBUG == 1)
#define MDNSD_RR_DEBUG
#endif
-#if MDNS_DEBUG_PRINTF==1 && MDNS_MEMORY_DEBUG==1
+#if (MDNS_DEBUG_PRINTF == 1) && (MDNS_MEMORY_DEBUG == 1)
#define MDNSD_MEMORY_DEBUG
#endif
#define PACKET_SIZE 1536 /* maximum packet size : */
#define SERVICES_DNS_SD_NLABEL \
- ((uint8_t *)"\x09_services\x07_dns-sd\x04_udp\x05local")
+ ((uint8_t *)"\x09_services\x07_dns-sd\x04_udp\x05local")
#define TIME_GET(time) gettimeofday(&time, NULL)
#define TIME_DIFF_USEC(old_time, cur_time) \
- ((cur_time.tv_sec * 1000000 + cur_time.tv_usec) - (old_time.tv_sec * 1000000 + old_time.tv_usec))
+ ((cur_time.tv_sec * 1000000 + cur_time.tv_usec) - (old_time.tv_sec * 1000000 + old_time.tv_usec))
#define MAX_ECONNRESET_COUNT 5
int create_pipe(int handles[2])
{
-#if PIPE_SOCKET_TYPE ==1
+#if (PIPE_SOCKET_TYPE == 1)
int result = -1;
struct sockaddr_in serv_addr;
int read_pipe(int s, char *buf, int len)
{
-#if PIPE_SOCKET_TYPE ==1
+#if (PIPE_SOCKET_TYPE == 1)
int ret;
struct sockaddr_in fromaddr;
socklen_t sockaddr_size = sizeof(struct sockaddr_in);
int write_pipe(int s, char *buf, int len, int port)
{
-#if PIPE_SOCKET_TYPE ==1
+#if (PIPE_SOCKET_TYPE == 1)
static struct sockaddr_in toaddr;
memset(&toaddr, 0, sizeof(struct sockaddr_in));
}
/* create main_loop thread */
- if ((pthread_create(&tid, &attr, (void * ( *)(void *))main_loop, (void *)g_svr) != 0)) {
+ if ((pthread_create(&tid, &attr, (void * (*)(void *))main_loop, (void *)g_svr) != 0)) {
ndbg("ERROR: pthread_create() failed.\n");
goto errout_with_mutex;
}
} else {
return GetTickCount() / 1000; /* FIXME - need to deal with overflow. */
}
-#elif _POSIX_TIMERS>0 && defined(_POSIX_MONOTONIC_CLOCK)
+#elif (_POSIX_TIMERS > 0) && defined(_POSIX_MONOTONIC_CLOCK)
struct timespec tp;
clock_gettime(CLOCK_MONOTONIC, &tp);
}
}
}
-stop :
+stop:
HTTP_LOGD("http_server_hander stop :%d\n", server->port);
if (msg_q >= 0) {
int read_finish = false;
int method = HTTP_METHOD_UNKNOWN;
- char url[HTTP_CONF_MAX_REQUEST_HEADER_URL_LENGTH] =
- { 0, };
+ char url[HTTP_CONF_MAX_REQUEST_HEADER_URL_LENGTH] = { 0, };
int buf_len = 0;
int remain = HTTP_CONF_MAX_REQUEST_LENGTH;
int enc = HTTP_CONTENT_LENGTH;
extern void printf_encode(char *txt, size_t maxlen, const u8 *data, size_t len);
#ifdef CONFIG_DEBUG_WLAN_API_VERBOSE
-#define VPRINT(format, ...) printf("SLSI API VERBOSE (%s): " format,__FUNCTION__, ##__VA_ARGS__)
+#define VPRINT(format, ...) printf("SLSI API VERBOSE (%s): " format, __FUNCTION__, ##__VA_ARGS__)
#define SLSI_API_VERBOSE (1)
#ifndef CONFIG_DEBUG_WLAN_API_DEBUG
#define CONFIG_DEBUG_WLAN_API_DEBUG
#endif //CONFIG_DEBUG_WLAN_API_VERBOSE
#ifdef CONFIG_DEBUG_WLAN_API_DEBUG
-#define DPRINT(format, ...) printf("SLSI API DEBUG (%s): " format,__FUNCTION__, ##__VA_ARGS__)
+#define DPRINT(format, ...) printf("SLSI API DEBUG (%s): " format, __FUNCTION__, ##__VA_ARGS__)
#ifndef CONFIG_DEBUG_WLAN_API_ERROR
#define CONFIG_DEBUG_WLAN_API_ERROR
#endif
#endif //CONFIG_DEBUG_WLAN_API_DEBUG
#ifdef CONFIG_DEBUG_WLAN_API_ERROR
-#define EPRINT(format, ...) printf("SLSI API ERROR (%s): " format,__FUNCTION__, ##__VA_ARGS__)
+#define EPRINT(format, ...) printf("SLSI API ERROR (%s): " format, __FUNCTION__, ##__VA_ARGS__)
#else
#define EPRINT(a, ...) (void)0
#endif //CONFIG_DEBUG_WLAN_API_ERROR
#endif
#define LOCKUNLOCK_CRITICAL { \
- EPRINT("LOCKUNLOCK_CRITICAL - %s\n", __func__); \
- if (SLSI_API_VERBOSE) fflush(stdout); \
- pthread_mutex_trylock(&mutex_state); \
- pthread_mutex_unlock(&mutex_state); \
+ EPRINT("LOCKUNLOCK_CRITICAL - %s\n", __func__); \
+ if (SLSI_API_VERBOSE) fflush(stdout); \
+ pthread_mutex_trylock(&mutex_state); \
+ pthread_mutex_unlock(&mutex_state); \
}
#define ENTER_CRITICAL { \
- VPRINT("ENTER_CRITICAL in API - %s\n", __func__); \
- if (!g_mutex_initialized) { \
- VPRINT("Initializing the mutex\n"); \
- if (pthread_mutex_init(&mutex_state, NULL) != OK) { \
- EPRINT("Could not initialize mutex\n"); \
- } else { \
- VPRINT("Mutex ready\n"); \
- g_mutex_initialized = TRUE; \
- } \
- } \
- if (SLSI_API_VERBOSE) fflush(stdout); \
- int err = pthread_mutex_lock(&mutex_state); \
- if (err != OK) { \
- EPRINT("mutex lock failed with error %d",err); \
- } \
- if (g_state == SLSI_WIFIAPI_STATE_RECOVERING || g_recovering ) { \
- VPRINT("sem_wait recovering - %s\n", __func__); \
- if (SLSI_API_VERBOSE) fflush(stdout); \
- sem_wait(&g_sem_api_block);} \
+ VPRINT("ENTER_CRITICAL in API - %s\n", __func__); \
+ if (!g_mutex_initialized) { \
+ VPRINT("Initializing the mutex\n"); \
+ if (pthread_mutex_init(&mutex_state, NULL) != OK) { \
+ EPRINT("Could not initialize mutex\n"); \
+ } else { \
+ VPRINT("Mutex ready\n"); \
+ g_mutex_initialized = TRUE; \
+ } \
+ } \
+ if (SLSI_API_VERBOSE) fflush(stdout); \
+ int err = pthread_mutex_lock(&mutex_state); \
+ if (err != OK) { \
+ EPRINT("mutex lock failed with error %d", err); \
+ } \
+ if (g_state == SLSI_WIFIAPI_STATE_RECOVERING || g_recovering) { \
+ VPRINT("sem_wait recovering - %s\n", __func__); \
+ if (SLSI_API_VERBOSE) fflush(stdout); \
+ sem_wait(&g_sem_api_block); \
+ } \
}
#define LEAVE_CRITICAL { \
- VPRINT("LEAVE_CRITICAL in API - %s\n", __func__); \
- if (SLSI_API_VERBOSE) fflush(stdout); \
- pthread_mutex_unlock(&mutex_state); \
+ VPRINT("LEAVE_CRITICAL in API - %s\n", __func__); \
+ if (SLSI_API_VERBOSE) fflush(stdout); \
+ pthread_mutex_unlock(&mutex_state); \
}
/*
printf("IP address %s\n", inet_ntoa(ds.ipaddr));
printf("Netmask %s\n", inet_ntoa(ds.netmask));
printf("Gateway %s\n", inet_ntoa(ds.default_router));
-#if defined (CONFIG_NETDB_DNSCLIENT) && defined (CONFIG_NETDB_DNSSERVER_BY_DHCP)
+#if defined(CONFIG_NETDB_DNSCLIENT) && defined(CONFIG_NETDB_DNSSERVER_BY_DHCP)
printf("Default DNS %s\n", inet_ntoa(ds.dnsaddr));
#endif
dhcpc_close(handle);
u8 ip_addr_buf[4];
#endif /* CONFIG_P2P */
- if (! !authorized == ! !(sta->flags & WLAN_STA_AUTHORIZED)) {
+ if (!!authorized == !!(sta->flags & WLAN_STA_AUTHORIZED)) {
return;
}
* underscore).
*/
#define _GET_VLAN_REALDEV_NAME_CMD 8
-#define _GET_VLAN_VID_CMD 9
+#define _GET_VLAN_VID_CMD 9
/* This value should be 256 ONLY. If it is something else, then hostapd
* might crash!, as this value has been hard-coded in 2.4.x kernel
* bridging code.
*/
-#define MAX_BR_PORTS 256
+#define MAX_BR_PORTS 256
static int br_delif(const char *br_name, const char *if_name)
{
#endif /* CONFIG_IEEE80211W */
WPA_PUT_LE16((u8 *)
- & mgmt->u.action.u.wnm_sleep_resp.keydata_len, gtk_elem_len + igtk_elem_len);
+ &mgmt->u.action.u.wnm_sleep_resp.keydata_len, gtk_elem_len + igtk_elem_len);
}
os_memcpy(pos, &wnmsleep_ie, wnmsleep_ie_len);
/* copy TFS IE here */
return rk;
}
-static void rijndaelDecrypt(const u32 rk[ /*44 */ ], int Nr, const u8 ct[16],
+static void rijndaelDecrypt(const u32 rk[/* 44 */], int Nr, const u8 ct[16],
u8 pt[16])
{
u32 s0, s1, s2, s3, t0, t1, t2, t3;
s2 = GETU32(ct + 8) ^ rk[2];
s3 = GETU32(ct + 12) ^ rk[3];
-#define ROUND(i,d,s) \
+#define ROUND(i, d, s) \
d##0 = TD0(s##0) ^ TD1(s##3) ^ TD2(s##2) ^ TD3(s##1) ^ rk[4 * i]; \
d##1 = TD0(s##1) ^ TD1(s##0) ^ TD2(s##3) ^ TD3(s##2) ^ rk[4 * i + 1]; \
d##2 = TD0(s##2) ^ TD1(s##1) ^ TD2(s##0) ^ TD3(s##3) ^ rk[4 * i + 2]; \
s2 = GETU32(pt + 8) ^ rk[2];
s3 = GETU32(pt + 12) ^ rk[3];
-#define ROUND(i,d,s) \
+#define ROUND(i, d, s) \
d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \
d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + 1]; \
d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \
#define mp_unsigned_bin_size(a) ltc_mp.unsigned_size(a)
#define mp_to_unsigned_bin(a, b) ltc_mp.unsigned_write(a, b)
#define mp_read_unsigned_bin(a, b, c) ltc_mp.unsigned_read(a, b, c)
-#define mp_exptmod(a,b,c,d) ltc_mp.exptmod(a,b,c,d)
+#define mp_exptmod(a, b, c, d) ltc_mp.exptmod(a, b, c, d)
#endif
int md4_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
#endif /* ALL_DH_GROUPS */
-#define DH_GROUP(id,safe) \
+#define DH_GROUP(id, safe) \
{ id, dh_group ## id ## _generator, sizeof(dh_group ## id ## _generator), \
dh_group ## id ## _prime, sizeof(dh_group ## id ## _prime), \
dh_group ## id ## _order, sizeof(dh_group ## id ## _order), safe }
/* This is the central step in the MD4 algorithm. */
#define MD4STEP(f, w, x, y, z, data, s) \
- ( w += f(x, y, z) + data, w = w<<s | w>>(32-s) )
+ (w += f(x, y, z) + data, w = w << s | w >> (32 - s))
/*
* The core of the MD4 algorithm, this alters an existing MD4 hash to
/* This is the central step in the MD5 algorithm. */
#define MD5STEP(f, w, x, y, z, data, s) \
- ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
+ (w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x)
/*
* The core of the MD5 algorithm, this alters an existing MD5 hash to
block->l[(i + 8) & 15] ^ block->l[(i + 2) & 15] ^ block->l[i & 15], 1))
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
-#define R0(v,w,x,y,z,i) \
+#define R0(v, w, x, y, z, i) \
z += ((w & (x ^ y)) ^ y) + blk0(i) + 0x5A827999 + rol(v, 5); \
w = rol(w, 30);
-#define R1(v,w,x,y,z,i) \
+#define R1(v, w, x, y, z, i) \
z += ((w & (x ^ y)) ^ y) + blk(i) + 0x5A827999 + rol(v, 5); \
w = rol(w, 30);
-#define R2(v,w,x,y,z,i) \
+#define R2(v, w, x, y, z, i) \
z += (w ^ x ^ y) + blk(i) + 0x6ED9EBA1 + rol(v, 5); w = rol(w, 30);
-#define R3(v,w,x,y,z,i) \
+#define R3(v, w, x, y, z, i) \
z += (((w | x) & y) | (w & x)) + blk(i) + 0x8F1BBCDC + rol(v, 5); \
w = rol(w, 30);
-#define R4(v,w,x,y,z,i) \
+#define R4(v, w, x, y, z, i) \
z += (w ^ x ^ y) + blk(i) + 0xCA62C1D6 + rol(v, 5); \
- w=rol(w, 30);
+ w = rol(w, 30);
#ifdef VERBOSE /* SAK */
void SHAPrintContext(SHA1_CTX *context, char *msg)
/* Various logical functions */
#define RORc(x, y) \
-( ((((unsigned long) (x) & 0xFFFFFFFFUL) >> (unsigned long) ((y) & 31)) | \
- ((unsigned long) (x) << (unsigned long) (32 - ((y) & 31)))) & 0xFFFFFFFFUL)
-#define Ch(x,y,z) (z ^ (x & (y ^ z)))
-#define Maj(x,y,z) (((x | y) & z) | (x & y))
+ (((((unsigned long)(x) & 0xFFFFFFFFUL) >> (unsigned long)((y) & 31)) | \
+ ((unsigned long)(x) << (unsigned long)(32 - ((y) & 31)))) & 0xFFFFFFFFUL)
+#define Ch(x, y, z) (z ^ (x & (y ^ z)))
+#define Maj(x, y, z) (((x | y) & z) | (x & y))
#define S(x, n) RORc((x), (n))
#define R(x, n) (((x)&0xFFFFFFFFUL)>>(n))
#define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22))
}
/* Compress */
-#define RND(a,b,c,d,e,f,g,h,i) \
+#define RND(a, b, c, d, e, f, g, h, i) \
t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \
t1 = Sigma0(a) + Maj(a, b, c); \
d += t0; \
size_t pre_shared_secret_len;
int established;
int verify_peer;
- unsigned int disable_time_checks: 1;
+ unsigned int disable_time_checks : 1;
struct wpabuf *push_buf;
struct wpabuf *pull_buf;
u8 *session_ticket;
size_t session_ticket_len;
- unsigned int ca_cert_verify: 1;
- unsigned int cert_probe: 1;
- unsigned int server_cert_only: 1;
- unsigned int invalid_hb_used: 1;
+ unsigned int ca_cert_verify : 1;
+ unsigned int cert_probe : 1;
+ unsigned int server_cert_only : 1;
+ unsigned int invalid_hb_used : 1;
u8 srv_cert_hash[32];
unsigned int num_multichan_concurrent;
- unsigned int error: 1;
- unsigned int device_ap_sme: 1;
- unsigned int poll_command_supported: 1;
- unsigned int data_tx_status: 1;
- unsigned int monitor_supported: 1;
- unsigned int auth_supported: 1;
- unsigned int connect_supported: 1;
- unsigned int p2p_go_supported: 1;
- unsigned int p2p_client_supported: 1;
- unsigned int p2p_go_ctwindow_supported: 1;
- unsigned int p2p_concurrent: 1;
- unsigned int channel_switch_supported: 1;
- unsigned int set_qos_map_supported: 1;
- unsigned int have_low_prio_scan: 1;
- unsigned int wmm_ac_supported: 1;
- unsigned int mac_addr_rand_scan_supported: 1;
- unsigned int mac_addr_rand_sched_scan_supported: 1;
+ unsigned int error : 1;
+ unsigned int device_ap_sme : 1;
+ unsigned int poll_command_supported : 1;
+ unsigned int data_tx_status : 1;
+ unsigned int monitor_supported : 1;
+ unsigned int auth_supported : 1;
+ unsigned int connect_supported : 1;
+ unsigned int p2p_go_supported : 1;
+ unsigned int p2p_client_supported : 1;
+ unsigned int p2p_go_ctwindow_supported : 1;
+ unsigned int p2p_concurrent : 1;
+ unsigned int channel_switch_supported : 1;
+ unsigned int set_qos_map_supported : 1;
+ unsigned int have_low_prio_scan : 1;
+ unsigned int wmm_ac_supported : 1;
+ unsigned int mac_addr_rand_scan_supported : 1;
+ unsigned int mac_addr_rand_sched_scan_supported : 1;
};
static unsigned int probe_resp_offload_support(int supp_protocols)
[NL80211_IFACE_COMB_NUM_CHANNELS] = {.type = NLA_U32},
[NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS] = {.type = NLA_U32},
}, iface_limit_policy[NUM_NL80211_IFACE_LIMIT] = {
- [NL80211_IFACE_LIMIT_TYPES] = {
- .type = NLA_NESTED
- }, [NL80211_IFACE_LIMIT_MAX] = {
- .type = NLA_U32
- },
+ [NL80211_IFACE_LIMIT_TYPES] = {.type = NLA_NESTED},
+ [NL80211_IFACE_LIMIT_MAX] = {.type = NLA_U32},
};
err = nla_parse_nested(tb_comb, MAX_NL80211_IFACE_COMB, nl_combi, iface_combination_policy);
struct wpabuf *out_buf;
size_t out_used;
size_t fragment_size;
- unsigned int was_done: 1;
- unsigned int was_fail: 1;
+ unsigned int was_done : 1;
+ unsigned int was_fail : 1;
};
/* EAP-TNC Flags */
struct radius_msg *last_reply;
u8 last_authenticator[16];
- unsigned int remediation: 1;
- unsigned int macacl: 1;
+ unsigned int remediation : 1;
+ unsigned int macacl : 1;
struct hostapd_radius_attr *accept_attr;
};
struct wpa_tdls_peer {
struct wpa_tdls_peer *next;
- unsigned int reconfig_key: 1;
+ unsigned int reconfig_key : 1;
int initiator; /* whether this end was initiator for TDLS setup */
u8 addr[ETH_ALEN]; /* other end MAC address */
u8 inonce[WPA_NONCE_LEN]; /* Initiator Nonce */
/**
* wpa_tdls_send_error - To send suitable TDLS status response with
* appropriate status code mentioning reason for error/failure.
- * @dst - MAC addr of Peer station
+ * @dst - MAC addr of Peer station
* @tdls_action - TDLS frame type for which error code is sent
- * @initiator - was this end the initiator of the connection
- * @status - status code mentioning reason
+ * @initiator - was this end the initiator of the connection
+ * @status - status code mentioning reason
*/
static int wpa_tdls_send_error(struct wpa_sm *sm, const u8 *dst, u8 tdls_action, u8 dialog_token, int initiator, u16 status)
/* from tommath.h */
#ifndef MIN
-#define MIN(x,y) ((x)<(y)?(x):(y))
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
#endif
#ifndef MAX
-#define MAX(x,y) ((x)>(y)?(x):(y))
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
#endif
#define OPT_CAST(x)
{
switch (c) {
case EDIT_KEY_ENTER:
- case EDIT_KEY_CTRL_J:
- case EDIT_KEY_LEFT:
- case EDIT_KEY_RIGHT:
- case EDIT_KEY_HOME:
- case EDIT_KEY_END:
- case EDIT_KEY_CTRL_A:
- case EDIT_KEY_CTRL_E:
- search_stop();
+ case EDIT_KEY_CTRL_J:
+ case EDIT_KEY_LEFT:
+ case EDIT_KEY_RIGHT:
+ case EDIT_KEY_HOME:
+ case EDIT_KEY_END:
+ case EDIT_KEY_CTRL_A:
+ case EDIT_KEY_CTRL_E:
+ search_stop();
return c;
case EDIT_KEY_DOWN:
case EDIT_KEY_UP:
struct wps_nfc_pw_token {
struct dl_list list;
u8 pubkey_hash[WPS_OOB_PUBKEY_HASH_LEN];
- unsigned int peer_pk_hash_known: 1;
+ unsigned int peer_pk_hash_known : 1;
u16 pw_id;
u8 dev_pw[WPS_OOB_DEVICE_PASSWORD_LEN * 2 + 1];
size_t dev_pw_len;
* better. */
static int wpa_scan_result_compar(const void *a, const void *b)
{
-#define MIN(a,b) a < b ? a : b
+#define MIN(a, b) a < b ? a : b
struct wpa_scan_res **_wa = (void *)a;
struct wpa_scan_res **_wb = (void *)b;
struct wpa_scan_res *wa = *_wa;
cardinality = relation_cardinality(rel);
- for(tuple_id = 0; tuple_id < cardinality; tuple_id++) {
+ for (tuple_id = 0; tuple_id < cardinality; tuple_id++) {
memset(row, 0, sizeof(row));
result = storage_get_row(rel, &tuple_id, row);
if (DB_ERROR(result)) {
****************************************************************************/
/* This structure describes the state of one ADC block */
-struct s5j_dev_s
-{
+struct s5j_dev_s {
FAR const struct adc_callback_s *cb;
struct adc_dev_s *dev; /* A reference to the outer (parent) */
/* Get the pin number */
pin = (cfgset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT;
- switch(cfgset & GPIO_FUNC_MASK) {
+ switch (cfgset & GPIO_FUNC_MASK) {
case GPIO_INPUT:
ret = s5j_configinput(cfgset, port, pin);
break;
unsigned long cal_clk_getrate(unsigned int id)
{
- unsigned long rate=0;
+ unsigned long rate = 0;
switch (id) {
case d1_spi0:
/****************************************************************************
* Private Types
****************************************************************************/
-struct rtc_regvals_s
-{
+struct rtc_regvals_s {
uint8_t bcdsec;
uint8_t bcdmin;
uint8_t bcdhour;
****************************************************************************/
static uint32_t rtc_bin2bcd(int value)
{
- uint32_t hundreds, tens;
+ uint32_t hundreds;
+ uint32_t tens;
hundreds = tens = 0;
* Private Types
****************************************************************************/
#ifdef CONFIG_RTC_ALARM
-struct s5j_cbinfo_s
-{
+struct s5j_cbinfo_s {
volatile rtc_alarm_callback_t cb; /* Callback when the alarm expires */
volatile FAR void *priv; /* Private arg passed to callback */
};
#endif /* CONFIG_RTC_ALARM */
-struct s5j_lowerhalf_s
-{
+struct s5j_lowerhalf_s {
/*
* This is the contained reference to the read-only, lower-half
* operations vtable (which may lie in FLASH or ROM
.irq = S5J_IRQ_UART3,
.parity = CONFIG_UART3_PARITY,
.bits = CONFIG_UART3_BITS,
- .stopbits2 = CONFIG_UART3_2STOP,
+ .stopbits2 = CONFIG_UART3_2STOP,
.rxd = GPIO_UART3_RXD,
.txd = GPIO_UART3_TXD,
#ifdef CONFIG_S5J_UART3_FLOWCONTROL
* Private Data
*****************************************************************************/
-static const struct spi_ops_s g_spiops =
-{
+static const struct spi_ops_s g_spiops = {
#ifndef CONFIG_SPI_OWNBUS
.lock = spi_lock,
#endif
.registercallback = 0,
};
-static struct s5j_spidev_s g_spi0dev =
-{
+static struct s5j_spidev_s g_spi0dev = {
.spidev = { .ops = &g_spiops },
.base = S5J_SPI0_BASE,
.port = SPI_PORT0,
.gpio_miso = GPIO_SPI0_MISO,
.gpio_mosi = GPIO_SPI0_MOSI,
};
-static struct s5j_spidev_s g_spi1dev =
-{
+static struct s5j_spidev_s g_spi1dev = {
.spidev = { .ops = &g_spiops },
.base = S5J_SPI1_BASE,
.port = SPI_PORT1,
.gpio_miso = GPIO_SPI1_MISO,
.gpio_mosi = GPIO_SPI1_MOSI,
};
-static struct s5j_spidev_s g_spi2dev =
-{
+static struct s5j_spidev_s g_spi2dev = {
.spidev = { .ops = &g_spiops },
.base = S5J_SPI2_BASE,
.port = SPI_PORT2,
.gpio_miso = GPIO_SPI2_MISO,
.gpio_mosi = GPIO_SPI2_MOSI,
};
-static struct s5j_spidev_s g_spi3dev =
-{
+static struct s5j_spidev_s g_spi3dev = {
.spidev = { .ops = &g_spiops },
.base = S5J_SPI3_BASE,
.port = SPI_PORT3,
mode_cfg = mode_cfg & (~(MODE_CFG_BUS_WDT_MASK | MODE_CFG_CH_WDT_MASK));
switch (nbits) {
- case 8:
- mode_cfg = mode_cfg | MODE_CFG_BUS_WIDTH_8 | MODE_CFG_CH_WIDTH_8;
- break;
+ case 8:
+ mode_cfg = mode_cfg | MODE_CFG_BUS_WIDTH_8 | MODE_CFG_CH_WIDTH_8;
+ break;
- case 16:
- mode_cfg = mode_cfg | MODE_CFG_BUS_WIDTH_16 | MODE_CFG_CH_WIDTH_16;
- break;
+ case 16:
+ mode_cfg = mode_cfg | MODE_CFG_BUS_WIDTH_16 | MODE_CFG_CH_WIDTH_16;
+ break;
- case 32:
- mode_cfg = mode_cfg | MODE_CFG_BUS_WIDTH_32 | MODE_CFG_CH_WIDTH_32;
- break;
+ case 32:
+ mode_cfg = mode_cfg | MODE_CFG_BUS_WIDTH_32 | MODE_CFG_CH_WIDTH_32;
+ break;
- default:
- DEBUGASSERT(0 == 1);
- break;
+ default:
+ DEBUGASSERT(0 == 1);
+ break;
}
putreg32(mode_cfg, &pSPIRegs->MODE_CFG);
}
switch (port) {
- case 0:
- priv = &g_spi0dev;
- break;
- case 1:
- priv = &g_spi1dev;
- break;
- case 2:
- priv = &g_spi2dev;
- break;
- case 3:
- priv = &g_spi3dev;
- break;
+ case 0:
+ priv = &g_spi0dev;
+ break;
+ case 1:
+ priv = &g_spi1dev;
+ break;
+ case 2:
+ priv = &g_spi2dev;
+ break;
+ case 3:
+ priv = &g_spi3dev;
+ break;
}
lldbg("Prepare SPI%d for Master operation\n", priv->port);
/* Device geometry description, compact form (2 bytes per entry) */
struct ee_geom_s {
- uint8_t bytes: 4; /* Power of two of 128 bytes (0:128 1:256 2:512 etc) */
- uint8_t org: 4; /* Organization, bytes */
- uint8_t addrlen: 4; /* Number of bytes in command address field */
- uint8_t flags: 4; /* Special Features ??? */
+ uint8_t bytes : 4; /* Power of two of 128 bytes (0:128 1:256 2:512 etc) */
+ uint8_t org : 4; /* Organization, bytes */
+ uint8_t addrlen : 4; /* Number of bytes in command address field */
+ uint8_t flags : 4; /* Special Features ??? */
};
static const struct ee_geom_s g_ee_devices[] = {
#endif
#ifdef CONFIG_EXAMPLES_EEPROM_TEST
- ee_test_main(0, NULL);
+ ee_test_main(0, NULL);
#endif
/* to suppress a compiler warning */
/****************************************************************************
* Public Data
****************************************************************************/
-const struct file_operations bch_fops =
-{
+const struct file_operations bch_fops = {
bch_open, /* open */
bch_close, /* close */
bch_read, /* read */
****************************************************************************/
#ifdef CONFIG_RTC_ALARM
-struct rtc_alarminfo_s
-{
- bool active; /* True: alarm is active */
- uint8_t signo; /* Signal number for alarm notification */
- pid_t pid; /* Identifies task to be notified */
+struct rtc_alarminfo_s {
+ bool active; /* True: alarm is active */
+ uint8_t signo; /* Signal number for alarm notification */
+ pid_t pid; /* Identifies task to be notified */
union sigval sigvalue; /* Data passed with notification */
};
#endif
-struct rtc_upperhalf_s
-{
+struct rtc_upperhalf_s {
FAR struct rtc_lowerhalf_s *lower; /* Contained lower half driver */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
* Private Data
****************************************************************************/
-static const struct file_operations rtc_fops =
-{
+static const struct file_operations rtc_fops = {
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
rtc_open, /* open */
rtc_close, /* close */
#else
- 0, /* open */
- 0, /* close */
+ 0, /* open */
+ 0, /* close */
#endif
rtc_read, /* read */
rtc_write, /* write */
- 0, /* seek */
+ 0, /* seek */
rtc_ioctl, /* ioctl */
#ifndef CONFIG_DISABLE_POLL
- 0, /* poll */
+ 0, /* poll */
#endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
rtc_unlink /* unlink */
struct slsi_mib_data mibrsp = { 0, NULL };
int rxLength = 0;
int r;
- static const struct slsi_mib_get_entry getValues[] = { {SLSI_PSID_UNIFI_FAST_POWER_SAVE_TIMEOUT, {0, 0}},
- {SLSI_PSID_UNIFI_CHIP_VERSION, {0, 0}},
- {SLSI_PSID_UNIFI_FIRMWARE_BUILD_ID, {0, 0}},
- {SLSI_PSID_UNIFI_FIRMWARE_PATCH_BUILD_ID, {0, 0}},
+ static const struct slsi_mib_get_entry getValues[] = { { SLSI_PSID_UNIFI_FAST_POWER_SAVE_TIMEOUT, { 0, 0 } },
+ { SLSI_PSID_UNIFI_CHIP_VERSION, { 0, 0 } },
+ { SLSI_PSID_UNIFI_FIRMWARE_BUILD_ID, { 0, 0 } },
+ { SLSI_PSID_UNIFI_FIRMWARE_PATCH_BUILD_ID, { 0, 0 } },
};
r = slsi_mib_encode_get_list(&mibreq, sizeof(getValues) / sizeof(struct slsi_mib_get_entry), getValues);
struct slsi_mib_data mibrsp = { 0, NULL };
int rxLength = 0;
int r;
- struct slsi_mib_get_entry getValues[] = { {psid, {0, 0}} };
+ struct slsi_mib_get_entry getValues[] = { {psid, { 0, 0 } } };
r = slsi_mib_encode_get_list(&mibreq, sizeof(getValues) / sizeof(struct slsi_mib_get_entry), getValues);
if (r != SLSI_MIB_STATUS_SUCCESS) {
}
#define MIFRAMMAN_ALIGN(mem, align) \
- ((void *)((((uintptr_t)(mem) + (align + sizeof(void *))) \
- & (~(uintptr_t)(align - 1)))))
+ ((void *)((((uintptr_t)(mem) + (align + sizeof(void *))) & \
+ (~(uintptr_t)(align - 1)))))
#define MIFRAMMAN_PTR(mem) \
(*(((void **)((uintptr_t)(mem) & \
- (~(uintptr_t)(sizeof(void *)-1)))) - 1))
+ (~(uintptr_t)(sizeof(void *)-1)))) - 1))
bool is_power_of_2(unsigned long n)
{
int data_length = 0;
int r = 0;
static const struct slsi_mib_get_entry getValues[] = {
- {SLSI_PSID_UNIFI_TX_DATA_RATE, {0, 0}}, /* to get STATION_INFO_TX_BITRATE */
- {SLSI_PSID_UNIFI_RSSI, {0, 0}}, /* to get STATION_INFO_SIGNAL_AVG */
+ { SLSI_PSID_UNIFI_TX_DATA_RATE, { 0, 0 } }, /* to get STATION_INFO_TX_BITRATE */
+ { SLSI_PSID_UNIFI_RSSI, { 0, 0 } }, /* to get STATION_INFO_SIGNAL_AVG */
};
WARN_ON(!SLSI_MUTEX_IS_LOCKED(ndev_vif->vif_mutex));
{
switch (priority) {
case FAPI_PRIORITY_QOS_UP0:
- case FAPI_PRIORITY_QOS_UP3:
- return SLSI_TRAFFIC_Q_BE;
+ case FAPI_PRIORITY_QOS_UP3:
+ return SLSI_TRAFFIC_Q_BE;
case FAPI_PRIORITY_QOS_UP1:
case FAPI_PRIORITY_QOS_UP2:
return SLSI_TRAFFIC_Q_BK;
SLSI_P2P_UNSYNC_VIF_EXTRA_MSEC); */
SLSI_P2P_STATE_CHANGE(sdev, P2P_IDLE_VIF_ACTIVE);
}
- }
- else if ((sdev->p2p_group_exp_frame != SLSI_P2P_PA_INVALID) && (sdev->p2p_group_exp_frame == subtype)) {
+ } else if ((sdev->p2p_group_exp_frame != SLSI_P2P_PA_INVALID) && (sdev->p2p_group_exp_frame == subtype)) {
SLSI_NET_DBG2(dev, SLSI_MLME, "Expected action frame (%s) received on Group VIF\n", slsi_p2p_pa_subtype_text(subtype));
slsi_clear_offchannel_data(sdev, (ndev_vif->ifnum != SLSI_NET_INDEX_P2PX) ? true : false);
}
else
#endif
- if (data_unit_descriptor == FAPI_DATAUNITDESCRIPTOR_IEEE802_3_FRAME)
- {
+ if (data_unit_descriptor == FAPI_DATAUNITDESCRIPTOR_IEEE802_3_FRAME) {
struct slsi_peer *peer = NULL;
struct ethhdr *ehdr = (struct ethhdr *)fapi_get_data(mbuf);
goto errout_with_semaphore;
}
#endif
- ret = FS_IOCTL(fs, BIOC_WRITESECT, (unsigned long ) &readwrite);
+ ret = FS_IOCTL(fs, BIOC_WRITESECT, (unsigned long)&readwrite);
#ifdef CONFIG_SMARTFS_JOURNALING
retj = smartfs_finish_journalentry(fs, 0, t_sector, t_offset, T_WRITE);
if (retj != OK) {
/* No.. Verify that the PID still exists. We may be destroying
- * the mutex after cancelling a pthread and the mutex may have
- * been in a bad state owned by the dead pthread. NOTE: The
- * following behavior is unspecified for pthread_mutex_destroy()
- * (see pthread_mutex_consistent()).
- *
- * If the holding thread is still valid, then we should be able to
- * map its PID to the underlying TCB. That is what sched_gettcb()
- * does.
- */
+ * the mutex after cancelling a pthread and the mutex may have
+ * been in a bad state owned by the dead pthread. NOTE: The
+ * following behavior is unspecified for pthread_mutex_destroy()
+ * (see pthread_mutex_consistent()).
+ *
+ * If the holding thread is still valid, then we should be able to
+ * map its PID to the underlying TCB. That is what sched_gettcb()
+ * does.
+ */
if (sched_gettcb(mutex->pid) == NULL) {
/* The thread associated with the PID no longer exists */
mutex->pid = -1;
/* Reset the semaphore. If threads are were on this
- * semaphore, then this will awakened them and make
- * destruction of the semaphore impossible here.
- */
+ * semaphore, then this will awakened them and make
+ * destruction of the semaphore impossible here.
+ */
status = sem_reset((FAR sem_t *)&mutex->sem, 1);
if (status < 0) {
}
/* Check if the reset caused some other thread to lock the
- * mutex.
- */
+ * mutex.
+ */
else if (mutex->pid != -1) {
/* Yes.. then we cannot destroy the mutex now. */
ret = EBUSY;
}
} else {
/* Destroy the semaphore
- *
- * REVISIT: What if there are threads waiting on the semaphore?
- * Perhaps this logic should all sem_reset() first?
- */
+ *
+ * REVISIT: What if there are threads waiting on the semaphore?
+ * Perhaps this logic should all sem_reset() first?
+ */
status = sem_destroy((sem_t *)&mutex->sem);
ret = ((status != OK) ? get_errno() : OK);
sched_lock();
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
- /* All mutex types except for NORMAL (and DEFAULT) will return
- * and an error error if the caller does not hold the mutex.
- */
+ /* All mutex types except for NORMAL (and DEFAULT) will return
+ * and an error error if the caller does not hold the mutex.
+ */
if (mutex->type != PTHREAD_MUTEX_NORMAL && mutex->pid == mypid) {
/* Yes.. Is this a recursive mutex? */
} else {
ret = EOVERFLOW;
}
- } else
- {
+ } else {
/* No, then we would deadlock... return an error (default behavior
* is like PTHREAD_MUTEX_ERRORCHECK)
*/
* To handle DHCP packets on netutils applications,
* enable IP_ACCEPT_LINK_LAYER_ADDRESSING configurations for either NETUTILS DHCPC or NETUTILS DHCPD
*/
-#if defined (CONFIG_NETUTILS_DHCPC) || defined (CONFIG_NETUTILS_DHCPD)
+#if defined(CONFIG_NETUTILS_DHCPC) || defined(CONFIG_NETUTILS_DHCPD)
#define IP_ACCEPT_LINK_LAYER_ADDRESSING 1
#define DHCP_CLIENT_PORT 68
#define IP_ACCEPT_LINK_LAYER_ADDRESSED_PORT(port) ((port) == PP_NTOHS(DHCP_CLIENT_PORT))
#if defined(CONFIG_HW_DH_PARAM)
#include "tls/see_api.h"
#include "tls/see_internal.h"
-#define DHM_MPI_EXPORT(X,n) \
- MBEDTLS_MPI_CHK( mbedtls_mpi_write_binary( X, p + 2, n ) ); \
- *p++ = (unsigned char)( n >> 8 ); \
- *p++ = (unsigned char)( n ); p += n;
+#define DHM_MPI_EXPORT(X, n) \
+ MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(X, p + 2, n)); \
+ *p++ = (unsigned char)(n >> 8); \
+ *p++ = (unsigned char)(n); p += n;
#endif
/* Implementation that should never be optimized out by the compiler */
/*
* export P, G, GX
*/
-#define DHM_MPI_EXPORT(X,n) \
- MBEDTLS_MPI_CHK( mbedtls_mpi_write_binary( X, p + 2, n ) ); \
- *p++ = (unsigned char)( n >> 8 ); \
- *p++ = (unsigned char)( n ); p += n;
+#define DHM_MPI_EXPORT(X, n) \
+ MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(X, p + 2, n)); \
+ *p++ = (unsigned char)(n >> 8); \
+ *p++ = (unsigned char)(n); p += n;
n1 = mbedtls_mpi_size(&ctx->P);
n2 = mbedtls_mpi_size(&ctx->G);
n3 = mbedtls_mpi_size(&ctx->GX);
sub32(&cur, -cc, &c); \
else \
add32(&cur, cc, &c); \
-
+
#define LAST \
STORE32; i++; \
cur = c > 0 ? c : 0; STORE32; \
#else
if (mbedtls_ssl_ciphersuite_from_id(*p) != NULL)
#endif
- * (q++) = *p;
+ *(q++) = *p;
}
*q = 0;