User`s guide
www.uTasker.com 
µ
Tasker – AT91SAM7X Tutorial 
V1.4
uTaskerV1.4_SAM7X.doc/0.03  30/36  31.07.2009
Repeat the ping test from the DOS window and the execution will stop at the breakpoint 
which you set in the interrupt routine. Since there will be no answer to the ping test because 
our code has been stopped, the ping test(s) will fail, but we don’t worry about that since we 
have caught the event which we are going to use to analyse the flow through the driver, 
memory, the operating system and the ICMP routine. Now we can get to know the code in as 
much detail as we want…..and since we are working with the SAM7X, this will also give us 
the opportunity to look at some of its internal registers on the way. 
A. Interrupt routine 
__interrupt void EMAC_Interrupt(void) 
{ 
  unsigned long ulInterrupts; 
  while (ulInterrupts = EMAC_ISR) { // read the interrupt status register, which 
clears all interrupts 
  if (ulInterrupts & TCOMP) {  // frame tramsmitted 
    … 
  } 
  if (ulInterrupts & RCOMP) {  // complete reception frame available 
  ((ETHERNETQue*)(eth_rx_control))->ETH_queue.chars = 
(QUEUE_TRANSFER)(ptrRxBd->bd_details & BD_INFO_LENGTH_OF_FRAME_MASK); 
  // put the length of the received frame 
  in the buffer 
  fnWrite(INTERNAL_ROUTE, (unsigned char*)EMAC_RX_int_message, HEADER_LENGTH); 
  // Inform the Ethernet task 
  } 
  ulInterrupts &= ~(TCOMP | RCOMP); 
  } 
} 
The simulator has just received a frame for our MAC address or a broadcast address (the 
simulator doesn’t disturb us with foreign MAC addresses when the EMAC in the SAM7X has 
not be set up for promiscuous operation) and here we are in the interrupt routine. Now don’t 
forget that this is the real code which will operate on your target and if this doesn’t work 
properly it will also not work properly on your target. 
We see that such routines are necessarily quite hardware specific. Here we see accesses to 
the internal register, EMAC_ISR. Search for this registers in the SAM7X data sheet if you 
want to read exactly how it works; here is a very quick overview where we will also look at 
the registers in the simulated SAM7X. 
EMAC_ISR is the interrupt status register in the EMAC. We can search for it in our project by 
using “search in files”, ensuring that the search path starts at the highest level in the µTasker 
project, and using the search files of type *.c and *.h. 
It will be found in the code at several locations but also in the file sam7x.h, where it is 
defined as: 
#define EMAC_ISR *(volatile unsigned long*)(EMAC_PERIPHERAL_BLOCK + 0x24) 
where EMAC_PERIPHERAL_BLOCK is also defined locally twice: 
 #define EMAC_PERIPHERAL_BLOCK ((unsigned char *)(&ucSAM7x.ucSimMAC)) and 
 #define EMAC_PERIPHERAL_BLOCK 0xFFFDC000
On the target the register is located at long word address 0xFFFDC000 and when simulating 
it can be found in a structure called ucSAM7X. 










