Nios® II Software Developer Handbook

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

15.1.30. alt_flash_open_dev()

Prototype

alt_flash_fd* alt_flash_open_dev(const char* name)

Commonly Called By

C/C++ programs

Device drivers

Thread-safe

No.

Available from ISR

No.

Include

<sys/alt_flash.h>

Description

The alt_flash_open_dev() function opens a flash device. After it is opened, you can perform the following operations:
  • Write to a flash device using alt_write_flash()
  • Read from a flash device using alt_read_flash()
  • Control individual flash blocks using alt_get_flash_info(), alt_erase_flash_block(), or alt_write_flash_block().

    Call the alt_flash_open_dev function only when operating in single-threaded mode.

Return

The return value is zero upon failure. Any other value indicates success.