/*! Time-stamp: <@(#)ATBoardModDVBS2.h   07/05/2007 - 15:46:04   P.Hoogervorst>
*********************************************************************
*  @file   : ATBoardModDVBS2.h
*
*  Author  : P.Hoogervorst                              Date: 03/04/2008
*
*  Purpose : Implementation of methods for class 
*
*********************************************************************
* Version History:
*
* V 0.10  03/04/2008  BN : First Revision
*
*********************************************************************
*/

#ifndef __ATBOARD_MOD_DVBS2_H__
#define __ATBOARD_MOD_DVBS2_H__

/**********************************************************************************************************/
// includes
#include "ATBoardModRfIf.h"

class CATBoardModDVBS2 : public CAtBoardModRfIf
{
public:
	CATBoardModDVBS2(void);
public:
	virtual ~CATBoardModDVBS2(void);

public:

    /*!
     * Do the one time initialize of the modulator. Is done once at startup.
     *
	 * @return BOOL  : TRUE on success, else FALSE
     */
	BOOL Init();

	/*!
     * Set the Modulator.
	 *
     *
	 *
	 * @param Modulation:		modulation type
	 * @param FECCodeRate:		FEC code rate
	 * @param FltRollOff:		set alpha filter roll off factor
	 * @param Inversion:		spectral inversion selection
	 * @param nSymbolRate:		symbol rate in Symbols per second
	 * @param nPLscrambleSeed:	scrambler initialization seed
	 * @param DvbModeSel:		set dvb mode: dvb-s, dvb-dsng, dvb-s2
	 * @param bPLscrambleEn:	enable physical layer scrambling
	 * @param bISSYIndEn:		enable input stream synchronization indicator
	 * @param bISSYLongByteEn:	enable long byte input stream synchronization option
	 * @param bNullPckDelEn:	enable null packet deletion
	 * @param bPilotInsEn:		enable pilot insertion at the physical layer
	 * @param bDummyFrameEn:	enable dummy frame insertion
	 *		  
	 * @return BOOL  : TRUE on success, else FALSE
	 */
	/*!
\htmlonly
Valid settings:<br>
<br>
DVBS:
<ul>
<li>Modulation:				QPSK
<li>FECCodeRate:			FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8
<li>FltRollOff:				FLT_ALPHA_35
<li>Inversion:				INVERSION_OFF, INVERSION_ON,
<li>nSymbolRate:			1-45MSymbols/s
<li>nPLscrambleSeed:		not used
<li>bDvbS2En:				FALSE
<li>bPLscrambleEn:			not used
<li>bISSYIndEn:				not used
<li>bISSYLongByteEn:		not used
<li>bNullPckDelEn:			not used
<li>bPilotInsEn:			not used
<li>bDummyFrameEn:			not used
</ul>
DVBS2:
<ul>
<li>Modulation:				QPSK, PSK8, APSK16, APSK32
<li>FECCodeRate:			FEC_1_4, FEC_1_3, FEC_2_5, FEC_1_2, FEC_3_5, FEC_2_3, FEC_3_4, FEC_4_5, FEC_5_6, FEC_8_9, FEC_9_10
<li>FltRollOff:				FLT_ALPHA_20, FLT_ALPHA_25, FLT_ALPHA_35
<li>Inversion:				INVERSION_OFF, INVERSION_ON,
<li>nSymbolRate:			1-45MSymbols/s
<li>nPLscrambleSeed:		0-262143
<li>bDvbS2En:				TRUE
<li>bPLscrambleEn:			TRUE or FALSE
<li>bISSYIndEn:				TRUE or FALSE
<li>bISSYLongByteEn:		TRUE or FALSE
<li>bNullPckDelEn:			TRUE or FALSE
<li>bPilotInsEn:			TRUE or FALSE
<li>bDummyFrameEn:			TRUE or FALSE
</ul>
DVB-DSNG:
<ul>
<li>Modulation:				QPSK, PSK8, QAM16
<li>FECCodeRate:			QPSK:		FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8
<li>						PSK8:		FEC_2_3, FEC_5_6, FEC_8_9
<li>						QAM16:		FEC_3_4, FEC_7_8
<li>FltRollOff:				QPSK:		FLT_ALPHA_35
<li>						PSK8,QAM16:	FLT_ALPHA_35, FLT_ALPHA_25
<li>Inversion:				INVERSION_OFF, INVERSION_ON,
<li>nSymbolRate:			1-45MSymbols/s
<li>nPLscrambleSeed:		not used
<li>bDvbS2En:				FALSE
<li>bPLscrambleEn:			not used
<li>bISSYIndEn:				not used
<li>bISSYLongByteEn:		not used
<li>bNullPckDelEn:			not used
<li>bPilotInsEn:			not used
<li>bDummyFrameEn:			not used
</ul>
\endhtmlonly
     */
	BOOL Set(	src_modulation_t			Modulation,
				src_code_rate_t				FECCodeRate,
				src_filter_rolloff_t		FltRollOff,
				src_spectral_inversion_t	Inversion,
				u32							nSymbolRate,
				u32							nPLscrambleSeed,
				src_dvbs_mode_t				DvbModeSel,
				BOOL						bPLscrambleEn,
				BOOL						bISSYIndEn,
				BOOL						bISSYLongByteEn,
				BOOL						bNullPckDelEn,
				BOOL						bPilotInsEn,
				BOOL						bDummyFrameEn);


