Add some missing function attributes.

pull/1469/head
Dean Camera 12 years ago
parent d5e84db5ab
commit 334f70aa80

@ -56,17 +56,17 @@
* // Initialize the SPI driver before first use * // Initialize the SPI driver before first use
* SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | * SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING |
* SPI_SAMPLE_TRAILING | SPI_MODE_MASTER); * SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
* *
* // Send several bytes, ignoring the returned data * // Send several bytes, ignoring the returned data
* SPI_SendByte(0x01); * SPI_SendByte(0x01);
* SPI_SendByte(0x02); * SPI_SendByte(0x02);
* SPI_SendByte(0x03); * SPI_SendByte(0x03);
* *
* // Receive several bytes, sending a dummy 0x00 byte each time * // Receive several bytes, sending a dummy 0x00 byte each time
* uint8_t Byte1 = SPI_ReceiveByte(); * uint8_t Byte1 = SPI_ReceiveByte();
* uint8_t Byte2 = SPI_ReceiveByte(); * uint8_t Byte2 = SPI_ReceiveByte();
* uint8_t Byte3 = SPI_ReceiveByte(); * uint8_t Byte3 = SPI_ReceiveByte();
* *
* // Send a byte, and store the received byte from the same transaction * // Send a byte, and store the received byte from the same transaction
* uint8_t ResponseByte = SPI_TransferByte(0xDC); * uint8_t ResponseByte = SPI_TransferByte(0xDC);
* \endcode * \endcode
@ -165,6 +165,7 @@
* \param[in] SPIOptions SPI Options, a mask consisting of one of each of the \c SPI_SPEED_*, * \param[in] SPIOptions SPI Options, a mask consisting of one of each of the \c SPI_SPEED_*,
* \c SPI_SCK_*, \c SPI_SAMPLE_*, \c SPI_ORDER_* and \c SPI_MODE_* masks. * \c SPI_SCK_*, \c SPI_SAMPLE_*, \c SPI_ORDER_* and \c SPI_MODE_* masks.
*/ */
static inline void SPI_Init(const uint8_t SPIOptions);
static inline void SPI_Init(const uint8_t SPIOptions) static inline void SPI_Init(const uint8_t SPIOptions)
{ {
/* Prevent high rise times on PB.0 (/SS) from forcing a change to SPI slave mode */ /* Prevent high rise times on PB.0 (/SS) from forcing a change to SPI slave mode */
@ -187,6 +188,7 @@
} }
/** Turns off the SPI driver, disabling and returning used hardware to their default configuration. */ /** Turns off the SPI driver, disabling and returning used hardware to their default configuration. */
static inline void SPI_Disable(void);
static inline void SPI_Disable(void) static inline void SPI_Disable(void)
{ {
DDRB &= ~((1 << 1) | (1 << 2)); DDRB &= ~((1 << 1) | (1 << 2));

@ -201,8 +201,10 @@
* \param[in] Prescale Prescaler to use when determining the bus frequency, a \c TWI_BIT_PRESCALE_* value. * \param[in] Prescale Prescaler to use when determining the bus frequency, a \c TWI_BIT_PRESCALE_* value.
* \param[in] BitLength Length of the bits sent on the bus. * \param[in] BitLength Length of the bits sent on the bus.
*/ */
static inline void TWI_Init(const uint8_t Prescale, const uint8_t BitLength) ATTR_ALWAYS_INLINE; static inline void TWI_Init(const uint8_t Prescale,
static inline void TWI_Init(const uint8_t Prescale, const uint8_t BitLength) const uint8_t BitLength) ATTR_ALWAYS_INLINE;
static inline void TWI_Init(const uint8_t Prescale,
const uint8_t BitLength)
{ {
TWCR |= (1 << TWEN); TWCR |= (1 << TWEN);
TWSR = Prescale; TWSR = Prescale;

@ -53,17 +53,17 @@
* SPI_Init(&SPIC, * SPI_Init(&SPIC,
* SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | * SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING |
* SPI_SAMPLE_TRAILING | SPI_MODE_MASTER); * SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
* *
* // Send several bytes, ignoring the returned data * // Send several bytes, ignoring the returned data
* SPI_SendByte(&SPIC, 0x01); * SPI_SendByte(&SPIC, 0x01);
* SPI_SendByte(&SPIC, 0x02); * SPI_SendByte(&SPIC, 0x02);
* SPI_SendByte(&SPIC, 0x03); * SPI_SendByte(&SPIC, 0x03);
* *
* // Receive several bytes, sending a dummy 0x00 byte each time * // Receive several bytes, sending a dummy 0x00 byte each time
* uint8_t Byte1 = SPI_ReceiveByte(&SPIC); * uint8_t Byte1 = SPI_ReceiveByte(&SPIC);
* uint8_t Byte2 = SPI_ReceiveByte(&SPIC); * uint8_t Byte2 = SPI_ReceiveByte(&SPIC);
* uint8_t Byte3 = SPI_ReceiveByte(&SPIC); * uint8_t Byte3 = SPI_ReceiveByte(&SPIC);
* *
* // Send a byte, and store the received byte from the same transaction * // Send a byte, and store the received byte from the same transaction
* uint8_t ResponseByte = SPI_TransferByte(&SPIC, 0xDC); * uint8_t ResponseByte = SPI_TransferByte(&SPIC, 0xDC);
* \endcode * \endcode
@ -163,6 +163,8 @@
* \param[in] SPIOptions SPI Options, a mask consisting of one of each of the \c SPI_SPEED_*, * \param[in] SPIOptions SPI Options, a mask consisting of one of each of the \c SPI_SPEED_*,
* \c SPI_SCK_*, \c SPI_SAMPLE_*, \c SPI_ORDER_* and \c SPI_MODE_* masks. * \c SPI_SCK_*, \c SPI_SAMPLE_*, \c SPI_ORDER_* and \c SPI_MODE_* masks.
*/ */
static inline void SPI_Init(SPI_t* const SPI,
const uint8_t SPIOptions) ATTR_NON_NULL_PTR_ARG(1);
static inline void SPI_Init(SPI_t* const SPI, static inline void SPI_Init(SPI_t* const SPI,
const uint8_t SPIOptions) const uint8_t SPIOptions)
{ {
@ -173,6 +175,7 @@
* *
* \param[in,out] SPI Pointer to the base of the SPI peripheral within the device. * \param[in,out] SPI Pointer to the base of the SPI peripheral within the device.
*/ */
static inline void SPI_Disable(SPI_t* const SPI) ATTR_NON_NULL_PTR_ARG(1);
static inline void SPI_Disable(SPI_t* const SPI) static inline void SPI_Disable(SPI_t* const SPI)
{ {
SPI->CTRL &= ~SPI_ENABLE_bm; SPI->CTRL &= ~SPI_ENABLE_bm;
@ -184,7 +187,7 @@
* *
* \return \ref SPI_MODE_MASTER if the interface is currently in SPI Master mode, \ref SPI_MODE_SLAVE otherwise * \return \ref SPI_MODE_MASTER if the interface is currently in SPI Master mode, \ref SPI_MODE_SLAVE otherwise
*/ */
static inline uint8_t SPI_GetCurrentMode(SPI_t* const SPI) ATTR_ALWAYS_INLINE; static inline uint8_t SPI_GetCurrentMode(SPI_t* const SPI) ATTR_ALWAYS_INLINE ATTR_NON_NULL_PTR_ARG(1);
static inline uint8_t SPI_GetCurrentMode(SPI_t* const SPI) static inline uint8_t SPI_GetCurrentMode(SPI_t* const SPI)
{ {
return (SPI->CTRL & SPI_MASTER_bm); return (SPI->CTRL & SPI_MASTER_bm);
@ -198,7 +201,7 @@
* \return Response byte from the attached SPI device. * \return Response byte from the attached SPI device.
*/ */
static inline uint8_t SPI_TransferByte(SPI_t* const SPI, static inline uint8_t SPI_TransferByte(SPI_t* const SPI,
const uint8_t Byte) ATTR_ALWAYS_INLINE; const uint8_t Byte) ATTR_ALWAYS_INLINE ATTR_NON_NULL_PTR_ARG(1);
static inline uint8_t SPI_TransferByte(SPI_t* const SPI, static inline uint8_t SPI_TransferByte(SPI_t* const SPI,
const uint8_t Byte) const uint8_t Byte)
{ {
@ -214,7 +217,7 @@
* \param[in] Byte Byte to send through the SPI interface. * \param[in] Byte Byte to send through the SPI interface.
*/ */
static inline void SPI_SendByte(SPI_t* const SPI, static inline void SPI_SendByte(SPI_t* const SPI,
const uint8_t Byte) ATTR_ALWAYS_INLINE; const uint8_t Byte) ATTR_ALWAYS_INLINE ATTR_NON_NULL_PTR_ARG(1);
static inline void SPI_SendByte(SPI_t* const SPI, static inline void SPI_SendByte(SPI_t* const SPI,
const uint8_t Byte) const uint8_t Byte)
{ {
@ -229,7 +232,7 @@
* *
* \return The response byte from the attached SPI device. * \return The response byte from the attached SPI device.
*/ */
static inline uint8_t SPI_ReceiveByte(SPI_t* const SPI) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; static inline uint8_t SPI_ReceiveByte(SPI_t* const SPI) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1);
static inline uint8_t SPI_ReceiveByte(SPI_t* const SPI) static inline uint8_t SPI_ReceiveByte(SPI_t* const SPI)
{ {
SPI->DATA = 0; SPI->DATA = 0;

@ -53,17 +53,17 @@
* \code * \code
* // Initialize the Master SPI mode USART driver before first use, with 1Mbit baud * // Initialize the Master SPI mode USART driver before first use, with 1Mbit baud
* SerialSPI_Init(&USARTD0, (USART_SPI_SCK_LEAD_RISING | USART_SPI_SAMPLE_LEADING | USART_SPI_ORDER_MSB_FIRST), 1000000); * SerialSPI_Init(&USARTD0, (USART_SPI_SCK_LEAD_RISING | USART_SPI_SAMPLE_LEADING | USART_SPI_ORDER_MSB_FIRST), 1000000);
* *
* // Send several bytes, ignoring the returned data * // Send several bytes, ignoring the returned data
* SerialSPI_SendByte(&USARTD0, 0x01); * SerialSPI_SendByte(&USARTD0, 0x01);
* SerialSPI_SendByte(&USARTD0, 0x02); * SerialSPI_SendByte(&USARTD0, 0x02);
* SerialSPI_SendByte(&USARTD0, 0x03); * SerialSPI_SendByte(&USARTD0, 0x03);
* *
* // Receive several bytes, sending a dummy 0x00 byte each time * // Receive several bytes, sending a dummy 0x00 byte each time
* uint8_t Byte1 = SerialSPI_ReceiveByte(&USARTD); * uint8_t Byte1 = SerialSPI_ReceiveByte(&USARTD);
* uint8_t Byte2 = SerialSPI_ReceiveByte(&USARTD); * uint8_t Byte2 = SerialSPI_ReceiveByte(&USARTD);
* uint8_t Byte3 = SerialSPI_ReceiveByte(&USARTD); * uint8_t Byte3 = SerialSPI_ReceiveByte(&USARTD);
* *
* // Send a byte, and store the received byte from the same transaction * // Send a byte, and store the received byte from the same transaction
* uint8_t ResponseByte = SerialSPI_TransferByte(&USARTD0, 0xDC); * uint8_t ResponseByte = SerialSPI_TransferByte(&USARTD0, 0xDC);
* \endcode * \endcode
@ -118,40 +118,44 @@
/** SPI data order mask for \ref SerialSPI_Init(). Indicates that data should be shifted out LSB first. */ /** SPI data order mask for \ref SerialSPI_Init(). Indicates that data should be shifted out LSB first. */
#define USART_SPI_ORDER_LSB_FIRST USART_UDORD_bm #define USART_SPI_ORDER_LSB_FIRST USART_UDORD_bm
//@} //@}
/* Inline Functions: */ /* Inline Functions: */
/** Initialize the USART module in Master SPI mode. /** Initialize the USART module in Master SPI mode.
* *
* \param[in,out] USART Pointer to the base of the USART peripheral within the device. * \param[in,out] USART Pointer to the base of the USART peripheral within the device.
* \param[in] SPIOptions USART SPI Options, a mask consisting of one of each of the \c USART_SPI_SCK_*, * \param[in] SPIOptions USART SPI Options, a mask consisting of one of each of the \c USART_SPI_SCK_*,
* \c USART_SPI_SAMPLE_* and \c USART_SPI_ORDER_* masks. * \c USART_SPI_SAMPLE_* and \c USART_SPI_ORDER_* masks.
* \param[in] BaudRate SPI baud rate, in bits per second. * \param[in] BaudRate SPI baud rate, in bits per second.
*/ */
static inline void SerialSPI_Init(USART_t* const USART,
const uint8_t SPIOptions,
const uint32_t BaudRate) ATTR_NON_NULL_PTR_ARG(1);
static inline void SerialSPI_Init(USART_t* const USART, static inline void SerialSPI_Init(USART_t* const USART,
const uint8_t SPIOptions, const uint8_t SPIOptions,
const uint32_t BaudRate) const uint32_t BaudRate)
{ {
uint16_t BaudValue = SERIAL_SPI_UBBRVAL(BaudRate); uint16_t BaudValue = SERIAL_SPI_UBBRVAL(BaudRate);
USART->BAUDCTRLB = (BaudValue >> 8); USART->BAUDCTRLB = (BaudValue >> 8);
USART->BAUDCTRLA = (BaudValue & 0xFF); USART->BAUDCTRLA = (BaudValue & 0xFF);
USART->CTRLC = (USART_CMODE_MSPI_gc | SPIOptions); USART->CTRLC = (USART_CMODE_MSPI_gc | SPIOptions);
USART->CTRLB = (USART_RXEN_bm | USART_TXEN_bm); USART->CTRLB = (USART_RXEN_bm | USART_TXEN_bm);
} }
/** Turns off the USART driver, disabling and returning used hardware to their default configuration. /** Turns off the USART driver, disabling and returning used hardware to their default configuration.
* *
* \param[in,out] USART Pointer to the base of the USART peripheral within the device. * \param[in,out] USART Pointer to the base of the USART peripheral within the device.
*/ */
static inline void SerialSPI_Disable(USART_t* const USART) ATTR_ALWAYS_INLINE ATTR_NON_NULL_PTR_ARG(1);
static inline void SerialSPI_Disable(USART_t* const USART) static inline void SerialSPI_Disable(USART_t* const USART)
{ {
USART->CTRLA = 0; USART->CTRLA = 0;
USART->CTRLB = 0; USART->CTRLB = 0;
USART->CTRLC = 0; USART->CTRLC = 0;
} }
/** Sends and receives a byte through the USART SPI interface, blocking until the transfer is complete. /** Sends and receives a byte through the USART SPI interface, blocking until the transfer is complete.
* *
* \param[in,out] USART Pointer to the base of the USART peripheral within the device. * \param[in,out] USART Pointer to the base of the USART peripheral within the device.
@ -159,6 +163,8 @@
* *
* \return Response byte from the attached SPI device. * \return Response byte from the attached SPI device.
*/ */
static inline uint8_t SerialSPI_TransferByte(USART_t* const USART,
const uint8_t DataByte) ATTR_ALWAYS_INLINE ATTR_NON_NULL_PTR_ARG(1);
static inline uint8_t SerialSPI_TransferByte(USART_t* const USART, static inline uint8_t SerialSPI_TransferByte(USART_t* const USART,
const uint8_t DataByte) const uint8_t DataByte)
{ {
@ -174,6 +180,8 @@
* \param[in,out] USART Pointer to the base of the USART peripheral within the device. * \param[in,out] USART Pointer to the base of the USART peripheral within the device.
* \param[in] DataByte Byte to send through the USART SPI interface. * \param[in] DataByte Byte to send through the USART SPI interface.
*/ */
static inline void SerialSPI_SendByte(USART_t* const USART,
const uint8_t DataByte) ATTR_ALWAYS_INLINE ATTR_NON_NULL_PTR_ARG(1)
static inline void SerialSPI_SendByte(USART_t* const USART, static inline void SerialSPI_SendByte(USART_t* const USART,
const uint8_t DataByte) const uint8_t DataByte)
{ {
@ -187,11 +195,12 @@
* *
* \return The response byte from the attached SPI device. * \return The response byte from the attached SPI device.
*/ */
static inline uint8_t SerialSPI_ReceiveByte(USART_t* const USART) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1);
static inline uint8_t SerialSPI_ReceiveByte(USART_t* const USART) static inline uint8_t SerialSPI_ReceiveByte(USART_t* const USART)
{ {
return SerialSPI_TransferByte(USART, 0); return SerialSPI_TransferByte(USART, 0);
} }
/* Disable C linkage for C++ Compilers: */ /* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus) #if defined(__cplusplus)
} }

@ -95,7 +95,7 @@ void Serial_SendData(USART_t* const USART,
Serial_SendByte(USART, *((uint8_t*)Buffer++)); Serial_SendByte(USART, *((uint8_t*)Buffer++));
} }
void Serial_CreateStream(FILE* Stream) void Serial_CreateStream(FILE* const Stream)
{ {
if (!(Stream)) if (!(Stream))
{ {
@ -107,7 +107,7 @@ void Serial_CreateStream(FILE* Stream)
*Stream = (FILE)FDEV_SETUP_STREAM(Serial_putchar, Serial_getchar, _FDEV_SETUP_RW); *Stream = (FILE)FDEV_SETUP_STREAM(Serial_putchar, Serial_getchar, _FDEV_SETUP_RW);
} }
void Serial_CreateBlockingStream(FILE* Stream) void Serial_CreateBlockingStream(FILE* const Stream)
{ {
if (!(Stream)) if (!(Stream))
{ {

@ -139,7 +139,8 @@
* \param[in] Length Length of the data to send, in bytes. * \param[in] Length Length of the data to send, in bytes.
*/ */
void Serial_SendData(USART_t* const USART, void Serial_SendData(USART_t* const USART,
const void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); const void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
/** Creates a standard character stream from the USART so that it can be used with all the regular functions /** Creates a standard character stream from the USART so that it can be used with all the regular functions
* in the avr-libc \c <stdio.h> library that accept a \c FILE stream as a destination (e.g. \c fprintf). The created * in the avr-libc \c <stdio.h> library that accept a \c FILE stream as a destination (e.g. \c fprintf). The created
@ -155,7 +156,7 @@
* *
* \pre The USART must first be configured via a call to \ref Serial_Init() before the stream is used. * \pre The USART must first be configured via a call to \ref Serial_Init() before the stream is used.
*/ */
void Serial_CreateStream(FILE* Stream); void Serial_CreateStream(FILE* const Stream);
/** Identical to \ref Serial_CreateStream(), except that reads are blocking until the calling stream function terminates /** Identical to \ref Serial_CreateStream(), except that reads are blocking until the calling stream function terminates
* the transfer. * the transfer.
@ -165,7 +166,7 @@
* *
* \pre The USART must first be configured via a call to \ref Serial_Init() before the stream is used. * \pre The USART must first be configured via a call to \ref Serial_Init() before the stream is used.
*/ */
void Serial_CreateBlockingStream(FILE* Stream); void Serial_CreateBlockingStream(FILE* const Stream);
/* Inline Functions: */ /* Inline Functions: */
/** Initializes the USART, ready for serial data transmission and reception. This initializes the interface to /** Initializes the USART, ready for serial data transmission and reception. This initializes the interface to
@ -175,6 +176,9 @@
* \param[in] BaudRate Serial baud rate, in bits per second. * \param[in] BaudRate Serial baud rate, in bits per second.
* \param[in] DoubleSpeed Enables double speed mode when set, halving the sample time to double the baud rate. * \param[in] DoubleSpeed Enables double speed mode when set, halving the sample time to double the baud rate.
*/ */
static inline void Serial_Init(USART_t* const USART,
const uint32_t BaudRate,
const bool DoubleSpeed) ATTR_NON_NULL_PTR_ARG(1);
static inline void Serial_Init(USART_t* const USART, static inline void Serial_Init(USART_t* const USART,
const uint32_t BaudRate, const uint32_t BaudRate,
const bool DoubleSpeed) const bool DoubleSpeed)
@ -192,6 +196,7 @@
* *
* \param[in,out] USART Pointer to the base of the USART peripheral within the device. * \param[in,out] USART Pointer to the base of the USART peripheral within the device.
*/ */
static inline void Serial_Disable(USART_t* const USART) ATTR_ALWAYS_INLINE ATTR_NON_NULL_PTR_ARG(1);
static inline void Serial_Disable(USART_t* const USART) static inline void Serial_Disable(USART_t* const USART)
{ {
USART->CTRLA = 0; USART->CTRLA = 0;
@ -205,7 +210,7 @@
* *
* \return Boolean \c true if a character has been received, \c false otherwise. * \return Boolean \c true if a character has been received, \c false otherwise.
*/ */
static inline bool Serial_IsCharReceived(USART_t* const USART) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline bool Serial_IsCharReceived(USART_t* const USART) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1);
static inline bool Serial_IsCharReceived(USART_t* const USART) static inline bool Serial_IsCharReceived(USART_t* const USART)
{ {
return ((USART->STATUS & USART_RXCIF_bm) ? true : false); return ((USART->STATUS & USART_RXCIF_bm) ? true : false);
@ -217,7 +222,7 @@
* \param[in] DataByte Byte to transmit through the USART. * \param[in] DataByte Byte to transmit through the USART.
*/ */
static inline void Serial_SendByte(USART_t* const USART, static inline void Serial_SendByte(USART_t* const USART,
const char DataByte) ATTR_ALWAYS_INLINE; const char DataByte) ATTR_ALWAYS_INLINE ATTR_NON_NULL_PTR_ARG(1);
static inline void Serial_SendByte(USART_t* const USART, static inline void Serial_SendByte(USART_t* const USART,
const char DataByte) const char DataByte)
{ {
@ -231,7 +236,7 @@
* *
* \return Next byte received from the USART, or a negative value if no byte has been received. * \return Next byte received from the USART, or a negative value if no byte has been received.
*/ */
static inline int16_t Serial_ReceiveByte(USART_t* const USART) ATTR_ALWAYS_INLINE; static inline int16_t Serial_ReceiveByte(USART_t* const USART) ATTR_ALWAYS_INLINE ATTR_NON_NULL_PTR_ARG(1);
static inline int16_t Serial_ReceiveByte(USART_t* const USART) static inline int16_t Serial_ReceiveByte(USART_t* const USART)
{ {
if (!(Serial_IsCharReceived(USART))) if (!(Serial_IsCharReceived(USART)))

@ -137,7 +137,7 @@
* *
* \return Boolean \c true if a packet is waiting to be read in by the host, \c false otherwise. * \return Boolean \c true if a packet is waiting to be read in by the host, \c false otherwise.
*/ */
bool RNDIS_Device_IsPacketReceived(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo); bool RNDIS_Device_IsPacketReceived(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Retrieves the next pending packet from the device, discarding the remainder of the RNDIS packet header to leave /** Retrieves the next pending packet from the device, discarding the remainder of the RNDIS packet header to leave
* only the packet contents for processing by the device in the nominated buffer. * only the packet contents for processing by the device in the nominated buffer.
@ -153,7 +153,7 @@
*/ */
uint8_t RNDIS_Device_ReadPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, uint8_t RNDIS_Device_ReadPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo,
void* Buffer, void* Buffer,
uint16_t* const PacketLength); uint16_t* const PacketLength) ATTR_NON_NULL_PTR_ARG(1);
/** Sends the given packet to the attached RNDIS device, after adding a RNDIS packet message header. /** Sends the given packet to the attached RNDIS device, after adding a RNDIS packet message header.
* *
@ -168,7 +168,7 @@
*/ */
uint8_t RNDIS_Device_SendPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, uint8_t RNDIS_Device_SendPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo,
void* Buffer, void* Buffer,
const uint16_t PacketLength); const uint16_t PacketLength) ATTR_NON_NULL_PTR_ARG(1);
/* Private Interface - For use in library only: */ /* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__) #if !defined(__DOXYGEN__)

@ -176,7 +176,7 @@
*/ */
uint8_t AOA_Host_SendData(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, uint8_t AOA_Host_SendData(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo,
const void* const Buffer, const void* const Buffer,
const uint16_t Length); const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
/** Sends a given null-terminated string to the attached USB device, if connected. If a device is not connected when the /** Sends a given null-terminated string to the attached USB device, if connected. If a device is not connected when the
* function is called, the string is discarded. Bytes will be queued for transmission to the device until either the pipe * function is called, the string is discarded. Bytes will be queued for transmission to the device until either the pipe
@ -267,7 +267,7 @@
* \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed.
*/ */
void AOA_Host_CreateStream(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, void AOA_Host_CreateStream(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo,
FILE* const Stream); FILE* const Stream) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
/** Identical to \ref AOA_Host_CreateStream(), except that reads are blocking until the calling stream function terminates /** Identical to \ref AOA_Host_CreateStream(), except that reads are blocking until the calling stream function terminates
* the transfer. While blocking, the USB and AOA service tasks are called repeatedly to maintain USB communications. * the transfer. While blocking, the USB and AOA service tasks are called repeatedly to maintain USB communications.
@ -278,7 +278,7 @@
* \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed.
*/ */
void AOA_Host_CreateBlockingStream(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, void AOA_Host_CreateBlockingStream(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo,
FILE* const Stream); FILE* const Stream) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
/* Private Interface - For use in library only: */ /* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__) #if !defined(__DOXYGEN__)

@ -199,7 +199,7 @@
*/ */
uint8_t CDC_Host_SendData(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, uint8_t CDC_Host_SendData(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
const void* const Buffer, const void* const Buffer,
const uint16_t Length); const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
/** Sends a given null-terminated string to the attached USB device, if connected. If a device is not connected when the /** Sends a given null-terminated string to the attached USB device, if connected. If a device is not connected when the
* function is called, the string is discarded. Bytes will be queued for transmission to the device until either the pipe * function is called, the string is discarded. Bytes will be queued for transmission to the device until either the pipe
@ -291,7 +291,7 @@
* \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed.
*/ */
void CDC_Host_CreateStream(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, void CDC_Host_CreateStream(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
FILE* const Stream); FILE* const Stream) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
/** Identical to \ref CDC_Host_CreateStream(), except that reads are blocking until the calling stream function terminates /** Identical to \ref CDC_Host_CreateStream(), except that reads are blocking until the calling stream function terminates
* the transfer. While blocking, the USB and CDC service tasks are called repeatedly to maintain USB communications. * the transfer. While blocking, the USB and CDC service tasks are called repeatedly to maintain USB communications.
@ -302,7 +302,7 @@
* \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed.
*/ */
void CDC_Host_CreateBlockingStream(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, void CDC_Host_CreateBlockingStream(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
FILE* const Stream); FILE* const Stream) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
#endif #endif
/** CDC class driver event for a control line state change on a CDC host interface. This event fires each time the device notifies /** CDC class driver event for a control line state change on a CDC host interface. This event fires each time the device notifies

@ -231,7 +231,7 @@
* *
* \return Total number of buffered bytes received from the device. * \return Total number of buffered bytes received from the device.
*/ */
uint16_t PRNT_Host_BytesReceived(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo); uint16_t PRNT_Host_BytesReceived(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Reads a byte of data from the device. If no data is waiting to be read of if a USB device is not connected, the function /** Reads a byte of data from the device. If no data is waiting to be read of if a USB device is not connected, the function
* returns a negative value. The \ref PRNT_Host_BytesReceived() function may be queried in advance to determine how many bytes * returns a negative value. The \ref PRNT_Host_BytesReceived() function may be queried in advance to determine how many bytes
@ -244,7 +244,7 @@
* *
* \return Next received byte from the device, or a negative value if no data received. * \return Next received byte from the device, or a negative value if no data received.
*/ */
int16_t PRNT_Host_ReceiveByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo); int16_t PRNT_Host_ReceiveByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Retrieves the attached printer device's ID string, formatted according to IEEE 1284. This string is sent as a /** Retrieves the attached printer device's ID string, formatted according to IEEE 1284. This string is sent as a
* Unicode string from the device and is automatically converted to an ASCII encoded C string by this function, thus * Unicode string from the device and is automatically converted to an ASCII encoded C string by this function, thus

@ -76,7 +76,7 @@
* uint8_t* CurrDescriptor = &ConfigDescriptor[0]; // Pointing to the configuration header * uint8_t* CurrDescriptor = &ConfigDescriptor[0]; // Pointing to the configuration header
* USB_Descriptor_Configuration_Header_t* ConfigHeaderPtr = DESCRIPTOR_PCAST(CurrDescriptor, * USB_Descriptor_Configuration_Header_t* ConfigHeaderPtr = DESCRIPTOR_PCAST(CurrDescriptor,
* USB_Descriptor_Configuration_Header_t); * USB_Descriptor_Configuration_Header_t);
* *
* // Can now access elements of the configuration header struct using the -> indirection operator * // Can now access elements of the configuration header struct using the -> indirection operator
* \endcode * \endcode
*/ */
@ -90,7 +90,7 @@
* uint8_t* CurrDescriptor = &ConfigDescriptor[0]; // Pointing to the configuration header * uint8_t* CurrDescriptor = &ConfigDescriptor[0]; // Pointing to the configuration header
* USB_Descriptor_Configuration_Header_t ConfigHeader = DESCRIPTOR_CAST(CurrDescriptor, * USB_Descriptor_Configuration_Header_t ConfigHeader = DESCRIPTOR_CAST(CurrDescriptor,
* USB_Descriptor_Configuration_Header_t); * USB_Descriptor_Configuration_Header_t);
* *
* // Can now access elements of the configuration header struct using the . operator * // Can now access elements of the configuration header struct using the . operator
* \endcode * \endcode
*/ */
@ -231,7 +231,7 @@
* Usage Example: * Usage Example:
* \code * \code
* uint8_t EndpointSearcher(void* CurrentDescriptor); // Comparator Prototype * uint8_t EndpointSearcher(void* CurrentDescriptor); // Comparator Prototype
* *
* uint8_t EndpointSearcher(void* CurrentDescriptor) * uint8_t EndpointSearcher(void* CurrentDescriptor)
* { * {
* if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) * if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
@ -239,9 +239,9 @@
* else * else
* return DESCRIPTOR_SEARCH_NotFound; * return DESCRIPTOR_SEARCH_NotFound;
* } * }
* *
* //... * //...
* *
* // After retrieving configuration descriptor: * // After retrieving configuration descriptor:
* if (USB_Host_GetNextDescriptorComp(&BytesRemaining, &CurrentConfigLoc, EndpointSearcher) == * if (USB_Host_GetNextDescriptorComp(&BytesRemaining, &CurrentConfigLoc, EndpointSearcher) ==
* Descriptor_Search_Comp_Found) * Descriptor_Search_Comp_Found)
@ -252,7 +252,8 @@
*/ */
uint8_t USB_GetNextDescriptorComp(uint16_t* const BytesRem, uint8_t USB_GetNextDescriptorComp(uint16_t* const BytesRem,
void** const CurrConfigLoc, void** const CurrConfigLoc,
ConfigComparatorPtr_t const ComparatorRoutine); ConfigComparatorPtr_t const ComparatorRoutine) ATTR_NON_NULL_PTR_ARG(1)
ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(3);
/* Inline Functions: */ /* Inline Functions: */
/** Skips over the current sub-descriptor inside the configuration descriptor, so that the pointer then /** Skips over the current sub-descriptor inside the configuration descriptor, so that the pointer then

@ -50,13 +50,13 @@
* Usage Example: * Usage Example:
* \code * \code
* #include <LUFA/Platform/XMEGA/ClockManagement.h> * #include <LUFA/Platform/XMEGA/ClockManagement.h>
* *
* void main(void) * void main(void)
* { * {
* // Start the PLL to multiply the 2MHz RC oscillator to F_CPU and switch the CPU core to run from it * // Start the PLL to multiply the 2MHz RC oscillator to F_CPU and switch the CPU core to run from it
* XMEGACLK_StartPLL(CLOCK_SRC_INT_RC2MHZ, 2000000, F_CPU); * XMEGACLK_StartPLL(CLOCK_SRC_INT_RC2MHZ, 2000000, F_CPU);
* XMEGACLK_SetCPUClockSource(CLOCK_SRC_PLL); * XMEGACLK_SetCPUClockSource(CLOCK_SRC_PLL);
* *
* // Start the 32MHz internal RC oscillator and start the DFLL to increase it to F_USB using the USB SOF as a reference * // Start the 32MHz internal RC oscillator and start the DFLL to increase it to F_USB using the USB SOF as a reference
* XMEGACLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ); * XMEGACLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ);
* XMEGACLK_StartDFLL(CLOCK_SRC_INT_RC32MHZ, DFLL_REF_INT_USBSOF, F_USB); * XMEGACLK_StartDFLL(CLOCK_SRC_INT_RC32MHZ, DFLL_REF_INT_USBSOF, F_USB);
@ -123,7 +123,7 @@
* \param[in] Address Address to write to, a memory address protected by the CCP mechanism * \param[in] Address Address to write to, a memory address protected by the CCP mechanism
* \param[in] Value Value to write to the protected location * \param[in] Value Value to write to the protected location
*/ */
static inline void XMEGACLK_CCP_Write(volatile void* Address, const uint8_t Value) ATTR_ALWAYS_INLINE; static inline void XMEGACLK_CCP_Write(volatile void* Address, const uint8_t Value) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE;
static inline void XMEGACLK_CCP_Write(volatile void* Address, const uint8_t Value) static inline void XMEGACLK_CCP_Write(volatile void* Address, const uint8_t Value)
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
@ -134,7 +134,7 @@
: /* No output operands */ : /* No output operands */
: /* Input operands: */ "m" (RAMPZ), "e" (Address), "m" (CCP), "r" (CCP_IOREG_gc), "r" (Value) : /* Input operands: */ "m" (RAMPZ), "e" (Address), "m" (CCP), "r" (CCP_IOREG_gc), "r" (Value)
: /* Clobbered registers: */ "r30", "r31" : /* Clobbered registers: */ "r30", "r31"
); );
} }
/** Starts the external oscillator of the XMEGA microcontroller, with the given options. This routine blocks until /** Starts the external oscillator of the XMEGA microcontroller, with the given options. This routine blocks until
@ -239,7 +239,7 @@
if (SourceFreq > Frequency) if (SourceFreq > Frequency)
return false; return false;
if (MulFactor > 31) if (MulFactor > 31)
return false; return false;

Loading…
Cancel
Save