1 /* -------------------------------- Arctic Core ------------------------------
\r
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
\r
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
\r
6 * This source code is free software; you can redistribute it and/or modify it
\r
7 * under the terms of the GNU General Public License version 2 as published by the
\r
8 * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
\r
10 * This program is distributed in the hope that it will be useful, but
\r
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
\r
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
\r
14 * -------------------------------- Arctic Core ------------------------------*/
\r
19 #define WRITE8(address, value) (*(uint8_t*)(address) = (value))
\r
20 #define READ8(address) ((uint8_t)(*(uint8_t*)(address)))
\r
22 #define WRITE16(address, value) (*(vuint16_t*)(address) = (value))
\r
23 #define READ16(address) ((uint16_t)(*(vuint16_t*)(address)))
\r
25 #define WRITE32(address, value) (*(vuint32_t*)(address) = (value))
\r
26 #define READ32(address) ((uint32_t)(*(vuint32_t*)(address)))
\r
28 #define WRITE64(address, value) (*(vuint64_t*)(address) = (value))
\r
29 #define READ64(address) ((uint64_t)(*(vuint64_t*)(address)))
\r
31 /* Not aligned reads */
\r
32 #define READ32_NA(address ) ( (((uint32_t)(((uint8_t *)address)[0]))<<24) + \
\r
33 (((uint32_t)(((uint8_t *)address)[1]))<<16) + \
\r
34 (((uint32_t)(((uint8_t *)address)[2]))<<8) + \
\r
35 ((uint32_t)(((uint8_t *)address)[3])) )
\r
37 #define READ16_NA(address ) ( (((uint16_t)(((uint8_t *)address)[0]))<<8) + \
\r
38 (((uint16_t)(((uint8_t *)address)[1]))) )
\r
40 #define WRITE32_NA(address, value ) \
\r
42 ((uint8_t *)address)[0] = ((value>>24)&0xff); \
\r
43 ((uint8_t *)address)[1] = ((value>>16)&0xff); \
\r
44 ((uint8_t *)address)[2] = ((value>>8)&0xff); \
\r
45 ((uint8_t *)address)[3] = ((value&0xff)); \
\r
48 #define WRITE16_NA(address, value ) \
\r
50 ((uint8_t *)address)[0] = ((value>>8)&0xff); \
\r
51 ((uint8_t *)address)[1] = ((value&0xff)); \
\r