software: Fix cast from pointer to integer of different size warnings

litex/soc/software/liblitesdcard/sdcard.c: In function 'sdcard_read':
    litex/soc/software/liblitesdcard/sdcard.c:476:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      sdblock2mem_dma_base_write((uint64_t) buf);
				 ^
    litex/soc/software/liblitesdcard/sdcard.c: In function 'sdcard_write':
    litex/soc/software/liblitesdcard/sdcard.c:507:30: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
       sdmem2block_dma_base_write((uint64_t) buf);
				  ^

When casting a pointer (32-bit or 64-bit, depending on the platform) to
a 64-bit integer, an intermediate cast to "uintptr_t" should be used to
avoid warnings like the above.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
This commit is contained in:
Geert Uytterhoeven 2021-01-14 16:24:31 +01:00
parent 5474f563c8
commit a2389c71ea
2 changed files with 4 additions and 4 deletions

View file

@ -51,7 +51,7 @@ void sata_read(uint32_t sector, uint32_t count, uint8_t* buf)
for (i=0; i<count; i++) { for (i=0; i<count; i++) {
uint8_t done = 0; uint8_t done = 0;
while (done == 0) { while (done == 0) {
sata_sector2mem_base_write((uint64_t) buf); sata_sector2mem_base_write((uint64_t)(uintptr_t) buf);
sata_sector2mem_sector_write(sector + i); sata_sector2mem_sector_write(sector + i);
sata_sector2mem_start_write(1); sata_sector2mem_start_write(1);
while ((sata_sector2mem_done_read() & 0x1) == 0); while ((sata_sector2mem_done_read() & 0x1) == 0);
@ -80,7 +80,7 @@ void sata_write(uint32_t sector, uint32_t count, uint8_t* buf)
for (i=0; i<count; i++) { for (i=0; i<count; i++) {
uint8_t done = 0; uint8_t done = 0;
while (done == 0) { while (done == 0) {
sata_mem2sector_base_write((uint64_t) buf); sata_mem2sector_base_write((uint64_t)(uintptr_t) buf);
sata_mem2sector_sector_write(sector + i); sata_mem2sector_sector_write(sector + i);
sata_mem2sector_start_write(1); sata_mem2sector_start_write(1);
while ((sata_sector2mem_done_read() & 0x1) == 0); while ((sata_sector2mem_done_read() & 0x1) == 0);

View file

@ -473,7 +473,7 @@ void sdcard_read(uint32_t block, uint32_t count, uint8_t* buf)
{ {
/* Initialize DMA Writer */ /* Initialize DMA Writer */
sdblock2mem_dma_enable_write(0); sdblock2mem_dma_enable_write(0);
sdblock2mem_dma_base_write((uint64_t) buf); sdblock2mem_dma_base_write((uint64_t)(uintptr_t) buf);
sdblock2mem_dma_length_write(512*count); sdblock2mem_dma_length_write(512*count);
sdblock2mem_dma_enable_write(1); sdblock2mem_dma_enable_write(1);
@ -504,7 +504,7 @@ void sdcard_write(uint32_t block, uint32_t count, uint8_t* buf)
while (count--) { while (count--) {
/* Initialize DMA Reader */ /* Initialize DMA Reader */
sdmem2block_dma_enable_write(0); sdmem2block_dma_enable_write(0);
sdmem2block_dma_base_write((uint64_t) buf); sdmem2block_dma_base_write((uint64_t)(uintptr_t) buf);
sdmem2block_dma_length_write(512); sdmem2block_dma_length_write(512);
sdmem2block_dma_enable_write(1); sdmem2block_dma_enable_write(1);