no-OS
|
Header file of ADF4157 Driver for Microblaze processor. More...
Go to the source code of this file.
Classes | |
struct | adf4157_platform_data |
struct | adf4157_state |
struct | adf4157_dev |
struct | adf4157_init_param |
Macros | |
#define | ADF4157_MUXOUT_Z (0x00 << 27) |
#define | ADF4157_MUXOUT_DVdd (0x01 << 27) |
#define | ADF4157_MUXOUT_DGND (0x02 << 27) |
#define | ADF4157_MUXOUT_RDIV (0x03 << 27) |
#define | ADF4157_MUXOUT_NDIV (0x04 << 27) |
#define | ADF4157_MUXOUT_ALOCK (0x05 << 27) |
#define | ADF4157_MUXOUT_DLOCK (0x06 << 27) |
#define | ADF4157_MUXOUT_SDO (0x07 << 27) |
#define | ADF4157_MUXOUT_CLKDIV (0x0A << 27) |
#define | ADF4157_MUXOUT_FLS (0x0C << 27) |
#define | ADF4157_MUXOUT_RDIV2 (0x0D << 27) |
#define | ADF4157_MUXOUT_NDIV2 (0x0E << 27) |
#define | ADF4157_MUXOUT_RESERVED (0x0F << 27) |
#define | ADF4157_INT_VAL(x) ((x & 0xFFF) << 15) |
#define | ADF4157_FRAC_VAL_MSB(x) ((x & 0x1FFE000) >> 10) |
#define | ADF4157_R0_CTRL 0x00 |
#define | ADF4157_FRAC_VAL_LSB(x) ((x & 0x1FFF) << 15) |
#define | ADF4157_R1_CTRL 0x01 |
#define | ADF4157_LOW_NOISE (0x00 << 29) |
#define | ADF4157_LOW_SPUR (0x03 << 29) |
#define | ADF4157_CSR_EN(x) ((x & 0x1) << 28) |
#define | ADF4157_CURR_SET(x) ((x & 0xF) << 24) |
#define | ADF4157_PRESCALER(x) ((x & 0x1) << 22) |
#define | ADF4157_RDIV2(x) ((x & 0x1) << 21) |
#define | ADF4157_REF_DBL(x) ((x & 0x1) << 20) |
#define | ADF4157_R_CNT(x) ((x & 0x1F) << 15) |
#define | ADF4157_R2_CTRL 0x02 |
#define | ADF4157_SIG_DEL_RST(x) ((x & 0x1) << 14) |
#define | ADF4157_LDP(x) ((x & 0x1) << 7) |
#define | ADF4157_PD_POL(x) ((x & 0x1) << 6) |
#define | ADF4157_PD ((x & 0x1) << 5) |
#define | ADF4157_CP_Z(x) ((x & 0x1) << 4) |
#define | ADF4157_CNT_RST(x) ((x & 0x1) << 3) |
#define | ADF4157_R3_CTRL 0x03 |
#define | ADF4157_NEG_BLEED_CUR(x) ((x && 0x3) << 23) |
#define | ADF4157_CLK_DIV_OFF (0x00 << 19) |
#define | ADF4157_CLK_FAST_LOCK (0x01 << 19) |
#define | ADF4157_CLK_RESYNC_EN (0x02 << 19) |
#define | ADF4157_CLK_DIV_VAL(x) ((x & 0xFFF) << 7) |
#define | ADF4157_R4_CTRL 0x04 |
#define | ADF4157_LE_OUT |
#define | ADF4157_LE_LOW |
#define | ADF4157_LE_HIGH |
#define | ADF4157_MUX_OUT |
#define | ADF4157_MUX_LOW |
#define | ADF4157_MUX_HIGH |
#define | ADF4157_CE_OUT |
#define | ADF4157_CE_LOW |
#define | ADF4157_CE_HIGH |
#define | ADF4157_LE2_OUT |
#define | ADF4157_LE2_LOW |
#define | ADF4157_LE2_HIGH |
#define | ADF4157_CE2_OUT |
#define | ADF4157_CE2_LOW |
#define | ADF4157_CE2_HIGH |
#define | ADF4157_MAX_OUT_FREQ 6000 /* MHz */ |
#define | ADF4157_MIN_OUT_FREQ 500 /* MHz */ |
#define | ADF4157_MAX_FREQ_45_PRESC 3000 /* MHz */ |
#define | ADF4157_MAX_FREQ_PFD 32000000 /* Hz */ |
#define | ADF4157_MAX_FREQ_REFIN 300000000 /* Hz */ |
#define | ADF4157_MIN_FREQ_REFIN 10000000 /* Hz */ |
#define | ADF4157_FIXED_MODULUS 33554432 /* 2^25 */ |
#define | ADF4157_MAX_R_CNT 32 |
#define | ADF4157_MAX_REG_VAL 0x1FFFFFFF |
#define | ADF4157_REG0 0 |
#define | ADF4157_REG1 1 |
#define | ADF4157_REG2 2 |
#define | ADF4157_REG3 3 |
#define | ADF4157_REG4 4 |
Functions | |
int8_t | adf4157_init (struct adf4157_dev **device, struct adf4157_init_param init_param) |
Initialize the SPI communication with the device. More... | |
int32_t | adf4157_remove (struct adf4157_dev *dev) |
Free the resources allocated by adf4157_init(). More... | |
int8_t | adf4157_set (struct adf4157_dev *dev, uint32_t value) |
Transmits 32 bits on SPI. More... | |
int32_t | adf4157_tune_r_cnt (struct adf4157_dev *dev, int32_t r_cnt) |
Increases the R counter value until the PFD frequency is smaller than ADF4351_MAX_FREQ_PFD. More... | |
uint32_t | gcd (uint32_t x, uint32_t y) |
Computes the greatest common divider of two numbers. More... | |
double | adf4157_set_freq (struct adf4157_dev *dev, double freq) |
Sets the ADF4157 output frequency. More... | |
Header file of ADF4157 Driver for Microblaze processor.
Copyright 2013(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:
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.
#define ADF4157_CE2_HIGH |
#define ADF4157_CE2_LOW |
#define ADF4157_CE2_OUT |
#define ADF4157_CE_HIGH |
#define ADF4157_CE_LOW |
#define ADF4157_CE_OUT |
#define ADF4157_CLK_DIV_OFF (0x00 << 19) |
#define ADF4157_CLK_DIV_VAL | ( | x | ) | ((x & 0xFFF) << 7) |
#define ADF4157_CLK_FAST_LOCK (0x01 << 19) |
#define ADF4157_CLK_RESYNC_EN (0x02 << 19) |
#define ADF4157_CNT_RST | ( | x | ) | ((x & 0x1) << 3) |
#define ADF4157_CP_Z | ( | x | ) | ((x & 0x1) << 4) |
#define ADF4157_CSR_EN | ( | x | ) | ((x & 0x1) << 28) |
#define ADF4157_CURR_SET | ( | x | ) | ((x & 0xF) << 24) |
#define ADF4157_FIXED_MODULUS 33554432 /* 2^25 */ |
#define ADF4157_FRAC_VAL_LSB | ( | x | ) | ((x & 0x1FFF) << 15) |
#define ADF4157_FRAC_VAL_MSB | ( | x | ) | ((x & 0x1FFE000) >> 10) |
#define ADF4157_INT_VAL | ( | x | ) | ((x & 0xFFF) << 15) |
#define ADF4157_LDP | ( | x | ) | ((x & 0x1) << 7) |
#define ADF4157_LE2_HIGH |
#define ADF4157_LE2_LOW |
#define ADF4157_LE2_OUT |
#define ADF4157_LE_HIGH |
#define ADF4157_LE_LOW |
#define ADF4157_LE_OUT |
#define ADF4157_LOW_NOISE (0x00 << 29) |
#define ADF4157_LOW_SPUR (0x03 << 29) |
#define ADF4157_MAX_FREQ_45_PRESC 3000 /* MHz */ |
#define ADF4157_MAX_FREQ_PFD 32000000 /* Hz */ |
#define ADF4157_MAX_FREQ_REFIN 300000000 /* Hz */ |
#define ADF4157_MAX_OUT_FREQ 6000 /* MHz */ |
#define ADF4157_MAX_R_CNT 32 |
#define ADF4157_MAX_REG_VAL 0x1FFFFFFF |
#define ADF4157_MIN_FREQ_REFIN 10000000 /* Hz */ |
#define ADF4157_MIN_OUT_FREQ 500 /* MHz */ |
#define ADF4157_MUX_HIGH |
#define ADF4157_MUX_LOW |
#define ADF4157_MUX_OUT |
#define ADF4157_MUXOUT_ALOCK (0x05 << 27) |
#define ADF4157_MUXOUT_CLKDIV (0x0A << 27) |
#define ADF4157_MUXOUT_DGND (0x02 << 27) |
#define ADF4157_MUXOUT_DLOCK (0x06 << 27) |
#define ADF4157_MUXOUT_DVdd (0x01 << 27) |
#define ADF4157_MUXOUT_FLS (0x0C << 27) |
#define ADF4157_MUXOUT_NDIV (0x04 << 27) |
#define ADF4157_MUXOUT_NDIV2 (0x0E << 27) |
#define ADF4157_MUXOUT_RDIV (0x03 << 27) |
#define ADF4157_MUXOUT_RDIV2 (0x0D << 27) |
#define ADF4157_MUXOUT_RESERVED (0x0F << 27) |
#define ADF4157_MUXOUT_SDO (0x07 << 27) |
#define ADF4157_MUXOUT_Z (0x00 << 27) |
#define ADF4157_NEG_BLEED_CUR | ( | x | ) | ((x && 0x3) << 23) |
#define ADF4157_PD ((x & 0x1) << 5) |
#define ADF4157_PD_POL | ( | x | ) | ((x & 0x1) << 6) |
#define ADF4157_PRESCALER | ( | x | ) | ((x & 0x1) << 22) |
#define ADF4157_R0_CTRL 0x00 |
#define ADF4157_R1_CTRL 0x01 |
#define ADF4157_R2_CTRL 0x02 |
#define ADF4157_R3_CTRL 0x03 |
#define ADF4157_R4_CTRL 0x04 |
#define ADF4157_R_CNT | ( | x | ) | ((x & 0x1F) << 15) |
#define ADF4157_RDIV2 | ( | x | ) | ((x & 0x1) << 21) |
#define ADF4157_REF_DBL | ( | x | ) | ((x & 0x1) << 20) |
#define ADF4157_REG0 0 |
#define ADF4157_REG1 1 |
#define ADF4157_REG2 2 |
#define ADF4157_REG3 3 |
#define ADF4157_REG4 4 |
#define ADF4157_SIG_DEL_RST | ( | x | ) | ((x & 0x1) << 14) |
int8_t adf4157_init | ( | struct adf4157_dev ** | device, |
struct adf4157_init_param | init_param | ||
) |
Initialize the SPI communication with the device.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
int32_t adf4157_remove | ( | struct adf4157_dev * | dev | ) |
Free the resources allocated by adf4157_init().
dev | - The device structure. |
int8_t adf4157_set | ( | struct adf4157_dev * | dev, |
uint32_t | value | ||
) |
Transmits 32 bits on SPI.
dev | - The device structure. |
value | - Data which will be transmitted. |
double adf4157_set_freq | ( | struct adf4157_dev * | dev, |
double | freq | ||
) |
Sets the ADF4157 output frequency.
dev | - The device structure. |
freq | - The desired frequency value. |
int32_t adf4157_tune_r_cnt | ( | struct adf4157_dev * | dev, |
int32_t | r_cnt | ||
) |
Increases the R counter value until the PFD frequency is smaller than ADF4351_MAX_FREQ_PFD.
dev | - The device structure. |
r_cnt | - Initial r_cnt value. |
uint32_t gcd | ( | uint32_t | x, |
uint32_t | y | ||
) |
Computes the greatest common divider of two numbers.