/* Gets the status of a job. 
Gets the status of an ongoing or the last job. */
enum status_code m2m_get_job_status(struct m2m_module *const m2m, enum m2m_job_type type)
/* Gets the status of a job. 
Gets the status of an ongoing or the last job. */
enum status_code m2m_get_job_status(struct m2m_module *const m2m, enum m2m_job_type type)
{
	Assert(m2m);
	if (M2M_JOB_TRANSFER == type) {
		return m2m->job_status;
	} else if (M2M_JOB_BUFFER == type) {
		if (ERR_BUSY == m2m->job_status) {
			return (0 == m2m->hw->MEM2MEM_RCR) ? STATUS_OK : ERR_BUSY;
		} else {
			return m2m->job_status;
		}
	} else {
		return ERR_INVALID_ARG;
	}
}