1 /* 2 * Copyright (c) 2020 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 * 21 * DESCRIPTION 22 * - This is an extension of standard msmhwio.h to support relative addressing 23 * scheme used in SCALe auto-generated sequences. 24 * - The objective of this new addressing scheme is enable the same C function 25 * definition to be applicable to multiple baseances of the same block. 26 * - Such code reuse is not feasible with the standard HWIO macros that use a 27 * absolute addressing scheme. 28 * - Compared to the standard HWIO macros, the new macros defined here take an 29 * additional parameter 'baseance offset'. So are the C functions generated 30 * by SCALe Autoseq from .seq inputs. 31 * - As such, macros defined in this file must be used with 'seq_msmhwiobase.h', 32 * 'seq_msmhwioreg.h', and the C codes generated from SCALe Autoseq. 33 * - Macros defined in this file leverage the lower-level macros from the 34 * standard 'msmhwio.h', and the two sets of macros are compatible. 35 * 36 ********************************************************************************/ 37 38 #ifndef __SEQ_H__ 39 #define __SEQ_H__ 40 41 #include "HALhwio.h" 42 43 44 45 /**** Register Ref Read ****/ 46 #define SEQ_INH(base, regtype, reg) \ 47 SEQ_##regtype##_INH(base, reg) 48 49 /**** Masked Register Read ****/ 50 #define SEQ_INMH(base, regtype, reg, mask) \ 51 SEQ_##regtype##_INMH(base, reg, mask) 52 53 54 /**** Ref Reg Field Read ****/ 55 #define SEQ_INFH(base, regtype, reg, fld) \ 56 (SEQ_##regtype##_INMH(base, reg, HWIO_FMSK(regtype, fld)) >> HWIO_SHFT(regtype, fld)) 57 58 59 /**** Ref Register Write ****/ 60 #define SEQ_OUTH(base, regtype, reg, val) \ 61 SEQ_##regtype##_OUTH(base, reg, val) 62 63 /**** Ref Register Masked Write ****/ 64 #define SEQ_OUTMH(base, regtype, reg, mask, val) \ 65 SEQ_##regtype##_OUTMH(base, reg, mask, val) 66 67 68 /**** Ref Register Field Write ****/ 69 #define SEQ_OUTFH(base, regtype, reg, fld, val) \ 70 SEQ_##regtype##_OUTMH(base, reg, HWIO_FMSK(regtype, fld), val << HWIO_SHFT(regtype, fld)) 71 72 73 /**** seq_msg() **** 74 75 typedef enum { 76 DEBUG, 77 INFO, 78 WARNING, 79 ERROR, 80 FATAL 81 } SeverityLevel ; 82 83 void seq_msg(SeverityLevel severity, unsigned int msg_id, const char *format_str, ... ); 84 85 */ 86 87 /************ seq_wait() ************/ 88 89 typedef enum { 90 SEC, 91 MS, 92 US, 93 NS 94 } SEQ_TimeUnit; 95 96 extern void seq_wait(uint32 time_value, SEQ_TimeUnit time_unit); 97 98 99 /************ seq_poll() ************/ 100 extern uint32 seq_poll(uint32 reg_offset, uint32 expect_value, uint32 value_mask, uint32 value_shift, uint32 max_poll_cnt); 101 102 #endif /* __SEQ_H__ */ 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122