yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [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 | * SPDX-License-Identifier: GPL-2.0+ |
| 12 | */ |
| 13 | |
| 14 | #include <linux/list.h> |
| 15 | |
| 16 | /* mtd device types */ |
| 17 | #define MTD_DEV_TYPE_NOR 0x0001 |
| 18 | #define MTD_DEV_TYPE_NAND 0x0002 |
| 19 | #define MTD_DEV_TYPE_ONENAND 0x0004 |
| 20 | |
| 21 | #define MTD_DEV_TYPE(type) ((type == MTD_DEV_TYPE_NAND) ? "nand" : \ |
| 22 | (type == MTD_DEV_TYPE_ONENAND) ? "onenand" : "nor") |
| 23 | |
| 24 | struct mtd_device { |
| 25 | struct list_head link; |
| 26 | struct mtdids *id; /* parent mtd id entry */ |
| 27 | u16 num_parts; /* number of partitions on this device */ |
| 28 | struct list_head parts; /* partitions */ |
| 29 | }; |
| 30 | |
| 31 | struct part_info { |
| 32 | struct list_head link; |
| 33 | char *name; /* partition name */ |
| 34 | u8 auto_name; /* set to 1 for generated name */ |
| 35 | u32 size; /* total size of the partition */ |
| 36 | u32 offset; /* offset within device */ |
| 37 | void *jffs2_priv; /* used internaly by jffs2 */ |
| 38 | u32 mask_flags; /* kernel MTD mask flags */ |
| 39 | u32 sector_size; /* size of sector */ |
| 40 | struct mtd_device *dev; /* parent device */ |
| 41 | }; |
| 42 | |
| 43 | struct mtdids { |
| 44 | struct list_head link; |
| 45 | u8 type; /* device type */ |
| 46 | u8 num; /* device number */ |
| 47 | u32 size; /* device size */ |
| 48 | char *mtd_id; /* linux kernel device id */ |
| 49 | }; |
| 50 | |
| 51 | #define ldr_strlen strlen |
| 52 | #define ldr_strncmp strncmp |
| 53 | #define ldr_memcpy memcpy |
| 54 | #define putstr(x) printf("%s", x) |
| 55 | #define mmalloc malloc |
| 56 | #define UDEBUG printf |
| 57 | |
| 58 | #define putnstr(str, size) printf("%*.*s", size, size, str) |
| 59 | #define ldr_output_string(x) puts(x) |
| 60 | #define putLabeledWord(x, y) printf("%s %08x\n", x, (unsigned int)y) |
| 61 | #define led_blink(x, y, z, a) |
| 62 | |
| 63 | /* common/cmd_jffs2.c */ |
| 64 | extern int mtdparts_init(void); |
| 65 | extern int find_dev_and_part(const char *id, struct mtd_device **dev, |
| 66 | u8 *part_num, struct part_info **part); |
| 67 | extern struct mtd_device *device_find(u8 type, u8 num); |
| 68 | |
| 69 | #endif /* load_kernel_h */ |