Recently, FreeBSD 11 went into 'release candidate' mode and they've expanded their support for Raspberry Pi, so I tested it [and with minor difficulties, got it working on a model 1 'B'].
one of the first things I noticed was that the /proc method of toggling IO pins wasn't there. (maybe it just wasn't enabled, but I didn't like that interface much anyway, being inherently inefficient).
I did see a link (from a related web page) to a project that has an open source Perl and Python interface, and of course that's _something_ but didn't do what I wanted.
So, I created THIS:
It's a simple utility that lets you configure, read, write to, and query status of the GPIO pins. It's intended to be fast and efficient and easy to work with from a shell script.
(I'm still working on the build environment, i.e. Makefile and man page, and plan on putting it in 'ports', hopefully as 'sysutils/gpio-rpi' or similar. Preliminary versions of the Makefile and man page have already been pushed to github)
At this time the application has the name 'gpio'. if it clashes with others [haven't found any yet] I'll change it before creating a port/package for it.
There are also instructions in the project wiki on github on how to set up the RPi running FreeBSD with respect to security for the /dev/gpioc0 device, so that non-root users can access it [basically set up /etc/devfs.conf and an entry in /etc/group specifying a group like 'gpio' to have access to it).
In any case, give it a try, post what you think
On a related note, if you wanted to blink the status LED twice, you could use a command line like this:
gpio -w16=0 -d250000 -w16=1 -d250000 -w16=0 -d250000 -w16=1
that would assign 0 to GPIO 16 (the status LED), wait 250000 microseconds, then set it to a 1, then wait again, then set it to a zero, etc.. When GPIO16 is a zero, the LED is lit. Normally it's a 1.
in theory you could build a command line that sent an entire bytes' worth of data over something similar to an SPI port, although the delay function just uses 'usleep()' at the moment. If timing becomes critical it could theoretically be modified to switch into a near 'real time' priority and spin for timing control. so maybe as sample code it has even MORE use...