summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/include/rtems/rtems/support.h
blob: 8d8a85a8258fff02f2e1cc48a208ecc6391aa25e (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
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
/**
 * @file rtems/rtems/support.h
 *
 *  This include file contains information about support functions for
 *  the RTEMS API.
 */

/*  COPYRIGHT (c) 1989-2008.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.com/license/LICENSE.
 *
 *  $Id$
 */

#ifndef _RTEMS_RTEMS_SUPPORT_H
#define _RTEMS_RTEMS_SUPPORT_H

#ifdef __cplusplus
extern "C" {
#endif

#include <rtems/rtems/types.h>

/**
 *  @addtogroup ClassicRTEMS
 *  @{
 */

/**
 *  @brief milliseconds to microseconds
 *
 *  This is the public milliseconds to microseconds conversion.
 */
#define RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms) \
        TOD_MILLISECONDS_TO_MICROSECONDS(_ms)

/**
 *  @brief milliseconds to ticks
 *
 *  This is the public milliseconds to ticks conversion.
 */
#define RTEMS_MILLISECONDS_TO_TICKS(_ms) \
       (TOD_MILLISECONDS_TO_MICROSECONDS(_ms) / \
          rtems_configuration_get_microseconds_per_tick())

/**
 *  @brief microseconds to ticks
 *
 *  This is the public microseconds to tick conversion.
 */
#define RTEMS_MICROSECONDS_TO_TICKS(_ms) \
       ((_ms) / rtems_configuration_get_microseconds_per_tick())

/**
 *  @brief get workspace information
 *
 *  This returns information about the heap that is used as
 *  the RTEMS Executive Workspace.
 *
 *  @param[in] the_info
 *
 *  @return true if successful
 */
bool rtems_workspace_get_information(
  Heap_Information_block  *the_info
);

/**
 *  @brief allocate memory from workspace
 *
 *  This allocates memory from the the RTEMS Executive Workspace.
 *
 *  @param[in] bytes is the number of bytes to allocate 
 *  @param[in] pointer is the returned pointer to allocated memory
 *
 *  @return true if successful
 */
bool rtems_workspace_allocate(
  size_t   bytes,
  void   **pointer
);

/**
 * @brief free memory back to the workspace
 *
 *  This frees memory that was allocated from   
 *  the RTEMS Executive Workspace.
 *
 *  @param[in] pointer is the allocated workspace
 *
 *  @return true if successful
 */
bool rtems_workspace_free(
  void *pointer
);

#ifndef __RTEMS_APPLICATION__
#include <rtems/rtems/support.inl>
#endif

#ifdef __cplusplus
}
#endif

/**@}*/

#endif
/* end of include file */