spi_fh_adapt.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * This file is part of FH8620 BSP for RT-Thread distribution.
  3. *
  4. * Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
  5. * All rights reserved
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program; if not, write to the Free Software Foundation, Inc.,
  19. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  20. *
  21. * Visit http://www.fullhan.com to get contact with Fullhan.
  22. *
  23. * Change Logs:
  24. * Date Author Notes
  25. */
  26. /*
  27. * spi_fh_adapt.h
  28. *
  29. * Created on: Mar 2, 2016
  30. * Author: duobao
  31. */
  32. #ifndef SPI_FH_ADAPT_H_
  33. #define SPI_FH_ADAPT_H_
  34. #include <rtthread.h>
  35. #include <drivers/spi.h>
  36. #define MTD_WRITEABLE 0x400 /* Device is writeable */
  37. #define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */
  38. #define MTD_NO_ERASE 0x1000 /* No erase necessary */
  39. #define MTD_POWERUP_LOCK 0x2000 /* Always locked after reset */
  40. struct mtd_partition {
  41. char *name; /* identifier string */
  42. rt_uint32_t size; /* partition size */
  43. rt_uint32_t offset; /* offset within the master MTD space */
  44. rt_uint32_t mask_flags; /* master MTD flags to mask out for this partition */
  45. struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only) */
  46. };
  47. struct flash_platform_data {
  48. char *flash_name;
  49. char *spi_name;
  50. struct mtd_partition *parts;
  51. unsigned int nr_parts;
  52. char *type;
  53. /* we'll likely add more ... use JEDEC IDs, etc */
  54. };
  55. rt_err_t fh_flash_adapt_init(void);
  56. #endif /* SPI_FH_ADAPT_H_ */