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

📄 ezkitbf538_initcode.h

📁 General EXAMPLE project for initialization code. This file will be executed on the processor prior
💻 H
字号:
/****************************************************************************
 Include Section
*****************************************************************************/

#include <blackfin.h>
#include "defBF538_add.h"
#include "nblackfin.h"

/*****************************************************************************
 Symbolic constants / definitions
******************************************************************************/

#define IRQ_PLL_WAKEUP          PLL_WAKEUP_IRQ      /* PLL Wakeup Interrupt Request */

/*****************************************************************************
 Dynamic Power Managment
*****************************************************************************/


/********************************
* PLL Control Register Value    *
* Reset = 0x1440                *
* ADSP-BF538F EZ-KIT Lite:      *
* CLKIN = 25MHz                 *
* MSEL = 21                     *
* --> VCO = 25MHz x 21 = 525MHz *
********************************/

#define PLL_CTL_VAL             (\
                               nBYPASS           |  /* Bypass the PLL */\
                               nPDWN             |  /* Enter Deep Sleep Mode */\
                               nSTOPCK           |  /* Core Clock Off */\
                               nPLL_OFF          |  /* PLL Not Powered */\
                               nDF               |  /* 0: PLL = CLKIN, 1: PLL = CLKIN/2 */\
                                SET_MSEL(21)     |  /* Set MSEL = 0-63 --> VCO = CLKIN*MSEL */\
                                SET_OUT_DELAY(0) |  /* Nominal output delay */\
                                SET_IN_DELAY(0)  |  /* Nominal input delay */\
                                0)

#define CLKIN_Hz                25000000            /* CLKIN [Hz] */

#define VCO_MAX_Hz              600000000           /* VCO [Hz] */


/***********************************
* PLL Divide Register Value        *
* Reset = 0x0005                   *
* ADSP-BF538 EZ-KIT Lite:          *
* CSEL = 1                         *
* --> CCLK = VCO / CSEL            *
* --> CCLK = 525MHz / 1 = 525MHz   *
* SSEL = 4                         *
* --> SCLK = VCO / SSEL            *
* --> SCLK = 525MHz / 4 = 131MHz   *
***********************************/

#define PLL_DIV_VAL             (\
                                SET_SSEL(4)     |   /* Set SSEL = 1-15 --> SCLK = VCO/SSEL */\
                                CCLK_DIV1       |   /* CCLK = VCO / 1 */\
                                0)

#define CCLK_MAX_Hz             VCO_MAX_Hz          /* Maximum Core Clock [Hz] */

#define SCLK_MAX_Hz             133000000           /* Maximum System Clock [Hz] */


/********************************
* PLL Lock Count Register Value *
* Reset = 0x0200                *
********************************/

#define PLL_LOCKCNT_VAL         0x0200


/****************************
* PLL Status Register Value *
* Reset = 0x00A2            *
****************************/

#define PLL_STAT_VAL            (\
                                0x0010              |   /* Bit #7 set by default */\
                                PLL_LOCKED          |   /* PLL Locked Status */\
                               nACTIVE_PLLDISABLED  |   /* Active Mode With PLL Disabled */\
                                FULL_ON             |   /* Full-On Mode */\
                               nACTIVE_PLLENABLED   |   /* Active Mode With PLL Enabled */\
                                0)


/*******************************************
* Voltage Regulator Control Register Value *
* Reset = 0x00DB                           *
*******************************************/

#define VR_CTL_VAL              (\
                               nSCKELOW         |   /* Do Not Drive SCKE High During Reset After Hibernate */\
                               nWAKE            |   /* Enable RTC/Reset Wakeup From Hibernate */\
                               nCANWE           |   /* Enable CAN Wakeup From Hibernate */\
                               nGPWE            |   /* Enable General-Purpose Wakeup From Hibernate */\
                                VLEV_125        |   /* VLEV = 1.25 V (-5% - +10% Accuracy) */\
                                GAIN_20         |   /* GAIN = 20 */\
                                FREQ_1000       |   /* Switching Frequency Is 1 MHz */\
                                0)


/*****************************************************************************
 EBIU: Asynchronous Memory
*****************************************************************************/


/****************************************************
* Asynchronous Memory Global Control Register Value *
* Reset = 0x00F2                                    *
* ADSP-BF538-proc.xml = 0x00FF                      *
* --> Enabling all four Async Banks and Clock Out   *
****************************************************/

#define EBIU_AMGCTL_VAL         (\
                               nCDPRIO          |   /* Core/DMA Priority */\
                                AMCKEN          |   /* Enable CLKOUT */\
                                AMBEN_ALL           /* 4MB Asynchronous Memory */\
                                )


/****************************************************
* Asynchronous Memory Bank Control 0 Register Value *
* Reset = 0xFFC2 FFC2                               *
* here = 0x7BB0 7BB0                                *
****************************************************/

