the Cypress EZ-USB firmware download, shared with the kernel
An EZ-USB (AN21xx, FX, FX2) enumerates with its on-chip loader alone; its firmware goes into RAM over vendor requests and runs once the CPU's reset bit is released, whereupon the firmware re-enumerates the device under its own identity. Two requests serve the download: internal (0xa0) is the loader's own and reaches the internal RAM only, external (0xa3) is served by a second stage loader the caller downloads first, and reaches the external RAM. An image is the data records of the vendor's Intel HEX file as the build packs them (embed_file: address (2 bytes, high first), length, data); the caller supplies the images and the poke - the platform's vendor control request - this header the walk and the sequence, which is fxload's.
template<typename chip_t, typename poke_t>
| bool dx::usb::ezusb::load |
( |
const uint8_t * | loader, |
|
|
size_t | loader_size, |
|
|
const uint8_t * | firmware, |
|
|
size_t | firmware_size, |
|
|
poke_t && | poke ) |
the download: poke(request, address, data, length) is the vendor control request to the device; the CPU is held in reset while its internal RAM is written, the second stage loader runs while the firmware's external part goes through it, and the firmware runs at the end - the device then re-enumerates by itself. Without a loader the firmware is written internally alone