Dioctl
dioctl is a userspace driver utility to manage the GPIO that goes through the FPGA.
Overview
To manipulate the GPIO controller we have implemented in the FPGA we have created dioctl. This provides a consistant and simple way for managing dio with different boards.
XUART serial ports are implemented entirely from userspace. The 8 serial ports have a single shared 4kByte receive FIFO which makes real time interrupt latency response less of a concern and in actual implementation, the serial ports are simply polled at 100Hz and don't even use an IRQ. Even with all 8 ports running at 230400 baud, it is not possible to overflow the receive FIFO in 1/100th of a second. The "xuartctl --server" daemon is started by default in the INITRD linuxrc file which sets up listening TCP/IP ports for all 8 XUART channels on ports 7350-7357. An application may simply connect to these ports via localhost (or via the network) and use the serial ports as if they were network services.
Usage
The xuartctl utility is split into 2 parts. The first part is the main server. This server must run on the board and provides the communication between the FPGA and the TCP ports. This can be created by running:
xuartctl --server
You can also specify the speed and mode arguments to make them the default for the port servers. The port servers are created by simply specifying a port after the main server has been started:
xuartctl --server --port=0 --speed=115200
Help
General options:
-a | --arch display what arches this binary supports
-s | --server=<port> Daemonize and run as server listening on port
-o | --poll=rate milliseconds between DIO polls (0 = never poll)
-f | --file=board read the config definitions for the specified board
-p | --port=<host><:port> Talk to dioctl server
-g | --getcaps Get DIO capabilities
-m | --model Get model id of board
-l | --lookup=name Get logical DIO number from DIO name
-L | --lookup=name:value Get full DIO name from partial match and value
-D | --define=name:DIOnum Associate new name with logical DIO number
-U | --undef=name De-Associate name with logical DIO number
-r | --read=DIOnum Read the state of the specified DIO
-1 | --1=DIOnum set the specified DIO to output and drive high
-0 | --0=DIOnum set the specified DIO to output and drive low
-i | --input=DIOnum set the specified DIO to an input
-G | --group=num:val1... set the specified DIO Group number to the list of DIOs
-w | --wait=num:val1... wait for any DIO in the specified group number to be the given value
-W | --wait=num:val wait for the specified DIO number to read as the given value
-t | --test test macro-controller with base board
-B | --bus=debuglevel log bus cycle accesses to stderr
-d | --dump dump a table of the current servers DIO mappings
To specify a DIO group where a DIO number is expected, add 1000 to the group number.
Otherwise, DIOnum can be specified by an absolute DIO number, a DIO name, or
the connector name.