MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / clk_alloc

Function clk_alloc

components/drivers/clk/clk.c:80–99  ·  view source on GitHub ↗

* @brief Allocate memory space for struct clock and return it * * @param clk_np point to clock node * @param dev_id device identifier for the clock * @param con_id connection identifier for the clock * @param fw_node point to the firmware node associated with the clock * * @return struct rt_clk* point to clock */

Source from the content-addressed store, hash-verified

78 * @return struct rt_clk* point to clock
79 */
80static struct rt_clk *clk_alloc(struct rt_clk_node *clk_np, const char *dev_id,
81 const char *con_id, void *fw_node)
82{
83 struct rt_clk *clk = rt_calloc(1, sizeof(*clk));
84
85 if (clk)
86 {
87 clk->clk_np = clk_np;
88 clk->dev_id = dev_id;
89 clk->con_id = con_id;
90
91 clk->fw_node = fw_node;
92 }
93 else
94 {
95 clk = rt_err_ptr(-RT_ENOMEM);
96 }
97
98 return clk;
99}
100
101/**
102 * @brief Free memory space of clock object

Callers 2

clk_createFunction · 0.85
rt_clk_registerFunction · 0.85

Calls 1

rt_callocFunction · 0.85

Tested by

no test coverage detected