forked from mfulz_github/qmk_firmware
Add some missing function attributes.
This commit is contained in:
parent
d5e84db5ab
commit
334f70aa80
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -128,6 +128,9 @@
|
|||
* \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)
|
||||
|
@ -145,6 +148,7 @@
|
|||
*
|
||||
* \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;
|
||||
|
@ -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,6 +195,7 @@
|
|||
*
|
||||
* \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);
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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 <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.
|
||||
*/
|
||||
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)))
|
||||
|
|
|
@ -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__)
|
||||
|
|
|
@ -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__)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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__ (
|
||||
|
|
Loading…
Reference in New Issue