首页 \ 问答 \ 如何在linux内核设备树中定义时钟多路复用器(How to define a clock multiplexer in a linux kernel device tree)

如何在linux内核设备树中定义时钟多路复用器(How to define a clock multiplexer in a linux kernel device tree)

我正在编写Linux设备驱动程序,需要在设备树文件中定义以下时钟树:

linux,通用时钟框架,时钟树

注意:在多路复用器中选择振荡器是通过将gpio输出拉高或拉低来完成的。 时钟发生器通过I2C编程。

这是我到目前为止的一个例子:

clocks {
    /* fixed clock oscillators */
    osc22: oscillator22 {
        compatible = "fixed-clock";
        #clock-cells = <0>;
        clock-frequency = <22579200>;
    };

    osc24: oscillator24 {
        compatible = "fixed-clock";
        #clock-cells = <0>;
        clock-frequency = <24576000>;
    };

    /* clock multiplexer
     * I'm afraid the following is not going to work :( ?
     */
    mux: multiplexer {
        compatible = "mux-clock";     /* <-------- ??? */
        clocks = <&osc22>, <&osc24>;  /* parent clocks */
    };
};

i2c1 {
    /* clock generator */
    si5351: si5351c@60 {
        #address-cells = <1>;
        #size-cells = <0>;
        #clock-cells = <1>;
        compatible = "silabs,si5351c";
        reg = <0x60>;
        clocks = <0>, <&mux>;
        clock-names = "xtal", "clkin";
        status = "okay";

        clkout0 {
            reg = <0>;
            silabs,disable-state = <2>;
            silabs,clock-source = <3>;
        };
    };
};

参考文献

如何在设备树中定义简单的gpio控制时钟多路复用器?


I am writing a linux device driver and need to define the following clock-tree in a device tree file:

linux, common clock framework, clock tree

Note: Selecting an oscillator in the multiplexer is done by pulling an gpio output high or low. The clock generator is programmed via I2C.

Here is an example of what I have so far:

clocks {
    /* fixed clock oscillators */
    osc22: oscillator22 {
        compatible = "fixed-clock";
        #clock-cells = <0>;
        clock-frequency = <22579200>;
    };

    osc24: oscillator24 {
        compatible = "fixed-clock";
        #clock-cells = <0>;
        clock-frequency = <24576000>;
    };

    /* clock multiplexer
     * I'm afraid the following is not going to work :( ?
     */
    mux: multiplexer {
        compatible = "mux-clock";     /* <-------- ??? */
        clocks = <&osc22>, <&osc24>;  /* parent clocks */
    };
};

i2c1 {
    /* clock generator */
    si5351: si5351c@60 {
        #address-cells = <1>;
        #size-cells = <0>;
        #clock-cells = <1>;
        compatible = "silabs,si5351c";
        reg = <0x60>;
        clocks = <0>, <&mux>;
        clock-names = "xtal", "clkin";
        status = "okay";

        clkout0 {
            reg = <0>;
            silabs,disable-state = <2>;
            silabs,clock-source = <3>;
        };
    };
};

References:

How do I define a simple gpio-controlled clock multiplexer in a device tree?


原文:https://stackoverflow.com/questions/29153415
更新时间:2023-09-25 20:09

最满意答案

cblas_sdot函数不应该返回指针。

来自BLAS参考

cblas_sdot

计算两个向量的点积(单精度)。

float cblas_sdot(const int N, const float *X, const int incX, const float *Y, const int incY);


The cblas_sdot function is not supposed to return a pointer.

From BLAS Reference:

cblas_sdot

Computes the dot product of two vectors (single-precision).

float cblas_sdot(const int N, const float *X, const int incX, const float *Y, const int incY);

相关问答

更多
  • 那么,方法只是常规函数,正如克里斯所说, self参数与Self类型有着隐含的联系。 用你的例子(稍加修改)使用C代码中的函数应该很简单: #[repr(C)] pub struct A { id: u32, } #[no_mangle] pub extern fn new_a(id: u32) -> A { A { id: id } } impl A { #[no_mangle] pub extern fn some_funct(&self) { println ...
  • 这是不可能的,我不认为将来有可能。 C宏带来了太多问题。 如果你想在你的Rust源码上运行cpp ,你可以手动完成。 如果你不想这样做,并且如果有很多常量,并且你也不想将它们的值从C代码复制到Rust,你可以创建一个C封装器,它将为这些值提供全局变量: #define INIT_FLAG 0x00000001 ... const int init_flag = INIT_FLAG; 你编译这个文件,从它创建一个静态库并像往常一样链接到它: $ gcc -c init_flag.c $ ar r lib ...
  • 请注意, rustbindgen以与C中一样多的安全性生成与C union绑定; 因此,在打电话时: event.xkey(); // gets the C union 'xkey' field 没有运行时检查xkey是当前包含值的字段。 这是因为由于C没有标记union (即union知道当前正在使用哪个字段),开发人员想出了各种编码此信息的方式(*),我知道这两种方式是: 外部供应商; 通常是union之前结构的另一个领域 union中每个结构的第一个领域 在这里,你在后一种情况下int type; ...
  • 您需要将实际模式传递给if let (与Swift之类的语言不同,特殊情况if let Option类型): if let Some(doc) = xml::parse_file("filename") { doc.simple_function(); } You need to pass the actual pattern to if let (unlike languages like Swift which special case if let for Option types): if ...
  • 感谢JJ Hakala的回答 ,我能够用纯Rust生产MCVE : extern crate libc; use std::ffi::CString; use libc::c_void; fn encode_coordinates(coordinates: &Vec<[f64; 2]>) -> String { format!("Encoded coordinates {:?}", coordinates) } struct Array { data: *const c_void, ...
  • CString不仅是一个指针, 它是一个指针加上一个布尔值 ,表示CString拥有C字符串。 因此,您的Lua代码中的声明与Rust代码中的定义不符。 通过在CString上使用*mut c_char方法返回*const c_char或a *mut c_char 。 如果你的函数返回一个动态分配的字符串,你还需要提供一个函数来释放Lua代码需要手动调用的字符串,否则会导致内存泄漏。 A CString isn't only a pointer; it's a pointer plus a boolean ...
  • 阿德里安指出的问题是我正在向Vec推进弦乐。 FFI需要*const libc::c_char ,它可以从String转换。 let mut urls: Vec<*const libc::c_char> = vec![]; urls.push(CString::new(string_var.value.to_string()).unwrap().into_raw()); The issue, pointed out by Adrian, was that I was pushing strings in ...
  • Rust不支持使用C ++的FFI。 如果要使用此库,则必须查找或编写一个转换层,该转换层为库提供纯C接口,然后绑定到该库。 Rust doesn't support FFI with C++. If you want to use this library, you will have to find or write a translation layer that provides a pure C interface to the library, then bind to that.
  • use std::os::raw::c_void; extern "C" { #[no_mangle] static magic: *const c_void; } 可选地,在extern之前可以有#[link(kind="static", name="")]来获得实际链接的符号。 这个常量被声明为static ,但是使用const关键字它会失败,“extern items不能是const ”。 ¯\ _(ツ)_ /¯ use std::os::raw:: ...
  • cblas_sdot函数不应该返回指针。 来自BLAS参考 : cblas_sdot 计算两个向量的点积(单精度)。 float cblas_sdot(const int N, const float *X, const int incX, const float *Y, const int incY); The cblas_sdot function is not supposed to return a pointer. From BLAS Reference: cblas_sdot Computes ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。