mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 11:29:58 +03:00
Cleanup HAL usb driver (#13669)
This commit is contained in:
parent
49adddbdd5
commit
d82c8facb2
5 changed files with 3 additions and 113 deletions
|
@ -193,7 +193,7 @@ MCU_EXCLUDES = \
|
||||||
|
|
||||||
MSC_SRC = \
|
MSC_SRC = \
|
||||||
drivers/usb_msc_common.c \
|
drivers/usb_msc_common.c \
|
||||||
drivers/stm32/usb_msc_f7xx.c \
|
drivers/stm32/usb_msc_hal.c \
|
||||||
msc/usbd_storage.c \
|
msc/usbd_storage.c \
|
||||||
msc/usbd_storage_emfat.c \
|
msc/usbd_storage_emfat.c \
|
||||||
msc/emfat.c \
|
msc/emfat.c \
|
||||||
|
|
|
@ -180,7 +180,7 @@ MCU_EXCLUDES = \
|
||||||
# G4's MSC use the same driver layer file with F7
|
# G4's MSC use the same driver layer file with F7
|
||||||
MSC_SRC = \
|
MSC_SRC = \
|
||||||
drivers/usb_msc_common.c \
|
drivers/usb_msc_common.c \
|
||||||
drivers/stm32/usb_msc_f7xx.c \
|
drivers/stm32/usb_msc_hal.c \
|
||||||
msc/usbd_storage.c \
|
msc/usbd_storage.c \
|
||||||
msc/usbd_storage_emfat.c \
|
msc/usbd_storage_emfat.c \
|
||||||
msc/emfat.c \
|
msc/emfat.c \
|
||||||
|
|
|
@ -335,7 +335,7 @@ MCU_EXCLUDES = \
|
||||||
drivers/bus_i2c.c
|
drivers/bus_i2c.c
|
||||||
|
|
||||||
MSC_SRC = \
|
MSC_SRC = \
|
||||||
drivers/stm32/usb_msc_h7xx.c \
|
drivers/stm32/usb_msc_hal.c \
|
||||||
drivers/usb_msc_common.c \
|
drivers/usb_msc_common.c \
|
||||||
msc/usbd_storage.c \
|
msc/usbd_storage.c \
|
||||||
msc/usbd_storage_emfat.c \
|
msc/usbd_storage_emfat.c \
|
||||||
|
|
|
@ -1,110 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of Cleanflight and Betaflight.
|
|
||||||
*
|
|
||||||
* Cleanflight and Betaflight are free software. You can redistribute
|
|
||||||
* this software and/or modify this software under the terms of the
|
|
||||||
* GNU General Public License as published by the Free Software
|
|
||||||
* Foundation, either version 3 of the License, or (at your option)
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* Cleanflight and Betaflight are distributed in the hope that they
|
|
||||||
* 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 software.
|
|
||||||
*
|
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Author: Chris Hockuba (https://github.com/conkerkh)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "platform.h"
|
|
||||||
|
|
||||||
#if defined(USE_USB_MSC)
|
|
||||||
|
|
||||||
#include "build/build_config.h"
|
|
||||||
|
|
||||||
#include "common/utils.h"
|
|
||||||
|
|
||||||
#include "blackbox/blackbox.h"
|
|
||||||
#include "drivers/io.h"
|
|
||||||
#include "drivers/nvic.h"
|
|
||||||
#include "drivers/serial_usb_vcp.h"
|
|
||||||
#include "drivers/system.h"
|
|
||||||
#include "drivers/time.h"
|
|
||||||
#include "drivers/usb_msc.h"
|
|
||||||
|
|
||||||
#include "msc/usbd_storage.h"
|
|
||||||
|
|
||||||
#include "pg/sdcard.h"
|
|
||||||
#include "pg/usb.h"
|
|
||||||
|
|
||||||
#include "vcp_hal/usbd_cdc_interface.h"
|
|
||||||
|
|
||||||
#include "drivers/usb_io.h"
|
|
||||||
#include "usbd_msc.h"
|
|
||||||
|
|
||||||
uint8_t mscStart(void)
|
|
||||||
{
|
|
||||||
//Start USB
|
|
||||||
usbGenerateDisconnectPulse();
|
|
||||||
|
|
||||||
IOInit(IOGetByTag(IO_TAG(PA11)), OWNER_USB, 0);
|
|
||||||
IOInit(IOGetByTag(IO_TAG(PA12)), OWNER_USB, 0);
|
|
||||||
|
|
||||||
USBD_Init(&USBD_Device, &VCP_Desc, 0);
|
|
||||||
|
|
||||||
/** Regsiter class */
|
|
||||||
USBD_RegisterClass(&USBD_Device, USBD_MSC_CLASS);
|
|
||||||
|
|
||||||
/** Register interface callbacks */
|
|
||||||
switch (blackboxConfig()->device) {
|
|
||||||
#ifdef USE_SDCARD
|
|
||||||
case BLACKBOX_DEVICE_SDCARD:
|
|
||||||
switch (sdcardConfig()->mode) {
|
|
||||||
#ifdef USE_SDCARD_SDIO
|
|
||||||
case SDCARD_MODE_SDIO:
|
|
||||||
USBD_MSC_RegisterStorage(&USBD_Device, &USBD_MSC_MICRO_SDIO_fops);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef USE_SDCARD_SPI
|
|
||||||
case SDCARD_MODE_SPI:
|
|
||||||
USBD_MSC_RegisterStorage(&USBD_Device, &USBD_MSC_MICRO_SD_SPI_fops);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_FLASHFS
|
|
||||||
case BLACKBOX_DEVICE_FLASH:
|
|
||||||
USBD_MSC_RegisterStorage(&USBD_Device, &USBD_MSC_EMFAT_fops);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
default:
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
USBD_Start(&USBD_Device);
|
|
||||||
|
|
||||||
// NVIC configuration for SYSTick
|
|
||||||
NVIC_DisableIRQ(SysTick_IRQn);
|
|
||||||
NVIC_SetPriority(SysTick_IRQn, NVIC_BUILD_PRIORITY(0, 0));
|
|
||||||
NVIC_EnableIRQ(SysTick_IRQn);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Add table
Add a link
Reference in a new issue