qmss_drv.c File Reference

This is the Queue Manager Low Level Driver file. More...

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include <ti/drv/qmss/qmss_drv.h>
#include <ti/drv/qmss/include/qmss_pvt.h>
#include <ti/drv/qmss/include/qmss_intd.h>
#include <qmss_osal.h>
#include <ti/drv/rm/rm_services.h>

Functions

static Qmss_QueueHnd Qmss_internalQueueOpen (Qmss_SubSysHnd subSysHnd, int qGroupIsSpecified, uint32_t qGroup, Qmss_QueueType queType, int queNum, uint8_t *isAllocated)
Qmss_Result Qmss_initSubSys (Qmss_SubSysHnd *subSysHnd, Qmss_SubSys subSys, Qmss_InitCfg *initCfg, Qmss_GlobalConfigParams *qmssGblCfgParams)
Qmss_Result Qmss_init (Qmss_InitCfg *initCfg, Qmss_GlobalConfigParams *qmssGblCfgParams)
Qmss_Result Qmss_exitSubSys (Qmss_SubSysHnd *subSysHnd)
Qmss_Result Qmss_exit (void)
Qmss_Result Qmss_startSubSysCfg (Qmss_SubSysHnd *subSysHnd, Qmss_SubSys subSys, Qmss_StartCfg *startCfg)
Qmss_Result Qmss_startCfg (Qmss_StartCfg *startCfg)
Qmss_Result Qmss_start (void)
Qmss_Result Qmss_getMemoryRegionCfgSubSys (Qmss_SubSysHnd subSysHnd, Qmss_MemRegCfg *memRegInfo)
Qmss_Result Qmss_getMemoryRegionCfg (Qmss_MemRegCfg *memRegInfo)
Qmss_Result Qmss_insertMemoryRegionSubSys (Qmss_SubSysHnd subSysHnd, Qmss_MemRegInfo *memRegCfg)
Qmss_Result Qmss_insertMemoryRegion (Qmss_MemRegInfo *memRegCfg)
Qmss_Result Qmss_openMemoryRegionSubSys (Qmss_SubSysHnd subSysHnd, Qmss_MemRegion memRegion, uint32_t qGroup)
Qmss_Result Qmss_openMemoryRegion (Qmss_MemRegion memRegion, uint32_t qGroup)
Qmss_Result Qmss_removeMemoryRegionSubSys (Qmss_SubSysHnd subSysHnd, int32_t region, uint32_t qGroup)
Qmss_Result Qmss_removeMemoryRegion (int32_t region, uint32_t qGroup)
Qmss_Result Qmss_closeMemoryRegionSubSys (Qmss_SubSysHnd subSysHnd, int32_t region, uint32_t qGroup)
Qmss_Result Qmss_closeMemoryRegion (int32_t region, uint32_t qGroup)
Qmss_QueueHnd Qmss_initDescriptorSubSys (Qmss_SubSysHnd subSysHnd, Qmss_DescCfg *descCfg, uint32_t *numAllocated)
Qmss_QueueHnd Qmss_initDescriptor (Qmss_DescCfg *descCfg, uint32_t *numAllocated)
Qmss_QueueHnd Qmss_queueOpenInGroupSubSys (Qmss_SubSysHnd subSysHnd, int32_t queGroup, Qmss_QueueType queType, int32_t queNum, uint8_t *isAllocated)
Qmss_QueueHnd Qmss_queueOpenInGroup (int32_t queGroup, Qmss_QueueType queType, int32_t queNum, uint8_t *isAllocated)
Qmss_QueueHnd Qmss_queueOpenSubSys (Qmss_SubSysHnd subSysHnd, Qmss_QueueType queType, int32_t queNum, uint8_t *isAllocated)
Qmss_QueueHnd Qmss_queueOpen (Qmss_QueueType queType, int32_t queNum, uint8_t *isAllocated)
Qmss_QueueHnd Qmss_queueOpenInRangeSubSys (Qmss_SubSysHnd subSysHnd, uint32_t startQueNum, uint32_t endQueNum, uint8_t *isAllocated)
Qmss_QueueHnd Qmss_queueOpenInRange (uint32_t startQueNum, uint32_t endQueNum, uint8_t *isAllocated)
Qmss_QueueHnd Qmss_queueBlockOpenInGroupSubSys (Qmss_SubSysHnd subSysHnd, Qmss_QueueHnd *queueHnds, int32_t queGroup, Qmss_QueueType queType, int32_t numQ, int32_t align)
Qmss_QueueHnd Qmss_queueBlockOpenInGroup (Qmss_QueueHnd *queueHnds, int32_t queGroup, Qmss_QueueType queType, int32_t numQ, int32_t align)
Qmss_QueueHnd Qmss_queueBlockOpenSubSys (Qmss_SubSysHnd subSysHnd, Qmss_QueueHnd *queueHnds, Qmss_QueueType queType, int32_t numQ, int32_t align)
Qmss_QueueHnd Qmss_queueBlockOpen (Qmss_QueueHnd *queueHnds, Qmss_QueueType queType, int32_t numQ, int32_t align)
Qmss_QueueHnd Qmss_queueOpenUseSubSys (Qmss_SubSysHnd subSysHnd, uint32_t QID, uint8_t *useCount)
Qmss_QueueHnd Qmss_queueOpenUse (uint32_t QID, uint8_t *useCount)
Qmss_Result Qmss_queueClose (Qmss_QueueHnd hnd)
uint32_t Qmss_getQueueThreshold (Qmss_QueueHnd hnd)
Qmss_Result Qmss_setQueueThreshold (Qmss_QueueHnd hnd, uint16_t hilo, uint8_t threshold)
Qmss_Result Qmss_getStarvationCounts (Qmss_QueueHnd hnd, uint32_t numCounts, uint32_t *pStarvationCounts)
uint32_t Qmss_getStarvationCount (Qmss_QueueHnd hnd)
uint16_t Qmss_getQueueThresholdStatus (Qmss_QueueHnd hnd)
Qmss_Queue Qmss_getQueueNumber (Qmss_QueueHnd hnd)
uint32_t Qmss_getQueueGroup (Qmss_QueueHnd hnd)
Qmss_QueueHnd Qmss_getQueueHandle (Qmss_Queue queue)
Qmss_Result Qmss_downloadFirmwareSubSys (Qmss_SubSysHnd subSysHnd, Qmss_PdspId pdspId, void *image, uint32_t size)
Qmss_Result Qmss_downloadFirmware (Qmss_PdspId pdspId, void *image, uint32_t size)
Qmss_Result Qmss_setEoiVectorByIntdSubSys (Qmss_SubSysHnd subSysHnd, uint8_t intdNum, Qmss_IntdInterruptType type, uint8_t accumCh)
Qmss_Result Qmss_setEoiVectorByIntd (uint8_t intdNum, Qmss_IntdInterruptType type, uint8_t accumCh)
Qmss_Result Qmss_setEoiVectorSubSys (Qmss_SubSysHnd subSysHnd, Qmss_IntdInterruptType type, uint8_t accumCh)
Qmss_Result Qmss_setEoiVector (Qmss_IntdInterruptType type, uint8_t accumCh)
Qmss_Result Qmss_setEoiIntNumByIntdSubSys (Qmss_SubSysHnd subSysHnd, uint8_t intdNum, uint8_t intNum)
Qmss_Result Qmss_setEoiIntNumByIntd (uint8_t intdNum, uint8_t intNum)
Qmss_Result Qmss_setEoiIntNumSubSys (Qmss_SubSysHnd subSysHnd, uint8_t intNum)
Qmss_Result Qmss_setEoiIntNum (uint8_t intNum)
Qmss_Result Qmss_ackInterruptByIntdSubSys (Qmss_SubSysHnd subSysHnd, uint8_t intdNum, uint8_t interruptNum, uint8_t value)
Qmss_Result Qmss_ackInterruptByIntd (uint8_t intdNum, uint8_t interruptNum, uint8_t value)
Qmss_Result Qmss_ackInterruptSubSys (Qmss_SubSysHnd subSysHnd, uint8_t interruptNum, uint8_t value)
Qmss_Result Qmss_ackInterrupt (uint8_t interruptNum, uint8_t value)
uint32_t Qmss_getVersion (void)
const char * Qmss_getVersionStr (void)
Qmss_QueueHnd Qmss_getMemRegQueueHandleQGroupSubSys (Qmss_SubSysHnd subSysHnd, uint32_t memRegion, uint32_t qGroup)
Qmss_QueueHnd Qmss_getMemRegQueueHandleSubSys (Qmss_SubSysHnd subSysHnd, uint32_t memRegion)
Qmss_QueueHnd Qmss_getMemRegQueueHandle (uint32_t memRegion)
uint32_t Qmss_getMemRegDescSizeSubSys (Qmss_SubSysHnd subSysHnd, uint32_t memRegion, uint32_t qGroup)
uint32_t Qmss_getMemRegDescSize (uint32_t memRegion, uint32_t qGroup)

