1 /* 2 * Copyright (c) 2024 Qualcomm Innovation Center, Inc. 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 #ifndef __SEQ_H__ 19 #define __SEQ_H__ 20 21 #include "HALhwio.h" 22 23 #define SEQ_INH(base, regtype, reg) \ 24 SEQ_##regtype##_INH(base, reg) 25 26 #define SEQ_INMH(base, regtype, reg, mask) \ 27 SEQ_##regtype##_INMH(base, reg, mask) 28 29 #define SEQ_INFH(base, regtype, reg, fld) \ 30 (SEQ_##regtype##_INMH(base, reg, HWIO_FMSK(regtype, fld)) >> HWIO_SHFT(regtype, fld)) 31 32 #define SEQ_OUTH(base, regtype, reg, val) \ 33 SEQ_##regtype##_OUTH(base, reg, val) 34 35 #define SEQ_OUTMH(base, regtype, reg, mask, val) \ 36 SEQ_##regtype##_OUTMH(base, reg, mask, val) 37 38 #define SEQ_OUTFH(base, regtype, reg, fld, val) \ 39 SEQ_##regtype##_OUTMH(base, reg, HWIO_FMSK(regtype, fld), val << HWIO_SHFT(regtype, fld)) 40 41 typedef enum { 42 SEC, 43 MS, 44 US, 45 NS 46 } SEQ_TimeUnit; 47 48 extern void seq_wait(uint32 time_value, SEQ_TimeUnit time_unit); 49 50 extern uint32 seq_poll(uint32 reg_offset, uint32 expect_value, uint32 value_mask, uint32 value_shift, uint32 max_poll_cnt); 51 52 #endif 53