Macros
USB Exported Macros
Peripheral Driver » HAL Driver » USB » Defines
Collaboration diagram for USB Exported Macros:

## Macros
#define | __HAL_USB_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_USB_STATE_RESET)
| Reset USB handle states. More...
#define | __HAL_USB_ENABLE() ll_usb_enable()
| Enable the specified USB peripheral. More...
#define | __HAL_USB_DISABLE() ll_usb_disable()
| Disable the specified USB peripheral. More...
#define | __HAL_USB_ENABLE_SW_RST() SET_BITS(MCU_SUB->USB_SW_RST, MCU_SUB_USB_SW_RST_EN)
| Enable the specified USB peripheral software reset. More...
#define | __HAL_USB_DISABLE_SW_RST() CLEAR_BITS(MCU_SUB->USB_SW_RST, MCU_SUB_USB_SW_RST_EN)
| Disable the specified USB peripheral software reset. More...
#define | __HAL_USB_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BITS((__HANDLE__)->p_instance->INT_EN, (__INTERRUPT__))
| Enable the specified USB interrupts. More...
#define | __HAL_USB_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BITS((__HANDLE__)->p_instance->INT_EN, (__INTERRUPT__))
| Disable the specified USB interrupts. More...
#define | __HAL_USB_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->INT_STAT, (__FLAG__)) != 0) ? SET : RESET)
| Check whether the specified USB flag is set or not. More...
#define | __HAL_USB_CLEAR_FLAG(__HANDLE__, __FLAG__) SET_BITS((__HANDLE__)->p_instance->INT_CLR, (__FLAG__))
| Clear the specified USB flag. More...
#define | __HAL_USB_GET_EP0_OUT_DAT_RDY(__HANDLE__) ((READ_BITS((__HANDLE__)->p_instance->CTRL, USB_CTRL_EP0_OUT_DATA_RDY) != 0) ? SET : RESET)
| Check whether the specified USB flag is set or not. More...
#define | __HAL_USB_ENABLE_ADDR_STAT(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL,USB_CTRL_ADDR_STAT)
| Enable the specified USB in addressed status. More...
#define | __HAL_USB_ENABLE_CFG_STAT(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL,USB_CTRL_CFG_STAT)
| Enable the specified USB in configured status. More...
#define | __HAL_USB_CLEAR_EP0_IFIFO(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->EP0_1_CTRL,USB_EP0_CTRL_IFIFO_CLR)
| clear the specified USB EP0 IN FIFO. More...
#define | __HAL_USB_CLEAR_EP1_IFIFO(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->EP0_1_CTRL,USB_EP1_CTRL_IFIFO_CLR)
| clear the specified USB EP1 IN FIFO. More...
#define | __HAL_USB_ENABLE_DEV_REMOTE_WAKEUP(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL,USB_CTRL_DEV_REMOTE_WAKEUP)
| Enable the specified USB device remote_wakeup feature. More...
#define | __HAL_USB_DISABLE_DEV_REMOTE_WAKEUP(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL,USB_CTRL_DEV_REMOTE_WAKEUP)
| Disable the specified USB device remote_wakeup feature. More...
#define | __HAL_USB_ENABLE_EP5_DMA_READ(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->EP5_CTRL,USB_EP5_CTRL_AHBM_EN)
| Enable the specified USB EP5 DMA READ. More...
#define | __HAL_USB_DISABLE_EP5_DMA_READ(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->EP5_CTRL,USB_EP5_CTRL_AHBM_EN)
| Disable the specified USB EP5 DMA READ. More...
#define | __HAL_USB_SET_EP5_TIMER_VAL(__HANDLE__, __VAL__) MODIFY_REG((__HANDLE__)->p_instance->EP5_TIMER, USB_EP5_TIMER_VAL, (__VAL__));
| Set USB ep5 DMA recieve data time out value. More...
#define | __HAL_USB_SET_EP4_BURST_SIZE(__HANDLE__, __VAL__)
| Set USB ep4 DMA burst size value. More...

## Detailed Description

## Macro Definition Documentation

## ◆ __HAL_USB_CLEAR_EP0_IFIFO

#define __HAL_USB_CLEAR_EP0_IFIFO | ( |  | __HANDLE__ | ) | SET_BITS((__HANDLE__)->p_instance->EP0_1_CTRL,USB_EP0_CTRL_IFIFO_CLR)

