1/*
2 * The internal definitions
3 *
4 * Copyright (C) 2010-2021, Joachim Metz <joachim.metz@gmail.com>
5 *
6 * Refer to AUTHORS for acknowledgements.
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#if !defined( _LIBSMDEV_DEFINITIONS_H )
23#define _LIBSMDEV_DEFINITIONS_H
24
25#include <common.h>
26#include <byte_stream.h>
27
28#define LIBSMDEV_ENDIAN_BIG				_BYTE_STREAM_ENDIAN_BIG
29#define LIBSMDEV_ENDIAN_LITTLE				_BYTE_STREAM_ENDIAN_LITTLE
30
31/* Define HAVE_LOCAL_LIBSMDEV for local use of libsmdev
32 */
33#if !defined( HAVE_LOCAL_LIBSMDEV )
34#include <libsmdev/definitions.h>
35
36#else
37
38#define LIBSMDEV_VERSION				@VERSION@
39
40/* The version string
41 */
42#define LIBSMDEV_VERSION_STRING				"@VERSION@"
43
44/* The access flags definitions
45 * bit 1        set to 1 for read access
46 * bit 2        set to 1 for write access
47 * bit 3        set to 1 to truncate an existing file on write
48 * bit 4-8      not used
49 */
50enum LIBSMDEV_ACCESS_FLAGS
51{
52	LIBSMDEV_ACCESS_FLAG_READ			= 0x01,
53	LIBSMDEV_ACCESS_FLAG_WRITE			= 0x02,
54	LIBSMDEV_ACCESS_FLAG_TRUNCATE			= 0x04
55};
56
57/* The file access macros
58 */
59#define LIBSMDEV_OPEN_READ				( LIBSMDEV_ACCESS_FLAG_READ )
60#define LIBSMDEV_OPEN_WRITE				( LIBSMDEV_ACCESS_FLAG_WRITE )
61#define LIBSMDEV_OPEN_READ_WRITE			( LIBSMDEV_ACCESS_FLAG_READ | LIBSMDEV_ACCESS_FLAG_WRITE )
62#define LIBSMDEV_OPEN_WRITE_TRUNCATE			( LIBSMDEV_ACCESS_FLAG_WRITE | LIBSMDEV_ACCESS_FLAG_TRUNCATE )
63#define LIBSMDEV_OPEN_READ_WRITE_TRUNCATE		( LIBSMDEV_ACCESS_FLAG_READ | LIBSMDEV_ACCESS_FLAG_WRITE | LIBSMDEV_ACCESS_FLAG_TRUNCATE )
64
65/* The error flags definitions
66 */
67enum LIBSMDEV_ERROR_FLAGS
68{
69	LIBSMDEV_ERROR_FLAG_ZERO_ON_ERROR		= 0x01
70};
71
72/* The media type definitions
73 */
74enum LIBSMDEV_MEDIA_TYPES
75{
76	LIBSMDEV_MEDIA_TYPE_REMOVABLE			= 0x00,
77	LIBSMDEV_MEDIA_TYPE_FIXED			= 0x01,
78	LIBSMDEV_MEDIA_TYPE_OPTICAL			= 0x03,
79	LIBSMDEV_MEDIA_TYPE_MEMORY			= 0x10
80};
81
82/* The bus type definitions
83 */
84enum LIBSMDEV_BUS_TYPES
85{
86	LIBSMDEV_BUS_TYPE_UNKNOWN			= 0,
87	LIBSMDEV_BUS_TYPE_ATA				= (uint8_t) 'a',
88	LIBSMDEV_BUS_TYPE_FIREWIRE			= (uint8_t) 'f',
89	LIBSMDEV_BUS_TYPE_SCSI				= (uint8_t) 's',
90	LIBSMDEV_BUS_TYPE_USB				= (uint8_t) 'u'
91};
92
93/* The track types
94 */
95enum LIBSMDEV_TRACK_TYPES
96{
97	LIBSMDEV_TRACK_TYPE_UNKNOWN,
98	LIBSMDEV_TRACK_TYPE_AUDIO,
99	LIBSMDEV_TRACK_TYPE_CDG,
100	LIBSMDEV_TRACK_TYPE_MODE1_2048,
101	LIBSMDEV_TRACK_TYPE_MODE1_2352,
102	LIBSMDEV_TRACK_TYPE_MODE2_2048,
103	LIBSMDEV_TRACK_TYPE_MODE2_2324,
104	LIBSMDEV_TRACK_TYPE_MODE2_2336,
105	LIBSMDEV_TRACK_TYPE_MODE2_2352,
106	LIBSMDEV_TRACK_TYPE_CDI_2336,
107	LIBSMDEV_TRACK_TYPE_CDI_2352,
108};
109
110#endif
111
112/* Platform specific macros
113 */
114#if defined( _MSC_VER )
115#define LIBSMDEV_LARGE_INTEGER_ZERO			{ 0, 0 }
116
117#elif defined( __BORLANDC__ )
118#define LIBSMDEV_LARGE_INTEGER_ZERO			{ 0 }
119
120#elif defined( __CYGWIN__ )
121#define LIBSMDEV_LARGE_INTEGER_ZERO			{ { 0, 0 } }
122
123#elif defined( __MINGW32_VERSION ) || defined( __MINGW64_VERSION_MAJOR )
124#define LIBSMDEV_LARGE_INTEGER_ZERO			{ { 0, 0 } }
125
126#endif
127
128#endif
129
130