Exemple #1
0
/** ============================================================================
 *  @func   KFILEDEF_Tell
 *
 *  @desc   Returns the current file pointer position for the specified
 *          file handle.
 *
 *  @modif  None
 *  ============================================================================
 */
EXPORT_API
DSP_STATUS
KFILEDEF_Tell (IN  Void *        fileHandle,
               OUT Int32 *       pos)
{
    DSP_STATUS   status = DSP_SOK ;
    KFILEDEF_Object * fileObj = NULL ;

    TRC_2ENTER ("KFILEDEF_Tell", fileObj, pos) ;

    DBC_Require (fileHandle != NULL) ;
    DBC_Require (pos != NULL) ;

    if (pos == NULL) {
        status = DSP_EINVALIDARG ;
        SET_FAILURE_REASON ;
    }
    else {
        fileObj = (KFILEDEF_Object *) fileHandle ;
        *pos = fileObj->curPos ;
        DBC_Assert (*pos == fileObj->fileDesc->f_pos) ;
    }

    DBC_Ensure (   (DSP_SUCCEEDED (status) && (pos != NULL) && (*pos >= 0))
                   || (DSP_FAILED (status))) ;

    TRC_1LEAVE ("KFILEDEF_Tell", status) ;

    return status ;
}
Exemple #2
0
/*
 *  ======== SERVICES_Exit ========
 *  Purpose:
 *      Discontinue usage of module; free resources when reference count
 *      reaches 0.
 */
void SERVICES_Exit(void)
{
	DBC_Require(cRefs > 0);

	GT_1trace(SERVICES_debugMask, GT_5CLASS, "SERVICES_Exit: cRefs 0x%x\n",
		 cRefs);

	cRefs--;
	if (cRefs == 0) {
		/* Uninitialize all SERVICES modules here */
		NTFY_Exit();
		SYNC_Exit();
		CLK_Exit();
		REG_Exit();
		LST_Exit();
		KFILE_Exit();
		DPC_Exit();
		DBG_Exit();
		CSL_Exit();
		CFG_Exit();
		MEM_Exit();

		GT_exit();
	}

	DBC_Ensure(cRefs >= 0);
}
Exemple #3
0
/*
 *  ======== NTFY_Create ========
 *  Purpose:
 *      Create an empty list of notifications.
 */
DSP_STATUS NTFY_Create(struct NTFY_OBJECT **phNtfy)
{
	struct NTFY_OBJECT *pNtfy;
	DSP_STATUS status = DSP_SOK;

	DBC_Require(phNtfy != NULL);

	*phNtfy = NULL;
	MEM_AllocObject(pNtfy, struct NTFY_OBJECT, NTFY_SIGNATURE);

	if (pNtfy) {

		status = SYNC_InitializeDPCCS(&pNtfy->hSync);
		if (DSP_SUCCEEDED(status)) {
			pNtfy->notifyList = MEM_Calloc(sizeof(struct LST_LIST),
							MEM_NONPAGED);
			if (pNtfy->notifyList == NULL) {
				(void) SYNC_DeleteCS(pNtfy->hSync);
				MEM_FreeObject(pNtfy);
				status = DSP_EMEMORY;
			} else {
				INIT_LIST_HEAD(&pNtfy->notifyList->head);
				*phNtfy = pNtfy;
			}
		}
	} else {
		status = DSP_EMEMORY;
	}

	DBC_Ensure((DSP_FAILED(status) && *phNtfy == NULL) ||
		  (DSP_SUCCEEDED(status) && MEM_IsValidHandle((*phNtfy),
		  NTFY_SIGNATURE)));

	return status;
}
Exemple #4
0
/*
 *  ======== WCD_Exit ========
 */
