Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

scc_return_t scc_read_register ( int  register_offset,
uint32_t *  value 

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.

[in] register_offset The (byte) offset within the SCC block of the register to be queried. See SCM Registers and SMN Registers.
[out] value Pointer to where value from the register should be placed.
0 if OK, non-zero on error. See scc_return_t.

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) {

      /* 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 =
                                           scm_status)) ==
                      SCC_RET_OK) {
                        *value = SCC_READ_REGISTER(register_offset);

      return return_status;
}                       /* scc_read_register */

Generated by  Doxygen 1.6.0   Back to index