uboot 的i2c读写,i2c_read(u_int8_t chip, u_int32_t addr, int alen, u_int8_t *buf, int len),u-boot,i2c_wr
生活随笔
收集整理的這篇文章主要介紹了
uboot 的i2c读写,i2c_read(u_int8_t chip, u_int32_t addr, int alen, u_int8_t *buf, int len),u-boot,i2c_wr
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
【轉帖請注明出處:blog.csdn.net/lanmanck】
看格式,介紹參數好了:
int i2c_read(u_int8_t chip, //芯片的i2c地址,不包含讀寫位
u_int32_t addr, //芯片內的讀寫地址,比如寄存器地址
int alen, //這個要看代碼才知道是地址的長度。比如有的flash比較大就有16位地址。
?? ? ? ? ? ? ?//uboot支持32位地址,不過要看驅動支不支持。0=8bit,1=16bit,2=32bit地址長度
u_int8_t *buf, //數據
int len) ? ? ? ? ? ?//數據長度
?
通過代碼可以看到,addr是在alen!=0的情況下采用的,所以如果只是讀寫8位地址的芯片,addr是沒有用的。因此在讀取之前可能需要用i2c_write先寫一個寄存器地址,然后再調用i2c_read進行讀取。
總結
以上是生活随笔為你收集整理的uboot 的i2c读写,i2c_read(u_int8_t chip, u_int32_t addr, int alen, u_int8_t *buf, int len),u-boot,i2c_wr的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Canvas Scaler 的3种模式
- 下一篇: python x轴显示指定时间刻度