Go to the source code of this file.
|
static int | nrf_clock_control_request (const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli) |
| Request a reservation to use a given clock with specified attributes.
|
|
int | nrf_clock_control_request_sync (const struct device *dev, const struct nrf_clock_spec *spec, k_timeout_t timeout) |
| Synchronously request a reservation to use a given clock with specified attributes.
|
|
static int | nrf_clock_control_release (const struct device *dev, const struct nrf_clock_spec *spec) |
| Release a reserved use of a clock.
|
|
static int | nrf_clock_control_cancel_or_release (const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli) |
| Safely cancel a reservation request.
|
|
static int | nrf_clock_control_resolve (const struct device *dev, const struct nrf_clock_spec *req_spec, struct nrf_clock_spec *res_spec) |
| Resolve a requested clock spec to resulting spec.
|
|
static int | nrf_clock_control_get_startup_time (const struct device *dev, const struct nrf_clock_spec *spec, uint32_t *startup_time_us) |
| Get the startup time of a clock.
|
|
void | nrf_clock_control_hfxo_request (void) |
| Request the HFXO from Zero Latency Interrupt context.
|
|
void | nrf_clock_control_hfxo_release (void) |
| Release the HFXO from Zero Latency Interrupt context.
|
|
◆ NRF_CLOCK_CONTROL_ACCURACY_MAX
#define NRF_CLOCK_CONTROL_ACCURACY_MAX 1 |
◆ NRF_CLOCK_CONTROL_ACCURACY_PPM
#define NRF_CLOCK_CONTROL_ACCURACY_PPM |
( |
| ppm | ) |
|
◆ NRF_CLOCK_CONTROL_FREQUENCY_MAX
#define NRF_CLOCK_CONTROL_FREQUENCY_MAX UINT32_MAX |
◆ NRF_CLOCK_CONTROL_PRECISION_DEFAULT
#define NRF_CLOCK_CONTROL_PRECISION_DEFAULT 0 |
◆ NRF_CLOCK_CONTROL_PRECISION_HIGH
#define NRF_CLOCK_CONTROL_PRECISION_HIGH 1 |
◆ nrf_clock_control_cancel_or_release()
Safely cancel a reservation request.
It may be that a client has issued a reservation request but needs to shut down before the request has completed. This function attempts to cancel the request and issues a release if cancellation fails because the request was completed. This synchronously ensures that ownership data reverts to the client so is available for a future request.
- Parameters
-
dev | pointer to the clock device structure. |
spec | the same specification of the clock attributes that was used in the reservation request. |
cli | a pointer to the same client state that was provided when the operation to be cancelled was issued. |
- Return values
-
ONOFF_STATE_TO_ON | if the cancellation occurred before the transition completed. |
ONOFF_STATE_ON | if the cancellation occurred after the transition completed. |
-EINVAL | if the parameters are invalid. |
negative | other errors produced by onoff_release(). |
◆ nrf_clock_control_get_startup_time()
Get the startup time of a clock.
- Parameters
-
dev | Device structure. |
spec | Clock specification to get startup time for. |
startup_time_us | Destination for startup time in microseconds. |
- Return values
-
Successful | if successful. |
-errno | code if failure. |
◆ nrf_clock_control_hfxo_release()
void nrf_clock_control_hfxo_release |
( |
void | | ) |
|
Release the HFXO from Zero Latency Interrupt context.
Function is optimized for use in Zero Latency Interrupt context.
Calls to this function must be coupled with prior calls to nrf_clock_control_hfxo_request(), because it uses basic reference counting to make sure the HFXO is released when there are no more pending requests.
◆ nrf_clock_control_hfxo_request()
void nrf_clock_control_hfxo_request |
( |
void | | ) |
|
Request the HFXO from Zero Latency Interrupt context.
Function is optimized for use in Zero Latency Interrupt context. It does not give notification when the HFXO is ready, so each user must put the request early enough to make sure the HFXO ramp-up has finished on time.
This function uses reference counting so the caller must ensure that every nrf_clock_control_hfxo_request() call has a matching nrf_clock_control_hfxo_release() call.
◆ nrf_clock_control_release()
static int nrf_clock_control_release |
( |
const struct device * | dev, |
|
|
const struct nrf_clock_spec * | spec ) |
|
inlinestatic |
Release a reserved use of a clock.
- Parameters
-
dev | pointer to the clock device structure. |
spec | the same specification of the clock attributes that was used in the reservation request (so that the clock control module can keep track of what attributes are still requested). |
- Return values
-
non-negative | the observed state of the on-off service associated with the clock machine at the time the request was processed (see onoff_release()), if successful. |
-EIO | if service has recorded an error. |
-ENOTSUP | if the service is not in a state that permits release. |
◆ nrf_clock_control_request()
Request a reservation to use a given clock with specified attributes.
The return value indicates the success or failure of an attempt to initiate an operation to request the clock be made available. If initiation of the operation succeeds, the result of the request operation is provided through the configured client notification method, possibly before this call returns.
Note that the call to this function may succeed in a case where the actual request fails. Always check the operation completion result.
- Parameters
-
dev | pointer to the clock device structure. |
spec | specification of minimal acceptable attributes, like frequency, accuracy, and precision, required for the clock. Value of 0 has the meaning of "default" and can be passed instead of a given attribute if there is no strict requirement in this regard. If there is no specific requirement for any of the attributes, this parameter can be NULL. |
cli | pointer to client state providing instructions on synchronous expectations and how to notify the client when the request completes. Behavior is undefined if client passes a pointer object associated with an incomplete service operation. |
- Return values
-
non-negative | the observed state of the on-off service associated with the clock machine at the time the request was processed (see onoff_request()), if successful. |
-EIO | if service has recorded an error. |
-EINVAL | if the function parameters are invalid or the clock attributes cannot be provided (e.g. the requested accuracy is unavailable). |
-EAGAIN | if the reference count would overflow. |
◆ nrf_clock_control_request_sync()
Synchronously request a reservation to use a given clock with specified attributes.
Function can only be called from thread context as it blocks until request is completed.
- See also
- nrf_clock_control_request().
- Parameters
-
- Return values
-
0 | if request is fulfilled. |
-EWOULDBLOCK | if request is called from the interrupt context. |
negative | See error codes returned by nrf_clock_control_request(). |
◆ nrf_clock_control_resolve()
Resolve a requested clock spec to resulting spec.
- Parameters
-
dev | Device structure. |
req_spec | The requested clock specification. |
res_spec | Destination for the resulting clock specification. |
- Return values
-
Successful | if successful. |
-errno | code if failure |