h3600.c

来自「LUBBOCK板的BLOB」· C语言 代码 · 共 134 行

C
134
字号
/*
 * h3600.c: Ipaq H3600 specific stuff
 *
 * Copyright (C) 2001  Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
 *
 * $Id: h3600.c,v 1.5 2002/01/03 16:07:17 erikm Exp $
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#ident "$Id: h3600.c,v 1.5 2002/01/03 16:07:17 erikm Exp $"

#ifdef HAVE_CONFIG_H
# include <blob/config.h>
#endif

#include <blob/flash.h>
#include <blob/init.h>
#include <blob/serial.h>




/* taken from Linux include/asm-arm/arch-sa1100/h3600.h */
#define EGPIO_H3600_VPP_ON		(1 << 0)
#define EGPIO_H3600_RS232_ON		(1 << 7)  /* UART3 transceiver force on.  Active high. */


/* H3600 EGPIO register */
static u32 *EGPIO = (u32 *)0x49000000;

/* the EGPIO register is write only, so we need a shadow register to
 * remember the state
 */
static u32 shadow_egpio;




static void h3600_clr_egpio(u32 x)
{
	shadow_egpio &= ~x;
	*EGPIO = shadow_egpio;
}




static void h3600_set_egpio(u32 x)
{
	shadow_egpio |= x;
	*EGPIO = shadow_egpio;
}




/* flash descriptor for H3600 flash */
/* 2x Intel 28F640J3A (16MB) */
static flash_descriptor_t h3600_flash_descriptors[] =
{
	{
		size: 2 * 128 * 1024,
		num: 64,
		lockable: 1
	},
	{
		/* NULL block */
	},
};




static int h3600_flash_enable_vpp(void)
{
	h3600_set_egpio(EGPIO_H3600_VPP_ON);

	return 0;
}




static int h3600_flash_disable_vpp(void)
{
	h3600_clr_egpio(EGPIO_H3600_VPP_ON);

	return 0;
}




static void init_h3600_flash_driver(void)
{
	flash_descriptors = h3600_flash_descriptors;

	flash_driver = &intel32_flash_driver;

	flash_driver->enable_vpp = h3600_flash_enable_vpp;
	flash_driver->disable_vpp = h3600_flash_disable_vpp;
}

__initlist(init_h3600_flash_driver, INIT_LEVEL_DRIVER_SELECTION);



static void h3600_init_hardware(void)
{
	shadow_egpio = 0;

	/* enable RS232 tranceiver */
	h3600_set_egpio(EGPIO_H3600_RS232_ON);

	/* select serial driver */
	serial_driver = &sa11x0_serial_driver;
}

__initlist(h3600_init_hardware, INIT_LEVEL_DRIVER_SELECTION);

⌨️ 快捷键说明

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