
/*****************************************************************************
* Copyright (c) 2004 Digi International Inc., All Rights Reserved
* 
* This software contains proprietary and confidential information of Digi
* International Inc.  By accepting transfer of this copy, Recipient agrees
* to retain this software in confidence, to prevent disclosure to others,
* and to make no use of this software other than that for which it was
* delivered.  This is an unpublished copyrighted work of Digi International
* Inc.  Except as permitted by federal law, 17 USC 117, copying is strictly
* prohibited.
* 
* Restricted Rights Legend
*
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in sub-paragraph (c)(1)(ii) of The Rights in
* Technical Data and Computer Software clause at DFARS 252.227-7031 or
* subparagraphs (c)(1) and (2) of the Commercial Computer Software -
* Restricted Rights at 48 CFR 52.227-19, as applicable.
*
* Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
*
*****************************************************************************/


#include <assert.h>
#include <npttypes.h>
#include <nagpio.h>
#include <gpioplatform.h>
#include <processorgpio.h>
#include <reg_def.h>


int GpioPlatformFunction(int function, unsigned long *gpio_type, unsigned long *addr, unsigned long *gpio_pin)
{
    *gpio_type = GPIO_TYPE_PROCESSOR_PIN;
    *addr = (unsigned long) NARM_PORTC_ADDR;	    /* Default is PORT C */
    switch (function)
    {

	case GPIO_ERROR_LED:
	    *gpio_pin = 6;
	    break;
	case GPIO_DIAG:
	    *gpio_pin = 6;
	    break;
	case GPIO_SOFTRESET:
	    *gpio_pin = 5;
	    break;
	case GPIO_EINT:
	    *gpio_pin = 0;
	    break;
#ifdef POWER_LED_ENABLED	/* EM or SP */
	case GPIO_POWERLED:
	    *gpio_pin = 6;
	    break;
#endif
#ifdef ETH_ACTIVITY_LED_ENABLED
	case GPIO_ACTIVITY:
	    if (GetHardwareType() == DIGI_CONNECT_EM)
		*gpio_pin = 2;	/* EM */
	    else
		*gpio_pin = 6;	/* ME, WiEM */
	    break;
#endif
#ifdef RESET_ENABLED
	case GPIO_RESETLED:
	    if (GetHardwareType() == DIGI_CONNECT_WiEM)
		*gpio_pin = 2;	/* WiEM */
	    else
		*gpio_pin = 6;	/* ME, EM, SP, WiME */
	    break;
#endif
	case GPIO_MFGO:
	    *gpio_pin = 4;
	    break;
	case GPIO_MFGI:
	    *gpio_pin = 1;
	    break;
#ifdef SERIAL_ACTIVITY_LED_ENABLED  /* EM or WiEM */
	case GPIO_SERIALACT:
	    *gpio_pin = 4;
	    break;
#endif
#ifdef MG_ENABLED /* Cellular DS */
	case GPIO_CELLMDM_RST:
	    *gpio_pin = 0;
	    break;
#endif
	default:
	    /* No such pin. */
	    return FALSE;
    }
    return TRUE;
}

void GpioPlatform_epoch(void)
{
}
