-
Notifications
You must be signed in to change notification settings - Fork 0
/
usbotghs_handler.h
76 lines (66 loc) · 2.16 KB
/
usbotghs_handler.h
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
*
* Copyright 2019 The wookey project team <[email protected]>
* - Ryad Benadjila
* - Arnauld Michelizza
* - Mathieu Renard
* - Philippe Thierry
* - Philippe Trebuchet
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* the Free Software Foundation; either version 3 of the License, or (at
* ur option) any later version.
*
* This package is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this package; if not, write to the Free Software Foundation, Inc., 51
* Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef USBOTGHS_HANDLER_H_
#define USBOTGHS_HANDLER_H_
#include "libc/types.h"
/*
* OTG_HS_GRXSTSR/OTG_HS_GRXSTSP fields typeseting, needed by oepint/iepint handlers
*/
/*
* Host IN packet possible status. Other values are reserved
*/
typedef enum {
PKT_STATUS_IN_DATA_PKT_RECV = 0x02,
PKT_STATUS_IN_TRANSFER_COMPLETE = 0x03,
PKT_STATUS_DATA_TOGGLE_ERROR = 0x05,
PKT_STATUS_CHANNEL_HALTED = 0x07,
} host_pkt_status_t;
/*
* Device OUT packet possible status. Other values are reserved
*/
typedef enum {
PKT_STATUS_GLOBAL_OUT_NAK = 0x01,
PKT_STATUS_OUT_DATA_PKT_RECV = 0x02,
PKT_STATUS_OUT_TRANSFER_COMPLETE = 0x03,
PKT_STATUS_SETUP_TRANS_COMPLETE = 0x04,
PKT_STATUS_SETUP_PKT_RECEIVED = 0x06,
} device_pkt_status_t;
/*
* The packet status field content doesn't have the same meaning depending on the current
* mode (Device or host)
*/
typedef union {
host_pkt_status_t hoststs;
device_pkt_status_t devsts;
} pkt_status_t;
typedef enum {
DATA_PID_DATA0 = 0x0,
DATA_PID_DATA1 = 0x1,
DATA_PID_DATA2 = 0x2,
DATA_PID_MDATA = 0x3,
} data_pid_t;
void USBOTGHS_IRQHandler(uint8_t interrupt,
uint32_t sr,
uint32_t dr);
#endif/*!USBOTGHS_HANDLER_H_*/