1 /* Copyright (c) 2008-2011 Freescale Semiconductor, Inc.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above copyright
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution.
11 * * Neither the name of Freescale Semiconductor nor the
12 * names of its contributors may be used to endorse or promote products
13 * derived from this software without specific prior written permission.
16 * ALTERNATIVELY, this software may be distributed under the terms of the
17 * GNU General Public License ("GPL") as published by the Free Software
18 * Foundation, either version 2 of that License or (at your option) any
21 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
22 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
25 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 /**************************************************************************//**
36 @Description FM Application Programming Interface.
37 *//***************************************************************************/
41 #include "error_ext.h"
46 /**************************************************************************//**
47 @Group FM_grp Frame Manager API
49 @Description FM API functions, definitions and enums.
52 *//***************************************************************************/
54 /**************************************************************************//**
55 @Group FM_lib_grp FM library
57 @Description FM API functions, definitions and enums
58 The FM module is the main driver module and is a mandatory module
59 for FM driver users. Before any further module initialization,
60 this module must be initialized.
61 The FM is a "singletone" module. It is responsible of the common
62 HW modules: FPM, DMA, common QMI, common BMI initializations and
63 run-time control routines. This module must be initialized always
64 when working with any of the FM modules.
65 NOTE - We assumes that the FML will be initialize only by core No. 0!
68 *//***************************************************************************/
70 /**************************************************************************//**
71 @Description enum for defining port types
72 *//***************************************************************************/
73 typedef enum e_FmPortType {
74 e_FM_PORT_TYPE_OH_OFFLINE_PARSING = 0, /**< Offline parsing port (id's: 0-6, share id's with
75 host command, so must have exclusive id) */
76 e_FM_PORT_TYPE_OH_HOST_COMMAND, /**< Host command port (id's: 0-6, share id's with
77 offline parsing ports, so must have exclusive id) */
78 e_FM_PORT_TYPE_RX, /**< 1G Rx port (id's: 0-3) */
79 e_FM_PORT_TYPE_RX_10G, /**< 10G Rx port (id's: 0) */
80 e_FM_PORT_TYPE_TX, /**< 1G Tx port (id's: 0-3) */
81 e_FM_PORT_TYPE_TX_10G, /**< 10G Tx port (id's: 0) */
85 /**************************************************************************//**
86 @Collection General FM defines
87 *//***************************************************************************/
88 #define FM_MAX_NUM_OF_PARTITIONS 64 /**< Maximum number of partitions */
89 #define FM_PHYS_ADDRESS_SIZE 6 /**< FM Physical address size */
93 #if defined(__MWERKS__) && !defined(__GNUC__)
95 #endif /* defined(__MWERKS__) && ... */
98 /**************************************************************************//**
99 @Description FM physical Address
100 *//***************************************************************************/
101 typedef _Packed struct t_FmPhysAddr {
102 volatile uint8_t high; /**< High part of the physical address */
103 volatile uint32_t low; /**< Low part of the physical address */
104 } _PackedType t_FmPhysAddr;
106 /**************************************************************************//**
107 @Description Parse results memory layout
108 *//***************************************************************************/
109 typedef _Packed struct t_FmPrsResult {
110 volatile uint8_t lpid; /**< Logical port id */
111 volatile uint8_t shimr; /**< Shim header result */
112 volatile uint16_t l2r; /**< Layer 2 result */
113 volatile uint16_t l3r; /**< Layer 3 result */
114 volatile uint8_t l4r; /**< Layer 4 result */
115 volatile uint8_t cplan; /**< Classification plan id */
116 volatile uint16_t nxthdr; /**< Next Header */
117 volatile uint16_t cksum; /**< Checksum */
118 volatile uint32_t lcv; /**< LCV */
119 volatile uint8_t shim_off[3]; /**< Shim offset */
120 volatile uint8_t eth_off; /**< ETH offset */
121 volatile uint8_t llc_snap_off; /**< LLC_SNAP offset */
122 volatile uint8_t vlan_off[2]; /**< VLAN offset */
123 volatile uint8_t etype_off; /**< ETYPE offset */
124 volatile uint8_t pppoe_off; /**< PPP offset */
125 volatile uint8_t mpls_off[2]; /**< MPLS offset */
126 volatile uint8_t ip_off[2]; /**< IP offset */
127 volatile uint8_t gre_off; /**< GRE offset */
128 volatile uint8_t l4_off; /**< Layer 4 offset */
129 volatile uint8_t nxthdr_off; /**< Parser end point */
130 } _PackedType t_FmPrsResult;
132 /**************************************************************************//**
133 @Collection FM Parser results
134 *//***************************************************************************/
135 #define FM_PR_L2_VLAN_STACK 0x00000100 /**< Parse Result: VLAN stack */
136 #define FM_PR_L2_ETHERNET 0x00008000 /**< Parse Result: Ethernet*/
137 #define FM_PR_L2_VLAN 0x00004000 /**< Parse Result: VLAN */
138 #define FM_PR_L2_LLC_SNAP 0x00002000 /**< Parse Result: LLC_SNAP */
139 #define FM_PR_L2_MPLS 0x00001000 /**< Parse Result: MPLS */
140 #define FM_PR_L2_PPPoE 0x00000800 /**< Parse Result: PPPoE */
143 /**************************************************************************//**
144 @Collection FM Frame descriptor macros
145 *//***************************************************************************/
146 #define FM_FD_CMD_FCO 0x80000000 /**< Frame queue Context Override */
147 #define FM_FD_CMD_RPD 0x40000000 /**< Read Prepended Data */
148 #define FM_FD_CMD_UPD 0x20000000 /**< Update Prepended Data */
149 #define FM_FD_CMD_DTC 0x10000000 /**< Do L4 Checksum */
150 #define FM_FD_CMD_DCL4C 0x10000000 /**< Didn't calculate L4 Checksum */
151 #define FM_FD_CMD_CFQ 0x00ffffff /**< Confirmation Frame Queue */
153 #define FM_FD_TX_STATUS_ERR_MASK 0x07000000 /**< TX Error FD bits */
154 #define FM_FD_RX_STATUS_ERR_MASK 0x070ee3f8 /**< RX Error FD bits */
157 /**************************************************************************//**
158 @Description Context A
159 *//***************************************************************************/
160 typedef _Packed struct t_FmContextA {
161 volatile uint32_t command; /**< ContextA Command */
162 volatile uint8_t res0[4]; /**< ContextA Reserved bits */
163 } _PackedType t_FmContextA;
165 /**************************************************************************//**
166 @Description Context B
167 *//***************************************************************************/
168 typedef uint32_t t_FmContextB;
170 /**************************************************************************//**
171 @Collection Context A macros
172 *//***************************************************************************/
173 #define FM_CONTEXTA_OVERRIDE_MASK 0x80000000
174 #define FM_CONTEXTA_ICMD_MASK 0x40000000
175 #define FM_CONTEXTA_A1_VALID_MASK 0x20000000
176 #define FM_CONTEXTA_MACCMD_MASK 0x00ff0000
177 #define FM_CONTEXTA_MACCMD_VALID_MASK 0x00800000
178 #define FM_CONTEXTA_MACCMD_SECURED_MASK 0x00100000
179 #define FM_CONTEXTA_MACCMD_SC_MASK 0x000f0000
180 #define FM_CONTEXTA_A1_MASK 0x0000ffff
182 #define FM_CONTEXTA_GET_OVERRIDE(contextA) ((((t_FmContextA *)contextA)->command & FM_CONTEXTA_OVERRIDE_MASK) >> (31-0))
183 #define FM_CONTEXTA_GET_ICMD(contextA) ((((t_FmContextA *)contextA)->command & FM_CONTEXTA_ICMD_MASK) >> (31-1))
184 #define FM_CONTEXTA_GET_A1_VALID(contextA) ((((t_FmContextA *)contextA)->command & FM_CONTEXTA_A1_VALID_MASK) >> (31-2))
185 #define FM_CONTEXTA_GET_A1(contextA) ((((t_FmContextA *)contextA)->command & FM_CONTEXTA_A1_MASK) >> (31-31))
186 #define FM_CONTEXTA_GET_MACCMD(contextA) ((((t_FmContextA *)contextA)->command & FM_CONTEXTA_MACCMD_MASK) >> (31-15))
187 #define FM_CONTEXTA_GET_MACCMD_VALID(contextA) ((((t_FmContextA *)contextA)->command & FM_CONTEXTA_MACCMD_VALID_MASK) >> (31-8))
188 #define FM_CONTEXTA_GET_MACCMD_SECURED(contextA) ((((t_FmContextA *)contextA)->command & FM_CONTEXTA_MACCMD_SECURED_MASK) >> (31-11))
189 #define FM_CONTEXTA_GET_MACCMD_SECURE_CHANNEL(contextA) ((((t_FmContextA *)contextA)->command & FM_CONTEXTA_MACCMD_SC_MASK) >> (31-15))
191 #define FM_CONTEXTA_SET_OVERRIDE(contextA,val) (((t_FmContextA *)contextA)->command = (uint32_t)((((t_FmContextA *)contextA)->command & ~FM_CONTEXTA_OVERRIDE_MASK) | (((uint32_t)(val) << (31-0)) & FM_CONTEXTA_OVERRIDE_MASK) ))
192 #define FM_CONTEXTA_SET_ICMD(contextA,val) (((t_FmContextA *)contextA)->command = (uint32_t)((((t_FmContextA *)contextA)->command & ~FM_CONTEXTA_ICMD_MASK) | (((val) << (31-1)) & FM_CONTEXTA_ICMD_MASK) ))
193 #define FM_CONTEXTA_SET_A1_VALID(contextA,val) (((t_FmContextA *)contextA)->command = (uint32_t)((((t_FmContextA *)contextA)->command & ~FM_CONTEXTA_A1_VALID_MASK) | (((val) << (31-2)) & FM_CONTEXTA_A1_VALID_MASK) ))
194 #define FM_CONTEXTA_SET_A1(contextA,val) (((t_FmContextA *)contextA)->command = (uint32_t)((((t_FmContextA *)contextA)->command & ~FM_CONTEXTA_A1_MASK) | (((val) << (31-31)) & FM_CONTEXTA_A1_MASK) ))
195 #define FM_CONTEXTA_SET_MACCMD(contextA,val) (((t_FmContextA *)contextA)->command = (uint32_t)((((t_FmContextA *)contextA)->command & ~FM_CONTEXTA_MACCMD_MASK) | (((val) << (31-15)) & FM_CONTEXTA_MACCMD_MASK) ))
196 #define FM_CONTEXTA_SET_MACCMD_VALID(contextA,val) (((t_FmContextA *)contextA)->command = (uint32_t)((((t_FmContextA *)contextA)->command & ~FM_CONTEXTA_MACCMD_VALID_MASK) | (((val) << (31-8)) & FM_CONTEXTA_MACCMD_VALID_MASK) ))
197 #define FM_CONTEXTA_SET_MACCMD_SECURED(contextA,val) (((t_FmContextA *)contextA)->command = (uint32_t)((((t_FmContextA *)contextA)->command & ~FM_CONTEXTA_MACCMD_SECURED_MASK) | (((val) << (31-11)) & FM_CONTEXTA_MACCMD_SECURED_MASK) ))
198 #define FM_CONTEXTA_SET_MACCMD_SECURE_CHANNEL(contextA,val) (((t_FmContextA *)contextA)->command = (uint32_t)((((t_FmContextA *)contextA)->command & ~FM_CONTEXTA_MACCMD_SC_MASK) | (((val) << (31-15)) & FM_CONTEXTA_MACCMD_SC_MASK) ))
201 /**************************************************************************//**
202 @Collection Context B macros
203 *//***************************************************************************/
204 #define FM_CONTEXTB_FQID_MASK 0x00ffffff
206 #define FM_CONTEXTB_GET_FQID(contextB) (*((t_FmContextB *)contextB) & FM_CONTEXTB_FQID_MASK)
207 #define FM_CONTEXTB_SET_FQID(contextB,val) (*((t_FmContextB *)contextB) = ((*((t_FmContextB *)contextB) & ~FM_CONTEXTB_FQID_MASK) | ((val) & FM_CONTEXTB_FQID_MASK)))
211 #if defined(__MWERKS__) && !defined(__GNUC__)
213 #endif /* defined(__MWERKS__) && ... */
216 /**************************************************************************//**
217 @Description FM Exceptions
218 *//***************************************************************************/
219 typedef enum e_FmExceptions {
220 e_FM_EX_DMA_BUS_ERROR, /**< DMA bus error. */
221 e_FM_EX_DMA_READ_ECC, /**< Read Buffer ECC error */
222 e_FM_EX_DMA_SYSTEM_WRITE_ECC, /**< Write Buffer ECC error on system side */
223 e_FM_EX_DMA_FM_WRITE_ECC, /**< Write Buffer ECC error on FM side */
224 e_FM_EX_FPM_STALL_ON_TASKS, /**< Stall of tasks on FPM */
225 e_FM_EX_FPM_SINGLE_ECC, /**< Single ECC on FPM. */
226 e_FM_EX_FPM_DOUBLE_ECC, /**< Double ECC error on FPM ram access */
227 e_FM_EX_QMI_SINGLE_ECC, /**< Single ECC on QMI. */
228 e_FM_EX_QMI_DOUBLE_ECC, /**< Double bit ECC occurred on QMI */
229 e_FM_EX_QMI_DEQ_FROM_UNKNOWN_PORTID,/**< Dequeu from unknown port id */
230 e_FM_EX_BMI_LIST_RAM_ECC, /**< Linked List RAM ECC error */
231 e_FM_EX_BMI_PIPELINE_ECC, /**< Pipeline Table ECC Error */
232 e_FM_EX_BMI_STATISTICS_RAM_ECC, /**< Statistics Count RAM ECC Error Enable */
233 e_FM_EX_BMI_DISPATCH_RAM_ECC, /**< Dispatch RAM ECC Error Enable */
234 e_FM_EX_IRAM_ECC, /**< Double bit ECC occurred on IRAM*/
235 e_FM_EX_MURAM_ECC /**< Double bit ECC occurred on MURAM*/
238 /**************************************************************************//**
239 @Group FM_init_grp FM Initialization Unit
241 @Description FM Initialization Unit
244 Initialization of the FM Module will be carried out by the application
245 according to the following sequence:
246 a. Calling the configuration routine with basic parameters.
247 b. Calling the advance initialization routines to change driver's defaults.
248 c. Calling the initialization routine.
251 *//***************************************************************************/
253 /**************************************************************************//**
254 @Function t_FmExceptionsCallback
256 @Description Exceptions user callback routine, will be called upon an
257 exception passing the exception identification.
259 @Param[in] h_App - User's application descriptor.
260 @Param[in] exception - The exception.
261 *//***************************************************************************/
262 typedef void (t_FmExceptionsCallback) (t_Handle h_App,
263 e_FmExceptions exception);
265 /**************************************************************************//**
266 @Function t_FmBusErrorCallback
268 @Description Bus error user callback routine, will be called upon a
269 bus error, passing parameters describing the errors and the owner.
271 @Param[in] h_App - User's application descriptor.
272 @Param[in] portType - Port type (e_FmPortType)
273 @Param[in] portId - Port id - relative to type.
274 @Param[in] addr - Address that caused the error
275 @Param[in] tnum - Owner of error
276 @Param[in] liodn - Logical IO device number
277 *//***************************************************************************/
278 typedef void (t_FmBusErrorCallback) (t_Handle h_App,
279 e_FmPortType portType,
285 /**************************************************************************//**
286 @Description structure for defining Ucode patch for loading.
287 *//***************************************************************************/
288 typedef struct t_FmPcdFirmwareParams {
289 uint32_t size; /**< Size of uCode */
290 uint32_t *p_Code; /**< A pointer to the uCode */
291 } t_FmPcdFirmwareParams;
293 /**************************************************************************//**
294 @Description structure representing FM initialization parameters
295 *//***************************************************************************/
296 #define FM_SIZE_OF_LIODN_TABLE 64
297 typedef struct t_FmParams {
298 uint8_t fmId; /**< Index of the FM */
300 uint8_t guestId; /**< FM Partition Id */
302 uintptr_t baseAddr; /**< Relevant when guestId = NCSW_MASSTER_ID only.
303 A pointer to base of memory mapped FM registers (virtual);
304 NOTE that this should include ALL common regs of the FM including
305 the PCD regs area. */
306 t_Handle h_FmMuram; /**< Relevant when guestId = NCSW_MASSTER_ID only.
307 A handle of an initialized MURAM object,
308 to be used by the FM */
309 uint16_t fmClkFreq; /**< Relevant when guestId = NCSW_MASSTER_ID only.
311 #ifdef FM_PARTITION_ARRAY
312 uint16_t liodnBasePerPort[FM_SIZE_OF_LIODN_TABLE];
313 /**< Relevant when guestId = NCSW_MASSTER_ID only.
314 For each partition, LIODN should be configured here. */
315 #endif /* FM_PARTITION_ARRAY */
316 t_FmExceptionsCallback *f_Exception; /**< Relevant when guestId = NCSW_MASSTER_ID only.
317 An application callback routine to
319 t_FmBusErrorCallback *f_BusError; /**< Relevant when guestId = NCSW_MASSTER_ID only.
320 An application callback routine to
322 t_Handle h_App; /**< Relevant when guestId = NCSW_MASSTER_ID only.
323 A handle to an application layer object; This handle will
324 be passed by the driver upon calling the above callbacks */
325 uintptr_t irq; /**< Relevant when guestId = NCSW_MASSTER_ID only.
326 FM interrupt source for normal events */
327 uintptr_t errIrq; /**< Relevant when guestId = NCSW_MASSTER_ID only.
328 FM interrupt source for errors */
329 t_FmPcdFirmwareParams firmware; /**< Relevant when guestId = NCSW_MASSTER_ID only.
334 /**************************************************************************//**
337 @Description Creates descriptor for the FM module.
339 The routine returns a handle (descriptor) to the FM object.
340 This descriptor must be passed as first parameter to all other
343 No actual initialization or configuration of FM hardware is
344 done by this routine.
346 @Param[in] p_FmParams - A pointer to data structure of parameters
348 @Return Handle to FM object, or NULL for Failure.
349 *//***************************************************************************/
350 t_Handle FM_Config(t_FmParams *p_FmParams);
352 /**************************************************************************//**
355 @Description Initializes the FM module
357 @Param[in] h_Fm - FM module descriptor
359 @Return E_OK on success; Error code otherwise.
360 *//***************************************************************************/
361 t_Error FM_Init(t_Handle h_Fm);
363 /**************************************************************************//**
366 @Description Frees all resources that were assigned to FM module.
368 Calling this routine invalidates the descriptor.
370 @Param[in] h_Fm - FM module descriptor
372 @Return E_OK on success; Error code otherwise.
373 *//***************************************************************************/
374 t_Error FM_Free(t_Handle h_Fm);
377 /**************************************************************************//**
378 @Group FM_advanced_init_grp FM Advanced Configuration Unit
380 @Description Configuration functions used to change default values;
381 Note: Advanced init routines are not available for guest partition.
383 *//***************************************************************************/
385 /**************************************************************************//**
386 @Description DMA debug mode
387 *//***************************************************************************/
388 typedef enum e_FmDmaDbgCntMode {
389 e_FM_DMA_DBG_NO_CNT = 0, /**< No counting */
390 e_FM_DMA_DBG_CNT_DONE, /**< Count DONE commands */
391 e_FM_DMA_DBG_CNT_COMM_Q_EM, /**< count command queue emergency signals */
392 e_FM_DMA_DBG_CNT_INT_READ_EM, /**< Count Internal Read buffer emergency signal */
393 e_FM_DMA_DBG_CNT_INT_WRITE_EM, /**< Count Internal Write buffer emergency signal */
394 e_FM_DMA_DBG_CNT_FPM_WAIT, /**< Count FPM WAIT signal */
395 e_FM_DMA_DBG_CNT_SIGLE_BIT_ECC, /**< Single bit ECC errors. */
396 e_FM_DMA_DBG_CNT_RAW_WAR_PROT /**< Number of times there was a need for RAW & WAR protection. */
399 /**************************************************************************//**
400 @Description DMA Cache Override
401 *//***************************************************************************/
402 typedef enum e_FmDmaCacheOverride {
403 e_FM_DMA_NO_CACHE_OR = 0, /**< No override of the Cache field */
404 e_FM_DMA_NO_STASH_DATA, /**< Data should not be stashed in system level cache */
405 e_FM_DMA_MAY_STASH_DATA, /**< Data may be stashed in system level cache */
406 e_FM_DMA_STASH_DATA /**< Data should be stashed in system level cache */
407 } e_FmDmaCacheOverride;
409 /**************************************************************************//**
410 @Description DMA External Bus Priority
411 *//***************************************************************************/
412 typedef enum e_FmDmaExtBusPri {
413 e_FM_DMA_EXT_BUS_NORMAL = 0, /**< Normal priority */
414 e_FM_DMA_EXT_BUS_EBS, /**< AXI extended bus service priority */
415 e_FM_DMA_EXT_BUS_SOS, /**< AXI sos priority */
416 e_FM_DMA_EXT_BUS_EBS_AND_SOS /**< AXI ebs + sos priority */
419 /**************************************************************************//**
420 @Description enum for choosing the field that will be output on AID
421 *//***************************************************************************/
422 typedef enum e_FmDmaAidMode {
423 e_FM_DMA_AID_OUT_PORT_ID = 0, /**< 4 LSB of PORT_ID */
424 e_FM_DMA_AID_OUT_TNUM /**< 4 LSB of TNUM */
427 /**************************************************************************//**
428 @Description FPM Catasrophic error behaviour
429 *//***************************************************************************/
430 typedef enum e_FmCatastrophicErr {
431 e_FM_CATASTROPHIC_ERR_STALL_PORT = 0, /**< Port_ID is stalled (only reset can release it) */
432 e_FM_CATASTROPHIC_ERR_STALL_TASK /**< Only errornous task is stalled */
433 } e_FmCatastrophicErr;
435 /**************************************************************************//**
436 @Description FPM DMA error behaviour
437 *//***************************************************************************/
438 typedef enum e_FmDmaErr {
439 e_FM_DMA_ERR_CATASTROPHIC = 0, /**< Dma error is treated as a catastrophic error */
440 e_FM_DMA_ERR_REPORT /**< Dma error is just reported */
443 /**************************************************************************//**
444 @Description DMA Emergency level by BMI emergency signal
445 *//***************************************************************************/
446 typedef enum e_FmDmaEmergencyLevel {
447 e_FM_DMA_EM_EBS = 0, /**< EBS emergency */
448 e_FM_DMA_EM_SOS /**< SOS emergency */
449 } e_FmDmaEmergencyLevel;
451 /**************************************************************************//**
452 @Collection DMA emergency options
453 *//***************************************************************************/
454 typedef uint32_t fmEmergencyBus_t; /**< DMA emergency options */
456 #define FM_DMA_MURAM_READ_EMERGENCY 0x00800000 /**< Enable emergency for MURAM1 */
457 #define FM_DMA_MURAM_WRITE_EMERGENCY 0x00400000 /**< Enable emergency for MURAM2 */
458 #define FM_DMA_EXT_BUS_EMERGENCY 0x00100000 /**< Enable emergency for external bus */
461 /**************************************************************************//**
462 @Description A structure for defining DMA emergency level
463 *//***************************************************************************/
464 typedef struct t_FmDmaEmergency {
465 fmEmergencyBus_t emergencyBusSelect; /**< An OR of the busses where emergency
467 e_FmDmaEmergencyLevel emergencyLevel; /**< EBS/SOS */
470 /**************************************************************************//**
471 @Description structure for defining FM threshold
472 *//***************************************************************************/
473 typedef struct t_FmThresholds {
474 uint8_t dispLimit; /**< The number of times a frames may
475 be passed in the FM before assumed to
477 uint8_t prsDispTh; /**< This is the number pf packets that may be
478 queued in the parser dispatch queue*/
479 uint8_t plcrDispTh; /**< This is the number pf packets that may be
480 queued in the policer dispatch queue*/
481 uint8_t kgDispTh; /**< This is the number pf packets that may be
482 queued in the keygen dispatch queue*/
483 uint8_t bmiDispTh; /**< This is the number pf packets that may be
484 queued in the BMI dispatch queue*/
485 uint8_t qmiEnqDispTh; /**< This is the number pf packets that may be
486 queued in the QMI enqueue dispatch queue*/
487 uint8_t qmiDeqDispTh; /**< This is the number pf packets that may be
488 queued in the QMI dequeue dispatch queue*/
489 uint8_t fmCtl1DispTh; /**< This is the number pf packets that may be
490 queued in fmCtl1 dispatch queue*/
491 uint8_t fmCtl2DispTh; /**< This is the number pf packets that may be
492 queued in fmCtl2 dispatch queue*/
496 /**************************************************************************//**
497 @Description structure for defining DMA thresholds
498 *//***************************************************************************/
499 typedef struct t_FmDmaThresholds {
500 uint8_t assertEmergency; /**< When this value is reached,
501 assert emergency (Threshold)*/
502 uint8_t clearEmergency; /**< After emergency is asserted, it is held
503 until this value is reached (Hystheresis) */
507 /**************************************************************************//**
508 @Function FM_ConfigResetOnInit
510 @Description Tell the driver whether to reset the FM before initialization or
511 not. It changes the default configuration [FALSE].
513 @Param[in] h_Fm A handle to an FM Module.
514 @Param[in] enable When TRUE, FM will be reset before any initialization.
516 @Return E_OK on success; Error code otherwise.
518 @Cautions Allowed only following FM_Config() and before FM_Init().
519 *//***************************************************************************/
520 t_Error FM_ConfigResetOnInit(t_Handle h_Fm, bool enable);
522 /**************************************************************************//**
523 @Function FM_ConfigTotalNumOfTasks
525 @Description Change the total number of tasks from its default
526 configuration [BMI_MAX_NUM_OF_TASKS]
528 @Param[in] h_Fm A handle to an FM Module.
529 @Param[in] totalNumOfTasks The selected new value.
531 @Return E_OK on success; Error code otherwise.
533 @Cautions Allowed only following FM_Config() and before FM_Init().
534 *//***************************************************************************/
535 t_Error FM_ConfigTotalNumOfTasks(t_Handle h_Fm, uint8_t totalNumOfTasks);
537 /**************************************************************************//**
538 @Function FM_ConfigTotalFifoSize
540 @Description Change the total Fifo size from its default
541 configuration [BMI_MAX_FIFO_SIZE]
543 @Param[in] h_Fm A handle to an FM Module.
544 @Param[in] totalFifoSize The selected new value.
546 @Return E_OK on success; Error code otherwise.
548 @Cautions Allowed only following FM_Config() and before FM_Init().
549 *//***************************************************************************/
550 t_Error FM_ConfigTotalFifoSize(t_Handle h_Fm, uint32_t totalFifoSize);
552 /**************************************************************************//**
553 @Function FM_ConfigMaxNumOfOpenDmas
555 @Description Change the maximum allowed open DMA's for this FM from its default
556 configuration [BMI_MAX_NUM_OF_DMAS]
558 @Param[in] h_Fm A handle to an FM Module.
559 @Param[in] maxNumOfOpenDmas The selected new value.
561 @Return E_OK on success; Error code otherwise.
563 @Cautions Allowed only following FM_Config() and before FM_Init().
564 *//***************************************************************************/
565 t_Error FM_ConfigMaxNumOfOpenDmas(t_Handle h_Fm, uint8_t maxNumOfOpenDmas);
567 /**************************************************************************//**
568 @Function FM_ConfigThresholds
570 @Description Calling this routine changes the internal driver data base
571 from its default FM threshold configuration:
582 @Param[in] h_Fm A handle to an FM Module.
583 @Param[in] p_FmThresholds A structure of threshold parameters.
585 @Return E_OK on success; Error code otherwise.
587 @Cautions Allowed only following FM_Config() and before FM_Init().
588 *//***************************************************************************/
589 t_Error FM_ConfigThresholds(t_Handle h_Fm, t_FmThresholds *p_FmThresholds);
591 /**************************************************************************//**
592 @Function FM_ConfigDmaCacheOverride
594 @Description Calling this routine changes the internal driver data base
595 from its default configuration of cache override mode [e_FM_DMA_NO_CACHE_OR]
597 @Param[in] h_Fm A handle to an FM Module.
598 @Param[in] cacheOverride The selected new value.
600 @Return E_OK on success; Error code otherwise.
602 @Cautions Allowed only following FM_Config() and before FM_Init().
603 *//***************************************************************************/
604 t_Error FM_ConfigDmaCacheOverride(t_Handle h_Fm, e_FmDmaCacheOverride cacheOverride);
606 /**************************************************************************//**
607 @Function FM_ConfigDmaAidOverride
609 @Description Calling this routine changes the internal driver data base
610 from its default configuration of aid override mode [TRUE]
612 @Param[in] h_Fm A handle to an FM Module.
613 @Param[in] aidOverride The selected new value.
615 @Return E_OK on success; Error code otherwise.
617 @Cautions Allowed only following FM_Config() and before FM_Init().
618 *//***************************************************************************/
619 t_Error FM_ConfigDmaAidOverride(t_Handle h_Fm, bool aidOverride);
621 /**************************************************************************//**
622 @Function FM_ConfigDmaAidMode
624 @Description Calling this routine changes the internal driver data base
625 from its default configuration of aid mode [e_FM_DMA_AID_OUT_TNUM]
627 @Param[in] h_Fm A handle to an FM Module.
628 @Param[in] aidMode The selected new value.
630 @Return E_OK on success; Error code otherwise.
632 @Cautions Allowed only following FM_Config() and before FM_Init().
633 *//***************************************************************************/
634 t_Error FM_ConfigDmaAidMode(t_Handle h_Fm, e_FmDmaAidMode aidMode);
636 /**************************************************************************//**
637 @Function FM_ConfigDmaAxiDbgNumOfBeats
639 @Description Calling this routine changes the internal driver data base
640 from its default configuration of axi debug [1]
642 @Param[in] h_Fm A handle to an FM Module.
643 @Param[in] axiDbgNumOfBeats The selected new value.
645 @Return E_OK on success; Error code otherwise.
647 @Cautions Allowed only following FM_Config() and before FM_Init().
648 *//***************************************************************************/
649 t_Error FM_ConfigDmaAxiDbgNumOfBeats(t_Handle h_Fm, uint8_t axiDbgNumOfBeats);
651 /**************************************************************************//**
652 @Function FM_ConfigDmaCamNumOfEntries
654 @Description Calling this routine changes the internal driver data base
655 from its default configuration of number of CAM entries [32]
657 @Param[in] h_Fm A handle to an FM Module.
658 @Param[in] numOfEntries The selected new value.
660 @Return E_OK on success; Error code otherwise.
662 @Cautions Allowed only following FM_Config() and before FM_Init().
663 *//***************************************************************************/
664 t_Error FM_ConfigDmaCamNumOfEntries(t_Handle h_Fm, uint8_t numOfEntries);
666 /**************************************************************************//**
667 @Function FM_ConfigDmaWatchdog
669 @Description Calling this routine changes the internal driver data base
670 from its default watchdog configuration, which is disabled
673 @Param[in] h_Fm A handle to an FM Module.
674 @Param[in] watchDogValue The selected new value - in microseconds.
676 @Return E_OK on success; Error code otherwise.
678 @Cautions Allowed only following FM_Config() and before FM_Init().
679 *//***************************************************************************/
680 t_Error FM_ConfigDmaWatchdog(t_Handle h_Fm, uint32_t watchDogValue);
682 /**************************************************************************//**
683 @Function FM_ConfigDmaWriteBufThresholds
685 @Description Calling this routine changes the internal driver data base
686 from its default configuration of DMA write buffer threshold
687 assertEmergency: [DMA_THRESH_MAX_BUF]
688 clearEmergency: [DMA_THRESH_MAX_BUF]
690 @Param[in] h_Fm A handle to an FM Module.
691 @Param[in] p_FmDmaThresholds A structure of thresholds to define emergency behavior -
692 When 'assertEmergency' value is reached, emergency is asserted,
693 then it is held until 'clearEmergency' value is reached.
695 @Return E_OK on success; Error code otherwise.
697 @Cautions Allowed only following FM_Config() and before FM_Init().
698 *//***************************************************************************/
699 t_Error FM_ConfigDmaWriteBufThresholds(t_Handle h_Fm, t_FmDmaThresholds *p_FmDmaThresholds);
701 /**************************************************************************//**
702 @Function FM_ConfigDmaCommQThresholds
704 @Description Calling this routine changes the internal driver data base
705 from its default configuration of DMA command queue threshold
706 assertEmergency: [DMA_THRESH_MAX_COMMQ]
707 clearEmergency: [DMA_THRESH_MAX_COMMQ]
709 @Param[in] h_Fm A handle to an FM Module.
710 @Param[in] p_FmDmaThresholds A structure of thresholds to define emergency behavior -
711 When 'assertEmergency' value is reached, emergency is asserted,
712 then it is held until 'clearEmergency' value is reached..
714 @Return E_OK on success; Error code otherwise.
716 @Cautions Allowed only following FM_Config() and before FM_Init().
717 *//***************************************************************************/
718 t_Error FM_ConfigDmaCommQThresholds(t_Handle h_Fm, t_FmDmaThresholds *p_FmDmaThresholds);
720 /**************************************************************************//**
721 @Function FM_ConfigDmaReadBufThresholds
723 @Description Calling this routine changes the internal driver data base
724 from its default configuration of DMA read buffer threshold
725 assertEmergency: [DMA_THRESH_MAX_BUF]
726 clearEmergency: [DMA_THRESH_MAX_BUF]
728 @Param[in] h_Fm A handle to an FM Module.
729 @Param[in] p_FmDmaThresholds A structure of thresholds to define emergency behavior -
730 When 'assertEmergency' value is reached, emergency is asserted,
731 then it is held until 'clearEmergency' value is reached..
733 @Return E_OK on success; Error code otherwise.
735 @Cautions Allowed only following FM_Config() and before FM_Init().
736 *//***************************************************************************/
737 t_Error FM_ConfigDmaReadBufThresholds(t_Handle h_Fm, t_FmDmaThresholds *p_FmDmaThresholds);
739 /**************************************************************************//**
740 @Function FM_ConfigDmaSosEmergencyThreshold
742 @Description Calling this routine changes the internal driver data base
743 from its default dma SOS emergency configuration [0]
745 @Param[in] h_Fm A handle to an FM Module.
746 @Param[in] dmaSosEmergency The selected new value.
748 @Return E_OK on success; Error code otherwise.
750 @Cautions Allowed only following FM_Config() and before FM_Init().
751 *//***************************************************************************/
752 t_Error FM_ConfigDmaSosEmergencyThreshold(t_Handle h_Fm, uint32_t dmaSosEmergency);
754 /**************************************************************************//**
755 @Function FM_ConfigEnableCounters
757 @Description Calling this routine changes the internal driver data base
758 from its default counters configuration where counters are disabled.
760 @Param[in] h_Fm A handle to an FM Module.
762 @Return E_OK on success; Error code otherwise.
764 @Cautions Allowed only following FM_Config() and before FM_Init().
765 *//***************************************************************************/
766 t_Error FM_ConfigEnableCounters(t_Handle h_Fm);
768 /**************************************************************************//**
769 @Function FM_ConfigDmaDbgCounter
771 @Description Calling this routine changes the internal driver data base
772 from its default DMA debug counters configuration [e_FM_DMA_DBG_NO_CNT]
774 @Param[in] h_Fm A handle to an FM Module.
775 @Param[in] fmDmaDbgCntMode An enum selecting the debug counter mode.
777 @Return E_OK on success; Error code otherwise.
779 @Cautions Allowed only following FM_Config() and before FM_Init().
780 *//***************************************************************************/
781 t_Error FM_ConfigDmaDbgCounter(t_Handle h_Fm, e_FmDmaDbgCntMode fmDmaDbgCntMode);
783 /**************************************************************************//**
784 @Function FM_ConfigDmaStopOnBusErr
786 @Description Calling this routine changes the internal driver data base
787 from its default selection of bus error behavior [FALSE]
790 @Param[in] h_Fm A handle to an FM Module.
791 @Param[in] stop TRUE to stop on bus error, FALSE to continue.
793 @Return E_OK on success; Error code otherwise.
795 @Cautions Allowed only following FM_Config() and before FM_Init().
796 Only if bus error is enabled.
797 *//***************************************************************************/
798 t_Error FM_ConfigDmaStopOnBusErr(t_Handle h_Fm, bool stop);
800 /**************************************************************************//**
801 @Function FM_ConfigDmaEmergency
803 @Description Calling this routine changes the internal driver data base
804 from its default selection of DMA emergency where's it's disabled.
806 @Param[in] h_Fm A handle to an FM Module.
807 @Param[in] p_Emergency An OR mask of all required options.
809 @Return E_OK on success; Error code otherwise.
811 @Cautions Allowed only following FM_Config() and before FM_Init().
812 *//***************************************************************************/
813 t_Error FM_ConfigDmaEmergency(t_Handle h_Fm, t_FmDmaEmergency *p_Emergency);
815 /**************************************************************************//**
816 @Function FM_ConfigDmaEmergencySmoother
818 @Description sets the minimum amount of DATA beats transferred on the AXI
819 READ and WRITE ports before lowering the emergency level.
820 By default smother is disabled.
822 @Param[in] h_Fm A handle to an FM Module.
823 @Param[in] emergencyCnt emergency switching counter.
825 @Return E_OK on success; Error code otherwise.
827 @Cautions Allowed only following FM_Config() and before FM_Init().
828 *//***************************************************************************/
829 t_Error FM_ConfigDmaEmergencySmoother(t_Handle h_Fm, uint32_t emergencyCnt);
831 /**************************************************************************//**
832 @Function FM_ConfigDmaErr
834 @Description Calling this routine changes the internal driver data base
835 from its default DMA error treatment [e_FM_DMA_ERR_CATASTROPHIC]
837 @Param[in] h_Fm A handle to an FM Module.
838 @Param[in] dmaErr The selected new choice.
840 @Return E_OK on success; Error code otherwise.
842 @Cautions Allowed only following FM_Config() and before FM_Init().
843 *//***************************************************************************/
844 t_Error FM_ConfigDmaErr(t_Handle h_Fm, e_FmDmaErr dmaErr);
846 /**************************************************************************//**
847 @Function FM_ConfigCatastrophicErr
849 @Description Calling this routine changes the internal driver data base
850 from its default behavior on catastrophic error [e_FM_CATASTROPHIC_ERR_STALL_PORT]
852 @Param[in] h_Fm A handle to an FM Module.
853 @Param[in] catastrophicErr The selected new choice.
855 @Return E_OK on success; Error code otherwise.
857 @Cautions Allowed only following FM_Config() and before FM_Init().
858 *//***************************************************************************/
859 t_Error FM_ConfigCatastrophicErr(t_Handle h_Fm, e_FmCatastrophicErr catastrophicErr);
861 /**************************************************************************//**
862 @Function FM_ConfigEnableMuramTestMode
864 @Description Calling this routine changes the internal driver data base
865 from its default selection of test mode where it's disabled.
867 @Param[in] h_Fm A handle to an FM Module.
869 @Return E_OK on success; Error code otherwise.
871 @Cautions Allowed only following FM_Config() and before FM_Init().
872 *//***************************************************************************/
873 t_Error FM_ConfigEnableMuramTestMode(t_Handle h_Fm);
875 /**************************************************************************//**
876 @Function FM_ConfigEnableIramTestMode
878 @Description Calling this routine changes the internal driver data base
879 from its default selection of test mode where it's disabled.
881 @Param[in] h_Fm A handle to an FM Module.
883 @Return E_OK on success; Error code otherwise.
885 @Cautions Allowed only following FM_Config() and before FM_Init().
886 *//***************************************************************************/
887 t_Error FM_ConfigEnableIramTestMode(t_Handle h_Fm);
889 /**************************************************************************//**
890 @Function FM_ConfigHaltOnExternalActivation
892 @Description Calling this routine changes the internal driver data base
893 from its default selection of FM behaviour on external halt
896 @Param[in] h_Fm A handle to an FM Module.
897 @Param[in] enable TRUE to enable halt on external halt
900 @Return E_OK on success; Error code otherwise.
902 @Cautions Allowed only following FM_Config() and before FM_Init().
903 *//***************************************************************************/
904 t_Error FM_ConfigHaltOnExternalActivation(t_Handle h_Fm, bool enable);
906 /**************************************************************************//**
907 @Function FM_ConfigHaltOnUnrecoverableEccError
909 @Description Calling this routine changes the internal driver data base
910 from its default selection of FM behaviour on unrecoverable
913 @Param[in] h_Fm A handle to an FM Module.
914 @Param[in] enable TRUE to enable halt on unrecoverable Ecc error
916 @Return E_OK on success; Error code otherwise.
918 @Cautions Allowed only following FM_Config() and before FM_Init().
919 *//***************************************************************************/
920 t_Error FM_ConfigHaltOnUnrecoverableEccError(t_Handle h_Fm, bool enable);
922 /**************************************************************************//**
923 @Function FM_ConfigException
925 @Description Calling this routine changes the internal driver data base
926 from its default selection of exceptions enablement.
927 By default all exceptions are enabled.
929 @Param[in] h_Fm A handle to an FM Module.
930 @Param[in] exception The exception to be selected.
931 @Param[in] enable TRUE to enable interrupt, FALSE to mask it.
933 @Return E_OK on success; Error code otherwise.
935 @Cautions Allowed only following FM_Config() and before FM_Init().
936 *//***************************************************************************/
937 t_Error FM_ConfigException(t_Handle h_Fm, e_FmExceptions exception, bool enable);
939 /**************************************************************************//**
940 @Function FM_ConfigExternalEccRamsEnable
942 @Description Calling this routine changes the internal driver data base
943 from its default [FALSE].
944 When this option is enabled Rams ECC enable is not effected
945 by the FPM RCR bit, but by a JTAG.
947 @Param[in] h_Fm A handle to an FM Module.
948 @Param[in] enable TRUE to enable this option.
950 @Return E_OK on success; Error code otherwise.
952 @Cautions Allowed only following FM_Config() and before FM_Init().
953 *//***************************************************************************/
954 t_Error FM_ConfigExternalEccRamsEnable(t_Handle h_Fm, bool enable);
956 /**************************************************************************//**
957 @Function FM_ConfigTnumAgingPeriod
959 @Description Calling this routine changes the internal driver data base
960 from its default configuration for aging of dequeue TNUM's
962 Note that this functionality is not available in all chips.
964 @Param[in] h_Fm A handle to an FM Module.
965 @Param[in] tnumAgingPeriod Tnum Aging Period in microseconds.
966 Note that period is recalculated in units of
967 64 FM clocks. Driver will pick the closest
970 @Return E_OK on success; Error code otherwise.
972 @Cautions Allowed only following FM_Config() and before FM_Init().
973 *//***************************************************************************/
974 t_Error FM_ConfigTnumAgingPeriod(t_Handle h_Fm, uint16_t tnumAgingPeriod);
976 /** @} */ /* end of FM_advanced_init_grp group */
977 /** @} */ /* end of FM_init_grp group */
980 /**************************************************************************//**
981 @Group FM_runtime_control_grp FM Runtime Control Unit
983 @Description FM Runtime control unit API functions, definitions and enums.
984 The FM driver provides a set of control routines for each module.
985 These routines may only be called after the module was fully
986 initialized (both configuration and initialization routines were
987 called). They are typically used to get information from hardware
988 (status, counters/statistics, revision etc.), to modify a current
989 state or to force/enable a required action. Run-time control may
990 be called whenever necessary and as many times as needed.
992 *//***************************************************************************/
994 /**************************************************************************//**
995 @Collection General FM defines.
996 *//***************************************************************************/
997 #define FM_MAX_NUM_OF_VALID_PORTS (FM_MAX_NUM_OF_OH_PORTS + \
998 FM_MAX_NUM_OF_1G_RX_PORTS + \
999 FM_MAX_NUM_OF_10G_RX_PORTS + \
1000 FM_MAX_NUM_OF_1G_TX_PORTS + \
1001 FM_MAX_NUM_OF_10G_TX_PORTS)
1004 /**************************************************************************//**
1005 @Description Structure for Port bandwidth requirement. Port is identified
1006 by type and relative id.
1007 *//***************************************************************************/
1008 typedef struct t_FmPortBandwidth {
1009 e_FmPortType type; /**< FM port type */
1010 uint8_t relativePortId; /**< Type relative port id */
1011 uint8_t bandwidth; /**< bandwidth - (in term of percents) */
1012 } t_FmPortBandwidth;
1014 /**************************************************************************//**
1015 @Description A Structure containing an array of Port bandwidth requirements.
1016 The user should state the ports requiring bandwidth in terms of
1017 percentage - i.e. all port's bandwidths in the array must add
1019 *//***************************************************************************/
1020 typedef struct t_FmPortsBandwidthParams {
1021 uint8_t numOfPorts; /**< num of ports listed in the array below */
1022 t_FmPortBandwidth portsBandwidths[FM_MAX_NUM_OF_VALID_PORTS];
1023 /**< for each port, it's bandwidth (all port's
1024 bandwidths must add up to 100.*/
1025 } t_FmPortsBandwidthParams;
1027 /**************************************************************************//**
1028 @Description DMA Emergency control on MURAM
1029 *//***************************************************************************/
1030 typedef enum e_FmDmaMuramPort {
1031 e_FM_DMA_MURAM_PORT_WRITE, /**< MURAM write port */
1032 e_FM_DMA_MURAM_PORT_READ /**< MURAM read port */
1035 /**************************************************************************//**
1036 @Description enum for defining FM counters
1037 *//***************************************************************************/
1038 typedef enum e_FmCounters {
1039 e_FM_COUNTERS_ENQ_TOTAL_FRAME = 0, /**< QMI total enqueued frames counter */
1040 e_FM_COUNTERS_DEQ_TOTAL_FRAME, /**< QMI total dequeued frames counter */
1041 e_FM_COUNTERS_DEQ_0, /**< QMI 0 frames from QMan counter */
1042 e_FM_COUNTERS_DEQ_1, /**< QMI 1 frames from QMan counter */
1043 e_FM_COUNTERS_DEQ_2, /**< QMI 2 frames from QMan counter */
1044 e_FM_COUNTERS_DEQ_3, /**< QMI 3 frames from QMan counter */
1045 e_FM_COUNTERS_DEQ_FROM_DEFAULT, /**< QMI dequeue from default queue counter */
1046 e_FM_COUNTERS_DEQ_FROM_CONTEXT, /**< QMI dequeue from FQ context counter */
1047 e_FM_COUNTERS_DEQ_FROM_FD, /**< QMI dequeue from FD command field counter */
1048 e_FM_COUNTERS_DEQ_CONFIRM, /**< QMI dequeue confirm counter */
1049 e_FM_COUNTERS_SEMAPHOR_ENTRY_FULL_REJECT, /**< DMA semaphor reject due to full entry counter */
1050 e_FM_COUNTERS_SEMAPHOR_QUEUE_FULL_REJECT, /**< DMA semaphor reject due to full CAM queue counter */
1051 e_FM_COUNTERS_SEMAPHOR_SYNC_REJECT /**< DMA semaphor reject due to sync counter */
1054 /**************************************************************************//**
1055 @Description structure for returning revision information
1056 *//***************************************************************************/
1057 typedef struct t_FmRevisionInfo {
1058 uint8_t majorRev; /**< Major revision */
1059 uint8_t minorRev; /**< Minor revision */
1062 /**************************************************************************//**
1063 @Description struct for defining DMA status
1064 *//***************************************************************************/
1065 typedef struct t_FmDmaStatus {
1066 bool cmqNotEmpty; /**< Command queue is not empty */
1067 bool busError; /**< Bus error occurred */
1068 bool readBufEccError; /**< Double ECC error on buffer Read */
1069 bool writeBufEccSysError; /**< Double ECC error on buffer write from system side */
1070 bool writeBufEccFmError; /**< Double ECC error on buffer write from FM side */
1074 #if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
1075 /**************************************************************************//**
1076 @Function FM_DumpRegs
1078 @Description Dumps all FM registers
1080 @Param[in] h_Fm A handle to an FM Module.
1082 @Return E_OK on success;
1084 @Cautions Allowed only FM_Init().
1085 *//***************************************************************************/
1086 t_Error FM_DumpRegs(t_Handle h_Fm);
1087 #endif /* (defined(DEBUG_ERRORS) && ... */
1089 /**************************************************************************//**
1090 @Function FM_SetException
1092 @Description Calling this routine enables/disables the specified exception.
1093 Note: Not available for guest partition.
1095 @Param[in] h_Fm A handle to an FM Module.
1096 @Param[in] exception The exception to be selected.
1097 @Param[in] enable TRUE to enable interrupt, FALSE to mask it.
1099 @Return E_OK on success; Error code otherwise.
1101 @Cautions Allowed only following FM_Init().
1102 *//***************************************************************************/
1103 t_Error FM_SetException(t_Handle h_Fm, e_FmExceptions exception, bool enable);
1105 /**************************************************************************//**
1106 @Function FM_SetPortsBandwidth
1108 @Description Sets relative weights between ports when accessing common resources.
1109 Note: Not available for guest partition.
1111 @Param[in] h_Fm A handle to an FM Module.
1112 @Param[in] p_PortsBandwidth A structure of ports bandwidths in percentage, i.e.
1113 total must equal 100.
1115 @Return E_OK on success; Error code otherwise.
1117 @Cautions Allowed only following FM_Init().
1118 *//***************************************************************************/
1119 t_Error FM_SetPortsBandwidth(t_Handle h_Fm, t_FmPortsBandwidthParams *p_PortsBandwidth);
1121 /**************************************************************************//**
1122 @Function FM_EnableRamsEcc
1124 @Description Enables ECC mechanism for all the different FM RAM's; E.g. IRAM,
1125 MURAM, Parser, Keygen, Policer, etc.
1127 If FM_ConfigExternalEccRamsEnable was called to enable external
1128 setting of ECC, this routine effects IRAM ECC only.
1129 This routine is also called by the driver if an ECC exception is
1131 Note: Not available for guest partition.
1133 @Param[in] h_Fm A handle to an FM Module.
1135 @Return E_OK on success; Error code otherwise.
1137 @Cautions Allowed only following FM_Config() and before FM_Init().
1138 *//***************************************************************************/
1139 t_Error FM_EnableRamsEcc(t_Handle h_Fm);
1141 /**************************************************************************//**
1142 @Function FM_DisableRamsEcc
1144 @Description Disables ECC mechanism for all the different FM RAM's; E.g. IRAM,
1145 MURAM, Parser, Keygen, Policer, etc.
1147 If FM_ConfigExternalEccRamsEnable was called to enable external
1148 setting of ECC, this routine effects IRAM ECC only.
1149 In opposed to FM_EnableRamsEcc, this routine must be called
1150 explicitly to disable all Rams ECC.
1151 Note: Not available for guest partition.
1154 @Param[in] h_Fm A handle to an FM Module.
1156 @Return E_OK on success; Error code otherwise.
1158 @Cautions Allowed only following FM_Config() and before FM_Init().
1159 *//***************************************************************************/
1160 t_Error FM_DisableRamsEcc(t_Handle h_Fm);
1162 /**************************************************************************//**
1163 @Function FM_GetRevision
1165 @Description Returns the FM revision
1167 @Param[in] h_Fm A handle to an FM Module.
1168 @Param[out] p_FmRevisionInfo A structure of revision information parameters.
1170 @Return E_OK on success; Error code otherwise.
1172 @Cautions Allowed only following FM_Init().
1173 *//***************************************************************************/
1174 t_Error FM_GetRevision(t_Handle h_Fm, t_FmRevisionInfo *p_FmRevisionInfo);
1176 /**************************************************************************//**
1177 @Function FM_GetCounter
1179 @Description Reads one of the FM counters.
1181 @Param[in] h_Fm A handle to an FM Module.
1182 @Param[in] counter The requested counter.
1184 @Return Counter's current value.
1186 @Cautions Allowed only following FM_Init().
1187 Note that it is user's responsibility to call this routine only
1188 for enabled counters, and there will be no indication if a
1189 disabled counter is accessed.
1190 *//***************************************************************************/
1191 uint32_t FM_GetCounter(t_Handle h_Fm, e_FmCounters counter);
1193 /**************************************************************************//**
1194 @Function FM_ModifyCounter
1196 @Description Sets a value to an enabled counter. Use "0" to reset the counter.
1197 Note: Not available for guest partition.
1199 @Param[in] h_Fm A handle to an FM Module.
1200 @Param[in] counter The requested counter.
1201 @Param[in] val The requested value to be written into the counter.
1203 @Return E_OK on success; Error code otherwise.
1205 @Cautions Allowed only following FM_Init().
1206 *//***************************************************************************/
1207 t_Error FM_ModifyCounter(t_Handle h_Fm, e_FmCounters counter, uint32_t val);
1209 /**************************************************************************//**
1212 @Description Release FM after halt FM command or after unrecoverable ECC error.
1213 Note: Not available for guest partition.
1215 @Param[in] h_Fm A handle to an FM Module.
1217 @Return E_OK on success; Error code otherwise.
1218 *//***************************************************************************/
1219 void FM_Resume(t_Handle h_Fm);
1221 /**************************************************************************//**
1222 @Function FM_SetDmaEmergency
1224 @Description Manual emergency set
1225 Note: Not available for guest partition.
1227 @Param[in] h_Fm A handle to an FM Module.
1228 @Param[in] muramPort MURAM direction select.
1229 @Param[in] enable TRUE to manually enable emergency, FALSE to disable.
1233 @Cautions Allowed only following FM_Init().
1234 *//***************************************************************************/
1235 void FM_SetDmaEmergency(t_Handle h_Fm, e_FmDmaMuramPort muramPort, bool enable);
1237 /**************************************************************************//**
1238 @Function FM_SetDmaExtBusPri
1240 @Description Manual emergency set
1241 Note: Not available for guest partition.
1243 @Param[in] h_Fm A handle to an FM Module.
1244 @Param[in] pri External bus priority select
1248 @Cautions Allowed only following FM_Init().
1249 *//***************************************************************************/
1250 void FM_SetDmaExtBusPri(t_Handle h_Fm, e_FmDmaExtBusPri pri);
1252 /**************************************************************************//**
1253 @Function FM_ForceIntr
1255 @Description Causes an interrupt event on the requested source.
1256 Note: Not available for guest partition.
1258 @Param[in] h_Fm A handle to an FM Module.
1259 @Param[in] exception An exception to be forced.
1261 @Return E_OK on success; Error code if the exception is not enabled,
1262 or is not able to create interrupt.
1264 @Cautions Allowed only following FM_Init().
1265 *//***************************************************************************/
1266 t_Error FM_ForceIntr (t_Handle h_Fm, e_FmExceptions exception);
1268 /**************************************************************************//**
1269 @Function FM_GetDmaStatus
1271 @Description Reads the DMA current status
1273 @Param[in] h_Fm A handle to an FM Module.
1274 @Param[out] p_FmDmaStatus A structure of DMA status parameters.
1278 @Cautions Allowed only following FM_Init().
1279 *//***************************************************************************/
1280 void FM_GetDmaStatus(t_Handle h_Fm, t_FmDmaStatus *p_FmDmaStatus);
1282 /**************************************************************************//**
1283 @Function FM_GetPcdHandle
1285 @Description Used by FMC in order to get PCD handle
1287 @Param[in] h_Fm A handle to an FM Module.
1289 @Return A handle to the PCD module, NULL if uninitialized.
1291 @Cautions Allowed only following FM_Init().
1292 *//***************************************************************************/
1293 t_Handle FM_GetPcdHandle(t_Handle h_Fm);
1295 /**************************************************************************//**
1296 @Function FM_ErrorIsr
1297 Note: Not available for guest partition.
1299 @Description FM interrupt-service-routine for errors.
1301 @Param[in] h_Fm A handle to an FM Module.
1303 @Return E_OK on success; E_EMPTY if no errors found in register, other
1304 error code otherwise.
1306 @Cautions Allowed only following FM_Init().
1307 This routine should NOT be called from guest-partition
1308 (i.e. guestId != NCSW_MASTER_ID)
1309 *//***************************************************************************/
1310 t_Error FM_ErrorIsr(t_Handle h_Fm);
1312 /**************************************************************************//**
1313 @Function FM_EventIsr
1314 Note: Not available for guest partition.
1316 @Description FM interrupt-service-routine for normal events.
1318 @Param[in] h_Fm A handle to an FM Module.
1320 @Cautions Allowed only following FM_Init().
1321 This routine should NOT be called from guest-partition
1322 (i.e. guestId != NCSW_MASTER_ID)
1323 *//***************************************************************************/
1324 void FM_EventIsr(t_Handle h_Fm);
1326 #if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
1327 /**************************************************************************//**
1328 @Function FmDumpPortRegs
1330 @Description Dumps FM port registers which are part of FM common registers
1332 @Param[in] h_Fm A handle to an FM Module.
1333 @Param[in] hardwarePortId HW port id.
1335 @Return E_OK on success; Error code otherwise.
1337 @Cautions Allowed only FM_Init().
1338 *//***************************************************************************/
1339 t_Error FmDumpPortRegs(t_Handle h_Fm,uint8_t hardwarePortId);
1340 #endif /* (defined(DEBUG_ERRORS) && ... */
1343 /** @} */ /* end of FM_runtime_control_grp group */
1344 /** @} */ /* end of FM_lib_grp group */
1345 /** @} */ /* end of FM_grp group */
1347 #endif /* __FM_EXT */