本文整理汇总了C++中Error_init函数的典型用法代码示例。如果您正苦于以下问题:C++ Error_init函数的具体用法?C++ Error_init怎么用?C++ Error_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Error_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SyslinkMemMgr_SharedMemory_alloc
/* Function to allocate memory from the SyslinkMemMgr */
Ptr SyslinkMemMgr_SharedMemory_alloc(SyslinkMemMgr_SharedMemory_Object *obj,
SyslinkMemMgr_AllocParams *allocParams)
{
Ptr buf = NULL;
Error_Block eb;
Error_init (&eb);
if (obj != NULL) {
buf = Memory_alloc(obj->heapHandle, allocParams->size,
allocParams->align, &eb);
}
return (buf);
}
示例2: Error_init
void Event::begin()
{
Error_Block eb;
Error_init(&eb);
Event_Params params;
Event_Params_init(¶ms);
EventHandle = Event_create(¶ms, &eb);
if (EventHandle == NULL)
{
System_abort("Event create failed");
}
}
示例3: InterruptArp32_intRegister
/*!
* ======== InterruptArp32_intRegister ========
*/
Void InterruptArp32_intRegister(UInt16 remoteProcId,
IInterrupt_IntInfo *intInfo,
Fxn func, UArg arg)
{
UInt key;
Hwi_Params hwiAttrs;
Error_Block eb;
InterruptArp32_FxnTable *table;
Assert_isTrue(remoteProcId < ti_sdo_utils_MultiProc_numProcessors,
ti_sdo_ipc_Ipc_A_internal);
/* Assert that our MultiProc id is set correctly */
Assert_isTrue((InterruptArp32_arp32ProcId == MultiProc_self()),
ti_sdo_ipc_Ipc_A_internal);
/* init error block */
Error_init(&eb);
/* Disable global interrupts */
key = Hwi_disable();
table = &(InterruptArp32_module->fxnTable);
table->func = func;
table->arg = arg;
InterruptArp32_intClear(remoteProcId, intInfo);
/* Make sure the interrupt only gets plugged once */
InterruptArp32_module->numPlugged++;
if (InterruptArp32_module->numPlugged == 1) {
/* Register interrupt to remote processor */
Hwi_Params_init(&hwiAttrs);
hwiAttrs.arg = arg;
hwiAttrs.vectorNum = intInfo->intVectorId;
Hwi_create(ARP32INT,
(Hwi_FuncPtr)InterruptArp32_intShmStub,
&hwiAttrs,
&eb);
}
/* enable the mailbox and Hwi */
InterruptArp32_intEnable(remoteProcId, intInfo);
/* Restore global interrupts */
Hwi_restore(key);
}
示例4: NotifySetup_attach
/*!
* ======== NotifySetup_attach ========
* Initialize interrupt
*/
Int NotifySetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
{
NotifyDriverShm_Params notifyShmParams;
NotifyDriverShm_Handle shmDrvHandle;
ti_sdo_ipc_Notify_Handle notifyHandle;
Int status = Notify_S_SUCCESS;
Error_Block eb;
Error_init(&eb);
NotifyDriverShm_Params_init(¬ifyShmParams);
notifyShmParams.sharedAddr = sharedAddr;
notifyShmParams.remoteProcId = remoteProcId;
/* Set the intVectorId if on the DSP */
if ((MultiProc_self() == NotifySetup_dsp0ProcId) ||
(MultiProc_self() == NotifySetup_dsp1ProcId)) {
notifyShmParams.intVectorId = NotifySetup_dspIntVectId;
}
/* Set the intVectorId if on the EVE */
if ((MultiProc_self() == NotifySetup_eve0ProcId) ||
(MultiProc_self() == NotifySetup_eve1ProcId) ||
(MultiProc_self() == NotifySetup_eve2ProcId) ||
(MultiProc_self() == NotifySetup_eve3ProcId)) {
if (PROCID(remoteProcId) < 4) {
notifyShmParams.intVectorId = NotifySetup_eveIntVectId_INTC1;
}
else {
notifyShmParams.intVectorId = NotifySetup_eveIntVectId_INTC0;
}
}
shmDrvHandle = NotifyDriverShm_create(¬ifyShmParams, &eb);
if (shmDrvHandle == NULL) {
return (Notify_E_FAIL);
}
notifyHandle = ti_sdo_ipc_Notify_create(
NotifyDriverShm_Handle_upCast(shmDrvHandle), remoteProcId, 0,
NULL, &eb);
if (notifyHandle == NULL) {
NotifyDriverShm_delete(&shmDrvHandle);
status = Notify_E_FAIL;
}
return (status);
}
示例5: Power_registerConstraint
/*
* ======== Power_registerConstraint ========
* Register an operational constraint with Power.
*
*/
Power_Status Power_registerConstraint(Power_Constraint type, UArg value,
Power_ConstraintHandle *handle)
{
Power_Status status = Power_SOK;
Power_ConstraintObj * pConstraint;
Error_Block eb;
/* check for NULL handle pointer */
if (handle == NULL) {
status = Power_EINVALIDPOINTER;
}
/* else, check for invalid constraint type */
else if ((type < Power_DISALLOWED_CPU_SETPOINT_MASK) ||
(type > Power_DISALLOWEDSLEEPSTATE_MASK)) {
status = Power_EINVALIDVALUE;
}
/* else, allocate a constraint object */
else {
Error_init(&eb);
pConstraint = Memory_calloc(Power_Object_heap(),
sizeof(Power_ConstraintObj), 0, &eb);
if ((pConstraint == NULL) || Error_check(&eb)) {
status = Power_EFAIL;
}
/* fill in and enqueue the constraint, update aggregate constraints */
else {
/* fill in constraint object elements */
pConstraint->type = type;
pConstraint->value = value;
/* place constraint object on the constraints queue */
Queue_put(Power_Module_State_constraintsQ(),
(Queue_Elem*) pConstraint);
/* update aggregated constraints with the new constraint */
Power_updateConstraints(type, value);
/* set out parameters */
*handle = (UArg *) pConstraint;
}
}
return (status);
}
示例6: Create_uartHandler
void Create_uartHandler() {
// Create UART task (RS-485)
Task_Handle UART_taskHandle;
Task_Params UART_taskParams;
Error_Block UART_eb;
Task_Params_init(&UART_taskParams);
Error_init(&UART_eb);
UART_taskParams.stackSize = 2048;
UART_taskParams.priority = 1;
UART_taskParams.arg0 = 1000;
UART_taskHandle = Task_create((Task_FuncPtr) uartHandler, &UART_taskParams,
&UART_eb);
if (UART_taskHandle == NULL) {
System_printf("main: Failed to create uartHandler Task\n");
}
}
示例7: Power_registerNotify
/*
* ======== Power_registerNotify ========
* Register a function to be called on a specific power event.
*
*/
Power_Status Power_registerNotify(Power_Event eventType, UInt eventMask,
Fxn notifyFxn, UArg clientArg, Power_NotifyHandle * notifyHandle,
Fxn *delayedCompletionFxn)
{
Power_NotifyObj * pNotify;
Queue_Handle notifyQ;
Error_Block eb;
/* check for out of range event type */
if ((eventType < 0) || (eventType >= Power_INVALIDEVENT)) {
return (Power_EINVALIDEVENT);
}
/* check for NULL pointers for notifyFxn and out params */
if ((notifyFxn == NULL) || (notifyHandle == NULL) ||
(delayedCompletionFxn == NULL)) {
return (Power_EINVALIDPOINTER);
}
/* allocate a notification object */
Error_init(&eb);
pNotify = Memory_calloc(Power_Object_heap(), sizeof(Power_NotifyObj), 0,
&eb);
if ((pNotify == NULL) || Error_check(&eb)) {
return (Power_EFAIL);
}
/* fill in notify object elements */
pNotify->eventType = eventType;
pNotify->notifyFxn = notifyFxn;
pNotify->clientArg = clientArg;
pNotify->eventMask = eventMask;
/* determine the appropriate notification queue */
notifyQ = (Queue_Handle)((UInt8 *)(Power_module->notifyQ) +
(UInt)(eventType * (2 * sizeof(Ptr))));
/* place notify object on appropriate event queue */
Queue_put(notifyQ, (Queue_Elem*) pNotify);
/* set out parameters */
*notifyHandle = pNotify;
*delayedCompletionFxn =
(Fxn) ti_sysbios_family_c674_Power_delayCompletionFxns[eventType];
return(Power_SOK);
}
示例8: RcmClient_create
Int RcmClient_create(String server, const RcmClient_Params *params,
RcmClient_Handle *handle)
{
RcmClient_Object *obj;
Error_Block eb;
Int status = RcmClient_S_SUCCESS;
Log_print1(Diags_ENTRY, "--> %s: ()", (IArg)FXNN);
/* initialize the error block */
Error_init(&eb);
*handle = (RcmClient_Handle)NULL;
/* TODO: add check that params was initialized correctly */
/* allocate the object */
obj = (RcmClient_Handle)xdc_runtime_Memory_calloc(RcmClient_Module_heap(),
sizeof(RcmClient_Object), sizeof(Int), &eb);
if (NULL == obj) {
Log_error2(FXNN": out of memory: heap=0x%x, size=%u",
(IArg)RcmClient_Module_heap(), sizeof(RcmClient_Object));
status = RcmClient_E_NOMEMORY;
goto leave;
}
Log_print1(Diags_LIFECYCLE, FXNN": instance create: 0x%x", (IArg)obj);
/* object-specific initialization */
status = RcmClient_Instance_init(obj, server, params);
if (status < 0) {
RcmClient_Instance_finalize(obj);
xdc_runtime_Memory_free(RcmClient_Module_heap(),
(Ptr)obj, sizeof(RcmClient_Object));
goto leave;
}
/* success, return opaque pointer */
*handle = (RcmClient_Handle)obj;
leave:
Log_print2(Diags_EXIT, "<-- %s: %d", (IArg)FXNN, (IArg)status);
return(status);
}
示例9: void
//void SWItrigger::begin(uint8_t trigger, void (*functionSWItrigger)(uint8_t))
void SWItrigger::begin(uint8_t trigger, void (*functionSWItrigger)())
{
Error_Block eb;
Error_init(&eb);
Swi_Params swiParams;
Swi_Params_init(&swiParams);
swiParams.trigger = trigger;
// SWItriggerHandle = Swi_create((Swi_FuncPtr)functionSWItrigger(Swi_getTrigger()), &swiParams, &eb);
SWItriggerHandle = Swi_create((Swi_FuncPtr)functionSWItrigger, &swiParams, &eb);
if (SWItriggerHandle == NULL)
{
System_abort("SWItrigger create failed");
}
}
示例10: main
/*
* ======== main ========
*/
Int main()
{
Task_Handle task;
Error_Block eb;
System_printf("enter main()\n");
Error_init(&eb);
task = Task_create(taskMstr, NULL, &eb);
if (task == NULL) {
System_printf("Task_create() failed!\n");
BIOS_exit(0);
}
BIOS_start(); /* does not return */
return(0);
}
示例11: OS_semaphore_create
/**
* \brief create semaphore object
*
* Creates a counting semaphore for inter-thread synchronization.
* The initial semaphore count is specified as an input parameter.
*
* \param[in] p_sem_handle Handle to semaphore control block
* \param[in] p_name Name of the semaphore - UNUSED in SYS/BIOS
* \param[in] count Initial count of the semaphore
*
* \return e_SUCCESS on success, e_FAILURE on error
*
* \sa OS_semaphore_delete, OS_semaphore_put, OS_semaphore_get
* \note
*
* \warning
*/
e_ret_status OS_semaphore_create(handle p_handle,
const void *const p_name, //UNUSED
uInt16 count)
{
Semaphore_Handle sem_handle = NULL;
Error_Block eb;
Error_init(&eb);
sem_handle = Semaphore_create(count, NULL, &eb);
if (NULL == sem_handle) {
return e_FAILURE;
}
*(Semaphore_Handle *)p_handle = sem_handle;
return e_SUCCESS;
}
示例12: Task_Init1
/*****************************************************************************
** Function name: Task_Init1
**
** Descriptions:
** Create a task in a non-running state
** parameters: Task *pThis, Task name, Task function, Task Fn Arg, Stack Size,
Task Priority.
** Returned value: None
**
** Dependencies/Limitations/Side Effects/Design Notes:
** Task is just created, and it will not run until Task_Start
**
******************************************************************************/
BOOL Task_Init1(Task *pThis, String sName, pfnTask pfn, VOID *pArg, TaskStack eStacksize, TaskPri ePriority )
{
Error_Block eb;
//pThis->tskattrs = TSK_ATTRS;
Task_Params_init(&(pThis->tskattrs));
Error_init(&eb);
//pThis->tskattrs.stacksize = eStacksize;
pThis->tskattrs.stackSize= eStacksize;
//Setting of Task name
if (sName != NULL)
{
memcpy(pThis->Name, sName, TASK_NAME_SIZE);
//pThis->tskattrs.name = (String )&pThis->Name[0];
pThis->tskattrs.instance->name = (String )&pThis->Name[0];
}
else
{
//pThis->tskattrs.name = "DUMMY";
pThis->tskattrs.instance->name ="DUMMY";
}
//Setting of Task priority
pThis->tskattrs.priority = STE_TASK_SUSPEND; // Suspend the priority.
pThis->hPriority = ePriority;
//Setting argument
//pThis->tskattrs.arg0 =*(xdc_UArg*)pArg;
pThis->tskattrs.arg0 =(xdc_UArg)pArg;
//pThis->Handle = TSK_create((Fxn)pfn, &pThis->tskattrs, pArg);
pThis->Handle = Task_create((Task_FuncPtr)pfn, &pThis->tskattrs,&eb);
if (pThis->Handle == NULL)
{
printf("TASK: Failed create thread");
return FALSE;
///SYS_abort("Failed create thread");
//Raise an exception.
}
return TRUE;
}
示例13: InterruptDsp_intRegister
/*!
* ======== InterruptDsp_intRegister ========
*/
Void InterruptDsp_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
Fxn func, UArg arg)
{
UInt key;
Hwi_Params hwiAttrs;
Error_Block eb;
InterruptDsp_FxnTable *table;
Assert_isTrue(intInfo->intVectorId <= 15, ti_sdo_ipc_Ipc_A_internal);
/* init error block */
Error_init(&eb);
/* Disable global interrupts */
key = Hwi_disable();
table = &(InterruptDsp_module->fxnTable);
table->func = func;
table->arg = arg;
InterruptDsp_intClear(remoteProcId, intInfo);
/* Make sure the interrupt only gets plugged once */
InterruptDsp_module->numPlugged++;
if (InterruptDsp_module->numPlugged == 1) {
/* Register interrupt to remote processor */
Hwi_Params_init(&hwiAttrs);
hwiAttrs.arg = arg;
hwiAttrs.eventId = 90;
Hwi_create(intInfo->intVectorId,
(Hwi_FuncPtr)InterruptDsp_intShmStub,
&hwiAttrs,
&eb);
/* enable the interrupt vector */
Hwi_enableInterrupt(intInfo->intVectorId);
}
/* Enable the mailbox interrupt to the DSP */
InterruptDsp_intEnable(remoteProcId, intInfo);
/* Restore global interrupts */
Hwi_restore(key);
}
示例14: wc_InitMutex
int wc_InitMutex(wolfSSL_Mutex* m)
{
Semaphore_Params params;
Error_Block eb;
Error_init(&eb);
Semaphore_Params_init(¶ms);
params.mode = Semaphore_Mode_BINARY;
*m = Semaphore_create(1, ¶ms, &eb);
if (Error_check(&eb)) {
Error_raise(&eb, Error_E_generic, "Failed to Create the semaphore.",
NULL);
return BAD_MUTEX_E;
}
else
return 0;
}
示例15: MBX_create
MBX_Handle MBX_create(Uns size, Uns length, MBX_Attrs *attrs)
{
Mailbox_Params params;
Error_Block eb;
if (attrs == NULL) {
attrs = &MBX_ATTRS;
}
Mailbox_Params_init(¶ms);
params.instance->name = attrs->name;
params.heap = MEM_getHandle(attrs->segid);
Error_init(&eb);
return ((MBX_Handle)Mailbox_create(size, length, ¶ms, &eb));
}