summaryrefslogtreecommitdiffstats
path: root/Graphic_Equalizer/doc/html/main_8hcc-source.html
blob: b95c02312a183c425d4cf79601a6761267ef5b3b (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
154
155
156
157
158
159
160
161
162
163
164
<!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: 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="files.html">File&nbsp;List</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>
00022 <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 "fft.hch"</span>
00039 <span class="preprocessor">#include "runfft.hch"</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         mousedata_t mousedata;
00062         events_t events;
00063         audiodata_t audiodata;
00064         skindata_t 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         PalPL2RAMRequire(1);
00077 
00078         <span class="comment">/*</span>
00079 <span class="comment">         * We verify some datawidths here at compile time. This to ensure</span>
00080 <span class="comment">         * successfull operation.</span>
00081 <span class="comment">         */</span>
00082         assert (PalVideoOutGetColorWidthCT(VideoOut) == 24, 0, 
00083                 <span class="stringliteral">"We need a 24-bit color Display."</span>);
00084         assert (PalPL2RAMGetDataWidthCT(RAM_BANK0) &gt;= 32, 0, 
00085                 <span class="stringliteral">"We can't work with anything less then 32 bits wide ram."</span>);
00086 
00087         <span class="comment">/*</span>
00088 <span class="comment">         * Run The Following main tasks in parallel.</span>
00089 <span class="comment">         */</span>
00090         par {
00091                 <span class="comment">/*</span>
00092 <span class="comment">                 * Primary task is to 'Run' several hardware simultaniously.</span>
00093 <span class="comment">                 */</span>
00094                 PalVideoOutRun(VideoOut, ClockRate);
00095                 MouseRun(ClockRate);
00096                 PalAudioInRun(AudioIn, ClockRate);
00097                 PalAudioOutRun(AudioOut, ClockRate);
00098                 PalPL2RAMRun(RAM_BANK0, ClockRate);
00099 <span class="preprocessor">#if HAVE_SMARTMEDIA</span>
00100 <span class="preprocessor"></span>                <span class="comment">/*</span>
00101 <span class="comment">                 * The smartmedia device needs the CPLD to run also.</span>
00102 <span class="comment">                 */</span>
00103                 CPLDRun(ClockRate);
00104                 SmartMediaRun(ClockRate);
00105 <span class="preprocessor">#endif</span>
00106 <span class="preprocessor"></span><span class="preprocessor">#if HAVE_DEBUG</span>
00107 <span class="preprocessor"></span>                RC200RS232Run(RC200RS232_115200Baud, RC200RS232ParityNone,
00108                         RC200RS232FlowControlNone, ClockRate);
00109 <span class="preprocessor">#endif</span>
00110 <span class="preprocessor"></span>                
00111                 <span class="comment">/*</span>
00112 <span class="comment">                 * Parallel to our Primary tasks we run the application.</span>
00113 <span class="comment">                 */</span>
00114                 seq {
00115                         <span class="comment">/*</span>
00116 <span class="comment">                         * But first we need to initialize Video and Audio.</span>
00117 <span class="comment">                         * We also load the data from the SmartMedia card</span>
00118 <span class="comment">                         * into the ram.</span>
00119 <span class="comment">                         */</span>
00120 <span class="preprocessor">#if HAVE_DEBUG</span>
00121 <span class="preprocessor"></span>                        print_cls();
00122                         print_string(<span class="stringliteral">"Graphic Equalizer 2"</span>);
00123                         print_eol();
00124 <span class="preprocessor">#endif</span>
00125 <span class="preprocessor"></span>                        PalVideoOutEnable(VideoOut);
00126                         PalAudioInEnable(AudioIn);
00127                         PalAudioOutEnable(AudioOut);
00128                         <a class="code" href="audio_8hcc.html#a0">audio_init</a>(6, LINE_IN, SR_44100, AudioIn, AudioOut);
00129 <span class="preprocessor">#if HAVE_SMARTMEDIA</span>
00130 <span class="preprocessor"></span>                        <span class="comment">/*</span>
00131 <span class="comment">                         * Once we properly setup the SmartMedia we load our</span>
00132 <span class="comment">                         * data folowed by our main program loop.</span>
00133 <span class="comment">                         */</span>
00134                         result = <a class="code" href="smartmedia_8hch.html#a9">smartmedia_init</a>();
00135                         <span class="keywordflow">if</span> (!result) {
00136 <span class="preprocessor">#endif</span>
00137 <span class="preprocessor"></span><span class="preprocessor">#if HAVE_DEBUG</span>
00138 <span class="preprocessor"></span>                                print_string(<span class="stringliteral">"Loading Skin ..."</span>);
00139 <span class="preprocessor">#endif</span>
00140 <span class="preprocessor"></span>                                <a class="code" href="smartmedia_8hcc.html#a1">smartmedia_loaddata</a>(&amp;skindata);
00141 <span class="preprocessor">#if HAVE_DEBUG</span>
00142 <span class="preprocessor"></span>                                print_eol();
00143                                 print_string(<span class="stringliteral">"Done Loading Skin ..."</span>);
00144                                 print_eol();
00145                                 print_string(<span class="stringliteral">"Running Main Application."</span>);
00146                                 print_eol();
00147 <span class="preprocessor">#endif</span>
00148 <span class="preprocessor"></span>
00149                                 <span class="comment">/*</span>
00150 <span class="comment">                                 * Main application starts here!</span>
00151 <span class="comment">                                 */</span>
00152                                 par {
00153                                         <span class="comment">/*</span>
00154 <span class="comment">                                         * From here we run the mouse driver, audio</span>
00155 <span class="comment">                                         * and display in parallel. None of these</span>
00156 <span class="comment">                                         * should ever return.</span>
00157 <span class="comment">                                         */</span>
00158                                         <a class="code" href="mouse_8hcc.html#a0">mouse_main</a>(&amp;mousedata);
00159                                         <a class="code" href="display_8hcc.html#a3">display_main</a>(&amp;skindata, &amp;audiodata, &amp;events, &amp;mousedata);
00160                                         <a class="code" href="eventhandler_8hcc.html#a3">eventhandler_main</a>(&amp;audiodata, &amp;events, &amp;mousedata);
00161                                         <a class="code" href="audio_8hcc.html#a1">audio_main</a>(audiodata, AudioIn, AudioOut);
00162                                 }
00163 <span class="preprocessor">#if HAVE_SMARTMEDIA</span>
00164 <span class="preprocessor"></span>                        } <span class="keywordflow">else</span> {
00165 <span class="preprocessor">#if HAVE_DEBUG</span>
00166 <span class="preprocessor"></span>                                print_string(<span class="stringliteral">"Error Initializing SmartMedia"</span>);
00167 <span class="preprocessor">#endif</span>
00168 <span class="preprocessor"></span>                        }
00169 <span class="preprocessor">#endif</span>
00170 <span class="preprocessor"></span>                }
00171         }
00172 
00173 } <span class="comment">/* --- main() --- */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Nov 29 12:04:48 2004 for Graphic Equalizer 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>