aboutsummaryrefslogtreecommitdiffstats
path: root/lib/lufa/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.h
blob: 1c0c9b2808b4eee83363e0fc797794cf54e3e884 (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
/*
             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 VirtualSerialHost.c.
 */

#ifndef _VIRTUALSERIAL_HOST_H_
#define _VIRTUALSERIAL_HOST_H_

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

		#include <LUFA/Drivers/Misc/TerminalCodes.h>
		#include <LUFA/Drivers/USB/USB.h>
		#include <LUFA/Drivers/Peripheral/Serial.h>
		#include <LUFA/Drivers/Board/LEDs.h>
		#include <LUFA/Platform/Platform.h>

		#include "ConfigDescriptor.h"

	/* Macros: */
		/** 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 CDCHost_Task(void);

		void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
		void EVENT_USB_Host_DeviceAttached(void);
		void EVENT_USB_Host_DeviceUnattached(void);
		void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
		                                            const uint8_t SubErrorCode);
		void EVENT_USB_Host_DeviceEnumerationComplete(void);

#endif
ss="k">range <>) of STD_LOGIC; function TO_01 (S : SIGNED; XMAP : STD_LOGIC := '0') return SIGNED; function TO_01 (S : UNSIGNED; XMAP : STD_LOGIC := '0') return UNSIGNED; -- Convert 'H' and '1' to '1', 'L' and '0' to '0'. -- If any other value is present, return (others => XMAP) -- Issue a warning in that case, and if S is a null array. -- Result index range is S'Length - 1 downto 0. function std_match (l, r : std_ulogic) return boolean; function std_match (l, r : std_ulogic_vector) return boolean; function std_match (l, r : std_logic_vector) return boolean; function std_match (l, r : UNSIGNED) return boolean; function std_match (l, r : SIGNED) return boolean; -- Return True iff L and R matches. function TO_INTEGER (ARG : UNSIGNED) return NATURAL; function TO_INTEGER (ARG : SIGNED) return INTEGER; -- Convert ARG to an integer. -- Simulation is aborted in case of overflow. -- Issue a warning in case of non-logical value. function TO_UNSIGNED (ARG, SIZE : NATURAL) return UNSIGNED; -- Convert ARG to unsigned. -- Result index range is SIZE - 1 downto 0. -- Issue a warning if value is truncated. function TO_SIGNED (ARG : INTEGER; SIZE : NATURAL) return SIGNED; -- Convert ARG to signed. -- Result index range is SIZE - 1 downto 0. -- Issue a warning if value is truncated. function resize (ARG : UNSIGNED; NEW_SIZE: natural) return UNSIGNED; function resize (ARG : SIGNED; NEW_SIZE: natural) return SIGNED; -- Result index range is NEW_SIZE - 1 downto 0 (unless null array). -- For SIGNED, the sign of the result is the sign of ARG. function "=" (L, R : UNSIGNED) return BOOLEAN; function "=" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function "=" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function "/=" (L, R : UNSIGNED) return BOOLEAN; function "/=" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function "/=" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function "<" (L, R : UNSIGNED) return BOOLEAN; function "<" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function "<" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function "<=" (L, R : UNSIGNED) return BOOLEAN; function "<=" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function "<=" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function ">" (L, R : UNSIGNED) return BOOLEAN; function ">" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function ">" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function ">=" (L, R : UNSIGNED) return BOOLEAN; function ">=" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function ">=" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function "=" (L, R : SIGNED) return BOOLEAN; function "=" (L : SIGNED; R : INTEGER) return BOOLEAN; function "=" (L : INTEGER; R : SIGNED) return BOOLEAN; function "/=" (L, R : SIGNED) return BOOLEAN; function "/=" (L : SIGNED; R : INTEGER) return BOOLEAN; function "/=" (L : INTEGER; R : SIGNED) return BOOLEAN; function "<" (L, R : SIGNED) return BOOLEAN; function "<" (L : SIGNED; R : INTEGER) return BOOLEAN; function "<" (L : INTEGER; R : SIGNED) return BOOLEAN; function "<=" (L, R : SIGNED) return BOOLEAN; function "<=" (L : SIGNED; R : INTEGER) return BOOLEAN; function "<=" (L : INTEGER; R : SIGNED) return BOOLEAN; function ">" (L, R : SIGNED) return BOOLEAN; function ">" (L : SIGNED; R : INTEGER) return BOOLEAN; function ">" (L : INTEGER; R : SIGNED) return BOOLEAN; function ">=" (L, R : SIGNED) return BOOLEAN; function ">=" (L : SIGNED; R : INTEGER) return BOOLEAN; function ">=" (L : INTEGER; R : SIGNED) return BOOLEAN; -- Issue a warning in case of non-logical value. function "-" (ARG : SIGNED) return SIGNED; -- Compute -ARG. -- Result index range is Arg'length - 1 downto 0. function "abs" (ARG : SIGNED) return SIGNED; -- Compute abs ARG. -- Result index range is Arg'length - 1 downto 0. function "+" (L, R : UNSIGNED) return UNSIGNED; function "+" (L, R : SIGNED) return SIGNED; function "-" (L, R : UNSIGNED) return UNSIGNED; function "-" (L, R : SIGNED) return SIGNED; -- Compute L +/- R. -- Result index range is max (L'Length, R'Length) - 1 downto 0. -- Issue a warning in case of non-logical value. function "+" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "+" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "+" (L : SIGNED; R : INTEGER) return SIGNED; function "+" (L : INTEGER; R : SIGNED) return SIGNED; function "-" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "-" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "-" (L : SIGNED; R : INTEGER) return SIGNED; function "-" (L : INTEGER; R : SIGNED) return SIGNED; -- Compute L +/- R. -- Result index range is V'Length - 1 downto 0, where V is the vector -- parameter. -- Issue a warning in case of non-logical value. -- Issue a warning if value is truncated. function "*" (L, R : UNSIGNED) return UNSIGNED; function "*" (L, R : SIGNED) return SIGNED; -- Compute L * R -- Result index range is L'Length + R'Length - 1 downto 0. function "*" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "*" (L : SIGNED; R : INTEGER) return SIGNED; -- Compute L * R -- R is converted to a vector of length L'length function "*" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "*" (L : INTEGER; R : SIGNED) return SIGNED; -- Compute L * R -- L is converted to a vector of length R'length function "/" (L, R : UNSIGNED) return UNSIGNED; function "/" (L, R : SIGNED) return SIGNED; function "rem" (L, R : UNSIGNED) return UNSIGNED; function "rem" (L, R : SIGNED) return SIGNED; function "mod" (L, R : UNSIGNED) return UNSIGNED; function "mod" (L, R : SIGNED) return SIGNED; -- Compute L op R -- Result index range is L'Length - 1 downto 0. -- Issue a warning in case of non-logical value. -- Issue an error if R is 0. function "/" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "/" (L : SIGNED; R : INTEGER) return SIGNED; function "rem" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "rem" (L : SIGNED; R : INTEGER) return SIGNED; function "mod" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "mod" (L : SIGNED; R : INTEGER) return SIGNED; -- Compute L op R. -- Result index range is L'Length - 1 downto 0. -- Issue a warning in case of non-logical value. -- Issue an error if R is 0. function "/" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "/" (L : INTEGER; R : SIGNED) return SIGNED; function "rem" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "rem" (L : INTEGER; R : SIGNED) return SIGNED; function "mod" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "mod" (L : INTEGER; R : SIGNED) return SIGNED; -- Compute L op R. -- Result index range is R'Length - 1 downto 0. -- Issue a warning in case of non-logical value. -- Issue an error if R is 0. -- Result may be truncated. function "not" (l : UNSIGNED) return UNSIGNED; function "not" (l : SIGNED) return SIGNED; function "and" (l, r : UNSIGNED) return UNSIGNED; function "and" (l, r : SIGNED) return SIGNED; function "nand" (l, r : UNSIGNED) return UNSIGNED; function "nand" (l, r : SIGNED) return SIGNED; function "or" (l, r : UNSIGNED) return UNSIGNED; function "or" (l, r : SIGNED) return SIGNED; function "nor" (l, r : UNSIGNED) return UNSIGNED; function "nor" (l, r : SIGNED) return SIGNED; function "xor" (l, r : UNSIGNED) return UNSIGNED; function "xor" (l, r : SIGNED) return SIGNED; function "xnor" (l, r : UNSIGNED) return UNSIGNED; function "xnor" (l, r : SIGNED) return SIGNED; -- Compute L OP R. -- Result index range is L'Length - 1 downto 0. -- No specific handling of null array: the index range of the result -- would be -1 downto 0 (without warning). This it not what is specified -- in 1076.3, but corresponds to the standard implementation. -- No specific handling of non-logical values. Behaviour is compatible -- with std_logic_1164. function shift_left (ARG : UNSIGNED; COUNT: NATURAL) return UNSIGNED; function shift_left (ARG : SIGNED; COUNT: NATURAL) return SIGNED; function shift_right (ARG : UNSIGNED; COUNT: NATURAL) return UNSIGNED; function shift_right (ARG : SIGNED; COUNT: NATURAL) return SIGNED; -- Result index range is ARG'Length - 1 downto 0. function rotate_left (ARG : UNSIGNED; COUNT: NATURAL) return UNSIGNED; function rotate_left (ARG : SIGNED; COUNT: NATURAL) return SIGNED; function rotate_right (ARG : UNSIGNED; COUNT: NATURAL) return UNSIGNED; function rotate_right (ARG : SIGNED; COUNT: NATURAL) return SIGNED; -- Result index range is ARG'Length - 1 downto 0. function "sll" (ARG : UNSIGNED; COUNT: INTEGER) return UNSIGNED; function "sll" (ARG : SIGNED; COUNT: INTEGER) return SIGNED; function "srl" (ARG : UNSIGNED; COUNT: INTEGER) return UNSIGNED; function "srl" (ARG : SIGNED; COUNT: INTEGER) return SIGNED; -- Result index range is ARG'Length - 1 downto 0. function "rol" (ARG : UNSIGNED; COUNT: INTEGER) return UNSIGNED; function "rol" (ARG : SIGNED; COUNT: INTEGER) return SIGNED; function "ror" (ARG : UNSIGNED; COUNT: INTEGER) return UNSIGNED; function "ror" (ARG : SIGNED; COUNT: INTEGER) return SIGNED; -- Result index range is ARG'Length - 1 downto 0. end NUMERIC_STD;