Skip to content

USB Host + MSC #1196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cores/arduino/stm32/usb_host/hid/usb_host_hid.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifdef USBHOST

#include "usbh_hid.c"

#endif /* USBHOST */
5 changes: 5 additions & 0 deletions cores/arduino/stm32/usb_host/hid/usb_host_hid_keybd.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifdef USBHOST

#include "usbh_hid_keybd.c"

#endif /* USBHOST */
5 changes: 5 additions & 0 deletions cores/arduino/stm32/usb_host/hid/usb_host_hid_mouse.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifdef USBHOST

#include "usbh_hid_mouse.c"

#endif /* USBHOST */
5 changes: 5 additions & 0 deletions cores/arduino/stm32/usb_host/hid/usb_host_hid_parser.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifdef USBHOST

#include "usbh_hid_parser.c"

#endif /* USBHOST */
5 changes: 5 additions & 0 deletions cores/arduino/stm32/usb_host/msc/usb_host_msc.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifdef USBHOST

#include "usbh_msc.c"

#endif /* USBHOST */
5 changes: 5 additions & 0 deletions cores/arduino/stm32/usb_host/msc/usb_host_msc_bot.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifdef USBHOST

#include "usbh_msc_bot.c"

#endif /* USBHOST */
5 changes: 5 additions & 0 deletions cores/arduino/stm32/usb_host/msc/usb_host_msc_scsi.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifdef USBHOST

#include "usbh_msc_scsi.c"

#endif /* USBHOST */
5 changes: 5 additions & 0 deletions cores/arduino/stm32/usb_host/usb_host_core.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifdef USBHOST

#include "usbh_core.c"

#endif /* USBHOST */
5 changes: 5 additions & 0 deletions cores/arduino/stm32/usb_host/usb_host_ctlreq.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifdef USBHOST

#include "usbh_ctlreq.c"

#endif /* USBHOST */
5 changes: 5 additions & 0 deletions cores/arduino/stm32/usb_host/usb_host_ioreq.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifdef USBHOST

#include "usbh_ioreq.c"

#endif /* USBHOST */
5 changes: 5 additions & 0 deletions cores/arduino/stm32/usb_host/usb_host_pipes.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifdef USBHOST

#include "usbh_pipes.c"

#endif /* USBHOST */
651 changes: 651 additions & 0 deletions cores/arduino/stm32/usb_host/usbh_conf.c

Large diffs are not rendered by default.

213 changes: 213 additions & 0 deletions cores/arduino/stm32/usb_host/usbh_conf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : Target/usbh_conf.h
* @version : v1.0_Cube
* @brief : Header for usbh_conf.c file.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under Ultimate Liberty license
* SLA0044, the "License"; You may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* www.st.com/SLA0044
*
******************************************************************************
*/
/* USER CODE END Header */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USBH_CONF__H__
#define __USBH_CONF__H__
#ifdef __cplusplus
extern "C" {
#endif

// #define USBHOST

#ifdef USBHOST
/* Includes ------------------------------------------------------------------*/
#include "stm32_def.h"

/* Includes ------------------------------------------------------------------*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// #include "main.h"

// #include "stm32f4xx.h"
// #include "stm32f4xx_hal.h"

/* USER CODE BEGIN INCLUDE */

/* USER CODE END INCLUDE */

/** @addtogroup STM32_USB_HOST_LIBRARY
* @{
*/

/** @defgroup USBH_CONF
* @brief usb host low level driver configuration file
* @{
*/

/** @defgroup USBH_CONF_Exported_Variables USBH_CONF_Exported_Variables
* @brief Public variables.
* @{
*/

/**
* @}
*/

/** @defgroup USBH_CONF_Exported_Defines USBH_CONF_Exported_Defines
* @brief Defines for configuration of the Usb host.
* @{
*/

/*---------- -----------*/
#define USBH_MAX_NUM_ENDPOINTS 2U

/*---------- -----------*/
#define USBH_MAX_NUM_INTERFACES 2U

/*---------- -----------*/
#define USBH_MAX_NUM_CONFIGURATION 2U

/*---------- -----------*/
#define USBH_KEEP_CFG_DESCRIPTOR 2U

/*---------- -----------*/
#define USBH_MAX_NUM_SUPPORTED_CLASS 2U

/*---------- -----------*/
#define USBH_MAX_SIZE_CONFIGURATION 256U

/*---------- -----------*/
#define USBH_MAX_DATA_BUFFER 512U

/*---------- -----------*/
#define USBH_DEBUG_LEVEL 0U

/*---------- -----------*/
#define USBH_USE_OS 0U

/****************************************/
/* #define for FS and HS identification */
#define HOST_HS 0
#define HOST_FS 1

/* Interrupt priority */
#ifndef USBH_IRQ_PRIO
#define USBH_IRQ_PRIO 0
#endif /* USBH_IRQ_PRIO */
#ifndef USBH_IRQ_SUBPRIO
#define USBH_IRQ_SUBPRIO 0
#endif /* USBH_IRQ_SUBPRIO */

#if (USBH_USE_OS == 1)
#include "cmsis_os.h"
#define USBH_PROCESS_PRIO osPriorityNormal
#define USBH_PROCESS_STACK_SIZE ((uint16_t)0)
#endif /* (USBH_USE_OS == 1) */

/**
* @}
*/

/** @defgroup USBH_CONF_Exported_Macros USBH_CONF_Exported_Macros
* @brief Aliases.
* @{
*/

/* Memory management macros */

/** Alias for memory allocation. */
#define USBH_malloc malloc

/** Alias for memory release. */
#define USBH_free free

/** Alias for memory set. */
#define USBH_memset memset

/** Alias for memory copy. */
#define USBH_memcpy memcpy

/* DEBUG macros */

#if (USBH_DEBUG_LEVEL > 0U)
#define USBH_UsrLog(...) do { \
printf(__VA_ARGS__); \
printf("\n"); \
} while (0)
#else
#define USBH_UsrLog(MSG, ...) do {} while (0)
#endif

