/* Do not modify this file. Report bugs or desired changes to: Steve Pier University of California, Irvine pier@nucleus.ps.uci.edu 714-824-3162 */ /* eboot.h include file common to eboot.c and dsp_init.c */ /*** DO NOT CHANGE THIS FILE. *** *** Boot code in the DSP's EEPROM uses this file. ***/ /* 16 words at the beginning of the DPRAM are reserved for the boot ROM's use. */ /* DSP boot states (written by DSP) */ #define DBS_RESETTING (0) /* DSP has not finished resetting; DBS_RESETTING must be 0 */ #define DBS_INITIALIZING (1) /* DSP is initializing boot structure */ #define DBS_READY (2) /* ready to start download */ #define DBS_DOWNLOADING (3) /* download has begun */ #define DBS_DOWNLOAD_OK (4) /* the downloaded code is running */ #define ERR_FIRST_WORD (0xA0) /* these error codes may appear in dsp_bstate */ #define ERR_PAGE_FAILED (0xA1) #define ERR_BLK_SIZE (0xA2) #define ERR_BLK_DEST (0xA3) /* host boot states (written by host) */ #define HBS_RESETTING (0xf00ba123) /* forces delay of start of boot */ #define HBS_IDLE (0) /* HBS_IDLE must be 0 */ #define HBS_READY (0x0ad00dad) /* causes DSP to proceed with boot */ #define PAGE_SIZE (512) /* number of int32's in a page */ #define HAND_HI (0xff) /* legal handshake values for req and ack */ #define HAND_LO (0) /* This structure is in the VME card's dual-port RAM. Members of this structure are written by the DSP unless noted otherwise. ! The first member of boot_dpr must be host_bstate ! ! The second member of boot_dpr must be boots ! */ struct boot_dpr { int32 host_bstate; /* host boot state, written by host */ int32 boots; /* number of boots (set to 0 by host) */ int32 rom_rev; /* boot ROM revision number */ int32 dip_switches; /* ddddvvvvvvvv, d = DSP's dip switch, v = VME card's dip switch */ int32 dsp_bstate; /* DSP boot state */ int32 req, ack; /* handshake flags, ack is written by host */ int32 lo_mem, hi_mem; /* external ram available during boot */ int32 words_read; /* words of system downloaded so far */ int32 ram_loops, ram_errors; /* memory test information */ int32 dummy [ 4 ]; /* fill in unused words to make 16 total */ int32 zero[ 8 ]; /* zeroes (used by messaging system) */ int32 page[ PAGE_SIZE ]; /* block through which system code is transferred */ }; /* The meaning of some words used in this and related files: The word 'host' refers to the CPU that is in communication with the DSP. This CPU may be a VME card, a MacIntosh, or other computer that has access to the VMEbus. The word 'page' refers to the units into which the system file is divided as it is sent to the DSP. The system file is too big to be sent through the DSP's dual-port RAM all at once, so it is divided into pages. (The system file is converted to binary before being divided into pages and sent through the DPRAM.) The word 'block' refers to the data blocks described in "Format of System File" below. These are the blocks recognized by the 320C31's boot loader as well as the system loader coded in eboot.c. The word 'download' refers to the process of loading the DSP's operating system into the DSP's memory. The operating system is stored in an ASCII file on the host's file system. The function init_dsps() (in dsp_init.c) reads in this file, converts it to binary, and sends it to the DSP. The DSP loads it into RAM in the same way the the 320C31's built-in bootloader loads code from ROM. In fact, the system file, once converted to binary, is in the format used by the built-in bootloader. */ /* The boot process as seen by the VME host: The VME host sets host_bstate to HBS_RESETTING. The VME host resets the DSP. The VME host zeroes all of the DPRAM except host_bstate. The VME host sets dsp_bstate to DBS_RESETTING. The VME host sets host_bstate to HBS_IDLE, allowing DSP RAM tests to proceed. The VME host waits until dsp_bstate is DBS_READY. The VME host sets host_bstate to HBS_READY. When dsp_bstate is DBS_DOWNLOADING, downloading begins. The boot process as seen by the DSP: The DSP is reset (by the host or on power-up). The DSP waits if host_bstate is HBS_RESETTING (unlikely at power-up). The DSP sets dsp_bstate to DBS_INITIALIZING. The DSP initializes its hardware and the boot structure. The DSP sets dsp_bstate to DBS_READY. The DSP starts the download if host_bstate is HBS_READY. If host_bstate is not HBS_READY, the DSP runs one loop of a RAM test. If host_bstate is HBS_READY, downloading begins. The download process as seen by the VME host: If req is true, the host reads one page of code into the DPRAM. It then sets ack true and waits for req to go false. It then sets ack false. The host checks for a variety of errors. The download process as seen by the DSP: The DSP sets dsp_bstate to DBS_DOWNLOADING. The DSP calls get_word() repeatedly until all code is loaded. get_word() calls get_page() as necessary. get_page() handshakes with the host as necessary. If the DSP detect errors, it reports them in dsp_bstate and halts. If there are no errors, the DSP sets dsp_bstate to DBS_DOWNLOAD_OK. The DSP turns on all DSP LED's and transfers control to the downloaded code. The req/ack handshake: req is controlled by the DSP ack is controlled by the host req: ________~~~~~~~~~~~~~~~~~~~~~~~~_________________~~~~~~~~~~~ ack: _____________________________~~~~~__________________________ - host -|--- host copies ---| |-- DSP loads --|- next --> waits page to DPRAM page into RAM handshake for req */ /* Format of System File: The system is stored in an ASCII file. This file is the output of the hex30 program (by Texas Instruments). The hex30 program is instructed to output an ascii (-a option) file of bootable code. The resulting file starts with a ctrl-B (02h), continues with hex data bytes separated by white space, and ends with a ctrl-C (03h): ^B XX XX XX XX XX XX ... XX ^C XX represents a hex byte. A group of four hex bytes represents a 32-bit word, with the MSB first: 33 22 11 00 represents the 32-bit hex number 0x33221100. The 32-bit numbers are in exactly the 32-bit format used by the 320C31's built-in boot loader (not to be confused with the code in the file eboot.h). The format is detailed in the TMS320C3x User's Guide. A brief description: word value comments ---- ---------- ---------------------------------------------------- 0 0x00000020 memory width (always = 32) 1 -- ignored by eboot.c 2 size1 size of first data block 3 dest1 destination (address in memory) for first data block . data data words (total of size1) . data . ... . size2 size of second data block . dest2 destination for second data block . data data words (total of size2) . data . ... . sizeN size of last data block . destN destination for last data block . data data words (total of sizeN) . data . ... . 0x00000000 size == 0 indicates no more data blocks Execution will begin at dest1 (the beginning of the first data block). The DSP is passed only the binary version of this data. I.e., the host reads the ASCII file and sends the binary equivalent to the DSP during the system download process. */