Presentation on theme: "Advanced SCSI Programming Interface A few notes about ASPI for Win32 Some FINE Print: DISCLAIMER: This information is intended ONLY as an overview and."— Presentation transcript:
Advanced SCSI Programming Interface A few notes about ASPI for Win32 Some FINE Print: DISCLAIMER: This information is intended ONLY as an overview and introduction to ASPI and is NOT a specification of any kind. GUSTECH, Solution Technology Inc., and the instructor make no warranty and assume no liability arising from the application or use of any information described herein, and assume no responsibility for errors appearing in this document or for any claims that the concepts or details discussed or disclosed in these materials are proprietary to any person or company. Students are strongly urged to clear any designs proposed for products with their patent and copyright council. Note: company, brand, product, trade, and other names used in this document are trademarks of their respective holders.
29 May 2000Developed by GUSTECH2 ASPI for Win32 Brief Synopsis n SCSI-2 Hosts System Model n ASPI Overview n ASPI Manager & Module(s) n To use ASPI: call 5 Functions n SCSI I/O Requests (SRBs) – with some details concerning: – (SendASPI32Command) – (Execute SCSI I/O Command)
29 May 2000Developed by GUSTECH3 SCSI-2 Hosts System Model Application: Operating System: Device Driver: ASPI Modules: Peripheral Interfaces ASPI ASPI Manager: Host Adapter Driver SCSI Results: -Status -Sense Data Results from HAB -Adapter & Driver Dependent Results from Device Driver -OS Dependent Results from Operating System -OS Dependent File Request includes: -File Name -Length of transfer -Offset in Data Area Block Request built: -Starting Block -Number of Blocks -Pointers to Memory SCSI Request includes: -ASPI command, CDB -Starting Block -Number of Blocks -Pointers to Data Areas SCSI Request includes: -Starting Block -Number of Blocks -Pointers to Data Area NOTE: SCSI bus not shown Host Adapter:
29 May 2000Developed by GUSTECH4 ASPI Overview n Abstraction Layer created to insulate developers from tedious details of the host adapter hardware n Defines a protocol for SCSI Device Driver and programs to submit I/O requests to a host adapter n Designed to increase compatibility and simplify the connection of SCSI peripheral devices n Developed by Adaptec & first completed around 1984
29 May 2000Developed by GUSTECH5 ASPI Overview n ASPI supports re-entry. Up to 255 commands may be queued. ASPI will return from a request immediately, as the request is queued for execution by the manager. There is also support for multi-threaded I/O. n ASPI does NOT support Asynchronous Event Notification (or Reporting). n ASPI supports any length SCSI CDB size. n ASPI does NOT support message phase control
29 May 2000Developed by GUSTECH6 ASPI Overview n ASPI does NOT support tag queuing control n ASPI does NOT support disconnect/reconnect control n ASPI does NOT support narrow/wide negotiation n ASPI does NOT support synchronous negotiation n ASPI supports messages; it does NOT allow you to control the setup of these SCSI features. n If a message feature is not used, ASPI is not responsible for the non-use.
29 May 2000Developed by GUSTECH7 ASPI Overview n ASPI does NOT support command linking n ASPI does NOT support SCSI Bus resets, but it does support Device Resets (message out). n Most current version of ASPI is version 4.57, build 1008. n As this material is for reference only, always go to Adaptec for the latest, official information: www.adaptec.com
29 May 2000Developed by GUSTECH8 ASPI Manager Overview n Operating System and HAB Hardware Dependent; therefore, separate manager for each HAB family n Written to manage Host Adapter Board Resources n Implemented as a Dynamic Link Library wnaspi32.dll n Is the single operating system device driver n Accepts I/O requests from ASPI Modules n Scans SCSI bus for devices and builds table for Modules information
29 May 2000Developed by GUSTECH9 ASPI Module(s) Overview n SCSI client application programs n Submits I/O requests to the ASPI Manager & receives status via function calls n Tailored to each peripheral types unique SCSI Command Set (disk, tape, printer, scanner, etc.) n Integrate each type of SCSI device into the Operating System through ASPI n Does NOT scan the SCSI bus for device info. n Structured as SCSI Request Blocks (SRBs)
29 May 2000Developed by GUSTECH10 to use ASPI... n the following five functions interact with wnaspi32.dll with these entry points (using C calling convention like ___cdecl) : – GetASPI32SupportInfo n Returns the number of host adapters installed and other miscellaneous information. Should call this function to make sure that ASPI is properly initialized before calling: – SendASPI32Command will show more details n Handles all SCSI I/O requests – A command code specifies the type of I/O – Is called with a pointer to the SCSI Request Block – SRB structure is ASPI Command Code dependent
29 May 2000Developed by GUSTECH11 to use ASPI… (continued) n the last three (of five) functions interact with wnaspi32.dll with these entry points: – GetASPI32Buffer n Allocates buffers which meet Win95/WinNT large transfer requirements – up to 512KBytes with safe physical continuity – FreeASPI32Buffer n Releases buffers previously allocated with GetASPI32Buffer – TranslateASPI32Address n Translates ASPI HA/ID/LUN address triples to/from Win95 DEVNODEs. – to associate ASPI target addresses with Plug and Play capability
29 May 2000Developed by GUSTECH12 SendASPI32Command details n Handles all SCSI I/O requests, and n Each is handled through a SCSI Request Block n Each SRB defines the exact ASPI operation n All SRBs have a standard header containing: – SRB_CMD = command code byte – SRB_Status = command status byte (return values) – SRB_HaId = host adapter number byte – SRB_Flags = request flags byte – SRB_Hdr_Rsvd = Reserved, Must = 0, Double Word n All SRBs have a body that is SRB unique, having some or all of: Target ID, LUN, Data pointer & length, Sense Data & CDB length, and Status for HA & Target
29 May 2000Developed by GUSTECH13 SRB_Cmd codes: n SC_HA_INQUIRY = 0x00 = Queries ASPI for information on specific host adapters n SC_GET_DEV_TYPE = 0x01 = Requests the SCSI device type for a specific SCSI target n SC_EXEC_SCSI_CMD = 0x02 = Sends a SCSI command (arbitrary CDB) to a SCSI target will look at in detail later n SC_ABORT_SRB = 0x03 = Requests that ASPI cancel a previously submitted request
29 May 2000Developed by GUSTECH14 SRB_Cmd codes: (continued) n SC_RESET_DEV = 0x04 = Sends a BUS DEVICE RESET message to a SCSI target n SC_GET_DISK_INFO = 0x06 = Returns BIOS information for a SCSI target (Win95 only) n SC_RESCAN_SCSI_BUS = 0x07 = Requests a rescan of a host adapters SCSI bus n SC_GETSET_TIMEOUTS = 0x08 = Sets SRB timeouts for specific SCSI targets
29 May 2000Developed by GUSTECH15 Execute SCSI I/O Command: detail n SRB_Cmd = 02 h @ offset = 00h n Command Status returned (1 of 11) @ offset = 01h n Host Adapter Number @ offset = 02h n SCSI Request Flags (any 3 of 5) @ offset = 03h n Reserved double-word = 0 @ offset = 04h n Target ID @ offset = 08h n Logic Unit Number @ offset = 09h n Reserved word = 0 for alignment @ offset = 0Ah n Buffer Data Allocation Length (r/w) @ offset = 0Ch n Data Buffer Pointer @ offset = 10h n Sense Allocation Length (see 40h) @ offset = 14h
29 May 2000Developed by GUSTECH16 Execute SCSI I/O Command: (continued) n SCSI CDB Length in bytes (see 30h) @ offset = 15h n Host Adapter Status (1 of 11) @ offset = 16h n Target Status (per SCSI Spec) @ offset = 17h n Post Routine Address (if Posting, is pointer to Function; if Event_Notify, is handle to an event on completion of ASPI request) @ offset = 18h n Reserved 20hex bytes = 0 @ offset = 1Ch n SCSI Command Descriptor Block (16 bytes allowed, actual length is per CDB Length value see 15h ) @ offset = 30h n Sense (data buffer) Allocation Area (CAC Request Sense sense data see 14h ) @ offset = 40h
Your consent to our cookies if you continue to use this website.