Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4417 → Rev 4418

/branches/dd/uspace/srv/pci/psycho.c
109,12 → 109,12
return res;
}
 
static inline uint16_t invert_endianess_16(uint16_t x)
static inline uint16_t invert_endianness_16(uint16_t x)
{
return (x & 0xFF) << 8 | (x >> 8);
}
 
static inline uint32_t invert_endianess_32(uint32_t x)
static inline uint32_t invert_endianness_32(uint32_t x)
{
return ((x & 0xFF) << 24) | ((x & 0xFF00) << 8) | ((x & 0xFF0000) >> 8) | (x >> 24);
}
126,10 → 126,10
buf[0] = pio_read_8(psycho_conf_addr(d, reg));
break;
case 2:
*((uint16_t *)buf) = invert_endianess_16(pio_read_16(psycho_conf_addr(d, reg)));
*((uint16_t *)buf) = invert_endianness_16(pio_read_16(psycho_conf_addr(d, reg)));
break;
case 4:
*((uint32_t *)buf) = invert_endianess_32(pio_read_32(psycho_conf_addr(d, reg)));
*((uint32_t *)buf) = invert_endianness_32(pio_read_32(psycho_conf_addr(d, reg)));
break;
}
}
141,10 → 141,10
pio_write_8(psycho_conf_addr(d, reg), buf[0]);
break;
case 2:
pio_write_16(psycho_conf_addr(d, reg), invert_endianess_16(*((uint16_t *)buf)));
pio_write_16(psycho_conf_addr(d, reg), invert_endianness_16(*((uint16_t *)buf)));
break;
case 4:
pio_write_32(psycho_conf_addr(d, reg), invert_endianess_32(*((uint32_t *)buf)));
pio_write_32(psycho_conf_addr(d, reg), invert_endianness_32(*((uint32_t *)buf)));
break;
}
}