
9
ReadMotionReg – Reads the ADNS-6000 Motion register. The
data returned from this register will be used to determine if
any motion has occurred or if any fault condition exists.
ReadDeltaX – Reads the ADNS-6000 Delta_X register for the
X movement. Calls the ReadSPI routine to enable the SPI
interface and perform reading operations through the
two wire serial interface. Any new X motion information is
added to the [xCount] variable.
ReadDeltaY – Reads the ADNS-6000 Delta_Y register for the
Y movement. Calls the ReadSPI routine to enable the SPI
interface and perform reading operations through the
two wire serial interface. Any new Y motion information is
added to the [yCount] variable.
WriteSPI – Writes to the ADNS-6000 register. A write
operation consists of two bytes. The rst byte contains
the address (7 bits) and has“1” as its MSB. The second byte
contains data. The microcontroller to drive both the SCLK
and the MOSI lines. SPIWriteRoutine is called to carry the
write operation.
ReadSPI – Reads the desired ADNS-6000 registers. A read
operation is composed of two parts. First, the microcon-
troller performs a write to the ADNS-6000, sending the
address of the target register to be read. The microcon-
troller drives both the SCLK and MOSI lines. After tSRAD
delay, the ADNS-6000 will drive the data via MISO. The
microcontroller is only driving the SCLK line (outputs SCLK
for the serial interface). SPIWriteRoutine is called to carry
the write operation.
SPIWriteRoutine – Writes the data to be transmitted onto the
SPI pins.
CheckProductID – This function checks the product ID of the
sensor chip being used. The ID returned should match with
the ADNS-6000’s ID.
GetButtons – Returns the current state of the buttons.
USB Functions
usbMain – This routine initializes the USB related parameters
and enables VREG to signal the host that the mouse has
been connected. The program then goes to the usbTask-
Loop .
usbTaskLoop – This function spins in an innite loop waiting
for an event that needs servicing. The ProcessButtons and
ReadProcessOptics functions are called within this loop
to retrieve any new motion or button information. The
data received from these functions will be loaded into the
endpoint 1 buer to be sent to the host.
ep0SetupReceived – This routine is entered whenever a SETUP
packet is received in on endpoint 0. It parses the packet
and calls the appropriate routine to handle the packet.
ep0InReceived – This routine is entered whenever an IN
packet is received on endpoint 0.
ep0OutReceived – This routine is entered whenever an OUT
packet is received on endpoint 0.
setDeviceConguration – This routine is entered when a SET
CONFIGURATION request has been received from the
host.
setDeviceAddress – This routine is entered whenever a SET
ADDRESS request has been received. The device address
change cannot actually take place until after the status
stage of this no-data control transaction, so the address is
saved and a ag is set to indicate that a new address was
just received. The code that handles IN transactions will
recognize this and set the address properly.
getDescriptor – This routine is entered when a GET DESCRIP-
TOR request is received from the host. This function
decodes the descriptor request and sends the proper
descriptor.
setInterfaceIdle – This routine is entered whenever a SET
IDLE request is received. See the HID specication for the
rules on setting idle periods. This function sets the HID idle
time. See the HID documentation for details on handling
the idle timer.
setInterfaceProtocol – This routine is entered whenever a SET
PROTOCOL request is received. This no-data control trans-
action enables boot or report protocol.
getInterfaceReport – This routine is entered whenever a GET
REPORT request is received.
getInterfaceIdle – This routine is entered whenever a GET IDLE
request is received. This function then initiates a control-
read transaction that returns the idle time. See the HID
class documentation for more details.
getInterfaceProtocol – This routine is entered whenever a GET
PROTOCOL request is received. This request initiates a
control-read transaction that tells the host if the mouse is
congured for boot or report protocol. See the HID class
documentation for more details.
getDeviceConguration – This routine is entered whenever a
GET CONFIGURATION Request is received. This function
then starts a control read transaction that sends the con-
guration, interface, endpoint, and HID descriptors to the
host.
requestNotSupported – Unsupported or invalid descriptor
requests will cause this rmware to STALL these transac-
tions.
PS/2 Firmware Description
A function call map for PS/2 operation is shown in Figure
7. The following are descriptions of the functions in Adns-
6000.asm
Downloaded from Elcodis.com electronic components distributor