embkernel
 All Classes Functions Variables Typedefs Groups Pages
DrvFlash.hpp
1 //------------------------------------------------------------------------------
2 //This file is part of embKernel.
3 //See license.txt for the full license governing this code.
4 //------------------------------------------------------------------------------
5 
6 #ifndef DRV_FLASH_HPP_
7 #define DRV_FLASH_HPP_
8 
9 #include <stdint.h>
10 #include <stddef.h>
11 
12 class DrvFlash {
13 public:
14  const static size_t START_ADDRESS = 0x08000000;
15  const static size_t PAGE_SIZE = 2048;
16 
17  inline const static void* getPageStartAddress(int page) {
18  return (void*) (START_ADDRESS + (page * PAGE_SIZE));
19  }
20 
21  static void unlock();
22  static void lock();
23  static bool erasePage(unsigned int page);
24  static bool write(const void* dst, const void* src, size_t len);
25 private:
26  static bool waitActionComplete();
27 };
28 
29 #endif /* DRV_FLASH_HPP_ */