Changeset 704 for trunk/softs/tsar_boot/include
- Timestamp:
- May 27, 2014, 4:43:09 PM (11 years ago)
- Location:
- trunk/softs/tsar_boot/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/softs/tsar_boot/include/defs.h
r701 r704 3 3 #define RESET_VERSION 0x00010002 4 4 5 #define RESET_STACKS_SIZE 0x11000 /* 64 bytes * 1024 + 4 Kbytes (for P0) = 68 Kbytes */6 5 #define BOOT_LOADER_LBA 2 7 6 #define PHDR_ARRAY_SIZE 16 -
trunk/softs/tsar_boot/include/io.h
r655 r704 1 /** 1 /********************************************************************** 2 2 * \file io.h 3 3 * \date 5 September 2012 4 * \author Cesar Fuguet 4 * \author Cesar Fuguet / Alain Greiner 5 5 * 6 6 * Utility functions to write or read memory mapped hardware registers 7 */ 7 *********************************************************************/ 8 8 9 #ifndef IO_H 9 10 #define IO_H 10 11 11 /** 12 #include <defs.h> 13 14 /********************************************************************** 12 15 * Read an 32 bits memory mapped hardware register 13 */ 16 * with physical address extension to access cluster_io 17 *********************************************************************/ 14 18 static inline unsigned int ioread32(void * addr) 15 19 { 16 return *(volatile unsigned int *) addr; 20 unsigned int value; 21 unsigned int ext = CLUSTER_IO; 22 23 asm volatile( 24 "mtc2 %2, $24 \n" /* PADDR_EXT <= cluster_io */ 25 "lw %0, 0(%1) \n" /* value <= *(ext\addr) */ 26 "mtc2 $0, $24 \n" /* PADDR_EXT <= 0 */ 27 : "=r" (value) 28 : "r" (addr), "r" (ext) ); 29 30 return value; 17 31 } 18 32 19 /** 33 /********************************************************************** 20 34 * Read an 16 bits memory mapped hardware register 21 * /35 *********************************************************************/ 22 36 static inline unsigned short ioread16(void * addr) 23 37 { … … 25 39 } 26 40 27 /** 41 /********************************************************************** 28 42 * Read an 8 bits memory mapped hardware register 29 * /43 *********************************************************************/ 30 44 static inline unsigned char ioread8(void * addr) 31 45 { … … 33 47 } 34 48 35 /** 49 /********************************************************************** 36 50 * Write an 32 bits memory mapped hardware register 37 */ 51 * with physical address extension to access cluster_io 52 *********************************************************************/ 38 53 static inline void iowrite32(void * addr, unsigned int value) 39 54 { 40 *(volatile unsigned int *) addr = value; 41 asm volatile("sync" ::: "memory"); 55 unsigned int ext = CLUSTER_IO; 56 57 asm volatile( 58 "mtc2 %2, $24 \n" /* PADDR_EXT <= cluster_io */ 59 "sw %0, 0(%1) \n" /* *(ext\addr) <= value */ 60 "mtc2 $0, $24 \n" /* PADDR_EXT <= 0 */ 61 "sync \n" /* sync barrier */ 62 : 63 : "r" (value), "r" (addr), "r" (ext) ); 42 64 } 43 65 44 /** 66 /********************************************************************** 45 67 * Write an 16 bits memory mapped hardware register 46 * /68 *********************************************************************/ 47 69 static inline void iowrite16(void * addr, unsigned short value) 48 70 { … … 51 73 } 52 74 53 /** 75 /********************************************************************** 54 76 * Write an 8 bits memory mapped hardware register 55 * /77 *********************************************************************/ 56 78 static inline void iowrite8(void * addr, unsigned char value) 57 79 {
Note: See TracChangeset
for help on using the changeset viewer.