lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * Copyright (C) 2007, ZTE Corporation. |
| 3 | * |
| 4 | * File Name: |
| 5 | * File Mark: |
| 6 | * Description: |
| 7 | * Others: |
| 8 | * Version: 1.0 |
| 9 | * Author: geanfeng |
| 10 | * Date: 2013-09-25 |
| 11 | * History 1: |
| 12 | * Date: |
| 13 | * Version: |
| 14 | * Author: |
| 15 | * Modification: |
| 16 | * History 2: |
| 17 | ********************************************************************************/ |
| 18 | #ifndef _DRVS_DISK_H |
| 19 | #define _DRVS_DISK_H |
| 20 | |
| 21 | #include "drvs_list.h" |
| 22 | #include "drvs_io.h" |
| 23 | #include "drvs_io_dev.h" |
| 24 | |
| 25 | |
| 26 | typedef struct _T_ZDrvDisk_PartDevice T_ZDrvDisk_PartDevice; |
| 27 | |
| 28 | typedef struct _T_ZDrvDisk_DevDesc { |
| 29 | char dev_name[32]; /* device name */ |
| 30 | unsigned char part_type; /* partition type */ |
| 31 | unsigned char target; /* target SCSI ID */ |
| 32 | unsigned char type; /* device type */ |
| 33 | unsigned char removable; /* removable device */ |
| 34 | unsigned long lba; /* number of blocks */ |
| 35 | unsigned long blksz; /* block size */ |
| 36 | char vendor [40+1]; /* IDE model, SCSI Vendor */ |
| 37 | char product[20+1]; /* IDE Serial no, SCSI product */ |
| 38 | char revision[8+1]; /* firmware revision */ |
| 39 | |
| 40 | T_ZDrvDisk_PartDevice *partition; |
| 41 | |
| 42 | SINT32 (*block_read)(VOID *priv_data, |
| 43 | UINT32 start, |
| 44 | UINT32 blkcnt, |
| 45 | VOID *buffer); |
| 46 | SINT32 (*block_write)(VOID *priv_data, |
| 47 | UINT32 start, |
| 48 | UINT32 blkcnt, |
| 49 | const VOID *buffer); |
| 50 | SINT32 (*block_erase)(VOID *priv_data, |
| 51 | UINT32 start, |
| 52 | UINT32 blkcnt); |
| 53 | VOID *priv_data; /* device private data */ |
| 54 | }T_ZDrvDisk_DevDesc; |
| 55 | |
| 56 | |
| 57 | /* Part types */ |
| 58 | #define PART_TYPE_UNKNOWN 0x00 |
| 59 | #define PART_TYPE_MAC 0x01 |
| 60 | #define PART_TYPE_DOS 0x02 |
| 61 | #define PART_TYPE_ISO 0x03 |
| 62 | #define PART_TYPE_AMIGA 0x04 |
| 63 | #define PART_TYPE_EFI 0x05 |
| 64 | #define PART_TYPE_TSP 0x06 |
| 65 | |
| 66 | |
| 67 | /* device types */ |
| 68 | #define DEV_TYPE_UNKNOWN 0xff /* not connected */ |
| 69 | #define DEV_TYPE_HARDDISK 0x00 /* harddisk */ |
| 70 | #define DEV_TYPE_TAPE 0x01 /* Tape */ |
| 71 | #define DEV_TYPE_CDROM 0x05 /* CD-ROM */ |
| 72 | #define DEV_TYPE_OPDISK 0x07 /* optical disk */ |
| 73 | |
| 74 | typedef struct _T_ZDrvDisk_Partition { |
| 75 | unsigned long start; /* # of first block in partition */ |
| 76 | unsigned long size; /* number of blocks in partition */ |
| 77 | unsigned long blksz; /* block size in bytes */ |
| 78 | unsigned char name[48]; /* partition name */ |
| 79 | unsigned char type[32]; /* string type description */ |
| 80 | } T_ZDrvDisk_Partition; |
| 81 | |
| 82 | typedef struct _T_ZDrvDisk_PartDevice |
| 83 | { |
| 84 | struct list_head node; |
| 85 | T_ZDrvDisk_Partition part_info; |
| 86 | T_ZDrvDisk_DevDesc *blk_dev; |
| 87 | T_ZDrvIODev_Handle *io_dev; |
| 88 | } |
| 89 | T_ZDrvDisk_PartDevice; |
| 90 | |
| 91 | SINT32 zDrvDisk_Register(T_ZDrvDisk_DevDesc *dev_desc); |
| 92 | VOID zDrvDisk_Unregister(T_ZDrvDisk_DevDesc *dev_desc); |
| 93 | |
| 94 | #endif /* _DRVS_DISK_H */ |