Raspberry Pi LPC1114 I/O Processor Expansion Board SPI Agent Shared
../
Makefile  7291Feb 4 01:08:33 2019
README.html  3521Sep 7 00:41:14 2017
README.txt  3324Sep 7 00:41:14 2017
adc.c  2089Jan 25 01:42:45 2018
clients/  512Mar 15 03:03:21 2016
config.c  3905May 16 02:34:04 2018
control  218Dec 10 07:04:45 2016
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  6512Jan 25 01:42:45 2018
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

I am available for custom system development (hardware and software) of products using the Raspberry Pi or other ARM microcomputers.