Nios® II Software Developer Handbook

ID 683525
Date 8/28/2023
Public
Document Table of Contents

15.1.26. alt_erase_flash_block()

Prototype

int alt_erase_flash_block(alt_flash_fd* fd,

int offset,


 int length)

Commonly Called By

C/C++ programs

Device drivers

Thread-safe

No.

Available from ISR

No.

Include

<sys/alt_flash.h>

Description

The alt_erase_flash_block() function erases an individual flash erase block. The parameter fd specifies the flash device; offset is the offset within the flash of the block to erase; length is the size of the block to erase. No error checking is performed to check that this is a valid block, or that the length is correct.

For more information, refer to “Using Flash Devices” in the "Developing Programs Using the Hardware Abstraction Layer" chapter.

Call the alt_erase_flash_block() function only when operating in single-threaded mode.

The only valid values for the fd parameter are those returned from the alt_flash_open_dev function. If any other value is passed, the behavior of this function is undefined.

Return

The return value is zero upon success. A negative return value indicates failure.