no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
no_os_clk.h
Go to the documentation of this file.
1/***************************************************************************/
33#ifndef _NO_OS_CLK_H_
34#define _NO_OS_CLK_H_
35
36#include <stdint.h>
37
40 const char *name;
42 uint8_t hw_ch_num;
46 void *dev_desc;
47};
48
50 void *dev;
51 int32_t (*dev_clk_enable)();
52 int32_t (*dev_clk_disable)();
53 int32_t (*dev_clk_recalc_rate)();
54 int32_t (*dev_clk_set_rate)();
55 int32_t (*dev_clk_round_rate)();
56};
57
58struct no_os_clk {
60 uint32_t hw_ch_num;
61 const char *name;
62 const struct no_os_clk_desc *clk_desc;
63};
64
69typedef struct no_os_clk_desc {
71 const char *name;
73 uint8_t hw_ch_num;
77 void *dev_desc;
79
87 int (*init)(struct no_os_clk_desc **, const struct no_os_clk_init_param *);
89 int (*clk_enable)(struct no_os_clk_desc *);
91 int (*clk_disable)(struct no_os_clk_desc *);
93 int (*clk_recalc_rate)(struct no_os_clk_desc *, uint64_t *);
94 /* Round the desired frequency to a rate that CLK can actually output. */
95 int (*clk_round_rate)(struct no_os_clk_desc *, uint64_t, uint64_t *);
96 /* Change CLK frequency function pointer. */
97 int (*clk_set_rate)(struct no_os_clk_desc *, uint64_t);
99 int (*remove)(struct no_os_clk_desc *);
100};
101
102/* Initialize CLK ops. */
103int32_t no_os_clk_init(struct no_os_clk_desc **desc,
104 const struct no_os_clk_init_param *param);
105
106/* Free the resources allocated by no_os_clk_init(). */
107int32_t no_os_clk_remove(struct no_os_clk_desc *desc);
108
109/* Start the clock. */
110int32_t no_os_clk_enable(struct no_os_clk_desc *desc);
111
112/* Stop the clock. */
113int32_t no_os_clk_disable(struct no_os_clk_desc *desc);
114
115/* Get the current frequency of the clock. */
117 uint64_t *rate);
118
119/* Round the desired frequency to a rate that the clock can actually output. */
121 uint64_t rate,
122 uint64_t *rounded_rate);
123
124/* Change the frequency of the clock. */
126 uint64_t rate);
127
128#endif // _NO_OS_CLK_H_
int32_t no_os_clk_init(struct no_os_clk_desc **desc, const struct no_os_clk_init_param *param)
int32_t no_os_clk_remove(struct no_os_clk_desc *desc)
int32_t no_os_clk_disable(struct no_os_clk_desc *desc)
int32_t no_os_clk_recalc_rate(struct no_os_clk_desc *desc, uint64_t *rate)
int32_t no_os_clk_set_rate(struct no_os_clk_desc *desc, uint64_t rate)
int32_t no_os_clk_enable(struct no_os_clk_desc *desc)
int32_t no_os_clk_round_rate(struct no_os_clk_desc *desc, uint64_t rate, uint64_t *rounded_rate)
Structure holding CLK descriptor.
Definition no_os_clk.h:69
void * dev_desc
Definition no_os_clk.h:77
const struct no_os_clk_platform_ops * platform_ops
Definition no_os_clk.h:75
uint8_t hw_ch_num
Definition no_os_clk.h:73
const char * name
Definition no_os_clk.h:71
Definition no_os_clk.h:49
int32_t(* dev_clk_disable)()
Definition no_os_clk.h:52
int32_t(* dev_clk_round_rate)()
Definition no_os_clk.h:55
int32_t(* dev_clk_set_rate)()
Definition no_os_clk.h:54
int32_t(* dev_clk_recalc_rate)()
Definition no_os_clk.h:53
int32_t(* dev_clk_enable)()
Definition no_os_clk.h:51
void * dev
Definition no_os_clk.h:50
Definition no_os_clk.h:38
uint8_t hw_ch_num
Definition no_os_clk.h:42
const char * name
Definition no_os_clk.h:40
const struct no_os_clk_platform_ops * platform_ops
Definition no_os_clk.h:44
void * dev_desc
Definition no_os_clk.h:46
Structure holding CLK function pointers that point to the platform specific function.
Definition no_os_clk.h:85
int(* clk_enable)(struct no_os_clk_desc *)
Definition no_os_clk.h:89
int(* clk_round_rate)(struct no_os_clk_desc *, uint64_t, uint64_t *)
Definition no_os_clk.h:95
int(* clk_set_rate)(struct no_os_clk_desc *, uint64_t)
Definition no_os_clk.h:97
int(* remove)(struct no_os_clk_desc *)
Definition no_os_clk.h:99
int(* clk_disable)(struct no_os_clk_desc *)
Definition no_os_clk.h:91
int(* clk_recalc_rate)(struct no_os_clk_desc *, uint64_t *)
Definition no_os_clk.h:93
int(* init)(struct no_os_clk_desc **, const struct no_os_clk_init_param *)
Definition no_os_clk.h:87
Definition no_os_clk.h:58
const char * name
Definition no_os_clk.h:61
struct no_os_clk_hw * hw
Definition no_os_clk.h:59
const struct no_os_clk_desc * clk_desc
Definition no_os_clk.h:62
uint32_t hw_ch_num
Definition no_os_clk.h:60