Specifications

printf ("time in func1 = %u ticks\n",
(unsigned int) (time2 - time1));
printf ("time in func2 = %u ticks\n",
(unsigned int) (time3 - time2));
printf ("Number of ticks per second = %u\n",
(unsigned int)alt_timestamp_freq());
}
return 0;
}
Related Information
HAL API Reference on page 14-1
Using Flash Devices
The HAL provides a generic device model for nonvolatile flash memory devices. Flash memories use
special programming protocols to store data. The HAL API provides functions to write data to flash
memory. For example, you can use these functions to implement a flash-based file subsystem.
The HAL API also provides functions to read flash, although it is generally not necessary. For most flash
devices, programs can treat the flash memory space as simple memory when reading, and do not need to
call special HAL API functions. If the flash device has a special protocol for reading data, such as the
Altera erasable programmable configurable serial (EPCS) configuration device, you must use the HAL
API to both read and write data.
This section describes the HAL API for the flash device model. The following two APIs provide two
different levels of access to the flash:
Simple flash access—Functions that write buffers to flash and read them back at the block level. In
writing, if the buffer is less than a full block, these functions erase preexisting flash data above and
below the newly written data.
Fine-grained flash access—Functions that write buffers to flash and read them back at the buffer level.
In writing, if the buffer is less than a full block, these functions preserve preexisting flash data above
and below the newly written data. This functionality is generally required for managing a file
subsystem.
The API functions for accessing flash devices are defined in sys/alt_flash.h.
For more information about the use of these functions, refer to the HAL API Reference chapter of the Nios
II Software Developer’s Handbook.
For more information about the Common Flash Interface, including the organization of common flash
interface (CFI) erase regions and blocks, refer to the JEDEC website.
For more information about the CFI standard, refer to the JEDEC website and search for document
JESD68.
Related Information
HAL API Reference on page 14-1
JEDEC Website
For more information about the Common Flash Interface standard, including the organization of
common flash interface (CFI) erase regions and blocks, refer to the JEDEC website and search for
document JESD68.
NII5V2
2015.05.14
Using Flash Devices
6-17
Developing Programs Using the Hardware Abstraction Layer
Altera Corporation
Send Feedback