How to receive package by poll style with Ethernet MAC Lib?

Technical questions regarding the XTC tools and programming with XMOS.
knighthu1982
Junior Member
Posts: 4
Joined: Mon Sep 29, 2014 9:01 am

How to receive package by poll style with Ethernet MAC Lib?

Post by knighthu1982 »

Hello all, with the Ethernet MAC Lib, we have to receive a package only after receive the package notify by rx.packet_ready(). But within my application, I want to receive a package by poll style only after sendout a package instead of always waiting for the packet_ready() notify.
Is this possible and how to do it ?
jerryXCORE
Experienced Member
Posts: 65
Joined: Tue Apr 30, 2013 10:41 pm

Post by jerryXCORE »

Not sure what exactly you need, but in my opinion:
* rx.packet_ready() actually simplify the task that you describe.

For example, poll for packet:

Code: Select all

int ready = 0;
while(ready==0){
   select{
     case rx.packet_ready():
            {packet, n}= rx.get_packet(); //Syntax of this statement to be refined.
            ready=1;
            break;
    }
}