You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.5 KiB
85 lines
2.5 KiB
/*
|
|
* Copyright (c) Hisilicon Technologies Co., Ltd.. 2010-2021. All rights reserved.
|
|
* Description:
|
|
*/
|
|
|
|
/********************************************************************************************/
|
|
/* Includes */
|
|
/********************************************************************************************/
|
|
#include "uapi_spi.h"
|
|
#include "mpi_spi_ext.h"
|
|
|
|
/********************************************************************************************
|
|
Function Implementation
|
|
********************************************************************************************/
|
|
td_s32 uapi_spi_init(td_void)
|
|
{
|
|
return ext_mpi_spi_init();
|
|
}
|
|
|
|
td_s32 uapi_spi_deinit(td_void)
|
|
{
|
|
return ext_mpi_spi_deinit();
|
|
}
|
|
|
|
/* Open spi bus device. */
|
|
td_s32 uapi_spi_open(uapi_spi_device device)
|
|
{
|
|
return ext_mpi_spi_open((ext_mpi_spi_device)device);
|
|
}
|
|
|
|
/* Close spi bus device. */
|
|
td_s32 uapi_spi_close(uapi_spi_device device)
|
|
{
|
|
return ext_mpi_spi_close((ext_mpi_spi_device)device);
|
|
}
|
|
|
|
/* Set attribute on a spi bus device. */
|
|
td_s32 uapi_spi_set_attr(uapi_spi_device device, const uapi_spi_attr *attr)
|
|
{
|
|
return ext_mpi_spi_set_attr((ext_mpi_spi_device)device, (ext_mpi_spi_attr *)(td_void *)attr);
|
|
}
|
|
|
|
/* Get attribute on a spi bus device. */
|
|
td_s32 uapi_spi_get_attr(uapi_spi_device device, uapi_spi_attr *attr)
|
|
{
|
|
return ext_mpi_spi_get_attr((ext_mpi_spi_device)device, (ext_mpi_spi_attr *)(td_void *)attr);
|
|
}
|
|
|
|
/*
|
|
* Transmit data in full-duplex mode.
|
|
*
|
|
* The data to be written is stored in write.
|
|
* The number of data to be written is set by write_count.
|
|
* The data to be read is stored in read.
|
|
* The number of data to be read is set by read_count.
|
|
*/
|
|
td_s32 uapi_spi_transmit(uapi_spi_device device,
|
|
const td_u8 *send, td_u32 send_count,
|
|
td_u8 *read, td_u32 read_count)
|
|
{
|
|
return ext_mpi_spi_transmit((ext_mpi_spi_device)device, send, send_count, read, read_count);
|
|
}
|
|
|
|
/*
|
|
* Read data on a spi device.
|
|
*
|
|
* The data to be read is stored in read.
|
|
* The number of data to be read is set by read_count.
|
|
*/
|
|
td_s32 uapi_spi_read(uapi_spi_device device, td_u8 *read, td_u32 read_count)
|
|
{
|
|
return ext_mpi_spi_read((ext_mpi_spi_device)device, read, read_count);
|
|
}
|
|
|
|
/*
|
|
* Data transimit on a spi bus device.
|
|
*
|
|
* The data to be written is stored in write.
|
|
* The number of data to be read is set by read_count.
|
|
*/
|
|
td_s32 uapi_spi_write(uapi_spi_device device, const td_u8 *send, td_u32 send_count)
|
|
{
|
|
return ext_mpi_spi_write((ext_mpi_spi_device)device, send, send_count);
|
|
}
|