/* Register/Clear RX callback. Callback will be invoked after the next received frame. 
This function is usually invoked from the RX callback itself with NULL callback, to unregister. Once the callback has resumed the application task, there is no need to invoke the callback again. */
void gmac_dev_set_rx_callback(gmac_device_t *p_gmac_dev, gmac_quelist_t queue_idx, gmac_dev_tx_cb_t func_rx_cb)
/* Register/Clear RX callback. Callback will be invoked after the next received frame. 
This function is usually invoked from the RX callback itself with NULL callback, to unregister. Once the callback has resumed the application task, there is no need to invoke the callback again. */
void gmac_dev_set_rx_callback(gmac_device_t *p_gmac_dev, gmac_quelist_t queue_idx, gmac_dev_tx_cb_t func_rx_cb)
{
	Gmac *p_hw = p_gmac_dev->p_hw;
	if (func_rx_cb == NULL) {
		if(queue_idx == GMAC_QUE_0) {
			gmac_disable_interrupt(p_hw, GMAC_IDR_RCOMP);
		} else {
			gmac_disable_priority_interrupt(p_hw, GMAC_IER_RCOMP, queue_idx);
		}
		p_gmac_dev->gmac_queue_list[queue_idx].func_rx_cb = NULL;
	} else {
		p_gmac_dev->gmac_queue_list[queue_idx].func_rx_cb = func_rx_cb;
		if(queue_idx == GMAC_QUE_0) {
			gmac_enable_interrupt(p_hw, GMAC_IER_RCOMP);
		} else {
			gmac_enable_priority_interrupt(p_hw, GMAC_IER_RCOMP, queue_idx);
		}
	}
}