diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2017-01-25 22:24:18 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2017-01-25 22:29:25 +0100 |
commit | 40e04e3772726829d66c12e69f24b03920d79c67 (patch) | |
tree | 636811bad956798c9d5d22de9e7ba8c799b8d791 /thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc | |
parent | 2fff65aed2477a503c72629d27e2a330d30c02d1 (diff) | |
download | stm32f103-playground-40e04e3772726829d66c12e69f24b03920d79c67.tar.gz stm32f103-playground-40e04e3772726829d66c12e69f24b03920d79c67.tar.bz2 stm32f103-playground-40e04e3772726829d66c12e69f24b03920d79c67.tar.xz stm32f103-playground-40e04e3772726829d66c12e69f24b03920d79c67.zip |
o Moving tinyprintf and stm libraries under thirdparty.
Diffstat (limited to 'thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc')
6 files changed, 635 insertions, 0 deletions
diff --git a/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/i2s_codec.h b/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/i2s_codec.h new file mode 100644 index 0000000..c392004 --- /dev/null +++ b/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/i2s_codec.h @@ -0,0 +1,193 @@ +/** + ****************************************************************************** + * @file i2s_codec.h + * @author MCD Application Team + * @version V4.0.0 + * @date 21-January-2013 + * @brief This file contains all the functions prototypes for the I2S codec + * firmware driver. + ****************************************************************************** + * @attention + * + * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2> + * + * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.st.com/software_license_agreement_liberty_v2 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __I2S_CODEC_H +#define __I2S_CODEC_H + +/* .WAV file format : + + Endian Offset Length Contents + big 0 4 bytes 'RIFF' // 0x52494646 + little 4 4 bytes <file length - 8> + big 8 4 bytes 'WAVE' // 0x57415645 + +Next, the fmt chunk describes the sample format: + + big 12 4 bytes 'fmt ' // 0x666D7420 + little 16 4 bytes 0x00000010 // Length of the fmt data (16 bytes) + little 20 2 bytes 0x0001 // Format tag: 1 = PCM + little 22 2 bytes <channels> // Channels: 1 = mono, 2 = stereo + little 24 4 bytes <sample rate> // Samples per second: e.g., 22050 + little 28 4 bytes <bytes/second> // sample rate * block align + little 32 2 bytes <block align> // channels * bits/sample / 8 + little 34 2 bytes <bits/sample> // 8 or 16 + +Finally, the data chunk contains the sample data: + + big 36 4 bytes 'data' // 0x64617461 + little 40 4 bytes <length of the data block> + little 44 * <sample data> + +*/ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f10x.h" + +/* Exported types ------------------------------------------------------------*/ + +/* Audio file information structure */ +typedef struct +{ + uint32_t RIFFchunksize; + uint16_t FormatTag; + uint16_t NumChannels; + uint32_t SampleRate; + uint32_t ByteRate; + uint16_t BlockAlign; + uint16_t BitsPerSample; + uint32_t DataSize; +} WAVE_FormatTypeDef; + +/* Error Identification structure */ +typedef enum +{ + Valid_WAVE_File = 0, + Unvalid_RIFF_ID, + Unvalid_WAVE_Format, + Unvalid_FormatChunk_ID, + Unsupporetd_FormatTag, + Unsupporetd_Number_Of_Channel, + Unsupporetd_Sample_Rate, + Unsupporetd_Bits_Per_Sample, + Unvalid_DataChunk_ID, + Unsupporetd_ExtraFormatBytes, + Unvalid_FactChunk_ID +} ErrorCode; + +/* Exported constants --------------------------------------------------------*/ + +/* Codec output DEVICE */ +#define OutputDevice_SPEAKER 1 +#define OutputDevice_HEADPHONE 2 +#define OutputDevice_BOTH 3 + +/* VOLUME control constants */ +#define DEFAULT_VOL 0x52 +#define VolumeDirection_HIGH 0xF +#define VolumeDirection_LOW 0xA +#define VolumeDirection_LEVEL 0x0 +#define VOLStep 4 + +/* Forward and Rewind constants */ +#define STEP_FORWARD 2 /* 2% of wave file data length*/ +#define STEP_BACK 6 /* 6% of wave file data length*/ + +/* Codec POWER DOWN modes */ +#define CodecPowerDown_HW 1 +#define CodecPowerDown_SW 2 + +/* Audio Play STATUS */ +#define AudioPlayStatus_STOPPED 0 +#define AudioPlayStatus_PLAYING 1 +#define AudioPlayStatus_PAUSED 2 + +/* MUTE commands */ +#define MUTE_ON 1 +#define MUTE_OFF 0 + +/* I2S configuration parameters */ +#define I2S_STANDARD I2S_Standard_Phillips +#define I2S_MCLKOUTPUT I2S_MCLKOutput_Enable + +/* Exported macro ------------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ + + /* CONFIGURATION */ +uint32_t I2S_CODEC_Init(uint32_t OutputDevice, uint32_t Address); +void I2S_CODEC_ReplayConfig(uint32_t Repetions); + + /* AUDIO CONTROL */ +uint32_t I2S_CODEC_Play(uint32_t AudioStartPosition); +uint32_t I2S_CODEC_Pause(void); +uint32_t I2S_CODEC_Stop(void); +uint32_t I2S_CODEC_ControlVolume(uint32_t direction, uint8_t volume); +void I2S_CODEC_Mute(uint32_t Command); +void I2S_CODEC_ForwardPlay(uint32_t Step); +void I2S_CODEC_RewindPlay(uint32_t Step); + + /* EXTRA CONTROLS */ +void I2S_CODEC_PowerDown(uint32_t CodecPowerDown_Mode); +void I2S_CODEC_Reset(void); +uint32_t I2S_CODEC_SpeakerHeadphoneSwap(uint32_t CODEC_AudioOutput, uint32_t Address); +uint8_t GetVar_CurrentVolume(void); + +/* Medium Layer Codec Functions ----------------------------------------------*/ +void I2S_CODEC_DataTransfer(void); +void I2S_CODEC_UpdateStatus(void); +uint32_t GetVar_DataStartAddr(void); +ErrorCode I2S_CODEC_WaveParsing(uint8_t* HeaderTab); +uint32_t GetVar_CurrentOutputDevice(void); + +uint32_t GetVar_AudioDataIndex(void); +void SetVar_AudioDataIndex(uint32_t value); +void ResetVar_AudioDataIndex(void); +void IncrementVar_AudioDataIndex(uint32_t IncrementNumber); +void DecrementVar_AudioDataIndex(uint32_t DecrementNumber); + +uint32_t GetVar_AudioReplay(void); +void Decrement_AudioReplay(void); + +uint32_t GetVar_AudioPlayStatus(void); +uint32_t SetVar_AudioPlayStatus(uint32_t Status); + +uint16_t GetVar_i2saudiofreq(void); +uint32_t GetVar_AudioDataLength(void); + +/* Low Layer Codec Function --------------------------------------------------*/ +uint32_t SetVar_SendDummyData(void); +uint32_t ResetVar_SendDummyData(void); +uint32_t GetVar_SendDummyData(void); +uint32_t AudioFile_Init(void); + +void I2S_GPIO_Config(void); +void I2S_Config(uint16_t Standard, uint16_t MCLKOutput, uint16_t AudioFreq); +uint32_t CODEC_Config(uint16_t AudioOutput, uint16_t I2S_Standard, uint16_t I2S_MCLKOutput, uint8_t Volume); + +uint32_t Media_Init(void); +void Media_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead); +void Media_StartReadSequence(uint32_t ReadAddr); +uint16_t Media_ReadHalfWord(uint32_t Offset); +uint8_t Media_ReadByte(uint32_t Offset); + +void delay(__IO uint32_t nCount); + +#endif /* __I2S_CODEC_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/platform_config.h b/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/platform_config.h new file mode 100644 index 0000000..440c531 --- /dev/null +++ b/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/platform_config.h @@ -0,0 +1,129 @@ +/** + ****************************************************************************** + * @file platform_config.h + * @author MCD Application Team + * @version V4.0.0 + * @date 21-January-2013 + * @brief Evaluation board specific configuration file. + ****************************************************************************** + * @attention + * + * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2> + * + * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.st.com/software_license_agreement_liberty_v2 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __PLATFORM_CONFIG_H +#define __PLATFORM_CONFIG_H + +/* Includes ------------------------------------------------------------------*/ + +#if defined(STM32L1XX_MD) + #include "stm32l1xx.h" + #if defined (USE_STM32L152_EVAL) + #include "stm32l152_eval.h" + #endif /* USE_STM32L152_EVAL */ +#elif defined (STM32F10X_MD) || defined (STM32F10X_HD) || defined (STM32F10X_XL) + #include "stm32f10x.h" + #if defined (USE_STM3210B_EVAL) + #include "stm3210b_eval.h" + #elif defined (USE_STM3210E_EVAL) + #include "i2s_codec.h" + #include "stm3210e_eval.h" + #else + #error "Missing define: USE_STM3210B_EVAL or USE_STM3210E_EVAL" + #endif /* USE_STM3210B_EVAL */ +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* Uncomment the line corresponding to the STMicroelectronics evaluation board + used to run the example */ +#if !defined (USE_STM3210B_EVAL) && !defined (USE_STM3210E_EVAL) && !defined (USE_STM32L152_EVAL) + //#define USE_STM3210B_EVAL + //#define USE_STM3210E_EVAL +#define USE_STM32L152_EVAL + +#endif + +/*Unique Devices IDs register set*/ + +#if defined(STM32L1XX_MD) + +#define ID1 (0x1FF80050) +#define ID2 (0x1FF80054) +#define ID3 (0x1FF80064) + +#else /*STM32F1x*/ + +#define ID1 (0x1FFFF7E8) +#define ID2 (0x1FFFF7EC) +#define ID3 (0x1FFFF7F0) + +#endif + +/* Define the STM32F10x hardware depending on the used evaluation board */ +#ifdef USE_STM3210B_EVAL + + #define USB_DISCONNECT GPIOD + #define USB_DISCONNECT_PIN GPIO_Pin_9 + #define RCC_APB2Periph_GPIO_DISCONNECT RCC_APB2Periph_GPIOD + +#elif defined(USE_STM3210E_EVAL) + + #define USB_DISCONNECT GPIOB + #define USB_DISCONNECT_PIN GPIO_Pin_14 + #define RCC_APB2Periph_GPIO_DISCONNECT RCC_APB2Periph_GPIOB + +#elif defined (USE_STM32L152_EVAL) + /* + For STM32L15xx devices it is possible to use the internal USB pullup + controlled by register SYSCFG_PMC (refer to RM0038 reference manual for + more details). + It is also possible to use external pullup (and disable the internal pullup) + by setting the define USB_USE_EXTERNAL_PULLUP in file platform_config.h + and configuring the right pin to be used for the external pull up configuration. + To have more details on how to use an external pull up, please refer to + STM3210E-EVAL evaluation board manuals. + */ + /* Uncomment the following define to use an external pull up instead of the + integrated STM32L15xx internal pull up. In this case make sure to set up + correctly the external required hardware and the GPIO defines below.*/ +/* #define USB_USE_EXTERNAL_PULLUP */ + + #if !defined(USB_USE_EXTERNAL_PULLUP) + #define STM32L15_USB_CONNECT SYSCFG_USBPuCmd(ENABLE) + #define STM32L15_USB_DISCONNECT SYSCFG_USBPuCmd(DISABLE) + + #elif defined(USB_USE_EXTERNAL_PULLUP) + /* PA0 is chosen just as illustrating example, you should modify the defines + below according to your hardware configuration. */ + #define USB_DISCONNECT GPIOA + #define USB_DISCONNECT_PIN GPIO_Pin_0 + #define RCC_AHBPeriph_GPIO_DISCONNECT RCC_AHBPeriph_GPIOA + #define STM32L15_USB_CONNECT GPIO_ResetBits(USB_DISCONNECT, USB_DISCONNECT_PIN) + #define STM32L15_USB_DISCONNECT GPIO_SetBits(USB_DISCONNECT, USB_DISCONNECT_PIN) + #endif /* USB_USE_EXTERNAL_PULLUP */ + +#endif /* USE_STM3210B_EVAL */ + +/* Exported macro ------------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ + +#endif /* __PLATFORM_CONFIG_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/stm32_it.h b/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/stm32_it.h new file mode 100644 index 0000000..6bc6037 --- /dev/null +++ b/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/stm32_it.h @@ -0,0 +1,63 @@ +/** + ****************************************************************************** + * @file stm32_it.h + * @author MCD Application Team + * @version V4.0.0 + * @date 21-January-2013 + * @brief This file contains the headers of the interrupt handlers. + ****************************************************************************** + * @attention + * + * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2> + * + * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.st.com/software_license_agreement_liberty_v2 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32_IT_H +#define __STM32_IT_H + +/* Includes ------------------------------------------------------------------*/ +#include "platform_config.h" + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ + +void NMI_Handler(void); +void HardFault_Handler(void); +void MemManage_Handler(void); +void BusFault_Handler(void); +void UsageFault_Handler(void); +void SVC_Handler(void); +void DebugMon_Handler(void); +void PendSV_Handler(void); +void SysTick_Handler(void); +void USB_HP_CAN1_TX_IRQHandler(void); +void USB_LP_CAN1_RX0_IRQHandler(void); +void USBWakeUp_IRQHandler(void); +void USB_FS_WKUP_IRQHandler(void); +#ifdef USE_STM3210B_EVAL +void TIM2_IRQHandler(void); +#endif /* USE_STM3210B_EVAL */ +#if defined (USE_STM3210E_EVAL) +void SPI2_IRQHandler(void); +#endif /* USE_STM3210E_EVAL */ + +#endif /* __STM32_IT_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/stm32f10x_conf.h b/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/stm32f10x_conf.h new file mode 100644 index 0000000..e08299d --- /dev/null +++ b/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/stm32f10x_conf.h @@ -0,0 +1,85 @@ +/** + ****************************************************************************** + * @file stm32f10x_conf.h + * @author MCD Application Team + * @version V4.0.0 + * @date 21-January-2013 + * @brief Library configuration file. + ****************************************************************************** + * @attention + * + * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2> + * + * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.st.com/software_license_agreement_liberty_v2 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32F10x_CONF_H +#define __STM32F10x_CONF_H + +/* Includes ------------------------------------------------------------------*/ +/* Uncomment the line below to enable peripheral header file inclusion */ +#include "stm32f10x_adc.h" +#include "stm32f10x_bkp.h" +#include "stm32f10x_can.h" +#include "stm32f10x_crc.h" +#include "stm32f10x_dac.h" +#include "stm32f10x_dbgmcu.h" +#include "stm32f10x_dma.h" +#include "stm32f10x_exti.h" +#include "stm32f10x_flash.h" +#include "stm32f10x_fsmc.h" +#include "stm32f10x_gpio.h" +#include "stm32f10x_i2c.h" +#include "stm32f10x_iwdg.h" +#include "stm32f10x_pwr.h" +#include "stm32f10x_rcc.h" +#include "stm32f10x_rtc.h" +#include "stm32f10x_sdio.h" +#include "stm32f10x_spi.h" +#include "stm32f10x_tim.h" +#include "stm32f10x_usart.h" +#include "stm32f10x_wwdg.h" +#include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* Uncomment the line below to expanse the "assert_param" macro in the + Standard Peripheral Library drivers code */ +/* #define USE_FULL_ASSERT 1 */ + +/* Exported macro ------------------------------------------------------------*/ +#ifdef USE_FULL_ASSERT + +/******************************************************************************* +* Macro Name : assert_param +* Description : The assert_param macro is used for function's parameters check. +* Input : - expr: If expr is false, it calls assert_failed function +* which reports the name of the source file and the source +* line number of the call that failed. +* If expr is true, it returns no value. +* Return : None +*******************************************************************************/ + #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) +/* Exported functions ------------------------------------------------------- */ + void assert_failed(uint8_t* file, uint32_t line); +#else + #define assert_param(expr) ((void)0) +#endif /* USE_FULL_ASSERT */ + +#endif /* __STM32F10x_CONF_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/usb_istr.h b/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/usb_istr.h new file mode 100644 index 0000000..de6ca1c --- /dev/null +++ b/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/usb_istr.h @@ -0,0 +1,93 @@ +/** + ****************************************************************************** + * @file usb_istr.h + * @author MCD Application Team + * @version V4.0.0 + * @date 21-January-2013 + * @brief This file includes the peripherals header files in the user application. + ****************************************************************************** + * @attention + * + * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2> + * + * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.st.com/software_license_agreement_liberty_v2 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __USB_ISTR_H +#define __USB_ISTR_H + +/* Includes ------------------------------------------------------------------*/ +#include "usb_conf.h" + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +void USB_Istr(void); +/* function prototypes Automatically built defining related macros */ + +#ifdef CTR_CALLBACK + void CTR_Callback(void); +#endif + +#ifdef DOVR_CALLBACK + void DOVR_Callback(void); +#endif + +#ifdef ERR_CALLBACK + void ERR_Callback(void); +#endif + +#ifdef WKUP_CALLBACK + void WKUP_Callback(void); +#endif + +#ifdef SUSP_CALLBACK + void SUSP_Callback(void); +#endif + +#ifdef RESET_CALLBACK + void RESET_Callback(void); +#endif + +#ifdef SOF_CALLBACK + void SOF_Callback(void); +#endif + +#ifdef ESOF_CALLBACK + void ESOF_Callback(void); +#endif + +void EP1_IN_Callback(void); +void EP2_IN_Callback(void); +void EP3_IN_Callback(void); +void EP4_IN_Callback(void); +void EP5_IN_Callback(void); +void EP6_IN_Callback(void); +void EP7_IN_Callback(void); + +void EP1_OUT_Callback(void); +void EP2_OUT_Callback(void); +void EP3_OUT_Callback(void); +void EP4_OUT_Callback(void); +void EP5_OUT_Callback(void); +void EP6_OUT_Callback(void); +void EP7_OUT_Callback(void); + +#endif /*__USB_ISTR_H*/ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/usb_pwr.h b/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/usb_pwr.h new file mode 100644 index 0000000..af7873e --- /dev/null +++ b/thirdparty/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Audio_Speaker/inc/usb_pwr.h @@ -0,0 +1,72 @@ +/** + ****************************************************************************** + * @file usb_pwr.h + * @author MCD Application Team + * @version V4.0.0 + * @date 21-January-2013 + * @brief Connection/disconnection & power management header + ****************************************************************************** + * @attention + * + * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2> + * + * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.st.com/software_license_agreement_liberty_v2 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __USB_PWR_H +#define __USB_PWR_H + +/* Includes ------------------------------------------------------------------*/ +/* Exported types ------------------------------------------------------------*/ +typedef enum _RESUME_STATE +{ + RESUME_EXTERNAL, + RESUME_INTERNAL, + RESUME_LATER, + RESUME_WAIT, + RESUME_START, + RESUME_ON, + RESUME_OFF, + RESUME_ESOF +} RESUME_STATE; + +typedef enum _DEVICE_STATE +{ + UNCONNECTED, + ATTACHED, + POWERED, + SUSPENDED, + ADDRESSED, + CONFIGURED +} DEVICE_STATE; + +/* Exported constants --------------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +void Suspend(void); +void Resume_Init(void); +void Resume(RESUME_STATE eResumeSetVal); +RESULT PowerOn(void); +RESULT PowerOff(void); + +/* External variables --------------------------------------------------------*/ +extern __IO uint32_t bDeviceState; /* USB device status */ +extern __IO bool fSuspendEnabled; /* true when suspend is possible */ + +#endif /*__USB_PWR_H*/ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |