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
......@@ -28,10 +28,12 @@
this software.
*/
#define __INCLUDE_FROM_USB_DRIVER
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#define INCLUDE_FROM_RNDIS_CLASS_DEVICE_C
#define __INCLUDE_FROM_RNDIS_CLASS_DEVICE_C
#define __INCLUDE_FROM_RNDIS_DRIVER
#include "RNDIS.h"
static const uint32_t PROGMEM AdapterSupportedOIDList[] =
......
......@@ -55,6 +55,11 @@
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_RNDIS_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/RNDIS.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** Class state structure. An instance of this structure should be made for each RNDIS interface
......@@ -131,7 +136,7 @@
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Function Prototypes: */
#if defined(INCLUDE_FROM_RNDIS_CLASS_DEVICE_C)
#if defined(__INCLUDE_FROM_RNDIS_CLASS_DEVICE_C)
static void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo)
ATTR_NON_NULL_PTR_ARG(1);
static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo,
......
......@@ -51,6 +51,10 @@
#ifndef _HID_CLASS_H_
#define _HID_CLASS_H_
/* Macros: */
#define __INCLUDE_FROM_HID_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
/* Includes: */
#include "../HighLevel/USBMode.h"
......
......@@ -28,10 +28,12 @@
this software.
*/
#define __INCLUDE_FROM_USB_DRIVER
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define INCLUDE_FROM_CDC_CLASS_HOST_C
#define __INCLUDE_FROM_CDC_CLASS_HOST_C
#define __INCLUDE_FROM_CDC_DRIVER
#include "CDC.h"
uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, uint16_t ConfigDescriptorSize,
......
......@@ -56,6 +56,11 @@
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_CDC_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/CDC.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** Class state structure. An instance of this structure should be made within the user application,
......@@ -286,7 +291,7 @@
#define CDC_FOUND_NOTIFICATION_IN (1 << 2)
/* Function Prototypes: */
#if defined(INCLUDE_FROM_CDC_CLASS_HOST_C)
#if defined(__INCLUDE_FROM_CDC_CLASS_HOST_C)
static int CDC_Host_putchar(char c, FILE* Stream);
static int CDC_Host_getchar(FILE* Stream);
static int CDC_Host_getchar_Blocking(FILE* Stream);
......
......@@ -28,10 +28,12 @@
this software.
*/
#define __INCLUDE_FROM_USB_DRIVER
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define INCLUDE_FROM_HID_CLASS_HOST_C
#define __INCLUDE_FROM_HID_CLASS_HOST_C
#define __INCLUDE_FROM_HID_DRIVER
#include "HID.h"
uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, uint16_t ConfigDescriptorSize,
......
......@@ -55,6 +55,11 @@
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_HID_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/HID.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Error code for some HID Host functions, indicating a logical (and not hardware) error */
......@@ -275,7 +280,7 @@
#define HID_FOUND_DATAPIPE_OUT (1 << 1)
/* Function Prototypes: */
#if defined(INCLUDE_FROM_HID_CLASS_HOST_C)
#if defined(__INCLUDE_FROM_HID_CLASS_HOST_C)
static uint8_t DComp_HID_Host_NextHIDInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t DComp_NextHID(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t DComp_HID_Host_NextHIDInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
......
......@@ -28,6 +28,7 @@
this software.
*/
#define __INCLUDE_FROM_USB_DRIVER
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
......
......@@ -57,6 +57,10 @@
#ifndef __HIDPARSER_H__
#define __HIDPARSER_H__
/* Macros: */
#define __INCLUDE_FROM_USB_DRIVER
#define __INCLUDE_FROM_HID_DRIVER
/* Includes: */
#include <string.h>
#include <stdbool.h>
......
......@@ -28,10 +28,12 @@
this software.
*/
#define __INCLUDE_FROM_USB_DRIVER
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define INCLUDE_FROM_MIDI_CLASS_HOST_C
#define __INCLUDE_FROM_MIDI_CLASS_HOST_C
#define __INCLUDE_FROM_MIDI_DRIVER
#include "MIDI.h"
uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, uint16_t ConfigDescriptorSize,
......
......@@ -53,6 +53,11 @@
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_MIDI_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/MIDI.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** Class state structure. An instance of this structure should be made within the user application,
......@@ -172,7 +177,7 @@
#define MIDI_FOUND_DATAPIPE_OUT (1 << 1)
/* Function Prototypes: */
#if defined(INCLUDE_FROM_MIDI_CLASS_HOST_C)
#if defined(__INCLUDE_FROM_MIDI_CLASS_HOST_C)
static uint8_t DComp_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t DComp_MIDI_Host_NextMIDIStreamingDataEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
#endif
......
......@@ -28,10 +28,12 @@
this software.
*/
#define __INCLUDE_FROM_USB_DRIVER
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define INCLUDE_FROM_MS_CLASS_HOST_C
#define __INCLUDE_FROM_MS_CLASS_HOST_C
#define __INCLUDE_FROM_MS_DRIVER
#include "MassStorage.h"
uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, uint16_t ConfigDescriptorSize,
......
......@@ -53,6 +53,11 @@
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_MS_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/MassStorage.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Error code for some Mass Storage Host functions, indicating a logical (and not hardware) error */
......@@ -296,7 +301,7 @@
#define MS_FOUND_DATAPIPE_OUT (1 << 1)
/* Function Prototypes: */
#if defined(INCLUDE_FROM_MS_CLASS_HOST_C)
#if defined(__INCLUDE_FROM_MS_CLASS_HOST_C)
static uint8_t DComp_NextMSInterface(void* const CurrentDescriptor);
static uint8_t DComp_NextMSInterfaceEndpoint(void* const CurrentDescriptor);
......
......@@ -28,10 +28,12 @@
this software.
*/
#define __INCLUDE_FROM_USB_DRIVER
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define INCLUDE_FROM_PRINTER_CLASS_HOST_C
#define __INCLUDE_FROM_PRINTER_CLASS_HOST_C
#define __INCLUDE_FROM_PRINTER_DRIVER
#include "Printer.h"
uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, uint16_t ConfigDescriptorSize,
......
......@@ -53,9 +53,12 @@
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_PRINTER_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/Printer.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/* Type Defines: */
/** Class state structure. An instance of this structure should be made within the user application,
* and passed to each of the Printer class driver functions as the PRNTInterfaceInfo parameter. This
......@@ -203,7 +206,7 @@
#define PRNT_FOUND_DATAPIPE_OUT (1 << 1)
/* Function Prototypes: */
#if defined(INCLUDE_FROM_PRINTER_CLASS_HOST_C)
#if defined(__INCLUDE_FROM_PRINTER_CLASS_HOST_C)
static uint8_t DComp_NextPRNTInterface(void* const CurrentDescriptor);
static uint8_t DComp_NextPRNTInterfaceEndpoint(void* const CurrentDescriptor);
#endif
......
......@@ -28,10 +28,12 @@
this software.
*/
#define __INCLUDE_FROM_USB_DRIVER
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define INCLUDE_FROM_RNDIS_CLASS_HOST_C
#define __INCLUDE_FROM_RNDIS_CLASS_HOST_C
#define __INCLUDE_FROM_RNDIS_DRIVER
#include "RNDIS.h"
uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, uint16_t ConfigDescriptorSize,
......
......@@ -57,6 +57,11 @@
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_RNDIS_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/RNDIS.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** Class state structure. An instance of this structure should be made within the user application,
......@@ -245,7 +250,7 @@
#define RNDIS_FOUND_NOTIFICATION_IN (1 << 2)
/* Function Prototypes: */
#if defined(INCLUDE_FROM_RNDIS_CLASS_HOST_C)
#if defined(__INCLUDE_FROM_RNDIS_CLASS_HOST_C)
static uint8_t RNDIS_SendEncapsulatedCommand(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,
void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t RNDIS_GetEncapsulatedResponse(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,
......
......@@ -28,10 +28,12 @@
this software.
*/
#define __INCLUDE_FROM_USB_DRIVER
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define INCLUDE_FROM_SI_CLASS_HOST_C
#define __INCLUDE_FROM_SI_CLASS_HOST_C
#define __INCLUDE_FROM_SI_DRIVER
#include "StillImage.h"
uint8_t SImage_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, uint16_t ConfigDescriptorSize,
......
......@@ -53,6 +53,11 @@
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_SI_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/StillImage.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Error code for some Still Image Host functions, indicating a logical (and not hardware) error */
......@@ -287,7 +292,7 @@
#define COMMAND_DATA_TIMEOUT_MS 10000
/* Function Prototypes: */
#if defined(INCLUDE_FROM_SI_CLASS_HOST_C)
#if defined(__INCLUDE_FROM_SI_CLASS_HOST_C)
static uint8_t DComp_SI_Host_NextSIInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t DComp_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
#endif
......
......@@ -53,6 +53,10 @@
#ifndef _MIDI_CLASS_H_
#define _MIDI_CLASS_H_
/* Macros: */
#define __INCLUDE_FROM_MIDI_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
/* Includes: */
#include "../HighLevel/USBMode.h"
......
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