#define EBIU_AMBCTL0_VAL        (\
                                B1WAT_7         |  /* B1 Write Access Time = 7 cycles */\
                                B1RAT_11        |  /* B1 Read Access Time = 11 cycles */\
                                B1HT_2          |  /* B1 Hold Time from Read/Write deasserted to AOE deasserted = 2 cycles */\
                                B1ST_3          |  /* B1 Setup Time from AOE asserted to Read/Write asserted=3 cycles */\
                                B0WAT_7         |  /* B0 Write Access Time = 7 cycles */\
                                B0RAT_11        |  /* B0 Read Access Time = 11 cycles */\
                                B0HT_2          |  /* B0 Hold Time from Read/Write deasserted to AOE deasserted = 2 cycles */\
                                B0ST_3          |  /* B0 Setup Time from AOE asserted to Read/Write asserted=3 cycles */\
                                0)


/****************************************************
* Asynchronous Memory Bank Control 1 Register Value *
* Reset = 0xFFC2 FFC2                               *
* here = 0x7BB0 7BB0                                *
****************************************************/

#define EBIU_AMBCTL1_VAL        (\
                                B3WAT_7         |  /* B3 Write Access Time = 7 cycles */\
                                B3RAT_11        |  /* B3 Read Access Time = 11 cycles */\
                                B3HT_2          |  /* B3 Hold Time from Read/Write deasserted to AOE deasserted = 2 cycles */\
                                B3ST_3          |  /* B3 Setup Time from AOE asserted to Read/Write asserted=3 cycles */\
                                B2WAT_7         |  /* B2 Write Access Time = 7 cycles */\
                                B2RAT_11        |  /* B2 Read Access Time = 11 cycles */\
                                B2HT_2          |  /* B2 Hold Time from Read/Write deasserted to AOE deasserted = 2 cycles */\
                                B2ST_3          |  /* B2 Setup Time from AOE asserted to Read/Write asserted=3 cycles */\
                                0)


/*****************************************************************************
 EBIU: SDRAM Memory

       SDRAM Setup according to ADSP-BF538F EZ-KIT Lite

       SDRAM Devices = MT48C32M8A2-75D
 
       NRA  = 8192
       tRef = 64ms 
       tRAS = 44ns 
       tRP  = 20ns 

       always round up tRAS and tRP values
       SDRRC = SCLK x tRef / NRA - SCLK x tRAS - SCLK x tRP

       SCLK = 50MHz:  SDRRC = 0386 = 0x0182
       SCLK = 100MHz: SDRRC = 0774 = 0x0306
       SCLK = 120MHz: SDRRC = 0928 = 0x03A0
       SCLK = 131MHz: SDRRC = 1014 = 0x03F6
       SCLK = 133MHz: SDRRC = 1030 = 0x0406
 
       Note: with a 25MHz crystal the default SCLK rate is 50MHz on the EZ-KIT Lite.
*****************************************************************************/


/********************************************
* SDRAM Refresh Rate Control Register Value *
* Reset = 0x081A                            *
* ADSP-BF538-proc.xml = 0x03A0              *
* here = 0x03F6, SCLK @ 131MHz              *
********************************************/

#define EBIU_SDRRC_VAL          0x03F6

#define NRA                     8192                /* [int] */
#define tREF                    64                  /* [ms] */


/*********************************************
* SDRAM Memory Global Control Register Value *
* Reset = 0xE008 8849                        *
* ADSP-BF538-proc.xml = 0x0091 998D          *
*********************************************/

#define EBIU_SDGCTL_VAL         (\
                               nCDDBG           |  /* Tristate SDRAM Controls During Bus Grant */\
                               nTCSR            |  /* Temp-Compensated Self-Refresh Value (85/45* Deg C) */\
                               nEMREN           |  /* Extended Mode Register Enable */\
                               nFBBRW           |  /* Enable Fast Back-To-Back Read To Write */\
                               nEBUFE           |  /* Enable External Buffering Timing */\
                               nSRFS            |  /* Enable SDRAM Self-Refresh Mode */\
                               nPSM             |  /* Power-Up Sequence (Mode Register Before/After* Refresh) */\
                               nPUPSD           |  /* Power-Up Start Delay (15 SCLK Cycles Delay) */\
                                SCTLE           |  /* Enable SDRAM Signals */\
                                PSS             |  /* Enable Power-Up Sequence on Next SDRAM Access */\
                                TWR_2           |  /* SDRAM tWR = 2 cycle */\
                                TRCD_3          |  /* SDRAM tRCD = 3 cycles */\
                                TRP_3           |  /* SDRAM tRP = 3 cycles */\
                                TRAS_6          |  /* SDRAM tRAS = 6 cycles */\
                                PASR_ALL        |  /* All 4 SDRAM Banks Refreshed In Self-Refresh */\
                                CL_3            |  /* SDRAM CAS Latency = 3 cycles */\
                                0)


/*******************************************
* SDRAM Memory Bank Control Register Value *
* Reset = 0x0000                           *
* ADSP-BF538-proc.xml = 0x0025             *
*******************************************/

#define EBIU_SDBCTL_VAL         (\
                                EBE             |  /* Enable SDRAM External Bank */\
                                EBSZ_64         |  /* SDRAM External Bank Size = 64MB */\
                                EBCAW_10        |  /* SDRAM External Bank Column Address Width = 10 Bits */\
                                0)


/****************************************************************************
 EOF
*****************************************************************************/

⌨️ 快捷键说明

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