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