clk子系统 - 驱动框架

【linux kernel】一文总结linux的clk框架 本文浅析linux的clk框架 阅读详情

clk子系统负责为整个系统硬件提供时钟信号,这个要和linux的时钟系统区别开来;现在的ASoC上包含许多clk模块,比如晶振,pll,divider等,那么clk子系统就把这些模块抽象出来,并形成一个驱动框架,这样对于其他驱动开发人员来说,只需要调用通用的接口就能操作各自设备的clk,没必要从上到下重新配置clk

1.驱动框架

这里写图片描述
clk驱动框架如上图,API层是提供操作clk的通用接口,CORE层是抽象各个clk设备为一个对象加入到框架中,HARDWARE层主要是为不同的clk设备生成一个对象,最后会加入到一个clk链表:

static HLIST_HEAD(clk_root_list);
static HLIST_HEAD(clk_orphan_list);

如果你是个根设备那个就加入clk_root_list,其他的clk设备加入到clk_orphan_list,它们的关系如下图:

这里写图片描述

2.相关结构体及关系

2.1 struct clk

struct clk {
    const char      *name;
    const struct clk_ops    *ops;
    struct clk_hw       *hw;
    struct clk      *parent;
    const char      **parent_names;
    struct clk      **parents;
    u8          num_parents;
    u8          new_parent_index;
    unsigned long       rate;
    unsigned long       new_rate;
    struct clk      *new_parent;
    struct clk      *new_child;
    unsigned long       flags;
    unsigned int        enable_count;
    unsigned int        prepare_count;
    struct hlist_head   children;
    struct hlist_node   child_node;
    unsigned int        notifier_count;

    void            *private_data;
#ifdef CONFIG_COMMON_CLK_DEBUG
    struct dentry       *dentry;
#endif
};

clk结构体是clk子系统的主要结构体,每个clk设备都会抽象为一个clk结构体,这个结构体构建了clk的拓扑关系

2.2 struct clk_hw

struct clk_hw {
    struct clk *clk;
    const struct clk_init_data *init;
};

clk_hw为不同的clk设备到统一的clk设备搭建桥梁,通过clk_hw就能找到clk_fixed_rate/clk_gate/clk_divider…;比如要找到clk_gate,就可以通过以下宏定义实现:

#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw)

2.3clk的相关操作函数ops

struct clk_ops {
    int     (*prepare)(struct clk_hw *hw);
    void        (*unprepare)(struct clk_hw *hw);
    int     (*is_prepared)(struct clk_hw *hw);
    void        (*unprepare_unused)(struct clk_hw *hw);
    int     (*enable)(struct clk_hw *hw);
    void        (*disable)(struct clk_hw *hw);
    int     (*is_enabled)(struct clk_hw *hw);
    void        (*disable_unused)(struct clk_hw *hw);
    unsigned long   (*recalc_rate)(struct clk_hw *hw,
                    unsigned long parent_rate);
    long        (*round_rate)(struct clk_hw *hw, unsigned long,
                    unsigned long *);
    long        (*determine_rate)(struct clk_hw *hw, unsigned long rate,
                    unsigned long *best_parent_rate,
                    struct clk **best_parent_clk);
    int     (*set_parent)(struct clk_hw *hw, u8 index);
    u8      (*get_parent)(struct clk_hw *hw);
    int     (*set_rate)(struct clk_hw *hw, unsigned long,
                    unsigned long);
    void        (*init)(struct clk_hw *hw);
};

这些操作函数不是每种clk设备都会用到,对于特定的设备只会用到其对应的操作函数,下表总结为:
“y”表示会用到,”-“表示看情况

opsclk_fixed_rateclk_gateclk_dividerclk_muxclk_fixed_factorclk_composite
prepare-
unprepare-
is_prepared-
unprepare_unused-
enabley-
disabley-
is_enabledy-
disable_unused-
recalc_rateyyy-
round_rateyy-
determine_ratey-
set_parenty-
get_parenty-
set_rateyy-

clk源代码在目录drivers/clk:
core的代码源文件为:clkdev.c ,clk-devres.c, clk.c,还有hardware相关的源文件:

clk_fixed_rateclk_gateclk_dividerclk_muxclk_fixed_factorclk_composite
clk-fixed-rate.cclk-gate.cclk-divider.cclk-mux.cclk-fixed-factor.cclk-composite.c

3.clk通用函数接口介绍

这些通用函数接口在头文件include/linux/clk.h中:
clk的打开与关闭:

int clk_enable(struct clk *clk);
void clk_disable(struct clk *clk);
static inline int clk_prepare_enable(struct clk *clk);
static inline void clk_disable_unprepare(struct clk *clk);

clk设备频率:

int clk_set_rate(struct clk *clk, unsigned long rate);
long clk_round_rate(struct clk *clk, unsigned long rate);
unsigned long clk_get_rate(struct clk *clk);

