mirror of
https://git.freebsd.org/src.git
synced 2026-01-11 19:57:22 +00:00
sdio: add sdio_{read,write}_2
This is equivalent of sdio_readw and sdio_writew in linuxkpi Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1951
This commit is contained in:
parent
930a1341d6
commit
2727bdebb3
2 changed files with 32 additions and 0 deletions
|
|
@ -166,6 +166,36 @@ sdio_write_1(struct sdio_func *f, uint32_t addr, uint8_t val, int *err)
|
|||
*err = error;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
sdio_read_2(struct sdio_func *f, uint32_t addr, int *err)
|
||||
{
|
||||
int error;
|
||||
uint16_t v;
|
||||
|
||||
error = SDIO_READ_EXTENDED(device_get_parent(f->dev), f->fn, addr,
|
||||
sizeof(v), (uint8_t *)&v, true);
|
||||
if (error) {
|
||||
if (err != NULL)
|
||||
*err = error;
|
||||
return (0xffff);
|
||||
} else {
|
||||
if (err != NULL)
|
||||
*err = 0;
|
||||
return (le16toh(v));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
sdio_write_2(struct sdio_func *f, uint32_t addr, uint16_t val, int *err)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = SDIO_WRITE_EXTENDED(device_get_parent(f->dev), f->fn, addr,
|
||||
sizeof(val), (uint8_t *)&val, true);
|
||||
if (err != NULL)
|
||||
*err = error;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
sdio_read_4(struct sdio_func *f, uint32_t addr, int *err)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -95,6 +95,8 @@ int sdio_set_block_size(struct sdio_func *, uint16_t);
|
|||
|
||||
uint8_t sdio_read_1(struct sdio_func *, uint32_t, int *);
|
||||
void sdio_write_1(struct sdio_func *, uint32_t, uint8_t, int *);
|
||||
uint16_t sdio_read_2(struct sdio_func *, uint32_t, int *);
|
||||
void sdio_write_2(struct sdio_func *, uint32_t, uint16_t, int *);
|
||||
uint32_t sdio_read_4(struct sdio_func *, uint32_t, int *);
|
||||
void sdio_write_4(struct sdio_func *, uint32_t, uint32_t, int *);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue