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

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

#define REG_SPINLOCK_BASE (0x51000000)

typedef volatile struct
{
    uint32_t __0[2];          // 0x00000000
    uint32_t spinlockttlsts;  // 0x00000008
    uint32_t __12[29];        // 0x0000000c
    uint32_t spinlockmstid_i; // 0x00000080
    uint32_t __132[479];      // 0x00000084
    uint32_t spinlocksts_i;   // 0x00000800
    uint32_t __2052[510];     // 0x00000804
    uint32_t spinlockverid;   // 0x00000ffc
} HWP_SPINLOCK_T;

#define hwp_spinlock ((HWP_SPINLOCK_T *)REG_ACCESS_ADDRESS(REG_SPINLOCK_BASE))

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

// spinlocksts_i
#define SPINLOCK_TAKEN (1 << 0)

#endif // _SPINLOCK_H_
