Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.20 KB | None | 0 0
  1. diff --git a/litex/soc/software/include/hw/common.h b/litex/soc/software/include/hw/common.h
  2. index 801ec979..d2553118 100644
  3. --- a/litex/soc/software/include/hw/common.h
  4. +++ b/litex/soc/software/include/hw/common.h
  5. @@ -3,9 +3,8 @@
  6.  
  7.  #include <stdint.h>
  8.  
  9. -/* To overwrite CSR accessors, define extern, non-inlined versions
  10. - * of csr_rd_uint[8|16|32|64]() and csr_wr_uint[8|16|32|64](), and
  11. - * define CSR_ACCESSORS_DEFINED.
  12. +/* To overwrite CSR subregister accessors, define extern, non-inlined versions
  13. + * of csr_writel() and csr_readl(), and define CSR_ACCESSORS_DEFINED.
  14.   */
  15.  
  16.  #ifndef CSR_ACCESSORS_DEFINED
  17. @@ -41,6 +40,16 @@
  18.  /* CSR subregisters are embedded inside native CPU word aligned locations: */
  19.  #define MMPTR(a) (*((volatile unsigned long *)(a)))
  20.  
  21. +static inline unsigned long csr_writel(unsigned long v, unsigned long a)
  22. +{
  23. +       MMPTR(a) = v;
  24. +}
  25. +
  26. +static inline unsigned long csr_readl(unsigned long a)
  27. +{
  28. +       return MMPTR(a);
  29. +}
  30. +
  31.  /* Number of subregs required for various total byte sizes, by subreg width:
  32.   * NOTE: 1, 2, 4, and 8 bytes represent uint[8|16|32|64]_t C types; However,
  33.   *       CSRs of intermediate byte sizes (24, 40, 48, and 56) are NOT padded
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement