Changeset 9b2b389 in rtems


Ignore:
Timestamp:
Jan 18, 2019, 5:00:47 PM (4 months ago)
Author:
Jiri Gaisler <jiri@…>
Branches:
master
Children:
c1dcd6af
Parents:
5981c8ca
git-author:
Jiri Gaisler <jiri@…> (01/18/19 17:00:47)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/22/19 11:50:08)
Message:

grlib: use cpu-independent routines for uncached access

Update #3678.

Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • bsps/include/grlib/grlib_impl.h

    r5981c8ca r9b2b389  
    9191#endif
    9292
     93#ifdef __sparc__
     94
     95RTEMS_INLINE_ROUTINE unsigned char grlib_read_uncached8(unsigned int address)
     96{
     97       unsigned char tmp;
     98       __asm__ (" lduba [%1]1, %0 "
     99           : "=r"(tmp)
     100           : "r"(address)
     101       );
     102       return tmp;
     103}
     104
     105RTEMS_INLINE_ROUTINE unsigned short grlib_read_uncached16(unsigned int addr) {
     106       unsigned short tmp;
     107       __asm__ (" lduha [%1]1, %0 "
     108         : "=r"(tmp)
     109         : "r"(addr)
     110       );
     111       return tmp;
     112}
     113
     114
     115RTEMS_INLINE_ROUTINE unsigned int grlib_read_uncached32(unsigned int address)
     116{
     117        unsigned int tmp;
     118        __asm__ (" lda [%1]1, %0 "
     119                : "=r"(tmp)
     120                : "r"(address)
     121        );
     122        return tmp;
     123}
     124#else
     125
     126static unsigned char __inline__ grlib_read_uncached8(unsigned int address)
     127{
     128        unsigned char tmp = (*(volatile unsigned char *)(address));
     129        return tmp;
     130}
     131
     132static __inline__ unsigned short grlib_read_uncached16(unsigned int address) {
     133        unsigned short tmp = (*(volatile unsigned short *)(address));
     134        return tmp;
     135}
     136
     137RTEMS_INLINE_ROUTINE unsigned int grlib_read_uncached32(unsigned int address)
     138{
     139        unsigned int tmp = (*(volatile unsigned int *)(address));
     140        return tmp;
     141}
     142
     143#endif
     144
    93145extern struct ambapp_bus ambapp_plb;
    94146
  • bsps/shared/grlib/1553/b1553brm.c

    r5981c8ca r9b2b389  
    6060
    6161#define READ_REG(address) (*(volatile unsigned int *)address)
    62 #define READ_DMA(address) _BRM_REG_READ16((unsigned int)address)
    63 static __inline__ unsigned short _BRM_REG_READ16(unsigned int addr) {
    64         unsigned short tmp;
    65         __asm__ (" lduha [%1]1, %0 "
    66           : "=r"(tmp)
    67           : "r"(addr)
    68         );
    69         return tmp;
    70 }
     62#define READ_DMA(address) grlib_read_uncached16((unsigned int)address)
    7163
    7264static rtems_device_driver brm_initialize(rtems_device_major_number major, rtems_device_minor_number minor, void *arg);
  • bsps/shared/grlib/1553/b1553rt.c

    r5981c8ca r9b2b389  
    5353#endif
    5454
    55 #define READ_DMA(address) _READ16((unsigned int)address)
    56 
    57 static __inline__ unsigned short _READ16(unsigned int addr) {
    58     unsigned short tmp;
    59     asm(" lduha [%1]1, %0 "
    60         : "=r"(tmp)
    61         : "r"(addr)
    62         );
    63     return tmp;
    64 }
     55#define READ_DMA(address) grlib_read_uncached16((unsigned int)address)
    6556
    6657static rtems_device_driver rt_initialize(rtems_device_major_number major, rtems_device_minor_number minor, void *arg);
  • bsps/shared/grlib/can/grcan.c

    r5981c8ca r9b2b389  
    166166
    167167#ifdef GRCAN_REG_BYPASS_CACHE
    168 #define READ_REG(address) _grcan_read_nocache((unsigned int)(address))
     168#define READ_REG(address) grlib_read_uncached32((unsigned int)(address))
    169169#else
    170170#define READ_REG(address) (*(volatile unsigned int *)(address))
     
    172172
    173173#ifdef GRCAN_DMA_BYPASS_CACHE
    174 #define READ_DMA_WORD(address) _grcan_read_nocache((unsigned int)(address))
    175 #define READ_DMA_BYTE(address) _grcan_read_nocache_byte((unsigned int)(address))
    176 static unsigned char __inline__ _grcan_read_nocache_byte(unsigned int address)
    177 {
    178         unsigned char tmp;
    179         __asm__ (" lduba [%1]1, %0 "
    180             : "=r"(tmp)
    181             : "r"(address)
    182         );
    183         return tmp;
    184 }
     174#define READ_DMA_WORD(address) grlib_read_uncached32((unsigned int)(address))
     175#define READ_DMA_BYTE(address) grlib_read_uncached8((unsigned int)(address))
    185176#else
    186177#define READ_DMA_WORD(address) (*(volatile unsigned int *)(address))
    187178#define READ_DMA_BYTE(address) (*(volatile unsigned char *)(address))
    188 #endif
    189 
    190 #if defined(GRCAN_REG_BYPASS_CACHE) || defined(GRCAN_DMA_BYPASS_CACHE)
    191 static unsigned int __inline__ _grcan_read_nocache(unsigned int address)
    192 {
    193         unsigned int tmp;
    194         __asm__ (" lda [%1]1, %0 "
    195                 : "=r"(tmp)
    196                 : "r"(address)
    197         );
    198         return tmp;
    199 }
    200179#endif
    201180
  • bsps/shared/grlib/pci/grpci2dma.c

    r5981c8ca r9b2b389  
    9999#define BD_WRITE(addr, val) (*(volatile unsigned int *)(addr) = (unsigned int)(val))
    100100/*#define BD_READ(addr) (*(volatile unsigned int *)(addr))*/
    101 #define BD_READ(addr) leon_r32_no_cache((unsigned long)(addr))
     101#define BD_READ(addr) grlib_read_uncached32((unsigned long)(addr))
    102102#define REG_WRITE(addr, val) (*(volatile unsigned int *)(addr) = (unsigned int)(val))
    103103#define REG_READ(addr) (*(volatile unsigned int *)(addr))
  • bsps/shared/grlib/spw/grspw.c

    r5981c8ca r9b2b389  
    153153#define _MEM_READ32(address) (*(volatile unsigned int *)(address))
    154154#else
    155 static inline unsigned int _SPW_READ(volatile void *addr) {
    156         unsigned int tmp;
    157         __asm__ (" lda [%1]1, %0 "
    158             : "=r"(tmp)
    159             : "r"(addr)
    160            );
    161         return tmp;
    162 }
    163 
    164 static inline unsigned int _MEM_READ8(volatile void *addr) {
    165         unsigned int tmp;
    166         __asm__ (" lduba [%1]1, %0 "
    167             : "=r"(tmp)
    168             : "r"(addr)
    169            );
    170         return tmp;
    171 }
    172 
    173 static inline unsigned int _MEM_READ32(volatile void *addr) {
    174         unsigned int tmp;
    175         __asm__ (" lda [%1]1, %0 "
    176             : "=r"(tmp)
    177             : "r"(addr)
    178            );
    179         return tmp;
    180 }
     155#define _SPW_READ(address) grlib_read_uncached32((unsigned int) address)
     156#define _MEM_READ8(address) grlib_read_uncached8((unsigned int) address)
     157#define _MEM_READ32(address) grlib_read_uncached32((unsigned int) address)
    181158#endif
    182159
  • bsps/shared/grlib/spw/grspw_pkt.c

    r5981c8ca r9b2b389  
    316316#define BD_WRITE(addr, val) (*(volatile unsigned int *)(addr) = (unsigned int)(val))
    317317/*#define BD_READ(addr) (*(volatile unsigned int *)(addr))*/
    318 #define BD_READ(addr) leon_r32_no_cache((unsigned long)(addr))
     318#define BD_READ(addr) grlib_read_uncached32((unsigned long)(addr))
    319319#define REG_WRITE(addr, val) (*(volatile unsigned int *)(addr) = (unsigned int)(val))
    320320#define REG_READ(addr) (*(volatile unsigned int *)(addr))
  • cpukit/score/cpu/riscv/headers.am

    r5981c8ca r9b2b389  
    11## This file was generated by "./boostrap -H".
     2include_libcpu_HEADERS += score/cpu/riscv/include/libcpu/access.h
     3include_libcpu_HEADERS += score/cpu/riscv/include/libcpu/byteorder.h
    24include_rtems_HEADERS += score/cpu/riscv/include/rtems/asm.h
    35include_rtems_score_HEADERS += score/cpu/riscv/include/rtems/score/cpu.h
Note: See TracChangeset for help on using the changeset viewer.