Question about reading NORflash data using ioremap16
Source: Internet
Author: User
For more information about how to use ioremap16 to read NORflash data-Linux general technology-Linux programming and kernel, see the following. Let me explain the situation first:
I am now using AT91RM9200 to read a mounted 28F128J3D norflash with a size of 16 M and a physical address starting from 0x1000 0000
Now we can test the reading flash data in the driver: the code is as follows:
# Define BASE_FLASH (unsigned long) 0x10640000)
Static int _ init eth_init (void)
{
Volatile unsigned int data;
Void * flash_add;
Int I;
Request_mem_region (BASE_FLASH, 0x18, "flash ");
Flash_add = ioremap (BASE_FLASH, 0x18 );
For (I = 0; I <12; I ++ ){
Iowrite16 (WORD_PROGRAM_COMMAND, flash_add );
Iowrite16 (0x1234, flash_add + 0x2 * I );
Iowrite16 (READ_ARRAY_COMMAND, flash_add );
Data = ioread16 (flash_add + 0x2 * I );
Printk ("data = % d \ n", data );
}
Printk ("init module \ n ");
Return 0;
}
The following problems occur:
1. If flash writing can only write two bytes, that is, the iowrite16 () function is executed only once;
2. If ioread16 () is executed after iowrite16 (), you can write all the pairs;
3. If the data read by ioread16 () is incorrect, all data is 127;
Bytes ----------------------------------------------------------------------------------------------------------
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.