亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 4580 | 回復(fù): 1
打印 上一主題 下一主題

I2C應(yīng)用程序和Linux內(nèi)核驅(qū)動程序看到的數(shù)據(jù)不一致? [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2007-05-13 21:11 |只看該作者 |倒序瀏覽
大家好!
我的設(shè)計中使用了I2C總線控制器。程序包括應(yīng)用程序和驅(qū)動。
應(yīng)用程序中,定義了下面的數(shù)組(數(shù)組的偶數(shù)項(0開始)表示I2C設(shè)備的地址。奇數(shù)項表示數(shù)據(jù)。):
unsigned char startRA[]={
      STA_REG_SOFT_RESET,      0x01,
      STA_REG_SOFT_RESET,      0x00,
      STA_REG_MUTE,            0x01,
      STA_REG_PCMDIVIDER,      0x01,
      STA_REG_PCMCONF,         0x31,
      STA_REG_PLLFRAC_441_H,   0x67,
      STA_REG_PLLFRAC_441_L,   0x77,
      STA_REG_PLLFRAC_H,       0xbb,
      STA_REG_PLLFRAC_L,       0x3a,
      STA_REG_MFSDF_441,       0x10,
      STA_REG_MFSDF,           0x0F,
      STA_REG_PLLCTL_2,        0x0C,
      STA_REG_PLLCTL_3,        0x00,
      STA_REG_PLLCTL_1,        0xA1,
      STA_REG_SCLK_POL,        0x00,
      STA_REG_REQ_POL,         0x01,
      STA_REG_DATA_REQ_ENABLE, 0x04,
      STA_REG_PLLCTL_1,        0xA1,
      STA_REG_RUN,             0x01,
      STA_REG_PLAY,            0x01,
      STA_REG_MUTE,            0x00,
      0xff,                    0xff };//0xff作為終止符號,沒有傳入內(nèi)核
然后調(diào)用write函數(shù)把數(shù)組寫入I2C總線內(nèi)核驅(qū)動。傳遞給write函數(shù)的數(shù)據(jù)的類型為unsigned char。
可是,內(nèi)核中的i2cdev_write是char:
static ssize_t i2cdev_write (struct file *file, const char __user *buf, size_t count,
                             loff_t *offset)
在測試中,我們在內(nèi)核中把應(yīng)用程序輸入的數(shù)據(jù)打印出來如下:
i2cdev_write Kernel: 16
i2cdev_write Kernel: 16
i2cdev_write Kernel: 20
i2cdev_write Kernel: 84
i2cdev_write Kernel: 85
i2cdev_write Kernel: 82
i2cdev_write Kernel: 81
i2cdev_write Kernel: 101
i2cdev_write Kernel: 100
i2cdev_write Kernel: 80
i2cdev_write Kernel: 97
i2cdev_write Kernel: 6
i2cdev_write Kernel: 7
i2cdev_write Kernel: 5
i2cdev_write Kernel: 13
i2cdev_write Kernel: 12
i2cdev_write Kernel: 24
i2cdev_write Kernel: 5
i2cdev_write Kernel: 114
i2cdev_write Kernel: 19
i2cdev_write Kernel: 20
請問這個是怎么解釋的?
把應(yīng)用程序的所有數(shù)據(jù)都改寫為int類型呢?哪位提供方法解決一下?

論壇徽章:
0
2 [報告]
發(fā)表于 2007-05-14 09:22 |只看該作者
原來是測試打印函數(shù)出錯,傳送進來的數(shù)據(jù)還是對的
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP