Embedded Template Library 1.0
Loading...
Searching...
No Matches
io_port.h
Go to the documentation of this file.
1
2
3/******************************************************************************
4The MIT License(MIT)
5
6Embedded Template Library.
7https://github.com/ETLCPP/etl
8https://www.etlcpp.com
9
10Copyright(c) 2014 John Wellbelove
11
12Permission is hereby granted, free of charge, to any person obtaining a copy
13of this software and associated documentation files(the "Software"), to deal
14in the Software without restriction, including without limitation the rights
15to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
16copies of the Software, and to permit persons to whom the Software is
17furnished to do so, subject to the following conditions :
18
19The above copyright notice and this permission notice shall be included in all
20copies or substantial portions of the Software.
21
22THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
25AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28SOFTWARE.
29******************************************************************************/
30
31#ifndef ETL_IO_PORT_INCLUDED
32#define ETL_IO_PORT_INCLUDED
33
37
38#include "platform.h"
39#include "iterator.h"
40#include "nullptr.h"
41#include "static_assert.h"
42#include "utility.h"
43
44#include <stdint.h>
45
47
48namespace etl
49{
50 template <typename, uintptr_t>
51 class io_port_rw;
52
53 namespace private_io_port
54 {
55 //***************************************************************************
57 //***************************************************************************
58 template <typename TIO_Port>
59 class iterator : public etl::iterator<ETL_OR_STD::forward_iterator_tag, typename TIO_Port::value_type>
60 {
61 public:
62
63 //********************************
65 //********************************
66 friend TIO_Port;
67
68 //********************************
70 //********************************
71 template <typename U>
72 friend class const_iterator;
73
74 //********************************
76 //********************************
78 typedef typename TIO_Port::value_type value_type;
79
80 //********************************
82 //********************************
83 iterator()
84 : p_iop(ETL_NULLPTR)
85 {
86 }
87
88 //********************************
90 //********************************
91 iterator(const iterator& other)
92 : p_iop(other.p_iop)
93 {
94 }
95
96 //********************************
98 //********************************
99 iterator& operator=(const iterator& other)
100 {
101 p_iop = other.p_iop;
102 return *this;
103 }
104
105 //********************************
107 //********************************
108 io_port_type& operator*()
109 {
110 return *p_iop;
111 }
112
113 //********************************
115 //********************************
116 const io_port_type& operator*() const
117 {
118 return *p_iop;
119 }
120
121 //********************************
123 //********************************
124 iterator& operator++()
125 {
126 return *this;
127 }
128
129 //********************************
131 //********************************
132 iterator operator++(int)
133 {
134 return *this;
135 }
136
137 private:
138
139 //********************************
141 //********************************
143 : p_iop(&iop)
144 {
145 }
146
147 io_port_type* p_iop;
148 };
149
150 //***************************************************************************
152 //***************************************************************************
153 template <typename TIO_Port>
154 class const_iterator : public etl::iterator<ETL_OR_STD::forward_iterator_tag, const typename TIO_Port::value_type>
155 {
156 private:
157
158 typedef etl::private_io_port::iterator<TIO_Port> iterator_type;
159
160 public:
161
162 //********************************
164 //********************************
165 friend TIO_Port;
166
167 //********************************
169 //********************************
171 typedef const typename TIO_Port::value_type value_type;
172
173 //********************************
175 //********************************
176 const_iterator()
177 : p_iop(ETL_NULLPTR)
178 {
179 }
180
181 //********************************
183 //********************************
184 const_iterator(const iterator_type& other)
185 : p_iop(other.p_iop)
186 {
187 }
188
189 //********************************
191 //********************************
192 const_iterator(const const_iterator& other)
193 : p_iop(other.p_iop)
194 {
195 }
196
197 //********************************
199 //********************************
200 const_iterator& operator=(const iterator_type& other)
201 {
202 p_iop = other.p_iop;
203 return *this;
204 }
205
206 //********************************
208 //********************************
209 const_iterator& operator=(const const_iterator& other)
210 {
211 p_iop = other.p_iop;
212 return *this;
213 }
214
215 //********************************
217 //********************************
218 const io_port_type& operator*() const
219 {
220 return *p_iop;
221 }
222
223 //********************************
225 //********************************
226 const_iterator& operator++()
227 {
228 return *this;
229 }
230
231 //********************************
233 //********************************
234 const_iterator operator++(int)
235 {
236 return *this;
237 }
238
239 private:
240
241 //********************************
243 //********************************
244 const_iterator(const io_port_type& iop)
245 : p_iop(&iop)
246 {
247 }
248
249 const io_port_type* p_iop;
250 };
251 } // namespace private_io_port
252
253 //***************************************************************************
255 //***************************************************************************
256 template <typename T, uintptr_t Address = 0>
258 {
259 public:
260
261 ETL_STATIC_ASSERT(etl::is_integral<T>::value, "Not an integral type");
262
263 typedef T value_type;
264 typedef volatile T* pointer;
265 typedef volatile const T* const_pointer;
266 typedef volatile T& reference;
267 typedef volatile const T& const_reference;
268
271
272 //**********************************
274 //**********************************
275 iterator iter()
276 {
277 return iterator(*this);
278 }
279
280 //**********************************
282 //**********************************
283 const_iterator iter() const
284 {
285 return const_iterator(*this);
286 }
287
288 //**********************************
290 //**********************************
291 const_iterator citer() const
292 {
293 return const_iterator(*this);
294 }
295
296 //**********************************
298 //**********************************
299 operator value_type() const
300 {
301 return *reinterpret_cast<const_pointer>(Address);
302 }
303
304 //**********************************
306 //**********************************
307 value_type read() const
308 {
309 return *reinterpret_cast<const_pointer>(Address);
310 }
311
312 //**********************************
314 //**********************************
315 void write(value_type value_)
316 {
317 *reinterpret_cast<pointer>(Address) = value_;
318 }
319
320 //**********************************
322 //**********************************
323 io_port_rw& operator=(value_type value_)
324 {
325 *reinterpret_cast<pointer>(Address) = value_;
326 return *this;
327 }
328
329 //**********************************
331 //**********************************
332 io_port_rw& operator|=(value_type value)
333 {
334 pointer address = reinterpret_cast<pointer>(Address);
335 value_type temp = *address;
336 temp |= value;
337 *address = temp;
338
339 return *this;
340 }
341
342 //**********************************
344 //**********************************
345 io_port_rw& operator&=(value_type value)
346 {
347 pointer address = reinterpret_cast<pointer>(Address);
348 value_type temp = *address;
349 temp &= value;
350 *address = temp;
351
352 return *this;
353 }
354
355 //**********************************
357 //**********************************
358 io_port_rw& operator^=(value_type value)
359 {
360 pointer address = reinterpret_cast<pointer>(Address);
361 value_type temp = *address;
362 temp ^= value;
363 *address = temp;
364
365 return *this;
366 }
367
368 //**********************************
370 //**********************************
372 {
373 pointer address = reinterpret_cast<pointer>(Address);
374 value_type temp = *address;
375 temp <<= shift;
376 *address = temp;
377
378 return *this;
379 }
380
381 //**********************************
383 //**********************************
385 {
386 pointer address = reinterpret_cast<pointer>(Address);
387 value_type temp = *address;
388 temp >>= shift;
389 *address = temp;
390
391 return *this;
392 }
393
394 //**********************************
396 //**********************************
397 value_type operator~() const
398 {
399 return ~(*reinterpret_cast<pointer>(Address));
400 }
401
402 //**********************************
404 //**********************************
405 pointer get_address()
406 {
407 return reinterpret_cast<pointer>(Address);
408 }
409
410 //**********************************
412 //**********************************
413 const_pointer get_address() const
414 {
415 return reinterpret_cast<const_pointer>(Address);
416 }
417
418 private:
419
422 };
423
424 //***************************************************************************
426 //***************************************************************************
427 template <typename T, uintptr_t Address = 0>
429 {
430 public:
431
432 ETL_STATIC_ASSERT(etl::is_integral<T>::value, "Not an integral type");
433
434 typedef T value_type;
435 typedef volatile T* pointer;
436 typedef volatile const T* const_pointer;
437 typedef volatile T& reference;
438 typedef volatile const T& const_reference;
439
441
442 //**********************************
444 //**********************************
445 const_iterator iter() const
446 {
447 return const_iterator(*this);
448 }
449
450 //**********************************
452 //**********************************
453 const_iterator citer() const
454 {
455 return const_iterator(*this);
456 }
457
458 //**********************************
460 //**********************************
461 operator value_type() const
462 {
463 return *reinterpret_cast<const_pointer>(Address);
464 }
465
466 //**********************************
468 //**********************************
469 value_type read() const
470 {
471 return *reinterpret_cast<const_pointer>(Address);
472 }
473
474 //**********************************
476 //**********************************
477 pointer get_address()
478 {
479 return reinterpret_cast<pointer>(Address);
480 }
481
482 //**********************************
484 //**********************************
485 const_pointer get_address() const
486 {
487 return reinterpret_cast<const_pointer>(Address);
488 }
489
490 private:
491
493 void operator=(value_type value) ETL_DELETE;
494
496 io_port_ro& operator=(const io_port_ro&) ETL_DELETE;
497 };
498
499 //***************************************************************************
501 //***************************************************************************
502 template <typename T, uintptr_t Address = 0>
504 {
505 public:
506
507 ETL_STATIC_ASSERT(etl::is_integral<T>::value, "Not an integral type");
508
509 typedef T value_type;
510 typedef volatile T* pointer;
511 typedef volatile const T* const_pointer;
512 typedef volatile T& reference;
513 typedef volatile const T& const_reference;
514
516
517 //**********************************
519 //**********************************
520 iterator iter()
521 {
522 return iterator(*this);
523 }
524
525 //**********************************
527 //**********************************
528 void operator=(value_type value)
529 {
530 *reinterpret_cast<pointer>(Address) = value;
531 }
532
533 //**********************************
535 //**********************************
536 void write(value_type value_)
537 {
538 *reinterpret_cast<pointer>(Address) = value_;
539 }
540
541 //**********************************
543 //**********************************
544 pointer get_address()
545 {
546 return reinterpret_cast<pointer>(Address);
547 }
548
549 //**********************************
551 //**********************************
552 const_pointer get_address() const
553 {
554 return reinterpret_cast<const_pointer>(Address);
555 }
556
557 private:
558
560 operator value_type() const ETL_DELETE;
561
563 io_port_wo& operator=(const io_port_wo&) ETL_DELETE;
564 };
565
566 //***************************************************************************
568 //***************************************************************************
569 template <typename T, uintptr_t Address = 0>
571 {
572 public:
573
574 ETL_STATIC_ASSERT(etl::is_integral<T>::value, "Not an integral type");
575
576 typedef T value_type;
577 typedef volatile T* pointer;
578 typedef volatile const T* const_pointer;
579 typedef volatile T& reference;
580 typedef volatile const T& const_reference;
581
584
585 //**********************************
587 //**********************************
589 : shadow_value(value_type())
590 {
591 }
592
593 //**********************************
595 //**********************************
596 iterator iter()
597 {
598 return iterator(*this);
599 }
600
601 //**********************************
603 //**********************************
604 const_iterator iter() const
605 {
606 return const_iterator(*this);
607 }
608
609 //**********************************
611 //**********************************
612 const_iterator citer() const
613 {
614 return const_iterator(*this);
615 }
616
617 //**********************************
619 //**********************************
620 operator value_type() const
621 {
622 return shadow_value;
623 }
624
625 //**********************************
627 //**********************************
628 value_type read() const
629 {
630 return shadow_value;
631 }
632
633 //**********************************
635 //**********************************
636 void write(value_type value_)
637 {
638 shadow_value = value_;
639 *reinterpret_cast<pointer>(Address) = shadow_value;
640 }
641
642 //**********************************
644 //**********************************
645 io_port_wos& operator=(value_type value_)
646 {
647 shadow_value = value_;
648 *reinterpret_cast<pointer>(Address) = shadow_value;
649 return *this;
650 }
651
652 //**********************************
654 //**********************************
655 io_port_wos& operator|=(value_type value)
656 {
657 shadow_value |= value;
658 *reinterpret_cast<pointer>(Address) = shadow_value;
659
660 return *this;
661 }
662
663 //**********************************
665 //**********************************
666 io_port_wos& operator&=(value_type value)
667 {
668 shadow_value &= value;
669 *reinterpret_cast<pointer>(Address) = shadow_value;
670
671 return *this;
672 }
673
674 //**********************************
676 //**********************************
677 io_port_wos& operator^=(value_type value)
678 {
679 shadow_value ^= value;
680 *reinterpret_cast<pointer>(Address) = shadow_value;
681
682 return *this;
683 }
684
685 //**********************************
687 //**********************************
689 {
690 shadow_value <<= shift;
691 *reinterpret_cast<pointer>(Address) = shadow_value;
692
693 return *this;
694 }
695
696 //**********************************
698 //**********************************
700 {
701 shadow_value >>= shift;
702 *reinterpret_cast<pointer>(Address) = shadow_value;
703
704 return *this;
705 }
706
707 //**********************************
709 //**********************************
710 value_type operator~() const
711 {
712 return ~shadow_value;
713 }
714
715 //**********************************
717 //**********************************
718 pointer get_address()
719 {
720 return reinterpret_cast<pointer>(Address);
721 }
722
723 private:
724
727
728 value_type shadow_value;
729 };
730
731 //***************************************************************************
734 //***************************************************************************
735 template <typename T>
736 class io_port_rw<T, 0>
737 {
738 public:
739
740 ETL_STATIC_ASSERT(etl::is_integral<T>::value, "Not an integral type");
741
742 typedef T value_type;
743 typedef volatile T* pointer;
744 typedef volatile const T* const_pointer;
745 typedef volatile T& reference;
746 typedef volatile const T& const_reference;
747
750
751 //**********************************
753 //**********************************
755 : address(ETL_NULLPTR)
756 {
757 }
758
759 //**********************************
761 //**********************************
762 io_port_rw(void* address_)
763 : address(reinterpret_cast<pointer>(address_))
764 {
765 }
766
767 //**********************************
769 //**********************************
770 io_port_rw(const io_port_rw& other_)
771 : address(reinterpret_cast<pointer>(other_.address))
772 {
773 }
774
775 //**********************************
777 //**********************************
779 {
780 address = other_.address;
781 return *this;
782 }
783
784 //**********************************
786 //**********************************
787 iterator iter()
788 {
789 return iterator(*this);
790 }
791
792 //**********************************
794 //**********************************
795 const_iterator iter() const
796 {
797 return const_iterator(*this);
798 }
799
800 //**********************************
802 //**********************************
803 const_iterator citer() const
804 {
805 return const_iterator(*this);
806 }
807
808 //**********************************
810 //**********************************
811 io_port_rw& operator|=(value_type value)
812 {
813 value_type temp = *address;
814 temp |= value;
815 *address = temp;
816
817 return *this;
818 }
819
820 //**********************************
822 //**********************************
823 io_port_rw& operator&=(value_type value)
824 {
825 value_type temp = *address;
826 temp &= value;
827 *address = temp;
828
829 return *this;
830 }
831
832 //**********************************
834 //**********************************
835 io_port_rw& operator^=(value_type value)
836 {
837 value_type temp = *address;
838 temp ^= value;
839 *address = temp;
840
841 return *this;
842 }
843
844 //**********************************
846 //**********************************
848 {
849 value_type temp = *address;
850 temp <<= shift;
851 *address = temp;
852
853 return *this;
854 }
855
856 //**********************************
858 //**********************************
860 {
861 value_type temp = *address;
862 temp >>= shift;
863 *address = temp;
864
865 return *this;
866 }
867
868 //**********************************
870 //**********************************
871 value_type operator~() const
872 {
873 return ~(*address);
874 }
875
876 //**********************************
878 //**********************************
879 void set_address(void* address_)
880 {
881 address = reinterpret_cast<pointer>(address_);
882 }
883
884 //**********************************
886 //**********************************
887 pointer get_address()
888 {
889 return address;
890 }
891
892 //**********************************
894 //**********************************
895 const_pointer get_address() const
896 {
897 return address;
898 }
899
900 //**********************************
902 //**********************************
903 operator value_type() const
904 {
905 return *address;
906 }
907
908 //**********************************
910 //**********************************
911 value_type read() const
912 {
913 return *address;
914 }
915
916 //**********************************
918 //**********************************
919 void write(value_type value_)
920 {
921 *address = value_;
922 }
923
924 //**********************************
926 //**********************************
927 io_port_rw& operator=(value_type value_)
928 {
929 *address = value_;
930 return *this;
931 }
932
933 private:
934
935 pointer address;
936 };
937
938 //***************************************************************************
941 //***************************************************************************
942 template <typename T>
943 class io_port_ro<T, 0>
944 {
945 public:
946
947 ETL_STATIC_ASSERT(etl::is_integral<T>::value, "Not an integral type");
948
949 typedef T value_type;
950 typedef volatile T* pointer;
951 typedef volatile const T* const_pointer;
952 typedef volatile T& reference;
953 typedef volatile const T& const_reference;
954
956
957 //**********************************
959 //**********************************
961 : address(ETL_NULLPTR)
962 {
963 }
964
965 //**********************************
967 //**********************************
968 io_port_ro(void* address_)
969 : address(reinterpret_cast<pointer>(address_))
970 {
971 }
972
973 //**********************************
975 //**********************************
976 io_port_ro(const io_port_ro& other_)
977 : address(reinterpret_cast<pointer>(other_.address))
978 {
979 }
980
981 //**********************************
983 //**********************************
985 {
986 address = other_.address;
987 return *this;
988 }
989
990 //**********************************
992 //**********************************
993 const_iterator iter() const
994 {
995 return const_iterator(*this);
996 }
997
998 //**********************************
1000 //**********************************
1001 const_iterator citer() const
1002 {
1003 return const_iterator(*this);
1004 }
1005
1006 //**********************************
1008 //**********************************
1009 void set_address(void* address_)
1010 {
1011 address = reinterpret_cast<pointer>(address_);
1012 }
1013
1014 //**********************************
1016 //**********************************
1017 const_pointer get_address() const
1018 {
1019 return address;
1020 }
1021
1022 //**********************************
1024 //**********************************
1025 operator value_type() const
1026 {
1027 return *address;
1028 }
1029
1030 //**********************************
1032 //**********************************
1033 value_type read() const
1034 {
1035 return *address;
1036 }
1037
1038 private:
1039
1041 void operator=(value_type value) ETL_DELETE;
1042
1043 pointer address;
1044 };
1045
1046 //***************************************************************************
1049 //***************************************************************************
1050 template <typename T>
1051 class io_port_wo<T, 0>
1052 {
1053 public:
1054
1055 ETL_STATIC_ASSERT(etl::is_integral<T>::value, "Not an integral type");
1056
1057 typedef T value_type;
1058 typedef volatile T* pointer;
1059 typedef volatile const T* const_pointer;
1060 typedef volatile T& reference;
1061 typedef volatile const T& const_reference;
1062
1064
1065 //**********************************
1067 //**********************************
1069 : address(ETL_NULLPTR)
1070 {
1071 }
1072
1073 //**********************************
1075 //**********************************
1076 io_port_wo(void* address_)
1077 : address(reinterpret_cast<pointer>(address_))
1078 {
1079 }
1080
1081 //**********************************
1083 //**********************************
1084 io_port_wo(const io_port_wo& other_)
1085 : address(reinterpret_cast<pointer>(other_.address))
1086 {
1087 }
1088
1089 //**********************************
1091 //**********************************
1093 {
1094 address = other_.address;
1095 return *this;
1096 }
1097
1098 //**********************************
1100 //**********************************
1101 iterator iter()
1102 {
1103 return iterator(*this);
1104 }
1105
1106 //**********************************
1108 //**********************************
1109 void set_address(void* address_)
1110 {
1111 address = reinterpret_cast<pointer>(address_);
1112 }
1113
1114 //**********************************
1116 //**********************************
1117 pointer get_address()
1118 {
1119 return address;
1120 }
1121
1122 //**********************************
1124 //**********************************
1125 const_pointer get_address() const
1126 {
1127 return address;
1128 }
1129
1130 //**********************************
1132 //**********************************
1133 void write(value_type value_)
1134 {
1135 *address = value_;
1136 }
1137
1138 //**********************************
1140 //**********************************
1141 void operator=(value_type value)
1142 {
1143 *address = value;
1144 }
1145
1146 private:
1147
1149 operator value_type() const ETL_DELETE;
1150
1151 pointer address;
1152 };
1153
1154 //***************************************************************************
1157 //***************************************************************************
1158 template <typename T>
1159 class io_port_wos<T, 0>
1160 {
1161 public:
1162
1163 ETL_STATIC_ASSERT(etl::is_integral<T>::value, "Not an integral type");
1164
1165 typedef T value_type;
1166 typedef volatile T* pointer;
1167 typedef volatile const T* const_pointer;
1168 typedef volatile T& reference;
1169 typedef volatile const T& const_reference;
1170
1173
1174 //**********************************
1176 //**********************************
1178 : shadow_value(T())
1179 , address(ETL_NULLPTR)
1180 {
1181 }
1182
1183 //**********************************
1185 //**********************************
1186 io_port_wos(void* address_)
1187 : shadow_value(T())
1188 , address(reinterpret_cast<pointer>(address_))
1189 {
1190 }
1191
1192 //**********************************
1194 //**********************************
1196 : shadow_value(other_.shadow_value)
1197 , address(reinterpret_cast<pointer>(other_.address))
1198 {
1199 }
1200
1201 //**********************************
1203 //**********************************
1205 {
1206 shadow_value = other_.shadow_value;
1207 address = other_.address;
1208 return *this;
1209 }
1210
1211 //**********************************
1213 //**********************************
1214 iterator iter()
1215 {
1216 return iterator(*this);
1217 }
1218
1219 //**********************************
1221 //**********************************
1222 const_iterator iter() const
1223 {
1224 return const_iterator(*this);
1225 }
1226
1227 //**********************************
1229 //**********************************
1230 const_iterator citer() const
1231 {
1232 return const_iterator(*this);
1233 }
1234
1235 //**********************************
1237 //**********************************
1238 io_port_wos& operator|=(value_type value)
1239 {
1240 shadow_value |= value;
1241 *address = shadow_value;
1242
1243 return *this;
1244 }
1245
1246 //**********************************
1248 //**********************************
1249 io_port_wos& operator&=(value_type value)
1250 {
1251 shadow_value &= value;
1252 *address = shadow_value;
1253
1254 return *this;
1255 }
1256
1257 //**********************************
1259 //**********************************
1260 io_port_wos& operator^=(value_type value)
1261 {
1262 shadow_value ^= value;
1263 *address = shadow_value;
1264
1265 return *this;
1266 }
1267
1268 //**********************************
1270 //**********************************
1272 {
1273 shadow_value <<= shift;
1274 *address = shadow_value;
1275
1276 return *this;
1277 }
1278
1279 //**********************************
1281 //**********************************
1283 {
1284 shadow_value >>= shift;
1285 *address = shadow_value;
1286
1287 return *this;
1288 }
1289
1290 //**********************************
1292 //**********************************
1293 value_type operator~() const
1294 {
1295 return ~shadow_value;
1296 }
1297
1298 //**********************************
1300 //**********************************
1301 void set_address(void* address_)
1302 {
1303 address = reinterpret_cast<pointer>(address_);
1304 }
1305
1306 //**********************************
1308 //**********************************
1309 pointer get_address()
1310 {
1311 return address;
1312 }
1313
1314 //**********************************
1316 //**********************************
1317 const_pointer get_address() const
1318 {
1319 return address;
1320 }
1321
1322 //**********************************
1324 //**********************************
1325 operator value_type() const
1326 {
1327 return shadow_value;
1328 }
1329
1330 //**********************************
1332 //**********************************
1333 value_type read() const
1334 {
1335 return shadow_value;
1336 }
1337
1338 //**********************************
1340 //**********************************
1341 void write(value_type value_)
1342 {
1343 shadow_value = value_;
1344 *address = shadow_value;
1345 }
1346
1347 //**********************************
1349 //**********************************
1350 io_port_wos& operator=(value_type value_)
1351 {
1352 shadow_value = value_;
1353 *address = shadow_value;
1354 return *this;
1355 }
1356
1357 //**********************************
1359 //**********************************
1361 {
1362 return *this;
1363 }
1364
1365 //**********************************
1367 //**********************************
1368 const_reference operator*() const
1369 {
1370 return shadow_value;
1371 }
1372
1373 private:
1374
1375 value_type shadow_value;
1376 pointer address;
1377 };
1378} // namespace etl
1379
1380#include "private/diagnostic_pop.h"
1381
1382#endif
void set_address(void *address_)
Set the IO port address.
Definition io_port.h:1009
const_pointer get_address() const
Get the IO port address.
Definition io_port.h:1017
value_type read() const
Read.
Definition io_port.h:1033
io_port_ro & operator=(const io_port_ro &other_)
Assignment.
Definition io_port.h:984
const_iterator citer() const
Get a const_iterator to this port.
Definition io_port.h:1001
io_port_ro(void *address_)
Constructor.
Definition io_port.h:968
io_port_ro()
Default constructor.
Definition io_port.h:960
const_iterator iter() const
Get a const_iterator to this port.
Definition io_port.h:993
io_port_ro(const io_port_ro &other_)
Copy Constructor.
Definition io_port.h:976
Read only port.
Definition io_port.h:429
value_type read() const
Read.
Definition io_port.h:469
const_iterator citer() const
Get a const_iterator to this port.
Definition io_port.h:453
const_pointer get_address() const
Get the IO port address.
Definition io_port.h:485
const_iterator iter() const
Get a const_iterator to this port.
Definition io_port.h:445
pointer get_address()
Get the IO port address.
Definition io_port.h:477
io_port_rw & operator>>=(int shift)
Right-Shift-Equals operator.
Definition io_port.h:859
value_type read() const
Read.
Definition io_port.h:911
const_iterator citer() const
Get a const_iterator to this port.
Definition io_port.h:803
const_pointer get_address() const
Get the IO port address.
Definition io_port.h:895
io_port_rw & operator&=(value_type value)
And-Equals operator.
Definition io_port.h:823
pointer get_address()
Get the IO port address.
Definition io_port.h:887
io_port_rw & operator=(const io_port_rw &other_)
Assignment.
Definition io_port.h:778
io_port_rw & operator<<=(int shift)
Left-Shift-Equals operator.
Definition io_port.h:847
const_iterator iter() const
Get a const_iterator to this port.
Definition io_port.h:795
io_port_rw(const io_port_rw &other_)
Copy Constructor.
Definition io_port.h:770
void write(value_type value_)
Write.
Definition io_port.h:919
void set_address(void *address_)
Set the IO port address.
Definition io_port.h:879
iterator iter()
Get an iterator to this port.
Definition io_port.h:787
value_type operator~() const
Not operator.
Definition io_port.h:871
io_port_rw & operator|=(value_type value)
Or-Equals operator.
Definition io_port.h:811
io_port_rw & operator=(value_type value_)
Write.
Definition io_port.h:927
io_port_rw & operator^=(value_type value)
Exclusive-Or-Equals operator.
Definition io_port.h:835
io_port_rw(void *address_)
Constructor.
Definition io_port.h:762
io_port_rw()
Default constructor.
Definition io_port.h:754
Read write port.
Definition io_port.h:258
io_port_rw & operator&=(value_type value)
And-Equals operator.
Definition io_port.h:345
io_port_rw & operator>>=(int shift)
Right-Shift-Equals operator.
Definition io_port.h:384
io_port_rw & operator=(value_type value_)
Write.
Definition io_port.h:323
pointer get_address()
Get the IO port address.
Definition io_port.h:405
io_port_rw & operator^=(value_type value)
Exclusive-Or-Equals operator.
Definition io_port.h:358
value_type operator~() const
Not operator.
Definition io_port.h:397
const_pointer get_address() const
Get the IO port address.
Definition io_port.h:413
io_port_rw & operator<<=(int shift)
Left-Shift-Equals operator.
Definition io_port.h:371
void write(value_type value_)
Write.
Definition io_port.h:315
value_type read() const
Read.
Definition io_port.h:307
io_port_rw & operator|=(value_type value)
Or-Equals operator.
Definition io_port.h:332
iterator iter()
Get an iterator to this port.
Definition io_port.h:275
const_iterator iter() const
Get a const_iterator to this port.
Definition io_port.h:283
const_iterator citer() const
Get a const_iterator to this port.
Definition io_port.h:291
io_port_wo(const io_port_wo &other_)
Copy Constructor.
Definition io_port.h:1084
void set_address(void *address_)
Set the IO port address.
Definition io_port.h:1109
io_port_wo & operator=(const io_port_wo &other_)
Assignment.
Definition io_port.h:1092
pointer get_address()
Get the IO port address.
Definition io_port.h:1117
iterator iter()
Get an iterator to this port.
Definition io_port.h:1101
void operator=(value_type value)
Write.
Definition io_port.h:1141
io_port_wo(void *address_)
Constructor.
Definition io_port.h:1076
void write(value_type value_)
Write.
Definition io_port.h:1133
const_pointer get_address() const
Get the IO port address.
Definition io_port.h:1125
io_port_wo()
Default constructor.
Definition io_port.h:1068
Write only port.
Definition io_port.h:504
const_pointer get_address() const
Get the IO port address.
Definition io_port.h:552
iterator iter()
Get an iterator to this port.
Definition io_port.h:520
void operator=(value_type value)
Write.
Definition io_port.h:528
pointer get_address()
Get the IO port address.
Definition io_port.h:544
void write(value_type value_)
Write.
Definition io_port.h:536
io_port_wos & operator=(const io_port_wos &other_)
Assignment.
Definition io_port.h:1204
const_pointer get_address() const
Get the IO port address.
Definition io_port.h:1317
void write(value_type value_)
Write.
Definition io_port.h:1341
value_type operator~() const
Not operator.
Definition io_port.h:1293
pointer get_address()
Get the IO port address.
Definition io_port.h:1309
io_port_wos & operator^=(value_type value)
Exclusive-Or-Equals operator.
Definition io_port.h:1260
void set_address(void *address_)
Set the IO port address.
Definition io_port.h:1301
io_port_wos & operator&=(value_type value)
And-Equals operator.
Definition io_port.h:1249
io_port_wos & operator*()
Read / Write.
Definition io_port.h:1360
io_port_wos & operator=(value_type value_)
Write.
Definition io_port.h:1350
iterator iter()
Get an iterator to this port.
Definition io_port.h:1214
const_reference operator*() const
Read.
Definition io_port.h:1368
io_port_wos & operator<<=(int shift)
Left-Shift-Equals operator.
Definition io_port.h:1271
io_port_wos(void *address_)
Constructor.
Definition io_port.h:1186
io_port_wos()
Default constructor.
Definition io_port.h:1177
value_type read() const
Read.
Definition io_port.h:1333
const_iterator citer() const
Get a const_iterator to this port.
Definition io_port.h:1230
const_iterator iter() const
Get a const_iterator to this port.
Definition io_port.h:1222
io_port_wos(const io_port_wos &other_)
Copy Constructor.
Definition io_port.h:1195
io_port_wos & operator>>=(int shift)
Right-Shift-Equals operator.
Definition io_port.h:1282
io_port_wos & operator|=(value_type value)
Or-Equals operator.
Definition io_port.h:1238
Write only port with shadow register.
Definition io_port.h:571
const_iterator iter() const
Get a const_iterator to this port.
Definition io_port.h:604
io_port_wos & operator>>=(int shift)
Right-Shift-Equals operator.
Definition io_port.h:699
pointer get_address()
Get the IO port address.
Definition io_port.h:718
iterator iter()
Get an iterator to this port.
Definition io_port.h:596
io_port_wos & operator<<=(int shift)
Left-Shift-Equals operator.
Definition io_port.h:688
void write(value_type value_)
Write.
Definition io_port.h:636
io_port_wos & operator=(value_type value_)
Write.
Definition io_port.h:645
value_type operator~() const
Not operator.
Definition io_port.h:710
const_iterator citer() const
Get a const_iterator to this port.
Definition io_port.h:612
io_port_wos()
Default constructor.
Definition io_port.h:588
io_port_wos & operator^=(value_type value)
Exclusive-Or-Equals operator.
Definition io_port.h:677
io_port_wos & operator&=(value_type value)
And-Equals operator.
Definition io_port.h:666
io_port_wos & operator|=(value_type value)
Or-Equals operator.
Definition io_port.h:655
value_type read() const
Read.
Definition io_port.h:628
Common io_port const_iterator implementation.
Definition io_port.h:155
const_iterator operator++(int)
Post-increment operator.
Definition io_port.h:234
TIO_Port io_port_type
Types.
Definition io_port.h:170
const_iterator & operator++()
Pre-increment operator.
Definition io_port.h:226
Common io_port iterator implementation.
Definition io_port.h:60
TIO_Port io_port_type
Types.
Definition io_port.h:77
iterator operator++(int)
Post-increment operator.
Definition io_port.h:132
iterator & operator++()
Pre-increment operator.
Definition io_port.h:124
friend class const_iterator
Definition io_port.h:72
Definition absolute.h:40
iterator
Definition iterator.h:482