/*
* @file hv_drv_UsbPortingOsDiskIo.h
* @brief Header file of usb adapting to os about disk.
*
* @author HiView SoC Software Team
* @version 1.0.0
* @date 2022-06-15
*/

#ifndef __HV_DRV_USB_PORTING_OS_DISK_IO_H
#define __HV_DRV_USB_PORTING_OS_DISK_IO_H

#include "hv_drv_UsbPortingOsDevtab.h"

struct os_disk_identify_t {
    char serial[20+1];      // serial number
    char firmware_rev[8+1]; // firmware revision
    char model_num[40+1];   // model number
    u32  cylinders_num;     // number of cylinders         (CHS)
    u32  heads_num;         // number of heads             (CHS)
    u32  sectors_num;       // number of sectors per track (CHS)
    u32  lba_sectors_num;   // total number of sectors in LBA mode
    u32  phys_block_size;   // physical block size in sectors
    u32  max_transfer;      // Maximum transfer size in bytes
};

struct  os_disk_partition_t {
    u8  type;    // partition type
    u8  state;   // state 0x00 - inactive, 0x80 - active
    u32 start;   // first sector number
    u32 end;     // last sector number
    u32 size;    // size in sectors
};

struct  os_disk_info_t {
    struct os_disk_partition_t  *partitions;        // partition table
    int                         partitions_num;     // partition table size
    struct os_disk_identify_t   ident;              // identify data
    u32                         block_size;         // logical block size
    u32                         blocks_num;         // number of blocks on disk
    u32                         phys_block_size;    // physical block size
    boolean                     connected;          // true if device connected
    os_ucount16                 mounts;             // total number of mounts for all partitions
};

#endif  /* OS_DISKIO_H */
/* EOF diskio.h */
