Пример #1
0
/*
 *  ======== DPI_close ========
 */
Static Int DPI_close(DEV_Handle dev)
{
    PipeObj         *pipe = (PipeObj *)dev->object;
    SPipeObj        *sPipe = pipe->sPipe;

    MEM_free(0, pipe, sizeof(PipeObj));
    
    SEM_pend(mutex, SYS_FOREVER);

    sPipe->device[dev->mode] = NULL;
    sPipe->readySem[dev->mode] = NULL;
             
    if (sPipe->device[DEV_INPUT] == NULL &&
                sPipe->device[DEV_OUTPUT] == NULL) {
        /* delete all shared pipe sub-objects */
        SEM_delete(sPipe->dataSem);
        SEM_delete(sPipe->freeSem);

        /* remove sPipe obj from sPipeList */
        QUE_remove(&sPipe->link);
        
        /* delete sPipe object itself */
        MEM_free(0, sPipe, sizeof (SPipeObj));
    }

    SEM_post(mutex);

    return (SYS_OK);
}
Пример #2
0
/* ARGSUSED */
Int smain(Int argc, Char * argv[])
{
    TSK_Handle tsk;
    TSK_Attrs attrs = TSK_ATTRS;
    Int i;

    GT_0trace(ti_sdo_fc_rman_examples_hdvicp, GT_ENTER, "_smain> Enter \n");

    done = SEM_create(0, NULL);
    mutex = SEM_create(1, NULL);

    if ((done == NULL) || (mutex == NULL)) {

        SYS_abort("Sem create failed \n");
    }

/*
 * Do I care about this ? 
 */
    attrs.stackseg = EXTMEM_HEAP;

/*
 * Use a bigger stack size when printing out trace 
 */
    attrs.stacksize = 0x1000;

    for (i = 0; i < NUMTASKS; i++) {

        attrs.priority = attrsTable[i].priority;
        tsk = TSK_create((Fxn)rmanTask, &attrs, 
                                (Arg)(attrsTable[i].scratchId),
                                (Arg)(&(attrsTable[i].id)),
                                (Arg)(attrsTable[i].priority),
                (Arg)(i +1),
                (Arg)(attrsTable[i].yieldFlag));
        if (tsk == NULL) {

            GT_1trace(ti_sdo_fc_rman_examples_hdvicp, GT_7CLASS, "_rman> " 
                "Task #%d create failed \n",i);

            SYS_abort("TSK_create() of task %d failed\n",i+1); 
        }
    }

    for (i=0; i < NUMTASKS; i++) {
        SEM_pend(done, SYS_FOREVER);
    }

    GT_0trace(ti_sdo_fc_rman_examples_hdvicp, GT_4CLASS, "_smain> "
    "TEST PASSED \n");

    SEM_delete(mutex);
    SEM_delete(done);

    GT_0trace(ti_sdo_fc_rman_examples_hdvicp, GT_ENTER, "_smain> Exit \n");

    return 0;
}
Пример #3
0
/*
 *  ======== rmSPipe ========
 */
Static Void rmSPipe(SPipeObj *sPipe)
{

    if (sPipe == MEM_ILLEGAL) {
        return;
    }
    else {
        if (sPipe->dataSem != NULL) {
            SEM_delete(sPipe->dataSem);
        }
        if (sPipe->freeSem != NULL) {
            SEM_delete(sPipe->freeSem);
        }
        MEM_free(0, sPipe, sizeof(SPipeObj));
    }
}
Пример #4
0
/*
 *  ======== Sem_delete ========
 */
Void Sem_delete(Sem_Handle sem)
{
    GT_1trace(curTrace, GT_ENTER, "Sem_delete> sem: 0x%lx\n", sem);

    if (sem != NULL) {
        SEM_delete((SEM_Handle)sem);
    }
}
Пример #5
0
/*
 *  ======== tskRmPort ========
 *  Removes a DIO object and cleans up
 */
static Void tskRmPort(DIO_Handle dio)
{
    /* if chanp not NULL, must delete mini-driver channel */
    if (dio->chanp != NULL) {
        dio->fxns->mdDeleteChan(dio->chanp);
    }

    /* remove the semaphore ... */
    SEM_delete(dio->context.sems.complete);

    /* and finally the object */
    MEM_free(0, dio, sizeof(DIO_Obj));
}
/**
* \brief   EDMA3 OS Semaphore Delete
*
*      This function deletes or removes the specified semaphore
*      from the system. Associated dynamically allocated memory
*      if any is also freed up.
* \warning OsSEM services run in client context and not in a thread
*      of their own. If there exist threads pended on a semaphore
*      that is being deleted, results are undefined.
* \param   hSem [IN] handle to the semaphore to be deleted
* \return  EDMA3_DRV_SOK if succesful else a suitable error code
*/
EDMA3_DRV_Result edma3OsSemDelete(EDMA3_OS_Sem_Handle hSem)
{
#if 0
  EDMA3_DRV_Result semDeleteResult = EDMA3_DRV_SOK;
  
  if(NULL == hSem)
  {
    semDeleteResult = EDMA3_DRV_E_INVALID_PARAM;
  }
  else
  {
    SEM_delete(hSem);
  }
  
  return semDeleteResult;
#else
  return 0;
#endif
}