⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zl5011xrdwr.c

📁 Zalink50114----TDMoIP芯片驱动源码
💻 C
字号:
/*******************************************************************************
*
*  File name:              zl5011xRdWr.c
*
*  Version:                9
*
*  Author:                 MRC
*
*  Date created:           08/02/2002
*
*  Copyright 2002, 2003, 2004, 2005, Zarlink Semiconductor Limited.
*  All rights reserved.
*
*  Module Description:
*
*  This file contains the low level functions used to access the device.
*
*  Revision History:
*
*  Rev:  Date:       Author:  Comments:
*  1     08/02/2002  MRC      Creation
*  2     15/02/2002  MRC      Added debug mode for read / writes
*  3     20/02/2002  MRC      Update
*  4     22/02/2002  MRC      Update
*  5     29/05/2002  MRC      Update
*  6     29/10/2002  ARW      Added conditiona; code for running on a PPC card
*  7     31/10/2002  MRC      Added variants + minor fixes
*  8     06/05/2003  MRC      Added address offset to trace
*  9     23/09/2003  AMS      added logRegisterAccess
*
*******************************************************************************/

/*****************   INCLUDE FILES   ******************************************/

#include "zl5011x.h"
#include "zl5011xRdWr.h"

#ifdef _NO_DEVICE
   extern Uint32T *getRegister(AddressT);
   extern void logRegisterAccess( const char *action, AddressT addr, Uint32T data );
#endif

/*******************************************************************************

 Function:
   zl5011xRead

 Description:
   This function is used to perform 32 bit reads from the device.

 Inputs:
   zl5011xParams      Pointer to the structure for this device instance
   Address           Address to read from  (should be 4 byte aligned)

 Outputs:
   memValue          Pointer to store the data read from the device

 Returns:
   zlStatusE

 Remarks:
   None

*******************************************************************************/

zlStatusE zl5011xRead(zl5011xParamsS* zl5011xParams, AddressT address, Uint32T *memValue)
{
   zlStatusE status = ZL5011X_OK;

   /* read the data */
   /*GAR LE1VE的寄存器的映射方法比较特殊,所以此函数要重写*/
#if 1   
    ZL5011X_REG_READ(zl5011xParams->slotNum, address, (UINT32 *)memValue);
#else
#ifdef _NO_DEVICE
   *memValue = *(Uint32T *)(getRegister(address));
   logRegisterAccess( "Read", address, *memValue );
#else
   *memValue = *(Uint32T *)(zl5011xParams->baseAdd + address);
#endif

   ZL5011X_TRACE(ZL5011X_READ, "zl5011xRead:  A = %08lX, D = %08lX",
         (Uint32T)(zl5011xParams->baseAdd + address), *memValue, 0, 0, 0, 0);
#endif  /*#if 0*/
   return(status);
}

/*******************************************************************************

 Function:
   zl5011xWrite

 Description:
   This function is used to perform 32 bit writes to the device.

 Inputs:
   zl5011xParams      Pointer to the structure for this device instance
   Address           Address to write to (should be 4 byte aligned)
   memValue          data to write to the device

 Outputs:
   None

 Returns:
   zlStatusE

 Remarks:
   None

*******************************************************************************/

zlStatusE zl5011xWrite(zl5011xParamsS* zl5011xParams, AddressT address, Uint32T memValue)
{
   zlStatusE status = ZL5011X_OK;

   /*GAR LE1VE的寄存器的映射方法比较特殊,所以此函数要重写*/
#if 1
	ZL5011X_REG_WRITE(zl5011xParams->slotNum, address, memValue);
#else
   /* write the data */
#ifdef _NO_DEVICE
   *(Uint32T *)(getRegister(address)) = memValue;
   logRegisterAccess( "Write", address, memValue );
#else
   *(Uint32T *)(zl5011xParams->baseAdd + address) = memValue;
#endif

   ZL5011X_TRACE(ZL5011X_WRITE, "zl5011xWrite: A = %08lX, D = %08lX",
         (Uint32T)(zl5011xParams->baseAdd + address), memValue, 0, 0, 0, 0);
#endif
   return(status);
}

/*****************   END   ****************************************************/

⌨️ 快捷键说明

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