当然还有其他的接口,具体请参考源文件

ref.

linux3.1

㉖AW-H3 Linux驱动开发之clk子系统驱动程序 本次用纯Linux + 自制Filesystem,这种方式更利于学习底层驱动,在说clk子系统之前,我们先说一下如何做最基础的Linux系统,我们这里主要用的是Linux和busybox,其中busybox用来制作文件系统.这一节直接用之前的博客做的文件系统,详细制作步骤参考: https://blog.youkuaiyun.com/qq_23922117/article/details/78312908 ... 阅读详情

相关推荐

uboot框架源码剖析详解

一、uboot源码整体框架 cpu 与处理器相关的文件。每个子目录中都包括cpu.c和interrupt.c、start.S、u-boot.lds。 cpu.c:初始化CPU、设置指令Cache和数据Cache等 interrupt.c:设置系统的各种中断和异常 start.S:是U-boot启动时执行的第一个文件,它主要做最早期的系统初始化,代码重定向和设置系统堆栈,为进入U-boot第二阶段的C程序奠定基础。 u-boot.lds:链接脚本

weixin_38606457的博客 2928

linux内核时钟管理,Linux时钟管理透彻分析

Linux时钟管理透彻分析。硬件资源越来越庞大和复杂,内核的另一个挑战就是要便捷的管理这些资源。同时,面对如此之多的平台不同的CPU,管理机制需要统一适用,这就需要对资源的管理抽象到更加通用的层次。CPU中各个模块都需要时钟驱动,内核需要一种机制能通用所有的平台,方便的管理CPU上所有的clk资源。这里分析Linux对clk的管理。通常操作为以下几步:1.定义struct clk *clk;2.获...

weixin_42363510的博客 1212

Linux时钟子系统:CCF框架与驱动开发实践

时钟管理是嵌入式系统开发的核心基础技术之一,它通过精确的时序控制确保硬件协同工作。Linux内核采用CCF(Common Clock Framework)框架统一管理时钟资源,该框架采用Provider-CCF-Consumer三层架构设计,实现了硬件无关的时钟操作接口。在驱动开发中,开发者通过clk_set_rate等标准API即可完成时钟配置,无需关心底层硬件差异。时钟子系统广泛应用于CPU主频调节、外设工作时钟控制等场景,其稳定性和性能直接影响系统整体表现。通过分析clk_core等关键数据结构和cl

weixin_28729843的博客 342

linux clk

涉及的主要文件有

luckywang1103的专栏 3680

Linux内核时钟子系统实战:手把手教你用CCF框架配置RK3399的PLL时钟

本文深入解析Linux内核时钟子系统在RK3399平台上的实战应用,通过CCF框架配置PLL时钟的详细步骤。从嵌入式系统时钟架构到设备树配置,再到驱动开发关键实现,提供全面的技术指南,帮助开发者高效管理SoC时钟资源,确保系统稳定性和性能优化。

weixin_30664051的博客 359

Linux整理回归(二)--扩展补充

本文接着上文,继续进行阶段性整理。

文艺小少年的博客 111

linux驱动移植-通用时钟框架子系统

一、CCF子系统概述 计算机硬件通过许多时钟设备提供时钟。从进入系统内部的 cpu core 时钟开始,使用数十种时钟,如 timer、i2c、uart 等。每个 ARM SoC都通过多个时钟设备驱动程序设置时钟,硬件千差万别。 linux内核采用了一个时钟子系统来解决这个问题。在linux 3.4之后的版本,linux内核时钟子系统又叫通用时钟框架子系统,简称CCF子系统(common clo...

Graceful_scenery的博客 361

41页PPT | 华为业务流程架构全景视图:全业务域L1-L3级流程全案

TBD、收集和生成线索、验证机会点、TBD、管理销售授权、管理销售项目、管理销售项目群、管理合同要素/模板、验证和分发线索、标前引导、管理开票和回款、客户网络评估、管理销售评审、TBD、管理交付项目群、管理合同文档、管理结构化合同信息、跟踪和培育线索、制定并提交标书、管理合同/PO变更、客户网络规划、管理销售决策。:4.1 管理技术、服务请求、4.2管理备件、服务交付、4.3管理非技术、服务请求、4.4管理客户、投诉。:管理Idea、产生Idea、激发兴趣与协作、孵化、原型和验证、确认Idea与商业化。

zuoan1993的博客 4547

5.从RK808驱动看Linux MFD子系统与Regulator框架的协同设计

本文深入解析了RK808 PMIC芯片在Linux系统中的驱动设计,重点探讨了MFD子系统如何将复杂硬件拆分为regulator、RTC等虚拟设备进行统一管理,并详细介绍了regulator框架的电源控制机制与设备树配置实践,为嵌入式电源管理提供了完整解决方案。

rose2的博客 681

告别谷歌翻译失效!手把手教你用Immersive Translate插件实现双语网页阅读(附Chrome/Edge/Firefox保姆级配置)

本文详细介绍了如何使用Immersive Translate插件实现双语网页阅读,解决谷歌翻译失效的问题。通过Chrome、Edge和Firefox的保姆级配置指南,帮助用户轻松安装和使用这款支持双语对照、智能识别网页内容的翻译插件,提升外文资料阅读效率。

weixin_28683689的博客 485

实用工具系列 - Xshell安装下载与使用

一、介绍 二、下载 三、安装 四、使用

Passerby_Wang的博客 1万+

Linux 时钟子系统详解

在现代SoC中,时钟系统是所有硬件模块能正常工作的基础CPU、总线、外设控制器、存储接口等模块,本质上都是同步数字电路,其时序行为完全依赖于时钟信号‍​​是Linux内核中用于统一管理系统clock资源的子系统,为各模块提供时钟信号,主要解决以下问题如何统一描述复杂的时钟硬件结构如何让不同设备安全地共享同一时钟资源如何在不暴露硬件细节的前提下操作时钟(实现clock控制的通用逻辑)如何将时钟管理与设备树、功耗管理结合‍。

weixin_51107304的博客 949

2024年全国大学生信息安全竞赛安徽省赛网络系统建设与运维赛项-网络构建真题

该网络工程方案主要包含基础配置、有线网络、无线网络、出口网络、运维配置和SDN网络六个部分。基础配置包括设备接口设置、SSH服务开启和SNMP功能配置。有线网络部分重点部署VLAN、MSTP、VRRP和OSPF协议,实现网络冗余和负载均衡。无线网络规划了AP点位、信号覆盖和用户接入策略,包括SSID配置、频段优化和安全认证。出口网络配置了NAT转换、VPN隧道和流量审计功能。运维方面搭建了监控平台实时监测设备状态。SDN网络部分通过控制器实现流量管控。整个方案实现了多业务隔离、高可用性网络架构和

weixin_42221934的博客 1174

Linux时钟子系统架构与驱动开发实战

时钟管理是嵌入式系统和服务器运维中的核心技术,其核心原理是通过分层架构管理硬件时钟源。Linux时钟子系统采用Provider-Consumer模型,包含时钟注册、查找和控制等基础服务,通过时钟树结构实现频率分配。在驱动开发中,开发者需要掌握时钟提供者注册、动态频率调整等关键技术,这些技术在I2C接口调试、CPU动态调频等场景中具有重要应用价值。通过debugfs等工具可以高效调试时钟问题,而合理的时钟配置能显著降低系统功耗,如在RK3588等平台中优化时钟门控可降低30%功耗。

weixin_30363285的博客 299

深入解析五大ADC芯片架构及其应用场景

本文深入解析了五大ADC芯片架构及其应用场景,包括逐次逼近型ADC、Σ-Δ型ADC、流水线型ADC、闪存型ADC和积分型ADC。通过详细的架构分析和实际应用案例,帮助工程师理解不同ADC芯片的特点和适用场景,提升电路设计效率。

weixin_28702105的博客 354

使用SAM进行遥感图像语义分割

SAM(Segment Anything Model)的成功表明了以数据为中心的机器学习的重要性。然而,由于遥感(RS)图像注释的困难和高成本,大量有价值的RS数据仍然没有被标记,特别是在像素级。在这项研究中,我们利用SAM和现有的RS物体检测数据集,开发了一个高效的管道来生成大规模的RS分割数据集,称为SAMRS。SAMRS在规模上超过了现有的高分辨率RS分割数据集几个数量级,并提供了物体类别、位置和实例信息,可用于语义分割、实例分割和物体检测,无论是单独还是组合。

lalula的博客 7451

Linux内核CCF通用时钟框架原理与驱动开发实战

时钟在嵌入式系统中不仅是频率源,更是影响RTC精度、NTP同步、DMA时序和看门狗行为的关键系统资源。CCF(Common Clock Framework)通过时钟拓扑建模、父子依赖管理与频率传播机制,将离散寄存器操作升维为可追溯、可协同的有向无环图(DAG)系统。其核心价值在于支撑多级分频、动态调频(DVFS)、热插拔设备及温度漂移补偿等复杂场景,广泛应用于ARM64、RISC-V等SoC平台。理解CCF,本质是掌握设备树驱动协同、rate propagation协商流程与/sys/kernel/debu

weixin_29194693的博客 91

别再用RIDE了!VSCode+RobotFramework插件打造现代化测试开发环境

本文介绍了如何利用VSCode和RobotFramework插件构建现代化的测试开发环境,替代老旧的RIDE工具。详细讲解了环境配置、插件安装、智能代码补全、测试运行与调试等核心功能,帮助开发者提升自动化测试效率。文章还提供了高级技巧、最佳实践和常见问题解决方案,助力团队实现平滑迁移。

weixin_28829629的博客 480

linux clk驱动框架

内核中提供了clk common framework子系统,用来完成对clock的统一管理。 我们将从如下几个方面来介绍clk子系统的内容:1. clk framework简介 2. clk framework的实现 3. clk和device tree 4. 如何添加自己的clock一、 clk framework简介 clk framework是内核中用来统一管理clock的子

程序猿Ricky的日常干货 1万+

第 8 篇:TMC2240 电机正反转实现|DIR 引脚控制 + 代码优化(稳定不抖动)

本文详细介绍了TMC2240电机驱动芯片的正反转实现方法,重点解决方向切换时的抖动和冲击问题。文章首先明确了硬件连接、基础配置和使能状态三个前提条件,然后阐述了DIR引脚电平控制方向的核心原理,提供了STM32的GPIO配置代码。针对方向切换时的电流冲击问题,作者提出了"停止-延迟-切换-启动"的平滑切换逻辑,并给出了包含方向枚举、转速控制和方向切换函数的完整代码实现方案。通过这种优化方法,可以有效避免电机在正反转切换时产生的抖动、冲击声和发热问题,实现稳定的双向控制。文章还提示了后续可

BackCatK Chen的博客 2073

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

驱动开发硬核特训 · Day 24(下篇):深入理解 Linux 内核时钟子系统结构

在上一章节中,我们详细探讨了 SoC 中时钟控制器的硬件组成和功能。本篇将聚焦于 Linux 内核中的时钟子系统,深入解析其架构、关键数据结构、驱动实现以及与设备树的关系,帮助您全面掌握时钟子系统的工作原理和开发要点。Linux 内核中的时钟子系统主要由 Common Clock Framework(CCF)组成,旨在为各种硬件平台提供统一的时钟管理接口。CCF 通过抽象不同类型的时钟,简化了时钟的注册、配置和使用流程,增强了内核的可移植性和可维护性。

Interview_TC的博客 1628

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

linux学习

linux中断详解好文 http://www.wowotech.net/irq_subsystem/interrupt_subsystem_architecture.html linux clk驱动框架 https://blog.youkuaiyun.com/rikeyone/article/details/51672720

tangqinglin的专栏 181

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

linux内核虚拟时钟驱动

本文介绍了Linux内核中虚拟时钟控制器驱动的实现方法。主要内容包括:1) 固定频率时钟的注册与使用,通过设备树配置晶振频率并使用clk_register_fixed_rate()注册;2) 门控时钟的实现,用于动态开关外设时钟以降低功耗;3) 倍频器与选择器的应用场景,如PLL锁相环和CPU时钟切换;4) 复合时钟的抽象,将MUX、分频器和门控打包成单一逻辑时钟。文章还提供了设备树配置示例和驱动代码片段,展示了如何获取时钟资源、准备和使能时钟的标准流程。

