xref: /wlan-driver/fw-api/hw/qca6390/v1/seq_hwio.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2018 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 /*********************************************************************************
20  *
21  * DESCRIPTION
22  * - This is an extension of standard msmhwio.h to support relative addressing
23  *   scheme used in SCALe auto-generated sequences.
24  * - The objective of this new addressing scheme is enable the same C function
25  *   definition to be applicable to multiple baseances of the same block.
26  * - Such code reuse is not feasible with the standard HWIO macros that use a
27  *   absolute addressing scheme.
28  * - Compared to the standard HWIO macros, the new macros defined here take an
29  *   additional parameter 'baseance offset'.  So are the C functions generated
30  *   by SCALe Autoseq from .seq inputs.
31  * - As such, macros defined in this file must be used with 'seq_msmhwiobase.h',
32  *   'seq_msmhwioreg.h', and the C codes generated from SCALe Autoseq.
33  * - Macros defined in this file leverage the lower-level macros from the
34  *   standard 'msmhwio.h', and the two sets of macros are compatible.
35 ********************************************************************************/
36 
37 #ifndef __SEQ_H__
38 #define __SEQ_H__
39 
40 #include "HALhwio.h"
41 
42 
43 
44 /**** Register Ref Read ****/
45 #define SEQ_INH(base, regtype, reg) \
46         SEQ_##regtype##_INH(base, reg)
47 
48 /**** Masked Register Read ****/
49 #define SEQ_INMH(base, regtype, reg, mask) \
50         SEQ_##regtype##_INMH(base, reg, mask)
51 
52 
53 /**** Ref Reg Field Read ****/
54 #define SEQ_INFH(base, regtype, reg, fld) \
55         (SEQ_##regtype##_INMH(base, reg, HWIO_FMSK(regtype, fld)) >> HWIO_SHFT(regtype, fld))
56 
57 
58 /**** Ref Register  Write ****/
59 #define SEQ_OUTH(base, regtype, reg, val) \
60         SEQ_##regtype##_OUTH(base, reg, val)
61 
62 /**** Ref Register Masked Write ****/
63 #define SEQ_OUTMH(base, regtype, reg, mask, val) \
64         SEQ_##regtype##_OUTMH(base, reg, mask, val)
65 
66 
67 /**** Ref Register Field Write ****/
68 #define SEQ_OUTFH(base, regtype, reg, fld, val) \
69         SEQ_##regtype##_OUTMH(base, reg, HWIO_FMSK(regtype, fld), val << HWIO_SHFT(regtype, fld))
70 
71 
72 /**** seq_msg() ****
73 
74 typedef enum {
75 	DEBUG,
76 	INFO,
77 	WARNING,
78 	ERROR,
79 	FATAL
80 } SeverityLevel ;
81 
82 void seq_msg(SeverityLevel severity, unsigned int msg_id, const char *format_str, ... );
83 
84 */
85 
86 /************ seq_wait() ************/
87 
88 typedef enum {
89     SEC,
90     MS,
91     US,
92     NS
93 } SEQ_TimeUnit;
94 
95 extern void seq_wait(uint32 time_value, SEQ_TimeUnit time_unit);
96 
97 
98 /************ seq_poll() ************/
99 extern uint32 seq_poll(uint32 reg_offset, uint32 expect_value, uint32 value_mask, uint32 value_shift, uint32 max_poll_cnt);
100 
101 #endif /* __SEQ_H__ */
102 
103 
104 
105 
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121