Changeset 704
- Timestamp:
- May 27, 2014, 4:43:09 PM (11 years ago)
- Location:
- trunk/softs/tsar_boot
- Files:
-
- 4 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 { -
trunk/softs/tsar_boot/src/reset.S
r694 r704 12 12 * by the seg_reset_stack_base parameters in ldscript, of size 0x10000 (64k) 13 13 * - Processor 0 uses a larger stack: 64 Kbytes. 14 * - Other processors use a smaller stack: 512 bytes. 15 * => the stack size cannot be smaller than 0x90000 bytes (576 K). 14 * - Other processors use a smaller stack: 256 bytes. 15 * => the seg_stack_size cannot be smaller than 0x50000 bytes (320 Kytes). 16 * (64K + 1024 * 256 = 320 Kbytes) 16 17 * Those stacks can be used by both the preloader and the boot-loader code. 17 18 * -
trunk/softs/tsar_boot/src/reset_tty.c
r586 r704 1 /******************************************************************** 2 * \file reset_tty.c 3 * \date 5 mars 2014 4 * \author Cesar Fuguet 5 * 6 * Minimal driver for TTY controler 7 *******************************************************************/ 8 1 9 #include <reset_tty.h> 2 10 #include <io.h> … … 7 15 { 8 16 unsigned int* tty_address = (unsigned int*) TTY_PADDR_BASE; 9 if (ioread32(&tty_address[TTY_STATUS]) == 0)10 return 0;11 17 12 *c = ioread32(&tty_address[TTY_READ]); 18 if (ioread32( &tty_address[TTY_STATUS] ) == 0) return 0; 19 *c = ioread32( &tty_address[TTY_READ] ); 13 20 return 1; 14 21 } … … 18 25 { 19 26 unsigned int* tty_address = (unsigned int*) TTY_PADDR_BASE; 20 iowrite32(&tty_address[TTY_WRITE], (unsigned int)c);21 27 22 if (c == '\n') 23 { 24 iowrite32(&tty_address[TTY_WRITE], (unsigned int)'\r'); 25 } 28 iowrite32( &tty_address[TTY_WRITE], (unsigned int)c ); 29 if (c == '\n') reset_putc( '\r' ); 26 30 } 27 31 … … 34 38 { 35 39 if (buffer[n] == 0) break; 36 37 40 reset_putc(buffer[n]); 38 41 }
Note: See TracChangeset
for help on using the changeset viewer.