📄 st7545.c
字号:
/*
* Copyright (c) 1995,1996,1997 by TriMedia Technologies.
*
* +------------------------------------------------------------------+
* | This software is furnished under a license and may only be used |
* | and copied in accordance with the terms and conditions of such |
* | a license and with the inclusion of this copyright notice. This |
* | software or any other copies of this software may not be provided|
* | or otherwise made available to any other person. The ownership |
* | and title of this software is not transferred. |
* | |
* | The information in this software is subject to change without |
* | any prior notice and should not be construed as a commitment by |
* | TriMedia Technologies. |
* | |
* | this code and information is provided "as is" without any |
* | warranty of any kind, either expressed or implied, including but |
* | not limited to the implied warranties of merchantability and/or |
* | fitness for any particular purpose. |
* +------------------------------------------------------------------+
*
* Module name : st7545.c 1.15
*
* Last update : 11:55:18 - 97/08/09
*
* Description :
*
* Board Support package for Thompson 7545 AFE on TM IREF board.
* Created for TCS 1.1 Release.
* Called by tmSSI portion of device library.
* This package provides only the most rudimentary support for taking
* the 7545 out of reset.
* All programming is up to the application
*
*/
#include <math.h>
#include <tmlib/tmtypes.h>
#include <tm1/tmInterrupts.h>
#include <ops/custom_defs.h>
#include <tm1/tmBoard.h>
#include <tm1/mmio.h>
#include <tm1/tmSSImmio.h>
#include "st7545.h"
#define SSI_CONTROL_PORT_ADDRESS 0x70
#define SSI_CONTROL_PORT_BITMASK 4
/*====================================================================*/
/* Definitions of static variables: */
/*====================================================================*/
/*====================================================================*/
/* L O C A L F U N C T I O N P R O T O T Y P E S */
/*====================================================================*/
/* This routine is designed to setup the hardware in device specific way.
* Generic stuff is handled in the ssiSetup.
* This routine must not leave an interrupt installed.
*/
extern tmLibdevErr_t
st7545Setup(boardSSIParam_t * param)
{
UInt iicd;
ssiReset(); /* defaults, except: */
/* toggle AFE reset */
iicReadReg(SSI_CONTROL_PORT_ADDRESS, -1, &iicd);
iicd &= ~SSI_CONTROL_PORT_BITMASK;
iicWriteReg(SSI_CONTROL_PORT_ADDRESS, -1, iicd);
iicd |= SSI_CONTROL_PORT_BITMASK;
iicWriteReg(SSI_CONTROL_PORT_ADDRESS, -1, iicd);
ssiSetModeIO1(SSI_IO1_MODE_GPI); /* IO1 is input */
ssiSetWIO2(1); /* high for on hook */
ssiSetModeIO2(SSI_IO2_MODE_GPO); /* IO2 is output high (on hook) */
#if __LITTLE_ENDIAN__
ssiLittleEndianEMS();
#else
ssiBigEndianEMS();
#endif
return TMLIBDEV_OK;
}
/*****************************************************************
* st7545Term
*/
extern tmLibdevErr_t
st7545Term(void)
{
unsigned int iicd;
/* ssi to reset */
ssiReset();
ssiSetWIO2(1); /* IO2 is output high (on hook) */
ssiSetModeIO2(SSI_IO2_MODE_GPO);
ssiSetModeIO1(SSI_IO1_MODE_GPI); /* IO1 is input */
/* AFE to reset */
iicReadReg(SSI_CONTROL_PORT_ADDRESS, -1, &iicd);
iicd &= ~SSI_CONTROL_PORT_BITMASK;
iicWriteReg(SSI_CONTROL_PORT_ADDRESS, -1, iicd);
return TMLIBDEV_OK;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -