Changeset 226d48d8 in rtems


Ignore:
Timestamp:
May 16, 2012, 3:20:35 PM (8 years ago)
Author:
Daniel Hellstrom <daniel@…>
Branches:
4.11, master
Children:
13647019
Parents:
ca764e6
git-author:
Daniel Hellstrom <daniel@…> (05/16/12 15:20:35)
git-committer:
Gedare Bloom <gedare@…> (05/16/12 17:29:13)
Message:

LEON: moved register definitions into grlib header file

Some register layout definitions for LEON3 reside in ambapp.h which
does not really has anything to do with device registers. The
register structures has been incorrectly named LEON3_*, the cores
are not only used on LEON3 but on LEON4 and perhaps on LEON5 when
that day comes. Some structures has been renamed according to the
GRLIB core name instead, which CPU that actually use it is not
relevant. Drivers has been updated with the new names.

Signed-off-by: Daniel Hellstrom <daniel@…>

Location:
c/src/lib/libbsp/sparc
Files:
1 added
20 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/Makefile.am

    rca764e6 r226d48d8  
    1515EXTRA_DIST += shared/include/ambapp.h
    1616EXTRA_DIST += shared/include/ambapp_ids.h
     17EXTRA_DIST += shared/include/grlib.h
    1718EXTRA_DIST += shared/amba/ambapp.c
    1819EXTRA_DIST += shared/amba/ambapp_alloc.c
  • c/src/lib/libbsp/sparc/leon2/Makefile.am

    rca764e6 r226d48d8  
    7979include_HEADERS += ../../sparc/shared/include/ambapp.h
    8080include_HEADERS += ../../sparc/shared/include/ambapp_ids.h
     81include_HEADERS += ../../sparc/shared/include/grlib.h
    8182libbsp_a_SOURCES += ../../sparc/shared/amba/ambapp.c
    8283libbsp_a_SOURCES += ../../sparc/shared/amba/ambapp_alloc.c
  • c/src/lib/libbsp/sparc/leon2/preinstall.am

    rca764e6 r226d48d8  
    162162PREINSTALL_FILES += $(PROJECT_INCLUDE)/ambapp_ids.h
    163163
     164$(PROJECT_INCLUDE)/grlib.h: ../../sparc/shared/include/grlib.h $(PROJECT_INCLUDE)/$(dirstamp)
     165        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/grlib.h
     166PREINSTALL_FILES += $(PROJECT_INCLUDE)/grlib.h
     167
    164168$(PROJECT_INCLUDE)/i2cmst.h: ../../sparc/shared/include/i2cmst.h $(PROJECT_INCLUDE)/$(dirstamp)
    165169        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/i2cmst.h
  • c/src/lib/libbsp/sparc/leon2/rasta/rasta.c

    rca764e6 r226d48d8  
    1111#include <rasta.h>
    1212#include <ambapp.h>
     13#include <grlib.h>
    1314#include <grcan_rasta.h>
    1415#include <grspw_rasta.h>
     
    4243#endif
    4344
    44 /*
    45 typedef struct {
    46   volatile unsigned int ilevel;
    47   volatile unsigned int ipend;
    48   volatile unsigned int iforce;
    49   volatile unsigned int iclear;
    50   volatile unsigned int mpstat;
    51   volatile unsigned int notused01;
    52   volatile unsigned int notused02;
    53   volatile unsigned int notused03;
    54   volatile unsigned int notused10;
    55   volatile unsigned int notused11;
    56   volatile unsigned int notused12;
    57   volatile unsigned int notused13;
    58   volatile unsigned int notused20;
    59   volatile unsigned int notused21;
    60   volatile unsigned int notused22;
    61   volatile unsigned int notused23;
    62   volatile unsigned int mask[16];
    63   volatile unsigned int force[16];
    64 } LEON3_IrqCtrl_Regs_Map;
    65 */
    6645static int bus, dev, fun;
    6746
    68 LEON3_IrqCtrl_Regs_Map *irq = NULL;
    69 LEON_Register_Map      *regs = (LEON_Register_Map *)0x80000000;
     47struct irqmp_regs *irq = NULL;
     48LEON_Register_Map *regs = (LEON_Register_Map *)0x80000000;
    7049
    7150struct gpio_reg *gpio0, *gpio1;
     
    292271#endif
    293272    /* Set up rasta irq controller */
    294     irq = (LEON3_IrqCtrl_Regs_Map *) (bar0+IRQ_OFFSET);
     273    irq = (struct irqmp_regs *) (bar0+IRQ_OFFSET);
    295274    irq->iclear = 0xffff;
    296275    irq->ilevel = 0;
  • c/src/lib/libbsp/sparc/leon3/Makefile.am

    rca764e6 r226d48d8  
    4545include_HEADERS += ../../sparc/shared/include/ambapp.h
    4646include_HEADERS += ../../sparc/shared/include/ambapp_ids.h
     47include_HEADERS += ../../sparc/shared/include/grlib.h
    4748libbsp_a_SOURCES += amba/amba.c
    4849libbsp_a_SOURCES += ../../sparc/shared/amba/ambapp.c
  • c/src/lib/libbsp/sparc/leon3/amba/amba.c

    rca764e6 r226d48d8  
    2626
    2727/* Pointers to Interrupt Controller configuration registers */
    28 volatile LEON3_IrqCtrl_Regs_Map *LEON3_IrqCtrl_Regs;
     28volatile struct irqmp_regs *LEON3_IrqCtrl_Regs;
    2929
    3030/*
     
    6262  }
    6363
    64   LEON3_IrqCtrl_Regs = (volatile LEON3_IrqCtrl_Regs_Map *)
    65                        DEV_TO_APB(adev)->start;
     64  LEON3_IrqCtrl_Regs = (volatile struct irqmp_regs *)DEV_TO_APB(adev)->start;
    6665  if ((LEON3_IrqCtrl_Regs->ampctrl >> 28) > 0) {
    6766    /* IRQ Controller has support for multiple IRQ Controllers, each
     
    8685                                 ambapp_find_by_idx, NULL);
    8786  if (adev) {
    88     LEON3_Timer_Regs = (volatile LEON3_Timer_Regs_Map *)DEV_TO_APB(adev)->start;
     87    LEON3_Timer_Regs = (volatile struct gptimer_regs *)DEV_TO_APB(adev)->start;
    8988
    9089    /* Register AMBA Bus Frequency */
  • c/src/lib/libbsp/sparc/leon3/clock/ckinit.c

    rca764e6 r226d48d8  
    3939
    4040
    41 volatile LEON3_Timer_Regs_Map *LEON3_Timer_Regs = 0;
     41volatile struct gptimer_regs *LEON3_Timer_Regs = 0;
    4242static int clkirq;
    4343
     
    6666    if (adev) { \
    6767      /* Found APB GPTIMER Timer */ \
    68       LEON3_Timer_Regs = (volatile LEON3_Timer_Regs_Map *) \
     68      LEON3_Timer_Regs = (volatile struct gptimer_regs *) \
    6969                         DEV_TO_APB(adev)->start; \
    70       clkirq = (LEON3_Timer_Regs->status & 0xf8) >> 3; \
     70      clkirq = (LEON3_Timer_Regs->cfg & 0xf8) >> 3; \
    7171      \
    7272      Adjust_clkirq_for_node(); \
     
    8484      rtems_configuration_get_microseconds_per_tick() - 1; \
    8585    \
    86     LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].conf = \
     86    LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].ctrl = \
    8787      LEON3_GPTIMER_EN | LEON3_GPTIMER_RL | \
    8888        LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN; \
     
    9292  do { \
    9393    LEON_Mask_interrupt(LEON_TRAP_TYPE(clkirq)); \
    94     LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].conf = 0; \
     94    LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].ctrl = 0; \
    9595  } while (0)
    9696
  • c/src/lib/libbsp/sparc/leon3/console/console.c

    rca764e6 r226d48d8  
    5050
    5151extern void apbuart_outbyte_polled(
    52   ambapp_apb_uart *regs,
     52  struct apbuart_regs *regs,
    5353  unsigned char ch,
    5454  int do_cr_on_newline,
     
    5757
    5858
     59/* body is in printk_support.c */
     60
     61/*
     62 *  apbuart_inbyte_nonblocking
     63 *
     64 *  This routine polls for a character.
     65 */
     66
     67extern int apbuart_inbyte_nonblocking(struct apbuart_regs *regs);
     68
    5969/* body is in debugputs.c */
    6070
    61 /*
    62  *  apbuart_inbyte_nonblocking
    63  *
    64  *  This routine polls for a character.
    65  */
    66 
    67 extern int apbuart_inbyte_nonblocking(ambapp_apb_uart *regs);
    68 
    69 /* body is in debugputs.c */
    70 
    7171struct apbuart_priv {
    72   ambapp_apb_uart *regs;
     72  struct apbuart_regs *regs;
    7373  unsigned int freq_hz;
    7474#if CONSOLE_USE_INTERRUPTS
     
    253253
    254254  /* Extract needed information of one APBUART */
    255   apbuarts[uarts].regs = (ambapp_apb_uart *)apb->start;
     255  apbuarts[uarts].regs = (struct apbuart_regs *)apb->start;
    256256#if CONSOLE_USE_INTERRUPTS
    257257  apbuarts[uarts].irq = apb->irq;
  • c/src/lib/libbsp/sparc/leon3/console/printk_support.c

    rca764e6 r226d48d8  
    3030 */
    3131int debug_uart_index __attribute__((weak)) = 0;
    32 ambapp_apb_uart *dbg_uart = NULL;
     32struct apbuart_regs *dbg_uart = NULL;
    3333
    3434/* Before UART driver has registered (or when no UART is available), calls to
     
    7575     */
    7676    apb = (struct ambapp_apb_info *)adev->devinfo;
    77     dbg_uart = (ambapp_apb_uart *)apb->start;
     77    dbg_uart = (struct apbuart_regs *)apb->start;
    7878    dbg_uart->ctrl |= LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE;
    7979    dbg_uart->status = 0;
     
    8989 */
    9090void apbuart_outbyte_polled(
    91   ambapp_apb_uart *regs,
     91  struct apbuart_regs *regs,
    9292  unsigned char ch,
    9393  int do_cr_on_newline,
     
    122122 *  This routine polls for a character.
    123123 */
    124 int apbuart_inbyte_nonblocking(ambapp_apb_uart *regs)
     124int apbuart_inbyte_nonblocking(struct apbuart_regs *regs)
    125125{
    126126  /* Clear errors */
  • c/src/lib/libbsp/sparc/leon3/include/amba.h

    rca764e6 r226d48d8  
    2626
    2727#include <ambapp.h>
     28#include <grlib.h>
    2829
    2930#ifdef __cplusplus
  • c/src/lib/libbsp/sparc/leon3/include/leon.h

    rca764e6 r226d48d8  
    4444  ( (_trap) >= 0x11 && \
    4545    (_trap) <= 0x1F )
    46 
    47 typedef struct {
    48   volatile unsigned int value;
    49   volatile unsigned int reload;
    50   volatile unsigned int conf;
    51   volatile unsigned int notused;
    52 } LEON3_Timer_SubType;
    53 
    54 typedef struct {
    55   volatile unsigned int scaler_value;   /* common timer registers */
    56   volatile unsigned int scaler_reload;
    57   volatile unsigned int status;
    58   volatile unsigned int notused;
    59   LEON3_Timer_SubType timer[8];
    60 } LEON3_Timer_Regs_Map;
    61 
    62 typedef struct {
    63   volatile unsigned int iodata;
    64   volatile unsigned int ioout;
    65   volatile unsigned int iodir;
    66   volatile unsigned int irqmask;
    67   volatile unsigned int irqpol;
    68   volatile unsigned int irqedge;
    69 } LEON3_IOPORT_Regs_Map;
    7046
    7147/* /\* */
     
    138114#define LEON_REG_UART_CTRL_LB     0x00000080 /* Loop Back enable */
    139115
    140 extern volatile LEON3_IrqCtrl_Regs_Map *LEON3_IrqCtrl_Regs;  /* LEON3 Interrupt Controller */
    141 extern volatile LEON3_Timer_Regs_Map *LEON3_Timer_Regs; /* LEON3 GP Timer */
     116extern volatile struct irqmp_regs *LEON3_IrqCtrl_Regs;  /* LEON3 Interrupt Controller */
     117extern volatile struct gptimer_regs *LEON3_Timer_Regs; /* LEON3 GP Timer */
    142118
    143119/* LEON3 CPU Index of boot CPU */
  • c/src/lib/libbsp/sparc/leon3/leon_smc91111/leon_smc91111.c

    rca764e6 r226d48d8  
    3535{
    3636  unsigned long addr_mctrl = 0;
    37   LEON3_IOPORT_Regs_Map *io;
     37  struct grgpio_regs *io;
    3838  struct ambapp_apb_info apbpio;
    3939  struct ambapp_apb_info apbmctrl;
     
    6464  /* Get  controller address */
    6565  addr_mctrl = (unsigned long) apbmctrl.start;
    66   io = (LEON3_IOPORT_Regs_Map *) apbpio.start;
     66  io = (struct grgpio_regs *) apbpio.start;
    6767
    6868  printk(
     
    7272
    7373  /* Setup PIO IRQ */
    74   io->irqmask |= (1 << leon_scmv91111_configuration.pio);
    75   io->irqpol |= (1 << leon_scmv91111_configuration.pio);
    76   io->irqedge |= (1 << leon_scmv91111_configuration.pio);
    77   io->iodir &= ~(1 << leon_scmv91111_configuration.pio);
     74  io->imask |= (1 << leon_scmv91111_configuration.pio);
     75  io->ipol |= (1 << leon_scmv91111_configuration.pio);
     76  io->iedge |= (1 << leon_scmv91111_configuration.pio);
     77  io->dir &= ~(1 << leon_scmv91111_configuration.pio);
    7878
    7979  /* Setup memory controller I/O waitstates */
  • c/src/lib/libbsp/sparc/leon3/preinstall.am

    rca764e6 r226d48d8  
    9090PREINSTALL_FILES += $(PROJECT_INCLUDE)/ambapp_ids.h
    9191
     92$(PROJECT_INCLUDE)/grlib.h: ../../sparc/shared/include/grlib.h $(PROJECT_INCLUDE)/$(dirstamp)
     93        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/grlib.h
     94PREINSTALL_FILES += $(PROJECT_INCLUDE)/grlib.h
     95
    9296$(PROJECT_INCLUDE)/bsp/irq-generic.h: ../../shared/include/irq-generic.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
    9397        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq-generic.h
  • c/src/lib/libbsp/sparc/leon3/timer/timer.c

    rca764e6 r226d48d8  
    3434bool benchmark_timer_is_initialized = false;
    3535
    36 extern volatile LEON3_Timer_Regs_Map *LEON3_Timer_Regs;
     36extern volatile struct gptimer_regs *LEON3_Timer_Regs;
    3737
    3838void benchmark_timer_initialize(void)
     
    4949      benchmark_timer_is_initialized = true;
    5050    }
    51     LEON3_Timer_Regs->timer[LEON3_TIMER_INDEX].conf = LEON3_GPTIMER_EN | LEON3_GPTIMER_LD;
     51    LEON3_Timer_Regs->timer[LEON3_TIMER_INDEX].ctrl = LEON3_GPTIMER_EN | LEON3_GPTIMER_LD;
    5252  }
    5353}
  • c/src/lib/libbsp/sparc/shared/can/grcan.c

    rca764e6 r226d48d8  
    2727#include <grcan.h>
    2828#include <ambapp.h>
     29#include <grlib.h>
    2930
    3031#define WRAP_AROUND_TX_MSGS 1
     
    10981099  {
    10991100    struct ambapp_apb_info gptimer;
    1100     LEON3_Timer_Regs_Map *tregs;
     1101    struct gptimer_regs *tregs;
    11011102
    11021103    if (ambapp_find_apbslv (&ambapp_plb, VENDOR_GAISLER, GAISLER_GPTIMER, &gptimer)
    11031104        == 1) {
    1104       tregs = (LEON3_Timer_Regs_Map *) gptimer.start;
     1105      tregs = (struct gptimer_regs *) gptimer.start;
    11051106      sys_freq_hz = (tregs->scaler_reload + 1) * 1000 * 1000;
    11061107      DBG("GRCAN: detected %dHZ system frequency\n\r", sys_freq_hz);
  • c/src/lib/libbsp/sparc/shared/can/occan.c

    rca764e6 r226d48d8  
    2020#include <leon.h>
    2121#include <ambapp.h>
     22#include <grlib.h>
    2223#include <occan.h>
    2324
     
    937938        {
    938939                struct ambapp_apb_info gptimer;
    939                 LEON3_Timer_Regs_Map *tregs;
     940                struct gptimer_regs *tregs;
    940941
    941942                if ( ambapp_find_apbslv(&ambapp_plb, VENDOR_GAISLER,
    942943                                        GAISLER_GPTIMER, &gptimer) == 1 ){
    943                         tregs = (LEON3_Timer_Regs_Map *)gptimer.start;
     944                        tregs = (struct gptimer_regs *)gptimer.start;
    944945                        sys_freq_hz = (tregs->scaler_reload+1)*1000*1000;
    945946                        DBG("OCCAN: detected %dHZ system frequency\n\r",sys_freq_hz);
  • c/src/lib/libbsp/sparc/shared/i2c/i2cmst.c

    rca764e6 r226d48d8  
    1818#include <i2cmst.h>
    1919#include <ambapp.h>
     20#include <grlib.h>
    2021#include <rtems/libi2c.h>
    2122
     
    319320        {
    320321          struct ambapp_apb_info gptimer;
    321           LEON3_Timer_Regs_Map *tregs;
     322          struct gptimer_regs *tregs;
    322323
    323324          if (ambapp_find_apbslv(abus, VENDOR_GAISLER,
    324325                                 GAISLER_GPTIMER, &gptimer) == 1 ) {
    325             tregs = (LEON3_Timer_Regs_Map *)gptimer.start;
     326            tregs = (struct gptimer_regs *)gptimer.start;
    326327            gr_i2cmst_desc.prv.sysfreq = (tregs->scaler_reload+1)*1000;
    327328          } else {
  • c/src/lib/libbsp/sparc/shared/include/ambapp.h

    rca764e6 r226d48d8  
    354354
    355355
    356 /******** AMBA DEVICES *******/
    357 
    358 /* ESA MEMORY CONTROLLER */
    359 typedef struct {
    360   unsigned int mcfg1;
    361   unsigned int mcfg2;
    362   unsigned int mcfg3;
    363 } ambapp_regmap_mctrl;
    364 
    365 /* APB UART */
    366 typedef struct {
    367   volatile unsigned int data;
    368   volatile unsigned int status;
    369   volatile unsigned int ctrl;
    370   volatile unsigned int scaler;
    371 } ambapp_apb_uart;
    372 
    373 typedef struct {
    374   volatile unsigned int ilevel;
    375   volatile unsigned int ipend;
    376   volatile unsigned int iforce;
    377   volatile unsigned int iclear;
    378   volatile unsigned int mpstat;
    379   volatile unsigned int notused01;
    380   volatile unsigned int notused02;
    381   volatile unsigned int notused03;
    382   volatile unsigned int ampctrl;
    383   volatile unsigned int icsel[2];
    384   volatile unsigned int notused13;
    385   volatile unsigned int notused20;
    386   volatile unsigned int notused21;
    387   volatile unsigned int notused22;
    388   volatile unsigned int notused23;
    389   volatile unsigned int mask[16];
    390   volatile unsigned int force[16];
    391   /* Extended IRQ registers */
    392   volatile unsigned int intid[16];
    393   /* 0x100, align to 4Kb boundary */
    394   volatile unsigned int resv1[(0x1000-0x100)/4];
    395 } LEON3_IrqCtrl_Regs_Map;
    396 
    397 /*****************************/
    398 
    399356#ifdef __cplusplus
    400357}
  • c/src/lib/libbsp/sparc/shared/spw/grspw.c

    rca764e6 r226d48d8  
    8484#include <rtems/bspIo.h>
    8585#include <ambapp.h>
     86#include <grlib.h>
    8687#include <grspw.h>
    8788
     
    391392        {
    392393                struct ambapp_apb_info gptimer;
    393                 LEON3_Timer_Regs_Map *tregs;
     394                struct gptimer_regs *tregs;
    394395
    395396                if ( ambapp_find_apbslv(&ambapp_plb, VENDOR_GAISLER,
    396397                                        GAISLER_GPTIMER, &gptimer) == 1 ) {
    397                         tregs = (LEON3_Timer_Regs_Map *)gptimer.start;
     398                        tregs = (struct gptimer_regs *)gptimer.start;
    398399                        sys_freq_khz = (tregs->scaler_reload+1)*1000;
    399400                        SPACEWIRE_DBG("GRSPW: detected %dkHZ system frequency\n\r",sys_freq_khz);
  • c/src/lib/libbsp/sparc/shared/uart/apbuart.c

    rca764e6 r226d48d8  
    2323
    2424#include <ambapp.h>
     25#include <grlib.h>
    2526#include <apbuart.h>
    2627
     
    8081
    8182typedef struct {
    82         ambapp_apb_uart *regs;
     83        struct apbuart_regs *regs;
    8384        int irq;
    8485        int minor;
     
    154155
    155156#if 0
    156 static int apbuart_outbyte_try(ambapp_apb_uart *regs, unsigned char ch)
     157static int apbuart_outbyte_try(struct apbuart_regs *regs, unsigned char ch)
    157158{
    158159        if ( (READ_REG(&regs->status) & LEON_REG_UART_STATUS_THE) == 0 )
     
    165166
    166167
    167 static int apbuart_inbyte_try(ambapp_apb_uart *regs)
     168static int apbuart_inbyte_try(struct apbuart_regs *regs)
    168169{
    169170        unsigned int status;
     
    387388        {
    388389                struct ambapp_apb_info gptimer;
    389                 LEON3_Timer_Regs_Map *tregs;
     390                struct gptimer_regs *tregs;
    390391
    391392                if ( ambapp_find_apbslv(&ambapp_plb, VENDOR_GAISLER,
    392393                                        GAISLER_GPTIMER, &gptimer) == 1 ){
    393                         tregs = (LEON3_Timer_Regs_Map *)gptimer.start;
     394                        tregs = (struct gptimer_regs *)gptimer.start;
    394395                        sys_freq_hz = (tregs->scaler_reload+1)*1000*1000;
    395396                        DBG("APBUART: detected %dHZ system frequency\n\r",sys_freq_hz);
     
    420421                printk("APBUART[%d]: at 0x%x irq %d (0x%x)\n\r",i,dev.start,dev.irq,(unsigned int)&apbuarts[i]);
    421422
    422                 apbuarts[i].regs = (ambapp_apb_uart *)dev.start;
     423                apbuarts[i].regs = (struct apbuart_regs *)dev.start;
    423424                apbuarts[i].irq = dev.irq;
    424425                apbuarts[i].minor = i;
Note: See TracChangeset for help on using the changeset viewer.