NGW100 My OS and EDXS/LSELast edited on Feb 25, 2012

Peripheral communication - EDXS/LSE

External Data eXchange Services

Peripherals are abstracted at a minimum by the OS. The OS abstracts the devices while applications must implement their drivers.A peripheral can send data (from the device to external environment) or receive data (from enviroment into the device). The OS is responsible for receiving data from the peripherals upon interrupt and to try send data until the device is ready. The module responsible for allowing the OS to exchange data between applications and peripherals is called the External Data eXchange Services (EDXS). The EDXS provides the following services:

  • Sending: An application may request the OS the to send the contents of a buffer out of a peripheral (serial port, ethernet, etc.) the OS will provide a function that waits until the device is ready and send the data. Therefore, sending functions are blocking.
  • Receiving: The OS gets notified by peripherals that data is available trough the use of interrupts. The OS will extract data from the peripheral and store it in a temporary buffer. The OS will provide a function that returns the available data if available or an error if no data is available. The OS will not notify applications that this data has been received, it is the responsibility of the applications to verify if data is ready. Receiving functions are synchronous and non-blocking.

The following is a list of device services provided by the EDXS:

  • SFlashSend
  • SFlashRecv
  • SDSend
  • SDRecv
  • EthRecv
  • EthSend
  • SerialRecv
  • SerialSend

Logical Services Extension

The EDXS allows an application to exchange raw data with peripherals. This is often not convenient though. For this reason, an extension to the EDXS is provided by the OS. This is called the Logical Services Extension (LSE). The LSE is always used with the EDXS (EDXS/LSE). Since it is impractical, with the EDXS, to access the dataflash or the ethernet controllers, the LSE will provide functions that allow applications to access a more generalized representation of the device. The LSE provides the following abstractions:

  • FAT32 File system.
    To access the dataflash and MMC
    • FSOpenFile
    • FSCloseFile
    • FSReadFile
    • FSWriteFile
    • FSDeleteFile
    • FSCreateFile
  • IP interface
    takes care of ARP,DHCP,DNS
    udp sockets
    tcp sockets (takes care of SYN/ACK and all ACKS)
    • IPInit: set ip/gateway/subnet
    • TCPConnect
    • TCPAccept
    • TCPRecv
    • TCPSend
    • TCPClose
    • UDPRecv
    • UDPSend

User interface

The EDXS/LSE provide functions that must execute in supervisor mode but accessible from application mode. For this, the "scall" mechanism will be used. The functions provided by EDXS/LSE will all be accessible trough supervisor calls. A user friendly API that wraps those call will be provided.