1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-20 12:03:52 +01:00
RIOT/cpu/stm32/include/periph/cpu_usbdev.h
Marian Buschsieweke 9cbd344fdc
Merge pull request #21718 from maribu/cpu/stm32/usbdev_fs/inverted-disconnect-pin
cpu/stm32/usbdev_fs: allow inverted disconnect GPIO
2025-10-07 18:44:07 +00:00

69 lines
1.7 KiB
C

/*
* SPDX-FileCopyrightText: 2016 Freie Universität Berlin
* SPDX-FileCopyrightText: 2017 OTA keys S.A.
* SPDX-License-Identifier: LGPL-2.1-only
*/
#pragma once
/**
* @ingroup cpu_stm32_usbdev
* @{
*
* @file
* @brief USB CPU specific definitions for the STM32 family
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* @author Vincent Dupont <vincent@otakeys.com>
*/
#include <stdint.h>
#include "periph/cpu_gpio.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief USBDEV buffers must be word aligned because of DMA restrictions
*/
#define USBDEV_CPU_DMA_ALIGNMENT (4)
/**
* @brief USBDEV buffer instantiation requirement
*/
#define USBDEV_CPU_DMA_REQUIREMENTS __attribute__((aligned(USBDEV_CPU_DMA_ALIGNMENT)))
/**
* @name Flags used in stm32_usbdev_fs_config_t
* @{
*/
/**
* @brief Indicates that logic levels are inverted compared to a GPIO connected
* directly via a 1.5 kOhm resistor to the USB D+ signal.
*/
#define STM32_USBDEV_FS_CONFIG_FLAG_DISCONN_INVERTED 0x01
/** @} */
/**
* @brief stm32 USB device FS configuration
*/
typedef struct {
uintptr_t base_addr; /**< USB peripheral base address */
uint32_t rcc_mask; /**< bit in clock enable register */
gpio_t dm; /**< Data- gpio */
gpio_t dp; /**< Data+ gpio */
gpio_af_t af; /**< Alternative function */
gpio_t disconn; /**< GPIO if used for USB disconnect */
uint8_t irqn; /**< IRQ channel */
uint8_t apb; /**< APB bus */
uint8_t flags; /**< Configuration flags */
} stm32_usbdev_fs_config_t;
#ifdef __cplusplus
}
#endif
/** @} */