Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

alt_read_flash()

Hello,

What is the meaning of 5000 in alt_read_flash(fd, 0, dest, 5000)? I cannot understand the arguments inside alt_read_flash. I read a few articles and notes but still cannot get its meaning. pls help. thanks!

14 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    hi... thanks for the reply. i am quite confused with "length". what does it mean by "amount of data read" which is "length"? is it in bytes or the number of data to be read? example, i am writing 1Mb of data to flash and want to read it out. so what should be the length for alt_write_flash and alt_read_flash?

    thanks!
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    int alt_read_flash( alt_flash_fd* fd,

    int offset,

    void* dest_addr,

    int length );

    In the "Using Flash Devices" section of the Nios II SW Developers Handbook.

    "A call to alt_read_flash() reads from the flash device with the handle fd,

    offset bytes from the beginning of the flash device. The function writes the data to

    location pointed to by dest_addr, and the amount of data read is length. For most

    flash devices, you can access the contents as standard memory, making it unnecessary

    to use alt_read_flash()."