Bare Metal Programming Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
basics.h
1 //***************************************************************************
2 //
3 // file : bmptk/core/basics.h
4 //
5 // LICENSE (MIT expat license, copy of bmptk/license.txt)
6 //
7 // Copyright (c) 2013 Wouter van Ooijen (wouter@voti.nl)
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE..
27 //
28 //***************************************************************************
29 
30 // ==========================================================================
31 //
33 //
36 //
37 // ==========================================================================
38 
39 // ==========================================================================
40 //
42 //
45 //
46 // ==========================================================================
47 namespace bmptk {
48 
50 //
53 namespace hardware {};
54 
56 //
58 namespace chips {};
59 
61 //
63 namespace rtos {};
64 
65 
66 // ==========================================================================
67 //
68 // debug macro's
69 //
70 // ==========================================================================
71 
73 //
77 #define BMPTK_HERE_STR( X ) #X
78 #define BMPTK_HERE2( F, L ) ( "\n" F ":" BMPTK_HERE_STR( L ) " " )
79 #define BMPTK_HERE BMPTK_HERE2( __FILE__, __LINE__ )
80 
81 
83 #define BMPTK_VERSION_STR( X ) BMPTK_HERE_STR( X )
84 
86 const char version[] = BMPTK_VERSION_STR( BMPTK_VERSION );
87 
88 
90 //
111 //#define trace ( std::cout << BMPTK_HERE << " " << std::flush )
112 #define trace ( std::cout << BMPTK_HERE << " " )
113 
114 
116 //
120 enum {
121  type_none, type_pin_ad,
122  type_pin_in, type_pin_out, type_pin_in_out, type_pin_oc,
123  type_port_in, type_port_out, type_port_in_out, type_port_oc,
124  type_i2c_bus,
125  type_spi_bus, type_spi_channel
126 };
127 
128 
130 //
133 enum {
134  has_none = 0x0000,
135  has_ad = 0x0001,
136  has_pullup = 0x0002
137 };
138 
139 
141 enum {
142  Hz = 1,
143  kHz = 1000,
144  MHz = 1000 * 1000,
145  GHz = 1000 * 1000 * 1000
146 };
147 
148 
150 //
161 extern "C" void fatal_error_detected( const char *msg );
162 
164 //
169 void fatal_error_handler( void f( const char * ) );
170 
171 
172 }; // namespace bmptk;