IDE and Flash Media InterfaceMCF5253 Reference Manual, Rev. 1Freescale Semiconductor 13-2913.5.7.3 Send Command to Card (Write Multiple Data Blocks)This sequence sends a write data command to the card. The card sends back a response token on the CMDline. After receiving this response, the host starts transmitting data on the DAT lines. After every datapacket, the card sends back a CRC status response, followed by a possible busy.The sequence is set to send BLOCKCOUNT data packets to the card. No STOP command is sent as partof this sequence./* write command to host */CMDBITCOUNT = 46if(wide_shift_mode)wide_shift_mask = 0x400000;elsewide_shift_mask = 0;FLASHMEDIACMD2 = 0xC60000 + CMDBITCOUNTwhile(CMDBITCOUNT > 0){if(FLASHMEDIADATA2 empty){write data to FLASHMEDIADATA2CMDBITCOUNT:= CMDBITCOUNT - 32;}}/* one of the two waits need to be done. *//* First one is more suitable for polling *//* second one more suitable for interrupt driven */wait until ((FLASHMEDIACMD2 & 0xFFFF) == 0) ORwait until (SHIFTBUSY2FALL event)/* receive status from host */wait until (SHIFTBUSY2RISE event) ORwait until ((FLASHMEDIASTATUS & 8)!= 0)RESPBITCOUNT = 46 or 134 /* depends on command */FLASHMEDIACMD2 = 0xC00000 + RESPBITCOUNT;while(RESPBITCOUNT > 0){if(FLASHMEDIADATA2 full){read data from FLASHMEDIADATA2RESPBITCOUNT:= RESPBITCOUNT - 32;}}}/* start sending data to card */BLOCKCOUNT:= while(BLOCKCOUNT > 0){-- start transmission of new blockDATABITCOUNT = + crcLen;FLASHMEDIACMD1 = 0x260000 + dataBitCount +wide_shift_mask;while(DATABITCOUNT > 0){if(FLASHMEDIADATA1 empty){write data to FLASHMEDIADATA1