/* Stops transmission. Function will wait until transmit operation enters stop state. */
static int32_t MAC_stop_receiving(void)
/* Stops transmission. Function will wait until transmit operation enters stop state. */
static int32_t MAC_stop_receiving(void)
{
    int32_t retval = MAC_OK;
    MAC_set_time_out( (uint16_t)STATE_CHANGE_TIME_OUT );
	while( (((MAC->CSR5 & CSR5_RS_MASK) >> CSR5_RS_SHIFT) != CSR5_RS_STOPPED)
            && (retval == MAC_OK) )
	{
    	MAC_BITBAND->CSR6_SR = 0u;
    	if( MAC_get_time_out() == 0u ) {
    		retval = MAC_TIME_OUT;
    	}
	}
	return retval;
}