mirror of https://github.com/ArduPilot/ardupilot
AP_HAL_ChibiOS: enable write protection on USB msd
also fixes support for MSD on FS
This commit is contained in:
parent
a9ef3b031e
commit
f7d3969116
|
@ -304,15 +304,6 @@ bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
|
|||
(void)sdcp;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SDC card write protection detection.
|
||||
*/
|
||||
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
|
||||
|
||||
(void)sdcp;
|
||||
return false;
|
||||
}
|
||||
#endif /* HAL_USE_SDC */
|
||||
|
||||
#if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
|
||||
|
|
|
@ -27,7 +27,11 @@
|
|||
/*
|
||||
* must be 64 for full speed and 512 for high speed
|
||||
*/
|
||||
#if STM32_USB_HS
|
||||
#define USB_MSD_EP_SIZE 512U
|
||||
#else
|
||||
#define USB_MSD_EP_SIZE 64U
|
||||
#endif
|
||||
#define USB_DATA_REQUEST_EP 2
|
||||
#define USB_DATA_AVAILABLE_EP 2
|
||||
#define USB_INTERRUPT_REQUEST_EP 3
|
||||
|
|
|
@ -929,11 +929,14 @@ class ChibiOSHWDef(object):
|
|||
f.write('#define STM32_OTG2_IS_OTG1 FALSE\n')
|
||||
f.write('#define HAL_USE_USB TRUE\n')
|
||||
f.write('#define HAL_USE_SERIAL_USB TRUE\n')
|
||||
f.write('#define STM32_USB_HS FALSE\n')
|
||||
if 'OTG2' in self.bytype:
|
||||
f.write('#define STM32_USB_USE_OTG2 TRUE\n')
|
||||
f.write('#define STM32_USB_HS FALSE\n')
|
||||
if 'OTG_HS' in self.bytype:
|
||||
f.write('#define STM32_OTG2_IS_OTG1 FALSE\n')
|
||||
f.write('#define STM32_USB_USE_OTG2 TRUE\n')
|
||||
f.write('#define STM32_USB_HS TRUE\n')
|
||||
f.write('#define HAL_USE_USB TRUE\n')
|
||||
f.write('#define HAL_USE_SERIAL_USB TRUE\n')
|
||||
f.write('#define BOARD_OTG2_USES_ULPI\n')
|
||||
|
|
|
@ -30,13 +30,16 @@ extern const AP_HAL::HAL& hal;
|
|||
|
||||
|
||||
#if HAL_HAVE_USB_CDC_MSD
|
||||
bool write_protected = false;
|
||||
static void block_filesys_access()
|
||||
{
|
||||
AP::FS().block_access();
|
||||
write_protected = true;
|
||||
}
|
||||
|
||||
static void free_filesys_access()
|
||||
{
|
||||
write_protected = false;
|
||||
AP::FS().free_access();
|
||||
}
|
||||
#endif
|
||||
|
@ -193,6 +196,16 @@ bool sdcard_init()
|
|||
return false;
|
||||
}
|
||||
|
||||
#if HAL_USE_SDC
|
||||
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
|
||||
#if HAL_HAVE_USB_CDC_MSD
|
||||
return write_protected;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
stop sdcard interface (for reboot)
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue