aboutsummaryrefslogtreecommitdiffstats
path: root/lib/lufa/Demos/Device/LowLevel/AudioInput/AudioInput.h
blob: 718df7cb7c3ea030ebeaa22f34a9d3e3e68a46a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
             LUFA Library
     Copyright (C) Dean Camera, 2017.

  dean [at] fourwalledcubicle [dot] com
           www.lufa-lib.org
*/

/*
  Copyright 2017  Dean Camera (dean [at] fourwalledcubicle [dot] com)

  Permission to use, copy, modify, distribute, and sell this
  software and its documentation for any purpose is hereby granted
  without fee, provided that the above copyright notice appear in
  all copies and that both that the copyright notice and this
  permission notice and warranty disclaimer appear in supporting
  documentation, and that the name of the author not be used in
  advertising or publicity pertaining to distribution of the
  software without specific, written prior permission.

  The author disclaims all warranties with regard to this
  software, including all implied warranties of merchantability
  and fitness.  In no event shall the author be liable for any
  special, indirect or consequential damages or any damages
  whatsoever resulting from loss of use, data or profits, whether
  in an action of contract, negligence or other tortious action,
  arising out of or in connection with the use or performance of
  this software.
*/

/** \file
 *
 *  Header file for AudioInput.c.
 */

#ifndef _AUDIO_INPUT_H_
#define _AUDIO_INPUT_H_

	/* Includes: */
		#include <avr/io.h>
		#include <avr/wdt.h>
		#include <avr/power.h>
		#include <avr/interrupt.h>

		#include "Descriptors.h"
		#include "Config/AppConfig.h"

		#include <LUFA/Drivers/USB/USB.h>
		#include <LUFA/Drivers/Board/LEDs.h>
		#include <LUFA/Drivers/Board/Buttons.h>
		#include <LUFA/Drivers/Peripheral/ADC.h>
		#include <LUFA/Platform/Platform.h>

	/* Macros: */
		/** Maximum audio sample value for the microphone input. */
		#define SAMPLE_MAX_RANGE          0xFFFF

		/** Maximum ADC range for the microphone input. */
		#define ADC_MAX_RANGE             0x3FF

		/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
		#define LEDMASK_USB_NOTREADY      LEDS_LED1

		/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
		#define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)

		/** LED mask for the library LED driver, to indicate that the USB interface is ready. */
		#define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)

		/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
		#define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)

	/* Function Prototypes: */
		void SetupHardware(void);

		void EVENT_USB_Device_Connect(void);
		void EVENT_USB_Device_Disconnect(void);
		void EVENT_USB_Device_ConfigurationChanged(void);
		void EVENT_USB_Device_ControlRequest(void);

#endif
*/ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
 * Copyright (c) 2006, XenSource Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 */

#ifndef XEN_CPU_FEATURE_H
#define XEN_CPU_FEATURE_H


#include "xen_common.h"


enum xen_cpu_feature
{
    /**
     *  Onboard FPU
     */
    XEN_CPU_FEATURE_FPU,

    /**
     *  Virtual Mode Extensions
     */
    XEN_CPU_FEATURE_VME,

    /**
     *  Debugging Extensions
     */
    XEN_CPU_FEATURE_DE,

    /**
     *  Page Size Extensions
     */
    XEN_CPU_FEATURE_PSE,

    /**
     *  Time Stamp Counter
     */
    XEN_CPU_FEATURE_TSC,

    /**
     *  Model-Specific Registers, RDMSR, WRMSR
     */
    XEN_CPU_FEATURE_MSR,

    /**
     *  Physical Address Extensions
     */
    XEN_CPU_FEATURE_PAE,

    /**
     *  Machine Check Architecture
     */
    XEN_CPU_FEATURE_MCE,

    /**
     *  CMPXCHG8 instruction
     */
    XEN_CPU_FEATURE_CX8,

    /**
     *  Onboard APIC
     */
    XEN_CPU_FEATURE_APIC,

    /**
     *  SYSENTER/SYSEXIT
     */
    XEN_CPU_FEATURE_SEP,

    /**
     *  Memory Type Range Registers
     */
    XEN_CPU_FEATURE_MTRR,

    /**
     *  Page Global Enable
     */
    XEN_CPU_FEATURE_PGE,

    /**
     *  Machine Check Architecture
     */
    XEN_CPU_FEATURE_MCA,

    /**
     *  CMOV instruction (FCMOVCC and FCOMI too if FPU present)
     */
    XEN_CPU_FEATURE_CMOV,

    /**
     *  Page Attribute Table
     */
    XEN_CPU_FEATURE_PAT,

    /**
     *  36-bit PSEs
     */
    XEN_CPU_FEATURE_PSE36,

    /**
     *  Processor serial number
     */
    XEN_CPU_FEATURE_PN,

    /**
     *  Supports the CLFLUSH instruction
     */
    XEN_CPU_FEATURE_CLFLSH,

    /**
     *  Debug Trace Store
     */
    XEN_CPU_FEATURE_DTES,

    /**
     *  ACPI via MSR
     */
    XEN_CPU_FEATURE_ACPI,

    /**
     *  Multimedia Extensions
     */
    XEN_CPU_FEATURE_MMX,

    /**
     *  FXSAVE and FXRSTOR instructions (fast save and restore
     */
    XEN_CPU_FEATURE_FXSR,

