/* RETURN: XOR_CHANNEL_IDLE - If the engine is idle. XOR_CHANNEL_ACTIVE - If the engine is busy. XOR_CHANNEL_PAUSED - If the engine is paused. MV_UNDEFINED_STATE - If the engine state is undefind or there is no such engine  */
enum mv_state mv_xor_state_get(u32 chan)
/* RETURN: XOR_CHANNEL_IDLE - If the engine is idle. XOR_CHANNEL_ACTIVE - If the engine is busy. XOR_CHANNEL_PAUSED - If the engine is paused. MV_UNDEFINED_STATE - If the engine state is undefind or there is no such engine  */
enum mv_state mv_xor_state_get(u32 chan)
{
	u32 state;
	if (chan >= MV_XOR_MAX_CHAN) {
		DB(printf("%s: ERR. Invalid chan num %d\n", __func__, chan));
		return MV_UNDEFINED_STATE;
	}
	state = reg_read(XOR_ACTIVATION_REG(XOR_UNIT(chan), XOR_CHAN(chan)));
	state &= XEXACTR_XESTATUS_MASK;
	switch (state) {
	case XEXACTR_XESTATUS_IDLE:
		return MV_IDLE;
	case XEXACTR_XESTATUS_ACTIVE:
		return MV_ACTIVE;
	case XEXACTR_XESTATUS_PAUSED:
		return MV_PAUSED;
	}
	return MV_UNDEFINED_STATE;
}