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
#ifndef __CORE_SYNOPSYSOTG_SYNOPSYSOTG_H__
#define __CORE_SYNOPSYSOTG_SYNOPSYSOTG_H__

#include "global.h"
#include "protocol/usb/usb.h"

struct __attribute__((packed,aligned(4))) synopsysotg_config
{
    volatile USB_OTG_CORE_REGS* core;
    uint32_t use_ulpi : 1;
    uint32_t use_dma : 1;
    uint32_t disable_double_buffering : 1;
    uint32_t reserved0 : 5;
    uint8_t reserved1;
    uint16_t fifosize;
    uint16_t txfifosize[16];
};

struct __attribute__((packed,aligned(4))) synopsysotg_state
{
    int dummy[0];
    struct
    {
        uint32_t* rxaddr;
        const uint32_t* txaddr;
    } endpoints[];
};

extern const struct usb_driver synopsysotg_driver;

extern void synopsysotg_irq(const struct usb_instance* instance);
extern void synopsysotg_target_enable_clocks(const struct usb_instance* instance);
extern void synopsysotg_target_enable_irq(const struct usb_instance* instance);
extern void synopsysotg_target_disable_irq(const struct usb_instance* instance);
extern void synopsysotg_target_clear_irq(const struct usb_instance* instance);

#endif