mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-25 06:13:56 +08:00
added bsp/evb4020
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1129 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
Executable
+2
@@ -0,0 +1,2 @@
|
||||
[EXTDLL]
|
||||
Count=0
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
/******************************************************************************/
|
||||
/* MEMORY.INI: Memory Debug Initialization File */
|
||||
/******************************************************************************/
|
||||
/* This file is part of the uVision/ARM development tools. */
|
||||
/* Copyright (c) 2005-2006 Keil Software. All rights reserved. */
|
||||
/* This software may only be used under the terms of a valid, current, */
|
||||
/* end user licence from KEIL for a compatible version of KEIL software */
|
||||
/* development tools. Nothing else gives you the right to use this software. */
|
||||
/******************************************************************************/
|
||||
RESET
|
||||
FUNC void InitEmi(void)
|
||||
{
|
||||
_WWORD(0x11000000,0x08a6a6a1);
|
||||
_WWORD(0x11000010,0x8cfffff1);
|
||||
_WWORD(0x11000018,0x1e104177);
|
||||
_WWORD(0x1100001C,0x80001860);
|
||||
_WWORD(0x11000020,0x0000000b);
|
||||
}
|
||||
InitEmi();
|
||||
Load %L INCREMENTAL;
|
||||
PC = 0x30000000;
|
||||
|
||||
|
||||
|
||||
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
[FLASH]
|
||||
SkipProgOnCRCMatch = 1
|
||||
VerifyDownload = 1
|
||||
AllowCaching = 1
|
||||
EnableFlashDL = 2
|
||||
Override = 0
|
||||
Device="ADUC7020X62"
|
||||
[BREAKPOINTS]
|
||||
ShowInfoWin = 1
|
||||
EnableFlashBP = 2
|
||||
BPDuringExecution = 0
|
||||
[CPU]
|
||||
OverrideMemMap = 0
|
||||
AllowSimulation = 1
|
||||
Executable
Executable
+25
@@ -0,0 +1,25 @@
|
||||
; *************************************************************
|
||||
; *** Scatter-Loading Description File generated by uVision ***
|
||||
; *************************************************************
|
||||
|
||||
; *************************************************************
|
||||
; *** Scatter-Loadig Description File generated by uVision ***n
|
||||
; *************************************************************
|
||||
|
||||
|
||||
LR_ROM1 0x30000000 0x0FFD00 ; load region size_region
|
||||
{
|
||||
ER_ROM1 0x30000000 0x0FFD00 ; load address = execution address
|
||||
{
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
}
|
||||
RW_RAM1 0x30100000 0x100000 ; RW data
|
||||
{
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
*** Creating Trace Output File 'evb4020.tra' Ok.
|
||||
### Preparing for ADS-LD.
|
||||
### Creating ADS-LD Command Line
|
||||
### List of Objects: adding '"startup.o"'
|
||||
### List of Objects: adding '".\context_rvds.o"'
|
||||
### List of Objects: adding '".\start_rvds.o"'
|
||||
### ADS-LD Command completed:
|
||||
--cpu ARM7TDMI "startup.o" ".\context_rvds.o" ".\start_rvds.o" --strict --scatter "evb4020.sct" ␍
|
||||
--autoat --summary_stderr --info summarysizes --map --xref --callgraph --symbols ␍
|
||||
--info sizes --info totals --info unused --info veneers ␍
|
||||
--list ".\evb4020.map" -o "evb4020.axf"### Preparing Environment (PrepEnvAds)
|
||||
### ADS-LD Output File: 'evb4020.axf'
|
||||
### ADS-LD Command File: 'evb4020.lnp'
|
||||
### Checking for dirty Components...
|
||||
### Creating CmdFile 'evb4020.lnp', Handle=0x000006D0
|
||||
### Writing '.lnp' file
|
||||
### ADS-LD Command file 'evb4020.lnp' is ready.
|
||||
### ADS-LD: About to start ADS-LD Thread.
|
||||
### ADS-LD: executed with 0 errors
|
||||
### Updating obj list
|
||||
### LDADS_file() completed.
|
||||
Executable
+4492
File diff suppressed because one or more lines are too long
Executable
+939
File diff suppressed because it is too large
Load Diff
Executable
+1
@@ -0,0 +1 @@
|
||||
Dependencies for Project 'evb4020', Target 'Target 1': (DO NOT MODIFY !)
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
; *************************************************************
|
||||
; *** Scatter-Loading Description File generated by uVision ***
|
||||
; *************************************************************
|
||||
|
||||
LR_ROM1 0x20000200 0x0FFD00 ; load region size_region
|
||||
{
|
||||
ER_ROM1 0x20000200 0x0FFD00 ; load address = execution address
|
||||
{
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
}
|
||||
RW_RAM1 0x30100000 0x080000 ; RW data
|
||||
{
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+4492
File diff suppressed because one or more lines are too long
Executable
+939
File diff suppressed because it is too large
Load Diff
Executable
+154
@@ -0,0 +1,154 @@
|
||||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1>µVision Build Log</h1>
|
||||
<h2>Project:</h2>
|
||||
F:\rtt\bsp\evb4020\evb4020.uvproj
|
||||
Project File Date: 10/26/2010
|
||||
|
||||
<h2>Output:</h2>
|
||||
Build target 'EVB4020'
|
||||
compiling startup.c...
|
||||
compiling application.c...
|
||||
compiling export.c...
|
||||
compiling clock.c...
|
||||
compiling device.c...
|
||||
compiling idle.c...
|
||||
compiling ipc.c...
|
||||
compiling irq.c...
|
||||
compiling kservice.c...
|
||||
compiling mem.c...
|
||||
compiling mempool.c...
|
||||
compiling object.c...
|
||||
compiling scheduler.c...
|
||||
compiling slab.c...
|
||||
compiling thread.c...
|
||||
compiling timer.c...
|
||||
assembling context_rvds.S...
|
||||
assembling start_rvds.S...
|
||||
compiling stack.c...
|
||||
compiling trap.c...
|
||||
compiling interrupt.c...
|
||||
compiling cpu.c...
|
||||
..\..\libcpu\arm\sep4020\cpu.c(21): warning: #1215-D: #warning directive: I DON'T KNOW IF THE MMU OPERATION WORKS ON SEP4020
|
||||
..\..\libcpu\arm\sep4020\cpu.c: #warning I DON'T KNOW IF THE MMU OPERATION WORKS ON SEP4020
|
||||
..\..\libcpu\arm\sep4020\cpu.c: ^
|
||||
..\..\libcpu\arm\sep4020\cpu.c(187): warning: #236-D: controlling expression is constant
|
||||
..\..\libcpu\arm\sep4020\cpu.c: RT_ASSERT(RT_NULL);
|
||||
..\..\libcpu\arm\sep4020\cpu.c: ^
|
||||
..\..\libcpu\arm\sep4020\cpu.c: ..\..\libcpu\arm\sep4020\cpu.c: 2 warnings, 0 errors
|
||||
compiling board.c...
|
||||
compiling serial.c...
|
||||
compiling sdcard.c...
|
||||
src\sdcard.c(359): warning: #177-D: function "sd_readmultiblock" was declared but never referenced
|
||||
src\sdcard.c: static rt_uint8_t sd_readmultiblock(rt_uint32_t address, rt_uint8_t* buf,rt_uint32_t size)
|
||||
src\sdcard.c: ^
|
||||
src\sdcard.c: src\sdcard.c: 1 warning, 0 errors
|
||||
compiling dm9161.c...
|
||||
src\dm9161.c(363): warning: #1215-D: #warning directive: SHOULD SET MAC ADDR
|
||||
src\dm9161.c: #warning SHOULD SET MAC ADDR
|
||||
src\dm9161.c: ^
|
||||
src\dm9161.c(369): warning: #1215-D: #warning directive: SHOULD DETERMIN LINK SPEED
|
||||
src\dm9161.c: #warning SHOULD DETERMIN LINK SPEED
|
||||
src\dm9161.c: ^
|
||||
src\dm9161.c(487): warning: #1215-D: #warning directive: disable ether;
|
||||
src\dm9161.c: #warning disable ether;
|
||||
src\dm9161.c: ^
|
||||
src\dm9161.c(534): warning: #1215-D: #warning directive: SHOULD DISABLE INTEERUPT?
|
||||
src\dm9161.c: #warning SHOULD DISABLE INTEERUPT?
|
||||
src\dm9161.c: ^
|
||||
src\dm9161.c(563): warning: #1215-D: #warning directive: SHOULD NOTICE IT'S LENGTH
|
||||
src\dm9161.c: #warning SHOULD NOTICE IT'S LENGTH
|
||||
src\dm9161.c: ^
|
||||
src\dm9161.c(616): warning: #177-D: variable "len" was declared but never referenced
|
||||
src\dm9161.c: rt_int32_t len;
|
||||
src\dm9161.c: ^
|
||||
src\dm9161.c(664): warning: #1215-D: #warning directive: NOTICE:
|
||||
src\dm9161.c: #warning NOTICE:
|
||||
src\dm9161.c: ^
|
||||
src\dm9161.c(688): warning: #1215-D: #warning directive: TODO
|
||||
src\dm9161.c: #warning TODO
|
||||
src\dm9161.c: ^
|
||||
src\dm9161.c: src\dm9161.c: 8 warnings, 0 errors
|
||||
compiling backtrace.c...
|
||||
compiling div0.c...
|
||||
compiling showmem.c...
|
||||
compiling dfs.c...
|
||||
compiling dfs_file.c...
|
||||
compiling dfs_fs.c...
|
||||
compiling dfs_posix.c...
|
||||
compiling dfs_elm.c...
|
||||
compiling ff.c...
|
||||
compiling cmd.c...
|
||||
compiling finsh_compiler.c...
|
||||
compiling finsh_error.c...
|
||||
compiling finsh_heap.c...
|
||||
compiling finsh_init.c...
|
||||
compiling finsh_node.c...
|
||||
compiling finsh_ops.c...
|
||||
compiling finsh_parser.c...
|
||||
compiling finsh_token.c...
|
||||
compiling finsh_var.c...
|
||||
compiling finsh_vm.c...
|
||||
compiling shell.c...
|
||||
compiling symbol.c...
|
||||
compiling api_lib.c...
|
||||
compiling api_msg.c...
|
||||
compiling err.c...
|
||||
compiling netbuf.c...
|
||||
compiling netdb.c...
|
||||
compiling netifapi.c...
|
||||
compiling sockets.c...
|
||||
compiling tcpip.c...
|
||||
compiling sys_arch.c...
|
||||
compiling sys_arch_init.c...
|
||||
compiling dhcp.c...
|
||||
compiling dns.c...
|
||||
compiling init.c...
|
||||
compiling memp.c...
|
||||
compiling netif.c...
|
||||
compiling pbuf.c...
|
||||
compiling raw.c...
|
||||
compiling stats.c...
|
||||
compiling sys.c...
|
||||
compiling tcp.c...
|
||||
compiling tcp_in.c...
|
||||
compiling tcp_out.c...
|
||||
compiling udp.c...
|
||||
compiling autoip.c...
|
||||
compiling icmp.c...
|
||||
compiling igmp.c...
|
||||
compiling inet.c...
|
||||
compiling inet_chksum.c...
|
||||
compiling ip.c...
|
||||
compiling ip_addr.c...
|
||||
compiling ip_frag.c...
|
||||
compiling asn1_dec.c...
|
||||
compiling asn1_enc.c...
|
||||
compiling mib_structs.c...
|
||||
compiling mib2.c...
|
||||
compiling msg_in.c...
|
||||
compiling msg_out.c...
|
||||
compiling etharp.c...
|
||||
compiling ethernetif.c...
|
||||
compiling loopif.c...
|
||||
compiling slipif.c...
|
||||
compiling auth.c...
|
||||
compiling chap.c...
|
||||
compiling chpms.c...
|
||||
compiling fsm.c...
|
||||
compiling ipcp.c...
|
||||
compiling lcp.c...
|
||||
compiling magic.c...
|
||||
compiling md5.c...
|
||||
compiling pap.c...
|
||||
compiling ppp.c...
|
||||
compiling ppp_oe.c...
|
||||
compiling randm.c...
|
||||
compiling vj.c...
|
||||
compiling ping.c...
|
||||
linking...
|
||||
Program Size: Code=96692 RO-data=3264 RW-data=468 ZI-data=17844
|
||||
".\output\evb4020.axf" - 0 Error(s), 11 Warning(s).
|
||||
Clean started: Project: 'evb4020'
|
||||
deleting intermediate output files for target 'EVB4020'
|
||||
Executable
+121
File diff suppressed because one or more lines are too long
Executable
+126
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* File : application.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2007-11-20 Yi.Qiu add rtgui application
|
||||
* 2008-6-28 Bernard no rtgui init
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup mini2440
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
#include <board.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifdef RT_USING_DFS
|
||||
#include <dfs_init.h>
|
||||
#include <dfs_elm.h>
|
||||
#include <dfs_fs.h>
|
||||
#include <dfs_posix.h>
|
||||
#endif
|
||||
|
||||
static rt_uint8_t buf_init[0x200];
|
||||
static struct rt_thread thread_test;
|
||||
|
||||
|
||||
void rt_init_thread_entry(void* parameter)
|
||||
{
|
||||
int fd;
|
||||
rt_uint32_t sz;
|
||||
char buffer[20];
|
||||
#ifdef RT_USING_DFS
|
||||
dfs_init();
|
||||
#ifdef RT_USING_DFS_ELMFATFS
|
||||
elm_init();
|
||||
/* mount sd card fat partition 1 as root directory */
|
||||
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
|
||||
{
|
||||
rt_kprintf("File System initialized!\n");
|
||||
|
||||
/*Open a file*/
|
||||
fd = open("/fattest.txt", O_RDWR|O_CREAT, 0);
|
||||
if (fd < 0)
|
||||
{
|
||||
rt_kprintf("open file for write failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
sz = write(fd,"Hello RT-Thread!",sizeof("Hello RT-Thread!"));
|
||||
|
||||
if(sz!=0)
|
||||
{
|
||||
rt_kprintf("written %d\n",sz);
|
||||
}
|
||||
else
|
||||
rt_kprintf("haven't written\n");
|
||||
|
||||
|
||||
sz = read(fd,buffer,sizeof(buffer));
|
||||
|
||||
if(sz!=0)
|
||||
{
|
||||
rt_kprintf("READ %d:",sz);
|
||||
while(sz--)
|
||||
rt_kprintf("%c",buffer[sz]);//opposite
|
||||
}
|
||||
else
|
||||
rt_kprintf("haven't read\n");
|
||||
|
||||
close(fd);
|
||||
}
|
||||
else
|
||||
rt_kprintf("File System initialzation failed!\n");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void rt_led_thread_entry(void* parameter)
|
||||
{
|
||||
/*
|
||||
rt_uint32_t flag = 0;
|
||||
while(1)
|
||||
{
|
||||
//Add your led implemention here
|
||||
|
||||
rt_led_put(flag^0x01);
|
||||
rt_kprintf("rt led test %s\n",flag?"on":"off" );
|
||||
rt_thread_delay(100);
|
||||
|
||||
|
||||
} */
|
||||
//rt_thread_suspend(rt_thread_self());
|
||||
}
|
||||
|
||||
|
||||
int rt_application_init()
|
||||
{
|
||||
rt_thread_t led_thread;
|
||||
rt_err_t err;
|
||||
|
||||
err = rt_thread_init(&thread_test,"init",
|
||||
rt_init_thread_entry, RT_NULL,buf_init,
|
||||
sizeof(buf_init), 19, 20);
|
||||
|
||||
led_thread = rt_thread_create("led",
|
||||
rt_led_thread_entry, RT_NULL,
|
||||
512, 200, 20);
|
||||
|
||||
if(err == RT_EOK)
|
||||
rt_thread_startup(&thread_test);
|
||||
|
||||
if (led_thread != RT_NULL)
|
||||
rt_thread_startup(led_thread);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
Executable
+159
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* File : board.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009 RT-Thread Develop Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-05-16 Bernard first implementation
|
||||
* 2010-10-5 Wangmeng sep4020 implementation
|
||||
*/
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#include <sep4020.h>
|
||||
#include <serial.h>
|
||||
|
||||
void rt_hw_serial_putc(const char c);
|
||||
|
||||
#define UART0 ((struct uartport *)UART0_BASE)
|
||||
struct rt_device uart0_device;
|
||||
struct serial_int_rx uart0_int_rx;
|
||||
struct serial_device uart0 =
|
||||
{
|
||||
UART0,
|
||||
&uart0_int_rx,
|
||||
RT_NULL
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* This function will handle rtos timer
|
||||
*/
|
||||
void rt_timer_handler(int vector)
|
||||
{
|
||||
rt_uint32_t clear_int;
|
||||
rt_tick_increase();
|
||||
|
||||
/*Clear timer interrupt*/
|
||||
clear_int = *(RP)TIMER_T1ISCR;
|
||||
*(RP)TIMER_T1ISCR=clear_int;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will handle serial
|
||||
*/
|
||||
void rt_serial_handler(int vector)
|
||||
{
|
||||
//rt_kprintf("in rt_serial_handler\n");
|
||||
rt_int32_t stat = *(RP)UART0_IIR ;
|
||||
UNUSED char c;
|
||||
|
||||
/*Received data*/
|
||||
if(((stat & 0x0E) >> 1) == 0x02)
|
||||
{
|
||||
|
||||
rt_hw_serial_isr(&uart0_device);
|
||||
/*while (((*(RP)UART0_LSR) & 0x40))
|
||||
{
|
||||
c = (char)(*(RP)UART0_BASE);
|
||||
if(c == '\r')
|
||||
{
|
||||
rt_hw_serial_putc('\r');
|
||||
rt_hw_serial_putc('\n');
|
||||
}
|
||||
else
|
||||
rt_hw_serial_putc(c);
|
||||
} */
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/*clear the timeout interrupt*/
|
||||
while (uart0.uart_device->lsr & USTAT_RCV_READY)
|
||||
c = uart0.uart_device->dlbl_fifo.rxfifo;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will init timer4 for system ticks
|
||||
*/
|
||||
void rt_hw_timer_init()
|
||||
{
|
||||
/*Set timer1*/
|
||||
*(RP)TIMER_T1LCR = 880000;
|
||||
*(RP)TIMER_T1CR = 0x06;
|
||||
|
||||
rt_hw_interrupt_install(INTSRC_TIMER1, rt_timer_handler, RT_NULL);
|
||||
rt_hw_interrupt_umask(INTSRC_TIMER1);
|
||||
|
||||
/*Enable timer1*/
|
||||
*(RP)TIMER_T1CR |= 0x01;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will handle init uart
|
||||
*/
|
||||
void rt_hw_uart_init(void)
|
||||
{
|
||||
const rt_int32_t sysclk = 72000000;
|
||||
|
||||
/*Set data bit:8*/
|
||||
*(RP)(UART0_LCR) = 0x83;
|
||||
/*Set baud rate high*/
|
||||
*(RP)(UART0_DLBH) = (sysclk/16/115200) >> 8;
|
||||
/*Set baud rate low*/
|
||||
*(RP)(UART0_DLBL) = (sysclk/16/115200) & 0xff;
|
||||
|
||||
*(RP)(UART0_LCR) = 0x83&(~(0x1 << 7));
|
||||
|
||||
/*Set trigger level*/
|
||||
*(RP)(UART0_FCR) = 0x0;
|
||||
*(RP)(UART0_IER) = 0x0;
|
||||
|
||||
/*Enable rx interrupt*/
|
||||
*(RP)(UART0_IER) |= 0x01;
|
||||
/*Disable tx interrupt*/
|
||||
*(RP)(UART0_IER) &= ~(0x1<<1);
|
||||
|
||||
rt_hw_interrupt_install(INTSRC_UART0, rt_serial_handler, RT_NULL);
|
||||
rt_hw_interrupt_umask(INTSRC_UART0);
|
||||
|
||||
}
|
||||
|
||||
void rt_hw_board_init()
|
||||
{
|
||||
/* initialize uart */
|
||||
rt_hw_uart_init();
|
||||
rt_hw_timer_init();
|
||||
}
|
||||
|
||||
/* write one character to serial, must not trigger interrupt */
|
||||
void rt_hw_serial_putc(const char c)
|
||||
{
|
||||
/*
|
||||
to be polite with serial console add a line feed
|
||||
to the carriage return character
|
||||
*/
|
||||
if (c=='\n')rt_hw_serial_putc('\r');
|
||||
|
||||
while (!((*(RP)UART0_LSR) & 0x40));
|
||||
*(RP)(UART0_BASE) = c;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used by rt_kprintf to display a string on console.
|
||||
*
|
||||
* @param str the displayed string
|
||||
*/
|
||||
void rt_hw_console_output(const char* str)
|
||||
{
|
||||
while (*str)
|
||||
{
|
||||
rt_hw_serial_putc(*str++);
|
||||
}
|
||||
}
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* File : board.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2006-10-08 Bernard add board.h to this bsp
|
||||
* 2010-10-5 Wangmeng sep4020 implemention
|
||||
*/
|
||||
|
||||
#ifndef __BOARD_H__
|
||||
#define __BOARD_H__
|
||||
|
||||
#include <sep4020.h>
|
||||
|
||||
void rt_hw_board_init(void);
|
||||
void rt_hw_sdcard_init(void);
|
||||
|
||||
#endif
|
||||
Executable
+700
File diff suppressed because it is too large
Load Diff
Executable
+65
@@ -0,0 +1,65 @@
|
||||
#ifndef __DM9000_H__
|
||||
#define __DM9000_H__
|
||||
|
||||
/*MACRO DEFINATIONS*/
|
||||
|
||||
|
||||
#define SEP4020_ID_EMAC ((unsigned int) 28) // Ethernet Mac
|
||||
/* Davicom 9161 PHY */
|
||||
#define MII_DM9161_ID 0x0181b880
|
||||
#define MII_DM9161A_ID 0x0181b8a0
|
||||
|
||||
/* Davicom specific registers */
|
||||
#define MII_DSCR_REG 16
|
||||
#define MII_DSCSR_REG 17
|
||||
#define MII_DSINTR_REG 21
|
||||
|
||||
/* Intel LXT971A PHY */
|
||||
#define MII_LXT971A_ID 0x001378E0
|
||||
|
||||
/* Intel specific registers */
|
||||
#define MII_ISINTE_REG 18
|
||||
#define MII_ISINTS_REG 19
|
||||
#define MII_LEDCTRL_REG 20
|
||||
|
||||
/* Realtek RTL8201 PHY */
|
||||
#define MII_RTL8201_ID 0x00008200
|
||||
|
||||
/* Broadcom BCM5221 PHY */
|
||||
#define MII_BCM5221_ID 0x004061e0
|
||||
|
||||
/* Broadcom specific registers */
|
||||
#define MII_BCMINTR_REG 26
|
||||
|
||||
/* National Semiconductor DP83847 */
|
||||
#define MII_DP83847_ID 0x20005c30
|
||||
|
||||
/* Altima AC101L PHY */
|
||||
#define MII_AC101L_ID 0x00225520
|
||||
|
||||
/* Micrel KS8721 PHY */
|
||||
#define MII_KS8721_ID 0x00221610
|
||||
|
||||
/* ........................................................................ */
|
||||
|
||||
#define MAX_RBUFF_SZ 0x600 /* 1518 rounded up */
|
||||
#define MAX_RX_DESCR 20 /* max number of receive buffers */
|
||||
|
||||
#define MAX_TBUFF_SZ 0x600 /* 1518 rounded up */
|
||||
#define MAX_TX_DESCR 20 /* max number of receive buffers */
|
||||
|
||||
#define EMAC_DESC_DONE 0x00000001 /* bit for if DMA is done */
|
||||
#define EMAC_DESC_WRAP 0x00000002 /* bit for wrap */
|
||||
|
||||
#define EMAC_BROADCAST 0x80000000 /* broadcast address */
|
||||
#define EMAC_MULTICAST 0x40000000 /* multicast address */
|
||||
#define EMAC_UNICAST 0x20000000 /* unicast address */
|
||||
|
||||
#define DM9161_inb(r) (*(volatile rt_uint8_t *)r)
|
||||
#define DM9161_outb(r, d) (*(volatile rt_uint8_t *)r = d)
|
||||
#define DM9161_inw(r) (*(volatile rt_uint16_t *)r)
|
||||
#define DM9161_outw(r, d) (*(volatile rt_uint16_t *)r = d)
|
||||
|
||||
void rt_hw_dm9616_init(void);
|
||||
|
||||
#endif
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#include <rtthread.h>
|
||||
#include <finsh.h>
|
||||
|
||||
void testkkkk(void)
|
||||
{
|
||||
rt_kprintf("Hello wangmengmeng!\n");
|
||||
return;
|
||||
}
|
||||
FINSH_FUNCTION_EXPORT(testkkkk,a test);
|
||||
Executable
+130
@@ -0,0 +1,130 @@
|
||||
|
||||
#ifndef __MII_H__
|
||||
#define __MII_H__
|
||||
|
||||
/* Generic MII registers. */
|
||||
|
||||
#define MII_BMCR 0x00 /* Basic mode control register */
|
||||
#define MII_BMSR 0x01 /* Basic mode status register */
|
||||
#define MII_PHYSID1 0x02 /* PHYS ID 1 */
|
||||
#define MII_PHYSID2 0x03 /* PHYS ID 2 */
|
||||
#define MII_ADVERTISE 0x04 /* Advertisement control reg */
|
||||
#define MII_LPA 0x05 /* Link partner ability reg */
|
||||
#define MII_EXPANSION 0x06 /* Expansion register */
|
||||
#define MII_CTRL1000 0x09 /* 1000BASE-T control */
|
||||
#define MII_STAT1000 0x0a /* 1000BASE-T status */
|
||||
#define MII_ESTATUS 0x0f /* Extended Status */
|
||||
#define MII_DCOUNTER 0x12 /* Disconnect counter */
|
||||
#define MII_FCSCOUNTER 0x13 /* False carrier counter */
|
||||
#define MII_NWAYTEST 0x14 /* N-way auto-neg test reg */
|
||||
#define MII_RERRCOUNTER 0x15 /* Receive error counter */
|
||||
#define MII_SREVISION 0x16 /* Silicon revision */
|
||||
#define MII_RESV1 0x17 /* Reserved... */
|
||||
#define MII_LBRERROR 0x18 /* Lpback, rx, bypass error */
|
||||
#define MII_PHYADDR 0x19 /* PHY address */
|
||||
#define MII_RESV2 0x1a /* Reserved... */
|
||||
#define MII_TPISTATUS 0x1b /* TPI status for 10mbps */
|
||||
#define MII_NCONFIG 0x1c /* Network interface config */
|
||||
|
||||
/* Basic mode control register. */
|
||||
#define BMCR_RESV 0x003f /* Unused... */
|
||||
#define BMCR_SPEED1000 0x0040 /* MSB of Speed (1000) */
|
||||
#define BMCR_CTST 0x0080 /* Collision test */
|
||||
#define BMCR_FULLDPLX 0x0100 /* Full duplex */
|
||||
#define BMCR_ANRESTART 0x0200 /* Auto negotiation restart */
|
||||
#define BMCR_ISOLATE 0x0400 /* Disconnect DP83840 from MII */
|
||||
#define BMCR_PDOWN 0x0800 /* Powerdown the DP83840 */
|
||||
#define BMCR_ANENABLE 0x1000 /* Enable auto negotiation */
|
||||
#define BMCR_SPEED100 0x2000 /* Select 100Mbps */
|
||||
#define BMCR_LOOPBACK 0x4000 /* TXD loopback bits */
|
||||
#define BMCR_RESET 0x8000 /* Reset the DP83840 */
|
||||
|
||||
/* Basic mode status register. */
|
||||
#define BMSR_ERCAP 0x0001 /* Ext-reg capability */
|
||||
#define BMSR_JCD 0x0002 /* Jabber detected */
|
||||
#define BMSR_LSTATUS 0x0004 /* Link status */
|
||||
#define BMSR_ANEGCAPABLE 0x0008 /* Able to do auto-negotiation */
|
||||
#define BMSR_RFAULT 0x0010 /* Remote fault detected */
|
||||
#define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */
|
||||
#define BMSR_RESV 0x00c0 /* Unused... */
|
||||
#define BMSR_ESTATEN 0x0100 /* Extended Status in R15 */
|
||||
#define BMSR_100FULL2 0x0200 /* Can do 100BASE-T2 HDX */
|
||||
#define BMSR_100HALF2 0x0400 /* Can do 100BASE-T2 FDX */
|
||||
#define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */
|
||||
#define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */
|
||||
#define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */
|
||||
#define BMSR_100FULL 0x4000 /* Can do 100mbps, full-duplex */
|
||||
#define BMSR_100BASE4 0x8000 /* Can do 100mbps, 4k packets */
|
||||
|
||||
/* Advertisement control register. */
|
||||
#define ADVERTISE_SLCT 0x001f /* Selector bits */
|
||||
#define ADVERTISE_CSMA 0x0001 /* Only selector supported */
|
||||
#define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */
|
||||
#define ADVERTISE_1000XFULL 0x0020 /* Try for 1000BASE-X full-duplex */
|
||||
#define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */
|
||||
#define ADVERTISE_1000XHALF 0x0040 /* Try for 1000BASE-X half-duplex */
|
||||
#define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */
|
||||
#define ADVERTISE_1000XPAUSE 0x0080 /* Try for 1000BASE-X pause */
|
||||
#define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */
|
||||
#define ADVERTISE_1000XPSE_ASYM 0x0100 /* Try for 1000BASE-X asym pause */
|
||||
#define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */
|
||||
#define ADVERTISE_PAUSE_CAP 0x0400 /* Try for pause */
|
||||
#define ADVERTISE_PAUSE_ASYM 0x0800 /* Try for asymetric pause */
|
||||
#define ADVERTISE_RESV 0x1000 /* Unused... */
|
||||
#define ADVERTISE_RFAULT 0x2000 /* Say we can detect faults */
|
||||
#define ADVERTISE_LPACK 0x4000 /* Ack link partners response */
|
||||
#define ADVERTISE_NPAGE 0x8000 /* Next page bit */
|
||||
|
||||
#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \
|
||||
ADVERTISE_CSMA)
|
||||
#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \
|
||||
ADVERTISE_100HALF | ADVERTISE_100FULL)
|
||||
|
||||
/* Link partner ability register. */
|
||||
#define LPA_SLCT 0x001f /* Same as advertise selector */
|
||||
#define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */
|
||||
#define LPA_1000XFULL 0x0020 /* Can do 1000BASE-X full-duplex */
|
||||
#define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */
|
||||
#define LPA_1000XHALF 0x0040 /* Can do 1000BASE-X half-duplex */
|
||||
#define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */
|
||||
#define LPA_1000XPAUSE 0x0080 /* Can do 1000BASE-X pause */
|
||||
#define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */
|
||||
#define LPA_1000XPAUSE_ASYM 0x0100 /* Can do 1000BASE-X pause asym*/
|
||||
#define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */
|
||||
#define LPA_PAUSE_CAP 0x0400 /* Can pause */
|
||||
#define LPA_PAUSE_ASYM 0x0800 /* Can pause asymetrically */
|
||||
#define LPA_RESV 0x1000 /* Unused... */
|
||||
#define LPA_RFAULT 0x2000 /* Link partner faulted */
|
||||
#define LPA_LPACK 0x4000 /* Link partner acked us */
|
||||
#define LPA_NPAGE 0x8000 /* Next page bit */
|
||||
|
||||
#define LPA_DUPLEX (LPA_10FULL | LPA_100FULL)
|
||||
#define LPA_100 (LPA_100FULL | LPA_100HALF | LPA_100BASE4)
|
||||
|
||||
/* Expansion register for auto-negotiation. */
|
||||
#define EXPANSION_NWAY 0x0001 /* Can do N-way auto-nego */
|
||||
#define EXPANSION_LCWP 0x0002 /* Got new RX page code word */
|
||||
#define EXPANSION_ENABLENPAGE 0x0004 /* This enables npage words */
|
||||
#define EXPANSION_NPCAPABLE 0x0008 /* Link partner supports npage */
|
||||
#define EXPANSION_MFAULTS 0x0010 /* Multiple faults detected */
|
||||
#define EXPANSION_RESV 0xffe0 /* Unused... */
|
||||
|
||||
#define ESTATUS_1000_TFULL 0x2000 /* Can do 1000BT Full */
|
||||
#define ESTATUS_1000_THALF 0x1000 /* Can do 1000BT Half */
|
||||
|
||||
/* N-way test register. */
|
||||
#define NWAYTEST_RESV1 0x00ff /* Unused... */
|
||||
#define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */
|
||||
#define NWAYTEST_RESV2 0xfe00 /* Unused... */
|
||||
|
||||
/* 1000BASE-T Control register */
|
||||
#define ADVERTISE_1000FULL 0x0200 /* Advertise 1000BASE-T full duplex */
|
||||
#define ADVERTISE_1000HALF 0x0100 /* Advertise 1000BASE-T half duplex */
|
||||
|
||||
/* 1000BASE-T Status register */
|
||||
#define LPA_1000LOCALRXOK 0x2000 /* Link partner local receiver status */
|
||||
#define LPA_1000REMRXOK 0x1000 /* Link partner remote receiver status */
|
||||
#define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */
|
||||
#define LPA_1000HALF 0x0400 /* Link partner 1000BASE-T half duplex */
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user