summaryrefslogtreecommitdiff
path: root/bsp/allwinner/libraries/sunxi-hal/include/hal/sunxi_hal_eise.h
blob: cb2561e3b03bce1f3f97e851ca5c6a63e244d938 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
 * ===========================================================================================
 *
 *       Filename:  sunxi_eise.h
 *
 *    Description:  EISE HAL definition.
 *
 *        Version:  Melis3.0
 *         Create:  2020-01-09 11:11:56
 *       Revision:  none
 *       Compiler:
 *
 *         Author:  ganqiuye([email protected])
 *   Organization:  SWC-MPD
 *  Last Modified:  2020-04-02 17:32:52
 *
 * ===========================================================================================
 */

#ifndef SUNXI_HAL_EISE_H
#define SUNXI_HAL_EISE_H
#include <hal_clk.h>
#include "hal_sem.h"
#ifdef __cplusplus
extern "C"
{
#endif

#include "sunxi_hal_common.h"

#define DEVICE_NAME "sunxi_eise"

/* system address */
#define PLL_ISE_CTRL_REG                 (0x00D0)
#define EISE_CLK_REG                     (0x06D0)
#define MBUS_CLK_GATING_REG              (0x0804)
#define EISE_BGR_REG                     (0x06DC)

/* eise register */
#define EISE_CTRL_REG                    (0x00)
#define EISE_IN_SIZE                     (0x28)
#define EISE_OUT_SIZE                    (0x38)
#define EISE_ICFG_REG                    (0x04)
#define EISE_OCFG_REG                    (0x08)
#define EISE_INTERRUPT_EN                (0x0c)
#define EISE_TIME_OUT_NUM                (0x3c)

#define EISE_INTERRUPT_STATUS            (0x10)
#define EISE_ERROR_FLAG                  (0x14)
#define EISE_RESET_REG                   (0x88)


struct eise_register{
  unsigned int addr;
  unsigned int value;
};

typedef struct hal_eise_t{
    unsigned int eise_base_addr;
    unsigned int ccmu_base_addr;
   // unsigned long err_cnt;
    //unsigned long interrupt_times;
    unsigned int irq_id;
    hal_clk_id_t pclk;
    hal_clk_id_t mclk;
    hal_sem_t   hal_sem;
}hal_eise_t;

typedef struct sunxi_hal_driver_eise
{
    int32_t (*initialize)(int32_t dev);

    int32_t (*uninitialize)(int32_t dev);

    int32_t (*send)(int32_t dev, const char *data, uint32_t num);

    int32_t (*receive)(int32_t dev, int *data, uint32_t num);

    int32_t (*control)(int32_t dev, uint32_t control, void* arg);
    sunxi_hal_poll_ops *poll_ops;
} const sunxi_hal_driver_eise_t;

#ifdef __cplusplus
}
#endif

#endif