nios II 高2G地址与低2G的关系
来源:互联网 发布:windows如何安装redis 编辑:程序博客网 时间:2024/06/07 09:08
IO programming in user space.
Note, you are doing in user space, with uclibc and included from /opt/nios2/include. It is not kernel space. You can not use interrupt. You can not use nios2 HAL, either.
You should know about the cache in Nios II. (BadOman:?) The first 2GB of address space is cached. The second 2GB is non-cached. These are not two seperate memory spaces or anything so there is a total of 2GB of address space (mirrored memory). This only applies for Nios II Full version with Data Cache. Nios II Standard version is uncached, so there should be no problems.
In other words address 0x00000000 (cachable) maps to address 0x8000000 (non-cachable)
" " " " " " 0x00000001 " " " " " " " " 0x8000001 (and so on .....)
So use the first 2GB for non-peripheral access (local memory), and the second 2GB for peripherals
You can define memory pointer access, and you can make it uncached by setting address bit 31.
eg, 0x00004000 -> 0x80004000
Or use port address defined in nios2_system.h, eg na_button_pio.
#include
#define inw(port) (*(volatile unsigned *)(port)) # for io read,
#define outw(d,port) (*(volatile unsigned *)(port))=(d) # for io write,
As an alternative, you can use these two defines (which are always uncached), they are similar to the Nios2-IDE functions :
#define IORD(address,offset) (*(volatile unsigned *)(((address)|0x80000000)+4*(offset)))
#define IOWR(address,offset,value) (*(volatile unsigned *)(((address)|0x80000000)+4*(offset)))=(value)
本文转自
file:///E:/g/linuxnios/pages/CompileHello%20-%20JotSpot%20Wiki%20(nioswiki).htm
Note, you are doing in user space, with uclibc and included from /opt/nios2/include. It is not kernel space. You can not use interrupt. You can not use nios2 HAL, either.
You should know about the cache in Nios II. (BadOman:?) The first 2GB of address space is cached. The second 2GB is non-cached. These are not two seperate memory spaces or anything so there is a total of 2GB of address space (mirrored memory). This only applies for Nios II Full version with Data Cache. Nios II Standard version is uncached, so there should be no problems.
In other words address 0x00000000 (cachable) maps to address 0x8000000 (non-cachable)
" " " " " " 0x00000001 " " " " " " " " 0x8000001 (and so on .....)
So use the first 2GB for non-peripheral access (local memory), and the second 2GB for peripherals
You can define memory pointer access, and you can make it uncached by setting address bit 31.
eg, 0x00004000 -> 0x80004000
Or use port address defined in nios2_system.h, eg na_button_pio.
#include
#define inw(port) (*(volatile unsigned *)(port)) # for io read,
#define outw(d,port) (*(volatile unsigned *)(port))=(d) # for io write,
As an alternative, you can use these two defines (which are always uncached), they are similar to the Nios2-IDE functions :
#define IORD(address,offset) (*(volatile unsigned *)(((address)|0x80000000)+4*(offset)))
#define IOWR(address,offset,value) (*(volatile unsigned *)(((address)|0x80000000)+4*(offset)))=(value)
本文转自
file:///E:/g/linuxnios/pages/CompileHello%20-%20JotSpot%20Wiki%20(nioswiki).htm
- nios II 高2G地址与低2G的关系
- GSM、GPRS、EDGE、2G、3G与WAP的关系
- GSM、GPRS、EDGE、2G、3G与WAP的关系
- 2G、 3G、 4G、5G的区别
- 高通G-sensor-2
- 换用gcc与g++的较低版本
- 2G与3G(转载)
- 2G、3G、4G与WiFi的一些认识
- 2G与3G的制式
- 实验2 建立带SDRAM的NIOS II系统
- 1G,2G,3G,4G与LTE知识普及
- 3G? 2G? 2.5G? 4G? 与 WIFI, GPRS,CDMA 3G无线上网
- 23-不提权读取高2G内存
- 1G/2G/2.5G/3G
- 什么是2G、3G、4G
- g++和gcc的关系
- gcc和g++的关系
- Oracle 10g中 sga_max_size 与 sga_target的关系
- linux乱码解决
- 伪技术人员的成长历程之20-在Windows下的OpenVPN
- UpdateProgress控件显示问题
- Nano-X的FASTJPEG的问题
- 将yum的目标服务器更改为中国大陆服务器镜像
- nios II 高2G地址与低2G的关系
- Stay with my heart -Sophie Zelmani
- Asp.net程序中生成Excel报表
- 绝美情诗排行榜
- 关于dropdownlist的问题
- javaScript控制選中單選按鈕`
- FlashFXP 3.8 (3.7.2 Build 1270) Beta Incl. Keygen-Lz0
- 深入浅出WPF(9)——数据的绿色通道,Binding(下)
- 计算机名词