mbed(SerialHalfDuplex入り)
Fork of mbed by
TARGET_NUCLEO_F103RB/stm32f1xx_hal_hcd.h@98:01a414ca7d6d, 2015-04-08 (annotated)
- Committer:
- yusuke_kyo
- Date:
- Wed Apr 08 08:04:18 2015 +0000
- Revision:
- 98:01a414ca7d6d
- Parent:
- 96:487b796308b0
remove SerialHalfDuplex.h
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 96:487b796308b0 | 1 | /** |
Kojto | 96:487b796308b0 | 2 | ****************************************************************************** |
Kojto | 96:487b796308b0 | 3 | * @file stm32f1xx_hal_hcd.h |
Kojto | 96:487b796308b0 | 4 | * @author MCD Application Team |
Kojto | 96:487b796308b0 | 5 | * @version V1.0.0 |
Kojto | 96:487b796308b0 | 6 | * @date 15-December-2014 |
Kojto | 96:487b796308b0 | 7 | * @brief Header file of HCD HAL module. |
Kojto | 96:487b796308b0 | 8 | ****************************************************************************** |
Kojto | 96:487b796308b0 | 9 | * @attention |
Kojto | 96:487b796308b0 | 10 | * |
Kojto | 96:487b796308b0 | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
Kojto | 96:487b796308b0 | 12 | * |
Kojto | 96:487b796308b0 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 96:487b796308b0 | 14 | * are permitted provided that the following conditions are met: |
Kojto | 96:487b796308b0 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 96:487b796308b0 | 16 | * this list of conditions and the following disclaimer. |
Kojto | 96:487b796308b0 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 96:487b796308b0 | 18 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 96:487b796308b0 | 19 | * and/or other materials provided with the distribution. |
Kojto | 96:487b796308b0 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 96:487b796308b0 | 21 | * may be used to endorse or promote products derived from this software |
Kojto | 96:487b796308b0 | 22 | * without specific prior written permission. |
Kojto | 96:487b796308b0 | 23 | * |
Kojto | 96:487b796308b0 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 96:487b796308b0 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 96:487b796308b0 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 96:487b796308b0 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 96:487b796308b0 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 96:487b796308b0 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 96:487b796308b0 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 96:487b796308b0 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 96:487b796308b0 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 96:487b796308b0 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 96:487b796308b0 | 34 | * |
Kojto | 96:487b796308b0 | 35 | ****************************************************************************** |
Kojto | 96:487b796308b0 | 36 | */ |
Kojto | 96:487b796308b0 | 37 | |
Kojto | 96:487b796308b0 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 96:487b796308b0 | 39 | #ifndef __STM32F1xx_HAL_HCD_H |
Kojto | 96:487b796308b0 | 40 | #define __STM32F1xx_HAL_HCD_H |
Kojto | 96:487b796308b0 | 41 | |
Kojto | 96:487b796308b0 | 42 | #ifdef __cplusplus |
Kojto | 96:487b796308b0 | 43 | extern "C" { |
Kojto | 96:487b796308b0 | 44 | #endif |
Kojto | 96:487b796308b0 | 45 | |
Kojto | 96:487b796308b0 | 46 | #if defined(STM32F105xC) || defined(STM32F107xC) |
Kojto | 96:487b796308b0 | 47 | |
Kojto | 96:487b796308b0 | 48 | |
Kojto | 96:487b796308b0 | 49 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 96:487b796308b0 | 50 | #include "stm32f1xx_ll_usb.h" |
Kojto | 96:487b796308b0 | 51 | |
Kojto | 96:487b796308b0 | 52 | /** @addtogroup STM32F1xx_HAL_Driver |
Kojto | 96:487b796308b0 | 53 | * @{ |
Kojto | 96:487b796308b0 | 54 | */ |
Kojto | 96:487b796308b0 | 55 | |
Kojto | 96:487b796308b0 | 56 | /** @addtogroup HCD |
Kojto | 96:487b796308b0 | 57 | * @{ |
Kojto | 96:487b796308b0 | 58 | */ |
Kojto | 96:487b796308b0 | 59 | |
Kojto | 96:487b796308b0 | 60 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 96:487b796308b0 | 61 | /** @defgroup HCD_Exported_Types HCD Exported Types |
Kojto | 96:487b796308b0 | 62 | * @{ |
Kojto | 96:487b796308b0 | 63 | */ |
Kojto | 96:487b796308b0 | 64 | |
Kojto | 96:487b796308b0 | 65 | /** |
Kojto | 96:487b796308b0 | 66 | * @brief HCD Status structure definition |
Kojto | 96:487b796308b0 | 67 | */ |
Kojto | 96:487b796308b0 | 68 | typedef enum |
Kojto | 96:487b796308b0 | 69 | { |
Kojto | 96:487b796308b0 | 70 | HAL_HCD_STATE_RESET = 0x00, |
Kojto | 96:487b796308b0 | 71 | HAL_HCD_STATE_READY = 0x01, |
Kojto | 96:487b796308b0 | 72 | HAL_HCD_STATE_ERROR = 0x02, |
Kojto | 96:487b796308b0 | 73 | HAL_HCD_STATE_BUSY = 0x03, |
Kojto | 96:487b796308b0 | 74 | HAL_HCD_STATE_TIMEOUT = 0x04 |
Kojto | 96:487b796308b0 | 75 | } HCD_StateTypeDef; |
Kojto | 96:487b796308b0 | 76 | |
Kojto | 96:487b796308b0 | 77 | typedef USB_OTG_GlobalTypeDef HCD_TypeDef; |
Kojto | 96:487b796308b0 | 78 | typedef USB_OTG_CfgTypeDef HCD_InitTypeDef; |
Kojto | 96:487b796308b0 | 79 | typedef USB_OTG_HCTypeDef HCD_HCTypeDef; |
Kojto | 96:487b796308b0 | 80 | typedef USB_OTG_URBStateTypeDef HCD_URBStateTypeDef; |
Kojto | 96:487b796308b0 | 81 | typedef USB_OTG_HCStateTypeDef HCD_HCStateTypeDef; |
Kojto | 96:487b796308b0 | 82 | |
Kojto | 96:487b796308b0 | 83 | /** |
Kojto | 96:487b796308b0 | 84 | * @brief HCD Handle Structure definition |
Kojto | 96:487b796308b0 | 85 | */ |
Kojto | 96:487b796308b0 | 86 | typedef struct |
Kojto | 96:487b796308b0 | 87 | { |
Kojto | 96:487b796308b0 | 88 | HCD_TypeDef *Instance; /*!< Register base address */ |
Kojto | 96:487b796308b0 | 89 | HCD_InitTypeDef Init; /*!< HCD required parameters */ |
Kojto | 96:487b796308b0 | 90 | HCD_HCTypeDef hc[15]; /*!< Host channels parameters */ |
Kojto | 96:487b796308b0 | 91 | HAL_LockTypeDef Lock; /*!< HCD peripheral status */ |
Kojto | 96:487b796308b0 | 92 | __IO HCD_StateTypeDef State; /*!< HCD communication state */ |
Kojto | 96:487b796308b0 | 93 | void *pData; /*!< Pointer Stack Handler */ |
Kojto | 96:487b796308b0 | 94 | } HCD_HandleTypeDef; |
Kojto | 96:487b796308b0 | 95 | |
Kojto | 96:487b796308b0 | 96 | /** |
Kojto | 96:487b796308b0 | 97 | * @} |
Kojto | 96:487b796308b0 | 98 | */ |
Kojto | 96:487b796308b0 | 99 | |
Kojto | 96:487b796308b0 | 100 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 96:487b796308b0 | 101 | /** @defgroup HCD_Exported_Constants HCD Exported Constants |
Kojto | 96:487b796308b0 | 102 | * @{ |
Kojto | 96:487b796308b0 | 103 | */ |
Kojto | 96:487b796308b0 | 104 | /** @defgroup HCD_Speed HCD Speed |
Kojto | 96:487b796308b0 | 105 | * @{ |
Kojto | 96:487b796308b0 | 106 | */ |
Kojto | 96:487b796308b0 | 107 | #define HCD_SPEED_LOW 2 |
Kojto | 96:487b796308b0 | 108 | #define HCD_SPEED_FULL 3 |
Kojto | 96:487b796308b0 | 109 | |
Kojto | 96:487b796308b0 | 110 | /** |
Kojto | 96:487b796308b0 | 111 | * @} |
Kojto | 96:487b796308b0 | 112 | */ |
Kojto | 96:487b796308b0 | 113 | |
Kojto | 96:487b796308b0 | 114 | /** |
Kojto | 96:487b796308b0 | 115 | * @} |
Kojto | 96:487b796308b0 | 116 | */ |
Kojto | 96:487b796308b0 | 117 | |
Kojto | 96:487b796308b0 | 118 | /* Exported macro ------------------------------------------------------------*/ |
Kojto | 96:487b796308b0 | 119 | /** @defgroup HCD_Exported_Macros HCD Exported Macros |
Kojto | 96:487b796308b0 | 120 | * @brief macros to handle interrupts and specific clock configurations |
Kojto | 96:487b796308b0 | 121 | * @{ |
Kojto | 96:487b796308b0 | 122 | */ |
Kojto | 96:487b796308b0 | 123 | #define __HAL_HCD_ENABLE(__HANDLE__) USB_EnableGlobalInt ((__HANDLE__)->Instance) |
Kojto | 96:487b796308b0 | 124 | #define __HAL_HCD_DISABLE(__HANDLE__) USB_DisableGlobalInt ((__HANDLE__)->Instance) |
Kojto | 96:487b796308b0 | 125 | |
Kojto | 96:487b796308b0 | 126 | |
Kojto | 96:487b796308b0 | 127 | #define __HAL_HCD_GET_FLAG(__HANDLE__, __INTERRUPT__) ((USB_ReadInterrupts((__HANDLE__)->Instance) & (__INTERRUPT__)) == (__INTERRUPT__)) |
Kojto | 96:487b796308b0 | 128 | #define __HAL_HCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->GINTSTS) = (__INTERRUPT__)) |
Kojto | 96:487b796308b0 | 129 | #define __HAL_HCD_IS_INVALID_INTERRUPT(__HANDLE__) (USB_ReadInterrupts((__HANDLE__)->Instance) == 0) |
Kojto | 96:487b796308b0 | 130 | |
Kojto | 96:487b796308b0 | 131 | |
Kojto | 96:487b796308b0 | 132 | #define __HAL_HCD_CLEAR_HC_INT(chnum, __INTERRUPT__) (USBx_HC(chnum)->HCINT = (__INTERRUPT__)) |
Kojto | 96:487b796308b0 | 133 | #define __HAL_HCD_MASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_CHHM) |
Kojto | 96:487b796308b0 | 134 | #define __HAL_HCD_UNMASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_CHHM) |
Kojto | 96:487b796308b0 | 135 | #define __HAL_HCD_MASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_ACKM) |
Kojto | 96:487b796308b0 | 136 | #define __HAL_HCD_UNMASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_ACKM) |
Kojto | 96:487b796308b0 | 137 | |
Kojto | 96:487b796308b0 | 138 | /** |
Kojto | 96:487b796308b0 | 139 | * @} |
Kojto | 96:487b796308b0 | 140 | */ |
Kojto | 96:487b796308b0 | 141 | |
Kojto | 96:487b796308b0 | 142 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 96:487b796308b0 | 143 | /** @addtogroup HCD_Exported_Functions HCD Exported Functions |
Kojto | 96:487b796308b0 | 144 | * @{ |
Kojto | 96:487b796308b0 | 145 | */ |
Kojto | 96:487b796308b0 | 146 | |
Kojto | 96:487b796308b0 | 147 | /* Initialization/de-initialization functions ********************************/ |
Kojto | 96:487b796308b0 | 148 | /** @addtogroup HCD_Exported_Functions_Group1 Initialization and de-initialization functions |
Kojto | 96:487b796308b0 | 149 | * @{ |
Kojto | 96:487b796308b0 | 150 | */ |
Kojto | 96:487b796308b0 | 151 | HAL_StatusTypeDef HAL_HCD_Init(HCD_HandleTypeDef *hhcd); |
Kojto | 96:487b796308b0 | 152 | HAL_StatusTypeDef HAL_HCD_DeInit (HCD_HandleTypeDef *hhcd); |
Kojto | 96:487b796308b0 | 153 | HAL_StatusTypeDef HAL_HCD_HC_Init(HCD_HandleTypeDef *hhcd, |
Kojto | 96:487b796308b0 | 154 | uint8_t ch_num, |
Kojto | 96:487b796308b0 | 155 | uint8_t epnum, |
Kojto | 96:487b796308b0 | 156 | uint8_t dev_address, |
Kojto | 96:487b796308b0 | 157 | uint8_t speed, |
Kojto | 96:487b796308b0 | 158 | uint8_t ep_type, |
Kojto | 96:487b796308b0 | 159 | uint16_t mps); |
Kojto | 96:487b796308b0 | 160 | |
Kojto | 96:487b796308b0 | 161 | HAL_StatusTypeDef HAL_HCD_HC_Halt(HCD_HandleTypeDef *hhcd, |
Kojto | 96:487b796308b0 | 162 | uint8_t ch_num); |
Kojto | 96:487b796308b0 | 163 | |
Kojto | 96:487b796308b0 | 164 | void HAL_HCD_MspInit(HCD_HandleTypeDef *hhcd); |
Kojto | 96:487b796308b0 | 165 | void HAL_HCD_MspDeInit(HCD_HandleTypeDef *hhcd); |
Kojto | 96:487b796308b0 | 166 | /** |
Kojto | 96:487b796308b0 | 167 | * @} |
Kojto | 96:487b796308b0 | 168 | */ |
Kojto | 96:487b796308b0 | 169 | |
Kojto | 96:487b796308b0 | 170 | /* I/O operation functions ***************************************************/ |
Kojto | 96:487b796308b0 | 171 | /** @addtogroup HCD_Exported_Functions_Group2 IO operation functions |
Kojto | 96:487b796308b0 | 172 | * @{ |
Kojto | 96:487b796308b0 | 173 | */ |
Kojto | 96:487b796308b0 | 174 | HAL_StatusTypeDef HAL_HCD_HC_SubmitRequest(HCD_HandleTypeDef *hhcd, |
Kojto | 96:487b796308b0 | 175 | uint8_t pipe, |
Kojto | 96:487b796308b0 | 176 | uint8_t direction, |
Kojto | 96:487b796308b0 | 177 | uint8_t ep_type, |
Kojto | 96:487b796308b0 | 178 | uint8_t token, |
Kojto | 96:487b796308b0 | 179 | uint8_t* pbuff, |
Kojto | 96:487b796308b0 | 180 | uint16_t length, |
Kojto | 96:487b796308b0 | 181 | uint8_t do_ping); |
Kojto | 96:487b796308b0 | 182 | |
Kojto | 96:487b796308b0 | 183 | /* Non-Blocking mode: Interrupt */ |
Kojto | 96:487b796308b0 | 184 | void HAL_HCD_IRQHandler(HCD_HandleTypeDef *hhcd); |
Kojto | 96:487b796308b0 | 185 | void HAL_HCD_SOF_Callback(HCD_HandleTypeDef *hhcd); |
Kojto | 96:487b796308b0 | 186 | void HAL_HCD_Connect_Callback(HCD_HandleTypeDef *hhcd); |
Kojto | 96:487b796308b0 | 187 | void HAL_HCD_Disconnect_Callback(HCD_HandleTypeDef *hhcd); |
Kojto | 96:487b796308b0 | 188 | void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *hhcd, |
Kojto | 96:487b796308b0 | 189 | uint8_t chnum, |
Kojto | 96:487b796308b0 | 190 | HCD_URBStateTypeDef urb_state); |
Kojto | 96:487b796308b0 | 191 | /** |
Kojto | 96:487b796308b0 | 192 | * @} |
Kojto | 96:487b796308b0 | 193 | */ |
Kojto | 96:487b796308b0 | 194 | /* Peripheral Control functions **********************************************/ |
Kojto | 96:487b796308b0 | 195 | /** @addtogroup HCD_Exported_Functions_Group3 Peripheral Control functions |
Kojto | 96:487b796308b0 | 196 | * @{ |
Kojto | 96:487b796308b0 | 197 | */ |
Kojto | 96:487b796308b0 | 198 | HAL_StatusTypeDef HAL_HCD_ResetPort(HCD_HandleTypeDef *hhcd); |
Kojto | 96:487b796308b0 | 199 | HAL_StatusTypeDef HAL_HCD_Start(HCD_HandleTypeDef *hhcd); |
Kojto | 96:487b796308b0 | 200 | HAL_StatusTypeDef HAL_HCD_Stop(HCD_HandleTypeDef *hhcd); |
Kojto | 96:487b796308b0 | 201 | /** |
Kojto | 96:487b796308b0 | 202 | * @} |
Kojto | 96:487b796308b0 | 203 | */ |
Kojto | 96:487b796308b0 | 204 | /* Peripheral State functions ************************************************/ |
Kojto | 96:487b796308b0 | 205 | /** @addtogroup HCD_Exported_Functions_Group4 Peripheral State functions |
Kojto | 96:487b796308b0 | 206 | * @{ |
Kojto | 96:487b796308b0 | 207 | */ |
Kojto | 96:487b796308b0 | 208 | HCD_StateTypeDef HAL_HCD_GetState(HCD_HandleTypeDef *hhcd); |
Kojto | 96:487b796308b0 | 209 | HCD_URBStateTypeDef HAL_HCD_HC_GetURBState(HCD_HandleTypeDef *hhcd, uint8_t chnum); |
Kojto | 96:487b796308b0 | 210 | uint32_t HAL_HCD_HC_GetXferCount(HCD_HandleTypeDef *hhcd, uint8_t chnum); |
Kojto | 96:487b796308b0 | 211 | HCD_HCStateTypeDef HAL_HCD_HC_GetState(HCD_HandleTypeDef *hhcd, uint8_t chnum); |
Kojto | 96:487b796308b0 | 212 | uint32_t HAL_HCD_GetCurrentFrame(HCD_HandleTypeDef *hhcd); |
Kojto | 96:487b796308b0 | 213 | uint32_t HAL_HCD_GetCurrentSpeed(HCD_HandleTypeDef *hhcd); |
Kojto | 96:487b796308b0 | 214 | /** |
Kojto | 96:487b796308b0 | 215 | * @} |
Kojto | 96:487b796308b0 | 216 | */ |
Kojto | 96:487b796308b0 | 217 | |
Kojto | 96:487b796308b0 | 218 | /** |
Kojto | 96:487b796308b0 | 219 | * @} |
Kojto | 96:487b796308b0 | 220 | */ |
Kojto | 96:487b796308b0 | 221 | |
Kojto | 96:487b796308b0 | 222 | /* Private macros ------------------------------------------------------------*/ |
Kojto | 96:487b796308b0 | 223 | /** @defgroup HCD_Private_Macros HCD Private Macros |
Kojto | 96:487b796308b0 | 224 | * @{ |
Kojto | 96:487b796308b0 | 225 | */ |
Kojto | 96:487b796308b0 | 226 | /** @defgroup HCD_Instance_definition HCD Instance definition |
Kojto | 96:487b796308b0 | 227 | * @{ |
Kojto | 96:487b796308b0 | 228 | */ |
Kojto | 96:487b796308b0 | 229 | #define IS_HCD_ALL_INSTANCE(INSTANCE) (((INSTANCE) == USB_OTG_FS)) |
Kojto | 96:487b796308b0 | 230 | /** |
Kojto | 96:487b796308b0 | 231 | * @} |
Kojto | 96:487b796308b0 | 232 | */ |
Kojto | 96:487b796308b0 | 233 | /** |
Kojto | 96:487b796308b0 | 234 | * @} |
Kojto | 96:487b796308b0 | 235 | */ |
Kojto | 96:487b796308b0 | 236 | |
Kojto | 96:487b796308b0 | 237 | /** |
Kojto | 96:487b796308b0 | 238 | * @} |
Kojto | 96:487b796308b0 | 239 | */ |
Kojto | 96:487b796308b0 | 240 | |
Kojto | 96:487b796308b0 | 241 | /** |
Kojto | 96:487b796308b0 | 242 | * @} |
Kojto | 96:487b796308b0 | 243 | */ |
Kojto | 96:487b796308b0 | 244 | |
Kojto | 96:487b796308b0 | 245 | #endif /* STM32F105xC || STM32F107xC */ |
Kojto | 96:487b796308b0 | 246 | |
Kojto | 96:487b796308b0 | 247 | |
Kojto | 96:487b796308b0 | 248 | #ifdef __cplusplus |
Kojto | 96:487b796308b0 | 249 | } |
Kojto | 96:487b796308b0 | 250 | #endif |
Kojto | 96:487b796308b0 | 251 | |
Kojto | 96:487b796308b0 | 252 | #endif /* __STM32F1xx_HAL_HCD_H */ |
Kojto | 96:487b796308b0 | 253 | |
Kojto | 96:487b796308b0 | 254 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |