URL
https://opencores.org/ocsvn/usb_fpga_1_11/usb_fpga_1_11/trunk
Subversion Repositories usb_fpga_1_11
[/] [usb_fpga_1_11/] [trunk/] [examples/] [all/] [debug/] [Readme] - Rev 5
Compare with Previous | Blame | View Log
debug-----This example explains the usage of the debug helper and should workon all EZ-USB Products.The debug helper provides a simple interface to store statusinformations or other data which can be read out from host PC using theAPI.The debug helper is stack orientated and initialized using the"ENABLE_DEBUG(<stack size>,<message_size>);" macro, where <stack size>denotes the maximum number of messages in stack and <message size>denotes the message size in bytes.Two variables and one function are used for the message control:/*This buffer is used to buffer the message. The user shouldwrite the data to this buffer.*/__xdata BYTE debug_msg_buf[DEBUG_MSG_SIZE];/*Points the the last message on message stack. This can be used tomodify / update the last message*/__xdata BYTE* xdata debug_stack_ptr;/*Adds the message stored in debug_msg_buf to the message stack*/void debug_add_msg ();The messages can be read out from host PC using the following APImethods and variables:/*Is set by debugReadMessages(boolean,byte[]) and contains the numberof new messages.*/public int debugNewMessages;/*Returns the size of message stack in messages.*/public int debugStackSize ( );/*Returns the size of messages in bytes.*/public int debugMsgSize ( );/*Returns the number of the last message read out bydebugStackSize(boolean,byte[])*/public final int debuglastMsg ( );/*Reads debug messages from message stack. The number of messagesstored in buf is returned. The total number of new messages is storedin debugNewMessages. The number of the latest message is returned bydebuglastMessage().If parameter all is true, all messages from stack are written to buf.If it is false, only the new messages are written to buf.*/public int debugReadMessages ( boolean all, byte[] buf );The example creates one debug message per second. Each message is 3bytes long. The first two bytes contain the second counter, the lastbyte contains a another counter which is incremented every 10ms.
