Пример #1
0
int fc8150_spib_bulkread(HANDLE hDevice, u16 addr, u8 *data, u16 length)
{
	int res;
	u8 command = SPI_READ | SPI_AINC;

	OAL_OBTAIN_SEMAPHORE();
	res = spi_bulkread(hDevice, addr, command, data, length);
	OAL_RELEASE_SEMAPHORE();
	return res;
}
Пример #2
0
int fc8150_spib_longread(HANDLE hDevice, u16 addr, u32 *data)
{
	int res;
	u8 command = SPI_READ | SPI_AINC;

	OAL_OBTAIN_SEMAPHORE();
	res = spi_bulkread(hDevice, addr, command, (u8 *)data, 4);
	OAL_RELEASE_SEMAPHORE();
	return res;
}
Пример #3
0
int fc8050_spi_bulkread(HANDLE hDevice, u16 addr, u8 *data, u16 length)
{
	int res;
	u8 command = HPIC_READ | HPIC_AINC | HPIC_BMODE | HPIC_ENDIAN;

	mutex_lock(&lock);
	res  = spi_bulkwrite(hDevice, BBM_COMMAND_REG, &command, 1);
	res |= spi_bulkwrite(hDevice, BBM_ADDRESS_REG, (u8 *)&addr, 2);
	res |= spi_bulkread(hDevice, BBM_DATA_REG, data, length);
	mutex_unlock(&lock);

	return res;
}
Пример #4
0
int fc8050_spi_longread(HANDLE hDevice, fci_u16 addr, fci_u32 *data)
{
	int res;
	fci_u8 command = HPIC_READ | HPIC_AINC | HPIC_BMODE | HPIC_ENDIAN;

	mutex_lock(&lock);
	
	res  = spi_bulkwrite(hDevice, BBM_COMMAND_REG, &command, 1);
	res |= spi_bulkwrite(hDevice, BBM_ADDRESS_REG, (fci_u8*)&addr, 2);
	res |= spi_bulkread(hDevice, BBM_DATA_REG, (fci_u8*)data, 4);

	mutex_unlock(&lock);

	return res;
}
Пример #5
0
int fc8050_spi_wordread(HANDLE hDevice, u16 addr, u16 *data)
{
	int res;
	u8 command = HPIC_READ | HPIC_AINC | HPIC_BMODE | HPIC_ENDIAN;

	if (BBM_SCI_DATA <= addr && BBM_SCI_SYNCRX >= addr)
		command = HPIC_READ | HPIC_WMODE | HPIC_ENDIAN;

	mutex_lock(&lock);
	res  = spi_bulkwrite(hDevice, BBM_COMMAND_REG, &command, 1);
	res |= spi_bulkwrite(hDevice, BBM_ADDRESS_REG, (u8 *)&addr, 2);
	res |= spi_bulkread(hDevice, BBM_DATA_REG, (u8 *)data, 2);
	mutex_unlock(&lock);

	return res;
}