summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2004-11-26 16:04:09 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2004-11-26 16:04:09 (GMT)
commit2486259bcf847d66502f4d64311da4a5b920f884 (patch)
treee1fcf9e4f9dc5886413874dd5c99759264b5f87d
parentc2322b876d59479db2052e3b9828c902da245484 (diff)
downloadTASS-2486259bcf847d66502f4d64311da4a5b920f884.zip
TASS-2486259bcf847d66502f4d64311da4a5b920f884.tar.gz
TASS-2486259bcf847d66502f4d64311da4a5b920f884.tar.bz2
changed macro proc's to functions.
replaced for loops for while loops.
-rw-r--r--Graphic_Equalizer/src/audio.hcc2
-rw-r--r--Graphic_Equalizer/src/main.hcc10
-rw-r--r--Graphic_Equalizer/src/mouse.hcc20
-rw-r--r--Graphic_Equalizer/src/smartmedia.hcc76
4 files changed, 62 insertions, 46 deletions
diff --git a/Graphic_Equalizer/src/audio.hcc b/Graphic_Equalizer/src/audio.hcc
index 21d8a8d..ef8b530 100644
--- a/Graphic_Equalizer/src/audio.hcc
+++ b/Graphic_Equalizer/src/audio.hcc
@@ -82,7 +82,7 @@ macro proc audio_main(audiodata, AUDIOIN, AUDIOOUT) {
signed IW sample_left_in, sample_right_in;
signed OW sample_left_out, sample_right_out;
- for (;;) {
+ while (TRUE) {
PalAudioInRead(AUDIOIN, &sample_left_in, &sample_right_in);
/* par {
diff --git a/Graphic_Equalizer/src/main.hcc b/Graphic_Equalizer/src/main.hcc
index 3bb1dca..3593637 100644
--- a/Graphic_Equalizer/src/main.hcc
+++ b/Graphic_Equalizer/src/main.hcc
@@ -134,13 +134,13 @@ void main(void) {
* Once we properly setup the SmartMedia we load our
* data folowed by our main program loop.
*/
- smartmedia_init(result);
+ result = smartmedia_init();
if (!result) {
#endif
#if HAVE_DEBUG
print_string("Loading Skin ...");
#endif
- smartmedia_loaddata(skindata, RAM_BANK0);
+ smartmedia_loaddata(&skindata);
#if HAVE_DEBUG
print_eol();
print_string("Done Loading Skin ...");
@@ -158,9 +158,9 @@ void main(void) {
* and display in parallel. None of these
* should ever return.
*/
- mouse_main(mousedata);
- display_main(skindata, audiodata, events, mousedata, ClockRate, VideoOut, RAM_BANK0);
- eventhandler_main(audiodata, events, mousedata);
+ mouse_main(&mousedata);
+ display_main(&skindata, &audiodata, &events, &mousedata);
+ eventhandler_main(&audiodata, &events, &mousedata);
audio_main(audiodata, AudioIn, AudioOut);
}
#if HAVE_SMARTMEDIA
diff --git a/Graphic_Equalizer/src/mouse.hcc b/Graphic_Equalizer/src/mouse.hcc
index 2deebb9..0469fda 100644
--- a/Graphic_Equalizer/src/mouse.hcc
+++ b/Graphic_Equalizer/src/mouse.hcc
@@ -45,8 +45,7 @@
* \return Never Returns.
* \retval void
*/
-macro proc mouse_main(mousedata)
-{
+void mouse_main(mousedata_t *mousedata) {
unsigned 18 touch_sampler;
unsigned 10 x, oldx;
unsigned 9 y, oldy;
@@ -59,7 +58,8 @@ macro proc mouse_main(mousedata)
* using newer libs this might be overkill, e.g. smaller values may
* work or sampling all together will be redundant.
*/
- for(touch_sampler = 1;; touch_sampler++) {
+ touch_sampler = 1;
+ while (TRUE) {
if (!touch_sampler) {
/*
* We are here ready to set mouse states. We compare
@@ -103,15 +103,15 @@ macro proc mouse_main(mousedata)
* can only do this when the display has handled all
* changes.
*/
- if (((oldmousestate != mousestate) || (oldx != x) || (oldy != y)) && (MOUSE_NOT_UPDATED == mousedata.status)) {
+ if (((oldmousestate != mousestate) || (oldx != x) || (oldy != y)) && (MOUSE_NOT_UPDATED == mousedata->status)) {
//par {
oldx = x;
oldy = y;
oldmousestate = mousestate;
- mousedata.x = x;
- mousedata.y = 0 @ y;
- mousedata.state = mousestate;
- mousedata.status = MOUSE_UPDATED;
+ mousedata->x = x;
+ mousedata->y = 0 @ y;
+ mousedata->state = mousestate;
+ mousedata->status = MOUSE_UPDATED;
//}
}
}
@@ -125,5 +125,7 @@ macro proc mouse_main(mousedata)
if (touch) {
touched = TRUE;
}
+
+ touch_sampler++;
}
-} /* --- mouse_main_loop() --- */
+} /* --- mouse_main() --- */
diff --git a/Graphic_Equalizer/src/smartmedia.hcc b/Graphic_Equalizer/src/smartmedia.hcc
index 9cbc986..efc0e3d 100644
--- a/Graphic_Equalizer/src/smartmedia.hcc
+++ b/Graphic_Equalizer/src/smartmedia.hcc
@@ -23,16 +23,19 @@
/******** Application Includes ********/
#include "configuration.hch"
+#include "display_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 void smartmedia_init(void);
+/*! \fn unsigned 1 smartmedia_init(void);
* \brief We here initialize the Smart Media card and verify wether the
* card is inserted and such.
*
@@ -41,33 +44,37 @@
* \return We return 0 on success, 1 on error.
* \retval unsigned 1
*/
-macro proc smartmedia_init(result) {
+unsigned 1 smartmedia_init(void) {
+ unsigned 1 retval;
/*
* Firstly we enable both the CPLD and the SmartMedia.
*/
RC200CPLDEnable();
- RC200SmartMediaInit(&result);
+ RC200SmartMediaInit(&retval);
- if (result) {
- RC200SmartMediaReset(&result);
- RC200SmartMediaInit(&result);
- }
+ if (retval) {
+ RC200SmartMediaReset(&retval);
+ RC200SmartMediaInit(&retval);
+ }
+
+ return retval;
} /* --- smartmedia_init() --- */
-/*! \fn void smartmedia_loaddata(RAM_BANK0);
+/*! \fn void smartmedia_loaddata(skindata_t *skindata);
* \brief We load our memory with skin and help data from the smartmedia.
*
- * \param RAM_BANK0 Handle to RAM_BANK0
+ * \param skindata_t *skindata pointer to skindata struct.
*
* \return void
* \retval void
*/
-macro proc smartmedia_loaddata(skindata, RAM_BANK0) {
+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();
@@ -120,9 +127,12 @@ macro proc smartmedia_loaddata(skindata, RAM_BANK0) {
* address pointer to the address from our loop.
*/
#if SKIP_LOAD
- PalPL2RAMSetWriteAddress(RAM_BANK0, 0);
+ if (STAGE_LOAD_PRESET == stage) {
+ PalPL2RAMSetWriteAddress(RAM_BANK0, address);
+ } else {
+ PalPL2RAMSetWriteAddress(RAM_BANK0, 0);
+ }
#else
-/* Warning: Make sure the proper images are loaded into ram before calling! */
PalPL2RAMSetWriteAddress(RAM_BANK0, address);
#endif
@@ -171,7 +181,11 @@ macro proc smartmedia_loaddata(skindata, RAM_BANK0) {
}
#else
- data = 0x0000ff00;
+ if (STAGE_LOAD_PRESET == stage) {
+ data = (address <- 1) ? 0x000000ff : 0x00000000;
+ } else {
+ data = 0x0000ff00;
+ }
#endif
/*
* Now that we have gathered all pixel data, store it in ram.
@@ -185,7 +199,7 @@ macro proc smartmedia_loaddata(skindata, RAM_BANK0) {
if (!(address <- 11)) {
print_cr();
print_hex_value(0 @ (address \\ 12));
- print_string(" / 000000AF | data: ");
+ print_string(" / 000000E1 | data: ");
print_hex_value(data <- 32);
}
#endif
@@ -201,21 +215,21 @@ macro proc smartmedia_loaddata(skindata, RAM_BANK0) {
* 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;
+ 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() --- */