summaryrefslogtreecommitdiffstats
path: root/Graphic_Equalizer/src/smartmedia.hcc
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2004-12-09 14:00:26 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2004-12-09 14:00:26 (GMT)
commitb0ae032ae5712e38471c9347af289f3e50b0a08a (patch)
tree5f98113107975ddcc484cffb27625e09d015f504 /Graphic_Equalizer/src/smartmedia.hcc
parent593d5fded11b8723ce27883e06865ab205c6f008 (diff)
downloadTASS-b0ae032ae5712e38471c9347af289f3e50b0a08a.zip
TASS-b0ae032ae5712e38471c9347af289f3e50b0a08a.tar.gz
TASS-b0ae032ae5712e38471c9347af289f3e50b0a08a.tar.bz2
Added defines makeing it possible to split the application in various parts namely:
Loader (loads data from the smart media into ram) Equalizer (The 'normal' known application) Visualization (The graphical visualization)
Diffstat (limited to 'Graphic_Equalizer/src/smartmedia.hcc')
-rw-r--r--Graphic_Equalizer/src/smartmedia.hcc233
1 files changed, 0 insertions, 233 deletions
diff --git a/Graphic_Equalizer/src/smartmedia.hcc b/Graphic_Equalizer/src/smartmedia.hcc
deleted file mode 100644
index ff405c1..0000000
--- a/Graphic_Equalizer/src/smartmedia.hcc
+++ /dev/null
@@ -1,233 +0,0 @@
-/*! \file smartmedia.hcc
- *
- * \section generic Here we interface with the SmartMedia card.
- *
- * \section project Project information.
- * Project Graphic Equalizer\n
- * \author O.M. Schinagl
- * \date 20041110
- * \version 0.1
- *
- * \section copyright Copyright
- * Copyright ©2004 Koninklijke Philips Electronics N.V. All rights reserved
- *
- * \section history Change history
- * 20041110: O.M. Schinagl\n Initial version
- *
- ********************************************************************/
-
-/******** System Includes *************/
-#include <stdlib.hch>
-
-#include "pal_master.hch"
-
-/******** Application Includes ********/
-#include "configuration.hch"
-#include "display_shared.hch"
-#include "smartmedia_shared.hch"
-#include "smartmedia.hch"
-
-#if HAVE_DEBUG
- #include "debug.hch"
-#endif
-
-#include "audio.hch"
-#include "mouse_shared.hch"
-#include "eventhandler_shared.hch"
-#include "display.hch" /* FIXME: temporary include, needs to be moved to 'init' */
-
-/*! \fn unsigned 1 smartmedia_init(void);
- * \brief We here initialize the Smart Media card and verify wether the
- * card is inserted and such.
- *
- * \return We return 0 on success, 1 on error.
- * \retval unsigned 1
- */
-unsigned 1 smartmedia_init(void) {
- unsigned 1 retval;
- /*
- * Firstly we enable both the CPLD and the SmartMedia.
- */
- RC200CPLDEnable();
- RC200SmartMediaInit(&retval);
-
- if (retval) {
- RC200SmartMediaReset(&retval);
- RC200SmartMediaInit(&retval);
- }
-
- return retval;
-} /* --- smartmedia_init() --- */
-
-
-
-/*! \fn void smartmedia_loaddata(skindata_t *skindata);
- * \brief We load our memory with skin and help data from the smartmedia.
- *
- * \param *skindata skindata like boundries and colors of elements.
- *
- * \return void
- * \retval void
- */
-void smartmedia_loaddata(skindata_t *skindata) {
- /*
- * Setup RAM Handle, and determin maximum Data and Address widths
- */
- macro expr RAM_BANK0 = PalPL2RAMCT(0);
- macro expr DW = PalPL2RAMGetMaxDataWidthCT();
- macro expr AW = PalPL2RAMGetMaxAddressWidthCT();
-
- unsigned DW data;
- unsigned 27 smartmedia_address, smartmedia_address_mask;
- unsigned AW address;
- unsigned 8 mask, r, g, b;
- unsigned 3 stage;
- 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.
- */
- smartmedia_address = SMARTMEDIA_ADDRESS_SKIN_START;
- smartmedia_address_mask = SMARTMEDIA_ADDRESS_SKINMASK_START;
- stage = STAGE_LOAD_SKIN;
- /*
- * We start with the address of the skin, and do the loop until we have
- * done the end of the help.
- */
- for (address = ADDRESS_SKIN_START; address != (ADDRESS_PRESET_RESET_END +1); address++) {
- /*
- * Once we are done with the loading of our skin, we need to
- * change the smartmedia start addresses.
- */
- switch (address) {
- case 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:
- smartmedia_address_mask = SMARTMEDIA_ADDRESS_GRAPHMASK_START;
- stage = STAGE_LOAD_GRAPH;
- break;
- case ADDRESS_PRESET_DEMO_START:
- smartmedia_address_mask = SMARTMEDIA_ADDRESS_PRESET_DEMO_START;
- stage = STAGE_LOAD_PRESET;
- break;
- case ADDRESS_PRESET_RESET_START:
- smartmedia_address_mask = SMARTMEDIA_ADDRESS_PRESET_RESET_START;
- stage = STAGE_LOAD_PRESET;
- 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);
-#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.
- */
- if ((STAGE_LOAD_SKIN == stage) || (STAGE_LOAD_HELP == 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);
- }
- RC200SmartMediaSetAddress(READ, smartmedia_address_mask);
- RC200SmartMediaRead(&mask, TRUE);
- RC200SmartMediaOperationEnd(&result);
-
- switch (stage) {
- case STAGE_LOAD_SKIN:
- data = 0 @ mask @ r @ g @ b;
- break;
- case STAGE_LOAD_HELP:
- data = 0 @ mask @ r @ g @ b;
- break;
- case STAGE_LOAD_GRAPH:
- data = (unsigned DW)(0 @ mask) << 24;
- break;
- case STAGE_LOAD_PRESET:
- presets_default_values[(address -ADDRESS_PRESET_DEMO_START) <- 10] = mask;
- }
-
-#else
- data = 0x0000ff00;
-#endif
- /*
- * Now that we have gathered all pixel data, store it in ram.
- */
- PalPL2RAMWrite(RAM_BANK0, data);
-
-#if HAVE_DEBUG
- /*
- * Print some nice stats about data loading.
- */
- if (!(address <- 10)) {
- print_cr();
- print_hex_value(0 @ (address \\ 11));
- print_string(" / 000001C2 | data: ");
- print_hex_value(data <- 32);
- }
-#endif
-
- /*
- * Finally increase al our indexes approperiatly.
- */
- smartmedia_address += 3;
- smartmedia_address_mask++;
- }
-
- /*
- * This block needs to probably move up into the fore loop where we
- * calculate these settings later.
- */
- skindata->area_spectrum_top = 200;
- skindata->area_spectrum_bottom = 335;
- skindata->area_spectrum_left = 77;
- skindata->area_spectrum_right = 575;
- skindata->area_waveform_top = 46;
- skindata->area_waveform_bottom = 118;
- skindata->area_waveform_left = 76;
- skindata->area_waveform_right = 413;
- skindata->area_volume_top = 112;
- skindata->area_volume_bottom = 66;
- skindata->area_volume_left = 439;
- skindata->area_volume_right = 455;
- skindata->color_area_volume = PIXEL_VOLUME;
- skindata->color_area_waveform = PIXEL_WAVEFORM;
-// skindata->color_area_spectrum_top = PIXEL_SPECTRUM;
-// skindata->color_area_spectrum_bottom = PIXEL_SPECTRUM;
- skindata->color_equalizer = PIXEL_EQUALIZER;
-} /* --- smartmedia_loaddata() --- */