CLEON  Version 1
Cloud-Offloaded GPS Receiver
hal_flash.c File Reference

FLASH configuration. More...

#include "cleon_conf.h"
#include "app_define.h"
#include "sys_define.h"
#include "hal_define.h"
#include "fs_define.h"
Include dependency graph for hal_flash.c:

Go to the source code of this file.

Functions

void HAL_FLASH_Init (void)
 Initializing FLASH.
 
void HAL_FLASH_Write (unsigned int uiSize, unsigned char *ptrucSource, unsigned char *ptrucDestination)
 Write data to internal FLASH.
 
void HAL_FLASH_EraseSegment (unsigned long *ptrulDestination)
 Erase FLASH segement.
 
void HAL_FLASH_EraseBank (unsigned long *ptrulDestination)
 Erase FLASH bank.
 

Detailed Description

FLASH configuration.

Definition in file hal_flash.c.

Function Documentation

void HAL_FLASH_EraseBank ( unsigned long *  ptrulDestination)

Erase FLASH bank.

Returns
void
Parameters
*ptrulDestination- base address of FLAHS bank

Definition at line 81 of file hal_flash.c.

{
FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY + MERAS; // Set Erase bit
*ptrulDestination = 0; // Dummy write to erase Flash seg
while (FCTL3 & BUSY); // test busy
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCK; // Set LOCK bit
}

Here is the caller graph for this function:

void HAL_FLASH_EraseSegment ( unsigned long *  ptrulDestination)

Erase FLASH segement.

Returns
void
Parameters
*ptrulDestination- base address of FLAHS segment

Definition at line 63 of file hal_flash.c.

{
FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY + ERASE; // Set Erase bit
*ptrulDestination = 0; // Dummy write to erase Flash seg
while (FCTL3 & BUSY); // test busy
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCK; // Set LOCK bit
}
void HAL_FLASH_Init ( void  )

Initializing FLASH.

Returns
void
Parameters
void

Definition at line 21 of file hal_flash.c.

{
#if ERASE_INTERNAL_FLASH_ON_RESET == _ENABLE_
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void HAL_FLASH_Write ( unsigned int  uiSize,
unsigned char *  ptrucSource,
unsigned char *  ptrucDestination 
)

Write data to internal FLASH.

Returns
void
Parameters
uiSize- size of source data
*ptrulSource- base address of source data
*ptrulDestination- base address of FLASH destination

Definition at line 40 of file hal_flash.c.

{
FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY + WRT; // Enable byte/word write mode
while (uiSize > 0) {
while (FCTL3 & BUSY); // test busy
*ptrucDestination++ = *ptrucSource++; // Write to Flash
uiSize--;
}
FCTL1 = FWKEY; // Clear Erase bit
FCTL3 = FWKEY + LOCK; // Set LOCK bit
}

Here is the caller graph for this function: