comparison src/cs/riviera/rvf/rvf_target.h @ 0:4e78acac3d88

src/{condat,cs,gpf,nucleus}: import from Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:23:26 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4e78acac3d88
1 /****************************************************************************/
2 /* */
3 /* Name rvf_target.h */
4 /* */
5 /* Function this file contains definitions that will probably */
6 /* change for each target system. This includes */
7 /* such things number of tasks, */
8 /* little endian/big endian conversions, etc... */
9 /* */
10 /* */
11 /* NOTE This file should always be included first. */
12 /* */
13 /* Version 0.1 */
14 /* */
15 /* Date Modification */
16 /* ------------------------------------ */
17 /* 4/19/1999 Create */
18 /* 10/27/1999 remove declaration of ntohs, htons, ntohl, htonl */
19 /* in order to avoid conflict with winsock.h */
20 /* 12/23/1999 add buffer and memory bank related definition */
21 /* 07/12/2000 implement dynamic memory allocation. */
22 /* 01/16/2004 Corrected conversion from seconds/milliseconds to ticks. */
23 /* */
24 /* Author David Lamy-Charrier (dlamy@tif.ti.com) */
25 /* */
26 /* (C) Copyright 1999 by Texas Instruments Incorporated, All Rights Reserved*/
27 /****************************************************************************/
28 #ifndef _RVF_TARGET_H
29 #define _RVF_TARGET_H
30
31 #ifndef _WINDOWS
32 #include "config/rv.cfg"
33 #include "config/swconfig.cfg"
34 #endif
35
36
37 /* optimizations */
38 #ifdef _WINDOWS
39 #define INLINE __inline
40 #else
41 #define INLINE inline
42 #endif
43
44
45 /*----------------------------------------------------------------------*/
46 /* RVF Definitions */
47 /*----------------------------------------------------------------------*/
48
49
50 /* the maximum number of memory bank created by users */
51 #if (!GSMLITE)
52 #define RVF_MAX_TOTAL_MB 70
53 #else // GSMLITE
54 #define RVF_MAX_TOTAL_MB 20
55 #endif // GSMLITE
56
57 /* the maximum number of real memory bank managed */
58 #if (!GSMLITE)
59 #define RVF_MAX_REAL_MB 60
60 #else // GSMLITE
61 #define RVF_MAX_REAL_MB 20
62 #endif // GSMLITE
63
64 /* max length of memory bank name */
65 #define RVF_MAX_MB_LEN 10
66
67 /* max length of task name */
68 #define RVF_MAX_TASK_LEN 10
69
70
71 /* RVF_MB_MAPPING defines the correspondance between mb_name and mb_id */
72 /* WARNING!!!! When adding new memory banks in this default list, take care */
73 /* to always finish with the {0,0} !!! */
74 #if (!GSMLITE)
75 #define RVF_MB_MAPPING {{ "RVM_PRIM", 0},{ "TEST1", 1}, { "TEST2", 2},\
76 { "TEST3", 3}, { "TEST4", 3},\
77 {"HCI_RX", 4},{"HCI_TX", 5},\
78 {"ATP_PRIM",27},{"ATP_UART",27},\
79 {"RV_TRACE", TRACE_MB_ID},\
80 {"UWIRE_PRIM",37},{0,0}}
81 #else // GSMLITE
82 #define RVF_MB_MAPPING {{ "RVM_PRIM", 0},{ "TEST1", 1}, { "TEST2", 2},\
83 { "TEST3", 3}, { "TEST4", 3}, {0,0}}
84 #endif // GSMLITE
85
86 /* set the following variable to 1 to check for buffer corruption*/
87 #define RVF_ENABLE_BUF_CORRUPTION_CHECK 1
88
89 /* set the following variable to 1 to check for buffer linkage*/
90 #define RVF_ENABLE_BUF_LINKAGE_CHECK 1
91
92 /* enable or disable memory statistics functions */
93 #define RVF_ENABLE_STATS 1
94
95
96 /* The maximum number of RVF tasks allowed in the system*/
97 #if (!GSMLITE)
98 #define MAX_RVF_TASKS 30
99 #else // GSMLITE
100 #define MAX_RVF_TASKS 11
101 #endif // GSMLITE
102
103 /* max number of callback functions for buffers waiting to be counted on another memory bank */
104 #if (!GSMLITE)
105 #define RVF_MAX_WAITING_BUF 300
106 #else // GSMLITE
107 #define RVF_MAX_WAITING_BUF 20
108 #endif // GSMLITE
109 /* sum of RVF_BUFi_MAX */
110
111
112
113
114
115
116
117 /***********************************************************************
118 ** Timer related definitions. These should be edited per system. The
119 ** macros should convert milliseconds and seconds to system ticks.
120 ** Applications should use these to calculate the number of ticks to
121 ** sleep for.
122 */
123
124 #ifdef _WINDOWS
125 #define RVF_MS_TO_TICKS(_x) ((_x) / 50)
126 #define RVF_SECS_TO_TICKS(_x) (((_x) * 1000) / 50)
127 #define RVF_TICKS_TO_MS(_x) ((_x) * 50)
128 #else
129 #if 1 /* new FreeCalypso code */
130 /*
131 * In the present GSM firmware, the Nucleus tick is the TDMA frame,
132 * and the duration of one TDMA frame by definition equals 60/13 ms.
133 * Hence we use the natural factors of 13 and 60 instead of TI's
134 * 200 and 923 (computed to fit the rounded 4.615 ms value),
135 * and get not only better accuracy, but also a greater maximum
136 * time value: 330382 s (just under 4 days) instead of the old maximum
137 * of 21474 s (just under 6 h).
138 */
139 #define RVF_MS_TO_TICKS(_x) ((((_x) * 13) + 30) / 60)
140 #define RVF_SECS_TO_TICKS(_x) ((((_x) * 13000) + 30) / 60)
141 /* RVF_TICKS_TO_MS() macro was unused and is being removed */
142 #else /* old code from TI */
143 /*
144 * To avoid floating point computation, the tick duration 4.615 ms can be
145 * resolved to the fraction : 923/200.
146 *
147 * Due to the multiplication with 200, the maximum usable value for
148 * milliseconds is 2^32 / 200 = 21,474,836. The maximum usable value
149 * for seconds is 2^32 / (200 * 1000) = 21,474.
150 * Both values correspond approximately to 5h 57m 54s.
151 */
152 #define RVF_MS_TO_TICKS(_x) ((((_x) * 200) + 462) / 923)
153 #define RVF_SECS_TO_TICKS(_x) ((((_x) * 1000 * 200) + 462) / 923)
154 #define RVF_TICKS_TO_MS(_x) ((((_x) * 923) + 100) / 200)
155 #endif
156 #endif
157
158 #endif /* _RVF_TARGET_H */