diff --git a/BaS_gcc/Makefile b/BaS_gcc/Makefile index d4ca635..c600195 100644 --- a/BaS_gcc/Makefile +++ b/BaS_gcc/Makefile @@ -44,7 +44,7 @@ TOOLDIR=util VPATH=dma exe flash fs if kbd pci spi sys usb net util video radeon x86emu xhdi -# Linker control file. The final $(LDCFILE) is intermediate only (preprocessed version of $(LDCSRC) +# Linker control file. The final $(LDCFILE) is intermediate only (preprocessed version of $(LDCSRC) LDCFILE=bas.lk LDRFILE=ram.lk LDCSRC=bas.lk.in diff --git a/BaS_gcc/bas.lk.in b/BaS_gcc/bas.lk.in index 9129a45..a6658f8 100644 --- a/BaS_gcc/bas.lk.in +++ b/BaS_gcc/bas.lk.in @@ -118,7 +118,7 @@ SECTIONS __BAS_BSS_END = .; #endif /* COMPILE_RAM */ -#if (FORMAT == elf32-m68k) +#if FORMAT == elf32-m68k *(.rodata) *(.rodata.*) #endif @@ -148,6 +148,7 @@ SECTIONS .driver_memory : { + . = ALIGN(4); _driver_mem_buffer = .; //. = . + DRIVER_MEM_BUFFER_SIZE; } > driver_ram diff --git a/BaS_gcc/if/driver_vec.c b/BaS_gcc/if/driver_vec.c index 98aa2c6..e0afeea 100644 --- a/BaS_gcc/if/driver_vec.c +++ b/BaS_gcc/if/driver_vec.c @@ -25,10 +25,10 @@ #include #include -#include "driver_vec.h" #include "version.h" #include "xhdi_sd.h" #include "dma.h" +#include "driver_vec.h" #include "driver_mem.h" /* @@ -67,6 +67,16 @@ static struct dma_driver_interface dma_interface = .dma_free = driver_mem_free }; +extern const struct fb_info *info_fb; + +/* + * driver interface struct for the BaS framebuffer video driver + */ +static struct framebuffer_driver_interface framebuffer_interface = +{ + .framebuffer_info = &info_fb +}; + static struct generic_interface interfaces[] = { { @@ -87,6 +97,14 @@ static struct generic_interface interfaces[] = .revision = 1, .interface.dma = &dma_interface, }, + { + .type = VIDEO_DRIVER, + .name = "RADEON", + .description = "BaS RADEON framebuffer driver", + .version = 0, + .revision = 1, + .interface.fb = &framebuffer_interface, + }, /* insert new drivers here */ diff --git a/BaS_gcc/include/driver_vec.h b/BaS_gcc/include/driver_vec.h index 791500c..664babb 100644 --- a/BaS_gcc/include/driver_vec.h +++ b/BaS_gcc/include/driver_vec.h @@ -76,11 +76,139 @@ struct xhdi_driver_interface uint32_t (*xhdivec)(); }; +/* Interpretation of offset for color fields: All offsets are from the right, + * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you + * can use the offset as right argument to <<). A pixel afterwards is a bit + * stream and is written to video memory as that unmodified. This implies + * big-endian byte order if bits_per_pixel is greater than 8. + */ +struct fb_bitfield +{ + unsigned long offset; /* beginning of bitfield */ + unsigned long length; /* length of bitfield */ + unsigned long msb_right; /* != 0 : Most significant bit is */ + /* right */ +}; + +/* + * the following structures define the interface to the BaS-builtin-framebuffer video driver + */ +struct fb_var_screeninfo +{ + unsigned long xres; /* visible resolution */ + unsigned long yres; + unsigned long xres_virtual; /* virtual resolution */ + unsigned long yres_virtual; + unsigned long xoffset; /* offset from virtual to visible */ + unsigned long yoffset; /* resolution */ + + unsigned long bits_per_pixel; /* guess what */ + unsigned long grayscale; /* != 0 Graylevels instead of colors */ + + struct fb_bitfield red; /* bitfield in fb mem if true color, */ + struct fb_bitfield green; /* else only length is significant */ + struct fb_bitfield blue; + struct fb_bitfield transp; /* transparency */ + + unsigned long nonstd; /* != 0 Non standard pixel format */ + + unsigned long activate; /* see FB_ACTIVATE_* */ + + unsigned long height; /* height of picture in mm */ + unsigned long width; /* width of picture in mm */ + + unsigned long accel_flags; /* (OBSOLETE) see fb_info.flags */ + + /* Timing: All values in pixclocks, except pixclock (of course) */ + unsigned long pixclock; /* pixel clock in ps (pico seconds) */ + unsigned long left_margin; /* time from sync to picture */ + unsigned long right_margin; /* time from picture to sync */ + unsigned long upper_margin; /* time from sync to picture */ + unsigned long lower_margin; + unsigned long hsync_len; /* length of horizontal sync */ + unsigned long vsync_len; /* length of vertical sync */ + unsigned long sync; /* see FB_SYNC_* */ + unsigned long vmode; /* see FB_VMODE_* */ + unsigned long rotate; /* angle we rotate counter clockwise */ + unsigned long refresh; + unsigned long reserved[4]; /* Reserved for future compatibility */ +}; + +struct fb_fix_screeninfo +{ + char id[16]; /* identification string eg "TT Builtin" */ + unsigned long smem_start; /* Start of frame buffer mem */ + /* (physical address) */ + unsigned long smem_len; /* Length of frame buffer mem */ + unsigned long type; /* see FB_TYPE_* */ + unsigned long type_aux; /* Interleave for interleaved Planes */ + unsigned long visual; /* see FB_VISUAL_* */ + unsigned short xpanstep; /* zero if no hardware panning */ + unsigned short ypanstep; /* zero if no hardware panning */ + unsigned short ywrapstep; /* zero if no hardware ywrap */ + unsigned long line_length; /* length of a line in bytes */ + unsigned long mmio_start; /* Start of Memory Mapped I/O */ + /* (physical address) */ + unsigned long mmio_len; /* Length of Memory Mapped I/O */ + unsigned long accel; /* Indicate to driver which */ + /* specific chip/card we have */ + unsigned short reserved[3]; /* Reserved for future compatibility */ +}; + +struct fb_chroma +{ + unsigned long redx; /* in fraction of 1024 */ + unsigned long greenx; + unsigned long bluex; + unsigned long whitex; + unsigned long redy; + unsigned long greeny; + unsigned long bluey; + unsigned long whitey; +}; + +struct fb_monspecs +{ + struct fb_chroma chroma; + struct fb_videomode *modedb; /* mode database */ + unsigned char manufacturer[4]; /* Manufacturer */ + unsigned char monitor[14]; /* Monitor String */ + unsigned char serial_no[14]; /* Serial Number */ + unsigned char ascii[14]; /* ? */ + unsigned long modedb_len; /* mode database length */ + unsigned long model; /* Monitor Model */ + unsigned long serial; /* Serial Number - Integer */ + unsigned long year; /* Year manufactured */ + unsigned long week; /* Week Manufactured */ + unsigned long hfmin; /* hfreq lower limit (Hz) */ + unsigned long hfmax; /* hfreq upper limit (Hz) */ + unsigned long dclkmin; /* pixelclock lower limit (Hz) */ + unsigned long dclkmax; /* pixelclock upper limit (Hz) */ + unsigned short input; /* display type - see FB_DISP_* */ + unsigned short dpms; /* DPMS support - see FB_DPMS_ */ + unsigned short signal; /* Signal Type - see FB_SIGNAL_* */ + unsigned short vfmin; /* vfreq lower limit (Hz) */ + unsigned short vfmax; /* vfreq upper limit (Hz) */ + unsigned short gamma; /* Gamma - in fractions of 100 */ + unsigned short gtf : 1; /* supports GTF */ + unsigned short misc; /* Misc flags - see FB_MISC_* */ + unsigned char version; /* EDID version... */ + unsigned char revision; /* ...and revision */ + unsigned char max_x; /* Maximum horizontal size (cm) */ + unsigned char max_y; /* Maximum vertical size (cm) */ +}; + +struct framebuffer_driver_interface +{ + struct fb_info **framebuffer_info; /* pointer to an fb_info struct (defined in include/fb.h) */ +}; + union interface { struct generic_driver_interface *gdi; struct xhdi_driver_interface *xhdi; struct dma_driver_interface *dma; + struct framebuffer_driver_interface *fb; }; struct generic_interface diff --git a/BaS_gcc/include/fb.h b/BaS_gcc/include/fb.h index f814151..f215234 100644 --- a/BaS_gcc/include/fb.h +++ b/BaS_gcc/include/fb.h @@ -174,22 +174,22 @@ extern struct mode_option resolution; /* fVDI */ #define FB_ACCEL_PROSAVAGE_DDRK 0x8e /* S3 ProSavage DDR-K */ struct fb_fix_screeninfo { - char id[16]; /* identification string eg "TT Builtin" */ - unsigned long smem_start; /* Start of frame buffer mem */ - /* (physical address) */ + char id[16]; /* identification string eg "TT Builtin" */ + unsigned long smem_start; /* Start of frame buffer mem */ + /* (physical address) */ unsigned long smem_len; /* Length of frame buffer mem */ - unsigned long type; /* see FB_TYPE_* */ + unsigned long type; /* see FB_TYPE_* */ unsigned long type_aux; /* Interleave for interleaved Planes */ unsigned long visual; /* see FB_VISUAL_* */ - unsigned short xpanstep; /* zero if no hardware panning */ - unsigned short ypanstep; /* zero if no hardware panning */ + unsigned short xpanstep; /* zero if no hardware panning */ + unsigned short ypanstep; /* zero if no hardware panning */ unsigned short ywrapstep; /* zero if no hardware ywrap */ unsigned long line_length; /* length of a line in bytes */ - unsigned long mmio_start; /* Start of Memory Mapped I/O */ - /* (physical address) */ + unsigned long mmio_start; /* Start of Memory Mapped I/O */ + /* (physical address) */ unsigned long mmio_len; /* Length of Memory Mapped I/O */ unsigned long accel; /* Indicate to driver which */ - /* specific chip/card we have */ + /* specific chip/card we have */ unsigned short reserved[3]; /* Reserved for future compatibility */ }; @@ -243,20 +243,20 @@ struct fb_bitfield { #define KHZ2PICOS(a) (1000000000UL/(a)) struct fb_var_screeninfo { - unsigned long xres; /* visible resolution */ + unsigned long xres; /* visible resolution */ unsigned long yres; unsigned long xres_virtual; /* virtual resolution */ unsigned long yres_virtual; unsigned long xoffset; /* offset from virtual to visible */ unsigned long yoffset; /* resolution */ - unsigned long bits_per_pixel; /* guess what */ + unsigned long bits_per_pixel; /* guess what */ unsigned long grayscale; /* != 0 Graylevels instead of colors */ - struct fb_bitfield red; /* bitfield in fb mem if true color, */ - struct fb_bitfield green; /* else only length is significant */ + struct fb_bitfield red; /* bitfield in fb mem if true color, */ + struct fb_bitfield green; /* else only length is significant */ struct fb_bitfield blue; - struct fb_bitfield transp; /* transparency */ + struct fb_bitfield transp; /* transparency */ unsigned long nonstd; /* != 0 Non standard pixel format */ @@ -275,7 +275,7 @@ struct fb_var_screeninfo { unsigned long lower_margin; unsigned long hsync_len; /* length of horizontal sync */ unsigned long vsync_len; /* length of vertical sync */ - unsigned long sync; /* see FB_SYNC_* */ + unsigned long sync; /* see FB_SYNC_* */ unsigned long vmode; /* see FB_VMODE_* */ unsigned long rotate; /* angle we rotate counter clockwise */ unsigned long refresh; @@ -363,15 +363,15 @@ struct fb_chroma { struct fb_monspecs { struct fb_chroma chroma; struct fb_videomode *modedb; /* mode database */ - unsigned char manufacturer[4]; /* Manufacturer */ + unsigned char manufacturer[4]; /* Manufacturer */ unsigned char monitor[14]; /* Monitor String */ - unsigned char serial_no[14]; /* Serial Number */ + unsigned char serial_no[14]; /* Serial Number */ unsigned char ascii[14]; /* ? */ unsigned long modedb_len; /* mode database length */ unsigned long model; /* Monitor Model */ unsigned long serial; /* Serial Number - Integer */ - unsigned long year; /* Year manufactured */ - unsigned long week; /* Week Manufactured */ + unsigned long year; /* Year manufactured */ + unsigned long week; /* Week Manufactured */ unsigned long hfmin; /* hfreq lower limit (Hz) */ unsigned long hfmax; /* hfreq upper limit (Hz) */ unsigned long dclkmin; /* pixelclock lower limit (Hz) */ @@ -385,7 +385,7 @@ struct fb_monspecs { unsigned short gtf : 1; /* supports GTF */ unsigned short misc; /* Misc flags - see FB_MISC_* */ unsigned char version; /* EDID version... */ - unsigned char revision; /* ...and revision */ + unsigned char revision; /* ...and revision */ unsigned char max_x; /* Maximum horizontal size (cm) */ unsigned char max_y; /* Maximum vertical size (cm) */ };