APM:Libraries
libraries
AP_HAL_Linux
RCInput_AioPRU.h
Go to the documentation of this file.
1
// This program is free software: you can redistribute it and/or modify
2
// it under the terms of the GNU General Public License as published by
3
// the Free Software Foundation, either version 3 of the License, or
4
// (at your option) any later version.
5
// This program is distributed in the hope that it will be useful,
6
// but WITHOUT ANY WARRANTY; without even the implied warranty of
7
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8
// GNU General Public License for more details.
9
// You should have received a copy of the GNU General Public License
10
// along with this program. If not, see <http://www.gnu.org/licenses/>.
11
#pragma once
12
13
/*
14
This class implements RCInput on the BeagleBoneBlack with a PRU
15
doing the edge detection of the PPM sum input
16
*/
17
18
#include "
AP_HAL_Linux.h
"
19
20
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_POCKET
21
#define RCIN_PRUSS_RAM_BASE 0x4a301000
22
#else
23
#define RCIN_PRUSS_RAM_BASE 0x4a303000
24
#endif
25
26
// we use 300 ring buffer entries to guarantee that a full 25 byte
27
// frame of 12 bits per byte
28
29
namespace
Linux
{
30
31
class
RCInput_AioPRU
:
public
RCInput
{
32
public
:
33
void
init
();
34
void
_timer_tick
(
void
);
35
36
protected
:
37
static
const
uint32_t
TICK_PER_US
= 200;
38
static
const
uint32_t
NUM_RING_ENTRIES
= 300;
39
// shared ring buffer with the PRU which records pin transitions
40
struct
ring_buffer
{
41
volatile
uint16_t
ring_head
;
// owned by ARM CPU
42
volatile
uint16_t
ring_tail
;
// owned by the PRU
43
struct
{
44
volatile
uint32_t
s1_t
;
// 5ns per tick
45
volatile
uint32_t
s0_t
;
// 5ns per tick
46
}
buffer
[
NUM_RING_ENTRIES
];
47
};
48
volatile
struct
ring_buffer
*
ring_buffer
;
49
};
50
51
}
Linux::RCInput_AioPRU::TICK_PER_US
static const uint32_t TICK_PER_US
Definition:
RCInput_AioPRU.h:37
Linux::RCInput_AioPRU::ring_buffer
Definition:
RCInput_AioPRU.h:40
Linux::RCInput
Definition:
RCInput.h:11
Linux::RCInput_AioPRU::ring_buffer::s1_t
volatile uint32_t s1_t
Definition:
RCInput_AioPRU.h:44
Linux::RCInput_AioPRU::_timer_tick
void _timer_tick(void)
Definition:
RCInput_AioPRU.cpp:52
Linux::RCInput_AioPRU::init
void init()
Definition:
RCInput_AioPRU.cpp:38
Linux::RCInput_AioPRU::ring_buffer::ring_head
volatile uint16_t ring_head
Definition:
RCInput_AioPRU.h:41
Linux::buffer
Definition:
VideoIn.h:23
Linux::RCInput_AioPRU::ring_buffer::s0_t
volatile uint32_t s0_t
Definition:
RCInput_AioPRU.h:45
Linux::RCInput_AioPRU
Definition:
RCInput_AioPRU.h:31
Linux::RCInput_AioPRU::NUM_RING_ENTRIES
static const uint32_t NUM_RING_ENTRIES
Definition:
RCInput_AioPRU.h:38
Linux::RCInput_AioPRU::ring_buffer
volatile struct ring_buffer * ring_buffer
Definition:
RCInput_AioPRU.h:48
Linux::RCInput_AioPRU::ring_buffer::ring_tail
volatile uint16_t ring_tail
Definition:
RCInput_AioPRU.h:42
AP_HAL_Linux.h
Linux
Definition:
CameraSensor.h:19
Generated on Sun Jun 17 2018 14:18:49 for APM:Libraries by
1.8.13