Changeset 80186ca8 in rtems


Ignore:
Timestamp:
Feb 27, 2014, 7:32:52 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
64f4ac2
Parents:
e1d7bf0
git-author:
Sebastian Huber <sebastian.huber@…> (02/27/14 07:32:52)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/28/14 08:06:19)
Message:

bsp/leon3: Add and use cache register functions

Location:
c/src/lib/libbsp/sparc/leon3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/leon3/include/leon.h

    re1d7bf0 r80186ca8  
    358358}
    359359
     360static inline void leon3_set_system_register(uint32_t addr, uint32_t val)
     361{
     362  __asm__ volatile(
     363    "sta %1, [%0] 2"
     364    :
     365    : "r" (addr), "r" (val)
     366  );
     367}
     368
     369static inline uint32_t leon3_get_system_register(uint32_t addr)
     370{
     371  uint32_t val;
     372
     373  __asm__ volatile(
     374    "lda [%1] 2, %0"
     375    : "=r" (val)
     376    : "r" (addr)
     377  );
     378
     379  return val;
     380}
     381
     382static inline void leon3_set_cache_control_register(uint32_t val)
     383{
     384  leon3_set_system_register(0x0, val);
     385}
     386
     387static inline uint32_t leon3_get_cache_control_register(void)
     388{
     389  return leon3_get_system_register(0x0);
     390}
     391
     392static inline uint32_t leon3_get_inst_cache_config_register(void)
     393{
     394  return leon3_get_system_register(0x8);
     395}
     396
     397static inline uint32_t leon3_get_data_cache_config_register(void)
     398{
     399  return leon3_get_system_register(0xc);
     400}
     401
    360402#endif /* !ASM */
    361403
  • c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c

    re1d7bf0 r80186ca8  
    2020#include <stdlib.h>
    2121
    22 static inline void sparc_leon3_set_cctrl( unsigned int val )
    23 {
    24   __asm__ volatile( "sta %0, [%%g0] 2" : : "r" (val) );
    25 }
    26 
    27 static inline unsigned int sparc_leon3_get_cctrl( void )
    28 {
    29   unsigned int v = 0;
    30   __asm__ volatile( "lda [%%g0] 2, %0" : "=r" (v) : "0" (v) );
    31   return v;
    32 }
    33 
    3422static rtems_isr bsp_inter_processor_interrupt(
    3523  rtems_vector_number vector
     
    4129void leon3_secondary_cpu_initialize(uint32_t cpu)
    4230{
    43   sparc_leon3_set_cctrl( 0x80000F );
     31  leon3_set_cache_control_register(0x80000F);
    4432  LEON_Unmask_interrupt(LEON3_MP_IRQ);
    4533  LEON3_IrqCtrl_Regs->mask[cpu] |= 1 << LEON3_MP_IRQ;
     
    5442  uint32_t cpu;
    5543
    56   sparc_leon3_set_cctrl( 0x80000F );
     44  leon3_set_cache_control_register(0x80000F);
    5745
    5846  max_cpu_count = leon3_get_cpu_count(LEON3_IrqCtrl_Regs);
  • c/src/lib/libbsp/sparc/leon3/startup/bspstart.c

    re1d7bf0 r80186ca8  
    3333 * set_snooping
    3434 *
    35  * Read the data cache configuration register to determine if
     35 * Read the cache control register to determine if
    3636 * bus snooping is available and enabled. This is needed for some
    3737 * drivers so that they can select the most efficient copy routines.
     
    4141static inline int set_snooping(void)
    4242{
    43   int tmp;
    44   __asm__ (" lda [%%g0] 2, %0 "
    45       : "=r"(tmp)
    46       :
    47   );
    48   return (tmp >> 23) & 1;
     43  return (leon3_get_cache_control_register() >> 23) & 1;
    4944}
    5045
Note: See TracChangeset for help on using the changeset viewer.