summaryrefslogtreecommitdiff
path: root/include/dt-bindings/types.h
blob: d91fcae8342af56437d4432f31a8fb45ea6885b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * This header provides macros for different types and conversions
 */

#ifndef _DT_BINDINGS_TYPES_H_
#define _DT_BINDINGS_TYPES_H_

/*
 * S32_TO_U32: This macro converts the signed number to 2's complement
 * unisgned number. E.g. S32_TO_U32(-3) will be 0xfffffffd and
 * S32_TO_U32(3) will be 0x3;
 * Use of_property_read_s32() for getting back the correct signed value
 * in driver.
 */
#define S32_TO_U32(x) (((x) < 0) ? (((-(x)) ^ 0xFFFFFFFFU) + 1) : (x))

#endif