1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 21:58:06 +11:00
collapseos/doc/protocol.txt
Virgil Dupras 1a6a549857 Make the SPI Relay protocol support multiple devices
Working on programming AVR chips exposes a glaring omission in my
first design of the SPI Relay: not allowing multiple devices make
this task hard. I constantly have to unplug my SD card before, plug
the AVR chip holder, then play a bit, then unplug the AVR holder,
then replug the SD card...

My prototype for a SPI relay design is built, but I haven't tested
it yet. I need to adapt the code first, which is what I do here.

When the prototype is tested, I'll update the SDC recipe with a new
schema.
2020-09-17 09:48:55 -04:00

40 lines
1.2 KiB
Plaintext

# Protocols
Some subsystems (and in the case of KEY and EMIT, the core) re-
quire drivers to implement certain words in a certain way. For
example, the core requires drivers to implement (key) and (emit)
or else it won't know how to provide a console.
These protocols are described here.
# TTY protocol
(key) -- c Returns the next typed key on the console.
If none, block until there is one.
(emit) c -- Spit a character on the console.
# PS/2 protocol
This protocol enables communication with a device that spits
PS/2 keycodes.
(ps2kc) -- kc Returns the next typed PS/2 keycode from the
console. Blocking.
# SPI Relay protocol
This protocol enables communication with a SPI relay. This
protocol is designed to support devices with multiple endpoints.
To that end, (spie) takes a device ID argument, with a meaning
that is up to the device itself. To disable all devices, supply
0 to (spie).
We expect relay devices to support only one enabled device at
once. Enabling a specific device is expected to disable the
previously enabled one.
(spie) n -- Enable SPI device
(spix) n -- n Perform SPI exchange (push a number, get a
number back)