]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/pdk.git/blob - packages/ti/drv/udma/include/udma_rm.h
f4b54192e26efa115d050ebce90549d910147b7d
[processor-sdk/pdk.git] / packages / ti / drv / udma / include / udma_rm.h
1 /*
2  *  Copyright (c) Texas Instruments Incorporated 2018
3  *
4  *  Redistribution and use in source and binary forms, with or without
5  *  modification, are permitted provided that the following conditions
6  *  are met:
7  *
8  *    Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  *
11  *    Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the
14  *    distribution.
15  *
16  *    Neither the name of Texas Instruments Incorporated nor the names of
17  *    its contributors may be used to endorse or promote products derived
18  *    from this software without specific prior written permission.
19  *
20  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
33 /**
34  *  \ingroup DRV_UDMA_MODULE
35  *  \defgroup DRV_UDMA_RM_MODULE UDMA Driver RM API
36  *            This is UDMA driver resource manager related configuration
37  *            parameters and API
38  *
39  *  @{
40  */
42 /**
43  *  \file udma_rm.h
44  *
45  *  \brief UDMA RM related parameters and API.
46  */
48 #ifndef UDMA_RM_H_
49 #define UDMA_RM_H_
51 /* ========================================================================== */
52 /*                             Include Files                                  */
53 /* ========================================================================== */
55 /* None */
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
61 /* ========================================================================== */
62 /*                           Macros & Typedefs                                */
63 /* ========================================================================== */
65 /* None */
67 /* ========================================================================== */
68 /*                         Structure Declarations                             */
69 /* ========================================================================== */
71 /**
72  *  \brief UDMA resource manager init parameters.
73  *
74  *  This assumes contiguos allocation of 'N' resources from a start offset
75  *  to keep the interface simple.
76  *
77  *  Note: This is applicable for the driver handle as given during init call.
78  *  The init call doesn't (can't rather) check for resource overlap across
79  *  handles and across cores. It is the callers responsibility to ensure that
80  *  resources overlaps are not present.
81  */
82 typedef struct
83 {
84     uint32_t                startBlkCopyUhcCh;
85     /**< Start ultra high capacity block copy channel from which this UDMA
86      *   driver instance manages */
87     uint32_t                numBlkCopyUhcCh;
88     /**< Number of ultra high capacity block copy channel to be managed.
89      *   Note: This cannot exceed #UDMA_RM_MAX_BLK_COPY_UHC_CH */
90     uint32_t                startBlkCopyHcCh;
91     /**< Start high capacity block copy channel from which this UDMA
92      *   driver instance manages */
93     uint32_t                numBlkCopyHcCh;
94     /**< Number of ultra high capacity block copy channel to be managed.
95      *   Note: This cannot exceed #UDMA_RM_MAX_BLK_COPY_HC_CH */
96     uint32_t                startBlkCopyCh;
97     /**< Start Block copy channel from which this UDMA driver instance manages */
98     uint32_t                numBlkCopyCh;
99     /**< Number of Block copy channel to be managed.
100      *   Note: This cannot exceed #UDMA_RM_MAX_BLK_COPY_CH */
102     uint32_t                startTxUhcCh;
103     /**< Start ultra high capacity TX channel from which this UDMA driver
104      *   instance manages */
105     uint32_t                numTxUhcCh;
106     /**< Number of ultra high capacity TX channel to be managed.
107      *   Note: This cannot exceed #UDMA_RM_MAX_TX_UHC_CH */
108     uint32_t                startTxHcCh;
109     /**< Start high capacity TX channel from which this UDMA driver instance
110      *   manages */
111     uint32_t                numTxHcCh;
112     /**< Number of high capacity TX channel to be managed.
113      *   Note: This cannot exceed #UDMA_RM_MAX_TX_HC_CH */
114     uint32_t                startTxCh;
115     /**< Start TX channel from which this UDMA driver instance manages */
116     uint32_t                numTxCh;
117     /**< Number of TX channel to be managed.
118      *   Note: This cannot exceed #UDMA_RM_MAX_TX_CH */
120     uint32_t                startRxUhcCh;
121     /**< Start ultra high capacity RX channel from which this UDMA driver
122      *   instance manages */
123     uint32_t                numRxUhcCh;
124     /**< Number of high capacity RX channel to be managed.
125      *   Note: This cannot exceed #UDMA_RM_MAX_RX_UHC_CH */
126     uint32_t                startRxHcCh;
127     /**< Start high capacity RX channel from which this UDMA driver instance
128      *   manages */
129     uint32_t                numRxHcCh;
130     /**< Number of high capacity RX channel to be managed.
131      *   Note: This cannot exceed #UDMA_RM_MAX_RX_HC_CH */
132     uint32_t                startRxCh;
133     /**< Start RX channel from which this UDMA driver instance manages */
134     uint32_t                numRxCh;
135     /**< Number of RX channel to be managed.
136      *   Note: This cannot exceed #UDMA_RM_MAX_RX_CH */
138 #if (UDMA_NUM_UTC_INSTANCE > 0)
139     uint32_t                startUtcCh[UDMA_NUM_UTC_INSTANCE];
140     /**< Start External UTC channel from which this UDMA driver instance
141      *   manages */
142     uint32_t                numUtcCh[UDMA_NUM_UTC_INSTANCE];
143     /**< Number of External UTC channel to be managed.
144      *   Note: This cannot exceed #UDMA_RM_MAX_UTC_CH_PER_INST */
145 #endif
147     uint32_t                startFreeFlow;
148     /**< Start free flow from which this UDMA driver instance manages */
149     uint32_t                numFreeFlow;
150     /**< Number of free flow to be managed.
151      *   Note: This cannot exceed #UDMA_RM_MAX_FREE_FLOW */
152     uint32_t                startFreeRing;
153     /**< Start free ring from which this UDMA driver instance manages */
154     uint32_t                numFreeRing;
155     /**< Number of free ring to be managed.
156      *   Note: This cannot exceed #UDMA_RM_MAX_FREE_RING */
158     uint32_t                startGlobalEvent;
159     /**< Start global event from which this UDMA driver instance manages */
160     uint32_t                numGlobalEvent;
161     /**< Number of global event to be managed.
162      *   Note: This cannot exceed #UDMA_RM_MAX_GLOBAL_EVENT */
163     uint32_t                startVintr;
164     /**< Start VINT number from which this UDMA driver instance manages */
165     uint32_t                numVintr;
166     /**< Number of VINT to be managed.
167      *   Note: This cannot exceed #UDMA_RM_MAX_VINTR */
168     uint32_t                startIrIntr;
169     /**< Start core interrupt from which this UDMA driver instance manages.
170      *
171      *   Note: Incase of C7x, this represents the GIC SPI events to the CLEC.
172      *   For routing this event, the driver further uses the startC7xCoreIntr
173      *   parameter as the start C7x interrupt and assumes that numIrIntr
174      *   C7x interrupt are used by UDMA driver for one to one mapping.
175      *   The UDMA driver directly programs the CLEC for this routing
176      *
177      *   Example: startIrIntr = 700, numIrIntr = 3, startC7xCoreIntr = 32
178      *
179      *   First Event registration:
180      *   CLEC input         : 700+1024-32
181      *   CLEC output        : 32
182      *   OSAL registration  : 32
183      *
184      *   Second Event registration:
185      *   CLEC input         : 701+1024-32
186      *   CLEC output        : 33
187      *   OSAL registration  : 33
188      */
189     uint32_t                numIrIntr;
190     /**< Number of core interrupts to be managed.
191      *   Note: This cannot exceed #UDMA_RM_MAX_CORE_INTR */
193     uint32_t                proxyThreadNum;
194     /**< Proxy thread to push/pop to ring in proxy mode.
195      *   By default driver will initialize to a default value based on
196      *   core and NAVSS instance. User can override this based on need.
197      *   The default proxy allocation starts from #UDMA_DEFAULT_RM_PROXY_THREAD_START
198      *   and will allocate 1 per core. So total allocation will be from
199      *   #UDMA_DEFAULT_RM_PROXY_THREAD_START to
200      *   (#UDMA_DEFAULT_RM_PROXY_THREAD_START + num cores) in an SOC.
201      *
202      *   The proxy thread number should be allocated within a NAVSS instance
203      *   as a proxy can access ring only within the same NAVSS instance. The
204      *   driver assumes the right proxy instance to use based on the
205      *   instance ID (instId) provided in #Udma_init API
206      *
207      *   Also this should be set a unique number across core and NAVSS
208      *   instance. Care should be taken not to use the same proxy across
209      *   the system.
210      *
211      *   Warning: When using multiple UDMA handle for the same NAVSS instance
212      *   within a core, care should taken to provide a unique proxy number
213      *   per handle. Otherwise the the driver handle will use the same
214      *   proxy for ring operation and will result in unintended behaviour and
215      *   corruption of ring memory/operation.
216      */
217     uint32_t                startC7xCoreIntr;
218     /**< Start C7x core interrupt from which this UDMA driver instance manages.
219      *   This assumes numIrIntr contiguous interrupts from this offset is
220      *   reserved for the UDMA driver.
221      *   This is NA for other cores and could be set to 0.
222      */
223     uint32_t                startProxy;
224     /**< Start proxy from which this UDMA driver instance manages.
225      *   Note this should not overlap with proxyThreadNum */
226     uint32_t                numProxy;
227     /**< Number of proxy to be managed.
228      *   Note: This cannot exceed #UDMA_RM_MAX_PROXY */
229     uint32_t                startRingMon;
230     /**< Start monitor from which this UDMA driver instance manages */
231     uint32_t                numRingMon;
232     /**< Number of monitors to be managed.
233      *   Note: This cannot exceed #UDMA_RM_MAX_RING_MON */
234 } Udma_RmInitPrms;
236 /* ========================================================================== */
237 /*                          Function Declarations                             */
238 /* ========================================================================== */
240 /**
241  *  \brief Returns the default RM config structure based on instance and core.
242  *  User can use this API to get the default config and override as per need.
243  *
244  *  Note: The driver internally uses this same API to init the #Udma_RmInitPrms
245  *  structure in #UdmaInitPrms_init API
246  *
247  *  \param instId       [IN] \ref Udma_InstanceId
248  *
249  *  \return Const pointer to default RM init config #Udma_RmInitPrms
250  */
251 const Udma_RmInitPrms *Udma_rmGetDefaultCfg(uint32_t instId);
253 /**
254  *  \brief API to check the default configuration across all instance and cores.
255  *
256  *  \return \ref Udma_ErrorCodes
257  */
258 int32_t Udma_rmCheckDefaultCfg(void);
260 /* ========================================================================== */
261 /*                       Static Function Definitions                          */
262 /* ========================================================================== */
264 /* None */
266 /* ========================================================================== */
267 /*                  Internal/Private Structure Declarations                   */
268 /* ========================================================================== */
270 /* None */
272 #ifdef __cplusplus
274 #endif
276 #endif /* #ifndef UDMA_RM_H_ */
278 /* @} */