<ahref="chdebug_8c.html">Go to the documentation of this file.</a><divclass="fragment"><preclass="fragment"><aname="l00001"></a>00001 <spanclass="comment">/*</span>
<aname="l00040"></a>00040 <spanclass="preprocessor">#include "<aclass="code"href="ch_8h.html"title="ChibiOS/RT main include file.">ch.h</a>"</span>
<aname="l00054"></a>00054 trace_buffer.<aclass="code"href="struct_trace_buffer.html#a647a0c08bf641558f87ca690fd933097"title="Pointer to the ring buffer front.">tb_ptr</a> = &trace_buffer.<aclass="code"href="struct_trace_buffer.html#a3e5f6e61398a217126933b092afd1cea"title="Ring buffer.">tb_buffer</a>[0];
<aname="l00062"></a><aclass="code"href="group__debug.html#gac7f8f0653faf2e3a93108ff5333821b7">00062</a><spanclass="keywordtype">void</span><aclass="code"href="group__debug.html#gac7f8f0653faf2e3a93108ff5333821b7"title="Inserts in the circular debug trace buffer a context switch record.">chDbgTrace</a>(<aclass="code"href="struct_thread.html"title="Structure representing a thread.">Thread</a> *otp) {
<aname="l00063"></a>00063
<aname="l00064"></a>00064 trace_buffer.<aclass="code"href="struct_trace_buffer.html#a647a0c08bf641558f87ca690fd933097"title="Pointer to the ring buffer front.">tb_ptr</a>-><aclass="code"href="struct_ctx_swc_event.html#ac28fce73613158bf501382c110c4a0fa"title="Object where going to sleep.">cse_wtobjp</a> = otp-><aclass="code"href="struct_thread.html#a72cd0424b6098ca241fac1f74d21b56a"title="State-specific fields.">p_u</a>.<aclass="code"href="struct_thread.html#a4f016b01444741e6f9b420436b748862"title="Pointer to a generic &quot;wait&quot; object.">wtobjp</a>;
<aname="l00065"></a>00065 trace_buffer.<aclass="code"href="struct_trace_buffer.html#a647a0c08bf641558f87ca690fd933097"title="Pointer to the ring buffer front.">tb_ptr</a>-><aclass="code"href="struct_ctx_swc_event.html#a463c08b6776d7337d18b1965243abfc9"title="Time of the switch event.">cse_time</a> = <aclass="code"href="group__time.html#ga137c8f67c450f34416a786d169be90e2"title="Current system time.">chTimeNow</a>();
<aname="l00066"></a>00066 trace_buffer.<aclass="code"href="struct_trace_buffer.html#a647a0c08bf641558f87ca690fd933097"title="Pointer to the ring buffer front.">tb_ptr</a>-><aclass="code"href="struct_ctx_swc_event.html#a83d48714c7e96b1bb4f8756ea5cbaf56"title="Switched out thread state.">cse_state</a> = otp-><aclass="code"href="struct_thread.html#a3c3e9d6abccb62c3a5fab6ef043a391f"title="Current thread state.">p_state</a>;
<aname="l00067"></a>00067 trace_buffer.<aclass="code"href="struct_trace_buffer.html#a647a0c08bf641558f87ca690fd933097"title="Pointer to the ring buffer front.">tb_ptr</a>-><aclass="code"href="struct_ctx_swc_event.html#ad982bde0268f45b772c07d993de65a41"title="Switched in thread id.">cse_tid</a> = (unsigned)<aclass="code"href="group__scheduler.html#ga1a5fddde56420e8accd0c09c1abb32a7"title="Current thread pointer access macro.">currp</a>>> 6;
<aname="l00068"></a>00068 <spanclass="keywordflow">if</span> (++trace_buffer.<aclass="code"href="struct_trace_buffer.html#a647a0c08bf641558f87ca690fd933097"title="Pointer to the ring buffer front.">tb_ptr</a>>= &trace_buffer.<aclass="code"href="struct_trace_buffer.html#a3e5f6e61398a217126933b092afd1cea"title="Ring buffer.">tb_buffer</a>[<aclass="code"href="group__debug.html#ga85f9a678e5f44d97a8a21adab8c065b7"title="Trace buffer entries.">TRACE_BUFFER_SIZE</a>])
<aname="l00069"></a>00069 trace_buffer.<aclass="code"href="struct_trace_buffer.html#a647a0c08bf641558f87ca690fd933097"title="Pointer to the ring buffer front.">tb_ptr</a> = &trace_buffer.<aclass="code"href="struct_trace_buffer.html#a3e5f6e61398a217126933b092afd1cea"title="Ring buffer.">tb_buffer</a>[0];
<aname="l00080"></a><aclass="code"href="group__debug.html#ga218d35701e90bead41b249f80f58aac4">00080</a><spanclass="keywordtype">char</span> *<aclass="code"href="group__debug.html#ga218d35701e90bead41b249f80f58aac4"title="Pointer to the panic message.">panic_msg</a>;
<aname="l00087"></a><aclass="code"href="group__debug.html#ga3cfb02183cd13f939b9b666810511157">00087</a><spanclass="keywordtype">void</span><aclass="code"href="group__debug.html#ga3cfb02183cd13f939b9b666810511157"title="Prints a panic message on the console and then halts the system.">chDbgPanic</a>(<spanclass="keywordtype">char</span> *msg) {
<aname="l00088"></a>00088
<aname="l00089"></a>00089 <aclass="code"href="group__debug.html#ga218d35701e90bead41b249f80f58aac4"title="Pointer to the panic message.">panic_msg</a> = msg;
<aname="l00090"></a>00090 <aclass="code"href="group__system.html#gad43b78f160a2c983792af3041cc4a536"title="Halts the system.">chSysHalt</a>();
Generated on Sun Nov 28 2010 14:09:48 for ChibiOS/RT by <ahref="http://www.doxygen.org/index.html"><imgsrc="doxygen.png"alt="doxygen"align="middle"border="0"></a> 1.7.1</small></address>