From a86ec7c81d7ad2037e900899a0b32c5592cae7c0 Mon Sep 17 00:00:00 2001 From: AJM Date: Thu, 22 Apr 2010 23:27:09 -0400 Subject: c++ ified all of the usb_core files, added the auto-reset feature to the virtual com port, got the descriptors in functional although not pretty order that can be fixed using the attribute packing --- core/usb/usb_lib/usb_conf.h | 86 --------------------------------------------- core/usb/usb_lib/usb_core.c | 2 +- core/usb/usb_lib/usb_core.h | 8 +++++ core/usb/usb_lib/usb_def.h | 8 +++++ core/usb/usb_lib/usb_init.h | 8 +++++ core/usb/usb_lib/usb_int.h | 8 +++++ core/usb/usb_lib/usb_mem.h | 8 +++++ core/usb/usb_lib/usb_regs.h | 8 +++++ core/usb/usb_lib/usb_type.h | 10 +++++- 9 files changed, 58 insertions(+), 88 deletions(-) delete mode 100644 core/usb/usb_lib/usb_conf.h (limited to 'core/usb/usb_lib') diff --git a/core/usb/usb_lib/usb_conf.h b/core/usb/usb_lib/usb_conf.h deleted file mode 100644 index e9b7f14..0000000 --- a/core/usb/usb_lib/usb_conf.h +++ /dev/null @@ -1,86 +0,0 @@ -/******************** (C) COPYRIGHT 2008 STMicroelectronics ******************** -* File Name : usb_conf.h -* Author : MCD Application Team -* Version : V2.2.1 -* Date : 09/22/2008 -* Description : Device Firmware Upgrade (DFU) configuration file -******************************************************************************** -* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS -* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. -* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, -* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE -* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING -* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. -*******************************************************************************/ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __USB_CONF_H -#define __USB_CONF_H - -/* Includes ------------------------------------------------------------------*/ -/* Exported types ------------------------------------------------------------*/ -/* Exported constants --------------------------------------------------------*/ -/* Exported macro ------------------------------------------------------------*/ -/* Exported functions ------------------------------------------------------- */ -/* External variables --------------------------------------------------------*/ -/*-------------------------------------------------------------*/ -/* EP_NUM */ -/* defines how many endpoints are used by the device */ -/*-------------------------------------------------------------*/ -#define EP_NUM (1) - -/*-------------------------------------------------------------*/ -/* -------------- Buffer Description Table -----------------*/ -/*-------------------------------------------------------------*/ -/* buffer table base address */ -/* buffer table base address */ -#define BTABLE_ADDRESS (0x00) - -/* EP0 */ -/* rx/tx buffer base address */ -#define ENDP0_RXADDR (0x10) -#define ENDP0_TXADDR (0x50) - - -/*-------------------------------------------------------------*/ -/* ------------------- ISTR events -------------------------*/ -/*-------------------------------------------------------------*/ -/* IMR_MSK */ -/* mask defining which events has to be handled */ -/* by the device application software */ -#define IMR_MSK (CNTR_CTRM | \ - CNTR_WKUPM | \ - CNTR_SUSPM | \ - CNTR_ERRM | \ - CNTR_SOFM | \ - CNTR_ESOFM | \ - CNTR_RESETM \ - ) - -/* CTR service routines */ -/* associated to defined endpoints */ -#define EP1_IN_Callback NOP_Process -#define EP2_IN_Callback NOP_Process -#define EP3_IN_Callback NOP_Process -#define EP4_IN_Callback NOP_Process -#define EP5_IN_Callback NOP_Process -#define EP6_IN_Callback NOP_Process -#define EP7_IN_Callback NOP_Process - - -#define EP1_OUT_Callback NOP_Process -#define EP2_OUT_Callback NOP_Process -#define EP3_OUT_Callback NOP_Process -#define EP4_OUT_Callback NOP_Process -#define EP5_OUT_Callback NOP_Process -#define EP6_OUT_Callback NOP_Process -#define EP7_OUT_Callback NOP_Process - - -#endif /*__USB_CONF_H*/ - -/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/ - - - - diff --git a/core/usb/usb_lib/usb_core.c b/core/usb/usb_lib/usb_core.c index f637165..223a2e1 100644 --- a/core/usb/usb_lib/usb_core.c +++ b/core/usb/usb_lib/usb_core.c @@ -37,7 +37,7 @@ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ u16_u8 StatusInfo; -bool Data_Mul_MaxPacketSize = FALSE; +USB_Bool Data_Mul_MaxPacketSize = FALSE; /* Private function prototypes -----------------------------------------------*/ static void DataStageOut(void); static void DataStageIn(void); diff --git a/core/usb/usb_lib/usb_core.h b/core/usb/usb_lib/usb_core.h index efeaad8..1931fbf 100644 --- a/core/usb/usb_lib/usb_core.h +++ b/core/usb/usb_lib/usb_core.h @@ -17,6 +17,10 @@ #ifndef __USB_CORE_H #define __USB_CORE_H +#if defined(__cplusplus) +extern "C" { +#endif + /* Includes ------------------------------------------------------------------*/ /* Exported types ------------------------------------------------------------*/ typedef enum _CONTROL_STATE @@ -239,6 +243,10 @@ extern DEVICE_INFO Device_Info; extern u16 SaveRState; extern u16 SaveTState; +#if defined(__cplusplus) +} +#endif + #endif /* __USB_CORE_H */ /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/ diff --git a/core/usb/usb_lib/usb_def.h b/core/usb/usb_lib/usb_def.h index 4261d46..aa6bcba 100644 --- a/core/usb/usb_lib/usb_def.h +++ b/core/usb/usb_lib/usb_def.h @@ -17,6 +17,10 @@ #ifndef __USB_DEF_H #define __USB_DEF_H +#if defined(__cplusplus) +extern "C" { +#endif + /* Includes ------------------------------------------------------------------*/ /* Exported types ------------------------------------------------------------*/ typedef enum _RECIPIENT_TYPE @@ -75,6 +79,10 @@ typedef enum _FEATURE_SELECTOR /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ +#if defined(__cplusplus) +} +#endif + #endif /* __USB_DEF_H */ /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/ diff --git a/core/usb/usb_lib/usb_init.h b/core/usb/usb_lib/usb_init.h index 76e9d8a..1091ce5 100644 --- a/core/usb/usb_lib/usb_init.h +++ b/core/usb/usb_lib/usb_init.h @@ -17,6 +17,10 @@ #ifndef __USB_INIT_H #define __USB_INIT_H +#if defined(__cplusplus) +extern "C" { +#endif + /* Includes ------------------------------------------------------------------*/ /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ @@ -44,6 +48,10 @@ extern USER_STANDARD_REQUESTS *pUser_Standard_Requests; extern u16 SaveState ; extern u16 wInterrupt_Mask; +#if defined(__cplusplus) +} +#endif + #endif /* __USB_INIT_H */ /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/ diff --git a/core/usb/usb_lib/usb_int.h b/core/usb/usb_lib/usb_int.h index 1eb18a7..10a33fb 100644 --- a/core/usb/usb_lib/usb_int.h +++ b/core/usb/usb_lib/usb_int.h @@ -23,11 +23,19 @@ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ +#if defined(__cplusplus) +extern "C" { +#endif + void CTR_LP(void); void CTR_HP(void); /* External variables --------------------------------------------------------*/ +#if defined(__cplusplus) +} +#endif + #endif /* __USB_INT_H */ /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/ diff --git a/core/usb/usb_lib/usb_mem.h b/core/usb/usb_lib/usb_mem.h index d4cc4a6..a3d7927 100644 --- a/core/usb/usb_lib/usb_mem.h +++ b/core/usb/usb_lib/usb_mem.h @@ -22,9 +22,17 @@ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ +#if defined(__cplusplus) +extern "C" { +#endif + void UserToPMABufferCopy(u8 *pbUsrBuf, u16 wPMABufAddr, u16 wNBytes); void PMAToUserBufferCopy(u8 *pbUsrBuf, u16 wPMABufAddr, u16 wNBytes); +#if defined(__cplusplus) +} +#endif + /* External variables --------------------------------------------------------*/ #endif /*__USB_MEM_H*/ diff --git a/core/usb/usb_lib/usb_regs.h b/core/usb/usb_lib/usb_regs.h index 8f32e44..9a4df75 100644 --- a/core/usb/usb_lib/usb_regs.h +++ b/core/usb/usb_lib/usb_regs.h @@ -19,6 +19,10 @@ /* Includes ------------------------------------------------------------------*/ /* Exported types ------------------------------------------------------------*/ +#if defined(__cplusplus) +extern "C" { +#endif + typedef enum _EP_DBUF_DIR { /* double buffered endpoint direction */ @@ -614,6 +618,10 @@ void FreeUserBuffer(u8 bEpNum/*bEpNum*/, u8 bDir); u16 ToWord(u8, u8); u16 ByteSwap(u16); +#if defined(__cplusplus) +} +#endif + #endif /* __USB_REGS_H */ /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/ diff --git a/core/usb/usb_lib/usb_type.h b/core/usb/usb_lib/usb_type.h index 9e428b9..44b1f8c 100644 --- a/core/usb/usb_lib/usb_type.h +++ b/core/usb/usb_lib/usb_type.h @@ -17,6 +17,10 @@ #ifndef __USB_TYPE_H #define __USB_TYPE_H +#if defined(__cplusplus) +extern "C" { +#endif + /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ #ifndef NULL @@ -54,7 +58,7 @@ typedef enum { FALSE = 0, TRUE = !FALSE } -bool; +USB_Bool; typedef enum { RESET = 0, SET = !RESET } FlagStatus, ITStatus; @@ -67,6 +71,10 @@ typedef enum { ERROR = 0, SUCCESS = !ERROR} ErrorStatus; /* Exported functions ------------------------------------------------------- */ /* External variables --------------------------------------------------------*/ +#if defined(__cplusplus) +} +#endif + #endif /* __USB_TYPE_H */ /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/ -- cgit v1.2.3