no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
maxim_timer.c File Reference

Source file for Maxim timer platform driver. More...

#include "tmr.h"
#include "maxim_timer.h"
#include "no_os_error.h"
#include "no_os_util.h"
#include "no_os_alloc.h"
Include dependency graph for maxim_timer.c:

Functions

int max_timer_init (struct no_os_timer_desc **desc, const struct no_os_timer_init_param *param)
 Timer driver init function.
 
int max_timer_remove (struct no_os_timer_desc *desc)
 Timer driver remove function.
 
int max_timer_start (struct no_os_timer_desc *desc)
 Timer count start function.
 
int max_timer_stop (struct no_os_timer_desc *desc)
 Timer count stop function.
 
int max_timer_counter_get (struct no_os_timer_desc *desc, uint32_t *counter)
 Function to get the current timer counter value.
 
int max_timer_counter_set (struct no_os_timer_desc *desc, uint32_t new_val)
 Function to set the timer counter value.
 
int max_timer_count_clk_get (struct no_os_timer_desc *desc, uint32_t *freq_hz)
 Function to get the timer frequency.
 
int max_timer_count_clk_set (struct no_os_timer_desc *desc, uint32_t freq_hz)
 Function to set the timer frequency.
 
int max_get_elapsed_nsec (struct no_os_timer_desc *desc, uint64_t *elapsed_time)
 Not implemented.
 

Variables

const struct no_os_timer_platform_ops max_timer_ops
 maxim platform specific timer platform ops structure
 

Detailed Description

Source file for Maxim timer platform driver.

Author
Ciprian Regus (cipri.nosp@m.an.r.nosp@m.egus@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

Copyright 2022(c) Analog Devices, Inc.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

◆ max_get_elapsed_nsec()

int max_get_elapsed_nsec ( struct no_os_timer_desc * desc,
uint64_t * elapsed_time )

Not implemented.

Parameters
desc- timer descriptor
elapsed_time- time in nanoseconds
Returns
-ENOSYS

◆ max_timer_count_clk_get()

int max_timer_count_clk_get ( struct no_os_timer_desc * desc,
uint32_t * freq_hz )

Function to get the timer frequency.

Parameters
desc- timer descriptor
freq_hz- the timer frequency value
Returns
0 in case of success, -EINVAL otherwise.

◆ max_timer_count_clk_set()

int max_timer_count_clk_set ( struct no_os_timer_desc * desc,
uint32_t freq_hz )

Function to set the timer frequency.

Parameters
desc- timer descriptor.
freq_hz- the timer frequency value to be set.
Returns
0 in case of success, negative errno error codes otherwise.

◆ max_timer_counter_get()

int max_timer_counter_get ( struct no_os_timer_desc * desc,
uint32_t * counter )

Function to get the current timer counter value.

Parameters
desc- timer descriptor
counter- the timer counter value
Returns
0 in case of success, -EINVAL otherwise.

◆ max_timer_counter_set()

int max_timer_counter_set ( struct no_os_timer_desc * desc,
uint32_t new_val )

Function to set the timer counter value.

Parameters
desc- timer descriptor
new_val- timer counter value to be set
Returns
0 in case of success, -EINVAL otherwise.

◆ max_timer_init()

int max_timer_init ( struct no_os_timer_desc ** desc,
const struct no_os_timer_init_param * param )

Timer driver init function.

Parameters
desc- timer descriptor to be initialized
param- initialization parameter for the desc
Returns
0 in case of success, negative errno error codes otherwise.

◆ max_timer_remove()

int max_timer_remove ( struct no_os_timer_desc * desc)

Timer driver remove function.

Parameters
desc- timer descriptor
Returns
0 in case of success, -EINVAL otherwise.

◆ max_timer_start()

int max_timer_start ( struct no_os_timer_desc * desc)

Timer count start function.

Parameters
desc- timer descriptor
Returns
0 in case of success, -EINVAL otherwise.

◆ max_timer_stop()

int max_timer_stop ( struct no_os_timer_desc * desc)

Timer count stop function.

Parameters
desc- timer descriptor
Returns
0 in case of success, -EINVAL otherwise.

Variable Documentation

◆ max_timer_ops

const struct no_os_timer_platform_ops max_timer_ops
Initial value:
= {
.init = (int32_t (*)())max_timer_init,
.start = (int32_t (*)())max_timer_start,
.stop = (int32_t (*)())max_timer_stop,
.counter_get = (int32_t (*)())max_timer_counter_get,
.counter_set = (int32_t (*)())max_timer_counter_set,
.count_clk_get = (int32_t (*)())max_timer_count_clk_get,
.count_clk_set = (int32_t (*)())max_timer_count_clk_set,
.get_elapsed_time_nsec = (int32_t (*)())max_get_elapsed_nsec,
.remove = (int32_t (*)())max_timer_remove
}
int max_timer_start(struct no_os_timer_desc *desc)
Timer count start function.
Definition maxim_timer.c:168
int max_timer_stop(struct no_os_timer_desc *desc)
Timer count stop function.
Definition maxim_timer.c:183
int max_timer_count_clk_get(struct no_os_timer_desc *desc, uint32_t *freq_hz)
Function to get the timer frequency.
Definition maxim_timer.c:231
int max_timer_remove(struct no_os_timer_desc *desc)
Timer driver remove function.
Definition maxim_timer.c:151
int max_timer_counter_set(struct no_os_timer_desc *desc, uint32_t new_val)
Function to set the timer counter value.
Definition maxim_timer.c:215
int max_timer_counter_get(struct no_os_timer_desc *desc, uint32_t *counter)
Function to get the current timer counter value.
Definition maxim_timer.c:199
int max_timer_count_clk_set(struct no_os_timer_desc *desc, uint32_t freq_hz)
Function to set the timer frequency.
Definition maxim_timer.c:247
int max_get_elapsed_nsec(struct no_os_timer_desc *desc, uint64_t *elapsed_time)
Not implemented.
Definition maxim_timer.c:290
int max_timer_init(struct no_os_timer_desc **desc, const struct no_os_timer_init_param *param)
Timer driver init function.
Definition maxim_timer.c:90

maxim platform specific timer platform ops structure

Maxim specific timer platform ops.