[PATCH 3/3] bsp/tms570: source changes reflecting new headers.

Premysl Houdek kom541000 at gmail.com
Thu Jul 16 12:14:32 UTC 2015


Signed-off-by: Premysl Houdek <kom541000 at gmail.com>
---
 c/src/lib/libbsp/arm/tms570/clock/clock.c          |  34 ++---
 .../lib/libbsp/arm/tms570/console/printk-support.c |   8 +-
 c/src/lib/libbsp/arm/tms570/console/tms570-sci.c   |  55 ++++----
 .../lib/libbsp/arm/tms570/include/system-clocks.h  |   2 +-
 c/src/lib/libbsp/arm/tms570/include/tms570-pom.h   |  42 +-----
 c/src/lib/libbsp/arm/tms570/include/tms570-rti.h   |  51 +------
 c/src/lib/libbsp/arm/tms570/include/tms570-sci.h   |  33 +----
 c/src/lib/libbsp/arm/tms570/include/tms570-vim.h   |  29 +---
 c/src/lib/libbsp/arm/tms570/include/tms570.h       | 151 +++++++++++++++++----
 c/src/lib/libbsp/arm/tms570/startup/bspreset.c     |  11 +-
 10 files changed, 186 insertions(+), 230 deletions(-)

diff --git a/c/src/lib/libbsp/arm/tms570/clock/clock.c b/c/src/lib/libbsp/arm/tms570/clock/clock.c
index 03c156e..1d887af 100644
--- a/c/src/lib/libbsp/arm/tms570/clock/clock.c
+++ b/c/src/lib/libbsp/arm/tms570/clock/clock.c
@@ -36,7 +36,7 @@ static struct timecounter tms570_rti_tc;
 
 static uint32_t tms570_rti_get_timecount(struct timecounter *tc)
 {
-  return TMS570_RTI.RTIFRC0;
+  return TMS570_RTI.CNT[0].FRCx;
 }
 
 #ifndef TMS570_PREFERRED_TC_FREQUENCY
@@ -83,25 +83,25 @@ static void tms570_clock_driver_support_initialize_hardware( void )
                            500000) / 1000000;
 
   /* Hardware specific initialize */
-  TMS570_RTI.RTIGCTRL = 0;
-  TMS570_RTI.RTICPUC0 = tc_prescaler - 1;
-  TMS570_RTI.RTITBCTRL = 2;
-  TMS570_RTI.RTICAPCTRL = 0;
-  TMS570_RTI.RTICOMPCTRL = 0;
+  TMS570_RTI.GCTRL = 0;
+  TMS570_RTI.CNT[0].CPUCx = tc_prescaler - 1;
+  TMS570_RTI.TBCTRL = 2;
+  TMS570_RTI.CAPCTRL = 0;
+  TMS570_RTI.COMPCTRL = 0;
   /* set counter to zero */
-  TMS570_RTI.RTIUC0 = 0;
-  TMS570_RTI.RTIFRC0 = 0;
+  TMS570_RTI.CNT[0].UCx = 0;
+  TMS570_RTI.CNT[0].FRCx = 0;
   /* clear interrupts*/
-  TMS570_RTI.RTICLEARINTENA = 0x00070f0f;
-  TMS570_RTI.RTIINTFLAG = 0x0007000f;
+  TMS570_RTI.CLEARINTENA = 0x00070f0f;
+  TMS570_RTI.INTFLAG = 0x0007000f;
   /* set timer */
-  TMS570_RTI.RTICOMP0 = TMS570_RTI.RTIFRC0 + tc_increments_per_tick;
-  TMS570_RTI.RTICOMP0CLR = TMS570_RTI.RTICOMP0 + tc_increments_per_tick / 2;
-  TMS570_RTI.RTIUDCP0 = tc_increments_per_tick;
+  TMS570_RTI.CMP[0].COMPx = TMS570_RTI.CNT[0].FRCx + tc_increments_per_tick;
+  TMS570_RTI.COMP0CLR = TMS570_RTI.CMP[0].COMPx + tc_increments_per_tick / 2;
+  TMS570_RTI.CMP[0].UDCPx = tc_increments_per_tick;
   /* enable interupt */
-  TMS570_RTI.RTISETINTENA = 0x1;
+  TMS570_RTI.SETINTENA = 0x1;
   /* enable timer */
-  TMS570_RTI.RTIGCTRL = 1;
+  TMS570_RTI.GCTRL = 1;
   /* set timecounter */
   tms570_rti_tc.tc_get_timecount = tms570_rti_get_timecount;
   tms570_rti_tc.tc_counter_mask = 0xffffffff;
@@ -117,7 +117,7 @@ static void tms570_clock_driver_support_initialize_hardware( void )
  */
 static void tms570_clock_driver_support_at_tick( void )
 {
-  TMS570_RTI.RTIINTFLAG = 0x00000001;
+  TMS570_RTI.INTFLAG = 0x00000001;
 }
 
 /**
@@ -156,7 +156,7 @@ static void tms570_clock_driver_support_install_isr(
 static void tms570_clock_driver_support_shutdown_hardware( void )
 {
   /* turn off the timer interrupts */
