drivers/wireless/ieee80211: Add tools/nxstyle to all of the C files in this directory.
This commit is contained in:
parent
2a22a64f36
commit
e3665c1fb4
@ -1425,9 +1425,9 @@ static sdio_capset_t imxrt_capabilities(FAR struct sdio_dev_s *dev)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IMXRT_USDHC_DMA
|
||||
caps |= SDIO_CAPS_DMASUPPORTED;
|
||||
caps |= SDIO_CAPS_DMASUPPORTED;
|
||||
#endif
|
||||
caps |= SDIO_CAPS_DMABEFOREWRITE;
|
||||
caps |= SDIO_CAPS_DMABEFOREWRITE;
|
||||
|
||||
return caps;
|
||||
}
|
||||
@ -2017,7 +2017,8 @@ static int imxrt_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd,
|
||||
|
||||
if ((getreg32(priv->addr + IMXRT_USDHC_IRQSTAT_OFFSET) & USDHC_RESPERR_INTS) != 0)
|
||||
{
|
||||
modifyreg32(priv->addr + IMXRT_USDHC_SYSCTL_OFFSET, 0, USDHC_SYSCTL_RSTC);
|
||||
modifyreg32(priv->addr + IMXRT_USDHC_SYSCTL_OFFSET, 0,
|
||||
USDHC_SYSCTL_RSTC);
|
||||
while ((getreg32(priv->addr + IMXRT_USDHC_SYSCTL_OFFSET) &
|
||||
USDHC_SYSCTL_RSTC) != 0)
|
||||
{
|
||||
|
@ -106,6 +106,7 @@ struct bcmf_frame_s *bcmf_bdc_allocate_frame(FAR struct bcmf_dev_s *priv,
|
||||
struct bcmf_frame_s *frame;
|
||||
|
||||
/* Allocate data frame */
|
||||
|
||||
/* TODO check for integer overflow */
|
||||
|
||||
frame = priv->bus->allocate_frame(priv,
|
||||
@ -190,11 +191,11 @@ int bcmf_event_register(FAR struct bcmf_dev_s *priv, event_handler_t handler,
|
||||
unsigned int event_id)
|
||||
{
|
||||
if (event_id >= BCMF_EVENT_COUNT)
|
||||
{
|
||||
/* Invalid event id */
|
||||
{
|
||||
/* Invalid event id */
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
priv->event_handlers[event_id] = handler;
|
||||
return OK;
|
||||
|
@ -69,11 +69,12 @@
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
struct __attribute__((packed)) bcmf_cdc_header {
|
||||
uint32_t cmd; /* Command to be sent */
|
||||
uint32_t len; /* Size of command data */
|
||||
uint32_t flags; /* cdc request flags, see above */
|
||||
uint32_t status; /* Returned status code from chip */
|
||||
struct __attribute__((packed)) bcmf_cdc_header
|
||||
{
|
||||
uint32_t cmd; /* Command to be sent */
|
||||
uint32_t len; /* Size of command data */
|
||||
uint32_t flags; /* cdc request flags, see above */
|
||||
uint32_t status; /* Returned status code from chip */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@ -150,20 +151,22 @@ int bcmf_cdc_sendframe(FAR struct bcmf_dev_s *priv, uint32_t cmd,
|
||||
{
|
||||
struct bcmf_cdc_header *header =
|
||||
(struct bcmf_cdc_header *)frame->data;
|
||||
uint32_t cdc_data_len;
|
||||
|
||||
/* Setup control frame header */
|
||||
|
||||
uint32_t cdc_data_len = frame->len - (uint32_t)(frame->data-frame->base);
|
||||
cdc_data_len = frame->len - (uint32_t)(frame->data - frame->base);
|
||||
|
||||
header->cmd = cmd;
|
||||
header->len = cdc_data_len-sizeof(struct bcmf_cdc_header);
|
||||
header->len = cdc_data_len - sizeof(struct bcmf_cdc_header);
|
||||
header->status = 0;
|
||||
header->flags = ++priv->control_reqid << BCMF_CONTROL_REQID_SHIFT;
|
||||
header->flags |= ifidx << BCMF_CONTROL_INTERFACE_SHIFT;
|
||||
|
||||
if (set)
|
||||
{
|
||||
header->flags |= BCMF_CONTROL_SET;
|
||||
}
|
||||
{
|
||||
header->flags |= BCMF_CONTROL_SET;
|
||||
}
|
||||
|
||||
/* Send frame */
|
||||
|
||||
|
@ -504,13 +504,15 @@ int bcmf_core_upload_firmware(FAR struct bcmf_sdio_dev_s *sbus)
|
||||
bool bcmf_core_isup(FAR struct bcmf_sdio_dev_s *sbus, unsigned int core)
|
||||
{
|
||||
uint32_t value = 0;
|
||||
uint32_t base;
|
||||
|
||||
if (core >= MAX_CORE_ID)
|
||||
{
|
||||
wlerr("Invalid core id %d\n", core);
|
||||
return false;
|
||||
}
|
||||
uint32_t base = sbus->chip->core_base[core];
|
||||
|
||||
base = sbus->chip->core_base[core];
|
||||
|
||||
bcmf_read_sbregw(sbus, base + BCMA_IOCTL, &value);
|
||||
|
||||
@ -566,13 +568,15 @@ void bcmf_core_disable(FAR struct bcmf_sdio_dev_s *sbus, unsigned int core)
|
||||
void bcmf_core_reset(FAR struct bcmf_sdio_dev_s *sbus, unsigned int core)
|
||||
{
|
||||
uint32_t value;
|
||||
uint32_t base;
|
||||
|
||||
if (core >= MAX_CORE_ID)
|
||||
{
|
||||
wlerr("Invalid core id %d\n", core);
|
||||
return;
|
||||
}
|
||||
uint32_t base = sbus->chip->core_base[core];
|
||||
|
||||
base = sbus->chip->core_base[core];
|
||||
|
||||
/* Put core in reset state */
|
||||
|
||||
|
@ -329,7 +329,7 @@ int bcmf_driver_download_clm(FAR struct bcmf_dev_s *priv)
|
||||
dlhead->crc = 0;
|
||||
|
||||
out_len = chunk_len + sizeof(struct wl_dload_data);
|
||||
out_len = (out_len + 7) & ~0x7U;
|
||||
out_len = (out_len + 7) & ~0x7;
|
||||
|
||||
ret = bcmf_cdc_iovar_request(priv, CHIP_STA_INTERFACE, true,
|
||||
IOVAR_STR_CLMLOAD, downloadbuff,
|
||||
@ -406,7 +406,7 @@ int bcmf_driver_download_clm(FAR struct bcmf_dev_s *priv)
|
||||
dlhead->crc = 0;
|
||||
|
||||
out_len = chunk_len + sizeof(struct wl_dload_data);
|
||||
out_len = (out_len + 7) & ~0x7U;
|
||||
out_len = (out_len + 7) & ~0x7;
|
||||
|
||||
ret = bcmf_cdc_iovar_request(priv, CHIP_STA_INTERFACE, true,
|
||||
IOVAR_STR_CLMLOAD, downloadbuff,
|
||||
@ -624,12 +624,14 @@ void bcmf_wl_scan_event_handler(FAR struct bcmf_dev_s *priv,
|
||||
{
|
||||
len = escan_result_len;
|
||||
}
|
||||
|
||||
if (len == sizeof(struct wl_escan_result) - sizeof(struct wl_bss_info))
|
||||
{
|
||||
/* Nothing to process, may be scan done event */
|
||||
|
||||
goto wl_escan_result_processed;
|
||||
}
|
||||
|
||||
if (len < sizeof(struct wl_escan_result))
|
||||
{
|
||||
goto exit_invalid_frame;
|
||||
@ -738,7 +740,7 @@ void bcmf_wl_scan_event_handler(FAR struct bcmf_dev_s *priv,
|
||||
/* Special processing for iw_point, set offset in pointer field */
|
||||
|
||||
iwe->u.essid.pointer = (FAR void *)sizeof(iwe->u.essid);
|
||||
memcpy(&iwe->u.essid+1, bss->SSID, essid_len);
|
||||
memcpy(&iwe->u.essid + 1, bss->SSID, essid_len);
|
||||
|
||||
priv->scan_result_size += BCMF_IW_EVENT_SIZE(essid)+essid_len_aligned;
|
||||
result_size -= BCMF_IW_EVENT_SIZE(essid)+essid_len_aligned;
|
||||
@ -810,7 +812,7 @@ void bcmf_wl_scan_event_handler(FAR struct bcmf_dev_s *priv,
|
||||
/* Copy relevant raw IE frame */
|
||||
|
||||
if (bss->ie_offset >= bss_info_len ||
|
||||
bss->ie_length > bss_info_len-bss->ie_offset)
|
||||
bss->ie_length > bss_info_len - bss->ie_offset)
|
||||
{
|
||||
goto process_next_bss;
|
||||
}
|
||||
@ -829,7 +831,7 @@ void bcmf_wl_scan_event_handler(FAR struct bcmf_dev_s *priv,
|
||||
break;
|
||||
}
|
||||
|
||||
ie_frame_size = ie_buffer[ie_offset+1] + 2;
|
||||
ie_frame_size = ie_buffer[ie_offset + 1] + 2;
|
||||
|
||||
if (ie_frame_size > bss->ie_length - ie_offset)
|
||||
{
|
||||
@ -857,10 +859,11 @@ void bcmf_wl_scan_event_handler(FAR struct bcmf_dev_s *priv,
|
||||
iwe->u.data.flags = 0;
|
||||
iwe->u.data.length = ie_frame_size;
|
||||
iwe->u.data.pointer = (FAR void *)sizeof(iwe->u.data);
|
||||
memcpy(&iwe->u.data+1, &ie_buffer[ie_offset], ie_frame_size);
|
||||
memcpy(&iwe->u.data + 1, &ie_buffer[ie_offset], ie_frame_size);
|
||||
|
||||
priv->scan_result_size += BCMF_IW_EVENT_SIZE(essid)+ie_frame_size_aligned;
|
||||
result_size -= BCMF_IW_EVENT_SIZE(essid)+ie_frame_size_aligned;
|
||||
priv->scan_result_size += BCMF_IW_EVENT_SIZE(essid) +
|
||||
ie_frame_size_aligned;
|
||||
result_size -= BCMF_IW_EVENT_SIZE(essid) + ie_frame_size_aligned;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -868,17 +871,19 @@ void bcmf_wl_scan_event_handler(FAR struct bcmf_dev_s *priv,
|
||||
break;
|
||||
}
|
||||
|
||||
ie_offset += ie_buffer[ie_offset+1] + 2;
|
||||
ie_offset += ie_buffer[ie_offset + 1] + 2;
|
||||
}
|
||||
|
||||
goto process_next_bss;
|
||||
|
||||
scan_result_full:
|
||||
|
||||
/* Continue instead of break to log dropped AP results */
|
||||
|
||||
wlerr("No more space in scan_result buffer\n");
|
||||
|
||||
process_next_bss:
|
||||
|
||||
/* Process next bss_info */
|
||||
|
||||
len -= bss_info_len;
|
||||
@ -923,10 +928,10 @@ void bcmf_wl_scan_timeout(int argc, wdparm_t arg1, ...)
|
||||
|
||||
if (priv->scan_status < BCMF_SCAN_RUN)
|
||||
{
|
||||
/* Fatal error, invalid scan status */
|
||||
/* Fatal error, invalid scan status */
|
||||
|
||||
wlerr("Unexpected scan timeout\n");
|
||||
return;
|
||||
wlerr("Unexpected scan timeout\n");
|
||||
return;
|
||||
}
|
||||
|
||||
wlerr("Scan timeout detected\n");
|
||||
@ -1022,7 +1027,7 @@ int bcmf_wl_start_scan(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
|
||||
scan_params.action = WL_SCAN_ACTION_START;
|
||||
scan_params.sync_id = 0xabcd; /* Not used for now */
|
||||
|
||||
memset(&scan_params.params.bssid, 0xFF,
|
||||
memset(&scan_params.params.bssid, 0xff,
|
||||
sizeof(scan_params.params.bssid));
|
||||
|
||||
scan_params.params.bss_type = DOT11_BSSTYPE_ANY;
|
||||
@ -1057,7 +1062,7 @@ int bcmf_wl_start_scan(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
|
||||
|
||||
wlinfo("Use default scan parameters\n");
|
||||
|
||||
memset(&scan_params.params.bssid, 0xFF,
|
||||
memset(&scan_params.params.bssid, 0xff,
|
||||
sizeof(scan_params.params.bssid));
|
||||
|
||||
scan_params.params.scan_type = 0; /* Active scan */
|
||||
@ -1078,21 +1083,21 @@ int bcmf_wl_start_scan(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
|
||||
|
||||
if ((ret = nxsem_wait(&priv->control_mutex)) < 0)
|
||||
{
|
||||
goto exit_failed;
|
||||
goto exit_failed;
|
||||
}
|
||||
|
||||
/* Allocate buffer to store scan result */
|
||||
|
||||
if (priv->scan_result == NULL)
|
||||
{
|
||||
priv->scan_result = kmm_malloc(BCMF_SCAN_RESULT_SIZE);
|
||||
if (priv->scan_result == NULL)
|
||||
{
|
||||
wlerr("Cannot allocate result buffer\n");
|
||||
ret = -ENOMEM;
|
||||
goto exit_sem_post;
|
||||
}
|
||||
}
|
||||
{
|
||||
priv->scan_result = kmm_malloc(BCMF_SCAN_RESULT_SIZE);
|
||||
if (priv->scan_result == NULL)
|
||||
{
|
||||
wlerr("Cannot allocate result buffer\n");
|
||||
ret = -ENOMEM;
|
||||
goto exit_sem_post;
|
||||
}
|
||||
}
|
||||
|
||||
wlinfo("start scan\n");
|
||||
|
||||
@ -1185,6 +1190,7 @@ int bcmf_wl_get_scan_results(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
|
||||
memcpy(iwr->u.data.pointer, priv->scan_result, iwr->u.data.length);
|
||||
|
||||
exit_free_buffer:
|
||||
|
||||
/* Free scan result buffer */
|
||||
|
||||
kmm_free(priv->scan_result);
|
||||
@ -1220,88 +1226,96 @@ int bcmf_wl_set_auth_param(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
|
||||
{
|
||||
case IW_AUTH_WPA_VERSION:
|
||||
{
|
||||
uint32_t wpa_version[2];
|
||||
uint32_t auth_mode;
|
||||
uint32_t wpa_version[2];
|
||||
uint32_t auth_mode;
|
||||
|
||||
switch (iwr->u.param.value)
|
||||
{
|
||||
case IW_AUTH_WPA_VERSION_DISABLED:
|
||||
wpa_version[1] = 0;
|
||||
auth_mode = WPA_AUTH_DISABLED;
|
||||
break;
|
||||
case IW_AUTH_WPA_VERSION_WPA:
|
||||
wpa_version[1] = 1;
|
||||
auth_mode = WPA_AUTH_PSK;
|
||||
break;
|
||||
case IW_AUTH_WPA_VERSION_WPA2:
|
||||
wpa_version[1] = 1;
|
||||
auth_mode = WPA2_AUTH_PSK;
|
||||
break;
|
||||
default:
|
||||
wlerr("Invalid wpa version %d\n", iwr->u.param.value);
|
||||
return -EINVAL;
|
||||
}
|
||||
switch (iwr->u.param.value)
|
||||
{
|
||||
case IW_AUTH_WPA_VERSION_DISABLED:
|
||||
wpa_version[1] = 0;
|
||||
auth_mode = WPA_AUTH_DISABLED;
|
||||
break;
|
||||
|
||||
out_len = 8;
|
||||
wpa_version[0] = interface;
|
||||
case IW_AUTH_WPA_VERSION_WPA:
|
||||
wpa_version[1] = 1;
|
||||
auth_mode = WPA_AUTH_PSK;
|
||||
break;
|
||||
|
||||
if (bcmf_cdc_iovar_request(priv, interface, true,
|
||||
"bsscfg:"IOVAR_STR_SUP_WPA,
|
||||
(uint8_t *)wpa_version,
|
||||
&out_len))
|
||||
{
|
||||
return -EIO;
|
||||
}
|
||||
case IW_AUTH_WPA_VERSION_WPA2:
|
||||
wpa_version[1] = 1;
|
||||
auth_mode = WPA2_AUTH_PSK;
|
||||
break;
|
||||
|
||||
out_len = 4;
|
||||
if (bcmf_cdc_ioctl(priv, interface, true, WLC_SET_WPA_AUTH,
|
||||
(uint8_t *)&auth_mode, &out_len))
|
||||
{
|
||||
return -EIO;
|
||||
}
|
||||
default:
|
||||
wlerr("Invalid wpa version %d\n", iwr->u.param.value);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
out_len = 8;
|
||||
wpa_version[0] = interface;
|
||||
|
||||
if (bcmf_cdc_iovar_request(priv, interface, true,
|
||||
"bsscfg:"IOVAR_STR_SUP_WPA,
|
||||
(uint8_t *)wpa_version,
|
||||
&out_len))
|
||||
{
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
out_len = 4;
|
||||
if (bcmf_cdc_ioctl(priv, interface, true, WLC_SET_WPA_AUTH,
|
||||
(uint8_t *)&auth_mode, &out_len))
|
||||
{
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
||||
case IW_AUTH_CIPHER_PAIRWISE:
|
||||
case IW_AUTH_CIPHER_GROUP:
|
||||
{
|
||||
uint32_t cipher_mode;
|
||||
uint32_t wep_auth = 0;
|
||||
uint32_t cipher_mode;
|
||||
uint32_t wep_auth = 0;
|
||||
|
||||
switch (iwr->u.param.value)
|
||||
{
|
||||
case IW_AUTH_CIPHER_WEP40:
|
||||
case IW_AUTH_CIPHER_WEP104:
|
||||
cipher_mode = WEP_ENABLED;
|
||||
wep_auth = 1;
|
||||
break;
|
||||
case IW_AUTH_CIPHER_TKIP:
|
||||
cipher_mode = TKIP_ENABLED;
|
||||
break;
|
||||
case IW_AUTH_CIPHER_CCMP:
|
||||
cipher_mode = AES_ENABLED;
|
||||
break;
|
||||
default:
|
||||
wlerr("Invalid cipher mode %d\n", iwr->u.param.value);
|
||||
return -EINVAL;
|
||||
}
|
||||
switch (iwr->u.param.value)
|
||||
{
|
||||
case IW_AUTH_CIPHER_WEP40:
|
||||
case IW_AUTH_CIPHER_WEP104:
|
||||
cipher_mode = WEP_ENABLED;
|
||||
wep_auth = 1;
|
||||
break;
|
||||
|
||||
out_len = 4;
|
||||
if (bcmf_cdc_ioctl(priv, interface, true,
|
||||
WLC_SET_WSEC, (uint8_t *)&cipher_mode, &out_len))
|
||||
{
|
||||
return -EIO;
|
||||
}
|
||||
case IW_AUTH_CIPHER_TKIP:
|
||||
cipher_mode = TKIP_ENABLED;
|
||||
break;
|
||||
|
||||
/* Set authentication mode */
|
||||
case IW_AUTH_CIPHER_CCMP:
|
||||
cipher_mode = AES_ENABLED;
|
||||
break;
|
||||
|
||||
out_len = 4;
|
||||
if (bcmf_cdc_ioctl(priv, interface, true,
|
||||
WLC_SET_AUTH, (uint8_t *)&wep_auth, &out_len))
|
||||
{
|
||||
return -EIO;
|
||||
}
|
||||
default:
|
||||
wlerr("Invalid cipher mode %d\n", iwr->u.param.value);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
out_len = 4;
|
||||
if (bcmf_cdc_ioctl(priv, interface, true,
|
||||
WLC_SET_WSEC, (uint8_t *)&cipher_mode, &out_len))
|
||||
{
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/* Set authentication mode */
|
||||
|
||||
out_len = 4;
|
||||
if (bcmf_cdc_ioctl(priv, interface, true,
|
||||
WLC_SET_AUTH, (uint8_t *)&wep_auth, &out_len))
|
||||
{
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
||||
case IW_AUTH_KEY_MGMT:
|
||||
@ -1431,4 +1445,4 @@ int bcmf_wl_set_ssid(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
@ -484,9 +484,9 @@ int bcmf_sdio_find_block_size(unsigned int size)
|
||||
{
|
||||
size_copy >>= 1;
|
||||
ret++;
|
||||
}
|
||||
}
|
||||
|
||||
if (size & (size-1))
|
||||
if (size & (size - 1))
|
||||
{
|
||||
return 1 << ret;
|
||||
}
|
||||
@ -515,8 +515,10 @@ static int bcmf_sdio_sr_init(FAR struct bcmf_sdio_dev_s *sbus)
|
||||
* even though module won't decode cmd or respond
|
||||
*/
|
||||
|
||||
bcmf_write_reg(sbus, 0, SDIO_CCCR_BRCM_CARDCAP, SDIO_CCCR_BRCM_CARDCAP_CMD_NODEC);
|
||||
bcmf_write_reg(sbus, 1, SBSDIO_FUNC1_CHIPCLKCSR, SBSDIO_FORCE_HT);
|
||||
bcmf_write_reg(sbus, 0, SDIO_CCCR_BRCM_CARDCAP,
|
||||
SDIO_CCCR_BRCM_CARDCAP_CMD_NODEC);
|
||||
bcmf_write_reg(sbus, 1, SBSDIO_FUNC1_CHIPCLKCSR,
|
||||
SBSDIO_FORCE_HT);
|
||||
|
||||
/* Enable KeepSdioOn (KSO) bit for normal operation */
|
||||
|
||||
@ -587,25 +589,25 @@ int bcmf_transfer_bytes(FAR struct bcmf_sdio_dev_s *sbus, bool write,
|
||||
function, address, 0, buf);
|
||||
}
|
||||
|
||||
/* Find best block settings for transfer */
|
||||
/* Find best block settings for transfer */
|
||||
|
||||
if (len >= 64)
|
||||
{
|
||||
/* Use block mode */
|
||||
if (len >= 64)
|
||||
{
|
||||
/* Use block mode */
|
||||
|
||||
blocklen = 64;
|
||||
nblocks = (len + 63) / 64;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Use byte mode */
|
||||
blocklen = 64;
|
||||
nblocks = (len + 63) / 64;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Use byte mode */
|
||||
|
||||
blocklen = bcmf_sdio_find_block_size(len);
|
||||
nblocks = 0;
|
||||
}
|
||||
blocklen = bcmf_sdio_find_block_size(len);
|
||||
nblocks = 0;
|
||||
}
|
||||
|
||||
return sdio_io_rw_extended(sbus->sdio_dev, write,
|
||||
function, address, true, buf, blocklen, nblocks);
|
||||
return sdio_io_rw_extended(sbus->sdio_dev, write,
|
||||
function, address, true, buf, blocklen, nblocks);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -674,6 +676,7 @@ int bcmf_bus_sdio_initialize(FAR struct bcmf_dev_s *priv,
|
||||
sq_init(&sbus->free_queue);
|
||||
|
||||
/* Setup free buffer list */
|
||||
|
||||
/* FIXME this should be static to driver */
|
||||
|
||||
for (ret = 0; ret < BCMF_PKT_POOL_SIZE; ret++)
|
||||
@ -953,7 +956,7 @@ struct bcmf_sdio_frame *bcmf_sdio_allocate_frame(FAR struct bcmf_dev_s *priv,
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (!tx || sbus->tx_queue_count < BCMF_PKT_POOL_SIZE-1)
|
||||
if (!tx || sbus->tx_queue_count < BCMF_PKT_POOL_SIZE - 1)
|
||||
#endif
|
||||
{
|
||||
if ((entry = bcmf_dqueue_pop_tail(&sbus->free_queue)) != NULL)
|
||||
|
@ -57,7 +57,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
#define HEADER_SIZE 0x12 /* Default sdpcm + bdc header size */
|
||||
// TODO move to Kconfig
|
||||
|
||||
/* TODO move to Kconfig */
|
||||
|
||||
#define BCMF_PKT_POOL_SIZE 4 /* Frame pool size */
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -73,16 +73,17 @@
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
struct __attribute__((packed)) bcmf_sdpcm_header {
|
||||
uint16_t size;
|
||||
uint16_t checksum;
|
||||
uint8_t sequence;
|
||||
uint8_t channel;
|
||||
uint8_t next_length;
|
||||
uint8_t data_offset;
|
||||
uint8_t flow_control;
|
||||
uint8_t credit;
|
||||
uint16_t padding;
|
||||
struct __attribute__((packed)) bcmf_sdpcm_header
|
||||
{
|
||||
uint16_t size;
|
||||
uint16_t checksum;
|
||||
uint8_t sequence;
|
||||
uint8_t channel;
|
||||
uint8_t next_length;
|
||||
uint8_t data_offset;
|
||||
uint8_t flow_control;
|
||||
uint8_t credit;
|
||||
uint16_t padding;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@ -149,7 +150,8 @@ int bcmf_sdpcm_process_header(FAR struct bcmf_sdio_dev_s *sbus,
|
||||
int bcmf_sdpcm_readframe(FAR struct bcmf_dev_s *priv)
|
||||
{
|
||||
int ret;
|
||||
uint16_t len, checksum;
|
||||
uint16_t len;
|
||||
uint16_t checksum;
|
||||
struct bcmf_sdpcm_header *header;
|
||||
struct bcmf_sdio_frame *sframe;
|
||||
FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s *)priv->bus;
|
||||
@ -250,6 +252,7 @@ int bcmf_sdpcm_readframe(FAR struct bcmf_dev_s *priv)
|
||||
{
|
||||
ret = bcmf_bdc_process_event_frame(priv, &sframe->header);
|
||||
}
|
||||
|
||||
goto exit_free_frame;
|
||||
|
||||
case SDPCM_DATA_CHANNEL:
|
||||
@ -310,7 +313,6 @@ int bcmf_sdpcm_sendframe(FAR struct bcmf_dev_s *priv)
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
|
||||
if (nxsem_wait(&sbus->queue_mutex) < 0)
|
||||
{
|
||||
DEBUGPANIC();
|
||||
@ -443,7 +445,6 @@ struct bcmf_frame_s *bcmf_sdpcm_alloc_frame(FAR struct bcmf_dev_s *priv,
|
||||
return &sframe->header;
|
||||
}
|
||||
|
||||
|
||||
void bcmf_sdpcm_free_frame(FAR struct bcmf_dev_s *priv,
|
||||
struct bcmf_frame_s *frame)
|
||||
{
|
||||
|
@ -73,26 +73,27 @@ void bcmf_hexdump(uint8_t *data, unsigned int len, unsigned long offset)
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (char_count >= LINE_LEN)
|
||||
{
|
||||
/* Flush line */
|
||||
{
|
||||
/* Flush line */
|
||||
|
||||
wlinfo("%08x: %s%s\n", offset+i-char_count, hex_line, char_line);
|
||||
char_count = 0;
|
||||
}
|
||||
wlinfo("%08x: %s%s\n",
|
||||
offset + i - char_count, hex_line, char_line);
|
||||
char_count = 0;
|
||||
}
|
||||
|
||||
sprintf(hex_line+3*char_count, "%02x ", data[i]);
|
||||
sprintf(char_line+char_count, "%c",
|
||||
sprintf(hex_line + 3 * char_count, "%02x ", data[i]);
|
||||
sprintf(char_line + char_count, "%c",
|
||||
data[i] < 0x20 || data[i] >= 0x7f? '.': data[i]);
|
||||
char_count ++;
|
||||
char_count++;
|
||||
}
|
||||
|
||||
if (char_count > 0)
|
||||
{
|
||||
/* Flush last line */
|
||||
|
||||
memset(hex_line+3*char_count, ' ', 3*(LINE_LEN-char_count));
|
||||
hex_line[3*LINE_LEN] = 0;
|
||||
wlinfo("%08x: %s%s\n", offset+i-char_count, hex_line, char_line);
|
||||
memset(hex_line + 3 * char_count, ' ', 3 * (LINE_LEN - char_count));
|
||||
hex_line[3 * LINE_LEN] = 0;
|
||||
wlinfo("%08x: %s%s\n", offset + i - char_count, hex_line, char_line);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -466,6 +466,7 @@ int sdio_enable_function(FAR struct sdio_dev_s *dev, uint8_t function)
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user