云淡风轻 40

linux驱动-CCF-0基础

晶振:提供基础时钟源的(可分为有源晶振、无源晶振两种);PLL: 用于倍频的锁相环;mux: 用于多路时钟源选择;Divider: 用于分频的;gate: 用于时钟使能的与门电路等。

2401_83458819的博客 355

【Linux 内核专栏 19】20 · 嵌入式子系统 — GPIO·pinctrl·clock·regulator

本文系统解析Linux内核SoC驱动框架四件套:GPIO、pinctrl、CCF时钟与regulator电源子系统。从设备树绑定到gpiod、clk、regulator等核心API使用,详解引脚配置、时钟使能、电源管理及中断处理机制,揭示“外设不工作”的根本原因——非代码错误,而是时钟/电源/引脚未就绪。适合嵌入式开发者掌握BSP底层原理,实现驱动高效调试与开发。

peter_pan_study的博客 645

linux内核clk驱动子系统

本文分析了Linux内核时钟子系统的框架结构,重点介绍了时钟提供者驱动的实现。时钟子系统采用树状结构管理SoC中的各类时钟源,包含固定时钟、可编程时钟等类型。关键数据结构包括clk_hw_onecell_data(时钟控制器抽象)、clk_hw(硬件时钟抽象)、clk_init_data(初始化参数)和clk_core(时钟内部表示)。文章通过瑞芯微芯片的设备树示例,展示了固定时钟、SoC内部时钟和外部I2C时钟的配置方式,并详细解析了各数据结构在时钟注册和管理中的作用机制。

jianjian的博客 1117
上一篇: 硬盘基本术语
下一篇: clk子系统 - 代码分析
gomogomono
博客等级 码龄17年 909粉丝 191原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值