当前位置:首页>Linux>Linux 驱动 SPI 和I2C 读写函数

Linux 驱动 SPI 和I2C 读写函数

  • 2026-03-10 01:01:03
Linux 驱动 SPI 和I2C 读写函数
大家好,我是王鸽,这篇主要是对 Linux 驱动下的SPI 和I2C 读写函数具体介绍一下,因为之前的文章都是对这两个通讯协议框架流程解读,怎么读写发送数据没有详细解释。

一、核心前提:SPI/I2C 驱动的通用结构

无论是 SPI 还是 I2C,驱动读写的核心逻辑都是:

  1. 从 client/adapter 获取总线句柄;
  2. 组装读写消息(指定地址、长度、数据缓冲区);
  3. 调用总线核心函数执行传输;
  4. 检查返回值并处理错误。
  5. 二、I2C 读写函数总结
1. 核心 API 分类
函数类型
核心函数
适用场景
返回值说明
通用传输
i2c_transfer()
任意格式的 I2C 读写(推荐)
成功:传输的消息数;失败:负数错误码
SMBus 专用
i2c_smbus_read/write_*()
符合 SMBus 规范的简单读写
成功:0 / 读取值;失败:负数
简化接口
i2c_master_send/receive()
纯写 / 纯读(无寄存器地址)
成功:传输字节数;失败:负数

2. 通用读写模板(最常用)

(1)单寄存器读写(带寄存器地址)

#include<linux/i2c.h>// I2C 读单寄存器(核心模板)inti2c_read_reg(struct i2c_client *client, u8 reg, u8 *val){    struct i2c_msg msgs[2] = {        // 消息1:发送寄存器地址(写操作)        {            .addr = client->addr,  // 外设I2C地址(7位)            .flags = 0,            // 0=写,I2C_M_RD=读            .len = 1,              // 寄存器地址长度(1字节)            .buf = &reg,           // 寄存器地址缓冲区        },        // 消息2:读取寄存器值(读操作)        {            .addr = client->addr,            .flags = I2C_M_RD,     // 读标志            .len = 1,              // 读取数据长度            .buf = val,            // 接收缓冲区        },    };    // 执行传输:成功返回消息数(2),失败返回负数    int ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));    if (ret != ARRAY_SIZE(msgs)) {        dev_err(&client->dev, "I2C读寄存器0x%02x失败,ret=%d\n", reg, ret);        return ret < 0 ? ret : -EIO;    }    return 0;}// I2C 写单寄存器(核心模板)inti2c_write_reg(struct i2c_client *client, u8 reg, u8 val){    u8 buf[2] = {reg, val};  // 寄存器地址 + 写入值    struct i2c_msg msg = {        .addr = client->addr,        .flags = 0,        .len = ARRAY_SIZE(buf),        .buf = buf,    };    int ret = i2c_transfer(client->adapter, &msg, 1);    if (ret != 1) {        dev_err(&client->dev, "I2C写寄存器0x%02x失败,ret=%d\n", reg, ret);        return ret < 0 ? ret : -EIO;    }    return 0;}

还有kernel/drivers/input/touchscreen/rk29_i2c_goodix.c

(2)多寄存器批量读写

// I2C 批量读寄存器(reg:起始寄存器,buf:接收缓冲区,len:读取长度)

int i2c_read_regs(struct i2c_client *client, u8 reg, u8 *buf, u16 len) {    struct i2c_msg msgs[2] = {        { .addr = client->addr, .flags = 0, .len = 1, .buf = &reg },        { .addr = client->addr, .flags = I2C_M_RD, .len = len, .buf = buf },    };    int ret = i2c_transfer(client->adapter, msgs, 2);    if (ret != 2) {        dev_err(&client->dev, "I2C批量读失败,reg=0x%02x, len=%d\n", reg, len);        return ret < 0 ? ret : -EIO;    }    return 0;}// I2C 批量写寄存器int i2c_write_regs(struct i2c_client *client, u8 reg, const u8 *buf, u16 len) {    // 拼接寄存器地址 + 数据    u8 *tx_buf = devm_kzalloc(&client->dev, len + 1, GFP_KERNEL);    if (!tx_buf) return -ENOMEM;    tx_buf[0] = reg;    memcpy(&tx_buf[1], buf, len);    struct i2c_msg msg = {        .addr = client->addr,        .flags = 0,        .len = len + 1,        .buf = tx_buf,    };    int ret = i2c_transfer(client->adapter, &msg, 1);    devm_kfree(&client->dev, tx_buf);  // 释放临时缓冲区    if (ret != 1) {        dev_err(&client->dev, "I2C批量写失败,reg=0x%02x, len=%d\n", reg, len);        return ret < 0 ? ret : -EIO;    }    return 0;}

