/*
 *  Copyright (c) 1996-2007 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
 *
 * Description.
 * =======================================================================
 *  This file contains the routines that reset and restart the processor,
 *  and the LED initialization routine.  These routines need to be customized
 *  to support your hardware.
 *
 *
 * Edit Date/Ver   Edit Description
 * ==============  =======================================================
 *
 *
 */

#include <stdlib.h>
#include <Npttypes.h>
// #include <bsp.h>
#include <reg_def.h>
#include <narmled.h>
#include <nareset.h>
#include <init.h>
#include <bootldr.h>
#include <gpio_def.h>
#include <gpio.h>




/*
 * Bit definitions for LEDs on the Connect ME.
 *
 * The Connect ME only has one LED, for ethernet activity.
 */
#define ETHERNET_ACTIVITY_GPIO_BIT         BIT_6

#if (BSP_SERIAL_PORT_2 == BSP_SERIAL_NO_DRIVER) 

/*
 * The NET+OS LED driver uses values in the table NALedTable
 * to determine how to turn LEDs on and off.  See the BSP
 * Reference guide for information on how to modify this
 * table for your custom hardware.  
 *
 * This table sets up the LEDs on the development board.  Pin
 * C1 is connected to the green LED, and pin C2 is connected
 * to the yellow LED.  Setting a pin HIGH turns the LED OFF,
 * and setting it LOW turns the LED ON.
 *
 * The LED driver has to be able to work even when RAM is not
 * setup.  It is the only way to get status information out
 * during initialization.  Therefore, this table should be
 * declared as a constant so that it is stored in ROM.  If you
 * need to support multiple boards that have the LEDs connected
 * to different pins, then use #ifdef statements to create
 * different tables for different boards.
 */
const NALedTableType NALedTable[] = 
{
    {                       /* setup for the error LED*/
        NULL,
        0,
        0,
        0,
        0,
        FALSE               /* not supported */
    },
    {                       /* setup for the "other" LED*/
        NULL,
        0,
        0,
        0,
        0,
        FALSE               /* not supported */
    },
    {                       /* setup for the activity LED*/
        (WORD32*)NARM_PORTC_ADDR,
        0,
        ~ETHERNET_ACTIVITY_GPIO_BIT,
        ETHERNET_ACTIVITY_GPIO_BIT,
        0xffffffff,
        TRUE
    }

};


/*
 * This constant should be set to the number of LEDs supported by
 * the H/W.  The LED driver uses it 
 * to determine the size of the table.
 */
const int NA_LED_COUNT = sizeof NALedTable/sizeof(NALedTableType);

#else

const NALedTableType NALedTable[] = 
{
    {                       /* setup for the error LED*/
        NULL,
        0,
        0,
        0,
        0,
        FALSE               /* not supported */
    }
};

const int NA_LED_COUNT = 0;

#endif







