示例#1
0
eEsifError EsifActMgrInit()
{
	eEsifError rc = ESIF_OK;

	ESIF_TRACE_ENTRY_INFO();

	esif_ccb_lock_init(&g_actMgr.fLock);

	g_actMgr.fActTypes = esif_link_list_create();
	if (NULL == g_actMgr.fActTypes) {
		rc = ESIF_E_NO_MEMORY;
		goto exit;
	}

	g_actMgr.GetActType     = GetActionType;
	g_actMgr.GetActFromName = GetActionFromName;
	g_actMgr.AddActType     = AddAction;
	g_actMgr.RemoveActType  = RemoveAction;

	/* Action manager must be initialized */
	EsifActInit();
exit:
	ESIF_TRACE_EXIT_INFO_W_STATUS(rc);
	return rc;
}
示例#2
0
DataBankPtr DataBank_Create ()
{
	DataBankPtr self = (DataBankPtr)esif_ccb_malloc(sizeof(*self));
	if (self) {
		esif_ccb_lock_init(&self->lock);
	}
	return self;
}
示例#3
0
// constructor
static void DataVault_ctor(DataVaultPtr self)
{
	if (self) {
		WIPEPTR(self);
		esif_ccb_lock_init(&self->lock);
		self->cache  = DataCache_Create();
		self->stream = IOStream_Create();
	}
}
示例#4
0
文件: esif_uf_pm.c 项目: naitaku/dptf
/* Initialize manager */
eEsifError EsifUppMgrInit(void)
{
	eEsifError rc = ESIF_OK;
	ESIF_TRACE_INFO("%s: Init Upper Participant Manager (PM)", ESIF_FUNC);

	/* Initialize Lock */
	esif_ccb_lock_init(&g_uppMgr.fLock);

	return rc;
}
示例#5
0
eEsifError EsifDspMgrInit(void)
{
	eEsifError rc = ESIF_OK;
	ESIF_TRACE_ENTRY_INFO();

	esif_ccb_lock_init(&g_dm.lock);

	rc = esif_dsp_table_build();

	ESIF_TRACE_EXIT_INFO_W_STATUS(rc);
	return rc;
}
示例#6
0
/* Init */
enum esif_rc esif_event_init(void)
{
	ESIF_TRACE_DYN_INIT("%s: Initialize Event\n", ESIF_FUNC);


	g_event_queue = esif_queue_create(1024, g_event_queue_name);
	if (NULL == g_event_queue)
		return ESIF_E_NO_MEMORY;

