C API
Header files
drmc.h
Typedefs
-
typedef int (*ReadRegisterCallback)(uint32_t, uint32_t*, void *user_p)
FPGA read register callback function. The register offset is relative to first register of DRM controller.
Warning
This function must be thread-safe in case of concurrency on the register bus.
- Param register_offset
[in] : Register offset relative to DRM controller IP base address.
- Param returned_data
[in] : Pointer to an integer that will contain the value of the corresponding register.
- Param user_p
[in] : User pointer.
-
typedef int (*WriteRegisterCallback)(uint32_t, uint32_t, void *user_p)
FPGA write register callback function. The register offset is relative to first register of DRM controller.
Warning
This function must be thread-safe in case of concurrency on the register bus.
- Param register_offset
[in] : Register offset relative to DRM controller IP base address.
- Param data_to_write
[in] : Data to write in register.
- Param user_p
[in] : User pointer.
-
typedef void (*AsynchErrorCallback)(const char*, void *user_p)
Asynchronous Error handling callback function. This function is called in case of asynchronous error during operation.
- Param error_message
[in] : Error message.
- Param user_p
[in] : User pointer.
Enums
Functions
- const char * DrmManager_getApiVersion () DRM_EXPORT
Return API version.
- DRM_ErrorCode DrmManager_alloc (DrmManager **p_m, const char *conf_file_path, const char *cred_file_path, ReadRegisterCallback read_register, WriteRegisterCallback write_register, AsynchErrorCallback async_error, void *user_p) DRM_EXPORT
Instantiate and initialize a DRM manager.
- Parameters
p_m – [in] : Pointer to a DrmManager pointer that will be set to the new constructed object.
conf_file_path – [in] : Path to the DRM configuration JSON file.
cred_file_path – [in] : Path to the user Accelize credential JSON file.
read_register – [in] : FPGA read register callback function.
write_register – [in] : FPGA write register callback function.
async_error – [in] : Asynchronous Error handling callback function.
user_p – [in] : User pointer that will be passed to the callback functions.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_free (DrmManager **p_m) DRM_EXPORT
Free a DRM manager object.
- Parameters
p_m – [in] : Pointer to a DrmManager pointer that will be freed. After *p_m == NULL.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_activate (DrmManager *m, bool resume_session_request) DRM_EXPORT
Activate DRM session.
This function activate/unlocks the hardware by unlocking the protected IPs in the FPGA and opening a DRM session.
If a session is still pending the behavior depends on “resume_session_request” argument. If true the session is reused. Otherwise the session is closed and a new session is created.
This function will start a thread that keeps the hardware unlocked by automatically updating the license when necessary.
Any error during this thread execution will be reported asynchronously through the “async_error” function, if provided in constructor.
When this function returns and the license is valid, the protected IPs are guaranteed to be unlocked.
- Parameters
m – [in] : Pointer to a DrmManager object.
resume_session_request – [in] : If true, the pending session is reused. If no pending session is found, create a new one. If false and a pending session is found, close it and create a new one. Set to false to have default behavior.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_deactivate (DrmManager *m, bool pause_session_request) DRM_EXPORT
Deactivate DRM session.
This function deactivates/locks the hardware back and close the session unless the “pause_session_request” argument is True. In this case, the session is kept opened for later use.
This function will join the thread keeping the hardware unlocked.
When the function returns, the hardware are guaranteed to be locked.
- Parameters
m – [in] : Pointer to a DrmManager object.
pause_session_request – [in] : If true, the current session is kept open for later usage. Otherwise, the current session is closed. Set to false to have default behavior.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_get_json_string (DrmManager *m, const char *json_in, char **json_out) DRM_EXPORT
Get information from the DRM system.
This function gives access to the internal parameter of the DRM system.
Note
The function will allocated the output string,
json_out
. This is the responsibility to the user to free it: free(json_out)- Parameters
m – [in] : Pointer to a DrmManager object.
json_in – [in] : JSON formatted string listing the parameter names requested as key associated to any value. For instance, std::string json_string = “{"NUM_ACTIVATORS”: null, “SESSION_ID”: null}”;
json_out – [out] : Pointer to a char* that will point to a JSON formatted string containing the parameter names requested and their actual values in the DRM system.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_get_bool (DrmManager *m, const DrmParameterKey key_id, bool *p_value) DRM_EXPORT
Get information from the DRM system.
This function gives access to the internal parameter of the DRM system.
- Parameters
m – [in] : Pointer to a DrmManager object.
key_id – [in] : Unique identifier of the parameter to access; available IDs are listed in DrmParameterKey.
p_value – [out] : Pointer to a boolean that will contain the value of the corresponding parameter.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_get_int (DrmManager *m, const DrmParameterKey key_id, int *p_value) DRM_EXPORT
Get information from the DRM system.
This function gives access to the internal parameter of the DRM system.
- Parameters
m – [in] : Pointer to a DrmManager object.
key_id – [in] : Unique identifier of the parameter to access; available IDs are listed in DrmParameterKey.
p_value – [out] : Pointer to an integer that will contain the value of the corresponding parameter.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_get_uint (DrmManager *m, const DrmParameterKey key_id, unsigned int *p_value) DRM_EXPORT
Get information from the DRM system.
This function gives access to the internal parameter of the DRM system.
- Parameters
m – [in] : Pointer to a DrmManager object.
key_id – [in] : Unique identifier of the parameter to access; available IDs are listed in DrmParameterKey.
p_value – [out] : Pointer to an unsigned integer that will contain the value of the corresponding parameter.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_get_int64 (DrmManager *m, const DrmParameterKey key_id, long long int *p_value) DRM_EXPORT
Get information from the DRM system.
This function gives access to the internal parameter of the DRM system.
- Parameters
m – [in] : Pointer to a DrmManager object.
key_id – [in] : Unique identifier of the parameter to access; available IDs are listed in DrmParameterKey.
p_value – [out] : Pointer to a long integer that will contain the value of the corresponding parameter.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_get_uint64 (DrmManager *m, const DrmParameterKey key_id, unsigned long long int *p_value) DRM_EXPORT
Get information from the DRM system.
This function gives access to the internal parameter of the DRM system.
- Parameters
m – [in] : Pointer to a DrmManager object.
key_id – [in] : Unique identifier of the parameter to access; available IDs are listed in DrmParameterKey.
p_value – [out] : Pointer to an unsigned long integer that will contain the value of the corresponding parameter.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_get_float (DrmManager *m, const DrmParameterKey key_id, float *p_value) DRM_EXPORT
Get information from the DRM system.
This function gives access to the internal parameter of the DRM system.
- Parameters
m – [in] : Pointer to a DrmManager object.
key_id – [in] : Unique identifier of the parameter to access; available IDs are listed in DrmParameterKey.
p_value – [out] : Pointer to a float that will contain the value of the corresponding parameter.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_get_double (DrmManager *m, const DrmParameterKey key_id, double *p_value) DRM_EXPORT
Get information from the DRM system.
This function gives access to the internal parameter of the DRM system.
- Parameters
m – [in] : Pointer to a DrmManager object.
key_id – [in] : Unique identifier of the parameter to access; available IDs are listed in DrmParameterKey.
p_value – [out] : Pointer to a double float that will contain the value of the corresponding parameter.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_get_string (DrmManager *m, const DrmParameterKey key_id, char **p_value) DRM_EXPORT
Get information from the DRM system.
This function gives access to the internal parameter of the DRM system.
- Parameters
m – [in] : Pointer to a DrmManager object.
key_id – [in] : Unique identifier of the parameter to access; available IDs are listed in DrmParameterKey.
p_value – [out] : Pointer to a string that will contain the value of the corresponding parameter.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_set_json_string (DrmManager *m, const char *json_in) DRM_EXPORT
Set information of the DRM system.
This function overwrites an internal parameter of the DRM system.
- Parameters
m – [in] : Pointer to a DrmManager object.
json_in – [in] : JSON formatted string listing the parameter names and corresponding values. For instance, std::string json_string = “{"CUSTOM_FIELD”: 0x12345678}”;
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_set_bool (DrmManager *m, const DrmParameterKey key_id, const bool value) DRM_EXPORT
Set information of the DRM system.
This function overwrites an internal parameter of the DRM system.
- Parameters
m – [in] : Pointer to a DrmManager object.
key_id – [in] : Unique identifier of the parameter to access; available IDs are listed in DrmParameterKey.
value – [in] : Boolean value to overwrite with.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_set_int (DrmManager *m, const DrmParameterKey key_id, const int value) DRM_EXPORT
Set information of the DRM system.
This function overwrites an internal parameter of the DRM system.
- Parameters
m – [in] : Pointer to a DrmManager object.
key_id – [in] : Unique identifier of the parameter to access; available IDs are listed in DrmParameterKey.
value – [in] : Integer value to overwrite with.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_set_uint (DrmManager *m, const DrmParameterKey key_id, const unsigned int value) DRM_EXPORT
Set information of the DRM system.
This function overwrites an internal parameter of the DRM system.
- Parameters
m – [in] : Pointer to a DrmManager object.
key_id – [in] : Unique identifier of the parameter to access; available IDs are listed in DrmParameterKey.
value – [in] : Unsigned integer value to overwrite with.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_set_int64 (DrmManager *m, const DrmParameterKey key_id, const long long int value) DRM_EXPORT
Set information of the DRM system.
This function overwrites an internal parameter of the DRM system.
- Parameters
m – [in] : Pointer to a DrmManager object.
key_id – [in] : Unique identifier of the parameter to access; available IDs are listed in DrmParameterKey.
value – [in] : Long integer value to overwrite with.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_set_uint64 (DrmManager *m, const DrmParameterKey key_id, const unsigned long long int value) DRM_EXPORT
Set information of the DRM system.
This function overwrites an internal parameter of the DRM system.
- Parameters
m – [in] : Pointer to a DrmManager object.
key_id – [in] : Unique identifier of the parameter to access; available IDs are listed in DrmParameterKey.
value – [in] : Unsigned long integer value to overwrite with.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_set_float (DrmManager *m, const DrmParameterKey key_id, const float value) DRM_EXPORT
Set information of the DRM system.
This function overwrites an internal parameter of the DRM system.
- Parameters
m – [in] : Pointer to a DrmManager object.
key_id – [in] : Unique identifier of the parameter to access; available IDs are listed in DrmParameterKey.
value – [in] : Float value to overwrite with.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_set_double (DrmManager *m, const DrmParameterKey key_id, const double value) DRM_EXPORT
Set information of the DRM system.
This function overwrites an internal parameter of the DRM system.
- Parameters
m – [in] : Pointer to a DrmManager object.
key_id – [in] : Unique identifier of the parameter to access; available IDs are listed in DrmParameterKey.
value – [in] : Double float value to overwrite with.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
- DRM_ErrorCode DrmManager_set_string (DrmManager *m, const DrmParameterKey key_id, const char *value) DRM_EXPORT
Set information of the DRM system.
This function overwrites an internal parameter of the DRM system.
- Parameters
m – [in] : Pointer to a DrmManager object.
key_id – [in] : Unique identifier of the parameter to access; available IDs are listed in DrmParameterKey.
value – [in] : String value to overwrite with.
- Returns
An error code defined by the enumerator DRM_ErrorCode indicating the success or the cause of the error during the function execution.
-
struct DrmManager
- #include <accelize/drmc/wrapper.h>
Typedef struct handling DRM manager.
Manage error message and Accelize DRM by handling communication with DRM controller IP and Accelize Web service.
drmc/errorcode.h
Header defining all error codes of DRM Library.
Enums
-
enum DRM_ErrorCode
Error code enum.
Values:
-
enumerator DRM_OK
Function returned successfully
-
enumerator DRM_BadArg
Bad argument provided
-
enumerator DRM_BadFormat
Bad format of provided input or config file
-
enumerator DRM_ExternFail
Fail happened in an external library
-
enumerator DRM_BadUsage
Wrong usage of the DRM Library
-
enumerator DRM_BadFrequency
Wrong value of the DRM frequency provided in the configuration file
-
enumerator DRM_WSRespError
A malformed response has been received from Accelize WebService
-
enumerator DRM_WSReqError
Failed during HTTP request to Accelize WebService
-
enumerator DRM_WSError
Error returned from Accelize WebService
-
enumerator DRM_WSMayRetry
Error with request to Accelize Webservice, retry advised
-
enumerator DRM_WSTimedOut
Error with request to Accelize Webservice, deadline has been reached
-
enumerator DRM_CtlrError
An error happened on a command to the DRM controller
-
enumerator DRM_Fatal
Fatal error, unknown error (Please contact Accelize)
-
enumerator DRM_Assert
Assertion failed internally (Please contact Accelize)
-
enumerator DRM_Debug
Generated for debug and testing only
-
enumerator DRM_PncInitError
Error from ProvenCore initialization
-
enumerator DRM_PncShmError
Error from ProvenCore to access shared memory
-
enumerator DRM_Exit
Generated for debug and testing only
-
enumerator DRM_OK