#if (USBH_DEBUG_LEVEL > 1U)

#define USBH_ErrLog(...) do { \
printf("ERROR: ") ; \
printf(__VA_ARGS__); \
printf("\n"); \
} while (0)
#else
#define USBH_ErrLog(MSG, ...) do {} while (0)
#endif

#if (USBH_DEBUG_LEVEL > 2U)
#define USBH_DbgLog(...) do { \
printf("DEBUG : ") ; \
printf(__VA_ARGS__); \
printf("\n"); \
} while (0)
#else
#define USBH_DbgLog(MSG, ...) do {} while (0)
#endif

/**
* @}
*/

/** @defgroup USBH_CONF_Exported_Types USBH_CONF_Exported_Types
* @brief Types.
* @{
*/

/**
* @}
*/

/** @defgroup USBH_CONF_Exported_FunctionsPrototype USBH_CONF_Exported_FunctionsPrototype
* @brief Declaration of public functions for Usb host.
* @{
*/

/* Exported functions -------------------------------------------------------*/

/**
* @}
*/

/**
* @}
*/

/**
* @}
*/

#endif /* USBHOST */

#ifdef __cplusplus
}
#endif

#endif /* __USBH_CONF__H__ */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
59 changes: 59 additions & 0 deletions tools/platformio-build.py
Original file line number Diff line number Diff line change
@@ -187,6 +187,7 @@ def configure_application_offset(mcu, upload_protocol):
join(FRAMEWORK_DIR, "cores", "arduino", "stm32", "OpenAMP"),
join(FRAMEWORK_DIR, "cores", "arduino", "stm32", "usb", "hid"),
join(FRAMEWORK_DIR, "cores", "arduino", "stm32", "usb", "cdc"),
join(FRAMEWORK_DIR, "cores", "arduino", "stm32", "usb_host"),
join(FRAMEWORK_DIR, "system", "Drivers", series + "_HAL_Driver", "Inc"),
join(FRAMEWORK_DIR, "system", "Drivers", series + "_HAL_Driver", "Src"),
join(FRAMEWORK_DIR, "system", series),
@@ -208,6 +209,64 @@ def configure_application_offset(mcu, upload_protocol):
"Core",
"Src",
),
join(
FRAMEWORK_DIR,
"system",
"Middlewares",
"ST",
"STM32_USB_Host_Library",
"Core",
"Inc",
),
join(
FRAMEWORK_DIR,
"system",
"Middlewares",
"ST",
"STM32_USB_Host_Library",
"Core",
"Src",
),
join(
FRAMEWORK_DIR,
"system",
"Middlewares",
"ST",
"STM32_USB_Host_Library",
"Class",
"MSC",
"Inc",
),
join(
FRAMEWORK_DIR,
"system",
"Middlewares",
"ST",
"STM32_USB_Host_Library",
"Class",
"MSC",
"Src",
),
join(
FRAMEWORK_DIR,
"system",
"Middlewares",
"ST",
"STM32_USB_Host_Library",
"Class",
"HID",
"Inc",
),
join(
FRAMEWORK_DIR,
"system",
"Middlewares",
"ST",
"STM32_USB_Host_Library",
"Class",
"HID",
"Src",
),
join(
FRAMEWORK_DIR,
"system",