Driver_Flash.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. * Copyright (c) 2013-2018 Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the License); you may
  7. * not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  14. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. #include "Driver_Flash.h"
  19. #define ARM_FLASH_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(1, 0) /* driver version */
  20. /* Sector Information */
  21. #ifdef FLASH_SECTORS
  22. static ARM_FLASH_SECTOR FLASH_SECTOR_INFO[FLASH_SECTOR_COUNT] = {
  23. FLASH_SECTORS
  24. };
  25. #else
  26. #define FLASH_SECTOR_INFO NULL
  27. #endif
  28. /* Flash Information */
  29. static ARM_FLASH_INFO FlashInfo = {
  30. 0, /* FLASH_SECTOR_INFO */
  31. 0, /* FLASH_SECTOR_COUNT */
  32. 0, /* FLASH_SECTOR_SIZE */
  33. 0, /* FLASH_PAGE_SIZE */
  34. 0, /* FLASH_PROGRAM_UNIT */
  35. 0 /* FLASH_ERASED_VALUE */
  36. };
  37. /* Flash Status */
  38. static ARM_FLASH_STATUS FlashStatus;
  39. /* Driver Version */
  40. static const ARM_DRIVER_VERSION DriverVersion = {
  41. ARM_FLASH_API_VERSION,
  42. ARM_FLASH_DRV_VERSION
  43. };
  44. /* Driver Capabilities */
  45. static const ARM_FLASH_CAPABILITIES DriverCapabilities = {
  46. 0, /* event_ready */
  47. 0, /* data_width = 0:8-bit, 1:16-bit, 2:32-bit */
  48. 0 /* erase_chip */
  49. };
  50. //
  51. // Functions
  52. //
  53. ARM_DRIVER_VERSION ARM_Flash_GetVersion(void)
  54. {
  55. }
  56. ARM_FLASH_CAPABILITIES ARM_Flash_GetCapabilities(void)
  57. {
  58. }
  59. int32_t ARM_Flash_Initialize(ARM_Flash_SignalEvent_t cb_event)
  60. {
  61. }
  62. int32_t ARM_Flash_Uninitialize(void)
  63. {
  64. }
  65. int32_t ARM_Flash_PowerControl(ARM_POWER_STATE state)
  66. {
  67. switch (state)
  68. {
  69. case ARM_POWER_OFF:
  70. break;
  71. case ARM_POWER_LOW:
  72. break;
  73. case ARM_POWER_FULL:
  74. break;
  75. default:
  76. return ARM_DRIVER_ERROR_UNSUPPORTED;
  77. }
  78. }
  79. int32_t ARM_Flash_ReadData(uint32_t addr, void *data, uint32_t cnt)
  80. {
  81. }
  82. int32_t ARM_Flash_ProgramData(uint32_t addr, const void *data, uint32_t cnt)
  83. {
  84. }
  85. int32_t ARM_Flash_EraseSector(uint32_t addr)
  86. {
  87. }
  88. int32_t ARM_Flash_EraseChip(void)
  89. {
  90. }
  91. ARM_FLASH_STATUS ARM_Flash_GetStatus(void)
  92. {
  93. }
  94. ARM_FLASH_INFO * ARM_Flash_GetInfo(void)
  95. {
  96. }
  97. void ARM_Flash_SignalEvent(uint32_t event)
  98. {
  99. }
  100. // End Flash Interface
  101. ARM_DRIVER_FLASH Driver_FLASH = {
  102. ARM_Flash_GetVersion,
  103. ARM_Flash_GetCapabilities,
  104. ARM_Flash_Initialize,
  105. ARM_Flash_Uninitialize,
  106. ARM_Flash_PowerControl,
  107. ARM_Flash_ReadData,
  108. ARM_Flash_ProgramData,
  109. ARM_Flash_EraseSector,
  110. ARM_Flash_EraseChip,
  111. ARM_Flash_GetStatus,
  112. ARM_Flash_GetInfo
  113. };