예제 #1
0
/*
 *  ======== WMD_CHNL_Destroy ========
 *  Purpose:
 *      Close all open channels, and destroy the channel manager.
 */
DSP_STATUS WMD_CHNL_Destroy(struct CHNL_MGR *hChnlMgr)
{
	DSP_STATUS status = DSP_SOK;
	struct CHNL_MGR *pChnlMgr = hChnlMgr;
	u32 iChnl;

	if (MEM_IsValidHandle(hChnlMgr, CHNL_MGRSIGNATURE)) {
		/* Close all open channels: */
		for (iChnl = 0; iChnl < pChnlMgr->cChannels; iChnl++) {
			if (DSP_SUCCEEDED
			    (WMD_CHNL_Close(pChnlMgr->apChannel[iChnl]))) {
				DBC_Assert(pChnlMgr->apChannel[iChnl] == NULL);
			}
		}
		/* release critical section */
		if (pChnlMgr->hCSObj)
			SYNC_DeleteCS(pChnlMgr->hCSObj);

		/* Free channel manager object: */
		if (pChnlMgr->apChannel)
			MEM_Free(pChnlMgr->apChannel);

		/* Set hChnlMgr to NULL in device object. */
		DEV_SetChnlMgr(pChnlMgr->hDevObject, NULL);
		/* Free this Chnl Mgr object: */
		MEM_FreeObject(hChnlMgr);
	} else {
		status = DSP_EHANDLE;
	}
	return status;
}
예제 #2
0
/*
 *  ======== WMD_CHNL_Destroy ========
 *  Purpose:
 *      Close all open channels, and destroy the channel manager.
 */
DSP_STATUS WMD_CHNL_Destroy(struct CHNL_MGR *hChnlMgr)
{
	DSP_STATUS status = DSP_SOK;
	struct CHNL_MGR *pChnlMgr = hChnlMgr;
	u32 iChnl;

	if (MEM_IsValidHandle(hChnlMgr, CHNL_MGRSIGNATURE)) {
		/* Close all open channels: */
		for (iChnl = 0; iChnl < pChnlMgr->cChannels; iChnl++) {
			status = WMD_CHNL_Close(pChnlMgr->apChannel[iChnl]);
			if (DSP_FAILED(status))
				DBG_Trace(DBG_LEVEL7, "Error in CHNL_Close "
						"status 0x%x\n", status);
		}
		/* release critical section */
		if (pChnlMgr->hCSObj)
			SYNC_DeleteCS(pChnlMgr->hCSObj);

		/* Free channel manager object: */
		kfree(pChnlMgr->apChannel);

		/* Set hChnlMgr to NULL in device object. */
		DEV_SetChnlMgr(pChnlMgr->hDevObject, NULL);
		/* Free this Chnl Mgr object: */
		MEM_FreeObject(hChnlMgr);
	} else {
		status = DSP_EHANDLE;
	}
	return status;
}
예제 #3
0
/*
 *  ======== DeleteMsgMgr ========
 */
static void DeleteMsgMgr(struct MSG_MGR *hMsgMgr)
{
	DBC_Require(MEM_IsValidHandle(hMsgMgr, MSGMGR_SIGNATURE));

	if (hMsgMgr->queueList) {
               if (LST_IsEmpty(hMsgMgr->queueList)) {
                       LST_Delete(hMsgMgr->queueList);
                       hMsgMgr->queueList = NULL;
               }
	}

       if (hMsgMgr->msgFreeList) {
		FreeMsgList(hMsgMgr->msgFreeList);
               hMsgMgr->msgFreeList = NULL;
       }

       if (hMsgMgr->msgUsedList) {
		FreeMsgList(hMsgMgr->msgUsedList);
               hMsgMgr->msgUsedList = NULL;
       }

	if (hMsgMgr->hSyncEvent)
		SYNC_CloseEvent(hMsgMgr->hSyncEvent);

	if (hMsgMgr->hSyncCS)
		SYNC_DeleteCS(hMsgMgr->hSyncCS);

	MEM_FreeObject(hMsgMgr);
}
예제 #4
0
파일: ntfy.c 프로젝트: ka6sox/nook_kernel
/*
 *  ======== 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;
}
예제 #5
0
파일: ntfy.c 프로젝트: ka6sox/nook_kernel
/*
 *  ======== NTFY_Delete ========
 *  Purpose:
 *      Free resources allocated in NTFY_Create.
 */
void NTFY_Delete(struct NTFY_OBJECT *hNtfy)
{
	struct NOTIFICATION *pNotify;

	DBC_Require(MEM_IsValidHandle(hNtfy, NTFY_SIGNATURE));

	/* Remove any elements remaining in list */
	if (hNtfy->notifyList) {

		(void) SYNC_EnterCS(hNtfy->hSync);
	
		while ((pNotify = (struct NOTIFICATION *)LST_GetHead(hNtfy->
								notifyList))) {
			DeleteNotify(pNotify);
		}
		DBC_Assert(LST_IsEmpty(hNtfy->notifyList));
		kfree(hNtfy->notifyList);

		(void) SYNC_LeaveCS(hNtfy->hSync);
	}

	
	if (hNtfy->hSync)
		(void)SYNC_DeleteCS(hNtfy->hSync);

	MEM_FreeObject(hNtfy);
}
예제 #6
0
/*
 *  ======== REG_Exit ========
 *  Discontinue usage of the REG module.
 */
void REG_Exit(void)
{
	if (reglock)
		SYNC_DeleteCS(reglock);

	crefs--;

	regsupExit();
}
예제 #7
0
/*
 *  ======== DeleteStrmMgr ========
 *  Purpose:
 *      Frees stream manager.
 */
static void DeleteStrmMgr(struct STRM_MGR *hStrmMgr)
{
	if (MEM_IsValidHandle(hStrmMgr, STRMMGR_SIGNATURE)) {

		if (hStrmMgr->hSync)
			SYNC_DeleteCS(hStrmMgr->hSync);

		MEM_FreeObject(hStrmMgr);
	}
}
예제 #8
0
/*
 *  ======== DMM_Destroy ========
 *  Purpose:
 *      Release the communication memory manager resources.
 */
DSP_STATUS DMM_Destroy(struct DMM_OBJECT *hDmmMgr)
{
	struct DMM_OBJECT *pDmmObj = (struct DMM_OBJECT *)hDmmMgr;
	DSP_STATUS status = DSP_SOK;

	GT_1trace(DMM_debugMask, GT_ENTER,
		"Entered DMM_Destroy () hDmmMgr %x\n", hDmmMgr);
	DBC_Require(cRefs > 0);
	if (MEM_IsValidHandle(hDmmMgr, DMMSIGNATURE)) {
		status = DMM_DeleteTables(pDmmObj);
		if (DSP_SUCCEEDED(status)) {
			/* Delete CS & dmm mgr object */
			SYNC_DeleteCS(pDmmObj->hDmmLock);
			MEM_FreeObject(pDmmObj);
		} else
			GT_0trace(DMM_debugMask, GT_7CLASS,
			 "DMM_Destroy: DMM_DeleteTables "
			 "Failure\n");
	} else
		status = DSP_EHANDLE;
	GT_1trace(DMM_debugMask, GT_4CLASS, "Leaving DMM_Destroy status %x\n",
								status);
	return status;
}