blob: ff8bfe384759ce41e480e68db8755e2940e72d67 [file] [log] [blame]
#ifndef __GPT_REG_H__
#define __GPT_REG_H__
#include <reg_base.h>
#include <irqid.h>
/* Register Address Definition */
#define MDGPT_BASE (BASE_ADDR_MDGPTM)
#define GPT_CODA_VERSION (MDGPT_BASE)
/* n = 1~6 */
#define MDGPT_CNT_REG(n) (MDGPT_BASE + ((n))*0x10U + 0x0U)
#define MDGPT_PSR_REG(n) (MDGPT_BASE + ((n))*0x10U + 0x4U)
#define MDGPT_CTRL_REG(n) (MDGPT_BASE + ((n))*0x10U + 0x8U)
#define MDGPT_DATA_REG(n) (MDGPT_BASE + ((n))*0x10U + 0xCU)
#ifndef __MD93__
#define GPT_INT_STATUS_REG(n) (MDGPT_BASE + ((n))*0x4U + 0xC0U)
#define GPT_INT_STATUS_MASK_BIT(n) (1U<<(n - 1))
#endif
#define MDGPT_CTRL_MODE_ENABLE (1U<<1)
#define MDGPT_CTRL_MODE_ONESHOT (0U<<0)
#define MDGPT_CTRL_MODE_REPEAT (1U<<0)
#define MDGPT_INTR_ID(n) (n + IRQ_GPTM1_CODE - 1)
#define MDGPT_INTR_ID2TIMER(n) (n + 1 - IRQ_GPTM1_CODE)
#endif /* end of __GPT_REG_H__ */