From owner-freebsd-firewire Tue Nov 19 22: 5:21 2002 Delivered-To: freebsd-firewire@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 12D0937B401 for ; Tue, 19 Nov 2002 22:05:14 -0800 (PST) Received: from ns.koganei.wide.ad.jp (koganei.wide.ad.jp [202.249.37.254]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2882543E3B for ; Tue, 19 Nov 2002 22:05:13 -0800 (PST) (envelope-from ikob@koganei.wide.ad.jp) Received: from koganei.wide.ad.jp (dhcp-204-42-69-170.ietf55.ops.ietf.org [204.42.69.170]) (authenticated bits=0) by ns.koganei.wide.ad.jp (8.12.3/8.12.3) with ESMTP id gAK68jh6037213; Wed, 20 Nov 2002 15:08:46 +0900 (JST) (envelope-from ikob@koganei.wide.ad.jp) X-Authentication-Warning: ns.koganei.wide.ad.jp: Host dhcp-204-42-69-170.ietf55.ops.ietf.org [204.42.69.170] claimed to be koganei.wide.ad.jp Date: Wed, 20 Nov 2002 01:05:45 -0500 Subject: Re: Kodak on firewire Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v548) Cc: freebsd-firewire@FreeBSD.ORG To: Buzz Slye From: Katsushi Kobayashi In-Reply-To: Message-Id: <1B5B5C1B-FC4E-11D6-B36D-000393D603A4@koganei.wide.ad.jp> Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.548) Sender: owner-freebsd-firewire@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I cannot judge whether your code would work from the attached information. I found the attached SBP-2 test code when I was using earlier developing phase. I think this code is messy and difficult to read. But, I hope it is your help. On 2002.Nov.19, at 01:15 PM, Buzz Slye wrote: > Hi, > > I am going to try this one again. This time it really is a Kodak > camera, > not an Oxford disk. (The result fails the same way.) The Kodak is not > a SCSI device. The Kodak camera is logged in and attached by SBP-II as > follows: > #include #include #include #include #include #include #include #include #include #include #include #include #define SBPRES_HI 0x000f #define SBPRES_LO 0x30000000 usage() { printf("TBD.."); exit(); } main(argc, argv) int argc; char *argv[]; { extern char *optarg; extern int optind; int d; int i, j, len; unsigned long *qld; unsigned long *buf; char ch, node; char devname[] = "/dev/fw0"; struct fw_asyreq *asyreq; struct fw_asybindreq bindreq; struct fw_pkt *fp; struct stat sb; while ((ch = getopt(argc, argv, "I:")) != -1){ switch(ch) { case 'I': strcpy(devname, optarg); break; case '?': default: usage(); break; } } argc -= optind; argv += optind; if( argc < 1 ) { usage(); }else { node = strtoul(argv[0], (char **)NULL, 10); } asyreq = (struct fw_asyreq *)malloc(sizeof(struct fw_asyreq_t) + 512); buf = (unsigned long *)malloc(512); fp = (struct fw_pkt *)buf; d = open(devname, O_RDWR); if(fstat(d, &sb)< 0){ err(1, "stat"); } bindreq.start.hi = SBPRES_HI; bindreq.start.lo = SBPRES_LO; bindreq.len= 2048; #if 1 printf("step 1\n"); if( ioctl(d, FW_SBINDADDR, &bindreq) < 0) { err(1, "ioctl"); } /**/ asyreq->req.sped = 0; asyreq->req.type = FWASREQNODE; asyreq->pkt.mode.wreqb.dst = htons(0xffc0 | node); asyreq->pkt.mode.wreqb.tlrt = 0; asyreq->pkt.mode.wreqb.tcode = 1; asyreq->pkt.mode.wreqb.len = htons(8); asyreq->req.len = 512; asyreq->pkt.mode.wreqb.extcode = 0; asyreq->pkt.mode.wreqb.dest_hi = htons(0xffff); /**/ asyreq->pkt.mode.wreqb.dest_lo = htonl(0xf0030000); /**/ asyreq->pkt.mode.wreqb.dest_lo = htonl(0xf0010000); asyreq->pkt.mode.wreqb.payload[0] = htonl(SBPRES_HI); asyreq->pkt.mode.wreqb.payload[1] = htonl(SBPRES_LO); /**/ /* asyreq->req.sped = 0; asyreq->req.type = FWASREQNODE; asyreq->pkt.mode.wreqq.dst = 0xffc0 | node; asyreq->pkt.mode.wreqq.tlrt = 0; asyreq->pkt.mode.wreqq.tcode = 0; asyreq->pkt.mode.wreqq.data = 0; asyreq->req.len = 512; asyreq->pkt.mode.wreqq.dest_hi = 0xffff; asyreq->pkt.mode.wreqq.dest_lo = 0xf0010008; qld = (unsigned long *)&asyreq->pkt; for(i = 0 ; i < 24 ; i+= 4){ printf("%08x ", qld[i/4]); } printf("\n"); printf("step 2\n"); if( ioctl(d, FW_ASYREQ, asyreq) < 0) { err(1, "ioctl"); } for(i = 0 ; i < asyreq->req.len ; i+= 4){ printf("%08x ", qld[i/4]); } printf("\n"); asyreq->req.sped = 0; asyreq->req.type = FWASREQNODE; asyreq->pkt.mode.wreqq.dst = 0xffc0 | node; asyreq->pkt.mode.wreqq.tlrt = 0; asyreq->pkt.mode.wreqq.tcode = 0; asyreq->pkt.mode.wreqq.data = 0x30000000; asyreq->req.len = 512; asyreq->pkt.mode.wreqq.dest_hi = 0xffff; asyreq->pkt.mode.wreqq.dest_lo = 0xf001000c; */ qld = (unsigned long *)&asyreq->pkt; for(i = 0 ; i < 24 ; i+= 4){ printf("%08x ", ntohl(qld[i/4])); } printf("\n"); printf("step 3\n"); if( ioctl(d, FW_ASYREQ, asyreq) < 0) { err(1, "ioctl"); } for(i = 0 ; i < asyreq->req.len ; i+= 4){ printf("%08x ", ntohl(qld[i/4])); } printf("\n"); len = read(d, buf, 512); if(len < 0){ err(1, "ioctl"); } /* printf("len = %d\n", len); for(i = 0 ; i < len; i+= 4){ printf("%08x ", buf[i/4]); if(((i - 1 )% 64) == 0){ printf("\n"); } } if((i % 64) != 0){ printf("\n"); } */ printf("code %08x ", fp->mode.rreqb.tcode); printf("tlrt %08x ", fp->mode.rreqb.tlrt); printf("addr %08x:", ntohs(fp->mode.rreqb.dest_hi)); printf("%08x ", ntohl(fp->mode.rreqb.dest_lo)); printf("len %08x\n", ntohs(fp->mode.rreqb.len)); asyreq->pkt.mode.rresb.dst = ntohs(0xffc0 | node); asyreq->pkt.mode.rresb.tlrt = fp->mode.rreqb.tlrt; asyreq->pkt.mode.rresb.tcode = 7; asyreq->pkt.mode.rresb.rtcode = 0; asyreq->pkt.mode.rresb.len = fp->mode.rreqb.len; asyreq->req.len = 512; asyreq->pkt.mode.rresb.extcode = 0; printf("len %08x\n", ntohs(fp->mode.rreqb.len)); asyreq->pkt.mode.rresb.payload[0] = 0; asyreq->pkt.mode.rresb.payload[1] = 0; asyreq->pkt.mode.rresb.payload[2] = 0; asyreq->pkt.mode.rresb.payload[3] = ntohl(0x30000200); asyreq->pkt.mode.rresb.payload[4] = ntohl(0x90100000); asyreq->pkt.mode.rresb.payload[5] = ntohl(0x00000200); asyreq->pkt.mode.rresb.payload[6] = ntohl(0x00000000); asyreq->pkt.mode.rresb.payload[7] = ntohl(0x30000400); /**/ for(i = 0 ; i < 40 ; i+= 4){ printf("%08x ", ntohl(qld[i/4])); } printf("\n"); /**/ printf("step 4\n"); if( ioctl(d, FW_ASYREQ, asyreq) < 0) { err(1, "ioctl"); } for(i = 0 ; i < asyreq->req.len ; i+= 4){ printf("%08x ", qld[i/4]); } printf("\n"); len = read(d, buf, 512); if(len < 0){ err(1, "ioctl"); } printf("len = %d\n", len); for(i = 0 ; i < len; i+= 4){ printf("%08x ", buf[i/4]); if(((i - 1 )% 64) == 0){ printf("\n"); } } if((i % 64) != 0){ printf("\n"); } /**/ printf("code %08x ", fp->mode.wreqb.tcode); printf("tlrt %08x ", fp->mode.wreqb.tlrt); printf("addr %08x:", fp->mode.wreqb.dest_hi); printf("%08x ", fp->mode.wreqb.dest_lo); printf("len %08x\n", fp->mode.wreqb.len); printf("%08x %08x %08x\n", fp->mode.wreqb.payload[0], fp->mode.wreqb.payload[1], fp->mode.wreqb.payload[2]); asyreq->pkt.mode.wres.dst = 0xffc0 | node; asyreq->pkt.mode.wres.tlrt = fp->mode.rreqb.tlrt; asyreq->pkt.mode.wres.tcode = 2; asyreq->pkt.mode.wres.rtcode = 0; asyreq->req.len = 512; printf("step 5\n"); if( ioctl(d, FW_ASYREQ, asyreq) < 0) { err(1, "ioctl"); } len = read(d, buf, 512); if(len < 0){ err(1, "ioctl"); } /* printf("len = %d\n", len); for(i = 0 ; i < len; i+= 4){ printf("%08x ", buf[i/4]); if(((i - 1 )% 64) == 0){ printf("\n"); } } if((i % 64) != 0){ printf("\n"); } */ /**/ printf("code %08x ", fp->mode.wreqb.tcode); printf("tlrt %08x ", fp->mode.wreqb.tlrt); printf("addr %08x:", fp->mode.wreqb.dest_hi); printf("%08x ", fp->mode.wreqb.dest_lo); printf("len %08x\n", fp->mode.wreqb.len); printf("%08x %08x %08x\n", fp->mode.wreqb.payload[0], fp->mode.wreqb.payload[1], fp->mode.wreqb.payload[2]); asyreq->pkt.mode.wres.dst = 0xffc0 | node; asyreq->pkt.mode.wres.tlrt = fp->mode.rreqb.tlrt; asyreq->pkt.mode.wres.tcode = 2; asyreq->pkt.mode.wres.rtcode = 0; asyreq->req.len = 512; printf("step 6\n"); if( ioctl(d, FW_ASYREQ, asyreq) < 0) { err(1, "ioctl"); } /**/ #endif #if 0 fp->mode.wres.dst = 0xffc0 | node; fp->mode.wres.rtcode = 0; fp->mode.wreqb.tcode = 2; for(i = 0 ; i < 12 ; i+= 4){ printf("%08x ", buf[i/4]); if(((i - 1 )% 64) == 0){ printf("\n"); } } if((i % 64) != 0){ printf("\n"); } len = write(d, buf, 12); if(len < 0){ err(1, "write"); } #endif } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-firewire" in the body of the message