29
29
#include "qemu/module.h"
30
30
#include "qemu/timer.h"
31
31
#include "adb-internal.h"
32
+ #include "trace.h"
32
33
33
34
/* error codes */
34
35
#define ADB_RET_NOTPRESENT (-2)
35
36
37
+ static const char * adb_commands [] = {
38
+ "RESET" , "FLUSH" , "(Reserved 0x2)" , "(Reserved 0x3)" ,
39
+ "Reserved (0x4)" , "(Reserved 0x5)" , "(Reserved 0x6)" , "(Reserved 0x7)" ,
40
+ "LISTEN r0" , "LISTEN r1" , "LISTEN r2" , "LISTEN r3" ,
41
+ "TALK r0" , "TALK r1" , "TALK r2" , "TALK r3" ,
42
+ };
43
+
36
44
static void adb_device_reset (ADBDevice * d )
37
45
{
38
46
qdev_reset_all (DEVICE (d ));
@@ -86,9 +94,16 @@ static int do_adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf,
86
94
87
95
int adb_request (ADBBusState * s , uint8_t * obuf , const uint8_t * buf , int len )
88
96
{
97
+ int ret ;
98
+
99
+ trace_adb_bus_request (buf [0 ] >> 4 , adb_commands [buf [0 ] & 0xf ], len );
100
+
89
101
assert (s -> autopoll_blocked );
90
102
91
- return do_adb_request (s , obuf , buf , len );
103
+ ret = do_adb_request (s , obuf , buf , len );
104
+
105
+ trace_adb_bus_request_done (buf [0 ] >> 4 , adb_commands [buf [0 ] & 0xf ], ret );
106
+ return ret ;
92
107
}
93
108
94
109
int adb_poll (ADBBusState * s , uint8_t * obuf , uint16_t poll_mask )
@@ -161,6 +176,7 @@ void adb_set_autopoll_mask(ADBBusState *s, uint16_t mask)
161
176
void adb_autopoll_block (ADBBusState * s )
162
177
{
163
178
s -> autopoll_blocked = true;
179
+ trace_adb_bus_autopoll_block (s -> autopoll_blocked );
164
180
165
181
if (s -> autopoll_enabled ) {
166
182
timer_del (s -> autopoll_timer );
@@ -170,6 +186,7 @@ void adb_autopoll_block(ADBBusState *s)
170
186
void adb_autopoll_unblock (ADBBusState * s )
171
187
{
172
188
s -> autopoll_blocked = false;
189
+ trace_adb_bus_autopoll_block (s -> autopoll_blocked );
173
190
174
191
if (s -> autopoll_enabled ) {
175
192
timer_mod (s -> autopoll_timer ,
@@ -183,7 +200,9 @@ static void adb_autopoll(void *opaque)
183
200
ADBBusState * s = opaque ;
184
201
185
202
if (!s -> autopoll_blocked ) {
203
+ trace_adb_bus_autopoll_cb (s -> autopoll_mask );
186
204
s -> autopoll_cb (s -> autopoll_cb_opaque );
205
+ trace_adb_bus_autopoll_cb_done (s -> autopoll_mask );
187
206
}
188
207
189
208
timer_mod (s -> autopoll_timer ,
0 commit comments