The miscellaneous service is in charge of providing access to all features not handled by the other services some examples include the following features:
- Subsystems controls - Some subsystems have settings that can be configured through the SCFW. For instance it is possible to set thresholds for a temperature alarm and get the temperature value of the sensor in different resources. For a complete list of resources and its controls please refer to the sc_fw_api document Chapter 5 Control List.
- DMA configurations - The SCFW provides access to DMA grouping and priority functions.
- Security functions - The SCFW provides some security functions such as:
- Image loading and authentication
- Fuse writing
- Life cycle management.
- Debug features - The SCFW provides some debug functionality through its miscellaneous service, some examples include:
- Output a character through the SCU UART port
- Obtain SCFW build information (SCFW version)
- Obtain device Unique ID
- For a complete list of functions supported by your device please refer to the (SVC) Miscellaneous Service chapter of the sc_fw_api document.
This guide will cover the most common functions,
Getting and setting a control
The process to get and set a control on a resource is the same for all available controls. Refer to the Control list chapter of your SoC SCFW API document for a complete list of the available controls. The following example will be based on an i.MX8QM.
The control list looks as follows:
The table lists the controls available per resource as well as the width of the data to get/set, the 'Set' column describes whether a control is 'settable' or not, for instance the temperature sensor on the A53 resource can only be read/retrieved it cannot be 'written' (set) therefore the 'Y' (yes) in this column is missing, a brief description of the control is also provided.
To get a control sc_misc_get_control must be called:
sc_misc_get_control(ipc, SC_R_A53, SC_C_TEMP, &val);
By default all calls to get_control need a pointer to a 32 bit unsigned integer, the width field on the control list table defines the span of meaningful data. In the example above the data from the temperature sensor in the A53 resource is retrieved. This call returns SC_ERR_NONE whenever it succeeds. If the parameters are invalid it returns SC_PARM and if the caller does not have access to that resource it returns SC_ERR_NOACCESS.
To set a control sc_misc_set_control must be called:
uint32_t val = high_alarm_temperature_value;
sc_misc_set_control(ipc, SC_R_A53, SC_C_TEMP_HI, val);
As in the get example sc_misc_set_control expects a 32 bit unsigned integer, it is the responsibility of the user to pass a value within the width limits defined in the control list table. In the example above the upper threshold for the A53 resource is being set/configured. The return values are the same as in sc_misc_get_control.
There is a different method for getting/setting temperatures in a friendly human readable format, the method above uses a 'raw' format to interact with the temperature sensors in the resources, an easier way is to use the sc_misc_get_temp and sc_misc_set_temp functions.
This functions return the temperature value in degrees Celsius as well as it's fractional part. To define whether to get/set the value for the temperature sensor itself or one of it's alarm the sc_misc_temp_t has been defined.
SC_MISC_TEMP -> Temperature sensor
SC_MISC_TEMP_HIGH -> Upper threshold temperature sensor alarm
SC_MISC_TEMP_LOW -> Lower threshold temperature sensor alarm
For instance to get the temperature reading from the A53 resource the following call can be made:
sc_misc_get_temp(ipc, SC_R_A53, SC_MISC_TEMP, &celsius, &tenths);
And to set the upper threshold alarm:
int16_t celsius = 80;
int8_t tenths = 0;
/* Set High temperature alarm to 80 degrees Celsius */
sc_misc_set_temp(ipc, SC_R_A53, SC_MISC_TEMP_HIGH, celsius, tenths);
Unique ID of the chip as well as the build info of the SCFW can also be obtained through the miscellaneous service, the following example queries for this information:
/* Getting SCFW version information */
sc_misc_build_info(ipc, &build_version, &commit_hash);
/* Getting Device Unique ID */
/* The ID is a 64-bit number ID_L stores the lower 32-bit portion and ID_H the 32-bit upper portion */
sc_misc_unique_id(ipc, &ID_L, &ID_H);
Refer to the sc_fw_api document for a definition of the remaining miscellaneous functions.