jnand_msm.c

来自「QUALCOMM JNAND DRIVER」· C语言 代码 · 共 116 行

C
116
字号
/*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*

                      MSM specific Functinos

GENERAL DESCRIPTION
  This module contains functiosn specific to a particular MSM


EXTERNALIZED FUNCTIONS
  clk_regime_get_NAND_wait_states
    This function provides NAND wait states to NAND device drivers
    
  clk_long_busy_wait
    This function provides a wait in microseconds using MSM Pause timer


   Copyright (c) 1998-2002 by QUALCOMM Incorporated.  
   All Rights Reserved.
*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*/


/*===========================================================================

                        EDIT HISTORY FOR MODULE

  This section contains comments describing changes made to the module.
  Notice that changes are listed in reverse chronological order.

  $Header: //depot/asic/msm6250/tools/jnand/jnand_msm.c#1 $ $DateTime: 2003/07/28 15:17:29 $ $Author: dionh $

when       who     what, where, why
--------   ---     ----------------------------------------------------------
07/24/03   drh     Initial version for MSM6250

===========================================================================*/


#include "msm.h"


/*=========================================================================
FUNCTION CLK_REGIME_GET_NAND_WAIT_STATES

DESCRIPTION
  This function returns the number of NAND wait states depending on
  the clock speed.

  1) Higher clock speeds require more wait states.
  2) It is less efficient, but not an error, to have too many wait states.

  The number of wait states needed for each clock speed is documented in the
  description of the "wait state select" field of the NAND_FLASH_CFG register.

DEPENDENCIES
  None.

RETURN VALUE
  Number of NAND wait states

SIDE EFFECTS
  None.
=============================================================================*/
uint32 clk_regime_get_NAND_wait_states (void)
{
  return
  (
     3<<(HWIO_SHFT(NAND_FLASH_CFG,WAIT_STATE_SEL)) |
     1<<(HWIO_SHFT(NAND_FLASH_CFG,RECOVER_CYCLE)) |
     0<<(HWIO_SHFT(NAND_FLASH_CFG,BUFF_MEM_WR_WAIT))
  );

} /* clk_regime_get_NAND_wait_states */

/*===========================================================================

FUNCTION CLK_LONG_BUSY_WAIT

DESCRIPTION
  This function only applies to ARM (MSM3) targets.

  Perform a busy-wait for the specified number of microseconds.  For
  short values, the clk_busy_wait macro should be used, as it will
  check for short cases, and inline the call.

DEPENDENCIES
  None

RETURN VALUE
  None

SIDE EFFECTS
  None

===========================================================================*/

void
clk_long_busy_wait (int microseconds)
{
  while (microseconds > 50)
    {
      /* If greater accuracy is needed, adjust the pause value here by
         the amount of overhead in the loop.  Measurements indicate
         that this value is small (< 1 microsecond). */
      MSM_OUT(PAUSE_TIMER, 50);
      microseconds -= 50;
    }

  /* Delay for any remaining time.  This involves a multiplication, so
   will be slower than expected. */
  if (microseconds > 0)
    MSM_OUT(PAUSE_TIMER, microseconds);
}



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?