../ | ||
Makefile | 7355 | Jan 13 14:35:42 2024 |
README.txt | 3181 | Jan 23 09:38:20 2024 |
adc.c | 2089 | Jan 25 01:42:45 2018 |
clients/ | 512 | May 18 16:30:48 2021 |
config.c | 3905 | May 16 02:34:04 2018 |
control | 241 | Jan 13 14:35:42 2024 |
errmsg.inc | 1430 | Jan 11 02:21:23 2018 |
gpio.c | 3013 | Jan 11 02:21:23 2018 |
interrupt.c | 3863 | Feb 9 11:52:09 2019 |
legorc.c | 2191 | Jan 25 01:42:45 2018 |
pwm.c | 4277 | May 18 12:57:03 2019 |
resolve.c | 1779 | Jan 11 02:21:23 2018 |
resolve.h | 1331 | Jan 11 02:21:23 2018 |
sfr.c | 1920 | Jan 11 02:21:23 2018 |
spi_agent_services.c | 5496 | Jan 7 03:28:11 2019 |
spi_agent_services_http.c | 6513 | Nov 23 12:32:12 2020 |
spi_agent_services_i2c.c | 3283 | May 16 02:34:04 2018 |
spi_agent_services_ioctl.c | 4287 | May 16 02:34:04 2018 |
spi_agent_services_oncrpc.c | 3532 | Jan 25 01:42:45 2018 |
spi_agent_services_spi.c | 3136 | May 16 02:34:04 2018 |
spi_agent_services_xmlrpc.c | 4938 | Jan 25 01:42:45 2018 |
timer.c | 6974 | May 18 12:57:03 2019 |
The shared library libspiagent.so encapsulates abstract services for communicating with the Raspberry Pi LPC1114 I/O Processor Expansion Board SPI Agent firmware, using various local and network transport services.
The following declarations, extracted from spi-agent.h, specify the abstract services that are available:
// SPI Agent Firmware services extern void spiagent_open(const char *servername, int32_t *error); extern void spiagent_command(SPIAGENT_COMMAND_MSG_t *cmd, SPIAGENT_RESPONSE_MSG_t *resp, int32_t *error); extern void spiagent_close(int32_t *error);
The service transport scheme and server hostname or IP address are encoded in the servername parameter supplied to spiagent_open(), using a form of URL notation. The following service transport schemes are defined:
ioctl://localhost | Linux ioctl() SPI device API (Raspberry Pi Linux, local machine only) |
http://<servername> | HTTP via libcurl |
oncrpc://<servername> | ONC/RPC Remote Procedure Call (over UDP) |
xmlrpc://<servername> | XML-RPC Remote Procedure Call (over HTTP) |
Ada, C, Free Pascal, Java, and Python3 all fully support libspiagent.so. Each of these programming languages has its own thin binding module.
All of the service transports described above are included in the prebuilt library for the Raspberry Pi, and the ioctl() transport is default for best performance.
For a Unix derivative network client, libspiagent.so can be built to include HTTP, ONC/RPC, and XML-RPC service transports. The default service transport is ONC/RPC over UDP for best performance.
Microsoft Windows is problematic. It is possible to build libspiagent.dll using Cygwin. That DLL can then be used for C and Python3 clients using Cygwin tools, but not with GNAT Ada, nor Free Pascal, nor ActivePython for Windows nor the official Python for Windows. The DLL also malfunctions with the Cygwin GNAT Ada compiler toolchain, causing hangs at program exit.
The Cygwin libspiagent.dll can be built to include HTTP, ONC/RPC, and XML-RPC transports. The default service transport is ONC/RPC over UDP for best performance.