Variables

const char qmssLldVersionStr [] = QMSS_LLD_VERSION_STR ":" __DATE__ ":" __TIME__
 Global Variable which describes the QMSS LLD Version Information.


Detailed Description

This is the Queue Manager Low Level Driver file.

============================================================================
(C) Copyright 2009-2014, Texas Instruments, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of Texas Instruments Incorporated nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Function Documentation

uint32_t Qmss_getMemRegDescSize ( uint32_t  memRegion,
uint32_t  qGroup 
)

Description
Backwards compatibility wrapper of Qmss_getMemRegDescSizeSubSys which operates on the global subsystem.

uint32_t Qmss_getMemRegDescSizeSubSys ( Qmss_SubSysHnd  subSysHnd,
uint32_t  memRegion,
uint32_t  qGroup 
)

Description
The function returns size of the descriptors in the specified memory region.

This is for *internal* LLD usage.

Parameters:
[in] subSysHnd Handle to specific subsystem returned by Qmss_initSubSys or Qmss_startSubSysCfg.
[in] memRegion Memory region number.
[in] qGroup Queue manager group number
Return values:
Descriptor size

Qmss_QueueHnd Qmss_getMemRegQueueHandle ( uint32_t  memRegion  ) 

Description
Backwards compatibility wrapper of Qmss_getMemRegQueueHandleSubSys which operates on the global subsystem.

