diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2009-06-04 17:20:47 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2009-06-04 17:20:47 +0100 |
commit | c9c7391178ae93a139e35225fa250330eb5dce38 (patch) | |
tree | c4e6fbacbe21cdea3d62d828f90556726acc2153 | |
parent | e6f18c245cb682ef36a5b6f196de95bd4d27c086 (diff) | |
download | stm32-virtcomport-c9c7391178ae93a139e35225fa250330eb5dce38.tar.bz2 |
Initial stab at port
-rw-r--r-- | .bzrignore | 1 | ||||
-rw-r--r-- | hw_config.c | 55 | ||||
-rw-r--r-- | platform_config.h | 72 | ||||
-rw-r--r-- | stm32f10x_conf.h | 174 | ||||
-rw-r--r-- | stm32f10x_it.c | 720 | ||||
-rw-r--r-- | stm32f10x_it.h | 65 | ||||
-rw-r--r-- | usb_prop.c | 2 | ||||
-rw-r--r-- | virtcomport.s3c | 97 | ||||
-rw-r--r-- | virtcomport.s3p | 190 | ||||
-rw-r--r-- | virtcomport.s3r | 38 |
10 files changed, 412 insertions, 1002 deletions
diff --git a/.bzrignore b/.bzrignore new file mode 100644 index 0000000..0d4009a --- /dev/null +++ b/.bzrignore @@ -0,0 +1 @@ +virtcomport.s3s diff --git a/hw_config.c b/hw_config.c index 02561bc..b7cf280 100644 --- a/hw_config.c +++ b/hw_config.c @@ -93,29 +93,30 @@ void Set_System(void) {} } - /* Enable GPIOA, GPIOD and USART1 clock */ - RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOD - | RCC_APB2Periph_USART1, ENABLE); - - /* Enable USB_DISCONNECT GPIO clock */ - RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIO_DISCONNECT, ENABLE); + /* Enable USART's GPIO and the DISCONNECT GPIO clocks */ + RCC_APB2PeriphClockCmd(USART_RCC_GPIO | + RCC_APB2Periph_GPIO_DISCONNECT, ENABLE); + + /* Enable the USART's clock */ + RCC_USART_CMD(RCC_USART_PERIPH, ENABLE); /* Configure USB pull-up pin */ + USB_Cable_Config(DISABLE); GPIO_InitStructure.GPIO_Pin = USB_DISCONNECT_PIN; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD; + GPIO_InitStructure.GPIO_Mode = USB_DISCONNECT_MODE; GPIO_Init(USB_DISCONNECT, &GPIO_InitStructure); - /* Configure USART1 Rx (PA.10) as input floating */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; + /* Configure USART Rx as input floating */ + GPIO_InitStructure.GPIO_Pin = USART_RXPIN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; - GPIO_Init(GPIOA, &GPIO_InitStructure); + GPIO_Init(USART_GPIO, &GPIO_InitStructure); - /* Configure USART1 Tx (PA.09) as alternate function push-pull */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; + /* Configure USART Tx as alternate function push-pull */ + GPIO_InitStructure.GPIO_Pin = USART_TXPIN; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; - GPIO_Init(GPIOA, &GPIO_InitStructure); + GPIO_Init(USART_GPIO, &GPIO_InitStructure); } /******************************************************************************* @@ -193,7 +194,7 @@ void USB_Interrupts_Config(void) NVIC_Init(&NVIC_InitStructure); /* Enable USART1 Interrupt */ - NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQChannel; + NVIC_InitStructure.NVIC_IRQChannel = USART_IRQCHANNEL; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; NVIC_Init(&NVIC_InitStructure); } @@ -208,24 +209,24 @@ void USB_Cable_Config (FunctionalState NewState) { if (NewState != DISABLE) { - GPIO_ResetBits(USB_DISCONNECT, USB_DISCONNECT_PIN); + USB_DISCONNECT_ACTIVATE(USB_DISCONNECT, USB_DISCONNECT_PIN); } else { - GPIO_SetBits(USB_DISCONNECT, USB_DISCONNECT_PIN); + USB_DISCONNECT_DEACTIVATE(USB_DISCONNECT, USB_DISCONNECT_PIN); } } /******************************************************************************* -* Function Name : UART0_Config_Default. +* Function Name : USART_Config_Default. * Description : configure the UART 0 with default values. * Input : None. * Return : None. *******************************************************************************/ void USART_Config_Default(void) { - /* USART1 default configuration */ - /* USART1 configured as follow: + /* USART default configuration */ + /* USART configured as follow: - BaudRate = 9600 baud - Word Length = 8 Bits - One Stop Bit @@ -241,10 +242,10 @@ void USART_Config_Default(void) USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; /* Configure the USART1 */ - USART_Init(USART1, &USART_InitStructure); + USART_Init(ACTIVE_USART, &USART_InitStructure); /* Enable the USART Receive interrupt */ - USART_ITConfig(USART1, USART_IT_RXNE, ENABLE); + USART_ITConfig(ACTIVE_USART, USART_IT_RXNE, ENABLE); } /******************************************************************************* @@ -324,8 +325,8 @@ bool USART_Config(void) USART_InitStructure.USART_BaudRate = linecoding.bitrate; USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; - USART_Init(USART1, &USART_InitStructure); - USART_Cmd(USART1, ENABLE); + USART_Init(ACTIVE_USART, &USART_InitStructure); + USART_Cmd(ACTIVE_USART, ENABLE); return (TRUE); } @@ -342,8 +343,8 @@ void USB_To_USART_Send_Data(u8* data_buffer, u8 Nb_bytes) for (i = 0; i < Nb_bytes; i++) { - USART_SendData(USART1, *(data_buffer + i)); - while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET); + USART_SendData(ACTIVE_USART, *(data_buffer + i)); + while(USART_GetFlagStatus(ACTIVE_USART, USART_FLAG_TXE) == RESET); } } @@ -357,11 +358,11 @@ void USART_To_USB_Send_Data(void) { if (linecoding.datatype == 7) { - buffer_in[count_in] = USART_ReceiveData(USART1) & 0x7F; + buffer_in[count_in] = USART_ReceiveData(ACTIVE_USART) & 0x7F; } else if (linecoding.datatype == 8) { - buffer_in[count_in] = USART_ReceiveData(USART1); + buffer_in[count_in] = USART_ReceiveData(ACTIVE_USART); } count_in++; UserToPMABufferCopy(buffer_in, ENDP1_TXADDR, count_in); diff --git a/platform_config.h b/platform_config.h index 6475ccb..da7963b 100644 --- a/platform_config.h +++ b/platform_config.h @@ -20,29 +20,67 @@ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_type.h" -/* Exported types ------------------------------------------------------------*/ -/* Exported constants --------------------------------------------------------*/ -/* Uncomment the line corresponding to the STMicroelectronics evaluation board - used to run the example */ -#if !defined (USE_STM3210B_EVAL) && !defined (USE_STM3210E_EVAL) - //#define USE_STM3210B_EVAL - #define USE_STM3210E_EVAL +/* All of these are typically supplied by the makefile */ + +#ifndef RCC_APB2Periph_GPIO_DISCONNECT +#define RCC_APB2Periph_GPIO_DISCONNECT RCC_APB2Periph_GPIOD +#endif + +#ifndef USB_DISCONNECT +#define USB_DISCONNECT GPIOA +#endif + +#ifndef USB_DISCONNECT_PIN +#define USB_DISCONNECT_PIN GPIO_Pin_10 +#endif + +#ifndef USB_DISCONNECT_MODE +#define USB_DISCONNECT_MODE GPIO_Mode_Out_PP +#endif + +#ifndef USB_DISCONNECT_ACTIVATE +#define USB_DISCONNECT_ACTIVATE GPIO_SetBits +#endif + +#ifndef USB_DISCONNECT_DEACTIVATE +#define USB_DISCONNECT_DEACTIVATE GPIO_ResetBits +#endif + +#ifndef ACTIVE_USART +#define ACTIVE_USART USART1 +#endif + +#ifndef RCC_USART_CMD +#define RCC_USART_CMD RCC_APB2PeriphClockCmd +#endif + +#ifndef RCC_USART_PERIPH +#define RCC_USART_PERIPH RCC_APB2Periph_USART1 +#endif + +#ifndef USART_IRQCHANNEL +#define USART_IRQCHANNEL USART1_IRQChannel #endif -/* Define the STM32F10x hardware depending on the used evaluation board */ -#ifdef USE_STM3210B_EVAL +#ifndef USART_GPIO +#define USART_GPIO GPIOA +#endif - #define USB_DISCONNECT GPIOD - #define USB_DISCONNECT_PIN GPIO_Pin_9 - #define RCC_APB2Periph_GPIO_DISCONNECT RCC_APB2Periph_GPIOD +#ifndef USART_RCC_GPIO +#define USART_RCC_GPIO RCC_APB2Periph_##USART_GPIO +#endif -#else /* USE_STM3210E_EVAL */ +#ifndef USART_IRQHANDLER +#define USART_IRQHANDLER ACTIVE_USART##_IRQHandler +#endif - #define USB_DISCONNECT GPIOB - #define USB_DISCONNECT_PIN GPIO_Pin_14 - #define RCC_APB2Periph_GPIO_DISCONNECT RCC_APB2Periph_GPIOB +#ifndef USART_TXPIN +#define USART_TXPIN GPIO_Pin_9 +#endif -#endif /* USE_STM3210B_EVAL */ +#ifndef USART_RXPIN +#define USART_RXPIN GPIO_Pin_10 +#endif /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ diff --git a/stm32f10x_conf.h b/stm32f10x_conf.h deleted file mode 100644 index a19c5aa..0000000 --- a/stm32f10x_conf.h +++ /dev/null @@ -1,174 +0,0 @@ -/******************** (C) COPYRIGHT 2008 STMicroelectronics ******************** -* File Name : stm32f10x_conf.h -* Author : MCD Application Team -* Version : V2.2.1 -* Date : 09/22/2008 -* Description : Library 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 __STM32F10x_CONF_H -#define __STM32F10x_CONF_H - -/* Includes ------------------------------------------------------------------*/ -#include "stm32f10x_type.h" - -/* Exported types ------------------------------------------------------------*/ -/* Exported constants --------------------------------------------------------*/ -/* Uncomment the line below to compile the library in DEBUG mode, this will expanse - the "assert_param" macro in the firmware library code (see "Exported macro" - section below) */ -/* #define DEBUG 1*/ - -/* Comment the line below to disable the specific peripheral inclusion */ -/************************************* ADC ************************************/ -//#define _ADC -//#define _ADC1 -//#define _ADC2 -//#define _ADC3 - -/************************************* BKP ************************************/ -//#define _BKP - -/************************************* CAN ************************************/ -//#define _CAN - -/************************************* CRC ************************************/ -//#define _CRC - -/************************************* DAC ************************************/ -//#define _DAC - -/************************************* DBGMCU *********************************/ -//#define _DBGMCU - -/************************************* DMA ************************************/ -//#define _DMA -//#define _DMA1_Channel1 -//#define _DMA1_Channel2 -//#define _DMA1_Channel3 -//#define _DMA1_Channel4 -//#define _DMA1_Channel5 -//#define _DMA1_Channel6 -//#define _DMA1_Channel7 -//#define _DMA2_Channel1 -//#define _DMA2_Channel2 -//#define _DMA2_Channel3 -//#define _DMA2_Channel4 -//#define _DMA2_Channel5 - -/************************************* EXTI ***********************************/ -//#define _EXTI - -/************************************* FLASH and Option Bytes *****************/ -#define _FLASH -/* Uncomment the line below to enable FLASH program/erase/protections functions, - otherwise only FLASH configuration (latency, prefetch, half cycle) functions - are enabled */ -/* #define _FLASH_PROG */ - -/************************************* FSMC ***********************************/ -//#define _FSMC - -/************************************* GPIO ***********************************/ -#define _GPIO -#define _GPIOA -#define _GPIOB -//#define _GPIOC -#define _GPIOD -//#define _GPIOE -//#define _GPIOF -//#define _GPIOG -#define _AFIO - -/************************************* I2C ************************************/ -//#define _I2C -//#define _I2C1 -//#define _I2C2 - -/************************************* IWDG ***********************************/ -//#define _IWDG - -/************************************* NVIC ***********************************/ -#define _NVIC - -/************************************* PWR ************************************/ -//#define _PWR - -/************************************* RCC ************************************/ -#define _RCC - -/************************************* RTC ************************************/ -//#define _RTC - -/************************************* SDIO ***********************************/ -//#define _SDIO - -/************************************* SPI ************************************/ -//#define _SPI -//#define _SPI1 -//#define _SPI2 -//#define _SPI3 - -/************************************* SysTick ********************************/ -//#define _SysTick - -/************************************* TIM ************************************/ -//#define _TIM -//#define _TIM1 -//#define _TIM2 -//#define _TIM3 -//#define _TIM4 -//#define _TIM5 -//#define _TIM6 -//#define _TIM7 -//#define _TIM8 - -/************************************* USART **********************************/ -#define _USART -#define _USART1 -//#define _USART2 -//#define _USART3 -//#define _UART4 -//#define _UART5 - -/************************************* WWDG ***********************************/ -//#define _WWDG - -/* In the following line adjust the value of External High Speed oscillator (HSE) - used in your application */ -#define HSE_Value ((u32)8000000) /* Value of the External oscillator in Hz*/ - -/* In the following line adjust the External High Speed oscillator (HSE) Startup - Timeout value */ -#define HSEStartUp_TimeOut ((u16)0x0500) /* Time out for HSE start up */ - -/* Exported macro ------------------------------------------------------------*/ -#ifdef DEBUG -/******************************************************************************* -* Macro Name : assert_param -* Description : The assert_param macro is used for function's parameters check. -* It is used only if the library is compiled in DEBUG mode. -* Input : - expr: If expr is false, it calls assert_failed function -* which reports the name of the source file and the source -* line number of the call that failed. -* If expr is true, it returns no value. -* Return : None -*******************************************************************************/ - #define assert_param(expr) ((expr) ? (void)0 : assert_failed((u8 *)__FILE__, __LINE__)) -/* Exported functions ------------------------------------------------------- */ - void assert_failed(u8* file, u32 line); -#else - #define assert_param(expr) ((void)0) -#endif /* DEBUG */ - -#endif /* __STM32F10x_CONF_H */ - -/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/ diff --git a/stm32f10x_it.c b/stm32f10x_it.c index 403db52..d18b0cf 100644 --- a/stm32f10x_it.c +++ b/stm32f10x_it.c @@ -21,732 +21,16 @@ #include "usb_istr.h" #include "hw_config.h" -/* Private typedef -----------------------------------------------------------*/ -/* Private define ------------------------------------------------------------*/ -/* Private macro -------------------------------------------------------------*/ -/* Private variables ---------------------------------------------------------*/ -/* Private function prototypes -----------------------------------------------*/ -/* Private functions ---------------------------------------------------------*/ - -/******************************************************************************* -* Function Name : NMIException -* Description : This function handles NMI exception. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void NMIException(void) -{} - -/******************************************************************************* -* Function Name : HardFaultException -* Description : This function handles Hard Fault exception. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void HardFaultException(void) -{ - /* Go to infinite loop when Hard Fault exception occurs */ - while (1) - {} -} - -/******************************************************************************* -* Function Name : MemManageException -* Description : This function handles Memory Manage exception. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void MemManageException(void) -{ - /* Go to infinite loop when Memory Manage exception occurs */ - while (1) - {} -} - -/******************************************************************************* -* Function Name : BusFaultException -* Description : This function handles Bus Fault exception. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void BusFaultException(void) -{ - /* Go to infinite loop when Bus Fault exception occurs */ - while (1) - {} -} - -/******************************************************************************* -* Function Name : UsageFaultException -* Description : This function handles Usage Fault exception. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void UsageFaultException(void) -{ - /* Go to infinite loop when Usage Fault exception occurs */ - while (1) - {} -} - -/******************************************************************************* -* Function Name : DebugMonitor -* Description : This function handles Debug Monitor exception. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void DebugMonitor(void) -{} - -/******************************************************************************* -* Function Name : SVCHandler -* Description : This function handles SVCall exception. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void SVCHandler(void) -{} - -/******************************************************************************* -* Function Name : PendSVC -* Description : This function handles PendSVC exception. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void PendSVC(void) -{} - -/******************************************************************************* -* Function Name : SysTickHandler -* Description : This function handles SysTick Handler. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void SysTickHandler(void) -{} - -/******************************************************************************* -* Function Name : WWDG_IRQHandler -* Description : This function handles WWDG interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void WWDG_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : PVD_IRQHandler -* Description : This function handles PVD interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void PVD_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : TAMPER_IRQHandler -* Description : This function handles Tamper interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void TAMPER_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : RTC_IRQHandler -* Description : This function handles RTC global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void RTC_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : FLASH_IRQHandler -* Description : This function handles Flash interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void FLASH_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : RCC_IRQHandler -* Description : This function handles RCC interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void RCC_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : EXTI0_IRQHandler -* Description : This function handles External interrupt Line 0 request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void EXTI0_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : EXTI1_IRQHandler -* Description : This function handles External interrupt Line 1 request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void EXTI1_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : EXTI2_IRQHandler -* Description : This function handles External interrupt Line 2 request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void EXTI2_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : EXTI3_IRQHandler -* Description : This function handles External interrupt Line 3 request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void EXTI3_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : EXTI4_IRQHandler -* Description : This function handles External interrupt Line 4 request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void EXTI4_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : DMA1_Channel1_IRQHandler -* Description : This function handles DMA1 Channel 1 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void DMA1_Channel1_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : DMA1_Channel2_IRQHandler -* Description : This function handles DMA1 Channel 2 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void DMA1_Channel2_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : DMA1_Channel3_IRQHandler -* Description : This function handles DMA1 Channel 3 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void DMA1_Channel3_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : DMA1_Channel4_IRQHandler -* Description : This function handles DMA1 Channel 4 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void DMA1_Channel4_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : DMA1_Channel5_IRQHandler -* Description : This function handles DMA1 Channel 5 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void DMA1_Channel5_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : DMA1_Channel6_IRQHandler -* Description : This function handles DMA1 Channel 6 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void DMA1_Channel6_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : DMA1_Channel7_IRQHandler -* Description : This function handles DMA1 Channel 7 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void DMA1_Channel7_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : ADC1_2_IRQHandler -* Description : This function handles ADC1 and ADC2 global interrupts requests. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void ADC1_2_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : USB_HP_CAN_TX_IRQHandler -* Description : This function handles USB High Priority or CAN TX interrupts -* requests. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void USB_HP_CAN_TX_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : USB_LP_CAN_RX0_IRQHandler -* Description : This function handles USB Low Priority or CAN RX0 interrupts -* requests. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ void USB_LP_CAN_RX0_IRQHandler(void) { USB_Istr(); } -/******************************************************************************* -* Function Name : CAN_RX1_IRQHandler -* Description : This function handles CAN RX1 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void CAN_RX1_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : CAN_SCE_IRQHandler -* Description : This function handles CAN SCE interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void CAN_SCE_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : EXTI9_5_IRQHandler -* Description : This function handles External lines 9 to 5 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void EXTI9_5_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : TIM1_BRK_IRQHandler -* Description : This function handles TIM1 Break interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void TIM1_BRK_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : TIM1_UP_IRQHandler -* Description : This function handles TIM1 overflow and update interrupt -* request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void TIM1_UP_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : TIM1_TRG_COM_IRQHandler -* Description : This function handles TIM1 Trigger and commutation interrupts -* requests. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void TIM1_TRG_COM_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : TIM1_CC_IRQHandler -* Description : This function handles TIM1 capture compare interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void TIM1_CC_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : TIM2_IRQHandler -* Description : This function handles TIM2 global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void TIM2_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : TIM3_IRQHandler -* Description : This function handles TIM3 global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void TIM3_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : TIM4_IRQHandler -* Description : This function handles TIM4 global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void TIM4_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : I2C1_EV_IRQHandler -* Description : This function handles I2C1 Event interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void I2C1_EV_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : I2C1_ER_IRQHandler -* Description : This function handles I2C1 Error interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void I2C1_ER_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : I2C2_EV_IRQHandler -* Description : This function handles I2C2 Event interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void I2C2_EV_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : I2C2_ER_IRQHandler -* Description : This function handles I2C2 Error interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void I2C2_ER_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : SPI1_IRQHandler -* Description : This function handles SPI1 global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void SPI1_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : SPI2_IRQHandler -* Description : This function handles SPI2 global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void SPI2_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : USART1_IRQHandler -* Description : This function handles USART1 global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void USART1_IRQHandler(void) +void USART_IRQHANDLER(void) { - if (USART_GetITStatus(USART1, USART_IT_RXNE) != RESET) + if (USART_GetITStatus(ACTIVE_USART, USART_IT_RXNE) != RESET) { /* Send the received data to the PC Host*/ USART_To_USB_Send_Data(); } } - -/******************************************************************************* -* Function Name : USART2_IRQHandler -* Description : This function handles USART2 global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void USART2_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : USART3_IRQHandler -* Description : This function handles USART3 global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void USART3_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : EXTI15_10_IRQHandler -* Description : This function handles External lines 15 to 10 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void EXTI15_10_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : RTCAlarm_IRQHandler -* Description : This function handles RTC Alarm interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void RTCAlarm_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : USBWakeUp_IRQHandler -* Description : This function handles USB WakeUp interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void USBWakeUp_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : TIM8_BRK_IRQHandler -* Description : This function handles TIM8 Break interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void TIM8_BRK_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : TIM8_UP_IRQHandler -* Description : This function handles TIM8 overflow and update interrupt -* request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void TIM8_UP_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : TIM8_TRG_COM_IRQHandler -* Description : This function handles TIM8 Trigger and commutation interrupts -* requests. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void TIM8_TRG_COM_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : TIM8_CC_IRQHandler -* Description : This function handles TIM8 capture compare interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void TIM8_CC_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : ADC3_IRQHandler -* Description : This function handles ADC3 global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void ADC3_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : FSMC_IRQHandler -* Description : This function handles FSMC global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void FSMC_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : SDIO_IRQHandler -* Description : This function handles SDIO global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void SDIO_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : TIM5_IRQHandler -* Description : This function handles TIM5 global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void TIM5_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : SPI3_IRQHandler -* Description : This function handles SPI3 global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void SPI3_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : UART4_IRQHandler -* Description : This function handles UART4 global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void UART4_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : UART5_IRQHandler -* Description : This function handles UART5 global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void UART5_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : TIM6_IRQHandler -* Description : This function handles TIM6 global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void TIM6_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : TIM7_IRQHandler -* Description : This function handles TIM7 global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void TIM7_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : DMA2_Channel1_IRQHandler -* Description : This function handles DMA2 Channel 1 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void DMA2_Channel1_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : DMA2_Channel2_IRQHandler -* Description : This function handles DMA2 Channel 2 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void DMA2_Channel2_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : DMA2_Channel3_IRQHandler -* Description : This function handles DMA2 Channel 3 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void DMA2_Channel3_IRQHandler(void) -{} - -/******************************************************************************* -* Function Name : DMA2_Channel4_5_IRQHandler -* Description : This function handles DMA2 Channel 4 and DMA2 Channel 5 -* interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void DMA2_Channel4_5_IRQHandler(void) -{} - -/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/ diff --git a/stm32f10x_it.h b/stm32f10x_it.h index 50b6892..d721502 100644 --- a/stm32f10x_it.h +++ b/stm32f10x_it.h @@ -25,75 +25,10 @@ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ -void NMIException(void); -void HardFaultException(void); -void MemManageException(void); -void BusFaultException(void); -void UsageFaultException(void); -void DebugMonitor(void); -void SVCHandler(void); -void PendSVC(void); -void SysTickHandler(void); -void WWDG_IRQHandler(void); -void PVD_IRQHandler(void); -void TAMPER_IRQHandler(void); -void RTC_IRQHandler(void); -void FLASH_IRQHandler(void); -void RCC_IRQHandler(void); -void EXTI0_IRQHandler(void); -void EXTI1_IRQHandler(void); -void EXTI2_IRQHandler(void); -void EXTI3_IRQHandler(void); -void EXTI4_IRQHandler(void); -void DMA1_Channel1_IRQHandler(void); -void DMA1_Channel2_IRQHandler(void); -void DMA1_Channel3_IRQHandler(void); -void DMA1_Channel4_IRQHandler(void); -void DMA1_Channel5_IRQHandler(void); -void DMA1_Channel6_IRQHandler(void); -void DMA1_Channel7_IRQHandler(void); -void ADC1_2_IRQHandler(void); -void USB_HP_CAN_TX_IRQHandler(void); void USB_LP_CAN_RX0_IRQHandler(void); -void CAN_RX1_IRQHandler(void); -void CAN_SCE_IRQHandler(void); -void EXTI9_5_IRQHandler(void); -void TIM1_BRK_IRQHandler(void); -void TIM1_UP_IRQHandler(void); -void TIM1_TRG_COM_IRQHandler(void); -void TIM1_CC_IRQHandler(void); -void TIM2_IRQHandler(void); -void TIM3_IRQHandler(void); -void TIM4_IRQHandler(void); -void I2C1_EV_IRQHandler(void); -void I2C1_ER_IRQHandler(void); -void I2C2_EV_IRQHandler(void); -void I2C2_ER_IRQHandler(void); -void SPI1_IRQHandler(void); -void SPI2_IRQHandler(void); void USART1_IRQHandler(void); void USART2_IRQHandler(void); void USART3_IRQHandler(void); -void EXTI15_10_IRQHandler(void); -void RTCAlarm_IRQHandler(void); -void USBWakeUp_IRQHandler(void); -void TIM8_BRK_IRQHandler(void); -void TIM8_UP_IRQHandler(void); -void TIM8_TRG_COM_IRQHandler(void); -void TIM8_CC_IRQHandler(void); -void ADC3_IRQHandler(void); -void FSMC_IRQHandler(void); -void SDIO_IRQHandler(void); -void TIM5_IRQHandler(void); -void SPI3_IRQHandler(void); -void UART4_IRQHandler(void); -void UART5_IRQHandler(void); -void TIM6_IRQHandler(void); -void TIM7_IRQHandler(void); -void DMA2_Channel1_IRQHandler(void); -void DMA2_Channel2_IRQHandler(void); -void DMA2_Channel3_IRQHandler(void); -void DMA2_Channel4_5_IRQHandler(void); #endif /* __STM32F10x_IT_H */ @@ -123,7 +123,7 @@ void Virtual_Com_Port_init(void) /* set interrupts mask */ _SetCNTR(wInterrupt_Mask); - /* configure the USART 1 to the default settings */ + /* configure the USART to the default settings */ USART_Config_Default(); bDeviceState = UNCONNECTED; diff --git a/virtcomport.s3c b/virtcomport.s3c new file mode 100644 index 0000000..8e7d43d --- /dev/null +++ b/virtcomport.s3c @@ -0,0 +1,97 @@ +# Things to force-on for us. + +config VIRTCOMPORT_DEFAULTS + bool + default y + depends on USB_ACCESS_LINE || PERFORMANCE_LINE + select ENABLE_RCC + select HAS_HSE + select ENABLE_NVIC + select ENABLE_USB + +# Extra configuration for the virtual COM port program + +menu "USB disconnect pin configuration" + +choice + prompt "USB Disconnect pin GPIO bank" + default DISCONNECT_BANK_GPIOA + +config DISCONNECT_BANK_GPIOA + bool "Disconnect on bank GPIOA" + select ENABLE_GPIOA + +config DISCONNECT_BANK_GPIOB + bool "Disconnect on bank GPIOB" + select ENABLE_GPIOB + +config DISCONNECT_BANK_GPIOC + bool "Disconnect on bank GPIOC" + select ENABLE_GPIOC + +config DISCONNECT_BANK_GPIOD + bool "Disconnect on bank GPIOD" + select ENABLE_GPIOD + +config DISCONNECT_BANK_GPIOE + bool "Disconnect on bank GPIOE" + select ENABLE_GPIOE + +config DISCONNECT_BANK_GPIOF + bool "Disconnect on bank GPIOF" + select ENABLE_GPIOF + +config DISCONNECT_BANK_GPIOG + bool "Disconnect on bank GPIOG" + select ENABLE_GPIOG + +endchoice + +config DISCONNECT_PIN + int "Which pin on the GPIO bank is the disconnect signal" + default 10 + +choice + prompt "Pin configuration type" + default DISCONNECT_PIN_PP + +config DISCONNECT_PIN_OD + bool "Open Drain" + +config DISCONNECT_PIN_PP + bool "Push/Pull" + +endchoice + +choice + prompt "Pin active mode" + default DISCONNECT_ACTIVE_HIGH + +config DISCONNECT_ACTIVE_HIGH + bool "Active high" + +config DISCONNECT_ACTIVE_LOW + bool "Active low" + +endchoice + + +endmenu + +choice + prompt "USART to connect" + default ACTIVE_USART_USART1 + +config ACTIVE_USART_USART1 + bool "USART1" + select ENABLE_USART1 + +config ACTIVE_USART_USART2 + bool "USART2" + select ENABLE_USART2 + +config ACTIVE_USART_USART3 + bool "USART3" + select ENABLE_USART3 + +endchoice diff --git a/virtcomport.s3p b/virtcomport.s3p new file mode 100644 index 0000000..49f79a0 --- /dev/null +++ b/virtcomport.s3p @@ -0,0 +1,190 @@ +# +# Automatically generated STM32 project. don't edit +# If you wish to re-configure this project, re-run the stm32-config tool. +# Thu Jun 4 17:20:03 2009 +# + +# +# Chosen device: +# +CONFIG_DEVICE_STM32F103CBT6=y +CONFIG_CHOOSE_STM32F103CBT6=y + +# +# Alter device fundamentals: +# +# CONFIG_ACCESS_LINE is not set +# CONFIG_USB_ACCESS_LINE is not set +CONFIG_PERFORMANCE_LINE=y +# CONFIG_HIGH_DENSITY is not set +# CONFIG_RAM_4 is not set +# CONFIG_RAM_6 is not set +# CONFIG_RAM_10 is not set +# CONFIG_RAM_16 is not set +CONFIG_RAM_20=y +# CONFIG_RAM_48 is not set +# CONFIG_RAM_64 is not set +# CONFIG_FLASH_16 is not set +# CONFIG_FLASH_32 is not set +# CONFIG_FLASH_64 is not set +CONFIG_FLASH_128=y +# CONFIG_FLASH_256 is not set +# CONFIG_FLASH_384 is not set +# CONFIG_FLASH_512 is not set +# CONFIG_VQFPN36 is not set +CONFIG_LQFP48=y +# CONFIG_LQFP64 is not set +# CONFIG_LQFP100 is not set +# CONFIG_BGA100 is not set +# CONFIG_LQFP144 is not set +# CONFIG_BGA144 is not set +CONFIG_ITEMP_85=y +# CONFIG_ITEMP_105 is not set + +# +# Now select which library features to compile in: +# + +# +# Miscellaneous features +# +# CONFIG_ENABLE_PWR is not set +CONFIG_ENABLE_RCC=y +CONFIG_HAS_HSE=y +CONFIG_HSE_FREQ=12000000 +# CONFIG_HSE_6000000 is not set +# CONFIG_HSE_8000000 is not set +CONFIG_HSE_12000000=y +# CONFIG_HSE_16000000 is not set +# CONFIG_HSE_IS_CUSTOM is not set +CONFIG_ENABLE_NVIC=y +# CONFIG_ENABLE_EXTI is not set +# CONFIG_ENABLE_RTC is not set +# CONFIG_ENABLE_BKP is not set +CONFIG_ENABLE_FLASH=y +# CONFIG_ENABLE_FLASH_PROG is not set +# CONFIG_ENABLE_CRC is not set +# CONFIG_ENABLE_DBGMCU is not set +# CONFIG_ENABLE_IWDG is not set +# CONFIG_ENABLE_WWDG is not set + +# +# DMA engines +# +# CONFIG_ENABLE_DMA1_1 is not set +# CONFIG_ENABLE_DMA1_2 is not set +# CONFIG_ENABLE_DMA1_3 is not set +# CONFIG_ENABLE_DMA1_4 is not set +# CONFIG_ENABLE_DMA1_5 is not set +# CONFIG_ENABLE_DMA1_6 is not set +# CONFIG_ENABLE_DMA1_7 is not set + +# +# ADC support +# +# CONFIG_ENABLE_ADC1 is not set +# CONFIG_ENABLE_ADC2 is not set + +# +# Timers +# +# CONFIG_ENABLE_SYSTICK is not set +# CONFIG_ENABLE_TIM1 is not set +# CONFIG_ENABLE_TIM2 is not set +# CONFIG_ENABLE_TIM3 is not set +# CONFIG_ENABLE_TIM4 is not set + +# +# General Purpose I/O +# +CONFIG_ENABLE_AFIO=y +CONFIG_ENABLE_GPIOA=y +# CONFIG_ENABLE_GPIOB is not set +# CONFIG_ENABLE_GPIOC is not set +# CONFIG_ENABLE_GPIOD is not set + +# +# Serial ports (USARTS) +# +CONFIG_ENABLE_USART1=y +# CONFIG_ENABLE_USART2 is not set +# CONFIG_ENABLE_USART3 is not set + +# +# I2C (IIC) Support +# +# CONFIG_ENABLE_I2C1 is not set +# CONFIG_ENABLE_I2C2 is not set + +# +# SPI (Serial Peripheral Interconnect) support +# +# CONFIG_ENABLE_SPI1 is not set +# CONFIG_ENABLE_SPI2 is not set + +# +# Complex or special peripherals +# +# CONFIG_NO_CAN_NO_USB is not set +# CONFIG_ENABLE_CAN is not set +CONFIG_ENABLE_USB=y +# CONFIG_ENABLE_DFU is not set + +# +# +# + +# +# Toolchain configuration +# +CONFIG_DEFAULT_TOOLCHAIN=y +CONFIG_EXTRA_CFLAGS="" +CONFIG_EXTRA_LINKFLAGS="" + +# +# +# + +# +# Select source files +# +CONFIG_SOURCE_FILE_hw_config_c="hw_config.c" +CONFIG_CHOOSE_FILE_hw_config_c=y +CONFIG_SOURCE_FILE_main_c="main.c" +CONFIG_CHOOSE_FILE_main_c=y +CONFIG_SOURCE_FILE_stm32f10x_it_c="stm32f10x_it.c" +CONFIG_CHOOSE_FILE_stm32f10x_it_c=y +CONFIG_SOURCE_FILE_usb_desc_c="usb_desc.c" +CONFIG_CHOOSE_FILE_usb_desc_c=y +CONFIG_SOURCE_FILE_usb_endp_c="usb_endp.c" +CONFIG_CHOOSE_FILE_usb_endp_c=y +CONFIG_SOURCE_FILE_usb_istr_c="usb_istr.c" +CONFIG_CHOOSE_FILE_usb_istr_c=y +CONFIG_SOURCE_FILE_usb_prop_c="usb_prop.c" +CONFIG_CHOOSE_FILE_usb_prop_c=y +CONFIG_SOURCE_FILE_usb_pwr_c="usb_pwr.c" +CONFIG_CHOOSE_FILE_usb_pwr_c=y + +# +# +# +CONFIG_VIRTCOMPORT_DEFAULTS=y + +# +# USB disconnect pin configuration +# +CONFIG_DISCONNECT_BANK_GPIOA=y +# CONFIG_DISCONNECT_BANK_GPIOB is not set +# CONFIG_DISCONNECT_BANK_GPIOC is not set +# CONFIG_DISCONNECT_BANK_GPIOD is not set +# CONFIG_DISCONNECT_BANK_GPIOE is not set +# CONFIG_DISCONNECT_BANK_GPIOF is not set +# CONFIG_DISCONNECT_BANK_GPIOG is not set +CONFIG_DISCONNECT_PIN=10 +# CONFIG_DISCONNECT_PIN_OD is not set +CONFIG_DISCONNECT_PIN_PP=y +CONFIG_DISCONNECT_ACTIVE_HIGH=y +# CONFIG_DISCONNECT_ACTIVE_LOW is not set +CONFIG_ACTIVE_USART_USART1=y +# CONFIG_ACTIVE_USART_USART2 is not set +# CONFIG_ACTIVE_USART_USART3 is not set diff --git a/virtcomport.s3r b/virtcomport.s3r new file mode 100644 index 0000000..14492cd --- /dev/null +++ b/virtcomport.s3r @@ -0,0 +1,38 @@ +# Extra rules for the virtual COM port project + +VCOMP_CFLAGS := -DUSB_DISCONNECT_PIN=GPIO_Pin_$(CONFIG_FLASHER_PIN) + +GPIOBLOCK := $(patsubst CONFIG_DISCONNECT_BANK_GPIO%,GPIO%,$(filter CONFIG_DISCONNECT_BANK_GPIO%,$(.VARIABLES))) + +VCOMP_CFLAGS += -DRCC_APB2Periph_GPIO_DISCONNECT=RCC_APB2Periph_$(GPIOBLOCK) -DUSB_DISCONNECT=$(GPIOBLOCK) + +ifeq ($(CONFIG_DISCONNECT_PIN_OD),y) +VCOMP_CFLAGS += -DUSB_DISCONNECT_MODE=GPIO_Mode_Out_OD +else +VCOMP_CFLAGS += -DUSB_DISCONNECT_MODE=GPIO_Mode_Out_PP +endif + +ifeq ($(CONFIG_DISCONNECT_ACTIVE_HIGH),y) +VCOMP_CFLAGS += -DUSB_DISCONNECT_ACTIVATE=GPIO_SetBits -DUSB_DISCONNECT_DEACTIVATE=GPIO_ResetBits +else +VCOMP_CFLAGS += -DUSB_DISCONNECT_ACTIVATE=GPIO_ResetBits -DUSB_DISCONNECT_DEACTIVATE=GPIO_SetBits +endif + +USART := $(patsubst CONFIG_ACTIVE_USART_%,%,$(filter CONFIG_ACTIVE_USART_%,$(.VARIABLES))) + +VCOMP_CFLAGS += -DACTIVE_USART=$(USART) -DUSART_IRQCHANNEL=$(USART)_IRQChannel + +ifeq ($(USART),USART1) +VCOMP_CFLAGS += -DRCC_USART_CMD=RCC_APB2PeriphClockCmd -DRCC_USART_PERIPH=RCC_APB2Periph_USART1 +VCOMP_CFLAGS += -DUSART_GPIO=GPIOA -DUSART_TXPIN=GPIO_Pin_9 -DUSART_RXPIN=GPIO_Pin_10 +else +VCOMP_CFLAGS += -DRCC_USART_CMD=RCC_APB1PeriphClockCmd -DRCC_USART_PERIPH=RCC_APB1Periph_$(USART) +ifeq ($(USART,USART2)) +VCOMP_CFLAGS += -DUSART_GPIO=GPIOA -DUSART_TXPIN=GPIO_Pin_2 -DUSART_RXPIN=GPIO_Pin_3 +else +VCOMP_CFLAGS += -DUSART_GPIO=GPIOB -DUSART_TXPIN=GPIO_Pin_10 -DUSART_RXPIN=GPIO_Pin_11 +endif +endif + +EXTRA_CFLAGS += $(VCOMP_CFLAGS) + |