/* * Performs the sequence necessary to read a 16/32 bit config/info item * and convert it to host order. * * Arguments: * hw device structure * rid config/info record id (in host order) * val ptr to 16/32 bit buffer to receive value (in host order) * * Returns: * 0 success */ #if 0 /* Not actually used anywhere */ static int hfa384x_drvr_getconfig16(hfa384x_t *hw, uint16_t rid, void *val) { int result = 0; result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(uint16_t)); if ( result == 0 ) { *((uint16_t*)val) = hfa384x2host_16(*((uint16_t*)val)); } return result; } #endif #if 0 /* Not actually used anywhere */ static int hfa384x_drvr_getconfig32(hfa384x_t *hw, uint16_t rid, void *val) { int result = 0; result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(uint32_t)); if ( result == 0 ) { *((uint32_t*)val) = hfa384x2host_32(*((uint32_t*)val)); } return result; }
/* * Performs the sequence necessary to read a 16/32 bit config/info item * and convert it to host order. * * Arguments: * hw device structure * rid config/info record id (in host order) * val ptr to 16/32 bit buffer to receive value (in host order) * * Returns: * 0 success */ #if 0 /* Not actually used anywhere */ static int hfa384x_drvr_getconfig16(hfa384x_t *hw, UINT16 rid, void *val) { int result = 0; result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(UINT16)); if ( result == 0 ) { *((UINT16*)val) = hfa384x2host_16(*((UINT16*)val)); } return result; } #endif #if 0 /* Not actually used anywhere */ static int hfa384x_drvr_getconfig32(hfa384x_t *hw, UINT16 rid, void *val) { int result = 0; result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(UINT32)); if ( result == 0 ) { *((UINT32*)val) = hfa384x2host_32(*((UINT32*)val)); } return result; }
/************************************************************************** POLL - Wait for a frame ***************************************************************************/ static int prism2_poll(struct nic *nic, int retrieve) { uint16_t reg; uint16_t rxfid; uint16_t result; hfa384x_rx_frame_t rxdesc; hfa384x_t *hw = &hw_global; /* Check for received packet */ reg = hfa384x_getreg(hw, HFA384x_EVSTAT); if ( ! HFA384x_EVSTAT_ISRX(reg) ) { /* No packet received - return 0 */ return 0; } if ( ! retrieve ) return 1; /* Acknowledge RX event */ hfa384x_setreg(hw, HFA384x_EVACK_RX_SET(1), HFA384x_EVACK); /* Get RX FID */ rxfid = hfa384x_getreg(hw, HFA384x_RXFID); /* Get the descriptor (including headers) */ result = hfa384x_copy_from_bap(hw, rxfid, 0, &rxdesc, sizeof(rxdesc)); if ( result ) { return 0; /* fail */ } /* Byte order convert once up front. */ rxdesc.status = hfa384x2host_16(rxdesc.status); rxdesc.time = hfa384x2host_32(rxdesc.time); rxdesc.data_len = hfa384x2host_16(rxdesc.data_len); /* Fill in nic->packetlen */ nic->packetlen = rxdesc.data_len; if ( nic->packetlen > 0 ) { /* Fill in nic->packet */ /* * NOTE: Packets as received have an 8-byte header (LLC+SNAP(?)) terminating with the packet type. * Etherboot expects a 14-byte header terminating with the packet type (it ignores the rest of the * header), so we use a quick hack to achieve this. */ result = hfa384x_copy_from_bap(hw, rxfid, HFA384x_RX_DATA_OFF, nic->packet + ETH_HLEN - sizeof(wlan_80211hdr_t), nic->packetlen); if ( result ) { return 0; /* fail */ } } return 1; /* Packet successfully received */ }