1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     cec_CecAPI.h
4 
5   Copyright (C)2009 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 25622 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_CEC_CTR_CEC_CEC_API_H_
17 #define NN_CEC_CTR_CEC_CEC_API_H_
18 
19 #include <nn/cec/CTR/cec_Cec.h>
20 
21 namespace nn {
22 namespace cec {
23 namespace CTR {
24 
25 namespace detail {
26 
27     namespace
28     {
29         const char PORT_NAME_CEC[]      = "cecd:u";
30         const char PORT_NAME_CEC_SYS[]  = "cecd:s";
31         const char PORT_NAME_CEC_NDM[]  = "cecd:ndm";
32     }
33 
34 
35     Result InitializeCecControl();
36     Result InitializeCecControlSys();
37     Result FinalizeCecControl();
38     Result FinalizeCecControlSys();
39 
40     Result WaitForSessionValid();
41 
42 
43     Result Open( u32 cecTitleId, u32 dataType, u32 option, size_t* filesize );
44     Result Read(size_t* pReadLen, u8 pReadBuf[], size_t len );
45     Result ReadMessage( u32 cecTitleId, u8 in_or_out_box, const u8 pMessId[], size_t messIdLen, size_t* pReadLen, u8 pReadBuf[], size_t len );
46     Result ReadMessageWithHmac( u32 cecTitleId, u8 in_or_out_box, const u8 pMessId[], size_t messIdLen, size_t* pReadLen, u8 pReadBuf[], size_t len , const u8 pHmac[] );
47     Result Write(const u8 pWriteBuf[], size_t len );
48     Result WriteMessage( u32 cecTitleId, u8 in_or_out_box, u8 pMessId[], size_t messIdLen, const u8 pWriteBuf[], size_t len );
49     Result WriteMessageWithHmac( u32 cecTitleId, u8 in_or_out_box, u8 pMessId[], size_t messIdLen, const u8 pWriteBuf[], size_t len , const u8 pHmac[]);
50     Result Delete( u32 cecTitleId, u32 dataType, u8 in_or_out_box, const u8 pMessId[], size_t messIdLen );
51 
52     nn::Result SetData( u32 cecTitleId, const u8 pData[], size_t len, u32 option );
53     nn::Result ReadData( u8 pReadBuf[], size_t len, u32 option , const u8 optionData[], size_t optionDataLen);
54 
55     Result Start(u32 option);
56     Result Stop(u32 option);
57 
58     Result GetCecdState( u32* state );
59     Result GetCecInfoBuffer( u32 cecTitleId, u8 pCecInfoBuffer[], size_t size );
60     Result GetCecInfoEventHandle( nn::Handle* pEventHandle );
61     Result GetChangeStateEventHandle( nn::Handle* pEventHandle );
62 
63     //Result SystemOpenBox( u32 cecTitleId );
64     Result SetCecTestMode( bit8 testMode );
65     Result GetCecInfoEventHandleSys( nn::Handle* pEventHandle );
66 
67 } // end of namespace detail
68 } // end of namespace CTR
69 } // end of namespace cec
70 } // end of namespace nn
71 
72 
73 
74 #endif  // ifndef NN_CEC_CTR_CEC_CEC_API_H_
75