Read value from an SCC register. The offset will be checked for validity (range) as well as whether it is accessible (e.g. not busy, not in failed state) at the time of the call.
For internal use only. Verify that the register_offset is a) valid, b) refers to a readable register, and c) the SCC is in a state which would allow a read of this register. Definition at line 881 of file scc2_driver.c. References check_register_accessible(), check_register_offset(), scc_availability, scc_init(), SCC_READ_REGISTER, SCC_RET_FAIL, SCC_RET_OK, SCC_STATUS_INITIAL, SCC_STATUS_UNIMPLEMENTED, scc_update_state(), SCM_STATUS, SCM_STATUS_REG, SMN_BB_DEC_REG, and SMN_BITBANK_DECREMENT. { scc_return_t return_status = SCC_RET_FAIL; uint32_t smn_status; uint32_t scm_status; if (scc_availability == SCC_STATUS_INITIAL) { scc_init(); } /* First layer of protection -- completely unaccessible SCC */ if (scc_availability != SCC_STATUS_UNIMPLEMENTED) { /* Second layer -- that offset is valid */ if (register_offset != SMN_BB_DEC_REG && /* write only! */ check_register_offset(register_offset) == SCC_RET_OK) { /* Get current status / update local state */ smn_status = scc_update_state(); scm_status = SCC_READ_REGISTER(SCM_STATUS_REG); /* * Third layer - verify that the register being requested is * available in the current state of the SCC. */ if ((return_status = check_register_accessible(register_offset, smn_status, scm_status)) == SCC_RET_OK) { *value = SCC_READ_REGISTER(register_offset); } } } return return_status; } /* scc_read_register */
|