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 #ifndef __SEQ_H__ 18 #define __SEQ_H__ 19 20 //xiuhongs: conflict with msmhwio.h for CDVI_SVTB 21 #include "HALhwio.h" 22 //#include "msmhwio.h" 23 24 25 26 /**** Register Ref Read ****/ 27 #define SEQ_INH(base, regtype, reg) \ 28 SEQ_##regtype##_INH(base, reg) 29 30 /**** Masked Register Read ****/ 31 #define SEQ_INMH(base, regtype, reg, mask) \ 32 SEQ_##regtype##_INMH(base, reg, mask) 33 34 35 /**** Ref Reg Field Read ****/ 36 #define SEQ_INFH(base, regtype, reg, fld) \ 37 (SEQ_##regtype##_INMH(base, reg, HWIO_SPRUCE_FMSK(regtype, fld)) >> HWIO_SPRUCE_SHFT(regtype, fld)) 38 39 40 /**** Ref Register Write ****/ 41 #define SEQ_OUTH(base, regtype, reg, val) \ 42 SEQ_##regtype##_OUTH(base, reg, val) 43 44 /**** Ref Register Masked Write ****/ 45 #define SEQ_OUTMH(base, regtype, reg, mask, val) \ 46 SEQ_##regtype##_OUTMH(base, reg, mask, val) 47 48 49 /**** Ref Register Field Write ****/ 50 #define SEQ_OUTFH(base, regtype, reg, fld, val) \ 51 SEQ_##regtype##_OUTMH(base, reg, HWIO_SPRUCE_FMSK(regtype, fld), val << HWIO_SPRUCE_SHFT(regtype, fld)) 52 53 54 /**** seq_msg() **** 55 56 typedef enum { 57 DEBUG, 58 INFO, 59 WARNING, 60 ERROR, 61 FATAL 62 } SeverityLevel ; 63 64 void seq_msg(SeverityLevel severity, unsigned int msg_id, const char *format_str, ... ); 65 66 */ 67 68 /************ seq_wait() ************/ 69 70 typedef enum { 71 SEC, 72 MS, 73 US, 74 NS 75 } SEQ_TimeUnit; 76 77 extern void seq_wait(uint32 time_value, SEQ_TimeUnit time_unit); 78 79 80 /************ seq_poll() ************/ 81 extern uint32 seq_poll(uint32 reg_offset, uint32 expect_value, uint32 value_mask, uint32 value_shift, uint32 max_poll_cnt); 82 83 #endif /* __SEQ_H__ */ 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103