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

📄 gpio.c

📁 用于TM1300/PNX1300系列DSP(主要用于视频处理)的设备库的源码
💻 C
字号:
/*
 *  +-------------------------------------------------------------------+
 *  | Copyright (c) 1999 by TriMedia Technologies.                      |
 *  |                                                                   |
 *  | This software  is furnished under a license  and may only be used |
 *  | and copied in accordance with the terms  and conditions of such a |
 *  | license  and with  the inclusion of this  copyright notice.  This |
 *  | software or any other copies of this software may not be provided |
 *  | or otherwise  made available  to any other person.  The ownership |
 *  | and title of this software is not transferred.                    |
 *  |                                                                   |
 *  | The information  in this software  is subject  to change  without |
 *  | any  prior notice  and should not be construed as a commitment by |
 *  | TriMedia Technologies.                                            |
 *  |                                                                   |
 *  | This  code  and  information  is  provided  "as is"  without  any |
 *  | warranty of any kind,  either expressed or implied, including but |
 *  | not limited  to the implied warranties  of merchantability and/or |
 *  | fitness for any particular purpose.                               |
 *  +-------------------------------------------------------------------+
 *
 *
 *  Module name              : gpio.c    1.2
 *
 *  Last update              : 18:43:41 - 00/11/09
 *
 *  Description              :
 *            This file describes the GPIO abilities of the different
 *            TriMedia chips.
 *  Revision                 :
 *      Constructed for TCS 2.0b
 */

#include <tm1/tmBoard.h>
#include <tm1/tmProcessor.h>
#include <tm1/tmGPIOboard.h>
#include <tm1/mmio.h>

/* TM2 gpio Capabilities */

#define TM2_NROF_EVENTS 8
#define TM2_NROF_TS_EVENTS 6

static gpioGroupInternalCaps_t TM2Groups[]=
{
    { 0x00, 12, GPIOA_MODE },
    { 0x0c, 12, GPIOB_MODE },
    { 0x18, 34, GPIOC_MODE },
    { 0x3a, 11, GPIOD_MODE },
    { 0x45, 4 , GPIOE_MODE },
    { 0x49, 8 , GPIOF_MODE }, 
    { 0x51, 4 , GPIOG_MODE }, 
    { 0x55, 6 , GPIOH_MODE }, 
    { 0x5b, 22, GPIOJ_MODE }, 
    { 0x71, 4 , GPIOK_MODE },
    { 0x75, 11, 0          },
    { 0   , 0 , 0          }
};

static gpioEventInternalCaps_t TM2Events=
{
    TM2_NROF_EVENTS,
    TM2_NROF_TS_EVENTS
};

static boardGPIOConfig_t TM2Config =
{
    TM2Groups,
    &TM2Events
};


/* TM1 (default) GPIO Capabilities */

static gpioGroupInternalCaps_t defaultGroups[] = 
{
    { 0   , 0 , 0          } /* no GPIO capabilities */
};

static gpioEventInternalCaps_t defaultEvents =
{
    0, /* no event capabilities */
    0
};

static boardGPIOConfig_t defaultConfig =
{
    defaultGroups,
    &defaultEvents
};


extern tmLibdevErr_t gpioInit(void)
{
    pprocCapabilities_t      procCap;
    boardGPIOConfig_t       *gpiobc;
    
    
    procGetCapabilities(&procCap);
    switch(procCap->deviceID)
    {
    case PROC_DEVICE_TM2500:
    case PROC_DEVICE_TM2600:
    case PROC_DEVICE_TM2700:
    case PROC_DEVICE_TM2800:
        gpiobc = &TM2Config;
        break;
    default:
        gpiobc = &defaultConfig;
        break;
    }

    tsaBoardRegisterGPIO(0, gpiobc);

    return TMLIBDEV_OK;
}

⌨️ 快捷键说明

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