Update CDC Class Driver character stream functions to use the correct avr-libc return codes for errors and EOF.

Fix pointer arithmetic on void byte buffers by explicitly typecasting the buffer pointers to uint8_t* before altering them.
This commit is contained in:
Dean Camera 2009-11-10 11:24:15 +00:00
parent c1782ac024
commit 5de364163f
11 changed files with 43 additions and 44 deletions

View file

@ -1,6 +1,6 @@
uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length)
{
uint8_t* DataStream = (uint8_t*)(Buffer + TEMPLATE_BUFFER_OFFSET(Length));
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
while (Length)
{

View file

@ -1,6 +1,6 @@
uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, uint16_t Length)
{
uint8_t* DataStream = (uint8_t*)(Buffer + TEMPLATE_BUFFER_OFFSET(Length));
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
bool LastPacketFull = false;
if (Length > USB_ControlRequest.wLength)

View file

@ -1,6 +1,6 @@
uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer, uint16_t Length __CALLBACK_PARAM)
{
uint8_t* DataStream = (uint8_t*)(Buffer + TEMPLATE_BUFFER_OFFSET(Length));
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
uint8_t ErrorCode;
if ((ErrorCode = Endpoint_WaitUntilReady()))

View file

@ -1,6 +1,6 @@
uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer, uint16_t Length __CALLBACK_PARAM)
{
uint8_t* DataStream = (uint8_t*)(Buffer + TEMPLATE_BUFFER_OFFSET(Length));
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
uint8_t ErrorCode;
Pipe_SetToken(TEMPLATE_TOKEN);