no-OS
Macros | Functions
adf4153.c File Reference
#include <stdlib.h>
#include "adf4153.h"
Include dependency graph for adf4153.c:

Macros

#define CEIL(a, b)   (((a) / (b)) + (((a) % (b)) > 0 ? 1 : 0))
 
#define DATA_MASK_MSB8   0xFF0000
 
#define DATA_OFFSET_MSB8   16
 
#define DATA_MASK_MID8   0xFF00
 
#define DATA_OFFSET_MID8   8
 
#define DATA_MASK_LSB8   0xFF
 
#define DATA_OFFSET_LSB8   0
 
#define ADDRESS_MASK   3
 
#define FREQ_2_GHZ   2000000000
 

Functions

int8_t adf4153_init (struct adf4153_dev **device, struct adf4153_init_param init_param)
 Initialize SPI and Initial Values for ADF4106 Board. More...
 
int32_t adf4153_remove (struct adf4153_dev *dev)
 Free the resources allocated by adf4153_init(). More...
 
void adf4153_update_latch (struct adf4153_dev *dev, uint32_t latch_data)
 Update one of the latch via the SPI interface. More...
 
uint32_t adf4153_read_latch (struct adf4153_dev *dev, uint8_t latch_type)
 Return the value of a desired latch. More...
 
uint32_t adf4153_tune_rcounter (struct adf4153_dev *dev, uint16_t *r_counter)
 Increases the R counter value until the ADF4106_PDF_MAX_FREQ is greater than PFD frequency. More...
 
uint64_t adf4153_set_frequency (struct adf4153_dev *dev, uint64_t frequency)
 Sets the output frequency. More...
 
uint32_t adf4153_get_channel_spacing (struct adf4153_dev *dev)
 Return the value of the channel spacing. More...
 

Macro Definition Documentation

◆ ADDRESS_MASK

#define ADDRESS_MASK   3

◆ CEIL

#define CEIL (   a,
 
)    (((a) / (b)) + (((a) % (b)) > 0 ? 1 : 0))

◆ DATA_MASK_LSB8

#define DATA_MASK_LSB8   0xFF

◆ DATA_MASK_MID8

#define DATA_MASK_MID8   0xFF00

◆ DATA_MASK_MSB8

#define DATA_MASK_MSB8   0xFF0000

◆ DATA_OFFSET_LSB8

#define DATA_OFFSET_LSB8   0

◆ DATA_OFFSET_MID8

#define DATA_OFFSET_MID8   8

◆ DATA_OFFSET_MSB8

#define DATA_OFFSET_MSB8   16

◆ FREQ_2_GHZ

#define FREQ_2_GHZ   2000000000

Function Documentation

◆ adf4153_get_channel_spacing()

uint32_t adf4153_get_channel_spacing ( struct adf4153_dev dev)

Return the value of the channel spacing.

Parameters
dev- The device structure.
Returns
calculatedFrequency - The actual frequency value that was set.

◆ adf4153_init()

int8_t adf4153_init ( struct adf4153_dev **  device,
struct adf4153_init_param  init_param 
)

Initialize SPI and Initial Values for ADF4106 Board.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
success

◆ adf4153_read_latch()

uint32_t adf4153_read_latch ( struct adf4153_dev dev,
uint8_t  latch_type 
)

Return the value of a desired latch.

Parameters
dev- The device structure.
latch_type- the type of the latch: 0 - 'ADF4153_CTRL_N_DIVIDER' 1 - 'ADF4153_CTRL_R_DIVIDER' 2 - 'ADF4153_CTRL_CONTROL' 3 - 'ADF4153_CTRL_NOISE_SPUR'
Returns
latchValue - the value of the desired latch

◆ adf4153_remove()

int32_t adf4153_remove ( struct adf4153_dev dev)

Free the resources allocated by adf4153_init().

Parameters
dev- The device structure.
Returns
SUCCESS in case of success, negative error code otherwise.

◆ adf4153_set_frequency()

uint64_t adf4153_set_frequency ( struct adf4153_dev dev,
uint64_t  frequency 
)

Sets the output frequency.

Parameters
dev- The device structure.
frequency- The desired frequency value.
Returns
calculatedFrequency - The actual frequency value that was set.

◆ adf4153_tune_rcounter()

uint32_t adf4153_tune_rcounter ( struct adf4153_dev dev,
uint16_t *  r_counter 
)

Increases the R counter value until the ADF4106_PDF_MAX_FREQ is greater than PFD frequency.

Parameters
dev- The device structure.
r_counter- pointer of the R counter variable.
Returns
pfdFrequency - The value of the PFD frequency.
Here is the caller graph for this function:

◆ adf4153_update_latch()

void adf4153_update_latch ( struct adf4153_dev dev,
uint32_t  latch_data 
)

Update one of the latch via the SPI interface.

Parameters
dev- The device structure.
latch_data- the data which will be written to the latch
Returns
Here is the caller graph for this function: