| M480 BSP V3.05.001 The Board Support Package for M480 Series

Macros
OTG Exported Functions
Standard Driver » OTG Driver

## Macros
#define | OTG_ENABLE()
| This macro is used to enable OTG function. More...
#define | OTG_DISABLE()
| This macro is used to disable OTG function. More...
#define | OTG_ENABLE_PHY()
| This macro is used to enable USB PHY. More...
#define | OTG_DISABLE_PHY()
| This macro is used to disable USB PHY. More...
#define | OTG_ENABLE_ID_DETECT()
| This macro is used to enable ID detection function. More...
#define | OTG_DISABLE_ID_DETECT()
| This macro is used to disable ID detection function. More...
#define | OTG_ENABLE_WAKEUP()
| This macro is used to enable OTG wake-up function. More...
#define | OTG_DISABLE_WAKEUP()
| This macro is used to disable OTG wake-up function. More...
#define | OTG_SET_VBUS_EN_POL(u32Pol)
| This macro is used to set the polarity of USB_VBUS_EN pin. More...
#define | OTG_SET_VBUS_STS_POL(u32Pol)
| This macro is used to set the polarity of USB_VBUS_ST pin. More...
#define | OTG_ENABLE_INT(u32Mask)
| This macro is used to enable OTG related interrupts. More...
#define | OTG_DISABLE_INT(u32Mask)
| This macro is used to disable OTG related interrupts. More...
#define | OTG_GET_INT_FLAG(u32Mask)
| This macro is used to get OTG related interrupt flags. More...
#define | OTG_CLR_INT_FLAG(u32Mask)
| This macro is used to clear OTG related interrupt flags. More...
#define | OTG_GET_STATUS(u32Mask)
| This macro is used to get OTG related status. More...

## Detailed Description

## Macro Definition Documentation

## ◆ OTG_CLR_INT_FLAG

#define OTG_CLR_INT_FLAG | ( |  | u32Mask | ) |

This macro is used to clear OTG related interrupt flags.

Parameters

  [in] | u32Mask | The combination of interrupt source. Each bit corresponds to a interrupt source. Valid values are listed below. OTG_INTSTS_ROLECHGIF_Msk OTG_INTSTS_VBEIF_Msk OTG_INTSTS_SRPFIF_Msk OTG_INTSTS_HNPFIF_Msk OTG_INTSTS_GOIDLEIF_Msk OTG_INTSTS_IDCHGIF_Msk OTG_INTSTS_PDEVIF_Msk OTG_INTSTS_HOSTIF_Msk OTG_INTSTS_BVLDCHGIF_Msk OTG_INTSTS_AVLDCHGIF_Msk OTG_INTSTS_VBCHGIF_Msk OTG_INTSTS_SECHGIF_Msk OTG_INTSTS_SRPDETIF_Msk

Returns
  None

This macro will clear OTG related interrupt flags specified by u32Mask parameter.

Definition at line 235 of file otg.h.

## ◆ OTG_DISABLE

#define OTG_DISABLE | ( |  | ) |

This macro is used to disable OTG function.

Parameters

  None |

Returns
  None

This macro will clear OTGEN bit of OTG_CTL register to disable OTG function.

Definition at line 70 of file otg.h.

## ◆ OTG_DISABLE_ID_DETECT

#define OTG_DISABLE_ID_DETECT | ( |  | ) |

This macro is used to disable ID detection function.

Parameters

  None |

Returns
  None

This macro will clear IDDETEN bit of OTG_PHYCTL register to disable ID detection function.

Definition at line 107 of file otg.h.

## ◆ OTG_DISABLE_INT

#define OTG_DISABLE_INT | ( |  | u32Mask | ) |

This macro is used to disable OTG related interrupts.

Parameters

  [in] | u32Mask | The combination of interrupt source. Each bit corresponds to a interrupt source. Valid values are listed below. OTG_INTEN_ROLECHGIEN_Msk OTG_INTEN_VBEIEN_Msk OTG_INTEN_SRPFIEN_Msk OTG_INTEN_HNPFIEN_Msk OTG_INTEN_GOIDLEIEN_Msk OTG_INTEN_IDCHGIEN_Msk OTG_INTEN_PDEVIEN_Msk OTG_INTEN_HOSTIEN_Msk OTG_INTEN_BVLDCHGIEN_Msk OTG_INTEN_AVLDCHGIEN_Msk OTG_INTEN_VBCHGIEN_Msk OTG_INTEN_SECHGIEN_Msk OTG_INTEN_SRPDETIEN_Msk

Returns
  None

This macro will disable OTG related interrupts specified by u32Mask parameter.

Definition at line 191 of file otg.h.

## ◆ OTG_DISABLE_PHY

#define OTG_DISABLE_PHY | ( |  | ) |

This macro is used to disable USB PHY.

Parameters

  None |

Returns
  None

This macro will clear OTGPHYEN bit of OTG_PHYCTL register to disable USB PHY.

Definition at line 89 of file otg.h.

## ◆ OTG_DISABLE_WAKEUP

#define OTG_DISABLE_WAKEUP | ( |  | ) |

This macro is used to disable OTG wake-up function.

Parameters

  None |

Returns
  None

This macro will clear WKEN bit of OTG_CTL register to disable OTG wake-up function.

Definition at line 125 of file otg.h.

