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.

Parameters:
[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.
Returns:
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 734 of file mxc_scc.c.

{
      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_BITBANK_DECREMENT && /* 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);

                  /*
                   * 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 */


Generated by  Doxygen 1.6.0   Back to index