start merging R_0.8.6.1 (jtag load bug fix)

This commit is contained in:
Markus Fröschle
2014-12-26 09:07:22 +00:00
parent dce24ff7c7
commit 732956830f
2 changed files with 188 additions and 188 deletions

View File

@@ -261,8 +261,6 @@ tos/jtagwait/include/MCF5475_USB.h
tos/jtagwait/include/MCF5475_XLB.h tos/jtagwait/include/MCF5475_XLB.h
tos/jtagwait/include/MCF5475.h tos/jtagwait/include/MCF5475.h
tos/jtagwait/include/driver_vec.h tos/jtagwait/include/driver_vec.h
tos/jtagwait/sources/bas_printf.c
tos/jtagwait/sources/bas_string.c
tos/jtagwait/sources/printf_helper.S tos/jtagwait/sources/printf_helper.S
tos/bascook/Makefile tos/bascook/Makefile
tos/bascook/sources/bascook.c tos/bascook/sources/bascook.c
@@ -271,3 +269,5 @@ usb/usb_hub.c
include/usb_hub.h include/usb_hub.h
tos/Makefile tos/Makefile
usb/usb_kbd.c usb/usb_kbd.c
tos/jtagwait/sources/bas_printf.c
tos/jtagwait/sources/bas_string.c

View File

