Integrated libl4thread with libl4. Added device number to device caps.

A 16-bit device number or id further distinguishes a device on the
system in addition to the device type. This is meant to be used for
the very first identification of the device for further probing. Any
further info is available by userspace mapping and probing.
This commit is contained in:
Bahadir Balban
2009-11-22 21:34:18 +02:00
parent 26d469fccd
commit 877b2cedc7
29 changed files with 84 additions and 149 deletions

View File

@@ -375,6 +375,7 @@ static inline void pl011_rx_dma_disable(unsigned int base)
write(val, (base +PL011_UARTDMACR));
return;
}
int pl011_initialise(struct pl011_uart *uart);
#endif /* __PL011__UART__ */

View File

@@ -16,7 +16,7 @@ struct pl011_uart uart;
* Initialises the uart class data structures, and the device.
* Terminal-like operation is assumed for default settings.
*/
int pl011_initialise(struct pl011_uart * uart)
int pl011_initialise(struct pl011_uart *uart)
{
uart->frame_errors = 0;
uart->parity_errors = 0;

View File

@@ -30,14 +30,19 @@ Import('arch')
config = configuration_retrieve()
LIBMEM_RELDIR = 'conts/libmem'
LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
env = Environment(CC = config.user_toolchain + 'gcc',
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding'],
CCFLAGS = ['-g', '-std=gnu99', '-nostdlib', '-ffreestanding'],
LINKFLAGS = ['-nostdlib'],
ASFLAGS = ['-D__ASSEMBLY__'],
ENV = {'PATH' : os.environ['PATH']},
LIBS = 'gcc',
CPPPATH = ['include', 'include/l4lib/arch', join(PROJROOT, 'include') ])
env.Append(CPPPATH = [LIBMEM_DIR])
def create_symlinks(arch):
print os.getcwd()
prefix = 'conts/libl4/include/l4lib'

View File

@@ -17,12 +17,12 @@ config = configuration_retrieve()
arch = config.arch
env = Environment(CC = config.user_toolchain + 'gcc',
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding'],
CCFLAGS = ['-std=gnu99', '-g', '-nostdlib', '-ffreestanding'],
LINKFLAGS = ['-nostdlib'],
ASFLAGS = ['-D__ASSEMBLY__'],
ENV = {'PATH' : os.environ['PATH']},
LIBS = 'gcc',
CPPPATH = ['#include', '#include/l4lib/arch', join(PROJROOT,'include') ])
CPPPATH = ['#include', '#include/l4lib/arch', join(PROJROOT,'include')])
# TODO: There are errors in this code that -Werror gives problems with.

View File

