/* 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 _RFFE_H_
#define _RFFE_H_

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

#define REG_RFFE_BASE (0x50038000)

typedef volatile struct
{
    uint32_t cmd_mipi0;   // 0x00000000
    uint32_t cmd_mipi1;   // 0x00000004
    uint32_t data_mipi0;  // 0x00000008
    uint32_t data_mipi1;  // 0x0000000c
    uint32_t data_out0;   // 0x00000010
    uint32_t data_out1;   // 0x00000014
    uint32_t data_valid;  // 0x00000018
    uint32_t mipi_status; // 0x0000001c
} HWP_RFFE_T;

#define hwp_rffe ((HWP_RFFE_T *)REG_ACCESS_ADDRESS(REG_RFFE_BASE))

// cmd_mipi0
typedef union {
    uint32_t v;
    struct
    {
        uint32_t cmd_mipi_low : 16; // [15:0]
        uint32_t __31_16 : 16;      // [31:16]
    } b;
} REG_RFFE_CMD_MIPI0_T;

// cmd_mipi1
typedef union {
    uint32_t v;
    struct
    {
        uint32_t cmd_mipi_high : 16; // [15:0]
        uint32_t __31_16 : 16;       // [31:16]
    } b;
} REG_RFFE_CMD_MIPI1_T;

// data_mipi0
typedef union {
    uint32_t v;
    struct
    {
        uint32_t data_mipi_low : 16; // [15:0]
        uint32_t __31_16 : 16;       // [31:16]
    } b;
} REG_RFFE_DATA_MIPI0_T;

// data_mipi1
typedef union {
    uint32_t v;
    struct
    {
        uint32_t data_mipi_high : 16; // [15:0]
        uint32_t __31_16 : 16;        // [31:16]
    } b;
} REG_RFFE_DATA_MIPI1_T;

// data_out0
typedef union {
    uint32_t v;
    struct
    {
        uint32_t data_out_low : 16; // [15:0]
        uint32_t __31_16 : 16;      // [31:16]
    } b;
} REG_RFFE_DATA_OUT0_T;

// data_out1
typedef union {
    uint32_t v;
    struct
    {
        uint32_t data_out_high : 16; // [15:0]
        uint32_t __31_16 : 16;       // [31:16]
    } b;
} REG_RFFE_DATA_OUT1_T;

// data_valid
typedef union {
    uint32_t v;
    struct
    {
        uint32_t data_valid : 4; // [3:0], read only
        uint32_t __31_4 : 28;    // [31:4]
    } b;
} REG_RFFE_DATA_VALID_T;

// mipi_status
typedef union {
    uint32_t v;
    struct
    {
        uint32_t cmd_done_status : 1;      // [0], read only
        uint32_t master_busy_mipi_dly : 1; // [1], read only
        uint32_t __31_2 : 30;              // [31:2]
    } b;
} REG_RFFE_MIPI_STATUS_T;

// cmd_mipi0
#define RFFE_CMD_MIPI_LOW(n) (((n)&0xffff) << 0)

// cmd_mipi1
#define RFFE_CMD_MIPI_HIGH(n) (((n)&0xffff) << 0)

// data_mipi0
#define RFFE_DATA_MIPI_LOW(n) (((n)&0xffff) << 0)

// data_mipi1
#define RFFE_DATA_MIPI_HIGH(n) (((n)&0xffff) << 0)

// data_out0
#define RFFE_DATA_OUT_LOW(n) (((n)&0xffff) << 0)

// data_out1
#define RFFE_DATA_OUT_HIGH(n) (((n)&0xffff) << 0)

// data_valid
#define RFFE_DATA_VALID(n) (((n)&0xf) << 0)

// mipi_status
#define RFFE_CMD_DONE_STATUS (1 << 0)
#define RFFE_MASTER_BUSY_MIPI_DLY (1 << 1)

#endif // _RFFE_H_
