/** @file flash.h
 * Module handling flash memory interface registers.
 *
 * The module provides functions to configure the flash and perform read and
 * writes
 */

#ifndef _FLASH_H_
#define _FLASH_H_

//--includes--------------------------------------------------------------------

#include "stdint.h"


//--type definitions------------------------------------------------------------

/**
 * Available flash configuration presets
 */
enum FlashPreset {
	FLASH_PRESET_LOW_CLOCK_SPEED,    //for 0 < clock <= 24Mz
	FLASH_PRESET_MEDIUM_CLOCK_SPEED, //for 24MHz < clock <= 48MHz
	FLASH_PRESET_HIGH_CLOCK_SPEED,   //for 48MHz < clock <= 72MHz
};


//--functions-------------------------------------------------------------------

/**
 * Configure the flash according to the given preset. Warning: calling this
 * function with a sysclk higher than 24Mhz may cause the system to crash,
 * please lower the clocks first
 */
void flash_configure(enum FlashPreset preset);


#endif //_FLASH_H_

