Subject: acx(4) : acx100
To: M. Warner Losh <imp@bsdimp.com>
From: Sam Thigpen <sthigpen@sdf.lonestar.org>
List: tech-kern
Date: 02/16/2004 00:16:30
My DWL-520+ PCI works with the FreeBSD 5.2 acx100 module as reported.  I know this is
probably duplicating some work somewhere, but oh well, I am in the process of lining
up some of the functions.

The file bin2h.c converts all the windows chipset code for acx100
to 4 files (corresponding to the uppercase names) each containing an array
of 32-bit integers stored as hexidecimals (const u_int32_t
(includename)_code [] { 0xea001f9c,0xeafffffe,0xeafffffe,0xeafffffe, .. }

http://sthigpen.freeshell.org/netbsd/acx/radio0d.h
http://sthigpen.freeshell.org/netbsd/acx/radio11.h
http://sthigpen.freeshell.org/netbsd/acx/radio15.h
http://sthigpen.freeshell.org/netbsd/acx/wlangen.h

This windows code is from:

ftp://ftp.dlink.co.uk/wireless/dwl-g650+/dwl-g650+_drv_v1.0.zip
ftp://ftp.dlink.co.uk/wireless/dwl-650+/dwl-650+_drv_v3.06_1007_inc_utility.zip

and this does work with the PCI DWL-520+.

as per the discussion earlier, the Intel Prism code does provide some
form of template:

---------------------------------------------------------------------------
NetBSD Intel Prism Functions:

sys/dev/ic/wi.c
functions:
static int  wi_init(struct ifnet *);
static void wi_stop(struct ifnet *, int);
static void wi_start(struct ifnet *);
static int  wi_reset(struct wi_softc *);
static void wi_watchdog(struct ifnet *);
static int  wi_ioctl(struct ifnet *, u_long, caddr_t);
static int  wi_media_change(struct ifnet *);
static void wi_media_status(struct ifnet *, struct ifmediareq *);

static struct ieee80211_node *wi_node_alloc(struct ieee80211com *);
static void wi_node_copy(struct ieee80211com *, struct ieee80211_node *, const struct ieee80211_node *);
static void wi_node_free(struct ieee80211com *, struct ieee80211_node *);

static void wi_raise_rate(struct ieee80211com *, struct ieee80211_rssdesc *);
static void wi_lower_rate(struct ieee80211com *, struct ieee80211_rssdesc *);
static void wi_choose_rate(struct ieee80211com *, struct ieee80211_node *, struct ieee80211_frame *, u_int);
static void wi_rssadapt_updatestats_cb(void *, struct ieee80211_node *);
static void wi_rssadapt_updatestats(void *);

static void wi_rx_intr(struct wi_softc *);
static void wi_txalloc_intr(struct wi_softc *);
static void wi_tx_intr(struct wi_softc *);
static void wi_tx_ex_intr(struct wi_softc *);
static void wi_info_intr(struct wi_softc *);

static int  wi_get_cfg(struct ifnet *, u_long, caddr_t);
static int  wi_set_cfg(struct ifnet *, u_long, caddr_t);
static int  wi_cfg_txrate(struct wi_softc *);
static int  wi_write_txrate(struct wi_softc *, int);
static int  wi_write_wep(struct wi_softc *);
static int  wi_write_multi(struct wi_softc *);
static int  wi_alloc_fid(struct wi_softc *, int, int *);
static void wi_read_nicid(struct wi_softc *);
static int  wi_write_ssid(struct wi_softc *, int, u_int8_t *, int);

static int  wi_cmd(struct wi_softc *, int, int, int, int);
static int  wi_seek_bap(struct wi_softc *, int, int);
static int  wi_read_bap(struct wi_softc *, int, int, void *, int);
static int  wi_write_bap(struct wi_softc *, int, int, void *, int);
static int  wi_mwrite_bap(struct wi_softc *, int, int, struct mbuf *, int);
static int  wi_read_rid(struct wi_softc *, int, void *, int *);
static int  wi_write_rid(struct wi_softc *, int, void *, int);

static int  wi_newstate(struct ieee80211com *, enum ieee80211_state, int);
static int  wi_set_tim(struct ieee80211com *, int, int);

static int  wi_scan_ap(struct wi_softc *, u_int16_t, u_int16_t);
static void wi_scan_result(struct wi_softc *, int, int);

static void wi_dump_pkt(struct wi_frame *, struct ieee80211_node *, int rssi);

---------------------------------------------------------------------------

includes:
sys/dev/ic/wi_ieee.h
sys/dev/ic/wireg.h

sys/dev/ic/wivar.h
functions:
int     wi_attach(struct wi_softc *);
int     wi_detach(struct wi_softc *);
int     wi_activate(struct device *, enum devact);
int     wi_intr(void *arg);
void    wi_power(struct wi_softc *, int);
void    wi_shutdown(struct wi_softc *);

---------------------------------------------------------------------------

sys/dev/pci/if_wi_pci.c
functions:
static int      wi_pci_match __P((struct device *, struct cfdata *, void *));
static void     wi_pci_attach __P((struct device *, struct device *, void *));
static int      wi_pci_enable __P((struct wi_softc *));
static void     wi_pci_disable __P((struct wi_softc *));
static void     wi_pci_reset __P((struct wi_softc *));
static void     wi_pci_powerhook __P((int, void *));

static const struct wi_pci_product
        *wi_pci_lookup __P((struct pci_attach_args *));

---------------------------------------------------------------------------
FreeBSD acx100 functions:

if_acx.c:
int acx_attach(struct acx_softc *sc)
void acx_detach(struct acx_softc *sc)
void acx_interrupt(void *scarg)

if_acxcmd.c:
void acx_cmd_init(struct acx_softc *sc)
void acx_cmd_end(struct acx_softc *sc)
inline void acx_cmd_access(struct acx_softc *sc)
inline void acx_cmd_upload(struct acx_softc *sc, u_int32_t offset)
inline void acx_cmd_info(struct acx_softc *sc)
void acx_cmd_get_info(struct acx_softc *sc, u_int16_t *cmd_type, u_int16_t
*cmd_status, const char **cmd_status_string)
void acx_cmd_set_type(struct acx_softc *sc, u_int16_t cmd_type)
void cmd_set_status(struct acx_softc *sc, u_int16_t cmd_status)
inline void acx_cmd_get_result(struct acx_softc *sc, struct acx_cmd_entry *cmd)
void acx_cmd_run(struct acx_softc *sc)
int acx_cmd_upload_firmware(struct acx_softc *sc, struct acx_dev_firmware *fw, u_int32_t offset)
struct acx_cmd_entry *
acx_cmd_create(struct acx_softc *sc, u_int16_t command_type, void *callback_func, u_int16_t param_length)
void acx_cmd_start(struct acx_softc *sc, struct acx_cmd_entry *cmd)
void acx_cmd_task_exec(struct acx_softc *sc, int count)
void acx_cmd_complete(struct acx_softc *sc, struct acx_cmd_entry *cmd)

void acx_cmd_task_irq(struct acx_softc *sc, int count)
void acx_cmd_issue(struct acx_softc *sc, struct acx_cmd_entry *cmd)
void acx_cmd_set_timer(struct acx_softc *sc)
void acx_cmd_set_memory_map(struct acx_softc *sc, struct acx_cmd_memory_map_param *memory_map)
void acx_cmd_set_wep_options(struct acx_softc *sc, u_int8_t mode)
void acx_cmd_set_current_cca_mode(struct acx_softc *sc, u_int8_t mode)
void acx_cmd_set_ed_threshold(struct acx_softc *sc, u_int8_t threshold)
void acx_cmd_set_current_reg_domain(struct acx_softc *sc, u_int8_t domain)
void acx_cmd_set_current_antenna(struct acx_softc *sc, u_int8_t select)
void acx_cmd_set_ssid(struct acx_softc *sc, char *nwid)
void acx_cmd_set_rx_config(struct acx_softc *sc, u_int32_t options)
void acx_cmd_set_queue_config(struct acx_softc *sc, struct  acx_cmd_queue_config_param *queue_config)
void acx_cmd_set_memory_config_options(struct acx_softc *sc, struct
acx_cmd_memory_config_options_param *memory_options)
void acx_cmd_set_block_size(struct acx_softc *sc, u_int16_t block_size)
void acx_cmd_set_max_xmit_msdu_lifetime(struct acx_softc *sc, u_int32_t lifetime)
void acx_cmd_set_short_retry_limit(struct acx_softc *sc, u_int8_t limit)
void acx_cmd_set_long_retry_limit(struct acx_softc *sc, u_int8_t limit)
void acx_cmd_set_wep_tx_key(struct acx_softc *sc, u_int8_t txkey)
void acx_cmd_set_wep_key(struct acx_softc *sc, u_int8_t index)
void acx_cmd_get_memory_map(struct acx_softc *sc, struct acx_cmd_memory_map_param *memory_map)
void acx_cmd_get_current_cca_mode(struct acx_softc *sc, u_int8_t *mode)
void acx_cmd_get_ed_threshold(struct acx_softc *sc, u_int8_t *threshold)
void acx_cmd_get_current_antenna(struct acx_softc *sc, u_int8_t *select)

void acx_cmd_get_rx_config(struct acx_softc *sc, u_int32_t *options)
void acx_cmd_get_max_xmit_msdu_lifetime(struct acx_softc *sc, u_int32_t *lifetime)
void acx_cmd_get_short_retry_limit(struct acx_softc *sc, u_int8_t *limit)
void acx_cmd_get_long_retry_limit(struct acx_softc *sc, u_int8_t *limit)
void acx_cmd_get_fwrev(struct acx_softc *sc)
void acx_cmd_get_station_id(struct acx_softc *sc)
void acx_cmd_sleep(struct acx_softc *sc)
void acx_cmd_wake(struct acx_softc *sc)
void acx_cmd_init_memory(struct acx_softc *sc)

void acx_cmd_join_nb(struct acx_softc *sc, u_int8_t macmode)
void acx_cmd_scan(struct acx_softc *sc)
void acx_cmd_stop_scan(struct acx_softc *sc)
void acx_cmd_enable_rx_nb(struct acx_softc *sc, u_int8_t channel)
void acx_cmd_disable_rx(struct acx_softc *sc)
void acx_cmd_enable_tx_nb(struct acx_softc *sc, u_int8_t channel)
void acx_cmd_disable_tx(struct acx_softc *sc)
void acx_cmd_radioinit(struct acx_softc *sc, u_int32_t radio_offset, u_int32_t radio_size)
void acx_cmd_config_beacon(struct acx_softc *sc, u_int8_t *packet, int size)
void acx_cmd_config_tim(struct acx_softc *sc, u_int8_t *packet, int size)
void acx_cmd_config_probe_response(struct acx_softc *sc, u_int8_t *packet, int size)
void acx_cmd_config_probe_request(struct acx_softc *sc, u_int8_t *packet, int size)
void acx_cmd_reset(struct acx_softc *sc)
void acx_cmd_generic_callback(struct acx_softc *sc, struct acx_cmd_entry *cmd)
void acx_cmd_get_rx_config(struct acx_softc *sc, u_int32_t *options)
void acx_cmd_generic_callback(struct acx_softc *sc, struct acx_cmd_entry *cmd)

if_acxdebug.c:
void acx_debug_dump(struct acx_softc *sc, struct acx_resource *mem, u_int32_t start, u_int32_t end)
void acx_debug_dump_memory_map(struct acx_softc *sc, struct acx_cmd_memory_map_param *map)
void acx_debug_dump_queue_config(struct acx_softc *sc, struct
acx_cmd_queue_config_param *config)
void acx_debug_dump_memory_options(struct acx_softc *sc, struct
acx_cmd_memory_config_options_param *options)
void acx_debug_packet(struct acx_softc *sc, const char *label, struct acx_packet_tiheader *tiheader,
    struct ieee80211_frame *frame)
int acx_debug_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)

