Hardware Abstraction Layer for FreeRTOS
example_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 EXAMPLE_PRV_
7
#define EXAMPLE_PRV_
8
#ifndef EXAMPLE_PRV
9
# error "Never include this file out of a EXAMPLE driver"
10
#endif
11
#include <FreeRTOS.h>
12
#include <semphr.h>
13
#include <stdint.h>
14
#include <stdbool.h>
15
#include <
hal.h
>
31
#define EXAMPLE_ALREDY_INITED 1
32
39
int32_t
example_genericInit
(
struct
example *example);
40
#ifdef CONFIG_EXAMPLE_THREAD_SAVE
41
45
# define example_lock(u, w, e) HAL_LOCK(u, w, e)
46
50
# define example_unlock(u, e) HAL_UNLOCK(u, e)
51
#else
52
# define example_lock(u, w, e)
53
# define example_unlock(u, e)
54
#endif
55
60
#define EXAMPLE_ADDDEV(ns, p) HAL_ADDDEV(example, ns, p)
61
/*
62
* Define Global Array for Driver Access
63
*/
64
HAL_DEFINE_GLOBAL_ARRAY
(example);
70
#define EXAMPLE_GET_DEV(index) HAL_GET_DEV(example, index)
71
#ifndef CONFIG_EXAMPLE_MULTI
72
# define EXAMPLE_OPS(ns)
73
# define EXAMPLE_INIT_DEV(ns)
74
75
# define EXAMPLE_INIT(ns, index) struct example *example_init(uint32_t index)
76
# define EXAMPLE_DEINIT(ns, p) int32_t example_deinit(struct example *p)
77
78
# define EXAMPLE_FUNCNAME(ns, p, param) int32_t example_funcname(struct example *p, uint32_t param)
79
#else
80
84
# define EXAMPLE_OPS(ns) static const struct example_ops ns##_example_ops = { \
85
.example_init = &ns##_example_init,\
86
.example_deinit = &ns##_example_deinit,\
87
.example_funcname = &ns##_example_funcname, \
88
}
89
93
# define EXAMPLE_INIT_DEV(ns) .gen.ops = &ns##_example_ops,
94
100
# define EXAMPLE_INIT(ns, index) static struct example *ns##_example_init(uint32_t index)
101
106
# define EXAMPLE_DEINIT(ns, p) static int32_t ns##_example_deinit(struct example *p)
107
113
# define EXAMPLE_FUNCNAME(ns, p, param) static int32_t ns##_example_funcname(struct example *p, uint32_t param)
114
#endif
115
116
#endif
hal.h
example_genericInit
int32_t example_genericInit(struct example *example)
HAL_DEFINE_GLOBAL_ARRAY
HAL_DEFINE_GLOBAL_ARRAY(example)
driver
include
example_prv.h
Generated on Tue Aug 17 2021 15:19:23 for Hardware Abstraction Layer for FreeRTOS by
1.8.20