Changeset 704 for trunk/softs


Ignore:
Timestamp:
May 27, 2014, 4:43:09 PM (10 years ago)
Author:
alain
Message:

tsar_boot:

  • Erasing unused constant in defs.h
  • Modofication in IO access functions to allow addressing in clusters using physical address extension
Location:
trunk/softs/tsar_boot
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/softs/tsar_boot/include/defs.h

    r701 r704  
    33#define RESET_VERSION       0x00010002
    44
    5 #define RESET_STACKS_SIZE   0x11000  /* 64 bytes * 1024 + 4 Kbytes (for P0) = 68 Kbytes */
    65#define BOOT_LOADER_LBA     2
    76#define PHDR_ARRAY_SIZE     16
  • trunk/softs/tsar_boot/include/io.h

    r655 r704  
    1 /**
     1/**********************************************************************
    22 * \file        io.h
    33 * \date        5 September 2012
    4  * \author      Cesar Fuguet
     4 * \author      Cesar Fuguet / Alain Greiner
    55 *
    66 * Utility functions to write or read memory mapped hardware registers
    7  */
     7 *********************************************************************/
     8
    89#ifndef IO_H
    910#define IO_H
    1011
    11 /**
     12#include <defs.h>
     13
     14/**********************************************************************
    1215 * Read an 32 bits memory mapped hardware register
    13  */
     16 * with physical address extension to access cluster_io
     17 *********************************************************************/
    1418static inline unsigned int ioread32(void * addr)
    1519{
    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;
    1731}
    1832
    19 /**
     33/**********************************************************************
    2034 * Read an 16 bits memory mapped hardware register
    21  */
     35 *********************************************************************/
    2236static inline unsigned short ioread16(void * addr)
    2337{
     
    2539}
    2640
    27 /**
     41/**********************************************************************
    2842 * Read an 8 bits memory mapped hardware register
    29  */
     43 *********************************************************************/
    3044static inline unsigned char ioread8(void * addr)
    3145{
     
    3347}
    3448
    35 /**
     49/**********************************************************************
    3650 * Write an 32 bits memory mapped hardware register
    37  */
     51 * with physical address extension to access cluster_io
     52 *********************************************************************/
    3853static inline void iowrite32(void * addr, unsigned int value)
    3954{
    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) );
    4264}
    4365
    44 /**
     66/**********************************************************************
    4567 * Write an 16 bits memory mapped hardware register
    46  */
     68 *********************************************************************/
    4769static inline void iowrite16(void * addr, unsigned short value)
    4870{
     
    5173}
    5274
    53 /**
     75/**********************************************************************
    5476 * Write an 8 bits memory mapped hardware register
    55  */
     77 *********************************************************************/
    5678static inline void iowrite8(void * addr, unsigned char value)
    5779{
  • trunk/softs/tsar_boot/src/reset.S

    r694 r704  
    1212 * by the seg_reset_stack_base parameters in ldscript, of size 0x10000 (64k)
    1313 * - 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)
    1617 * Those stacks can be used by both the preloader and the boot-loader code.
    1718 *
  • 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
    19#include <reset_tty.h>
    210#include <io.h>
     
    715{
    816    unsigned int* tty_address = (unsigned int*) TTY_PADDR_BASE;
    9     if (ioread32(&tty_address[TTY_STATUS]) == 0)
    10         return 0;
    1117
    12     *c = ioread32(&tty_address[TTY_READ]);
     18    if (ioread32( &tty_address[TTY_STATUS] ) == 0) return 0;
     19    *c = ioread32( &tty_address[TTY_READ] );
    1320    return 1;
    1421}
     
    1825{
    1926    unsigned int* tty_address = (unsigned int*) TTY_PADDR_BASE;
    20     iowrite32(&tty_address[TTY_WRITE], (unsigned int)c);
    2127
    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' );
    2630}
    2731
     
    3438    {
    3539        if (buffer[n] == 0) break;
    36 
    3740        reset_putc(buffer[n]);
    3841    }
Note: See TracChangeset for help on using the changeset viewer.