Message ID | CAEgOgz54PRciOofZ0q1JkzTcT-84drinZMdWjMz-2Au+wXufPA@mail.gmail.com |
---|---|
State | New |
Headers | show |
On 5 April 2012 01:32, Peter Crosthwaite <peter.crosthwaite@petalogix.com> wrote: > 3: add support for flagging sdi/sdo bits as tristated: > > --- a/hw/ssi.h > +++ b/hw/ssi.h > @@ -28,7 +28,11 @@ typedef struct SSISlaveClass { > DeviceClass parent_class; > > int (*init)(SSISlave *dev); > - uint32_t (*transfer)(SSISlave *dev, uint32_t val); > + /* transfer data. If z if provided, *z is the tristate mask > + * It is initially populated with tristate value for tx, and > + * on return should be populated with tristate for rx > + */ > + uint32_t (*transfer)(SSISlave *dev, uint32_t val, uint32_t *z); > } SSISlaveClass; I'm not sure what you intend the tristate masks to be used for? If the sending device puts the line into high-impedance presumably the receiving device is just going to read something random which it's supposed to ignore, so the sender could just send whatever it likes. We're not modelling multiple devices sending at once, which is the only case I can think of where you'd need to care which bits each device was tristating for. -- PMM
On Thu, Apr 5, 2012 at 5:18 PM, Peter Maydell <peter.maydell@linaro.org> wrote: > > I'm not sure what you intend the tristate masks to be used for? > If the sending device puts the line into high-impedance presumably > the receiving device is just going to read something random which > it's supposed to ignore, so the sender could just send whatever > it likes. We're not modelling multiple devices sending at once, > which is the only case I can think of where you'd need to care > which bits each device was tristating for. > > -- PMM Hi Peter, I managed to get all the tristate behaviours out of my controller and device models so we can drop this as you have suggested, so we can drop that change to ssi. Happy Easter, Peter
--- a/hw/ssi.h +++ b/hw/ssi.h @@ -29,6 +29,7 @@ typedef struct SSISlaveClass { int (*init)(SSISlave *dev); uint32_t (*transfer)(SSISlave *dev, uint32_t val); + int (*set_cs)(SSISlave *dev, int state); } SSISlaveClass; struct SSISlave { 2: set up SSI bus as a multi-slave bus: --- a/hw/ssi.h +++ b/hw/ssi.h @@ -38,12 +38,13 @@ struct SSISlave { #define SSI_SLAVE_FROM_QDEV(dev) DO_UPCAST(SSISlave, qdev, dev) #define FROM_SSI_SLAVE(type, dev) DO_UPCAST(type, ssidev, dev) -DeviceState *ssi_create_slave(SSIBus *bus, const char *name); +DeviceState *ssi_create_slave(SSIBus *bus, const char *name, int slave); /* Master interface. */ -SSIBus *ssi_create_bus(DeviceState *parent, const char *name); +SSIBus *ssi_create_bus(DeviceState *parent, const char *name, int num_slaves); uint32_t ssi_transfer(SSIBus *bus, uint32_t val); +uint32_t ssi_select_slave(SSIBus *bus, int slave); /* max111x.c */ 3: add support for flagging sdi/sdo bits as tristated: --- a/hw/ssi.h +++ b/hw/ssi.h @@ -28,7 +28,11 @@ typedef struct SSISlaveClass { DeviceClass parent_class; int (*init)(SSISlave *dev); - uint32_t (*transfer)(SSISlave *dev, uint32_t val); + /* transfer data. If z if provided, *z is the tristate mask + * It is initially populated with tristate value for tx, and + * on return should be populated with tristate for rx + */ + uint32_t (*transfer)(SSISlave *dev, uint32_t val, uint32_t *z); } SSISlaveClass; >