コード例 #1
0
ファイル: i2ellis.c プロジェクト: Antonio-Zhou/Linux-2.6.11
//******************************************************************************
// Function:   iiReadBuf8(pB, address, count)
// Parameters: pB      - pointer to board structure
//             address - address to put data read
//             count   - number of data bytes to read
//
// Returns:    True if everything appears copacetic.
//             False if there is any error: the pB->i2eError field has the error
//
// Description:
//
// Reads 'count' bytes into 'address' from the data fifo specified by the board
// structure pointer pB. Should count happen to be odd, an extra pad byte is
// received (identity unknown...). This to match the 16-bit behaviour. Uses
// 8-bit (byte) operations. Is called indirectly through pB->i2eReadBuf.
//
//******************************************************************************
static int
iiReadBuf8(i2eBordStrPtr pB, unsigned char *address, int count)
{
	// Rudimentary sanity checking here.
	if (pB->i2eValid != I2E_MAGIC)
		COMPLETE(pB, I2EE_INVALID);

	INSB ( pB->i2eData, address, count);

	COMPLETE(pB, I2EE_GOOD);
}
コード例 #2
0
ファイル: endian.c プロジェクト: gz/aos10
uint64_t read64(void *iptr, enum endianness endianness)
{
    uint8_t *ptr = iptr;

    if(endianness == LSB) {
	return INSB(*ptr, 0) | INSB(*(ptr + 1), 1) | INSB(*(ptr + 2), 2) | INSB(*(ptr + 3), 3) |
	    INSB(*(ptr + 4), 4) | INSB(*(ptr + 5), 5) | INSB(*(ptr + 6), 6) | INSB(*(ptr + 7), 7);
    } else {
	return INSB(*ptr, 7) | INSB(*(ptr + 1), 6) | INSB(*(ptr + 2), 5) | INSB(*(ptr + 3), 4) |
	    INSB(*(ptr + 4), 3) | INSB(*(ptr + 5), 2) | INSB(*(ptr + 6), 1) | INSB(*(ptr + 7), 0);
    }
}