Files
luban-lite-t3e-pro/doc/topics/sdk/psram/psram-design-guide.html
2025-01-23 16:37:00 +08:00

782 lines
102 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn" data-whc_version="26.0">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="description" content="源码说明 表 1 . 相关模块 源码路径 PSRAM Driver bsp/artinchip/drv_bare/psram HAL bsp/artinchip/hal/xspi 模块架构 图 1 . Luban-Lite XSPI PSRAM 框图 ArtInChip 提供了 XSPI HAL 层,并且实现了对接 DRV_BARE 的驱动层。 由于 XSPI 传输需要使用 SYSCFG 和 ..."/><meta name="DC.rights.owner" content="(C) 版权 2025"/><meta name="copyright" content="(C) 版权 2025"/><meta name="generator" content="DITA-OT"/><meta name="DC.type" content="topic"/><meta name="DC.relation" content="../../../topics/sdk/psram/psram-user-guide.html"/><meta name="DC.relation" content="../../../topics/sdk/psram/psram-test-guide.html"/><meta name="DC.relation" content="../../../topics/sdk/psram/psram-faq.html"/><meta name="DC.contributor" content="yan.wang"/><meta name="DC.contributor" content="yan.wang"/><meta name="DC.date.modified" content="2024-01-15"/><meta name="DC.format" content="HTML5"/><meta name="DC.identifier" content="id"/><meta name="DC.language" content="zh-CN"/><title>设计说明</title><!-- Build number 2023110923. --><meta name="wh-path2root" content="../../../"/><meta name="wh-toc-id" content="id-d5856e3483"/><meta name="wh-source-relpath" content="topics/sdk/psram/psram-design-guide.dita"/><meta name="wh-out-relpath" content="topics/sdk/psram/psram-design-guide.html"/>
<link rel="stylesheet" type="text/css" href="../../../webhelp/app/commons.css?buildId=2023110923"/>
<link rel="stylesheet" type="text/css" href="../../../webhelp/app/topic.css?buildId=2023110923"/>
<script src="../../../webhelp/app/options/properties.js?buildId=20250121171154"></script>
<script src="../../../webhelp/app/localization/strings.js?buildId=2023110923"></script>
<script src="../../../webhelp/app/search/index/keywords.js?buildId=20250121171154"></script>
<script defer="defer" src="../../../webhelp/app/commons.js?buildId=2023110923"></script>
<script defer="defer" src="../../../webhelp/app/topic.js?buildId=2023110923"></script>
<link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-styles-web.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/notes.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-common.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-images.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/footnote.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-web-watermark.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/topic-body-list.css?buildId=2023110923"/></head>
<body id="id" class="wh_topic_page frmBody">
<a href="#wh_topic_body" class="sr-only sr-only-focusable">
跳转到主要内容
</a>
<header class="navbar navbar-default wh_header">
<div class="container-fluid">
<div class="wh_header_flex_container navbar-nav navbar-expand-md navbar-dark">
<div class="wh_logo_and_publication_title_container">
<div class="wh_logo_and_publication_title">
<a href="http://www.artinchip.com" class=" wh_logo d-none d-sm-block "><img src="../../../company-logo-white.png" alt="RTOS SDK 使用指南SDK 指南文件"/></a>
<div class=" wh_publication_title "><a href="../../../index.html"><span class="booktitle"><span class="ph mainbooktitle">RTOS SDK 使用指南</span><span class="ph booktitlealt">SDK 指南文件</span></span></a></div>
</div>
</div>
<div class="wh_top_menu_and_indexterms_link collapse navbar-collapse" id="wh_top_menu_and_indexterms_link">
</div>
</div>
</div>
</header>
<div class=" wh_search_input navbar-form wh_topic_page_search search " role="form">
<form id="searchForm" method="get" role="search" action="../../../search.html"><div><input type="search" placeholder="搜索 " class="wh_search_textfield" id="textToSearch" name="searchQuery" aria-label="搜索查询" required="required"/><button type="submit" class="wh_search_button" aria-label="搜索"><span class="search_input_text">搜索</span></button></div></form>
</div>
<div class="container-fluid" id="wh_topic_container">
<div class="row">
<nav class="wh_tools d-print-none navbar-expand-md" aria-label="Tools">
<div data-tooltip-position="bottom" class=" wh_breadcrumb "><ol class="d-print-none"><li><span class="home"><a href="../../../index.html"><span>主页</span></a></span></li><li><div class="topicref" data-id="id"><div class="title"><a href="../../../topics/sdk/chapter-advanced-app.html">高级应用</a><div class="wh-tooltip"><p class="shortdesc">系统、存储、多媒体、接口、安全等模块的详细配置和设计说明。</p></div></div></div></li><li><div class="topicref" data-id="chapter-memory"><div class="title"><a href="../../../topics/chapter-title/chapter-memory-sdk.html">存储</a><div class="wh-tooltip"><p class="shortdesc">SDMC、SPI NAND、SPI NOR<span class="ph"> 以及文件系统</span> 等存储模块的介绍和使用说明。</p></div></div></div></li><li><div class="topicref" data-id="id"><div class="title"><a href="../../../topics/sdk/psram/psram-user-guide.html">PSRAM 使用指南</a></div></div></li><li class="active"><div class="topicref" data-id="id"><div class="title"><a href="../../../topics/sdk/psram/psram-design-guide.html">设计说明</a></div></div></li></ol></div>
<div class="wh_right_tools">
<button class="wh_hide_highlight" aria-label="切换搜索突出显示" title="切换搜索突出显示"></button>
<button class="webhelp_expand_collapse_sections" data-next-state="collapsed" aria-label="折叠截面" title="折叠截面"></button>
<div class=" wh_navigation_links "><span id="topic_navigation_links" class="navheader">
<span class="navprev"><a class="- topic/link link" href="../../../topics/sdk/psram/psram-test-guide.html" title="测试指南" aria-label="上一主题: 测试指南" rel="prev"></a></span>
<span class="navnext"><a class="- topic/link link" href="../../../topics/sdk/psram/psram-faq.html" title="常见问题" aria-label="下一主题: 常见问题" rel="next"></a></span> </span></div>
<div class=" wh_print_link print d-none d-md-inline-block "><button onClick="window.print()" title="打印此页" aria-label="打印此页"></button></div>
<button type="button" id="wh_toc_button" class="custom-toggler navbar-toggler collapsed wh_toggle_button navbar-light" aria-expanded="false" aria-label="Toggle publishing table of content" aria-controls="wh_publication_toc">
<span class="navbar-toggler-icon"></span>
</button>
</div>
</nav>
</div>
<div class="wh_content_area">
<div class="row">
<nav id="wh_publication_toc" class="col-lg-3 col-md-3 col-sm-12 d-md-block d-none d-print-none" aria-label="Table of Contents Container">
<div id="wh_publication_toc_content">
<div class=" wh_publication_toc " data-tooltip-position="right"><span class="expand-button-action-labels"><span id="button-expand-action" role="button" aria-label="Expand"></span><span id="button-collapse-action" role="button" aria-label="Collapse"></span><span id="button-pending-action" role="button" aria-label="Pending"></span></span><ul role="tree" aria-label="Table of Contents"><li role="treeitem"><div data-tocid="revinfo_linux-d5856e989" class="topicref" data-id="revinfo_linux" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/revinfo/revinfo_rtos.html" id="revinfo_linux-d5856e989-link">修订记录</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d5856e1003" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d5856e1003-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/env/sdk-compile.html" id="id-d5856e1003-link">SDK 编译</a><div class="wh-tooltip"><p class="shortdesc">介绍不同编译环境下 SDK 的详细编译流程。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d5856e1152" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d5856e1152-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/advanced/sdk-usage.html" id="id-d5856e1152-link">使用指南</a><div class="wh-tooltip"><p class="shortdesc">系统镜像、编译选项、开发板、应用等相关的详细使用说明。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_rcx_czh_pzb-d5856e1416" class="topicref" data-id="concept_rcx_czh_pzb" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_rcx_czh_pzb-d5856e1416-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/chapter-app.html" id="concept_rcx_czh_pzb-d5856e1416-link">应用场景</a><div class="wh-tooltip"><p class="shortdesc">描述了 SDK 在不同应用场景中的配置和使用包括系统更新、OTA、安全方案等。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d5856e2119" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d5856e2119-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/peripheral/peripheral-intro.html" id="id-d5856e2119-link">外设移植</a><div class="wh-tooltip"><p class="shortdesc"><span class="ph">CTP、U 盘、SD 卡、有线和无线网络</span>等外设的介绍和使用说明。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d5856e2244" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d5856e2244-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/bringup/chapter-bringup.html" id="id-d5856e2244-link">BringUp</a><div class="wh-tooltip"><p class="shortdesc">在硬件上电后快速初始化系统,为操作系统的启动准备好必要的硬件环境。</p></div></div></div></li><li role="treeitem" aria-expanded="true"><div data-tocid="id-d5856e2345" class="topicref" data-id="id" data-state="expanded"><span role="button" tabindex="0" aria-labelledby="button-collapse-action id-d5856e2345-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/chapter-advanced-app.html" id="id-d5856e2345-link">高级应用</a><div class="wh-tooltip"><p class="shortdesc">系统、存储、多媒体、接口、安全等模块的详细配置和设计说明。</p></div></div></div><ul role="group" class="navbar-nav nav-list"><li role="treeitem" aria-expanded="false"><div data-tocid="_0-d5856e2360" class="topicref" data-id="_0" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action _0-d5856e2360-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/boot/lite_boot_direct.html" id="_0-d5856e2360-link">启动引导</a><div class="wh-tooltip"><p class="shortdesc">启动引导程序 Bootloader 可以实现加载启动应用程序、 烧录和升级功能。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="chapter-system-d5856e2435" class="topicref" data-id="chapter-system" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action chapter-system-d5856e2435-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/chapter-title/chapter-system.html" id="chapter-system-d5856e2435-link">系统</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem" aria-expanded="true"><div data-tocid="chapter-memory-d5856e3357" class="topicref" data-id="chapter-memory" data-state="expanded"><span role="button" tabindex="0" aria-labelledby="button-collapse-action chapter-memory-d5856e3357-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/chapter-title/chapter-memory-sdk.html" id="chapter-memory-d5856e3357-link">存储</a><div class="wh-tooltip"><p class="shortdesc">SDMC、SPI NAND、SPI NOR<span class="ph"> 以及文件系统</span> 等存储模块的介绍和使用说明。</p></div></div></div><ul role="group" class="navbar-nav nav-list"><li role="treeitem" aria-expanded="false"><div data-tocid="id-d5856e3375" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d5856e3375-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/sdmc/sdmc-user-guide_2.html" id="id-d5856e3375-link">SDMC 使用指南</a></div></div></li><li role="treeitem" aria-expanded="true"><div data-tocid="id-d5856e3447" class="topicref" data-id="id" data-state="expanded"><span role="button" tabindex="0" aria-labelledby="button-collapse-action id-d5856e3447-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/psram/psram-user-guide.html" id="id-d5856e3447-link">PSRAM 使用指南</a></div></div><ul role="group" class="navbar-nav nav-list"><li role="treeitem"><div data-tocid="id-d5856e3459" class="topicref" data-id="id" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/psram/psram-config-guide.html" id="id-d5856e3459-link">PSRAM 配置</a></div></div></li><li role="treeitem"><div data-tocid="id-d5856e3471" class="topicref" data-id="id" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/psram/psram-test-guide.html" id="id-d5856e3471-link">测试指南</a></div></div></li><li role="treeitem" class="active"><div data-tocid="id-d5856e3483" class="topicref" data-id="id" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/psram/psram-design-guide.html" id="id-d5856e3483-link">设计说明</a></div></div></li><li role="treeitem"><div data-tocid="id-d5856e3495" class="topicref" data-id="id" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/psram/psram-faq.html" id="id-d5856e3495-link">常见问题</a></div></div></li></ul></li><li role="treeitem" aria-expanded="false"><div data-tocid="spi_nand_user_guide-d5856e3507" class="topicref" data-id="spi_nand_user_guide" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action spi_nand_user_guide-d5856e3507-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/spinand/spi-nand-user-guide_2.html" id="spi_nand_user_guide-d5856e3507-link">SPI NAND 使用指南</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d5856e3591" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d5856e3591-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/spinor/spinor_user_guide_lite.html" id="id-d5856e3591-link">SPI NOR 使用指南</a></div></div></li></ul></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_mcc_32s_nbc-d5856e3639" class="topicref" data-id="concept_mcc_32s_nbc" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_mcc_32s_nbc-d5856e3639-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/chapter-title/chapter-multi-media-sdk.html" id="concept_mcc_32s_nbc-d5856e3639-link">多媒体</a><div class="wh-tooltip"><p class="shortdesc">GE、VE、Display、DVP、MPP、MPP 播放器等多媒体模块的介绍和使用说明。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_nww_hzh_pzb-d5856e4868" class="topicref" data-id="concept_nww_hzh_pzb" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_nww_hzh_pzb-d5856e4868-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/chapter-title/chapter-interface-sdk.html" id="concept_nww_hzh_pzb-d5856e4868-link">接口</a><div class="wh-tooltip"><p class="shortdesc">CAN<span class="ph">、CAP</span>、CIR、GPAI、GPIO、I2C、PSADC、PWM 等接口模块的介绍和使用说明。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="chapter-safety-d5856e6083" class="topicref" data-id="chapter-safety" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action chapter-safety-d5856e6083-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/chapter-title/chapter-safety-sdk.html" id="chapter-safety-d5856e6083-link">安全</a><div class="wh-tooltip"><p class="shortdesc">SPI ENC、CE、eFuse 等安全模块的介绍和使用说明。</p></div></div></div></li></ul></li></ul></div>
</div>
</nav>
<div class="col-lg-7 col-md-9 col-sm-12" id="wh_topic_body">
<button id="wh_close_publication_toc_button" class="close-toc-button d-none" aria-label="Toggle publishing table of content" aria-controls="wh_publication_toc" aria-expanded="true">
<span class="close-toc-icon-container">
<span class="close-toc-icon"></span>
</span>
</button>
<button id="wh_close_topic_toc_button" class="close-toc-button d-none" aria-label="Toggle topic table of content" aria-controls="wh_topic_toc" aria-expanded="true">
<span class="close-toc-icon-container">
<span class="close-toc-icon"></span>
</span>
</button>
<div class=" wh_topic_content body "><main role="main"><article class="- topic/topic topic" role="article" aria-labelledby="ariaid-title1"><span class="edit-link" style="font-size:12px; opacity:0.6; text-align:right; vertical-align:middle"><a target="_blank" href="http://172.16.35.88/tasks/jdssno1uvvbf2mltu9kb9v3if05d5gopuakboe8hlud18rma/edit/F:/aicdita/aicdita-cn/topics/sdk/psram/psram-design-guide.dita">Edit online</a></span><h1 class="- topic/title title topictitle1" id="ariaid-title1">设计说明</h1><div class="date inPage">15 Jan 2024</div><div style="color: gray;">
Read time: 12 minute(s)
</div><div class="- topic/body body"><section class="- topic/section section" id="id__id2" data-ofbid="id__id2"><h2 class="- topic/title title sectiontitle">源码说明</h2>
<div class="table-container"><table class="- topic/table table frame-all" id="id__table_c3c_qyh_bdc" data-ofbid="id__table_c3c_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 1</span><span class="table--title-label-punctuation">. </span></span><span class="table--title"></span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="id__table_c3c_qyh_bdc__entry__1">相关模块</th><th class="- topic/entry entry colsep-0 rowsep-1" id="id__table_c3c_qyh_bdc__entry__2">源码路径</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_c3c_qyh_bdc__entry__1">PSRAM Driver</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_c3c_qyh_bdc__entry__2"><span class="+ topic/ph sw-d/filepath ph filepath">bsp/artinchip/drv_bare/psram</span></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="id__table_c3c_qyh_bdc__entry__1">HAL</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="id__table_c3c_qyh_bdc__entry__2"><span class="+ topic/ph sw-d/filepath ph filepath">bsp/artinchip/hal/xspi</span></td></tr></tbody></table></div>
</section><section class="- topic/section section" id="id__id3" data-ofbid="id__id3"><h2 class="- topic/title title sectiontitle">模块架构</h2>
<figure class="- topic/fig fig fignone" id="id__id9" data-ofbid="id__id9"><br/><div class="imagecenter"><img class="- topic/image image imagecenter" id="id__image_d3c_qyh_bdc" src="../../../images/psram/luban-lite-XSPI-PSRAM-arch.drawio.png" alt="luban-lite-XSPI-PSRAM-arch"/></div><br/><figcaption data-caption-side="bottom" class="- topic/title title figcapcenter"><span class="figtitleprefix fig--title-label"><span class="fig--title-label-number"> 1</span><span class="fig--title-label-punctuation">. </span></span><span class="fig--title"><span class="- topic/ph ph">Luban-Lite</span> XSPI PSRAM 框图</span></figcaption></figure>
<p class="- topic/p p" data-ofbid="d83620e65__20250121171529">ArtInChip 提供了 XSPI HAL 层,并且实现了对接 DRV_BARE 的驱动层。 由于 XSPI 传输需要使用 SYSCFG 和 CMU因此 SYSCFG
HAL 和 CMU HAL 是相关模块。</p>
</section><section class="- topic/section section" id="id__hal-drv" data-ofbid="id__hal-drv"><h2 class="- topic/title title sectiontitle">HAL 与 DRV</h2>
<p class="- topic/p p" data-ofbid="d83620e73__20250121171529">ArtInChip 的 PSRAM 驱动按照 HAL 层 + Driver 层的结构进行设计,其中 HAL 层为硬件抽象层, 提供系统无关的硬件驱动实现;在 HAL
层之上,可根据不同 RTOS 的驱动框架,实现对应的 PSRAM DRV 层进行对接。</p>
<figure class="- topic/fig fig fignone" id="id__id10" data-ofbid="id__id10"><br/><div class="imagecenter"><img class="- topic/image image imagecenter" id="id__image_e3c_qyh_bdc" src="../../../images/psram/luban-lite-hal-drv.drawio.png" alt="luban-lite-hal-drv"/></div><br/><figcaption data-caption-side="bottom" class="- topic/title title figcapcenter"><span class="figtitleprefix fig--title-label"><span class="fig--title-label-number"> 2</span><span class="fig--title-label-punctuation">. </span></span><span class="fig--title">HAL and DRV</span></figcaption></figure>
<p class="- topic/p p" data-ofbid="d83620e83__20250121171529">XSPI HAL 的特点:</p>
<ol class="- topic/ol ol arabic simple" id="id__ol_g3c_qyh_bdc" data-ofbid="id__ol_g3c_qyh_bdc"><li class="- topic/li li" data-ofbid="d83620e87__20250121171529">
<p class="- topic/p p" data-ofbid="d83620e89__20250121171529">无状态</p>
</li><li class="- topic/li li" data-ofbid="d83620e92__20250121171529">
<p class="- topic/p p" data-ofbid="d83620e94__20250121171529">支持 XIPAHB 模式</p>
</li></ol>
<p class="- topic/p p" data-ofbid="d83620e99__20250121171529">XSPI HAL 相关的设备操作都需要通过 Handle 的方式进行。 由于 HAL 其内部无状态,不会进行空间分配,因此 Handle 的空间需要外部申请并且传入, 由
HAL 层进行使用。</p>
</section><section class="- topic/section section" id="id__id4" data-ofbid="id__id4"><h2 class="- topic/title title sectiontitle">关键流程设计</h2>
<div class="- topic/p p" data-ofbid="d83620e107__20250121171529">在 bootloader 板级初始化过程中,会调用 <span class="+ topic/keyword pr-d/apiname keyword apiname">aic_xspi_psram_init()</span> 函数,对 XSPI
控制器、PSRAM 设备初始化, 并开启 XIP 模式,系统可以通过 PSRAM 映射地址进行内存访问
<code class="+ topic/ph pr-d/codeph ph codeph">0x40000000-0x5FFFFFFF</code>
<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_hsn_z33_ddc" data-ofbid="id__codeblock_hsn_z33_ddc">aic_xspi_psram_init(); <em class="hl-comment">// application\baremetal\bootloader\main.c</em>
|-&gt; hal_xspi_init(); <em class="hl-comment">// bsp\artinchip\drv_bare\psram\xspi_psram.c</em>
|-&gt; aic_xspi_psram_dev_init(); <em class="hl-comment">// bsp\artinchip\drv_bare\psram\xspi_psram.c</em>
|-&gt; hal_xspi_set_boudary(); <em class="hl-comment">// bsp\artinchip\drv_bare\psram\xspi_psram.c</em>
|-&gt; aic_xspi_psram_xip(); <em class="hl-comment">// bsp\artinchip\drv_bare\psram\xspi_psram.c</em>
|-&gt; hal_xspi_dll_training() <em class="hl-comment">// bsp\artinchip\drv_bare\psram\xspi_psram.c</em>
|-&gt; hal_xspi_set_parallel_mode(); <em class="hl-comment">// bsp\artinchip\drv_bare\psram\xspi_psram.c</em></pre></div>
</section><section class="- topic/section section" id="id__id5" data-ofbid="id__id5"><h2 class="- topic/title title sectiontitle">数据结构设计</h2>
<div class="- topic/div div section" id="id__driver">
<strong class="+ topic/ph hi-d/b ph b"> Driver 层主要数据接口</strong>
<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_dqy_1j3_ddc" data-ofbid="id__codeblock_dqy_1j3_ddc"><strong class="hl-keyword">struct</strong> aic_xspi
{
<strong class="hl-keyword">char</strong> *name;
u32 idx;
u32 clk_id;
u32 clk_in_hz;
u32 dma_port_id;
u32 irq_num;
hal_xspi_handle handle;
bool inited;
};</pre><div class="- topic/note note tip note_tip" id="id__note_nrq_qn3_ddc" data-ofbid="id__note_nrq_qn3_ddc"><span class="note__title">提示:</span>
<p class="- topic/p p" data-ofbid="d83620e132__20250121171529"><code class="+ topic/ph pr-d/codeph ph codeph">name,idx,clk_id,clk_in_hz</code> 属性需要有相应的值, 其中
<code class="+ topic/ph pr-d/codeph ph codeph">clk_id</code> 使用 <code class="+ topic/ph pr-d/codeph ph codeph">aic_clk_id.h</code> 文件的宏定义,
<code class="+ topic/ph pr-d/codeph ph codeph">clk_in_hz</code> 从配置文件中获取</p>
</div>
</div>
<div class="- topic/div div section" id="id__hal">
<strong class="+ topic/ph hi-d/b ph b">HAL
层主要数据结构</strong><pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_mn3_3k3_ddc" data-ofbid="id__codeblock_mn3_3k3_ddc"><strong class="hl-keyword">struct</strong> hal_xspi_config {
u32 idx;
u32 clk_in_hz;
u32 clk_id;
u32 cs0_port;
u32 cs1_port;
bool bit_mode;
bool wire3_en;
bool lsb_en;
bool cs_auto;
u8 cs_polarity;
u8 cpol;
u8 cpha;
};</pre><pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_edm_3k3_ddc" data-ofbid="id__codeblock_edm_3k3_ddc"><strong class="hl-keyword">struct</strong> hal_xspi_transfer {
u8 *tx_data;
u8 *rx_data;
u32 data_len;
};</pre><pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_prn_3k3_ddc" data-ofbid="id__codeblock_prn_3k3_ddc"><strong class="hl-keyword">struct</strong> hal_xspi_proto_cfg {
u8 mode;
u8 clk_mode;
u8 parallel_mode;
u8 wr_cmd_clk_mode;
u8 wr_cmd_lines;
u8 wr_cmd_val;
u8 rd_cmd_clk_mode;
u8 rd_cmd_lines;
u8 rd_cmd_val;
u8 addr_clk_mode;
u8 addr_lines;
u8 addr_width;
u8 wr_dummy;
u8 rd_dummy;
u8 wr_cnt_lines;
u32 wr_cnt;
u8 rd_cnt_lines;
u32 rd_cnt;
};</pre><pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_icm_jk3_ddc" data-ofbid="id__codeblock_icm_jk3_ddc"><strong class="hl-keyword">struct</strong> hal_xspi_state {
u32 idx;
hal_xspi_async_cb cb;
<strong class="hl-keyword">void</strong> *cb_priv;
u32 status;
u32 clk_id;
u32 bus_hz;
u32 bus_width;
<strong class="hl-keyword">struct</strong> hal_xspi_dma_config dma_cfg;
<strong class="hl-keyword">void</strong> *dma_tx;
<strong class="hl-keyword">void</strong> *dma_rx;
u8 *async_tx; <em class="hl-comment">/* Used in Async Non-DMA mode */</em>
u8 *async_rx; <em class="hl-comment">/* Used in Async Non-DMA mode */</em>
u32 async_tx_remain; <em class="hl-comment">/* Used in Async Non-DMA mode */</em>
u32 async_rx_remain; <em class="hl-comment">/* Used in Async Non-DMA mode */</em>
u32 work_mode;
u32 done_mask;
};</pre></div>
</section><section class="- topic/section section" id="id__id6" data-ofbid="id__id6"><h2 class="- topic/title title sectiontitle">接口设计</h2>
<div class="- topic/div div section" id="id__id7">
<strong class="+ topic/ph hi-d/b ph b">Driver 接口设计</strong>
<div class="table-container"><table class="- topic/table table frame-all" id="id__table_n3c_qyh_bdc" data-ofbid="id__table_n3c_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 2</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">aic_get_xspi_by_index</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">static struct aic_xspi *aic_get_xspi_by_index(u32
idx)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">获取具体 XSPI 控制设备</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">u32 idx</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器编号XSPI 当前只有 0 可选择。</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">NULL: 失败</div>
<div class="- topic/div div">aic_xspi 实例: 成功</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="id__table_o3c_qyh_bdc" data-ofbid="id__table_o3c_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 3</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">aic_xspi_psram_dev_reset</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">static u32 aic_xspi_psram_dev_reset(hal_xspi_handle
*handle)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">reset PSRAM 模块,当前只支持 APS3208K</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *handle</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器句柄, 经过 hal_xspi_init 初始化后可得到。</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0 操作完成</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="id__table_p3c_qyh_bdc" data-ofbid="id__table_p3c_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 4</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">aic_xspi_psram_dev_init</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">static u32 aic_xspi_psram_dev_init(hal_xspi_handle
*handle)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">初始化 PSRAM 设备</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *handle</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器句柄, 经过 hal_xspi_init 初始化后可得到。</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0 操作完成</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="id__table_q3c_qyh_bdc" data-ofbid="id__table_q3c_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 5</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">aic_xspi_psram_read_id</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">static u32 aic_xspi_psram_read_id(hal_xspi_handle
*handle)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">读取 PSRAM 的 ID</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *handle</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器句柄, 经过 hal_xspi_init 初始化后可得到。</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0 操作完成</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">该接口只是读取一遍,没有实际作用,仅作为调试使用</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="id__table_r3c_qyh_bdc" data-ofbid="id__table_r3c_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 6</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">aic_xspi_psram_xip</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">static u32 aic_xspi_psram_xip(hal_xspi_handle *handle,
hal_xspi_proto_cfg_t proto)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">读取 PSRAM 的 ID</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *handle</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器句柄, 经过 hal_xspi_init 初始化后可得到。</div>
</div>
<div class="- topic/div div">hal_xspi_proto_cfg_t proto</div>
<div class="- topic/div div">
<div class="- topic/div div"> 关于 XIP 的相关配置</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0 操作完成</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="id__table_s3c_qyh_bdc" data-ofbid="id__table_s3c_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 7</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">aic_xspi_psram_icp_calc</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">u32 aic_xspi_psram_icp_calc(u32 clk_in_hz)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">根据配置的 clock获取 ICP 时钟等级</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">u32 clk_in_hz</div>
<div class="- topic/div div">
<div class="- topic/div div"> 配置给 XSPI 的时钟值</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: AIC_XSPI_ICP_50_100M</div>
<div class="- topic/div div">1AIC_XSPI_ICP_100_150M</div>
<div class="- topic/div div">2: AIC_XSPI_ICP_150_200M</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">返回结果一般作为 aic_xspi_psram_training 接口的 reg_icp 参数。</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="id__table_t3c_qyh_bdc" data-ofbid="id__table_t3c_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 8</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">aic_xspi_psram_mem_test</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">static u8 aic_xspi_psram_mem_test(long address, u32
size)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">PSRAM 的 training 使用的 memtest</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">long address</div>
<div class="- topic/div div">
<div class="- topic/div div">training buffer 的起始地址</div>
</div>
<div class="- topic/div div">u32 size</div>
<div class="- topic/div div">
<div class="- topic/div div">training buffer 的空间大小</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 成功完成</div>
<div class="- topic/div div">1失败</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">需要判断是否成功</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="id__table_u3c_qyh_bdc" data-ofbid="id__table_u3c_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 9</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">aic_xspi_psram_training</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">u32 aic_xspi_psram_training(hal_xspi_handle *h, u8 sel, u8
reg_icp, void *psram_buf, u32 len)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">PSRAM 的 training</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
<div class="- topic/div div">u8 sel</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 的 CS 选择0 1</div>
</div>
<div class="- topic/div div">u8 reg_icp</div>
<div class="- topic/div div">
<div class="- topic/div div"> XSPI 的时钟范围选择ICP__50_100M = 0x0, ICP_100_150M =
0x1,</div>
<div class="- topic/div div">
<div class="- topic/div div">ICP_150_200M = 0x2, ICP_200_266M = 0x3.</div>
</div>
</div>
<div class="- topic/div div">void *psram_buf</div>
<div class="- topic/div div">
<div class="- topic/div div"> psram 的 training 地址,取 psram 的地址空间</div>
</div>
<div class="- topic/div div">u32 len</div>
<div class="- topic/div div">
<div class="- topic/div div"> 地址空间大小,建议 256KB 以上</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 传输成功完成</div>
<div class="- topic/div div">1传输失败</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">需要判断是否 traning 成功</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="id__table_v3c_qyh_bdc" data-ofbid="id__table_v3c_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 10</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">aic_xspi_psram_init</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">u32 aic_xspi_psram_init(void)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">读取 PSRAM 的 ID</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div"></div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0 操作完成</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">training 失败时,会打印 trainning failed 并停止系统启动。</td></tr></tbody></table></div></div>
<div class="- topic/div div section" id="id__id8">
<strong class="+ topic/ph hi-d/b ph b">HAL 接口设计</strong>
<div class="table-container"><table class="- topic/table table frame-all" id="id__table_w3c_qyh_bdc" data-ofbid="id__table_w3c_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 11</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_xspi_init</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">int hal_xspi_init(hal_xspi_handle *h, struct hal_xspi_config
*cfg)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">XSPI 控制器的初始化函数</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
<div class="- topic/div div">struct hal_xspi_config *cfg</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器的初始化配置参数</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 成功</div>
<div class="- topic/div div">其他: 失败</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">初始化时Handle 的空间由使用者负责分配和释放</td></tr></tbody></table></div>
<div class="table-container"><table class="- topic/table table frame-all" id="id__table_x3c_qyh_bdc" data-ofbid="id__table_x3c_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 12</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_xspi_set_cmd_width</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">int hal_xspi_set_cmd_width(hal_xspi_handle *h, u8
ddr_sdr_mode, u8 lines)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">设置 CMD 传输所使用的模式和总线位宽</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
<div class="- topic/div div">u8 ddr_sdr_mode</div>
<div class="- topic/div div">
<div class="- topic/div div"> cmd 数据设置 ddrsdr 模式</div>
</div>
<div class="- topic/div div">u8 lines</div>
<div class="- topic/div div">
<div class="- topic/div div"> cmd 数据设置 1/2/4/8 线传输</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 成功</div>
<div class="- topic/div div">其他: 失败</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">-</td></tr></tbody></table></div>
<div class="table-container"><table class="- topic/table table frame-all" id="id__table_y3c_qyh_bdc" data-ofbid="id__table_y3c_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 13</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_xspi_set_cmd</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">int hal_xspi_set_cmd(hal_xspi_handle *h, u8 ddr_sdr_mode, u8
cmd)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">设置 CMD 的模式和 opcode</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
<div class="- topic/div div">u8 ddr_sdr_mode</div>
<div class="- topic/div div">
<div class="- topic/div div"> cmd 数据设置 ddrsdr 模式</div>
</div>
<div class="- topic/div div">u8 cmd</div>
<div class="- topic/div div">
<div class="- topic/div div">设置 CMD 的 opcode</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 成功</div>
<div class="- topic/div div">其他: 失败</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">-</td></tr></tbody></table></div>
<div class="table-container"><table class="- topic/table table frame-all" id="id__table_z3c_qyh_bdc" data-ofbid="id__table_z3c_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 14</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_xspi_set_addr_width</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">int hal_xspi_set_addr_width(hal_xspi_handle *h, u8
ddr_sdr_mode, u8 lines, u8 bw_3_4_bytes)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">设置 addr 的模式,传输线数,地址宽度</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
<div class="- topic/div div">u8 ddr_sdr_mode</div>
<div class="- topic/div div">
<div class="- topic/div div"> ADDR 数据设置 ddrsdr 模式, 0x0 是 sdr 0x01 是 ddr</div>
</div>
<div class="- topic/div div">u8 lines</div>
<div class="- topic/div div">
<div class="- topic/div div"> ADDR 数据设置 1/2/4/8 线传输, 可取值 0 1 2 3</div>
</div>
<div class="- topic/div div">u8 bw_3_4_bytes</div>
<div class="- topic/div div">
<div class="- topic/div div"> ADDR 数据的宽度,可取值 3、4</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 成功</div>
<div class="- topic/div div">其他: 失败</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="id__table_ajc_qyh_bdc" data-ofbid="id__table_ajc_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 15</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_xspi_set_addr</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">int hal_xspi_set_addr(hal_xspi_handle *h, u8 addr)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">设置 addr 的 opcode</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
<div class="- topic/div div">u8 addr</div>
<div class="- topic/div div">
<div class="- topic/div div">addr 的 opcode</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 成功</div>
<div class="- topic/div div">其他: 失败</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">-</td></tr></tbody></table></div>
<div class="table-container"><table class="- topic/table table frame-all" id="id__table_bjc_qyh_bdc" data-ofbid="id__table_bjc_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 16</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_xspi_set_dummy</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">int hal_xspi_set_dummy(hal_xspi_handle *h, u8 lines, u8
dummy)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">配置 read dummy</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
<div class="- topic/div div">u8 lines</div>
<div class="- topic/div div">
<div class="- topic/div div"> 设置 1/2/4/8 线传输, 可取值 0 1 2 3可固定任意值</div>
</div>
<div class="- topic/div div">u8 dummy</div>
<div class="- topic/div div">
<div class="- topic/div div">dummy 个数</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 成功</div>
<div class="- topic/div div">其他: 失败</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">line 可以设置任意值dummy 不受传输线限制</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="id__table_cjc_qyh_bdc" data-ofbid="id__table_cjc_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 17</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_xspi_set_write_cnt</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">int hal_xspi_set_write_cnt(hal_xspi_handle *h, u8
ddr_sdr_mode, u8 lines, u32 count)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">配置写 data 的个数</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
<div class="- topic/div div">u8 ddr_sdr_mode</div>
<div class="- topic/div div">
<div class="- topic/div div"> 写数据设置 ddrsdr 模式, 0x0 是 sdr 0x01 是 ddr</div>
</div>
<div class="- topic/div div">u8 lines</div>
<div class="- topic/div div">
<div class="- topic/div div"> 设置 1/2/4/8 线传输, 可取值 0 1 2 3</div>
</div>
<div class="- topic/div div">u32 count</div>
<div class="- topic/div div">
<div class="- topic/div div"> 设置写入 data 的个数bytes 为单位</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 成功</div>
<div class="- topic/div div">其他: 失败</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">u8 lines 需要根据实际配置,传入的 lines 和 count 硬件会控制输出的 cycle</td></tr></tbody></table></div>
<div class="table-container"><table class="- topic/table table frame-all" id="id__table_djc_qyh_bdc" data-ofbid="id__table_djc_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 18</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_xspi_set_read_cnt</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">int hal_xspi_set_read_cnt(hal_xspi_handle *h, u8
ddr_sdr_mode, u8 lines, u32 count)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">配置读 data 的个数</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
<div class="- topic/div div">u8 ddr_sdr_mode</div>
<div class="- topic/div div">
<div class="- topic/div div"> 读数据设置 ddrsdr 模式, 0x0 是 sdr 0x01 是 ddr</div>
</div>
<div class="- topic/div div">u8 lines</div>
<div class="- topic/div div">
<div class="- topic/div div"> 设置 1/2/4/8 线传输, 可取值 0 1 2 3</div>
</div>
<div class="- topic/div div">u32 count</div>
<div class="- topic/div div">
<div class="- topic/div div"> 设置读入 data 的个数bytes 为单位</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 成功</div>
<div class="- topic/div div">其他: 失败</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">u8 lines 需要根据实际配置,传入的 lines 和 count 硬件会控制输出的 cycle</td></tr></tbody></table></div>
<div class="table-container"><table class="- topic/table table frame-all" id="id__table_ejc_qyh_bdc" data-ofbid="id__table_ejc_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 19</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_xspi_start_transfer</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">int hal_xspi_start_transfer(hal_xspi_handle *h)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">开始传输使能</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 成功</div>
<div class="- topic/div div">其他: 失败</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">-</td></tr></tbody></table></div>
<div class="table-container"><table class="- topic/table table frame-all" id="id__table_fjc_qyh_bdc" data-ofbid="id__table_fjc_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 20</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_xspi_transfer_cpu_sync</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">int hal_xspi_transfer_cpu_sync(hal_xspi_handle *h, struct
hal_xspi_transfer *t)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">数据传输配置,写入 fifo。</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
<div class="- topic/div div">struct hal_xspi_transfer *t</div>
<div class="- topic/div div">
<div class="- topic/div div">数据结构体</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 传输成功完成</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">-</td></tr></tbody></table></div>
<div class="table-container"><table class="- topic/table table frame-all" id="id__table_gjc_qyh_bdc" data-ofbid="id__table_gjc_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 21</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_xspi_xip_cfg</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">int hal_xspi_xip_cfg(hal_xspi_handle *h, hal_xspi_proto_cfg_t
xip_proto_cfg)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">XSPI 的 XIP 配置,根据实际的 psram 设备协议写入 XIP 指令</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
<div class="- topic/div div">hal_xspi_proto_cfg_t xip_proto_cfg</div>
<div class="- topic/div div">
<div class="- topic/div div"> psram 设备协议 XIP 指令</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 设置完成</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">-</td></tr></tbody></table></div>
<div class="table-container"><table class="- topic/table table frame-all" id="id__table_hjc_qyh_bdc" data-ofbid="id__table_hjc_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 22</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_xspi_xip_enable</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">int hal_xspi_xip_enable( hal_xspi_handle *h)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">XSPI 的 XIP 使能</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 设置完成</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">在 hal_xspi_xip_cfg()后调用</td></tr></tbody></table></div>
<div class="table-container"><table class="- topic/table table frame-all" id="id__table_ijc_qyh_bdc" data-ofbid="id__table_ijc_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 23</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_xspi_set_cs</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">int hal_xspi_set_cs(hal_xspi_handle *h, u8 sel)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">数据传输配置,写入 fifo。</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
<div class="- topic/div div">u8 sel</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 的 CS 选择0 1</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 设置完成</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="id__table_jjc_qyh_bdc" data-ofbid="id__table_jjc_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 24</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_xspi_set_boudary</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">int hal_xspi_set_boudary(hal_xspi_handle *h, u8 by)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">数据切割,根据具体 psram 配置</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
<div class="- topic/div div">u8 by</div>
<div class="- topic/div div">
<div class="- topic/div div"> 数据长度切割,可选 xspi_2k = 0x0, xspi_1k = 0x1,</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 设置完成</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="id__table_kjc_qyh_bdc" data-ofbid="id__table_kjc_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 25</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_xspi_set_parallel_mode</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">int hal_xspi_set_parallel_mode(hal_xspi_handle *h, u8
mode)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">使用双/单片 PSRAM 配置。</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
<div class="- topic/div div">u8 mode</div>
<div class="- topic/div div">
<div class="- topic/div div"> 单片或双片配置,可选 single_mode = 0x0, parellel_mode =
0x1</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 设置完成</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="id__table_ljc_qyh_bdc" data-ofbid="id__table_ljc_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 26</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_xspi_set_dll_ctl</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">int hal_xspi_set_dll_ctl(hal_xspi_handle *h, u8 sel, u8
reg_icp, u8 phase_sel)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1"> 时钟采样相位和时钟频率等级配置,需要传入与时钟频率等级和相位值,一般在 training
得到稳定相位时传入。</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
<div class="- topic/div div">u8 sel</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 的 CS 选择0 1</div>
</div>
<div class="- topic/div div">u8 reg_icp</div>
<div class="- topic/div div">
<div class="- topic/div div"> 时钟频率等级ICP_50_100MICP_100_150M
ICP_150_200M。</div>
</div>
<div class="- topic/div div">u8 phase_sel</div>
<div class="- topic/div div">
<div class="- topic/div div"> 相位等级配置0x00-0x0f</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 设置完成</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="id__table_mjc_qyh_bdc" data-ofbid="id__table_mjc_qyh_bdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 27</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_xspi_set_phase_sel</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 函数原型 </td><td class="- topic/entry entry colsep-0 rowsep-1">int hal_xspi_set_phase_sel(hal_xspi_handle *h, u8 sel, u8
phase_sel)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 功能说明 </td><td class="- topic/entry entry colsep-0 rowsep-1">时钟采样相位配置,需要传入相位值,一般在 training 过程尝试不同相位时配置。</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 参数定义 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">hal_xspi_handle *h</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 控制器 Handle</div>
</div>
<div class="- topic/div div">u8 sel</div>
<div class="- topic/div div">
<div class="- topic/div div">XSPI 的 CS 选择0 1</div>
</div>
<div class="- topic/div div">u8 phase_sel</div>
<div class="- topic/div div">
<div class="- topic/div div"> 相位等级配置0x00-0x0f</div>
</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1"> 返回值 </td><td class="- topic/entry entry colsep-0 rowsep-1">
<div class="- topic/div div">
<div class="- topic/div div">0: 设置完成</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0"> 注意事项 </td><td class="- topic/entry entry colsep-0 rowsep-0">-</td></tr></tbody></table></div>
</div>
</section></div></article></main></div>
</div>
<nav role="navigation" id="wh_topic_toc" aria-label="On this page" class="col-lg-2 d-none d-lg-block navbar d-print-none">
<div id="wh_topic_toc_content">
<div class=" wh_topic_toc "><div class="wh_topic_label">在本页上</div><ul><li class="section-item"><div class="section-title"><a href="#id__id2" data-tocid="id__id2">源码说明</a></div></li><li class="section-item"><div class="section-title"><a href="#id__id3" data-tocid="id__id3">模块架构</a></div></li><li class="section-item"><div class="section-title"><a href="#id__hal-drv" data-tocid="id__hal-drv">HAL 与 DRV</a></div></li><li class="section-item"><div class="section-title"><a href="#id__id4" data-tocid="id__id4">关键流程设计</a></div></li><li class="section-item"><div class="section-title"><a href="#id__id5" data-tocid="id__id5">数据结构设计</a></div></li><li class="section-item"><div class="section-title"><a href="#id__id6" data-tocid="id__id6">接口设计</a></div></li></ul></div>
</div>
</nav>
</div>
</div>
</div>
<footer class="navbar navbar-default wh_footer">
<div class=" footer-container mx-auto ">
<title>footer def</title>
<style><!--
.p1 {
font-family: FangZhengShuSong, Times, serif;
}
.p2 {
font-family: Arial, Helvetica, sans-serif;
}
.p3 {
font-family: "Lucida Console", "Courier New", monospace;
}
--></style>
<div class="webhelp.fragment.footer">
<p class="p1">Copyright © 2019-2024 广东匠芯创科技有限公司. All rights reserved.</p>
</div><div>
<div class="generation_time">
Update Time: 2025-01-21
</div>
</div>
</div>
</footer>
<div id="go2top" class="d-print-none">
<span class="oxy-icon oxy-icon-up"></span>
</div>
<div id="modal_img_large" class="modal">
<span class="close oxy-icon oxy-icon-remove"></span>
<div id="modal_img_container"></div>
<div id="caption"></div>
</div>
<script src="${pd}/publishing/publishing-styles-AIC-template/js/custom.js" defer="defer"></script>
</body>
</html>