This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
resources:tools-software:linux-drivers:sound:sigma [09 Nov 2011 14:19] – Approved Lars-Peter Clausen | resources:tools-software:linux-drivers:sound:sigma [01 Aug 2012 17:30] (current) – Approved Lars-Peter Clausen | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Firmware Loader for SigmaDSPs ====== | + | ~~GOTO>resources/tools-software/linux-software/sigmadsp_genfirmware? |
- | + | ||
- | Parts that include the [[adi>sigmadsp|SigmaDSP]] processor can be loaded with arbitrary code that is generated by [[adi>en/embedded-processing-dsp/ | + | |
- | + | ||
- | <note warning> | + | |
- | + | ||
- | ===== Helper Functions ===== | + | |
- | + | ||
- | You should only need to invoke one function in order to load a binary blob: | + | |
- | <code c>extern int process_sigma_firmware(struct i2c_client *client, const char *name);</ | + | |
- | + | ||
- | You pass the I2C client of the connected SigmaDSP and the name of the firmware blob to load (which normally corresponds to the '' | + | |
- | + | ||
- | ===== Firmware Blob Format ===== | + | |
- | + | ||
- | The XML format allows multiple '' | + | |
- | + | ||
- | Every firmware blob has a header which includes a magic string, version format identifier, and crc: | + | |
- | <source trunk/ | + | |
- | + | ||
- | Then there are an arbitrary number of actions (which correspond to the '' | + | |
- | <source trunk/include/ | + | |
- | + | ||
- | The '' | + | |
- | <source trunk/ | + | |
- | + | ||
- | The '' | + | |
- | <source trunk/ | + | |
- | + | ||
- | The '' | + | |
- | + | ||
- | Each action must be padded to 16bits so that the structure can easily be read directly from the file without having to worry about unaligned issues. | + | |
- | <source trunk/ | + | |
- | + | ||
- | ===== XML -> Firmware Blob ===== | + | |
- | + | ||
- | While the typical output of SigmaStudio is an XML file, processing this on the board would force a lot of ugly overhead. | + | |
- | + | ||
- | < | + | |
- | # | + | |
- | set -e | + | |
- | + | ||
- | err() { echo " | + | |
- | + | ||
- | unset end | + | |
- | + | ||
- | export \ | + | |
- | INSTR_writexbytes=0 \ | + | |
- | INSTR_writesingle=1 \ | + | |
- | INSTR_writesafeload=2 \ | + | |
- | INSTR_delay=3 \ | + | |
- | INSTR_pllwait=4 \ | + | |
- | INSTR_noop=5 \ | + | |
- | INSTR_end=6 | + | |
- | + | ||
- | awk 'BEGIN { | + | |
- | printf " | + | |
- | printf " | + | |
- | }' | + | |
- | + | ||
- | xml sel -t -c ROM/ | + | |
- | perl -p -e ' | + | |
- | sed \ | + | |
- | -e ' | + | |
- | -e ' | + | |
- | -e ' | + | |
- | -e ' | + | |
- | -e ' | + | |
- | sed -e 's: *> | + | |
- | tr ' | + | |
- | while read line ; do | + | |
- | if [ " | + | |
- | err " | + | |
- | exit 1 | + | |
- | fi | + | |
- | + | ||
- | unset instr len addr data | + | |
- | eval $line | + | |
- | export instr len addr data | + | |
- | data=$(set -- ${data}; echo ${@/#/ | + | |
- | rlen=${len: | + | |
- | + | ||
- | case $instr in | + | |
- | writexbytes);; | + | |
- | writesingle) len=3;; | + | |
- | writesafeload);; | + | |
- | delay) len=$(printf ' | + | |
- | pllwait|noop) err " | + | |
- | end) end=true; continue;; | + | |
- | esac | + | |
- | + | ||
- | instr=" | + | |
- | err "LINE: $line {inst: | + | |
- | + | ||
- | #struct sigma_action { | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | #}; | + | |
- | + | ||
- | # awk ' | + | |
- | php -B " | + | |
- | printf(' | + | |
- | printf(' | + | |
- | printf(' | + | |
- | printf(' | + | |
- | printf(' | + | |
- | printf(' | + | |
- | \$a = explode(' | + | |
- | if (!(count(\$a) == 1 && \$a[0] == '' | + | |
- | foreach (\$a as \$d) { printf(' | + | |
- | if (count(\$a) % 2 == 1) printf(' | + | |
- | } | + | |
- | " </ | + | |
- | done | + | |
- | </ | + |