| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
DataflashManager.c File Reference

## Detailed Description

Functions to manage the physical Dataflash media, including reading and writing of blocks of data. These functions are called by the SCSI layer when data must be stored or retrieved to/from the physical storage media. If a different media is used (such as a SD card or EEPROM), functions similar to these will need to be generated.

Definition in file DataflashManager.c.

`#include "DataflashManager.h"`

Go to the source code of this file.

## Macros
#define | INCLUDE_FROM_DATAFLASHMANAGER_C

## Functions
void | DataflashManager_WriteBlocks (USB_ClassInfo_MS_Device_t *const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
void | DataflashManager_ReadBlocks (USB_ClassInfo_MS_Device_t *const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)
void | DataflashManager_WriteBlocks_RAM (const uint32_t BlockAddress, uint16_t TotalBlocks, uint8_t *BufferPtr)
void | DataflashManager_ReadBlocks_RAM (const uint32_t BlockAddress, uint16_t TotalBlocks, uint8_t *BufferPtr)
void | DataflashManager_ResetDataflashProtections (void)
bool | DataflashManager_CheckDataflashOperation (void)

## Variables
static int | InitializedFlag = 1

## Macro Definition Documentation

#define INCLUDE_FROM_DATAFLASHMANAGER_C

Definition at line 38 of file DataflashManager.c.

## Function Documentation

bool DataflashManager_CheckDataflashOperation | ( | void |  | ) |

Performs a simple test on the attached Dataflash IC(s) to ensure that they are working.

Returns
  Boolean true if all media chips are working, false otherwise

Definition at line 517 of file DataflashManager.c.

void DataflashManager_ReadBlocks | ( | USB_ClassInfo_MS_Device_t *const | MSInterfaceInfo,
|  | const uint32_t | BlockAddress,
|  | uint16_t | TotalBlocks
| ) |  |

Reads blocks (OS blocks, not Dataflash pages) from the storage medium, the board Dataflash IC(s), into the pre-selected data IN endpoint. This routine reads in Dataflash page sized blocks from the Dataflash and writes them in OS sized blocks to the endpoint.

Parameters

  [in] | MSInterfaceInfo | Pointer to a structure containing a Mass Storage Class configuration and state
  [in] | BlockAddress | Data block starting address for the read sequence
  [in] | TotalBlocks | Number of blocks of data to read

Definition at line 203 of file DataflashManager.c.

void DataflashManager_ReadBlocks_RAM | ( | const uint32_t | BlockAddress,
|  | uint16_t | TotalBlocks,
|  | uint8_t * | BufferPtr
| ) |  |

Reads blocks (OS blocks, not Dataflash pages) from the storage medium, the board Dataflash IC(s), into the preallocated RAM buffer. This routine reads in Dataflash page sized blocks from the Dataflash and writes them in OS sized blocks to the given buffer. This can be linked to FAT libraries to read the files stored on the Dataflash.

Parameters

  [in] | BlockAddress | Data block starting address for the read sequence
  [in] | TotalBlocks | Number of blocks of data to read
  [out] | BufferPtr | Pointer to the data destination RAM buffer

Definition at line 412 of file DataflashManager.c.

void DataflashManager_ResetDataflashProtections | ( | void |  | ) |

Disables the Dataflash memory write protection bits on the board Dataflash ICs, if enabled.

Definition at line 475 of file DataflashManager.c.

void DataflashManager_WriteBlocks | ( | USB_ClassInfo_MS_Device_t *const | MSInterfaceInfo,
|  | const uint32_t | BlockAddress,
|  | uint16_t | TotalBlocks
| ) |  |

Writes blocks (OS blocks, not Dataflash pages) to the storage medium, the board Dataflash IC(s), from the pre-selected data OUT endpoint. This routine reads in OS sized blocks from the endpoint and writes them to the Dataflash in Dataflash page sized blocks.

Parameters

  MSInterfaceInfo | : Pointer to a structure containing a Mass Storage Class configuration and state
  BlockAddress | : Data block starting address for the write sequence
  TotalBlocks | : Number of blocks of data to write

Definition at line 67 of file DataflashManager.c.

void DataflashManager_WriteBlocks_RAM | ( | const uint32_t | BlockAddress,
|  | uint16_t | TotalBlocks,
|  | uint8_t * | BufferPtr
| ) |  |

Writes blocks (OS blocks, not Dataflash pages) to the storage medium, the board Dataflash IC(s), from the given RAM buffer. This routine reads in OS sized blocks from the buffer and writes them to the Dataflash in Dataflash page sized blocks. This can be linked to FAT libraries to write files to the Dataflash.

Parameters

  [in] | BlockAddress | Data block starting address for the write sequence
  [in] | TotalBlocks | Number of blocks of data to write
  [in] | BufferPtr | Pointer to the data source RAM buffer

Definition at line 313 of file DataflashManager.c.

## Variable Documentation

int InitializedFlag = 1
| static

Definition at line 45 of file DataflashManager.c.