	esif_ccb_lock_init(&g_event_lock);
	return ESIF_OK;
}
示例#7
0
eEsifError EsifCnjMgrInit()
{
    eEsifError rc = ESIF_OK;

    ESIF_TRACE_DEBUG("%s: Init Action Manager (CNJMGR)", ESIF_FUNC);

    esif_ccb_lock_init(&g_cnjMgr.fLock);

    EsifCnjInit();

    ESIF_TRACE_EXIT_INFO();
    return rc;
}
示例#8
0
文件: esif_uf.c 项目: hoangt/dptf
void esif_memtrace_init()
{
	struct memalloc_s *mem = NULL;

	esif_ccb_lock_init(&g_memtrace.lock);
	esif_ccb_write_lock(&g_memtrace.lock);
	mem = g_memtrace.allocated;

	// Ignore any allocations made before this function was called
	while (mem) {
		struct memalloc_s *node = mem;
		mem = mem->next;
		native_free(node);
	}
	g_memtrace.allocated = NULL;
	esif_ccb_write_unlock(&g_memtrace.lock);
	ESIF_TRACE_EXIT_INFO();
}
示例#9
0
文件: esif_uf.c 项目: hoangt/dptf
eEsifError EsifLogMgrInit(void)
{
	int j;

	ESIF_TRACE_ENTRY_INFO();

	esif_ccb_memset(g_EsifLogFile, 0, sizeof(g_EsifLogFile));
	for (j=0; j < MAX_ESIFLOG; j++) {
		esif_ccb_lock_init(&g_EsifLogFile[j].lock);
	}
	g_EsifLogFile[ESIF_LOG_EVENTLOG].name = esif_ccb_strdup("event");
	g_EsifLogFile[ESIF_LOG_DEBUGGER].name = esif_ccb_strdup("debug");
	g_EsifLogFile[ESIF_LOG_SHELL].name    = esif_ccb_strdup("shell");
	g_EsifLogFile[ESIF_LOG_TRACE].name    = esif_ccb_strdup("trace");
	g_EsifLogFile[ESIF_LOG_UI].name       = esif_ccb_strdup("ui");

	ESIF_TRACE_EXIT_INFO();
	return ESIF_OK;
}
示例#10
0
eEsifError EsifAppMgrInit()
{
	eEsifError rc = ESIF_OK;

	ESIF_TRACE_ENTRY_INFO();

	esif_ccb_lock_init(&g_appMgr.fLock);

	EsifAppInit();

	g_appMgr.GetAppFromName = GetAppFromName;
	g_appMgr.GetPrompt = GetPrompt;

	EsifEventMgr_RegisterEventByType(ESIF_EVENT_PARTICIPANT_SUSPEND, EVENT_MGR_MATCH_ANY, EVENT_MGR_DOMAIN_D0, EsifAppMgr_EventCallback, NULL);
	EsifEventMgr_RegisterEventByType(ESIF_EVENT_PARTICIPANT_RESUME, EVENT_MGR_MATCH_ANY, EVENT_MGR_DOMAIN_D0, EsifAppMgr_EventCallback, NULL);

	ESIF_TRACE_EXIT_INFO_W_STATUS(rc);
	return rc;
}
示例#11
0
eEsifError EsifActMgrInit()
{
	eEsifError rc = ESIF_OK;

	ESIF_TRACE_ENTRY_INFO();

	esif_ccb_lock_init(&g_actMgr.mgrLock);

	g_actMgr.actions = esif_link_list_create();
	if (NULL == g_actMgr.actions) {
		rc = ESIF_E_NO_MEMORY;
		goto exit;
	}

	/* Action manager must be initialized before this call */
	EsifActMgr_InitActions();
exit:
	ESIF_TRACE_EXIT_INFO_W_STATUS(rc);
	return rc;
}
示例#12
0
eEsifError EsifEventMgr_Init(void)
{
	eEsifError rc = ESIF_OK;
	UInt8 i;

	ESIF_TRACE_ENTRY_INFO();

	esif_ccb_lock_init(&g_EsifEventMgr.listLock);

	for (i = 0; i < NUM_EVENT_LISTS; i++) {
		g_EsifEventMgr.observerLists[i] = esif_link_list_create();
		if (NULL == g_EsifEventMgr.observerLists[i]) {
			rc = ESIF_E_NO_MEMORY;
			goto exit;
		}
	}

	g_EsifEventMgr.eventQueuePtr = esif_queue_create(ESIF_UF_EVENT_QUEUE_SIZE, ESIF_UF_EVENT_QUEUE_NAME, ESIF_UF_EVENT_QUEUE_TIMEOUT);
	g_EsifEventMgr.garbageList = esif_link_list_create();

	if ((NULL == g_EsifEventMgr.eventQueuePtr) ||
		(NULL == g_EsifEventMgr.garbageList)) {
		rc = ESIF_E_NO_MEMORY;
		goto exit;
	}

	rc = esif_ccb_thread_create(&g_EsifEventMgr.eventQueueThread, EsifEventMgr_EventQueueThread, NULL);
	if (rc != ESIF_OK) {
		goto exit;
	}
exit:
	if (rc != ESIF_OK) {
		EsifEventMgr_Exit();
	}
	ESIF_TRACE_EXIT_INFO_W_STATUS(rc);
	return rc;
}
示例#13
0
/* Init */
enum esif_rc esif_action_systemio_init(void)
{
	ESIF_TRACE_DYN_INIT("Initialize SYSTEMIO Action\n");
	esif_ccb_lock_init(&g_esif_action_systemio_lock);
	return ESIF_OK;
}
示例#14
0
/*
 * This functions is expected to be called when the system is in a "known" state
 * before any attempt to create a timer
 */
enum esif_rc esif_ccb_tmrm_init(void)
{
	esif_ccb_lock_init(&g_tmrm.mgr_lock);
	g_tmrm.enabled = ESIF_TRUE;
	return ESIF_OK;
}
示例#15
0
/*
 * FUNCTION DEFINITIONS
 */