@@ -6,7 +6,7 @@
#ifndef __ADDR_H__
#define __ADDR_H__
#include <idpool.h>
#include <l4lib/idpool.h>
/* Address pool to allocate from a range of addresses */
struct address_pool {

View File

@@ -1,6 +1,8 @@
#ifndef __BIT_H__
#define __BIT_H__
#include <l4lib/types.h>
unsigned int __clz(unsigned int bitvector);
int find_and_set_first_free_bit(u32 *word, unsigned int lastbit);
int find_and_set_first_free_contig_bits(u32 *word, unsigned int limit,

View File

@@ -1,8 +1,9 @@
#ifndef __IDPOOL_H__
#define __IDPOOL_H__
#include <bit.h>
#include <l4lib/bit.h>
#include <string.h>
#include <l4/macros.h>
#include INC_GLUE(memory.h)
struct id_pool {

View File

@@ -11,4 +11,22 @@ struct l4_thread_struct {
unsigned long stack_start; /* Thread start of stack */
};
/* -- Bora start -- */
/* A helper macro easing utcb space creation. */
#define DECLARE_UTCB_SPACE(name, entries) \
char name[(entries + PAGE_SIZE / UTCB_SIZE) * UTCB_SIZE] ALIGN(PAGE_SIZE);
int l4_set_stack_params(unsigned long stack_top,
unsigned long stack_bottom,
unsigned long stack_size);
int l4_set_utcb_params(unsigned long utcb_start, unsigned long utcb_end);
int l4_thread_create(struct task_ids *ids, unsigned int flags,
int (*func)(void *), void *arg);
void l4_thread_exit(int retval);
/* -- Bora start -- */
#endif /* __L4_THREAD_H__ */

View File

@@ -9,4 +9,14 @@
int utcb_init(void);
/* Bora start */
#include <l4lib/tcb.h>
/* Checks if l4_set_stack_params is called. */
#define IS_UTCB_SETUP() (lib_utcb_range_size)
unsigned long get_utcb_addr(struct tcb *task);
int delete_utcb_addr(struct tcb *task);
/* Bora end */
#endif /* __UTCB_H__ */

View File

@@ -4,7 +4,7 @@
*
* Copyright (C) 2007 Bahadir Balban
*/
#include <addr.h>
#include <l4lib/addr.h>
#include <stdio.h>
/*

View File

@@ -3,8 +3,9 @@
*
* Copyright (C) 2007 Bahadir Balban
*/
#include <bit.h>
#include <l4lib/bit.h>
#include <stdio.h>
#include <l4/macros.h>
#include INC_GLUE(memory.h)
/* Emulation of ARM's CLZ (count leading zeroes) instruction */

View File

@@ -4,7 +4,7 @@
*
* Copyright (C) 2009 B Labs Ltd.
*/
#include <idpool.h>
#include <l4lib/idpool.h>
#include <stdio.h>
#include <l4/api/errno.h>
#include <malloc/malloc.h>

View File

@@ -4,10 +4,10 @@
* Copyright © 2009 B Labs Ltd.
*/
#include <stdio.h>
#include <addr.h>
#include <l4/api/errno.h>
#include <l4lib/addr.h>
#include <l4lib/mutex.h>
#include <stack.h>
#include <l4lib/stack.h>
/* Extern declarations */
extern struct l4_mutex lib_mutex;

View File

@@ -7,7 +7,8 @@
#include <malloc/malloc.h>
#include <l4/api/errno.h>
#include <l4/api/thread.h>
#include <tcb.h>
#include <l4lib/tcb.h>
#include <l4/macros.h>
/* Global task list. */
struct global_list global_tasks = {

View File

@@ -11,8 +11,8 @@
#include <l4/api/thread.h>
#include <l4/api/errno.h>
#include <malloc/malloc.h>
#include <utcb.h>
#include <stack.h>
#include <l4lib/utcb.h>
#include <l4lib/stack.h>
/* Extern declarations */
extern void setup_new_thread(void);

View File

@@ -4,8 +4,8 @@
* Copyright © 2009 B Labs Ltd.
*/
#include <stdio.h>
#include <addr.h>
#include <utcb-common.h>
#include <l4lib/addr.h>
#include <l4lib/utcb-common.h>
#include <malloc/malloc.h>
/* Globally disjoint utcb virtual region pool */

View File

@@ -4,13 +4,13 @@
* Copyright (C) 2009 B Labs Ltd.
*/
#include <stdio.h>
#include <malloc/malloc.h>
#include <l4/api/errno.h>
#include <l4lib/arch/syscalls.h>
#include <l4lib/exregs.h>
#include <errno.h>
#include <malloc/malloc.h>
#include <idpool.h>
#include <utcb-common.h>
#include <utcb.h>
#include <l4lib/idpool.h>
#include <l4lib/utcb-common.h>
#include <l4lib/utcb.h>
/* Extern declarations */
extern struct global_list global_tasks;

View File

@@ -1,32 +0,0 @@
# -*- mode: python; coding: utf-8; -*-
#
# Codezero -- Virtualization microkernel for embedded systems.
#
# Copyright © 2009 B Labs Ltd
import os, sys
# Get global paths
PROJRELROOT = '../..'
sys.path.append(PROJRELROOT)
from config.projpaths import *
Import('env')
LIBMEM_RELDIR = 'conts/libmem'
LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
LIBL4_RELDIR = 'conts/libl4'
LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR)
LIBL4_INCLUDE = join(LIBL4_DIR, 'include')
e = env.Clone()
e.Append(CPPPATH = ['include/l4thread', LIBMEM_DIR, LIBL4_INCLUDE])
source = [Glob('*.[cS]') + Glob('src/*.[cS]') + Glob('src/arch/*.[cS]')]
objects = e.StaticObject(source)
library = e.StaticLibrary('l4thread', objects)
Return('library')

View File

@@ -1,22 +0,0 @@
/*
* Thread creation userspace helpers
*
* Copyright (C) 2009 B Labs Ltd.
*/
#ifndef __LIB_THREAD_H__
#define __LIB_THREAD_H__
/* A helper macro easing utcb space creation. */
#define DECLARE_UTCB_SPACE(name, entries) \
char name[(entries + PAGE_SIZE / UTCB_SIZE) * UTCB_SIZE] ALIGN(PAGE_SIZE);
int l4_set_stack_params(unsigned long stack_top,
unsigned long stack_bottom,
unsigned long stack_size);
int l4_set_utcb_params(unsigned long utcb_start, unsigned long utcb_end);
int l4_thread_create(struct task_ids *ids, unsigned int flags,
int (*func)(void *), void *arg);
void l4_thread_exit(int retval);
#endif /* __LIB_THREAD_H__ */

View File

@@ -1,17 +0,0 @@
/*
* UTCB handling helper routines.
*
* Copyright (C) 2009 B Labs Ltd.
*/
#ifndef __LIB_UTCB_H__
#define __LIB_UTCB_H__
#include <tcb.h>
/* Checks if l4_set_stack_params is called. */
#define IS_UTCB_SETUP() (lib_utcb_range_size)
unsigned long get_utcb_addr(struct tcb *task);
int delete_utcb_addr(struct tcb *task);
#endif /* __LIB_UTCB_H__ */

View File

@@ -1 +0,0 @@
arch-arm/