Path: blob/main/sys/contrib/ncsw/inc/Peripherals/fm_vsp_ext.h
48375 views
/*1* Copyright 2008-2012 Freescale Semiconductor Inc.2*3* Redistribution and use in source and binary forms, with or without4* modification, are permitted provided that the following conditions are met:5* * Redistributions of source code must retain the above copyright6* notice, this list of conditions and the following disclaimer.7* * Redistributions in binary form must reproduce the above copyright8* notice, this list of conditions and the following disclaimer in the9* documentation and/or other materials provided with the distribution.10* * Neither the name of Freescale Semiconductor nor the11* names of its contributors may be used to endorse or promote products12* derived from this software without specific prior written permission.13*14*15* ALTERNATIVELY, this software may be distributed under the terms of the16* GNU General Public License ("GPL") as published by the Free Software17* Foundation, either version 2 of that License or (at your option) any18* later version.19*20* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY21* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED22* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE23* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY24* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES25* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;26* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND27* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT28* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS29* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.30*/313233/**************************************************************************//**34@File fm_vsp_ext.h3536@Description FM Virtual Storage-Profile ...37*//***************************************************************************/38#ifndef __FM_VSP_EXT_H39#define __FM_VSP_EXT_H4041#include "std_ext.h"42#include "error_ext.h"43#include "string_ext.h"44#include "debug_ext.h"4546#include "fm_ext.h"474849/**************************************************************************//**5051@Group FM_grp Frame Manager API5253@Description FM API functions, definitions and enums5455@{56*//***************************************************************************/5758/**************************************************************************//**59@Group FM_VSP_grp FM Virtual-Storage-Profile6061@Description FM Virtual-Storage-Profile API6263@{64*//***************************************************************************/6566/**************************************************************************//**67@Group FM_VSP_init_grp FM VSP Initialization Unit6869@Description FM VSP initialization API.7071@{72*//***************************************************************************/7374/**************************************************************************//**75@Description Virtual Storage Profile76*//***************************************************************************/77typedef struct t_FmVspParams {78t_Handle h_Fm; /**< A handle to the FM object this VSP related to */79t_FmExtPools extBufPools; /**< Which external buffer pools are used80(up to FM_PORT_MAX_NUM_OF_EXT_POOLS), and their sizes.81parameter associated with Rx / OP port */82uint16_t liodnOffset; /**< VSP's LIODN offset */83struct {84e_FmPortType portType; /**< Port type */85uint8_t portId; /**< Port Id - relative to type */86} portParams;87uint8_t relativeProfileId; /**< VSP Id - relative to VSP's range88defined in relevant FM object */89} t_FmVspParams;909192/**************************************************************************//**93@Function FM_VSP_Config9495@Description Creates descriptor for the FM VSP module.9697The routine returns a handle (descriptor) to the FM VSP object.98This descriptor must be passed as first parameter to all other99FM VSP function calls.100101No actual initialization or configuration of FM hardware is102done by this routine.103104@Param[in] p_FmVspParams Pointer to data structure of parameters105106@Retval Handle to FM VSP object, or NULL for Failure.107*//***************************************************************************/108t_Handle FM_VSP_Config(t_FmVspParams *p_FmVspParams);109110/**************************************************************************//**111@Function FM_VSP_Init112113@Description Initializes the FM VSP module114115@Param[in] h_FmVsp - FM VSP module descriptor116117@Return E_OK on success; Error code otherwise.118*//***************************************************************************/119t_Error FM_VSP_Init(t_Handle h_FmVsp);120121/**************************************************************************//**122@Function FM_VSP_Free123124@Description Frees all resources that were assigned to FM VSP module.125126Calling this routine invalidates the descriptor.127128@Param[in] h_FmVsp - FM VSP module descriptor129130@Return E_OK on success; Error code otherwise.131*//***************************************************************************/132t_Error FM_VSP_Free(t_Handle h_FmVsp);133134135/**************************************************************************//**136@Group FM_VSP_adv_config_grp FM VSP Advanced Configuration Unit137138@Description FM VSP advanced configuration functions.139140@{141*//***************************************************************************/142143/**************************************************************************//**144@Function FM_VSP_ConfigBufferPrefixContent145146@Description Defines the structure, size and content of the application buffer.147148The prefix will149In VSPs defined for Tx ports, if 'passPrsResult', the application150should set a value to their offsets in the prefix of151the FM will save the first 'privDataSize', than,152depending on 'passPrsResult' and 'passTimeStamp', copy parse result153and timeStamp, and the packet itself (in this order), to the154application buffer, and to offset.155156Calling this routine changes the buffer margins definitions157in the internal driver data base from its default158configuration: Data size: [DEFAULT_FM_SP_bufferPrefixContent_privDataSize]159Pass Parser result: [DEFAULT_FM_SP_bufferPrefixContent_passPrsResult].160Pass timestamp: [DEFAULT_FM_SP_bufferPrefixContent_passTimeStamp].161162@Param[in] h_FmVsp A handle to a FM VSP module.163@Param[in,out] p_FmBufferPrefixContent A structure of parameters describing the164structure of the buffer.165Out parameter: Start margin - offset166of data from start of external buffer.167168@Return E_OK on success; Error code otherwise.169170@Cautions Allowed only following FM_VSP_Config() and before FM_VSP_Init().171*//***************************************************************************/172t_Error FM_VSP_ConfigBufferPrefixContent(t_Handle h_FmVsp,173t_FmBufferPrefixContent *p_FmBufferPrefixContent);174175/**************************************************************************//**176@Function FM_VSP_ConfigDmaSwapData177178@Description Calling this routine changes the DMA swap data parameter179in the internal driver data base from its default180configuration [DEFAULT_FM_SP_dmaSwapData]181182@Param[in] h_FmVsp A handle to a FM VSP module.183@Param[in] swapData New selection184185@Return E_OK on success; Error code otherwise.186187@Cautions Allowed only following FM_VSP_Config() and before FM_VSP_Init().188*//***************************************************************************/189t_Error FM_VSP_ConfigDmaSwapData(t_Handle h_FmVsp, e_FmDmaSwapOption swapData);190191/**************************************************************************//**192@Function FM_VSP_ConfigDmaIcCacheAttr193194@Description Calling this routine changes the internal context cache195attribute parameter in the internal driver data base196from its default configuration [DEFAULT_FM_SP_dmaIntContextCacheAttr]197198@Param[in] h_FmVsp A handle to a FM VSP module.199@Param[in] intContextCacheAttr New selection200201@Return E_OK on success; Error code otherwise.202203@Cautions Allowed only following FM_VSP_Config() and before FM_VSP_Init().204*//***************************************************************************/205t_Error FM_VSP_ConfigDmaIcCacheAttr(t_Handle h_FmVsp,206e_FmDmaCacheOption intContextCacheAttr);207208/**************************************************************************//**209@Function FM_VSP_ConfigDmaHdrAttr210211@Description Calling this routine changes the header cache212attribute parameter in the internal driver data base213from its default configuration [DEFAULT_FM_SP_dmaHeaderCacheAttr]214215@Param[in] h_FmVsp A handle to a FM VSP module.216@Param[in] headerCacheAttr New selection217218@Return E_OK on success; Error code otherwise.219220@Cautions Allowed only following FM_VSP_Config() and before FM_VSP_Init().221*//***************************************************************************/222t_Error FM_VSP_ConfigDmaHdrAttr(t_Handle h_FmVsp, e_FmDmaCacheOption headerCacheAttr);223224/**************************************************************************//**225@Function FM_VSP_ConfigDmaScatterGatherAttr226227@Description Calling this routine changes the scatter gather cache228attribute parameter in the internal driver data base229from its default configuration [DEFAULT_FM_SP_dmaScatterGatherCacheAttr]230231@Param[in] h_FmVsp A handle to a FM VSP module.232@Param[in] scatterGatherCacheAttr New selection233234@Return E_OK on success; Error code otherwise.235236@Cautions Allowed only following FM_VSP_Config() and before FM_VSP_Init().237*//***************************************************************************/238t_Error FM_VSP_ConfigDmaScatterGatherAttr(t_Handle h_FmVsp,239e_FmDmaCacheOption scatterGatherCacheAttr);240241/**************************************************************************//**242@Function FM_VSP_ConfigDmaWriteOptimize243244@Description Calling this routine changes the write optimization245parameter in the internal driver data base246from its default configuration: optimize = [DEFAULT_FM_SP_dmaWriteOptimize]247248@Param[in] h_FmVsp A handle to a FM VSP module.249@Param[in] optimize TRUE to enable optimization, FALSE for normal operation250251@Return E_OK on success; Error code otherwise.252253@Cautions Allowed only following FM_VSP_Config() and before FM_VSP_Init().254*//***************************************************************************/255t_Error FM_VSP_ConfigDmaWriteOptimize(t_Handle h_FmVsp, bool optimize);256257/**************************************************************************//**258@Function FM_VSP_ConfigNoScatherGather259260@Description Calling this routine changes the possibility to receive S/G frame261in the internal driver data base262from its default configuration: optimize = [DEFAULT_FM_SP_noScatherGather]263264@Param[in] h_FmVsp A handle to a FM VSP module.265@Param[in] noScatherGather TRUE to operate without scatter/gather capability.266267@Return E_OK on success; Error code otherwise.268269@Cautions Allowed only following FM_VSP_Config() and before FM_VSP_Init().270*//***************************************************************************/271t_Error FM_VSP_ConfigNoScatherGather(t_Handle h_FmVsp, bool noScatherGather);272273/**************************************************************************//**274@Function FM_VSP_ConfigPoolDepletion275276@Description Calling this routine enables pause frame generation depending on the277depletion status of BM pools. It also defines the conditions to activate278this functionality. By default, this functionality is disabled.279280@Param[in] h_FmVsp A handle to a FM VSP module.281@Param[in] p_BufPoolDepletion A structure of pool depletion parameters282283@Return E_OK on success; Error code otherwise.284285@Cautions Allowed only following FM_VSP_Config() and before FM_VSP_Init().286*//***************************************************************************/287t_Error FM_VSP_ConfigPoolDepletion(t_Handle h_FmVsp, t_FmBufPoolDepletion *p_BufPoolDepletion);288289/**************************************************************************//**290@Function FM_VSP_ConfigBackupPools291292@Description Calling this routine allows the configuration of some of the BM pools293defined for this port as backup pools.294A pool configured to be a backup pool will be used only if all other295enabled non-backup pools are depleted.296297@Param[in] h_FmVsp A handle to a FM VSP module.298@Param[in] p_BackupBmPools An array of pool id's. All pools specified here will299be defined as backup pools.300301@Return E_OK on success; Error code otherwise.302303@Cautions Allowed only following FM_VSP_Config() and before FM_VSP_Init().304*//***************************************************************************/305t_Error FM_VSP_ConfigBackupPools(t_Handle h_FmVsp, t_FmBackupBmPools *p_BackupBmPools);306307/** @} */ /* end of FM_VSP_adv_config_grp group */308/** @} */ /* end of FM_VSP_init_grp group */309310311/**************************************************************************//**312@Group FM_VSP_control_grp FM VSP Control Unit313314@Description FM VSP runtime control API.315316@{317*//***************************************************************************/318319/**************************************************************************//**320@Function FM_VSP_GetBufferDataOffset321322@Description Relevant for Rx ports.323Returns the data offset from the beginning of the data buffer324325@Param[in] h_FmVsp - FM PORT module descriptor326327@Return data offset.328329@Cautions Allowed only following FM_VSP_Init().330*//***************************************************************************/331uint32_t FM_VSP_GetBufferDataOffset(t_Handle h_FmVsp);332333/**************************************************************************//**334@Function FM_VSP_GetBufferICInfo335336@Description Returns the Internal Context offset from the beginning of the data buffer337338@Param[in] h_FmVsp - FM PORT module descriptor339@Param[in] p_Data - A pointer to the data buffer.340341@Return Internal context info pointer on success, NULL if 'allOtherInfo' was not342configured for this port.343344@Cautions Allowed only following FM_VSP_Init().345*//***************************************************************************/346uint8_t * FM_VSP_GetBufferICInfo(t_Handle h_FmVsp, char *p_Data);347348/**************************************************************************//**349@Function FM_VSP_GetBufferPrsResult350351@Description Returns the pointer to the parse result in the data buffer.352In Rx ports this is relevant after reception, if parse353result is configured to be part of the data passed to the354application. For non Rx ports it may be used to get the pointer355of the area in the buffer where parse result should be356initialized - if so configured.357See FM_VSP_ConfigBufferPrefixContent for data buffer prefix358configuration.359360@Param[in] h_FmVsp - FM PORT module descriptor361@Param[in] p_Data - A pointer to the data buffer.362363@Return Parse result pointer on success, NULL if parse result was not364configured for this port.365366@Cautions Allowed only following FM_VSP_Init().367*//***************************************************************************/368t_FmPrsResult * FM_VSP_GetBufferPrsResult(t_Handle h_FmVsp, char *p_Data);369370/**************************************************************************//**371@Function FM_VSP_GetBufferTimeStamp372373@Description Returns the time stamp in the data buffer.374Relevant for Rx ports for getting the buffer time stamp.375See FM_VSP_ConfigBufferPrefixContent for data buffer prefix376configuration.377378@Param[in] h_FmVsp - FM PORT module descriptor379@Param[in] p_Data - A pointer to the data buffer.380381@Return A pointer to the hash result on success, NULL otherwise.382383@Cautions Allowed only following FM_VSP_Init().384*//***************************************************************************/385uint64_t * FM_VSP_GetBufferTimeStamp(t_Handle h_FmVsp, char *p_Data);386387/**************************************************************************//**388@Function FM_VSP_GetBufferHashResult389390@Description Given a data buffer, on the condition that hash result was defined391as a part of the buffer content (see FM_VSP_ConfigBufferPrefixContent)392this routine will return the pointer to the hash result location in the393buffer prefix.394395@Param[in] h_FmVsp - FM PORT module descriptor396@Param[in] p_Data - A pointer to the data buffer.397398@Return A pointer to the hash result on success, NULL otherwise.399400@Cautions Allowed only following FM_VSP_Init().401*//***************************************************************************/402uint8_t * FM_VSP_GetBufferHashResult(t_Handle h_FmVsp, char *p_Data);403404405/** @} */ /* end of FM_VSP_control_grp group */406/** @} */ /* end of FM_VSP_grp group */407/** @} */ /* end of FM_grp group */408409410#endif /* __FM_VSP_EXT_H */411412413