21 #include "user_config.h"
161 AMIGO_REQUEST_STATUS,
162 AMIGO_REQUEST_STATUS_UNBUFFERED,
163 AMIGO_REQUEST_STATUS_BUFFERED,
164 AMIGO_REQUEST_LOGICAL_ADDRESS,
165 AMIGO_COLD_LOAD_READ,
166 AMIGO_READ_UNBUFFERED,
168 AMIGO_WRITE_UNBUFFERED,
169 AMIGO_WRITE_BUFFERED,
184 AMIGOs->state = AMIGO_IDLE;
186 memset(AMIGOs->status,0,
sizeof(AMIGOs->status));
187 memset(AMIGOs->logical_address,0,
sizeof(AMIGOs->logical_address));
215 AMIGOs->logical_address[0] = 0xff & (AMIGOs->cyl >> 8);
217 AMIGOs->logical_address[1] = 0xff & (AMIGOs->cyl);
218 AMIGOs->logical_address[2] = 0xff & (AMIGOs->head);
219 AMIGOs->logical_address[3] = 0xff & (AMIGOs->sector);
235 printf(
"[AMIGO request status]\n");
237 AMIGOs->status[0] = 0x00;
239 AMIGOs->status[1] = AMIGOs->unitNO;
240 AMIGOs->status[2] = 0x0d;
241 AMIGOs->status[3] = 0x00;
245 AMIGOs->status[3] |= 0x40;
246 AMIGOs->status[3] |= 0x20;
251 AMIGOs->status[0] = 0b00010011;
252 AMIGOs->status[3] |= 0x08;
254 else if(AMIGOs->Errors || AMIGOs->dsj == 1)
258 AMIGOs->status[0] = 0b00010011;
260 AMIGOs->status[0] = 0b00001010;
262 AMIGOs->status[3] |= 0x03;
264 AMIGOs->status[0] = 0b00010011;
266 AMIGOs->status[3] |= 0x04;
268 AMIGOs->status[3] |= 0x10;
269 AMIGOs->status[2] |= 0x80;
292 printf(
"[AMIGO send logical address]\n");
302 printf(
"[AMIGO GPIB write error]\n");
324 printf(
"[AMIGO send status]\n");
333 printf(
"[AMIGO GPIB write error]\n");
355 pos = (long) ( AMIGOp->GEOMETRY.SECTORS_PER_TRACK * p->
head);
356 pos += (long) ( (AMIGOp->GEOMETRY.SECTORS_PER_TRACK * AMIGOp->GEOMETRY.HEADS) * p->
cyl);
358 pos *= (
long) AMIGOp->GEOMETRY.BYTES_PER_SECTOR;
362 printf(
"[AMIGO %s, P:%08lxH, U:%d C:%d H:%d S:%d]\n",
378 while(p->
sector >= AMIGOp->GEOMETRY.SECTORS_PER_TRACK)
382 while (p->
head >= AMIGOp->GEOMETRY.HEADS)
386 if (p->
cyl >= AMIGOp->GEOMETRY.CYLINDERS)
390 printf(
"[AMIGO %s pos OVERFLOW]\n", msg);
436 stat = amigo_overflow_check(p,
"Seek");
444 AMIGOs->sector = p->
sector;
445 AMIGOs->head = p->
head;
446 AMIGOs->cyl = p->
cyl;
466 pos = amigo_chs_to_logical(AMIGOs,
"Verify Start");
470 printf(
"[AMIGO verify P:%08lXH, sectors:%04XH]\n", pos, sectors);
475 pos = amigo_chs_to_logical(AMIGOs,
"Verfify");
489 if(AMIGOs->Errors || len != AMIGOp->GEOMETRY.BYTES_PER_SECTOR )
525 memset((
void *)
gpib_iobuff, db, AMIGOp->GEOMETRY.BYTES_PER_SECTOR);
529 printf(
"[AMIGO format]\n");
536 pos = amigo_chs_to_logical(AMIGOs,
"Format");
539 pos,
gpib_iobuff,AMIGOp->GEOMETRY.BYTES_PER_SECTOR, &AMIGOs->Errors);
541 if(AMIGOs->Errors || len != AMIGOp->GEOMETRY.BYTES_PER_SECTOR)
566 printf(
"[AMIGO Format Done]\n");
587 pos = amigo_chs_to_logical(AMIGOs,
"Buffered Read");
590 printf(
"AMIGOs->state:%d\n", AMIGOs->state);
606 printf(
"[AMIGO GPIB disk read error]\n");
623 if(status &
ERROR_MASK || len != AMIGOp->GEOMETRY.BYTES_PER_SECTOR)
628 printf(
"[AMIGO GPIB bus write error]\n");
660 pos = amigo_chs_to_logical(AMIGOs,
"Buffered Read");
663 printf(
"AMIGOs->state:%d\n", AMIGOs->state);
675 if(AMIGOs->Errors || len != AMIGOp->GEOMETRY.BYTES_PER_SECTOR)
719 if(status &
ERROR_MASK || len != AMIGOp->GEOMETRY.BYTES_PER_SECTOR)
724 printf(
"[AMIGO GPIB write error]\n");
745 pos = amigo_chs_to_logical(AMIGOs,
"Buffered Write");
757 printf(
"AMIGOs->state:%d\n", AMIGOs->state);
762 if(status &
ERROR_MASK || len != AMIGOp->GEOMETRY.BYTES_PER_SECTOR)
767 printf(
"[AMIGO Write GPIB read error]\n");
788 printf(
"[AMIGO Write disk write error]\n");
818 tmp[0] = AMIGOs->
dsj;
822 if(status &
ERROR_MASK || len !=
sizeof(tmp) )
827 printf(
"[AIMGO: DSJ send failed]\n");
834 printf(
"[DSJ %02XH]\n", AMIGOs->dsj);
858 printf(
"[AMIGO Wakeup]\n");
860 tmp[0] = AMIGOs->dsj;
867 printf(
"[AMIGO GPIB write error]\n");
886 printf(
"[AMIGO Clear]\n");
913 printf(
"[L Amigo TODO secondary: %02XH, state:%02XH, opcode:%02XH, len:%3d, listening:%02XH, talking:%02XH]\n",
916 printf(
"[T Amigo TODO secondary: %02XH, state:%02XH, opcode:%02XH, len:%3d, listening:%02XH, talking:%02XH]\n",
919 printf(
"[UNT Amigo TODO secondary: %02XH, state:%02XH, opcode:%02XH, len:%3d, listening:%02XH, talking:%02XH]\n",
922 printf(
"[U Amigo TODO secondary: %02XH, state:%02XH, opcode:%02XH, len:%3d, listening:%02XH, talking:%02XH]\n",
938 printf(
"[L Amigo TODO secondary: %02XH, state:%02XH, listening:%02XH, talking:%02XH]\n",
941 printf(
"[T Amigo TODO secondary: %02XH, state:%02XH, listening:%02XH, talking:%02XH]\n",
944 printf(
"[UNT Amigo TODO secondary: %02XH, state:%02XH, listening:%02XH, talking:%02XH]\n",
947 printf(
"[E Amigo ERROR secondary: %02XH, state:%02XH, listening:%02XH, talking:%02XH]\n",
960 AMIGOs->unitNO = unit;
961 if(AMIGOs->unitNO != 0)
995 printf(
"[AMIGO Command(%02XH): listen:%02XH, talk:%02XH]\n",
1011 printf(
"[AMIGO_Command:GPIB write error]\n");
1036 printf(
"[AMIGO Command:GPIB read error]\n");
1056 printf(
"[AMIGO Command:GPIB read error]\n");
1061 printf(
"[AMIGO Command(%02XH): GPIB read bytes:%02XH]\n",
1076 if(op == 0x00 && len == 2)
1083 printf(
"[AMIGO Cold Load Read Command]\n");
1091 tmp.
head = ( (0xff & *ptr) >> 6) & 0x03;
1092 tmp.
sector = 0x3f & *ptr;
1096 AMIGOs->state = AMIGO_COLD_LOAD_READ;
1100 else if(op == 0x02 && len == 5)
1109 printf(
"[AMIGO Seek len=5]\n");
1116 tmp.
cyl = 0xff & *ptr++;
1117 tmp.
head = 0xff & *ptr++;
1118 tmp.
sector = 0xff & *ptr++;
1124 else if(op == 0x02 && len == 6)
1133 printf(
"[AMIGO Seek len=6]\n");
1139 tmp.
cyl = (0xff & *ptr++) << 8;
1140 tmp.
cyl |= (0xff & *ptr++);
1141 tmp.
head = 0xff & *ptr++;
1142 tmp.
sector = 0xff & *ptr++;
1148 else if(op == 0x03 && len == 2)
1153 printf(
"[AMIGO Request Status Buffered Command]\n");
1159 AMIGOs->state = AMIGO_REQUEST_STATUS_BUFFERED;
1162 else if(op == 0x05 && len == 2)
1167 printf(
"[AMIGO Read Unbuffered Command]\n");
1172 AMIGOs->state = AMIGO_READ_UNBUFFERED;
1181 else if(op == 0x07 && len == 4)
1186 printf(
"[AMIGO Verify]\n");
1191 sectors = (0xff & *ptr++) << 8;
1192 sectors |= (0xff & *ptr++);
1195 else if(op == 0x08 && len == 2)
1199 printf(
"[AMIGO Write Unbuffered Command]\n");
1204 AMIGOs->state = AMIGO_WRITE_UNBUFFERED;
1208 else if((op == 0x0B || op == 0x2b) && len == 2)
1212 printf(
"[AMIGO Initialize Command]\n");
1217 AMIGOs->state = AMIGO_INITIALIZE;
1221 else if(op == 0x14 && len == 2)
1225 printf(
"[AMIGO Request Logical Address Command]\n");
1228 AMIGOs->state = AMIGO_REQUEST_LOGICAL_ADDRESS;
1235 if(op == 0x08 && len == 2)
1239 printf(
"[AMIGO Write Buffered Command]\n");
1244 AMIGOs->state = AMIGO_WRITE_BUFFERED;
1251 if(op == 0x03 && len == 2)
1255 printf(
"[AMIGO Request Status Unbuffered Command]\n");
1260 AMIGOs->state = AMIGO_REQUEST_STATUS_UNBUFFERED;
1264 if(op == 0x05 && len == 2)
1268 printf(
"[AMIGO Read Buffered Command]\n");
1273 AMIGOs->state = AMIGO_READ_BUFFERED;
1285 if(op == 0x18 && len == 5)
1292 printf(
"[AMIGO Format]\n");
1326 printf(
"[AMIGO Execute(%02XH): listen:%02XH, talk:%02XH]\n",
1343 switch(AMIGOs->state)
1347 case AMIGO_COLD_LOAD_READ:
1350 printf(
"[AMIGO Execute Cold Load Read]\n");
1353 case AMIGO_READ_UNBUFFERED:
1356 printf(
"[AMIGO Execute Read Unbuffered]\n");
1359 case AMIGO_READ_BUFFERED:
1362 printf(
"[AMIGO Execute Read Buffered]\n");
1365 case AMIGO_WRITE_UNBUFFERED:
1368 printf(
"[AMIGO Execute Write Unbuffered]\n");
1371 case AMIGO_INITIALIZE:
1374 printf(
"[AMIGO Execute Initialize]\n");
1377 case AMIGO_WRITE_BUFFERED:
1380 printf(
"[AMIGO Execute Write Buffered]\n");
1386 AMIGOs->state = AMIGO_IDLE;
1390 switch(AMIGOs->state)
1394 case AMIGO_REQUEST_STATUS_BUFFERED:
1397 printf(
"[AMIGO Execute Request Status Buffered]\n");
1400 case AMIGO_REQUEST_STATUS_UNBUFFERED:
1403 printf(
"[AMIGO Exicute Request Status Unbuffered]\n");
1406 case AMIGO_REQUEST_LOGICAL_ADDRESS:
1409 printf(
"[AMIGO Execute Request Logical Address]\n");
1415 AMIGOs->state = AMIGO_IDLE;
1480 if(ch == 0x7e && ch == 0x7f)
1491 #endif //ifdef AMIGO