al_setting.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /*****************************************************************************
  2. ** al_setting.h: AL Layer System Setting Header File
  3. **
  4. ** Description: the interface of system setting module.
  5. **
  6. ** Copyright(c) 2011 Sunmedia Technologies - All Rights Reserved
  7. **
  8. ** Author : anlzhao
  9. **
  10. ** $Id: al_setting.h 1901 2011-01-22 05:47:03Z liang.wu_c1 $
  11. *****************************************************************************/
  12. #ifndef __AL_SETTING_H__
  13. #define __AL_SETTING_H__
  14. #include "al_basictypes.h"
  15. //#include "nvm_mgr.h"
  16. /*
  17. ** Marco define
  18. */
  19. /* MAX open count of devices at one time*/
  20. #define MAX_DEVICE (20)
  21. /* MAX count of components in a virtual device */
  22. #define MAX_NUM_COMP (250)
  23. /* CRC size */
  24. #define CRC_INFO_SIZE (0)
  25. /* define handle of virtual device */
  26. #define INVAILDHANDLE (-1)
  27. /* macro define to get the item offset within given structure */
  28. #define SYSTEM_SET_ITEM_OFFSET(type, field) ((UINT32)&(((type *)0)->field))
  29. /* macro define to get the item size within given structure */
  30. #define SYSTEM_SET_ITEM_SIZE(type, field) (sizeof ((type *)0)->field)
  31. #ifdef __cplusplus
  32. extern "C"{
  33. #endif
  34. typedef al_int32 AL_SETTING_HANDLE;
  35. /*****************************************************************************
  36. ** FUNCTION : AL_Setting_Open
  37. **
  38. ** DESCRIPTION :
  39. ** This method initializes the user preference component.
  40. ** Notice:This function must be first before any functions
  41. ** are called
  42. **
  43. ** PARAMETERS :
  44. ** VirtualDev_Dev_t - Storage device
  45. ** size_arr - Array of component sizes
  46. ** addr_arr - Array of component address
  47. ** num_comp - No. of components
  48. ** p_stParam - Device registered functions
  49. **
  50. ** RETURN VALUES:
  51. ** AL_SETTING_HANDLE
  52. *****************************************************************************/
  53. AL_SETTING_HANDLE AL_Setting_Open(
  54. const al_uint16* size_arr, const al_uint32* addr_arr, const al_uint32* tech_arr, al_uint8 num_comp);
  55. /*****************************************************************************
  56. ** FUNCTION : AL_Setting_Close
  57. **
  58. ** DESCRIPTION :
  59. ** This method terminates the storage device for user
  60. ** preference component, save all data and releases all
  61. ** resources occpied by the technology
  62. **
  63. ** PARAMETERS :
  64. ** handle - handle Storage device
  65. **
  66. ** RETURN VALUES:
  67. ** AL_SUCCESS
  68. ** AL_FAILURE
  69. ** AL_INVALID_PARAM
  70. *****************************************************************************/
  71. AL_Return_t AL_Setting_Close(AL_SETTING_HANDLE handle);
  72. /*****************************************************************************
  73. ** FUNCTION : AL_Setting_Read
  74. **
  75. ** DESCRIPTION :
  76. ** This method gets the specific user setting from certail
  77. ** memory cache asked by the component from memory cache
  78. **
  79. ** PARAMETERS :
  80. ** handle - handle of Storage device
  81. ** user_pref_id- Fixed unique Id assigned to each component
  82. ** offset - Starting byte position from which data is read
  83. ** num_bytes - No.of bytes required by the component
  84. ** data - Data asked for by the calling component
  85. **
  86. ** RETURN VALUES:
  87. ** AL_SUCCESS
  88. ** AL_FAILURE
  89. ** AL_INVALID_PARAM
  90. *****************************************************************************/
  91. AL_Return_t AL_Setting_Read(AL_SETTING_HANDLE handle,
  92. al_uint8 user_pref_id, al_uint32 offset, al_uint16 num_bytes,
  93. al_void *data);
  94. /*****************************************************************************
  95. ** FUNCTION : AL_Setting_ReadDefault
  96. **
  97. ** DESCRIPTION :
  98. ** This method gets the default user setting to memory cache
  99. ** Notice:when user_pref_id is equal to 0xFF, it represents
  100. ** reading all default items of certain storage device
  101. **
  102. ** PARAMETERS :
  103. ** handle - handle of Storage device
  104. ** user_pref_id- Fixed unique Id assigned to each component
  105. ** data - Default Data
  106. **
  107. ** RETURN VALUES:
  108. ** AL_SUCCESS
  109. ** AL_FAILURE
  110. ** AL_INVALID_PARAM
  111. *****************************************************************************/
  112. AL_Return_t AL_Setting_ReadDefault(AL_SETTING_HANDLE handle,
  113. al_uint8 user_pref_id, const al_void *data);
  114. /*****************************************************************************
  115. ** FUNCTION : AL_Setting_Write
  116. **
  117. ** DESCRIPTION :
  118. ** This method writes the user data into user setting cache
  119. **
  120. ** PARAMETERS :
  121. ** handle - handle of Storage device
  122. ** user_pref_id- Fixed unique Id assigned to each component
  123. ** offset - Starting position from which data is written
  124. ** num_bytes - No. of bytes required by the component
  125. ** data - Data to be written onto cache
  126. **
  127. ** RETURN VALUES:
  128. ** AL_SUCCESS
  129. ** AL_FAILURE
  130. ** AL_INVALID_PARAM
  131. *****************************************************************************/
  132. AL_Return_t AL_Setting_Write(AL_SETTING_HANDLE handle,
  133. al_uint8 user_pref_id, al_uint32 offset, al_uint16 num_bytes,
  134. const al_void *data);
  135. /*****************************************************************************
  136. ** FUNCTION : AL_Setting_Reload
  137. **
  138. ** DESCRIPTION :
  139. ** This method retrieves the user setting from actual
  140. ** storage device into memory cache.
  141. ** Notice:when user_pref_id is equal to 0xFF, it represents
  142. ** retrieving all items
  143. **
  144. ** PARAMETERS :
  145. ** handle - handle of Storage device
  146. ** user_pref_id- Fixed unique Id assigned to each component
  147. **
  148. ** RETURN VALUES:
  149. ** AL_SUCCESS
  150. ** AL_FAILURE
  151. ** AL_INVALID_PARAM
  152. *****************************************************************************/
  153. AL_Return_t AL_Setting_Reload(AL_SETTING_HANDLE handle,
  154. al_uint8 user_pref_id);
  155. /*****************************************************************************
  156. ** FUNCTION : AL_Setting_Store
  157. **
  158. ** DESCRIPTION :
  159. ** This method stores the user setting into actual storage
  160. ** device from memory cache.
  161. ** Notice:when id is equal to 0xFF, it represents
  162. ** to store all items
  163. **
  164. ** PARAMETERS :
  165. ** handle - handle ofStorage device
  166. ** id - Fixed unique Id assigned to each component
  167. ** item_offset - component item offset
  168. ** num_bytes - number of data need to store
  169. **
  170. ** RETURN VALUES:
  171. ** AL_SUCCESS
  172. ** AL_FAILURE
  173. ** AL_INVALID_PARAM
  174. *****************************************************************************/
  175. AL_Return_t AL_Setting_Store(AL_SETTING_HANDLE handle,
  176. al_uint8 user_pref_id, al_uint32 offset, al_uint16 num_bytes);
  177. #ifdef __cplusplus
  178. }
  179. #endif /* __cplusplus */
  180. #endif /* __AL_SETTING_H__ */
  181. /*****************************************************************************
  182. ** $Rev: 1901 $
  183. **
  184. *****************************************************************************/