load_kernel.h 2.1 KB

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