Main Page | Data Structures | Directories | File List | Data Fields | Globals

main.hcc

Go to the documentation of this file.
00001 
00019 /*
00020  * Set the Clock rate for this domain. 25.175 Mhz is required for the Video output.
00021  */
00022 #define PAL_TARGET_CLOCK_RATE 25175000
00023 
00024 /******** System Includes *************/
00025 #include "pal_master.hch"
00026 
00027 /******** Application Includes ********/
00028 #include "configuration.hch"
00029 #include "audio.hch"
00030 #include "mouse_shared.hch"
00031 #include "mouse.hch"
00032 #include "eventhandler_shared.hch"
00033 #include "eventhandler.hch"
00034 #include "display_shared.hch"
00035 #include "display.hch"
00036 #include "smartmedia.hch"
00037 
00038 #include "fft.hch"
00039 #include "runfft.hch"
00040 
00041 #if HAVE_DEBUG
00042         #include "debug.hch"
00043 #endif
00044 
00051 void main(void) {
00052         /*
00053          * Set VideoOut, Audio I/O and Ram Handles and set clockrate.
00054          */
00055         macro expr ClockRate = PAL_ACTUAL_CLOCK_RATE;
00056         macro expr VideoOut = PalVideoOutOptimalCT(ClockRate);
00057         macro expr AudioIn  = PalAudioInCT(0);
00058         macro expr AudioOut = PalAudioOutCT(0);
00059         macro expr RAM_BANK0 = PalPL2RAMCT(0);
00060 
00061         mousedata_t mousedata;
00062         events_t events;
00063         audiodata_t audiodata;
00064         skindata_t skindata;
00065         unsigned 1 result;
00066 
00067         /*
00068          * Check library versions and Request various hardware functionality.
00069          * We need at least Major Version 1. For Audio purposes we need atleast
00070          * minor version 2.
00071          */
00072         PalVersionRequire(1, 2);
00073         PalVideoOutRequire(1);
00074         PalAudioInRequire(1);
00075         PalAudioOutRequire(1);
00076 
00077         /*
00078          * We verify some datawidths here at compile time. This to ensure
00079          * successfull operation.
00080          */
00081         assert (PalVideoOutGetColorWidthCT(VideoOut) == 24, 0, 
00082                 "We need a 24-bit color Display.");
00083         assert (PalPL2RAMGetDataWidthCT(RAM_BANK0) >= 32, 0, 
00084                 "We can't work with anything less then 32 bits wide ram.");
00085 
00086         /*
00087          * Run The Following main tasks in parallel.
00088          */
00089         par {
00090                 /*
00091                  * Primary task is to 'Run' several hardware simultaniously.
00092                  */
00093                 PalVideoOutRun(VideoOut, ClockRate);
00094                 MouseRun(ClockRate);
00095                 PalAudioInRun(AudioIn, ClockRate);
00096                 PalAudioOutRun(AudioOut, ClockRate);
00097                 PalPL2RAMRun(RAM_BANK0, ClockRate);
00098 #if HAVE_SMARTMEDIA
00099                 /*
00100                  * The smartmedia device needs the CPLD to run also.
00101                  */
00102                 CPLDRun(ClockRate);
00103                 SmartMediaRun(ClockRate);
00104 #endif
00105 #if HAVE_DEBUG
00106                 RC200RS232Run(RC200RS232_115200Baud, RC200RS232ParityNone,
00107                         RC200RS232FlowControlNone, ClockRate);
00108 #endif
00109                 
00110                 /*
00111                  * Parallel to our Primary tasks we run the application.
00112                  */
00113                 seq {
00114                         /*
00115                          * But first we need to initialize Video and Audio.
00116                          * We also load the data from the SmartMedia card
00117                          * into the ram.
00118                          */
00119 #if HAVE_DEBUG
00120                         print_cls();
00121                         print_string("Graphic Equalizer 2");
00122                         print_eol();
00123 #endif
00124                         PalVideoOutEnable(VideoOut);
00125                         PalAudioInEnable(AudioIn);
00126                         PalAudioOutEnable(AudioOut);
00127                         audio_init(6, LINE_IN, SR_44100, AudioIn, AudioOut);
00128 #if HAVE_SMARTMEDIA
00129                         /*
00130                          * Once we properly setup the SmartMedia we load our
00131                          * data folowed by our main program loop.
00132                          */
00133                         result = smartmedia_init();
00134                         if (!result) {
00135 #endif
00136                                 smartmedia_loaddata(&skindata);
00137 
00138                                 /*
00139                                  * Main application starts here!
00140                                  */
00141                                 par {
00142                                         /*
00143                                          * From here we run the mouse driver, audio
00144                                          * and display in parallel. None of these
00145                                          * should ever return.
00146                                          */
00147                                         mouse_main(&mousedata);
00148                                         display_main(&skindata, &audiodata, &events, &mousedata);
00149                                         eventhandler_main(&audiodata, &events, &mousedata);
00150                                         audio_main(audiodata, AudioIn, AudioOut);
00151                                 }
00152 #if HAVE_SMARTMEDIA
00153                         } else {
00154 #if HAVE_DEBUG
00155                                 print_string("Error Initializing SmartMedia");
00156 #endif
00157                         }
00158 #endif
00159                 }
00160         }
00161 
00162 } /* --- main() --- */

Generated on Thu Dec 9 14:37:07 2004 for Graphic Equalizer 2 by  doxygen 1.3.9.1