⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sysgpio.c

📁 au1500开发的应用程序
💻 C
字号:
/* sysGpio.c - system GPIO manipulation routines */

/* Copyright Copyright 2002-2005 Founder Communications, Inc. */

/*
modification history
--------------------
01b,29feb05,fhchen  PD15 and PD14 are used by I2C
01a,26jan05,fhchen  written 
*/

/*
DESCRIPTION

This file contains routines for manipulating the on board GPIO pins. 
*/

/* includes */

#include "sysGpio.h"
#include "m8260IOPort.h"

/***********************************************************************
*
* sysGpioInit - initialize V100R001SCB board I/O ports
*
* This routines initialize the SCB board I/O ports. Registers are 
* configured to reflect on board settings, please refer to document
* provided by hardware department.
*
* NOTE: 
* - bits of unused pins are set to 0.
* - programming PSORx and PDIRx before PPARx! or a pin might function
*   for a short period as an unwanted dedicated function and cause 
*   unknown behavior. See MPC8260 manual.
*
* RETURNS: N/A
*/

void sysGpioInit(void)
    {
    int immrVal = vxImmrGet();
    
    /* configure port A, mainly FCC1 */

    *M8260_IOP_PAODR(immrVal) = 0x00000000;
    *M8260_IOP_PASO(immrVal) = 0x0000003B;
    *M8260_IOP_PADIR(immrVal) = 0x02303C08;
    *M8260_IOP_PAPAR(immrVal) = 0x0003FC3B;

    /* configure port B, mainly FCC3 */
    
    *M8260_IOP_PBODR(immrVal) = 0x00000000;
    *M8260_IOP_PBSO(immrVal) = 0x00000000;
    *M8260_IOP_PBDIR(immrVal) = 0x0F020000;
    *M8260_IOP_PBPAR(immrVal) = 0x0FFEC000;

    /* configure port C, some gpio pins and clk */

    *M8260_IOP_PCODR(immrVal) = 0x00000000;
    *M8260_IOP_PCSO(immrVal) = 0x10000000;
    *M8260_IOP_PCDIR(immrVal) = 0x40200000;
    *M8260_IOP_PCPAR(immrVal) = 0x1081CC00;
    
    /* configure port D, SCC1, SCC4, SMC, I2C */
    
    *M8260_IOP_PDODR(immrVal) = 0x00000000;
    *M8260_IOP_PDSO(immrVal) = 0x00030002;
    *M8260_IOP_PDDIR(immrVal) = 0x007C0C06;
    *M8260_IOP_PDPAR(immrVal) = 0x01C30E07;
    
    }

/***********************************************************************
*
* sysGpioRegShow - show content of gpio related registers 
*
* This routine call board specific show routine to provide GPIO register
* information.
*  
* NOTE:
* - When GPIO are changing fast, this routine do not reflect the 
*   current state of GPIO.
* - This routine is for debug purpose only, it may affect system behavior,
*   use at your risk  
*
* RETURNS: N/A
*/

void sysGpioRegShow
    (
    int port    /* port to show */
    )
    {

    m8260IOPortRegShow(port);
    
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -