summaryrefslogtreecommitdiffstats
path: root/Graphic_Equalizer_v1.0/doc/html/main_8hcc-source.html
blob: 33c19e6943c0ef0b879b9a684f6281fb31631c50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Graphic Equalizer 2: C:/Project  Marcel &amp; Oliver/Graphic_Equalizer/src/main.hcc Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.9.1 -->
<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">C:</a>&nbsp;/&nbsp;<a class="el" href="dir_000001.html">Project  Marcel &amp; Oliver</a>&nbsp;/&nbsp;<a class="el" href="dir_000002.html">Graphic_Equalizer</a>&nbsp;/&nbsp;<a class="el" href="dir_000004.html">src</a></div>
<h1>main.hcc</h1><a href="main_8hcc.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 
00019 <span class="comment">/*</span>
00020 <span class="comment"> * Set the Clock rate for this domain. 25.175 Mhz is required for the Video output.</span>
00021 <span class="comment"> */</span>
<a name="l00022"></a><a class="code" href="main_8hcc.html#a0">00022</a> <span class="preprocessor">#define PAL_TARGET_CLOCK_RATE 25175000</span>
00023 <span class="preprocessor"></span>
00024 <span class="comment">/******** System Includes *************/</span>
00025 <span class="preprocessor">#include "pal_master.hch"</span>
00026 
00027 <span class="comment">/******** Application Includes ********/</span>
00028 <span class="preprocessor">#include "<a class="code" href="configuration_8hch.html">configuration.hch</a>"</span>
00029 <span class="preprocessor">#include "<a class="code" href="audio_8hch.html">audio.hch</a>"</span>
00030 <span class="preprocessor">#include "<a class="code" href="mouse__shared_8hch.html">mouse_shared.hch</a>"</span>
00031 <span class="preprocessor">#include "<a class="code" href="mouse_8hch.html">mouse.hch</a>"</span>
00032 <span class="preprocessor">#include "<a class="code" href="eventhandler__shared_8hch.html">eventhandler_shared.hch</a>"</span>
00033 <span class="preprocessor">#include "<a class="code" href="eventhandler_8hch.html">eventhandler.hch</a>"</span>
00034 <span class="preprocessor">#include "<a class="code" href="display__shared_8hch.html">display_shared.hch</a>"</span>
00035 <span class="preprocessor">#include "<a class="code" href="display_8hch.html">display.hch</a>"</span>
00036 <span class="preprocessor">#include "<a class="code" href="smartmedia_8hch.html">smartmedia.hch</a>"</span>
00037 
00038 <span class="preprocessor">#include "<a class="code" href="fft_8hch.html">fft.hch</a>"</span>
00039 <span class="preprocessor">#include "<a class="code" href="runfft_8hch.html">runfft.hch</a>"</span>
00040 
00041 <span class="preprocessor">#if HAVE_DEBUG</span>
00042 <span class="preprocessor"></span><span class="preprocessor">        #include "debug.hch"</span>
00043 <span class="preprocessor">#endif</span>
00044 <span class="preprocessor"></span>
<a name="l00051"></a><a class="code" href="main_8hcc.html#a1">00051</a> <span class="keywordtype">void</span> <a class="code" href="main_8hcc.html#a1">main</a>(<span class="keywordtype">void</span>) {
00052         <span class="comment">/*</span>
00053 <span class="comment">         * Set VideoOut, Audio I/O and Ram Handles and set clockrate.</span>
00054 <span class="comment">         */</span>
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         <a class="code" href="structmousedata__t.html">mousedata_t</a> mousedata;
00062         <a class="code" href="structevents__t.html">events_t</a> events;
00063         <a class="code" href="structaudiodata__t.html">audiodata_t</a> audiodata;
00064         <a class="code" href="structskindata__t.html">skindata_t</a> skindata;
00065         <span class="keywordtype">unsigned</span> 1 result;
00066 
00067         <span class="comment">/*</span>
00068 <span class="comment">         * Check library versions and Request various hardware functionality.</span>
00069 <span class="comment">         * We need at least Major Version 1. For Audio purposes we need atleast</span>
00070 <span class="comment">         * minor version 2.</span>
00071 <span class="comment">         */</span>
00072         PalVersionRequire(1, 2);
00073         PalVideoOutRequire(1);
00074         PalAudioInRequire(1);
00075         PalAudioOutRequire(1);
00076 
00077         <span class="comment">/*</span>
00078 <span class="comment">         * We verify some datawidths here at compile time. This to ensure</span>
00079 <span class="comment">         * successfull operation.</span>
00080 <span class="comment">         */</span>
00081         assert (PalVideoOutGetColorWidthCT(VideoOut) == 24, 0, 
00082                 <span class="stringliteral">"We need a 24-bit color Display."</span>);
00083         assert (PalPL2RAMGetDataWidthCT(RAM_BANK0) &gt;= 32, 0, 
00084                 <span class="stringliteral">"We can't work with anything less then 32 bits wide ram."</span>);
00085 
00086         <span class="comment">/*</span>
00087 <span class="comment">         * Run The Following main tasks in parallel.</span>
00088 <span class="comment">         */</span>
00089         par {
00090                 <span class="comment">/*</span>
00091 <span class="comment">                 * Primary task is to 'Run' several hardware simultaniously.</span>
00092 <span class="comment">                 */</span>
00093                 PalVideoOutRun(VideoOut, ClockRate);
00094                 <a class="code" href="mouse_8hch.html#a1">MouseRun</a>(ClockRate);
00095                 PalAudioInRun(AudioIn, ClockRate);
00096                 PalAudioOutRun(AudioOut, ClockRate);
00097                 PalPL2RAMRun(RAM_BANK0, ClockRate);
00098 <span class="preprocessor">#if HAVE_SMARTMEDIA</span>
00099 <span class="preprocessor"></span>                <span class="comment">/*</span>
00100 <span class="comment">                 * The smartmedia device needs the CPLD to run also.</span>
00101 <span class="comment">                 */</span>
00102                 <a class="code" href="smartmedia_8hch.html#a7">CPLDRun</a>(ClockRate);
00103                 <a class="code" href="smartmedia_8hch.html#a8">SmartMediaRun</a>(ClockRate);
00104 <span class="preprocessor">#endif</span>
00105 <span class="preprocessor"></span><span class="preprocessor">#if HAVE_DEBUG</span>
00106 <span class="preprocessor"></span>                RC200RS232Run(RC200RS232_115200Baud, RC200RS232ParityNone,
00107                         RC200RS232FlowControlNone, ClockRate);
00108 <span class="preprocessor">#endif</span>
00109 <span class="preprocessor"></span>                
00110                 <span class="comment">/*</span>
00111 <span class="comment">                 * Parallel to our Primary tasks we run the application.</span>
00112 <span class="comment">                 */</span>
00113                 seq {
00114                         <span class="comment">/*</span>
00115 <span class="comment">                         * But first we need to initialize Video and Audio.</span>
00116 <span class="comment">                         * We also load the data from the SmartMedia card</span>
00117 <span class="comment">                         * into the ram.</span>
00118 <span class="comment">                         */</span>
00119 <span class="preprocessor">#if HAVE_DEBUG</span>
00120 <span class="preprocessor"></span>                        print_cls();
00121                         print_string(<span class="stringliteral">"Graphic Equalizer 2"</span>);
00122                         print_eol();
00123 <span class="preprocessor">#endif</span>
00124 <span class="preprocessor"></span>                        PalVideoOutEnable(VideoOut);
00125                         PalAudioInEnable(AudioIn);
00126                         PalAudioOutEnable(AudioOut);
00127                         <a class="code" href="audio_8hcc.html#a0">audio_init</a>(6, <a class="code" href="audio_8hch.html#a3">LINE_IN</a>, <a class="code" href="audio_8hch.html#a9">SR_44100</a>, AudioIn, AudioOut);
00128 <span class="preprocessor">#if HAVE_SMARTMEDIA</span>
00129 <span class="preprocessor"></span>                        <span class="comment">/*</span>
00130 <span class="comment">                         * Once we properly setup the SmartMedia we load our</span>
00131 <span class="comment">                         * data folowed by our main program loop.</span>
00132 <span class="comment">                         */</span>
00133                         result = <a class="code" href="smartmedia_8hch.html#a9">smartmedia_init</a>();
00134                         <span class="keywordflow">if</span> (!result) {
00135 <span class="preprocessor">#endif</span>
00136 <span class="preprocessor"></span>                                <a class="code" href="smartmedia_8hcc.html#a1">smartmedia_loaddata</a>(&amp;skindata);
00137 
00138                                 <span class="comment">/*</span>
00139 <span class="comment">                                 * Main application starts here!</span>
00140 <span class="comment">                                 */</span>
00141                                 par {
00142                                         <span class="comment">/*</span>
00143 <span class="comment">                                         * From here we run the mouse driver, audio</span>
00144 <span class="comment">                                         * and display in parallel. None of these</span>
00145 <span class="comment">                                         * should ever return.</span>
00146 <span class="comment">                                         */</span>
00147                                         <a class="code" href="mouse_8hcc.html#a0">mouse_main</a>(&amp;mousedata);
00148                                         <a class="code" href="display_8hcc.html#a2">display_main</a>(&amp;skindata, &amp;audiodata, &amp;events, &amp;mousedata);
00149                                         <a class="code" href="eventhandler_8hcc.html#a2">eventhandler_main</a>(&amp;audiodata, &amp;events, &amp;mousedata);
00150                                         <a class="code" href="audio_8hcc.html#a1">audio_main</a>(audiodata, AudioIn, AudioOut);
00151                                 }
00152 <span class="preprocessor">#if HAVE_SMARTMEDIA</span>
00153 <span class="preprocessor"></span>                        } <span class="keywordflow">else</span> {
00154 <span class="preprocessor">#if HAVE_DEBUG</span>
00155 <span class="preprocessor"></span>                                print_string(<span class="stringliteral">"Error Initializing SmartMedia"</span>);
00156 <span class="preprocessor">#endif</span>
00157 <span class="preprocessor"></span>                        }
00158 <span class="preprocessor">#endif</span>
00159 <span class="preprocessor"></span>                }
00160         }
00161 
00162 } <span class="comment">/* --- main() --- */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Dec 9 14:37:07 2004 for Graphic Equalizer 2 by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address>
</body>
</html>