Thread: [Tinyx-devel] [PATCH] stddef.h fot arm7 arch
Status: Planning
Brought to you by:
davidcohen
From: David C. <da...@gm...> - 2007-12-11 23:09:15
|
From: David Cohen <david@ghandi.localdomain> Adding the stddef.h file for arm7 architecture. This file has (and will have more) the C standards for arm7. Signed-off-by: David Cohen <da...@gm...> --- include/asm-arm7/stddef.h | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) create mode 100644 include/asm-arm7/stddef.h diff --git a/include/asm-arm7/stddef.h b/include/asm-arm7/stddef.h new file mode 100644 index 0000000..03176e8 --- /dev/null +++ b/include/asm-arm7/stddef.h @@ -0,0 +1,6 @@ +#ifndef __ASM_STDDEF_H +#define __ASM_STDDEF_H + +#define NULL ((void *)0) + +#endif /* __ASM_STDDEF_H */ -- 1.5.3.5 |
From: David C. <da...@gm...> - 2007-12-11 23:09:16
|
Signed-off-by: David Cohen <da...@gm...> --- arch/arm7/common/platform_device.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-) diff --git a/arch/arm7/common/platform_device.c b/arch/arm7/common/platform_device.c index f7626a3..a2b1a47 100644 --- a/arch/arm7/common/platform_device.c +++ b/arch/arm7/common/platform_device.c @@ -1,6 +1,7 @@ #include <tinyx/device.h> #include <tinyx/kernel.h> #include <asm/io.h> +#include <asm/device.h> #include <asm/platform_device.h> static void platform_writeb(struct device *dev, @@ -28,22 +29,22 @@ static unsigned char platform_readb(struct device *dev, unsigned long addr) static unsigned int platform_readw(struct device *dev, unsigned long addr) { - return __raw_readb(addr); + return __raw_readw(addr); } static unsigned long platform_readl(struct device *dev, unsigned long addr) { - return __raw_readb(addr); + return __raw_readl(addr); } static struct bus_type platform_bus = { - .name = "platform", - .writeb = platform_writeb, - .writew = platform_writew, - .writel = platform_writel, - .readb = platform_readb, - .readw = platform_readw, - .readl = platform_readl, + .type = BUS_TYPE_PLATFORM, + .writeb = platform_writeb, + .writew = platform_writew, + .writel = platform_writel, + .readb = platform_readb, + .readw = platform_readw, + .readl = platform_readl, }; int register_platform_device(struct device *dev) -- 1.5.3.5 |
From: David C. <da...@gm...> - 2007-12-11 23:09:25
|
Signed-off-by: David Cohen <da...@gm...> --- Makefile | 2 +- include/tinyx/libc/string.h | 6 ++++++ lib/Makefile | 1 + lib/libc/Makefile | 1 + lib/libc/string.c | 13 +++++++++++++ 5 files changed, 22 insertions(+), 1 deletions(-) create mode 100644 include/tinyx/libc/string.h create mode 100644 lib/Makefile create mode 100644 lib/libc/Makefile create mode 100644 lib/libc/string.c diff --git a/Makefile b/Makefile index bae3b3f..0ca9772 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ all-sources = $(shell git-ls-files) export ARCH AS LD CC AR NM STRIP OBJCOPY OBJDUMP AWK CFLAGS PYTHON INCLUDES -tinyx.dirs = arch/ kernel/ +tinyx.dirs = lib/ arch/ kernel/ tinyx.objs = $(patsubst %/, %/tyx_part.o, $(tinyx.dirs)) diff --git a/include/tinyx/libc/string.h b/include/tinyx/libc/string.h new file mode 100644 index 0000000..2455bcc --- /dev/null +++ b/include/tinyx/libc/string.h @@ -0,0 +1,6 @@ +#ifndef __TINYX_LIBC_STRING_H +#define __TINYX_LIBC_STRING_H + +int strcmp(const char *str1, const char *str2); + +#endif /* __TINYX_LIBC_STRING_H */ diff --git a/lib/Makefile b/lib/Makefile new file mode 100644 index 0000000..3231475 --- /dev/null +++ b/lib/Makefile @@ -0,0 +1 @@ +obj-y = libc/ diff --git a/lib/libc/Makefile b/lib/libc/Makefile new file mode 100644 index 0000000..f6fde72 --- /dev/null +++ b/lib/libc/Makefile @@ -0,0 +1 @@ +obj-y += string.o diff --git a/lib/libc/string.c b/lib/libc/string.c new file mode 100644 index 0000000..bc9bfb3 --- /dev/null +++ b/lib/libc/string.c @@ -0,0 +1,13 @@ +#include <tinyx/libc/string.h> + +int strcmp(const char *str1, const char *str2) +{ + while ((*str1) == (*str2)) { + if (!*str1++) + return 0; + str2++; + } + while ((*str1++) && (*str2++)); + + return (*str1) ? 1 : -1; +} -- 1.5.3.5 |
From: Felipe B. <me...@fe...> - 2007-12-11 23:19:08
|
On Tue, 11 Dec 2007 19:08:21 -0400, David Cohen <da...@gm...> wrote: > Signed-off-by: David Cohen <da...@gm...> Acked-by: Felipe Balbi <me...@fe...> > --- > Makefile | 2 +- > include/tinyx/libc/string.h | 6 ++++++ > lib/Makefile | 1 + > lib/libc/Makefile | 1 + > lib/libc/string.c | 13 +++++++++++++ > 5 files changed, 22 insertions(+), 1 deletions(-) > create mode 100644 include/tinyx/libc/string.h > create mode 100644 lib/Makefile > create mode 100644 lib/libc/Makefile > create mode 100644 lib/libc/string.c > > diff --git a/Makefile b/Makefile > index bae3b3f..0ca9772 100644 > --- a/Makefile > +++ b/Makefile > @@ -30,7 +30,7 @@ all-sources = $(shell git-ls-files) > > export ARCH AS LD CC AR NM STRIP OBJCOPY OBJDUMP AWK CFLAGS PYTHON > INCLUDES > > -tinyx.dirs = arch/ kernel/ > +tinyx.dirs = lib/ arch/ kernel/ > > tinyx.objs = $(patsubst %/, %/tyx_part.o, $(tinyx.dirs)) > > diff --git a/include/tinyx/libc/string.h b/include/tinyx/libc/string.h > new file mode 100644 > index 0000000..2455bcc > --- /dev/null > +++ b/include/tinyx/libc/string.h > @@ -0,0 +1,6 @@ > +#ifndef __TINYX_LIBC_STRING_H > +#define __TINYX_LIBC_STRING_H > + > +int strcmp(const char *str1, const char *str2); > + > +#endif /* __TINYX_LIBC_STRING_H */ > diff --git a/lib/Makefile b/lib/Makefile > new file mode 100644 > index 0000000..3231475 > --- /dev/null > +++ b/lib/Makefile > @@ -0,0 +1 @@ > +obj-y = libc/ > diff --git a/lib/libc/Makefile b/lib/libc/Makefile > new file mode 100644 > index 0000000..f6fde72 > --- /dev/null > +++ b/lib/libc/Makefile > @@ -0,0 +1 @@ > +obj-y += string.o > diff --git a/lib/libc/string.c b/lib/libc/string.c > new file mode 100644 > index 0000000..bc9bfb3 > --- /dev/null > +++ b/lib/libc/string.c > @@ -0,0 +1,13 @@ > +#include <tinyx/libc/string.h> > + > +int strcmp(const char *str1, const char *str2) > +{ > + while ((*str1) == (*str2)) { > + if (!*str1++) > + return 0; > + str2++; > + } > + while ((*str1++) && (*str2++)); > + > + return (*str1) ? 1 : -1; > +} > -- > 1.5.3.5 > > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Tinyx-devel mailing list > Tin...@li... > https://lists.sourceforge.net/lists/listinfo/tinyx-devel -- Best Regards, Felipe Balbi http://felipebalbi.com me...@fe... |
From: Felipe B. <me...@fe...> - 2007-12-11 23:17:04
|
On Tue, 11 Dec 2007 19:08:20 -0400, David Cohen <da...@gm...> wrote: > Signed-off-by: David Cohen <da...@gm...> Acked-by: Felipe Balbi <me...@fe...> > --- > arch/arm7/common/platform_device.c | 19 ++++++++++--------- > 1 files changed, 10 insertions(+), 9 deletions(-) > > diff --git a/arch/arm7/common/platform_device.c > b/arch/arm7/common/platform_device.c > index f7626a3..a2b1a47 100644 > --- a/arch/arm7/common/platform_device.c > +++ b/arch/arm7/common/platform_device.c > @@ -1,6 +1,7 @@ > #include <tinyx/device.h> > #include <tinyx/kernel.h> > #include <asm/io.h> > +#include <asm/device.h> > #include <asm/platform_device.h> > > static void platform_writeb(struct device *dev, > @@ -28,22 +29,22 @@ static unsigned char platform_readb(struct device > *dev, unsigned long addr) > > static unsigned int platform_readw(struct device *dev, unsigned long > addr) > { > - return __raw_readb(addr); > + return __raw_readw(addr); > } > > static unsigned long platform_readl(struct device *dev, unsigned long > addr) > { > - return __raw_readb(addr); > + return __raw_readl(addr); > } > > static struct bus_type platform_bus = { > - .name = "platform", > - .writeb = platform_writeb, > - .writew = platform_writew, > - .writel = platform_writel, > - .readb = platform_readb, > - .readw = platform_readw, > - .readl = platform_readl, > + .type = BUS_TYPE_PLATFORM, > + .writeb = platform_writeb, > + .writew = platform_writew, > + .writel = platform_writel, > + .readb = platform_readb, > + .readw = platform_readw, > + .readl = platform_readl, > }; > > int register_platform_device(struct device *dev) > -- > 1.5.3.5 > > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Tinyx-devel mailing list > Tin...@li... > https://lists.sourceforge.net/lists/listinfo/tinyx-devel -- Best Regards, Felipe Balbi http://felipebalbi.com me...@fe... |
From: David C. <da...@gm...> - 2007-12-11 23:09:17
|
Signed-off-by: David Cohen <da...@gm...> --- include/tinyx/list.h | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/tinyx/list.h b/include/tinyx/list.h index 0272f86..55020b1 100644 --- a/include/tinyx/list.h +++ b/include/tinyx/list.h @@ -22,7 +22,7 @@ struct list_head { * * @list: the list being initialized */ -static inline void init_list_head(struct list_head *list) +static void inline init_list_head(struct list_head *list) { list->next = list; list->prev = list; @@ -32,11 +32,13 @@ static inline void init_list_head(struct list_head *list) * list_add_tail - add a new entry at the end of the list * * @head: the head of the current list - * @new: the member to insert + * @queue: the member to insert */ -#define list_add_tail(head, new) \ - (head)->next = (new)->next; \ - (new)->next = (head); +static void inline list_add_tail(struct list_head *head, struct list_head *queue) +{ + head->next = queue->next; + queue->next = head; +} /* * list_del_tail - delete the tail from the list -- 1.5.3.5 |
From: David C. <da...@gm...> - 2007-12-11 23:09:24
|
This patch updates the device subsystem: - implements the register_* on device.c - code cleanups on device.h - adding ioctl on bus Signed-off-by: David Cohen <da...@gm...> --- include/tinyx/device.h | 27 ++++++++++----- kernel/device.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 104 insertions(+), 12 deletions(-) diff --git a/include/tinyx/device.h b/include/tinyx/device.h index b5de65a..2916925 100644 --- a/include/tinyx/device.h +++ b/include/tinyx/device.h @@ -1,6 +1,8 @@ #ifndef __TINYX_DEVICE_H #define __TINYX_DEVICE_H +#include <tinyx/list.h> + struct bus_type; struct device_driver; struct device; @@ -22,26 +24,33 @@ struct resource { }; struct bus_type { - struct list_head *head; - const char *name; - int id; + struct list_head queue; + unsigned int type; void *private_data; int (*probe) (struct bus_type *bus); int (*remove) (struct bus_type *bus); - int (*match) (struct device *dev, struct device_driver *drv); + int (*match) (struct bus_type *bus, + struct device *dev, struct device_driver *drv); - void (*writeb) (struct device *dev, unsigned char val, unsigned long addr); - void (*writew) (struct device *dev, unsigned int val, unsigned long addr); - void (*writel) (struct device *dev, unsigned long val, unsigned long addr); + /* These write* and read* exists in order to avoid if's + * inside critial buses. */ + void (*writeb) (struct device *dev, + unsigned char val, unsigned long addr); + void (*writew) (struct device *dev, + unsigned int val, unsigned long addr); + void (*writel) (struct device *dev, + unsigned long val, unsigned long addr); unsigned char (*readb) (struct device *dev, unsigned long addr); unsigned int (*readw) (struct device *dev, unsigned long addr); unsigned long (*readl) (struct device *dev, unsigned long addr); + + void (*ioctl) (struct device *dev, void *data, int type); }; struct device_driver { - struct list_head *head; + struct list_head queue; const char *name; int (*probe) (struct device *dev); @@ -49,7 +58,7 @@ struct device_driver { }; struct device { - struct list_head *head; + struct list_head queue; const char *name; int id; struct device_driver *drv; diff --git a/kernel/device.c b/kernel/device.c index 0b11433..a7baeb1 100644 --- a/kernel/device.c +++ b/kernel/device.c @@ -1,16 +1,99 @@ #include <tinyx/device.h> +#include <tinyx/list.h> +#include <tinyx/libc/string.h> + +DECLARE_LIST_HEAD(bus_list); +DECLARE_LIST_HEAD(driver_list); +DECLARE_LIST_HEAD(device_list); + +static void *match_device_driver(struct device *dev, struct device_driver *drv) +{ + struct list_head *list; + struct list_head *entry; + void *item; + int ret; + + if (!dev) + list = &device_list; + else + list = &driver_list; + + list_for_each(list, entry) { + if (!dev) { + item = list_entry(entry, struct device, queue); + ret = strcmp(((struct device *)item)->name, drv->name); + } else { + item = list_entry(entry, struct device_driver, queue); + ret = strcmp(dev->name, + ((struct device_driver *)item)->name); + } + if (!ret) + break; + else + item = NULL; + } + + return item; +} int register_bus_type(struct bus_type *bus) { - return 0; + int ret = 0; + + if (bus == NULL) + return -ENODEV; + + if (bus->probe) + ret = bus->probe(bus); + if (!ret) + list_add_tail(&bus_list, &bus->queue); + + return ret; } int register_device_driver(struct device_driver *drv) { - return 0; + int ret = 0; + struct device *dev; + + if (drv == NULL) + return -ENODEV; + + dev = match_device_driver(NULL, drv); + if (dev) { + if (dev->bus->match) + ret = dev->bus->match(dev->bus, dev, drv); + if (!ret && drv->probe) + ret = drv->probe(dev); + } + + if (!ret) + list_add_tail(&driver_list, &drv->queue); + + return ret; } int register_device(struct device *dev, struct bus_type *bus) { - return 0; + int ret = 0; + struct device_driver *drv; + + if (dev == NULL) + return -ENODEV; + + dev->bus = bus; + drv = match_device_driver(dev, NULL); + if (drv) { + if (bus->match) + ret = bus->match(bus, dev, drv); + if (!ret && drv->probe) + ret = drv->probe(dev); + } + + if (!ret) + list_add_tail(&device_list, &dev->queue); + else + dev->bus = NULL; + + return ret; } -- 1.5.3.5 |
From: Felipe B. <me...@fe...> - 2007-12-11 23:22:44
|
On Tue, 11 Dec 2007 19:08:23 -0400, David Cohen <da...@gm...> wrote: > This patch updates the device subsystem: > - implements the register_* on device.c > - code cleanups on device.h > - adding ioctl on bus > > Signed-off-by: David Cohen <da...@gm...> Acked-by: Felipe Balbi <me...@fe...> > --- > include/tinyx/device.h | 27 ++++++++++----- > kernel/device.c | 89 > ++++++++++++++++++++++++++++++++++++++++++++++-- > 2 files changed, 104 insertions(+), 12 deletions(-) > > diff --git a/include/tinyx/device.h b/include/tinyx/device.h > index b5de65a..2916925 100644 > --- a/include/tinyx/device.h > +++ b/include/tinyx/device.h > @@ -1,6 +1,8 @@ > #ifndef __TINYX_DEVICE_H > #define __TINYX_DEVICE_H > > +#include <tinyx/list.h> > + > struct bus_type; > struct device_driver; > struct device; > @@ -22,26 +24,33 @@ struct resource { > }; > > struct bus_type { > - struct list_head *head; > - const char *name; > - int id; > + struct list_head queue; > + unsigned int type; > void *private_data; > > int (*probe) (struct bus_type *bus); > int (*remove) (struct bus_type *bus); > - int (*match) (struct device *dev, struct device_driver *drv); > + int (*match) (struct bus_type *bus, > + struct device *dev, struct device_driver *drv); > > - void (*writeb) (struct device *dev, unsigned char val, unsigned long addr); > - void (*writew) (struct device *dev, unsigned int val, unsigned long addr); > - void (*writel) (struct device *dev, unsigned long val, unsigned long addr); > + /* These write* and read* exists in order to avoid if's > + * inside critial buses. */ > + void (*writeb) (struct device *dev, > + unsigned char val, unsigned long addr); > + void (*writew) (struct device *dev, > + unsigned int val, unsigned long addr); > + void (*writel) (struct device *dev, > + unsigned long val, unsigned long addr); > > unsigned char (*readb) (struct device *dev, unsigned long addr); > unsigned int (*readw) (struct device *dev, unsigned long addr); > unsigned long (*readl) (struct device *dev, unsigned long addr); > + > + void (*ioctl) (struct device *dev, void *data, int type); > }; > > struct device_driver { > - struct list_head *head; > + struct list_head queue; > const char *name; > > int (*probe) (struct device *dev); > @@ -49,7 +58,7 @@ struct device_driver { > }; > > struct device { > - struct list_head *head; > + struct list_head queue; > const char *name; > int id; > struct device_driver *drv; > diff --git a/kernel/device.c b/kernel/device.c > index 0b11433..a7baeb1 100644 > --- a/kernel/device.c > +++ b/kernel/device.c > @@ -1,16 +1,99 @@ > #include <tinyx/device.h> > +#include <tinyx/list.h> > +#include <tinyx/libc/string.h> > + > +DECLARE_LIST_HEAD(bus_list); > +DECLARE_LIST_HEAD(driver_list); > +DECLARE_LIST_HEAD(device_list); > + > +static void *match_device_driver(struct device *dev, struct device_driver > *drv) > +{ > + struct list_head *list; > + struct list_head *entry; > + void *item; > + int ret; > + > + if (!dev) > + list = &device_list; > + else > + list = &driver_list; > + > + list_for_each(list, entry) { > + if (!dev) { > + item = list_entry(entry, struct device, queue); > + ret = strcmp(((struct device *)item)->name, drv->name); > + } else { > + item = list_entry(entry, struct device_driver, queue); > + ret = strcmp(dev->name, > + ((struct device_driver *)item)->name); > + } > + if (!ret) > + break; > + else > + item = NULL; > + } > + > + return item; > +} > > int register_bus_type(struct bus_type *bus) > { > - return 0; > + int ret = 0; > + > + if (bus == NULL) > + return -ENODEV; > + > + if (bus->probe) > + ret = bus->probe(bus); > + if (!ret) > + list_add_tail(&bus_list, &bus->queue); > + > + return ret; > } > > int register_device_driver(struct device_driver *drv) > { > - return 0; > + int ret = 0; > + struct device *dev; > + > + if (drv == NULL) > + return -ENODEV; > + > + dev = match_device_driver(NULL, drv); > + if (dev) { > + if (dev->bus->match) > + ret = dev->bus->match(dev->bus, dev, drv); > + if (!ret && drv->probe) > + ret = drv->probe(dev); > + } > + > + if (!ret) > + list_add_tail(&driver_list, &drv->queue); > + > + return ret; > } > > int register_device(struct device *dev, struct bus_type *bus) > { > - return 0; > + int ret = 0; > + struct device_driver *drv; > + > + if (dev == NULL) > + return -ENODEV; > + > + dev->bus = bus; > + drv = match_device_driver(dev, NULL); > + if (drv) { > + if (bus->match) > + ret = bus->match(bus, dev, drv); > + if (!ret && drv->probe) > + ret = drv->probe(dev); > + } > + > + if (!ret) > + list_add_tail(&device_list, &dev->queue); > + else > + dev->bus = NULL; > + > + return ret; > } > -- > 1.5.3.5 > > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Tinyx-devel mailing list > Tin...@li... > https://lists.sourceforge.net/lists/listinfo/tinyx-devel -- Best Regards, Felipe Balbi http://felipebalbi.com me...@fe... |
From: David C. <da...@gm...> - 2007-12-11 23:09:30
|
Signed-off-by: David Cohen <da...@gm...> --- include/tinyx/kernel.h | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/tinyx/kernel.h b/include/tinyx/kernel.h index 8a317b1..3b55653 100644 --- a/include/tinyx/kernel.h +++ b/include/tinyx/kernel.h @@ -1,16 +1,19 @@ #ifndef __TINYX_KERNEL_H #define __TINYX_KERNEL_H +#include <asm/stddef.h> +#include <tinyx/errno.h> + typedef int (*initcall_t)(void); #define __initcall(level, fn) \ static initcall_t __initcall_##fn __attribute__ ((section (".initcall." level ".init"))) = fn -#define first_init(fn) __initcall("0", fn) -#define early_init(fn) __initcall("1", fn) -#define standard_init(fn) __initcall("2", fn) -#define late_init(fn) __initcall("3", fn) -#define last_init(fn) __initcall("4", fn) +#define first_init(fn) __initcall("0", fn) +#define early_init(fn) __initcall("1", fn) +#define standard_init(fn) __initcall("2", fn) +#define late_init(fn) __initcall("3", fn) +#define last_init(fn) __initcall("4", fn) #define __init __attribute__ ((__section__ (".init_functions"))) -- 1.5.3.5 |
From: David C. <da...@gm...> - 2007-12-11 23:09:33
|
Adding the device.h for arm7 arch. Signed-off-by: David Cohen <da...@gm...> --- include/asm-arm7/device.h | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) create mode 100644 include/asm-arm7/device.h diff --git a/include/asm-arm7/device.h b/include/asm-arm7/device.h new file mode 100644 index 0000000..93ea2fd --- /dev/null +++ b/include/asm-arm7/device.h @@ -0,0 +1,11 @@ +#ifndef __ASM_DEVICE_H +#define __ASM_DEVICE_H + +/* ARM7 Buses */ +#define BUS_TYPE_PLATFORM 0x00 +#define BUS_TYPE_I2C 0x01 +#define BUS_TYPE_SPI 0x02 +#define BUS_TYPE_UART 0x03 +#define BUS_TYPE_USB 0x04 + +#endif /* __ASM_DEVICE_H */ -- 1.5.3.5 |
From: Felipe B. <me...@fe...> - 2007-12-11 23:31:15
|
We should start putting theses discussions on the list so other eventual users will be able to follow our plans, in any case we decided to have those bus type defines in order to encapsulate the bus implementation to the driver. The driver doesn't need to know anything about the bus it should just call a "write" function, and that function would handle all bus specific logic. On Tue, 11 Dec 2007 19:08:25 -0400, David Cohen <da...@gm...> wrote: > Adding the device.h for arm7 arch. > > Signed-off-by: David Cohen <da...@gm...> Acked-by: Felipe Balbi <me...@fe...> > --- > include/asm-arm7/device.h | 11 +++++++++++ > 1 files changed, 11 insertions(+), 0 deletions(-) > create mode 100644 include/asm-arm7/device.h > > diff --git a/include/asm-arm7/device.h b/include/asm-arm7/device.h > new file mode 100644 > index 0000000..93ea2fd > --- /dev/null > +++ b/include/asm-arm7/device.h > @@ -0,0 +1,11 @@ > +#ifndef __ASM_DEVICE_H > +#define __ASM_DEVICE_H > + > +/* ARM7 Buses */ > +#define BUS_TYPE_PLATFORM 0x00 > +#define BUS_TYPE_I2C 0x01 > +#define BUS_TYPE_SPI 0x02 > +#define BUS_TYPE_UART 0x03 > +#define BUS_TYPE_USB 0x04 > + > +#endif /* __ASM_DEVICE_H */ > -- > 1.5.3.5 > > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Tinyx-devel mailing list > Tin...@li... > https://lists.sourceforge.net/lists/listinfo/tinyx-devel -- Best Regards, Felipe Balbi http://felipebalbi.com me...@fe... |
From: David C. <da...@gm...> - 2007-12-11 23:32:45
|
Yes. All bus have their function pointer to write, read and ioctl. The driver will try to write and the device will know which bus use. BR, David On Dec 11, 2007 7:31 PM, Felipe Balbi <me...@fe...> wrote: > We should start putting theses discussions on the list so other eventual > users will be able to follow our plans, in any case we decided to have > those bus type defines in order to encapsulate the bus implementation to > the driver. The driver doesn't need to know anything about the bus it > should just call a "write" function, and that function would handle all > bus > specific logic. > > On Tue, 11 Dec 2007 19:08:25 -0400, David Cohen <da...@gm...> wrote: > > Adding the device.h for arm7 arch. > > > > Signed-off-by: David Cohen <da...@gm...> > > Acked-by: Felipe Balbi <me...@fe...> > > > --- > > include/asm-arm7/device.h | 11 +++++++++++ > > 1 files changed, 11 insertions(+), 0 deletions(-) > > create mode 100644 include/asm-arm7/device.h > > > > diff --git a/include/asm-arm7/device.h b/include/asm-arm7/device.h > > new file mode 100644 > > index 0000000..93ea2fd > > --- /dev/null > > +++ b/include/asm-arm7/device.h > > @@ -0,0 +1,11 @@ > > +#ifndef __ASM_DEVICE_H > > +#define __ASM_DEVICE_H > > + > > +/* ARM7 Buses */ > > +#define BUS_TYPE_PLATFORM 0x00 > > +#define BUS_TYPE_I2C 0x01 > > +#define BUS_TYPE_SPI 0x02 > > +#define BUS_TYPE_UART 0x03 > > +#define BUS_TYPE_USB 0x04 > > + > > +#endif /* __ASM_DEVICE_H */ > > -- > > 1.5.3.5 > > > > > > > ------------------------------------------------------------------------- > > SF.Net email is sponsored by: > > Check out the new SourceForge.net Marketplace. > > It's the best place to buy or sell services for > > just about anything Open Source. > > http://sourceforge.net/services/buy/index.php > > _______________________________________________ > > Tinyx-devel mailing list > > Tin...@li... > > https://lists.sourceforge.net/lists/listinfo/tinyx-devel > -- > Best Regards, > > Felipe Balbi > http://felipebalbi.com > me...@fe... > > |
From: Felipe B. <me...@fe...> - 2007-12-11 23:23:58
|
Good one, now we can use error codes and NULL everywhere. On Tue, 11 Dec 2007 19:08:24 -0400, David Cohen <da...@gm...> wrote: > Signed-off-by: David Cohen <da...@gm...> Acked-by: Felipe Balbi <me...@fe...> > --- > include/tinyx/kernel.h | 13 ++++++++----- > 1 files changed, 8 insertions(+), 5 deletions(-) > > diff --git a/include/tinyx/kernel.h b/include/tinyx/kernel.h > index 8a317b1..3b55653 100644 > --- a/include/tinyx/kernel.h > +++ b/include/tinyx/kernel.h > @@ -1,16 +1,19 @@ > #ifndef __TINYX_KERNEL_H > #define __TINYX_KERNEL_H > > +#include <asm/stddef.h> > +#include <tinyx/errno.h> > + > typedef int (*initcall_t)(void); > > #define __initcall(level, fn) \ > static initcall_t __initcall_##fn __attribute__ ((section > (".initcall." level ".init"))) = fn > > -#define first_init(fn) __initcall("0", fn) > -#define early_init(fn) __initcall("1", fn) > -#define standard_init(fn) __initcall("2", fn) > -#define late_init(fn) __initcall("3", fn) > -#define last_init(fn) __initcall("4", fn) > +#define first_init(fn) __initcall("0", fn) > +#define early_init(fn) __initcall("1", fn) > +#define standard_init(fn) __initcall("2", fn) > +#define late_init(fn) __initcall("3", fn) > +#define last_init(fn) __initcall("4", fn) > > #define __init __attribute__ ((__section__ (".init_functions"))) > > -- > 1.5.3.5 > > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Tinyx-devel mailing list > Tin...@li... > https://lists.sourceforge.net/lists/listinfo/tinyx-devel -- Best Regards, Felipe Balbi http://felipebalbi.com me...@fe... |
From: Felipe B. <fel...@us...> - 2007-12-11 23:10:22
|
On Dec 11, 2007 7:08 PM, David Cohen <da...@gm...> wrote: > From: David Cohen <david@ghandi.localdomain> > > Adding the stddef.h file for arm7 architecture. > This file has (and will have more) the C standards for arm7. > > Signed-off-by: David Cohen <da...@gm...> Acked-by: Felipe Balbi <me...@fe...> > --- > include/asm-arm7/stddef.h | 6 ++++++ > 1 files changed, 6 insertions(+), 0 deletions(-) > create mode 100644 include/asm-arm7/stddef.h > > diff --git a/include/asm-arm7/stddef.h b/include/asm-arm7/stddef.h > new file mode 100644 > index 0000000..03176e8 > --- /dev/null > +++ b/include/asm-arm7/stddef.h > @@ -0,0 +1,6 @@ > +#ifndef __ASM_STDDEF_H > +#define __ASM_STDDEF_H > + > +#define NULL ((void *)0) > + > +#endif /* __ASM_STDDEF_H */ > -- > 1.5.3.5 > > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Tinyx-devel mailing list > Tin...@li... > https://lists.sourceforge.net/lists/listinfo/tinyx-devel > -- Best Regards, Felipe Balbi fel...@us... |
From: Felipe B. <fel...@us...> - 2007-12-11 23:12:08
|
On Dec 11, 2007 7:08 PM, David Cohen <da...@gm...> wrote: Try to put a comment before signed-off-by entry so git-log will be "usable" :-p In any case, an inline is really better. > Signed-off-by: David Cohen <da...@gm...> Acked-by: Felipe Balbi <me...@fe...> > --- > include/tinyx/list.h | 12 +++++++----- > 1 files changed, 7 insertions(+), 5 deletions(-) > > diff --git a/include/tinyx/list.h b/include/tinyx/list.h > index 0272f86..55020b1 100644 > --- a/include/tinyx/list.h > +++ b/include/tinyx/list.h > @@ -22,7 +22,7 @@ struct list_head { > * > * @list: the list being initialized > */ > -static inline void init_list_head(struct list_head *list) > +static void inline init_list_head(struct list_head *list) > { > list->next = list; > list->prev = list; > @@ -32,11 +32,13 @@ static inline void init_list_head(struct list_head *list) > * list_add_tail - add a new entry at the end of the list > * > * @head: the head of the current list > - * @new: the member to insert > + * @queue: the member to insert > */ > -#define list_add_tail(head, new) \ > - (head)->next = (new)->next; \ > - (new)->next = (head); > +static void inline list_add_tail(struct list_head *head, struct list_head *queue) > +{ > + head->next = queue->next; > + queue->next = head; > +} > > /* > * list_del_tail - delete the tail from the list > -- > 1.5.3.5 > > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Tinyx-devel mailing list > Tin...@li... > https://lists.sourceforge.net/lists/listinfo/tinyx-devel > -- Best Regards, Felipe Balbi fel...@us... |
From: David C. <da...@gm...> - 2007-12-11 23:14:15
|
On Dec 11, 2007 7:12 PM, Felipe Balbi <fel...@us...> wrote: > On Dec 11, 2007 7:08 PM, David Cohen <da...@gm...> wrote: > > Try to put a comment before signed-off-by entry so git-log will be > "usable" :-p I'll do it =) > > > In any case, an inline is really better. yes, as this define has more than 1 line, inline will avoid error on using if without { }. BR, David > > > > Signed-off-by: David Cohen <da...@gm...> > > Acked-by: Felipe Balbi <me...@fe...> > > > --- > > include/tinyx/list.h | 12 +++++++----- > > 1 files changed, 7 insertions(+), 5 deletions(-) > > > > diff --git a/include/tinyx/list.h b/include/tinyx/list.h > > index 0272f86..55020b1 100644 > > --- a/include/tinyx/list.h > > +++ b/include/tinyx/list.h > > @@ -22,7 +22,7 @@ struct list_head { > > * > > * @list: the list being initialized > > */ > > -static inline void init_list_head(struct list_head *list) > > +static void inline init_list_head(struct list_head *list) > > { > > list->next = list; > > list->prev = list; > > @@ -32,11 +32,13 @@ static inline void init_list_head(struct list_head > *list) > > * list_add_tail - add a new entry at the end of the list > > * > > * @head: the head of the current list > > - * @new: the member to insert > > + * @queue: the member to insert > > */ > > -#define list_add_tail(head, new) \ > > - (head)->next = (new)->next; \ > > - (new)->next = (head); > > +static void inline list_add_tail(struct list_head *head, struct > list_head *queue) > > +{ > > + head->next = queue->next; > > + queue->next = head; > > +} > > > > /* > > * list_del_tail - delete the tail from the list > > -- > > 1.5.3.5 > > > > > > > ------------------------------------------------------------------------- > > SF.Net email is sponsored by: > > Check out the new SourceForge.net Marketplace. > > It's the best place to buy or sell services for > > just about anything Open Source. > > http://sourceforge.net/services/buy/index.php > > _______________________________________________ > > Tinyx-devel mailing list > > Tin...@li... > > https://lists.sourceforge.net/lists/listinfo/tinyx-devel > > > > > > -- > Best Regards, > > Felipe Balbi > fel...@us... > |