Summary of DSP56k

  • Page 1

    The dsp56k mp3 player user’s manual raymond jimenez june 8, 2011.

  • Page 2

    Ii.

  • Page 3

    Introduction congratulations! You’re the new owner of a dsp56k-based mp3 player. This unit was designed by raymond jimenez personally, with emphasis in mind on: • audiophile-quality playback • expandibility • usability to get started, please flip to the quick start guide on page 3, which guides you ...

  • Page 4

    Iv introduction.

  • Page 5

    Contents introduction iii i quick start guide 1 1 quick start guide 3 ii user guide 7 2 basic usage 9 2.1 the display . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2 playing songs . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.3 volume control . . . . . . . . . . . . . . . ...

  • Page 6

    Vi contents 4.5 ide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4.6 dram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 5 memory map and registers 23 6 timing 27 6.1 timing targets . . . . . . . . . . . . . . . . . . . . . . . . . . 27 6.1.1 sram . . . . . . ...

  • Page 7

    Contents vii 9 release notes/errata 241 9.1 known bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 9.2 known limitations . . . . . . . . . . . . . . . . . . . . . . . . 242.

  • Page 8

    Viii contents.

  • Page 9

    List of figures 1.1 main mp3 playback unit . . . . . . . . . . . . . . . . . . . . 4 1.2 mp3 player’s keypad . . . . . . . . . . . . . . . . . . . . . . . 5 1.3 lcd display unit . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.1 typical appearance of the lcd display . . . . . . . . . . . . 9 4....

  • Page 10

    X list of figures.

  • Page 11

    List of tables 4.1 dac startup mode . . . . . . . . . . . . . . . . . . . . . . . . 18 xi.

  • Page 12

    Xii list of tables.

  • Page 13

    Part i quick start guide 1.

  • Page 15

    Chapter 1 quick start guide your dsp56k mp3 player comes complete with one mp3 hard drive, one main playback unit (fig 1.1), one keypad (fig 1.2), one display unit (fig 1.3), and one power supply. In order to play mp3s from the hard drive, connect the main playback unit to the keypad, display, and h...

  • Page 16

    4 chapter 1. Quick start guide figure 1.1: main mp3 playback unit.

  • Page 17

    5 figure 1.2: mp3 player’s keypad.

  • Page 18

    6 chapter 1. Quick start guide figure 1.3: lcd display unit.

  • Page 19

    Part ii user guide 7.

  • Page 21

    Chapter 2 basic usage 2.1 the display this mp3 player comes with one main display unit, a 2x40 character liquid- crystal display (lcd). At all times, the display reflects the status of the unit, in addition to its current operation and song (fig 2.1). 1. Song title: the currently playing song or fol...

  • Page 22

    10 chapter 2. Basic usage 4. Status: this indicates the unit’s current status, and will be one of “play” ”stop” “rev” “ffwd” or “err”. An appropriate icon will also be displayed. 5. Volume: this indicates the current volume setting, in terms of atten- uation. 0db means the unit is at the maximum vol...

  • Page 23

    Chapter 3 advanced features 3.1 adding songs to add songs, power down the mp3 player, detach the included hard drive and attach it to your own computer, via the included usb adaptor. Please note that we currently only support windows computers for adding songs. To continue, open a run prompt and typ...

  • Page 24

    12 chapter 3. Advanced features 3.2 playing non-mp3 files due to the nature of our player, non-mp3 files are no different than mp3 files. In order to add a non-mp3 file, follow the steps above and the song should appear normally, available for play. When adding the non-mp3 files, keep in mind: • if ...

  • Page 25

    Part iii developer documentation 13.

  • Page 27

    Chapter 4 system overview 4.1 introduction to architecture a general overview of the system’s architecture can be seen from figure 4.1. Since our main purpose is to play music, not to act as a multipurpose appliance, we can make several assumptions: 1. Data should take the shortest path from the har...

  • Page 28

    16 chapter 4. System overview figure 4.1: overall system block diagram when the mp3 decoder requests more data via an interrupt, we begin sending it data via a serial port, which is handled via dma. We then begin manually fetching data in a polling loop from the hard drive, as before, to fill anothe...

  • Page 29

    4.3. Mp3 decoder 17 figure 4.2: main board components.

  • Page 30

    18 chapter 4. System overview parameter value upsampling rate 96khz input word length 16-bit digital filter response 3 attenuation -27db volume ramp on mclk auto detect anti-clip mode on table 4.1: dac startup mode of board space. 4.4 dac/analog stage the dac and analog stage have been optimized for...

  • Page 31

    4.5. Ide 19 our mp3 decoder’s maximum i 2 s output is 96khz, 16-bit stereo with a 12.288mhz master clock (mclk = 128fs), so the input parameters were set accordingly. The digital filter was set for the best sound (response 3 is a minimum-phase, slow-rolloff filter, the same as the γ2’s “filter b”). ...

  • Page 32

    20 chapter 4. System overview figure 4.3: dram block diagram.

  • Page 33

    4.6. Dram 21 8. Deassert cas, ras, both latch oe’s due to the fact that we use ta, the dram timings are specified not in the cpu but by the cpld. For more details, please see the cpld dram code on page 73..

  • Page 34

    22 chapter 4. System overview.

  • Page 35

    Chapter 5 memory map and registers 23.

  • Page 36

    Program space address x space address y space address 0xffffff internal i/o 0xffffff - 0xffff80 internal i/o 0xffffff - 0xffff80 reserved 0xff00c0 bootstrap rom 0xff0000 internal reserved 0xffefff internal reserved 0xffefff 0xff0000 0xff0000 0xd3ffff boot rom (256k x 8 bits) (forced by mode 9) 0xd00...

  • Page 37

    Register value comments hex equiv. Omr register: 1000 0000 0000 1000 0000 1001 - mode 9, most options turned off, no ta synchronization 0x100809 pctl - using 20mhz crystal, we have a multiplication factor of 4. External driven xtal, no division, output 50% clock 0x040003 aa0: 0x100431 (general perip...

  • Page 38

    26 chapter 5. Memory map and registers.

  • Page 39

    Chapter 6 timing there are a number of timing diagrams that we have worked on in order to make sure our circuit works. However, these timing diagrams may not reflect reality due to parasitic effects that we haven’t taken into account; the wait states presented here are simply minimum settings. 6.1 t...

  • Page 40

    -10ns 0ps 10ns 20ns 30ns 40ns 50ns 60ns 70ns 80ns clk o 80mhz address o [18..0] cs o rd o data o [15..0] data sampled o [15..0] tc quart t rc t acsdel t acsdel tc quart t rdw t rdna t aa t oe t acs t oh t rdtoval t ohz.

  • Page 41

    Page 3 sram read, cpu symbol definition description min max nom tc clock period (80mhz) 12.5ns 12.5ns 12.5ns tc quart =eng(nom("tc")/4) 1/4 clock period 3.125ns 3.125ns 3.125ns ws wait states 1 t acsdel address to chip select delay 0ps 0ps 1ns t ohz rd deassertion to data not valid (data hold time) ...

  • Page 42

    Page 4 sram read, sram symbol definition description min max nom t aa address access time 15ns t acs chip select access time 15ns t oe output enable low to output valid 7ns t oh output hold from address change 4ns.

  • Page 43

    -40ns -20ns 0ps 20ns 40ns 60ns clk o 80mhz address o [15..0] cs o wr o data out o [15..0] tc quart t rc t acsdel t acsdel t as t wp t wr t ds t dh t wc t aw t cw t wp t dw.

  • Page 44

    Page 3 sram write, cpu symbol definition description min max nom tc clock period (80mhz) 12.5ns 12.5ns 12.5ns tc quart =eng(nom("tc")/4) quarter-clock period 3.125ns 3.125ns 3.125ns t rc =eng((nom("ws") + 1) * nom("tc")-4000) address valid 33.5ns 33.5ns 33.5ns ws wait states 2 t acsdel address to ch...

  • Page 45

    Page 4 sram write, sram symbol definition description min max nom t wc write cycle time 15ns t aw address valid to end of write 10ns t cw chip select low to end of 10ns t wp write pulse width 10ns t dw data valid to end of write 7ns.

  • Page 46

    34 chapter 6. Timing 6.1.2 rom.

  • Page 47

    -40ns -20ns 0ps 20ns 40ns 60ns 80ns 100ns 120ns 140ns 160ns 180ns 200ns 220ns clk o 80mhz address o [18..0] cs o rd o data o [15..0] data sampled o [15..0] tc quart t rc t acsdel t acsdel tc quart t rdw t rdna t ce t oe t acc t oh t rdtoval t ohz.

  • Page 48

    Page 2 rom read, cpu symbol definition description min max nom tc clock period (80mhz) 12.5ns 12.5ns 12.5ns tc quart =eng(nom("tc")/4) 1/4 clock period 3.125ns 3.125ns 3.125ns ws wait states 9 t acsdel address to chip select delay 0ps 0ps 0 t ohz rd deassertion to data not valid (data hold time) 0ns...

  • Page 49

    Page 3 rom read, rom symbol definition description min max nom t acc address to output delay 120ns t ce chip select access time 120ns t oe output enable low to output valid 50ns t oh output hold from address change 0ns.

  • Page 50

    38 chapter 6. Timing 6.1.3 dram.

  • Page 51

    -20ns 0ps 20ns 40ns 60ns 80ns 100ns 120ns a[0−18] o [15..0] rd o ab[0−18] o [15..0] brd o ras o cas o dram addr o [15..0] dram data o [15..0] db[0−24] to cpu o [15..0] t rc t bdelay t bdelay t rdna t rdw t bdelay t bdelay t cpld−delay t cpld−delay t bdelay t cpld−row t rah t asr t ras t cpld−rc−inte...

  • Page 52

    Page 3 cpu timing symbol definition description min max nom t bdelay general buffer delay 4.1ns t rc address cycle time 108.5ns tc clock period 12.5ns t rdna 117 - rd deassertion to address not valid -13.625ns ws wait states 7 t cpld-delay average cpld gate delay for combinatorials 15ns t cpld-rc-in...

  • Page 53

    Page 4 dram timing - 70ns fpm symbol definition description min max nom t ras ras pulse width 70ns 10000ns t asr row address setup 0 t off data hold time 0ns t rah row address hold 10ns t rac ras to data 70ns t cas cas pulse width 15ns 10000ns t aa column addr to data 35ns t cac cas to data 20ns.

  • Page 54

    -20ns 0ps 20ns 40ns 60ns 80ns 100ns a[0−18] o [15..0] wr o ab[0−18] o [15..0] bwr o ras o cas o dram addr o [15..0] d[0−23] o [15..0] db[0−23] o [15..0] t wc t bdelay t bdelay t wrna t wrw t bdelay t bdelay t cpld−delay t cpld−delay t bdelay t cpld−row t rah t asr t ras t cpld−rc−inter t cpld−column...

  • Page 55

    Page 3 cpu timing symbol definition description min max nom t bdelay general buffer delay 4.1ns t ds data setup time -68.875ns t wc address cycle time 96ns t dh data hold time 13.625ns tc clock period 12.5ns t wrna 103 - wr deassertion to address not valid -11.625ns ws wait states 6 t cpld-delay ave...

  • Page 56

    Page 4 dram timing - 50ns edo symbol definition description min max nom t ras ras pulse width 50ns 10000ns t asr row address setup 0 t rah row address hold 9ns t cas cas pulse width 8ns 10000ns t ds data setup 0ps t cah column address hold 8ns t dh data hold 8ns.

  • Page 57

    6.1. Timing targets 45 6.1.4 ide.

  • Page 58

    -60ns -40ns -20ns 0ps 20ns 40ns 60ns 80ns 100ns 120ns 140ns 160ns 180ns a[0−2] o [15..0] ab[0−2] o [15..0] aar0 o cs o rd o brd o dior o t delay t ad−aar t aar−cs t rc t 1+0 t aar−cs t ad−aar t rdanv t rdw t delay t delay t delay.

  • Page 59

    Page 2 cpu timings symbol definition description min max nom t delay address buffer 4.5ns t ad-aar delay between address bus and aar 0 0 t aar-cs delay between aar and cs (cpld) 15ns tc cpu clock period 12.5ns ws wait states 9 t rdanv rd deassertion to address not valid -54.25ns t rdw rd pulse width...

  • Page 60

    Page 3 ide timings symbol definition description min max nom t 1 address valid to dior/diow setup 25ns t 0 cycle time 120ns t 1+0 minimum address assertion 145ns.

  • Page 61

    6.1. Timing targets 49 6.1.5 dac (via sci) please note that these timings are not actually in effect; we decided to in- terface via essi instead, which is adjustable enough that we were able to directly tune dsp parametrs to fit dac timing..

  • Page 62

    -1us -800ns -600ns -400ns -200ns 0ps 200ns 400ns 600ns 800ns 1us 1.2us 1.4us 1.6us sclk o 1mhz txd o [15..0] t siclk t setup t siids t hold t siids.

  • Page 63

    Page 2 cpu output symbol definition description min max nom tc internal clock 12.5ns 12.5ns t hold hold time after rising edge 243.75ns t sc c serial clock period 1us 1us t setup setup time before falling edge -239.25ns.

  • Page 64

    Page 3 decoder requirements symbol definition description min max nom t siclk clock requirement 960ns t siids data setup time 50ns t siidh data hold time 50ns.

  • Page 65

    6.1. Timing targets 53 6.1.6 mp3 decoder (via sci) please note that these timings are not actually in effect; we decided to in- terface via essi instead, which is adjustable enough that we were able to directly tune dsp parametrs to fit mp3 decoder timing. Additionally, sci did not support dma, so w...

  • Page 66

    -1us -800ns -600ns -400ns -200ns 0ps 200ns 400ns 600ns 800ns 1us 1.2us 1.4us 1.6us sclk o 1mhz txd o [15..0] t siclk t setup t siids t hold t siids.

  • Page 67

    Page 2 cpu output symbol definition description min max nom tc internal clock 12.5ns 12.5ns t hold hold time after rising edge 243.75ns t sc c serial clock period 1us 1us t setup setup time before falling edge -239.25ns.

  • Page 68

    Page 3 decoder requirements symbol definition description min max nom t siclk clock requirement 960ns t siids data setup time 50ns t siidh data hold time 50ns.

  • Page 69

    6.2. Timing simulation (cpld) 57 6.1.7 lcd display please note that there are no current timing diagrams for the lcd display; our current design uses latches and the cpld to interface between the lcd and the rest of the system. 6.2 timing simulation (cpld) for insurance that our cpld design would wo...

  • Page 70

    Z:\cpld\input page 1 of 1 0.0 ns 0.0 ns 200.0 ns 200.0 ns 400.0 ns 400.0 ns 600.0 ns 600.0 ns 800.0 ns 800.0 ns 1,000.0 ns 1,000.0 ns 1,200.0 ns 1,200.0 ns 1,400.0 ns 1,400.0 ns clock aa0 dispcs aa2 bwr brd dwe drefresh bg dras dcas ta dcoll drowl dlatchen resetcpu.

  • Page 71

    Chapter 7 schematics 7.1 prototyping board/cpu 59.

  • Page 72

    1 1 2 2 3 3 4 4 5 5 6 6 d d c c b b a a title number revision size c date: 2011/06/13 sheet of file: z:\documentation\..\56k3.Sch drawn by: v c c p 4 5 v c c q 1 8 v c c q 5 6 v c c q 9 1 v c c q 1 2 6 v c c a 7 4 v c c a 8 0 v c c a 8 6 v c c a 9 5 v c c d 1 0 3 v c c d 1 1 1 v c c d 1 1 9 v c c d ...

  • Page 73

    7.2. Cpld 61 7.2 cpld.

  • Page 74

    1 1 2 2 3 3 4 4 d d c c b b a a title number revision size letter date: 2011/06/13 sheet of file: z:\documentation\..\cpld.Schdoc drawn by: cpld/reset logic 1.0 raymond jimenez 2 7 c1 0.1 uf c2 0.1 uf vcc5 cpu clkout cpu reset v c c 3 g n d 1 reset 2 u2 max809 man. Reset vcc5 3k r3 res1 3k r4 res1 s...

  • Page 75

    7.3. Mp3 decoder daughterboard 63 7.3 mp3 decoder daughterboard.

  • Page 76

    1 1 2 2 3 3 4 4 d d c c b b a a title number revision size letter date: 2011/06/13 sheet of file: z:\documentation\..\mp3daughter.Schdoc drawn by: mp3 decoder daughterboard 1.0 raymond jimenez 3 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 p1 header 17 vcc33 serial out serial in serial clk xcs xdcs x...

  • Page 77

    7.4. Dac/analog out 65 7.4 dac/analog out.

  • Page 78

    1 1 2 2 3 3 4 4 d d c c b b a a title number revision size letter date: 2011/06/13 sheet of file: z:\documentation\..\analogout.Schdoc drawn by: dac/analog output stage 1.0 raymond jimenez 4 7 lrclk/dsdl 1 din/dinl 2 bclk/dsd64clk 3 fsel/dinr 4 mclk 5 diffhw 6 dgnd 7 dvdd 8 avddr 9 agndr 10 vmidr 11...

  • Page 79

    7.5. Display/keypad 67 7.5 display/keypad.

  • Page 80

    1 1 2 2 3 3 4 4 d d c c b b a a title number revision size letter date: 2011/06/13 sheet of file: z:\documentation\..\display.Schdoc drawn by: lcd display/keypad 1.0 raymond jimenez 5 7 r1 1 r2 2 r3 3 r4 4 r5 5 osc 6 kbm 7 c4 8 c3 9 c2 11 c1 12 rdy 13 oe 14 d4 15 d3 16 d2 17 d1 18 d0 19 2 74c923 k1 ...

  • Page 81

    7.6. Ide interface 69 7.6 ide interface.

  • Page 82

    1 1 2 2 3 3 4 4 d d c c b b a a title number revision size letter date: 2011/06/13 sheet of file: z:\documentation\..\ide.Schdoc drawn by: ide interface 1.0 raymond jimenez 6 7 reset 1 ground 2 dd7 3 dd8 4 dd6 5 dd9 6 dd5 7 dd10 8 dd4 9 dd11 10 dd3 11 dd12 12 dd2 13 dd13 14 dd1 15 dd14 16 dd0 17 dd1...

  • Page 83

    7.7. Dram & address multiplexing 71 7.7 dram & address multiplexing.

  • Page 84

    1 1 2 2 3 3 4 4 d d c c b b a a title number revision size letter date: 2011/06/13 sheet of file: z:\documentation\..\dram.Schdoc drawn by: dram & address multiplexing 1.0 raymond jimenez 7 7 a0 12 a1 13 a2 14 a3 15 a4 16 a5 17 a6 18 a7 28 a8 31 a9 32 a10 19 ras0 44 cas0 40 cas1 43 cas2 41 cas3 42 w...

  • Page 85

    Chapter 8 annotated code 8.1 cpld code the cpld code acts as the glue that holds the system’s chip select and arbitration logic together. As a result, we have several very important files: main.Abl ties everything together. It ties the logical blocks that follow with real pins; we decided to use a h...

  • Page 86

    Main.Abl 2011/03/30 // main glue for cpld logic module main; title 'main cpld logic'; reset interface ( reset1, reset2 -> reset ) ; chipsel interface ( aa0, aa2, ab14, ab13, ab12, brd, bwr, clock -> dispcs, keypadcs, iderd, idewr, datadir, dispenable ) ; interrupt interface ( inirq3, inirq2, inirq1,...

  • Page 87

    Main.Abl 2011/03/30 dlatchen pin 43; // i/o pin 22 ta pin 44; // i/o pin 23 drefresh pin 2; // i/o pin 24 dras pin 4; // i/o pin 25 dcas pin 5; // i/o pin 26 drowl pin 6; // i/o pin 27 dcoll pin 7; // i/o pin 28 dwe pin 8; // i/o pin 29 bg pin 9; // i/o pin 30 mp3dreq pin 10; // i/o pin 31 // last p...

  • Page 88

    Main.Abl 2011/03/30 // active high per the mm74c923 datasheet. // dram takes up a lot of stuff... D1.Cs = aa2; d1.Reset = r1.Reset; d1.Bwr = bwr; d1.Brd = brd; d1.Refreshen = drefresh; d1.Clock = clock; drowl = d1.Rowlatch; dcoll = d1.Collatch; dras = d1.Ras; dcas = d1.Cas; dlatchen = d1.Latchen; ta...

  • Page 89

    Reset.Abl 2011/02/14 //////////////////////////////////////////////////////////////////////// // // abel file for dsp56k board reset logic // for the lattice isplsi 2016e cpld // // author: raymond jimenez... Original file from alexander hu/suresh situala // // revision history: // april 18, 2009 in...

  • Page 90

    Chipsel.Abl 2011/03/22 /////////////////////////////////////////////////////////////////////// // // abel file for dsp56k board chip select logic // for the lattice isplsi 1016e cpld // // author: raymond jimenez... Original file from alexander hu/suresh situala // // revision history: // april 18, ...

  • Page 91

    Chipsel.Abl 2011/03/22 // our address set addr = [ ab14, ab13, ab12 ] ; //state counter s1..S0 node istype ' reg '; // display enable state counter dispstate = [ s1..S0 ] ; // we have 4 states pretty much. Define using a gray code to minimize terms. Enablesetup = [ 0,0 ] ; enablepulse1 = [ 0,1 ] ; e...

  • Page 92

    Chipsel.Abl 2011/03/22 // selected. Idewr = aa0 & (( addr == 2 ) # ( addr == 3 )) & bwr; iderd = aa0 & (( addr == 2 ) # ( addr == 3 )) & brd; // we now deal with the display enable. Our display is pretty // slow, so we do this manually. Dispstate .Clk = clock; // we wait on the clock for wait states...

  • Page 93

    Interrpt.Abl 2011/02/13 //////////////////////////////////////////////////////////////////////// // // abel file for dsp56k board interrupt logic // for the lattice isplsi 2016e cpld // // author: raymond jimenez... Original file from alexander hu/suresh situala // // revision history: // april 18, ...

  • Page 94

    Interrpt.Abl 2011/02/13 end interrupt 2.

  • Page 95

    Dram.Abl 2011/03/27 //////////////////////////////////////////////////////////////////////// // // abel file for dsp56k board dram controller // for the lattice isplsi 2016e cpld // // author: raymond jimenez... Original file from alexander hu/suresh situala // // revision history: // april 18, 2009...

  • Page 96

    Dram.Abl 2011/03/27 clock pin ; scount = [ qs2..Qs0 ] ; //counter for multiple clock cycles, setup time hcount = [ qh2..Qh0 ] ; //counter for hold timing equations hcount .Clk = clock; hcount .Ar = reset; scount .Clk = clock; scount .Ar = reset; sreg .Clk = clock; sreg .Ar = reset; bg .Clk = clock; ...

  • Page 97

    Dram.Abl 2011/03/27 if ( brd ) then rw_ras with { scount := 0 } else if ( bwr ) then rw_ras with { scount := 0 } else rw_rowsetup; state rw_ras: ras = 1; cas = 0; rowlatch = 1; ta := 0; we = 0; if ( scount == 1 ) then rw_colsetup with { scount := 0; } else rw_ras with { scount := scount + 1; } state...

  • Page 98

    Dram.Abl 2011/03/27 else rw_pc with { scount := scount + 1; } state cbr_cas_low: ta := 1; ras = 0; cas = 1; we = 0; rowlatch = 1; if ( scount == 3 ) then cbr_ras_low with { scount :=0 } else ( cbr_cas_low ) with { scount := scount + 1 } state cbr_ras_low: ta := 1; ras = 1; cas = 1; we = 0; rowlatch ...

  • Page 99

    8.2. Bootup code (crt0.Asm) 87 8.2 bootup code (crt0.Asm) crt0.Asm contains the system’s bootloader; this code is executed first and copies all of the system code from ram into rom in order to match the compiler’s expectations. Please note that when booting via this code, program space is over- writ...

  • Page 100

    Crt0.Asm 2011/06/13 1 ; crt0.Asm 2 ; 3 ; this file is the initial bootup code that's executed from rom. 4 ; this file is heavily adopted from the standard crt0.Asm 5 ; that was included with the dsp56k developer toolkit. 6 ; 7 ; perhaps most importantly, this file also incorporates the memory map 8 ...

  • Page 101

    Crt0.Asm 2011/06/13 58 global f__stack_safety 59 f__stack_safety dc 1024 60 61 top_of_memory equ $a07fff 62 ;this is the top of our memory in x space; anything below this is sram 63 ; and is writable 64 bottom_of_memory equ $a00000 65 ;and then dsize is the bottom of our memory in x space. 66 67 ; _...

  • Page 102

    Crt0.Asm 2011/06/13 115 movep #$d00609, x :$fffff8 ; aa1 = rom (forced due to mode 9) 116 movep #$200431, x :$fffff7 ; aa2 = dram (via our own controller) 117 movep #$a00831, x :$fffff6 ; aa3 = sram 118 119 jmp end_xload 120 121 ;now that we can access the rom, unpack x-space constants down there 12...

  • Page 103

    Crt0.Asm 2011/06/13 172 stop ; all done 173 174 endsec 175 176 section time_counter 177 178 org x : 179 global f__time 180 f__time 181 dc 0 182 183 endsec 184 185 section io_primitives 186 187 org p: 188 189 nop 190 global f__send 191 f__send 192 rts 193 nop 194 195 nop 196 global f__receive 197 f__...

  • Page 104

    Crt0.Asm 2011/06/13 229 ; called function (because of the prologue code which is after the jsr 230 ; in dummy_call). 231 ; 232 ; the prologue code decrements r6 by the amount used by the arguments 233 ; to the target function plus one (to move us back to where the return 234 ; address was stored). T...

  • Page 105

    Crt0.Asm 2011/06/13 286 movem p: ( r0 ) +, r2 ; source start 287 movem p: ( r0 ) +, r3 ; size of expicitly initialized block 288 movem p: ( r0 ) +, r4 ; size of zero initialized block 289 290 do r3 ,_lab2 291 movem p: ( r2 ) +, x0 292 move x0 , x : ( r1 ) + 293 nop 294 _lab2 295 296 do r4 ,_lab3 297...

  • Page 106

    Crt0.Asm 2011/06/13 343 ds $700000 ;0xa00000 - 0x300000 344 endsec 345 346 ;cover the dram for now because it is not functional 347 section dram_temp_reservation 348 org x :$200000 ;starts at 0x200000 349 ds $100000 ;0x300000 - 0x200000 (1mbyte ostensibly) 350 endsec 351 352 ;cover the gap between d...

  • Page 107

    8.3. Queues (queues.Asm) 95 8.3 queues (queues.Asm) queues.Asm contains basic circular queue code. This code is used mainly by the display code..

  • Page 108

    Queues.Asm 2011/02/22 1 2 ; queues.Asm 3 ; 4 ; this file offers several rudimentary queue (fifo) functions. 5 ; note that none of these functions follow the c calling convention; 6 ; they are asm-call safe only. 7 ; 8 ; many of these functions are ported from ee51 hw#3. 9 ; 10 ; queue_init - initial...

  • Page 109

    Queues.Asm 2011/02/22 58 ; description: queue_init zeros out the queue structure so that 59 ; it can be used by other queue functions later. We assume all queues 60 ; are in x space. 61 ; 62 ; operation: queue_init sets the head and tail pointers to be 63 ; the same (0) and sets the size to be the p...

  • Page 110

    Queues.Asm 2011/02/22 115 ; description: queue_empty checks whether the queue is empty, by comparing 116 ; the head and tail pointers, and sets zf if the queue is empty. 117 ; 118 ; operation: the function compares the head and tail pointers, and as a 119 ; result, sets the zero flag. In other words...

  • Page 111

    Queues.Asm 2011/02/22 172 ; queue_full 173 ; functional specification 174 ; 175 ; description: queue_full takes the head and tail pointers, does 176 ; a little bit of modulo arithmetic to increment the tail pointer, and tells 177 ; us whether the queue is full or not. 178 ; 179 ; operation: the func...

  • Page 112

    Queues.Asm 2011/02/22 228 add #>1, a ;we increment the pointer to the next address 229 230 cmp x1 , a ;we see if the pointer is too large (x1 231 jle queue_full_nowrap 232 ;if tail >= size, wrap to zero 233 ;jgt queue_full_wrap 234 queue_full_wrap: 235 clr a ;we reset our tail pointer to 0 to wrap 2...

  • Page 113

    Queues.Asm 2011/02/22 285 ; registers changed: a2, a1, a0 (a) 286 ; 287 ; limitations: none known. 288 ; 289 ; known bugs: none. 290 ; 291 ; special notes: 292 ; 293 ; revision history: 2011/02/16 raymond jimenez first revision 294 ; 295 global dequeue 296 dequeue: ;assembly entry point 297 298 ;we ...

  • Page 114

    Queues.Asm 2011/02/22 341 342 ;end of body code, now clean up registers 343 move ssl , n0 ;restore n0/x0 344 move ssh , x0 345 346 pop_acc b 347 348 rts ;return from subroutine 349 ;end of dequeue 350 351 352 ; enqeueue 353 ; functional specification 354 ; 355 ; description: enqueue takes a single a...

  • Page 115

    Queues.Asm 2011/02/22 398 enqueue: ;assembly entry point 399 400 ;save all registers we use so we can restore later 401 ;we use the accumulators due to cmp/sub, so save them: 402 push_acc a 403 ;then we used n0/x0, so save them: 404 move x0 , ssh 405 move n0 , ssl 406 407 408 ;check if there is any ...

  • Page 116

    Queues.Asm 2011/02/22 453 454 rts ;return from subroutine 455 ;end function 456 457 458 459 460 endsec 461 462 463 9.

  • Page 117

    8.4. Display (display.Inc, display.Asm) 105 8.4 display (display.Inc, display.Asm) display.Inc contains important defines and constants for the display code, located in display.Asm. Display.Asm contains the display code. We assume a hd44780-compatible lcd that is connected to the cpld and address/da...

  • Page 118

    Display.Inc 2011/06/13 1 ; display.Inc 2 ; 3 ; this file offers several key includes for the display functionality, 4 ; such as size of memory buffers and constants, etc. 5 ; 6 ; revision history: 7 ; 8 ; 2011/2/15 raymond jimenez initial revision 9 ; 2011/6/12 raymond jimenez cleaned up for documen...

  • Page 119

    Display.Asm 2011/06/13 1 ; display.Asm 2 ; 3 ; this file contains the hardware-level interface code for the lcd display. 4 ; it offers the functions: 5 ; 6 ; void display_time(unsigned int) - display the passed time on the lcd 7 ; void display_status(unsigned int) - display the passed status on the ...

  • Page 120

    Display.Asm 2011/06/13 58 59 clear_artist_str: 60 ; 1 2 3 4 61 ; 1234567890123456789012345678901234567890 62 dc " " ,$00 63 clear_title_str: 64 ; 1 2 3 4 65 ; 1234567890123456789012345678901234567890 66 dc " " ,$00 67 clear_time_str: 68 ; 1 2 3 4 69 ; 1234567890123456789012345678901234567890 70 dc "...

  • Page 121

    Display.Asm 2011/06/13 115 dc status_fastfwd_str ;1 - fastfwd 116 dc status_reverse_str ;2 - reverse 117 dc status_idle_str ;3 - idle 118 dc status_illegal_str ;4 - illegal 119 120 ; program code starts here 121 122 ;and finally, program code 123 global display_update 124 display_update: ;assembly e...

  • Page 122

    Display.Asm 2011/06/13 172 ; 173 ; global variables: none. 174 ; 175 ; shared variables: none. 176 ; 177 ; local variables: none. 178 ; 179 ; inputs: none. 180 ; 181 ; outputs: none. 182 ; 183 ; error handling: none. 184 ; 185 ; algorithm: none. 186 ; 187 ; data structures: none. 188 ; 189 ; registe...

  • Page 123

    Display.Asm 2011/06/13 229 nop 230 nop 231 232 display_init_loop_end : 233 234 235 ;set our output mode: display on 236 move #>$0c, a 237 jsr enqueue 238 239 240 move #>$38, a ;and make 2-line mode a thing. 241 jsr enqueue ;and let the display interrupt take care of it 242 243 ;end of body code, now...

  • Page 124

    Display.Asm 2011/06/13 286 ; algorithm: none. 287 ; 288 ; data structures: none. 289 ; 290 ; registers changed: none. 291 ; 292 ; limitations: none known. 293 ; 294 ; known bugs: none. 295 ; 296 ; special notes: 297 ; 298 ; revision history: 2011/02/16 raymond jimenez first revision 299 ; 300 global...

  • Page 125

    Display.Asm 2011/06/13 343 344 345 pop_acc a 346 move ssl , r1 ;restore r1 347 move ssh , r0 ;restore r0 348 349 350 ;end of body code, now restore all registers 351 rts ;return from subroutine 352 ;end display_write_string 353 354 355 ; display_set_loc 356 ; 357 ; functional specification 358 ; 359...

  • Page 126

    Display.Asm 2011/06/13 400 ; 401 ; revision history: 2011/02/16 raymond jimenez first revision 402 ; 403 global display_set_loc 404 display_set_loc: ;assembly entry point 405 406 ;save all registers we use so we can restore later 407 move r0 , ssh ;we use r0 of course. 408 ;and we change the accumul...

  • Page 127

    Display.Asm 2011/06/13 457 ; error handling: none. 458 ; 459 ; algorithm: none. 460 ; 461 ; data structures: none. 462 ; 463 ; registers changed: none. 464 ; 465 ; limitations: none known. 466 ; 467 ; known bugs: none. 468 ; 469 ; special notes: 470 ; 471 ; revision history: 2011/02/16 raymond jimen...

  • Page 128

    Display.Asm 2011/06/13 513 move ssh , n1 514 move ssl , r1 515 move ssh , r0 516 517 ;standard c epilogue 518 move #0+1, n6 519 move ( r6 ) - n6 ; deallocate local stack space, set ccr flags. 520 tst a 521 move x : ( r6 ) , ssh ; get the return address. 522 rts ;return from subroutine 523 ;end fdisp...

  • Page 129

    Display.Asm 2011/06/13 570 move ssh , x : ( r6 ) + ; save the return address. 571 move ( r6 ) + n6 ; allocate local stack space of size k. 572 573 ;save all registers we use so we can restore later 574 move r0 , ssh 575 move r1 , ssl 576 577 ;we also change b, so preserve it 578 push_acc a 579 580 5...

  • Page 130

    Display.Asm 2011/06/13 627 ; 628 ; global variables: none. 629 ; 630 ; shared variables: none. 631 ; 632 ; local variables: none. 633 ; 634 ; inputs: none. 635 ; 636 ; outputs: artist name on the display. 637 ; 638 ; error handling: none. 639 ; 640 ; algorithm: none. 641 ; 642 ; data structures: non...

  • Page 131

    Display.Asm 2011/06/13 684 685 ;end of body code, now restore all registers 686 pop_acc a 687 688 move ssl , r1 689 move ssh , r0 690 691 ;standard c epilogue 692 move #0+1, n6 693 move ( r6 ) - n6 ; deallocate local stack space, set ccr flags. 694 tst a 695 move x : ( r6 ) , ssh ; get the return ad...

  • Page 132

    Display.Asm 2011/06/13 741 global fdisplay_time 742 fdisplay_time: ;c entry point 743 744 nop 745 nop 746 rts 747 748 ;standard c prologue 749 move #0, n6 ; k is the amount of local space needed. 750 move ssh , x : ( r6 ) + ; save the return address. 751 move ( r6 ) + n6 ; allocate local stack space...

  • Page 133

    Display.Asm 2011/06/13 798 move #>600, x0 799 jsr imod_x0a ; a = a%600 800 801 ;we divide by ten to get seconds: 802 move #>10, x0 803 jsr idiv_x0a ; a = floor(a/10) 804 805 ;and we turn this into a string and blit it: 806 move #convert_temp_buf, r0 807 jsr dec2string 808 jsr display_write_string 80...

  • Page 134

    Display.Asm 2011/06/13 855 ; 856 ; arguments: none. 857 ; 858 ; return values: none. 859 ; 860 ; global variables: none. 861 ; 862 ; shared variables: convert_temp_buf - temporary buffer for binary->ascii 863 ; conversion 864 ; 865 ; local variables: none. 866 ; 867 ; inputs: none. 868 ; 869 ; outpu...

  • Page 135

    Display.Asm 2011/06/13 912 jsr get_atten ;we now work with the attenuation 913 asr #atten_shift, a , a ;shift over to get integer db 914 915 ;and we convert to a number and write it to the screen 916 move #convert_temp_buf, r0 917 jsr dec2string 918 jsr display_write_string 919 920 ;this is followed...

  • Page 136

    124 chapter 8. Annotated code 8.5 keypad (keyfunc.Inc, keyfunc.Asm) keyfunc.Inc contains important definitions for the keypad code, mostly keyscan code definitions. Keyfunc.Asm contains the keypad processing code and the event handler installed to handle the keypad irq..

  • Page 137

    Keyfunc.Inc 2011/06/13 1 ; keyfunc.Inc 2 ; 3 ; this file contains several important definitions that the keypad code 4 ; depends on, such as the definitions for the keycodes. 5 ; 6 ; revision history 7 ; 8 ; 2011/2/16 raymond jimenez initial revision 9 ; 2011/6/12 raymond jimenez cleaned up for docu...

  • Page 138

    Keyfunc.Asm 2011/06/13 1 ; keyfunc.Asm 2 ; 3 ; this file contains procedures related to the keypad, such as getkey and the 4 ; keypad interrupt handler. 5 ; 6 ; keypad_handler - the event handler called when a new key has been pressed 7 ; fkey_init - initialization code for the keypad; call before d...

  • Page 139

    Keyfunc.Asm 2011/06/13 58 59 key_trans_table: 60 dc key_nop ;key 0 - don't do anything 61 dc key_nop ;key 1 - don't do anything 62 dc key_nop ;key 2 - don't do anything 63 dc key_nop ;key 3 - don't do anything 64 dc key_nop ;key 4 - don't do anything 65 dc key_trackup ;key 5 - track up 66 dc key_vol...

  • Page 140

    Keyfunc.Asm 2011/06/13 115 ; algorithm: none. 116 ; 117 ; data structures: none. 118 ; 119 ; registers changed: none. 120 ; 121 ; limitations: none known. 122 ; 123 ; known bugs: none. 124 ; 125 ; special notes: 126 ; 127 ; revision history: 2011/02/16 raymond jimenez first revision 128 ; 129 global...

  • Page 141

    Keyfunc.Asm 2011/06/13 172 ; 173 ; algorithm: none. 174 ; 175 ; data structures: none. 176 ; 177 ; registers changed: a. 178 ; 179 ; limitations: none known. 180 ; 181 ; known bugs: none. 182 ; 183 ; special notes: 184 ; 185 ; revision history: 2011/02/16 raymond jimenez first revision 186 ; 187 glo...

  • Page 142

    Keyfunc.Asm 2011/06/13 229 ; 230 ; shared variables: none. 231 ; 232 ; local variables: none. 233 ; 234 ; inputs: none. 235 ; 236 ; outputs: none. 237 ; 238 ; error handling: none. 239 ; 240 ; algorithm: none. 241 ; 242 ; data structures: none. 243 ; 244 ; registers changed: a. 245 ; 246 ; limitatio...

  • Page 143

    Keyfunc.Asm 2011/06/13 286 287 ;standard c epilogue 288 move #0+1, n6 289 move ( r6 ) - n6 ; deallocate local stack space, set ccr flags. 290 tst a 291 move x : ( r6 ) , ssh ; get the return address. 292 ;save all registers we use so we can restore later 293 294 rts ;return from subroutine 295 ;end ...

  • Page 144

    Keyfunc.Asm 2011/06/13 342 ;standard c prologue 343 move #0, n6 ; k is the amount of local space needed. 344 move ssh , x : ( r6 ) + ; save the return address. 345 move ( r6 ) + n6 ; allocate local stack space of size k. 346 347 ;save all of the registers we use 348 move r0 , ssh ;save both r0/n0 34...

  • Page 145

    8.6. Ide interface 133 8.6 ide interface ide.Inc contains important definitions for the ide code, mostly ide standard definitions. Ide.Asm contains the ide block reading code, as well as the initialization code..

  • Page 146

    Ide.Inc 2011/03/30 1 2 ;the various ide register addresses 3 ; some are read only, others write only, 4 ; most r/w. Please check the ata spec for details. 5 6 ;the addresses come from how we've wired up the 7 ; bus to the ide connector. 8 9 10 ide_data_reg equ $103000 11 ide_feature_reg equ $103100 ...

  • Page 147

    Ide.Asm 2011/03/30 1 2 ; ide.Asm 3 ; 4 ; this file offers several ide routines, such as setup and other things. 5 ; 6 7 section ide 8 include 'macros.Inc' 9 include 'ide.Inc' 10 org x : 11 12 ;no variables yet, i think 13 14 org p: ;we want to be located in program space 15 16 ; fsetup_ide 17 ; func...

  • Page 148

    Ide.Asm 2011/03/30 57 global fsetup_ide 58 fsetup_ide: ;c entry point 59 ;standard c prologue 60 move #0, n6 ;k is the amount of local space 61 move ssh , x : ( r6 ) + ;save the return address 62 move ( r6 ) + n6 ;allocate local stack space of size k 63 64 ;save all registers we use so we can restor...

  • Page 149

    Ide.Asm 2011/03/30 114 ; 115 ; arguments: none 116 ; 117 ; return values: none. 118 ; 119 ; global variables: none. 120 ; 121 ; shared variables: none. 122 ; 123 ; local variables: none. 124 ; 125 ; inputs: none. 126 ; 127 ; outputs: none. 128 ; 129 ; error handling: none. 130 ; 131 ; algorithm: non...

  • Page 150

    Ide.Asm 2011/03/30 171 ; the ide drive to stop giving us data, resulting in returning less blocks 172 ; than the calling function expects. 173 ; 174 ; arguments: first (a) - block number to start reading from 175 ; second (b) - number of blocks to read 176 ; third (r6-1) - (on stack) - pointer of ad...

  • Page 151

    Ide.Asm 2011/03/30 228 ; go to ide_cyl_low 229 asr #ide_reg_length, a , a 230 move a0 , x :ide_cyl_low_reg 231 232 ;and then [23:16] go to ide_cyl_high 233 asr #ide_reg_length, a , a 234 move a0 , x :ide_cyl_high_reg 235 236 ;and then we need to put [27:24] in the last 4 bits of 237 ; ide_dev_head_r...

  • Page 152

    Ide.Asm 2011/03/30 285 and #> ( 1 ) , b ;check the drq bit 286 jeq get_all_blocks_end ;if equal, get out of here, no more 287 ; blocks to read 288 ;spacing nop 289 nop 290 nop 291 nop 292 jmp get_all_blocks 293 294 get_all_blocks_end : 295 296 297 ;restore registers 298 pop_acc b 299 move ssl , r1 3...

  • Page 153

    8.7. Sound (dac & mp3 decoder) 141 8.7 sound (dac & mp3 decoder) sound.Inc contains most of the register definitions and command definitions for both the mp3 decoder (vs1053b) and the dac (wm8741). Sound.Asm contains the dma handling code, the interrupt handling code, and the interface code for the ...

  • Page 154

    Sound.Inc 2011/04/01 1 2 3 ; the following are helpful constants when dealing with essi0, the 4 ; vlsi vs1053b mp3 decoder chip. Data and control are both run over 5 ; essi0. 6 7 ; start decoder section 8 9 ;the essi ports expect left aligned data, so we shift over this number of bits: 10 essi_byte_...

  • Page 155

    Sound.Inc 2011/04/01 43 (std) enabled (will do later) 44 ; ---- ---- 0--- ---- ---- ---- tx1 (sc0) disabled 45 ; ---- ---- -0-- ---- ---- ---- tx2 (sc1) enabled (will do later) 46 ; ---- ---- --0- ---- ---- ---- normal mode 47 ; ---- ---- ---1 ---- ---- ---- synchronous mode 48 ; ---- ---- ---- 1---...

  • Page 156

    Sound.Inc 2011/04/01 79 ; ---- --0- ---- ---- ---- ---- rx disabled 80 ; ---- ---0 ---- ---- ---- ---- tx0 (std) enabled (will do later) 81 ; ---- ---- 0--- ---- ---- ---- tx1 (sc0) disabled 82 ; ---- ---- -0-- ---- ---- ---- tx2 (sc1) disabled 83 ; ---- ---- --1- ---- ---- ---- network mode (on-dem...

  • Page 157

    Sound.Inc 2011/04/01 110 enabled 111 ; ---- ---- ---- ---- ---- --0- sc1 enabled 112 ; ---- ---- ---- ---- ---- ---0 sc0 disabled 113 114 ;see errata for mask 4h80g, we find that gpio pins need to be programmed to output 115 ; anyway. This is probably why our shit's not working otl. 116 117 essi0_pr...

  • Page 158

    Sound.Inc 2011/04/01 161 ; ---0 0--- ---- ---- no turbo mode, running at max 162 ; ---- -000 0000 0000 12.288 mhz crystal (default) 163 164 165 sci_vol_value equ ( $0000 ) 166 ;max volume, dac does vol control 167 168 sci_mode_value equ ( $0800 ) ;allow sdi tests 169 sci_mode_cancel_value equ ( $080...

  • Page 159

    Sound.Inc 2011/04/01 204 ;constants for our dma/transfer logic 205 needs_kickstart equ 1 206 no_kickstart equ 0 207 dreq_ctl_prio equ %110 ;set to edge-trigger, priority 1, we can transmit up to 208 ; 32 bytes safely due to safety zone, even after dreq is 209 ; lowered 210 no_buffer_len equ 0 211 21...

  • Page 160

    Sound.Inc 2011/04/01 244 ; ---- ---- --1- ---- ---- ---- network (on-demand) mode 245 ; ---- ---- ---1 ---- ---- ---- synchronous mode 246 ; ---- ---- ---- 1--- ---- ---- clock out data on falling edge 247 ; ---- ---- ---- -1-- ---- ---- negative edge triggers word (positive is end of word) 248 ; --...

  • Page 161

    Sound.Inc 2011/04/01 278 dac_addr_shift equ 9+8 ;we shift 9 bits over as our addresses comprise 279 ; the first 7 bits of our data word 280 dac_data_shift equ 8 ;the data goes in the last 8 bits of the 16 bit word 281 282 ;here are a bunch of appropriately shifted and masked addresses to use with ou...

  • Page 162

    Sound.Asm 2011/04/02 1 opt noidw 2 opt so,xr 3 page 132,66,3,3 4 5 ; 6 ; sound.Asm 7 ; 8 ; this file offers interfacing code to the sound subsystem: the mp3 decoder and 9 ; the dac. 10 ; 11 12 section sound 13 include 'dsp_equ.Inc' 14 include 'sound.Inc' 15 include 'macros.Inc' 16 include 'general.I...

  • Page 163

    Sound.Asm 2011/04/02 56 ; operation: this function sets up essi0 to interface with the mp3 57 ; decoder chip (vlsi solutions vs1053b) in new mode, and sets the clock 58 ; registers as appropriate. It also enables i2s output so we can get 59 ; our dac outputting something. 60 ; 61 ; arguments: none. ...

  • Page 164

    Sound.Asm 2011/04/02 113 move #>essi0_pcrc_sci, r0 114 move r0 , x :m_pcrc 115 move #>essi0_prrc, r0 116 move r0 , x :m_prrc 117 move #>essi0_pdrc, r0 118 move r0 , x :m_pdrc 119 120 ;we load first data 121 move #>$ffff00, r0 122 move r0 , x :m_tx00 123 ; (tx02 control xcs) 124 move #xcs_high, r0 12...

  • Page 165

    Sound.Asm 2011/04/02 170 move r0 , x :m_tx02 171 172 ;now enable transmitters 173 bset #m_sste0, x :m_crb0 174 bset #m_sste2, x :m_crb0 175 bset #m_ssre, x :m_crb0 176 177 ; 2) enable i2s output 178 179 ;to enable i2s, we turn gpio to output and turn on i2s 180 ;set gpio flags: 181 move #> ( sci_wri...

  • Page 166

    Sound.Asm 2011/04/02 227 ; move #sci_aiaddr_value,r1 228 ; jsr write_sync_mp3_sci 229 ; move #>set_aiaddr_wait,r0 230 ; jsr sleep 231 232 ; 5) we now switch to data mode 233 jsr mp3_to_data_mode 234 235 ;and we setup the dma control registers as we'll be using 236 ; them in the future 237 move #>dcr...

  • Page 167

    Sound.Asm 2011/04/02 284 ; nop 285 ; nop 286 ; jclr #m_tde,x:m_ssisr0,* ;wait until transmitted 287 288 ; move #>$0,r1 289 ; move r1,x:m_tx00 ;shill write to tx00 290 ; nop ;wait for delay 291 ; nop 292 ; nop 293 ; jclr #m_tde,x:m_ssisr0,* ;wait until transmitted 294 295 296 297 298 299 ;end of body...

  • Page 168

    Sound.Asm 2011/04/02 341 ; 342 ; algorithm: none. 343 ; 344 ; data structures: none. 345 ; 346 ; registers changed: none. 347 ; 348 ; limitations: none known. 349 ; 350 ; known bugs: none. 351 ; 352 ; special notes: this function turns off essi0's interrupts. It does not 353 ; enable the dreq/irq1 i...

  • Page 169

    Sound.Asm 2011/04/02 397 rts ;return from subroutine 398 ;end mp3_to_data_mode 399 400 ; mp3_to_control_mode 401 ; functional specification 402 ; 403 ; description: mp3_to_control_mode changes essi0 to control mode, 404 ; so we can use write_sync_mp3_sci/read_sync_mp3_sci. 405 ; 406 ; operation: mp3...

  • Page 170

    Sound.Asm 2011/04/02 454 nop 455 jclr #m_tde, x :m_ssisr0,* ;wait until transmitted 456 457 ;need to temporarily disable essi pins otherwise they retain functionality 458 move #>0, r0 459 move r0 , x :m_pcrc 460 461 462 ;we then reconfigure essi0 to give us automatic frame syncs 463 ; (auto xdcs) 46...

  • Page 171

    Sound.Asm 2011/04/02 509 ; arguments: r0 - sci command and address to write, left aligned. 510 ; r0[23:16] - should be $02 for write 511 ; r0[15:8] - sci address 512 ; r0[7:0] - reserved, write 0 for compat 513 ; 514 ; r1 - sci data to write 515 ; r1[23:8] - sci data to write 516 ; r1[7:0] - reserve...

  • Page 172

    Sound.Asm 2011/04/02 564 ;we first want to make sure xcs is turned on for these words, 565 ; so set up tx10/tx20 appropriately 566 move #xcs_high, r2 567 move r2 , x :m_tx02 568 569 570 ;we first make sure the transmitter is empty 571 572 ;we have a two-cycle pipeline delay after we write these regi...

  • Page 173

    Sound.Asm 2011/04/02 621 622 ; read_sync_mp3_sci 623 ; functional specification 624 ; 625 ; description: read_sync_mp3_sci reads from the mp3 decoder, selecting a 626 ; register/address to read from. 627 ; 628 ; essi0 interrupts must be disabled before invocation. 629 ; 630 ; operation: write_sync_m...

  • Page 174

    Sound.Asm 2011/04/02 676 transmits) 677 start_critical 678 679 ;we first make sure the transmitter is empty 680 jclr #m_tde, x :m_ssisr0,* ;keep on jumping here until tde is set 681 move r0 , x :m_tx00 ;transmit first 16 bits: command, address 682 683 ;we first want to make sure xcs is turned on for...

  • Page 175

    Sound.Asm 2011/04/02 732 jclr #m_tde, x :m_ssisr0,* ;wait until transmitted 733 734 move r1 , x :m_tx00 ;shill write to tx00 735 736 move #xcs_high, r2 737 move r2 , x :m_tx02 738 739 end_critical 740 741 ;end of body code, now restore all registers 742 move ssh , r2 743 744 nop ;pipeline cache issu...

  • Page 176

    Sound.Asm 2011/04/02 788 ; 789 ; revision history: 2011/02/16 raymond jimenez first revision 790 ; 791 global faudio_play 792 faudio_play: ;c entry point 793 794 ;standard c prologue 795 move #0, n6 ;k is the amount of local space 796 move ssh , x : ( r6 ) + ;save the return address 797 move ( r6 ) ...

  • Page 177

    Sound.Asm 2011/04/02 843 move b1 , x :m_iprc 844 845 ;and then finally, we enable the dma and get going 846 847 bset #m_de, x :m_dcr2 ;set enable, since dma is de-enabled 848 849 ;at this point we should be going at full tilt: 850 ; if the buffer runs out, the dma done interrupt will handle it 851 ;...

  • Page 178

    Sound.Asm 2011/04/02 900 ; data structures: none. 901 ; 902 ; registers changed: none. 903 ; 904 ; limitations: none known. 905 ; 906 ; known bugs: none. 907 ; 908 ; special notes: 909 ; 910 ; revision history: 2011/02/16 raymond jimenez first revision 911 ; 912 global faudio_halt 913 faudio_halt: ;...

  • Page 179

    Sound.Asm 2011/04/02 955 956 do #2052,write_endfillbyte 957 move a1 , x :m_tx00 ;write endfillbyte 958 nop ;account for pipeline delay 959 nop 960 nop 961 jclr #m_tde, x :m_ssisr0,* ;keep on jumping here until transmitted 962 nop ;spacing nops 963 nop 964 nop 965 write_endfillbyte: 966 967 jsr mp3_t...

  • Page 180

    Sound.Asm 2011/04/02 1009 1010 ; end_mp3_dma_handler 1011 ; functional specification 1012 ; 1013 ; description: end_mp3_dma_handler takes care of switching to the next 1014 ; buffer at the end of a dma transfer to the mp3 decoder. 1015 ; 1016 ; operation: end_mp3_dma_handler handles the case when we...

  • Page 181

    Sound.Asm 2011/04/02 1064 1065 ;since we're called if de has also been hand-deasserted 1066 ; (as in dreq stopping our data transfer), we 1067 ; check to see if we were at the end of the transfer by comparing 1068 ; the buffer length to dcr+1. 1069 move x :m_dco2, a 1070 add #>1, a ;number of transf...

  • Page 182

    Sound.Asm 2011/04/02 1121 end_mp3_dma_no_buf: ;we're guaranteed to have no buffers to move in 1122 ;since we have no next buffer, we mark the current buffer 1123 ; used as well. 1124 move x :curbuf, r0 1125 nop 1126 move r0 , x :usedbuf 1127 1128 ;we invalidate the current buffer by setting it to no...

  • Page 183

    Sound.Asm 2011/04/02 1178 ; algorithm: none. 1179 ; 1180 ; data structures: none. 1181 ; 1182 ; registers changed: none. 1183 ; 1184 ; limitations: none known. 1185 ; 1186 ; known bugs: none. 1187 ; 1188 ; special notes: 1189 ; 1190 ; revision history: 2011/02/16 raymond jimenez first revision 1191 ...

  • Page 184

    Sound.Asm 2011/04/02 1234 ; shared variables: none. 1235 ; 1236 ; local variables: none. 1237 ; 1238 ; inputs: none. 1239 ; 1240 ; outputs: none. 1241 ; 1242 ; error handling: none. 1243 ; 1244 ; algorithm: none. 1245 ; 1246 ; data structures: none. 1247 ; 1248 ; registers changed: none. 1249 ; 1250...

  • Page 185

    Sound.Asm 2011/04/02 1290 ; return false -- no space 1291 ; 1292 ; no: we then check, is curbuf occupied? 1293 ; 1294 ; no: 1295 ; case #2: curbuf is empty, nextbuf is empty, usedbuf (formery curbuf) is passed 1296 ; -- this is the kickstart scenario, after an underrun 1297 ; we return true, since w...

  • Page 186

    Sound.Asm 2011/04/02 1346 fupdate: ;c entry point 1347 1348 ;standard c prologue 1349 move #0, n6 ;k is the amount of local space 1350 move ssh , x : ( r6 ) + ;save the return address 1351 move ( r6 ) + n6 ;allocate local stack space of size k 1352 1353 1354 ;save all registers we use so we can rest...

  • Page 187

    Sound.Asm 2011/04/02 1401 jmp update_end 1402 1403 update_empty_curbuf_new : ;scenario #3: we have all empty buffers, and new data 1404 move x0 , x :curbuf ;place in the new buffer 1405 move x1 , x :curbuflen 1406 jsr process_mp3_buffer ;and process the buffer when we place it in 1407 ;(r0-r1 set up...

  • Page 188

    Sound.Asm 2011/04/02 1457 ;standard c epilogue 1458 move #0+1, n6 1459 move ( r6 ) - n6 ;deallocate local stack space, set ccr flags 1460 tst a 1461 move x : ( r6 ) , ssh ;get return address 1462 1463 nop ;pipeline cache issue (see errata) 1464 rts ;return from subroutine 1465 1466 ;end fupdate 1467...

  • Page 189

    Sound.Asm 2011/04/02 1514 1515 ;save all registers we use so we can restore later 1516 push_acc a 1517 push_acc b 1518 move r0 , ssh 1519 move x0 , ssl 1520 1521 nop 1522 do r1 ,process_buffer_loop 1523 nop 1524 1525 move x : ( r0 ) , a ;we copy into a/b so we can do bitshifts. 1526 nop 1527 move a1...

  • Page 190

    Sound.Asm 2011/04/02 1570 ; return values: none. 1571 ; 1572 ; global variables: none. 1573 ; 1574 ; shared variables: none. 1575 ; 1576 ; local variables: none. 1577 ; 1578 ; inputs: none. 1579 ; 1580 ; outputs: none. 1581 ; 1582 ; error handling: none. 1583 ; 1584 ; algorithm: none. 1585 ; 1586 ; ...

  • Page 191

    Sound.Asm 2011/04/02 1627 ;enable transmitter 1628 bset #m_sste0, x :m_crb1 1629 1630 1631 ;now that the essi port is setup, we can go ahead and write our initial 1632 ; reg values 1633 move #> ( dac_reset_addr ) , r0 1634 jsr write_sync_dac ;reset the chip to a known state 1635 1636 1637 move #> ( ...

  • Page 192

    Sound.Asm 2011/04/02 1683 ; r0[23:17] - address of register to write 1684 ; r0[16] - should always be 0 1685 ; r0[15-8] - data to write 1686 ; r0[7-0] - reserved; write 0 for compat 1687 ; 1688 ; return values: none. 1689 ; 1690 ; global variables: none. 1691 ; 1692 ; shared variables: none. 1693 ; ...

  • Page 193

    Sound.Asm 2011/04/02 1739 ; 1740 ; description: vol_up is called whenever we want to increase the volume. It 1741 ; increases it by ten -.125db steps. 1742 ; 1743 ; operation: vol_up simply calls write_sync_dac in order to tell the dac 1744 ; go up to the desired volume. 1745 ; 1746 ; arguments: non...

  • Page 194

    Sound.Asm 2011/04/02 1793 sub x0 , a ; subtract (smaller atten == louder) 1794 1795 cmp #>min_atten, a ;see if it's too loud, nowhere to go 1796 jlt vol_up_done ;too loud, so go don't make any changes 1797 1798 1799 move a1 , x :sound_atten ;store the change 1800 1801 and #>atten_mask, a ;we now hav...

  • Page 195

    Sound.Asm 2011/04/02 1849 it 1850 ; increases it by ten -.125db steps. 1851 ; 1852 ; operation: vol_down simply calls write_sync_dac in order to tell the dac 1853 ; go up to the desired volume. 1854 ; 1855 ; arguments: none. 1856 ; 1857 ; return values: none. 1858 ; 1859 ; global variables: none. 18...

  • Page 196

    Sound.Asm 2011/04/02 1904 cmp #>max_atten, a ; see if it's too soft. 1905 jgt vol_down_done ;too soft, so go don't make any changes 1906 1907 1908 move a1 , x :sound_atten ;store the change 1909 and #>atten_mask, a ;we now have our desired attenuation 1910 ; in a1, so we use masks to get it to 1911 ...

  • Page 197

    Sound.Asm 2011/04/02 1960 ; 1961 ; operation: this function is an accessor function for sound_atten; 1962 ; it moves sound_atten into a. 1963 ; 1964 ; arguments: none. 1965 ; 1966 ; return values: a1 - current attenuation in steps of .125db 1967 ; 1968 ; global variables: none. 1969 ; 1970 ; shared ...

  • Page 198

    186 chapter 8. Annotated code 8.8 timing timing.Inc contains definitions for timing, such as how many loop iterations cor- respond to a minimum of 1 millisecond, etc. Timing.Asm provides several timing functions, such as felapsed time and others..

  • Page 199

    Timing.Inc 2011/03/24 1 ticks_per_ms equ 1 2 sleep_cycles equ 8 3 1.

  • Page 200

    Timing.Asm 2011/03/24 1 ; 2 ; timing.Asm 3 ; 4 ; this file offers several timing provider routines. 5 ; 6 7 section timing 8 include 'timing.Inc' 9 include 'macros.Inc' 10 org x : 11 12 global time_elapsed_counter 13 time_elapsed_counter : 14 ds $1 ;one word to count the clock ticks elapsed. 15 16 o...

  • Page 201

    Timing.Asm 2011/03/24 58 felapsed_time: ;c entry point 59 ;standard c prologue 60 move #0, n6 ;k is the amount of local space 61 move ssh , x : ( r6 ) + ;save the return address 62 move ( r6 ) + n6 ;allocate local stack space of size k 63 64 ;save all registers we use so we can restore later 65 move...

  • Page 202

    Timing.Asm 2011/03/24 115 ; error handling: none. 116 ; 117 ; algorithm: none. 118 ; 119 ; data structures: none. 120 ; 121 ; registers changed: none. 122 ; 123 ; limitations: none known. 124 ; 125 ; known bugs: none. 126 ; 127 ; special notes: 128 ; 129 ; revision history: 2011/02/16 raymond jimene...

  • Page 203

    Timing.Asm 2011/03/24 172 ; 173 ; error handling: none. 174 ; 175 ; algorithm: none. 176 ; 177 ; data structures: none. 178 ; 179 ; registers changed: none. 180 ; 181 ; limitations: none known. 182 ; 183 ; known bugs: none. 184 ; 185 ; special notes: 186 ; 187 ; revision history: 2011/02/16 raymond ...

  • Page 204

    192 chapter 8. Annotated code 8.9 interrupts intrrpts.Asm contains the interrupt installation/initalivation code..

  • Page 205

    Intrrpts.Asm 2011/04/02 1 ; intrrupts.Asm 2 ; 3 ; this file offers interrupt setup and handler routines. 4 ; 5 ; void setup_timer0(void) -- sets up timer 0, currently used for processing 6 ; display commands at 500ns intervals. 7 ; 8 ; void install_timer0_handler(void) -- installs timer0 handler (cu...

  • Page 206

    Intrrpts.Asm 2011/04/02 57 ; known bugs: none. 58 ; 59 ; special notes: 60 ; 61 ; revision history: 2011/02/16 raymond jimenez first revision 62 ; 63 global fstart_intr_setup 64 fstart_intr_setup: ;c entry point 65 ;standard c prologue 66 move #0, n6 ;k is the amount of local space 67 move ssh , x :...

  • Page 207

    Intrrpts.Asm 2011/04/02 114 movep a1 , x :m_iprp ;write back to the register 115 116 ;setup the prescaler timer to have 4 cycles. 117 ;@ 40mhz = 80/2 mhz, this gives us 1us resolution 118 movep #40, x :m_tplr 119 120 ;we want to have 200 cycles -> 200us command cycle time for the display 121 movep #...

  • Page 208

    Intrrpts.Asm 2011/04/02 171 ; 1ms per tick. 172 ; additionally, we base our mp3 timing off of this routine, 173 ; down to millisecond accuracy, so don't change! 174 movep #1000, x :m_tcpr1 175 ;initialize the timer start count to zero, too 176 movep #0, x :m_tlr1 177 178 ;set timer 1 to be enabled a...

  • Page 209

    Intrrpts.Asm 2011/04/02 228 ;(sr interrupt bits are already set by crt0) 229 ; this should have been setup already by timer0_setup. 230 231 ; 15us per tick. 232 ; dram refresh, so it's important that this works properly. 233 movep #400, x :m_tcpr2 234 ;initialize the timer start count to zero, too 2...

  • Page 210

    Intrrpts.Asm 2011/04/02 284 285 286 287 ; save registers we use 288 move r0 , ssh 289 move r1 , ssl 290 move r2 , ssh 291 move #$200000, r0 ;we just grab the first 32 words of dram into r1. 292 ; (it's important that it's dram due to dma contention) 293 ;we disable dma during refresh. 294 move x :m_...

  • Page 211

    Intrrpts.Asm 2011/04/02 339 ; 340 ; operation: it writes the interrupt pin setup registers 341 ; (iprc) to setup irqa as a level-triggered pin with priority 1 342 ; (low, we don't care about losing keys too much). We implement 343 ; the interrupt handler with a fast handler (2 opcodes), that are 344...

  • Page 213

    Intrrpts.Asm 2011/04/02 453 ; 454 ; revision history: 2011/02/16 raymond jimenez first revision 455 ; 456 global fend_intr_setup 457 fend_intr_setup: ;c entry point 458 ;standard c prologue 459 move #0, n6 ;k is the amount of local space 460 move ssh , x : ( r6 ) + ;save the return address 461 move ...

  • Page 214

    202 chapter 8. Annotated code 8.10 user interface several portions of the provided code were modified in order to interface with the assembly code. They are provided as follows: keyproc.H was updated to include volume-changing functions. Interfac.H was modified to reflect our current system, and was...

  • Page 215

    Keyproc.H 2011/06/14 /****************************************************************************/ /* */ /* keyproc.H */ /* key processing functions */ /* include file */ /* mp3 jukebox project */ /* ee/cs 52 */ /* */ /****************************************************************************/ /*...

  • Page 216

    Keyproc.H 2011/06/14 enum status do_trackdown ( enum status ) ; /* go to the previous track */ enum status do_volup ( enum status ) ; /* increase volume */ enum status do_voldown ( enum status ) ; /* decrease volume */ enum status start_play ( enum status ) ; /* begin playing the current track */ en...

  • Page 217

    Interfac.H 2011/04/02 /****************************************************************************/ /* */ /* interfac.H */ /* interface definitions */ /* include file */ /* mp3 jukebox project */ /* ee/cs 52 */ /* */ /****************************************************************************/ /* ...

  • Page 218

    Interfac.H 2011/04/02 #define subdir_char '>' #define status_play 0 #define status_fastfwd 1 #define status_reverse 2 #define status_idle 3 #define status_illegal 4 #define ide_block_size 256 /* 256 words/block */ #endif 2.

  • Page 219

    Mainloop.C 2011/04/02 /****************************************************************************/ /* */ /* mainloop */ /* main program loop */ /* mp3 jukebox project */ /* ee/cs 52 */ /* */ /****************************************************************************/ /* this file contains the ma...

  • Page 220

    Mainloop.C 2011/04/02 /* main description: this procedure is the main program loop for the mp3 jukebox. It loops getting keys from the keypad, processing those keys as is appropriate. It also handles updating the display and setting up the buffers for mp3 playback. Arguments: none. Return value: (in...

  • Page 221

    Mainloop.C 2011/04/02 /* idle play fast forward reverse */ { no_update, update_play, update_fastfwd, update_reverse } ; /* key processing functions (one for each system status type and key) */ static enum status ( * const process_key [ num_keycodes ][ num_status ])( enum status ) = /* current system...

  • Page 222

    Mainloop.C 2011/04/02 while(1) { test_dram(); } */ /* first initialize everything */ /* initalize fat directory functions */ root_dir_start = init_fat_system () ; /* get the first directory entry (file/song) */ if ( root_dir_start != 0 ) { /* have a valid starting sector - get the first directory en...

  • Page 223

    Mainloop.C 2011/04/02 /* always remember the current status for next loop iteration */ prev_status = cur_status; } /* done with main (never should get here), return 0 */ return 0; } /* key_lookup description: this function gets a key from the keypad and translates the raw keycode to an enumerated ke...

  • Page 224

    Mainloop.C 2011/04/02 static const int keys [] = /* array of key values */ { /* order must match keycodes array exactly */ key_trackup, /* */ key_trackdown, /* */ key_play, /* */ key_rptplay, /* */ key_fastfwd, /* */ key_reverse, /* */ key_stop, /* */ key_volup, /* */ key_voldown /* */ } ; int key; ...

  • Page 225

    Keyupdat.C 2011/03/31 /****************************************************************************/ /* */ /* keyupdat */ /* miscellaneous key processing and update functions */ /* mp3 jukebox project */ /* ee/cs 52 */ /* */ /**************************************************************************...

  • Page 226

    Keyupdat.C 2011/03/31 /* no_action description: this function handles a key when there is nothing to be done. It just returns. Arguments: cur_status (enum status) - the current system status. Return value: (enum status) - the new status (same as current status). Input: none. Output: none. Error hand...

  • Page 227

    Keyupdat.C 2011/03/31 algorithms: none. Data structures: none. Shared variables: none. Author: glen george last modified: june 5, 2003 */ enum status do_trackup ( enum status cur_status ) { /* variables */ /* none */ /* move to the previous directory entry, watching for errors */ if ( !Get_previous_...

  • Page 228

    Keyupdat.C 2011/03/31 data structures: none. Shared variables: none. Author: glen george last modified: june 5, 2003 */ enum status do_trackdown ( enum status cur_status ) { /* variables */ /* none */ /* move to the next directory entry, watching for errors */ if ( !Get_next_dir_entry ()) /* success...

  • Page 229

    Keyupdat.C 2011/03/31 shared variables: none. Author: glen george last modified: june 3, 2000 */ enum status stop_idle ( enum status cur_status ) { /* variables */ /* none */ /* reset to the start of the current track */ init_track () ; /* display the new time for the current track */ display_time (...

  • Page 230

    Keyupdat.C 2011/03/31 /* nothing to do - return with the status unchanged */ return cur_status; } /* do_volup description: this function handles when a key is pressed to increase volume. It asks the corresponding assembly function, vol_up, to increase the volume. Arguments: cur_status (enum status) ...

  • Page 231

    Keyupdat.C 2011/03/31 return value: (enum status) - the new status (same as current status). Input: none. Output: none. Error handling: none. Algorithms: none. Data structures: none. Shared variables: none. Author: raymond jimenez last modified: mar. 27, 2011 */ enum status do_voldown ( enum status ...

  • Page 232

    Test_dram.C 2011/06/14 #include #include #include "interfac.H" #include "mp3defs.H" #define block_sz 0x2000 #define dram_sz 0x4000 #define dram_start 0x200000 void test_dram () { unsigned int lfsr = 1; unsigned int period = 0; volatile unsigned int *dramptr; char buffer [ block_sz ] ; char strbuf [ ...

  • Page 233

    Test_dram.C 2011/06/14 2.

  • Page 234

    222 chapter 8. Annotated code 8.11 miscellaneous dsp equ.Inc contains several system defines, such as critical memory addresses and register values. General.Inc contains important definitons applicable to all code. Macros.Inc contains several important macros, such as a x86 push/pop equiva- lent and...

  • Page 235

    Dsp_equ.Inc 2011/01/28 1 ;******************************************************************************* ** 2 ; 3 ; equates for 56302/3 i/o registers and ports 4 ; 5 ; last update: june 11 1995 6 ; 7 ;******************************************************************************* ** 8 page 132,55,0...

  • Page 236

    Dsp_equ.Inc 2011/01/28 56 m_hrdf equ $0 ; host receive data full 57 m_htde equ $1 ; host receive data emptiy 58 m_hcp equ $2 ; host command pending 59 m_hf0 equ $3 ; host flag 0 60 m_hf1 equ $4 ; host flag 1 61 62 ; hpcr bits definition 63 m_hgen equ $0 ; host port gpio enable 64 m_ha8en equ $1 ; ho...

  • Page 237

    Dsp_equ.Inc 2011/01/28 113 m_tmie equ 13 ; timer interrupt enable 114 m_tir equ 14 ; timer interrupt rate 115 m_sckp equ 15 ; sci clock polarity 116 m_reie equ 16 ; sci error interrupt enable (reie) 117 118 ; sci status register bit flags 119 m_trne equ 0 ; transmitter empty 120 m_tdre equ 1 ; trans...

  • Page 238

    Dsp_equ.Inc 2011/01/28 170 ; essi control register a bit flags 171 m_pm equ $ff ; prescale modulus select mask (pm0-pm7) 172 m_psr equ 11 ; prescaler range 173 m_dc equ $1f000 ; frame rate divider control mask (dc0-dc7) 174 m_alc equ 18 ; alignment control (alc) 175 m_wl equ $380000 ; word length co...

  • Page 239

    Dsp_equ.Inc 2011/01/28 227 228 ; essi receive slot mask register b 229 m_ssrsb equ $ffff ; essi receive slot bits mask b (rs16-rs31) 230 231 232 ;------------------------------------------------------------------------ 233 ; 234 ; equates for exception processing 235 ; 236 ;-------------------------...

  • Page 240

    Dsp_equ.Inc 2011/01/28 284 m_s0l1 equ 3 ; essi0 interrupt priority level (high) 285 m_s1l equ $30 ; essi1 interrupt priority level mask 286 m_s1l0 equ 4 ; essi1 interrupt priority level (low) 287 m_s1l1 equ 5 ; essi1 interrupt priority level (high) 288 m_scl equ $c0 ; sci interrupt priority level ma...

  • Page 241

    Dsp_equ.Inc 2011/01/28 341 ; timer control bits 342 m_tc0 equ 4 ; timer control 0 343 m_tc1 equ 5 ; timer control 1 344 m_tc2 equ 6 ; timer control 2 345 m_tc3 equ 7 ; timer control 3 346 347 348 ;------------------------------------------------------------------------ 349 ; 350 ; equates for direct...

  • Page 242

    Dsp_equ.Inc 2011/01/28 398 m_dss equ $3 ; dma source space mask (dss0-dss1) 399 m_dss0 equ 0 ; dma source memory space 0 400 m_dss1 equ 1 ; dma source memory space 1 401 m_dds equ $c ; dma destination space mask (dds-dds1) 402 m_dds0 equ 2 ; dma destination memory space 0 403 m_dds1 equ 3 ; dma dest...

  • Page 243

    Dsp_equ.Inc 2011/01/28 455 m_pcod equ 19 ; pll clock output disable bit 456 m_pd equ $f00000 ; predivider factor bits mask (pd0-pd3) 457 458 459 ;------------------------------------------------------------------------ 460 ; 461 ; equates for biu 462 ; 463 ;------------------------------------------...

  • Page 244

    Dsp_equ.Inc 2011/01/28 510 m_z equ 2 ; zero 511 m_n equ 3 ; negative 512 m_u equ 4 ; unnormalized 513 m_e equ 5 ; extension 514 m_l equ 6 ; limit 515 m_s equ 7 ; scaling bit 516 m_i0 equ 8 ; interupt mask bit 0 517 m_i1 equ 9 ; interupt mask bit 1 518 m_s0 equ 10 ; scaling mode bit 0 519 m_s1 equ 11...

  • Page 245

    Dsp_equ.Inc 2011/01/28 565 else 566 i_vec equ $0 567 endif 568 569 ;------------------------------------------------------------------------ 570 ; non-maskable interrupts 571 ;------------------------------------------------------------------------ 572 i_reset equ i_vec+$00 ; hardware reset 573 i_st...

  • Page 246

    Dsp_equ.Inc 2011/01/28 622 623 ;------------------------------------------------------------------------ 624 ; sci interrupts 625 ;------------------------------------------------------------------------ 626 i_scird equ i_vec+$50 ; sci receive data 627 i_scirde equ i_vec+$52 ; sci receive data with ...

  • Page 247

    General.Inc 2011/03/29 1 false equ 0 2 true equ 1 3 1.

  • Page 248

    Macros.Inc 2011/03/29 1 ; we place some convenient macros here to make our life easier: 2 3 push_acc macro acc 4 5 ;we're saving an accumulator to the stack. 6 move acc\0, ssh ;push acc0/acc1 onto stack in one location 7 move acc\1, ssl ;pushing acc0 already preincremented 8 move acc\2, ssh ; and th...

  • Page 249

    Makefile.Mak 2011/06/14 ############################################################################# # # makefile # # ee/cs 52: dsp56k mp3/ogg jukebox project # # revision history # 2/16/2010 glen george initial revision # 3/10/2011 raymond jimenez now working for our build # ######################...

  • Page 250

    Makefile.Mak 2011/06/14 ### rules #################################################################### # specify virtual path for object files vpath %.Cln $ ( objdir ) # rule for building objects from c sources %.Cln: $ ( cc ) $ ( cflags ) -c $ ( patsubst %.Cln,%.C,$ ( )) -o $ ( objdir ) \$@ ### com...

  • Page 251

    Makefile.Mak 2011/06/14 test_dram.Cln: $ ( sysdir ) /test_dram.C # targets for low-level code # user must supply these targets and dependencies # example defintions: # keypad.Cln: $(sysdir)/keypad.Asm $(sysdir)/general.Inc $(sysdir)/keypad.Inc # $(asm) $(asmflags) -b$(objdir)/keypad.Cln $(sysdir)/ke...

  • Page 252

    240 chapter 8. Annotated code.

  • Page 253

    Chapter 9 release notes/errata 9.1 known bugs • due to bad soldering, the dram may not be always functional. To resolve this issue, one can resort to percussive maintenance or a “hot- plug” of the dram. In order to hotplug the dram, start the system as described in the quick-start guide. Begin playi...

  • Page 254

    242 chapter 9. Release notes/errata no fix is known at this time. • adding songs during daylight saving time may not operate correctly. You may see songs with extremely long playtimes, such as 500 minutes. This is due to a bug in the ms-dos song-adding program, which does not operate correctly given...