clear the specified USB EP0 IN FIFO.

Parameters

  <strong>HANDLE</strong> | Specifies the USB Handle.

Return values

  None |

Definition at line 652 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_CLEAR_EP1_IFIFO

#define __HAL_USB_CLEAR_EP1_IFIFO | ( |  | __HANDLE__ | ) | SET_BITS((__HANDLE__)->p_instance->EP0_1_CTRL,USB_EP1_CTRL_IFIFO_CLR)

clear the specified USB EP1 IN FIFO.

Parameters

  <strong>HANDLE</strong> | Specifies the USB Handle.

Return values

  None |

Definition at line 658 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_CLEAR_FLAG

#define __HAL_USB_CLEAR_FLAG | ( |  | __HANDLE__,
|  |  | __FLAG__
| ) |  | SET_BITS((__HANDLE__)->p_instance->INT_CLR, (__FLAG__))

Clear the specified USB flag.

Parameters

  <strong>HANDLE</strong> | Specifies the USB Handle.
  <strong>FLAG</strong> | Specifies the flag to check. This parameter can be one of the following values: USB_IT_CLR_ALL USB all clear USB_IT_CLR_SUSPEND USB suspend status clear USB_IT_CLR_EP0_OUT_READY USB ep0 data out ready clear USB_IT_CLR_EP1_OUT_READY USB ep1 data out ready clear USB_IT_CLR_CRC16_ERR USB receive CRC error data clear USB_IT_CLR_UPID_ERR USB receive unsupported PID clear USB_IT_CLR_TIMEOUT_ERR USB rx/tx timeout error clear USB_IT_CLR_SEQ_ERR USB DATA0/DATA1 PID sequence error clear USB_IT_CLR_PID_CKS_ERR USB PID checksum error clear USB_IT_CLR_PID_CRC_ERR USB PID CRC error clear USB_IT_CLR_HOST_RESET USB host reset clear USB_IT_CLR_AHB_XFER_ERR USB ep3 and ep4 AHB master receive ERROR response clear USB_IT_CLR_NSE_ERR USB no such endpoint error clear USB_IT_CLR_EP3_AHB_XFER_DONE USB ep3 AHB master transfer done clear USB_IT_CLR_SYNC_ERR USB SYNC error flag USB_IT_CLR_BIT_STUFF_ERR USB bit stuff error clear USB_IT_CLR_BYTE_ERR USB byte error clear USB_IT_CLR_SOF USB SOF clear USB_IT_CLR_EP0_TX_DONE USB ep0 TX done clear USB_IT_CLR_EP2_TX_DONE USB ep2 TX done clear USB_IT_CLR_EP3_TX_DONE USB ep3 TX done clear USB_IT_CLR_INTO_CONFIG USB into cofig status interrupt clear USB_IT_CLR_EP5_OUT_READY USB ep5 data out ready interrupt clear USB_IT_CLR_EP4_AHB_XFER_DONE USB ep4 AHB master transfer done interrupt clear USB_IT_CLR_EP4_TX_DONE USB ep4 TX done interrupt clear USB_IT_CLR_EP5_AHB_XFER_DONE USB ep5 AHB master transfer done interrupt clear USB_IT_CLR_EP5_TIMER_OUT_ERR USB ep5 timer out error interrupt clear

Return values

  None |

Definition at line 628 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_DISABLE

#define __HAL_USB_DISABLE | ( |  | ) | ll_usb_disable()

Disable the specified USB peripheral.

Return values

  None |

Definition at line 475 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_DISABLE_DEV_REMOTE_WAKEUP

#define __HAL_USB_DISABLE_DEV_REMOTE_WAKEUP | ( |  | __HANDLE__ | ) | CLEAR_BITS((__HANDLE__)->p_instance->CTRL,USB_CTRL_DEV_REMOTE_WAKEUP)

Disable the specified USB device remote_wakeup feature.

Parameters

  <strong>HANDLE</strong> | Specifies the USB handle.

Return values

  None |

Definition at line 670 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_DISABLE_EP5_DMA_READ

#define __HAL_USB_DISABLE_EP5_DMA_READ | ( |  | __HANDLE__ | ) | CLEAR_BITS((__HANDLE__)->p_instance->EP5_CTRL,USB_EP5_CTRL_AHBM_EN)

