/******************************************************************************
*
* Copyright 2013 Altera Corporation. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. 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.
*
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "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 AUTHOR 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.
*
******************************************************************************/
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <assert.h>
#include "socal/hps.h"
#include "socal/socal.h"
#include "socal/alt_sysmgr.h"
#include "hwlib.h"
#include "alt_clock_manager.h"
#include "alt_mpu_registers.h"
#define UINT12_MAX (4096)
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Useful Structures ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/* General structure used to hold parameters of various clock entities, */
typedef struct ALT_CLK_PARAMS_s
{
alt_freq_t freqcur; // current frequency of the clock
alt_freq_t freqmin; // minimum allowed frequency for this clock
alt_freq_t freqmax; // maximum allowed frequency for this clock
uint32_t guardband : 7; // guardband percentage (0-100) if this clock
// is a PLL, ignored otherwise
uint32_t active : 1; // current state of activity of this clock
} ALT_CLK_PARAMS_t;
typedef struct ALT_EXT_CLK_PARAMBLOK_s
{
ALT_CLK_PARAMS_t clkosc1; // ALT_CLK_OSC1
ALT_CLK_PARAMS_t clkosc2; // ALT_CLK_OSC2
ALT_CLK_PARAMS_t periph; // ALT_CLK_F2H_PERIPH_REF
ALT_CLK_PARAMS_t sdram; // ALT_CLK_F2H_SDRAM_REF
} ALT_EXT_CLK_PARAMBLOK_t;
/* Initializes the External Clock Frequency Limits block */
/* The first field is the current external clock frequency, and can be set by */
/* alt_clk_ext_clk_freq_set(), the second and third fields are the minimum and */
/* maximum frequencies, the fourth field is ignored, and the fifth field */
/* contains the current activity state of the clock, 1=active, 0=inactive. */
/* Values taken from Section 2.3 and Section 2.7.1 of the HHP HPS-Clocking */
/* NPP specification. */
static ALT_EXT_CLK_PARAMBLOK_t alt_ext_clk_paramblok = {{25000000, 10000000, 50000000, 0, 1},
{25000000, 10000000, 50000000, 0, 1},
{0, 10000000, 50000000, 0, 1},
{0, 10000000, 50000000, 0, 1}};
/* PLL frequency limits */
typedef struct ALT_PLL_CLK_PARAMBLOK_s
{
ALT_CLK_PARAMS_t MainPLL_600; // Main PLL values for 600 MHz SoC
ALT_CLK_PARAMS_t PeriphPLL_600; // Peripheral PLL values for 600 MHz SoC
ALT_CLK_PARAMS_t SDRAMPLL_600; // SDRAM PLL values for 600 MHz SoC
ALT_CLK_PARAMS_t MainPLL_800; // Main PLL values for 800 MHz SoC
ALT_CLK_PARAMS_t PeriphPLL_800; // Peripheral PLL values for 800 MHz SoC
ALT_CLK_PARAMS_t SDRAMPLL_800; // SDRAM PLL values for 800 MHz SoC
} ALT_PLL_CLK_PARAMBLOK_t;
/* Initializes the PLL frequency limits block */
/* The first field is the current frequency, the second and third fields */
/* are the design limits of the PLLs as listed in Section 3.2.1.2 of the */
/* HHP HPS-Clocking NPP document. The fourth field of each line is the */
/* guardband percentage, and the fifth field of each line is the current */
/* state of the PLL, 1=active, 0=inactive. */
#define ALT_ORIGINAL_GUARDBAND_VAL 20
#define ALT_GUARDBAND_LIMIT 20
static ALT_PLL_CLK_PARAMBLOK_t alt_pll_clk_paramblok = {{0, 320000000, 1200000000, ALT_ORIGINAL_GUARDBAND_VAL, 0},
{0, 320000000, 900000000, ALT_ORIGINAL_GUARDBAND_VAL, 0},
{0, 320000000, 800000000, ALT_ORIGINAL_GUARDBAND_VAL, 0},
{0, 320000000, 1600000000, ALT_ORIGINAL_GUARDBAND_VAL, 1},
{0, 320000000, 1250000000, ALT_ORIGINAL_GUARDBAND_VAL, 1},
{0, 320000000, 1066000000, ALT_ORIGINAL_GUARDBAND_VAL, 1}};
/* PLL counter frequency limits */
typedef struct ALT_PLL_CNTR_FREQMAX_s
{
alt_freq_t MainPLL_C0; // Main PLL Counter 0 parameter block
alt_freq_t MainPLL_C1; // Main PLL Counter 1 parameter block
alt_freq_t MainPLL_C2; // Main PLL Counter 2 parameter block
alt_freq_t MainPLL_C3; // Main PLL Counter 3 parameter block
alt_freq_t MainPLL_C4; // Main PLL Counter 4 parameter block
alt_freq_t MainPLL_C5; // Main PLL Counter 5 parameter block
alt_freq_t PeriphPLL_C0; // Peripheral PLL Counter 0 parameter block
alt_freq_t PeriphPLL_C1; // Peripheral PLL Counter 1 parameter block
alt_freq_t PeriphPLL_C2; // Peripheral PLL Counter 2 parameter block
alt_freq_t PeriphPLL_C3; // Peripheral PLL Counter 3 parameter block
alt_freq_t PeriphPLL_C4; // Peripheral PLL Counter 4 parameter block
alt_freq_t PeriphPLL_C5; // Peripheral PLL Counter 5 parameter block
alt_freq_t SDRAMPLL_C0; // SDRAM PLL Counter 0 parameter block
alt_freq_t SDRAMPLL_C1; // SDRAM PLL Counter 1 parameter block
alt_freq_t SDRAMPLL_C2; // SDRAM PLL Counter 2 parameter block
alt_freq_t SDRAMPLL_C5; // SDRAM PLL Counter 5 parameter block
} ALT_PLL_CNTR_FREQMAX_t;
/* Initializes the PLL Counter output maximum frequency block */
static ALT_PLL_CNTR_FREQMAX_t alt_pll_cntr_maxfreq = {800000000, /* Main PLL Outputs */
400000000,
400000000,
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
那些年经历的亢,还好遇到了很多具有奉献精神的大牛们!从公司决定上altera soc方案,就是这个噩梦的开始,一开始觉得altera与xilinx应该差别不大,后面这个亢只能越挖越深,好吧,好像有点跑题了。 soc AMP方案,cpu0跑linux,cpu1跑bare-metal,工程在友晶的de1 soc上实测过,这个得特别提醒一下,device tree相当重要,核间通信现在只是弄了linux触发bm的,现在bm触发linux的,还在捣腾,欢迎有这方面资源的老铁们互相交流学习。这个例程是骏龙那边提供的,至于这个虐心的过程,还是得感谢harvey的倾力相助。欢迎志同道合的人,一起学习,欢迎私信,谢谢。
资源详情
资源评论
资源推荐
收起资源包目录
altera soc AMP(linux+bare-metal) (224个子文件)
bm_core1.a 486KB
bm_core1.axf 201KB
bm_core1.bin 160KB
bm_core1.bin 80KB
alt_clock_manager.c 231KB
cpu_core.c 115KB
alt_dma.c 101KB
alt_timers.c 56KB
alt_watchdog.c 46KB
alt_cache.c 45KB
alt_mmu.c 39KB
alt_16550_uart.c 38KB
alt_generalpurpose_io.c 34KB
alt_generalpurpose_io.c 34KB
alt_interrupt.c 33KB
alt_fpga_manager.c 30KB
alt_dma_program.c 30KB
cadence_qspi_apb.c 26KB
alt_globaltmr.c 26KB
csp_int.c 21KB
app.c 18KB
cpu_bsp.c 15KB
clocks.c 11KB
bsp.c 11KB
spi_flash.c 11KB
alt_system_manager.c 11KB
load_bm_core1.c 10KB
app_hooks.c 10KB
cadence_qspi.c 9KB
stmicro.c 8KB
alt_address_space.c 8KB
alt_bridge_manager.c 7KB
csp.c 7KB
bsp_pagetable.c 7KB
os_csp.c 6KB
app_serial.c 5KB
alt_reset_manager.c 4KB
ns16550.c 4KB
designware_wdt.c 3KB
gpio_config.c 1KB
.cproject 5KB
.cproject 4KB
app.d 5KB
gpio_config.d 3KB
alt_dma.d 3KB
alt_fpga_manager.d 3KB
alt_bridge_manager.d 3KB
alt_clock_manager.d 3KB
alt_dma_program.d 3KB
spi_flash.d 3KB
alt_cache.d 3KB
stmicro.d 3KB
alt_generalpurpose_io.d 3KB
cadence_qspi.d 2KB
cadence_qspi_apb.d 2KB
app_hooks.d 2KB
bsp_pagetable.d 2KB
alt_address_space.d 885B
alt_interrupt.d 877B
clocks.d 774B
os_csp.d 447B
designware_wdt.d 420B
bsp.d 414B
ns16550.d 408B
csp_int.d 362B
csp.d 302B
bsp_utils.d 110B
os_cpu_a.d 108B
start.d 102B
cpu_a.d 68B
Altera De1 Soc学习总结.docx 409KB
alt_sysmgr.h 1.14MB
hps.h 619KB
alt_nand.h 554KB
alt_sdmmc.h 394KB
alt_fpgamgr.h 315KB
alt_clkmgr.h 301KB
alt_i2c.h 287KB
alt_l3.h 281KB
alt_qspi.h 266KB
alt_uart.h 216KB
alt_sdr.h 208KB
alt_acpidmap.h 174KB
alt_rstmgr.h 172KB
alt_spim.h 139KB
alt_spis.h 124KB
alt_gpio.h 91KB
alt_l4wd.h 82KB
alt_mmu.h 75KB
alt_lwh2f.h 65KB
alt_clock_manager.h 59KB
lib_def.h 59KB
alt_16550_uart.h 56KB
alt_f2h.h 47KB
alt_h2f.h 47KB
cpu_core.h 47KB
alt_generalpurpose_io.h 46KB
alt_scanmgr.h 42KB
csp.h 42KB
cpu.h 42KB
共 224 条
- 1
- 2
- 3
KeepJay
- 粉丝: 5
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1