void WCD_Exit(void)
{
	DBC_Require(WCD_cRefs > 0);
	WCD_cRefs--;
	GT_1trace(WCD_debugMask, GT_5CLASS,
		 "Entered WCD_Exit, ref count:  0x%x\n", WCD_cRefs);
	if (WCD_cRefs == 0) {
		/* Release all WCD modules initialized in WCD_Init(). */
		COD_Exit();
		DEV_Exit();
		CHNL_Exit();
		MSG_Exit();
		IO_Exit();
		STRM_Exit();
		NTFY_Exit();
		DISP_Exit();
		NODE_Exit();
		PROC_Exit();
		MGR_Exit();
		RMM_exit();
		DRV_Exit();
		SERVICES_Exit();
	}
	DBC_Ensure(WCD_cRefs >= 0);
}
Exemple #5
0
/** ============================================================================
 *  @func   MEM_Calloc
 *
 *  @desc   Allocates the specified number of bytes and memory is set to zero.
 *
 *  @modif  None
 *  ============================================================================
 */
EXPORT_API
DSP_STATUS
MEM_Calloc (OUT Void ** ptr, IN Uint32 cBytes, IN OUT Pvoid arg)
{
    DSP_STATUS status = DSP_SOK ;
    Uint32       i                ;

    TRC_3ENTER ("MEM_Calloc", ptr, cBytes, arg) ;

    DBC_Require (ptr != NULL) ;
    DBC_Require (MEM_IsInitialized == TRUE) ;
    DBC_Require (cBytes != 0) ;

    status = MEM_Alloc (ptr, cBytes, arg) ;

    if (DSP_SUCCEEDED (status)) {
        for (i = 0 ; i < cBytes ; i++) {
            (*(Uint8 **) ptr)[i] = 0 ;
        }
    }

    DBC_Ensure (   ((ptr == NULL) && DSP_FAILED (status))
                || ((ptr != NULL) && (*ptr != NULL) && DSP_SUCCEEDED (status))
                || ((ptr != NULL) && (*ptr == NULL) && DSP_FAILED (status))) ;

    TRC_1LEAVE ("MEM_Calloc", status) ;

    return  status ;
}
Exemple #6
0
/*
 *  ======== RMM_init ========
 */
bool RMM_init(void)
{
	bool retVal = true;

	DBC_Require(cRefs >= 0);

	if (cRefs == 0) {
		DBC_Assert(!RMM_debugMask.flags);
		GT_create(&RMM_debugMask, "RM");	/* "RM" for RMm */

		retVal = MEM_Init();

		if (!retVal)
			MEM_Exit();

	}

	if (retVal)
		cRefs++;

	GT_1trace(RMM_debugMask, GT_5CLASS,
		 "RMM_init(), ref count:  0x%x\n",
		 cRefs);

	DBC_Ensure((retVal && (cRefs > 0)) || (!retVal && (cRefs >= 0)));

	return retVal;
}
Exemple #7
0
/** ============================================================================
 *  @func   KFILEDEF_Close
 *
 *  @desc   Closes a file handle.
 *
 *  @modif  None
 *  ============================================================================
 */
EXPORT_API
DSP_STATUS
KFILEDEF_Close (IN Void * fileHandle)
{
    DSP_STATUS   status = DSP_SOK ;
    mm_segment_t fs               ;
    KFILEDEF_Object * fileObj = NULL ;

    TRC_1ENTER ("KFILEDEF_Close", fileHandle) ;

    DBC_Require (fileHandle != NULL);

    if (fileHandle == NULL) {
        status = DSP_EFILE ;
        SET_FAILURE_REASON ;
    }
    else {
        fileObj = (KFILEDEF_Object *) fileHandle ;
        fs = get_fs () ;
        set_fs (KERNEL_DS) ;
        filp_close (fileObj->fileDesc, NULL) ;
        set_fs (fs) ;
        FREE_PTR (fileObj) ;

    }

    DBC_Ensure (   (DSP_SUCCEEDED (status) && (fileObj == NULL))
                   || (DSP_FAILED (status))) ;

    TRC_1LEAVE ("KFILEDEF_Close", status) ;

    return status ;
}
/*
 *  ======== STRM_RegisterNotify ========
 *  Purpose:
 *      Register to be notified on specific events for this stream.
 */
DSP_STATUS STRM_RegisterNotify(struct STRM_OBJECT *hStrm, u32 uEventMask,
			      u32 uNotifyType, struct DSP_NOTIFICATION
			      *hNotification)
{
	struct WMD_DRV_INTERFACE *pIntfFxns;
	DSP_STATUS status = DSP_SOK;

	DBC_Require(cRefs > 0);
	DBC_Require(hNotification != NULL);


	if ((uEventMask & ~((DSP_STREAMIOCOMPLETION) |
		 DSP_STREAMDONE)) != 0) {
		status = DSP_EVALUE;
	} else {
		if (uNotifyType != DSP_SIGNALEVENT)
			status = DSP_ENOTIMPL;

	}
	if (DSP_SUCCEEDED(status)) {
		pIntfFxns = hStrm->hStrmMgr->pIntfFxns;

		status = (*pIntfFxns->pfnChnlRegisterNotify)(hStrm->hChnl,
			 uEventMask, uNotifyType, hNotification);
	}
	/* ensure we return a documented return code */
	DBC_Ensure(DSP_SUCCEEDED(status) || status == DSP_EHANDLE ||
		  status == DSP_ETIMEOUT || status == DSP_ETRANSLATE ||
		  status == DSP_ENOTIMPL || status == DSP_EFAIL);
	return status;
}
/*
 *  ======== WMD_CHNL_Close ========
 *  Purpose:
 *      Ensures all pending I/O on this channel is cancelled, discards all
 *      queued I/O completion notifications, then frees the resources allocated
 *      for this channel, and makes the corresponding logical channel id
 *      available for subsequent use.
 */
DSP_STATUS WMD_CHNL_Close(struct CHNL_OBJECT *hChnl)
{
	DSP_STATUS status;
	struct CHNL_OBJECT *pChnl = (struct CHNL_OBJECT *)hChnl;

	/* Check args: */
	if (!MEM_IsValidHandle(pChnl, CHNL_SIGNATURE)) {
		status = DSP_EHANDLE;
		goto func_cont;
	}
	{
		/* Cancel IO: this ensures no further IO requests or
		 * notifications.*/
		status = WMD_CHNL_CancelIO(hChnl);
	}
func_cont:
	if (DSP_SUCCEEDED(status)) {
		/* Assert I/O on this channel is now cancelled: Protects
		 * from IO_DPC. */
		DBC_Assert((pChnl->dwState & CHNL_STATECANCEL));
		/* Invalidate channel object: Protects from
		 * CHNL_GetIOCompletion(). */
		pChnl->dwSignature = 0x0000;
		/* Free the slot in the channel manager: */
		pChnl->pChnlMgr->apChannel[pChnl->uId] = NULL;
		pChnl->pChnlMgr->cOpenChannels -= 1;
		if (pChnl->hNtfy) {
			NTFY_Delete(pChnl->hNtfy);
			pChnl->hNtfy = NULL;
		}
		/* Reset channel event: (NOTE: hUserEvent freed in user
		 * context.). */
		if (pChnl->hSyncEvent) {
			SYNC_ResetEvent(pChnl->hSyncEvent);
			SYNC_CloseEvent(pChnl->hSyncEvent);
			pChnl->hSyncEvent = NULL;
		}
		/* Free I/O request and I/O completion queues:  */
		if (pChnl->pIOCompletions) {
			FreeChirpList(pChnl->pIOCompletions);
			pChnl->pIOCompletions = NULL;
			pChnl->cIOCs = 0;
		}
		if (pChnl->pIORequests) {
			FreeChirpList(pChnl->pIORequests);
			pChnl->pIORequests = NULL;
			pChnl->cIOReqs = 0;
		}
		if (pChnl->pFreeList) {
			FreeChirpList(pChnl->pFreeList);
			pChnl->pFreeList = NULL;
		}
		/* Release channel object. */
		MEM_FreeObject(pChnl);
		pChnl = NULL;
	}
	DBC_Ensure(DSP_FAILED(status) ||
		  !MEM_IsValidHandle(pChnl, CHNL_SIGNATURE));
	return status;
}
Exemple #10
0
/** ============================================================================
 *  @func   ISR_Initialize
 *
 *  @desc   Initialize the module and allocate resource used by this module.
 *
 *  @modif  ISR_InstalledIsrs, ISR_IsInitialized
 *  ============================================================================
 */
