资源简介
海思3516d GPIO控制,详情请参考博客http://blog.csdn.net/qq_21193563/article/details/79050938
代码片段和文件信息
/*
* HisiGpio.cpp
*
* Created on: 2018年1月11日
* Author: JasonHuo
*/
#include
#include
#include
#include
#include “HisiGpio.h“
#include “hi_comm_sys.h“
#include “mpi_sys.h“
#define GPIO_DATA_ADDR(gpioGroupbaseAddr pin) ((gpioGroupbaseAddr) + 0x000) + (1 << ((pin) + 2))
#define GPIO_GROUP_DIR_ADDR(gpioGroupbaseAddr) (gpioGroupbaseAddr) + 0x400
static int gsHisiGpiobaseAddrTab[16]={0x201400000x201500000x201600000x201700000x201800000x201900000x201a0000
0x201b00000x201c00000x201d00000x201e00000x201f00000x202000000x202100000x202200000x20260000};
void HisiGpioDirCfg(int groupint pinbool isOutput)
{
unsigned int val = 0;
unsigned int dirAddr = 0;
dirAddr = GPIO_GROUP_DIR_ADDR(gsHisiGpiobaseAddrTab[group]);
if( 0 == HI_MPI_SYS_GetReg(dirAddr&val) )
{
if(isOutput)
{
val |= 1 << pin;
}
else
{
val &= ~(1 << pin);
}
if( 0 != HI_MPI_SYS_SetReg(dirAddrval) )
{
printf(“HI_
- 上一篇:禁忌搜索算法C语言程序
- 下一篇:20多个常用的Hash算法C++ 实现
评论
共有 条评论