aboutsummaryrefslogtreecommitdiffstats
path: root/src/pru/internal.h
blob: 109dd3a2e5a71d1415c9ce8c6c52babd58fffee7 (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
#ifndef __PRU_INTERNAL_H
#define __PRU_INTERNAL_H
// Local definitions for PRU code

#include <stdint.h> // uint32_t

#define IEP_EVENT                 7
#define KICK_ARM_EVENT            16
#define KICK_PRU0_FROM_ARM_EVENT  17
#define KICK_PRU0_EVENT           18
#define KICK_PRU1_EVENT           19

#define WAKE_PRU0_IRQ  0
#define WAKE_PRU1_IRQ  1
#define WAKE_ARM_IRQ   2

#define R31_IRQ_OFFSET 30

#define R31_WRITE_IRQ_SELECT (1<<5)
#define R31_WRITE_IRQ_OFFSET 16

// Layout of shared memory
struct shared_mem {
    uint32_t signal;
    uint32_t read_pos, read_count;
    char read_data[512];
    uint32_t send_push_pos, send_pop_pos;
    struct {
        uint32_t count;
        char data[64];
    } send_data[4];
};

#define SIGNAL_PRU0_WAITING 0xefefefef
#define SIGNAL_PRU1_READY   0xabababab

#define SHARED_MEM ((struct shared_mem *)0x10000)

// Hardware ADC registers
struct beaglebone_adc {
    uint32_t pad_00[10];
    uint32_t irqstatus;
    uint32_t irqenable_set;
    uint32_t irqenable_clr;
    uint32_t irqwakeup;
    uint32_t dmaenable_set;
    uint32_t dmaenable_clr;
    uint32_t ctrl;
    uint32_t adcstat;
    uint32_t adcrange;
    uint32_t adc_clkdiv;
    uint32_t adc_misc;
    uint32_t stepenable;
    uint32_t idleconfig;
    uint32_t ts_charge_stepconfig;
    uint32_t ts_charge_delay;
    struct {
        uint32_t config;
        uint32_t delay;
    } step[16];
    uint32_t fifo0count;
    uint32_t pad_e8[6];
    uint32_t fifo0data;
    uint32_t pad_104[63];
    uint32_t fifo1data;
};

#define ADC ((struct beaglebone_adc *)0x44e0d000)

#endif // internal.h