Photon: Cosmetic changes to style detected by tools/nxstyle

This commit is contained in:
Gregory Nutt 2017-05-03 18:20:57 -06:00
parent 11c14470c3
commit 97f149a40b
19 changed files with 1910 additions and 1794 deletions

View File

@ -97,8 +97,8 @@ static const uint8_t bcmf_broadcom_oui[] = {0x00, 0x10, 0x18};
* Public Functions
****************************************************************************/
struct bcmf_frame_s* bcmf_bdc_allocate_frame(FAR struct bcmf_dev_s *priv,
uint32_t len, bool block)
struct bcmf_frame_s *bcmf_bdc_allocate_frame(FAR struct bcmf_dev_s *priv,
uint32_t len, bool block)
{
struct bcmf_frame_s *frame;
@ -136,7 +136,7 @@ int bcmf_bdc_process_event_frame(FAR struct bcmf_dev_s *priv,
goto exit_invalid_frame;
}
header = (struct bcmf_bdc_header*)frame->data;
header = (struct bcmf_bdc_header *)frame->data;
data_size -= sizeof(struct bcmf_bdc_header) + header->data_offset;
@ -149,9 +149,9 @@ int bcmf_bdc_process_event_frame(FAR struct bcmf_dev_s *priv,
/* Check ethernet header */
event_msg = (struct bcmf_event_msg*)(frame->data +
sizeof(struct bcmf_bdc_header) +
header->data_offset);
event_msg = (struct bcmf_event_msg *)(frame->data +
sizeof(struct bcmf_bdc_header) +
header->data_offset);
if (event_msg->eth.ether_type != BCMF_EVENT_ETHER_TYPE ||
memcmp(event_msg->bcm_eth.oui, bcmf_broadcom_oui, 3))
@ -207,15 +207,15 @@ int bcmf_event_push_config(FAR struct bcmf_dev_s *priv)
{
int i;
uint32_t out_len;
uint8_t event_mask[(BCMF_EVENT_COUNT+7)>>3];
uint8_t event_mask[(BCMF_EVENT_COUNT + 7) >> 3];
memset(event_mask, 0, sizeof(event_mask));
for (i=0; i<BCMF_EVENT_COUNT; i++)
for (i = 0; i < BCMF_EVENT_COUNT; i++)
{
if (priv->event_handlers[i] != NULL)
{
event_mask[i>>3] |= 1 << (i & 0x7);
event_mask[i >> 3] |= 1 << (i & 0x7);
}
}
@ -233,20 +233,20 @@ int bcmf_event_push_config(FAR struct bcmf_dev_s *priv)
}
int bcmf_bdc_transmit_frame(FAR struct bcmf_dev_s *priv,
struct bcmf_frame_s *frame)
struct bcmf_frame_s *frame)
{
struct bcmf_bdc_header* header;
struct bcmf_bdc_header *header;
/* Set frame data for lower layer */
frame->data -= sizeof(struct bcmf_bdc_header);
header = (struct bcmf_bdc_header*)frame->data;
header = (struct bcmf_bdc_header *)frame->data;
/* Setup data frame header */
header->flags = 0x20; /* Set bdc protocol version */
header->priority = 0; // TODO handle priority
header->flags2 = CHIP_STA_INTERFACE;
header->flags = 0x20; /* Set bdc protocol version */
header->priority = 0; // TODO handle priority
header->flags2 = CHIP_STA_INTERFACE;
header->data_offset = 0;
/* Send frame */
@ -254,7 +254,7 @@ int bcmf_bdc_transmit_frame(FAR struct bcmf_dev_s *priv,
return priv->bus->txframe(priv, frame, false);
}
struct bcmf_frame_s* bcmf_bdc_rx_frame(FAR struct bcmf_dev_s *priv)
struct bcmf_frame_s *bcmf_bdc_rx_frame(FAR struct bcmf_dev_s *priv)
{
unsigned int frame_len;
struct bcmf_frame_s *frame = priv->bus->rxframe(priv);
@ -274,4 +274,4 @@ struct bcmf_frame_s* bcmf_bdc_rx_frame(FAR struct bcmf_dev_s *priv)
frame->data += sizeof(struct bcmf_bdc_header);
return frame;
}
}

View File

@ -75,13 +75,13 @@ int bcmf_bdc_process_event_frame(FAR struct bcmf_dev_s *priv,
/* Function called from upper layer */
struct bcmf_frame_s* bcmf_bdc_allocate_frame(FAR struct bcmf_dev_s *priv,
uint32_t len, bool block);
struct bcmf_frame_s *bcmf_bdc_allocate_frame(FAR struct bcmf_dev_s *priv,
uint32_t len, bool block);
int bcmf_bdc_transmit_frame(FAR struct bcmf_dev_s *priv,
struct bcmf_frame_s *frame);
struct bcmf_frame_s* bcmf_bdc_rx_frame(FAR struct bcmf_dev_s *priv);
struct bcmf_frame_s *bcmf_bdc_rx_frame(FAR struct bcmf_dev_s *priv);
/* Event frames API */

View File

@ -80,7 +80,7 @@ struct __attribute__((packed)) bcmf_cdc_header {
* Private Function Prototypes
****************************************************************************/
static struct bcmf_frame_s* bcmf_cdc_allocate_frame(
static struct bcmf_frame_s *bcmf_cdc_allocate_frame(
FAR struct bcmf_dev_s *priv, char *name,
uint8_t *data, uint32_t len);
@ -99,8 +99,9 @@ static int bcmf_cdc_control_request_unsafe(FAR struct bcmf_dev_s *priv,
* Private Functions
****************************************************************************/
struct bcmf_frame_s* bcmf_cdc_allocate_frame(FAR struct bcmf_dev_s *priv,
char *name, uint8_t *data, uint32_t len)
struct bcmf_frame_s *bcmf_cdc_allocate_frame(FAR struct bcmf_dev_s *priv,
char *name, uint8_t *data,
uint32_t len)
{
uint32_t data_len;
uint16_t name_len;
@ -145,10 +146,10 @@ struct bcmf_frame_s* bcmf_cdc_allocate_frame(FAR struct bcmf_dev_s *priv,
}
int bcmf_cdc_sendframe(FAR struct bcmf_dev_s *priv, uint32_t cmd,
int ifidx, bool set, struct bcmf_frame_s *frame)
int ifidx, bool set, struct bcmf_frame_s *frame)
{
struct bcmf_cdc_header* header =
(struct bcmf_cdc_header*)frame->data;
struct bcmf_cdc_header *header =
(struct bcmf_cdc_header *)frame->data;
/* Setup control frame header */
@ -290,7 +291,7 @@ int bcmf_cdc_process_control_frame(FAR struct bcmf_dev_s *priv,
return -EINVAL;
}
cdc_header = (struct bcmf_cdc_header*)frame->data;
cdc_header = (struct bcmf_cdc_header *)frame->data;
if (data_size < cdc_header->len ||
data_size < sizeof(struct bcmf_cdc_header) + cdc_header->len)
@ -315,8 +316,9 @@ int bcmf_cdc_process_control_frame(FAR struct bcmf_dev_s *priv,
priv->control_rxdata_len, cdc_header->len);
priv->control_rxdata_len = cdc_header->len;
}
memcpy(priv->control_rxdata, (uint8_t*)&cdc_header[1],
priv->control_rxdata_len);
memcpy(priv->control_rxdata, (uint8_t *)&cdc_header[1],
priv->control_rxdata_len);
}
sem_post(&priv->control_timeout);
@ -325,4 +327,4 @@ int bcmf_cdc_process_control_frame(FAR struct bcmf_dev_s *priv,
wlinfo("Got unexpected control frame\n");
return -EINVAL;
}
}

View File

@ -44,7 +44,8 @@ extern const unsigned int bcm43362_nvram_image_len;
extern const uint8_t bcm43362_firmware_image[];
extern const unsigned int bcm43362_firmware_image_len;
const struct bcmf_sdio_chip bcmf_43362_config_sdio = {
const struct bcmf_sdio_chip bcmf_43362_config_sdio =
{
/* General chip stats */
@ -52,7 +53,8 @@ const struct bcmf_sdio_chip bcmf_43362_config_sdio = {
/* Backplane architecture */
.core_base = {
.core_base =
{
[CHIPCOMMON_CORE_ID] = 0x18000000, /* Chipcommon core register base */
[DOT11MAC_CORE_ID] = 0x18001000, /* dot11mac core register base */
[SDIOD_CORE_ID] = 0x18002000, /* SDIOD Device core register base */
@ -66,9 +68,9 @@ const struct bcmf_sdio_chip bcmf_43362_config_sdio = {
// TODO find something smarter than using image_len references
.firmware_image = (uint8_t*)bcm43362_firmware_image,
.firmware_image_size = (unsigned int*)&bcm43362_firmware_image_len,
.firmware_image = (uint8_t *)bcm43362_firmware_image,
.firmware_image_size = (unsigned int *)&bcm43362_firmware_image_len,
.nvram_image = (uint8_t*)bcm43362_nvram_image,
.nvram_image_size = (unsigned int*)&bcm43362_nvram_image_len
};
.nvram_image = (uint8_t *)bcm43362_nvram_image,
.nvram_image_size = (unsigned int *)&bcm43362_nvram_image_len
};

View File

@ -190,23 +190,23 @@ int bcmf_upload_nvram(FAR struct bcmf_sdio_dev_s *sbus)
ret = bcmf_upload_binary(sbus, sbus->chip->ram_size - 4 - nvram_sz,
sbus->chip->nvram_image,
*sbus->chip->nvram_image_size);
if ( ret != OK)
{
if (ret != OK)
{
return ret;
}
}
/* generate length token */
/* Generate length token */
token = nvram_sz / 4;
token = (~token << 16) | (token & 0x0000FFFF);
/* Write the length token to the last word */
ret = bcmf_write_sbreg(sbus, sbus->chip->ram_size - 4, (uint8_t*)&token, 4);
if ( ret != OK)
{
ret = bcmf_write_sbreg(sbus, sbus->chip->ram_size - 4, (uint8_t *)&token, 4);
if (ret != OK)
{
return ret;
}
}
return OK;
}

View File

@ -64,7 +64,7 @@ static inline int bcmf_read_sbregb(FAR struct bcmf_sdio_dev_s *sbus,
static inline int bcmf_read_sbregw(FAR struct bcmf_sdio_dev_s *sbus,
uint32_t address, uint32_t *reg)
{
return bcmf_read_sbreg(sbus, address, (uint8_t*)reg, 4);
return bcmf_read_sbreg(sbus, address, (uint8_t *)reg, 4);
}
static inline int bcmf_write_sbregb(FAR struct bcmf_sdio_dev_s *sbus,
@ -76,7 +76,7 @@ static inline int bcmf_write_sbregb(FAR struct bcmf_sdio_dev_s *sbus,
static inline int bcmf_write_sbregw(FAR struct bcmf_sdio_dev_s *sbus,
uint32_t address, uint32_t reg)
{
return bcmf_write_sbreg(sbus, address, (uint8_t*)&reg, 4);
return bcmf_write_sbreg(sbus, address, (uint8_t *)&reg, 4);
}
#endif /* __DRIVERS_WIRELESS_IEEE80211_BCMF_CORE_H */

View File

@ -84,12 +84,13 @@ enum
* Private Function Prototypes
****************************************************************************/
static FAR struct bcmf_dev_s* bcmf_allocate_device(void);
static FAR struct bcmf_dev_s *bcmf_allocate_device(void);
static void bcmf_free_device(FAR struct bcmf_dev_s *priv);
static int bcmf_driver_initialize(FAR struct bcmf_dev_s *priv);
// FIXME only for debug purpose
static void bcmf_wl_default_event_handler(FAR struct bcmf_dev_s *priv,
struct bcmf_event_s *event, unsigned int len);
@ -109,7 +110,7 @@ static int bcmf_wl_get_interface(FAR struct bcmf_dev_s *priv,
* Private Functions
****************************************************************************/
FAR struct bcmf_dev_s* bcmf_allocate_device(void)
FAR struct bcmf_dev_s *bcmf_allocate_device(void)
{
int ret;
FAR struct bcmf_dev_s *priv;
@ -186,7 +187,7 @@ int bcmf_wl_set_mac_address(FAR struct bcmf_dev_s *priv, struct ifreq *req)
ret = bcmf_cdc_iovar_request(priv, CHIP_STA_INTERFACE, true,
IOVAR_STR_CUR_ETHERADDR,
(uint8_t*)req->ifr_hwaddr.sa_data,
(uint8_t *)req->ifr_hwaddr.sa_data,
&out_len);
if (ret != OK)
{
@ -215,10 +216,10 @@ int bcmf_driver_initialize(FAR struct bcmf_dev_s *priv)
/* Disable TX Gloming feature */
out_len = 4;
*(uint32_t*)tmp_buf = 0;
*(uint32_t *)tmp_buf = 0;
ret = bcmf_cdc_iovar_request(priv, interface, false,
IOVAR_STR_TX_GLOM, tmp_buf,
&out_len);
IOVAR_STR_TX_GLOM, tmp_buf,
&out_len);
if (ret != OK)
{
return -EIO;
@ -229,7 +230,7 @@ int bcmf_driver_initialize(FAR struct bcmf_dev_s *priv)
out_len = 4;
value = 0;
ret = bcmf_cdc_ioctl(priv, interface, true, WLC_SET_PM,
(uint8_t*)&value, &out_len);
(uint8_t *)&value, &out_len);
if (ret != OK)
{
return ret;
@ -240,7 +241,7 @@ int bcmf_driver_initialize(FAR struct bcmf_dev_s *priv)
out_len = 4;
value = GMODE_AUTO;
ret = bcmf_cdc_ioctl(priv, interface, true, WLC_SET_GMODE,
(uint8_t*)&value, &out_len);
(uint8_t *)&value, &out_len);
if (ret != OK)
{
return ret;
@ -251,14 +252,14 @@ int bcmf_driver_initialize(FAR struct bcmf_dev_s *priv)
out_len = 4;
value = 1;
ret = bcmf_cdc_iovar_request(priv, interface, true, IOVAR_STR_ROAM_OFF,
(uint8_t*)&value,
(uint8_t *)&value,
&out_len);
/* TODO configure EAPOL version to default */
out_len = 8;
((uint32_t*)tmp_buf)[0] = interface;
((uint32_t*)tmp_buf)[1] = (uint32_t)-1;
((uint32_t *)tmp_buf)[0] = interface;
((uint32_t *)tmp_buf)[1] = (uint32_t)-1;
if (bcmf_cdc_iovar_request(priv, interface, true,
"bsscfg:"IOVAR_STR_SUP_WPA2_EAPVER, tmp_buf,
@ -282,10 +283,10 @@ int bcmf_driver_initialize(FAR struct bcmf_dev_s *priv)
/* Remove line feed */
out_len = strlen((char*)tmp_buf);
if (out_len > 0 && tmp_buf[out_len-1] == '\n')
out_len = strlen((char *)tmp_buf);
if (out_len > 0 && tmp_buf[out_len - 1] == '\n')
{
tmp_buf[out_len-1] = 0;
tmp_buf[out_len - 1] = 0;
}
wlinfo("fw version <%s>\n", tmp_buf);
@ -353,7 +354,7 @@ void bcmf_wl_auth_event_handler(FAR struct bcmf_dev_s *priv,
wlinfo("Got auth event %d from <%s>\n", type, event->src_name);
bcmf_hexdump((uint8_t*)event, len, (unsigned long)event);
bcmf_hexdump((uint8_t *)event, len, (unsigned long)event);
if (type == WLC_E_SET_SSID && status == WLC_E_STATUS_SUCCESS)
{
@ -408,7 +409,7 @@ void bcmf_wl_scan_event_handler(FAR struct bcmf_dev_s *priv,
/* Process escan result payload */
result = (struct wl_escan_result*)&event[1];
result = (struct wl_escan_result *)&event[1];
if (len < result->buflen || result->buflen < sizeof(struct wl_escan_result))
{
@ -442,7 +443,7 @@ void bcmf_wl_scan_event_handler(FAR struct bcmf_dev_s *priv,
/* Process next bss_info */
len -= bss_info_len;
bss = (struct wl_bss_info*)((uint8_t*)bss + bss_info_len);
bss = (struct wl_bss_info *)((uint8_t *)bss + bss_info_len);
bss_count += 1;
}
@ -474,12 +475,12 @@ wl_escan_result_processed:
exit_invalid_frame:
wlerr("Invalid scan result event\n");
bcmf_hexdump((uint8_t*)event, event_len, (unsigned long)event);
bcmf_hexdump((uint8_t *)event, event_len, (unsigned long)event);
}
void bcmf_wl_scan_timeout(int argc, wdparm_t arg1, ...)
{
FAR struct bcmf_dev_s *priv = (FAR struct bcmf_dev_s*)arg1;
FAR struct bcmf_dev_s *priv = (FAR struct bcmf_dev_s *)arg1;
if (priv->scan_status < BCMF_SCAN_RUN)
{
@ -590,7 +591,7 @@ int bcmf_wl_start_scan(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
if (iwr->u.data.pointer && iwr->u.data.length >= sizeof(*req))
{
req = (struct iw_scan_req*)iwr->u.data.pointer;
req = (struct iw_scan_req *)iwr->u.data.pointer;
memcpy(&scan_params.params.bssid, req->bssid.sa_data,
sizeof(scan_params.params.bssid));
@ -624,7 +625,7 @@ int bcmf_wl_start_scan(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
value = scan_params.params.scan_type;
out_len = 4;
if (bcmf_cdc_ioctl(priv, CHIP_STA_INTERFACE, true,
WLC_SET_PASSIVE_SCAN, (uint8_t*)&value, &out_len))
WLC_SET_PASSIVE_SCAN, (uint8_t *)&value, &out_len))
{
ret = -EIO;
goto exit_failed;
@ -644,7 +645,7 @@ int bcmf_wl_start_scan(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
out_len = sizeof(scan_params);
if (bcmf_cdc_iovar_request_unsafe(priv, CHIP_STA_INTERFACE, true,
IOVAR_STR_ESCAN, (uint8_t*)&scan_params,
IOVAR_STR_ESCAN, (uint8_t *)&scan_params,
&out_len))
{
ret = -EIO;
@ -727,15 +728,15 @@ int bcmf_wl_set_auth_param(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
if (bcmf_cdc_iovar_request(priv, interface, true,
"bsscfg:"IOVAR_STR_SUP_WPA,
(uint8_t*)wpa_version,
(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))
if (bcmf_cdc_ioctl(priv, interface, true, WLC_SET_WPA_AUTH,
(uint8_t *)&auth_mode, &out_len))
{
return -EIO;
}
@ -767,8 +768,8 @@ int bcmf_wl_set_auth_param(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
}
out_len = 4;
if(bcmf_cdc_ioctl(priv, interface, true,
WLC_SET_WSEC, (uint8_t*)&cipher_mode, &out_len))
if (bcmf_cdc_ioctl(priv, interface, true,
WLC_SET_WSEC, (uint8_t *)&cipher_mode, &out_len))
{
return -EIO;
}
@ -776,8 +777,8 @@ int bcmf_wl_set_auth_param(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
/* Set authentication mode */
out_len = 4;
if(bcmf_cdc_ioctl(priv, interface, true,
WLC_SET_AUTH, (uint8_t*)&wep_auth, &out_len))
if (bcmf_cdc_ioctl(priv, interface, true,
WLC_SET_AUTH, (uint8_t *)&wep_auth, &out_len))
{
return -EIO;
}
@ -815,8 +816,8 @@ int bcmf_wl_set_mode(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
out_len = 4;
value = iwr->u.mode == IW_MODE_INFRA ? 1 : 0;
if(bcmf_cdc_ioctl(priv, interface, true,
WLC_SET_INFRA, (uint8_t*)&value, &out_len))
if (bcmf_cdc_ioctl(priv, interface, true,
WLC_SET_INFRA, (uint8_t *)&value, &out_len))
{
return -EIO;
}
@ -838,7 +839,7 @@ int bcmf_wl_set_encode_ext(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
return -EINVAL;
}
ext = (struct iw_encode_ext*)iwr->u.encoding.pointer;
ext = (struct iw_encode_ext *)iwr->u.encoding.pointer;
switch (ext->alg)
{
@ -860,7 +861,7 @@ int bcmf_wl_set_encode_ext(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
out_len = sizeof(psk);
return bcmf_cdc_ioctl(priv, interface, true,
WLC_SET_WSEC_PMK, (uint8_t*)&psk, &out_len);
WLC_SET_WSEC_PMK, (uint8_t *)&psk, &out_len);
}
int bcmf_wl_set_ssid(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
@ -883,8 +884,8 @@ int bcmf_wl_set_ssid(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
/* Configure AP SSID and trig authentication request */
out_len = sizeof(ssid);
if(bcmf_cdc_ioctl(priv, interface, true,
WLC_SET_SSID, (uint8_t*)&ssid, &out_len))
if (bcmf_cdc_ioctl(priv, interface, true,
WLC_SET_SSID, (uint8_t *)&ssid, &out_len))
{
return -EIO;
}
@ -910,4 +911,5 @@ int bcmf_wl_set_ssid(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
return -EINVAL;
}
return OK;
}
}

View File

@ -105,18 +105,18 @@ struct bcmf_bus_dev_s
void (*stop)(FAR struct bcmf_dev_s *priv);
int (*txframe)(FAR struct bcmf_dev_s *priv, struct bcmf_frame_s *frame,
bool control);
struct bcmf_frame_s* (*rxframe)(FAR struct bcmf_dev_s *priv);
struct bcmf_frame_s *(*rxframe)(FAR struct bcmf_dev_s *priv);
/* Frame buffer allocation primitives
* len - requested payload length
* control - true if control frame else false
* block - true to block until free frame is available
*/
struct bcmf_frame_s* (*allocate_frame)(FAR struct bcmf_dev_s *priv,
struct bcmf_frame_s *(*allocate_frame)(FAR struct bcmf_dev_s *priv,
unsigned int len, bool block,
bool control);
void (*free_frame)(FAR struct bcmf_dev_s *priv, struct bcmf_frame_s* frame);
void (*free_frame)(FAR struct bcmf_dev_s *priv, struct bcmf_frame_s *frame);
};
/* bcmf frame definition */

File diff suppressed because it is too large Load Diff

View File

@ -755,9 +755,10 @@ static int bcmf_ifdown(FAR struct net_driver_s *dev)
static void bcmf_txavail_work(FAR void *arg)
{
// wlinfo("Entry\n");
FAR struct bcmf_dev_s *priv = (FAR struct bcmf_dev_s *)arg;
// wlinfo("Entry\n");
/* Lock the network and serialize driver operations if necessary.
* NOTE: Serialization is only required in the case where the driver work
* is performed on an LP worker thread and where more than one LP worker
@ -991,23 +992,23 @@ static int bcmf_ioctl(FAR struct net_driver_s *dev, int cmd,
switch (cmd)
{
case SIOCSIWSCAN:
ret = bcmf_wl_start_scan(priv, (struct ifreq*)arg);
ret = bcmf_wl_start_scan(priv, (struct ifreq *)arg);
break;
case SIOCGIWSCAN:
ret = bcmf_wl_get_scan_results(priv, (struct ifreq*)arg);
ret = bcmf_wl_get_scan_results(priv, (struct ifreq *)arg);
break;
case SIOCSIFHWADDR: /* Set device MAC address */
ret = bcmf_wl_set_mac_address(priv, (struct ifreq*)arg);
ret = bcmf_wl_set_mac_address(priv, (struct ifreq *)arg);
break;
case SIOCSIWAUTH:
ret = bcmf_wl_set_auth_param(priv, (struct iwreq*)arg);
ret = bcmf_wl_set_auth_param(priv, (struct iwreq *)arg);
break;
case SIOCSIWENCODEEXT:
ret = bcmf_wl_set_encode_ext(priv, (struct iwreq*)arg);
ret = bcmf_wl_set_encode_ext(priv, (struct iwreq *)arg);
break;
case SIOCSIWFREQ: /* Set channel/frequency (Hz) */
@ -1021,7 +1022,7 @@ static int bcmf_ioctl(FAR struct net_driver_s *dev, int cmd,
break;
case SIOCSIWMODE: /* Set operation mode */
ret = bcmf_wl_set_mode(priv, (struct iwreq*)arg);
ret = bcmf_wl_set_mode(priv, (struct iwreq *)arg);
break;
case SIOCGIWMODE: /* Get operation mode */
@ -1040,7 +1041,7 @@ static int bcmf_ioctl(FAR struct net_driver_s *dev, int cmd,
break;
case SIOCSIWESSID: /* Set ESSID (network name) */
ret = bcmf_wl_set_ssid(priv, (struct iwreq*)arg);
ret = bcmf_wl_set_ssid(priv, (struct iwreq *)arg);
break;
case SIOCGIWESSID: /* Get ESSID */

View File

@ -114,7 +114,8 @@ static int bcmf_sdio_find_block_size(unsigned int size);
FAR struct bcmf_dev_s *g_sdio_priv;
/* Buffer pool for SDIO bus interface
This pool is shared between all driver devices */
* This pool is shared between all driver devices
*/
static struct bcmf_sdio_frame g_pktframes[BCMF_PKT_POOL_SIZE];
@ -126,11 +127,12 @@ static struct bcmf_sdio_frame g_pktframes[BCMF_PKT_POOL_SIZE];
int bcmf_oob_irq(int irq, FAR void *context, FAR void *arg)
{
FAR struct bcmf_sdio_dev_s *sbus = (struct bcmf_sdio_dev_s*)arg;
FAR struct bcmf_sdio_dev_s *sbus = (struct bcmf_sdio_dev_s *)arg;
if (sbus->ready)
{
/* Signal bmcf thread */
sbus->irq_pending = true;
sem_post(&sbus->thread_signal);
@ -360,7 +362,7 @@ int bcmf_bus_setup_interrupts(FAR struct bcmf_sdio_dev_s *sbus)
/* Configure gpio interrupt pin */
bcmf_board_setup_oob_irq(sbus->minor, bcmf_oob_irq, (void*)sbus);
bcmf_board_setup_oob_irq(sbus->minor, bcmf_oob_irq, (void *)sbus);
/* Enable function 2 interrupt */
@ -455,16 +457,18 @@ int bcmf_sdio_find_block_size(unsigned int size)
{
int ret = 0;
int size_copy = size;
while (size_copy) {
size_copy >>= 1;
ret++;
}
while (size_copy)
{
size_copy >>= 1;
ret++;
}
if (size & (size-1))
{
return 1<<ret;
return 1 << ret;
}
return 1<<(ret-1);
return 1 << (ret - 1);
}
/****************************************************************************
@ -554,7 +558,7 @@ int bcmf_bus_sdio_initialize(FAR struct bcmf_dev_s *priv,
/* Allocate sdio bus structure */
sbus = (FAR struct bcmf_sdio_dev_s*)kmm_malloc(sizeof(*sbus));
sbus = (FAR struct bcmf_sdio_dev_s *)kmm_malloc(sizeof(*sbus));
if (!sbus)
{
@ -581,6 +585,7 @@ int bcmf_bus_sdio_initialize(FAR struct bcmf_dev_s *priv,
{
goto exit_free_bus;
}
sq_init(&sbus->tx_queue);
sq_init(&sbus->rx_queue);
sq_init(&sbus->free_queue);
@ -599,6 +604,7 @@ int bcmf_bus_sdio_initialize(FAR struct bcmf_dev_s *priv,
{
goto exit_free_bus;
}
if ((ret = sem_setprotocol(&sbus->thread_signal, SEM_PRIO_NONE)) != OK)
{
goto exit_free_bus;
@ -708,7 +714,7 @@ int bcmf_chipinitialize(FAR struct bcmf_sdio_dev_s *sbus)
#ifdef CONFIG_IEEE80211_BROADCOM_BCM43362
case SDIO_DEVICE_ID_BROADCOM_43362:
wlinfo("bcm43362 chip detected\n");
sbus->chip = (struct bcmf_sdio_chip*)&bcmf_43362_config_sdio;
sbus->chip = (struct bcmf_sdio_chip *)&bcmf_43362_config_sdio;
break;
#endif
default:
@ -720,8 +726,8 @@ int bcmf_chipinitialize(FAR struct bcmf_sdio_dev_s *sbus)
void bcmf_sdio_waitdog_timeout(int argc, wdparm_t arg1, ...)
{
FAR struct bcmf_dev_s *priv = (FAR struct bcmf_dev_s*)arg1;
FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s*)priv->bus;
FAR struct bcmf_dev_s *priv = (FAR struct bcmf_dev_s *)arg1;
FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s *)priv->bus;
/* Notify bcmf thread */
@ -733,7 +739,7 @@ int bcmf_sdio_thread(int argc, char **argv)
{
int ret;
FAR struct bcmf_dev_s *priv = g_sdio_priv;
FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s*)priv->bus;
FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s *)priv->bus;
wlinfo("Enter\n");
@ -788,7 +794,8 @@ int bcmf_sdio_thread(int argc, char **argv)
do
{
ret = bcmf_sdpcm_readframe(priv);
} while (ret == OK);
}
while (ret == OK);
if (ret == -ENODATA)
{
@ -803,7 +810,8 @@ int bcmf_sdio_thread(int argc, char **argv)
do
{
ret = bcmf_sdpcm_sendframe(priv);
} while (ret == OK);
}
while (ret == OK);
/* Check if RX frames are available */
@ -825,10 +833,10 @@ int bcmf_sdio_thread(int argc, char **argv)
return 0;
}
struct bcmf_sdio_frame* bcmf_sdio_allocate_frame(FAR struct bcmf_dev_s *priv,
struct bcmf_sdio_frame *bcmf_sdio_allocate_frame(FAR struct bcmf_dev_s *priv,
bool block, bool tx)
{
FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s*)priv->bus;
FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s *)priv->bus;
struct bcmf_sdio_frame *sframe;
dq_entry_t *entry = NULL;
@ -879,7 +887,7 @@ void bcmf_sdio_free_frame(FAR struct bcmf_dev_s *priv,
struct bcmf_sdio_frame *sframe)
{
// wlinfo("free %p\n", sframe);
FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s*)priv->bus;
FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s *)priv->bus;
if (sem_wait(&sbus->queue_mutex))
{
@ -893,4 +901,4 @@ void bcmf_sdio_free_frame(FAR struct bcmf_dev_s *priv,
sbus->tx_queue_count -= 1;
}
sem_post(&sbus->queue_mutex);
}
}

View File

@ -106,12 +106,13 @@ struct bcmf_sdio_dev_s
/* Structure used to manage SDIO frames */
struct bcmf_sdio_frame {
struct bcmf_frame_s header;
bool tx;
dq_entry_t list_entry;
uint8_t data[HEADER_SIZE + MAX_NET_DEV_MTU +
CONFIG_NET_GUARDSIZE];
struct bcmf_sdio_frame
{
struct bcmf_frame_s header;
bool tx;
dq_entry_t list_entry;
uint8_t data[HEADER_SIZE + MAX_NET_DEV_MTU +
CONFIG_NET_GUARDSIZE];
};
/****************************************************************************
@ -137,7 +138,7 @@ int bcmf_read_reg(FAR struct bcmf_sdio_dev_s *sbus, uint8_t function,
int bcmf_write_reg(FAR struct bcmf_sdio_dev_s *sbus, uint8_t function,
uint32_t address, uint8_t reg);
struct bcmf_sdio_frame* bcmf_sdio_allocate_frame(FAR struct bcmf_dev_s *priv,
struct bcmf_sdio_frame *bcmf_sdio_allocate_frame(FAR struct bcmf_dev_s *priv,
bool block, bool tx);
void bcmf_sdio_free_frame(FAR struct bcmf_dev_s *priv,

View File

@ -1,4 +1,4 @@
/*
/****************************************************************************
* Copyright (c) 2011 Broadcom Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
@ -12,7 +12,8 @@
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
*
****************************************************************************/
#ifndef __DRIVERS_WIRELESS_IEEE80211_BCMF_SDIO_CORE_H
#define __DRIVERS_WIRELESS_IEEE80211_BCMF_SDIO_CORE_H
@ -26,6 +27,7 @@
#endif
/* SDIO device ID */
#define SDIO_DEVICE_ID_BROADCOM_43143 43143
#define SDIO_DEVICE_ID_BROADCOM_43241 0x4324
#define SDIO_DEVICE_ID_BROADCOM_4329 0x4329
@ -34,10 +36,10 @@
#define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
#define SDIO_DEVICE_ID_BROADCOM_43362 43362
/*
* Core reg address translation.
/* Core reg address translation.
* Both macro's returns a 32 bits byte address on the backplane bus.
*/
#define CORE_CC_REG(base, field) \
(base + offsetof(struct chipcregs, field))
#define CORE_BUS_REG(base, field) \
@ -68,152 +70,157 @@
#define SMB_USE_OOB (1 << 2) /* Use OOB Wakeup */
#define SMB_DEV_INT (1 << 3) /* Miscellaneous Interrupt */
enum {
CHIPCOMMON_CORE_ID = 0,
DOT11MAC_CORE_ID,
SDIOD_CORE_ID,
WLAN_ARMCM3_CORE_ID,
SOCSRAM_CORE_ID,
MAX_CORE_ID
enum
{
CHIPCOMMON_CORE_ID = 0,
DOT11MAC_CORE_ID,
SDIOD_CORE_ID,
WLAN_ARMCM3_CORE_ID,
SOCSRAM_CORE_ID,
MAX_CORE_ID
};
struct chip_core_info {
uint16_t id;
uint16_t rev;
uint32_t base;
uint32_t wrapbase;
uint32_t caps;
uint32_t cib;
struct chip_core_info
{
uint16_t id;
uint16_t rev;
uint32_t base;
uint32_t wrapbase;
uint32_t caps;
uint32_t cib;
};
struct sbconfig {
uint8_t PAD[0xf00];
uint32_t PAD[2];
uint32_t sbipsflag; /* initiator port ocp slave flag */
uint32_t PAD[3];
uint32_t sbtpsflag; /* target port ocp slave flag */
uint32_t PAD[11];
uint32_t sbtmerrloga; /* (sonics >= 2.3) */
uint32_t PAD;
uint32_t sbtmerrlog; /* (sonics >= 2.3) */
uint32_t PAD[3];
uint32_t sbadmatch3; /* address match3 */
uint32_t PAD;
uint32_t sbadmatch2; /* address match2 */
uint32_t PAD;
uint32_t sbadmatch1; /* address match1 */
uint32_t PAD[7];
uint32_t sbimstate; /* initiator agent state */
uint32_t sbintvec; /* interrupt mask */
uint32_t sbtmstatelow; /* target state */
uint32_t sbtmstatehigh; /* target state */
uint32_t sbbwa0; /* bandwidth allocation table0 */
uint32_t PAD;
uint32_t sbimconfiglow; /* initiator configuration */
uint32_t sbimconfighigh; /* initiator configuration */
uint32_t sbadmatch0; /* address match0 */
uint32_t PAD;
uint32_t sbtmconfiglow; /* target configuration */
uint32_t sbtmconfighigh; /* target configuration */
uint32_t sbbconfig; /* broadcast configuration */
uint32_t PAD;
uint32_t sbbstate; /* broadcast state */
uint32_t PAD[3];
uint32_t sbactcnfg; /* activate configuration */
uint32_t PAD[3];
uint32_t sbflagst; /* current sbflags */
uint32_t PAD[3];
uint32_t sbidlow; /* identification */
uint32_t sbidhigh; /* identification */
struct sbconfig
{
uint8_t PAD[0xf00];
uint32_t PAD[2];
uint32_t sbipsflag; /* initiator port ocp slave flag */
uint32_t PAD[3];
uint32_t sbtpsflag; /* target port ocp slave flag */
uint32_t PAD[11];
uint32_t sbtmerrloga; /* (sonics >= 2.3) */
uint32_t PAD;
uint32_t sbtmerrlog; /* (sonics >= 2.3) */
uint32_t PAD[3];
uint32_t sbadmatch3; /* address match3 */
uint32_t PAD;
uint32_t sbadmatch2; /* address match2 */
uint32_t PAD;
uint32_t sbadmatch1; /* address match1 */
uint32_t PAD[7];
uint32_t sbimstate; /* initiator agent state */
uint32_t sbintvec; /* interrupt mask */
uint32_t sbtmstatelow; /* target state */
uint32_t sbtmstatehigh; /* target state */
uint32_t sbbwa0; /* bandwidth allocation table0 */
uint32_t PAD;
uint32_t sbimconfiglow; /* initiator configuration */
uint32_t sbimconfighigh; /* initiator configuration */
uint32_t sbadmatch0; /* address match0 */
uint32_t PAD;
uint32_t sbtmconfiglow; /* target configuration */
uint32_t sbtmconfighigh; /* target configuration */
uint32_t sbbconfig; /* broadcast configuration */
uint32_t PAD;
uint32_t sbbstate; /* broadcast state */
uint32_t PAD[3];
uint32_t sbactcnfg; /* activate configuration */
uint32_t PAD[3];
uint32_t sbflagst; /* current sbflags */
uint32_t PAD[3];
uint32_t sbidlow; /* identification */
uint32_t sbidhigh; /* identification */
};
/* sdio core registers */
struct sdpcmd_regs {
uint32_t corecontrol; /* 0x00, rev8 */
uint32_t corestatus; /* rev8 */
uint32_t PAD[1];
uint32_t biststatus; /* rev8 */
/* PCMCIA access */
uint16_t pcmciamesportaladdr; /* 0x010, rev8 */
uint16_t PAD[1];
uint16_t pcmciamesportalmask; /* rev8 */
uint16_t PAD[1];
uint16_t pcmciawrframebc; /* rev8 */
uint16_t PAD[1];
uint16_t pcmciaunderflowtimer; /* rev8 */
uint16_t PAD[1];
struct sdpcmd_regs
{
uint32_t corecontrol; /* 0x00, rev8 */
uint32_t corestatus; /* rev8 */
uint32_t PAD[1];
uint32_t biststatus; /* rev8 */
/* interrupt */
uint32_t intstatus; /* 0x020, rev8 */
uint32_t hostintmask; /* rev8 */
uint32_t intmask; /* rev8 */
uint32_t sbintstatus; /* rev8 */
uint32_t sbintmask; /* rev8 */
uint32_t funcintmask; /* rev4 */
uint32_t PAD[2];
uint32_t tosbmailbox; /* 0x040, rev8 */
uint32_t tohostmailbox; /* rev8 */
uint32_t tosbmailboxdata; /* rev8 */
uint32_t tohostmailboxdata; /* rev8 */
/* PCMCIA access */
uint16_t pcmciamesportaladdr; /* 0x010, rev8 */
uint16_t PAD[1];
uint16_t pcmciamesportalmask; /* rev8 */
uint16_t PAD[1];
uint16_t pcmciawrframebc; /* rev8 */
uint16_t PAD[1];
uint16_t pcmciaunderflowtimer; /* rev8 */
uint16_t PAD[1];
/* synchronized access to registers in SDIO clock domain */
uint32_t sdioaccess; /* 0x050, rev8 */
uint32_t PAD[3];
/* interrupt */
uint32_t intstatus; /* 0x020, rev8 */
uint32_t hostintmask; /* rev8 */
uint32_t intmask; /* rev8 */
uint32_t sbintstatus; /* rev8 */
uint32_t sbintmask; /* rev8 */
uint32_t funcintmask; /* rev4 */
uint32_t PAD[2];
uint32_t tosbmailbox; /* 0x040, rev8 */
uint32_t tohostmailbox; /* rev8 */
uint32_t tosbmailboxdata; /* rev8 */
uint32_t tohostmailboxdata; /* rev8 */
/* PCMCIA frame control */
uint8_t pcmciaframectrl; /* 0x060, rev8 */
uint8_t PAD[3];
uint8_t pcmciawatermark; /* rev8 */
uint8_t PAD[155];
/* synchronized access to registers in SDIO clock domain */
uint32_t sdioaccess; /* 0x050, rev8 */
uint32_t PAD[3];
/* interrupt batching control */
uint32_t intrcvlazy; /* 0x100, rev8 */
uint32_t PAD[3];
/* PCMCIA frame control */
uint8_t pcmciaframectrl; /* 0x060, rev8 */
uint8_t PAD[3];
uint8_t pcmciawatermark; /* rev8 */
uint8_t PAD[155];
/* counters */
uint32_t cmd52rd; /* 0x110, rev8 */
uint32_t cmd52wr; /* rev8 */
uint32_t cmd53rd; /* rev8 */
uint32_t cmd53wr; /* rev8 */
uint32_t abort; /* rev8 */
uint32_t datacrcerror; /* rev8 */
uint32_t rdoutofsync; /* rev8 */
uint32_t wroutofsync; /* rev8 */
uint32_t writebusy; /* rev8 */
uint32_t readwait; /* rev8 */
uint32_t readterm; /* rev8 */
uint32_t writeterm; /* rev8 */
uint32_t PAD[40];
uint32_t clockctlstatus; /* rev8 */
uint32_t PAD[7];
/* interrupt batching control */
uint32_t intrcvlazy; /* 0x100, rev8 */
uint32_t PAD[3];
uint32_t PAD[128]; /* DMA engines */
/* counters */
uint32_t cmd52rd; /* 0x110, rev8 */
uint32_t cmd52wr; /* rev8 */
uint32_t cmd53rd; /* rev8 */
uint32_t cmd53wr; /* rev8 */
uint32_t abort; /* rev8 */
uint32_t datacrcerror; /* rev8 */
uint32_t rdoutofsync; /* rev8 */
uint32_t wroutofsync; /* rev8 */
uint32_t writebusy; /* rev8 */
uint32_t readwait; /* rev8 */
uint32_t readterm; /* rev8 */
uint32_t writeterm; /* rev8 */
uint32_t PAD[40];
uint32_t clockctlstatus; /* rev8 */
uint32_t PAD[7];
/* SDIO/PCMCIA CIS region */
char cis[512]; /* 0x400-0x5ff, rev6 */
uint32_t PAD[128]; /* DMA engines */
/* PCMCIA function control registers */
char pcmciafcr[256]; /* 0x600-6ff, rev6 */
uint16_t PAD[55];
/* SDIO/PCMCIA CIS region */
char cis[512]; /* 0x400-0x5ff, rev6 */
/* PCMCIA backplane access */
uint16_t backplanecsr; /* 0x76E, rev6 */
uint16_t backplaneaddr0; /* rev6 */
uint16_t backplaneaddr1; /* rev6 */
uint16_t backplaneaddr2; /* rev6 */
uint16_t backplaneaddr3; /* rev6 */
uint16_t backplanedata0; /* rev6 */
uint16_t backplanedata1; /* rev6 */
uint16_t backplanedata2; /* rev6 */
uint16_t backplanedata3; /* rev6 */
uint16_t PAD[31];
/* PCMCIA function control registers */
char pcmciafcr[256]; /* 0x600-6ff, rev6 */
uint16_t PAD[55];
/* sprom "size" & "blank" info */
uint16_t spromstatus; /* 0x7BE, rev2 */
uint32_t PAD[464];
/* PCMCIA backplane access */
uint16_t backplanecsr; /* 0x76E, rev6 */
uint16_t backplaneaddr0; /* rev6 */
uint16_t backplaneaddr1; /* rev6 */
uint16_t backplaneaddr2; /* rev6 */
uint16_t backplaneaddr3; /* rev6 */
uint16_t backplanedata0; /* rev6 */
uint16_t backplanedata1; /* rev6 */
uint16_t backplanedata2; /* rev6 */
uint16_t backplanedata3; /* rev6 */
uint16_t PAD[31];
uint16_t PAD[0x80];
/* sprom "size" & "blank" info */
uint16_t spromstatus; /* 0x7BE, rev2 */
uint32_t PAD[464];
uint16_t PAD[0x80];
};
#endif /* __DRIVERS_WIRELESS_IEEE80211_BCMF_SDIO_CORE_H */

View File

@ -1,4 +1,4 @@
/*
/****************************************************************************
* Copyright (c) 2010 Broadcom Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
@ -12,7 +12,8 @@
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
*
****************************************************************************/
#ifndef __DRIVERS_WIRELESS_IEEE80211_BCMF_SDIO_REGS_H
#define __DRIVERS_WIRELESS_IEEE80211_BCMF_SDIO_REGS_H
@ -24,28 +25,35 @@
#define SDIOD_FBR_SIZE 0x100
/* io_en */
#define SDIO_FUNC_ENABLE_1 0x02
#define SDIO_FUNC_ENABLE_2 0x04
/* io_rdys */
#define SDIO_FUNC_READY_1 0x02
#define SDIO_FUNC_READY_2 0x04
/* intr_status */
#define INTR_STATUS_FUNC1 0x2
#define INTR_STATUS_FUNC2 0x4
/* Maximum number of I/O funcs */
#define SDIOD_MAX_IOFUNCS 7
/* mask of register map */
#define REG_F0_REG_MASK 0x7FF
#define REG_F1_MISC_MASK 0x1FFFF
/* as of sdiod rev 0, supports 3 functions */
#define SBSDIO_NUM_FUNCTION 3
/* function 0 vendor specific CCCR registers */
#define SDIO_CCCR_BRCM_CARDCAP 0xf0
#define SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT 0x02
#define SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT 0x04
@ -61,74 +69,140 @@
/* function 1 miscellaneous registers */
/* sprom command and status */
#define SBSDIO_SPROM_CS 0x10000
/* sprom info register */
#define SBSDIO_SPROM_INFO 0x10001
/* sprom indirect access data byte 0 */
#define SBSDIO_SPROM_DATA_LOW 0x10002
/* sprom indirect access data byte 1 */
#define SBSDIO_SPROM_DATA_HIGH 0x10003
/* sprom indirect access addr byte 0 */
#define SBSDIO_SPROM_ADDR_LOW 0x10004
/* sprom indirect access addr byte 0 */
#define SBSDIO_SPROM_ADDR_HIGH 0x10005
/* xtal_pu (gpio) output */
#define SBSDIO_CHIP_CTRL_DATA 0x10006
/* xtal_pu (gpio) enable */
#define SBSDIO_CHIP_CTRL_EN 0x10007
/* rev < 7, watermark for sdio device */
#define SBSDIO_WATERMARK 0x10008
/* control busy signal generation */
#define SBSDIO_DEVICE_CTL 0x10009
/* SB Address Window Low (b15) */
#define SBSDIO_FUNC1_SBADDRLOW 0x1000A
/* SB Address Window Mid (b23:b16) */
#define SBSDIO_FUNC1_SBADDRMID 0x1000B
/* SB Address Window High (b31:b24) */
/* SB Address Window High (b31:b24) */
#define SBSDIO_FUNC1_SBADDRHIGH 0x1000C
/* Frame Control (frame term/abort) */
#define SBSDIO_FUNC1_FRAMECTRL 0x1000D
/* Read Frame Terminate */
#define SFC_RF_TERM (1 << 0)
/* Write Frame Terminate */
#define SFC_WF_TERM (1 << 1)
/* CRC error for write out of sync */
#define SFC_CRC4WOOS (1 << 2)
/* Abort all in-progress frames */
#define SFC_ABORTALL (1 << 3)
/* ChipClockCSR (ALP/HT ctl/status) */
#define SBSDIO_FUNC1_CHIPCLKCSR 0x1000E
/* Force ALP request to backplane */
#define SBSDIO_FORCE_ALP 0x01
/* Force HT request to backplane */
#define SBSDIO_FORCE_HT 0x02
/* Force ILP request to backplane */
#define SBSDIO_FORCE_ILP 0x04
/* Make ALP ready (power up xtal) */
#define SBSDIO_ALP_AVAIL_REQ 0x08
/* Make HT ready (power up PLL) */
#define SBSDIO_HT_AVAIL_REQ 0x10
/* Squelch clock requests from HW */
#define SBSDIO_FORCE_HW_CLKREQ_OFF 0x20
/* Status: ALP is ready */
#define SBSDIO_ALP_AVAIL 0x40
/* Status: HT is ready */
#define SBSDIO_HT_AVAIL 0x80
/* SdioPullUp (on cmd, d0-d2) */
#define SBSDIO_FUNC1_SDIOPULLUP 0x1000F
/* Write Frame Byte Count Low */
#define SBSDIO_FUNC1_WFRAMEBCLO 0x10019
/* Write Frame Byte Count High */
#define SBSDIO_FUNC1_WFRAMEBCHI 0x1001A
/* Read Frame Byte Count Low */
#define SBSDIO_FUNC1_RFRAMEBCLO 0x1001B
/* Read Frame Byte Count High */
#define SBSDIO_FUNC1_RFRAMEBCHI 0x1001C
/* MesBusyCtl (rev 11) */
#define SBSDIO_FUNC1_MESBUSYCTRL 0x1001D
/* Sdio Core Rev 12 */
#define SBSDIO_FUNC1_WAKEUPCTRL 0x1001E
#define SBSDIO_FUNC1_WCTRL_ALPWAIT_MASK 0x1
#define SBSDIO_FUNC1_WCTRL_ALPWAIT_SHIFT 0
@ -155,9 +229,12 @@
/* function 1 OCP space */
/* sb offset addr is <= 15 bits, 32k */
#define SBSDIO_SB_OFT_ADDR_MASK 0x07FFF
#define SBSDIO_SB_OFT_ADDR_LIMIT 0x08000
/* with b15, maps to 32-bit SB access */
#define SBSDIO_SB_ACCESS_2_4B_FLAG 0x08000
/* valid bits in SBSDIO_FUNC1_SBADDRxxx regs */

View File

@ -152,7 +152,7 @@ int bcmf_sdpcm_readframe(FAR struct bcmf_dev_s *priv)
uint16_t len, 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;
FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s *)priv->bus;
/* Request free frame buffer */
@ -164,11 +164,11 @@ int bcmf_sdpcm_readframe(FAR struct bcmf_dev_s *priv)
return -EAGAIN;
}
header = (struct bcmf_sdpcm_header*)sframe->data;
header = (struct bcmf_sdpcm_header *)sframe->data;
/* Read header */
ret = bcmf_transfer_bytes(sbus, false, 2, 0, (uint8_t*)header, 4);
ret = bcmf_transfer_bytes(sbus, false, 2, 0, (uint8_t *)header, 4);
if (ret != OK)
{
wlinfo("failread size\n");
@ -203,7 +203,7 @@ int bcmf_sdpcm_readframe(FAR struct bcmf_dev_s *priv)
/* Read remaining frame data */
ret = bcmf_transfer_bytes(sbus, false, 2, 0, (uint8_t*)header+4, len - 4);
ret = bcmf_transfer_bytes(sbus, false, 2, 0, (uint8_t *)header + 4, len - 4);
if (ret != OK)
{
ret = -EIO;
@ -211,7 +211,7 @@ int bcmf_sdpcm_readframe(FAR struct bcmf_dev_s *priv)
}
// wlinfo("Receive frame %p %d\n", sframe, len);
// bcmf_hexdump((uint8_t*)header, header->size, (unsigned int)header);
// bcmf_hexdump((uint8_t *)header, header->size, (unsigned int)header);
/* Process and validate header */
@ -289,7 +289,7 @@ int bcmf_sdpcm_sendframe(FAR struct bcmf_dev_s *priv)
dq_entry_t *entry;
struct bcmf_sdio_frame *sframe;
struct bcmf_sdpcm_header *header;
FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s*)priv->bus;
FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s *)priv->bus;
if (sbus->tx_queue.tail == NULL)
{
@ -313,7 +313,7 @@ int bcmf_sdpcm_sendframe(FAR struct bcmf_dev_s *priv)
entry = sbus->tx_queue.tail;
sframe = container_of(entry, struct bcmf_sdio_frame, list_entry);
header = (struct bcmf_sdpcm_header*)sframe->header.base;
header = (struct bcmf_sdpcm_header *)sframe->header.base;
/* Set frame sequence id */
@ -361,9 +361,9 @@ exit_abort:
int bcmf_sdpcm_queue_frame(FAR struct bcmf_dev_s *priv,
struct bcmf_frame_s *frame, bool control)
{
FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s*)priv->bus;
struct bcmf_sdio_frame *sframe = (struct bcmf_sdio_frame*)frame;
struct bcmf_sdpcm_header *header = (struct bcmf_sdpcm_header*)sframe->data;
FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s *)priv->bus;
struct bcmf_sdio_frame *sframe = (struct bcmf_sdio_frame *)frame;
struct bcmf_sdpcm_header *header = (struct bcmf_sdpcm_header *)sframe->data;
/* Prepare sw header */
@ -399,9 +399,9 @@ int bcmf_sdpcm_queue_frame(FAR struct bcmf_dev_s *priv,
return OK;
}
struct bcmf_frame_s* bcmf_sdpcm_alloc_frame(FAR struct bcmf_dev_s *priv,
unsigned int len, bool block,
bool control)
struct bcmf_frame_s *bcmf_sdpcm_alloc_frame(FAR struct bcmf_dev_s *priv,
unsigned int len, bool block,
bool control)
{
struct bcmf_sdio_frame *sframe;
unsigned int header_len = sizeof(struct bcmf_sdpcm_header);
@ -436,14 +436,14 @@ struct bcmf_frame_s* bcmf_sdpcm_alloc_frame(FAR struct bcmf_dev_s *priv,
void bcmf_sdpcm_free_frame(FAR struct bcmf_dev_s *priv,
struct bcmf_frame_s *frame)
{
return bcmf_sdio_free_frame(priv, (struct bcmf_sdio_frame*)frame);
return bcmf_sdio_free_frame(priv, (struct bcmf_sdio_frame *)frame);
}
struct bcmf_frame_s* bcmf_sdpcm_get_rx_frame(FAR struct bcmf_dev_s *priv)
struct bcmf_frame_s *bcmf_sdpcm_get_rx_frame(FAR struct bcmf_dev_s *priv)
{
dq_entry_t *entry;
struct bcmf_sdio_frame *sframe;
FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s*)priv->bus;
FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s *)priv->bus;
if (sem_wait(&sbus->queue_mutex))
{
@ -461,4 +461,4 @@ struct bcmf_frame_s* bcmf_sdpcm_get_rx_frame(FAR struct bcmf_dev_s *priv)
sframe = container_of(entry, struct bcmf_sdio_frame, list_entry);
return &sframe->header;
}
}

View File

@ -55,9 +55,10 @@ int bcmf_sdpcm_queue_frame(FAR struct bcmf_dev_s *priv,
void bcmf_sdpcm_free_frame(FAR struct bcmf_dev_s *priv, struct bcmf_frame_s *frame);
struct bcmf_frame_s* bcmf_sdpcm_alloc_frame(FAR struct bcmf_dev_s *priv,
unsigned int len, bool block, bool control);
struct bcmf_frame_s *bcmf_sdpcm_alloc_frame(FAR struct bcmf_dev_s *priv,
unsigned int len, bool block,
bool control);
struct bcmf_frame_s* bcmf_sdpcm_get_rx_frame(FAR struct bcmf_dev_s *priv);
struct bcmf_frame_s *bcmf_sdpcm_get_rx_frame(FAR struct bcmf_dev_s *priv);
#endif /* __DRIVERS_WIRELESS_IEEE80211_BCMF_SDPCM_H */
#endif /* __DRIVERS_WIRELESS_IEEE80211_BCMF_SDPCM_H */

View File

@ -68,7 +68,7 @@ void bcmf_hexdump(uint8_t *data, unsigned int len, unsigned long offset)
char char_line[20];
char hex_line[64];
for(i = 0; i < len; i++)
for (i = 0; i < len; i++)
{
if (char_count >= LINE_LEN)
{
@ -107,9 +107,9 @@ int bcmf_sem_wait(sem_t *sem, unsigned int timeout_ms)
(void)clock_gettime(CLOCK_REALTIME, &abstime);
timeout_sec = timeout_ms/1000;
timeout_sec = timeout_ms / 1000;
abstime.tv_sec += timeout_sec;
abstime.tv_nsec += 1000 * 1000* (timeout_ms % 1000);
abstime.tv_nsec += 1000 * 1000 * (timeout_ms % 1000);
if (abstime.tv_nsec >= 1000 * 1000 * 1000)
{
@ -144,7 +144,7 @@ void bcmf_dqueue_push(dq_queue_t *queue, dq_entry_t *entry)
queue->head = entry;
}
dq_entry_t* bcmf_dqueue_pop_tail(dq_queue_t *queue)
dq_entry_t *bcmf_dqueue_pop_tail(dq_queue_t *queue)
{
dq_entry_t *entry = queue->tail;
@ -164,4 +164,4 @@ dq_entry_t* bcmf_dqueue_pop_tail(dq_queue_t *queue)
}
return entry;
}
}

View File

@ -45,7 +45,7 @@
#include <queue.h>
#define container_of(ptr, type, member) \
(type *)( (uint8_t *)(ptr) - offsetof(type,member) )
(type *)((uint8_t *)(ptr) - offsetof(type, member))
/****************************************************************************
* Public Function Prototypes
@ -55,19 +55,19 @@ void bcmf_hexdump(uint8_t *data, unsigned int len, unsigned long offset);
int bcmf_sem_wait(sem_t *sem, unsigned int timeout_ms);
dq_entry_t* bcmf_dqueue_pop_tail(dq_queue_t *queue);
dq_entry_t *bcmf_dqueue_pop_tail(dq_queue_t *queue);
void bcmf_dqueue_push(dq_queue_t *queue, dq_entry_t *entry);
static inline uint16_t bcmf_getle16(uint16_t *val)
{
uint8_t *valb = (uint8_t*)val;
uint8_t *valb = (uint8_t *)val;
return (uint16_t)valb[0] << 8 | (uint16_t)valb[1];
}
static inline uint16_t bcmf_getle32(uint32_t *val)
{
uint16_t *valw = (uint16_t*)val;
return (uint32_t)bcmf_getle16(valw)<<16 | bcmf_getle16(valw+1);
uint16_t *valw = (uint16_t *)val;
return (uint32_t)bcmf_getle16(valw) << 16 | bcmf_getle16(valw + 1);
}
#endif /* __DRIVERS_WIRELESS_IEEE80211_BCMF_UTILS_H */

View File

@ -7,43 +7,48 @@
#define SDIO_CMD53_TIMEOUT_MS 100
#define SDIO_IDLE_DELAY_MS 50
struct __attribute__((packed)) sdio_cmd52 {
uint32_t write_data : 8;
uint32_t reserved_8 : 1;
uint32_t register_address : 17;
uint32_t reserved_26 : 1;
uint32_t raw_flag : 1;
uint32_t function_number : 3;
uint32_t rw_flag : 1;
struct __attribute__((packed)) sdio_cmd52
{
uint32_t write_data : 8;
uint32_t reserved_8 : 1;
uint32_t register_address : 17;
uint32_t reserved_26 : 1;
uint32_t raw_flag : 1;
uint32_t function_number : 3;
uint32_t rw_flag : 1;
};
struct __attribute__((packed)) sdio_cmd53 {
uint32_t byte_block_count : 9;
uint32_t register_address : 17;
uint32_t op_code : 1;
uint32_t block_mode : 1;
uint32_t function_number : 3;
uint32_t rw_flag : 1;
struct __attribute__((packed)) sdio_cmd53
{
uint32_t byte_block_count : 9;
uint32_t register_address : 17;
uint32_t op_code : 1;
uint32_t block_mode : 1;
uint32_t function_number : 3;
uint32_t rw_flag : 1;
};
struct __attribute__((packed)) sdio_resp_R5 {
uint32_t data : 8;
struct {
uint32_t out_of_range : 1;
uint32_t function_number : 1;
uint32_t rfu : 1;
uint32_t error : 1;
uint32_t io_current_state : 2;
uint32_t illegal_command : 1;
uint32_t com_crc_error : 1;
} flags;
uint32_t reserved_16 : 16;
struct __attribute__((packed)) sdio_resp_R5
{
uint32_t data : 8;
struct
{
uint32_t out_of_range : 1;
uint32_t function_number : 1;
uint32_t rfu : 1;
uint32_t error : 1;
uint32_t io_current_state : 2;
uint32_t illegal_command : 1;
uint32_t com_crc_error : 1;
} flags;
uint32_t reserved_16 : 16;
};
union sdio_cmd5x {
uint32_t value;
struct sdio_cmd52 cmd52;
struct sdio_cmd53 cmd53;
union sdio_cmd5x
{
uint32_t value;
struct sdio_cmd52 cmd52;
struct sdio_cmd53 cmd53;
};
int sdio_sendcmdpoll(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t arg)
@ -70,7 +75,7 @@ int sdio_sendcmdpoll(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t arg)
int sdio_io_rw_direct(FAR struct sdio_dev_s *dev, bool write,
uint8_t function, uint32_t address,
uint8_t inb, uint8_t* outb)
uint8_t inb, uint8_t *outb)
{
union sdio_cmd5x arg;
struct sdio_resp_R5 resp;
@ -96,7 +101,7 @@ int sdio_io_rw_direct(FAR struct sdio_dev_s *dev, bool write,
/* Send CMD52 command */
sdio_sendcmdpoll(dev, SDIO_ACMD52, arg.value);
ret = SDIO_RECVR5(dev, SDIO_ACMD52, (uint32_t*)&resp);
ret = SDIO_RECVR5(dev, SDIO_ACMD52, (uint32_t *)&resp);
if (ret != OK)
{
@ -110,6 +115,7 @@ int sdio_io_rw_direct(FAR struct sdio_dev_s *dev, bool write,
{
return -EIO;
}
if (resp.flags.function_number || resp.flags.out_of_range)
{
return -EINVAL;
@ -170,7 +176,7 @@ int sdio_io_rw_extended(FAR struct sdio_dev_s *dev, bool write,
{
// wlinfo("prep write %d %d\n", blocklen, nblocks);
sdio_sendcmdpoll(dev, SDIO_ACMD53, (uint32_t)arg.value);
ret = SDIO_RECVR5(dev, SDIO_ACMD53, (uint32_t*)&resp);
ret = SDIO_RECVR5(dev, SDIO_ACMD53, (uint32_t *)&resp);
SDIO_DMASENDSETUP(dev, buf, blocklen * nblocks);
wkupevent = SDIO_EVENTWAIT(dev, SDIO_CMD53_TIMEOUT_MS);
@ -182,7 +188,7 @@ int sdio_io_rw_extended(FAR struct sdio_dev_s *dev, bool write,
SDIO_SENDCMD(dev, SDIO_ACMD53, (uint32_t)arg.value);
wkupevent = SDIO_EVENTWAIT(dev, SDIO_CMD53_TIMEOUT_MS);
ret = SDIO_RECVR5(dev, SDIO_ACMD53, (uint32_t*)&resp);
ret = SDIO_RECVR5(dev, SDIO_ACMD53, (uint32_t *)&resp);
}
if (ret != OK)
@ -198,11 +204,13 @@ int sdio_io_rw_extended(FAR struct sdio_dev_s *dev, bool write,
wlerr("timeout\n");
return -ETIMEDOUT;
}
if (resp.flags.error || (wkupevent & SDIOWAIT_ERROR))
{
wlerr("error 1\n");
return -EIO;
}
if (resp.flags.function_number || resp.flags.out_of_range)
{
wlerr("error 2\n");
@ -233,7 +241,7 @@ int sdio_set_wide_bus(struct sdio_dev_s *dev)
ret = sdio_io_rw_direct(dev, true, 0, SDIO_CCCR_BUS_IF, value, NULL);
if (ret != OK)
{
return ret;
return ret;
}
SDIO_WIDEBUS(dev, true);