Ignore:
Timestamp:
May 27, 2014, 4:43:09 PM (11 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/include
Files:
2 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{
Note: See TracChangeset for help on using the changeset viewer.