@@ -31,53 +31,53 @@
enum driver_type enum driver_type
{ {
BLOCKDEV_DRIVER, BLOCKDEV_DRIVER,
CHARDEV_DRIVER, CHARDEV_DRIVER,
XHDI_DRIVER, XHDI_DRIVER,
MCD_DRIVER, MCD_DRIVER,
VIDEO_DRIVER, VIDEO_DRIVER,
PCI_DRIVER, PCI_DRIVER,
MMU_DRIVER, MMU_DRIVER,
END_OF_DRIVERS, /* marks end of driver list */ END_OF_DRIVERS = 0xffffffff, /* marks end of driver list */
}; };
struct generic_driver_interface struct generic_driver_interface
{ {
uint32_t (*init)(void); uint32_t (*init)(void);
uint32_t (*read)(void *buf, size_t count); uint32_t (*read)(void *buf, size_t count);
uint32_t (*write)(const void *buf, size_t count); uint32_t (*write)(const void *buf, size_t count);
uint32_t (*ioctl)(uint32_t request, ...); uint32_t (*ioctl)(uint32_t request, ...);
}; };
struct dma_driver_interface struct dma_driver_interface
{ {
int32_t version; int32_t version;
int32_t magic; int32_t magic;
int (*dma_set_initiator)(int initiator); int (*dma_set_initiator)(int initiator);
uint32_t (*dma_get_initiator)(int requestor); uint32_t (*dma_get_initiator)(int requestor);
void (*dma_free_initiator)(int requestor); void (*dma_free_initiator)(int requestor);
int (*dma_set_channel)(int requestor, void (*handler)(void)); int (*dma_set_channel)(int requestor, void (*handler)(void));
int (*dma_get_channel)(int requestor); int (*dma_get_channel)(int requestor);
void (*dma_free_channel)(int requestor); void (*dma_free_channel)(int requestor);
void (*dma_clear_channel)(int channel); void (*dma_clear_channel)(int channel);
int (*MCD_startDma)(long channel, int (*MCD_startDma)(long channel,
int8_t *srcAddr, unsigned int srcIncr, int8_t *destAddr, unsigned int destIncr, int8_t *srcAddr, unsigned int srcIncr, int8_t *destAddr, unsigned int destIncr,
unsigned int dmaSize, unsigned int xferSize, unsigned int initiator, int priority, unsigned int dmaSize, unsigned int xferSize, unsigned int initiator, int priority,
unsigned int flags, unsigned int funcDesc); unsigned int flags, unsigned int funcDesc);
int32_t (*MCD_dmaStatus)(int32_t channel); int32_t (*MCD_dmaStatus)(int32_t channel);
int32_t (*MCD_XferProgrQuery)(int32_t channel, MCD_XferProg *progRep); int32_t (*MCD_XferProgrQuery)(int32_t channel, MCD_XferProg *progRep);
int32_t (*MCD_killDma)(int32_t channel); int32_t (*MCD_killDma)(int32_t channel);
int32_t (*MCD_continDma)(int32_t channel); int32_t (*MCD_continDma)(int32_t channel);
int32_t (*MCD_pauseDma)(int32_t channel); int32_t (*MCD_pauseDma)(int32_t channel);
int32_t (*MCD_resumeDma)(int32_t channel); int32_t (*MCD_resumeDma)(int32_t channel);
int32_t (*MCD_csumQuery)(int32_t channel, uint32_t *csum); int32_t (*MCD_csumQuery)(int32_t channel, uint32_t *csum);
void *(*dma_malloc)(uint32_t amount); void *(*dma_malloc)(uint32_t amount);
int32_t (*dma_free)(void *addr); int32_t (*dma_free)(void *addr);
}; };
struct xhdi_driver_interface struct xhdi_driver_interface
{ {
uint32_t (*xhdivec)(); uint32_t (*xhdivec)();
}; };
/* Interpretation of offset for color fields: All offsets are from the right, /* Interpretation of offset for color fields: All offsets are from the right,
@@ -88,10 +88,10 @@ struct xhdi_driver_interface
*/ */
struct fb_bitfield struct fb_bitfield
{ {
unsigned long offset; /* beginning of bitfield */ unsigned long offset; /* beginning of bitfield */
unsigned long length; /* length of bitfield */ unsigned long length; /* length of bitfield */
unsigned long msb_right; /* != 0 : Most significant bit is */ unsigned long msb_right; /* != 0 : Most significant bit is */
/* right */ /* right */
}; };
/* /*
@@ -99,164 +99,164 @@ struct fb_bitfield
*/ */
struct fb_var_screeninfo struct fb_var_screeninfo
{ {
unsigned long xres; /* visible resolution */ unsigned long xres; /* visible resolution */
unsigned long yres; unsigned long yres;
unsigned long xres_virtual; /* virtual resolution */ unsigned long xres_virtual; /* virtual resolution */
unsigned long yres_virtual; unsigned long yres_virtual;
unsigned long xoffset; /* offset from virtual to visible */ unsigned long xoffset; /* offset from virtual to visible */
unsigned long yoffset; /* resolution */ 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 */ unsigned long grayscale; /* != 0 Graylevels instead of colors */
struct fb_bitfield red; /* bitfield in fb mem if true color, */ struct fb_bitfield red; /* bitfield in fb mem if true color, */
struct fb_bitfield green; /* else only length is significant */ struct fb_bitfield green; /* else only length is significant */
struct fb_bitfield blue; struct fb_bitfield blue;
struct fb_bitfield transp; /* transparency */ struct fb_bitfield transp; /* transparency */
unsigned long nonstd; /* != 0 Non standard pixel format */ unsigned long nonstd; /* != 0 Non standard pixel format */
unsigned long activate; /* see FB_ACTIVATE_* */ unsigned long activate; /* see FB_ACTIVATE_* */
unsigned long height; /* height of picture in mm */ unsigned long height; /* height of picture in mm */
unsigned long width; /* width of picture in mm */ unsigned long width; /* width of picture in mm */
unsigned long accel_flags; /* (OBSOLETE) see fb_info.flags */ unsigned long accel_flags; /* (OBSOLETE) see fb_info.flags */
/* Timing: All values in pixclocks, except pixclock (of course) */ /* Timing: All values in pixclocks, except pixclock (of course) */
unsigned long pixclock; /* pixel clock in ps (pico seconds) */ unsigned long pixclock; /* pixel clock in ps (pico seconds) */
unsigned long left_margin; /* time from sync to picture */ unsigned long left_margin; /* time from sync to picture */
unsigned long right_margin; /* time from picture to sync */ unsigned long right_margin; /* time from picture to sync */
unsigned long upper_margin; /* time from sync to picture */ unsigned long upper_margin; /* time from sync to picture */
unsigned long lower_margin; unsigned long lower_margin;
unsigned long hsync_len; /* length of horizontal sync */ unsigned long hsync_len; /* length of horizontal sync */
unsigned long vsync_len; /* length of vertical 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 vmode; /* see FB_VMODE_* */
unsigned long rotate; /* angle we rotate counter clockwise */ unsigned long rotate; /* angle we rotate counter clockwise */
unsigned long refresh; unsigned long refresh;
unsigned long reserved[4]; /* Reserved for future compatibility */ unsigned long reserved[4]; /* Reserved for future compatibility */
}; };
struct fb_fix_screeninfo struct fb_fix_screeninfo
{ {
char id[16]; /* identification string eg "TT Builtin" */ char id[16]; /* identification string eg "TT Builtin" */
unsigned long smem_start; /* Start of frame buffer mem */ unsigned long smem_start; /* Start of frame buffer mem */
/* (physical address) */ /* (physical address) */
unsigned long smem_len; /* Length of frame buffer mem */ 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 type_aux; /* Interleave for interleaved Planes */
unsigned long visual; /* see FB_VISUAL_* */ unsigned long visual; /* see FB_VISUAL_* */
unsigned short xpanstep; /* zero if no hardware panning */ unsigned short xpanstep; /* zero if no hardware panning */
unsigned short ypanstep; /* zero if no hardware panning */ unsigned short ypanstep; /* zero if no hardware panning */
unsigned short ywrapstep; /* zero if no hardware ywrap */ unsigned short ywrapstep; /* zero if no hardware ywrap */
unsigned long line_length; /* length of a line in bytes */ unsigned long line_length; /* length of a line in bytes */
unsigned long mmio_start; /* Start of Memory Mapped I/O */ unsigned long mmio_start; /* Start of Memory Mapped I/O */
/* (physical address) */ /* (physical address) */
unsigned long mmio_len; /* Length of Memory Mapped I/O */ unsigned long mmio_len; /* Length of Memory Mapped I/O */
unsigned long accel; /* Indicate to driver which */ 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 */ unsigned short reserved[3]; /* Reserved for future compatibility */
}; };
struct fb_chroma struct fb_chroma
{ {
unsigned long redx; /* in fraction of 1024 */ unsigned long redx; /* in fraction of 1024 */
unsigned long greenx; unsigned long greenx;
unsigned long bluex; unsigned long bluex;
unsigned long whitex; unsigned long whitex;
unsigned long redy; unsigned long redy;
unsigned long greeny; unsigned long greeny;
unsigned long bluey; unsigned long bluey;
unsigned long whitey; unsigned long whitey;
}; };
struct fb_monspecs struct fb_monspecs
{ {
struct fb_chroma chroma; struct fb_chroma chroma;
struct fb_videomode *modedb; /* mode database */ struct fb_videomode *modedb; /* mode database */
unsigned char manufacturer[4]; /* Manufacturer */ unsigned char manufacturer[4]; /* Manufacturer */
unsigned char monitor[14]; /* Monitor String */ 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 char ascii[14]; /* ? */
unsigned long modedb_len; /* mode database length */ unsigned long modedb_len; /* mode database length */
unsigned long model; /* Monitor Model */ unsigned long model; /* Monitor Model */
unsigned long serial; /* Serial Number - Integer */ unsigned long serial; /* Serial Number - Integer */
unsigned long year; /* Year manufactured */ unsigned long year; /* Year manufactured */
unsigned long week; /* Week Manufactured */ unsigned long week; /* Week Manufactured */
unsigned long hfmin; /* hfreq lower limit (Hz) */ unsigned long hfmin; /* hfreq lower limit (Hz) */
unsigned long hfmax; /* hfreq upper limit (Hz) */ unsigned long hfmax; /* hfreq upper limit (Hz) */
unsigned long dclkmin; /* pixelclock lower limit (Hz) */ unsigned long dclkmin; /* pixelclock lower limit (Hz) */
unsigned long dclkmax; /* pixelclock upper limit (Hz) */ unsigned long dclkmax; /* pixelclock upper limit (Hz) */
unsigned short input; /* display type - see FB_DISP_* */ unsigned short input; /* display type - see FB_DISP_* */
unsigned short dpms; /* DPMS support - see FB_DPMS_ */ unsigned short dpms; /* DPMS support - see FB_DPMS_ */
unsigned short signal; /* Signal Type - see FB_SIGNAL_* */ unsigned short signal; /* Signal Type - see FB_SIGNAL_* */
unsigned short vfmin; /* vfreq lower limit (Hz) */ unsigned short vfmin; /* vfreq lower limit (Hz) */
unsigned short vfmax; /* vfreq upper limit (Hz) */ unsigned short vfmax; /* vfreq upper limit (Hz) */
unsigned short gamma; /* Gamma - in fractions of 100 */ unsigned short gamma; /* Gamma - in fractions of 100 */
unsigned short gtf : 1; /* supports GTF */ unsigned short gtf : 1; /* supports GTF */
unsigned short misc; /* Misc flags - see FB_MISC_* */ unsigned short misc; /* Misc flags - see FB_MISC_* */
unsigned char version; /* EDID version... */ 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_x; /* Maximum horizontal size (cm) */
unsigned char max_y; /* Maximum vertical size (cm) */ unsigned char max_y; /* Maximum vertical size (cm) */
}; };
struct framebuffer_driver_interface struct framebuffer_driver_interface
{ {
struct fb_info **framebuffer_info; /* pointer to an fb_info struct (defined in include/fb.h) */ struct fb_info **framebuffer_info; /* pointer to an fb_info struct (defined in include/fb.h) */
}; };
struct pci_bios_interface { struct pci_bios_interface {
uint32_t subjar; uint32_t subjar;
uint32_t version; uint32_t version;
/* Although we declare this functions as standard gcc functions (cdecl), /* Although we declare this functions as standard gcc functions (cdecl),
* they expect paramenters inside registers (fastcall) unsupported by gcc m68k. * they expect paramenters inside registers (fastcall) unsupported by gcc m68k.
* Caller will take care of parameters passing convention. * Caller will take care of parameters passing convention.
*/ */
int32_t (*find_pci_device) (uint32_t id, uint16_t index); int32_t (*find_pci_device) (uint32_t id, uint16_t index);
int32_t (*find_pci_classcode) (uint32_t class, uint16_t index); int32_t (*find_pci_classcode) (uint32_t class, uint16_t index);
int32_t (*read_config_byte) (int32_t handle, uint16_t reg, uint8_t *address); int32_t (*read_config_byte) (int32_t handle, uint16_t reg, uint8_t *address);
int32_t (*read_config_word) (int32_t handle, uint16_t reg, uint16_t *address); int32_t (*read_config_word) (int32_t handle, uint16_t reg, uint16_t *address);
int32_t (*read_config_longword) (int32_t handle, uint16_t reg, uint32_t *address); int32_t (*read_config_longword) (int32_t handle, uint16_t reg, uint32_t *address);
uint8_t (*fast_read_config_byte) (int32_t handle, uint16_t reg); uint8_t (*fast_read_config_byte) (int32_t handle, uint16_t reg);
uint16_t (*fast_read_config_word) (int32_t handle, uint16_t reg); uint16_t (*fast_read_config_word) (int32_t handle, uint16_t reg);
uint32_t (*fast_read_config_longword) (int32_t handle, uint16_t reg); uint32_t (*fast_read_config_longword) (int32_t handle, uint16_t reg);
int32_t (*write_config_byte) (int32_t handle, uint16_t reg, uint16_t val); int32_t (*write_config_byte) (int32_t handle, uint16_t reg, uint16_t val);
int32_t (*write_config_word) (int32_t handle, uint16_t reg, uint16_t val); int32_t (*write_config_word) (int32_t handle, uint16_t reg, uint16_t val);
int32_t (*write_config_longword) (int32_t handle, uint16_t reg, uint32_t val); int32_t (*write_config_longword) (int32_t handle, uint16_t reg, uint32_t val);
int32_t (*hook_interrupt) (int32_t handle, uint32_t *routine, uint32_t *parameter); int32_t (*hook_interrupt) (int32_t handle, uint32_t *routine, uint32_t *parameter);
int32_t (*unhook_interrupt) (int32_t handle); int32_t (*unhook_interrupt) (int32_t handle);
int32_t (*special_cycle) (uint16_t bus, uint32_t data); int32_t (*special_cycle) (uint16_t bus, uint32_t data);
int32_t (*get_routing) (int32_t handle); int32_t (*get_routing) (int32_t handle);
int32_t (*set_interrupt) (int32_t handle); int32_t (*set_interrupt) (int32_t handle);
int32_t (*get_resource) (int32_t handle); int32_t (*get_resource) (int32_t handle);
int32_t (*get_card_used) (int32_t handle, uint32_t *address); int32_t (*get_card_used) (int32_t handle, uint32_t *address);
int32_t (*set_card_used) (int32_t handle, uint32_t *callback); int32_t (*set_card_used) (int32_t handle, uint32_t *callback);
int32_t (*read_mem_byte) (int32_t handle, uint32_t offset, uint8_t *address); int32_t (*read_mem_byte) (int32_t handle, uint32_t offset, uint8_t *address);
int32_t (*read_mem_word) (int32_t handle, uint32_t offset, uint16_t *address); int32_t (*read_mem_word) (int32_t handle, uint32_t offset, uint16_t *address);
int32_t (*read_mem_longword) (int32_t handle, uint32_t offset, uint32_t *address); int32_t (*read_mem_longword) (int32_t handle, uint32_t offset, uint32_t *address);
uint8_t (*fast_read_mem_byte) (int32_t handle, uint32_t offset); uint8_t (*fast_read_mem_byte) (int32_t handle, uint32_t offset);
uint16_t (*fast_read_mem_word) (int32_t handle, uint32_t offset); uint16_t (*fast_read_mem_word) (int32_t handle, uint32_t offset);
uint32_t (*fast_read_mem_longword) (int32_t handle, uint32_t offset); uint32_t (*fast_read_mem_longword) (int32_t handle, uint32_t offset);
int32_t (*write_mem_byte) (int32_t handle, uint32_t offset, uint16_t val); int32_t (*write_mem_byte) (int32_t handle, uint32_t offset, uint16_t val);
int32_t (*write_mem_word) (int32_t handle, uint32_t offset, uint16_t val); int32_t (*write_mem_word) (int32_t handle, uint32_t offset, uint16_t val);
int32_t (*write_mem_longword) (int32_t handle, uint32_t offset, uint32_t val); int32_t (*write_mem_longword) (int32_t handle, uint32_t offset, uint32_t val);
int32_t (*read_io_byte) (int32_t handle, uint32_t offset, uint8_t *address); int32_t (*read_io_byte) (int32_t handle, uint32_t offset, uint8_t *address);
int32_t (*read_io_word) (int32_t handle, uint32_t offset, uint16_t *address); int32_t (*read_io_word) (int32_t handle, uint32_t offset, uint16_t *address);
int32_t (*read_io_longword) (int32_t handle, uint32_t offset, uint32_t *address); int32_t (*read_io_longword) (int32_t handle, uint32_t offset, uint32_t *address);
uint8_t (*fast_read_io_byte) (int32_t handle, uint32_t offset); uint8_t (*fast_read_io_byte) (int32_t handle, uint32_t offset);
uint16_t (*fast_read_io_word) (int32_t handle, uint32_t offset); uint16_t (*fast_read_io_word) (int32_t handle, uint32_t offset);
uint32_t (*fast_read_io_longword) (int32_t handle, uint32_t offset); uint32_t (*fast_read_io_longword) (int32_t handle, uint32_t offset);
int32_t (*write_io_byte) (int32_t handle, uint32_t offset, uint16_t val); int32_t (*write_io_byte) (int32_t handle, uint32_t offset, uint16_t val);
int32_t (*write_io_word) (int32_t handle, uint32_t offset, uint16_t val); int32_t (*write_io_word) (int32_t handle, uint32_t offset, uint16_t val);
int32_t (*write_io_longword) (int32_t handle, uint32_t offset, uint32_t val); int32_t (*write_io_longword) (int32_t handle, uint32_t offset, uint32_t val);
int32_t (*get_machine_id) (void); int32_t (*get_machine_id) (void);
int32_t (*get_pagesize) (void); int32_t (*get_pagesize) (void);
int32_t (*virt_to_bus) (int32_t handle, uint32_t address, PCI_CONV_ADR *pointer); int32_t (*virt_to_bus) (int32_t handle, uint32_t address, PCI_CONV_ADR *pointer);
int32_t (*bus_to_virt) (int32_t handle, uint32_t address, PCI_CONV_ADR *pointer); int32_t (*bus_to_virt) (int32_t handle, uint32_t address, PCI_CONV_ADR *pointer);
int32_t (*virt_to_phys) (uint32_t address, PCI_CONV_ADR *pointer); int32_t (*virt_to_phys) (uint32_t address, PCI_CONV_ADR *pointer);
int32_t (*phys_to_virt) (uint32_t address, PCI_CONV_ADR *pointer); int32_t (*phys_to_virt) (uint32_t address, PCI_CONV_ADR *pointer);
// int32_t reserved[2]; // int32_t reserved[2];
}; };
@@ -270,30 +270,30 @@ struct mmu_driver_interface
union interface union interface
{ {
struct generic_driver_interface *gdi; struct generic_driver_interface *gdi;
struct xhdi_driver_interface *xhdi; struct xhdi_driver_interface *xhdi;
struct dma_driver_interface *dma; struct dma_driver_interface *dma;
struct framebuffer_driver_interface *fb; struct framebuffer_driver_interface *fb;
struct pci_bios_interface *pci; struct pci_bios_interface *pci;
struct mmu_driver_interface *mmu; struct mmu_driver_interface *mmu;
}; };
struct generic_interface struct generic_interface
{ {
enum driver_type type; enum driver_type type;
char name[16]; char name[16];
char description[64]; char description[64];
int version; int version;
int revision; int revision;
union interface interface; union interface interface;
}; };
struct driver_table struct driver_table
{ {
uint32_t bas_version; uint32_t bas_version;
uint32_t bas_revision; uint32_t bas_revision;
void (*remove_handler)(void); /* calling this will disable the BaS' hook into trap #0 */ void (*remove_handler)(void); /* calling this will disable the BaS' hook into trap #0 */
struct generic_interface *interfaces; struct generic_interface *interfaces;
}; };