Qmss_QueueHnd Qmss_getMemRegQueueHandleQGroupSubSys ( Qmss_SubSysHnd  subSysHnd,
uint32_t  memRegion,
uint32_t  qGroup 
)

Description
The function return the source queue handle on which the descriptors configured for the specified memory region are stored.

Parameters:
[in] subSysHnd Handle to specific subsystem returned by Qmss_initSubSys or Qmss_startSubSysCfg.
[in] memRegion Memory region number
[in] qGroup Queue group (for split mode)
Return values:
Success - Queue Handle
Failure - QMSS_NOT_INITIALIZED

Qmss_QueueHnd Qmss_getMemRegQueueHandleSubSys ( Qmss_SubSysHnd  subSysHnd,
uint32_t  memRegion 
)

Description
The function return the source queue handle on which the descriptors configured for the specified memory region are stored.

Parameters:
[in] subSysHnd Handle to specific subsystem returned by Qmss_initSubSys or Qmss_startSubSysCfg.
[in] memRegion Memory region number
Return values:
Success - Queue Handle
Failure - QMSS_NOT_INITIALIZED Failure - QMSS_API_NO_SPLIT_MODE

static Qmss_QueueHnd Qmss_internalQueueOpen ( Qmss_SubSysHnd  subSysHnd,
int  qGroupIsSpecified,
uint32_t  qGroup,
Qmss_QueueType  queType,
int  queNum,
uint8_t *  isAllocated 
) [static]

Description
Internal queue open function; is called to allocate a queue when critical section is provided by the caller.

A queue can be opened in two ways: 1) If "queNum" is set to QMSS_PARAM_NOT_SPECIFIED, then a new available queue of type "queType" is allocated. 2) If "queNum" is a valid queue number i.e., >= 0, then a queue is allocated if free else a handle to a previously opened queue is returned. In this case "queType" parameter is not used.

Parameters:
[in] subSysHnd Handle to specific subsystem returned by Qmss_initSubSys or Qmss_startSubSysCfg.
[in] qGroupIsSpecified 0: Ignore qGroup in joint mode and allocate per balancing scheme 1: Use gGroup in joint mode
[in] qGroup Specifies queue group to open from (only used in SPLIT mode
[in] queType Specifies the type of queue that should be opened.
[in] queNum Specifies the queue number that should be opened.
[out] isAllocated Indicates whether the requested queue is a new queue allocation(1). or was already allocated. If the queue was previously allocated this parameter returns the reference count.
*
Precondition:
Appropriate Critical section protection should be provided by caller.
Return values:
Success - Queue Handle. Used as an input parameter for operation on this queue.
Failure - QMSS_RESOURCE_ALLOCATE_USE_DENIED
Failure - <0


Variable Documentation

uint32_t alternate

Used to perform round robin allocation

int32_t groupFreeQueues[QMSS_MAX_QMGR_GROUPS]

Used to do load balanced allocation

uint8_t pad[QMSS_MAX_CACHE_ALIGN-sizeof(uint32_t)*(QMSS_MAX_QMGR_GROUPS+1)]

Padding required to make sure linker doesn't put something else on the same cache line.


Copyright 2014, Texas Instruments Incorporated