1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
#ifndef _VG_LITE_OS_H
#define _VG_LITE_OS_H
#include <stdint.h>
#if !defined(VG_DRIVER_SINGLE_THREAD)
#define vg_lite_os_set_event_state(event, state) (event)->signal = state
#define vg_lite_os_event_state(event) (event)->signal
#define vg_lite_os_config_event(event, sem_id, state) \
{ \
(event)->semaphore_id = sem_id; \
(event)->signal = state; \
}
typedef struct vg_lite_os_async_event
{
uint32_t semaphore_id; /*! The Id of the semaphore assigned to this event */
int32_t signal; /*! The command buffer status */
}
vg_lite_os_async_event_t;
int32_t vg_lite_os_init_tls_array(void);
void vg_lite_os_deinit_tls_array(void);
/*!
@brief Set the value in a task’s thread local storage array.
*/
int32_t vg_lite_os_set_tls(void* tls);
/*!
@brief Get the current task’s thread local storage array.
*/
void * vg_lite_os_get_tls( );
#endif /* not defined(VG_DRIVER_SINGLE_THREAD) */
/*!
@brief Memory allocate.
*/
void * vg_lite_os_malloc(uint32_t size);
/*!
@brief Memory free.
*/
void vg_lite_os_free(void * memory);
#if !defined(VG_DRIVER_SINGLE_THREAD)
/*!
@brief Reset the value in a task’s thread local storage array.
*/
void vg_lite_os_reset_tls();
#endif /* not defined(VG_DRIVER_SINGLE_THREAD) */
/*!
@brief sleep a number of milliseconds.
*/
void vg_lite_os_sleep(uint32_t msec);
/*!
@brief initialize the os parameters.
*/
int32_t vg_lite_os_initialize();
/*!
@brief deinitialize the os parameters.
*/
void vg_lite_os_deinitialize();
#if !defined(VG_DRIVER_SINGLE_THREAD)
/*!
@brief Mutex semaphore take.
*/
int32_t vg_lite_os_lock();
/*!
@brief Mutex semaphore give.
*/
int32_t vg_lite_os_unlock();
/*!
@brief Submit the current command buffer to the command queue.
*/
int32_t vg_lite_os_submit(uint32_t context, uint32_t physical, uint32_t offset, uint32_t size, vg_lite_os_async_event_t *event);
/*!
@brief Wait for the current command buffer to be executed.
*/
int32_t vg_lite_os_wait(uint32_t timeout, vg_lite_os_async_event_t *event);
#endif /* not defined(VG_DRIVER_SINGLE_THREAD) */
/*!
@brief IRQ Handler.
*/
void vg_lite_os_IRQHandler(void);
/*!
@brief Wait until an interrupt from the VGLite graphics hardware has been received.
*/
int32_t vg_lite_os_wait_interrupt(uint32_t timeout, uint32_t mask, uint32_t * value);
#if !defined(VG_DRIVER_SINGLE_THREAD)
/*!
@brief
*/
int32_t vg_lite_os_init_event(vg_lite_os_async_event_t *event,
uint32_t semaphore_id,
int32_t state);
/*!
@brief
*/
int32_t vg_lite_os_delete_event(vg_lite_os_async_event_t *event);
/*!
@brief
*/
int32_t vg_lite_os_wait_event(vg_lite_os_async_event_t *event);
/*!
@brief
*/
int32_t vg_lite_os_signal_event(vg_lite_os_async_event_t *event);
/*!
@brief
*/
int8_t vg_lite_os_query_context_switch(uint32_t context);
#endif /* not defined(VG_DRIVER_SINGLE_THREAD) */
#endif
|