I don't understand why the parameter of usart callback functions is qualified constant. I'm not referring to the pointer being a constant, but rather that the pointer points to a constant structure.
typedef void (*usart_cb_t)(const struct usart_async_descriptor *const descr);
The reason I ask, is that it'd be handy if within a callback function I could call get_io_descriptor, or get_status, passing along descr. I get the sense that the writers of ASF4 were telling me not to do that, since the parameters of those functions are not constant pointers to constant structures.
int32_t usart_async_get_io_descriptor(struct usart_async_descriptor *const descr, struct io_descriptor **io); int32_t usart_async_get_status(struct usart_async_descriptor *const descr, struct usart_async_status *const status);
On the other hand, the parameter for usart_async_is_rx_not_empty match the type of the callback parameter.
int32_t usart_async_is_rx_not_empty(const struct usart_async_descriptor *const descr);
I know how to do what I want to using casts or other tricks, so that's not the point of my question. I'm just looking for some insight as to why the callback takes a constant structure, and what types of things I might break if I treat it otherwise.