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