1 /*""FILE COMMENT""******************************************************* 2 * System Name : I/O Port API for RX62N (144-pin LQFP) 3 * File Name : r_pdl_io_port_RX62NxFB.h 4 * Version : 1.02 5 * Contents : I/O Port 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_IO_PORT_RX62NxFB_H 24 #define R_PDL_IO_PORT_RX62NxFB_H 25 26 /* Library prototypes */ 27 /* Library prototypes */ 28 bool R_IO_PORT_SetAll( 29 const uint8_t, 30 const uint8_t, 31 const uint8_t, 32 const uint8_t 33 ); 34 bool R_IO_PORT_ReadControlAll( 35 const uint8_t, 36 const uint8_t, 37 const uint8_t, 38 volatile uint8_t * const 39 ); 40 bool R_IO_PORT_ReadControlRegisterAll( 41 const uint8_t, 42 const uint8_t, 43 volatile uint8_t * const 44 ); 45 bool R_IO_PORT_ModifyControlAll( 46 const uint8_t, 47 const uint8_t, 48 const uint8_t, 49 const uint8_t, 50 const uint8_t 51 ); 52 bool R_IO_PORT_ModifyControlRegisterAll( 53 const uint8_t, 54 const uint8_t, 55 const uint8_t 56 ); 57 bool R_IO_PORT_ReadDataAll( 58 const uint8_t, 59 const uint8_t, 60 volatile uint8_t * const 61 ); 62 bool R_IO_PORT_ReadDataRegisterAll( 63 const uint8_t, 64 volatile uint8_t * const 65 ); 66 bool R_IO_PORT_WriteAll( 67 const uint8_t, 68 const uint8_t, 69 const uint8_t, 70 const uint8_t 71 ); 72 bool R_IO_PORT_WriteRegisterAll( 73 const uint8_t, 74 const uint8_t 75 ); 76 bool R_IO_PORT_CompareAll( 77 const uint8_t, 78 const uint8_t, 79 const uint8_t, 80 VoidCallBackFunc const 81 ); 82 bool R_IO_PORT_CompareRegisterAll( 83 const uint8_t, 84 const uint8_t, 85 VoidCallBackFunc const 86 ); 87 bool R_IO_PORT_ModifyDataAll( 88 const uint8_t, 89 const uint8_t, 90 const uint8_t, 91 const uint8_t, 92 const uint8_t 93 ); 94 bool R_IO_PORT_ModifyDataRegisterAll( 95 const uint8_t, 96 const uint8_t, 97 const uint8_t 98 ); 99 bool R_IO_PORT_WaitAll( 100 const uint8_t, 101 const uint8_t, 102 const uint8_t 103 ); 104 bool R_IO_PORT_WaitRegisterAll( 105 const uint8_t, 106 const uint8_t 107 ); 108 bool ReturnFalse(void); 109 110 /* Macro definitions */ 111 112 /* R_IO_PORT_Set */ 113 /* Call the function if the port number is valid. */ 114 #define R_IO_PORT_Set(a, b) \ 115 ( \ 116 ( ((a) >= PDL_IO_PORT_0_0) && ((a) <= PDL_IO_PORT_E_7) ) ? \ 117 R_IO_PORT_SetAll( (uint8_t)((a) >> 8), (uint8_t)(a), (uint8_t)~(a), (b) ) : \ 118 ReturnFalse() \ 119 ) 120 121 /* R_IO_PORT_ReadControl */ 122 /* Call the function if the port number is valid. */ 123 #define R_IO_PORT_ReadControl(a, b, c) \ 124 ( \ 125 ( (((a) >= PDL_IO_PORT_0_0) && ((a) <= PDL_IO_PORT_E_7)) ) ? \ 126 R_IO_PORT_ReadControlAll( (uint8_t)((a) >> 8), (uint8_t)(a), (b), (c) ) : \ 127 ( ((a) >= PDL_IO_PORT_0) && ((a) <= PDL_IO_PORT_E) ) ? \ 128 R_IO_PORT_ReadControlRegisterAll( (uint8_t)(a), (b), (c) ) : \ 129 ReturnFalse() \ 130 ) 131 132 /* R_IO_PORT_ModifyControl */ 133 /* Call the function if the port number is valid (0 to E). */ 134 #define R_IO_PORT_ModifyControl(a, b, c) \ 135 ( \ 136 ( (((a) >= PDL_IO_PORT_0_0) && ((a) <= PDL_IO_PORT_E_7)) ) ? \ 137 R_IO_PORT_ModifyControlAll( (uint8_t)((a) >> 8), (uint8_t)(a), (uint8_t)~(a), (b), (c) ) : \ 138 ( ((a) >= PDL_IO_PORT_0) && ((a) <= PDL_IO_PORT_E) ) ? \ 139 R_IO_PORT_ModifyControlRegisterAll( (uint8_t)(a), (b), (c) ) : \ 140 ReturnFalse() \ 141 ) 142 143 /* R_IO_PORT_Read */ 144 /* Call the function if the port number is valid. */ 145 #define R_IO_PORT_Read(a, b) \ 146 ( \ 147 ( (((a) >= PDL_IO_PORT_0_0) && ((a) <= PDL_IO_PORT_E_7)) ) ? \ 148 R_IO_PORT_ReadDataAll( (uint8_t)((a) >> 8), (uint8_t)(a), (b) ) : \ 149 ( ((a) >= PDL_IO_PORT_0) && ((a) <= PDL_IO_PORT_E) ) ? \ 150 R_IO_PORT_ReadDataRegisterAll( (uint8_t)(a), (b) ) : \ 151 ReturnFalse() \ 152 ) 153 154 /* R_IO_PORT_Write */ 155 /* Call the function if the port number is valid. */ 156 #define R_IO_PORT_Write(a, b) \ 157 ( \ 158 ( (((a) >= PDL_IO_PORT_0_0) && ((a) <= PDL_IO_PORT_E_7)) ) ? \ 159 R_IO_PORT_WriteAll( (uint8_t)((a) >> 8), (uint8_t)(a), (uint8_t)~(a), (b) ) : \ 160 ( ((a) >= PDL_IO_PORT_0) && ((a) <= PDL_IO_PORT_E) ) ? \ 161 R_IO_PORT_WriteRegisterAll( (uint8_t)(a), (b) ): \ 162 ReturnFalse() \ 163 ) 164 165 /* R_IO_PORT_Compare */ 166 /* Call the function if the port number is valid. */ 167 #define R_IO_PORT_Compare(a, b, c) \ 168 ( \ 169 ( (((a) >= PDL_IO_PORT_0_0) && ((a) <= PDL_IO_PORT_E_7)) ) ? \ 170 R_IO_PORT_CompareAll( (uint8_t)((a) >> 8), (uint8_t)(a), (b), (c) ) : \ 171 ( ((a) >= PDL_IO_PORT_0) && ((a) <= PDL_IO_PORT_E) ) ? \ 172 R_IO_PORT_CompareRegisterAll( (uint8_t)(a), (b), (c) ): \ 173 ReturnFalse() \ 174 ) 175 176 /* R_IO_PORT_Modify */ 177 /* Call the function if the port number is valid. */ 178 #define R_IO_PORT_Modify(a, b, c) \ 179 ( \ 180 ( (((a) >= PDL_IO_PORT_0_0) && ((a) <= PDL_IO_PORT_E_7)) ) ? \ 181 R_IO_PORT_ModifyDataAll( (uint8_t)((a) >> 8), (uint8_t)(a), (uint8_t)~(a), (b), (c) ) : \ 182 ( ((a) >= PDL_IO_PORT_0) && ((a) <= PDL_IO_PORT_E) ) ? \ 183 R_IO_PORT_ModifyDataRegisterAll( (uint8_t)(a), (b), (c) ): \ 184 ReturnFalse() \ 185 ) 186 187 /* R_IO_PORT_Wait */ 188 /* Call the function if the port number is valid. */ 189 #define R_IO_PORT_Wait(a, b) \ 190 ( \ 191 ( (((a) >= PDL_IO_PORT_0_0) && ((a) <= PDL_IO_PORT_E_7)) && (b == 1u) ) ? \ 192 R_IO_PORT_WaitAll( (uint8_t)((a) >> 8), (uint8_t)(a), (uint8_t)(a) ) : \ 193 ( (((a) >= PDL_IO_PORT_0_0) && ((a) <= PDL_IO_PORT_E_7)) && (b == 0u) ) ? \ 194 R_IO_PORT_WaitAll( (uint8_t)((a) >> 8), (uint8_t)(a), 0u ) : \ 195 ( ((a) >= PDL_IO_PORT_0) && ((a) <= PDL_IO_PORT_E) ) ? \ 196 R_IO_PORT_WaitRegisterAll( (uint8_t)(a), (b) ) : \ 197 ReturnFalse() \ 198 ) 199 200 #endif 201 /* End of file */ 202