登录注册
论坛
一粒金砂(初级)
82
0
扫一扫,分享给好友
76
72
71
59
引用 3 楼 trueman_onlyme 的回复: 你是说如何操作GPIO的吗? ? ?C/C++ code#define IOP_BASE 0xB1600000// 0x56000000 typedefstruct { unsignedint rGPACON;// 00 unsignedint rGPADAT; unsignedint rPAD1[2]; unsignedint rGPBCON;// 10 unsignedint rGPBDAT; unsignedint rGPBUP; unsignedint rPAD2; unsignedint rGPCCON;// 20 unsignedint rGPCDAT; unsignedint rGPCUP; unsignedint rPAD3; unsignedint rGPDCON;// 30 unsignedint rGPDDAT; unsignedint rGPDUP; unsignedint rPAD4; unsignedint rGPECON;// 40 unsignedint rGPEDAT; unsignedint rGPEUP; unsignedint rPAD5; unsignedint rGPFCON;// 50 unsignedint rGPFDAT; unsignedint rGPFUP; unsignedint rPAD6; unsignedint rGPGCON;// 60 unsignedint rGPGDAT; unsignedint rGPGUP; unsignedint rPAD7; unsignedint rGPHCON;// 70 unsignedint rGPHDAT; unsignedint rGPHUP; unsignedint rPAD8; unsignedint rMISCCR;// 80 unsignedint rDCKCON; unsignedint rEXTINT0; unsignedint rEXTINT1; unsignedint rEXTINT2;// 90 unsignedint rEINTFLT0; unsignedint rEINTFLT1; unsignedint rEINTFLT2; unsignedint rEINTFLT3;// A0 unsignedint rEINTMASK; unsignedint rEINTPEND; unsignedint rGSTATUS0;// AC unsignedint rGSTATUS1;// B0 unsignedint rGSTATUS2;// B4 ;;; SHL unsignedint rGSTATUS3;// B8 unsignedint rGSTATUS4;// BC unsignedint rFLTOUT;// C0 unsignedint rDSC0; unsignedint rDSC1; unsignedint rMSLCON; unsignedint rGPJCON;// D0 unsignedint rGPJDAT; unsignedint rGPJUP; unsignedint rPAD9; }IOPreg; 然后在驱动里面 定义一个IOPreg类型的指针,如果IOPreg是虚拟地址,那么可以直接操作,如果是物理地址,要做一个映射操作,然后就想操作结构体成员变量一样来进行GPIO寄存器的配置
发表回复 回帖后跳转到最后一页
EEWorld Datasheet 技术支持
查看 »