Ubuntu12.04.4_lts
2023-08-01 961efe36f62f7eba688d504ec0cdf3e1daa4dd74
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
**  SAM926x IOCTL Header
**  HangZhou QiYang Technology Co.Ltd. 
**  www.qiyangtech.com
*/
 
#ifndef __AT91_IOCTL_H__
#define __AT91_IOCTL_H__
 
 
// ==================================== PIO ============================================
typedef enum {
    AT91PIO_DIR_INP = 0,
    AT91PIO_DIR_OUT
} at91_pio_dir_t;
 
typedef struct {
    int  pin_idx;
    int  pin_dir;
    int  pin_sta;
} at91_pio_arg;
 
//IOCTL for PIO
#define    IOCTL_PIO_SETDIR    _IOW('Q', 0x01, int)       //Set pio direct
#define    IOCTL_PIO_GETDIR     _IOR('Q', 0x02, int)    //Get pio direct
#define    IOCTL_PIO_SETSTA    _IOW('Q', 0x03, int)    //Set pio status
#define    IOCTL_PIO_GETSTA    _IOR('Q', 0x04, int)    //Get pio status
 
 
// ==================================== EBI ============================================
typedef struct {
    int ebi_addr;
    int ebi_data;
} at91_ebi_arg;
 
 
// ==================================== PCX ============================================
typedef struct {
        int pcx_addr;
        int pcx_data;
} at91_pcx_arg;
 
// ==================================== TCB ============================================
typedef struct {
    int tc_freq;
} at91_tc_arg;
 
//IOCTL for TC
#define IOCTL_TC_START        _IOW('Q', 0x21, int)
#define    IOCTL_TC_STOP        _IOW('Q', 0x22, int)
#define IOCTL_TC_GETCNT        _IOR('Q', 0x23, int)
 
//IOCTL for AT91_CAN
#define IOCTL_CAN_SETBAND    _IOW('Q', 0x24, int)
 
//IOCTL for PC104
typedef struct {
        int     addr;
        int     data;
} pc104_arg;
 
enum {
        IOCTL_PC104_CHANGEWIDTH = 0x300,
        IOCTL_PC104_WAITINTERRUPT
};
 
 
// ==================================== PIO ============================================
//IOCTL for Buzzer
#define IOCTL_BZR_BEEP        _IOW('Q', 0x31, int)
 
 
// ==================================== PIO ============================================
typedef struct {
    int pwm_freq;        //frequency in Hz
    int pwm_duty;        //duty cycle in percent. ex. 50 is 50% 
    int pwm_pulse;        //1 for PWM positive pulse, 0 for negative pulse
} at91_pwm_arg;
 
#define IOCTL_PWM_START        _IOW('Q', 0x41, int)
#define IOCTL_PWM_STOP        _IOW('Q', 0x42, int)
#define IOCTL_PWM_SETARG    _IOW('Q', 0x43, at91_pwm_arg *)
#define IOCTL_PWM_GETARG    _IOR('Q', 0x44, at91_pwm_arg *)
 
//====================================PWM================================================
 
struct pwm_str{
        int chid;//enable channel id
        int cpre;
        int cpol;
        int calg;
        int cdty;
        int cprd;
};
 
struct pwm_getcnt{
        int chid;
        int valu;
};
 
struct pwm_cupd{
        int chid;
        int cpd;
        int valu;
};
 
 
#define     IOCTL_PWM_DIVA        _IOW('P',0X01,int)
#define     IOCTL_PWM_DIVB        _IOW('P',0X02,int)
#define     IOCTL_PWM_RPEA        _IOW('P',0X03,int)
#define     IOCTL_PWM_RPEB        _IOW('P',0X04,int)
#define        IOCTL_PWM_ECHID        _IOW('P',0X05,int)//enable channel
#define        IOCTL_PWM_DCHID        _IOW('P',0X06,int)//disable channel
#define        IOCTL_PWM_ENINT        _IOW('P',0X07,int)//enable interrupt
#define        IOCTL_PWM_DIINT     _IOW('P',0X08,int)//disable interrupt
 
#define        IOCTL_SET_CMR_CDTY_CPRD     _IOW('P',0x09,int)
 
#define        IOCTL_PWM_CPD        _IOW('P',0x0c,int)//updata duty cycle or period
 
#define        IOCTL_PWM_GETCNT    _IOR('P',0x0f,int)//get counter value
 
#define        IOCTL_PWM_CUPD        _IOW('P',0x10,int)
 
#endif //__AT91_IOCTL_H__