コード例 #1
0
/*
 *  ======== TIEvent_wait ========
 */
cl_int TIEvent_wait(cl_event event)
{
    RcmClient_Handle    rcmH = (RcmClient_Handle)(event->rcmClientH);
    UInt16              msgId = (UInt16)(0xFF & (UInt)(event->msgId));
    RcmClient_Message * msg;
    Int                 status;


    /* check if event has already completed */
    if (event->status == CL_COMPLETE) {
        return(CL_SUCCESS);
    }

    /* check if event terminated with error */
    /* TODO */

    /* event still pending, wait for command to complete */
    status = RcmClient_waitUntilDone(rcmH, msgId, &msg);

    if (status < 0) {
        /* TODO */
    }

    /* extract any return value from message? */
    /* TODO */

    /* free the rcm message */
    RcmClient_free(rcmH, msg);

    event->status = CL_COMPLETE;

    return(CL_COMPLETE);
}
コード例 #2
0
/*
 *  ======== TestExecNoWait ========
 */
Int TestExecNoWait(void)
{
    Int                     status                  = 0;
    Int                     loop, job;
    UInt16                  msgIdAry[JOB_COUNT];
    RcmClient_Message     * rcmMsg                  = NULL;
    RcmClient_Message     * returnMsg               = NULL;
    UInt                    rcmMsgSize;
    RCM_Remote_FxnArgs    * fxnDoubleArgs;

    Osal_printf ("\nTestExecNoWait: Testing TestExecNoWait API\n");

    for (loop = 1; loop <= LOOP_COUNT; loop++) {
        /* Issue process jobs */
        for (job = 1; job <= JOB_COUNT; job++) {
            /* Allocate a remote command message */
            rcmMsgSize = sizeof(RCM_Remote_FxnArgs);
            Osal_printf ("TestExecNoWait: calling RcmClient_alloc \n");
            status = RcmClient_alloc (rcmClientHandle, rcmMsgSize, &rcmMsg);
            if (status < 0) {
                Osal_printf ("TestExecNoWait: Error allocating RCM message\n");
                goto exit;
            }
            /* Fill in the remote command message */
            rcmMsg->fxnIdx = fxnDoubleIdx;
            fxnDoubleArgs = (RCM_Remote_FxnArgs *)(&rcmMsg->data);
            fxnDoubleArgs->a = job;

            /* Execute the remote command message */
            Osal_printf ("TestExecNoWait: calling RcmClient_execNoWait \n");
            status = RcmClient_execNoWait (rcmClientHandle, rcmMsg,
                                            &msgIdAry[job-1]);
            if (status < 0) {
                Osal_printf ("TestExecNoWait: RcmClient_execNoWait error. \n");
                goto exit;
            }
        }

        /* Reclaim process jobs */
        for (job = 1; job <= JOB_COUNT; job++) {
            Osal_printf ("TestExecNoWait: calling RcmClient_waitUntilDone \n");
            status = RcmClient_waitUntilDone (rcmClientHandle, msgIdAry[job-1],
                                                &returnMsg);
            if (status < 0) {
                Osal_printf ("TestExecNoWait: RcmClient_waitUntilDone error\n");
                goto exit;
            }

            Osal_printf ("TestExecNoWait: msgId: %d, result = %d",
                            msgIdAry[job-1], returnMsg->result);

            /* Return message to the heap */
            Osal_printf ("TestExecNoWait: calling RcmClient_free \n");
            RcmClient_free (rcmClientHandle, returnMsg);
        }
    }

exit:
    Osal_printf ("TestExecNoWait: Leaving TestExecNoWait()\n");
    return status;
}