- Main Page
- Modules
- Data Structures
- Files
- Related Pages

# USB common management drivers
[USB low level drivers module]

Collaboration diagram for USB common management drivers:

These macros manage the USB controller. More...

## Defines
#define | Usb_enable() (USBCON |= ((1<<USBE) ))
| Enable both USB interface.
#define | Usb_disable() (USBCON &= ~((1<<USBE)))
| Disable both USB interface.
#define | Is_usb_enabled() ((USBCON & (1<<USBE)) ? TRUE : FALSE)
#define | Usb_enable_device() (USBCON |= (1<<USBE))
#define | Usb_disable_device() (USBCON &= ~(1<<USBE))
#define | Usb_reset_macro_only() (UDCON &= ~(1<<RSTCPU))
#define | Usb_reset_all_system() (UDCON |= (1<<RSTCPU))
#define | Usb_vbus_sense_init()
| Init vbus sensing i/o.
#define | Is_usb_vbus_on() (((VBUS_SENSE_PIN&(1<<VBUS_SENSE_IO)) != 0) ? TRUE : FALSE)
| test if vbus is present
#define | Is_usb_vbus_off() (((VBUS_SENSE_PIN&(1<<VBUS_SENSE_IO)) == 0) ? TRUE : FALSE)
| test if vbus is not present
#define | Usb_freeze_clock() (USBCON |= (1<<FRZCLK))
| Stop internal USB clock in interface (freeze the interface register).
#define | Usb_unfreeze_clock() (USBCON &= ~(1<<FRZCLK))
#define | Is_usb_clock_freezed() ((USBCON & (1<<FRZCLK)) ? TRUE : FALSE)
#define | Ps2_enable_device() (PS2CON |= (1<<PS2EN))
#define | Ps2_disable_device() (PS2CON &= ~(1<<PS2EN))
#define | Usb_direct_drive_usb_enable() (UPOE |= (1<<UPWE1), UPOE &= ~(1<<UPWE0))
#define | Usb_direct_drive_ps2_enable() (UPOE |= ((1<<UPWE1) | (1<<UPWE0)))
#define | Usb_direct_drive_disable() (UPOE &= ~((1<<UPWE1) | (1<<UPWE0)))
#define | Usb_drive_dp_high() (UPOE |= (1<<UPDRV1))
#define | Usb_drive_dp_low() (UPOE &= ~(1<<UPDRV1))
#define | Usb_drive_dm_high() (UPOE |= (1<<UPDRV0))
#define | Usb_drive_dm_low() (UPOE &= ~(1<<UPDRV0))
#define | Ps2_drive_sck_high() (UPOE |= (1<<UPDRV1))
#define | Ps2_drive_sck_low() (UPOE &= ~(1<<UPDRV1))
#define | Ps2_drive_data_high() (UPOE |= (1<<UPDRV0))
#define | Ps2_drive_data_low() (UPOE &= ~(1<<UPDRV0))
#define | Usb_get_general_interrupt() (USBINT & (USBCON & MSK_IDTE_VBUSTE))
| returns the USB general interrupts (interrupt enabled)
#define | Usb_ack_all_general_interrupt() (USBINT = ~(USBCON & MSK_IDTE_VBUSTE))
| acks the general interrupts (interrupt enabled)
#define | Usb_ack_cache_id_transition(x) ((x) &= ~(1<<IDTI))
#define | Usb_ack_cache_vbus_transition(x) ((x) &= ~(1<<VBUSTI))
#define | Is_usb_cache_id_transition(x) (((x) & (1<<IDTI)) )
#define | Is_usb_cache_vbus_transition(x) (((x) & (1<<VBUSTI)))

## Detailed Description

These macros manage the USB controller.

## Define Documentation

#define Usb_enable | ( |  | ) | (USBCON |= ((1<<USBE) ))

Enable both USB interface.

Definition at line 163 of file usb_drv.h.

Referenced by usb_device_task(), and usb_device_task_init().

#define Usb_disable | ( |  | ) | (USBCON &= ~((1<<USBE)))

Disable both USB interface.

Definition at line 165 of file usb_drv.h.

Referenced by usb_device_task(), and usb_device_task_init().

#define Is_usb_enabled | ( |  | ) | ((USBCON & (1<<USBE)) ? TRUE : FALSE)

Definition at line 166 of file usb_drv.h.

#define Usb_enable_device | ( |  | ) | (USBCON |= (1<<USBE))

Definition at line 168 of file usb_drv.h.

Referenced by usb_start_device().

#define Usb_disable_device | ( |  | ) | (USBCON &= ~(1<<USBE))

Definition at line 169 of file usb_drv.h.

#define Usb_reset_macro_only | ( |  | ) | (UDCON &= ~(1<<RSTCPU))

Definition at line 170 of file usb_drv.h.

Referenced by usb_start_device().

#define Usb_reset_all_system | ( |  | ) | (UDCON |= (1<<RSTCPU))

