summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2005-01-18 16:00:02 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2005-01-18 16:00:02 (GMT)
commit53313f1415eca1cf26d91ca58793c20248161596 (patch)
tree450ebc397215511530acdccd35c7b2c65bef8f92
parent0d787bc6133900527a7d0a4cbadc3d5a9d344cef (diff)
downloadTASS-53313f1415eca1cf26d91ca58793c20248161596.zip
TASS-53313f1415eca1cf26d91ca58793c20248161596.tar.gz
TASS-53313f1415eca1cf26d91ca58793c20248161596.tar.bz2
Added internal audio play functionality.
Still issue when playing sound. Appears to be signed /unsigned conversion problem. Do not use this functionality yet!
-rw-r--r--Graphic_Equalizer/src/smartmedia.hcc101
1 files changed, 84 insertions, 17 deletions
diff --git a/Graphic_Equalizer/src/smartmedia.hcc b/Graphic_Equalizer/src/smartmedia.hcc
index 77258cd..a69c79e 100644
--- a/Graphic_Equalizer/src/smartmedia.hcc
+++ b/Graphic_Equalizer/src/smartmedia.hcc
@@ -36,6 +36,9 @@
#include "eventhandler_shared.hch"
#include "display.hch" /* FIXME: temporary include, needs to be moved to 'init' */
+
+unsigned 1 physical_format;
+
/*! \fn unsigned 1 smartmedia_init(void);
* \brief We here initialize the Smart Media card and verify wether the
* card is inserted and such.
@@ -43,7 +46,7 @@
* \return We return 0 on success, 1 on error.
* \retval unsigned 1
*/
-unsigned 1 smartmedia_init(void) {
+inline unsigned 1 smartmedia_init(void) {
unsigned 1 retval;
/*
* Firstly we enable both the CPLD.
@@ -58,6 +61,13 @@ unsigned 1 smartmedia_init(void) {
RC200SmartMediaReset(&retval);
delay;
RC200SmartMediaInit(&retval);
+
+
+ /*
+ * Before we enter our main Smart Media read loop we verify the format
+ * of the SMC. This to ensure we use the correct functions later.
+ */
+ RC200SmartMediaCheckLogicalFormat(&physical_format);
return retval;
} /* --- smartmedia_init() --- */
@@ -90,16 +100,9 @@ void smartmedia_loaddata(skindata_t *skindata) {
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];
-
- /*
- * Before we enter our main Smart Media read loop we verify the format
- * of the SMC. This to ensure we use the correct functions later.
- */
- RC200SmartMediaCheckLogicalFormat(&physical_format);
+ extern ram unsigned 8 presets_default_values[768];
/*
* We have several stages to go through. We stop once we pass the last
@@ -214,14 +217,6 @@ void smartmedia_loaddata(skindata_t *skindata) {
presets_default_values[address <- 10] = mask;
} else {
/*
- * There needs to be atleast one clock cycle
- * between setting the address and reading
- * from it. We therefore set the address before
- * reading from the SmartMedia as 'delay'.
- */
- PalPL2RAMSetWriteAddress(RAM_BANK0, address);
-
- /*
* All other data has RGB image data and thus
* we read those additional bytes from the SMC.
* The image used for the graphic visualization
@@ -233,6 +228,14 @@ void smartmedia_loaddata(skindata_t *skindata) {
RC200SmartMediaRead(&b, FALSE);
/*
+ * There needs to be atleast one clock cycle
+ * between setting the address and reading
+ * from it. We therefore set the address before
+ * reading from the SmartMedia as 'delay'.
+ */
+ PalPL2RAMSetWriteAddress(RAM_BANK0, address);
+
+ /*
* FIXME: Do we need this even?
*/
data = 0 @ mask @ r @ g @ b;
@@ -311,3 +314,67 @@ void smartmedia_loaddata(skindata_t *skindata) {
skindata->equalizer.color_primary = PIXEL_EQUALIZER;
} /* --- smartmedia_loaddata() --- */
+
+/*
+smartmedia_load_block() {
+
+ setaddress();
+ for () {
+ smart_read();
+ }
+ end();
+}*/
+
+
+unsigned 1 load_audio_samples(signed 18 *samples, unsigned 27 blockoffset, unsigned 7 sample_count) {
+ ram unsigned 8 data[128];
+
+ unsigned 16 sampleword;
+ unsigned 8 sampleindex, samplebyte, samplecount;
+ unsigned 1 result;
+ unsigned 1 retval;
+
+ samplecount = (0 @ sample_count) <<1;
+ sampleindex = 0;
+ retval = 0;
+
+ if (!blockoffset) {
+// print_string("Setting Address");
+ if (physical_format)
+ {
+ RC200SmartMediaSetAddress(READ, SMARTMEDIA_ADDRESS_AUDIO_START);
+ } else {
+ RC200SmartMediaSetLogicalAddress(READ, SMARTMEDIA_ADDRESS_AUDIO_START);
+ }
+ }
+
+ smartmedia_read_bytes(data, samplecount);
+
+ while (sampleindex != samplecount) {
+ samplebyte = data[sampleindex <- 7];
+ sampleword = samplebyte @ data[(sampleindex +1) <- 7];
+ samples[sampleindex >>1] = (signed 18)(sampleword @ 0);
+ sampleindex +=2;
+ }
+
+ if (((blockoffset <<7) +(0 @ samplecount) +SMARTMEDIA_ADDRESS_AUDIO_START) >= SMARTMEDIA_ADDRESS_AUDIO_END) {
+ RC200SmartMediaRead(&samplebyte, TRUE);
+ RC200SmartMediaOperationEnd(&result);
+ retval = 1;
+// print_string("Operation end");
+ }
+ return retval;
+}
+
+void smartmedia_read_bytes(unsigned 8 *data, unsigned 8 bytecount)
+{
+ unsigned 8 byteindex;
+
+ byteindex = 0;
+ while (byteindex != bytecount) {
+ RC200SmartMediaRead(&data[byteindex], FALSE);
+ byteindex++;
+ }
+// print_eol();
+// print_string(".");
+} \ No newline at end of file