I'm opening a discussion here because the idea is very much in flux.
Code:
PROBLEM: Any 65SIB device can appear at any address.
WHY THIS IS A PROBLEM: Human-interface devices (HIDs), like keyboards, LCD displays, etc. are required so that humans can use the system. But, if booting from ROM, the firmware has no way of knowing where these HIDs are located.
PROPOSED SOLUTION: Let each peripheral (optionally) support a means of identifying to the host system which kind of device it is.
IMPLICATIONS: Hardware peripherals trade some minor complexity for the flexibility of "just working" with most systems.
Configuration space is treated as a special-purpose address space. That is, you can read any byte from, and if supported, write any byte to, configuration space.
Issue: should we employ existing eeprom/flash protocols to support this behavior? Having the ability to write individual bytes would be very much appreciated, for reasons I hope to illustrate below, which suggests we should instead consider RAM-based protocols instead.
Configuration space can be any size, but must be at least big enough to contain the following data structure:
Code:
Address Read/Write Description
$00 R Configuration space version (= 0)
This field
must be zero, for only one version exists at the time of this writing. This one byte determines how all other bytes are laid out in memory.
Code:
Address Read/Write Description
$01 R Number of protocols this peripheral supports (0 < x < 255)
I define a "protocol" as the specific set of commands and responses supported by a normally selected peripheral. These include your LCD interface protocols, MMC memory protocols, etc.
Many devices support more than one protocol. For example, by definition,
all SD media are also MMC media, but the reverse is not true. Hence, an intelligent SD media device would list that it supports 2 protocols: the MMC protocol, and the SD extensions there-to.
Another example would be a PS/2 keyboard adapter which is capable of producing plain-ASCII output, raw PS/2 scancodes, or (perhaps for development purposes) USB scancodes as well.
A value of 0 or 255 is meaningless at this time; any device indicating 0 or 255 supported protocols should be considered either dumb or absent (you're just reading a byte formed from the 65SIB's pull-up or pull-down resistor on the MISO line; you'll need to take the computer operator's word that there is, in fact, a real device on this address) or defective. Use this peripheral at your own risk.
Code:
Address Read/Write Description
$02 R Byte pointer to first protocol ID
$02 points to the first protocol ID in configuration space. As you might expect, the first byte must appear somewhere in the range $..04 to $..FF.
Protocol IDs are UUIDs; see
http://en.wikipedia.org/wiki/Universall ... identifier . I opted for this approach because I don't feel like administering a central authority doling ID ranges out. If anyone has ideas for something better, I'm open to suggestions.
For example, an array of three protocols might look like:
Code:
$0080 DE AD BE EF FE ED FA CE - 01 02 03 04 05 06 07 08
$0090 01 02 03 04 05 06 07 08 - FE ED FA CE DE AD BE EF
$00A0 DE AD FA CE FE ED BE EF - AA 55 AA 55 55 AA 55 AA
where UUID {DEADBEEF-FEED-FACE-0102-030405060708} might refer to MMC memory protocol, {01020304-0506-0708-FEED-FACEDEADBEEF} might refer to SecureDigital extensions, and {DEADFACE-FEED-BEEF-AA55-AA5555AA55AA} might refer to proprietary extensions aiding in debugging.
Code:
Address Read/Write Description
$04-$07 R Maximum device bits per second data transfer rate on 65SIB bus.
$08-$0B R Maximum configuration bits per second data transfer rate on 65SIB bus.
The minimum supported bits per second for either device or configuration selection is 0 bps. If your peripheral cannot handle this, then it's fundamentally incompatible with 65SIB by definition -- use such devices at your own risk. (Note that the 0bps requirement comes from the configuration protocol itself.)
All 65SIB devices must be able to handle at least 1000 bits per second. Conversely, if you do not know a device's maximum throughput, you are advised to query this information at a rate not to exceed 1000bps before attempting higher data rates. (The master must learn to walk before it can run.
).
Code:
Address Read/Write Description
$0C-$0F R Minimum latency between bus transactions for device.
$10-$13 R Maximum latency between bus transactions for device.
$14-$17 R Minimum latency between bus transactions for config.
$18-$1B R Maximum latency between bus transactions for config.
These should be fairly self-explanatory, I'd think. Time units are in nanoseconds, thus permitting over four second latencies between adjacent yet related transactions. A value of $FFFFFFFF implies infinity.
Code:
Address Read/Write Description
$1C-$1F R Model ID (chosen exclusively by the vendor)
$20-$2F R Vendor UUID.
Self-explanatory.
Code:
Address Read/Write Description
$30-$3F R Currently unused (read as zero).
Self-explanatory.
Code:
PROBLEM: Not all protocols inherit from some base specification.
WHY THIS IS A PROBLEM: For example, IBM PS/2 keyboard scancodes are completely incompatible with USB keyboard scancodes. And, sometimes, you just plain want simplicity in life, where plain-ASCII is all you need.
PROPOSED SOLUTION: Permit the master to configure the peripheral, as required, which protocol it wants to use.
IMPLICATIONS: Requires that the master be able to
write into configuration space to issue commands to a
configurator. The command set to use must remain stable across all classes of devices attached.
All commands
must end in finite time.
Code:
Address Read/Write Description
$30 R/W Command Byte
The command byte is composed of two fields:
Code:
+---+---+---+---+---+---+---+---+
| F | command |
+---+---+---+---+---+---+---+---+
| |
| +-------------- A value between $00-$7F
| requesting the configurator
| to take some action.
|
+------------------------------ 0: Request completed (with or without error)
1: Request in progress.
After writing relevant parameters into configuration space first, the master writes a command code with bit 7 set into location $30. It then will poll location $30 until bit 7 is clear.
Command $00 is, by definition for backward compatibility, no-operation.
Code:
Address Read/Write Description
$31-$37 R Unused (read as zero)
$38-$39 R/W Start of command parameters (16-bit configuration space)
$38-$3B R/W Start of command parameters (32-bit configuration space)
$38-$3F R/W Start of command parameters (64-bit configuration space)
Self-explanatory, but with one quirk:
You can detect the size of the configuration address space by filling in $38-$3F with $FF bytes. When you read these pointers back, you may find some of the address bits set to 0, indicating unused/unsupported address bits. For example, if you read back $00000000000FFF after writing $FFFFFFFFFFFFFFFF, you know only 4K of configuration space exists.
In the context of selecting the protocol to support, I define the following:
Command $01: query current protocol. The parameter block looks like this:
Code:
$00-$0F UUID of the protocol to query support for (set by master).
$10 $FF if supported; $00 otherwise (set by slave).
Command $02: set current protocol. The parameter block looks like the above, except that the indicated UUID is selected as the current protocol. The master must poll on address $30 to wait for this operation to complete, since changing protocols could conceivably take some time. Parameter byte $10 is ignored.