blob: ff8bfe384759ce41e480e68db8755e2940e72d67 [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001#ifndef __GPT_REG_H__
2#define __GPT_REG_H__
3
4#include <reg_base.h>
5#include <irqid.h>
6
7/* Register Address Definition */
8#define MDGPT_BASE (BASE_ADDR_MDGPTM)
9#define GPT_CODA_VERSION (MDGPT_BASE)
10
11/* n = 1~6 */
12#define MDGPT_CNT_REG(n) (MDGPT_BASE + ((n))*0x10U + 0x0U)
13#define MDGPT_PSR_REG(n) (MDGPT_BASE + ((n))*0x10U + 0x4U)
14#define MDGPT_CTRL_REG(n) (MDGPT_BASE + ((n))*0x10U + 0x8U)
15#define MDGPT_DATA_REG(n) (MDGPT_BASE + ((n))*0x10U + 0xCU)
16
17#ifndef __MD93__
18#define GPT_INT_STATUS_REG(n) (MDGPT_BASE + ((n))*0x4U + 0xC0U)
19#define GPT_INT_STATUS_MASK_BIT(n) (1U<<(n - 1))
20#endif
21
22
23#define MDGPT_CTRL_MODE_ENABLE (1U<<1)
24#define MDGPT_CTRL_MODE_ONESHOT (0U<<0)
25#define MDGPT_CTRL_MODE_REPEAT (1U<<0)
26
27#define MDGPT_INTR_ID(n) (n + IRQ_GPTM1_CODE - 1)
28#define MDGPT_INTR_ID2TIMER(n) (n + 1 - IRQ_GPTM1_CODE)
29
30
31#endif /* end of __GPT_REG_H__ */