turnip cs again
@krh @chadversary
The first six commits cleans up tu_cs to prepare it for other operation modes.
The 7th commit adds TU_CS_MODE_EXTERNAL mode, where tu_cs acts as a wrapper to an external buffer and cannot grow.
The last commit adds TU_CS_MODE_SUB_STREAM mode. When in this mode, tu_cs_begin_sub_stream must be called instead of tu_cs_begin. The function returns a sub-cs where commands are emitted to.
Example:
tu_cs_init(cs, TU_CS_MODE_SUB_STREAM, 4096);
tu_cs_begin_sub_stream(dev, cs, 2 /* size of sub-stream */, &sub_cs);
tu_cs_reserve_space(&sub_cs, 2);
tu_cs_emit(&sub_cs, some_value);
tu_cs_emit(&sub_cs, some_value2);
index = tu_cs_end_sub_stream(cs, &sub_cs);
// cs->entries[index] is the entry for the sub-stream
Edited by Chia-I Wu