Source file: /~heha/ewa/Motor/Maxmaus1.zip/usb_hal.c

#include "usb_hal.h"

void USBGPIOEnable(void) {
    // 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);

//  GPIO_setMasterCore(120, GPIO_CORE_CPU1);
//  GPIO_setDirectionMode(120, GPIO_DIR_MODE_IN);

//  GPIO_setMasterCore(121, GPIO_CORE_CPU1);
//  GPIO_setDirectionMode(121, GPIO_DIR_MODE_OUT);
//  GPIO_writePin(121, 1);
}

//******************************************************************************
//! Configure the CPU Timer.
//******************************************************************************
void CPUTimerInit(void) {
    // 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(void) {
    USB0DeviceIntHandler();
    Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
}

//__interrupt void f28x_USB0HostIntHandler(void) {
//    USB0HostIntHandler();
//    Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
//}

//__interrupt void f28x_USB0DualModeIntHandler(void) {
//    USB0DualModeIntHandler();
//    Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
//}

//__interrupt void f28x_USB0OTGModeIntHandler(void) {
//    USB0OTGModeIntHandler();
//    Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
//}
Detected encoding: ASCII (7 bit)2