![]() |
Samsung Internal API reference
2.0
|
Data Structures | |
| struct | intrinfo |
Typedefs | |
| typedef struct __TEES_InterruptHandle * | TEES_InterruptHandle |
| typedef void(* | intruhandler) (struct intrinfo *) |
| typedef void(* | TEES_DriverDestructor_t) (int) |
Functions | |
| int | TEES_DcacheFlush (const void *addr, size_t nbytes) |
| Perform data cache flush. More... | |
| int | TEES_DcacheClean (const void *addr, size_t nbytes) |
| Perform data cache clean. More... | |
| int | TEES_InitDriver (char *name, struct fops *fops, unsigned int drvid, struct usr_drv_info **info) |
Register user driver in /dev/ directory under name, using mask of file operations fops and drvid of served asset. More... | |
| int | TEES_RegisterIoctlDesc (struct usr_drv_info *info, unsigned int cmd, struct ioctl_desc *desc) |
| Register an ioctl() cmd for driver. More... | |
| int | TEES_FiniDriver (struct usr_drv_info *info) |
| Allow to release driver that was registered by using struct usr_drv_info. More... | |
| int | TEES_RegisterDriver (char *name, struct fops *fops, unsigned int drvid, struct usr_drv_info **info) _deprecated_ |
Register user driver in /dev/ directory under name, using mask of file operations fops and drvid of served asset. More... | |
| int | TEES_ReleaseDriver (struct usr_drv_info **info) _deprecated_ |
| Allow to release driver that was registered by using struct usr_drv_info. More... | |
| int | TEES_CompleteRequest (struct drv_info *filp, long ret) |
| Complete deferred request(read, write, etc.) to driver. More... | |
| void * | TEES_AcquireUserBuffer (struct drv_info *filp, uint64_t addr, const size_t size, int prot) |
| Get shared mapped area to use as buffer. this API can not be used in read()/write() cmd for driver. More... | |
| int | TEES_ReleaseUserBuffer (const void *addr, const size_t size) |
| Deletes the shared mapped area for the specified address range. More... | |
| TEE_Result | TEES_AllocateInterrupt (int nr, intruhandler handler, TEES_InterruptHandle *handle) |
| This function is used to allocate interrupt and register user handler. More... | |
| TEE_Result | TEES_ReleaseInterrupt (TEES_InterruptHandle handle) |
| This function is used to release interrupt. More... | |
| TEE_Result | TEES_GenerateInterrupt (TEES_InterruptHandle handle) |
| This function is used to generate interrupt. More... | |
| TEE_Result | TEES_WaitForInterrupt (TEES_InterruptHandle handle, uint32_t timeout) |
| This function is used to wait for interrupt. More... | |
| TEE_Result | TEES_CompleteInterrupt (TEES_InterruptHandle handle) |
| This function is used to notify about interrupt arrival. More... | |
| TEE_Result | TEES_RegisterDriverDestructor (TEES_DriverDestructor_t destr) |
| Initializes driver destructor function pointer. The destructor will be called when secure kernel generates any interrupting signal. More... | |
Provides set of function to interact with device drivers from userspace comonents.
| intruhandler |
#include <tee_interrupt.h>
interrupt handler abstraction
| TEES_DriverDestructor_t |
#include <tee_ta_destructor.h>
Pointer to driver destructor function. int parameter - is an interrupting signal value
#include <tee_interrupt.h>
interrupt handle abstraction
| void* TEES_AcquireUserBuffer | ( | struct drv_info * | filp, |
| uint64_t | addr, | ||
| const size_t | size, | ||
| int | prot | ||
| ) |
#include <driver.h>
Get shared mapped area to use as buffer. this API can not be used in read()/write() cmd for driver.
| [in] | filp | Pointer to struct drv_info related to driver:
struct drv_info {
int pid;
int fd;
int share_fd;
struct uuid uuid;
char profile_name[PROFILE_STR_LEN];
};
|
| [in] | addr | Offset in the file (or other object) referred to by the file descriptor filp->share_fd |
| [in] | size | The length of the buffer |
| [in] | prot | Desired memory protection of the mapping |
Example:
| TEE_Result TEES_AllocateInterrupt | ( | int | nr, |
| intruhandler | handler, | ||
| TEES_InterruptHandle * | handle | ||
| ) |
#include <tee_interrupt.h>
This function is used to allocate interrupt and register user handler.
| [in] | nr | An interrupt id. |
| [in] | handler | An interrupt handler. |
| [out] | handle | An interrupt handle. |
| TEE_SUCCESS | on success. |
| TEE_ERROR | on fail. |
Example:
| TEE_Result TEES_CompleteInterrupt | ( | TEES_InterruptHandle | handle | ) |
#include <tee_interrupt.h>
This function is used to notify about interrupt arrival.
| [in] | handle | An interrupt handle. |
| TEE_SUCCESS | on success. |
| TEE_ERROR | on failure. |
Example:
| int TEES_CompleteRequest | ( | struct drv_info * | filp, |
| long | ret | ||
| ) |
#include <driver.h>
Complete deferred request(read, write, etc.) to driver.
| [in] | filp | Pointer to structure related to driver:
struct drv_info {
int pid;
int fd;
int share_fd;
struct uuid uuid;
char profile_name[PROFILE_STR_LEN];
};
|
| [in] | ret | Ret value that should be delivered to the driver's client. |
| 0 | no error. |
| -1 | on failure. errno variable is set appropriately. |
Example:
| int TEES_DcacheClean | ( | const void * | addr, |
| size_t | nbytes | ||
| ) |
| int TEES_DcacheFlush | ( | const void * | addr, |
| size_t | nbytes | ||
| ) |
| int TEES_FiniDriver | ( | struct usr_drv_info * | info | ) |
#include <driver.h>
Allow to release driver that was registered by using struct usr_drv_info.
| [in] | info | A pointer to struct usr_drv_info that contains information describing the driver. |
| non-negative | driver handle. |
| -1 | on failure. errno variable is set appropriately. |
Example:
| TEE_Result TEES_GenerateInterrupt | ( | TEES_InterruptHandle | handle | ) |
#include <tee_interrupt.h>
This function is used to generate interrupt.
| [in] | handle | An interrupt handle. |
| TEE_SUCCESS | on success. |
| TEE_ERROR | on failure. |
Example:
| int TEES_InitDriver | ( | char * | name, |
| struct fops * | fops, | ||
| unsigned int | drvid, | ||
| struct usr_drv_info ** | info | ||
| ) |
#include <driver.h>
Register user driver in /dev/ directory under name, using mask of file operations fops and drvid of served asset.
| [in] | name | A pointer to an array storing driver name |
| [in] | fops | A pointer to struct fops containing file operations supported by driver |
| [in] | drvid | Identificator of driver asset, used by access control |
| [out] | info | Double pointer to struct usr_drv_info that contains information describing the driver |
| 0 | no error. |
| -1 | on failure. errno variable is set appropriately. |
Example:
| int TEES_RegisterDriver | ( | char * | name, |
| struct fops * | fops, | ||
| unsigned int | drvid, | ||
| struct usr_drv_info ** | info | ||
| ) |
#include <driver.h>
Register user driver in /dev/ directory under name, using mask of file operations fops and drvid of served asset.
| [in] | name | A pointer to an array storing driver name |
| [in] | fops | A pointer to struct fops containing file operations supported by driver |
| [in] | drvid | Identificator of driver asset, used by access control |
| [out] | info | Double pointer to struct usr_drv_info that contains information describing the driver |
| 0 | no error. |
| -1 | on failure. errno variable is set appropriately. |
Example:
| TEE_Result TEES_RegisterDriverDestructor | ( | TEES_DriverDestructor_t | destr | ) |
#include <tee_ta_destructor.h>
Initializes driver destructor function pointer. The destructor will be called when secure kernel generates any interrupting signal.
| [in] | destr | - pointer to driver destructor function. |
| TEE_ERROR_BAD_PARAMETERS | when destr is NULL |
| TEE_SUCCESS | all other cases |
| int TEES_RegisterIoctlDesc | ( | struct usr_drv_info * | info, |
| unsigned int | cmd, | ||
| struct ioctl_desc * | desc | ||
| ) |
#include <driver.h>
Register an ioctl() cmd for driver.
| [in] | info | A pointer to struct usr_drv_info that contains information describing the driver. |
| [in] | cmd | An ioctl() command being added. |
| [in] | desc | An ioctl() arguments descriptor, see below for details. |
| 0 | on success, -1 otherwise. errno variable is set appropriately. |
Example:
struct example { uint32_t a; char *b; uint32_t items_cnt; uint32_t items[]; };
struct example data = { .a = 0xa5a5a5a5, .b = "0123456789", .items_cnt = 3, .items = {0, 1, 2}, };
struct ioctl_desc example_desc = { .cnt = 5, .tpl = { {.type = DESC_ATOM_VAL, .len = sizeof(uint32_t) }, {.type = DESC_ATOM_REF, .len = 10 }, {.type = DESC_ATOM_ARR_CNT_0, .len = sizeof(uint32_t) }, {.type = DESC_ATOM_ARR_ITEM_0, .len = 1 }, {.type = DESC_ATOM_VAL, .len = sizeof(uint32_t) }, }, };
| int TEES_ReleaseDriver | ( | struct usr_drv_info ** | info | ) |
#include <driver.h>
Allow to release driver that was registered by using struct usr_drv_info.
| [in] | info | Double pointer to struct usr_drv_info that contains information describing the driver. |
| non-negative | driver handle. |
| -1 | on failure. errno variable is set appropriately. |
Example:
| TEE_Result TEES_ReleaseInterrupt | ( | TEES_InterruptHandle | handle | ) |
#include <tee_interrupt.h>
This function is used to release interrupt.
| [in] | handle | An interrupt handle. |
| TEE_SUCCESS | on success. |
| TEE_ERROR | on failure. |
Example:
| int TEES_ReleaseUserBuffer | ( | const void * | addr, |
| const size_t | size | ||
| ) |
#include <driver.h>
Deletes the shared mapped area for the specified address range.
| [in] | addr | Starting address of releasing buffer |
| [in] | size | The length of the mapping |
| 0 | no error. |
| -1 | on failure. errno variable is set appropriately. |
Example:
| TEE_Result TEES_WaitForInterrupt | ( | TEES_InterruptHandle | handle, |
| uint32_t | timeout | ||
| ) |
#include <tee_interrupt.h>
This function is used to wait for interrupt.
| [in] | handle | An interrupt handle. |
| [in] | timeout | waiting timeout. |
| TEE_SUCCESS | on success. |
| TEE_ERROR | on failure. |
Example: