[0m


FDC(4)		    UNIX Programmer's Manual		   FDC(4)



[1mNAME
     [0mfd - micro diskette drive.

[1mDESCRIPTION
     [0mFiles in the directory /_d_e_v whose names are of the form:
     _f_d{_f,_v}{_2_5_6,_5_1_2,_1_0_2_4} or _r_f_d{_f,_v}{_2_5_6,_5_1_2,_1_0_2_4} are block
     and character devices respectively which refer to the
     built-in micro diskette drive using various sector sizes and
     layouts.  There are 6 block devices and 6 character (raw)
     devices.  There may also be names of the form:
     _f_d{_f,_v}{_2_5_6,_5_1_2,_1_0_2_4}{_a,_b} or _r_f_d{_f,_v}{_2_5_6,_5_1_2,_1_0_2_4}{_a,_b}
     which allow use of a second micro diskette drive, if fitted;
     those ending in "a" are equivalent to those without such a
     suffix in referring to drive zero, while those ending in "b"
     refer to the second drive, drive one, with parameters ident-
     ical to those of the corresponding drive zero.  In the dis-
     cussion below, mention of any device pertains equally to
     that device name suffixed with "a" or "b".

     The device [_r]_f_d_f_2_5_6 uses 2560 256-byte sectors physically
     laid out on the disk surfaces in a manner similar to the
     "ADFS" format used on the British Broadcasting Corporation
     Master Compact Microcomputer 3.5 inch disk.  The device
     [_r]_f_d_f_5_1_2 uses 1440 512-byte sectors physically laid out in
     a manner similar to MS-DOS 720Kbyte floppy format.  The dev-
     ice [_r]_f_d_f_1_0_2_4 uses 800 1024-byte sectors physically laid
     out in a manner similar to the "ADFS" format used by Acorn
     Archimedes computers' native operating system.  This is the
     recommended format.

     The devices [_r]_f_d_v_2_5_6, [_r]_f_d_v_5_1_2 and [_r]_f_d_v_1_0_2_4 are devices
     which may have sector sizes, interleave etc arbitrarily
     varied, but which are initialised at system boot time to the
     same parameters as [_r]_f_d_f_2_5_6, [_r]_f_d_f_5_1_2 and [_r]_f_d_f_1_0_2_4
     respectively.

     Note that in all cases the formats referred to above are
     followed in respect of the _p_h_y_s_i_c_a_l _a_d_d_r_e_s_s_i_n_g _a_n_d _s_i_z_e of
     data sectors on the disc, but the _l_o_g_i_c_a_l _s_t_r_u_c_t_u_r_e of data
     stored in the sectors is _n_o_t in the driver's control, i.e.
     ADFS or MSDOS directories, free-space maps etc are not
     created or maintained by the device driver, it is just the
     order of access of tracks, sector size and interleave param-
     eters which are determined by the device.	Thus it is
     entirely up to the code using the driver how the data stored
     in the sectors is interpreted or constructed.

     Only one type of device may be opened at once.

     _I_o_c_t_l(2) commands are available on the raw devices (whose
     names begin with `r') to format diskettes according to the
     [1mISO [0mspecification, to enquire about the sector size and



Printed 13/2/92     Revision 1.9 of 04/05/89			1






FDC(4)		    UNIX Programmer's Manual		   FDC(4)



     interleave parameters, and to download sector size and
     interleave information onto the devices which permit user
     definition.

     The following _i_o_c_t_l(2) commands are available. The constants
     and structure definitions are all given in the header file
     [1m<fdioctl.h>[0m.  In all the descriptions _f_d represents a file
     descriptor open to the raw device.

     [1mioctl(fd, XIOCFORMAT, &result) [0mformats the diskette accord-
     ing to the current sector size, number of tracks and sec-
     tors. If the format operation is successful, the [1mint [0mvalue
     _r_e_s_u_l_t is set to zero. Otherwise _r_e_s_u_l_t is set to a bit pat-
     tern consisting of the value

	0xF1000000   if an error occurred seeking to a track or
	0xF2000000   if an error occurred writing a track
	+ 0x100      if the error occurred on the second side
	+ track number

     The first error encountered causes the format operation to
     be aborted.

     [1mioctl(fd, XIOCGPARM, &layout) [0mreports the sector size and
     interleave parameters for the device.  _L_a_y_o_u_t is a structure
     of the following format:

	struct	     xiocparm	  {
	      unsigned	char	  fd_bytes;	  /*  Bytes/sector / 256  */
	      unsigned	char	  fd_sects;	  /*  Sectors/track  */
	      unsigned	char	  fd_tracks;	  /*  Tracks per side  */
	      unsigned	char	  fd_interleave;  /*  Interleave factor  */
	      unsigned	char	  fd_skew;	  /*  Intertrack skew  */
	      unsigned	char	  fd_inittrack;   /*  Track to start at  */
	      unsigned	  fd_snstart : 1; /*  Sector nos start at 0 or 1  */
	      unsigned	  fd_cylmode : 1; /*  0 surface by surface 1 cyl  */
	      unsigned	  fd_backside : 1;	  /* 2nd side goes backwards */
	      unsigned	  fd_hardskew : 1;	  /* skew applied at format time */
	};

     Interleave values of 0 and 1 are synonymous.

     The field _f_d__i_n_i_t_t_r_a_c_k is provided as some diskette formats
     commence at other than the first track on the diskette, run
     to the end and then start at the beginning again.

     The field _f_d__b_a_c_k_s_i_d_e is only defined if surface mode is
     selected; this means that the second side is accessed moving
     outwards from the centre of the diskette.

     The field _f_d__h_a_r_d_s_k_e_w determines whether the skew and inter-
     leave parameters are applied when the diskette is formatted



Printed 13/2/92     Revision 1.9 of 04/05/89			2






FDC(4)		    UNIX Programmer's Manual		   FDC(4)



     (1) or as a remapping when the diskette is read or written
     (0).

     [1mioctl(fd, XIOCSPARM, &layout) [0mmay only be applied to the
     variable devices _r_f_d_v_2_5_6, _r_f_d_v_5_1_2 and _r_f_d_v_1_0_2_4.  A pointer
     to an instance of the above structure is passed, and the
     parameters are installed for the device.  Once they have
     been installed, they remain unchanged, even if the device is
     closed, until reset or the system is rebooted.  It is the
     responsibility of the user to ensure that the parameters are
     sensible.	Note that setting a variable device's parameters
     can only be done via the raw interface to the device
     (/dev/rfdv_n_n_n), but the changes are immediately reflected in
     the behaviour of the corresponding block interface
     (/dev/fdv_n_n_n).

     The standard parameters for the fixed-format devices, and
     the initial values of the variable-format devices are as
     follows:

	Device	  Sector size	 Sectors/  Surface/  Sector    Skew
	Number	  bytes          Track	   Cylinder  Numbering

	256	  256		 16	   Surface   0	       0
	512	  512		 9	   Cylinder  1	       0
	1024	  1024		 5	   Cylinder  0	       0

     In all cases the skew type is "hard" and there is no inter-
     leave.

     The command [1mioctl(fd, XIOCSSTD, arg) [0mresets one of the vari-
     able devices _r_f_d_v_2_5_6, _r_f_d_v_5_1_2 or _r_f_d_v_1_0_2_4 to a standard for-
     mat, given by the integer value _a_r_g, which may be _X_S_T_0, _X_S_T_1
     or _X_S_T_2 to set to the same formats as _r_f_d_f_1_0_2_4, _r_f_d_f_2_5_6 and
     _r_f_d_f_5_1_2 respectively.

[1mFILES
     [0m/dev/fdf* - fixed format block devices
     /dev/fdv* - variable format block devices
     /dev/rfdf*               - fixed format raw devices
     /dev/rfdv*               - variable format raw devices

[1mSEE ALSO
     [0mffd(8), adfsls(1), adfscat(1), adfscp(1), adfsrm(1),
     wradfs(1), msdosls(1), msdoscat(1), msdoscp(1), msdosrm(1),
     wrmsdos(1).

[1mDIAGNOSTICS
     [0mVarious error conditions are noted, and appropriate messages
     are output on the console.





Printed 13/2/92     Revision 1.9 of 04/05/89			3






FDC(4)		    UNIX Programmer's Manual		   FDC(4)



[1mLIMITATIONS
     [0mThe raw devices are restrictive in the disc position and
     size of data transfer requests made using read/write calls.
     All requests must be aligned with respect to the start of
     the disc in units of 512 bytes or the disc sector size,
     whichever is larger; the length of a request must similarly
     be an integral multiple of this number.  Failure to comply
     with these requirements will cause an error to be returned.

     It is a limitation of the current block device interface
     (for [1mall [0mblock devices, not just the floppy disc devices)
     that attempts to write beyond the end of a disc or disc par-
     tition will fail silently, with no error reported or
     returned to the user.  Such an attempt made on the raw
     interface will return the error ENXIO.

     Inappropriate sector sizes etc (e.g. sector size 768), given
     when size and interleave parameters are installed on a vari-
     able device, will not be detected until later, when the sec-
     tors prove to be of some random different length.



































Printed 13/2/92     Revision 1.9 of 04/05/89			4



[0m