EXPORT_API
DSP_STATUS
ISR_Initialize ()
{
    DSP_STATUS  status = DSP_SOK ;
    Uint32      index  = 0       ;
    Uint32      procId = 0       ;

    TRC_0ENTER ("Entered ISR_Initialize ()\n") ;

    DBC_Require (ISR_IsInitialized == FALSE) ;

    if (ISR_IsInitialized == FALSE) {
        for (procId = 0 ; procId < MAX_DSPS ; procId ++) {
            for (index = 0 ; index < MAX_ISR ; index ++) {
                ISR_InstalledIsrs [procId][index] = NULL ;
            }
        }
        ISR_IsInitialized = TRUE ;
    }

    DBC_Ensure (ISR_IsInitialized == TRUE) ;

    TRC_1LEAVE ("ISR_Initialize", status) ;

    return status ;
}
Exemple #11
0
/*
 *  ======== MGR_Init ========
 *      Initialize MGR's private state, keeping a reference count on each call.
 */
bool MGR_Init(void)
{
	bool fRetval = true;
	bool fInitDCD = false;

	DBC_Require(cRefs >= 0);

	if (cRefs == 0) {

		/* Set the Trace mask */
		DBC_Assert(!MGR_DebugMask.flags);

		GT_create(&MGR_DebugMask, "MG");	/* "MG" for Manager */
		fInitDCD = DCD_Init();	/*  DCD Module */

		if (!fInitDCD) {
			fRetval = false;
			GT_0trace(MGR_DebugMask, GT_6CLASS,
				 "MGR_Init failed\n");
		}
	}

	if (fRetval)
		cRefs++;


	GT_1trace(MGR_DebugMask, GT_5CLASS,
		 "Entered MGR_Init, ref count:  0x%x\n", cRefs);
	DBC_Ensure((fRetval && (cRefs > 0)) || (!fRetval && (cRefs >= 0)));

	return fRetval;
}
Exemple #12
0
/*
 *  ======== DMM_Init ========
 *  Purpose:
 *      Initializes private state of DMM module.
 */
bool DMM_Init(void)
{
	bool fRetval = true;

	DBC_Require(cRefs >= 0);

	if (cRefs == 0) {
		/* Set the Trace mask */
		/*"DM" for Dymanic Memory Manager */
		GT_create(&DMM_debugMask, "DM");
	}

	if (fRetval)
		cRefs++;

	GT_1trace(DMM_debugMask, GT_ENTER,
		 "Entered DMM_Init, ref count:0x%x\n", cRefs);

	DBC_Ensure((fRetval && (cRefs > 0)) || (!fRetval && (cRefs >= 0)));

	pVirtualMappingTable = NULL ;
	pPhysicalAddrTable = NULL ;
	TableSize = 0;

	return fRetval;
}
/* This function is called when all applications close handles to the bridge
 * driver. */
static int bridge_release(struct inode *ip, struct file *filp)
{
	struct PROCESS_CONTEXT *pr_ctxt;
	int status = 0;

	if (!filp->private_data) {
		status = -EIO;
		goto err;
	}
	pr_ctxt = filp->private_data;

	if (pr_ctxt) {
		DSP_STATUS status;
		flush_signals(current);
		status = DRV_RemoveAllResources(pr_ctxt);
		DBC_Ensure(DSP_SUCCEEDED(status));
		if (pr_ctxt->hProcessor)
			PROC_Detach(pr_ctxt);
		mutex_destroy(&pr_ctxt->strm_mutex);
		mutex_destroy(&pr_ctxt->node_mutex);
		kfree(pr_ctxt);
		filp->private_data = NULL;
	}
err:
#ifdef CONFIG_BRIDGE_RECOVERY
	if (!atomic_dec_return(&bridge_cref))
		complete(&bridge_comp);
#endif

	return status;
}
Exemple #14
0
/*
 *  ======== DBLL_unload ========
 */
