X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/cbbd3d746acef02a4afd562652a2ba71b24dfd6f..4f74075fad7f1e7a35d04ff534d9d6a57d2b97fc:/LUFA/Drivers/USB/LowLevel/Pipe.c diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.c b/LUFA/Drivers/USB/LowLevel/Pipe.c index 0a32f183b..fd8f81bc6 100644 --- a/LUFA/Drivers/USB/LowLevel/Pipe.c +++ b/LUFA/Drivers/USB/LowLevel/Pipe.c @@ -70,15 +70,15 @@ void Pipe_ClearPipes(void) } } -bool Pipe_IsEndpointBound(uint8_t EndpointAddress) +bool Pipe_IsEndpointBound(const uint8_t EndpointAddress) { - uint8_t PrevPipeNumber = Pipe_GetPipeNumber(); + uint8_t PrevPipeNumber = Pipe_GetCurrentPipe(); for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++) { Pipe_SelectPipe(PNum); - if (Pipe_IsConfigured() && (Pipe_BoundEndpointAddress() == EndpointAddress)) + if (Pipe_IsConfigured() && (Pipe_BoundEndpointNumber() == (EndpointAddress & PIPE_EPNUM_MASK))) return true; } @@ -93,7 +93,7 @@ uint8_t Pipe_WaitUntilReady(void) #else uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; #endif - + for (;;) { if (Pipe_GetPipeToken() == PIPE_TOKEN_IN) @@ -130,7 +130,7 @@ uint8_t Pipe_Discard_Stream(uint16_t Length { uint8_t ErrorCode; - Pipe_SetToken(PIPE_TOKEN_IN); + Pipe_SetPipeToken(PIPE_TOKEN_IN); if ((ErrorCode = Pipe_WaitUntilReady())) return ErrorCode; @@ -200,73 +200,83 @@ uint8_t Pipe_Discard_Stream(uint16_t Length } #define TEMPLATE_FUNC_NAME Pipe_Write_Stream_LE +#define TEMPLATE_BUFFER_TYPE const void* #define TEMPLATE_TOKEN PIPE_TOKEN_OUT #define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() #define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(*(BufferPtr++)) +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(*((uint8_t*)BufferPtr++)) #include "Template/Template_Pipe_RW.c" #define TEMPLATE_FUNC_NAME Pipe_Write_PStream_LE +#define TEMPLATE_BUFFER_TYPE const void* #define TEMPLATE_TOKEN PIPE_TOKEN_OUT #define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() #define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(pgm_read_byte(BufferPtr++)) +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(pgm_read_byte((uint8_t*)BufferPtr++)) #include "Template/Template_Pipe_RW.c" #define TEMPLATE_FUNC_NAME Pipe_Write_EStream_LE +#define TEMPLATE_BUFFER_TYPE const void* #define TEMPLATE_TOKEN PIPE_TOKEN_OUT #define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() #define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(eeprom_read_byte(BufferPtr++)) +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr++)) #include "Template/Template_Pipe_RW.c" #define TEMPLATE_FUNC_NAME Pipe_Write_Stream_BE +#define TEMPLATE_BUFFER_TYPE const void* #define TEMPLATE_TOKEN PIPE_TOKEN_OUT #define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() #define TEMPLATE_BUFFER_OFFSET(Length) Length - 1 -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(*(BufferPtr--)) +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(*((uint8_t*)BufferPtr--)) #include "Template/Template_Pipe_RW.c" #define TEMPLATE_FUNC_NAME Pipe_Write_PStream_BE +#define TEMPLATE_BUFFER_TYPE const void* #define TEMPLATE_TOKEN PIPE_TOKEN_OUT #define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() #define TEMPLATE_BUFFER_OFFSET(Length) Length - 1 -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(pgm_read_byte(BufferPtr--)) +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(pgm_read_byte((uint8_t*)BufferPtr--)) #include "Template/Template_Pipe_RW.c" #define TEMPLATE_FUNC_NAME Pipe_Write_EStream_BE +#define TEMPLATE_BUFFER_TYPE const void* #define TEMPLATE_TOKEN PIPE_TOKEN_OUT #define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() #define TEMPLATE_BUFFER_OFFSET(Length) Length - 1 -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(eeprom_read_byte(BufferPtr--)) +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr--)) #include "Template/Template_Pipe_RW.c" #define TEMPLATE_FUNC_NAME Pipe_Read_Stream_LE +#define TEMPLATE_BUFFER_TYPE void* #define TEMPLATE_TOKEN PIPE_TOKEN_IN #define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() #define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *(BufferPtr++) = Pipe_Read_Byte() +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr++) = Pipe_Read_Byte() #include "Template/Template_Pipe_RW.c" #define TEMPLATE_FUNC_NAME Pipe_Read_EStream_LE +#define TEMPLATE_BUFFER_TYPE void* #define TEMPLATE_TOKEN PIPE_TOKEN_IN #define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() #define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_write_byte(BufferPtr++, Pipe_Read_Byte()) +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_write_byte((uint8_t*)BufferPtr++, Pipe_Read_Byte()) #include "Template/Template_Pipe_RW.c" #define TEMPLATE_FUNC_NAME Pipe_Read_Stream_BE +#define TEMPLATE_BUFFER_TYPE void* #define TEMPLATE_TOKEN PIPE_TOKEN_IN #define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() #define TEMPLATE_BUFFER_OFFSET(Length) Length - 1 -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *(BufferPtr--) = Pipe_Read_Byte() +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr--) = Pipe_Read_Byte() #include "Template/Template_Pipe_RW.c" #define TEMPLATE_FUNC_NAME Pipe_Read_EStream_BE +#define TEMPLATE_BUFFER_TYPE void* #define TEMPLATE_TOKEN PIPE_TOKEN_IN #define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() #define TEMPLATE_BUFFER_OFFSET(Length) Length - 1 -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_write_byte(BufferPtr--, Pipe_Read_Byte()) +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_write_byte((uint8_t*)BufferPtr--, Pipe_Read_Byte()) #include "Template/Template_Pipe_RW.c" #endif