summaryrefslogtreecommitdiffstats
path: root/Graphic_Equalizer/src/smartmedia.hcc
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2005-01-06 09:05:53 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2005-01-06 09:05:53 (GMT)
commit5ec375840a359359ed78b569bb960beaf83914fb (patch)
tree92a8e93dca642cfac2ea024bf4d0fe0b0bf80f93 /Graphic_Equalizer/src/smartmedia.hcc
parente133152016e44d81202f18bcdc2b110a3bce7196 (diff)
downloadTASS-5ec375840a359359ed78b569bb960beaf83914fb.zip
TASS-5ec375840a359359ed78b569bb960beaf83914fb.tar.gz
TASS-5ec375840a359359ed78b569bb960beaf83914fb.tar.bz2
Refactured Smart Media Loading completely.
Diffstat (limited to 'Graphic_Equalizer/src/smartmedia.hcc')
-rw-r--r--Graphic_Equalizer/src/smartmedia.hcc340
1 files changed, 107 insertions, 233 deletions
diff --git a/Graphic_Equalizer/src/smartmedia.hcc b/Graphic_Equalizer/src/smartmedia.hcc
index da0388b..e87c852 100644
--- a/Graphic_Equalizer/src/smartmedia.hcc
+++ b/Graphic_Equalizer/src/smartmedia.hcc
@@ -49,12 +49,10 @@ unsigned 1 smartmedia_init(void) {
* Firstly we enable both the CPLD and the SmartMedia.
*/
RC200CPLDEnable();
- RC200SmartMediaInit(&retval);
- if (retval) {
- RC200SmartMediaReset(&retval);
- RC200SmartMediaInit(&retval);
- }
+ RC200SmartMediaReset(&retval);
+ delay;
+ RC200SmartMediaInit(&retval);
return retval;
} /* --- smartmedia_init() --- */
@@ -78,250 +76,120 @@ void smartmedia_loaddata(skindata_t *skindata) {
macro expr AW = PalPL2RAMGetMaxAddressWidthCT();
unsigned DW data;
- unsigned 27 smartmedia_address, smartmedia_address_mask;
- unsigned AW address, address_offset;
+ unsigned 27 sm_address;
+ unsigned AW address, address_end;
unsigned 8 mask, r, g, b;
unsigned 4 stage;
+ unsigned 1 physical_format;
unsigned 1 result;
extern ram unsigned 8 presets_default_values[768];
-#if HAVE_DEBUG
- /*
- * Print some nice stats about data loading.
- */
- print_eol();
- print_hex_value(0);
-#endif
- /*
- * Before we enter our loop to fill our memory with valid data, we have
- * to set the startup positions for the SmartMedia.
- */
- address=0;
- address_offset = 0;
- smartmedia_address = 0;
- smartmedia_address_mask = SMARTMEDIA_ADDRESS_PRESET_DEMO_START;
- stage = STAGE_LOAD_PRESET;
- /*
- * We start with the address of the skin, and do the loop until we have
- * done the end of the help.
- */
- while ((ADDRESS_ABOUT_BOTTOM_END +1) != (address_offset +address)) {
- if (STAGE_LOAD_PRESET == stage) {
- if (ADDRESS_PRESET_RESET_START == (address_offset +address)) {
- smartmedia_address_mask = SMARTMEDIA_ADDRESS_PRESET_RESET_START;
- }
- if (ADDRESS_PRESET_RESET_END == (address_offset +address)) { /* case ADRESS_SKIN_START */
-#if HAVE_DEBUG
- print_string(" ADDRESS_SKIN_START");print_eol();
-#endif
- address = 0;
- address_offset = ADDRESS_SKIN_START;
- smartmedia_address = SMARTMEDIA_ADDRESS_SKIN_START;
- smartmedia_address_mask = SMARTMEDIA_ADDRESS_SKINMASK_START;
- stage = STAGE_LOAD_SKIN;
- }
- } else {
- /*
- * Once we are done with the loading of our skin, we need to
- * change the smartmedia start addresses.
- */
- switch (address_offset +address) {
- case ADDRESS_HELP_START:
-#if HAVE_DEBUG
- print_string(" ADDRESS_HELP_START");print_eol();
-#endif
- address = 0;
- address_offset = ADDRESS_HELP_START;
- smartmedia_address = SMARTMEDIA_ADDRESS_HELP_START;
- smartmedia_address_mask = SMARTMEDIA_ADDRESS_HELPMASK_START;
- stage = STAGE_LOAD_HELP;
- break;
- case ADDRESS_GRAPHMASK_START:
-#if HAVE_DEBUG
- print_string(" ADDRESS_GRAPHMASK_START");print_eol();
-#endif
- address = 0;
- address_offset = ADDRESS_GRAPHMASK_START;
- smartmedia_address_mask = SMARTMEDIA_ADDRESS_GRAPHMASK_START;
- stage = STAGE_LOAD_GRAPH;
- break;
- case ADDRESS_ABOUT_TOP_FONTYS_START:
-#if HAVE_DEBUG
- print_string(" ADDRESS_ABOUT_TOP_FONTYS_START: ");print_eol();
-#endif
- address = 0;
- address_offset = ADDRESS_ABOUT_TOP_FONTYS_START;
- smartmedia_address = SMARTMEDIA_ADDRESS_TOP_FONTYS_START;
- smartmedia_address_mask = SMARTMEDIA_ADDRESS_TOPMASK_START;
- stage = STAGE_LOAD_TOP_FONTYS;
- break;
- case ADDRESS_ABOUT_TOP_TASS_START:
-#if HAVE_DEBUG
- print_string(" ADDRESS_ABOUT_TOP_TASS_START");print_eol();
-#endif
- address = 0;
- address_offset = ADDRESS_ABOUT_TOP_TASS_START;
- smartmedia_address = SMARTMEDIA_ADDRESS_TOP_TASS_START;
- smartmedia_address_mask = SMARTMEDIA_ADDRESS_TOPMASK_START;
- stage = STAGE_LOAD_TOP_TASS;
- break;
- case ADDRESS_ABOUT_TOP_TRANSFER_START:
-#if HAVE_DEBUG
- print_string(" ADDRESS_ABOUT_TOP_TRANSFER_START");print_eol();
-#endif
- address = 0;
- address_offset = ADDRESS_ABOUT_TOP_TRANSFER_START;
- smartmedia_address = SMARTMEDIA_ADDRESS_TOP_TRANSFER_START;
- smartmedia_address_mask = SMARTMEDIA_ADDRESS_TOPMASK_START;
- stage = STAGE_LOAD_TOP_TRANSFER;
- break;
- case ADDRESS_ABOUT_TOP_CELOXICA_START:
-#if HAVE_DEBUG
- print_string(" ADDRESS_ABOUT_TOP_CELOXICA_START");print_eol();
-#endif
- address = 0;
- address_offset = ADDRESS_ABOUT_TOP_CELOXICA_START;
- smartmedia_address = SMARTMEDIA_ADDRESS_TOP_CELOXICA_START;
- smartmedia_address_mask = SMARTMEDIA_ADDRESS_TOPMASK_START;
- stage = STAGE_LOAD_TOP_CELOXICA;
- break;
+ RC200SmartMediaCheckLogicalFormat(&physical_format);
+
+ while ((STAGE_LOAD_ABOUT_BOTTOM +1) != stage) {
+ switch (stage) {
+ case STAGE_LOAD_DEMO_PRESET:
+ sm_address = SMARTMEDIA_ADDRESS_PRESET_DEMO_START;
+ address = INDEX_PRESET_DEMO_START;
+ address_end = INDEX_PRESET_DEMO_END;
+ break;
+ case STAGE_LOAD_RESET_PRESET:
+ sm_address = SMARTMEDIA_ADDRESS_PRESET_RESET_START;
+ address = INDEX_PRESET_RESET_START;
+ address_end = INDEX_PRESET_RESET_END;
+ break;
+ case STAGE_LOAD_SKIN:
+ sm_address = SMARTMEDIA_ADDRESS_SKIN_START;
+ address = ADDRESS_SKIN_START;
+ address_end = ADDRESS_SKIN_END;
+ break;
+ case STAGE_LOAD_HELP:
+ sm_address = SMARTMEDIA_ADDRESS_HELP_START;
+ address = ADDRESS_HELP_START;
+ address_end = ADDRESS_HELP_END;
+ break;
+ case STAGE_LOAD_GRAPH:
+ sm_address = SMARTMEDIA_ADDRESS_GRAPH_START;
+ address = ADDRESS_GRAPH_START;
+ address_end = ADDRESS_GRAPH_END;
+ break;
+ case STAGE_LOAD_TOP_FONTYS:
+ sm_address = SMARTMEDIA_ADDRESS_TOP_FONTYS_START;
+ address = ADDRESS_ABOUT_TOP_FONTYS_START;
+ address_end = ADDRESS_ABOUT_TOP_FONTYS_END;
+ break;
+ case STAGE_LOAD_TOP_TASS:
+ sm_address = SMARTMEDIA_ADDRESS_TOP_TASS_START;
+ address = ADDRESS_ABOUT_TOP_TASS_START;
+ address_end = ADDRESS_ABOUT_TOP_TASS_END;
+ break;
+ case STAGE_LOAD_TOP_TRANSFER:
+ sm_address = SMARTMEDIA_ADDRESS_TOP_TRANSFER_START;
+ address = ADDRESS_ABOUT_TOP_TRANSFER_START;
+ address_end = ADDRESS_ABOUT_TOP_TRANSFER_END;
+ break;
+ case STAGE_LOAD_TOP_CELOXICA:
+ sm_address = SMARTMEDIA_ADDRESS_TOP_CELOXICA_START;
+ address = ADDRESS_ABOUT_TOP_CELOXICA_START;
+ address_end = ADDRESS_ABOUT_TOP_CELOXICA_END;
+ break;
/*
- case ADDRESS_ABOUT_TOP_DETAILS_START:
- address = 0;
- address_offset = ADDRESS_ABOUT_TOP_DETAILS_START;
- smartmedia_address = SMARTMEDIA_ADDRESS_TOP_DETAILS_START;
- smartmedia_address_mask = SMARTMEDIA_ADDRESS_TOPMASK_START;
- stage = STAGE_LOAD_TOP_DETAILS;
- break;
+ case STAGE_LOAD_TOP_DETAILS:
+ sm_address = SMARTMEDIA_ADDRESS_TOP_DETAILS_START;
+ address = ADDRESS_ABOUT_TOP_DETAILS_START;
+ address_end = ADDRESS_ABOUT_TOP_DETAILS_END;
+ break;
*/
- case ADDRESS_ABOUT_BOTTOM_START:
-#if HAVE_DEBUG
- print_string(" ADDRESS_ABOUT_BOTTOM_START");print_eol();
-#endif
- address = 0;
- address_offset = ADDRESS_ABOUT_BOTTOM_START;
- smartmedia_address = SMARTMEDIA_ADDRESS_BOTTOM_START;
- smartmedia_address_mask = SMARTMEDIA_ADDRESS_BOTTOMMASK_START;
- stage = STAGE_LOAD_ABOUT_BOTTOM;
- break;
- default:
- break;
- }
- }
-
- /*
- * Before reading our data from the smartmedia we set our
- * address pointer to the address from our loop.
- */
-
-#if HAVE_SMARTMEDIA
- PalPL2RAMSetWriteAddress(RAM_BANK0, address_offset +address); //(STAGE_LOAD_GRAPH == stage) ? (address_offset +(0 @ (address \\ 2))) :
-#else
- PalPL2RAMSetWriteAddress(RAM_BANK0, 0);
-#endif
-
- /*
- * SmartMedia data is read one byte per call. Because we want
- * to store the mask + the rgb values in one variable for later
- * useage we need to read those 4 bytes from the smartmedia
- * before storing it as one.
- */
-#if HAVE_SMARTMEDIA
- /*
- * FIXME: Due to a bug in the DK2 smartmedia libraries we need
- * stop reading after each byte with OperationEnd call. This is
- * VERY slow and must be changed.
- */
-
- RC200SmartMediaSetAddress(READ, smartmedia_address_mask);
- RC200SmartMediaRead(&mask, TRUE);
- RC200SmartMediaOperationEnd(&result);
-
- if ((STAGE_LOAD_PRESET != stage) && (STAGE_LOAD_GRAPH != stage)) {
- RC200SmartMediaSetAddress(READ, smartmedia_address);
- RC200SmartMediaRead(&r, TRUE);
- RC200SmartMediaOperationEnd(&result);
- RC200SmartMediaSetAddress(READ, (smartmedia_address +1));
- RC200SmartMediaRead(&g, TRUE);
- RC200SmartMediaOperationEnd(&result);
- RC200SmartMediaSetAddress(READ, (smartmedia_address +2));
- RC200SmartMediaRead(&b, TRUE);
- RC200SmartMediaOperationEnd(&result);
+ case STAGE_LOAD_ABOUT_BOTTOM:
+ sm_address = SMARTMEDIA_ADDRESS_BOTTOM_START;
+ address = ADDRESS_ABOUT_BOTTOM_START;
+ address_end = ADDRESS_ABOUT_BOTTOM_END;
+ break;
+ default:
+ break;
}
- if (STAGE_LOAD_GRAPH == stage) {
- RC200SmartMediaSetAddress(READ, smartmedia_address_mask +1);
- RC200SmartMediaRead(&r, TRUE);
- RC200SmartMediaOperationEnd(&result);
- RC200SmartMediaSetAddress(READ, (smartmedia_address_mask +2));
- RC200SmartMediaRead(&g, TRUE);
- RC200SmartMediaOperationEnd(&result);
- RC200SmartMediaSetAddress(READ, (smartmedia_address_mask +3));
- RC200SmartMediaRead(&b, TRUE);
- RC200SmartMediaOperationEnd(&result);
+ if (physical_format) {
+ RC200SmartMediaSetAddress(READ, sm_address);
+ } else {
+ RC200SmartMediaSetLogicalAddress(READ, sm_address);
}
+
+ while (address != address_end) {
-
- switch (stage) {
- case STAGE_LOAD_PRESET:
+ RC200SmartMediaRead(&mask, FALSE);
+ if ((STAGE_LOAD_DEMO_PRESET == stage) || (STAGE_LOAD_RESET_PRESET == stage)) {
presets_default_values[address <- 10] = mask;
- break;
- case STAGE_LOAD_SKIN: /* fall through */
- case STAGE_LOAD_HELP: /* fall through */
- case STAGE_LOAD_GRAPH: /* fall through */
- case STAGE_LOAD_TOP_FONTYS: /* fall through */
- case STAGE_LOAD_TOP_TASS: /* fall through */
- case STAGE_LOAD_TOP_TRANSFER: /* fall through */
- case STAGE_LOAD_TOP_CELOXICA: /* fall through */
- case STAGE_LOAD_TOP_DETAILS: /* fall through */
- case STAGE_LOAD_ABOUT_BOTTOM:
+ } else {
+ RC200SmartMediaRead(&r, FALSE);
+ RC200SmartMediaRead(&g, FALSE);
+ RC200SmartMediaRead(&b, FALSE);
+
+ PalPL2RAMSetWriteAddress(RAM_BANK0, address);
data = 0 @ mask @ r @ g @ b;
- break;
- // case STAGE_LOAD_GRAPH:
- // data = ((address <- 2) ? ((data << 8) +(0 @ mask)) : (0 @ mask));
- // break;
- }
-
-#else
- data = 0x0000ff00;
-#endif
- /*
- * Now that we have gathered all pixel data, store it in ram.
- */
- PalPL2RAMWrite(RAM_BANK0, data);
+ PalPL2RAMWrite(RAM_BANK0, data);
+ }
-#if HAVE_DEBUG
- /*
- * Print some nice stats about data loading.
- */
- if (!((address_offset +address) <- 10)) {
- print_cr();
- print_hex_value(0 @ ((address_offset +address) \\ 11));
- print_string(" / 000001D7 | data: ");
- print_hex_value(data <- 32);
- print_string(" | PL2: ");
- print_hex_value(0@(address_offset));
- print_string(" | SMC: ");
- print_hex_value(0@smartmedia_address);
- }
+ address++;
+#if HAVE_DEBUG
+ /*
+ * Print some indication about data loading.
+ */
+ if (!(address <- 14)) {;
+ print_string(".");
+ }
#endif
-
- /*
- * Finally increase al our indexes approperiatly.
- */
- if (STAGE_LOAD_GRAPH == stage) {
- smartmedia_address_mask += 4;
- } else {
- smartmedia_address += 3;
- smartmedia_address_mask++;
}
- address++;
+ RC200SmartMediaRead(&mask, TRUE);
+ RC200SmartMediaOperationEnd(&result);
+
+ stage++;
}
/*
- * This block needs to probably move up into the fore loop where we
- * calculate these settings later.
+ * This block needs to probably move up into the for loop where we
+ * calculate these settings determind by the image data..
*/
skindata->spectrum.top = 200;
skindata->spectrum.bottom = 335;
@@ -336,11 +204,17 @@ void smartmedia_loaddata(skindata_t *skindata) {
skindata->waveform.right = 413;
skindata->waveform.color_primary = PIXEL_WAVEFORM;
- skindata->volume.top = 112;
- skindata->volume.bottom = 66;
- skindata->volume.left = 439;
- skindata->volume.right = 455;
+ skindata->volume.top = 66;
+ skindata->volume.bottom = 112;
+ skindata->volume.left = 431;
+ skindata->volume.right = 448;
skindata->volume.color_primary = PIXEL_VOLUME;
+ skindata->inputgain.top = 66;
+ skindata->inputgain.bottom = 112;
+ skindata->inputgain.left = 450;
+ skindata->inputgain.right = 467;
+ skindata->inputgain.color_primary = PIXEL_INPUTGAIN;
+
skindata->equalizer.color_primary = PIXEL_EQUALIZER;
} /* --- smartmedia_loaddata() --- */