Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/spibus/spibus.c
Show First 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | case SPIBUS_IVAR_CS: | ||||
*(uint32_t *)result = devi->cs; | *(uint32_t *)result = devi->cs; | ||||
break; | break; | ||||
case SPIBUS_IVAR_MODE: | case SPIBUS_IVAR_MODE: | ||||
*(uint32_t *)result = devi->mode; | *(uint32_t *)result = devi->mode; | ||||
break; | break; | ||||
case SPIBUS_IVAR_CLOCK: | case SPIBUS_IVAR_CLOCK: | ||||
*(uint32_t *)result = devi->clock; | *(uint32_t *)result = devi->clock; | ||||
break; | break; | ||||
case SPIBUS_IVAR_CS_DELAY: | |||||
*(uint32_t *)result = devi->cs_delay; | |||||
break; | |||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
spibus_write_ivar(device_t bus, device_t child, int which, uintptr_t value) | spibus_write_ivar(device_t bus, device_t child, int which, uintptr_t value) | ||||
{ | { | ||||
struct spibus_ivar *devi = SPIBUS_IVAR(child); | struct spibus_ivar *devi = SPIBUS_IVAR(child); | ||||
Show All 11 Lines | spibus_write_ivar(device_t bus, device_t child, int which, uintptr_t value) | ||||
case SPIBUS_IVAR_CS: | case SPIBUS_IVAR_CS: | ||||
/* Chip select cannot be changed. */ | /* Chip select cannot be changed. */ | ||||
return (EINVAL); | return (EINVAL); | ||||
case SPIBUS_IVAR_MODE: | case SPIBUS_IVAR_MODE: | ||||
/* Valid SPI modes are 0-3. */ | /* Valid SPI modes are 0-3. */ | ||||
if (value > 3) | if (value > 3) | ||||
return (EINVAL); | return (EINVAL); | ||||
devi->mode = (uint32_t)value; | devi->mode = (uint32_t)value; | ||||
break; | |||||
case SPIBUS_IVAR_CS_DELAY: | |||||
devi->cs_delay = (uint32_t)value; | |||||
break; | break; | ||||
default: | default: | ||||
return (EINVAL); | return (EINVAL); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines |