Revision 1d5bcc82

View differences:

Makefile
27 27
AMIROLLD_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
28 28

  
29 29
# include paths
30
AMIROLLD_INC = $(AMIROLLD_DIR:/=) \
31
               $(AMIROLLD_DIR)include
32

  
33
AMIROLLD_SRCDIR = $(AMIROLLD_DIR)source
30
AMIROLLD_INC = $(AMIROLLD_DIR) \
31
               $(sort $(dir $(wildcard $(AMIROLLD_DIR)include/?*/)))
34 32

  
35 33
# C sources
36
AMIROLLD_CSRC = $(wildcard $(AMIROLLD_SRCDIR)/*.c)
34
AMIROLLD_CSRC = $(wildcard $(AMIROLLD_DIR)source/*/*/*.c)
37 35

  
include/A3906/alld_A3906.h
1
/*
2
AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

  
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU Lesser General Public License for more details.
14

  
15
You should have received a copy of the GNU Lesser General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18

  
19
/**
20
 * @file    alld_A3906.h
21
 *
22
 * @addtogroup lld_motor
23
 * @{
24
 */
25

  
26
#ifndef AMIROLLD_A3906_H
27
#define AMIROLLD_A3906_H
28

  
29
#include <amiro-lld.h>
30

  
31
#if defined(AMIROLLD_CFG_A3906)
32

  
33
#if (AMIROLLD_CFG_A3906 == 1)
34
  #include "v1/alld_A3906_v1.h"
35
#else
36
  #error "invalid value assigned to AMIROLLD_CFG_A3906 in alldconf.h"
37
#endif
38

  
39
#endif /* defined(AMIROLLD_CFG_A3906) */
40

  
41
#endif /* AMIROLLD_A3906_H */
42

  
43
/** @} */
include/A3906/v1/alld_A3906_v1.h
1
/*
2
AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

  
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU Lesser General Public License for more details.
14

  
15
You should have received a copy of the GNU Lesser General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18

  
19
/**
20
 * @file    alld_A3906_v1.h
21
 * @brief   Motor driver macros and structures.
22
 *
23
 * @addtogroup lld_motor
24
 * @{
25
 */
26

  
27
#ifndef AMIROLLD_A3906_V1_H
28
#define AMIROLLD_A3906_V1_H
29

  
30
#include <amiro-lld.h>
31

  
32
#if (defined(AMIROLLD_CFG_A3906) && (AMIROLLD_CFG_A3906 == 1)) || defined(__DOXYGEN__)
33

  
34
/******************************************************************************/
35
/* CONSTANTS                                                                  */
36
/******************************************************************************/
37

  
38
/**
39
 * @brief Active state of power pin.
40
 */
41
#define A3906_LLD_POWER_PIN_ACTIVE_STATE  APAL_GPIO_ACTIVE_HIGH
42

  
43
/******************************************************************************/
44
/* SETTINGS                                                                   */
45
/******************************************************************************/
46

  
47
/******************************************************************************/
48
/* CHECKS                                                                     */
49
/******************************************************************************/
50

  
51
/******************************************************************************/
52
/* DATA STRUCTURES AND TYPES                                                  */
53
/******************************************************************************/
54

  
55
/**
56
 * @brief A3906 driver struct.
57
 */
58
typedef struct {
59
  const apalControlGpio_t* power_pin;   /**< @brief GPIO to enable/disable power of the A3906. */
60
} A3906Driver;
61

  
62
/**
63
 * @brief Power state of the A3906.
64
 */
65
typedef enum {
66
  A3906_LLD_POWER_OFF = 0x00,   /**< 'power off' state  */
67
  A3906_LLD_POWER_ON  = 0x01,   /**< 'power on' state   */
68
} a3906_lld_power_t;
69

  
70
/******************************************************************************/
71
/* MACROS                                                                     */
72
/******************************************************************************/
73

  
74
/******************************************************************************/
75
/* EXTERN DECLARATIONS                                                        */
76
/******************************************************************************/
77

  
78
#ifdef __cplusplus
79
extern "C" {
80
#endif
81
  apalExitStatus_t a3906_lld_set_power(const A3906Driver* const a3906, const a3906_lld_power_t power_state);
82
  apalExitStatus_t a3906_lld_get_power(const A3906Driver* const a3906, a3906_lld_power_t* const power_state);
83
  apalExitStatus_t a3906_lld_set_pwm(apalPWMDriver_t* pwm, const apalPWMchannel_t channel, const apalPWMwidth_t width);
84
#ifdef __cplusplus
85
}
86
#endif
87

  
88
/******************************************************************************/
89
/* INLINE FUNCTIONS                                                           */
90
/******************************************************************************/
91

  
92
#endif /* defined(AMIROLLD_CFG_USE_A3906) && (AMIROLLD_CFG_USE_A3906 == 1) */
93

  
94
#endif /* AMIROLLD_A3906_V1_H */
95

  
96
/** @} */
include/AT24C01B/alld_AT24C01B.h
1
/*
2
AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

  
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU Lesser General Public License for more details.
14

  
15
You should have received a copy of the GNU Lesser General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18

  
19
/**
20
 * @file    alld_AT24C01B.h
21
 *
22
 * @addtogroup lld_eeprom
23
 * @{
24
 */
25

  
26
#ifndef AMIROLLD_AT24C01B_H
27
#define AMIROLLD_AT24C01B_H
28

  
29
#include <amiro-lld.h>
30

  
31
#if defined(AMIROLLD_CFG_AT24C01B)
32

  
33
#if (AMIROLLD_CFG_AT24C01B == 1)
34
  #include "v1/alld_AT24C01B_v1.h"
35
#else
36
  #error "invalid value assigned to AMIROLLD_CFG_AT24C01B in alldconf.h"
37
#endif
38

  
39
#endif /* defined(AMIROLLD_CFG_AT24C01B) */
40

  
41
#endif /* AMIROLLD_AT24C01B_H */
42

  
43
/** @} */
include/AT24C01B/v1/alld_AT24C01B_v1.h
1
/*
2
AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

  
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU Lesser General Public License for more details.
14

  
15
You should have received a copy of the GNU Lesser General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18

  
19
/**
20
 * @file    alld_AT24C01B_v1.h
21
 * @brief   EEPROM macros and structures.
22
 *
23
 * @addtogroup lld_eeprom
24
 * @{
25
 */
26

  
27
#ifndef AMIROLLD_AT24C01B_V1_H
28
#define AMIROLLD_AT24C01B_V1_H
29

  
30
#include <amiro-lld.h>
31

  
32
#if (defined(AMIROLLD_CFG_AT24C01B) && (AMIROLLD_CFG_AT24C01B == 1)) || defined(__DOXYGEN__)
33

  
34
/******************************************************************************/
35
/* CONSTANTS                                                                  */
36
/******************************************************************************/
37

  
38
/**
39
 * @brief Memory size of the EEPROM in bits.
40
 */
41
#define AT24C01B_LLD_SIZE_BITS              1024
42

  
43
/**
44
 * @brief Memory size of the EEPROM in bytes
45
 */
46
#define AT24C01B_LLD_SIZE_BYTES             128
47

  
48

  
49
/**
50
 * @brief Size of a page in bytes
51
 */
52
#define AT24C01B_LLD_PAGE_SIZE_BYTES        8
53

  
54
/**
55
 * @brief  Time in microseconds a write operation takes to complete (I2C will not respond).
56
 * @note   The system should wait slightly longer.
57
 */
58
#define AT24C01B_LLD_WRITECYCLETIME_US      5000
59

  
60
/**
61
 * @brief Maximum I2C frequency.
62
 */
63
#define AT24C01B_LLD_I2C_MAXFREQUENCY       400000
64

  
65
/**
66
 * @brief Maximum I2C frequency at 5V.
67
 */
68
#define AT24C01B_LLD_I2C_MAXFREQUENCY_5V    1000000
69

  
70

  
71
/******************************************************************************/
72
/* SETTINGS                                                                   */
73
/******************************************************************************/
74

  
75
/******************************************************************************/
76
/* CHECKS                                                                     */
77
/******************************************************************************/
78

  
79
/******************************************************************************/
80
/* DATA STRUCTURES AND TYPES                                                  */
81
/******************************************************************************/
82

  
83
/**
84
 * @brief The AT24C01B driver struct
85
 */
86
typedef struct {
87
  apalI2CDriver_t* i2cd;  /**< @brief The I2C Driver */
88
  apalI2Caddr_t addr;     /**< @brief The address of the AT24C01B for I2C communication, which is defined by the wiring of the A0, A1, A2 pins */
89
} AT24C01BDriver;
90

  
91
/**
92
 * @brief Bitmasks for the I2C address, including the wiring of the A0, A1, A2 pins.
93
 */
94
enum {
95
  AT24C01B_LLD_I2C_ADDR_FIXED       = 0x0050u,
96
  AT24C01B_LLD_I2C_ADDR_A0          = 0x0001u,
97
  AT24C01B_LLD_I2C_ADDR_A1          = 0x0002u,
98
  AT24C01B_LLD_I2C_ADDR_A2          = 0x0004u,
99
};
100

  
101
/******************************************************************************/
102
/* MACROS                                                                     */
103
/******************************************************************************/
104

  
105
/******************************************************************************/
106
/* EXTERN DECLARATIONS                                                        */
107
/******************************************************************************/
108

  
109
#ifdef __cplusplus
110
extern "C" {
111
#endif
112
  apalExitStatus_t at24c01b_lld_poll_ack(const AT24C01BDriver* const at24c01b, const apalTime_t timeout);
113
  apalExitStatus_t at24c01b_lld_read_current_address(const AT24C01BDriver* const at24c01b, uint8_t* const data, const uint8_t num, const apalTime_t timeout);
114
  apalExitStatus_t at24c01b_lld_read(const AT24C01BDriver* const at24c01b, const uint8_t addr, uint8_t* const data, const uint8_t num, const apalTime_t timeout);
115
  apalExitStatus_t at24c01b_lld_write_byte(const AT24C01BDriver* const at24c01b, const uint8_t addr, const uint8_t data, const apalTime_t timeout);
116
  apalExitStatus_t at24c01b_lld_write_page(const AT24C01BDriver* const at24c01b, const uint8_t addr, const uint8_t* const data, const uint8_t num, const apalTime_t timeout);
117
#ifdef __cplusplus
118
}
119
#endif
120

  
121
/******************************************************************************/
122
/* INLINE FUNCTIONS                                                           */
123
/******************************************************************************/
124

  
125
#endif /* defined(AMIROLLD_CFG_AT24C01B) && (AMIROLLD_CFG_AT24C01B == 1) */
126

  
127
#endif /* AMIROLLD_AT24C01BN_V1_H */
128

  
129
/** @} */
include/AT42QT1050/alld_AT42QT1050.h
1
/*
2
AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

  
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU Lesser General Public License for more details.
14

  
15
You should have received a copy of the GNU Lesser General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18

  
19
/**
20
 * @file    alld_AT42QT1050.h
21
 *
22
 * @addtogroup lld_touch
23
 * @{
24
 */
25

  
26
#ifndef AMIROLLD_AT42QT1050_H
27
#define AMIROLLD_AT42QT1050_H
28

  
29
#include <amiro-lld.h>
30

  
31
#if defined(AMIROLLD_CFG_AT42QT1050)
32

  
33
#if (AMIROLLD_CFG_AT42QT1050 == 1)
34
  #include "v1/alld_AT42QT1050_v1.h"
35
#else
36
  #error "invalid value assigned to AMIROLLD_CFG_AT42QT1050 in alldconf.h"
37
#endif
38

  
39
#endif /* defined(AMIROLLD_CFG_AT42QT1050) */
40

  
41
#endif /* AMIROLLD_AT42QT1050_H */
42

  
43
/** @} */
include/AT42QT1050/v1/alld_AT42QT1050_v1.h
1
/*
2
AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

  
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU Lesser General Public License for more details.
14

  
15
You should have received a copy of the GNU Lesser General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18

  
19
/**
20
 * @file    alld_AT42QT1050_v1.h
21
 * @brief   Touch sensor macros and structures.
22
 *
23
 * @addtogroup lld_touch
24
 * @{
25
 */
26

  
27
#ifndef AMIROLLD_AT42QT1050_V1_H
28
#define AMIROLLD_AT42QT1050_V1_H
29

  
30
#include <amiro-lld.h>
31

  
32
#if (defined(AMIROLLD_CFG_AT42QT1050) && (AMIROLLD_CFG_AT42QT1050 == 1)) || defined(__DOXYGEN__)
33

  
34
/******************************************************************************/
35
/* CONSTANTS                                                                  */
36
/******************************************************************************/
37

  
38
/**
39
 * @brief   Maximum I2C frequency.
40
 */
41
#define AT42QT1050_LLD_I2C_MAXFREQUENCY         400000
42

  
43
/**
44
 * @brief   A falling edge indicats an interrupt.
45
 */
46
#define AT42QT1050_LLD_INT_EDGE                 APAL_GPIO_EDGE_FALLING
47

  
48
/**
49
 * @brief   Number of touch keys supported by AT42QT1050.
50
 */
51
#define AT42QT1050_LLD_NUM_KEYS                 5
52

  
53
/**
54
 * @brief   Maximum time (in microseconds) to acquire all key signals before the overflow bit of the detection status register is set.
55
 */
56
#define AT42QT1050_LLD_MAX_KEY_ACQUIRATION_TIME 8000
57

  
58
/**
59
 * @brief   The chip ID as can be read from the according register (constant).
60
 */
61
#define AT42QT1050_LLD_CHIPID                   0x46
62

  
63
/******************************************************************************/
64
/* SETTINGS                                                                   */
65
/******************************************************************************/
66

  
67
/******************************************************************************/
68
/* CHECKS                                                                     */
69
/******************************************************************************/
70

  
71
/******************************************************************************/
72
/* DATA STRUCTURES AND TYPES                                                  */
73
/******************************************************************************/
74

  
75
/**
76
 * @brief   The AT42QT1050Driver sruct.
77
 */
78
typedef struct {
79
  apalI2CDriver_t* i2cd;
80
  apalI2Caddr_t addr;
81
} AT42QT1050Driver;
82

  
83
/**
84
 * @brief   Possible I2C address configurations.
85
 */
86
enum {
87
  AT42QT1050_LLD_I2C_ADDRSEL_LOW  = 0x0041u,  /**< ADDR_SEL pin is pulled low. */
88
  AT42QT1050_LLD_I2C_ADDRSEL_HIGH = 0x0046u,  /**< ADDR_SEL pin is pulled high. */
89
};
90

  
91
/**
92
 * @brief   Available register addresses of the AT42Q1050.
93
 */
94
typedef enum {
95
  AT42QT1050_LLD_REG_CHIPID               = 0x00u,  /**<  read only */
96
  AT42QT1050_LLD_REG_FIRMWAREVERSION      = 0x01u,  /**<  read only */
97
  AT42QT1050_LLD_REG_DETECTIONSTATUS      = 0x02u,  /**<  read only */
98
  AT42QT1050_LLD_REG_KEYSTATUS            = 0x03u,  /**<  read only */
99
  AT42QT1050_LLD_REG_KEYSIGNAL_0          = 0x06u,  /**<  read only */
100
  AT42QT1050_LLD_REG_KEYSIGNAL_1          = 0x08u,  /**<  read only */
101
  AT42QT1050_LLD_REG_KEYSIGNAL_2          = 0x0Du,  /**<  read only */
102
  AT42QT1050_LLD_REG_KEYSIGNAL_3          = 0x0Fu,  /**<  read only */
103
  AT42QT1050_LLD_REG_KEYSIGNAL_4          = 0x11u,  /**<  read only */
104
  AT42QT1050_LLD_REG_REFERENCEDATA_0      = 0x14u,  /**<  read only */
105
  AT42QT1050_LLD_REG_REFERENCEDATA_1      = 0x16u,  /**<  read only */
106
  AT42QT1050_LLD_REG_REFERENCEDATA_2      = 0x1Au,  /**<  read only */
107
  AT42QT1050_LLD_REG_REFERENCEDATA_3      = 0x1Cu,  /**<  read only */
108
  AT42QT1050_LLD_REG_REFERENCEDATA_4      = 0x1Eu,  /**<  read only */
109
  AT42QT1050_LLD_REG_NEGATIVETHRESHOLD_0  = 0x21u,  /**< read/write */
110
  AT42QT1050_LLD_REG_NEGATIVETHRESHOLD_1  = 0x22u,  /**< read/write */
111
  AT42QT1050_LLD_REG_NEGATIVETHRESHOLD_2  = 0x24u,  /**< read/write */
112
  AT42QT1050_LLD_REG_NEGATIVETHRESHOLD_3  = 0x25u,  /**< read/write */
113
  AT42QT1050_LLD_REG_NEGATIVETHRESHOLD_4  = 0x26u,  /**< read/write */
114
  AT42QT1050_LLD_REG_PULSE_SCALE_0        = 0x28u,  /**< read/write */
115
  AT42QT1050_LLD_REG_PULSE_SCALE_1        = 0x29u,  /**< read/write */
116
  AT42QT1050_LLD_REG_PULSE_SCALE_2        = 0x2Bu,  /**< read/write */
117
  AT42QT1050_LLD_REG_PULSE_SCALE_3        = 0x2Cu,  /**< read/write */
118
  AT42QT1050_LLD_REG_PULSE_SCALE_4        = 0x2Du,  /**< read/write */
119
  AT42QT1050_LLD_REG_INTEGRATOR_AKS_0     = 0x2Fu,  /**< read/write */
120
  AT42QT1050_LLD_REG_INTEGRATOR_AKS_1     = 0x30u,  /**< read/write */
121
  AT42QT1050_LLD_REG_INTEGRATOR_AKS_2     = 0x32u,  /**< read/write */
122
  AT42QT1050_LLD_REG_INTEGRATOR_AKS_3     = 0x33u,  /**< read/write */
123
  AT42QT1050_LLD_REG_INTEGRATOR_AKS_4     = 0x34u,  /**< read/write */
124
  AT42QT1050_LLD_REG_CHARGESHAREDELAY_0   = 0x36u,  /**< read/write */
125
  AT42QT1050_LLD_REG_CHARGESHAREDELAY_1   = 0x37u,  /**< read/write */
126
  AT42QT1050_LLD_REG_CHARGESHAREDELAY_2   = 0x39u,  /**< read/write */
127
  AT42QT1050_LLD_REG_CHARGESHAREDELAY_3   = 0x3Au,  /**< read/write */
128
  AT42QT1050_LLD_REG_CHARGESHAREDELAY_4   = 0x3Bu,  /**< read/write */
129
  AT42QT1050_LLD_REG_FINFOUTMAXCALGUARD   = 0x3Cu,  /**< read/write */
130
  AT42QT1050_LLD_REG_LOWPOWERMODE         = 0x3Du,  /**< read/write */
131
  AT42QT1050_LLD_REG_MAXONDURATION        = 0x3Eu,  /**< read/write */
132
  AT42QT1050_LLD_REG_RESET_CALIBRATE      = 0x3Fu,  /**< read/write */
133
} at42qt1050_lld_register_t;
134

  
135
/**
136
 * @brief   Firmware version register structure.
137
 */
138
typedef union {
139
  uint8_t raw;
140
  struct {
141
    uint8_t minor : 4;
142
    uint8_t major : 4;
143
  };
144
} at42qt1050_lld_firmwarereg_t;
145

  
146

  
147
/**
148
 * @brief   Relevant bits of the detection status register.
149
 */
150
typedef enum {
151
  AT42QT1050_LLD_DETECTIONSTATUS_TOUCH      = 0x01u,  /**< Set if any keys are in detect.  */
152
  AT42QT1050_LLD_DETECTIONSTATUS_OVERFLOW   = 0x40u,  /**< Set if the time to acquire all key signals exceeds 8ms. */
153
  AT42QT1050_LLD_DETECTIONSTATUS_CALIBRATE  = 0x80u,  /**< Set during calibration sequence. */
154
} at42q1050_lld_detectionstatusreg_t;
155

  
156
/**
157
 * @brief   Key status register masks.
158
 */
159
typedef enum {
160
  AT42QT1050_LLD_KEYSTATUS_KEY0 = 0x02u,
161
  AT42QT1050_LLD_KEYSTATUS_KEY1 = 0x04u,
162
  AT42QT1050_LLD_KEYSTATUS_KEY2 = 0x10u,
163
  AT42QT1050_LLD_KEYSTATUS_KEY3 = 0x20u,
164
  AT42QT1050_LLD_KEYSTATUS_KEY4 = 0x40u,
165
} at42qt1050_lld_keystatusreg_t;
166

  
167
/**
168
 * @brief   Pulse/Scale register structure.
169
 */
170
typedef union {
171
  uint8_t raw;
172
  struct {
173
    uint8_t scale : 4;
174
    uint8_t pulse : 4;
175
  };
176
} at42qt1050_lld_pulsescalereg_t;
177

  
178
/**
179
 * @brief   Detection Integrator (DI) / AKS register structure.
180
 */
181
typedef union {
182
  uint8_t raw;
183
  struct {
184
    uint8_t aks : 2;
185
    uint8_t detection_integrator : 6;
186
  };
187
} at42qt1050_lld_detectionintegratoraksreg_t;
188

  
189
/**
190
 * @brief   Charge share delay constant sclaing factor.
191
 * @details Values in the charge share delay registers are multiplied by this factor.
192
 *          Unit is microseconds (µs).
193
 */
194
#define AT42QT1050_LLD_CHARGESHAREDELAY_FACTOR  2.5f
195

  
196
/**
197
 * @brief   FastIn / FastOutDI / Max Cal / Guard Channel register masks.
198
 */
199
typedef enum {
200
  AT42QT1050_LLD_FINFOUTMAXCALGUARD_GUARD   = 0x0Fu,
201
  AT42QT1050_LLD_FINFOUTMAXCALGUARD_MAXCAL  = 0x10u,
202
  AT42QT1050_LLD_FINFOUTMAXCALGUARD_FO      = 0x20u,
203
  AT42QT1050_LLD_FINFOUTMAXCALGUARD_FI      = 0x40u,
204
} at42qt1050_lld_finfoutmaxcalguardreg_t;
205

  
206
/**
207
 * @brief   Low power mode constant scaling factor.
208
 * @details The values in the low poer mode register is multiplied by this factor.
209
 *          Unit is microseconds (µs).
210
 * @note    Setting the power mode scaling register value to zero makes the AT42QT1050 enter deep-sleep mode.
211
 */
212
#define AT42QT1050_LLD_LOWPOWER_FACTOR          8000
213

  
214
/**
215
 * @brief   Man on duration constant scaling factor.
216
 * @details The value in the max on duration register is multiplied by this factor.
217
 *          Unit is microseconds (µs).
218
 */
219
#define AT42QT1050_LLD_MAXONDURATION_FACTOR     160000
220

  
221
/**
222
 * @brief   RESET / Calibrate register masks.
223
 */
224
typedef enum {
225
  AT42QT1050_LLD_RESETCALIBRATE_CALIBRATE = 0x7Fu,
226
  AT42QT1050_LLD_RESETCALIBRATE_RESET     = 0x80u,
227
} at42qt1050_lld_resetcalibratereg_t;
228

  
229
/******************************************************************************/
230
/* MACROS                                                                     */
231
/******************************************************************************/
232

  
233
/******************************************************************************/
234
/* EXTERN DECLARATIONS                                                        */
235
/******************************************************************************/
236

  
237
#ifdef __cplusplus
238
extern "C" {
239
#endif
240
  apalExitStatus_t at42qt1050_lld_read_reg(const AT42QT1050Driver* at42qt1050d, const at42qt1050_lld_register_t reg, uint8_t* const data, const apalTime_t timeout);
241
  apalExitStatus_t at42qt1050_lld_write_reg(const AT42QT1050Driver* at42qt1050d, const at42qt1050_lld_register_t reg, const uint8_t data, const apalTime_t timeout);
242

  
243
  apalExitStatus_t at42qt1050_lld_read_keyssignal(const AT42QT1050Driver* at42qt1050d, const uint8_t key, uint16_t* signal, const apalTime_t timeout);
244
  apalExitStatus_t at42qt1050_lld_read_referencedata(const AT42QT1050Driver* at42qt1050d, const uint8_t key, uint16_t* refdata, const apalTime_t timeout);
245

  
246
  uint16_t at42qt1050_lld_pulse2samples(const uint8_t pulse);
247
  float at42qt1050_lld_samples2pulse(const uint16_t samples);
248
  uint16_t at42qt1050_lld_scale2scaling(const uint8_t scale);
249
  float at42qt1050_lld_scaling2scale(const uint16_t factor);
250
#ifdef __cplusplus
251
}
252
#endif
253

  
254
/******************************************************************************/
255
/* INLINE FUNCTIONS                                                           */
256
/******************************************************************************/
257

  
258
#endif /* defined(AMIROLLD_CFG_AT42QT1050) && (AMIROLLD_CFG_AT42QT1050 == 1) */
259

  
260
#endif /* AMIROLLD_AT42QT1050_V1_H */
261

  
262
/** @} */
include/DW1000/alld_DW1000.h
1
/*
2
AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

  
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU Lesser General Public License for more details.
14

  
15
You should have received a copy of the GNU Lesser General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18

  
19
/**
20
 * @file    alld_DW1000.h
21
 *
22
 * @addtogroup lld_uwb
23
 * @{
24
 */
25

  
26
#ifndef AMIROLLD_DW1000_H
27
#define AMIROLLD_DW1000_H
28

  
29
#include <amiro-lld.h>
30

  
31
#if defined(AMIROLLD_CFG_DW1000)
32

  
33
#error "DW1000 LLD implementation is not ready yet."
34

  
35
#endif /* defined(AMIROLLD_CFG_DW1000) */
36

  
37
#endif /* AMIROLLD_DW1000_H */
38

  
39
/** @} */
include/DW1000/v0/alld_dw1000_regs.h
1
/*! ------------------------------------------------------------------------------------------------------------------
2
 * @file    deca_regs.h
3
 * @brief   DW1000 Register Definitions
4
 *          This file supports assembler and C development for DW1000 enabled devices
5
 *
6
 * @attention
7
 *
8
 * Copyright 2013 (c) Decawave Ltd, Dublin, Ireland.
9
 *
10
 * All rights reserved.
11
 *
12
 */
13

  
14
#ifndef _DECA_REGS_H_
15
#define _DECA_REGS_H_
16

  
17
#ifdef __cplusplus
18
extern "C" {
19
#endif
20

  
21
#include <amiro-lld.h>
22
#if defined(AMIROLLD_CFG_USE_DW1000) || defined(__DOXYGEN__)
23

  
24
/****************************************************************************//**
25
 * @brief Bit definitions for register DEV_ID
26
**/
27
#define DEV_ID_ID               0x00            /* Device ID register, includes revision info (0xDECA0130) */
28
#define DEV_ID_LEN              (4)
29
/* mask and shift */
30
#define DEV_ID_REV_MASK         0x0000000FUL    /* Revision */
31
#define DEV_ID_VER_MASK         0x000000F0UL    /* Version */
32
#define DEV_ID_MODEL_MASK       0x0000FF00UL    /* The MODEL identifies the device. The DW1000 is device type 0x01 */
33
#define DEV_ID_RIDTAG_MASK      0xFFFF0000UL    /* Register Identification Tag 0XDECA */
34

  
35
/****************************************************************************//**
36
 * @brief Bit definitions for register EUI_64
37
**/
38
#define EUI_64_ID               0x01            /* IEEE Extended Unique Identifier (63:0) */
39
#define EUI_64_OFFSET           0x00
40
#define EUI_64_LEN              (8)
41

  
42
/****************************************************************************//**
43
 * @brief Bit definitions for register PANADR
44
**/
45
#define PANADR_ID               0x03            /* PAN ID (31:16) and Short Address (15:0) */
46
#define PANADR_LEN              (4)
47
/*mask and shift */
48
#define PANADR_SHORT_ADDR_OFFSET 0              /* In bytes */
49
#define PANADR_SHORT_ADDR_MASK  0x0000FFFFUL    /* Short Address */
50
#define PANADR_PAN_ID_OFFSET     2              /* In bytes */
51
#define PANADR_PAN_ID_MASK      0xFFFF00F0UL    /* PAN Identifier */
52

  
53
/****************************************************************************//**
54
 * @brief Bit definitions for register 0x05
55
**/
56
#define REG_05_ID_RESERVED      0x05
57

  
58
/****************************************************************************//**
59
 * @brief Bit definitions for register SYS_CFG
60
**/
61
#define SYS_CFG_ID              0x04            /* System Configuration (31:0) */
62
#define SYS_CFG_LEN             (4)
63
/*mask and shift */
64
#define SYS_CFG_MASK            0xF047FFFFUL    /* access mask to SYS_CFG_ID */
65
#define SYS_CFG_FF_ALL_EN       0x000001FEUL    /* Frame filtering options all frames allowed */
66
/*offset 0 */
67
#define SYS_CFG_FFE             0x00000001UL    /* Frame Filtering Enable. This bit enables the frame filtering functionality */
68
#define SYS_CFG_FFBC            0x00000002UL    /* Frame Filtering Behave as a Co-ordinator */
69
#define SYS_CFG_FFAB            0x00000004UL    /* Frame Filtering Allow Beacon frame reception */
70
#define SYS_CFG_FFAD            0x00000008UL    /* Frame Filtering Allow Data frame reception */
71
#define SYS_CFG_FFAA            0x00000010UL    /* Frame Filtering Allow Acknowledgment frame reception */
72
#define SYS_CFG_FFAM            0x00000020UL    /* Frame Filtering Allow MAC command frame reception */
73
#define SYS_CFG_FFAR            0x00000040UL    /* Frame Filtering Allow Reserved frame types */
74
#define SYS_CFG_FFA4            0x00000080UL    /* Frame Filtering Allow frames with frame type field of 4, (binary 100) */
75
/*offset 8 */
76
#define SYS_CFG_FFA5            0x00000100UL    /* Frame Filtering Allow frames with frame type field of 5, (binary 101) */
77
#define SYS_CFG_HIRQ_POL        0x00000200UL    /* Host interrupt polarity */
78
#define SYS_CFG_SPI_EDGE        0x00000400UL    /* SPI data launch edge */
79
#define SYS_CFG_DIS_FCE         0x00000800UL    /* Disable frame check error handling */
80
#define SYS_CFG_DIS_DRXB        0x00001000UL    /* Disable Double RX Buffer */
81
#define SYS_CFG_DIS_PHE         0x00002000UL    /* Disable receiver abort on PHR error */
82
#define SYS_CFG_DIS_RSDE        0x00004000UL    /* Disable Receiver Abort on RSD error */
83
#define SYS_CFG_FCS_INIT2F      0x00008000UL    /* initial seed value for the FCS generation and checking function */
84
/*offset 16 */
85
#define SYS_CFG_PHR_MODE_SHFT   16
86
#define SYS_CFG_PHR_MODE_00     0x00000000UL    /* Standard Frame mode */
87
#define SYS_CFG_PHR_MODE_11     0x00030000UL    /* Long Frames mode */
88
#define SYS_CFG_DIS_STXP        0x00040000UL    /* Disable Smart TX Power control */
89
#define SYS_CFG_RXM110K         0x00400000UL    /* Receiver Mode 110 kbps data rate */
90
/*offset 24 */
91
#define SYS_CFG_RXWTOE          0x10000000UL    /* Receive Wait Timeout Enable. */
92
#define SYS_CFG_RXAUTR          0x20000000UL    /* Receiver Auto-Re-enable. This bit is used to cause the receiver to re-enable automatically */
93
#define SYS_CFG_AUTOACK         0x40000000UL    /* Automatic Acknowledgement Enable */
94
#define SYS_CFG_AACKPEND        0x80000000UL    /* Automatic Acknowledgement Pending bit control */
95

  
96

  
97
/****************************************************************************//**
98
 * @brief Bit definitions for register SYS_TIME
99
**/
100
#define SYS_TIME_ID             0x06            /* System Time Counter (40-bit) */
101
#define SYS_TIME_OFFSET         0x00
102
#define SYS_TIME_LEN            (5)             /* Note 40 bit register */
103

  
104

  
105
/****************************************************************************//**
106
 * @brief Bit definitions for register  0x07
107
**/
108
#define REG_07_ID_RESERVED      0x07
109

  
110
/****************************************************************************//**
111
 * @brief Bit definitions for register TX_FCTRL
112
**/
113
#define TX_FCTRL_ID             0x08            /* Transmit Frame Control */
114
#define TX_FCTRL_LEN            (5)             /* Note 40 bit register */
115
/*masks (low 32 bit) */
116
#define TX_FCTRL_TFLEN_MASK     0x0000007FUL    /* bit mask to access Transmit Frame Length */
117
#define TX_FCTRL_TFLE_MASK      0x00000380UL    /* bit mask to access Transmit Frame Length Extension */
118
#define TX_FCTRL_FLE_MASK       0x000003FFUL    /* bit mask to access Frame Length field */
119
#define TX_FCTRL_TXBR_MASK      0x00006000UL    /* bit mask to access Transmit Bit Rate */
120
#define TX_FCTRL_TXPRF_MASK     0x00030000UL    /* bit mask to access Transmit Pulse Repetition Frequency */
121
#define TX_FCTRL_TXPSR_MASK     0x000C0000UL    /* bit mask to access Transmit Preamble Symbol Repetitions (PSR). */
122
#define TX_FCTRL_PE_MASK        0x00300000UL    /* bit mask to access Preamble Extension */
123
#define TX_FCTRL_TXPSR_PE_MASK  0x003C0000UL    /* bit mask to access Transmit Preamble Symbol Repetitions (PSR). */
124
#define TX_FCTRL_SAFE_MASK_32   0xFFFFE3FFUL    /* FSCTRL has fields which should always be writen zero */
125
/*offset 0 */
126
/*offset 8 */
127
#define TX_FCTRL_TXBR_110k      0x00000000UL    /* Transmit Bit Rate = 110k */
128
#define TX_FCTRL_TXBR_850k      0x00002000UL    /* Transmit Bit Rate = 850k */
129
#define TX_FCTRL_TXBR_6M        0x00004000UL    /* Transmit Bit Rate = 6.8M */
130
#define TX_FCTRL_TXBR_SHFT      (13)            /* shift to access Data Rate field */
131
#define TX_FCTRL_TR             0x00008000UL    /* Transmit Ranging enable */
132
#define TX_FCTRL_TR_SHFT        (15)            /* shift to access Ranging bit */
133
/*offset 16 */
134
#define TX_FCTRL_TXPRF_SHFT     (16)            /* shift to access Pulse Repetition Frequency field */
135
#define TX_FCTRL_TXPRF_4M       0x00000000UL    /* Transmit Pulse Repetition Frequency = 4 Mhz */
136
#define TX_FCTRL_TXPRF_16M      0x00010000UL    /* Transmit Pulse Repetition Frequency = 16 Mhz */
137
#define TX_FCTRL_TXPRF_64M      0x00020000UL    /* Transmit Pulse Repetition Frequency = 64 Mhz */
138
#define TX_FCTRL_TXPSR_SHFT     (18)            /* shift to access Preamble Symbol Repetitions field */
139
#define TX_FCTRL_PE_SHFT        (20)            /* shift to access Preamble length Extension to allow specification of non-standard values */
140
#define TX_FCTRL_TXPSR_PE_16    0x00000000UL    /* bit mask to access Preamble Extension = 16 */
141
#define TX_FCTRL_TXPSR_PE_64    0x00040000UL    /* bit mask to access Preamble Extension = 64 */
142
#define TX_FCTRL_TXPSR_PE_128   0x00140000UL    /* bit mask to access Preamble Extension = 128 */
143
#define TX_FCTRL_TXPSR_PE_256   0x00240000UL    /* bit mask to access Preamble Extension = 256 */
144
#define TX_FCTRL_TXPSR_PE_512   0x00340000UL    /* bit mask to access Preamble Extension = 512 */
145
#define TX_FCTRL_TXPSR_PE_1024  0x00080000UL    /* bit mask to access Preamble Extension = 1024 */
146
#define TX_FCTRL_TXPSR_PE_1536  0x00180000UL    /* bit mask to access Preamble Extension = 1536 */
147
#define TX_FCTRL_TXPSR_PE_2048  0x00280000UL    /* bit mask to access Preamble Extension = 2048 */
148
#define TX_FCTRL_TXPSR_PE_4096  0x000C0000UL    /* bit mask to access Preamble Extension = 4096 */
149
/*offset 22 */
150
#define TX_FCTRL_TXBOFFS_SHFT   (22)            /* Shift to access transmit buffer index offset */
151
#define TX_FCTRL_TXBOFFS_MASK   0xFFC00000UL    /* bit mask to access Transmit buffer index offset 10-bit field */
152
/*offset 32 */
153
#define TX_FCTRL_IFSDELAY_MASK  0xFF00000000ULL /* bit mask to access Inter-Frame Spacing field */
154

  
155
/****************************************************************************//**
156
 * @brief Bit definitions for register TX_BUFFER
157
**/
158
#define TX_BUFFER_ID            0x09            /* Transmit Data Buffer */
159
#define TX_BUFFER_LEN           (1024)
160

  
161
/****************************************************************************//**
162
 * @brief Bit definitions for register  DX_TIME
163
**/
164
#define DX_TIME_ID              0x0A            /* Delayed Send or Receive Time (40-bit) */
165
#define DX_TIME_LEN             (5)
166

  
167
/****************************************************************************//**
168
 * @brief Bit definitions for register 0x08
169
**/
170
#define REG_0B_ID_RESERVED      0x0B
171

  
172
/****************************************************************************//**
173
 * @brief Bit definitions for register RX_FWTO
174
**/
175
#define RX_FWTO_ID              0x0C            /* Receive Frame Wait Timeout Period */
176
#define RX_FWTO_OFFSET          0x00
177
#define RX_FWTO_LEN             (2)             /* doc bug*/
178
/*mask and shift */
179
#define RX_FWTO_MASK            0xFFFF
180

  
181
/****************************************************************************//**
182
 * @brief Bit definitions for register SYS_CTRL
183
**/
184
#define SYS_CTRL_ID             0x0D            /* System Control Register */
185
#define SYS_CTRL_OFFSET         0x00
186
#define SYS_CTRL_LEN            (4)
187
/*masks */
188
#define SYS_CTRL_MASK_32        0x010003CFUL    /* System Control Register access mask (all unused fields should always be writen as zero) */
189
/*offset 0 */
190
#define SYS_CTRL_SFCST          0x00000001UL    /* Suppress Auto-FCS Transmission (on this frame) */
191
#define SYS_CTRL_TXSTRT         0x00000002UL    /* Start Transmitting Now */
192
#define SYS_CTRL_TXDLYS         0x00000004UL    /* Transmitter Delayed Sending (initiates sending when SYS_TIME == TXD_TIME */
193
#define SYS_CTRL_CANSFCS        0x00000008UL    /* Cancel Suppression of auto-FCS transmission (on the current frame) */
194
#define SYS_CTRL_TRXOFF         0x00000040UL    /* Transceiver Off. Force Transciever OFF abort TX or RX immediately */
195
#define SYS_CTRL_WAIT4RESP      0x00000080UL    /* Wait for Response */
196
/*offset 8 */
197
#define SYS_CTRL_RXENAB         0x00000100UL    /* Enable Receiver Now */
198
#define SYS_CTRL_RXDLYE         0x00000200UL    /* Receiver Delayed Enable (Enables Receiver when SY_TIME[0x??] == RXD_TIME[0x??] CHECK comment*/
199
/*offset 16 */
200
/*offset 24 */
201
#define SYS_CTRL_HSRBTOGGLE     0x01000000UL    /* Host side receiver buffer pointer toggle - toggles 0/1 host side data set pointer */
202
#define SYS_CTRL_HRBT           (SYS_CTRL_HSRBTOGGLE)
203
#define SYS_CTRL_HRBT_OFFSET    (3)
204

  
205
/****************************************************************************//**
206
 * @brief Bit definitions for register  SYS_MASK
207
**/
208
#define SYS_MASK_ID             0x0E            /* System Event Mask Register */
209
#define SYS_MASK_LEN            (4)
210
/*masks */
211
#define SYS_MASK_MASK_32        0x3FF7FFFEUL    /* System Event Mask Register access mask (all unused fields should always be writen as zero) */
212
/*offset 0 */
213
#define SYS_MASK_MCPLOCK        0x00000002UL    /* Mask clock PLL lock event    */
214
#define SYS_MASK_MESYNCR        0x00000004UL    /* Mask clock PLL lock event    */
215
#define SYS_MASK_MAAT           0x00000008UL    /* Mask automatic acknowledge trigger event */
216
#define SYS_MASK_MTXFRB         0x00000010UL    /* Mask transmit frame begins event */
217
#define SYS_MASK_MTXPRS         0x00000020UL    /* Mask transmit preamble sent event    */
218
#define SYS_MASK_MTXPHS         0x00000040UL    /* Mask transmit PHY Header Sent event  */
219
#define SYS_MASK_MTXFRS         0x00000080UL    /* Mask transmit frame sent event   */
220
/*offset 8 */
221
#define SYS_MASK_MRXPRD         0x00000100UL    /* Mask receiver preamble detected event    */
222
#define SYS_MASK_MRXSFDD        0x00000200UL    /* Mask receiver SFD detected event */
223
#define SYS_MASK_MLDEDONE       0x00000400UL    /* Mask LDE processing done event   */
224
#define SYS_MASK_MRXPHD         0x00000800UL    /* Mask receiver PHY header detect event    */
225
#define SYS_MASK_MRXPHE         0x00001000UL    /* Mask receiver PHY header error event */
226
#define SYS_MASK_MRXDFR         0x00002000UL    /* Mask receiver data frame ready event */
227
#define SYS_MASK_MRXFCG         0x00004000UL    /* Mask receiver FCS good event */
228
#define SYS_MASK_MRXFCE         0x00008000UL    /* Mask receiver FCS error event    */
229
/*offset 16 */
230
#define SYS_MASK_MRXRFSL        0x00010000UL    /* Mask receiver Reed Solomon Frame Sync Loss event */
231
#define SYS_MASK_MRXRFTO        0x00020000UL    /* Mask Receive Frame Wait Timeout event    */
232
#define SYS_MASK_MLDEERR        0x00040000UL    /* Mask leading edge detection processing error event   */
233
#define SYS_MASK_MRXOVRR        0x00100000UL    /* Mask Receiver Overrun event  */
234
#define SYS_MASK_MRXPTO         0x00200000UL    /* Mask Preamble detection timeout event    */
235
#define SYS_MASK_MGPIOIRQ       0x00400000UL    /* Mask GPIO interrupt event    */
236
#define SYS_MASK_MSLP2INIT      0x00800000UL    /* Mask SLEEP to INIT event */
237
/*offset 24*/
238
#define SYS_MASK_MRFPLLLL       0x01000000UL    /* Mask RF PLL Loosing Lock warning event   */
239
#define SYS_MASK_MCPLLLL        0x02000000UL    /* Mask Clock PLL Loosing Lock warning event    */
240
#define SYS_MASK_MRXSFDTO       0x04000000UL    /* Mask Receive SFD timeout event   */
241
#define SYS_MASK_MHPDWARN       0x08000000UL    /* Mask Half Period Delay Warning event */
242
#define SYS_MASK_MTXBERR        0x10000000UL    /* Mask Transmit Buffer Error event */
243
#define SYS_MASK_MAFFREJ        0x20000000UL    /* Mask Automatic Frame Filtering rejection event   */
244

  
245
/****************************************************************************//**
246
 * @brief Bit definitions for register SYS_STATUS
247
**/
248
#define SYS_STATUS_ID           0x0F            /* System event Status Register */
249
#define SYS_STATUS_OFFSET       0x00
250
#define SYS_STATUS_LEN          (5)             /* Note 40 bit register */
251
/*masks */
252
#define SYS_STATUS_MASK_32      0xFFF7FFFFUL    /* System event Status Register access mask (all unused fields should always be writen as zero) */
253
/*offset 0 */
254
#define SYS_STATUS_IRQS         0x00000001UL    /* Interrupt Request Status READ ONLY */
255
#define SYS_STATUS_CPLOCK       0x00000002UL    /* Clock PLL Lock */
256
#define SYS_STATUS_ESYNCR       0x00000004UL    /* External Sync Clock Reset */
257
#define SYS_STATUS_AAT          0x00000008UL    /* Automatic Acknowledge Trigger */
258
#define SYS_STATUS_TXFRB        0x00000010UL    /* Transmit Frame Begins */
259
#define SYS_STATUS_TXPRS        0x00000020UL    /* Transmit Preamble Sent */
260
#define SYS_STATUS_TXPHS        0x00000040UL    /* Transmit PHY Header Sent */
261
#define SYS_STATUS_TXFRS        0x00000080UL    /* Transmit Frame Sent: This is set when the transmitter has completed the sending of a frame */
262
/*offset 8 */
263
#define SYS_STATUS_RXPRD        0x00000100UL    /* Receiver Preamble Detected status */
264
#define SYS_STATUS_RXSFDD       0x00000200UL    /* Receiver Start Frame Delimiter Detected. */
265
#define SYS_STATUS_LDEDONE      0x00000400UL    /* LDE processing done */
266
#define SYS_STATUS_RXPHD        0x00000800UL    /* Receiver PHY Header Detect */
267
#define SYS_STATUS_RXPHE        0x00001000UL    /* Receiver PHY Header Error */
268
#define SYS_STATUS_RXDFR        0x00002000UL    /* Receiver Data Frame Ready */
269
#define SYS_STATUS_RXFCG        0x00004000UL    /* Receiver FCS Good */
270
#define SYS_STATUS_RXFCE        0x00008000UL    /* Receiver FCS Error */
271
/*offset 16 */
272
#define SYS_STATUS_RXRFSL       0x00010000UL    /* Receiver Reed Solomon Frame Sync Loss */
273
#define SYS_STATUS_RXRFTO       0x00020000UL    /* Receive Frame Wait Timeout */
274
#define SYS_STATUS_LDEERR       0x00040000UL    /* Leading edge detection processing error */
275
#define SYS_STATUS_reserved     0x00080000UL    /* bit19 reserved */
276
#define SYS_STATUS_RXOVRR       0x00100000UL    /* Receiver Overrun */
277
#define SYS_STATUS_RXPTO        0x00200000UL    /* Preamble detection timeout */
278
#define SYS_STATUS_GPIOIRQ      0x00400000UL    /* GPIO interrupt */
279
#define SYS_STATUS_SLP2INIT     0x00800000UL    /* SLEEP to INIT */
280
/*offset 24 */
281
#define SYS_STATUS_RFPLL_LL     0x01000000UL    /* RF PLL Losing Lock */
282
#define SYS_STATUS_CLKPLL_LL    0x02000000UL    /* Clock PLL Losing Lock */
283
#define SYS_STATUS_RXSFDTO      0x04000000UL    /* Receive SFD timeout */
284
#define SYS_STATUS_HPDWARN      0x08000000UL    /* Half Period Delay Warning */
285
#define SYS_STATUS_TXBERR       0x10000000UL    /* Transmit Buffer Error */
286
#define SYS_STATUS_AFFREJ       0x20000000UL    /* Automatic Frame Filtering rejection */
287
#define SYS_STATUS_HSRBP        0x40000000UL    /* Host Side Receive Buffer Pointer */
288
#define SYS_STATUS_ICRBP        0x80000000UL    /* IC side Receive Buffer Pointer READ ONLY */
289
/*offset 32 */
290
#define SYS_STATUS_RXRSCS       0x0100000000ULL /* Receiver Reed-Solomon Correction Status */
291
#define SYS_STATUS_RXPREJ       0x0200000000ULL /* Receiver Preamble Rejection */
292
#define SYS_STATUS_TXPUTE       0x0400000000ULL /* Transmit power up time error */
293

  
294
#define SYS_STATUS_TXERR        (0x0408)        /* These bits are the 16 high bits of status register TXPUTE and HPDWARN flags */
295

  
296
/* All RX events after a correct packet reception mask. */
297
#define SYS_STATUS_ALL_RX_GOOD (SYS_STATUS_RXDFR | SYS_STATUS_RXFCG | SYS_STATUS_RXPRD | \
298
                                SYS_STATUS_RXSFDD | SYS_STATUS_RXPHD | SYS_STATUS_LDEDONE)
299

  
300
/* All double buffer events mask. */
301
#define SYS_STATUS_ALL_DBLBUFF (SYS_STATUS_RXDFR | SYS_STATUS_RXFCG)
302

  
303
/* All RX errors mask. */
304
#define SYS_STATUS_ALL_RX_ERR  (SYS_STATUS_RXPHE | SYS_STATUS_RXFCE | SYS_STATUS_RXRFSL | SYS_STATUS_RXSFDTO \
305
                                | SYS_STATUS_AFFREJ | SYS_STATUS_LDEERR)
306

  
307
/* User defined RX timeouts (frame wait timeout and preamble detect timeout) mask. */
308
#define SYS_STATUS_ALL_RX_TO   (SYS_STATUS_RXRFTO | SYS_STATUS_RXPTO)
309

  
310
/* All TX events mask. */
311
#define SYS_STATUS_ALL_TX      (SYS_STATUS_AAT | SYS_STATUS_TXFRB | SYS_STATUS_TXPRS | \
312
                                SYS_STATUS_TXPHS | SYS_STATUS_TXFRS )
313

  
314

  
315
/****************************************************************************//**
316
 * @brief Bit definitions for register RX_FINFO
317
**/
318
#define RX_FINFO_ID             0x10            /* RX Frame Information (in double buffer set) */
319
#define RX_FINFO_OFFSET         0x00
320
#define RX_FINFO_LEN            (4)
321
/*mask and shift */
322
#define RX_FINFO_MASK_32        0xFFFFFBFFUL    /* System event Status Register access mask (all unused fields should always be writen as zero) */
323
#define RX_FINFO_RXFLEN_MASK    0x0000007FUL    /* Receive Frame Length (0 to 127) */
324
#define RX_FINFO_RXFLE_MASK     0x00000380UL    /* Receive Frame Length Extension (0 to 7)<<7 */
325
#define RX_FINFO_RXFL_MASK_1023 0x000003FFUL    /* Receive Frame Length Extension (0 to 1023) */
326

  
327
#define RX_FINFO_RXNSPL_MASK    0x00001800UL    /* Receive Non-Standard Preamble Length */
328
#define RX_FINFO_RXPSR_MASK     0x000C0000UL    /* RX Preamble Repetition. 00 = 16 symbols, 01 = 64 symbols, 10 = 1024 symbols, 11 = 4096 symbols */
329

  
330
#define RX_FINFO_RXPEL_MASK     0x000C1800UL    /* Receive Preamble Length = RXPSR+RXNSPL */
331
#define RX_FINFO_RXPEL_64       0x00040000UL    /* Receive Preamble length = 64 */
332
#define RX_FINFO_RXPEL_128      0x00040800UL    /* Receive Preamble length = 128 */
333
#define RX_FINFO_RXPEL_256      0x00041000UL    /* Receive Preamble length = 256 */
334
#define RX_FINFO_RXPEL_512      0x00041800UL    /* Receive Preamble length = 512 */
335
#define RX_FINFO_RXPEL_1024     0x00080000UL    /* Receive Preamble length = 1024 */
336
#define RX_FINFO_RXPEL_1536     0x00080800UL    /* Receive Preamble length = 1536 */
337
#define RX_FINFO_RXPEL_2048     0x00081000UL    /* Receive Preamble length = 2048 */
338
#define RX_FINFO_RXPEL_4096     0x000C0000UL    /* Receive Preamble length = 4096 */
339

  
340
#define RX_FINFO_RXBR_MASK      0x00006000UL    /* Receive Bit Rate report. This field reports the received bit rate */
341
#define RX_FINFO_RXBR_110k      0x00000000UL    /* Received bit rate = 110 kbps */
342
#define RX_FINFO_RXBR_850k      0x00002000UL    /* Received bit rate = 850 kbps */
343
#define RX_FINFO_RXBR_6M        0x00004000UL    /* Received bit rate = 6.8 Mbps */
344
#define RX_FINFO_RXBR_SHIFT     (13)
345

  
346
#define RX_FINFO_RNG            0x00008000UL    /* Receiver Ranging. Ranging bit in the received PHY header identifying the frame as a ranging packet. */
347
#define RX_FINFO_RNG_SHIFT      (15)
348

  
349
#define RX_FINFO_RXPRF_MASK     0x00030000UL    /* RX Pulse Repetition Rate report */
350
#define RX_FINFO_RXPRF_16M      0x00010000UL    /* PRF being employed in the receiver = 16M */
351
#define RX_FINFO_RXPRF_64M      0x00020000UL    /* PRF being employed in the receiver = 64M */
352
#define RX_FINFO_RXPRF_SHIFT    (16)
353

  
354
#define RX_FINFO_RXPACC_MASK    0xFFF00000UL    /* Preamble Accumulation Count */
355
#define RX_FINFO_RXPACC_SHIFT   (20)
356

  
357

  
358
/****************************************************************************//**
359
 * @brief Bit definitions for register RX_BUFFER
360
**/
361
#define RX_BUFFER_ID            0x11            /* Receive Data Buffer (in double buffer set) */
362
#define RX_BUFFER_LEN           (1024)
363

  
364

  
365
/****************************************************************************//**
366
 * @brief Bit definitions for register RX_FQUAL
367
**/
368
#define RX_FQUAL_ID             0x12            /* Rx Frame Quality information (in double buffer set) */
369
#define RX_FQUAL_LEN            (8)             /* note 64 bit register*/
370
/*mask and shift */
371
/*offset 0 */
372
#define RX_EQUAL_STD_NOISE_MASK 0x0000FFFFULL   /* Standard Deviation of Noise */
373
#define RX_EQUAL_STD_NOISE_SHIFT (0)
374
#define STD_NOISE_MASK          RX_EQUAL_STD_NOISE_MASK
375
#define STD_NOISE_SHIFT         RX_EQUAL_STD_NOISE_SHIFT
376
/*offset 16 */
377
#define RX_EQUAL_FP_AMPL2_MASK  0xFFFF0000ULL   /* First Path Amplitude point 2 */
378
#define RX_EQUAL_FP_AMPL2_SHIFT (16)
379
#define FP_AMPL2_MASK           RX_EQUAL_FP_AMPL2_MASK
380
#define FP_AMPL2_SHIFT          RX_EQUAL_FP_AMPL2_SHIFT
381
/*offset 32*/
382
#define RX_EQUAL_PP_AMPL3_MASK  0x0000FFFF00000000ULL   /* First Path Amplitude point 3 */
383
#define RX_EQUAL_PP_AMPL3_SHIFT (32)
384
#define PP_AMPL3_MASK           RX_EQUAL_PP_AMPL3_MASK
385
#define PP_AMPL3_SHIFT          RX_EQUAL_PP_AMPL3_SHIFT
386
/*offset 48*/
387
#define RX_EQUAL_CIR_MXG_MASK   0xFFFF000000000000ULL   /* Channel Impulse Response Max Growth */
388
#define RX_EQUAL_CIR_MXG_SHIFT  (48)
389
#define CIR_MXG_MASK            RX_EQUAL_CIR_MXG_MASK
390
#define CIR_MXG_SHIFT           RX_EQUAL_CIR_MXG_SHIFT
391

  
392

  
393

  
394
/****************************************************************************//**
395
 * @brief Bit definitions for register RX_TTCKI
396
 *      The value here is the interval over which the timing offset reported
397
 *      in the RXTOFS field of Register file: 0x14 RX_TTCKO is measured.
398
 *      The clock offset is calculated by dividing RXTTCKI by RXTOFS.
399
 *      The value in RXTTCKI will take just one of two values depending on the PRF: 0x01F00000 @ 16 MHz PRF,
400
 *      and 0x01FC0000 @ 64 MHz PRF.
401
**/
402
#define RX_TTCKI_ID             0x13            /* Receiver Time Tracking Interval (in double buffer set) */
403
#define RX_TTCKI_LEN            (4)
404

  
405
/****************************************************************************//**
406
 * @brief Bit definitions for register RX_TTCKO
407
**/
408
#define RX_TTCKO_ID             0x14            /* Receiver Time Tracking Offset (in double buffer set) */
409
#define RX_TTCKO_LEN            (5)             /* Note 40 bit register */
410
/*mask and shift */
411
#define RX_TTCKO_MASK_32        0xFF07FFFFUL    /* Receiver Time Tracking Offset access mask (all unused fields should always be writen as zero) */
412
/*offset 0 */
413
#define RX_TTCKO_RXTOFS_MASK    0x0007FFFFUL    /* RX time tracking offset. This RXTOFS value is a 19-bit signed quantity*/
414
/*offset 24 */
415
#define RX_TTCKO_RSMPDEL_MASK   0xFF000000UL    /* This 8-bit field reports an internal re-sampler delay value */
416
/*offset 32 */
417
#define RX_TTCKO_RCPHASE_MASK   0x7F0000000000ULL   /* This 7-bit field reports the receive carrier phase adjustment at time the ranging timestamp is made. */
418

  
419

  
420
/****************************************************************************//**
421
 * @brief Bit definitions for register RX_TIME
422
**/
423
#define RX_TIME_ID              0x15            /* Receive Message Time of Arrival (in double buffer set) */
424
#define RX_TIME_LLEN            (14)
425
#define RX_TIME_RX_STAMP_LEN    (5)             /* read only 5 bytes (the adjusted timestamp (40:0)) */
426
#define RX_STAMP_LEN            RX_TIME_RX_STAMP_LEN
427
/*mask and shift */
428
#define RX_TIME_RX_STAMP_OFFSET  (0) /* byte 0..4 40 bit Reports the fully adjusted time of reception. */
429
#define RX_TIME_FP_INDEX_OFFSET  (5)    /* byte 5..6 16 bit First path index. */
430
#define RX_TIME_FP_AMPL1_OFFSET  (7)    /* byte 7..8 16 bit First Path Amplitude point 1 */   /* doc bug */
431
#define RX_TIME_FP_RAWST_OFFSET  (9)    /* byte 9..13 40 bit Raw Timestamp for the frame */
432

  
433

  
434
/****************************************************************************//**
435
 * @brief Bit definitions for register
436
**/
437
#define REG_16_ID_RESERVED      0x16
438

  
439

  
440
/****************************************************************************//**
441
 * @brief Bit definitions for register
442
**/
443
#define TX_TIME_ID              0x17            /* Transmit Message Time of Sending */
444
#define TX_TIME_LLEN            (10)
445
#define TX_TIME_TX_STAMP_LEN    (5)             /* 40-bits = 5 bytes */
446
#define TX_STAMP_LEN            TX_TIME_TX_STAMP_LEN
447
/*mask and shift */
448
#define TX_TIME_TX_STAMP_OFFSET  (0) /* byte 0..4 40 bit Reports the fully adjusted time of transmission */
449
#define TX_TIME_TX_RAWST_OFFSET  (5) /* byte 5..9 40 bit Raw Timestamp for the frame */
450

  
451

  
452

  
453

  
454
/****************************************************************************//**
455
 * @brief Bit definitions for register TX_ANTD
456
**/
457
#define TX_ANTD_ID              0x18            /* 16-bit Delay from Transmit to Antenna */
458
#define TX_ANTD_OFFSET          0x00
459
#define TX_ANTD_LEN             (2)
460

  
461

  
462

  
463

  
464
/****************************************************************************//**
465
 * @brief Bit definitions for register SYS_STATES
466
 *        Register map register file 0x19 is reserved
467
 *
468
**/
469
#define SYS_STATE_ID            0x19            /* System State information READ ONLY */
470
#define SYS_STATE_LEN           (5)
471

  
472
/****************************************************************************//**
473
 * @brief Bit definitions for register ACK_RESP_T
474
**/
475
/* Acknowledge (31:24 preamble symbol delay before auto ACK is sent) and respose (19:0 - unit 1us) timer */
476
#define ACK_RESP_T_ID           0x1A            /* Acknowledgement Time and Response Time */
477
#define ACK_RESP_T_LEN          (4)
478
/*mask and shift */
479
#define ACK_RESP_T_MASK         0xFF0FFFFFUL    /* Acknowledgement Time and Response access mask */
480
#define ACK_RESP_T_W4R_TIM_OFFSET 0             /* In bytes */
481
#define ACK_RESP_T_W4R_TIM_MASK 0x000FFFFFUL    /* Wait-for-Response turn-around Time 20 bit field */
482
#define W4R_TIM_MASK            ACK_RESP_T_W4R_TIM_MASK
483
#define ACK_RESP_T_ACK_TIM_OFFSET 3             /* In bytes */
484
#define ACK_RESP_T_ACK_TIM_MASK 0xFF000000UL    /* Auto-Acknowledgement turn-around Time */
485
#define ACK_TIM_MASK            ACK_RESP_T_ACK_TIM_MASK
486

  
487

  
488

  
489
/****************************************************************************//**
490
 * @brief Bit definitions for register 0x1B 0x1C
491
**/
492
#define REG_1B_ID_RESERVED      0x1B
493
#define REG_1C_ID_RESERVED      0x1C
494

  
495
/****************************************************************************//**
496
 * @brief Bit definitions for register RX_SNIFF
497
 *        Sniff Mode Configuration or Pulsed Preamble Reception Configuration
498
**/
499
#define RX_SNIFF_ID             0x1D            /* Sniff Mode Configuration */
500
#define RX_SNIFF_OFFSET         0x00
501
#define RX_SNIFF_LEN            (4)
502
/*mask and shift */
503
#define RX_SNIFF_MASK           0x0000FF0FUL    /*  */
504
#define RX_SNIFF_SNIFF_ONT_MASK 0x0000000FUL    /* SNIFF Mode ON time. Specified in units of PAC */
505
#define SNIFF_ONT_MASK          RX_SNIFF_SNIFF_ONT_MASK
506
#define RX_SNIFF_SNIFF_OFFT_MASK 0x0000FF00UL   /* SNIFF Mode OFF time specified in units of approximately 1mkS, or 128 system clock cycles.*/
507
#define SNIFF_OFFT_MASK         RX_SNIFF_SNIFF_OFFT_MASK
508

  
509

  
510

  
511
/****************************************************************************//**
512
 * @brief Bit definitions for register TX_POWER
513
**/
514
#define TX_POWER_ID             0x1E            /* TX Power Control */
515
#define TX_POWER_LEN            (4)
516
/*mask and shift definition for Smart Transmit Power Control*/
517
#define TX_POWER_BOOSTNORM_MASK 0x00000000UL    /* This is the normal power setting used for frames that do not fall */
518
#define BOOSTNORM_MASK          TX_POWER_BOOSTNORM_MASK
519
#define TX_POWER_BOOSTNORM_SHIFT (0)
520
#define TX_POWER_BOOSTP500_MASK 0x00000000UL    /* This value sets the power applied during transmission at the 6.8 Mbps data rate frames that are less than 0.5 ms duration */
521
#define BOOSTP500_MASK          TX_POWER_BOOSTP500_MASK
522
#define TX_POWER_BOOSTP500_SHIFT (8)
523
#define TX_POWER_BOOSTP250_MASK 0x00000000UL    /* This value sets the power applied during transmission at the 6.8 Mbps data rate frames that are less than 0.25 ms duration */
524
#define BOOSTP250_MASK          TX_POWER_BOOSTP250_MASK
525
#define TX_POWER_BOOSTP250_SHIFT (16)
526
#define TX_POWER_BOOSTP125_MASK 0x00000000UL    /* This value sets the power applied during transmission at the 6.8 Mbps data rate frames that are less than 0.125 ms */
527
#define BOOSTP125_MASK          TX_POWER_BOOSTP125_MASK
528
#define TX_POWER_BOOSTP125_SHIFT (24)
529
/*mask and shift definition for Manual Transmit Power Control (DIS_STXP=1 in SYS_CFG)*/
530
#define TX_POWER_MAN_DEFAULT    0x0E080222UL
531
#define TX_POWER_TXPOWPHR_MASK  0x0000FF00UL    /* This power setting is applied during the transmission of the PHY header (PHR) portion of the frame. */
532
#define TX_POWER_TXPOWSD_MASK   0x00FF0000UL    /* This power setting is applied during the transmission of the synchronisation header (SHR) and data portions of the frame. */
533

  
534

  
535
/****************************************************************************//**
536
 * @brief Bit definitions for register CHAN_CTRL
537
**/
538
#define CHAN_CTRL_ID            0x1F            /* Channel Control */
539
#define CHAN_CTRL_LEN           (4)
540
/*mask and shift */
541
#define CHAN_CTRL_MASK          0xFFFF00FFUL    /* Channel Control Register access mask */
542
#define CHAN_CTRL_TX_CHAN_MASK  0x0000000FUL    /* Supported channels are 1, 2, 3, 4, 5, and 7.*/
543
#define CHAN_CTRL_TX_CHAN_SHIFT (0)             /* Bits 0..3        TX channel number 0-15 selection */
544

  
545
#define CHAN_CTRL_RX_CHAN_MASK  0x000000F0UL
546
#define CHAN_CTRL_RX_CHAN_SHIFT (4)             /* Bits 4..7        RX channel number 0-15 selection */
547

  
548
#define CHAN_CTRL_RXFPRF_MASK   0x000C0000UL    /* Bits 18..19      Specify (Force) RX Pulse Repetition Rate: 00 = 4 MHz, 01 = 16 MHz, 10 = 64MHz. */
549
#define CHAN_CTRL_RXFPRF_SHIFT  (18)
550
/* Specific RXFPRF configuration */
551
#define CHAN_CTRL_RXFPRF_4      0x00000000UL    /* Specify (Force) RX Pulse Repetition Rate: 00 = 4 MHz, 01 = 16 MHz, 10 = 64MHz. */
552
#define CHAN_CTRL_RXFPRF_16     0x00040000UL    /* Specify (Force) RX Pulse Repetition Rate: 00 = 4 MHz, 01 = 16 MHz, 10 = 64MHz. */
553
#define CHAN_CTRL_RXFPRF_64     0x00080000UL    /* Specify (Force) RX Pulse Repetition Rate: 00 = 4 MHz, 01 = 16 MHz, 10 = 64MHz. */
554
#define CHAN_CTRL_TX_PCOD_MASK  0x07C00000UL    /* Bits 22..26      TX Preamble Code selection, 1 to 24. */
555
#define CHAN_CTRL_TX_PCOD_SHIFT (22)
556
#define CHAN_CTRL_RX_PCOD_MASK  0xF8000000UL    /* Bits 27..31      RX Preamble Code selection, 1 to 24. */
557
#define CHAN_CTRL_RX_PCOD_SHIFT (27)
558
/*offset 16 */
559
#define CHAN_CTRL_DWSFD         0x00020000UL    /* Bit 17 This bit enables a non-standard DecaWave proprietary SFD sequence. */
560
#define CHAN_CTRL_DWSFD_SHIFT   (17)
561
#define CHAN_CTRL_TNSSFD        0x00100000UL    /* Bit 20 Non-standard SFD in the transmitter */
562
#define CHAN_CTRL_TNSSFD_SHIFT  (20)
563
#define CHAN_CTRL_RNSSFD        0x00200000UL    /* Bit 21 Non-standard SFD in the receiver */
564
#define CHAN_CTRL_RNSSFD_SHIFT  (21)
565

  
566

  
567

  
568

  
569
/****************************************************************************//**
570
 * @brief Bit definitions for register 0x20
571
**/
572
#define REG_20_ID_RESERVED      0x20
573

  
574
/****************************************************************************//**
575
 * @brief Bit definitions for register USR_SFD
576
 *        Please read User Manual : User defined SFD sequence
577
**/
578
#define USR_SFD_ID              0x21            /* User-specified short/long TX/RX SFD sequences */
579
#define USR_SFD_LEN             (41)
580
#define DW_NS_SFD_LEN_110K      64              /* Decawave non-standard SFD length for 110 kbps */
581
#define DW_NS_SFD_LEN_850K      16              /* Decawave non-standard SFD length for 850 kbps */
582
#define DW_NS_SFD_LEN_6M8       8               /* Decawave non-standard SFD length for 6.8 Mbps */
583

  
584

  
585
/****************************************************************************//**
586
 * @brief Bit definitions for register
587
**/
588
#define REG_22_ID_RESERVED      0x22
589

  
590
/****************************************************************************//**
591
 * @brief Bit definitions for register AGC_CTRL
592
 * Please take care to write to this register as doing so may cause the DW1000 to malfunction
593
**/
594
#define AGC_CTRL_ID             0x23            /* Automatic Gain Control configuration */
595
#define AGC_CTRL_LEN            (32)
596
#define AGC_CFG_STS_ID          AGC_CTRL_ID
597
/* offset from AGC_CTRL_ID in bytes */
598
#define AGC_CTRL1_OFFSET        (0x02)
599
#define AGC_CTRL1_LEN           (2)
600
#define AGC_CTRL1_MASK          0x0001          /* access mask to AGC configuration and control register */
601
#define AGC_CTRL1_DIS_AM        0x0001          /* Disable AGC Measurement. The DIS_AM bit is set by default. */
602
/* offset from AGC_CTRL_ID in bytes */
603
/* Please take care not to write other values to this register as doing so may cause the DW1000 to malfunction */
604
#define AGC_TUNE1_OFFSET        (0x04)
605
#define AGC_TUNE1_LEN           (2)
606
#define AGC_TUNE1_MASK          0xFFFF          /* It is a 16-bit tuning register for the AGC. */
607
#define AGC_TUNE1_16M           0x8870
608
#define AGC_TUNE1_64M           0x889B
609
/* offset from AGC_CTRL_ID in bytes */
610
/* Please take care not to write other values to this register as doing so may cause the DW1000 to malfunction */
611
#define AGC_TUNE2_OFFSET        (0x0C)
612
#define AGC_TUNE2_LEN           (4)
613
#define AGC_TUNE2_MASK          0xFFFFFFFFUL
614
#define AGC_TUNE2_VAL           0X2502A907UL
615
/* offset from AGC_CTRL_ID in bytes */
616
/* Please take care not to write other values to this register as doing so may cause the DW1000 to malfunction */
617
#define AGC_TUNE3_OFFSET        (0x12)
618
#define AGC_TUNE3_LEN           (2)
619
#define AGC_TUNE3_MASK          0xFFFF
620
#define AGC_TUNE3_VAL           0X0055
621
/* offset from AGC_CTRL_ID in bytes */
622
#define AGC_STAT1_OFFSET        (0x1E)
623
#define AGC_STAT1_LEN           (3)
624
#define AGC_STAT1_MASK          0x0FFFFF
625
#define AGC_STAT1_EDG1_MASK     0x0007C0        /* This 5-bit gain value relates to input noise power measurement. */
626
#define AGC_STAT1_EDG2_MASK     0x0FF800        /* This 9-bit value relates to the input noise power measurement. */
627

  
628
/****************************************************************************//**
629
 * @brief Bit definitions for register EXT_SYNC
630
**/
631
#define EXT_SYNC_ID             0x24            /* External synchronisation control */
632
#define EXT_SYNC_LEN            (12)
633
/* offset from EXT_SYNC_ID in bytes */
634
#define EC_CTRL_OFFSET          (0x00)
635
#define EC_CTRL_LEN             (4)
636
#define EC_CTRL_MASK            0x00000FFBUL    /* sub-register 0x00 is the External clock synchronisation counter configuration register */
637
#define EC_CTRL_OSTSM           0x00000001UL    /* External transmit synchronisation mode enable */
638
#define EC_CTRL_OSRSM           0x00000002UL    /* External receive synchronisation mode enable */
639
#define EC_CTRL_PLLLCK          0x04            /* PLL lock detect enable */
640
#define EC_CTRL_OSTRM           0x00000800UL    /* External timebase reset mode enable */
641
#define EC_CTRL_WAIT_MASK       0x000007F8UL    /* Wait counter used for external transmit synchronisation and external timebase reset */
642
/* offset from EXT_SYNC_ID in bytes */
643
#define EC_RXTC_OFFSET          (0x04)
644
#define EC_RXTC_LEN             (4)
645
#define EC_RXTC_MASK            0xFFFFFFFFUL    /* External clock synchronisation counter captured on RMARKER */
646
/* offset from EXT_SYNC_ID in bytes */
647
#define EC_GOLP                 (0x08)
648
#define EC_GOLP_LEN             (4)
649
#define EC_GOLP_MASK            0x0000003FUL    /* sub-register 0x08 is the External clock offset to first path 1 GHz counter, EC_GOLP */
650
#define EC_GOLP_OFFSET_EXT_MASK 0x0000003FUL    /* This register contains the 1 GHz count from the arrival of the RMARKER and the next edge of the external clock. */
651

  
652

  
653
/****************************************************************************//**
654
 * @brief Bit definitions for register ACC_MEM
655
**/
656
#define ACC_MEM_ID              0x25            /* Read access to accumulator data */
657
#define ACC_MEM_LEN             (4064)
658

  
659

  
660
/****************************************************************************//**
661
 * @brief Bit definitions for register GPIO_CTRL
662
**/
663
#define GPIO_CTRL_ID            0x26            /* Peripheral register bus 1 access - GPIO control */
664
#define GPIO_CTRL_LEN           (44)
665

  
666
/* offset from GPIO_CTRL in bytes */
667
#define GPIO_MODE_OFFSET        0x00            /* sub-register 0x00 is the GPIO Mode Control Register */
668
#define GPIO_MODE_LEN           (4)
669
#define GPIO_MODE_MASK          0x00FFFFC0UL
670

  
671
#define GPIO_MSGP0_MASK         0x000000C0UL    /* Mode Selection for GPIO0/RXOKLED */
672
#define GPIO_MSGP1_MASK         0x00000300UL    /* Mode Selection for GPIO1/SFDLED */
673
#define GPIO_MSGP2_MASK         0x00000C00UL    /* Mode Selection for GPIO2/RXLED */
674
#define GPIO_MSGP3_MASK         0x00003000UL    /* Mode Selection for GPIO3/TXLED */
675
#define GPIO_MSGP4_MASK         0x0000C000UL    /* Mode Selection for GPIO4/EXTPA */
676
#define GPIO_MSGP5_MASK         0x00030000UL    /* Mode Selection for GPIO5/EXTTXE */
677
#define GPIO_MSGP6_MASK         0x000C0000UL    /* Mode Selection for GPIO6/EXTRXE */
678
#define GPIO_MSGP7_MASK         0x00300000UL    /* Mode Selection for SYNC/GPIO7 */
679
#define GPIO_MSGP8_MASK         0x00C00000UL    /* Mode Selection for IRQ/GPIO8 */
680

  
681
#define GPIO_PIN2_RXLED         0x00000400UL    /* The pin operates as the RXLED output */
682
#define GPIO_PIN3_TXLED         0x00001000UL    /* The pin operates as the TXLED output */
683
#define GPIO_PIN4_EXTPA         0x00004000UL    /* The pin operates as the EXTPA output */
684
#define GPIO_PIN5_EXTTXE        0x00010000UL    /* The pin operates as the EXTTXE output */
685
#define GPIO_PIN6_EXTRXE        0x00040000UL    /* The pin operates as the EXTRXE output */
686

  
687
/* offset from GPIO_CTRL in bytes */
688
#define GPIO_DIR_OFFSET         0x08            /* sub-register 0x08 is the GPIO Direction Control Register */
689
#define GPIO_DIR_LEN            (3)
690
#define GPIO_DIR_MASK           0x0011FFFFUL
691

  
692
#define GxP0                    0x00000001UL    /* GPIO0 Only changed if the GxM0 mask bit has a value of 1 for the write operation*/
693
#define GxP1                    0x00000002UL    /* GPIO1. (See GDP0). */
694
#define GxP2                    0x00000004UL    /* GPIO2. (See GDP0). */
695
#define GxP3                    0x00000008UL    /* GPIO3. (See GDP0). */
696
#define GxP4                    0x00000100UL    /* GPIO4. (See GDP0). */
697
#define GxP5                    0x00000200UL    /* GPIO5. (See GDP0). */
698
#define GxP6                    0x00000400UL    /* GPIO6. (See GDP0). */
699
#define GxP7                    0x00000800UL    /* GPIO7. (See GDP0). */
700
#define GxP8                    0x00010000UL    /* GPIO8 */
701

  
702
#define GxM0                    0x00000010UL    /* Mask for GPIO0 */
703
#define GxM1                    0x00000020UL    /* Mask for GPIO1. (See GDM0). */
704
#define GxM2                    0x00000040UL    /* Mask for GPIO2. (See GDM0). */
705
#define GxM3                    0x00000080UL    /* Mask for GPIO3. (See GDM0). */
706
#define GxM4                    0x00001000UL    /* Mask for GPIO4. (See GDM0). */
707
#define GxM5                    0x00002000UL    /* Mask for GPIO5. (See GDM0). */
708
#define GxM6                    0x00004000UL    /* Mask for GPIO6. (See GDM0). */
709
#define GxM7                    0x00008000UL    /* Mask for GPIO7. (See GDM0). */
710
#define GxM8                    0x00100000UL    /* Mask for GPIO8. (See GDM0). */
711

  
712
#define GDP0    GxP0    /* Direction Selection for GPIO0. 1 = input, 0 = output. Only changed if the GDM0 mask bit has a value of 1 for the write operation*/
713
#define GDP1    GxP1    /* Direction Selection for GPIO1. (See GDP0). */
714
#define GDP2    GxP2    /* Direction Selection for GPIO2. (See GDP0). */
715
#define GDP3    GxP3    /* Direction Selection for GPIO3. (See GDP0). */
716
#define GDP4    GxP4    /* Direction Selection for GPIO4. (See GDP0). */
717
#define GDP5    GxP5    /* Direction Selection for GPIO5. (See GDP0). */
718
#define GDP6    GxP6    /* Direction Selection for GPIO6. (See GDP0). */
719
#define GDP7    GxP7    /* Direction Selection for GPIO7. (See GDP0). */
720
#define GDP8    GxP8    /* Direction Selection for GPIO8 */
721

  
722
#define GDM0    GxM0    /* Mask for setting the direction of GPIO0 */
723
#define GDM1    GxM1    /* Mask for setting the direction of GPIO1. (See GDM0). */
724
#define GDM2    GxM2    /* Mask for setting the direction of GPIO2. (See GDM0). */
725
#define GDM3    GxM3    /* Mask for setting the direction of GPIO3. (See GDM0). */
726
#define GDM4    GxM4    /* Mask for setting the direction of GPIO4. (See GDM0). */
727
#define GDM5    GxM5    /* Mask for setting the direction of GPIO5. (See GDM0). */
728
#define GDM6    GxM6    /* Mask for setting the direction of GPIO6. (See GDM0). */
729
#define GDM7    GxM7    /* Mask for setting the direction of GPIO7. (See GDM0). */
730
#define GDM8    GxM8    /* Mask for setting the direction of GPIO8. (See GDM0). */
731

  
732
/* offset from GPIO_CTRL in bytes */
733
#define GPIO_DOUT_OFFSET        0x0C            /* sub-register 0x0C is the GPIO data output register. */
734
#define GPIO_DOUT_LEN           (3)
735
#define GPIO_DOUT_MASK          GPIO_DIR_MASK
736

  
737
/* offset from GPIO_CTRL in bytes */
738
#define GPIO_IRQE_OFFSET        0x10            /* sub-register 0x10 is the GPIO interrupt enable register */
739
#define GPIO_IRQE_LEN           (4)
740
#define GPIO_IRQE_MASK          0x000001FFUL
741
#define GIRQx0                  0x00000001UL    /* IRQ bit0 */
742
#define GIRQx1                  0x00000002UL    /* IRQ bit1 */
743
#define GIRQx2                  0x00000004UL    /* IRQ bit2 */
744
#define GIRQx3                  0x00000008UL    /* IRQ bit3 */
745
#define GIRQx4                  0x00000010UL    /* IRQ bit4 */
746
#define GIRQx5                  0x00000020UL    /* IRQ bit5 */
747
#define GIRQx6                  0x00000040UL    /* IRQ bit6 */
748
#define GIRQx7                  0x00000080UL    /* IRQ bit7 */
749
#define GIRQx8                  0x00000100UL    /* IRQ bit8 */
750
#define GIRQE0  GIRQx0  /* GPIO IRQ Enable for GPIO0 input. Value 1 = enable, 0 = disable*/
751
#define GIRQE1  GIRQx1  /*  */
752
#define GIRQE2  GIRQx2  /*  */
753
#define GIRQE3  GIRQx3  /*  */
754
#define GIRQE4  GIRQx4  /*  */
755
#define GIRQE5  GIRQx5  /*  */
756
#define GIRQE6  GIRQx6  /*  */
757
#define GIRQE7  GIRQx7  /*  */
758
#define GIRQE8  GIRQx8  /* Value 1 = enable, 0 = disable */
759

  
760
/* offset from GPIO_CTRL in bytes */
761
#define GPIO_ISEN_OFFSET        0x14    /* sub-register 0x14 is the GPIO interrupt sense selection register */
762
#define GPIO_ISEN_LEN           (4)
763
#define GPIO_ISEN_MASK          GPIO_IRQE_MASK
764
#define GISEN0  GIRQx0  /* GPIO IRQ Sense selection GPIO0 input. Value 0 = High or Rising-Edge, 1 = Low or falling-edge.*/
765
#define GISEN1  GIRQx1  /*  */
766
#define GISEN2  GIRQx2  /*  */
767
#define GISEN3  GIRQx3  /*  */
768
#define GISEN4  GIRQx4  /*  */
769
#define GISEN5  GIRQx5  /*  */
770
#define GISEN6  GIRQx6  /*  */
771
#define GISEN7  GIRQx7  /*  */
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff