/** ============================================================================ * @func DSP_Delete * * @desc This function releases resources allocated earlier by call to * DSP_Create (). * During cleanup, the allocated resources are being freed * unconditionally. Actual applications may require stricter check * against return values for robustness. * * @modif LOOP_Buffers * ============================================================================ */ NORMAL_API Void DSP_Delete (Uint8 processorId) { DSP_STATUS status = DSP_SOK ; DSP_STATUS tmpStatus = DSP_SOK ; LOOP_0Print ("Entered DSP_Delete ()\n") ; status = PROC_stop (processorId) ; tmpStatus = POOL_close (POOL_makePoolId(processorId, 0)) ; if (DSP_SUCCEEDED (status) && DSP_FAILED (tmpStatus)) { LOOP_1Print ("POOL_close () failed. Status = [0x%x]\n", tmpStatus) ; } tmpStatus = PROC_detach (processorId) ; if (DSP_SUCCEEDED (status) && DSP_FAILED (tmpStatus)) { LOOP_1Print ("PROC_detach () failed. Status = [0x%x]\n", tmpStatus) ; } tmpStatus = PROC_destroy () ; if (DSP_SUCCEEDED (status) && DSP_FAILED (tmpStatus)) { LOOP_1Print ("PROC_destroy () failed. Status = [0x%x]\n", tmpStatus) ; } LOOP_0Print ("Leaving DSP_Delete ()\n") ; }
static void kern_terminated(void) { if (cur_proc != NULL) { printf("kernel: process %d terminated\n", cur_proc->pid); PROC_destroy(cur_proc); cur_proc = NULL; } else { printf("kernel: unknown process died\n"); } KERN_resched(); }
/** ============================================================================ * @func helloDSP_Delete * * @desc This function releases resources allocated earlier by call to * helloDSP_Create (). * During cleanup, the allocated resources are being freed * unconditionally. Actual applications may require stricter check * against return values for robustness. * * @modif None * ============================================================================ */ NORMAL_API Void helloDSP_Delete(Uint8 processorId) { DSP_STATUS status = DSP_SOK; DSP_STATUS tmpStatus = DSP_SOK; SYSTEM_0Print("Entered helloDSP_Delete ()\n"); /* Release the remote message queue */ status = MSGQ_release(SampleDspMsgq); if (DSP_FAILED(status)) { SYSTEM_1Print("MSGQ_release () failed. Status = [0x%x]\n", status); } /* Close the remote transport */ tmpStatus = MSGQ_transportClose(processorId); if (DSP_SUCCEEDED(status) && DSP_FAILED(tmpStatus)) { status = tmpStatus; SYSTEM_1Print("MSGQ_transportClose () failed. Status = [0x%x]\n", status); } /* Stop execution on DSP. */ tmpStatus = PROC_stop(processorId); if (DSP_SUCCEEDED(status) && DSP_FAILED(tmpStatus)) { status = tmpStatus; SYSTEM_1Print("PROC_stop () failed. Status = [0x%x]\n", status); } /* Reset the error handler before deleting the MSGQ that receives */ /* the error messages. */ tmpStatus = MSGQ_setErrorHandler(MSGQ_INVALIDMSGQ, MSGQ_INVALIDMSGQ); if (DSP_SUCCEEDED(status) && DSP_FAILED(tmpStatus)) { status = tmpStatus; SYSTEM_1Print("MSGQ_setErrorHandler () failed. Status = [0x%x]\n", status); } /* Close the GPP's message queue */ tmpStatus = MSGQ_close(SampleGppMsgq); if (DSP_SUCCEEDED(status) && DSP_FAILED(tmpStatus)) { status = tmpStatus; SYSTEM_1Print("MSGQ_close () failed. Status = [0x%x]\n", status); } /* Close the pool */ tmpStatus = POOL_close(POOL_makePoolId(processorId, SAMPLE_POOL_ID)); if (DSP_SUCCEEDED(status) && DSP_FAILED(tmpStatus)) { status = tmpStatus; SYSTEM_1Print("POOL_close () failed. Status = [0x%x]\n", status); } /* Detach from the processor */ tmpStatus = PROC_detach(processorId); if (DSP_SUCCEEDED(status) && DSP_FAILED(tmpStatus)) { status = tmpStatus; SYSTEM_1Print("PROC_detach () failed. Status = [0x%x]\n", status); } /* Destroy the PROC object. */ tmpStatus = PROC_destroy(); if (DSP_SUCCEEDED(status) && DSP_FAILED(tmpStatus)) { status = tmpStatus; SYSTEM_1Print("PROC_destroy () failed. Status = [0x%x]\n", status); } SYSTEM_0Print("Leaving helloDSP_Delete ()\n"); }
/** ============================================================================ * @func LOOP_Delete * * @desc This function releases resources allocated earlier by call to * LOOP_Create (). * During cleanup, the allocated resources are being freed * unconditionally. Actual applications may require stricter check * against return values for robustness. * * @modif LOOP_Buffers * ============================================================================ */ NORMAL_API Void LOOP_Delete (Uint8 processorId) { DSP_STATUS status = DSP_SOK ; DSP_STATUS tmpStatus = DSP_SOK ; LOOP_0Print ("Entered LOOP_Delete ()\n") ; /* * Free the buffer(s) allocated for channel to DSP */ tmpStatus = CHNL_freeBuffer (processorId, CHNL_ID_OUTPUT, LOOP_Buffers, 1) ; if (DSP_SUCCEEDED (status) && DSP_FAILED (tmpStatus)) { LOOP_1Print ("CHNL_freeBuffer () failed (output). Status = [0x%x]\n", tmpStatus) ; } /* * Delete both input and output channels */ tmpStatus = CHNL_delete (processorId, CHNL_ID_INPUT) ; if (DSP_SUCCEEDED (status) && DSP_FAILED (tmpStatus)) { LOOP_1Print ("CHNL_delete () failed (input). Status = [0x%x]\n", tmpStatus) ; } tmpStatus = CHNL_delete (processorId, CHNL_ID_OUTPUT) ; if (DSP_SUCCEEDED (status) && DSP_FAILED (tmpStatus)) { LOOP_1Print ("CHNL_delete () failed (output). Status = [0x%x]\n", tmpStatus) ; } /* * Stop execution on DSP. */ status = PROC_stop (processorId) ; /* * Close the pool */ tmpStatus = POOL_close (POOL_makePoolId(processorId, POOL_ID)) ; if (DSP_SUCCEEDED (status) && DSP_FAILED (tmpStatus)) { LOOP_1Print ("POOL_close () failed. Status = [0x%x]\n", tmpStatus) ; } /* * Detach from the processor */ tmpStatus = PROC_detach (processorId) ; if (DSP_SUCCEEDED (status) && DSP_FAILED (tmpStatus)) { LOOP_1Print ("PROC_detach () failed. Status = [0x%x]\n", tmpStatus) ; } /* * Destroy the PROC object. */ tmpStatus = PROC_destroy () ; if (DSP_SUCCEEDED (status) && DSP_FAILED (tmpStatus)) { LOOP_1Print ("PROC_destroy () failed. Status = [0x%x]\n", tmpStatus) ; } LOOP_0Print ("Leaving LOOP_Delete ()\n") ; }
/** ============================================================================ * @func pool_notify_Delete * * @desc This function releases resources allocated earlier by call to * pool_notify_Create (). * During cleanup, the allocated resources are being freed * unconditionally. Actual applications may require stricter check * against return values for robustness. * * @modif None * ============================================================================ */ NORMAL_API Void pool_notify_Delete (Uint8 processorId) { DSP_STATUS status = DSP_SOK ; DSP_STATUS tmpStatus = DSP_SOK ; #ifdef DEBUG printf ("Entered pool_notify_Delete ()\n") ; #endif /* * Stop execution on DSP. */ status = PROC_stop (processorId) ; if (DSP_FAILED (status)) { printf ("PROC_stop () failed. Status = [0x%x]\n", (int)status) ; } /* * Unregister for notification of event registered earlier. */ tmpStatus = NOTIFY_unregister (processorId, pool_notify_IPS_ID, pool_notify_IPS_EVENTNO, (FnNotifyCbck) pool_notify_Notify, 0/* vladms pool_notify_SemPtr*/) ; if (DSP_SUCCEEDED (status) && DSP_FAILED (tmpStatus)) { status = tmpStatus ; printf ("NOTIFY_unregister () failed Status = [0x%x]\n", (int)status) ; } /* * Free the memory allocated for the data buffer. */ tmpStatus = POOL_free (POOL_makePoolId(processorId, SAMPLE_POOL_ID), (Void *) pool_notify_DataBuf, pool_notify_BufferSize) ; if (DSP_SUCCEEDED (status) && DSP_FAILED (tmpStatus)) { status = tmpStatus ; printf ("POOL_free () DataBuf failed. Status = [0x%x]\n", (int)status) ; } /* * Close the pool */ tmpStatus = POOL_close (POOL_makePoolId(processorId, SAMPLE_POOL_ID)) ; if (DSP_SUCCEEDED (status) && DSP_FAILED (tmpStatus)) { status = tmpStatus ; printf ("POOL_close () failed. Status = [0x%x]\n", (int)status) ; } /* * Detach from the processor */ tmpStatus = PROC_detach (processorId) ; if (DSP_SUCCEEDED (status) && DSP_FAILED (tmpStatus)) { status = tmpStatus ; printf ("PROC_detach () failed. Status = [0x%x]\n", (int)status) ; } /* * Destroy the PROC object. */ tmpStatus = PROC_destroy () ; if (DSP_SUCCEEDED (status) && DSP_FAILED (tmpStatus)) { status = tmpStatus ; printf ("PROC_destroy () failed. Status = [0x%x]\n", (int)status) ; } #ifdef DEBUG printf ("Leaving pool_notify_Delete ()\n") ; #endif }