#![no_std]
#![no_main]

use core::sync::atomic::{AtomicU8, AtomicU32, Ordering};
use cortex_m::asm;
use flash_algorithm::*;
use pac::pmc::vals::WpKey as PmcWpKey;
use sam3x8e_pac::{self as pac};

struct Algorithm;

static FUNCTION: AtomicU8 = AtomicU8::new(0);
static BASE_ADDRESS: AtomicU32 = AtomicU32::new(0);

algorithm!(Algorithm, {
    device_name: "sam3x-512",
    device_type: DeviceType::Onchip,
    flash_address: 0x80000,
    flash_size: 0x80000,
    page_size: 0x100,
    empty_value: 0xFF,
    program_time_out: 1000,
    erase_time_out: 2000,
    sectors: [{
        size: 0x100,
        address: 0x0,
    }]
});

sam3x_flash::algorithm_impl!();
