📄 fpga.c
字号:
/*
===============================================================================
TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION
Property of Texas Instruments
For Unrestricted Internal Use Only
Unauthorized reproduction and/or distribution is strictly prohibited.
This product is protected under copyright law and trade secret law
as an unpublished work.
Created 1999, (C) Copyright 1999 Texas Instruments. All rights reserved.
Filename : fpga.c
Description : Header file for fpga board access functions
===============================================================================
*/
#include "fpga.h"
//for OMAP1510TEB
#ifdef APEX
//-----------------------------------------------------------------------------
// FPGA_RevisionRead
//-----------------------------------------------------------------------------
UWORD16 FPGA_RevisionRead(void)
{
return(*(REGISTER_UWORD16*)FPGA_ELPD_REVISION_ADDR);
}
//-----------------------------------------------------------------------------
// FPGA_Write(UWORD16 value)
//-----------------------------------------------------------------------------
void FPGA_Write(UWORD32 reg_add, UWORD16 reg_mask, UWORD16 reg_value)
{
UWORD16 idx_location, value, registre;
idx_location = reg_mask;
value = (UWORD16)reg_value;
registre= *(REGISTER_UWORD16*)reg_add;
while((idx_location & 0x0001) == 0)
{
idx_location >>= 1;
value <<= 1;
}
registre &= ~reg_mask;
registre |= ((UWORD16)value & reg_mask);
*(REGISTER_UWORD16*)reg_add = registre;
}
//
//-----------------------------------------------------------------------------
// FPGA_Read
//-----------------------------------------------------------------------------
UWORD16 FPGA_Read(UWORD32 reg_add)
{
return (*(UWORD16*)reg_add);
}
#else
//for HELENDCEVM
//-----------------------------------------------------------------------------
// FPGA_Write(UWORD16 value)
//-----------------------------------------------------------------------------
void FPGA_Write(UWORD16 reg_mask, UWORD16 value)
{
// Notes regsiter fpga value is read only
// so reg_value represent its value
static UWORD16 reg_value = DEFAULT_REGISTER_FPGA_VALUE;
UWORD16 idx_location;
idx_location = reg_mask;
// shift value to write according to mask
while((idx_location & 0x0001) == 0)
{
idx_location >>= 1;
value <<= 1;
}
reg_value &= ~reg_mask;
reg_value |= ((UWORD16)value & reg_mask);
FPGA_REG = reg_value;
}
//
//-----------------------------------------------------------------------------
// FPGA_Read
//-----------------------------------------------------------------------------
UWORD16 FPGA_Read(void)
{
return(FPGA_REG);
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -