Repository navigation
Conversation
The Opto22 PCI-AC5 driver was removed in dd394d9 because it only built for RTAI kernels and nobody was known to use or be able to test it. It is in daily use on a milling machine here, so port it instead. Only the PCI discovery and mapping change: pci_get_device() / ioremap_nocache() become a rtapi_pci driver (probe/remove, rtapi_pci_ioremap_bar), and readl()/writel() go through ac5_read() / ac5_write(), which keep readl()/writel() in a kernel build and do a volatile 32 bit access on the mapped BAR in uspace. Pins, parameters, functions and the read/write logic are unchanged. The uspace rtapi_pci matches subvendor/subdevice exactly (no PCI_ANY_ID), so the id table lists the subsystem IDs the card reports (148a:ac05). The driver is built like hal_gm, for uspace and RTAI. Its docs, man page and component-list row are restored.
Whitespace only, no code change (git diff -w is empty). Tabs are expanded and the old functions are reindented to 4 spaces per level as asked in review.
As suggested in review: digital-read computes the input state once and writes it to the pin and the -not pin, and digital-write reads the output pin and its invert parameter once each. Same behaviour, the output test is now simply val == inv.
| * 'opto_ac5.[BOARDNUMBER].port[PORTNUMBER].in-[PINNUMBER] OUT bit' - | ||
|
|
||
| * 'opto_ac5.[BOARDNUMBER].port[PORTNUMBER].in-[PINNUMBER]-not OUT bit' - |
There was a problem hiding this comment.
The HAL types have been renamed and bit is now called bool (several more instances below).
IIRC, the only pins this driver makes are bools.
| **opto_ac5.**_BOARDNUMBER_**.port.**_PORTNUMBER_**.in-**_PINNUMBER_ OUT bit:: | ||
| + | ||
|
|
||
| **opto_ac5.**_BOARDNUMBER_**.port.**_PORTNUMBER_**.in-**_PINNUMBER_**-not** OUT bit:: |
There was a problem hiding this comment.
Same issue: bit --> bool
(must be done everywhere appropriate)
| *PCI AC5 ADAPTER CARD / HAL DRIVER* | ||
|
|
There was a problem hiding this comment.
The file is called opto22.adoc whereas the card is called PCI AC5. The driver file is called opto_ac5.*. This is rather confusing. Was that always the case? The Opto22 is the manufacturer. Are there other cards from that manufacturer? Maybe use opto_ac5.adoc?
| int msgLevel, error=0; | ||
|
|
There was a problem hiding this comment.
There are some stray tabs here.
| int halError=0, channel,mask,portnum=0; | ||
|
|
| // Read digital I/O register. | ||
| pins= ac5_read(pboard, offset); |
There was a problem hiding this comment.
Stray tab or just misplaced space at pins=
| board_data_t *pboard = (board_data_t *)arg; | ||
| DigitalPinsParams *pDigital; | ||
| int portnum=0; | ||
| unsigned int i,j; | ||
| unsigned long pins, offset=DATA_WRITE_OFFSET_0,mask; |
There was a problem hiding this comment.
Are there tabs here or just many spaces?
And then, the spaces around = and , are inconsistent.
Yes, please do. Also, if we need this driver tested in the future, may we ask you again?
Yes, please do. |
Follow-up to #4880.
The Opto22 PCI-AC5 driver was removed in #4513 because nobody was known to use or test it. I use one on my milling machine, so this brings it back, ported to rtapi_pci so it builds and runs on uspace.
Tested on Debian 13, 6.12 PREEMPT_RT, i7-2600, base thread at 90 us, master run-in-place with my full machine config: e-stop, home all on X/Y/Z/A, jog on every axis, spindle CW/CCW and speed changes. in/in-not checked in halrun on all port 1 inputs. For the invert param itself I have nothing to look at on the hardware, none of my outputs use it.
I can keep testing on the machine during the review. Squash the commits if you prefer it as one.