The Linux NCP-Link Project
Psion palmtop computers typically communicate with a PC (or Mac) using Psion's PsiWin (PsiMac) product. (Or RCOM, or MCLINK). These products provide three communications protocols running over the serial link: a logical link protocol, a data transport and multiplexing protocol and a file server protocol. PsiWin also provides application-specific data-convertors. There is no corresponding product for Linux. Products exist which require specialised daemons running on the Psion, but none utilise the built in protocols. This project attempts to provide Linux support for the three built-in protocols (so you can see your Linux system from your Psion), and a Linux filesystem driver for the remote file server protocol (So you can mount the Psion's file systems on your Linux system). Of course, with Linux being available on more than one architecture, this software will run anywhere you have Linux. It has been tested on Intel and Sparc Linux, and can be ported easily to any UNIX.
Table Of Contents
1 Project StatusI've been beaten to it (again) - Philip Proudman released his stack (plp) and Fritz Elfert extended it (plptools). So, I've abandoned work on my own protocol stack, and am concentrating on extending plptools. My efforts towards this can be found here.
The only part of this project likely to survive is the NCP protocol analyser,
and the Linux Kernel modules - I'll create new pages for these as and when I
Release 0.02 on hold.
What may be of use to you (if you're a developer) are the scope and ncpscope programs, contained in the package. They are a general-purpose RS232 line monitor/logger (This is now a separate package - see scope for more details) - and a PLP/NCP/RFSV protocol analyser. The first is relatively finished, the second isn't, but still very useful. There is also a captured session, created by scope, when I was copying files etc. between my Psion 3c and PsiWin1.1. Run this through ncpscope to find out what's going on...
I'll continue refining ncpscope, so check back here from time to time...
I've crashed my Psion 3c several times during development of my driver program (not scope or ncpscope) - once, erasing the entire internal ramdrive, otherwise just resetting it, requiring a re-installation of icons and preferences.
This surprised me somewhat - I can understand my software being buggy, but it shouldn't crash the remote system. (I'm told that if a loadable device driver panics, it causes a SIBO kernel fault. Sounds suspiciously like a reboot to me!)
You can grab it here: linux-ncp-0.01.tar.gz.
Although the ncp program source is included in this package, it won't build
(since it's not finished yet). All you get is scope and ncpscope.
Feedback on this software is most welcome, either to me directly, or to the
following mailing list...
To subscribe, send a message to firstname.lastname@example.org,
containing the message subscribe linux-psion.
For information on writing Linux Device Drivers/Filesystems/Line Disciplines, I have to thank:
3 Appendix A: Protocol DocumentationThis appendix contains an overview of the protocols in use, followed by more technical descriptions of the frame formats.
It isn't finished.
So, the first phase will handle physical, logical, network layers, and provide a LINK server and SYS$RFSV server. The second phase will provide a RFSV client that maps Linux VFS requests into RFSV protocol frames, routed over NCP/PLP.
I may separate PLP and NCP into a line discipline module - I haven't
PLP is a simple protocol, designed to fit into small amounts of memory, based on the MicroCom Network Protocol (MNP). It provides a symmetric full-duplex link, with error-detection being aided by the CCITT 16-bit CRC, with polynomial x16+x12+x5+1 (i.e. starting value 0x1021).
Frames are numbered, multiple retransmissions are allowed, and the the window size is only one, so the link is probably not very efficient (but it doesn't need to be).
Every frame that is sent must be acknowledged. If no acknowledgement is received within some as-yet unascertained tineout period, the frame is resent.
Frames may be up to 300 bytes, and the frame size is variable. PLP (or is it NCP?) will segment large transmissions into 300-byte chunks as necessary.
PLP is a data transfer protocol, not a file transfer protocol - additional
application layers need to be added which supply file access and management
facilities. PLP protocol passes undifferentiated bytes.
SYN HEADER TYPE DATA FOOTER CRCWhere:
3.3 The NCP Protocol
3.3.1 DescriptionAgain, this is implemented in the SYS$NCP process on the Psion.
Once a physical connection has been made (the driver sees the DSR signal, i.e. the remote side's DTR), the Psion's PLP layer will send a LINK REQUEST message to the PC, which must be acknowledged.
Then, the Psion NCP layer exchanges logon messages with the remote side. The logon messages contain a version number and the time at which the NCP layer started. This allows connections to be re-started in the event of a logical or physical layer failure. SIBO computers tend to reply with a version3, whereas PsiWin is version 2.
These logon messages are sent as NCON_MSG_NCP_INFO frames. The Psion's frame is received and acknowledged, and then the PC must send one, which will be acknowledged. The NCP link is then active.
NCP provides eight logical channels, multiplexed over the physical link. Channel 0 is used by the NCP protocol driver itself, to communicate with its remote counterpart, and is the only channel that does not have to be explicity connected to.
Applications talk over the remote link, over a given channel. NCP talks to NCP over channel zero. For instance, the timestamp frames explained above are sent over channel 0. The remaining seven channels are available for applications (Although LINK and SYS$RFSV take up two, automatically).
Applications can send frames of arbitrary sizes; NCP performs
fragmentation and reassembly.
TX-CHANNEL RX-CHANNEL DATAWhere:
Need to finish description of NCP, and start on...
LINK also handles IPC (Inter-Process Communication) messages. Applications may send the following messages to the LINK process:
3.4.2 Frame FormatsDon't know these yet.
3.5 The SYS$RFSV application
3.5.1 DescriptionThe Series 3 LINK application is responsible for opening the PLP/NCP link, and starting the SYS$RFSV process, which acts as a server for RFSV messages. LINK will create a filesystem node called REM:: which (presumably) receives filesystem access requests from the OS, these get translated into RFSV requests, sent over the NCP link to the remote RFSV process which will perform the necessary filesystem accesses and respond.
In phase I of this implementation, only the RFSV server will be provided,
allowing you to access the Linux filesystem from your Psion. Phase II is
to write a userfs daemon which converts userfs/VFS requests into RFSV frames,
channeled over NCP so that the Linux system can mount the Psion's drives. i.e.
an RFSV client.
FRAME-NUMBER COMMAND SIZE DATAWhere:
To be continued...