1 /* If we're being compiled as a .c file, rather than being included in
2 d10v_sim.h, then ENDIAN_INLINE won't be defined yet. */
4 /* This must come before any other includes. */
8 #define NO_ENDIAN_INLINE
13 ENDIAN_INLINE
uint16_t
16 return ((uint16_t)x
[0]<<8) + x
[1];
19 ENDIAN_INLINE
uint32_t
20 get_longword (uint8_t *x
)
22 return ((uint32_t)x
[0]<<24) + ((uint32_t)x
[1]<<16) + ((uint32_t)x
[2]<<8) + ((uint32_t)x
[3]);
26 get_longlong (uint8_t *x
)
28 uint32_t top
= get_longword (x
);
29 uint32_t bottom
= get_longword (x
+4);
30 return (((int64_t)top
)<<32) | (int64_t)bottom
;
34 write_word (uint8_t *addr
, uint16_t data
)
36 addr
[0] = (data
>> 8) & 0xff;
37 addr
[1] = data
& 0xff;
41 write_longword (uint8_t *addr
, uint32_t data
)
43 addr
[0] = (data
>> 24) & 0xff;
44 addr
[1] = (data
>> 16) & 0xff;
45 addr
[2] = (data
>> 8) & 0xff;
46 addr
[3] = data
& 0xff;
50 write_longlong (uint8_t *addr
, int64_t data
)
52 write_longword (addr
, (uint32_t)(data
>> 32));
53 write_longword (addr
+4, (uint32_t)data
);