added Firetos' radeon PCI driver

This commit is contained in:
Markus Fröschle
2013-12-26 21:20:47 +00:00
parent 9ca272dd76
commit 0d845e2c14
23 changed files with 9822 additions and 93 deletions

View File

@@ -44,6 +44,15 @@
#include "nbuf.h"
#include "nif.h"
#include "fec.h"
#include "interrupts.h"
#include "exceptions.h"
#define BAS_DEBUG
#if defined(BAS_DEBUG)
#define dbg(format, arg...) do { xprintf("DEBUG: " format "\r\n", ##arg); } while (0)
#else
#define dbg(format, arg...) do { ; } while (0)
#endif
/* imported routines */
extern int mmu_init();
@@ -61,11 +70,6 @@ extern uint8_t _EMUTOS[];
extern uint8_t _EMUTOS_SIZE[];
#define EMUTOS_SIZE ((uint32_t)_EMUTOS_SIZE) /* size of EmuTOS, in bytes */
NIF nif1;
#ifdef MACHINE_M5484LITE
NIF nif2;
#endif
/*
* check if it is possible to transfer data to PIC
*/
@@ -126,7 +130,7 @@ void pic_init(void)
if (answer[0] != 'O' || answer[1] != 'K' || answer[2] != '!')
{
xprintf("PIC initialization failed. Already initialized?\r\n");
dbg("%s: PIC initialization failed. Already initialized?\r\n", __FUNCTION__);
}
else
{
@@ -236,24 +240,47 @@ void disable_coldfire_interrupts()
NIF nif1;
#ifdef MACHINE_M5484LITE
NIF nif2;
#endif
static IP_INFO ip_info;
static ARP_INFO arp_info;
void network_init(void)
{
uint8_t mac[6] = {0x00, 0x04, 0x9f, 0x01, 0x01, 0x01}; /* this is a Freescale MAC address */
uint8_t bc[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; /* this is our broadcast MAC address */
IP_ADDR myip = {0, 0, 0, 0};
IP_ADDR gateway = {0, 0, 0, 0};
IP_ADDR netmask = {0, 0, 0, 0};
IP_INFO info;
IP_ADDR myip = {192, 168, 1, 100};
IP_ADDR gateway = {192, 168, 1, 1};
IP_ADDR netmask = {255, 255, 255, 0};
int vector;
int (*handler)(void *, void *);
handler = fec0_interrupt_handler;
vector = 103;
if (!isr_register_handler(ISR_DBUG_ISR, vector, handler, NULL, (void *) &nif1))
{
dbg("%s: unable to register handler\r\n", __FUNCTION__);
return;
}
fec_eth_setup(0, FEC_MODE_MII, FEC_MII_100BASE_TX, FEC_MII_FULL_DUPLEX, mac);
nif_init(&nif1);
nif1.mtu = ETH_MTU;
nif1.send = fec0_send;
fec_eth_setup(0, FEC_MODE_MII, FEC_MII_100BASE_TX, FEC_MII_FULL_DUPLEX, mac);
fec_eth_setup(1, FEC_MODE_MII, FEC_MII_100BASE_TX, FEC_MII_FULL_DUPLEX, mac);
memcpy(nif1.hwa, mac, 6);
memcpy(nif1.broadcast, bc, 6);
ip_init(&info, myip, gateway, netmask);
udp_init();
arp_init(&arp_info);
nif_bind_protocol(&nif1, ETH_FRM_ARP, arp_handler, (void *) &arp_info);
ip_init(&ip_info, myip, gateway, netmask);
nif_bind_protocol(&nif1, ETH_FRM_IP, ip_handler, (void *) &ip_info);
bootp_request(&nif1, 0);
}
@@ -324,6 +351,7 @@ void BaS(void)
enable_coldfire_interrupts();
#ifdef _NOT_USED_
screen_init();
/* experimental */
@@ -346,6 +374,7 @@ void BaS(void)
}
}
}
#endif /* _NOT_USED_ */
#endif /* MACHINE_FIREBEE */
@@ -392,7 +421,8 @@ void BaS(void)
xprintf("BaS initialization finished, enable interrupts\r\n");
enable_coldfire_interrupts();
// network_init();
set_ipl(0);
network_init();
xprintf("call EmuTOS\r\n");
ROM_HEADER* os_header = (ROM_HEADER*)TOS;

