Hardware Abstraction Layer for FreeRTOS
capture_prv.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: MIT */
2
/*
3
* Author: Andreas Werner <kernel@andy89.org>
4
* Date: 2016
5
*/
6
#ifndef CAPTURE_PRV_
7
#define CAPTURE_PRV_
8
#ifndef CAPTURE_PRV
9
# error "Never include this file out of a Capture driver"
10
#endif
11
#include <FreeRTOS.h>
12
#include <semphr.h>
13
#include <stdint.h>
14
#include <stdbool.h>
15
#include <
hal.h
>
16
#define CAPTURE_ALREDY_INITED 1
17
int32_t
capture_generic_init
(
struct
capture *capture);
18
#define CAPTURE_ADDDEV(ns, p) HAL_ADDDEV(capture, ns, p)
19
HAL_DEFINE_GLOBAL_ARRAY
(capture);
20
#define CAPTURE_GET_DEV(index) HAL_GET_DEV(capture, index)
21
#ifndef CONFIG_CAPTURE_MULTI
22
# define CAPTURE_OPS(ns)
23
# define CAPTURE_INIT_DEV(ns)
24
25
# define CAPTURE_INIT(ns, index) struct capture *capture_init(uint32_t index)
26
# define CAPTURE_DEINIT(ns, c) int32_t capture_deinit(struct capture *c)
27
28
# define CAPTURE_SET_CALLBACK(ns, c, callback, data) int32_t capture_setCallback(struct capture *c, bool (*callback)(struct capture *capture, uint32_t index, uint64_t time, void *data), void *data)
29
30
# define CAPTURE_SET_PERIOD(ns, c, us) int32_t capture_setPeriod(struct capture *c, uint64_t us)
31
# define CAPTURE_GET_TIME(ns, c) uint64_t capture_getTime(struct capture *c)
32
# define CAPTURE_GET_CHANNEL_TIME(ns, c) uint64_t capture_getChannelTime(struct capture *c)
33
#else
34
# define CAPTURE_OPS(ns) const struct capture_ops ns##_capture_ops = { \
35
.capture_init = &ns##_capture_init,\
36
.capture_deinit = &ns##_capture_deinit,\
37
.capture_setCallback = &ns##_capture_setCallback, \
38
.capture_setPeriod= &ns##_capture_setPeriod, \
39
.capture_getTime = &ns##_capture_getTime, \
40
.capture_getChannelTime = &ns##_capture_getChannelTime\
41
};
42
# define CAPTURE_INIT_DEV(ns) .gen.ops = &ns##_capture_ops,
43
44
# define CAPTURE_INIT(ns, index) static struct capture *ns##_capture_init(uint32_t index)
45
# define CAPTURE_DEINIT(ns, c) static int32_t ns##_capture_deinit(struct capture *c)
46
47
# define CAPTURE_SET_CALLBACK(ns, c, callback, data) static int32_t ns##_capture_setCallback(struct capture *c, bool (*callback)(struct capture *capture, uint32_t index, uint64_t time, void *data), void *data)
48
49
# define CAPTURE_SET_PERIOD(ns, c, us) static int32_t ns##_capture_setPeriod(struct capture *c, uint64_t us)
50
# define CAPTURE_GET_TIME(ns, c) static uint64_t ns##_capture_getTime(struct capture *c)
51
# define CAPTURE_GET_CHANNEL_TIME(ns, c) static uint64_t ns##_capture_getChannelTime(struct capture *c)
52
53
#endif
54
#endif
hal.h
capture_generic_init
int32_t capture_generic_init(struct capture *capture)
HAL_DEFINE_GLOBAL_ARRAY
HAL_DEFINE_GLOBAL_ARRAY(capture)
driver
include
capture_prv.h
Generated on Tue Aug 17 2021 15:19:23 for Hardware Abstraction Layer for FreeRTOS by
1.8.20