1 /*""FILE COMMENT""*******************************************************
2 * System Name	: CMT API for RX62Nxx
3 * File Name		: r_pdl_cmt_RX62Nxx.h
4 * Version		: 1.02
5 * Contents		: CMT API header
6 * Customer		:
7 * Model			:
8 * Order			:
9 * CPU			: RX
10 * Compiler		: RXC
11 * OS			: Nothing
12 * Programmer	:
13 * Note			:
14 ************************************************************************
15 * Copyright, 2011. Renesas Electronics Corporation
16 * and Renesas Solutions Corporation
17 ************************************************************************
18 * History		: 2011.04.08
19 *				: Ver 1.02
20 *				: CS-5 release.
21 *""FILE COMMENT END""**************************************************/
22 
23 #ifndef R_PDL_CMT_RX62Nxx_H
24 #define R_PDL_CMT_RX62Nxx_H
25 
26 #define CMT_UNITS	2
27 #define CMT_CHANNELS_PER_UNIT 2
28 #define CMT_CHANNELS (uint8_t)(CMT_UNITS * CMT_CHANNELS_PER_UNIT)
29 
30 /* Callback function storage */
31 extern VoidCallBackFunc rpdl_CMT_callback_func[CMT_CHANNELS];
32 
33 /* Global variables */
34 extern volatile uint8_t rpdl_CMT_one_shot[CMT_CHANNELS];
35 
36 /* Library prototypes */
37 bool R_CMT_CreateAll(
38 	const uint8_t,
39 	const uint16_t,
40 	const float,
41 	VoidCallBackFunc const,
42 	const uint8_t
43 );
44 bool R_CMT_CreateOneShotAll(
45 	const uint8_t,
46 	const uint16_t,
47 	const float,
48 	VoidCallBackFunc const,
49 	const uint8_t
50 );
51 bool R_CMT_DestroyAll(
52 	const uint8_t
53 );
54 bool R_CMT_ControlAll(
55 	const uint8_t,
56 	const uint16_t,
57 	const float
58 );
59 bool R_CMT_ReadAll(
60 	const uint8_t,
61 	volatile uint8_t * const,
62 	volatile uint16_t * const
63 );
64 bool ReturnFalse(void);
65 
66 /* Macro definitions */
67 
68 #define R_CMT_Create(a, b, c, d, e) \
69 ( \
70 ( ( ((a) < CMT_CHANNELS ) && ((e) <= IPL_MAX) ) ) ? \
71 R_CMT_CreateAll( (a), (b), (c), (d), (e) ) : \
72 ReturnFalse() \
73 )
74 
75 #define R_CMT_CreateOneShot(a, b, c, d, e) \
76 ( \
77 ( ( ((a) < CMT_CHANNELS ) && ((e) <= IPL_MAX) ) ) ? \
78 R_CMT_CreateOneShotAll( (a), (b), (c), (d), (e) ) : \
79 ReturnFalse() \
80 )
81 
82 #define R_CMT_Destroy(a) \
83 ( \
84 ( (a) < CMT_UNITS ) ? \
85 R_CMT_DestroyAll( (a) ) : \
86 ReturnFalse() \
87 )
88 
89 #define R_CMT_Control(a, b, c) \
90 ( \
91 ( (a) < CMT_CHANNELS ) ? \
92 R_CMT_ControlAll( (a), (b), (c) ) : \
93 ReturnFalse() \
94 )
95 
96 #define R_CMT_Read(a, b, c) \
97 ( \
98 ( (a) < CMT_CHANNELS ) ? \
99 R_CMT_ReadAll( (a), (b), (c) ) : \
100 ReturnFalse() \
101 )
102 
103 #endif
104 /* End of file */
105