1 |
9 |
nussgipfel |
/* -*- c -*- */
|
2 |
|
|
/*
|
3 |
|
|
* Copyright 2003 Free Software Foundation, Inc.
|
4 |
|
|
*
|
5 |
|
|
* This file is part of GNU Radio
|
6 |
|
|
*
|
7 |
|
|
* GNU Radio is free software; you can redistribute it and/or modify
|
8 |
|
|
* it under the terms of the GNU General Public License as published by
|
9 |
|
|
* the Free Software Foundation; either version 3, or (at your option)
|
10 |
|
|
* any later version.
|
11 |
|
|
*
|
12 |
|
|
* GNU Radio is distributed in the hope that it will be useful,
|
13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
* GNU General Public License for more details.
|
16 |
|
|
*
|
17 |
|
|
* You should have received a copy of the GNU General Public License
|
18 |
|
|
* along with GNU Radio; see the file COPYING. If not, write to
|
19 |
|
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
20 |
|
|
* Boston, MA 02110-1301, USA.
|
21 |
|
|
*/
|
22 |
|
|
|
23 |
|
|
/*********************************************************************/
|
24 |
|
|
/** \file usb_common.h
|
25 |
|
|
*********************************************************************
|
26 |
|
|
* \brief basic functions to setup and enable USB functionality
|
27 |
|
|
*
|
28 |
|
|
* usb_common provides the basic functions and interrupt
|
29 |
|
|
* routines to enable USB communication and handling of all
|
30 |
|
|
* basic functions like standard requests, USB reset,
|
31 |
|
|
* descriptor handling etc.\n
|
32 |
|
|
* When a USB Class command or a USB Vendor specific command
|
33 |
|
|
* is received usb_common calls the app_class_cmd or the
|
34 |
|
|
* app_vendor_cmd function. These functions are not implemented
|
35 |
|
|
* here. This is done by the user programm.
|
36 |
|
|
*
|
37 |
|
|
* \author GNUradio, Christoph Zimmermann bfh.ch
|
38 |
|
|
*
|
39 |
|
|
*/
|
40 |
|
|
|
41 |
|
|
#ifndef _USB_COMMON_H_
|
42 |
|
|
#define _USB_COMMON_H_
|
43 |
|
|
|
44 |
|
|
/** Global variable set by SUDAV isr (USB SETUP Data Available) */
|
45 |
|
|
extern volatile bit _usb_got_SUDAV;
|
46 |
|
|
|
47 |
|
|
/** Provided by user application to handle CLASS commands.
|
48 |
|
|
* \return returns non-zero if it handled the command. */
|
49 |
|
|
unsigned char app_class_cmd (void);
|
50 |
|
|
|
51 |
|
|
/** Provided by user application to handle VENDOR commands.
|
52 |
|
|
* \return returns non-zero if it handled the command. */
|
53 |
|
|
unsigned char app_vendor_cmd (void);
|
54 |
|
|
|
55 |
|
|
/** Installs the interrupt handlers to handle the standard USB interrupts */
|
56 |
|
|
void usb_install_handlers (void);
|
57 |
|
|
|
58 |
|
|
/** Handles the setup package and the basic device requests like reading
|
59 |
|
|
* descriptors, get/set confifuration etc. \n
|
60 |
|
|
* Also calls the app_class_cmd or app_vendor_cmd functions when needed. */
|
61 |
|
|
void usb_handle_setup_packet (void);
|
62 |
|
|
|
63 |
|
|
#ifdef USB_DFU_SUPPORT
|
64 |
|
|
/** Changes the interrupt handlers from runtime mode to DFU mode handlers
|
65 |
|
|
* and the oposite. */
|
66 |
|
|
void usb_toggle_dfu_handlers (void);
|
67 |
|
|
#endif
|
68 |
|
|
|
69 |
|
|
/** makro to check if new setup data is available */
|
70 |
|
|
#define usb_setup_packet_avail() _usb_got_SUDAV
|
71 |
|
|
|
72 |
|
|
#endif /* _USB_COMMON_H_ */
|