summaryrefslogtreecommitdiffstats
path: root/Graphic_Equalizer/src/main.hcc
diff options
context:
space:
mode:
Diffstat (limited to 'Graphic_Equalizer/src/main.hcc')
-rw-r--r--Graphic_Equalizer/src/main.hcc164
1 files changed, 164 insertions, 0 deletions
diff --git a/Graphic_Equalizer/src/main.hcc b/Graphic_Equalizer/src/main.hcc
new file mode 100644
index 0000000..6e4f7ae
--- /dev/null
+++ b/Graphic_Equalizer/src/main.hcc
@@ -0,0 +1,164 @@
+/*! \file main.hcc
+ *
+ * \section generic Message build up information and more
+ *
+ * \section project Project information.
+ * Project Graphic Equalizer\n
+ * \author O.M. Schinagl
+ * \date 20041011
+ * \version 0.1
+ *
+ * \section copyright Copyright
+ * Copyright ©2004 Koninklijke Philips Electronics N.V. All rights reserved
+ *
+ * \section history Change history
+ * 20041011: O.M. Schinagl\n Initial version
+ *
+ *****************************************************************************/
+
+
+/*
+ * Set the Clock rate for this domain. 25.175 Mhz is required for the Video output.
+ */
+#define PAL_TARGET_CLOCK_RATE 25175000
+
+/******** System Includes *************/
+#include "pal_master.hch"
+#include "pal_mouse.hch"
+
+/******** Application Includes ********/
+#include "configuration.hch"
+#include "display.hch"
+#include "mouse.hch"
+#include "mouse_shared.hch"
+#include "audio.hch"
+#include "eventhandler.hch"
+#include "eventhandler_shared.hch"
+
+#if HAVE_DEBUG
+ #include "debug.hch"
+#endif
+
+
+/*
+ * Request Clockrate. Approximated ClockRate is compiler assigned. As the
+ * ClockRate is identical throughout the entire domain, this is a global
+ * expression so that all process use the correct one.
+ */
+macro expr ClockRate = PAL_ACTUAL_CLOCK_RATE;
+
+
+/*! \fn void main(void);
+ * \brief Main User Input/Ouput loop.
+ *
+ * \param void
+ *
+ * \return void
+ * \retval void
+ */
+void main(void) {
+ /*
+ * Set VideoOut, Audio I/O and Ram Handles
+ */
+ macro expr VideoOut = PalVideoOutOptimalCT(ClockRate);
+ macro expr AudioIn = PalAudioInCT(0);
+ macro expr AudioOut = PalAudioOutCT(0)
+ macro expr RAM_BANK0 = PalPL2RAMCT(0);
+
+ unsigned mousedata_t mousedata;
+ unsigned events_t events;
+
+ /*
+ * Check library versions and Request various hardware functionality.
+ * We need at least Major Version 1. For Audio purposes we need atleast
+ * minor version 2.
+ */
+ PalVersionRequire(1, 2);
+ PalVideoOutRequire(1);
+ PalAudioInRequire(1);
+ PalAudioOutRequire(1);
+ PalPL2RAMRequire(1);
+
+ /*
+ * We verify some datawidths here at compile time. This to ensure
+ * successfull operation.
+ */
+ assert (PalVideoOutGetColorWidthCT(VideoOut) == 24, 0,
+ "We need a 24-bit color Display.");
+ assert (PalPL2RAMGetDataWidthCT(PL2RAM_BANK0) >= 32, 0,
+ "We can't work with anything less then 32 bits wide ram.");
+
+ /*
+ * Run The Following main tasks in parallel.
+ */
+ par {
+ /*
+ * Primary task is to 'Run' several hardware simultaniously.
+ */
+ PalVideoOutRun(VideoOut, ClockRate);
+ MouseRun(ClockRate);
+ PalAudioInRun(AudioIn, ClockRate);
+ PalAudioOutRun(AudioOut, ClockRate);
+#if HAVE_SMART_MEDIA
+ /*
+ * The smartmedia device needs the CPLD to run.
+ */
+ CPLDRun(ClockRate);
+ SmartMediaRun(ClockRate);
+#endif
+
+ /*
+ * Parallel to our Primary tasks we run the application.
+ */
+ seq {
+ /*
+ * But first we need to initialize Video and Audio.
+ * We also load the data from the SmartMedia card
+ * into the ram.
+ */
+ display_init(ClockRate);
+ PalAudioInEnable(AudioIn);
+ PalAudioOutEnable(AudioOut);
+ audio_init(6, LINE_IN, SR_44100);
+#if HAVE_SMART_MEDIA
+ /*
+ * Once we properly setup the SmartMedia we load our
+ * data folowed by our main program loop.
+ */
+ if (!smartmedia_init()) {
+#endif
+#if HAVE_DEBUG
+ print_string("Loading Skin ...");
+#endif
+ smartmedia_loaddata();
+#if HAVE_DEBUG
+ print_string("Done Loading Skin ...");
+ print_eol();
+ print_string("Running Main Application.");
+#endif
+
+ /*
+ * Main application starts here!
+ */
+ par {
+ /*
+ * From here we run the mouse driver, audio
+ * and display in parallel. None of these
+ * should ever return.
+ */
+ mouse_main(&mousedata);
+ display_main(&events, &mousedata);
+ eventhandler_main(&events, &mousedata);
+ audio_main();
+ }
+#if HAVE_SMART_MEDIA
+ } else {
+#if HAVE_DEBUG
+ print_string("Error Initializing SmartMedia");
+#endif
+ }
+#endif
+ }
+ }
+
+} /* --- main() --- */