-  TMS570_RTI.RTICLEARINTENA = 0x20000;
+  TMS570_RTI.CLEARINTENA = 0x20000;
 }
 
 #define Clock_driver_support_initialize_hardware \
diff --git a/c/src/lib/libbsp/arm/tms570/console/printk-support.c b/c/src/lib/libbsp/arm/tms570/console/printk-support.c
index 241ca9b..ed33d98 100644
--- a/c/src/lib/libbsp/arm/tms570/console/printk-support.c
+++ b/c/src/lib/libbsp/arm/tms570/console/printk-support.c
@@ -41,10 +41,10 @@ static void tms570_putc(char ch)
   rtems_interrupt_level level;
 
   rtems_interrupt_disable(level);
-  while ( ( driver_context_table[0].regs->SCIFLR & 0x100 ) == 0) {
+  while ( ( driver_context_table[0].regs->FLR & 0x100 ) == 0) {
     rtems_interrupt_flash(level);
   }
-  driver_context_table[0].regs->SCITD = ch;
+  driver_context_table[0].regs->TD = ch;
   rtems_interrupt_enable(level);
 }
 
@@ -74,8 +74,8 @@ static void tms570_uart_output(char c)
  */
 static int tms570_uart_input( void )
 {
-  if ( driver_context_table[0].regs->SCIFLR & (1<<9) ) {
-      return driver_context_table[0].regs->SCIRD;
+  if ( driver_context_table[0].regs->FLR & (1<<9) ) {
+      return driver_context_table[0].regs->RD;
   } else {
       return -1;
   }
diff --git a/c/src/lib/libbsp/arm/tms570/console/tms570-sci.c b/c/src/lib/libbsp/arm/tms570/console/tms570-sci.c
index d78cf20..44b53f5 100644
--- a/c/src/lib/libbsp/arm/tms570/console/tms570-sci.c
+++ b/c/src/lib/libbsp/arm/tms570/console/tms570-sci.c
@@ -44,13 +44,16 @@ tms570_sci_context driver_context_table[] = {
   {
     .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("TMS570 SCI1"),
     .device_name = "/dev/console",
-    .regs = &TMS570_SCI,
+    /* TMS570 UART peripheral use subset of LIN registers which are equivalent
+     * to SCI ones
+     */
+    .regs = (volatile tms570_sci_t *) &TMS570_LIN,
     .irq = TMS570_IRQ_SCI_LEVEL_0,
   },
   {
     .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("TMS570 SCI2"),
     .device_name = "/dev/ttyS1",
-    .regs = &TMS570_SCI2,
+    .regs = &TMS570_SCI,
     .irq = TMS570_IRQ_SCI2_LEVEL_0,
   }
 };
@@ -134,8 +137,8 @@ static int tms570_sci_read_received_chars(
   if ( N < 1 ) {
     return 0;
   }
-  if ( ctx->regs->SCIRD != 0 ) {
-     buf[0] = ctx->regs->SCIRD;
+  if ( ctx->regs->RD != 0 ) {
+     buf[0] = ctx->regs->RD;
     return 1;
   }
   return 0;
@@ -152,7 +155,7 @@ static int tms570_sci_read_received_chars(
  */
 static void tms570_sci_enable_interrupts(tms570_sci_context * ctx)
 {
-  ctx->regs->SCISETINT = (1<<9);
+  ctx->regs->SETINT = (1<<9);
 }
 
 /**
@@ -166,7 +169,7 @@ static void tms570_sci_enable_interrupts(tms570_sci_context * ctx)
  */
 static void tms570_sci_disable_interrupts(tms570_sci_context * ctx)
 {
-  ctx->regs->SCICLEARINT = (1<<9);
+  ctx->regs->CLEARINT = (1<<9);
 }
 
 /**
@@ -213,29 +216,29 @@ static bool tms570_sci_set_attributes(
 
   rtems_termios_device_lock_acquire(base, &lock_context);
 
-  ctx->regs->SCIGCR1 &= ~( (1<<7) | (1<<25) | (1<<24) );
+  ctx->regs->GCR1 &= ~( (1<<7) | (1<<25) | (1<<24) );
 
-  ctx->regs->SCIGCR1 &= ~(1<<4);    /*one stop bit*/
-  ctx->regs->SCIFORMAT = 0x7;
+  ctx->regs->GCR1 &= ~(1<<4);    /*one stop bit*/
+  ctx->regs->FORMAT = 0x7;
 
   switch ( t->c_cflag & ( PARENB|PARODD ) ) {
     case ( PARENB|PARODD ):
       /* Odd parity */
-      ctx->regs->SCIGCR1 &= ~(1<<3);
-      ctx->regs->SCIGCR1 |= (1<<2);
+      ctx->regs->GCR1 &= ~(1<<3);
+      ctx->regs->GCR1 |= (1<<2);
       break;
 
     case PARENB:
       /* Even parity */
-      ctx->regs->SCIGCR1 |= (1<<3);
-      ctx->regs->SCIGCR1 |= (1<<2);
+      ctx->regs->GCR1 |= (1<<3);
+      ctx->regs->GCR1 |= (1<<2);
       break;
 
     default:
     case 0:
     case PARODD:
       /* No Parity */
-      ctx->regs->SCIGCR1 &= ~(1<<2);
+      ctx->regs->GCR1 &= ~(1<<2);
   }
 
   /* Baud rate */
@@ -244,7 +247,7 @@ static bool tms570_sci_set_attributes(
   bauddiv = (BSP_PLL_OUT_CLOCK + baudrate / 2) / baudrate;
   ctx->regs->BRS = bauddiv;
 
-  ctx->regs->SCIGCR1 |= (1<<7) | (1<<25) | (1<<24);
+  ctx->regs->GCR1 |= (1<<7) | (1<<25) | (1<<24);
 
   rtems_termios_device_lock_release(base, &lock_context);
 
@@ -271,7 +274,7 @@ static void tms570_sci_interrupt_handler(void * arg)
   /*
    * Check if we have received something.
    */
-   if ( (ctx->regs->SCIFLR & (1<<9) ) == (1<<9) ) {
+   if ( (ctx->regs->FLR & (1<<9) ) == (1<<9) ) {
       n = tms570_sci_read_received_chars(ctx, buf, TMS570_SCI_BUFFER_SIZE);
       if ( n > 0 ) {
         /* Hand the data over to the Termios infrastructure */
@@ -281,7 +284,7 @@ static void tms570_sci_interrupt_handler(void * arg)
   /*
    * Check if we have something transmitted.
    */
-  if ( (ctx->regs->SCIFLR & (1<<8) ) == (1<<8) ) {
+  if ( (ctx->regs->FLR & (1<<8) ) == (1<<8) ) {
     n = tms570_sci_transmitted_chars(ctx);
     if ( n > 0 ) {
       /*
@@ -316,15 +319,15 @@ static void tms570_sci_interrupt_write(
 
   if ( len > 0 ) {
     /* start UART TX, this will result in an interrupt when done */
-    ctx->regs->SCITD = *buf;
+    ctx->regs->TD = *buf;
     /* character written - raise count*/
     ctx->tx_chars_in_hw = 1;
     /* Enable TX interrupt (interrupt is edge-triggered) */
-    ctx->regs->SCISETINT = (1<<8);
+    ctx->regs->SETINT = (1<<8);
 
   } else {
     /* No more to send, disable TX interrupts */
-    ctx->regs->SCICLEARINT = (1<<8);
+    ctx->regs->CLEARINT = (1<<8);
     /* Tell close that we sent everything */
   }
 }
@@ -352,10 +355,10 @@ static void tms570_sci_poll_write(
   /* Write */
 
   for ( i = 0; i < n; ++i ) {
-    while ( (ctx->regs->SCIFLR & (1<<11) ) == 0) {
+    while ( (ctx->regs->FLR & (1<<11) ) == 0) {
       ;
     }
-    ctx->regs->SCITD = buf[i];
+    ctx->regs->TD = buf[i];
   }
 }
 
@@ -372,7 +375,7 @@ static int TMS570_sci_can_read_char(
   tms570_sci_context * ctx
 )
 {
-  return ctx->regs->SCIFLR & (1<<9);
+  return ctx->regs->FLR & (1<<9);
 }
 
 /**
@@ -387,7 +390,7 @@ static char TMS570_sci_read_char(
   tms570_sci_context * ctx
 )
 {
-  return ctx->regs->SCIRD;
+  return ctx->regs->RD;
 }
 
 /**
@@ -468,7 +471,7 @@ static bool tms570_sci_interrupt_first_open(
   if ( ret == false ) {
     return false;
   }
-  ctx->regs->SCISETINTLVL = 0;
+  ctx->regs->SETINTLVL = 0;
   /* Register Interrupt handler */
   sc = rtems_interrupt_handler_install(ctx->irq,
       ctx->device_name,
@@ -527,7 +530,7 @@ static void tms570_sci_interrupt_last_close(
   rtems_termios_device_lock_release(base, &lock_context);
 
   /* Flush device */
-  while ( ( ctx->regs->SCIFLR & (1<<11) ) > 0 ) {
+  while ( ( ctx->regs->FLR & (1<<11) ) > 0 ) {
     ;/* Wait until all data has been sent */
   }
 
diff --git a/c/src/lib/libbsp/arm/tms570/include/system-clocks.h b/c/src/lib/libbsp/arm/tms570/include/system-clocks.h
index d441ec4..0e1d130 100644
--- a/c/src/lib/libbsp/arm/tms570/include/system-clocks.h
+++ b/c/src/lib/libbsp/arm/tms570/include/system-clocks.h
@@ -49,7 +49,7 @@ extern "C" {
  */
 static inline unsigned tms570_timer(void)
 {
-  uint32_t actual_fcr0 = TMS570_RTI.RTIFRC0;
+  uint32_t actual_fcr0 = TMS570_RTI.CNT[0].FRCx;
   return actual_fcr0;
 }
 
diff --git a/c/src/lib/libbsp/arm/tms570/include/tms570-pom.h b/c/src/lib/libbsp/arm/tms570/include/tms570-pom.h
index a447711..215d608 100644
--- a/c/src/lib/libbsp/arm/tms570/include/tms570-pom.h
+++ b/c/src/lib/libbsp/arm/tms570/include/tms570-pom.h
@@ -21,6 +21,7 @@
 #define LIBBSP_ARM_TMS570_POM_H
 
 #include <stdint.h>
+#include <bsp/tms570.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -47,47 +48,6 @@ extern "C" {
 
 #define TMS570_POM_REGADDRMASK    ((1<<23)-1)
 
-typedef struct tms570_pom_region_t {
-  uint32_t PROGSTART;
-  uint32_t OVLSTART;
-  uint32_t REGSIZE;
-  uint32_t res0;
-} tms570_pom_region_t;
-
-typedef struct tms570_pom_t {
-  uint32_t GLBCTRL;                    /* 000h Global Control Register */
-  uint32_t REV;                        /* 004h Revision ID */
-  uint32_t CLKCTRL;                    /* 008h Clock Gate Control Register */
-  uint32_t FLG;                        /* 00Ch Status Register */
-  uint32_t reserved1[0x1f0/4];
-  tms570_pom_region_t REG[TMS570_POM_REGIONS]; /* 200h Program Regions */
-  uint32_t reserved2[0xb00/4];
-  uint32_t ITCTRL;                     /* F00h Integration Control Register */
-  uint32_t reserved3[0x09c/4];
-  uint32_t CLAIMSET;                   /* FA0h Claim Set Register */
-  uint32_t CLAIMCLR;                   /* FA4h Claim Clear Register */
-  uint32_t reserved4[0x008/4];
-  uint32_t LOCKACCESS;                 /* FB0h Lock Access Register */
-  uint32_t LOCKSTATUS;                 /* FB4h Lock Status Register */
-  uint32_t AUTHSTATUS;                 /* FB8h Authentication Status Register */
-  uint32_t reserved5[0x00c/4];
-  uint32_t DEVID;                      /* FC8h Device ID Register */
-  uint32_t DEVTYPE;                    /* FCCh Device Type Register */
-  uint32_t PERIPHERALID4;              /* FD0h Peripheral ID 4 Register */
-  uint32_t PERIPHERALID5;              /* FD4h Peripheral ID 5 Register */
-  uint32_t PERIPHERALID6;              /* FD8h Peripheral ID 6 Register */
-  uint32_t PERIPHERALID7;              /* FDCh Peripheral ID 7 Register */
-  uint32_t PERIPHERALID0;              /* FE0h Peripheral ID 0 Register */
-  uint32_t PERIPHERALID1;              /* FE4h Peripheral ID 1 Register */
-  uint32_t PERIPHERALID2;              /* FE8h Peripheral ID 2 Register */
-  uint32_t PERIPHERALID3;              /* FECh Peripheral ID 3 Register */
-  uint32_t COMPONENTID0;               /* FF0h Component ID 0 Register */
-  uint32_t COMPONENTID1;               /* FF4h Component ID 1 Register */
-  uint32_t COMPONENTID2;               /* FF8h Component ID 2 Register */
-  uint32_t COMPONENTID3;               /* FFCh Component ID 3 Register */
-} tms570_pom_t;
-
-#define TMS570_POM (*(volatile tms570_pom_t*)0xffa04000)
 
 int mem_dump(void *buf, unsigned long start, unsigned long len, int blen);
 void tms570_pom_remap(void);
diff --git a/c/src/lib/libbsp/arm/tms570/include/tms570-rti.h b/c/src/lib/libbsp/arm/tms570/include/tms570-rti.h
index 25c02e5..552db88 100644
--- a/c/src/lib/libbsp/arm/tms570/include/tms570-rti.h
+++ b/c/src/lib/libbsp/arm/tms570/include/tms570-rti.h
@@ -29,61 +29,12 @@
 #ifndef ASM
 
 #include <stdint.h>
+#include <bsp/tms570.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
 
-typedef struct {
-  uint32_t RTIGCTRL;       /* RTIGlobalControlRegister */
-  uint32_t RTITBCTRL;      /* RTITimebaseControlRegister */
-  uint32_t RTICAPCTRL;     /* RTICaptureControlRegister */
-  uint32_t RTICOMPCTRL;    /* RTICompareControlRegister */
-  uint32_t RTIFRC0;        /* RTIFreeRunningCounter0Register */
-  uint32_t RTIUC0;         /* RTIUpCounter0Register */
-  uint32_t RTICPUC0;       /* RTICompareUpCounter0Register */
-  uint32_t reserved1 [0x4/4];
-  uint32_t RTICAFRC0;      /* RTICaptureFreeRunningCounter0Register */
-  uint32_t RTICAUC0;       /* RTICaptureUpCounter0Register */
-  uint32_t reserved2 [0x8/4];
-  uint32_t RTIFRC1;        /* RTIFreeRunningCounter1Register */
-  uint32_t RTIUC1;         /* RTIUpCounter1Register */
-  uint32_t RTICPUC1;       /* RTICompareUpCounter1Register */
-  uint32_t reserved3 [0x4/4];
-  uint32_t RTICAFRC1;      /* RTICaptureFreeRunningCounter1Register */
-  uint32_t RTICAUC1;       /* RTICaptureUpCounter1Register */
-  uint32_t reserved4 [0x8/4];
-  uint32_t RTICOMP0;       /* RTICompare0Register */
-  uint32_t RTIUDCP0;       /* RTIUpdateCompare0Register */
-  uint32_t RTICOMP1;       /* RTICompare1Register */
-  uint32_t RTIUDCP1;       /* RTIUpdateCompare1Register */
-  uint32_t RTICOMP2;       /* RTICompare2Register */
-  uint32_t RTIUDCP2;       /* RTIUpdateCompare2Register */
-  uint32_t RTICOMP3;       /* RTICompare3Register */
-  uint32_t RTIUDCP3;       /* RTIUpdateCompare3Register */
-  uint32_t RTITBLCOMP;     /* RTITimebaseLowCompareRegister */
-  uint32_t RTITBHCOMP;     /* RTITimebaseHighCompareRegister */
-  uint32_t reserved5 [0x8/4];
-  uint32_t RTISETINTENA;   /* RTISetInterruptEnableRegister */
-  uint32_t RTICLEARINTENA; /* RTIClearInterruptEnableRegister */
-  uint32_t RTIINTFLAG;     /* RTIInterruptFlagRegister */
-  uint32_t reserved6 [0x4/4];
-  uint32_t RTIDWDCTRL;     /* DigitalWatchdogControlRegister */
-  uint32_t RTIDWDPRLD;     /* DigitalWatchdogPreloadRegister */
-  uint32_t RTIWDSTATUS;    /* WatchdogStatusRegister */
-  uint32_t RTIWDKEY;       /* RTIWatchdogKeyRegister */
-  uint32_t RTIDWDCNTR;     /* RTIDigitalWatchdogDownCounterRegister */
-  uint32_t RTIWWDRXNCTRL;  /* DigitalWindowedWatchdogReactionControlRegister */
-  uint32_t RTIWWDSIZECTRL; /* DigitalWindowedWatchdogWindowSizeControlRegister */
-  uint32_t RTIINTCLRENABLE;/* RTICompareInterruptClearEnableRegister */
-  uint32_t RTICOMP0CLR;    /* RTICompare0ClearRegister */
-  uint32_t RTICOMP1CLR;    /* RTICompare1ClearRegister */
-  uint32_t RTICOMP2CLR;    /* RTICompare2ClearRegister */
-  uint32_t RTICOMP3CLR;    /* RTICompare3ClearRegister */
-}tms570_rti_t;
-
-#define TMS570_RTI (*(volatile tms570_rti_t*)0xFFFFFC00)
-
 /** @} */
 
 #ifdef __cplusplus
diff --git a/c/src/lib/libbsp/arm/tms570/include/tms570-sci.h b/c/src/lib/libbsp/arm/tms570/include/tms570-sci.h
index 6ed68e2..9c502dc 100644
--- a/c/src/lib/libbsp/arm/tms570/include/tms570-sci.h
+++ b/c/src/lib/libbsp/arm/tms570/include/tms570-sci.h
@@ -30,43 +30,12 @@
 
 #include <rtems.h>
 #include <stdint.h>
+#include <bsp/tms570.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
 
-typedef struct {
-  uint32_t SCIGCR0;         /*SCIGlobalControlRegister0*/
-  uint32_t SCIGCR1;         /*SCIGlobalControlRegister1*/
-  uint32_t reserved1 [0x4/4];
-  uint32_t SCISETINT;       /*SCISetInterruptRegister*/
-  uint32_t SCICLEARINT;     /*SCIClearInterruptRegister*/
-  uint32_t SCISETINTLVL;    /*SCISetInterruptLevelRegister*/
-  uint32_t SCICLEARINTLVL;  /*SCIClearInterruptLevelRegister*/
-  uint32_t SCIFLR;          /*SCIFlagsRegister*/
-  uint32_t SCIINTVECT0;     /*SCIInterruptVectorOffset0*/
-  uint32_t SCIINTVECT1;     /*SCIInterruptVectorOffset1*/
-  uint32_t SCIFORMAT;       /*SCIFormatControlRegister*/
-  uint32_t BRS;             /*BaudRateSelectionRegister*/
-  uint32_t SCIED;           /*ReceiverEmulationDataBuffer*/
-  uint32_t SCIRD;           /*ReceiverDataBuffer*/
-  uint32_t SCITD;           /*TransmitDataBuffer*/
-  uint32_t SCIPIO0;         /*SCIPinI/OControlRegister0*/
-  uint32_t SCIPIO1;         /*SCIPinI/OControlRegister1*/
-  uint32_t SCIPIO2;         /*SCIPinI/OControlRegister2*/
-  uint32_t SCIPIO3;         /*SCIPinI/OControlRegister3*/
-  uint32_t SCIPIO4;         /*SCIPinI/OControlRegister4*/
-  uint32_t SCIPIO5;         /*SCIPinI/OControlRegister5*/
-  uint32_t SCIPIO6;         /*SCIPinI/OControlRegister6*/
-  uint32_t SCIPIO7;         /*SCIPinI/OControlRegister7*/
-  uint32_t SCIPIO8;         /*SCIPinI/OControlRegister8*/
-  uint32_t reserved2 [0x30/4];
-  uint32_t IODFTCTRL;       /*Input/OutputErrorEnableRegister*/
-}tms570_sci_t;
-
-#define TMS570_SCI (*(volatile tms570_sci_t*)0xFFF7E400U)
-#define TMS570_SCI2 (*(volatile tms570_sci_t*)0xFFF7E500U)
-
 /** @} */
 
 #ifdef __cplusplus
diff --git a/c/src/lib/libbsp/arm/tms570/include/tms570-vim.h b/c/src/lib/libbsp/arm/tms570/include/tms570-vim.h
index 136af53..9fa7e05 100644
--- a/c/src/lib/libbsp/arm/tms570/include/tms570-vim.h
+++ b/c/src/lib/libbsp/arm/tms570/include/tms570-vim.h
@@ -29,40 +29,13 @@
 #ifndef ASM
 #include <rtems.h>
 #include <stdint.h>
+#include <bsp/tms570.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
 
-typedef struct{
-    uint32_t PARFLG;            /* InterruptVectorTableParityFlagRegister */
-    uint32_t PARCTL;            /* InterruptVectorTableParityControlRegister */
-    uint32_t ADDERR;            /* AddressParityErrorRegister */
-    uint32_t FBPARERR;          /* Fall-BackAddressParityErrorRegister */
-    uint32_t reserved1 [0x4/4];
-    uint32_t IRQINDEX;          /* IRQIndexOffsetVectorRegister */
-    uint32_t FIQINDEX;          /* FIQIndexOffsetVectorRegister */
-    uint32_t reserved2 [0x8/4];
-    uint32_t FIRQPR[3];         /* FIQ/IRQProgramControlRegister0 */
-    uint32_t reserved3 [0x4/4];
-    uint32_t INTREQ[3];         /* PendingInterruptReadLocationRegister0 */
-    uint32_t reserved4 [0x4/4];
-    uint32_t REQENASET[3];      /* InterruptEnableSetRegister0 */
-    uint32_t reserved5 [0x4/4];
-    uint32_t REQENACLR[3];      /* InterruptEnableClearRegister0 */
-    uint32_t reserved6 [0x4/4];
-    uint32_t WAKEENASET[3];     /* Wake-upEnableSetRegister0 */
-    uint32_t reserved7 [0x4/4];
-    uint32_t WAKEENACLR[3];     /* Wake-upEnableClearRegister0 */
-    uint32_t reserved8 [0x4/4];
-    uint32_t IRQVECREG;         /* IRQInterruptVectorRegister */
-    uint32_t FIQVECREG;         /* FIQInterruptVectorRegister */
-    uint32_t CAPEVT;            /* CaptureEventRegister */
-    uint32_t reserved9 [0x4/4];
-    uint32_t CHANCTRL [0x5c/4]; /* VIM Interrupt Control Register (PARSER ERROR) */
-}tms570_vim_t;
 
-#define TMS570_VIM (*(volatile tms570_vim_t*)0xFFFFFDEC)
 
 #endif
 
diff --git a/c/src/lib/libbsp/arm/tms570/include/tms570.h b/c/src/lib/libbsp/arm/tms570/include/tms570.h
index 50f1315..3280950 100644
--- a/c/src/lib/libbsp/arm/tms570/include/tms570.h
+++ b/c/src/lib/libbsp/arm/tms570/include/tms570.h
@@ -1,31 +1,130 @@
-/**
- * @file tms570.h
- *
- * @ingroup tms570
- *
- * @brief Specific register definitions according to tms570 family boards.
- */
+/* This file is generated by make_central_header.py */
+/* Current script's version can be found at: */
+/* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */
 
 /*
- * Copyright (c) 2015 Taller Technologies.
+ * Copyright (c) 2014-2015, Premysl Houdek <kom541000 at gmail.com>
  *
- * @author Martin Galvan <martin.galvan at tallertechnologies.com>
+ * Czech Technical University in Prague
+ * Zikova 1903/4
+ * 166 36 Praha 6
+ * Czech Republic
  *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifndef LIBBSP_ARM_TMS570_H
-#define LIBBSP_ARM_TMS570_H
-
-#define SYSECR (*(uint32_t *)0xFFFFFFE0u) /* System Exception Control Register */
-#define ESMIOFFHR (*(uint32_t *)0xFFFFF528) /* ESM Interrupt Offset High Register */
-#define ESMSR1 (*(uint32_t *)0xFFFFF518u) /* ESM Status Register 1 */
-#define ESMSR2 (*(uint32_t *)0xFFFFF51Cu) /* ESM Status Register 2 */
-#define ESMSR3 (*(uint32_t *)0xFFFFF520u) /* ESM Status Register 3 */
-#define ESMSR4 (*(uint32_t *)0xFFFFF558u) /* ESM Status Register 4 */
-
-#define SYSECR_RESET 0x80000u
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ *    list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+*/
+#ifndef LIBBSP_ARM_TMS570
+#define LIBBSP_ARM_TMS570
+#include <bsp/ti_herc/reg_adc.h>
+#include <bsp/ti_herc/reg_ccmsr.h>
+#include <bsp/ti_herc/reg_crc.h>
+#include <bsp/ti_herc/reg_dcan.h>
+#include <bsp/ti_herc/reg_dcc.h>
+#include <bsp/ti_herc/reg_dma.h>
+#include <bsp/ti_herc/reg_dmm.h>
+#include <bsp/ti_herc/reg_efuse.h>
+#include <bsp/ti_herc/reg_emac.h>
+#include <bsp/ti_herc/reg_emacm.h>
+#include <bsp/ti_herc/reg_emif.h>
+#include <bsp/ti_herc/reg_esm.h>
+#include <bsp/ti_herc/reg_flash.h>
+#include <bsp/ti_herc/reg_flex_ray.h>
+#include <bsp/ti_herc/reg_gio.h>
+#include <bsp/ti_herc/reg_htu.h>
+#include <bsp/ti_herc/reg_i2c.h>
+#include <bsp/ti_herc/reg_iomm.h>
+#include <bsp/ti_herc/reg_lin.h>
+#include <bsp/ti_herc/reg_mdio.h>
+#include <bsp/ti_herc/reg_n2het.h>
+#include <bsp/ti_herc/reg_pbist.h>
+#include <bsp/ti_herc/reg_pll.h>
+#include <bsp/ti_herc/reg_pmm.h>
+#include <bsp/ti_herc/reg_rti.h>
+#include <bsp/ti_herc/reg_rtp.h>
+#include <bsp/ti_herc/reg_sci.h>
+#include <bsp/ti_herc/reg_tcr.h>
+#include <bsp/ti_herc/reg_tcram.h>
+#include <bsp/ti_herc/reg_vim.h>
+#include <bsp/ti_herc/reg_pom.h>
+#include <bsp/ti_herc/reg_spi.h>
+#include <bsp/ti_herc/reg_stc.h>
+#include <bsp/ti_herc/reg_sys.h>
+#include <bsp/ti_herc/reg_sys2.h>
+#include <bsp/ti_herc/reg_pcr.h>
 
-#endif /* LIBBSP_ARM_TMS570_H */
+#define TMS570_ADC1 (*(volatile tms570_adc_t*)0xFFF7C000)
+#define TMS570_ADC2 (*(volatile tms570_adc_t*)0xFFF7C200)
+#define TMS570_CCMSR (*(volatile tms570_ccmsr_t*)0XFFFFF600)
+#define TMS570_CRC (*(volatile tms570_crc_t*)0xFE000000)
+#define TMS570_DCAN1 (*(volatile tms570_dcan_t*)0xFFF7DC00)
+#define TMS570_DCAN2 (*(volatile tms570_dcan_t*)0xFFF7DE00)
+#define TMS570_DCAN3 (*(volatile tms570_dcan_t*)0xFFF7E000)
+#define TMS570_DCC1 (*(volatile tms570_dcc_t*)0xFFFFEC00)
+#define TMS570_DCC2 (*(volatile tms570_dcc_t*)0xFFFFF400)
+#define TMS570_DMA (*(volatile tms570_dma_t*)0xFFFFF000)
+#define TMS570_DMM (*(volatile tms570_dmm_t*)0xFFFFF700)
+#define TMS570_EFUSE (*(volatile tms570_efuse_t*)0XFFF8C01C)
+#define TMS570_EMAC (*(volatile tms570_emac_t*)0xFCF78900)
+#define TMS570_EMACM (*(volatile tms570_emacm_t*)0xFCF78000)
+#define TMS570_EMIF (*(volatile tms570_emif_t*)0xFCFFE800)
+#define TMS570_ESM (*(volatile tms570_esm_t*)0XFFFFF500)
+#define TMS570_FLASH (*(volatile tms570_flash_t*)0XFFF87000)
+#define TMS570_FLEX_RAY (*(volatile tms570_flex_ray_t*)0xFFF7C800)
+#define TMS570_GIO (*(volatile tms570_gio_t*)0xFFF7BC00)
+#define TMS570_GIO_PORTA (*(volatile tms570_gio_port_t*)0xFFF7BC34)
+#define TMS570_GIO_PORTB (*(volatile tms570_gio_port_t*)0xFFF7BC54)
+#define TMS570_GIO_PORTC (*(volatile tms570_gio_port_t*)0xFFF7BC74)
+#define TMS570_GIO_PORTD (*(volatile tms570_gio_port_t*)0xFFF7BC94)
+#define TMS570_GIO_PORTE (*(volatile tms570_gio_port_t*)0xFFF7BCB4)
+#define TMS570_GIO_PORTF (*(volatile tms570_gio_port_t*)0xFFF7BCD4)
+#define TMS570_GIO_PORTG (*(volatile tms570_gio_port_t*)0xFFF7BCF4)
+#define TMS570_GIO_PORTH (*(volatile tms570_gio_port_t*)0xFFF7BD14)
+#define TMS570_HTU1 (*(volatile tms570_htu_t*)0xFFF7A400)
+#define TMS570_HTU2 (*(volatile tms570_htu_t*)0xFFF7A500)
+#define TMS570_I2C (*(volatile tms570_i2c_t*)0xFFF7D400)
+#define TMS570_IOMM (*(volatile tms570_iomm_t*)0XFFFFEA00)
+#define TMS570_PINMUX (*(volatile tms570_pinmux_t*)0xFFFFEB10)
+#define TMS570_LIN (*(volatile tms570_lin_t*)0xFFF7E400)
+#define TMS570_MDIO (*(volatile tms570_mdio_t*)0xFCF78900)
+#define TMS570_NHET1 (*(volatile tms570_nhet_t*)0xFFF7B800)
+#define TMS570_NHET2 (*(volatile tms570_nhet_t*)0xFFF7B900)
+#define TMS570_PBIST (*(volatile tms570_pbist_t*)0xFFFFE400)
+#define TMS570_PLL (*(volatile tms570_pll_t*)0XFFFFE100)
+#define TMS570_PMM (*(volatile tms570_pmm_t*)0xFFFF0000)
+#define TMS570_RTI (*(volatile tms570_rti_t*)0xFFFFFC00)
+#define TMS570_RTP (*(volatile tms570_rtp_t*)0xFFFFFA00)
+#define TMS570_SCI (*(volatile tms570_sci_t*)0xFFF7E500)
+#define TMS570_TCR (*(volatile tms570_tcr_t*)0xFFF7C800)
+#define TMS570_TCRAM1 (*(volatile tms570_tcram_t*)0xFFFFF800)
+#define TMS570_TCRAM2 (*(volatile tms570_tcram_t*)0xFFFFF900)
+#define TMS570_VIM (*(volatile tms570_vim_t*)0XFFFFFDEC)
+#define TMS570_POM (*(volatile tms570_pom_t*)0XFFA04000)
+#define TMS570_SPI (*(volatile tms570_spi_t*)0xFFF7F400)
+#define TMS570_STC (*(volatile tms570_stc_t*)0xFFFFE600)
+#define TMS570_SYS1 (*(volatile tms570_sys1_t*)0xFFFFFF00)
+#define TMS570_SYS2 (*(volatile tms570_sys2_t*)0xFFFFE100)
+#define TMS570_PCR (*(volatile tms570_pcr_t*)0xFFFFE000)
+#endif /* LIBBSP_ARM_TMS570 */
diff --git a/c/src/lib/libbsp/arm/tms570/startup/bspreset.c b/c/src/lib/libbsp/arm/tms570/startup/bspreset.c
index 3efb590..f6bdee2 100644
--- a/c/src/lib/libbsp/arm/tms570/startup/bspreset.c
+++ b/c/src/lib/libbsp/arm/tms570/startup/bspreset.c
@@ -25,22 +25,23 @@ static void handle_esm_errors(uint32_t esm_irq_channel)
 {
    /* ESMR3 errors don't generate interrupts. */
    if (esm_irq_channel < 0x20u) {
-     ESMSR1 = 1 << esm_irq_channel;
+     TMS570_ESM.SR[0] = 1 << esm_irq_channel;
    } else if (esm_irq_channel < 0x40u) {
-     ESMSR2 = 1 << (esm_irq_channel - 32u);
+     TMS570_ESM.SR[1] = 1 << (esm_irq_channel - 32u);
    } else if (esm_irq_channel < 0x60u) {
-     ESMSR4 = 1 << (esm_irq_channel - 64u);
+     TMS570_ESM.SR4 = 1 << (esm_irq_channel - 64u);
    }
 }
 
 void bsp_reset(void)
 {
-   uint32_t esm_irq_channel = ESMIOFFHR - 1;
+   uint32_t esm_irq_channel = TMS570_ESM.IOFFHR - 1;
 
    if (esm_irq_channel) {
      handle_esm_errors(esm_irq_channel);
    }
 
    /* Reset the board */
-   SYSECR = SYSECR_RESET;
+   /* write of value other than 1 cause system reset */
+   TMS570_SYS1.SYSECR = TMS570_SYS1_SYSECR_RESET(2);
 }
-- 
1.9.1




More information about the devel mailing list