日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

c语言spi测试代码,spi_test.c的spi跟踪(spi 数据传送流程)

發布時間:2024/9/27 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c语言spi测试代码,spi_test.c的spi跟踪(spi 数据传送流程) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

晚上跟蹤 了下spi_test.c,數據的傳送流程大概是這樣的:

transfer()(spidev_test.c)-->

ioctl()(spidev_test.c)-->

spidev_ioctl()(spidev_test.c)--->

spidev_message()(spidev.c)--->

spidev_sync()(spidev.c)--->

spi_async(spi.h)--通過調用

spi->master->transfer(spi ,message)

調用--->spi_bitbang_transfer()(spi_bitbang.c)--->

bitbang_work()(spi_bitbang.c)--

通過status=bitbang->txrx_buf()

調用---->sep4020_spi_txrx()具體的傳數據,其實是 sep4020_spi_txrx()(spi_sep4020.c)與sep4020_spi_txrx()(spi_sep4020.c)共同實現的,通過硬件上的中斷觸發,完成了數據的傳送

spidev_message()函數:

1:把用戶空間的數據傳進buf;

2:通過spidev_sync()函數一級級調用,來傳輸數據

3:把buf中的數據在送到用戶空間中,通過終端顯示

以下是代碼運行a.out跟蹤代碼

# mount all...........

mount: mounting none on /proc/bus/usb failed: No such file or directory

# Starting mdev.........

starting pid 358, tty '': '-/bin/sh'

hwclock: can't open '/dev/misc/rtc': No such file or directory

mkdir: cannot create directory '/var/run': File exists

/ # ./a.out

after the open-----------------------------------

we have enter the? iocontl*****************

we have enter the? iocontl*****************

<7>spidev spi0.0: before the setup---------1-------

<7>spidev spi0.0: ---********we enter the sep4020_soi_setupxfer

<7>SPI: sep4020_spi_setupxfer: we get the clk rate? is 176

<7>spidev spi0.0: setting pre-scaler to 176 (hz 500000)

<7>SPI: sep4020_spi_setupxfer: the value of div is 176

<7>SPI: sep4020_spi_setupxfer: the value of BITBANG_CS_INACTIVE is 0

<7>SPI: sep4020_spi_chipsel: we have enter the sep4020_spi_chipsel

<7>spidev spi0.0: sep4020_spi_setup: mode 0, 8 bpw, 500000 hz

<7>spidev spi0.0: spi mode 00

we have enter the? iocontl*****************

we have enter the? iocontl*****************

after the spi mode----------------------------------

we have enter the? iocontl*****************

we have enter the? iocontl*****************

<7>spidev spi0.0: before the setup-------------3---

3333333333333333333

3333333333333333333

<7>spidev spi0.0: ---********we enter the sep4020_soi_setupxfer

<7>SPI: sep4020_spi_setupxfer: we get the clk rate? is 176

<7>spidev spi0.0: setting pre-scaler to 176 (hz 500000)

<7>SPI: sep4020_spi_setupxfer: the value of div is 176

<7>SPI: sep4020_spi_setupxfer: the value of BITBANG_CS_INACTIVE is 0

<7>SPI: sep4020_spi_chipsel: we have enter the sep4020_spi_chipsel

<7>spidev spi0.0: sep4020_spi_setup: mode 0, 8 bpw, 500000 hz

<7>spidev spi0.0: 8 bits per word

we have enter the? iocontl*****************

we have enter the? iocontl*****************

after the bits per wors-----------------------------

we have enter the? iocontl*****************

we have enter the? iocontl*****************

<7>spidev spi0.0: before the setup-------------4---

<7>spidev spi0.0: ---********we enter the sep4020_soi_setupxfer

<7>SPI: sep4020_spi_setupxfer: we get the clk rate? is 176

<7>spidev spi0.0: setting pre-scaler to 176 (hz 500000)

<7>SPI: sep4020_spi_setupxfer: the value of div is 176

<7>SPI: sep4020_spi_setupxfer: the value of BITBANG_CS_INACTIVE is 0

<7>SPI: sep4020_spi_chipsel: we have enter the sep4020_spi_chipsel

<7>spidev spi0.0: sep4020_spi_setup: mode 0, 8 bpw, 500000 hz

<7>spidev spi0.0: 500000 Hz (max)

we have enter the? iocontl*****************

we have enter the? iocontl*****************

after the max speed hz----------------------------------

spi mode: 0

bits per word: 8

max speed: 500000 Hz (500 KHz)

before the transfer iocontl

we have enter the? iocontl*****************

we have enter the? iocontl*****************

<7>spidev spi0.0: default-------------

--------1--------

--------1--------

---------2-------

---------2-------

--------3--------

--------3--------

--------4--------

--------4--------

--------5--------

--------5--------

--------6--------

--------6--------

we are in spidev_sync -----

we are in spidev_sync -----

********************spi_bitbang_transfer***********************************

********************spi_bitbang_transfer***********************************

********************spi_bitbang_transfer****************end*******************

********************spi_bitbang_transfer****************end*******************

after the spi_async

after the spi_async

1

1

2

2

*******************bitbang_work***********************************

*******************bitbang_work***********************************

bitbang_work*******1***********

bitbang_work*******1***********

we enter the sep4020_soi_setupxfer

we enter the sep4020_soi_setupxfer

<7>SPI: sep4020_spi_setupxfer: we get the clk rate? is 176

<7>spidev spi0.0: setting pre-scaler to 176 (hz 500000)

<7>SPI: sep4020_spi_setupxfer: the value of div is 176

bitbang_work*******2***********

bitbang_work*******2***********

<7>SPI: sep4020_spi_chipsel: we have enter the sep4020_spi_chipsel

<7>SPI: sep4020_spi_chipsel: we have enble spi in the sep4020_spi_chipsel

bitbang_work*******3***********

bitbang_work*******3***********

bitbang_work*******4***********

bitbang_work*******4***********

<7>spidev spi0.0: txrx: tx c1c0c000, rx c1c0c000, len 38

<7>SPI: sep4020_spi_txrx: the value of SSIENR is :0x1

<7>SPI: sep4020_spi_txrx: in sep4020_spi_irq before enable spi in txrx

<7>SPI: sep4020_spi_txrx: have enble spi in txrx

<7>SPI: sep4020_spi_txrx: we begin to sent the first byte:0xff

<7>SPI: sep4020_spi_txrx: SSI_IMR:0x1e ,SSI_ISR:0x0 ,SSI_RISR:0x1 ,SSI_SR:0x2

<7>SPI: sep4020_spi_irq: I am done

<7>SPI: sep4020_spi_txrx: the read data is :0

we enter the sep4020_soi_setupxfer

we enter the sep4020_soi_setupxfer

<7>SPI: sep4020_spi_setupxfer: we get the clk rate? is 176

<7>spidev spi0.0: setting pre-scaler to 176 (hz 500000)

<7>SPI: sep4020_spi_setupxfer: the value of div is 176

<7>SPI: sep4020_spi_chipsel: we have enter the sep4020_spi_chipsel

*******************bitbang_work********************end***************

*******************bitbang_work********************end***************

3

3

4

4

5

5

the end of the spidev_sync----

the end of the spidev_sync----

-------7--------

-------7--------

we have after the transfer iocotl----------

FF FF FF FF FF FF

40 00 00 00 00 95

FF FF FF FF FF FF

FF FF FF FF FF FF

FF FF FF FF FF FF

DE AD BE EF BA AD

BC AC

/ #

文章出處:飛諾網(

總結

以上是生活随笔為你收集整理的c语言spi测试代码,spi_test.c的spi跟踪(spi 数据传送流程)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。