📄 uda13xx.c
字号:
/*
* Copyright (c) 1999 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 : uda13xx.c 1.7
*
* Last update : 18:43:51 - 00/11/09
*
* Description :
*
*
*
*/
#include <tm1/tmLibdevErr.h>
#include <tm1/tmIIC.h>
#include <tmlib/tmtypes.h>
#include <tm1/tmAssert.h>
#include <tmlib/dprintf.h> /* for debugging with DP(()) */
#include "uda13xx.h"
/*-------------------------------statics-------------------------------------*/
/*------------------------------functions------------------------------------*/
extern tmLibdevErr_t uda13xxInitOutput(puda13xxParam_t p, puda13xxOutputParam_t op)
{
tmLibdevErr_t err;
switch (p->mode)
{
case uda13xxIICMode:
/* L3 with IIC */
return UDA13XX_ERR_MODE_NOT_SUPPORTED;
case uda13xxGPIOMode:
case uda13xxXIOMode:
{
/* L3 with XIO */
puda13xxRegisters_t regs = p->regs;
pl3Param_t l3params = (pl3Param_t) (p->modeParams);
Char data[4];
tmAssert(regs, -1);
tmAssert(l3params, -1);
/* set default values for registers */
l3params->data = data;
/* write status registers */
data[0] = regs->status0 = 0x20;
data[1] = regs->status1 = 0x80;
l3params->l3Address = (UDA13XX_L3_ADDRESS << 2) | UDA13XX_L3_STATUS_MODE;
l3params->numberOfBytes = 2;
l3params->data = data;
err = l3Write(l3params);
tmAssert(err == TMLIBDEV_OK, err);
/* write data registers */
data[0] = regs->data0 = 0x00;
data[1] = regs->data1 = 0x40;
data[2] = regs->data2 = 0x80;
data[3] = regs->data3 = 0xc1;
l3params->l3Address = (UDA13XX_L3_ADDRESS << 2) | UDA13XX_L3_DATA_MODE;
l3params->numberOfBytes = 4;
l3params->data = data;
err |= l3Write(l3params);
tmAssert(err == TMLIBDEV_OK, err);
}
break;
default:
return UDA13XX_ERR_MODE_NOT_SUPPORTED;
}
return err;
}
extern tmLibdevErr_t uda13xxInitInput(puda13xxParam_t p, puda13xxInputParam_t ip)
{
return TMLIBDEV_OK;
}
extern tmLibdevErr_t uda13xxConfigOutput(puda13xxParam_t p, UInt32 subAddr, Pointer value)
{
return TMLIBDEV_OK;
}
extern tmLibdevErr_t uda13xxConfigInput(puda13xxParam_t p, UInt32 subAddr, Pointer value)
{
return TMLIBDEV_OK;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -