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

📄 led_dmled.c

📁 OMAP1030 处理器的ARM 侧硬件测试代码 OMAP1030 是TI的双核处理器
💻 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 2004, (C) Copyright 2004 Texas Instruments.  All rights reserved.
*
*   Component: PROJ - DMLED Project specific functions
*   Filename:  led_dmled.c
*   Description:  The DMLED library component offers basic project functionality
*                 specific to a project and simulation/board environment.
*
* ========================================================================== */

/* ============================================================================
* STANDARD INCLUDE FILES
* ========================================================================== */

/* ============================================================================
* PROJECT SPECIFIC INCLUDE FILES
* ========================================================================== */
#include "led_dmled.h"
#include "led_top.h"

/* ============================================================================
* LOCAL TYPES AND DEFINITIONS
* ========================================================================== */


/* ============================================================================
* GLOBAL VARIABLES DECLARATIONS
* ========================================================================== */

/* ============================================================================
* LOCAL VARIABLES DECLARATIONS
* ========================================================================== */

/* ============================================================================
* LOCAL FUNCTIONS PROTOTYPES
* ========================================================================== */

/* ============================================================================
* FUNCTIONS
* =========================================================================== */

/* ========================= Function Separator ============================= */
UWORD16 DMLED_Init( void ) {
   UWORD16 returnCode = RET_OK;
   UWORD32 gpio_base_addr;
   UWORD16 DPLL_BYPASS, DPLLLOCK_TIMEOUT;
   UWORD16 j = 0;
   
   gpio_base_addr = (CTEDM_GPIO2_ADDR_LSB + (65536*CTEDM_GPIO2_ADDR_MSB));
   // Set up the AutoIdle, EnableWakeup and SmartIdle.
   gpio_syscfg(gpio_base_addr);
   // clear all 32bits of the gpio-output pins to zero except exec gpio 0
   REG32(gpio_base_addr + 0x3C) |= 0x0;

   gpio_base_addr = (CTEDM_GPIO_ADDR_LSB + (65536*CTEDM_GPIO_ADDR_MSB));
   // Set up the AutoIdle, EnableWakeup and SmartIdle.
   gpio_syscfg(gpio_base_addr);
   // clear all 32bits of the gpio-output pins to zero
   REG32(gpio_base_addr + 0x3C) |= 0x0;
   
   // 0xFFFED41C = TESTBLOCK_DMA_REQ_FB_REG (16 bit);
   // Write 0x0 to end of CTE parameter
   if ( ((CTEDM_CLK_STDY_BYPASS & 0xFFFF) == 0xFFFF) && (REG32(0xFFFED41C) == 0xFFFFFFFF) ) {
   
   // Change to synchronous scalable mode from fully synchronous mode
   ARM_SYSST_REG = CTEDM_SYNC_BYPASS_MODE;
   
   // Set clock divider: ARM=DSP=LCD run at DPLL1 freq, TC=PERI runs at DPLL/2.
   // Disable the DSP_CK activation during reset, ARM inth run at ARM/2 clk.
   ARM_CKCTL_REG = CTEDM_ARM_CLK_CONTROL;
   
   // No LDO_STEADY bit 6 of POWER_CTRL_REG (@=0xFFFE0850) register in the ULPD.
   // Disable DPLL first if already enabled
   ClearBitIndex(REG16(0xFFFECF08), 4);
   
   // Sets DPLL ratio, enable DPLL, with 384 clk cycles timeout
   REG16(0xFFFECF08) = CTEDM_DPLL1_BYPASS_VALUE;
   
   // Sets DPLL_ON or DPLL_OFF
   DPLL_BYPASS = CTEDM_DPLL1_BYPASS_VALUE;
   
   if  ((DPLL_BYPASS & 0x0010) != 0x0) {
      DPLLLOCK_TIMEOUT = CTEDM_ULPD_TIMEOUT_VALUE;
      do {
         j++;
      }
      while((!(REG16(0xFFFECF08) & 0x1)) && (j < DPLLLOCK_TIMEOUT));
      
      // Spy dump if dpll times out
      if (j >= DPLLLOCK_TIMEOUT) {
         // switch off the dpll
         REG16(0xFFFECF08) = 0x2000;
         RES_SetDMLED(LED_RES_DPLL_TIMEOUT);
      }
   }
   
   //
   DMLED_CLKCFG();
   
   // Write 0x0 to TESTBLOCK_DMA_REQ_FB_REG
   REG32(0xFFFED41C) &= 0x0;

   } // End Software CLKRST programing and NOT JTAG.
   
   // Clears the flag register for both private and public RHEA aborts
   // This a work around to fixed illegal 32bit accesses to 16bit RHEA registers
   DPLL_BYPASS = REG16(0xFFFECA1C);
   DPLL_BYPASS = REG16(0xFFFED31C);
   
   // The spy result location size is fixed at 256 bytes. The spy location
   // initialization value is 0xBABE. Initial Simulated Result Spy location
   // with 32bit 0xBABEBABE. Always execute the result location initialisation
   // before the set result location function.
   RES_Init_SimRes();
   
   // Set the location address of the result area values into the class Result
   // and then Set the automatic index to the first position
   // set location internal to spy, after location initialisation.
   RES_SetLCTnDMLED(0x05000000);
   
   return returnCode;
   
}	// End of DMLED_Init


/* ==================== Function Separator ============================= */
UWORD16 DMLED_DeInit( void ) {
    UWORD16      finalResult;
    UWORD16 returnCode = RET_OK;
  
    /* Get final test status */
    RES_GetFinalStatus(&finalResult);

    RES_ResComp(finalResult);

    /* test finished */
    RES_EndDMLED();
  
    /* loop ARM11 polling the GPIO for new sync as test finished */
    while(1){ };
    returnCode = RET_OK;
    return returnCode;
    /* this line will never be reached */
}  // DMLED_DeInit

/* ============================================================================
* LOCAL FUNCTIONS
* ========================================================================== */



/* EOF */

⌨️ 快捷键说明

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