当前位置: 编程技术>移动开发
本页文章导读:
▪iore地图_nocache函数说明 ioremap_nocache函数说明NAME
ioremap_nocache - 把内存映射到CPU空间
SYNOPSIS
void __iomem * ioremap_nocache (unsigned long phys_addr, unsigned long
size);
ARGUMENTS
phys_addr 要映射的物理地址 size 要映射资源的大小.........
▪ 请投小弟我们作品一票 请投我们作品一票
新年公司要logo评选了,请投我们一票,我会写更多博客给投我票的朋友。谢谢!
投票地址:
http://weibo.com/1791575250/profile?topnav=1&wvr=5
图片:
请投:霍克 Mr..........
▪ 限制EditText输入篇幅 限制EditText输入字数1、main_activity.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_pa.........
[1]iore地图_nocache函数说明
来源: 互联网 发布时间: 2014-02-18
ioremap_nocache函数说明
NAME
NAME
ioremap_nocache - 把内存映射到CPU空间
SYNOPSISvoid __iomem * ioremap_nocache (unsigned long phys_addr, unsigned long size);
ARGUMENTS phys_addr 要映射的物理地址 size 要映射资源的大小 DESCRIPTIONioremap_nocache进行一系列平台相关的操作使得CPU可以通过readb/readw/readl/writeb/writew/writel等IO函数进行访问。
返回的地址不保证可以作为虚拟地址直接访问。
[译者按:在译者的使用过程种并没有出现不能作为虚拟地址直接访问的情况,可能是某些平台下的不可以吧。译者的使用平台是x86和ixp425]
这个版本的ioremap确保这些内存在CPU是不可缓冲的,如同PCI总线上现存的缓冲规则一样。注:此时在很多总线上仍有其他的缓冲和缓存。在某些特殊的驱动中,作者应当在PCI写的时候进行读取。
这对于一些控制寄存器在这种不希望复合写或者缓冲读的区域内时是非常有用的
返回的映射地址必须使用iounmap来释放。
一直被这个CPU的高速缓冲困扰,好不容易找到这个函数,总算是解决问题了.
用于确保每次数据都写到内存中了
用于确保每次数据都写到内存中了
[2] 请投小弟我们作品一票
来源: 互联网 发布时间: 2014-02-18
请投我们作品一票
新年公司要logo评选了,请投我们一票,我会写更多博客给投我票的朋友。谢谢!
投票地址:
http://weibo.com/1791575250/profile?topnav=1&wvr=5
图片:
请投:霍克 Mr. Hawk
谢谢!
[3] 限制EditText输入篇幅
来源: 互联网 发布时间: 2014-02-18
限制EditText输入字数
2、MainActivity
完整代码:http://download.csdn.net/detail/wo334499/5025510
1、main_activity.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MainActivity" >
<EditText
android:gravity="top"
android:id="@+id/et"
android:layout_width="fill_parent"
android:layout_height="200dp" />
<TextView
android:layout_below="@id/et"
android:layout_alignParentRight="true"
android:id="@+id/tv"
android:layout_marginRight="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="还可输入10字" />
</RelativeLayout>2、MainActivity
package forrest.foreditlimit;
import android.os.Bundle;
import android.app.Activity;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.Menu;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
private EditText et;
private TextView tv;
private int limitNum = 10;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
init();
setListener();
}
private void setListener() {
et.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void afterTextChanged(Editable s) {
if (s.length() > limitNum) {
// 不能输入
s.delete(limitNum, limitNum+1);
et.setText(s);
et.setSelection(limitNum);
} else {
tv.setText("还可输入" + (limitNum - s.length()) + "字");
}
}
});
}
private void init() {
et = (EditText) findViewById(R.id.et);
tv = (TextView) findViewById(R.id.tv);
}
}
完整代码:http://download.csdn.net/detail/wo334499/5025510
最新技术文章: