/*-----------------------------------------------------------------------------
* Source Location: OMAPL1x/support/src/
* File: OMAPL1x_common.c
*
* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*---------------------------------------------------------------------------*/
#ifdef OMAPL137
#include <OMAPL137_common.h>
#elif OMAPL138
#include <OMAPL138_common.h>
#endif
/*-----------------------------------------------------------------------------
*
* Global Variables Used in rCSL Examples
*
*---------------------------------------------------------------------------*/
// Pointers to OMAPL1x Module Memory Mapped Registers
CSL_SyscfgRegsOvly sysRegs = (CSL_SyscfgRegsOvly)(CSL_SYSCFG_0_REGS);
CSL_PscRegsOvly psc0Regs = (CSL_PscRegsOvly)(CSL_PSC_0_REGS);
CSL_PscRegsOvly psc1Regs = (CSL_PscRegsOvly)(CSL_PSC_1_REGS);
CSL_PllcRegsOvly pll0Regs = (CSL_PllcRegsOvly)(CSL_PLLC_0_REGS);
CSL_GpioRegsOvly gpioRegs = (CSL_GpioRegsOvly)(CSL_GPIO_0_REGS);
CSL_I2cRegsOvly i2c0Regs = (CSL_I2cRegsOvly)(CSL_I2C_0_REGS);
CSL_TmrRegsOvly tmr0Regs = (CSL_TmrRegsOvly)(CSL_TMR_0_REGS);
CSL_TmrRegsOvly tmr1Regs = (CSL_TmrRegsOvly)(CSL_TMR_1_REGS);
CSL_UartRegsOvly uart0Regs = (CSL_UartRegsOvly)(CSL_UART_0_REGS);
CSL_UartRegsOvly uart2Regs = (CSL_UartRegsOvly)(CSL_UART_2_REGS);
CSL_AintcRegsOvly aintcRegs = (CSL_AintcRegsOvly)(CSL_AINTC_0_REGS);
CSL_DspintcRegsOvly dspintcRegs = (CSL_DspintcRegsOvly)(CSL_INTC_0_REGS);
// Common Global Example Variables (Not Specific to OMAPL1x)
volatile int runExample, runTimerDelay, counter, errorCount;
// ARM System Interrupt Table (Map System Interrupts to Corresponding ISRs)
ISRpointer sysISRtbl[NUM_AINTC_EVENTID] = {NULL};
// Global PSC Variables
volatile Bool modulesEnabled;
volatile int pscTimeoutCount;
// Global UART/I2C Variables (Use with Interrupts)
volatile Bool dataUnavailable;
volatile Bool transmitterFull;
/*-----------------------------------------------------------------------------
*
* Global Variables Used in OMAPL1x_common.c Only
*
*---------------------------------------------------------------------------*/
// Used in I2C0 Functions
static volatile int _counter;
/*-----------------------------------------------------------------------------
*
* OMAPL1x PSC1 Functions
*
*---------------------------------------------------------------------------*/
// Function: check_psc_transition
// Return: Integer - Value of variable pscTimeoutCount
int check_psc_transition (void)
{
// Reset the PSC Timeout Counter
pscTimeoutCount = 0;
// Increment the PSC Timeout Counter While the PSC is in Transition
while((CSL_FEXT(psc1Regs->PTSTAT, PSC_PTSTAT_GOSTAT0)
== CSL_PSC_PTSTAT_GOSTAT0_IN_TRANSITION)
&& (pscTimeoutCount != pscTimeout))
pscTimeoutCount++;
// Return the PSC Timeout Counter
return pscTimeoutCount;
}/* check_psc_transition */
// Function: check_psc_MDSTAT
// Return: Integer - Value of variable pscTimeoutCount
// Arguments: Integer - PSC Module number
int check_psc_MDSTAT (int module)
{
// Reset the PSC Timeout Counter
pscTimeoutCount = 0;
// Increment the PSC Timeout Counter While the
// Specified Module State is Disabled
while((CSL_FEXT(psc1Regs->MDSTAT[module], PSC_MDSTAT_STATE)
!= CSL_PSC_MDSTAT_STATE_ENABLE) && (pscTimeoutCount != pscTimeout))
pscTimeoutCount++;
// Return the PSC Timeout Counter
return pscTimeoutCount;
} /* check_psc_MDSTAT */
/*-----------------------------------------------------------------------------
*
* OMAPL1x I2C0 Functions
*
*---------------------------------------------------------------------------*/
int I2C_write (Uint16 i2c_addr, Uint8* data, Uint16 len)
{
// Specify Number of Data Words to Transfer (Only for Master Mode)
CSL_FINS(i2c0Regs->ICCNT, I2C_ICCNT_ICDC, len);
// Specify I2C Slave Address
CSL_FINS(i2c0Regs->ICSAR, I2C_ICSAR_SADDR, i2c_addr);
// Configure I2C Peripheral as Master Transmitter
CSL_FINST(i2c0Regs->ICMDR, I2C_ICMDR_MST, MASTER_MODE);
CSL_FINST(i2c0Regs->ICMDR, I2C_ICMDR_TRX, TX_MODE);
// Send Start Signal on I2C Bus
CSL_FINST(i2c0Regs->ICMDR, I2C_ICMDR_STT, SET);
// Send Data to Slave on I2C Bus
for(_counter = 0; _counter < len; _counter++)
{
// Send Data to the Transmit Buffer
CSL_FINS(i2c0Regs->ICDXR, I2C_ICDXR_D, data[_counter]);
// Wait for Transmit Buffer to Clear or NACK Signal
while((CSL_FEXT(i2c0Regs->ICSTR, I2C_ICSTR_ICXRDY) == 0)
&& (CSL_FEXT(i2c0Regs->ICSTR, I2C_ICSTR_ARDY) == 0));
// Check for NACK Signal
if(CSL_FEXT(i2c0Regs->ICSTR, I2C_ICSTR_NACK) == 1)
{
// Terminate I2C Transfer
terminate_I2C_transfer();
// Retry I2C Write
return 1;
}
}
// Wait for access to the I2C Registers
while(CSL_FEXT(i2c0Regs->ICSTR, I2C_ICSTR_ARDY) == 0);
// Terminate I2C Transfer
terminate_I2C_transfer();
// I2C Write Successful
return 0;
}/* I2C_write */
/*---------------------------------------------------------------------------*/
int I2C_read (Uint16 i2c_addr, Uint8* data, Uint16 len)
{
// Specify Number of Data Words to Receive (Only for Master Mode)
CSL_FINS(i2c0Regs->ICCNT, I2C_ICCNT_ICDC, len);
// Specify I2C Slave Address
CSL_FINS(i2c0Regs->ICSAR, I2C_ICSAR_SADDR, i2c_addr);
// Configure I2C Peripheral as Master Receiver
CSL_FINST(i2c0Regs->ICMDR, I2C_ICMDR_MST, MASTER_MODE);
CSL_FINST(i2c0Regs->ICMDR, I2C_ICMDR_TRX, RX_MODE);
// Send Start Signal on I2C Bus
CSL_FINST(i2c0Regs->ICMDR, I2C_ICMDR_STT, SET);
// Receive Data from Slave on I2C Bus
for(_counter = 0; _counter < len; _counter++)
{
// Wait for Receiver Buffer to Clear of NACK Signal
while((CSL_FEXT(i2c0Regs->ICSTR, I2C_ICSTR_ICRRDY) == 0)
&& (CSL_FEXT(i2c0Regs->ICSTR, I2C_ICSTR_ARDY) == 0));
// Check for NACK Signal
if(CSL_FEXT(i2c0Regs->ICSTR, I2C_ICSTR_NACK) == 1)
{
// Terminate I2C Transfer
terminate_I2C_transfer();
// Retry I2C Read
return 1;
}
// Store Data from the Receiver Buffer
data[_counter] = CSL_FEXT(i2c0Regs->ICDRR, I2C_ICDRR_D);
}
// Wait for access to the I2C Registers
while(CSL_FEXT(i2c0Regs->ICSTR, I2C_ICSTR_ARDY) == 0);
// Terminate I2C Transfer
terminate_I2C_transfer();
// I2C Read Successful
ret
没有合适的资源?快使用搜索试试~ 我知道了~
OMAPL138.zip_OMAPL DSP_omapl138
共97个文件
h:65个
obj:10个
c:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 185 浏览量
2022-07-14
01:55:10
上传
评论
收藏 724KB ZIP 举报
温馨提示
OMAPL138 的gpio,edma,中断控制,调试通过,可用
资源推荐
资源详情
资源评论
收起资源包目录
OMAPL138.zip (97个子文件)
OMAPL138
linker_OMAPL138.cmd 1KB
OMAPL138_GPIO_trigger_EDMA_Demo.paf2 6KB
OMAPL138_GPIO_trigger_EDMA_Demo.pjt 1KB
support
cmd
OMAPL138_ARM.cmd 2KB
OMAPL138_ARM_3_3.cmd 2KB
obj
Debug
ARM9_handler.obj 2KB
OMAPL1x_common.obj 28KB
ARM9_intvecs.obj 2KB
ARM9_initstack.obj 2KB
src
ARM9_intvecs.asm 4KB
ARM9_handler.asm 7KB
ARM9_initstack.asm 4KB
OMAPL1x_common.c 9KB
includes
ti
pspiom
cslr
cslr_idma.h 17KB
cslr_pllc_C6748.h 23KB
soc_C6747.h 43KB
cslr_mdio.h 12KB
cslr_dspintc.h 146KB
soc_OMAPL138.h 55KB
cslr_mcasp.h 158KB
cslr_psc_C6748.h 21KB
cslr_i2c.h 21KB
csl_types.h 3KB
cslr.h 4KB
cslr_pllc_C6747.h 20KB
cslr_cache.h 14KB
cslr_psc_OMAPL138.h 21KB
cslr_syscfg1_C6748.h 42KB
cslr_vpif.h 42KB
cslr_lcdc.h 26KB
cslr_mmcsd.h 30KB
cslr_chip.h 37KB
soc_C6748.h 55KB
cslr_syscfg0_OMAPL138.h 128KB
soc_OMAPL137.h 43KB
cslr_mcbsp.h 110KB
cslr_syscfg_C6747.h 128KB
cslr_emac1.h 78KB
cslr_ehrpwm.h 29KB
cslr_pllc_OMAPL138.h 23KB
cslr_emifa2.h 53KB
cslr_syscfg0_C6748.h 128KB
cslr_eqep.h 28KB
csl_error.h 5KB
cslr_hpi.h 6KB
cslr_syscfg_OMAPL137.h 128KB
cslr_ectl1.h 36KB
cslr_ddr2_mddr.h 24KB
csl.h 2KB
cslr_usb_ohci.h 32KB
cslr_syscfg1_OMAPL138.h 42KB
cslr_tmr.h 28KB
cslr_rtc.h 17KB
cslr_sata.h 36KB
csl_version.h 3KB
cslr_edma3tc.h 23KB
cslr_spi.h 45KB
cslr_pllc_OMAPL137.h 20KB
cslr_emifb.h 15KB
cslr_gpio.h 67KB
cslr_psc_OMAPL137.h 21KB
cslr_upp.h 36KB
cslr_aintc.h 41KB
cslr_uart.h 20KB
cslr_edma3cc.h 184KB
cslr_usb_otg.h 122KB
cslr_psc_C6747.h 21KB
tistdtypes.h 4KB
cslr_ecap.h 17KB
OMAPL138_common.h 9KB
TIMER_interrupt_armL138.h 2KB
Debug.lkf 1013B
src
main.c 7KB
OMAPL138_init.c 5KB
OMAPL138_GPIO_trigger_EDMA_Demo.CS_
SYMBOL.DBF 524KB
FILE.CDX 3KB
FILE.FPT 2KB
FILE.DBF 960B
SYMBOL.FPT 1.13MB
SYMBOL.CDX 532KB
includes
evmomapl138_ddr.h 2KB
evmomapl138_sysconfig.h 3KB
evmomapl138.h 9KB
evmomapl138_psc.h 4KB
evmomapl138_pll.h 4KB
types.h 749B
OMAPL138_init.h 66B
memory.map 17KB
Debug
ARM9_handler.obj 2KB
OMAPL138_init.obj 21KB
main.obj 22KB
OMAPL1x_common.obj 28KB
ARM9_intvecs.obj 2KB
OMAPL138_GPIO_trigger_EDMA_Demo.out 135KB
ARM9_initstack.obj 2KB
OMAPL138_GPIO_trigger_EDMA_Demo.sbl 5KB
cc_build_Debug.log 3KB
共 97 条
- 1
资源评论
小贝德罗
- 粉丝: 69
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功