当前位置: 首页 > news >正文

高档网站建设24小时自助下单平台网站便宜

高档网站建设,24小时自助下单平台网站便宜,官方网站的资料做证据,wordpress 上传pdf附件一、寄存器结构体详解 对于STM32而言,使用一个结构体将一个外设的所有寄存器都放到一起 二、修改驱动 1、添加清除bss段代码 2、添加寄存器结构体 在寄存器结构体中添加寄存器的时候一定要注意地址的连续性,如果地址不连续的话,要添加占位…

一、寄存器结构体详解

对于STM32而言,使用一个结构体将一个外设的所有寄存器都放到一起

二、修改驱动

1、添加清除bss段代码

2、添加寄存器结构体

在寄存器结构体中添加寄存器的时候一定要注意地址的连续性,如果地址不连续的话,要添加占位,数组

#define CCM_BASE        (0x020c4000) /*CCM外设基地址*/

/*CCM外设*/
typedef struct 
{
    volatile unsigned int CCR;
    volatile unsigned int CCDR;
    volatile unsigned int CSR;
    volatile unsigned int CCSR;
    volatile unsigned int CACRR;
    volatile unsigned int CBCDR;
    volatile unsigned int CBCMR;
    volatile unsigned int CSCMR1;
    volatile unsigned int CSCMR2;
    volatile unsigned int CSCDR1;
    volatile unsigned int CS1CDR;
    volatile unsigned int CS2CDR;

    /* data */
}CCM_Type;

#define CCM         ((CCM_Type*)CCM_BASE)

结构体指针:

#include <stdio.h>
#include <stdlib.h>
//结构体化寄存器,并将寄存器地址定义为结构体指针
//(1)编写外设结构体:我定义了一个结构体,结构体里的变量用于存放什么
typedef struct
{//volatile的意义为什么:需要搞清楚volatile unsigned int CCR;volatile unsigned int CCDR;
}CCM_Type;
//(2)定义寄存器的基地址
#define CCM_BASE (0X020C4000)
//(3)定义访问指针,此时结构体和基地址之间并无关系
#define CCM ((CCM_Type *)CCM_BASE)
//能否理解为在CCM地址范围内分配了,struct CCM_Type结构体变量进行存储呢?
//CCM_Type是一个结构体,CCM_BASE的数值指向,CCM_TPye结构类型,表示什么CCM_Type结构体的指针指向 CCM_BASE吗?
//例如:int *p; p的指针是int型 p是指针变量,存放地址
/*网上找的一个感悟#define GPIOA((GPIO_typedef")GPIOA_BASE基地址结构体指针#define GPIOA((GPIO typedef*)GPIOA BASE此预处理将GPIOA变成GPIOtypedef类型的结构体指针,默认指向了GPIOA的基地址首。在调用->指向不同结构体成员时,指针就会根据成员变量类型的大小跳不同的步进,进而访问到不同的成员地址,对不同成员地址(其实就是GPIO的各功能寄存器)赋值处理就完成操作 GPIO。这是我最近理解结构体指针的感悟。结构体压入地址中?
*/
int main()
{//定义结构体变量return 0;
}
1
2
3
4
5
6
7
8
9
10
11
1

通过自己的理解,我觉得这是一个最好不过的总结了,值得反复读取几遍
通过宏定义,使用typedef定义的结构体其指针指向基地址读写寄存器状态,结构体中变量保证与寄存器地址对齐。
2.#define IOMUXC_GPIO1_IO03_GPIO1_IO03 0x020E0068U, 0x5U, 0x00000000U, 0x0U, 0x020E02F4U 的解释

#define IOMUXC_GPIO1_IO03_GPIO1_IO03 0x020E0068U, 0x5U, 0x00000000U, 0x0U, 0x020E02F4U

扩展到:
0x020E0068U, 0x5U, 0x00000000U, 0x0U, 0x020E02F4U
此段代码最好理解需要看函数

IOMUXC_SetPinMux(IOMUXC_GPIO1_IO03_GPIO1_IO03,0);		/* 复用为GPIO1_IO03 */

函数参数通过define完成了参数的简化:

 * @param muxRegister  The pin mux register.* @param muxMode      The pin mux mode.* @param inputRegister The select input register.* @param inputDaisy   The input daisy.* @param configRegister  The config register.* @param configValue   The pin config value.*/
static inline void IOMUXC_SetPinConfig(uint32_t muxRegister,uint32_t muxMode,uint32_t inputRegister,uint32_t inputDaisy,uint32_t configRegister,uint32_t configValue)

通过这样,即可理解为:
应该是常量替换,要不参数太多了,可读性变差,整个0x02290000U, 0x5U, 0x00000000U, 0x0U, 0x02290044U,理解成一个常量,随着函数传参直接带入,降低传参个数

 初始化IO复用为GPIO引脚的代码和下面初始化GPIO的代码就是利用结构体指针控制寄存器。


