wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 1 | #ifndef load_kernel_h |
| 2 | #define load_kernel_h |
| 3 | /*------------------------------------------------------------------------- |
| 4 | * Filename: load_kernel.h |
| 5 | * Version: $Id: load_kernel.h,v 1.3 2002/01/25 01:34:11 nyet Exp $ |
| 6 | * Copyright: Copyright (C) 2001, Russ Dill |
| 7 | * Author: Russ Dill <Russ.Dill@asu.edu> |
| 8 | * Description: header for load kernel modules |
| 9 | *-----------------------------------------------------------------------*/ |
| 10 | /* |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation; either version 2 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program; if not, write to the Free Software |
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 25 | * |
| 26 | */ |
| 27 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 28 | #include <linux/list.h> |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 29 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 30 | /* mtd device types */ |
Kyungmin Park | 2538374 | 2008-08-27 14:45:20 +0900 | [diff] [blame] | 31 | #define MTD_DEV_TYPE_NOR 0x0001 |
| 32 | #define MTD_DEV_TYPE_NAND 0x0002 |
| 33 | #define MTD_DEV_TYPE_ONENAND 0x0004 |
| 34 | |
| 35 | #define MTD_DEV_TYPE(type) ((type == MTD_DEV_TYPE_NAND) ? "nand" : \ |
| 36 | (type == MTD_DEV_TYPE_ONENAND) ? "onenand" : "nor") |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 37 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 38 | struct mtd_device { |
| 39 | struct list_head link; |
| 40 | struct mtdids *id; /* parent mtd id entry */ |
| 41 | u16 num_parts; /* number of partitions on this device */ |
| 42 | struct list_head parts; /* partitions */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 43 | }; |
| 44 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 45 | struct part_info { |
| 46 | struct list_head link; |
| 47 | char *name; /* partition name */ |
| 48 | u8 auto_name; /* set to 1 for generated name */ |
| 49 | u32 size; /* total size of the partition */ |
| 50 | u32 offset; /* offset within device */ |
| 51 | void *jffs2_priv; /* used internaly by jffs2 */ |
| 52 | u32 mask_flags; /* kernel MTD mask flags */ |
Ilya Yanok | 85cceb5 | 2008-11-13 19:49:32 +0300 | [diff] [blame] | 53 | u32 sector_size; /* size of sector */ |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 54 | struct mtd_device *dev; /* parent device */ |
| 55 | }; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 56 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 57 | struct mtdids { |
| 58 | struct list_head link; |
| 59 | u8 type; /* device type */ |
| 60 | u8 num; /* device number */ |
| 61 | u32 size; /* device size */ |
| 62 | char *mtd_id; /* linux kernel device id */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 63 | }; |
| 64 | |
| 65 | #define ldr_strlen strlen |
| 66 | #define ldr_strncmp strncmp |
| 67 | #define ldr_memcpy memcpy |
| 68 | #define putstr(x) printf("%s", x) |
| 69 | #define mmalloc malloc |
| 70 | #define UDEBUG printf |
| 71 | |
| 72 | #define putnstr(str, size) printf("%*.*s", size, size, str) |
| 73 | #define ldr_output_string(x) puts(x) |
| 74 | #define putLabeledWord(x, y) printf("%s %08x\n", x, (unsigned int)y) |
| 75 | #define led_blink(x, y, z, a) |
| 76 | |
Kyungmin Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 77 | /* common/cmd_jffs2.c */ |
| 78 | extern int mtdparts_init(void); |
| 79 | extern int find_dev_and_part(const char *id, struct mtd_device **dev, |
| 80 | u8 *part_num, struct part_info **part); |
| 81 | |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 82 | #endif /* load_kernel_h */ |