Beispiel #1
0
/*
 *  ======== STRM_Create ========
 *  Purpose:
 *      Create a STRM manager object.
 */
DSP_STATUS STRM_Create(OUT struct STRM_MGR **phStrmMgr, struct DEV_OBJECT *hDev)
{
	struct STRM_MGR *pStrmMgr;
	DSP_STATUS status = DSP_SOK;

	DBC_Require(cRefs > 0);
	DBC_Require(phStrmMgr != NULL);
	DBC_Require(hDev != NULL);

	GT_2trace(STRM_debugMask, GT_ENTER, "STRM_Create: phStrmMgr: "
		 "0x%x\thDev: 0x%x\n", phStrmMgr, hDev);
	*phStrmMgr = NULL;
	/* Allocate STRM manager object */
	MEM_AllocObject(pStrmMgr, struct STRM_MGR, STRMMGR_SIGNATURE);
	if (pStrmMgr == NULL) {
		status = DSP_EMEMORY;
		GT_0trace(STRM_debugMask, GT_6CLASS, "STRM_Create: "
			 "MEM_AllocObject() failed!\n ");
	} else {
		pStrmMgr->hDev = hDev;
	}
	/* Get Channel manager and WMD function interface */
	if (DSP_SUCCEEDED(status)) {
		status = DEV_GetChnlMgr(hDev, &(pStrmMgr->hChnlMgr));
		if (DSP_SUCCEEDED(status)) {
			(void) DEV_GetIntfFxns(hDev, &(pStrmMgr->pIntfFxns));
			DBC_Assert(pStrmMgr->pIntfFxns != NULL);
		} else {
			GT_1trace(STRM_debugMask, GT_6CLASS, "STRM_Create: "
				 "Failed to get channel manager! status = "
				 "0x%x\n", status);
		}
	}
	if (DSP_SUCCEEDED(status))
		status = SYNC_InitializeCS(&pStrmMgr->hSync);

	if (DSP_SUCCEEDED(status))
		*phStrmMgr = pStrmMgr;
	else
		DeleteStrmMgr(pStrmMgr);

	DBC_Ensure(DSP_SUCCEEDED(status) &&
		  (MEM_IsValidHandle((*phStrmMgr), STRMMGR_SIGNATURE) ||
		  (DSP_FAILED(status) && *phStrmMgr == NULL)));

	return status;
}
Beispiel #2
0
/*
 *  ======== MSG_Create ========
 *  Purpose:
 *      Create an object to manage message queues. Only one of these objects
 *      can exist per device object.
 */
DSP_STATUS MSG_Create(OUT struct MSG_MGR **phMsgMgr,
                      struct DEV_OBJECT *hDevObject, MSG_ONEXIT msgCallback)
{
    struct WMD_DRV_INTERFACE *pIntfFxns;
    struct MSG_MGR_ *pMsgMgr;
    struct MSG_MGR *hMsgMgr;
    DSP_STATUS status = DSP_SOK;

    DBC_Require(cRefs > 0);
    DBC_Require(phMsgMgr != NULL);
    DBC_Require(msgCallback != NULL);
    DBC_Require(hDevObject != NULL);

    GT_3trace(MSG_debugMask, GT_ENTER, "MSG_Create: phMsgMgr: 0x%x\t"
              "hDevObject: 0x%x\tmsgCallback: 0x%x\n",
              phMsgMgr, hDevObject, msgCallback);

    *phMsgMgr = NULL;

    DEV_GetIntfFxns(hDevObject, &pIntfFxns);

    /* Let WMD message module finish the create: */
    status = (*pIntfFxns->pfnMsgCreate)(&hMsgMgr, hDevObject, msgCallback);

    if (DSP_SUCCEEDED(status)) {
        /* Fill in WCD message module's fields of the MSG_MGR
         * structure */
        pMsgMgr = (struct MSG_MGR_ *)hMsgMgr;
        pMsgMgr->pIntfFxns = pIntfFxns;

        /* Finally, return the new message manager handle: */
        *phMsgMgr = hMsgMgr;
        GT_1trace(MSG_debugMask, GT_1CLASS,
                  "MSG_Create: Success pMsgMgr: 0x%x\n",	pMsgMgr);
    } else {
        status = DSP_EFAIL;
    }
    return status;
}
Beispiel #3
0
/*
 *  ======== STRM_Create ========
 *  Purpose:
 *      Create a STRM manager object.
 */
DSP_STATUS STRM_Create(OUT struct STRM_MGR **phStrmMgr, struct DEV_OBJECT *hDev)
{
	struct STRM_MGR *pStrmMgr;
	DSP_STATUS status = DSP_SOK;

	DBC_Require(cRefs > 0);
	DBC_Require(phStrmMgr != NULL);
	DBC_Require(hDev != NULL);

	*phStrmMgr = NULL;
	/* Allocate STRM manager object */
	MEM_AllocObject(pStrmMgr, struct STRM_MGR, STRMMGR_SIGNATURE);
	if (pStrmMgr == NULL)
		status = DSP_EMEMORY;
	else
		pStrmMgr->hDev = hDev;

	/* Get Channel manager and WMD function interface */
	if (DSP_SUCCEEDED(status)) {
		status = DEV_GetChnlMgr(hDev, &(pStrmMgr->hChnlMgr));
		if (DSP_SUCCEEDED(status)) {
			(void) DEV_GetIntfFxns(hDev, &(pStrmMgr->pIntfFxns));
			DBC_Assert(pStrmMgr->pIntfFxns != NULL);
		}
	}
	if (DSP_SUCCEEDED(status))
		status = SYNC_InitializeCS(&pStrmMgr->hSync);

	if (DSP_SUCCEEDED(status))
		*phStrmMgr = pStrmMgr;
	else
		DeleteStrmMgr(pStrmMgr);

	DBC_Ensure(DSP_SUCCEEDED(status) &&
		  (MEM_IsValidHandle((*phStrmMgr), STRMMGR_SIGNATURE) ||
		  (DSP_FAILED(status) && *phStrmMgr == NULL)));

	return status;
}