Jump to main content

##

# 1.1.3.4.7 DRV_MEMORY_SyncErase Function

## C

    bool DRV_MEMORY_SyncErase
    (
        const DRV_HANDLE handle,
        uint32_t blockStart,
        uint32_t nBlock
    );

## Summary

Erase the specified number of memory blocks in Synchronous mode.

## Description

This function schedules a blocking sector erase operation for the specified number of memory blocks from the specified block start start address on attached memory device.

## Preconditions

The DRV_MEMORY_Open() must have been called with DRV_IO_INTENT_WRITE or DRV_IO_INTENT_READWRITE as a parameter to obtain a valid opened device handle.

## Parameters

Param | Description
--- | ---
handle | A valid open-instance handle, returned from the driver's open function
blockStart | block start from where the blocks should be erased.
nBlock | Total number of blocks to be erased.

## Returns

- true

  - If the transfer request is successfully completed.

- false

  - If the client opened the driver for read only
  - If the number of blocks to be erased is either zero or more than the number of blocks actually available
  - If the driver handle is invalid

## Example

    // Use DRV_MEMORY_GeometryGet () to find the erase region geometry.
    uint32_t blockStart = 0;
    uint32_t nBlocks = 10;

    // memoryHandle is the handle returned by the DRV_MEMORY_Open function.

    if(DRV_MEMORY_SyncErase( memoryHandle, blockStart, nBlock ) == false)
    {
        // Error handling here
    }

## Remarks

This API is supported only in RTOS environment..