parent
ce80895b25
commit
6f749f0198
@ -1,53 +0,0 @@ |
|||||||
/**
|
|
||||||
****************************************************************************** |
|
||||||
* @file usbd_cdc_if_template.h |
|
||||||
* @author MCD Application Team |
|
||||||
* @version V2.4.2 |
|
||||||
* @date 11-December-2015 |
|
||||||
* @brief Header for usbd_cdc_if_template.c file. |
|
||||||
****************************************************************************** |
|
||||||
* @attention |
|
||||||
* |
|
||||||
* <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2> |
|
||||||
* |
|
||||||
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); |
|
||||||
* You may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at: |
|
||||||
* |
|
||||||
* http://www.st.com/software_license_agreement_liberty_v2
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
* |
|
||||||
****************************************************************************** |
|
||||||
*/ |
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/ |
|
||||||
#ifndef __USBD_CDC_IF_TEMPLATE_H |
|
||||||
#define __USBD_CDC_IF_TEMPLATE_H |
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
extern "C" { |
|
||||||
#endif |
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/ |
|
||||||
#include "usbd_cdc.h" |
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/ |
|
||||||
/* Exported constants --------------------------------------------------------*/ |
|
||||||
|
|
||||||
extern USBD_CDC_ItfTypeDef USBD_CDC_Template_fops; |
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/ |
|
||||||
/* Exported functions ------------------------------------------------------- */ |
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
} |
|
||||||
#endif |
|
||||||
|
|
||||||
#endif /* __USBD_CDC_IF_TEMPLATE_H */ |
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
|
@ -1,226 +0,0 @@ |
|||||||
/**
|
|
||||||
****************************************************************************** |
|
||||||
* @file usbd_cdc_if_template.c |
|
||||||
* @author MCD Application Team |
|
||||||
* @version V2.4.2 |
|
||||||
* @date 11-December-2015 |
|
||||||
* @brief Generic media access Layer. |
|
||||||
****************************************************************************** |
|
||||||
* @attention |
|
||||||
* |
|
||||||
* <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2> |
|
||||||
* |
|
||||||
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); |
|
||||||
* You may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at: |
|
||||||
* |
|
||||||
* http://www.st.com/software_license_agreement_liberty_v2
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
* |
|
||||||
****************************************************************************** |
|
||||||
*/
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/ |
|
||||||
#include "usbd_cdc_if_template.h" |
|
||||||
|
|
||||||
/** @addtogroup STM32_USB_DEVICE_LIBRARY
|
|
||||||
* @{ |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/** @defgroup USBD_CDC
|
|
||||||
* @brief usbd core module |
|
||||||
* @{ |
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CDC_Private_TypesDefinitions
|
|
||||||
* @{ |
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/** @defgroup USBD_CDC_Private_Defines
|
|
||||||
* @{ |
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/** @defgroup USBD_CDC_Private_Macros
|
|
||||||
* @{ |
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/** @defgroup USBD_CDC_Private_FunctionPrototypes
|
|
||||||
* @{ |
|
||||||
*/ |
|
||||||
|
|
||||||
static int8_t TEMPLATE_Init (void); |
|
||||||
static int8_t TEMPLATE_DeInit (void); |
|
||||||
static int8_t TEMPLATE_Control (uint8_t cmd, uint8_t* pbuf, uint16_t length); |
|
||||||
static int8_t TEMPLATE_Receive (uint8_t* pbuf, uint32_t *Len); |
|
||||||
|
|
||||||
USBD_CDC_ItfTypeDef USBD_CDC_Template_fops =
|
|
||||||
{ |
|
||||||
TEMPLATE_Init, |
|
||||||
TEMPLATE_DeInit, |
|
||||||
TEMPLATE_Control, |
|
||||||
TEMPLATE_Receive |
|
||||||
}; |
|
||||||
|
|
||||||
USBD_CDC_LineCodingTypeDef linecoding = |
|
||||||
{ |
|
||||||
115200, /* baud rate*/ |
|
||||||
0x00, /* stop bits-1*/ |
|
||||||
0x00, /* parity - none*/ |
|
||||||
0x08 /* nb. of bits 8*/ |
|
||||||
}; |
|
||||||
|
|
||||||
/* Private functions ---------------------------------------------------------*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief TEMPLATE_Init |
|
||||||
* Initializes the CDC media low layer |
|
||||||
* @param None |
|
||||||
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL |
|
||||||
*/ |
|
||||||
static int8_t TEMPLATE_Init(void) |
|
||||||
{ |
|
||||||
/*
|
|
||||||
Add your initialization code here
|
|
||||||
*/
|
|
||||||
return (0); |
|
||||||
} |
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief TEMPLATE_DeInit |
|
||||||
* DeInitializes the CDC media low layer |
|
||||||
* @param None |
|
||||||
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL |
|
||||||
*/ |
|
||||||
static int8_t TEMPLATE_DeInit(void) |
|
||||||
{ |
|
||||||
/*
|
|
||||||
Add your deinitialization code here
|
|
||||||
*/
|
|
||||||
return (0); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief TEMPLATE_Control |
|
||||||
* Manage the CDC class requests |
|
||||||
* @param Cmd: Command code
|
|
||||||
* @param Buf: Buffer containing command data (request parameters) |
|
||||||
* @param Len: Number of data to be sent (in bytes) |
|
||||||
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL |
|
||||||
*/ |
|
||||||
static int8_t TEMPLATE_Control (uint8_t cmd, uint8_t* pbuf, uint16_t length) |
|
||||||
{
|
|
||||||
switch (cmd) |
|
||||||
{ |
|
||||||
case CDC_SEND_ENCAPSULATED_COMMAND: |
|
||||||
/* Add your code here */ |
|
||||||
break; |
|
||||||
|
|
||||||
case CDC_GET_ENCAPSULATED_RESPONSE: |
|
||||||
/* Add your code here */ |
|
||||||
break; |
|
||||||
|
|
||||||
case CDC_SET_COMM_FEATURE: |
|
||||||
/* Add your code here */ |
|
||||||
break; |
|
||||||
|
|
||||||
case CDC_GET_COMM_FEATURE: |
|
||||||
/* Add your code here */ |
|
||||||
break; |
|
||||||
|
|
||||||
case CDC_CLEAR_COMM_FEATURE: |
|
||||||
/* Add your code here */ |
|
||||||
break; |
|
||||||
|
|
||||||
case CDC_SET_LINE_CODING: |
|
||||||
linecoding.bitrate = (uint32_t)(pbuf[0] | (pbuf[1] << 8) |\
|
|
||||||
(pbuf[2] << 16) | (pbuf[3] << 24)); |
|
||||||
linecoding.format = pbuf[4]; |
|
||||||
linecoding.paritytype = pbuf[5]; |
|
||||||
linecoding.datatype = pbuf[6]; |
|
||||||
|
|
||||||
/* Add your code here */ |
|
||||||
break; |
|
||||||
|
|
||||||
case CDC_GET_LINE_CODING: |
|
||||||
pbuf[0] = (uint8_t)(linecoding.bitrate); |
|
||||||
pbuf[1] = (uint8_t)(linecoding.bitrate >> 8); |
|
||||||
pbuf[2] = (uint8_t)(linecoding.bitrate >> 16); |
|
||||||
pbuf[3] = (uint8_t)(linecoding.bitrate >> 24); |
|
||||||
pbuf[4] = linecoding.format; |
|
||||||
pbuf[5] = linecoding.paritytype; |
|
||||||
pbuf[6] = linecoding.datatype;
|
|
||||||
|
|
||||||
/* Add your code here */ |
|
||||||
break; |
|
||||||
|
|
||||||
case CDC_SET_CONTROL_LINE_STATE: |
|
||||||
/* Add your code here */ |
|
||||||
break; |
|
||||||
|
|
||||||
case CDC_SEND_BREAK: |
|
||||||
/* Add your code here */ |
|
||||||
break;
|
|
||||||
|
|
||||||
default: |
|
||||||
break; |
|
||||||
} |
|
||||||
|
|
||||||
return (0); |
|
||||||
} |
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief TEMPLATE_Receive |
|
||||||
* Data received over USB OUT endpoint are sent over CDC interface
|
|
||||||
* through this function. |
|
||||||
*
|
|
||||||
* @note |
|
||||||
* This function will issue a NAK packet on any OUT packet received on
|
|
||||||
* USB endpoint untill exiting this function. If you exit this function |
|
||||||
* before transfer is complete on CDC interface (ie. using DMA controller) |
|
||||||
* it will result in receiving more data while previous ones are still
|
|
||||||
* not sent. |
|
||||||
*
|
|
||||||
* @param Buf: Buffer of data to be received |
|
||||||
* @param Len: Number of data received (in bytes) |
|
||||||
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL |
|
||||||
*/ |
|
||||||
static int8_t TEMPLATE_Receive (uint8_t* Buf, uint32_t *Len) |
|
||||||
{ |
|
||||||
|
|
||||||
return (0); |
|
||||||
} |
|
||||||
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
|
||||||
|
|
@ -1,105 +0,0 @@ |
|||||||
/**
|
|
||||||
****************************************************************************** |
|
||||||
* @file usbd_msc_storage.h |
|
||||||
* @author MCD Application Team |
|
||||||
* @version V2.4.2 |
|
||||||
* @date 11-December-2015 |
|
||||||
* @brief Header file for the usbd_msc_storage.c file |
|
||||||
****************************************************************************** |
|
||||||
* @attention |
|
||||||
* |
|
||||||
* <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2> |
|
||||||
* |
|
||||||
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); |
|
||||||
* You may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at: |
|
||||||
* |
|
||||||
* http://www.st.com/software_license_agreement_liberty_v2
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
* |
|
||||||
****************************************************************************** |
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/ |
|
||||||
#ifndef __USBD_MSC_STORAGE_H |
|
||||||
#define __USBD_MSC_STORAGE_H |
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
extern "C" { |
|
||||||
#endif |
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/ |
|
||||||
#include "usbd_msc.h" |
|
||||||
|
|
||||||
/** @addtogroup STM32_USB_DEVICE_LIBRARY
|
|
||||||
* @{ |
|
||||||
*/ |
|
||||||
|
|
||||||
/** @defgroup USBD_STORAGE
|
|
||||||
* @brief header file for the usbd_msc_storage.c file |
|
||||||
* @{ |
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_STORAGE_Exported_Defines
|
|
||||||
* @{ |
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/** @defgroup USBD_STORAGE_Exported_Types
|
|
||||||
* @{ |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** @defgroup USBD_STORAGE_Exported_Macros
|
|
||||||
* @{ |
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_STORAGE_Exported_Variables
|
|
||||||
* @{ |
|
||||||
*/
|
|
||||||
extern USBD_StorageTypeDef USBD_MSC_Template_fops; |
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_STORAGE_Exported_FunctionsPrototype
|
|
||||||
* @{ |
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
} |
|
||||||
#endif |
|
||||||
|
|
||||||
#endif /* __USBD_MSC_STORAGE_H */ |
|
||||||
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
|
@ -1,188 +0,0 @@ |
|||||||
/**
|
|
||||||
****************************************************************************** |
|
||||||
* @file usbd_msc_storage_template.c |
|
||||||
* @author MCD Application Team |
|
||||||
* @version V2.4.2 |
|
||||||
* @date 11-December-2015 |
|
||||||
* @brief Memory management layer |
|
||||||
****************************************************************************** |
|
||||||
* @attention |
|
||||||
* |
|
||||||
* <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2> |
|
||||||
* |
|
||||||
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); |
|
||||||
* You may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at: |
|
||||||
* |
|
||||||
* http://www.st.com/software_license_agreement_liberty_v2
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
* |
|
||||||
****************************************************************************** |
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/ |
|
||||||
#include "usbd_msc_storage_template.h" |
|
||||||
|
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/ |
|
||||||
/* Private define ------------------------------------------------------------*/ |
|
||||||
/* Private macro -------------------------------------------------------------*/ |
|
||||||
/* Private variables ---------------------------------------------------------*/ |
|
||||||
/* Private function prototypes -----------------------------------------------*/ |
|
||||||
/* Extern function prototypes ------------------------------------------------*/ |
|
||||||
/* Private functions ---------------------------------------------------------*/ |
|
||||||
|
|
||||||
#define STORAGE_LUN_NBR 1 |
|
||||||
#define STORAGE_BLK_NBR 0x10000 |
|
||||||
#define STORAGE_BLK_SIZ 0x200 |
|
||||||
|
|
||||||
int8_t STORAGE_Init (uint8_t lun); |
|
||||||
|
|
||||||
int8_t STORAGE_GetCapacity (uint8_t lun,
|
|
||||||
uint32_t *block_num,
|
|
||||||
uint16_t *block_size); |
|
||||||
|
|
||||||
int8_t STORAGE_IsReady (uint8_t lun); |
|
||||||
|
|
||||||
int8_t STORAGE_IsWriteProtected (uint8_t lun); |
|
||||||
|
|
||||||
int8_t STORAGE_Read (uint8_t lun,
|
|
||||||
uint8_t *buf,
|
|
||||||
uint32_t blk_addr, |
|
||||||
uint16_t blk_len); |
|
||||||
|
|
||||||
int8_t STORAGE_Write (uint8_t lun,
|
|
||||||
uint8_t *buf,
|
|
||||||
uint32_t blk_addr, |
|
||||||
uint16_t blk_len); |
|
||||||
|
|
||||||
int8_t STORAGE_GetMaxLun (void); |
|
||||||
|
|
||||||
/* USB Mass storage Standard Inquiry Data */ |
|
||||||
int8_t STORAGE_Inquirydata[] = {//36
|
|
||||||
|
|
||||||
/* LUN 0 */ |
|
||||||
0x00,
|
|
||||||
0x80,
|
|
||||||
0x02,
|
|
||||||
0x02, |
|
||||||
(STANDARD_INQUIRY_DATA_LEN - 5), |
|
||||||
0x00, |
|
||||||
0x00,
|
|
||||||
0x00, |
|
||||||
'S', 'T', 'M', ' ', ' ', ' ', ' ', ' ', /* Manufacturer : 8 bytes */ |
|
||||||
'P', 'r', 'o', 'd', 'u', 'c', 't', ' ', /* Product : 16 Bytes */ |
|
||||||
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', |
|
||||||
'0', '.', '0' ,'1', /* Version : 4 Bytes */ |
|
||||||
};
|
|
||||||
|
|
||||||
USBD_StorageTypeDef USBD_MSC_Template_fops = |
|
||||||
{ |
|
||||||
STORAGE_Init, |
|
||||||
STORAGE_GetCapacity, |
|
||||||
STORAGE_IsReady, |
|
||||||
STORAGE_IsWriteProtected, |
|
||||||
STORAGE_Read, |
|
||||||
STORAGE_Write, |
|
||||||
STORAGE_GetMaxLun, |
|
||||||
STORAGE_Inquirydata, |
|
||||||
|
|
||||||
}; |
|
||||||
/*******************************************************************************
|
|
||||||
* Function Name : Read_Memory |
|
||||||
* Description : Handle the Read operation from the microSD card. |
|
||||||
* Input : None. |
|
||||||
* Output : None. |
|
||||||
* Return : None. |
|
||||||
*******************************************************************************/ |
|
||||||
int8_t STORAGE_Init (uint8_t lun) |
|
||||||
{ |
|
||||||
return (0); |
|
||||||
} |
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Function Name : Read_Memory |
|
||||||
* Description : Handle the Read operation from the STORAGE card. |
|
||||||
* Input : None. |
|
||||||
* Output : None. |
|
||||||
* Return : None. |
|
||||||
*******************************************************************************/ |
|
||||||
int8_t STORAGE_GetCapacity (uint8_t lun, uint32_t *block_num, uint16_t *block_size) |
|
||||||
{ |
|
||||||
*block_num = STORAGE_BLK_NBR; |
|
||||||
*block_size = STORAGE_BLK_SIZ; |
|
||||||
return (0); |
|
||||||
} |
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Function Name : Read_Memory |
|
||||||
* Description : Handle the Read operation from the STORAGE card. |
|
||||||
* Input : None. |
|
||||||
* Output : None. |
|
||||||
* Return : None. |
|
||||||
*******************************************************************************/ |
|
||||||
int8_t STORAGE_IsReady (uint8_t lun) |
|
||||||
{ |
|
||||||
return (0); |
|
||||||
} |
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Function Name : Read_Memory |
|
||||||
* Description : Handle the Read operation from the STORAGE card. |
|
||||||
* Input : None. |
|
||||||
* Output : None. |
|
||||||
* Return : None. |
|
||||||
*******************************************************************************/ |
|
||||||
int8_t STORAGE_IsWriteProtected (uint8_t lun) |
|
||||||
{ |
|
||||||
return 0; |
|
||||||
} |
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Function Name : Read_Memory |
|
||||||
* Description : Handle the Read operation from the STORAGE card. |
|
||||||
* Input : None. |
|
||||||
* Output : None. |
|
||||||
* Return : None. |
|
||||||
*******************************************************************************/ |
|
||||||
int8_t STORAGE_Read (uint8_t lun,
|
|
||||||
uint8_t *buf,
|
|
||||||
uint32_t blk_addr,
|
|
||||||
uint16_t blk_len) |
|
||||||
{ |
|
||||||
return 0; |
|
||||||
} |
|
||||||
/*******************************************************************************
|
|
||||||
* Function Name : Write_Memory |
|
||||||
* Description : Handle the Write operation to the STORAGE card. |
|
||||||
* Input : None. |
|
||||||
* Output : None. |
|
||||||
* Return : None. |
|
||||||
*******************************************************************************/ |
|
||||||
int8_t STORAGE_Write (uint8_t lun,
|
|
||||||
uint8_t *buf,
|
|
||||||
uint32_t blk_addr, |
|
||||||
uint16_t blk_len) |
|
||||||
{ |
|
||||||
return (0); |
|
||||||
} |
|
||||||
/*******************************************************************************
|
|
||||||
* Function Name : Write_Memory |
|
||||||
* Description : Handle the Write operation to the STORAGE card. |
|
||||||
* Input : None. |
|
||||||
* Output : None. |
|
||||||
* Return : None. |
|
||||||
*******************************************************************************/ |
|
||||||
int8_t STORAGE_GetMaxLun (void) |
|
||||||
{ |
|
||||||
return (STORAGE_LUN_NBR - 1); |
|
||||||
} |
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
|
||||||
|
|
@ -1,169 +0,0 @@ |
|||||||
/**
|
|
||||||
****************************************************************************** |
|
||||||
* @file usbd_conf_template.h |
|
||||||
* @author MCD Application Team |
|
||||||
* @version V2.4.2 |
|
||||||
* @date 11-December-2015 |
|
||||||
* @brief Header file for the usbd_conf_template.c file |
|
||||||
****************************************************************************** |
|
||||||
* @attention |
|
||||||
* |
|
||||||
* <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2> |
|
||||||
* |
|
||||||
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); |
|
||||||
* You may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at: |
|
||||||
* |
|
||||||
* http://www.st.com/software_license_agreement_liberty_v2
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
* |
|
||||||
****************************************************************************** |
|
||||||
*/ |
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/ |
|
||||||
#ifndef __USBD_CONF_TEMPLATE_H |
|
||||||
#define __USBD_CONF_TEMPLATE_H |
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
extern "C" { |
|
||||||
#endif |
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/ |
|
||||||
#include "stm32fxxx.h" /* replace 'stm32xxx' with your HAL driver header filename, ex: stm32f4xx.h */ |
|
||||||
#include <stdio.h> |
|
||||||
#include <stdlib.h> |
|
||||||
#include <string.h> |
|
||||||
|
|
||||||
/** @addtogroup STM32_USB_DEVICE_LIBRARY
|
|
||||||
* @{ |
|
||||||
*/ |
|
||||||
|
|
||||||
/** @defgroup USBD_CONF
|
|
||||||
* @brief USB device low level driver configuration file |
|
||||||
* @{ |
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CONF_Exported_Defines
|
|
||||||
* @{ |
|
||||||
*/
|
|
||||||
|
|
||||||
#define USBD_MAX_NUM_INTERFACES 1 |
|
||||||
#define USBD_MAX_NUM_CONFIGURATION 1 |
|
||||||
#define USBD_MAX_STR_DESC_SIZ 0x100 |
|
||||||
#define USBD_SUPPORT_USER_STRING 0 |
|
||||||
#define USBD_SELF_POWERED 1 |
|
||||||
#define USBD_DEBUG_LEVEL 2 |
|
||||||
|
|
||||||
/* MSC Class Config */ |
|
||||||
#define MSC_MEDIA_PACKET 8192 |
|
||||||
|
|
||||||
/* CDC Class Config */ |
|
||||||
#define USBD_CDC_INTERVAL 2000 |
|
||||||
|
|
||||||
/* DFU Class Config */ |
|
||||||
#define USBD_DFU_MAX_ITF_NUM 1 |
|
||||||
#define USBD_DFU_XFERS_IZE 1024 |
|
||||||
|
|
||||||
/* AUDIO Class Config */ |
|
||||||
#define USBD_AUDIO_FREQ 22100 |
|
||||||
|
|
||||||
/** @defgroup USBD_Exported_Macros
|
|
||||||
* @{ |
|
||||||
*/
|
|
||||||
|
|
||||||
/* Memory management macros */
|
|
||||||
#define USBD_malloc malloc |
|
||||||
#define USBD_free free |
|
||||||
#define USBD_memset memset |
|
||||||
#define USBD_memcpy memcpy |
|
||||||
|
|
||||||
/* DEBUG macros */
|
|
||||||
|
|
||||||
|
|
||||||
#if (USBD_DEBUG_LEVEL > 0) |
|
||||||
#define USBD_UsrLog(...) printf(__VA_ARGS__);\ |
|
||||||
printf("\n"); |
|
||||||
#else |
|
||||||
#define USBD_UsrLog(...) |
|
||||||
#endif |
|
||||||
|
|
||||||
|
|
||||||
#if (USBD_DEBUG_LEVEL > 1) |
|
||||||
|
|
||||||
#define USBD_ErrLog(...) printf("ERROR: ") ;\ |
|
||||||
printf(__VA_ARGS__);\
|
|
||||||
printf("\n"); |
|
||||||
#else |
|
||||||
#define USBD_ErrLog(...) |
|
||||||
#endif |
|
||||||
|
|
||||||
|
|
||||||
#if (USBD_DEBUG_LEVEL > 2) |
|
||||||
#define USBD_DbgLog(...) printf("DEBUG : ") ;\ |
|
||||||
printf(__VA_ARGS__);\
|
|
||||||
printf("\n"); |
|
||||||
#else |
|
||||||
#define USBD_DbgLog(...) |
|
||||||
#endif |
|
||||||
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/** @defgroup USBD_CONF_Exported_Types
|
|
||||||
* @{ |
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/** @defgroup USBD_CONF_Exported_Macros
|
|
||||||
* @{ |
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CONF_Exported_Variables
|
|
||||||
* @{ |
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CONF_Exported_FunctionsPrototype
|
|
||||||
* @{ |
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
} |
|
||||||
#endif |
|
||||||
|
|
||||||
#endif /* __USBD_CONF_TEMPLATE_H */ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @} |
|
||||||
*/
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
|
||||||
|
|
@ -1,212 +0,0 @@ |
|||||||
/**
|
|
||||||
****************************************************************************** |
|
||||||
* @file usbd_conf_template.c |
|
||||||
* @author MCD Application Team |
|
||||||
* @version V2.4.2 |
|
||||||
* @date 11-December-2015 |
|
||||||
* @brief USB Device configuration and interface file |
|
||||||
* This template should be copied to the user folder, renamed and customized |
|
||||||
* following user needs.
|
|
||||||
****************************************************************************** |
|
||||||
* @attention |
|
||||||
* |
|
||||||
* <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2> |
|
||||||
* |
|
||||||
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); |
|
||||||
* You may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at: |
|
||||||
* |
|
||||||
* http://www.st.com/software_license_agreement_liberty_v2
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
* |
|
||||||
****************************************************************************** |
|
||||||
*/
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/ |
|
||||||
#include "usbd_core.h" |
|
||||||
/* Private typedef -----------------------------------------------------------*/ |
|
||||||
/* Private define ------------------------------------------------------------*/ |
|
||||||
/* Private macro -------------------------------------------------------------*/ |
|
||||||
/* Private variables ---------------------------------------------------------*/ |
|
||||||
/* Private function prototypes -----------------------------------------------*/ |
|
||||||
/* Private functions ---------------------------------------------------------*/ |
|
||||||
/**
|
|
||||||
* @brief Initializes the Low Level portion of the Device driver. |
|
||||||
* @param pdev: Device handle |
|
||||||
* @retval USBD Status |
|
||||||
*/ |
|
||||||
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev) |
|
||||||
{
|
|
||||||
return USBD_OK; |
|
||||||
} |
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief De-Initializes the Low Level portion of the Device driver. |
|
||||||
* @param pdev: Device handle |
|
||||||
* @retval USBD Status |
|
||||||
*/ |
|
||||||
USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev) |
|
||||||
{ |
|
||||||
return USBD_OK; |
|
||||||
} |
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Starts the Low Level portion of the Device driver.
|
|
||||||
* @param pdev: Device handle |
|
||||||
* @retval USBD Status |
|
||||||
*/ |
|
||||||
USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev) |
|
||||||
{ |
|
||||||
return USBD_OK; |
|
||||||
} |
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Stops the Low Level portion of the Device driver. |
|
||||||
* @param pdev: Device handle |
|
||||||
* @retval USBD Status |
|
||||||
*/ |
|
||||||
USBD_StatusTypeDef USBD_LL_Stop(USBD_HandleTypeDef *pdev) |
|
||||||
{ |
|
||||||
return USBD_OK; |
|
||||||
} |
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Opens an endpoint of the Low Level Driver. |
|
||||||
* @param pdev: Device handle |
|
||||||
* @param ep_addr: Endpoint Number |
|
||||||
* @param ep_type: Endpoint Type |
|
||||||
* @param ep_mps: Endpoint Max Packet Size |
|
||||||
* @retval USBD Status |
|
||||||
*/ |
|
||||||
USBD_StatusTypeDef USBD_LL_OpenEP(USBD_HandleTypeDef *pdev, |
|
||||||
uint8_t ep_addr, |
|
||||||
uint8_t ep_type, |
|
||||||
uint16_t ep_mps) |
|
||||||
{ |
|
||||||
return USBD_OK; |
|
||||||
} |
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Closes an endpoint of the Low Level Driver. |
|
||||||
* @param pdev: Device handle |
|
||||||
* @param ep_addr: Endpoint Number |
|
||||||
* @retval USBD Status |
|
||||||
*/ |
|
||||||
USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) |
|
||||||
{ |
|
||||||
return USBD_OK; |
|
||||||
} |
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Flushes an endpoint of the Low Level Driver. |
|
||||||
* @param pdev: Device handle |
|
||||||
* @param ep_addr: Endpoint Number |
|
||||||
* @retval USBD Status |
|
||||||
*/ |
|
||||||
USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) |
|
||||||
{ |
|
||||||
return USBD_OK; |
|
||||||
} |
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Sets a Stall condition on an endpoint of the Low Level Driver. |
|
||||||
* @param pdev: Device handle |
|
||||||
* @param ep_addr: Endpoint Number |
|
||||||
* @retval USBD Status |
|
||||||
*/ |
|
||||||
USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) |
|
||||||
{ |
|
||||||
return USBD_OK; |
|
||||||
} |
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Clears a Stall condition on an endpoint of the Low Level Driver. |
|
||||||
* @param pdev: Device handle |
|
||||||
* @param ep_addr: Endpoint Number |
|
||||||
* @retval USBD Status |
|
||||||
*/ |
|
||||||
USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) |
|
||||||
{ |
|
||||||
return USBD_OK;
|
|
||||||
} |
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns Stall condition. |
|
||||||
* @param pdev: Device handle |
|
||||||
* @param ep_addr: Endpoint Number |
|
||||||
* @retval Stall (1: Yes, 0: No) |
|
||||||
*/ |
|
||||||
uint8_t USBD_LL_IsStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) |
|
||||||
{ |
|
||||||
return 0; |
|
||||||
} |
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Assigns a USB address to the device. |
|
||||||
* @param pdev: Device handle |
|
||||||
* @param ep_addr: Endpoint Number |
|
||||||
* @retval USBD Status |
|
||||||
*/ |
|
||||||
USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev, uint8_t dev_addr) |
|
||||||
{ |
|
||||||
return USBD_OK;
|
|
||||||
} |
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Transmits data over an endpoint. |
|
||||||
* @param pdev: Device handle |
|
||||||
* @param ep_addr: Endpoint Number |
|
||||||
* @param pbuf: Pointer to data to be sent |
|
||||||
* @param size: Data size
|
|
||||||
* @retval USBD Status |
|
||||||
*/ |
|
||||||
USBD_StatusTypeDef USBD_LL_Transmit(USBD_HandleTypeDef *pdev,
|
|
||||||
uint8_t ep_addr, |
|
||||||
uint8_t *pbuf, |
|
||||||
uint16_t size) |
|
||||||
{ |
|
||||||
return USBD_OK; |
|
||||||
} |
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Prepares an endpoint for reception. |
|
||||||
* @param pdev: Device handle |
|
||||||
* @param ep_addr: Endpoint Number |
|
||||||
* @param pbuf: Pointer to data to be received |
|
||||||
* @param size: Data size |
|
||||||
* @retval USBD Status |
|
||||||
*/ |
|
||||||
USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev,
|
|
||||||
uint8_t ep_addr, |
|
||||||
uint8_t *pbuf, |
|
||||||
uint16_t size) |
|
||||||
{ |
|
||||||
return USBD_OK; |
|
||||||
} |
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns the last transferred packet size. |
|
||||||
* @param pdev: Device handle |
|
||||||
* @param ep_addr: Endpoint Number |
|
||||||
* @retval Recived Data Size |
|
||||||
*/ |
|
||||||
uint32_t USBD_LL_GetRxDataSize(USBD_HandleTypeDef *pdev, uint8_t ep_addr) |
|
||||||
{ |
|
||||||
return 0; |
|
||||||
} |
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Delays routine for the USB Device Library. |
|
||||||
* @param Delay: Delay in ms |
|
||||||
* @retval None |
|
||||||
*/ |
|
||||||
void USBD_LL_Delay(uint32_t Delay) |
|
||||||
{ |
|
||||||
} |
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
|
||||||
|
|
Loading…
Reference in new issue