xref: /wlan-driver/fw-api/hw/wcn6450/v1/seq_hwio.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 
2 /*
3  * Copyright (c) 2023 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 #ifndef __SEQ_H__
23 #define __SEQ_H__
24 
25 #include "HALhwio.h"
26 
27 #define SEQ_INH(base, regtype, reg) \
28         SEQ_##regtype##_INH(base, reg)
29 
30 #define SEQ_INMH(base, regtype, reg, mask) \
31         SEQ_##regtype##_INMH(base, reg, mask)
32 
33 #define SEQ_INFH(base, regtype, reg, fld) \
34         (SEQ_##regtype##_INMH(base, reg, HWIO_FMSK(regtype, fld)) >> HWIO_SHFT(regtype, fld))
35 
36 #define SEQ_OUTH(base, regtype, reg, val) \
37         SEQ_##regtype##_OUTH(base, reg, val)
38 
39 #define SEQ_OUTMH(base, regtype, reg, mask, val) \
40         SEQ_##regtype##_OUTMH(base, reg, mask, val)
41 
42 #define SEQ_OUTFH(base, regtype, reg, fld, val) \
43         SEQ_##regtype##_OUTMH(base, reg, HWIO_FMSK(regtype, fld), val << HWIO_SHFT(regtype, fld))
44 
45 typedef enum {
46     SEC,
47     MS,
48     US,
49     NS
50 } SEQ_TimeUnit;
51 
52 extern void seq_wait(uint32 time_value, SEQ_TimeUnit time_unit);
53 
54 extern uint32 seq_poll(uint32 reg_offset, uint32 expect_value, uint32 value_mask, uint32 value_shift, uint32 max_poll_cnt);
55 
56 #endif
57 
58