- fixed warnings, produced by Haiku version of gcc;
- space-based indentations replaced with tab-based ones; - USB_v3.h removed - now use system USB interface descriptions; - a bit of cleanup; git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18783 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,14 +1,21 @@
|
|||||||
/*
|
/**
|
||||||
* Copyright (c) 2003-2005 by Siarzhuk Zharski <[email protected]>
|
*
|
||||||
* Distributed under the terms of the BSD License.
|
* TODO: description
|
||||||
|
*
|
||||||
|
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||||
|
* May be used under terms of the MIT License
|
||||||
|
*
|
||||||
|
* Author(s):
|
||||||
|
* Siarzhuk Zharski <[email protected]>
|
||||||
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** definitions that should be in system headers but ... */
|
/** definitions that should be in system headers but ... */
|
||||||
|
|
||||||
#ifndef _USB_DEFS_H_
|
#ifndef _USB_DEFS_H_
|
||||||
#define _USB_DEFS_H_
|
#define _USB_DEFS_H_
|
||||||
|
|
||||||
|
// TODO: Shouldn't it be declared in system USB headers?
|
||||||
#define USB_EP_ATTR_CONTROL 0x00
|
#define USB_EP_ATTR_CONTROL 0x00
|
||||||
#define USB_EP_ATTR_ISOCHRONOUS 0x01
|
#define USB_EP_ATTR_ISOCHRONOUS 0x01
|
||||||
#define USB_EP_ATTR_BULK 0x02
|
#define USB_EP_ATTR_BULK 0x02
|
||||||
@@ -32,6 +39,8 @@
|
|||||||
#define USB_DEV_PROTOCOL_CB 0x01
|
#define USB_DEV_PROTOCOL_CB 0x01
|
||||||
#define USB_DEV_PROTOCOL_BULK 0x50
|
#define USB_DEV_PROTOCOL_BULK 0x50
|
||||||
|
|
||||||
|
//TODO: And this was in old v3 stack what now ???
|
||||||
#define B_DEV_STALLED 0x8000a015 /* some "forgotten" error */
|
#define B_DEV_STALLED 0x8000a015 /* some "forgotten" error */
|
||||||
|
|
||||||
#endif /*_USB_DEFS_H_*/
|
#endif /*_USB_DEFS_H_*/
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
/*
|
/**
|
||||||
* Copyright (c) 2003-2005 by Siarzhuk Zharski <[email protected]>
|
*
|
||||||
* Distributed under the terms of the BSD License.
|
* TODO: description
|
||||||
|
*
|
||||||
|
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||||
|
* May be used under terms of the MIT License
|
||||||
|
*
|
||||||
|
* Author(s):
|
||||||
|
* Siarzhuk Zharski <[email protected]>
|
||||||
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Main part of USB SIM implementation */
|
/** Main part of USB SIM implementation */
|
||||||
|
|
||||||
#include "usb_scsi.h"
|
#include "usb_scsi.h"
|
||||||
@@ -25,8 +31,7 @@
|
|||||||
#include "fake_device.h"
|
#include "fake_device.h"
|
||||||
#include "sg_buffer.h"
|
#include "sg_buffer.h"
|
||||||
|
|
||||||
status_t device_added(const usb_device device,
|
status_t device_added(const usb_device device, void **cookie);
|
||||||
void **cookie);
|
|
||||||
|
|
||||||
status_t device_removed(void *cookie);
|
status_t device_removed(void *cookie);
|
||||||
|
|
||||||
@@ -68,6 +73,18 @@ struct usb_notify_hooks notify_hooks = {
|
|||||||
device_added,
|
device_added,
|
||||||
device_removed
|
device_removed
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* function prototupes */
|
||||||
|
static status_t get_interface_properties(usb_interface_info *uii, uint32 *pproperties);
|
||||||
|
static status_t load_vendor_module(char **path, const char *path_mask, const char *prop, module_info **mi);
|
||||||
|
static status_t setup_transport_modules(usb_device_info *udi, usb_device_settings *uds);
|
||||||
|
static status_t setup_endpoints(usb_interface_info *uii, usb_device_info *udi);
|
||||||
|
static status_t allocate_resources(usb_device_info *udi);
|
||||||
|
static void release_resources(usb_device_info *udi);
|
||||||
|
static status_t xpt_scsi_io(CCB_SCSIIO *ccbio);
|
||||||
|
static status_t xpt_path_inquiry(CCB_PATHINQ *ccbp);
|
||||||
|
static status_t xpt_extended_path_inquiry(CCB_EXTENDED_PATHINQ *ccbep);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\fn:match_device
|
\fn:match_device
|
||||||
\param device:???
|
\param device:???
|
||||||
@@ -77,8 +94,7 @@ struct usb_notify_hooks notify_hooks = {
|
|||||||
|
|
||||||
??
|
??
|
||||||
*/
|
*/
|
||||||
status_t get_interface_properties(usb_interface_info *uii,
|
status_t get_interface_properties(usb_interface_info *uii, uint32 *pproperties)
|
||||||
uint32 *pproperties)
|
|
||||||
{
|
{
|
||||||
status_t status = B_BAD_TYPE;
|
status_t status = B_BAD_TYPE;
|
||||||
if(uii->descr->interface_class == USB_DEV_CLASS_MASS){
|
if(uii->descr->interface_class == USB_DEV_CLASS_MASS){
|
||||||
@@ -212,8 +228,7 @@ release_transport_modules(usb_device_info *udi)
|
|||||||
/**
|
/**
|
||||||
\fn:
|
\fn:
|
||||||
*/
|
*/
|
||||||
status_t setup_endpoints(usb_interface_info *uii,
|
status_t setup_endpoints(usb_interface_info *uii, usb_device_info *udi)
|
||||||
usb_device_info *udi)
|
|
||||||
{
|
{
|
||||||
status_t status = B_OK;
|
status_t status = B_OK;
|
||||||
int16 idx = 0;
|
int16 idx = 0;
|
||||||
@@ -336,8 +351,7 @@ void release_resources(usb_device_info *udi)
|
|||||||
|
|
||||||
??
|
??
|
||||||
*/
|
*/
|
||||||
status_t device_added(const usb_device device,
|
status_t device_added(const usb_device device, void **cookie){
|
||||||
void **cookie){
|
|
||||||
status_t status = B_NO_MEMORY;
|
status_t status = B_NO_MEMORY;
|
||||||
const usb_configuration_info *uci = NULL;
|
const usb_configuration_info *uci = NULL;
|
||||||
uint16 cfg = 0;
|
uint16 cfg = 0;
|
||||||
@@ -346,8 +360,11 @@ status_t device_added(const usb_device device,
|
|||||||
const usb_device_descriptor *udd = (*usb->get_device_descriptor)(device);
|
const usb_device_descriptor *udd = (*usb->get_device_descriptor)(device);
|
||||||
usb_device_info *udi = (usb_device_info *)malloc(sizeof(usb_device_info));
|
usb_device_info *udi = (usb_device_info *)malloc(sizeof(usb_device_info));
|
||||||
TRACE("device_added: probing canidate: "
|
TRACE("device_added: probing canidate: "
|
||||||
"%04x/%04x %02d/%02d/%02d\n", udd->vendor_id, udd->product_id,
|
"%04x/%04x %02d/%02d/%02d\n",
|
||||||
udd->device_class, udd->device_subclass, udd->device_protocol);
|
udd->vendor_id, udd->product_id,
|
||||||
|
udd->device_class,
|
||||||
|
udd->device_subclass,
|
||||||
|
udd->device_protocol);
|
||||||
if(udi){
|
if(udi){
|
||||||
status = B_NO_INIT;
|
status = B_NO_INIT;
|
||||||
while(!b_found && (uci = (*usb->get_nth_configuration)(device, cfg++))){
|
while(!b_found && (uci = (*usb->get_nth_configuration)(device, cfg++))){
|
||||||
@@ -478,8 +495,7 @@ static long sim_init(void)
|
|||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
pre_check_scsi_io_request(usb_device_info *udi,
|
pre_check_scsi_io_request(usb_device_info *udi, CCB_SCSIIO *ccbio,
|
||||||
CCB_SCSIIO *ccbio,
|
|
||||||
status_t *ret_status)
|
status_t *ret_status)
|
||||||
{
|
{
|
||||||
int target_id = ccbio->cam_ch.cam_target_id;
|
int target_id = ccbio->cam_ch.cam_target_id;
|
||||||
@@ -521,10 +537,8 @@ pre_check_scsi_io_request(usb_device_info *udi,
|
|||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
pre_handle_features(usb_device_info *udi,
|
pre_handle_features(usb_device_info *udi, CCB_SCSIIO *ccbio,
|
||||||
CCB_SCSIIO *ccbio,
|
scsi_cmd_generic *command, sg_buffer *sgb,
|
||||||
scsi_cmd_generic *command,
|
|
||||||
sg_buffer *sgb,
|
|
||||||
status_t *ret_status)
|
status_t *ret_status)
|
||||||
{
|
{
|
||||||
uint8 target_lun = ccbio->cam_ch.cam_target_lun;
|
uint8 target_lun = ccbio->cam_ch.cam_target_lun;
|
||||||
@@ -600,10 +614,8 @@ set_REQ_INVALID_and_return:
|
|||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
post_handle_features(usb_device_info *udi,
|
post_handle_features(usb_device_info *udi, CCB_SCSIIO *ccbio,
|
||||||
CCB_SCSIIO *ccbio,
|
scsi_cmd_generic *command, sg_buffer *sgb,
|
||||||
scsi_cmd_generic *command,
|
|
||||||
sg_buffer *sgb,
|
|
||||||
status_t *ret_status)
|
status_t *ret_status)
|
||||||
{
|
{
|
||||||
bool b_cmd_ok = (ccbio->cam_ch.cam_status == CAM_REQ_CMP);
|
bool b_cmd_ok = (ccbio->cam_ch.cam_status == CAM_REQ_CMP);
|
||||||
@@ -810,6 +822,7 @@ status_t xpt_scsi_io(CCB_SCSIIO *ccbio)
|
|||||||
status_t xpt_path_inquiry(CCB_PATHINQ *ccbp)
|
status_t xpt_path_inquiry(CCB_PATHINQ *ccbp)
|
||||||
{
|
{
|
||||||
status_t status = B_OK;
|
status_t status = B_OK;
|
||||||
|
|
||||||
ccbp->cam_version_num = SIM_VERSION;
|
ccbp->cam_version_num = SIM_VERSION;
|
||||||
ccbp->cam_target_sprt = 0;
|
ccbp->cam_target_sprt = 0;
|
||||||
ccbp->cam_hba_eng_cnt = 0;
|
ccbp->cam_hba_eng_cnt = 0;
|
||||||
@@ -962,3 +975,4 @@ _EXPORT module_info *modules[] = {
|
|||||||
(module_info *) &sim_usb_module,
|
(module_info *) &sim_usb_module,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
/*
|
/**
|
||||||
* Copyright (c) 2003-2005 by Siarzhuk Zharski <[email protected]>
|
*
|
||||||
* Distributed under the terms of the BSD License.
|
* TODO: description
|
||||||
|
*
|
||||||
|
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||||
|
* May be used under terms of the MIT License
|
||||||
|
*
|
||||||
|
* Author(s):
|
||||||
|
* Siarzhuk Zharski <[email protected]>
|
||||||
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _USB_SCSI_H_
|
#ifndef _USB_SCSI_H_
|
||||||
#define _USB_SCSI_H_
|
#define _USB_SCSI_H_
|
||||||
|
|
||||||
@@ -11,9 +17,9 @@
|
|||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#endif //_OS_H
|
#endif //_OS_H
|
||||||
|
|
||||||
#ifndef _USB_V3_H
|
#ifndef _USB_V3_H_
|
||||||
#include "USB_v3.h"
|
#include <USB3.h>
|
||||||
#endif /* _USB_V3_H */
|
#endif /* _USB_V3_H_ */
|
||||||
|
|
||||||
#ifndef _CAM_H
|
#ifndef _CAM_H
|
||||||
#include <CAM.h>
|
#include <CAM.h>
|
||||||
@@ -70,3 +76,4 @@
|
|||||||
HAS_SET((__value), (__fix))
|
HAS_SET((__value), (__fix))
|
||||||
|
|
||||||
#endif /*_USB_SCSI_H_*/
|
#endif /*_USB_SCSI_H_*/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user