flash_at91.c File Reference

At91sam7 Internal flash read/write driver. More...

#include "flash_at91.h"
#include <cpu/types.h>
#include <kern/kfile.h>
#include <io/arm.h>
#include "cfg/cfg_flash_at91.h"
#include <cfg/macros.h>
#include "hw/hw_boot.h"
#include <cfg/log.h>
#include <cpu/irq.h>
#include <cpu/attr.h>
#include <cpu/power.h>
#include <drv/timer.h>
#include <drv/flash.h>
#include <string.h>

Go to the source code of this file.

Functions

static RAM_FUNC void flash_at91_sendWRcmd (uint32_t page)
 Send write command.
static RAM_FUNC int flash_at91_getStatus (struct KFile *_fd)
 Return 0 if no error are occurred after flash memory read or write operation, otherwise return error code.
static RAM_FUNC void flash_at91_flush (Flash *fd)
 Write modified page on internal latch, and then send write command to flush page to internal flash.
static int flash_at91_kfileFlush (struct KFile *_fd)
 Flush At91 flash function.
static void flash_at91_loadPage (Flash *fd, page_t page)
 Check current page and if page is different, load it in temporary buffer.
static size_t flash_at91_write (struct KFile *_fd, const void *_buf, size_t size)
 Write program memory.
static int flash_at91_close (struct KFile *_fd)
 Close file fd.
static void flash_at91_open (struct Flash *fd)
 Open flash file fd name and mode are unused, cause flash memory is threated like one file.
static kfile_off_t flash_at91_seek (struct KFile *_fd, kfile_off_t offset, KSeekMode whence)
 Move fd file seek position of offset bytes from whence.
static struct KFileflash_at91_reopen (struct KFile *_fd)
 Reopen file fd.
static size_t flash_at91_read (struct KFile *_fd, void *_buf, size_t size)
 Read from file fd size bytes and put it in buffer buf.
void flash_hw_init (struct Flash *fd)
 Init module to perform write and read operation on internal flash memory.

Detailed Description

At91sam7 Internal flash read/write driver.

Author:
Daniele Basile <asterix@develer.com>

Definition in file flash_at91.c.


Function Documentation

static int flash_at91_kfileFlush ( struct KFile _fd  )  [static]

Flush At91 flash function.

Write current buffered page in flash memory (if modified). This function erase flash memory page before writing.

Definition at line 161 of file flash_at91.c.

static size_t flash_at91_read ( struct KFile _fd,
void *  _buf,
size_t  size 
) [static]

Read from file fd size bytes and put it in buffer buf.

Returns:
the number of bytes read.

Definition at line 308 of file flash_at91.c.

static RAM_FUNC void flash_at91_sendWRcmd ( uint32_t  page  )  [static]

Send write command.

After WR command cpu write bufferd page into flash memory.

Definition at line 79 of file flash_at91.c.

static size_t flash_at91_write ( struct KFile _fd,
const void *  _buf,
size_t  size 
) [static]

Write program memory.

Write size bytes from buffer _buf to file fd

Note:
Write operations are buffered.

Definition at line 191 of file flash_at91.c.