SOFTWARE MANUAL EKF Intelligent I/O Controller Family On &RPSDFW3&, Document No.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Contents Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - 2 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - 5 About this Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Edition History . . . . . . . . . . . .
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Clear Performance Statistics: IOCTL_SERIAL_CLEAR_STATS . . . . . . Clear Modem Line DTR: IOCTL_SERIAL_CLEAR_DTR . . . . . . . . . . . . Clear Modem Line RTS: IOCTL_SERIAL_CLEAR_RTS . . . . . . . . . . . . Get Configuration Size: IOCTL_SERIAL_CONFIG_SIZE . . . . . . . . . . . Get Port Baud Rate: IOCTL_SERIAL_GET_BAUD_RATE . . . . . . . . . . Get Special Characters: IOCTL_SERIAL_GET_CHARS . . . . . . . . . . . .
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI EKF_DOWNLOAD_PARAMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - 68 Command Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - 69 Get Version Of The Firmware: CMDIMR_VERSION_GET . . . . . . . . . . . . . . - 70 Initialize A Port: CMDIMR_INIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - 71 Deinitialize A Port: CMDIMR_DEINIT . .
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Tables I/O Control Requests Supported . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - 24 Address Translation Unit Configuration Header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - 49 ATU Extended PCI Configuration Register Space . . . . . . . . . . . . . . . . . . . . . . . . . . . - 50 Subsystem and Subvendor IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI About this Manual This manual describes the technical aspects of the Windows NT4/2000 driver and the board level interface to members of EKF’s Intelligent I/O Controller family, required for installation and system integration. It is intended for system administrators, and for driver and application writers only. Edition History EKF Document “ekf960mle.wpd” Text #2468 Ed.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Legal Exclaimer - Liability Exclusion This manual has been edited as carefully as possible. We apologize for any potential mistake. Information provided herein is designated exclusively to the proficient user (system integrator, engineer). EKF can accept no responsibility for any damage caused by the use of this manual. -7EKF Elektronik GmbH * Philipp-Reis-Str. 4 * D-59065 HAMM (Germany) Tel. +49 (0)2381/6890-0 * Fax.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Windows NT4/2000 Driver Description This chapter describes the requirements and features of the Windows NT4/2000 device driver “ekf960si1" for the EKF Intelligent I/O Controller family. Furthermore all issues related to the installation on a Windows NT4 respective Windows 2000 system are discussed.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI If the board isn’t still found after removing this jumper, check whether your system CPU board supports the so-called spread spectrum clocks on the CompactPCI bus. The clock in this case is modulated by another low frequent clock (typical 0.5% of the base clock) with the advantage of an improved EMC behaviour.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Software Requirements Board Firmware To use the ports on the I/O controllers, the local firmware on the adapters must run. See section “Hardware Requirements” above for correct jumper setting to make sure that. The driver “ekf960si1" checks whether the firmware responses to messages sent to it and whether the version of this firmware is proper to work with it.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI gives a description of all options and arguments accepted by the utility. The application “comtest.exe” can be included into other applications or batch files when the possibility for automatic firmware update is desired. Windows NT4/2000 The driver “ekf960si1" delivered by EKF was tested under Windows NT4 with at least service pack 4 installed. On a Windows 2000 system all driver tests were performed without a service pack installed.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Installation On a Windows NT4 system simply run the “setup.exe” installer on the installation disk labeled "EKF's Intelligent Serial Driver for i960 Board Family WinNT/2000" and follow the instructions. At the end of the installation procedure you should reboot the system to start the driver. The driver currently distributed does not support Windows 2000's PnP.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Registry Entries Many parameters of the driver are controlled by registry entries. Normally there is no need to change these keys manually because the setup procedure will do all the work for you. Caution is given if you make any changes to the entries. Note down the old value before modifying an entry, so you can restore it if you run into trouble. The following section gives an explanation of all registry keys the driver will use.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI "DEVICES_PER_BOARD"=dword:00000010 number of ports on the board, e.g.: CHORUS: 16, QUARTET: 4. "PCI_BUS_NUMBER"=dword:00000001 number of the PCI bus where the board is attached to. "PCI_BUS_SLOT"=dword:0000000B number of the PCI device where the board is attached to. Do not confuse this number with the CompactPCI rack slot number. "VALID"=dword:00000001 defines wether the board should be ignored (VALID = 0) by the driver.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI "ACCEPTANCE_SINGLE"=dword:00000001 build a single acceptance filter when set (ACCEPTANCE_SINGLE != 0), else a dual filter configuration is created. 1) "BASE_CLOCK"=dword:016E3600 CANbus clock frequency in Hz, depends on the oscillator mounted on the board, allowed values are: 8000000, 16000000, 24000000. "DEVICE_TYPE"=dword:00000001 specifies the type of the I/O device: 0 or absent defines a serial port, 1 defines a CANbus port.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Driver Dispatch Functions The driver supports most of the functionality of the usual Windows NT4/2000 “Serial” device driver for the serial ports. Standard applications like the “HyperTerminal” are working with the serial ports on EKF’s Intelligent I/O Controllers without any problem.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI BreakChar: This character, when enabled, is placed in the stream of received characters when a break condition was detected. EventChar: When enabled, an event is sent by the driver to the application, if this character was received by the port. XonChar: Defines the XON character that resumes an earlier stopped data transmission if XON/XOFF flow control is enabled.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI SERIAL_AUTO_TRANSMIT: Use the XON/XOFF protocol based flow control for output. The reception of the XoffChar will stop data transmission until the XonChar is received (see also structure SERIAL_CHARS). SERIAL_AUTO_RECEIVE: Use the XON/XOFF protocol based flow control for input. The XoffChar is send by the controller if the receive buffer reaches the programmed high water mark.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI ReceivedCount: The number of characters received successfully. TransmittedCount: The number of characters transmitted successfully. FrameErrorCount: The number of framing errors detected by the serial controller. SerialOverrunErrorCount: The number of overruns of the serial controller’s internal receive FIFO. BufferOverrunErrorCount: The number of overruns of the read ring buffer maintained by the firmware.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI SERIAL_TX_WAITING_ON_BREAK SERIAL_RX_WAITING_FOR_DSR AmountInInQueue: The number of bytes that reside currently in the port’s read ring buffer. AmountInOutQueue: The number of bytes that reside currently in the port’s write buffer. EofReceived, WaitForImmediate: These flags are not used by the driver and will always return FALSE.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Loading / Unloading The Driver At boot time the system will automatically load and start the driver. The driver then looks in the registry for the installed hardware it supports, initializes all ports and makes them visible to the system. The driver also supports its unload from the system. This can be made under Windows NT4 from the Devices Menu of the Control Panel.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI CreateFile returns a handle to the device opened. If the opening failed, the constant INVALID_HANDLE_VALUE is returned and a call to GetLastError returns a corresponding error code. To close an previously opened port the C function CloseHandle should be used. When closing a serial port, the driver waits for the transmission of the data that currently reside in the transmit FIFO of the UART.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Call: Ekf960SendCanFrame( handle, // handle returned by CreateFile pOverlapped, // optional pointer to overlapped buffer (may be NULL) SendID, // transmit identifier CAN_FLAG_EXTENDED, // send an extended (29 bit ID) frame bytesToWrite, // number of data bytes to write pBytesWritten, // pointer to number of data bytes written pData, // pointer to data buffer pStatusRecord // optional pointer to status record (may be NULL) ); The write o
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Call: Ekf960ReceiveCanFrame( handle, // handle returned by CreateFile pOverlapped, // optional pointer to overlapped buffer (may be NULL) pExtended, // pointer to a boolean that will be TRUE if the received // frame has an extended (29 bit) identifier pRemoteXmit, // pointer to a boolean that will be TRUE if the received // frame has the remote transmit request flag set pIdentifier, // pointer to a long that will be filled with the ident
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI I/O Control Request Serial Device IOCTL_EKF960SI1_GET_STATS_CAN IOCTL_EKF960SI1_SET_ACCEPTANCE IOCTL_SERIAL_CLEAR_STATS IOCTL_SERIAL_CLEAR_DTR IOCTL_SERIAL_CLEAR_RTS IOCTL_SERIAL_CONFIG_SIZE IOCTL_SERIAL_GET_BAUD_RATE IOCTL_SERIAL_GET_CHARS IOCTL_SERIAL_GET_COMMSTATUS IOCTL_SERIAL_GET_DTRRTS IOCTL_SERIAL_GET_HANDFLOW IOCTL_SERIAL_GET_LINE_CONTROL IOCTL_SERIAL_GET_MODEMSTATUS IOCTL_SERIAL_GET_PROPERTIES IOCTL_SERIAL_GET_STATS IOCTL_SERIA
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Most of these I/O controls are entered by the C function DeviceIoControl, nevertheless exists a couple of specialized C functions.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Lock Firmware Flash ROMs: IOCTL_EKF960SI1_FLASH_LOCK This I/O control request locks the firmware flash ROMs on an I/O controller for exclusive use.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Call: DeviceIoControl( handle, // handle returned by CreateFile IOCTL_EKF960SI1_FLASH_WRITE, pData, // pointer to a EKF_DOWNLOAD_PARAMS structure 1) sizeof(*pData) + pData->byteCount, NULL, 0, &unused, // pointer to a DWORD variable pOverlapped // optional pointer to overlapped buffer (may be NULL) ); Note: 1 ) This structure contains the size of the download data block and the offset within the flash ROMs where to write it.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Call: DeviceIoControl( handle, // handle returned by CreateFile IOCTL_EKF960SI1_GET_ACCEPTANCE, NULL, 0, pAcceptance, // pointer to a SJA1000_ACCEPTANCE structure 1) sizeof(*pAcceptance), &unused, // pointer to a DWORD variable pOverlapped // optional pointer to overlapped buffer (may be NULL) ); Note: ) The acceptance filter setting is returned in this structure. It is defined in the C header file “ntddekf.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Setup Acceptance Filter: IOCTL_EKF960SI1_SET_ACCEPTANCE This I/O control request sets up the acceptance filter for a CANbus port.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Clear Modem Line DTR: IOCTL_SERIAL_CLEAR_DTR This I/O control request clears the modem line Data Terminal Ready (DTR) on a serial port.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Get Port Baud Rate: IOCTL_SERIAL_GET_BAUD_RATE This I/O control request returns the baud rate that is currently set on a serial or CANbus port.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Get Port Status: IOCTL_SERIAL_GET_COMMSTATUS This I/O control request returns the current communication status of a serial or CANbus port. This includes the number of characters in the read and write buffers, the error status and so on.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Note: 1 ) The DWORD Status contains zero or more of the following flags: SERIAL_DTR_STATE: SERIAL_RTS_STATE: DTR line is set RTS line is set The flags are defined in the C header file “ntddekf.h” delivered with the driver installation package. Get Flow Control: IOCTL_SERIAL_GET_HANDFLOW This I/O control request returns the handshake and flow control that currently is set on a serial port.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Note: 1 ) The line control settings are returned in this structure. It is defined in the C header file “ntddekf.h” delivered with the driver installation package. Get Modem Status: IOCTL_SERIAL_GET_MODEMSTATUS This I/O control request returns the current modem line settings of a serial port.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Get Performance Statistics: IOCTL_SERIAL_GET_STATS This I/O control request returns the current performance statistics of a serial port. To get the statistics for a CANbus port use IOCTL_EKF960SI1_GET_STATS_CAN.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Get Wait Mask Setting: IOCTL_SERIAL_GET_WAIT_MASK This I/O control request returns the event mask that is currently set on a serial or CANbus port.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Call: DeviceIoControl( handle, // handle returned by CreateFile IOCTL_SERIAL_LSRMST_INSERT, &EscapeChar, // pointer to an UCHAR variable containing the escape // character sizeof(EscapeChar), NULL, 0, &unused, // pointer to a DWORD variable pOverlapped // optional pointer to overlapped buffer (may be NULL) ); Purge Read/Write Queues: IOCTL_SERIAL_PURGE This I/O control request is used to cancel the specified requests and to remove any d
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Call: DeviceIoControl( handle, // handle returned by CreateFile IOCTL_SERIAL_RESET_DEVICE, NULL, 0, NULL, 0, &unused, // pointer to a DWORD variable pOverlapped // optional pointer to overlapped buffer (may be NULL) ); Note: The device driver for EKF’s Intelligent I/O Controllers really does nothing when calling this request.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Set Break Off: IOCTL_SERIAL_SET_BREAK_OFF This I/O control request is used to turn off the break condition on a serial device.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Note: 1 ) This structure is used to pass the new special character setting. It is defined in the C header file “ntddekf.h” delivered with the driver installation package. See also description in section “SERIAL_CHARS” Set Modem Line DTR: IOCTL_SERIAL_SET_DTR This I/O control request sets the modem line Data Terminal Ready (DTR) on a serial port.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Setup Line Control: IOCTL_SERIAL_SET_LINE_CONTROL This I/O control request sets up the line control values on a serial port.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Set Modem Line RTS: IOCTL_SERIAL_SET_RTS This I/O control request sets the modem line Clear To Send (RTS) on a serial port.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Call: DeviceIoControl( handle, // handle returned by CreateFile IOCTL_SERIAL_SET_WAIT_MASK, &WaitMask, // pointer to a DWORD variable 1) sizeof(WaitMask), NULL, 0, &unused, // pointer to a DWORD variable pOverlapped // optional pointer to overlapped buffer (may be NULL) ); Note: ) The DWORD WaitMask contains zero or more of the following flags when called for a serial port: 1 SERIAL_EV_RXCHAR: SERIAL_EV_RXFLAG: SERIAL_EV_TXEMPTY: SERIA
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Call: DeviceIoControl( handle, // handle returned by CreateFile IOCTL_SERIAL_WAIT_ON_MASK, NULL, 0, &Event, // pointer to a DWORD variable 1) sizeof(Event), &unused, // pointer to a DWORD variable pOverlapped // optional pointer to overlapped buffer (may be NULL) ); Note: ) The DWORD Event is used to return the events that were occurred. It contains one or more of the event flags defined in the C header file “ntddekf.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Static Library Ekf960si1.lib The driver installation pack comes with the static library “ekf960si1.lib”. This small library currently mainly contains C functions for CANbus port processing, but will be enlarged in the future.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI BOOL Ekf960SendCanFrame( HANDLE handle, LPOVERLAPPED overlap, ULONG identifier, ULONG flags, ULONG dataSize, PULONG pDataSend, PUCHAR pData, PSJA1000_STATUS pStatus ); BOOL Ekf960SetAcceptance( HANDLE handle, LPOVERLAPPED overlap, ULONG AcceptCodeId1, ULONG AcceptCodeId2, ULONG AcceptCodeData, ULONG AcceptMaskId1, ULONG AcceptMaskId2, ULONG AcceptMaskData, ULONG Flags ); BOOL Ekf960SetBaudRate( HANDLE handle, LPOVERLAPPED overlap, ULONG B
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Board Level Interface Description This chapter describes the low level interface to a board of the EKF Intelligent I/O Controller family. It is dedicated to those software developers that have to write a driver for such a board. To support driver writers, EKF delivers C header files that contain most of the necessary stuff like structure and macro definitions.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Address Translation Unit The i960 Rx processor contains two Address Translation Units, a primary and a secondary ATU. The primary ATU builds the data path between the CompactPCI bus and the local data bus, i.e. the local memory. The secondary ATU is not used on any member of EKF’s Intelligent I/O Controller family, thus the focus is set on the primary ATU only, that simply is called ATU in the following.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI ATU Extended PCI Configuration Register Space Address Offset Primary Inbound ATU Limit Register PIALR 0x40 Primary Inbound ATU Translate Value Register PIATVR 0x44 Secondary Inbound ATU Base Address Register SIABAR 0x48 Secondary Inbound ATU Limit Register SIALR 0x4C Secondary Inbound ATU Translate Value Register SIATVR 0x50 Primary Outbound Memory Window Value Register POMWVR 0x54 Reserved 0x58 Primary Outbound I/O Window
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI window occupied by the PCI device. Others are filled by the system controller’s BIOS, e.g. the primary inbound ATU base address register PIABAR.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI MU Register Name Member Name 1) Address Offset Inbound Interrupt Status Register IISR 0x0024 Inbound Interrupt Mask Register IIMR 0x0028 Outbound Doorbell Register ODR 0x002C Outbound Interrupt Status Register OISR 0x0030 Outbound Interrupt Mask Register OIMR 0x0034 0x0038 Reserved 0x003C Inbound Queue Port IQP 0x0040 Outbound Queue Port OQP 0x0044 0x0048 Reserved 0x004C Index Register 0 : : Index Register 1003
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Inbound Message Register 0 (IMR0) Bit Access 31:00 Read/Write Description Inbound Message Word. The Outbound Message Register 0 (OMR0) is used to send messages from the controller to the host. When OMR0 is written by the controller firmware, an interrupt is requested on the CompactPCI bus. Interrupt generation can be disabled by setting bit 0 in the Outbound Interrupt Mask Register OIMR.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Outbound Interrupt MASK Register (OIMR) Bit Access Description 31:08 Read Only Reserved (Read as 0) 7 Read/Write PCI Doorbell Interrupt D Mask. 6 Read Only PCI Doorbell Interrupt C Mask. 5 Read Only PCI Doorbell Interrupt B Mask. 4 Read Only PCI Doorbell Interrupt A Mask. 3 Read Only Outbound Post Queue Interrupt Mask. 2 Read Only Outbound Doorbell Interrupt Mask. 1 Read/Clear Outbound Message 1 Interrupt Mask.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI controller. The inbound parameter buffer is used to pass parameters belonging to a message to the controller. The controller returns parameters in the outbound parameter area as a result of a previously sent message. Write or read data are exchanged in the I/O buffer areas. Each port owns one read and one write buffer each of fixed size.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Command Word Structure Commands passed to the controller via the Inbound Message Register IMR0 are called messages. A message consists of a command word and belonging parameters or data. The command word contains the meaning of the message, the device number involved with the message, the size of belonging parameters or data and some flags.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Exchanging Messages With The Controller When requesting a service from the controller, this is done by the following sequence: 1. 2. 3. Set up a command word with all flags cleared in a local variable. Copy parameter or data to the corresponding area of the MU (if any). Write the command word to the controller’s IMR0. The last step will request an interrupt on the controller that is servicing the message.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI When sending a message to the controller it is important to note, that neither the contents of IMR0 nor the parameter or data buffers should be altered until the controller responds by writing a reply message to OMR0. This is best done by using a semaphore flag that indicates, when set, that the MU is currently in use. Before writing to the MU test and set the flag.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Data Structures Used By The Interface The data structures used by the interface are explained in the following section. They and their possibly corresponding definitions can be found in the C header “ekf960if.h”.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI UCHAR XonChar; UCHAR XoffChar; } EKF16550_CHARS, *PEKF16550_CHARS; EofChar: End Of File character (currently not used). ErrorChar: This character, when enabled, is placed in the stream of received characters on error conditions like buffer overflow, frame errors and so on. BreakChar: This character, when enabled, is placed in the stream of received characters when a break condition was detected.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI EKF16550_DSR_HANDSHAKE: Use the modem signal CTS, DCD or DSR respectively for output flow control. If the corresponding modem line(s) found as cleared, the controller will hold data transmission. EKF16550_DSR_SENSITIVITY: Ignore any character arriving when the DSR line is not set. EKF16550_ERROR_ABORT: If there exists an error condition the controller will send an error message to the host to indicate this.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI SJA1000_ACCEPTANCE A structure that is used to set the frame acceptance code, mask and mode of a CANbus device to build an acceptance filter. See the data sheet of the SJA1000 stand-alone CANbus controller for details on acceptance filter programming. The library “ekf960si1.lib” that is delivered with source files also contains a function to build an acceptance filter.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI UCHAR pad[12]; } EKF_INIT_PARAMS_CAN, *PEKF_INIT_PARAMS_CAN; ClockRate: Base clock of the CANbus controller in Hz. BaudRate: Initial baud rate in bits per second. Acceptance: Structure containing the initial acceptance filter (see description of structure SJA1000_ACCEPTANCE). pad: For alignment purposes.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI BaudRate: Initial baud rate in bits per second. BufferSizePt8: This defines a high water mark that can be used to send an event message to the host if reached. It is by default set to 80% of the receive buffer size.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Errors: A set of flags that reflect the possible errors occurred on a serial port: EKF16550_ERROR_BREAK: a break condition was detected, EKF16550_ERROR_FRAMING: a framing error was detected, EKF16550_ERROR_OVERRUN: an overrun of the serial controller’s internal receiver FIFO occurred, EKF16550_ERROR_BUFFEROVERRUN: an overrun of the read ring buffer maintained by the firmware occurred, EKF16550_ERROR_PARITY: a parity error was detected.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI SJA1000_ERROR_FIFOOVERRUN: an overrun of the CANbus controller’s internal receiver FIFO occurred, SJA1000_ERROR_BUFFEROVERRUN: an overrun of the read ring buffer maintained by the firmware occurred, SJA1000_ERROR_BUSOFF: a bus-off event on the CANbus occurred. LastErrorCapture: This reflects the contents of the CANbus controller’s Error Capture Register (ECC) at the moment when a bus error was detected.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI FrameErrorCount: The number of framing errors detected by the serial controller. SerialOverrunErrorCount: The number of overruns of the serial controller’s internal receive FIFO. BufferOverrunErrorCount: The number of overruns of the read ring buffer maintained by the firmware. ParityErrorCount: The number of parity errors detected by the serial controller.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI ErrorWarningIrqCount: The number of Error Warning Interrupts. This count is incremented on every bus status change (bus-on to bus-off or vice versa). ErrorPassiveIrqCount: The number of Error Passive Interrupts. This count is incremented when the CAN controller reaches the error passive status (at least one of the SJA1000 internal error counters reached the level of 127) or leaves the error passive status.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Command Set The following section will give a detailed description of the commands implemented on the EKF Intelligent I/O Controllers. Note that some of these commands are understood only by specific types of controllers. The command codes and their possibly corresponding data structures and definitions can be found in the C header “ekf960if.h”. - 69 EKF Elektronik GmbH * Philipp-Reis-Str. 4 * D-59065 HAMM (Germany) Tel.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Get Version Of The Firmware: CMDIMR_VERSION_GET This command is used to get the version of the firmware currently running on the controller. Description: Command Code: 1. Don’t Care. Port Identifier: Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Initialize A Port: CMDIMR_INIT This command is used to initialize a port specified by the port identifier. The port is brought in a quiescent state. Some device parameters are set to the values passed by the initialization parameter block with this message. Description: Command Code: 2. Command Data: Size of the initialization parameter block in bytes. Parameters: A set of parameters is passed in the inbound parameter area.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI parameter structures for the different types of ports see section “Data Structures Used By The Interface”. - 72 EKF Elektronik GmbH * Philipp-Reis-Str. 4 * D-59065 HAMM (Germany) Tel. +49 (0)2381/6890-0 * Fax. +49 (0)2381/6890-90 * E-Mail info@ekf.de * Internet http://www.ekf.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Deinitialize A Port: CMDIMR_DEINIT This command is used to deinitialize a port specified by the port identifier. The port is brought in a quiescent state, i.e. all of its interrupts will be disabled. Description: Command Code: 3. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Open A Port: CMDIMR_OPEN This command is used to open a port specified by the port identifier. The port is initialized, the receive buffer is purged, i.e. the fill pointer is set to begin of the read buffer, the performance statistics are cleared and finally the port IRQs will be enabled. Description: Command Code: 4. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Close A Port: CMDIMR_CLOSE This command is used to close a port specified by the port identifier. First the port interrupts will be disabled. On serial ports the controller then waits for the transmission of the data that currently reside in the transmit FIFO of the UART. If programmed for XON/XOFF flow control, an XON character is sent when reception was held before by sending XOFF.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Write Data To Port: CMDIMR_WRITE_DATA This command is used to write a block of data to a port specified by the port identifier. The write data is copied to the begin of the write buffer of the corresponding port. Description: Command Code: 6. Command Data: Size of the data block in bytes written to the write buffer. Parameters: None. Data: The data block to write is passed in the write buffer of the port.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI A new WRITE command should issued only if a previous write was completed. Otherwise the contents of the old write data could be corrupted. Do not write the number of the bytes in the write buffer directly to the CharsInBuffer field of the write buffer. This field is managed by the controller only, although reading this field is possible any time.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Kill Current Write: CMDIMR_KILL_WRITE This command is used to kill a write currently in progress on a port specified by the port identifier. Description: Command Code: 7. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Read Data From Port: CMDIMR_RED_DATA This command is used to tell the controller how many data the host has red from a port’s read buffer. The port identifier specifies the port. The reported amount of data was copied from the read buffer of the corresponding port before this command. Description: Command Code: 8. Command Data: Size of the data block red from the read buffer before. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Set Amount Needed For Read: CMDIMR_READ_NEED This command is used to set the amount of data the host needs for a read. The port is specified by the port identifier. As soon as the requested number of bytes are available in the read buffer, the controller sends a message to the host. Description: Command Code: 9. Command Data: Number of bytes needed for the read. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Purge The Read Buffer: CMDIMR_PURGE_READ This command is used to purge the read buffer of a port specified by the port identifier. The number of bytes in the read buffer is cleared and the fill pointer reset to the buffer start. Description: Command Code: 10. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Setup Port Baud Rate: CMDIMR_SET_BAUD This command is used to setup the transmission speed of a port specified by the port identifier. Description: Command Code: 16. Command Data: Size of the baud rate parameter in bytes. Parameters: The baud rate in bits per second as an unsigned long is passed in the inbound parameter area. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Get Baud Rate: CMDIMR_GET_BAUD This command is used to get the baud rate currently set on a port specified by the port identifier. Description: Command Code: 17. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Setup Line Control: CMDIMR_SET_LINE_CTL This command is used to setup the line control value of a port specified by the port identifier. Description: Command Code: 18. Command Data: The line control value in bits 07:00. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Get Line Control: CMDIMR_GET_LINE_CTL This command is used to get the line control value currently set on a port specified by the port identifier. Description: Command Code: 19. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Set Modem Line DTR: CMDIMR_SET_DTR This command is used to set the modem line Data Terminal Ready (DTR) of a port specified by the port identifier. Description: Command Code: 20. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Clear Modem Line DTR: CMDIMR_CLR_DTR This command is used to clear the modem line Data Terminal Ready (DTR) of a port specified by the port identifier. Description: Command Code: 21. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Set Modem Line RTS: CMDIMR_SET_RTS This command is used to set the modem line Request To Send (RTS) of a port specified by the port identifier. Description: Command Code: 22. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Clear Modem Line RTS: CMDIMR_CLR_RTS This command is used to clear the modem line Request To Send (RTS) of a port specified by the port identifier. Description: Command Code: 23. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Setup Flow Control: CMDIMR_SET_HANDFLOW This command is used to setup the flow control values of a port specified by the port identifier. Description: Command Code: 24. Command Data: Size of the flow control parameter structure in bytes. Parameters: The flow control parameter structure EKF16550_HANDFLOW is passed in the inbound parameter area. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Flags Port ID Command Command Data E R R R P L C P L U F ID ID ID ID C 3 2 1 0 7 C 6 C 5 C 4 C 3 C 2 C 1 C D D D D D D D D D D D D D D D D0 0 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 0 0 0 1 0 Y 0 0 0 1 1 0 0 31 28 27 Y Y Y 0 24 23 A 16 15 A A A A A A A A 8 7 A A A A A A A 0 The error message has the command code 12 and passes the error(s) happened in bits 15:00 with the CPL flag s
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Get Flow Control: CMDIMR_GET_HANDFLOW This command is used to get the flow control parameter currently set on a port specified by the port identifier. Description: Command Code: 25. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Get Modem Status: CMDIMR_GET_MODEMSTAT This command is used to get the current modem line setting of a port specified by the port identifier. Description: Command Code: 26. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Get DTR/RTS Status: CMDIMR_GET_DTRRTS This command is used to get the current setting of the modem lines Data Terminal Ready (DTR) and Request To Send (RTS) of a port specified by the port identifier. Description: Command Code: 27. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Setup Special Characters: CMDIMR_SET_CHARS This command is used to setup the special characters of a port specified by the port identifier. Description: Command Code: 28. Command Data: Size of the special characters structure in bytes. Parameters: The special characters structure EKF16550_CHARS is passed in the inbound parameter area. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Get Special Characters: CMDIMR_GET_CHARS This command is used to get the special characters currently set on a port specified by the port identifier. Description: Command Code: 29. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Get Port Status: CMDIMR_GET_COMMSTAT This command is used to get the current status of a port specified by the port identifier. This includes the number of characters in the read and write buffer, the error status and so on. Description: Command Code: 30. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Setup Event Mask: CMDIMR_SET_EV_MASK This command is used to setup an event mask of a port specified by the port identifier. Description: Command Code: 31. Command Data: The event mask in bits 15:00. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI These are the events supported on CANbus ports: SJA1000_EV_RXFRAME: a frame received, SJA1000_EV_BUSOFF: a bus-off event occurred, SJA1000_EV_BUSON: a bus-on event occurred, SJA1000_EV_ERR: an error occurred. An event message is sent to the host if at least one of the enabled events occurred.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Get Event Mask: CMDIMR_GET_EV_MASK This command is used to get the current event mask setting of a port specified by the port identifier. Description: Command Code: 32. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Get Performance Statistics: CMDIMR_GET_STATS This command is used to get the current values of the performance statistic counters of a port specified by the port identifier. Description: Command Code: 33. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Clear Statistics Counters: CMDIMR_CLR_STATS This command is used to clear the performance counters of a port specified by the port identifier. Description: Command Code: 34. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Turn Break On: CMDIMR_BREAK_ON This command is used to turn on break of a port specified by the port identifier. Description: Command Code: 35. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Turn Break Off: CMDIMR_BREAK_OFF This command is used to turn off break of a port specified by the port identifier. Description: Command Code: 36. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Setup Insert Mode: CMDIMR_SET_INSERT_MODE This command is used to setup the insertion of information about the line status and the modem status in the receive data stream of a port specified by the port identifier. An escape character is passed with this message. If the escape character is 0x00 then the insertion mode is turned off. Description: Command Code: 38. Command Data: The escape character in bits 07:00. Parameters: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI If no receive data was available when the receive error occurred, the escape character, EKF16550_LSRMST_LSR_NODATA and the contents of LSR is placed in the read ring buffer. On changes of the modem lines the escape character, the character EKF16550_LSRMST_MST and the contents of the Modem Status Register (MSR) is placed in the read ring buffer.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Erase Firmware Flash ROMs: CMDIMR_FLASH_ERASE This command is used to erase the firmware flash ROMs on the controller. Description: Command Code: 40. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Write Firmware Flash ROMs: CMDIMR_FLASH_WRITE This command is used to write a block of new data to the firmware flash ROMs on the controller. Description: Command Code: 41. Command Data: Size of the download parameter structure in bytes. Parameters: The download parameters structure EKF_DOWNLOAD_PARAMS followed by the download data is passed in the download area. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI The host may use any port ID that is valid for the corresponding board when calling the flash ROM write command. It is not necessary to open the port used before. The size of the download data block is limited to EKF_MU_DOWNLOAD_BUFFER_SIZE minus the size of the structure EKF_DOWNLOAD_PARAMS. Therefore it is necessary to split and download the firmware in several blocks.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Read Firmware Flash ROMs: CMDIMR_FLASH_READ This command is used to read a block of data from the firmware flash ROMs on the controller. Description: Command Code: 42. Command Data: Size of the download parameter structure in bytes. Parameters: The download parameters structure EKF_DOWNLOAD_PARAMS is passed in the download area. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Setup Acceptance Filter: CMDIMR_SET_ACCEPTANCE This command is used to setup the acceptance filter of a port specified by the port identifier. Description: Command Code: 43. Command Data: Size of the acceptance filter structure in bytes. Parameters: The acceptance filter structure SJA1000_ACCEPTANCE is passed in the inbound parameter area. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Get Acceptance Filter: CMDIMR_GET_ACCEPTANCE This command is used to get the current acceptance filter settings of a port specified by the port identifier. Description: Command Code: 44. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Get Statistics Counters: CMDIMR_GET_STATS_CAN This command is used to get the current values of the performance counters of a port specified by the port identifier. Description: Command Code: 45. Command Data: None. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Get CANbus Controller Register: CMDIMR_GET_REG_CAN This command is used to get the current value of a register from the SJA1000 CANbus controller of a CANbus port specified by the port identifier. Description: Command Code: 46. Command Data: The controller’s register number is passed in bits 15:08. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Set CANbus Controller Register: CMDIMR_SET_REG_CAN This command is used to set a register of the SJA1000 CANbus controller of a CANbus port specified by the port identifier to a new value. Description: Command Code: 47. Command Data: The controller’s register number is passed in bits 15:08 and the new register value is passed in bits 07:00. Parameters: None. Data: None.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Error Codes The error codes returned by the command messages are explained in this section. They can be found in the C header “ekf960if.h”. EIMR_UNKNOWN_CMD A message was given to the controller with a command code that is unknown to the firmware. EIMR_BAD_ID A message was given to the controller with a port ID number that doesn’t correspond to a port on the board. In most cases the ID is too large, e.g.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI EIMR_BAD_FRAME A CMDIMR_WRITE_DATA message was given to a CANbus port on the controller that passed a frame with a bad format. EIMR_XMIT_FAILED The transmission of a frame of a CANbus port failed. - 117 EKF Elektronik GmbH * Philipp-Reis-Str. 4 * D-59065 HAMM (Germany) Tel. +49 (0)2381/6890-0 * Fax. +49 (0)2381/6890-90 * E-Mail info@ekf.de * Internet http://www.ekf.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Port Arrangement The EKF Intelligent I/O Controllers may contain one or more ports of different type. These are currently serial ports and CANbus ports. A port on a board is referenced by a port ID. A port ID has a fixed relationship to a port on a board.
Software Manual • EKF Intelligent I/O Controller Family On CompactPCI Additional Documentation A detailed description of the features including the programming of the i960®RP processor, the serial controller 16C550 and the CANbus controller SJA1000 could be find in the documentation listed below.