rtc/rtc-max6900.c

读取寄存器函数

写寄存器函数

(3)SMBus 简化接口(适合标准外设)

// SMBus 读字节(等价于单寄存器读)int i2c_smbus_read_byte(struct i2c_client *client, u8 reg) {    int ret = i2c_smbus_read_byte_data(client, reg);    if (ret < 0) {        dev_err(&client->dev, "SMBus读字节失败,reg=0x%02x\n", reg);        return ret;    }    return ret;  // 返回读取的字节值}// SMBus 写字节int i2c_smbus_write_byte(struct i2c_client *client, u8 reg, u8 val) {    int ret = i2c_smbus_write_byte_data(client, reg, val);    if (ret < 0) {        dev_err(&client->dev, "SMBus写字节失败,reg=0x%02x\n", reg);    }    return ret;}//其中 /** * i2c_smbus_read_byte_data - SMBus "read byte" protocol * @client: Handle to slave device * @command: Byte interpreted by slave * * This executes the SMBus "read byte" protocol, returning negative errno * else a data byte received from the device. */s32 i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command){	union i2c_smbus_data data;	int status;	status = i2c_smbus_xfer(client->adapter, client->addr, client->flags,				I2C_SMBUS_READ, command,				I2C_SMBUS_BYTE_DATA, &data);return (status < 0) ? status : data.byte;}EXPORT_SYMBOL(i2c_smbus_read_byte_data);/** * i2c_smbus_write_byte_data - SMBus "write byte" protocol * @client: Handle to slave device * @command: Byte interpreted by slave * @value: Byte being written * * This executes the SMBus "write byte" protocol, returning negative errno * else zero on success. */s32 i2c_smbus_write_byte_data(const struct i2c_client *client, u8 command,			      u8 value){	union i2c_smbus_data data;data.byte = value;return i2c_smbus_xfer(client->adapter, client->addr, client->flags,			      I2C_SMBUS_WRITE, command,			      I2C_SMBUS_BYTE_DATA, &data);}EXPORT_SYMBOL(i2c_smbus_write_byte_data);
其中i2c_smbus_read_byte_data用于通过 I2C SMBus 协议,从指定 I2C 设备(由 i2c_client 指定)的某个寄存器(由 command 参数指定)读取1 个字节的数据。
client:指向 struct i2c_client 的指针,代表一个具体的 I2C 设备(包含设备地址、挂载的 I2C 适配器等信息);
command:要读取的寄存器地址(或命令码),对应 I2C 设备的子地址;
返回值:成功返回读取到的字节数据(0~255),失败返回负数错误码(如 -EIO 表示通信失败)。
都调用的i2c_smbus_xfer,这个函数主要做 “基础校验 + 转发”
status = i2c_smbus_xfer(    client->adapter,    // 参数1:I2C适配器(对应硬件I2C控制器,如i2c-0)    client->addr,       // 参数2:目标I2C设备的7/10位地址    client->flags,      // 参数3:通信标志(如I2C_M_TEN表示10位地址、I2C_M_RECV_LEN等)    I2C_SMBUS_READ,     // 参数4:操作类型——读    command,            // 参数5:寄存器地址/命令码(要读的哪个寄存器)    I2C_SMBUS_BYTE_DATA,// 参数6:数据类型——单字节数据(寄存器+1字节)    &data// 参数7:输出缓冲区——存储读取到的字节数据);

函数返回值 status 的含义:

  • 成功:返回0(注意:读取到的实际数据存在data.byte中,不是返回值);
  • 失败:返回负数错误码(如-EIO表示通信失败、-ETIMEDOUT表示超时、-EINVAL表示参数非法)。
最后调用
static s32 i2c_smbus_xfer_emulated(struct i2c_adapter *adapter, u16 addr,				   unsigned short flags,				   char read_write, u8 command, int size,				   union i2c_smbus_data *data)				   {......	status = i2c_transfer(adapter, msg, num);if (status < 0)return status;.........		}
i2c_smbus_read_byte_data是高层业务接口,封装了 “读单字节寄存器” 的语义,无需关心协议细节;
i2c_smbus_xfer是中间桥接层,仅做参数校验和重试,核心逻辑交给 __i2c_smbus_xfer
__i2c_smbus_xfer是协议转换核心,将 SMBus 操作转换为 I2C 标准消息序列,是整个流程的关键节点。
i2c_smbus_xfer → __i2c_smbus_xfer(构造 i2c_msg) → i2c_transfer
小结一下:
追踪代码可以发现
i2c_read_reg(struct i2c_client *client, u8 reg, u8 *val)int i2c_read_regs(struct i2c_client *client, u8 reg, u8 *buf, u16 lenint i2c_smbus_read_byte(struct i2c_client *client, u8 reg)
最后都调用 
i2c_transfer(structi2c_adapter*adap,structi2c_msg*msgs,int num)
  1. 看一下i2c_transfer最后执行到哪里?

int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) 

if (in_atomic() || irqs_disabled()) {//中断关闭			ret = i2c_trylock_adapter(adap);if (!ret)/* I2C activity is ongoing. */return -EAGAIN;else {			i2c_lock_adapter(adap); // 2. 加总线锁(防止并发访问I2C总线)		}		ret = __i2c_transfer(adap, msgs, num);//3.适配器底层的xfer函数(真正的硬件操作入口)		i2c_unlock_adapter(adap); // 4. 释放总线锁return ret;else {		dev_dbg(&adap->dev, "I2C level transfers not supported\n");return -EOPNOTSUPP;	}
  其中
int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num){unsigned long orig_jiffies;int ret, try;/* Retry automatically on arbitration loss */	orig_jiffies = jiffies;for (ret = 0try = 0try <= adap->retries; try++) {		ret = adap->algo->master_xfer(adap, msgs, num);if (ret != -EAGAIN)break;if (time_after(jiffies, orig_jiffies + adap->timeout))break;	}return ret;}EXPORT_SYMBOL(__i2c_transfer);
adap->algo->master_xfer(adap, msgs, num)是具体 I2C 控制器驱动实现的硬件操作函数(比如i2c-imx.ci2c-gpio.c中的xfer),它会直接操作硬件寄存器,按照i2c_msg消息序列控制 SCL/SDA 时序,完成实际的读写 —— 这是i2c_transfer的最终落地,也是整个调用链路的终点。
  • i2c_transfer
     是 I2C 消息执行的统一入口,核心作用是参数校验、总线加锁、转发消息到适配器底层;
  • 它不直接操作硬件,而是调用适配器 algo->xfer 函数(硬件相关),实现 “上层统一接口 + 底层差异化实现”;
  • 关键机制:总线锁(防抢占)、重试机制(提稳定性)、消息序列执行(支持多步操作)。

好的I2C的读写就到这里,接下来是SPI 读写。

三、SPI 读写函数总结

1. 核心 API 分类

SPI 无统一的「消息传输」函数,需根据内核版本选择:

内核版本
核心函数
适用场景
返回值说明
3.15+(推荐)
spi_transfer()
 + spi_message
任意 SPI 读写(支持多段传输)
成功:0;失败:负数错误码
旧版本
spi_sync()
简化单段传输
成功:0;失败:负数
简化接口
spi_write/spi_read
纯写 / 纯读(无片选控制)
成功:0;失败:负数

2. 通用读写模板(3.15+ 内核)

(1)单寄存器读写(SPI 通常用指令 + 数据格式)

#include<linux/spi/spi.h>// SPI 读单寄存器(cmd:读写指令,val:接收值)intspi_read_reg(struct spi_device *spi, u8 cmd, u8 *val){    u8 tx_buf[2] = {cmd | 0x800x00};  // 读指令(最高位1表示读)    u8 rx_buf[2] = {0};    // 组装SPI传输段    struct spi_transfer t = {        .tx_buf = tx_buf,        // 发送缓冲区(指令)        .rx_buf = rx_buf,        // 接收缓冲区(数据)        .len = ARRAY_SIZE(tx_buf), // 传输长度        .speed_hz = spi->max_speed_hz, // 传输速率(可用自定义值)        .cs_change = 0,          // 传输后不释放片选    };    // 组装SPI消息    struct spi_message msg;    spi_message_init(&msg);    spi_message_add_tail(&t, &msg);    // 执行传输    int ret = spi_sync(spi, &msg);    if (ret < 0) {        dev_err(&spi->dev, "SPI读寄存器0x%02x失败,ret=%d\n", cmd, ret);        return ret;    }    *val = rx_buf[1];  // 提取读取的值(根据外设协议调整)    return 0;}// SPI 写单寄存器intspi_write_reg(struct spi_device *spi, u8 cmd, u8 val){    u8 tx_buf[2] = {cmd & 0x7F, val};  // 写指令(最高位0表示写)    struct spi_transfer t = {        .tx_buf = tx_buf,        .len = ARRAY_SIZE(tx_buf),        .speed_hz = spi->max_speed_hz,        .cs_change = 0,    };    struct spi_message msg;    spi_message_init(&msg);    spi_message_add_tail(&t, &msg);    int ret = spi_sync(spi, &msg);    if (ret < 0) {        dev_err(&spi->dev, "SPI写寄存器0x%02x失败,ret=%d\n", cmd, ret);    }    return ret;}

(2)多字节批量读写

// SPI 批量读(cmd:起始指令,buf:接收缓冲区,len:读取长度)int spi_read_bulk(struct spi_device *spi, u8 cmd, u8 *buf, u16 len) {    // 分配发送缓冲区(指令 + 占位符)    u8 *tx_buf = devm_kzalloc(&spi->dev, len + 1, GFP_KERNEL);    if (!tx_buf) return -ENOMEM;    tx_buf[0] = cmd | 0x80;  // 读指令    struct spi_transfer t = {        .tx_buf = tx_buf,        .rx_buf = buf,        .len = len + 1,        // 指令1字节 + 数据len字节        .speed_hz = spi->max_speed_hz,    };    struct spi_message msg;    spi_message_init(&msg);    spi_message_add_tail(&t, &msg);    int ret = spi_sync(spi, &msg);    devm_kfree(&spi->dev, tx_buf);    if (ret < 0) {        dev_err(&spi->dev, "SPI批量读失败,cmd=0x%02x, len=%d\n", cmd, len);        return ret;    }    // 注意:buf[0]是指令回显,有效数据从buf[1]开始(根据外设调整)    memmove(buf, &buf[1], len);    return 0;}// SPI 批量写int spi_write_bulk(struct spi_device *spi, u8 cmd, const u8 *buf, u16 len) {    u8 *tx_buf = devm_kzalloc(&spi->dev, len + 1, GFP_KERNEL);    if (!tx_buf) return -ENOMEM;    tx_buf[0] = cmd & 0x7F;  // 写指令    memcpy(&tx_buf[1], buf, len);    struct spi_transfer t = {        .tx_buf = tx_buf,        .len = len + 1,        .speed_hz = spi->max_speed_hz,    };    struct spi_message msg;    spi_message_init(&msg);    spi_message_add_tail(&t, &msg);    int ret = spi_sync(spi, &msg);    devm_kfree(&spi->dev, tx_buf);    if (ret < 0) {        dev_err(&spi->dev, "SPI批量写失败,cmd=0x%02x, len=%d\n", cmd, len);    }    return ret;}

(3)简化接口(纯写 / 纯读)

// 纯写(无寄存器地址,直接发数据)int spi_write_simple(struct spi_device *spi, const u8 *buf, u16 len) {    return spi_write(spi, buf, len);  // 封装好的简化函数}// 纯读(先发送dummy数据,再读)int spi_read_simple(struct spi_device *spi, u8 *buf, u16 len) {    // 分配dummy发送缓冲区    u8 *tx_buf = devm_kzalloc(&spi->dev, len, GFP_KERNEL);    if (!tx_buf) return -ENOMEM;    struct spi_transfer t = {        .tx_buf = tx_buf,        .rx_buf = buf,        .len = len,    };    struct spi_message msg;    spi_message_init(&msg);    spi_message_add_tail(&t, &msg);    int ret = spi_sync(spi, &msg);    devm_kfree(&spi->dev, tx_buf);    return ret;}

四、SPI vs I2C 读写核心差异

维度
I2C 读写
SPI 读写
地址方式
7/10 位外设地址(client->addr)
片选(CS)引脚区分外设,无总线地址
读写标志
I2C_M_RD
 标志区分读写
指令位(如最高位)区分读写
传输单位
i2c_msg
 消息(可多段)
spi_transfer
 传输段 + spi_message
片选控制
无片选,靠地址应答
cs_change
 控制片选释放 / 保持
速率控制
设备树 clock-frequency
speed_hz
 字段自定义
错误码
-EIO
(无应答)、-ENXIO(无总线)
-EIO
(传输失败)、-EPROTO(协议错)

五、通用避坑要点

1. 硬件相关

  • 地址校验:I2C 外设地址是 7 位(不要带读写位),SPI 无地址但要确认 CS 引脚;
  • 速率匹配:传输速率不能超过外设最大支持值(I2C 常见 100K/400K,SPI 常见 1M/10M);
  • 时序匹配:SPI 需确认 CPOL/CPHA(时钟极性 / 相位),I2C 需确认上拉电阻。

2. 软件相关

  • 返回值检查:必须检查所有读写函数的返回值,不能忽略 -EIO 等错误;
  • 缓冲区对齐:SPI 传输缓冲区建议用 kmalloc(DMA 兼容),避免栈上缓冲区;
  • 上下文约束:中断上下文禁止用 devm_kzalloc(GFP_KERNEL),需用 GFP_ATOMIC
  • 数据长度:I2C i2c_transfer 的 len 不能超过适配器最大长度(通常 4096)。

3. 调试技巧

  • 先用户层验证:I2C 用 i2cget/i2cset,SPI 用 spidev_test 工具验证硬件连通性;
  • 开启调试日志:
# I2C 调试日志echo 7 > /sys/module/i2c_core/parameters/debug# SPI 调试日志echo 1 > /sys/module/spi_core/parameters/debug

抓波形验证:用逻辑分析仪对比读写时序是否符合外设手册。

最后总结

  1. I2C 核心
    以 i2c_transfer 为核心,通过 i2c_msg 组装「地址 + 数据」,适合多外设共享总线;
  2. SPI 核心
    以 spi_sync + spi_transfer 为核心,通过指令位区分读写,适合高速传输;
  3. 通用模板
    单寄存器读写是基础,批量读写需注意缓冲区拼接和数据偏移;
  4. 避坑关键
    校验硬件参数、检查返回值、匹配外设时序,先工具验证再写驱动。

谢谢阅读点赞收藏!

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-03-27 21:54:22 HTTP/2.0 GET : https://f.mffb.com.cn/a/478384.html
  2. 运行时间 : 0.126901s [ 吞吐率:7.88req/s ] 内存消耗:4,625.44kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=3d7682e603ccec364a1634a26ce4510b
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000690s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000961s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000351s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000277s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000666s ]
  6. SELECT * FROM `set` [ RunTime:0.000234s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000703s ]
  8. SELECT * FROM `article` WHERE `id` = 478384 LIMIT 1 [ RunTime:0.005760s ]
  9. UPDATE `article` SET `lasttime` = 1774619662 WHERE `id` = 478384 [ RunTime:0.002994s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 67 LIMIT 1 [ RunTime:0.000278s ]
  11. SELECT * FROM `article` WHERE `id` < 478384 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000649s ]
  12. SELECT * FROM `article` WHERE `id` > 478384 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001651s ]
  13. SELECT * FROM `article` WHERE `id` < 478384 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.003645s ]
  14. SELECT * FROM `article` WHERE `id` < 478384 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.029993s ]
  15. SELECT * FROM `article` WHERE `id` < 478384 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.009372s ]
0.128543s