PSoC 6 Peripheral Driver Library
Initialization Functions

General Description

The Initialization functions provide an API to begin the USBFS driver operation (configure and enable) and to stop operation (disable and de-initialize).

Functions

cy_en_usbfs_dev_drv_status_t Cy_USBFS_Dev_Drv_Init (USBFS_Type *base, cy_stc_usbfs_dev_drv_config_t const *config, cy_stc_usbfs_dev_drv_context_t *context)
 Initializes the USBFS in device mode. More...
 
void Cy_USBFS_Dev_Drv_DeInit (USBFS_Type *base, cy_stc_usbfs_dev_drv_context_t *context)
 De-initializes the USBFS Device hardware (returns the register values to default) and removes all registered callbacks. More...
 
void Cy_USBFS_Dev_Drv_Enable (USBFS_Type *base, cy_stc_usbfs_dev_drv_context_t const *context)
 Enables the USBFS Device operation. More...
 
void Cy_USBFS_Dev_Drv_Disable (USBFS_Type *base, cy_stc_usbfs_dev_drv_context_t *context)
 Disables the USBFS Device operation. More...
 
__STATIC_INLINE void Cy_USBFS_Dev_Drv_SetAddress (USBFS_Type *base, uint8_t address, cy_stc_usbfs_dev_drv_context_t *context)
 Posts a request to set the device address after the completion status stage of the control transfer. More...
 
__STATIC_INLINE void Cy_USBFS_Dev_Drv_SetDeviceAddress (USBFS_Type *base, uint8_t address)
 Sets the device address (writes the address directly into the register). More...
 
__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetDeviceAddress (USBFS_Type const *base)
 Returns the device address (reads the address directly from the register). More...
 
__STATIC_INLINE void Cy_USBFS_Dev_Drv_SetDevContext (USBFS_Type const *base, void *devContext, cy_stc_usbfs_dev_drv_context_t *context)
 Stores a pointer to the USB Device context in the driver context. More...
 
__STATIC_INLINE void * Cy_USBFS_Dev_Drv_GetDevContext (USBFS_Type const *base, cy_stc_usbfs_dev_drv_context_t *context)
 Returns a pointer to the USB Device context. More...
 
void Cy_USBFS_Dev_Drv_ConfigDevice (USBFS_Type *base, cy_stc_usbfs_dev_drv_context_t *context)
 Sets the basic device configuration (clears previous configuration). More...
 
void Cy_USBFS_Dev_Drv_UnConfigureDevice (USBFS_Type *base, cy_stc_usbfs_dev_drv_context_t *context)
 Clears device configuration. More...
 

Function Documentation

◆ Cy_USBFS_Dev_Drv_Init()

cy_en_usbfs_dev_drv_status_t Cy_USBFS_Dev_Drv_Init ( USBFS_Type *  base,
cy_stc_usbfs_dev_drv_config_t const *  config,
cy_stc_usbfs_dev_drv_context_t context 
)

Initializes the USBFS in device mode.

If DMAs are used, initialize the DMAs.

Parameters
baseThe pointer to the USBFS instance.
configThe pointer to the configuration structure cy_stc_usbfs_dev_drv_config_t.
contextThe pointer to the context structure cy_stc_usbfs_dev_drv_context_t allocated by the user. The structure is used during the USBFS Device operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
The status code of the function execution cy_en_usbfs_dev_drv_status_t.

◆ Cy_USBFS_Dev_Drv_DeInit()

void Cy_USBFS_Dev_Drv_DeInit ( USBFS_Type *  base,
cy_stc_usbfs_dev_drv_context_t context 
)

De-initializes the USBFS Device hardware (returns the register values to default) and removes all registered callbacks.

Parameters
baseThe pointer to the USBFS instance.
contextThe pointer to the context structure cy_stc_usbfs_dev_drv_context_t allocated by the user. The structure is used during the USBFS Device operation for internal configuration and data retention. The user must not modify anything in this structure.

◆ Cy_USBFS_Dev_Drv_Enable()

void Cy_USBFS_Dev_Drv_Enable ( USBFS_Type *  base,
cy_stc_usbfs_dev_drv_context_t const *  context 
)

Enables the USBFS Device operation.

Parameters
baseThe pointer to the USBFS instance.
contextThe pointer to the context structure cy_stc_usbfs_dev_drv_context_t allocated by the user. The structure is used during the USBFS Device operation for internal configuration and data retention. The user must not modify anything in this structure.

