source: soft/giet_vm/giet_common/io.h @ 295

Last change on this file since 295 was 289, checked in by cfuguet, 10 years ago

Modifications on GIET-VM IOC driver:

  • Introducing new layer on the IOC driver. Every call to ioc_read, ioc_write, ioc_get_block_size or ioc_init

functions will call the specific driver of the used IOC
controller. Supported IOC controllers are (for now) :

  1. BDV (Soclib Block Device)
  2. HBA
  3. SPI (SDCARD - SPI controller)
  • All functions of IOC controllers drivers respect the same interface.
  • To specify the used IOC controller of the platform, a subtype field has been introduced on the map.xml file. This subtype field must be declared on the IOC periph instantiation. Available subtypes (for now) : BDV, HBA or SPI.
File size: 2.4 KB
Line 
1///////////////////////////////////////////////////////////////////////////////////
2// File     : io.h
3// Date     : 05/09/2012
4// Author   : cesar fuguet
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////////
7// Utility functions to write or read memory mapped hardware registers
8///////////////////////////////////////////////////////////////////////////////////
9#ifndef IO_H
10#define IO_H
11
12///////////////////////////////////////////////////////////////////////////////////
13// Read an 32 bits memory mapped hardware register
14///////////////////////////////////////////////////////////////////////////////////
15static inline unsigned int ioread32(void * addr)
16{
17        return *(volatile unsigned int *) addr;
18}
19
20///////////////////////////////////////////////////////////////////////////////////
21// Read an 16 bits memory mapped hardware register
22///////////////////////////////////////////////////////////////////////////////////
23static inline unsigned short ioread16(void * addr)
24{
25        return *(volatile unsigned short *) addr;
26}
27
28///////////////////////////////////////////////////////////////////////////////////
29// Read an 8 bits memory mapped hardware register
30///////////////////////////////////////////////////////////////////////////////////
31static inline unsigned char ioread8(void * addr)
32{
33        return *(volatile unsigned char *) addr;
34}
35
36///////////////////////////////////////////////////////////////////////////////////
37// Write an 32 bits memory mapped hardware register
38///////////////////////////////////////////////////////////////////////////////////
39static inline void iowrite32(void * addr, unsigned int value)
40{
41        *(volatile unsigned int *) addr = value;
42        asm volatile("sync");
43}
44
45///////////////////////////////////////////////////////////////////////////////////
46// Write an 16 bits memory mapped hardware register
47///////////////////////////////////////////////////////////////////////////////////
48static inline void iowrite16(void * addr, unsigned short value)
49{
50        *(volatile unsigned short *) addr = value;
51        asm volatile("sync");
52}
53
54///////////////////////////////////////////////////////////////////////////////////
55// Write an 8 bits memory mapped hardware register
56///////////////////////////////////////////////////////////////////////////////////
57static inline void iowrite8(void * addr, unsigned char value)
58{
59        *(volatile unsigned char *) addr = value;
60        asm volatile("sync");
61}
62
63#undef in_reset
64
65#endif
Note: See TracBrowser for help on using the repository browser.