load_kernel.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. #ifndef load_kernel_h
  3. #define load_kernel_h
  4. /*-------------------------------------------------------------------------
  5. * Filename: load_kernel.h
  6. * Version: $Id: load_kernel.h,v 1.3 2002/01/25 01:34:11 nyet Exp $
  7. * Copyright: Copyright (C) 2001, Russ Dill
  8. * Author: Russ Dill <Russ.Dill@asu.edu>
  9. * Description: header for load kernel modules
  10. *-----------------------------------------------------------------------*/
  11. #include <linux/list.h>
  12. /* mtd device types */
  13. #define MTD_DEV_TYPE_NOR 0x0001
  14. #define MTD_DEV_TYPE_NAND 0x0002
  15. #define MTD_DEV_TYPE_ONENAND 0x0004
  16. #define MTD_DEV_TYPE_SPINAND 0x0008
  17. #define MTD_DEV_TYPE(type) (type == MTD_DEV_TYPE_NAND ? "nand" : \
  18. (type == MTD_DEV_TYPE_NOR ? "nor" : \
  19. (type == MTD_DEV_TYPE_ONENAND ? "onenand" : \
  20. "spi-nand"))) \
  21. struct mtd_device {
  22. struct list_head link;
  23. struct mtdids *id; /* parent mtd id entry */
  24. u16 num_parts; /* number of partitions on this device */
  25. struct list_head parts; /* partitions */
  26. };
  27. struct part_info {
  28. struct list_head link;
  29. char *name; /* partition name */
  30. u8 auto_name; /* set to 1 for generated name */
  31. u64 size; /* total size of the partition */
  32. u64 offset; /* offset within device */
  33. void *jffs2_priv; /* used internaly by jffs2 */
  34. u32 mask_flags; /* kernel MTD mask flags */
  35. u32 sector_size; /* size of sector */
  36. struct mtd_device *dev; /* parent device */
  37. };
  38. struct mtdids {
  39. struct list_head link;
  40. u8 type; /* device type */
  41. u8 num; /* device number */
  42. u64 size; /* device size */
  43. char *mtd_id; /* linux kernel device id */
  44. };
  45. #define ldr_strlen strlen
  46. #define ldr_strncmp strncmp
  47. #define ldr_memcpy memcpy
  48. #define putstr(x) printf("%s", x)
  49. #define mmalloc malloc
  50. #define UDEBUG printf
  51. #define putnstr(str, size) printf("%*.*s", size, size, str)
  52. #define ldr_output_string(x) puts(x)
  53. #define putLabeledWord(x, y) printf("%s %08x\n", x, (unsigned int)y)
  54. #define led_blink(x, y, z, a)
  55. /* common/cmd_jffs2.c */
  56. extern int mtdparts_init(void);
  57. extern int find_dev_and_part(const char *id, struct mtd_device **dev,
  58. u8 *part_num, struct part_info **part);
  59. extern struct mtd_device *device_find(u8 type, u8 num);
  60. #endif /* load_kernel_h */