	/*!
	* Get the modulation status of the modulator
	*
	* @param bTsInSync :		TRUE: modulator core transport stream input is in sync, FALSE: not in sync
	* @param bTs204PacketSize :	TRUE: modulator core has detected a transport stream packet size of 204, FALSE: a transport stream packet size of 188
	* @param bTsOFlow :			TRUE: modulator core has detected an overflow at the transport stream input buffer
	*
	* @return BOOL  : TRUE on success, else FALSE
	*/
	BOOL Get(BOOL &bTsInSync, BOOL &bTs204PacketSize, BOOL &bTsOFlow); 

	/*!
	* Initialize play for derived class. If the initialization of the play must be changed or expanded by a derived class,
	* The derived class should do that in this function
	*
	* @param nFileBitrate : Bit rate of the file to play 
	* @param bORemux : TRUE: enable bit rate re-multiplexing, FALSE: disable bit rate re-multiplexing
	* @param nOutputBitrate : Output bit rate. Only used if bORemux is enabled, then it must be equal or higher as the nFileBitrate. If bORemux is disabled, Output nOutputBitrate must be set to MAX_ASIBITRATE
	* @param OSel : Selects which output ports are enabled
	* @param OMode : Selects the output standard
	* @param OSpiMode : Selects the SPI output mode
	* @param OTsPSize : Selects the output transport packet size
	* @param bOHTP : TRUE: Hardware Generated Transport stream is enabled, FALSE: Hardware Generated Transport stream is disabled.
	* @param bOCTP : TRUE: If Hardware Generated Transport stream is enabled, counter packets are generated, FALSE, null packets are generated.
	* @param nBurstSize : Output burst size. (Only for the serial ASI output)
	*
	* @return BOOL  : TRUE on success, else FALSE
	*/
	BOOL _InitPlay	   (u32			nFileBitrate,
						BOOL		bORemux,
						u32			nOutputBitrate,
						EIOSel		OSel,
						EIOMode		OMode,
						EIOSpiMode	OSpiMode,
						ETSPSize	OTsPSize,
						BOOL		bOHTP,
						BOOL		bOCTP,
						BYTE		nBurstSize);


	/*!
	* Initialize recording for derived class. If the initialization of the recording must be changed or expanded by a derived class,
	* The derived class should do that in this function
	*
	* @param IMode : Selects the input standard
	* @param ISel : Selects which input port is enabled
	* @param bILoop : TRUE: enable loopthrough, FALSE: disable loopthrough
	* @param bIPassThroughSer : TRUE: enable passthrough to serial output, FALSE: disable passthrough
	* @param bIPassThroughSpi : TRUE: enable passthrough to SPI output, FALSE: disable passthrough
	* @param bITimeStamp : TRUE: enable timestamp, FALSE: disable loopthrough
	* @param ISpiMode : Selects the SPI input mode
	*
	* @return BOOL  : TRUE on success, else FALSE
	*/
	BOOL _InitRec	   (EIOMode		IMode,
						EIOSel		ISel,
						BOOL		bILoop,
						BOOL		bIPassThroughSer,
						BOOL		bIPassThroughSpi,
						BOOL		bITimeStamp,
						EIOSpiMode	ISpiMode);
};

#endif //__ATBOARD_MOD_DVBS2_H__