if_acxdev.c:
int acx_dev_attach(struct acx_softc *sc)
void acx_dev_power_led_on(struct acx_softc *sc)
void acx_dev_irq_on(struct acx_softc *sc)
void acx_dev_irq_off(struct acx_softc *sc)
void acx_dev_init(struct acx_softc *sc)
void acx_dev_end(struct acx_softc *sc)
void acx_dev_set_power_level(struct acx_softc *sc, u_int8_t power_level)

if_acxeeprom.c:
void acx_eeprom_init_domain(struct acx_softc *sc)
inline u_int16_t acx_eeprom_read(struct acx_softc *sc, u_int16_t address)
void acx_eeprom_init(struct acx_softc *sc)
void acx_ifnet_attach(struct acx_softc *sc)
void acx_ifnet_detach(struct acx_softc *sc)
void acx_ifnet_start_scan(struct ifnet *ifp)
void acx_ifnet_callout_next_scan(void *arg)
int acx_ifnet_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
void acx_ifnet_setrates(struct ieee80211com *ic)
void acx_ifnet_setchannels(struct ieee80211com *ic, u_int8_t low, u_int8_t high)
void acx_ifnet_init(void *arg)
void acx_ifnet_up(struct ifnet *ifp)
void acx_ifnet_down(struct ifnet *ifp)
int acx_ifnet_newstate(struct ieee80211com *ic, enum ieee80211_state newstate, int arg)

