├── .cproject ├── .project ├── .xml ├── build.xml ├── cmsis ├── arm_math.h ├── core_cm4.h ├── core_cm4_simd.h ├── core_cmFunc.h └── core_cmInstr.h ├── cmsis_boot ├── startup │ └── startup_stm32f4xx.c ├── stm32f4xx.h ├── stm32f4xx_conf.h ├── system_stm32f4xx.c └── system_stm32f4xx.h ├── cmsis_lib ├── include │ ├── misc.h │ ├── stm32f4xx_adc.h │ ├── stm32f4xx_dac.h │ ├── stm32f4xx_dma.h │ ├── stm32f4xx_exti.h │ ├── stm32f4xx_flash.h │ ├── stm32f4xx_fsmc.h │ ├── stm32f4xx_gpio.h │ ├── stm32f4xx_i2c.h │ ├── stm32f4xx_pwr.h │ ├── stm32f4xx_rcc.h │ ├── stm32f4xx_rtc.h │ ├── stm32f4xx_spi.h │ ├── stm32f4xx_syscfg.h │ ├── stm32f4xx_tim.h │ ├── stm32f4xx_usart.h │ └── stm32f4xx_wwdg.h └── source │ ├── misc.c │ ├── stm32f4xx_adc.c │ ├── stm32f4xx_dac.c │ ├── stm32f4xx_dma.c │ ├── stm32f4xx_exti.c │ ├── stm32f4xx_flash.c │ ├── stm32f4xx_fsmc.c │ ├── stm32f4xx_gpio.c │ ├── stm32f4xx_i2c.c │ ├── stm32f4xx_pwr.c │ ├── stm32f4xx_rcc.c │ ├── stm32f4xx_rtc.c │ ├── stm32f4xx_spi.c │ ├── stm32f4xx_syscfg.c │ ├── stm32f4xx_tim.c │ ├── stm32f4xx_usart.c │ └── stm32f4xx_wwdg.c ├── componentfile.history ├── debug.config ├── dict ├── drivers ├── audio │ ├── audio_driver.c │ ├── audio_driver.h │ ├── codec │ │ ├── codec.c │ │ ├── codec.h │ │ ├── i2s.c │ │ └── i2s.h │ ├── cw │ │ ├── cw_gen.c │ │ ├── cw_gen.h │ │ └── cw_sm_tbl.h │ ├── filters │ │ ├── fir_10k.h │ │ ├── fir_1_8k.h │ │ ├── fir_2_3k.h │ │ ├── fir_3_6k.h │ │ ├── i_rx_filter.h │ │ ├── i_tx_filter.h │ │ ├── q_rx_filter.h │ │ └── q_tx_filter.h │ └── softdds │ │ ├── dds_table.h │ │ ├── softdds.c │ │ └── softdds.h ├── cat │ ├── cat_driver.c │ ├── cat_driver.h │ └── usb │ │ ├── usbd_bsp.c │ │ ├── usbd_bsp.h │ │ ├── usbd_cdc_vcp.c │ │ ├── usbd_cdc_vcp.h │ │ ├── usbd_conf.h │ │ ├── usbd_desc.c │ │ ├── usbd_desc.h │ │ └── usbd_usr.c ├── keyboard │ ├── keyb_driver.c │ ├── keyb_driver.h │ └── usb │ │ ├── usbh_bsp.c │ │ ├── usbh_bsp.h │ │ ├── usbh_conf.h │ │ ├── usbh_usr.c │ │ └── usbh_usr.h └── ui │ ├── encoder │ ├── ui_rotary.c │ └── ui_rotary.h │ ├── lcd │ ├── fonts │ │ ├── DV_18.h │ │ └── eng8x8.h │ ├── ui_lcd_hy28.c │ ├── ui_lcd_hy28.h │ ├── ui_lcd_hy28_fonts.c │ └── ui_lcd_hy28_fonts.h │ ├── misc │ └── hamm_wnd.h │ ├── oscillator │ ├── ui_si570.c │ ├── ui_si570.h │ └── ui_soft_tcxo.h │ ├── ui_driver.c │ └── ui_driver.h ├── firmware.cob.bak ├── firmware.coproj ├── firmware_Target.cogui ├── firmware_Target.comarker ├── hardware ├── mchf_board.c ├── mchf_board.h ├── mchf_hw_i2c.c ├── mchf_hw_i2c.h ├── mchf_hw_i2c2.c ├── mchf_hw_i2c2.h └── mchf_types.h ├── libs ├── libarm_cortexM4lf_math.a ├── libc.a ├── libg.a └── libm.a ├── link.ld ├── main.c ├── memory.ld ├── misc └── v_eprom │ ├── eeprom.c │ └── eeprom.h ├── stdio └── printf.c ├── syscalls └── syscalls.c └── usb ├── otg ├── inc │ ├── usb_core.h │ ├── usb_dcd.h │ ├── usb_dcd_int.h │ ├── usb_defines.h │ ├── usb_hcd.h │ ├── usb_hcd_int.h │ ├── usb_otg.h │ └── usb_regs.h └── src │ ├── usb_core.c │ ├── usb_dcd.c │ ├── usb_dcd_int.c │ ├── usb_hcd.c │ ├── usb_hcd_int.c │ └── usb_otg.c ├── usb_conf.h ├── usbd ├── class │ ├── audio │ │ ├── inc │ │ │ ├── usbd_audio_core.h │ │ │ └── usbd_audio_out_if.h │ │ └── src │ │ │ ├── usbd_audio_core.c │ │ │ └── usbd_audio_out_if.c │ └── cdc │ │ ├── inc │ │ └── usbd_cdc_core.h │ │ └── src │ │ └── usbd_cdc_core.c └── core │ ├── inc │ ├── usbd_core.h │ ├── usbd_def.h │ ├── usbd_ioreq.h │ ├── usbd_req.h │ └── usbd_usr.h │ └── src │ ├── usbd_core.c │ ├── usbd_ioreq.c │ └── usbd_req.c └── usbh ├── class └── HID │ ├── inc │ ├── usbh_hid_core.h │ ├── usbh_hid_keybd.h │ └── usbh_hid_mouse.h │ └── src │ ├── usbh_hid_core.c │ ├── usbh_hid_keybd.c │ └── usbh_hid_mouse.c └── core ├── inc ├── usbh_core.h ├── usbh_def.h ├── usbh_hcs.h ├── usbh_ioreq.h └── usbh_stdreq.h └── src ├── usbh_core.c ├── usbh_hcs.c ├── usbh_ioreq.c └── usbh_stdreq.c /.cproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | mcHF 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | ?name? 14 | 15 | 16 | 17 | org.eclipse.cdt.make.core.append_environment 18 | true 19 | 20 | 21 | org.eclipse.cdt.make.core.buildArguments 22 | 23 | 24 | 25 | org.eclipse.cdt.make.core.buildCommand 26 | make 27 | 28 | 29 | org.eclipse.cdt.make.core.contents 30 | org.eclipse.cdt.make.core.activeConfigSettings 31 | 32 | 33 | org.eclipse.cdt.make.core.enableAutoBuild 34 | false 35 | 36 | 37 | org.eclipse.cdt.make.core.enableCleanBuild 38 | true 39 | 40 | 41 | org.eclipse.cdt.make.core.enableFullBuild 42 | true 43 | 44 | 45 | org.eclipse.cdt.make.core.stopOnError 46 | true 47 | 48 | 49 | org.eclipse.cdt.make.core.useDefaultBuildCmd 50 | false 51 | 52 | 53 | 54 | 55 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 56 | 57 | 58 | 59 | 60 | 61 | org.eclipse.cdt.core.cnature 62 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 63 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 64 | 65 | 66 | -------------------------------------------------------------------------------- /.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /cmsis_boot/stm32f4xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imoldovavan/mcHF-SDR/bcea073d9a38cdf3e094dce6d81657797a0b415a/cmsis_boot/stm32f4xx.h -------------------------------------------------------------------------------- /cmsis_boot/stm32f4xx_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/STM32F4xx_StdPeriph_Templates/stm32f4xx_conf.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F4xx_CONF_H 24 | #define __STM32F4xx_CONF_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | /* Uncomment the line below to enable peripheral header file inclusion */ 28 | /*#include "stm32f4xx_adc.h" 29 | #include "stm32f4xx_can.h" 30 | #include "stm32f4xx_crc.h" 31 | #include "stm32f4xx_cryp.h" 32 | #include "stm32f4xx_dac.h" 33 | #include "stm32f4xx_dbgmcu.h" 34 | #include "stm32f4xx_dcmi.h" 35 | #include "stm32f4xx_dma.h" 36 | #include "stm32f4xx_exti.h" 37 | #include "stm32f4xx_flash.h" 38 | #include "stm32f4xx_fsmc.h" 39 | #include "stm32f4xx_hash.h" 40 | #include "stm32f4xx_gpio.h" 41 | #include "stm32f4xx_i2c.h" 42 | #include "stm32f4xx_iwdg.h" 43 | #include "stm32f4xx_pwr.h" 44 | #include "stm32f4xx_rcc.h" 45 | #include "stm32f4xx_rng.h" 46 | #include "stm32f4xx_rtc.h" 47 | #include "stm32f4xx_sdio.h" 48 | #include "stm32f4xx_spi.h" 49 | #include "stm32f4xx_syscfg.h" 50 | #include "stm32f4xx_tim.h" 51 | #include "stm32f4xx_usart.h" 52 | #include "stm32f4xx_wwdg.h" 53 | #include "misc.h"*/ 54 | /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 55 | 56 | /* Exported types ------------------------------------------------------------*/ 57 | /* Exported constants --------------------------------------------------------*/ 58 | 59 | /* If an external clock source is used, then the value of the following define 60 | should be set to the value of the external clock source, else, if no external 61 | clock is used, keep this define commented */ 62 | /*#define I2S_EXTERNAL_CLOCK_VAL 12288000 */ /* Value of the external clock in Hz */ 63 | 64 | 65 | /* Uncomment the line below to expanse the "assert_param" macro in the 66 | Standard Peripheral Library drivers code */ 67 | /* #define USE_FULL_ASSERT 1 */ 68 | 69 | /* Exported macro ------------------------------------------------------------*/ 70 | #ifdef USE_FULL_ASSERT 71 | 72 | /** 73 | * @brief The assert_param macro is used for function's parameters check. 74 | * @param expr: If expr is false, it calls assert_failed function 75 | * which reports the name of the source file and the source 76 | * line number of the call that failed. 77 | * If expr is true, it returns no value. 78 | * @retval None 79 | */ 80 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 81 | /* Exported functions ------------------------------------------------------- */ 82 | void assert_failed(uint8_t* file, uint32_t line); 83 | #else 84 | #define assert_param(expr) ((void)0) 85 | #endif /* USE_FULL_ASSERT */ 86 | 87 | #endif /* __STM32F4xx_CONF_H */ 88 | 89 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 90 | -------------------------------------------------------------------------------- /cmsis_boot/system_stm32f4xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f4xx.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /** @addtogroup CMSIS 23 | * @{ 24 | */ 25 | 26 | /** @addtogroup stm32f4xx_system 27 | * @{ 28 | */ 29 | 30 | /** 31 | * @brief Define to prevent recursive inclusion 32 | */ 33 | #ifndef __SYSTEM_STM32F4XX_H 34 | #define __SYSTEM_STM32F4XX_H 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @addtogroup STM32F4xx_System_Includes 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @addtogroup STM32F4xx_System_Exported_types 50 | * @{ 51 | */ 52 | 53 | //extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 54 | 55 | 56 | /** 57 | * @} 58 | */ 59 | 60 | /** @addtogroup STM32F4xx_System_Exported_Constants 61 | * @{ 62 | */ 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @addtogroup STM32F4xx_System_Exported_Macros 69 | * @{ 70 | */ 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @addtogroup STM32F4xx_System_Exported_Functions 77 | * @{ 78 | */ 79 | 80 | extern void SystemInit(void); 81 | extern void SystemCoreClockUpdate(void); 82 | /** 83 | * @} 84 | */ 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif /*__SYSTEM_STM32F4XX_H */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 100 | -------------------------------------------------------------------------------- /cmsis_lib/include/stm32f4xx_wwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_wwdg.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file contains all the functions prototypes for the WWDG firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4xx_WWDG_H 25 | #define __STM32F4xx_WWDG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup STM32F4xx_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup WWDG 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /* Exported constants --------------------------------------------------------*/ 44 | 45 | /** @defgroup WWDG_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** @defgroup WWDG_Prescaler 50 | * @{ 51 | */ 52 | 53 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000) 54 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080) 55 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100) 56 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180) 57 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \ 58 | ((PRESCALER) == WWDG_Prescaler_2) || \ 59 | ((PRESCALER) == WWDG_Prescaler_4) || \ 60 | ((PRESCALER) == WWDG_Prescaler_8)) 61 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F) 62 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F)) 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | /* Exported macro ------------------------------------------------------------*/ 73 | /* Exported functions --------------------------------------------------------*/ 74 | 75 | /* Function used to set the WWDG configuration to the default reset state ****/ 76 | void WWDG_DeInit(void); 77 | 78 | /* Prescaler, Refresh window and Counter configuration functions **************/ 79 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler); 80 | void WWDG_SetWindowValue(uint8_t WindowValue); 81 | void WWDG_EnableIT(void); 82 | void WWDG_SetCounter(uint8_t Counter); 83 | 84 | /* WWDG activation function ***************************************************/ 85 | void WWDG_Enable(uint8_t Counter); 86 | 87 | /* Interrupts and flags management functions **********************************/ 88 | FlagStatus WWDG_GetFlagStatus(void); 89 | void WWDG_ClearFlag(void); 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif /* __STM32F4xx_WWDG_H */ 96 | 97 | /** 98 | * @} 99 | */ 100 | 101 | /** 102 | * @} 103 | */ 104 | 105 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 106 | -------------------------------------------------------------------------------- /cmsis_lib/source/stm32f4xx_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imoldovavan/mcHF-SDR/bcea073d9a38cdf3e094dce6d81657797a0b415a/cmsis_lib/source/stm32f4xx_flash.c -------------------------------------------------------------------------------- /cmsis_lib/source/stm32f4xx_rcc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imoldovavan/mcHF-SDR/bcea073d9a38cdf3e094dce6d81657797a0b415a/cmsis_lib/source/stm32f4xx_rcc.c -------------------------------------------------------------------------------- /componentfile.history: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /debug.config: -------------------------------------------------------------------------------- 1 | # 2 | #Sat Nov 03 16:56:10 GMT 2012 3 | org.coocox.codebugger.gdbjtag.core.debugMode=SWD 4 | org.coocox.codebugger.gdbjtag.core.adapter=ST-Link 5 | org.coocox.codebugger.gdbjtag.core.jflashtool= 6 | org.coocox.codebugger.gdbjtag.corerunToMain=true 7 | org.coocox.codebugger.gdbjtag.core.resetMode=SYSRESETREQ 8 | org.coocox.codebugger.gdbjtag.coredebugInRam=false 9 | org.coocox.codebugger.gdbjtag.core.jlinkResetMode=Type 0\: Normal 10 | org.coocox.codebugger.gdbjtag.core.clockDiv=1M 11 | org.coocox.codebugger.gdbjtag.core.jlinkgdbserver= 12 | org.coocox.codebugger.gdbjtag.core.verify=true 13 | org.coocox.codebugger.gdbjtag.core.downloadFuction=Erase Effected 14 | org.coocox.codebugger.gdbjtag.core.autoDownload=true 15 | org.coocox.codebugger.gdbjtag.core.targetEndianess=0 16 | org.coocox.codebugger.gdbjtag.core.userDefineGDBScript= 17 | org.coocox.codebugger.gdbjtag.core.ifSemihost=false 18 | org.coocox.codebugger.gdbjtag.core.jflashscript= 19 | org.coocox.codebugger.gdbjtag.core.defaultAlgorithm=C\:/CooCox/CoIDE/flash/STM32F4xx_1024.elf 20 | org.coocox.codebugger.gdbjtag.core.ifCacheRom=true 21 | -------------------------------------------------------------------------------- /dict: -------------------------------------------------------------------------------- 1 | atanassov 2 | -------------------------------------------------------------------------------- /drivers/audio/audio_driver.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | /* Define to prevent recursive inclusion -------------------------------------*/ 15 | #ifndef __AUDIO_DRIVER_H 16 | #define __AUDIO_DRIVER_H 17 | 18 | #include "arm_math.h" 19 | 20 | // 16 or 24 bits from Codec 21 | // 22 | //#define USE_24_BITS 23 | 24 | // ----------------------------- 25 | // With 128 words buffer we have 26 | // 120uS processing time in the 27 | // IRQ and 530uS idle time 28 | // (48kHz sampling - USB) 29 | // 30 | #define BUFF_LEN 128 31 | // 32 | // ----------------------------- 33 | // Half of total buffer 34 | #define IQ_BUFSZ (BUFF_LEN/2) 35 | 36 | // Audio filter 37 | #define FIR_RXAUDIO_BLOCK_SIZE 1 38 | #define FIR_RXAUDIO_NUM_TAPS 48 39 | 40 | // Audio driver publics 41 | typedef struct AudioDriverState 42 | { 43 | // Stereo buffers 44 | float i_buffer[IQ_BUFSZ]; 45 | float q_buffer[IQ_BUFSZ]; 46 | float a_buffer[IQ_BUFSZ]; 47 | 48 | // Lock audio filter flag 49 | uchar af_dissabled; 50 | 51 | } AudioDriverState; 52 | 53 | // ----------------------------- 54 | // FFT buffer (128, 512 or 2048) 55 | #define FFT_IQ_BUFF_LEN 512 56 | 57 | // FFT will work with quadrature signals 58 | #define FFT_QUADRATURE_PROC 1 59 | 60 | // Spectrum display 61 | typedef struct SpectrumDisplay 62 | { 63 | // FFT state 64 | arm_rfft_instance_q15 S; 65 | arm_cfft_radix4_instance_q15 S_CFFT; 66 | 67 | // Samples buffer 68 | q15_t FFT_Samples[FFT_IQ_BUFF_LEN]; 69 | q15_t FFT_MagData[FFT_IQ_BUFF_LEN/2]; 70 | q15_t FFT_BkpData[FFT_IQ_BUFF_LEN/2]; 71 | 72 | // Current data ptr 73 | ulong samp_ptr; 74 | 75 | // Skip flag for FFT processing 76 | ulong skip_process; 77 | 78 | // Addresses of vertical grid lines on x axis 79 | ushort vert_grid_id[7]; 80 | 81 | // Addresses of horizontal grid lines on x axis 82 | ushort horz_grid_id[3]; 83 | 84 | // State machine current state 85 | uchar state; 86 | 87 | // Init done flag 88 | uchar enabled; 89 | 90 | // Flag to indicate frequency change, 91 | // we need it to clear spectrum control 92 | uchar dial_moved; 93 | 94 | } SpectrumDisplay; 95 | 96 | // ----------------------------- 97 | // S meter sample time 98 | #define S_MET_SAMP_CNT 512 99 | 100 | // S meter drag delay 101 | #define S_MET_UPD_SKIP 10 //10000 102 | 103 | // S meter public 104 | typedef struct SMeter 105 | { 106 | ulong skip; 107 | 108 | ulong s_count; 109 | int curr_max; 110 | 111 | uchar old; 112 | //uchar max_upd; 113 | 114 | } SMeter; 115 | 116 | // Exports 117 | void audio_driver_init(void); 118 | void audio_driver_stop(void); 119 | void audio_driver_set_rx_audio_filter(void); 120 | void audio_driver_thread(void); 121 | 122 | #ifdef USE_24_BITS 123 | void I2S_RX_CallBack(int32_t *src, int32_t *dst, int16_t size, uint16_t ht); 124 | #else 125 | void I2S_RX_CallBack(int16_t *src, int16_t *dst, int16_t size, uint16_t ht); 126 | #endif 127 | 128 | #endif 129 | -------------------------------------------------------------------------------- /drivers/audio/codec/codec.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __CODEC_H 15 | #define __CODEC_H 16 | 17 | #define WORD_SIZE_16 0 18 | #define WORD_SIZE_32 1 19 | 20 | #define CODEC_I2S SPI3 21 | #define CODEC_I2S_EXT I2S3ext 22 | #define CODEC_I2S_CLK RCC_APB1Periph_SPI3 23 | #define CODEC_I2S_ADDRESS (SPI3_BASE + 0x0C) 24 | #define CODEC_I2S_EXT_ADDRESS (I2S3ext_BASE + 0x0C) 25 | #define CODEC_I2S_GPIO_AF GPIO_AF_SPI3 26 | #define CODEC_I2S_IRQ SPI3_IRQn 27 | #define CODEC_I2S_EXT_IRQ SPI3_IRQn 28 | 29 | #define AUDIO_I2S_IRQHandler SPI3_IRQHandler 30 | #define AUDIO_I2S_EXT_IRQHandler SPI3_IRQHandler 31 | 32 | #define AUDIO_I2S_DMA_CLOCK RCC_AHB1Periph_DMA1 33 | #define AUDIO_I2S_DMA_STREAM DMA1_Stream5 34 | #define AUDIO_I2S_DMA_DREG CODEC_I2S_ADDRESS 35 | #define AUDIO_I2S_DMA_CHANNEL DMA_Channel_0 36 | #define AUDIO_I2S_DMA_IRQ DMA1_Stream5_IRQn 37 | #define AUDIO_I2S_DMA_FLAG_TC DMA_FLAG_TCIF5 38 | #define AUDIO_I2S_DMA_FLAG_HT DMA_FLAG_HTIF5 39 | #define AUDIO_I2S_DMA_FLAG_FE DMA_FLAG_FEIF5 40 | #define AUDIO_I2S_DMA_FLAG_TE DMA_FLAG_TEIF5 41 | #define AUDIO_I2S_DMA_FLAG_DME DMA_FLAG_DMEIF5 42 | #define AUDIO_I2S_EXT_DMA_STREAM DMA1_Stream2 43 | #define AUDIO_I2S_EXT_DMA_DREG CODEC_I2S_EXT_ADDRESS 44 | #define AUDIO_I2S_EXT_DMA_CHANNEL DMA_Channel_2 45 | #define AUDIO_I2S_EXT_DMA_IRQ DMA1_Stream2_IRQn 46 | #define AUDIO_I2S_EXT_DMA_FLAG_TC DMA_FLAG_TCIF2 47 | #define AUDIO_I2S_EXT_DMA_FLAG_HT DMA_FLAG_HTIF2 48 | #define AUDIO_I2S_EXT_DMA_FLAG_FE DMA_FLAG_FEIF2 49 | #define AUDIO_I2S_EXT_DMA_FLAG_TE DMA_FLAG_TEIF2 50 | #define AUDIO_I2S_EXT_DMA_FLAG_DME DMA_FLAG_DMEIF2 51 | 52 | uint32_t Codec_Init(uint32_t AudioFreq,ulong word_size); 53 | void Codec_RX_TX(void); 54 | void Codec_Volume(uchar vol); 55 | void Codec_Mute(uchar state); 56 | 57 | void Codec_AudioInterface_Init(uint32_t AudioFreq); 58 | void Codec_Reset(uint32_t AudioFreq,ulong word_size); 59 | uint32_t Codec_WriteRegister(uint8_t RegisterAddr, uint16_t RegisterValue); 60 | void Codec_GPIO_Init(void); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /drivers/audio/codec/i2s.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __I2S_H 15 | #define __I2S_H 16 | 17 | void I2S_Block_Init(void); 18 | 19 | void I2S_Block_Process(uint32_t txAddr, uint32_t rxAddr, uint32_t Size); 20 | void I2S_Block_Stop(void); 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /drivers/audio/cw/cw_gen.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __CW_GEN_H 15 | #define __UI_GEN_H 16 | 17 | // Break timeout on straight key 18 | #define CW_BREAK 800 19 | 20 | // States 21 | #define CW_IDLE 0 22 | #define CW_DIT_CHECK 1 23 | #define CW_DAH_CHECK 3 24 | #define CW_KEY_DOWN 4 25 | #define CW_KEY_UP 5 26 | #define CW_PAUSE 6 27 | 28 | #define CW_DIT_L 0x01 29 | #define CW_DAH_L 0x02 30 | #define CW_DIT_PROC 0x04 31 | 32 | #define CW_IAMBIC_A 0x00 33 | #define CW_IAMBIC_B 0x10 34 | 35 | #define CW_SMOOTH_LEN 16 36 | 37 | typedef struct PaddleState 38 | { 39 | // State machine and port states 40 | ulong port_state; 41 | ulong cw_state; 42 | 43 | // Smallest element duration 44 | ulong dit_time; 45 | 46 | // Timers 47 | ulong key_timer; 48 | ulong break_timer; 49 | 50 | // Key clicks smooting table current ptr 51 | ulong sm_tbl_ptr; 52 | 53 | } PaddleState; 54 | 55 | // Exports 56 | void cw_gen_init(void); 57 | ulong cw_gen_process(float *i_buffer,float *q_buffer,ulong size); 58 | ulong cw_gen_process_strk(float *i_buffer,float *q_buffer,ulong size); 59 | ulong cw_gen_process_iamb(float *i_buffer,float *q_buffer,ulong size); 60 | 61 | void cw_gen_dah_IRQ(void); 62 | void cw_gen_dit_IRQ(void); 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /drivers/audio/cw/cw_sm_tbl.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __CW_SM_TBL_H 15 | #define __CW_SM_TBL_H 16 | 17 | #define CW_SMOOTH_TBL_SIZE 32 18 | 19 | const float sm_table[CW_SMOOTH_TBL_SIZE] = { 20 | 0, 21 | 0.0323949034866865, 22 | 0.0664377813382162, 23 | 0.1021744106202792, 24 | 0.1394369420920119, 25 | 0.1780727855344472, 26 | 0.2178988326848249, 27 | 0.2587167162584878, 28 | 0.3003585870145724, 29 | 0.3425955596246281, 30 | 0.3852292668039979, 31 | 0.4280308232242313, 32 | 0.4707866025787747, 33 | 0.5132677195391775, 34 | 0.5552605477988861, 35 | 0.5965362020294499, 36 | 0.6368657969024186, 37 | 0.6760204470893416, 38 | 0.7138170443274586, 39 | 0.7500114442664225, 40 | 0.784420538643473, 41 | 0.8168459601739528, 42 | 0.8471046005951019, 43 | 0.8750286106660563, 44 | 0.9004654001678492, 45 | 0.9232623788815137, 46 | 0.9432822156099794, 47 | 0.9604180971999695, 48 | 0.9745784695201038, 49 | 0.9856717784390021, 50 | 0.9936369878690776, 51 | 0.9984283207446403 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /drivers/audio/filters/fir_1_8k.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __FIR_1_8K_H 15 | #define __FIR_1_8K_H 16 | 17 | /************************************************************** 18 | WinFilter version 0.8 19 | http://www.winfilter.20m.com 20 | akundert@hotmail.com 21 | 22 | Filter type: Low Pass 23 | Filter model: Raised Cosine 24 | Roll Off Factor: 0.500000 25 | Sampling Frequency: 48 KHz 26 | Cut Frequency: 1.800000 KHz 27 | Coefficents Quantization: float 28 | ***************************************************************/ 29 | const float Fir1p8k[] = 30 | { 31 | -0.00426819364143772060, 32 | -0.00597439843648166210, 33 | -0.00763055542185103740, 34 | -0.00908405765771721180, 35 | -0.01016593456122973600, 36 | -0.01070053841743971900, 37 | -0.01051687408464730900, 38 | -0.00946086177749527230, 39 | -0.00740769165783349260, 40 | -0.00427335758554678140, 41 | -0.00002445525440020314, 42 | 0.00531459894523010620, 43 | 0.01165762971415022100, 44 | 0.01885654143712867100, 45 | 0.02670517545498869700, 46 | 0.03494714310266955300, 47 | 0.04328729807517890700, 48 | 0.05140623264250578100, 49 | 0.05897694040337997400, 50 | 0.06568260392707771200, 51 | 0.07123435483872585200, 52 | 0.07538782704221719300, 53 | 0.07795738458131895600, 54 | 0.07882705078156765400, 55 | 0.07795738458131895600, 56 | 0.07538782704221719300, 57 | 0.07123435483872585200, 58 | 0.06568260392707771200, 59 | 0.05897694040337997400, 60 | 0.05140623264250578100, 61 | 0.04328729807517890700, 62 | 0.03494714310266955300, 63 | 0.02670517545498869700, 64 | 0.01885654143712867100, 65 | 0.01165762971415022100, 66 | 0.00531459894523010620, 67 | -0.00002445525440020314, 68 | -0.00427335758554678140, 69 | -0.00740769165783349260, 70 | -0.00946086177749527230, 71 | -0.01051687408464730900, 72 | -0.01070053841743971900, 73 | -0.01016593456122973600, 74 | -0.00908405765771721180, 75 | -0.00763055542185103740, 76 | -0.00597439843648166210, 77 | -0.00426819364143772060, 78 | -0.00264067411855023690 79 | }; 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /drivers/audio/filters/fir_2_3k.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __FIR_2_3K_H 15 | #define __FIR_2_3K_H 16 | 17 | /************************************************************** 18 | WinFilter version 0.8 19 | http://www.winfilter.20m.com 20 | akundert@hotmail.com 21 | 22 | Filter type: Low Pass 23 | Filter model: Raised Cosine 24 | Roll Off Factor: 0.500000 25 | Sampling Frequency: 48 KHz 26 | Cut Frequency: 2.600000 KHz 27 | Coefficents Quantization: float 28 | ***************************************************************/ 29 | 30 | const float Fir2p3k[] = 31 | { 32 | 0.00188114078300528960, 33 | 0.00246915627560174680, 34 | 0.00275147999511975250, 35 | 0.00249922207395431550, 36 | 0.00151923424574379510, 37 | -0.00029316909784470079, 38 | -0.00290526201735795800, 39 | -0.00611169810901346370, 40 | -0.00952212365416487890, 41 | -0.01257799847944318500, 42 | -0.01460079028693520200, 43 | -0.01486856826099707200, 44 | -0.01271279469446456700, 45 | -0.00762272449367136420, 46 | 0.00065787552536992382, 47 | 0.01205736496923631000, 48 | 0.02613973038629860400, 49 | 0.04211389715355937100, 50 | 0.05889147009522376100, 51 | 0.07518835922249293700, 52 | 0.08965889424818972200, 53 | 0.10104562295502811000, 54 | 0.10832496029788323000, 55 | 0.11082877504191631000, 56 | 0.10832496029788323000, 57 | 0.10104562295502811000, 58 | 0.08965889424818972200, 59 | 0.07518835922249293700, 60 | 0.05889147009522376100, 61 | 0.04211389715355937100, 62 | 0.02613973038629860400, 63 | 0.01205736496923631000, 64 | 0.00065787552536992382, 65 | -0.00762272449367136420, 66 | -0.01271279469446456700, 67 | -0.01486856826099707200, 68 | -0.01460079028693520200, 69 | -0.01257799847944318500, 70 | -0.00952212365416487890, 71 | -0.00611169810901346370, 72 | -0.00290526201735795800, 73 | -0.00029316909784470079, 74 | 0.00151923424574379510, 75 | 0.00249922207395431550, 76 | 0.00275147999511975250, 77 | 0.00246915627560174680, 78 | 0.00188114078300528960, 79 | 0.00120466669245462150 80 | }; 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /drivers/audio/filters/fir_3_6k.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __FIR_3_6K_H 15 | #define __FIR_3_6K_H 16 | 17 | /************************************************************** 18 | WinFilter version 0.8 19 | http://www.winfilter.20m.com 20 | akundert@hotmail.com 21 | 22 | Filter type: Low Pass 23 | Filter model: Raised Cosine 24 | Roll Off Factor: 0.500000 25 | Sampling Frequency: 48 KHz 26 | Cut Frequency: 3.600000 KHz 27 | Coefficents Quantization: float 28 | ***************************************************************/ 29 | 30 | const float Fir3p6k[] = 31 | { 32 | 0.00081453499271201123, 33 | 0.00057850280033394056, 34 | 0.00022161691547898369, 35 | -0.00000003189861792975, 36 | 0.00018908271692504838, 37 | 0.00093627473345748405, 38 | 0.00211961256337390170, 39 | 0.00328105380994909900, 40 | 0.00368941656048077470, 41 | 0.00255092844167583140, 42 | -0.00066933841061655552, 43 | -0.00590491352964717630, 44 | -0.01224515425555462700, 45 | -0.01790650429025262100, 46 | -0.02048321349207813200, 47 | -0.01746222733901376900, 48 | -0.00689748492563840510, 49 | 0.01193007242686815700, 50 | 0.03806312753399056200, 51 | 0.06878905910544046200, 52 | 0.10000114513684132000, 53 | 0.12694958155876870000, 54 | 0.14521730877477412000, 55 | 0.15168197724593041000, 56 | 0.14521730877477412000, 57 | 0.12694958155876870000, 58 | 0.10000114513684132000, 59 | 0.06878905910544046200, 60 | 0.03806312753399056200, 61 | 0.01193007242686815700, 62 | -0.00689748492563840510, 63 | -0.01746222733901376900, 64 | -0.02048321349207813200, 65 | -0.01790650429025262100, 66 | -0.01224515425555462700, 67 | -0.00590491352964717630, 68 | -0.00066933841061655552, 69 | 0.00255092844167583140, 70 | 0.00368941656048077470, 71 | 0.00328105380994909900, 72 | 0.00211961256337390170, 73 | 0.00093627473345748405, 74 | 0.00018908271692504838, 75 | -0.00000003189861792975, 76 | 0.00022161691547898369, 77 | 0.00057850280033394056, 78 | 0.00081453499271201123, 79 | 0.00079312289476705944 80 | }; 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /drivers/audio/filters/i_rx_filter.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __I_RX_FILTER_H 15 | #define __I_RX_FILTER_H 16 | 17 | #define I_BLOCK_SIZE 1 18 | #define I_NUM_TAPS 89 19 | 20 | /* 21 | * Kaiser Window FIR Filter 22 | * Passband: 0.0 - 1350.0 Hz 23 | * modulation freq: 1650Hz 24 | * Order: 88 25 | * Transition band: 500.0 Hz 26 | * Stopband attenuation: 60.0 dB 27 | */ 28 | const float i_rx_coeffs[I_NUM_TAPS] = 29 | { 30 | -2.081541E-4f, 31 | -3.5587244E-4f, 32 | -5.237722E-5f, 33 | -1.00883444E-4f, 34 | -8.27162E-4f, 35 | -7.391658E-4f, 36 | 9.386093E-5f, 37 | -6.221307E-4f, 38 | -0.0019506976f, 39 | -8.508009E-4f, 40 | 2.8596455E-4f, 41 | -0.002028003f, 42 | -0.003321186f, 43 | -2.7830937E-4f, 44 | 2.7148606E-9f, 45 | -0.004654892f, 46 | -0.0041854046f, 47 | 0.001115112f, 48 | -0.0017027275f, 49 | -0.008291345f, 50 | -0.0034240147f, 51 | 0.0027767413f, 52 | -0.005873899f, 53 | -0.011811939f, 54 | -2.075215E-8f, 55 | 0.003209243f, 56 | -0.0131212445f, 57 | -0.013072912f, 58 | 0.0064319638f, 59 | 1.0081245E-8f, 60 | -0.023050211f, 61 | -0.009034872f, 62 | 0.015074444f, 63 | -0.010180626f, 64 | -0.034043692f, 65 | 0.004729156f, 66 | 0.024004854f, 67 | -0.033643555f, 68 | -0.043601833f, 69 | 0.04075407f, 70 | 0.03076061f, 71 | -0.10492244f, 72 | -0.049181364f, 73 | 0.30635652f, 74 | 0.5324795f, 75 | 0.30635652f, 76 | -0.049181364f, 77 | -0.10492244f, 78 | 0.03076061f, 79 | 0.04075407f, 80 | -0.043601833f, 81 | -0.033643555f, 82 | 0.024004854f, 83 | 0.004729156f, 84 | -0.034043692f, 85 | -0.010180626f, 86 | 0.015074444f, 87 | -0.009034872f, 88 | -0.023050211f, 89 | 1.0081245E-8f, 90 | 0.0064319638f, 91 | -0.013072912f, 92 | -0.0131212445f, 93 | 0.003209243f, 94 | -2.075215E-8f, 95 | -0.011811939f, 96 | -0.005873899f, 97 | 0.0027767413f, 98 | -0.0034240147f, 99 | -0.008291345f, 100 | -0.0017027275f, 101 | 0.001115112f, 102 | -0.0041854046f, 103 | -0.004654892f, 104 | 2.7148606E-9f, 105 | -2.7830937E-4f, 106 | -0.003321186f, 107 | -0.002028003f, 108 | 2.8596455E-4f, 109 | -8.508009E-4f, 110 | -0.0019506976f, 111 | -6.221307E-4f, 112 | 9.386093E-5f, 113 | -7.391658E-4f, 114 | -8.27162E-4f, 115 | -1.00883444E-4f, 116 | -5.237722E-5f, 117 | -3.5587244E-4f, 118 | -2.081541E-4f 119 | }; 120 | 121 | static float32_t FirState_I[128]; 122 | arm_fir_instance_f32 FIR_I; 123 | 124 | #endif 125 | -------------------------------------------------------------------------------- /drivers/audio/filters/i_tx_filter.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __I_TX_FILTER_H 15 | #define __I_TX_FILTER_H 16 | 17 | #define I_TX_BLOCK_SIZE 1 18 | #define I_TX_NUM_TAPS 31 19 | 20 | const float i_tx_coeffs[I_TX_NUM_TAPS] = 21 | { 22 | -0.000001471048f, 23 | -0.000008733459f, 24 | 0.000020899328f, 25 | -0.000119307579f, 26 | 0.000073745873f, 27 | -0.000833593046f, 28 | -0.000250466363f, 29 | -0.003477179239f, 30 | -0.003120310594f, 31 | -0.009819740014f, 32 | -0.014799302400f, 33 | -0.019970367225f, 34 | -0.050950886022f, 35 | -0.030234028630f, 36 | -0.215745393756f, 37 | 0.318897616171f, 38 | 0.215745393756f, 39 | -0.030234028630f, 40 | 0.050950886022f, 41 | -0.019970367225f, 42 | 0.014799302400f, 43 | -0.009819740014f, 44 | 0.003120310594f, 45 | -0.003477179239f, 46 | 0.000250466363f, 47 | -0.000833593046f, 48 | -0.000073745873f, 49 | -0.000119307579f, 50 | -0.000020899328f, 51 | -0.000008733459f, 52 | 0.000001471048f 53 | }; 54 | 55 | static float32_t FirState_I_TX[128]; 56 | arm_fir_instance_f32 FIR_I_TX; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /drivers/audio/filters/q_rx_filter.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __Q_RX_FILTER_H 15 | #define __Q_RX_FILTER_H 16 | 17 | #define Q_BLOCK_SIZE 1 18 | #define Q_NUM_TAPS 89 19 | 20 | /* 21 | * Kaiser Window FIR Filter 22 | * 23 | * Filter type: Q-filter 24 | * Passband: 0.0 - 1350.0 Hz 25 | * modulation freq: 1650Hz 26 | * with +90 degree pahse shift 27 | * Order: 88 28 | * Transition band: 500.0 Hz 29 | * Stopband attenuation: 60.0 dB 30 | */ 31 | const float q_rx_coeffs[Q_NUM_TAPS] = 32 | { 33 | 6.767926E-5f, 34 | -2.1822347E-4f, 35 | -3.3091355E-4f, 36 | 1.1819744E-4f, 37 | 2.1773627E-9f, 38 | -8.6602167E-4f, 39 | -5.9300865E-4f, 40 | 3.814961E-4f, 41 | -6.342388E-4f, 42 | -0.00205537f, 43 | -5.616135E-4f, 44 | 4.8721067E-4f, 45 | -0.002414588f, 46 | -0.003538588f, 47 | -2.7166707E-9f, 48 | -3.665928E-4f, 49 | -0.0057645175f, 50 | -0.004647882f, 51 | 8.681589E-4f, 52 | -0.0034366683f, 53 | -0.010545009f, 54 | -0.0045342376f, 55 | 9.309649E-4f, 56 | -0.01009504f, 57 | -0.015788108f, 58 | -0.0027427748f, 59 | -0.0020795742f, 60 | -0.021347176f, 61 | -0.019808702f, 62 | -4.1785704E-9f, 63 | -0.011752444f, 64 | -0.037658f, 65 | -0.020762002f, 66 | 8.017756E-4f, 67 | -0.03406628f, 68 | -0.060129803f, 69 | -0.01745214f, 70 | -0.008082453f, 71 | -0.08563026f, 72 | -0.09845453f, 73 | -0.010001372f, 74 | -0.06433928f, 75 | -0.31072536f, 76 | -0.35893586f, 77 | 0.0f, 78 | 0.35893586f, 79 | 0.31072536f, 80 | 0.06433928f, 81 | 0.010001372f, 82 | 0.09845453f, 83 | 0.08563026f, 84 | 0.008082453f, 85 | 0.01745214f, 86 | 0.060129803f, 87 | 0.03406628f, 88 | -8.017756E-4f, 89 | 0.020762002f, 90 | 0.037658f, 91 | 0.011752444f, 92 | 4.1785704E-9f, 93 | 0.019808702f, 94 | 0.021347176f, 95 | 0.0020795742f, 96 | 0.0027427748f, 97 | 0.015788108f, 98 | 0.01009504f, 99 | -9.309649E-4f, 100 | 0.0045342376f, 101 | 0.010545009f, 102 | 0.0034366683f, 103 | -8.681589E-4f, 104 | 0.004647882f, 105 | 0.0057645175f, 106 | 3.665928E-4f, 107 | 2.7166707E-9f, 108 | 0.003538588f, 109 | 0.002414588f, 110 | -4.8721067E-4f, 111 | 5.616135E-4f, 112 | 0.00205537f, 113 | 6.342388E-4f, 114 | -3.814961E-4f, 115 | 5.9300865E-4f, 116 | 8.6602167E-4f, 117 | -2.1773627E-9f, 118 | -1.1819744E-4f, 119 | 3.3091355E-4f, 120 | 2.1822347E-4f, 121 | -6.767926E-5f 122 | }; 123 | 124 | static float32_t FirState_Q[128]; 125 | arm_fir_instance_f32 FIR_Q; 126 | 127 | #endif 128 | -------------------------------------------------------------------------------- /drivers/audio/filters/q_tx_filter.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __Q_TX_FILTER_H 15 | #define __Q_TX_FILTER_H 16 | 17 | #define Q_TX_BLOCK_SIZE 1 18 | #define Q_TX_NUM_TAPS 31 19 | 20 | const float q_tx_coeffs[Q_TX_NUM_TAPS] = 21 | { 22 | -0.000001471048f, 23 | 0.000008733459f, 24 | 0.000020899328f, 25 | 0.000119307579f, 26 | 0.000073745873f, 27 | 0.000833593046f, 28 | -0.000250466363f, 29 | 0.003477179239f, 30 | -0.003120310594f, 31 | 0.009819740014f, 32 | -0.014799302400f, 33 | 0.019970367225f, 34 | -0.050950886022f, 35 | 0.030234028630f, 36 | -0.215745393756f, 37 | -0.318897616171f, 38 | 0.215745393756f, 39 | 0.030234028630f, 40 | 0.050950886022f, 41 | 0.019970367225f, 42 | 0.014799302400f, 43 | 0.009819740014f, 44 | 0.003120310594f, 45 | 0.003477179239f, 46 | 0.000250466363f, 47 | 0.000833593046f, 48 | -0.000073745873f, 49 | 0.000119307579f, 50 | -0.000020899328f, 51 | 0.000008733459f, 52 | 0.000001471048f 53 | }; 54 | 55 | static float32_t FirState_Q_TX[128]; 56 | arm_fir_instance_f32 FIR_Q_TX; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /drivers/audio/softdds/softdds.c: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | // Credits - SDR cube!!! 15 | 16 | // Common 17 | #include "mchf_board.h" 18 | 19 | #include 20 | 21 | #include "dds_table.h" 22 | #include "softdds.h" 23 | 24 | // Software DDS public 25 | __IO SoftDds sd; 26 | 27 | // Step in the public structure - don't work for some crazy reason 28 | ulong step; 29 | 30 | //*---------------------------------------------------------------------------- 31 | //* Function Name : softdds_setfreq 32 | //* Object : 33 | //* Object : 34 | //* Input Parameters : 35 | //* Output Parameters : 36 | //* Functions called : 37 | //*---------------------------------------------------------------------------- 38 | void softdds_setfreq(float freq,ulong samp_rate,uchar smooth) 39 | { 40 | float f = (float)(samp_rate); 41 | 42 | //printf("freq %d\n\r",(int)freq); 43 | 44 | // Reset accumulator, if need smooth tone 45 | // transition, do not reset it (e.g. wspr) 46 | if(!smooth) 47 | sd.acc = 0; 48 | 49 | // Calculate new step 50 | f /= 65536.0; 51 | step = (ulong)(freq / f); 52 | 53 | //printf("step %d\n\r",step); 54 | } 55 | 56 | //*---------------------------------------------------------------------------- 57 | //* Function Name : softdds_runf 58 | //* Object : use two float buffer 59 | //* Object : 60 | //* Input Parameters : 61 | //* Output Parameters : 62 | //* Functions called : 63 | //*---------------------------------------------------------------------------- 64 | void softdds_runf(float *i_buff,float *q_buff,ushort size) 65 | { 66 | ulong i,k; 67 | 68 | for(i = 0; i < size; i++) 69 | { 70 | // Calculate next sample 71 | sd.acc += step; 72 | k = sd.acc >> DDS_ACC_SHIFT; 73 | 74 | // Fix ptr overload 75 | k &= (DDS_TBL_SIZE - 1); 76 | 77 | // Load I value 78 | *i_buff = (float)(DDS_TABLE[k]); 79 | 80 | // 90 degrees shift 81 | k += (DDS_TBL_SIZE/4); 82 | 83 | // Fix ptr overload 84 | k &= (DDS_TBL_SIZE - 1); 85 | 86 | // Load Q value 87 | *q_buff = (float)(DDS_TABLE[k]); 88 | 89 | // Next ptr 90 | i_buff++; 91 | q_buff++; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /drivers/audio/softdds/softdds.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __SOFTDDS_H 15 | #define __SOFTDDS_H 16 | 17 | // 256 points 18 | //#define DDS_ACC_SHIFT 8 19 | 20 | // 512 points 21 | //#define DDS_ACC_SHIFT 7 22 | 23 | // 1024 points 24 | #define DDS_ACC_SHIFT 6 25 | 26 | // Soft DDS public structure 27 | typedef struct SoftDds 28 | { 29 | // DDS accumulator 30 | ulong acc; 31 | 32 | // DDS step - not working if part of the structure 33 | ulong step; 34 | 35 | } SoftDds; 36 | 37 | void softdds_setfreq(float freq,ulong samp_rate,uchar smooth); 38 | void softdds_runf(float *i_buff,float *q_buff,ushort size); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /drivers/cat/cat_driver.c: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | // Common 15 | #include "mchf_board.h" 16 | 17 | #include 18 | 19 | #include "usbd_cdc_core.h" 20 | #include "usbd_usr.h" 21 | #include "usb_conf.h" 22 | #include "usbd_desc.h" 23 | 24 | #include "cat_driver.h" 25 | 26 | __ALIGN_BEGIN USB_OTG_CORE_HANDLE USB_OTG_dev __ALIGN_END ; 27 | 28 | extern USB_OTG_CORE_HANDLE USB_OTG_dev; 29 | extern uint32_t USBD_OTG_ISR_Handler (USB_OTG_CORE_HANDLE *pdev); 30 | 31 | extern __IO CatDriver kd; 32 | 33 | //void OTG_FS_WKUP_IRQHandler(void) 34 | //{ 35 | //if(USB_OTG_dev.cfg.low_power) 36 | //{ 37 | // *(uint32_t *)(0xE000ED10) &= 0xFFFFFFF9 ; 38 | // SystemInit(); 39 | // USB_OTG_UngateClock(&USB_OTG_dev); 40 | //} 41 | //EXTI_ClearITPendingBit(EXTI_Line18); 42 | //} 43 | 44 | void OTG_FS_IRQHandler(void) 45 | { 46 | USBD_OTG_ISR_Handler (&USB_OTG_dev); 47 | } 48 | 49 | void cat_driver_init(void) 50 | { 51 | // Start driver 52 | USBD_Init( &USB_OTG_dev, 53 | USB_OTG_FS_CORE_ID, 54 | &USR_desc, 55 | &USBD_CDC_cb, 56 | &USR_cb); 57 | 58 | printf("cat driver started\n\r"); 59 | } 60 | 61 | void cat_driver_stop(void) 62 | { 63 | // Stop driver 64 | USBD_DeInit(&USB_OTG_dev); 65 | 66 | printf("cat driver stopped\n\r"); 67 | } 68 | 69 | void cat_driver_thread(void) 70 | { 71 | if(!kd.enabled) 72 | return; 73 | } 74 | -------------------------------------------------------------------------------- /drivers/cat/cat_driver.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __CAT_DRIVER_H 15 | #define __CAT_DRIVER_H 16 | 17 | // CAT driver public structure 18 | typedef struct CatDriver 19 | { 20 | uchar enabled; 21 | 22 | } CatDriver; 23 | 24 | // Exports 25 | void cat_driver_init(void); 26 | void cat_driver_stop(void); 27 | void cat_driver_thread(void); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /drivers/cat/usb/usbd_bsp.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_bsp.c 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief This file is responsible to offer board support package and is 8 | * configurable by user. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "usbd_bsp.h" 31 | #include "usbd_conf.h" 32 | 33 | void USBD_OTG_BSP_Init(USB_OTG_CORE_HANDLE *pdev) 34 | { 35 | GPIO_InitTypeDef GPIO_InitStructure; 36 | 37 | //RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_GPIOA , ENABLE); 38 | 39 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11|GPIO_Pin_12; 40 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; 41 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; 42 | GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; 43 | GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ; 44 | GPIO_Init(GPIOA, &GPIO_InitStructure); 45 | 46 | GPIO_PinAFConfig(GPIOA,GPIO_PinSource11,GPIO_AF_OTG1_FS) ; 47 | GPIO_PinAFConfig(GPIOA,GPIO_PinSource12,GPIO_AF_OTG1_FS) ; 48 | 49 | //RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); // already on 50 | RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_OTG_FS, ENABLE) ; 51 | } 52 | 53 | void USBD_OTG_BSP_DeInit(USB_OTG_CORE_HANDLE *pdev) 54 | { 55 | GPIO_InitTypeDef GPIO_InitStructure; 56 | NVIC_InitTypeDef NVIC_InitStructure; 57 | 58 | // IRQ channel stop 59 | NVIC_InitStructure.NVIC_IRQChannel = OTG_FS_IRQn; 60 | NVIC_InitStructure.NVIC_IRQChannelCmd = DISABLE; 61 | NVIC_Init(&NVIC_InitStructure); 62 | 63 | // Stop peripheral clock 64 | RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_OTG_FS, DISABLE) ; 65 | 66 | // Pins back to input 67 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 |GPIO_Pin_12; 68 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; 69 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; 70 | GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN; 71 | GPIO_Init(GPIOA, &GPIO_InitStructure); 72 | } 73 | 74 | void USBD_OTG_BSP_EnableInterrupt(USB_OTG_CORE_HANDLE *pdev) 75 | { 76 | NVIC_InitTypeDef NVIC_InitStructure; 77 | 78 | NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1); 79 | 80 | NVIC_InitStructure.NVIC_IRQChannel = OTG_FS_IRQn; 81 | NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; 82 | NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3; 83 | NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; 84 | NVIC_Init(&NVIC_InitStructure); 85 | } 86 | 87 | void USBD_OTG_BSP_uDelay (const uint32_t usec) 88 | { 89 | uint32_t count = 0; 90 | const uint32_t utime = (120 * usec / 7); 91 | do 92 | { 93 | if ( ++count > utime ) 94 | { 95 | return ; 96 | } 97 | } 98 | while (1); 99 | } 100 | 101 | void USBD_OTG_BSP_mDelay (const uint32_t msec) 102 | { 103 | USBD_OTG_BSP_uDelay(msec * 1000); 104 | } 105 | 106 | void USBD_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev) 107 | { 108 | } 109 | void USBD_OTG_BSP_DriveVBUS(USB_OTG_CORE_HANDLE *pdev,uint8_t state) 110 | { 111 | } 112 | 113 | 114 | -------------------------------------------------------------------------------- /drivers/cat/usb/usbd_bsp.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_bsp.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief Specific api's relative to the used hardware platform 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USBD_BSP__H__ 30 | #define __USBD_BSP__H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_core.h" 34 | #include "usb_conf.h" 35 | 36 | 37 | //void BSP_Init(void); 38 | 39 | void USBD_OTG_BSP_Init (USB_OTG_CORE_HANDLE *pdev); 40 | void USBD_OTG_BSP_DeInit(USB_OTG_CORE_HANDLE *pdev); 41 | void USBD_OTG_BSP_uDelay (const uint32_t usec); 42 | void USBD_OTG_BSP_mDelay (const uint32_t msec); 43 | void USBD_OTG_BSP_EnableInterrupt (USB_OTG_CORE_HANDLE *pdev); 44 | //#ifdef USE_HOST_MODE 45 | void USBD_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev); 46 | void USBD_OTG_BSP_DriveVBUS(USB_OTG_CORE_HANDLE *pdev,uint8_t state); 47 | //#endif 48 | /** 49 | * @} 50 | */ 51 | 52 | #endif //__USB_BSP__H__ 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** 59 | * @} 60 | */ 61 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 62 | 63 | -------------------------------------------------------------------------------- /drivers/cat/usb/usbd_cdc_vcp.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_cdc_vcp.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief Header for usbd_cdc_vcp.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USBD_CDC_VCP_H 30 | #define __USBD_CDC_VCP_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #ifdef STM32F2XX 34 | #include "stm32f2xx.h" 35 | #elif defined(STM32F10X_CL) 36 | #include "stm32f10x.h" 37 | #endif /* STM32F2XX */ 38 | 39 | #include "usbd_cdc_core.h" 40 | #include "usbd_conf.h" 41 | 42 | 43 | /* Exported typef ------------------------------------------------------------*/ 44 | /* The following structures groups all needed parameters to be configured for the 45 | ComPort. These parameters can modified on the fly by the host through CDC class 46 | command class requests. */ 47 | typedef struct 48 | { 49 | uint32_t bitrate; 50 | uint8_t format; 51 | uint8_t paritytype; 52 | uint8_t datatype; 53 | }LINE_CODING; 54 | 55 | /* Exported constants --------------------------------------------------------*/ 56 | /* The following define is used to route the USART IRQ handler to be used. 57 | The IRQ handler function is implemented in the usbd_cdc_vcp.c file. */ 58 | 59 | #ifdef USE_STM3210C_EVAL 60 | #define EVAL_COM_IRQHandler USART2_IRQHandler 61 | #else 62 | #define EVAL_COM_IRQHandler USART3_IRQHandler 63 | #endif /* USE_STM322xG_EVAL */ 64 | 65 | 66 | #define DEFAULT_CONFIG 0 67 | #define OTHER_CONFIG 1 68 | 69 | /* Exported macro ------------------------------------------------------------*/ 70 | /* Exported functions ------------------------------------------------------- */ 71 | 72 | #endif /* __USBD_CDC_VCP_H */ 73 | 74 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 75 | -------------------------------------------------------------------------------- /drivers/cat/usb/usbd_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_conf.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief USB Device configuration file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USBD_CONF__H__ 30 | #define __USBD_CONF__H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_conf.h" 34 | 35 | /** @defgroup USB_CONF_Exported_Defines 36 | * @{ 37 | */ 38 | #define USBD_CFG_MAX_NUM 1 39 | #define USBD_ITF_MAX_NUM 1 40 | 41 | #define USBD_SELF_POWERED 42 | 43 | #define USB_MAX_STR_DESC_SIZ 255 44 | 45 | /** @defgroup USB_VCP_Class_Layer_Parameter 46 | * @{ 47 | */ 48 | #define CDC_IN_EP 0x81 /* EP1 for data IN */ 49 | #define CDC_OUT_EP 0x01 /* EP1 for data OUT */ 50 | #define CDC_CMD_EP 0x82 /* EP2 for CDC commands */ 51 | 52 | /* CDC Endpoints parameters: you can fine tune these values depending on the needed baudrates and performance. */ 53 | #ifdef USE_USB_OTG_HS 54 | #define CDC_DATA_MAX_PACKET_SIZE 512 /* Endpoint IN & OUT Packet size */ 55 | #define CDC_CMD_PACKET_SZE 8 /* Control Endpoint Packet size */ 56 | 57 | #define CDC_IN_FRAME_INTERVAL 40 /* Number of micro-frames between IN transfers */ 58 | #define APP_RX_DATA_SIZE 2048 /* Total size of IN buffer: 59 | APP_RX_DATA_SIZE*8/MAX_BAUDARATE*1000 should be > CDC_IN_FRAME_INTERVAL*8 */ 60 | #else 61 | #define CDC_DATA_MAX_PACKET_SIZE 64 /* Endpoint IN & OUT Packet size */ 62 | #define CDC_CMD_PACKET_SZE 8 /* Control Endpoint Packet size */ 63 | 64 | #define CDC_IN_FRAME_INTERVAL 5 /* Number of frames between IN transfers */ 65 | #define APP_RX_DATA_SIZE 2048 /* Total size of IN buffer: 66 | APP_RX_DATA_SIZE*8/MAX_BAUDARATE*1000 should be > CDC_IN_FRAME_INTERVAL */ 67 | #endif /* USE_USB_OTG_HS */ 68 | 69 | #define APP_FOPS VCP_fops 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /drivers/cat/usb/usbd_desc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_desc.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief header file for the usbd_desc.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | 30 | #ifndef __USB_DESC_H 31 | #define __USB_DESC_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usbd_def.h" 35 | 36 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 37 | * @{ 38 | */ 39 | 40 | /** @defgroup USB_DESC 41 | * @brief general defines for the usb device library file 42 | * @{ 43 | */ 44 | 45 | /** @defgroup USB_DESC_Exported_Defines 46 | * @{ 47 | */ 48 | #define USB_DEVICE_DESCRIPTOR_TYPE 0x01 49 | #define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02 50 | #define USB_STRING_DESCRIPTOR_TYPE 0x03 51 | #define USB_INTERFACE_DESCRIPTOR_TYPE 0x04 52 | #define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05 53 | #define USB_SIZ_DEVICE_DESC 18 54 | #define USB_SIZ_STRING_LANGID 4 55 | 56 | /** 57 | * @} 58 | */ 59 | 60 | 61 | /** @defgroup USBD_DESC_Exported_TypesDefinitions 62 | * @{ 63 | */ 64 | /** 65 | * @} 66 | */ 67 | 68 | 69 | 70 | /** @defgroup USBD_DESC_Exported_Macros 71 | * @{ 72 | */ 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup USBD_DESC_Exported_Variables 78 | * @{ 79 | */ 80 | extern uint8_t USBD_DeviceDesc [USB_SIZ_DEVICE_DESC]; 81 | extern uint8_t USBD_StrDesc[USB_MAX_STR_DESC_SIZ]; 82 | extern uint8_t USBD_OtherSpeedCfgDesc[USB_LEN_CFG_DESC]; 83 | extern uint8_t USBD_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC]; 84 | extern uint8_t USBD_LangIDDesc[USB_SIZ_STRING_LANGID]; 85 | extern USBD_DEVICE USR_desc; 86 | /** 87 | * @} 88 | */ 89 | 90 | /** @defgroup USBD_DESC_Exported_FunctionsPrototype 91 | * @{ 92 | */ 93 | 94 | 95 | uint8_t * USBD_USR_DeviceDescriptor( uint8_t speed , uint16_t *length); 96 | uint8_t * USBD_USR_LangIDStrDescriptor( uint8_t speed , uint16_t *length); 97 | uint8_t * USBD_USR_ManufacturerStrDescriptor ( uint8_t speed , uint16_t *length); 98 | uint8_t * USBD_USR_ProductStrDescriptor ( uint8_t speed , uint16_t *length); 99 | uint8_t * USBD_USR_SerialStrDescriptor( uint8_t speed , uint16_t *length); 100 | uint8_t * USBD_USR_ConfigStrDescriptor( uint8_t speed , uint16_t *length); 101 | uint8_t * USBD_USR_InterfaceStrDescriptor( uint8_t speed , uint16_t *length); 102 | 103 | #ifdef USB_SUPPORT_USER_STRING_DESC 104 | uint8_t * USBD_USR_USRStringDesc (uint8_t speed, uint8_t idx , uint16_t *length); 105 | #endif /* USB_SUPPORT_USER_STRING_DESC */ 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | #endif /* __USBD_DESC_H */ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | /** 118 | * @} 119 | */ 120 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 121 | -------------------------------------------------------------------------------- /drivers/cat/usb/usbd_usr.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_usr.c 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief This file includes the user application layer 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | // Common 29 | #include "mchf_board.h" 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "usbd_usr.h" 33 | #include "usbd_ioreq.h" 34 | 35 | #include 36 | 37 | USBD_Usr_cb_TypeDef USR_cb = 38 | { 39 | USBD_USR_Init, 40 | USBD_USR_DeviceReset, 41 | USBD_USR_DeviceConfigured, 42 | USBD_USR_DeviceSuspended, 43 | USBD_USR_DeviceResumed, 44 | 45 | 46 | USBD_USR_DeviceConnected, 47 | USBD_USR_DeviceDisconnected, 48 | }; 49 | 50 | // 51 | // call to here commented out 52 | // in USBD_Init() in usbd_core.c 53 | // 54 | void USBD_USR_Init(void) 55 | { 56 | //printf("USBD_USR_Init\n\r"); 57 | //while(1); 58 | 59 | /* Initialize LEDs */ 60 | //STM_EVAL_LEDInit(LED1); 61 | //STM_EVAL_LEDInit(LED2); 62 | //STM_EVAL_LEDInit(LED3); 63 | //STM_EVAL_LEDInit(LED4); 64 | 65 | //LCD_LOG_Init(); 66 | 67 | #ifdef USE_USB_OTG_HS 68 | //LCD_LOG_SetHeader(" USB OTG HS VCP Device"); 69 | #else 70 | //LCD_LOG_SetHeader(" USB OTG FS VCP Device"); 71 | #endif 72 | //LCD_UsrLog("> USB device library started.\n"); 73 | //LCD_LOG_SetFooter (" USB Device Library v1.1.0" ); 74 | } 75 | 76 | /** 77 | * @brief USBD_USR_DeviceReset 78 | * Displays the message on LCD on device Reset Event 79 | * @param speed : device speed 80 | * @retval None 81 | */ 82 | void USBD_USR_DeviceReset(uint8_t speed ) 83 | { 84 | switch (speed) 85 | { 86 | case USB_OTG_SPEED_HIGH: 87 | //LCD_LOG_SetFooter (" USB Device Library v1.1.0 [HS]" ); 88 | break; 89 | 90 | case USB_OTG_SPEED_FULL: 91 | //LCD_LOG_SetFooter (" USB Device Library v1.1.0 [FS]" ); 92 | break; 93 | //default: 94 | //LCD_LOG_SetFooter (" USB Device Library v1.1.0 [??]" ); 95 | } 96 | } 97 | 98 | 99 | /** 100 | * @brief USBD_USR_DeviceConfigured 101 | * Displays the message on LCD on device configuration Event 102 | * @param None 103 | * @retval Staus 104 | */ 105 | void USBD_USR_DeviceConfigured (void) 106 | { 107 | //LCD_UsrLog("> VCP Interface configured.\n"); 108 | } 109 | 110 | /** 111 | * @brief USBD_USR_DeviceSuspended 112 | * Displays the message on LCD on device suspend Event 113 | * @param None 114 | * @retval None 115 | */ 116 | void USBD_USR_DeviceSuspended(void) 117 | { 118 | //LCD_UsrLog("> USB Device in Suspend Mode.\n"); 119 | /* Users can do their application actions here for the USB-Reset */ 120 | } 121 | 122 | 123 | /** 124 | * @brief USBD_USR_DeviceResumed 125 | * Displays the message on LCD on device resume Event 126 | * @param None 127 | * @retval None 128 | */ 129 | void USBD_USR_DeviceResumed(void) 130 | { 131 | //LCD_UsrLog("> USB Device in Idle Mode.\n"); 132 | /* Users can do their application actions here for the USB-Reset */ 133 | } 134 | 135 | 136 | /** 137 | * @brief USBD_USR_DeviceConnected 138 | * Displays the message on LCD on device connection Event 139 | * @param None 140 | * @retval Staus 141 | */ 142 | void USBD_USR_DeviceConnected (void) 143 | { 144 | //LCD_UsrLog("> USB Device Connected.\n"); 145 | 146 | //printf("USB Device Connected.\n\r"); 147 | } 148 | 149 | 150 | /** 151 | * @brief USBD_USR_DeviceDisonnected 152 | * Displays the message on LCD on device disconnection Event 153 | * @param None 154 | * @retval Staus 155 | */ 156 | void USBD_USR_DeviceDisconnected (void) 157 | { 158 | //LCD_UsrLog("> USB Device Disconnected.\n"); 159 | 160 | //printf("USB Device Disconnected.\n\r"); 161 | } 162 | 163 | -------------------------------------------------------------------------------- /drivers/keyboard/keyb_driver.c: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | // Common 15 | #include "mchf_board.h" 16 | 17 | #include "usbh_bsp.h" 18 | #include "usbh_core.h" 19 | #include "usbh_usr.h" 20 | #include "usbh_hid_core.h" 21 | 22 | #include "keyb_driver.h" 23 | 24 | __ALIGN_BEGIN USB_OTG_CORE_HANDLE USB_OTG_Core_dev __ALIGN_END ; 25 | __ALIGN_BEGIN USBH_HOST USB_Host __ALIGN_END ; 26 | 27 | 28 | //*---------------------------------------------------------------------------- 29 | //* Function Name : TIM2_IRQHandler 30 | //* Object : 31 | //* Object : 32 | //* Input Parameters : 33 | //* Output Parameters : 34 | //* Functions called : 35 | //*---------------------------------------------------------------------------- 36 | void TIM2_IRQHandler(void) 37 | { 38 | USBH_OTG_BSP_TimerIRQ(); 39 | } 40 | 41 | //*---------------------------------------------------------------------------- 42 | //* Function Name : OTG_HS_IRQHandler 43 | //* Object : 44 | //* Object : 45 | //* Input Parameters : 46 | //* Output Parameters : 47 | //* Functions called : 48 | //*---------------------------------------------------------------------------- 49 | void OTG_HS_IRQHandler(void) 50 | { 51 | // Interrupt here even if driver not enabled, when the cat driver works 52 | // to fix! 53 | //USBH_OTG_ISR_Handler(&USB_OTG_Core_dev); 54 | } 55 | 56 | void keyb_driver_init(void) 57 | { 58 | printf("keyb driver init...\n\r"); 59 | 60 | // Init Host Library 61 | USBH_Init( &USB_OTG_Core_dev, 62 | USB_OTG_HS_CORE_ID, 63 | &USB_Host, 64 | &HID_cb, 65 | &USR_Callbacks); 66 | 67 | printf("keyb driver init ok\n\r"); 68 | } 69 | 70 | void keyb_driver_thread(void) 71 | { 72 | // Host Task handler 73 | USBH_Process(&USB_OTG_Core_dev , &USB_Host); 74 | } 75 | -------------------------------------------------------------------------------- /drivers/keyboard/keyb_driver.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __KEYB_DRIVER_H 15 | #define __KEYB_DRIVER_H 16 | 17 | // Exports 18 | void keyb_driver_init(void); 19 | void keyb_driver_thread(void); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /drivers/keyboard/usb/usbh_bsp.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_bsp.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief Specific api's relative to the used hardware platform 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USBH_BSP__H__ 30 | #define __USBH_BSP__H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_core.h" 34 | #include "usb_conf.h" 35 | 36 | /** @addtogroup USB_OTG_DRIVER 37 | * @{ 38 | */ 39 | 40 | /** @defgroup USB_BSP 41 | * @brief This file is the 42 | * @{ 43 | */ 44 | 45 | 46 | /** @defgroup USB_BSP_Exported_Defines 47 | * @{ 48 | */ 49 | /** 50 | * @} 51 | */ 52 | 53 | 54 | /** @defgroup USB_BSP_Exported_Types 55 | * @{ 56 | */ 57 | /** 58 | * @} 59 | */ 60 | 61 | 62 | /** @defgroup USB_BSP_Exported_Macros 63 | * @{ 64 | */ 65 | /** 66 | * @} 67 | */ 68 | 69 | /** @defgroup USB_BSP_Exported_Variables 70 | * @{ 71 | */ 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @defgroup USB_BSP_Exported_FunctionsPrototype 77 | * @{ 78 | */ 79 | //void BSP_Init(void); 80 | 81 | void USBH_OTG_BSP_Init (USB_OTG_CORE_HANDLE *pdev); 82 | void USBH_OTG_BSP_uDelay (const uint32_t usec); 83 | void USBH_OTG_BSP_mDelay (const uint32_t msec); 84 | void USBH_OTG_BSP_EnableInterrupt (USB_OTG_CORE_HANDLE *pdev); 85 | #ifdef USE_HOST_MODE 86 | void USBH_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev); 87 | void USBH_OTG_BSP_DriveVBUS(USB_OTG_CORE_HANDLE *pdev,uint8_t state); 88 | #endif 89 | 90 | void USBH_OTG_BSP_TimerIRQ (void); 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | #endif //__USB_BSP__H__ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** 103 | * @} 104 | */ 105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 106 | 107 | -------------------------------------------------------------------------------- /drivers/keyboard/usb/usbh_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file USBH_conf.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief General low level driver configuration 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USBH_CONF__H__ 30 | #define __USBH_CONF__H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | 34 | /** @addtogroup USBH_OTG_DRIVER 35 | * @{ 36 | */ 37 | 38 | /** @defgroup USBH_CONF 39 | * @brief usb otg low level driver configuration file 40 | * @{ 41 | */ 42 | 43 | /** @defgroup USBH_CONF_Exported_Defines 44 | * @{ 45 | */ 46 | 47 | #define USBH_MAX_NUM_ENDPOINTS 2 48 | #define USBH_MAX_NUM_INTERFACES 2 49 | #define USBH_MSC_MPS_SIZE 0x200 50 | 51 | /** 52 | * @} 53 | */ 54 | 55 | 56 | /** @defgroup USBH_CONF_Exported_Types 57 | * @{ 58 | */ 59 | /** 60 | * @} 61 | */ 62 | 63 | 64 | /** @defgroup USBH_CONF_Exported_Macros 65 | * @{ 66 | */ 67 | /** 68 | * @} 69 | */ 70 | 71 | /** @defgroup USBH_CONF_Exported_Variables 72 | * @{ 73 | */ 74 | /** 75 | * @} 76 | */ 77 | 78 | /** @defgroup USBH_CONF_Exported_FunctionsPrototype 79 | * @{ 80 | */ 81 | /** 82 | * @} 83 | */ 84 | 85 | 86 | #endif //__USBH_CONF__H__ 87 | 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** 94 | * @} 95 | */ 96 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 97 | 98 | -------------------------------------------------------------------------------- /drivers/keyboard/usb/usbh_usr.h: -------------------------------------------------------------------------------- 1 | 2 | /* Define to prevent recursive inclusion -------------------------------------*/ 3 | #ifndef __USH_USR_H__ 4 | #define __USH_USR_H__ 5 | 6 | 7 | /* Includes ------------------------------------------------------------------*/ 8 | #include "usbh_core.h" 9 | //#include "usbh_usr_lcd.h" 10 | #include "usb_conf.h" 11 | #include 12 | 13 | 14 | extern USBH_Usr_cb_TypeDef USR_Callbacks; 15 | 16 | // Keyboard Status 17 | typedef struct KeyBoardStatus 18 | { 19 | // UI public state 20 | uchar old_state; 21 | uchar new_state; 22 | 23 | // Edit mode 24 | uchar set_mode; 25 | 26 | // Last key pressed value 27 | uchar last_char; 28 | 29 | uchar edit_item_id; 30 | uchar edit_item_hor; 31 | 32 | uchar item_0[16]; 33 | uchar item_1[16]; 34 | uchar item_2[16]; 35 | 36 | } KeyBoardStatus; 37 | 38 | 39 | void USBH_USR_ApplicationSelected(void); 40 | void USBH_USR_Init(void); 41 | void USBH_USR_DeInit(void); 42 | void USBH_USR_DeviceAttached(void); 43 | void USBH_USR_ResetDevice(void); 44 | void USBH_USR_DeviceDisconnected (void); 45 | void USBH_USR_OverCurrentDetected (void); 46 | void USBH_USR_DeviceSpeedDetected(uint8_t DeviceSpeed); 47 | void USBH_USR_Device_DescAvailable(void *); 48 | void USBH_USR_DeviceAddressAssigned(void); 49 | void USBH_USR_Configuration_DescAvailable(USBH_CfgDesc_TypeDef * cfgDesc, 50 | USBH_InterfaceDesc_TypeDef *itfDesc, 51 | USBH_EpDesc_TypeDef *epDesc); 52 | void USBH_USR_Manufacturer_String(void *); 53 | void USBH_USR_Product_String(void *); 54 | void USBH_USR_SerialNum_String(void *); 55 | void USBH_USR_EnumerationDone(void); 56 | USBH_USR_Status USBH_USR_UserInput(void); 57 | void USBH_USR_DeInit(void); 58 | void USBH_USR_DeviceNotSupported(void); 59 | void USBH_USR_UnrecoveredError(void); 60 | 61 | #endif 62 | 63 | -------------------------------------------------------------------------------- /drivers/ui/encoder/ui_rotary.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __UI_ROTARY_H 15 | #define __UI_ROTARY_H 16 | 17 | // Some encoders have detend and generate x 18 | // ammount of pulses per click 19 | #define USE_DETENTED_ENCODERS 20 | #define USE_DETENTED_VALUE 4 21 | 22 | // Protective band on top and bottom scale 23 | // dependent on encoder quality and debounce 24 | // capacitors 25 | #define ENCODER_FLICKR_BAND 4 26 | 27 | // Maximum pot value 28 | #define FREQ_ENCODER_RANGE 0xFFF 29 | 30 | // Divider to create non linearity 31 | #define FREQ_ENCODER_LOG_D 1 32 | 33 | // The UI checking function will skip 34 | // reading too often based on this value 35 | #define FREQ_UPDATE_SKIP 100 36 | 37 | // Frequency public structure 38 | typedef struct DialFrequency 39 | { 40 | // pot values 41 | // 42 | ulong value_old; // previous value 43 | ulong value_new; // most current value 44 | 45 | // SI570 actual frequency 46 | ulong tune_old; // previous value 47 | ulong tune_new; // most current value 48 | 49 | // Current tunning step 50 | ulong tunning_step; // selected step by user 51 | ulong selected_idx; // id of step 52 | ulong last_tune_step; // last tunning step used during dial rotation 53 | ulong step_new; // Eth driver req step 54 | 55 | // First OSC frequency 56 | ulong transv_freq; 57 | 58 | ulong update_skip; 59 | 60 | // Shift used on TX 61 | //int tx_shift; 62 | 63 | // TCXO routine factor/flag 64 | int temp_factor; 65 | uchar temp_enabled; 66 | 67 | uchar de_detent; // sw de-detent flag 68 | 69 | // Virtual segments 70 | uchar dial_010_mhz; 71 | uchar dial_001_mhz; 72 | uchar dial_100_khz; 73 | uchar dial_010_khz; 74 | uchar dial_001_khz; 75 | uchar dial_100_hz; 76 | uchar dial_010_hz; 77 | uchar dial_001_hz; 78 | 79 | // Second display 80 | uchar sdial_010_mhz; 81 | uchar sdial_001_mhz; 82 | uchar sdial_100_khz; 83 | uchar sdial_010_khz; 84 | uchar sdial_001_khz; 85 | uchar sdial_100_hz; 86 | uchar sdial_010_hz; 87 | uchar sdial_001_hz; 88 | 89 | } DialFrequency; 90 | 91 | // -------------------------------- 92 | // Maximum pot value 93 | #define ENCODER_ONE_RANGE 0xFFF 94 | 95 | // Divider to create non linearity 96 | #define ENCODER_ONE_LOG_D 1 97 | 98 | // Audio Gain public structure 99 | typedef struct EncoderOneSelection 100 | { 101 | // pot values 102 | // 103 | ulong value_old; // previous value 104 | ulong value_new; // most current value 105 | uchar de_detent; // sw de-detent flag 106 | 107 | } EncoderOneSelection; 108 | 109 | // -------------------------------- 110 | // Maximum pot value 111 | #define ENCODER_TWO_RANGE 0xFFF 112 | 113 | // Divider to create non linearity 114 | #define ENCODER_TWO_LOG_D 1 115 | 116 | // Audio Gain public structure 117 | typedef struct EncoderTwoSelection 118 | { 119 | // pot values 120 | // 121 | ulong value_old; // previous value 122 | ulong value_new; // most current value 123 | uchar de_detent; // sw de-detent flag 124 | 125 | } EncoderTwoSelection; 126 | 127 | // -------------------------------- 128 | // Maximum pot value 129 | #define ENCODER_THR_RANGE 0xFFF 130 | 131 | // Divider to create non linearity 132 | #define ENCODER_THR_LOG_D 1 133 | 134 | // FIR selector public structure 135 | typedef struct EncoderThreeSelection 136 | { 137 | // pot values 138 | // 139 | ulong value_old; // previous value 140 | ulong value_new; // most current value 141 | uchar de_detent; // sw de-detent flag 142 | 143 | } EncoderThreeSelection; 144 | 145 | void UiRotaryFreqEncoderInit(void); 146 | void UiRotaryEncoderOneInit(void); 147 | void UiRotaryEncoderTwoInit(void); 148 | void UiRotaryEncoderThreeInit(void); 149 | 150 | #endif 151 | -------------------------------------------------------------------------------- /drivers/ui/lcd/ui_lcd_hy28.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imoldovavan/mcHF-SDR/bcea073d9a38cdf3e094dce6d81657797a0b415a/drivers/ui/lcd/ui_lcd_hy28.c -------------------------------------------------------------------------------- /drivers/ui/lcd/ui_lcd_hy28.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __UI_LCD_HY28_H 15 | #define __UI_LCD_HY28_H 16 | 17 | #include "arm_math.h" 18 | #include "math.h" 19 | #include "ui_driver.h" 20 | 21 | #define MAX_X 320 22 | #define MAX_Y 320 23 | 24 | #define SPI_START (0x70) /* Start byte for SPI transfer */ 25 | #define SPI_RD (0x01) /* WR bit 1 within start */ 26 | #define SPI_WR (0x00) /* WR bit 0 within start */ 27 | #define SPI_DATA (0x02) /* RS bit 1 within start byte */ 28 | #define SPI_INDEX (0x00) /* RS bit 0 within start byte */ 29 | 30 | #define RGB(red,green,blue)(uint16_t)(((red>>3)<<11)|((green>>2)<<5)|(blue>> 3)) 31 | 32 | // Colors definitions, go to http://www.color-hex.com/ 33 | // choose a new one and declare here 34 | // 35 | #define White 0xFFFF 36 | #define Black 0x0000 37 | #define Grey 0xBDF5 38 | #define Blue 0x001F 39 | #define Blue2 0x051F 40 | #define Red 0xF800 41 | #define Magenta 0xF81F 42 | #define Green 0x07E0 43 | #define Cyan 0x7FFF 44 | #define Yellow 0xFFE0 45 | 46 | #define Orange RGB(0xF6,0xA0,0x1A) 47 | #define Cream RGB(0xED,0xE7,0xD7) 48 | 49 | #define Grey1 RGB(0x80,0x80,0x80) 50 | #define Grey2 RGB(0xC0,0xC0,0xC0) 51 | #define Grey3 RGB(0xA6,0xA8,0xAD) 52 | 53 | #define Grid RGB(COL_SPECTRUM_GRAD,COL_SPECTRUM_GRAD,COL_SPECTRUM_GRAD) 54 | 55 | #define LCD_DIR_HORIZONTAL 0x0000 56 | #define LCD_DIR_VERTICAL 0x0001 57 | 58 | #define GRADIENT_STEP 8 59 | 60 | // ---------------------------------------------------------- 61 | // Spectrum draw params 62 | // 63 | // Little bit right of control border 64 | #define SPECTRUM_START_X (POS_SPECTRUM_IND_X + 2) 65 | // 66 | // Shift of whole spectrum in vertical direction 67 | #define SPECTRUM_START_Y (POS_SPECTRUM_IND_Y - 10) 68 | // 69 | // Spectrum hight is bit lower that the whole control 70 | #define SPECTRUM_HEIGHT (POS_SPECTRUM_IND_H - 10) 71 | // 72 | // Dependent on FFT samples,but should be less than control width! 73 | #define SPECTRUM_WIDTH 256 74 | // ---------------------------------------------------------- 75 | 76 | #define LCD_REG (*((volatile unsigned short *) 0x60000000)) 77 | #define LCD_RAM (*((volatile unsigned short *) 0x60020000)) 78 | 79 | // ---------------------------------------------------------- 80 | // Dual purpose pins (parallel + serial) 81 | #define LCD_D11 LCD_CS 82 | #define LCD_D11_SOURCE LCD_CS_SOURCE 83 | #define LCD_D11_PIO LCD_CS_PIO 84 | 85 | // ---------------------------------------------------------- 86 | 87 | void UiLcdHy28_LcdClear(ushort Color); 88 | void UiLcdHy28_PrintText(ushort Xpos, ushort Ypos, char *str,ushort Color, ushort bkColor,uchar font); 89 | 90 | void UiLcdHy28_DrawStraightLine(ushort Xpos, ushort Ypos, ushort Length, uchar Direction,ushort color); 91 | void UiLcdHy28_DrawHorizLineWithGrad(ushort Xpos, ushort Ypos, ushort Length,ushort gradient_start); 92 | 93 | void UiLcdHy28_DrawEmptyRect(ushort Xpos, ushort Ypos, ushort Height, ushort Width, ushort color); 94 | void UiLcdHy28_DrawBottomButton(ushort Xpos, ushort Ypos, ushort Height, ushort Width,ushort color); 95 | void UiLcdHy28_DrawFullRect (ushort Xpos, ushort Ypos, ushort Height, ushort Width, ushort color); 96 | 97 | void UiLcdHy28_DrawSpectrum(q15_t *fft,ushort color,ushort shift); 98 | 99 | void UiLcdHy28_Test(void); 100 | uchar UiLcdHy28_Init(void); 101 | 102 | void UiLcdHy28_ShowStartUpScreen(ulong hold_time); 103 | 104 | #endif 105 | -------------------------------------------------------------------------------- /drivers/ui/lcd/ui_lcd_hy28_fonts.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __UI_LCD_HY28_FONTS_H 15 | #define __UI_LCD_HY28_FONTS_H 16 | 17 | typedef struct tFont 18 | { 19 | const unsigned short *table; 20 | unsigned short Width; 21 | unsigned short Height; 22 | } sFONT; 23 | 24 | #endif 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /drivers/ui/misc/hamm_wnd.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __HAMM_WND_H 15 | #define __HAMM_WND_H 16 | 17 | 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /drivers/ui/oscillator/ui_si570.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __UI_SI570 15 | #define __UI_SI570 16 | 17 | #define HIGHER_PRECISION 18 | //#define LOWER_PRECISION 19 | 20 | // ------------------------------------------------------------------------------------- 21 | // Local Oscillator 22 | // ------------------ 23 | #define SI570_ADDRESS (0x55 << 1) // R/W bit = LSB 24 | 25 | #define SI570_MIN_FREQ 10000000 // 2.5 Mhz 26 | #define SI570_MAX_FREQ 120000000 // 30 Mhz 27 | 28 | #define SI570_RECALL (1<<0) 29 | #define SI570_FREEZE_DCO (1<<4) 30 | #define SI570_FREEZE_M (1<<5) 31 | #define SI570_NEW_FREQ (1<<6) 32 | 33 | #define SI570_REG_7 7 34 | #define SI570_REG_135 135 35 | #define SI570_REG_137 137 36 | 37 | // Enter in the Startup frequency 38 | #define FOUT_START_UP 56.32 // MHz 39 | #define FACTORY_FXTAL 114.285 40 | 41 | // VCO range 42 | #define FDCO_MAX 5670 43 | #define FDCO_MIN 4850 44 | 45 | #define POW_2_28 268435456.0 46 | // ------------------------------------------------------------------------------------- 47 | // Temperature sensor 48 | // ------------------ 49 | #define MCP_ADDR (0x90) 50 | 51 | // MCP registers 52 | #define MCP_TEMP (0x00) 53 | #define MCP_CONFIG (0x01) 54 | #define MCP_HYSTR (0x02) 55 | #define MCP_LIMIT (0x03) 56 | 57 | // MCP CONFIG register bits 58 | #define MCP_ONE_SHOT (7) 59 | #define MCP_ADC_RES (5) 60 | #define MCP_FAULT_QUEUE (3) 61 | #define MCP_ALERT_POL (2) 62 | #define MCP_INT_MODE (1) 63 | #define MCP_SHUTDOWN (0) 64 | #define R_BIT (1) 65 | #define W_BIT (0) 66 | 67 | #define MCP_ADC_RES_9 0 68 | #define MCP_ADC_RES_10 1 69 | #define MCP_ADC_RES_11 2 70 | #define MCP_ADC_RES_12 3 71 | 72 | #define MCP_POWER_UP 0 73 | #define MCP_POWER_DOWN 1 74 | 75 | typedef struct OscillatorState 76 | { 77 | long double rfreq; 78 | long double rfreq_old; 79 | 80 | float fxtal; 81 | 82 | uchar regs[6]; 83 | 84 | #ifdef LOWER_PRECISION 85 | uchar init_n1; 86 | uchar init_hsdiv; 87 | ulong init_rfreq; 88 | #endif 89 | 90 | } OscillatorState; 91 | 92 | // ------------------------------------------------------------------------------------- 93 | // Exports 94 | // ------------------ 95 | 96 | uchar ui_si570_get_configuration(void); 97 | uchar ui_si570_set_frequency(ulong freq,int calib,int temp_factor); 98 | 99 | uchar ui_si570_init_temp_sensor(void); 100 | uchar ui_si570_read_temp(int *temp); 101 | void ui_si570_conv_temp(uchar *temp,int *dtemp); 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /drivers/ui/oscillator/ui_soft_tcxo.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | // 15 | // SI570 frequency shift table 16 | // 0-100 degrees C range 17 | // shots from 20m band (56Mhz) 18 | // 19 | short tcxo_table_20m[100] = 20 | { 21 | -1, // 0 C 22 | -1, // 1 C 23 | -1, // 2 C 24 | -1, // 3 C 25 | -1, // 4 C 26 | -1, // 5 C 27 | -1, // 6 C 28 | -1, // 7 C 29 | -1, // 8 C 30 | -1, // 9 C 31 | -1, // 10 C 32 | -1, // 11 C 33 | -1, // 12 C 34 | -1, // 13 C 35 | -1, // 14 C 36 | -1, // 15 C 37 | -1, // 16 C 38 | -1, // 17 C 39 | -1, // 18 C 40 | -1, // 19 C 41 | -250, // 20 C 42 | -191, // 21 C 43 | -135, // 22 C 44 | -87, // 23 C 45 | -51, // 24 C 46 | -20, // 25 C 47 | 19, // 26 C 48 | 49, // 27 C 49 | 79, // 28 C 50 | 106, // 29 C 51 | 129, // 30 C 52 | 152, // 31 C 53 | 175, // 32 C 54 | 202, // 33 C 55 | 223, // 34 C 56 | 239, // 35 C 57 | 264, // 36 C 58 | 282, // 37 C 59 | 301, // 38 C 60 | 316, // 39 C 61 | 340, // 40 C 62 | 367, // 41 C 63 | 385, // 42 C 64 | 403, // 43 C 65 | 418, // 44 C 66 | 434, // 45 C 67 | 450, // 46 C 68 | 461, // 47 C 69 | 484, // 48 C 70 | 495, // 49 C 71 | 507, // 50 C 72 | 515, // 51 C 73 | 525, // 52 C 74 | 536, // 53 C 75 | 542, // 54 C 76 | 546, // 55 C 77 | 549, // 56 C 78 | 556, // 57 C 79 | 559, // 58 C 80 | 560, // 59 C 81 | 561, // 60 C 82 | -1, // 61 C 83 | -1, // 62 C 84 | -1, // 63 C 85 | -1, // 64 C 86 | -1, // 65 C 87 | -1, // 67 C 88 | -1, // 68 C 89 | -1, // 69 C 90 | -1, // 70 C 91 | -1, // 71 C 92 | -1, // 72 C 93 | -1, // 73 C 94 | -1, // 74 C 95 | -1, // 75 C 96 | -1, // 76 C 97 | -1, // 77 C 98 | -1, // 78 C 99 | -1, // 79 C 100 | -1, // 80 C 101 | -1, // 81 C 102 | -1, // 82 C 103 | -1, // 83 C 104 | -1, // 84 C 105 | -1, // 85 C 106 | -1, // 86 C 107 | -1, // 87 C 108 | -1, // 88 C 109 | -1, // 89 C 110 | -1, // 90 C 111 | -1, // 91 C 112 | -1, // 92 C 113 | -1, // 93 C 114 | -1, // 94 C 115 | -1, // 95 C 116 | -1, // 96 C 117 | -1, // 97 C 118 | -1, // 98 C 119 | -1, // 99 C 120 | -1 // 100C 121 | }; 122 | -------------------------------------------------------------------------------- /firmware.cob.bak: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /firmware_Target.comarker: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /hardware/mchf_hw_i2c.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __MCHF_HW_I2C_H 15 | #define __MCHF_HW_I2C_H 16 | 17 | void mchf_hw_i2c_init(void); 18 | void mchf_hw_i2c_reset(void); 19 | 20 | uchar mchf_hw_i2c_WriteRegister(uchar I2CAddr,uchar RegisterAddr, uchar RegisterValue); 21 | uchar mchf_hw_i2c_WriteBlock(uchar I2CAddr,uchar RegisterAddr, uchar *data,ulong size); 22 | uchar mchf_hw_i2c_ReadRegister (uchar I2CAddr,uchar RegisterAddr, uchar *RegisterValue); 23 | uchar mchf_hw_i2c_ReadData(uchar I2CAddr,uchar RegisterAddr, uchar *data, ulong size); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /hardware/mchf_hw_i2c2.c: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | // Common 15 | #include "mchf_board.h" 16 | 17 | #include "mchf_hw_i2c2.h" 18 | 19 | #define I2C2_FLAG_TIMEOUT ((uint32_t)0x500) 20 | #define I2C2_LONG_TIMEOUT ((uint32_t)(300 * I2C2_FLAG_TIMEOUT)) 21 | 22 | #define I2C2_SPEED 25000 23 | 24 | // I2C peripheral configuration defines (control interface of the si570) 25 | #define CODEC_I2C I2C2 26 | #define I2C2_CLK RCC_APB1Periph_I2C2 27 | #define CODEC_I2C_GPIO_AF GPIO_AF_I2C2 28 | 29 | __IO uint32_t I2C2_Timeout = I2C2_LONG_TIMEOUT; 30 | 31 | //*---------------------------------------------------------------------------- 32 | //* Function Name : mchf_hw_i2c2_init 33 | //* Object : 34 | //* Object : 35 | //* Input Parameters : 36 | //* Output Parameters : 37 | //* Functions called : 38 | //*---------------------------------------------------------------------------- 39 | void mchf_hw_i2c2_init(void) 40 | { 41 | GPIO_InitTypeDef GPIO_InitStructure; 42 | I2C_InitTypeDef I2C_InitStructure; 43 | 44 | // CODEC_I2C SCL and SDA pins configuration 45 | GPIO_InitStructure.GPIO_Pin = I2C2_SCL_PIN|I2C2_SDA_PIN; 46 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; 47 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_25MHz; 48 | GPIO_InitStructure.GPIO_OType = GPIO_OType_OD; 49 | 50 | GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; // we also have ext pullups 51 | GPIO_Init(I2C2_SCL_GPIO, &GPIO_InitStructure); 52 | 53 | // Connect pins to I2C peripheral 54 | GPIO_PinAFConfig(I2C2_SCL_GPIO, I2C2_SCL_PINSRC, CODEC_I2C_GPIO_AF); 55 | GPIO_PinAFConfig(I2C2_SDA_GPIO, I2C2_SDA_PINSRC, CODEC_I2C_GPIO_AF); 56 | 57 | // Enable the CODEC_I2C peripheral clock 58 | RCC_APB1PeriphClockCmd(I2C2_CLK, ENABLE); 59 | 60 | // CODEC_I2C peripheral configuration 61 | I2C_DeInit(CODEC_I2C); 62 | I2C_InitStructure.I2C_Mode = I2C_Mode_I2C; 63 | I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2; 64 | I2C_InitStructure.I2C_OwnAddress1 = 0x33; 65 | I2C_InitStructure.I2C_Ack = I2C_Ack_Enable; 66 | I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit; 67 | I2C_InitStructure.I2C_ClockSpeed = I2C2_SPEED; 68 | 69 | // Enable the I2C peripheral 70 | I2C_Cmd (CODEC_I2C, ENABLE); 71 | I2C_Init(CODEC_I2C, &I2C_InitStructure); 72 | } 73 | 74 | //*---------------------------------------------------------------------------- 75 | //* Function Name : mchf_hw_i2c2_WriteRegister 76 | //* Object : 77 | //* Object : 78 | //* Input Parameters : 79 | //* Output Parameters : 80 | //* Functions called : 81 | //*---------------------------------------------------------------------------- 82 | uchar mchf_hw_i2c2_WriteRegister(uchar I2CAddr,uchar RegisterAddr, uchar RegisterValue) 83 | { 84 | //printf("i2c write 0x%02x\n\r",I2CAddr); 85 | 86 | // While the bus is busy 87 | I2C2_Timeout = I2C2_LONG_TIMEOUT; 88 | while(I2C_GetFlagStatus(CODEC_I2C, I2C_FLAG_BUSY)) 89 | { 90 | if((I2C2_Timeout--) == 0) 91 | return 1; 92 | } 93 | 94 | // Start the config sequence 95 | I2C_GenerateSTART(CODEC_I2C, ENABLE); 96 | 97 | // Test on EV5 and clear it 98 | I2C2_Timeout = I2C2_FLAG_TIMEOUT; 99 | while (!I2C_CheckEvent(CODEC_I2C, I2C_EVENT_MASTER_MODE_SELECT)) 100 | { 101 | if((I2C2_Timeout--) == 0) 102 | return 2; 103 | } 104 | 105 | // Transmit the slave address and enable writing operation 106 | I2C_Send7bitAddress(CODEC_I2C, I2CAddr, I2C_Direction_Transmitter); 107 | 108 | // Test on EV6 and clear it 109 | I2C2_Timeout = I2C2_FLAG_TIMEOUT; 110 | while (!I2C_CheckEvent(CODEC_I2C, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)) 111 | { 112 | if((I2C2_Timeout--) == 0) 113 | return 3; 114 | } 115 | 116 | // Transmit the first address for write operation 117 | I2C_SendData(CODEC_I2C, RegisterAddr); 118 | 119 | // Test on EV8 and clear it 120 | I2C2_Timeout = I2C2_FLAG_TIMEOUT; 121 | while (!I2C_CheckEvent(CODEC_I2C, I2C_EVENT_MASTER_BYTE_TRANSMITTING)) 122 | { 123 | if((I2C2_Timeout--) == 0) 124 | return 4; 125 | } 126 | 127 | // Prepare the register value to be sent 128 | I2C_SendData(CODEC_I2C, RegisterValue); 129 | 130 | // Wait till all data have been physically transferred on the bus 131 | I2C2_Timeout = I2C2_LONG_TIMEOUT; 132 | while(!I2C_GetFlagStatus(CODEC_I2C, I2C_FLAG_BTF)) 133 | { 134 | if((I2C2_Timeout--) == 0) 135 | return 5; 136 | } 137 | 138 | // End the configuration sequence 139 | I2C_GenerateSTOP(CODEC_I2C, ENABLE); 140 | 141 | // stop bit flag 142 | I2C2_Timeout = I2C2_FLAG_TIMEOUT; 143 | while(I2C_GetFlagStatus(CODEC_I2C, I2C_FLAG_STOPF)) 144 | { 145 | if((I2C2_Timeout--) == 0) 146 | return 6; 147 | } 148 | 149 | //printf("i2c write ok\n\r"); 150 | return 0; 151 | } 152 | -------------------------------------------------------------------------------- /hardware/mchf_hw_i2c2.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __MCHF_HW_I2C2_H 15 | #define __MCHF_HW_I2C2_H 16 | 17 | void mchf_hw_i2c2_init(void); 18 | uchar mchf_hw_i2c2_WriteRegister(uchar I2CAddr,uchar RegisterAddr, uchar RegisterValue); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /hardware/mchf_types.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | ** ** 3 | ** mcHF QRP Transceiver ** 4 | ** K Atanassov - M0NKA 2014 ** 5 | ** ** 6 | **---------------------------------------------------------------------------------** 7 | ** ** 8 | ** File name: ** 9 | ** Description: ** 10 | ** Last Modified: ** 11 | ** Licence: For radio amateurs experimentation, non-commercial use only! ** 12 | ************************************************************************************/ 13 | 14 | #ifndef __MCHF_TYPES_H 15 | #define __MCHF_TYPES_H 16 | 17 | #ifndef uchar 18 | typedef unsigned char uchar; 19 | #endif 20 | 21 | #ifndef ushort 22 | typedef unsigned short ushort; 23 | #endif 24 | 25 | #ifndef uint 26 | typedef unsigned int uint; 27 | #endif 28 | 29 | #ifndef ulong 30 | typedef unsigned long ulong; 31 | #endif 32 | 33 | #ifndef bool 34 | typedef int bool; 35 | #endif 36 | 37 | #ifndef true 38 | #define true 1 39 | #endif 40 | 41 | #ifndef false 42 | #define false 0 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /libs/libarm_cortexM4lf_math.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imoldovavan/mcHF-SDR/bcea073d9a38cdf3e094dce6d81657797a0b415a/libs/libarm_cortexM4lf_math.a -------------------------------------------------------------------------------- /libs/libc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imoldovavan/mcHF-SDR/bcea073d9a38cdf3e094dce6d81657797a0b415a/libs/libc.a -------------------------------------------------------------------------------- /libs/libg.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imoldovavan/mcHF-SDR/bcea073d9a38cdf3e094dce6d81657797a0b415a/libs/libg.a -------------------------------------------------------------------------------- /libs/libm.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imoldovavan/mcHF-SDR/bcea073d9a38cdf3e094dce6d81657797a0b415a/libs/libm.a -------------------------------------------------------------------------------- /link.ld: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") 2 | SEARCH_DIR(.) 3 | INCLUDE "memory.ld" 4 | 5 | /* Section Definitions */ 6 | SECTIONS 7 | { 8 | .text : 9 | { 10 | KEEP(*(.isr_vector .isr_vector.*)) 11 | *(.text .text.* .gnu.linkonce.t.*) 12 | *(.glue_7t) *(.glue_7) 13 | *(.rodata .rodata* .gnu.linkonce.r.*) 14 | } > rom 15 | 16 | .ARM.extab : 17 | { 18 | *(.ARM.extab* .gnu.linkonce.armextab.*) 19 | } > rom 20 | 21 | .ARM.exidx : 22 | { 23 | *(.ARM.exidx* .gnu.linkonce.armexidx.*) 24 | } > rom 25 | 26 | . = ALIGN(4); 27 | _etext = .; 28 | _sidata = .; 29 | 30 | .data : AT (_etext) 31 | { 32 | _sdata = .; 33 | *(.data .data.*) 34 | . = ALIGN(4); 35 | _edata = . ; 36 | } > ram 37 | 38 | /* .bss section which is used for uninitialized data */ 39 | .bss (NOLOAD) : 40 | { 41 | _sbss = . ; 42 | *(.bss .bss.*) 43 | *(COMMON) 44 | . = ALIGN(4); 45 | _ebss = . ; 46 | } > ram 47 | 48 | /* stack section */ 49 | .co_stack (NOLOAD): 50 | { 51 | . = ALIGN(8); 52 | *(.co_stack .co_stack.*) 53 | } > ram 54 | 55 | . = ALIGN(4); 56 | _end = . ; 57 | } -------------------------------------------------------------------------------- /memory.ld: -------------------------------------------------------------------------------- 1 | /** 2 | ******************************************************************* 3 | * Chip: STM32F407VG 4 | * NOTE: This file is generated by CoIDE and Included by *link.ld 5 | * It is used to describe which memory regions may be used 6 | * by the linker. 7 | ******************************************************************* 8 | * Internal memory map 9 | * Region Start Size 10 | * flash0 0x08000000 0x00100000 11 | * sram0 0x20000000 0x00020000 12 | * sram1 0x10000000 0x00010000 13 | ******************************************************************* 14 | */ 15 | 16 | MEMORY 17 | { 18 | rom (rx) : ORIGIN = 0x08000000, LENGTH = 0x00100000 19 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00020000 20 | ram1 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x00010000 21 | } 22 | 23 | _eram = 0x20000000 + 0x00020000; -------------------------------------------------------------------------------- /misc/v_eprom/eeprom.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file EEPROM_Emulation/inc/eeprom.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 10-October-2011 7 | * @brief This file contains all the functions prototypes for the EEPROM 8 | * emulation firmware library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __EEPROM_H 25 | #define __EEPROM_H 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32f4xx.h" 29 | 30 | /* Exported constants --------------------------------------------------------*/ 31 | /* Define the size of the sectors to be used */ 32 | #define PAGE_SIZE (uint32_t)0x4000 /* Page size = 16KByte */ 33 | 34 | /* Device voltage range supposed to be [2.7V to 3.6V], the operation will 35 | be done by word */ 36 | #define VOLTAGE_RANGE (uint8_t)VoltageRange_3 37 | 38 | /* EEPROM start address in Flash */ 39 | #define EEPROM_START_ADDRESS ((uint32_t)0x08008000) /* EEPROM emulation start address: 40 | from sector2 : after 16KByte of used 41 | Flash memory */ 42 | 43 | /* Pages 0 and 1 base and end addresses */ 44 | #define PAGE0_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x0000)) 45 | #define PAGE0_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (PAGE_SIZE - 1))) 46 | #define PAGE0_ID FLASH_Sector_2 47 | 48 | #define PAGE1_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x4000)) 49 | #define PAGE1_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (2 * PAGE_SIZE - 1))) 50 | #define PAGE1_ID FLASH_Sector_3 51 | 52 | /* Used Flash pages for EEPROM emulation */ 53 | #define PAGE0 ((uint16_t)0x0000) 54 | #define PAGE1 ((uint16_t)0x0001) 55 | 56 | /* No valid page define */ 57 | #define NO_VALID_PAGE ((uint16_t)0x00AB) 58 | 59 | /* Page status definitions */ 60 | #define ERASED ((uint16_t)0xFFFF) /* Page is empty */ 61 | #define RECEIVE_DATA ((uint16_t)0xEEEE) /* Page is marked to receive data */ 62 | #define VALID_PAGE ((uint16_t)0x0000) /* Page containing valid data */ 63 | 64 | /* Valid pages in read and write defines */ 65 | #define READ_FROM_VALID_PAGE ((uint8_t)0x00) 66 | #define WRITE_IN_VALID_PAGE ((uint8_t)0x01) 67 | 68 | /* Page full define */ 69 | #define PAGE_FULL ((uint8_t)0x80) 70 | 71 | /* Variables' number */ 72 | #define NB_OF_VAR ((uint8_t)0x15) 73 | 74 | #define VAR_ADDR_1 0xAA01 75 | #define VAR_ADDR_2 0xAA02 76 | #define VAR_ADDR_3 0xAA03 77 | #define VAR_ADDR_4 0xAA04 78 | #define VAR_ADDR_5 0xAA05 79 | #define VAR_ADDR_6 0xAA06 80 | #define VAR_ADDR_7 0xAA07 81 | #define VAR_ADDR_8 0xAA08 82 | #define VAR_ADDR_9 0xAA09 83 | #define VAR_ADDR_10 0xAA0A 84 | #define VAR_ADDR_11 0xAA0B 85 | #define VAR_ADDR_12 0xAA0C 86 | #define VAR_ADDR_13 0xAA0D 87 | #define VAR_ADDR_14 0xAA0E 88 | #define VAR_ADDR_15 0xAA0F 89 | #define VAR_ADDR_16 0xAA10 90 | #define VAR_ADDR_17 0xAA11 91 | #define VAR_ADDR_18 0xAA12 92 | #define VAR_ADDR_19 0xAA13 93 | #define VAR_ADDR_20 0xAA14 94 | #define VAR_ADDR_21 0xAA15 95 | 96 | /* Exported types ------------------------------------------------------------*/ 97 | /* Exported macro ------------------------------------------------------------*/ 98 | /* Exported functions ------------------------------------------------------- */ 99 | uint16_t EE_Init(void); 100 | uint16_t EE_ReadVariable(uint16_t VirtAddress, uint16_t* Data); 101 | uint16_t EE_WriteVariable(uint16_t VirtAddress, uint16_t Data); 102 | 103 | #endif /* __EEPROM_H */ 104 | 105 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 106 | -------------------------------------------------------------------------------- /syscalls/syscalls.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************//***** 2 | * @file stdio.c 3 | * @brief Implementation of newlib syscall 4 | ********************************************************************************/ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #undef errno 12 | extern int errno; 13 | extern int _end; 14 | 15 | caddr_t _sbrk ( int incr ) 16 | { 17 | static unsigned char *heap = NULL; 18 | unsigned char *prev_heap; 19 | 20 | if (heap == NULL) { 21 | heap = (unsigned char *)&_end; 22 | } 23 | prev_heap = heap; 24 | 25 | heap += incr; 26 | 27 | return (caddr_t) prev_heap; 28 | } 29 | 30 | int link(char *old, char *new) { 31 | return -1; 32 | } 33 | 34 | int _close(int file) 35 | { 36 | return -1; 37 | } 38 | 39 | int _fstat(int file, struct stat *st) 40 | { 41 | st->st_mode = S_IFCHR; 42 | return 0; 43 | } 44 | 45 | int _isatty(int file) 46 | { 47 | return 1; 48 | } 49 | 50 | int _lseek(int file, int ptr, int dir) 51 | { 52 | return 0; 53 | } 54 | 55 | int _read(int file, char *ptr, int len) 56 | { 57 | return 0; 58 | } 59 | 60 | int _write(int file, char *ptr, int len) 61 | { 62 | return len; 63 | } 64 | 65 | void abort(void) 66 | { 67 | /* Abort called */ 68 | while(1); 69 | } 70 | 71 | /* --------------------------------- End Of File ------------------------------ */ 72 | -------------------------------------------------------------------------------- /usb/otg/inc/usb_dcd.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_dcd.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief Peripheral Driver Header file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __DCD_H__ 30 | #define __DCD_H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_core.h" 34 | 35 | 36 | /** @addtogroup USB_OTG_DRIVER 37 | * @{ 38 | */ 39 | 40 | /** @defgroup USB_DCD 41 | * @brief This file is the 42 | * @{ 43 | */ 44 | 45 | 46 | /** @defgroup USB_DCD_Exported_Defines 47 | * @{ 48 | */ 49 | #define USB_OTG_EP_CONTROL 0 50 | #define USB_OTG_EP_ISOC 1 51 | #define USB_OTG_EP_BULK 2 52 | #define USB_OTG_EP_INT 3 53 | #define USB_OTG_EP_MASK 3 54 | 55 | /* Device Status */ 56 | #define USB_OTG_DEFAULT 1 57 | #define USB_OTG_ADDRESSED 2 58 | #define USB_OTG_CONFIGURED 3 59 | #define USB_OTG_SUSPENDED 4 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | 66 | /** @defgroup USB_DCD_Exported_Types 67 | * @{ 68 | */ 69 | /******************************************************************************** 70 | Data structure type 71 | ********************************************************************************/ 72 | typedef struct 73 | { 74 | uint8_t bLength; 75 | uint8_t bDescriptorType; 76 | uint8_t bEndpointAddress; 77 | uint8_t bmAttributes; 78 | uint16_t wMaxPacketSize; 79 | uint8_t bInterval; 80 | } 81 | EP_DESCRIPTOR , *PEP_DESCRIPTOR; 82 | 83 | /** 84 | * @} 85 | */ 86 | 87 | 88 | /** @defgroup USB_DCD_Exported_Macros 89 | * @{ 90 | */ 91 | /** 92 | * @} 93 | */ 94 | 95 | /** @defgroup USB_DCD_Exported_Variables 96 | * @{ 97 | */ 98 | /** 99 | * @} 100 | */ 101 | 102 | /** @defgroup USB_DCD_Exported_FunctionsPrototype 103 | * @{ 104 | */ 105 | /******************************************************************************** 106 | EXPORTED FUNCTION FROM THE USB-OTG LAYER 107 | ********************************************************************************/ 108 | void DCD_Init(USB_OTG_CORE_HANDLE *pdev , 109 | USB_OTG_CORE_ID_TypeDef coreID); 110 | 111 | void DCD_DeInit(USB_OTG_CORE_HANDLE *pdev); 112 | 113 | void DCD_DevConnect (USB_OTG_CORE_HANDLE *pdev); 114 | void DCD_DevDisconnect (USB_OTG_CORE_HANDLE *pdev); 115 | void DCD_EP_SetAddress (USB_OTG_CORE_HANDLE *pdev, 116 | uint8_t address); 117 | uint32_t DCD_EP_Open(USB_OTG_CORE_HANDLE *pdev , 118 | uint8_t ep_addr, 119 | uint16_t ep_mps, 120 | uint8_t ep_type); 121 | 122 | uint32_t DCD_EP_Close (USB_OTG_CORE_HANDLE *pdev, 123 | uint8_t ep_addr); 124 | 125 | 126 | uint32_t DCD_EP_PrepareRx ( USB_OTG_CORE_HANDLE *pdev, 127 | uint8_t ep_addr, 128 | uint8_t *pbuf, 129 | uint16_t buf_len); 130 | 131 | uint32_t DCD_EP_Tx (USB_OTG_CORE_HANDLE *pdev, 132 | uint8_t ep_addr, 133 | uint8_t *pbuf, 134 | uint32_t buf_len); 135 | uint32_t DCD_EP_Stall (USB_OTG_CORE_HANDLE *pdev, 136 | uint8_t epnum); 137 | uint32_t DCD_EP_ClrStall (USB_OTG_CORE_HANDLE *pdev, 138 | uint8_t epnum); 139 | uint32_t DCD_EP_Flush (USB_OTG_CORE_HANDLE *pdev, 140 | uint8_t epnum); 141 | uint32_t DCD_Handle_ISR(USB_OTG_CORE_HANDLE *pdev); 142 | 143 | uint32_t DCD_GetEPStatus(USB_OTG_CORE_HANDLE *pdev , 144 | uint8_t epnum); 145 | 146 | void DCD_SetEPStatus (USB_OTG_CORE_HANDLE *pdev , 147 | uint8_t epnum , 148 | uint32_t Status); 149 | 150 | /** 151 | * @} 152 | */ 153 | 154 | 155 | #endif //__DCD_H__ 156 | 157 | 158 | /** 159 | * @} 160 | */ 161 | 162 | /** 163 | * @} 164 | */ 165 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 166 | 167 | -------------------------------------------------------------------------------- /usb/otg/inc/usb_dcd_int.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_dcd_int.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief Peripheral Device Interface Layer 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef USB_DCD_INT_H__ 30 | #define USB_DCD_INT_H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_dcd.h" 34 | 35 | 36 | 37 | /** @addtogroup USB_OTG_DRIVER 38 | * @{ 39 | */ 40 | 41 | /** @defgroup USB_DCD_INT 42 | * @brief This file is the 43 | * @{ 44 | */ 45 | 46 | 47 | /** @defgroup USB_DCD_INT_Exported_Defines 48 | * @{ 49 | */ 50 | 51 | typedef struct _USBD_DCD_INT 52 | { 53 | uint8_t (* DataOutStage) (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum); 54 | uint8_t (* DataInStage) (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum); 55 | uint8_t (* SetupStage) (USB_OTG_CORE_HANDLE *pdev); 56 | uint8_t (* SOF) (USB_OTG_CORE_HANDLE *pdev); 57 | uint8_t (* Reset) (USB_OTG_CORE_HANDLE *pdev); 58 | uint8_t (* Suspend) (USB_OTG_CORE_HANDLE *pdev); 59 | uint8_t (* Resume) (USB_OTG_CORE_HANDLE *pdev); 60 | uint8_t (* IsoINIncomplete) (USB_OTG_CORE_HANDLE *pdev); 61 | uint8_t (* IsoOUTIncomplete) (USB_OTG_CORE_HANDLE *pdev); 62 | 63 | uint8_t (* DevConnected) (USB_OTG_CORE_HANDLE *pdev); 64 | uint8_t (* DevDisconnected) (USB_OTG_CORE_HANDLE *pdev); 65 | 66 | }USBD_DCD_INT_cb_TypeDef; 67 | 68 | extern USBD_DCD_INT_cb_TypeDef *USBD_DCD_INT_fops; 69 | /** 70 | * @} 71 | */ 72 | 73 | 74 | /** @defgroup USB_DCD_INT_Exported_Types 75 | * @{ 76 | */ 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @defgroup USB_DCD_INT_Exported_Macros 82 | * @{ 83 | */ 84 | 85 | #define CLEAR_IN_EP_INTR(epnum,intr) \ 86 | diepint.d32=0; \ 87 | diepint.b.intr = 1; \ 88 | USB_OTG_WRITE_REG32(&pdev->regs.INEP_REGS[epnum]->DIEPINT,diepint.d32); 89 | 90 | #define CLEAR_OUT_EP_INTR(epnum,intr) \ 91 | doepint.d32=0; \ 92 | doepint.b.intr = 1; \ 93 | USB_OTG_WRITE_REG32(&pdev->regs.OUTEP_REGS[epnum]->DOEPINT,doepint.d32); 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /** @defgroup USB_DCD_INT_Exported_Variables 100 | * @{ 101 | */ 102 | /** 103 | * @} 104 | */ 105 | 106 | /** @defgroup USB_DCD_INT_Exported_FunctionsPrototype 107 | * @{ 108 | */ 109 | 110 | uint32_t USBD_OTG_ISR_Handler (USB_OTG_CORE_HANDLE *pdev); 111 | 112 | /** 113 | * @} 114 | */ 115 | 116 | 117 | #endif // USB_DCD_INT_H__ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** 124 | * @} 125 | */ 126 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 127 | 128 | -------------------------------------------------------------------------------- /usb/otg/inc/usb_hcd.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_hcd.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief Host layer Header file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_HCD_H__ 30 | #define __USB_HCD_H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_regs.h" 34 | #include "usb_core.h" 35 | 36 | 37 | /** @addtogroup USB_OTG_DRIVER 38 | * @{ 39 | */ 40 | 41 | /** @defgroup USB_HCD 42 | * @brief This file is the 43 | * @{ 44 | */ 45 | 46 | 47 | /** @defgroup USB_HCD_Exported_Defines 48 | * @{ 49 | */ 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @defgroup USB_HCD_Exported_Types 56 | * @{ 57 | */ 58 | /** 59 | * @} 60 | */ 61 | 62 | 63 | /** @defgroup USB_HCD_Exported_Macros 64 | * @{ 65 | */ 66 | /** 67 | * @} 68 | */ 69 | 70 | /** @defgroup USB_HCD_Exported_Variables 71 | * @{ 72 | */ 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup USB_HCD_Exported_FunctionsPrototype 78 | * @{ 79 | */ 80 | uint32_t HCD_Init (USB_OTG_CORE_HANDLE *pdev , 81 | USB_OTG_CORE_ID_TypeDef coreID); 82 | uint32_t HCD_HC_Init (USB_OTG_CORE_HANDLE *pdev , 83 | uint8_t hc_num); 84 | uint32_t HCD_SubmitRequest (USB_OTG_CORE_HANDLE *pdev , 85 | uint8_t hc_num) ; 86 | uint32_t HCD_GetCurrentSpeed (USB_OTG_CORE_HANDLE *pdev); 87 | uint32_t HCD_ResetPort (USB_OTG_CORE_HANDLE *pdev); 88 | uint32_t HCD_IsDeviceConnected (USB_OTG_CORE_HANDLE *pdev); 89 | uint32_t HCD_GetCurrentFrame (USB_OTG_CORE_HANDLE *pdev) ; 90 | URB_STATE HCD_GetURB_State (USB_OTG_CORE_HANDLE *pdev, uint8_t ch_num); 91 | uint32_t HCD_GetXferCnt (USB_OTG_CORE_HANDLE *pdev, uint8_t ch_num); 92 | HC_STATUS HCD_GetHCState (USB_OTG_CORE_HANDLE *pdev, uint8_t ch_num) ; 93 | /** 94 | * @} 95 | */ 96 | 97 | #endif //__USB_HCD_H__ 98 | 99 | 100 | /** 101 | * @} 102 | */ 103 | 104 | /** 105 | * @} 106 | */ 107 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 108 | 109 | -------------------------------------------------------------------------------- /usb/otg/inc/usb_hcd_int.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_hcd_int.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief Peripheral Device Interface Layer 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __HCD_INT_H__ 30 | #define __HCD_INT_H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_hcd.h" 34 | 35 | 36 | /** @addtogroup USB_OTG_DRIVER 37 | * @{ 38 | */ 39 | 40 | /** @defgroup USB_HCD_INT 41 | * @brief This file is the 42 | * @{ 43 | */ 44 | 45 | 46 | /** @defgroup USB_HCD_INT_Exported_Defines 47 | * @{ 48 | */ 49 | /** 50 | * @} 51 | */ 52 | 53 | 54 | /** @defgroup USB_HCD_INT_Exported_Types 55 | * @{ 56 | */ 57 | 58 | typedef struct _USBH_HCD_INT 59 | { 60 | uint8_t (* SOF) (USB_OTG_CORE_HANDLE *pdev); 61 | uint8_t (* DevConnected) (USB_OTG_CORE_HANDLE *pdev); 62 | uint8_t (* DevDisconnected) (USB_OTG_CORE_HANDLE *pdev); 63 | 64 | }USBH_HCD_INT_cb_TypeDef; 65 | 66 | extern USBH_HCD_INT_cb_TypeDef *USBH_HCD_INT_fops; 67 | /** 68 | * @} 69 | */ 70 | 71 | 72 | /** @defgroup USB_HCD_INT_Exported_Macros 73 | * @{ 74 | */ 75 | 76 | #define CLEAR_HC_INT(HC_REGS, intr) \ 77 | {\ 78 | USB_OTG_HCINTn_TypeDef hcint_clear; \ 79 | hcint_clear.d32 = 0; \ 80 | hcint_clear.b.intr = 1; \ 81 | USB_OTG_WRITE_REG32(&((HC_REGS)->HCINT), hcint_clear.d32);\ 82 | }\ 83 | 84 | #define MASK_HOST_INT_CHH(hc_num) { USB_OTG_HCINTMSK_TypeDef INTMSK; \ 85 | INTMSK.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK); \ 86 | INTMSK.b.chhltd = 0; \ 87 | USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK, INTMSK.d32);} 88 | 89 | #define UNMASK_HOST_INT_CHH(hc_num) { USB_OTG_HCINTMSK_TypeDef INTMSK; \ 90 | INTMSK.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK); \ 91 | INTMSK.b.chhltd = 1; \ 92 | USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK, INTMSK.d32);} 93 | 94 | #define MASK_HOST_INT_ACK(hc_num) { USB_OTG_HCINTMSK_TypeDef INTMSK; \ 95 | INTMSK.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK); \ 96 | INTMSK.b.ack = 0; \ 97 | USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK, GINTMSK.d32);} 98 | 99 | #define UNMASK_HOST_INT_ACK(hc_num) { USB_OTG_HCGINTMSK_TypeDef INTMSK; \ 100 | INTMSK.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK); \ 101 | INTMSK.b.ack = 1; \ 102 | USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK, INTMSK.d32);} 103 | 104 | /** 105 | * @} 106 | */ 107 | 108 | /** @defgroup USB_HCD_INT_Exported_Variables 109 | * @{ 110 | */ 111 | /** 112 | * @} 113 | */ 114 | 115 | /** @defgroup USB_HCD_INT_Exported_FunctionsPrototype 116 | * @{ 117 | */ 118 | /* Callbacks handler */ 119 | void ConnectCallback_Handler(USB_OTG_CORE_HANDLE *pdev); 120 | void Disconnect_Callback_Handler(USB_OTG_CORE_HANDLE *pdev); 121 | void Overcurrent_Callback_Handler(USB_OTG_CORE_HANDLE *pdev); 122 | uint32_t USBH_OTG_ISR_Handler (USB_OTG_CORE_HANDLE *pdev); 123 | 124 | /** 125 | * @} 126 | */ 127 | 128 | 129 | 130 | #endif //__HCD_INT_H__ 131 | 132 | 133 | /** 134 | * @} 135 | */ 136 | 137 | /** 138 | * @} 139 | */ 140 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 141 | 142 | -------------------------------------------------------------------------------- /usb/otg/inc/usb_otg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_otg.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief OTG Core Header 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_OTG__ 30 | #define __USB_OTG__ 31 | 32 | 33 | /** @addtogroup USB_OTG_DRIVER 34 | * @{ 35 | */ 36 | 37 | /** @defgroup USB_OTG 38 | * @brief This file is the 39 | * @{ 40 | */ 41 | 42 | 43 | /** @defgroup USB_OTG_Exported_Defines 44 | * @{ 45 | */ 46 | 47 | 48 | void USB_OTG_InitiateSRP(void); 49 | void USB_OTG_InitiateHNP(uint8_t state , uint8_t mode); 50 | //void USB_OTG_Switchback (USB_OTG_CORE_DEVICE *pdev); 51 | //uint32_t USB_OTG_GetCurrentState (USB_OTG_CORE_DEVICE *pdev); 52 | 53 | /** 54 | * @} 55 | */ 56 | 57 | 58 | /** @defgroup USB_OTG_Exported_Types 59 | * @{ 60 | */ 61 | /** 62 | * @} 63 | */ 64 | 65 | 66 | /** @defgroup USB_OTG_Exported_Macros 67 | * @{ 68 | */ 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @defgroup USB_OTG_Exported_Variables 74 | * @{ 75 | */ 76 | /** 77 | * @} 78 | */ 79 | 80 | /** @defgroup USB_OTG_Exported_FunctionsPrototype 81 | * @{ 82 | */ 83 | /** 84 | * @} 85 | */ 86 | 87 | 88 | #endif //__USB_OTG__ 89 | 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 99 | 100 | -------------------------------------------------------------------------------- /usb/usb_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_conf.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief General low level driver configuration 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_CONF__H__ 30 | #define __USB_CONF__H__ 31 | 32 | #include "mchf_board.h" 33 | 34 | #define USE_EMBEDDED_PHY 35 | 36 | /****************** USB OTG FS CONFIGURATION **********************************/ 37 | #define RX_FIFO_FS_SIZE 128 38 | #define TX0_FIFO_FS_SIZE 32 39 | #define TX1_FIFO_FS_SIZE 128 40 | #define TX2_FIFO_FS_SIZE 32 41 | #define TX3_FIFO_FS_SIZE 0 42 | 43 | /****************** USB OTG MISC CONFIGURATION ********************************/ 44 | //#define VBUS_SENSING_ENABLED 45 | 46 | /****************** USB OTG MODE CONFIGURATION ********************************/ 47 | #define USE_DEVICE_MODE 48 | #define USE_HOST_MODE 49 | 50 | //#define USE_USB_OTG_FS 51 | //#define USB_OTG_FS_CORE 52 | 53 | /****************** C Compilers dependant keywords ****************************/ 54 | /* In HS mode and when the DMA is used, all variables and data structures dealing 55 | with the DMA during the transaction process should be 4-bytes aligned */ 56 | #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED 57 | #if defined (__GNUC__) /* GNU Compiler */ 58 | #define __ALIGN_END __attribute__ ((aligned (4))) 59 | #define __ALIGN_BEGIN 60 | #else 61 | #define __ALIGN_END 62 | #if defined (__CC_ARM) /* ARM Compiler */ 63 | #define __ALIGN_BEGIN __align(4) 64 | #elif defined (__ICCARM__) /* IAR Compiler */ 65 | #define __ALIGN_BEGIN 66 | #elif defined (__TASKING__) /* TASKING Compiler */ 67 | #define __ALIGN_BEGIN __align(4) 68 | #endif /* __CC_ARM */ 69 | #endif /* __GNUC__ */ 70 | #else 71 | #define __ALIGN_BEGIN 72 | #define __ALIGN_END 73 | #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */ 74 | 75 | /* __packed keyword used to decrease the data type alignment to 1-byte */ 76 | #if defined (__CC_ARM) /* ARM Compiler */ 77 | #define __packed __packed 78 | #elif defined (__ICCARM__) /* IAR Compiler */ 79 | #define __packed __packed 80 | #elif defined ( __GNUC__ ) /* GNU Compiler */ 81 | #define __packed __attribute__ ((__packed__)) 82 | #elif defined (__TASKING__) /* TASKING Compiler */ 83 | #define __packed __unaligned 84 | #endif /* __CC_ARM */ 85 | 86 | #endif //__USB_CONF__H__ 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /usb/usbd/class/audio/inc/usbd_audio_out_if.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_audio_out_if.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief header file for the usbd_audio_out_if.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | 30 | #ifndef __USB_AUDIO_OUT_IF_H_ 31 | #define __USB_AUDIO_OUT_IF_H_ 32 | 33 | #ifdef STM32F2XX 34 | #include "stm322xg_usb_audio_codec.h" 35 | #elif defined(STM32F4XX) 36 | //! #include "stm324xg_usb_audio_codec.h" 37 | #elif defined(STM32F10X_CL) 38 | #include "stm3210c_usb_audio_codec.h" 39 | #endif /* STM32F2XX */ 40 | 41 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 42 | * @{ 43 | */ 44 | 45 | /** @defgroup usbd_audio 46 | * @brief This file is the Header file for USBD_audio.c 47 | * @{ 48 | */ 49 | 50 | 51 | /** @defgroup usbd_audio_Exported_Defines 52 | * @{ 53 | */ 54 | /* Audio Commands enmueration */ 55 | typedef enum 56 | { 57 | AUDIO_CMD_PLAY = 1, 58 | AUDIO_CMD_PAUSE, 59 | AUDIO_CMD_STOP, 60 | }AUDIO_CMD_TypeDef; 61 | 62 | /* Mute commands */ 63 | #define AUDIO_MUTE 0x01 64 | #define AUDIO_UNMUTE 0x00 65 | 66 | /* Functions return value */ 67 | #define AUDIO_OK 0x00 68 | #define AUDIO_FAIL 0xFF 69 | 70 | /* Audio Machine States */ 71 | #define AUDIO_STATE_INACTIVE 0x00 72 | #define AUDIO_STATE_ACTIVE 0x01 73 | #define AUDIO_STATE_PLAYING 0x02 74 | #define AUDIO_STATE_PAUSED 0x03 75 | #define AUDIO_STATE_STOPPED 0x04 76 | #define AUDIO_STATE_ERROR 0x05 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | 83 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 84 | * @{ 85 | */ 86 | /** 87 | * @} 88 | */ 89 | 90 | 91 | 92 | /** @defgroup USBD_CORE_Exported_Macros 93 | * @{ 94 | */ 95 | /** 96 | * @} 97 | */ 98 | 99 | /** @defgroup USBD_CORE_Exported_Variables 100 | * @{ 101 | */ 102 | 103 | extern AUDIO_FOPS_TypeDef AUDIO_OUT_fops; 104 | 105 | /** 106 | * @} 107 | */ 108 | 109 | /** @defgroup USB_CORE_Exported_Functions 110 | * @{ 111 | */ 112 | /** 113 | * @} 114 | */ 115 | 116 | #endif /* __USB_AUDIO_OUT_IF_H_ */ 117 | /** 118 | * @} 119 | */ 120 | 121 | /** 122 | * @} 123 | */ 124 | 125 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 126 | -------------------------------------------------------------------------------- /usb/usbd/class/cdc/inc/usbd_cdc_core.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_cdc_core.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief header file for the usbd_cdc_core.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | 30 | #ifndef __USB_CDC_CORE_H_ 31 | #define __USB_CDC_CORE_H_ 32 | 33 | #include "usbd_ioreq.h" 34 | 35 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 36 | * @{ 37 | */ 38 | 39 | /** @defgroup usbd_cdc 40 | * @brief This file is the Header file for USBD_cdc.c 41 | * @{ 42 | */ 43 | 44 | 45 | /** @defgroup usbd_cdc_Exported_Defines 46 | * @{ 47 | */ 48 | #define USB_CDC_CONFIG_DESC_SIZ (67) 49 | #define USB_CDC_DESC_SIZ (67-9) 50 | 51 | #define CDC_DESCRIPTOR_TYPE 0x21 52 | 53 | #define DEVICE_CLASS_CDC 0x02 54 | #define DEVICE_SUBCLASS_CDC 0x00 55 | 56 | 57 | #define USB_DEVICE_DESCRIPTOR_TYPE 0x01 58 | #define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02 59 | #define USB_STRING_DESCRIPTOR_TYPE 0x03 60 | #define USB_INTERFACE_DESCRIPTOR_TYPE 0x04 61 | #define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05 62 | 63 | #define STANDARD_ENDPOINT_DESC_SIZE 0x09 64 | 65 | #define CDC_DATA_IN_PACKET_SIZE CDC_DATA_MAX_PACKET_SIZE 66 | 67 | #define CDC_DATA_OUT_PACKET_SIZE CDC_DATA_MAX_PACKET_SIZE 68 | 69 | /*---------------------------------------------------------------------*/ 70 | /* CDC definitions */ 71 | /*---------------------------------------------------------------------*/ 72 | 73 | /**************************************************/ 74 | /* CDC Requests */ 75 | /**************************************************/ 76 | #define SEND_ENCAPSULATED_COMMAND 0x00 77 | #define GET_ENCAPSULATED_RESPONSE 0x01 78 | #define SET_COMM_FEATURE 0x02 79 | #define GET_COMM_FEATURE 0x03 80 | #define CLEAR_COMM_FEATURE 0x04 81 | #define SET_LINE_CODING 0x20 82 | #define GET_LINE_CODING 0x21 83 | #define SET_CONTROL_LINE_STATE 0x22 84 | #define SEND_BREAK 0x23 85 | #define NO_CMD 0xFF 86 | 87 | /** 88 | * @} 89 | */ 90 | 91 | 92 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 93 | * @{ 94 | */ 95 | typedef struct _CDC_IF_PROP 96 | { 97 | uint16_t (*pIf_Init) (void); 98 | uint16_t (*pIf_DeInit) (void); 99 | uint16_t (*pIf_Ctrl) (uint32_t Cmd, uint8_t* Buf, uint32_t Len); 100 | uint16_t (*pIf_DataTx) (uint8_t* Buf, uint32_t Len); 101 | uint16_t (*pIf_DataRx) (uint8_t* Buf, uint32_t Len); 102 | } 103 | CDC_IF_Prop_TypeDef; 104 | /** 105 | * @} 106 | */ 107 | 108 | 109 | 110 | /** @defgroup USBD_CORE_Exported_Macros 111 | * @{ 112 | */ 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | /** @defgroup USBD_CORE_Exported_Variables 119 | * @{ 120 | */ 121 | 122 | extern USBD_Class_cb_TypeDef USBD_CDC_cb; 123 | /** 124 | * @} 125 | */ 126 | 127 | /** @defgroup USB_CORE_Exported_Functions 128 | * @{ 129 | */ 130 | /** 131 | * @} 132 | */ 133 | 134 | #endif // __USB_CDC_CORE_H_ 135 | /** 136 | * @} 137 | */ 138 | 139 | /** 140 | * @} 141 | */ 142 | 143 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 144 | -------------------------------------------------------------------------------- /usb/usbd/core/inc/usbd_core.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_core.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief Header file for usbd_core.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USBD_CORE_H 30 | #define __USBD_CORE_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_dcd.h" 34 | #include "usbd_def.h" 35 | #include "usbd_conf.h" 36 | 37 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 38 | * @{ 39 | */ 40 | 41 | /** @defgroup USBD_CORE 42 | * @brief This file is the Header file for usbd_core.c file 43 | * @{ 44 | */ 45 | 46 | 47 | /** @defgroup USBD_CORE_Exported_Defines 48 | * @{ 49 | */ 50 | 51 | typedef enum { 52 | USBD_OK = 0, 53 | USBD_BUSY, 54 | USBD_FAIL, 55 | }USBD_Status; 56 | /** 57 | * @} 58 | */ 59 | 60 | 61 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 62 | * @{ 63 | */ 64 | 65 | 66 | /** 67 | * @} 68 | */ 69 | 70 | 71 | 72 | /** @defgroup USBD_CORE_Exported_Macros 73 | * @{ 74 | */ 75 | 76 | /** 77 | * @} 78 | */ 79 | 80 | /** @defgroup USBD_CORE_Exported_Variables 81 | * @{ 82 | */ 83 | 84 | /** 85 | * @} 86 | */ 87 | 88 | /** @defgroup USBD_CORE_Exported_FunctionsPrototype 89 | * @{ 90 | */ 91 | void USBD_Init(USB_OTG_CORE_HANDLE *pdev, 92 | USB_OTG_CORE_ID_TypeDef coreID, 93 | USBD_DEVICE *pDevice, 94 | USBD_Class_cb_TypeDef *class_cb, 95 | USBD_Usr_cb_TypeDef *usr_cb); 96 | 97 | USBD_Status USBD_DeInit(USB_OTG_CORE_HANDLE *pdev); 98 | 99 | USBD_Status USBD_ClrCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx); 100 | 101 | USBD_Status USBD_SetCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx); 102 | 103 | /** 104 | * @} 105 | */ 106 | 107 | #endif /* __USBD_CORE_H */ 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /usb/usbd/core/inc/usbd_def.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_def.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief general defines for the usb device library 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | 30 | #ifndef __USBD_DEF_H 31 | #define __USBD_DEF_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usbd_conf.h" 35 | 36 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 37 | * @{ 38 | */ 39 | 40 | /** @defgroup USB_DEF 41 | * @brief general defines for the usb device library file 42 | * @{ 43 | */ 44 | 45 | /** @defgroup USB_DEF_Exported_Defines 46 | * @{ 47 | */ 48 | 49 | #ifndef NULL 50 | #define NULL 0 51 | #endif 52 | 53 | #define USB_LEN_DEV_QUALIFIER_DESC 0x0A 54 | #define USB_LEN_DEV_DESC 0x12 55 | #define USB_LEN_CFG_DESC 0x09 56 | #define USB_LEN_IF_DESC 0x09 57 | #define USB_LEN_EP_DESC 0x07 58 | #define USB_LEN_OTG_DESC 0x03 59 | 60 | #define USBD_IDX_LANGID_STR 0x00 61 | #define USBD_IDX_MFC_STR 0x01 62 | #define USBD_IDX_PRODUCT_STR 0x02 63 | #define USBD_IDX_SERIAL_STR 0x03 64 | #define USBD_IDX_CONFIG_STR 0x04 65 | #define USBD_IDX_INTERFACE_STR 0x05 66 | 67 | #define USB_REQ_TYPE_STANDARD 0x00 68 | #define USB_REQ_TYPE_CLASS 0x20 69 | #define USB_REQ_TYPE_VENDOR 0x40 70 | #define USB_REQ_TYPE_MASK 0x60 71 | 72 | #define USB_REQ_RECIPIENT_DEVICE 0x00 73 | #define USB_REQ_RECIPIENT_INTERFACE 0x01 74 | #define USB_REQ_RECIPIENT_ENDPOINT 0x02 75 | #define USB_REQ_RECIPIENT_MASK 0x03 76 | 77 | #define USB_REQ_GET_STATUS 0x00 78 | #define USB_REQ_CLEAR_FEATURE 0x01 79 | #define USB_REQ_SET_FEATURE 0x03 80 | #define USB_REQ_SET_ADDRESS 0x05 81 | #define USB_REQ_GET_DESCRIPTOR 0x06 82 | #define USB_REQ_SET_DESCRIPTOR 0x07 83 | #define USB_REQ_GET_CONFIGURATION 0x08 84 | #define USB_REQ_SET_CONFIGURATION 0x09 85 | #define USB_REQ_GET_INTERFACE 0x0A 86 | #define USB_REQ_SET_INTERFACE 0x0B 87 | #define USB_REQ_SYNCH_FRAME 0x0C 88 | 89 | #define USB_DESC_TYPE_DEVICE 1 90 | #define USB_DESC_TYPE_CONFIGURATION 2 91 | #define USB_DESC_TYPE_STRING 3 92 | #define USB_DESC_TYPE_INTERFACE 4 93 | #define USB_DESC_TYPE_ENDPOINT 5 94 | #define USB_DESC_TYPE_DEVICE_QUALIFIER 6 95 | #define USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION 7 96 | 97 | 98 | #define USB_CONFIG_REMOTE_WAKEUP 2 99 | #define USB_CONFIG_SELF_POWERED 1 100 | 101 | #define USB_FEATURE_EP_HALT 0 102 | #define USB_FEATURE_REMOTE_WAKEUP 1 103 | #define USB_FEATURE_TEST_MODE 2 104 | 105 | /** 106 | * @} 107 | */ 108 | 109 | 110 | /** @defgroup USBD_DEF_Exported_TypesDefinitions 111 | * @{ 112 | */ 113 | /** 114 | * @} 115 | */ 116 | 117 | 118 | 119 | /** @defgroup USBD_DEF_Exported_Macros 120 | * @{ 121 | */ 122 | #define SWAPBYTE(addr) (((uint16_t)(*((uint8_t *)(addr)))) + \ 123 | (((uint16_t)(*(((uint8_t *)(addr)) + 1))) << 8)) 124 | 125 | #define LOBYTE(x) ((uint8_t)(x & 0x00FF)) 126 | #define HIBYTE(x) ((uint8_t)((x & 0xFF00) >>8)) 127 | /** 128 | * @} 129 | */ 130 | 131 | /** @defgroup USBD_DEF_Exported_Variables 132 | * @{ 133 | */ 134 | 135 | /** 136 | * @} 137 | */ 138 | 139 | /** @defgroup USBD_DEF_Exported_FunctionsPrototype 140 | * @{ 141 | */ 142 | 143 | /** 144 | * @} 145 | */ 146 | 147 | #endif /* __USBD_DEF_H */ 148 | 149 | /** 150 | * @} 151 | */ 152 | 153 | /** 154 | * @} 155 | */ 156 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 157 | -------------------------------------------------------------------------------- /usb/usbd/core/inc/usbd_ioreq.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_ioreq.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief header file for the usbd_ioreq.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | 30 | #ifndef __USBD_IOREQ_H_ 31 | #define __USBD_IOREQ_H_ 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usbd_def.h" 35 | #include "usbd_core.h" 36 | 37 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 38 | * @{ 39 | */ 40 | 41 | /** @defgroup USBD_IOREQ 42 | * @brief header file for the usbd_ioreq.c file 43 | * @{ 44 | */ 45 | 46 | /** @defgroup USBD_IOREQ_Exported_Defines 47 | * @{ 48 | */ 49 | /** 50 | * @} 51 | */ 52 | 53 | 54 | /** @defgroup USBD_IOREQ_Exported_Types 55 | * @{ 56 | */ 57 | 58 | 59 | /** 60 | * @} 61 | */ 62 | 63 | 64 | 65 | /** @defgroup USBD_IOREQ_Exported_Macros 66 | * @{ 67 | */ 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @defgroup USBD_IOREQ_Exported_Variables 74 | * @{ 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @defgroup USBD_IOREQ_Exported_FunctionsPrototype 82 | * @{ 83 | */ 84 | 85 | USBD_Status USBD_CtlSendData (USB_OTG_CORE_HANDLE *pdev, 86 | uint8_t *buf, 87 | uint16_t len); 88 | 89 | USBD_Status USBD_CtlContinueSendData (USB_OTG_CORE_HANDLE *pdev, 90 | uint8_t *pbuf, 91 | uint16_t len); 92 | 93 | USBD_Status USBD_CtlPrepareRx (USB_OTG_CORE_HANDLE *pdev, 94 | uint8_t *pbuf, 95 | uint16_t len); 96 | 97 | USBD_Status USBD_CtlContinueRx (USB_OTG_CORE_HANDLE *pdev, 98 | uint8_t *pbuf, 99 | uint16_t len); 100 | 101 | USBD_Status USBD_CtlSendStatus (USB_OTG_CORE_HANDLE *pdev); 102 | 103 | USBD_Status USBD_CtlReceiveStatus (USB_OTG_CORE_HANDLE *pdev); 104 | 105 | uint16_t USBD_GetRxCount (USB_OTG_CORE_HANDLE *pdev , 106 | uint8_t epnum); 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | #endif /* __USBD_IOREQ_H_ */ 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | /** 119 | * @} 120 | */ 121 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 122 | -------------------------------------------------------------------------------- /usb/usbd/core/inc/usbd_req.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_req.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief header file for the usbd_req.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | 30 | #ifndef __USB_REQUEST_H_ 31 | #define __USB_REQUEST_H_ 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usbd_def.h" 35 | #include "usbd_core.h" 36 | #include "usbd_conf.h" 37 | 38 | 39 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 40 | * @{ 41 | */ 42 | 43 | /** @defgroup USBD_REQ 44 | * @brief header file for the usbd_ioreq.c file 45 | * @{ 46 | */ 47 | 48 | /** @defgroup USBD_REQ_Exported_Defines 49 | * @{ 50 | */ 51 | /** 52 | * @} 53 | */ 54 | 55 | 56 | /** @defgroup USBD_REQ_Exported_Types 57 | * @{ 58 | */ 59 | /** 60 | * @} 61 | */ 62 | 63 | 64 | 65 | /** @defgroup USBD_REQ_Exported_Macros 66 | * @{ 67 | */ 68 | /** 69 | * @} 70 | */ 71 | 72 | /** @defgroup USBD_REQ_Exported_Variables 73 | * @{ 74 | */ 75 | /** 76 | * @} 77 | */ 78 | 79 | /** @defgroup USBD_REQ_Exported_FunctionsPrototype 80 | * @{ 81 | */ 82 | 83 | USBD_Status USBD_StdDevReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req); 84 | USBD_Status USBD_StdItfReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req); 85 | USBD_Status USBD_StdEPReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req); 86 | void USBD_ParseSetupRequest( USB_OTG_CORE_HANDLE *pdev, 87 | USB_SETUP_REQ *req); 88 | 89 | void USBD_CtlError( USB_OTG_CORE_HANDLE *pdev, 90 | USB_SETUP_REQ *req); 91 | 92 | void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len); 93 | /** 94 | * @} 95 | */ 96 | 97 | #endif /* __USB_REQUEST_H_ */ 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | /** 104 | * @} 105 | */ 106 | 107 | 108 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 109 | -------------------------------------------------------------------------------- /usb/usbd/core/inc/usbd_usr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_usr.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief Header file for usbd_usr.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USBD_USR_H__ 30 | #define __USBD_USR_H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usbd_core.h" 34 | 35 | 36 | /** @addtogroup USBD_USER 37 | * @{ 38 | */ 39 | 40 | /** @addtogroup USBD_MSC_DEMO_USER_CALLBACKS 41 | * @{ 42 | */ 43 | 44 | /** @defgroup USBD_USR 45 | * @brief This file is the Header file for usbd_usr.c 46 | * @{ 47 | */ 48 | 49 | 50 | /** @defgroup USBD_USR_Exported_Types 51 | * @{ 52 | */ 53 | 54 | extern USBD_Usr_cb_TypeDef USR_cb; 55 | extern USBD_Usr_cb_TypeDef USR_FS_cb; 56 | extern USBD_Usr_cb_TypeDef USR_HS_cb; 57 | 58 | 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | 65 | 66 | /** @defgroup USBD_USR_Exported_Defines 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @defgroup USBD_USR_Exported_Macros 75 | * @{ 76 | */ 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @defgroup USBD_USR_Exported_Variables 82 | * @{ 83 | */ 84 | 85 | void USBD_USR_Init(void); 86 | void USBD_USR_DeviceReset (uint8_t speed); 87 | void USBD_USR_DeviceConfigured (void); 88 | void USBD_USR_DeviceSuspended(void); 89 | void USBD_USR_DeviceResumed(void); 90 | 91 | void USBD_USR_DeviceConnected(void); 92 | void USBD_USR_DeviceDisconnected(void); 93 | 94 | void USBD_USR_FS_Init(void); 95 | void USBD_USR_FS_DeviceReset (uint8_t speed); 96 | void USBD_USR_FS_DeviceConfigured (void); 97 | void USBD_USR_FS_DeviceSuspended(void); 98 | void USBD_USR_FS_DeviceResumed(void); 99 | 100 | void USBD_USR_FS_DeviceConnected(void); 101 | void USBD_USR_FS_DeviceDisconnected(void); 102 | 103 | void USBD_USR_HS_Init(void); 104 | void USBD_USR_HS_DeviceReset (uint8_t speed); 105 | void USBD_USR_HS_DeviceConfigured (void); 106 | void USBD_USR_HS_DeviceSuspended(void); 107 | void USBD_USR_HS_DeviceResumed(void); 108 | 109 | void USBD_USR_HS_DeviceConnected(void); 110 | void USBD_USR_HS_DeviceDisconnected(void); 111 | 112 | /** 113 | * @} 114 | */ 115 | 116 | /** @defgroup USBD_USR_Exported_FunctionsPrototype 117 | * @{ 118 | */ 119 | /** 120 | * @} 121 | */ 122 | 123 | #endif /*__USBD_USR_H__*/ 124 | 125 | /** 126 | * @} 127 | */ 128 | 129 | /** 130 | * @} 131 | */ 132 | 133 | /** 134 | * @} 135 | */ 136 | 137 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /usb/usbh/class/HID/inc/usbh_hid_core.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_hid_core.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief This file contains all the prototypes for the usbh_hid_core.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive ----------------------------------------------*/ 29 | #ifndef __USBH_HID_CORE_H 30 | #define __USBH_HID_CORE_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usbh_core.h" 34 | #include "usbh_stdreq.h" 35 | #include "usbh_bsp.h" 36 | #include "usbh_ioreq.h" 37 | #include "usbh_hcs.h" 38 | 39 | /** @addtogroup USBH_LIB 40 | * @{ 41 | */ 42 | 43 | /** @addtogroup USBH_CLASS 44 | * @{ 45 | */ 46 | 47 | /** @addtogroup USBH_HID_CLASS 48 | * @{ 49 | */ 50 | 51 | /** @defgroup USBH_HID_CORE 52 | * @brief This file is the Header file for USBH_HID_CORE.c 53 | * @{ 54 | */ 55 | 56 | 57 | /** @defgroup USBH_HID_CORE_Exported_Types 58 | * @{ 59 | */ 60 | 61 | #define HID_MIN_POLL 10 62 | 63 | /* States for HID State Machine */ 64 | typedef enum 65 | { 66 | HID_IDLE= 0, 67 | HID_SEND_DATA, 68 | HID_BUSY, 69 | HID_GET_DATA, 70 | HID_SYNC, 71 | HID_POLL, 72 | HID_ERROR, 73 | } 74 | HID_State; 75 | 76 | typedef enum 77 | { 78 | HID_REQ_IDLE = 0, 79 | HID_REQ_GET_REPORT_DESC, 80 | HID_REQ_GET_HID_DESC, 81 | HID_REQ_SET_IDLE, 82 | HID_REQ_SET_PROTOCOL, 83 | HID_REQ_SET_REPORT, 84 | 85 | } 86 | HID_CtlState; 87 | 88 | typedef struct HID_cb 89 | { 90 | void (*Init) (void); 91 | void (*Decode) (uint8_t *data); 92 | 93 | } HID_cb_TypeDef; 94 | 95 | typedef struct _HID_Report 96 | { 97 | uint8_t ReportID; 98 | uint8_t ReportType; 99 | uint16_t UsagePage; 100 | uint32_t Usage[2]; 101 | uint32_t NbrUsage; 102 | uint32_t UsageMin; 103 | uint32_t UsageMax; 104 | int32_t LogMin; 105 | int32_t LogMax; 106 | int32_t PhyMin; 107 | int32_t PhyMax; 108 | int32_t UnitExp; 109 | uint32_t Unit; 110 | uint32_t ReportSize; 111 | uint32_t ReportCnt; 112 | uint32_t Flag; 113 | uint32_t PhyUsage; 114 | uint32_t AppUsage; 115 | uint32_t LogUsage; 116 | } 117 | HID_Report_TypeDef; 118 | 119 | /* Structure for HID process */ 120 | typedef struct _HID_Process 121 | { 122 | uint8_t buff[64]; 123 | uint8_t hc_num_in; 124 | uint8_t hc_num_out; 125 | HID_State state; 126 | uint8_t HIDIntOutEp; 127 | uint8_t HIDIntInEp; 128 | HID_CtlState ctl_state; 129 | uint16_t length; 130 | uint8_t ep_addr; 131 | uint16_t poll; 132 | __IO uint16_t timer; 133 | HID_cb_TypeDef *cb; 134 | } 135 | HID_Machine_TypeDef; 136 | 137 | /** 138 | * @} 139 | */ 140 | 141 | /** @defgroup USBH_HID_CORE_Exported_Defines 142 | * @{ 143 | */ 144 | 145 | #define USB_HID_REQ_GET_REPORT 0x01 146 | #define USB_HID_GET_IDLE 0x02 147 | #define USB_HID_GET_PROTOCOL 0x03 148 | #define USB_HID_SET_REPORT 0x09 149 | #define USB_HID_SET_IDLE 0x0A 150 | #define USB_HID_SET_PROTOCOL 0x0B 151 | /** 152 | * @} 153 | */ 154 | 155 | /** @defgroup USBH_HID_CORE_Exported_Macros 156 | * @{ 157 | */ 158 | /** 159 | * @} 160 | */ 161 | 162 | /** @defgroup USBH_HID_CORE_Exported_Variables 163 | * @{ 164 | */ 165 | extern USBH_Class_cb_TypeDef HID_cb; 166 | /** 167 | * @} 168 | */ 169 | 170 | /** @defgroup USBH_HID_CORE_Exported_FunctionsPrototype 171 | * @{ 172 | */ 173 | 174 | USBH_Status USBH_Set_Report (USB_OTG_CORE_HANDLE *pdev, 175 | USBH_HOST *phost, 176 | uint8_t reportType, 177 | uint8_t reportId, 178 | uint8_t reportLen, 179 | uint8_t* reportBuff); 180 | /** 181 | * @} 182 | */ 183 | 184 | 185 | #endif /* __USBH_HID_CORE_H */ 186 | 187 | /** 188 | * @} 189 | */ 190 | 191 | /** 192 | * @} 193 | */ 194 | 195 | /** 196 | * @} 197 | */ 198 | 199 | /** 200 | * @} 201 | */ 202 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 203 | 204 | -------------------------------------------------------------------------------- /usb/usbh/class/HID/inc/usbh_hid_keybd.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_hid_keybd.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief This file contains all the prototypes for the usbh_hid_keybd.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive -----------------------------------------------*/ 29 | #ifndef __USBH_HID_KEYBD_H 30 | #define __USBH_HID_KEYBD_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_conf.h" 34 | #include "usbh_hid_core.h" 35 | 36 | /** @addtogroup USBH_LIB 37 | * @{ 38 | */ 39 | 40 | /** @addtogroup USBH_CLASS 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup USBH_HID_CLASS 45 | * @{ 46 | */ 47 | 48 | /** @defgroup USBH_HID_KEYBD 49 | * @brief This file is the Header file for USBH_HID_KEYBD.c 50 | * @{ 51 | */ 52 | 53 | 54 | /** @defgroup USBH_HID_KEYBD_Exported_Types 55 | * @{ 56 | */ 57 | 58 | 59 | /** 60 | * @} 61 | */ 62 | 63 | /** @defgroup USBH_HID_KEYBD_Exported_Defines 64 | * @{ 65 | */ 66 | //#define QWERTY_KEYBOARD 67 | #define AZERTY_KEYBOARD 68 | 69 | #define KBD_LEFT_CTRL 0x01 70 | #define KBD_LEFT_SHIFT 0x02 71 | #define KBD_LEFT_ALT 0x04 72 | #define KBD_LEFT_GUI 0x08 73 | #define KBD_RIGHT_CTRL 0x10 74 | #define KBD_RIGHT_SHIFT 0x20 75 | #define KBD_RIGHT_ALT 0x40 76 | #define KBD_RIGHT_GUI 0x80 77 | 78 | #define KBR_MAX_NBR_PRESSED 6 79 | 80 | /** 81 | * @} 82 | */ 83 | 84 | /** @defgroup USBH_HID_KEYBD_Exported_Macros 85 | * @{ 86 | */ 87 | /** 88 | * @} 89 | */ 90 | 91 | /** @defgroup USBH_HID_KEYBD_Exported_Variables 92 | * @{ 93 | */ 94 | 95 | extern HID_cb_TypeDef HID_KEYBRD_cb; 96 | /** 97 | * @} 98 | */ 99 | 100 | /** @defgroup USBH_HID_KEYBD_Exported_FunctionsPrototype 101 | * @{ 102 | */ 103 | void USR_KEYBRD_Init (void); 104 | void USR_KEYBRD_ProcessData (uint8_t pbuf); 105 | /** 106 | * @} 107 | */ 108 | 109 | #endif /* __USBH_HID_KEYBD_H */ 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** 124 | * @} 125 | */ 126 | 127 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 128 | 129 | -------------------------------------------------------------------------------- /usb/usbh/class/HID/inc/usbh_hid_mouse.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_hid_mouse.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief This file contains all the prototypes for the usbh_hid_mouse.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive ----------------------------------------------*/ 30 | #ifndef __USBH_HID_MOUSE_H 31 | #define __USBH_HID_MOUSE_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usbh_hid_core.h" 35 | 36 | /** @addtogroup USBH_LIB 37 | * @{ 38 | */ 39 | 40 | /** @addtogroup USBH_CLASS 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup USBH_HID_CLASS 45 | * @{ 46 | */ 47 | 48 | /** @defgroup USBH_HID_MOUSE 49 | * @brief This file is the Header file for USBH_HID_MOUSE.c 50 | * @{ 51 | */ 52 | 53 | 54 | /** @defgroup USBH_HID_MOUSE_Exported_Types 55 | * @{ 56 | */ 57 | typedef struct _HID_MOUSE_Data 58 | { 59 | uint8_t x; 60 | uint8_t y; 61 | uint8_t z; /* Not Supported */ 62 | uint8_t button; 63 | } 64 | HID_MOUSE_Data_TypeDef; 65 | 66 | /** 67 | * @} 68 | */ 69 | 70 | /** @defgroup USBH_HID_MOUSE_Exported_Defines 71 | * @{ 72 | */ 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup USBH_HID_MOUSE_Exported_Macros 78 | * @{ 79 | */ 80 | /** 81 | * @} 82 | */ 83 | 84 | /** @defgroup USBH_HID_MOUSE_Exported_Variables 85 | * @{ 86 | */ 87 | 88 | extern HID_cb_TypeDef HID_MOUSE_cb; 89 | extern HID_MOUSE_Data_TypeDef HID_MOUSE_Data; 90 | /** 91 | * @} 92 | */ 93 | 94 | /** @defgroup USBH_HID_MOUSE_Exported_FunctionsPrototype 95 | * @{ 96 | */ 97 | void USR_MOUSE_Init (void); 98 | void USR_MOUSE_ProcessData (HID_MOUSE_Data_TypeDef *data); 99 | /** 100 | * @} 101 | */ 102 | 103 | #endif /* __USBH_HID_MOUSE_H */ 104 | 105 | /** 106 | * @} 107 | */ 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | /** 118 | * @} 119 | */ 120 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 121 | -------------------------------------------------------------------------------- /usb/usbh/class/HID/src/usbh_hid_mouse.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_hid_mouse.c 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief This file is the application layer for USB Host HID Mouse Handling. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "usbh_hid_mouse.h" 30 | 31 | 32 | /** @addtogroup USBH_LIB 33 | * @{ 34 | */ 35 | 36 | /** @addtogroup USBH_CLASS 37 | * @{ 38 | */ 39 | 40 | /** @addtogroup USBH_HID_CLASS 41 | * @{ 42 | */ 43 | 44 | /** @defgroup USBH_HID_MOUSE 45 | * @brief This file includes HID Layer Handlers for USB Host HID class. 46 | * @{ 47 | */ 48 | 49 | /** @defgroup USBH_HID_MOUSE_Private_TypesDefinitions 50 | * @{ 51 | */ 52 | /** 53 | * @} 54 | */ 55 | 56 | 57 | /** @defgroup USBH_HID_MOUSE_Private_Defines 58 | * @{ 59 | */ 60 | /** 61 | * @} 62 | */ 63 | 64 | 65 | /** @defgroup USBH_HID_MOUSE_Private_Macros 66 | * @{ 67 | */ 68 | /** 69 | * @} 70 | */ 71 | 72 | /** @defgroup USBH_HID_MOUSE_Private_FunctionPrototypes 73 | * @{ 74 | */ 75 | static void MOUSE_Init (void); 76 | static void MOUSE_Decode(uint8_t *data); 77 | /** 78 | * @} 79 | */ 80 | 81 | 82 | /** @defgroup USBH_HID_MOUSE_Private_Variables 83 | * @{ 84 | */ 85 | #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED 86 | #if defined (__CC_ARM) /*!< ARM Compiler */ 87 | __align(4) 88 | #elif defined ( __ICCARM__ ) /*!< IAR Compiler */ 89 | #pragma data_alignment=4 90 | #elif defined (__GNUC__) /*!< GNU Compiler */ 91 | #pragma pack(4) 92 | #elif defined (__TASKING__) /*!< TASKING Compiler */ 93 | __align(4) 94 | #endif /* __CC_ARM */ 95 | #endif 96 | 97 | 98 | HID_MOUSE_Data_TypeDef HID_MOUSE_Data; 99 | HID_cb_TypeDef HID_MOUSE_cb = 100 | { 101 | MOUSE_Init, 102 | MOUSE_Decode, 103 | }; 104 | /** 105 | * @} 106 | */ 107 | 108 | 109 | /** @defgroup USBH_HID_MOUSE_Private_Functions 110 | * @{ 111 | */ 112 | 113 | /** 114 | * @brief MOUSE_Init 115 | * Init Mouse State. 116 | * @param None 117 | * @retval None 118 | */ 119 | static void MOUSE_Init ( void) 120 | { 121 | /* Call User Init*/ 122 | USR_MOUSE_Init(); 123 | } 124 | 125 | /** 126 | * @brief MOUSE_Decode 127 | * Decode Mouse data 128 | * @param data : Pointer to Mouse HID data buffer 129 | * @retval None 130 | */ 131 | static void MOUSE_Decode(uint8_t *data) 132 | { 133 | HID_MOUSE_Data.button = data[0]; 134 | 135 | HID_MOUSE_Data.x = data[1]; 136 | HID_MOUSE_Data.y = data[2]; 137 | 138 | USR_MOUSE_ProcessData(&HID_MOUSE_Data); 139 | 140 | } 141 | /** 142 | * @} 143 | */ 144 | 145 | /** 146 | * @} 147 | */ 148 | 149 | /** 150 | * @} 151 | */ 152 | 153 | /** 154 | * @} 155 | */ 156 | 157 | 158 | /** 159 | * @} 160 | */ 161 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 162 | -------------------------------------------------------------------------------- /usb/usbh/core/inc/usbh_hcs.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_hcs.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief Header file for usbh_hcs.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive ----------------------------------------------*/ 29 | #ifndef __USBH_HCS_H 30 | #define __USBH_HCS_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usbh_core.h" 34 | 35 | /** @addtogroup USBH_LIB 36 | * @{ 37 | */ 38 | 39 | /** @addtogroup USBH_LIB_CORE 40 | * @{ 41 | */ 42 | 43 | /** @defgroup USBH_HCS 44 | * @brief This file is the header file for usbh_hcs.c 45 | * @{ 46 | */ 47 | 48 | /** @defgroup USBH_HCS_Exported_Defines 49 | * @{ 50 | */ 51 | #define HC_MAX 8 52 | 53 | #define HC_OK 0x0000 54 | #define HC_USED 0x8000 55 | #define HC_ERROR 0xFFFF 56 | #define HC_USED_MASK 0x7FFF 57 | /** 58 | * @} 59 | */ 60 | 61 | /** @defgroup USBH_HCS_Exported_Types 62 | * @{ 63 | */ 64 | /** 65 | * @} 66 | */ 67 | 68 | 69 | /** @defgroup USBH_HCS_Exported_Macros 70 | * @{ 71 | */ 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @defgroup USBH_HCS_Exported_Variables 77 | * @{ 78 | */ 79 | /** 80 | * @} 81 | */ 82 | 83 | /** @defgroup USBH_HCS_Exported_FunctionsPrototype 84 | * @{ 85 | */ 86 | 87 | uint8_t USBH_Alloc_Channel(USB_OTG_CORE_HANDLE *pdev, uint8_t ep_addr); 88 | 89 | uint8_t USBH_Free_Channel (USB_OTG_CORE_HANDLE *pdev, uint8_t idx); 90 | 91 | uint8_t USBH_DeAllocate_AllChannel (USB_OTG_CORE_HANDLE *pdev); 92 | 93 | uint8_t USBH_Open_Channel (USB_OTG_CORE_HANDLE *pdev, 94 | uint8_t ch_num, 95 | uint8_t dev_address, 96 | uint8_t speed, 97 | uint8_t ep_type, 98 | uint16_t mps); 99 | 100 | uint8_t USBH_Modify_Channel (USB_OTG_CORE_HANDLE *pdev, 101 | uint8_t hc_num, 102 | uint8_t dev_address, 103 | uint8_t speed, 104 | uint8_t ep_type, 105 | uint16_t mps); 106 | /** 107 | * @} 108 | */ 109 | 110 | 111 | 112 | #endif /* __USBH_HCS_H */ 113 | 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** 124 | * @} 125 | */ 126 | 127 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 128 | 129 | 130 | -------------------------------------------------------------------------------- /usb/usbh/core/inc/usbh_ioreq.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_ioreq.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief Header file for usbh_ioreq.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive ----------------------------------------------*/ 29 | #ifndef __USBH_IOREQ_H 30 | #define __USBH_IOREQ_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_conf.h" 34 | #include "usbh_core.h" 35 | #include "usbh_def.h" 36 | 37 | /** @addtogroup USBH_LIB 38 | * @{ 39 | */ 40 | 41 | /** @addtogroup USBH_LIB_CORE 42 | * @{ 43 | */ 44 | 45 | /** @defgroup USBH_IOREQ 46 | * @brief This file is the header file for usbh_ioreq.c 47 | * @{ 48 | */ 49 | 50 | 51 | /** @defgroup USBH_IOREQ_Exported_Defines 52 | * @{ 53 | */ 54 | #define USBH_SETUP_PKT_SIZE 8 55 | #define USBH_EP0_EP_NUM 0 56 | #define USBH_MAX_PACKET_SIZE 0x40 57 | /** 58 | * @} 59 | */ 60 | 61 | 62 | /** @defgroup USBH_IOREQ_Exported_Types 63 | * @{ 64 | */ 65 | /** 66 | * @} 67 | */ 68 | 69 | 70 | /** @defgroup USBH_IOREQ_Exported_Macros 71 | * @{ 72 | */ 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup USBH_IOREQ_Exported_Variables 78 | * @{ 79 | */ 80 | /** 81 | * @} 82 | */ 83 | 84 | /** @defgroup USBH_IOREQ_Exported_FunctionsPrototype 85 | * @{ 86 | */ 87 | USBH_Status USBH_CtlSendSetup ( USB_OTG_CORE_HANDLE *pdev, 88 | uint8_t *buff, 89 | uint8_t hc_num); 90 | 91 | USBH_Status USBH_CtlSendData ( USB_OTG_CORE_HANDLE *pdev, 92 | uint8_t *buff, 93 | uint16_t length, 94 | uint8_t hc_num); 95 | 96 | USBH_Status USBH_CtlReceiveData( USB_OTG_CORE_HANDLE *pdev, 97 | uint8_t *buff, 98 | uint16_t length, 99 | uint8_t hc_num); 100 | 101 | USBH_Status USBH_BulkReceiveData( USB_OTG_CORE_HANDLE *pdev, 102 | uint8_t *buff, 103 | uint16_t length, 104 | uint8_t hc_num); 105 | 106 | USBH_Status USBH_BulkSendData ( USB_OTG_CORE_HANDLE *pdev, 107 | uint8_t *buff, 108 | uint16_t length, 109 | uint8_t hc_num); 110 | 111 | USBH_Status USBH_InterruptReceiveData( USB_OTG_CORE_HANDLE *pdev, 112 | uint8_t *buff, 113 | uint8_t length, 114 | uint8_t hc_num); 115 | 116 | USBH_Status USBH_InterruptSendData( USB_OTG_CORE_HANDLE *pdev, 117 | uint8_t *buff, 118 | uint8_t length, 119 | uint8_t hc_num); 120 | 121 | USBH_Status USBH_CtlReq (USB_OTG_CORE_HANDLE *pdev, 122 | USBH_HOST *phost, 123 | uint8_t *buff, 124 | uint16_t length); 125 | 126 | USBH_Status USBH_IsocReceiveData( USB_OTG_CORE_HANDLE *pdev, 127 | uint8_t *buff, 128 | uint32_t length, 129 | uint8_t hc_num); 130 | 131 | 132 | USBH_Status USBH_IsocSendData( USB_OTG_CORE_HANDLE *pdev, 133 | uint8_t *buff, 134 | uint32_t length, 135 | uint8_t hc_num); 136 | /** 137 | * @} 138 | */ 139 | 140 | #endif /* __USBH_IOREQ_H */ 141 | 142 | /** 143 | * @} 144 | */ 145 | 146 | /** 147 | * @} 148 | */ 149 | 150 | /** 151 | * @} 152 | */ 153 | 154 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 155 | 156 | 157 | -------------------------------------------------------------------------------- /usb/usbh/core/inc/usbh_stdreq.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_stdreq.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief Header file for usbh_stdreq.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive ----------------------------------------------*/ 29 | #ifndef __USBH_STDREQ_H 30 | #define __USBH_STDREQ_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_conf.h" 34 | #include "usb_hcd.h" 35 | #include "usbh_core.h" 36 | #include "usbh_def.h" 37 | 38 | /** @addtogroup USBH_LIB 39 | * @{ 40 | */ 41 | 42 | /** @addtogroup USBH_LIB_CORE 43 | * @{ 44 | */ 45 | 46 | /** @defgroup USBH_STDREQ 47 | * @brief This file is the 48 | * @{ 49 | */ 50 | 51 | 52 | /** @defgroup USBH_STDREQ_Exported_Defines 53 | * @{ 54 | */ 55 | /*Standard Feature Selector for clear feature command*/ 56 | #define FEATURE_SELECTOR_ENDPOINT 0X00 57 | #define FEATURE_SELECTOR_DEVICE 0X01 58 | 59 | 60 | #define INTERFACE_DESC_TYPE 0x04 61 | #define ENDPOINT_DESC_TYPE 0x05 62 | #define INTERFACE_DESC_SIZE 0x09 63 | 64 | 65 | #define USBH_HID_CLASS 0x03 66 | 67 | /** 68 | * @} 69 | */ 70 | 71 | 72 | /** @defgroup USBH_STDREQ_Exported_Types 73 | * @{ 74 | */ 75 | /** 76 | * @} 77 | */ 78 | 79 | 80 | /** @defgroup USBH_STDREQ_Exported_Macros 81 | * @{ 82 | */ 83 | /** 84 | * @} 85 | */ 86 | 87 | /** @defgroup USBH_STDREQ_Exported_Variables 88 | * @{ 89 | */ 90 | extern uint8_t USBH_CfgDesc[512]; 91 | /** 92 | * @} 93 | */ 94 | 95 | /** @defgroup USBH_STDREQ_Exported_FunctionsPrototype 96 | * @{ 97 | */ 98 | USBH_Status USBH_GetDescriptor(USB_OTG_CORE_HANDLE *pdev, 99 | USBH_HOST *phost, 100 | uint8_t req_type, 101 | uint16_t value_idx, 102 | uint8_t* buff, 103 | uint16_t length ); 104 | 105 | USBH_Status USBH_Get_DevDesc(USB_OTG_CORE_HANDLE *pdev, 106 | USBH_HOST *phost, 107 | uint8_t length); 108 | 109 | USBH_Status USBH_Get_StringDesc(USB_OTG_CORE_HANDLE *pdev, 110 | USBH_HOST *phost, 111 | uint8_t string_index, 112 | uint8_t *buff, 113 | uint16_t length); 114 | 115 | USBH_Status USBH_SetCfg(USB_OTG_CORE_HANDLE *pdev, 116 | USBH_HOST *phost, 117 | uint16_t configuration_value); 118 | 119 | USBH_Status USBH_Get_CfgDesc(USB_OTG_CORE_HANDLE *pdev, 120 | USBH_HOST *phost, 121 | uint16_t length); 122 | 123 | USBH_Status USBH_SetAddress(USB_OTG_CORE_HANDLE *pdev, 124 | USBH_HOST *phost, 125 | uint8_t DeviceAddress); 126 | 127 | USBH_Status USBH_ClrFeature(USB_OTG_CORE_HANDLE *pdev, 128 | USBH_HOST *phost, 129 | uint8_t ep_num, uint8_t hc_num); 130 | 131 | USBH_Status USBH_SetInterface(USB_OTG_CORE_HANDLE *pdev, 132 | USBH_HOST *phost, 133 | uint8_t ep_num, uint8_t altSetting); 134 | 135 | USBH_Status USBH_Issue_ClrFeature(USB_OTG_CORE_HANDLE *pdev, 136 | USBH_HOST *phost, 137 | uint8_t ep_num); 138 | 139 | USBH_DescHeader_t *USBH_GetNextDesc (uint8_t *pbuf, 140 | uint16_t *ptr); 141 | /** 142 | * @} 143 | */ 144 | 145 | #endif /* __USBH_STDREQ_H */ 146 | 147 | /** 148 | * @} 149 | */ 150 | 151 | /** 152 | * @} 153 | */ 154 | 155 | /** 156 | * @} 157 | */ 158 | 159 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 160 | 161 | 162 | --------------------------------------------------------------------------------