Start porting the USB core to the AVR32 UC3B.
This commit is contained in:
parent
e11fddfe66
commit
0e6d5cf5b4
19 changed files with 354 additions and 122 deletions
|
@ -66,11 +66,17 @@
|
|||
#define __ENDPOINT_H__
|
||||
|
||||
/* Includes: */
|
||||
#include <avr/io.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/eeprom.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#if defined(__AVR32__)
|
||||
#include <avr32/io.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#elif defined(__AVR__)
|
||||
#include <avr/io.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/eeprom.h>
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
|
||||
#include "../../../Common/Common.h"
|
||||
#include "../HighLevel/USBTask.h"
|
||||
|
||||
|
@ -486,7 +492,11 @@
|
|||
static inline uint8_t Endpoint_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
|
||||
static inline uint8_t Endpoint_Read_Byte(void)
|
||||
{
|
||||
#if defined(__AVR32__)
|
||||
return 0; // TODO
|
||||
#elif defined(__AVR__)
|
||||
return UEDATX;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Writes one byte from the currently selected endpoint's bank, for IN direction endpoints.
|
||||
|
@ -498,7 +508,11 @@
|
|||
static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
|
||||
static inline void Endpoint_Write_Byte(const uint8_t Byte)
|
||||
{
|
||||
#if defined(__AVR32__)
|
||||
// TODO
|
||||
#elif defined(__AVR__)
|
||||
UEDATX = Byte;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Discards one byte from the currently selected endpoint's bank, for OUT direction endpoints.
|
||||
|
@ -510,7 +524,11 @@
|
|||
{
|
||||
uint8_t Dummy;
|
||||
|
||||
#if defined(__AVR32__)
|
||||
// TODO
|
||||
#elif defined(__AVR__)
|
||||
Dummy = UEDATX;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Reads two bytes from the currently selected endpoint's bank in little endian format, for OUT
|
||||
|
@ -529,8 +547,12 @@
|
|||
uint8_t Bytes[2];
|
||||
} Data;
|
||||
|
||||
#if defined(__AVR32__)
|
||||
// TODO
|
||||
#elif defined(__AVR__)
|
||||
Data.Bytes[0] = UEDATX;
|
||||
Data.Bytes[1] = UEDATX;
|
||||
#endif
|
||||
|
||||
return Data.Word;
|
||||
}
|
||||
|
@ -551,8 +573,12 @@
|
|||
uint8_t Bytes[2];
|
||||
} Data;
|
||||
|
||||
#if defined(__AVR32__)
|
||||
// TODO
|
||||
#elif defined(__AVR__)
|
||||
Data.Bytes[1] = UEDATX;
|
||||
Data.Bytes[0] = UEDATX;
|
||||
#endif
|
||||
|
||||
return Data.Word;
|
||||
}
|
||||
|
@ -567,8 +593,12 @@
|
|||
static inline void Endpoint_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE;
|
||||
static inline void Endpoint_Write_Word_LE(const uint16_t Word)
|
||||
{
|
||||
#if defined(__AVR32__)
|
||||
// TODO
|
||||
#elif defined(__AVR__)
|
||||
UEDATX = (Word & 0xFF);
|
||||
UEDATX = (Word >> 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Writes two bytes to the currently selected endpoint's bank in big endian format, for IN
|
||||
|
@ -581,8 +611,12 @@
|
|||
static inline void Endpoint_Write_Word_BE(const uint16_t Word) ATTR_ALWAYS_INLINE;
|
||||
static inline void Endpoint_Write_Word_BE(const uint16_t Word)
|
||||
{
|
||||
#if defined(__AVR32__)
|
||||
// TODO
|
||||
#elif defined(__AVR__)
|
||||
UEDATX = (Word >> 8);
|
||||
UEDATX = (Word & 0xFF);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Discards two bytes from the currently selected endpoint's bank, for OUT direction endpoints.
|
||||
|
@ -594,8 +628,12 @@
|
|||
{
|
||||
uint8_t Dummy;
|
||||
|
||||
#if defined(__AVR32__)
|
||||
// TODO
|
||||
#elif defined(__AVR__)
|
||||
Dummy = UEDATX;
|
||||
Dummy = UEDATX;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Reads four bytes from the currently selected endpoint's bank in little endian format, for OUT
|
||||
|
@ -614,10 +652,14 @@
|
|||
uint8_t Bytes[4];
|
||||
} Data;
|
||||
|
||||
#if defined(__AVR32__)
|
||||
// TODO
|
||||
#elif defined(__AVR__)
|
||||
Data.Bytes[0] = UEDATX;
|
||||
Data.Bytes[1] = UEDATX;
|
||||
Data.Bytes[2] = UEDATX;
|
||||
Data.Bytes[3] = UEDATX;
|
||||
#endif
|
||||
|
||||
return Data.DWord;
|
||||
}
|
||||
|
@ -638,10 +680,14 @@
|
|||
uint8_t Bytes[4];
|
||||
} Data;
|
||||
|
||||
#if defined(__AVR32__)
|
||||
// TODO
|
||||
#elif defined(__AVR__)
|
||||
Data.Bytes[3] = UEDATX;
|
||||
Data.Bytes[2] = UEDATX;
|
||||
Data.Bytes[1] = UEDATX;
|
||||
Data.Bytes[0] = UEDATX;
|
||||
#endif
|
||||
|
||||
return Data.DWord;
|
||||
}
|
||||
|
@ -656,10 +702,14 @@
|
|||
static inline void Endpoint_Write_DWord_LE(const uint32_t DWord) ATTR_ALWAYS_INLINE;
|
||||
static inline void Endpoint_Write_DWord_LE(const uint32_t DWord)
|
||||
{
|
||||
#if defined(__AVR32__)
|
||||
// TODO
|
||||
#elif defined(__AVR__)
|
||||
UEDATX = (DWord & 0xFF);
|
||||
UEDATX = (DWord >> 8);
|
||||
UEDATX = (DWord >> 16);
|
||||
UEDATX = (DWord >> 24);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Writes four bytes to the currently selected endpoint's bank in big endian format, for IN
|
||||
|
@ -672,10 +722,14 @@
|
|||
static inline void Endpoint_Write_DWord_BE(const uint32_t DWord) ATTR_ALWAYS_INLINE;
|
||||
static inline void Endpoint_Write_DWord_BE(const uint32_t DWord)
|
||||
{
|
||||
#if defined(__AVR32__)
|
||||
// TODO
|
||||
#elif defined(__AVR__)
|
||||
UEDATX = (DWord >> 24);
|
||||
UEDATX = (DWord >> 16);
|
||||
UEDATX = (DWord >> 8);
|
||||
UEDATX = (DWord & 0xFF);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints.
|
||||
|
@ -687,10 +741,14 @@
|
|||
{
|
||||
uint8_t Dummy;
|
||||
|
||||
#if defined(__AVR32__)
|
||||
// TODO
|
||||
#elif defined(__AVR__)
|
||||
Dummy = UEDATX;
|
||||
Dummy = UEDATX;
|
||||
Dummy = UEDATX;
|
||||
Dummy = UEDATX;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* External Variables: */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue