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 数据传送流程)相关推荐
- c语言spi测试代码,C语言程序SPI
#ifndef _V_SPI_ SPCR = (1/ 使能SPI接口,主机模式,LSB低位在先,模式0,16分频,SPI时钟约1MHz #endif } void un_init_SPI(void) ...
- c语言指针测试代码,一个关于C语言指针的测试
前几天有个同学让我帮他看一道关于指针的二级题.当时虽然做出来了,但感觉对概念还是有点模糊,所以刚刚就做了一个小测试. 测试代码是这样的: #include #include using namespa ...
- java向hdfs提交命令_Java语言操作HDFS常用命令测试代码
本文主要向大家介绍了Java语言操作HDFS常用命令测试代码,通过具体的内容向大家展示,希望对大家学习JAVA语言有所帮助. package com.yxc.hdfs; import org.apac ...
- 【Python】python初学者应该知道与其他语言差异化的高效编程技巧(附测试代码+详细注释)
目录 1. 交换变量 2. 集合去重 3. 列表推导.集合推导和字典推导 4. 统计字符串中各个字符出现的次数 5.优雅地打印JSON数据 6.行内的if语句 6. 符合正常逻辑的数值比较 7. 田忌 ...
- Go语学习笔记 - websocket gorilla(附测试代码) | 从零开始Go语言
目录 项目结构 消息结构 服务端代码 定义客户端行为 服务启动 测试代码 总结 学习笔记,写到哪是哪. websocket也是常用的协议了,在上一篇中主要测试使用了一下grpc. 下面我会把代码贴出来 ...
- C语言运算符号优先级测试代码(i++ ,++i)
a++ //先用后加 ++a //先加后用. c语言的运算符表 测试代码如下: #include <stdio.h>int main(void) {int a=10,b=20;//复合表 ...
- 为《 两周自制脚本语言 》添加中文测试代码
源自自制编译器+自制脚本语言+自制编程语言 三书比较? 两年多前只看了一本的前六章: 实践"两周自制脚本语言"一书[java吧]_百度贴吧 当时是希望一路添加测试用例, 并且最终把 ...
- 操作系统大作业 基于Linux的模拟进程调度算法 运用c++语言编程 在VMware虚拟机里 centos 亲自写亲自测试 代码 说明书
发布文章 博文管理我的博客退出 Trash Temp 操作系统大作业 基于Linux的模拟进程调度算法 运用c++语言编程 在VMware虚拟机里 centos 亲自写亲自测试 代码 说明书 @[TO ...
- C语言程序运行慢是什么问题,为什么cgo的表现如此缓慢?我的测试代码有什么问题吗?...
我正在做一个测试:比较cgo和pure Go功能的卓越时间每次运行1亿次.与Golang功能相比,cgo功能需要更长的时间,我对此结果感到困惑.我的测试代码是: package main import ...
最新文章
- 智源社区AI周刊·第二期:过去一周AI领域的新鲜事
- 数据结构与算法 - 递归回溯(迷宫问题)
- Node.js压缩web项目中的js,css和图片
- 【英语学习】【WOTD】hypermnesia 释义/词源/示例
- 数据治理为何越来越重要
- VS2015 经常不出现智能提示,代码颜色也没有了
- 【Selenium】1.介绍 Selenium
- 基于Android语言的通信调试助手实现(TCP协议+Socket编程)
- unity3d Physics.Raycast和Ray(射线)
- python——numpy——roll()函数
- Gazbo下的无人车集群导航仿真
- 《谷物大脑》笔记(初稿)
- R语言——(四)、数据读入与预处理
- 【国企笔试】263、山有色:水发声 A 山河在:草木深 B 客舍青:柳色新 C 鸟飞绝:人踪灭 D 花作尘:鸟不惊
- android 接口sign,[原创]小米APP登录接口env、envkey、sign、hash算法
- GAN实战——TinyMind书法字体生成练习赛开始报名拉!
- autojs上传蓝奏云UI模板
- 蓝桥杯 时间管理大师
- 目标检测算法——SSD详解
- luogu P3642 [APIO2016]烟火表演
热门文章
- html中怎样播放本地视频教程,【Axure9基础教程】内联框架如何引入本地音频 视频 HTML PDF等本地文件...
- 安卓checkbox无响应_【安卓手机】无法连接电脑的解决方法
- 十年积累,5.4万GitHub Star一朝清零:开源史上最大意外损失
- “牛津第一,16岁上大学”,中国美女学霸被骂学术媛?学术人“光鲜亮丽”就是错?...
- 一头华发梳得整齐,一袭素衣低调谦逊。她是著名的环境工程专家清华第一位女院士钱易教授。...
- 假如把地球46亿年历史压缩到一天,竟然有这么多惊奇的发现!
- windows10 计算文件的HASH(SHA256\MD5等)
- mysql3.5.2 下载_mybatis 3.5.2 jar 下载
- webshell提权教程linux,Linux下WEBSHELL提权
- 解密 云HBase 冷热分离技术原理