Exemplo n.º 1
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);
}
Exemplo n.º 2
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);
}
Exemplo n.º 3
0
/*
 *  ======== SERVICES_Exit ========
 *  Purpose:
 *      Discontinue usage of module; free resources when reference count
 *      reaches 0.
 */
void SERVICES_Exit(void)
{
	/* Uninitialize all SERVICES modules here */
	NTFY_Exit();
	SYNC_Exit();
	CLK_Exit();
	REG_Exit();
	DBG_Exit();
	CFG_Exit();
	MEM_Exit();

	GT_exit();
}
Exemplo n.º 4
0
/*
 *  ======== SERVICES_Init ========
 *  Purpose:
 *      Initializes SERVICES modules.
 */
bool SERVICES_Init(void)
{
	bool fInit = true;
	bool fCFG, fDBG, fMEM;
	bool fREG, fSYNC, fCLK, fNTFY;

	GT_init();
	GT_create(&SERVICES_debugMask, "OS");	/* OS for OSal */

	/* Perform required initialization of SERVICES modules. */
	fMEM = MEM_Init();
	fSYNC = SYNC_Init();
	fREG = REG_Init();
	fCFG = CFG_Init();
	fDBG = DBG_Init();
	fCLK  = CLK_Init();
	fNTFY = NTFY_Init();

	fInit = fCFG && fDBG && fMEM && fREG && fSYNC && fCLK;

	if (!fInit) {
		if (fNTFY)
			NTFY_Exit();

		if (fSYNC)
			SYNC_Exit();

		if (fCLK)
			CLK_Exit();

		if (fREG)
			REG_Exit();

		if (fDBG)
			DBG_Exit();

		if (fCFG)
			CFG_Exit();

		if (fMEM)
			MEM_Exit();

	}

	return fInit;
}
Exemplo n.º 5
0
/*
 *  ======== SERVICES_Init ========
 *  Purpose:
 *      Initializes SERVICES modules.
 */
bool SERVICES_Init(void)
{
	bool fInit = true;
	bool fCFG, fCSL, fDBG, fDPC, fKFILE, fLST, fMEM;
	bool fREG, fSYNC, fCLK, fNTFY;

	DBC_Require(cRefs >= 0);

	if (cRefs == 0) {

		GT_init();
		GT_create(&SERVICES_debugMask, "OS");	/* OS for OSal */

		GT_0trace(SERVICES_debugMask, GT_ENTER,
			 "SERVICES_Init: entered\n");

		/* Perform required initialization of SERVICES modules. */
		fMEM = MEM_Init();
		fREG = REG_Init();
		fCFG = CFG_Init();
		fCSL = CSL_Init();
		fDBG = DBG_Init();
		fDPC = DPC_Init();
		fKFILE = KFILE_Init();
		fLST = LST_Init();
		fSYNC = SYNC_Init();
		fCLK  = CLK_Init();
		fNTFY = NTFY_Init();

		fInit = fCFG && fCSL && fDBG && fDPC && fKFILE &&
			fLST && fMEM && fREG && fSYNC && fCLK;

		if (!fInit) {
			if (fNTFY)
				NTFY_Exit();

			if (fSYNC)
				SYNC_Exit();

			if (fCLK)
				CLK_Exit();

			if (fREG)
				REG_Exit();

			if (fLST)
				LST_Exit();

			if (fKFILE)
				KFILE_Exit();

			if (fDPC)
				DPC_Exit();

			if (fDBG)
				DBG_Exit();

			if (fCSL)
				CSL_Exit();

			if (fCFG)
				CFG_Exit();

			if (fMEM)
				MEM_Exit();

		}
	}

	if (fInit)
		cRefs++;

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

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

	return fInit;
}
Exemplo n.º 6
0
/*
 *  ======== WCD_Init ========
 *  Purpose:
 *      Module initialization is done by SERVICES Init.
 */
bool WCD_Init(void)
{
	bool fInit = true;
	bool fDRV, fDEV, fCOD, fSERVICES, fCHNL, fMSG, fIO;
	bool fMGR, fPROC, fNODE, fDISP, fNTFY, fSTRM, fRMM;
#ifdef DEBUG
	/* runtime check of Device IOCtl array. */
	u32 i;
	int cmdtable = ARRAY_SIZE(WCD_cmdTable);

	for (i = 1; i < cmdtable; i++)
		DBC_Assert(WCD_cmdTable[i - 1].dwIndex == i);

#endif
	if (WCD_cRefs == 0) {
		/* initialize all SERVICES modules */
		fSERVICES = SERVICES_Init();
		/* initialize debugging module */
		DBC_Assert(!WCD_debugMask.flags);
		GT_create(&WCD_debugMask, "CD");    /* CD for class driver */
		/* initialize class driver and other modules */
		fDRV = DRV_Init();
		fMGR = MGR_Init();
		fPROC = PROC_Init();
		fNODE = NODE_Init();
		fDISP = DISP_Init();
		fNTFY = NTFY_Init();
		fSTRM = STRM_Init();
		fRMM = RMM_init();
		fCHNL = CHNL_Init();
		fMSG = MSG_Init();
		fIO = IO_Init();
		fDEV = DEV_Init();
		fCOD = COD_Init();
		fInit = fSERVICES && fDRV && fDEV && fCHNL && fCOD &&
			fMSG && fIO;
		fInit = fInit && fMGR && fPROC && fRMM;
		if (!fInit) {
			if (fSERVICES)
				SERVICES_Exit();

			if (fDRV)
				DRV_Exit();

			if (fMGR)
				MGR_Exit();

			if (fSTRM)
				STRM_Exit();

			if (fPROC)
				PROC_Exit();

			if (fNODE)
				NODE_Exit();

			if (fDISP)
				DISP_Exit();

			if (fNTFY)
				NTFY_Exit();

			if (fCHNL)
				CHNL_Exit();

			if (fMSG)
				MSG_Exit();

			if (fIO)
				IO_Exit();

			if (fDEV)
				DEV_Exit();

			if (fCOD)
				COD_Exit();

			if (fRMM)
				RMM_exit();

		}
	}
	if (fInit)
		WCD_cRefs++;

	GT_1trace(WCD_debugMask, GT_5CLASS,
		 "Entered WCD_Init, ref count: 0x%x\n",	WCD_cRefs);
	return fInit;
}