Raspberry Pi LPC1114 I/O Processor Expansion Board SPI Agent Shared
../
Makefile  7355Jan 13 14:35:42 2024
README.txt  3181Jan 23 09:38:20 2024
adc.c  2089Jan 25 01:42:45 2018
clients/  512May 18 16:30:48 2021
config.c  3905May 16 02:34:04 2018
control  241Jan 13 14:35:42 2024
errmsg.inc  1430Jan 11 02:21:23 2018
gpio.c  3013Jan 11 02:21:23 2018
interrupt.c  3863Feb 9 11:52:09 2019
legorc.c  2191Jan 25 01:42:45 2018
pwm.c  4277May 18 12:57:03 2019
resolve.c  1779Jan 11 02:21:23 2018
resolve.h  1331Jan 11 02:21:23 2018
sfr.c  1920Jan 11 02:21:23 2018
spi_agent_services.c  5496Jan 7 03:28:11 2019
spi_agent_services_http.c  6513Nov 23 12:32:12 2020
spi_agent_services_i2c.c  3283May 16 02:34:04 2018
spi_agent_services_ioctl.c  4287May 16 02:34:04 2018
spi_agent_services_oncrpc.c  3532Jan 25 01:42:45 2018
spi_agent_services_spi.c  3136May 16 02:34:04 2018
spi_agent_services_xmlrpc.c  4938Jan 25 01:42:45 2018
timer.c  6974May 18 12:57:03 2019
Library

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)

Operating System Notes

Unix Derivatives (Linux, MacOS X, OpenBSD, etc.)

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

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.


Questions or comments to Philip Munts phil@munts.net