Moved all source to the trunk directory.
[pub/USBasp.git] / LUFA / Common / ButtLoadTag.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2009.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
7 */
8
9 /*
10 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, and distribute this software
13 and its documentation for any purpose and without fee is hereby
14 granted, provided that the above copyright notice appear in all
15 copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29 */
30
31 /** \file
32 *
33 * This file contains macros for the embedding of compile-time strings into the resultant project binary for
34 * identification purposes. It is designed to prefix "tags" with the magic string of "@(#)" so that the tags
35 * can easily be identified in the binary data.
36 *
37 * These tags are compatible with the ButtLoad project at http://www.fourwalledcubicle.com/ButtLoad.php .
38 */
39
40 #ifndef __BUTTLOADTAG_H__
41 #define __BUTTLOADTAG_H__
42
43 /* Includes: */
44 #include <avr/io.h>
45 #include <avr/pgmspace.h>
46
47 /* Public Interface - May be used in end-application: */
48 /* Macros: */
49 /** Creates a new tag in the resultant binary, containing the specified data array. The macro id
50 * parameter is only for identification purposes (so that the tag data can be referenced in code)
51 * and is not visible in the compiled binary.
52 */
53 #define BUTTLOADTAG(id, data) const struct ButtLoadTagData BUTTTAG_##id \
54 PROGMEM __attribute__((used, externally_visible)) = \
55 {MagicString: BT_TAGHEADER, TagData: data}
56
57 /** Macro for retrieving a reference to the specified tag's contents. The tag data is located in
58 * the program memory (FLASH) space, and so must be read out with the macros in avr-libc which
59 * deal with embedded data.
60 */
61 #define BUTTLOADTAG_DATA(id) BUTTTAG_##id.TagData
62
63 /* Structures: */
64 /** Structure for ButtLoad compatible binary tags. */
65 struct ButtLoadTagData
66 {
67 char MagicString[4]; /**< Magic tag header, containing the string "@(#)". */
68 char TagData[]; /**< Tag contents as a char array. */
69 };
70
71 /* Private Interface - For use in library only: */
72 #if !defined(__DOXYGEN__)
73 /* Macros: */
74 #define BT_TAGHEADER {'@','(','#',')'}
75 #endif
76
77 #endif