tinySG/MDK-ARM/lmx2595.h
2025-01-08 00:18:38 +08:00

877 lines
12 KiB
C

#include "stm32f0xx.h"
#ifndef LMX2595_H
#define LMX2595_H
#pragma anon_unions
typedef struct
{
union
{
__IO uint16_t All;
struct
{
__IO uint16_t POWERDOWN:1;
__IO uint16_t RESET:1;
__IO uint16_t MUXOUT_LD_SEL:1;
__IO uint16_t FCAL_EN:1;
__IO uint16_t NA00:1;
__IO uint16_t FCAL_LPFD_ADJ:2;
__IO uint16_t FCAL_HPFD_ADJ:2;
__IO uint16_t OUT_MUTE:1;
__IO uint16_t NA01:4;
__IO uint16_t VCO_PHASE_SYNC:1;
__IO uint16_t RAMP_EN:1;
};
}LMX_R0;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t CAL_CLK_DIV:3;
__IO uint16_t NA10:13;
};
}LMX_R1;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R2;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R3;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t NA40:8;
__IO uint16_t ACAL_CMP_DLY:8;
};
}LMX_R4;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R5;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R6;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t NA70:14;
__IO uint16_t OUT_FORCE:1;
__IO uint16_t NA71:1;
};
}LMX_R7;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t NA80:13;
__IO uint16_t VCO_CAPCTRL_FORCE:1;
__IO uint16_t NA81:2;
__IO uint16_t VCO_DACISET_FORCE:1;
__IO uint16_t NA82:1;
};
}LMX_R8;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t NA90:12;
__IO uint16_t OSC_2X:1;
__IO uint16_t NA92:3;
};
}LMX_R9;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t NA100:7;
__IO uint16_t MULT:5;
__IO uint16_t NA101:4;
};
}LMX_R10;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t NA110:4;
__IO uint16_t PLL_R:8;
__IO uint16_t NA111:4;
};
}LMX_R11;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t PLL_R_PRE:12;
__IO uint16_t NA120:4;
};
}LMX_R12;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R13;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t NA140:4;
__IO uint16_t CPG:3;
__IO uint16_t NA141:9;
};
}LMX_R14;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R15;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t VCO_DACISET:9;
__IO uint16_t NA160:7;
};
}LMX_R16;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t VCO_DACISET_START:9;
__IO uint16_t NA170:7;
};
}LMX_R17;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R18;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t VCO_CAPCTRL:8;
__IO uint16_t NA190:8;
};
}LMX_R19;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t NA200:10;
__IO uint16_t VCO_SEL_FORCE:1;
__IO uint16_t VCO_SEL:1;
__IO uint16_t NA201:4;
};
}LMX_R20;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R21;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R22;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R23;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R24;
union
{
__IO uint16_t All;
uint16_t DBLR_IBIAS_CTRL1;
}LMX_R25;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R26;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t VCO2X_EN:1;
__IO uint16_t NA270:15;
};
}LMX_R27;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R28;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R29;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R30;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t NA310:14;
__IO uint16_t CHDIV_DIV2:1;
__IO uint16_t NA311:1;
};
}LMX_R31;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R32;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R33;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t PLL_N_B18_B16:3;
__IO uint16_t NA340:13;
};
}LMX_R34;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R35;
union
{
__IO uint16_t All;
__IO uint16_t PLL_N_B15_B0;
}LMX_R36;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t NA370:8;
__IO uint16_t PFD_DLY_SEL:6;
__IO uint16_t NA371:1;
__IO uint16_t MASH_SEED_EN:1;
};
}LMX_R37;
union
{
__IO uint16_t All;
__IO uint16_t PLL_DEN_B31_B16;
}LMX_R38;
union
{
__IO uint16_t All;
__IO uint16_t PLL_DEN_B15_B0;
}LMX_R39;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R40;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R41;
union
{
__IO uint16_t All;
__IO uint16_t PLL_NUM_B31_B16;
}LMX_R42;
union
{
__IO uint16_t All;
__IO uint16_t PLL_NUM_B15_B0;
}LMX_R43;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t MASH_ORDER:3;
__IO uint16_t NA440:2;
__IO uint16_t MASH_RESET_N:1;
__IO uint16_t OUTA_PD:1;
__IO uint16_t OUTB_PD:1;
__IO uint16_t OUTA_PWR:6;
__IO uint16_t NA441:2;
};
}LMX_R44;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t OUTA_PWR:6;
__IO uint16_t NA450:3;
__IO uint16_t OUT_ISET:2;
__IO uint16_t OUTA_MUX:2;
__IO uint16_t NA451:3;
};
}LMX_R45;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t OUTB_MUX:2;
__IO uint16_t NA460:14;
};
}LMX_R46;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R47;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R48;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R49;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R50;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R51;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R52;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R53;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R54;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R55;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R56;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R57;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t NA580:9;
__IO uint16_t INPIN_FMT:2;
__IO uint16_t INPIN_LVL:2;
__IO uint16_t INPIN_HYST:1;
__IO uint16_t INPIN_IGNORE:1;
};
}LMX_R58;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t LD_TYPE:1;
__IO uint16_t NA590:15;
};
}LMX_R59;
union
{
__IO uint16_t All;
__IO uint16_t LD_DLY;
}LMX_R60;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R61;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R62;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R63;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R64;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R65;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R66;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R67;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R68;
union
{
__IO uint16_t All;
__IO uint16_t MASH_RST_COUNT_B31_B16;
}LMX_R69;
union
{
__IO uint16_t All;
__IO uint16_t MASH_RST_COUNT_B15_B0;
}LMX_R70;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t NA710:2;
__IO uint16_t SYSREF_REPEAT:1;
__IO uint16_t SYSREF_EN:1;
__IO uint16_t SYSREF_PULSE:1;
__IO uint16_t SYSREF_DIV_PRE:3;
__IO uint16_t NA711:8;
};
}LMX_R71;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t SYSREF_DIV:11;
__IO uint16_t NA720:5;
};
}LMX_R72;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t JESD_DAC1_CTRL:6;
__IO uint16_t JESD_DAC2_CTRL:6;
__IO uint16_t NA730:4;
};
}LMX_R73;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t JESD_DAC3_CTRL:6;
__IO uint16_t JESD_DAC4_CTRL:6;
__IO uint16_t SYSREF_PULSE_CNT:4;
};
}LMX_R74;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t NA750:6;
__IO uint16_t CHDIV:5;
__IO uint16_t NA751:5;
};
}LMX_R75;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R76;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R77;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t NA780:1;
__IO uint16_t VCO_CAPCTRL_STRT:8;
__IO uint16_t QUICK_RECAL_EN:1;
__IO uint16_t NA781:1;
__IO uint16_t RAMP_THRESH_B32:1;
__IO uint16_t NA782:4;
};
}LMX_R78;
union
{
__IO uint16_t All;
__IO uint16_t RAMP_THRESH_B31_B16;
}LMX_R79;
union
{
__IO uint16_t All;
__IO uint16_t RAMP_THRESH_B15_B0;
}LMX_R80;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t RAMP_LIMIT_HIGH_B32:1;
__IO uint16_t NA810:15;
};
}LMX_R81;
union
{
__IO uint16_t All;
__IO uint16_t RAMP_LIMIT_HIGH_B31_B16;
}LMX_R82;
union
{
__IO uint16_t All;
__IO uint16_t RAMP_LIMIT_HIGH_B15_B0;
}LMX_R83;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t RAMP_LIMIT_LOW_B32:1;
__IO uint16_t NA840:15;
};
}LMX_R84;
union
{
__IO uint16_t All;
__IO uint16_t RAMP_LIMIT_LOW_B31_B16;
}LMX_R85;
union
{
__IO uint16_t All;
__IO uint16_t RAMP_LIMIT_LOW_B15_B0;
}LMX_R86;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R87;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R88;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R89;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R90;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R91;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R92;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R93;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R94;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R95;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t NA960:2;
__IO uint16_t RAMP_BURST_COUNT:13;
__IO uint16_t RAMP_BURST_EN:1;
};
}LMX_R96;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t RAMP_BURST_TRIG:2;
__IO uint16_t NA970:1;
__IO uint16_t RAMP_TRIGA:4;
__IO uint16_t RAMP_TRIGB:4;
__IO uint16_t NA971:4;
__IO uint16_t RAMP0_RST:1;
};
}LMX_R97;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t RAMP0_DLY:1;
__IO uint16_t NA970:1;
__IO uint16_t RAMP0_INC_B29_B16:13;
};
}LMX_R98;
union
{
__IO uint16_t All;
__IO uint16_t RAMP0_INC_B15_B0;
}LMX_R99;
union
{
__IO uint16_t All;
__IO uint16_t RAMP0_LEN;
}LMX_R100;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t RAMP0_NEXT_TRIG:1;
__IO uint16_t NA1010:2;
__IO uint16_t RAMP0_NEXT:1;
__IO uint16_t RAMP1_RST:1;
__IO uint16_t RAMP1_DLY:1;
__IO uint16_t NA1011:10;
};
}LMX_R101;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t RAMP1_INC_B29_B16:14;
__IO uint16_t NA1020:2;
};
}LMX_R102;
union
{
__IO uint16_t All;
__IO uint16_t RAMP1_INC_B15_B0;
}LMX_R103;
union
{
__IO uint16_t All;
__IO uint16_t RAMP1_LEN;
}LMX_R104;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t RAMP1_NEXT_TRIG:1;
__IO uint16_t NA1050:2;
__IO uint16_t RAMP1_NEXT:1;
__IO uint16_t RAMP_MANUAL:1;
__IO uint16_t RAMP_DLY_CNT:11;
};
}LMX_R105;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t RAMP_SCALE_COUNT:1;
__IO uint16_t NA1060:1;
__IO uint16_t RAMMP_TRIG_CAL:1;
__IO uint16_t NA1061:13;
};
}LMX_R106;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R107;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R108;
union
{
__IO uint16_t All;
__IO uint16_t BIT;
}LMX_R109;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t NA1100:5;
__IO uint16_t rb_VCO_SEL:3;
__IO uint16_t NA1101:1;
__IO uint16_t rb_LD_VTUNE:2;
__IO uint16_t NA1102:4;
};
}LMX_R110;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t rb_VCO_CAPCTRL:8;
__IO uint16_t NA1110:8;
};
}LMX_R111;
union
{
__IO uint16_t All;
struct
{
__IO uint16_t rb_VCO_DACISET:9;
__IO uint16_t NA1120:7;
};
}LMX_R112;
}_LMX2595_REG;
typedef struct
{
//GPIO type
GPIO_TypeDef *gpio;
uint16_t gpio_pin;
}LMX_PORT_T;
typedef struct
{
//LMX type
LMX_PORT_T SCK;
LMX_PORT_T SDI;
LMX_PORT_T CSB;
LMX_PORT_T LDO;
}LMX_MAP_T;
extern void Lmx_PortIntit(void);
extern void SetLmxParameter(void);
extern void SetLmxFreq(void);
extern void ConfigLmxAgain(void);
extern void CheckLmxLdStatus(void);
extern void LMX2592_WRITE_FREQ(double freq);
extern _LMX2595_REG lmx;
#endif