Hardware Abstraction Layer for FreeRTOS
temp_prv.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: MIT */
2
/*
3
* Author: Andreas Werner <kernel@andy89.org>
4
* Date: 2019
5
*/
6
#ifndef TEMP_PRV_
7
#define TEMP_PRV_
8
#ifndef TEMP_PRV
9
# error "Never include this file out of a Accel 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 TEMP_ALREDY_INITED 1
17
int32_t
temp_generic_init
(
struct
temp *temp);
18
#ifdef CONFIG_TEMP_THREAD_SAVE
19
# define temp_lock(u, w, e) HAL_LOCK(u, w, e)
20
# define temp_unlock(u, e) HAL_UNLOCK(u, e)
21
#else
22
# define temp_lock(u, w, e)
23
# define temp_unlock(u, e)
24
#endif
25
26
#define TEMP_ADDDEV(ns, p) HAL_ADDDEV(temp, ns, p)
27
HAL_DEFINE_GLOBAL_ARRAY
(temp);
28
#define TEMP_GET_DEV(index) HAL_GET_DEV(temp, index)
29
#ifndef CONFIG_TEMP_MULTI
30
# define TEMP_OPS(ns)
31
# define TEMP_INIT_DEV(ns)
32
33
# define TEMP_INIT(ns, index) struct temp *temp_init(uint32_t index)
34
# define TEMP_DEINIT(ns, t) int32_t temp_deinit(struct temp *t)
35
36
# define TEMP_GET(ns, t, v, waittime) int32_t temp_get(struct temp *t, float *v, TickType_t waittime)
37
# define TEMP_GET_ISR(ns, t, v) int32_t temp_getISR(struct temp *t, float *v)
38
39
#else
40
# define TEMP_OPS(ns) const struct temp_ops ns##_temp_ops = { \
41
.temp_init = &ns##_temp_init, \
42
.temp_deinit = &ns##_temp_deinit, \
43
.temp_get = &ns##_temp_get, \
44
.temp_getISR = &ns##_temp_getISR, \
45
}
46
# define TEMP_INIT_DEV(ns) .gen.ops = &ns##_temp_ops,
47
48
# define TEMP_INIT(ns, index) static struct temp *ns##_temp_init(uint32_t index)
49
# define TEMP_DEINIT(ns, t) static int32_t ns##_temp_deinit(struct temp *t)
50
51
# define TEMP_GET(ns, t, v, waittime) static int32_t ns##_temp_get(struct temp *t, float *value, TickType_t waittime)
52
# define TEMP_GET_ISR(ns, t, v) static int32_t ns##_temp_getISR(struct temp *t, float *v)
53
54
#endif
55
#endif
56
57
hal.h
HAL_DEFINE_GLOBAL_ARRAY
HAL_DEFINE_GLOBAL_ARRAY(temp)
temp_generic_init
int32_t temp_generic_init(struct temp *temp)
driver
include
temp_prv.h
Generated on Tue Aug 17 2021 15:19:23 for Hardware Abstraction Layer for FreeRTOS by
1.8.20