os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/tscsiblockcmds.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @internalTechnology
sl@0
    19
*/
sl@0
    20
sl@0
    21
#ifndef TSCSIBLOCKCMDS_H
sl@0
    22
#define TSCSIBLOCKCMDS_H
sl@0
    23
sl@0
    24
sl@0
    25
/**
sl@0
    26
Data type for Logical Block Address
sl@0
    27
*/
sl@0
    28
typedef TUint32 TLba;
sl@0
    29
sl@0
    30
/**
sl@0
    31
Data type for PROTECT filed used in READ (10) and WRITE (10)
sl@0
    32
SBC-3 5.6 Table 33 and 5.25 Table 68
sl@0
    33
*/
sl@0
    34
typedef TUint TProtect;     // 3 bits
sl@0
    35
sl@0
    36
class TScsiClientReq;
sl@0
    37
sl@0
    38
sl@0
    39
/**
sl@0
    40
Encode SCSI MODE SENSE(6) REQUEST
sl@0
    41
Ref SPC-2 7.8 Request
sl@0
    42
Ref SPC-3 6.9 Request
sl@0
    43
Ref SPC-3 7.4 Response format
sl@0
    44
Ref SBC-3 6.3 Response format for SBC
sl@0
    45
*/
sl@0
    46
class TScsiClientModeSense6Req: public TScsiClientReq
sl@0
    47
    {
sl@0
    48
public:
sl@0
    49
    /** SCSI PAGE CONTROL values */
sl@0
    50
    enum TPageControl
sl@0
    51
        {
sl@0
    52
        ECurrentValues = 0x00,
sl@0
    53
        EChangeableValues = 0x01,
sl@0
    54
        EDefaultValues = 0x02,
sl@0
    55
        ESavedValues = 0x03
sl@0
    56
        };
sl@0
    57
sl@0
    58
    /** Length of MODE SENSE (6) response */
sl@0
    59
    static const TUint KResponseLength = 4;
sl@0
    60
sl@0
    61
    TScsiClientModeSense6Req(TPageControl aPageControl,
sl@0
    62
                             TUint aPageCode,
sl@0
    63
                             TUint aSubPageCode = 0);
sl@0
    64
sl@0
    65
    TInt EncodeRequestL(TDes8& aBuffer) const;
sl@0
    66
sl@0
    67
public:
sl@0
    68
    /** SCSI PAGE CONTROL field */
sl@0
    69
    TPageControl iPageControl;
sl@0
    70
    /** SCSI PAGE CODE field */
sl@0
    71
    TUint iPageCode;
sl@0
    72
    /** SCSI SUB PAGE CODE field */
sl@0
    73
    TUint iSubPageCode;
sl@0
    74
    /** SCSI ALLOCATION LENGTH field */
sl@0
    75
    TAllocationLength iAllocationLength;
sl@0
    76
    };
sl@0
    77
sl@0
    78
sl@0
    79
/**
sl@0
    80
Encode SCSI MODE SENSE(6) RESPONSE
sl@0
    81
Ref SPC-3 6.9 Request
sl@0
    82
Ref SPC-3 7.4 Response format
sl@0
    83
Ref SBC-3 6.3 Response format for SBC
sl@0
    84
*/
sl@0
    85
class TScsiClientModeSense6Resp: public TScsiClientResp
sl@0
    86
    {
sl@0
    87
public:
sl@0
    88
    /** Length of MODE SENSE (6) response */
sl@0
    89
    static const TUint KResponseLength = 4;
sl@0
    90
sl@0
    91
    TScsiClientModeSense6Resp() {};
sl@0
    92
sl@0
    93
    TInt DataLength() const {return KResponseLength;}
sl@0
    94
    void DecodeL(const TDesC8& aPtr);
sl@0
    95
sl@0
    96
public:
sl@0
    97
    /** Returned SCSI WP flag */
sl@0
    98
    TBool iWriteProtected;
sl@0
    99
    };
sl@0
   100
sl@0
   101
sl@0
   102
/**
sl@0
   103
Encode MODE SENSE (10) REQUEST
sl@0
   104
Ref SPC-2 7.9  Request
sl@0
   105
Ref SPC-3 6.10 Request
sl@0
   106
Ref SPC-2 8.2  Response format
sl@0
   107
Ref SPC-3 7.4  Response format
sl@0
   108
Ref SBC-3 6.3  Response format for SBC
sl@0
   109
*/
sl@0
   110
class TScsiClientModeSense10Req: public TScsiClientReq
sl@0
   111
    {
sl@0
   112
public:
sl@0
   113
    /** SCSI PAGE CONTROL values */
sl@0
   114
    enum TPageControl
sl@0
   115
        {
sl@0
   116
        ECurrentValues = 0x00,
sl@0
   117
        EChangeableValues = 0x01,
sl@0
   118
        EDefaultValues = 0x02,
sl@0
   119
        ESavedValues = 0x03
sl@0
   120
        };
sl@0
   121
sl@0
   122
    /** Length of MODE SENSE (10) response */
sl@0
   123
    static const TUint KResponseLength = 8;
sl@0
   124
sl@0
   125
    TScsiClientModeSense10Req(TPageControl aPageControl,
sl@0
   126
                              TUint aPageCode,
sl@0
   127
                              TUint aSubPageCode = 0);
sl@0
   128
sl@0
   129
    TInt EncodeRequestL(TDes8& aBuffer) const;
sl@0
   130
sl@0
   131
public:
sl@0
   132
    /** SCSI PAGE CONTROL field */
sl@0
   133
    TPageControl iPageControl;
sl@0
   134
    /** SCSI PAGE CODE field */
sl@0
   135
    TUint iPageCode;
sl@0
   136
    /** SCSI SUB PAGE CODE field */
sl@0
   137
    TUint iSubPageCode;
sl@0
   138
    /** SCSI ALLOCATION LENGTH field */
sl@0
   139
    TAllocationLength iAllocationLength;
sl@0
   140
    };
sl@0
   141
sl@0
   142
sl@0
   143
/**
sl@0
   144
Decode SCSI MODE SENSE (10) RESPONSE
sl@0
   145
Ref SPC-3 6.10 Request
sl@0
   146
Ref SPC-3 7.4  Response format
sl@0
   147
Ref SBC-3 6.3  Response format for SBC
sl@0
   148
*/
sl@0
   149
class TScsiClientModeSense10Resp: public TScsiClientResp
sl@0
   150
    {
sl@0
   151
public:
sl@0
   152
    /** Length of MODE SENSE (10) response */
sl@0
   153
    static const TUint KResponseLength = 8;
sl@0
   154
sl@0
   155
    TScsiClientModeSense10Resp() {};
sl@0
   156
sl@0
   157
    TInt DataLength() const {return KResponseLength;}
sl@0
   158
    void DecodeL(const TDesC8& aPtr);
sl@0
   159
sl@0
   160
public:
sl@0
   161
    /** Returned SCSI WP flag */
sl@0
   162
    TBool iWriteProtected;
sl@0
   163
    };
sl@0
   164
sl@0
   165
/**
sl@0
   166
Encode READ CAPCAITY (10) REQUEST
sl@0
   167
Ref SBC 2 5.10
sl@0
   168
Ref SBC 3 5.10
sl@0
   169
*/
sl@0
   170
class TScsiClientReadCapacity10Req: public TScsiClientReq
sl@0
   171
    {
sl@0
   172
public:
sl@0
   173
    /** Length of READ CAPACITY (10) response */
sl@0
   174
    static const TInt KResponseLength = 8;
sl@0
   175
    TScsiClientReadCapacity10Req();
sl@0
   176
    TScsiClientReadCapacity10Req(TLba aLba);
sl@0
   177
    TInt EncodeRequestL(TDes8& aBuffer) const;
sl@0
   178
sl@0
   179
public:
sl@0
   180
    /** SCSI LOGICAL BLOCK ADDRESS */
sl@0
   181
    TLba iLba;
sl@0
   182
    };
sl@0
   183
sl@0
   184
