Arduino Due equivalent of avr/interrupt.h

I wrote the following code to modify Timer 2 on the newest Arduino Due:

#include <avr/io.h>
#include <avr/interrupt.h>
void setup() {

  pinMode(3, OUTPUT);
  pinMode(11, OUTPUT);
  TCCR2A = _BV(COM2A0) | _BV(COM2B1) | _BV(WGM21) | _BV(WGM20);
  TCCR2B = _BV(WGM22) | _BV(CS20);
  OCR2A = 19;
  OCR2B = 9;
}

void loop() {

  
}

In the IDE when I select which board I'm using, every other board compiles without any issues. When I select the Arduino Due (Programming Port) for my board selection, I now get a compiling error "fatal error: avr/io.h: No such file or directory compilation terminated." Is this a bug? Why would changing the board type have any influence on including certain libraries?

This is urgent so any immediate help or advice would be greatly appreciated.

elevine:
I wrote the following code to modify Timer 2 on the newest Arduino Due:

#include <avr/io.h>

#include <avr/interrupt.h>
void setup() {

pinMode(3, OUTPUT);
  pinMode(11, OUTPUT);
  TCCR2A = _BV(COM2A0) | _BV(COM2B1) | _BV(WGM21) | _BV(WGM20);
  TCCR2B = _BV(WGM22) | _BV(CS20);
  OCR2A = 19;
  OCR2B = 9;
}

void loop() {

}




In the IDE when I select which board I'm using, every other board compiles without any issues. When I select the Arduino Due (Programming Port) for my board selection, I now get a compiling error "fatal error: avr/io.h: No such file or directory compilation terminated." Is this a bug? Why would changing the board type have any influence on including certain libraries?

This is **urgent** so any immediate help or advice would be greatly appreciated.

Same problem.
I wish to use an ISR(TIMER2_OVF_vect) perfectly running with Arduino Uno, but when I try to compile with Arduino Due all the variables such as TCCR2A,CS22, TCCR2B etc generate the error ""was not declared in this scope".

Where can I find the equivalent Interrupts Service Routine for the Arduino Due ? or
Which library have I to include for the scope ?

Thanks in advance.

For timer interrupts on the DUE the following library worked out for me:

The fact that the same names of the registers as in the UNO don't work is not at all a bug, because there is a totally different structure behind the SAM3X8E chip for the DUE with many Timer Counter channels having different functionalities.

Thanks a lot !
I am a beginner, then I have to study how to use the new counters, registers and timers.
It will be a great help if you can explain the equivalence between the Arduino Uno variables and the one to use in Arduino Due.
These are the "not declared variables" that I would use in Arduino Due (with equivalents):

TCCR2A
TCCR2B
CS20
CS21
CS22
TIMSK2
TOIE2
TCNT2

The sketch is from Michael Blank and it is intended to command a Rail Model Train in DCC (Digital Control).
This is the part of the sketch that generates the errors:
//--------------------------------------------------------------------------------------------------------------------------------
//Setup Timer2.
//Configures the 8-Bit Timer2 to generate an interrupt at the specified frequency.
//Returns the time load value which must be loaded into TCNT2 inside your ISR routine.
void SetupTimer2(){

//Timer2 Settings: Timer Prescaler /8, mode 0
//Timmer clock = 16MHz/8 = 2MHz oder 0,5usec
TCCR2A = 0;
TCCR2B = 0<<CS22 | 1<<CS21 | 0<<CS20;

//Timer2 Overflow Interrupt Enable
TIMSK2 = 1<<TOIE2;

//load the timer for its first cycle
TCNT2=0x8D; // 58usec pulse length

}

//Timer2 overflow interrupt vector handler
ISR(TIMER2_OVF_vect) {
//Capture the current timer value TCTN2. This is how much error we have
//due to interrupt latency and the work in this function
//Reload the timer and correct for latency.

...
here the TCTN2 is used several times, i.e.
TCNT2=0x8D; // 58usec pulse length
TCNT2=0x1B; // 116usec pulse length
etc
...
//--------------------------------------------------------------------------------------------------------------------------------

Things like TCCRx are called registers. Those expressions are pointers to the registers in an AVR core. Not the SAM3X8E core. The SAM3X8E has registers, just with different names and different locations. Its as if I was giving you driving directions. You may be asking me how to get to the local drug store, so I say drive straight and take the third right. Then, when you go to a different town, you follow the same directions but end up at a different store. This town has its own directions, just like the SAM3X8E has its own registers at different locations. Consult the SAM3X8E for register names. I advise looking at the Due libraries included with the IDE, since they include some nice functions for setting up things like timers.

Timer and interrupt handler solved...now it works.
Now I have problems with the serial port (see the 3ad "Serial.read problems with Arduino Due")

How solved?
What Due library?
Is the IDE going to include a set of Due Examples?

Are there Due examples for Timers, Interrupts, CAN, etc., Where?

I am gradually making some, but how can we get some Due-Examples
into the IDE for other Due-users to use for learning?

Are there any Due-related Reference/Help pages being created,
like those for the traditional Arduino series?

Is the IDE goal to make the old programs work, using new Due
versions of the libraries, with the same calls and functions?

Thanks, Gary