

typedef enum {
    RDA_ID = 0,
    WIDEVINE_ID,
    SOTER_ATTK,
    SOTER_COUNTER,
    GATEKEEPER_ID,
    KEYMASTER_ID,
    UNDEFINED6_ID,
    UNDEFINED7_ID
} RPMB_USER_ID;


/* Compatible with legacy API */
typedef unsigned int tlApiResult_t;

/*
 * Open session to the driver with given data
 *
 * @return  session id
 */
_TLAPI_EXTERN_C uint32_t tlApiRpmbOpenSession( uint32_t uid );


/*
 * Close session
 *
 * @param sid  session id
 *
 * @return  TLAPI_OK upon success or specific error
 */
_TLAPI_EXTERN_C tlApiResult_t tlApiRpmbCloseSession( uint32_t sid );

/**
 * rpmb read data
 *
 * @param sid        session id
 * @param offset     offset to access rpmb data for this session
 * @param buf        data buf for store the read data.
 * @param size       data length need to read
 * @result           rpmb operation result code.
 * @return           TLAPI_OK upon success or specific error
 */
_TLAPI_EXTERN_C tlApiResult_t __tlApiRpmbReadData(
        uint32_t sid,
        uint32_t offset,
        uint8_t *buf,
        uint32_t size,
        int *result);

_TLAPI_EXTERN_C tlApiResult_t tlApiRpmbReadData(
        uint32_t sid,
        uint8_t *buf,
        uint32_t bufSize,
        int *result);

/**
 * rpmb write data
 *
 * @param sid        session id
 * @param offset     offset to access rpmb data for this session
 * @param buf        data buf for store the write data.
 * @param size       data length need to write
 * @result           rpmb operation result code.
 * @return           TLAPI_OK upon success or specific error
 */
_TLAPI_EXTERN_C tlApiResult_t __tlApiRpmbWriteData(
        uint32_t sid,
        uint32_t offset,
        uint8_t *buf,
        uint32_t size,
        int *result);

_TLAPI_EXTERN_C tlApiResult_t tlApiRpmbWriteData(
        uint32_t sid,
        uint8_t *buf,
        uint32_t bufSize,
        int *result);

#if (CFG_RPMB_KEY_PROGRAMED_IN_KERNEL == 1)
_TLAPI_EXTERN_C tlApiResult_t tlApiRpmbProgramKey(
        uint32_t sid,
        int *result);
#endif