User`s guide

www.uTasker.com
µ
Tasker – AT91SAM7X Tutorial
V1.4
uTaskerV1.4_SAM7X.doc/0.03 31/36 31.07.2009
Double click on the word ucSAM7X so that it becomes highlighted and then drag it into the
watch window (Shift F9 opens a quick watch window). Expand the structure by clicking on
the cross to the left of the name and you will see the various internal peripheral divided into
sub-blocks. EMAC_ISR is in the sub-block usSimMAC so we also expand this sub-structure
by clicking on the cross left of its name.
In the sub-block you will see all of the EMAC registers listed in the order in which they occur
in memory as well as showing their present values. Step the code (F10) and you will see that
the length of the received frame is read from a location from memory pointed to by the
present EMAC buffer description and saved before sending an internal message defined by
static const unsigned char EMAC_RXA_int_message[ HEADER_LENGTH ] = { 0, 0 ,
TASK_ETHERNET, INTERRUPT_EVENT, EMAC_RXA_INTERRUPT };
// define fixed interrupt event
This internal message is sent to TASK_ETHERNET to inform that a frame has been received
and is as such a method used by the operating system to wake up this Ethernet task. If you
want to, you can also step into the write function to see the internal workings of how it wakes
up the receiver task but I will assume here that all is working well and will just move to
TASK_ETHERNET to see it actually receiving this interrupt message.
Before doing the next step, remove the break point in the interrupt routine by setting the
cursor to its line and hitting F9.
B. Receive Task
Now open the file ethernet.c in the project directory TCP/IP and set the cursor to the
bracket after the tasks routine void fnTaskEthernet(TTASKTABLE *ptrTaskTable)
With a right click, the menu item “Run to cursorcan be executed and you will see that this
task is indeed started immediately since the program execution stops at this line.
Step slowly through the code using F10 and observe that the task reads the contents and
interprets it as an INTERRUPT_EVENT. It calls fnEthernetEvent() to learn about the
length of the received frame and to get a pointer to it – use F11 to step into this routine if you
would like to see its internal workings, which I will not discuss here.
You will see that the pointer to the frame is called rx_frame and it is defined as a pointer to
an ETHERNET_FRAME. Now, as we all know, a pointer is just a pointer – but the fact that it is
defined as a pointer to a certain structure will help us greatly to interpret the contents of the
received frame. We will first look at the frame as it is in memory and then how it looks in the
debugger as a structure.
C. Receive Frame
Let’s start with simply looking at the raw data which we have just received from the Ethernet.
Do this by placing rx_frame in a watch windows and expanding it so that the length of the
frame (frame_size) and the pointer to the data (ptEth) are visible [do you recognise the
length from earlier?]. ptEth has a value which you can double click on and insert to the clip
board before pasting it into the address field of a memory display window (if this window is
not yet visible, activate it in the debug menu). Now you will see the raw Ethernet frame in
memory – note that this is in the local computer’s memory and the address of its location has
nothing to do with the storage place on the real target.