usbd_init.h 2.8 KB
Newer Older
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 112 113 114 115 116
/*!
 * @file        usbd_init.h
 *
 * @brief       USB initialization management head file
 *
 * @version     V1.0.1
 *
 * @date        2022-09-20
 *
 * @attention
 *
 *  Copyright (C) 2020-2022 Geehy Semiconductor
 *
 *  You may not use this file except in compliance with the
 *  GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
 *
 *  The program is only for reference, which is distributed in the hope
 *  that it will be useful and instructional for customers to develop
 *  their software. Unless required by applicable law or agreed to in
 *  writing, the program is distributed on an "AS IS" BASIS, WITHOUT
 *  ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
 *  and limitations under the License.
 */

/* Define to prevent recursive inclusion */
#ifndef USBD_INIT_H_
#define USBD_INIT_H_

/* Includes */
#include "usbd_core.h"

/** @addtogroup USB_Driver_Library USB Driver Library
  @{
*/

/** @addtogroup Core_Device Core Device
  @{
*/

/** @addtogroup Standrad
  @{
*/

/** @addtogroup Init
  @{
*/

/** @defgroup Init_Macros Macros
  @{
*/

/**@} end of group Init_Macros */

/** @defgroup Init_Enumerations Enumerations
  @{
*/

/**@} end of group Init_Enumerations */

/** @defgroup Init_Structures Structures
  @{
*/

/**
 * @brief   Endpoint Configuration Info
 */
typedef struct
{
    USBD_EP_T      epNum;      /*!< endpoint number */
    USBD_EP_TYPE_T epType;     /*!< endpoint type */
    uint8_t        epKind;     /**
                                * Which could be ENABLE or DISABLE, it is valid only for
                                * control and bulk Endpoint. The mean of ENABLE for them like :
                                * 1. Control endpoint : Only for OUT status which is zero data.
                                * 2. Bulk endpoint : Enable the double-buffer feature
                                */
    USBD_EP_STATUS_T epStatus; /*!< Endpoint status */
    uint16_t epBufAddr;        /*!< buffer address for the endpoint */
    uint16_t maxPackSize;      /*!< max packet size for the endpoint */
} USBD_EPConfig_T;

/**@} end of group Init_Structures */

/** @defgroup Init_Variables Variables
  @{
*/

/**@} end of group Init_Variables */

/** @defgroup Init_Functions Functions
  @{
*/

/* USB init */
void USBD_Init(USBD_InitParam_T* param);
void USBD_InitParamStructInit(USBD_InitParam_T* param);

/* power */
void USBD_PowerOn(void);
void USBD_PowerOff(void);

/* Endpoint init */
void USBD_OpenOutEP(USBD_EPConfig_T* epConfig);
void USBD_OpenInEP(USBD_EPConfig_T* epConfig);

void USBD_CloseOutEP(USBD_EP_T ep);
void USBD_CloseInEP(USBD_EP_T ep);

#endif

/**@} end of group Init_Functions */
/**@} end of group Init */
/**@} end of group Standard */
/**@} end of groupInit_Device */
/**@} end of group USB_Driver_Library */