1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - MB - demos - mbm
3   File:     mb_measure_channel.h
4 
5   Copyright 2006-2008 Nintendo. 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   $Date:: 2008-09-18#$
14   $Rev: 8573 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef _MBM_MEASURE_CHANNEL_H_
19 #define _MBM_MEASURE_CHANNEL_H_
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 #include <nitro/types.h>
26 
27 /* Constant Definitions */
28 
29 typedef enum
30 {
31     MBM_MEASURE_SUCCESS = 0,           // Get the channel
32     MBM_MEASURE_ERROR_INIT_API = -1,   //
33     MBM_MEASURE_ERROR_INIT_CALLBACK = -2,       //
34     MBM_MEASURE_ERROR_MEASURECHANNEL_API = -3,  //
35     MBM_MEASURE_ERROR_MEASURECHANNEL_CALLBACK = -4,     //
36     MBM_MEASURE_ERROR_RESET_API = -5,  //
37     MBM_MEASURE_ERROR_RESET_CALLBACK = -6,      //
38     MBM_MEASURE_ERROR_END_API = -7,    //
39     MBM_MEASURE_ERROR_END_CALLBACK = -8,        //
40     MBM_MEASURE_ERROR_NO_ALLOWED_CHANNEL = -9,  //
41     MBM_MEASURE_ERROR_ILLEGAL_STATE = -10       //
42 }
43 MBMErrCode;
44 
45 
46 typedef struct
47 {
48     s16     errcode;                   // Error code (MBMErrCode)
49     u16     channel;                   // Channel with the lowest usage rate
50 }
51 MBMCallback;
52 
53 /* Type Definitions */
54 typedef void (*MBMCallbackFunc) (MBMCallback *);
55 
56 
57 /* Function definitions */
58 
59 // The function to search for the optimal channel, which is called before wireless initialization
60 void    MBM_MeasureChannel(u8 *wm_buffer, MBMCallbackFunc callback);
61 // The function to search for the optimal channel, which is called in the IDLE state
62 void    MBM_MeasureChannelInIdle(MBMCallbackFunc callback);
63 
64 
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 
70 #endif /* _MBM_MEASURE_CHANNEL_H_ */
71