关键词ioport的作用是什么
2009-06-13 09:17
239 查看
The ioport keyword enables access to the I/O port space of the C54x devices. The keyword has the form:
ioport type port hex_num
ioport is the keyword that indicates this is a port variable.
type must be char, short, int, or the unsigned variable.
porthex_num refers to the port number. The hex_num argument is a hexadecimal number.
All declarations of port variables must be done at the file level. Port variables declared at the function level are not supported. Do not use the ioport keyword in a function prototype.
For example, the following code declares the I/O port as unsigned port 10h, writes a to port 10h, then reads port 10h into b:
ioport unsigned port10; /* variable to access I/O port 10h */
int func ()
{
...
port10 = a; /* write a to port 10h */
...
b = port10; /* read port 10h into b */
...
}
The use of port variables is not limited to assignments. Port variables can be used in expressions like any other variable. Following are examples:
a = port10 + b; /* read port 10h, add b, assign to a */
port10 += a; /* read port 10h, add a, write to port 10h */
In calls, port variables are passed by value, not by reference:
call(port10); /* read port 10h and pass (by value) to call */
call(&port10); /* invalid pass by reference! */
ioport type port hex_num
ioport is the keyword that indicates this is a port variable.
type must be char, short, int, or the unsigned variable.
porthex_num refers to the port number. The hex_num argument is a hexadecimal number.
All declarations of port variables must be done at the file level. Port variables declared at the function level are not supported. Do not use the ioport keyword in a function prototype.
For example, the following code declares the I/O port as unsigned port 10h, writes a to port 10h, then reads port 10h into b:
ioport unsigned port10; /* variable to access I/O port 10h */
int func ()
{
...
port10 = a; /* write a to port 10h */
...
b = port10; /* read port 10h into b */
...
}
The use of port variables is not limited to assignments. Port variables can be used in expressions like any other variable. Following are examples:
a = port10 + b; /* read port 10h, add b, assign to a */
port10 += a; /* read port 10h, add a, write to port 10h */
In calls, port variables are passed by value, not by reference:
call(port10); /* read port 10h and pass (by value) to call */
call(&port10); /* invalid pass by reference! */
相关文章推荐
- 关键词ioport的作用是什么
- 分析外链对关键词有什么作用
- 关键词const是什么含意,有什么作用
- stdafx.h是什么用处, stdafx.h、stdafx.cpp的作用
- VB中.frm .frx .vbp .vbw .scc有什么作用
- C#中的序列化和反序列化是什么、有什么作用、使用方法详解
- java接口有什么作用?
- #ifdef __cplusplus 有什么作用
- Java中JDK和JRE的区别是什么?它们的作用分别是什么?
- SessionFactory有什么作用? SessionFactory线程安全吗
- dsp,dsw,ncb,opt,clw,plg,aps文件中分别存放的是什么东东,有什么作用?
- Java中对象序列化的作用是什么
- 什么是java序列化,如何实现java序列化?或请解释Serializable接口的作用
- 什么是功率电感,主要作用是什么,在哪些电子设计中要用到
- 什么是IO(三)- IO性能的重要指标
- 建立视图和存储过程到底能有什么作用和方便之处
- translateAnimation.setFillxxx()作用是什么?
- WINS服务器是什么?有什么作用?
- 图像的模式(RGB和CMYK)、通道(8位、16位、32位)分别有什么作用
- 网站SEO关键词排名下降起因是什么?