/*	$Id: pmon_target.h,v 1.3 2006/09/01 15:27:32 pefo Exp $ */
/*
 * Copyright (c) 2006 Opsycon AB  (www.opsycon.se)
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */

#include <target/msp2200.h>

/*
 *  Name of envvar that has to be set to enable expert mode.
 */
#define EXPERT  "pmcexpert"

/*
 *  Target arch specifics
 */

/*
 *  Target dependent CLIENTPC settings
 */
#define CLIENTPC 0x00100000
#define SETCLIENTPC "00100000"

/*
 *  Valid load address checking
 */
extern void *pmon_end;

#define	TGT_VALID_LOAD_ADDRESS(low, high)	\
	if (((long)low < (long)pmon_end) ||	\
	    ((long)high > (long)memtop))	\
		return -1;


#ifndef SBD_DEBUG
#define SBD_DISPLAY(text)		/* No display function */
#else
#define SBD_DISPLAY(text)	tgt_display(text, 0)
#endif

/*
 *  Define the system LED settings
 */
#if defined(TGT_PM74020)
#define	TFTPD_LED_ON	500	/* TFTPD active led on time in ms */
#define	TFTPD_LED_OFF	500	/* TFTPD active led off time in ms */
#define	ERASE_LED_ON	125	/* ERASE active led on time in ms */
#define	ERASE_LED_OFF	125	/* ERASE active led off time in ms */
#define	SYSERR_LED_ON	250	/* SYSERR active led on time in ms */
#define	SYSERR_LED_OFF	250	/* SYSERR active led off time in ms */

#define	ERASE_PIN	25	/* Erase status input. */
#define	ERASE_PIN_TIME	3000	/* Time until activated. */
#define	TFTPD_PIN	25	/* TFTPD status input (may be equal to erase) */
#define	TFTPD_PIN_TIME	5000	/* Time until activated */

#define	SYSTEM_PWR_LED	1	/* Power LED yellow-green */
#define	SYSTEM_ERR_LED	2	/* Error LED yellow-red */
#define	TFTPD_LED	SYSTEM_PWR_LED

#define	SYSTEM_LEDS \
  { SYSTEM_PWR_LED, 34, -1, 1, 1, { 0x11, 0x00, 0x33, 0x01, 0x31, 0x03 } }, \
  { SYSTEM_ERR_LED, 22, -1, 0, 0, { 0x00, 0x11, 0x22, 0x10, 0x20, 0x12 } },

#endif

#if defined(TGT_PM74102)
#define	ERASE_LED_ON	125	/* ERASE active led on time in ms */
#define	ERASE_LED_OFF	125	/* ERASE active led off time in ms */
#define	SYSERR_LED_ON	250	/* SYSERR active led on time in ms */
#define	SYSERR_LED_OFF	250	/* SYSERR active led off time in ms */

#define	ERASE_PIN	46	/* Erase status input. */
#define	ERASE_PIN_TIME	3000	/* Time until activated. */
#define	DIAGN_PIN	65	/* Diagnostic mode */

#define	SYSTEM_PWR_LED	1	/* Power LED yellow-green */
#define	SYSTEM_ERR_LED	2	/* Error LED yellow-red */

#define SYSTEM_LEDS \
  { SYSTEM_PWR_LED, 35, 43, 1, 1, { 0x11, 0x00, 0x33, 0x01, 0x31, 0x03 } }, \
  { SYSTEM_ERR_LED, 66, 53, 0, 0, { 0x00, 0x11, 0x22, 0x10, 0x20, 0x12 } },

#endif
