projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add support for more i2c devices.
[bertos.git]
/
bertos
/
cpu
/
avr
/
drv
/
flash_avr.h
diff --git
a/bertos/cpu/avr/drv/flash_avr.h
b/bertos/cpu/avr/drv/flash_avr.h
index 5b8dd6b194d3a1f0d82531cd3138886a2168600a..ecbe1b772cccda9f8e038b10b13eaa75e0e27e5f 100644
(file)
--- a/
bertos/cpu/avr/drv/flash_avr.h
+++ b/
bertos/cpu/avr/drv/flash_avr.h
@@
-30,29
+30,42
@@
*
* -->
*
*
* -->
*
- * \brief Self programming routines (interface).
- *
- * \version $Id$
* \author Francesco Sacchi <batt@develer.com>
* \author Daniele Basile <asterix@develer.com>
* \author Francesco Sacchi <batt@develer.com>
* \author Daniele Basile <asterix@develer.com>
+ *
+ * \brief AVR Internal flash read/write driver.
+ *
+ *
*/
*/
-#ifndef DRV_FLASH_AVR_H
-#define DRV_FLASH_AVR_H
+#ifndef FLASH_AT91_H
+#define FLASH_AT91_H
+
+#include <cpu/types.h>
#include <cfg/compiler.h>
#include <cfg/compiler.h>
-#include <kern/kfile.h>
+
+#include <io/kfile.h>
+
#include <avr/io.h>
#include <avr/io.h>
+#define FLASH_PAGE_SIZE SPM_PAGESIZE
+
/**
* Definition of type for avr flash module.
*/
/**
* Definition of type for avr flash module.
*/
-typedef uint16_t
avr_
page_t;
+typedef uint16_t page_t;
+/* Forward declaration */
+struct Flash;
/**
* FlashAvr KFile context structure.
/**
* FlashAvr KFile context structure.
+ * DEPREACTED STRUCTURE!
+ * Use Flash instead
+ *
+ * \{
*/
typedef struct FlashAvr
{
*/
typedef struct FlashAvr
{
@@
-62,43
+75,33
@@
typedef struct FlashAvr
KFile fd;
/**
KFile fd;
/**
- *
Current buffered page
.
+ *
Flag for checking if current page is modified
.
*/
*/
-
avr_page_t curr_page
;
+
bool page_dirty
;
/**
/**
- *
Flag for checking if current page is modified
.
+ *
Current buffered page
.
*/
*/
-
bool page_dirty
;
+
page_t curr_page
;
/**
* Temporary buffer cointaing data block to
* write on flash.
*/
uint8_t page_buf[SPM_PAGESIZE];
/**
* Temporary buffer cointaing data block to
* write on flash.
*/
uint8_t page_buf[SPM_PAGESIZE];
-
-
} FlashAvr;
} FlashAvr;
+/* \} */
-
-
-/**
- * ID for FlashAvr
- */
-#define KFT_FLASHAVR MAKE_ID('F', 'L', 'A', 'V')
+void flash_hw_init(struct Flash *fd);
/**
/**
- * Convert + ASSERT from generic KFile to FlashAvr.
+ * WARNING!
+ * This function is DEPRECADED!
+ * use the flash module instead.
*/
*/
-INLINE
FlashAvr * FLASHAVRKFILE(KFile
*fd)
+INLINE
void flash_avr_init(struct FlashAvr
*fd)
{
{
- ASSERT(fd->_type == KFT_FLASHAVR);
- return (FlashAvr *)fd;
+ flash_hw_init((struct Flash *)fd);
}
}
-
-void flash_avr_init(struct FlashAvr *fd);
-
-
-
#endif /* DRV_FLASH_AVR_H */
#endif /* DRV_FLASH_AVR_H */