Site Index
   Support Home
   C6000 Home
   DaVinci EVM
   EVMDM6437
   EVM6424
   EVMDM642
   XEVM642
   DSKTCI6482
   EVMTCI6482
   DSK6455
   EVM6455
   EVM6418
   DSK6713
   DSK6416
   Ordering Info.
Google

C6000 Site
Support Site
Main Site

EVMDM642 Flash Module

The FLASH API provides functions to erase as well as read and write from the on-board Flash memory. Programming errors can be detected through use of a checksum function.

The following list summarizes the FLASH API in terms of its function calls:

Function Description
EVMDM642_FLASH_checksum Calculate checksum for a memory range
EVMDM642_FLASH_erase Erase a range of Flash memory
EVMDM642_FLASH_read Read data from a range in Flash
EVMDM642_FLASH_write Write data to a range in Flash

Programs that use the FLASH API should include both the evmdm642.h and the evmdm642_flash.h BSL header files. evmdm642_flash.h defines several constants that may be useful while programming:

Pages and Sectors
The Flash chip is divided up into 64 fixed size sectors. Since the Flash is fairly large and the Flash shares the CE1 space with other peripherals, the EVMDM642 does not have enough address lines to address all of the Flash at one time. The EVMDM642 implements a page based overlay scheme where the Flash is divided into eight pages with only one page (8 sectors) being visible at any one time. The active page is set using the OSD FPGA’s asynchronous FLASHPAGE register.

Name Typical Value Description
EVMDM642_FLASH_BASE 0x90000000 Address of start of Flash memory
EVMDM642_FLASH_SECTORSIZE 0x10000 Size of a normal Flash sector in bytes
EVMDM642_FLASH_SECTORS 8 Number of Flash sectors in a page
EVMDM642_FLASH_PAGESIZE 0x8000 Size of Flash page
EVMDM642_FLASH_PAGES 8 Number of Flash pages
EVMDM642_FLASH_SIZE 0x400000 Total size of Flash
EVMDM642_FLASH_SUPPORT 1 1 if Flash is supported on this target, 0 if not

EVMDM642_FLASH_checksum()

Description
Calculate the checksum of a data range in Flash. The checksum is the unsigned sum of all 8-bit bytes in the range. If the sum is exceeds 0xFFFFFFFF it wraps around at 32-bits. The sum is returned as a single 32-bit value.

Required Headers
evmdm642.h
evmdm642_flash.h

Required Libraries
evmdm642bsl.lib

Function Prototype
Uint32 EVMDM642_FLASH_checksum( Uint32 start, Uint32 length )

Parameters
start - Beginning of region to checksum. Given as an integral number of 8-bit bytes.
length - Length of memory to checksum. Given as an integral number of 8-bit bytes.

Return Value
32-bit checksum that is generated by adding all the bytes in the Flash range

Example

    Uint32 checksum;

    /* Calculate checksum for first page sector of Flash */
    checksum = EVMDM642_FLASH_checksum(EVMDM642_FLASH_BASE,
                                       EVMDM642_FLASH_SECTORSIZE);

EVMDM642_FLASH_erase()

Description
Erase a range of Flash memory.

Required Headers
evmdm642.h
evmdm642_flash.h

Required Libraries
evmdm642bsl.lib

Function Prototype
void EVMDM642_FLASH_erase( Uint32 start, Uint32 length )

Parameters
start - Beginning of region to erase. Given as an integral number of 8-bit bytes.
length - Length of region to erase. Given as an integral number of 8-bit bytes.

Return Value
None

Example

    /* Erase the first 2 sectors of the Flash */
    EVMDM642_FLASH_erase(EVMDM642_FLASH_BASE,
                         (Uint32)(EVMDM642_FLASH_SECTORSIZE * 2));

    /* Erase the current Flash page */
    EVMDM642_FLASH_erase(EVMDM642_FLASH_BASE,
                         EVMDM642_FLASH_PAGESIZE);

EVMDM642_FLASH_read()

Description
Read data from a range in Flash

Required Headers
evmdm642.h
evmdm642_flash.h

Required Libraries
evmdm642bsl.lib

Function Prototype
void EVMDM642_FLASH_read(Uint32 src, Uint32 dst, Uint32 length)

Parameters
src - Address of Flash to read from. Given as an integral number of 8-bit bytes.
dst - Address to memory to read to. Given as an integral number of 8-bit bytes.
length - Length of memory to read from. Given as an integral number of 8-bit bytes.

Return Value
None

Example

    Uint8 buffer[256];

    /* Copy 256 16-bit words from 
     * the beginning of the Flash to buf */
    EVMDM642_FLASH_read(EVMDM642_FLASH_BASE, (Uint32)buf, 256);

EVMDM642_FLASH_write()

Description
Write data to a data range in Flash. The Flash must be erased first.

Required Headers
evmdm642.h
evmdm642_flash.h

Required Libraries
evmdm642bsl.lib

Function Prototype
void EVMDM642_FLASH_write(Uint32 src, Uint32 dst, Uint32 length)

Parameters
src - Address of memory to read from. Given as an integral number of 8-bit bytes.
dst - Address to Flash to write to. Given as an integral number of 8-bit bytes.
length – Length of memory to write to. Given as an integral number of 8-bit bytes.

Return Value
None

Example

    Uint8 buffer[256];

    /* Copy 256 8-bit bytes from buf to the beginning of Flash */
    EVMDM642_FLASH_write((Uint32)buf, EVMDM642_FLASH_BASE, 256);
©Copyright 2002-2012 Spectrum Digital, Inc. All Rights Reserved.