BSP430  20141115
Board Support Package for MSP430 microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
timer.h
Go to the documentation of this file.
1 /* Copyright 2012-2014, Peter A. Bigot
2  *
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * * Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * * Neither the name of the software nor the names of its contributors may be
16  * used to endorse or promote products derived from this software without
17  * specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
280 #ifndef BSP430_PERIPH_TIMER_H
281 #define BSP430_PERIPH_TIMER_H
282 
283 /* !BSP430! periph=timer */
284 /* !BSP430! instance=@timers */
285 
286 #include <bsp430/periph.h>
287 #include <bsp430/clock.h>
288 
295 #define BSP430_MODULE_TIMER_A (defined(__MSP430_HAS_TA2__) \
296  || defined(__MSP430_HAS_TA3__) \
297  || defined(__MSP430_HAS_TA5__) \
298  || defined(__MSP430_HAS_T0A3__) \
299  || defined(__MSP430_HAS_T0A5__))
300 
307 #define BSP430_MODULE_TIMER_B (defined(__MSP430_HAS_TB3__) \
308  || defined(__MSP430_HAS_TB7__) \
309  || defined(__MSP430_HAS_T0B3__) \
310  || defined(__MSP430_HAS_T0B7__))
311 
312 
319 #define BSP430_MODULE_TIMER (BSP430_MODULE_TIMER_A || BSP430_MODULE_TIMER_B)
320 
321 /* Surprisingly, not every MCU has a Timer_A. Some have only a Basic
322  * Timer (BT). */
323 #if defined(BSP430_DOXYGEN) || (BSP430_MODULE_TIMER - 0)
324 
359 #ifndef configBSP430_TIMER_CCACLK
360 #define configBSP430_TIMER_CCACLK 0
361 #endif /* configBSP430_TIMER_CCACLK */
362 
382 #if defined(BSP430_DOXYGEN)
383 #define BSP430_TIMER_CCACLK include <bsp430/platform.h>
384 #endif /* BSP430_DOXYGEN */
385 
397 #if defined(BSP430_DOXYGEN)
398 #define BSP430_TIMER_CCACLK_PERIPH_CPPID include "bsp430_config.h"
399 #endif /* BSP430_DOXYGEN */
400 
408 #if defined(BSP430_DOXYGEN)
409 #define BSP430_TIMER_CCACLK_PERIPH_HANDLE derived platform or application specific
410 /* !BSP430! instance=@timers functional=timer_ccaclk subst=functional insert=periph_sethandle */
411 /* BEGIN AUTOMATICALLY GENERATED CODE---DO NOT MODIFY [periph_sethandle] */
412 
413 #elif BSP430_TIMER_CCACLK_PERIPH_CPPID == BSP430_PERIPH_CPPID_TA0
414 #define BSP430_TIMER_CCACLK_PERIPH_HANDLE BSP430_PERIPH_TA0
415 
416 #elif BSP430_TIMER_CCACLK_PERIPH_CPPID == BSP430_PERIPH_CPPID_TA1
417 #define BSP430_TIMER_CCACLK_PERIPH_HANDLE BSP430_PERIPH_TA1
418 
419 #elif BSP430_TIMER_CCACLK_PERIPH_CPPID == BSP430_PERIPH_CPPID_TA2
420 #define BSP430_TIMER_CCACLK_PERIPH_HANDLE BSP430_PERIPH_TA2
421 
422 #elif BSP430_TIMER_CCACLK_PERIPH_CPPID == BSP430_PERIPH_CPPID_TA3
423 #define BSP430_TIMER_CCACLK_PERIPH_HANDLE BSP430_PERIPH_TA3
424 
425 #elif BSP430_TIMER_CCACLK_PERIPH_CPPID == BSP430_PERIPH_CPPID_TB0
426 #define BSP430_TIMER_CCACLK_PERIPH_HANDLE BSP430_PERIPH_TB0
427 
428 #elif BSP430_TIMER_CCACLK_PERIPH_CPPID == BSP430_PERIPH_CPPID_TB1
429 #define BSP430_TIMER_CCACLK_PERIPH_HANDLE BSP430_PERIPH_TB1
430 
431 #elif BSP430_TIMER_CCACLK_PERIPH_CPPID == BSP430_PERIPH_CPPID_TB2
432 #define BSP430_TIMER_CCACLK_PERIPH_HANDLE BSP430_PERIPH_TB2
433 /* END AUTOMATICALLY GENERATED CODE [periph_sethandle] */
434 /* !BSP430! end=periph_sethandle */
435 #endif /* BSP430_TIMER_CCACLK_PERIPH_CPPID */
436 
446 #ifndef configBSP430_TIMER_CCACLK_HAL
447 #define configBSP430_TIMER_CCACLK_HAL indirectly defaulted
448 #endif /* configBSP430_TIMER_CCACLK_HAL */
449 
459 #if defined(BSP430_DOXYGEN)
460 #define configBSP430_TIMER_CCACLK_HAL_ISR indirectly defaulted
461 #endif /* BSP430_DOXYGEN */
462 
472 #if defined(BSP430_DOXYGEN)
473 #define configBSP430_TIMER_CCACLK_HAL_CC0_ISR indirectly defaulted
474 #endif /* BSP430_DOXYGEN */
475 
496 #ifndef configBSP430_TIMER_CCACLK_CLK_PORT
497 #define configBSP430_TIMER_CCACLK_CLK_PORT indirectly defaulted
498 #endif /* configBSP430_TIMER_CCACLK_CLK_PORT */
499 
511 #ifndef configBSP430_TIMER_CCACLK_CLK_PORT_HAL
512 #define configBSP430_TIMER_CCACLK_CLK_PORT_HAL indirectly defaulted 0
513 #endif /* configBSP430_TIMER_CCACLK_CLK_PORT_HAL */
514 
535 #ifndef configBSP430_TIMER_CCACLK_CC0_PORT
536 #define configBSP430_TIMER_CCACLK_CC0_PORT indirectly defaulted
537 #endif /* configBSP430_TIMER_CCACLK_CC0_PORT */
538 
550 #ifndef configBSP430_TIMER_CCACLK_CC0_PORT_HAL
551 #define configBSP430_TIMER_CCACLK_CC0_PORT_HAL indirectly defaulted 0
552 #endif /* configBSP430_TIMER_CCACLK_CC0_PORT_HAL */
553 
574 #ifndef configBSP430_TIMER_CCACLK_CC1_PORT
575 #define configBSP430_TIMER_CCACLK_CC1_PORT indirectly defaulted
576 #endif /* configBSP430_TIMER_CCACLK_CC1_PORT */
577 
589 #ifndef configBSP430_TIMER_CCACLK_CC1_PORT_HAL
590 #define configBSP430_TIMER_CCACLK_CC1_PORT_HAL indirectly defaulted 0
591 #endif /* configBSP430_TIMER_CCACLK_CC1_PORT_HAL */
592 
603 #if defined(BSP430_DOXYGEN)
604 #define BSP430_TIMER_CCACLK_ACLK_CCIDX include <bsp430/platform.h>
605 #endif /* BSP430_DOXYGEN */
606 
615 #if defined(BSP430_DOXYGEN)
616 #define BSP430_TIMER_CCACLK_ACLK_CCIS include <bsp430/platform.h>
617 #endif /* BSP430_DOXYGEN */
618 
628 #if defined(BSP430_DOXYGEN)
629 #define BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_CPPID platform or application specific
630 #endif /* BSP430_DOXYGEN */
631 
637 #if defined(BSP430_DOXYGEN)
638 #define BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_HANDLE derived platform or application specific
639 /* !BSP430! instance=@ports functional=timer_ccaclk_clk_port subst=functional insert=periph_sethandle */
640 /* BEGIN AUTOMATICALLY GENERATED CODE---DO NOT MODIFY [periph_sethandle] */
641 
642 #elif BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT1
643 #define BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT1
644 
645 #elif BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT2
646 #define BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT2
647 
648 #elif BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT3
649 #define BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT3
650 
651 #elif BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT4
652 #define BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT4
653 
654 #elif BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT5
655 #define BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT5
656 
657 #elif BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT6
658 #define BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT6
659 
660 #elif BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT7
661 #define BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT7
662 
663 #elif BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT8
664 #define BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT8
665 
666 #elif BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT9
667 #define BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT9
668 
669 #elif BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT10
670 #define BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT10
671 
672 #elif BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT11
673 #define BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT11
674 /* END AUTOMATICALLY GENERATED CODE [periph_sethandle] */
675 /* !BSP430! end=periph_sethandle instance=@timers */
676 #endif /* BSP430_TIMER_CCACLK_CLK_PORT_PERIPH_CPPID */
677 
685 #if defined(BSP430_DOXYGEN)
686 #define BSP430_TIMER_CCACLK_CLK_PORT_BIT include <bsp430/platform.h>
687 #endif /* BSP430_DOXYGEN */
688 
699 #if defined(BSP430_DOXYGEN)
700 #define BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_CPPID platform or application specific
701 #endif /* BSP430_DOXYGEN */
702 
707 #if defined(BSP430_DOXYGEN)
708 #define BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_HANDLE derived platform or application specific
709 /* !BSP430! instance=@ports functional=timer_ccaclk_cc0_port subst=functional insert=periph_sethandle */
710 /* BEGIN AUTOMATICALLY GENERATED CODE---DO NOT MODIFY [periph_sethandle] */
711 
712 #elif BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT1
713 #define BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT1
714 
715 #elif BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT2
716 #define BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT2
717 
718 #elif BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT3
719 #define BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT3
720 
721 #elif BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT4
722 #define BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT4
723 
724 #elif BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT5
725 #define BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT5
726 
727 #elif BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT6
728 #define BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT6
729 
730 #elif BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT7
731 #define BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT7
732 
733 #elif BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT8
734 #define BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT8
735 
736 #elif BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT9
737 #define BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT9
738 
739 #elif BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT10
740 #define BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT10
741 
742 #elif BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT11
743 #define BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT11
744 /* END AUTOMATICALLY GENERATED CODE [periph_sethandle] */
745 /* !BSP430! end=periph_sethandle instance=@timers */
746 #endif /* BSP430_TIMER_CCACLK_CC0_PORT_PERIPH_CPPID */
747 
755 #if defined(BSP430_DOXYGEN)
756 #define BSP430_TIMER_CCACLK_CC0_PORT_BIT include <bsp430/platform.h>
757 #endif /* BSP430_DOXYGEN */
758 
767 #ifndef BSP430_TIMER_CCACLK_CC0_CCIS
768 #define BSP430_TIMER_CCACLK_CC0_CCIS CCIS_0
769 #endif /* BSP430_TIMER_CCACLK_CC0_CCIS */
770 
780 #if defined(BSP430_DOXYGEN)
781 #define BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_CPPID platform or application specific
782 #endif /* BSP430_DOXYGEN */
783 
789 #if defined(BSP430_DOXYGEN)
790 #define BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_HANDLE derived platform or application specific
791 /* !BSP430! instance=@ports functional=timer_ccaclk_cc1_port subst=functional insert=periph_sethandle */
792 /* BEGIN AUTOMATICALLY GENERATED CODE---DO NOT MODIFY [periph_sethandle] */
793 
794 #elif BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT1
795 #define BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT1
796 
797 #elif BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT2
798 #define BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT2
799 
800 #elif BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT3
801 #define BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT3
802 
803 #elif BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT4
804 #define BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT4
805 
806 #elif BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT5
807 #define BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT5
808 
809 #elif BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT6
810 #define BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT6
811 
812 #elif BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT7
813 #define BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT7
814 
815 #elif BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT8
816 #define BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT8
817 
818 #elif BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT9
819 #define BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT9
820 
821 #elif BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT10
822 #define BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT10
823 
824 #elif BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_CPPID == BSP430_PERIPH_CPPID_PORT11
825 #define BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_HANDLE BSP430_PERIPH_PORT11
826 /* END AUTOMATICALLY GENERATED CODE [periph_sethandle] */
827 /* !BSP430! end=periph_sethandle instance=@timers */
828 #endif /* BSP430_TIMER_CCACLK_CC1_PORT_PERIPH_CPPID */
829 
837 #if defined(BSP430_DOXYGEN)
838 #define BSP430_TIMER_CCACLK_CC1_PORT_BIT include <bsp430/platform.h>
839 #endif /* BSP430_DOXYGEN */
840 
849 #ifndef BSP430_TIMER_CCACLK_CC1_CCIS
850 #define BSP430_TIMER_CCACLK_CC1_CCIS CCIS_0
851 #endif /* BSP430_TIMER_CCACLK_CC1_CCIS */
852 
877 #ifndef configBSP430_TIMER_VALID_COUNTER_READ
878 #define configBSP430_TIMER_VALID_COUNTER_READ 1
879 #endif /* configBSP430_TIMER_VALID_COUNTER_READ */
880 
881 /* 20130312 TODO REMOVE 20130630 Detect legacy issues */
882 #ifdef configBSP430_TIMER_SAFE_COUNTER_READ
883 #warning configBSP430_TIMER_SAFE_COUNTER_READ has been superseded by configBSP430_TIMER_VALID_COUNTER_READ
884 #endif /* configBSP430_TIMER_SAFE_COUNTER_READ */
885 
929 #if defined(BSP430_DOXYGEN) || (configBSP430_TIMER_VALID_COUNTER_READ - 0)
930 #ifndef BSP430_TIMER_VALID_COUNTER_READ_CCIDX
931 #define BSP430_TIMER_VALID_COUNTER_READ_CCIDX 2
932 #endif /* BSP430_TIMER_VALID_COUNTER_READ_CCIDX */
933 #endif /* configBSP430_TIMER_VALID_COUNTER_READ */
934 
986  int ccidx,
987  unsigned int capture_mode,
988  unsigned int ccis,
989  unsigned int count);
990 
993 typedef struct sBSP430hplTIMER {
994  unsigned int ctl;
995  union {
996  unsigned int cctl[7];
997  struct {
998  unsigned int cctl0;
999  unsigned int cctl1;
1000  unsigned int cctl2;
1001  unsigned int cctl3;
1002  unsigned int cctl4;
1003  unsigned int cctl5;
1004  unsigned int cctl6;
1005  };
1006  };
1007  unsigned int r;
1008  union {
1009  unsigned int ccr[7];
1010  struct {
1011  unsigned int ccr0;
1012  unsigned int ccr1;
1013  unsigned int ccr2;
1014  unsigned int ccr3;
1015  unsigned int ccr4;
1016  unsigned int ccr5;
1017  unsigned int ccr6;
1018  };
1019  };
1020 } sBSP430hplTIMER;
1021 
1027 #if defined(__MSP430_HAS_MSP430XV2_CPU__)
1028 /* Find the relevant tests with the following command over the
1029  * upstream include files in the msp430mcu package::
1030 
1031  for i in TA T0A T1A T2A T3A TB T0B T1B T2B T3B ; do
1032  grep -h BASEADDRESS_${i} * \
1033  | sort \
1034  | uniq ;
1035  done
1036 
1037  * Use the alternative with the most CCs as the default. If the MCU
1038  * doesn't support it but a user references the handle, the name will
1039  * be unresolved at compile time, which is a fair error message.
1040  */
1041 #if defined(__MSP430_HAS_T0A3__)
1042 #define BSP430_PERIPH_TA0_BASEADDRESS_ __MSP430_BASEADDRESS_T0A3__
1043 #else /* TA0 */
1044 #define BSP430_PERIPH_TA0_BASEADDRESS_ __MSP430_BASEADDRESS_T0A5__
1045 #endif /* TA0 */
1046 
1047 #if defined(__MSP430_HAS_T1A2__)
1048 #define BSP430_PERIPH_TA1_BASEADDRESS_ __MSP430_BASEADDRESS_T1A2__
1049 #else /* TA1 */
1050 #define BSP430_PERIPH_TA1_BASEADDRESS_ __MSP430_BASEADDRESS_T1A3__
1051 #endif /* TA1 */
1052 
1053 #if defined(__MSP430_HAS_T2A2__)
1054 #define BSP430_PERIPH_TA2_BASEADDRESS_ __MSP430_BASEADDRESS_T2A2__
1055 #else /* TA2 */
1056 #define BSP430_PERIPH_TA2_BASEADDRESS_ __MSP430_BASEADDRESS_T2A3__
1057 #endif /* TA2 */
1058 
1059 #if defined(__MSP430_HAS_T3A2__)
1060 #define BSP430_PERIPH_TA3_BASEADDRESS_ __MSP430_BASEADDRESS_T3A2__
1061 #else /* TA3 */
1062 #define BSP430_PERIPH_TA3_BASEADDRESS_ __MSP430_BASEADDRESS_T3A3__
1063 #endif /* TA3 */
1064 
1065 #if defined(__MSP430_HAS_T0B3__)
1066 #define BSP430_PERIPH_TB0_BASEADDRESS_ __MSP430_BASEADDRESS_T0B3__
1067 #else /* TB0 */
1068 #define BSP430_PERIPH_TB0_BASEADDRESS_ __MSP430_BASEADDRESS_T0B7__
1069 #endif /* TB0 */
1070 
1071 #define BSP430_PERIPH_TB1_BASEADDRESS_ __MSP430_BASEADDRESS_T1B3__
1072 #define BSP430_PERIPH_TB2_BASEADDRESS_ __MSP430_BASEADDRESS_T2B3__
1073 
1074 #else /* MSP430XV2 */
1075 
1076 /* Non-5xx MCU headers don't provide peripheral base addresses.
1077  * Fortunately, all the variants are at the same address in these
1078  * families (in 5xx there are a couple chips with different addresses
1079  * for TA0). */
1080 #define BSP430_PERIPH_TA0_BASEADDRESS_ 0x0160
1081 /* In some chips (e.g., msp430g2553) there are two Timer_As, and the
1082  * second is located at the same address as Timer_B in other chips in
1083  * the family. There are no MCUs of this type that have a Timer_B. */
1084 #define BSP430_PERIPH_TA1_BASEADDRESS_ 0x0180
1085 #define BSP430_PERIPH_TB0_BASEADDRESS_ 0x0180
1086 #endif /* MSP430XV2 */
1087 
1088 /* The other thing we're doing here is adapting old-style vector
1089  * macros for legacy MCUs with outdated headers. */
1090 #if defined(TIMERA0_VECTOR) && ! defined(TIMER0_A0_VECTOR)
1091 #define TIMER0_A0_VECTOR TIMERA0_VECTOR
1092 #endif /* T0A CC0 */
1093 #if defined(TIMERA1_VECTOR) && ! defined(TIMER0_A1_VECTOR)
1094 #define TIMER0_A1_VECTOR TIMERA1_VECTOR
1095 #endif /* T0A CC1-2 TA */
1096 #if defined(TIMERB0_VECTOR) && ! defined(TIMER0_B0_VECTOR)
1097 #define TIMER0_B0_VECTOR TIMERB0_VECTOR
1098 #endif /* T0B CC0 */
1099 #if defined(TIMERB1_VECTOR) && ! defined(TIMER0_B1_VECTOR)
1100 #define TIMER0_B1_VECTOR TIMERB1_VECTOR
1101 #endif /* T0B CC1-2 TB */
1102  /* DOXYGEN_INTERNAL */
1104 
1107 #define BSP430_TIMER_HAL_HPL_VARIANT_TIMER 1
1108 
1115 #define BSP430_TIMER_FLAG_MCLKSYNC 0x01
1116 
1125 #define BSP430_TIMER_FLAG_SLOW 0x02
1126 
1129 typedef struct sBSP430halTIMER {
1134 
1136  volatile sBSP430hplTIMER * const hpl;
1137 
1150  unsigned long overflow_count;
1151 
1157 
1165  const struct sBSP430halISRIndexedChainNode * volatile * const cc_cbchain_ni;
1166 } sBSP430halTIMER;
1167 
1170 
1193 void vBSP430timerInferHints_ni (hBSP430halTIMER timer);
1194 
1205 
1213 unsigned long ulBSP430timerFrequency_Hz_ni (tBSP430periphHandle periph);
1214 
1231 unsigned long ulBSP430timerOverflowAdjusted_ni (hBSP430halTIMER timer,
1232  unsigned int ctr);
1233 
1266 unsigned long ulBSP430timerCounter_ni (hBSP430halTIMER timer,
1267  unsigned int * overflowp);
1268 
1277 static BSP430_CORE_INLINE
1278 unsigned long
1279 ulBSP430timerCounter (hBSP430halTIMER timer,
1280  unsigned int * overflowp)
1281 {
1283  unsigned long rv;
1284 
1286  rv = ulBSP430timerCounter_ni(timer, overflowp);
1288  return rv;
1289 }
1290 
1306 static BSP430_CORE_INLINE
1307 unsigned long long
1308 ullBSP430timerCorrected (hBSP430halTIMER timer,
1309  unsigned int ctr)
1310 {
1312  unsigned int overflow;
1313  unsigned int ui;
1314  unsigned long ul;
1315  unsigned long long ull;
1316 
1318  do {
1319  ul = ulBSP430timerCounter_ni(timer, &overflow);
1320  } while (0);
1322  ull = overflow;
1323  ull <<= 8 * sizeof(ul);
1324  ull += ul;
1325  ui = ul;
1326  ui -= ctr;
1327  ull -= (long)ui;
1328  return ull;
1329 }
1330 
1348 unsigned long ulBSP430timerCaptureCounter_ni (hBSP430halTIMER timer,
1349  unsigned int ccidx);
1350 
1356 void vBSP430timerResetCounter_ni (hBSP430halTIMER timer);
1357 
1372 void vBSP430timerSetCounter_ni (hBSP430halTIMER timer,
1373  unsigned int overflow,
1374  unsigned long counter);
1375 
1376 /* Forward declaration */
1377 struct sBSP430timerAlarm;
1378 
1386 typedef const struct sBSP430timerAlarm * hBSP430timerAlarm;
1387 
1406 typedef int (* iBSP430timerAlarmCallback_ni) (hBSP430timerAlarm alarm);
1407 
1411 #define BSP430_TIMER_ALARM_FLAG_SET 0x01
1412 
1416 #define BSP430_TIMER_ALARM_FLAG_ENABLED 0x02
1417 
1427 typedef struct sBSP430timerAlarm {
1429  hBSP430halTIMER timer;
1430 
1435  unsigned char ccidx;
1436 
1443  unsigned char flags;
1444 
1455  unsigned long setting_tck;
1456 
1465 
1474 
1484 
1522 hBSP430timerAlarm hBSP430timerAlarmInitialize (sBSP430timerAlarm * alarm,
1523  tBSP430periphHandle periph,
1524  int ccidx,
1525  iBSP430timerAlarmCallback_ni callback);
1526 
1549 int iBSP430timerAlarmSetEnabled_ni (hBSP430timerAlarm alarm,
1550  int enablep);
1551 
1562 static BSP430_CORE_INLINE
1563 int iBSP430timerAlarmEnable (hBSP430timerAlarm alarm)
1564 {
1566  int rv;
1567 
1569  rv = iBSP430timerAlarmSetEnabled_ni(alarm, 1);
1571  return rv;
1572 }
1573 
1583 static BSP430_CORE_INLINE
1584 int iBSP430timerAlarmDisable (hBSP430timerAlarm alarm)
1585 {
1587  int rv;
1588 
1590  rv = iBSP430timerAlarmSetEnabled_ni(alarm, 0);
1592  return rv;
1593 }
1594 
1604 #ifndef BSP430_TIMER_ALARM_FUTURE_LIMIT
1605 #define BSP430_TIMER_ALARM_FUTURE_LIMIT 3UL
1606 #endif /* BSP430_TIMER_ALARM_FUTURE_LIMIT */
1607 
1613 #define BSP430_TIMER_ALARM_SET_NOW 1
1614 
1619 #define BSP430_TIMER_ALARM_SET_PAST 2
1620 
1625 #define BSP430_TIMER_ALARM_SET_ALREADY -2
1626 
1653 int iBSP430timerAlarmSet_ni (hBSP430timerAlarm alarm,
1654  unsigned long setting_tck);
1655 
1684 int iBSP430timerAlarmSetForced_ni (hBSP430timerAlarm alarm,
1685  unsigned long setting_tck);
1686 
1691 static BSP430_CORE_INLINE
1692 int iBSP430timerAlarmSet (hBSP430timerAlarm alarm,
1693  unsigned long setting_tck)
1694 {
1696  int rv;
1697 
1699  rv = iBSP430timerAlarmSet_ni(alarm, setting_tck);
1701  return rv;
1702 }
1703 
1720 int iBSP430timerAlarmCancel_ni (hBSP430timerAlarm alarm);
1721 
1726 static BSP430_CORE_INLINE
1727 int iBSP430timerAlarmCancel (hBSP430timerAlarm alarm)
1728 {
1730  int rv;
1731 
1733  rv = iBSP430timerAlarmCancel_ni(alarm);
1735  return rv;
1736 }
1737 
1738 /* Forward declaration */
1739 struct sBSP430timerMuxAlarm;
1740 
1741 /* Forward declaration */
1743 
1758  struct sBSP430timerMuxAlarm * alarm);
1759 
1771 
1776 
1780 
1786 typedef struct sBSP430timerMuxAlarm {
1794  unsigned long setting_tck;
1795 
1798 
1805 
1809 
1830  tBSP430periphHandle periph,
1831  int ccidx);
1832 
1845 
1854 static BSP430_CORE_INLINE
1856 {
1857  if (! shared->dedicated.timer) {
1858  return 0;
1859  }
1860  return ulBSP430timerCounter_ni(shared->dedicated.timer, NULL);
1861 }
1862 
1889  hBSP430timerMuxAlarm alarm);
1890 
1910  hBSP430timerMuxAlarm alarm);
1911 
1915 #define BSP430_TIMER_PULSECAP_START_VALID 0x01
1916 
1920 #define BSP430_TIMER_PULSECAP_END_VALID 0x02
1921 
1932 #define BSP430_TIMER_PULSECAP_OVERFLOW 0x04
1933 
1942 #define BSP430_TIMER_PULSECAP_ACTIVE_HIGH 0x08
1943 
1947 #define BSP430_TIMER_PULSECAP_START_CALLBACK 0x100
1948 
1952 #define BSP430_TIMER_PULSECAP_END_CALLBACK 0x200
1953 
1956 #define BSP430_TIMER_PULSECAP_CALLBACK_ACTIVE 0x0400
1957 
1961 #define BSP430_TIMER_PULSECAP_ENABLED 0x1000
1962 
1965 #define BSP430_TIMER_PULSECAP_ACTIVE 0x2000
1966 
1967 /* Forward declaration */
1969 
1978 
1985 
1987  hBSP430halTIMER hal;
1988 
1990  int ccidx;
1991 
1994  unsigned int ccis;
1995 
2000 
2006  volatile unsigned int flags_ni;
2007 
2011  volatile unsigned long start_tt_ni;
2012 
2016  volatile unsigned long end_tt_ni;
2018 
2021 
2054 hBSP430timerPulseCapture
2055 hBSP430timerPulseCaptureInitialize (hBSP430timerPulseCapture pulsecap,
2056  tBSP430periphHandle periph,
2057  int ccidx,
2058  unsigned int ccis,
2059  unsigned int flags,
2061 
2084 int iBSP430timerPulseCaptureSetEnabled_ni (hBSP430timerPulseCapture pulsecap,
2085  int enablep);
2086 
2109 int iBSP430timerPulseCaptureSetActive_ni (hBSP430timerPulseCapture pulsecap,
2110  int activep);
2111 
2125 static BSP430_CORE_INLINE
2126 void
2127 vBSP430timerPulseCaptureClear_ni (hBSP430timerPulseCapture pulsecap)
2128 {
2133 }
2134 
2143 static BSP430_CORE_INLINE
2144 int
2145 iBSP430timerPulseCaptureDisable (hBSP430timerPulseCapture pulsecap)
2146 {
2148  int rv;
2149 
2151  rv = iBSP430timerPulseCaptureSetEnabled_ni(pulsecap, 0);
2153  return rv;
2154 }
2155 
2166 static BSP430_CORE_INLINE
2167 int
2168 iBSP430timerPulseCaptureEnable (hBSP430timerPulseCapture pulsecap)
2169 {
2171  int rv;
2172 
2174  rv = iBSP430timerPulseCaptureSetEnabled_ni(pulsecap, 1);
2176  return rv;
2177 }
2178 
2194 static BSP430_CORE_INLINE
2195 int
2196 iBSP430timerPulseCaptureActivate (hBSP430timerPulseCapture pulsecap)
2197 {
2199  int rv;
2200 
2203  rv = iBSP430timerPulseCaptureSetActive_ni(pulsecap, 1);
2205  return rv;
2206 }
2207 
2218 static BSP430_CORE_INLINE
2219 int
2220 iBSP430timerPulseCaptureDeactivate (hBSP430timerPulseCapture pulsecap)
2221 {
2223  int rv;
2224 
2226  rv = iBSP430timerPulseCaptureSetActive_ni(pulsecap, 0);
2228  return rv;
2229 }
2230 
2244 static BSP430_CORE_INLINE
2245 void vBSP430timerPulseCaptureInvertSense_ni (hBSP430timerPulseCapture pulsecap)
2246 {
2247  unsigned int flags = pulsecap->flags_ni;
2249  if (BSP430_TIMER_PULSECAP_END_VALID & flags) {
2252  pulsecap->start_tt_ni = pulsecap->end_tt_ni;
2253  } else {
2255  }
2256  pulsecap->flags_ni = flags;
2257 }
2258 
2259 /* !BSP430! insert=hal_decl */
2260 /* BEGIN AUTOMATICALLY GENERATED CODE---DO NOT MODIFY [hal_decl] */
2277 #ifndef configBSP430_HAL_TA0
2278 #define configBSP430_HAL_TA0 0
2279 #endif /* configBSP430_HAL_TA0 */
2280 
2282 #if (configBSP430_HAL_TA0 - 0)
2283 /* You do not need to know about this */
2284 extern sBSP430halTIMER xBSP430hal_TA0_;
2285 #endif /* configBSP430_HAL_TA0 */
2286 
2294 #if defined(BSP430_DOXYGEN) || (configBSP430_HAL_TA0 - 0)
2295 #define BSP430_HAL_TA0 (&xBSP430hal_TA0_)
2296 #endif /* configBSP430_HAL_TA0 */
2297 
2314 #ifndef configBSP430_HAL_TA1
2315 #define configBSP430_HAL_TA1 0
2316 #endif /* configBSP430_HAL_TA1 */
2317 
2319 #if (configBSP430_HAL_TA1 - 0)
2320 /* You do not need to know about this */
2321 extern sBSP430halTIMER xBSP430hal_TA1_;
2322 #endif /* configBSP430_HAL_TA1 */
2323 
2331 #if defined(BSP430_DOXYGEN) || (configBSP430_HAL_TA1 - 0)
2332 #define BSP430_HAL_TA1 (&xBSP430hal_TA1_)
2333 #endif /* configBSP430_HAL_TA1 */
2334 
2351 #ifndef configBSP430_HAL_TA2
2352 #define configBSP430_HAL_TA2 0
2353 #endif /* configBSP430_HAL_TA2 */
2354 
2356 #if (configBSP430_HAL_TA2 - 0)
2357 /* You do not need to know about this */
2358 extern sBSP430halTIMER xBSP430hal_TA2_;
2359 #endif /* configBSP430_HAL_TA2 */
2360 
2368 #if defined(BSP430_DOXYGEN) || (configBSP430_HAL_TA2 - 0)
2369 #define BSP430_HAL_TA2 (&xBSP430hal_TA2_)
2370 #endif /* configBSP430_HAL_TA2 */
2371 
2388 #ifndef configBSP430_HAL_TA3
2389 #define configBSP430_HAL_TA3 0
2390 #endif /* configBSP430_HAL_TA3 */
2391 
2393 #if (configBSP430_HAL_TA3 - 0)
2394 /* You do not need to know about this */
2395 extern sBSP430halTIMER xBSP430hal_TA3_;
2396 #endif /* configBSP430_HAL_TA3 */
2397 
2405 #if defined(BSP430_DOXYGEN) || (configBSP430_HAL_TA3 - 0)
2406 #define BSP430_HAL_TA3 (&xBSP430hal_TA3_)
2407 #endif /* configBSP430_HAL_TA3 */
2408 
2425 #ifndef configBSP430_HAL_TB0
2426 #define configBSP430_HAL_TB0 0
2427 #endif /* configBSP430_HAL_TB0 */
2428 
2430 #if (configBSP430_HAL_TB0 - 0)
2431 /* You do not need to know about this */
2432 extern sBSP430halTIMER xBSP430hal_TB0_;
2433 #endif /* configBSP430_HAL_TB0 */
2434 
2442 #if defined(BSP430_DOXYGEN) || (configBSP430_HAL_TB0 - 0)
2443 #define BSP430_HAL_TB0 (&xBSP430hal_TB0_)
2444 #endif /* configBSP430_HAL_TB0 */
2445 
2462 #ifndef configBSP430_HAL_TB1
2463 #define configBSP430_HAL_TB1 0
2464 #endif /* configBSP430_HAL_TB1 */
2465 
2467 #if (configBSP430_HAL_TB1 - 0)
2468 /* You do not need to know about this */
2469 extern sBSP430halTIMER xBSP430hal_TB1_;
2470 #endif /* configBSP430_HAL_TB1 */
2471 
2479 #if defined(BSP430_DOXYGEN) || (configBSP430_HAL_TB1 - 0)
2480 #define BSP430_HAL_TB1 (&xBSP430hal_TB1_)
2481 #endif /* configBSP430_HAL_TB1 */
2482 
2499 #ifndef configBSP430_HAL_TB2
2500 #define configBSP430_HAL_TB2 0
2501 #endif /* configBSP430_HAL_TB2 */
2502 
2504 #if (configBSP430_HAL_TB2 - 0)
2505 /* You do not need to know about this */
2506 extern sBSP430halTIMER xBSP430hal_TB2_;
2507 #endif /* configBSP430_HAL_TB2 */
2508 
2516 #if defined(BSP430_DOXYGEN) || (configBSP430_HAL_TB2 - 0)
2517 #define BSP430_HAL_TB2 (&xBSP430hal_TB2_)
2518 #endif /* configBSP430_HAL_TB2 */
2519 
2520 /* END AUTOMATICALLY GENERATED CODE [hal_decl] */
2521 /* !BSP430! end=hal_decl */
2522 
2523 /* !BSP430! insert=periph_decl */
2524 /* BEGIN AUTOMATICALLY GENERATED CODE---DO NOT MODIFY [periph_decl] */
2540 #ifndef configBSP430_HPL_TA0
2541 #define configBSP430_HPL_TA0 (configBSP430_HAL_TA0 - 0)
2542 #endif /* configBSP430_HPL_TA0 */
2543 
2544 #if (configBSP430_HAL_TA0 - 0) && ! (configBSP430_HPL_TA0 - 0)
2545 #warning configBSP430_HAL_TA0 requested without configBSP430_HPL_TA0
2546 #endif /* HAL and not HPL */
2547 
2554 #if defined(BSP430_DOXYGEN) || (configBSP430_HPL_TA0 - 0)
2555 #define BSP430_PERIPH_TA0 ((tBSP430periphHandle)(BSP430_PERIPH_TA0_BASEADDRESS_))
2556 #endif /* configBSP430_HPL_TA0 */
2557 
2573 #ifndef configBSP430_HPL_TA1
2574 #define configBSP430_HPL_TA1 (configBSP430_HAL_TA1 - 0)
2575 #endif /* configBSP430_HPL_TA1 */
2576 
2577 #if (configBSP430_HAL_TA1 - 0) && ! (configBSP430_HPL_TA1 - 0)
2578 #warning configBSP430_HAL_TA1 requested without configBSP430_HPL_TA1
2579 #endif /* HAL and not HPL */
2580 
2587 #if defined(BSP430_DOXYGEN) || (configBSP430_HPL_TA1 - 0)
2588 #define BSP430_PERIPH_TA1 ((tBSP430periphHandle)(BSP430_PERIPH_TA1_BASEADDRESS_))
2589 #endif /* configBSP430_HPL_TA1 */
2590 
2606 #ifndef configBSP430_HPL_TA2
2607 #define configBSP430_HPL_TA2 (configBSP430_HAL_TA2 - 0)
2608 #endif /* configBSP430_HPL_TA2 */
2609 
2610 #if (configBSP430_HAL_TA2 - 0) && ! (configBSP430_HPL_TA2 - 0)
2611 #warning configBSP430_HAL_TA2 requested without configBSP430_HPL_TA2
2612 #endif /* HAL and not HPL */
2613 
2620 #if defined(BSP430_DOXYGEN) || (configBSP430_HPL_TA2 - 0)
2621 #define BSP430_PERIPH_TA2 ((tBSP430periphHandle)(BSP430_PERIPH_TA2_BASEADDRESS_))
2622 #endif /* configBSP430_HPL_TA2 */
2623 
2639 #ifndef configBSP430_HPL_TA3
2640 #define configBSP430_HPL_TA3 (configBSP430_HAL_TA3 - 0)
2641 #endif /* configBSP430_HPL_TA3 */
2642 
2643 #if (configBSP430_HAL_TA3 - 0) && ! (configBSP430_HPL_TA3 - 0)
2644 #warning configBSP430_HAL_TA3 requested without configBSP430_HPL_TA3
2645 #endif /* HAL and not HPL */
2646 
2653 #if defined(BSP430_DOXYGEN) || (configBSP430_HPL_TA3 - 0)
2654 #define BSP430_PERIPH_TA3 ((tBSP430periphHandle)(BSP430_PERIPH_TA3_BASEADDRESS_))
2655 #endif /* configBSP430_HPL_TA3 */
2656 
2672 #ifndef configBSP430_HPL_TB0
2673 #define configBSP430_HPL_TB0 (configBSP430_HAL_TB0 - 0)
2674 #endif /* configBSP430_HPL_TB0 */
2675 
2676 #if (configBSP430_HAL_TB0 - 0) && ! (configBSP430_HPL_TB0 - 0)
2677 #warning configBSP430_HAL_TB0 requested without configBSP430_HPL_TB0
2678 #endif /* HAL and not HPL */
2679 
2686 #if defined(BSP430_DOXYGEN) || (configBSP430_HPL_TB0 - 0)
2687 #define BSP430_PERIPH_TB0 ((tBSP430periphHandle)(BSP430_PERIPH_TB0_BASEADDRESS_))
2688 #endif /* configBSP430_HPL_TB0 */
2689 
2705 #ifndef configBSP430_HPL_TB1
2706 #define configBSP430_HPL_TB1 (configBSP430_HAL_TB1 - 0)
2707 #endif /* configBSP430_HPL_TB1 */
2708 
2709 #if (configBSP430_HAL_TB1 - 0) && ! (configBSP430_HPL_TB1 - 0)
2710 #warning configBSP430_HAL_TB1 requested without configBSP430_HPL_TB1
2711 #endif /* HAL and not HPL */
2712 
2719 #if defined(BSP430_DOXYGEN) || (configBSP430_HPL_TB1 - 0)
2720 #define BSP430_PERIPH_TB1 ((tBSP430periphHandle)(BSP430_PERIPH_TB1_BASEADDRESS_))
2721 #endif /* configBSP430_HPL_TB1 */
2722 
2738 #ifndef configBSP430_HPL_TB2
2739 #define configBSP430_HPL_TB2 (configBSP430_HAL_TB2 - 0)
2740 #endif /* configBSP430_HPL_TB2 */
2741 
2742 #if (configBSP430_HAL_TB2 - 0) && ! (configBSP430_HPL_TB2 - 0)
2743 #warning configBSP430_HAL_TB2 requested without configBSP430_HPL_TB2
2744 #endif /* HAL and not HPL */
2745 
2752 #if defined(BSP430_DOXYGEN) || (configBSP430_HPL_TB2 - 0)
2753 #define BSP430_PERIPH_TB2 ((tBSP430periphHandle)(BSP430_PERIPH_TB2_BASEADDRESS_))
2754 #endif /* configBSP430_HPL_TB2 */
2755 
2756 /* END AUTOMATICALLY GENERATED CODE [periph_decl] */
2757 /* !BSP430! end=periph_decl */
2758 
2759 /* !BSP430! insert=hpl_decl */
2760 /* BEGIN AUTOMATICALLY GENERATED CODE---DO NOT MODIFY [hpl_decl] */
2768 #if defined(BSP430_DOXYGEN) || (configBSP430_HPL_TA0 - 0)
2769 #define BSP430_HPL_TA0 ((volatile sBSP430hplTIMER *)BSP430_PERIPH_TA0)
2770 #endif /* configBSP430_HPL_TA0 */
2771 
2779 #if defined(BSP430_DOXYGEN) || (configBSP430_HPL_TA1 - 0)
2780 #define BSP430_HPL_TA1 ((volatile sBSP430hplTIMER *)BSP430_PERIPH_TA1)
2781 #endif /* configBSP430_HPL_TA1 */
2782 
2790 #if defined(BSP430_DOXYGEN) || (configBSP430_HPL_TA2 - 0)
2791 #define BSP430_HPL_TA2 ((volatile sBSP430hplTIMER *)BSP430_PERIPH_TA2)
2792 #endif /* configBSP430_HPL_TA2 */
2793 
2801 #if defined(BSP430_DOXYGEN) || (configBSP430_HPL_TA3 - 0)
2802 #define BSP430_HPL_TA3 ((volatile sBSP430hplTIMER *)BSP430_PERIPH_TA3)
2803 #endif /* configBSP430_HPL_TA3 */
2804 
2812 #if defined(BSP430_DOXYGEN) || (configBSP430_HPL_TB0 - 0)
2813 #define BSP430_HPL_TB0 ((volatile sBSP430hplTIMER *)BSP430_PERIPH_TB0)
2814 #endif /* configBSP430_HPL_TB0 */
2815 
2823 #if defined(BSP430_DOXYGEN) || (configBSP430_HPL_TB1 - 0)
2824 #define BSP430_HPL_TB1 ((volatile sBSP430hplTIMER *)BSP430_PERIPH_TB1)
2825 #endif /* configBSP430_HPL_TB1 */
2826 
2834 #if defined(BSP430_DOXYGEN) || (configBSP430_HPL_TB2 - 0)
2835 #define BSP430_HPL_TB2 ((volatile sBSP430hplTIMER *)BSP430_PERIPH_TB2)
2836 #endif /* configBSP430_HPL_TB2 */
2837 
2838 /* END AUTOMATICALLY GENERATED CODE [hpl_decl] */
2839 /* !BSP430! end=hpl_decl */
2840 
2841 /* !BSP430! insert=hal_timer_isr_decl */
2842 /* BEGIN AUTOMATICALLY GENERATED CODE---DO NOT MODIFY [hal_timer_isr_decl] */
2857 #if defined(BSP430_DOXYGEN)
2858 #define configBSP430_HAL_TA0_CC0_ISR 0
2859 #endif /* BSP430_DOXYGEN */
2860 
2861 #if (configBSP430_HAL_TA0_CC0_ISR - 0) && ! (configBSP430_HAL_TA0 - 0)
2862 #warning configBSP430_HAL_TA0_CC0_ISR requested without configBSP430_HAL_TA0
2863 #endif /* HAL_CC0_ISR and not HAL */
2864 
2883 #ifndef configBSP430_HAL_TA0_ISR
2884 #define configBSP430_HAL_TA0_ISR (configBSP430_HAL_TA0 - 0)
2885 #endif /* configBSP430_HAL_TA0_ISR */
2886 
2887 #if (configBSP430_HAL_TA0_ISR - 0) && ! (configBSP430_HAL_TA0 - 0)
2888 #warning configBSP430_HAL_TA0_ISR requested without configBSP430_HAL_TA0
2889 #endif /* HAL_ISR and not HAL */
2890 
2905 #if defined(BSP430_DOXYGEN)
2906 #define configBSP430_HAL_TA1_CC0_ISR 0
2907 #endif /* BSP430_DOXYGEN */
2908 
2909 #if (configBSP430_HAL_TA1_CC0_ISR - 0) && ! (configBSP430_HAL_TA1 - 0)
2910 #warning configBSP430_HAL_TA1_CC0_ISR requested without configBSP430_HAL_TA1
2911 #endif /* HAL_CC0_ISR and not HAL */
2912 
2931 #ifndef configBSP430_HAL_TA1_ISR
2932 #define configBSP430_HAL_TA1_ISR (configBSP430_HAL_TA1 - 0)
2933 #endif /* configBSP430_HAL_TA1_ISR */
2934 
2935 #if (configBSP430_HAL_TA1_ISR - 0) && ! (configBSP430_HAL_TA1 - 0)
2936 #warning configBSP430_HAL_TA1_ISR requested without configBSP430_HAL_TA1
2937 #endif /* HAL_ISR and not HAL */
2938 
2953 #if defined(BSP430_DOXYGEN)
2954 #define configBSP430_HAL_TA2_CC0_ISR 0
2955 #endif /* BSP430_DOXYGEN */
2956 
2957 #if (configBSP430_HAL_TA2_CC0_ISR - 0) && ! (configBSP430_HAL_TA2 - 0)
2958 #warning configBSP430_HAL_TA2_CC0_ISR requested without configBSP430_HAL_TA2
2959 #endif /* HAL_CC0_ISR and not HAL */
2960 
2979 #ifndef configBSP430_HAL_TA2_ISR
2980 #define configBSP430_HAL_TA2_ISR (configBSP430_HAL_TA2 - 0)
2981 #endif /* configBSP430_HAL_TA2_ISR */
2982 
2983 #if (configBSP430_HAL_TA2_ISR - 0) && ! (configBSP430_HAL_TA2 - 0)
2984 #warning configBSP430_HAL_TA2_ISR requested without configBSP430_HAL_TA2
2985 #endif /* HAL_ISR and not HAL */
2986 
3001 #if defined(BSP430_DOXYGEN)
3002 #define configBSP430_HAL_TA3_CC0_ISR 0
3003 #endif /* BSP430_DOXYGEN */
3004 
3005 #if (configBSP430_HAL_TA3_CC0_ISR - 0) && ! (configBSP430_HAL_TA3 - 0)
3006 #warning configBSP430_HAL_TA3_CC0_ISR requested without configBSP430_HAL_TA3
3007 #endif /* HAL_CC0_ISR and not HAL */
3008 
3027 #ifndef configBSP430_HAL_TA3_ISR
3028 #define configBSP430_HAL_TA3_ISR (configBSP430_HAL_TA3 - 0)
3029 #endif /* configBSP430_HAL_TA3_ISR */
3030 
3031 #if (configBSP430_HAL_TA3_ISR - 0) && ! (configBSP430_HAL_TA3 - 0)
3032 #warning configBSP430_HAL_TA3_ISR requested without configBSP430_HAL_TA3
3033 #endif /* HAL_ISR and not HAL */
3034 
3049 #if defined(BSP430_DOXYGEN)
3050 #define configBSP430_HAL_TB0_CC0_ISR 0
3051 #endif /* BSP430_DOXYGEN */
3052 
3053 #if (configBSP430_HAL_TB0_CC0_ISR - 0) && ! (configBSP430_HAL_TB0 - 0)
3054 #warning configBSP430_HAL_TB0_CC0_ISR requested without configBSP430_HAL_TB0
3055 #endif /* HAL_CC0_ISR and not HAL */
3056 
3075 #ifndef configBSP430_HAL_TB0_ISR
3076 #define configBSP430_HAL_TB0_ISR (configBSP430_HAL_TB0 - 0)
3077 #endif /* configBSP430_HAL_TB0_ISR */
3078 
3079 #if (configBSP430_HAL_TB0_ISR - 0) && ! (configBSP430_HAL_TB0 - 0)
3080 #warning configBSP430_HAL_TB0_ISR requested without configBSP430_HAL_TB0
3081 #endif /* HAL_ISR and not HAL */
3082 
3097 #if defined(BSP430_DOXYGEN)
3098 #define configBSP430_HAL_TB1_CC0_ISR 0
3099 #endif /* BSP430_DOXYGEN */
3100 
3101 #if (configBSP430_HAL_TB1_CC0_ISR - 0) && ! (configBSP430_HAL_TB1 - 0)
3102 #warning configBSP430_HAL_TB1_CC0_ISR requested without configBSP430_HAL_TB1
3103 #endif /* HAL_CC0_ISR and not HAL */
3104 
3123 #ifndef configBSP430_HAL_TB1_ISR
3124 #define configBSP430_HAL_TB1_ISR (configBSP430_HAL_TB1 - 0)
3125 #endif /* configBSP430_HAL_TB1_ISR */
3126 
3127 #if (configBSP430_HAL_TB1_ISR - 0) && ! (configBSP430_HAL_TB1 - 0)
3128 #warning configBSP430_HAL_TB1_ISR requested without configBSP430_HAL_TB1
3129 #endif /* HAL_ISR and not HAL */
3130 
3145 #if defined(BSP430_DOXYGEN)
3146 #define configBSP430_HAL_TB2_CC0_ISR 0
3147 #endif /* BSP430_DOXYGEN */
3148 
3149 #if (configBSP430_HAL_TB2_CC0_ISR - 0) && ! (configBSP430_HAL_TB2 - 0)
3150 #warning configBSP430_HAL_TB2_CC0_ISR requested without configBSP430_HAL_TB2
3151 #endif /* HAL_CC0_ISR and not HAL */
3152 
3171 #ifndef configBSP430_HAL_TB2_ISR
3172 #define configBSP430_HAL_TB2_ISR (configBSP430_HAL_TB2 - 0)
3173 #endif /* configBSP430_HAL_TB2_ISR */
3174 
3175 #if (configBSP430_HAL_TB2_ISR - 0) && ! (configBSP430_HAL_TB2 - 0)
3176 #warning configBSP430_HAL_TB2_ISR requested without configBSP430_HAL_TB2
3177 #endif /* HAL_ISR and not HAL */
3178 
3179 /* END AUTOMATICALLY GENERATED CODE [hal_timer_isr_decl] */
3180 /* !BSP430! end=hal_timer_isr_decl */
3181 
3191 static BSP430_CORE_INLINE
3193 {
3194  /* !BSP430! insert=periph_hpl_demux */
3195  /* BEGIN AUTOMATICALLY GENERATED CODE---DO NOT MODIFY [periph_hpl_demux] */
3196 #if (configBSP430_HPL_TA0 - 0)
3197  if (BSP430_PERIPH_TA0 == periph) {
3198  return BSP430_HPL_TA0;
3199  }
3200 #endif /* configBSP430_HPL_TA0 */
3201 
3202 #if (configBSP430_HPL_TA1 - 0)
3203  if (BSP430_PERIPH_TA1 == periph) {
3204  return BSP430_HPL_TA1;
3205  }
3206 #endif /* configBSP430_HPL_TA1 */
3207 
3208 #if (configBSP430_HPL_TA2 - 0)
3209  if (BSP430_PERIPH_TA2 == periph) {
3210  return BSP430_HPL_TA2;
3211  }
3212 #endif /* configBSP430_HPL_TA2 */
3213 
3214 #if (configBSP430_HPL_TA3 - 0)
3215  if (BSP430_PERIPH_TA3 == periph) {
3216  return BSP430_HPL_TA3;
3217  }
3218 #endif /* configBSP430_HPL_TA3 */
3219 
3220 #if (configBSP430_HPL_TB0 - 0)
3221  if (BSP430_PERIPH_TB0 == periph) {
3222  return BSP430_HPL_TB0;
3223  }
3224 #endif /* configBSP430_HPL_TB0 */
3225 
3226 #if (configBSP430_HPL_TB1 - 0)
3227  if (BSP430_PERIPH_TB1 == periph) {
3228  return BSP430_HPL_TB1;
3229  }
3230 #endif /* configBSP430_HPL_TB1 */
3231 
3232 #if (configBSP430_HPL_TB2 - 0)
3233  if (BSP430_PERIPH_TB2 == periph) {
3234  return BSP430_HPL_TB2;
3235  }
3236 #endif /* configBSP430_HPL_TB2 */
3237 
3238  /* END AUTOMATICALLY GENERATED CODE [periph_hpl_demux] */
3239  /* !BSP430! end=periph_hpl_demux */
3240  return NULL;
3241 }
3242 
3251 static BSP430_CORE_INLINE
3252 hBSP430halTIMER hBSP430timerLookup (tBSP430periphHandle periph)
3253 {
3254  /* !BSP430! insert=periph_hal_demux */
3255  /* BEGIN AUTOMATICALLY GENERATED CODE---DO NOT MODIFY [periph_hal_demux] */
3256 #if (configBSP430_HAL_TA0 - 0)
3257  if (BSP430_PERIPH_TA0 == periph) {
3258  return BSP430_HAL_TA0;
3259  }
3260 #endif /* configBSP430_HAL_TA0 */
3261 
3262 #if (configBSP430_HAL_TA1 - 0)
3263  if (BSP430_PERIPH_TA1 == periph) {
3264  return BSP430_HAL_TA1;
3265  }
3266 #endif /* configBSP430_HAL_TA1 */
3267 
3268 #if (configBSP430_HAL_TA2 - 0)
3269  if (BSP430_PERIPH_TA2 == periph) {
3270  return BSP430_HAL_TA2;
3271  }
3272 #endif /* configBSP430_HAL_TA2 */
3273 
3274 #if (configBSP430_HAL_TA3 - 0)
3275  if (BSP430_PERIPH_TA3 == periph) {
3276  return BSP430_HAL_TA3;
3277  }
3278 #endif /* configBSP430_HAL_TA3 */
3279 
3280 #if (configBSP430_HAL_TB0 - 0)
3281  if (BSP430_PERIPH_TB0 == periph) {
3282  return BSP430_HAL_TB0;
3283  }
3284 #endif /* configBSP430_HAL_TB0 */
3285 
3286 #if (configBSP430_HAL_TB1 - 0)
3287  if (BSP430_PERIPH_TB1 == periph) {
3288  return BSP430_HAL_TB1;
3289  }
3290 #endif /* configBSP430_HAL_TB1 */
3291 
3292 #if (configBSP430_HAL_TB2 - 0)
3293  if (BSP430_PERIPH_TB2 == periph) {
3294  return BSP430_HAL_TB2;
3295  }
3296 #endif /* configBSP430_HAL_TB2 */
3297 
3298  /* END AUTOMATICALLY GENERATED CODE [periph_hal_demux] */
3299  /* !BSP430! end=periph_hal_demux */
3300  return NULL;
3301 }
3302 
3310 const char * xBSP430timerName (tBSP430periphHandle periph);
3311 
3319 
3341 unsigned int
3343 {
3344  return hpl->r;
3345 }
3346 
3374 unsigned int
3376 {
3377  unsigned int v1;
3378  unsigned int v2;
3379  do {
3382  } while (v1 != v2);
3383  return v1;
3384 }
3385 
3397 void
3399  int ccidx)
3400 {
3401  /* Configure for capture, alternating between GND and VCC as
3402  * sources, triggering on both edges, asynchronously. */
3403  hpl->cctl[ccidx] = CAP | CCIS1 | CM_3;
3404 }
3405 
3433 unsigned int
3435  int ccidx)
3436 {
3437  /* Latch the current counter into a capture register and return it. */
3438  hpl->cctl[ccidx] ^= CCIS0;
3439  return hpl->ccr[ccidx];
3440 }
3441 
3467 static BSP430_CORE_INLINE
3468 void
3470 {
3471 #if (configBSP430_TIMER_VALID_COUNTER_READ - 0)
3472 #if ! (BSP430_CORE_NDEBUG - 0)
3474  while ((NULL == hpl)
3476  /* Spin to detect misconfiguration */
3477  }
3478 #endif /* BSP430_CORE_NDEBUG */
3480 #endif /* configBSP430_TIMER_VALID_COUNTER_READ */
3481 }
3482 
3517 unsigned int
3519 {
3520  unsigned int rv;
3521 #if (configBSP430_TIMER_VALID_COUNTER_READ - 0)
3522 #if ! (BSP430_CORE_NDEBUG - 0)
3523  /* Clear the flag; used only to prevent the following sanity check
3524  * from falsely failing. */
3526 #endif /* BSP430_CORE_NDEBUG */
3528 #if ! (BSP430_CORE_NDEBUG - 0)
3529  /* If the capture/compare register is not configured properly to
3530  * have done a capture, spin in place so this problem can be
3531  * detected during development. */
3532  while ((CCIS1 | CCIFG) != (hpl->cctl[BSP430_TIMER_VALID_COUNTER_READ_CCIDX] & (CCIS1 | CCIFG))) {
3533  /* Spin to detect misconfiguration */
3534  }
3535 #endif /* NDEBUG */
3536 #else /* configBSP430_TIMER_VALID_COUNTER_READ */
3537  /* Async could hang if the clock rates were too close, so just read
3538  * once and hope for the best. */
3540 #endif /* configBSP430_TIMER_VALID_COUNTER_READ */
3541  return rv;
3542 }
3543 
3577 unsigned int
3579  int flags)
3580 {
3581  if (flags & BSP430_TIMER_FLAG_MCLKSYNC) {
3582  return uiBSP430timerSyncCounterRead_ni(hpl);
3583  }
3584  if (flags & BSP430_TIMER_FLAG_SLOW) {
3586  }
3587  return uiBSP430timerSafeCounterRead_ni(hpl);
3588 }
3589 
3590 #endif /* BSP430_MODULE_TIMER */
3591 
3592 #endif /* BSP430_PERIPH_TIMER_H */
sBSP430halISRIndexedChainNode cb
Definition: timer.h:1984
#define BSP430_TIMER_PULSECAP_ACTIVE_HIGH
Definition: timer.h:1942
unsigned int cctl1
Definition: timer.h:999
unsigned long ulBSP430timerCounter_ni(hBSP430halTIMER timer, unsigned int *overflowp)
#define BSP430_PERIPH_TA3
Definition: timer.h:2654
volatile unsigned long start_tt_ni
Definition: timer.h:2011
#define BSP430_HPL_TB0
Definition: timer.h:2813
int iBSP430timerPulseCaptureSetEnabled_ni(hBSP430timerPulseCapture pulsecap, int enablep)
struct sBSP430timerMuxAlarm * next
Definition: timer.h:1803
int ccidx
Definition: timer.h:1990
#define BSP430_TIMER_PULSECAP_END_VALID
Definition: timer.h:1920
#define BSP430_CORE_RESTORE_INTERRUPT_STATE(state_)
Definition: core.h:731
Definition: timer.h:1427
unsigned int cctl0
Definition: timer.h:998
#define BSP430_TIMER_VALID_COUNTER_READ_CCIDX
Definition: timer.h:931
static BSP430_CORE_INLINE int iBSP430timerPulseCaptureDeactivate(hBSP430timerPulseCapture pulsecap)
Definition: timer.h:2220
void vBSP430timerSetCounter_ni(hBSP430halTIMER timer, unsigned int overflow, unsigned long counter)
hBSP430timerPulseCapture hBSP430timerPulseCaptureInitialize(hBSP430timerPulseCapture pulsecap, tBSP430periphHandle periph, int ccidx, unsigned int ccis, unsigned int flags, iBSP430timerPulseCaptureCallback_ni callback)
static BSP430_CORE_INLINE_FORCED unsigned int uiBSP430timerSafeCounterRead_ni(volatile sBSP430hplTIMER *const hpl)
Definition: timer.h:3518
static BSP430_CORE_INLINE_FORCED unsigned int uiBSP430timerSyncCounterRead_ni(volatile sBSP430hplTIMER *const hpl)
Definition: timer.h:3342
unsigned long setting_tck
Definition: timer.h:1794
struct sBSP430halTIMER * hBSP430halTIMER
Definition: timer.h:1169
static BSP430_CORE_INLINE hBSP430halTIMER hBSP430timerLookup(tBSP430periphHandle periph)
Definition: timer.h:3252
unsigned int ccr6
Definition: timer.h:1017
iBSP430timerAlarmCallback_ni callback_ni
Definition: timer.h:1464
static BSP430_CORE_INLINE int iBSP430timerPulseCaptureActivate(hBSP430timerPulseCapture pulsecap)
Definition: timer.h:2196
static BSP430_CORE_INLINE int iBSP430timerPulseCaptureDisable(hBSP430timerPulseCapture pulsecap)
Definition: timer.h:2145
#define CCIS0
Definition: msp430.h:174
struct sBSP430timerPulseCapture * hBSP430timerPulseCapture
Definition: timer.h:2020
iBSP430timerPulseCaptureCallback_ni callback_ni
Definition: timer.h:1999
int iBSP430timerMuxAlarmRemove_ni(hBSP430timerMuxSharedAlarm shared, hBSP430timerMuxAlarm alarm)
int iBSP430timerMuxAlarmShutdown(sBSP430timerMuxSharedAlarm *shared)
unsigned int uiBSP430timerCaptureDelta_ni(tBSP430periphHandle periph, int ccidx, unsigned int capture_mode, unsigned int ccis, unsigned int count)
static BSP430_CORE_INLINE unsigned long long ullBSP430timerCorrected(hBSP430halTIMER timer, unsigned int ctr)
Definition: timer.h:1308
static BSP430_CORE_INLINE_FORCED unsigned int uiBSP430timerLatchedCounterRead_ni(volatile sBSP430hplTIMER *const hpl, int ccidx)
Definition: timer.h:3434
#define CCIS1
Definition: msp430.h:173
Definition: timer.h:993
void vBSP430timerResetCounter_ni(hBSP430halTIMER timer)
unsigned int ccis
Definition: timer.h:1994
static BSP430_CORE_INLINE void vBSP430timerPulseCaptureClear_ni(hBSP430timerPulseCapture pulsecap)
Definition: timer.h:2127
struct sBSP430timerMuxSharedAlarm sBSP430timerMuxSharedAlarm
Definition: timer.h:1786
unsigned long overflow_count
Definition: timer.h:1150
sBSP430halISRVoidChainNode overflow_cb
Definition: timer.h:1473
unsigned int ccr1
Definition: timer.h:1012
static BSP430_CORE_INLINE unsigned long ulBSP430timerCounter(hBSP430halTIMER timer, unsigned int *overflowp)
Definition: timer.h:1279
#define BSP430_TIMER_PULSECAP_OVERFLOW
Definition: timer.h:1932
unsigned long ulBSP430timerFrequency_Hz_ni(tBSP430periphHandle periph)
Clock-related functions implemented on all MSP430 MCUs.
hBSP430timerMuxSharedAlarm hBSP430timerMuxAlarmStartup(sBSP430timerMuxSharedAlarm *shared, tBSP430periphHandle periph, int ccidx)
#define BSP430_HAL_TA0
Definition: timer.h:2295
unsigned char ccidx
Definition: timer.h:1435
eBSP430clockSource
Definition: clock.h:362
Definition: periph.h:425
static BSP430_CORE_INLINE tBSP430periphHandle xBSP430periphFromHPL(volatile void *hpl)
Definition: periph.h:306
#define BSP430_HAL_TB1
Definition: timer.h:2480
#define BSP430_HPL_TB1
Definition: timer.h:2824
#define BSP430_PERIPH_TA0
Definition: timer.h:2555
hBSP430timerAlarm hBSP430timerAlarmInitialize(sBSP430timerAlarm *alarm, tBSP430periphHandle periph, int ccidx, iBSP430timerAlarmCallback_ni callback)
#define BSP430_TIMER_FLAG_SLOW
Definition: timer.h:1125
#define BSP430_PERIPH_TB1
Definition: timer.h:2720
const struct sBSP430halISRIndexedChainNode *volatile *const cc_cbchain_ni
Definition: timer.h:1165
void vBSP430timerInferHints_ni(hBSP430halTIMER timer)
unsigned int r
Definition: timer.h:1007
static BSP430_CORE_INLINE unsigned long ulBSP430timerMuxSharedAlarmCounter(sBSP430timerMuxSharedAlarm *shared)
Definition: timer.h:1855
unsigned int ccr3
Definition: timer.h:1014
unsigned int ccr2
Definition: timer.h:1013
#define BSP430_HAL_TB2
Definition: timer.h:2517
#define BSP430_CORE_INLINE
Definition: core.h:439
struct sBSP430timerMuxAlarm sBSP430timerMuxAlarm
unsigned long setting_tck
Definition: timer.h:1455
sBSP430hplHALStatePrefix hal_state
Definition: timer.h:1133
Definition: timer.h:1762
const char * xBSP430timerName(tBSP430periphHandle periph)
Generic peripheral support for MSP430 MCUs.
#define BSP430_CORE_SAVED_INTERRUPT_STATE(var_)
Definition: core.h:719
sBSP430timerAlarm dedicated
Definition: timer.h:1770
#define BSP430_HAL_TB0
Definition: timer.h:2443
#define BSP430_PERIPH_TA2
Definition: timer.h:2621
#define CAP
Definition: msp430.h:189
static BSP430_CORE_INLINE void vBSP430timerSafeCounterInitialize_ni(volatile sBSP430hplTIMER *const hpl)
Definition: timer.h:3469
#define BSP430_HAL_TA1
Definition: timer.h:2332
#define BSP430_HPL_TA1
Definition: timer.h:2780
sBSP430halISRIndexedChainNode cc_cb
Definition: timer.h:1482
const struct sBSP430halISRVoidChainNode *volatile overflow_cbchain_ni
Definition: timer.h:1156
static BSP430_CORE_INLINE int iBSP430timerAlarmEnable(hBSP430timerAlarm alarm)
Definition: timer.h:1563
static BSP430_CORE_INLINE int iBSP430timerAlarmSet(hBSP430timerAlarm alarm, unsigned long setting_tck)
Definition: timer.h:1692
Definition: periph.h:437
#define BSP430_PERIPH_TA1
Definition: timer.h:2588
unsigned int cctl3
Definition: timer.h:1001
static BSP430_CORE_INLINE_FORCED unsigned int uiBSP430timerAsyncCounterRead_ni(volatile sBSP430hplTIMER *const hpl)
Definition: timer.h:3375
#define BSP430_TIMER_PULSECAP_START_VALID
Definition: timer.h:1915
eBSP430clockSource xBSP430timerClockSource(volatile sBSP430hplTIMER *hpl)
Definition: timer.h:1981
unsigned int ccr[7]
Definition: timer.h:1009
struct sBSP430halTIMER sBSP430halTIMER
unsigned int ccr5
Definition: timer.h:1016
unsigned int cctl5
Definition: timer.h:1003
hBSP430halTIMER timer
Definition: timer.h:1429
int iBSP430timerPulseCaptureSetActive_ni(hBSP430timerPulseCapture pulsecap, int activep)
unsigned int cctl[7]
Definition: timer.h:996
#define BSP430_PERIPH_TB0
Definition: timer.h:2687
int iBSP430timerMuxAlarmAdd_ni(hBSP430timerMuxSharedAlarm shared, hBSP430timerMuxAlarm alarm)
unsigned int ctl
Definition: timer.h:994
iBSP430timerMuxAlarmCallback_ni callback_ni
Definition: timer.h:1797
int(* iBSP430timerAlarmCallback_ni)(hBSP430timerAlarm alarm)
Definition: timer.h:1406
static BSP430_CORE_INLINE_FORCED unsigned int uiBSP430timerBestCounterRead_ni(volatile sBSP430hplTIMER *const hpl, int flags)
Definition: timer.h:3578
#define BSP430_CORE_INLINE_FORCED
Definition: core.h:454
const struct sBSP430timerAlarm * hBSP430timerAlarm
Definition: timer.h:1386
static BSP430_CORE_INLINE volatile sBSP430hplTIMER * xBSP430hplLookupTIMER(tBSP430periphHandle periph)
Definition: timer.h:3192
sBSP430timerMuxAlarm * hBSP430timerMuxAlarm
Definition: timer.h:1808
int iBSP430timerAlarmSet_ni(hBSP430timerAlarm alarm, unsigned long setting_tck)
int iBSP430timerAlarmSetForced_ni(hBSP430timerAlarm alarm, unsigned long setting_tck)
unsigned int cctl2
Definition: timer.h:1000
int iBSP430timerSupportedCCs(tBSP430periphHandle periph)
struct sBSP430timerAlarm sBSP430timerAlarm
#define BSP430_CORE_DISABLE_INTERRUPT()
Definition: core.h:762
volatile unsigned int flags_ni
Definition: timer.h:2006
struct sBSP430hplTIMER sBSP430hplTIMER
unsigned char flags
Definition: timer.h:1443
int(* iBSP430timerMuxAlarmCallback_ni)(struct sBSP430timerMuxSharedAlarm *shared, struct sBSP430timerMuxAlarm *alarm)
Definition: timer.h:1757
unsigned int ccr4
Definition: timer.h:1015
static BSP430_CORE_INLINE int iBSP430timerAlarmCancel(hBSP430timerAlarm alarm)
Definition: timer.h:1727
sBSP430timerMuxSharedAlarm * hBSP430timerMuxSharedAlarm
Definition: timer.h:1779
unsigned long ulBSP430timerOverflowAdjusted_ni(hBSP430halTIMER timer, unsigned int ctr)
#define BSP430_HPL_TB2
Definition: timer.h:2835
volatile sBSP430hplTIMER *const hpl
Definition: timer.h:1136
struct sBSP430timerMuxAlarm * alarms
Definition: timer.h:1774
int tBSP430periphHandle
Definition: periph.h:106
#define BSP430_HAL_TA2
Definition: timer.h:2369
#define BSP430_HPL_TA2
Definition: timer.h:2791
#define CCIFG
Definition: msp430.h:185
static BSP430_CORE_INLINE int iBSP430timerAlarmDisable(hBSP430timerAlarm alarm)
Definition: timer.h:1584
unsigned int ccr0
Definition: timer.h:1011
int iBSP430timerAlarmSetEnabled_ni(hBSP430timerAlarm alarm, int enablep)
unsigned int cctl6
Definition: timer.h:1004
#define BSP430_HPL_TA3
Definition: timer.h:2802
#define CM_3
Definition: msp430.h:168
static BSP430_CORE_INLINE void vBSP430timerPulseCaptureInvertSense_ni(hBSP430timerPulseCapture pulsecap)
Definition: timer.h:2245
#define BSP430_TIMER_FLAG_MCLKSYNC
Definition: timer.h:1115
unsigned long ulBSP430timerCaptureCounter_ni(hBSP430halTIMER timer, unsigned int ccidx)
#define BSP430_HPL_TA0
Definition: timer.h:2769
static BSP430_CORE_INLINE int iBSP430timerPulseCaptureEnable(hBSP430timerPulseCapture pulsecap)
Definition: timer.h:2168
Definition: periph.h:272
int iBSP430timerAlarmCancel_ni(hBSP430timerAlarm alarm)
volatile unsigned long end_tt_ni
Definition: timer.h:2016
Definition: timer.h:1129
#define BSP430_PERIPH_TB2
Definition: timer.h:2753
unsigned int cctl4
Definition: timer.h:1002
#define BSP430_HAL_TA3
Definition: timer.h:2406
int(* iBSP430timerPulseCaptureCallback_ni)(struct sBSP430timerPulseCapture *state)
Definition: timer.h:1977
struct sBSP430timerPulseCapture sBSP430timerPulseCapture
hBSP430halTIMER hal
Definition: timer.h:1987
static BSP430_CORE_INLINE_FORCED void vBSP430timerLatchedCounterInitialize_ni(volatile sBSP430hplTIMER *const hpl, int ccidx)
Definition: timer.h:3398