esp: apply transfer length adjustment when STC is zero at TC load time
Perform the length adjustment whereby a value of 0 in the STC represents a transfer length of 0x10000 at the point where the TC is loaded at the start of a DMA command rather than just when a TI (Transfer Information) command is executed. This better matches the description as given in the datasheet. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20210304221103.6369-12-mark.cave-ayland@ilande.co.uk>
This commit is contained in:
		
							parent
							
								
									c04ed569b0
								
							
						
					
					
						commit
						96676c2f74
					
				@ -561,9 +561,6 @@ static void handle_ti(ESPState *s)
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dmalen = esp_get_tc(s);
 | 
					    dmalen = esp_get_tc(s);
 | 
				
			||||||
    if (dmalen == 0) {
 | 
					 | 
				
			||||||
        dmalen = 0x10000;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    s->dma_counter = dmalen;
 | 
					    s->dma_counter = dmalen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (s->do_cmd) {
 | 
					    if (s->do_cmd) {
 | 
				
			||||||
@ -698,7 +695,11 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val)
 | 
				
			|||||||
        if (val & CMD_DMA) {
 | 
					        if (val & CMD_DMA) {
 | 
				
			||||||
            s->dma = 1;
 | 
					            s->dma = 1;
 | 
				
			||||||
            /* Reload DMA counter.  */
 | 
					            /* Reload DMA counter.  */
 | 
				
			||||||
 | 
					            if (esp_get_stc(s) == 0) {
 | 
				
			||||||
 | 
					                esp_set_tc(s, 0x10000);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
                esp_set_tc(s, esp_get_stc(s));
 | 
					                esp_set_tc(s, esp_get_stc(s));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            s->dma = 0;
 | 
					            s->dma = 0;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user