OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [orpsocv2/] [boards/] [actel/] [ordb1a3pe1500/] [sw/] [drivers/] [usbhostslave/] [usbhostslave-host.c] - Blame information for rev 439

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 408 julius
 
2
/*
3
 *
4
 * USB usbhostslave core host functions
5
 *
6
 * Julius Baxter, julius@opencores.org
7
 *
8
 */
9
 
10
#include "cpu-utils.h"
11
#include "board.h"
12
#include "usbhostslave-host.h"
13
 
14
const int USBHOSTSLAVE_HOST_CORE_ADR[2] = { USB0_BASE, USB1_BASE };
15
 
16
// ------------------------ usbInit -----------------------------
17
char usb_host_init(int core)
18
{
19
        volatile int i;
20
 
21
        // Reset the thing
22
        REG8(USBHOSTSLAVE_HOST_CORE_ADR[core] + RA_HOST_SLAVE_MODE) = 0x2;
23
 
24
        // Wait 10 USB cycles ( this should be plenty)
25
        for (i = 0; i < 8; i++) ;
26
 
27
        REG8(USBHOSTSLAVE_HOST_CORE_ADR[core] + RA_HC_INTERRUPT_MASK_REG) = 0x00;       // Disable interrupts
28
 
29
        REG8(USBHOSTSLAVE_HOST_CORE_ADR[core] + RA_HC_INTERRUPT_STATUS_REG) = 0xff;     // Clear interrupt statuses
30
 
31
        REG8(USBHOSTSLAVE_HOST_CORE_ADR[core] + RA_HC_TX_LINE_CONTROL_REG) = 0x00;      // low speed normal
32
 
33
        REG8(USBHOSTSLAVE_HOST_CORE_ADR[core] + RA_HC_TX_SOF_ENABLE_REG) = 0x00;        // No SOF
34
 
35
        REG8(USBHOSTSLAVE_HOST_CORE_ADR[core] + RA_HOST_SLAVE_MODE) = 0x01;     // Set core to HOST mode
36
 
37
        // Reset RX FIFO buffer
38
        REG8(USBHOSTSLAVE_HOST_CORE_ADR[core] + RA_HC_RX_FIFO_CONTROL_REG) =
39
            0xff;
40
        // Reset TX FIFO buffer
41
        REG8(USBHOSTSLAVE_HOST_CORE_ADR[core] + RA_HC_TX_FIFO_CONTROL_REG) =
42
            0xff;
43
 
44
        // Return version number reg
45
        return REG8(USBHOSTSLAVE_HOST_CORE_ADR[core] + RA_HOST_SLAVE_VERSION);
46
 
47
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.