diff --git a/include/sdfw/sdfw_services/device_info_service.h b/include/sdfw/sdfw_services/device_info_service.h index 9a5f9e47c0d..cf267b98c9a 100644 --- a/include/sdfw/sdfw_services/device_info_service.h +++ b/include/sdfw/sdfw_services/device_info_service.h @@ -15,8 +15,8 @@ /** .. include_startingpoint_device_info_header_rst */ /** * @brief Read UUID value. - * - * @note UUID is provided in words, byte order is the same as + * + * @note UUID is provided in words, byte order is the same as * read from the memory and no endianness swapping is performed. * * @param[out] uuid_words Local buffer for copying the UUID words into. @@ -24,7 +24,7 @@ * * @return 0 on success, otherwise a negative errno. */ -int ssf_device_info_get_uuid(uint32_t* uuid_words, size_t uuid_words_count); +int ssf_device_info_get_uuid(uint32_t *uuid_words, size_t uuid_words_count); /** .. include_endpoint_device_info_header_rst */ diff --git a/subsys/sdfw_services/services/device_info/device_info_service.c b/subsys/sdfw_services/services/device_info/device_info_service.c index 57a9073d46b..47281b7ae0d 100644 --- a/subsys/sdfw_services/services/device_info/device_info_service.c +++ b/subsys/sdfw_services/services/device_info/device_info_service.c @@ -30,16 +30,17 @@ int ssf_device_info_get_uuid(uint32_t *uuid_words, size_t uuid_words_count) int err = -1; /* initialize with negative value for error */ if ((NULL != uuid_words) && (uuid_words_count >= UUID_BYTES_LENGTH)) { - // valid parameters int ret = -1; /* initialize with negative value for error */ const uint8_t *rsp_pkt; /* For freeing response packet after copying rsp_str. */ struct device_info_service_read_req uuid_read_req = { - .device_info_service_read_req_target.device_info_target_choice = device_info_target_UUID_c, + .device_info_service_read_req_target.device_info_target_choice = + device_info_target_UUID_c, }; struct device_info_req read_req = { - .device_info_req_msg_choice = device_info_req_msg_device_info_service_read_req_m_c, + .device_info_req_msg_choice = + device_info_req_msg_device_info_service_read_req_m_c, .device_info_req_msg_device_info_service_read_req_m = uuid_read_req }; @@ -50,32 +51,39 @@ int ssf_device_info_get_uuid(uint32_t *uuid_words, size_t uuid_words_count) return err; } - struct device_info_service_read_resp uuid_read_resp = read_resp.device_info_resp_msg_device_info_service_read_resp_m; - if (read_resp.device_info_resp_msg_choice == device_info_resp_msg_device_info_service_read_resp_m_c) { - if (device_info_target_UUID_c == uuid_read_resp.device_info_service_read_resp_target.device_info_target_choice) { - ret = read_resp.device_info_resp_msg_device_info_service_read_resp_m.device_info_service_read_resp_status.device_info_status_choice; + struct device_info_service_read_resp uuid_read_resp = + read_resp.device_info_resp_msg_device_info_service_read_resp_m; + if (read_resp.device_info_resp_msg_choice == + device_info_resp_msg_device_info_service_read_resp_m_c) { + if (device_info_target_UUID_c == + uuid_read_resp.device_info_service_read_resp_target.device_info_target_choice) { + ret = read_resp. + device_info_resp_msg_device_info_service_read_resp_m. + device_info_service_read_resp_status.device_info_status_choice; if (device_info_status_SUCCESS_c != ret) { ssf_client_decode_done(rsp_pkt); return ret; } } else { - // not a read UUID response + /* not a read UUID response */ ssf_client_decode_done(rsp_pkt); return device_info_status_INTERNAL_ERROR_c; } } else { - // not a read response + /* not a read response */ ssf_client_decode_done(rsp_pkt); return device_info_status_INTERNAL_ERROR_c; } size_t uuid_words_len = uuid_read_resp.device_info_service_read_resp_data_uint_count; - memcpy(uuid_words, uuid_read_resp.device_info_service_read_resp_data_uint, uuid_words_len * sizeof(uint32_t)); + memcpy(uuid_words, + uuid_read_resp.device_info_service_read_resp_data_uint, + uuid_words_len * sizeof(uint32_t)); ssf_client_decode_done(rsp_pkt); } else { - // invalid parameters + /* invalid parameters */ err = -1; } diff --git a/subsys/sdfw_services/services/device_info/device_info_service.cddl b/subsys/sdfw_services/services/device_info/device_info_service.cddl index 15fe1b41848..376c7a921a2 100644 --- a/subsys/sdfw_services/services/device_info/device_info_service.cddl +++ b/subsys/sdfw_services/services/device_info/device_info_service.cddl @@ -7,10 +7,10 @@ ; .. include_startingpoint_device_info_cddl_rst device_info_status = (SUCCESS: 0) / - (INTERNAL_ERROR: 16781313) / + (INTERNAL_ERROR: 16781313) / (UNPROGRAMMED: 16781314) -device_info_target = (UUID: 0) / +device_info_target = (UUID: 0) / (TYPE: 1) / (TESTIMPRINT: 2) / (PARTNO: 3) /