eEsifError EsifAct_CreateAction(
	EsifActIfacePtr actIfacePtr,
	EsifActPtr *actPtr
	)
{
	eEsifError rc = ESIF_OK;
	EsifActPtr newActPtr = NULL;
	enum esif_action_type actionType;
	UInt16 intfcSize = 0;

	if ((NULL == actIfacePtr) || (NULL == actPtr)){
		rc = ESIF_E_PARAMETER_IS_NULL;
		goto exit;
	}

	/* Check EsifActIface */
	if (!EsifActIface_IsSupported(actIfacePtr)) {
		rc = ESIF_E_IFACE_NOT_SUPPORTED;
		goto exit;	
	}

	intfcSize = EsifActIface_Sizeof(actIfacePtr->hdr.fIfaceVersion);
	if (intfcSize != actIfacePtr->hdr.fIfaceSize) {
		rc = ESIF_E_PARAMETER_IS_OUT_OF_BOUNDS;
		goto exit;
	}

	newActPtr = esif_ccb_malloc(sizeof(*newActPtr));
	if (NULL == newActPtr) {
		rc = ESIF_E_NO_MEMORY;
		goto exit;
	}

	esif_ccb_memcpy(&newActPtr->iface, actIfacePtr, intfcSize);

	rc = EsifActIface_GetType(actIfacePtr, &actionType);
	if (rc != ESIF_OK) {
		goto exit;
	}
	newActPtr->type = actionType;

	newActPtr->refCount = 1;
	newActPtr->markedForDelete = ESIF_FALSE;

	esif_ccb_lock_init(&newActPtr->objLock);
	esif_ccb_event_init(&newActPtr->deleteEvent);

	rc = EsifAct_CallIfaceCreate(newActPtr);
	if (rc != ESIF_OK) {
		goto exit;
	}

	rc = EsifAct_RegisterEvents(newActPtr);
	if (rc != ESIF_OK) {
		goto exit;
	}

	ESIF_TRACE_DEBUG("\n"
		"Created new action:"
		"  Name   : %s\n"
		"  Desc   : %s\n"
		"  Type   : %d\n"
		"  Version: %u\n",
		EsifAct_GetName(newActPtr),
		EsifAct_GetDesc(newActPtr),
		EsifAct_GetType(newActPtr),
		EsifAct_GetVersion(newActPtr));

	*actPtr = newActPtr;
exit:
	if (rc != ESIF_OK) {
		EsifAct_DestroyAction(newActPtr);
	}
	return rc;
}
示例#16
0
// Automatically Load all Static DataVaults and *.dv files in the current folder into the DataBank
eEsifError DataBank_LoadDataVaults (DataBankPtr self)
{
	eEsifError rc = ESIF_OK;
	esif_ccb_file_find_handle find_handle;
	esif_string file_path = 0;
	char file_pattern[MAX_PATH];
	char file_path_buf[MAX_PATH] = {0};
	struct esif_ccb_file *ffd_ptr;
	UInt32 idx;

	ASSERT(self);
	esif_ccb_lock_init(&self->lock);

	// TODO: Locking

	// Import all Static DataVaults into ReadOnly DataVaults
	for (idx = 0; g_StaticDataVaults[idx].name; idx++) {
		DataVaultPtr DB = DataBank_OpenNameSpace(self, g_StaticDataVaults[idx].name);
		if (DB) {
			IOStream_SetMemory(DB->stream, g_StaticDataVaults[idx].buffer, g_StaticDataVaults[idx].buf_len);
			DB->flags |= (ESIF_SERVICE_CONFIG_READONLY | ESIF_SERVICE_CONFIG_NOCACHE);
			DataVault_ReadVault(DB);
		}
	}

	// Create ESIFDV_DIR if it doesn't exit (only 1 level deep for now)
	esif_ccb_makepath(ESIFDV_DIR);

	// Import all matching *.dv files into ReadWrite DataVaults
	esif_ccb_strcpy(file_path_buf, ESIFDV_DIR, sizeof(file_path_buf));
	file_path = file_path_buf;
	esif_ccb_sprintf(MAX_PATH, file_pattern, "*%s", ESIFDV_FILEEXT);
	ffd_ptr   = (struct esif_ccb_file*)esif_ccb_malloc(sizeof(*ffd_ptr));
	if (NULL == ffd_ptr) {
		return ESIF_E_NO_MEMORY;
	}

	find_handle = esif_ccb_file_enum_first(file_path, file_pattern, ffd_ptr);
	if (INVALID_HANDLE_VALUE == find_handle) {
		rc = ESIF_OK;	// No Persisted DataVaults found
	} else {
		do {
			struct esif_ccb_file dv_file = {0};
			DataVaultPtr DB = 0;

			// Read DataVault File, unless it's already been loaded as a Static DataVault
			if (esif_ccb_strlen(ffd_ptr->filename, MAX_PATH) > sizeof(ESIFDV_FILEEXT)) {
				ffd_ptr->filename[esif_ccb_strlen(ffd_ptr->filename, MAX_PATH) - (sizeof(ESIFDV_FILEEXT) - 1)] = 0;	// Truncate ".dv" extension
				if (DataBank_GetNameSpace(self, ffd_ptr->filename) == NULL) {
					DB = DataBank_OpenNameSpace(self, ffd_ptr->filename);
					if (DB) {
						esif_ccb_sprintf(MAX_PATH, dv_file.filename, "%s%s%s", file_path, DB->name, ESIFDV_FILEEXT);
						IOStream_SetFile(DB->stream, dv_file.filename, "rb");
						DataVault_ReadVault(DB);
					}
				}
			}
		} while (esif_ccb_file_enum_next(find_handle, file_pattern, ffd_ptr));
		esif_ccb_file_enum_close(find_handle);
	}
	esif_ccb_free(ffd_ptr);
	return rc;
}