/*
 * Copyright (c) 2018 Renesas Electronics Corporation. All rights reserved.
 */

#include	"common.h"
#include	"devdrv.h"
#include	"scifdrv0.h"
#include	"scifdrv0_v3h.h"
#include	"scifdrv2.h"
#include	"reg_rcargen3.h"


/************************
	PutChar				*
*************************/

int32_t PutChar(char outChar)
{
	uint32_t product;

	product = *((volatile uint32_t*)PRR) & PRR_PRODUCT_MASK;
	switch (product) {
	case PRR_PRODUCT_H3:	/* H3, M3 and M3N setting values are same */
	case PRR_PRODUCT_M3:
	case PRR_PRODUCT_M3N:
	case PRR_PRODUCT_D3:
		PutCharSCIF2(outChar);
		break;
	case PRR_PRODUCT_V3M:
		PutCharSCIF0(outChar);
		break;
	case PRR_PRODUCT_V3H:
		PutCharSCIF0_v3h(outChar);
		break;
	default:
		break;
	}
	return(0);
}

int32_t WaitPutCharSendEnd(void)
{
	uint32_t product;

	product = *((volatile uint32_t*)PRR) & PRR_PRODUCT_MASK;
	switch (product) {
	case PRR_PRODUCT_H3:	/* H3, M3 and M3N setting values are same */
	case PRR_PRODUCT_M3:
	case PRR_PRODUCT_M3N:
	case PRR_PRODUCT_D3:
		WaitPutScif2SendEnd();
		break;
	case PRR_PRODUCT_V3M:
		WaitPutScif0SendEnd();
		break;
	case PRR_PRODUCT_V3H:
		WaitPutScif0_v3h_SendEnd();
		break;
	default:
		break;
	}
}
