To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/BYAPR02MB542929F5D7C8594591BFD9B9A34B9%40BYAPR02MB5429.namprd02.prod.outlook.com.
Result
type, whose Err
variant includes an error code. The Tock kernel provides a standard set of
error codes, oriented towards system calls, in the kernel::ErrorCode
enum.
Sometimes, however, these error codes don't quite fit the use case and so
a HIL defines its own error codes. The I2C HIL, for example, defines an
i2c::Error
enumeration for cases such as address and data negative
acknowledgments, which can occur in I2C.”To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/BYAPR02MB542929F5D7C8594591BFD9B9A34B9%40BYAPR02MB5429.namprd02.prod.outlook.com.
On Apr 17, 2021, at 12:07 PM, Alexandru Radovici <msg4...@gmail.com> wrote:I still think the HIL should return only ErrorCode. In this example for instance, if the HIL functions return I2CError, it may happen that a function can return I2CError::CommandComplete. This takes us back to the ReturnCode issue, where SUCCESS and Error were defined in the same type.
Another issue in HIL TRD seems to be virtualization. If a HIL is used in a virtualized driver, the "commands" usually do not return synchronous errors, as they have to wait for their turn with the actual driver. The only way they can return error is via a callback. The problem is that not all HILs define errors in callback. An example is the SpiMasterClient, that does not provide an Error.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/CAHGAQoy15bxXi4mHD8VChbxe6pieqJ%3Dy7uEvS4ToaG_-TvAexg%40mail.gmail.com.