BSP430  20141115
Board Support Package for MSP430 microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Macros | Functions
flash.h File Reference

Hardware presentation/abstraction for flash memory peripheral (FLASH). More...

#include <bsp430/periph.h>

Go to the source code of this file.

Macros

#define BSP430_MODULE_FLASH   (defined(__MSP430_HAS_FLASH__) || defined(__MSP430_HAS_FLASH2__))
 

Functions

int iBSP430flashEraseSegment_ni (const void *addr)
 
int iBSP430flashWriteData_ni (void *dest, const void *src, size_t len)
 

Detailed Description

Hardware presentation/abstraction for flash memory peripheral (FLASH).

A flash memory peripherals is available on almost every MSP430 MCU, and may be identified as either FLASH or FLASH2. Different MCUs in the same family are one or the other. The differences between these peripherals are visible in the interface provided by this module.

Module Configuration Options

None supported.

Hardware Presentation Layer

As there can be only one instance of the flash memory peripheral on any MCU, there is no structure supporting a FLASH HPL. Manipulate the peripheral through its registers directly.

Hardware Adaptation Layer

As there can be only one instance of FLASH on any MCU, there is no structure supporting a FLASH HAL.

Homepage
http://github.com/pabigot/bsp430

Macro Definition Documentation

#define BSP430_MODULE_FLASH   (defined(__MSP430_HAS_FLASH__) || defined(__MSP430_HAS_FLASH2__))

Defined on inclusion of <bsp430/periph/flash.h>. The value evaluates to true if the target MCU supports the Flash Memory module, and false if it does not.

C Preprocessor Only:
This macro may have a value that restricts its use to C preprocessor conditional directives.

Function Documentation

int iBSP430flashEraseSegment_ni ( const void *  addr)

Erase the flash segment holding the given address

The MSP430 flash segment erase function is invoked.

Note
This function is not responsible for managing either LOCKA or LOCKINFO. If you wish to erase or modify information memory segment A, you will have to clear LOCKA. Similarly if you have set LOCKINFO and wish to modify any information memory segment, you will have to do so yourself.
This function does not disable the watchdog, but does reset it prior to invoking the erase operation. If the duration of the erase operation exceeds the watchdog timeout, the board may reset.
Parameters
addran address within the segment to be erased
Returns
0 if the erase was successful, or a negative error code.
Examples:
rf/cc3000/cli/main.c.
int iBSP430flashWriteData_ni ( void *  dest,
const void *  src,
size_t  len 
)

Copy data into flash memory

Rather like memcpy(), but the destination is assumed to be in a flash memory segment. The write must not cross a segment boundary.

Note
This function is not responsible for managing either LOCKA or LOCKINFO. If you wish to erase or modify information memory segment A, you will have to clear LOCKA. Similarly if you have set LOCKINFO and wish to modify any information memory segment, you will have to do so yourself.
This function does not disable the watchdog, but does reset it prior to copying the data. If the duration of the write operation exceeds the watchdog timeout, the board may reset.
Parameters
destan address in a flash segment. The region into which the data will be written must have already been erased.
srcthe address of the data to be copied into flash
lenthe number of bytes to be copied
Returns
the number of bytes successfully copied, or a negative error code.
Examples:
rf/cc3000/cli/main.c.