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

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

#define REG_WLAN_BASE (0x14008000)

typedef volatile struct
{
    uint32_t __0[1];           // 0x00000000
    uint32_t bank_addr;        // 0x00000004
    uint32_t offset_addr;      // 0x00000008
    uint32_t regwdata;         // 0x0000000c
    uint32_t regrdata;         // 0x00000010
    uint32_t protocol_version; // 0x00000014
    uint32_t type;             // 0x00000018
    uint32_t subtype;          // 0x0000001c
    uint32_t desaddr_l;        // 0x00000020
    uint32_t desaddr_h;        // 0x00000024
    uint32_t srcaddr_l;        // 0x00000028
    uint32_t srcaddr_h;        // 0x0000002c
    uint32_t bssidaddr_l;      // 0x00000030
    uint32_t bssidaddr_h;      // 0x00000034
    uint32_t seqcontl;         // 0x00000038
    uint32_t rssival;          // 0x0000003c
    uint32_t __64[16];         // 0x00000040
    uint32_t apb_config;       // 0x00000080
    uint32_t datardyinterrupt; // 0x00000084
    uint32_t __136[9];         // 0x00000088
    uint32_t framectrl;        // 0x000000ac
    uint32_t duration;         // 0x000000b0
    uint32_t ht_ctrl;          // 0x000000b4
    uint32_t tstamp_l;         // 0x000000b8
    uint32_t tstamp_h;         // 0x000000bc
    uint32_t bcnintvl;         // 0x000000c0
    uint32_t capinfo;          // 0x000000c4
    uint32_t elmtid;           // 0x000000c8
    uint32_t ssidlen;          // 0x000000cc
    uint32_t ssidbyte1;        // 0x000000d0
    uint32_t ssidbyte2;        // 0x000000d4
    uint32_t ssidbyte3;        // 0x000000d8
    uint32_t ssidbyte4;        // 0x000000dc
    uint32_t ssidbyte5;        // 0x000000e0
    uint32_t ssidbyte6;        // 0x000000e4
    uint32_t ssidbyte7;        // 0x000000e8
    uint32_t ssidbyte8;        // 0x000000ec
    uint32_t out_fcsval;       // 0x000000f0
} HWP_WLAN_T;

#define hwp_wlan ((HWP_WLAN_T *)REG_ACCESS_ADDRESS(REG_WLAN_BASE))

// protocol_version
typedef union {
    uint32_t v;
    struct
    {
        uint32_t protocol_version : 2; // [1:0], read only
        uint32_t __31_2 : 30;          // [31:2]
    } b;
} REG_WLAN_PROTOCOL_VERSION_T;

// type
typedef union {
    uint32_t v;
    struct
    {
        uint32_t type : 2;    // [1:0], read only
        uint32_t __31_2 : 30; // [31:2]
    } b;
} REG_WLAN_TYPE_T;

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

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

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

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

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

// rssival
typedef union {
    uint32_t v;
    struct
    {
        uint32_t rssival : 8; // [7:0], read only
        uint32_t __31_8 : 24; // [31:8]
    } b;
} REG_WLAN_RSSIVAL_T;

// apb_config
typedef union {
    uint32_t v;
    struct
    {
        uint32_t apb_clear : 1; // [0]
        uint32_t apb_hold : 1;  // [1]
        uint32_t __7_2 : 6;     // [7:2]
        uint32_t subtype : 4;   // [11:8]
        uint32_t type : 2;      // [13:12]
        uint32_t __15_14 : 2;   // [15:14]
        uint32_t phyrxenn : 1;  // [16]
        uint32_t __31_17 : 15;  // [31:17]
    } b;
} REG_WLAN_APB_CONFIG_T;

// datardyinterrupt
typedef union {
    uint32_t v;
    struct
    {
        uint32_t datardyinterrupt : 1; // [0], read only
        uint32_t __31_1 : 31;          // [31:1]
    } b;
} REG_WLAN_DATARDYINTERRUPT_T;

// framectrl
typedef union {
    uint32_t v;
    struct
    {
        uint32_t framectrl : 8; // [7:0], read only
        uint32_t __31_8 : 24;   // [31:8]
    } b;
} REG_WLAN_FRAMECTRL_T;

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

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

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

// elmtid
typedef union {
    uint32_t v;
    struct
    {
        uint32_t elmtid : 8;  // [7:0], read only
        uint32_t __31_8 : 24; // [31:8]
    } b;
} REG_WLAN_ELMTID_T;

// ssidlen
typedef union {
    uint32_t v;
    struct
    {
        uint32_t ssidlen : 8; // [7:0], read only
        uint32_t __31_8 : 24; // [31:8]
    } b;
} REG_WLAN_SSIDLEN_T;

// protocol_version
#define WLAN_PROTOCOL_VERSION(n) (((n)&0x3) << 0)

// type
#define WLAN_TYPE_TYPE(n) (((n)&0x3) << 0)

// subtype
#define WLAN_SUBTYPE_SUBTYPE(n) (((n)&0xf) << 0)

// desaddr_h
#define WLAN_DESADDR_H(n) (((n)&0xffff) << 0)

// srcaddr_h
#define WLAN_SRCADDR_H(n) (((n)&0xffff) << 0)

// bssidaddr_h
#define WLAN_BSSIDADDR_H(n) (((n)&0xffff) << 0)

// seqcontl
#define WLAN_SEQCONTL(n) (((n)&0xffff) << 0)

// rssival
#define WLAN_RSSIVAL(n) (((n)&0xff) << 0)

// apb_config
#define WLAN_APB_CLEAR (1 << 0)
#define WLAN_APB_HOLD (1 << 1)
#define WLAN_APB_CONFIG_SUBTYPE(n) (((n)&0xf) << 8)
#define WLAN_APB_CONFIG_TYPE(n) (((n)&0x3) << 12)
#define WLAN_PHYRXENN (1 << 16)

// datardyinterrupt
#define WLAN_DATARDYINTERRUPT (1 << 0)

// framectrl
#define WLAN_FRAMECTRL(n) (((n)&0xff) << 0)

// duration
#define WLAN_DURATION(n) (((n)&0xffff) << 0)

// bcnintvl
#define WLAN_BCNINTVL(n) (((n)&0xffff) << 0)

// capinfo
#define WLAN_CAPINFO(n) (((n)&0xffff) << 0)

// elmtid
#define WLAN_ELMTID(n) (((n)&0xff) << 0)

// ssidlen
#define WLAN_SSIDLEN(n) (((n)&0xff) << 0)

#endif // _WLAN_H_
