/*-------------------------------------------------------------------------
   CE3 function copy right information

   Copyright (C) 2007-2008. Lin, Rongrong <woody@palmmicro.com>

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   This software is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-------------------------------------------------------------------------*/

#include "version.h"
#include "type.h"
#include "ar168.h"
#include "core.h"
#include "apps.h"

#ifdef OEM_IP20

// 74LS138 input: A-A4 B-A5 C-A7 output: Y0-ch1, Y1-ch2

void IP20_LedControl(UCHAR ch1, UCHAR ch2)
{
	PCHAR p;
	UCHAR iOrg;

	EnableCE3();
	iOrg = GetExtPage();
	SetExtPage(0x00);

	p = (PCHAR)BANK_BASE;			// A4 = 0 write ch1
	p[0] = ch1;
	p = (PCHAR)(BANK_BASE + 0x10);	// A4 = 1 write ch2
	p[0] = ch2;

	SetExtPage(iOrg);
	DisableCEx();
}
#endif
