Skip to content

Commit adb31f4

Browse files
committed
Add libs/pal/stubs
1 parent e1aacb3 commit adb31f4

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed

libs/pal/stubs/meson.build

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# The MIT License (MIT)
3+
#
4+
# Copyright (c) Adel Mamin
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
# SOFTWARE.
23+
#
24+
25+
pal_src = [files('pal.c')]
26+
src += pal_src
27+
28+
libpal = library('pal', [pal_src], include_directories: inc)
29+
libpal_dep = declare_dependency(link_with : libpal, include_directories : inc)

libs/pal/stubs/pal.c

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) Adel Mamin
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
/**
26+
* @file
27+
*
28+
* Platform abstraction layer (PAL) API stubs
29+
*/
30+
31+
#ifdef AMAST_PAL_STUBS
32+
33+
#include <stddef.h>
34+
#include <stdint.h>
35+
36+
#include "pal/pal.h"
37+
38+
void am_pal_crit_enter(void) {}
39+
40+
void am_pal_crit_exit(void) {}
41+
42+
void *am_pal_task_create(
43+
const char *name,
44+
int priority,
45+
void *stack,
46+
int stack_size,
47+
void (*entry)(void *arg),
48+
void *arg
49+
) {
50+
(void)name;
51+
(void)priority;
52+
(void)stack;
53+
(void)stack_size;
54+
(void)entry;
55+
(void)arg;
56+
57+
return NULL;
58+
}
59+
60+
void am_pal_task_notify(void *task) { (void)task; }
61+
62+
void am_pal_task_wait(void *task) { (void)task; }
63+
64+
uint32_t am_pal_time_get_ms(void) { return 0; }
65+
66+
uint32_t am_pal_time_get_tick(int domain) {
67+
(void)domain;
68+
return 0;
69+
}
70+
71+
uint32_t am_pal_time_get_tick_from_ms(int domain, uint32_t ms) {
72+
(void)domain;
73+
(void)ms;
74+
return 0;
75+
}
76+
77+
#endif /* AMAST_PAL_STUBS */

0 commit comments

Comments
 (0)