Linux内核4.14版本——ccf时钟子系统(3)——ccf一些核心结构体
目录
1. struct clk_hw
2. struct clk_ops
3. struct clk_core
4. struct clk_notifier
5. struct clk
6. struct clk_gate
7. struct clk_divider
8. struct clk_mux
9. struct clk_fixed_factor
10. struct clk_fractional_divider
11. struct clk_multiplier
12. struct clk_composite
13.各结构体之间的关系
1. struct clk_hw
从前文中我们知道,ccf根据不同时钟的特点,clock framework 将 clock 分为 Fixed rate、gate、Divider、Mux、Fixed factor、composite六类,Linux 内核将上面六类设备特点抽象出来,用struct clk_hw表示。
clock framework使用struct clk结构抽象clock,但该结构对clock consumer是透明的(不需要知道它的内部细节)。同样,struct clk对clock provider也是透明的。framework提供了struct clk_hw结构,从clock provider的角度,描述clock,该结构的定义如下:
/*** struct clk_hw - handle for traversing from a struct clk to its corresponding* hardware-specific structure. struct clk_hw should be declared within struct* clk_foo and then referenced by the struct clk instance that uses struct* clk_foo's clk_ops** @core: pointer to the struct clk_core instance that points back to this* struct clk_hw instance** @clk: pointer to the per-user struct clk instance that can be used to call* into the clk API** @init: pointer to struct clk_init_data that contains the init data shared* with the common clock framework.*/
struct clk_hw {//指向CCF模块中对应 clock device 实例struct clk_core *core;//clk是访问clk_core的实例 每当consumer通过clk_get对CCF中的clock device(也就是clk_core) //发起访问的时候都需要获取一个句柄,也就是clkstruct clk *clk;//clock provider driver初始化时的数据,数据被用来初始化clk_hw对应的clk_core数据结构const struct clk_init_data *init;
};/*** struct clk_init_data - holds init data that's common to all clocks and is* shared between the clock provider and the common clock framework.** @name: clock name* @ops: operations this clock supports* @parent_names: array of string names for all possible parents* @num_parents: number of possible parents* @flags: framework-level hints and quirks*/
struct clk_init_data {//该clock设备的名字const char *name;//clock provider driver 进行的具体的 HW 操作const struct clk_ops *ops;//描述该clk_hw的拓扑结构const char * const *parent_names;u8 num_parents;unsigned long flags;
};
以Fixed rate clock和gate clock为例,它就包含一个 struct clk_hw 结构作为核心:
struct clk_fixed_rate {// 包含的 clk_hw 结构struct clk_hw hw;unsigned long fixed_rate;unsigned long fixed_accuracy;u8 flags;
};struct clk_gate {struct clk_hw hw;void __iomem *reg;u8 bit_idx;u8 flags;spinlock_t *lock;
};
由此可以知道:
(1)每次注册进入内核的clock device设备,都会包含一个struct clk_hw结构
(2)strutc clk_hw包含一个重要的结构体成员const struct clk_init_data *init,里面包含了注册进入内核的时钟的具体操作方法,struct clk_init_data 包含一个重要成员clk_ops,里面就是时钟设备的具体操作方法函数。
2. struct clk_ops
/*** struct clk_ops - Callback operations for hardware clocks; these are to* be provided by the clock implementation, and will be called by drivers* through the clk_* api.** @prepare: Prepare the clock for enabling. This must not return until* the clock is fully prepared, and it's safe to call clk_enable.* This callback is intended to allow clock implementations to* do any initialisation that may sleep. Called with* prepare_lock held.** @unprepare: Release the clock from its prepared state. This will typically* undo any work done in the @prepare callback. Called with* prepare_lock held.** @is_prepared: Queries the hardware to determine if the clock is prepared.* This function is allowed to sleep. Optional, if this op is not* set then the prepare count will be used.** @unprepare_unused: Unprepare the clock atomically. Only called from* clk_disable_unused for prepare clocks with special needs.* Called with prepare mutex held. This function may sleep.** @enable: Enable the clock atomically. This must not return until the* clock is generating a valid clock signal, usable by consumer* devices. Called with enable_lock held. This function must not* sleep.** @disable: Disable the clock atomically. Called with enable_lock held.* This function must not sleep.** @is_enabled: Queries the hardware to determine if the clock is enabled.* This function must not sleep. Optional, if this op is not* set then the enable count will be used.** @disable_unused: Disable the clock atomically. Only called from* clk_disable_unused for gate clocks with special needs.* Called with enable_lock held. This function must not* sleep.** @recalc_rate Recalculate the rate of this clock, by querying hardware. The* parent rate is an input parameter. It is up to the caller to* ensure that the prepare_mutex is held across this call.* Returns the calculated rate. Optional, but recommended - if* this op is not set then clock rate will be initialized to 0.** @round_rate: Given a target rate as input, returns the closest rate actually* supported by the clock. The parent rate is an input/output* parameter.** @determine_rate: Given a target rate as input, returns the closest rate* actually supported by the clock, and optionally the parent clock* that should be used to provide the clock rate.** @set_parent: Change the input source of this clock; for clocks with multiple* possible parents specify a new parent by passing in the index* as a u8 corresponding to the parent in either the .parent_names* or .parents arrays. This function in affect translates an* array index into the value programmed into the hardware.* Returns 0 on success, -EERROR otherwise.** @get_parent: Queries the hardware to determine the parent of a clock. The* return value is a u8 which specifies the index corresponding to* the parent clock. This index can be applied to either the* .parent_names or .parents arrays. In short, this function* translates the parent value read from hardware into an array* index. Currently only called when the clock is initialized by* __clk_init. This callback is mandatory for clocks with* multiple parents. It is optional (and unnecessary) for clocks* with 0 or 1 parents.** @set_rate: Change the rate of this clock. The requested rate is specified* by the second argument, which should typically be the return* of .round_rate call. The third argument gives the parent rate* which is likely helpful for most .set_rate implementation.* Returns 0 on success, -EERROR otherwise.** @set_rate_and_parent: Change the rate and the parent of this clock. The* requested rate is specified by the second argument, which* should typically be the return of .round_rate call. The* third argument gives the parent rate which is likely helpful* for most .set_rate_and_parent implementation. The fourth* argument gives the parent index. This callback is optional (and* unnecessary) for clocks with 0 or 1 parents as well as* for clocks that can tolerate switching the rate and the parent* separately via calls to .set_parent and .set_rate.* Returns 0 on success, -EERROR otherwise.** @recalc_accuracy: Recalculate the accuracy of this clock. The clock accuracy* is expressed in ppb (parts per billion). The parent accuracy is* an input parameter.* Returns the calculated accuracy. Optional - if this op is not* set then clock accuracy will be initialized to parent accuracy* or 0 (perfect clock) if clock has no parent.** @get_phase: Queries the hardware to get the current phase of a clock.* Returned values are 0-359 degrees on success, negative* error codes on failure.** @set_phase: Shift the phase this clock signal in degrees specified* by the second argument. Valid values for degrees are* 0-359. Return 0 on success, otherwise -EERROR.** @init: Perform platform-specific initialization magic.* This is not not used by any of the basic clock types.* Please consider other ways of solving initialization problems* before using this callback, as its use is discouraged.** @debug_init: Set up type-specific debugfs entries for this clock. This* is called once, after the debugfs directory entry for this* clock has been created. The dentry pointer representing that* directory is provided as an argument. Called with* prepare_lock held. Returns 0 on success, -EERROR otherwise.*** The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow* implementations to split any work between atomic (enable) and sleepable* (prepare) contexts. If enabling a clock requires code that might sleep,* this must be done in clk_prepare. Clock enable code that will never be* called in a sleepable context may be implemented in clk_enable.** Typically, drivers will call clk_prepare when a clock may be needed later* (eg. when a device is opened), and clk_enable when the clock is actually* required (eg. from an interrupt). Note that clk_prepare MUST have been* called before clk_enable.*/
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 rate,unsigned long *parent_rate);int (*determine_rate)(struct clk_hw *hw,struct clk_rate_request *req);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 rate,unsigned long parent_rate);int (*set_rate_and_parent)(struct clk_hw *hw,unsigned long rate,unsigned long parent_rate, u8 index);unsigned long (*recalc_accuracy)(struct clk_hw *hw,unsigned long parent_accuracy);int (*get_phase)(struct clk_hw *hw);int (*set_phase)(struct clk_hw *hw, int degrees);void (*init)(struct clk_hw *hw);int (*debug_init)(struct clk_hw *hw, struct dentry *dentry);
};
is_prepared,判断clock是否已经prepared。可以不提供,clock framework core会维护一个prepare的计数(该计数在clk_prepare调用时加一,在clk_unprepare时减一),并依据该计数判断是否prepared;
unprepare_unused,自动unprepare unused clocks;
is_enabled,和is_prepared类似;
disable_unused,自动disable unused clocks;
注1:clock framework core提供一个clk_disable_unused接口,在系统初始化的late_call中调用,用于关闭unused clocks,这个接口会调用相应clock的.unprepare_unused和.disable_unused函数。
recalc_rate,以parent clock rate为参数,从新计算并返回clock rate;
注2:细心的读者可能会发现,该结构没有提供get_rate函数,因为会有一个rate变量缓存,另外可以使用recalc_rate。
round_rate,该接口有点特别,在返回rounded rate的同时,会通过一个指针,返回round后parent的rate。这和CLK_SET_RATE_PARENT flag有关,后面会详细解释;
init,clock的初始化接口,会在clock被register到内核时调用。
/*
* flags used across common struct clk. these flags should only affect the
* top-level framework. custom flags for dealing with hardware specifics
* belong in struct clk_foo
*/
#define CLK_SET_RATE_GATE BIT(0) /* must be gated across rate change */
#define CLK_SET_PARENT_GATE BIT(1) /* must be gated across re-parent */
#define CLK_SET_RATE_PARENT BIT(2) /* propagate rate change up one level */
#define CLK_IGNORE_UNUSED BIT(3) /* do not gate even if unused */
#define CLK_IS_ROOT BIT(4) /* root clk, has no parent */
#define CLK_IS_BASIC BIT(5) /* Basic clk, can't do a to_clk_foo() */
#define CLK_GET_RATE_NOCACHE BIT(6) /* do not use the cached clk rate */
上面是framework级别的flags,可以使用或的关系,指定多个flags,解释如下:
CLK_SET_RATE_GATE,表示在改变该clock的rate时,必须gated(关闭);
CLK_SET_PARENT_GATE,表示在改变该clock的parent时,必须gated(关闭);
CLK_SET_RATE_PARENT,表示改变该clock的rate时,要将该改变传递到上层parent(下面再详细说明);
CLK_IGNORE_UNUSED,忽略disable unused的调用;
CLK_IS_ROOT,该clock为root clock,没有parent;
CLK_IS_BASIC,不再使用了;
CLK_GET_RATE_NOCACHE,get rate时,不要从缓存中拿,而是从新计算。
注3:round_rate和CLK_SET_RATE_PARENT
当clock consumer调用clk_round_rate获取一个近似的rate时,如果该clock没有提供.round_rate函数,有两种方法:
1)在没有设置CLK_SET_RATE_PARENT标志时,直接返回该clock的cache rate
2)如果设置了CLK_SET_RATE_PARENT标志,则会询问parent,即调用clk_round_rate获取parent clock能提供的、最接近该rate的值。这是什么意思呢?也就是说,如果parent clock可以得到一个近似的rate值,那么通过改变parent clock,就能得到所需的clock。 在后续的clk_set_rate接口中,会再次使用该flag,如果置位,则会在设置rate时,传递到parent clock,因此parent clock的rate可能会重设。 讲的很拗口,我觉得我也没说清楚,那么最好的方案就是:在写clock driver时,最好不用这个flag,简单的就是最好的(前提是能满足需求)。
3. struct clk_core
/*** private data structures ***/
struct clk_core {const char *name; //clk核心名称const struct clk_ops *ops; //该clk核心对应的ops。struct clk_hw *hw; //指向struct clk_hw类型的指针,表示这个时钟节点的硬件实现;struct module *owner;struct clk_core *parent; //指向struct clk_core类型的指针,表示这个时钟节点的父时钟节点;const char **parent_names;struct clk_core **parents; //一个数组,表示这个时钟节点可能的所有父时钟节点及其对应的索引;u8 num_parents; //表示这个时钟节点总共有多少个可能的父时钟节点;u8 new_parent_index;unsigned long rate;unsigned long req_rate;unsigned long new_rate;struct clk_core *new_parent;struct clk_core *new_child;unsigned long flags;bool orphan;unsigned int enable_count;unsigned int prepare_count;unsigned long min_rate;unsigned long max_rate;unsigned long accuracy; //表示这个时钟节点的频率精度;int phase; //表示这个时钟节点的相位;struct hlist_head children; //一个链表头,用于将所有子时钟节点组织成一个列表。struct hlist_node child_node;struct hlist_head clks;unsigned int notifier_count;
#ifdef CONFIG_DEBUG_FSstruct dentry *dentry;struct hlist_node debug_node;
#endifstruct kref ref;
};
从上述结构的组成元素可知,struct clk_core是strcuct device的子类,因为一款SOC的时钟关系一般以“树状”进行组织,在struct clk_core中提供描述父clk_core和子clk_core的组成元素。
4. struct clk_notifier
stuct clk_notifier用于将CLK与通知器进行关联,也就是定义clk的通知器,基于srcu实现。该结构实现如下(/linux/include/linux/clk.h):
struct clk_notifier {struct clk *clk; //与该通知器关联的clk。struct srcu_notifier_head notifier_head; //用于这个CLK的blocking_notifier_head通知器。struct list_head node;
};
常用API:
//注册一个通知块(notifier block),以便在指定时钟发生事件(例如频率变化)时接收通知。
int clk_notifier_register(struct clk *clk, struct notifier_block *nb);//注销一个通知块
int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);//带资源管理注册一个通知块(notifier block),以便在指定时钟发生事件(如频率变化)时接收通知。确保在设备驱动程序卸载时自动注销通知块。
int devm_clk_notifier_register(struct device *dev, struct clk *clk,struct notifier_block *nb);
5. struct clk
struct clk {struct clk_core *core; //表示clk核心。struct device *dev; //clk设备的父设备。const char *dev_id; //设备id。const char *con_id; unsigned long min_rate; //最小频率。unsigned long max_rate; //最大频率。unsigned int exclusive_count; //独占计数。struct hlist_node clks_node; //clk链表。
};
6. struct clk_gate
struct clk_gate {struct clk_hw hw; //处理公共接口和特定于硬件的接口。void __iomem *reg; //寄存器控制门。u8 bit_idx; //单比特控制门。u8 flags; //特定硬件的falg标志。spinlock_t *lock; //自旋锁。
};
clk_register_gate()/clk_unregister_gate()
7. struct clk_divider
struct clk_divider描述可调的分频时钟,该结构定义如下:
struct clk_divider {struct clk_hw hw; //处理公共接口和特定硬件的接口void __iomem *reg; //分频器的寄存器u8 shift; //分频位域的偏移量u8 width; //分频位域的宽度u8 flags; //标志const struct clk_div_table *table; //数组的值/除数对,最后一项div = 0。spinlock_t *lock; //注册锁
};
具有影响其输出频率的可调分压器的时钟。实现.recalc_rate,.set_rate和.round_rate。
clk_register_divider()/clk_unregister_divider()
clk_hw_register_divider()/clk_hw_unregister_divider()
8. struct clk_mux
struct clk_mux用于描述多路复用器的时钟,该结构定义如下:
struct clk_mux {struct clk_hw hw;void __iomem *reg;const u32 *table;u32 mask;u8 shift;u8 flags;spinlock_t *lock;
};
void clk_unregister_mux(struct clk *clk);
void clk_hw_unregister_mux(struct clk_hw *hw);
9. struct clk_fixed_factor
struct clk_fixed_factor用于倍频和分频时钟。该结构定义如下:
struct clk_fixed_factor {struct clk_hw hw; //处理公共接口和特定硬件的接口。unsigned int mult; //倍频器unsigned int div; //分频器
};
10. struct clk_fractional_divider
struct clk_fractional_divider用于描述可调分数的分频时钟,该结构定义如下:
struct clk_fractional_divider {struct clk_hw hw; //处理公共接口和特定硬件的接口void __iomem *reg; //用于分频器的寄存器u8 mshift; //分频位域分子的偏移量u8 mwidth; //分频位域分子的宽度u8 nshift; //分频位域分母的偏移量u8 nwidth; //分频位域分母的宽度u8 flags; //标志位void (*approximation)(struct clk_hw *hw, //近似方法的callbackunsigned long rate, unsigned long *parent_rate,unsigned long *m, unsigned long *n); spinlock_t *lock; //注册锁
};
11. struct clk_multiplier
struct clk_multiplier结构用于描述可调的倍频时钟,该结构定义如下:
struct clk_multiplier {struct clk_hw hw; //处理公共接口和特定硬件的接口void __iomem *reg; //倍频器的寄存器u8 shift; //乘法位域的偏移量u8 width; //乘法位域的宽度u8 flags; //标志spinlock_t *lock; //注册锁
};
12. struct clk_composite
struct clk_composite结构用于描述多路复用器、分频器和门控时钟的组合时钟。该结构定义如下:
struct clk_composite {struct clk_hw hw; //处理公共接口和特定硬件的接口struct clk_ops ops; //clk对应的ops的callbackstruct clk_hw *mux_hw; //处理复合和硬件特定多路复用时钟struct clk_hw *rate_hw; //处理复合和硬件特定的频率时钟struct clk_hw *gate_hw; //处理之间的组合和硬件特定的门控时钟const struct clk_ops *mux_ops; //对mux的时钟opsconst struct clk_ops *rate_ops; //对rate的时钟opsconst struct clk_ops *gate_ops; //对gate的时钟ops
};
13.各结构体之间的关系
相关文章:
Linux内核4.14版本——ccf时钟子系统(3)——ccf一些核心结构体
目录 1. struct clk_hw 2. struct clk_ops 3. struct clk_core 4. struct clk_notifier 5. struct clk 6. struct clk_gate 7. struct clk_divider 8. struct clk_mux 9. struct clk_fixed_factor 10. struct clk_fractional_divider 11. struct clk_multiplier 12…...
服务器遭受DDoS攻击后如何恢复运行?
当服务器遭受 DDoS(分布式拒绝服务)攻击 后,恢复运行需要快速采取应急措施来缓解攻击影响,并在恢复后加强防护以减少未来攻击的风险。以下是详细的分步指南: 一、应急处理步骤 1. 确认服务器是否正在遭受 DDoS 攻击 …...
js原型、原型链和继承
文章目录 一、原型1、prototype2、constructor 二、原型链1、字面量原型链2、字面量继承3、构造函数的原型链4、Object.create5、Object.setPrototypeOf 三、继承1、构造函数继承2、原型链继承3、组合继承 四、常见链条1、Function2、Object.prototype 继承是指将特性从父代传递…...
看不见的彼方:交换空间——小菜一碟
有个蓝色的链接,先去看看两年前的题目的write up (https://github.com/USTC-Hackergame/hackergame2022-writeups/blob/master/official/%E7%9C%8B%E4%B8%8D%E8%A7%81%E7%9A%84%E5%BD%BC%E6%96%B9/README.md) 从别人的write up中了解到&…...
传奇996_38——称号系统
记住: 称号是装备,加属性的 特效是顶戴,加特效的 需要两个命令分开设置,称号和特效不关联 角色-称号栏显示的图标:由装备表字段,背包显示Looks控制,图片位置在:stab\res\private\t…...
C++:异常
---什么是异常? 异常是面向对象语法处理错误的一种方式。 ---C语言传统的处理错误的方式有哪些呢? 1.返回错误码,有些API接口都是把错误码放到errno中。 2.终止程序,比如发生越界等严重问题时,我们也可以主动调用exit…...
winScp连接Ubantu系统,访问拒绝的解决方式
一、原理分析 win10系统能够通过WinScp连接到Ubantu系统的前提是Ubantu系统开启ssh服务 二、解决步骤 1、Ubantu系统开启ssh服务 更新软件列表 sudo apt update安装OpenSSH服务器 sudo apt install openssh-server开启SSH服务 service sshd start到此,winScp…...
Oracle 建表的存储过程
建表的存储过程 下面是建表的存储过程,用途:通过不同的表,根据不同过滤条件,得到某个字段,例如neid,然后创建一个新表T,表T的表名为拼接XXXX_XXX_neid,表T的字段自行添加 xxx&…...
芯科科技率先支持Matter 1.4,推动智能家居迈向新高度
Matter 1.4引入核心增强功能、支持新设备类型,持续推进智能家居互联互通 近日,连接标准联盟(Connectivity Standard Alliance,CSA)发布了Matter 1.4标准版本。作为连接标准联盟的重要成员之一,以及Matter标…...
pandas快速解决空列表问题
在使用 Pandas 处理数据时,我们经常会遇到包含空列表(即空值或缺失值)的问题。Pandas 提供了一些非常有效的方法来处理这些空列表,使得数据清理和预处理变得更加简单和高效。 以下是一个示例,展示如何使用 Pandas 快速…...
sentinel使用手册
1.引入依赖 <dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-sentinel</artifactId></dependency>2.yaml spring:cloud:sentinel:transport:dashboard: localhost:8090 #sentinel控制台地址…...
【继承】—— 我与C++的不解之缘(十九)
前言: 面向对象编程语言的三大特性:封装、继承和多态 本篇博客来学习C中的继承,加油! 一、什么是继承? 继承(inheritance)机制是⾯向对象程序设计使代码可以复⽤的最重要的⼿段,它允许我们在保持原有类…...
腾讯微众银行大数据面试题(包含数据分析/挖掘方向)面试题及参考答案
为什么喜欢使用 XGBoost,XGBoost 的主要优势有哪些? XGBoost 是一个优化的分布式梯度增强库,在数据科学和机器学习领域应用广泛,深受喜爱,原因主要在于其众多突出优势。 首先,它的精度高,在许多机器学习竞赛和实际应用中,XGBoost 都展现出卓越的预测准确性。其基于决策…...
组合数练习题——c++
题目设置: 现在有x个相同的小球,分给y个人,每个人至少分k个,请问有多少种可能的分发方法,由于结果可能较大,答案对10^97取模。 输入格式: 一行3个整数:x,y, k…...
Java:JPMS模块化开发
JPMS(Java Platform Module System)简介 为什么用JPMS? JPMS(Java 平台模块系统)是 Java 9 引入的模块化系统,也称为 Jigsaw 项目。它为 Java 提供了更精细的模块化机制,用于组织和管理代码&a…...
Spring Boot中配置Flink的资源管理
在 Spring Boot 中配置 Flink 的资源管理,需要遵循以下步骤: 添加 Flink 依赖项 在你的 pom.xml 文件中,添加 Flink 和 Flink-connector-kafka 的依赖项。这里以 Flink 1.14 版本为例: <!-- Flink dependencies --><de…...
【ruby on rails】dup、deep_dup、clone的区别
一、区别 dup 浅复制:dup 方法创建对象的浅复制。 不复制冻结状态:dup 不会复制对象的冻结状态。 不复制单例方法:dup 不会复制对象的单例方法。 deep_dup 深复制:deep_dup 方法创建对象的深复制,递归复制嵌套的对象。…...
鸿蒙开发-HMS Kit能力集(应用内支付、推送服务)
1 应用内支付 开发步骤 步骤一:判断当前登录的华为账号所在服务地是否支持应用内支付 在使用应用内支付之前,您的应用需要向IAP Kit发送queryEnvironmentStatus请求,以此判断用户当前登录的华为帐号所在的服务地是否在IAP Kit支持结算的国…...
springboot中使用mongodb完成评论功能
pom文件中引入 <!-- mongodb --> <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-mongodb</artifactId> </dependency> yml中配置连接 data:mongodb:uri: mongodb://admin:1234561…...
南京仁品耳鼻喉专科医院:12月启动公益义诊月
专业医疗资源送至“家门口”!南京仁品耳鼻喉专科医院启动公益义诊月 随着2024年即将步入尾声,南京仁品耳鼻喉医院为回馈社会,提升公众健康福祉,将于12月隆重推出“三甲专家公益义诊月”活动。此次活动旨在通过汇聚众多耳鼻喉领域…...
微信小程序首页搜索框的实现教程
微信小程序首页搜索框的实现教程 前言 在现代移动应用中,搜索功能是用户获取信息的主要方式之一。对于购物小程序而言,提供一个美观且高效的搜索框,可以显著提升用户体验,帮助用户快速找到他们想要的商品。本文将详细介绍如何在微信小程序中实现一个样式优美的搜索框,包…...
Educational Codeforces Round 151 (Rated for Div. 2)
题目链接 B. Come Together 题意 输入 输出 思路 可以将B、C坐标作A的变换,将A平移至原点,然后分情况讨论: B、C两点都在轴上,具体分为同向轴和其他情况B、C两点都在象限中,具体分为相同象限、对角象限和相邻象限分别位于象限…...
第二十一天 深度学习简介
深度学习(Deep Learning,简称DL)是机器学习的一个分支,它通过构建和训练深层神经网络模型,从数据中学习和提取特征,以实现复杂任务的自动化处理和决策。以下是对深度学习的详细介绍: 一、起源与…...
mongodb/redis/neo4j 如何自己打造一个 web 数据库可视化客户端?
随笔 从千万粉丝“何同学”抄袭开源项目说起,为何纯技术死路一条? 数据源的统一与拆分 监控报警系统的指标、规则与执行闭环 我们的系统应该配置哪些监控报警项? 监控报警系统如何实现自监控? java 老矣,尚能饭否ÿ…...
elementUI如何dialog对话框 不设置 点击遮罩层 自动关闭的功能
背景 用户在填写dialog对话框的时候,有时候误触 遮罩层,导致form表单直接关闭,用户的信息丢失 代码 要使对话框在点击遮罩层时关闭,您需要在 el-dialog 组件上将 close-on-click-modal 属性设置为 false。以下是更新后的代码&…...
循环神经网络:从基础到应用的深度解析
🍛循环神经网络(RNN)概述 循环神经网络(Recurrent Neural Network, RNN)是一种能够处理时序数据或序列数据的深度学习模型。不同于传统的前馈神经网络,RNN具有内存单元,能够捕捉序列中前后信息…...
LeetCode 100.相同的树
题目: 给你两棵二叉树的根节点 p 和 q ,编写一个函数来检验这两棵树是否相同。 如果两个树在结构上相同,并且节点具有相同的值,则认为它们是相同的。 思路:灵神 代码: class Solution {public boolean…...
序列化与反序列化
序列化是将对象转换为可被存储或传输的格式,例如将对象转换为字节流或字符串。序列化的过程可以将对象的状态保存下来,以便在需要时可以重新创建对象。 反序列化则是将序列化的对象转换回原始的对象形式,以便可以使用和操作这些对象。 序列…...
spring boot打包fat jar
所谓fat jar就是包含所有依赖的jar以及其他开发的代码的jar包。可以通过java -jar xxx.jar直接启动运行,不需要部署到tomcat中间件就能运行。 接下来我们使用maven进行打包: (1)在需要带包的主模块的pom中添加build依赖…...
2021年美亚杯电子数据取证大赛-个人赛
资格赛-案件背景 2021年10月某日早上,本市一个名为"大路建设"的高速公路工地主管发现办公室的计算机被加密并无法开启,其后收到了勒索通知。考虑到高速公路的基建安全,主管决定报警。警方调查人员到达现场取证,发现办公…...
用 React 编写一个笔记应用程序
这篇文章会教大家用 React 编写一个笔记应用程序。用户可以创建、编辑、和切换 Markdown 笔记。 1. nanoid nanoid 是一个轻量级和安全的唯一字符串ID生成器,常用于JavaScript环境中生成随机、唯一的字符串ID,如数据库主键、会话ID、文件名等场景。 …...
泛型擦除是什么?
泛型擦除(Type Erasure)是Java编译器在编译泛型代码时的一种机制,它的目的是确保泛型能够与JAVA的旧版本(即不支持泛型的版本)兼容。泛型擦除会在编译时移除泛型类型信息,并将泛型类型替换为其非泛型的上限类型(通常是Object) 详细解释 在Java中&#…...
鸿蒙Next星河版基础代码
目录: 1、鸿蒙箭头函数的写法2、鸿蒙数据类型的定义3、枚举的定义以及使用4、position绝对定位及层级zIndex5、字符串的拼接转换以及数据的处理(1)字符串转数字(2)数字转字符串(3)布尔值转换情况(4)数组的增删改查 6、三元表达式7、鸿蒙for循环的几种写法7.1、基本用…...
物联网智能项目:智能家居系统的设计与实现
物联网(Internet of Things,IoT)技术正在迅速改变我们的生活方式,特别是在智能家居、工业自动化、环境监控等领域。物联网智能项目通过将设备、传感器、控制器等通过互联网连接,实现设备间的智能交互,带来高效、便捷和智能的体验。本文将介绍一个典型的物联网智能家居项目…...
STL算法之set相关算法
STL一共提供了四种与set(集合)相关的算法,分别是并集(union)、交集(intersection)、差集(difference)、对称差集(symmetric difference)。 目录 set_union set_itersection set_difference set_symmetric_difference 所谓set,可细分为数学上定义的和…...
STM32主要功能
STM32 是由意法半导体(STMicroelectronics)推出的一系列基于 ARM Cortex-M 内核的微控制器(MCU)。STM32 微控制器广泛应用于嵌入式系统中,因其高性能、低功耗、丰富的外设接口和多种封装形式而被广泛采用。其主要功能和…...
【数据结构】--ArrayList与顺序表
文章目录 1. 线性表2. 顺序表3. ArrayList简介4. MyArrayList的实现5. ArrayList使用5.1 ArrayList的构造5.2 ArrayList常见操作5.3 ArrayList的遍历5.4 ArrayList的扩容机制 6. ArrayList的具体使用6.1 简单的洗牌算法6.2 杨辉三角 1. 线性表 线性表(linear list&…...
多线程篇-3--java内存模型(主内存,共享内存,三大特性,指定重排)
Java内存模型 Java Memory Model,简称JMM,本身是一种抽象的概念,实际上并不存在,它描述的是一组规范,通过这组规范定义了程序中各个变量(包括实例字段,静态字段和构成数组对象的元素࿰…...
Android Studio的AI工具插件使用介绍
Android Studio的AI工具插件使用介绍 一、前言 Android Studio 的 AI 工具插件具有诸多重要作用,以下是一些常见的方面: 代码生成与自动补全 代码优化与重构 代码解读 学习与知识获取 智能搜索与资源推荐实际使用中可以添加注释,解读某段代…...
【Yarn Bug】 yarn 安装依赖出现的网络连接问题
最近,在初始化 Ant Design Pro 前端脚手架过程中,使用 yarn 安装依赖时遇到了网络连接问题,具体错误信息提示为 info There appears to be trouble with your network connection. Retrying...。通过百度查询,得知出现这种问题的原…...
Vue3的Setup语法动态获取Dom或调用子组件方法
官方文档:https://cn.vuejs.org/api/composition-api-setup.html#composition-api-setup 获取Dom <template><div class"todo" ref"todoDom" click"handleClick"></div> </template><script lang"t…...
中科院一区算法KO-K均值优化算法(K-means Optimizer)-附Matlab免费代码
首先,使用K-means算法在每次迭代中建立聚类区域的形心向量,然后KO提出两种移动策略,以在开发和探索能力之间建立平衡。每次迭代中探索或开发的移动策略的决定取决于一个参数,该参数将被设计为识别每个搜索代理是否在访问的区域中过…...
python数据可视化销量柱状图练习
需求: 假设某店铺的商品销量分为 线上销量 和 线下销量: 使用 叠加柱状图 分别显示线上和线下销量。 在柱状图中添加每种商品的总销量。 图表美观,包含图例、网格、颜色区分等。 代码实现: import matplotlib.pyplot as plt imp…...
甘特图全面指南:原理、制作与实际案例
甘特图(Gantt Chart)是一种用于项目管理的直观工具,以条形图的形式展示任务的时间进度和依赖关系。它通过简单明了的视觉效果帮助团队跟踪任务进展,分配资源并优化时间安排。本文将深入介绍甘特图的定义、制作方法,以及…...
如何创建 MySQL 数据库的副本 ?
MySQL 是一个广泛使用的开源数据库系统,它提供了多种数据库复制的方法。此功能对于确保跨不同环境的数据可用性和完整性至关重要。 管理 MySQL 数据库通常需要创建数据库的副本。这个任务被称为 MySQL 数据库复制,对于备份、测试、服务器迁移和其他关键…...
基于YOLO模型的目标检测与识别实现在ESP32-S3 EYE上全流程部署
前言 文章首发于 基于YOLO模型的目标检测与识别实现在ESP32-S3 EYE上全流程部署 文章目录 前言项目环境安装ESP-IDF安装开发环境运行环境 训练数据集准备添加自定义数据集 下载预训练模型训练 YOLO 模型模型量化和格式转换模型结果评估训练损失评估指标模型推理 模型部署部署环…...
2411C++,CXImage简单使用
介绍 CxImage是一个可非常简单快速的加载,保存,显示和转换图像的C类. 文件格式和链接的C库 Cximage对象基本上是加了一些成员变量来保存有用信息的一个位图: class CxImage{...protected:void* pDib; //包含标题,调色板,像素BITMAPINFOHEADER head; //标准头文件CXIMAGEINFO…...
Java对象与XML互相转换(xstream)
依赖 <dependency><groupId>com.thoughtworks.xstream</groupId><artifactId>xstream</artifactId><version>1.4.18</version></dependency> 实体类 package com.itheima.util;import lombok.AllArgsConstructor; import lom…...
计算机视觉工程师紧张学习中!
在当今这个日新月异的科技时代,计算机视觉作为人工智能的重要分支,正以前所未有的速度改变着我们的生活和工作方式。为了紧跟时代步伐,提升自我技能,一群怀揣梦想与热情的计算机视觉设计开发工程师们聚集在了本次线下培训活动中。…...
网关整合sentinel无法读取nacos配置问题分析
sentinel无法读取nacos配置问题分析 1.spring-cloud-gateway整合sentinel2.问题现象3.原因猜测4.源码分析4. 结语 最近公司需要上线一个集约项目,虽然为内网项目,但曾经有过内网被攻破,导致内部系统被攻击的案例,且集约系统同时在…...