OpenCores
URL https://opencores.org/ocsvn/usb_fpga_2_13/usb_fpga_2_13/trunk

Subversion Repositories usb_fpga_2_13

[/] [usb_fpga_2_13/] [trunk/] [examples/] [all/] [debug/] [Readme] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ZTEX
debug
2
-----
3
 
4
This example explains the usage of the debug helper and should work
5
on all EZ-USB Products.
6
 
7
The debug helper provides a simple interface to store status
8
informations or other data which can be read out from host PC using the
9
API.
10
 
11
The debug helper is stack orientated and initialized using the
12
"ENABLE_DEBUG(,);" macro, where 
13
denotes the maximum number of messages in stack and 
14
denotes the message size in bytes.
15
 
16
Two variables and one function are used for the message control:
17
 
18
/*
19
   This buffer is used to buffer the message. The user should
20
   write the data to this buffer.
21
*/
22
__xdata BYTE debug_msg_buf[DEBUG_MSG_SIZE];
23
 
24
/*
25
   Points the the last message on message stack. This can be used to
26
   modify / update the last message
27
*/
28
__xdata BYTE* xdata debug_stack_ptr;
29
 
30
/*
31
   Adds the message stored in debug_msg_buf to the message stack
32
*/
33
void debug_add_msg ();
34
 
35
The messages can be read out from host PC using the following API
36
methods and variables:
37
 
38
/*
39
   Is set by debugReadMessages(boolean,byte[]) and contains the number
40
   of new messages.
41
*/
42
public int debugNewMessages;
43
 
44
/*
45
   Returns the size of message stack in messages.
46
*/
47
public int debugStackSize ( );
48
 
49
/*
50
   Returns the size of messages in bytes.
51
*/
52
public int debugMsgSize ( );
53
 
54
/*
55
   Returns the number of the last message read out by
56
   debugStackSize(boolean,byte[])
57
*/
58
public final int debuglastMsg ( );
59
 
60
/*
61
   Reads debug messages from message stack. The number of messages
62
   stored in buf is returned. The total number of new messages is stored
63
   in debugNewMessages. The number of the latest message is returned by
64
   debuglastMessage().
65
 
66
   If parameter all is true, all messages from stack are written to buf.
67
   If it is false, only the new messages are written to buf.
68
*/
69
public int debugReadMessages ( boolean all, byte[] buf );
70
 
71
 
72
The example creates one debug message per second. Each message is 3
73
bytes long. The first two bytes contain the second counter, the last
74
byte contains a another counter which is incremented every 10ms.

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.