carl9170: Update to latest upstream
[linux-libre-firmware.git] / ath9k_htc / sboot / magpie_1_1 / sboot / athos / src / xtos / xtos-params.h
1 /*
2  * xtos-params.h  --  user-settable parameters for XTOS single-threaded run-time
3  *
4  * Copyright (c) 2002, 2004, 2006-2007 Tensilica Inc.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining
7  * a copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sublicense, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included
15  * in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  */
25
26 #ifndef XTOS_PARAMS_H
27 #define XTOS_PARAMS_H
28
29 /*
30  *  IMPORTANT NOTE.
31  *  This file contains XTOS parameters that may be modified
32  *  according to needs.  HOWEVER, any modifications are NOT
33  *  supported.  Handling of parameters other than the defaults
34  *  provided in the original version of this file are for
35  *  illustrative and educational purposes only.  If you do
36  *  change the parameters here-in (which requires rebuilding
37  *  XTOS), please verify the resulting code extensively
38  *  before even considering its use in production code.
39  *
40  *  To rebuild XTOS, see instructions in the Xtensa System Software
41  *  Reference Manual.  The following sequence is no longer supported.
42  *
43  *      cd <config_dir>/xtensa-elf/src/handlers
44  *      xt-make clean
45  *      xt-make
46  *      xt-make install
47  *
48  *  (Note: the last step installs the modified XTOS in *ALL*
49  *  LSPs that normally include XTOS.  You may prefer copying
50  *  the generated files to your own custom LSP instead.  Or
51  *  better yet, also make a copy of all source files and maintain
52  *  them somewhere completely separate -- which may require
53  *  minor adjustments to the makefile.)
54  *
55  *  PERFORMANCE TUNING:
56  *  To slightly improve performance of interrupt dispatching,
57  *  you can do some combination of the following:
58  *      - change XTOS_SUBPRI to zero
59  *      - change XTOS_SUBPRI_GROUPS to zero
60  *      - change XTOS_SUBPRI_ORDER to XTOS_SPO_ZERO_HI
61  *      - change XTOS_DEBUG_PC to zero
62  *      - change XTOS_INT_FAIRNESS to zero
63  *      - change XTOS_CNEST to zero
64  *  There are non-trivial trade-offs in making such changes however,
65  *  such as loss of support (see important note above), loss of
66  *  interrupt scheduling fairness, loss of ability to traceback
67  *  interrupt handlers across interrupted code when debugging them,
68  *  loss of supported for nested C functions, etc.
69  */
70
71
72 /*
73  *  Lower LOCKLEVEL to XCHAL_EXCM_LEVEL for improved interrupt latency
74  *  if you don't register C handlers for high-priority interrupts and your
75  *  high-priority handlers don't touch INTENABLE nor virtual priorities.
76  *
77  *  XTOS_LOCKLEVEL is less meaningful but still relevant if XEA2 and SUBPRI is zero,
78  *  ie. if INTENABLE doesn't get virtualized (XTOS_VIRTUAL_INTENABLE not set);
79  *  in this case, it is the interrupt level at which INTENABLE accesses are guarded,
80  *  so that interrupt handlers up to this level can safely manipulate INTENABLE.
81  */
82 #define XTOS_LOCKLEVEL          XCHAL_NUM_INTLEVELS     /* intlevel of INTENABLE register virtualization
83                                                            (minimum is EXCM_LEVEL) */
84
85 /*
86  *  NOTE:  the following four parameters (SUBPRI, SUBPRI_GROUPS, SUBPRI_ORDER, INT_FAIRNESS)
87  *  are irrelevant and ignored for interrupt vectors to which only one interrupt is mapped.
88  */
89
90 #define XTOS_SUBPRI             1       /* set to 0 if you don't need sub-prioritization
91                                            within level-one interrupts via software;
92                                            for XEA2 configs, this might improve performance of
93                                            certain sections of code, because INTENABLE register
94                                            virtualization becomes unnecessary in this case */
95
96 /*  Ignored unless SUBPRI set:  */
97 #define XTOS_SUBPRI_GROUPS      1       /* support selective grouping of interrupts at the same priority */
98
99 #define XTOS_SUBPRI_ORDER       XTOS_SPO_ZERO_LO        /* one of XTOS_SPO_ZERO_LO, XTOS_SPO_ZERO_HI */
100
101 /*  Ignored if SUBPRI set but SUBPRI_GROUPS is not (single interrupt per subpri),
102  *  or if single interrupt configured at level/vector:  */
103 #define XTOS_INT_FAIRNESS       1       /* disable round-robin/fifo scheduling of interrupt
104                                            handlers of a given level or sub-priority */
105
106
107 #define XTOS_DEBUG_PC           1       /* enable nice stack traceback showing interrupted code
108                                            when debugging interrupt or exception handler;
109                                            not implemented for high-priority handlers, or
110                                            for call0 ABI */
111
112 #define XTOS_CNEST              1       /* enable support for nested C functions
113                                            (save/restore nested C function call-chain pointer) */
114
115 /*  Current compilers only use ACC (not MRn) when MAC16 is enabled, so you can leave this 0 for performance:  */
116 #define XTOS_SAVE_ALL_MAC16     0       /* set to save/restore MAC16 MRn registers */
117
118 /*  Setting this might be useful to clear X's in hardware simulation a bit earlier, but
119  *  should not be needed in production code:  */
120 #define XTOS_RESET_UNNEEDED     0       /* set to reset more registers than are really needed */
121
122 #endif /* XTOS_PARAMS_H */
123