1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-30 08:32:52 +08:00

Clean up types

This commit is contained in:
Alex Forencich 2022-03-03 22:45:38 -08:00
parent e3799aa1bf
commit 7fa621bddf
5 changed files with 19 additions and 19 deletions

View File

@ -110,7 +110,7 @@ void flash_release(struct flash_device *fdev)
free(fdev); free(fdev);
} }
int flash_read(struct flash_device *fdev, size_t addr, size_t len, void* dest) int flash_read(struct flash_device *fdev, size_t addr, size_t len, void *dest)
{ {
if (!fdev) if (!fdev)
return -1; return -1;
@ -118,7 +118,7 @@ int flash_read(struct flash_device *fdev, size_t addr, size_t len, void* dest)
return fdev->driver->read(fdev, addr, len, dest); return fdev->driver->read(fdev, addr, len, dest);
} }
int flash_write(struct flash_device *fdev, size_t addr, size_t len, void* src) int flash_write(struct flash_device *fdev, size_t addr, size_t len, const void *src)
{ {
if (!fdev) if (!fdev)
return -1; return -1;

View File

@ -75,22 +75,22 @@ struct flash_device {
struct flash_ops { struct flash_ops {
void (*init)(struct flash_device *fdev); void (*init)(struct flash_device *fdev);
int (*sector_erase)(struct flash_device *fdev, size_t addr); int (*sector_erase)(struct flash_device *fdev, size_t addr);
int (*buffered_program)(struct flash_device *fdev, size_t addr, size_t len, void *src); int (*buffered_program)(struct flash_device *fdev, size_t addr, size_t len, const void *src);
}; };
struct flash_driver { struct flash_driver {
int (*init)(struct flash_device *fdev); int (*init)(struct flash_device *fdev);
void (*release)(struct flash_device *fdev); void (*release)(struct flash_device *fdev);
int (*read)(struct flash_device *fdev, size_t addr, size_t len, void* dest); int (*read)(struct flash_device *fdev, size_t addr, size_t len, void *dest);
int (*write)(struct flash_device *fdev, size_t addr, size_t len, void* src); int (*write)(struct flash_device *fdev, size_t addr, size_t len, const void *src);
int (*erase)(struct flash_device *fdev, size_t addr, size_t len); int (*erase)(struct flash_device *fdev, size_t addr, size_t len);
}; };
struct flash_device *flash_open_spi(int data_width, volatile uint8_t *ctrl_reg); struct flash_device *flash_open_spi(int data_width, volatile uint8_t *ctrl_reg);
struct flash_device *flash_open_bpi(int data_width, volatile uint8_t *ctrl_reg, volatile uint8_t *addr_reg, volatile uint8_t *data_reg); struct flash_device *flash_open_bpi(int data_width, volatile uint8_t *ctrl_reg, volatile uint8_t *addr_reg, volatile uint8_t *data_reg);
void flash_release(struct flash_device *fdev); void flash_release(struct flash_device *fdev);
int flash_read(struct flash_device *fdev, size_t addr, size_t len, void* dest); int flash_read(struct flash_device *fdev, size_t addr, size_t len, void *dest);
int flash_write(struct flash_device *fdev, size_t addr, size_t len, void* src); int flash_write(struct flash_device *fdev, size_t addr, size_t len, const void *src);
int flash_erase(struct flash_device *fdev, size_t addr, size_t len); int flash_erase(struct flash_device *fdev, size_t addr, size_t len);
#endif /* FLASH_H */ #endif /* FLASH_H */

View File

@ -197,9 +197,9 @@ int bpi_flash_intel_sector_erase(struct flash_device *fdev, size_t addr)
return 0; return 0;
} }
int bpi_flash_intel_buffered_program(struct flash_device *fdev, size_t addr, size_t len, void *src) int bpi_flash_intel_buffered_program(struct flash_device *fdev, size_t addr, size_t len, const void *src)
{ {
uint8_t *s = src; const uint8_t *s = (const uint8_t *)src;
bpi_flash_set_addr(fdev, addr); bpi_flash_set_addr(fdev, addr);
bpi_flash_write_cur(fdev, BPI_INTEL_BUFFERED_PROGRAM_SETUP); bpi_flash_write_cur(fdev, BPI_INTEL_BUFFERED_PROGRAM_SETUP);
@ -296,9 +296,9 @@ int bpi_flash_amd_sector_erase(struct flash_device *fdev, size_t addr)
return 0; return 0;
} }
int bpi_flash_amd_buffered_program(struct flash_device *fdev, size_t addr, size_t len, void *src) int bpi_flash_amd_buffered_program(struct flash_device *fdev, size_t addr, size_t len, const void *src)
{ {
uint8_t *s = src; const uint8_t *s = (const uint8_t *)src;
bpi_flash_amd_unlock(fdev); bpi_flash_amd_unlock(fdev);
bpi_flash_write_word(fdev, addr, BPI_AMD_BUFFERED_PROGRAM_SETUP); bpi_flash_write_word(fdev, addr, BPI_AMD_BUFFERED_PROGRAM_SETUP);
@ -379,9 +379,9 @@ int bpi_flash_micron_sector_erase(struct flash_device *fdev, size_t addr)
return 0; return 0;
} }
int bpi_flash_micron_buffered_program(struct flash_device *fdev, size_t addr, size_t len, void *src) int bpi_flash_micron_buffered_program(struct flash_device *fdev, size_t addr, size_t len, const void *src)
{ {
uint8_t *s = src; const uint8_t *s = (const uint8_t *)src;
bpi_flash_set_addr(fdev, addr); bpi_flash_set_addr(fdev, addr);
bpi_flash_write_cur(fdev, BPI_MICRON_BUFFERED_PROGRAM_SETUP); bpi_flash_write_cur(fdev, BPI_MICRON_BUFFERED_PROGRAM_SETUP);
@ -577,9 +577,9 @@ int bpi_flash_read(struct flash_device *fdev, size_t addr, size_t len, void *des
return 0; return 0;
} }
int bpi_flash_write(struct flash_device *fdev, size_t addr, size_t len, void *src) int bpi_flash_write(struct flash_device *fdev, size_t addr, size_t len, const void *src)
{ {
char *s = src; const char *s = src;
while (len > 0) while (len > 0)
{ {

View File

@ -431,9 +431,9 @@ int spi_flash_read(struct flash_device *fdev, size_t addr, size_t len, void *des
return 0; return 0;
} }
int spi_flash_write(struct flash_device *fdev, size_t addr, size_t len, void *src) int spi_flash_write(struct flash_device *fdev, size_t addr, size_t len, const void *src)
{ {
char *s = src; const char *s = src;
int protocol = SPI_PROTO_STR; int protocol = SPI_PROTO_STR;

View File

@ -131,7 +131,7 @@ static void usage(char *name)
name); name);
} }
int flash_read_progress(struct flash_device *fdev, size_t addr, size_t len, void* dest) int flash_read_progress(struct flash_device *fdev, size_t addr, size_t len, void *dest)
{ {
int ret; int ret;
size_t remain = len; size_t remain = len;
@ -181,7 +181,7 @@ int flash_read_progress(struct flash_device *fdev, size_t addr, size_t len, void
return 0; return 0;
} }
int flash_write_progress(struct flash_device *fdev, size_t addr, size_t len, void* src) int flash_write_progress(struct flash_device *fdev, size_t addr, size_t len, const void *src)
{ {
int ret; int ret;
size_t remain = len; size_t remain = len;