vbendeb@ pointed out this discrepency when wondering how large of a buffer is needed to pass to log_dequeue_event().
struct event_log_entry {
uint32_t timestamp; /* relative timestamp in milliseconds */
uint8_t type; /* event type, caller-defined */
uint8_t size; /* [7:5] caller-def'd [4:0] payload size in bytes */
uint16_t data; /* type-defined data payload */
uint8_t payload[0]; /* optional additional data payload: 0..16 bytes */
} __packed;
Size is represented by five bits, and since we aren't enforcing that the payload size is limited to 16 (though in practice we don't write more than 16 payload bytes), it's possible to have payload size up to 31 bytes.
If we want to limit the payload size to 16 bytes, we can modify EVENT_LOG_SIZE() to enforce the limit.