if_acxifnet.c:
void acx_ifnet_attach(struct acx_softc *sc)
void acx_ifnet_detach(struct acx_softc *sc)
void acx_ifnet_start_scan(struct ifnet *ifp)
void acx_ifnet_callout_next_scan(void *arg)
int acx_ifnet_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
void acx_ifnet_setrates(struct ieee80211com *ic)
void acx_ifnet_setchannels(struct ieee80211com *ic, u_int8_t low, u_int8_t high)
void acx_ifnet_init(void *arg)
void acx_ifnet_up(struct ifnet *ifp)
void acx_ifnet_down(struct ifnet *ifp)
int acx_ifnet_newstate(struct ieee80211com *ic, enum ieee80211_state newstate, int arg)

if_acxpacket.c:
int acx_packet_attach(struct acx_softc *sc)
void acx_packet_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error)
void acx_packet_detach(struct acx_softc *sc)
int acx_packet_init(struct acx_softc *sc)
int acx_packet_init_rxdesc(struct acx_softc *sc)
void acx_packet_init_firmware_rxdesc(struct acx_softc *sc)
int acx_packet_new_mbuf(struct acx_softc *sc, u_int8_t **paddr, struct acx_packet_bufmap *bufmap)
void acx_packet_map_mbuf(void *arg, bus_dma_segment_t *segs, int nseg, bus_size_t mapsize, int error)
int acx_packet_new_buf(struct acx_softc *sc, u_int8_t **paddr, struct acx_packet_bufmap *bufmap)
void acx_packet_delete_bufmap(struct acx_softc *sc, struct acx_packet_bufmap *bufmap)
void acx_packet_delete_bufmaps(struct acx_softc *sc, struct acx_packet_bufmap *bufmap)
int acx_packet_init_txdesc(struct acx_softc *sc)
void acx_packet_init_firmware_txdesc(struct acx_softc *sc)
inline void acx_packet_rxstats(struct acx_softc *sc, struct acx_packet_tiheader *tiheader)
void acx_packet_task_rx(struct acx_softc *sc, int count)
u_int16_t acx_packet_txnext(struct acx_softc *sc)
void acx_packet_tx(struct ifnet *ifp)
void acx_packet_txrate_reset(struct acx_softc *sc)
void acx_packet_txrate(struct acx_softc *sc, int packetcount, int errorcount)
void acx_packet_task_tx(struct acx_softc *sc, int count)
void acx_packet_watchdog(struct ifnet *ifp)

