hwitag_find_clkfreq()

QNX SDP8.0C Library ReferenceAPIDeveloper

Find the clock source for a device

Synopsis:

#include <drvr/hwinfo.h>

long hwitag_find_clkfreq( unsigned hwi_off,
                          unsigned *clk_idx);

Arguments:

hwi_off
The offset into the hwinfo section of the system page for the device, which you can get by calling hwi_find_device().
clk_idx
NULL, or a pointer to a location that holds the index of the clock frequency that you want to find; see below.

Library:

libdrvr

Use the -l drvr option to qcc to link against this library.

Description:

You can use hwitag_find_clkfreq() to find one or more clock sources associated with the device at hwi_off in the hwinfo section of the system page.

Some devices contain clock sources vectors. You can retrieve the base frequency for all of them by using the clk_idx parameter as follows:

  • On the first call, set *clk_idx to 0. The first clock frequency (if one exists) is returned.
  • You can then continue to call hwitag_find_clkfreq() with the same arguments until the function returns -1.
  • If you know that there's more than one clock source for the specified device, you can set *clk_idx to the number of the desired clock. If that clock exists, hwitag_find_clkfreq() returns the base frequency. For example, to obtain the third clock frequency for hwi_off, set *clk_idx to 2 (base-0 indexing applies).
  • If you're interested only in the first clock, you can pass NULL for clk_idx (which is the same as setting *clk_idx to 0).

Returns:

The clock source frequency in Hz, or -1 if the clock source wasn't found.

Classification:

QNX OS

Safety:
Cancellation pointNo
Signal handlerNo
ThreadYes
Page updated: