source: branches/v4/softs/tsar_boot/include/io.h @ 732

Last change on this file since 732 was 292, checked in by cfuguet, 12 years ago

Changing directory structure of the TSAR boot loader.
A README.txt file has been included to explain the new structure
and the MAKEFILE parameters.

Erasing the heap segment for the boot elf loader. All the work space
is allocated in the stack.

The stack size is defined in the include/defs.h.

Important modification in the reset.S file. The non-boot
processors (processor id != 0) wait in a low comsumption energy
mode to be wake up by processor 0 using an IPI. Each processor
has a private mailbox in the local XICU. The value written in
the mailbox will be used as address to jump by the processors.

The waking up of non-boot processors is not done in this boot loader
so it must be done in the application loaded.

The boot_loader_elf function loads into memory an executable .elf file
which must be placed in the BOOT_LOADER_LBA block of the disk. This
constant can be defined in the include/defs.h file.

File size: 1.2 KB
Line 
1/**
2 * \file        io.h
3 * \date        5 September 2012
4 * \author      Cesar Fuguet
5 *
6 * Utility functions to write or read memory mapped hardware registers
7 */
8#ifndef IO_H
9#define IO_H
10
11/**
12 * Read an 32 bits memory mapped hardware register
13 */
14static inline unsigned int ioread32(void * addr)
15{
16        return *(volatile unsigned int *) addr;
17}
18
19/**
20 * Read an 16 bits memory mapped hardware register
21 */
22static inline unsigned short ioread16(void * addr)
23{
24        return *(volatile unsigned short *) addr;
25}
26
27/**
28 * Read an 8 bits memory mapped hardware register
29 */
30static inline unsigned char ioread8(void * addr)
31{
32        return *(volatile unsigned char *) addr;
33}
34
35/**
36 * Write an 32 bits memory mapped hardware register
37 */
38static inline void iowrite32(void * addr, unsigned int value)
39{
40        *(volatile unsigned int *) addr = value;
41        asm volatile("sync");
42}
43
44/**
45 * Write an 16 bits memory mapped hardware register
46 */
47static inline void iowrite16(void * addr, unsigned short value)
48{
49        *(volatile unsigned short *) addr = value;
50        asm volatile("sync");
51}
52
53/**
54 * Write an 8 bits memory mapped hardware register
55 */
56static inline void iowrite8(void * addr, unsigned char value)
57{
58        *(volatile unsigned char *) addr = value;
59        asm volatile("sync");
60}
61
62#undef in_reset
63
64#endif
Note: See TracBrowser for help on using the repository browser.