void DBLL_unload(struct DBLL_LibraryObj *lib, struct DBLL_Attrs *attrs)
{
	struct DBLL_LibraryObj *zlLib = (struct DBLL_LibraryObj *)lib;
	s32 err = 0;

	DBC_Require(cRefs > 0);
	DBC_Require(MEM_IsValidHandle(zlLib, DBLL_LIBSIGNATURE));
	DBC_Require(zlLib->loadRef > 0);
	GT_1trace(DBLL_debugMask, GT_ENTER, "DBLL_unload: lib: 0x%x\n", lib);
	zlLib->loadRef--;
	/* Unload only if reference count is 0 */
	if (zlLib->loadRef != 0)
		goto func_end;

	zlLib->pTarget->attrs = *attrs;
	if (zlLib->mHandle) {
		err = Dynamic_Unload_Module(zlLib->mHandle,
			&zlLib->symbol.dlSymbol,
			&zlLib->allocate.dlAlloc, &zlLib->init.dlInit);
		if (err != 0) {
			GT_1trace(DBLL_debugMask, GT_5CLASS,
				 "Dynamic_Unload_Module failed: 0x%x\n", err);
		}
	}
	/* remove symbols from symbol table */
	if (zlLib->symTab != NULL) {
		GH_delete(zlLib->symTab);
		zlLib->symTab = NULL;
	}
	/* delete DOFF desc since it holds *lots* of host OS
	 * resources */
	dofClose(zlLib);
func_end:
	DBC_Ensure(zlLib->loadRef >= 0);
}
Exemple #15
0
/*
 *  ======== DBLL_init ========
 */
bool DBLL_init(void)
{
	bool retVal = true;

	DBC_Require(cRefs >= 0);

	if (cRefs == 0) {
		DBC_Assert(!DBLL_debugMask.flags);
		GT_create(&DBLL_debugMask, "DL"); 	/* "DL" for dbDL */
		GH_init();
		retVal = MEM_Init();
		if (!retVal)
			MEM_Exit();

	}

	if (retVal)
		cRefs++;


	GT_1trace(DBLL_debugMask, GT_5CLASS, "DBLL_init(), ref count:  0x%x\n",
		 cRefs);

	DBC_Ensure((retVal && (cRefs > 0)) || (!retVal && (cRefs >= 0)));

	return retVal;
}
Exemple #16
0
/*
 *  ======== DBLL_create ========
 */
DSP_STATUS DBLL_create(struct DBLL_TarObj **pTarget, struct DBLL_Attrs *pAttrs)
{
	struct DBLL_TarObj *pzlTarget;
	DSP_STATUS status = DSP_SOK;

	DBC_Require(cRefs > 0);
	DBC_Require(pAttrs != NULL);
	DBC_Require(pTarget != NULL);

	GT_2trace(DBLL_debugMask, GT_ENTER,
		  "DBLL_create: pTarget: 0x%x pAttrs: "
		  "0x%x\n", pTarget, pAttrs);
	/* Allocate DBL target object */
	MEM_AllocObject(pzlTarget, struct DBLL_TarObj, DBLL_TARGSIGNATURE);
	if (pTarget != NULL) {
		if (pzlTarget == NULL) {
			GT_0trace(DBLL_debugMask, GT_6CLASS,
				 "DBLL_create: Memory allocation"
				 " failed\n");
			*pTarget = NULL;
			status = DSP_EMEMORY;
		} else {
			pzlTarget->attrs = *pAttrs;
			*pTarget = (struct DBLL_TarObj *)pzlTarget;
		}
		DBC_Ensure((DSP_SUCCEEDED(status) &&
			  MEM_IsValidHandle(((struct DBLL_TarObj *)(*pTarget)),
			  DBLL_TARGSIGNATURE)) || (DSP_FAILED(status) &&
			  *pTarget == NULL));
	}

	return status;
}
Exemple #17
0
/*
 *  ========= MGR_Destroy =========
 *     This function is invoked during bridge driver unloading.Frees MGR object.
 */
