RTEMS
6.3
Toggle main menu visibility
Loading...
Searching...
No Matches
cpukit
include
rtems
rfs
rtems-rfs-data.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: BSD-2-Clause */
2
17
18
/*
19
* COPYRIGHT (c) 2010 Chris Johns <chrisj@rtems.org>
20
*
21
* Redistribution and use in source and binary forms, with or without
22
* modification, are permitted provided that the following conditions
23
* are met:
24
* 1. Redistributions of source code must retain the above copyright
25
* notice, this list of conditions and the following disclaimer.
26
* 2. Redistributions in binary form must reproduce the above copyright
27
* notice, this list of conditions and the following disclaimer in the
28
* documentation and/or other materials provided with the distribution.
29
*
30
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
31
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
34
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
35
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
36
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
37
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
38
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
39
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40
* POSSIBILITY OF SUCH DAMAGE.
41
*/
42
43
44
#if !defined (_RTEMS_RFS_DATA_H_)
45
#define _RTEMS_RFS_DATA_H_
46
47
#include <stdint.h>
48
52
#define rtems_rfs_data_ptr(_d) ((uint8_t*)(_d))
53
57
#define rtems_rfs_data_get(_d, _t, _o, _s) \
58
(((_t)(rtems_rfs_data_ptr (_d)[_o])) << (_s))
59
63
#define rtems_rfs_read_u8(_d) \
64
(*rtems_rfs_data_ptr (_d))
65
69
#define rtems_rfs_read_u16(_d) \
70
(rtems_rfs_data_get (_d, uint16_t, 0, 8) | \
71
rtems_rfs_data_get (_d, uint16_t, 1, 0))
72
76
#define rtems_rfs_read_u32(_d) \
77
(rtems_rfs_data_get (_d, uint32_t, 0, 24) | \
78
rtems_rfs_data_get (_d, uint32_t, 1, 16) | \
79
rtems_rfs_data_get (_d, uint32_t, 2, 8) | \
80
rtems_rfs_data_get (_d, uint32_t, 3, 0))
81
85
#define rtems_rfs_write_u8(_d, _v) \
86
(*rtems_rfs_data_ptr (_d) = (uint8_t)(_v))
87
91
#define rtems_rfs_write_u16(_d, _v) \
92
do { \
93
rtems_rfs_data_ptr (_d)[0] = (uint8_t)(((uint16_t)(_v)) >> 8); \
94
rtems_rfs_data_ptr (_d)[1] = (uint8_t)((_v)); \
95
} while (0)
96
100
#define rtems_rfs_write_u32(_d, _v) \
101
do { \
102
rtems_rfs_data_ptr (_d)[0] = (uint8_t)(((uint32_t)(_v)) >> 24); \
103
rtems_rfs_data_ptr (_d)[1] = (uint8_t)(((uint32_t)(_v)) >> 16); \
104
rtems_rfs_data_ptr (_d)[2] = (uint8_t)(((uint32_t)(_v)) >> 8); \
105
rtems_rfs_data_ptr (_d)[3] = (uint8_t)((uint32_t)(_v)); \
106
} while (0)
107
108
#endif
Generated by
1.18.0