/* * XIOH power sequence * Copyright (C) 2013 Avencall * * serial.h - traces to serial console * Authors: * Guillaume Knispel * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef SERIAL_H #define SERIAL_H #include "config.h" #ifdef TRACE_SERIAL #ifdef TEST_LOOP_SPEED #define TL_WAIT 0 #define TL_COUNT -1 #define TL_SAVED -2 extern u8 tl_delta; extern s8 tl_state; extern u16 tl_num; extern u16 ref_Timer_A_count; u16 tl_emit(void); #define TRACE_WHAT(ms, loops) (loops) #else /* ndef TEST_LOOP_SPEED: */ #define TRACE_WHAT(ms, loops) (ms) #endif /* TEST_LOOP_SPEED */ void SerialInit(void); void serial_puts(const char *s); void trace(u16 tstamp, u8 state, u8 infos); #define trace_state(ns) \ do { \ u8 s3inreg_ = SLP_S3_N(inreg); \ trace(TRACE_WHAT(Timer_A_count, tl_emit()), \ (ns), s3inreg_ & SLP_S3_N(bit)); \ } while (0) void trace_changes(u8 state); void dump_trace(void); #else /* ndef TRACE_SERIAL */ #define trace_state(ns) do { } while (0) #define trace_changes(state) do { } while (0) #endif /* TRACE_SERIAL */ #endif /* SERIAL_H */