Contiki 3.x
Macros | Functions
ext-flash.c File Reference

Driver for the LaunchPad Flash and the Sensortag WinBond W25X20CL/W25X40CL. More...

#include "contiki.h"
#include "ext-flash.h"
#include "ti-lib.h"
#include "board-spi.h"
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Macros

#define BLS_CODE_PROGRAM   0x02
 Page Program.
 
#define BLS_CODE_READ   0x03
 Read Data.
 
#define BLS_CODE_READ_STATUS   0x05
 Read Status Register.
 
#define BLS_CODE_WRITE_ENABLE   0x06
 Write Enable.
 
#define BLS_CODE_SECTOR_ERASE   0x20
 Sector Erase.
 
#define BLS_CODE_MDID   0x90
 Manufacturer Device ID.
 
#define BLS_CODE_PD   0xB9
 Power down.
 
#define BLS_CODE_RPD   0xAB
 Release Power-Down.
 
#define BLS_CODE_ERASE_4K   0x20
 Sector Erase.
 
#define BLS_CODE_ERASE_ALL   0xC7
 Mass Erase.
 
#define BLS_STATUS_BIT_BUSY   0x01
 Busy bit of the status register.
 

Functions

static void select_on_bus (void)
 Clear external flash CSN line.
 
static void deselect (void)
 Set external flash CSN line.
 
static bool wait_ready (void)
 Wait till previous erase/program operation completes. More...
 
static uint8_t verify_part (void)
 Verify the flash part. More...
 
static void power_down (void)
 Put the device in power save mode. More...
 
static bool power_standby (void)
 Take device out of power save mode and prepare it for normal operation. More...
 
static bool write_enable (void)
 Enable write. More...
 
bool ext_flash_open (void)
 Initialize storage driver. More...
 
void ext_flash_close (void)
 Close the storage driver. More...
 
bool ext_flash_read (size_t offset, size_t length, uint8_t *buf)
 Read storage content. More...
 
bool ext_flash_write (size_t offset, size_t length, const uint8_t *buf)
 Write to storage sectors. More...
 
bool ext_flash_erase (size_t offset, size_t length)
 Erase storage sectors corresponding to the range. More...
 
bool ext_flash_test (void)
 Test the flash (power on self-test) More...
 
void ext_flash_init (void)
 Initialise the external flash. More...
 

Detailed Description

Driver for the LaunchPad Flash and the Sensortag WinBond W25X20CL/W25X40CL.

Definition in file ext-flash.c.