blob: c8a2b1628007c6da9de7e380194a0cb15a6ee4de (
plain) (
blame)
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
|
/*
* RTEMS Monitor semaphore support
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems.h>
#include "monitor.h"
#include <rtems/rtems/attrimpl.h>
#include <stdio.h>
#include <string.h> /* memcpy() */
void
rtems_monitor_sema_canonical(
rtems_monitor_sema_t *canonical_sema,
const void *sema_void
)
{
const Semaphore_Control *rtems_sema = (const Semaphore_Control *) sema_void;
canonical_sema->attribute = rtems_sema->attribute_set;
canonical_sema->priority_ceiling =
rtems_sema->Core_control.mutex.Attributes.priority_ceiling;
canonical_sema->holder_id =
rtems_sema->Core_control.mutex.holder_id;
if (_Attributes_Is_counting_semaphore(canonical_sema->attribute)) {
/* we have a counting semaphore */
canonical_sema->cur_count =
rtems_sema->Core_control.semaphore.count;
canonical_sema->max_count =
rtems_sema->Core_control.semaphore.Attributes.maximum_count;
}
else {
/* we have a binary semaphore (mutex) */
canonical_sema->cur_count = rtems_sema->Core_control.mutex.lock;
canonical_sema->max_count = 1; /* mutex is either 0 or 1 */
}
}
void
rtems_monitor_sema_dump_header(
bool verbose __attribute__((unused))
)
{
printf("\
ID NAME ATTR PRICEIL CURR_CNT HOLDID \n");
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 1234
1 2 3 4 5 6 7 */
rtems_monitor_separator();
}
/*
*/
void
rtems_monitor_sema_dump(
rtems_monitor_sema_t *monitor_sema,
bool verbose __attribute__((unused))
)
{
int length = 0;
length += rtems_monitor_dump_id(monitor_sema->id);
length += rtems_monitor_pad(11, length);
length += rtems_monitor_dump_name(monitor_sema->id);
length += rtems_monitor_pad(18, length);
length += rtems_monitor_dump_attributes(monitor_sema->attribute);
length += rtems_monitor_pad(30, length);
length += rtems_monitor_dump_priority(monitor_sema->priority_ceiling);
length += rtems_monitor_pad(38, length);
length += rtems_monitor_dump_decimal(monitor_sema->cur_count);
length += rtems_monitor_pad(47, length);
length += rtems_monitor_dump_id(monitor_sema->holder_id);
printf("\n");
}
|