summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2004-10-21 09:38:26 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2004-10-21 09:38:26 (GMT)
commit8dc8d2307a1ff34a75b678659434996af3a2e734 (patch)
treebb4304dd2fadaaad15d621c3163532c59c3f832b
parenta651ae0a1d303f92043624dec87314e369bf2bca (diff)
downloadTASS-8dc8d2307a1ff34a75b678659434996af3a2e734.zip
TASS-8dc8d2307a1ff34a75b678659434996af3a2e734.tar.gz
TASS-8dc8d2307a1ff34a75b678659434996af3a2e734.tar.bz2
-rw-r--r--Graphic_Equalizer/Graphic_Equalizer.hp2
-rw-r--r--Graphic_Equalizer/Graphic_Equalizer.pref35
-rw-r--r--Graphic_Equalizer/include/audiodriver.hch80
-rw-r--r--Graphic_Equalizer/include/mousedriver.hch4
-rw-r--r--Graphic_Equalizer/include/mousedriver_shared.hch14
-rw-r--r--Graphic_Equalizer/src/audio/audiodriver.hcc84
-rw-r--r--Graphic_Equalizer/src/audio/main.hcc88
-rw-r--r--Graphic_Equalizer/src/audio/sample.hcc77
-rw-r--r--Support_Libs/debug/debug.hcc21
-rw-r--r--Support_Libs/debug/debug.hch18
10 files changed, 380 insertions, 43 deletions
diff --git a/Graphic_Equalizer/Graphic_Equalizer.hp b/Graphic_Equalizer/Graphic_Equalizer.hp
index 5427c0c..a151425 100644
--- a/Graphic_Equalizer/Graphic_Equalizer.hp
+++ b/Graphic_Equalizer/Graphic_Equalizer.hp
@@ -88,7 +88,7 @@ setting RC200E include:..\\..\\..\\include false
setting RC200E include:include true
command RC200E "cd RC200"
command RC200E "call edifmake_rc200 Graphic_Equalizer"
-output RC200E RC200\\Graphic_Equalizer.bit
+output RC200E bin\\Graphic_Equalizer.bit
document include\\display.hch {
type hch
}
diff --git a/Graphic_Equalizer/Graphic_Equalizer.pref b/Graphic_Equalizer/Graphic_Equalizer.pref
index 6a4b4d0..8cf1236 100644
--- a/Graphic_Equalizer/Graphic_Equalizer.pref
+++ b/Graphic_Equalizer/Graphic_Equalizer.pref
@@ -1,3 +1,11 @@
+[WorkState_v1_2.Frames.ChildFrames.Document-4]
+ptn_Child1=ViewFrame-0
+[WorkState_v1_2.Frames.ChildFrames.Document-4.ViewFrame-0]
+DocPathName=R:\c2hardw\Project_Marcel_&_Oliver\Project_CVS\Graphic_Equalizer\include\display_shared.hch
+DocumentString=
+DocTemplateIndex=5
+WindowPlacement=MCAAAAAAAAAAAAAABAAAAAAAPPPPPPPPPPPPPPPPMPPPPPPPJOPPPPPPCEAAAAAACEAAAAAAINCAAAAADIBAAAAA
+IsActiveChildFrame=False
[WorkState_v1_2]
ptn_Child1=Frames
ptn_Child2=DK Design Suite Preferences
@@ -10,22 +18,21 @@ ptn_Child1=Document-0
ptn_Child2=Document-1
ptn_Child3=Document-2
ptn_Child4=Document-3
-ptn_Child5=Document-4
[WorkState_v1_2.Frames.ChildFrames.Document-0]
ptn_Child1=ViewFrame-0
[WorkState_v1_2.Frames.ChildFrames.Document-0.ViewFrame-0]
-DocPathName=R:\c2hardw\Project_Marcel_&_Oliver\Project_CVS\Graphic_Equalizer\src\display\main.hcc
+DocPathName=R:\c2hardw\project_marcel_&_oliver\project_cvs\graphic_equalizer\src\display\main.hcc
DocumentString=
DocTemplateIndex=4
-WindowPlacement=MCAAAAAAAAAAAAAABAAAAAAAPPPPPPPPPPPPPPPPMPPPPPPPJOPPPPPPAAAAAAAAAAAAAAAACJCAAAAANDBAAAAA
+WindowPlacement=MCAAAAAAAAAAAAAABAAAAAAAPPPPPPPPPPPPPPPPMPPPPPPPJOPPPPPPGBAAAAAAGBAAAAAAMKCAAAAAFDBAAAAA
IsActiveChildFrame=False
[WorkState_v1_2.Frames.ChildFrames.Document-1]
ptn_Child1=ViewFrame-0
[WorkState_v1_2.Frames.ChildFrames.Document-1.ViewFrame-0]
-DocPathName=R:\c2hardw\Project_Marcel_&_Oliver\Project_CVS\Graphic_Equalizer\src\display\display.hcc
+DocPathName=R:\c2hardw\project_marcel_&_oliver\project_cvs\graphic_equalizer\src\display\display.hcc
DocumentString=
DocTemplateIndex=4
-WindowPlacement=MCAAAAAAAAAAAAAABAAAAAAAPPPPPPPPPPPPPPPPMPPPPPPPJOPPPPPPGBAAAAAAGBAAAAAAMKCAAAAAHFBAAAAA
+WindowPlacement=MCAAAAAAAAAAAAAABAAAAAAAPPPPPPPPPPPPPPPPMPPPPPPPJOPPPPPPMCAAAAAAMCAAAAAAGMCAAAAAPEBAAAAA
IsActiveChildFrame=False
[WorkState_v1_2.Frames.ChildFrames.Document-2]
ptn_Child1=ViewFrame-0
@@ -33,24 +40,16 @@ ptn_Child1=ViewFrame-0
DocPathName=R:\c2hardw\Project_Marcel_&_Oliver\Project_CVS\Graphic_Equalizer\src\display\mousedriver.hcc
DocumentString=
DocTemplateIndex=4
-WindowPlacement=MCAAAAAACAAAAAAADAAAAAAAPPPPPPPPPPPPPPPPMPPPPPPPJOPPPPPPIFAAAAAAIFAAAAAAOOCAAAAAJJBAAAAA
-IsActiveChildFrame=True
+WindowPlacement=MCAAAAAAAAAAAAAABAAAAAAAPPPPPPPPPPPPPPPPMPPPPPPPJOPPPPPPCEAAAAAACEAAAAAAMNCAAAAAFGBAAAAA
+IsActiveChildFrame=False
[WorkState_v1_2.Frames.ChildFrames.Document-3]
ptn_Child1=ViewFrame-0
[WorkState_v1_2.Frames.ChildFrames.Document-3.ViewFrame-0]
-DocPathName=R:\c2hardw\Project_Marcel_&_Oliver\Project_CVS\Graphic_Equalizer\include\display.hch
+DocPathName=R:\c2hardw\Project_Marcel_&_Oliver\Project_CVS\Graphic_Equalizer\include\mousedriver.hch
DocumentString=
DocTemplateIndex=5
-WindowPlacement=MCAAAAAAAAAAAAAABAAAAAAAPPPPPPPPPPPPPPPPMPPPPPPPJOPPPPPPMCAAAAAAMCAAAAAACMCAAAAANGBAAAAA
-IsActiveChildFrame=False
-[WorkState_v1_2.Frames.ChildFrames.Document-4]
-ptn_Child1=ViewFrame-0
-[WorkState_v1_2.Frames.ChildFrames.Document-4.ViewFrame-0]
-DocPathName=R:\c2hardw\Project_Marcel_&_Oliver\Project_CVS\Graphic_Equalizer\include\display_shared.hch
-DocumentString=
-DocTemplateIndex=5
-WindowPlacement=MCAAAAAAAAAAAAAABAAAAAAAPPPPPPPPPPPPPPPPMPPPPPPPJOPPPPPPCEAAAAAACEAAAAAAINCAAAAADIBAAAAA
-IsActiveChildFrame=False
+WindowPlacement=MCAAAAAACAAAAAAADAAAAAAAPPPPPPPPPPPPPPPPMPPPPPPPJOPPPPPPIFAAAAAAIFAAAAAACPCAAAAALHBAAAAA
+IsActiveChildFrame=True
[WorkState_v1_2.DK Design Suite Preferences]
Active Project Index=0
Active Configuration Index=3
diff --git a/Graphic_Equalizer/include/audiodriver.hch b/Graphic_Equalizer/include/audiodriver.hch
new file mode 100644
index 0000000..0b11168
--- /dev/null
+++ b/Graphic_Equalizer/include/audiodriver.hch
@@ -0,0 +1,80 @@
+/*! \file audiodriver.hch
+ *
+ * \section generic Audiodriver API
+ *
+ * \section project Project information.
+ * Project Graphic Equalizer\n
+ * \author O.M. Schinagl
+ * \date 20041021
+ * \version 0.1
+ *
+ * \section copyright Copyright
+ * Copyright ©2004 Koninklijke Philips Electronics N.V. All rights reserved
+ *
+ * \section history Change history
+ * 20041021: O.M. Schinagl\n Initial version
+ *
+ ********************************************************************/
+
+#ifndef _AUDIODRIVER_HCH
+#define _AUDIODRIVER_HCH 1
+
+
+
+/*
+ * Type definition of the shared memory to be used in various processes
+ */
+typedef struct {
+} audiodata_s;
+
+
+
+/*
+ * States used to indicate wether audio data is sampled.
+ */
+#define AUDIO_NOT_READY 0
+#define AUDIO_READY 1
+
+
+
+/*
+ * Line in or Mic in aliases for audio_init.
+ */
+#define LINE_IN RC200AudioInLineIn
+#define MIC_IN RC200AudioInMicIn
+
+
+
+/*
+ * Sample Rate Aliases for audio_init.
+ */
+#define SR_8000 RC200AudioSampleRate8000
+#define SR_11025 RC200AudioSampleRate11025
+#define SR_16000 RC200AudioSampleRate16000
+#define SR_22050 RC200AudioSampleRate22050
+#define SR_44100 RC200AudioSampleRate44100
+#define SR_48000 RC200AudioSampleRate48000
+
+
+
+/*
+ * Initialize the Audio sub-system. gain_level sets the internal amplifier to
+ * passed level, input_source chooses between line in or mic in. The
+ * sample_rate is set to supplied rate. Defines for these are mentioned above.
+ */
+void audio_init(unsigned 4 gain_level,
+ unsigned 1 input_source,
+ unsigned 3 sample_rate);
+
+
+
+/*
+ * Main audiodriver loop. This procedure never returns! It handles audio io,
+ * updates the shared memory and notifies listeners.
+ */
+void audio_main(void);
+
+#else
+#error "ERROR file audiodriver.hch multiple times included"
+#endif /* --- _AUDIODRIVER_HCH --- */
+
diff --git a/Graphic_Equalizer/include/mousedriver.hch b/Graphic_Equalizer/include/mousedriver.hch
index a0f9e8e..9c674cd 100644
--- a/Graphic_Equalizer/include/mousedriver.hch
+++ b/Graphic_Equalizer/include/mousedriver.hch
@@ -24,12 +24,12 @@
/*
* Create a define to keep API generic
*/
-#define mouse_run(ClockRate) RC200TouchScreenRun(ClockRate)
+#define MouseRun(ClockRate) RC200TouchScreenRun(ClockRate)
/*
- * Main mousedriver loop. This function never returns! It handles mouse input,
+ * Main mousedriver loop. This procedure never returns! It handles mouse input,
* updates the shared memory and notifies listeners.
*/
void mouse_main(void);
diff --git a/Graphic_Equalizer/include/mousedriver_shared.hch b/Graphic_Equalizer/include/mousedriver_shared.hch
index d020b94..01470fa 100644
--- a/Graphic_Equalizer/include/mousedriver_shared.hch
+++ b/Graphic_Equalizer/include/mousedriver_shared.hch
@@ -19,14 +19,16 @@
#ifndef _MOUSEDRIVER_SHARED_HCH
#define _MOUSEDRIVER_SHARED_HCH 1
+/*** Data Types **********************/
+
/*
* Type definition of the shared memory to be used in various processes
*/
-struct mousedata_s {
- ram unsigned 10 x;
- ram unsigned 9 y;
- ram unsigned 2 state;
-};
+typedef struct {
+ unsigned 10 x;
+ unsigned 9 y;
+ unsigned 3 state;
+} mousedata_s;
@@ -36,6 +38,8 @@ struct mousedata_s {
#define MOUSE_NOT_UPDATED 0
#define MOUSE_UPDATED 1
+
+
/*
* Set of Mouse States defines
*/
diff --git a/Graphic_Equalizer/src/audio/audiodriver.hcc b/Graphic_Equalizer/src/audio/audiodriver.hcc
new file mode 100644
index 0000000..0038ef6
--- /dev/null
+++ b/Graphic_Equalizer/src/audio/audiodriver.hcc
@@ -0,0 +1,84 @@
+/*! \file header_templace.hcc
+ *
+ * \section generic Message build up information and more
+ *
+ * \section project Project information.
+ * Project Graphic Equalizer\n
+ * \author
+ * \date 20041011
+ * \version 0.1
+ *
+ * \section copyright Copyright
+ * Copyright ©2004 Koninklijke Philips Electronics N.V. All rights reserved
+ *
+ * \section history Change history
+ * 20041011: \n Initial version
+ *
+ ********************************************************************/
+
+/******** System Includes *************/
+#include <stdlib.hch>
+
+#include "pal_master.hch"
+
+/******** Application Includes ********/
+#include "audiodriver.hch"
+#include "audiodriver_shared.hch"
+
+
+
+/*! \fn void audio_init(unsigned 4 gain_level,
+ * unsigned 1 input_source,
+ * unsigned 3 sample_rate)
+ *
+ * \brief Set some inital values to the audio hardware.
+ *
+ * \param unsigned 4 gain_level Set the input amplifier to this
+ * amplification level.
+ * \param unsigned 1 input_source Choose between microphone input
+ * or linein input
+ * \param unsigned 3 sample_rate Set the sample rate between 8000
+ * and 48000
+ *
+ * \return void
+ * \retval void
+ *
+ */
+void audio_init(unsigned 4 gain_level,
+ unsigned 1 input_source,
+ unsigned 3 sample_rate) {
+ /*
+ * We simply call the appropiate handlers and pass values along. We
+ * Don't set the mute on input gain. We have volume control to do this.
+ * Input and Output sampling rates are equal. We dont' need different
+ * rates.
+ */
+ RC200AudioInSetGain(FALSE, gain_level, gain_level);
+ RC200AudioInSetInput(input_source);
+ PalAudioInSetSampleRate(AudioIn, sample_rate);
+ PalAudioOutSetSampleRate(AudioOut, sample_rate);
+} /* --- audio_init() --- */
+
+
+
+/*! \fn void audio_main(void);
+ * \brief Main audiodriver. This function never returns! It calls the
+ * audiohandlers and stores samples into a global array. Once 64
+ * Samples are collected it raises a signal AUDIO_READY to let
+ * other processes know it's ready. We use quadruple buffering for
+ * audio input and double buffering for audio output.
+ *
+ * \param void
+ *
+ * \return Never Returns.
+ * \retval void
+ */
+void audio_main(void) {
+ /*
+ * Setup audio pointers.
+ */
+ macro expr AudioIn = PalAudioInCT(0);
+ macro expr AudioOut = PalAudioOutCT(0);
+
+
+} /* --- audio_main() --- */
diff --git a/Graphic_Equalizer/src/audio/main.hcc b/Graphic_Equalizer/src/audio/main.hcc
new file mode 100644
index 0000000..cd98565
--- /dev/null
+++ b/Graphic_Equalizer/src/audio/main.hcc
@@ -0,0 +1,88 @@
+/*! \file header_templace.hcc
+ *
+ * \section generic Message build up information and more
+ *
+ * \section project Project information.
+ * Project Graphic Equalizer\n
+ * \author
+ * \date 20041011
+ * \version 0.1
+ *
+ * \section copyright Copyright
+ * Copyright ©2004 Koninklijke Philips Electronics N.V. All rights reserved
+ *
+ * \section history Change history
+ * 20041011: \n Initial version
+ *
+ ********************************************************************/
+
+
+/*
+ * Set the Clock rate for this domain. 50.0 Mhz is minimally required while
+ * performing audio tasks.
+ */
+#define PAL_TARGET_CLOCK_RATE 50000000
+
+/******** System Includes *************/
+#include <stdlib.hch>
+
+#include "pal_master.hch"
+
+/******** Application Includes ********/
+#include "audiodriver.hch"
+
+
+/*
+ * Request Clockrate. Approximated ClockRate is compiler assigned.
+ */
+static macro expr ClockRate = PAL_ACTUAL_CLOCK_RATE;
+
+
+
+/*! \fn void main(void);
+ * \brief Main audio handling loop.
+ *
+ * \param void
+ *
+ * \return void
+ * \retval void
+ */
+void main(void) {
+ /* Setup Audio I/O Pointers */
+ macro expr AudioIn = PalAudioInCT(0);
+ macro expr AudioOut = PalAudioOutCT(0);
+
+ /*
+ * Check library versions and Request VideoOutput.
+ * We need at least Major Version 1 and minor version 2.
+ */
+ PalVersionRequire(1, 2);
+ PalAudioInRequire(1);
+ PalAudioOutRequire(1);
+
+ /*
+ * Run The Following main tasks in parallel.
+ */
+ par {
+ /*
+ * Primary task is to 'Run' several hardware simultaniously.
+ * Audio I/O needs to be in sync.
+ */
+ PalAudioInRun(AudioIn, ClockRate);
+ PalAudioOutRun(AudioOut, ClockRate);
+
+ /* Parallel to our Primary tasks we run the application. */
+ seq {
+ /* But first we need to enable and initialize the audio. */
+ PalAudioInEnable(AudioIn);
+ PalAudioOutEnable(AudioOut);
+ audio_init(7, LINE_IN, SR_44100);
+ par {
+ /*
+ * From here we run the main audio loop.
+ */
+ audio_main();
+ }
+ }
+ }
+} /* --- main() --- */
diff --git a/Graphic_Equalizer/src/audio/sample.hcc b/Graphic_Equalizer/src/audio/sample.hcc
new file mode 100644
index 0000000..95139e7
--- /dev/null
+++ b/Graphic_Equalizer/src/audio/sample.hcc
@@ -0,0 +1,77 @@
+/*! \file sample.hcc
+ *
+ * \section generic Handle audio sampling and buffer rotation.
+ *
+ * \section project Project information.
+ * Project Graphic Equalizer\n
+ * \author O.M. Schinagl
+ * \date 20041021
+ * \version 0.1
+ *
+ * \section copyright Copyright
+ * Copyright ©2004 Koninklijke Philips Electronics N.V. All rights reserved
+ *
+ * \section history Change history
+ * 20041021: O.M. Schinagl\n Initial version
+ *
+ ********************************************************************/
+
+/******** System Includes *************/
+
+/******** Application Includes ********/
+
+
+
+/*
+ * 64 step counter to keep track of our samples.
+ */
+unsigned 8 sample_count;
+signed 16 *audio_in_ptr;
+
+
+/*! \fn void sample_add(in_sample);
+ * \brief This procedure adds the supplied sample to our internal array.
+ *
+ * \param in_sample 16 bits signed sample to be added.
+ *
+ * \return void
+ * \retval void
+ */
+void sample_add(in_sample) {
+ /*
+ * We only want a 64 sample buffer, hence we circulate around only the
+ * last 6 bits.
+ */
+ audio_in_ptr[sample_count <-6] = in_sample;
+ sample_count++;
+} /* --- sample_add() --- */
+
+
+
+/*! \fn void sample_rotate_buffers(void);
+ * \brief This procedure rotates our buffers around if 64 samples are
+ * read into our current buffer.
+ *
+ * \param in_sample 16 bits signed sample to be added.
+ *
+ * \return void
+ * \retval void
+ */
+void sample_rotate_buffers(in_sample) {
+ /*
+ * We only want to read 64 samples, but calculations work nicer if we
+ * use 256 samples. Therefor we circulate our audio pointer around.
+ */
+ if (!(sample_count <- 6)) {
+ /*
+ * 64 Samples have passed. We are back at '0'. Copy use the
+ * full sample count as index which is 0 64 128 or 192 and back
+ * to 0. Our Output is only 128 big so we only look at the
+ * 7 LSB.
+ */
+ par {
+ audio_in_ptr = &pcm_audio_in[sample_count];
+ audio_out_ptr = &pcm_audio_out[(sample_count <- 7)];
+ }
+ }
+} /* --- main() --- */
diff --git a/Support_Libs/debug/debug.hcc b/Support_Libs/debug/debug.hcc
index 2cc6bef..303adde 100644
--- a/Support_Libs/debug/debug.hcc
+++ b/Support_Libs/debug/debug.hcc
@@ -19,15 +19,20 @@ void print_hex_value(unsigned value)
ch += (ch > 9) ? 0x37 : 0x30;
PalDataPortWrite(PalRS232PortCT(0), ch);
}
-
- PalDataPortWrite(PalRS232PortCT(0), 0x0A);
- PalDataPortWrite(PalRS232PortCT(0), 0x0D);
}
-void print_string(unsigned 8 s[16]) {
+void print_string(unsigned char *s) {
unsigned 4 i;
-
- for(i = 0;('\0' != s[i]) || (0 < i);i++) {
- PalDataPortWrite(PalRS232PortCT(0), s[i] +0x30);
- }
+ i = 0;
+ for(i = 0;'\0' != s[i];i++)
+ {
+ PalDataPortWrite(PalRS232PortCT(0), s[i]);
+ }
+
}
+
+void print_eol(void)
+{
+ PalDataPortWrite(PalRS232PortCT(0), 0x0A);
+ PalDataPortWrite(PalRS232PortCT(0), 0x0D);
+} \ No newline at end of file
diff --git a/Support_Libs/debug/debug.hch b/Support_Libs/debug/debug.hch
index abd8bea..c2656f2 100644
--- a/Support_Libs/debug/debug.hch
+++ b/Support_Libs/debug/debug.hch
@@ -9,25 +9,25 @@
* This function will print the integer through the RS232 interface in a
* 32-bit hexadecimal representation.
* Pre: Value must be smaller or equal to 32-bits.
- * RS232 must be available.
- * Post: A hex representation of value is printed.
+ * Post: A hex representation of value is printed.
*
****************************************************************************/
void print_hex_value(unsigned value);
/****************************************************************************
*
- * print_string (unsigned 8 value[16])
+ * print_string (unsigned char *s)
*
* Arguments: (typical)
- * value: An array of characters.
+ * s: Pointer to an array containg a string top print.
*
* Description: (typical)
* This function will print a string through the RS232 interface.
- * Pre: Value must not be 16 characters in length. If less char's
- * are used, termination with \0 is recommended.
- * RS232 must be available.
- * Post: The string is printed as is.
+ * Pre: The array must be /0 terminated.
+ * Post: The string is printed as is.
*
****************************************************************************/
-void print_string(unsigned 8 s[16]);
+void print_string(unsigned char *s);
+
+
+void print_eol(void); \ No newline at end of file