| 1 | /* |
| 2 | * Copyright (C) 2009 - Pierre-Marc Fournier (pierre-marc dot fournier at polymtl dot ca) |
| 3 | * Copyright (C) 2008 - Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca) |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #ifndef TRACERCONST_H |
| 21 | #define TRACERCONST_H |
| 22 | |
| 23 | /* Hardcoded event headers |
| 24 | * |
| 25 | * event header for a trace with active heartbeat : 27 bits timestamps |
| 26 | * |
| 27 | * headers are 32-bits aligned. In order to insure such alignment, a dynamic per |
| 28 | * trace alignment value must be done. |
| 29 | * |
| 30 | * Remember that the C compiler does align each member on the boundary |
| 31 | * equivalent to their own size. |
| 32 | * |
| 33 | * As relay subbuffers are aligned on pages, we are sure that they are 4 and 8 |
| 34 | * bytes aligned, so the buffer header and trace header are aligned. |
| 35 | * |
| 36 | * Event headers are aligned depending on the trace alignment option. |
| 37 | * |
| 38 | * Note using C structure bitfields for cross-endianness and portability |
| 39 | * concerns. |
| 40 | */ |
| 41 | |
| 42 | #define LTT_RESERVED_EVENTS 3 |
| 43 | #define LTT_EVENT_BITS 5 |
| 44 | #define LTT_FREE_EVENTS ((1 << LTT_EVENT_BITS) - LTT_RESERVED_EVENTS) |
| 45 | #define LTT_TSC_BITS 27 |
| 46 | #define LTT_TSC_MASK ((1 << LTT_TSC_BITS) - 1) |
| 47 | |
| 48 | struct ltt_event_header { |
| 49 | u32 id_time; /* 5 bits event id (MSB); 27 bits time (LSB) */ |
| 50 | }; |
| 51 | |
| 52 | /* Reservation flags */ |
| 53 | #define LTT_RFLAG_ID (1 << 0) |
| 54 | #define LTT_RFLAG_ID_SIZE (1 << 1) |
| 55 | #define LTT_RFLAG_ID_SIZE_TSC (1 << 2) |
| 56 | |
| 57 | #define LTT_MAX_SMALL_SIZE 0xFFFFU |
| 58 | |
| 59 | #endif /* TRACERCONST_H */ |