Example #1
0
/*!
 * \brief	Stop a running task.
 * \param	taskId	Task handle passed back from a successful TaskSetup()
 * \returns	TASK_ERR_NO_ERR on success or TASK_ERR_INVALID_ARG if taskId
 *			is invalid.
 *
 * \em Note: Stopping a polling buffer descriptor task is a catastrophic
 * operation. It does not merely pause execution. Context is not
 * saved. The task's pointer into the BD ring is reset back to the
 * beginning.
 *
 * \em Note: This is not the case for the new "fall-through" BD tasks.
 * They save the BD ring pointer across stop/start boundaries. The
 * previous polling tasks are considered deprecated.
 */
int TaskStop(TaskId taskId)
{
	SDMA_INT_DISABLE(SDMA_INT_MASK, taskId);
	SDMA_TASK_DISABLE(SDMA_TCR, taskId);

	TaskRunning[taskId] = 0;
	return TASK_ERR_NO_ERR;
}
Example #2
0
/*!
 * \brief	Start an initialized task running.
 * \param	taskId	Task handle passed back from a successful TaskSetup()
 * \param	autoStartEnable Boolean for whether autostart bit is enabled.
 *							If this is set then the parameter autoStartTask
 *							defines the task to auto start.
 * \param	autoStartTask	TaskId for task to autostart. If autoStartEnable
 *							is not set then this parameter is a don't care.
 * \param	intrEnable		Boolean for interrupt enable for this task.
 * \returns	TASK_ERR_NO_ERR on success or TASK_ERR_INVALID_ARG if taskId
 *			is invalid.
 */
int TaskStart(TaskId taskId, uint32 autoStartEnable, TaskId autoStartTask,
			  uint32 intrEnable)
{
	if (intrEnable) {
		SDMA_INT_ENABLE(SDMA_INT_MASK, taskId);
	} else {
		SDMA_INT_DISABLE(SDMA_INT_MASK, taskId);
	}
	SDMA_TASK_AUTO_START(SDMA_TCR, taskId, autoStartEnable, autoStartTask)
	SDMA_TASK_ENABLE(SDMA_TCR, taskId);

	TaskRunning[taskId] = 1;
	return TASK_ERR_NO_ERR;
}
Example #3
0
/*!
 * \brief	Stop a running task.
 * \param	taskId	Task handle passed back from a successful TaskSetup()
 * \returns	TASK_ERR_NO_ERR on success or TASK_ERR_INVALID_ARG if taskId
 *			is invalid.
 *
 * Stopping a task is a catastrophic operation. It does not merely
 * pause execution. Context is not saved. Any buffer descriptors are
 * cleared. This should be called, e.g., when a device driver is stopped.
 */
int TaskStop( TaskId taskId )
{
	if( (taskId < 0) || (taskId >= MAX_TASKS) ) {
		return TASK_ERR_INVALID_ARG;
	}

	SDMA_INT_DISABLE( SDMA_INT_MASK, taskId );
	SDMA_TASK_DISABLE( SDMA_TCR, taskId );

	BDHead[taskId] = BDTail[taskId] = 0;
	
	(TaskBDIdxTable[taskId].currBDInUse) = 0;
	
	return TASK_ERR_NO_ERR;
}
Example #4
0
/*!
 * \brief	Start an initialized task running.
 * \param	taskId	Task handle passed back from a successful TaskSetup()
 * \param	autoStartEnable Boolean for whether autostart bit is enabled.
 *							If this is set then the parameter autoStartTask
 *							defines the task to auto start.
 * \param	autoStartTask	TaskId for task to autostart. If autoStartEnable
 *							is not set then this parameter is a don't care.
 * \param	intrEnable		Boolean for interrupt enable for this task.
 * \returns	TASK_ERR_NO_ERR on success or TASK_ERR_INVALID_ARG if taskId
 *			is invalid.
 */
int TaskStart( TaskId taskId, uint32 autoStartEnable, TaskId autoStartTask,
						uint32 intrEnable  )
{
	if( (0 <= taskId) && (taskId < MAX_TASKS) ) {
		if ( intrEnable ) {
			SDMA_INT_ENABLE( SDMA_INT_MASK, taskId );
		}
		else {
			SDMA_INT_DISABLE( SDMA_INT_MASK, taskId );
		}
		SDMA_TASK_AUTO_START(SDMA_TCR, taskId, autoStartEnable, autoStartTask)
		SDMA_TASK_ENABLE( SDMA_TCR, taskId );
		return TASK_ERR_NO_ERR;
	} else {
		return TASK_ERR_INVALID_ARG;
	}
}