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
165
166
|
/* -*- c++ -*- */
/*
* Copyright 2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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, or (at your option)
* any later version.
*
* GNU Radio 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, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef INCLUDED_GC_LOGGING_H
#define INCLUDED_GC_LOGGING_H
#include <gc_types.h>
#include <string.h>
__GC_BEGIN_DECLS
typedef struct gc_log {
gc_eaddr_t base; // gc_log_entry_t * (16 byte aligned)
uint32_t nentries; // number of entries (power-of-2)
} gc_log_t;
typedef struct gc_log_entry {
uint32_t seqno; // monotonic sequence number
uint32_t timestamp; // decrementer value (wraps every 53s on PS3)
uint16_t subsystem; // 0 to 255 reserved for system, user gets 256 and up
uint16_t event;
uint32_t info[5];
} _AL16 gc_log_entry_t;
#define GCL_SS_SYS 0 // lowest system reserved subsystem
#define GCL_SS_USER 256 // lowest user reserved subsystem
/*
* The resulting log files can be displayed using using:
*
* $ od -t x4 -w32 spu_log.00 | less
*/
#if defined(__SPU__)
/*!
* System fills in seqno and timestamp. User is responsible for the rest.
*/
void _gc_log_write(gc_log_entry_t entry);
#ifdef ENABLE_GC_LOGGING
#define gc_log_write(entry) _gc_log_write(entry)
#else
#define gc_log_write(entry) do { } while (0)
#endif
inline static void
gc_log_write0(int subsystem, int event)
{
gc_log_entry_t e;
e.subsystem = subsystem;
e.event = event;
e.info[0] = 0;
e.info[1] = 0;
e.info[2] = 0;
e.info[3] = 0;
e.info[4] = 0;
gc_log_write(e);
}
inline static void
gc_log_write1(int subsystem, int event,
uint32_t info0)
{
gc_log_entry_t e;
e.subsystem = subsystem;
e.event = event;
e.info[0] = info0;
e.info[1] = 0;
e.info[2] = 0;
e.info[3] = 0;
e.info[4] = 0;
gc_log_write(e);
}
inline static void
gc_log_write2(int subsystem, int event,
uint32_t info0, uint32_t info1)
{
gc_log_entry_t e;
e.subsystem = subsystem;
e.event = event;
e.info[0] = info0;
e.info[1] = info1;
e.info[2] = 0;
e.info[3] = 0;
e.info[4] = 0;
gc_log_write(e);
}
inline static void
gc_log_write3(int subsystem, int event,
uint32_t info0, uint32_t info1, uint32_t info2)
{
gc_log_entry_t e;
e.subsystem = subsystem;
e.event = event;
e.info[0] = info0;
e.info[1] = info1;
e.info[2] = info2;
e.info[3] = 0;
e.info[4] = 0;
gc_log_write(e);
}
inline static void
gc_log_write4(int subsystem, int event,
uint32_t info0, uint32_t info1, uint32_t info2, uint32_t info3)
{
gc_log_entry_t e;
e.subsystem = subsystem;
e.event = event;
e.info[0] = info0;
e.info[1] = info1;
e.info[2] = info2;
e.info[3] = info3;
e.info[4] = 0;
gc_log_write(e);
}
inline static void
gc_log_write5(int subsystem, int event,
uint32_t info0, uint32_t info1, uint32_t info2, uint32_t info3, uint32_t info4)
{
gc_log_entry_t e;
e.subsystem = subsystem;
e.event = event;
e.info[0] = info0;
e.info[1] = info1;
e.info[2] = info2;
e.info[3] = info3;
e.info[4] = info4;
gc_log_write(e);
}
/*!
* One time initialization called by system runtime
*/
void
_gc_log_init(gc_log_t log_info);
#endif
__GC_END_DECLS
#endif /* INCLUDED_GC_LOGGING_H */
|