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

sah_Execute_Status sah_Wait_On_Sahara ( void   ) 

Polls Sahara to determine when its current operation is complete

Returns:
last value found in Sahara's status register

Definition at line 132 of file sah_hardware_interface.c.

References OP_STATUS, SAH_EXEC_BUSY, SAH_EXEC_DONE1_BUSY2, SAH_EXEC_ERROR1, SAH_EXEC_FAULT, SAH_EXEC_OPSTAT1, SAH_EXEC_STATE_MASK, and sah_HW_Read_Status().

Referenced by sah_HW_Reset().

{
      uint32_t count = 0;     /* ensure we don't get stuck in the loop forever */
      sah_Execute_Status status;    /* Sahara's status register */
      uint32_t stat_reg;

      pr_debug("Entered sah_Wait_On_Sahara\n");

      do {
            /* get current status register from Sahara */
            stat_reg = sah_HW_Read_Status();
            status = stat_reg & SAH_EXEC_STATE_MASK;

            /* timeout if SAHARA takes too long to complete */
            if (++count == sah_poll_timeout) {
                  status = SAH_EXEC_FAULT;
                  printk("sah_Wait_On_Sahara timed out\n");
            }

            /* stay in loop as long as Sahara is still busy */
      } while ((status == SAH_EXEC_BUSY) || (status == SAH_EXEC_DONE1_BUSY2));

      if (status == SAH_EXEC_ERROR1) {
            if (stat_reg & OP_STATUS) {
                  status = SAH_EXEC_OPSTAT1;
            }
      }

      return status;
}                       /* sah_Wait_on_Sahara() */


Generated by  Doxygen 1.6.0   Back to index