Linx Port Devices Driver

Posted on

Install FTDI drivers for FTDI devices using Linux. 1.1 Overview FTDI has two types of drivers for all supported operating systems. These are the virtual COM port driver (VCP) and the D2XX API driver. Since the FTDI VCP driver is built into the Linux kernel, this document will focus on the installation of the D2XX driver. If you want to go for Linux device driver development, the freely available O'Reilly book Linux Device Drivers, Third Edition is a must read. In order to find unsupported hardware pieces for which you could write a driver, ask on the Linux mailing lists. Maybe some USB 3.0 device? How to query or control network driver and hardware settings in Linux. For wired Ethernet devices, you need to use a command called ethtool. It provides the following information from the Linux CLI. Display info about network adapter status; Find identification and diagnostic information; Get extended device statistics. With a full-size USB port, the Linx 12X64 lets you connect all your external devices wihtout the need for additional hubs or cables. Whether you need files from your external HDD, prefer to use a mouse when working, or just want to connect with your Windows Xbox controller for a better gaming experience, the Linx 12X64 lets you work and play.

Chapter 8
Hardware Management

Contents:

I/O Ports and I/O Memory
Using I/O Ports
Using Digital I/O Ports
Using I/O Memory
Backward Compatibility
Quick Reference

App

[31]Not all computer platform use aread and a write signal;some have different means to address external circuits. The differenceis irrelevant at software level, however, and we'll assume all haveread and write to simplifythe discussion.

I/O Registers and Conventional Memory

#include <linux/kernel.h>
void barrier(void)
#include <asm/system.h>
void rmb(void);
void wmb(void);
void mb(void);

Using I/O Ports

[32]Sometimes I/O ports are arranged likememory, and you can (for example) bind two 8-bit writes into a single16-bit operation. This applies, for instance, to PC video boards, butin general you can't count on this feature.

NOTE:From now on, when we use unsigned without furthertype specifications, we are referring to an architecture-dependentdefinition whose exact nature is not relevant. The functions arealmost always portable because the compiler automatically casts thevalues during assignment -- their being unsigned helps preventcompile-time warnings. No information is lost with such casts as longas the programmer assigns sensible values to avoid overflow. We'llstick to this convention of 'incomplete typing' for the rest of thechapter.
unsigned inb(unsigned port);
void outb(unsigned char byte, unsigned port);
unsigned inw(unsigned port);
void outw(unsigned short word, unsigned port);
unsigned inl(unsigned port);
void outl(unsigned longword, unsigned port);
  • [33]Technically, it must have theCAP_SYS_RAWIO capability, but that is the same asrunning as root on current systems.

String Operations

void insb(unsigned port, void *addr, unsigned long count);
void outsb(unsigned port, void *addr, unsigned long count);
void insw(unsigned port, void *addr, unsigned long count);
void outsw(unsigned port, void *addr, unsigned long count);
void insl(unsigned port, void *addr, unsigned long count);
void outsl(unsigned port, void *addr, unsigned long count);

Pausing I/O

Platform Dependencies

IA-32 (x86)
IA-64 (Itanium)
Alpha
ARM
M68k
MIPS
MIPS64
PowerPC
S390
Super-H
SPARC
SPARC64

[34]Single-byte I/O is not as important as one mayimagine, because it is a rare operation. In order to read/write asingle byte to any address space, you need to implement a data pathconnecting the low bits of the register-set data bus to any byteposition in the external data bus. These data paths require additionallogic gates that get in the way of every data transfer. Droppingbyte-wide loads and stores can benefit overall systemperformance.

Linx Port Devices Driver

Linux Port Devices Driver Updater

Using Digital I/O Ports

An Overview of the Parallel Port

WARNING:The parallel connector is not isolated from the computer's internalcircuitry, which is useful if you want to connect logic gates directlyto the port. But you have to be careful to do the wiring correctly;the parallel port circuitry is easily damaged when you play with yourown custom circuitry unless you add optoisolators to your circuit. Youcan choose to use plug-in parallel ports if you fear you'll damageyour motherboard.

Figure 8-1. The pinout of the parallel port

A Sample Driver

Using I/O Memory

Directly Mapped Memory

unsigned readb(address);
unsigned readw(address);
unsigned readl(address);
void writeb(unsigned value, address);
void writew(unsigned value, address);
void writel(unsigned value, address);
memset_io(address, value, count);
memcpy_fromio(dest, source, num);
memcpy_toio(dest, source, num);

Reusing short for I/O Memory

Software-Mapped I/O Memory

ISA Memory Below 1 MB

[35]Actually, this is not completely true. Thememory range is so small and so frequently used that the kernel buildspage tables at boot time to access those addresses. However, thevirtual address used to access them is not the same as the physicaladdress, and thus ioremap is neededanyway. Moreover, version 2.0 of the kernel had that range directlymapped. See 'Backward Compatibility' for 2.0issues.

isa_readb and Friends

Probing for ISA Memory

Backward Compatibility

Linux Port Devices Driver Device

Quick Reference

Linx Port Devices Drivers

This chapter introduced the following symbols related to hardwaremanagement.

#include <linux/kernel.h>
void barrier(void)
#include <asm/system.h>
void rmb(void);
void wmb(void);
void mb(void);
#include <asm/io.h>
unsigned inb(unsigned port);
void outb(unsigned char byte, unsigned port);
unsigned inw(unsigned port);
void outw(unsigned short word, unsigned port);
unsigned inl(unsigned port);
void outl(unsigned doubleword, unsigned port);
unsigned inb_p(unsigned port);
..
void insb(unsigned port, void *addr, unsigned long count);
void outsb(unsigned port, void *addr, unsigned long count);
void insw(unsigned port, void *addr, unsigned long count);
void outsw(unsigned port, void *addr, unsigned long count);
void insl(unsigned port, void *addr, unsigned long count);
void outsl(unsigned port, void *addr, unsigned long count);
#include <linux/ioport.h>
int check_region(unsigned long start, unsigned long len);
void request_region(unsigned long start, unsigned long len, char *name);
void release_region(unsigned long start, unsigned long len);
int check_mem_region(unsigned long start, unsigned long len);
void request_mem_region(unsigned long start, unsigned long len, char *name);
void release_mem_region(unsigned long start, unsigned long len);
#include <asm/io.h>
void *ioremap(unsigned long phys_addr, unsigned long size);
void *ioremap_nocache(unsigned long phys_addr, unsigned long size);
void iounmap(void *virt_addr);
#include <linux/io.h>
unsigned readb(address);
unsigned readw(address);
unsigned readl(address);
void writeb(unsigned value, address);
void writew(unsigned value, address);
void writel(unsigned value, address);
memset_io(address, value, count);
memcpy_fromio(dest, source, nbytes);
memcpy_toio(dest, source, nbytes);