summaryrefslogtreecommitdiff
path: root/bsp/rx/RPDL/r_pdl_cmt_rx62nxx.h
blob: ae425dca0c505923a738098b902393072685b3eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*""FILE COMMENT""*******************************************************
* System Name	: CMT API for RX62Nxx
* File Name		: r_pdl_cmt_RX62Nxx.h
* Version		: 1.02
* Contents		: CMT API header
* Customer		: 
* Model			: 
* Order			: 
* CPU			: RX
* Compiler		: RXC
* OS			: Nothing
* Programmer	: 
* Note			: 
************************************************************************
* Copyright, 2011. Renesas Electronics Corporation
* and Renesas Solutions Corporation
************************************************************************
* History		: 2011.04.08
*				: Ver 1.02
*				: CS-5 release.
*""FILE COMMENT END""**************************************************/

#ifndef R_PDL_CMT_RX62Nxx_H
#define R_PDL_CMT_RX62Nxx_H

#define CMT_UNITS	2
#define CMT_CHANNELS_PER_UNIT 2
#define CMT_CHANNELS (uint8_t)(CMT_UNITS * CMT_CHANNELS_PER_UNIT)

/* Callback function storage */
extern VoidCallBackFunc rpdl_CMT_callback_func[CMT_CHANNELS];

/* Global variables */
extern volatile uint8_t rpdl_CMT_one_shot[CMT_CHANNELS];

/* Library prototypes */
bool R_CMT_CreateAll(
	const uint8_t,
	const uint16_t,
	const float,
	VoidCallBackFunc const,
	const uint8_t
);
bool R_CMT_CreateOneShotAll(
	const uint8_t,
	const uint16_t,
	const float,
	VoidCallBackFunc const,
	const uint8_t
);
bool R_CMT_DestroyAll(
	const uint8_t
);
bool R_CMT_ControlAll(
	const uint8_t,
	const uint16_t,
	const float
);
bool R_CMT_ReadAll(
	const uint8_t,
	volatile uint8_t * const,
	volatile uint16_t * const
);
bool ReturnFalse(void);

/* Macro definitions */

#define R_CMT_Create(a, b, c, d, e) \
( \
( ( ((a) < CMT_CHANNELS ) && ((e) <= IPL_MAX) ) ) ? \
R_CMT_CreateAll( (a), (b), (c), (d), (e) ) : \
ReturnFalse() \
)

#define R_CMT_CreateOneShot(a, b, c, d, e) \
( \
( ( ((a) < CMT_CHANNELS ) && ((e) <= IPL_MAX) ) ) ? \
R_CMT_CreateOneShotAll( (a), (b), (c), (d), (e) ) : \
ReturnFalse() \
)

#define R_CMT_Destroy(a) \
( \
( (a) < CMT_UNITS ) ? \
R_CMT_DestroyAll( (a) ) : \
ReturnFalse() \
)

#define R_CMT_Control(a, b, c) \
( \
( (a) < CMT_CHANNELS ) ? \
R_CMT_ControlAll( (a), (b), (c) ) : \
ReturnFalse() \
)

#define R_CMT_Read(a, b, c) \
( \
( (a) < CMT_CHANNELS ) ? \
R_CMT_ReadAll( (a), (b), (c) ) : \
ReturnFalse() \
)

#endif
/* End of file */