dnx RTOS 2.2.0 "Eagle"
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
CLK Driver

Detailed Description


Driver handles system clock peripheral (PLL).

Supported architectures


Meaning of major and minor numbers

There is no special meaning of major and minor numbers. Both numbers should be set to 0.

Numeration restrictions

Both driver numbers should be set to 0.

Driver initialization

To initialize driver the following code can be used:

driver_init("CLK", 0, 0, "/dev/clk");

Driver release

To release driver the following code can be used:

driver_release("CLK", 0, 0);

Driver configuration

Driver can be configured only in configuration tool. Runtime configuration is not possible.

Data write

Write operation is not supported.

Data read

Read operation is not supported.

Getting clock frequencies

The clock frequencies and clock names can be explored by ioctl() function. Example:

// ...
FILE *clk = fopen("/dev/clk", "r+");
if (clk) {
CLK_info_t clkinf;
clkinf.iterator = 0;
while ( (ioctl(fileno(clk), IOCTL_CLK__GET_CLK_INFO, &clkinf) == 0)
&& (clkinf.name != NULL) ) {
printf("Clock '%s': %d Hz\n", clkinf.name, clkinf.freq_Hz);
} else {
// ...

Data Structures

struct  CLK_info_t


#define IOCTL_CLK__GET_CLK_INFO   _IOWR(CLK, 0x00, CLK_info_t*)
 Get frequency and name of selected clock [Hz]. More...

Data Structure Documentation

struct CLK_info_t

Type represent clock info object (iterator).

Data Fields
u32_t freq_Hz

[OUT] Clock frequency in Hz

u8_t iterator

[IN] Clock iterator (starts from 0, auto incremented)

const char * name

[OUT] Clock name (NULL if clock does not exist – end of iteration)

Macro Definition Documentation

#define IOCTL_CLK__GET_CLK_INFO   _IOWR(CLK, 0x00, CLK_info_t*)
[WR,RD]CLK_info_t * clock information.
On success 0 is returned, otherwise -1.