Merge branch 'rebase' of git://git.l4dev.org/~amit/codezero into devel

Conflicts:
	conts/baremetal/baremetal5/main.c
This commit is contained in:
Bahadir Balban
2009-11-30 15:36:36 +02:00
3 changed files with 36 additions and 9 deletions

View File

@@ -149,8 +149,10 @@ int cap_read_all()
"complete CAP_CONTROL_READ_CAPS request.\n"); "complete CAP_CONTROL_READ_CAPS request.\n");
BUG(); BUG();
} }
#if 0
cap_array_print(&caparray); cap_array_print(&caparray);
#endif
return 0; return 0;
} }
@@ -272,6 +274,7 @@ char uart_generic_rx(int devno)
void handle_requests(void) void handle_requests(void)
{ {
u32 mr[MR_UNUSED_TOTAL];
l4id_t senderid; l4id_t senderid;
u32 tag; u32 tag;
int ret; int ret;
@@ -287,6 +290,10 @@ void handle_requests(void)
tag = l4_get_tag(); tag = l4_get_tag();
senderid = l4_get_sender(); senderid = l4_get_sender();
/* Read mrs not used by syslib */
for (int i = 0; i < MR_UNUSED_TOTAL; i++)
mr[i] = read_mr(MR_UNUSED_START + i);
/* /*
* TODO: * TODO:
* *
@@ -298,12 +305,18 @@ void handle_requests(void)
* the request should (currently) come from a task * the request should (currently) come from a task
* inside the current container * inside the current container
*/ */
/*
* FIXME: Right now we are talking to UART1 by default, we need to define protocol
* for sommunication with UART service
*/
switch (tag) { switch (tag) {
case L4_IPC_TAG_UART_SENDCHAR: case L4_IPC_TAG_UART_SENDCHAR:
uart_generic_tx(0, 1); /*FIXME: Fill in */ printf("got L4_IPC_TAG_UART_SENDCHAR with char %d\n ", mr[0]);
uart_generic_tx((char)mr[0], 0);
break; break;
case L4_IPC_TAG_UART_RECVCHAR: case L4_IPC_TAG_UART_RECVCHAR:
uart_generic_rx(1); /* FIXME: Fill in */ mr[0] = (int)uart_generic_rx(0);
break; break;
default: default:
printf("%s: Error received ipc from 0x%x residing " printf("%s: Error received ipc from 0x%x residing "

View File

@@ -193,7 +193,7 @@ int timer_setup_devices(void)
for (int i = 0; i < TIMERS_TOTAL; i++) { for (int i = 0; i < TIMERS_TOTAL; i++) {
/* Get one page from address pool */ /* Get one page from address pool */
timer[i].base = (unsigned long)l4_new_virtual(1); timer[i].base = (unsigned long)l4_new_virtual(1);
/* Map timers to a virtual address region */ /* Map timers to a virtual address region */
if (IS_ERR(l4_map((void *)__pfn_to_addr(timer_cap[i].start), if (IS_ERR(l4_map((void *)__pfn_to_addr(timer_cap[i].start),
(void *)timer[i].base, timer_cap[i].size, MAP_USR_IO_FLAGS, (void *)timer[i].base, timer_cap[i].size, MAP_USR_IO_FLAGS,
@@ -210,7 +210,7 @@ int timer_setup_devices(void)
SP804_TIMER_WRAPMODE_WRAPPING, SP804_TIMER_WIDTH32BIT, \ SP804_TIMER_WRAPMODE_WRAPPING, SP804_TIMER_WIDTH32BIT, \
SP804_TIMER_IRQDISABLE); SP804_TIMER_IRQDISABLE);
/* Enable Timer */ /* Enable Timer */
sp804_enable(timer[i].base, 1); sp804_enable(timer[i].base, 1);
} }
return 0; return 0;
@@ -221,7 +221,6 @@ static struct address_pool device_vaddr_pool;
/* /*
* Initialize a virtual address pool * Initialize a virtual address pool
* for mapping physical devices. * for mapping physical devices.
*/ */
void init_vaddr_pool(void) void init_vaddr_pool(void)
{ {
@@ -262,7 +261,6 @@ out_err:
void *l4_new_virtual(int npages) void *l4_new_virtual(int npages)
{ {
return address_new(&device_vaddr_pool, npages, PAGE_SIZE); return address_new(&device_vaddr_pool, npages, PAGE_SIZE);
} }
@@ -271,8 +269,16 @@ int timer_gettime(int devno)
return sp804_read_value(timer[devno].base); return sp804_read_value(timer[devno].base);
} }
void timer_sleep(int sec)
{
/*
* TODO: We need to have a timer struct already present to be used
* as reference for us. to implement this call
*/
}
void handle_requests(void) void handle_requests(void)
{ {
u32 mr[MR_UNUSED_TOTAL];
l4id_t senderid; l4id_t senderid;
u32 tag; u32 tag;
int ret; int ret;
@@ -287,7 +293,11 @@ void handle_requests(void)
/* Syslib conventional ipc data which uses first few mrs. */ /* Syslib conventional ipc data which uses first few mrs. */
tag = l4_get_tag(); tag = l4_get_tag();
senderid = l4_get_sender(); senderid = l4_get_sender();
/* Read mrs not used by syslib */
for (int i = 0; i < MR_UNUSED_TOTAL; i++)
mr[i] = read_mr(MR_UNUSED_START + i);
/* /*
* TODO: * TODO:
* *
@@ -304,6 +314,10 @@ void handle_requests(void)
timer_gettime(1); timer_gettime(1);
break; break;
case L4_IPC_TAG_TIMER_SLEEP:
timer_sleep(mr[0]);
break;
default: default:
printf("%s: Error received ipc from 0x%x residing " printf("%s: Error received ipc from 0x%x residing "
"in container %x with an unrecognized tag: " "in container %x with an unrecognized tag: "

View File

@@ -74,6 +74,6 @@ extern l4id_t pagerid;
/* For ipc to timer service (TODO: Shared mapping buffers???) */ /* For ipc to timer service (TODO: Shared mapping buffers???) */
#define L4_IPC_TAG_TIMER_GETTIME 55 #define L4_IPC_TAG_TIMER_GETTIME 55
#define L4_IPC_TAG_TIMER_SLEEP 56
#endif /* __IPCDEFS_H__ */ #endif /* __IPCDEFS_H__ */