diff options
Diffstat (limited to 'Graphic_Equalizer/src/smartmedia.hcc')
-rw-r--r-- | Graphic_Equalizer/src/smartmedia.hcc | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/Graphic_Equalizer/src/smartmedia.hcc b/Graphic_Equalizer/src/smartmedia.hcc index f02b8bc..371d0bf 100644 --- a/Graphic_Equalizer/src/smartmedia.hcc +++ b/Graphic_Equalizer/src/smartmedia.hcc @@ -38,6 +38,19 @@ unsigned 1 physical_format; +unsigned 2 current_track; + +static rom unsigned 27 track_start[4] = { + SMARTMEDIA_ADDRESS_TRACK1_START, + SMARTMEDIA_ADDRESS_TRACK2_START, + SMARTMEDIA_ADDRESS_TRACK3_START +}; + +static rom unsigned 27 track_end[4] = { + SMARTMEDIA_ADDRESS_TRACK1_END, + SMARTMEDIA_ADDRESS_TRACK2_END, + SMARTMEDIA_ADDRESS_TRACK3_END +}; /*! \fn unsigned 1 smartmedia_init(void); * \brief We here initialize the Smart Media card and verify wether the @@ -68,7 +81,8 @@ inline unsigned 1 smartmedia_init(void) { * of the SMC. This to ensure we use the correct functions later. */ RC200SmartMediaCheckLogicalFormat(&physical_format); - + + current_track = 0; return retval; } /* --- smartmedia_init() --- */ @@ -108,7 +122,7 @@ void smartmedia_loaddata(skindata_t *skindata) { * We have several stages to go through. We stop once we pass the last * one. */ - while ((STAGE_LOAD_ABOUT_BOTTOM +1) != stage) { + while ((STAGE_LOAD_AUDIO_PLAYER +1) != stage) { /* * For each iteration of the main loop we set a different * start and end variables. @@ -171,6 +185,12 @@ void smartmedia_loaddata(skindata_t *skindata) { address = ADDRESS_ABOUT_BOTTOM_START; address_end = ADDRESS_ABOUT_BOTTOM_END; break; + + case STAGE_LOAD_AUDIO_PLAYER: + sm_address = SMARTMEDIA_ADDRESS_AUDIO_PLAYER_START; + address = ADDRESS_AUDIO_PLAYER_START; + address_end = ADDRESS_AUDIO_PLAYER_END; + break; default: break; } @@ -281,7 +301,12 @@ void smartmedia_loaddata(skindata_t *skindata) { */ stage++; } - + if (physical_format) + { + RC200SmartMediaSetAddress(READ, 0); + } else { + RC200SmartMediaSetLogicalAddress(READ, 0); + } /* * TODO: This block needs to move up into the loop where we calculate * these settings determind by the image data. @@ -325,7 +350,21 @@ smartmedia_load_block() { end(); }*/ - +void change_track(unsigned 2 track_index) +{ + current_track = track_index; +} +
+void empty_buffers(signed 18 *buffer, unsigned 7 buffer_size)
+{
+ unsigned 7 buffer_index;
+ buffer_index = 0;
+ while(buffer_index != buffer_size)
+ {
+ buffer[buffer_index] = 0;
+ buffer_index++;
+ }
+} unsigned 1 load_audio_samples(signed 18 *samples, unsigned 27 blockoffset, unsigned 7 sample_count) { ram unsigned 8 data[128]; @@ -339,7 +378,7 @@ unsigned 1 load_audio_samples(signed 18 *samples, unsigned 27 blockoffset, unsig retval = 0; if (!blockoffset) { - smartmedia_set_read_address(SMARTMEDIA_ADDRESS_AUDIO_START) + smartmedia_set_read_address(track_start[current_track]); } smartmedia_read_bytes(data, samplecount); @@ -351,13 +390,13 @@ unsigned 1 load_audio_samples(signed 18 *samples, unsigned 27 blockoffset, unsig sampleindex +=2; } - if (((blockoffset <<7) +(0 @ samplecount) +SMARTMEDIA_ADDRESS_AUDIO_START) >= SMARTMEDIA_ADDRESS_AUDIO_END) { + if (((blockoffset <<7) +(0 @ samplecount) +track_start[current_track]) >= track_end[current_track]) { retval = 1; } return retval; } -void smartmedia_set_read_address(unsigned 20 address) +void smartmedia_set_read_address(unsigned 27 address) { unsigned 8 dummy; unsigned 1 result; |