if_acxpci.c:
int acx_pci_probe(device_t dev)
static int acx_pci_attach(device_t dev)
static int acx_pci_attach_acx100(struct acx_softc *sc)
static int acx_pci_detach(device_t dev)
static int acx_pci_detach_acx100(struct acx_softc *sc)
static int acx_pci_detach_acx111(struct acx_softc *sc)
static int acx_pci_shutdown(device_t dev)
static int acx_pci_suspend(device_t dev)
static int acx_pci_resume(device_t dev)

if_acxreg.c:
inline u_int8_t READB( struct acx_resource *mem, u_int16_t reg)
inline void WRITEB( struct acx_resource *mem, u_int16_t reg, u_int8_t value)
inline u_int16_t READW( struct acx_resource *mem, u_int16_t reg)
inline void WRITEW( struct acx_resource *mem, u_int16_t reg, u_int16_t value)
inline u_int32_t READL( struct acx_resource *mem, u_int32_t reg)
inline void WRITEL( struct acx_resource *mem, u_int16_t reg, u_int32_t value)

if_acxsysctl.c:

if_acxtemplate.c:
void acx_template_init(struct acx_softc *sc)
void acx_template_set_tim(struct acx_softc *sc)
void acx_template_set_beacon(struct acx_softc *sc)
void acx_template_set_probe_response(struct acx_softc *sc)
int acx_template_get_beacon(struct acx_softc *sc, u_int8_t *beacon, u_int8_t subtype)

if_acxwep.c
void acx_wep_init(struct acx_softc *sc)

includes:

if_acx.h
if_acx_proto.h
if_acxcmd.h
if_acxcmd_proto.h
if_acxdebug.h
if_acxdebug_proto.h
if_acxdev.h
if_acxdev_proto.h
if_acxeeprom.h
if_acxeeprom_proto.h
if_acxifnet.h
if_acxifnet_proto.h
if_acxpacket.h
if_acxpacket_proto.h
if_acxpci.h
if_acxpci_proto.h
if_acxreg.h
if_acxreg_proto.h
if_acxsys.h
if_acxsysctl.h
if_acxsysctl_proto.h
if_acxtemplate.h
if_acxtemplate_proto.h
if_acxwep.h
if_acxwep_proto.h


*Any* skeleton wireless code would be appreciated.

Sam.

--------------------------------------------------
SA Thigpen * KL1FE * http://sthigpen.freeshell.org
--------------------------------------------------