View File

@@ -295,12 +295,19 @@ init_vec_loop:
lea handler_psc3(pc),a1
// PSC3 interrupt source = 32
move.l a1,(INT_SOURCE_PSC3 + 64) * 4(a0)
// timer vectors (used for video page copy on the FireBee)
// timer vectors (triggers when vbashi gets changed, used for video page copy)
lea handler_gpt0(pc),a1
// GPT0 interrupt source = 62
move.l a1,(INT_SOURCE_GPT0 + 64) * 4(a0)
#endif /* MACHINE_FIREBEE */
lea _lowlevel_isr_handler,a1
move.l a1,(INT_SOURCE_GPT1 + 64) * 4(a0)
move.l a1,(INT_SOURCE_GPT2 + 64) * 4(a0)
move.l a1,(INT_SOURCE_GPT3 + 64) * 4(a0)
move.l a1,(INT_SOURCE_FEC0 + 64) * 4(a0)
move.l a1,(INT_SOURCE_FEC1 + 64) * 4(a0)
move.l (sp)+,a2 // Restore registers
rts
/*
@@ -462,7 +469,6 @@ flpoow:
halt
nop
nop
#endif /* _NOT_USED */
irq1:
@@ -977,10 +983,10 @@ video_chg_end:
* low-level interrupt service routine for routines registered with
* isr_register_handler()
*/
.global _asm_isr_handler
.global _lowlevel_isr_handler
.extern _isr_execute_handler
_asm_isr_handler:
_lowlevel_isr_handler:
link a6,#-4*4
movem.l d0-d1/a0-a1,(sp)
@@ -991,13 +997,11 @@ _asm_isr_handler:
jsr _isr_execute_handler
lea 4(sp),sp
cmp.l #1,d0
//beq handled
#ifdef _NOT_USED_
beq handled
nothandled:
movem.l (sp),d0-d1/a0-a1
unlk a6
jmp asm_exception_handler
#endif /* _NOT_USED_ */
jmp std_exc_vec
handled:
movem.l (sp),d0-d1/a0-a1
unlk a6

View File

@@ -34,6 +34,13 @@
extern void (*rt_vbr[])(void);
#define VBR rt_vbr
#define IRQ_DEBUG
#if defined(IRQ_DEBUG)
#define dbg(format, arg...) do { xprintf("DEBUG: " format "\r\n", ##arg); } while (0)
#else
#define dbg(format, arg...) do { ; } while (0)
#endif
/*
* register an interrupt handler at the Coldfire interrupt controller and add the handler to
* the interrupt vector table
@@ -113,8 +120,7 @@ void isr_init(void)
}
int isr_register_handler (
int type, int vector,
int isr_register_handler(int type, int vector,
int (*handler)(void *, void *), void *hdev, void *harg)
{
/*
@@ -131,7 +137,8 @@ int isr_register_handler (
((type != ISR_DBUG_ISR) && (type != ISR_USER_ISR)) ||
(handler == NULL))
{
return true;
dbg("%s: illegal type, vector or handler!\r\n", __FUNCTION__);
return false;
}
for (index = 0; index < UIF_MAX_ISR_ENTRY; index++)
@@ -140,7 +147,8 @@ int isr_register_handler (
(isrtab[index].type == type))
{
/* only one entry of each type per vector */
return 0;
dbg("%s: already set handler with this type and vector (%d, %d)\r\n", __FUNCTION__, type, vector);
return false;
}
if (isrtab[index].vector == 0)
@@ -150,9 +158,10 @@ int isr_register_handler (
isrtab[index].handler = handler;
isrtab[index].hdev = hdev;
isrtab[index].harg = harg;
return 1;
return true;
}
}
dbg("%s: no available slots\n\t", __FUNCTION__);
return false; /* no available slots */
}