Disable the specified USB EP5 DMA READ.

Parameters

  <strong>HANDLE</strong> | Specifies the USB Handle.

Return values

  None |

Definition at line 682 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_DISABLE_IT

#define __HAL_USB_DISABLE_IT | ( |  | __HANDLE__,
|  |  | __INTERRUPT__
| ) |  | CLEAR_BITS((__HANDLE__)->p_instance->INT_EN, (__INTERRUPT__))

Disable the specified USB interrupts.

Parameters

  <strong>HANDLE</strong> | Specifies the USB handle.
  <strong>INTERRUPT</strong> | Specifies the interrupt source to disable. This parameter can be one of the following values: USB_IT_ALL USB all interrupt USB_IT_RESET_VAL interrupt control register rest value USB_IT_SUSPEND USB suspend status interrupt USB_IT_EP0_OUT_READY USB ep0 data out ready interrupt USB_IT_EP1_OUT_READY USB ep1 data out ready interrupt USB_IT_CRC16_ERR USB receive CRC error data interrupt USB_IT_UPID_ERR USB receive unsupported PID interrupt USB_IT_TIMEOUT_ERR USB rx/tx timeout error interrupt USB_IT_SEQ_ERR USB DATA0/DATA1 PID sequence error interrupt USB_IT_PID_CKS_ERR USB PID checksum error interrupt USB_IT_PID_CRC_ERR USB PID CRC error interrupt USB_IT_HOST_RESET USB host reset interrupt USB_IT_AHB_XFER_ERR USB ep3 and ep4 AHB master receive ERROR response interrupt USB_IT_NSE_ERR USB no such endpoint error interrupt USB_IT_EP3_AHB_XFER_DONE USB ep3 AHB master transfer done interrupt USB_IT_SYNC_ERR USB SYNC error interrupt USB_IT_BIT_STUFF_ERR USB bit stuff error interrupt USB_IT_BYTE_ERR USB byte error interrupt USB_IT_SOF USB SOF interrupt USB_IT_EP0_TX_DONE USB ep0 TX done interrupt USB_IT_EP2_TX_DONE USB ep2 TX done interrupt USB_IT_EP3_TX_DONE USB ep3 TX done interrupt USB_IT_EP3_TX_DONE USB ep3 TX done interrupt USB_IT_INTO_CONFIG USB into cofig status interrupt USB_IT_EP5_OUT_READY USB ep5 data out ready interrupt USB_IT_CLR_EP4_AHB_XFER_DONE USB ep4 AHB master transfer done interrupt USB_IT_EP4_TX_DONE USB ep4 TX done interrupt USB_IT_EP5_AHB_XFER_DONE USB ep5 AHB master transfer done interrupt USB_IT_EP5_TIMER_OUT_ERR USB ep5 timer out error interrupt

Return values

  None |

Definition at line 558 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_DISABLE_SW_RST

#define __HAL_USB_DISABLE_SW_RST | ( |  | ) | CLEAR_BITS(MCU_SUB->USB_SW_RST, MCU_SUB_USB_SW_RST_EN)

Disable the specified USB peripheral software reset.

Return values

  None |

Definition at line 485 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_ENABLE

#define __HAL_USB_ENABLE | ( |  | ) | ll_usb_enable()

Enable the specified USB peripheral.

Return values

  None |

Definition at line 470 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_ENABLE_ADDR_STAT

#define __HAL_USB_ENABLE_ADDR_STAT | ( |  | __HANDLE__ | ) | SET_BITS((__HANDLE__)->p_instance->CTRL,USB_CTRL_ADDR_STAT)

Enable the specified USB in addressed status.

Parameters

  <strong>HANDLE</strong> | Specifies the USB Handle.

Return values

  None |

Definition at line 640 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_ENABLE_CFG_STAT

#define __HAL_USB_ENABLE_CFG_STAT | ( |  | __HANDLE__ | ) | SET_BITS((__HANDLE__)->p_instance->CTRL,USB_CTRL_CFG_STAT)

Enable the specified USB in configured status.

Parameters

  <strong>HANDLE</strong> | Specifies the USB Handle.

Return values

  None |

Definition at line 646 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_ENABLE_DEV_REMOTE_WAKEUP

