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

Subversion Repositories usb_fpga_2_16

[/] [usb_fpga_2_16/] [trunk/] [examples/] [all/] [debug/] [debug.c] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ZTEX
/*!
2
   debug -- debug helper example
3 3 ZTEX
   Copyright (C) 2009-2014 ZTEX GmbH.
4 2 ZTEX
   http://www.ztex.de
5
 
6
   This program is free software; you can redistribute it and/or modify
7
   it under the terms of the GNU General Public License version 3 as
8
   published by the Free Software Foundation.
9
 
10
   This program is distributed in the hope that it will be useful, but
11
   WITHOUT ANY WARRANTY; without even the implied warranty of
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
   General Public License for more details.
14
 
15
   You should have received a copy of the GNU General Public License
16
   along with this program; if not, see http://www.gnu.org/licenses/.
17
!*/
18
 
19
 
20
#include[ztex-conf.h]   // Loads the configuration macros, see ztex-conf.h for the available macros
21
#include[ztex-utils.h]  // include basic functions
22
 
23
// thin initializes the debug helper with a 32 messages stack and 4 bytes per message
24
ENABLE_DEBUG(32,3);
25
 
26
// this product string is also used for identification by the host software
27
#define[PRODUCT_STRING]["debug for EZ-USB devices"]
28
 
29
// include the main part of the firmware kit, define the descriptors, ...
30
#include[ztex.h]
31
 
32
void main(void)
33
{
34
    WORD i;
35
    BYTE b;
36
 
37
// init everything
38
    init_USB();
39
 
40
    i=0;
41
    while (1) {
42
 
43
        debug_msg_buf[0] = i;            // write second counter to the message buffer
44
        debug_msg_buf[1] = i >> 8;
45
        debug_add_msg();                // add the message to the stack
46
        i+=1;
47
 
48
        for (b=0; b<100; b++) {          // 100 x 10ms
49
            debug_stack_ptr[2] = b;     // write the 10ms tick number to the current message in stack
50
            wait(10);                   // wait 10ms
51
        }
52
    }
53
}
54
 

powered by: WebSVN 2.1.0

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