1 /* 2 * Copyright (c) 2016-2017 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 #ifndef __SEQ_H__ 20 #define __SEQ_H__ 21 22 #include "HALhwio.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_FMSK(regtype, fld)) >> HWIO_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_FMSK(regtype, fld), val << HWIO_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