Open FFBoard
Open source force feedback firmware
dcd_lpc17_40.h
Go to the documentation of this file.
1/*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2019 Ha Thach (tinyusb.org)
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 *
24 * This file is part of the TinyUSB stack.
25 */
26
27#ifndef _TUSB_DCD_LPC17_40_H_
28#define _TUSB_DCD_LPC17_40_H_
29
30#include "common/tusb_common.h"
31
32#ifdef __cplusplus
33 extern "C" {
34#endif
35
36//--------------------------------------------------------------------+
37// Register Interface
38//--------------------------------------------------------------------+
39
40//------------- USB Interrupt USBIntSt -------------//
41//enum {
42// DCD_USB_REQ_LOW_PRIO_MASK = TU_BIT(0),
43// DCD_USB_REQ_HIGH_PRIO_MASK = TU_BIT(1),
44// DCD_USB_REQ_DMA_MASK = TU_BIT(2),
45// DCD_USB_REQ_NEED_CLOCK_MASK = TU_BIT(8),
46// DCD_USB_REQ_ENABLE_MASK = TU_BIT(31)
47//};
48
49//------------- Device Interrupt USBDevInt -------------//
50enum {
51 DEV_INT_FRAME_MASK = TU_BIT(0),
52 DEV_INT_ENDPOINT_FAST_MASK = TU_BIT(1),
53 DEV_INT_ENDPOINT_SLOW_MASK = TU_BIT(2),
54 DEV_INT_DEVICE_STATUS_MASK = TU_BIT(3),
55 DEV_INT_COMMAND_CODE_EMPTY_MASK = TU_BIT(4),
56 DEV_INT_COMMAND_DATA_FULL_MASK = TU_BIT(5),
57 DEV_INT_RX_ENDPOINT_PACKET_MASK = TU_BIT(6),
58 DEV_INT_TX_ENDPOINT_PACKET_MASK = TU_BIT(7),
59 DEV_INT_ENDPOINT_REALIZED_MASK = TU_BIT(8),
60 DEV_INT_ERROR_MASK = TU_BIT(9)
61};
62
63//------------- DMA Interrupt USBDMAInt-------------//
64enum {
67 DMA_INT_ERROR_MASK = TU_BIT(2)
68};
69
70//------------- USBCtrl -------------//
71enum {
74};
75
76//------------- USBRxPLen -------------//
77enum {
81};
82
83//------------- SIE Command Code -------------//
84typedef enum
85{
90
91enum {
92 // device commands
101
102 // endpoint commands
103 SIE_CMDCODE_ENDPOINT_SELECT = 0x00, // + endpoint index
104 SIE_CMDCODE_ENDPOINT_SELECT_CLEAR_INTERRUPT = 0x40, // + endpoint index, should use USBEpIntClr instead
105 SIE_CMDCODE_ENDPOINT_SET_STATUS = 0x40, // + endpoint index
109
110//------------- SIE Device Status (get/set from SIE_CMDCODE_DEVICE_STATUS) -------------//
111enum {
116 SIE_DEV_STATUS_RESET_MASK = TU_BIT(4)
118
119//------------- SIE Select Endpoint Command -------------//
120enum {
121 SIE_SELECT_ENDPOINT_FULL_EMPTY_MASK = TU_BIT(0), // 0: empty, 1 full. IN endpoint checks empty, OUT endpoint check full
123 SIE_SELECT_ENDPOINT_SETUP_RECEIVED_MASK = TU_BIT(2), // clear by SIE_CMDCODE_ENDPOINT_SELECT_CLEAR_INTERRUPT
124 SIE_SELECT_ENDPOINT_PACKET_OVERWRITTEN_MASK = TU_BIT(3), // previous packet is overwritten by a SETUP packet
125 SIE_SELECT_ENDPOINT_NAK_MASK = TU_BIT(4), // last packet response is NAK (auto clear by an ACK)
129
130typedef enum
131{
137
138//------------- DMA Descriptor Status -------------//
139enum {
143 DD_STATUS_DATA_UNDERUN, // short packet
147
148#ifdef __cplusplus
149 }
150#endif
151
152#endif
@ USBRXPLEN_PACKET_READY_MASK
Definition: dcd_lpc17_40.h:80
@ USBRXPLEN_PACKET_LENGTH_MASK
Definition: dcd_lpc17_40.h:78
@ USBRXPLEN_DATA_VALID_MASK
Definition: dcd_lpc17_40.h:79
@ DMA_INT_ERROR_MASK
Definition: dcd_lpc17_40.h:67
@ DMA_INT_END_OF_XFER_MASK
Definition: dcd_lpc17_40.h:65
@ DMA_INT_NEW_DD_REQUEST_MASK
Definition: dcd_lpc17_40.h:66
@ SIE_DEV_STATUS_SUSPEND_MASK
Definition: dcd_lpc17_40.h:114
@ SIE_DEV_STATUS_CONNECT_STATUS_MASK
Definition: dcd_lpc17_40.h:112
@ SIE_DEV_STATUS_CONNECT_CHANGE_MASK
Definition: dcd_lpc17_40.h:113
@ SIE_DEV_STATUS_RESET_MASK
Definition: dcd_lpc17_40.h:116
@ SIE_DEV_STATUS_SUSPEND_CHANGE_MASK
Definition: dcd_lpc17_40.h:115
sie_endpoint_set_status_mask_t
Definition: dcd_lpc17_40.h:131
@ SIE_SET_ENDPOINT_STALLED_MASK
Definition: dcd_lpc17_40.h:132
@ SIE_SET_ENDPOINT_RATE_FEEDBACK_MASK
Definition: dcd_lpc17_40.h:134
@ SIE_SET_ENDPOINT_DISABLED_MASK
Definition: dcd_lpc17_40.h:133
@ SIE_SET_ENDPOINT_CONDITION_STALLED_MASK
Definition: dcd_lpc17_40.h:135
@ SIE_CMDCODE_ENDPOINT_SELECT
Definition: dcd_lpc17_40.h:103
@ SIE_CMDCODE_READ_FRAME_NUMBER
Definition: dcd_lpc17_40.h:96
@ SIE_CMDCODE_ENDPOINT_SELECT_CLEAR_INTERRUPT
Definition: dcd_lpc17_40.h:104
@ SIE_CMDCODE_BUFFER_CLEAR
Definition: dcd_lpc17_40.h:106
@ SIE_CMDCODE_READ_ERROR_STATUS
Definition: dcd_lpc17_40.h:100
@ SIE_CMDCODE_ENDPOINT_SET_STATUS
Definition: dcd_lpc17_40.h:105
@ SIE_CMDCODE_SET_ADDRESS
Definition: dcd_lpc17_40.h:93
@ SIE_CMDCODE_READ_TEST_REGISTER
Definition: dcd_lpc17_40.h:97
@ SIE_CMDCODE_DEVICE_STATUS
Definition: dcd_lpc17_40.h:98
@ SIE_CMDCODE_BUFFER_VALIDATE
Definition: dcd_lpc17_40.h:107
@ SIE_CMDCODE_CONFIGURE_DEVICE
Definition: dcd_lpc17_40.h:94
@ SIE_CMDCODE_GET_ERROR
Definition: dcd_lpc17_40.h:99
@ SIE_CMDCODE_SET_MODE
Definition: dcd_lpc17_40.h:95
sie_cmdphase_t
Definition: dcd_lpc17_40.h:85
@ SIE_CMDPHASE_WRITE
Definition: dcd_lpc17_40.h:86
@ SIE_CMDPHASE_READ
Definition: dcd_lpc17_40.h:87
@ SIE_CMDPHASE_COMMAND
Definition: dcd_lpc17_40.h:88
@ USBCTRL_READ_ENABLE_MASK
Definition: dcd_lpc17_40.h:72
@ USBCTRL_WRITE_ENABLE_MASK
Definition: dcd_lpc17_40.h:73
@ DD_STATUS_BEING_SERVICED
Definition: dcd_lpc17_40.h:141
@ DD_STATUS_DATA_OVERRUN
Definition: dcd_lpc17_40.h:144
@ DD_STATUS_SYSTEM_ERROR
Definition: dcd_lpc17_40.h:145
@ DD_STATUS_NORMAL
Definition: dcd_lpc17_40.h:142
@ DD_STATUS_DATA_UNDERUN
Definition: dcd_lpc17_40.h:143
@ DD_STATUS_NOT_SERVICED
Definition: dcd_lpc17_40.h:140
@ SIE_SELECT_ENDPOINT_PACKET_OVERWRITTEN_MASK
Definition: dcd_lpc17_40.h:124
@ SIE_SELECT_ENDPOINT_BUFFER2_FULL_MASK
Definition: dcd_lpc17_40.h:127
@ SIE_SELECT_ENDPOINT_STALL_MASK
Definition: dcd_lpc17_40.h:122
@ SIE_SELECT_ENDPOINT_NAK_MASK
Definition: dcd_lpc17_40.h:125
@ SIE_SELECT_ENDPOINT_SETUP_RECEIVED_MASK
Definition: dcd_lpc17_40.h:123
@ SIE_SELECT_ENDPOINT_FULL_EMPTY_MASK
Definition: dcd_lpc17_40.h:121
@ SIE_SELECT_ENDPOINT_BUFFER1_FULL_MASK
Definition: dcd_lpc17_40.h:126