Commit d49cc0f7 authored by Dean Camera's avatar Dean Camera
Browse files

Add more include protection macros to give the user warnings when they try to...

Add more include protection macros to give the user warnings when they try to manually include private driver header files, instead of the public driver headers.
parent 3a2c1db6
......@@ -50,6 +50,10 @@
#ifndef _MS_CLASS_H_
#define _MS_CLASS_H_
/* Macros: */
#define __INCLUDE_FROM_MS_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
/* Includes: */
#include "../HighLevel/USBMode.h"
......
......@@ -51,6 +51,10 @@
#ifndef _PRINTER_CLASS_H_
#define _PRINTER_CLASS_H_
/* Macros: */
#define __INCLUDE_FROM_PRINTER_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
/* Includes: */
#include "../HighLevel/USBMode.h"
......
......@@ -50,6 +50,10 @@
#ifndef _RNDIS_CLASS_H_
#define _RNDIS_CLASS_H_
/* Macros: */
#define __INCLUDE_FROM_RNDIS_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
/* Includes: */
#include "../HighLevel/USBMode.h"
......
......@@ -49,6 +49,10 @@
#ifndef _SI_CLASS_H_
#define _SI_CLASS_H_
/* Macros: */
#define __INCLUDE_FROM_SI_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
/* Includes: */
#include "../HighLevel/USBMode.h"
......
......@@ -28,6 +28,7 @@
this software.
*/
#define __INCLUDE_FROM_USB_DRIVER
#include "ConfigDescriptor.h"
#if defined(USB_CAN_BE_HOST)
......
......@@ -59,6 +59,11 @@
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Mask for determining the type of an endpoint from an endpoint descriptor. This should then be compared
......
......@@ -28,9 +28,8 @@
this software.
*/
#include "USBMode.h"
#define INCLUDE_FROM_EVENTS_C
#define __INCLUDE_FROM_EVENTS_C
#define __INCLUDE_FROM_USB_DRIVER
#include "Events.h"
void USB_Event_Stub(void)
......
......@@ -60,9 +60,14 @@
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Pseudo-Functions for Doxygen: */
#if !defined(INCLUDE_FROM_EVENTS_C) || defined(__DOXYGEN__)
#if !defined(__INCLUDE_FROM_EVENTS_C) || defined(__DOXYGEN__)
/** Event for USB stack initialization failure. This event fires when the USB interface fails to
* initialize correctly due to a hardware or software fault.
*
......@@ -287,7 +292,7 @@
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Function Prototypes: */
#if defined(INCLUDE_FROM_EVENTS_C)
#if defined(__INCLUDE_FROM_EVENTS_C)
void USB_Event_Stub(void) ATTR_CONST;
#if defined(USB_CAN_BE_BOTH)
......
......@@ -58,6 +58,11 @@
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Indicates that a given descriptor does not exist in the device. This can be used inside descriptors
......
......@@ -40,6 +40,11 @@
#ifndef __STDREQTYPE_H__
#define __STDREQTYPE_H__
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Mask for the request type parameter, to indicate the direction of the request data (Host to Device
......
......@@ -41,6 +41,11 @@
#ifndef __STREAMCALLBACK_H__
#define __STREAMCALLBACK_H__
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Used with the Endpoint and Pipe stream functions as the callback function parameter, indicating that the stream
......
......@@ -28,6 +28,7 @@
this software.
*/
#define __INCLUDE_FROM_USB_DRIVER
#include "USBInterrupt.h"
void USB_INT_DisableAllInterrupts(void)
......
......@@ -45,6 +45,11 @@
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
......
......@@ -43,6 +43,11 @@
#ifndef __USBMODE_H__
#define __USBMODE_H__
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Public Interface - May be used in end-application: */
#if defined(__DOXYGEN__)
/** Indicates that the target AVR microcontroller belongs to the Series 2 USB controller
......
......@@ -28,9 +28,8 @@
this software.
*/
#include "USBMode.h"
#define INCLUDE_FROM_USBTASK_C
#define __INCLUDE_FROM_USBTASK_C
#define __INCLUDE_FROM_USB_DRIVER
#include "USBTask.h"
volatile bool USB_IsInitialized;
......
......@@ -54,6 +54,11 @@
#if defined(__cplusplus)
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Global Variables: */
......@@ -164,7 +169,7 @@
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Function Prototypes: */
#if defined(INCLUDE_FROM_USBTASK_C)
#if defined(__INCLUDE_FROM_USBTASK_C)
#if defined(USB_CAN_BE_HOST)
static void USB_HostTask(void);
#endif
......
......@@ -28,11 +28,12 @@
this software.
*/
#define __INCLUDE_FROM_USB_DRIVER
#include "../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#define INCLUDE_FROM_DEVCHAPTER9_C
#define __INCLUDE_FROM_DEVCHAPTER9_C
#include "DevChapter9.h"
uint8_t USB_ConfigurationNumber;
......
......@@ -48,6 +48,11 @@
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
#if defined(USE_SINGLE_DEVICE_CONFIGURATION)
......@@ -124,7 +129,7 @@
/* Function Prototypes: */
void USB_Device_ProcessControlRequest(void);
#if defined(INCLUDE_FROM_DEVCHAPTER9_C)
#if defined(__INCLUDE_FROM_DEVCHAPTER9_C)
static void USB_Device_SetAddress(void);
static void USB_Device_SetConfiguration(void);
static void USB_Device_GetConfiguration(void);
......
......@@ -52,6 +52,10 @@
#if (defined(USE_RAM_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS))
#error USE_RAM_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive.
#endif
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
......
......@@ -28,11 +28,12 @@
this software.
*/
#define __INCLUDE_FROM_USB_DRIVER
#include "../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#define INCLUDE_FROM_ENDPOINT_C
#define __INCLUDE_FROM_ENDPOINT_C
#include "Endpoint.h"
#if !defined(FIXED_CONTROL_ENDPOINT_SIZE)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment