SD 0.4.2 Release Notes
----------------------

  This release note refers to the initial release of the SDIO driver.
  The note covers:

   - How to use the SD API.
   - How to use the SD test program.

  This is an initial release.  If you have any questions about its
  use, or you find bugs, please email gbarnard@broadon.com Also refer to 
  the SDIO release notes.

Structure of the SDIO release.
------------------------------

	Driver section same as SDIO,

   - SD API header file:

       /opt/iop-sdk/usr/include/iose/sd_api.h


How to use the SD API.
------------------------

  The SD API consists of:

    - Header files.
    - libraries.

  The header file for the SD API is:

    iose/include/sd_api.h

  This header file contains the prototypes for the SD API routines
  as well as comments which should help with using it.

  The libraries for the SD API are:

    iose/os/lib/iossyscalls/libiossyscall_sdio.a
    iose/os/lib/ioslibc/libioslibc.a

  Emulator components which need to use the SD API should link with
  both these libraries.

How to use the SD test program.
---------------------------------

  This release includes an sd driver test program: sd_api_test. 
  The program exercise the basic SD API interface. 
  The basic sequence is as follows, see sd_test() in sd_api_test.c:
  
  1) Attach to driver: ISD_AttachDevice (same as SDIO).
   
  2) Select slot where device is located:
  config.SDDevSlot = 0 for slot 0
                     1 for slot 1
                     
                     OR
                     
	The test program can use the probe function to automatically find 
	in which slot the card has been inserted:
   	config.SDDevSlot = 0;  
    /* --- See if memory card is in slot --- */
    status = ISD_ProbeCard(config.SDDevSlot);
	if (status==IOS_ERROR_OK) 
	{
		printf(" - Probe found SD Card found in slot %d -\n",config.SDDevSlot);  
	}
	else /* see if memory card in other slot */
	{
		config.SDDevSlot = 1;
		status = ISD_AttachDevice(&config, &Handles[config.SDDevSlot][config.SDDevFunc]);
		status = ISD_ProbeCard(config.SDDevSlot);
		if (status==IOS_ERROR_OK) 
		{
			printf(" - Probe found SD Card found in slot %d -\n",config.SDDevSlot);  
		}	
		else
		{	
			printf(" - Probe could not find SD Card. -\n"); 
			return;
		}
	}             

  3) Mount Card: ISD_MountCard. This prepares the card for access, by
  		resetting, 
  		setting voltages,
  		acquiring SD card address (RCA),
  		and putting card in data transfer mode.
  4) Retrieving card information example:
  		cmd_deselect(); take out of data transfer mode for general commands
		cmd_cardsize(); retieve card size
  5) Data transfer and erase examples:
  
  	Note that the data buffer used is 32bit, so 512 bytes is only 128 32bit words.
  	The addresses are printed in accord: 0x80 is start of block.
  	if (cmd_select()==IOS_ERROR_OK)	put back in data transfer mode
	{	
	
		cmd_optimise();	/* put in 4bit mode, 1bit by default */
	
		#if 1
			cmd_writeblocks(0,1024); example to write multiple blocks, 
				SD card address is 0, size is 1024 (multiple of 512bytes)
		#else
			cmd_writeblock(0);	example to write single block
			cmd_writeblock(512);
		#endif
	
		#if 1
			cmd_readblocks(0,1024);
		#else
	    	cmd_readblock(0);
	    	cmd_readblock(512);
	    #endif
	    
	    #if 1
	    	cmd_erase_sector(0);
	    	cmd_readblocks(0,1024);
	    #endif
	}
  6) Unmount and detach. Detach from driver in linux environment not completely functional. 
  So user should exit iose, and run it again to run sd_api_test again.

  Bringing up the session:
  ------------------------

    Same as SDIO:
    1) load drivers,
    2) run iose:
    
$ iose
iose will handle signals in range [34, 64]
USB Core initialized...
SDIO Core initialized...
iossh version: 0.3 starting...
Commands: help
          run<r>{program} [priority] - Run a program from $ROOT/bin
                           Default location: /opt/iop-sdk//usr/bin/iose/
          ls             - List available programs.
          exit<e>        - Exit current shell.
          shutdown<s, x> - Shutdown emulator
You can use the letters in <> as abbreviations for the commands
>r sd_api_test
iossh: will run with default priority: 50
$Id$

======= SD API Test Program =======
sd_api_test: devId 2

------- Tests Start -------
ISD_AttachDevice, attach to Host Driver Dev:4 OK
 - Probe found SD Card found in slot 1 -
ISD_MountCard RCA:0x2931 OK
 - cmd_deselect OK -
 - GetSdStatus:700  READY_FOR_DATA stby
ISD_GetCardSize OK
     Sector Size   = 32
     Total Sectors = 31240
     Card Capacity = 511836160
ISD_ReadCardRegister(CID) OK
     0x0002544D5344353132078000140F0037
 - GetSdStatus:700  READY_FOR_DATA stby
RCA response:00002931
 - select SD card for R/W -
 - Set DataBus Width to 4 -
ISD_WriteMultiBlockAsync(data=0xd16c80 to offset=0x0 blocks=2)
     80000000 80000001 80000002 80000003
     80000080 80000081 80000082 80000083
ISD_ReadMultiBlockAsync(offset=0x0 to data=0xd16c80 blocks=2)
Read block #0 (display in 32bit address)
0x0000:  80000000 80000001 80000002 80000003 80000004 80000005 80000006 80000007
0x0008:  80000008 80000009 8000000a 8000000b 8000000c 8000000d 8000000e 8000000f
0x0010:  80000010 80000011 80000012 80000013 80000014 80000015 80000016 80000017
0x0018:  80000018 80000019 8000001a 8000001b 8000001c 8000001d 8000001e 8000001f
Read block #1 (display in 32bit address)
0x0080:  80000080 80000081 80000082 80000083 80000084 80000085 80000086 80000087
0x0088:  80000088 80000089 8000008a 8000008b 8000008c 8000008d 8000008e 8000008f
0x0090:  80000090 80000091 80000092 80000093 80000094 80000095 80000096 80000097
0x0098:  80000098 80000099 8000009a 8000009b 8000009c 8000009d 8000009e 8000009f
ISD_EraseSectorAsync(sector=0)
ISD_ReadMultiBlockAsync(offset=0x0 to data=0xd16c80 blocks=2)
Read block #0 (display in 32bit address)
0x0000:  ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
0x0008:  ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
0x0010:  ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
0x0018:  ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
Read block #1 (display in 32bit address)
0x0080:  ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
0x0088:  ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
0x0090:  ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
0x0098:  ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff

------- Tests Done -------
ISD_DetachDevice OK
(linux issue require iose restart!)
>

  Bug Fixes
  ---------

  Bugs fixed in this release:
  
  1. Increase device identification delay from 0.5 to 1.0s. 
  This fixes the issue with some SD cards not being detected.
  
# eof