## ◆ OTG_ENABLE

#define OTG_ENABLE | ( |  | ) |

This macro is used to enable OTG function.

Parameters

  None |

Returns
  None

This macro will set OTGEN bit of OTG_CTL register to enable OTG function.

Definition at line 61 of file otg.h.

## ◆ OTG_ENABLE_ID_DETECT

#define OTG_ENABLE_ID_DETECT | ( |  | ) |

This macro is used to enable ID detection function.

Parameters

  None |

Returns
  None

This macro will set IDDETEN bit of OTG_PHYCTL register to enable ID detection function.

Definition at line 98 of file otg.h.

## ◆ OTG_ENABLE_INT

#define OTG_ENABLE_INT | ( |  | u32Mask | ) |

This macro is used to enable OTG related interrupts.

Parameters

  [in] | u32Mask | The combination of interrupt source. Each bit corresponds to a interrupt source. Valid values are listed below. OTG_INTEN_ROLECHGIEN_Msk OTG_INTEN_VBEIEN_Msk OTG_INTEN_SRPFIEN_Msk OTG_INTEN_HNPFIEN_Msk OTG_INTEN_GOIDLEIEN_Msk OTG_INTEN_IDCHGIEN_Msk OTG_INTEN_PDEVIEN_Msk OTG_INTEN_HOSTIEN_Msk OTG_INTEN_BVLDCHGIEN_Msk OTG_INTEN_AVLDCHGIEN_Msk OTG_INTEN_VBCHGIEN_Msk OTG_INTEN_SECHGIEN_Msk OTG_INTEN_SRPDETIEN_Msk

Returns
  None

This macro will enable OTG related interrupts specified by u32Mask parameter.

Definition at line 169 of file otg.h.

## ◆ OTG_ENABLE_PHY

#define OTG_ENABLE_PHY | ( |  | ) |

This macro is used to enable USB PHY.

Parameters

  None |

Returns
  None

When the USB role is selected as OTG device, use this macro to enable USB PHY. This macro will set OTGPHYEN bit of OTG_PHYCTL register to enable USB PHY.

Definition at line 80 of file otg.h.

## ◆ OTG_ENABLE_WAKEUP

#define OTG_ENABLE_WAKEUP | ( |  | ) |

This macro is used to enable OTG wake-up function.

Parameters

  None |

Returns
  None

This macro will set WKEN bit of OTG_CTL register to enable OTG wake-up function.

Definition at line 116 of file otg.h.

## ◆ OTG_GET_INT_FLAG

#define OTG_GET_INT_FLAG | ( |  | u32Mask | ) |

This macro is used to get OTG related interrupt flags.

Parameters

  [in] | u32Mask | The combination of interrupt source. Each bit corresponds to a interrupt source. Valid values are listed below. OTG_INTSTS_ROLECHGIF_Msk OTG_INTSTS_VBEIF_Msk OTG_INTSTS_SRPFIF_Msk OTG_INTSTS_HNPFIF_Msk OTG_INTSTS_GOIDLEIF_Msk OTG_INTSTS_IDCHGIF_Msk OTG_INTSTS_PDEVIF_Msk OTG_INTSTS_HOSTIF_Msk OTG_INTSTS_BVLDCHGIF_Msk OTG_INTSTS_AVLDCHGIF_Msk OTG_INTSTS_VBCHGIF_Msk OTG_INTSTS_SECHGIF_Msk OTG_INTSTS_SRPDETIF_Msk

Returns
  Interrupt flags of selected sources.

This macro will return OTG related interrupt flags specified by u32Mask parameter.

Definition at line 213 of file otg.h.

## ◆ OTG_GET_STATUS

#define OTG_GET_STATUS | ( |  | u32Mask | ) |

This macro is used to get OTG related status.

Parameters

  [in] | u32Mask | The combination of user specified source. Valid values are listed below. OTG_STATUS_OVERCUR_Msk OTG_STATUS_IDSTS_Msk OTG_STATUS_SESSEND_Msk OTG_STATUS_BVLD_Msk OTG_STATUS_AVLD_Msk OTG_STATUS_VBUSVLD_Msk

Returns
  The user specified status.

This macro will return OTG related status specified by u32Mask parameter.

Definition at line 250 of file otg.h.

## ◆ OTG_SET_VBUS_EN_POL

#define OTG_SET_VBUS_EN_POL | ( |  | u32Pol | ) |

This macro is used to set the polarity of USB_VBUS_EN pin.

Parameters

  [in] | u32Pol | The polarity selection. Valid values are listed below. OTG_VBUS_EN_ACTIVE_HIGH OTG_VBUS_EN_ACTIVE_LOW

Returns
  None

This macro is used to set the polarity of external USB VBUS power switch enable signal.

Definition at line 136 of file otg.h.

## ◆ OTG_SET_VBUS_STS_POL

#define OTG_SET_VBUS_STS_POL | ( |  | u32Pol | ) |

This macro is used to set the polarity of USB_VBUS_ST pin.

Parameters

  [in] | u32Pol | The polarity selection. Valid values are listed below. OTG_VBUS_ST_VALID_HIGH OTG_VBUS_ST_VALID_LOW

Returns
  None

This macro is used to set the polarity of external USB VBUS power switch status signal.

Definition at line 147 of file otg.h.