首页 文章 精选 留言 我的

精选列表

搜索[模块切片],共10000篇文章
优秀的个人博客,低调大师

挖掘全志Tina Linux下SPI主从通信验证模块的秘密

主控: D1H 板卡: 两块哪吒开发板(以下简称为主机, 从机) 操作系统: Tina Linux 2.0 验证D1H芯片SPI主从机通信. 硬件接线 主机SPI 从机SPI 19 SPI1_MOSI SPI1_MOSI 19 21 SPI1_MISO SPI1_MISO 21 23 SPI1_SCK SPI1_SCK 23 24 SPI1_CE SPI1_CE 24 SPI概述 SPI接口是一种高速的, 全双工, 同步的通信总线. 适配D1H芯片的Tina Linux的BSP-SDK(以下简称SDK)中已包含相关驱动文件: spi-sunxi.c. 它提供的了仅内核态下主从机的简易通信验证实验, 这或许是考虑到SPI通信速率比较高的特性. 验证操作 SPI主机配置 MENUCONFIG 在SDK执行完环境变量加载后, 执行: /mnt/tina-d1-h$ make kernel_menuconfig ●开启Device Drivers->SPI support ●进入SPI support, 按图示开启: 设备树 修改: ./device/config/chips/d1-h/configs/nezha/board.dts 需要根据手册和原理图确认好针脚功能: SPI从机配置 MENUCONFIG (同SPI主机配置一致) 设备树 仅spi_slave_mode设为0, 其余项同SPI主机配置一致. spi_slave_mode = <0>; SPI主机收发信息 按上述配置, 重新编译SDK, 打包, 烧录, 启动设备会出现: root@TinaLinux# ls -l /dev/spidev1.0 crw------- 1 root root 153, 0 Jan 1 08:00 /dev/spidev1.0 然后将可执行的SPI测试程序(./lichee/linux-5.4/tools/spi/spidev_test)挪到设备上(adb push等)并赋予可执行权限: # 主机以10MHz发送(即MOSI)发送16进制数据: 0x01 0x02 0x03 0x04 ./spidev_test -v -D /dev/spidev1.0 -s 10000000 -p "\x01\x02\x03\x04" # 主机以10MHz发送(即MOSI)发送ASCII字符串数据: "allwinner" ./spidev_test -v -D /dev/spidev1.0 -s 10000000 -p "allwinner" spi mode: 0x0 bits per word: 8 max speed: 10000000 Hz (10000 KHz) TX | 61 6C 6C 77 69 6E 6E 65 72 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ |allwinner| 注意SPI是同步通信接口, 所以在发送的同时也会接收同样长度字节的数据. 下文将用到SPI主从通信的一种常见做法: 主机先发指令头, 然后再发指令体以获取从机应答. SPI从机收发信息 spi-sunxi.c中对SPI从机模(SLAVE_MODE)采取了简单的收发验证处理, 具体是创建一个内核线程执行int sunxi_spi_slave_task(void *data), 该函数又被设备中断所控制(当收到SPI数据时). SPI从机接收到数据的主要流程: sunxi_spi_slave_task() -> sunxi_spi_slave_handle_head(), 然后: 若指令头是写操作(0x01), 则执行:sunxi_spi_slave_cpu_rx_config(), 该函数仅是输出写入内容. 若指令投是读操作(0x03), 则执行:sunxi_spi_slave_cpu_tx_config(), 该函数仅是将收到的指令体的值+0x80, 然后发送(MISO)给主机. 对于从机, spi-sunxi.c能验证SPI通信, 但没有可供用户层直接使用的方法. 用户层可验证的SPI从机收发方案 功能设计 从机安排一块32byte的内存缓存空间(简称"缓存空间")供主机通过指令进行读操作和写操作, 且从机能在用户层对该内存空间访问. 主要改动 spi.c: 增加static struct class_attribute ye_spi_buf_attrs[], 以创建/sys/class/spi_slave目录下的spi_buf文件, 并提供实现了读/写缓存空间的方法. spi-sunxi.c: 使用ye_spi_slave_set_txdata()方法替换sunxi_spi_slave_set_txdata(), 以实现读操作. 修改sunxi_spi_slave_cpu_rx_config()方法, 以实现写操作. 改动详情请查看:d1h_spi_driver.diff 使用方法 写操作: 操作:0x01(写) 地址:0x00 0x00 0x00 指令体长度:0x09 ./spidev_test -v -D /dev/spidev1.0 -s 10000000 -p "\x01\x00\x00\x00\x09" && \ ./spidev_test -v -D /dev/spidev1.0 -s 10000000 -p "allwinner" 读操作: 操作:0x03(读) 地址:0x00 0x00 0x00 指令体长度:0x09 ./spidev_test -v -D /dev/spidev1.0 -s 10000000 -p "\x03\x00\x00\x00\x09" && \ ./spidev_test -v -D /dev/spidev1.0 -s 10000000 -p "\x00\x00\x00\x00\x00\x00\x00\x00\x00" 从机读取缓存空间: cat /sys/class/spi_slave/spi_buf 从机写入缓存空间: echo "Hello world" > /sys/class/spi_slave/spi_buf

优秀的个人博客,低调大师

爱组搭 aizuda 低代码 OSS 文件存储模块 1.0.6 发布

目前支持 Minio ,阿里云 OSS ,腾讯 COS ,亚马逊 AWSS3 ,本地存储 支持文件类型合法校验 OSS.fileStorage(platform).bucket(bucketName) // 使用默认 yml 配置媒体类型 .allowMediaType(bis) // 只允许gif图片上传,所有图片可以是 image/ 部分匹配 .allowMediaType(fis, t -> t.startsWith("image/gif")) .upload(bis, filename); 源码地址:https://gitee.com/aizuda/aizuda-components 仓库地址:https://search.maven.org/search?q=aizuda-oss 升级日志: 新增Amazon AWS S3 支持 优化OSS文件检查新增注释说明 对外返回 Client 实现 优化返回签名地址 优化返回桶名称 其它完善 SpringBoot 使用 application.yml 配置 # 配置存储平台 ,第一位 test-minio 为默认存储平台 aizuda: oss: test-minio: platform: minio endpoint: http://xxxxxx accessKey: xxx secretKey: xxxxxxx bucketName: test1 aliyun-oss: platform: aliyun endpoint: http://xxxxxx accessKey: xxx secretKey: xxxxxxx bucketName: test Bean 方式注入,以下注入 minio3 为平台别名 @Bean public IFileStorage minio3() { // 注入一个自定义存储平台 OssProperty ossProperty = new OssProperty(); ossProperty.setPlatform(StoragePlatform.minio); ossProperty.setBucketName("test3"); ossProperty.setEndpoint("http://xxxxx"); ossProperty.setAccessKey("q7RNi6elbvQ0j1ry"); ossProperty.setSecretKey("HMoKkeu0zGSvSdDGWlMDuytaRON12St9"); return new Minio(ossProperty); } 测试上传 platform 存储平台(不设置使用默认)bucketName 存储桶(不设置使用默认) // 静态方法方式调用 OSS.fileStorage(platform).bucket(bucketName).upload(fis, filename); // 依赖注入方式调用 fileStorage.bucket(bucketName).upload(fis, filename); #IFileStorage 方法说明 属性 说明 upload 上传 delete 删除 download 下载 getUrl 文件可预览地址 #配置属性说明 属性 说明 platform 存储平台,目前支持 Minio ,阿里云 OSS ,腾讯 COS ,亚马逊 AWSS3 ,本地存储 endpoint 域名 accessKey 访问 KEY secretKey 密钥 bucketName 存储空间桶名 connectionTimeout 连接超时,阿里云 OSS 有效

优秀的个人博客,低调大师

.NET 框架 Furion v4.3.4 发布,日志模块全新体验

