Accessing Internal Ts-7400 Registers From Linux Userspace; Changing/Updating The Ts-Bootrom - Technologic Systems TS-7400 Hardware & Software Installation

Table of Contents

Advertisement

3.4 Accessing internal TS-7400 registers from Linux userspace

Linux applications run in a protected and separate environment where they can do no
damage to either the kernel or other applications running simultaneously. This protected
environment does not allow arbitrary manipulation of hardware registers by default.
Applications may be allowed temporary access through memory space windows granted
by the mmap() system call applied to the /dev/mem device node. For instance, to set up
access to the GPIO registers at 0x12c00000, the following snippet of C code is provided
as an example:
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
{
int fd = open("/dev/mem", O_RDWR|O_SYNC);
char *gpioregs;
gpioregs = (char *)mmap(0, 4096, PROT_READ|PROT_WRITE,
MAP_SHARED, fd, 0x12c00000);
gpioregs[0] = 0xff; //data direction register set all outputs */
gpioregs[2] = 0x12; //output high to DIO_01 & DIO_4, all else low
}
Some notes about the preceding code:
Make sure to open using O_SYNC, otherwise you may get a cachable MMU mapping
which unless you know what you're doing, probably is not what you want when dealing
with hardware registers.
mmap() must be called only on pagesize (4096 byte) boundaries and size must at least
have pagesize granularity.
mmap() of /dev/mem is only allowed for processes with UID 0 (root)
More information on mmap() and open() system calls can be had by running "man
mmap" or "man open" from most any Linux shell prompt.
When working with char * types to registers, make sure to compile with the "-
mcpu=arm9" option otherwise the wrong ARM opcodes will be used and your byte
reads/writes may be turned into 32-bit reads and writes.

3.5 Changing/Updating the TS-BOOTROM

Normally, the TS-7400 boot firmware is loaded with the TS-FLASHBOOT bootup program.
This program bootstraps the CPU by loading the first 512 bytes from the NAND flash and
jumping into it. This program then loads the kernel and initrd from the NAND flash. Once
the kernel has booted and mounted the initrd, it can "pivot_root" and give the illusion it
actually booted directly from SD, NAND, NFS, etc file systems. Should you wish to
actually load the kernel and fastboot initrd from an SD card, the TS-FLASHBOOT bootup
program must be replaced with TS-SDBOOT. This can be done with the "tsbootrom-
update" program.
© May, 2010
TS-7400/TS-9441 MANUAL
www.embeddedARM.com
SOFTWARE
17

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ts-9441

Table of Contents