Definition at line 171 of file usb_drv.h.

Referenced by usb_start_device().

#define Usb_vbus_sense_init | ( |  | ) |

Value:

    (VBUS_SENSE_DDR &= ~(1<<VBUS_SENSE_IO), \
                                           VBUS_SENSE_PORT &= ~(1<<VBUS_SENSE_IO))

Init vbus sensing i/o.

Definition at line 175 of file usb_drv.h.

Referenced by usb_device_task_init().

#define Is_usb_vbus_on | ( |  | ) | (((VBUS_SENSE_PIN&(1<<VBUS_SENSE_IO)) != 0) ? TRUE : FALSE)

test if vbus is present

Definition at line 178 of file usb_drv.h.

Referenced by usb_device_task().

#define Is_usb_vbus_off | ( |  | ) | (((VBUS_SENSE_PIN&(1<<VBUS_SENSE_IO)) == 0) ? TRUE : FALSE)

test if vbus is not present

Definition at line 180 of file usb_drv.h.

Referenced by usb_device_task().

#define Usb_freeze_clock | ( |  | ) | (USBCON |= (1<<FRZCLK))

Stop internal USB clock in interface (freeze the interface register).

Definition at line 184 of file usb_drv.h.

Referenced by usb_general_interrupt(), and usb_start_device().

#define Usb_unfreeze_clock | ( |  | ) | (USBCON &= ~(1<<FRZCLK))

Definition at line 185 of file usb_drv.h.

Referenced by usb_general_interrupt(), and usb_start_device().

#define Is_usb_clock_freezed | ( |  | ) | ((USBCON & (1<<FRZCLK)) ? TRUE : FALSE)

Definition at line 186 of file usb_drv.h.

#define Ps2_enable_device | ( |  | ) | (PS2CON |= (1<<PS2EN))

Definition at line 188 of file usb_drv.h.

#define Ps2_disable_device | ( |  | ) | (PS2CON &= ~(1<<PS2EN))

Definition at line 189 of file usb_drv.h.

#define Usb_direct_drive_usb_enable | ( |  | ) | (UPOE |= (1<<UPWE1), UPOE &= ~(1<<UPWE0))

Definition at line 191 of file usb_drv.h.

#define Usb_direct_drive_ps2_enable | ( |  | ) | (UPOE |= ((1<<UPWE1) | (1<<UPWE0)))

Definition at line 192 of file usb_drv.h.

#define Usb_direct_drive_disable | ( |  | ) | (UPOE &= ~((1<<UPWE1) | (1<<UPWE0)))

Definition at line 193 of file usb_drv.h.

#define Usb_drive_dp_high | ( |  | ) | (UPOE |= (1<<UPDRV1))

Definition at line 194 of file usb_drv.h.

#define Usb_drive_dp_low | ( |  | ) | (UPOE &= ~(1<<UPDRV1))

Definition at line 195 of file usb_drv.h.

#define Usb_drive_dm_high | ( |  | ) | (UPOE |= (1<<UPDRV0))

Definition at line 196 of file usb_drv.h.

#define Usb_drive_dm_low | ( |  | ) | (UPOE &= ~(1<<UPDRV0))

Definition at line 197 of file usb_drv.h.

#define Ps2_drive_sck_high | ( |  | ) | (UPOE |= (1<<UPDRV1))

Definition at line 198 of file usb_drv.h.

#define Ps2_drive_sck_low | ( |  | ) | (UPOE &= ~(1<<UPDRV1))

Definition at line 199 of file usb_drv.h.

#define Ps2_drive_data_high | ( |  | ) | (UPOE |= (1<<UPDRV0))

Definition at line 200 of file usb_drv.h.

#define Ps2_drive_data_low | ( |  | ) | (UPOE &= ~(1<<UPDRV0))

Definition at line 201 of file usb_drv.h.

#define Usb_get_general_interrupt | ( |  | ) | (USBINT & (USBCON & MSK_IDTE_VBUSTE))

returns the USB general interrupts (interrupt enabled)

Definition at line 205 of file usb_drv.h.

#define Usb_ack_all_general_interrupt | ( |  | ) | (USBINT = ~(USBCON & MSK_IDTE_VBUSTE))

acks the general interrupts (interrupt enabled)

Definition at line 207 of file usb_drv.h.

#define Usb_ack_cache_id_transition | ( | x |  | ) | ((x) &= ~(1<<IDTI))

Definition at line 208 of file usb_drv.h.

#define Usb_ack_cache_vbus_transition | ( | x |  | ) | ((x) &= ~(1<<VBUSTI))

Definition at line 209 of file usb_drv.h.

#define Is_usb_cache_id_transition | ( | x |  | ) | (((x) & (1<<IDTI)) )

Definition at line 210 of file usb_drv.h.

#define Is_usb_cache_vbus_transition | ( | x |  | ) | (((x) & (1<<VBUSTI)))

Definition at line 211 of file usb_drv.h.