    /**
     *  Streaming SIMD Extensions
     */
    XEN_CPU_FEATURE_XMM,

    /**
     *  Streaming SIMD Extensions-2
     */
    XEN_CPU_FEATURE_XMM2,

    /**
     *  CPU self snoop
     */
    XEN_CPU_FEATURE_SELFSNOOP,

    /**
     *  Hyper-Threading
     */
    XEN_CPU_FEATURE_HT,

    /**
     *  Automatic clock control
     */
    XEN_CPU_FEATURE_ACC,

    /**
     *  IA-64 processor
     */
    XEN_CPU_FEATURE_IA64,

    /**
     *  SYSCALL/SYSRET
     */
    XEN_CPU_FEATURE_SYSCALL,

    /**
     *  MP Capable.
     */
    XEN_CPU_FEATURE_MP,

    /**
     *  Execute Disable
     */
    XEN_CPU_FEATURE_NX,

    /**
     *  AMD MMX extensions
     */
    XEN_CPU_FEATURE_MMXEXT,

    /**
     *  Long Mode (x86-64)
     */
    XEN_CPU_FEATURE_LM,

    /**
     *  AMD 3DNow! extensions
     */
    XEN_CPU_FEATURE_3DNOWEXT,

    /**
     *  3DNow!
     */
    XEN_CPU_FEATURE_3DNOW,

    /**
     *  CPU in recovery mode
     */
    XEN_CPU_FEATURE_RECOVERY,

    /**
     *  Longrun power control
     */
    XEN_CPU_FEATURE_LONGRUN,

    /**
     *  LongRun table interface
     */
    XEN_CPU_FEATURE_LRTI,

    /**
     *  Cyrix MMX extensions
     */
    XEN_CPU_FEATURE_CXMMX,

    /**
     *  AMD K6 nonstandard MTRRs
     */
    XEN_CPU_FEATURE_K6_MTRR,

    /**
     *  Cyrix ARRs (= MTRRs)
     */
    XEN_CPU_FEATURE_CYRIX_ARR,

    /**
     *  Centaur MCRs (= MTRRs)
     */
    XEN_CPU_FEATURE_CENTAUR_MCR,

    /**
     *  Opteron, Athlon64
     */
    XEN_CPU_FEATURE_K8,

    /**
     *  Athlon
     */
    XEN_CPU_FEATURE_K7,

    /**
     *  P3
     */
    XEN_CPU_FEATURE_P3,

    /**
     *  P4
     */
    XEN_CPU_FEATURE_P4,

    /**
     *  TSC ticks at a constant rate
     */
    XEN_CPU_FEATURE_CONSTANT_TSC,

    /**
     *  FXSAVE leaks FOP/FIP/FOP
     */
    XEN_CPU_FEATURE_FXSAVE_LEAK,

    /**
     *  Streaming SIMD Extensions-3
     */
    XEN_CPU_FEATURE_XMM3,

    /**
     *  Monitor/Mwait support
     */
    XEN_CPU_FEATURE_MWAIT,

    /**
     *  CPL Qualified Debug Store
     */
    XEN_CPU_FEATURE_DSCPL,

    /**
     *  Enhanced SpeedStep
     */
    XEN_CPU_FEATURE_EST,

    /**
     *  Thermal Monitor 2
     */
    XEN_CPU_FEATURE_TM2,

    /**
     *  Context ID
     */
    XEN_CPU_FEATURE_CID,

    /**
     *  CMPXCHG16B
     */
    XEN_CPU_FEATURE_CX16,

    /**
     *  Send Task Priority Messages
     */
    XEN_CPU_FEATURE_XTPR,

    /**
     *  on-CPU RNG present (xstore insn)
     */
    XEN_CPU_FEATURE_XSTORE,

    /**
     *  on-CPU RNG enabled
     */
    XEN_CPU_FEATURE_XSTORE_EN,

    /**
     *  on-CPU crypto (xcrypt insn)
     */
    XEN_CPU_FEATURE_XCRYPT,

    /**
     *  on-CPU crypto enabled
     */
    XEN_CPU_FEATURE_XCRYPT_EN,

    /**
     *  LAHF/SAHF in long mode
     */
    XEN_CPU_FEATURE_LAHF_LM,

    /**
     *  If yes HyperThreading not valid
     */
    XEN_CPU_FEATURE_CMP_LEGACY,

    /**
     *  VMX instruction set
     */
    XEN_CPU_FEATURE_VMX
};


typedef struct xen_cpu_feature_set
{
    size_t size;
    enum xen_cpu_feature contents[];
} xen_cpu_feature_set;

/**
 * Allocate a xen_cpu_feature_set of the given size.
 */
extern xen_cpu_feature_set *
xen_cpu_feature_set_alloc(size_t size);

/**
 * Free the given xen_cpu_feature_set.  The given set must have been
 * allocated by this library.
 */
extern void
xen_cpu_feature_set_free(xen_cpu_feature_set *set);


/**
 * Return the name corresponding to the given code.  This string must
 * not be modified or freed.
 */
extern const char *
xen_cpu_feature_to_string(enum xen_cpu_feature val);


/**
 * Return the correct code for the given string, or set the session
 * object to failure and return an undefined value if the given string does
 * not match a known code.
 */
extern enum xen_cpu_feature
xen_cpu_feature_from_string(xen_session *session, const char *str);


#endif