/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
 * All rights reserved.
 *
 * This software is supplied "AS IS" without any warranties.
 * RDA assumes no responsibility or liability for the use of the software,
 * conveys no license or title under any patent, copyright, or mask work
 * right to the product. RDA reserves the right to make changes in the
 * software without notification.  RDA also make no representation or
 * warranty that such application will be suitable for the specified use
 * without further testing or modification.
 */

#ifndef _COEFF_H_
#define _COEFF_H_

// Auto generated by dtools(see dtools.txt for its version).
// Don't edit it manually!

#define REG_COEFF_BASE (0x18200000)

typedef volatile struct
{
    uint32_t qfqt_start; // 0x00000000
    uint32_t qfqt_state; // 0x00000004
    uint32_t qf_conf;    // 0x00000008
    uint32_t qt_conf;    // 0x0000000c
    uint32_t sw_in;      // 0x00000010
    uint32_t sw_out;     // 0x00000014
} HWP_COEFF_T;

#define hwp_coeff ((HWP_COEFF_T *)REG_ACCESS_ADDRESS(REG_COEFF_BASE))

// qfqt_start
typedef union {
    uint32_t v;
    struct
    {
        uint32_t qfqt_en : 1;    // [0]
        uint32_t cp_type : 1;    // [1]
        uint32_t qfqt_inten : 1; // [2]
        uint32_t __3_3 : 1;      // [3]
        uint32_t port_sel : 1;   // [4]
        uint32_t fast_mod : 1;   // [5]
        uint32_t cat_sel : 1;    // [6]
        uint32_t buf_sel : 2;    // [8:7]
        uint32_t ldtc_en : 1;    // [9]
        uint32_t meas_en : 1;    // [10]
        uint32_t __31_11 : 21;   // [31:11]
    } b;
} REG_COEFF_QFQT_START_T;

// qfqt_state
typedef union {
    uint32_t v;
    struct
    {
        uint32_t qfqt_intf : 1; // [0], write clear
        uint32_t err_state : 1; // [1], write clear
        uint32_t which_err : 2; // [3:2], write clear
        uint32_t __31_4 : 28;   // [31:4]
    } b;
} REG_COEFF_QFQT_STATE_T;

// qf_conf
typedef union {
    uint32_t v;
    struct
    {
        uint32_t cha_mod : 2;       // [1:0]
        uint32_t __3_2 : 2;         // [3:2]
        uint32_t coeff_qf_snr : 11; // [14:4]
        uint32_t sys_band_sel : 3;  // [17:15]
        uint32_t __31_18 : 14;      // [31:18]
    } b;
} REG_COEFF_QF_CONF_T;

// qt_conf
typedef union {
    uint32_t v;
    struct
    {
        uint32_t ss_sel : 4;        // [3:0]
        uint32_t coeff_qt_snr : 11; // [14:4]
        uint32_t tdd_fdd : 1;       // [15]
        uint32_t doppler : 2;       // [17:16]
        uint32_t __31_18 : 14;      // [31:18]
    } b;
} REG_COEFF_QT_CONF_T;

// sw_in
typedef union {
    uint32_t v;
    struct
    {
        uint32_t sw_in : 16;   // [15:0]
        uint32_t __31_16 : 16; // [31:16]
    } b;
} REG_COEFF_SW_IN_T;

// sw_out
typedef union {
    uint32_t v;
    struct
    {
        uint32_t sw_out : 16;  // [15:0], read only
        uint32_t __31_16 : 16; // [31:16]
    } b;
} REG_COEFF_SW_OUT_T;

// qfqt_start
#define COEFF_QFQT_EN (1 << 0)
#define COEFF_CP_TYPE (1 << 1)
#define COEFF_QFQT_INTEN (1 << 2)
#define COEFF_PORT_SEL (1 << 4)
#define COEFF_FAST_MOD (1 << 5)
#define COEFF_CAT_SEL (1 << 6)
#define COEFF_BUF_SEL(n) (((n)&0x3) << 7)
#define COEFF_LDTC_EN (1 << 9)
#define COEFF_MEAS_EN (1 << 10)

// qfqt_state
#define COEFF_QFQT_INTF (1 << 0)
#define COEFF_ERR_STATE (1 << 1)
#define COEFF_WHICH_ERR(n) (((n)&0x3) << 2)

// qf_conf
#define COEFF_CHA_MOD(n) (((n)&0x3) << 0)
#define COEFF_COEFF_QF_SNR(n) (((n)&0x7ff) << 4)
#define COEFF_SYS_BAND_SEL(n) (((n)&0x7) << 15)

// qt_conf
#define COEFF_SS_SEL(n) (((n)&0xf) << 0)
#define COEFF_COEFF_QT_SNR(n) (((n)&0x7ff) << 4)
#define COEFF_TDD_FDD (1 << 15)
#define COEFF_DOPPLER(n) (((n)&0x3) << 16)

// sw_in
#define COEFF_SW_IN(n) (((n)&0xffff) << 0)

// sw_out
#define COEFF_SW_OUT(n) (((n)&0xffff) << 0)

#endif // _COEFF_H_
