7
USB Firmware Description
A function call map for USB operation is shown in Figure
6. The following are descriptions of the functions in
SPCP825A _A6010.asm.
Start_up
– This function is used for mouse sensor calibra-
tion. It proceeds for calibration when the output power
measurement device is plugged to the mouse. Otherwise
it skips the calibration process and proceeds to USB ini-
tialization.
Read_LP_CFG_REG
– This function reads the calibrated
laser power confi guration register from EEPROM.
reset_ands6010
– This function is responsible for
resetting the hardware, loading the SROM (Shadow ROM)
fi rmware into the ADNS-6010 optical sensor. Then ReadSPI
and WriteSPI are called to set the resolution of the sensor
to 2000cpi. The ID from the device and program are
compared. If the ID is not the same, then the program is
trapped in the dead loop, i.e. the device is unusable.
hard_reset
– This routine resets the serial interface and
the ADNS-6010 internal registers by generating a pulse
on the RESET pin.
LoadSROM
– This routine is used to load the SROM
(Shadow ROM) fi rmware into the ADNS-6010 optical
sensor. It is called after hard_reset.
WriteSPI
– Writes to the ADNS-6010 register. A write
operation consists of two bytes. The fi rst byte contains
the address (7 bits) and has “1” as its MSB. The second byte
contains data. The microcontroller is responsible to drive
both the SCLK and the MOSI lines.
ReadSPI
– Reads the desired ADNS-6010 registers. A read
operation is composed of two parts. First, the microcon-
troller performs a write to the ADNS-6010, sending the
address of the target register to be read. The microcon-
troller drives both the SCLK and MOSI lines. After t
SRAD
delay, the ADNS-6010 will drive the data via MISO. The mi-
crocontroller is only driving the SCLK line (outputs SCLK
for the serial interface).
CheckProductID
– This function checks the product ID
of the sensor chip being used. The ID returned should
match with the ADNS-6010’s ID. Otherwise the program is
trapped in the dead loop, i.e. the device is unusable.
Check_SROM_ID
– This function is to check the SROM
ID, if product device and program ID do not match, the
program is trapped in the dead loop, and thus the device
is unusable.
disable_laser
– This function is called to disable the
operation of the laser.
AdjustLaser
– This function is used to adjust the laser
power. To meet Class 1 eye safety requirement, manu-
facturers are required to program LP_CFG0 and LP_CFG1
to get laser output power as close to 506uW as possible.
This is done by using a power meter which can measure
the output laser power during mouse calibration.
SetDCMode
– Set the laser to continuous on mode for
laser calibration purpose.
SetShutterMode
– This function is responsible to on the
laser only when illumination is required. This is to ensure
safety to the users as well as for power saving.
enable_laser
– This function is to enable the laser.
check_susp
– This function is used to determine whether
the mouse is in the suspend mode.
sample_mouse
– This routine returns any updates in
the X, Y and Z-wheel motion information. The motion of
the Z-wheel is detected using the traditional method by
decoding the quadrature signal generated by the pho-
totransistors. The X and Y directions of the movement
are obtained by calling the ReadDeltaX and ReadDeltaY
routines. The X, Y, and Z-wheel movement is stored in the
[xCount], [yCount], and [zCount] variables which will be
sent to the host in the main routine.
detect_key_change
– This function is used to detect left,
right or middle button changes.
ReadMotionReg
– Reads the ADNS-6010 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-6010 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-6010 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.
Report_mouse_data
– This function is used to send
buttons, X, Y and Z-wheel data to the computer.