| Samsung Internal API reference 2.0

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

tee_spi.h
Go to the documentation of this file.
1
9 #ifndef __TEE_SPI_H__
10 #define __TEE_SPI_H__
11
12 #include <stdint.h>
13 #include <tee_internal_api.h>
14 #include <driver/spi/spi.h>
15
19 typedef struct {
20 uint32_t speedHz;
21 uint8_t bitsPerWord;
22 uint8_t CPOL;
23 uint8_t CPHA;
24 bool isDMAMode;
25 bool manualClockControl;
27 } TEES_SPIConfig;
28
32 typedef struct {
33 void *bufAddr;
34 size_t bufLen;
35 size_t transferredLen;
36 } TEES_SPITransfer;
37
38 /* DMA specific */
44 DSO_EXPORT TEE_Result TEES_SPIDMAInit(uintptr_t address);
45
47 DSO_EXPORT TEE_Result TEES_SPITestDMA(void);
50 struct __TEES_SPIHandlerImpl;
51
54 typedef struct __TEES_SPIHandlerImpl* TEES_SPIHandler;
55
84 DSO_EXPORT TEE_Result TEES_SPIInit(uint32_t port, const TEES_SPIConfig *cfg, TEES_SPIHandler *handler);
85
119 DSO_EXPORT TEE_Result TEES_SPIExit(TEES_SPIHandler handler);
120
155 DSO_EXPORT TEE_Result TEES_SPISetConfig(TEES_SPIHandler handler, const TEES_SPIConfig *cfg);
156
170 DSO_EXPORT TEE_Result TEES_SPISetClockSpeed(TEES_SPIHandler handler, uint32_t speedHz);
171
185 DSO_EXPORT TEE_Result TEES_SPISetBitsPerWord(TEES_SPIHandler handler, uint8_t bitsPerWord);
186
200 DSO_EXPORT TEE_Result TEES_SPISetDMAMode(TEES_SPIHandler handler, bool isEnabled);
201
215 DSO_EXPORT TEE_Result TEES_SPISetCPOL(TEES_SPIHandler handler, uint8_t cpol);
216
230 DSO_EXPORT TEE_Result TEES_SPISetCPHA(TEES_SPIHandler handler, uint8_t cpha);
231
237 DSO_EXPORT TEE_Result TEES_SPIClockEnable(TEES_SPIHandler handler);
238
244 DSO_EXPORT TEE_Result TEES_SPIClockDisable(TEES_SPIHandler handler);
245
253 DSO_EXPORT TEE_Result TEES_SPIWrite(TEES_SPIHandler handler, TEES_SPITransfer *tx);
254
297 DSO_EXPORT TEE_Result TEES_SPIRead(TEES_SPIHandler handler, TEES_SPITransfer *rx);
298
348 DSO_EXPORT TEE_Result TEES_SPIWriteRead(TEES_SPIHandler handler, TEES_SPITransfer *tx, TEES_SPITransfer *rx);
349
350 #ifndef __HIDE_INTERNAL_FUNCTIONS__
351
357 DSO_EXPORT TEE_Result TEES_SPISetLoopback(TEES_SPIHandler handler, bool isEnabled);
358 #endif /* __HIDE_INTERNAL_FUNCTIONS__ */
359
360 #endif /* __TEE_SPI_H__ */
361
TEES_SPIWrite
TEE_Result TEES_SPIWrite(TEES_SPIHandler handler, TEES_SPITransfer *tx)
Transfer data from buffer bus to SPI.
TEES_SPISetCPHA
TEE_Result TEES_SPISetCPHA(TEES_SPIHandler handler, uint8_t cpha)
Set SPI clock phase bit.
TEES_SPIHandler
struct __TEES_SPIHandlerImpl * TEES_SPIHandler
Definition: tee_spi.h:54
TEES_SPIConfig::isDMAMode
bool isDMAMode
Definition: tee_spi.h:24
TEES_SPIDMAInit
TEE_Result TEES_SPIDMAInit(uintptr_t address)
Initialize DMA for working with SPI device.
TEES_SPITransfer
Descriptor to transfer data over SPI.
Definition: tee_spi.h:32
TEES_SPITransfer::transferredLen
size_t transferredLen
Definition: tee_spi.h:35
TEES_SPIRead
TEE_Result TEES_SPIRead(TEES_SPIHandler handler, TEES_SPITransfer *rx)
Transfer data from SPI bus to buffer.
TEES_SPISetCPOL
TEE_Result TEES_SPISetCPOL(TEES_SPIHandler handler, uint8_t cpol)
Set SPI clock polarity bit.
TEES_SPISetConfig
TEE_Result TEES_SPISetConfig(TEES_SPIHandler handler, const TEES_SPIConfig *cfg)
Initialize handler with configuration values.
TEES_SPIConfig
Configuration of SPI device.
Definition: tee_spi.h:19
TEES_SPISetBitsPerWord
TEE_Result TEES_SPISetBitsPerWord(TEES_SPIHandler handler, uint8_t bitsPerWord)
Set the number of bits that will be transferred per SPI rate.
TEES_SPIExit
TEE_Result TEES_SPIExit(TEES_SPIHandler handler)
Free handler resource.
TEES_SPIConfig::manualClockControl
bool manualClockControl
Definition: tee_spi.h:25
TEES_SPIConfig::CPHA
uint8_t CPHA
Definition: tee_spi.h:23
TEES_SPITransfer::bufLen
size_t bufLen
Definition: tee_spi.h:34
TEES_SPITransfer::bufAddr
void * bufAddr
Definition: tee_spi.h:33
TEES_SPIClockEnable
TEE_Result TEES_SPIClockEnable(TEES_SPIHandler handler)
Not implemented.
TEES_SPIWriteRead
TEE_Result TEES_SPIWriteRead(TEES_SPIHandler handler, TEES_SPITransfer *tx, TEES_SPITransfer *rx)
Transfer data from buffer to SPI bus.
TEES_SPISetClockSpeed
TEE_Result TEES_SPISetClockSpeed(TEES_SPIHandler handler, uint32_t speedHz)
Set clock frequency rate.
TEES_SPISetDMAMode
TEE_Result TEES_SPISetDMAMode(TEES_SPIHandler handler, bool isEnabled)
Enable or disable DMA mode.
TEES_SPIConfig::bitsPerWord
uint8_t bitsPerWord
Definition: tee_spi.h:21
TEES_SPIClockDisable
TEE_Result TEES_SPIClockDisable(TEES_SPIHandler handler)
Not implemented.
TEES_SPIInit
TEE_Result TEES_SPIInit(uint32_t port, const TEES_SPIConfig *cfg, TEES_SPIHandler *handler)
Initialize handler fields.
TEES_SPIConfig::CPOL
uint8_t CPOL
Definition: tee_spi.h:22
TEES_SPIConfig::speedHz
uint32_t speedHz
Definition: tee_spi.h:20