mirror of
				https://github.com/mfulz/qmk_firmware.git
				synced 2025-10-31 05:12:33 +01:00 
			
		
		
		
	More minor speedups to the AVRISP-MKII clone programmer PDI memory reading code.
This commit is contained in:
		
							parent
							
								
									13b3014db4
								
							
						
					
					
						commit
						e1b19e4e10
					
				| @ -236,21 +236,28 @@ bool XMEGANVM_ReadMemory(const uint32_t ReadAddress, | ||||
| 	XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD); | ||||
| 	XPROGTarget_SendByte(XMEGA_NVM_CMD_READNVM); | ||||
| 
 | ||||
| 	if (ReadSize > 1) | ||||
| 	{ | ||||
| 		/* Load the PDI pointer register with the start address we want to read from */ | ||||
| 		XPROGTarget_SendByte(PDI_CMD_ST | (PDI_POINTER_DIRECT << 2) | PDI_DATSIZE_4BYTES); | ||||
| 		XMEGANVM_SendAddress(ReadAddress); | ||||
| 
 | ||||
| 	if (ReadSize > 1) | ||||
| 	{ | ||||
| 		/* Send the REPEAT command with the specified number of bytes to read */ | ||||
| 		XPROGTarget_SendByte(PDI_CMD_REPEAT | PDI_DATSIZE_1BYTE); | ||||
| 		XPROGTarget_SendByte(ReadSize - 1); | ||||
| 	} | ||||
| 
 | ||||
| 		/* Send a LD command with indirect access and post-increment to read out the bytes */ | ||||
| 		XPROGTarget_SendByte(PDI_CMD_LD | (PDI_POINTER_INDIRECT_PI << 2) | PDI_DATSIZE_1BYTE); | ||||
| 		while (ReadSize-- && TimeoutTicksRemaining) | ||||
| 		  *(ReadBuffer++) = XPROGTarget_ReceiveByte(); | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		/* Send a LDS command with the read address to read out the requested byte */ | ||||
| 		XPROGTarget_SendByte(PDI_CMD_LDS | (PDI_DATSIZE_4BYTES << 2)); | ||||
| 		XMEGANVM_SendAddress(ReadAddress); | ||||
| 		*(ReadBuffer++) = XPROGTarget_ReceiveByte(); | ||||
| 	} | ||||
| 
 | ||||
| 	return (TimeoutTicksRemaining > 0); | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Dean Camera
						Dean Camera