1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-24 05:11:46 +02:00

[backfire] remove targets not (yet) supported in 10.03

git-svn-id: svn://svn.openwrt.org/openwrt/branches/backfire@20665 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nico 2010-04-03 01:52:48 +00:00
parent 1a417a0ab6
commit 3256895004
930 changed files with 0 additions and 386052 deletions

View File

@ -1,21 +0,0 @@
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
ARCH:=mips
BOARD:=amazon
BOARDNAME:=Infineon Amazon
FEATURES:=squashfs jffs2 broken
LINUX_VERSION:=2.6.30.10
include $(INCLUDE_DIR)/target.mk
define Target/Description
Build firmware images for Infineon Amazon boards
endef
$(eval $(call BuildTarget))

View File

@ -1,14 +0,0 @@
# Copyright (C) 2006 OpenWrt.org
config interface loopback
option ifname lo
option proto static
option ipaddr 127.0.0.1
option netmask 255.0.0.0
config interface lan
option ifname eth1
option type bridge
option proto static
option ipaddr 192.168.1.1
option netmask 255.255.255.0

View File

@ -1,152 +0,0 @@
CONFIG_32BIT=y
# CONFIG_64BIT is not set
CONFIG_ADM6996_SUPPORT=y
CONFIG_AMAZON_ASC_UART=y
CONFIG_AMAZON_MTD=y
CONFIG_AMAZON_NET_SW=y
CONFIG_AMAZON_PCI=y
CONFIG_AMAZON_WDT=y
CONFIG_AMAZON=y
# CONFIG_ARCH_HAS_ILOG2_U32 is not set
# CONFIG_ARCH_HAS_ILOG2_U64 is not set
CONFIG_ARCH_POPULATES_NODE_MAP=y
# CONFIG_ARCH_SUPPORTS_MSI is not set
CONFIG_ARCH_SUPPORTS_OPROFILE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
# CONFIG_BCM47XX is not set
# CONFIG_BINARY_PRINTF is not set
CONFIG_BITREVERSE=y
# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
CONFIG_CEVT_R4K_LIB=y
CONFIG_CEVT_R4K=y
CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2 init=/bin/sh"
CONFIG_CPU_BIG_ENDIAN=y
# CONFIG_CPU_CAVIUM_OCTEON is not set
CONFIG_CPU_HAS_LLSC=y
CONFIG_CPU_HAS_PREFETCH=y
CONFIG_CPU_HAS_SYNC=y
# CONFIG_CPU_LITTLE_ENDIAN is not set
# CONFIG_CPU_LOONGSON2 is not set
# CONFIG_CPU_MIPS32_R1 is not set
CONFIG_CPU_MIPS32_R2=y
CONFIG_CPU_MIPS32=y
# CONFIG_CPU_MIPS64_R1 is not set
# CONFIG_CPU_MIPS64_R2 is not set
CONFIG_CPU_MIPSR2=y
# CONFIG_CPU_NEVADA is not set
# CONFIG_CPU_R10000 is not set
# CONFIG_CPU_R3000 is not set
# CONFIG_CPU_R4300 is not set
# CONFIG_CPU_R4X00 is not set
# CONFIG_CPU_R5000 is not set
# CONFIG_CPU_R5432 is not set
# CONFIG_CPU_R5500 is not set
# CONFIG_CPU_R6000 is not set
# CONFIG_CPU_R8000 is not set
# CONFIG_CPU_RM7000 is not set
# CONFIG_CPU_RM9000 is not set
# CONFIG_CPU_SB1 is not set
CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
CONFIG_CPU_SUPPORTS_HIGHMEM=y
# CONFIG_CPU_TX39XX is not set
# CONFIG_CPU_TX49XX is not set
# CONFIG_CPU_VR41XX is not set
CONFIG_CSRC_R4K_LIB=y
CONFIG_CSRC_R4K=y
CONFIG_DECOMPRESS_LZMA=y
CONFIG_DEVPORT=y
# CONFIG_DM9000 is not set
CONFIG_DMA_NEED_PCI_MAP_STATE=y
CONFIG_DMA_NONCOHERENT=y
CONFIG_EARLY_PRINTK=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_GENERIC_FIND_LAST_BIT=y
CONFIG_GENERIC_FIND_NEXT_BIT=y
CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
CONFIG_HARDWARE_WATCHPOINTS=y
CONFIG_HAS_DMA=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAVE_ARCH_KGDB=y
# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
CONFIG_HAVE_IDE=y
CONFIG_HAVE_MLOCK=y
CONFIG_HAVE_OPROFILE=y
CONFIG_HAVE_STD_PC_SERIAL_PORT=y
CONFIG_HW_HAS_PCI=y
CONFIG_HW_RANDOM=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_IRQ_CPU=y
CONFIG_KALLSYMS=y
# CONFIG_LEMOTE_FULONG is not set
# CONFIG_MACH_ALCHEMY is not set
# CONFIG_MACH_DECSTATION is not set
# CONFIG_MACH_JAZZ is not set
# CONFIG_MACH_TX39XX is not set
# CONFIG_MACH_TX49XX is not set
# CONFIG_MACH_VR41XX is not set
# CONFIG_MIKROTIK_RB532 is not set
# CONFIG_MIPS_COBALT is not set
CONFIG_MIPS_L1_CACHE_SHIFT=5
# CONFIG_MIPS_MACHINE is not set
# CONFIG_MIPS_MALTA is not set
CONFIG_MIPS_MT_DISABLED=y
# CONFIG_MIPS_MT_SMP is not set
# CONFIG_MIPS_MT_SMTC is not set
# CONFIG_MIPS_SIM is not set
CONFIG_MIPS=y
CONFIG_MTD_AMAZON_BUS_WIDTH_16=y
# CONFIG_MTD_AMAZON_BUS_WIDTH_32 is not set
# CONFIG_MTD_AMAZON_BUS_WIDTH_8 is not set
# CONFIG_MTD_AMAZON_FLASH_SIZE_16 is not set
# CONFIG_MTD_AMAZON_FLASH_SIZE_2 is not set
CONFIG_MTD_AMAZON_FLASH_SIZE_4=y
# CONFIG_MTD_AMAZON_FLASH_SIZE_8 is not set
CONFIG_MTD_CFI_ADV_OPTIONS=y
# CONFIG_MTD_CFI_GEOMETRY is not set
# CONFIG_MTD_CFI_INTELEXT is not set
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-3
CONFIG_MTD_REDBOOT_PARTS=y
# CONFIG_NET_PCI is not set
# CONFIG_NO_IOPORT is not set
# CONFIG_NXP_STB220 is not set
# CONFIG_NXP_STB225 is not set
CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_PCI=y
CONFIG_PCI_DOMAINS=y
# CONFIG_PMC_MSP is not set
# CONFIG_PMC_YOSEMITE is not set
# CONFIG_PNX8550_JBS is not set
# CONFIG_PNX8550_STB810 is not set
# CONFIG_PROBE_INITRD_HEADER is not set
CONFIG_SCHED_OMIT_FRAME_POINTER=y
# CONFIG_SCSI_DMA is not set
# CONFIG_SERIAL_8250 is not set
# CONFIG_SGI_IP22 is not set
# CONFIG_SGI_IP27 is not set
# CONFIG_SGI_IP28 is not set
# CONFIG_SGI_IP32 is not set
# CONFIG_SIBYTE_BIGSUR is not set
# CONFIG_SIBYTE_CARMEL is not set
# CONFIG_SIBYTE_CRHINE is not set
# CONFIG_SIBYTE_CRHONE is not set
# CONFIG_SIBYTE_LITTLESUR is not set
# CONFIG_SIBYTE_RHONE is not set
# CONFIG_SIBYTE_SENTOSA is not set
# CONFIG_SIBYTE_SWARM is not set
# CONFIG_SLOW_WORK is not set
CONFIG_SWAP_IO_SPACE=y
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
CONFIG_SYS_HAS_CPU_MIPS32_R2=y
CONFIG_SYS_HAS_EARLY_PRINTK=y
CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
CONFIG_TRACING_SUPPORT=y
CONFIG_TRAD_SIGNALS=y
CONFIG_USB_SUPPORT=y
CONFIG_ZONE_DMA_FLAG=0

View File

@ -1,155 +0,0 @@
CONFIG_32BIT=y
# CONFIG_64BIT is not set
CONFIG_ADM6996_SUPPORT=y
# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
CONFIG_AMAZON_ASC_UART=y
CONFIG_AMAZON_MTD=y
CONFIG_AMAZON_NET_SW=y
CONFIG_AMAZON_PCI=y
CONFIG_AMAZON_WDT=y
CONFIG_AMAZON=y
# CONFIG_AR7 is not set
# CONFIG_ARCH_HAS_ILOG2_U32 is not set
# CONFIG_ARCH_HAS_ILOG2_U64 is not set
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_POPULATES_NODE_MAP=y
# CONFIG_ARCH_SUPPORTS_MSI is not set
CONFIG_ARCH_SUPPORTS_OPROFILE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
# CONFIG_BCM47XX is not set
# CONFIG_BCM63XX is not set
CONFIG_BITREVERSE=y
# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
CONFIG_CEVT_R4K_LIB=y
CONFIG_CEVT_R4K=y
CONFIG_CFG80211_DEFAULT_PS_VALUE=0
CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2 init=/bin/sh"
CONFIG_CPU_BIG_ENDIAN=y
# CONFIG_CPU_CAVIUM_OCTEON is not set
CONFIG_CPU_HAS_PREFETCH=y
CONFIG_CPU_HAS_SYNC=y
# CONFIG_CPU_LITTLE_ENDIAN is not set
# CONFIG_CPU_LOONGSON2E is not set
# CONFIG_CPU_MIPS32_R1 is not set
CONFIG_CPU_MIPS32_R2=y
CONFIG_CPU_MIPS32=y
# CONFIG_CPU_MIPS64_R1 is not set
# CONFIG_CPU_MIPS64_R2 is not set
CONFIG_CPU_MIPSR2=y
# CONFIG_CPU_NEVADA is not set
# CONFIG_CPU_R10000 is not set
# CONFIG_CPU_R3000 is not set
# CONFIG_CPU_R4300 is not set
# CONFIG_CPU_R4X00 is not set
# CONFIG_CPU_R5000 is not set
# CONFIG_CPU_R5432 is not set
# CONFIG_CPU_R5500 is not set
# CONFIG_CPU_R6000 is not set
# CONFIG_CPU_R8000 is not set
# CONFIG_CPU_RM7000 is not set
# CONFIG_CPU_RM9000 is not set
# CONFIG_CPU_SB1 is not set
CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
CONFIG_CPU_SUPPORTS_HIGHMEM=y
# CONFIG_CPU_TX39XX is not set
# CONFIG_CPU_TX49XX is not set
# CONFIG_CPU_VR41XX is not set
CONFIG_CSRC_R4K_LIB=y
CONFIG_CSRC_R4K=y
CONFIG_DECOMPRESS_LZMA=y
CONFIG_DEVPORT=y
# CONFIG_DM9000 is not set
CONFIG_DMA_NEED_PCI_MAP_STATE=y
CONFIG_DMA_NONCOHERENT=y
CONFIG_EARLY_PRINTK=y
# CONFIG_FSNOTIFY is not set
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_GENERIC_FIND_LAST_BIT=y
CONFIG_GENERIC_FIND_NEXT_BIT=y
CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
CONFIG_HARDWARE_WATCHPOINTS=y
CONFIG_HAS_DMA=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
CONFIG_HAVE_IDE=y
CONFIG_HAVE_OPROFILE=y
CONFIG_HAVE_STD_PC_SERIAL_PORT=y
CONFIG_HW_HAS_PCI=y
CONFIG_HW_RANDOM=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_IRQ_CPU=y
CONFIG_KALLSYMS=y
# CONFIG_MACH_ALCHEMY is not set
# CONFIG_MACH_DECSTATION is not set
# CONFIG_MACH_JAZZ is not set
# CONFIG_MACH_LOONGSON is not set
# CONFIG_MACH_TX39XX is not set
# CONFIG_MACH_TX49XX is not set
# CONFIG_MACH_VR41XX is not set
# CONFIG_MIKROTIK_RB532 is not set
# CONFIG_MIPS_COBALT is not set
CONFIG_MIPS_L1_CACHE_SHIFT=5
# CONFIG_MIPS_MACHINE is not set
# CONFIG_MIPS_MALTA is not set
CONFIG_MIPS_MT_DISABLED=y
# CONFIG_MIPS_MT_SMP is not set
# CONFIG_MIPS_MT_SMTC is not set
# CONFIG_MIPS_SIM is not set
CONFIG_MIPS=y
CONFIG_MTD_AMAZON_BUS_WIDTH_16=y
# CONFIG_MTD_AMAZON_BUS_WIDTH_32 is not set
# CONFIG_MTD_AMAZON_BUS_WIDTH_8 is not set
# CONFIG_MTD_AMAZON_FLASH_SIZE_16 is not set
# CONFIG_MTD_AMAZON_FLASH_SIZE_2 is not set
CONFIG_MTD_AMAZON_FLASH_SIZE_4=y
# CONFIG_MTD_AMAZON_FLASH_SIZE_8 is not set
CONFIG_MTD_CFI_ADV_OPTIONS=y
# CONFIG_MTD_CFI_GEOMETRY is not set
# CONFIG_MTD_CFI_INTELEXT is not set
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-3
CONFIG_MTD_REDBOOT_PARTS=y
# CONFIG_NET_PCI is not set
# CONFIG_NO_IOPORT is not set
# CONFIG_NXP_STB220 is not set
# CONFIG_NXP_STB225 is not set
CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_PCI=y
CONFIG_PCI_DOMAINS=y
# CONFIG_PMC_MSP is not set
# CONFIG_PMC_YOSEMITE is not set
# CONFIG_PNX8550_JBS is not set
# CONFIG_PNX8550_STB810 is not set
# CONFIG_PROBE_INITRD_HEADER is not set
CONFIG_SCHED_OMIT_FRAME_POINTER=y
# CONFIG_SCSI_DMA is not set
# CONFIG_SERIAL_8250 is not set
# CONFIG_SGI_IP22 is not set
# CONFIG_SGI_IP27 is not set
# CONFIG_SGI_IP28 is not set
# CONFIG_SGI_IP32 is not set
# CONFIG_SIBYTE_BIGSUR is not set
# CONFIG_SIBYTE_CARMEL is not set
# CONFIG_SIBYTE_CRHINE is not set
# CONFIG_SIBYTE_CRHONE is not set
# CONFIG_SIBYTE_LITTLESUR is not set
# CONFIG_SIBYTE_RHONE is not set
# CONFIG_SIBYTE_SENTOSA is not set
# CONFIG_SIBYTE_SWARM is not set
CONFIG_SWAP_IO_SPACE=y
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
CONFIG_SYS_HAS_CPU_MIPS32_R2=y
CONFIG_SYS_HAS_EARLY_PRINTK=y
CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
CONFIG_TRAD_SIGNALS=y
# CONFIG_TREE_PREEMPT_RCU is not set
CONFIG_TREE_RCU=y
CONFIG_USB_SUPPORT=y
CONFIG_ZONE_DMA_FLAG=0

View File

@ -1,67 +0,0 @@
# copyright 2007 john crispin <blogic@openwrt.org>
menu "Amazon built-in"
config AMAZON_ASC_UART
bool "Amazon asc uart"
select SERIAL_CORE
select SERIAL_CORE_CONSOLE
default y
config AMAZON_PCI
bool "Amazon PCI support"
default y
select HW_HAS_PCI
select PCI
config AMAZON_NET_SW
bool "Amazon network"
default y
config AMAZON_WDT
bool "Amazon watchdog timer"
default y
config AMAZON_MTD
bool "Amazon MTD map"
default y
config ADM6996_SUPPORT
bool "Amazon ADM6996 Switch driver"
default y
choice
prompt "Flash Size"
depends on AMAZON_MTD
config MTD_AMAZON_FLASH_SIZE_2
bool "2MB"
config MTD_AMAZON_FLASH_SIZE_4
bool "4MB"
config MTD_AMAZON_FLASH_SIZE_8
bool "8MB"
config MTD_AMAZON_FLASH_SIZE_16
bool "16MB"
endchoice
choice
prompt "Bus Width"
depends on AMAZON_MTD
config MTD_AMAZON_BUS_WIDTH_8
bool "8-bit"
config MTD_AMAZON_BUS_WIDTH_16
bool "16-bit"
config MTD_AMAZON_BUS_WIDTH_32
bool "32-bit"
endchoice
endmenu

View File

@ -1,9 +0,0 @@
#
# Copyright 2007 openwrt.org
# John Crispin <blogic@openwrt.org>
#
# Makefile for Infineon Amazon
#
obj-y := dma-core.o interrupt.o prom.o setup.o board.o
obj-$(CONFIG_PCI) += pci.o

View File

@ -1,69 +0,0 @@
/*
* 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.
*
* Copyright (C) 2009 Hauke Mehrtens <hauke@hauke-m.de>
*/
#include <linux/platform_device.h>
#include <asm/amazon/irq.h>
#define AMAZON_FLASH_START 0x13000000
#define AMAZON_FLASH_MAX 0x1000000
static struct platform_device amazon_mii = {
.id = 0,
.name = "amazon_mii0",
// .dev = {
// .platform_data = amazon_ethaddr,
// }
};
static struct platform_device amazon_wdt = {
.id = 0,
.name = "amazon_wdt",
};
static struct platform_device amazon_asc = {
.id = 0,
.name = "amazon_asc",
};
static struct resource amazon_mtd_resource = {
.start = AMAZON_FLASH_START,
.end = AMAZON_FLASH_START + AMAZON_FLASH_MAX - 1,
.flags = IORESOURCE_MEM,
};
static struct platform_device amazon_mtd = {
.id = 0,
.name = "amazon_mtd",
.num_resources = 1,
.resource = &amazon_mtd_resource,
};
struct platform_device *amazon_devs[] = {
&amazon_mii, &amazon_mtd, &amazon_wdt, &amazon_asc
};
int __init amazon_init_devices(void)
{
printk(KERN_INFO "");
return platform_add_devices(amazon_devs, 4);
}
arch_initcall(amazon_init_devices);

File diff suppressed because it is too large Load Diff

View File

@ -1,69 +0,0 @@
#ifndef DMA_CORE_H
#define DMA_CORE_H
#define AMAZON_DMA_REG32(reg_num) *((volatile u32*)(reg_num))
#define AMAZON_DMA_CH_STEP 4
#define COMB_ISR_RX_MASK 0xfe000000
#define COMB_ISR_TX_MASK 0x01f00000
#define DMA_OWN 1
#define CPU_OWN 0
#define DMA_MAJOR 250
//Descriptors
#define DMA_DESC_OWN_CPU 0x0
#define DMA_DESC_OWN_DMA 0x80000000
#define DMA_DESC_CPT_SET 0x40000000
#define DMA_DESC_SOP_SET 0x20000000
#define DMA_DESC_EOP_SET 0x10000000
#define switch_rx_chan_base 0
#define switch_tx_chan_base 7
#define switch2_rx_chan_base 2
#define switch2_tx_chan_base 8
#define TPE_rx_chan_base 4
#define TPE_tx_chan_base 9
#define DPLus2FPI_rx_chan_base 6
#define DPLus2FPI_tx_chan_base 11
#define RX_CHAN_NUM 7
#define TX_CHAN_NUM 5
#define CHAN_TOTAL_NUM (RX_CHAN_NUM+TX_CHAN_NUM)
#define DEFAULT_OFFSET 20
#define DESCRIPTOR_SIZE 8
typedef struct dev_list{
struct dma_device_info* dev;
int weight;
struct dev_list* prev;
struct dev_list* next;
}dev_list;
typedef struct channel_info{
char device_name[16];
int occupied;
enum attr_t attr;
int current_desc;
int weight;
int default_weight;
int desc_num;
int burst_len;
int desc_len;
int desc_ofst;
int packet_size;
int offset_from_base;
int control;
void* opt[DEFAULT_OFFSET];
u8* (*buffer_alloc)(int len,int* offset, void** opt);
int (*buffer_free)(u8* dataptr,void* opt);
int (*intr_handler)(struct dma_device_info* info,int status);
struct dma_device_info* dma_dev;
}channel_info;
#endif

View File

@ -1,192 +0,0 @@
/*
* Gary Jennejohn (C) 2003 <gj@denx.de>
* Copyright (C) 2007 Felix Fietkau <nbd@openwrt.org>
* Copyright (C) 2007 John Crispin <blogic@openwrt.org>
*
* This program is free software; you can distribute it and/or modify it
* under the terms of the GNU General Public License (Version 2) as
* published by the Free Software Foundation.
*
* This program is distributed in the hope 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.
*
* Routines for generic manipulation of the interrupts found on the
* AMAZON boards.
*/
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/kernel_stat.h>
#include <linux/module.h>
#include <asm/amazon/amazon.h>
#include <asm/amazon/irq.h>
#include <asm/bootinfo.h>
#include <asm/irq_cpu.h>
#include <asm/irq.h>
#include <asm/time.h>
static void amazon_disable_irq(unsigned int irq_nr)
{
int i;
u32 amazon_ier = AMAZON_ICU_IM0_IER;
if (irq_nr <= INT_NUM_IM0_IRL11 && irq_nr >= INT_NUM_IM0_IRL0)
amazon_writel(amazon_readl(amazon_ier) & (~(AMAZON_DMA_H_MASK)), amazon_ier);
else {
irq_nr -= INT_NUM_IRQ0;
for (i = 0; i <= 4; i++)
{
if (irq_nr <= 31)
amazon_writel(amazon_readl(amazon_ier) & ~(1 << irq_nr ), amazon_ier);
amazon_ier += 0x10;
irq_nr -= 32;
}
}
}
static void amazon_mask_and_ack_irq(unsigned int irq_nr)
{
int i;
u32 amazon_ier = AMAZON_ICU_IM0_IER;
u32 amazon_isr = AMAZON_ICU_IM0_ISR;
if (irq_nr <= INT_NUM_IM0_IRL11 && irq_nr >= INT_NUM_IM0_IRL0){
amazon_writel(amazon_readl(amazon_ier) & (~(AMAZON_DMA_H_MASK)), amazon_ier);
amazon_writel(AMAZON_DMA_H_MASK, amazon_isr);
} else {
irq_nr -= INT_NUM_IRQ0;
for (i = 0; i <= 4; i++)
{
if (irq_nr <= 31){
amazon_writel(amazon_readl(amazon_ier) & ~(1 << irq_nr ), amazon_ier);
amazon_writel((1 << irq_nr ), amazon_isr);
}
amazon_ier += 0x10;
amazon_isr += 0x10;
irq_nr -= 32;
}
}
}
static void amazon_enable_irq(unsigned int irq_nr)
{
int i;
u32 amazon_ier = AMAZON_ICU_IM0_IER;
if (irq_nr <= INT_NUM_IM0_IRL11 && irq_nr >= INT_NUM_IM0_IRL0)
amazon_writel(amazon_readl(amazon_ier) | AMAZON_DMA_H_MASK, amazon_ier);
else {
irq_nr -= INT_NUM_IRQ0;
for (i = 0; i <= 4; i++)
{
if (irq_nr <= 31)
amazon_writel(amazon_readl(amazon_ier) | (1 << irq_nr ), amazon_ier);
amazon_ier += 0x10;
irq_nr -= 32;
}
}
}
static unsigned int amazon_startup_irq(unsigned int irq)
{
amazon_enable_irq(irq);
return 0;
}
static void amazon_end_irq(unsigned int irq)
{
if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) {
amazon_enable_irq(irq);
}
}
static struct irq_chip amazon_irq_type = {
.name = "AMAZON",
.startup = amazon_startup_irq,
.enable = amazon_enable_irq,
.disable = amazon_disable_irq,
.unmask = amazon_enable_irq,
.ack = amazon_mask_and_ack_irq,
.mask = amazon_disable_irq,
.mask_ack = amazon_mask_and_ack_irq,
.end = amazon_end_irq
};
/* Cascaded interrupts from IM0-4 */
static inline void amazon_hw_irqdispatch(u8 line)
{
u32 irq;
irq = (amazon_readl(AMAZON_ICU_IM_VEC) >> (line * 5)) & AMAZON_ICU_IM0_VEC_MASK;
if (line == 0 && irq <= 11 && irq >= 0) {
//DMA fixed to IM0_IRL0
irq = 0;
}
do_IRQ(irq + INT_NUM_IRQ0 + (line * 32));
}
asmlinkage void plat_irq_dispatch(void)
{
unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
if (pending & CAUSEF_IP7){
do_IRQ(MIPS_CPU_TIMER_IRQ);
goto out;
} else {
unsigned int i;
for (i = 0; i <= 4; i++)
{
if(pending & (CAUSEF_IP2 << i)){
amazon_hw_irqdispatch(i);
goto out;
}
}
}
printk("Spurious IRQ: CAUSE=0x%08x\n", read_c0_status());
out:
return;
}
static struct irqaction cascade = {
.handler = no_action,
.flags = IRQF_DISABLED,
.name = "cascade",
};
void __init arch_init_irq(void)
{
int i;
/* mask all interrupt sources */
for(i = 0; i <= 4; i++){
amazon_writel(0, AMAZON_ICU_IM0_IER + (i * 0x10));
}
mips_cpu_irq_init();
/* set up irq cascade */
for (i = 2; i <= 6; i++) {
setup_irq(i, &cascade);
}
for (i = INT_NUM_IRQ0; i <= INT_NUM_IM4_IRL31; i++)
set_irq_chip_and_handler(i, &amazon_irq_type,
handle_level_irq);
set_c0_status(IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5);
}
void __cpuinit arch_fixup_c0_irqs(void)
{
/* FIXME: check for CPUID and only do fix for specific chips/versions */
cp0_compare_irq = CP0_LEGACY_COMPARE_IRQ;
cp0_perfcount_irq = CP0_LEGACY_PERFCNT_IRQ;
}

View File

@ -1,279 +0,0 @@
/*
* Carsten Langgaard, carstenl@mips.com
* Copyright (C) 1999, 2000 MIPS Technologies, Inc. All rights reserved.
* Copyright (C) 2007 Felix Fietkau <nbd@openwrt.org>
*
* This program is free software; you can distribute it and/or modify it
* under the terms of the GNU General Public License (Version 2) as
* published by the Free Software Foundation.
*
* This program is distributed in the hope 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.
*/
/* FIXME: convert nasty volatile register derefs to readl/writel calls */
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <asm/io.h>
#include <asm/paccess.h>
#include <asm/amazon/irq.h>
#include <asm/amazon/amazon.h>
#define AMAZON_PCI_REG32( addr ) (*(volatile u32 *)(addr))
#ifndef AMAZON_PCI_MEM_BASE
#define AMAZON_PCI_MEM_BASE 0xb2000000
#endif
#define AMAZON_PCI_MEM_SIZE 0x00400000
#define AMAZON_PCI_IO_BASE 0xb2400000
#define AMAZON_PCI_IO_SIZE 0x00200000
#define AMAZON_PCI_CFG_BUSNUM_SHF 16
#define AMAZON_PCI_CFG_DEVNUM_SHF 11
#define AMAZON_PCI_CFG_FUNNUM_SHF 8
#define PCI_ACCESS_READ 0
#define PCI_ACCESS_WRITE 1
static struct resource pci_io_resource = {
.name = "io pci IO space",
#if 1
.start = AMAZON_PCI_IO_BASE,
.end = AMAZON_PCI_IO_BASE + AMAZON_PCI_IO_SIZE - 1,
#else
.start = 0,
.end = 0x00002000 - 1,
#endif
.flags = IORESOURCE_IO
};
static struct resource pci_mem_resource = {
.name = "ext pci memory space",
.start = AMAZON_PCI_MEM_BASE,
.end = AMAZON_PCI_MEM_BASE + AMAZON_PCI_MEM_SIZE - 1,
.flags = IORESOURCE_MEM
};
static int amazon_pci_config_access(unsigned char access_type,
struct pci_bus *bus, unsigned int devfn, unsigned int where, u32 *data)
{
unsigned long flags;
u32 pci_addr;
u32 val;
int ret;
/* Amazon support slot from 0 to 15 */
/* devfn 0 & 0x20 is itself */
if ((bus->number != 0) || (devfn > 0x7f) || (devfn == 0) || (devfn == 0x20))
return 1;
local_irq_save(flags);
pci_addr = AMAZON_PCI_CFG_BASE |
bus->number << AMAZON_PCI_CFG_BUSNUM_SHF |
devfn << AMAZON_PCI_CFG_FUNNUM_SHF |
(where & ~0x3);
if (access_type == PCI_ACCESS_WRITE)
{
#ifdef CONFIG_SWAP_IO_SPACE
val = swab32(*data);
#endif
ret = put_dbe(val, (u32 *)pci_addr);
} else {
ret = get_dbe(val, (u32 *)pci_addr);
#ifdef CONFIG_SWAP_IO_SPACE
*data = swab32(val);
#else
*data = val;
#endif
}
amazon_writel(amazon_readl(PCI_MODE) & (~(1<<PCI_MODE_cfgok_bit)), PCI_MODE);
amazon_writel(amazon_readl(STATUS_COMMAND_ADDR), STATUS_COMMAND_ADDR);
amazon_writel(amazon_readl(PCI_MODE) | (~(1<<PCI_MODE_cfgok_bit)), PCI_MODE);
mb();
local_irq_restore(flags);
if (((*data) == 0xffffffff) && (access_type == PCI_ACCESS_READ))
return 1;
return ret;
}
static int amazon_pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val)
{
u32 data = 0;
if (amazon_pci_config_access(PCI_ACCESS_READ, bus, devfn, where, &data))
return PCIBIOS_DEVICE_NOT_FOUND;
if (size == 1)
*val = (data >> ((where & 3) << 3)) & 0xff;
else if (size == 2)
*val = (data >> ((where & 3) << 3)) & 0xffff;
else
*val = data;
return PCIBIOS_SUCCESSFUL;
}
static int amazon_pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val)
{
u32 data = 0;
if (size == 4)
{
data = val;
} else {
if (amazon_pci_config_access(PCI_ACCESS_READ, bus, devfn, where, &data))
return PCIBIOS_DEVICE_NOT_FOUND;
if (size == 1)
data = (data & ~(0xff << ((where & 3) << 3))) |
(val << ((where & 3) << 3));
else if (size == 2)
data = (data & ~(0xffff << ((where & 3) << 3))) |
(val << ((where & 3) << 3));
}
if (amazon_pci_config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data))
return PCIBIOS_DEVICE_NOT_FOUND;
return PCIBIOS_SUCCESSFUL;
}
static struct pci_ops amazon_pci_ops = {
amazon_pci_read,
amazon_pci_write
};
static struct pci_controller amazon_pci_controller = {
.pci_ops = &amazon_pci_ops,
.mem_resource = &pci_mem_resource,
.mem_offset = 0x00000000UL,
.io_resource = &pci_io_resource,
.io_offset = 0x00000000UL,
};
int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
{
switch (slot) {
case 13:
/* IDSEL = AD29 --> USB Host Controller */
return INT_NUM_IM2_IRL15;
case 14:
/* IDSEL = AD30 --> mini PCI connector */
return INT_NUM_IM2_IRL14;
default:
printk("Warning: no IRQ found for PCI device in slot %d, pin %d\n", slot, pin);
return 0;
}
}
int pcibios_plat_dev_init(struct pci_dev *dev)
{
switch(dev->irq) {
case INT_NUM_IM2_IRL15:
/*
* IDSEL = AD29 --> USB Host Controller
* PCI_INTA/B/C--GPIO Port0.2--EXIN3
* IN/ALT0:1 ALT1:0
* PULL UP
*/
(*AMAZON_GPIO_P0_DIR) = (*AMAZON_GPIO_P0_DIR) & 0xfffffffb;
(*AMAZON_GPIO_P0_ALTSEL0) = (*AMAZON_GPIO_P0_ALTSEL0)| 4;
(*AMAZON_GPIO_P0_ALTSEL1) = (*AMAZON_GPIO_P0_ALTSEL1)& 0xfffffffb;
(*AMAZON_GPIO_P0_PUDSEL) = (*AMAZON_GPIO_P0_PUDSEL) | 4;
(*AMAZON_GPIO_P0_PUDEN) = (*AMAZON_GPIO_P0_PUDEN) | 4;
//External Interrupt Node
(*AMAZON_ICU_EXTINTCR) = (*AMAZON_ICU_EXTINTCR)|0x6000; /* Low Level triggered */
(*AMAZON_ICU_IRNEN) = (*AMAZON_ICU_IRNEN)|0x8;
pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
break;
case INT_NUM_IM2_IRL14:
/*
* IDSEL = AD30 --> mini PCI connector
* PCI_INTA--GPIO Port0.1--EXIN2
* IN/ALT0:1 ALT1:0
* PULL UP
*/
(*AMAZON_GPIO_P0_DIR) = (*AMAZON_GPIO_P0_DIR) & 0xfffffffd;
(*AMAZON_GPIO_P0_ALTSEL0) = (*AMAZON_GPIO_P0_ALTSEL0)| 2;
(*AMAZON_GPIO_P0_ALTSEL1) = (*AMAZON_GPIO_P0_ALTSEL1)& 0xfffffffd;
(*AMAZON_GPIO_P0_PUDSEL) = (*AMAZON_GPIO_P0_PUDSEL) | 2;
(*AMAZON_GPIO_P0_PUDEN) = (*AMAZON_GPIO_P0_PUDEN) | 2;
//External Interrupt Node
(*AMAZON_ICU_EXTINTCR) = (*AMAZON_ICU_EXTINTCR)|0x600;
(*AMAZON_ICU_IRNEN) = (*AMAZON_ICU_IRNEN)|0x4;
pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
break;
default:
return 1;
}
return 0;
}
int __init amazon_pci_init(void)
{
u32 temp_buffer;
#ifdef CONFIG_SWAP_IO_SPACE
AMAZON_PCI_REG32(IRM) = AMAZON_PCI_REG32(IRM) | (1<<27) | (1<<28);
wmb();
#endif
AMAZON_PCI_REG32(CLOCK_CONTROL) = AMAZON_PCI_REG32(CLOCK_CONTROL) | (1<<ARB_CTRL_bit);
amazon_writel(amazon_readl(PCI_MODE) & (~(1<<PCI_MODE_cfgok_bit)), PCI_MODE);
AMAZON_PCI_REG32(STATUS_COMMAND_ADDR) = AMAZON_PCI_REG32(STATUS_COMMAND_ADDR) | (1<<BUS_MASTER_ENABLE_BIT) |(1<<MEM_SPACE_ENABLE_BIT);
temp_buffer = AMAZON_PCI_REG32(PCI_ARB_CTRL_STATUS_ADDR);
temp_buffer = temp_buffer | (1<< INTERNAL_ARB_ENABLE_BIT);
temp_buffer = temp_buffer & ~(3<< PCI_MASTER0_REQ_MASK_2BITS);
temp_buffer = temp_buffer & ~(3<< PCI_MASTER0_GNT_MASK_2BITS);
/* flash */
temp_buffer = temp_buffer & ~(3<< PCI_MASTER1_REQ_MASK_2BITS);
temp_buffer = temp_buffer & ~(3<< PCI_MASTER1_GNT_MASK_2BITS);
/* external master */
temp_buffer = temp_buffer & ~(3<< PCI_MASTER2_REQ_MASK_2BITS);
temp_buffer = temp_buffer & ~(3<< PCI_MASTER2_GNT_MASK_2BITS);
AMAZON_PCI_REG32(PCI_ARB_CTRL_STATUS_ADDR) = temp_buffer;
wmb();
AMAZON_PCI_REG32(FPI_ADDRESS_MAP_0) = 0xb2000000;
AMAZON_PCI_REG32(FPI_ADDRESS_MAP_1) = 0xb2100000;
AMAZON_PCI_REG32(FPI_ADDRESS_MAP_2) = 0xb2200000;
AMAZON_PCI_REG32(FPI_ADDRESS_MAP_3) = 0xb2300000;
AMAZON_PCI_REG32(FPI_ADDRESS_MAP_4) = 0xb2400000;
AMAZON_PCI_REG32(FPI_ADDRESS_MAP_5) = 0xb2500000;
AMAZON_PCI_REG32(FPI_ADDRESS_MAP_6) = 0xb2600000;
AMAZON_PCI_REG32(FPI_ADDRESS_MAP_7) = 0xb2700000;
AMAZON_PCI_REG32(BAR11_MASK) = 0x0c000008;
AMAZON_PCI_REG32(PCI_ADDRESS_MAP_11) = 0x0;
AMAZON_PCI_REG32(BAR1_ADDR) = 0x0;
amazon_writel(amazon_readl(PCI_MODE) | (~(1<<PCI_MODE_cfgok_bit)), PCI_MODE);
//use 8 dw burse length
AMAZON_PCI_REG32(FPI_BURST_LENGTH) = 0x303;
amazon_pci_controller.io_map_base = (unsigned long)ioremap(AMAZON_PCI_IO_BASE, AMAZON_PCI_IO_SIZE - 1);
register_pci_controller(&amazon_pci_controller);
return 0;
}
arch_initcall(amazon_pci_init);

View File

@ -1,72 +0,0 @@
/*
* 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.
*
* Copyright 2007 John Crispin <blogic@openwrt.org>
*/
#include <linux/init.h>
#include <linux/string.h>
#include <linux/ctype.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/bootmem.h>
#include <linux/ioport.h>
#include <asm/bootinfo.h>
#include <asm/amazon/amazon.h>
#include <asm/amazon/irq.h>
#include <asm/amazon/model.h>
#include <asm/cpu.h>
void prom_putchar(char c)
{
/* Wait for FIFO to empty */
while ((amazon_readl(AMAZON_ASC_FSTAT) >> 8) != 0x00) ;
/* Crude cr/nl handling is better than none */
if(c == '\n')
amazon_writel('\r', AMAZON_ASC_TBUF);
amazon_writel(c, AMAZON_ASC_TBUF);
}
void __init prom_init(void)
{
char **envp = (char **) fw_arg2;
int memsize = 16; /* assume 16M as default */
envp = (char **)KSEG1ADDR((unsigned long)envp);
while (*envp) {
char *e = (char *)KSEG1ADDR(*envp);
if (!strncmp(e, "memsize=", 8)) {
e += 8;
memsize = simple_strtoul(e, NULL, 10);
}
envp++;
}
memsize *= 1024 * 1024;
strcpy(&(arcs_cmdline[0]), "console=ttyS0,115200 rootfstype=squashfs,jffs2");
add_memory_region(0x00000000, memsize, BOOT_MEM_RAM);
}
void prom_free_prom_memory(void)
{
}
const char *get_system_type(void)
{
return BOARD_SYSTEM_TYPE;
}

View File

@ -1,193 +0,0 @@
/*
* Copyright (C) 2004 Peng Liu <peng.liu@infineon.com>
* Copyright (C) 2007 John Crispin <blogic@openwrt.org>
* Copyright (C) 2007 Felix Fietkau <nbd@openwrt.org>
*
* 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.
*
*/
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <asm/reboot.h>
#include <asm/system.h>
#include <asm/time.h>
#include <asm/cpu.h>
#include <asm/bootinfo.h>
#include <asm/irq.h>
#include <asm/mipsregs.h>
#include <asm/amazon/amazon.h>
#include <asm/amazon/irq.h>
#include <asm/amazon/model.h>
static unsigned int r4k_offset;
static unsigned int r4k_cur;
/* required in arch/mips/kernel/kspd.c */
unsigned long cpu_khz;
static void amazon_reboot_setup(void);
/* the CPU clock rate - lifted from u-boot */
unsigned int amazon_get_cpu_hz(void)
{
/*-----------------------------------*/
/**CGU CPU Clock Reduction Register***/
/*-----------------------------------*/
switch(amazon_readl(AMAZON_CGU_CPUCRD) & 0x3){
case 0:
/*divider ration 1/1, 235 MHz clock */
return 235000000;
case 1:
/*divider ration 2/3, 235 MHz clock, clock not accurate, here */
return 150000000;
case 2:
/*divider ration 1/2, 235 MHz clock */
return 117500000;
default:
/*divider ration 1/4, 235 MHz clock */
return 58750000;
}
}
/* the FPI clock rate - lifted from u-boot */
unsigned int amazon_get_fpi_hz(void)
{
unsigned int clkCPU;
clkCPU = amazon_get_cpu_hz();
/*-------------------------------------*/
/***CGU Clock Divider Select Register***/
/*-------------------------------------*/
switch (amazon_readl(AMAZON_CGU_DIV) & 0x3)
{
case 1:
return clkCPU >> 1;
case 2:
return clkCPU >> 2;
default:
return clkCPU;
/* '11' is reserved */
}
}
EXPORT_SYMBOL(amazon_get_fpi_hz);
/* this doesn't really belong here, but it's a convenient location */
unsigned int amazon_get_cpu_ver(void)
{
static unsigned int cpu_ver = 0;
if (cpu_ver == 0)
cpu_ver = amazon_readl(AMAZON_MCD_CHIPID) & 0xFFFFF000;
return cpu_ver;
}
static inline u32 amazon_get_counter_resolution(void)
{
u32 res;
__asm__ __volatile__(
".set push\n"
".set mips32r2\n"
".set noreorder\n"
"rdhwr %0, $3\n"
"ehb\n"
".set pop\n"
: "=&r" (res)
: /* no input */
: "memory");
instruction_hazard();
return res;
}
void __init plat_time_init(void)
{
mips_hpt_frequency = amazon_get_cpu_hz() / amazon_get_counter_resolution();
r4k_offset = mips_hpt_frequency / HZ;
printk("mips_hpt_frequency:%d\n", mips_hpt_frequency);
printk("r4k_offset: %08x(%d)\n", r4k_offset, r4k_offset);
r4k_cur = (read_c0_count() + r4k_offset);
write_c0_compare(r4k_cur);
/* enable the timer in the PMU */
amazon_writel(amazon_readl(AMAZON_PMU_PWDCR)| AMAZON_PMU_PWDCR_GPT|AMAZON_PMU_PWDCR_FPI, AMAZON_PMU_PWDCR);
/* setup the GPTU for timer tick f_fpi == f_gptu*/
amazon_writel(0x0100, AMAZON_GPTU_CLC);
amazon_writel(0xffff, AMAZON_GPTU_CAPREL);
amazon_writel(0x80C0, AMAZON_GPTU_T6CON);
}
void __init plat_mem_setup(void)
{
u32 chipid = 0;
u32 part_no = 0;
chipid = amazon_readl(AMAZON_MCD_CHIPID);
part_no = AMAZON_MCD_CHIPID_PART_NUMBER_GET(chipid);
if(part_no == AMAZON_CHIPID_YANGTSE){
printk("Yangtse Version\n");
} else if (part_no == AMAZON_CHIPID_STANDARD) {
printk(SYSTEM_MODEL_NAME "\n");
} else {
printk("unknown version %8x\n",part_no);
}
amazon_reboot_setup();
//stop reset TPE and DFE
amazon_writel(0, AMAZON_RST_REQ);
//clock
amazon_writel(0x3fff, AMAZON_PMU_PWDCR);
//reenable trace capability
part_no = readl(AMAZON_BCU_ECON);
ioport_resource.start = IOPORT_RESOURCE_START;
ioport_resource.end = IOPORT_RESOURCE_END;
iomem_resource.start = IOMEM_RESOURCE_START;
iomem_resource.end = IOMEM_RESOURCE_END;
}
static void amazon_machine_restart(char *command)
{
local_irq_disable();
amazon_writel(AMAZON_RST_ALL, AMAZON_RST_REQ);
for (;;) ;
}
static void amazon_machine_halt(void)
{
printk(KERN_NOTICE "System halted.\n");
local_irq_disable();
for (;;) ;
}
static void amazon_machine_power_off(void)
{
printk(KERN_NOTICE "Please turn off the power now.\n");
local_irq_disable();
for (;;) ;
}
static void amazon_reboot_setup(void)
{
_machine_restart = amazon_machine_restart;
_machine_halt = amazon_machine_halt;
pm_power_off = amazon_machine_power_off;
}

View File

@ -1,7 +0,0 @@
#ifndef __AMAZON_IRQ_H
#define __AMAZON_IRQ_H
#define NR_IRQS 256
#include_next <irq.h>
#endif

View File

@ -1,52 +0,0 @@
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2003, 2004 Ralf Baechle
*/
#ifndef __ASM_MACH_AMAZON_MANGLE_PORT_H
#define __ASM_MACH_AMAZON_MANGLE_PORT_H
#define __swizzle_addr_b(port) (port)
#define __swizzle_addr_w(port) ((port) ^ 2)
#define __swizzle_addr_l(port) (port)
#define __swizzle_addr_q(port) (port)
/*
* Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
* less sane hardware forces software to fiddle with this...
*
* Regardless, if the host bus endianness mismatches that of PCI/ISA, then
* you can't have the numerical value of data and byte addresses within
* multibyte quantities both preserved at the same time. Hence two
* variations of functions: non-prefixed ones that preserve the value
* and prefixed ones that preserve byte addresses. The latters are
* typically used for moving raw data between a peripheral and memory (cf.
* string I/O functions), hence the "__mem_" prefix.
*/
#if defined(CONFIG_SWAP_IO_SPACE)
# define ioswabb(a, x) (x)
# define __mem_ioswabb(a, x) (x)
# define ioswabw(a, x) le16_to_cpu(x)
# define __mem_ioswabw(a, x) (x)
# define ioswabl(a, x) le32_to_cpu(x)
# define __mem_ioswabl(a, x) (x)
# define ioswabq(a, x) le64_to_cpu(x)
# define __mem_ioswabq(a, x) (x)
#else
# define ioswabb(a, x) (x)
# define __mem_ioswabb(a, x) (x)
# define ioswabw(a, x) (x)
# define __mem_ioswabw(a, x) cpu_to_le16(x)
# define ioswabl(a, x) (x)
# define __mem_ioswabl(a, x) cpu_to_le32(x)
# define ioswabq(a, x) (x)
# define __mem_ioswabq(a, x) cpu_to_le32(x)
#endif
#endif /* __ASM_MACH_AMAZON_MANGLE_PORT_H */

View File

@ -1,24 +0,0 @@
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
*/
#ifndef __ASM_MIPS_MACH_AMAZON_WAR_H
#define __ASM_MIPS_MACH_AMAZON_WAR_H
#define R4600_V1_INDEX_ICACHEOP_WAR 0
#define R4600_V1_HIT_CACHEOP_WAR 0
#define R4600_V2_HIT_CACHEOP_WAR 0
#define R5432_CP0_INTERRUPT_WAR 0
#define BCM1250_M3_WAR 0
#define SIBYTE_1956_WAR 0
#define MIPS4K_ICACHE_REFILL_WAR 0
#define MIPS_CACHE_SYNC_WAR 0
#define TX49XX_ICACHE_INDEX_INV_WAR 0
#define RM9000_CDEX_SMP_WAR 0
#define ICACHE_REFILLS_WORKAROUND_WAR 0
#define R10000_LLSC_WAR 0
#define MIPS34K_MISSED_ITLB_WAR 0
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,204 +0,0 @@
/*
* Handle mapping of the flash memory access routines
* on Amazon based devices.
*
* Copyright(C) 2004 peng.liu@infineon.com
*
* This code is GPLed
*
*/
// 000005:fchang 2005/6/2 Modified by Bingtao to double check if the EBU is enabled/disabled
// 506231:tc.chen 2005/06/23 increase firmware partition size form 192KB to 256KB
// 050701:linmars 2005/07/01 fix flash size wrong alignment after increase firmware partition
// 165001:henryhsu 2005/8/18 Remove the support for Intel flash because of 2.1 not enough rootfs partition size
// 165001:henryhsu 2005/9/7 Rolback to support INtel flash
// 509071:tc.chen 2005/09/07 Reduced flash writing time
// 511046:linmars 2005/11/04 change bootloader size from 128 into 64
// 511241:linmars 2005/11/24 merge TaiChen's IRM patch
// copyright 2005 infineon
// copyright 2007 john crispin <blogic@openwrt.org>
// copyright 2007 felix fietkau <nbd@openwrt.org>
// copyright 2009 hauke mehrtens <hauke@hauke-m.de>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <asm/io.h>
#include <linux/init.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/cfi.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <asm/amazon/amazon.h>
#define AMAZON_PCI_ARB_CTL_ALT 0xb100205c
#define AMAZON_MTD_REG32( addr ) (*(volatile u32 *)(addr))
static struct map_info amazon_map = {
.name = "AMAZON_FLASH",
.bankwidth = 2,
};
static map_word amazon_read16(struct map_info * map, unsigned long ofs)
{
map_word temp;
ofs ^= 2;
temp.x[0] = *((__u16 *) (map->virt + ofs));
return temp;
}
static void amazon_write16(struct map_info *map, map_word d, unsigned long adr)
{
adr ^= 2;
*((__u16 *) (map->virt + adr)) = d.x[0];
}
void amazon_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
{
u8 *p;
u8 *to_8;
from = (unsigned long) (from + map->virt);
p = (u8 *) from;
to_8 = (u8 *) to;
while(len--){
*to_8++ = *p++;
}
}
void amazon_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
{
u8 *p = (u8*) from;
u8 *to_8;
to += (unsigned long) map->virt;
to_8 = (u8*)to;
while(len--){
*p++ = *to_8++;
}
}
#define UBOOT_SIZE 0x40000
static struct mtd_partition amazon_partitions[3] = {
{
name:"U-Boot", /* U-Boot firmware */
offset:0x00000000,
size:UBOOT_SIZE , /* 128k */
},
{
name:"kernel", /* firmware */
offset:UBOOT_SIZE,
size:0x00100000, /* 192K */
},
{
name:"rootfs", /* default partition */
offset:0x00200000,
size:0x00200000,
},
};
unsigned long uImage_size = 0x10000d;
int find_uImage_size(unsigned long start_offset)
{
unsigned long magic;
unsigned long temp;
amazon_copy_from(&amazon_map, &magic, start_offset, 4);
if (!(ntohl(magic) == 0x27051956)) {
printk(KERN_INFO "amazon_mtd: invalid magic (0x%08X) of kernel at 0x%08lx \n", ntohl(magic), start_offset);
return 0;
}
amazon_copy_from(&amazon_map, &temp, start_offset + 12, 4);
printk(KERN_INFO "amazon_mtd: kernel size is %ld \n", temp + 0x40);
return temp + 0x40;
}
static int __init amazon_mtd_probe(struct platform_device *dev)
{
unsigned long uimage_size;
struct mtd_info *mymtd = NULL;
struct mtd_partition *parts = NULL;
*AMAZON_EBU_BUSCON0 = 0x1d7ff;
amazon_map.read = amazon_read16;
amazon_map.write = amazon_write16;
amazon_map.copy_from = amazon_copy_from;
amazon_map.copy_to = amazon_copy_to;
amazon_map.phys = dev->resource->start;
amazon_map.size = dev->resource->end - amazon_map.phys + 1;
amazon_map.virt = ioremap_nocache(amazon_map.phys, amazon_map.size);
if (!amazon_map.virt) {
printk(KERN_WARNING "amazon_mtd: Failed to ioremap!\n");
return -EIO;
}
mymtd = (struct mtd_info *) do_map_probe("cfi_probe", &amazon_map);
if (!mymtd) {
iounmap(amazon_map.virt);
printk(KERN_WARNING "amazon_mtd: probing failed\n");
return -ENXIO;
}
mymtd->owner = THIS_MODULE;
parts = &amazon_partitions[0];
/* Some Samsung devices are containing a 16 MB flash chip with a bigger U-Boot partition. */
if(mymtd->size == 0x01000000 && mymtd->erasesize == 0x00020000) {
printk(KERN_INFO "amazon_mtd: Found big flash chip!\n");
amazon_partitions[0].size = 0x60000;
amazon_partitions[1].offset = 0x60000;
uimage_size = find_uImage_size(amazon_partitions[1].offset);
amazon_partitions[1].size = uimage_size;
amazon_partitions[2].offset = 0x60000 + uimage_size;
amazon_partitions[2].size = mymtd->size - amazon_partitions[2].offset - mymtd->erasesize;
} else {
printk(KERN_INFO "amazon_mtd: Found small flash chip!\n");
uimage_size = find_uImage_size(amazon_partitions[1].offset);
amazon_partitions[1].size = uimage_size;
amazon_partitions[2].offset = UBOOT_SIZE + uimage_size;
amazon_partitions[2].size = mymtd->size - amazon_partitions[2].offset - (2 * mymtd->erasesize);
}
add_mtd_partitions(mymtd, parts, 3);
printk(KERN_INFO "amazon_mtd: added %s flash with %dMB\n",
amazon_map.name, ((int)mymtd->size) >> 20);
return 0;
}
static struct platform_driver amazon_mtd_driver = {
.probe = amazon_mtd_probe,
.driver = {
.name = "amazon_mtd",
.owner = THIS_MODULE,
},
};
static int __init amazon_mtd_init(void)
{
int ret = platform_driver_register(&amazon_mtd_driver);
if (ret)
printk(KERN_WARNING "amazon_mtd: error registering platfom driver!\n");
return ret;
}
static void __exit amazon_mtd_cleanup(void)
{
platform_driver_unregister(&amazon_mtd_driver);
}
module_init(amazon_mtd_init);
module_exit(amazon_mtd_cleanup);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("john crispin blogic@openwrt.org");
MODULE_DESCRIPTION("MTD map driver for AMAZON boards");

File diff suppressed because it is too large Load Diff

View File

@ -1,899 +0,0 @@
/*
* 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.
*/
//-----------------------------------------------------------------------
/*
* Description:
* Driver for Infineon Amazon 3 port switch
*/
//-----------------------------------------------------------------------
/* Author: Wu Qi Ming[Qi-Ming.Wu@infineon.com]
* Created: 7-April-2004
*/
//-----------------------------------------------------------------------
/* History
* Changed on: Jun 28, 2004
* Changed by: peng.liu@infineon.com
* Reason: add hardware flow control (HFC) (CONFIG_NET_HW_FLOWCONTROL)
*
* Changed on: Apr 6, 2005
* Changed by: mars.lin@infineon.com
* Reason : supoort port identification
*/
// copyright 2004-2005 infineon.com
// copyright 2007 john crispin <blogic@openwrt.org>
// copyright 2007 felix fietkau <nbd@openwrt.org>
// copyright 2009 hauke mehrtens <hauke@hauke-m.de>
// TODO
// port vlan code from bcrm target... the tawainese code was scrapped due to crappyness
// check all the mmi reg settings and possibly document them better
// verify the ethtool code
// remove the while(1) stuff
// further clean up and rework ... but it works for now
// check the mode[]=bridge stuff
// verify that the ethaddr can be set from u-boot
#ifndef __KERNEL__
#define __KERNEL__
#endif
#if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS)
#define MODVERSIONS
#endif
#if defined(MODVERSIONS) && !defined(__GENKSYMS__)
#include <linux/modversions.h>
#endif
#include <linux/module.h>
#include <linux/string.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/mii.h>
#include <asm/uaccess.h>
#include <linux/in.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/skbuff.h>
#include <linux/in6.h>
#include <linux/proc_fs.h>
#include <linux/mm.h>
#include <linux/ethtool.h>
#include <asm/checksum.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <asm/amazon/amazon.h>
#include <asm/amazon/amazon_dma.h>
#include <asm/amazon/amazon_sw.h>
// how many mii ports are there ?
#define AMAZON_SW_INT_NO 2
#define ETHERNET_PACKET_DMA_BUFFER_SIZE 1536
/***************************************** Module Parameters *************************************/
char mode[] = "bridge";
module_param_array(mode, charp, NULL, 0);
static int timeout = 1 * HZ;
module_param(timeout, int, 0);
int switch_init(struct net_device *dev);
void switch_tx_timeout(struct net_device *dev);
static struct net_device *switch_devs[2];
int add_mac_table_entry(u64 entry_value)
{
int i;
u32 data1, data2;
AMAZON_SW_REG32(AMAZON_SW_ARL_CTL) = ~7;
for (i = 0; i < 32; i++) {
AMAZON_SW_REG32(AMAZON_SW_CPU_ACTL) = 0x80000000 | 0x20 | i;
while (AMAZON_SW_REG32(AMAZON_SW_CPU_ACTL) & (0x80000000)) {};
data1 = AMAZON_SW_REG32(AMAZON_SW_DATA1);
data2 = AMAZON_SW_REG32(AMAZON_SW_DATA2);
if ((data1 & (0x00700000)) != 0x00700000)
continue;
AMAZON_SW_REG32(AMAZON_SW_DATA1) = (u32) (entry_value >> 32);
AMAZON_SW_REG32(AMAZON_SW_DATA2) = (u32) entry_value & 0xffffffff;
AMAZON_SW_REG32(AMAZON_SW_CPU_ACTL) = 0xc0000020 | i;
while (AMAZON_SW_REG32(AMAZON_SW_CPU_ACTL) & (0x80000000)) {};
break;
}
AMAZON_SW_REG32(AMAZON_SW_ARL_CTL) |= 7;
if (i >= 32)
return -1;
return OK;
}
u64 read_mac_table_entry(int index)
{
u32 data1, data2;
u64 value;
AMAZON_SW_REG32(AMAZON_SW_CPU_ACTL) = 0x80000000 | 0x20 | index;
while (AMAZON_SW_REG32(AMAZON_SW_CPU_ACTL) & (0x80000000)) {};
data1 = AMAZON_SW_REG32(AMAZON_SW_DATA1) & 0xffffff;
data2 = AMAZON_SW_REG32(AMAZON_SW_DATA2);
value = (u64) data1 << 32 | (u64) data2;
return value;
}
int write_mac_table_entry(int index, u64 value)
{
u32 data1, data2;
data1 = (u32) (value >> 32);
data2 = (u32) value & 0xffffffff;
AMAZON_SW_REG32(AMAZON_SW_DATA1) = data1;
AMAZON_SW_REG32(AMAZON_SW_DATA2) = data2;
AMAZON_SW_REG32(AMAZON_SW_CPU_ACTL) = 0xc0000020 | index;
while (AMAZON_SW_REG32(AMAZON_SW_CPU_ACTL) & (0x80000000)) {};
return OK;
}
u32 get_mdio_reg(int phy_addr, int reg_num)
{
u32 value;
AMAZON_SW_REG32(AMAZON_SW_MDIO_ACC) = (3 << 30) | ((phy_addr & 0x1f) << 21) | ((reg_num & 0x1f) << 16);
while (AMAZON_SW_REG32(AMAZON_SW_MDIO_ACC) & (1 << 31)) {};
value = AMAZON_SW_REG32(AMAZON_SW_MDIO_ACC) & 0xffff;
return value;
}
int set_mdio_reg(int phy_addr, int reg_num, u32 value)
{
AMAZON_SW_REG32(AMAZON_SW_MDIO_ACC) = (2 << 30) | ((phy_addr & 0x1f) << 21) | ((reg_num & 0x1f) << 16) | (value & 0xffff);
while (AMAZON_SW_REG32(AMAZON_SW_MDIO_ACC) & (1 << 31)) {};
return OK;
}
int auto_negotiate(int phy_addr)
{
u32 value = 0;
value = get_mdio_reg(phy_addr, MDIO_BASE_CONTROL_REG);
set_mdio_reg(phy_addr, MDIO_BASE_CONTROL_REG, (value | RESTART_AUTO_NEGOTIATION | AUTO_NEGOTIATION_ENABLE | PHY_RESET));
return OK;
}
/*
In this version of switch driver, we split the dma channels for the switch.
2 for port0 and 2 for port1. So that we can do internal bridging if necessary.
In switch mode, packets coming in from port0 or port1 is able to do Destination
address lookup. Packets coming from port0 with destination address of port1 should
not go to pmac again. The switch hardware should be able to do the switch in the hard
ware level. Packets coming from the pmac should not do the DA look up in that the
desination is already known for the kernel. It only needs to go to the correct NIC to
find its way out.
*/
int amazon_sw_chip_init(void)
{
u32 tmp1;
int i = 0;
/* Aging tick select: 5mins */
tmp1 = 0xa0;
if (strcmp(mode, "bridge") == 0) {
// bridge mode, set militarised mode to 1, no learning!
tmp1 |= 0xC00;
} else {
// enable learning for P0 and P1,
tmp1 |= 3;
}
/* unknown broadcast/multicast/unicast to all ports */
AMAZON_SW_REG32(AMAZON_SW_UN_DEST) = 0x1ff;
AMAZON_SW_REG32(AMAZON_SW_ARL_CTL) = tmp1;
/* OCS:1 set OCS bit, split the two NIC in rx direction EDL:1 (enable DA lookup) */
#if defined(CONFIG_IFX_NFEXT_AMAZON_SWITCH_PHYPORT) || defined(CONFIG_IFX_NFEXT_AMAZON_SWITCH_PHYPORT_MODULE)
AMAZON_SW_REG32(AMAZON_SW_P2_PCTL) = 0x700;
#else
AMAZON_SW_REG32(AMAZON_SW_P2_PCTL) = 0x401;
#endif
/* EPC: 1 split the two NIC in tx direction CRC is generated */
AMAZON_SW_REG32(AMAZON_SW_P2_CTL) = 0x6;
// for bi-directional
AMAZON_SW_REG32(AMAZON_SW_P0_WM) = 0x14141412;
AMAZON_SW_REG32(AMAZON_SW_P1_WM) = 0x14141412;
AMAZON_SW_REG32(AMAZON_SW_P2_WM) = 0x28282826;
AMAZON_SW_REG32(AMAZON_SW_GBL_WM) = 0x0;
AMAZON_SW_REG32(AMAZON_CGU_PLL0SR) = (AMAZON_SW_REG32(AMAZON_CGU_PLL0SR)) | 0x58000000;
// clock for PHY
AMAZON_SW_REG32(AMAZON_CGU_IFCCR) = (AMAZON_SW_REG32(AMAZON_CGU_IFCCR)) | 0x80000004;
// enable power for PHY
AMAZON_SW_REG32(AMAZON_PMU_PWDCR) = (AMAZON_SW_REG32(AMAZON_PMU_PWDCR)) | AMAZON_PMU_PWDCR_EPHY;
// set reverse MII, enable MDIO statemachine
AMAZON_SW_REG32(AMAZON_SW_MDIO_CFG) = 0x800027bf;
while (1)
if (((AMAZON_SW_REG32(AMAZON_SW_MDIO_CFG)) & 0x80000000) == 0)
break;
AMAZON_SW_REG32(AMAZON_SW_EPHY) = 0xff;
// auto negotiation
AMAZON_SW_REG32(AMAZON_SW_MDIO_ACC) = 0x83e08000;
auto_negotiate(0x1f);
/* enable all ports */
AMAZON_SW_REG32(AMAZON_SW_PS_CTL) = 0x7;
for (i = 0; i < 32; i++)
write_mac_table_entry(i, 1 << 50);
return 0;
}
static unsigned char my_ethaddr[MAX_ADDR_LEN];
/* need to get the ether addr from u-boot */
static int __init ethaddr_setup(char *line)
{
char *ep;
int i;
memset(my_ethaddr, 0, MAX_ADDR_LEN);
for (i = 0; i < 6; i++) {
my_ethaddr[i] = line ? simple_strtoul(line, &ep, 16) : 0;
if (line)
line = (*ep) ? ep + 1 : ep;
}
printk(KERN_INFO "amazon_mii0: mac address %2x-%2x-%2x-%2x-%2x-%2x \n", my_ethaddr[0], my_ethaddr[1], my_ethaddr[2], my_ethaddr[3], my_ethaddr[4], my_ethaddr[5]);
return 0;
}
__setup("ethaddr=", ethaddr_setup);
static void open_rx_dma(struct net_device *dev)
{
struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev);
struct dma_device_info *dma_dev = priv->dma_device;
int i;
for (i = 0; i < dma_dev->num_rx_chan; i++)
dma_dev->rx_chan[i].control = 1;
dma_device_update_rx(dma_dev);
}
#ifdef CONFIG_NET_HW_FLOWCONTROL
static void close_rx_dma(struct net_device *dev)
{
struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev);
struct dma_device_info *dma_dev = priv->dma_device;
int i;
for (i = 0; i < dma_dev->num_rx_chan; i++)
dma_dev->rx_chan[i].control = 0;
dma_device_update_rx(dma_dev);
}
void amazon_xon(struct net_device *dev)
{
unsigned long flag;
local_irq_save(flag);
open_rx_dma(dev);
local_irq_restore(flag);
}
#endif
int switch_open(struct net_device *dev)
{
struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev);
if (!strcmp(dev->name, "eth1")) {
priv->mdio_phy_addr = PHY0_ADDR;
}
open_rx_dma(dev);
#ifdef CONFIG_NET_HW_FLOWCONTROL
if ((priv->fc_bit = netdev_register_fc(dev, amazon_xon)) == 0) {
printk(KERN_WARNING "amazon_mii0: Hardware Flow Control register fails\n");
}
#endif
netif_start_queue(dev);
return OK;
}
int switch_release(struct net_device *dev)
{
int i;
struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev);
struct dma_device_info *dma_dev = priv->dma_device;
for (i = 0; i < dma_dev->num_tx_chan; i++)
dma_dev->tx_chan[i].control = 0;
for (i = 0; i < dma_dev->num_rx_chan; i++)
dma_dev->rx_chan[i].control = 0;
dma_device_update(dma_dev);
#ifdef CONFIG_NET_HW_FLOWCONTROL
if (priv->fc_bit) {
netdev_unregister_fc(priv->fc_bit);
}
#endif
netif_stop_queue(dev);
return OK;
}
void switch_rx(struct net_device *dev, int len, struct sk_buff *skb)
{
struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev);
#ifdef CONFIG_NET_HW_FLOWCONTROL
int mit_sel = 0;
#endif
skb->dev = dev;
skb->protocol = eth_type_trans(skb, dev);
#ifdef CONFIG_NET_HW_FLOWCONTROL
mit_sel = netif_rx(skb);
switch (mit_sel) {
case NET_RX_SUCCESS:
case NET_RX_CN_LOW:
case NET_RX_CN_MOD:
break;
case NET_RX_CN_HIGH:
break;
case NET_RX_DROP:
if ((priv->fc_bit)
&& (!test_and_set_bit(priv->fc_bit, &netdev_fc_xoff))) {
close_rx_dma(dev);
}
break;
}
#else
netif_rx(skb);
#endif
priv->stats.rx_packets++;
priv->stats.rx_bytes += len;
return;
}
int asmlinkage switch_hw_tx(char *buf, int len, struct net_device *dev)
{
struct switch_priv *priv = netdev_priv(dev);
struct dma_device_info *dma_dev = priv->dma_device;
dma_dev->current_tx_chan = 0;
return dma_device_write(dma_dev, buf, len, priv->skb);
}
int asmlinkage switch_tx(struct sk_buff *skb, struct net_device *dev)
{
int len;
char *data;
struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev);
len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len;
data = skb->data;
priv->skb = skb;
dev->trans_start = jiffies;
if (switch_hw_tx(data, len, dev) != len) {
dev_kfree_skb_any(skb);
return OK;
}
priv->stats.tx_packets++;
priv->stats.tx_bytes += len;
return OK;
}
void switch_tx_timeout(struct net_device *dev)
{
struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev);
priv->stats.tx_errors++;
netif_wake_queue(dev);
return;
}
void negotiate(struct net_device *dev)
{
struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev);
unsigned short data = get_mdio_reg(priv->mdio_phy_addr, MDIO_ADVERTISMENT_REG);
data &= ~(MDIO_ADVERT_100_HD | MDIO_ADVERT_100_FD | MDIO_ADVERT_10_FD | MDIO_ADVERT_10_HD);
switch (priv->current_speed_selection) {
case 10:
if (priv->current_duplex == full)
data |= MDIO_ADVERT_10_FD;
else if (priv->current_duplex == half)
data |= MDIO_ADVERT_10_HD;
else
data |= MDIO_ADVERT_10_HD | MDIO_ADVERT_10_FD;
break;
case 100:
if (priv->current_duplex == full)
data |= MDIO_ADVERT_100_FD;
else if (priv->current_duplex == half)
data |= MDIO_ADVERT_100_HD;
else
data |= MDIO_ADVERT_100_HD | MDIO_ADVERT_100_FD;
break;
case 0: /* Auto */
if (priv->current_duplex == full)
data |= MDIO_ADVERT_100_FD | MDIO_ADVERT_10_FD;
else if (priv->current_duplex == half)
data |= MDIO_ADVERT_100_HD | MDIO_ADVERT_10_HD;
else
data |= MDIO_ADVERT_100_HD | MDIO_ADVERT_100_FD | MDIO_ADVERT_10_FD | MDIO_ADVERT_10_HD;
break;
default: /* assume autoneg speed and duplex */
data |= MDIO_ADVERT_100_HD | MDIO_ADVERT_100_FD | MDIO_ADVERT_10_FD | MDIO_ADVERT_10_HD;
}
set_mdio_reg(priv->mdio_phy_addr, MDIO_ADVERTISMENT_REG, data);
/* Renegotiate with link partner */
data = get_mdio_reg(priv->mdio_phy_addr, MDIO_BASE_CONTROL_REG);
data |= MDIO_BC_NEGOTIATE;
set_mdio_reg(priv->mdio_phy_addr, MDIO_BASE_CONTROL_REG, data);
}
void set_duplex(struct net_device *dev, enum duplex new_duplex)
{
struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev);
if (new_duplex != priv->current_duplex) {
priv->current_duplex = new_duplex;
negotiate(dev);
}
}
void set_speed(struct net_device *dev, unsigned long speed)
{
struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev);
priv->current_speed_selection = speed;
negotiate(dev);
}
static int switch_ethtool_ioctl(struct net_device *dev, struct ifreq *ifr)
{
struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev);
struct ethtool_cmd ecmd;
if (copy_from_user(&ecmd, ifr->ifr_data, sizeof(ecmd)))
return -EFAULT;
switch (ecmd.cmd) {
case ETHTOOL_GSET:
memset((void *) &ecmd, 0, sizeof(ecmd));
ecmd.supported = SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII | SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full |
SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full;
ecmd.port = PORT_TP;
ecmd.transceiver = XCVR_EXTERNAL;
ecmd.phy_address = priv->mdio_phy_addr;
ecmd.speed = priv->current_speed;
ecmd.duplex = priv->full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
ecmd.advertising = ADVERTISED_TP;
if (priv->current_duplex == autoneg && priv->current_speed_selection == 0)
ecmd.advertising |= ADVERTISED_Autoneg;
else {
ecmd.advertising |= ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full;
if (priv->current_speed_selection == 10)
ecmd.advertising &= ~(ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full);
else if (priv->current_speed_selection == 100)
ecmd.advertising &= ~(ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full);
if (priv->current_duplex == half)
ecmd.advertising &= ~(ADVERTISED_10baseT_Full | ADVERTISED_100baseT_Full);
else if (priv->current_duplex == full)
ecmd.advertising &= ~(ADVERTISED_10baseT_Half | ADVERTISED_100baseT_Half);
}
ecmd.autoneg = AUTONEG_ENABLE;
if (copy_to_user(ifr->ifr_data, &ecmd, sizeof(ecmd)))
return -EFAULT;
break;
case ETHTOOL_SSET:
if (!capable(CAP_NET_ADMIN)) {
return -EPERM;
}
if (ecmd.autoneg == AUTONEG_ENABLE) {
set_duplex(dev, autoneg);
set_speed(dev, 0);
} else {
set_duplex(dev, ecmd.duplex == DUPLEX_HALF ? half : full);
set_speed(dev, ecmd.speed == SPEED_10 ? 10 : 100);
}
break;
case ETHTOOL_GDRVINFO:
{
struct ethtool_drvinfo info;
memset((void *) &info, 0, sizeof(info));
strncpy(info.driver, "AMAZONE", sizeof(info.driver) - 1);
strncpy(info.fw_version, "N/A", sizeof(info.fw_version) - 1);
strncpy(info.bus_info, "N/A", sizeof(info.bus_info) - 1);
info.regdump_len = 0;
info.eedump_len = 0;
info.testinfo_len = 0;
if (copy_to_user(ifr->ifr_data, &info, sizeof(info)))
return -EFAULT;
}
break;
case ETHTOOL_NWAY_RST:
if (priv->current_duplex == autoneg && priv->current_speed_selection == 0)
negotiate(dev);
break;
default:
return -EOPNOTSUPP;
break;
}
return 0;
}
int mac_table_tools_ioctl(struct net_device *dev, struct mac_table_req *req)
{
int cmd;
int i;
cmd = req->cmd;
switch (cmd) {
case RESET_MAC_TABLE:
for (i = 0; i < 32; i++) {
write_mac_table_entry(i, 0);
}
break;
case READ_MAC_ENTRY:
req->entry_value = read_mac_table_entry(req->index);
break;
case WRITE_MAC_ENTRY:
write_mac_table_entry(req->index, req->entry_value);
break;
case ADD_MAC_ENTRY:
add_mac_table_entry(req->entry_value);
break;
default:
return -EINVAL;
}
return 0;
}
/*
the ioctl for the switch driver is developed in the conventional way
the control type falls into some basic categories, among them, the
SIOCETHTOOL is the traditional eth interface. VLAN_TOOLS and
MAC_TABLE_TOOLS are designed specifically for amazon chip. User
should be aware of the data structures used in these interfaces.
*/
int switch_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
struct data_req *switch_data_req = (struct data_req *) ifr->ifr_data;
struct mac_table_req *switch_mac_table_req;
switch (cmd) {
case SIOCETHTOOL:
switch_ethtool_ioctl(dev, ifr);
break;
case SIOCGMIIPHY: /* Get PHY address */
break;
case SIOCGMIIREG: /* Read MII register */
break;
case SIOCSMIIREG: /* Write MII register */
break;
case SET_ETH_SPEED_10: /* 10 Mbps */
break;
case SET_ETH_SPEED_100: /* 100 Mbps */
break;
case SET_ETH_SPEED_AUTO: /* Auto negotiate speed */
break;
case SET_ETH_DUPLEX_HALF: /* Half duplex. */
break;
case SET_ETH_DUPLEX_FULL: /* Full duplex. */
break;
case SET_ETH_DUPLEX_AUTO: /* Autonegotiate duplex */
break;
case SET_ETH_REG:
AMAZON_SW_REG32(switch_data_req->index) = switch_data_req->value;
break;
case MAC_TABLE_TOOLS:
switch_mac_table_req = (struct mac_table_req *) ifr->ifr_data;
mac_table_tools_ioctl(dev, switch_mac_table_req);
break;
default:
return -EINVAL;
}
return 0;
}
struct net_device_stats *switch_stats(struct net_device *dev)
{
struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev);
return &priv->stats;
}
int switch_change_mtu(struct net_device *dev, int new_mtu)
{
if (new_mtu >= 1516)
new_mtu = 1516;
dev->mtu = new_mtu;
return 0;
}
int switch_hw_receive(struct net_device *dev, struct dma_device_info *dma_dev)
{
u8 *buf = NULL;
int len = 0;
struct sk_buff *skb = NULL;
len = dma_device_read(dma_dev, &buf, (void **) &skb);
if (len >= 0x600) {
printk(KERN_WARNING "amazon_mii0: packet too large %d\n", len);
goto switch_hw_receive_err_exit;
}
/* remove CRC */
len -= 4;
if (skb == NULL) {
printk(KERN_WARNING "amazon_mii0: cannot restore pointer\n");
goto switch_hw_receive_err_exit;
}
if (len > (skb->end - skb->tail)) {
printk(KERN_WARNING "amazon_mii0: BUG, len:%d end:%p tail:%p\n", (len + 4), skb->end, skb->tail);
goto switch_hw_receive_err_exit;
}
skb_put(skb, len);
skb->dev = dev;
switch_rx(dev, len, skb);
return OK;
switch_hw_receive_err_exit:
if (skb)
dev_kfree_skb_any(skb);
return -EIO;
}
int dma_intr_handler(struct dma_device_info *dma_dev, int status)
{
struct net_device *dev;
dev = dma_dev->priv;
switch (status) {
case RCV_INT:
switch_hw_receive(dev, dma_dev);
break;
case TX_BUF_FULL_INT:
netif_stop_queue(dev);
break;
case TRANSMIT_CPT_INT:
netif_wake_queue(dev);
break;
}
return OK;
}
/* reserve 2 bytes in front of data pointer*/
u8 *dma_buffer_alloc(int len, int *byte_offset, void **opt)
{
u8 *buffer = NULL;
struct sk_buff *skb = NULL;
skb = dev_alloc_skb(ETHERNET_PACKET_DMA_BUFFER_SIZE);
if (skb == NULL) {
return NULL;
}
buffer = (u8 *) (skb->data);
skb_reserve(skb, 2);
*(int *) opt = (int) skb;
*byte_offset = 2;
return buffer;
}
int dma_buffer_free(u8 * dataptr, void *opt)
{
struct sk_buff *skb = NULL;
if (opt == NULL) {
kfree(dataptr);
} else {
skb = (struct sk_buff *) opt;
dev_kfree_skb_any(skb);
}
return OK;
}
int init_dma_device(_dma_device_info * dma_dev, struct net_device *dev)
{
int i;
int num_tx_chan, num_rx_chan;
if (strcmp(dma_dev->device_name, "switch1") == 0) {
num_tx_chan = 1;
num_rx_chan = 2;
} else {
num_tx_chan = 1;
num_rx_chan = 2;
}
dma_dev->priv = dev;
dma_dev->weight = 1;
dma_dev->num_tx_chan = num_tx_chan;
dma_dev->num_rx_chan = num_rx_chan;
dma_dev->ack = 1;
dma_dev->tx_burst_len = 4;
dma_dev->rx_burst_len = 4;
for (i = 0; i < dma_dev->num_tx_chan; i++) {
dma_dev->tx_chan[i].weight = QOS_DEFAULT_WGT;
dma_dev->tx_chan[i].desc_num = 10;
dma_dev->tx_chan[i].packet_size = 0;
dma_dev->tx_chan[i].control = 0;
}
for (i = 0; i < num_rx_chan; i++) {
dma_dev->rx_chan[i].weight = QOS_DEFAULT_WGT;
dma_dev->rx_chan[i].desc_num = 10;
dma_dev->rx_chan[i].packet_size = ETHERNET_PACKET_DMA_BUFFER_SIZE;
dma_dev->rx_chan[i].control = 0;
}
dma_dev->intr_handler = dma_intr_handler;
dma_dev->buffer_alloc = dma_buffer_alloc;
dma_dev->buffer_free = dma_buffer_free;
return 0;
}
int switch_set_mac_address(struct net_device *dev, void *p)
{
struct sockaddr *addr = p;
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
return OK;
}
static const struct net_device_ops amazon_mii_ops = {
.ndo_init = switch_init,
.ndo_open = switch_open,
.ndo_stop = switch_release,
.ndo_start_xmit = switch_tx,
.ndo_do_ioctl = switch_ioctl,
.ndo_get_stats = switch_stats,
.ndo_change_mtu = switch_change_mtu,
.ndo_set_mac_address = switch_set_mac_address,
.ndo_tx_timeout = switch_tx_timeout,
};
int switch_init(struct net_device *dev)
{
u64 retval = 0;
int i;
int result;
struct switch_priv *priv;
ether_setup(dev); /* assign some of the fields */
printk(KERN_INFO "amazon_mii0: %s up using ", dev->name);
dev->watchdog_timeo = timeout;
priv = netdev_priv(dev);
priv->dma_device = (struct dma_device_info *) kmalloc(sizeof(struct dma_device_info), GFP_KERNEL);
if (priv->num == 0) {
sprintf(priv->dma_device->device_name, "switch1");
} else if (priv->num == 1) {
sprintf(priv->dma_device->device_name, "switch2");
}
printk("\"%s\"\n", priv->dma_device->device_name);
init_dma_device(priv->dma_device, dev);
result = dma_device_register(priv->dma_device);
/* read the mac address from the mac table and put them into the mac table. */
for (i = 0; i < 6; i++) {
retval += my_ethaddr[i];
}
/* ethaddr not set in u-boot ? */
if (retval == 0) {
dev->dev_addr[0] = 0x00;
dev->dev_addr[1] = 0x20;
dev->dev_addr[2] = 0xda;
dev->dev_addr[3] = 0x86;
dev->dev_addr[4] = 0x23;
dev->dev_addr[5] = 0x74 + (unsigned char) priv->num;
} else {
for (i = 0; i < 6; i++) {
dev->dev_addr[i] = my_ethaddr[i];
}
dev->dev_addr[5] += +(unsigned char) priv->num;
}
return OK;
}
static int amazon_mii_probe(struct platform_device *dev)
{
int i = 0, result, device_present = 0;
struct switch_priv *priv;
for (i = 0; i < AMAZON_SW_INT_NO; i++) {
switch_devs[i] = alloc_etherdev(sizeof(struct switch_priv));
switch_devs[i]->netdev_ops = &amazon_mii_ops;
strcpy(switch_devs[i]->name, "eth%d");
priv = (struct switch_priv *) netdev_priv(switch_devs[i]);
priv->num = i;
if ((result = register_netdev(switch_devs[i])))
printk(KERN_WARNING "amazon_mii0: error %i registering device \"%s\"\n", result, switch_devs[i]->name);
else
device_present++;
}
amazon_sw_chip_init();
return device_present ? 0 : -ENODEV;
}
static int amazon_mii_remove(struct platform_device *dev)
{
int i;
struct switch_priv *priv;
for (i = 0; i < AMAZON_SW_INT_NO; i++) {
priv = netdev_priv(switch_devs[i]);
if (priv->dma_device) {
dma_device_unregister(priv->dma_device);
kfree(priv->dma_device);
}
kfree(netdev_priv(switch_devs[i]));
unregister_netdev(switch_devs[i]);
}
return 0;
}
static struct platform_driver amazon_mii_driver = {
.probe = amazon_mii_probe,
.remove = amazon_mii_remove,
.driver = {
.name = "amazon_mii0",
.owner = THIS_MODULE,
},
};
static int __init amazon_mii_init(void)
{
int ret = platform_driver_register(&amazon_mii_driver);
if (ret)
printk(KERN_WARNING "amazon_mii0: Error registering platfom driver!\n");
return ret;
}
static void __exit amazon_mii_cleanup(void)
{
platform_driver_unregister(&amazon_mii_driver);
}
module_init(amazon_mii_init);
module_exit(amazon_mii_cleanup);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Wu Qi Ming");
MODULE_DESCRIPTION("ethernet driver for AMAZON boards");

View File

@ -1,711 +0,0 @@
/*
* Driver for AMAZONASC serial ports
*
* Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
* Based on drivers/serial/serial_s3c2400.c
*
* 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
*
* Copyright (C) 2004 Infineon IFAP DC COM CPE
* Copyright (C) 2007 Felix Fietkau <nbd@openwrt.org>
* Copyright (C) 2007 John Crispin <blogic@openwrt.org>
*/
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/major.h>
#include <linux/string.h>
#include <linux/fcntl.h>
#include <linux/ptrace.h>
#include <linux/ioport.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/circ_buf.h>
#include <linux/serial.h>
#include <linux/serial_core.h>
#include <linux/console.h>
#include <linux/sysrq.h>
#include <linux/irq.h>
#include <linux/platform_device.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/bitops.h>
#include <asm/amazon/amazon.h>
#include <asm/amazon/irq.h>
#include <asm/amazon/serial.h>
#define PORT_AMAZONASC 111
#include <linux/serial_core.h>
#define UART_NR 1
#define UART_DUMMY_UER_RX 1
#define SERIAL_AMAZONASC_MAJOR TTY_MAJOR
#define CALLOUT_AMAZONASC_MAJOR TTYAUX_MAJOR
#define SERIAL_AMAZONASC_MINOR 64
#define SERIAL_AMAZONASC_NR UART_NR
static void amazonasc_tx_chars(struct uart_port *port);
static struct uart_port amazonasc_ports[UART_NR];
static struct uart_driver amazonasc_reg;
static unsigned int uartclk = 0;
static void amazonasc_stop_tx(struct uart_port *port)
{
/* fifo underrun shuts up after firing once */
return;
}
static void amazonasc_start_tx(struct uart_port *port)
{
unsigned long flags;
local_irq_save(flags);
amazonasc_tx_chars(port);
local_irq_restore(flags);
return;
}
static void amazonasc_stop_rx(struct uart_port *port)
{
/* clear the RX enable bit */
amazon_writel(ASCWHBCON_CLRREN, AMAZON_ASC_WHBCON);
}
static void amazonasc_enable_ms(struct uart_port *port)
{
/* no modem signals */
return;
}
#include <linux/version.h>
static void
amazonasc_rx_chars(struct uart_port *port)
{
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31))
struct tty_struct *tty = port->state->port.tty;
#else
struct tty_struct *tty = port->info->port.tty;
#endif
unsigned int ch = 0, rsr = 0, fifocnt;
fifocnt = amazon_readl(AMAZON_ASC_FSTAT) & ASCFSTAT_RXFFLMASK;
while (fifocnt--)
{
u8 flag = TTY_NORMAL;
ch = amazon_readl(AMAZON_ASC_RBUF);
rsr = (amazon_readl(AMAZON_ASC_CON) & ASCCON_ANY) | UART_DUMMY_UER_RX;
tty_flip_buffer_push(tty);
port->icount.rx++;
/*
* Note that the error handling code is
* out of the main execution path
*/
if (rsr & ASCCON_ANY) {
if (rsr & ASCCON_PE) {
port->icount.parity++;
amazon_writel_masked(AMAZON_ASC_WHBCON, ASCWHBCON_CLRPE, ASCWHBCON_CLRPE);
} else if (rsr & ASCCON_FE) {
port->icount.frame++;
amazon_writel_masked(AMAZON_ASC_WHBCON, ASCWHBCON_CLRFE, ASCWHBCON_CLRFE);
}
if (rsr & ASCCON_OE) {
port->icount.overrun++;
amazon_writel_masked(AMAZON_ASC_WHBCON, ASCWHBCON_CLROE, ASCWHBCON_CLROE);
}
rsr &= port->read_status_mask;
if (rsr & ASCCON_PE)
flag = TTY_PARITY;
else if (rsr & ASCCON_FE)
flag = TTY_FRAME;
}
if ((rsr & port->ignore_status_mask) == 0)
tty_insert_flip_char(tty, ch, flag);
if (rsr & ASCCON_OE)
/*
* Overrun is special, since it's reported
* immediately, and doesn't affect the current
* character
*/
tty_insert_flip_char(tty, 0, TTY_OVERRUN);
}
if (ch != 0)
tty_flip_buffer_push(tty);
return;
}
static void amazonasc_tx_chars(struct uart_port *port)
{
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31))
struct circ_buf *xmit = &port->state->xmit;
#else
struct circ_buf *xmit = &port->info->xmit;
#endif
if (uart_tx_stopped(port)) {
amazonasc_stop_tx(port);
return;
}
while (((amazon_readl(AMAZON_ASC_FSTAT) & ASCFSTAT_TXFFLMASK)
>> ASCFSTAT_TXFFLOFF) != AMAZONASC_TXFIFO_FULL)
{
if (port->x_char) {
amazon_writel(port->x_char, AMAZON_ASC_TBUF);
port->icount.tx++;
port->x_char = 0;
continue;
}
if (uart_circ_empty(xmit))
break;
amazon_writel(xmit->buf[xmit->tail], AMAZON_ASC_TBUF);
xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
port->icount.tx++;
}
if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
uart_write_wakeup(port);
}
static irqreturn_t amazonasc_tx_int(int irq, void *port)
{
amazon_writel(ASC_IRNCR_TIR, AMAZON_ASC_IRNCR1);
amazonasc_start_tx(port);
/* clear any pending interrupts */
amazon_writel_masked(AMAZON_ASC_WHBCON,
(ASCWHBCON_CLRPE | ASCWHBCON_CLRFE | ASCWHBCON_CLROE),
(ASCWHBCON_CLRPE | ASCWHBCON_CLRFE | ASCWHBCON_CLROE));
return IRQ_HANDLED;
}
static irqreturn_t amazonasc_er_int(int irq, void *port)
{
/* clear any pending interrupts */
amazon_writel_masked(AMAZON_ASC_WHBCON,
(ASCWHBCON_CLRPE | ASCWHBCON_CLRFE | ASCWHBCON_CLROE),
(ASCWHBCON_CLRPE | ASCWHBCON_CLRFE | ASCWHBCON_CLROE));
return IRQ_HANDLED;
}
static irqreturn_t amazonasc_rx_int(int irq, void *port)
{
amazon_writel(ASC_IRNCR_RIR, AMAZON_ASC_IRNCR1);
amazonasc_rx_chars((struct uart_port *) port);
return IRQ_HANDLED;
}
static u_int amazonasc_tx_empty(struct uart_port *port)
{
int status;
/*
* FSTAT tells exactly how many bytes are in the FIFO.
* The question is whether we really need to wait for all
* 16 bytes to be transmitted before reporting that the
* transmitter is empty.
*/
status = amazon_readl(AMAZON_ASC_FSTAT) & ASCFSTAT_TXFFLMASK;
return status ? 0 : TIOCSER_TEMT;
}
static u_int amazonasc_get_mctrl(struct uart_port *port)
{
/* no modem control signals - the readme says to pretend all are set */
return TIOCM_CTS|TIOCM_CAR|TIOCM_DSR;
}
static void amazonasc_set_mctrl(struct uart_port *port, u_int mctrl)
{
/* no modem control - just return */
return;
}
static void amazonasc_break_ctl(struct uart_port *port, int break_state)
{
/* no way to send a break */
return;
}
static int amazonasc_startup(struct uart_port *port)
{
unsigned int con = 0;
unsigned long flags;
int retval;
/* this assumes: CON.BRS = CON.FDE = 0 */
if (uartclk == 0)
uartclk = amazon_get_fpi_hz();
amazonasc_ports[0].uartclk = uartclk;
local_irq_save(flags);
/* this setup was probably already done in u-boot */
/* ASC and GPIO Port 1 bits 3 and 4 share the same pins
* P1.3 (RX) in, Alternate 10
* P1.4 (TX) in, Alternate 10
*/
amazon_writel_masked(AMAZON_GPIO_P1_DIR, 0x18, 0x10); //P1.4 output, P1.3 input
amazon_writel_masked(AMAZON_GPIO_P1_ALTSEL0, 0x18, 0x18); //ALTSETL0 11
amazon_writel_masked(AMAZON_GPIO_P1_ALTSEL1, 0x18, 0); //ALTSETL1 00
amazon_writel_masked(AMAZON_GPIO_P1_OD, 0x18, 0x10);
/* set up the CLC */
amazon_writel_masked(AMAZON_ASC_CLC, AMAZON_ASC_CLC_DISS, 0);
amazon_writel_masked(AMAZON_ASC_CLC, ASCCLC_RMCMASK, 1 << ASCCLC_RMCOFFSET);
/* asynchronous mode */
con = ASCCON_M_8ASYNC | ASCCON_FEN | ASCCON_OEN | ASCCON_PEN;
/* choose the line - there's only one */
amazon_writel(0, AMAZON_ASC_PISEL);
amazon_writel(((AMAZONASC_TXFIFO_FL << ASCTXFCON_TXFITLOFF) & ASCTXFCON_TXFITLMASK) | ASCTXFCON_TXFEN | ASCTXFCON_TXFFLU,
AMAZON_ASC_TXFCON);
amazon_writel(((AMAZONASC_RXFIFO_FL << ASCRXFCON_RXFITLOFF) & ASCRXFCON_RXFITLMASK) | ASCRXFCON_RXFEN | ASCRXFCON_RXFFLU,
AMAZON_ASC_RXFCON);
wmb();
amazon_writel_masked(AMAZON_ASC_CON, con, con);
retval = request_irq(AMAZONASC_RIR, amazonasc_rx_int, 0, "asc_rx", port);
if (retval){
printk("failed to request amazonasc_rx_int\n");
return retval;
}
retval = request_irq(AMAZONASC_TIR, amazonasc_tx_int, 0, "asc_tx", port);
if (retval){
printk("failed to request amazonasc_tx_int\n");
goto err1;
}
retval = request_irq(AMAZONASC_EIR, amazonasc_er_int, 0, "asc_er", port);
if (retval){
printk("failed to request amazonasc_er_int\n");
goto err2;
}
local_irq_restore(flags);
return 0;
err2:
free_irq(AMAZONASC_TIR, port);
err1:
free_irq(AMAZONASC_RIR, port);
local_irq_restore(flags);
return retval;
}
static void amazonasc_shutdown(struct uart_port *port)
{
free_irq(AMAZONASC_RIR, port);
free_irq(AMAZONASC_TIR, port);
free_irq(AMAZONASC_EIR, port);
/*
* disable the baudrate generator to disable the ASC
*/
amazon_writel(0, AMAZON_ASC_CON);
/* flush and then disable the fifos */
amazon_writel_masked(AMAZON_ASC_RXFCON, ASCRXFCON_RXFFLU, ASCRXFCON_RXFFLU);
amazon_writel_masked(AMAZON_ASC_RXFCON, ASCRXFCON_RXFEN, 0);
amazon_writel_masked(AMAZON_ASC_TXFCON, ASCTXFCON_TXFFLU, ASCTXFCON_TXFFLU);
amazon_writel_masked(AMAZON_ASC_TXFCON, ASCTXFCON_TXFEN, 0);
}
static void amazonasc_set_termios(struct uart_port *port, struct ktermios *new, struct ktermios *old)
{
unsigned int cflag;
unsigned int iflag;
unsigned int baud, quot;
unsigned int con = 0;
unsigned long flags;
cflag = new->c_cflag;
iflag = new->c_iflag;
/* byte size and parity */
switch (cflag & CSIZE) {
/* 7 bits are always with parity */
case CS7: con = ASCCON_M_7ASYNCPAR; break;
/* the ASC only suports 7 and 8 bits */
case CS5:
case CS6:
default:
if (cflag & PARENB)
con = ASCCON_M_8ASYNCPAR;
else
con = ASCCON_M_8ASYNC;
break;
}
if (cflag & CSTOPB)
con |= ASCCON_STP;
if (cflag & PARENB) {
if (!(cflag & PARODD))
con &= ~ASCCON_ODD;
else
con |= ASCCON_ODD;
}
port->read_status_mask = ASCCON_OE;
if (iflag & INPCK)
port->read_status_mask |= ASCCON_FE | ASCCON_PE;
port->ignore_status_mask = 0;
if (iflag & IGNPAR)
port->ignore_status_mask |= ASCCON_FE | ASCCON_PE;
if (iflag & IGNBRK) {
/*
* If we're ignoring parity and break indicators,
* ignore overruns too (for real raw support).
*/
if (iflag & IGNPAR)
port->ignore_status_mask |= ASCCON_OE;
}
/*
* Ignore all characters if CREAD is not set.
*/
if ((cflag & CREAD) == 0)
port->ignore_status_mask |= UART_DUMMY_UER_RX;
/* set error signals - framing, parity and overrun */
con |= ASCCON_FEN;
con |= ASCCON_OEN;
con |= ASCCON_PEN;
/* enable the receiver */
con |= ASCCON_REN;
/* block the IRQs */
local_irq_save(flags);
/* set up CON */
amazon_writel(con, AMAZON_ASC_CON);
/* Set baud rate - take a divider of 2 into account */
baud = uart_get_baud_rate(port, new, old, 0, port->uartclk/16);
quot = uart_get_divisor(port, baud);
quot = quot/2 - 1;
/* the next 3 probably already happened when we set CON above */
/* disable the baudrate generator */
amazon_writel_masked(AMAZON_ASC_CON, ASCCON_R, 0);
/* make sure the fractional divider is off */
amazon_writel_masked(AMAZON_ASC_CON, ASCCON_FDE, 0);
/* set up to use divisor of 2 */
amazon_writel_masked(AMAZON_ASC_CON, ASCCON_BRS, 0);
/* now we can write the new baudrate into the register */
amazon_writel(quot, AMAZON_ASC_BTR);
/* turn the baudrate generator back on */
amazon_writel_masked(AMAZON_ASC_CON, ASCCON_R, ASCCON_R);
local_irq_restore(flags);
}
static const char *amazonasc_type(struct uart_port *port)
{
return port->type == PORT_AMAZONASC ? "AMAZONASC" : NULL;
}
/*
* Release the memory region(s) being used by 'port'
*/
static void amazonasc_release_port(struct uart_port *port)
{
return;
}
/*
* Request the memory region(s) being used by 'port'
*/
static int amazonasc_request_port(struct uart_port *port)
{
return 0;
}
/*
* Configure/autoconfigure the port.
*/
static void amazonasc_config_port(struct uart_port *port, int flags)
{
if (flags & UART_CONFIG_TYPE) {
port->type = PORT_AMAZONASC;
amazonasc_request_port(port);
}
}
/*
* verify the new serial_struct (for TIOCSSERIAL).
*/
static int amazonasc_verify_port(struct uart_port *port, struct serial_struct *ser)
{
int ret = 0;
if (ser->type != PORT_UNKNOWN && ser->type != PORT_AMAZONASC)
ret = -EINVAL;
if (ser->irq < 0 || ser->irq >= NR_IRQS)
ret = -EINVAL;
if (ser->baud_base < 9600)
ret = -EINVAL;
return ret;
}
static struct uart_ops amazonasc_pops = {
.tx_empty = amazonasc_tx_empty,
.set_mctrl = amazonasc_set_mctrl,
.get_mctrl = amazonasc_get_mctrl,
.stop_tx = amazonasc_stop_tx,
.start_tx = amazonasc_start_tx,
.stop_rx = amazonasc_stop_rx,
.enable_ms = amazonasc_enable_ms,
.break_ctl = amazonasc_break_ctl,
.startup = amazonasc_startup,
.shutdown = amazonasc_shutdown,
.set_termios = amazonasc_set_termios,
.type = amazonasc_type,
.release_port = amazonasc_release_port,
.request_port = amazonasc_request_port,
.config_port = amazonasc_config_port,
.verify_port = amazonasc_verify_port,
};
static struct uart_port amazonasc_ports[UART_NR] = {
{
membase: (void *)AMAZON_ASC,
mapbase: AMAZON_ASC,
iotype: SERIAL_IO_MEM,
irq: AMAZONASC_RIR, /* RIR */
uartclk: 0, /* filled in dynamically */
fifosize: 16,
unused: { AMAZONASC_TIR, AMAZONASC_EIR}, /* xmit/error/xmit-buffer-empty IRQ */
type: PORT_AMAZONASC,
ops: &amazonasc_pops,
flags: ASYNC_BOOT_AUTOCONF,
},
};
static void amazonasc_console_write(struct console *co, const char *s, u_int count)
{
int i, fifocnt;
unsigned long flags;
local_irq_save(flags);
for (i = 0; i < count;)
{
/* wait until the FIFO is not full */
do
{
fifocnt = (amazon_readl(AMAZON_ASC_FSTAT) & ASCFSTAT_TXFFLMASK)
>> ASCFSTAT_TXFFLOFF;
} while (fifocnt == AMAZONASC_TXFIFO_FULL);
if (s[i] == '\0')
{
break;
}
if (s[i] == '\n')
{
amazon_writel('\r', AMAZON_ASC_TBUF);
do
{
fifocnt = (amazon_readl(AMAZON_ASC_FSTAT) &
ASCFSTAT_TXFFLMASK) >> ASCFSTAT_TXFFLOFF;
} while (fifocnt == AMAZONASC_TXFIFO_FULL);
}
amazon_writel(s[i], AMAZON_ASC_TBUF);
i++;
}
local_irq_restore(flags);
}
static void __init
amazonasc_console_get_options(struct uart_port *port, int *baud, int *parity, int *bits)
{
u_int lcr_h;
lcr_h = amazon_readl(AMAZON_ASC_CON);
/* do this only if the ASC is turned on */
if (lcr_h & ASCCON_R) {
u_int quot, div, fdiv, frac;
*parity = 'n';
if ((lcr_h & ASCCON_MODEMASK) == ASCCON_M_7ASYNCPAR ||
(lcr_h & ASCCON_MODEMASK) == ASCCON_M_8ASYNCPAR) {
if (lcr_h & ASCCON_ODD)
*parity = 'o';
else
*parity = 'e';
}
if ((lcr_h & ASCCON_MODEMASK) == ASCCON_M_7ASYNCPAR)
*bits = 7;
else
*bits = 8;
quot = amazon_readl(AMAZON_ASC_BTR) + 1;
/* this gets hairy if the fractional divider is used */
if (lcr_h & ASCCON_FDE)
{
div = 1;
fdiv = amazon_readl(AMAZON_ASC_FDV);
if (fdiv == 0)
fdiv = 512;
frac = 512;
}
else
{
div = lcr_h & ASCCON_BRS ? 3 : 2;
fdiv = frac = 1;
}
/*
* This doesn't work exactly because we use integer
* math to calculate baud which results in rounding
* errors when we try to go from quot -> baud !!
* Try to make this work for both the fractional divider
* and the simple divider. Also try to avoid rounding
* errors using integer math.
*/
*baud = frac * (port->uartclk / (div * 512 * 16 * quot));
if (*baud > 1100 && *baud < 2400)
*baud = 1200;
if (*baud > 2300 && *baud < 4800)
*baud = 2400;
if (*baud > 4700 && *baud < 9600)
*baud = 4800;
if (*baud > 9500 && *baud < 19200)
*baud = 9600;
if (*baud > 19000 && *baud < 38400)
*baud = 19200;
if (*baud > 38400 && *baud < 57600)
*baud = 38400;
if (*baud > 57600 && *baud < 115200)
*baud = 57600;
if (*baud > 115200 && *baud < 230400)
*baud = 115200;
}
}
static int __init amazonasc_console_setup(struct console *co, char *options)
{
struct uart_port *port;
int baud = 115200;
int bits = 8;
int parity = 'n';
int flow = 'n';
/* this assumes: CON.BRS = CON.FDE = 0 */
if (uartclk == 0)
uartclk = amazon_get_fpi_hz();
co->index = 0;
port = &amazonasc_ports[0];
amazonasc_ports[0].uartclk = uartclk;
amazonasc_ports[0].type = PORT_AMAZONASC;
if (options){
uart_parse_options(options, &baud, &parity, &bits, &flow);
}
return uart_set_options(port, co, baud, parity, bits, flow);
}
static struct uart_driver amazonasc_reg;
static struct console amazonasc_console = {
name: "ttyS",
write: amazonasc_console_write,
device: uart_console_device,
setup: amazonasc_console_setup,
flags: CON_PRINTBUFFER,
index: -1,
data: &amazonasc_reg,
};
static struct uart_driver amazonasc_reg = {
.owner = THIS_MODULE,
.driver_name = "serial",
.dev_name = "ttyS",
.major = TTY_MAJOR,
.minor = 64,
.nr = UART_NR,
.cons = &amazonasc_console,
};
static int __init amazon_asc_probe(struct platform_device *dev)
{
unsigned char res;
uart_register_driver(&amazonasc_reg);
res = uart_add_one_port(&amazonasc_reg, &amazonasc_ports[0]);
return res;
}
static int amazon_asc_remove(struct platform_device *dev)
{
uart_unregister_driver(&amazonasc_reg);
return 0;
}
static struct platform_driver amazon_asc_driver = {
.probe = amazon_asc_probe,
.remove = amazon_asc_remove,
.driver = {
.name = "amazon_asc",
.owner = THIS_MODULE,
},
};
static int __init amazon_asc_init(void)
{
int ret = platform_driver_register(&amazon_asc_driver);
if (ret)
printk(KERN_WARNING "amazon_asc: error registering platfom driver!\n");
return ret;
}
static void __exit amazon_asc_cleanup(void)
{
platform_driver_unregister(&amazon_asc_driver);
}
module_init(amazon_asc_init);
module_exit(amazon_asc_cleanup);
MODULE_AUTHOR("Gary Jennejohn, Felix Fietkau, John Crispin");
MODULE_DESCRIPTION("MIPS AMAZONASC serial port driver");
MODULE_LICENSE("GPL");

View File

@ -1,268 +0,0 @@
/*
* 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
*
* Copyright 2004 Wu Qi Ming <gokimi@msn.com>
* Copyright (C) 2007 John Crispin <blogic@openwrt.org>
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/fs.h>
#include <linux/errno.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/tty.h>
#include <linux/selection.h>
#include <linux/kmod.h>
#include <linux/vmalloc.h>
#include <linux/kdev_t.h>
#include <linux/ioctl.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <linux/platform_device.h>
#include <asm/amazon/amazon.h>
#include <asm/amazon/amazon_wdt.h>
#define DRV_NAME "AMAZON WDT:"
#undef AMAZON_WDT_DEBUG
static int amazon_wdt_isopen = 0;
#ifdef AMAZON_WDT_DEBUG
static struct proc_dir_entry* amazon_wdt_dir;
#endif
int wdt_enable(int timeout)
{
u32 hard_psw, ffpi;
int reload_value, divider = 1;
ffpi = amazon_get_fpi_hz();
reload_value = 65536 - timeout * ffpi / 256;
if (reload_value < 0) {
divider = 0;
reload_value = 65536 - timeout * ffpi / 16384;
}
if (reload_value < 0){
printk(KERN_INFO DRV_NAME "timeout too large %d\n", timeout);
return -EINVAL;
}
printk(KERN_INFO DRV_NAME "timeout:%d reload_value: %8x\n", timeout, reload_value);
hard_psw = (amazon_readl(AMAZON_WDT_CON0) & 0xffffff01) +
(amazon_readl(AMAZON_WDT_CON1) & 0xc) + 0xf0;
amazon_writel(hard_psw, AMAZON_WDT_CON0);
wmb();
amazon_writel((hard_psw & 0xff00) + (reload_value << 16) + 0xf2, AMAZON_WDT_CON0);
wmb();
amazon_writel(divider << 2, AMAZON_WDT_CON1);
wmb();
hard_psw = (amazon_readl(AMAZON_WDT_CON0) & 0xffffff01) +
(amazon_readl(AMAZON_WDT_CON1) & 0xc) + 0xf0;
amazon_writel(hard_psw, AMAZON_WDT_CON0);
wmb();
amazon_writel_masked(AMAZON_WDT_CON0, 0xff, 0xf3);
wmb();
return 0;
}
void wdt_disable(void)
{
u32 hard_psw = 0;
hard_psw = (amazon_readl(AMAZON_WDT_CON0) & 0xffffff01) +
(amazon_readl(AMAZON_WDT_CON1) & 0xc) + 0xf0;
amazon_writel(hard_psw, AMAZON_WDT_CON0);
wmb();
amazon_writel_masked(AMAZON_WDT_CON0, 0xff, 0xf2);
wmb();
amazon_writel_masked(AMAZON_WDT_CON1, 0x8, 0x8);
wmb();
hard_psw=(amazon_readl(AMAZON_WDT_CON0) & 0xffffff01) +
(amazon_readl(AMAZON_WDT_CON1) & 0xc) + 0xf0;
amazon_writel(hard_psw, AMAZON_WDT_CON0);
wmb();
amazon_writel_masked(AMAZON_WDT_CON0, 0xff, 0xf3);
wmb();
return;
}
static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
int result=0;
static int timeout=-1;
switch(cmd){
case AMAZON_WDT_IOC_START:
printk(KERN_INFO DRV_NAME "enable watch dog timer!\n");
if (copy_from_user((void*)&timeout, (void*)arg, sizeof (int))) {
printk(KERN_INFO DRV_NAME "invalid argument\n");
result=-EINVAL;
} else if ((result = wdt_enable(timeout)) < 0) {
timeout = -1;
}
break;
case AMAZON_WDT_IOC_STOP:
printk(KERN_INFO DRV_NAME "disable watch dog timer\n");
timeout = -1;
wdt_disable();
break;
case AMAZON_WDT_IOC_PING:
if (timeout < 0) {
result = -EIO;
} else {
result = wdt_enable(timeout);
}
break;
default:
result=-EINVAL;
break;
}
return result;
}
static ssize_t wdt_read(struct file *file, char *buf, size_t count, loff_t *offset)
{
return 0;
}
static ssize_t wdt_write(struct file *file, const char *buf, size_t count, loff_t *offset)
{
return count;
}
static int wdt_open(struct inode *inode, struct file *file)
{
if (amazon_wdt_isopen == 1)
return -EBUSY;
amazon_wdt_isopen = 1;
printk(KERN_INFO DRV_NAME "opened\n");
return 0;
}
static int wdt_release(struct inode *inode, struct file *file)
{
amazon_wdt_isopen = 0;
printk(KERN_INFO DRV_NAME "closed\n");
return 0;
}
#ifdef AMAZON_WDT_DEBUG
int wdt_register_proc_read(char *buf, char **start, off_t offset,
int count, int *eof, void *data)
{
int len=0;
len+=sprintf(buf+len,"NMISR: 0x%08x\n",AMAZON_WDT_REG32(AMAZON_WDT_NMISR));
len+=sprintf(buf+len,"RST_REQ: 0x%08x\n",AMAZON_WDT_REG32(AMAZON_RST_REQ));
len+=sprintf(buf+len,"RST_SR: 0x%08x\n",AMAZON_WDT_REG32(AMAZON_RST_SR));
len+=sprintf(buf+len,"WDT_CON0: 0x%08x\n",AMAZON_WDT_REG32(AMAZON_WDT_CON0));
len+=sprintf(buf+len,"WDT_CON1: 0x%08x\n",AMAZON_WDT_REG32(AMAZON_WDT_CON1));
len+=sprintf(buf+len,"WDT_SR: 0x%08x\n",AMAZON_WDT_REG32(AMAZON_WDT_SR));
*eof = 1;
return len;
}
#endif
static struct file_operations wdt_fops = {
read: wdt_read,
write: wdt_write,
ioctl: wdt_ioctl,
open: wdt_open,
release: wdt_release,
};
static int __init amazon_wdt_probe(struct platform_device *dev)
{
int result = result = register_chrdev(0, "watchdog", &wdt_fops);
if (result < 0) {
printk(KERN_INFO DRV_NAME "cannot register device\n");
return result;
}
#ifdef AMAZON_WDT_DEBUG
amazon_wdt_dir=proc_mkdir("amazon_wdt",NULL);
create_proc_read_entry("wdt_register", 0, amazon_wdt_dir,
wdt_register_proc_read, NULL);
#endif
amazon_wdt_isopen=0;
printk(KERN_INFO DRV_NAME "driver loaded but inactive\n");
return 0;
}
static int amazon_wdt_remove(struct platform_device *dev)
{
unregister_chrdev(0, "watchdog");
#ifdef AMAZON_WDT_DEBUG
remove_proc_entry("wdt_register", amazon_wdt_dir);
remove_proc_entry("amazon_wdt", NULL);
#endif
printk(KERN_INFO DRV_NAME "unregistered\n");
return 0;
}
static struct platform_driver amazon_wdt_driver = {
.probe = amazon_wdt_probe,
.remove = amazon_wdt_remove,
.driver = {
.name = "amazon_wdt",
.owner = THIS_MODULE,
},
};
static int __init amazon_wdt_init(void)
{
int ret = platform_driver_register(&amazon_wdt_driver);
if (ret)
printk(KERN_WARNING "amazon_wdt: error registering platfom driver!\n");
return ret;
}
static void __exit amazon_wdt_exit(void)
{
platform_driver_unregister(&amazon_wdt_driver);
}
module_init(amazon_wdt_init);
module_exit(amazon_wdt_exit);
MODULE_LICENSE ("GPL");
MODULE_AUTHOR("Infineon / John Crispin <blogic@openwrt.org>");
MODULE_DESCRIPTION("AMAZON WDT driver");

View File

@ -1,232 +0,0 @@
/******************************************************************************
Copyright (c) 2004, Infineon Technologies. All rights reserved.
No Warranty
Because the program is licensed free of charge, there is no warranty for
the program, to the extent permitted by applicable law. Except when
otherwise stated in writing the copyright holders and/or other parties
provide the program "as is" without warranty of any kind, either
expressed or implied, including, but not limited to, the implied
warranties of merchantability and fitness for a particular purpose. The
entire risk as to the quality and performance of the program is with
you. should the program prove defective, you assume the cost of all
necessary servicing, repair or correction.
In no event unless required by applicable law or agreed to in writing
will any copyright holder, or any other party who may modify and/or
redistribute the program as permitted above, be liable to you for
damages, including any general, special, incidental or consequential
damages arising out of the use or inability to use the program
(including but not limited to loss of data or data being rendered
inaccurate or losses sustained by you or third parties or a failure of
the program to operate with any other programs), even if such holder or
other party has been advised of the possibility of such damages.
******************************************************************************
Module : ifx_swdrv.h
Date : 2004-09-01
Description : JoeLin
Remarks:
*****************************************************************************/
#ifndef _ADM_6996_MODULE_H_
#define _ADM_6996_MODULE_H_
#include <asm/amazon/amazon.h>
#define ifx_printf(x) printk x
/* command codes */
#define ADM_SW_SMI_READ 0x02
#define ADM_SW_SMI_WRITE 0x01
#define ADM_SW_SMI_START 0x01
#define ADM_SW_EEPROM_WRITE 0x01
#define ADM_SW_EEPROM_WRITE_ENABLE 0x03
#define ADM_SW_EEPROM_WRITE_DISABLE 0x00
#define EEPROM_TYPE 8 /* for 93C66 */
/* bit masks */
#define ADM_SW_BIT_MASK_1 0x00000001
#define ADM_SW_BIT_MASK_2 0x00000002
#define ADM_SW_BIT_MASK_4 0x00000008
#define ADM_SW_BIT_MASK_10 0x00000200
#define ADM_SW_BIT_MASK_16 0x00008000
#define ADM_SW_BIT_MASK_32 0x80000000
/* delay timers */
#define ADM_SW_MDC_DOWN_DELAY 5
#define ADM_SW_MDC_UP_DELAY 5
#define ADM_SW_CS_DELAY 5
/* MDIO modes */
#define ADM_SW_MDIO_OUTPUT 1
#define ADM_SW_MDIO_INPUT 0
#define ADM_SW_MAX_PORT_NUM 5
#define ADM_SW_MAX_VLAN_NUM 15
/* registers */
#define ADM_SW_PORT0_CONF 0x1
#define ADM_SW_PORT1_CONF 0x3
#define ADM_SW_PORT2_CONF 0x5
#define ADM_SW_PORT3_CONF 0x7
#define ADM_SW_PORT4_CONF 0x8
#define ADM_SW_PORT5_CONF 0x9
#define ADM_SW_VLAN_MODE 0x11
#define ADM_SW_MAC_LOCK 0x12
#define ADM_SW_VLAN0_CONF 0x13
#define ADM_SW_PORT0_PVID 0x28
#define ADM_SW_PORT1_PVID 0x29
#define ADM_SW_PORT2_PVID 0x2a
#define ADM_SW_PORT34_PVID 0x2b
#define ADM_SW_PORT5_PVID 0x2c
#define ADM_SW_PHY_RESET 0x2f
#define ADM_SW_MISC_CONF 0x30
#define ADM_SW_BNDWDH_CTL0 0x31
#define ADM_SW_BNDWDH_CTL1 0x32
#define ADM_SW_BNDWDH_CTL_ENA 0x33
/* port modes */
#define ADM_SW_PORT_FLOWCTL 0x1 /* 802.3x flow control */
#define ADM_SW_PORT_AN 0x2 /* auto negotiation */
#define ADM_SW_PORT_100M 0x4 /* 100M */
#define ADM_SW_PORT_FULL 0x8 /* full duplex */
#define ADM_SW_PORT_TAG 0x10 /* output tag on */
#define ADM_SW_PORT_DISABLE 0x20 /* disable port */
#define ADM_SW_PORT_TOS 0x40 /* TOS first */
#define ADM_SW_PORT_PPRI 0x80 /* port based priority first */
#define ADM_SW_PORT_MDIX 0x8000 /* auto MDIX on */
#define ADM_SW_PORT_PVID_SHIFT 10
#define ADM_SW_PORT_PVID_BITS 4
/* VLAN */
#define ADM_SW_VLAN_PORT0 0x1
#define ADM_SW_VLAN_PORT1 0x2
#define ADM_SW_VLAN_PORT2 0x10
#define ADM_SW_VLAN_PORT3 0x40
#define ADM_SW_VLAN_PORT4 0x80
#define ADM_SW_VLAN_PORT5 0x100
/* GPIO 012 enabled, output mode */
#define GPIO_ENABLEBITS 0x000700f8
/*
define AMAZON GPIO port to ADM6996 EEPROM interface
MDIO -> EEDI GPIO 16, AMAZON GPIO P1.0, bi-direction
MDC -> EESK GPIO 17, AMAZON GPIO P1.1, output only
MDCS -> EECS GPIO 18, AMAZON GPIO P1.2, output only
EEDO GPIO 15, AMAZON GPIO P0.15, do not need this one! */
#define GPIO_MDIO 1 //P1.0
#define GPIO_MDC 2 //P1.1
#define GPIO_MDCS 4 //P1.2
//joelin #define GPIO_MDIO 0
//joelin #define GPIO_MDC 5 /* PORT 0 GPIO5 */
//joelin #define GPIO_MDCS 6 /* PORT 0 GPIO6 */
#define MDIO_INPUT 0x00000001
#define MDIO_OUTPUT_EN 0x00010000
/* type definitions */
typedef unsigned char U8;
typedef unsigned short U16;
typedef unsigned int U32;
typedef struct _REGRW_
{
unsigned int addr;
unsigned int value;
unsigned int mode;
}REGRW, *PREGRW;
//joelin adm6996i
typedef struct _MACENTRY_
{
unsigned char mac_addr[6];
unsigned long fid:4;
unsigned long portmap:6;
union {
unsigned long age_timer:9;
unsigned long info_ctrl:9;
} ctrl;
unsigned long occupy:1;
unsigned long info_type:1;
unsigned long bad:1;
unsigned long result:3;//000:command ok ,001:all entry used,010:Entry Not found ,011:try next entry ,101:command error
}MACENTRY, *PMACENTRY;
typedef struct _PROTOCOLFILTER_
{
int protocol_filter_num;//[0~7]
int ip_p; //Value Compared with Protocol in IP Heade[7:0]
char action:2;//Action for protocol Filter .
//00 = Protocol Portmap is Default Output Ports.
//01 = Protocol Portmap is 6'b0.
//10 = Protocol Portmap is the CPU port if the incoming port
//is not the CPU port. But if the incoming port is the CPU port, then Type Portmap contains Default Output Ports, excluding the CPU port.
}PROTOCOLFILTER, *PPROTOCOLFILTER;
//joelin adm6996i
/* Santosh: for IGMP proxy/snooping */
//050614:fchang int adm_process_mac_table_request (unsigned int cmd, struct _MACENTRY_ *mac);
//050614:fchang int adm_process_protocol_filter_request (unsigned int cmd, struct _PROTOCOLFILTER_ *filter);
/* IOCTL keys */
#define KEY_IOCTL_ADM_REGRW 0x01
#define KEY_IOCTL_ADM_SW_REGRW 0x02
#define KEY_IOCTL_ADM_SW_PORTSTS 0x03
#define KEY_IOCTL_ADM_SW_INIT 0x04
//for adm6996i-start
#define KEY_IOCTL_ADM_SW_IOCTL_MACENTRY_ADD 0x05
#define KEY_IOCTL_ADM_SW_IOCTL_MACENTRY_DEL 0x06
#define KEY_IOCTL_ADM_SW_IOCTL_MACENTRY_GET_INIT 0x07
#define KEY_IOCTL_ADM_SW_IOCTL_MACENTRY_GET_MORE 0x08
#define KEY_IOCTL_ADM_SW_IOCTL_FILTER_ADD 0x09
#define KEY_IOCTL_ADM_SW_IOCTL_FILTER_DEL 0x0a
#define KEY_IOCTL_ADM_SW_IOCTL_FILTER_GET 0x0b
//adm6996i #define KEY_IOCTL_MAX_KEY 0x05
#define KEY_IOCTL_MAX_KEY 0x0c
//for adm6996i-end
/* IOCTL MAGIC */
#define ADM_MAGIC ('a'|'d'|'m'|'t'|'e'|'k')
/* IOCTL parameters */
#define ADM_IOCTL_REGRW _IOWR(ADM_MAGIC, KEY_IOCTL_ADM_REGRW, REGRW)
#define ADM_SW_IOCTL_REGRW _IOWR(ADM_MAGIC, KEY_IOCTL_ADM_SW_REGRW, REGRW)
#define ADM_SW_IOCTL_PORTSTS _IOWR(ADM_MAGIC, KEY_IOCTL_ADM_SW_PORTSTS, NULL)
#define ADM_SW_IOCTL_INIT _IOWR(ADM_MAGIC, KEY_IOCTL_ADM_SW_INIT, NULL)
//6996i-stat
#define ADM_SW_IOCTL_MACENTRY_ADD _IOWR(ADM_MAGIC, KEY_IOCTL_ADM_SW_IOCTL_MACENTRY_ADD,MACENTRY)
#define ADM_SW_IOCTL_MACENTRY_DEL _IOWR(ADM_MAGIC, KEY_IOCTL_ADM_SW_IOCTL_MACENTRY_DEL,MACENTRY)
#define ADM_SW_IOCTL_MACENTRY_GET_INIT _IOWR(ADM_MAGIC, KEY_IOCTL_ADM_SW_IOCTL_MACENTRY_GET_INIT,MACENTRY)
#define ADM_SW_IOCTL_MACENTRY_GET_MORE _IOWR(ADM_MAGIC, KEY_IOCTL_ADM_SW_IOCTL_MACENTRY_GET_MORE,MACENTRY)
#define ADM_SW_IOCTL_FILTER_ADD _IOWR(ADM_MAGIC, KEY_IOCTL_ADM_SW_IOCTL_FILTER_ADD,PROTOCOLFILTER)
#define ADM_SW_IOCTL_FILTER_DEL _IOWR(ADM_MAGIC, KEY_IOCTL_ADM_SW_IOCTL_FILTER_DEL,PROTOCOLFILTER)
#define ADM_SW_IOCTL_FILTER_GET _IOWR(ADM_MAGIC, KEY_IOCTL_ADM_SW_IOCTL_FILTER_GET,PROTOCOLFILTER)
//6996i-end
#define REG_READ 0x0
#define REG_WRITE 0x1
/* undefine symbol */
#define AMAZON_SW_REG(reg) *((volatile U32*)(reg))
//#define GPIO0_INPUT_MASK 0
//#define GPIO_conf0_REG 0x12345678
//#define GPIO_SET_HI
//#define GPIO_SET_LOW
#endif
/* _ADM_6996_MODULE_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -1,148 +0,0 @@
#ifndef AMAZON_DMA_H
#define AMAZON_DMA_H
#define RCV_INT 1
#define TX_BUF_FULL_INT 2
#define TRANSMIT_CPT_INT 4
#define QOS_DEFAULT_WGT 0x7fffffffUL;
enum attr_t{
TX=0,
RX=1,
RESERVED=2,
DEFAULT=3,
};
#ifdef CONFIG_CPU_LITTLE_ENDIAN
typedef struct rx_desc{
u32 data_length:16;
volatile u32 reserved:7;
volatile u32 byte_offset:2;
volatile u32 Burst_length_offset:3;
volatile u32 EoP:1;
volatile u32 Res:1;
volatile u32 C:1;
volatile u32 OWN:1;
volatile u32 Data_Pointer;
/*fix me:should be 28 bits here, 32 bits just for host simulatiuon purpose*/
}_rx_desc;
typedef struct tx_desc{
volatile u32 data_length:16;
volatile u32 reserved1:7;
volatile u32 byte_offset:5;
volatile u32 EoP:1;
volatile u32 SoP:1;
volatile u32 C:1;
volatile u32 OWN:1;
volatile u32 Data_Pointer;//fix me:should be 28 bits here
}_tx_desc;
#else //BIG
typedef struct rx_desc{
union
{
struct
{
volatile u32 OWN :1;
volatile u32 C :1;
volatile u32 SoP :1;
volatile u32 EoP :1;
volatile u32 Burst_length_offset :3;
volatile u32 byte_offset :2;
volatile u32 reserve :7;
volatile u32 data_length :16;
}field;
volatile u32 word;
}status;
volatile u32 Data_Pointer;
}_rx_desc;
typedef struct tx_desc{
union
{
struct
{
volatile u32 OWN :1;
volatile u32 C :1;
volatile u32 SoP :1;
volatile u32 EoP :1;
volatile u32 byte_offset :5;
volatile u32 reserved :7;
volatile u32 data_length :16;
}field;
volatile u32 word;
}status;
volatile u32 Data_Pointer;
}_tx_desc;
#endif //ENDIAN
struct dma_channel_info{
/*filled by driver, optional*/
enum attr_t attr;/*TX or RX*/
int weight;
int desc_num;
int packet_size;
int control;/*on or off*/
int desc_base;
int status;
};
typedef struct dma_channel_info _dma_channel_info;
struct dma_device_info{
/*variables*/
/*filled by driver, compulsary*/
char device_name[15];
enum attr_t attr;/*default or else*/
int tx_burst_len;
int rx_burst_len;
int logic_rx_chan_base;
int logic_tx_chan_base;
u8 on_ch_bit;
/*filled by driver, optional*/
int weight;
int current_tx_chan;
int current_rx_chan;
int num_tx_chan;
int num_rx_chan;
struct dma_channel_info tx_chan[2];
struct dma_channel_info rx_chan[4];
/*functions, optional*/
u8* (*buffer_alloc)(int len,int* offset, void** opt);
int (*buffer_free)(u8* dataptr, void* opt);
int (*intr_handler)(struct dma_device_info* info, int status);
/*set by device, clear by dma*/
int ack;
void * priv; /* used by peripheral driver only */
};
typedef struct dma_device_info _dma_device_info;
int dma_device_register(struct dma_device_info* info);
int dma_device_unregister(struct dma_device_info* info);
int dma_device_read(struct dma_device_info* info, u8** dataptr, void** opt);
int dma_device_write(struct dma_device_info* info, u8* dataptr, int len, void* opt);
int dma_device_update(struct dma_device_info* info);
void dma_device_update_rx(struct dma_device_info* dma_dev);
void dma_device_update_tx(struct dma_device_info* dma_dev);
void register_handler_sim(int (*handler)(int));
#endif /* AMAZON_DMA_H */

View File

@ -1,220 +0,0 @@
#ifndef _AMAZON_MEI_H
#define _AMAZON_MEI_H
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "amazon_mei_app.h"
#define AMAZON_MEI_DEBUG_ON
#define AMAZON_MEI_CMV_EXTRA
#define AMAZON_MEI_MAJOR 106
/*
** Define where in ME Processor's memory map the Stratify chip lives
*/
#define MEI_SPACE_ACCESS 0xB0100C00
#define MAXSWAPSIZE 8 * 1024 //8k *(32bits)
//#define AMAZON_ADSL_IMAGESIZE 16*1024 // 16k * (32bits)
// Mailboxes
#define MSG_LENGTH 16 // x16 bits
#define YES_REPLY 1
#define NO_REPLY 0
#define CMV_TIMEOUT 100 //jiffies
#define MIB_INTERVAL 10000 //msec
/*** Bit definitions ***/
#define FALSE 0
#define TRUE 1
#define BIT0 1<<0
#define BIT1 1<<1
#define BIT2 1<<2
#define BIT3 1<<3
#define BIT4 1<<4
#define BIT5 1<<5
#define BIT6 1<<6
#define BIT7 1<<7
#define BIT8 1<<8
#define BIT9 1<<9
#define BIT10 1<<10
#define BIT11 1<<11
#define BIT12 1<<12
#define BIT13 1<<13
#define BIT14 1<<14
#define BIT15 1<<15
#define BIT16 1<<16
#define BIT17 1<<17
#define BIT18 1<<18
#define BIT19 1<<19
#define BIT20 1<<20
#define BIT21 1<<21
#define BIT22 1<<22
#define BIT23 1<<23
#define BIT24 1<<24
#define BIT25 1<<25
#define BIT26 1<<26
#define BIT27 1<<27
#define BIT28 1<<28
#define BIT29 1<<29
#define BIT30 1<<30
#define BIT31 1<<31
/*** Register address offsets, relative to MEI_SPACE_ADDRESS ***/
#define MEI_DATA_XFR (0x0000 + MEI_SPACE_ACCESS)
#define MEI_VERSION (0x0200 + MEI_SPACE_ACCESS)
#define ARC_GP_STAT (0x0204 + MEI_SPACE_ACCESS)
#define MEI_XFR_ADDR (0x020C + MEI_SPACE_ACCESS)
#define MEI_TO_ARC_INT (0x021C + MEI_SPACE_ACCESS)
#define ARC_TO_MEI_INT (0x0220 + MEI_SPACE_ACCESS)
#define ARC_TO_MEI_INT_MASK (0x0224 + MEI_SPACE_ACCESS)
#define MEI_DEBUG_WAD (0x0228 + MEI_SPACE_ACCESS)
#define MEI_DEBUG_RAD (0x022C + MEI_SPACE_ACCESS)
#define MEI_DEBUG_DATA (0x0230 + MEI_SPACE_ACCESS)
#define MEI_DEBUG_DEC (0x0234 + MEI_SPACE_ACCESS)
#define MEI_CONTROL (0x0238 + MEI_SPACE_ACCESS)
#define AT_CELLRDY_BC0 (0x023C + MEI_SPACE_ACCESS)
#define AT_CELLRDY_BC1 (0x0240 + MEI_SPACE_ACCESS)
#define AR_CELLRDY_BC0 (0x0244 + MEI_SPACE_ACCESS)
#define AR_CELLRDY_BC1 (0x0248 + MEI_SPACE_ACCESS)
#define AAI_ACCESS (0x024C + MEI_SPACE_ACCESS)
#define AAITXCB0 (0x0300 + MEI_SPACE_ACCESS)
#define AAITXCB1 (0x0304 + MEI_SPACE_ACCESS)
#define AAIRXCB0 (0x0308 + MEI_SPACE_ACCESS)
#define AAIRXCB1 (0x030C + MEI_SPACE_ACCESS)
// MEI_TO_ARC_INTERRUPT Register definitions
#define MEI_TO_ARC_INT1 BIT3
#define MEI_TO_ARC_INT0 BIT2
#define MEI_TO_ARC_CS_DONE BIT1
#define MEI_TO_ARC_MSGAV BIT0
// ARC_TO_MEI_INTERRUPT Register definitions
#define ARC_TO_MEI_INT1 BIT8
#define ARC_TO_MEI_INT0 BIT7
#define ARC_TO_MEI_CS_REQ BIT6
#define ARC_TO_MEI_DBG_DONE BIT5
#define ARC_TO_MEI_MSGACK BIT4
#define ARC_TO_MEI_NO_ACCESS BIT3
#define ARC_TO_MEI_CHECK_AAITX BIT2
#define ARC_TO_MEI_CHECK_AAIRX BIT1
#define ARC_TO_MEI_MSGAV BIT0
// ARC_TO_MEI_INTERRUPT_MASK Register definitions
#define GP_INT1_EN BIT8
#define GP_INT0_EN BIT7
#define CS_REQ_EN BIT6
#define DBG_DONE_EN BIT5
#define MSGACK_EN BIT4
#define NO_ACC_EN BIT3
#define AAITX_EN BIT2
#define AAIRX_EN BIT1
#define MSGAV_EN BIT0
// MEI_CONTROL Register definitions
#define INT_LEVEL BIT2
#define SOFT_RESET BIT1
#define HOST_MSTR BIT0
// MEI_DEBUG_DECODE Register definitions
#define MEI_DEBUG_DEC_MASK (0x3)
#define MEI_DEBUG_DEC_AUX_MASK (0x0)
#define MEI_DEBUG_DEC_DMP1_MASK (0x1)
#define MEI_DEBUG_DEC_DMP2_MASK (0x2)
#define MEI_DEBUG_DEC_CORE_MASK (0x3)
// ARC_TO_MEI_MAILBOX[11] is a special location used to indicate
// page swap requests.
#define MEI_TO_ARC_MAILBOX (0x15FC0)
#define MEI_TO_ARC_MAILBOXR (0x15FEC)
#define ARC_TO_MEI_MAILBOX (0x15F90)
#define ARC_MEI_MAILBOXR (0x15FBC)
// Codeswap request messages are indicated by setting BIT31
#define OMB_CODESWAP_MESSAGE_MSG_TYPE_MASK (0x80000000)
/*
** Swap page header
*/
// Page must be loaded at boot time if size field has BIT31 set
#define BOOT_FLAG (BIT31)
#define BOOT_FLAG_MASK ~BOOT_FLAG
// Swap page header describes size in 32-bit words, load location, and image offset
// for program and/or data segments
typedef struct _arc_swp_page_hdr
{
u32 p_offset; // Offset bytes of progseg from beginning of image
u32 p_dest; // Destination addr of progseg on processor
u32 p_size; // Size in 32-bitwords of program segment
u32 d_offset; // Offset bytes of dataseg from beginning of image
u32 d_dest; // Destination addr of dataseg on processor
u32 d_size; // Size in 32-bitwords of data segment
}ARC_SWP_PAGE_HDR;
/*
** Swap image header
*/
#define GET_PROG 0 // Flag used for program mem segment
#define GET_DATA 1 // Flag used for data mem segment
// Image header contains size of image, checksum for image, and count of
// page headers. Following that are 'count' page headers followed by
// the code and/or data segments to be loaded
typedef struct _arc_img_hdr
{
u32 size; // Size of binary image in bytes
u32 checksum; // Checksum for image
u32 count; // Count of swp pages in image
ARC_SWP_PAGE_HDR page[1]; // Should be "count" pages - '1' to make compiler happy
}ARC_IMG_HDR;
/*
** Native size for the Stratiphy interface is 32-bits. All reads and writes
** MUST be aligned on 32-bit boundaries. Trickery must be invoked to read word and/or
** byte data. Read routines are provided. Write routines are probably a bad idea, as the
** Arc has unrestrained, unseen access to the same memory, so a read-modify-write cycle
** could very well have unintended results.
*/
MEI_ERROR meiCMV(u16 *, int); // first arg is CMV to ARC, second to indicate whether need reply
void meiLongwordWrite(u32 ul_address, u32 ul_data);
void meiLongwordRead(u32 ul_address, u32 *pul_data);
MEI_ERROR meiDMAWrite(u32 destaddr, u32 *databuff, u32 databuffsize);
MEI_ERROR meiDebugWrite(u32 destaddr, u32 *databuff, u32 databuffsize);
MEI_ERROR meiDMARead(u32 srcaddr, u32 *databuff, u32 databuffsize);
MEI_ERROR meiDebugRead(u32 srcaddr, u32 *databuff, u32 databuffsize);
void meiPollForDbgDone(void);
void meiMailboxInterruptsDisable(void);
void meiMailboxInterruptsEnable(void);
MEI_ERROR meiMailboxWrite(u16 *msgsrcbuffer, u16 msgsize);
MEI_ERROR meiMailboxRead(u16 *msgdestbuffer, u16 msgsize);
int meiGetPage( u32 Page, u32 data, u32 MaxSize, u32 *Buffer, u32 *Dest);
MEI_ERROR meiHaltArc(void);
MEI_ERROR meiRunArc(void);
MEI_ERROR meiDownloadBootCode(void);
MEI_ERROR meiForceRebootAdslModem(void);
void makeCMV(u8 opcode, u8 group, u16 address, u16 index, int size, u16 * data);
#endif

View File

@ -1,54 +0,0 @@
//509221:tc.chen 2005/09/22 Reset DFE added when MEI_TO_ARC_CS_DONE not cleared by ARC and Added AMAZON_MEI_DEBUG_MODE ioctl
#ifndef _AMAZON_MEI_APP_H
#define _AMAZON_MEI_APP_H
/////////////////////////////////////////////////////////////////////////////////////////////////////
// ioctl control
#define AMAZON_MEI_START 300
#define AMAZON_MEI_REPLY 301
#define AMAZON_MEI_NOREPLY 302
#define AMAZON_MEI_RESET 303
#define AMAZON_MEI_REBOOT 304
#define AMAZON_MEI_HALT 305
#define AMAZON_MEI_CMV_WINHOST 306
#define AMAZON_MEI_CMV_READ 307
#define AMAZON_MEI_CMV_WRITE 308
#define AMAZON_MEI_MIB_DAEMON 309
#define AMAZON_MEI_SHOWTIME 310
#define AMAZON_MEI_REMOTE 311
#define AMAZON_MEI_READDEBUG 312
#define AMAZON_MEI_WRITEDEBUG 313
#define AMAZON_MEI_LOP 314
#define AMAZON_MEI_PCM_SETUP 315
#define AMAZON_MEI_PCM_START_TIMER 316
#define AMAZON_MEI_PCM_STOP_TIMER 317
#define AMAZON_MEI_PCM_CHECK 318
#define AMAZON_MEI_GET_EOC_LEN 319
#define AMAZON_MEI_GET_EOC_DATA 320
#define AMAZON_MEI_PCM_GETDATA 321
#define AMAZON_MEI_PCM_GPIO 322
#define AMAZON_MEI_EOC_SEND 323
//MIB
#define AMAZON_MIB_LO_ATUC 324
#define AMAZON_MIB_LO_ATUR 325
#define AMAZON_MEI_DOWNLOAD 326
#define AMAZON_MEI_DEBUG_MODE 327 //509221:tc.chen
#define LOOP_DIAGNOSTIC_MODE_COMPLETE 328
/*** Enums ***/
typedef enum mei_error
{
MEI_SUCCESS = 0,
MEI_FAILURE = -1,
MEI_MAILBOX_FULL = -2,
MEI_MAILBOX_EMPTY = -3,
MEI_MAILBOX_TIMEOUT = -4,
}MEI_ERROR;
#endif

View File

@ -1,757 +0,0 @@
//509221:tc.chen 2005/09/22 Reset DFE added when MEI_TO_ARC_CS_DONE not cleared by ARC and Added AMAZON_MEI_DEBUG_MODE ioctl
#ifndef _AMAZON_MEI_IOCTL_H
#define _AMAZON_MEI_IOCTL_H
/////////////////////////////////////////////////////////////////////////////////////////////////////
#define PCM_BUFF_SIZE 1024 //bytes
// interrupt numbers
#ifndef _AMAZON_ADSL_APP
typedef struct pcm_data_struct{
u16 S;
u16 temp;
u16 LSW;
u16 MSW;
u16 len;
u16 rdindex;
u16 wrindex;
u16 flow;
int finish;
u8 buff[PCM_BUFF_SIZE];
int point;
}pcm_data_struct;
typedef struct amazon_clreoc_pkt{
struct list_head list;
u8 * command; //point to clreoc command data
int len; //command length
}amazon_clreoc_pkt;
// Number of intervals
#define INTERVAL_NUM 192 //two days
typedef struct amazon_mei_mib{
struct list_head list;
struct timeval start_time; //start of current interval
int AtucPerfLof;
int AtucPerfLos;
int AtucPerfEs;
int AtucPerfInit;
int AturPerfLof;
int AturPerfLos;
int AturPerfLpr;
int AturPerfEs;
int AturChanPerfRxBlk;
int AturChanPerfTxBlk;
int AturChanPerfCorrBlk;
int AturChanPerfUncorrBlk;
//RFC-3440
int AtucPerfStatFastR;
int AtucPerfStatFailedFastR;
int AtucPerfStatSesL;
int AtucPerfStatUasL;
int AturPerfStatSesL;
int AturPerfStatUasL;
}amazon_mei_mib;
typedef struct adslChanPrevTxRate{
u32 adslAtucChanPrevTxRate;
u32 adslAturChanPrevTxRate;
}adslChanPrevTxRate;
typedef struct adslPhysCurrStatus{
u32 adslAtucCurrStatus;
u32 adslAturCurrStatus;
}adslPhysCurrStatus;
typedef struct ChanType{
int interleave;
int fast;
// 603221:tc.chen start
int bearchannel0;
int bearchannel1;
// 603221:tc.chen end
}ChanType;
typedef struct mib_previous_read{
u16 ATUC_PERF_ESS;
u16 ATUR_PERF_ESS;
u32 ATUR_CHAN_RECV_BLK;
u16 ATUR_CHAN_CORR_BLK_INTL;
u16 ATUR_CHAN_CORR_BLK_FAST;
u16 ATUR_CHAN_UNCORR_BLK_INTL;
u16 ATUR_CHAN_UNCORR_BLK_FAST;
u16 ATUC_PERF_STAT_FASTR;
u16 ATUC_PERF_STAT_FAILED_FASTR;
u16 ATUC_PERF_STAT_SESL;
u16 ATUC_PERF_STAT_UASL;
u16 ATUR_PERF_STAT_SESL;
}mib_previous_read;
typedef struct mib_flags_pretime{
struct timeval ATUC_PERF_LOSS_PTIME;
struct timeval ATUC_PERF_LOFS_PTIME;
struct timeval ATUR_PERF_LOSS_PTIME;
struct timeval ATUR_PERF_LOFS_PTIME;
struct timeval ATUR_PERF_LPR_PTIME;
}mib_flags_pretime;
// cmv message structures
#define MP_PAYLOAD_SIZE 12
typedef struct mpmessage{
u16 iFunction;
u16 iGroup;
u16 iAddress;
u16 iIndex;
u16 iPayload[MP_PAYLOAD_SIZE];
}MPMessage;
#endif
typedef struct meireg{
u32 iAddress;
u32 iData;
}meireg;
#define MEIDEBUG_BUFFER_SIZES 50
typedef struct meidebug{
u32 iAddress;
u32 iCount;
u32 buffer[MEIDEBUG_BUFFER_SIZES];
}meidebug;
//==============================================================================
// Group definitions
//==============================================================================
#define OPTN 5
#define CNFG 8
#define CNTL 1
#define STAT 2
#define RATE 6
#define PLAM 7
#define INFO 3
#define TEST 4
//==============================================================================
// Opcode definitions
//==============================================================================
#define H2D_CMV_READ 0x00
#define H2D_CMV_WRITE 0x04
#define H2D_CMV_INDICATE_REPLY 0x10
#define H2D_ERROR_OPCODE_UNKNOWN 0x20
#define H2D_ERROR_CMV_UNKNOWN 0x30
#define D2H_CMV_READ_REPLY 0x01
#define D2H_CMV_WRITE_REPLY 0x05
#define D2H_CMV_INDICATE 0x11
#define D2H_ERROR_OPCODE_UNKNOWN 0x21
#define D2H_ERROR_CMV_UNKNOWN 0x31
#define D2H_ERROR_CMV_READ_NOT_AVAILABLE 0x41
#define D2H_ERROR_CMV_WRITE_ONLY 0x51
#define D2H_ERROR_CMV_READ_ONLY 0x61
#define H2D_DEBUG_READ_DM 0x02
#define H2D_DEBUG_READ_PM 0x06
#define H2D_DEBUG_WRITE_DM 0x0a
#define H2D_DEBUG_WRITE_PM 0x0e
#define D2H_DEBUG_READ_DM_REPLY 0x03
#define D2H_DEBUG_READ_FM_REPLY 0x07
#define D2H_DEBUG_WRITE_DM_REPLY 0x0b
#define D2H_DEBUG_WRITE_FM_REPLY 0x0f
#define D2H_ERROR_ADDR_UNKNOWN 0x33
#define D2H_AUTONOMOUS_MODEM_READY_MSG 0xf1
//==============================================================================
// INFO register address field definitions
//==============================================================================
#define INFO_TxState 0
#define INFO_RxState 1
#define INFO_TxNextState 2
#define INFO_RxNextState 3
#define INFO_TxStateJumpFrom 4
#define INFO_RxStateJumpFrom 5
#define INFO_ReverbSnrBuf 8
#define INFO_ReverbEchoSnrBuf 9
#define INFO_MedleySnrBuf 10
#define INFO_RxShowtimeSnrBuf 11
#define INFO_DECdelay 12
#define INFO_DECExponent 13
#define INFO_DECTaps 14
#define INFO_AECdelay 15
#define INFO_AECExponent 16
#define INFO_AECTaps 17
#define INFO_TDQExponent 18
#define INFO_TDQTaps 19
#define INFO_FDQExponent 20
#define INFO_FDQTaps 21
#define INFO_USBat 22
#define INFO_DSBat 23
#define INFO_USFineGains 24
#define INFO_DSFineGains 25
#define INFO_BitloadFirstChannel 26
#define INFO_BitloadLastChannel 27
#define INFO_PollEOCData 28 // CO specific
#define INFO_CSNRMargin 29 // CO specific
#define INFO_RCMsgs1 30
#define INFO_RMsgs1 31
#define INFO_RMsgRA 32
#define INFO_RCMsgRA 33
#define INFO_RMsg2 34
#define INFO_RCMsg2 35
#define INFO_BitLoadOK 36
#define INFO_RCRates1 37
#define INFO_RRates1Tab 38
#define INFO_RMsgs1Tab 39
#define INFO_RMsgRATab 40
#define INFO_RRatesRA 41
#define INFO_RCRatesRA 42
#define INFO_RRates2 43
#define INFO_RCRates2 44
#define INFO_PackedRMsg2 45
#define INFO_RxBitSwapFlag 46
#define INFO_TxBitSwapFlag 47
#define INFO_ShowtimeSNRUpdateCount 48
#define INFO_ShowtimeFDQUpdateCount 49
#define INFO_ShowtimeDECUpdateCount 50
#define INFO_CopyRxBuffer 51
#define INFO_RxToneBuf 52
#define INFO_TxToneBuf 53
#define INFO_Version 54
#define INFO_TimeStamp 55
#define INFO_feVendorID 56
#define INFO_feSerialNum 57
#define INFO_feVersionNum 58
#define INFO_BulkMemory 59 //Points to start of bulk memory
#define INFO_neVendorID 60
#define INFO_neVersionNum 61
#define INFO_neSerialNum 62
//==============================================================================
// RATE register address field definitions
//==============================================================================
#define RATE_UsRate 0
#define RATE_DsRate 1
//==============================================================================
// PLAM (Physical Layer Management) register address field definitions
// (See G997.1 for reference)
//==============================================================================
// ///
// Failure Flags ///
// ///
#define PLAM_NearEndFailureFlags 0
#define PLAM_FarEndFailureFlags 1
// ///
// Near End Failure Flags Bit Definitions ///
// ///
// ADSL Failures ///
#define PLAM_LOS_FailureBit 0x0001
#define PLAM_LOF_FailureBit 0x0002
#define PLAM_LPR_FailureBit 0x0004
#define PLAM_RFI_FailureBit 0x0008
// ATM Failures ///
#define PLAM_NCD_LP0_FailureBit 0x0010
#define PLAM_NCD_LP1_FailureBit 0x0020
#define PLAM_LCD_LP0_FailureBit 0x0040
#define PLAM_LCD_LP1_FailureBit 0x0080
#define PLAM_NCD_BC0_FailureBit 0x0100
#define PLAM_NCD_BC1_FailureBit 0x0200
#define PLAM_LCD_BC0_FailureBit 0x0400
#define PLAM_LCD_BC1_FailureBit 0x0800
// ///
// Performance Counts ///
// ///
#define PLAM_NearEndCrcCnt 2
#define PLAM_CorrectedRSErrors 3
#define PLAM_NearEndECSCnt 6
#define PLAM_NearEndESCnt 7
#define PLAM_NearEndSESCnt 8
#define PLAM_NearEndLOSSCnt 9
#define PLAM_NearEndUASLCnt 10
#define PLAM_NearEndHECErrCnt 11
#define PLAM_NearEndHECTotCnt 16
#define PLAM_NearEndCellTotCnt 18
#define PLAM_NearEndSfCntLSW 20
#define PLAM_NearEndSfCntMSW 21
#define PLAM_FarEndFebeCnt 24
#define PLAM_FarEndFecCnt 28
#define PLAM_FarEndFECSCnt 32
#define PLAM_FarEndESCnt 33
#define PLAM_FarEndSESCnt 34
#define PLAM_FarEndLOSSCnt 35
#define PLAM_FarEndUASLCnt 36
#define PLAM_FarEndHECErrCnt 37
#define PLAM_FarEndHECTotCnt 41
#define PLAM_FarEndCellTotCnt 43
#define PLAM_LineAttn 45
#define PLAM_SNRMargin 46
//==============================================================================
// CNTL register address and bit field definitions
//==============================================================================
#define CNTL_ModemControl 0
#define CNTL_ModemReset 0x0
#define CNTL_ModemStart 0x2
//==============================================================================
// STAT register address and bit field definitions
//==============================================================================
#define STAT_MacroState 0
#define STAT_Mode 1
#define STAT_DMTFramingMode 2
#define STAT_SleepState 3
#define STAT_Misc 4
#define STAT_FailureState 5
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// STAT_OLRStatus provides status of OLR
//16-bit STAT_OLRStatus_DS
// [1:0] : OLR status 00=IDLE, 01=OLR_IN_PROGRESS, 10=OLR_Completed, 11=OLR_Aborted
// [3:2]: Reserved
// [5:4]: OLR_Type (1:bitswap; 2: DRR; 3: SRA)
// [7:6]: Reserved
// [10:8]: >0=Request. 0=not. For DS, # of request transmissions/retransmissions (3 bits).
// [11]: 1=Receive Response, 0=not
// [15:12]: Reserved
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
#define STAT_OLRStatus_DS 6
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// STAT_OLRStatus provides status of OLR
// 16-bit STAT_OLRStatus_US CMV
// [1:0] : OLR status 00=IDLE, 01=OLR_IN_PROGRESS, 10=OLR_Completed, 11=OLR_Aborted
// [3:2]: Reserved
// [5:4]: OLR_Type (1:bitswap; 2: DRR; 3: SRA)
// [7:6]: Reserved
// [8]: 1=Request Received. 0=not.
// [10:9]: Reserved
// [11]: 1=Response Sent, 0=not
// [15:12]: Reserved
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
#define STAT_OLRStatus_US 7
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// STAT_PMStatus provides status of PM
// 16-bit STAT_PMStatus CMV
// [1:0] : PM Status 00=IDLE, 01=PM_IN_PROGRESS, 10=PM_Completed, 11=PM_Aborted
// [2] : 0=ATU_R initiated PM; 1 = ATU_C initiated PM
// [3]: Reserved
// [5:4]: PM_Type (1:Simple Request; 2: L2 request; 3: L2 trim)
// [7:6]: Reserved
// [10:8]: >0=Request. 0=not. # of request transmissions/retransmissions (3 bits).
// [11]: 1=Response, 0=not
// [15:12]: Reserved
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
#define STAT_PMStatus 8
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 16-bit STAT_OLRError_DS, STAT_OLRError_US, STAT_PMError
// [3:0]: OLR/PM response reason code
// [7:4]: OLR/PM Internal error code
// [15:8]: OLR/PM Reserved for future
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
#define STAT_OLRError_DS 9
#define STAT_OLRError_US 10
#define STAT_PMError 11
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// STAT_MacroState
// MacroState reflects the high level state of the modem
#define STAT_InitState 0x0000
#define STAT_ReadyState 0x0001
#define STAT_FailState 0x0002
#define STAT_IdleState 0x0003
#define STAT_QuietState 0x0004
#define STAT_GhsState 0x0005
#define STAT_FullInitState 0x0006
#define STAT_ShowTimeState 0x0007
#define STAT_FastRetrainState 0x0008
#define STAT_LoopDiagMode 0x0009
#define STAT_ShortInit 0x000A // Bis short initialization ///
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// STAT_Mode
// ConfigurationMode indicates the mode of the current ADSL Link. In general, a modem may use
// G.Hs or some other mechanism to negotiate the specific mode of operation.
// The OPTN_modeControl CMV is used to select a set of desired modes.
// The STAT_Mode CMV indicates which mode was actually selected.
#define STAT_ConfigMode_T1413 0x0001
#define STAT_ConfigMode_G992_2_AB 0x0002
#define STAT_ConfigMode_G992_1_A 0x0004
#define STAT_ConfigMode_G992_1_B 0x0008
#define STAT_ConfigMode_G992_1_C 0x0010
#define STAT_ConfigMode_G992_2_C 0x0020
#define STAT_ConfigMode_G992_3_A 0x0100
#define STAT_ConfigMode_G992_3_B 0x0200
#define STAT_ConfigMode_G992_3_I 0x0400
#define STAT_ConfigMode_G992_3_J 0x0800
#define STAT_ConfigMode_G992_3_L 0x1000
#define STAT_ConfigMode_G992_4_A 0x2000
#define STAT_ConfigMode_G992_4_I 0x4000
#define STAT_ConfigMode_G992_5 0x8000
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// STAT_DMTFramingMode
// FramingMode indicates the DMT framing mde negotiated during initialization. The framing mode
// status is not applicable in BIS mode and its value is undefined
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define STAT_FramingModeMask 0x0003
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// STAT_Misc
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define STAT_OverlappedSpectrum 0x0008
#define STAT_TCM 0x0010
#define STAT_TDQ_at_1104 0x0020
#define STAT_T1413_Signal_Detected 0x0040
#define STAT_AnnexL_US_Mask1_PSD 0x1000 //indicate we actually selected G992.3 AnnexL US PSD mask1
#define STAT_AnnexL_US_Mask2_PSD 0x2000 //indicate we actually selected G992.3 AnnexL US PSD mask2
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// STAT_FailureState
// when the MacroSTate indicates the fail state, FailureState provides a failure code
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define E_CODE_NO_ERROR 0
#define E_CODE_BAT_TX 1 // TX BAT table is incorrect */
#define E_CODE_BAT_RX 2 // RX BAT table is incorrect */
#define E_CODE_PROFILE 3 // profile is not selected in fast retrain */
#define E_CODE_TX_AOC_FIFO_OVERFLOW 4
#define E_CODE_TRUNCATE_FR 5 //Fast Retrain truncated due to no stored profiles*/
#define E_CODE_BITLOAD 6 // bit loading fails */
#define E_CODE_ST_ERROR 7 // showtime CRC error */
#define E_CODE_RESERVED 8 // using parameters reserved by the ITU-T */
#define E_CODE_C_TONES 9 // detected C_TONES */
#define E_CODE_CODESWAP_ERR 10 // codeswap not finished in time */
#define E_CODE_FIFO_OVERFLOW 11 // we have run out of fifo space */
#define E_CODE_C_BG_DECODE_ERR 12 // error in decoding C-BG message */
#define E_CODE_C_RATES2_DECODE_ERR 13 // error in decoding C-MSGS2 and C-RATES2 */
#define E_CODE_RCMedleyRx_C_SEGUE2_Failure 14 // Timeout after RCMedleyRx waiting for C_SEGUE2 */
#define E_CODE_RReverbRATx_C_SEGUE2_Failure 15 // Timeout after RReverbRATx waiting for C_SEGUE2 */
#define E_CODE_RReverb3Tx_C_SEGUE1_Failure 16 // Timeout after RReverb3Tx waiting for C_SEGUE1 */
#define E_CODE_RCCRC2Rx_C_RATES1_DECOD_ERR 17 // Received CRC not equal to computed CRC */
#define E_CODE_RCCRC1Rx_C_RATES1_DECOD_ERR 18 // Received CRC not equal to computed CRC */
#define E_CODE_RReverb5Tx_C_SEGUE2_Failure 19 // Timeout after RReverb5Tx waiting for C_SEGUE2 */
#define E_CODE_RReverb6Tx_C_SEGUE3_Failure 20 // Timeout after RReverb6Tx waiting for C_SEGUE3 */
#define E_CODE_RSegue5Tx_C_SEGUE3_Failure 21 // Timeout after RSegue5Tx waiting for C_SEGUE3 */
#define E_CODE_RCReverb5Rx_C_SEGUE_Failure 22 // Timeout after RCReverb5Rx waiting for C_SEGUE */
#define E_CODE_RCReverbRARx_C_SEGUE2_Failure 23 // Timeout after RCReverbRARx waiting for C_SEGUE2 */
#define E_CODE_RCCRC4Rx_CMSGS2_DECOD_ERR 24 // Received CRC not equal to computed CRC */
#define E_CODE_RCCRC5Rx_C_BG_DECOD_ERR 25 // Received CRC not equal to computed CRC */
#define E_CODE_RCCRC3Rx_DECOD_ERR 26 // Received CRC not equal to computed CRC */
#define E_CODE_RCPilot3_DEC_PATH_DEL_TIMEOUT 27 // DEC Path Delay timeout */
#define E_CODE_RCPilot3_DEC_TRAINING_TIMEOUT 28 // DEC Training timeout */
#define E_CODE_RCReverb3Rx_C_SEGUE1_Failure 29 // Timeout after RCReverb3Rx waiting for C_SEGUE1 */
#define E_CODE_RCReverb2Rx_SignalEnd_Failure 30 // Timeout waiting for the end of RCReverb2Rx signal */
#define E_CODE_RQuiet2_SignalEnd_Failure 31 // Timeout waiting for the end of RQuiet2 signal */
#define E_CODE_RCReverbFR1Rx_Failure 32 // Timeout waiting for the end of RCReverbFR1Rx signal */
#define E_CODE_RCPilotFR1Rx_SignalEnd_Failure 33 // Timeout waiting for the end of RCPilotFR1Rx signal */
#define E_CODE_RCReverbFR2Rx_C_Segue_Failure 34 // Timeout after RCReverbFR2Rx waiting for C_SEGUE */
#define E_CODE_RCReverbFR5Rx_SignalEnd_TIMEOUT 35 // Timeout waiting for the end of RCReverbFR5Rx signal */
#define E_CODE_RCReverbFR6Rx_C_SEGUE_Failure 36 // Timeout after RCReverbFR6Rx waiting for C_SEGUE */
#define E_CODE_RCReverbFR8Rx_C_SEGUE_FR4_Failure 37 // Timeout after RCReverbFR8Rx waiting for C_SEGUE_FR4 */
#define E_CODE_RCReverbFR8Rx_No_PROFILE 38 // Timeout since no profile was selected */
#define E_CODE_RCReverbFR8Rx_SignalEnd_TIMEOUT 39 // Timeout waiting for the end of RCReverbFR8Rx signal */
#define E_CODE_RCCRCFR1_DECOD_ERR 40 // Received CRC not equal to computed CRC */
#define E_CODE_RCRecovRx_SingnalEnd_TIMEOUT 41 // Timeout waiting for the end of RCRecovRx signal */
#define E_CODE_RSegueFR5Tx_TX_Not_Ready_TIMEOUT 42 // Timeout after RSegueFR5Tx waiting for C_SEGUE2 */
#define E_CODE_RRecovTx_SignalEnd_TIMEOUT 43 // Timeout waiting for the end of RRecovTx signal */
#define E_CODE_RCMedleyFRRx_C_SEGUE2_Failure 44 // Timeout after RCMedleyFRRx waiting for C_SEGUE2 */
#define E_CODE_CONFIGURATION_PARAMETERS_ERROR 45 // one of the configuration parameters do not meet the standard */
#define E_CODE_BAD_MEM_ACCESS 46
#define E_CODE_BAD_INSTRUCTION_ACCESS 47
#define E_CODE_TX_EOC_FIFO_OVERFLOW 48
#define E_CODE_RX_EOC_FIFO_OVERFLOW 49
#define E_CODE_GHS_CD_FLAG_TIME_OUT 50 // Timeout when transmitting Flag in handshake cleardown */
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//STAT_OLRStatus:
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define STAT_OLRPM_IDLE 0x0000
#define STAT_OLRPM_IN_PROGRESS 0x0001
#define STAT_OLRPM_COMPLETE 0x0002
#define STAT_OLRPM_ABORTED 0x0003
#define STAT_OLRPM_RESPONSE 0x0800
#define STAT_OLR_BITSWAP 0x0010
#define STAT_OLR_DRR 0x0020
#define STAT_OLR_SRA 0x0030
//STAT_PMStatus_US:
#define STAT_PM_CO_REQ 0x0004
#define STAT_PM_SIMPLE_REQ 0x0010
#define STAT_PM_L2_REQ 0x0020
#define STAT_PM_L2_TRIM_REQ 0x0030
// STAT_OLRError_DS, STAT_OLRError_US
//4 bit response reason code:
#define RESP_BUSY 0x01
#define RESP_INVALID_PARAMETERS 0x02
#define RESP_NOT_ENABLED 0x03
#define RESP_NOT_SUPPORTED 0x04
//4 bit internal error code (common for OLR and PM)
#define REQ_INVALID_BiGi 0x10
#define REQ_INVALID_Lp 0x20
#define REQ_INVALID_Bpn 0x30
#define REQ_INVALID_FRAMING_CONSTRAINT 0x40
#define REQ_NOT_IN_L0_STATE 0x50
#define REQ_NOT_IN_L2_STATE 0x60
#define REQ_INVALID_PCB 0x70
#define REQ_VIOLATES_MARGIN 0x80
//STAT_PMError
//4 bit response reason code:
#define RESP_STATE_NOT_DESIRED 0x03
#define RESP_INFEASIBLE_PARAMETERS 0x04
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OPTN register address and bit field definitions
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define OPTN_ModeControl 0
#define OPTN_DMTLnkCtl 1
// Reserved 2
#define OPTN_GhsControl 3
// Reserved 4
#define OPTN_PwrManControl 5
#define OPTN_AnnexControl 6
#define OPTN_ModeControl1 7
// Reserved 8
#define OPTN_StateMachineCtrl 9
// Reserved 10
// Reserved 11
#define OPTN_BisLinkControl 12
#define OPTN_ATMAddrConfig 13
#define OPTN_ATMNumCellConfig 14
// Mode control defines the allowable operating modes of an ADSL link. In general, a modem may ///
// use G.Hs or some other mechanism to negotiate the specific mode of operation. ///
// The OPTN_ModeControl CMV is used to select a set of desired modes ///
// The STAT_ModeControl CMV indicates which mode was actually selected ///
// OPTN_ModeControl
#define OPTN_ConfigMode_T1413 0x0001
#define OPTN_ConfigMode_G992_2_AB 0x0002
#define OPTN_ConfigMode_G992_1_A 0x0004
#define OPTN_ConfigMode_G992_1_B 0x0008
#define OPTN_ConfigMode_G992_1_C 0x0010
#define OPTN_ConfigMode_G992_2_C 0x0020
#define OPTN_ConfigMode_G992_3_A 0x0100
#define OPTN_ConfigMode_G992_3_B 0x0200
#define OPTN_ConfigMode_G992_3_I 0x0400
#define OPTN_ConfigMode_G992_3_J 0x0800
#define OPTN_ConfigMode_G992_3_L 0x1000
#define OPTN_ConfigMode_G992_4_A 0x2000
#define OPTN_ConfigMode_G992_4_I 0x4000
#define OPTN_ConfigMode_G992_5 0x8000
// OPTN_PwrManControl
#define OPTN_PwrManWakeUpGhs 0x1
#define OPTN_PwrManWakeUpFR 0x2
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OPTN_DMT Link Control
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define OPTN_DMT_DualLatency_Dis 0x200
#define OPTN_DMT_S_Dis 0x100
#define OPTN_DMT_FRAMINGMODE 0x1
#define OPTN_DMT_FRAMINGMODE_MASK 0x7
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OPTN_BIS Link Control
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define OPTN_BisLinkContrl_LineProbeDis 0x1
#define OPTN_BisLinkContrl_DSBlackBitsEn 0x2
#define OPTN_BisLinkContrl_DiagnosticModeEn 0x4
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OPTN_GhsControl
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// for OPTN_GhsControl, we will assign 16bit word as follows
// bit 0~3: set the control over which start(initial) message CPE will send:
//
// BIT: 2 1 0
// 0 0 1 CLR
// 0 1 0 MR
// 0 1 1 MS
// 1 0 0 MP
//
// // bit 4~6: set the control over which message will be sent when we get at lease one CL/CLR exchange
// BIT: 5 4
// 0 1 MS
// 1 0 MR
// 1 1 MP
//
// // bit 15: RT initiated G.hs sample sessions one through eight. Session one is default.
// BIT: 15
// 1 means session one
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define OPTN_GHS_ST_GHS 0x8000
#define OPTN_GHS_INIT_MASK 0x000F
#define OPTN_GHS_RESP_MASK 0x00F0
#define OPTN_RTInitTxMsg_CLR 0x0001
#define OPTN_RTInitTxMsg_MR 0x0002
#define OPTN_RTInitTxMsg_MS 0x0003
#define OPTN_RTInitTxMsg_MP 0x0004
#define OPTN_RTRespTxMsg_MS 0x0010
#define OPTN_RTRespTxMsg_MR 0x0020
#define OPTN_RTRespTxMsg_MP 0x0030
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OPTN_AnnexControl
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// G.992.3 Annex A/L1/L2 US PSD Mask preferred
#define OPTN_G992_3_AnnexA_PreferredModeMask 0x3000
#define OPTN_G992_3_AnnexA_PreferredModeA 0x0000 // default AnnexA PSD mask ///
#define OPTN_G992_3_AnnexA_PreferredModeL1 0x1000 // AnnexL wide spectrum upstream PSD mask ///
#define OPTN_G992_3_AnnexA_PreferredModeL2 0x2000 // AnnexL narrow spectrum upstream PSD mask ///
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//OPTN_ATMAddrConfig
// Bits 4:0 are Utopia address for BC1
// Bits 9:5 are Utopia address for BC0
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define OPTN_UTPADDR_BC1 0x001F
#define OPTN_UTPADDR_BC0 0x03E0
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//OPTN_ATMNumCellConfig
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define OPTN_BC1_NUM_CELL_PAGES 0x000F // Bits 0:3 ///
#define OPTN_BC0_NUM_CELL_PAGES 0x00F0 // Bits 4:7 ///
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CNFG register address field ///
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////
// these cmvs are used by bis handshake ///
///////////////////////////////////////////
// Each of the CNFG_TPS entries points to a structure of type (TPS_TC_BearerChannel_t)
#define CNFG_TPS_TC_DS0 0
#define CNFG_TPS_TC_DS1 1
#define CNFG_TPS_TC_US0 2
#define CNFG_TPS_TC_US1 3
#define CNFG_HDLC_Overhead_Requirements 4
// Each of the CNFG_PMS entries points to a structure of type (PMS_TC_LatencyPath_t)
#define CNFG_PMS_TC_DS0 5
#define CNFG_PMS_TC_DS1 6
#define CNFG_PMS_TC_US0 7
#define CNFG_PMS_TC_US1 8
// CNFG_PMD_PARAMETERS points to a structure of type (PMD_params_t)
#define CNFG_PMD_PARAMETERS 9
////////////////////////////////////////////////////////////
// these cmvs are used by bis training and showtime code ///
////////////////////////////////////////////////////////////
////////////////
// Tx Config ///
////////////////
#define CNFG_tx_Cnfg_Nbc 10
#define CNFG_tx_Cnfg_Nlp 11
#define CNFG_tx_Cnfg_Rp 12
#define CNFG_tx_Cnfg_Mp 13
#define CNFG_tx_Cnfg_Lp 14
#define CNFG_tx_Cnfg_Tp 15
#define CNFG_tx_Cnfg_Dp 16
#define CNFG_tx_Cnfg_Bpn 17
#define CNFG_tx_Cnfg_FramingMode 18
#define CNFG_tx_Cnfg_MSGLp 19
#define CNFG_tx_Cnfg_MSGc 20
////////////////
// Rx Config ///
////////////////
#define CNFG_rx_Cnfg_Nbc 21
#define CNFG_rx_Cnfg_Nlp 22
#define CNFG_rx_Cnfg_Rp 23
#define CNFG_rx_Cnfg_Mp 24
#define CNFG_rx_Cnfg_Lp 25
#define CNFG_rx_Cnfg_Tp 26
#define CNFG_rx_Cnfg_Dp 27
#define CNFG_rx_Cnfg_Bpn 28
#define CNFG_rx_Cnfg_FramingMode 29
#define CNFG_rx_Cnfg_MSGLp 30
#define CNFG_rx_Cnfg_MSGc 31
#define CNFG_tx_Cnfg_BCnToLPp 32
#define CNFG_rx_Cnfg_BCnToLPp 33
#endif

View File

@ -1,177 +0,0 @@
#ifndef AMAZON_SW_H
#define AMAZON_SW_H
#define SET_ETH_SPEED_AUTO SIOCDEVPRIVATE
#define SET_ETH_SPEED_10 SIOCDEVPRIVATE+1
#define SET_ETH_SPEED_100 SIOCDEVPRIVATE+2
#define SET_ETH_DUPLEX_AUTO SIOCDEVPRIVATE+3
#define SET_ETH_DUPLEX_HALF SIOCDEVPRIVATE+4
#define SET_ETH_DUPLEX_FULL SIOCDEVPRIVATE+5
#define SET_ETH_REG SIOCDEVPRIVATE+6
#define VLAN_TOOLS SIOCDEVPRIVATE+7
#define MAC_TABLE_TOOLS SIOCDEVPRIVATE+8
/*===mac table commands==*/
#define RESET_MAC_TABLE 0
#define READ_MAC_ENTRY 1
#define WRITE_MAC_ENTRY 2
#define ADD_MAC_ENTRY 3
/*====vlan commands===*/
#define CHANGE_VLAN_CTRL 0
#define READ_VLAN_ENTRY 1
#define UPDATE_VLAN_ENTRY 2
#define CLEAR_VLAN_ENTRY 3
#define RESET_VLAN_TABLE 4
#define ADD_VLAN_ENTRY 5
/*
** MDIO constants.
*/
#define MDIO_BASE_STATUS_REG 0x1
#define MDIO_BASE_CONTROL_REG 0x0
#define MDIO_PHY_ID_HIGH_REG 0x2
#define MDIO_PHY_ID_LOW_REG 0x3
#define MDIO_BC_NEGOTIATE 0x0200
#define MDIO_BC_FULL_DUPLEX_MASK 0x0100
#define MDIO_BC_AUTO_NEG_MASK 0x1000
#define MDIO_BC_SPEED_SELECT_MASK 0x2000
#define MDIO_STATUS_100_FD 0x4000
#define MDIO_STATUS_100_HD 0x2000
#define MDIO_STATUS_10_FD 0x1000
#define MDIO_STATUS_10_HD 0x0800
#define MDIO_STATUS_SPEED_DUPLEX_MASK 0x7800
#define MDIO_ADVERTISMENT_REG 0x4
#define MDIO_ADVERT_100_FD 0x100
#define MDIO_ADVERT_100_HD 0x080
#define MDIO_ADVERT_10_FD 0x040
#define MDIO_ADVERT_10_HD 0x020
#define MDIO_LINK_UP_MASK 0x4
#define MDIO_START 0x1
#define MDIO_READ 0x2
#define MDIO_WRITE 0x1
#define MDIO_PREAMBLE 0xfffffffful
#define PHY_RESET 0x8000
#define AUTO_NEGOTIATION_ENABLE 0X1000
#define AUTO_NEGOTIATION_COMPLETE 0x20
#define RESTART_AUTO_NEGOTIATION 0X200
#define PHY0_ADDR 0
#define PHY1_ADDR 1
#define P1M 0
#define AMAZON_SW_REG32(reg_num) *((volatile u32*)(reg_num))
#define OK 0;
#ifdef CONFIG_CPU_LITTLE_ENDIAN
typedef struct mac_table_entry{
u64 mac_address:48;
u64 p0:1;
u64 p1:1;
u64 p2:1;
u64 cr:1;
u64 ma_st:3;
u64 res:9;
}_mac_table_entry;
typedef struct IFX_Switch_VLanTableEntry{
u32 vlan_id:12;
u32 mp0:1;
u32 mp1:1;
u32 mp2:1;
u32 v:1;
u32 res:16;
}_IFX_Switch_VLanTableEntry;
typedef struct mac_table_req{
int cmd;
int index;
u32 data;
u64 entry_value;
}_mac_table_req;
#else //not CONFIG_CPU_LITTLE_ENDIAN
typedef struct mac_table_entry{
u64 mac_address:48;
u64 p0:1;
u64 p1:1;
u64 p2:1;
u64 cr:1;
u64 ma_st:3;
u64 res:9;
}_mac_table_entry;
typedef struct IFX_Switch_VLanTableEntry{
u32 vlan_id:12;
u32 mp0:1;
u32 mp1:1;
u32 mp2:1;
u32 v:1;
u32 res:16;
}_IFX_Switch_VLanTableEntry;
typedef struct mac_table_req{
int cmd;
int index;
u32 data;
u64 entry_value;
}_mac_table_req;
#endif //CONFIG_CPU_LITTLE_ENDIAN
typedef struct vlan_req{
int cmd;
int index;
u32 data;
u32 entry_value;
}_vlan_req;
typedef struct data_req{
int index;
u32 value;
}_data_req;
enum duplex
{
half,
full,
autoneg
};
struct switch_priv {
struct net_device_stats stats;
int rx_packetlen;
u8 *rx_packetdata;
int rx_status;
int tx_packetlen;
#ifdef CONFIG_NET_HW_FLOWCONTROL
int fc_bit;
#endif //CONFIG_NET_HW_FLOWCONTROL
u8 *tx_packetdata;
int tx_status;
struct dma_device_info *dma_device;
struct sk_buff *skb;
spinlock_t lock;
int mdio_phy_addr;
int current_speed;
int current_speed_selection;
int rx_queue_len;
int full_duplex;
enum duplex current_duplex;
int num;
};
#endif //AMAZON_SW_H

View File

@ -1,258 +0,0 @@
#ifndef AMAZON_TPE_H
#define AMAZON_TPE_H
#include <linux/atm.h>
#include <linux/atmdev.h>
#include <linux/netdevice.h>
#include <linux/ioctl.h>
#ifdef CONFIG_IFX_ATM_MIB
/* For ATM-MIB lists */
#include <linux/list.h>
#endif
#include <asm/amazon/atm_mib.h>
/* CBM Queue arranagement
* Q0: free cells pool
* Q1~ Q15: upstream queues
* Q16: QAM downstream
* Q17~Q31: downstream queues
*/
#define AMAZON_ATM_MAX_QUEUE_NUM 32
#define AMAZON_ATM_PORT_NUM 2
#define AMAZON_ATM_FREE_CELLS 4000
#define AMAZON_ATM_MAX_VCC_NUM (AMAZON_ATM_MAX_QUEUE_NUM/2 - 1)
#define AMAZON_AAL0_SDU (ATM_AAL0_SDU+4) //one more word for status
#define CBM_RX_OFFSET 16 //offset from the same q for tx
#define AMAZON_ATM_OAM_Q_ID 16
#define AMAZON_ATM_RM_Q_ID 16
#define AMAZON_ATM_OTHER_Q_ID 16
#define CBM_DEFAULT_Q_OFFSET 1
#define HTUTIMEOUT 0xffff//timeoutofhtutocbm
#define QSB_WFQ_NONUBR_MAX 0x3f00
#define QSB_WFQ_UBR_BYPASS 0x3fff
#define QSB_TP_TS_MAX 65472
#define QSB_TAUS_MAX 64512
#define QSB_GCR_MIN 18
#define HTU_RAM_ACCESS_MAX 1024//maxium time for HTU RAM access
#define SWIE_LOCK 1
#define PROC_ATM 1
#define PROC_MIB 2
#define PROC_VCC 3
#define PROC_AAL5 4
#define PROC_CBM 5
#define PROC_HTU 6
#define PROC_QSB 7
#define PROC_SWIE 8
/***************** internal data structure ********************/
typedef int (*push_back_t)(struct atm_vcc *vcc,struct sk_buff *skb,int err) ;
/* Device private data */
typedef struct{
u8 padding_byte;
u32 tx_max_sdu;
u32 rx_max_sdu;
u32 cnt_cpy; //no. of packets that need a copy due to alignment
}amazon_aal5_dev_t;
typedef struct{
u32 max_q_off; //maxium queues used in real scenario
u32 nrt_thr;
u32 clp0_thr;
u32 clp1_thr;
u32 free_cell_cnt;
#ifdef CONFIG_USE_VENUS
u8 * qd_addr_free; //to work around a bug, bit15 of QDOFF address should be 1
#endif
u8 * qd_addr;
u8 * mem_addr;
u8 allocated;
}amazon_cbm_dev_t;
typedef struct{
}amazon_htu_dev_t;
typedef struct{
u32 tau; //cell delay variation due to concurrency(?)
u32 tstepc; //time step, all legal values are 1,2,4
u32 sbl; //scheduler burse length (for PHY)
}amazon_qsb_dev_t;
typedef struct{
u32 qid; //QID of the current extraction queue
struct semaphore in_sem; // Software-Insertion semaphore
volatile long lock; //lock that avoids race contions between SWIN and SWEX
wait_queue_head_t sleep; //wait queue for SWIE and SWEX
u32 sw; //status word
}amazon_swie_dev_t;
//AAL5 MIB Counter
typedef struct{
u32 tx,rx; //number AAL5 CPCS PDU from/to higher-layer
u32 tx_err,rx_err; //ifInErrors and ifOutErros
u32 tx_drop,rx_drop; //discarded received packets due to mm shortage
u32 htu_unp; //number of unknown received cells
u32 rx_cnt_h; //number of octets received, high 32 bits
u32 rx_cnt_l; //number of octets received, low 32 bits
u32 tx_cnt_h; //number of octets transmitted, high 32 bits
u32 tx_cnt_l; //number of octets transmitted, low 32 bits
u32 tx_ppd; //number of cells for AAL5 upstream PPD discards
u64 rx_cells; //number of cells for downstream
u64 tx_cells; //number of cells for upstream
u32 rx_err_cells; //number of cells dropped due to uncorrectable HEC errors
}amazon_mib_counter_t;
typedef enum {QS_PKT,QS_LEN,QS_ERR,QS_HW_DROP,QS_SW_DROP,QS_MAX} qs_t;
//queue statics no. of packet received / sent
//queue statics no. of bytes received / sent
//queue statics no. of packets with error
//queue statics no. of packets dropped by hw
//queue statics no. of packets dropped by sw
typedef struct{
push_back_t push; //call back function
struct atm_vcc * vcc; //opened vcc
struct timeval access_time; //time when last F4/F5 user cells arrive
int free; //whether this queue is occupied, 0: occupied, 1: free
u32 aal5VccCrcErrors; //MIB counter
u32 aal5VccOverSizedSDUs; //MIB counter
#if defined(AMAZON_ATM_DEBUG) || defined (CONFIG_IFX_ATM_MIB)
u32 qs[QS_MAX];
#endif
}amazon_atm_queue_t;
typedef struct{
int enable; //enable / disable
u32 max_conn; //maximum number of connections per port
u32 tx_max_cr; //Remaining cellrate for this device for tx direction
u32 tx_rem_cr; //Remaining cellrate for this device for tx direction
u32 tx_cur_cr; //Current cellrate for this device for tx direction
}amazon_atm_port_t;
typedef struct{
amazon_aal5_dev_t aal5;
amazon_cbm_dev_t cbm;
amazon_htu_dev_t htu;
amazon_qsb_dev_t qsb;
amazon_swie_dev_t swie;
amazon_mib_counter_t mib_counter;
amazon_atm_queue_t queues[AMAZON_ATM_MAX_QUEUE_NUM];
amazon_atm_port_t ports[AMAZON_ATM_PORT_NUM];
atomic_t dma_tx_free_0;//TX_CH0 has availabe descriptors
} amazon_atm_dev_t;
struct oam_last_activity{
u8 vpi; //vpi for this connection
u16 vci; //vci for t his connection
struct timeval stamp; //time when last F4/F5 user cells arrive
struct oam_last_activity * next;//for link list purpose
};
typedef union{
#ifdef CONFIG_CPU_LITTLE_ENDIAN
struct{
u32 tprs :16;
u32 twfq :14;
u32 vbr :1;
u32 reserved :1;
}bit;
u32 w0;
#else
struct{
u32 reserved :1;
u32 vbr :1;
u32 twfq :14;
u32 tprs :16;
}bit;
u32 w0;
#endif
}qsb_qptl_t;
typedef union{
#ifdef CONFIG_CPU_LITTLE_ENDIAN
struct{
u32 ts :16;
u32 taus :16;
}bit;
u32 w0;
#else
struct{
u32 taus :16;
u32 ts :16;
}bit;
u32 w0;
#endif
}qsb_qvpt_t;
struct amazon_atm_cell_header {
#ifdef CONFIG_CPU_LITTLE_ENDIAN
struct{
u32 clp :1; // Cell Loss Priority
u32 pti :3; // Payload Type Identifier
u32 vci :16; // Virtual Channel Identifier
u32 vpi :8; // Vitual Path Identifier
u32 gfc :4; // Generic Flow Control
}bit;
#else
struct{
u32 gfc :4; // Generic Flow Control
u32 vpi :8; // Vitual Path Identifier
u32 vci :16; // Virtual Channel Identifier
u32 pti :3; // Payload Type Identifier
u32 clp :1; // Cell Loss Priority
}bit;
#endif
};
/************************ Function Declarations **************************/
amazon_atm_dev_t * amazon_atm_create(void);
int amazon_atm_open(struct atm_vcc *vcc,push_back_t);
int amazon_atm_send(struct atm_vcc *vcc,struct sk_buff *skb);
int amazon_atm_send_oam(struct atm_vcc *vcc,void *cell, int flags);
void amazon_atm_close(struct atm_vcc *vcc);
void amazon_atm_cleanup(void);
const struct oam_last_activity* get_oam_time_stamp(void);
//mib-related
int amazon_atm_cell_mib(atm_cell_ifEntry_t * to,u32 itf);
int amazon_atm_aal5_mib(atm_aal5_ifEntry_t * to);
int amazon_atm_vcc_mib(struct atm_vcc *vcc,atm_aal5_vcc_t * to);
int amazon_atm_vcc_mib_x(int vpi, int vci,atm_aal5_vcc_t* to);
#define AMAZON_WRITE_REGISTER_L(data,addr) do{ *((volatile u32*)(addr)) = (u32)(data); wmb();} while (0)
#define AMAZON_READ_REGISTER_L(addr) (*((volatile u32*)(addr)))
/******************************* ioctl stuff****************************************/
#define NUM(dev) (MINOR(dev) & 0xf)
/*
* Ioctl definitions
*/
/* Use 'o' as magic number */
#define AMAZON_ATM_IOC_MAGIC 'o'
/* MIB_CELL: get atm cell level mib counter
* MIB_AAL5: get aal5 mib counter
* MIB_VCC: get vcc mib counter
*/
typedef struct{
int vpi;
int vci;
atm_aal5_vcc_t mib_vcc;
}atm_aal5_vcc_x_t;
#define AMAZON_ATM_MIB_CELL _IOWR(AMAZON_ATM_IOC_MAGIC, 0, atm_cell_ifEntry_t)
#define AMAZON_ATM_MIB_AAL5 _IOWR(AMAZON_ATM_IOC_MAGIC, 1, atm_aal5_ifEntry_t)
#define AMAZON_ATM_MIB_VCC _IOWR(AMAZON_ATM_IOC_MAGIC, 2, atm_aal5_vcc_x_t)
#define AMAZON_ATM_IOC_MAXNR 3
//sockopt
#define SO_AMAZON_ATM_MIB_VCC __SO_ENCODE(SOL_ATM,5,atm_aal5_vcc_t)
#endif // AMAZON_TPE_H

View File

@ -1,23 +0,0 @@
#ifndef AMAZON_WDT_H
#define AMAZON_WDT_H
#ifdef __KERNEL__
typedef struct wdt_dev{
char name[16];
int major;
int minor;
int full;
char buff[10];
}wdt_dev;
#define AMAZON_WDT_REG32(addr) (*((volatile u32*)(addr)))
#endif //__KERNEL__
//AMAZON_WDT_IOC_START: start the WDT timer (must provide a initial timeout value)
//AMAZON_WDT_IOC_STOP: stop the WDT
//AMAZON_WDT_IOC_PING: reload the timer to initial value (must happend after a AMAZON_WDT_IOC_START)
#define AMAZON_WDT_IOC_MAGIC 0xc0
#define AMAZON_WDT_IOC_START _IOW( AMAZON_WDT_IOC_MAGIC,0, int)
#define AMAZON_WDT_IOC_STOP _IO( AMAZON_WDT_IOC_MAGIC,1)
#define AMAZON_WDT_IOC_PING _IO( AMAZON_WDT_IOC_MAGIC,2)
#endif //AMAZON_WDT_H

View File

@ -1,540 +0,0 @@
#ifndef ATM_DEFINES_H
#define ATM_DEFINES_H
//Registers Base Address
#define IO_BASE_ADDR 0xA0000000
#define AAL5_BASE_ADDRESS 0x10104400+IO_BASE_ADDR
#define CBM_BASE_ADDRESS 0x10104000+IO_BASE_ADDR
#define HTU_BASE_ADDRESS 0x10105100+IO_BASE_ADDR
#define QSB_BASE_ADDRESS 0x10105000+IO_BASE_ADDR
#define SWIE_BASE_ADDRESS 0x10105200+IO_BASE_ADDR
//AAL5 Registers
#define AAL5_SISR0_ADDR AAL5_BASE_ADDRESS+0x20
#define AAL5_SIMR0_ADDR AAL5_BASE_ADDRESS+0x24
#define AAL5_SISR1_ADDR AAL5_BASE_ADDRESS+0x28
#define AAL5_SIMR1_ADDR AAL5_BASE_ADDRESS+0x2C
#define AAL5_SMFL_ADDR AAL5_BASE_ADDRESS+0x30
#define AAL5_SATMHD_ADDR AAL5_BASE_ADDRESS+0x34
#define AAL5_SCON_ADDR AAL5_BASE_ADDRESS+0x38
#define AAL5_SCMD_ADDR AAL5_BASE_ADDRESS+0x3C
#define AAL5_RISR0_ADDR AAL5_BASE_ADDRESS+0x40
#define AAL5_RIMR0_ADDR AAL5_BASE_ADDRESS+0x44
#define AAL5_RISR1_ADDR AAL5_BASE_ADDRESS+0x48
#define AAL5_RIMR1_ADDR AAL5_BASE_ADDRESS+0x4C
#define AAL5_RMFL_ADDR AAL5_BASE_ADDRESS+0x50
#define AAL5_RINTINF0_ADDR AAL5_BASE_ADDRESS+0x54
#define AAL5_RINTINF1_ADDR AAL5_BASE_ADDRESS+0x58
#define AAL5_RES5C_ADDR AAL5_BASE_ADDRESS+0x5C
#define AAL5_RIOL_ADDR AAL5_BASE_ADDRESS+0x60
#define AAL5_RIOM_ADDR AAL5_BASE_ADDRESS+0x64
#define AAL5_SOOL_ADDR AAL5_BASE_ADDRESS+0x68
#define AAL5_SOOM_ADDR AAL5_BASE_ADDRESS+0x6C
#define AAL5_RES70_ADDR AAL5_BASE_ADDRESS+0x70
#define AAL5_RES74_ADDR AAL5_BASE_ADDRESS+0x74
#define AAL5_RES78_ADDR AAL5_BASE_ADDRESS+0x78
#define AAL5_RES7C_ADDR AAL5_BASE_ADDRESS+0x7C
#define AAL5_RES80_ADDR AAL5_BASE_ADDRESS+0x80
#define AAL5_RES84_ADDR AAL5_BASE_ADDRESS+0x84
#define AAL5_RES88_ADDR AAL5_BASE_ADDRESS+0x88
#define AAL5_RES8C_ADDR AAL5_BASE_ADDRESS+0x8C
#define AAL5_RES90_ADDR AAL5_BASE_ADDRESS+0x90
#define AAL5_RES94_ADDR AAL5_BASE_ADDRESS+0x94
#define AAL5_RES98_ADDR AAL5_BASE_ADDRESS+0x98
#define AAL5_RES9C_ADDR AAL5_BASE_ADDRESS+0x9C
#define AAL5_RESA0_ADDR AAL5_BASE_ADDRESS+0xA0
#define AAL5_RESA4_ADDR AAL5_BASE_ADDRESS+0xA4
#define AAL5_RESA8_ADDR AAL5_BASE_ADDRESS+0xA8
#define AAL5_RESAC_ADDR AAL5_BASE_ADDRESS+0xAC
#define AAL5_RESB0_ADDR AAL5_BASE_ADDRESS+0xB0
#define AAL5_RESB4_ADDR AAL5_BASE_ADDRESS+0xB4
#define AAL5_RESB8_ADDR AAL5_BASE_ADDRESS+0xB8
#define AAL5_RESBC_ADDR AAL5_BASE_ADDRESS+0xBC
#define AAL5_RESC0_ADDR AAL5_BASE_ADDRESS+0xC0
#define AAL5_RESC4_ADDR AAL5_BASE_ADDRESS+0xC4
#define AAL5_RESC8_ADDR AAL5_BASE_ADDRESS+0xC8
#define AAL5_RESCC_ADDR AAL5_BASE_ADDRESS+0xCC
#define AAL5_RESD0_ADDR AAL5_BASE_ADDRESS+0xD0
#define AAL5_RESD4_ADDR AAL5_BASE_ADDRESS+0xD4
#define AAL5_RESD8_ADDR AAL5_BASE_ADDRESS+0xD8
#define AAL5_RESDC_ADDR AAL5_BASE_ADDRESS+0xDC
#define AAL5_RESE0_ADDR AAL5_BASE_ADDRESS+0xE0
#define AAL5_RESE4_ADDR AAL5_BASE_ADDRESS+0xE4
#define AAL5_RESE8_ADDR AAL5_BASE_ADDRESS+0xE8
#define AAL5_RESEC_ADDR AAL5_BASE_ADDRESS+0xEC
#define AAL5_SSRC0_ADDR AAL5_BASE_ADDRESS+0xF0
#define AAL5_SSRC1_ADDR AAL5_BASE_ADDRESS+0xF4
#define AAL5_RSRC0_ADDR AAL5_BASE_ADDRESS+0xF8
#define AAL5_RSRC1_ADDR AAL5_BASE_ADDRESS+0xFC
#define AAL5S_ISR_QID_MASK 0xFF000000
#define AAL5S_ISR_SAB 0x00000100
#define AAL5S_ISR_SE 0x00000080
#define AAL5S_ISR_MFLE 0x00000040
#define AAL5S_ISR_SBE0 0x00000020
#define AAL5S_ISR_SEG0 0x00000010
#define AAL5S_ISR_TAB 0x00000004
#define AAL5_SIMR_MASK 0x000001c7
#define AAL5_SIMR_SAB 0x00000100
#define AAL5_SIMR_SE 0x00000080
#define AAL5_SIMR_MFLE 0x00000040
#define AAL5_SIMR_TAB 0x00000004
#define AAL5_SIMR_SBE0 0x00000002
#define AAL5_SIMR_SEG0 0x00000001
#define AAL5_SCMD_SEQCOUNT_MASK 0x0000ff00
#define AAL5_SCMD_MODE_POLL 0x00000008
#define AAL5_SCMD_MODE_COUNT 0x00000000
#define AAL5_SCMD_AS 0x00000004
#define AAL5_SCMD_SS 0x00000002
#define AAL5_SCMD_AR 0x00000001
#define AAL5R_ISR_CID_MASK 0xFF000000//ConnectionID
#define AAL5R_ISR_DBC_MASK 0x00FF0000//DiscardedByteCounter
#define AAL5R_ISR_END 0x00002000//End
#define AAL5R_ISR_ICID 0x00001000//InvalidConnectionID
#define AAL5R_ISR_CLP 0x00000800//CellLossPriority
#define AAL5R_ISR_CGST 0x00000400//Congestion
#define AAL5R_ISR_UUE 0x00000200//CPCSUUError
#define AAL5R_ISR_CPIE 0x00000100//CPIError
#define AAL5R_ISR_FE 0x00000080//FrameEnd
#define AAL5R_ISR_MFLE 0x00000040//MaximumFrameLengthExceeded
#define AAL5R_ISR_DBCE 0x00000020//DiscardedByteCounterExceeded
#define AAL5R_ISR_CRC 0x00000010//CRCError
#define AAL5R_ISR_ILEN 0x00000008//InvalidLength
#define AAL5R_ISR_RAB 0x00000004//ReceiveAbort
#define AAL5_RIMR1_MASK 0x00003ffc
#define AAL5_RIMR1_END 0x00002000//End
#define AAL5_RIMR1_ICID 0x00001000//InvalidConnectionID
#define AAL5_RIMR1_CLP 0x00000800//CellLossPriority
#define AAL5_RIMR1_CGST 0x00000400//Congestion
#define AAL5_RIMR1_UUE 0x00000200//CPCSUUError
#define AAL5_RIMR1_CPIE 0x00000100//CPIError
#define AAL5_RIMR1_FE 0x00000080//FrameEnd
#define AAL5_RIMR1_MFLE 0x00000040//MaximumFrameLengthExceeded
#define AAL5_RIMR1_DBCE 0x00000020//DiscardedByteCounterExceeded
#define AAL5_RIMR1_CRC 0x00000010//CRCError
#define AAL5_RIMR1_ILEN 0x00000008//InvalidLength
#define AAL5_RIMR1_RAB 0x00000004//ReceiveAbort
//AAL5 Reassambly Errors
#define AAL5_STW1_MASK 0x33//Error mask
#define AAL5_STW0_MASK 0x5c//Error mask
#define AAL5_STW0_BE 0x3//padding bytes mask
#define AAL5_STW1_CBM 0x20//Transfer from CBM to A5R abnormally ended
#define AAL5_STW1_CH 0x10//Invalid Channel number error
#define AAL5_STW1_CLP 0x8//CLP value of cells in packet is 1
#define AAL5_STW1_CG 0x4//Cell in packet expired congestion
#define AAL5_STW1_UU 0x2//CPCS-UU value error
#define AAL5_STW1_CPI 0x1//CPI value error
#define AAL5_STW0_FE 0x80//Frame end
#define AAL5_STW0_MFL 0x40//Maximum frame length error
#define AAL5_STW0_CRC 0x10//CRC error
#define AAL5_STW0_IL 0x8//Invalid length
#define AAL5_STW0_RA 0x4//Received abort
//CBM Registers
#define CBM_NRTTHR_ADDR CBM_BASE_ADDRESS+0x10//NonRealTimeThreshold
#define CBM_CLP0THR_ADDR CBM_BASE_ADDRESS+0x14//CLP0Threshold
#define CBM_CLP1THR_ADDR CBM_BASE_ADDRESS+0x18//CLP1Threshold
#define CBM_QDOFF_ADDR CBM_BASE_ADDRESS+0x1C//QueueDescriptorOffset
#define CBM_CFG_ADDR CBM_BASE_ADDRESS+0x20//Configuration
#define CBM_HWEXPAR0_ADDR CBM_BASE_ADDRESS+0x24//HWExtractParameter0
#define CBM_RES28_ADDR CBM_BASE_ADDRESS+0x28
#define CBM_WMSTAT0_ADDR CBM_BASE_ADDRESS+0x2C
#define CBM_HWEXCMD_ADDR CBM_BASE_ADDRESS+0x30//HWExtractCommand0
#define CBM_RES34_ADDR CBM_BASE_ADDRESS+0x34
#define CBM_HWEXSTAT0_ADDR CBM_BASE_ADDRESS+0x38//HWExtractStatus0
#define CBM_RES3C_ADDR CBM_BASE_ADDRESS+0x3C
#define CBM_RES40_ADDR CBM_BASE_ADDRESS+0x40
#define CBM_CNT_ADDR CBM_BASE_ADDRESS+0x44//CellCount
#define CBM_RES48_ADDR CBM_BASE_ADDRESS+0x48
#define CBM_LFR_ADDR CBM_BASE_ADDRESS+0x4C//PointertolastCellinfreeCellQueue
#define CBM_FFR_ADDR CBM_BASE_ADDRESS+0x50//PointertofirstCellinfreeCellQueue
#define CBM_RES54_ADDR CBM_BASE_ADDRESS+0x54
#define CBM_RES58_ADDR CBM_BASE_ADDRESS+0x58
#define CBM_RES5C_ADDR CBM_BASE_ADDRESS+0x5C
#define CBM_RES60_ADDR CBM_BASE_ADDRESS+0x60
#define CBM_RES64_ADDR CBM_BASE_ADDRESS+0x64
#define CBM_RES68_ADDR CBM_BASE_ADDRESS+0x68
#define CBM_RES6C_ADDR CBM_BASE_ADDRESS+0x6C
#define CBM_RES70_ADDR CBM_BASE_ADDRESS+0x70
#define CBM_RES74_ADDR CBM_BASE_ADDRESS+0x74
#define CBM_RES78_ADDR CBM_BASE_ADDRESS+0x78
#define CBM_RES7C_ADDR CBM_BASE_ADDRESS+0x7C
#define CBM_RES80_ADDR CBM_BASE_ADDRESS+0x80
#define CBM_RES84_ADDR CBM_BASE_ADDRESS+0x84
#define CBM_RES88_ADDR CBM_BASE_ADDRESS+0x88
#define CBM_RES8C_ADDR CBM_BASE_ADDRESS+0x8C
#define CBM_RES90_ADDR CBM_BASE_ADDRESS+0x90
#define CBM_RES94_ADDR CBM_BASE_ADDRESS+0x94
#define CBM_RES98_ADDR CBM_BASE_ADDRESS+0x98
#define CBM_RES9C_ADDR CBM_BASE_ADDRESS+0x9C
#define CBM_RESA0_ADDR CBM_BASE_ADDRESS+0xA0
#define CBM_RESA4_ADDR CBM_BASE_ADDRESS+0xA4
#define CBM_RESA8_ADDR CBM_BASE_ADDRESS+0xA8
#define CBM_RESAC_ADDR CBM_BASE_ADDRESS+0xAC
#define CBM_RESB0_ADDR CBM_BASE_ADDRESS+0xB0
#define CBM_RESB4_ADDR CBM_BASE_ADDRESS+0xB4
#define CBM_RESB8_ADDR CBM_BASE_ADDRESS+0xB8
#define CBM_RESBC_ADDR CBM_BASE_ADDRESS+0xBC
#define CBM_INTINF0_ADDR CBM_BASE_ADDRESS+0xC0//InterruptInfo0
#define CBM_INTCMD_ADDR CBM_BASE_ADDRESS+0xC4//InterruptCommand0
#define CBM_IMR0_ADDR CBM_BASE_ADDRESS+0xC8//InterruptMask
#define CBM_SRC0_ADDR CBM_BASE_ADDRESS+0xCC//ServiceRequestControl
#define CBM_RESD0_ADDR CBM_BASE_ADDRESS+0xD0
#define CBM_RESD4_ADDR CBM_BASE_ADDRESS+0xD4
#define CBM_RESD8_ADDR CBM_BASE_ADDRESS+0xD8
#define CBM_RESDC_ADDR CBM_BASE_ADDRESS+0xDC
#define CBM_RESE0_ADDR CBM_BASE_ADDRESS+0xE0
#define CBM_AAL5IDIS_ADDR CBM_BASE_ADDRESS+0xE4//MIB-No.EPDdiscardedpacketsupstream
#define CBM_AAL5ODIS_ADDR CBM_BASE_ADDRESS+0xE8//MIB-No.PPDdiscardedpacketsupstream
#define CBM_RESEC_ADDR CBM_BASE_ADDRESS+0xEC
#define CBM_RESF0_ADDR CBM_BASE_ADDRESS+0xF0
#define CBM_RESF4_ADDR CBM_BASE_ADDRESS+0xF4
#define CBM_RESF8_ADDR CBM_BASE_ADDRESS+0xF8
#define CBM_RESFC_ADDR CBM_BASE_ADDRESS+0xFC
//CBMCFG
#define CBM_CFG_INTLCK0EN 0x00000008
#define CBM_CFG_INT0HLT 0x00000004
#define CBM_CFG_START 0x00000001
#define CBM_HWEXPAR_PN_A5 0x00002000
#define CBM_HWEXPAR_PN_CM 0x00000000
#define CBM_HWEXPAR_SUBADD_PORTMASK 0x00000070
#define CBM_HWEXPAR_SUBADD_ADU 0x00000000
#define CBM_HWEXPAR_SUBADD_AAL2 0x00000080
#define CBM_HWEXPAR_SUBADD_SWIE 0x00000100
#define CBM_HWEXCMD_SFE2 0x00000100
#define CBM_HWEXCMD_FE2 0x00000080
#define CBM_HWEXCMD_SCE2 0x00000040
#define CBM_HWEXCMD_SFE1 0x00000020
#define CBM_HWEXCMD_FE1 0x00000010
#define CBM_HWEXCMD_SCE1 0x00000008
#define CBM_HWEXCMD_SFE0 0x00000004
#define CBM_HWEXCMD_FE0 0x00000002
#define CBM_HWEXCMD_SCE0 0x00000001
#define CBM_INTINF0_QID_MASK 0xFF000000
#define CBM_INTINF0_ORIGIN_MASK 0x00F00000
#define CBM_INTINF0_EF 0x00004000
#define CBM_INTINF0_ACA 0x00002000
#define CBM_INTINF0_ERR 0x00001000
#define CBM_INTINF0_DISC 0x00000800
#define CBM_INTINF0_QSBV 0x00000400
#define CBM_INTINF0_Q0E 0x00000200
#define CBM_INTINF0_Q0I 0x00000100
#define CBM_INTINF0_RDE 0x00000080
#define CBM_INTINF0_OPF 0x00000040
#define CBM_INTINF0_NFCA 0x00000020
#define CBM_INTINF0_CLP1TR 0x00000010
#define CBM_INTINF0_CLP0TR 0x00000008
#define CBM_INTINF0_NRTTR 0x00000004
#define CBM_INTINF0_QFD 0x00000002
#define CBM_INTINF0_QTR 0x00000001
#define CBM_INTINF0_QID_SHIFT 24
//CBM QD Word 3
#define CBM_QD_W3_QOS_0 0x00000000
#define CBM_QD_W3_QOS_1 0x40000000
#define CBM_QD_W3_QOS_2 0x80000000
#define CBM_QD_W3_QOS_3 0xc0000000
#define CBM_QD_W3_DIR_UP 0x20000000
#define CBM_QD_W3_DIR_DOWN 0x00000000
#define CBM_QD_W3_CLPt 0x10000000
#define CBM_QD_W3_RT 0x08000000
#define CBM_QD_W3_AAL5 0x04000000
#define CBM_QD_W3_INT_NOINT 0x00000000
#define CBM_QD_W3_INT_ACA 0x01000000
#define CBM_QD_W3_INT_EOF 0x02000000
#define CBM_QD_W3_INT_BOTH 0x03000000
#define CBM_QD_W3_THRESHOLD_MASK 0x00ff0000
#define CBM_QD_W3_WM_EN 0x00000010
#define CBM_QD_W3_HCR 0x00000008
#define CBM_QD_W3_SBID_MASK 0x00000001
#define CBM_QD_W3_THRESHOLD_SHIFT 16
//WATER MARK STATUS
#define CBM_WM_NRT_MASK 0x00040000
#define CBM_WM_CLP0_MASK 0x00020000
#define CBM_WM_CLP1_MASK 0x00010000
//CBMNRTTHR, CBMCLP0THR, CBMCLP0THR
#define CBM_NRT_WM_NONE 0x00000000//no water mark
#define CBM_WM_3_1 0x00010000//3/4 to set, 1/4 to release
#define CBM_WM_3_2 0x00020000//3/4 to set, 2/4 to release
#define CBM_WM_2_1 0x00030000//2/4 to set, 1/4 to release
#define CBM_THR_MASK 0x0000FFFF
#define CBM_IMR_MASK 0x0000fbff
#define CBM_IMR_reserved 0xFFFF0400
#define CBM_IMR_RFULL 0x00008000//EndofFrame
#define CBM_IMR_EF 0x00004000//EndofFrame
#define CBM_IMR_ACA 0x00002000//AnyCellArrived
#define CBM_IMR_ERR 0x00001000//FPI Error
#define CBM_IMR_DISC 0x00000800//Discard
#define CBM_IMR_reserved1 0x00000400//reserved
#define CBM_IMR_Q0E 0x00000200//Queue0Extract
#define CBM_IMR_Q0I 0x00000100//Queue0Insert
#define CBM_IMR_RDE 0x00000080//ReadEmptyQueue
#define CBM_IMR_OPF 0x00000040//OncePerFrame
#define CBM_IMR_NFCA 0x00000020//NoFreeCellAvailable
#define CBM_IMR_CLP1TR 0x00000010//CLP1ThresholdReached
#define CBM_IMR_CLP0TR 0x00000008//CLP0ThresholdReached
#define CBM_IMR_NRTTR 0x00000004//NonRealTimeThresholdReached
#define CBM_IMR_QFD 0x00000002//QueueFrameDiscard
#define CBM_IMR_QTR 0x00000001//QueueThresholdReached
#define CBM_EXSTAT_FB 0x00000010
#define CBM_EXSTAT_SCB 0x00000008
#define CBM_EXSTAT_Q0 0x00000004
#define CBM_EXSTAT_RDE 0x00000002
#define CBM_EXSTAT_QV 0x00000001
//HTU Registers
#define HTU_RX0_ADDR HTU_BASE_ADDRESS+0x10
#define HTU_RX1_ADDR HTU_BASE_ADDRESS+0x14
#define HTU_RES18_ADDR HTU_BASE_ADDRESS+0x18
#define HTU_RES1C_ADDR HTU_BASE_ADDRESS+0x1C
#define HTU_RES20_ADDR HTU_BASE_ADDRESS+0x20
#define HTU_RES24_ADDR HTU_BASE_ADDRESS+0x24
#define HTU_RES28_ADDR HTU_BASE_ADDRESS+0x28
#define HTU_RES2C_ADDR HTU_BASE_ADDRESS+0x2C
#define HTU_PCF0PAT_ADDR HTU_BASE_ADDRESS+0x30
#define HTU_PCF1PAT_ADDR HTU_BASE_ADDRESS+0x34
#define HTU_RES38_ADDR HTU_BASE_ADDRESS+0x38
#define HTU_RES3C_ADDR HTU_BASE_ADDRESS+0x3C
#define HTU_RES40_ADDR HTU_BASE_ADDRESS+0x40
#define HTU_RES44_ADDR HTU_BASE_ADDRESS+0x44
#define HTU_RES48_ADDR HTU_BASE_ADDRESS+0x48
#define HTU_RES4C_ADDR HTU_BASE_ADDRESS+0x4C
#define HTU_PCF0MASK_ADDR HTU_BASE_ADDRESS+0x50
#define HTU_PCF1MASK_ADDR HTU_BASE_ADDRESS+0x54
#define HTU_RES58_ADDR HTU_BASE_ADDRESS+0x58
#define HTU_RES5C_ADDR HTU_BASE_ADDRESS+0x5C
#define HTU_RES60_ADDR HTU_BASE_ADDRESS+0x60
#define HTU_RES64_ADDR HTU_BASE_ADDRESS+0x64
#define HTU_RES68_ADDR HTU_BASE_ADDRESS+0x68
#define HTU_RES6C_ADDR HTU_BASE_ADDRESS+0x6C
#define HTU_TIMEOUT_ADDR HTU_BASE_ADDRESS+0x70
#define HTU_DESTOAM_ADDR HTU_BASE_ADDRESS+0x74
#define HTU_DESTRM_ADDR HTU_BASE_ADDRESS+0x78
#define HTU_DESTOTHER_ADDR HTU_BASE_ADDRESS+0x7C
#define HTU_CFG_ADDR HTU_BASE_ADDRESS+0x80
#define HTU_RES84_ADDR HTU_BASE_ADDRESS+0x84
#define HTU_RES88_ADDR HTU_BASE_ADDRESS+0x88
#define HTU_RES8C_ADDR HTU_BASE_ADDRESS+0x8C
#define HTU_INFNOENTRY_ADDR HTU_BASE_ADDRESS+0x90
#define HTU_INFTIMEOUT_ADDR HTU_BASE_ADDRESS+0x94
#define HTU_RES98_STAT HTU_BASE_ADDRESS+0x98
#define HTU_RES9C_ADDR HTU_BASE_ADDRESS+0x9C
#define HTU_MIBCIUP HTU_BASE_ADDRESS+0xA0//MIB Counter In Unknown Protoc Register
#define HTU_CNTTIMEOUT_ADDR HTU_BASE_ADDRESS+0xA4
#define HTU_RESA8_ADDR HTU_BASE_ADDRESS+0xA8
#define HTU_RESAC_ADDR HTU_BASE_ADDRESS+0xAC
#define HTU_RAMADDR_ADDR HTU_BASE_ADDRESS+0xB0
#define HTU_RAMCMD_ADDR HTU_BASE_ADDRESS+0xB4
#define HTU_RAMSTAT_ADDR HTU_BASE_ADDRESS+0xB8
#define HTU_RESBC_ADDR HTU_BASE_ADDRESS+0xBC
#define HTU_RAMDAT1_ADDR HTU_BASE_ADDRESS+0xC0
#define HTU_RAMDAT2_ADDR HTU_BASE_ADDRESS+0xC4
#define HTU_RESCC_ADDR HTU_BASE_ADDRESS+0xCC
#define HTU_RESD0_ADDR HTU_BASE_ADDRESS+0xD0
#define HTU_RESD4_ADDR HTU_BASE_ADDRESS+0xD4
#define HTU_RESD8_ADDR HTU_BASE_ADDRESS+0xD8
#define HTU_RESDC_ADDR HTU_BASE_ADDRESS+0xDC
#define HTU_RESE0_ADDR HTU_BASE_ADDRESS+0xE0
#define HTU_RESE4_ADDR HTU_BASE_ADDRESS+0xE4
#define HTU_IMR0_ADDR HTU_BASE_ADDRESS+0xE8
#define HTU_RESEC_ADDR HTU_BASE_ADDRESS+0xEC
#define HTU_ISR0_ADDR HTU_BASE_ADDRESS+0xF0
#define HTU_RESF4_ADDR HTU_BASE_ADDRESS+0xF4
#define HTU_SRC0_ADDR HTU_BASE_ADDRESS+0xF8
#define HTU_RESFC_ADDR HTU_BASE_ADDRESS+0xFC
//HTU_CFG
#define HTU_CFG_START 0x00000001
#define HTU_RAMCMD_RMW 0x00000004
#define HTU_RAMCMD_RD 0x00000002
#define HTU_RAMCMD_WR 0x00000001
#define HTU_RAMDAT1_VCON 0x00000080//validconnection
#define HTU_RAMDAT1_VCT 0x00000040//vcivalueistransparent
#define HTU_RAMDAT1_QIDS 0x00000020//qid selects a cell in cbm
#define HTU_RAMDAT1_VCI3 0x00000010//vci3->oamqueue
#define HTU_RAMDAT1_VCI4 0x00000008//vci4->oamqueue
#define HTU_RAMDAT1_VCI6 0x00000004//vci6->rmqueue
#define HTU_RAMDAT1_PTI4 0x00000002//pti4->oamqueue
#define HTU_RAMDAT1_PTI5 0x00000001//pti5->oamqueue
#define HTU_RAMDAT2_PTI6 0x00000800
#define HTU_RAMDAT2_PTI7 0x00000400
#define HTU_RAMDAT2_F4U 0x00000200
#define HTU_RAMDAT2_F5U 0x00000100
#define HTU_RAMDAT2_QID_MASK 0x000000ff
#define HTU_ISR_NE 0x00000001
#define HTU_ISR_TORD 0x00000002
#define HTU_ISR_IT 0x00000008
#define HTU_ISR_OTOC 0x00000010
#define HTU_ISR_ONEC 0x00000020
#define HTU_ISR_PNE 0x00000040
#define HTU_ISR_PT 0x00000080
#define HTU_ISR_MASK 0x000000ff
//QSB Registers
#define QSB_BIP0_ADDR QSB_BASE_ADDRESS+0x00
#define QSB_BIP1_ADDR QSB_BASE_ADDRESS+0x04
#define QSB_BIP2_ADDR QSB_BASE_ADDRESS+0x08
#define QSB_BIP3_ADDR QSB_BASE_ADDRESS+0x0C
#define QSB_RSVP_ADDR QSB_BASE_ADDRESS+0x10
#define QSB_TNOW_ADDR QSB_BASE_ADDRESS+0x14
#define QSB_TNOWCYC_ADDR QSB_BASE_ADDRESS+0x18
#define QSB_TAU_ADDR QSB_BASE_ADDRESS+0x1C
#define QSB_L1BRS_ADDR QSB_BASE_ADDRESS+0x20
#define QSB_SBL_ADDR QSB_BASE_ADDRESS+0x24
#define QSB_CONFIG_ADDR QSB_BASE_ADDRESS+0x28
#define QSB_RTM_ADDR QSB_BASE_ADDRESS+0x2C
#define QSB_RTD_ADDR QSB_BASE_ADDRESS+0x30
#define QSB_RAMAC_ADDR QSB_BASE_ADDRESS+0x34
#define QSB_ISR_ADDR QSB_BASE_ADDRESS+0x38
#define QSB_IMR_ADDR QSB_BASE_ADDRESS+0x3C
#define QSB_SRC_ADDR QSB_BASE_ADDRESS+0x40
#define QSB_TABLESEL_QVPT 8
#define QSB_TABLESEL_QPT 1
#define QSB_TABLESEL_SCT 2
#define QSB_TABLESEL_SPT 3
#define QSB_TABLESEL_CALENDARWFQ 4/*notusedbyFW*/
#define QSB_TABLESEL_L2WFQ 5/*notusedbyFW*/
#define QSB_TABLESEL_CALENDARRS 6/*notusedbyFW*/
#define QSB_TABLESEL_L2BITMAPRS 7/*notusedbyFW*/
#define QSB_TABLESEL_SHIFT 24
#define QSB_TWFQ_MASK 0x3FFF0000
#define QSB_TPRS_MASK 0x0000FFFF
#define QSB_SBID_MASK 0xF
#define QSB_TWFQ_SHIFT 16
#define QSB_SCDRATE_MASK 0x00007FFF
#define QSB_SBVALID_MASK 0x80000000
#define QSB_ISR_WFQLE 0x00000001
#define QSB_ISR_WFQBE 0x00000002
#define QSB_ISR_RSLE 0x00000004
#define QSB_ISR_RSBE 0x00000008
#define QSB_ISR_MUXOV 0x00000010
#define QSB_ISR_CDVOV 0x00000020
#define QSB_ISR_PARAMI 0x00000040
#define QSB_ISR_SLOSS 0x00000080
#define QSB_ISR_IIPS 0x00000100
#define QSB_IMR_WFQLE 0x00000001
#define QSB_IMR_WFQBE 0x00000002
#define QSB_IMR_RSLE 0x00000004
#define QSB_IMR_RSBE 0x00000008
#define QSB_IMR_MUXOV 0x00000010
#define QSB_IMR_CDVOV 0x00000020
#define QSB_IMR_PARAMI 0x00000040
#define QSB_IMR_SLOSS 0x00000080
#define QSB_IMR_IIPS 0x00000100
#define QSB_READ 0x0
#define QSB_WRITE 0x80000000
#define QSB_READ_ALL 0xFFFFFFFF
#if 1 //some bug with QSB access mask
#define QSB_QPT_SET_MASK 0x0
#define QSB_QVPT_SET_MASK 0x0
#define QSB_SET_SCT_MASK 0x0
#define QSB_SET_SPT_MASK 0x0
#define QSB_SET_SPT_SBVALID_MASK 0x7FFFFFFF
#else //some bug with QSB access mask
#define QSB_QPT_SET_MASK 0x80000000
#define QSB_QVPT_SET_MASK 0x0
#define QSB_SET_SCT_MASK 0xFFFFFFE0
#define QSB_SET_SPT_MASK 0x7FF8C000
#define QSB_SET_SPT_SBVALID_MASK 0x7FFFFFFF
#endif //some bug with QSB access mask
#define QSB_SPT_SBVALID 0x80000000
#define QSB_RAMAC_REG_LOW 0x0
#define QSB_RAMAC_REG_HIGH 0x00010000
#define SRC_SRE_ENABLE 0x1000
#define SRC_CLRR 0x4000 //request clear bit
//SWIE Registers
#define SWIE_IQID_ADDR SWIE_BASE_ADDRESS+0x0c//SWIEInsertQueueDescriptor
#define SWIE_ICMD_ADDR SWIE_BASE_ADDRESS+0x10//SWIEInsertCommand
#define SWIE_ISTAT_ADDR SWIE_BASE_ADDRESS+0x14//SWIEInsertStatus
#define SWIE_ESTAT_ADDR SWIE_BASE_ADDRESS+0x18//SWIEExtractStatus
#define SWIE_ISRC_ADDR SWIE_BASE_ADDRESS+0x74//SWIEInsertServiceRequestControl
#define SWIE_ESRC_ADDR SWIE_BASE_ADDRESS+0x78//SWIEExtractServiceRequestControl
#define SWIE_ICELL_ADDR SWIE_BASE_ADDRESS+0x80//SWIEInsertCell(0x80-0xb4)
#define SWIE_ECELL_ADDR SWIE_BASE_ADDRESS+0xc0//SWIEExtractCell(0xc0-0xf4)
#define SWIE_ISTAT_DONE 0x1
#define SWIE_ESTAT_DONE 0x1
#define SWIE_ICMD_START 0x00000001//Startcommandforinsertion
#define SWIE_CBM_SCE0 CBM_HWEXCMD_SCE0//CBMcommandforSingle-Cell-Extract
#define SWIE_CBM_PID_SUBADDR 0x00001000//CBMPortIDandSubAddressforUTOPIA
//Extracted cell format
//52bytes AAL0 PDU + "Input cell additional data"(14bits)
#define SWIE_ADDITION_DATA_MASK 0x7fff
#define SWIE_EPORT_MASK 0x7000//Source ID (000 AUB0, 001 AUB1)
#define SWIE_EF4USER_MASK 0x800
#define SWIE_EF5USER_MASK 0x400
#define SWIE_EOAM_MASK 0x200
#define SWIE_EAUU_MASK 0x100
#define SWIE_EVCI3_MASK 0x80
#define SWIE_EVCI4_MASK 0x40
#define SWIE_EVCI6_MASK 0x20
#define SWIE_EPTI4_MASK 0x10
#define SWIE_EPTI5_MASK 0x8
#define SWIE_EPTI6_MASK 0x4
#define SWIE_EPTI7_MASK 0x2
#define SWIE_ECRC10ERROR_MASK 0x1
#define CBM_CELL_SIZE 0x40
#define CBM_QD_SIZE 0x10
#define AAL5R_TRAILER_LEN 12
#define AAL5S_INBOUND_HEADER 8
//constants
//TODO: to be finalized by system guys
//DMA QOS defined by ATM QoS Service type
#define DMA_RX_CH0 0
#define DMA_RX_CH1 1
#define DMA_TX_CH0 0
#define DMA_TX_CH1 1
#define CBR_DMA_QOS CBM_QD_W3_QOS_0
#define VBR_RT_DMA_QOS CBM_QD_W3_QOS_0
#define VBR_NRT_DMA_QOS CBM_QD_W3_QOS_0
#define UBR_PLUS_DMA_QOS CBM_QD_W3_QOS_0
#define UBR_DMA_QOS CBM_QD_W3_QOS_0
#define SRC_TOS_MIPS 0
#define AAL5R_SRPN 0x00000006//a5rneedshigherprioritythanDR
#define AAL5S_SRPN 0x00000005
#define CBM_MIPS_SRPN 0x00000004
#define QSB_SRPN 0x00000023
#define HTU_SRPN1 0x00000022
#define HTU_SRPN0 0x00000021
#endif //ATM_DEFINES_H

View File

@ -1,142 +0,0 @@
#ifndef AMAZON_ATM_MIB_H
#define AMAZON_ATM_MIB_H
#ifdef CONFIG_IFX_ATM_MIB
#include <asm/types.h>
#ifdef __KERNEL__
#include <linux/list.h>
#endif
#endif /* CONFIG_IFX_ATM_MIB */
#ifndef __KERNEL__
#include <atmMIB/local_list.h>
typedef unsigned int __u32;
#endif
typedef struct{
__u32 ifHCInOctets_h;
__u32 ifHCInOctets_l;
__u32 ifHCOutOctets_h;
__u32 ifHCOutOctets_l;
__u32 ifInErrors;
__u32 ifInUnknownProtos;
__u32 ifOutErrors;
}atm_cell_ifEntry_t;
typedef struct{
__u32 ifHCInOctets_h;
__u32 ifHCInOctets_l;
__u32 ifHCOutOctets_h;
__u32 ifHCOutOctets_l;
__u32 ifInUcastPkts;
__u32 ifOutUcastPkts;
__u32 ifInErrors;
__u32 ifInDiscards;
__u32 ifOutErros;
__u32 ifOutDiscards;
}atm_aal5_ifEntry_t;
typedef struct{
__u32 aal5VccCrcErrors;
__u32 aal5VccSarTimeOuts;//no timer support yet
__u32 aal5VccOverSizedSDUs;
}atm_aal5_vcc_t;
#if defined(CONFIG_IFX_ATM_MIB) || defined(IFX_CONFIG_SNMP_ATM_MIB)
/* ATM-MIB data structures */
typedef struct atmIfConfEntry {
int ifIndex;
int atmInterfaceMaxVpcs;
int atmInterfaceMaxVccs;
int atmInterfaceConfVpcs;
int atmInterfaceConfVccs;
int atmInterfaceMaxActiveVpiBits;
int atmInterfaceMaxActiveVciBits;
int atmInterfaceIlmiVpi;
int atmInterfaceIlmiVci;
int atmInterfaceAddressType;
char atmInterfaceAdminAddress[40];
unsigned long atmInterfaceMyNeighborIpAddress;
char atmInterfaceMyNeighborIfName[20];
int atmInterfaceCurrentMaxVpiBits;
int atmInterfaceCurrentMaxVciBits;
char atmInterfaceSubscrAddress[40];
int flags;
}atmIfConfEntry;
typedef struct atmTrafficDescParamEntry {
/* Following three parameters are used to update VCC QoS values */
int ifIndex;
short atmVclvpi;
int atmVclvci;
unsigned int atmTrafficParamIndex;
unsigned char traffic_class;
int max_pcr;
/* Subramani: Added min_pcr */
int min_pcr;
int cdv;
int scr;
int mbs;
int atmTrafficRowStatus;
int atmTrafficFrameDiscard;
struct list_head vpivci_head;
struct list_head list;
}atmTrafficDescParamEntry;
typedef struct atmVclEntry {
int ifIndex;
short atmVclvpi;
int atmVclvci;
char vpivci[20];
int atmVclAdminStatus;
int atmVclOperStatus;
unsigned long atmVclLastChange;
struct atmTrafficDescParamEntry *atmVclRxTrafficPtr;
struct atmTrafficDescParamEntry *atmVclTxTrafficPtr;
unsigned char atmVccAalType;
unsigned int atmVccAal5TxSduSize;
unsigned int atmVccAal5RxSduSize;
int atmVccAal5Encap;
int atmVclRowStatus;
int atmVclCastType;
int atmVclConnKind;
struct list_head list;
int flags;
}atmVclEntry;
typedef union union_atmptrs {
struct atmIfConfEntry *atmIfConfEntry_ptr;
struct atmTrafficDescParamEntry *atmTrafficDescParamEntry_ptr;
struct atmVclEntry *atmVclEntry_ptr;
}union_atmptrs;
/* ATM Character device major number */
#define ATM_MEI_MAJOR 107
/* Protocol Constants */
#define IFX_PROTO_RAW 0
#define IFX_PROTO_BR2684 1
#define IFX_PROTO_PPPOATM 2
#define IFX_PROTO_CLIP 3
/* IOCTL Command Set for ATM-MIB */
#define GET_ATM_IF_CONF_DATA 0x0AB0
#define SET_ATM_IF_CONF_DATA 0x0AB1
#define SET_ATM_QOS_DATA 0x0BC0
#define GET_ATM_VCL_DATA 0x0CD0
#define SET_ATM_VCL_DATA 0x0CD1
#define FIND_VCC_IN_KERNEL 0x0DE0
/* User defined flags for VCL Table */
#define ATMVCCAAL5CPCSTRANSMITSDUSIZE 9
#define ATMVCCAAL5CPCSRECEIVESDUSIZE 10
#endif /* CONFIG_IFX_ATM_MIB || IFX_CONFIG_SNMP_ATM_MIB */
#endif //AMAZON_ATM_MIB_H

View File

@ -1,96 +0,0 @@
//*************************************************************************
//* Summary of definitions which are used in each peripheral *
//*************************************************************************
#ifndef peripheral_definitions_h
#define peripheral_definitions_h
typedef unsigned char UINT8;
typedef signed char INT8;
typedef unsigned short UINT16;
typedef signed short INT16;
typedef unsigned int UINT32;
typedef signed int INT32;
typedef unsigned long long UINT64;
typedef signed long long INT64;
#define REG8( addr ) (*(volatile UINT8 *) (addr))
#define REG16( addr ) (*(volatile UINT16 *)(addr))
#define REG32( addr ) (*(volatile UINT32 *)(addr))
#define REG64( addr ) (*(volatile UINT64 *)(addr))
/* define routine to set FPI access in Supervisor Mode */
#define IFX_SUPERVISOR_ON() REG32(FB0_CFG) = 0x01
/* Supervisor mode ends, following functions will be done in User mode */
#define IFX_SUPERVISOR_OFF() REG32(FB0_CFG) = 0x00
/* Supervisor mode ends, following functions will be done in User mode */
#define IFX_SUPERVISOR_MODE() REG32(FB0_CFG)
/* Supervisor mode ends, following functions will be done in User mode */
#define IFX_SUPERVISOR_SET(svm) REG32(FB0_CFG) = svm
/* enable all Interrupts in IIU */
//#define IFX_ENABLE_IRQ(irq_mask, im_base) REG32(im_base | IIU_MASK) = irq_mask
///* get all high priority interrupt bits in IIU */
//#define IFX_GET_IRQ_MASKED(im_base) REG32(im_base | IIU_IRMASKED)
///* signal ends of interrupt to IIU */
//#define IFX_CLEAR_DIRECT_IRQ(irq_bit, im_base) REG32(im_base | IIU_IR) = irq_bit
///* force IIU interrupt register */
//#define IFX_FORCE_IIU_REGISTER(data, im_base) REG32(im_base | IIU_IRDEBUG) = data
///* get all bits of interrupt register */
//#define IFX_GET_IRQ_UNMASKED(im_base) REG32(im_base | IIU_IR)
/* insert a NOP instruction */
#define NOP _nop()
/* CPU goes to power down mode until interrupt occurs */
#define IFX_CPU_SLEEP _sleep()
/* enable all interrupts to CPU */
#define IFX_CPU_ENABLE_ALL_INTERRUPT sys_enable_int()
/* get all low priority interrupt bits in peripheral */
#define IFX_GET_LOW_PRIO_IRQ(int_reg) REG32(int_reg)
/* clear low priority interrupt bit in peripheral */
#define IFX_CLEAR_LOW_PRIO_IRQ(irq_bit, int_reg) REG32(int_reg) = irq_bit
/* write FPI bus */
#define WRITE_FPI_BYTE(data, addr) REG8(addr) = data
#define WRITE_FPI_16BIT(data, addr) REG16(addr) = data
#define WRITE_FPI_32BIT(data, addr) REG32(addr) = data
/* read FPI bus */
#define READ_FPI_BYTE(addr) REG8(addr)
#define READ_FPI_16BIT(addr) REG16(addr)
#define READ_FPI_32BIT(addr) REG32(addr)
/* write peripheral register */
#define WRITE_PERIPHERAL_REGISTER(data, addr) REG32(addr) = data
#ifdef CONFIG_CPU_LITTLE_ENDIAN
#define WRITE_PERIPHERAL_REGISTER_16(data, addr) REG16(addr) = data
#define WRITE_PERIPHERAL_REGISTER_8(data, addr) REG8(addr) = data
#else //not CONFIG_CPU_LITTLE_ENDIAN
#define WRITE_PERIPHERAL_REGISTER_16(data, addr) REG16(addr+2) = data
#define WRITE_PERIPHERAL_REGISTER_8(data, addr) REG8(addr+3) = data
#endif //CONFIG_CPU_LITTLE_ENDIAN
/* read peripheral register */
#define READ_PERIPHERAL_REGISTER(addr) REG32(addr)
/* read/modify(or)/write peripheral register */
#define RMW_OR_PERIPHERAL_REGISTER(data, addr) REG32(addr) = REG32(addr) | data
/* read/modify(and)/write peripheral register */
#define RMW_AND_PERIPHERAL_REGISTER(data, addr) REG32(addr) = REG32(addr) & (UINT32)data
/* CPU-independent mnemonic constants */
/* CLC register bits */
#define IFX_CLC_ENABLE 0x00000000
#define IFX_CLC_DISABLE 0x00000001
#define IFX_CLC_DISABLE_STATUS 0x00000002
#define IFX_CLC_SUSPEND_ENABLE 0x00000004
#define IFX_CLC_CLOCK_OFF_DISABLE 0x00000008
#define IFX_CLC_OVERWRITE_SPEN_FSOE 0x00000010
#define IFX_CLC_FAST_CLOCK_SWITCH_OFF 0x00000020
#define IFX_CLC_RUN_DIVIDER_MASK 0x0000FF00
#define IFX_CLC_RUN_DIVIDER_OFFSET 8
#define IFX_CLC_SLEEP_DIVIDER_MASK 0x00FF0000
#define IFX_CLC_SLEEP_DIVIDER_OFFSET 16
#define IFX_CLC_SPECIFIC_DIVIDER_MASK 0x00FF0000
#define IFX_CLC_SPECIFIC_DIVIDER_OFFSET 24
/* number of cycles to wait for interrupt service routine to be called */
#define WAIT_CYCLES 50
#endif /* PERIPHERAL_DEFINITIONS_H not yet defined */

View File

@ -1,263 +0,0 @@
/*
* ifx_ssc.h defines some data sructures used in ifx_ssc.c
*
* Copyright (C) 2004 Michael Schoenenborn (IFX COM TI BT)
*
*
*/
#ifndef __IFX_SSC_H
#define __IFX_SSC_H
#ifdef __KERNEL__
#include <asm/amazon/ifx_ssc_defines.h>
#endif //__KERNEL__
#define PORT_CNT 1 // assume default value
/* symbolic constants to be used in SSC routines */
// ### TO DO: bad performance
#define IFX_SSC_TXFIFO_ITL 1
#define IFX_SSC_RXFIFO_ITL 1
struct ifx_ssc_statistics{
unsigned int abortErr; /* abort error */
unsigned int modeErr; /* master/slave mode error */
unsigned int txOvErr; /* TX Overflow error */
unsigned int txUnErr; /* TX Underrun error */
unsigned int rxOvErr; /* RX Overflow error */
unsigned int rxUnErr; /* RX Underrun error */
unsigned int rxBytes;
unsigned int txBytes;
};
struct ifx_ssc_hwopts {
unsigned int AbortErrDetect :1; /* Abort Error detection (in slave mode) */
unsigned int rxOvErrDetect :1; /* Receive Overflow Error detection */
unsigned int rxUndErrDetect :1; /* Receive Underflow Error detection */
unsigned int txOvErrDetect :1; /* Transmit Overflow Error detection */
unsigned int txUndErrDetect :1; /* Transmit Underflow Error detection */
unsigned int echoMode :1; /* Echo mode */
unsigned int loopBack :1; /* Loopback mode */
unsigned int idleValue :1; /* Idle value */
unsigned int clockPolarity :1; /* Idle clock is high or low */
unsigned int clockPhase :1; /* Tx on trailing or leading edge*/
unsigned int headingControl :1; /* LSB first or MSB first */
unsigned int dataWidth :6; /* from 2 up to 32 bits */
unsigned int masterSelect :1; /* Master or Slave mode */
unsigned int modeRxTx :2; /* rx/tx mode */
unsigned int gpoCs :8; /* choose outputs to use for chip select */
unsigned int gpoInv :8; /* invert GPO outputs */
};
struct ifx_ssc_frm_opts {
bool FrameEnable; // SFCON.SFEN
unsigned int DataLength; // SFCON.DLEN
unsigned int PauseLength; // SFCON.PLEN
unsigned int IdleData; // SFCON.IDAT
unsigned int IdleClock; // SFCON.ICLK
bool StopAfterPause; // SFCON.STOP
};
struct ifx_ssc_frm_status {
bool DataBusy; // SFSTAT.DBSY
bool PauseBusy; // SFSTAT.PBSY
unsigned int DataCount; // SFSTAT.DCNT
unsigned int PauseCount; // SFSTAT.PCNT
bool EnIntAfterData; // SFCON.IBEN
bool EnIntAfterPause;// SFCON.IAEN
};
typedef struct {
char *buf;
size_t len;
} ifx_ssc_buf_item_t;
// data structures for batch execution
typedef union {
struct {
bool save_options;
} init;
ifx_ssc_buf_item_t read;
ifx_ssc_buf_item_t write;
ifx_ssc_buf_item_t rd_wr;
unsigned int set_baudrate;
struct ifx_ssc_frm_opts set_frm;
unsigned int set_gpo;
struct ifx_ssc_hwopts set_hwopts;
}ifx_ssc_batch_cmd_param;
struct ifx_ssc_batch_list {
unsigned int cmd;
ifx_ssc_batch_cmd_param cmd_param;
struct ifx_ssc_batch_list *next;
};
#ifdef __KERNEL__
#define IFX_SSC_IS_MASTER(p) ((p)->opts.masterSelect == SSC_MASTER_MODE)
struct ifx_ssc_port{
unsigned long mapbase;
struct ifx_ssc_hwopts opts;
struct ifx_ssc_statistics stats;
struct ifx_ssc_frm_status frm_status;
struct ifx_ssc_frm_opts frm_opts;
/* wait queue for ifx_ssc_read() */
wait_queue_head_t rwait, pwait;
int port_nr;
char port_is_open; /* exclusive open - boolean */
// int no_of_bits; /* number of _valid_ bits */
// int elem_size; /* shift for element (no of bytes)*/
/* buffer and pointers to the read/write position */
char *rxbuf; /* buffer for RX */
char *rxbuf_end; /* buffer end pointer for RX */
volatile char *rxbuf_ptr; /* buffer write pointer for RX */
char *txbuf; /* buffer for TX */
char *txbuf_end; /* buffer end pointer for TX */
volatile char *txbuf_ptr; /* buffer read pointer for TX */
unsigned int baud;
/* each channel has its own interrupts */
/* (transmit/receive/error/frame) */
unsigned int txirq, rxirq, errirq, frmirq;
};
/* default values for SSC configuration */
// values of CON
#define IFX_SSC_DEF_IDLE_DATA 1 /* enable */
#define IFX_SSC_DEF_BYTE_VALID_CTL 1 /* enable */
#define IFX_SSC_DEF_DATA_WIDTH 32 /* bits */
#define IFX_SSC_DEF_ABRT_ERR_DETECT 0 /* disable */
#define IFX_SSC_DEF_RO_ERR_DETECT 1 /* enable */
#define IFX_SSC_DEF_RU_ERR_DETECT 0 /* disable */
#define IFX_SSC_DEF_TO_ERR_DETECT 0 /* disable */
#define IFX_SSC_DEF_TU_ERR_DETECT 0 /* disable */
#define IFX_SSC_DEF_LOOP_BACK 0 /* disable */
#define IFX_SSC_DEF_ECHO_MODE 0 /* disable */
#define IFX_SSC_DEF_CLOCK_POLARITY 0 /* low */
#define IFX_SSC_DEF_CLOCK_PHASE 1 /* 0: shift on leading edge, latch on trailling edge, 1, otherwise */
#define IFX_SSC_DEF_HEADING_CONTROL IFX_SSC_MSB_FIRST
#define IFX_SSC_DEF_MODE_RXTX IFX_SSC_MODE_RXTX
// other values
#define IFX_SSC_DEF_MASTERSLAVE IFX_SSC_MASTER_MODE /* master */
#define IFX_SSC_DEF_BAUDRATE 1000000
#define IFX_SSC_DEF_RMC 0x10
#define IFX_SSC_DEF_TXFIFO_FL 8
#define IFX_SSC_DEF_RXFIFO_FL 1
#if 1 //TODO
#define IFX_SSC_DEF_GPO_CS 2 /* no chip select */
#define IFX_SSC_DEF_GPO_INV 0 /* no chip select */
#else
#error "what is ur Chip Select???"
#endif
#define IFX_SSC_DEF_SFCON 0 /* no serial framing */
#if 0
#define IFX_SSC_DEF_IRNEN IFX_SSC_T_BIT | /* enable all int's */\
IFX_SSC_R_BIT | IFX_SSC_E_BIT | IFX_SSC_F_BIT
#endif
#define IFX_SSC_DEF_IRNEN IFX_SSC_T_BIT | /* enable all int's */\
IFX_SSC_R_BIT | IFX_SSC_E_BIT
#endif /* __KERNEL__ */
// batch execution commands
#define IFX_SSC_BATCH_CMD_INIT 1
#define IFX_SSC_BATCH_CMD_READ 2
#define IFX_SSC_BATCH_CMD_WRITE 3
#define IFX_SSC_BATCH_CMD_RD_WR 4
#define IFX_SSC_BATCH_CMD_SET_BAUDRATE 5
#define IFX_SSC_BATCH_CMD_SET_HWOPTS 6
#define IFX_SSC_BATCH_CMD_SET_FRM 7
#define IFX_SSC_BATCH_CMD_SET_GPO 8
#define IFX_SSC_BATCH_CMD_FIFO_FLUSH 9
//#define IFX_SSC_BATCH_CMD_
//#define IFX_SSC_BATCH_CMD_
#define IFX_SSC_BATCH_CMD_END_EXEC 0
/* Macros to configure SSC hardware */
/* headingControl: */
#define IFX_SSC_LSB_FIRST 0
#define IFX_SSC_MSB_FIRST 1
/* dataWidth: */
#define IFX_SSC_MIN_DATA_WIDTH 2
#define IFX_SSC_MAX_DATA_WIDTH 32
/* master/slave mode select */
#define IFX_SSC_MASTER_MODE 1
#define IFX_SSC_SLAVE_MODE 0
/* rx/tx mode */
// ### TO DO: !!! ATTENTION! Hardware dependency => move to ifx_ssc_defines.h
#define IFX_SSC_MODE_RXTX 0
#define IFX_SSC_MODE_RX 1
#define IFX_SSC_MODE_TX 2
#define IFX_SSC_MODE_OFF 3
#define IFX_SSC_MODE_MASK IFX_SSC_MODE_RX | IFX_SSC_MODE_TX
/* GPO values */
#define IFX_SSC_MAX_GPO_OUT 7
#define IFX_SSC_RXREQ_BLOCK_SIZE 32768
/***********************/
/* defines for ioctl's */
/***********************/
#define IFX_SSC_IOCTL_MAGIC 'S'
/* read out the statistics */
#define IFX_SSC_STATS_READ _IOR(IFX_SSC_IOCTL_MAGIC, 1, struct ifx_ssc_statistics)
/* clear the statistics */
#define IFX_SSC_STATS_RESET _IO(IFX_SSC_IOCTL_MAGIC, 2)
/* set the baudrate */
#define IFX_SSC_BAUD_SET _IOW(IFX_SSC_IOCTL_MAGIC, 3, unsigned int)
/* get the current baudrate */
#define IFX_SSC_BAUD_GET _IOR(IFX_SSC_IOCTL_MAGIC, 4, unsigned int)
/* set hardware options */
#define IFX_SSC_HWOPTS_SET _IOW(IFX_SSC_IOCTL_MAGIC, 5, struct ifx_ssc_hwopts)
/* get the current hardware options */
#define IFX_SSC_HWOPTS_GET _IOR(IFX_SSC_IOCTL_MAGIC, 6, struct ifx_ssc_hwopts)
/* set transmission mode */
#define IFX_SSC_RXTX_MODE_SET _IOW(IFX_SSC_IOCTL_MAGIC, 7, unsigned int)
/* get the current transmission mode */
#define IFX_SSC_RXTX_MODE_GET _IOR(IFX_SSC_IOCTL_MAGIC, 8, unsigned int)
/* abort transmission */
#define IFX_SSC_ABORT _IO(IFX_SSC_IOCTL_MAGIC, 9)
#define IFX_SSC_FIFO_FLUSH _IO(IFX_SSC_IOCTL_MAGIC, 9)
/* set general purpose outputs */
#define IFX_SSC_GPO_OUT_SET _IOW(IFX_SSC_IOCTL_MAGIC, 32, unsigned int)
/* clear general purpose outputs */
#define IFX_SSC_GPO_OUT_CLR _IOW(IFX_SSC_IOCTL_MAGIC, 33, unsigned int)
/* get general purpose outputs */
#define IFX_SSC_GPO_OUT_GET _IOR(IFX_SSC_IOCTL_MAGIC, 34, unsigned int)
/*** serial framing ***/
/* get status of serial framing */
#define IFX_SSC_FRM_STATUS_GET _IOR(IFX_SSC_IOCTL_MAGIC, 48, struct ifx_ssc_frm_status)
/* get counter reload values and control bits */
#define IFX_SSC_FRM_CONTROL_GET _IOR(IFX_SSC_IOCTL_MAGIC, 49, struct ifx_ssc_frm_opts)
/* set counter reload values and control bits */
#define IFX_SSC_FRM_CONTROL_SET _IOW(IFX_SSC_IOCTL_MAGIC, 50, struct ifx_ssc_frm_opts)
/*** batch execution ***/
/* do batch execution */
#define IFX_SSC_BATCH_EXEC _IOW(IFX_SSC_IOCTL_MAGIC, 64, struct ifx_ssc_batch_list)
#ifdef __KERNEL__
// routines from ifx_ssc.c
// ### TO DO
/* kernel interface for read and write */
ssize_t ifx_ssc_kread(int, char *, size_t);
ssize_t ifx_ssc_kwrite(int, const char *, size_t);
#ifdef CONFIG_IFX_VP_KERNEL_TEST
void ifx_ssc_tc(void);
#endif // CONFIG_IFX_VP_KERNEL_TEST
#endif //__KERNEL__
#endif // __IFX_SSC_H

View File

@ -1,552 +0,0 @@
#ifndef IFX_SSC_DEFINES_H
#define IFX_SSC_DEFINES_H
#include "ifx_peripheral_definitions.h"
/* maximum SSC FIFO size */
#define IFX_SSC_MAX_FIFO_SIZE 32
/* register map of SSC */
/* address of the Clock Control Register of the SSC */
#define IFX_SSC_CLC 0x00000000
/* IFX_SSC_CLC register is significant in bits 23 downto 8 and in bits 5, 3, 2, 0
bit 1 is hardware modified*/
#define IFX_SSC_CLC_readmask 0x00FFFFEF
#define IFX_SSC_CLC_writemask 0x00FFFF3D
#define IFX_SSC_CLC_hwmask 0x00000002
#define IFX_SSC_CLC_dontcare (IFX_SSC_CLC_readmask & IFX_SSC_CLC_writemask & ~IFX_SSC_CLC_hwmask)
/* address of Port Input Select Register of the SSC */
#define IFX_SSC_PISEL 0x00000004
/* IFX_SSC_PISEL register is significant in lowest three bits only */
#define IFX_SSC_PISEL_readmask 0x00000007
#define IFX_SSC_PISEL_writemask 0x00000007
#define IFX_SSC_PISEL_hwmask 0x00000000
#define IFX_SSC_PISEL_dontcare (IFX_SSC_PISEL_readmask & IFX_SSC_PISEL_writemask & ~IFX_SSC_PISEL_hwmask)
/* address of Identification Register of the SSC */
#define IFX_SSC_ID 0x00000008
/* IFX_SSC_ID register is significant in no bit */
#define IFX_SSC_ID_readmask 0x0000FF3F
#define IFX_SSC_ID_writemask 0x00000000
#define IFX_SSC_ID_hwmask 0x00000000
#define IFX_SSC_ID_dontcare (IFX_SSC_ID_readmask & IFX_SSC_ID_writemask & ~IFX_SSC_ID_hwmask)
/* address of the Control Register of the SSC */
#define IFX_SSC_CON 0x00000010
/* IFX_SSC_CON register is significant in bits 23:22, 20:16 and 12:0 */
#define IFX_SSC_CON_readmask 0x01DF1FFF
#define IFX_SSC_CON_writemask 0x01DF1FFF
#define IFX_SSC_CON_hwmask 0x00000000
#define IFX_SSC_CON_dontcare (IFX_SSC_CON_readmask & IFX_SSC_CON_writemask & ~IFX_SSC_CON_hwmask)
/* address of the Status Register of the SSC */
#define IFX_SSC_STATE 0x00000014
/* IFX_SSC_STATE register is readable in bits 30:28, 26:24, 20:16, 12:7 and 2:0
all bits except 1:0 are hardware modified */
#define IFX_SSC_STATE_readmask 0x771F3F87
#define IFX_SSC_STATE_writemask 0x00000000
#define IFX_SSC_STATE_hwmask 0x771F3F84
#define IFX_SSC_STATE_dontcare (IFX_SSC_STATE_readmask & IFX_SSC_STATE_writemask & ~IFX_SSC_STATE_hwmask)
/* address of the Write Hardware Modified Control Register Bits of the SSC */
#define IFX_SSC_WHBSTATE 0x00000018
/* IFX_SSC_WHBSTATE register is write only */
#define IFX_SSC_WHBSTATE_readmask 0x00000000
#define IFX_SSC_WHBSTATE_writemask 0x0000FFFF
#define IFX_SSC_WHBSTATE_hwmask 0x00000000
#define IFX_SSC_WHBSTATE_dontcare (IFX_SSC_WHBSTATE_readmask & IFX_SSC_WHBSTATE_writemask & ~IFX_SSC_WHBSTATE_hwmask)
/* address of the Baudrate Timer Reload Register of the SSC */
#define IFX_SSC_BR 0x00000040
/* IFX_SSC_BR register is significant in bit 15 downto 0*/
#define IFX_SSC_BR_readmask 0x0000FFFF
#define IFX_SSC_BR_writemask 0x0000FFFF
#define IFX_SSC_BR_hwmask 0x00000000
#define IFX_SSC_BR_dontcare (IFX_SSC_BR_readmask & IFX_SSC_BR_writemask & ~IFX_SSC_BR_hwmask)
/* address of the Baudrate Timer Status Register of the SSC */
#define IFX_SSC_BRSTAT 0x00000044
/* IFX_SSC_BRSTAT register is significant in bit 15 downto 0*/
#define IFX_SSC_BRSTAT_readmask 0x0000FFFF
#define IFX_SSC_BRSTAT_writemask 0x00000000
#define IFX_SSC_BRSTAT_hwmask 0x0000FFFF
#define IFX_SSC_BRSTAT_dontcare (IFX_SSC_BRSTAT_readmask & IFX_SSC_BRSTAT_writemask & ~IFX_SSC_BRSTAT_hwmask)
/* address of the Transmitter Buffer Register of the SSC */
#define IFX_SSC_TB 0x00000020
/* IFX_SSC_TB register is significant in bit 31 downto 0*/
#define IFX_SSC_TB_readmask 0xFFFFFFFF
#define IFX_SSC_TB_writemask 0xFFFFFFFF
#define IFX_SSC_TB_hwmask 0x00000000
#define IFX_SSC_TB_dontcare (IFX_SSC_TB_readmask & IFX_SSC_TB_writemask & ~IFX_SSC_TB_hwmask)
/* address of the Reciver Buffer Register of the SSC */
#define IFX_SSC_RB 0x00000024
/* IFX_SSC_RB register is significant in no bits*/
#define IFX_SSC_RB_readmask 0xFFFFFFFF
#define IFX_SSC_RB_writemask 0x00000000
#define IFX_SSC_RB_hwmask 0xFFFFFFFF
#define IFX_SSC_RB_dontcare (IFX_SSC_RB_readmask & IFX_SSC_RB_writemask & ~IFX_SSC_RB_hwmask)
/* address of the Receive FIFO Control Register of the SSC */
#define IFX_SSC_RXFCON 0x00000030
/* IFX_SSC_RXFCON register is significant in bit 13 downto 8 and bit 1 downto 0 */
#define IFX_SSC_RXFCON_readmask 0x00003F03
#define IFX_SSC_RXFCON_writemask 0x00003F03
#define IFX_SSC_RXFCON_hwmask 0x00000000
#define IFX_SSC_RXFCON_dontcare (IFX_SSC_RXFCON_readmask & IFX_SSC_RXFCON_writemask & ~IFX_SSC_RXFCON_hwmask)
/* address of the Transmit FIFO Control Register of the SSC */
#define IFX_SSC_TXFCON 0x00000034
/* IFX_SSC_TXFCON register is significant in bit 13 downto 8 and bit 1 downto 0 */
#define IFX_SSC_TXFCON_readmask 0x00003F03
#define IFX_SSC_TXFCON_writemask 0x00003F03
#define IFX_SSC_TXFCON_hwmask 0x00000000
#define IFX_SSC_TXFCON_dontcare (IFX_SSC_TXFCON_readmask & IFX_SSC_TXFCON_writemask & ~IFX_SSC_TXFCON_hwmask)
/* address of the FIFO Status Register of the SSC */
#define IFX_SSC_FSTAT 0x00000038
/* IFX_SSC_FSTAT register is significant in no bit*/
#define IFX_SSC_FSTAT_readmask 0x00003F3F
#define IFX_SSC_FSTAT_writemask 0x00000000
#define IFX_SSC_FSTAT_hwmask 0x00003F3F
#define IFX_SSC_FSTAT_dontcare (IFX_SSC_FSTAT_readmask & IFX_SSC_FSTAT_writemask & ~IFX_SSC_FSTAT_hwmask)
/* address of the Data Frame Control register of the SSC */
#define IFX_SSC_SFCON 0x00000060
#define IFX_SSC_SFCON_readmask 0xFFDFFFFD
#define IFX_SSC_SFCON_writemask 0xFFDFFFFD
#define IFX_SSC_SFCON_hwmask 0x00000000
#define IFX_SSC_SFCON_dontcare (IFX_SSC_SFCON_readmask & IFX_SSC_SFCON_writemask & ~IFX_SSC_SFCON_hwmask)
/* address of the Data Frame Status register of the SSC */
#define IFX_SSC_SFSTAT 0x00000064
#define IFX_SSC_SFSTAT_readmask 0xFFC0FFF3
#define IFX_SSC_SFSTAT_writemask 0x00000000
#define IFX_SSC_SFSTAT_hwmask 0xFFC0FFF3
#define IFX_SSC_SFSTAT_dontcare (IFX_SSC_SFSTAT_readmask & IFX_SSC_SFSTAT_writemask & ~IFX_SSC_SFSTAT_hwmask)
/* address of the General Purpose Output Control register of the SSC */
#define IFX_SSC_GPOCON 0x00000070
#define IFX_SSC_GPOCON_readmask 0x0000FFFF
#define IFX_SSC_GPOCON_writemask 0x0000FFFF
#define IFX_SSC_GPOCON_hwmask 0x00000000
#define IFX_SSC_GPOCON_dontcare (IFX_SSC_GPOCON_readmask & IFX_SSC_GPOCON_writemask & ~IFX_SSC_GPOCON_hwmask)
/* address of the General Purpose Output Status register of the SSC */
#define IFX_SSC_GPOSTAT 0x00000074
#define IFX_SSC_GPOSTAT_readmask 0x000000FF
#define IFX_SSC_GPOSTAT_writemask 0x00000000
#define IFX_SSC_GPOSTAT_hwmask 0x00000000
#define IFX_SSC_GPOSTAT_dontcare (IFX_SSC_GPOSTAT_readmask & IFX_SSC_GPOSTAT_writemask & ~IFX_SSC_GPOSTAT_hwmask)
/* address of the Force GPO Status register of the SSC */
#define IFX_SSC_WHBGPOSTAT 0x00000078
#define IFX_SSC_WHBGPOSTAT_readmask 0x00000000
#define IFX_SSC_WHBGPOSTAT_writemask 0x0000FFFF
#define IFX_SSC_WHBGPOSTAT_hwmask 0x00000000
#define IFX_SSC_WHBGPOSTAT_dontcare (IFX_SSC_WHBGPOSTAT_readmask & IFX_SSC_WHBGPOSTAT_writemask & ~IFX_SSC_WHBGPOSTAT_hwmask)
/* address of the Receive Request Register of the SSC */
#define IFX_SSC_RXREQ 0x00000080
#define IFX_SSC_RXREQ_readmask 0x0000FFFF
#define IFX_SSC_RXREQ_writemask 0x0000FFFF
#define IFX_SSC_RXREQ_hwmask 0x00000000
#define IFX_SSC_RXREQ_dontcare (IFX_SSC_RXREQ_readmask & IFX_SSC_RXREQ_writemask & ~IFX_SSC_RXREQ_hwmask)
/* address of the Receive Count Register of the SSC */
#define IFX_SSC_RXCNT 0x00000084
#define IFX_SSC_RXCNT_readmask 0x0000FFFF
#define IFX_SSC_RXCNT_writemask 0x00000000
#define IFX_SSC_RXCNT_hwmask 0x0000FFFF
#define IFX_SSC_RXCNT_dontcare (IFX_SSC_RXCNT_readmask & IFX_SSC_RXCNT_writemask & ~IFX_SSC_RXCNT_hwmask)
/* address of the DMA Configuration Register of the SSC */
#define IFX_SSC_DMACON 0x000000EC
#define IFX_SSC_DMACON_readmask 0x0000FFFF
#define IFX_SSC_DMACON_writemask 0x00000000
#define IFX_SSC_DMACON_hwmask 0x0000FFFF
#define IFX_SSC_DMACON_dontcare (IFX_SSC_DMACON_readmask & IFX_SSC_DMACON_writemask & ~IFX_SSC_DMACON_hwmask)
//------------------------------------------------------
// interrupt register for enabling interrupts, mask register of irq_reg
#define IFX_SSC_IRN_EN 0xF4
// read/write
#define IFX_SSC_IRN_EN_readmask 0x0000000F
#define IFX_SSC_IRN_EN_writemask 0x0000000F
#define IFX_SSC_IRN_EN_hwmask 0x00000000
#define IFX_SSC_IRN_EN_dontcare (IFX_SSC_IRN_EN_readmask & IFX_SSC_IRN_EN_writemask & ~IFX_SSC_IRN_EN_hwmask)
// interrupt register for accessing interrupts
#define IFX_SSC_IRN_CR 0xF8
// read/write
#define IFX_SSC_IRN_CR_readmask 0x0000000F
#define IFX_SSC_IRN_CR_writemask 0x0000000F
#define IFX_SSC_IRN_CR_hwmask 0x0000000F
#define IFX_SSC_IRN_CR_dontcare (IFX_SSC_IRN_CR_readmask & IFX_SSC_IRN_CR_writemask & ~IFX_SSC_IRN_CR_hwmask)
// interrupt register for stimulating interrupts
#define IFX_SSC_IRN_ICR 0xFC
// read/write
#define IFX_SSC_IRN_ICR_readmask 0x0000000F
#define IFX_SSC_IRN_ICR_writemask 0x0000000F
#define IFX_SSC_IRN_ICR_hwmask 0x00000000
#define IFX_SSC_IRN_ICR_dontcare (IFX_SSC_IRN_ICR_readmask & IFX_SSC_IRN_ICR_writemask & ~IFX_SSC_IRN_ICR_hwmask)
//---------------------------------------------------------------------
// Number of IRQs and bitposition of IRQ
#define IFX_SSC_NUM_IRQ 4
#define IFX_SSC_T_BIT 0x00000001
#define IFX_SSC_R_BIT 0x00000002
#define IFX_SSC_E_BIT 0x00000004
#define IFX_SSC_F_BIT 0x00000008
/* bit masks for SSC registers */
/* ID register */
#define IFX_SSC_PERID_REV_MASK 0x0000001F
#define IFX_SSC_PERID_CFG_MASK 0x00000020
#define IFX_SSC_PERID_ID_MASK 0x0000FF00
#define IFX_SSC_PERID_REV_OFFSET 0
#define IFX_SSC_PERID_CFG_OFFSET 5
#define IFX_SSC_PERID_ID_OFFSET 8
#define IFX_SSC_PERID_ID 0x45
#define IFX_SSC_PERID_DMA_ON 0x00000020
#define IFX_SSC_PERID_RXFS_MASK 0x003F0000
#define IFX_SSC_PERID_RXFS_OFFSET 16
#define IFX_SSC_PERID_TXFS_MASK 0x3F000000
#define IFX_SSC_PERID_TXFS_OFFSET 24
/* PISEL register */
#define IFX_SSC_PISEL_MASTER_IN_A 0x0000
#define IFX_SSC_PISEL_MASTER_IN_B 0x0001
#define IFX_SSC_PISEL_SLAVE_IN_A 0x0000
#define IFX_SSC_PISEL_SLAVE_IN_B 0x0002
#define IFX_SSC_PISEL_CLOCK_IN_A 0x0000
#define IFX_SSC_PISEL_CLOCK_IN_B 0x0004
/* IFX_SSC_CON register */
#define IFX_SSC_CON_ECHO_MODE_ON 0x01000000
#define IFX_SSC_CON_ECHO_MODE_OFF 0x00000000
#define IFX_SSC_CON_IDLE_HIGH 0x00800000
#define IFX_SSC_CON_IDLE_LOW 0x00000000
#define IFX_SSC_CON_ENABLE_BYTE_VALID 0x00400000
#define IFX_SSC_CON_DISABLE_BYTE_VALID 0x00000000
#define IFX_SSC_CON_DATA_WIDTH_OFFSET 16
#define IFX_SSC_CON_DATA_WIDTH_MASK 0x001F0000
#define IFX_SSC_ENCODE_DATA_WIDTH(width) (((width - 1) << IFX_SSC_CON_DATA_WIDTH_OFFSET) & IFX_SSC_CON_DATA_WIDTH_MASK)
#define IFX_SSC_CON_RESET_ON_BAUDERR 0x00002000
#define IFX_SSC_CON_GO_ON_ON_BAUDERR 0x00000000
#define IFX_SSC_CON_RX_UFL_CHECK 0x00001000
#define IFX_SSC_CON_RX_UFL_IGNORE 0x00000000
#define IFX_SSC_CON_TX_UFL_CHECK 0x00000800
#define IFX_SSC_CON_TX_UFL_IGNORE 0x00000000
#define IFX_SSC_CON_ABORT_ERR_CHECK 0x00000400
#define IFX_SSC_CON_ABORT_ERR_IGNORE 0x00000000
#define IFX_SSC_CON_RX_OFL_CHECK 0x00000200
#define IFX_SSC_CON_RX_OFL_IGNORE 0x00000000
#define IFX_SSC_CON_TX_OFL_CHECK 0x00000100
#define IFX_SSC_CON_TX_OFL_IGNORE 0x00000000
#define IFX_SSC_CON_ALL_ERR_CHECK 0x00001F00
#define IFX_SSC_CON_ALL_ERR_IGNORE 0x00000000
#define IFX_SSC_CON_LOOPBACK_MODE 0x00000080
#define IFX_SSC_CON_NO_LOOPBACK 0x00000000
#define IFX_SSC_CON_HALF_DUPLEX 0x00000080
#define IFX_SSC_CON_FULL_DUPLEX 0x00000000
#define IFX_SSC_CON_CLOCK_FALL 0x00000040
#define IFX_SSC_CON_CLOCK_RISE 0x00000000
#define IFX_SSC_CON_SHIFT_THEN_LATCH 0x00000000
#define IFX_SSC_CON_LATCH_THEN_SHIFT 0x00000020
#define IFX_SSC_CON_MSB_FIRST 0x00000010
#define IFX_SSC_CON_LSB_FIRST 0x00000000
#define IFX_SSC_CON_ENABLE_CSB 0x00000008
#define IFX_SSC_CON_DISABLE_CSB 0x00000000
#define IFX_SSC_CON_INVERT_CSB 0x00000004
#define IFX_SSC_CON_TRUE_CSB 0x00000000
#define IFX_SSC_CON_RX_OFF 0x00000002
#define IFX_SSC_CON_RX_ON 0x00000000
#define IFX_SSC_CON_TX_OFF 0x00000001
#define IFX_SSC_CON_TX_ON 0x00000000
/* IFX_SSC_STATE register */
#define IFX_SSC_STATE_RX_BYTE_VALID_OFFSET 28
#define IFX_SSC_STATE_RX_BYTE_VALID_MASK 0x70000000
#define IFX_SSC_DECODE_RX_BYTE_VALID(con_state) ((con_state & IFX_SSC_STATE_RX_BYTE_VALID_MASK) >> IFX_SSC_STATE_RX_BYTE_VALID_OFFSET)
#define IFX_SSC_STATE_TX_BYTE_VALID_OFFSET 24
#define IFX_SSC_STATE_TX_BYTE_VALID_MASK 0x07000000
#define IFX_SSC_DECODE_TX_BYTE_VALID(con_state) ((con_state & IFX_SSC_STATE_TX_BYTE_VALID_MASK) >> IFX_SSC_STATE_TX_BYTE_VALID_OFFSET)
#define IFX_SSC_STATE_BIT_COUNT_OFFSET 16
#define IFX_SSC_STATE_BIT_COUNT_MASK 0x001F0000
#define IFX_SSC_DECODE_DATA_WIDTH(con_state) (((con_state & IFX_SSC_STATE_BIT_COUNT_MASK) >> IFX_SSC_STATE_BIT_COUNT_OFFSET) + 1)
#define IFX_SSC_STATE_BUSY 0x00002000
#define IFX_SSC_STATE_RX_UFL 0x00001000
#define IFX_SSC_STATE_TX_UFL 0x00000800
#define IFX_SSC_STATE_ABORT_ERR 0x00000400
#define IFX_SSC_STATE_RX_OFL 0x00000200
#define IFX_SSC_STATE_TX_OFL 0x00000100
#define IFX_SSC_STATE_MODE_ERR 0x00000080
#define IFX_SSC_STATE_SLAVE_IS_SELECTED 0x00000004
#define IFX_SSC_STATE_IS_MASTER 0x00000002
#define IFX_SSC_STATE_IS_ENABLED 0x00000001
/* WHBSTATE register */
#define IFX_SSC_WHBSTATE_DISABLE_SSC 0x0001
#define IFX_SSC_WHBSTATE_CONFIGURATION_MODE 0x0001
#define IFX_SSC_WHBSTATE_CLR_ENABLE 0x0001
#define IFX_SSC_WHBSTATE_ENABLE_SSC 0x0002
#define IFX_SSC_WHBSTATE_RUN_MODE 0x0002
#define IFX_SSC_WHBSTATE_SET_ENABLE 0x0002
#define IFX_SSC_WHBSTATE_SLAVE_MODE 0x0004
#define IFX_SSC_WHBSTATE_CLR_MASTER_SELECT 0x0004
#define IFX_SSC_WHBSTATE_MASTER_MODE 0x0008
#define IFX_SSC_WHBSTATE_SET_MASTER_SELECT 0x0008
#define IFX_SSC_WHBSTATE_CLR_RX_UFL_ERROR 0x0010
#define IFX_SSC_WHBSTATE_SET_RX_UFL_ERROR 0x0020
#define IFX_SSC_WHBSTATE_CLR_MODE_ERROR 0x0040
#define IFX_SSC_WHBSTATE_SET_MODE_ERROR 0x0080
#define IFX_SSC_WHBSTATE_CLR_TX_OFL_ERROR 0x0100
#define IFX_SSC_WHBSTATE_CLR_RX_OFL_ERROR 0x0200
#define IFX_SSC_WHBSTATE_CLR_ABORT_ERROR 0x0400
#define IFX_SSC_WHBSTATE_CLR_TX_UFL_ERROR 0x0800
#define IFX_SSC_WHBSTATE_SET_TX_OFL_ERROR 0x1000
#define IFX_SSC_WHBSTATE_SET_RX_OFL_ERROR 0x2000
#define IFX_SSC_WHBSTATE_SET_ABORT_ERROR 0x4000
#define IFX_SSC_WHBSTATE_SET_TX_UFL_ERROR 0x8000
#define IFX_SSC_WHBSTATE_CLR_ALL_ERROR 0x0F50
#define IFX_SSC_WHBSTATE_SET_ALL_ERROR 0xF0A0
/* BR register */
#define IFX_SSC_BR_BAUDRATE_OFFSET 0
#define IFX_SSC_BR_BAUDRATE_MASK 0xFFFF
/* BR_STAT register */
#define IFX_SSC_BRSTAT_BAUDTIMER_OFFSET 0
#define IFX_SSC_BRSTAT_BAUDTIMER_MASK 0xFFFF
/* TB register */
#define IFX_SSC_TB_DATA_OFFSET 0
#define IFX_SSC_TB_DATA_MASK 0xFFFFFFFF
/* RB register */
#define IFX_SSC_RB_DATA_OFFSET 0
#define IFX_SSC_RB_DATA_MASK 0xFFFFFFFF
/* RXFCON and TXFCON registers */
#define IFX_SSC_XFCON_FIFO_DISABLE 0x0000
#define IFX_SSC_XFCON_FIFO_ENABLE 0x0001
#define IFX_SSC_XFCON_FIFO_FLUSH 0x0002
#define IFX_SSC_XFCON_ITL_MASK 0x00003F00
#define IFX_SSC_XFCON_ITL_OFFSET 8
/* FSTAT register */
#define IFX_SSC_FSTAT_RECEIVED_WORDS_OFFSET 0
#define IFX_SSC_FSTAT_RECEIVED_WORDS_MASK 0x003F
#define IFX_SSC_FSTAT_TRANSMIT_WORDS_OFFSET 8
#define IFX_SSC_FSTAT_TRANSMIT_WORDS_MASK 0x3F00
/* GPOCON register */
#define IFX_SSC_GPOCON_INVOUT0_POS 0
#define IFX_SSC_GPOCON_INV_OUT0 0x00000001
#define IFX_SSC_GPOCON_TRUE_OUT0 0x00000000
#define IFX_SSC_GPOCON_INVOUT1_POS 1
#define IFX_SSC_GPOCON_INV_OUT1 0x00000002
#define IFX_SSC_GPOCON_TRUE_OUT1 0x00000000
#define IFX_SSC_GPOCON_INVOUT2_POS 2
#define IFX_SSC_GPOCON_INV_OUT2 0x00000003
#define IFX_SSC_GPOCON_TRUE_OUT2 0x00000000
#define IFX_SSC_GPOCON_INVOUT3_POS 3
#define IFX_SSC_GPOCON_INV_OUT3 0x00000008
#define IFX_SSC_GPOCON_TRUE_OUT3 0x00000000
#define IFX_SSC_GPOCON_INVOUT4_POS 4
#define IFX_SSC_GPOCON_INV_OUT4 0x00000010
#define IFX_SSC_GPOCON_TRUE_OUT4 0x00000000
#define IFX_SSC_GPOCON_INVOUT5_POS 5
#define IFX_SSC_GPOCON_INV_OUT5 0x00000020
#define IFX_SSC_GPOCON_TRUE_OUT5 0x00000000
#define IFX_SSC_GPOCON_INVOUT6_POS 6
#define IFX_SSC_GPOCON_INV_OUT6 0x00000040
#define IFX_SSC_GPOCON_TRUE_OUT6 0x00000000
#define IFX_SSC_GPOCON_INVOUT7_POS 7
#define IFX_SSC_GPOCON_INV_OUT7 0x00000080
#define IFX_SSC_GPOCON_TRUE_OUT7 0x00000000
#define IFX_SSC_GPOCON_INV_OUT_ALL 0x000000FF
#define IFX_SSC_GPOCON_TRUE_OUT_ALL 0x00000000
#define IFX_SSC_GPOCON_ISCSB0_POS 8
#define IFX_SSC_GPOCON_IS_CSB0 0x00000100
#define IFX_SSC_GPOCON_IS_GPO0 0x00000000
#define IFX_SSC_GPOCON_ISCSB1_POS 9
#define IFX_SSC_GPOCON_IS_CSB1 0x00000200
#define IFX_SSC_GPOCON_IS_GPO1 0x00000000
#define IFX_SSC_GPOCON_ISCSB2_POS 10
#define IFX_SSC_GPOCON_IS_CSB2 0x00000400
#define IFX_SSC_GPOCON_IS_GPO2 0x00000000
#define IFX_SSC_GPOCON_ISCSB3_POS 11
#define IFX_SSC_GPOCON_IS_CSB3 0x00000800
#define IFX_SSC_GPOCON_IS_GPO3 0x00000000
#define IFX_SSC_GPOCON_ISCSB4_POS 12
#define IFX_SSC_GPOCON_IS_CSB4 0x00001000
#define IFX_SSC_GPOCON_IS_GPO4 0x00000000
#define IFX_SSC_GPOCON_ISCSB5_POS 13
#define IFX_SSC_GPOCON_IS_CSB5 0x00002000
#define IFX_SSC_GPOCON_IS_GPO5 0x00000000
#define IFX_SSC_GPOCON_ISCSB6_POS 14
#define IFX_SSC_GPOCON_IS_CSB6 0x00004000
#define IFX_SSC_GPOCON_IS_GPO6 0x00000000
#define IFX_SSC_GPOCON_ISCSB7_POS 15
#define IFX_SSC_GPOCON_IS_CSB7 0x00008000
#define IFX_SSC_GPOCON_IS_GPO7 0x00000000
#define IFX_SSC_GPOCON_IS_CSB_ALL 0x0000FF00
#define IFX_SSC_GPOCON_IS_GPO_ALL 0x00000000
/* GPOSTAT register */
#define IFX_SSC_GPOSTAT_OUT0 0x00000001
#define IFX_SSC_GPOSTAT_OUT1 0x00000002
#define IFX_SSC_GPOSTAT_OUT2 0x00000004
#define IFX_SSC_GPOSTAT_OUT3 0x00000008
#define IFX_SSC_GPOSTAT_OUT4 0x00000010
#define IFX_SSC_GPOSTAT_OUT5 0x00000020
#define IFX_SSC_GPOSTAT_OUT6 0x00000040
#define IFX_SSC_GPOSTAT_OUT7 0x00000080
#define IFX_SSC_GPOSTAT_OUT_ALL 0x000000FF
/* WHBGPOSTAT register */
#define IFX_SSC_WHBGPOSTAT_CLROUT0_POS 0
#define IFX_SSC_WHBGPOSTAT_CLR_OUT0 0x00000001
#define IFX_SSC_WHBGPOSTAT_CLROUT1_POS 1
#define IFX_SSC_WHBGPOSTAT_CLR_OUT1 0x00000002
#define IFX_SSC_WHBGPOSTAT_CLROUT2_POS 2
#define IFX_SSC_WHBGPOSTAT_CLR_OUT2 0x00000004
#define IFX_SSC_WHBGPOSTAT_CLROUT3_POS 3
#define IFX_SSC_WHBGPOSTAT_CLR_OUT3 0x00000008
#define IFX_SSC_WHBGPOSTAT_CLROUT4_POS 4
#define IFX_SSC_WHBGPOSTAT_CLR_OUT4 0x00000010
#define IFX_SSC_WHBGPOSTAT_CLROUT5_POS 5
#define IFX_SSC_WHBGPOSTAT_CLR_OUT5 0x00000020
#define IFX_SSC_WHBGPOSTAT_CLROUT6_POS 6
#define IFX_SSC_WHBGPOSTAT_CLR_OUT6 0x00000040
#define IFX_SSC_WHBGPOSTAT_CLROUT7_POS 7
#define IFX_SSC_WHBGPOSTAT_CLR_OUT7 0x00000080
#define IFX_SSC_WHBGPOSTAT_CLR_OUT_ALL 0x000000FF
#define IFX_SSC_WHBGPOSTAT_OUT0_POS 0
#define IFX_SSC_WHBGPOSTAT_OUT1_POS 1
#define IFX_SSC_WHBGPOSTAT_OUT2_POS 2
#define IFX_SSC_WHBGPOSTAT_OUT3_POS 3
#define IFX_SSC_WHBGPOSTAT_OUT4_POS 4
#define IFX_SSC_WHBGPOSTAT_OUT5_POS 5
#define IFX_SSC_WHBGPOSTAT_OUT6_POS 6
#define IFX_SSC_WHBGPOSTAT_OUT7_POS 7
#define IFX_SSC_WHBGPOSTAT_SETOUT0_POS 8
#define IFX_SSC_WHBGPOSTAT_SET_OUT0 0x00000100
#define IFX_SSC_WHBGPOSTAT_SETOUT1_POS 9
#define IFX_SSC_WHBGPOSTAT_SET_OUT1 0x00000200
#define IFX_SSC_WHBGPOSTAT_SETOUT2_POS 10
#define IFX_SSC_WHBGPOSTAT_SET_OUT2 0x00000400
#define IFX_SSC_WHBGPOSTAT_SETOUT3_POS 11
#define IFX_SSC_WHBGPOSTAT_SET_OUT3 0x00000800
#define IFX_SSC_WHBGPOSTAT_SETOUT4_POS 12
#define IFX_SSC_WHBGPOSTAT_SET_OUT4 0x00001000
#define IFX_SSC_WHBGPOSTAT_SETOUT5_POS 13
#define IFX_SSC_WHBGPOSTAT_SET_OUT5 0x00002000
#define IFX_SSC_WHBGPOSTAT_SETOUT6_POS 14
#define IFX_SSC_WHBGPOSTAT_SET_OUT6 0x00004000
#define IFX_SSC_WHBGPOSTAT_SETOUT7_POS 15
#define IFX_SSC_WHBGPOSTAT_SET_OUT7 0x00008000
#define IFX_SSC_WHBGPOSTAT_SET_OUT_ALL 0x0000FF00
/* SFCON register */
#define IFX_SSC_SFCON_SF_ENABLE 0x00000001
#define IFX_SSC_SFCON_SF_DISABLE 0x00000000
#define IFX_SSC_SFCON_FIR_ENABLE_BEFORE_PAUSE 0x00000004
#define IFX_SSC_SFCON_FIR_DISABLE_BEFORE_PAUSE 0x00000000
#define IFX_SSC_SFCON_FIR_ENABLE_AFTER_PAUSE 0x00000008
#define IFX_SSC_SFCON_FIR_DISABLE_AFTER_PAUSE 0x00000000
#define IFX_SSC_SFCON_DATA_LENGTH_MASK 0x0000FFF0
#define IFX_SSC_SFCON_DATA_LENGTH_OFFSET 4
#define IFX_SSC_SFCON_PAUSE_DATA_MASK 0x00030000
#define IFX_SSC_SFCON_PAUSE_DATA_OFFSET 16
#define IFX_SSC_SFCON_PAUSE_DATA_0 0x00000000
#define IFX_SSC_SFCON_PAUSE_DATA_1 0x00010000
#define IFX_SSC_SFCON_PAUSE_DATA_IDLE 0x00020000
#define IFX_SSC_SFCON_PAUSE_CLOCK_MASK 0x000C0000
#define IFX_SSC_SFCON_PAUSE_CLOCK_OFFSET 18
#define IFX_SSC_SFCON_PAUSE_CLOCK_0 0x00000000
#define IFX_SSC_SFCON_PAUSE_CLOCK_1 0x00040000
#define IFX_SSC_SFCON_PAUSE_CLOCK_IDLE 0x00080000
#define IFX_SSC_SFCON_PAUSE_CLOCK_RUN 0x000C0000
#define IFX_SSC_SFCON_STOP_AFTER_PAUSE 0x00100000
#define IFX_SSC_SFCON_CONTINUE_AFTER_PAUSE 0x00000000
#define IFX_SSC_SFCON_PAUSE_LENGTH_MASK 0xFFC00000
#define IFX_SSC_SFCON_PAUSE_LENGTH_OFFSET 22
#define IFX_SSC_SFCON_DATA_LENGTH_MAX 4096
#define IFX_SSC_SFCON_PAUSE_LENGTH_MAX 1024
#define IFX_SSC_SFCON_EXTRACT_DATA_LENGTH(sfcon) ((sfcon & IFX_SSC_SFCON_DATA_LENGTH_MASK) >> IFX_SSC_SFCON_DATA_LENGTH_OFFSET)
#define IFX_SSC_SFCON_EXTRACT_PAUSE_LENGTH(sfcon) ((sfcon & IFX_SSC_SFCON_PAUSE_LENGTH_MASK) >> IFX_SSC_SFCON_PAUSE_LENGTH_OFFSET)
#define IFX_SSC_SFCON_SET_DATA_LENGTH(value) ((value << IFX_SSC_SFCON_DATA_LENGTH_OFFSET) & IFX_SSC_SFCON_DATA_LENGTH_MASK)
#define IFX_SSC_SFCON_SET_PAUSE_LENGTH(value) ((value << IFX_SSC_SFCON_PAUSE_LENGTH_OFFSET) & IFX_SSC_SFCON_PAUSE_LENGTH_MASK)
/* SFSTAT register */
#define IFX_SSC_SFSTAT_IN_DATA 0x00000001
#define IFX_SSC_SFSTAT_IN_PAUSE 0x00000002
#define IFX_SSC_SFSTAT_DATA_COUNT_MASK 0x0000FFF0
#define IFX_SSC_SFSTAT_DATA_COUNT_OFFSET 4
#define IFX_SSC_SFSTAT_PAUSE_COUNT_MASK 0xFFF00000
#define IFX_SSC_SFSTAT_PAUSE_COUNT_OFFSET 20
#define IFX_SSC_SFSTAT_EXTRACT_DATA_COUNT(sfstat) ((sfstat & IFX_SSC_SFSTAT_DATA_COUNT_MASK) >> IFX_SSC_SFSTAT_DATA_COUNT_OFFSET)
#define IFX_SSC_SFSTAT_EXTRACT_PAUSE_COUNT(sfstat) ((sfstat & IFX_SSC_SFSTAT_PAUSE_COUNT_MASK) >> IFX_SSC_SFSTAT_PAUSE_COUNT_OFFSET)
/* RXREQ register */
#define IFX_SSC_RXREQ_RXCOUNT_MASK 0x0000FFFF
#define IFX_SSC_RXREQ_RXCOUNT_OFFSET 0
/* RXCNT register */
#define IFX_SSC_RXCNT_TODO_MASK 0x0000FFFF
#define IFX_SSC_RXCNT_TODO_OFFSET 0
/* DMACON register */
#define IFX_SSC_DMACON_RXON 0x00000001
#define IFX_SSC_DMACON_RXOFF 0x00000000
#define IFX_SSC_DMACON_TXON 0x00000002
#define IFX_SSC_DMACON_TXOFF 0x00000000
#define IFX_SSC_DMACON_DMAON 0x00000003
#define IFX_SSC_DMACON_DMAOFF 0x00000000
#define IFX_SSC_DMACON_CLASS_MASK 0x0000000C
#define IFX_SSC_DMACON_CLASS_OFFSET 2
/* register access macros */
#define ifx_ssc_fstat_received_words(status) (status & 0x003F)
#define ifx_ssc_fstat_words_to_transmit(status) ((status & 0x3F00) >> 8)
#define ifx_ssc_change_status(data, addr) WRITE_PERIPHERAL_REGISTER(data, (PHYS_OFFSET + addr + IFX_SSC_WHBSTATE))
#define ifx_ssc_set_config(data, addr) WRITE_PERIPHERAL_REGISTER(data, (PHYS_OFFSET + addr + IFX_SSC_CON))
#define ifx_ssc_get_config(addr) READ_PERIPHERAL_REGISTER((PHYS_OFFSET + addr + IFX_SSC_CON))
#define ifx_ssc_get_status(addr) READ_PERIPHERAL_REGISTER((PHYS_OFFSET + addr + IFX_SSC_STATE))
#define ifx_ssc_receive(addr) READ_PERIPHERAL_REGISTER((PHYS_OFFSET + addr + IFX_SSC_RB))
#define ifx_ssc_transmit(data, addr) WRITE_PERIPHERAL_REGISTER(data, (PHYS_OFFSET + addr + IFX_SSC_TB))
#define ifx_ssc_fifo_status(addr) READ_PERIPHERAL_REGISTER((PHYS_OFFSET + addr + IFX_SSC_FSTAT))
#define ifx_ssc_set_baudrate(data, addr) WRITE_PERIPHERAL_REGISTER(data, (PHYS_OFFSET + addr + IFX_SSC_BR))
#define ifx_ssc_extract_rx_fifo_size(id) ((id & IFX_SSC_PERID_RXFS_MASK) >> IFX_SSC_PERID_RXFS_OFFSET)
#define ifx_ssc_extract_tx_fifo_size(id) ((id & IFX_SSC_PERID_TXFS_MASK) >> IFX_SSC_PERID_TXFS_OFFSET)
#endif

View File

@ -1,200 +0,0 @@
/* irq.h - AMAZON interrupts */
#ifndef __AMAZON_IRQ
#define __AMAZON_IRQ
/************************************************************************
* Interrupt information
*************************************************************************/
/* these vectors are to handle the interrupts from the internal AMAZON
interrupt controller. THe INT_NUM values are really just indices into
an array and are set up so that we can use the INT_NUM as a shift
to calculate a mask value. */
#define INT_NUM_IRQ0 8
#define INT_NUM_IM0_IRL0 (INT_NUM_IRQ0 + 0)
#define INT_NUM_IM0_IRL1 (INT_NUM_IRQ0 + 1)
#define INT_NUM_IM0_IRL2 (INT_NUM_IRQ0 + 2)
#define INT_NUM_IM0_IRL3 (INT_NUM_IRQ0 + 3)
#define INT_NUM_IM0_IRL4 (INT_NUM_IRQ0 + 4)
#define INT_NUM_IM0_IRL5 (INT_NUM_IRQ0 + 5)
#define INT_NUM_IM0_IRL6 (INT_NUM_IRQ0 + 6)
#define INT_NUM_IM0_IRL7 (INT_NUM_IRQ0 + 7)
#define INT_NUM_IM0_IRL8 (INT_NUM_IRQ0 + 8)
#define INT_NUM_IM0_IRL9 (INT_NUM_IRQ0 + 9)
#define INT_NUM_IM0_IRL10 (INT_NUM_IRQ0 + 10)
#define INT_NUM_IM0_IRL11 (INT_NUM_IRQ0 + 11)
#define INT_NUM_IM0_IRL12 (INT_NUM_IRQ0 + 12)
#define INT_NUM_IM0_IRL13 (INT_NUM_IRQ0 + 13)
#define INT_NUM_IM0_IRL14 (INT_NUM_IRQ0 + 14)
#define INT_NUM_IM0_IRL15 (INT_NUM_IRQ0 + 15)
#define INT_NUM_IM0_IRL16 (INT_NUM_IRQ0 + 16)
#define INT_NUM_IM0_IRL17 (INT_NUM_IRQ0 + 17)
#define INT_NUM_IM0_IRL18 (INT_NUM_IRQ0 + 18)
#define INT_NUM_IM0_IRL19 (INT_NUM_IRQ0 + 19)
#define INT_NUM_IM0_IRL20 (INT_NUM_IRQ0 + 20)
#define INT_NUM_IM0_IRL21 (INT_NUM_IRQ0 + 21)
#define INT_NUM_IM0_IRL22 (INT_NUM_IRQ0 + 22)
#define INT_NUM_IM0_IRL23 (INT_NUM_IRQ0 + 23)
#define INT_NUM_IM0_IRL24 (INT_NUM_IRQ0 + 24)
#define INT_NUM_IM0_IRL25 (INT_NUM_IRQ0 + 25)
#define INT_NUM_IM0_IRL26 (INT_NUM_IRQ0 + 26)
#define INT_NUM_IM0_IRL27 (INT_NUM_IRQ0 + 27)
#define INT_NUM_IM0_IRL28 (INT_NUM_IRQ0 + 28)
#define INT_NUM_IM0_IRL29 (INT_NUM_IRQ0 + 29)
#define INT_NUM_IM0_IRL30 (INT_NUM_IRQ0 + 30)
#define INT_NUM_IM0_IRL31 (INT_NUM_IRQ0 + 31)
#define INT_NUM_IM1_IRL0 (INT_NUM_IRQ0 + 32)
#define INT_NUM_IM1_IRL1 (INT_NUM_IM1_IRL0 + 1)
#define INT_NUM_IM1_IRL2 (INT_NUM_IM1_IRL0 + 2)
#define INT_NUM_IM1_IRL3 (INT_NUM_IM1_IRL0 + 3)
#define INT_NUM_IM1_IRL4 (INT_NUM_IM1_IRL0 + 4)
#define INT_NUM_IM1_IRL5 (INT_NUM_IM1_IRL0 + 5)
#define INT_NUM_IM1_IRL6 (INT_NUM_IM1_IRL0 + 6)
#define INT_NUM_IM1_IRL7 (INT_NUM_IM1_IRL0 + 7)
#define INT_NUM_IM1_IRL8 (INT_NUM_IM1_IRL0 + 8)
#define INT_NUM_IM1_IRL9 (INT_NUM_IM1_IRL0 + 9)
#define INT_NUM_IM1_IRL10 (INT_NUM_IM1_IRL0 + 10)
#define INT_NUM_IM1_IRL11 (INT_NUM_IM1_IRL0 + 11)
#define INT_NUM_IM1_IRL12 (INT_NUM_IM1_IRL0 + 12)
#define INT_NUM_IM1_IRL13 (INT_NUM_IM1_IRL0 + 13)
#define INT_NUM_IM1_IRL14 (INT_NUM_IM1_IRL0 + 14)
#define INT_NUM_IM1_IRL15 (INT_NUM_IM1_IRL0 + 15)
#define INT_NUM_IM1_IRL16 (INT_NUM_IM1_IRL0 + 16)
#define INT_NUM_IM1_IRL17 (INT_NUM_IM1_IRL0 + 17)
#define INT_NUM_IM1_IRL18 (INT_NUM_IM1_IRL0 + 18)
#define INT_NUM_IM1_IRL19 (INT_NUM_IM1_IRL0 + 19)
#define INT_NUM_IM1_IRL20 (INT_NUM_IM1_IRL0 + 20)
#define INT_NUM_IM1_IRL21 (INT_NUM_IM1_IRL0 + 21)
#define INT_NUM_IM1_IRL22 (INT_NUM_IM1_IRL0 + 22)
#define INT_NUM_IM1_IRL23 (INT_NUM_IM1_IRL0 + 23)
#define INT_NUM_IM1_IRL24 (INT_NUM_IM1_IRL0 + 24)
#define INT_NUM_IM1_IRL25 (INT_NUM_IM1_IRL0 + 25)
#define INT_NUM_IM1_IRL26 (INT_NUM_IM1_IRL0 + 26)
#define INT_NUM_IM1_IRL27 (INT_NUM_IM1_IRL0 + 27)
#define INT_NUM_IM1_IRL28 (INT_NUM_IM1_IRL0 + 28)
#define INT_NUM_IM1_IRL29 (INT_NUM_IM1_IRL0 + 29)
#define INT_NUM_IM1_IRL30 (INT_NUM_IM1_IRL0 + 30)
#define INT_NUM_IM1_IRL31 (INT_NUM_IM1_IRL0 + 31)
#define INT_NUM_IM2_IRL0 (INT_NUM_IRQ0 + 64)
#define INT_NUM_IM2_IRL1 (INT_NUM_IM2_IRL0 + 1)
#define INT_NUM_IM2_IRL2 (INT_NUM_IM2_IRL0 + 2)
#define INT_NUM_IM2_IRL3 (INT_NUM_IM2_IRL0 + 3)
#define INT_NUM_IM2_IRL4 (INT_NUM_IM2_IRL0 + 4)
#define INT_NUM_IM2_IRL5 (INT_NUM_IM2_IRL0 + 5)
#define INT_NUM_IM2_IRL6 (INT_NUM_IM2_IRL0 + 6)
#define INT_NUM_IM2_IRL7 (INT_NUM_IM2_IRL0 + 7)
#define INT_NUM_IM2_IRL8 (INT_NUM_IM2_IRL0 + 8)
#define INT_NUM_IM2_IRL9 (INT_NUM_IM2_IRL0 + 9)
#define INT_NUM_IM2_IRL10 (INT_NUM_IM2_IRL0 + 10)
#define INT_NUM_IM2_IRL11 (INT_NUM_IM2_IRL0 + 11)
#define INT_NUM_IM2_IRL12 (INT_NUM_IM2_IRL0 + 12)
#define INT_NUM_IM2_IRL13 (INT_NUM_IM2_IRL0 + 13)
#define INT_NUM_IM2_IRL14 (INT_NUM_IM2_IRL0 + 14)
#define INT_NUM_IM2_IRL15 (INT_NUM_IM2_IRL0 + 15)
#define INT_NUM_IM2_IRL16 (INT_NUM_IM2_IRL0 + 16)
#define INT_NUM_IM2_IRL17 (INT_NUM_IM2_IRL0 + 17)
#define INT_NUM_IM2_IRL18 (INT_NUM_IM2_IRL0 + 18)
#define INT_NUM_IM2_IRL19 (INT_NUM_IM2_IRL0 + 19)
#define INT_NUM_IM2_IRL20 (INT_NUM_IM2_IRL0 + 20)
#define INT_NUM_IM2_IRL21 (INT_NUM_IM2_IRL0 + 21)
#define INT_NUM_IM2_IRL22 (INT_NUM_IM2_IRL0 + 22)
#define INT_NUM_IM2_IRL23 (INT_NUM_IM2_IRL0 + 23)
#define INT_NUM_IM2_IRL24 (INT_NUM_IM2_IRL0 + 24)
#define INT_NUM_IM2_IRL25 (INT_NUM_IM2_IRL0 + 25)
#define INT_NUM_IM2_IRL26 (INT_NUM_IM2_IRL0 + 26)
#define INT_NUM_IM2_IRL27 (INT_NUM_IM2_IRL0 + 27)
#define INT_NUM_IM2_IRL28 (INT_NUM_IM2_IRL0 + 28)
#define INT_NUM_IM2_IRL29 (INT_NUM_IM2_IRL0 + 29)
#define INT_NUM_IM2_IRL30 (INT_NUM_IM2_IRL0 + 30)
#define INT_NUM_IM2_IRL31 (INT_NUM_IM2_IRL0 + 31)
#define INT_NUM_IM3_IRL0 (INT_NUM_IRQ0 + 96)
#define INT_NUM_IM3_IRL1 (INT_NUM_IM3_IRL0 + 1)
#define INT_NUM_IM3_IRL2 (INT_NUM_IM3_IRL0 + 2)
#define INT_NUM_IM3_IRL3 (INT_NUM_IM3_IRL0 + 3)
#define INT_NUM_IM3_IRL4 (INT_NUM_IM3_IRL0 + 4)
#define INT_NUM_IM3_IRL5 (INT_NUM_IM3_IRL0 + 5)
#define INT_NUM_IM3_IRL6 (INT_NUM_IM3_IRL0 + 6)
#define INT_NUM_IM3_IRL7 (INT_NUM_IM3_IRL0 + 7)
#define INT_NUM_IM3_IRL8 (INT_NUM_IM3_IRL0 + 8)
#define INT_NUM_IM3_IRL9 (INT_NUM_IM3_IRL0 + 9)
#define INT_NUM_IM3_IRL10 (INT_NUM_IM3_IRL0 + 10)
#define INT_NUM_IM3_IRL11 (INT_NUM_IM3_IRL0 + 11)
#define INT_NUM_IM3_IRL12 (INT_NUM_IM3_IRL0 + 12)
#define INT_NUM_IM3_IRL13 (INT_NUM_IM3_IRL0 + 13)
#define INT_NUM_IM3_IRL14 (INT_NUM_IM3_IRL0 + 14)
#define INT_NUM_IM3_IRL15 (INT_NUM_IM3_IRL0 + 15)
#define INT_NUM_IM3_IRL16 (INT_NUM_IM3_IRL0 + 16)
#define INT_NUM_IM3_IRL17 (INT_NUM_IM3_IRL0 + 17)
#define INT_NUM_IM3_IRL18 (INT_NUM_IM3_IRL0 + 18)
#define INT_NUM_IM3_IRL19 (INT_NUM_IM3_IRL0 + 19)
#define INT_NUM_IM3_IRL20 (INT_NUM_IM3_IRL0 + 20)
#define INT_NUM_IM3_IRL21 (INT_NUM_IM3_IRL0 + 21)
#define INT_NUM_IM3_IRL22 (INT_NUM_IM3_IRL0 + 22)
#define INT_NUM_IM3_IRL23 (INT_NUM_IM3_IRL0 + 23)
#define INT_NUM_IM3_IRL24 (INT_NUM_IM3_IRL0 + 24)
#define INT_NUM_IM3_IRL25 (INT_NUM_IM3_IRL0 + 25)
#define INT_NUM_IM3_IRL26 (INT_NUM_IM3_IRL0 + 26)
#define INT_NUM_IM3_IRL27 (INT_NUM_IM3_IRL0 + 27)
#define INT_NUM_IM3_IRL28 (INT_NUM_IM3_IRL0 + 28)
#define INT_NUM_IM3_IRL29 (INT_NUM_IM3_IRL0 + 29)
#define INT_NUM_IM3_IRL30 (INT_NUM_IM3_IRL0 + 30)
#define INT_NUM_IM3_IRL31 (INT_NUM_IM3_IRL0 + 31)
#define INT_NUM_IM4_IRL0 (INT_NUM_IRQ0 + 128)
#define INT_NUM_IM4_IRL1 (INT_NUM_IM4_IRL0 + 1)
#define INT_NUM_IM4_IRL2 (INT_NUM_IM4_IRL0 + 2)
#define INT_NUM_IM4_IRL3 (INT_NUM_IM4_IRL0 + 3)
#define INT_NUM_IM4_IRL4 (INT_NUM_IM4_IRL0 + 4)
#define INT_NUM_IM4_IRL5 (INT_NUM_IM4_IRL0 + 5)
#define INT_NUM_IM4_IRL6 (INT_NUM_IM4_IRL0 + 6)
#define INT_NUM_IM4_IRL7 (INT_NUM_IM4_IRL0 + 7)
#define INT_NUM_IM4_IRL8 (INT_NUM_IM4_IRL0 + 8)
#define INT_NUM_IM4_IRL9 (INT_NUM_IM4_IRL0 + 9)
#define INT_NUM_IM4_IRL10 (INT_NUM_IM4_IRL0 + 10)
#define INT_NUM_IM4_IRL11 (INT_NUM_IM4_IRL0 + 11)
#define INT_NUM_IM4_IRL12 (INT_NUM_IM4_IRL0 + 12)
#define INT_NUM_IM4_IRL13 (INT_NUM_IM4_IRL0 + 13)
#define INT_NUM_IM4_IRL14 (INT_NUM_IM4_IRL0 + 14)
#define INT_NUM_IM4_IRL15 (INT_NUM_IM4_IRL0 + 15)
#define INT_NUM_IM4_IRL16 (INT_NUM_IM4_IRL0 + 16)
#define INT_NUM_IM4_IRL17 (INT_NUM_IM4_IRL0 + 17)
#define INT_NUM_IM4_IRL18 (INT_NUM_IM4_IRL0 + 18)
#define INT_NUM_IM4_IRL19 (INT_NUM_IM4_IRL0 + 19)
#define INT_NUM_IM4_IRL20 (INT_NUM_IM4_IRL0 + 20)
#define INT_NUM_IM4_IRL21 (INT_NUM_IM4_IRL0 + 21)
#define INT_NUM_IM4_IRL22 (INT_NUM_IM4_IRL0 + 22)
#define INT_NUM_IM4_IRL23 (INT_NUM_IM4_IRL0 + 23)
#define INT_NUM_IM4_IRL24 (INT_NUM_IM4_IRL0 + 24)
#define INT_NUM_IM4_IRL25 (INT_NUM_IM4_IRL0 + 25)
#define INT_NUM_IM4_IRL26 (INT_NUM_IM4_IRL0 + 26)
#define INT_NUM_IM4_IRL27 (INT_NUM_IM4_IRL0 + 27)
#define INT_NUM_IM4_IRL28 (INT_NUM_IM4_IRL0 + 28)
#define INT_NUM_IM4_IRL29 (INT_NUM_IM4_IRL0 + 29)
#define INT_NUM_IM4_IRL30 (INT_NUM_IM4_IRL0 + 30)
#define INT_NUM_IM4_IRL31 (INT_NUM_IM4_IRL0 + 31)
/****** Interrupt Assigments ***********/
#define AMAZON_DMA_INT INT_NUM_IM0_IRL0
#define IFX_SSC_TIR INT_NUM_IM0_IRL29
#define IFX_SSC_RIR INT_NUM_IM0_IRL30
#define IFX_SSC_EIR INT_NUM_IM0_IRL31
#define AMAZON_MEI_INT INT_NUM_IM2_IRL8
#define AMAZONASC_TIR INT_NUM_IM4_IRL15/* TX interrupt */
#define AMAZONASC_RIR INT_NUM_IM4_IRL16/* RX interrupt */
#define AMAZONASC_EIR INT_NUM_IM4_IRL17/* ERROR interrupt */
#define AMAZON_TIMER6_INT INT_NUM_IM1_IRL23
#define AMAZON_SWIE_INT INT_NUM_IM3_IRL8
#define AMAZON_CBM_INT INT_NUM_IM3_IRL9
#define AMAZON_AAL5_INT INT_NUM_IM3_IRL10
#define AMAZON_HTU_INT INT_NUM_IM3_IRL11
#define AMAZON_QSB_INT INT_NUM_IM3_IRL12
#define MIPS_CPU_TIMER_IRQ 7
#endif /* __AMAZON_IRQ */

View File

@ -1,29 +0,0 @@
#ifndef AMAZON_MODEL_H
#define AMAZON_MODEL_H
/******************************************************************************
Copyright (c) 2002, Infineon Technologies. All rights reserved.
No Warranty
Because the program is licensed free of charge, there is no warranty for
the program, to the extent permitted by applicable law. Except when
otherwise stated in writing the copyright holders and/or other parties
provide the program "as is" without warranty of any kind, either
expressed or implied, including, but not limited to, the implied
warranties of merchantability and fitness for a particular purpose. The
entire risk as to the quality and performance of the program is with
you. should the program prove defective, you assume the cost of all
necessary servicing, repair or correction.
In no event unless required by applicable law or agreed to in writing
will any copyright holder, or any other party who may modify and/or
redistribute the program as permitted above, be liable to you for
damages, including any general, special, incidental or consequential
damages arising out of the use or inability to use the program
(including but not limited to loss of data or data being rendered
inaccurate or losses sustained by you or third parties or a failure of
the program to operate with any other programs), even if such holder or
other party has been advised of the possibility of such damages.
******************************************************************************/
#define BOARD_SYSTEM_TYPE "AMAZON"
#define SYSTEM_MODEL_NAME "Amazon Gateway Package 3.2 Version"
#endif

View File

@ -1,72 +0,0 @@
/*
* ########################################################################
*
* This program is free software; you can distribute it and/or modify it
* under the terms of the GNU General Public License (Version 2) as
* published by the Free Software Foundation.
*
* This program is distributed in the hope 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.
*
* ########################################################################
*
* port.h
*
* Global Amazon port driver header file
*
*/
/* Modification history */
/* 21Jun2004 btxu Generate from Inca_IP project */
#ifndef PORT_H
#define PORT_H
struct amazon_port_ioctl_parm {
int port;
int pin;
int value;
};
#define AMAZON_PORT_IOC_MAGIC 0xbf
#define AMAZON_PORT_IOCOD _IOW( AMAZON_PORT_IOC_MAGIC,0,struct amazon_port_ioctl_parm)
#define AMAZON_PORT_IOCPUDSEL _IOW( AMAZON_PORT_IOC_MAGIC,1,struct amazon_port_ioctl_parm)
#define AMAZON_PORT_IOCPUDEN _IOW( AMAZON_PORT_IOC_MAGIC,2,struct amazon_port_ioctl_parm)
#define AMAZON_PORT_IOCSTOFF _IOW( AMAZON_PORT_IOC_MAGIC,3,struct amazon_port_ioctl_parm)
#define AMAZON_PORT_IOCDIR _IOW( AMAZON_PORT_IOC_MAGIC,4,struct amazon_port_ioctl_parm)
#define AMAZON_PORT_IOCOUTPUT _IOW( AMAZON_PORT_IOC_MAGIC,5,struct amazon_port_ioctl_parm)
#define AMAZON_PORT_IOCINPUT _IOWR(AMAZON_PORT_IOC_MAGIC,6,struct amazon_port_ioctl_parm)
#define AMAZON_PORT_IOCALTSEL0 _IOW( AMAZON_PORT_IOC_MAGIC,7,struct amazon_port_ioctl_parm)
#define AMAZON_PORT_IOCALTSEL1 _IOW( AMAZON_PORT_IOC_MAGIC,8,struct amazon_port_ioctl_parm)
int amazon_port_reserve_pin(int port, int pin, int module_id);
int amazon_port_free_pin(int port, int pin, int module_id);
int amazon_port_set_open_drain(int port, int pin, int module_id);
int amazon_port_clear_open_drain(int port, int pin, int module_id);
int amazon_port_set_pudsel(int port, int pin, int module_id);
int amazon_port_clear_pudsel(int port, int pin, int module_id);
int amazon_port_set_puden(int port, int pin, int module_id);
int amazon_port_clear_puden(int port, int pin, int module_id);
int amazon_port_set_stoff(int port, int pin, int module_id);
int amazon_port_clear_stoff(int port, int pin, int module_id);
int amazon_port_set_dir_out(int port, int pin, int module_id);
int amazon_port_set_dir_in(int port, int pin, int module_id);
int amazon_port_set_output(int port, int pin, int module_id);
int amazon_port_clear_output(int port, int pin, int module_id);
int amazon_port_get_input(int port, int pin, int module_id);
int amazon_port_set_altsel0(int port, int pin, int module_id);
int amazon_port_clear_altsel0(int port, int pin, int module_id);
int amazon_port_set_altsel1(int port, int pin, int module_id);
int amazon_port_clear_altsel1(int port, int pin, int module_id);
#endif /* PORT_H */

View File

@ -1,146 +0,0 @@
/* incaAscSio.h - (AMAZON) ASC UART tty driver header */
#ifndef __AMAZON_ASC_H
#define __AMAZON_ASC_H
/* channel operating modes */
#define ASCOPT_CSIZE 0x00000003
#define ASCOPT_CS7 0x00000001
#define ASCOPT_CS8 0x00000002
#define ASCOPT_PARENB 0x00000004
#define ASCOPT_STOPB 0x00000008
#define ASCOPT_PARODD 0x00000010
#define ASCOPT_CREAD 0x00000020
#define ASC_OPTIONS (ASCOPT_CREAD | ASCOPT_CS8)
/* ASC input select (0 or 1) */
#define CONSOLE_TTY 0
/* use fractional divider for baudrate settings */
#define AMAZONASC_USE_FDV
#ifdef AMAZONASC_USE_FDV
#define AMAZONASC_FDV_LOW_BAUDRATE 71
#ifdef CONFIG_USE_IKOS
#define AMAZONASC_FDV_HIGH_BAUDRATE 443
#else
#define AMAZONASC_FDV_HIGH_BAUDRATE 498
#endif //CONFIG_USE_IKOS
#endif /*AMAZONASC_USE_FDV*/
#define AMAZONASC_TXFIFO_FL 1
#define AMAZONASC_RXFIFO_FL 1
#define AMAZONASC_TXFIFO_FULL 16
/* interrupt lines masks for the ASC device interrupts*/
/* change these macroses if it's necessary */
#define AMAZONASC_IRQ_LINE_ALL 0x000F0000 /* all IRQs */
#define AMAZONASC_IRQ_LINE_TIR 0x00010000 /* TIR - Tx */
#define AMAZONASC_IRQ_LINE_RIR 0x00020000 /* RIR - Rx */
#define AMAZONASC_IRQ_LINE_EIR 0x00040000 /* EIR - Err */
#define AMAZONASC_IRQ_LINE_TBIR 0x00080000 /* TBIR - Tx Buf*/
/* CLC register's bits and bitfields */
#define ASCCLC_DISR 0x00000001
#define ASCCLC_DISS 0x00000002
#define ASCCLC_RMCMASK 0x0000FF00
#define ASCCLC_RMCOFFSET 8
/* CON register's bits and bitfields */
#define ASCCON_MODEMASK 0x0007
#define ASCCON_M_8SYNC 0x0
#define ASCCON_M_8ASYNC 0x1
#define ASCCON_M_8IRDAASYNC 0x2
#define ASCCON_M_7ASYNCPAR 0x3
#define ASCCON_M_9ASYNC 0x4
#define ASCCON_M_8WAKEUPASYNC 0x5
#define ASCCON_M_8ASYNCPAR 0x7
#define ASCCON_STP 0x0008
#define ASCCON_REN 0x0010
#define ASCCON_PEN 0x0020
#define ASCCON_FEN 0x0040
#define ASCCON_OEN 0x0080
#define ASCCON_PE 0x0100
#define ASCCON_FE 0x0200
#define ASCCON_OE 0x0400
#define ASCCON_FDE 0x0800
#define ASCCON_ODD 0x1000
#define ASCCON_BRS 0x2000
#define ASCCON_LB 0x4000
#define ASCCON_R 0x8000
#define ASCCON_ANY (ASCCON_PE|ASCCON_FE|ASCCON_OE)
/* WHBCON register's bits and bitfields */
#define ASCWHBCON_CLRREN 0x0010
#define ASCWHBCON_SETREN 0x0020
#define ASCWHBCON_CLRPE 0x0100
#define ASCWHBCON_CLRFE 0x0200
#define ASCWHBCON_CLROE 0x0400
#define ASCWHBCON_SETPE 0x0800
#define ASCWHBCON_SETFE 0x1000
#define ASCWHBCON_SETOE 0x2000
/* ABCON register's bits and bitfields */
#define ASCABCON_ABEN 0x0001
#define ASCABCON_AUREN 0x0002
#define ASCABCON_ABSTEN 0x0004
#define ASCABCON_ABDETEN 0x0008
#define ASCABCON_FCDETEN 0x0010
#define ASCABCON_EMMASK 0x0300
#define ASCABCON_EMOFF 8
#define ASCABCON_EM_DISAB 0x0
#define ASCABCON_EM_DURAB 0x1
#define ASCABCON_EM_ALWAYS 0x2
#define ASCABCON_TXINV 0x0400
#define ASCABCON_RXINV 0x0800
/* FDV register mask, offset and bitfields*/
#define ASCFDV_VALUE_MASK 0x000001FF
/* WHBABCON register's bits and bitfields */
#define ASCWHBABCON_SETABEN 0x0001
#define ASCWHBABCON_CLRABEN 0x0002
/* ABSTAT register's bits and bitfields */
#define ASCABSTAT_FCSDET 0x0001
#define ASCABSTAT_FCCDET 0x0002
#define ASCABSTAT_SCSDET 0x0004
#define ASCABSTAT_SCCDET 0x0008
#define ASCABSTAT_DETWAIT 0x0010
/* WHBABSTAT register's bits and bitfields */
#define ASCWHBABSTAT_CLRFCSDET 0x0001
#define ASCWHBABSTAT_SETFCSDET 0x0002
#define ASCWHBABSTAT_CLRFCCDET 0x0004
#define ASCWHBABSTAT_SETFCCDET 0x0008
#define ASCWHBABSTAT_CLRSCSDET 0x0010
#define ASCWHBABSTAT_SETSCSDET 0x0020
#define ASCWHBABSTAT_SETSCCDET 0x0040
#define ASCWHBABSTAT_CLRSCCDET 0x0080
#define ASCWHBABSTAT_CLRDETWAIT 0x0100
#define ASCWHBABSTAT_SETDETWAIT 0x0200
/* TXFCON register's bits and bitfields */
#define ASCTXFCON_TXFEN 0x0001
#define ASCTXFCON_TXFFLU 0x0002
#define ASCTXFCON_TXTMEN 0x0004
#define ASCTXFCON_TXFITLMASK 0x3F00
#define ASCTXFCON_TXFITLOFF 8
/* RXFCON register's bits and bitfields */
#define ASCRXFCON_RXFEN 0x0001
#define ASCRXFCON_RXFFLU 0x0002
#define ASCRXFCON_RXTMEN 0x0004
#define ASCRXFCON_RXFITLMASK 0x3F00
#define ASCRXFCON_RXFITLOFF 8
/* FSTAT register's bits and bitfields */
#define ASCFSTAT_RXFFLMASK 0x003F
#define ASCFSTAT_TXFFLMASK 0x3F00
#define ASCFSTAT_TXFFLOFF 8
#endif /* __AMAZON_ASC_H */

View File

@ -1,30 +0,0 @@
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
define Image/BuildKernel
$(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.lzma
mkimage -A mips -O linux -T kernel -C lzma -a 0x80002000 -e \
0x80002000 \
-n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
-d $(KDIR)/vmlinux.lzma $(KDIR)/uImage
cp $(KDIR)/uImage $(BIN_DIR)/openwrt-$(BOARD)-uImage
endef
define Image/Build/squashfs
$(call prepare_generic_squashfs,$(BIN_DIR)/openwrt-$(BOARD)-$(1).image)
endef
define Image/Build
cat $(KDIR)/uImage $(KDIR)/root.$(1) > $(BIN_DIR)/openwrt-$(BOARD)-$(1).image
$(call Image/Build/$(1),$(1))
endef
$(eval $(call BuildImage))

View File

@ -1,32 +0,0 @@
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1542,7 +1542,16 @@ void __cpuinit per_cpu_trap_init(void)
*/
if (cpu_has_mips_r2) {
cp0_compare_irq = (read_c0_intctl() >> 29) & 7;
+ if (!cp0_compare_irq)
+ cp0_compare_irq = CP0_LEGACY_COMPARE_IRQ;
+
cp0_perfcount_irq = (read_c0_intctl() >> 26) & 7;
+ if (!cp0_perfcount_irq)
+ cp0_perfcount_irq = CP0_LEGACY_PERFCNT_IRQ;
+
+ if (arch_fixup_c0_irqs)
+ arch_fixup_c0_irqs();
+
if (cp0_perfcount_irq == cp0_compare_irq)
cp0_perfcount_irq = -1;
} else {
--- a/arch/mips/include/asm/irq.h
+++ b/arch/mips/include/asm/irq.h
@@ -157,8 +157,10 @@ extern void free_irqno(unsigned int irq)
* IE7. Since R2 their number has to be read from the c0_intctl register.
*/
#define CP0_LEGACY_COMPARE_IRQ 7
+#define CP0_LEGACY_PERFCNT_IRQ 7
extern int cp0_compare_irq;
extern int cp0_perfcount_irq;
+extern void __weak arch_fixup_c0_irqs(void);
#endif /* _ASM_IRQ_H */

View File

@ -1,33 +0,0 @@
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -21,6 +21,22 @@
#ifndef CONFIG_MIPS_MT_SMTC
+/*
+ * Compare interrupt can be routed and latched outside the core,
+ * so a single execution hazard barrier may not be enough to give
+ * it time to clear as seen in the Cause register. 4 time the
+ * pipeline depth seems reasonably conservative, and empirically
+ * works better in configurations with high CPU/bus clock ratios.
+ */
+
+#define compare_change_hazard() \
+ do { \
+ irq_disable_hazard(); \
+ irq_disable_hazard(); \
+ irq_disable_hazard(); \
+ irq_disable_hazard(); \
+ } while (0)
+
static int mips_next_event(unsigned long delta,
struct clock_event_device *evt)
{
@@ -30,6 +46,7 @@ static int mips_next_event(unsigned long
cnt = read_c0_count();
cnt += delta;
write_c0_compare(cnt);
+ compare_change_hazard();
res = ((int)(read_c0_count() - cnt) > 0) ? -ETIME : 0;
return res;
}

View File

@ -1,10 +0,0 @@
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -105,6 +105,7 @@ obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o
obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o
obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
+obj-$(CONFIG_AMAZON_WDT) += amazon_wdt.o
# PARISC Architecture

View File

@ -1,49 +0,0 @@
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -60,6 +60,22 @@ config BCM47XX
help
Support for BCM47XX based boards
+config AMAZON
+ bool "Amazon support (EXPERIMENTAL)"
+ depends on EXPERIMENTAL
+ select DMA_NONCOHERENT
+ select IRQ_CPU
+ select CEVT_R4K
+ select CSRC_R4K
+ select SYS_HAS_CPU_MIPS32_R1
+ select SYS_HAS_CPU_MIPS32_R2
+ select HAVE_STD_PC_SERIAL_PORT
+ select SYS_SUPPORTS_BIG_ENDIAN
+ select SYS_SUPPORTS_32BIT_KERNEL
+ select SYS_HAS_EARLY_PRINTK
+ select HW_HAS_PCI
+ select SWAP_IO_SPACE
+
config MIPS_COBALT
bool "Cobalt Server"
select CEVT_R4K
@@ -633,6 +649,7 @@ config CAVIUM_OCTEON_REFERENCE_BOARD
endchoice
+source "arch/mips/amazon/Kconfig"
source "arch/mips/alchemy/Kconfig"
source "arch/mips/basler/excite/Kconfig"
source "arch/mips/jazz/Kconfig"
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -283,6 +283,13 @@ libs-$(CONFIG_MIPS_XXS1500) += arch/mips
load-$(CONFIG_MIPS_XXS1500) += 0xffffffff80100000
#
+# Infineon AMAZON
+#
+core-$(CONFIG_AMAZON) += arch/mips/amazon/
+cflags-$(CONFIG_AMAZON) += -I$(srctree)/arch/mips/include/asm/mach-amazon
+load-$(CONFIG_AMAZON) += 0xffffffff80002000
+
+#
# Cobalt Server
#
core-$(CONFIG_MIPS_COBALT) += arch/mips/cobalt/

View File

@ -1,7 +0,0 @@
--- a/drivers/mtd/maps/Makefile
+++ b/drivers/mtd/maps/Makefile
@@ -62,3 +62,4 @@ obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_
obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-async-flash.o
obj-$(CONFIG_MTD_RBTX4939) += rbtx4939-flash.o
obj-$(CONFIG_MTD_VMU) += vmu-flash.o
+obj-$(CONFIG_AMAZON_MTD) += amazon.o

View File

@ -1,9 +0,0 @@
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -272,3 +272,6 @@ obj-$(CONFIG_VIRTIO_NET) += virtio_net.o
obj-$(CONFIG_SFC) += sfc/
obj-$(CONFIG_WIMAX) += wimax/
+
+obj-$(CONFIG_AMAZON_NET_SW) += amazon_sw.o
+obj-$(CONFIG_ADM6996_SUPPORT) += admmod.o

View File

@ -1,10 +0,0 @@
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -3,6 +3,7 @@
#
obj-$(CONFIG_SERIAL_CORE) += serial_core.o
+obj-$(CONFIG_AMAZON_ASC_UART) += amazon_asc.o
obj-$(CONFIG_SERIAL_21285) += 21285.o
# These Sparc drivers have to appear before others such as 8250

View File

@ -1,56 +0,0 @@
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -1090,6 +1090,9 @@ static int __xipram do_write_oneword(str
int retry_cnt = 0;
adr += chip->start;
+#ifdef CONFIG_AMAZON
+ adr ^= 2;
+#endif
spin_lock(chip->mutex);
ret = get_chip(map, chip, adr, FL_WRITING);
@@ -1372,7 +1375,11 @@ static int __xipram do_write_buffer(stru
z = 0;
while(z < words * map_bankwidth(map)) {
datum = map_word_load(map, buf);
+#ifdef CONFIG_AMAZON
+ map_write(map, datum, (adr + z) ^ 0x2);
+#else
map_write(map, datum, adr + z);
+#endif
z += map_bankwidth(map);
buf += map_bankwidth(map);
@@ -1617,6 +1624,9 @@ static int __xipram do_erase_oneblock(st
int ret = 0;
adr += chip->start;
+#ifdef CONFIG_AMAZON
+ adr ^= 2;
+#endif
spin_lock(chip->mutex);
ret = get_chip(map, chip, adr, FL_ERASING);
@@ -1745,6 +1755,10 @@ static int do_atmel_lock(struct map_info
struct cfi_private *cfi = map->fldrv_priv;
int ret;
+#ifdef CONFIG_AMAZON
+ adr ^= 2;
+#endif
+
spin_lock(chip->mutex);
ret = get_chip(map, chip, adr + chip->start, FL_LOCKING);
if (ret)
@@ -1781,6 +1795,10 @@ static int do_atmel_unlock(struct map_in
struct cfi_private *cfi = map->fldrv_priv;
int ret;
+#ifdef CONFIG_AMAZON
+ adr ^= 2;
+#endif
+
spin_lock(chip->mutex);
ret = get_chip(map, chip, adr + chip->start, FL_UNLOCKING);
if (ret)

View File

@ -1,32 +0,0 @@
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1537,7 +1537,16 @@ void __cpuinit per_cpu_trap_init(void)
*/
if (cpu_has_mips_r2) {
cp0_compare_irq = (read_c0_intctl() >> 29) & 7;
+ if (!cp0_compare_irq)
+ cp0_compare_irq = CP0_LEGACY_COMPARE_IRQ;
+
cp0_perfcount_irq = (read_c0_intctl() >> 26) & 7;
+ if (!cp0_perfcount_irq)
+ cp0_perfcount_irq = CP0_LEGACY_PERFCNT_IRQ;
+
+ if (arch_fixup_c0_irqs)
+ arch_fixup_c0_irqs();
+
if (cp0_perfcount_irq == cp0_compare_irq)
cp0_perfcount_irq = -1;
} else {
--- a/arch/mips/include/asm/irq.h
+++ b/arch/mips/include/asm/irq.h
@@ -158,8 +158,10 @@ extern void free_irqno(unsigned int irq)
* IE7. Since R2 their number has to be read from the c0_intctl register.
*/
#define CP0_LEGACY_COMPARE_IRQ 7
+#define CP0_LEGACY_PERFCNT_IRQ 7
extern int cp0_compare_irq;
extern int cp0_perfcount_irq;
+extern void __weak arch_fixup_c0_irqs(void);
#endif /* _ASM_IRQ_H */

View File

@ -1,33 +0,0 @@
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -22,6 +22,22 @@
#ifndef CONFIG_MIPS_MT_SMTC
+/*
+ * Compare interrupt can be routed and latched outside the core,
+ * so a single execution hazard barrier may not be enough to give
+ * it time to clear as seen in the Cause register. 4 time the
+ * pipeline depth seems reasonably conservative, and empirically
+ * works better in configurations with high CPU/bus clock ratios.
+ */
+
+#define compare_change_hazard() \
+ do { \
+ irq_disable_hazard(); \
+ irq_disable_hazard(); \
+ irq_disable_hazard(); \
+ irq_disable_hazard(); \
+ } while (0)
+
static int mips_next_event(unsigned long delta,
struct clock_event_device *evt)
{
@@ -31,6 +47,7 @@ static int mips_next_event(unsigned long
cnt = read_c0_count();
cnt += delta;
write_c0_compare(cnt);
+ compare_change_hazard();
res = ((int)(read_c0_count() - cnt) > 0) ? -ETIME : 0;
return res;
}

View File

@ -1,10 +0,0 @@
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -113,6 +113,7 @@ obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o
obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o
obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
+obj-$(CONFIG_AMAZON_WDT) += amazon_wdt.o
# PARISC Architecture

View File

@ -1,49 +0,0 @@
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -96,6 +96,22 @@ config BCM63XX
help
Support for BCM63XX based boards
+config AMAZON
+ bool "Amazon support (EXPERIMENTAL)"
+ depends on EXPERIMENTAL
+ select DMA_NONCOHERENT
+ select IRQ_CPU
+ select CEVT_R4K
+ select CSRC_R4K
+ select SYS_HAS_CPU_MIPS32_R1
+ select SYS_HAS_CPU_MIPS32_R2
+ select HAVE_STD_PC_SERIAL_PORT
+ select SYS_SUPPORTS_BIG_ENDIAN
+ select SYS_SUPPORTS_32BIT_KERNEL
+ select SYS_HAS_EARLY_PRINTK
+ select HW_HAS_PCI
+ select SWAP_IO_SPACE
+
config MIPS_COBALT
bool "Cobalt Server"
select CEVT_R4K
@@ -673,6 +689,7 @@ config CAVIUM_OCTEON_REFERENCE_BOARD
endchoice
+source "arch/mips/amazon/Kconfig"
source "arch/mips/alchemy/Kconfig"
source "arch/mips/basler/excite/Kconfig"
source "arch/mips/bcm63xx/Kconfig"
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -296,6 +296,13 @@ cflags-$(CONFIG_SOC_AU1X00) += -I$(srctr
#
+# Infineon AMAZON
+#
+core-$(CONFIG_AMAZON) += arch/mips/amazon/
+cflags-$(CONFIG_AMAZON) += -I$(srctree)/arch/mips/include/asm/mach-amazon
+load-$(CONFIG_AMAZON) += 0xffffffff80002000
+
+#
# Cobalt Server
#
core-$(CONFIG_MIPS_COBALT) += arch/mips/cobalt/

View File

@ -1,7 +0,0 @@
--- a/drivers/mtd/maps/Makefile
+++ b/drivers/mtd/maps/Makefile
@@ -61,3 +61,4 @@ obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-asy
obj-$(CONFIG_MTD_RBTX4939) += rbtx4939-flash.o
obj-$(CONFIG_MTD_VMU) += vmu-flash.o
obj-$(CONFIG_MTD_GPIO_ADDR) += gpio-addr-flash.o
+obj-$(CONFIG_AMAZON_MTD) += amazon.o

View File

@ -1,9 +0,0 @@
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -286,3 +286,6 @@ obj-$(CONFIG_VIRTIO_NET) += virtio_net.o
obj-$(CONFIG_SFC) += sfc/
obj-$(CONFIG_WIMAX) += wimax/
+
+obj-$(CONFIG_AMAZON_NET_SW) += amazon_sw.o
+obj-$(CONFIG_ADM6996_SUPPORT) += admmod.o

View File

@ -1,10 +0,0 @@
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -3,6 +3,7 @@
#
obj-$(CONFIG_SERIAL_CORE) += serial_core.o
+obj-$(CONFIG_AMAZON_ASC_UART) += amazon_asc.o
obj-$(CONFIG_SERIAL_21285) += 21285.o
# These Sparc drivers have to appear before others such as 8250

View File

@ -1,56 +0,0 @@
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -1079,6 +1079,9 @@ static int __xipram do_write_oneword(str
int retry_cnt = 0;
adr += chip->start;
+#ifdef CONFIG_AMAZON
+ adr ^= 2;
+#endif
spin_lock(chip->mutex);
ret = get_chip(map, chip, adr, FL_WRITING);
@@ -1361,7 +1364,11 @@ static int __xipram do_write_buffer(stru
z = 0;
while(z < words * map_bankwidth(map)) {
datum = map_word_load(map, buf);
+#ifdef CONFIG_AMAZON
+ map_write(map, datum, (adr + z) ^ 0x2);
+#else
map_write(map, datum, adr + z);
+#endif
z += map_bankwidth(map);
buf += map_bankwidth(map);
@@ -1606,6 +1613,9 @@ static int __xipram do_erase_oneblock(st
int ret = 0;
adr += chip->start;
+#ifdef CONFIG_AMAZON
+ adr ^= 2;
+#endif
spin_lock(chip->mutex);
ret = get_chip(map, chip, adr, FL_ERASING);
@@ -1734,6 +1744,10 @@ static int do_atmel_lock(struct map_info
struct cfi_private *cfi = map->fldrv_priv;
int ret;
+#ifdef CONFIG_AMAZON
+ adr ^= 2;
+#endif
+
spin_lock(chip->mutex);
ret = get_chip(map, chip, adr + chip->start, FL_LOCKING);
if (ret)
@@ -1770,6 +1784,10 @@ static int do_atmel_unlock(struct map_in
struct cfi_private *cfi = map->fldrv_priv;
int ret;
+#ifdef CONFIG_AMAZON
+ adr ^= 2;
+#endif
+
spin_lock(chip->mutex);
ret = get_chip(map, chip, adr + chip->start, FL_UNLOCKING);
if (ret)

View File

@ -1,24 +0,0 @@
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
ARCH:=arm
BOARD:=at91
BOARDNAME:=Atmel AT91
FEATURES:=squashfs usb broken
LINUX_VERSION:=2.6.25.20
include $(INCLUDE_DIR)/target.mk
KERNELNAME:="uImage"
define Target/Description
Build fimware images for Figment Design Labs VersaLink board.
endef
$(eval $(call BuildTarget))

View File

@ -1,6 +0,0 @@
::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K stop
tts/0::askfirst:/bin/ash --login
ttyS0::askfirst:/bin/ash --login
ttyS2::respawn:/sbin/getty -L ttyS2 115200 vt100

View File

@ -1,3 +0,0 @@
src snapshots http://vlink.guthrie.homedns.org/vlink3
dest root /
dest ram /tmp

View File

@ -1,212 +0,0 @@
# CONFIG_AEABI is not set
CONFIG_ALIGNMENT_TRAP=y
# CONFIG_ARCH_AT91CAP9 is not set
# CONFIG_ARCH_AT91RM9200DK is not set
CONFIG_ARCH_AT91RM9200=y
# CONFIG_ARCH_AT91SAM9260 is not set
# CONFIG_ARCH_AT91SAM9261 is not set
# CONFIG_ARCH_AT91SAM9263 is not set
# CONFIG_ARCH_AT91SAM9RL is not set
# CONFIG_ARCH_AT91X40 is not set
CONFIG_ARCH_AT91=y
# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
# CONFIG_ARCH_HAS_ILOG2_U32 is not set
# CONFIG_ARCH_HAS_ILOG2_U64 is not set
CONFIG_ARCH_SUPPORTS_AOUT=y
# CONFIG_ARCH_SUPPORTS_MSI is not set
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARM_AT91_ETHER=y
CONFIG_ARM_THUMB=y
CONFIG_ARM=y
# CONFIG_ARPD is not set
# CONFIG_ARTHUR is not set
CONFIG_AT91_EARLY_DBGU=y
# CONFIG_AT91_EARLY_USART0 is not set
# CONFIG_AT91_EARLY_USART1 is not set
# CONFIG_AT91_EARLY_USART2 is not set
# CONFIG_AT91_EARLY_USART3 is not set
# CONFIG_AT91_EARLY_USART4 is not set
# CONFIG_AT91_EARLY_USART5 is not set
CONFIG_AT91_PMC_UNIT=y
# CONFIG_AT91_PROGRAMMABLE_CLOCKS is not set
# CONFIG_AT91_SPIDEV is not set
CONFIG_AT91_SPI=y
CONFIG_AT91_TIMER_HZ=128
CONFIG_AT91_VLIO=y
# CONFIG_ATMEL_PWM is not set
# CONFIG_ATMEL_SSC is not set
# CONFIG_BINFMT_AOUT is not set
CONFIG_BITREVERSE=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_BLK_DEV_RAM=y
# CONFIG_BLK_DEV_XIP is not set
# CONFIG_BONDING is not set
CONFIG_BOUNCE=y
# CONFIG_BSD_PROCESS_ACCT is not set
CONFIG_CLASSIC_RCU=y
CONFIG_CPU_32v4T=y
CONFIG_CPU_32=y
CONFIG_CPU_ABRT_EV4T=y
CONFIG_CPU_ARM920T=y
CONFIG_CPU_CACHE_V4WT=y
CONFIG_CPU_CACHE_VIVT=y
CONFIG_CPU_COPY_V4WB=y
CONFIG_CPU_CP15_MMU=y
CONFIG_CPU_CP15=y
# CONFIG_CPU_DCACHE_DISABLE is not set
# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
# CONFIG_CPU_ICACHE_DISABLE is not set
CONFIG_CPU_TLB_V4WBI=y
# CONFIG_DATAFLASH_ALWAYS_ADD_DEVICE is not set
CONFIG_DAVICOM_PHY=y
# CONFIG_DEBUG_USER is not set
# CONFIG_DM9000 is not set
CONFIG_DUMMY_CONSOLE=y
# CONFIG_E1000E_ENABLED is not set
# CONFIG_FPE_FASTFPE is not set
# CONFIG_FPE_NWFPE_XP is not set
CONFIG_FPE_NWFPE=y
CONFIG_FRAME_POINTER=y
CONFIG_FS_POSIX_ACL=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_GPIO=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_HAS_DMA=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
# CONFIG_HAVE_IDE is not set
CONFIG_HAVE_KPROBES=y
CONFIG_HAVE_KRETPROBES=y
CONFIG_HAVE_OPROFILE=y
CONFIG_HW_CONSOLE=y
# CONFIG_HW_RANDOM is not set
CONFIG_HZ=128
# CONFIG_IEEE80211_CRYPT_CCMP is not set
# CONFIG_IEEE80211_CRYPT_TKIP is not set
# CONFIG_IEEE80211_SOFTMAC is not set
# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
CONFIG_INITRAMFS_SOURCE=""
CONFIG_INPUT=y
CONFIG_LEDS_CPU=y
CONFIG_LEDS=y
CONFIG_LEGACY_PTY_COUNT=32
CONFIG_LEGACY_PTYS=y
# CONFIG_LLC2 is not set
# CONFIG_LZO_COMPRESS is not set
# CONFIG_LZO_DECOMPRESS is not set
# CONFIG_MACH_AT91RM9200EK is not set
# CONFIG_MACH_ATEB9200 is not set
# CONFIG_MACH_CARMEVA is not set
# CONFIG_MACH_CHUB is not set
# CONFIG_MACH_CSB337 is not set
# CONFIG_MACH_CSB637 is not set
# CONFIG_MACH_ECBAT91 is not set
# CONFIG_MACH_HOMEMATIC is not set
# CONFIG_MACH_KAFA is not set
# CONFIG_MACH_KB9200 is not set
# CONFIG_MACH_ONEARM is not set
# CONFIG_MACH_PICOTUX2XX is not set
# CONFIG_MACH_SWEDATMS is not set
# CONFIG_MACH_TT9200 is not set
CONFIG_MACH_VLINK=y
CONFIG_MTD_AT91_DATAFLASH=y
CONFIG_MTD_AT91_PARTS=y
# CONFIG_MTD_CFI is not set
CONFIG_MTD_CMDLINE_PARTS=y
# CONFIG_MTD_COMPLEX_MAPPINGS is not set
# CONFIG_MTD_ROOTFS_ROOT_DEV is not set
# CONFIG_MTD_ROOTFS_SPLIT is not set
# CONFIG_NET_IPGRE_BROADCAST is not set
# CONFIG_NET_PKTGEN is not set
# CONFIG_NF_CONNTRACK_AMANDA is not set
# CONFIG_NF_CONNTRACK_PPTP is not set
# CONFIG_NF_CONNTRACK_RTSP is not set
# CONFIG_NF_CONNTRACK_TFTP is not set
# CONFIG_NF_NAT_AMANDA is not set
# CONFIG_NF_NAT_PPTP is not set
# CONFIG_NF_NAT_RTSP is not set
# CONFIG_NF_NAT_TFTP is not set
# CONFIG_NO_IOPORT is not set
# CONFIG_OUTER_CACHE is not set
# CONFIG_PCI_SYSCALL is not set
CONFIG_PHYLIB=y
# CONFIG_SCSI_WAIT_SCAN is not set
# CONFIG_SDIO_UART is not set
# CONFIG_SERIAL_8250 is not set
CONFIG_SERIAL_ATMEL_CONSOLE=y
CONFIG_SERIAL_ATMEL_PDC=y
# CONFIG_SERIAL_ATMEL_TTYAT is not set
CONFIG_SERIAL_ATMEL=y
# CONFIG_SERIO_LIBPS2 is not set
CONFIG_SERIO_RAW=y
CONFIG_SERIO_SERPORT=y
CONFIG_SERIO=y
CONFIG_SLABINFO=y
# CONFIG_SMC91X is not set
# CONFIG_SPI_AT91 is not set
# CONFIG_SPI_ATMEL is not set
CONFIG_SPLIT_PTLOCK_CPUS=4096
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_UID16=y
# CONFIG_USB_ARCH_HAS_EHCI is not set
# CONFIG_USB is not set
CONFIG_USB_LIBUSUAL=y
# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
# CONFIG_USB_OHCI_HCD is not set
# CONFIG_USB_PRINTER is not set
# CONFIG_USB_R8A66597_HCD is not set
# CONFIG_USB_SERIAL_CYBERJACK is not set
# CONFIG_USB_SERIAL_EDGEPORT is not set
# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
# CONFIG_USB_SERIAL_EMPEG is not set
# CONFIG_USB_SERIAL_FUNSOFT is not set
# CONFIG_USB_SERIAL_GARMIN is not set
# CONFIG_USB_SERIAL_HP4X is not set
# CONFIG_USB_SERIAL_IPAQ is not set
# CONFIG_USB_SERIAL_IPW is not set
# CONFIG_USB_SERIAL_IR is not set
# CONFIG_USB_SERIAL_IUU is not set
# CONFIG_USB_SERIAL_KEYSPAN is not set
# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
# CONFIG_USB_SERIAL_KLSI is not set
# CONFIG_USB_SERIAL_KOBIL_SCT is not set
# CONFIG_USB_SERIAL_MCT_U232 is not set
# CONFIG_USB_SERIAL_MOS7720 is not set
# CONFIG_USB_SERIAL_MOS7840 is not set
# CONFIG_USB_SERIAL_NAVMAN is not set
# CONFIG_USB_SERIAL_OMNINET is not set
# CONFIG_USB_SERIAL_OPTION is not set
# CONFIG_USB_SERIAL_OTI6858 is not set
# CONFIG_USB_SERIAL_SAFE_PADDED is not set
# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
# CONFIG_USB_SERIAL_TI is not set
# CONFIG_USB_SERIAL_VISOR is not set
# CONFIG_USB_SERIAL_XIRCOM is not set
# CONFIG_USB_SPEEDTOUCH is not set
# CONFIG_USB_STORAGE_ALAUDA is not set
# CONFIG_USB_STORAGE_DATAFAB is not set
# CONFIG_USB_STORAGE_DPCM is not set
# CONFIG_USB_STORAGE_FREECOM is not set
# CONFIG_USB_STORAGE_JUMPSHOT is not set
# CONFIG_USB_STORAGE_KARMA is not set
# CONFIG_USB_STORAGE_SDDR09 is not set
# CONFIG_USB_STORAGE_SDDR55 is not set
# CONFIG_USB_STORAGE_USBAT is not set
CONFIG_USB_SUPPORT=y
# CONFIG_USB_UEAGLEATM is not set
CONFIG_VECTORS_BASE=0xffff0000
# CONFIG_VGA_CONSOLE is not set
# CONFIG_VGASTATE is not set
# CONFIG_VIDEO_DEV is not set
CONFIG_VT_CONSOLE=y
# CONFIG_VT_HW_CONSOLE_BINDING is not set
CONFIG_VT=y
# CONFIG_W1 is not set
# CONFIG_WATCHDOG is not set
# CONFIG_WLAN_80211 is not set
# CONFIG_XIP_KERNEL is not set
CONFIG_ZBOOT_ROM_BSS=0
CONFIG_ZBOOT_ROM_TEXT=0

View File

@ -1,120 +0,0 @@
/*
*
* Copyright (C) 2007 OpenWrt.org
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Atmel AT91 flash partition table. (Modified by Hamish Guthrie).
* Based on ar7 map by Felix Fietkau.
*
*/
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/bootmem.h>
#include <linux/squashfs_fs.h>
static struct mtd_partition at91_parts[6];
static int create_mtd_partitions(struct mtd_info *master,
struct mtd_partition **pparts,
unsigned long origin)
{
unsigned int offset, len;
unsigned int pre_size = 0x42000, root_max = 0x362400;
unsigned char buf[512];
struct squashfs_super_block *sb = (struct squashfs_super_block *) buf;
printk("Parsing AT91 partition map...\n");
at91_parts[0].name = "loaders";
at91_parts[0].offset = 0;
at91_parts[0].size = 0x21000;
at91_parts[0].mask_flags = MTD_WRITEABLE;
at91_parts[1].name = "ubparams";
at91_parts[1].offset = 0x21000;
at91_parts[1].size = 0x8400;
at91_parts[1].mask_flags = 0;
at91_parts[2].name = "kernel";
at91_parts[2].offset = pre_size;
at91_parts[2].size = 0;
at91_parts[2].mask_flags = 0;
at91_parts[3].name = "rootfs";
at91_parts[3].offset = 0;
at91_parts[3].size = 0;
at91_parts[3].mask_flags = 0;
for(offset = pre_size; offset < root_max; offset += master->erasesize) {
memset(&buf, 0xe5, sizeof(buf));
if (master->read(master, offset, sizeof(buf), &len, buf) || len != sizeof(buf))
break;
if (*((__u32 *) buf) == SQUASHFS_MAGIC) {
printk(KERN_INFO "%s: Filesystem type: squashfs, size=0x%x\n",
master->name, (u32) sb->bytes_used);
at91_parts[3].size = sb->bytes_used;
at91_parts[3].offset = offset;
len = at91_parts[3].offset + at91_parts[3].size;
len = ((len / (master->erasesize * 8)) + 1) * master->erasesize * 8;
at91_parts[3].size = len - at91_parts[3].offset;
at91_parts[2].size = offset - at91_parts[2].offset;
break;
}
}
if (at91_parts[3].size == 0) {
printk(KERN_NOTICE "%s: Couldn't find root filesystem\n", master->name);
return -1;
}
at91_parts[4].name = "rootfs_data";
at91_parts[4].offset = root_max;
at91_parts[4].size = master->size - root_max;
at91_parts[4].mask_flags = 0;
at91_parts[5].name = "complete";
at91_parts[5].offset = 0;
at91_parts[5].size = master->size;
at91_parts[5].mask_flags = 0;
*pparts = at91_parts;
return 6;
}
static struct mtd_part_parser at91_parser = {
.owner = THIS_MODULE,
.parse_fn = create_mtd_partitions,
.name = "at91part",
};
static int __init at91_parser_init(void)
{
return register_mtd_parser(&at91_parser);
}
module_init(at91_parser_init);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Felix Fietkau, Eugene Konev, Hamish Guthrie");
MODULE_DESCRIPTION("MTD partitioning for Atmel at91");

View File

@ -1,35 +0,0 @@
config AT91_DFBOOT
bool "Build dataflashboot loader"
depends TARGET_at91
default y
config AT91_UBOOT
bool "Build U-Boot bootloader"
depends TARGET_at91
default y
config UBOOT_TARGET
string "U-Boot target board"
depends TARGET_at91
depends AT91_UBOOT
default "vlink"
help
For all supported boards there are ready-to-use default
configurations available; just type "<board_name>".
config UBOOT_IPADDR
string "IP Address for U-Boot"
depends TARGET_at91
depends AT91_UBOOT
default "192.168.0.178"
help
IP address of device to be used in U-Boot
config UBOOT_SERVERIP
string "IP Address of TFTP server"
depends TARGET_at91
depends AT91_UBOOT
default "192.168.0.232"
help
IP address of TFTP server for U-Boot

View File

@ -1,45 +0,0 @@
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
define Build/Clean
$(MAKE) -C dfboot clean
$(MAKE) -C u-boot clean
endef
define Build/Compile
$(MAKE) -C dfboot compile
$(MAKE) -C u-boot compile
$(KDIR)/u-boot-1.1.4/tools/ubparams
cp params $(KDIR)
endef
define Image/Prepare
cp $(LINUX_DIR)/arch/arm/boot/uImage $(KDIR)/uImage
cp $(KDIR)/dfboot/dfboot.bin $(KDIR)/dfboot.bin
cp $(KDIR)/dfboot/dfbptest.bin $(KDIR)/dfbptest.bin
cp $(KDIR)/u-boot-1.1.4/u-boot.bin $(KDIR)/u-boot.bin
dd if=$(KDIR)/u-boot.bin of=$(KDIR)/u-boot.block bs=100k count=1 conv=sync
cat $(KDIR)/u-boot.block $(KDIR)/params > $(KDIR)/u-boot.full
endef
define Image/BuildKernel
cp $(KDIR)/uImage $(BIN_DIR)/openwrt-$(BOARD)-uImage
endef
define Image/Build
dd if=$(KDIR)/uImage of=$(KDIR)/uImage.block bs=8448 conv=sync
dd if=$(KDIR)/root.squashfs of=$(KDIR)/root.block bs=8448 conv=sync
cat $(KDIR)/uImage.block $(KDIR)/root.block > $(KDIR)/knlroot.bin
$(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD).trx -f $(KDIR)/dfboot.bin -f$(KDIR)/u-boot.full -f$(KDIR)/knlroot.bin
cp $(KDIR)/dfbptest.bin $(BIN_DIR)
$(call Image/Build/$(1),$(1))
endef
$(eval $(call BuildImage))

View File

@ -1,35 +0,0 @@
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=dfboot
PKG_VERSION:=0.1
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
$(TARGET_CONFIGURE_OPTS) \
CFLAGS="$(TARGET_CFLAGS)" \
LDFLAGS="$(LIBGCC_S)"
endef
define Build/InstallDev
dd if=$(PKG_BUILD_DIR)/binary/dfboot.bin of=$(PKG_BUILD_DIR)/binary/dfboot.block bs=32k count=1 conv=sync
endef
$(eval $(call Build/DefaultTargets))

View File

@ -1,94 +0,0 @@
# Makefile for DataFlashBoot.bin
# Must use toolchain with H/W FLoating Point
BASENAME=dfboot
BINNAME=$(BASENAME).bin
OUTNAME=$(BASENAME).out
LSSNAME=$(BASENAME).lss
MAPNAME=$(BASENAME).map
BASENAME2=dfbptest
BINNAME2=$(BASENAME2).bin
OUTNAME2=$(BASENAME2).out
LSSNAME2=$(BASENAME2).lss
MAPNAME2=$(BASENAME2).map
INCPATH=include
CFLAGS_LOCAL=-Os -Wall -I$(INCPATH)
BUILD=$(CC) $(CFLAGS) $(CFLAGS_LOCAL)
LDFLAGS+=-T elf32-littlearm.lds -Ttext 0
LINK=$(LD) $(LDFLAGS)
OBJS=objs/cstartup_ram.o objs/at45.o objs/com.o objs/dataflash.o\
objs/div0.o objs/init.o objs/main.o objs/asm_isr.o objs/asm_mci_isr.o\
objs/mci_device.o objs/jump.o objs/_udivsi3.o objs/_umodsi3.o
OBJS2=objs/cstartup_ram.o objs/at45.o objs/com.o objs/dataflash.o\
objs/div0.o objs/init.o objs/ptmain.o objs/asm_isr.o objs/asm_mci_isr.o\
objs/mci_device.o objs/jump.o objs/_udivsi3.o objs/_umodsi3.o
I=config.h com.h dataflash.h embedded_services.h main.h stdio.h include/AT91RM9200.h include/lib_AT91RM9200.h
all:clean $(BASENAME) $(BASENAME2)
$(BASENAME): $(OBJS)
$(LINK) -n -o $(OUTNAME) $(OBJS)
$(OBJCOPY) $(OUTNAME) -O binary $(BINNAME)
$(OBJDUMP) -h -s $(OUTNAME) > $(LSSNAME)
$(NM) -n $(OUTNAME) | grep -v '\( [aUw] \)\|\(__crc_\)\|\( \$[adt]\)' > $(MAPNAME)
cp $(BINNAME) binary
$(BASENAME2): $(OBJS2)
$(LINK) -n -o $(OUTNAME2) $(OBJS2)
$(OBJCOPY) $(OUTNAME2) -O binary $(BINNAME2)
$(OBJDUMP) -h -s $(OUTNAME2) > $(LSSNAME2)
$(NM) -n $(OUTNAME2) | grep -v '\( [aUw] \)\|\(__crc_\)\|\( \$[adt]\)' > $(MAPNAME2)
cp $(BINNAME2) binary
# C objects here
objs/at45.o: at45.c $(I)
$(BUILD) -c -o objs/at45.o at45.c
objs/com.o: com.c $(I)
$(BUILD) -c -o objs/com.o com.c
objs/dataflash.o: dataflash.c $(I)
$(BUILD) -c -o objs/dataflash.o dataflash.c
objs/mci_device.o: mci_device.c $(I)
$(BUILD) -c -o objs/mci_device.o mci_device.c
objs/div0.o: div0.c $(I)
$(BUILD) -c -o objs/div0.o div0.c
objs/init.o: init.c $(I)
$(BUILD) -c -o objs/init.o init.c
objs/main.o: main.c $(I)
$(BUILD) -c -o objs/main.o main.c
objs/ptmain.o: main.c $(I)
$(BUILD) -c -D PRODTEST -o objs/ptmain.o main.c
# ASM objects here
objs/asm_isr.o: asm_isr.S
$(BUILD) -c -o objs/asm_isr.o asm_isr.S
objs/asm_mci_isr.o: asm_mci_isr.S
$(BUILD) -c -o objs/asm_mci_isr.o asm_mci_isr.S
objs/cstartup_ram.o: cstartup_ram.S
$(BUILD) -c -o objs/cstartup_ram.o cstartup_ram.S
objs/jump.o: jump.S
$(BUILD) -c -o objs/jump.o jump.S
objs/_udivsi3.o: _udivsi3.S
$(BUILD) -c -o objs/_udivsi3.o _udivsi3.S
objs/_umodsi3.o: _umodsi3.S
$(BUILD) -c -o objs/_umodsi3.o _umodsi3.S
install: $(BINNAME) $(BINNAME2)
cp $(BINNAME) binary
cp $(BINNAME2) binary
clean:
rm -f *~
rm -f objs/*
rm -f *.out
rm -f *.bin
rm -f *.lss
rm -f *.map
rm -f .unpacked
mkdir -p objs

View File

@ -1,77 +0,0 @@
/* # 1 "libgcc1.S" */
@ libgcc1 routines for ARM cpu.
@ Division routines, written by Richard Earnshaw, (rearnsha@armltd.co.uk)
dividend .req r0
divisor .req r1
result .req r2
curbit .req r3
/* ip .req r12 */
/* sp .req r13 */
/* lr .req r14 */
/* pc .req r15 */
.text
.globl __udivsi3
.type __udivsi3 ,function
.align 0
__udivsi3 :
cmp divisor, #0
beq Ldiv0
mov curbit, #1
mov result, #0
cmp dividend, divisor
bcc Lgot_result
Loop1:
@ Unless the divisor is very big, shift it up in multiples of
@ four bits, since this is the amount of unwinding in the main
@ division loop. Continue shifting until the divisor is
@ larger than the dividend.
cmp divisor, #0x10000000
cmpcc divisor, dividend
movcc divisor, divisor, lsl #4
movcc curbit, curbit, lsl #4
bcc Loop1
Lbignum:
@ For very big divisors, we must shift it a bit at a time, or
@ we will be in danger of overflowing.
cmp divisor, #0x80000000
cmpcc divisor, dividend
movcc divisor, divisor, lsl #1
movcc curbit, curbit, lsl #1
bcc Lbignum
Loop3:
@ Test for possible subtractions, and note which bits
@ are done in the result. On the final pass, this may subtract
@ too much from the dividend, but the result will be ok, since the
@ "bit" will have been shifted out at the bottom.
cmp dividend, divisor
subcs dividend, dividend, divisor
orrcs result, result, curbit
cmp dividend, divisor, lsr #1
subcs dividend, dividend, divisor, lsr #1
orrcs result, result, curbit, lsr #1
cmp dividend, divisor, lsr #2
subcs dividend, dividend, divisor, lsr #2
orrcs result, result, curbit, lsr #2
cmp dividend, divisor, lsr #3
subcs dividend, dividend, divisor, lsr #3
orrcs result, result, curbit, lsr #3
cmp dividend, #0 @ Early termination?
movnes curbit, curbit, lsr #4 @ No, any more bits to do?
movne divisor, divisor, lsr #4
bne Loop3
Lgot_result:
mov r0, result
mov pc, lr
Ldiv0:
str lr, [sp, #-4]!
bl __div0 (PLT)
mov r0, #0 @ about as wrong as it could be
ldmia sp!, {pc}
.size __udivsi3 , . - __udivsi3
/* # 235 "libgcc1.S" */
/* # 320 "libgcc1.S" */
/* # 421 "libgcc1.S" */
/* # 433 "libgcc1.S" */
/* # 456 "libgcc1.S" */
/* # 500 "libgcc1.S" */
/* # 580 "libgcc1.S" */

View File

@ -1,88 +0,0 @@
/* # 1 "libgcc1.S" */
@ libgcc1 routines for ARM cpu.
@ Division routines, written by Richard Earnshaw, (rearnsha@armltd.co.uk)
/* # 145 "libgcc1.S" */
dividend .req r0
divisor .req r1
overdone .req r2
curbit .req r3
/* ip .req r12 */
/* sp .req r13 */
/* lr .req r14 */
/* pc .req r15 */
.text
.globl __umodsi3
.type __umodsi3 ,function
.align 0
__umodsi3 :
cmp divisor, #0
beq Ldiv0
mov curbit, #1
cmp dividend, divisor
movcc pc, lr
Loop1:
@ Unless the divisor is very big, shift it up in multiples of
@ four bits, since this is the amount of unwinding in the main
@ division loop. Continue shifting until the divisor is
@ larger than the dividend.
cmp divisor, #0x10000000
cmpcc divisor, dividend
movcc divisor, divisor, lsl #4
movcc curbit, curbit, lsl #4
bcc Loop1
Lbignum:
@ For very big divisors, we must shift it a bit at a time, or
@ we will be in danger of overflowing.
cmp divisor, #0x80000000
cmpcc divisor, dividend
movcc divisor, divisor, lsl #1
movcc curbit, curbit, lsl #1
bcc Lbignum
Loop3:
@ Test for possible subtractions. On the final pass, this may
@ subtract too much from the dividend, so keep track of which
@ subtractions are done, we can fix them up afterwards...
mov overdone, #0
cmp dividend, divisor
subcs dividend, dividend, divisor
cmp dividend, divisor, lsr #1
subcs dividend, dividend, divisor, lsr #1
orrcs overdone, overdone, curbit, ror #1
cmp dividend, divisor, lsr #2
subcs dividend, dividend, divisor, lsr #2
orrcs overdone, overdone, curbit, ror #2
cmp dividend, divisor, lsr #3
subcs dividend, dividend, divisor, lsr #3
orrcs overdone, overdone, curbit, ror #3
mov ip, curbit
cmp dividend, #0 @ Early termination?
movnes curbit, curbit, lsr #4 @ No, any more bits to do?
movne divisor, divisor, lsr #4
bne Loop3
@ Any subtractions that we should not have done will be recorded in
@ the top three bits of "overdone". Exactly which were not needed
@ are governed by the position of the bit, stored in ip.
@ If we terminated early, because dividend became zero,
@ then none of the below will match, since the bit in ip will not be
@ in the bottom nibble.
ands overdone, overdone, #0xe0000000
moveq pc, lr @ No fixups needed
tst overdone, ip, ror #3
addne dividend, dividend, divisor, lsr #3
tst overdone, ip, ror #2
addne dividend, dividend, divisor, lsr #2
tst overdone, ip, ror #1
addne dividend, dividend, divisor, lsr #1
mov pc, lr
Ldiv0:
str lr, [sp, #-4]!
bl __div0 (PLT)
mov r0, #0 @ about as wrong as it could be
ldmia sp!, {pc}
.size __umodsi3 , . - __umodsi3
/* # 320 "libgcc1.S" */
/* # 421 "libgcc1.S" */
/* # 433 "libgcc1.S" */
/* # 456 "libgcc1.S" */
/* # 500 "libgcc1.S" */
/* # 580 "libgcc1.S" */

View File

@ -1,75 +0,0 @@
#include "AT91RM9200_inc.h"
#define ARM_MODE_USER 0x10
#define ARM_MODE_FIQ 0x11
#define ARM_MODE_IRQ 0x12
#define ARM_MODE_SVC 0x13
#define ARM_MODE_ABORT 0x17
#define ARM_MODE_UNDEF 0x1B
#define ARM_MODE_SYS 0x1F
#define I_BIT 0x80
#define F_BIT 0x40
#define T_BIT 0x20
/* -----------------------------------------------------------------------------
AT91F_ASM_SPI_Handler
---------------------
Handler called by the AIC
Save context
Call C handler
Restore context
----------------------------------------------------------------------------- */
.global AT91F_ST_ASM_HANDLER
AT91F_ST_ASM_HANDLER:
/* Adjust and save LR_irq in IRQ stack */
sub r14, r14, #4
stmfd sp!, {r14}
/* Write in the IVR to support Protect Mode
No effect in Normal Mode
De-assert the NIRQ and clear the source in Protect Mode */
ldr r14, =AT91C_BASE_AIC
str r14, [r14, #AIC_IVR]
/* Save SPSR and r0 in IRQ stack */
mrs r14, SPSR
stmfd sp!, {r0, r14}
/* Enable Interrupt and Switch in SYS Mode */
mrs r0, CPSR
bic r0, r0, #I_BIT
orr r0, r0, #ARM_MODE_SYS
msr CPSR_c, r0
/* Save scratch/used registers and LR in User Stack */
stmfd sp!, { r1-r3, r12, r14}
ldr r1, =AT91F_ST_HANDLER
mov r14, pc
bx r1
/* Restore scratch/used registers and LR from User Stack */
ldmia sp!, { r1-r3, r12, r14}
/* Disable Interrupt and switch back in IRQ mode */
mrs r0, CPSR
bic r0, r0, #ARM_MODE_SYS
orr r0, r0, #I_BIT | ARM_MODE_IRQ
msr CPSR_c, r0
/* Mark the End of Interrupt on the AIC */
ldr r0, =AT91C_BASE_AIC
str r0, [r0, #AIC_EOICR]
/* Restore SPSR_irq and r0 from IRQ stack */
ldmia sp!, {r0, r14}
msr SPSR_cxsf, r14
/* Restore adjusted LR_irq from IRQ stack directly in the PC */
ldmia sp!, {pc}^

View File

@ -1,75 +0,0 @@
#include <AT91RM9200_inc.h>
#define ARM_MODE_USER 0x10
#define ARM_MODE_FIQ 0x11
#define ARM_MODE_IRQ 0x12
#define ARM_MODE_SVC 0x13
#define ARM_MODE_ABORT 0x17
#define ARM_MODE_UNDEF 0x1B
#define ARM_MODE_SYS 0x1F
#define I_BIT 0x80
#define F_BIT 0x40
#define T_BIT 0x20
/* -----------------------------------------------------------------------------
AT91F_ASM_MCI_Handler
---------------------
Handler called by the AIC
Save context
Call C handler
Restore context
----------------------------------------------------------------------------- */
.global AT91F_ASM_MCI_Handler
AT91F_ASM_MCI_Handler:
/* Adjust and save LR_irq in IRQ stack */
sub r14, r14, #4
stmfd sp!, {r14}
/* Write in the IVR to support Protect Mode
No effect in Normal Mode
De-assert the NIRQ and clear the source in Protect Mode */
ldr r14, =AT91C_BASE_AIC
str r14, [r14, #AIC_IVR]
/* Save SPSR and r0 in IRQ stack */
mrs r14, SPSR
stmfd sp!, {r0, r14}
/* Enable Interrupt and Switch in SYS Mode */
mrs r0, CPSR
bic r0, r0, #I_BIT
orr r0, r0, #ARM_MODE_SYS
msr CPSR_c, r0
/* Save scratch/used registers and LR in User Stack */
stmfd sp!, { r1-r3, r12, r14}
ldr r1, =AT91F_MCI_Handler
mov r14, pc
bx r1
/* Restore scratch/used registers and LR from User Stack */
ldmia sp!, { r1-r3, r12, r14}
/* Disable Interrupt and switch back in IRQ mode */
mrs r0, CPSR
bic r0, r0, #ARM_MODE_SYS
orr r0, r0, #I_BIT | ARM_MODE_IRQ
msr CPSR_c, r0
/* Mark the End of Interrupt on the AIC */
ldr r0, =AT91C_BASE_AIC
str r0, [r0, #AIC_EOICR]
/* Restore SPSR_irq and r0 from IRQ stack */
ldmia sp!, {r0, r14}
msr SPSR_cxsf, r14
/* Restore adjusted LR_irq from IRQ stack directly in the PC */
ldmia sp!, {pc}^

View File

@ -1,595 +0,0 @@
/*----------------------------------------------------------------------------
* ATMEL Microcontroller Software Support - ROUSSET -
*----------------------------------------------------------------------------
* The software is delivered "AS IS" without warranty or condition of any
* kind, either express, implied or statutory. This includes without
* limitation any warranty or condition with respect to merchantability or
* fitness for any particular purpose, or against the infringements of
* intellectual property rights of others.
*----------------------------------------------------------------------------
* File Name : at45c.h
* Object :
*
* 1.0 10/12/03 HIi : Creation.
* 1.01 03/05/04 HIi : Bug Fix in AT91F_DataFlashWaitReady() Function.
*----------------------------------------------------------------------------
*/
#include "config.h"
#include "stdio.h"
#include "AT91RM9200.h"
#include "lib_AT91RM9200.h"
#include "dataflash.h"
#include "main.h"
/*----------------------------------------------------------------------------*/
/* \fn AT91F_SpiInit */
/* \brief SPI Low level Init */
/*----------------------------------------------------------------------------*/
void AT91F_SpiInit(void) {
/* Configure PIOs */
AT91C_BASE_PIOA->PIO_ASR = AT91C_PA3_NPCS0 | AT91C_PA4_NPCS1 |
AT91C_PA1_MOSI | AT91C_PA5_NPCS2 |
AT91C_PA6_NPCS3 | AT91C_PA0_MISO |
AT91C_PA2_SPCK;
AT91C_BASE_PIOA->PIO_PDR = AT91C_PA3_NPCS0 | AT91C_PA4_NPCS1 |
AT91C_PA1_MOSI | AT91C_PA5_NPCS2 |
AT91C_PA6_NPCS3 | AT91C_PA0_MISO |
AT91C_PA2_SPCK;
/* Enable CLock */
AT91C_BASE_PMC->PMC_PCER = 1 << AT91C_ID_SPI;
/* Reset the SPI */
AT91C_BASE_SPI->SPI_CR = AT91C_SPI_SWRST;
/* Configure SPI in Master Mode with No CS selected !!! */
AT91C_BASE_SPI->SPI_MR = AT91C_SPI_MSTR | AT91C_SPI_MODFDIS | AT91C_SPI_PCS;
/* Configure CS0 and CS3 */
*(AT91C_SPI_CSR + 0) = AT91C_SPI_CPOL | (AT91C_SPI_DLYBS & DATAFLASH_TCSS) |
(AT91C_SPI_DLYBCT & DATAFLASH_TCHS) |
((AT91C_MASTER_CLOCK / (2*AT91C_SPI_CLK)) << 8);
*(AT91C_SPI_CSR + 3) = AT91C_SPI_CPOL | (AT91C_SPI_DLYBS & DATAFLASH_TCSS) |
(AT91C_SPI_DLYBCT & DATAFLASH_TCHS) |
((AT91C_MASTER_CLOCK / (2*AT91C_SPI_CLK)) << 8);
}
/*----------------------------------------------------------------------------*/
/* \fn AT91F_SpiEnable */
/* \brief Enable SPI chip select */
/*----------------------------------------------------------------------------*/
static void AT91F_SpiEnable(int cs) {
switch(cs) {
case 0: /* Configure SPI CS0 for Serial DataFlash AT45DBxx */
AT91C_BASE_SPI->SPI_MR &= 0xFFF0FFFF;
AT91C_BASE_SPI->SPI_MR |= ((AT91C_SPI_PCS0_SERIAL_DATAFLASH << 16) & AT91C_SPI_PCS);
break;
case 3: /* Configure SPI CS3 for Serial DataFlash Card */
/* Set up PIO SDC_TYPE to switch on DataFlash Card and not MMC/SDCard */
AT91C_BASE_PIOB->PIO_PER = AT91C_PIO_PB7; /* Set in PIO mode */
AT91C_BASE_PIOB->PIO_OER = AT91C_PIO_PB7; /* Configure in output */
/* Clear Output */
AT91C_BASE_PIOB->PIO_CODR = AT91C_PIO_PB7;
/* Configure PCS */
AT91C_BASE_SPI->SPI_MR &= 0xFFF0FFFF;
AT91C_BASE_SPI->SPI_MR |= ((AT91C_SPI_PCS3_DATAFLASH_CARD<<16) & AT91C_SPI_PCS);
break;
}
/* SPI_Enable */
AT91C_BASE_SPI->SPI_CR = AT91C_SPI_SPIEN;
}
/*----------------------------------------------------------------------------*/
/* \fn AT91F_SpiWrite */
/* \brief Set the PDC registers for a transfert */
/*----------------------------------------------------------------------------*/
static unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc)
{
unsigned int timeout;
AT91C_BASE_SPI->SPI_PTCR = AT91C_PDC_TXTDIS + AT91C_PDC_RXTDIS;
/* Initialize the Transmit and Receive Pointer */
AT91C_BASE_SPI->SPI_RPR = (unsigned int)pDesc->rx_cmd_pt ;
AT91C_BASE_SPI->SPI_TPR = (unsigned int)pDesc->tx_cmd_pt ;
/* Intialize the Transmit and Receive Counters */
AT91C_BASE_SPI->SPI_RCR = pDesc->rx_cmd_size;
AT91C_BASE_SPI->SPI_TCR = pDesc->tx_cmd_size;
if ( pDesc->tx_data_size != 0 ) {
/* Initialize the Next Transmit and Next Receive Pointer */
AT91C_BASE_SPI->SPI_RNPR = (unsigned int)pDesc->rx_data_pt ;
AT91C_BASE_SPI->SPI_TNPR = (unsigned int)pDesc->tx_data_pt ;
/* Intialize the Next Transmit and Next Receive Counters */
AT91C_BASE_SPI->SPI_RNCR = pDesc->rx_data_size ;
AT91C_BASE_SPI->SPI_TNCR = pDesc->tx_data_size ;
}
/* ARM simple, non interrupt dependent timer */
timeout = 0;
AT91C_BASE_SPI->SPI_PTCR = AT91C_PDC_TXTEN + AT91C_PDC_RXTEN;
while(!(AT91C_BASE_SPI->SPI_SR & AT91C_SPI_RXBUFF));
AT91C_BASE_SPI->SPI_PTCR = AT91C_PDC_TXTDIS + AT91C_PDC_RXTDIS;
if (timeout >= AT91C_DATAFLASH_TIMEOUT){
return AT91C_DATAFLASH_ERROR;
}
return AT91C_DATAFLASH_OK;
}
/*----------------------------------------------------------------------*/
/* \fn AT91F_DataFlashSendCommand */
/* \brief Generic function to send a command to the dataflash */
/*----------------------------------------------------------------------*/
static AT91S_DataFlashStatus AT91F_DataFlashSendCommand(
AT91PS_DataFlash pDataFlash,
unsigned char OpCode,
unsigned int CmdSize,
unsigned int DataflashAddress)
{
unsigned int adr;
/* process the address to obtain page address and byte address */
adr = ((DataflashAddress / (pDataFlash->pDevice->pages_size))
<< pDataFlash->pDevice->page_offset) +
(DataflashAddress % (pDataFlash->pDevice->pages_size));
/* fill the command buffer */
pDataFlash->pDataFlashDesc->command[0] = OpCode;
if (pDataFlash->pDevice->pages_number >= 16384)
{
pDataFlash->pDataFlashDesc->command[1] = (unsigned char)((adr & 0x0F000000) >> 24);
pDataFlash->pDataFlashDesc->command[2] = (unsigned char)((adr & 0x00FF0000) >> 16);
pDataFlash->pDataFlashDesc->command[3] = (unsigned char)((adr & 0x0000FF00) >> 8);
pDataFlash->pDataFlashDesc->command[4] = (unsigned char)(adr & 0x000000FF);
}
else
{
pDataFlash->pDataFlashDesc->command[1] = (unsigned char)((adr & 0x00FF0000) >> 16);
pDataFlash->pDataFlashDesc->command[2] = (unsigned char)((adr & 0x0000FF00) >> 8);
pDataFlash->pDataFlashDesc->command[3] = (unsigned char)(adr & 0x000000FF) ;
pDataFlash->pDataFlashDesc->command[4] = 0;
}
pDataFlash->pDataFlashDesc->command[5] = 0;
pDataFlash->pDataFlashDesc->command[6] = 0;
pDataFlash->pDataFlashDesc->command[7] = 0;
/* Initialize the SpiData structure for the spi write fuction */
pDataFlash->pDataFlashDesc->tx_cmd_pt = pDataFlash->pDataFlashDesc->command ;
pDataFlash->pDataFlashDesc->tx_cmd_size = CmdSize ;
pDataFlash->pDataFlashDesc->rx_cmd_pt = pDataFlash->pDataFlashDesc->command ;
pDataFlash->pDataFlashDesc->rx_cmd_size = CmdSize ;
return AT91F_SpiWrite(pDataFlash->pDataFlashDesc);
}
/*----------------------------------------------------------------------*/
/* \fn AT91F_DataFlashGetStatus */
/* \brief Read the status register of the dataflash */
/*----------------------------------------------------------------------*/
static AT91S_DataFlashStatus AT91F_DataFlashGetStatus(AT91PS_DataflashDesc pDesc)
{
AT91S_DataFlashStatus status;
/* first send the read status command (D7H) */
pDesc->command[0] = DB_STATUS;
pDesc->command[1] = 0;
pDesc->DataFlash_state = GET_STATUS;
pDesc->tx_data_size = 0 ; /* Transmit the command and receive response */
pDesc->tx_cmd_pt = pDesc->command ;
pDesc->rx_cmd_pt = pDesc->command ;
pDesc->rx_cmd_size = 2 ;
pDesc->tx_cmd_size = 2 ;
status = AT91F_SpiWrite (pDesc);
pDesc->DataFlash_state = *( (unsigned char *) (pDesc->rx_cmd_pt) +1);
return status;
}
/*-----------------------------------------------------------------------------
* Function Name : AT91F_DataFlashWaitReady
* Object : wait for dataflash ready (bit7 of the status register == 1)
* Input Parameters : DataFlash Service and timeout
* Return value : DataFlash status "ready or not"
*-----------------------------------------------------------------------------
*/
static AT91S_DataFlashStatus AT91F_DataFlashWaitReady(
AT91PS_DataflashDesc pDataFlashDesc,
unsigned int timeout)
{
pDataFlashDesc->DataFlash_state = IDLE;
do {
AT91F_DataFlashGetStatus(pDataFlashDesc);
timeout--;
}
while(((pDataFlashDesc->DataFlash_state & 0x80) != 0x80) && (timeout > 0));
if((pDataFlashDesc->DataFlash_state & 0x80) != 0x80)
return AT91C_DATAFLASH_ERROR;
return AT91C_DATAFLASH_OK;
}
/*------------------------------------------------------------------------------*/
/* Function Name : AT91F_DataFlashContinuousRead */
/* Object : Continuous stream Read */
/* Input Parameters : DataFlash Service */
/* : <src> = dataflash address */
/* : <*dataBuffer> = data buffer pointer */
/* : <sizeToRead> = data buffer size */
/* Return value : State of the dataflash */
/*------------------------------------------------------------------------------*/
static AT91S_DataFlashStatus AT91F_DataFlashContinuousRead(
AT91PS_DataFlash pDataFlash,
int src,
unsigned char *dataBuffer,
int sizeToRead )
{
AT91S_DataFlashStatus status;
/* Test the size to read in the device */
if ( (src + sizeToRead) > (pDataFlash->pDevice->pages_size * (pDataFlash->pDevice->pages_number)))
return AT91C_DATAFLASH_MEMORY_OVERFLOW;
pDataFlash->pDataFlashDesc->rx_data_pt = dataBuffer;
pDataFlash->pDataFlashDesc->rx_data_size = sizeToRead;
pDataFlash->pDataFlashDesc->tx_data_pt = dataBuffer;
pDataFlash->pDataFlashDesc->tx_data_size = sizeToRead;
status = AT91F_DataFlashSendCommand(pDataFlash, DB_CONTINUOUS_ARRAY_READ, 8, src);
/* Send the command to the dataflash */
return(status);
}
/*------------------------------------------------------------------------------*/
/* Function Name : AT91F_MainMemoryToBufferTransfer */
/* Object : Read a page in the SRAM Buffer 1 or 2 */
/* Input Parameters : DataFlash Service */
/* : Page concerned */
/* : */
/* Return value : State of the dataflash */
/*------------------------------------------------------------------------------*/
static AT91S_DataFlashStatus AT91F_MainMemoryToBufferTransfer(
AT91PS_DataFlash pDataFlash,
unsigned char BufferCommand,
unsigned int page)
{
int cmdsize;
/* Test if the buffer command is legal */
if ((BufferCommand != DB_PAGE_2_BUF1_TRF) && (BufferCommand != DB_PAGE_2_BUF2_TRF))
return AT91C_DATAFLASH_BAD_COMMAND;
/* no data to transmit or receive */
pDataFlash->pDataFlashDesc->tx_data_size = 0;
cmdsize = 4;
if (pDataFlash->pDevice->pages_number >= 16384)
cmdsize = 5;
return(AT91F_DataFlashSendCommand(pDataFlash, BufferCommand, cmdsize,
page*pDataFlash->pDevice->pages_size));
}
/*----------------------------------------------------------------------------- */
/* Function Name : AT91F_DataFlashWriteBuffer */
/* Object : Write data to the internal sram buffer 1 or 2 */
/* Input Parameters : DataFlash Service */
/* : <BufferCommand> = command to write buffer1 or buffer2 */
/* : <*dataBuffer> = data buffer to write */
/* : <bufferAddress> = address in the internal buffer */
/* : <SizeToWrite> = data buffer size */
/* Return value : State of the dataflash */
/*------------------------------------------------------------------------------*/
static AT91S_DataFlashStatus AT91F_DataFlashWriteBuffer(
AT91PS_DataFlash pDataFlash,
unsigned char BufferCommand,
unsigned char *dataBuffer,
unsigned int bufferAddress,
int SizeToWrite )
{
int cmdsize;
/* Test if the buffer command is legal */
if ((BufferCommand != DB_BUF1_WRITE) && (BufferCommand != DB_BUF2_WRITE))
return AT91C_DATAFLASH_BAD_COMMAND;
/* buffer address must be lower than page size */
if (bufferAddress > pDataFlash->pDevice->pages_size)
return AT91C_DATAFLASH_BAD_ADDRESS;
/* Send first Write Command */
pDataFlash->pDataFlashDesc->command[0] = BufferCommand;
pDataFlash->pDataFlashDesc->command[1] = 0;
if (pDataFlash->pDevice->pages_number >= 16384)
{
pDataFlash->pDataFlashDesc->command[2] = 0;
pDataFlash->pDataFlashDesc->command[3] = (unsigned char)(((unsigned int)(bufferAddress & pDataFlash->pDevice->byte_mask)) >> 8) ;
pDataFlash->pDataFlashDesc->command[4] = (unsigned char)((unsigned int)bufferAddress & 0x00FF) ;
cmdsize = 5;
}
else
{
pDataFlash->pDataFlashDesc->command[2] = (unsigned char)(((unsigned int)(bufferAddress & pDataFlash->pDevice->byte_mask)) >> 8) ;
pDataFlash->pDataFlashDesc->command[3] = (unsigned char)((unsigned int)bufferAddress & 0x00FF) ;
pDataFlash->pDataFlashDesc->command[4] = 0;
cmdsize = 4;
}
pDataFlash->pDataFlashDesc->tx_cmd_pt = pDataFlash->pDataFlashDesc->command ;
pDataFlash->pDataFlashDesc->tx_cmd_size = cmdsize ;
pDataFlash->pDataFlashDesc->rx_cmd_pt = pDataFlash->pDataFlashDesc->command ;
pDataFlash->pDataFlashDesc->rx_cmd_size = cmdsize ;
pDataFlash->pDataFlashDesc->rx_data_pt = dataBuffer ;
pDataFlash->pDataFlashDesc->tx_data_pt = dataBuffer ;
pDataFlash->pDataFlashDesc->rx_data_size = SizeToWrite ;
pDataFlash->pDataFlashDesc->tx_data_size = SizeToWrite ;
return AT91F_SpiWrite(pDataFlash->pDataFlashDesc);
}
/*------------------------------------------------------------------------------*/
/* Function Name : AT91F_PageErase */
/* Object : Read a page in the SRAM Buffer 1 or 2 */
/* Input Parameters : DataFlash Service */
/* : Page concerned */
/* : */
/* Return value : State of the dataflash */
/*------------------------------------------------------------------------------*/
static AT91S_DataFlashStatus AT91F_PageErase(
AT91PS_DataFlash pDataFlash,
unsigned int page)
{
int cmdsize;
/* Test if the buffer command is legal */
/* no data to transmit or receive */
pDataFlash->pDataFlashDesc->tx_data_size = 0;
cmdsize = 4;
if (pDataFlash->pDevice->pages_number >= 16384)
cmdsize = 5;
return(AT91F_DataFlashSendCommand(pDataFlash, DB_PAGE_ERASE, cmdsize,
page*pDataFlash->pDevice->pages_size));
}
/*------------------------------------------------------------------------------*/
/* Function Name : AT91F_WriteBufferToMain */
/* Object : Write buffer to the main memory */
/* Input Parameters : DataFlash Service */
/* : <BufferCommand> = command to send to buf1 or buf2 */
/* : <dest> = main memory address */
/* Return value : State of the dataflash */
/*------------------------------------------------------------------------------*/
static AT91S_DataFlashStatus AT91F_WriteBufferToMain (
AT91PS_DataFlash pDataFlash,
unsigned char BufferCommand,
unsigned int dest )
{
int cmdsize;
/* Test if the buffer command is correct */
if ((BufferCommand != DB_BUF1_PAGE_PGM) &&
(BufferCommand != DB_BUF1_PAGE_ERASE_PGM) &&
(BufferCommand != DB_BUF2_PAGE_PGM) &&
(BufferCommand != DB_BUF2_PAGE_ERASE_PGM) )
return AT91C_DATAFLASH_BAD_COMMAND;
/* no data to transmit or receive */
pDataFlash->pDataFlashDesc->tx_data_size = 0;
cmdsize = 4;
if (pDataFlash->pDevice->pages_number >= 16384)
cmdsize = 5;
/* Send the command to the dataflash */
return(AT91F_DataFlashSendCommand (pDataFlash, BufferCommand, cmdsize, dest));
}
/*------------------------------------------------------------------------------*/
/* Function Name : AT91F_PartialPageWrite */
/* Object : Erase partially a page */
/* Input Parameters : <page> = page number */
/* : <AdrInpage> = adr to begin the fading */
/* : <length> = Number of bytes to erase */
/*------------------------------------------------------------------------------*/
static AT91S_DataFlashStatus AT91F_PartialPageWrite (
AT91PS_DataFlash pDataFlash,
unsigned char *src,
unsigned int dest,
unsigned int size)
{
unsigned int page;
unsigned int AdrInPage;
page = dest / (pDataFlash->pDevice->pages_size);
AdrInPage = dest % (pDataFlash->pDevice->pages_size);
/* Read the contents of the page in the Sram Buffer */
AT91F_MainMemoryToBufferTransfer(pDataFlash, DB_PAGE_2_BUF1_TRF, page);
AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_DATAFLASH_TIMEOUT);
/*Update the SRAM buffer */
AT91F_DataFlashWriteBuffer(pDataFlash, DB_BUF1_WRITE, src, AdrInPage, size);
AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_DATAFLASH_TIMEOUT);
/* Erase page if a 128 Mbits device */
if (pDataFlash->pDevice->pages_number >= 16384)
{
AT91F_PageErase(pDataFlash, page);
AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_DATAFLASH_TIMEOUT);
}
/* Rewrite the modified Sram Buffer in the main memory */
return(AT91F_WriteBufferToMain(pDataFlash, DB_BUF1_PAGE_ERASE_PGM,
(page*pDataFlash->pDevice->pages_size)));
}
/*------------------------------------------------------------------------------*/
/* Function Name : AT91F_DataFlashWrite */
/* Object : */
/* Input Parameters : <*src> = Source buffer */
/* : <dest> = dataflash adress */
/* : <size> = data buffer size */
/*------------------------------------------------------------------------------*/
AT91S_DataFlashStatus AT91F_DataFlashWrite(
AT91PS_DataFlash pDataFlash,
unsigned char *src,
int dest,
int size )
{
unsigned int length;
unsigned int page;
unsigned int status;
AT91F_SpiEnable(pDataFlash->pDevice->cs);
if ( (dest + size) > (pDataFlash->pDevice->pages_size * (pDataFlash->pDevice->pages_number)))
return AT91C_DATAFLASH_MEMORY_OVERFLOW;
/* If destination does not fit a page start address */
if ((dest % ((unsigned int)(pDataFlash->pDevice->pages_size))) != 0 ) {
length = pDataFlash->pDevice->pages_size - (dest % ((unsigned int)(pDataFlash->pDevice->pages_size)));
if (size < length)
length = size;
if(!AT91F_PartialPageWrite(pDataFlash,src, dest, length))
return AT91C_DATAFLASH_ERROR;
AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_DATAFLASH_TIMEOUT);
/* Update size, source and destination pointers */
size -= length;
dest += length;
src += length;
}
while (( size - pDataFlash->pDevice->pages_size ) >= 0 )
{
/* program dataflash page */
page = (unsigned int)dest / (pDataFlash->pDevice->pages_size);
status = AT91F_DataFlashWriteBuffer(pDataFlash, DB_BUF1_WRITE, src,
0, pDataFlash->pDevice->pages_size);
AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_DATAFLASH_TIMEOUT);
status = AT91F_PageErase(pDataFlash, page);
AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_DATAFLASH_TIMEOUT);
if (!status)
return AT91C_DATAFLASH_ERROR;
status = AT91F_WriteBufferToMain (pDataFlash, DB_BUF1_PAGE_PGM, dest);
if(!status)
return AT91C_DATAFLASH_ERROR;
AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_DATAFLASH_TIMEOUT);
/* Update size, source and destination pointers */
size -= pDataFlash->pDevice->pages_size ;
dest += pDataFlash->pDevice->pages_size ;
src += pDataFlash->pDevice->pages_size ;
}
/* If still some bytes to read */
if ( size > 0 ) {
/* program dataflash page */
if(!AT91F_PartialPageWrite(pDataFlash, src, dest, size) )
return AT91C_DATAFLASH_ERROR;
AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_DATAFLASH_TIMEOUT);
}
return AT91C_DATAFLASH_OK;
}
/*------------------------------------------------------------------------------*/
/* Function Name : AT91F_DataFlashRead */
/* Object : Read a block in dataflash */
/* Input Parameters : */
/* Return value : */
/*------------------------------------------------------------------------------*/
int AT91F_DataFlashRead(
AT91PS_DataFlash pDataFlash,
unsigned long addr,
unsigned long size,
char *buffer)
{
unsigned long SizeToRead;
AT91F_SpiEnable(pDataFlash->pDevice->cs);
if(AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_DATAFLASH_TIMEOUT) != AT91C_DATAFLASH_OK)
return -1;
while (size)
{
SizeToRead = (size < 0x8000)? size:0x8000;
if (AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_DATAFLASH_TIMEOUT)
!= AT91C_DATAFLASH_OK)
return -1;
if (AT91F_DataFlashContinuousRead (pDataFlash, addr, (unsigned char *)buffer,
SizeToRead) != AT91C_DATAFLASH_OK)
return -1;
size -= SizeToRead;
addr += SizeToRead;
buffer += SizeToRead;
}
return AT91C_DATAFLASH_OK;
}
/*------------------------------------------------------------------------------*/
/* Function Name : AT91F_DataflashProbe */
/* Object : */
/* Input Parameters : */
/* Return value : Dataflash status register */
/*------------------------------------------------------------------------------*/
int AT91F_DataflashProbe(int cs, AT91PS_DataflashDesc pDesc)
{
AT91F_SpiEnable(cs);
AT91F_DataFlashGetStatus(pDesc);
return ((pDesc->command[1] == 0xFF)? 0: (pDesc->command[1] & 0x3C));
}
/*------------------------------------------------------------------------------*/
/* Function Name : AT91F_DataFlashErase */
/* Object : */
/* Input Parameters : <*pDataFlash> = Device info */
/*------------------------------------------------------------------------------*/
AT91S_DataFlashStatus AT91F_DataFlashErase(AT91PS_DataFlash pDataFlash)
{
unsigned int page;
unsigned int status;
AT91F_SpiEnable(pDataFlash->pDevice->cs);
for(page=0; page < pDataFlash->pDevice->pages_number; page++)
{
/* Erase dataflash page */
if ((page & 0x00FF) == 0)
printf("\rERA %d/%d", page, pDataFlash->pDevice->pages_number);
status = AT91F_PageErase(pDataFlash, page);
AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_DATAFLASH_TIMEOUT);
if (!status)
return AT91C_DATAFLASH_ERROR;
}
return AT91C_DATAFLASH_OK;
}

View File

@ -1,368 +0,0 @@
/*----------------------------------------------------------------------------
* ATMEL Microcontroller Software Support - ROUSSET -
*----------------------------------------------------------------------------
* The software is delivered "AS IS" without warranty or condition of any
* kind, either express, implied or statutory. This includes without
* limitation any warranty or condition with respect to merchantability or
* fitness for any particular purpose, or against the infringements of
* intellectual property rights of others.
*----------------------------------------------------------------------------
* File Name : com.c
* Object :
* Creation : HIi 03/27/2003
*
*----------------------------------------------------------------------------
*/
#include "AT91RM9200.h"
#include "lib_AT91RM9200.h"
#include "config.h"
#include "com.h"
#include "stdio.h"
static char erase_seq[] = "\b \b"; /* erase sequence */
#define MAX_UARTS 1
//unsigned int usa[2] = {(unsigned int)AT91C_BASE_DBGU, (unsigned int)AT91C_ALTERNATE_USART};
unsigned int usa[1] = {(unsigned int)AT91C_BASE_DBGU};
unsigned int us;
int port_detected;
void at91_init_uarts(void)
{
int i;
port_detected = 0;
AT91F_DBGU_CfgPIO();
AT91F_US0_CfgPIO();
AT91F_US0_CfgPMC();
for(i=0; i<MAX_UARTS; i++) {
us = usa[i];
AT91F_US_ResetRx((AT91PS_USART)us);
AT91F_US_ResetTx((AT91PS_USART)us);
// Configure DBGU
AT91F_US_Configure(
(AT91PS_USART)us, // DBGU base address
AT91C_MASTER_CLOCK, // 60 MHz
AT91C_US_ASYNC_MODE, // mode Register to be programmed
115200, // baudrate to be programmed
0 // timeguard to be programmed
);
// Enable Transmitter
AT91F_US_EnableTx((AT91PS_USART)us);
// Enable Receiver
AT91F_US_EnableRx((AT91PS_USART)us);
}
us = usa[0];
}
int at91_serial_putc(int ch)
{
if (ch == '\n')
at91_serial_putc('\r');
while (!AT91F_US_TxReady((AT91PS_USART)us));
AT91F_US_PutChar((AT91PS_USART)us, (char)ch);
return ch;
}
/* This getc is modified to be able work on more than one port. On certain
* boards (i.e. Figment Designs VersaLink), the debug port is not available
* once the unit is in it's enclosure, so, if one needs to get into dfboot
* for any reason it is impossible. With this getc, it scans between the debug
* port and another port and once it receives a character, it sets that port
* as the debug port. */
int at91_serial_getc()
{
while(1) {
#if 0
if (!port_detected) {
if (us == usa[0]) {
us = usa[1];
}
else {
us = usa[0];
}
}
#endif
if(AT91F_US_RxReady((AT91PS_USART)us)) {
#if 0
port_detected = 1;
#endif
return((int)AT91F_US_GetChar((AT91PS_USART)us));
}
}
}
/*-----------------------------------------------------------------------------
* Function Name : AT91F_ReadLine()
* Object :
* Input Parameters :
* Return value :
*-----------------------------------------------------------------------------
*/
int AT91F_ReadLine (const char *const prompt, char *console_buffer)
{
char *p = console_buffer;
int n = 0; /* buffer index */
int plen = strlen (prompt); /* prompt length */
int col; /* output column cnt */
char c;
/* print prompt */
if (prompt)
printf(prompt);
col = plen;
for (;;) {
c = getc();
switch (c) {
case '\r': /* Enter */
case '\n':
*p = '\0';
puts ("\n");
return (p - console_buffer);
case 0x03: /* ^C - break */
console_buffer[0] = '\0'; /* discard input */
return (-1);
case 0x08: /* ^H - backspace */
case 0x7F: /* DEL - backspace */
if (n) {
--p;
printf(erase_seq);
col--;
n--;
}
continue;
default:
/*
* Must be a normal character then
*/
if (n < (AT91C_CB_SIZE -2))
{
++col; /* echo input */
putc(c);
*p++ = c;
++n;
}
else
{ /* Buffer full */
putc('\a');
}
}
}
}
/*-----------------------------------------------------------------------------
* Function Name : AT91F_WaitKeyPressed()
* Object :
* Input Parameters :
* Return value :
*-----------------------------------------------------------------------------
*/
void AT91F_WaitKeyPressed(void)
{
int c;
puts("KEY");
c = getc();
putc('\n');
}
int puts(const char *str)
{
while(*str != 0) {
at91_serial_putc(*str);
str++;
}
return 1;
}
int putc(int c)
{
return at91_serial_putc(c);
}
int putchar(c)
{
return putc(c);
}
int getc()
{
return at91_serial_getc();
}
int strlen(const char *str)
{
int len = 0;
if(str == (char *)0)
return 0;
while(*str++ != 0)
len++;
return len;
}
#define ZEROPAD 1 /* pad with zero */
#define SIGN 2 /* unsigned/signed long */
#define LEFT 4 /* left justified */
#define LARGE 8 /* use 'ABCDEF' instead of 'abcdef' */
#define do_div(n,base) ({ \
int __res; \
__res = ((unsigned) n) % (unsigned) base; \
n = ((unsigned) n) / (unsigned) base; \
__res; \
})
static int number(int num, int base, int size,
int precision, int type)
{
char c, sign, tmp[66];
const char *digits="0123456789ABCDEF";
int i;
if (type & LEFT)
type &= ~ZEROPAD;
if (base < 2 || base > 16)
return 0;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if(type & SIGN && num < 0)
{
sign = '-';
num = -num;
size--;
}
i = 0;
if(num == 0)
tmp[i++] = digits[0];
else while(num != 0)
tmp[i++] = digits[do_div(num, base)];
if(i > precision)
precision = i;
size -= precision;
if(!(type&(ZEROPAD+LEFT)))
while(size-->0)
putc(' ');
if(sign)
putc(sign);
if (!(type & LEFT))
while (size-- > 0)
putc(c);
while (i < precision--)
putc('0');
while (i-- > 0)
putc(tmp[i]);
while (size-- > 0)
putc(' ');;
return 1;
}
int hvfprintf(const char *fmt, va_list va)
{
char *s;
do {
if(*fmt == '%') {
bool done = false;
int type = 0;
int precision = 0;
do {
fmt++;
switch(*fmt) {
case '0' :
if(!precision)
type |= ZEROPAD;
case '1' :
case '2' :
case '3' :
case '4' :
case '5' :
case '6' :
case '7' :
case '8' :
case '9' :
precision = precision * 10 + (*fmt - '0');
break;
case '.' :
break;
case 's' :
s = va_arg(va, char *);
if(!s)
puts("<NULL>");
else
puts(s);
done = true;
break;
case 'c' :
putc(va_arg(va, int));
done = true;
break;
case 'd' :
number(va_arg(va, int), 10, 0, precision, type);
done = true;
break;
case 'x' :
case 'X' :
number(va_arg(va, int), 16, 0, precision, type);
done = true;
break;
case '%' :
putc(*fmt);
done = true;
default:
putc('%');
putc(*fmt);
done = true;
break;
}
} while(!done);
} else if(*fmt == '\\') {
fmt++;
if(*fmt == 'r') {
putc('\r');
} else if(*fmt == 'n') {
putc('\n');
}
} else {
putc(*fmt);
}
fmt++;
} while(*fmt != 0);
return 0;
}
int printf(const char *fmt, ...)
{
va_list ap;
int i;
va_start(ap, fmt);
i = hvfprintf(fmt, ap);
va_end(ap);
return i;
}

View File

@ -1,28 +0,0 @@
/*----------------------------------------------------------------------------
* ATMEL Microcontroller Software Support - ROUSSET -
*----------------------------------------------------------------------------
* The software is delivered "AS IS" without warranty or condition of any
* kind, either express, implied or statutory. This includes without
* limitation any warranty or condition with respect to merchantability or
* fitness for any particular purpose, or against the infringements of
* intellectual property rights of others.
*----------------------------------------------------------------------------
* File Name : com.h
* Object :
*
* 1.0 27/03/03 HIi : Creation
*----------------------------------------------------------------------------
*/
#ifndef com_h
#define com_h
#define AT91C_CB_SIZE 20 /* size of the console buffer */
/* Escape sequences */
#define ESC \033
extern int AT91F_ReadLine (const char *const prompt, char *console_buffer);
extern void AT91F_WaitKeyPressed(void);
#endif

View File

@ -1,17 +0,0 @@
#ifndef _CONFIG_H
#define _CONFIG_H
//#define PAGESZ_1056 1
#undef PAGESZ_1056
#define SPI_LOW_SPEED 1
#define AT91C_DELAY_TO_BOOT 1500
#define CRC_RETRIES 0x100
#define AT91C_MASTER_CLOCK 59904000
#define AT91C_BAUD_RATE 115200
#define AT91C_ALTERNATE_USART AT91C_BASE_US0
#endif

View File

@ -1,144 +0,0 @@
#include "AT91RM9200_inc.h"
/*---------------------------
ARM Core Mode and Status Bits
---------------------------*/
.section start
.text
#define ARM_MODE_USER 0x10
#define ARM_MODE_FIQ 0x11
#define ARM_MODE_IRQ 0x12
#define ARM_MODE_SVC 0x13
#define ARM_MODE_ABORT 0x17
#define ARM_MODE_UNDEF 0x1B
#define ARM_MODE_SYS 0x1F
#define I_BIT 0x80
#define F_BIT 0x40
#define T_BIT 0x20
/*----------------------------------------------------------------------------
Area Definition
----------------
Must be defined as function to put first in the code as it must be mapped
at offset 0 of the flash EBI_CSR0, ie. at address 0 before remap.
_---------------------------------------------------------------------------*/
.align 4
.globl _start
_start:
/*----------------------------------------------------------------------------
Exception vectors ( before Remap )
------------------------------------
These vectors are read at address 0.
They absolutely requires to be in relative addresssing mode in order to
guarantee a valid jump. For the moment, all are just looping (what may be
dangerous in a final system). If an exception occurs before remap, this
would result in an infinite loop.
----------------------------------------------------------------------------*/
b reset /* reset */
b undefvec /* Undefined Instruction */
b swivec /* Software Interrupt */
b pabtvec /* Prefetch Abort */
b dabtvec /* Data Abort */
b rsvdvec /* reserved */
b aicvec /* IRQ : read the AIC */
b fiqvec /* FIQ */
undefvec:
swivec:
pabtvec:
dabtvec:
rsvdvec:
aicvec:
fiqvec:
b undefvec
reset:
#define MEMEND 0x00004000
/* ----------------------------
Setup the stack for each mode
---------------------------- */
#define IRQ_STACK_SIZE 0x10
#define FIQ_STACK_SIZE 0x04
#define ABT_STACK_SIZE 0x04
#define UND_STACK_SIZE 0x04
#define SVC_STACK_SIZE 0x10
#define USER_STACK_SIZE 0x400
ldr r0,= MEMEND
/*- Set up Supervisor Mode and set Supervisor Mode Stack*/
msr CPSR_c, #ARM_MODE_SVC | I_BIT | F_BIT
mov r13, r0 /* Init stack Undef*/
sub r0, r0, #SVC_STACK_SIZE
/*- Set up Interrupt Mode and set IRQ Mode Stack*/
msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT
mov r13, r0 /* Init stack IRQ*/
sub r0, r0, #IRQ_STACK_SIZE
/*- Set up Fast Interrupt Mode and set FIQ Mode Stack*/
msr CPSR_c, #ARM_MODE_FIQ | I_BIT | F_BIT
mov r13, r0 /* Init stack FIQ*/
sub r0, r0, #FIQ_STACK_SIZE
/*- Set up Abort Mode and set Abort Mode Stack*/
msr CPSR_c, #ARM_MODE_ABORT | I_BIT | F_BIT
mov r13, r0 /* Init stack Abort*/
sub r0, r0, #ABT_STACK_SIZE
/*- Set up Undefined Instruction Mode and set Undef Mode Stack*/
msr CPSR_c, #ARM_MODE_UNDEF | I_BIT | F_BIT
mov r13, r0 /* Init stack Undef*/
sub r0, r0, #UND_STACK_SIZE
/*- Set up user Mode and set System Mode Stack*/
msr CPSR_c, #ARM_MODE_SYS | I_BIT | F_BIT
bic r0, r0, #3 /* Insure word alignement */
mov sp, r0 /* Init stack System */
ldr r0, = AT91F_LowLevelInit
mov lr, pc
bx r0
/*----------------------------------------
Read/modify/write CP15 control register
----------------------------------------*/
mrc p15, 0, r0, c1, c0,0 /* read cp15 control registre (cp15 r1) in r0 */
ldr r3,= 0xC0000080 /* Reset bit :Little Endian end fast bus mode */
ldr r4,= 0xC0001000 /* Set bit :Asynchronous clock mode, Not Fast Bus, I-Cache enable */
bic r0, r0, r3
orr r0, r0, r4
mcr p15, 0, r0, c1, c0,0 /* write r0 in cp15 control registre (cp15 r1) */
/* Enable interrupts */
msr CPSR_c, #ARM_MODE_SYS | F_BIT
/*------------------------------------------------------------------------------
- Branch on C code Main function (with interworking)
----------------------------------------------------
- Branch must be performed by an interworking call as either an ARM or Thumb
- _start function must be supported. This makes the code not position-
- independent. A Branch with link would generate errors
----------------------------------------------------------------------------*/
/*- Branch to _start by interworking*/
ldr r4, = main
mov lr, pc
bx r4
/*-----------------------------------------------------------------------------
- Loop for ever
---------------
- End of application. Normally, never occur.
- Could jump on Software Reset ( B 0x0 ).
------------------------------------------------------------------------------*/
End:
b End

View File

@ -1,208 +0,0 @@
/*----------------------------------------------------------------------------
* ATMEL Microcontroller Software Support - ROUSSET -
*----------------------------------------------------------------------------
* The software is delivered "AS IS" without warranty or condition of any
* kind, either express, implied or statutory. This includes without
* limitation any warranty or condition with respect to merchantability or
* fitness for any particular purpose, or against the infringements of
* intellectual property rights of others.
*----------------------------------------------------------------------------
* File Name : dataflash.c
* Object : High level functions for the dataflash
* Creation : HIi 10/10/2003
*----------------------------------------------------------------------------
*/
#include "config.h"
#include "stdio.h"
#include "dataflash.h"
AT91S_DATAFLASH_INFO dataflash_info[CFG_MAX_DATAFLASH_BANKS];
static AT91S_DataFlash DataFlashInst;
int cs[][CFG_MAX_DATAFLASH_BANKS] = {
{CFG_DATAFLASH_LOGIC_ADDR_CS0, 0}, /* Logical adress, CS */
{CFG_DATAFLASH_LOGIC_ADDR_CS3, 3}
};
int AT91F_DataflashInit(void)
{
int i;
int dfcode;
int Nb_device = 0;
AT91F_SpiInit();
for (i = 0; i < CFG_MAX_DATAFLASH_BANKS; i++) {
dataflash_info[i].id = 0;
dataflash_info[i].Device.pages_number = 0;
dfcode = AT91F_DataflashProbe (cs[i][1], &dataflash_info[i].Desc);
switch (dfcode) {
case AT45DB161:
dataflash_info[i].Device.pages_number = 4096;
dataflash_info[i].Device.pages_size = 528;
dataflash_info[i].Device.page_offset = 10;
dataflash_info[i].Device.byte_mask = 0x300;
dataflash_info[i].Device.cs = cs[i][1];
dataflash_info[i].Desc.DataFlash_state = IDLE;
dataflash_info[i].logical_address = cs[i][0];
dataflash_info[i].id = dfcode;
Nb_device++;
break;
case AT45DB321:
dataflash_info[i].Device.pages_number = 8192;
dataflash_info[i].Device.pages_size = 528;
dataflash_info[i].Device.page_offset = 10;
dataflash_info[i].Device.byte_mask = 0x300;
dataflash_info[i].Device.cs = cs[i][1];
dataflash_info[i].Desc.DataFlash_state = IDLE;
dataflash_info[i].logical_address = cs[i][0];
dataflash_info[i].id = dfcode;
Nb_device++;
break;
case AT45DB642:
dataflash_info[i].Device.pages_number = 8192;
dataflash_info[i].Device.pages_size = 1056;
dataflash_info[i].Device.page_offset = 11;
dataflash_info[i].Device.byte_mask = 0x700;
dataflash_info[i].Device.cs = cs[i][1];
dataflash_info[i].Desc.DataFlash_state = IDLE;
dataflash_info[i].logical_address = cs[i][0];
dataflash_info[i].id = dfcode;
Nb_device++;
break;
case AT45DB128:
dataflash_info[i].Device.pages_number = 16384;
dataflash_info[i].Device.pages_size = 1056;
dataflash_info[i].Device.page_offset = 11;
dataflash_info[i].Device.byte_mask = 0x700;
dataflash_info[i].Device.cs = cs[i][1];
dataflash_info[i].Desc.DataFlash_state = IDLE;
dataflash_info[i].logical_address = cs[i][0];
dataflash_info[i].id = dfcode;
Nb_device++;
break;
default:
break;
}
}
return (Nb_device);
}
void AT91F_DataflashPrintInfo(void)
{
int i;
for (i = 0; i < CFG_MAX_DATAFLASH_BANKS; i++) {
if (dataflash_info[i].id != 0) {
printf ("DF:AT45DB");
switch (dataflash_info[i].id) {
case AT45DB161:
printf ("161");
break;
case AT45DB321:
printf ("321");
break;
case AT45DB642:
printf ("642");
break;
case AT45DB128:
printf ("128");
break;
}
printf ("\n# PG: %6d\n"
"PG SZ: %6d\n"
"SZ=%8d bytes\n"
"ADDR: %08X\n",
(unsigned int) dataflash_info[i].Device.pages_number,
(unsigned int) dataflash_info[i].Device.pages_size,
(unsigned int) dataflash_info[i].Device.pages_number *
dataflash_info[i].Device.pages_size,
(unsigned int) dataflash_info[i].logical_address);
}
}
}
/*------------------------------------------------------------------------------*/
/* Function Name : AT91F_DataflashSelect */
/* Object : Select the correct device */
/*------------------------------------------------------------------------------*/
static AT91PS_DataFlash AT91F_DataflashSelect(AT91PS_DataFlash pFlash,
unsigned int *addr)
{
char addr_valid = 0;
int i;
for (i = 0; i < CFG_MAX_DATAFLASH_BANKS; i++)
if ((*addr & 0xFF000000) == dataflash_info[i].logical_address) {
addr_valid = 1;
break;
}
if (!addr_valid) {
pFlash = (AT91PS_DataFlash) 0;
return pFlash;
}
pFlash->pDataFlashDesc = &(dataflash_info[i].Desc);
pFlash->pDevice = &(dataflash_info[i].Device);
*addr -= dataflash_info[i].logical_address;
return (pFlash);
}
/*------------------------------------------------------------------------------*/
/* Function Name : read_dataflash */
/* Object : dataflash memory read */
/*------------------------------------------------------------------------------*/
int read_dataflash(unsigned long addr, unsigned long size, char *result)
{
unsigned int AddrToRead = addr;
AT91PS_DataFlash pFlash = &DataFlashInst;
pFlash = AT91F_DataflashSelect (pFlash, &AddrToRead);
if (pFlash == 0)
return -1;
return (AT91F_DataFlashRead(pFlash, AddrToRead, size, result));
}
/*-----------------------------------------------------------------------------*/
/* Function Name : write_dataflash */
/* Object : write a block in dataflash */
/*-----------------------------------------------------------------------------*/
int write_dataflash(unsigned long addr_dest, unsigned int addr_src,
unsigned int size)
{
unsigned int AddrToWrite = addr_dest;
AT91PS_DataFlash pFlash = &DataFlashInst;
pFlash = AT91F_DataflashSelect(pFlash, &AddrToWrite);
if (AddrToWrite == -1)
return -1;
return AT91F_DataFlashWrite(pFlash, (unsigned char *) addr_src, AddrToWrite, size);
}
/*-----------------------------------------------------------------------------*/
/* Function Name : erase_dataflash */
/* Object : Erase entire dataflash */
/*-----------------------------------------------------------------------------*/
int erase_dataflash(unsigned long addr_dest)
{
unsigned int AddrToWrite = addr_dest;
AT91PS_DataFlash pFlash = &DataFlashInst;
pFlash = AT91F_DataflashSelect (pFlash, &AddrToWrite);
if (AddrToWrite == -1)
return -1;
return AT91F_DataFlashErase(pFlash);
}

View File

@ -1,181 +0,0 @@
//*---------------------------------------------------------------------------
//* ATMEL Microcontroller Software Support - ROUSSET -
//*---------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*---------------------------------------------------------------------------
//* File Name : AT91_SpiDataFlash.h
//* Object : Data Flash Atmel Description File
//* Translator :
//*
//* 1.0 03/04/01 HI : Creation
//*
//*---------------------------------------------------------------------------
#ifndef _DataFlash_h
#define _DataFlash_h
/* Max value = 15Mhz to be compliant with the Continuous array read function */
#ifdef SPI_LOW_SPEED
#define AT91C_SPI_CLK 14976000/4
#else
#define AT91C_SPI_CLK 14976000
#endif
/* AC characteristics */
/* DLYBS = tCSS= 250ns min and DLYBCT = tCSH = 250ns */
#define DATAFLASH_TCSS (0xf << 16) /* 250ns 15/60000000 */
#define DATAFLASH_TCHS (0x1 << 24) /* 250ns 32*1/60000000 */
#define AT91C_SPI_PCS0_SERIAL_DATAFLASH 0xE /* Chip Select 0 : NPCS0 %1110 */
#define AT91C_SPI_PCS3_DATAFLASH_CARD 0x7 /* Chip Select 3 : NPCS3 %0111 */
#define CFG_MAX_DATAFLASH_BANKS 2
#define CFG_DATAFLASH_LOGIC_ADDR_CS0 0xC0000000
#define CFG_DATAFLASH_LOGIC_ADDR_CS3 0xD0000000
typedef struct {
unsigned long base; /* logical base address for a bank */
unsigned long size; /* total bank size */
unsigned long page_count;
unsigned long page_size;
unsigned long id; /* device id */
} dataflash_info_t;
typedef unsigned int AT91S_DataFlashStatus;
/*----------------------------------------------------------------------*/
/* DataFlash Structures */
/*----------------------------------------------------------------------*/
/*---------------------------------------------*/
/* DataFlash Descriptor Structure Definition */
/*---------------------------------------------*/
typedef struct _AT91S_DataflashDesc {
unsigned char *tx_cmd_pt;
unsigned int tx_cmd_size;
unsigned char *rx_cmd_pt;
unsigned int rx_cmd_size;
unsigned char *tx_data_pt;
unsigned int tx_data_size;
unsigned char *rx_data_pt;
unsigned int rx_data_size;
volatile unsigned char DataFlash_state;
unsigned char command[8];
} AT91S_DataflashDesc, *AT91PS_DataflashDesc;
/*---------------------------------------------*/
/* DataFlash device definition structure */
/*---------------------------------------------*/
typedef struct _AT91S_Dataflash {
int pages_number; /* dataflash page number */
int pages_size; /* dataflash page size */
int page_offset; /* page offset in command */
int byte_mask; /* byte mask in command */
int cs;
} AT91S_DataflashFeatures, *AT91PS_DataflashFeatures;
/*---------------------------------------------*/
/* DataFlash Structure Definition */
/*---------------------------------------------*/
typedef struct _AT91S_DataFlash {
AT91PS_DataflashDesc pDataFlashDesc; /* dataflash descriptor */
AT91PS_DataflashFeatures pDevice; /* Pointer on a dataflash features array */
} AT91S_DataFlash, *AT91PS_DataFlash;
typedef struct _AT91S_DATAFLASH_INFO {
AT91S_DataflashDesc Desc;
AT91S_DataflashFeatures Device; /* Pointer on a dataflash features array */
unsigned long logical_address;
unsigned int id; /* device id */
} AT91S_DATAFLASH_INFO, *AT91PS_DATAFLASH_INFO;
/*-------------------------------------------------------------------------------------------------*/
#define AT45DB161 0x2c
#define AT45DB321 0x34
#define AT45DB642 0x3c
#define AT45DB128 0x10
#define AT91C_DATAFLASH_TIMEOUT 20000 /* For AT91F_DataFlashWaitReady */
/* DataFlash return value */
#define AT91C_DATAFLASH_BUSY 0x00
#define AT91C_DATAFLASH_OK 0x01
#define AT91C_DATAFLASH_ERROR 0x02
#define AT91C_DATAFLASH_MEMORY_OVERFLOW 0x03
#define AT91C_DATAFLASH_BAD_COMMAND 0x04
#define AT91C_DATAFLASH_BAD_ADDRESS 0x05
/* Driver State */
#define IDLE 0x0
#define BUSY 0x1
#define ERROR 0x2
/* DataFlash Driver State */
#define GET_STATUS 0x0F
/*-------------------------------------------------------------------------------------------------*/
/* Command Definition */
/*-------------------------------------------------------------------------------------------------*/
/* READ COMMANDS */
#define DB_CONTINUOUS_ARRAY_READ 0xE8 /* Continuous array read */
#define DB_BURST_ARRAY_READ 0xE8 /* Burst array read */
#define DB_PAGE_READ 0xD2 /* Main memory page read */
#define DB_BUF1_READ 0xD4 /* Buffer 1 read */
#define DB_BUF2_READ 0xD6 /* Buffer 2 read */
#define DB_STATUS 0xD7 /* Status Register */
/* PROGRAM and ERASE COMMANDS */
#define DB_BUF1_WRITE 0x84 /* Buffer 1 write */
#define DB_BUF2_WRITE 0x87 /* Buffer 2 write */
#define DB_BUF1_PAGE_ERASE_PGM 0x83 /* Buffer 1 to main memory page program with built-In erase */
#define DB_BUF1_PAGE_ERASE_FASTPGM 0x93 /* Buffer 1 to main memory page program with built-In erase, Fast program */
#define DB_BUF2_PAGE_ERASE_PGM 0x86 /* Buffer 2 to main memory page program with built-In erase */
#define DB_BUF2_PAGE_ERASE_FASTPGM 0x96 /* Buffer 1 to main memory page program with built-In erase, Fast program */
#define DB_BUF1_PAGE_PGM 0x88 /* Buffer 1 to main memory page program without built-In erase */
#define DB_BUF1_PAGE_FASTPGM 0x98 /* Buffer 1 to main memory page program without built-In erase, Fast program */
#define DB_BUF2_PAGE_PGM 0x89 /* Buffer 2 to main memory page program without built-In erase */
#define DB_BUF2_PAGE_FASTPGM 0x99 /* Buffer 1 to main memory page program without built-In erase, Fast program */
#define DB_PAGE_ERASE 0x81 /* Page Erase */
#define DB_BLOCK_ERASE 0x50 /* Block Erase */
#define DB_PAGE_PGM_BUF1 0x82 /* Main memory page through buffer 1 */
#define DB_PAGE_FASTPGM_BUF1 0x92 /* Main memory page through buffer 1, Fast program */
#define DB_PAGE_PGM_BUF2 0x85 /* Main memory page through buffer 2 */
#define DB_PAGE_FastPGM_BUF2 0x95 /* Main memory page through buffer 2, Fast program */
/* ADDITIONAL COMMANDS */
#define DB_PAGE_2_BUF1_TRF 0x53 /* Main memory page to buffer 1 transfert */
#define DB_PAGE_2_BUF2_TRF 0x55 /* Main memory page to buffer 2 transfert */
#define DB_PAGE_2_BUF1_CMP 0x60 /* Main memory page to buffer 1 compare */
#define DB_PAGE_2_BUF2_CMP 0x61 /* Main memory page to buffer 2 compare */
#define DB_AUTO_PAGE_PGM_BUF1 0x58 /* Auto page rewrite throught buffer 1 */
#define DB_AUTO_PAGE_PGM_BUF2 0x59 /* Auto page rewrite throught buffer 2 */
/*-------------------------------------------------------------------------------------------------*/
extern AT91S_DATAFLASH_INFO dataflash_info[CFG_MAX_DATAFLASH_BANKS];
extern void AT91F_SpiInit(void);
extern int AT91F_DataflashProbe(int i, AT91PS_DataflashDesc pDesc);
extern int AT91F_DataFlashRead(AT91PS_DataFlash, unsigned long , unsigned long, char *);
extern AT91S_DataFlashStatus AT91F_DataFlashWrite(AT91PS_DataFlash ,unsigned char *, int, int);
extern AT91S_DataFlashStatus AT91F_DataFlashErase(AT91PS_DataFlash pDataFlash);
extern int AT91F_DataflashInit(void);
extern void AT91F_DataflashPrintInfo(void);
extern int read_dataflash(unsigned long addr, unsigned long size, char *result);
extern int write_dataflash(unsigned long addr_dest, unsigned int addr_src, unsigned int size);
extern int erase_dataflash(unsigned long addr_dest);
#endif

View File

@ -1,28 +0,0 @@
/*
* (C) Copyright 2002
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* 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
*/
/* Replacement (=dummy) for GNU/Linux division-by zero handler */
void __div0 (void)
{
while(-1);
}

View File

@ -1,19 +0,0 @@
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
SECTIONS
{
. = 0x00000000;
. = ALIGN(4);
.text : { *(.text) }
. = ALIGN(4);
.rodata : { *(.rodata) }
. = ALIGN(4);
.data : { *(.data) }
. = ALIGN(4);
.bss : { *(.bss) }
}

View File

@ -1,500 +0,0 @@
//*----------------------------------------------------------------------------
//* ATMEL Microcontroller Software Support - ROUSSET -
//*----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*----------------------------------------------------------------------------
//* File Name : embedded_sevices.h
//* Object : Header File with all the embedded software services definitions
//*
//* 1.0 24 Jan 2003 FB : Creation
//*----------------------------------------------------------------------------
#ifndef embedded_sevices_h
#define embedded_sevices_h
#include "AT91RM9200.h"
#define AT91C_BASE_ROM (char *)0x00100000
/* Return values */
#define AT91C_BUFFER_SUCCESS 0
#define AT91C_BUFFER_ERROR_SHIFT 16
#define AT91C_BUFFER_ERROR (0x0F << AT91C_BUFFER_ERROR_SHIFT)
#define AT91C_BUFFER_OVERFLOW (0x01 << AT91C_BUFFER_ERROR_SHIFT)
#define AT91C_BUFFER_UNDERRUN (0x02 << AT91C_BUFFER_ERROR_SHIFT)
typedef unsigned int AT91S_BufferStatus;
struct _AT91S_Pipe;
// This structure is a virtual object of a buffer
typedef struct _AT91S_Buffer
{
struct _AT91S_Pipe *pPipe;
void *pChild;
// Functions invoked by the pipe
AT91S_BufferStatus (*SetRdBuffer) (struct _AT91S_Buffer *pSBuffer, char *pBuffer, unsigned int Size);
AT91S_BufferStatus (*SetWrBuffer) (struct _AT91S_Buffer *pSBuffer, char const *pBuffer, unsigned int Size);
AT91S_BufferStatus (*RstRdBuffer) (struct _AT91S_Buffer *pSBuffer);
AT91S_BufferStatus (*RstWrBuffer) (struct _AT91S_Buffer *pSBuffer);
char (*MsgWritten) (struct _AT91S_Buffer *pSBuffer, char const *pBuffer);
char (*MsgRead) (struct _AT91S_Buffer *pSBuffer, char const *pBuffer);
// Functions invoked by the peripheral
AT91S_BufferStatus (*GetWrBuffer) (struct _AT91S_Buffer *pSBuffer, char const **pData, unsigned int *pSize);
AT91S_BufferStatus (*GetRdBuffer) (struct _AT91S_Buffer *pSBuffer, char **pData, unsigned int *pSize);
AT91S_BufferStatus (*EmptyWrBuffer) (struct _AT91S_Buffer *pSBuffer, unsigned int size);
AT91S_BufferStatus (*FillRdBuffer) (struct _AT91S_Buffer *pSBuffer, unsigned int size);
char (*IsWrEmpty) (struct _AT91S_Buffer *pSBuffer);
char (*IsRdFull) (struct _AT91S_Buffer *pSBuffer);
} AT91S_Buffer, *AT91PS_Buffer;
// ===========================================================================================
// SimpleBuffer definition
//
// This structure is pointed by pRealBuffer field in the SBuffer
// It contains usefull information for a real implementation of
// a SBuffer object.
// The application just create an instance of SSBUffer and SBuffer,
// call OpenSimpleBuffer, and continue using SBuffer instance
typedef struct _AT91S_SBuffer
{
AT91S_Buffer parent;
char *pRdBuffer;
char const *pWrBuffer;
unsigned int szRdBuffer;
unsigned int szWrBuffer;
unsigned int stRdBuffer;
unsigned int stWrBuffer;
} AT91S_SBuffer, *AT91PS_SBuffer;
typedef AT91PS_Buffer (*AT91PF_OpenSBuffer) (AT91PS_SBuffer);
// This function is called by the application
extern AT91PS_Buffer AT91F_OpenSBuffer(AT91PS_SBuffer pBuffer);
// Functions invoked by the pipe
extern AT91S_BufferStatus AT91F_SbSetRdBuffer (AT91PS_Buffer pBuffer, char *pData, unsigned int Size);
extern AT91S_BufferStatus AT91F_SbSetWrBuffer (AT91PS_Buffer pBuffer, char const *pData, unsigned int Size);
extern AT91S_BufferStatus AT91F_SbRstRdBuffer (AT91PS_Buffer pBuffer);
extern AT91S_BufferStatus AT91F_SbRstWrBuffer (AT91PS_Buffer pBuffer);
extern char AT91F_SbMsgWritten (AT91PS_Buffer pBuffer, char const *pMsg);
extern char AT91F_SbMsgRead (AT91PS_Buffer pBuffer, char const *pMsg);
// Functions invoked by the peripheral
extern AT91S_BufferStatus AT91F_SbGetWrBuffer (AT91PS_Buffer pBuffer, char const **pData, unsigned int *pSize);
extern AT91S_BufferStatus AT91F_SbGetRdBuffer (AT91PS_Buffer pBuffer, char **pData, unsigned int *pSize);
extern AT91S_BufferStatus AT91F_SbEmptyWrBuffer(AT91PS_Buffer pBuffer, unsigned int size);
extern AT91S_BufferStatus AT91F_SbFillRdBuffer (AT91PS_Buffer pBuffer, unsigned int size);
extern char AT91F_SbIsWrEmpty (AT91PS_Buffer pBuffer);
extern char AT91F_SbIsRdFull (AT91PS_Buffer pBuffer);
#ifdef DBG_DRV_BUFFER
extern char const *AT91F_SbGetError(AT91S_BufferStatus errorNumber);
#endif
#define AT91C_OPEN_CTRLTEMPO_SUCCESS 0
#define AT91C_ERROR_OPEN_CTRLTEMPO 1
#define AT91C_START_OK 2
#define AT91C_STOP_OK 3
#define AT91C_TIMEOUT_REACHED 4
typedef enum _AT91E_SvcTempo {
AT91E_SVCTEMPO_DIS,
AT91E_SVCTEMPO_EN
} AT91E_SvcTempo;
typedef unsigned int AT91S_TempoStatus;
// AT91S_SvcTempo
typedef struct _AT91S_SvcTempo
{
// Methods:
AT91S_TempoStatus (*Start) (
struct _AT91S_SvcTempo *pSvc,
unsigned int timeout,
unsigned int reload,
void (*callback) (AT91S_TempoStatus, void *),
void *pData);
AT91S_TempoStatus (*Stop) (struct _AT91S_SvcTempo *pSvc);
struct _AT91S_SvcTempo *pPreviousTempo;
struct _AT91S_SvcTempo *pNextTempo;
// Data
unsigned int TickTempo; //* timeout value
unsigned int ReloadTempo;//* Reload value for periodic execution
void (*TempoCallback)(AT91S_TempoStatus, void *);
void *pPrivateData;
AT91E_SvcTempo flag;
} AT91S_SvcTempo, *AT91PS_SvcTempo;
// AT91S_CtrlTempo
typedef struct _AT91S_CtlTempo
{
// Members:
// Start and stop for Timer hardware
AT91S_TempoStatus (*CtlTempoStart) (void *pTimer);
AT91S_TempoStatus (*CtlTempoStop) (void *pTimer);
// Start and stop for Tempo service
AT91S_TempoStatus (*SvcTempoStart) (
struct _AT91S_SvcTempo *pSvc,
unsigned int timeout,
unsigned int reload,
void (*callback) (AT91S_TempoStatus, void *),
void *pData);
AT91S_TempoStatus (*SvcTempoStop) (struct _AT91S_SvcTempo *pSvc);
AT91S_TempoStatus (*CtlTempoSetTime)(struct _AT91S_CtlTempo *pCtrl, unsigned int NewTime);
AT91S_TempoStatus (*CtlTempoGetTime)(struct _AT91S_CtlTempo *pCtrl);
AT91S_TempoStatus (*CtlTempoIsStart)(struct _AT91S_CtlTempo *pCtrl);
AT91S_TempoStatus (*CtlTempoCreate) (
struct _AT91S_CtlTempo *pCtrl,
struct _AT91S_SvcTempo *pTempo);
AT91S_TempoStatus (*CtlTempoRemove) (
struct _AT91S_CtlTempo *pCtrl,
struct _AT91S_SvcTempo *pTempo);
AT91S_TempoStatus (*CtlTempoTick) (struct _AT91S_CtlTempo *pCtrl);
// Data:
void *pPrivateData; // Pointer to devived class
void const *pTimer; // hardware
AT91PS_SvcTempo pFirstTempo;
AT91PS_SvcTempo pNewTempo;
} AT91S_CtlTempo, *AT91PS_CtlTempo;
typedef AT91S_TempoStatus (*AT91PF_OpenCtlTempo) ( AT91PS_CtlTempo, void const *);
// This function is called by the application.
extern AT91S_TempoStatus AT91F_OpenCtlTempo( AT91PS_CtlTempo pCtrlTempo, void const *pTempoTimer );
extern AT91S_TempoStatus AT91F_STStart (void *);
extern AT91S_TempoStatus AT91F_STStop (void *);
extern AT91S_TempoStatus AT91F_STSetTime (AT91PS_CtlTempo, unsigned int);
extern AT91S_TempoStatus AT91F_STGetTime (AT91PS_CtlTempo);
extern AT91S_TempoStatus AT91F_STIsStart (AT91PS_CtlTempo);
extern AT91S_TempoStatus AT91F_CtlTempoCreate (AT91PS_CtlTempo, AT91PS_SvcTempo);
extern AT91S_TempoStatus AT91F_CtlTempoRemove (AT91PS_CtlTempo, AT91PS_SvcTempo);
extern AT91S_TempoStatus AT91F_CtlTempoTick (AT91PS_CtlTempo);
extern AT91S_TempoStatus AT91F_SvcTempoStart (
AT91PS_SvcTempo pSvc,
unsigned int timeout,
unsigned int reload,
void (*callback) (AT91S_TempoStatus, void *),
void *pData);
extern AT91S_TempoStatus AT91F_SvcTempoStop (AT91PS_SvcTempo);
// Following types are defined in another header files
struct _AT91S_Buffer;
// Constants:
#define AT91C_COMMSVC_SUCCESS 0
#define AT91C_COMMSVC_ERROR_SHIFT 8
#define AT91C_COMMSVC_ERROR (0x0f << AT91C_COMMSVC_ERROR_SHIFT)
typedef unsigned int AT91S_SvcCommStatus;
// AT91S_Service definition
// This structure is an abstraction of a communication peripheral
typedef struct _AT91S_Service
{
// Methods:
AT91S_SvcCommStatus (*Reset) (struct _AT91S_Service *pService);
AT91S_SvcCommStatus (*StartTx)(struct _AT91S_Service *pService);
AT91S_SvcCommStatus (*StartRx)(struct _AT91S_Service *pService);
AT91S_SvcCommStatus (*StopTx) (struct _AT91S_Service *pService);
AT91S_SvcCommStatus (*StopRx) (struct _AT91S_Service *pService);
char (*TxReady)(struct _AT91S_Service *pService);
char (*RxReady)(struct _AT91S_Service *pService);
// Data:
struct _AT91S_Buffer *pBuffer; // Link to a buffer object
void *pChild;
} AT91S_SvcComm, *AT91PS_SvcComm;
// Constants:
#define AT91C_XMODEM_SOH 0x01 /* Start of Heading for 128 bytes */
#define AT91C_XMODEM_STX 0x02 /* Start of heading for 1024 bytes */
#define AT91C_XMODEM_EOT 0x04 /* End of transmission */
#define AT91C_XMODEM_ACK 0x06 /* Acknowledge */
#define AT91C_XMODEM_NAK 0x15 /* Negative Acknowledge */
#define AT91C_XMODEM_CRCCHR 'C'
#define AT91C_XMODEM_PACKET_SIZE 2 // packet + packetCRC
#define AT91C_XMODEM_CRC_SIZE 2 // crcLSB + crcMSB
#define AT91C_XMODEM_DATA_SIZE_SOH 128 // data 128 corresponding to SOH header
#define AT91C_XMODEM_DATA_SIZE_STX 1024 // data 1024 corresponding to STX header
//* Following structure is used by SPipe to refer to the USB device peripheral endpoint
typedef struct _AT91PS_SvcXmodem {
// Public Methods:
AT91S_SvcCommStatus (*Handler) (struct _AT91PS_SvcXmodem *, unsigned int);
AT91S_SvcCommStatus (*StartTx) (struct _AT91PS_SvcXmodem *, unsigned int);
AT91S_SvcCommStatus (*StopTx) (struct _AT91PS_SvcXmodem *, unsigned int);
// Private Methods:
AT91S_SvcCommStatus (*ReadHandler) (struct _AT91PS_SvcXmodem *, unsigned int csr);
AT91S_SvcCommStatus (*WriteHandler) (struct _AT91PS_SvcXmodem *, unsigned int csr);
unsigned short (*GetCrc) (char *ptr, unsigned int count);
char (*CheckHeader) (unsigned char currentPacket, char *packet);
char (*CheckData) (struct _AT91PS_SvcXmodem *);
AT91S_SvcComm parent; // Base class
AT91PS_USART pUsart;
AT91S_SvcTempo tempo; // Link to a AT91S_Tempo object
char *pData;
unsigned int dataSize; // = XMODEM_DATA_STX or XMODEM_DATA_SOH
char packetDesc[AT91C_XMODEM_PACKET_SIZE];
unsigned char packetId; // Current packet
char packetStatus;
char isPacketDesc;
char eot; // end of transmition
} AT91S_SvcXmodem, *AT91PS_SvcXmodem;
typedef AT91PS_SvcComm (*AT91PF_OpenSvcXmodem) ( AT91PS_SvcXmodem, AT91PS_USART, AT91PS_CtlTempo);
// This function is called by the application.
extern AT91PS_SvcComm AT91F_OpenSvcXmodem( AT91PS_SvcXmodem, AT91PS_USART, AT91PS_CtlTempo);
extern unsigned short AT91F_SvcXmodemGetCrc (char *ptr, unsigned int count);
extern char AT91F_SvcXmodemCheckHeader(unsigned char currentPacket, char *packet);
extern char AT91F_SvcXmodemCheckData (AT91PS_SvcXmodem pSvcXmodem);
extern AT91S_SvcCommStatus AT91F_SvcXmodemReadHandler(AT91PS_SvcXmodem pSvcXmodem, unsigned int csr);
extern AT91S_SvcCommStatus AT91F_SvcXmodemWriteHandler(AT91PS_SvcXmodem pSvcXmodem, unsigned int csr);
extern AT91S_SvcCommStatus AT91F_SvcXmodemStartTx(AT91PS_SvcComm pSvcComm);
extern AT91S_SvcCommStatus AT91F_SvcXmodemStopTx(AT91PS_SvcComm pSvcComm);
extern AT91S_SvcCommStatus AT91F_SvcXmodemStartRx(AT91PS_SvcComm pSvcComm);
extern AT91S_SvcCommStatus AT91F_SvcXmodemStopRx(AT91PS_SvcComm pSvcComm);
extern char AT91F_SvcXmodemTxReady(AT91PS_SvcComm pService);
extern char AT91F_SvcXmodemRxReady(AT91PS_SvcComm pSvcComm);
// Constants:
#define AT91C_PIPE_SUCCESS 0
#define AT91C_PIPE_ERROR_SHIFT 8
#define AT91C_PIPE_ERROR (0x0F << AT91C_PIPE_ERROR_SHIFT)
#define AT91C_PIPE_OPEN_FAILED (1 << AT91C_PIPE_ERROR_SHIFT)
#define AT91C_PIPE_WRITE_FAILED (2 << AT91C_PIPE_ERROR_SHIFT)
#define AT91C_PIPE_WRITE_ABORTED (3 << AT91C_PIPE_ERROR_SHIFT)
#define AT91C_PIPE_READ_FAILED (4 << AT91C_PIPE_ERROR_SHIFT)
#define AT91C_PIPE_READ_ABORTED (5 << AT91C_PIPE_ERROR_SHIFT)
#define AT91C_PIPE_ABORT_FAILED (6 << AT91C_PIPE_ERROR_SHIFT)
#define AT91C_PIPE_RESET_FAILED (7 << AT91C_PIPE_ERROR_SHIFT)
/* _AT91S_Pipe stucture */
typedef unsigned int AT91S_PipeStatus;
typedef struct _AT91S_Pipe
{
// A pipe is linked with a peripheral and a buffer
AT91PS_SvcComm pSvcComm;
AT91PS_Buffer pBuffer;
// Callback functions with their arguments
void (*WriteCallback) (AT91S_PipeStatus, void *);
void (*ReadCallback) (AT91S_PipeStatus, void *);
void *pPrivateReadData;
void *pPrivateWriteData;
// Pipe methods
AT91S_PipeStatus (*Write) (
struct _AT91S_Pipe *pPipe,
char const * pData,
unsigned int size,
void (*callback) (AT91S_PipeStatus, void *),
void *privateData);
AT91S_PipeStatus (*Read) (
struct _AT91S_Pipe *pPipe,
char *pData,
unsigned int size,
void (*callback) (AT91S_PipeStatus, void *),
void *privateData);
AT91S_PipeStatus (*AbortWrite) (
struct _AT91S_Pipe *pPipe);
AT91S_PipeStatus (*AbortRead) (
struct _AT91S_Pipe *pPipe);
AT91S_PipeStatus (*Reset) (
struct _AT91S_Pipe *pPipe);
char (*IsWritten) (
struct _AT91S_Pipe *pPipe,
char const *pVoid);
char (*IsReceived) (
struct _AT91S_Pipe *pPipe,
char const *pVoid);
} AT91S_Pipe, *AT91PS_Pipe;
// types used in AT91S_Pipe
typedef AT91PS_Pipe (*AT91PF_OpenPipe) (AT91PS_Pipe, AT91PS_SvcComm, AT91PS_Buffer);
typedef void (*AT91PF_PipeWriteCallBack) (AT91S_PipeStatus, void *);
typedef void (*AT91PF_PipeReadCallBack) (AT91S_PipeStatus, void *);
typedef AT91S_PipeStatus (*AT91PF_PipeWrite) (AT91PS_Pipe, char const *, unsigned int, void (*) (AT91S_PipeStatus, void *), void *);
typedef AT91S_PipeStatus (*AT91PF_PipeRead) (AT91PS_Pipe, char const *, unsigned int, void (*) (AT91S_PipeStatus, void *), void *);
typedef AT91S_PipeStatus (*AT91PF_PipeAbortWrite) (AT91PS_Pipe);
typedef AT91S_PipeStatus (*AT91PF_PipeAbortRead) (AT91PS_Pipe);
typedef AT91S_PipeStatus (*AT91PF_PipeReset) (AT91PS_Pipe);
typedef char (*AT91PF_PipeIsWritten) (AT91PS_Pipe, char const *);
typedef char (*AT91PF_PipeIsReceived) (AT91PS_Pipe, char const *);
// This function is called by the application
extern AT91PS_Pipe AT91F_OpenPipe(
AT91PS_Pipe pPipe,
AT91PS_SvcComm pSvcComm,
AT91PS_Buffer pBuffer);
// Following functions are called through AT91S_Pipe pointers
extern AT91S_PipeStatus AT91F_PipeWrite(
AT91PS_Pipe pPipe,
char const *pVoid,
unsigned int size,
AT91PF_PipeWriteCallBack callback,
void *privateData);
extern AT91S_PipeStatus AT91F_PipeRead(
AT91PS_Pipe pPipe,
char *pVoid,
unsigned int Size,
AT91PF_PipeReadCallBack callback,
void *privateData);
extern AT91S_PipeStatus AT91F_PipeAbortWrite(AT91PS_Pipe pPipe);
extern AT91S_PipeStatus AT91F_PipeAbortRead(AT91PS_Pipe pPipe);
extern AT91S_PipeStatus AT91F_PipeReset(AT91PS_Pipe pPipe);
extern char AT91F_PipeMsgWritten(AT91PS_Pipe pPipe, char const *pVoid);
extern char AT91F_PipeMsgReceived(AT91PS_Pipe pPipe, char const *pVoid);
#ifdef DBG_DRV_PIPE
// This function parse the error number and return a string
// describing the error message
extern char const *AT91F_PipeGetError(AT91S_PipeStatus msgId);
#endif
extern const unsigned char bit_rev[256];
extern void CalculateCrc32(const unsigned char *,unsigned int, unsigned int *);
extern void CalculateCrc16(const unsigned char *, unsigned int , unsigned short *);
extern void CalculateCrcHdlc(const unsigned char *, unsigned int, unsigned short *);
extern void CalculateCrc16ccitt(const unsigned char *, unsigned int , unsigned short *);
typedef const unsigned char* AT91PS_SVC_CRC_BIT_REV ;
typedef void (*AT91PF_SVC_CRC32) (const unsigned char *, unsigned int, unsigned int *);
typedef void (*AT91PF_SVC_CRC16) (const unsigned char *, unsigned int, unsigned short *);
typedef void (*AT91PF_SVC_CRCHDLC) (const unsigned char *, unsigned int, unsigned short *);
typedef void (*AT91PF_SVC_CRCCCITT)(const unsigned char *, unsigned int , unsigned short *);
typedef short (*AT91PF_Sinus) (int angle);
typedef const short * AT91PS_SINE_TAB;
extern short AT91F_Sinus(int angle);
extern const short AT91C_SINUS180_TAB[256];
typedef void (TypeAICHandler) (void) ;
// ROM BOOT Structure Element Definition (liv v2)
typedef struct _AT91S_MEMCDesc
{
AT91PS_MC memc_base ; /* Peripheral base */
unsigned char periph_id ; /* MC Peripheral Identifier */
} AT91S_MEMCDesc, *AT91PS_MEMCDesc ;
typedef struct _AT91S_Pio2Desc
{
AT91PS_PIO pio_base ; /* Base Address */
unsigned char periph_id ; /* Peripheral Identifier */
unsigned char pio_number ; /* Total Pin Number */
} AT91S_Pio2Desc, *AT91PS_Pio2Desc ;
typedef struct _AT91S_SPIDesc
{
AT91PS_SPI spi_base ;
const AT91PS_PIO pio_base ;
unsigned char periph_id ;
unsigned char pin_spck ;
unsigned char pin_miso ;
unsigned char pin_mosi ;
unsigned char pin_npcs[4] ;
} AT91S_SPIDesc, *AT91PS_SPIDesc ;
typedef struct _AT91S_USART2Desc
{
AT91PS_USART usart_base ; /* Peripheral base */
const AT91PS_PIO pio_base ; /* IO controller descriptor */
unsigned int pin_rxd ; /* RXD pin number in the PIO */
unsigned int pin_txd ; /* TXD pin number in the PIO */
unsigned int pin_sck ; /* SCK pin number in the PIO */
unsigned int pin_rts ; /* RTS pin number in the PIO */
unsigned int pin_cts ; /* CTS pin number in the PIO */
unsigned int pin_dtr ; /* DTR pin number in the PIO */
unsigned int pin_ri ; /* RI pin number in the PIO */
unsigned int pin_dsr ; /* DSR pin number in the PIO */
unsigned int pin_dcd ; /* DCD pin number in the PIO */
unsigned int periph_id ; /* USART Peripheral Identifier */
} AT91S_USART2Desc, *AT91PS_USART2Desc ;
typedef struct _AT91S_TWIDesc
{
AT91PS_TWI TWI_base ;
const AT91PS_PIO pio_base ;
unsigned int pin_sck ;
unsigned int pin_sda ;
unsigned int periph_id;
}AT91S_TWIDesc, *AT91PS_TWIDesc;
typedef struct _AT91S_STDesc
{
AT91PS_ST st_base ; /* Peripheral base address */
TypeAICHandler *AsmSTHandler ; /* Assembly interrupt handler */
unsigned char PeriphId ; /* Peripheral Identifier */
} AT91S_STDesc, *AT91PS_STDesc;
typedef struct _AT91S_RomBoot {
const unsigned int version;
// Peripheral descriptors
const AT91S_MEMCDesc MEMC_DESC;
const AT91S_STDesc SYSTIMER_DESC;
const AT91S_Pio2Desc PIOA_DESC;
const AT91S_Pio2Desc PIOB_DESC;
const AT91S_USART2Desc DBGU_DESC;
const AT91S_USART2Desc USART0_DESC;
const AT91S_USART2Desc USART1_DESC;
const AT91S_USART2Desc USART2_DESC;
const AT91S_USART2Desc USART3_DESC;
const AT91S_TWIDesc TWI_DESC;
const AT91S_SPIDesc SPI_DESC;
// Objects entry
const AT91PF_OpenPipe OpenPipe;
const AT91PF_OpenSBuffer OpenSBuffer;
const unsigned int reserved1;
const AT91PF_OpenSvcXmodem OpenSvcXmodem;
const AT91PF_OpenCtlTempo OpenCtlTempo;
const unsigned int reserved2;
const unsigned int reserved3;
const unsigned int reserved4;
const AT91PF_SVC_CRC16 CRC16;
const AT91PF_SVC_CRCCCITT CRCCCITT;
const AT91PF_SVC_CRCHDLC CRCHDLC;
const AT91PF_SVC_CRC32 CRC32;
const AT91PS_SVC_CRC_BIT_REV Bit_Reverse_Array;
const AT91PS_SINE_TAB SineTab;
const AT91PF_Sinus Sine;
} AT91S_RomBoot, *AT91PS_RomBoot;
#define AT91C_ROM_BOOT_ADDRESS ((const AT91S_RomBoot *) ( *((unsigned int *) (AT91C_BASE_ROM + 0x20))) )
#endif

View File

@ -1,379 +0,0 @@
//*---------------------------------------------------------------------------
//* ATMEL Microcontroller Software Support - ROUSSET -
//*---------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*---------------------------------------------------------------------------
//* File Name : AT91C_MCI_Device.h
//* Object : Data Flash Atmel Description File
//* Translator :
//*
//* 1.0 26/11/02 FB : Creation
//*---------------------------------------------------------------------------
#ifndef AT91C_MCI_Device_h
#define AT91C_MCI_Device_h
#include "AT91RM9200.h"
#include "lib_AT91RM9200.h"
typedef unsigned int AT91S_MCIDeviceStatus;
/////////////////////////////////////////////////////////////////////////////////////////////////////
#define AT91C_CARD_REMOVED 0
#define AT91C_MMC_CARD_INSERTED 1
#define AT91C_SD_CARD_INSERTED 2
#define AT91C_NO_ARGUMENT 0x0
#define AT91C_FIRST_RCA 0xCAFE
#define AT91C_MAX_MCI_CARDS 10
#define AT91C_BUS_WIDTH_1BIT 0x00
#define AT91C_BUS_WIDTH_4BITS 0x02
/* Driver State */
#define AT91C_MCI_IDLE 0x0
#define AT91C_MCI_TIMEOUT_ERROR 0x1
#define AT91C_MCI_RX_SINGLE_BLOCK 0x2
#define AT91C_MCI_RX_MULTIPLE_BLOCK 0x3
#define AT91C_MCI_RX_STREAM 0x4
#define AT91C_MCI_TX_SINGLE_BLOCK 0x5
#define AT91C_MCI_TX_MULTIPLE_BLOCK 0x6
#define AT91C_MCI_TX_STREAM 0x7
/* TimeOut */
#define AT91C_TIMEOUT_CMDRDY 30
/////////////////////////////////////////////////////////////////////////////////////////////////////
// MMC & SDCard Structures
/////////////////////////////////////////////////////////////////////////////////////////////////////
/*-----------------------------------------------*/
/* SDCard Device Descriptor Structure Definition */
/*-----------------------------------------------*/
typedef struct _AT91S_MciDeviceDesc
{
volatile unsigned char state;
unsigned char SDCard_bus_width;
} AT91S_MciDeviceDesc, *AT91PS_MciDeviceDesc;
/*---------------------------------------------*/
/* MMC & SDCard Structure Device Features */
/*---------------------------------------------*/
typedef struct _AT91S_MciDeviceFeatures
{
unsigned char Card_Inserted; // (0=AT91C_CARD_REMOVED) (1=AT91C_MMC_CARD_INSERTED) (2=AT91C_SD_CARD_INSERTED)
unsigned int Relative_Card_Address; // RCA
unsigned int Max_Read_DataBlock_Length; // 2^(READ_BL_LEN) in CSD
unsigned int Max_Write_DataBlock_Length; // 2^(WRITE_BL_LEN) in CSD
unsigned char Read_Partial; // READ_BL_PARTIAL
unsigned char Write_Partial; // WRITE_BL_PARTIAL
unsigned char Erase_Block_Enable; // ERASE_BLK_EN
unsigned char Read_Block_Misalignment; // READ_BLK_MISALIGN
unsigned char Write_Block_Misalignment; // WRITE_BLK_MISALIGN
unsigned char Sector_Size; // SECTOR_SIZE
unsigned int Memory_Capacity; // Size in bits of the device
} AT91S_MciDeviceFeatures, *AT91PS_MciDeviceFeatures ;
/*---------------------------------------------*/
/* MCI Device Structure Definition */
/*---------------------------------------------*/
typedef struct _AT91S_MciDevice
{
AT91PS_MciDeviceDesc pMCI_DeviceDesc; // MCI device descriptor
AT91PS_MciDeviceFeatures pMCI_DeviceFeatures;// Pointer on a MCI device features array
}AT91S_MciDevice, *AT91PS_MciDevice;
/////////////////////////////////////////////////////////////////////////////////////////////////////
// MCI_CMD Register Value
/////////////////////////////////////////////////////////////////////////////////////////////////////
#define AT91C_POWER_ON_INIT (0 | AT91C_MCI_TRCMD_NO | AT91C_MCI_SPCMD_INIT | AT91C_MCI_OPDCMD)
/////////////////////////////////////////////////////////////////
// Class 0 & 1 commands: Basic commands and Read Stream commands
/////////////////////////////////////////////////////////////////
#define AT91C_GO_IDLE_STATE_CMD (0 | AT91C_MCI_TRCMD_NO | AT91C_MCI_SPCMD_NONE )
#define AT91C_MMC_GO_IDLE_STATE_CMD (0 | AT91C_MCI_TRCMD_NO | AT91C_MCI_SPCMD_NONE | AT91C_MCI_OPDCMD)
#define AT91C_MMC_SEND_OP_COND_CMD (1 | AT91C_MCI_TRCMD_NO | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_OPDCMD)
#define AT91C_ALL_SEND_CID_CMD (2 | AT91C_MCI_TRCMD_NO | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_136 )
#define AT91C_MMC_ALL_SEND_CID_CMD (2 | AT91C_MCI_TRCMD_NO | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_136 | AT91C_MCI_OPDCMD)
#define AT91C_SET_RELATIVE_ADDR_CMD (3 | AT91C_MCI_TRCMD_NO | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_MAXLAT )
#define AT91C_MMC_SET_RELATIVE_ADDR_CMD (3 | AT91C_MCI_TRCMD_NO | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_MAXLAT | AT91C_MCI_OPDCMD)
#define AT91C_SET_DSR_CMD (4 | AT91C_MCI_TRCMD_NO | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_NO | AT91C_MCI_MAXLAT ) // no tested
#define AT91C_SEL_DESEL_CARD_CMD (7 | AT91C_MCI_TRCMD_NO | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_MAXLAT )
#define AT91C_SEND_CSD_CMD (9 | AT91C_MCI_TRCMD_NO | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_136 | AT91C_MCI_MAXLAT )
#define AT91C_SEND_CID_CMD (10 | AT91C_MCI_TRCMD_NO | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_136 | AT91C_MCI_MAXLAT )
#define AT91C_MMC_READ_DAT_UNTIL_STOP_CMD (11 | AT91C_MCI_TRTYP_STREAM| AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRDIR | AT91C_MCI_TRCMD_START | AT91C_MCI_MAXLAT )
#define AT91C_STOP_TRANSMISSION_CMD (12 | AT91C_MCI_TRCMD_STOP | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_MAXLAT )
#define AT91C_STOP_TRANSMISSION_SYNC_CMD (12 | AT91C_MCI_TRCMD_STOP | AT91C_MCI_SPCMD_SYNC | AT91C_MCI_RSPTYP_48 | AT91C_MCI_MAXLAT )
#define AT91C_SEND_STATUS_CMD (13 | AT91C_MCI_TRCMD_NO | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_MAXLAT )
#define AT91C_GO_INACTIVE_STATE_CMD (15 | AT91C_MCI_RSPTYP_NO )
//*------------------------------------------------
//* Class 2 commands: Block oriented Read commands
//*------------------------------------------------
#define AT91C_SET_BLOCKLEN_CMD (16 | AT91C_MCI_TRCMD_NO | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_MAXLAT )
#define AT91C_READ_SINGLE_BLOCK_CMD (17 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_START | AT91C_MCI_TRTYP_BLOCK | AT91C_MCI_TRDIR | AT91C_MCI_MAXLAT)
#define AT91C_READ_MULTIPLE_BLOCK_CMD (18 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_START | AT91C_MCI_TRTYP_MULTIPLE | AT91C_MCI_TRDIR | AT91C_MCI_MAXLAT)
//*--------------------------------------------
//* Class 3 commands: Sequential write commands
//*--------------------------------------------
#define AT91C_MMC_WRITE_DAT_UNTIL_STOP_CMD (20 | AT91C_MCI_TRTYP_STREAM| AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 & ~(AT91C_MCI_TRDIR) | AT91C_MCI_TRCMD_START | AT91C_MCI_MAXLAT ) // MMC
//*------------------------------------------------
//* Class 4 commands: Block oriented write commands
//*------------------------------------------------
#define AT91C_WRITE_BLOCK_CMD (24 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_START | (AT91C_MCI_TRTYP_BLOCK & ~(AT91C_MCI_TRDIR)) | AT91C_MCI_MAXLAT)
#define AT91C_WRITE_MULTIPLE_BLOCK_CMD (25 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_START | (AT91C_MCI_TRTYP_MULTIPLE & ~(AT91C_MCI_TRDIR)) | AT91C_MCI_MAXLAT)
#define AT91C_PROGRAM_CSD_CMD (27 | AT91C_MCI_RSPTYP_48 )
//*----------------------------------------
//* Class 6 commands: Group Write protect
//*----------------------------------------
#define AT91C_SET_WRITE_PROT_CMD (28 | AT91C_MCI_RSPTYP_48 )
#define AT91C_CLR_WRITE_PROT_CMD (29 | AT91C_MCI_RSPTYP_48 )
#define AT91C_SEND_WRITE_PROT_CMD (30 | AT91C_MCI_RSPTYP_48 )
//*----------------------------------------
//* Class 5 commands: Erase commands
//*----------------------------------------
#define AT91C_TAG_SECTOR_START_CMD (32 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_NO | AT91C_MCI_MAXLAT)
#define AT91C_TAG_SECTOR_END_CMD (33 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_NO | AT91C_MCI_MAXLAT)
#define AT91C_MMC_UNTAG_SECTOR_CMD (34 | AT91C_MCI_RSPTYP_48 )
#define AT91C_MMC_TAG_ERASE_GROUP_START_CMD (35 | AT91C_MCI_RSPTYP_48 )
#define AT91C_MMC_TAG_ERASE_GROUP_END_CMD (36 | AT91C_MCI_RSPTYP_48 )
#define AT91C_MMC_UNTAG_ERASE_GROUP_CMD (37 | AT91C_MCI_RSPTYP_48 )
#define AT91C_ERASE_CMD (38 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_NO | AT91C_MCI_MAXLAT )
//*----------------------------------------
//* Class 7 commands: Lock commands
//*----------------------------------------
#define AT91C_LOCK_UNLOCK (42 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_NO | AT91C_MCI_MAXLAT) // no tested
//*-----------------------------------------------
// Class 8 commands: Application specific commands
//*-----------------------------------------------
#define AT91C_APP_CMD (55 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_NO | AT91C_MCI_MAXLAT)
#define AT91C_GEN_CMD (56 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_NO | AT91C_MCI_MAXLAT) // no tested
#define AT91C_SDCARD_SET_BUS_WIDTH_CMD (6 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_NO | AT91C_MCI_MAXLAT)
#define AT91C_SDCARD_STATUS_CMD (13 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_NO | AT91C_MCI_MAXLAT)
#define AT91C_SDCARD_SEND_NUM_WR_BLOCKS_CMD (22 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_NO | AT91C_MCI_MAXLAT)
#define AT91C_SDCARD_SET_WR_BLK_ERASE_COUNT_CMD (23 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_NO | AT91C_MCI_MAXLAT)
#define AT91C_SDCARD_APP_OP_COND_CMD (41 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_NO )
#define AT91C_SDCARD_SET_CLR_CARD_DETECT_CMD (42 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_NO | AT91C_MCI_MAXLAT)
#define AT91C_SDCARD_SEND_SCR_CMD (51 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_NO | AT91C_MCI_MAXLAT)
#define AT91C_SDCARD_APP_ALL_CMD (AT91C_SDCARD_SET_BUS_WIDTH_CMD +\
AT91C_SDCARD_STATUS_CMD +\
AT91C_SDCARD_SEND_NUM_WR_BLOCKS_CMD +\
AT91C_SDCARD_SET_WR_BLK_ERASE_COUNT_CMD +\
AT91C_SDCARD_APP_OP_COND_CMD +\
AT91C_SDCARD_SET_CLR_CARD_DETECT_CMD +\
AT91C_SDCARD_SEND_SCR_CMD)
//*----------------------------------------
//* Class 9 commands: IO Mode commands
//*----------------------------------------
#define AT91C_MMC_FAST_IO_CMD (39 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_MAXLAT)
#define AT91C_MMC_GO_IRQ_STATE_CMD (40 | AT91C_MCI_SPCMD_NONE | AT91C_MCI_RSPTYP_48 | AT91C_MCI_TRCMD_NO | AT91C_MCI_MAXLAT)
/////////////////////////////////////////////////////////////////////////////////////////////////////
// Functions returnals
/////////////////////////////////////////////////////////////////////////////////////////////////////
#define AT91C_CMD_SEND_OK 0 // Command ok
#define AT91C_CMD_SEND_ERROR -1 // Command failed
#define AT91C_INIT_OK 2 // Init Successfull
#define AT91C_INIT_ERROR 3 // Init Failed
#define AT91C_READ_OK 4 // Read Successfull
#define AT91C_READ_ERROR 5 // Read Failed
#define AT91C_WRITE_OK 6 // Write Successfull
#define AT91C_WRITE_ERROR 7 // Write Failed
#define AT91C_ERASE_OK 8 // Erase Successfull
#define AT91C_ERASE_ERROR 9 // Erase Failed
#define AT91C_CARD_SELECTED_OK 10 // Card Selection Successfull
#define AT91C_CARD_SELECTED_ERROR 11 // Card Selection Failed
/////////////////////////////////////////////////////////////////////////////////////////////////////
// MCI_SR Errors
/////////////////////////////////////////////////////////////////////////////////////////////////////
#define AT91C_MCI_SR_ERROR (AT91C_MCI_UNRE |\
AT91C_MCI_OVRE |\
AT91C_MCI_DTOE |\
AT91C_MCI_DCRCE |\
AT91C_MCI_RTOE |\
AT91C_MCI_RENDE |\
AT91C_MCI_RCRCE |\
AT91C_MCI_RDIRE |\
AT91C_MCI_RINDE)
////////////////////////////////////////////////////////////////////////////////////////////////////
// OCR Register
////////////////////////////////////////////////////////////////////////////////////////////////////
#define AT91C_VDD_16_17 (1 << 4)
#define AT91C_VDD_17_18 (1 << 5)
#define AT91C_VDD_18_19 (1 << 6)
#define AT91C_VDD_19_20 (1 << 7)
#define AT91C_VDD_20_21 (1 << 8)
#define AT91C_VDD_21_22 (1 << 9)
#define AT91C_VDD_22_23 (1 << 10)
#define AT91C_VDD_23_24 (1 << 11)
#define AT91C_VDD_24_25 (1 << 12)
#define AT91C_VDD_25_26 (1 << 13)
#define AT91C_VDD_26_27 (1 << 14)
#define AT91C_VDD_27_28 (1 << 15)
#define AT91C_VDD_28_29 (1 << 16)
#define AT91C_VDD_29_30 (1 << 17)
#define AT91C_VDD_30_31 (1 << 18)
#define AT91C_VDD_31_32 (1 << 19)
#define AT91C_VDD_32_33 (1 << 20)
#define AT91C_VDD_33_34 (1 << 21)
#define AT91C_VDD_34_35 (1 << 22)
#define AT91C_VDD_35_36 (1 << 23)
#define AT91C_CARD_POWER_UP_BUSY (1 << 31)
#define AT91C_MMC_HOST_VOLTAGE_RANGE (AT91C_VDD_27_28 +\
AT91C_VDD_28_29 +\
AT91C_VDD_29_30 +\
AT91C_VDD_30_31 +\
AT91C_VDD_31_32 +\
AT91C_VDD_32_33)
////////////////////////////////////////////////////////////////////////////////////////////////////
// CURRENT_STATE & READY_FOR_DATA in SDCard Status Register definition (response type R1)
////////////////////////////////////////////////////////////////////////////////////////////////////
#define AT91C_SR_READY_FOR_DATA (1 << 8) // corresponds to buffer empty signalling on the bus
#define AT91C_SR_IDLE (0 << 9)
#define AT91C_SR_READY (1 << 9)
#define AT91C_SR_IDENT (2 << 9)
#define AT91C_SR_STBY (3 << 9)
#define AT91C_SR_TRAN (4 << 9)
#define AT91C_SR_DATA (5 << 9)
#define AT91C_SR_RCV (6 << 9)
#define AT91C_SR_PRG (7 << 9)
#define AT91C_SR_DIS (8 << 9)
#define AT91C_SR_CARD_SELECTED (AT91C_SR_READY_FOR_DATA + AT91C_SR_TRAN)
/////////////////////////////////////////////////////////////////////////////////////////////////////
// MMC CSD register header File
// AT91C_CSD_xxx_S for shift value
// AT91C_CSD_xxx_M for mask value
/////////////////////////////////////////////////////////////////////////////////////////////////////
// First Response INT <=> CSD[3] : bits 0 to 31
#define AT91C_CSD_BIT0_S 0 // [0:0]
#define AT91C_CSD_BIT0_M 0x01
#define AT91C_CSD_CRC_S 1 // [7:1]
#define AT91C_CSD_CRC_M 0x7F
#define AT91C_CSD_MMC_ECC_S 8 // [9:8] reserved for MMC compatibility
#define AT91C_CSD_MMC_ECC_M 0x03
#define AT91C_CSD_FILE_FMT_S 10 // [11:10]
#define AT91C_CSD_FILE_FMT_M 0x03
#define AT91C_CSD_TMP_WP_S 12 // [12:12]
#define AT91C_CSD_TMP_WP_M 0x01
#define AT91C_CSD_PERM_WP_S 13 // [13:13]
#define AT91C_CSD_PERM_WP_M 0x01
#define AT91C_CSD_COPY_S 14 // [14:14]
#define AT91C_CSD_COPY_M 0x01
#define AT91C_CSD_FILE_FMT_GRP_S 15 // [15:15]
#define AT91C_CSD_FILE_FMT_GRP_M 0x01
// reserved 16 // [20:16]
// reserved 0x1F
#define AT91C_CSD_WBLOCK_P_S 21 // [21:21]
#define AT91C_CSD_WBLOCK_P_M 0x01
#define AT91C_CSD_WBLEN_S 22 // [25:22]
#define AT91C_CSD_WBLEN_M 0x0F
#define AT91C_CSD_R2W_F_S 26 // [28:26]
#define AT91C_CSD_R2W_F_M 0x07
#define AT91C_CSD_MMC_DEF_ECC_S 29 // [30:29] reserved for MMC compatibility
#define AT91C_CSD_MMC_DEF_ECC_M 0x03
#define AT91C_CSD_WP_GRP_EN_S 31 // [31:31]
#define AT91C_CSD_WP_GRP_EN_M 0x01
// Seconde Response INT <=> CSD[2] : bits 32 to 63
#define AT91C_CSD_v21_WP_GRP_SIZE_S 0 // [38:32]
#define AT91C_CSD_v21_WP_GRP_SIZE_M 0x7F
#define AT91C_CSD_v21_SECT_SIZE_S 7 // [45:39]
#define AT91C_CSD_v21_SECT_SIZE_M 0x7F
#define AT91C_CSD_v21_ER_BLEN_EN_S 14 // [46:46]
#define AT91C_CSD_v21_ER_BLEN_EN_M 0x01
#define AT91C_CSD_v22_WP_GRP_SIZE_S 0 // [36:32]
#define AT91C_CSD_v22_WP_GRP_SIZE_M 0x1F
#define AT91C_CSD_v22_ER_GRP_SIZE_S 5 // [41:37]
#define AT91C_CSD_v22_ER_GRP_SIZE_M 0x1F
#define AT91C_CSD_v22_SECT_SIZE_S 10 // [46:42]
#define AT91C_CSD_v22_SECT_SIZE_M 0x1F
#define AT91C_CSD_C_SIZE_M_S 15 // [49:47]
#define AT91C_CSD_C_SIZE_M_M 0x07
#define AT91C_CSD_VDD_WMAX_S 18 // [52:50]
#define AT91C_CSD_VDD_WMAX_M 0x07
#define AT91C_CSD_VDD_WMIN_S 21 // [55:53]
#define AT91C_CSD_VDD_WMIN_M 0x07
#define AT91C_CSD_RCUR_MAX_S 24 // [58:56]
#define AT91C_CSD_RCUR_MAX_M 0x07
#define AT91C_CSD_RCUR_MIN_S 27 // [61:59]
#define AT91C_CSD_RCUR_MIN_M 0x07
#define AT91C_CSD_CSIZE_L_S 30 // [63:62] <=> 2 LSB of CSIZE
#define AT91C_CSD_CSIZE_L_M 0x03
// Third Response INT <=> CSD[1] : bits 64 to 95
#define AT91C_CSD_CSIZE_H_S 0 // [73:64] <=> 10 MSB of CSIZE
#define AT91C_CSD_CSIZE_H_M 0x03FF
// reserved 10 // [75:74]
// reserved 0x03
#define AT91C_CSD_DSR_I_S 12 // [76:76]
#define AT91C_CSD_DSR_I_M 0x01
#define AT91C_CSD_RD_B_MIS_S 13 // [77:77]
#define AT91C_CSD_RD_B_MIS_M 0x01
#define AT91C_CSD_WR_B_MIS_S 14 // [78:78]
#define AT91C_CSD_WR_B_MIS_M 0x01
#define AT91C_CSD_RD_B_PAR_S 15 // [79:79]
#define AT91C_CSD_RD_B_PAR_M 0x01
#define AT91C_CSD_RD_B_LEN_S 16 // [83:80]
#define AT91C_CSD_RD_B_LEN_M 0x0F
#define AT91C_CSD_CCC_S 20 // [95:84]
#define AT91C_CSD_CCC_M 0x0FFF
// Fourth Response INT <=> CSD[0] : bits 96 to 127
#define AT91C_CSD_TRANS_SPEED_S 0 // [103:96]
#define AT91C_CSD_TRANS_SPEED_M 0xFF
#define AT91C_CSD_NSAC_S 8 // [111:104]
#define AT91C_CSD_NSAC_M 0xFF
#define AT91C_CSD_TAAC_S 16 // [119:112]
#define AT91C_CSD_TAAC_M 0xFF
// reserved 24 // [121:120]
// reserved 0x03
#define AT91C_CSD_MMC_SPEC_VERS_S 26 // [125:122] reserved for MMC compatibility
#define AT91C_CSD_MMC_SPEC_VERS_M 0x0F
#define AT91C_CSD_STRUCT_S 30 // [127:126]
#define AT91C_CSD_STRUCT_M 0x03
/////////////////////////////////////////////////////////////////////////////////////////////////////
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,49 +0,0 @@
/*
* (C) Copyright 2006
* Atmel Nordic AB <www.atmel.com>
* Ulf Samuelsson <ulf@atmel.com>
*
* See file CREDITS for list of people who contributed to this
* project.
*
* 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
*/
#ifndef __LED_H
#define __LED_H
#ifndef __ASSEMBLY__
extern void LED_init (void);
extern void LED_set(unsigned int led);
extern void red_LED_on(void);
extern void red_LED_off(void);
extern void green_LED_on(void);
extern void green_LED_off(void);
extern void yellow_LED_on(void);
extern void yellow_LED_off(void);
extern void LED_blink(unsigned int led);
#else
.extern LED_init
.extern LED_set
.extern LED_blink
.extern red_LED_on
.extern red_LED_off
.extern yellow_LED_on
.extern yellow_LED_off
.extern green_LED_on
.extern green_LED_off
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,165 +0,0 @@
//*----------------------------------------------------------------------------
//* ATMEL Microcontroller Software Support - ROUSSET -
//*----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*----------------------------------------------------------------------------
//* File Name : init.c
//* Object : Low level initialisations written in C
//* Creation : HIi 10/10/2003
//*
//*----------------------------------------------------------------------------
#include "config.h"
#include "AT91RM9200.h"
#include "lib_AT91RM9200.h"
#include "stdio.h"
//*----------------------------------------------------------------------------
//* \fn AT91F_DataAbort
//* \brief This function reports an Abort
//*----------------------------------------------------------------------------
static void AT91F_SpuriousHandler()
{
puts("ISI");
while (1);
}
//*----------------------------------------------------------------------------
//* \fn AT91F_DataAbort
//* \brief This function reports an Abort
//*----------------------------------------------------------------------------
static void AT91F_DataAbort()
{
puts("IDA");
while (1);
}
//*----------------------------------------------------------------------------
//* \fn AT91F_FetchAbort
//* \brief This function reports an Abort
//*----------------------------------------------------------------------------
static void AT91F_FetchAbort()
{
puts("IFA");
while (1);
}
//*----------------------------------------------------------------------------
//* \fn AT91F_UndefHandler
//* \brief This function reports that no handler have been set for current IT
//*----------------------------------------------------------------------------
static void AT91F_UndefHandler()
{
puts("IUD");
while (1);
}
//*--------------------------------------------------------------------------------------
//* Function Name : AT91F_InitSdram
//* Object : Initialize the SDRAM
//* Input Parameters :
//* Output Parameters :
//*--------------------------------------------------------------------------------------
static void AT91F_InitSdram()
{
int *pRegister;
//* Configure PIOC as peripheral (D16/D31)
AT91F_PIO_CfgPeriph(
AT91C_BASE_PIOC, // PIO controller base address
0xFFFF0030,
0
);
//*Init SDRAM
pRegister = (int *)0xFFFFFF98;
*pRegister = 0x2188c155;
pRegister = (int *)0xFFFFFF90;
*pRegister = 0x2;
pRegister = (int *)0x20000000;
*pRegister = 0;
pRegister = (int *)0xFFFFFF90;
*pRegister = 0x4;
pRegister = (int *)0x20000000;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
*pRegister = 0;
pRegister = (int *)0xFFFFFF90;
*pRegister = 0x3;
pRegister = (int *)0x20000080;
*pRegister = 0;
pRegister = (int *)0xFFFFFF94;
*pRegister = 0x2e0;
pRegister = (int *)0x20000000;
*pRegister = 0;
pRegister = (int *)0xFFFFFF90;
*pRegister = 0x00;
pRegister = (int *)0x20000000;
*pRegister = 0;
}
//*----------------------------------------------------------------------------
//* \fn AT91F_InitFlash
//* \brief This function performs low level HW initialization
//*----------------------------------------------------------------------------
static void AT91F_InitMemories()
{
int *pEbi = (int *)0xFFFFFF60;
//* Setup MEMC to support all connected memories (CS0 = FLASH; CS1=SDRAM)
pEbi = (int *)0xFFFFFF60;
*pEbi = 0x00000002;
//* CS0 cs for flash
pEbi = (int *)0xFFFFFF70;
*pEbi = 0x00003284;
AT91F_InitSdram();
}
//*----------------------------------------------------------------------------
//* \fn AT91F_LowLevelInit
//* \brief This function performs very low level HW initialization
//*----------------------------------------------------------------------------
void AT91F_LowLevelInit(void)
{
int i;
// Init Interrupt Controller
AT91F_AIC_Open(
AT91C_BASE_AIC, // pointer to the AIC registers
AT91C_AIC_BRANCH_OPCODE, // IRQ exception vector
AT91F_UndefHandler, // FIQ exception vector
AT91F_UndefHandler, // AIC default handler
AT91F_SpuriousHandler, // AIC spurious handler
0); // Protect mode
// Perform 8 End Of Interrupt Command to make sýre AIC will not Lock out nIRQ
for(i=0; i<8; i++)
AT91F_AIC_AcknowledgeIt(AT91C_BASE_AIC);
AT91F_AIC_SetExceptionVector((unsigned int *)0x0C, AT91F_FetchAbort);
AT91F_AIC_SetExceptionVector((unsigned int *)0x10, AT91F_DataAbort);
AT91F_AIC_SetExceptionVector((unsigned int *)0x4, AT91F_UndefHandler);
//Initialize SDRAM and Flash
AT91F_InitMemories();
}

View File

@ -1,4 +0,0 @@
.global Jump
Jump: mov pc, r0

View File

@ -1,103 +0,0 @@
/*
* (C) Copyright 2006
* Atmel Nordic AB <www.atmel.com>
* Ulf Samuelsson <ulf@atmel.com>
*
* See file CREDITS for list of people who contributed to this
* project.
*
* 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
*/
#include <AT91RM9200.h>
#define GREEN_LED AT91C_PIO_PB0
#define YELLOW_LED AT91C_PIO_PB1
#define RED_LED AT91C_PIO_PB2
void LED_set(unsigned int led)
{
AT91PS_PIO PIOB = AT91C_BASE_PIOB;
PIOB->PIO_SODR = (led ^ 0x7) & 0x7; // All 0's => Set PIO high => OFF
PIOB->PIO_CODR = led & 0x7; // All 1's => Set PIO low => ON
}
void green_LED_on(void)
{
AT91PS_PIO PIOB = AT91C_BASE_PIOB;
// PIOB->PIO_CODR = GREEN_LED;
PIOB->PIO_CODR = (1 << 0);
}
void yellow_LED_on(void)
{
AT91PS_PIO PIOB = AT91C_BASE_PIOB;
// PIOB->PIO_CODR = YELLOW_LED;
PIOB->PIO_CODR = (1 << 1);
}
void red_LED_on(void)
{
AT91PS_PIO PIOB = AT91C_BASE_PIOB;
// PIOB->PIO_CODR = RED_LED;
PIOB->PIO_CODR = (1 << 2);
}
void green_LED_off(void)
{
AT91PS_PIO PIOB = AT91C_BASE_PIOB;
// PIOB->PIO_SODR = GREEN_LED;
PIOB->PIO_SODR = (1 << 0);
}
void yellow_LED_off(void)
{
AT91PS_PIO PIOB = AT91C_BASE_PIOB;
// PIOB->PIO_SODR = YELLOW_LED;
PIOB->PIO_SODR = (1 << 1);
}
void red_LED_off(void)
{
AT91PS_PIO PIOB = AT91C_BASE_PIOB;
// PIOB->PIO_SODR = RED_LED;
PIOB->PIO_SODR = (1 << 2);
}
void LED_blink(unsigned int led)
{
volatile int i,j;
for(i = 0; i < 5; i++) {
LED_set((1 << led)&0x7);
for(j= 0; j < 200000; j++);
LED_set(0);
for(j= 0; j < 200000; j++);
}
}
void LED_init (void)
{
AT91PS_PIO PIOB = AT91C_BASE_PIOB;
AT91PS_PMC PMC = AT91C_BASE_PMC;
PMC->PMC_PCER = (1 << AT91C_ID_PIOB); // Enable PIOB clock
// Disable peripherals on LEDs
PIOB->PIO_PER = AT91C_PIO_PB2 | AT91C_PIO_PB1 | AT91C_PIO_PB0;
// Enable pins as outputs
PIOB->PIO_OER = AT91C_PIO_PB2 | AT91C_PIO_PB1 | AT91C_PIO_PB0;
// Turn all LEDs OFF
PIOB->PIO_SODR = AT91C_PIO_PB2 | AT91C_PIO_PB1 | AT91C_PIO_PB0;
}

View File

@ -1,811 +0,0 @@
/*----------------------------------------------------------------------------
* ATMEL Microcontroller Software Support - ROUSSET -
*----------------------------------------------------------------------------
* The software is delivered "AS IS" without warranty or condition of any
* kind, either express, implied or statutory. This includes without
* limitation any warranty or condition with respect to merchantability or
* fitness for any particular purpose, or against the infringements of
* intellectual property rights of others.
*----------------------------------------------------------------------------
* File Name : main.c
* Object :
* Creation : HIi 10/10/2003
* Modif : HIi 15/06/2004 : add crc32 to verify the download
* from dataflash
* : HIi 21/09/2004 : Set first PLLA to 180Mhz and MCK to
* 60Mhz to speed up dataflash boot (15Mhz)
* : MLC 12/04/2005 : Modify SetPLL() to avoid errata
* : USA 30/12/2005 : Change to page Size 1056
* Change startaddress to C0008400
* Change SPI Speed to ~4 Mhz
* Add retry on CRC Error
*----------------------------------------------------------------------------
*/
#include "config.h"
#include "stdio.h"
#include "AT91RM9200.h"
#include "lib_AT91RM9200.h"
#include "com.h"
#include "main.h"
#include "dataflash.h"
#include "AT91C_MCI_Device.h"
#define DEBUGOUT
#define XMODEM
#define MEMDISP
#ifdef PAGESZ_1056
#define PAGESIZE 1056
#else
#define PAGESIZE 1024
#endif
#define AT91C_SDRAM_START 0x20000000
#define AT91C_BOOT_ADDR 0x21F00000
#define AT91C_BOOT_SIZE 128*PAGESIZE
#ifdef PAGESZ_1056
#define AT91C_BOOT_DATAFLASH_ADDR 0xC0008400
#else
#define AT91C_BOOT_DATAFLASH_ADDR 0xC0008000
#endif
#define AT91C_PLLA_VALUE 0x237A3E5A // crystal= 18.432MHz - fixes BRG error at 115kbps
//#define AT91C_PLLA_VALUE 0x2026BE04 // crystal= 18.432MHz
//#define AT91C_PLLA_VALUE 0x202CBE01 // crystal= 4MHz
#define DISP_LINE_LEN 16
// Reason for boot failure
#define IMAGE_BAD_SIZE 0
#define IMAGE_READ_FAILURE 1
#define IMAGE_CRC_ERROR 2
#define IMAGE_ERROR 3
#define SUCCESS -1
/* prototypes*/
extern void AT91F_ST_ASM_HANDLER(void);
extern void Jump(unsigned int addr);
const char *menu_dataflash[] = {
#ifdef XMODEM
"1: P DFboot\n",
"2: P U-Boot\n",
#endif
"3: P SDCard\n",
#ifdef PAGESZ_1056
"4: R UBOOT\n",
#else
"4: R UBOOT\n",
#endif
#ifdef XMODEM
"5: P DF [addr]\n",
#endif
"6: RD DF [addr]\n",
"7: E DF\n"
};
#ifdef XMODEM
#define MAXMENU 7
#else
#define MAXMENU 4
#endif
char message[20];
#ifdef XMODEM
volatile char XmodemComplete = 0;
#endif
unsigned int StTick = 0;
AT91S_RomBoot const *pAT91;
#ifdef XMODEM
AT91S_SBuffer sXmBuffer;
AT91S_SvcXmodem svcXmodem;
AT91S_Pipe xmodemPipe;
#endif
AT91S_CtlTempo ctlTempo;
//*--------------------------------------------------------------------------------------
//* Function Name : GetTickCount()
//* Object : Return the number of systimer tick
//* Input Parameters :
//* Output Parameters :
//*--------------------------------------------------------------------------------------
unsigned int GetTickCount(void)
{
return StTick;
}
#ifdef XMODEM
//*--------------------------------------------------------------------------------------
//* Function Name : AT91_XmodemComplete()
//* Object : Perform the remap and jump to appli in RAM
//* Input Parameters :
//* Output Parameters :
//*--------------------------------------------------------------------------------------
static void AT91_XmodemComplete(AT91S_PipeStatus status, void *pVoid)
{
/* stop the Xmodem tempo */
svcXmodem.tempo.Stop(&(svcXmodem.tempo));
XmodemComplete = 1;
}
//*--------------------------------------------------------------------------------------
//* Function Name : AT91F_XmodemProtocol(AT91S_PipeStatus status, void *pVoid)
//* Object : Xmodem dispatcher
//* Input Parameters :
//* Output Parameters :
//*--------------------------------------------------------------------------------------
static void XmodemProtocol(AT91S_PipeStatus status, void *pVoid)
{
AT91PS_SBuffer pSBuffer = (AT91PS_SBuffer) xmodemPipe.pBuffer->pChild;
AT91PS_USART pUsart = svcXmodem.pUsart;
if (pSBuffer->szRdBuffer == 0) {
/* Start a tempo to wait the Xmodem protocol complete */
svcXmodem.tempo.Start(&(svcXmodem.tempo), 10, 0, AT91_XmodemComplete, pUsart);
}
}
#endif
//*--------------------------------------------------------------------------------------
//* Function Name : irq1_c_handler()
//* Object : C Interrupt handler for Interrutp source 1
//* Input Parameters : none
//* Output Parameters : none
//*--------------------------------------------------------------------------------------
void AT91F_ST_HANDLER(void)
{
volatile unsigned int csr = *AT91C_DBGU_CSR;
#ifdef XMODEM
unsigned int error;
#endif
if (AT91C_BASE_ST->ST_SR & 0x01) {
StTick++;
ctlTempo.CtlTempoTick(&ctlTempo);
return;
}
#ifdef XMODEM
error = AT91F_US_Error((AT91PS_USART)AT91C_BASE_DBGU);
if (csr & error) {
/* Stop previous Xmodem transmition*/
*(AT91C_DBGU_CR) = AT91C_US_RSTSTA;
AT91F_US_DisableIt((AT91PS_USART)AT91C_BASE_DBGU, AT91C_US_ENDRX);
AT91F_US_EnableIt((AT91PS_USART)AT91C_BASE_DBGU, AT91C_US_RXRDY);
}
else if (csr & (AT91C_US_TXRDY | AT91C_US_ENDTX | AT91C_US_TXEMPTY |
AT91C_US_RXRDY | AT91C_US_ENDRX | AT91C_US_TIMEOUT |
AT91C_US_RXBUFF)) {
if ( !(svcXmodem.eot) )
svcXmodem.Handler(&svcXmodem, csr);
}
#endif
}
//*-----------------------------------------------------------------------------
//* Function Name : AT91F_DisplayMenu()
//* Object :
//* Input Parameters :
//* Return value :
//*-----------------------------------------------------------------------------
static int AT91F_DisplayMenu(void)
{
int i, mci_present = 0;
printf("\nDF LOADER %s %s %s\n",AT91C_VERSION,__DATE__,__TIME__);
AT91F_DataflashPrintInfo();
mci_present = AT91F_MCI_Init();
for(i = 0; i < MAXMENU; i++) {
puts(menu_dataflash[i]);
}
return mci_present;
}
//*-----------------------------------------------------------------------------
//* Function Name : AsciiToHex()
//* Object : ascii to hexa conversion
//* Input Parameters :
//* Return value :
//*-----------------------------------------------------------------------------
static unsigned int AsciiToHex(char *s, unsigned int *val)
{
int n;
*val=0;
if(s[0] == '0' && ((s[1] == 'x') || (s[1] == 'X')))
s+=2;
n = 0;
while((n < 8) && (s[n] !=0))
{
*val <<= 4;
if ( (s[n] >= '0') && (s[n] <='9'))
*val += (s[n] - '0');
else
if ((s[n] >= 'a') && (s[n] <='f'))
*val += (s[n] - 0x57);
else
if ((s[n] >= 'A') && (s[n] <='F'))
*val += (s[n] - 0x37);
else
return 0;
n++;
}
return 1;
}
#ifdef MEMDISP
//*-----------------------------------------------------------------------------
//* Function Name : AT91F_MemoryDisplay()
//* Object : Display the content of the dataflash
//* Input Parameters :
//* Return value :
//*-----------------------------------------------------------------------------
static int AT91F_MemoryDisplay(unsigned int addr, unsigned int length)
{
unsigned long i, nbytes, linebytes;
char *cp;
// unsigned int *uip;
// unsigned short *usp;
unsigned char *ucp;
char linebuf[DISP_LINE_LEN];
// nbytes = length * size;
nbytes = length;
do
{
// uip = (unsigned int *)linebuf;
// usp = (unsigned short *)linebuf;
ucp = (unsigned char *)linebuf;
printf("%08x:", addr);
linebytes = (nbytes > DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
if((addr & 0xF0000000) == 0x20000000) {
for(i = 0; i < linebytes; i ++) {
linebuf[i] = *(char *)(addr+i);
}
} else {
read_dataflash(addr, linebytes, linebuf);
}
for (i=0; i<linebytes; i++)
{
/* if (size == 4)
printf(" %08x", *uip++);
else if (size == 2)
printf(" %04x", *usp++);
else
*/
printf(" %02x", *ucp++);
// addr += size;
addr++;
}
printf(" ");
cp = linebuf;
for (i=0; i<linebytes; i++) {
if ((*cp < 0x20) || (*cp > 0x7e))
printf(".");
else
printf("%c", *cp);
cp++;
}
printf("\n");
nbytes -= linebytes;
} while (nbytes > 0);
return 0;
}
#endif
//*--------------------------------------------------------------------------------------
//* Function Name : AT91F_SetPLL
//* Object : Set the PLLA to 180Mhz and Master clock to 60 Mhz
//* Input Parameters :
//* Output Parameters :
//*--------------------------------------------------------------------------------------
static unsigned int AT91F_SetPLL(void)
{
AT91_REG tmp;
AT91PS_PMC pPmc = AT91C_BASE_PMC;
AT91PS_CKGR pCkgr = AT91C_BASE_CKGR;
pPmc->PMC_IDR = 0xFFFFFFFF;
/* -Setup the PLL A */
pCkgr->CKGR_PLLAR = AT91C_PLLA_VALUE;
while (!(*AT91C_PMC_SR & AT91C_PMC_LOCKA));
/* - Switch Master Clock from PLLB to PLLA/3 */
tmp = pPmc->PMC_MCKR;
/* See Atmel Errata #27 and #28 */
if (tmp & 0x0000001C) {
tmp = (tmp & ~0x0000001C);
pPmc->PMC_MCKR = tmp;
while (!(*AT91C_PMC_SR & AT91C_PMC_MCKRDY));
}
if (tmp != 0x00000202) {
pPmc->PMC_MCKR = 0x00000202;
if ((tmp & 0x00000003) != 0x00000002)
while (!(*AT91C_PMC_SR & AT91C_PMC_MCKRDY));
}
return 1;
}
//*--------------------------------------------------------------------------------------
//* Function Name : AT91F_ResetRegisters
//* Object : Restore the initial state to registers
//* Input Parameters :
//* Output Parameters :
//*--------------------------------------------------------------------------------------
static unsigned int AT91F_ResetRegisters(void)
{
volatile int i = 0;
/* set the PIOs in input*/
/* This disables the UART output, so dont execute for now*/
#ifndef DEBUGOUT
*AT91C_PIOA_ODR = 0xFFFFFFFF; /* Disables all the output pins */
*AT91C_PIOA_PER = 0xFFFFFFFF; /* Enables the PIO to control all the pins */
#endif
AT91F_AIC_DisableIt (AT91C_BASE_AIC, AT91C_ID_SYS);
/* close all peripheral clocks */
#ifndef DEBUGOUT
AT91C_BASE_PMC->PMC_PCDR = 0xFFFFFFFC;
#endif
/* Disable core interrupts and set supervisor mode */
__asm__ ("msr CPSR_c, #0xDF"); //* ARM_MODE_SYS(0x1F) | I_BIT(0x80) | F_BIT(0x40)
/* Clear all the interrupts */
*AT91C_AIC_ICCR = 0xffffffff;
/* read the AIC_IVR and AIC_FVR */
i = *AT91C_AIC_IVR;
i = *AT91C_AIC_FVR;
/* write the end of interrupt control register */
*AT91C_AIC_EOICR = 0;
return 1;
}
static int AT91F_LoadBoot(void)
{
// volatile unsigned int crc1 = 0, crc2 = 0;
volatile unsigned int SizeToDownload = 0x21400;
volatile unsigned int AddressToDownload = AT91C_BOOT_ADDR;
#if 0
/* Read vector 6 to extract size to load */
if (read_dataflash(AT91C_BOOT_DATAFLASH_ADDR, 32,
(char *)AddressToDownload) != AT91C_DATAFLASH_OK)
{
printf("Bad Code Size\n");
return IMAGE_BAD_SIZE;
}
/* calculate the size to download */
SizeToDownload = *(int *)(AddressToDownload + AT91C_OFFSET_VECT6);
#endif
// printf("\nLoad UBOOT from dataflash[%x] to SDRAM[%x]\n",
// AT91C_BOOT_DATAFLASH_ADDR, AT91C_BOOT_ADDR);
if (read_dataflash(AT91C_BOOT_DATAFLASH_ADDR, SizeToDownload + 8,
(char *)AddressToDownload) != AT91C_DATAFLASH_OK)
{
printf("F DF RD\n");
return IMAGE_READ_FAILURE;
}
#if 0
pAT91->CRC32((const unsigned char *)AT91C_BOOT_ADDR,
(unsigned int)SizeToDownload , (unsigned int *)&crc2);
crc1 = (int)(*(char *)(AddressToDownload + SizeToDownload)) +
(int)(*(char *)(AddressToDownload + SizeToDownload + 1) << 8) +
(int)(*(char *)(AddressToDownload + SizeToDownload + 2) << 16) +
(int)(*(char *)(AddressToDownload + SizeToDownload + 3) << 24);
/* Restore the value of Vector 6 */
*(int *)(AddressToDownload + AT91C_OFFSET_VECT6) =
*(int *)(AddressToDownload + SizeToDownload + 4);
if (crc1 != crc2) {
printf("DF CRC bad %x != %x\n",crc1,crc2);
return IMAGE_CRC_ERROR;
}
#endif
return SUCCESS;
}
static int AT91F_StartBoot(void)
{
int sts;
if((sts = AT91F_LoadBoot()) != SUCCESS) return sts;
// printf("\n");
// printf("PLLA[180MHz], MCK[60Mhz] ==> Start UBOOT\n");
if (AT91F_ResetRegisters())
{
printf("Jump");
Jump(AT91C_BOOT_ADDR);
// LED_blink(0);
}
return IMAGE_ERROR;
}
#if 0
static void AT91F_RepeatedStartBoot(void)
{
int i;
for(i = 0; i < CRC_RETRIES; i++) {
if(AT91F_StartBoot() != IMAGE_CRC_ERROR){
// LED_blink(1);
return;
}
}
return;
}
#endif
#define TRUE 1
#define FALSE 0
#define TRX_MAGIC 0x30524448 /* "HDR0" */
#define TRX_VERSION 1
struct trx_header {
unsigned int magic;
unsigned int len;
unsigned int crc32;
unsigned int flag_version;
unsigned int offsets[3];
};
#define AT91C_MCI_TIMEOUT 1000000
extern AT91S_MciDevice MCI_Device;
extern void AT91F_MCIDeviceWaitReady(unsigned int);
extern int AT91F_MCI_ReadBlockSwab(AT91PS_MciDevice, int, unsigned int *, int);
int Program_From_MCI(void)
{
int i;
unsigned int Max_Read_DataBlock_Length;
int block = 0;
int buffer = AT91C_DOWNLOAD_BASE_ADDRESS;
int bufpos = AT91C_DOWNLOAD_BASE_ADDRESS;
int NbPage = 0;
struct trx_header *p;
p = (struct trx_header *)bufpos;
Max_Read_DataBlock_Length = MCI_Device.pMCI_DeviceFeatures->Max_Read_DataBlock_Length;
AT91F_MCIDeviceWaitReady(AT91C_MCI_TIMEOUT);
AT91F_MCI_ReadBlockSwab(&MCI_Device, block*Max_Read_DataBlock_Length, (unsigned int *)bufpos, Max_Read_DataBlock_Length);
if (p->magic != TRX_MAGIC) {
printf("Inv IMG 0x%08x\n", p->magic);
return FALSE;
}
printf("RDSD");
AT91C_BASE_PIOC->PIO_CODR = AT91C_PIO_PC7 | AT91C_PIO_PC15 | AT91C_PIO_PC8 | AT91C_PIO_PC14;
for (i=0; i<(p->len/512); i++) {
AT91F_MCI_ReadBlockSwab(&MCI_Device, block*Max_Read_DataBlock_Length, (unsigned int *)bufpos, Max_Read_DataBlock_Length);
block++;
bufpos += Max_Read_DataBlock_Length;
}
NbPage = 0;
i = dataflash_info[0].Device.pages_number;
while(i >>= 1)
NbPage++;
i = ((p->offsets[1] - p->offsets[0])/ 512) + 1 + (NbPage << 13) + (dataflash_info[0].Device.pages_size << 17);
*(int *)(buffer + p->offsets[0] + AT91C_OFFSET_VECT6) = i;
printf(" WDFB");
AT91C_BASE_PIOC->PIO_CODR = AT91C_PIO_PC7 | AT91C_PIO_PC15 | AT91C_PIO_PC14;
AT91C_BASE_PIOC->PIO_SODR = AT91C_PIO_PC8;
write_dataflash(0xc0000000, buffer + p->offsets[0], p->offsets[1] - p->offsets[0]);
printf(" WUB");
AT91C_BASE_PIOC->PIO_CODR = AT91C_PIO_PC7 | AT91C_PIO_PC15;
AT91C_BASE_PIOC->PIO_SODR = AT91C_PIO_PC8 | AT91C_PIO_PC14;
write_dataflash(0xc0008000, buffer + p->offsets[1], p->offsets[2] - p->offsets[1]);
printf(" WKRFS");
AT91C_BASE_PIOC->PIO_CODR = AT91C_PIO_PC8 | AT91C_PIO_PC15;
AT91C_BASE_PIOC->PIO_SODR = AT91C_PIO_PC7 | AT91C_PIO_PC14;
write_dataflash(0xc0042000, buffer + p->offsets[2], p->len - p->offsets[2]);
AT91C_BASE_PIOC->PIO_CODR = AT91C_PIO_PC8 | AT91C_PIO_PC14;
AT91C_BASE_PIOC->PIO_SODR = AT91C_PIO_PC7 | AT91C_PIO_PC15;
return TRUE;
}
//*----------------------------------------------------------------------------
//* Function Name : main
//* Object : Main function
//* Input Parameters : none
//* Output Parameters : True
//*----------------------------------------------------------------------------
int main(void)
{
#ifdef XMODEM
AT91PS_Buffer pXmBuffer;
AT91PS_SvcComm pSvcXmodem;
#endif
AT91S_SvcTempo svcBootTempo; // Link to a AT91S_Tempo object
unsigned int ix;
volatile unsigned int AddressToDownload, SizeToDownload;
unsigned int DeviceAddress = 0;
char command = 0;
#ifdef XMODEM
volatile int i = 0;
unsigned int crc1 = 0, crc2 = 0;
volatile int device;
int NbPage;
#endif
volatile int Nb_Device = 0;
int mci_present = 0;
pAT91 = AT91C_ROM_BOOT_ADDRESS;
if (!AT91F_SetPLL())
{
printf("F SetPLL");
while(1);
}
at91_init_uarts();
/* Tempo Initialisation */
pAT91->OpenCtlTempo(&ctlTempo, (void *) &(pAT91->SYSTIMER_DESC));
ctlTempo.CtlTempoStart((void *) &(pAT91->SYSTIMER_DESC));
// Attach the tempo to a tempo controler
ctlTempo.CtlTempoCreate(&ctlTempo, &svcBootTempo);
// LED_init();
// LED_blink(2);
#ifdef XMODEM
/* Xmodem Initialisation */
pXmBuffer = pAT91->OpenSBuffer(&sXmBuffer);
pSvcXmodem = pAT91->OpenSvcXmodem(&svcXmodem,
(AT91PS_USART)AT91C_BASE_DBGU, &ctlTempo);
pAT91->OpenPipe(&xmodemPipe, pSvcXmodem, pXmBuffer);
#endif
/* System Timer initialization */
AT91F_AIC_ConfigureIt(
AT91C_BASE_AIC, // AIC base address
AT91C_ID_SYS, // System peripheral ID
AT91C_AIC_PRIOR_HIGHEST, // Max priority
AT91C_AIC_SRCTYPE_INT_LEVEL_SENSITIVE, // Level sensitive
AT91F_ST_ASM_HANDLER
);
/* Enable ST interrupt */
AT91F_AIC_EnableIt(AT91C_BASE_AIC, AT91C_ID_SYS);
#ifndef PRODTEST
/* Start tempo to start Boot in a delay of
* AT91C_DELAY_TO_BOOT sec if no key pressed */
svcBootTempo.Start(&svcBootTempo, AT91C_DELAY_TO_BOOT,
0, AT91F_StartBoot, NULL);
#endif
while(1)
{
while(command == 0)
{
AddressToDownload = AT91C_DOWNLOAD_BASE_ADDRESS;
SizeToDownload = AT91C_DOWNLOAD_MAX_SIZE;
DeviceAddress = 0;
/* try to detect Dataflash */
if (!Nb_Device)
Nb_Device = AT91F_DataflashInit();
mci_present = AT91F_DisplayMenu();
#ifdef PRODTEST
if (mci_present) {
if (Program_From_MCI())
AT91F_StartBoot();
}
#endif
message[0] = 0;
AT91F_ReadLine ("Enter: ", message);
#ifndef PRODTEST
/* stop tempo ==> stop autoboot */
svcBootTempo.Stop(&svcBootTempo);
#endif
command = message[0];
for(ix = 1; (message[ix] == ' ') && (ix < 12); ix++); // Skip some whitespace
if(!AsciiToHex(&message[ix], &DeviceAddress) )
DeviceAddress = 0; // Illegal DeviceAddress
switch(command)
{
#ifdef XMODEM
case '1':
case '2':
case '5':
if(command == '1') {
DeviceAddress = 0xC0000000;
// printf("Download DataflashBoot.bin to [0x%x]\n", DeviceAddress);
} else if(command == '2') {
DeviceAddress = AT91C_BOOT_DATAFLASH_ADDR;
// printf("Download u-boot.bin to [0x%x]\n", DeviceAddress);
} else {
// printf("Download Dataflash to [0x%x]\n", DeviceAddress);
}
switch(DeviceAddress & 0xFF000000)
{
case CFG_DATAFLASH_LOGIC_ADDR_CS0:
if (dataflash_info[0].id == 0){
printf("No DF");
AT91F_WaitKeyPressed();
command = 0;
}
device = 0;
break;
case CFG_DATAFLASH_LOGIC_ADDR_CS3:
if (dataflash_info[1].id == 0){
printf("No DF");
AT91F_WaitKeyPressed();
command = 0;
}
device = 1;
break;
default:
command = 0;
break;
}
break;
#endif
case '3':
if (mci_present)
Program_From_MCI();
command = 0;
break;
case '4':
AT91F_StartBoot();
command = 0;
break;
#ifdef MEMDISP
case '6':
do
{
AT91F_MemoryDisplay(DeviceAddress, 256);
AT91F_ReadLine (NULL, message);
DeviceAddress += 0x100;
}
while(message[0] == '\0');
command = 0;
break;
#endif
case '7':
switch(DeviceAddress & 0xFF000000)
{
case CFG_DATAFLASH_LOGIC_ADDR_CS0:
break;
case CFG_DATAFLASH_LOGIC_ADDR_CS3:
break;
default:
command = 0;
break;
}
if (command != 0) {
AT91F_ReadLine ("RDY ERA\nSure?",
message);
if(message[0] == 'Y' || message[0] == 'y') {
erase_dataflash(DeviceAddress & 0xFF000000);
// printf("Erase complete\n\n");
}
// else
// printf("Erase aborted\n");
}
command = 0;
break;
default:
command = 0;
break;
}
}
#ifdef XMODEM
for(i = 0; i <= AT91C_DOWNLOAD_MAX_SIZE; i++)
*(unsigned char *)(AddressToDownload + i) = 0;
xmodemPipe.Read(&xmodemPipe, (char *)AddressToDownload,
SizeToDownload, XmodemProtocol, 0);
while(XmodemComplete !=1);
SizeToDownload = (unsigned int)((svcXmodem.pData) -
(unsigned int)AddressToDownload);
/* Modification of vector 6 */
if ((DeviceAddress == CFG_DATAFLASH_LOGIC_ADDR_CS0)) {
// Vector 6 must be compliant to the BootRom description (ref Datasheet)
NbPage = 0;
i = dataflash_info[device].Device.pages_number;
while(i >>= 1)
NbPage++;
i = (SizeToDownload / 512)+1 + (NbPage << 13) +
(dataflash_info[device].Device.pages_size << 17); //+4 to add crc32
SizeToDownload = 512 * (i &0xFF);
}
else
{
/* Save the contents of vector 6 ==> will be restored
* at boot time (AT91F_StartBoot) */
*(int *)(AddressToDownload + SizeToDownload + 4) =
*(int *)(AddressToDownload + AT91C_OFFSET_VECT6);
/* Modify Vector 6 to contain the size of the
* file to copy (Dataflash -> SDRAM)*/
i = SizeToDownload;
}
*(int *)(AddressToDownload + AT91C_OFFSET_VECT6) = i;
// printf("\nModification of Arm Vector 6 :%x\n", i);
// printf("\nWrite %d bytes in DataFlash [0x%x]\n",SizeToDownload, DeviceAddress);
crc1 = 0;
pAT91->CRC32((const unsigned char *)AddressToDownload, SizeToDownload , &crc1);
/* Add the crc32 at the end of the code */
*(char *)(AddressToDownload + SizeToDownload) = (char)(crc1 & 0x000000FF);
*(char *)(AddressToDownload + SizeToDownload + 1) = (char)((crc1 & 0x0000FF00) >> 8);
*(char *)(AddressToDownload + SizeToDownload + 2) = (char)((crc1 & 0x00FF0000) >> 16);
*(char *)(AddressToDownload + SizeToDownload + 3) = (char)((crc1 & 0xFF000000) >> 24);
/* write dataflash */
write_dataflash (DeviceAddress, AddressToDownload, (SizeToDownload + 8));
/* clear the buffer before read */
for(i=0; i <= SizeToDownload; i++)
*(unsigned char *)(AddressToDownload + i) = 0;
/* Read dataflash to check the validity of the data */
read_dataflash (DeviceAddress, (SizeToDownload + 4), (char *)(AddressToDownload));
printf("VFY: ");
crc2 = 0;
pAT91->CRC32((const unsigned char *)AddressToDownload, SizeToDownload , &crc2);
crc1 = (int)(*(char *)(AddressToDownload + SizeToDownload)) +
(int)(*(char *)(AddressToDownload + SizeToDownload + 1) << 8) +
(int)(*(char *)(AddressToDownload + SizeToDownload + 2) << 16) +
(int)(*(char *)(AddressToDownload + SizeToDownload + 3) << 24);
if (crc1 != crc2)
printf("ERR");
else
printf("OK");
command = 0;
XmodemComplete = 0;
AT91F_WaitKeyPressed();
#endif
}
}

View File

@ -1,43 +0,0 @@
//*----------------------------------------------------------------------------
//* ATMEL Microcontroller Software Support - ROUSSET -
//*----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*----------------------------------------------------------------------------
//* File Name : main.h
//* Object :
//*
//* 1.0 27/03/03 HIi : Creation
//* 1.01 03/05/04 HIi : AT9C_VERSION incremented to 1.01
//* 1.02 15/06/04 HIi : AT9C_VERSION incremented to 1.02 ==>
//* Add crc32 to verify dataflash download
//* 1.03 18/04/05 MLC : AT91C_VERSION incremented to 1.03g
//* Repeat boot on CRC Failure
//* Change Page Size to 1056
//* Reduce SPI speed to 4 Mbit
//* Change U-Boot boot address to a 1056 byte page boundary
//* 1.04 30/04/05 USA : AT91C_VERSION incremented to 1.04
//* 1.05 07/08/06 USA : AT91C_VERSION incremented to 1.05
//* Will only support loading Dataflashboot.bin and U-Boot
//*----------------------------------------------------------------------------
#ifndef main_h
#define main_h
#include "embedded_services.h"
#define AT91C_DOWNLOAD_BASE_ADDRESS 0x20000000
#define AT91C_DOWNLOAD_MAX_SIZE 0x00040000
#define AT91C_OFFSET_VECT6 0x14 //* Offset for ARM vector 6
#define AT91C_VERSION "VER 1.05"
// Global variables and functions definition
extern unsigned int GetTickCount(void);
#endif

View File

@ -1,743 +0,0 @@
//*----------------------------------------------------------------------------
//* ATMEL Microcontroller Software Support - ROUSSET -
//*----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*----------------------------------------------------------------------------
//* File Name : mci_device.c
//* Object : TEST DataFlash Functions
//* Creation : FB 26/11/2002
//*
//*----------------------------------------------------------------------------
#include <AT91C_MCI_Device.h>
#include "stdio.h"
#define AT91C_MCI_TIMEOUT 1000000 /* For AT91F_MCIDeviceWaitReady */
#define BUFFER_SIZE_MCI_DEVICE 512
#define MASTER_CLOCK 60000000
#define FALSE 0
#define TRUE 1
//* External Functions
extern void AT91F_ASM_MCI_Handler(void);
//* Global Variables
AT91S_MciDeviceFeatures MCI_Device_Features;
AT91S_MciDeviceDesc MCI_Device_Desc;
AT91S_MciDevice MCI_Device;
#undef ENABLE_WRITE
#undef MMC
//*----------------------------------------------------------------------------
//* \fn AT91F_MCI_SendCommand
//* \brief Generic function to send a command to the MMC or SDCard
//*----------------------------------------------------------------------------
int AT91F_MCI_SendCommand (
AT91PS_MciDevice pMCI_Device,
unsigned int Cmd,
unsigned int Arg)
{
unsigned int error,status;
//unsigned int tick=0;
// Send the command
AT91C_BASE_MCI->MCI_ARGR = Arg;
AT91C_BASE_MCI->MCI_CMDR = Cmd;
// wait for CMDRDY Status flag to read the response
do
{
status = AT91C_BASE_MCI->MCI_SR;
//tick++;
}
while( !(status & AT91C_MCI_CMDRDY) );//&& (tick<100) );
// Test error ==> if crc error and response R3 ==> don't check error
error = (AT91C_BASE_MCI->MCI_SR) & AT91C_MCI_SR_ERROR;
if(error != 0 )
{
// if the command is SEND_OP_COND the CRC error flag is always present (cf : R3 response)
if ( (Cmd != AT91C_SDCARD_APP_OP_COND_CMD) && (Cmd != AT91C_MMC_SEND_OP_COND_CMD) )
return ((AT91C_BASE_MCI->MCI_SR) & AT91C_MCI_SR_ERROR);
else
{
if (error != AT91C_MCI_RCRCE)
return ((AT91C_BASE_MCI->MCI_SR) & AT91C_MCI_SR_ERROR);
}
}
return AT91C_CMD_SEND_OK;
}
//*----------------------------------------------------------------------------
//* \fn AT91F_MCI_SDCard_SendAppCommand
//* \brief Specific function to send a specific command to the SDCard
//*----------------------------------------------------------------------------
int AT91F_MCI_SDCard_SendAppCommand (
AT91PS_MciDevice pMCI_Device,
unsigned int Cmd_App,
unsigned int Arg )
{
unsigned int status;
//unsigned int tick=0;
// Send the CMD55 for application specific command
AT91C_BASE_MCI->MCI_ARGR = (pMCI_Device->pMCI_DeviceFeatures->Relative_Card_Address << 16 );
AT91C_BASE_MCI->MCI_CMDR = AT91C_APP_CMD;
// wait for CMDRDY Status flag to read the response
do
{
status = AT91C_BASE_MCI->MCI_SR;
//tick++;
}
while( !(status & AT91C_MCI_CMDRDY) );//&& (tick<100) );
// if an error occurs
if (((AT91C_BASE_MCI->MCI_SR) & AT91C_MCI_SR_ERROR) != 0 )
return ((AT91C_BASE_MCI->MCI_SR) & AT91C_MCI_SR_ERROR);
// check if it is a specific command and then send the command
if ( (Cmd_App && AT91C_SDCARD_APP_ALL_CMD) == 0)
return AT91C_CMD_SEND_ERROR;
return( AT91F_MCI_SendCommand(pMCI_Device,Cmd_App,Arg) );
}
//*----------------------------------------------------------------------------
//* \fn AT91F_MCI_GetStatus
//* \brief Addressed card sends its status register
//*----------------------------------------------------------------------------
int AT91F_MCI_GetStatus(AT91PS_MciDevice pMCI_Device,unsigned int relative_card_address)
{
if (AT91F_MCI_SendCommand(pMCI_Device,
AT91C_SEND_STATUS_CMD,
relative_card_address <<16) == AT91C_CMD_SEND_OK)
return (AT91C_BASE_MCI->MCI_RSPR[0]);
return AT91C_CMD_SEND_ERROR;
}
//*----------------------------------------------------------------------------
//* \fn AT91F_MCI_Device_Handler
//* \brief MCI C interrupt handler
//*----------------------------------------------------------------------------
void AT91F_MCI_Device_Handler(
AT91PS_MciDevice pMCI_Device,
unsigned int status)
{
// If End of Tx Buffer Empty interrupt occurred
if ( status & AT91C_MCI_TXBUFE )
{
AT91C_BASE_MCI->MCI_IDR = AT91C_MCI_TXBUFE;
AT91C_BASE_PDC_MCI->PDC_PTCR = AT91C_PDC_TXTDIS;
pMCI_Device->pMCI_DeviceDesc->state = AT91C_MCI_IDLE;
} // End of if AT91C_MCI_TXBUFF
// If End of Rx Buffer Full interrupt occurred
if ( status & AT91C_MCI_RXBUFF )
{
AT91C_BASE_MCI->MCI_IDR = AT91C_MCI_RXBUFF;
AT91C_BASE_PDC_MCI->PDC_PTCR = AT91C_PDC_RXTDIS;
pMCI_Device->pMCI_DeviceDesc->state = AT91C_MCI_IDLE;
} // End of if AT91C_MCI_RXBUFF
}
//*----------------------------------------------------------------------------
//* \fn AT91F_MCI_Handler
//* \brief MCI Handler
//*----------------------------------------------------------------------------
void AT91F_MCI_Handler(void)
{
int status;
status = ( AT91C_BASE_MCI->MCI_SR & AT91C_BASE_MCI->MCI_IMR );
AT91F_MCI_Device_Handler(&MCI_Device,status);
}
//*----------------------------------------------------------------------------
//* \fn AT91F_MCI_ReadBlock
//* \brief Read an ENTIRE block or PARTIAL block
//*----------------------------------------------------------------------------
int AT91F_MCI_ReadBlock(
AT91PS_MciDevice pMCI_Device,
int src,
unsigned int *dataBuffer,
int sizeToRead )
{
////////////////////////////////////////////////////////////////////////////////////////////
if(pMCI_Device->pMCI_DeviceDesc->state != AT91C_MCI_IDLE)
return AT91C_READ_ERROR;
if( (AT91F_MCI_GetStatus(pMCI_Device,pMCI_Device->pMCI_DeviceFeatures->Relative_Card_Address) & AT91C_SR_READY_FOR_DATA) != AT91C_SR_READY_FOR_DATA)
return AT91C_READ_ERROR;
if ( (src + sizeToRead) > pMCI_Device->pMCI_DeviceFeatures->Memory_Capacity )
return AT91C_READ_ERROR;
// If source does not fit a begin of a block
if ( (src % pMCI_Device->pMCI_DeviceFeatures->Max_Read_DataBlock_Length) != 0 )
return AT91C_READ_ERROR;
// Test if the MMC supports Partial Read Block
// ALWAYS SUPPORTED IN SD Memory Card
if( (sizeToRead < pMCI_Device->pMCI_DeviceFeatures->Max_Read_DataBlock_Length)
&& (pMCI_Device->pMCI_DeviceFeatures->Read_Partial == 0x00) )
return AT91C_READ_ERROR;
if( sizeToRead > pMCI_Device->pMCI_DeviceFeatures->Max_Read_DataBlock_Length)
return AT91C_READ_ERROR;
////////////////////////////////////////////////////////////////////////////////////////////
// Init Mode Register
AT91C_BASE_MCI->MCI_MR |= ((pMCI_Device->pMCI_DeviceFeatures->Max_Read_DataBlock_Length << 16) | AT91C_MCI_PDCMODE);
if (sizeToRead %4)
sizeToRead = (sizeToRead /4)+1;
else
sizeToRead = sizeToRead/4;
AT91C_BASE_PDC_MCI->PDC_PTCR = (AT91C_PDC_TXTDIS | AT91C_PDC_RXTDIS);
AT91C_BASE_PDC_MCI->PDC_RPR = (unsigned int)dataBuffer;
AT91C_BASE_PDC_MCI->PDC_RCR = sizeToRead;
// Send the Read single block command
if ( AT91F_MCI_SendCommand(pMCI_Device, AT91C_READ_SINGLE_BLOCK_CMD, src) != AT91C_CMD_SEND_OK )
return AT91C_READ_ERROR;
pMCI_Device->pMCI_DeviceDesc->state = AT91C_MCI_RX_SINGLE_BLOCK;
// Enable AT91C_MCI_RXBUFF Interrupt
AT91C_BASE_MCI->MCI_IER = AT91C_MCI_RXBUFF;
// (PDC) Receiver Transfer Enable
AT91C_BASE_PDC_MCI->PDC_PTCR = AT91C_PDC_RXTEN;
return AT91C_READ_OK;
}
#ifdef ENABLE_WRITE
//*----------------------------------------------------------------------------
//* \fn AT91F_MCI_WriteBlock
//* \brief Write an ENTIRE block but not always PARTIAL block !!!
//*----------------------------------------------------------------------------
int AT91F_MCI_WriteBlock(
AT91PS_MciDevice pMCI_Device,
int dest,
unsigned int *dataBuffer,
int sizeToWrite )
{
////////////////////////////////////////////////////////////////////////////////////////////
if( pMCI_Device->pMCI_DeviceDesc->state != AT91C_MCI_IDLE)
return AT91C_WRITE_ERROR;
if( (AT91F_MCI_GetStatus(pMCI_Device,pMCI_Device->pMCI_DeviceFeatures->Relative_Card_Address) & AT91C_SR_READY_FOR_DATA) != AT91C_SR_READY_FOR_DATA)
return AT91C_WRITE_ERROR;
if ( (dest + sizeToWrite) > pMCI_Device->pMCI_DeviceFeatures->Memory_Capacity )
return AT91C_WRITE_ERROR;
// If source does not fit a begin of a block
if ( (dest % pMCI_Device->pMCI_DeviceFeatures->Max_Read_DataBlock_Length) != 0 )
return AT91C_WRITE_ERROR;
// Test if the MMC supports Partial Write Block
if( (sizeToWrite < pMCI_Device->pMCI_DeviceFeatures->Max_Write_DataBlock_Length)
&& (pMCI_Device->pMCI_DeviceFeatures->Write_Partial == 0x00) )
return AT91C_WRITE_ERROR;
if( sizeToWrite > pMCI_Device->pMCI_DeviceFeatures->Max_Write_DataBlock_Length )
return AT91C_WRITE_ERROR;
////////////////////////////////////////////////////////////////////////////////////////////
// Init Mode Register
AT91C_BASE_MCI->MCI_MR |= ((pMCI_Device->pMCI_DeviceFeatures->Max_Write_DataBlock_Length << 16) | AT91C_MCI_PDCMODE);
if (sizeToWrite %4)
sizeToWrite = (sizeToWrite /4)+1;
else
sizeToWrite = sizeToWrite/4;
// Init PDC for write sequence
AT91C_BASE_PDC_MCI->PDC_PTCR = (AT91C_PDC_TXTDIS | AT91C_PDC_RXTDIS);
AT91C_BASE_PDC_MCI->PDC_TPR = (unsigned int) dataBuffer;
AT91C_BASE_PDC_MCI->PDC_TCR = sizeToWrite;
// Send the write single block command
if ( AT91F_MCI_SendCommand(pMCI_Device, AT91C_WRITE_BLOCK_CMD, dest) != AT91C_CMD_SEND_OK)
return AT91C_WRITE_ERROR;
pMCI_Device->pMCI_DeviceDesc->state = AT91C_MCI_TX_SINGLE_BLOCK;
// Enable AT91C_MCI_TXBUFE Interrupt
AT91C_BASE_MCI->MCI_IER = AT91C_MCI_TXBUFE;
// Enables TX for PDC transfert requests
AT91C_BASE_PDC_MCI->PDC_PTCR = AT91C_PDC_TXTEN;
return AT91C_WRITE_OK;
}
#endif
#ifdef MMC
//*------------------------------------------------------------------------------------------------------------
//* \fn AT91F_MCI_MMC_SelectCard
//* \brief Toggles a card between the Stand_by and Transfer states or between Programming and Disconnect states
//*------------------------------------------------------------------------------------------------------------
int AT91F_MCI_MMC_SelectCard(AT91PS_MciDevice pMCI_Device, unsigned int relative_card_address)
{
int status;
//* Check if the MMC card chosen is already the selected one
status = AT91F_MCI_GetStatus(pMCI_Device,relative_card_address);
if (status < 0)
return AT91C_CARD_SELECTED_ERROR;
if ((status & AT91C_SR_CARD_SELECTED) == AT91C_SR_CARD_SELECTED)
return AT91C_CARD_SELECTED_OK;
//* Search for the MMC Card to be selected, status = the Corresponding Device Number
status = 0;
while( (pMCI_Device->pMCI_DeviceFeatures[status].Relative_Card_Address != relative_card_address)
&& (status < AT91C_MAX_MCI_CARDS) )
status++;
if (status > AT91C_MAX_MCI_CARDS)
return AT91C_CARD_SELECTED_ERROR;
if (AT91F_MCI_SendCommand( pMCI_Device,
AT91C_SEL_DESEL_CARD_CMD,
pMCI_Device->pMCI_DeviceFeatures[status].Relative_Card_Address << 16) == AT91C_CMD_SEND_OK)
return AT91C_CARD_SELECTED_OK;
return AT91C_CARD_SELECTED_ERROR;
}
#endif
//*----------------------------------------------------------------------------
//* \fn AT91F_MCI_GetCSD
//* \brief Asks to the specified card to send its CSD
//*----------------------------------------------------------------------------
int AT91F_MCI_GetCSD (AT91PS_MciDevice pMCI_Device, unsigned int relative_card_address , unsigned int * response)
{
if(AT91F_MCI_SendCommand(pMCI_Device,
AT91C_SEND_CSD_CMD,
(relative_card_address << 16)) != AT91C_CMD_SEND_OK)
return AT91C_CMD_SEND_ERROR;
response[0] = AT91C_BASE_MCI->MCI_RSPR[0];
response[1] = AT91C_BASE_MCI->MCI_RSPR[1];
response[2] = AT91C_BASE_MCI->MCI_RSPR[2];
response[3] = AT91C_BASE_MCI->MCI_RSPR[3];
return AT91C_CMD_SEND_OK;
}
//*----------------------------------------------------------------------------
//* \fn AT91F_MCI_SetBlocklength
//* \brief Select a block length for all following block commands (R/W)
//*----------------------------------------------------------------------------
int AT91F_MCI_SetBlocklength(AT91PS_MciDevice pMCI_Device,unsigned int length)
{
return( AT91F_MCI_SendCommand(pMCI_Device, AT91C_SET_BLOCKLEN_CMD, length) );
}
#ifdef MMC
//*----------------------------------------------------------------------------
//* \fn AT91F_MCI_MMC_GetAllOCR
//* \brief Asks to all cards to send their operations conditions
//*----------------------------------------------------------------------------
int AT91F_MCI_MMC_GetAllOCR (AT91PS_MciDevice pMCI_Device)
{
unsigned int response =0x0;
while(1)
{
response = AT91F_MCI_SendCommand(pMCI_Device,
AT91C_MMC_SEND_OP_COND_CMD,
AT91C_MMC_HOST_VOLTAGE_RANGE);
if (response != AT91C_CMD_SEND_OK)
return AT91C_INIT_ERROR;
response = AT91C_BASE_MCI->MCI_RSPR[0];
if ( (response & AT91C_CARD_POWER_UP_BUSY) == AT91C_CARD_POWER_UP_BUSY)
return(response);
}
}
#endif
#ifdef MMC
//*----------------------------------------------------------------------------
//* \fn AT91F_MCI_MMC_GetAllCID
//* \brief Asks to the MMC on the chosen slot to send its CID
//*----------------------------------------------------------------------------
int AT91F_MCI_MMC_GetAllCID (AT91PS_MciDevice pMCI_Device, unsigned int *response)
{
int Nb_Cards_Found=-1;
while(1)
{
if(AT91F_MCI_SendCommand(pMCI_Device,
AT91C_MMC_ALL_SEND_CID_CMD,
AT91C_NO_ARGUMENT) != AT91C_CMD_SEND_OK)
return Nb_Cards_Found;
else
{
Nb_Cards_Found = 0;
//* Assignation of the relative address to the MMC CARD
pMCI_Device->pMCI_DeviceFeatures[Nb_Cards_Found].Relative_Card_Address = Nb_Cards_Found + AT91C_FIRST_RCA;
//* Set the insert flag
pMCI_Device->pMCI_DeviceFeatures[Nb_Cards_Found].Card_Inserted = AT91C_MMC_CARD_INSERTED;
if (AT91F_MCI_SendCommand(pMCI_Device,
AT91C_MMC_SET_RELATIVE_ADDR_CMD,
(Nb_Cards_Found + AT91C_FIRST_RCA) << 16) != AT91C_CMD_SEND_OK)
return AT91C_CMD_SEND_ERROR;
//* If no error during assignation address ==> Increment Nb_cards_Found
Nb_Cards_Found++ ;
}
}
}
#endif
#ifdef MMC
//*----------------------------------------------------------------------------
//* \fn AT91F_MCI_MMC_Init
//* \brief Return the MMC initialisation status
//*----------------------------------------------------------------------------
int AT91F_MCI_MMC_Init (AT91PS_MciDevice pMCI_Device)
{
unsigned int tab_response[4];
unsigned int mult,blocknr;
unsigned int i,Nb_Cards_Found=0;
//* Resets all MMC Cards in Idle state
AT91F_MCI_SendCommand(pMCI_Device, AT91C_MMC_GO_IDLE_STATE_CMD, AT91C_NO_ARGUMENT);
if(AT91F_MCI_MMC_GetAllOCR(pMCI_Device) == AT91C_INIT_ERROR)
return AT91C_INIT_ERROR;
Nb_Cards_Found = AT91F_MCI_MMC_GetAllCID(pMCI_Device,tab_response);
if (Nb_Cards_Found != AT91C_CMD_SEND_ERROR)
{
//* Set the Mode Register
AT91C_BASE_MCI->MCI_MR = AT91C_MCI_MR_PDCMODE;
for(i = 0; i < Nb_Cards_Found; i++)
{
if (AT91F_MCI_GetCSD(pMCI_Device,
pMCI_Device->pMCI_DeviceFeatures[i].Relative_Card_Address,
tab_response) != AT91C_CMD_SEND_OK)
pMCI_Device->pMCI_DeviceFeatures[i].Relative_Card_Address = 0;
else
{
pMCI_Device->pMCI_DeviceFeatures[i].Max_Read_DataBlock_Length = 1 << ((tab_response[1] >> AT91C_CSD_RD_B_LEN_S) & AT91C_CSD_RD_B_LEN_M );
pMCI_Device->pMCI_DeviceFeatures[i].Max_Write_DataBlock_Length = 1 << ((tab_response[3] >> AT91C_CSD_WBLEN_S) & AT91C_CSD_WBLEN_M );
pMCI_Device->pMCI_DeviceFeatures[i].Sector_Size = 1 + ((tab_response[2] >> AT91C_CSD_v22_SECT_SIZE_S) & AT91C_CSD_v22_SECT_SIZE_M );
pMCI_Device->pMCI_DeviceFeatures[i].Read_Partial = (tab_response[1] >> AT91C_CSD_RD_B_PAR_S) & AT91C_CSD_RD_B_PAR_M;
pMCI_Device->pMCI_DeviceFeatures[i].Write_Partial = (tab_response[3] >> AT91C_CSD_WBLOCK_P_S) & AT91C_CSD_WBLOCK_P_M;
// None in MMC specification version 2.2
pMCI_Device->pMCI_DeviceFeatures[i].Erase_Block_Enable = 0;
pMCI_Device->pMCI_DeviceFeatures[i].Read_Block_Misalignment = (tab_response[1] >> AT91C_CSD_RD_B_MIS_S) & AT91C_CSD_RD_B_MIS_M;
pMCI_Device->pMCI_DeviceFeatures[i].Write_Block_Misalignment = (tab_response[1] >> AT91C_CSD_WR_B_MIS_S) & AT91C_CSD_WR_B_MIS_M;
//// Compute Memory Capacity
// compute MULT
mult = 1 << ( ((tab_response[2] >> AT91C_CSD_C_SIZE_M_S) & AT91C_CSD_C_SIZE_M_M) + 2 );
// compute MSB of C_SIZE
blocknr = ((tab_response[1] >> AT91C_CSD_CSIZE_H_S) & AT91C_CSD_CSIZE_H_M) << 2;
// compute MULT * (LSB of C-SIZE + MSB already computed + 1) = BLOCKNR
blocknr = mult * ( ( blocknr + ( (tab_response[2] >> AT91C_CSD_CSIZE_L_S) & AT91C_CSD_CSIZE_L_M) ) + 1 );
pMCI_Device->pMCI_DeviceFeatures[i].Memory_Capacity = pMCI_Device->pMCI_DeviceFeatures[i].Max_Read_DataBlock_Length * blocknr;
//// End of Compute Memory Capacity
} // end of else
} // end of for
return AT91C_INIT_OK;
} // end of if
return AT91C_INIT_ERROR;
}
#endif
//*----------------------------------------------------------------------------
//* \fn AT91F_MCI_SDCard_GetOCR
//* \brief Asks to all cards to send their operations conditions
//*----------------------------------------------------------------------------
int AT91F_MCI_SDCard_GetOCR (AT91PS_MciDevice pMCI_Device)
{
unsigned int response =0x0;
// The RCA to be used for CMD55 in Idle state shall be the card's default RCA=0x0000.
pMCI_Device->pMCI_DeviceFeatures->Relative_Card_Address = 0x0;
while( (response & AT91C_CARD_POWER_UP_BUSY) != AT91C_CARD_POWER_UP_BUSY )
{
response = AT91F_MCI_SDCard_SendAppCommand(pMCI_Device,
AT91C_SDCARD_APP_OP_COND_CMD,
AT91C_MMC_HOST_VOLTAGE_RANGE);
if (response != AT91C_CMD_SEND_OK)
return AT91C_INIT_ERROR;
response = AT91C_BASE_MCI->MCI_RSPR[0];
}
return(AT91C_BASE_MCI->MCI_RSPR[0]);
}
//*----------------------------------------------------------------------------
//* \fn AT91F_MCI_SDCard_GetCID
//* \brief Asks to the SDCard on the chosen slot to send its CID
//*----------------------------------------------------------------------------
int AT91F_MCI_SDCard_GetCID (AT91PS_MciDevice pMCI_Device, unsigned int *response)
{
if(AT91F_MCI_SendCommand(pMCI_Device,
AT91C_ALL_SEND_CID_CMD,
AT91C_NO_ARGUMENT) != AT91C_CMD_SEND_OK)
return AT91C_CMD_SEND_ERROR;
response[0] = AT91C_BASE_MCI->MCI_RSPR[0];
response[1] = AT91C_BASE_MCI->MCI_RSPR[1];
response[2] = AT91C_BASE_MCI->MCI_RSPR[2];
response[3] = AT91C_BASE_MCI->MCI_RSPR[3];
return AT91C_CMD_SEND_OK;
}
//*----------------------------------------------------------------------------
//* \fn AT91F_MCI_SDCard_SetBusWidth
//* \brief Set bus width for SDCard
//*----------------------------------------------------------------------------
int AT91F_MCI_SDCard_SetBusWidth(AT91PS_MciDevice pMCI_Device)
{
volatile int ret_value;
char bus_width;
do
{
ret_value =AT91F_MCI_GetStatus(pMCI_Device,pMCI_Device->pMCI_DeviceFeatures->Relative_Card_Address);
}
while((ret_value > 0) && ((ret_value & AT91C_SR_READY_FOR_DATA) == 0));
// Select Card
AT91F_MCI_SendCommand(pMCI_Device,
AT91C_SEL_DESEL_CARD_CMD,
(pMCI_Device->pMCI_DeviceFeatures->Relative_Card_Address)<<16);
// Set bus width for Sdcard
if(pMCI_Device->pMCI_DeviceDesc->SDCard_bus_width == AT91C_MCI_SCDBUS)
bus_width = AT91C_BUS_WIDTH_4BITS;
else bus_width = AT91C_BUS_WIDTH_1BIT;
if (AT91F_MCI_SDCard_SendAppCommand(pMCI_Device,AT91C_SDCARD_SET_BUS_WIDTH_CMD,bus_width) != AT91C_CMD_SEND_OK)
return AT91C_CMD_SEND_ERROR;
return AT91C_CMD_SEND_OK;
}
//*----------------------------------------------------------------------------
//* \fn AT91F_MCI_SDCard_Init
//* \brief Return the SDCard initialisation status
//*----------------------------------------------------------------------------
int AT91F_MCI_SDCard_Init (AT91PS_MciDevice pMCI_Device)
{
unsigned int tab_response[4];
unsigned int mult,blocknr;
AT91F_MCI_SendCommand(pMCI_Device, AT91C_GO_IDLE_STATE_CMD, AT91C_NO_ARGUMENT);
if(AT91F_MCI_SDCard_GetOCR(pMCI_Device) == AT91C_INIT_ERROR)
return AT91C_INIT_ERROR;
if (AT91F_MCI_SDCard_GetCID(pMCI_Device,tab_response) == AT91C_CMD_SEND_OK)
{
pMCI_Device->pMCI_DeviceFeatures->Card_Inserted = AT91C_SD_CARD_INSERTED;
if (AT91F_MCI_SendCommand(pMCI_Device, AT91C_SET_RELATIVE_ADDR_CMD, 0) == AT91C_CMD_SEND_OK)
{
pMCI_Device->pMCI_DeviceFeatures->Relative_Card_Address = (AT91C_BASE_MCI->MCI_RSPR[0] >> 16);
if (AT91F_MCI_GetCSD(pMCI_Device,pMCI_Device->pMCI_DeviceFeatures->Relative_Card_Address,tab_response) == AT91C_CMD_SEND_OK)
{
pMCI_Device->pMCI_DeviceFeatures->Max_Read_DataBlock_Length = 1 << ((tab_response[1] >> AT91C_CSD_RD_B_LEN_S) & AT91C_CSD_RD_B_LEN_M );
pMCI_Device->pMCI_DeviceFeatures->Max_Write_DataBlock_Length = 1 << ((tab_response[3] >> AT91C_CSD_WBLEN_S) & AT91C_CSD_WBLEN_M );
pMCI_Device->pMCI_DeviceFeatures->Sector_Size = 1 + ((tab_response[2] >> AT91C_CSD_v21_SECT_SIZE_S) & AT91C_CSD_v21_SECT_SIZE_M );
pMCI_Device->pMCI_DeviceFeatures->Read_Partial = (tab_response[1] >> AT91C_CSD_RD_B_PAR_S) & AT91C_CSD_RD_B_PAR_M;
pMCI_Device->pMCI_DeviceFeatures->Write_Partial = (tab_response[3] >> AT91C_CSD_WBLOCK_P_S) & AT91C_CSD_WBLOCK_P_M;
pMCI_Device->pMCI_DeviceFeatures->Erase_Block_Enable = (tab_response[3] >> AT91C_CSD_v21_ER_BLEN_EN_S) & AT91C_CSD_v21_ER_BLEN_EN_M;
pMCI_Device->pMCI_DeviceFeatures->Read_Block_Misalignment = (tab_response[1] >> AT91C_CSD_RD_B_MIS_S) & AT91C_CSD_RD_B_MIS_M;
pMCI_Device->pMCI_DeviceFeatures->Write_Block_Misalignment = (tab_response[1] >> AT91C_CSD_WR_B_MIS_S) & AT91C_CSD_WR_B_MIS_M;
//// Compute Memory Capacity
// compute MULT
mult = 1 << ( ((tab_response[2] >> AT91C_CSD_C_SIZE_M_S) & AT91C_CSD_C_SIZE_M_M) + 2 );
// compute MSB of C_SIZE
blocknr = ((tab_response[1] >> AT91C_CSD_CSIZE_H_S) & AT91C_CSD_CSIZE_H_M) << 2;
// compute MULT * (LSB of C-SIZE + MSB already computed + 1) = BLOCKNR
blocknr = mult * ( ( blocknr + ( (tab_response[2] >> AT91C_CSD_CSIZE_L_S) & AT91C_CSD_CSIZE_L_M) ) + 1 );
pMCI_Device->pMCI_DeviceFeatures->Memory_Capacity = pMCI_Device->pMCI_DeviceFeatures->Max_Read_DataBlock_Length * blocknr;
//// End of Compute Memory Capacity
printf("SD-Card: %d Bytes\n\r", pMCI_Device->pMCI_DeviceFeatures->Memory_Capacity);
if( AT91F_MCI_SDCard_SetBusWidth(pMCI_Device) == AT91C_CMD_SEND_OK )
{
if (AT91F_MCI_SetBlocklength(pMCI_Device,pMCI_Device->pMCI_DeviceFeatures->Max_Read_DataBlock_Length) == AT91C_CMD_SEND_OK)
return AT91C_INIT_OK;
}
}
}
}
return AT91C_INIT_ERROR;
}
//*----------------------------------------------------------------------------
//* \fn AT91F_CfgDevice
//* \brief This function is used to initialise MMC or SDCard Features
//*----------------------------------------------------------------------------
void AT91F_CfgDevice(void)
{
// Init Device Structure
MCI_Device_Features.Relative_Card_Address = 0;
MCI_Device_Features.Card_Inserted = AT91C_CARD_REMOVED;
MCI_Device_Features.Max_Read_DataBlock_Length = 0;
MCI_Device_Features.Max_Write_DataBlock_Length = 0;
MCI_Device_Features.Read_Partial = 0;
MCI_Device_Features.Write_Partial = 0;
MCI_Device_Features.Erase_Block_Enable = 0;
MCI_Device_Features.Sector_Size = 0;
MCI_Device_Features.Memory_Capacity = 0;
MCI_Device_Desc.state = AT91C_MCI_IDLE;
MCI_Device_Desc.SDCard_bus_width = AT91C_MCI_SCDBUS;
// Init AT91S_DataFlash Global Structure, by default AT45DB choosen !!!
MCI_Device.pMCI_DeviceDesc = &MCI_Device_Desc;
MCI_Device.pMCI_DeviceFeatures = &MCI_Device_Features;
}
//*----------------------------------------------------------------------------
//* \fn AT91F_MCI_Init
//* \brief Initialsise Card
//*----------------------------------------------------------------------------
int AT91F_MCI_Init(void)
{
///////////////////////////////////////////////////////////////////////////////////////////
// MCI Init : common to MMC and SDCard
///////////////////////////////////////////////////////////////////////////////////////////
// Set up PIO SDC_TYPE to switch on MMC/SDCard and not DataFlash Card
AT91F_PIO_CfgOutput(AT91C_BASE_PIOB,AT91C_PIO_PB7);
AT91F_PIO_SetOutput(AT91C_BASE_PIOB,AT91C_PIO_PB7);
// Init MCI for MMC and SDCard interface
AT91F_MCI_CfgPIO();
AT91F_MCI_CfgPMC();
AT91F_PDC_Open(AT91C_BASE_PDC_MCI);
// Disable all the interrupts
AT91C_BASE_MCI->MCI_IDR = 0xFFFFFFFF;
// Init MCI Device Structures
AT91F_CfgDevice();
// Configure MCI interrupt
AT91F_AIC_ConfigureIt(AT91C_BASE_AIC,
AT91C_ID_MCI,
AT91C_AIC_PRIOR_HIGHEST,
AT91C_AIC_SRCTYPE_INT_LEVEL_SENSITIVE,
AT91F_ASM_MCI_Handler);
// Enable MCI interrupt
AT91F_AIC_EnableIt(AT91C_BASE_AIC,AT91C_ID_MCI);
// Enable Receiver
AT91F_US_EnableRx((AT91PS_USART) AT91C_BASE_DBGU);
AT91F_MCI_Configure(AT91C_BASE_MCI,
AT91C_MCI_DTOR_1MEGA_CYCLES,
AT91C_MCI_MR_PDCMODE, // 15MHz for MCK = 60MHz (CLKDIV = 1)
AT91C_MCI_SDCARD_4BITS_SLOTA);
if(AT91F_MCI_SDCard_Init(&MCI_Device) != AT91C_INIT_OK)
return FALSE;
else
return TRUE;
}
//*----------------------------------------------------------------------------
//* \fn AT91F_MCIDeviceWaitReady
//* \brief Wait for MCI Device ready
//*----------------------------------------------------------------------------
void AT91F_MCIDeviceWaitReady(unsigned int timeout)
{
volatile int status;
do
{
status = AT91C_BASE_MCI->MCI_SR;
timeout--;
}
while( !(status & AT91C_MCI_NOTBUSY) && (timeout>0) );
}
unsigned int swab32(unsigned int data)
{
unsigned int res = 0;
res = (data & 0x000000ff) << 24 |
(data & 0x0000ff00) << 8 |
(data & 0x00ff0000) >> 8 |
(data & 0xff000000) >> 24;
return res;
}
//*--------------------------------------------------------------------
//* \fn AT91F_MCI_ReadBlockSwab
//* \brief Read Block and swap byte order
//*--------------------------------------------------------------------
int AT91F_MCI_ReadBlockSwab(
AT91PS_MciDevice pMCI_Device,
int src,
unsigned int *databuffer,
int sizeToRead)
{
int i;
unsigned char *buf = (unsigned char *)databuffer;
//* Read Block 1
for(i=0;i<BUFFER_SIZE_MCI_DEVICE;i++)
*buf++ = 0x00;
AT91F_MCI_ReadBlock(&MCI_Device,src,databuffer,sizeToRead);
//* Wait end of Read
AT91F_MCIDeviceWaitReady(AT91C_MCI_TIMEOUT);
{
int index;
unsigned int *uiBuffer = databuffer;
for(index = 0; index < 512/4; index++)
uiBuffer[index] = swab32(uiBuffer[index]);
}
return(1);
}

View File

@ -1,18 +0,0 @@
#include <stdarg.h>
#include <stdbool.h>
#ifndef NULL
#define NULL ((void *)0)
#endif
void at91_init_uarts(void);
int puts(const char *str);
int putc(int c);
int putchar(int c);
int getc();
int strlen(const char *str);
int hvfprintf(const char *fmt, va_list ap);
int printf(const char *fmt, ...);

View File

@ -1,49 +0,0 @@
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=u-boot
PKG_VERSION:=1.1.4
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=ftp://ftp.denx.de/pub/u-boot
PKG_MD5SUM:=
PKG_CAT:=bzcat
include $(INCLUDE_DIR)/package.mk
UBOOT_CONFIG=$(strip $(subst ",, $(CONFIG_UBOOT_TARGET)))
LAN_IP=$(strip $(CONFIG_UBOOT_IPADDR))
LAN_SERVERIP=$(strip $(subst ",, $(CONFIG_UBOOT_SERVERIP)))
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) $(UBOOT_CONFIG)_config
export CROSS_COMPILE=$(TARGET_CROSS); \
export LAN_IP=$(LAN_IP); \
export LAN_SERVERIP=$(LAN_SERVERIP); \
$(MAKE) -C $(PKG_BUILD_DIR)
mkdir -p $(PKG_BUILD_DIR)/ubclient
$(CP) ./ubclient/* $(PKG_BUILD_DIR)/ubclient
export LAN_IP=$(LAN_IP); \
export LAN_SERVERIP=$(LAN_SERVERIP); \
$(MAKE) -C $(PKG_BUILD_DIR)/ubclient \
$(TARGET_CONFIGURE_OPTS) \
CFLAGS="$(TARGET_CFLAGS) -Dtarget_$(BOARD)=1"
endef
define Build/InstallDev
dd if=$(PKG_BUILD_DIR)/u-boot.bin of=$(PKG_BUILD_DIR)/u-boot.block bs=232k count=1 conv=sync
# $(INSTALL_DIR) $(STAGING_DIR)/ubclient/sbin
# $(INSTALL_BIN) $(PKG_BUILD_DIR)/ubclient/ubpar $(STAGING_DIR)/ubclient/sbin/
$(CP) $(PKG_BUILD_DIR)/ubclient/ubpar ../../base-files/sbin
endef
$(eval $(call Build/DefaultTargets))

View File

@ -1,91 +0,0 @@
--- u-boot-1.1.4/cpu/arm920t/config.mk 2005-12-16 17:39:27.000000000 +0100
+++ u-boot-1.1.4.klaus/cpu/arm920t/config.mk 2006-02-27 19:07:41.000000000 +0100
@@ -30,5 +30,5 @@
# Supply options according to compiler version
#
# =========================================================================
-PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32)
PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
--- u-boot-1.1.4/cpu/arm920t/start.S 2005-12-16 17:39:27.000000000 +0100
+++ u-boot-1.1.4.klaus/cpu/arm920t/start.S 2006-02-22 16:45:24.000000000 +0100
@@ -237,6 +237,7 @@
*/
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
cpu_init_crit:
/*
* flush v4 I/D caches
@@ -265,6 +266,7 @@
mov lr, ip
mov pc, lr
+#endif
/*
*************************************************************************
--- u-boot-1.1.4/examples/Makefile 2005-12-16 17:39:27.000000000 +0100
+++ u-boot-1.1.4.klaus/examples/Makefile 2006-03-02 02:37:14.000000000 +0100
@@ -30,7 +30,7 @@
endif
ifeq ($(ARCH),arm)
-LOAD_ADDR = 0xc100000
+LOAD_ADDR = 0x21000000
endif
ifeq ($(ARCH),mips)
--- u-boot-1.1.4/include/config.h 1970-01-01 01:00:00.000000000 +0100
+++ u-boot-1.1.4.klaus/include/config.h 2006-02-27 19:04:46.000000000 +0100
@@ -0,0 +1,2 @@
+/* Automatically generated - do not edit */
+#include <configs/at91rm9200dk.h>
--- u-boot-1.1.4/include/config.mk 1970-01-01 01:00:00.000000000 +0100
+++ u-boot-1.1.4.klaus/include/config.mk 2006-02-27 19:04:46.000000000 +0100
@@ -0,0 +1,4 @@
+ARCH = arm
+CPU = arm920t
+BOARD = at91rm9200dk
+SOC = at91rm9200
--- u-boot-1.1.4/include/configs/at91rm9200dk.h 2005-12-16 17:39:27.000000000 +0100
+++ u-boot-1.1.4.klaus/include/configs/at91rm9200dk.h 2006-02-26 22:44:17.000000000 +0100
@@ -25,6 +25,11 @@
#ifndef __CONFIG_H
#define __CONFIG_H
+// Added 2 defines to skip re-init lowlevel and relocate HCG HLH
+//
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
/* ARM asynchronous clock */
#define AT91C_MAIN_CLOCK 179712000 /* from 18.432 MHz crystal (18432000 / 4 * 39) */
#define AT91C_MASTER_CLOCK 59904000 /* peripheral clock (AT91C_MASTER_CLOCK / 3) */
@@ -165,12 +170,12 @@
#define CFG_FLASH_ERASE_TOUT (2*CFG_HZ) /* Timeout for Flash Erase */
#define CFG_FLASH_WRITE_TOUT (2*CFG_HZ) /* Timeout for Flash Write */
-#undef CFG_ENV_IS_IN_DATAFLASH
+#define CFG_ENV_IS_IN_DATAFLASH
#ifdef CFG_ENV_IS_IN_DATAFLASH
-#define CFG_ENV_OFFSET 0x20000
+#define CFG_ENV_OFFSET 0x21000
#define CFG_ENV_ADDR (CFG_DATAFLASH_LOGIC_ADDR_CS0 + CFG_ENV_OFFSET)
-#define CFG_ENV_SIZE 0x2000 /* 0x8000 */
+#define CFG_ENV_SIZE 0x8400 /* 0x8000 */
#else
#define CFG_ENV_IS_IN_FLASH 1
#ifdef CONFIG_SKIP_LOWLEVEL_INIT
--- u-boot-1.1.4/Makefile 2005-12-16 17:39:27.000000000 +0100
+++ u-boot-1.1.4.klaus/Makefile 2006-03-02 02:49:23.000000000 +0100
@@ -57,7 +57,7 @@
CROSS_COMPILE = powerpc-linux-
endif
ifeq ($(ARCH),arm)
-CROSS_COMPILE = arm-linux-
+CROSS_COMPILE = ../staging_dir/bin/arm-linux-
endif
ifeq ($(ARCH),i386)
ifeq ($(HOSTARCH),i387)

View File

@ -1,14 +0,0 @@
--- u-boot-1.1.4.org/lib_arm/board.c 2006-06-05 12:36:22.000000000 +0200
+++ u-boot-1.1.4.tmp/lib_arm/board.c 2006-06-05 12:36:44.000000000 +0200
@@ -332,6 +332,11 @@
}
#endif /* CONFIG_DRIVER_SMC91111 || CONFIG_DRIVER_LAN91C96 */
+#ifdef CONFIG_MACH_VLINK
+ printf("Initialising MAC address\n\r");
+ eth_init(gd->bd);
+#endif
+
/* Initialize from environment */
if ((s = getenv ("loadaddr")) != NULL) {
load_addr = simple_strtoul (s, NULL, 16);

Some files were not shown because too many files have changed in this diff Show More