Programming The GPIO in Spear Board
Programming The GPIO in Spear Board
User Manual
Introduction
This document provides information about the Linux kernel and the device drivers provided
by the SPEAr Plus Linux SDK. The Linux kernel is the core component of an overall Linux-
based software solution.
This SDK version supports Linux kernel 2.6.19.2. A predefined Linux kernel is provided as
pre-stored on NOR Flash memory for SPEAr Plus development boards. Such kernel may be
immediately used for both initial assessment and application development.
Contents
1 Reference documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1 Acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3 Kernel overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.1 Device runtime architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2 Rebuilding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3 Handling modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.4 Flashing and booting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4 User-space APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.1 A/D converter (ADC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.2 Ethernet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.3 General-purpose input/output (GPIO) . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.4 Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.5 I2C bus and EEPROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.6 Inter-processor communication (IPC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.7 JPEG codec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.8 Real-time clock (RTC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.9 Slave CPU control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.10 Synchronous serial ports (SSPs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.11 Asynchronous serial ports (UARTs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.12 USB device (gadget filesystem) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.13 USB hosts (mass storage and USB filesystem) . . . . . . . . . . . . . . . . . . . . 27
4.14 Watchdog timer (WDT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5 Kernel-space APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.1 A/D converter (ADC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.2 Direct memory access (DMA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.3 General-purpose input/output (GPIO) . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.4 I2C bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2/62
UM0479 Contents
6 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
3/62
List of tables UM0479
List of tables
Table 1. Acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Table 2. Network interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Table 3. Open sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Table 4. ARP mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Table 5. IP routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Table 6. GPIO assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Table 7. USB filesystem ioctl requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Table 8. Gadget driver structure fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Table 9. Gadget structure fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Table 10. Endpoint structure fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Table 11. USB driver structure fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Table 12. USB interface structure fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Table 13. SDK 1.1 driver summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Table 14. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
4/62
UM0479 List of figures
List of figures
5/62
Reference documentation UM0479
1 Reference documentation
6/62
UM0479 Introduction
2 Introduction
This document provides information about the Linux kernel and the device drivers provided
by the SPEAr Plus Linux SDK (referred as just “SDK” in the following). The Linux kernel is
the core component of an overall Linux-based software solution.
A detailed description of Linux kernel is out of the scope of this document. For a good
reference book on this subject see [10]. Anyway, the main functionality provided by the
kernel can be summarized as follows:
● Task scheduling
● Memory management
● Inter-process communication and synchronization
● Virtual filesystem
● Interrupt / exception handling
● I/O devices integration framework
● Built-in filesystems
● Built-in protocol stacks (e.g. IP, Bluetooth, USB)
● Dynamic extension through modules
This SDK version supports Linux kernel 2.6.19.2. A predefined Linux kernel is provided as
pre-stored on NOR Flash memory for SPEAr Plus development boards. Such kernel may be
immediately used for both initial assessment and application development.
Changing the kernel is mostly performed at platform software development stage, in
particular when writing and testing specific additional device drivers or assessing different
configurations. At this stage, since updates are very frequent, the U-Boot resident monitor
may be configured to automatically download the specified kernel through Ethernet from a
host PC at each target reset.
When kernel configuration and contents become more stable along a project, the kernel
may be kept as resident in flash memory and only user-space software (in the so-called root
filesystem [3], a component that is separated from the kernel) is dynamically modified on-
demand. Persistent storage of kernel on flash is also required in order to make a stand-
alone self-booting system (and, of course, in the final product). Finally, rewriting the kernel
on flash is required if the flash area allocated to the kernel has been erased or damaged for
any reason.
An additional mechanism is made available by the Linux architecture. Besides static linking
with the kernel binary image, kernel extensions may be also compiled as “modules” (also
known as LKM, Loadable Kernel Modules). Such modules are stored outside the kernel
image, namely inside the root filesystem. Modules are then dynamically loaded (and
potentially unloaded) on demand by user-space software. However, modules maintain the
same properties of code that is statically linked with the kernel. More specifically, modules
operate in kernel (physical) address space and may directly access to any exposed kernel
function or data structure.
In order to minimize flash memory occupation, as well as to make downloads faster, it is
recommended to operate with a compressed kernel binary image. Usually about 50% size
reduction may be obtained using the GZ algorithm. Compression is a post-processing step
applied when rebuilding the kernel and is also part of the build procedure predefined by the
SDK. Decompression is performed on the fly by U-Boot when loading the kernel to system
RAM for execution.
7/62
Introduction UM0479
In next sections, the procedures to rebuild and use the kernel and LKM modules are first
discussed. The device APIs of the default kernel are then described.
Interactive commands are shown in courier bold font. The “#” prompt is assumed for the
Linux shell on the target board. The “$” prompt is assumed for the Linux shell on the PC
host. The “spearplus>” prompt is assumed for interaction with the resident
bootloader/monitor (U-Boot).
Finally, in this entire document, it is assumed that the SDK 1.1 package has been installed
on a Linux PC host under the recommended path:
/opt/splus_linux_sdk_1_1/
2.1 Acronyms
Table 1. Acronyms
Acronym Explanation
8/62
UM0479 Introduction
9/62
Kernel overview UM0479
3 Kernel overview
User
Space
Sockets /dev/ttyS0
/proc/net /dev/gpio /dev/i2c /dev/rtc /dev/ttyS1 /proc/bus/usb Filesystem
Gadget
Zero USBFS VFAT
kernel
console
IP Device Host
Stack Stack Stack
DMA Ethernet GPIOs I2C RTC UARTs USBD USBD USBD SoC
Controller Controller Controller (2) Ctrl+PHY Ctrl+ Ctrl+ Hardware
PHY PHY
Dev.
Ethernet LEDs EEPROM Battery RJ11 J16 USBD USBH USBH Board
PHY SW3 Switch Conn. Conn. Conn. Conn.
J19 Conn.
RJ45
10/62
UM0479 Kernel overview
3.2 Rebuilding
The Linux kernel, provided in source code inside the SDK, needs to be rebuilt in the
following typical cases:
● the source code of a new device driver is added or an existing driver source has been
modified
● the value of some kernel configuration options must be changed (e.g. to enable the use
of an additional protocol stack or filesystem)
The kernel contents are modified by directly adding files and/or editing existing files in the
kernel source tree. When new files are added, some Makefile and Kconfig files have
usually to be adapted as well.
It is important to remark that custom extensions or modifications that are statically linked to
the kernel are constrained by the GPL licensing policy. In other terms, any statically linked
extension is considered as a kernel derivative work and must be licensed as a GPL
component. On the other hand, for kernel extensions implemented as dynamically loaded
modules, no GPL policy automatically applies.
The SDK provides two default kernel configuration files, located under path:
/opt/splus_linux_sdk_1_1/src/linux-2.6.19.2/arch/arm/configs
The spearplus_defconfig file contains the standard configuration to be used. For
debugging purposes, an alternative configuration is also available, named
spearplus_dbg_defconfig. The latter file provides the same functionality as the former
one, but the kernel will be compiled with debugging options.
The kernel (as well as any module specified in the selected configuration file) may be rebuilt
with the configuration defined in spearplus_defconfig using the following commands:
$ cd /opt/splus_linux_sdk_1_1
$ build.sh linux
The output of this operation is a compressed kernel binary image located under:
/opt/splus_linux_sdk_1_1/flash/linux.uimg
This file is already in the proper format to be used by U-Boot for flashing or loading on-
demand through TFTP. The following commands also rebuild everything including the kernel
from standard configuration file:
$ cd /opt/splus_linux_sdk_1_1
$ build.sh all
In order to build a debugging kernel version, the following commands need to be used:
$ cd /opt/splus_linux_sdk_1_1
$ build.sh linux_dbg
The output of this operation is a compressed kernel binary image located under:
/opt/splus_linux_sdk_1_1/flash/linux_dbg.uimg
11/62
Kernel overview UM0479
12/62
UM0479 Kernel overview
An Ethernet host-target link is the fastest way to support flash updating. A predefined U-
Boot script called flash_linux_eth has been made available as predefined on the
development boards to minimize manual steps. In order to update the kernel partition with a
new Linux binary image using Ethernet, the following procedure has to be performed:
1. Connect the target board to a PC using both a null-modem serial cable (the UART0
DB9 connector must be used) and an Ethernet cross cable or an Ethernet hub/switch.
2. Assure that the TFTP server is running on the PC host and copy the linux.uimg file
(or linux_dbg.uimg for the debugging version) to the default TFTP server directory.
3. Launch a terminal emulator (HyperTerminal, minicom, etc.) on the PC. The PC serial
port must be set to 115200 bps, 8-N-1 mode, no flow control.
4. Switch on or just reset the target board and enter the U-Boot monitor interactive mode.
5. From U-Boot prompt, execute the following command:
spearplus> run flash_linux_eth
This will first start the transfer of the file from PC to the board over Ethernet. After the
transfer, the command will automatically proceed by completing all required steps for
flashing and verification.
An alternative to Ethernet for flash updating is the use of a serial link and the Kermit
protocol. This approach is slower but still helpful when an Ethernet link is not available. A
predefined U-Boot script called flash_linux_uart has been made available as
predefined on the development boards to minimize manual steps. In order to update the
kernel partition with a new Linux binary image using the serial link, the following procedure
has to be performed:
1. Connect the target board to a PC using a null-modem serial cable (the UART0 DB9
connector must be used).
2. Launch a terminal emulator with Kermit support (HyperTerminal, minicom, etc.) on the
PC. The PC serial port must be set to 115200 bps, 8-N-1 mode, no flow control.
3. Switch on or just reset the target board and enter the U-Boot monitor interactive mode.
4. From U-Boot prompt, execute the following command:
spearplus> run flash_linux_uart
U-Boot is now waiting for a Kermit file transfer from the PC terminal. The linux.uimg
file must be selected from a PC directory (or linux_dbg.uimg for the debugging
version). After the transfer is started on the PC, the command will go on by transferring
(using Kermit) the file over serial cable and completing all required steps for flashing
and verification.
System bootstrap with the flashed Linux kernel is normally performed with the following U-
Boot environment setting:
bootcmd=bootm 0xf8050000
When the Linux kernel is often changed, it may be useful to boot it directly from a host PC
instead of updating the NOR Flash everytime. This approach may be followed by just
changing the U-Boot environment variable as follows:
spearplus> setenv bootcmd tftpboot 0xF8050000 linux${dbg}.uimg
In this way, the kernel will be downloaded from a TFTP server at each board reset and then
executed.
13/62
Kernel overview UM0479
In order to use the alternative debugging version of the kernel, the dbg variable must be set
to “_dbg” as follows:
spearplus> setenv dbg _dbg
Consult appendix A of document [1] to fully restore default U-Boot settings in case of any
damage to them.
14/62
UM0479 User-space APIs
4 User-space APIs
The APIs to access SPEAr Plus devices from user-space software are described in the
following sections. Access is always performed internally through system calls, since there
is no static or dynamic linking of the relevant device drivers with application software.
It should be noted that user-space APIs are exposed only for devices that actually require
this access level. For instance, there is no need to expose a user-space API for DMA.
Standard Linux APIs are exploited wherever applicable (e.g. Ethernet, RTC, UARTs, USB
mass storage). In all other cases an ST-specific API has been defined for each kind of
device, while still based on standard I/O function calls.
4.2 Ethernet
The Ethernet port is usually accessed by user-space applications indirectly, by means of the
standard Linux Sockets API, available in the C runtime library [8], on top of the IP protocol
stack integrated in the kernel.
In addition, information about the Ethernet device is accessible to user-space through the
/proc/net pseudo file tree. These logical files may be directly accessed by user-space
commands and applications using standard library functions like for real files.
The /proc/net/dev file contains information about the configured network interfaces.
There is one text line for each logical network interface known to the kernel. For a SPEAr
board connected to a PC or to a LAN, there will be two interfaces named: eth0 and lo
(loopback). In each line you are given the interface name followed by two sets of nearly
identical statistics, receive and transmit, for that interface. The meanings of each of the
columns are:
15/62
User-space APIs UM0479
bytes The total number of bytes of data transmitted or received by the interface.
packets The total number of packets of data transmitted or received by the interface.
errs The total number of transmit or receive errors detected by the device driver.
drop The total number of packets dropped by the device driver.
fifo The number of FIFO buffer errors.
frame The number of packet framing errors.
colls The number of collisions detected on the interface.
compressed The number of compressed packets transmitted or received by the device driver.
carrier The number of carrier losses detected by the device driver.
multicast The number of multicast frames transmitted or received by the device driver.
The /proc/net/arp file contain the ARP table. ARP is the low-level protocol used by Ethernet
networks to enable a mapping from IP addresses (layer 3) to MAC addresses (layer 2). The
columns have the following meaning:
16/62
UM0479 User-space APIs
The /proc/net/route file contain the IP routing table. The columns have the following
meaning:
Table 5. IP routing
Column Description
The network interface that datagrams matching this route will leave. For a SPEAr
Iface
Plus board, this may be eth0 or lo.
In combination with the Mask field, specifies which datagrams will match this
Destination
route.
The IP address of the host that will act as a router for datagrams matching this
Gateway
route.
An indicator of various route attributes.
Flags See definitions under Linux sources, in the header file:
linux-2.6.19.2/include/linux/route.h
RefCnt Unused.
Use Unused.
The metric value associated with the route. This is used to indicate the cost or
Metric
priority of a route.
In combination with the Destination field, this specifies which datagrams will match
Mask
this route.
Specifies the largest TCP segment (in bytes) that will be built for transmission via
MTU
this route.
Specifies the TCP window (in bytes) that will be advertised for TCP connections
Window
made via this route.
Specifies the Initial Round Trip time (in milliseconds) that will be used for TCP
IRTT
connections established via this route.
The /proc/net/snmp file exports protocol statistics. It may be used for performance
analysis purposes or by a SNMP (Simple Network Management Protocol) daemon program
17/62
User-space APIs UM0479
(not provided with SDK). It reports summary statistics for each of the IP, ICMP, TCP, and
UDP protocols.
Very detailed access to networking information may be finally achieved using the
/proc/sys/net subtree.
GPIO pins are accessed by user-space applications by means of a character device named:
/dev/gpio
A single GPIO device driver supporting all blocks is implemented.
As a general consideration, accessing GPIOs from user-space has some intrinsic
limitations. Interrupts may not be configured or intercepted and operations on GPIOs are
slower than from kernel-space due to system call overhead. Therefore, the GPIO user-
space API is usually exploited only for non speed-critical tasks (such as turning on/off a LED
or reading a dip switch configuration).
User-space applications must include the drivers/char/spr_gpio_pl061.h header
file.
In addition to the standard and generic open() and close() routines, the GPIO user-
space API provides the interfaces described in the following.
Each block is identified by a specific enumeration constant:
typedef enum { GPIO0, GPIO1, GPIO2, GPIO_NONE } t_GPIOId;
18/62
UM0479 User-space APIs
The eight pins inside a block are identified through bit masks:
#define GPIO_PIN00x00000001
#define GPIO_PIN10x00000002
#define GPIO_PIN20x00000004
#define GPIO_PIN30x00000008
#define GPIO_PIN40x00000010
#define GPIO_PIN50x00000020
#define GPIO_PIN60x00000040
#define GPIO_PIN70x00000080
#define GPIO_ALLPINS0x000000FF
As anticipated, only GPIO0 and GPIO1 blocks are actually exposed by the SoC and the
development board. In addition, only GPIO_PIN0 and GPIO_PIN1 are available for the
GPIO1 block.
Binary values for pins are defined as follows:
typedef enum { RESET, SET } t_GPIOValue;
The direction (input or output) of a pin is defined as follows:
typedef enum { IN, OUT } t_GPIODir;
Given the definitions above, the interaction with GPIOs is performed through the following
data structure type:
typedef struct {
union {
t_GPIOValue PinVal; // SET, RESET
t_GPIODir PinDir; // IN, OUT
} PinInfo;
t_GPIOId GPIOId; // GPIO0, GPIO1, GPIO2
uint PinMask; // see bitmasks above
} t_GPIOPinInfo;
Error handling for all API calls is performed through predefined values returned by the
functions and defined as follows:
typedef enum {
GPIO_OK = 0,
GPIO_INVALID_ID,
GPIO_INVALID_PIN_DIRECTION,
GPIO_INVALID_PIN_ID,
GPIO_INVALID_PIN_VALUE,
GPIO_INVALID_INTERRUPT_TYPE, // not used in user-space
GPIO_NOT_AN_OUTPUT_PIN,
GPIO_NOT_AN_INPUT_PIN,
GPIO_INVALID_PARAMETER,
GPIO_PIN_NOT_AN_INTERRUPT_LINE, // not used in user-space
GPIO_PIN_NO_INT_HANDLER_REGISTERED, // not used in user-space
GPIO_INVALID_INTERRUPT_HANDLER, // not used in user-space
GPIO_PIN_NOT_IN_SOFTWARE_MODE, // not used in user-space
GPIO_UNKNOWN_ERROR
} t_GPIOError;
In order to configure pins, the ioctl() system call is used.
19/62
User-space APIs UM0479
In order to configure the direction of one or more pin for a specified block, the ioctl() call
is invoked with a GPIOIOC_DIRSET request parameter and a pointer to a
t_GPIOPinInfo structure initialized with block, pin mask of pins to be changed and
chosen direction.
Example:
int dev;
t_GPIOPinInfo info;
t_GPIOError result;
dev = open("/dev/gpio ",O_RDWR);
info.GPIOId = GPIO0; // specify block
info.PinMask = GPIO_PIN0 + GPIO_PIN1; // select 2 pins in the mask
info.PinInfo.PinDir = IN; // set to input
result = ioctl(dev,GPIOIOC_DIRSET,&info);
if (result != GPIO_OK) { printf("Error\n"); }
close(dev);
In order to query the current direction of one or more pin for a specified block, the ioctl()
call is used with a GPIOIOC_DIRGET request parameter and a pointer to a
t_GPIOPinInfo structure initialized with block identifier and pin mask of pins to be
queried.
Example:
int dev;
t_GPIOPinInfo info;
t_GPIOError result;
dev = open("/dev/gpio",O_RDWR);
info.GPIOId = GPIO0; // specify block
info.PinMask = GPIO_PIN0 + GPIO_PIN1; // select 2 pins in the mask
result = ioctl(dev,GPIOIOC_DIRGET,&info);
if (result != GPIO_OK)
{
printf("Error");
}
else
{
if ((info.PinInfo.PinDir & GPIO_PIN0)==IN)
{ printf("Block 0, Pin 0 direction is input\n"); }
else
{ printf("Block 0, Pin 0 direction is output\n"); }
if ((info.PinInfo.PinDir & GPIO_PIN1)==IN)
{ printf("Block 0, Pin 1 direction is input\n"); }
else
{ printf("Block 0, Pin 1 direction is output\n"); }
}
close(dev);
It is also possible to restore all pins of a specified block to default settings using the
ioctl() call with a GPIOIOC_CONFIGDEFAULT request.
Example:
int dev;
t_GPIOPinInfo info;
20/62
UM0479 User-space APIs
t_GPIOError result;
dev = open("/dev/gpio",O_RDWR);
info.GPIOId = GPIO0; // specify block
result = ioctl(dev,GPIOIOC_CONFIGDEFAULT,&info);
if (result != GPIO_OK) { printf("Error"); }
close(dev);
With default settings, all pins have input direction and interrupts are edge-triggered and
disabled.
In order to change the value of one or more GPIO pins for a specified block, the write()
system call is used. The passed structure specifies the operation (RESET or SET).
Example:
int dev;
t_GPIOPinInfo info;
t_GPIOError result;
dev = open("/dev/gpio",O_RDWR);
info.GPIOId = GPIO0; // specify block
info.PinMask = GPIO_PIN0 + GPIO_PIN1; // select 2 pins in the mask
info.PinInfo.PinVal = RESET; // set pins to zero
result = write(dev,&info,sizeof(info));
if (result != GPIO_OK) { printf("Error"); }
close(dev);
In order to read the value of one or more GPIO pins for a specified block, the read() system
call is used. On call return, the values for the specified pins are stored as bit pattern in the
PinVal field.
Example:
int dev;
t_GPIOPinInfo info;
t_GPIOError result;
dev = open("/dev/gpio",O_RDWR);
info.GPIOId = GPIO0; // specify block
info.PinMask = GPIO_PIN0 + GPIO_PIN1; // select 2 pins in the mask
result = read(dev,&info,sizeof(info));
if (result != GPIO_OK)
{
printf("Error");
}
else
{
info.PinInfo.PinVal = RESET; // set pins to zero
if ((info.PinInfo.PinVal & GPIO_PIN0)==RESET)
{ printf("Block 0, Pin 0 value is zero\n"); }
else
{ printf("Block 0, Pin 0 value is one\n"); }
if ((info.PinInfo.PinVal & GPIO_PIN1)== RESET)
{ printf("Block 0, Pin 1 value is zero\n"); }
else
{ printf("Block 0, Pin 1 value is one\n"); }
}
close(dev);
21/62
User-space APIs UM0479
4.4 Display
A device driver for the SPEAr Plus graphics display controller (CLCDC) and the relevant
user-space API shall be provided in future SDK releases. Such API shall be compatible with
the Linux frame buffer standard.
22/62
UM0479 User-space APIs
23/62
User-space APIs UM0479
24/62
UM0479 User-space APIs
result = ioctl(dev,RTC_SET_TIME,&info);
if (result) { printf("Error"); }
close(dev);
The current RTC date and time may be read with RTC_RD_TIME ioctl()
request as in the following example:
Example:
int dev;
struct rtc_time info;
dev = open("/dev/rtc",O_RDWR);
result = ioctl(dev,RTC_RD_TIME,&info);
if (result)
{
printf("Error");
}
else
{
printf("%02d/%02d/%04d %02d:%02d:%02d\n",
info.tm_mday+1,info.tm_mon+1,1900+info.tm_year,
info.tm_hour,info.tm_min,info.tm_sec);
close(dev);
The read() and write() functions are not used.
25/62
User-space APIs UM0479
26/62
UM0479 User-space APIs
27/62
User-space APIs UM0479
Finally, custom class drivers could be developed in user-space. In this case, the class driver
will directly interface with the USB host protocol stack through a user-space API based on
the so-called USB filesystem (usbfs). A possible application of this scenario is to implement,
in user-space, the USB Still Imaging Class and the corresponding PTP (Picture Transfer
Protocol) protocol.
Similar to the /proc/net pseudo file tree supported for Ethernet, there is a
/proc/bus/usb logical subtree for USB. On SPEAr Plus boards, the
/proc/bus/usb/devices logical file reports information about four USB host controllers:
Bus 01USB Host Port 1 (EHCI, USB 2.0)
Bus 02USB Host Port 2 (EHCI, USB 2.0)
Bus 03USB Host Port 1 (OHCI, USB 1.1)
Bus 04USB Host Port 2 (OHCI, USB 1.1)
In order to mount usbfs, the following command would need to be issued:
# mount -t usbfs none /proc/bus/usb
However, for user convenience, this command is already included in the initialization script
/etc/rc as described in [3].
The generic user-space API for USB host controllers is defined in the
include/linux/usbdevice_fs.h header file and is based on ioctl() calls. A specific
plugged USB device must be opened with open() before using such calls and closed with
close() after usage. The read() and write() system calls are not used.
28/62
UM0479 User-space APIs
29/62
User-space APIs UM0479
30/62
UM0479 Kernel-space APIs
5 Kernel-space APIs
The APIs to access SPEAr Plus devices from kernel-space software are described in the
following sections. Direct function calls are made in this case, since static or dynamic linking
of the relevant device drivers with client software is assumed.
A standard Linux API is exploited wherever applicable (USB host and device frameworks).
In all other cases an ST-specific API has been defined.
It should be noted that kernel-space APIs are exposed only for devices that actually require
this access level. For instance, there is no need to expose a kernel-space API for graphics
display, JPEG codec, real-time clock and slave CPU control.
Moreover, the Ethernet driver is designed to be integrated in the Linux networking
framework. Therefore, it only exposes interfaces to that framework and not to other kernel-
space subsystems (most driver functions are static, hence private). Likewise, the UART
driver is designed to be integrated in the Linux serial port framework. Therefore, it only
exposes interfaces to that framework and not to other kernel-space subsystems. For this
reason, no specific kernel APIs for Ethernet and UARTs are documented in this section.
31/62
Kernel-space APIs UM0479
LAST_DMA_DEVICE
} t_DMADeviceId;
It should be pointed out that some on-chip peripherals such as Ethernet and USB use their
own dedicated DMA support. In addition, the MEMORY_DMA_DEVICE value may be used for
generic transfer including peripherals since they are memory-mapped.
Error handling is managed by API functions through return values according to the following
definition:
typedef enum {
DMA_OK, // successful call
DMA_INVALID_BURST_SIZE,
DMA_INVALID_ACCESS_WIDTH,
DMA_INVALID_PROTECTION,
DMA_INVALID_CHANNEL_ID,
DMA_INVALID_INT_HANDLER,
DMA_INCORRECT_FLOW_CONTROLLER,
DMA_INVALID_DEVICE_ID,
DMA_INVALID_PRIORITY,
DMA_INVALID_PARAMETER,
DMA_INCOMPATIBLE_DMA_DEVICE,
DMA_NO_MORE_LLIS_AVAILABLE,
DMA_NO_MORE_HW_CHANNELS_AVAILABLE,
DMA_NO_INT_ACTIVE,
DMA_TRANSFER_OVER,
DMA_TRANSFER_ONGOING,
DMA_INCOMPATIBLE_TRANSFER_SIZE,
DMA_INCOMPATIBLE_BUFFER_SIZE,
DMA_DEVICE_CANT_BE_FLOWCTRL,
DMA_INVALID_FLOW_CONTROLLER,
DMA_CONTROLLER_NOT_INITIALIZED,
DMA_NULL_POINTER,
DMA_MISALLIGNED_ADDRESS,
DMA_ERROR
} t_DMAError;
The DMA Kernel API functions are listed in the following. Basically, the DMA controller must
be first initialized. Specific source or destination devices may be also configured. Then data
transfers may be started with optional user-defined callback routines to be invoked when the
each transfer is terminated. If required, DMA transfers may be also suspended, resumed or
aborted before normal completion.
It is important to remind that DMA operates with physical rather than virtual addresses.
32/62
UM0479 Kernel-space APIs
AccessWidth (in):
Access width of device according to following definition:
typedef enum {
BYTE_WIDTH = 1,
HALFWORD_WIDTH = 2,
WORD_WIDTH = 4
} t_DMAAccessWidth;
MaxBurstSize (in):
Maximum burst size of device according to following definition:
typedef enum {
BURST_SIZE_1,
BURST_SIZE_4,
BURST_SIZE_8,
BURST_SIZE_16,
BURST_SIZE_32,
BURST_SIZE_64,
BURST_SIZE_128,
BURST_SIZE_256
} t_DMABurstSize;
Protection (in):
Protection information of device according to following definition:
typedef enum {
PROT_RESET,
USER_BUFFERABLE_CACHEABLE,
USER_NOT_BUFFERABLE_CACHEABLE,
USER_BUFFERABLE_NOT_CACHEABLE,
USER_NOT_BUFFERABLE_NOT_CACHEABLE,
PRIV_BUFFERABLE_CACHEABLE,
PRIV_NOT_BUFFERABLE_CACHEABLE,
PRIV_BUFFERABLE_NOT_CACHEABLE,
PRIV_NOT_BUFFERABLE_NOT_CACHEABLE
} t_DMAProtection;
33/62
Kernel-space APIs UM0479
AccessWidth (out):
Access width of device (see SPEAr_DMA_SetConfigDevice for values).
MaxBurstSize (out):
Maximum burst size of device (see SPEAr_DMA_SetConfigDevice for values).
Protection (out):
Protection information of device (see SPEAr_DMA_SetConfigDevice for values).
Description: Transfers data from source to destination. The selected DMA channel for the transfer
is returned.
Arguments: TransferDesc (in):
Defines the details of the requested transfer using the following data structure:
typedef struct {
t_DMADeviceId SrcDeviceId; // source
t_DMADeviceId DestDeviceId; // destination
uint SrcAddress; // source address
uint DestAddress; // destination address
uint TransferSize; // size in bytes of transfer
t_DMAFlowCtrl FlowController; // flow type
t_DMATransferPriority Priority;// priority of DMA transfer
t_bool IsIntReqAfterEachPacketTransfer; // interrupt required
// after each LLI transfer ?
t_DMAIntHandler HandlerPtr; // interrupt handler for
// end of transfer
} t_DMATransferDesc;
typedef enum {
DMA_MEMORY_TO_MEMORY,
DMA_MEMORY_TO_PERIPHERAL,
DMA_PERIPHERAL_TO_MEMORY,
DMA_PERIPHERAL_TO_PERIPHERAL,
DEST_PERIPHERAL_TO_PERIPHERAL,
DEST_MEMORY_TO_PERIPHERAL,
SRC_PERIPHERAL_TO_MEMORY,
34/62
UM0479 Kernel-space APIs
SRC_PERIPHERAL_TO_PERIPHERAL
} t_DMAFlowCtrl;
typedef enum {
LOW_PRIORITY,
NORMAL_PRIORITY,
HIGH_PRIORITY,
UNDEFINED_PRIORITY
} t_DMATransferPriority;
ChannelID (out):
Returns the selected DMA channel for further reference .
35/62
Kernel-space APIs UM0479
DataCanBeLost (in):
If true, the channel is directly disabled and any data in the DMA FIFO is lost.
Dir (in):
Direction.
Mask (in):
Bitmask defining the pins for which the direction must be changed.
Dir (out):
Direction.
Mask (in):
Bitmask defining the pins for which the direction is obtained.
36/62
UM0479 Kernel-space APIs
Description: Sets the value or one or more pins for the specified block.
Arguments: GPIOId (in):
Block index.
Val (in):
Value.
Mask (in):
Bitmask defining the pins for which the value must be changed.
Val (out):
Value.
Mask (in):
Bitmask defining the pins for which the value must be obtained.
IntEdge (in):
Single or both edge according to following definition:
IntSingleEdge (in):
Single edge type according to following definition:
typedef enum {
FALLING_EDGE,
RISING_EDGE,
37/62
Kernel-space APIs UM0479
NONE
} t_GPIOIntSingleEdgeConfig;
Mask (in):
Bitmask defining the pins for to be configured.
IntLevel (in):
Level according to following definition:
Mask (in):
Bitmask defining the pins for to be configured.
Mask (in):
Bitmask defining the pins for which interrupts must be enabled.
Mask (in):
Bitmask defining the pins for which interrupts must be disabled.
38/62
UM0479 Kernel-space APIs
Mask (in):
Bitmask defining the pins for which interrupts must be disabled.
Handler (in):
Pointer to user-defined callback function to be invoked on interrupt occurrence. Such
handler must be defined according to following signature:
39/62
Kernel-space APIs UM0479
40/62
UM0479 Kernel-space APIs
All callbacks receive a standard argument defined as a pointer to the following structure:
struct usb_gadget {
const struct usb_gadget_ops *ops;
struct usb_ep *ep0;
struct list_head ep_list;
enum usb_device_speed speed;
unsigned is_dualspeed:1;
unsigned is_otg:1;
unsigned is_a_peripheral:1;
unsigned b_hnp_enable:1;
unsigned a_hnp_support:1;
unsigned a_alt_hnp_support:1;
const char *name;
struct device dev;
};
where the fields have the following meanings:
41/62
Kernel-space APIs UM0479
The kernel API functions available for gadget driver management are as follows:
42/62
UM0479 Kernel-space APIs
43/62
Kernel-space APIs UM0479
mA (in):
Current to draw, in milliAmperes.
For use by the gadget driver, all other fields are read-only to gadget
driver_data
drivers.
name Identifier for the endpoint, such as ep-a or ep9in-bulk”
ops Function pointers used to access hardware-specific operations.
The gadget's ep_list holds all of its endpoints. all the general purpose
ep_list endpoints in gadget->ep_list. The control endpoint (gadget->ep0) is not in
that list, and is accessed only in response to a driver setup() callback.
The maximum packet size used on this endpoint. The initial value can
maxpacket sometimes be reduced (hardware allowing), according to the endpoint
descriptor used to configure the endpoint.
A wide set of functions is available to manage endpoints, all of them getting as first
argument a pointer to the specified endpoint structure:
44/62
UM0479 Kernel-space APIs
desc (in):
Pointer to endpoint descriptor.
45/62
Kernel-space APIs UM0479
Arguments: ep (in):
Pointer to endpoint structure.
gfp_flags (in):
GFP flags.
req (in):
Pointer to request structure.
46/62
UM0479 Kernel-space APIs
req (in):
Pointer to request structure.
gfp_flags (in):
GFP flags.
req (in):
Pointer to request structure.
len (in):
Buffer length.
dma (out):
DMA address.
gfp_flags (in):
GFP flags.
47/62
Kernel-space APIs UM0479
buf (in):
Pointer to buffer.
dma (in):
DMA address.
len (in):
Buffer length.
Finally, the following utility functions are available:
buf (out):
Buffer to be filled.
buflen (in):
Buffer length.
desc (in):
Pointer to descriptor header.
48/62
UM0479 Kernel-space APIs
buflen (in):
Buffer length.
src (in):
Pointer to descriptor header.
id (in):
String identifier.
buf (out):
Pointer to buffer for returned string.
desc (in):
Pointer to endpoint descriptor.
49/62
Kernel-space APIs UM0479
Driver name, should be unique among USB host drivers and should
name
normally be the same as the module name.
Pointer to custom callback function invoked to see if the driver is willing to
manage a particular interface on a device. If it is, probe returns zero and
probe uses dev_set_drvdata() to associate driver-specific data with the interface.
It may also use usb_set_interface() to specify the appropriate altsetting. If
unwilling to manage the interface, return a negative errno value.
Pointer to custom callback function invoked when the interface is no longer
disconnect accessible, usually because its device has been (or is being) disconnected
or the driver module is being unloaded.
Pointer to custom callback function used for drivers that want to talk to
userspace through the usbfs filesystem. This lets devices provide ways to
ioctl
expose information to user space regardless of where they do (or don't)
show up otherwise in the filesystem.
50/62
UM0479 Kernel-space APIs
All callbacks receive a standard argument defined as a pointer to the following structure:
struct usb_interface {
struct usb_host_interface *altsetting;
struct usb_host_interface *cur_altsetting;
unsigned num_altsetting;
int minor;
enum usb_interface_condition condition;
unsigned is_active:1;
unsigned needs_remote_wakeup:1;
struct device dev;
struct class_device *class_dev;
int pm_usage_cnt;
};
where the fields have the following meanings:
Array of interface structures, one for each alternate setting that may be
altsetting selected. Each one includes a set of endpoint configurations. They will be
in no particular order.
cur_altsetting The current altsetting.
num_altsetting Number of altsettings defined.
51/62
Kernel-space APIs UM0479
The main kernel API functions available for class driver management are as follows:
52/62
UM0479 Source files for built-in drivers
A reference to source files implementing the SPEAr Plus device drivers provided with SDK
1.1 is reported in the following table. All paths are relative to Linux kernel top directory.
The availability of user-space and/or kernel-space API for each device is also reported.
A standard naming convention is adopted. All source files have a fixed “spr_” prefix,
followed by a general device identifier (dma, eth, gpio, etc.) and a cell-specific identifier
(pl080, syn, pl061, etc.). The “_hal” suffix, where applied, refers to source files
directly accessing hardware registers (Hardware Abstraction Layer).
drivers/char/spr_dma_pl080.h
drivers/char/spr_dma_pl080_config_device.h
DMA X drivers/char/spr_dma_pl080.c
drivers/char/spr_dma_pl080_hal.h
drivers/char/spr_dma_pl080_hal.c
drivers/net/arm/spr_eth_syn.h
Ethernet
X drivers/net/arm/spr_eth_syn.c
drivers/net/arm/spr_eth_syn_hal.c
drivers/char/spr_gpio_pl061.h
drivers/char/spr_gpio_pl061.c
GPIO X X
drivers/char/spr_gpio_pl061_hal.h
drivers/char/spr_gpio_pl061_hal.c
drivers/i2c/busses/spr_i2c_syn.h
drivers/i2c/busses/spr_i2c_syn.c
I2C Bus / EEPROM X X drivers/i2c/busses/spr_i2c_syn_hal.h
drivers/i2c/busses/spr_i2c_syn_hal.c
drivers/i2c/chips/spr_m24cxx.c
drivers/rtc/spr_rtc_st.c
Real-Time Clock (RTC) X drivers/rtc/spr_rtc_st_hal.h
drivers/rtc/spr_rtc_st_hal.c
drivers/serial/spr_uart_pl011.h
drivers/serial/spr_uart_pl011.c
UARTs X
drivers/serial/spr_uart_pl011_hal.hdrivers/serial
/spr_uart_pl011_hal.c
drivers/usb/gadget/spr_udc_syn.h
USB Device Controller X
drivers/usb/gadget/spr_udc_syn.c
drivers/usb/host/spr_hcd.h
USB Host Controllers X drivers/usb/host/spr_ehci_syn.c
drivers/usb/host/spr_ohci_syn.c
53/62
Default kernel configuration UM0479
This section provides the contents of the default kernel configuration file
(spearplus_defconfig). For the sake of better readability, unused sections and
commented lines have been omitted.
CONFIG_ARM=y
CONFIG_MMU=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_VECTORS_BASE=0xffff0000
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
#
# Code maturity level options
#
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
#
# General setup
#
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_SYSCTL=y
CONFIG_EMBEDDED=y
CONFIG_UID16=y
CONFIG_TINY_SHMEM=y
CONFIG_BASE_SMALL=1
CONFIG_SLOB=y
#
# Loadable module support
#
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_KMOD=y
#
# Block layer
#
CONFIG_BLOCK=y
54/62
UM0479 Default kernel configuration
#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
CONFIG_DEFAULT_CFQ=y
CONFIG_DEFAULT_IOSCHED="cfq"
#
# System Type
#
CONFIG_ARCH_SPEARPLUS=y
#
# SPEAR platform options
#
CONFIG_SPEAR_MISC_CONFIG=y
CONFIG_SPEAR_LOCK=y
#
# Processor Type
#
CONFIG_CPU_32=y
CONFIG_CPU_ARM926T=y
CONFIG_CPU_32v5=y
CONFIG_CPU_ABRT_EV5TJ=y
CONFIG_CPU_CACHE_VIVT=y
CONFIG_CPU_COPY_V4WB=y
CONFIG_CPU_TLB_V4WBI=y
CONFIG_CPU_CP15=y
CONFIG_CPU_CP15_MMU=y
#
# Processor Features
#
CONFIG_ARM_THUMB=y
#
# Kernel Features
#
CONFIG_HZ=100
CONFIG_FLATMEM=y
CONFIG_FLAT_NODE_MEM_MAP=y
CONFIG_SPLIT_PTLOCK_CPUS=4096
CONFIG_ALIGNMENT_TRAP=y
#
# Boot options
#
CONFIG_ZBOOT_ROM_TEXT=0x0
55/62
Default kernel configuration UM0479
CONFIG_ZBOOT_ROM_BSS=0x0
#
# Floating point emulation
#
CONFIG_FPE_NWFPE=y
#
# Userspace binary formats
#
CONFIG_BINFMT_ELF=y
#
# Networking
#
CONFIG_NET=y
#
# Networking options
#
CONFIG_PACKET=y
CONFIG_PACKET_MMAP=y
CONFIG_UNIX=y
CONFIG_XFRM=y
CONFIG_INET=y
CONFIG_IP_FIB_HASH=y
CONFIG_IP_PNP=y
CONFIG_INET_XFRM_MODE_TRANSPORT=y
CONFIG_INET_XFRM_MODE_TUNNEL=y
CONFIG_INET_XFRM_MODE_BEET=y
CONFIG_INET_DIAG=y
CONFIG_INET_TCP_DIAG=y
CONFIG_TCP_CONG_CUBIC=y
CONFIG_DEFAULT_TCP_CONG="cubic"
#
# Generic Driver Options
#
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y
#
# Memory Technology Devices (MTD)
#
CONFIG_MTD=y
CONFIG_MTD_CONCAT=y
CONFIG_MTD_PARTITIONS=y
56/62
UM0479 Default kernel configuration
#
# RAM/ROM/Flash chip drivers
#
CONFIG_MTD_MAP_BANK_WIDTH_1=y
CONFIG_MTD_MAP_BANK_WIDTH_2=y
CONFIG_MTD_MAP_BANK_WIDTH_4=y
CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y
#
# Self-contained MTD device drivers
#
CONFIG_SPEAR_MTD_NOR=y
CONFIG_MTD_STATIC_MEMORY_BANKS=y
CONFIG_MTD_STATIC_PARTITIONING=y
#
# SCSI device support
#
CONFIG_SCSI=y
CONFIG_SCSI_NETLINK=y
CONFIG_SCSI_PROC_FS=y
#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y
CONFIG_CHR_DEV_ST=y
CONFIG_CHR_DEV_OSST=y
CONFIG_BLK_DEV_SR=y
CONFIG_BLK_DEV_SR_VENDOR=y
#
# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
#
CONFIG_SCSI_MULTI_LUN=y
CONFIG_SCSI_CONSTANTS=y
CONFIG_SCSI_LOGGING=y
#
# SCSI Transports
#
CONFIG_SCSI_FC_ATTRS=y
#
# Network device support
#
57/62
Default kernel configuration UM0479
CONFIG_NETDEVICES=y
CONFIG_ETH_SPEAR_SYN=y
#
# Ethernet (10 or 100Mbit)
#
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
#
# Non-8250 serial port support
#
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
CONFIG_SPEAR_UART_pl011=y
CONFIG_SPEAR_UART_CONSOLE_pl011=y
CONFIG_UNIX98_PTYS=y
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
#
# Ftape, the floppy tape device driver
#
CONFIG_SPEAR_GPIO_pl061=y
CONFIG_SPEAR_DMA_pl080=y
#
# I2C support
#
CONFIG_I2C=y
#
# I2C Hardware Bus support
#
CONFIG_SPEAR_I2C_Syn=y
#
# Miscellaneous I2C Chip support
#
CONFIG_SPEAR_M24CXX=y
#
# USB support
#
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB_ARCH_HAS_OHCI=y
CONFIG_USB=y
#
# Miscellaneous USB options
#
CONFIG_USB_DEVICEFS=y
58/62
UM0479 Default kernel configuration
#
# USB Host Controller Drivers
#
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
#
# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
# may also be needed; see USB_STORAGE Help for more information
#
CONFIG_USB_STORAGE=y
#
# USB Gadget Support
#
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_SELECTED=y
CONFIG_USB_GADGET_SPEAR_SYN=y
CONFIG_USB_SPEAR_SYN=y
CONFIG_USB_GADGET_DUALSPEED=y
CONFIG_USB_ZERO=y
#
# Real Time Clock
#
CONFIG_RTC_LIB=y
CONFIG_SPEAR_RTC_ST=y
#
# DOS/FAT/NT Filesystems
#
CONFIG_FAT_FS=y
CONFIG_VFAT_FS=y
CONFIG_FAT_DEFAULT_CODEPAGE=437
CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
CONFIG_PROC_SYSCTL=y
CONFIG_SYSFS=y
CONFIG_TMPFS=y
CONFIG_RAMFS=y
#
# Miscellaneous filesystems
#
CONFIG_CRAMFS=y
59/62
Default kernel configuration UM0479
#
# Network File Systems
#
CONFIG_NFS_FS=y
CONFIG_ROOT_NFS=y
CONFIG_LOCKD=y
CONFIG_NFS_COMMON=y
CONFIG_SUNRPC=y
#
# Partition Types
#
CONFIG_MSDOS_PARTITION=y
#
# Native Language Support
#
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_CODEPAGE_850=y
CONFIG_NLS_ASCII=y
CONFIG_NLS_ISO8859_1=y
CONFIG_NLS_UTF8=y
#
# Kernel hacking
#
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_LOG_BUF_SHIFT=14
CONFIG_FRAME_POINTER=y
#
# Library routines
#
CONFIG_CRC_CCITT=y
CONFIG_CRC32=y
CONFIG_ZLIB_INFLATE=y
60/62
UM0479 Revision history
6 Revision history
61/62
UM0479
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the
right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any
time, without notice.
All ST products are sold pursuant to ST’s terms and conditions of sale.
Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no
liability whatsoever relating to the choice, selection or use of the ST products and services described herein.
No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this
document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products
or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such
third party products or services or any intellectual property contained therein.
UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED
WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS
OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZE REPRESENTATIVE OF ST, ST PRODUCTS ARE NOT DESIGNED,
AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING APPLICATIONS,
NOR IN PRODUCTS OR SYSTEMS, WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY, DEATH, OR
SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void
any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any
liability of ST.
Information in this document supersedes and replaces all information previously supplied.
The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.
62/62