libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
st_usbfs_v1.h
Go to the documentation of this file.
1/** @addtogroup usb_defines
2 */
3/*
4 * This file is part of the libopencm3 project.
5 *
6 * This library is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this library. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY !
21 * Use top-level <libopencm3/stm32/st_usbfs.h>
22 *
23 * Additional definitions for F1, F3, L1 devices:
24 * -F102, F103 (RM0008)
25 * -F302x{B,C}; *NOT* F302x{6,8,D,E} !! (USB_BTABLE access issues) (RM0365)
26 * -F303x{B,C}; *NOT* F303x{D,E} !! (USB_BTABLE access issues) (RM0316)
27 * -F37x (RM0313)
28 * -L1xx (RM0038)
29 */
30
31/** @cond */
32#ifdef LIBOPENCM3_ST_USBFS_H
33/** @endcond */
34#ifndef LIBOPENCM3_ST_USBFS_V1_H
35#define LIBOPENCM3_ST_USBFS_V1_H
36
38
39/* --- USB BTABLE Registers ------------------------------------------------ */
40
41#define USB_EP_TX_ADDR(EP) \
42 ((uint32_t *)(USB_PMA_BASE + (USB_GET_BTABLE + EP * 8 + 0) * 2))
43
44#define USB_EP_TX_COUNT(EP) \
45 ((uint32_t *)(USB_PMA_BASE + (USB_GET_BTABLE + EP * 8 + 2) * 2))
46
47#define USB_EP_RX_ADDR(EP) \
48 ((uint32_t *)(USB_PMA_BASE + (USB_GET_BTABLE + EP * 8 + 4) * 2))
49
50#define USB_EP_RX_COUNT(EP) \
51 ((uint32_t *)(USB_PMA_BASE + (USB_GET_BTABLE + EP * 8 + 6) * 2))
52
53/* --- USB BTABLE manipulators --------------------------------------------- */
54
55#define USB_GET_EP_TX_BUFF(EP) \
56 (USB_PMA_BASE + (uint8_t *)(USB_GET_EP_TX_ADDR(EP) * 2))
57
58#define USB_GET_EP_RX_BUFF(EP) \
59 (USB_PMA_BASE + (uint8_t *)(USB_GET_EP_RX_ADDR(EP) * 2))
60
61#endif
62/** @cond */
63#else
64#error "st_usbfs_v1.h should not be included directly, only via st_usbfs.h"
65#endif
66/** @endcond */
67