#define __HAL_USB_ENABLE_DEV_REMOTE_WAKEUP | ( |  | __HANDLE__ | ) | SET_BITS((__HANDLE__)->p_instance->CTRL,USB_CTRL_DEV_REMOTE_WAKEUP)

Enable the specified USB device remote_wakeup feature.

Parameters

  <strong>HANDLE</strong> | Specifies the USB handle.

Return values

  None |

Definition at line 664 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_ENABLE_EP5_DMA_READ

#define __HAL_USB_ENABLE_EP5_DMA_READ | ( |  | __HANDLE__ | ) | SET_BITS((__HANDLE__)->p_instance->EP5_CTRL,USB_EP5_CTRL_AHBM_EN)

Enable the specified USB EP5 DMA READ.

Parameters

  <strong>HANDLE</strong> | Specifies the USB Handle.

Return values

  None |

Definition at line 676 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_ENABLE_IT

#define __HAL_USB_ENABLE_IT | ( |  | __HANDLE__,
|  |  | __INTERRUPT__
| ) |  | SET_BITS((__HANDLE__)->p_instance->INT_EN, (__INTERRUPT__))

Enable the specified USB interrupts.

Parameters

  <strong>HANDLE</strong> | Specifies the USB Handle.
  <strong>INTERRUPT</strong> | Specifies the interrupt source to enable. This parameter can be one of the following values: USB_IT_ALL USB all interrupt USB_IT_RESET_VAL interrupt control register rest value USB_IT_SUSPEND USB suspend status interrupt USB_IT_EP0_OUT_READY USB ep0 data out ready interrupt USB_IT_EP1_OUT_READY USB ep1 data out ready interrupt USB_IT_CRC16_ERR USB receive CRC error data interrupt USB_IT_UPID_ERR USB receive unsupported PID interrupt USB_IT_TIMEOUT_ERR USB rx/tx timeout error interrupt USB_IT_SEQ_ERR USB DATA0/DATA1 PID sequence error interrupt USB_IT_PID_CKS_ERR USB PID checksum error interrupt USB_IT_PID_CRC_ERR USB PID CRC error interrupt USB_IT_HOST_RESET USB host reset interrupt USB_IT_AHB_XFER_ERR USB ep3 and ep4 AHB master receive ERROR response interrupt USB_IT_NSE_ERR USB no such endpoint error interrupt USB_IT_EP3_AHB_XFER_DONE USB ep3 AHB master transfer done interrupt USB_IT_SYNC_ERR USB SYNC error interrupt USB_IT_BIT_STUFF_ERR USB bit stuff error interrupt USB_IT_BYTE_ERR USB byte error interrupt USB_IT_SOF USB SOF interrupt USB_IT_EP0_TX_DONE USB ep0 TX done interrupt USB_IT_EP2_TX_DONE USB ep2 TX done interrupt USB_IT_EP3_TX_DONE USB ep3 TX done interrupt USB_IT_INTO_CONFIG USB into cofig status interrupt USB_IT_EP5_OUT_READY USB ep5 data out ready interrupt USB_IT_CLR_EP4_AHB_XFER_DONE USB ep4 AHB master transfer done interrupt USB_IT_EP4_TX_DONE USB ep4 TX done interrupt USB_IT_EP5_AHB_XFER_DONE USB ep5 AHB master transfer done interrupt USB_IT_EP5_TIMER_OUT_ERR USB ep5 timer out error interrupt

Return values

  None |

Definition at line 521 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_ENABLE_SW_RST

#define __HAL_USB_ENABLE_SW_RST | ( |  | ) | SET_BITS(MCU_SUB->USB_SW_RST, MCU_SUB_USB_SW_RST_EN)

Enable the specified USB peripheral software reset.

Return values

  None |

Definition at line 480 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_GET_EP0_OUT_DAT_RDY

#define __HAL_USB_GET_EP0_OUT_DAT_RDY | ( |  | __HANDLE__ | ) | ((READ_BITS((__HANDLE__)->p_instance->CTRL, USB_CTRL_EP0_OUT_DATA_RDY) != 0) ? SET : RESET)

Check whether the specified USB flag is set or not.

Parameters

  <strong>HANDLE</strong> | Specifies the USB Handle.

Return values

  The | new state of TRUE or FALSE.

Definition at line 634 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_GET_FLAG

