diff --git a/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h b/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h index be5434eba9..3fc681a286 100644 --- a/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h +++ b/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h @@ -56,17 +56,17 @@ * // Initialize the SPI driver before first use * SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | * SPI_SAMPLE_TRAILING | SPI_MODE_MASTER); - * + * * // Send several bytes, ignoring the returned data * SPI_SendByte(0x01); * SPI_SendByte(0x02); * SPI_SendByte(0x03); - * + * * // Receive several bytes, sending a dummy 0x00 byte each time * uint8_t Byte1 = SPI_ReceiveByte(); * uint8_t Byte2 = SPI_ReceiveByte(); * uint8_t Byte3 = SPI_ReceiveByte(); - * + * * // Send a byte, and store the received byte from the same transaction * uint8_t ResponseByte = SPI_TransferByte(0xDC); * \endcode @@ -165,6 +165,7 @@ * \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. */ + 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 */ @@ -187,6 +188,7 @@ } /** 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) { DDRB &= ~((1 << 1) | (1 << 2)); diff --git a/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h b/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h index c0a9067b76..80de7da807 100644 --- a/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h +++ b/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h @@ -201,8 +201,10 @@ * \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. */ - 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, const uint8_t BitLength) + 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, + const uint8_t BitLength) { TWCR |= (1 << TWEN); TWSR = Prescale; diff --git a/LUFA/Drivers/Peripheral/XMEGA/SPI_XMEGA.h b/LUFA/Drivers/Peripheral/XMEGA/SPI_XMEGA.h index 4c06851827..b1678dbbef 100644 --- a/LUFA/Drivers/Peripheral/XMEGA/SPI_XMEGA.h +++ b/LUFA/Drivers/Peripheral/XMEGA/SPI_XMEGA.h @@ -53,17 +53,17 @@ * SPI_Init(&SPIC, * SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | * SPI_SAMPLE_TRAILING | SPI_MODE_MASTER); - * + * * // Send several bytes, ignoring the returned data * SPI_SendByte(&SPIC, 0x01); * SPI_SendByte(&SPIC, 0x02); * SPI_SendByte(&SPIC, 0x03); - * + * * // Receive several bytes, sending a dummy 0x00 byte each time * uint8_t Byte1 = SPI_ReceiveByte(&SPIC); * uint8_t Byte2 = SPI_ReceiveByte(&SPIC); * uint8_t Byte3 = SPI_ReceiveByte(&SPIC); - * + * * // Send a byte, and store the received byte from the same transaction * uint8_t ResponseByte = SPI_TransferByte(&SPIC, 0xDC); * \endcode @@ -163,6 +163,8 @@ * \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. */ + 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, const uint8_t SPIOptions) { @@ -173,6 +175,7 @@ * * \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) { 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 */ - 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) { return (SPI->CTRL & SPI_MASTER_bm); @@ -198,7 +201,7 @@ * \return Response byte from the attached SPI device. */ 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, const uint8_t Byte) { @@ -214,7 +217,7 @@ * \param[in] Byte Byte to send through the SPI interface. */ 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, const uint8_t Byte) { @@ -229,7 +232,7 @@ * * \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) { SPI->DATA = 0; diff --git a/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h b/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h index 7042e9c7b1..38b682cfcd 100644 --- a/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h +++ b/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h @@ -53,17 +53,17 @@ * \code * // 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); - * + * * // Send several bytes, ignoring the returned data * SerialSPI_SendByte(&USARTD0, 0x01); * SerialSPI_SendByte(&USARTD0, 0x02); * SerialSPI_SendByte(&USARTD0, 0x03); - * + * * // Receive several bytes, sending a dummy 0x00 byte each time * uint8_t Byte1 = SerialSPI_ReceiveByte(&USARTD); * uint8_t Byte2 = SerialSPI_ReceiveByte(&USARTD); * uint8_t Byte3 = SerialSPI_ReceiveByte(&USARTD); - * + * * // Send a byte, and store the received byte from the same transaction * uint8_t ResponseByte = SerialSPI_TransferByte(&USARTD0, 0xDC); * \endcode @@ -118,40 +118,44 @@ /** 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 - //@} + //@} /* 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] 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. * \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, const uint8_t SPIOptions, const uint32_t BaudRate) { uint16_t BaudValue = SERIAL_SPI_UBBRVAL(BaudRate); - + USART->BAUDCTRLB = (BaudValue >> 8); USART->BAUDCTRLA = (BaudValue & 0xFF); - + USART->CTRLC = (USART_CMODE_MSPI_gc | SPIOptions); USART->CTRLB = (USART_RXEN_bm | USART_TXEN_bm); } - + /** 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. */ + 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) { USART->CTRLA = 0; USART->CTRLB = 0; USART->CTRLC = 0; } - + /** 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. @@ -159,6 +163,8 @@ * * \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, 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] 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, const uint8_t DataByte) { @@ -187,11 +195,12 @@ * * \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) { return SerialSPI_TransferByte(USART, 0); } - + /* Disable C linkage for C++ Compilers: */ #if defined(__cplusplus) } diff --git a/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c b/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c index c7dcd619be..3d61952684 100644 --- a/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c +++ b/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c @@ -95,7 +95,7 @@ void Serial_SendData(USART_t* const USART, Serial_SendByte(USART, *((uint8_t*)Buffer++)); } -void Serial_CreateStream(FILE* Stream) +void Serial_CreateStream(FILE* const Stream) { if (!(Stream)) { @@ -107,7 +107,7 @@ void Serial_CreateStream(FILE* Stream) *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)) { diff --git a/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.h b/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.h index 04941b1d8d..6d8e6ee6e7 100644 --- a/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.h +++ b/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.h @@ -139,7 +139,8 @@ * \param[in] Length Length of the data to send, in bytes. */ 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 * in the avr-libc \c 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. */ - 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 * 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. */ - void Serial_CreateBlockingStream(FILE* Stream); + void Serial_CreateBlockingStream(FILE* const Stream); /* Inline Functions: */ /** 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] 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, const uint32_t BaudRate, const bool DoubleSpeed) @@ -192,6 +196,7 @@ * * \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) { USART->CTRLA = 0; @@ -205,7 +210,7 @@ * * \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) { return ((USART->STATUS & USART_RXCIF_bm) ? true : false); @@ -217,7 +222,7 @@ * \param[in] DataByte Byte to transmit through the 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, const char DataByte) { @@ -231,7 +236,7 @@ * * \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) { if (!(Serial_IsCharReceived(USART))) diff --git a/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h b/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h index 9a80132ec3..d455cc98bb 100644 --- a/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h +++ b/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h @@ -137,7 +137,7 @@ * * \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 * 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, 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. * @@ -168,7 +168,7 @@ */ uint8_t RNDIS_Device_SendPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, void* Buffer, - const uint16_t PacketLength); + const uint16_t PacketLength) ATTR_NON_NULL_PTR_ARG(1); /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) diff --git a/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h b/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h index 6a4701e131..bcc76f9231 100644 --- a/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h +++ b/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h @@ -176,7 +176,7 @@ */ uint8_t AOA_Host_SendData(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, 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 * 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. */ 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 * 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. */ 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: */ #if !defined(__DOXYGEN__) diff --git a/LUFA/Drivers/USB/Class/Host/CDCClassHost.h b/LUFA/Drivers/USB/Class/Host/CDCClassHost.h index 23d637ae6e..1b421c52af 100644 --- a/LUFA/Drivers/USB/Class/Host/CDCClassHost.h +++ b/LUFA/Drivers/USB/Class/Host/CDCClassHost.h @@ -199,7 +199,7 @@ */ uint8_t CDC_Host_SendData(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, 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 * 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. */ 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 * 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. */ 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 /** CDC class driver event for a control line state change on a CDC host interface. This event fires each time the device notifies diff --git a/LUFA/Drivers/USB/Class/Host/PrinterClassHost.h b/LUFA/Drivers/USB/Class/Host/PrinterClassHost.h index 9a7cb08454..792f865644 100644 --- a/LUFA/Drivers/USB/Class/Host/PrinterClassHost.h +++ b/LUFA/Drivers/USB/Class/Host/PrinterClassHost.h @@ -231,7 +231,7 @@ * * \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 * 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. */ - 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 * Unicode string from the device and is automatically converted to an ASCII encoded C string by this function, thus diff --git a/LUFA/Drivers/USB/Core/ConfigDescriptors.h b/LUFA/Drivers/USB/Core/ConfigDescriptors.h index 98aefa751f..ad3c987211 100644 --- a/LUFA/Drivers/USB/Core/ConfigDescriptors.h +++ b/LUFA/Drivers/USB/Core/ConfigDescriptors.h @@ -76,7 +76,7 @@ * uint8_t* CurrDescriptor = &ConfigDescriptor[0]; // Pointing to the configuration header * USB_Descriptor_Configuration_Header_t* ConfigHeaderPtr = DESCRIPTOR_PCAST(CurrDescriptor, * USB_Descriptor_Configuration_Header_t); - * + * * // Can now access elements of the configuration header struct using the -> indirection operator * \endcode */ @@ -90,7 +90,7 @@ * uint8_t* CurrDescriptor = &ConfigDescriptor[0]; // Pointing to the configuration header * USB_Descriptor_Configuration_Header_t ConfigHeader = DESCRIPTOR_CAST(CurrDescriptor, * USB_Descriptor_Configuration_Header_t); - * + * * // Can now access elements of the configuration header struct using the . operator * \endcode */ @@ -231,7 +231,7 @@ * Usage Example: * \code * uint8_t EndpointSearcher(void* CurrentDescriptor); // Comparator Prototype - * + * * uint8_t EndpointSearcher(void* CurrentDescriptor) * { * if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) @@ -239,9 +239,9 @@ * else * return DESCRIPTOR_SEARCH_NotFound; * } - * + * * //... - * + * * // After retrieving configuration descriptor: * if (USB_Host_GetNextDescriptorComp(&BytesRemaining, &CurrentConfigLoc, EndpointSearcher) == * Descriptor_Search_Comp_Found) @@ -252,7 +252,8 @@ */ uint8_t USB_GetNextDescriptorComp(uint16_t* const BytesRem, 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: */ /** Skips over the current sub-descriptor inside the configuration descriptor, so that the pointer then diff --git a/LUFA/Platform/XMEGA/ClockManagement.h b/LUFA/Platform/XMEGA/ClockManagement.h index 2a2e50f721..ec341a2c8a 100644 --- a/LUFA/Platform/XMEGA/ClockManagement.h +++ b/LUFA/Platform/XMEGA/ClockManagement.h @@ -50,13 +50,13 @@ * Usage Example: * \code * #include - * + * * void main(void) * { * // 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_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 * XMEGACLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ); * 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] 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) { __asm__ __volatile__ ( @@ -134,7 +134,7 @@ : /* No output operands */ : /* Input operands: */ "m" (RAMPZ), "e" (Address), "m" (CCP), "r" (CCP_IOREG_gc), "r" (Value) : /* Clobbered registers: */ "r30", "r31" - ); + ); } /** Starts the external oscillator of the XMEGA microcontroller, with the given options. This routine blocks until @@ -239,7 +239,7 @@ if (SourceFreq > Frequency) return false; - + if (MulFactor > 31) return false;