69 <a name="l00048"></a>00048 |
69 <a name="l00048"></a>00048 |
70 <a name="l00049"></a>00049 |
70 <a name="l00049"></a>00049 |
71 <a name="l00050"></a>00050 <span class="preprocessor">#include <<a class="code" href="ports__def_8h.html">asm-m68hc12/ports_def.h</a>></span> |
71 <a name="l00050"></a>00050 <span class="preprocessor">#include <<a class="code" href="ports__def_8h.html">asm-m68hc12/ports_def.h</a>></span> |
72 <a name="l00051"></a>00051 |
72 <a name="l00051"></a>00051 |
73 <a name="l00052"></a>00052 <span class="comment">/* Prototypes */</span> |
73 <a name="l00052"></a>00052 <span class="comment">/* Prototypes */</span> |
74 <a name="l00053"></a>00053 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="ports_8h.html#0e52a4b1cfab47cef68fa24f47175e8d">get_timer_counter</a> (<span class="keywordtype">void</span>); |
74 <a name="l00053"></a>00053 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="ports_8h.html#11e82a3e64bca1705769a29948074aa2">get_timer_counter</a> (<span class="keywordtype">void</span>); |
75 <a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="ports_8h.html#e932beed06a4917e3387c24cf8e827eb">set_timer_counter</a> (<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> value); |
75 <a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="ports_8h.html#04afe6a709a86b0df3a0fcd20840ec52">set_timer_counter</a> (<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> value); |
76 <a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="ports_8h.html#a91f7029f6abe99bed4852a32bbe3496">cop_reset</a> (<span class="keywordtype">void</span>); |
76 <a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="ports_8h.html#0633bbb5cbea218c029227b5171d003d">cop_reset</a> (<span class="keywordtype">void</span>); |
77 <a name="l00056"></a>00056 |
77 <a name="l00056"></a>00056 |
78 <a name="l00057"></a>00057 |
78 <a name="l00057"></a>00057 |
79 <a name="l00058"></a>00058 <span class="comment">/* Must me adapted to hc12</span> |
79 <a name="l00058"></a>00058 <span class="comment">/* Must me adapted to hc12</span> |
80 <a name="l00059"></a>00059 <span class="comment">void timer_acknowledge (void);</span> |
80 <a name="l00059"></a>00059 <span class="comment">void timer_acknowledge (void);</span> |
81 <a name="l00060"></a>00060 <span class="comment">void timer_initialize_rate (unsigned char divisor);</span> |
81 <a name="l00060"></a>00060 <span class="comment">void timer_initialize_rate (unsigned char divisor);</span> |
99 <a name="l00078"></a>00078 <span class="comment">void set_output_compare_5 (unsigned short value);</span> |
99 <a name="l00078"></a>00078 <span class="comment">void set_output_compare_5 (unsigned short value);</span> |
100 <a name="l00079"></a>00079 <span class="comment">*/</span> |
100 <a name="l00079"></a>00079 <span class="comment">*/</span> |
101 <a name="l00080"></a>00080 |
101 <a name="l00080"></a>00080 |
102 <a name="l00081"></a>00081 |
102 <a name="l00081"></a>00081 |
103 <a name="l00082"></a>00082 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> |
103 <a name="l00082"></a>00082 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> |
104 <a name="l00083"></a><a class="code" href="ports_8h.html#0e52a4b1cfab47cef68fa24f47175e8d">00083</a> <a class="code" href="ports_8h.html#0e52a4b1cfab47cef68fa24f47175e8d">get_timer_counter</a> (<span class="keywordtype">void</span>) |
104 <a name="l00083"></a><a class="code" href="ports_8h.html#11e82a3e64bca1705769a29948074aa2">00083</a> <a class="code" href="ports_8h.html#11e82a3e64bca1705769a29948074aa2">get_timer_counter</a> (<span class="keywordtype">void</span>) |
105 <a name="l00084"></a>00084 { |
105 <a name="l00084"></a>00084 { |
106 <a name="l00085"></a>00085 <span class="keywordflow">return</span> ((<span class="keywordtype">unsigned</span> <span class="keyword">volatile</span> <span class="keywordtype">short</span>*) &<a class="code" href="portsaccess_8h.html#cb39c27c5b828bb40948690ed0fc9462">_io_ports</a>[<a class="code" href="ports__def_8h.html#b37ac48186b7d36d18fdc2ac47773f95">TCNTH</a>])[0]; |
106 <a name="l00085"></a>00085 <span class="keywordflow">return</span> ((<span class="keywordtype">unsigned</span> <span class="keyword">volatile</span> <span class="keywordtype">short</span>*) &<a class="code" href="portsaccess_8h.html#3ff97cc4d692e20bf82d84ddadc93c55">_io_ports</a>[<a class="code" href="ports__def_8h.html#b6a05bb2596b145a99eb1a4c76cdb459">TCNTH</a>])[0]; |
107 <a name="l00086"></a>00086 } |
107 <a name="l00086"></a>00086 } |
108 <a name="l00087"></a>00087 |
108 <a name="l00087"></a>00087 |
109 <a name="l00088"></a>00088 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> |
109 <a name="l00088"></a>00088 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> |
110 <a name="l00089"></a><a class="code" href="ports_8h.html#e932beed06a4917e3387c24cf8e827eb">00089</a> <a class="code" href="ports_8h.html#e932beed06a4917e3387c24cf8e827eb">set_timer_counter</a> (<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> value) |
110 <a name="l00089"></a><a class="code" href="ports_8h.html#04afe6a709a86b0df3a0fcd20840ec52">00089</a> <a class="code" href="ports_8h.html#04afe6a709a86b0df3a0fcd20840ec52">set_timer_counter</a> (<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> value) |
111 <a name="l00090"></a>00090 { |
111 <a name="l00090"></a>00090 { |
112 <a name="l00091"></a>00091 ((<span class="keywordtype">unsigned</span> <span class="keyword">volatile</span> <span class="keywordtype">short</span>*) &<a class="code" href="portsaccess_8h.html#cb39c27c5b828bb40948690ed0fc9462">_io_ports</a>[<a class="code" href="ports__def_8h.html#b37ac48186b7d36d18fdc2ac47773f95">TCNTH</a>])[0] = value; |
112 <a name="l00091"></a>00091 ((<span class="keywordtype">unsigned</span> <span class="keyword">volatile</span> <span class="keywordtype">short</span>*) &<a class="code" href="portsaccess_8h.html#3ff97cc4d692e20bf82d84ddadc93c55">_io_ports</a>[<a class="code" href="ports__def_8h.html#b6a05bb2596b145a99eb1a4c76cdb459">TCNTH</a>])[0] = value; |
113 <a name="l00092"></a>00092 } |
113 <a name="l00092"></a>00092 } |
114 <a name="l00093"></a>00093 |
114 <a name="l00093"></a>00093 |
115 <a name="l00094"></a>00094 |
115 <a name="l00094"></a>00094 |
116 <a name="l00095"></a>00095 <span class="comment">/* Reset the COP. */</span> |
116 <a name="l00095"></a>00095 <span class="comment">/* Reset the COP. */</span> |
117 <a name="l00096"></a>00096 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> |
117 <a name="l00096"></a>00096 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> |
118 <a name="l00097"></a><a class="code" href="ports_8h.html#a91f7029f6abe99bed4852a32bbe3496">00097</a> <a class="code" href="ports_8h.html#a91f7029f6abe99bed4852a32bbe3496">cop_reset</a> (<span class="keywordtype">void</span>) |
118 <a name="l00097"></a><a class="code" href="ports_8h.html#0633bbb5cbea218c029227b5171d003d">00097</a> <a class="code" href="ports_8h.html#0633bbb5cbea218c029227b5171d003d">cop_reset</a> (<span class="keywordtype">void</span>) |
119 <a name="l00098"></a>00098 { |
119 <a name="l00098"></a>00098 { |
120 <a name="l00099"></a>00099 <a class="code" href="portsaccess_8h.html#cb39c27c5b828bb40948690ed0fc9462">_io_ports</a>[<a class="code" href="ports__def_8h.html#7bf7cb62aaf7a62ee735a63b09575cd3">ARMCOP</a>] = 0x55; |
120 <a name="l00099"></a>00099 <a class="code" href="portsaccess_8h.html#3ff97cc4d692e20bf82d84ddadc93c55">_io_ports</a>[<a class="code" href="ports__def_8h.html#342afc0f3654da6e84b827a27f38a929">ARMCOP</a>] = 0x55; |
121 <a name="l00100"></a>00100 <a class="code" href="portsaccess_8h.html#cb39c27c5b828bb40948690ed0fc9462">_io_ports</a>[<a class="code" href="ports__def_8h.html#7bf7cb62aaf7a62ee735a63b09575cd3">ARMCOP</a>] = 0xAA; |
121 <a name="l00100"></a>00100 <a class="code" href="portsaccess_8h.html#3ff97cc4d692e20bf82d84ddadc93c55">_io_ports</a>[<a class="code" href="ports__def_8h.html#342afc0f3654da6e84b827a27f38a929">ARMCOP</a>] = 0xAA; |
122 <a name="l00101"></a>00101 } |
122 <a name="l00101"></a>00101 } |
123 <a name="l00102"></a>00102 |
123 <a name="l00102"></a>00102 |
124 <a name="l00103"></a>00103 |
124 <a name="l00103"></a>00103 |
125 <a name="l00104"></a>00104 <span class="preprocessor">#if 0</span> |
125 <a name="l00104"></a>00104 <span class="preprocessor">#if 0</span> |
126 <a name="l00105"></a>00105 <span class="preprocessor"></span><span class="comment">/* Acknowledge the timer interrupt. */</span> |
126 <a name="l00105"></a>00105 <span class="preprocessor"></span><span class="comment">/* Acknowledge the timer interrupt. */</span> |
127 <a name="l00106"></a>00106 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> |
127 <a name="l00106"></a>00106 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> |
128 <a name="l00107"></a>00107 timer_acknowledge (<span class="keywordtype">void</span>) |
128 <a name="l00107"></a>00107 timer_acknowledge (<span class="keywordtype">void</span>) |
129 <a name="l00108"></a>00108 { |
129 <a name="l00108"></a>00108 { |
130 <a name="l00109"></a>00109 <a class="code" href="portsaccess_8h.html#cb39c27c5b828bb40948690ed0fc9462">_io_ports</a>[<a class="code" href="ports__def_8h.html#5d31366a1f46029bc8f323b6dde52178">TFLG2</a>] = 0x80; |
130 <a name="l00109"></a>00109 <a class="code" href="portsaccess_8h.html#3ff97cc4d692e20bf82d84ddadc93c55">_io_ports</a>[<a class="code" href="ports__def_8h.html#6883dc8577242d6f4a0c254c53b4a503">TFLG2</a>] = 0x80; |
131 <a name="l00110"></a>00110 } |
131 <a name="l00110"></a>00110 } |
132 <a name="l00111"></a>00111 |
132 <a name="l00111"></a>00111 |
133 <a name="l00112"></a>00112 <span class="comment">/* Initialize the timer. */</span> |
133 <a name="l00112"></a>00112 <span class="comment">/* Initialize the timer. */</span> |
134 <a name="l00113"></a>00113 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> |
134 <a name="l00113"></a>00113 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> |
135 <a name="l00114"></a>00114 timer_initialize_rate (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> divisor) |
135 <a name="l00114"></a>00114 timer_initialize_rate (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> divisor) |
136 <a name="l00115"></a>00115 { |
136 <a name="l00115"></a>00115 { |
137 <a name="l00116"></a>00116 <a class="code" href="portsaccess_8h.html#cb39c27c5b828bb40948690ed0fc9462">_io_ports</a>[M6811_TMSK2] = M6811_RTII | divisor; |
137 <a name="l00116"></a>00116 <a class="code" href="portsaccess_8h.html#3ff97cc4d692e20bf82d84ddadc93c55">_io_ports</a>[M6811_TMSK2] = M6811_RTII | divisor; |
138 <a name="l00117"></a>00117 } |
138 <a name="l00117"></a>00117 } |
139 <a name="l00118"></a>00118 |
139 <a name="l00118"></a>00118 |
140 <a name="l00119"></a>00119 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> |
140 <a name="l00119"></a>00119 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> |
141 <a name="l00120"></a>00120 cop_optional_reset (<span class="keywordtype">void</span>) |
141 <a name="l00120"></a>00120 cop_optional_reset (<span class="keywordtype">void</span>) |
142 <a name="l00121"></a>00121 { |
142 <a name="l00121"></a>00121 { |
143 <a name="l00122"></a>00122 <span class="preprocessor">#if defined(M6811_USE_COP) && M6811_USE_COP == 1</span> |
143 <a name="l00122"></a>00122 <span class="preprocessor">#if defined(M6811_USE_COP) && M6811_USE_COP == 1</span> |
144 <a name="l00123"></a>00123 <span class="preprocessor"></span> <a class="code" href="ports_8h.html#a91f7029f6abe99bed4852a32bbe3496">cop_reset</a> (); |
144 <a name="l00123"></a>00123 <span class="preprocessor"></span> <a class="code" href="ports_8h.html#0633bbb5cbea218c029227b5171d003d">cop_reset</a> (); |
145 <a name="l00124"></a>00124 <span class="preprocessor">#endif</span> |
145 <a name="l00124"></a>00124 <span class="preprocessor">#endif</span> |
146 <a name="l00125"></a>00125 <span class="preprocessor"></span>} |
146 <a name="l00125"></a>00125 <span class="preprocessor"></span>} |
147 <a name="l00126"></a>00126 |
147 <a name="l00126"></a>00126 |
148 <a name="l00127"></a>00127 <span class="comment">/* Set the board in the expanded mode to get access to external bus. */</span> |
148 <a name="l00127"></a>00127 <span class="comment">/* Set the board in the expanded mode to get access to external bus. */</span> |
149 <a name="l00128"></a>00128 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> |
149 <a name="l00128"></a>00128 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> |
150 <a name="l00129"></a>00129 set_bus_expanded (<span class="keywordtype">void</span>) |
150 <a name="l00129"></a>00129 set_bus_expanded (<span class="keywordtype">void</span>) |
151 <a name="l00130"></a>00130 { |
151 <a name="l00130"></a>00130 { |
152 <a name="l00131"></a>00131 <a class="code" href="portsaccess_8h.html#cb39c27c5b828bb40948690ed0fc9462">_io_ports</a>[M6811_HPRIO] |= M6811_MDA; |
152 <a name="l00131"></a>00131 <a class="code" href="portsaccess_8h.html#3ff97cc4d692e20bf82d84ddadc93c55">_io_ports</a>[M6811_HPRIO] |= M6811_MDA; |
153 <a name="l00132"></a>00132 } |
153 <a name="l00132"></a>00132 } |
154 <a name="l00133"></a>00133 |
154 <a name="l00133"></a>00133 |
155 <a name="l00134"></a>00134 |
155 <a name="l00134"></a>00134 |
156 <a name="l00135"></a>00135 <span class="comment">/* Set the board in single chip mode. */</span> |
156 <a name="l00135"></a>00135 <span class="comment">/* Set the board in single chip mode. */</span> |
157 <a name="l00136"></a>00136 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> |
157 <a name="l00136"></a>00136 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> |
158 <a name="l00137"></a>00137 set_bus_single_chip (<span class="keywordtype">void</span>) |
158 <a name="l00137"></a>00137 set_bus_single_chip (<span class="keywordtype">void</span>) |
159 <a name="l00138"></a>00138 { |
159 <a name="l00138"></a>00138 { |
160 <a name="l00139"></a>00139 <a class="code" href="portsaccess_8h.html#cb39c27c5b828bb40948690ed0fc9462">_io_ports</a>[M6811_HPRIO] &= ~M6811_MDA; |
160 <a name="l00139"></a>00139 <a class="code" href="portsaccess_8h.html#3ff97cc4d692e20bf82d84ddadc93c55">_io_ports</a>[M6811_HPRIO] &= ~M6811_MDA; |
161 <a name="l00140"></a>00140 } |
161 <a name="l00140"></a>00140 } |
162 <a name="l00141"></a>00141 |
162 <a name="l00141"></a>00141 |
163 <a name="l00142"></a>00142 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> |
163 <a name="l00142"></a>00142 <span class="keyword">extern</span> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> |
164 <a name="l00143"></a>00143 get_input_capture_1 (<span class="keywordtype">void</span>) |
164 <a name="l00143"></a>00143 get_input_capture_1 (<span class="keywordtype">void</span>) |
165 <a name="l00144"></a>00144 { |
165 <a name="l00144"></a>00144 { |