seq_hwio.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * Copyright (c) 2019 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /*********************************************************************************
  19. *
  20. * DESCRIPTION
  21. * - This is an extension of standard msmhwio.h to support relative addressing
  22. * scheme used in SCALe auto-generated sequences.
  23. * - The objective of this new addressing scheme is enable the same C function
  24. * definition to be applicable to multiple baseances of the same block.
  25. * - Such code reuse is not feasible with the standard HWIO macros that use a
  26. * absolute addressing scheme.
  27. * - Compared to the standard HWIO macros, the new macros defined here take an
  28. * additional parameter 'baseance offset'. So are the C functions generated
  29. * by SCALe Autoseq from .seq inputs.
  30. * - As such, macros defined in this file must be used with 'seq_msmhwiobase.h',
  31. * 'seq_msmhwioreg.h', and the C codes generated from SCALe Autoseq.
  32. * - Macros defined in this file leverage the lower-level macros from the
  33. * standard 'msmhwio.h', and the two sets of macros are compatible.
  34. *
  35. ********************************************************************************/
  36. #ifndef __SEQ_H__
  37. #define __SEQ_H__
  38. #include "HALhwio.h"
  39. /**** Register Ref Read ****/
  40. #define SEQ_INH(base, regtype, reg) \
  41. SEQ_##regtype##_INH(base, reg)
  42. /**** Masked Register Read ****/
  43. #define SEQ_INMH(base, regtype, reg, mask) \
  44. SEQ_##regtype##_INMH(base, reg, mask)
  45. /**** Ref Reg Field Read ****/
  46. #define SEQ_INFH(base, regtype, reg, fld) \
  47. (SEQ_##regtype##_INMH(base, reg, HWIO_FMSK(regtype, fld)) >> HWIO_SHFT(regtype, fld))
  48. /**** Ref Register Write ****/
  49. #define SEQ_OUTH(base, regtype, reg, val) \
  50. SEQ_##regtype##_OUTH(base, reg, val)
  51. /**** Ref Register Masked Write ****/
  52. #define SEQ_OUTMH(base, regtype, reg, mask, val) \
  53. SEQ_##regtype##_OUTMH(base, reg, mask, val)
  54. /**** Ref Register Field Write ****/
  55. #define SEQ_OUTFH(base, regtype, reg, fld, val) \
  56. SEQ_##regtype##_OUTMH(base, reg, HWIO_FMSK(regtype, fld), val << HWIO_SHFT(regtype, fld))
  57. /**** seq_msg() ****
  58. typedef enum {
  59. DEBUG,
  60. INFO,
  61. WARNING,
  62. ERROR,
  63. FATAL
  64. } SeverityLevel ;
  65. void seq_msg(SeverityLevel severity, unsigned int msg_id, const char *format_str, ... );
  66. */
  67. /************ seq_wait() ************/
  68. typedef enum {
  69. SEC,
  70. MS,
  71. US,
  72. NS
  73. } SEQ_TimeUnit;
  74. extern void seq_wait(uint32 time_value, SEQ_TimeUnit time_unit);
  75. /************ seq_poll() ************/
  76. extern uint32 seq_poll(uint32 reg_offset, uint32 expect_value, uint32 value_mask, uint32 value_shift, uint32 max_poll_cnt);
  77. #endif /* __SEQ_H__ */