/**
sl@0
   185
Decode READ CAPCAITY (10) RESPONSE
sl@0
   186
*/
sl@0
   187
class TScsiClientReadCapacity10Resp: public TScsiClientResp
sl@0
   188
    {
sl@0
   189
public:
sl@0
   190
    /** Length of READ CAPACITY (10) response */
sl@0
   191
    static const TInt KResponseLength = 8;
sl@0
   192
    TScsiClientReadCapacity10Resp() {};
sl@0
   193
sl@0
   194
    void DecodeL(const TDesC8& aPtr);
sl@0
   195
    TInt DataLength() const {return KResponseLength;}
sl@0
   196
sl@0
   197
public:
sl@0
   198
    /** Returned SCSI LOGICAL BLOCK ADDRESS */
sl@0
   199
    TLba iLba;
sl@0
   200
    /** Returned SCSI BLOCK LENGTH IN BYTES */
sl@0
   201
    TUint32 iBlockSize;
sl@0
   202
    };
sl@0
   203
sl@0
   204
sl@0
   205
/**
sl@0
   206
Base class for encoding SCSI READ (10) and SCSI WRITE (10) requests
sl@0
   207
*/
sl@0
   208
class TScsiClientRdWr10Req: public TScsiClientReq
sl@0
   209
    {
sl@0
   210
public:
sl@0
   211
    TScsiClientRdWr10Req(TOperationCode aOperationCode);
sl@0
   212
    TInt EncodeRequestL(TDes8& aBuffer) const;
sl@0
   213
sl@0
   214
public:
sl@0
   215
    /** SCSI LOGICAL BLOCK ADDRESS field   */
sl@0
   216
    TUint32 iLogicalBlockAddress;
sl@0
   217
    /** SCSI TRANSFER LENGTH field   */
sl@0
   218
    TUint16 iBlockTransferLength;
sl@0
   219
    /** SCSI RDPROTECT or SCSI WRPROTECT field */
sl@0
   220
    TProtect iProtect;
sl@0
   221
    };
sl@0
   222
sl@0
   223
sl@0
   224
/**
sl@0
   225
Encode SCSI READ (10) REQUEST
sl@0
   226
*/
sl@0
   227
class TScsiClientRead10Req: public TScsiClientRdWr10Req
sl@0
   228
    {
sl@0
   229
public:
sl@0
   230
    TScsiClientRead10Req();
sl@0
   231
    TInt EncodeRequestL(TDes8& aBuffer) const;
sl@0
   232
    };
sl@0
   233
sl@0
   234
sl@0
   235
sl@0
   236
/**
sl@0
   237
Encode START STOP UNIT REQUEST
sl@0
   238
Ref SBC-2 5.17
sl@0
   239
*/
sl@0
   240
class TScsiClientStartStopUnitReq: public TScsiClientReq
sl@0
   241
    {
sl@0
   242
public:
sl@0
   243
    TScsiClientStartStopUnitReq();
sl@0
   244
    TInt EncodeRequestL(TDes8& aBuffer) const;
sl@0
   245
sl@0
   246
public:
sl@0
   247
    /** SCSI IMMED flag */
sl@0
   248
    TBool iImmed;
sl@0
   249
    /** SCSI START flag */
sl@0
   250
    TBool iStart;
sl@0
   251
    /** SCSI LOEJ flag */
sl@0
   252
    TBool iLoej;
sl@0
   253
    };
sl@0
   254
sl@0
   255
sl@0
   256
/**
sl@0
   257
Encode SCSI WRITE (10) REQUEST
sl@0
   258
*/
sl@0
   259
class TScsiClientWrite10Req: public TScsiClientRdWr10Req
sl@0
   260
    {
sl@0
   261
public:
sl@0
   262
    TScsiClientWrite10Req();
sl@0
   263
    TInt EncodeRequestL(TDes8& aBuffer) const;
sl@0
   264
    };
sl@0
   265
sl@0
   266
sl@0
   267
#include "tscsiblockcmds.inl"
sl@0
   268
sl@0
   269
#endif // TSCSIBLOCKCMDS_H