DSP_STATUS MGR_Destroy(struct MGR_OBJECT *hMgrObject)
{
	DSP_STATUS status = DSP_SOK;
	struct MGR_OBJECT *pMgrObject = (struct MGR_OBJECT *)hMgrObject;

	DBC_Require(cRefs > 0);
	DBC_Require(MEM_IsValidHandle(hMgrObject, SIGNATURE));

	GT_1trace(MGR_DebugMask, GT_ENTER,
		 "Entering MGR_Destroy hMgrObject 0x%x\n", hMgrObject);
	/* Free resources */
	if (hMgrObject->hDcdMgr)
		DCD_DestroyManager(hMgrObject->hDcdMgr);

	MEM_FreeObject(pMgrObject);
	/* Update the Registry with NULL for MGR Object */
	(void)CFG_SetObject(0, REG_MGR_OBJECT);

	GT_2trace(MGR_DebugMask, GT_ENTER,
		 "Exiting MGR_Destroy: hMgrObject: 0x%x\t"
		 "status: 0x%x\n", hMgrObject, status);

	DBC_Ensure(DSP_FAILED(status) ||
		 !MEM_IsValidHandle(hMgrObject, SIGNATURE));

	return status;
}
Exemple #18
0
static void MEM_Check(void)
{
	struct memInfo *pMem;
	struct LST_ELEM *last = &mMan.lst.head;
	struct LST_ELEM *curr = mMan.lst.head.next;

	if (!LST_IsEmpty(&mMan.lst)) {
		GT_0trace(MEM_debugMask, GT_7CLASS, "*** MEMORY LEAK ***\n");
		GT_0trace(MEM_debugMask, GT_7CLASS,
			  "Addr      Size      Caller\n");
		while (curr != last) {
			pMem = (struct memInfo *)curr;
			curr = curr->next;
			if ((u32)pMem > PAGE_OFFSET &&
			    MEM_IsValidHandle(pMem, memInfoSign)) {
				GT_3trace(MEM_debugMask, GT_7CLASS,
					"%lx  %d\t [<%p>]\n",
					(u32) pMem + sizeof(struct memInfo),
					pMem->size, pMem->caller);
				MLST_RemoveElem(&mMan.lst,
						(struct LST_ELEM *) pMem);
				kfree(pMem);
			} else {
				GT_1trace(MEM_debugMask, GT_7CLASS,
					  "Invalid allocation or "
					  "Buffer underflow at %x\n",
					  (u32)pMem +	sizeof(struct memInfo));
				break;
			}
		}
	}
	DBC_Ensure(LST_IsEmpty(&mMan.lst));
}
Exemple #19
0
/** ============================================================================
 *  @func   ISR_Finalize
 *
 *  @desc   This function provides an interface to exit from the ISR module.
 *          It frees up all the used ISRs and releases all the resources used by
 *          this module.
 *
 *  @modif  ISR_InstalledIsrs, ISR_IsInitialized
 *  ============================================================================
 */
EXPORT_API
DSP_STATUS
ISR_Finalize ()
{
    DSP_STATUS  status = DSP_SOK ;
    DSP_STATUS tmpStatus = DSP_SOK ;
    Uint32      index  = 0       ;
    Uint32      procId = 0       ;

    TRC_0ENTER ("ISR_Finalize") ;

    DBC_Require (ISR_IsInitialized == TRUE) ;

    if (ISR_IsInitialized == TRUE) {
        for (procId = 0 ; procId < MAX_DSPS ; procId ++) {
            for (index = 0 ; index < MAX_ISR ; index ++) {
                if (ISR_InstalledIsrs [procId][index] != NULL) {
                    tmpStatus = ISR_Uninstall (
                                            ISR_InstalledIsrs [procId][index]) ;
                    if (DSP_FAILED (tmpStatus) && DSP_SUCCEEDED (status)) {
                        status = tmpStatus ;
                    }
                }
            }
        }
        ISR_IsInitialized = FALSE ;
    }

    DBC_Ensure (ISR_IsInitialized == FALSE) ;

    TRC_1LEAVE ("ISR_Finalize", status) ;

    return status ;
}
/*
 *  ======== STRM_Exit ========
 *  Purpose:
 *      Discontinue usage of STRM module.
 */
