Updated usb related issues (markdown)
[librecmc/open-ath9k-htc-firmware.wiki.git] / Overview.md
1 The firmware and source tree are organised in a handful of functional units.
2
3 The overview:
4
5 * There's a simple bootstrap routine in ROM. More information is needed.
6 * There's a bunch of code that sits in ROM. This is primarily to save space in RAM/flash. Currently this is the bootstrap, some common OS routines, the HIF/USB interface glue, and a bunch of other stuff I haven't really gone digging into just yet.
7 * The main firmware sits in RAM and is loaded during USB host attach.
8
9 Now, the firmware is broken up into a few specific chunks:
10
11 * There's the athos/xtos runtime, which is a simple executive providing a single-threaded execution environment for the firmware. There's interrupt handling and some basic primitives.
12 * There's the USB/HTC target code, which provides a USB implementation of the Atheros transport-independent communication layer. The host creates a few HTC channels to the firmware for control, register access, TX and RX services.
13 * There's the wlan code, which is a very simple cut down version of ye olde familiar ath/hal driver code from Madwifi. (Seriously. Go look at it.)
14
15 The wifi code is pretty simple:
16
17 * There's the TX and RX descriptor handling code from the Ar5416 HAL - TX and RX is done by handling the receive/transmit interrupt locally, parsing the descriptors and then gluing that to the relevant HTC channel.
18 * There's the interrupt handling code (again from the AR5416 HAL) - for general interrupt handling services. Anything that's not handled locally is pushed up to the host device.
19 * The RX side looks a lot like the madwifi ath RX loop - it reads descriptors, pushes them into the RX HTC channel, then pushes more buffers to the hardware.
20 * The TX side is more complicated - the TX side implements rate control and software retransmission of frames when doing 802.11n aggregation.
21
22 Ok, so where's this all live:
23
24 * target_firmware/wlan - is the wlan side of things. It's a very cut down version of the madwifi device attach, TX, RX, rate control, interrupt handling and software transmit code.
25 * if_owl.c has the software retransmit and software queue handling code.
26 * target_firmware/magpie_fw_dev/ - has all of the non-wifi stuff. So, athos/xtos lives here, the USB HTC/WMI handling code and build interface.