#define __HAL_USB_GET_FLAG | ( |  | __HANDLE__,
|  |  | __FLAG__
| ) |  | ((READ_BITS((__HANDLE__)->p_instance->INT_STAT, (__FLAG__)) != 0) ? SET : RESET)

Check whether the specified USB flag is set or not.

Parameters

  <strong>HANDLE</strong> | Specifies the USB Handle.
  <strong>FLAG</strong> | Specifies the flag to check. This parameter can be one of the following values:

Return values

  The | new state of FLAG (TRUE or FALSE). USB Flags Definition USB all flag USB_FLAG_SUSPEND USB suspend status flag USB_FLAG_EP0_OUT_READY USB ep0 data out ready flag USB_FLAG_EP1_OUT_READY USB ep1 data out ready flag USB_FLAG_CRC16_ERR USB receive CRC error data flag USB_FLAG_UPID_ERR USB receive unsupported PID flag USB_FLAG_TIMEOUT_ERR USB rx/tx timeout error flag USB_FLAG_SEQ_ERR USB DATA0/DATA1 PID sequence error flag USB_FLAG_PID_CKS_ERR USB PID checksum error flag USB_FLAG_PID_CRC_ERR USB PID CRC error flag USB_FLAG_HOST_RESET USB host reset flag USB_FLAG_AHB_XFER_ERR USB ep3 and ep4 AHB master receive ERROR response flag USB_FLAG_NSE_ERR USB no such endpoint error flag USB_FLAG_EP3_AHB_XFER_DONE USB ep3 AHB master transfer done flag USB_FLAG_SYNC_ERR USB SYNC error flag USB_FLAG_BIT_STUFF_ERR USB bit stuff error flag USB_FLAG_BYTE_ERR USB byte error flag USB_FLAG_SOF USB SOF flag USB_FLAG_EP0_TX_DONE USB ep0 TX done flag USB_FLAG_EP2_TX_DONE USB ep2 TX done flag USB_FLAG_EP3_TX_DONE USB ep3 TX done flag USB_FLAG_INTO_CONFIG USB into cofig status flag USB_FLAG_EP5_OUT_READY USB ep5 data out ready flag USB_FLAG_EP4_AHB_XFER_DONE USB ep4 AHB master transfer done flag USB_FLAG_EP4_TX_DONE USB ep4 TX done flag USB_FLAG_EP5_AHB_XFER_DONE USB ep5 AHB master transfer done flag USB_FLAG_EP5_TIMER_OUT_ERR USB ep5 timer out error flag

Definition at line 593 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_RESET_HANDLE_STATE

#define __HAL_USB_RESET_HANDLE_STATE | ( |  | __HANDLE__ | ) | ((__HANDLE__)->state = HAL_USB_STATE_RESET)

Reset USB handle states.

Parameters

  <strong>HANDLE</strong> | USB handle.

Return values

  None |

Definition at line 465 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_SET_EP4_BURST_SIZE

#define __HAL_USB_SET_EP4_BURST_SIZE | ( |  | __HANDLE__,
|  |  | __VAL__
| ) |  |

Value:
MODIFY_REG((__HANDLE__)->p_instance->EP4_AHBM_CTRL, USB_EP4_AHBM_CTRL_BURST_SIZE,\
(__VAL__) << USB_EP4_AHBM_CTRL_BURST_SIZE_Pos);

Set USB ep4 DMA burst size value.

Parameters

  <strong>HANDLE</strong> | Specifies the USB Handle.
  <strong>VAL</strong> | Specifies 0:ep4 DMA burst size value(32~1023).

Return values

  None |

Definition at line 697 of file gr55xx_hal_usb.h.

## ◆ __HAL_USB_SET_EP5_TIMER_VAL

#define __HAL_USB_SET_EP5_TIMER_VAL | ( |  | __HANDLE__,
|  |  | __VAL__
| ) |  | MODIFY_REG((__HANDLE__)->p_instance->EP5_TIMER, USB_EP5_TIMER_VAL, (__VAL__));

Set USB ep5 DMA recieve data time out value.

Parameters

  <strong>HANDLE</strong> | Specifies the USB Handle.
  <strong>VAL</strong> | Specifies 0:never timeout 1~1000ms.

Return values

  None |

Definition at line 690 of file gr55xx_hal_usb.h.