Leapster Explorer: GPIO subsystem

From eLinux.org
Revision as of 11:49, 28 August 2010 by Reggie (Talk | contribs)

Jump to: navigation, search

This is a short article on using the lf1000-gpio subsystem. This is used internally by /etc/init.d/rcS and other system scripts to start the explorer in different states via emerald-boot. at least some the 'registers' in the gpio subsytem are loaded by reading a 'scratchpad' area of nand, then converting that raw scratchpad data to a human readable form via the values you will see below.

All of the kernel based magic happens via /sys/devices/platform/lf1000-gpio/ using cat you can find out the values of these registers, this is pretty much what emerald-boot does to tell itself which buttons config it should be using and how it should try and boot. /etc/rcS also uses this technique, again to setup the system for the different types of boot, mainly starting only the appropriate modules/services that are needed.

I believe that we can use some of the registers to our advantage and give ourselves extra boot modes where we only start a minimal set, which should see us getting some kind of performance boost from the various subsystems, this will also leave our recovery process alone.

here is a list of the registers:


As you can see there are a lot of them, we are only really interested in a few at this moment:

# this is how the system works out whether its booting a didj, explorer or LF Dev board(s)
# this is how rcS/EB knows which boot type it should use and which set of scripts to run once the kernel is loaded
# this is how it knows where it booted from (Nor,Nand,USB,UART)
# this is how the system differentiates between cart types (Game,MFG cart)
# this is how the system determines what speed the cpu should run at
# I think this tells the system whether the kernel panic'd or not
# whether it was a warm or cold boot?
# the type boot requested from the kernel
# how the system shutdown the last time

lets break that down a bit further:


The system uses board ID at compile time as well as boot, this is crucial to the system as it tells it which board type and consequently which types of boot it can perform, for the didj this will be nand or uart, for the explorer it will be nor,usb or uart. At compile time CONFIG_BOARD_ID is crucial for the system to know how the gpio pins are configured for the buttons.


this is how the system partly determines which set of scripts it should run at boot up via rcS, valid values are:

PLAY, RECOVERY (there may be more, I will update as I find them)

I believe this also tells emerald boot whether to boot normally or from USB for recovery purposes


This is how the system knows which method was used to boot, as mentioned in board_id, valid values for the explorer are:

and for the didj:


The explorer and didj systems use at least 2 types of cartridge, a normal game cart or a MFG cart, with the latter being able to perform system recovery, cart_id is how the system can tell the difference between cart types.


The explorer has various types of kernel boot modes, that it can set on exit or during the course of a session, on next startup these 'requests' tell it which scripts /etc/init.d/rcS should run, with valid values being:


for an explanation of what they do see /usr/bin/show-scr

This is a WIP., more to follow.