void STRM_Exit(void)
{
	DBC_Require(cRefs > 0);

	cRefs--;

	DBC_Ensure(cRefs >= 0);
}
Exemple #21
0
/*
 *  ======== MSG_Exit ========
 */
void MSG_Exit(void)
{
    DBC_Require(cRefs > 0);
    cRefs--;
    GT_1trace(MSG_debugMask, GT_5CLASS,
              "Entered MSG_Exit, ref count: 0x%x\n",	cRefs);
    DBC_Ensure(cRefs >= 0);
}
/*
 *  ======== STRM_Delete ========
 *  Purpose:
 *      Delete the STRM Manager Object.
 */
void STRM_Delete(struct STRM_MGR *hStrmMgr)
{
	DBC_Require(cRefs > 0);
	DBC_Require(MEM_IsValidHandle(hStrmMgr, STRMMGR_SIGNATURE));

	DeleteStrmMgr(hStrmMgr);

	DBC_Ensure(!MEM_IsValidHandle(hStrmMgr, STRMMGR_SIGNATURE));
}
Exemple #23
0
/*
 *  ======== COD_Exit ========
 *  Purpose:
 *      Discontinue usage of the COD module.
 *
 */
void COD_Exit(void)
{
	DBC_Require(cRefs > 0);

	cRefs--;

	GT_1trace(COD_debugMask, GT_ENTER,
		  "Entered COD_Exit, ref count:  0x%x\n", cRefs);

	DBC_Ensure(cRefs >= 0);
}
Exemple #24
0
/*
 *  ======== MGR_Exit ========
 *      Decrement reference count, and free resources when reference count is
 *      0.
 */
void MGR_Exit(void)
{
	DBC_Require(cRefs > 0);
	cRefs--;
	if (cRefs == 0)
		DCD_Exit();

	GT_1trace(MGR_DebugMask, GT_5CLASS,
		 "Entered MGR_Exit, ref count: 0x%x\n", cRefs);
	DBC_Ensure(cRefs >= 0);
}
Exemple #25
0
/*
 *  ======== STRM_Delete ========
 *  Purpose:
 *      Delete the STRM Manager Object.
 */
void STRM_Delete(struct STRM_MGR *hStrmMgr)
{
	DBC_Require(cRefs > 0);
	DBC_Require(MEM_IsValidHandle(hStrmMgr, STRMMGR_SIGNATURE));

	GT_1trace(STRM_debugMask, GT_ENTER, "STRM_Delete: hStrmMgr: 0x%x\n",
		 hStrmMgr);

	DeleteStrmMgr(hStrmMgr);

	DBC_Ensure(!MEM_IsValidHandle(hStrmMgr, STRMMGR_SIGNATURE));
}
Exemple #26
0
/*
 *  ======== RMM_exit ========
 */
void RMM_exit(void)
{
	DBC_Require(cRefs > 0);

	cRefs--;

	GT_1trace(RMM_debugMask, GT_5CLASS, "RMM_exit() ref count: 0x%x\n",
		 cRefs);

	if (cRefs == 0)
		MEM_Exit();

	DBC_Ensure(cRefs >= 0);
}
Exemple #27
0
/*
 *  ======== MEM_Exit ========
 *  Purpose:
 *      Discontinue usage of the MEM module.
 */
void MEM_Exit(void)
{
	DBC_Require(cRefs > 0);

	GT_1trace(MEM_debugMask, GT_5CLASS, "MEM_Exit: cRefs 0x%x\n", cRefs);

	cRefs--;
#ifdef MEM_CHECK
	if (cRefs == 0)
		MEM_Check();

#endif
	MEM_ExtPhysPoolRelease();
	DBC_Ensure(cRefs >= 0);
}
Exemple #28
0
/*
 *  ========= MGR_Create =========
 *  Purpose:
 *      MGR Object gets created only once during driver Loading.
 */
