// Copyright (c) 2023 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Qualcomm Technologies Proprietary and Confidential.

/** @cond */
/** Guid structure. */
struct StorAccess_Guid{
  uint32 Data1;
  uint16 Data2;
  uint16 Data3;
  uint8[8] Data4;
};
/** @endcond */

/** @cond */
interface IStorageAccess {
/** @endcond */

  /**
   * @addtogroup IStorageAccess
   * @{
   */

/*
 * Storage Device type IDs
 */ 
  const uint32 STORAGE_NULL            = 0;
  const uint32 STORAGE_SPINOR          = 1;
  const uint32 STORAGE_MAX_TYPE        = 2;

/*
 * Error Codes
 */
/** @cond */
  error ERROR_NOMEM;         /** Storage out of resource error */
  error ERROR_INVAL_PARAM;   /** Invalid parameter passed error */
  error ERROR_STORAGE;       /** Storage device error */
  error ERROR_ACCESS_DENIED; /** Storage access error */
  error ERROR_NOT_SUPPORTED; /** Not supported error */
/** @endcond */

    /**
    * @param[in] stor_type          - Type of Storage device
    * @param[in] slot               - Slot number of the storage device
    * @param[in] partition          - Partition number of the storage device
    * @param[in] GUID               - GUID ID
    * @param[out] data_buffer       - Data buffer to read the data
    * @param[in] start_byte         - Address of start byte 
    * @param[in] num_bytes          - Number of bytes to be read
    * @return Object_OK on success
    */
   method ReadBytes(in uint32 stor_type, in uint32 slot, in uint32 partition, in StorAccess_Guid GUID, out buffer data_buffer,in uint64 start_byte, in uint64 num_bytes);

   /**
    * @param[in] stor_type          - Type of Storage device  
    * @param[in] slot               - Slot number of the storage device
    * @param[in] partition          - Partition number of the storage device
    * @param[in] GUID               - GUID ID
    * @param[in] data_buffer        - Data buffer to write the data
    * @param[in] start_byte         - Address of start byte 
    * @param[in] num_bytes          - Number of bytes to be written
    * @return Object_OK on success
    */
   method WriteBytes(in uint32 stor_type, in uint32 slot, in uint32 partition, in StorAccess_Guid GUID, in buffer data_buffer,in uint64 start_byte, in uint64 num_bytes);

   /**
    * @param[in] stor_type          - Type of Storage device  
    * @param[in] slot               - Slot number of the storage device
    * @param[in] partition          - Partition number of the storage device
    * @param[in] GUID               - GUID ID
    * @param[in] start_sector       - Address of start sector 
    * @param[in] num_sectors        - Number of Sectors to erase
    * @return Object_OK on success
    */
   method EraseSectors(in uint32 stor_type, in uint32 slot, in uint32 partition, in StorAccess_Guid GUID, in uint64 start_sector, in uint64 num_sectors);

  /** @} */ /* end_addtogroup IStorageAccess */
};