序言 自 Furion v3.9.2 版本有了自主可控的日志组件之后,越来越多的 Furion 框架使用者移除了第三方日志组件选择框架内置的,Furion 框架提供了企业开发所需的几乎所有日志需求。 本期更新主要对日志性能,日志模板,日志功能进行了改进优化。 仓库地址:https://gitee.com/dotnetchina/Furion 文档地址:https://dotnetchina.gitee.io/furion/ 本期亮点 1. 更加美观的日志模板 [INF] [Microsoft.Hosting.Lifetime] 2022-08-30T15:52:13.7033488+08:00 [ListeningOnAddress] Now listening on: https://localhost:5001 [INF] [Microsoft.Hosting.Lifetime] 2022-08-30T15:52:13.7405477+08:00 [0] Application started. Press Ctrl+C to shut down. [INF] [Microsoft.Hosting.Lifetime] 2022-08-30T15:52:13.7453185+08:00 [0] Hosting environment: Development [INF] [Microsoft.Hosting.Lifetime] 2022-08-30T15:52:13.7482401+08:00 [0] Content root path: D:\Workplaces\OpenSources\Furion\samples\Furion.Web.Entry\ [WRN] [Furion.Application.TestLoggerServices] 2022-08-30T15:52:32.3892150+08:00 [0] 我是一个二配置日志 20 [ERR] [Furion.Application.TestLoggerServices] 2022-08-30T15:52:35.1479371+08:00 [0] 测试日志异常 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ System.Exception: 错误啦 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ [INF] [System.Logging.LoggingMonitor] 2022-08-30T15:53:26.3936806+08:00 [0] ┏━━━━━━━━━━━ Logging Monitor ━━━━━━━━━━━ ┣ Furion.Application.TestLoggerServices.GetPerson (Furion.Application) ┣ ┣ 控制器名称: TestLoggerServices ┣ 操作名称: GetPerson ┣ 路由信息: [area]: ; [controller]: test-logger; [action]: person ┣ 请求方式: GET ┣ 请求地址: https://localhost:5001/api/test-logger/person/233 ┣ 来源地址: https://localhost:5001/api/index.html ┣ 浏览器标识: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36 Edg/104.0.1293.70 ┣ 客户端 IP 地址: 0.0.0.1 ┣ 服务端 IP 地址: 0.0.0.1 ┣ 服务端运行环境: Development ┣ 执行耗时: 56ms ┣ ━━━━━━━━━━━━━━━ 参数列表 ━━━━━━━━━━━━━━━ ┣ Content-Type: ┣ ┣ id (Int32): 233 ┣ ━━━━━━━━━━━━━━━ 返回信息 ━━━━━━━━━━━━━━━ ┣ 原始类型: Furion.Application.Persons.PersonDto ┣ 最终类型: Furion.UnifyResult.RESTfulResult`1[[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] ┣ 最终返回值: {"StatusCode":200,"Data":{"Id":233,"Name":null,"Age":0,"Address":null,"PhoneNumber":null,"QQ":null,"CreatedTime":"0001-01-01T00:00:00+00:00","Childrens":null,"Posts":null},"Succeeded":true,"Errors":null,"Extras":null,"Timestamp":1661846006385} ┗━━━━━━━━━━━ Logging Monitor ━━━━━━━━━━━ [ERR] [System.Logging.FriendlyException] 2022-08-30T15:53:33.0839966+08:00 [0] Attempted to divide by zero. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ System.DivideByZeroException: Attempted to divide by zero. at Furion.Application.TestLoggerServices.测试直接抛出异常拦截(Int32 id) in D:\Workplaces\OpenSources\Furion\samples\Furion.Application\TestLoggerServices.cs:line 92 at lambda_method108(Closure , Object , Object[] ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ [INF] [Microsoft.EntityFrameworkCore.Database.Command] 2022-08-30T15:53:44.1172386+08:00 [Microsoft.EntityFrameworkCore.Database.Command.CommandExecuted] Executed DbCommand (53ms) [Parameters=[@__p_0='1'], CommandType='Text', CommandTimeout='30'] SELECT "p"."Id", "p"."Address", "p"."Age", "p"."CreatedTime", "p"."Name", "p"."UpdatedTime" FROM "Person" AS "p" WHERE "p"."Id" = @__p_0 LIMIT 1 [WRN] [Microsoft.EntityFrameworkCore.Query] 2022-08-30T15:53:49.0965317+08:00 [Microsoft.EntityFrameworkCore.Query.MultipleCollectionIncludeWarning] Compiling a query which loads related collections for more than one collection navigation, either via 'Include' or through projection, but no 'QuerySplittingBehavior' has been configured. By default, Entity Framework will use 'QuerySplittingBehavior.SingleQuery', which can potentially result in slow query performance. See https://go.microsoft.com/fwlink/?linkid=2134277 for more information. To identify the query that's triggering this warning call 'ConfigureWarnings(w => w.Throw(RelationalEventId.MultipleCollectionIncludeWarning))'. [INF] [Microsoft.EntityFrameworkCore.Database.Command] 2022-08-30T15:53:49.1180132+08:00 [Microsoft.EntityFrameworkCore.Database.Command.CommandExecuted] Executed DbCommand (2ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] SELECT "p"."Id", "p"."Name", "p"."Age", "p"."Address", "p0"."PhoneNumber", "p0"."QQ", "p"."CreatedTime", "p0"."Id", "c"."Id", "c"."Name", "c"."Gender", "t"."Id", "t"."Name", "t"."PersonsId", "t"."PostsId" FROM "Person" AS "p" LEFT JOIN "PersonDetail" AS "p0" ON "p"."Id" = "p0"."PersonId" LEFT JOIN "Children" AS "c" ON "p"."Id" = "c"."PersonId" LEFT JOIN ( SELECT "p2"."Id", "p2"."Name", "p1"."PersonsId", "p1"."PostsId" FROM "PersonPost" AS "p1" INNER JOIN "Post" AS "p2" ON "p1"."PostsId" = "p2"."Id" ) AS "t" ON "p"."Id" = "t"."PersonsId" ORDER BY "p"."Id", "p0"."Id", "c"."Id", "t"."PersonsId", "t"."PostsId" 2. 支持 Visual Studio Code 日志收缩、异常日志高亮 3. 提供 RabbitMQ 事件总线使用指南 4. 提供 Log 静态类写日志更多功能 // 创建日志对象 var logger = Log.CreateLogger("日志名称"); // 创建日志工厂 using var loggerFactory = Log.CreateLoggerFactory(builder => { // .... }); // 日志记录 Log.Information("Information"); Log.Warning("Warning"); Log.Error("Error"); Log.Debug("Debug"); Log.Trace("Trace"); Log.Critical("Critical"); 5. 提供 MessageCenter 事件总线静态类 // 发送消息(含诸多重载) await MessageCenter.PublishAsync("messageId", new {}); // 动态订阅消息 MessageCenter.Subscribe("messageId", async (ctx) => { Console.WriteLine("我是动态的"); await Task.CompletedTask; }); // 取消订阅 MessageCenter.Unsubscribe("messageId"); 本期更新 新特性 [新增]AppSettings配置的ExcludeAssemblies属性,支持忽略指定程序集扫描7b7747f [新增]Oops.Oh和Oops.Bah支持设置额外数据.WithData(data)#I5O38E [新增]定时任务Crontab.GetSleepMilliseconds(baseTime)获取下一个发生时间的时间差d024fae [新增]友好异常默认打印异常日志,避免生产环境漏掉重要异常信息6e3a5bd [新增]日志静态类Log.CreateLoggerFactory()静态方法75c672a [新增]事件总线MessageCenter静态类,解决从Fur v1.x版本升级问题a29fc7c 突破性变化 [新增]Furion程序集PublicKeyToken强签名26b12c0 [调整]事件总线IEventBusFactory事件工厂方法AddSubscriber -> Subscribe,RemoveSubscriber -> Unsubscribea29fc7c 问题修复 [修复]生成包含中文的JWT Token解密后出现乱码问题#I5O397 其他更改 [调整]默认输出文件日志模板,使其更加美观#1518cf3 文档 [新增]RabbitMQ事件总线文档 [更新]AppSettings配置文档、事件总线文档、多数据库配置文档、日志文档、定时任务文档、MessageCenter文档

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

用户登录
用户注册