summaryrefslogtreecommitdiffstats
path: root/firmware/export/usb_core.h
blob: be3e4789d985f23f6453d8f8c23cc33356a3acfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id:  $
 *
 * Copyright (C) 2007 by Björn Stenberg
 *
 * All files in this archive are subject to the GNU General Public License.
 * See the file COPYING in the source tree root for full license agreement.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ****************************************************************************/
#ifndef USB_CORE_H
#define USB_CORE_H

#include "usb_ch9.h"

#if defined(CPU_PP)
#define USB_IRAM_ORIGIN   ((unsigned char *)0x4000c000)
#define USB_IRAM_SIZE     ((size_t)0xc000)
#endif

/* endpoints */
enum {
    EP_CONTROL = 0,
    EP_RX,
    EP_TX,
    NUM_ENDPOINTS
};

/* queue events */
#define USB_TRANSFER_COMPLETE 1

struct queue_msg {
    int endpoint;
    int length;
    void* data;
};

extern int usb_max_pkt_size;

void usb_core_init(void);
void usb_core_exit(void);
void usb_core_control_request(struct usb_ctrlrequest* req);
void usb_core_transfer_complete(int endpoint, bool in);
void usb_core_bus_reset(void);

#endif