no-OS
clk.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef CLK_H_
40 #define CLK_H_
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 #include <stdint.h>
46 
47 /******************************************************************************/
48 /************************* Structure Declarations *****************************/
49 /******************************************************************************/
50 struct clk_hw {
51  void *dev;
52  int32_t (*dev_clk_enable)();
53  int32_t (*dev_clk_disable)();
54  int32_t (*dev_clk_recalc_rate)();
55  int32_t (*dev_clk_set_rate)();
56  int32_t (*dev_clk_round_rate)();
57 };
58 
59 struct clk {
60  struct clk_hw *hw;
61  uint32_t hw_ch_num;
62  const char *name;
63 };
64 
65 /******************************************************************************/
66 /************************ Functions Declarations ******************************/
67 /******************************************************************************/
68 
69 /* Start the clock. */
70 int32_t clk_enable(struct clk * clk);
71 
72 /* Stop the clock. */
73 int32_t clk_disable(struct clk * clk);
74 
75 /* Get the current frequency of the clock. */
76 int32_t clk_recalc_rate(struct clk *clk,
77  uint64_t *rate);
78 
79 /* Round the desired frequency to a rate that the clock can actually output. */
80 int32_t clk_round_rate(struct clk *clk,
81  uint64_t rate,
82  uint64_t *rounded_rate);
83 
84 /* Change the frequency of the clock. */
85 int32_t clk_set_rate(struct clk *clk,
86  uint64_t rate);
87 
88 #endif // CLK_H_
clk::hw_ch_num
uint32_t hw_ch_num
Definition: clk.h:61
clk_set_rate
int32_t clk_set_rate(struct clk *clk, uint64_t rate)
clk_hw::dev_clk_set_rate
int32_t(* dev_clk_set_rate)()
Definition: clk.h:55
clk_disable
int32_t clk_disable(struct clk *clk)
clk::hw
struct clk_hw * hw
Definition: clk.h:60
clk_hw
Definition: clk.h:50
clk::name
const char * name
Definition: clk.h:62
clk_hw::dev_clk_enable
int32_t(* dev_clk_enable)()
Definition: clk.h:52
clk_hw::dev_clk_disable
int32_t(* dev_clk_disable)()
Definition: clk.h:53
clk_round_rate
int32_t clk_round_rate(struct clk *clk, uint64_t rate, uint64_t *rounded_rate)
clk
Definition: clk.h:59
clk_hw::dev
void * dev
Definition: clk.h:51
clk_hw::dev_clk_recalc_rate
int32_t(* dev_clk_recalc_rate)()
Definition: clk.h:54
clk_hw::dev_clk_round_rate
int32_t(* dev_clk_round_rate)()
Definition: clk.h:56
clk_recalc_rate
int32_t clk_recalc_rate(struct clk *clk, uint64_t *rate)
clk_enable
int32_t clk_enable(struct clk *clk)