雅思8分是百分之几:第8章 Linux Kernel Device Driver Specifications
来源:百度文库 编辑:九乡新闻网 时间:2024/04/30 03:16:28
Armadillo 開発者サイト
開発者サイト第8章 Linux Kernel Device Driver Specifications
目次
- 8.1. UART
- 8.2. Ethernet
- 8.3. SD/MMC/SDIO Host
- 8.4. USB 2.0 Host
- 8.5. Frame Buffer
- 8.6. LED Backlight
- 8.7. Touchscreen
- 8.8. Audio
- 8.9. GPIO
-
- 8.9.1. GPIO sysfs
- 8.9.2. Armadillo-200 Series Compatible GPIO Driver
- 8.10. LED
-
- 8.10.1. LED Class
- 8.10.2. Armadillo-200 Series Compatible LED Driver
- 8.11. Buttons
- 8.12. Real-time Clock
- 8.13. Watchdog Timer
- 8.14. I2C
- 8.15. SPI
- 8.16. One Wire
- 8.17. PWM
- 8.18. CAN
- 8.19. Keypad
- 8.20. Power Management
-
- 8.20.1. Treatment of External Devices During Sleep
This chapter describes the specifications of the Linux kernel device drivers unique to the Armadillo-400 Series.
It is possible to use a wide range of functionality that is not enabled by default on the Armadillo-400 Series by altering the kernel configuration.
In order to use device drivers not enabled by default on the Armadillo-400 Series, the kernel must be configured by following the steps below.
-
Select which pins to assign the function to with board options.
When using make menuconfig, board options can be altered under System Type -> Freescale MXC Implementations -> MX25 Options -> Armadillo-400 Board options in the Linux Kernel Configuration.
The board options are designed so that multiple functions cannot be assigned to the same pins. Pins that do not have any specific function assigned to them will be configured as GPIO.
-
Enable the host (master) device driver.
-
If required, enable the slave device driver.
-
If required, add device information to
linux-2.6.26-at/arch/arm/mach-mx25/armadillo400.c
.
For information on altering the kernel configuration, please refer to 「Customizing Images」.
8.1. UART
The i.MX25 processor incorporates five UART modules, UART1 to UART5. On the Armadillo-400 Series, by default UART2 is used for Serial Interface 1 (CON3), UART3 for Serial Interface 2 (CON9), and UART5 for Serial Interface 3 (CON9). Also, UART3 and UART4 can be assigned to CON11 by altering the kernel configuration. When using UART9 or UART11, CTS/RTS hardware flow control can be selectively enabled or disabled.
The UART driver has the following functionality.
-
7/8 bit send and receive
-
1/2 stop bits
-
None/Odd/Even parity
-
XON/XOFF software flow control
-
CTS/RTS hardware flow control
-
Modem line control
-
Standard Linux serial API
-
Max baud rate: 230.4Kbps (Serial Interface 1) / 4Mbps[17] (Serial Interface 2, 3)
Each serial interface and their corresponding device files are shown in 表8.1「Serial Interface Device Files」.
表8.1 Serial Interface Device Files
/dev/ttymxc1
UART2 Serial Interface 2 /dev/ttymxc2
UART3 Serial Interface 3 /dev/ttymxc4
UART5 Serial Interface 4 /dev/ttymxc3
UART4 Kernel configuration options related to the UART functionality are shown in 表8.2「UART Configuration」.
表8.2 UART Configuration
SERIAL_MXC
y
Enables the i.MX serial driver
SERIAL_MXC_CONSOLE
y
Enables the system console for the i.MX serial driver
ARMADILLO400_UART3_CON9
y
Enables UART3 on CON9
Uses CON9_3 for UART3_RXD and CON9_5 for UART3_TXD
ARMADILLO400_UART3_HW_FLOW_CON9
n
Enables hardware flow control for UART3 on CON9
Uses CON9_11 for UART3_RTS and CON9_13 for UART3_CTS
Depends on ARMADILLO400_UART3_CON9
ARMADILLO400_UART3_CON11
n
Enables UART3 on CON11
Uses CON11_40 for UART3_RXD and CON11_41 for UART3_TXD
Cannot be used with ARMADILLO400_UART3_CON9
ARMADILLO400_UART3_HW_FLOW_CON11
n
Enables hardware flow control for UART3 on CON11
Uses CON11_42 for UART3_RTS and CON11_43 for UART3_CTS
Depends on ARMADILLO400_UART3_CON11
ARMADILLO400_UART4_CON11
n
Enables UART4 on CON11
Uses CON11_44 for UART4_RXD and CON11_45 for UART4_TXD
ARMADILLO400_UART4_HW_FLOW_CON11
n
Enables hardware flow control for UART4 on CON11
Uses CON11_46 for UART4_RTS and CON11_47 for UART4_CTS
Depends on ARMADILLO400_UART4_CON11
ARMADILLO400_UART5_CON9
y
Enables UART5 on CON9
Uses CON9_4 for UART5_RXD and CON9_6 for UART5_TXD
ARMADILLO400_UART5_HW_FLOW_CON9
n
Enables hardware flow control for UART5 on CON9
Uses CON9_12 for UART5_RTS and CON9_14 for UART5_CTS
Depends on ARMADILLO400_UART5_CON9
8.2. Ethernet
The Armadillo-400 Series Ethernet driver has the following functionality.
-
Auto-negotiation support
-
Carrier detect support
-
Ethtool support
-
Link status
-
10/100Mbps speed
-
Full/Half Duplex
-
Auto-negotiation enable/disable
-
8.3. SD/MMC/SDIO Host
The i.MX25 processor incorporates two SD/MMC/SDIO host controllers (eSDHC). On the Armadillo-400 Series, by default eSDHC1 is used for the microSD slot (CON1). Also, eSDHC2 can be assigned to CON9 by altering the kernel configuration.
The Armadillo-400 Series SD/MMC/SDIO host driver has the following functionality.
-
4 bit mode
-
Card detect
When a card is inserted in the microSD card slot, it will be registered as /dev/mmcblkN
(N is 0 or 1).
Kernel configuration options related to the SD/MMC/SDIO host functionality are shown in 表8.3「SD/MMC/SDIO Host Controller Configuration」.
表8.3 SD/MMC/SDIO Host Controller Configuration
MMC
y
Enables Linux kernel MMC/SD/SDIO card support
MMC_IMX_ESDHCI
y
Enables the i.MX25 eSDHC driver
ARMADILLO400_SDHC2_CON9
n
Enables SDHC2 on CON9
Uses CON9_15 to CON9_24
8.4. USB 2.0 Host
The Armadillo-400 Series USB 2.0 host driver has the following functionality.
-
EHCI compliant
-
OTG not supported
-
USB High Speed host x1
-
USB Full Speed host x1
When a USB device is detected, it will be mapped to /dev/sd*
.
8.5. Frame Buffer
The video out function on Armadillo-440 is implemented as a frame buffer device.
The frame buffer device driver has the following functionality.
-
Double-buffer support
-
Max resolution: SVGA
The default settings on the Armadillo-440 LCD Model are shown below.
-
Resolution: 480 x 272 pixels
-
RGB 565 Color
The frame buffers and their corresponding device files are shown in 表8.4「Frame Buffer Device Files」.
表8.4 Frame Buffer Device Files
/dev/fb0
Graphic window /dev/fb1
8.6. LED Backlight
The LED backlight function on Armadillo-440 is implemented as a backlight class driver.
The backlight can be controlled with the files under the /sys/class/backlight/pwm-backlight
directory.
The brightness can be adjusted with the brightness
file. Write a value between 0 (off) and 255 (full brightness) to the brightness
file to change the brightness.
The current brightness can be obtained by reading the value from the brightness
file.
The backlight on/off can be controlled with the bl_power
file. Write 0 to bl_power
to turn the backlight off and write 1 to turn it back on.
8.7. Touchscreen
The touchscreen function on Armadillo-440 is implemented as an input device and offers an event interface to userland programs.
The events sent by the interface are shown in 表8.5「Touchscreen Events」.
表8.5 Touchscreen Events
On the Armadillo-440 LCD Model, by default the touchscreen event device is mapped to /dev/input/event1
.
The event device file numbers are determined by the order the input devices are detected. Therefore, if another input device such as a USB keyboard is detected at boot time, the event device number of the touchscreen may change.
8.8. Audio
The audio function on the Armadillo-400 Series is implemented as an ALSA device driver. The ALSA device driver has the following functionality.
-
Playback (2ch) / Capture (1ch)
-
Sampling rates: 48k, 32k, 24k, 16k, 12k, 8k Hz
-
Formats: Signed 16/20/24 bit, Little-endian
The audio device can be controlled via the ALSA library (libasound2).
The Armadillo-400 Series audio driver cannot record and play sound at the same time.
On the i.MX25, it is possible to select what pins to assign the audio function to with the audio multiplex function. On the Armadillo-400 Series, the audio multiplex settings can be changed in the kernel configuration. By default, the audio multiplexing is set to use AUD6, with the audio function connected to CON11. By altering the configuration, it is possible to connect the audio function to CON9 by using AUD5.
Kernel configuration options related to the audio functionality are shown in 表8.6「Audio Configuration」.
表8.6 Audio Configuration
SOUND
y
Enables Linux kernel sound card support
SND
y
Enables Linux kernel ALSA support
SND_SOC
y
Enables Linux kernel ASoC support
SND_MXC_SOC
y
Enables driver which provides i.MX audio functionality
SND_SOC_ARMADILLO440_WM8978
y
Enables driver which provides audio functionality using the WM8978 codec on the Armadillo-400 Series
ARMADILLO400_AUD5_CON11
y
Assign audio function to CON11
Uses CON11_42 to CON11_47
ARMADILLO400_AUD6_CON9
n
Assign audio function to CON9
Uses CON9_15, 17, 21, 22, 23, 24
Cannot be used with ARMADILLO400_AUD5_CON11
8.9. GPIO
The GPIO on the Armadillo-400 Series are implemented as generic GPIO.
There are two interfaces available to manipulate GPIO from userland: GPIO sysfs and an Armadillo-200 Series compatible GPIO driver. The GPIO sysfs driver is enabled by default.
Pins that do not have any other function assigned to them in the kernel configuration are all set to be GPIO.
8.9.1. GPIO sysfs
With GPIO sysfs, I/O direction and output levels can be set and input levels checked with the files under the /sys/class/gpio/(GPIO_NAME)
directories.
The GPIO_NAME directories and their corresponding GPIO pins are shown in 表8.7「GPIO_NAME and GPIO Pins」.
表8.7 GPIO_NAME and GPIO Pins
I/O direction configuration is done with the /sys/class/gpio/(GPIO_NAME)/direction
file by writing one of the options shown in 表8.8「GPIO I/O Direction Configuration」. The current configuration can be obtained by reading the value from the direction
file.
表8.8 GPIO I/O Direction Configuration
Output levels can be set and input levels checked with the /sys/class/gpio/(GPIO_NAME)/value
file. A 0 represents a low level and 1 a high level.
Interrupt type configuration is done with the /sys/class/gpio/(GPIO_NAME)/edge
file by writing one of the options shown in 表8.9「GPIO Interrupt Type Configuration」. The current configuration can be obtained by reading the value from the edge
file.
表8.9 GPIO Interrupt Type Configuration
An example of handling GPIO sysfs interrupts in the C language is shown in 図8.1「GPIO sysfs Interrupt Sample Program」. When executed, the sample program sets the I/O direction of CON9_1 to input, the interrupt type to falling edge, and then waits for an interrupt. When an interrupt is detected the level of the GPIO pin at that time is displayed. The program exits after interrupts have been detected three times.
#include#include #include #include #define GPIO_DIR "/sys/class/gpio" #define GPIO_NAME "CON9_1" #define GPIO_PATH GPIO_DIR "/" GPIO_NAME "/" int main(void) { int fd; int i; fd = open(GPIO_PATH "direction", O_RDWR); write(fd, "in", 2); close(fd); fd = open(GPIO_PATH "edge", O_RDWR); write(fd, "falling", 7); close(fd); for (i=0; i > 3; i++) { char val; struct pollfd pfd; fd = open(GPIO_PATH "value", O_RDWR); read(fd, &val, 1); printf("waiting for interrupt..."); fflush(stdout); pfd.fd = fd; pfd.events = POLLIN; pfd.revents = 0; poll(&pfd, 1, -1); lseek(fd, 0, SEEK_SET); read(fd, &val, 1); close(fd); printf("OK (%c, %s)\n", val, val == '0' ? "Low" : "High"); usleep(100000); } return 0; }
図8.1 GPIO sysfs Interrupt Sample Program
The interrupt type is set to falling edge by writing "falling" to the edge
file.
After specifying the interrupt type, the value
file is opened.
A dummy read is performed once on the value
file. Any interrupts occurring after this will be picked up in the polling.
The poll or select system call is used to wait for an interrupt to occur.
As a dummy read has been performed, in order to obtain the level of the GPIO pin after an interrupt has occurred the lseek system call must be used to return the offset to the start of the file.
8.9.2. Armadillo-200 Series Compatible GPIO Driver
With the Armadillo-200 Series compatible GPIO driver, GPIO are manipulated by issuing ioctl function calls to the driver specific device file.
The Armadillo-200 Series compatible GPIO driver is not enabled by default. To enable the driver, in the kernel configuration enable the CONFIG_ARMADILLO2X0_GPIO option after disabling the CONFIG_GPIO_SYSFS option and then rebuild the kernel.
The GPIO names and corresponding GPIO pins for the Armadillo-200 Series compatible GPIO driver are shown in 表8.10「Armadillo-200 Series Compatible GPIO Driver GPIO List」.
表8.10 Armadillo-200 Series Compatible GPIO Driver GPIO List
With the Armadillo-200 Series compatible GPIO driver, the GPIO names and the corresponding GPIO pin positions are the same as those on the Armadillo-200 Series. Because of this, only a subsection of the GPIO available on the Armadillo-400 Series can be used with the Armadillo-200 Series compatible GPIO driver.
The details of the device file are shown below.
表8.11 Armadillo-200 Series Compatible GPIO Driver Device File
The file descriptor of the device file is specified as the first argument to ioctl, and the command to manipulate the GPIO is specified as the second argument.
表8.12 Armadillo-200 Series Compatible GPIO Driver ioctl Commands
The structures "struct gpio_param" and "struct wait_param" defined in (kernel source)/include/linux/armadillo2x0_gpio.h
are used for the third argument. "struct gpio_param" can be linked with its "next" member to form a singly-linked list in order to control multiple GPIO at once. Be sure to set the "next" member of the last structure of the list to "0 (NULL)". For detailed usage information, please refer to the source code of the GPIO control application (atmark-dist/vendors/AtmarkTechno/Armadillo-440/gpioctrl
).
8.10. LED
There are two LED drivers for the Armadillo-400 Series: a LED class driver and an Armadillo-200 Series compatible LED driver. The LED class driver is enabled by default.
8.10.1. LED Class
The LEDs can be controlled with the files under the /sys/class/leds/(LED_NAME)
directory.
The /sys/class/leds/(LED_NAME)/brightness
file is used to turn the LEDs on and off. Writing 0 to the brightness
file turns the LED off, and writing any other number turns the LED on.
A trigger mechanism is used to control blinking with the LED class driver. The mmc0, timer, heartbeat and default-on triggers can be used on the Armadillo-400 Series. The trigger can be set by writing the respective character string to the /sys/class/leds/(LED_NAME)/trigger
file.
When the mmc0 trigger is set, the LED will blink on and off in time with data accesses to the MMC/SD card.
The timer trigger can be used to have the LED blink at a certain rate. After the timer trigger has been enabled, files /sys/class/leds/(LED_NAME)/delay_on
and /sys/class/leds/(LED_NAME)/delay_off
will be created. The length of time (msec) the LED should stay on for each cycle is written to the first file, and the time (msec) it should stay off for to the second file.
When the heartbeat trigger is set, the LED will blink regularly while the system is running.
When the default-on trigger is set, the LED will remain on continuously while the system is running.
The LED_NAME names and their respective LEDs are shown in 表8.13「LED List」.
表8.13 LED List
8.10.2. Armadillo-200 Series Compatible LED Driver
With the Armadillo-200 Series compatible LED driver, LEDs are manipulated by issuing ioctl function calls to the driver specific device file.
The Armadillo-200 Series compatible LED driver is not enabled by default. To enable the driver, in the kernel configuration enable the CONFIG_ARMADILLO2X0_LED option after disabling the CONFIG_LEDS_GPIO option and then rebuild the kernel.
The details of the LED device file are shown below.
表8.14 LED Node
The file descriptor of the device file is specified as the first argument to ioctl, and the command to manipulate the LEDs is specified as the second argument.
表8.15 LED Manipulation Commands
For detailed usage information on the LED device driver, please refer to the source code of the sample LED control application (atmark-dist/vendors/AtmarkTechno/Armadillo-440/ledctrl
).
8.11. Buttons
The button input function on the Armadillo-400 Series is implemented as an input device and offers an event interface to userland programs.
On the Armadillo-440 LCD Model, the Armadillo-440 has one on-board tact switch and the LCD Expansion Board has three buttons mounted.
The buttons and their corresponding events are shown in 表8.16「Armadillo-440 LCD Model Button Events」.
表8.16 Armadillo-440 LCD Model Button Events
On the Armadillo-440 LCD Model, by default the button event device is mapped to /dev/input/event0
.
The event device file numbers are determined by the order the input devices are detected. Therefore, if another input device such as a USB keyboard is detected at boot time, the event device number of the button function may change.
8.12. Real-time Clock
A real-time clock is incorporated on the Armadillo-440 LCD Expansion Board and the Armadillo-400 RTC Option Module.
The real-time clock is registered as /dev/rtc0
. When using the RTC Option Module with the Armadillo-440 LCD Model, the real-time clock on the RTC Option Module is registered as /dev/rtc0
, and the real-time clock on the LCD Expansion Board becomes /dev/rtc1
.
8.13. Watchdog Timer
The i.MX25 processor on the Armadillo-400 Series boards includes an internal watchdog timer.
The default bootloader on the Armadillo-400 Series enables the internal watchdog timer straight after the board is powered on. It is set to time out after 10 seconds by default.
The watchdog timer is kicked automatically by the Linux kernel.
If for some reason the Linux kernel freezes and as a result is unable to kick the watchdog timer and a time-out occurs, the system will reset.
8.14. I2C
The i.MX25 processor includes three I2C controllers: I2C1 to I2C3. On the Armadillo-400 Series, by default I2C1 is used as a board internal bus, I2C2 is assigned to CON14 and I2C3 to CON11.
The I2C bus driver has the following functionality.
-
I2C master mode
-
400 kbps max
In order to use a slave device connected to an I2C bus, a chip driver for the appropriate device must be enabled. Also, if the chip driver is written in "new style"[18], struct i2c_board_info must be configured appropriately. For the Armadillo-400 Series, please add the details to the armadillo400_i2cN_board_info array in linux-2.6.26-at/arch/arm/maxh-mx25/armadillo400.c (where N corresponds to the bus number).
Kernel configuration options related to the I2C functionality are shown in 表8.17「I2C Configuration」.
表8.17 I2C Configuration
ARMADILLO400_I2C2_CON14
y
Enables I2C2 on CON14
Uses CON14_3 for I2C2_SCL and CON14_4 for I2C2_SDA
ARMADILLO400_I2C3_CON11
y
Enables I2C3 on CON11
Uses CON11_48 for I2C3_SCL and CON11_49 for I2C3_SDA
8.15. SPI
The i.MX25 processor includes three SPI controllers: CSPI1 to CSPI3. On the Armadillo-400 Series, CSPI1 and CSPI3 can be assigned to CON9 in the kernel configuration.
The SPI master driver has the following functionality.
-
SPI master mode
-
Multiple slave selects
The SPI master driver is not enabled by default. In order to use a slave device connected to a SPI bus, both the SPI master driver and a driver for the slave device must be enabled. Also, a struct spi_board_info must be configured appropriately. On the Armadillo-400 Series, please add the details to the armadillo400_spiN_board_info array in linux-2.6.26-at/arch/arm/maxh-mx25/armadillo400.c (where N corresponds to the bus number).
Kernel configuration options related to the SPI functionality are shown in 表8.18「SPI Configuration」.
表8.18 SPI Configuration
SPI
n
Enables Linux kernel SPI support
SPI_MXC
n
Enables the i.MX SPI master driver
ARMADILLO400_SPI1_CON9
n
Enables SPI1 on CON9
Uses CON9_3 for CSPI1_MOSI, CON9_5 for CSPI1_MISO, CON9_13 for CSPI1_SCLK and CON9_26 for CSPI1_RDY
ARMADILLO400_SPI1_SS0_CON9_25
n
Uses CON9_25 for SPI1_SS0
Depends on ARMADILLO400_SPI1_CON9
ARMADILLO400_SPI1_SS1_CON9_11
n
Uses CON9_11 for SPI1_SS1
Depends on ARMADILLO400_SPI1_CON9
ARMADILLO400_SPI3_CON9
n
Enables SPI3 on CON9
Uses CON9_4 for CSPI3_MOSI, CON9_6 for CSPI3_MISO, CON9_12 for CSPI3_SCLK and CON9_14 for CSPI3_RDY
ARMADILLO400_SPI3_SS0_CON9_16
n
Uses CON9_16 for SPI3_SS0
Depends on ARMADILLO400_SPI3_CON9
ARMADILLO400_SPI3_SS1_CON9_18
n
Uses CON9_18 for SPI3_SS1
Depends on ARMADILLO400_SPI3_CON9
ARMADILLO400_SPI3_SS2_CON9_15
n
Uses CON9_15 for SPI3_SS2
Depends on ARMADILLO400_SPI3_CON9
ARMADILLO400_SPI3_SS2_CON9_17
n
Uses CON9_17 for SPI3_SS3
Depends on ARMADILLO400_SPI3_CON9
8.16. One Wire
CON9_2 and CON9_26 can be used as one wire masters on the Armadillo-400 Series. The one wire controller included in the i.MX25 processor provides the master functionality for CON9_2, and the GPIO one wire driver provides the same for CON9_26.
The one wire master drivers are not enabled by default. In order to use a slave device connected to a one wire bus, both a one wire master driver and a driver for the slave device must be enabled.
Kernel configuration options related to the one wire functionality are shown in 表8.19「One Wire Configuration」.
表8.19 One Wire Configuration
W1
n
Enables Linux kernel one wire support
W1_MASTER_MXC
n
Enables the i.MX25 internal one wire master controller driver
Please enable when using CON9_2
W1_MASTER_GPIO
n
Enables GPIO one wire master driver
Please enable when using CON9_26
ARMADILLO400_W1_CON9_2
n
Use CON9_2 as one wire
ARMADILLO400_W1_CON9_26
n
Use CON9_26 as one wire
8.17. PWM
The i.MX25 processor includes four PWM modules: PWM1 to PWM4. On the Armadillo-400 Series, by default PWM1 is used for the LED backlight (CON11_12). PWN2 can be assigned to CON9_25 and PWM4 to CON14_3 by altering the kernel configuration.
With the i.MX25 PWM driver, configuration can be changed by writing an appropriate value to the files under /sys/class/mxc_pwm/(PWM_NAME). Files used for configuration are shown in 表8.20「PWM sysfs」.
表8.20 PWM sysfs
period_ns
PWN period set in nsec
Acceptable range is from 17 to 2,147,483,647 (from 20usec to 2sec approx.)
duty_ns
PWM on time (off time when invert = 1) set in nsec
Acceptable range is 0 < duty_ns < period_ns
invert
PWM output reversed when set to 1
enable
PWM output enabled when set to 1
Output stopped when set to 0
period_ns, duty_ns and invert can be changed even while PWM is enabled
Kernel configuration options related to the PWM functionality are shown in 表8.21「PWM Configuration」.
表8.21 PWM Configuration
MXC_PWM
y
Enable the i.MX25 PWM driver
MXC_PWM_CLASS
y
Enable PWM configuration via sysfs
ARMADILLO400_PWM2_CON9_25
n
Uses CON9_25 as PWM2
The PWM_NAME is CON9_25
ARMADILLO400_PWM4_CON14_3
n
Uses CON14_3 as PWM4
The PWM_NAME is CON14_3
8.18. CAN
The i.MX25 processor includes two CAN controllers (FlexCAN): CAN1 and CAN2. On the Armadillo-400 Series, CAN2 can be assigned to CON14 by altering the kernel configuration. The CAN driver is not enabled by default.
The CAN functionality is provided by the SocketCAN framework. For information on SocketCAN, please refer to linux-2.6.26-at/Documentation/networking/can.txt.
The CAN driver has the following functionality.
-
Base and Extended frame format support
-
1Mbps max
Configuration can be changed by writing an appropriate value to the files under /sys/devices/platform/FlexCAN.1/. Files used for configuration are shown in 表8.22「CAN sysfs」[19].
表8.22 CAN sysfs
br_clksrc
Specify clock source
When bus is specified, 66.5MHz is used for clock source
When osc is specified, 24MHz is used for clock source
bus
A
br_presdiv
Specify clock source prescaler divider
1 to 8 can be specified
7
A
br_propseg
Set propagation segment value
1 to 8 can be specified
5
A
br_pseg1
Set phase buffer segment 1 value
1 to 8 can be specified
5
A
br_pseg2
Set phase buffer segment 2 value
1 to 8 can be specified
8
A
br_rjw
Set resynchronization jump width
1 to 4 can be specified
3
A
bitrate
Displays transmission speed (bps)
Cannot be written to
500000
None
std_msg
Set whether or not to support standard format
1 for support, 0 for no support
1
A
ext_msg
Set whether or not to support extended format
1 for support, 0 for no support
1
A
maxmb
Set max message buffer number
2 to 64 can be specified
64
A
rx_maxmb
Set receive message buffer size
Send message buffer size is: maxmb - rx_maxmb
1 to maxmb - 1 can be specified
32
A
state
Display current status
Displayed with format: "interface status::error status"
Interface status is either "Start" (up) or "Stop" (down)
Error status is one of following: "normal", "error passive", "bus off"
Stop::normal
None
boff_rec
Set whether or not to recover from bus off automatically
0 to recover automatically, 1 to not recover
1
A
listen
Set whether or not to enable listen mode (receive only)
1 to enable listen mode, 0 to disable
0
A
loopback
Set whether or not to enable loopback mode
1 to enable loopback mode, 0 to disable
0
A
smp
Set sampling behavior
0 for determining received bit value from 1 sample
1 for determining received bit value by majority count from 3 samples
1
A
srx_dis
Set whether or not to receive sent frames
0 to receive sent frames, 1 to not receive
1
A
set_resframe
Set data frame to reply with after receiving remote frame
Set with format: "ID#DATA"
ID specified with 3 digit hex (standard format) or 8 digit hex value
Data specified as 0 to 8 groups of 2 digit hex values
Data can be separated by "."
None
B
del_resframe
Delete data frame set with set_resframe
Specify ID of data frame to delete with 3 digit hex (standard format) or 8 digit hex value
None
B
show_resframe
Display data frame set with set_resframe
Cannot be written to
None
C
wakeup
Set whether or not to enable CAN receive wakeup while suspended
1 to enable wakeup, 0 to disable
0
A
wak_src
Set whether or not to use low-pass filter while suspended
1 to enable filter, 0 to disable
0
A
-
Condition A: can be set when the network interface is in the off state (ifconfig canX off).
-
Condition B: can be set when the network interface is in the on state (ifconfig canX on).
-
Condition C: can be referenced when the network interface is in the on state (ifconfig canX on).
Transmission speed is determined by the following formula.
src_clk = 66,500,000 (br_clksrc = bus condition) src_clk = 24,000,000 (br_clksrc = osc condition) Transmission Speed[bps] = src_clk / br_presdiv / (1 + br_propseg + br_pseg1 + br_pseg2)
図8.2 CAN Transmission Speed Calculation
Kernel configuration options related to the CAN functionality are shown in 表8.23「CAN Configuration」.
表8.23 CAN Configuration
CAN
n
Enable Linux kernel CAN support
CAN_RAW
n
Enable RAW_CAN protocol support
CAN_BCM
n
Enable CAN_BCM protocol support
CAN_FLEXCAN
n
Enable the i.MX25 FlexCAN driver
ARMADILLO400_CAN2_CON14
n
Uses CON14 for CAN2
Uses CON14_3 for CAN2_TXCAN and CON14_4 for CAN2_RXCAN
8.19. Keypad
The i.MX25 processor includes a keypad controller. On the Armadillo-400 Series, the keypad can be assigned to CON11 by altering the kernel configuration. The keypad driver is not enabled by default.
Kernel configuration options related to the keypad functionality are shown in 表8.24「Keypad Configuration」.
表8.24 Keypad Configuration
INPUT
y
Enable Linux kernel input layer support
INPUT_EVDEV
y
Enable input layer event device support
KEYBOARD_MXC
n
Enable the i.MX25 keypad driver
ARMADILLO400_KEYPAD_CON11
n
Enable keypad on CON11
Please enable at least one COL and ROW each
ARMADILLO400_KEYPAD_ROW0_CON11_40
n
Uses CON11_40 as ROW0
ARMADILLO400_KEYPAD_ROW1_CON11_41
n
Uses CON11_41 as ROW1
ARMADILLO400_KEYPAD_ROW2_CON11_42
n
Uses CON11_42 as ROW2
ARMADILLO400_KEYPAD_ROW3_CON11_43
n
Uses CON11_43 as ROW3
ARMADILLO400_KEYPAD_COL0_CON11_44
n
Uses CON11_44 as COL0
ARMADILLO400_KEYPAD_COL1_CON11_45
n
Uses CON11_45 as COL1
ARMADILLO400_KEYPAD_COL2_CON11_46
n
Uses CON11_46 as COL2
ARMADILLO400_KEYPAD_COL3_CON11_47
n
Uses CON11_47 as COL3
ARMADILLO400_KEYPAD_ROW4_CON11_48
n
Uses CON11_48 as ROW4
ARMADILLO400_KEYPAD_ROW5_CON11_49
n
Uses CON11_49 as ROW5
To set what ROW and COL range is used for the keypad, specify the appropriate values in the armadillo440_keypad_data variable in linux-2.6.26-at/arch/arm/maxh-mx25/armadillo400.c. Specify the button to event key mappings in the armadillo440_keymapping variable.
8.20. Power Management
The Armadillo-400 Series support the Linux power management sleep functionality. In the sleep state, the execution of applications is paused and the kernel enters the suspend state. Power consumption is kept at a minimum during the sleep state as the operation of external devices is halted. When returning to the normal execution state from the sleep state, the kernel's resume logic is run and applications are returned to a running state.
Sleep mode can be entered by writing either "standby" or "mem" to the /sys/power/state
file. The system will return to the normal execution state from sleep mode when a wakeup interrupt occurs.
The differences in state of each mode are shown in 表8.25「Sleep Modes」. The suspend-to-RAM sleep mode provides for a greater reduction in power consumption compared to the power-on suspend mode.
表8.25 Sleep Modes
For devices that can be used as a basis for wakeups, whether or not they do trigger a wakeup can be specified with their power/wakeup
sysfs entry. Write "enabled" to the power/wakeup
file and the device will function as a basis for wakeups, and write "disabled" and they will not.
Please refer to 表8.26「Wakeup Basis Designation」 for details.
表8.26 Wakeup Basis Designation
8.20.1. Treatment of External Devices During Sleep
On the Armadillo-400 Series, the power supply to all external devices is halted as part of the suspend logic.
Because of this, USB devices must be put into a state where they can be safely disconnected before the system in put into the sleep state. That is, USB memory must be unmounted first. As the devices will be detected again when the system resumes, USB devices can be disconnected and reconnected while the system is in the sleep state.
As opposed to this, microSD cards can be left mounted when the system is put into the sleep state. In order for this to be possible, the SD host driver does not probe for cards at resume time, and instead assumes the same card is still inserted. Because of this, microSD cards cannot be removed or inserted when the system is in the sleep state.
For Ethernet devices, at resume time the same process is followed as when a cable is reconnected. Therefore, Auto-negotiation will take place at resume time if it is enabled.
By default, +3.3V_IO output is stopped when the system is put into the sleep state. However, if Serial Port 2 or Serial Port 4 are selected as a wakeup basis, the +3.3V_IO output will continue even during the sleep state.
[17] When DMA transfer is enabled. DMA is not enabled by default.
[18] Refer to linux-2.6.26-at/Documentation/i2c/writing-clients.
[19] Please do not use any file not described here as they are only provided for backwards compatibility.
第7章 Kernel and Userland Placement
PDF version 付録A Hermit-At Bootloader
- Preface
-
- Who Should Read This Document
- Document Structure
- Typographical Conventions
-
- Fonts
- Command Entry Examples
- Icons
- Acknowledgements
- Software Usage Precautions
- Trademarks
- System Overview
-
- Armadillo-400 Series Basic Specifications
- Basic Specifications of Armadillo-420 Basic Model
- Basic Specifications of Armadillo-440 LCD Model
- Memory Map
- Software Make-up
-
- Bootloader
- Kernel
- Userland
- Downloader
- Boot Modes
- Before Getting Started
-
- Preparation
- Connections
- Serial Console Software Configuration
- Development Environment Set-up
-
- Installing Cross Development Environment Packages
- Installing Packages Required for Atmark-Dist Builds
- Installing Cross Development Library Packages
- Rewriting Flash Memory
-
- Flash Memory Writing Regions
- Installing Downloader
-
- For Linux
- For Windows
- Rewriting Flash Memory With A Downloader
-
- Preparation
- For Linux
- For Windows
- Rewriting Flash Memory With tftpdl
- Rewriting Flash Memory With netflash
- Restoring Bootloader to Factory State
-
- Preparation
- For Linux
- For Windows
- Building
-
- Building Kernel and Userland Images
-
- Preparing Source Code
- Applying Default Configuration
- Building
- Customizing Images
- Adding An Application To The Userland Image
- Building Bootloader Images
-
- Preparing Source Code
- Building
- Kernel and Userland Placement
-
- Loading From A TFTP Server
-
- File Placement
- Boot Options
- Loading From Storage
-
- Partitioning
- Creating Filesystems
- Kernel Image Placement
- Creating A Root Filesystem
- Boot Device and Kernel Parameter Settings
- Return Settings To Defaults
- Linux Kernel Device Driver Specifications
-
- UART
- Ethernet
- SD/MMC/SDIO Host
- USB 2.0 Host
- Frame Buffer
- LED Backlight
- Touchscreen
- Audio
- GPIO
-
- GPIO sysfs
- Armadillo-200 Series Compatible GPIO Driver
- LED
-
- LED Class
- Armadillo-200 Series Compatible LED Driver
- Buttons
- Real-time Clock
- Watchdog Timer
- I2C
- SPI
- One Wire
- PWM
- CAN
- Keypad
- Power Management
-
- Treatment of External Devices During Sleep
© 2010 Atmark Techno, Inc.
Armadillo 開発者サイト
開発者サイト第8章 Linux Kernel Device Driver Specifications
目次
- 8.1. UART
- 8.2. Ethernet
- 8.3. SD/MMC/SDIO Host
- 8.4. USB 2.0 Host
- 8.5. Frame Buffer
- 8.6. LED Backlight
- 8.7. Touchscreen
- 8.8. Audio
- 8.9. GPIO
-
- 8.9.1. GPIO sysfs
- 8.9.2. Armadillo-200 Series Compatible GPIO Driver
- 8.10. LED
-
- 8.10.1. LED Class
- 8.10.2. Armadillo-200 Series Compatible LED Driver
- 8.11. Buttons
- 8.12. Real-time Clock
- 8.13. Watchdog Timer
- 8.14. I2C
- 8.15. SPI
- 8.16. One Wire
- 8.17. PWM
- 8.18. CAN
- 8.19. Keypad
- 8.20. Power Management
-
- 8.20.1. Treatment of External Devices During Sleep
This chapter describes the specifications of the Linux kernel device drivers unique to the Armadillo-400 Series.
It is possible to use a wide range of functionality that is not enabled by default on the Armadillo-400 Series by altering the kernel configuration.
In order to use device drivers not enabled by default on the Armadillo-400 Series, the kernel must be configured by following the steps below.
-
Select which pins to assign the function to with board options.
When using make menuconfig, board options can be altered under System Type -> Freescale MXC Implementations -> MX25 Options -> Armadillo-400 Board options in the Linux Kernel Configuration.
The board options are designed so that multiple functions cannot be assigned to the same pins. Pins that do not have any specific function assigned to them will be configured as GPIO.
-
Enable the host (master) device driver.
-
If required, enable the slave device driver.
-
If required, add device information to
linux-2.6.26-at/arch/arm/mach-mx25/armadillo400.c
.
For information on altering the kernel configuration, please refer to 「Customizing Images」.
8.1. UART
The i.MX25 processor incorporates five UART modules, UART1 to UART5. On the Armadillo-400 Series, by default UART2 is used for Serial Interface 1 (CON3), UART3 for Serial Interface 2 (CON9), and UART5 for Serial Interface 3 (CON9). Also, UART3 and UART4 can be assigned to CON11 by altering the kernel configuration. When using UART9 or UART11, CTS/RTS hardware flow control can be selectively enabled or disabled.
The UART driver has the following functionality.
-
7/8 bit send and receive
-
1/2 stop bits
-
None/Odd/Even parity
-
XON/XOFF software flow control
-
CTS/RTS hardware flow control
-
Modem line control
-
Standard Linux serial API
-
Max baud rate: 230.4Kbps (Serial Interface 1) / 4Mbps[17] (Serial Interface 2, 3)
Each serial interface and their corresponding device files are shown in 表8.1「Serial Interface Device Files」.
表8.1 Serial Interface Device Files
/dev/ttymxc1
UART2 Serial Interface 2 /dev/ttymxc2
UART3 Serial Interface 3 /dev/ttymxc4
UART5 Serial Interface 4 /dev/ttymxc3
UART4 Kernel configuration options related to the UART functionality are shown in 表8.2「UART Configuration」.
表8.2 UART Configuration
SERIAL_MXC
y
Enables the i.MX serial driver
SERIAL_MXC_CONSOLE
y
Enables the system console for the i.MX serial driver
ARMADILLO400_UART3_CON9
y
Enables UART3 on CON9
Uses CON9_3 for UART3_RXD and CON9_5 for UART3_TXD
ARMADILLO400_UART3_HW_FLOW_CON9
n
Enables hardware flow control for UART3 on CON9
Uses CON9_11 for UART3_RTS and CON9_13 for UART3_CTS
Depends on ARMADILLO400_UART3_CON9
ARMADILLO400_UART3_CON11
n
Enables UART3 on CON11
Uses CON11_40 for UART3_RXD and CON11_41 for UART3_TXD
Cannot be used with ARMADILLO400_UART3_CON9
ARMADILLO400_UART3_HW_FLOW_CON11
n
Enables hardware flow control for UART3 on CON11
Uses CON11_42 for UART3_RTS and CON11_43 for UART3_CTS
Depends on ARMADILLO400_UART3_CON11
ARMADILLO400_UART4_CON11
n
Enables UART4 on CON11
Uses CON11_44 for UART4_RXD and CON11_45 for UART4_TXD
ARMADILLO400_UART4_HW_FLOW_CON11
n
Enables hardware flow control for UART4 on CON11
Uses CON11_46 for UART4_RTS and CON11_47 for UART4_CTS
Depends on ARMADILLO400_UART4_CON11
ARMADILLO400_UART5_CON9
y
Enables UART5 on CON9
Uses CON9_4 for UART5_RXD and CON9_6 for UART5_TXD
ARMADILLO400_UART5_HW_FLOW_CON9
n
Enables hardware flow control for UART5 on CON9
Uses CON9_12 for UART5_RTS and CON9_14 for UART5_CTS
Depends on ARMADILLO400_UART5_CON9
8.2. Ethernet
The Armadillo-400 Series Ethernet driver has the following functionality.
-
Auto-negotiation support
-
Carrier detect support
-
Ethtool support
-
Link status
-
10/100Mbps speed
-
Full/Half Duplex
-
Auto-negotiation enable/disable
-
8.3. SD/MMC/SDIO Host
The i.MX25 processor incorporates two SD/MMC/SDIO host controllers (eSDHC). On the Armadillo-400 Series, by default eSDHC1 is used for the microSD slot (CON1). Also, eSDHC2 can be assigned to CON9 by altering the kernel configuration.
The Armadillo-400 Series SD/MMC/SDIO host driver has the following functionality.
-
4 bit mode
-
Card detect
When a card is inserted in the microSD card slot, it will be registered as /dev/mmcblkN
(N is 0 or 1).
Kernel configuration options related to the SD/MMC/SDIO host functionality are shown in 表8.3「SD/MMC/SDIO Host Controller Configuration」.
表8.3 SD/MMC/SDIO Host Controller Configuration
MMC
y
Enables Linux kernel MMC/SD/SDIO card support
MMC_IMX_ESDHCI
y
Enables the i.MX25 eSDHC driver
ARMADILLO400_SDHC2_CON9
n
Enables SDHC2 on CON9
Uses CON9_15 to CON9_24
8.4. USB 2.0 Host
The Armadillo-400 Series USB 2.0 host driver has the following functionality.
-
EHCI compliant
-
OTG not supported
-
USB High Speed host x1
-
USB Full Speed host x1
When a USB device is detected, it will be mapped to /dev/sd*
.
8.5. Frame Buffer
The video out function on Armadillo-440 is implemented as a frame buffer device.
The frame buffer device driver has the following functionality.
-
Double-buffer support
-
Max resolution: SVGA
The default settings on the Armadillo-440 LCD Model are shown below.
-
Resolution: 480 x 272 pixels
-
RGB 565 Color
The frame buffers and their corresponding device files are shown in 表8.4「Frame Buffer Device Files」.
表8.4 Frame Buffer Device Files
/dev/fb0
Graphic window /dev/fb1
8.6. LED Backlight
The LED backlight function on Armadillo-440 is implemented as a backlight class driver.
The backlight can be controlled with the files under the /sys/class/backlight/pwm-backlight
directory.
The brightness can be adjusted with the brightness
file. Write a value between 0 (off) and 255 (full brightness) to the brightness
file to change the brightness.
The current brightness can be obtained by reading the value from the brightness
file.
The backlight on/off can be controlled with the bl_power
file. Write 0 to bl_power
to turn the backlight off and write 1 to turn it back on.
8.7. Touchscreen
The touchscreen function on Armadillo-440 is implemented as an input device and offers an event interface to userland programs.
The events sent by the interface are shown in 表8.5「Touchscreen Events」.
表8.5 Touchscreen Events
On the Armadillo-440 LCD Model, by default the touchscreen event device is mapped to /dev/input/event1
.
The event device file numbers are determined by the order the input devices are detected. Therefore, if another input device such as a USB keyboard is detected at boot time, the event device number of the touchscreen may change.
8.8. Audio
The audio function on the Armadillo-400 Series is implemented as an ALSA device driver. The ALSA device driver has the following functionality.
-
Playback (2ch) / Capture (1ch)
-
Sampling rates: 48k, 32k, 24k, 16k, 12k, 8k Hz
-
Formats: Signed 16/20/24 bit, Little-endian
The audio device can be controlled via the ALSA library (libasound2).
The Armadillo-400 Series audio driver cannot record and play sound at the same time.
On the i.MX25, it is possible to select what pins to assign the audio function to with the audio multiplex function. On the Armadillo-400 Series, the audio multiplex settings can be changed in the kernel configuration. By default, the audio multiplexing is set to use AUD6, with the audio function connected to CON11. By altering the configuration, it is possible to connect the audio function to CON9 by using AUD5.
Kernel configuration options related to the audio functionality are shown in 表8.6「Audio Configuration」.
表8.6 Audio Configuration
SOUND
y
Enables Linux kernel sound card support
SND
y
Enables Linux kernel ALSA support
SND_SOC
y
Enables Linux kernel ASoC support
SND_MXC_SOC
y
Enables driver which provides i.MX audio functionality
SND_SOC_ARMADILLO440_WM8978
y
Enables driver which provides audio functionality using the WM8978 codec on the Armadillo-400 Series
ARMADILLO400_AUD5_CON11
y
Assign audio function to CON11
Uses CON11_42 to CON11_47
ARMADILLO400_AUD6_CON9
n
Assign audio function to CON9
Uses CON9_15, 17, 21, 22, 23, 24
Cannot be used with ARMADILLO400_AUD5_CON11
8.9. GPIO
The GPIO on the Armadillo-400 Series are implemented as generic GPIO.
There are two interfaces available to manipulate GPIO from userland: GPIO sysfs and an Armadillo-200 Series compatible GPIO driver. The GPIO sysfs driver is enabled by default.
Pins that do not have any other function assigned to them in the kernel configuration are all set to be GPIO.
8.9.1. GPIO sysfs
With GPIO sysfs, I/O direction and output levels can be set and input levels checked with the files under the /sys/class/gpio/(GPIO_NAME)
directories.
The GPIO_NAME directories and their corresponding GPIO pins are shown in 表8.7「GPIO_NAME and GPIO Pins」.
表8.7 GPIO_NAME and GPIO Pins
I/O direction configuration is done with the /sys/class/gpio/(GPIO_NAME)/direction
file by writing one of the options shown in 表8.8「GPIO I/O Direction Configuration」. The current configuration can be obtained by reading the value from the direction
file.
表8.8 GPIO I/O Direction Configuration
Output levels can be set and input levels checked with the /sys/class/gpio/(GPIO_NAME)/value
file. A 0 represents a low level and 1 a high level.
Interrupt type configuration is done with the /sys/class/gpio/(GPIO_NAME)/edge
file by writing one of the options shown in 表8.9「GPIO Interrupt Type Configuration」. The current configuration can be obtained by reading the value from the edge
file.
表8.9 GPIO Interrupt Type Configuration
An example of handling GPIO sysfs interrupts in the C language is shown in 図8.1「GPIO sysfs Interrupt Sample Program」. When executed, the sample program sets the I/O direction of CON9_1 to input, the interrupt type to falling edge, and then waits for an interrupt. When an interrupt is detected the level of the GPIO pin at that time is displayed. The program exits after interrupts have been detected three times.
#include#include #include #include #define GPIO_DIR "/sys/class/gpio" #define GPIO_NAME "CON9_1" #define GPIO_PATH GPIO_DIR "/" GPIO_NAME "/" int main(void) { int fd; int i; fd = open(GPIO_PATH "direction", O_RDWR); write(fd, "in", 2); close(fd); fd = open(GPIO_PATH "edge", O_RDWR); write(fd, "falling", 7); close(fd); for (i=0; i > 3; i++) { char val; struct pollfd pfd; fd = open(GPIO_PATH "value", O_RDWR); read(fd, &val, 1); printf("waiting for interrupt..."); fflush(stdout); pfd.fd = fd; pfd.events = POLLIN; pfd.revents = 0; poll(&pfd, 1, -1); lseek(fd, 0, SEEK_SET); read(fd, &val, 1); close(fd); printf("OK (%c, %s)\n", val, val == '0' ? "Low" : "High"); usleep(100000); } return 0; }
図8.1 GPIO sysfs Interrupt Sample Program
The interrupt type is set to falling edge by writing "falling" to the edge
file.
After specifying the interrupt type, the value
file is opened.
A dummy read is performed once on the value
file. Any interrupts occurring after this will be picked up in the polling.
The poll or select system call is used to wait for an interrupt to occur.
As a dummy read has been performed, in order to obtain the level of the GPIO pin after an interrupt has occurred the lseek system call must be used to return the offset to the start of the file.
8.9.2. Armadillo-200 Series Compatible GPIO Driver
With the Armadillo-200 Series compatible GPIO driver, GPIO are manipulated by issuing ioctl function calls to the driver specific device file.
The Armadillo-200 Series compatible GPIO driver is not enabled by default. To enable the driver, in the kernel configuration enable the CONFIG_ARMADILLO2X0_GPIO option after disabling the CONFIG_GPIO_SYSFS option and then rebuild the kernel.
The GPIO names and corresponding GPIO pins for the Armadillo-200 Series compatible GPIO driver are shown in 表8.10「Armadillo-200 Series Compatible GPIO Driver GPIO List」.
表8.10 Armadillo-200 Series Compatible GPIO Driver GPIO List
With the Armadillo-200 Series compatible GPIO driver, the GPIO names and the corresponding GPIO pin positions are the same as those on the Armadillo-200 Series. Because of this, only a subsection of the GPIO available on the Armadillo-400 Series can be used with the Armadillo-200 Series compatible GPIO driver.
The details of the device file are shown below.
表8.11 Armadillo-200 Series Compatible GPIO Driver Device File
The file descriptor of the device file is specified as the first argument to ioctl, and the command to manipulate the GPIO is specified as the second argument.
表8.12 Armadillo-200 Series Compatible GPIO Driver ioctl Commands
The structures "struct gpio_param" and "struct wait_param" defined in (kernel source)/include/linux/armadillo2x0_gpio.h
are used for the third argument. "struct gpio_param" can be linked with its "next" member to form a singly-linked list in order to control multiple GPIO at once. Be sure to set the "next" member of the last structure of the list to "0 (NULL)". For detailed usage information, please refer to the source code of the GPIO control application (atmark-dist/vendors/AtmarkTechno/Armadillo-440/gpioctrl
).
8.10. LED
There are two LED drivers for the Armadillo-400 Series: a LED class driver and an Armadillo-200 Series compatible LED driver. The LED class driver is enabled by default.
8.10.1. LED Class
The LEDs can be controlled with the files under the /sys/class/leds/(LED_NAME)
directory.
The /sys/class/leds/(LED_NAME)/brightness
file is used to turn the LEDs on and off. Writing 0 to the brightness
file turns the LED off, and writing any other number turns the LED on.
A trigger mechanism is used to control blinking with the LED class driver. The mmc0, timer, heartbeat and default-on triggers can be used on the Armadillo-400 Series. The trigger can be set by writing the respective character string to the /sys/class/leds/(LED_NAME)/trigger
file.
When the mmc0 trigger is set, the LED will blink on and off in time with data accesses to the MMC/SD card.
The timer trigger can be used to have the LED blink at a certain rate. After the timer trigger has been enabled, files /sys/class/leds/(LED_NAME)/delay_on
and /sys/class/leds/(LED_NAME)/delay_off
will be created. The length of time (msec) the LED should stay on for each cycle is written to the first file, and the time (msec) it should stay off for to the second file.
When the heartbeat trigger is set, the LED will blink regularly while the system is running.
When the default-on trigger is set, the LED will remain on continuously while the system is running.
The LED_NAME names and their respective LEDs are shown in 表8.13「LED List」.
表8.13 LED List
8.10.2. Armadillo-200 Series Compatible LED Driver
With the Armadillo-200 Series compatible LED driver, LEDs are manipulated by issuing ioctl function calls to the driver specific device file.
The Armadillo-200 Series compatible LED driver is not enabled by default. To enable the driver, in the kernel configuration enable the CONFIG_ARMADILLO2X0_LED option after disabling the CONFIG_LEDS_GPIO option and then rebuild the kernel.
The details of the LED device file are shown below.
表8.14 LED Node
The file descriptor of the device file is specified as the first argument to ioctl, and the command to manipulate the LEDs is specified as the second argument.
表8.15 LED Manipulation Commands
For detailed usage information on the LED device driver, please refer to the source code of the sample LED control application (atmark-dist/vendors/AtmarkTechno/Armadillo-440/ledctrl
).
8.11. Buttons
The button input function on the Armadillo-400 Series is implemented as an input device and offers an event interface to userland programs.
On the Armadillo-440 LCD Model, the Armadillo-440 has one on-board tact switch and the LCD Expansion Board has three buttons mounted.
The buttons and their corresponding events are shown in 表8.16「Armadillo-440 LCD Model Button Events」.
表8.16 Armadillo-440 LCD Model Button Events
On the Armadillo-440 LCD Model, by default the button event device is mapped to /dev/input/event0
.
The event device file numbers are determined by the order the input devices are detected. Therefore, if another input device such as a USB keyboard is detected at boot time, the event device number of the button function may change.
8.12. Real-time Clock
A real-time clock is incorporated on the Armadillo-440 LCD Expansion Board and the Armadillo-400 RTC Option Module.
The real-time clock is registered as /dev/rtc0
. When using the RTC Option Module with the Armadillo-440 LCD Model, the real-time clock on the RTC Option Module is registered as /dev/rtc0
, and the real-time clock on the LCD Expansion Board becomes /dev/rtc1
.
8.13. Watchdog Timer
The i.MX25 processor on the Armadillo-400 Series boards includes an internal watchdog timer.
The default bootloader on the Armadillo-400 Series enables the internal watchdog timer straight after the board is powered on. It is set to time out after 10 seconds by default.
The watchdog timer is kicked automatically by the Linux kernel.
If for some reason the Linux kernel freezes and as a result is unable to kick the watchdog timer and a time-out occurs, the system will reset.
8.14. I2C
The i.MX25 processor includes three I2C controllers: I2C1 to I2C3. On the Armadillo-400 Series, by default I2C1 is used as a board internal bus, I2C2 is assigned to CON14 and I2C3 to CON11.
The I2C bus driver has the following functionality.
-
I2C master mode
-
400 kbps max
In order to use a slave device connected to an I2C bus, a chip driver for the appropriate device must be enabled. Also, if the chip driver is written in "new style"[18], struct i2c_board_info must be configured appropriately. For the Armadillo-400 Series, please add the details to the armadillo400_i2cN_board_info array in linux-2.6.26-at/arch/arm/maxh-mx25/armadillo400.c (where N corresponds to the bus number).
Kernel configuration options related to the I2C functionality are shown in 表8.17「I2C Configuration」.
表8.17 I2C Configuration
ARMADILLO400_I2C2_CON14
y
Enables I2C2 on CON14
Uses CON14_3 for I2C2_SCL and CON14_4 for I2C2_SDA
ARMADILLO400_I2C3_CON11
y
Enables I2C3 on CON11
Uses CON11_48 for I2C3_SCL and CON11_49 for I2C3_SDA
8.15. SPI
The i.MX25 processor includes three SPI controllers: CSPI1 to CSPI3. On the Armadillo-400 Series, CSPI1 and CSPI3 can be assigned to CON9 in the kernel configuration.
The SPI master driver has the following functionality.
-
SPI master mode
-
Multiple slave selects
The SPI master driver is not enabled by default. In order to use a slave device connected to a SPI bus, both the SPI master driver and a driver for the slave device must be enabled. Also, a struct spi_board_info must be configured appropriately. On the Armadillo-400 Series, please add the details to the armadillo400_spiN_board_info array in linux-2.6.26-at/arch/arm/maxh-mx25/armadillo400.c (where N corresponds to the bus number).
Kernel configuration options related to the SPI functionality are shown in 表8.18「SPI Configuration」.
表8.18 SPI Configuration
SPI
n
Enables Linux kernel SPI support
SPI_MXC
n
Enables the i.MX SPI master driver
ARMADILLO400_SPI1_CON9
n
Enables SPI1 on CON9
Uses CON9_3 for CSPI1_MOSI, CON9_5 for CSPI1_MISO, CON9_13 for CSPI1_SCLK and CON9_26 for CSPI1_RDY
ARMADILLO400_SPI1_SS0_CON9_25
n
Uses CON9_25 for SPI1_SS0
Depends on ARMADILLO400_SPI1_CON9
ARMADILLO400_SPI1_SS1_CON9_11
n
Uses CON9_11 for SPI1_SS1
Depends on ARMADILLO400_SPI1_CON9
ARMADILLO400_SPI3_CON9
n
Enables SPI3 on CON9
Uses CON9_4 for CSPI3_MOSI, CON9_6 for CSPI3_MISO, CON9_12 for CSPI3_SCLK and CON9_14 for CSPI3_RDY
ARMADILLO400_SPI3_SS0_CON9_16
n
Uses CON9_16 for SPI3_SS0
Depends on ARMADILLO400_SPI3_CON9
ARMADILLO400_SPI3_SS1_CON9_18
n
Uses CON9_18 for SPI3_SS1
Depends on ARMADILLO400_SPI3_CON9
ARMADILLO400_SPI3_SS2_CON9_15
n
Uses CON9_15 for SPI3_SS2
Depends on ARMADILLO400_SPI3_CON9
ARMADILLO400_SPI3_SS2_CON9_17
n
Uses CON9_17 for SPI3_SS3
Depends on ARMADILLO400_SPI3_CON9
8.16. One Wire
CON9_2 and CON9_26 can be used as one wire masters on the Armadillo-400 Series. The one wire controller included in the i.MX25 processor provides the master functionality for CON9_2, and the GPIO one wire driver provides the same for CON9_26.
The one wire master drivers are not enabled by default. In order to use a slave device connected to a one wire bus, both a one wire master driver and a driver for the slave device must be enabled.
Kernel configuration options related to the one wire functionality are shown in 表8.19「One Wire Configuration」.
表8.19 One Wire Configuration
W1
n
Enables Linux kernel one wire support
W1_MASTER_MXC
n
Enables the i.MX25 internal one wire master controller driver
Please enable when using CON9_2
W1_MASTER_GPIO
n
Enables GPIO one wire master driver
Please enable when using CON9_26
ARMADILLO400_W1_CON9_2
n
Use CON9_2 as one wire
ARMADILLO400_W1_CON9_26
n
Use CON9_26 as one wire
8.17. PWM
The i.MX25 processor includes four PWM modules: PWM1 to PWM4. On the Armadillo-400 Series, by default PWM1 is used for the LED backlight (CON11_12). PWN2 can be assigned to CON9_25 and PWM4 to CON14_3 by altering the kernel configuration.
With the i.MX25 PWM driver, configuration can be changed by writing an appropriate value to the files under /sys/class/mxc_pwm/(PWM_NAME). Files used for configuration are shown in 表8.20「PWM sysfs」.
表8.20 PWM sysfs
period_ns
PWN period set in nsec
Acceptable range is from 17 to 2,147,483,647 (from 20usec to 2sec approx.)
duty_ns
PWM on time (off time when invert = 1) set in nsec
Acceptable range is 0 < duty_ns < period_ns
invert
PWM output reversed when set to 1
enable
PWM output enabled when set to 1
Output stopped when set to 0
period_ns, duty_ns and invert can be changed even while PWM is enabled
Kernel configuration options related to the PWM functionality are shown in 表8.21「PWM Configuration」.
表8.21 PWM Configuration
MXC_PWM
y
Enable the i.MX25 PWM driver
MXC_PWM_CLASS
y
Enable PWM configuration via sysfs
ARMADILLO400_PWM2_CON9_25
n
Uses CON9_25 as PWM2
The PWM_NAME is CON9_25
ARMADILLO400_PWM4_CON14_3
n
Uses CON14_3 as PWM4
The PWM_NAME is CON14_3
8.18. CAN
The i.MX25 processor includes two CAN controllers (FlexCAN): CAN1 and CAN2. On the Armadillo-400 Series, CAN2 can be assigned to CON14 by altering the kernel configuration. The CAN driver is not enabled by default.
The CAN functionality is provided by the SocketCAN framework. For information on SocketCAN, please refer to linux-2.6.26-at/Documentation/networking/can.txt.
The CAN driver has the following functionality.
-
Base and Extended frame format support
-
1Mbps max
Configuration can be changed by writing an appropriate value to the files under /sys/devices/platform/FlexCAN.1/. Files used for configuration are shown in 表8.22「CAN sysfs」[19].
表8.22 CAN sysfs
br_clksrc
Specify clock source
When bus is specified, 66.5MHz is used for clock source
When osc is specified, 24MHz is used for clock source
bus
A
br_presdiv
Specify clock source prescaler divider
1 to 8 can be specified
7
A
br_propseg
Set propagation segment value
1 to 8 can be specified
5
A
br_pseg1
Set phase buffer segment 1 value
1 to 8 can be specified
5
A
br_pseg2
Set phase buffer segment 2 value
1 to 8 can be specified
8
A
br_rjw
Set resynchronization jump width
1 to 4 can be specified
3
A
bitrate
Displays transmission speed (bps)
Cannot be written to
500000
None
std_msg
Set whether or not to support standard format
1 for support, 0 for no support
1
A
ext_msg
Set whether or not to support extended format
1 for support, 0 for no support
1
A
maxmb
Set max message buffer number
2 to 64 can be specified
64
A
rx_maxmb
Set receive message buffer size
Send message buffer size is: maxmb - rx_maxmb
1 to maxmb - 1 can be specified
32
A
state
Display current status
Displayed with format: "interface status::error status"
Interface status is either "Start" (up) or "Stop" (down)
Error status is one of following: "normal", "error passive", "bus off"
Stop::normal
None
boff_rec
Set whether or not to recover from bus off automatically
0 to recover automatically, 1 to not recover
1
A
listen
Set whether or not to enable listen mode (receive only)
1 to enable listen mode, 0 to disable
0
A
loopback
Set whether or not to enable loopback mode
1 to enable loopback mode, 0 to disable
0
A
smp
Set sampling behavior
0 for determining received bit value from 1 sample
1 for determining received bit value by majority count from 3 samples
1
A
srx_dis
Set whether or not to receive sent frames
0 to receive sent frames, 1 to not receive
1
A
set_resframe
Set data frame to reply with after receiving remote frame
Set with format: "ID#DATA"
ID specified with 3 digit hex (standard format) or 8 digit hex value
Data specified as 0 to 8 groups of 2 digit hex values
Data can be separated by "."
None
B
del_resframe
Delete data frame set with set_resframe
Specify ID of data frame to delete with 3 digit hex (standard format) or 8 digit hex value
None
B
show_resframe
Display data frame set with set_resframe
Cannot be written to
None
C
wakeup
Set whether or not to enable CAN receive wakeup while suspended
1 to enable wakeup, 0 to disable
0
A
wak_src
Set whether or not to use low-pass filter while suspended
1 to enable filter, 0 to disable
0
A
-
Condition A: can be set when the network interface is in the off state (ifconfig canX off).
-
Condition B: can be set when the network interface is in the on state (ifconfig canX on).
-
Condition C: can be referenced when the network interface is in the on state (ifconfig canX on).
Transmission speed is determined by the following formula.
src_clk = 66,500,000 (br_clksrc = bus condition) src_clk = 24,000,000 (br_clksrc = osc condition) Transmission Speed[bps] = src_clk / br_presdiv / (1 + br_propseg + br_pseg1 + br_pseg2)
図8.2 CAN Transmission Speed Calculation
Kernel configuration options related to the CAN functionality are shown in 表8.23「CAN Configuration」.
表8.23 CAN Configuration
CAN
n
Enable Linux kernel CAN support
CAN_RAW
n
Enable RAW_CAN protocol support
CAN_BCM
n
Enable CAN_BCM protocol support
CAN_FLEXCAN
n
Enable the i.MX25 FlexCAN driver
ARMADILLO400_CAN2_CON14
n
Uses CON14 for CAN2
Uses CON14_3 for CAN2_TXCAN and CON14_4 for CAN2_RXCAN
8.19. Keypad
The i.MX25 processor includes a keypad controller. On the Armadillo-400 Series, the keypad can be assigned to CON11 by altering the kernel configuration. The keypad driver is not enabled by default.
Kernel configuration options related to the keypad functionality are shown in 表8.24「Keypad Configuration」.
表8.24 Keypad Configuration
INPUT
y
Enable Linux kernel input layer support
INPUT_EVDEV
y
Enable input layer event device support
KEYBOARD_MXC
n
Enable the i.MX25 keypad driver
ARMADILLO400_KEYPAD_CON11
n
Enable keypad on CON11
Please enable at least one COL and ROW each
ARMADILLO400_KEYPAD_ROW0_CON11_40
n
Uses CON11_40 as ROW0
ARMADILLO400_KEYPAD_ROW1_CON11_41
n
Uses CON11_41 as ROW1
ARMADILLO400_KEYPAD_ROW2_CON11_42
n
Uses CON11_42 as ROW2
ARMADILLO400_KEYPAD_ROW3_CON11_43
n
Uses CON11_43 as ROW3
ARMADILLO400_KEYPAD_COL0_CON11_44
n
Uses CON11_44 as COL0
ARMADILLO400_KEYPAD_COL1_CON11_45
n
Uses CON11_45 as COL1
ARMADILLO400_KEYPAD_COL2_CON11_46
n
Uses CON11_46 as COL2
ARMADILLO400_KEYPAD_COL3_CON11_47
n
Uses CON11_47 as COL3
ARMADILLO400_KEYPAD_ROW4_CON11_48
n
Uses CON11_48 as ROW4
ARMADILLO400_KEYPAD_ROW5_CON11_49
n
Uses CON11_49 as ROW5
To set what ROW and COL range is used for the keypad, specify the appropriate values in the armadillo440_keypad_data variable in linux-2.6.26-at/arch/arm/maxh-mx25/armadillo400.c. Specify the button to event key mappings in the armadillo440_keymapping variable.
8.20. Power Management
The Armadillo-400 Series support the Linux power management sleep functionality. In the sleep state, the execution of applications is paused and the kernel enters the suspend state. Power consumption is kept at a minimum during the sleep state as the operation of external devices is halted. When returning to the normal execution state from the sleep state, the kernel's resume logic is run and applications are returned to a running state.
Sleep mode can be entered by writing either "standby" or "mem" to the /sys/power/state
file. The system will return to the normal execution state from sleep mode when a wakeup interrupt occurs.
The differences in state of each mode are shown in 表8.25「Sleep Modes」. The suspend-to-RAM sleep mode provides for a greater reduction in power consumption compared to the power-on suspend mode.
表8.25 Sleep Modes
For devices that can be used as a basis for wakeups, whether or not they do trigger a wakeup can be specified with their power/wakeup
sysfs entry. Write "enabled" to the power/wakeup
file and the device will function as a basis for wakeups, and write "disabled" and they will not.
Please refer to 表8.26「Wakeup Basis Designation」 for details.
表8.26 Wakeup Basis Designation
8.20.1. Treatment of External Devices During Sleep
On the Armadillo-400 Series, the power supply to all external devices is halted as part of the suspend logic.
Because of this, USB devices must be put into a state where they can be safely disconnected before the system in put into the sleep state. That is, USB memory must be unmounted first. As the devices will be detected again when the system resumes, USB devices can be disconnected and reconnected while the system is in the sleep state.
As opposed to this, microSD cards can be left mounted when the system is put into the sleep state. In order for this to be possible, the SD host driver does not probe for cards at resume time, and instead assumes the same card is still inserted. Because of this, microSD cards cannot be removed or inserted when the system is in the sleep state.
For Ethernet devices, at resume time the same process is followed as when a cable is reconnected. Therefore, Auto-negotiation will take place at resume time if it is enabled.
By default, +3.3V_IO output is stopped when the system is put into the sleep state. However, if Serial Port 2 or Serial Port 4 are selected as a wakeup basis, the +3.3V_IO output will continue even during the sleep state.
[17] When DMA transfer is enabled. DMA is not enabled by default.
[18] Refer to linux-2.6.26-at/Documentation/i2c/writing-clients.
[19] Please do not use any file not described here as they are only provided for backwards compatibility.
第7章 Kernel and Userland Placement
PDF version 付録A Hermit-At Bootloader
- Preface
-
- Who Should Read This Document
- Document Structure
- Typographical Conventions
-
- Fonts
- Command Entry Examples
- Icons
- Acknowledgements
- Software Usage Precautions
- Trademarks
- System Overview
-
- Armadillo-400 Series Basic Specifications
- Basic Specifications of Armadillo-420 Basic Model
- Basic Specifications of Armadillo-440 LCD Model
- Memory Map
- Software Make-up
-
- Bootloader
- Kernel
- Userland
- Downloader
- Boot Modes
- Before Getting Started
-
- Preparation
- Connections
- Serial Console Software Configuration
- Development Environment Set-up
-
- Installing Cross Development Environment Packages
- Installing Packages Required for Atmark-Dist Builds
- Installing Cross Development Library Packages
- Rewriting Flash Memory
-
- Flash Memory Writing Regions
- Installing Downloader
-
- For Linux
- For Windows
- Rewriting Flash Memory With A Downloader
-
- Preparation
- For Linux
- For Windows
- Rewriting Flash Memory With tftpdl
- Rewriting Flash Memory With netflash
- Restoring Bootloader to Factory State
-
- Preparation
- For Linux
- For Windows
- Building
-
- Building Kernel and Userland Images
-
- Preparing Source Code
- Applying Default Configuration
- Building
- Customizing Images
- Adding An Application To The Userland Image
- Building Bootloader Images
-
- Preparing Source Code
- Building
- Kernel and Userland Placement
-
- Loading From A TFTP Server
-
- File Placement
- Boot Options
- Loading From Storage
-
- Partitioning
- Creating Filesystems
- Kernel Image Placement
- Creating A Root Filesystem
- Boot Device and Kernel Parameter Settings
- Return Settings To Defaults
- Linux Kernel Device Driver Specifications
-
- UART
- Ethernet
- SD/MMC/SDIO Host
- USB 2.0 Host
- Frame Buffer
- LED Backlight
- Touchscreen
- Audio
- GPIO
-
- GPIO sysfs
- Armadillo-200 Series Compatible GPIO Driver
- LED
-
- LED Class
- Armadillo-200 Series Compatible LED Driver
- Buttons
- Real-time Clock
- Watchdog Timer
- I2C
- SPI
- One Wire
- PWM
- CAN
- Keypad
- Power Management
-
- Treatment of External Devices During Sleep
© 2010 Atmark Techno, Inc.