diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2011-05-06 11:35:08 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-05-06 11:35:08 +0200 |
commit | 30eb4cdf17e5cc0d42bcda5de6a5dccecb06bcf0 (patch) | |
tree | 38ebcb0dc08fc4cd35065b7cf4ce776315e03543 /include | |
parent | 3e19d858760a138cb8cba92a2395036bd70937e3 (diff) | |
parent | 64476d2177a53228319c4ab5b99cfb66ec8cc365 (diff) | |
download | barebox-30eb4cdf17e5cc0d42bcda5de6a5dccecb06bcf0.tar.gz barebox-30eb4cdf17e5cc0d42bcda5de6a5dccecb06bcf0.tar.xz |
Merge branch 'next'
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/sections.h | 3 | ||||
-rw-r--r-- | include/block.h | 32 | ||||
-rw-r--r-- | include/common.h | 1 | ||||
-rw-r--r-- | include/driver.h | 10 | ||||
-rw-r--r-- | include/environment.h | 15 | ||||
-rw-r--r-- | include/fs.h | 7 | ||||
-rw-r--r-- | include/kfifo.h | 2 | ||||
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | include/linux/mtd/compat.h | 46 | ||||
-rw-r--r-- | include/linux/mtd/mtd.h | 4 | ||||
-rw-r--r-- | include/malloc.h | 1 | ||||
-rw-r--r-- | include/nand.h | 5 | ||||
-rw-r--r-- | include/net.h | 8 | ||||
-rw-r--r-- | include/usb/usb.h | 2 |
14 files changed, 77 insertions, 61 deletions
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index c5d60a9d75..1f48fb8c6b 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -4,5 +4,8 @@ extern char _text[], _stext[], _etext[]; extern char __bss_start[], __bss_stop[]; extern char _end[]; +extern void *_barebox_image_size; + +#define barebox_image_size (unsigned int)&_barebox_image_size #endif /* _ASM_GENERIC_SECTIONS_H_ */ diff --git a/include/block.h b/include/block.h new file mode 100644 index 0000000000..aaab4e3b36 --- /dev/null +++ b/include/block.h @@ -0,0 +1,32 @@ +#ifndef __BLOCK_H +#define __BLOCK_H + +#include <driver.h> + +struct block_device; + +struct block_device_ops { + int (*read)(struct block_device *, void *buf, int block, int num_blocks); + int (*write)(struct block_device *, const void *buf, int block, int num_blocks); +}; + +struct block_device { + struct device_d *dev; + struct block_device_ops *ops; + int blockbits; + int num_blocks; + void *rdbuf; /* read buffer */ + int rdbufsize; + int rdblock; /* start block in read buffer */ + int rdblockend; /* end block in read buffer */ + void *wrbuf; /* write buffer */ + int wrblock; /* start block in write buffer */ + int wrbufblocks; /* number of blocks currently in write buffer */ + int wrbufsize; /* size of write buffer in blocks */ + struct cdev cdev; +}; + +int blockdevice_register(struct block_device *blk); +int blockdevice_unregister(struct block_device *blk); + +#endif /* __BLOCK_H */ diff --git a/include/common.h b/include/common.h index 35ad7b994d..491bc98033 100644 --- a/include/common.h +++ b/include/common.h @@ -219,6 +219,7 @@ int run_shell(void); int memory_display(char *addr, ulong offs, ulong nbytes, int size); extern const char version_string[]; +void barebox_banner(void); #define IOMEM(addr) ((void __force __iomem *)(addr)) diff --git a/include/driver.h b/include/driver.h index b9edca0e7f..6a4d45e3ec 100644 --- a/include/driver.h +++ b/include/driver.h @@ -290,8 +290,9 @@ struct file_operations { int (*ioctl)(struct cdev*, int, void *); off_t (*lseek)(struct cdev*, off_t); - int (*open)(struct cdev*, struct filep*); - int (*close)(struct cdev*, struct filep*); + int (*open)(struct cdev*); + int (*close)(struct cdev*); + int (*flush)(struct cdev*); int (*erase)(struct cdev*, size_t count, unsigned long offset); int (*protect)(struct cdev*, size_t count, unsigned long offset, int prot); int (*memmap)(struct cdev*, void **map, int flags); @@ -314,8 +315,13 @@ struct cdev { int devfs_create(struct cdev *); int devfs_remove(struct cdev *); struct cdev *cdev_by_name(const char *filename); +struct cdev *cdev_open(const char *name, unsigned long flags); +void cdev_close(struct cdev *cdev); +int cdev_flush(struct cdev *cdev); ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong flags); ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, ulong offset, ulong flags); +int cdev_ioctl(struct cdev *cdev, int cmd, void *buf); +int cdev_erase(struct cdev *cdev, size_t count, unsigned long offset); #define DEVFS_PARTITION_FIXED (1 << 0) #define DEVFS_PARTITION_READONLY (1 << 1) diff --git a/include/environment.h b/include/environment.h index 21a7ffa0e2..da032e21d6 100644 --- a/include/environment.h +++ b/include/environment.h @@ -44,12 +44,27 @@ struct env_context *get_current_context(void); char *var_val(struct variable_d *); char *var_name(struct variable_d *); +#ifdef CONFIG_ENVIRONMENT_VARIABLES const char *getenv(const char *); int setenv(const char *, const char *); +#else +static inline char *getenv(const char *var) +{ + return NULL; +} + +static inline int setenv(const char *var, const char *val) +{ + return 0; +} +#endif int env_pop_context(void); int env_push_context(void); +/* defaults to /dev/env0 */ +extern char *default_environment_path; + int envfs_load(char *filename, char *dirname); int envfs_save(char *filename, char *dirname); diff --git a/include/fs.h b/include/fs.h index 4c03978a03..97d5995c1f 100644 --- a/include/fs.h +++ b/include/fs.h @@ -3,10 +3,6 @@ #include <driver.h> -#define FS_TYPE_CRAMFS 1 -#define FS_TYPE_RAMFS 2 -#define FS_TYPE_DEVFS 3 - #define PATH_MAX 1024 /* include/linux/limits.h */ struct partition; @@ -41,7 +37,6 @@ typedef struct filep { #define FS_DRIVER_NO_DEV 1 struct fs_driver_d { - ulong type; char *name; int (*probe) (struct device_d *dev); int (*mkdir)(struct device_d *dev, const char *pathname); @@ -58,6 +53,7 @@ struct fs_driver_d { int (*close)(struct device_d *dev, FILE *f); int (*read)(struct device_d *dev, FILE *f, void *buf, size_t size); int (*write)(struct device_d *dev, FILE *f, const void *buf, size_t size); + int (*flush)(struct device_d *dev, FILE *f); off_t (*lseek)(struct device_d *dev, FILE *f, off_t pos); struct dir* (*opendir)(struct device_d *dev, const char *pathname); @@ -103,6 +99,7 @@ int open(const char *pathname, int flags, ...); int creat(const char *pathname, mode_t mode); int unlink(const char *pathname); int close(int fd); +int flush(int fd); int stat(const char *filename, struct stat *s); int read(int fd, void *buf, size_t count); int ioctl(int fd, int request, void *buf); diff --git a/include/kfifo.h b/include/kfifo.h index 6f8be10f67..3eb03cb17c 100644 --- a/include/kfifo.h +++ b/include/kfifo.h @@ -43,7 +43,7 @@ void kfifo_free(struct kfifo *fifo); * bytes copied. */ unsigned int kfifo_put(struct kfifo *fifo, - unsigned char *buffer, unsigned int len); + const unsigned char *buffer, unsigned int len); /** * kfifo_get - gets some data from the FIFO diff --git a/include/libbb.h b/include/libbb.h index 4151230c67..0962969559 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -30,4 +30,6 @@ int copy_file(const char *src, const char *dst); int process_escape_sequence(const char *source, char *dest, int destlen); +char *simple_itoa(unsigned int i); + #endif /* __LIBBB_H */ diff --git a/include/linux/mtd/compat.h b/include/linux/mtd/compat.h deleted file mode 100644 index a99d86e693..0000000000 --- a/include/linux/mtd/compat.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _LINUX_COMPAT_H_ -#define _LINUX_COMPAT_H_ - -#define __user -#define __iomem - -#define ndelay(x) udelay(1) - -#define printk printf - -#define KERN_EMERG -#define KERN_ALERT -#define KERN_CRIT -#define KERN_ERR -#define KERN_WARNING -#define KERN_NOTICE -#define KERN_INFO -#define KERN_DEBUG - -#define kmalloc(size, flags) malloc(size) -#define kfree(ptr) free(ptr) - -/* - * ..and if you can't take the strict - * types, you can specify one yourself. - * - * Or not use min/max at all, of course. - */ -#define min_t(type,x,y) \ - ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; }) -#define max_t(type,x,y) \ - ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) - -#ifndef BUG -#define BUG() do { \ - printf("barebox BUG at %s:%d!\n", __FILE__, __LINE__); \ -} while (0) - -#define BUG_ON(condition) do { if (condition) BUG(); } while(0) -#endif /* BUG */ - -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) - -#define PAGE_SIZE 4096 -#endif diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 01980f375c..29591e2643 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -178,10 +178,6 @@ struct mtd_info { int (*lock) (struct mtd_info *mtd, loff_t ofs, size_t len); int (*unlock) (struct mtd_info *mtd, loff_t ofs, size_t len); - /* Power Management functions */ - int (*suspend) (struct mtd_info *mtd); - void (*resume) (struct mtd_info *mtd); - /* Bad block management functions */ int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); diff --git a/include/malloc.h b/include/malloc.h index 4b0567ed1d..7b9b062ada 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -18,6 +18,7 @@ size_t malloc_usable_size(void*); void malloc_stats(void); int mallopt(int, int); struct mallinfo mallinfo(void); +void *sbrk(ptrdiff_t increment); #endif diff --git a/include/nand.h b/include/nand.h index 05358d0218..b1762dfa45 100644 --- a/include/nand.h +++ b/include/nand.h @@ -6,10 +6,15 @@ struct nand_bb; #ifdef CONFIG_NAND int dev_add_bb_dev(char *filename, const char *name); +int dev_remove_bb_dev(const char *name); #else static inline int dev_add_bb_dev(char *filename, const char *name) { return 0; } +static inline int dev_remove_bb_dev(const char *name) +{ + return 0; +} #endif #endif /* __NAND_H__ */ diff --git a/include/net.h b/include/net.h index 33d8a32f83..31bf6a23fc 100644 --- a/include/net.h +++ b/include/net.h @@ -363,7 +363,7 @@ static inline int is_valid_ether_addr(const u8 *addr) return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr); } -typedef void rx_handler_f(char *packet, unsigned int len); +typedef void rx_handler_f(void *ctx, char *packet, unsigned int len); void eth_set_current(struct eth_device *eth); struct eth_device *eth_get_current(void); @@ -388,6 +388,7 @@ struct net_connection { struct list_head list; rx_handler_f *handler; int proto; + void *priv; }; static inline char *net_alloc_packet(void) @@ -396,9 +397,10 @@ static inline char *net_alloc_packet(void) } struct net_connection *net_udp_new(IPaddr_t dest, uint16_t dport, - rx_handler_f *handler); + rx_handler_f *handler, void *ctx); -struct net_connection *net_icmp_new(IPaddr_t dest, rx_handler_f *handler); +struct net_connection *net_icmp_new(IPaddr_t dest, rx_handler_f *handler, + void *ctx); void net_unregister(struct net_connection *con); diff --git a/include/usb/usb.h b/include/usb/usb.h index 1e4d750ca9..6ef9977497 100644 --- a/include/usb/usb.h +++ b/include/usb/usb.h @@ -252,6 +252,8 @@ int usb_clear_halt(struct usb_device *dev, int pipe); int usb_string(struct usb_device *dev, int index, char *buf, size_t size); int usb_set_interface(struct usb_device *dev, int interface, int alternate); +void usb_rescan(void); + /* big endian -> little endian conversion */ /* some CPUs are already little endian e.g. the ARM920T */ #define __swap_16(x) \ |