usb.h File Reference


Detailed Description

USB support module C header file.

REVISION

Definition in file usb.h.

#include "../SYSTEM/sys_assert.h"
#include "../GENERIC/generic.h"
#include "../fat/fat.h"
#include "usb_api.h"

Include dependency graph for usb.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  st_LU_STATUS
 Logic unit status. More...
struct  st_LU_GLOBALS
 Logic unit global controls. More...

Defines

#define _USBTRAFFIC_MONITOR
 Define to enable USB traffic monitor.

Enumerations

enum  USB_CONNECT_STATUS { USB_CS_NO_CABLE, USB_CS_CABLE_PLUGIN, USB_CS_CONNECTED, USB_CS_20CABLE_PLUGIN, USB_CS_20CONNECTED }
 USB cable status. More...

Functions

void USB_cableDetect (void)
 Function checks to generate USB connection status message.
void USB_cableStatusInit (void)
 Function initializes the USB cable status.
BOOL USB_isCablePlugged (void)
 Function that detects the presence of USB cable.
void USB_connect (void)
 This function shall reconnect the USB if cable is already plugged in.
void USB_createTask (void)
 Function creates the USB task.
void USB_deleteTask (void)
 Function deletes the USB task.
void USB_disconnect (void)
 This function shall disconnect the USB no matter cable is plugged in or not.
void USB_main (void)
 Function initializes the USB interface to start.
void USB_ctl_handler (void)
 USB Endpoint0 event handler routine.
void USB_traffic_handler (void)
 Function returns current USB average traffic in bytes per second.
BOOL USB_is20active (void)
 Function tells if USB20 is actively connected.
BOOL USB_isCableRemoved (void)
 Function tells if USB cable is removed.
BOOL USB__isCablePlugged (void)
 Function that detects the presence of USB 1.1 cable.


Enumeration Type Documentation

enum USB_CONNECT_STATUS
 

USB cable status.

Enumeration values:
USB_CS_NO_CABLE  No cable plugged.
USB_CS_CABLE_PLUGIN  Cable just plugged in.
USB_CS_CONNECTED  Cable stably connected.
USB_CS_20CABLE_PLUGIN  2.0 Cable just plugged in.
USB_CS_20CONNECTED  2.0 cable stably connected.

Definition at line 42 of file usb.h.

00043 {
00044     USB_CS_NO_CABLE,        
00045     USB_CS_CABLE_PLUGIN,    
00046     USB_CS_CONNECTED,       
00047     USB_CS_20CABLE_PLUGIN,  
00048     USB_CS_20CONNECTED      
00049 } USB_CONNECT_STATUS;


Function Documentation

BOOL USB__isCablePlugged void   ) 
 

Function that detects the presence of USB 1.1 cable.

Returns:
USB cable connection status.

Definition at line 172 of file USB_cableDetect.c.

Referenced by USB_cableDetect(), and USB_isCablePlugged().

00173 {
00174     unsigned int    PCR2;
00175     
00176     // Load SPSA2 with sub-address 0x0E of PCR2 register 
00177     SPSA2 = PCR;
00178 
00179     // Read PCR2 register 
00180     PCR2 = SPACC2;
00181     asm(" nop");
00182     asm(" nop");
00183     asm(" nop");
00184     asm(" nop");
00185     asm(" nop");
00186 
00187     // Test USBDET signal which is DR_STAT bit (bit4) of PCR register
00188     if ( (PCR2 & 0x0010) == 0 ) 
00189     {
00190         return TRUE;
00191     }
00192     else 
00193     {
00194         return FALSE;
00195     }
00196 }

BOOL USB_is20active void   ) 
 

Function tells if USB20 is actively connected.

Returns:
TRUE if USB20 is actively connected, otherwise FALSE.

Definition at line 52 of file USB_cableDetect.c.

Referenced by UI_PSF_autosync().

00053 {
00054     return ((usbConnectStatus == USB_CS_20CONNECTED)? TRUE:FALSE);
00055 }

BOOL USB_isCablePlugged void   ) 
 

Function that detects the presence of USB cable.

Returns:
USB cable connection status.

Definition at line 151 of file USB_cableDetect.c.

References HDD_bpIsr(), and USB__isCablePlugged().

Referenced by SYS_kickoff(), and UI_parent().

00152 {
00153     if( TRUE == USB__isCablePlugged() ) return TRUE;
00154 
00155     #ifdef USB20_SUPPORT    
00156         // Run 2.0 cable detection code.
00157         HDD_bpIsr();
00158         if( SYS_isUsb20Plugged() ) return TRUE;
00159     #endif
00160     
00161     return FALSE;
00162 }

Here is the call graph for this function:

BOOL USB_isCableRemoved void   ) 
 

Function tells if USB cable is removed.

NOTE: FALSE return of this function does not mean USB is active.

Returns:
TRUE if cable is removed, otherwise FALSE.

Definition at line 65 of file USB_cableDetect.c.

Referenced by UI_PSF_autosync().

00066 {
00067     return ((usbConnectStatus == USB_CS_NO_CABLE)? TRUE:FALSE);
00068 }


Generated on Wed Jan 19 01:13:34 2005 for neuros-firmware by  doxygen 1.3.9.1