You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.2 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*****************************************************\
  2. * Copyright 2003-2005 Texas Instruments Incorporated. *
  3. * All rights reserved. *
  4. * Restricted rights to use, duplicate or disclose *
  5. * this code are granted through contract. *
  6. * *
  7. * "@(#) PSP/CSL 3.0.0.0 (2003-09-30) *
  8. \*****************************************************/
  9. /* Register layer central -- contains field-manipulation macro definitions */
  10. #ifndef _CSLR_H_
  11. #define _CSLR_H_
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. /* the "expression" macros */
  16. /* the Field MaKe macro */
  17. #define CSL_FMK(PER_REG_FIELD, val) \
  18. (((val) << CSL_##PER_REG_FIELD##_SHIFT) & CSL_##PER_REG_FIELD##_MASK)
  19. /* the Field EXTract macro */
  20. #define CSL_FEXT(reg, PER_REG_FIELD) \
  21. (((reg) & CSL_##PER_REG_FIELD##_MASK) >> CSL_##PER_REG_FIELD##_SHIFT)
  22. /* the Field INSert macro */
  23. #define CSL_FINS(reg, PER_REG_FIELD, val) \
  24. ((reg) = ((reg) & ~CSL_##PER_REG_FIELD##_MASK) \
  25. | CSL_FMK(PER_REG_FIELD, val))
  26. /* the "token" macros */
  27. /* the Field MaKe (Token) macro */
  28. #define CSL_FMKT(PER_REG_FIELD, TOKEN) \
  29. CSL_FMK(PER_REG_FIELD, CSL_##PER_REG_FIELD##_##TOKEN)
  30. /* the Field INSert (Token) macro */
  31. #define CSL_FINST(reg, PER_REG_FIELD, TOKEN) \
  32. CSL_FINS((reg), PER_REG_FIELD, CSL_##PER_REG_FIELD##_##TOKEN)
  33. /* the "raw" macros */
  34. /* the Field MaKe (Raw) macro */
  35. #define CSL_FMKR(msb, lsb, val) \
  36. (((val) & ((1 << ((msb) - (lsb) + 1)) - 1)) << (lsb))
  37. /* the Field EXTract (Raw) macro */
  38. #define CSL_FEXTR(reg, msb, lsb) \
  39. (((reg) >> (lsb)) & ((1 << ((msb) - (lsb) + 1)) - 1))
  40. /* the Field INSert (Raw) macro */
  41. #define CSL_FINSR(reg, msb, lsb, val) \
  42. ((reg) = ((reg) &~ (((1 << ((msb) - (lsb) + 1)) - 1) << (lsb))) \
  43. | CSL_FMKR(msb, lsb, val))
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #endif /* _CSLR_H_ */