DSP_STATUS MGR_Create(OUT struct MGR_OBJECT **phMgrObject,
		     struct CFG_DEVNODE *hDevNode)
{
	DSP_STATUS status = DSP_SOK;
	struct MGR_OBJECT *pMgrObject = NULL;

	DBC_Require(phMgrObject != NULL);
	DBC_Require(cRefs > 0);
	GT_1trace(MGR_DebugMask, GT_ENTER,
		 "Entering MGR_Create phMgrObject 0x%x\n ",
		 phMgrObject);
	MEM_AllocObject(pMgrObject, struct MGR_OBJECT, SIGNATURE);
	if (pMgrObject) {
		if (DSP_SUCCEEDED(DCD_CreateManager(ZLDLLNAME,
		   &pMgrObject->hDcdMgr))) {
			/* If succeeded store the handle in the MGR Object */
			if (DSP_SUCCEEDED(CFG_SetObject((u32)pMgrObject,
			   REG_MGR_OBJECT))) {
				*phMgrObject = pMgrObject;
				GT_0trace(MGR_DebugMask, GT_1CLASS,
					 "MGR_Create:MGR Created\r\n");
			} else {
				status = DSP_EFAIL;
				GT_0trace(MGR_DebugMask, GT_7CLASS,
					 "MGR_Create:CFG_SetObject "
					 "Failed\r\n");
				DCD_DestroyManager(pMgrObject->hDcdMgr);
				MEM_FreeObject(pMgrObject);
			}
		} else {
			/* failed to Create DCD Manager */
			status = DSP_EFAIL;
			GT_0trace(MGR_DebugMask, GT_7CLASS,
				 "MGR_Create:DCD_ManagerCreate Failed\r\n");
			MEM_FreeObject(pMgrObject);
		}
	} else {
		status = DSP_EMEMORY;
		GT_0trace(MGR_DebugMask, GT_7CLASS,
			 "MGR_Create DSP_FAILED to allocate memory \n");
	}
	GT_2trace(MGR_DebugMask, GT_ENTER,
		 "Exiting MGR_Create: phMgrObject: 0x%x\t"
		 "status: 0x%x\n", phMgrObject, status);
	DBC_Ensure(DSP_FAILED(status) ||
		  MEM_IsValidHandle(pMgrObject, SIGNATURE));
	return status;
}
/*
 *  ======== UUID_UuidToString ========
 *  Purpose:
 *      Converts a struct DSP_UUID to a string.
 *      Note: snprintf format specifier is:
 *      %[flags] [width] [.precision] [{h | l | I64 | L}]type
 */
void UUID_UuidToString(IN struct DSP_UUID *pUuid, OUT char *pszUuid,
		       IN s32 size)
{
	s32 i;			/* return result from snprintf. */

	DBC_Require(pUuid && pszUuid);

	i = snprintf(pszUuid, size,
		     "%.8X_%.4X_%.4X_%.2X%.2X_%.2X%.2X%.2X%.2X%.2X%.2X",
		     pUuid->ulData1, pUuid->usData2, pUuid->usData3,
		     pUuid->ucData4, pUuid->ucData5, pUuid->ucData6[0],
		     pUuid->ucData6[1], pUuid->ucData6[2], pUuid->ucData6[3],
		     pUuid->ucData6[4], pUuid->ucData6[5]);

	DBC_Ensure(i != -1);
}
Exemple #30
0
/*
 *  ======== LST_PutTail ========
 *  Purpose:
 *      Adds the specified element to the tail of the list
 */
void LST_PutTail(struct LST_LIST *pList, struct LST_ELEM *pElem)
{

	GT_2trace(LST_debugMask, GT_ENTER,
		  "LST_PutTail: pList 0x%x, pElem 0x%x\n",
		  pList, pElem);

	if (!pList || !pElem)
		return;
	pElem->prev = pList->head.prev;
	pElem->next = &pList->head;
	pList->head.prev = pElem;
	pElem->prev->next = pElem;

	DBC_Ensure(!LST_IsEmpty(pList));
}