User`s manual
RX62N Group, RX621 Group 5. Usage Examples
5.5. Bus Controller
5.5.1.
External bus, CS area
Figure 5-6 shows an example of external bus controller usage.
/* Peripheral driver function prototypes */
#include "r_pdl_bsc.h"
#include "r_pdl_cgc.h"
#include "r_pdl_intc.h"
/* RPDL device-specific definitions */
#include "r_pdl_definitions.h"
void BSC_error_handler(void)
{
/* Clear the error signals */
R_BSC_Control(
PDL_BSC_ERROR_CLEAR
);
}
void main(void)
{
uint8_t * cs1_location_8;
uint16_t * cs7_location_16;
cs1_location_8 = ( uint8_t *)0x07000000ul;
cs7_location_16 = (uint16_t *)0x01000000ul;
/* Initialise the system clocks and enable the BCLK output */
R_CGC_Set(
12.5E6,
100E6,
50E6,
25E6,
PDL_CGC_BCLK_DIV_1
);
/* Set the CPU’s Interrupt Priority Level to 0 */
R_INTC_Write(
PDL_INTC_REG_IPL,
0
);
/* Configure the bus controller */
R_BSC_Create(
PDL_BSC_CS2_B | PDL_BSC_WAIT_NOT_USED,
0,
PDL_BSC_ERROR_ILLEGAL_ADDRESS_ENABLE | PDL_BSC_ERROR_TIME_OUT_ENABLE,
BSC_error_handler,
5
);
/* Configure area CS7 */
R_BSC_CreateArea(
7,
PDL_BSC_WRITE_SINGLE | PDL_BSC_WIDTH_16,
0,
0,
0,
0,
0,
0,
0,
0,
1,
R20UT0084EE0112 Rev.1.12 Page 5-9
July. 16, 2014