◆ Cy_USBFS_Dev_Drv_Disable()

void Cy_USBFS_Dev_Drv_Disable ( USBFS_Type *  base,
cy_stc_usbfs_dev_drv_context_t context 
)

Disables the USBFS Device operation.

If DMAs are used, disables the DMAs.

Parameters
baseThe pointer to the USBFS instance.
contextThe pointer to the context structure cy_stc_usbfs_dev_drv_context_t allocated by the user. The structure is used during the USBFS Device operation for internal configuration and data retention. The user must not modify anything in this structure.

◆ Cy_USBFS_Dev_Drv_SetAddress()

__STATIC_INLINE void Cy_USBFS_Dev_Drv_SetAddress ( USBFS_Type *  base,
uint8_t  address,
cy_stc_usbfs_dev_drv_context_t context 
)

Posts a request to set the device address after the completion status stage of the control transfer.

This function must be used if a higher level requests to set an address before the status stage of the control transfer.

Parameters
baseThe pointer to the USBFS instance.
addressThe device address.
contextThe pointer to the context structure cy_stc_usbfs_dev_drv_context_t allocated by the user. The structure is used during the USBFS Device operation for internal configuration and data retention. The user must not modify anything in this structure.

◆ Cy_USBFS_Dev_Drv_SetDeviceAddress()

__STATIC_INLINE void Cy_USBFS_Dev_Drv_SetDeviceAddress ( USBFS_Type *  base,
uint8_t  address 
)

Sets the device address (writes the address directly into the register).

Parameters
baseThe pointer to the USBFS instance.
addressDevice address.

◆ Cy_USBFS_Dev_Drv_GetDeviceAddress()

__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetDeviceAddress ( USBFS_Type const *  base)

Returns the device address (reads the address directly from the register).

Parameters
baseThe pointer to the USBFS instance.
Returns
The device address. The device address is assigned by the Host during device enumeration. Zero means that the device address is not assigned.

◆ Cy_USBFS_Dev_Drv_SetDevContext()

__STATIC_INLINE void Cy_USBFS_Dev_Drv_SetDevContext ( USBFS_Type const *  base,
void *  devContext,
cy_stc_usbfs_dev_drv_context_t context 
)

Stores a pointer to the USB Device context in the driver context.

Parameters
baseThe pointer to the USBFS instance
devContextThe pointer to the USB Device context structure.
contextThe pointer to the context structure cy_stc_usbfs_dev_drv_context_t allocated by the user. The structure is used during the USBFS Device operation for internal configuration and data retention. The user must not modify anything in this structure.
Note
This function is intended for the USB Device middleware operation.

◆ Cy_USBFS_Dev_Drv_GetDevContext()

__STATIC_INLINE void * Cy_USBFS_Dev_Drv_GetDevContext ( USBFS_Type const *  base,
cy_stc_usbfs_dev_drv_context_t context 
)

Returns a pointer to the USB Device context.

Parameters
baseThe pointer to the USBFS instance.
contextThe pointer to the context structure cy_stc_usbfs_dev_drv_context_t allocated by the user. The structure is used during USBFS Device operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
The pointer to the USB Device context.
Note
This function is intended for the USB Device middleware operation.

◆ Cy_USBFS_Dev_Drv_ConfigDevice()

void Cy_USBFS_Dev_Drv_ConfigDevice ( USBFS_Type *  base,
cy_stc_usbfs_dev_drv_context_t context 
)

Sets the basic device configuration (clears previous configuration).

Call this function after the endpoints were configured to complete the device configuration.

Parameters
baseThe pointer to the USBFS instance.
contextThe pointer to the context structure cy_stc_usbfs_dev_drv_context_t allocated by the user. The structure is used during the USBFS Device operation for internal configuration and data retention. The user must not modify anything in this structure.

◆ Cy_USBFS_Dev_Drv_UnConfigureDevice()

void Cy_USBFS_Dev_Drv_UnConfigureDevice ( USBFS_Type *  base,
cy_stc_usbfs_dev_drv_context_t context 
)

Clears device configuration.

Call this function before setting a configuration or a configuration failure to set the configuration into the default state. Alternately, call Cy_USBFS_Dev_Drv_RemoveEndpoint for each active endpoint.

Parameters
baseThe pointer to the USBFS instance.
contextThe pointer to the context structure cy_stc_usbfs_dev_drv_context_t allocated by the user. The structure is used during the USBFS Device operation for internal configuration and data retention. The user must not modify anything in this structure.