1 
2 /*
3  * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 
21 
22 
23 #ifndef __SEQ_H__
24 #define __SEQ_H__
25 
26 #include "HALhwio.h"
27 
28 
29 
30 
31 #define SEQ_INH(base, regtype, reg) \
32 	SEQ_##regtype##_INH(base, reg)
33 
34 
35 #define SEQ_INMH(base, regtype, reg, mask) \
36 	SEQ_##regtype##_INMH(base, reg, mask)
37 
38 
39 
40 #define SEQ_INFH(base, regtype, reg, fld) \
41 	(SEQ_##regtype##_INMH(base, reg, HWIO_FMSK(regtype, fld)) >> HWIO_SHFT(regtype, fld))
42 
43 
44 
45 #define SEQ_OUTH(base, regtype, reg, val) \
46 	SEQ_##regtype##_OUTH(base, reg, val)
47 
48 
49 #define SEQ_OUTMH(base, regtype, reg, mask, val) \
50 	SEQ_##regtype##_OUTMH(base, reg, mask, val)
51 
52 
53 
54 #define SEQ_OUTFH(base, regtype, reg, fld, val) \
55 	SEQ_##regtype##_OUTMH(base, reg, HWIO_FMSK(regtype, fld), val << HWIO_SHFT(regtype, fld))
56 
57 
58 
59 
60 
61 
62 typedef enum {
63     SEC,
64     MS,
65     US,
66     NS
67 } SEQ_TimeUnit;
68 
69 extern void seq_wait(uint32 time_value, SEQ_TimeUnit time_unit);
70 
71 
72 
73 extern uint32 seq_poll(uint32 reg_offset, uint32 expect_value, uint32 value_mask, uint32 value_shift, uint32 max_poll_cnt);
74 
75 #endif
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95