summaryrefslogtreecommitdiffstats
path: root/Graphic_Equalizer/src
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2004-11-11 10:27:31 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2004-11-11 10:27:31 (GMT)
commit9877678730e53e9ee99241a8ab5babe35eacf28d (patch)
tree275313725d8a1816a665b892c6116549e26f24a7 /Graphic_Equalizer/src
parent51085a870cc074c3eeef5a6ba1b45503ce0e0f4d (diff)
downloadTASS-9877678730e53e9ee99241a8ab5babe35eacf28d.zip
TASS-9877678730e53e9ee99241a8ab5babe35eacf28d.tar.gz
TASS-9877678730e53e9ee99241a8ab5babe35eacf28d.tar.bz2
Diffstat (limited to 'Graphic_Equalizer/src')
-rw-r--r--Graphic_Equalizer/src/display.hcc92
-rw-r--r--Graphic_Equalizer/src/eventhandler.hcc27
-rw-r--r--Graphic_Equalizer/src/main.hcc12
-rw-r--r--Graphic_Equalizer/src/mouse.hcc18
-rw-r--r--Graphic_Equalizer/src/smartmedia.hcc19
5 files changed, 93 insertions, 75 deletions
diff --git a/Graphic_Equalizer/src/display.hcc b/Graphic_Equalizer/src/display.hcc
index 12f440c..3260990 100644
--- a/Graphic_Equalizer/src/display.hcc
+++ b/Graphic_Equalizer/src/display.hcc
@@ -34,7 +34,17 @@
-/*! \fn void display_main(events_t *events, mousedata_t *mousedata, ClockRate, RAM_BANK0);
+/*
+ * Channel to notify others when new mousedata is available. If so
+ * Then mousedata struct is updated with shared data.
+ */
+chan unsigned 1 maskupdate_notification;
+
+
+
+/*! \fn void display_main(events_t *events,
+ * mousedata_t *mousedata, ClockRate, RAM_BANK0);
+ *
* \brief This routine handles all drawing of pixels. It never returns!
*
* \param events_t *events struct with all events.
@@ -44,13 +54,12 @@
* \return Never Returns.
* \retval void
*/
-macro proc display_main(events, mousedata, CLOCKRATE, RAM_BANK0) {
+macro proc display_main(events, mousedata, CLOCKRATE, VIDEOOUT, RAM_BANK0) {
/*
* Setup macro's RAM/Video handles and to coordinate pixel writing.
*/
macro expr DW = PalPL2RAMGetMaxDataWidthCT();
macro expr AW = PalPL2RAMGetMaxAddressWidthCT();
- macro expr VIDEOOUT = PalVideoOutOptimalCT(CLOCKRATE);
macro expr VISIBLEX = PalVideoOutGetVisibleX(VIDEOOUT, CLOCKRATE);
macro expr TOTALX = PalVideoOutGetTotalX(VIDEOOUT, CLOCKRATE);
macro expr TOTALY = PalVideoOutGetTotalY(VIDEOOUT);
@@ -66,7 +75,7 @@ macro proc display_main(events, mousedata, CLOCKRATE, RAM_BANK0) {
* area's on the screen. Otherwise we only use the last 24 bits, the RGB values
* to draw on the screen.
*/
-#if USE_MASK_ONLY && HAVE_SMARTMEDIA
+#if (USE_MASK_ONLY && HAVE_SMARTMEDIA)
#define PIXEL (0 @ pixeldata[31:24])
#else
#define PIXEL (pixeldata <- 24)
@@ -82,16 +91,20 @@ macro proc display_main(events, mousedata, CLOCKRATE, RAM_BANK0) {
for (;;) {
par {
/*
- * Before starting this loop we allready set the the address.
- * Therefor we can start reading the previously set address and
- * prepare the next address for the next cycle.
+ * Before starting this loop we allready set the the
+ * address. Therefor we can start reading the
+ * previously set address and prepare the next address
+ * for the next cycle.
*/
PalPL2RAMRead(RAM_BANK0, &pixeldata);
PalPL2RAMSetReadAddress(RAM_BANK0, address);
-/*
+
+ /*
+ * Determin what to draw where here.
+ */
switch (pixeldata[31:24]) {
case AREA_VOLUME_YAXIS:
- if (SCANY <= 0 @ events->volume_position) {
+ if (SCANY >= 0 @ events.volume_position) {
PalVideoOutWrite(VIDEOOUT, PIXEL_VOLUME_YAXIS);
} else {
PalVideoOutWrite(VIDEOOUT, PIXEL);
@@ -100,52 +113,63 @@ macro proc display_main(events, mousedata, CLOCKRATE, RAM_BANK0) {
default:
PalVideoOutWrite(VIDEOOUT, PIXEL);
break;
- }*/
- // PalVideoOutWrite(VIDEOOUT, pixeldata <- 24));
- print_hex_value(pixeldata <- 32);
+ }
/*
- *
- if ((SCANX == 0 @ mousedata->x) && (SCANY == 0 @ mousedata->y)) {
- events->mask = pixeldata[31:24];
+ * We compare our current X and Y scan positions of the
+ * output to the x and y data of the mouse. When those
+ * are equal we set the current mask to the mask stored
+ * in memory at that location. We then know what mask
+ * is to be used for events.
+ */
+ if (MOUSE_UPDATED == mousedata.status) {
+ if ((SCANX == 0 @ mousedata.x) && (SCANY == 0 @ mousedata.y)) {
+ par {
+ events.mask = pixeldata[31:24];
+ maskupdate_notification ! MOUSE_UPDATED;
+ mousedata.status = MOUSE_NOT_UPDATED;
+ }
+ } else {
+ delay;
+ }
} else {
delay;
}
/*
- * The current position of the screen can lay in an area called
- * the blanking area. We don't have data for this area as it is
- * not drawn. We therefor have to determin wether we are beyond
- * the visible area of the screen, but before the end of the
- * total width of the screen.
- * Our pipeline consists of 4 total stages. Therefor we have to
- * substract 4 pixels.
+ * The current position of the screen can lay in an
+ * area called the blanking area. We don't have data
+ * for this area as it is not drawn. We therefor have
+ * to determin wether we are beyond the visible area of
+ * the screen, but before the end of the total width of
+ * the screen. Our pipeline consists of 4 total stages.
+ * Therefor we have to substract 4 pixels.
*/
if ((SCANX > (VISIBLEX - 4)) && (SCANX <= (TOTALX - 4))) {
/*
- * We are in the blanking area of the screen. If we are
- * on the last line, and thus last pixel we reset our
- * address counter.
+ * We are in the blanking area of the screen.
+ * If we are on the last line, and thus last
+ * pixel we reset our address counter.
*/
if (SCANY == (TOTALY -1)) {
/*
- * The reset address is determined by the help
- * bit.
+ * The reset address is determined by
+ * the help bit.
*/
- address = 0;//(events->help) ? ADDRESS_HELP_START : ADDRESS_SKIN_START;
+ address = (events.help) ? ADDRESS_HELP_START : ADDRESS_SKIN_START;
} else {
/*
- * We should not ever get inhere. To keep
- * everything consequent however, we add a
- * a delay.
+ * We should not ever get inhere. To
+ * keep everything consequent however,
+ * we add a delay.
*/
delay;
}
} else {
/*
- * Increase the memory counter for each pixel drawn
- * thus keeping the memory location in sync with
- * the current pixel position.
+ * Increase the memory counter for each pixel
+ * drawn thus keeping the memory location in
+ * sync with the current pixel position.
*/
address++;
}
diff --git a/Graphic_Equalizer/src/eventhandler.hcc b/Graphic_Equalizer/src/eventhandler.hcc
index b9b6b1f..b614d28 100644
--- a/Graphic_Equalizer/src/eventhandler.hcc
+++ b/Graphic_Equalizer/src/eventhandler.hcc
@@ -24,12 +24,17 @@
#include "pal_master.hch"
/******** Application Includes ********/
+#include "configuration.hch"
#include "mouse_shared.hch"
#include "display_shared.hch"
#include "eventhandler_shared.hch"
#include "eventhandler.hch"
+#if HAVE_DEBUG
+ #include "debug.hch"
+#endif
+extern chan unsigned 1 maskupdate_notification;
/*! \fn void eventhandler_main(events_t *events, mousedata_t *mousedata);
* \brief
@@ -40,26 +45,24 @@
* \return Never Returns.
* \retval void
*/
-void eventhandler_main(events_t *events, mousedata_t *mousedata) {
- extern chan unsigned 1 mousedata_notification;
-
+macro proc eventhandler_main(events, mousedata) {
unsigned 5 volume_left;
- unsigned 1 newmousedata;
+ unsigned 1 newmaskupdate;
for (;;) {
- mousedata_notification ? newmousedata;
+ maskupdate_notification ? newmaskupdate;
/*
* First we determine what mousestate we currently have. Then
* we check where we are to decide what to do.
*/
- switch (mousedata->state) {
+ switch (mousedata.state) {
case MOUSE_STATE_ON_PRESS:
/*
* If the current mask equals the help button
* we flip the help bit.
*/
- if (BUTTON_HELP == events->mask) {
- events->help = !events->help;
+ if (BUTTON_HELP == events.mask) {
+ events.help = !events.help;
} else {
delay;
}
@@ -69,18 +72,18 @@ void eventhandler_main(events_t *events, mousedata_t *mousedata) {
* If we are in the volume area we update the
* volume level for both channels.
*/
- if (AREA_VOLUME_YAXIS) {
+ if (AREA_VOLUME_YAXIS == events.mask) {
/*
* Copy the current Y cursor position
* to the events struct. This we then
* later use for drawing purposes.
*/
- events->volume_position = 0 @ mousedata->y;
+ events.volume_position = 0 @ mousedata.y;
/*
* Look the relative y-coordinate up in
* the volumecontrol lookup table.
*/
- volume_left = volumecontrol_table[((mousedata->y) -65) <- 6];
+ volume_left = volumecontrol_table[((mousedata.y) -65) <- 6];
/*
* We feel that volume gets softer the
* closer it gets to the 0, and louder
@@ -92,7 +95,7 @@ void eventhandler_main(events_t *events, mousedata_t *mousedata) {
} else {
delay;
}
- if ((AREA_EQUALIZER_MIN <= events->mask) && (events->mask <= AREA_EQUALIZER_MAX)) {
+ if ((AREA_EQUALIZER_MIN <= events.mask) && (events.mask <= AREA_EQUALIZER_MAX)) {
delay;
} else {
delay;
diff --git a/Graphic_Equalizer/src/main.hcc b/Graphic_Equalizer/src/main.hcc
index d7a8600..9c18ca5 100644
--- a/Graphic_Equalizer/src/main.hcc
+++ b/Graphic_Equalizer/src/main.hcc
@@ -23,7 +23,6 @@
/******** System Includes *************/
#include "pal_master.hch"
-#include "pal_mouse.hch"
/******** Application Includes ********/
#include "configuration.hch"
@@ -94,9 +93,10 @@ void main(void) {
MouseRun(ClockRate);
PalAudioInRun(AudioIn, ClockRate);
PalAudioOutRun(AudioOut, ClockRate);
+ PalPL2RAMRun(RAM_BANK0, ClockRate);
#if HAVE_SMARTMEDIA
/*
- * The smartmedia device needs the CPLD to run.
+ * The smartmedia device needs the CPLD to run also.
*/
CPLDRun(ClockRate);
SmartMediaRun(ClockRate);
@@ -116,7 +116,7 @@ void main(void) {
* into the ram.
*/
#if HAVE_DEBUG
- print_eol();
+ print_cls();
print_string("Graphic Equalizer 2");
print_eol();
#endif
@@ -152,9 +152,9 @@ void main(void) {
* and display in parallel. None of these
* should ever return.
*/
- mouse_main(&mousedata);
- display_main(events, mousedata, ClockRate, RAM_BANK0);
- eventhandler_main(&events, &mousedata);
+ mouse_main(mousedata);
+ display_main(events, mousedata, ClockRate, VideoOut, RAM_BANK0);
+ eventhandler_main(events, mousedata);
audio_main();
}
#if HAVE_SMARTMEDIA
diff --git a/Graphic_Equalizer/src/mouse.hcc b/Graphic_Equalizer/src/mouse.hcc
index 7764ed6..8db9c51 100644
--- a/Graphic_Equalizer/src/mouse.hcc
+++ b/Graphic_Equalizer/src/mouse.hcc
@@ -30,14 +30,6 @@
-/*
- * Channel to notify others when new mousedata is available. If so
- * Then mousedata struct is updated with shared data.
- */
-chan unsigned 1 mousedata_notification;
-
-
-
/*! \fn void mouse_main(mousedata_t *mousedata);
* \brief Main mousedriver. This function never returns! It calls the
* main mousehandler and returns the States and coordinates
@@ -48,7 +40,7 @@ chan unsigned 1 mousedata_notification;
* \return Never Returns.
* \retval void
*/
-void mouse_main(mousedata_t *mousedata)
+macro proc mouse_main(mousedata)
{
unsigned 14 touch_sampler;
unsigned 10 x, oldx;
@@ -97,10 +89,10 @@ void mouse_main(mousedata_t *mousedata)
* Set the new as previous values for the next run.
*/
if ((oldmousestate != mousestate) || (oldx != x) || (oldy != y)) {
- mousedata->x = x;
- mousedata->y = y;
- mousedata->state = mousestate;
- mousedata_notification ! MOUSE_UPDATED;
+ mousedata.x = x;
+ mousedata.y = y;
+ mousedata.state = mousestate;
+ mousedata.status = MOUSE_UPDATED;
oldx = x;
oldy = y;
oldmousestate = mousestate;
diff --git a/Graphic_Equalizer/src/smartmedia.hcc b/Graphic_Equalizer/src/smartmedia.hcc
index 78682ba..5c547cc 100644
--- a/Graphic_Equalizer/src/smartmedia.hcc
+++ b/Graphic_Equalizer/src/smartmedia.hcc
@@ -77,6 +77,7 @@ macro proc smartmedia_loaddata(RAM_BANK0) {
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;
@@ -141,26 +142,25 @@ macro proc smartmedia_loaddata(RAM_BANK0) {
RC200SmartMediaSetAddress(READ, smartmedia_address_mask);
RC200SmartMediaRead(&mask, TRUE);
RC200SmartMediaOperationEnd(&result);
+
+ data = 0 @ mask @ r @ g @ b;
#else
- mask = 0x01;
- r = 0xff;
- g = 0x0f;
- b = 0x00;
+ data = 0xff000f00;
#endif
/*
* Now that we have gathered all pixel data, store it in ram.
*/
- PalPL2RAMWrite(RAM_BANK0, (unsigned DW)(0 @ mask @ r @ g @ b));
+ PalPL2RAMWrite(RAM_BANK0, data);
#if HAVE_DEBUG
/*
* Print some nice stats about data loading.
*/
- if (!address[12:0]) {
+ if (!address[11:0]) {
print_cr();
- print_hex_value(0 @ address[19:13]);
- print_string(" / 00000064 | data: ");
- print_hex_value(0 @ mask @ r @ g @ b);
+ print_hex_value(0 @ (address \\ 12));
+ print_string(" / 00000096 | data: ");
+ print_hex_value(data <- 32);
}
#endif
@@ -169,6 +169,5 @@ macro proc smartmedia_loaddata(RAM_BANK0) {
*/
smartmedia_address += 3;
smartmedia_address_mask++;
-
}
} /* --- smartmedia_loaddata() --- */