Changeset 810 for trunk


Ignore:
Timestamp:
Sep 19, 2014, 2:53:18 PM (10 years ago)
Author:
cfuguet
Message:

giet_tsar: updating giet_tsar to use new hard_config format

Other optimizations:

  • Using a memory lock instead of the hard lock for the TTY
  • Each tty channel data is aligned to a cacheline (lock and buffers).
  • The applications' ldscript is generated from a template which includes the hard_config.h file.
Location:
trunk/softs
Files:
3 added
5 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/softs/giet_tsar/stdio.c

    r744 r810  
    7272#define in_drivers __attribute__((section (".drivers")))
    7373#define in_unckdata __attribute__((section (".unckdata")))
     74#define cacheline_aligned __attribute__((aligned(64)))
    7475
    7576//////////////////////////////////////////////////////////////
     
    9293static in_unckdata int volatile  _ioc_status;
    9394
    94 static in_unckdata char volatile _tty_get_buf[NB_TTY_CHANNELS];
    95 static in_unckdata int volatile  _tty_get_full[NB_TTY_CHANNELS] = { [0 ... NB_TTY_CHANNELS-1] = 0 };
     95static volatile in_unckdata struct cacheline_aligned {
     96    int  lock;
     97    int  get_full;
     98    char get_buf;
     99    char __padding[55];
     100} _tty_channel[NB_TTY_CHANNELS];
    96101
    97102////////////////////////////////////////////////////////////////////////////////////////
     
    141146in_drivers void  _extended_memcpy( unsigned int dst_cluster,
    142147                                   unsigned int dst_address,
     148                                   unsigned int src_cluster,
    143149                                   unsigned int src_address,
    144150                                   unsigned int length )
     
    157163    for ( i = 0 ; i < length ; i = i+4 )
    158164    {
    159         word = _word_extended_read( src_cluster, (src_address + i) );
    160         _word_extended_write( dst_cluster, (dst_address + i), word );
     165        word = _word_extended_read( src_cluster, src_address + i );
     166        _word_extended_write( dst_cluster, dst_address + i, word );
    161167    }
    162168}
     
    545551in_drivers void _tty_get_lock( unsigned int channel )
    546552{
    547     unsigned int base = (unsigned int)&seg_tty_base;
    548     unsigned int offset = (TTY_CONFIG + channel*TTY_SPAN) << 2;
    549     while ( _word_extended_read( CLUSTER_IO, base + offset ) );
     553    register unsigned int* plock = (unsigned int*)&_tty_channel[channel].lock;
     554
     555    asm volatile (
     556            "1:                         \n"
     557            "ll     $2,     0(%0)       \n" // $2 <= _tty_lock
     558            "bnez   $2,     1b          \n" // retry  if busy
     559            "li     $3,     1           \n" // prepare argument for sc
     560            "sc     $3,     0(%0)       \n" // try to set _tty_busy
     561            "beqz   $3,     1b          \n" // retry if not atomic
     562            ::"r"(plock) :"$2","$3");
    550563}
    551564
     
    556569in_drivers void _tty_release_lock( unsigned int channel )
    557570{
    558     unsigned int base    = (unsigned int)&seg_tty_base;
    559     unsigned int offset  = (TTY_CONFIG + channel*TTY_SPAN) << 2;
    560     _word_extended_write( CLUSTER_IO, base + offset, 0 );
     571    _tty_channel[channel].lock = 0;
    561572}
    562573
     
    813824    unsigned int offset = (index*TTY_SPAN + TTY_READ) << 2;
    814825
    815     _tty_get_buf[index] = _byte_extended_read(CLUSTER_IO, base + offset);
    816     _tty_get_full[index] = 1;               // signals character available
     826    _tty_channel[index].get_buf = _byte_extended_read(CLUSTER_IO, base + offset);
     827    _tty_channel[index].get_full = 1;               // signals character available
    817828}
    818829
     
    872883// reset the _ioc_done variable to zero, and releases the _ioc_lock variable.
    873884///////////////////////////////////////////////////////////////////////////////////////
    874 //  If USE_RAMDISK is set, we access a "virtual" block device controler implemented
     885//  If USE_IOC_RDK is set, we access a "virtual" block device controler implemented
    875886//  as a memory-mapped segment in cluster [0,0] at address seg_ramdisk_base.
    876887//  The tranfer being fully synchronous, the IOC interrupt is not activated.
     
    910921    _ioc_get_lock();
    911922
    912     if ( USE_RAMDISK )  // we use an extended_memcpy
     923    if ( USE_IOC_RDK )  // we use an extended_memcpy
    913924    {
    914925        unsigned int  src_address = (unsigned int)buffer;
     
    953964    _ioc_get_lock();
    954965
    955     if ( USE_RAMDISK )  // we use an extended_memcpy
     966    if ( USE_IOC_RDK )  // we use an extended_memcpy
    956967    {
    957968        unsigned int  dst_address = (unsigned int)buffer;
  • trunk/softs/soft_hello_giet/Makefile

    r623 r810  
    44DU = mipsel-unknown-elf-objdump
    55
    6 OBJS =   reset.o \
    7          giet.o \
    8          stdio.o \
    9          main.o
     6OBJS = reset.o \
     7       giet.o \
     8       stdio.o \
     9       main.o
    1010
    11 CFLAGS = -Wall -mno-gpopt -ffreestanding -fomit-frame-pointer -mips32 -ggdb
     11CFLAGS = -Wall -mno-gpopt -ffreestanding -fomit-frame-pointer -mips32
    1212
    1313GIET =  ../giet_tsar
    1414
    15 bin.soft: $(OBJS) ldscript
    16         $(LD) -o $@ -T ldscript $(OBJS)
     15bin.soft: $(OBJS) giet.ld
     16        $(LD) -o $@ -T giet.ld $(OBJS)
    1717        $(DU) -D $@ > $@.txt
    1818
     
    3333        $(DU) -D $@ > $@.txt
    3434
     35giet.ld: giet.ld.in
     36        $(CC) -x c -P -E -I. $< -o $@
     37
    3538clean:
    36         rm -f *.o bin.soft *.txt core term* temp
     39        rm -f *.o bin.soft *.txt core term* temp giet.ld
  • trunk/softs/soft_sort_giet/Makefile

    r744 r810  
    1313GIET =  ../giet_tsar
    1414
    15 bin.soft: $(OBJS) ldscript
    16         $(LD) -o $@ -T ldscript $(OBJS)
     15bin.soft: $(OBJS) giet.ld
     16        $(LD) -o $@ -T giet.ld $(OBJS)
    1717        $(DU) -D $@ > $@.txt
    1818
     
    3333        $(DU) -D $@ > $@.txt
    3434
     35giet.ld: giet.ld.in
     36        $(CC) -x c -P -E -I. $< -o $@
     37
    3538clean:
    36         rm -f *.o bin.soft *.txt core term* temp
     39        rm -f *.o bin.soft *.txt core term* temp giet.ld
  • trunk/softs/soft_transpose_giet/Makefile

    r744 r810  
    99       main.o
    1010
    11 CFLAGS = -Wall -mno-gpopt -ffreestanding -fomit-frame-pointer -mips32 \
    12          -msoft-float -O2 \
    13          # -ggdb -mlong-calls
     11CFLAGS = -Wall -mno-gpopt -ffreestanding -fomit-frame-pointer -mips32
    1412
    1513GIET =  ../giet_tsar
    1614
    17 bin.soft: $(OBJS) ldscript
    18         $(LD) -o $@ -T ldscript $(OBJS)
     15bin.soft: $(OBJS) giet.ld
     16        $(LD) -o $@ -T giet.ld $(OBJS)
    1917        $(DU) -D $@ > $@.txt
    2018
    2119reset.o: $(GIET)/reset.S hard_config.h
    22         $(CC) -I. -I$(GIET) $(CFLAGS) -c -o $@ $<
     20        $(CC) -I. $(CFLAGS) -c -o $@ $<
    2321        $(DU) -D $@ > $@.txt
    2422
     
    3533        $(DU) -D $@ > $@.txt
    3634
     35giet.ld: giet.ld.in
     36        $(CC) -x c -P -E -I. $< -o $@
     37
    3738clean:
    38         rm -f *.o bin.soft *.txt core term* temp
     39        rm -f *.o bin.soft *.txt core term* temp giet.ld
  • trunk/softs/soft_transpose_giet/hard_config.h

    r744 r810  
    1 /*******************************************************************/
    2 /* This file define various hardware parameters that are used by   */
    3 /* both the giet_tsar OS and by the hardware (top.cpp file)        */
    4 /*******************************************************************/
     1/* Generated by genmap for tsar_iob_2_2_4 */
    52
    6 #ifndef _HARD_CONFIG_H
    7 #define _HARD_CONFIG_H
     3#ifndef HARD_CONFIG_H
     4#define HARD_CONFIG_H
    85
    9 #define  X_SIZE              6
    10 #define  Y_SIZE              6
    11 #define  X_WIDTH             4
    12 #define  Y_WIDTH             4
    13 #define  X_IO                0//(X_SIZE - 1)
    14 #define  Y_IO                0//(Y_SIZE - 1)
     6/* General platform parameters */
    157
    16 #define  NB_PROCS_MAX        4
     8#define X_SIZE                 2
     9#define Y_SIZE                 2
     10#define X_WIDTH                4
     11#define Y_WIDTH                4
     12#define P_WIDTH                2
     13#define X_IO                   0
     14#define Y_IO                   0
     15#define NB_PROCS_MAX           4
     16#define IRQ_PER_PROCESSOR      4
     17#define RESET_ADDRESS          0xbfc00000
     18#define NB_TOTAL_PROCS         16
    1719
    18 #define  USE_RAMDISK         0
    19 #define  USE_PIC             1
     20/* Peripherals */
    2021
    21 #define  NB_DMA_CHANNELS     0
    22 #define  NB_HBA_CHANNELS     0
    23 #define  NB_NIC_CHANNELS     0
    24 #define  NB_CMA_CHANNELS     0
    25 #define  NB_TTY_CHANNELS     1
     22#define NB_TTY_CHANNELS        1
     23#define NB_IOC_CHANNELS        1
     24#define NB_NIC_CHANNELS        2
     25#define NB_CMA_CHANNELS        4
     26#define NB_TIM_CHANNELS        0
     27#define NB_DMA_CHANNELS        4
    2628
    27 #endif //_HARD_CONFIG_H
     29#define USE_XCU                1
     30#define USE_IOB                1
     31#define USE_PIC                1
     32#define USE_FBF                1
     33
     34#define USE_IOC_BDV            1
     35#define USE_IOC_SPI            0
     36#define USE_IOC_HBA            0
     37#define USE_IOC_RDK            0
     38
     39#define FBUF_X_SIZE            128
     40#define FBUF_Y_SIZE            128
     41
     42#define XCU_NB_INPUTS          16
     43
     44/* base addresses and sizes for physical segments */
     45
     46#define SEG_RAM_BASE           0x0
     47#define SEG_RAM_SIZE           0x40000
     48
     49#define SEG_CMA_BASE           0xb6000000
     50#define SEG_CMA_SIZE           0x4000
     51
     52#define SEG_DMA_BASE           0xb1000000
     53#define SEG_DMA_SIZE           0x4000
     54
     55#define SEG_FBF_BASE           0xb7000000
     56#define SEG_FBF_SIZE           0x4000
     57
     58#define SEG_ICU_BASE           0xffffffff
     59#define SEG_ICU_SIZE           0x0
     60
     61#define SEG_IOB_BASE           0xbe000000
     62#define SEG_IOB_SIZE           0x1000
     63
     64#define SEG_IOC_BASE           0xb3000000
     65#define SEG_IOC_SIZE           0x1000
     66
     67#define SEG_MMC_BASE           0xb2000000
     68#define SEG_MMC_SIZE           0x1000
     69
     70#define SEG_MWR_BASE           0xffffffff
     71#define SEG_MWR_SIZE           0x0
     72
     73#define SEG_ROM_BASE           0xbfc00000
     74#define SEG_ROM_SIZE           0x8000
     75
     76#define SEG_SIM_BASE           0xb9000000
     77#define SEG_SIM_SIZE           0x1000
     78
     79#define SEG_NIC_BASE           0xb5000000
     80#define SEG_NIC_SIZE           0x80000
     81
     82#define SEG_PIC_BASE           0xb8000000
     83#define SEG_PIC_SIZE           0x1000
     84
     85#define SEG_TIM_BASE           0xffffffff
     86#define SEG_TIM_SIZE           0x0
     87
     88#define SEG_TTY_BASE           0xb4000000
     89#define SEG_TTY_SIZE           0x4000
     90
     91#define SEG_XCU_BASE           0xb0000000
     92#define SEG_XCU_SIZE           0x1000
     93
     94#define SEG_RDK_BASE           0xffffffff
     95#define SEG_RDK_SIZE           0x0
     96
     97#define PERI_CLUSTER_INCREMENT 0x10000
     98
     99/* physical base addresses for identity mapped vsegs */
     100/* used by the GietVM OS                             */
     101
     102#define SEG_BOOT_MAPPING_BASE  0x0
     103#define SEG_BOOT_MAPPING_SIZE  0x80000
     104
     105#define SEG_BOOT_CODE_BASE     0x80000
     106#define SEG_BOOT_CODE_SIZE     0x40000
     107
     108#define SEG_BOOT_DATA_BASE     0xc0000
     109#define SEG_BOOT_DATA_SIZE     0x80000
     110
     111#define SEG_BOOT_STACK_BASE    0x140000
     112#define SEG_BOOT_STACK_SIZE    0x50000
     113#endif
Note: See TracChangeset for help on using the changeset viewer.