forked from Imagelibrary/rtems
2009-08-21 Xi Yang <hiyangxi@gmail.com>
* Makefile.am: Add fb/fb.c add rtl8019 Ethernet card support * preinstall.am: Install skyeye_fb.h, Install wd80x3 * fb/fb.c, fb/skyeye_fb.h: Framebuffer support for skyeye simulator * rtl8019/wd80x3, rtl8019/rtl8019.c: rtl8019 support * startup/memmap.c: Change the size of Map I/O to 1216M * bsp/bsp.h: Add rtl8019 related infomation
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
2009-08-21 Xi Yang <hiyangxi@gmail.com>
|
||||
|
||||
* Makefile.am: Add fb/fb.c add rtl8019 Ethernet card support
|
||||
* preinstall.am: Install skyeye_fb.h, Install wd80x3
|
||||
* fb/fb.c, fb/skyeye_fb.h: Framebuffer support for skyeye simulator
|
||||
* rtl8019/wd80x3, rtl8019/rtl8019.c: rtl8019 support
|
||||
* startup/memmap.c: Change the size of Map I/O to 1216M
|
||||
* bsp/bsp.h: Add rtl8019 related infomation
|
||||
|
||||
2009-07-16 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* configure.ac: Rename BSP_BOOTCARD_OPTIONS to
|
||||
|
||||
@@ -40,6 +40,17 @@ libbsp_a_SOURCES += ../../shared/bsplibc.c ../../shared/bsppost.c \
|
||||
libbsp_a_SOURCES += console/uarts.c ../../shared/console.c
|
||||
#abort
|
||||
libbsp_a_SOURCES += ../shared/abort/abort.c
|
||||
#framebuffer
|
||||
if ON_SKYEYE
|
||||
libbsp_a_SOURCES += fb/fb.c
|
||||
if HAS_NETWORKING
|
||||
rtl8019_CPPFLAGS = -D__INSIDE_RTEMS_BSD_TCPIP_STACK__
|
||||
noinst_PROGRAMS += rtl8019.rel
|
||||
rtl8019_rel_SOURCES = rtl8019/rtl8019.c rtl8019/wd80x3.h
|
||||
rtl8019_rel_CPPFLAGS = $(AM_CPPFLAGS) $(rtl8019_CPPFLAGS)
|
||||
rtl8019_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
|
||||
endif
|
||||
endif
|
||||
|
||||
libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/shared/arm920.rel \
|
||||
../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/clock.rel \
|
||||
@@ -48,5 +59,9 @@ libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/shared/arm920.rel \
|
||||
../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/irq.rel \
|
||||
../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/pmc.rel
|
||||
|
||||
if HAS_NETWORKING
|
||||
libbsp_a_LIBADD += rtl8019.rel
|
||||
endif
|
||||
|
||||
include $(srcdir)/preinstall.am
|
||||
include $(top_srcdir)/../../../../automake/local.am
|
||||
|
||||
@@ -21,6 +21,7 @@ RTEMS_BSPOPTS_HELP([ON_SKYEYE],
|
||||
simulator. Speed up the clock ticks while the idle task is running so
|
||||
time spent in the idle task is minimized. This significantly reduces
|
||||
the wall time required to execute the RTEMS test suites.])
|
||||
AM_CONDITIONAL(ON_SKYEYE,test "$ON_SKYEYE" = "1")
|
||||
|
||||
RTEMS_CHECK_NETWORKING
|
||||
AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
|
||||
|
||||
174
c/src/lib/libbsp/arm/gumstix/fb/fb.c
Normal file
174
c/src/lib/libbsp/arm/gumstix/fb/fb.c
Normal file
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* By Yang Xi <hiyangxi@gmail.com>.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <pxa255.h>
|
||||
#include <bsp.h>
|
||||
#include <rtems/libio.h>
|
||||
|
||||
#include <rtems/fb.h>
|
||||
#include <rtems/framebuffer.h>
|
||||
#include <rtems.h>
|
||||
|
||||
#define SCREEN_WIDTH 480
|
||||
#define SCREEN_HEIGHT 272
|
||||
#define BPP 16
|
||||
#define LCD_DMA_POINTER (0xa0000000 + 62*(1<<20) + 0x1000)
|
||||
#define LCD_BUFFER_SIZE (SCREEN_WIDTH*SCREEN_HEIGHT*2)
|
||||
|
||||
|
||||
static struct fb_var_screeninfo fb_var =
|
||||
{
|
||||
.xres = SCREEN_WIDTH,
|
||||
.yres = SCREEN_HEIGHT,
|
||||
.bits_per_pixel = BPP
|
||||
};
|
||||
|
||||
static struct fb_fix_screeninfo fb_fix =
|
||||
{
|
||||
.smem_start = (volatile char *)LCD_DMA_POINTER,
|
||||
.smem_len = LCD_BUFFER_SIZE,
|
||||
.type = FB_TYPE_PACKED_PIXELS,
|
||||
.visual = FB_VISUAL_TRUECOLOR,
|
||||
.line_length = 80
|
||||
};
|
||||
|
||||
static void enable_fbskyeye(void)
|
||||
{
|
||||
LCCR1 &= ~LCCR1_PPL;
|
||||
LCCR1 |= (SCREEN_WIDTH -1 ) & LCCR1_PPL;
|
||||
LCCR2 &= ~LCCR2_LPP;
|
||||
LCCR2 |= (SCREEN_HEIGHT/2 -1) & LCCR2_LPP;
|
||||
LCCR3 &= ~LCCR3_BPP;
|
||||
LCCR3 |= 4<<24;
|
||||
FDADR0 = LCD_DMA_POINTER - 0x1000;
|
||||
LCCR0 |= LCCR0_ENB;
|
||||
}
|
||||
|
||||
|
||||
static void disable_fbskyeye(void)
|
||||
{
|
||||
LCCR0 &= ~LCCR0_ENB;
|
||||
}
|
||||
|
||||
static int get_fix_screen_info( struct fb_fix_screeninfo *info )
|
||||
{
|
||||
*info = fb_fix;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_var_screen_info( struct fb_var_screeninfo *info )
|
||||
{
|
||||
*info = fb_var;
|
||||
return 0;
|
||||
}
|
||||
|
||||
rtems_device_driver
|
||||
frame_buffer_initialize(rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *arg)
|
||||
{
|
||||
rtems_status_code status;
|
||||
|
||||
printk( "FBSKYEYE -- driver initializing..\n" );
|
||||
/*
|
||||
* Register the device
|
||||
*/
|
||||
status = rtems_io_register_name ("/dev/fb", major, 0);
|
||||
if (status != RTEMS_SUCCESSFUL)
|
||||
{
|
||||
printk("Error registering FBSKYEYE device!\n");
|
||||
rtems_fatal_error_occurred( status );
|
||||
}
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
|
||||
rtems_device_driver
|
||||
frame_buffer_open( rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *arg)
|
||||
{
|
||||
/* rtems_status_code status; */
|
||||
printk( "FBSKYEYE open called.\n" );
|
||||
enable_fbskyeye();
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
|
||||
rtems_device_driver
|
||||
frame_buffer_close(rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *arg)
|
||||
{
|
||||
printk( "fbskyeye close called.\n" );
|
||||
disable_fbskyeye();
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_device_driver
|
||||
frame_buffer_read( rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *arg)
|
||||
{
|
||||
rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *)arg;
|
||||
printk( "FBSKYEYE read called.\n" );
|
||||
rw_args->bytes_moved = 0;
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_device_driver
|
||||
frame_buffer_write( rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg)
|
||||
{
|
||||
rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *)arg;
|
||||
printk( "FBSKYEY write called.\n" );
|
||||
rw_args->bytes_moved = 0;
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
|
||||
rtems_device_driver
|
||||
frame_buffer_control( rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
rtems_libio_ioctl_args_t *args = arg;
|
||||
printk( "FBSKYEYE ioctl called, cmd=%x\n", args->command );
|
||||
switch( args->command )
|
||||
{
|
||||
case FBIOGET_FSCREENINFO:
|
||||
args->ioctl_return = get_fix_screen_info( args->buffer );
|
||||
break;
|
||||
case FBIOGET_VSCREENINFO:
|
||||
args->ioctl_return = get_var_screen_info( args->buffer );
|
||||
break;
|
||||
case FBIOPUT_VSCREENINFO:
|
||||
/* not implemented yet*/
|
||||
break;
|
||||
case FBIOGETCMAP:
|
||||
args->ioctl_return = 0;
|
||||
break;
|
||||
case FBIOPUTCMAP:
|
||||
args->ioctl_return = 0;
|
||||
break;
|
||||
default:
|
||||
args->ioctl_return = 0;
|
||||
break;
|
||||
|
||||
}
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
@@ -22,6 +22,7 @@ extern "C" {
|
||||
#include <rtems/clockdrv.h>
|
||||
#include <libchip/serial.h>
|
||||
|
||||
|
||||
/* What is the input clock freq in hertz */
|
||||
#define BSP_MAIN_FREQ 3686400 /* 3.6864 MHz */
|
||||
#define BSP_SLCK_FREQ 32768 /* 32.768 KHz */
|
||||
@@ -42,6 +43,24 @@ extern rtems_configuration_table Configuration;
|
||||
|
||||
#define ST_PIMR_PIV 33 /* 33 ticks of the 32.768Khz clock ~= 1msec */
|
||||
|
||||
#define outport_byte(port,val) *((unsigned char volatile*)(port)) = (val)
|
||||
#define inport_byte(port,val) (val) = *((unsigned char volatile*)(port))
|
||||
#define outport_word(port,val) *((unsigned short volatile*)(port)) = (val)
|
||||
#define inport_word(port,val) (val) = *((unsigned short volatile*)(port))
|
||||
|
||||
struct rtems_bsdnet_ifconfig;
|
||||
extern int rtems_ne_driver_attach(struct rtems_bsdnet_ifconfig *, int);
|
||||
#define BSP_NE2000_NETWORK_DRIVER_NAME "ne1"
|
||||
#define BSP_NE2000_NETWORK_DRIVER_ATTACH rtems_ne_driver_attach
|
||||
|
||||
#ifndef RTEMS_BSP_NETWORK_DRIVER_NAME
|
||||
#define RTEMS_BSP_NETWORK_DRIVER_NAME BSP_NE2000_NETWORK_DRIVER_NAME
|
||||
#endif
|
||||
|
||||
#ifndef RTEMS_BSP_NETWORK_DRIVER_ATTACH
|
||||
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH BSP_NE2000_NETWORK_DRIVER_ATTACH
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -65,3 +65,5 @@ $(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
|
||||
PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
|
||||
|
||||
if ON_SKYEYE
|
||||
endif
|
||||
|
||||
1259
c/src/lib/libbsp/arm/gumstix/rtl8019/rtl8019.c
Normal file
1259
c/src/lib/libbsp/arm/gumstix/rtl8019/rtl8019.c
Normal file
File diff suppressed because it is too large
Load Diff
133
c/src/lib/libbsp/arm/gumstix/rtl8019/wd80x3.h
Normal file
133
c/src/lib/libbsp/arm/gumstix/rtl8019/wd80x3.h
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Information about the DP8390 Ethernet controller.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __BSP_WD80x3_h
|
||||
#define __BSP_WD80x3_h
|
||||
|
||||
/* Register descriptions */
|
||||
/* Controller DP8390. */
|
||||
|
||||
#define DATAPORT 0x10 /* Port Window. */
|
||||
#define RESET 0x1f /* Issue a read for reset */
|
||||
#define W83CREG 0x00 /* I/O port definition */
|
||||
#define ADDROM 0x08
|
||||
|
||||
/* page 0 read or read/write registers */
|
||||
|
||||
#define CMDR 0x00+RO
|
||||
#define CLDA0 0x01+RO /* current local dma addr 0 for read */
|
||||
#define CLDA1 0x02+RO /* current local dma addr 1 for read */
|
||||
#define BNRY 0x03+RO /* boundary reg for rd and wr */
|
||||
#define TSR 0x04+RO /* tx status reg for rd */
|
||||
#define NCR 0x05+RO /* number of collision reg for rd */
|
||||
#define FIFO 0x06+RO /* FIFO for rd */
|
||||
#define ISR 0x07+RO /* interrupt status reg for rd and wr */
|
||||
#define CRDA0 0x08+RO /* current remote dma address 0 for rd */
|
||||
#define CRDA1 0x09+RO /* current remote dma address 1 for rd */
|
||||
#define RSR 0x0C+RO /* rx status reg for rd */
|
||||
#define CNTR0 0x0D+RO /* tally cnt 0 for frm alg err for rd */
|
||||
#define CNTR1 RO+0x0E /* tally cnt 1 for crc err for rd */
|
||||
#define CNTR2 0x0F+RO /* tally cnt 2 for missed pkt for rd */
|
||||
|
||||
/* page 0 write registers */
|
||||
|
||||
#define PSTART 0x01+RO /* page start register */
|
||||
#define PSTOP 0x02+RO /* page stop register */
|
||||
#define TPSR 0x04+RO /* tx start page start reg */
|
||||
#define TBCR0 0x05+RO /* tx byte count 0 reg */
|
||||
#define TBCR1 0x06+RO /* tx byte count 1 reg */
|
||||
#define RSAR0 0x08+RO /* remote start address reg 0 */
|
||||
#define RSAR1 0x09+RO /* remote start address reg 1 */
|
||||
#define RBCR0 0x0A+RO /* remote byte count reg 0 */
|
||||
#define RBCR1 0x0B+RO /* remote byte count reg 1 */
|
||||
#define RCR 0x0C+RO /* rx configuration reg */
|
||||
#define TCR 0x0D+RO /* tx configuration reg */
|
||||
#define DCR RO+0x0E /* data configuration reg */
|
||||
#define IMR 0x0F+RO /* interrupt mask reg */
|
||||
|
||||
/* page 1 registers */
|
||||
|
||||
#define PAR 0x01+RO /* physical addr reg base for rd and wr */
|
||||
#define CURR 0x07+RO /* current page reg for rd and wr */
|
||||
#define MAR 0x08+RO /* multicast addr reg base fro rd and WR */
|
||||
#define MARsize 8 /* size of multicast addr space */
|
||||
|
||||
/*-----W83CREG command bits-----*/
|
||||
#define MSK_RESET 0x80 /* W83CREG masks */
|
||||
#define MSK_ENASH 0x40
|
||||
#define MSK_DECOD 0x3F /* memory decode bits, corresponding */
|
||||
/* to SA 18-13. SA 19 assumed to be 1 */
|
||||
|
||||
/*-----CMDR command bits-----*/
|
||||
#define MSK_STP 0x01 /* stop the chip */
|
||||
#define MSK_STA 0x02 /* start the chip */
|
||||
#define MSK_TXP 0x04 /* initial txing of a frm */
|
||||
#define MSK_RRE 0x08 /* remote read */
|
||||
#define MSK_RWR 0x10 /* remote write */
|
||||
#define MSK_RD2 0x20 /* no DMA used */
|
||||
#define MSK_PG0 0x00 /* select register page 0 */
|
||||
#define MSK_PG1 0x40 /* select register page 1 */
|
||||
#define MSK_PG2 0x80 /* select register page 2 */
|
||||
|
||||
/*-----ISR and TSR status bits-----*/
|
||||
#define MSK_PRX 0x01 /* rx with no error */
|
||||
#define MSK_PTX 0x02 /* tx with no error */
|
||||
#define MSK_RXE 0x04 /* rx with error */
|
||||
#define MSK_TXE 0x08 /* tx with error */
|
||||
#define MSK_OVW 0x10 /* overwrite warning */
|
||||
#define MSK_CNT 0x20 /* MSB of one of the tally counters is set */
|
||||
#define MSK_RDC 0x40 /* remote dma completed */
|
||||
#define MSK_RST 0x80 /* reset state indicator */
|
||||
|
||||
/*-----DCR command bits-----*/
|
||||
#define MSK_WTS 0x01 /* word transfer mode selection */
|
||||
#define MSK_BOS 0x02 /* byte order selection */
|
||||
#define MSK_LAS 0x04 /* long addr selection */
|
||||
#define MSK_BMS 0x08 /* burst mode selection */
|
||||
#define MSK_ARM 0x10 /* autoinitialize remote */
|
||||
#define MSK_FT00 0x00 /* burst lrngth selection */
|
||||
#define MSK_FT01 0x20 /* burst lrngth selection */
|
||||
#define MSK_FT10 0x40 /* burst lrngth selection */
|
||||
#define MSK_FT11 0x60 /* burst lrngth selection */
|
||||
|
||||
/*-----RCR command bits-----*/
|
||||
#define MSK_SEP 0x01 /* save error pkts */
|
||||
#define MSK_AR 0x02 /* accept runt pkt */
|
||||
#define MSK_AB 0x04 /* 8390 RCR */
|
||||
#define MSK_AM 0x08 /* accept multicast */
|
||||
#define MSK_PRO 0x10 /* accept all pkt with physical adr */
|
||||
#define MSK_MON 0x20 /* monitor mode */
|
||||
|
||||
/*-----TCR command bits-----*/
|
||||
#define MSK_CRC 0x01 /* inhibit CRC, do not append crc */
|
||||
#define MSK_LOOP 0x02 /* set loopback mode */
|
||||
#define MSK_BCST 0x04 /* Accept broadcasts */
|
||||
#define MSK_LB01 0x06 /* encoded loopback control */
|
||||
#define MSK_ATD 0x08 /* auto tx disable */
|
||||
#define MSK_OFST 0x10 /* collision offset enable */
|
||||
|
||||
/*-----receive status bits-----*/
|
||||
#define SMK_PRX 0x01 /* rx without error */
|
||||
#define SMK_CRC 0x02 /* CRC error */
|
||||
#define SMK_FAE 0x04 /* frame alignment error */
|
||||
#define SMK_FO 0x08 /* FIFO overrun */
|
||||
#define SMK_MPA 0x10 /* missed pkt */
|
||||
#define SMK_PHY 0x20 /* physical/multicase address */
|
||||
#define SMK_DIS 0x40 /* receiver disable. set in monitor mode */
|
||||
#define SMK_DEF 0x80 /* deferring */
|
||||
|
||||
/*-----transmit status bits-----*/
|
||||
#define SMK_PTX 0x01 /* tx without error */
|
||||
#define SMK_DFR 0x02 /* non deferred tx */
|
||||
#define SMK_COL 0x04 /* tx collided */
|
||||
#define SMK_ABT 0x08 /* tx abort because of excessive collisions */
|
||||
#define SMK_CRS 0x10 /* carrier sense lost */
|
||||
#define SMK_FU 0x20 /* FIFO underrun */
|
||||
#define SMK_CDH 0x40 /* collision detect heartbeat */
|
||||
#define SMK_OWC 0x80 /* out of window collision */
|
||||
|
||||
#endif
|
||||
/* end of include */
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
mmu_sect_map_t mem_map[] = {
|
||||
/* <phys addr> <virt addr> <size> <flags> */
|
||||
{0x40000000, 0x40000000, 20, MMU_CACHE_NONE}, /*Map I/O*/
|
||||
{0x40000000, 0x40000000, 1216, MMU_CACHE_NONE}, /*Map I/O*/
|
||||
{0xA0000000, 0x00000000, 1, MMU_CACHE_NONE}, /*sram*/
|
||||
{0xA0000000, 0xA0000000, 64, MMU_CACHE_WBACK}, /* SDRAM */
|
||||
{0x00000000, 0x00000000, 0, 0} /* The end */
|
||||
|
||||
Reference in New Issue
Block a user