Source file: /~heha/ewa/Motor/Maxmaus5.zip/usb_hal.cpp

#include "usb_hal.h"
#include "usblib/usblibpriv.h"

void USBGPIOEnable() {
    // Set the USB DM and DP.
  GPIO_setMasterCore(42, GPIO_CORE_CPU1);
  GPIO_setAnalogMode(42, GPIO_ANALOG_ENABLED);
  GPIO_setMasterCore(43, GPIO_CORE_CPU1);
  GPIO_setAnalogMode(43, GPIO_ANALOG_ENABLED);
    // Set the direction for VBUS.
//  GPIO_setMasterCore(46, GPIO_CORE_CPU1);
//  GPIO_setDirectionMode(46, GPIO_DIR_MODE_IN);
  // Set the direction for ID.
//  GPIO_setMasterCore(47, GPIO_CORE_CPU1);
//  GPIO_setDirectionMode(47, GPIO_DIR_MODE_IN);
}

//******************************************************************************
//! Configure the CPU Timer.
//******************************************************************************
void CPUTimerInit() {
    // Initialize timer period to maximum.
    CPUTimer_setPeriod(CPUTIMER0_BASE,0xFFFFFFFF);
    // Initialize Pre-scale counter to divide by 1.
    CPUTimer_setPreScaler(CPUTIMER0_BASE, 0U);
    // Make sure timer is stopped.
    CPUTimer_stopTimer(CPUTIMER0_BASE);
    // Reload all counter register with period value:
    CPUTimer_reloadTimerCounter(CPUTIMER0_BASE);
}

void USBDelay(uint32_t ui32Delay) {
    DEVICE_DELAY_US(ui32Delay*1000);
}

__interrupt void f28x_USB0DeviceIntHandler() {
  tDeviceInfo::USB0DeviceIntHandler();
  Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
}
Detected encoding: ASCII (7 bit)2