/*! * \file usbd_conf.h * * \brief Header for usbd_conf.c file. * * \copyright Revised BSD License, see section \ref LICENSE. * * \code * * _ __ _ ________ _ * | |/ /(_)___ / ____/ /_ (_)___ * | // / __ \/ / / __ \/ / __ \ * / |/ / / / / /___/ / / / / /_/ / * /_/|_/_/_/ /_/\____/_/ /_/_/ .___/ * /_/ * (C) 2022-2025 XinChip * * \endcode * * \author ( XinChip ) Alex-J * * \author ( XinChip ) */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __USBD_CONF__H #define __USBD_CONF__H #ifdef __cplusplus extern "C" { #endif /*----------------------------------------------------------------------------------- INCLUDE HEADE FILES ------------------------------------------------------------------------------------*/ #include #include #include #include "usbd_def.h" /*------------------------------------------------------------------------------------ Macros ------------------------------------------- -----------------------------------------*/ /** @defgroup USBD_CONF_Exported_Defines USBD_CONF_Exported_Defines * @brief Defines for configuration of the Usb device. * @{ */ /*---------- -----------*/ #if USB_SINGLE_DEVICE #define USBD_MAX_NUM_INTERFACES 1U #elif USB_COMPOSITE_DEVICE #define USBD_MAX_NUM_INTERFACES 2U #endif /*---------- -----------*/ #define USBD_MAX_NUM_CONFIGURATION 1U /*---------- -----------*/ #define USBD_MAX_STR_DESC_SIZ 512U /*---------- -----------*/ #define USBD_DEBUG_LEVEL 0U /*---------- -----------*/ #define USBD_LPM_ENABLED 0U /*---------- -----------*/ #define USBD_SELF_POWERED 1U /*---------- -----------*/ #define MSC_MEDIA_PACKET 512U /****************************************/ /* #define for FS and HS identification */ #define DEVICE_FS 0 //#define DEVICE_HS 1 /* Memory management macros make sure to use static memory allocation */ /** Alias for memory allocation. */ #define USBD_malloc (void *)USBD_static_malloc /** Alias for memory release. */ #define USBD_free USBD_static_free /** Alias for memory set. */ #define USBD_memset memset /** Alias for memory copy. */ #define USBD_memcpy memcpy /** Alias for delay. */ #define USBD_Delay HAL_Delay /* DEBUG macros */ #if (USBD_DEBUG_LEVEL > 0) #define USBD_UsrLog(...) DEBUG(__VA_ARGS__);\ DEBUG("\n"); #else #define USBD_UsrLog(...) #endif /* (USBD_DEBUG_LEVEL > 0U) */ #if (USBD_DEBUG_LEVEL > 1) #define USBD_ErrLog(...) DEBUG("ERROR: ") ;\ DEBUG(__VA_ARGS__);\ DEBUG("\n"); #else #define USBD_ErrLog(...) #endif /* (USBD_DEBUG_LEVEL > 1U) */ #if (USBD_DEBUG_LEVEL > 2) #define USBD_DbgLog(...) DEBUG("DEBUG : ") ;\ DEBUG(__VA_ARGS__);\ DEBUG("\n"); #else #define USBD_DbgLog(...) #endif /* (USBD_DEBUG_LEVEL > 2U) */ /*------------------------------------------------------------------------------------ Exported Functions -------------------------------------------------------------------------------------*/ void *USBD_static_malloc(uint32_t size); void USBD_static_free(void *p); #ifdef __cplusplus } #endif #endif /* __USBD_CONF__H__ */