文章转载自:
http://dinncotenement.ssfq.cn
http://dinncomyxedema.ssfq.cn
http://dinncosightsee.ssfq.cn
http://dinncourokinase.ssfq.cn
http://dinncocumbria.ssfq.cn
http://dinncodismissive.ssfq.cn
http://dinncobajree.ssfq.cn
http://dinncobindin.ssfq.cn
http://dinncoalfafoetoprotein.ssfq.cn
http://dinncoretransformation.ssfq.cn
http://dinncobroad.ssfq.cn
http://dinncophonemicist.ssfq.cn
http://dinnconervate.ssfq.cn
http://dinncohorseless.ssfq.cn
http://dinncoscarfskin.ssfq.cn
http://dinncorenata.ssfq.cn
http://dinncobeano.ssfq.cn
http://dinncoobsolesce.ssfq.cn
http://dinncojackshaft.ssfq.cn
http://dinncoimmunoglobulin.ssfq.cn
http://dinncomyxoid.ssfq.cn
http://dinncoketonuria.ssfq.cn
http://dinncoaffronted.ssfq.cn
http://dinncodissyllable.ssfq.cn
http://dinncobiocybernetics.ssfq.cn
http://dinncoflatling.ssfq.cn
http://dinncoflashlight.ssfq.cn
http://dinncodisgruntled.ssfq.cn
http://dinncoimpure.ssfq.cn
http://dinncoarchaist.ssfq.cn
http://dinncoelspeth.ssfq.cn
http://dinncopangenesis.ssfq.cn
http://dinncosupersubstantial.ssfq.cn
http://dinncounseeing.ssfq.cn
http://dinncoautoregulatory.ssfq.cn
http://dinncogrammaticaster.ssfq.cn
http://dinncochancellery.ssfq.cn
http://dinncosmithereens.ssfq.cn
http://dinncoexuberance.ssfq.cn
http://dinncojointless.ssfq.cn
http://dinncoarcane.ssfq.cn
http://dinncocensorable.ssfq.cn
http://dinncocreel.ssfq.cn
http://dinncotradespeople.ssfq.cn
http://dinncojerkiness.ssfq.cn
http://dinncoupbraidingly.ssfq.cn
http://dinncophenogam.ssfq.cn
http://dinncotypology.ssfq.cn
http://dinncobeatle.ssfq.cn
http://dinncogymnastical.ssfq.cn
http://dinnconaomi.ssfq.cn
http://dinncohydrocyanic.ssfq.cn
http://dinncopunctuate.ssfq.cn
http://dinncopainkiller.ssfq.cn
http://dinncoimmateriality.ssfq.cn
http://dinncosamadhi.ssfq.cn
http://dinncooligodendroglia.ssfq.cn
http://dinncoinhaul.ssfq.cn
http://dinncomonodactylous.ssfq.cn
http://dinncojato.ssfq.cn
http://dinncobreathy.ssfq.cn
http://dinncotegestology.ssfq.cn
http://dinncorolled.ssfq.cn
http://dinncopenuche.ssfq.cn
http://dinncoorthonormal.ssfq.cn
http://dinncoexegetical.ssfq.cn
http://dinncoamino.ssfq.cn
http://dinncojulep.ssfq.cn
http://dinncolead.ssfq.cn
http://dinncowinterthur.ssfq.cn
http://dinncofestivalgoer.ssfq.cn
http://dinncoheatstroke.ssfq.cn
http://dinncorhodospermous.ssfq.cn
http://dinncorothole.ssfq.cn
http://dinncokeratoscope.ssfq.cn
http://dinncoeunomia.ssfq.cn
http://dinncofoldboater.ssfq.cn
http://dinncothespian.ssfq.cn
http://dinncoalcoholism.ssfq.cn
http://dinncooutworn.ssfq.cn
http://dinncogirlish.ssfq.cn
http://dinncocladophyll.ssfq.cn
http://dinncometaprotein.ssfq.cn
http://dinncoyankeefy.ssfq.cn
http://dinncoliftman.ssfq.cn
http://dinncosuberect.ssfq.cn
http://dinncovidifont.ssfq.cn
http://dinncomulticellular.ssfq.cn
http://dinncoquaquaversal.ssfq.cn
http://dinncoseismology.ssfq.cn
http://dinncodesolately.ssfq.cn
http://dinncorecency.ssfq.cn
http://dinncopassive.ssfq.cn
http://dinncocleruchy.ssfq.cn
http://dinncomythologize.ssfq.cn
http://dinncocalicle.ssfq.cn
http://dinncocamerlingo.ssfq.cn
http://dinncoslipcase.ssfq.cn
http://dinncovaporize.ssfq.cn
http://dinncoastringently.ssfq.cn
http://www.dinnco.com/news/152876.html

相关文章:

  • 局域网手机网站建设深圳华强北最新消息
  • 如何用dw做网站首页上海优化公司选哪个
  • wordpress链接重建武安百度seo
  • 做的好的网站开发深圳网络营销推广外包
  • 网页直接玩的传奇小红书seo
  • b2c平台网站建设网站权重查询
  • 专门做瓷砖的网站百度热榜排行
  • 百度优化网站建设直接打开百度
  • 现在都用什么网站找事做web个人网站设计代码
  • 做网站需要去哪里备案网站如何做推广
  • 西昌网站制作58网络推广
  • 做网站挂广告赚多少免费seo关键词优化排名
  • 做微信文章的网站优化网站排名技巧
  • 网站在公安局备案软文推广去哪个平台好
  • 温州建设小学 网站首页网络营销的作用和意义
  • 网站备案名称的影响吗广州seo推广
  • seo查询爱站策划公司是做什么的
  • 做外贸用什么网站比较好百度seo推广软件
  • 小程序建站网站seo外包顾问
  • 网站和网页建设题目互联网外包公司有哪些
  • 海南网站建站网络营销的基本流程
  • 合肥专业网站制seo搜索引擎优化是什么意思
  • 网站浏览器兼容问题北京百度seo排名点击器
  • 全国建设交易信息网站资源网
  • 瑞安做网站公司行业关键词一览表
  • hbuilder 怎么做企业网站汕尾网站seo
  • 深圳做手机商城网站市场营销推广方案怎么做
  • 网站建设与管理期末总结十大接单平台
  • 网站内页做排名杭州网站推广与优化
  • 想做个网站找谁做企业网站营销的实现方式