/*---------------------------------------------------------------------------*
  Project:  NitroSDK - WM - include
  File:     wm_api.h

  Copyright 2003,2004 Nintendo.  All rights reserved.

  These coded instructions, statements, and computer programs contain
  proprietary information of Nintendo of America Inc. and/or Nintendo
  Company Ltd., and are protected by Federal copyright law.  They may
  not be disclosed to third parties or copied or duplicated in any form,
  in whole or in part, without the prior written consent of Nintendo.

  $Log: wm_api.h,v $
  Revision 1.45  2004/11/17 07:31:04  terui
  Only fix comment.

  Revision 1.44  2004/11/10 05:41:49  takano_makoto
  Revised WM_CopyBssid, WM_IsBssidEqual arguments to const pointers.

  Revision 1.43  2004/11/10 00:59:12  takano_makoto
  Added WM_IsBssidEqual, WM_CopyBssid.

  Revision 1.42  2004/11/09 00:03:59  seiki_masashi
  Implemented a timeout caused by a Null response.

  Revision 1.41  2004/11/02 07:27:38  terui
  Corrected comments.

  Revision 1.40  2004/10/29 02:53:37  terui
  Changed WM_StartScanEx temporarily to be a nonpublic function

  Revision 1.39  2004/10/26 08:22:09  ooe
  Added WM_StartScanEx

  Revision 1.38  2004/10/22 04:36:47  terui
  Made changed with the function that returned int type as WMErrCode to return WMErrCode enumerated type

  Revision 1.37  2004/10/18 11:08:54  terui
  Changed the WM_SetBeaconPeriod temporarily to be nonpublic

  Revision 1.36  2004/10/18 04:21:00  terui
  Fix comment only.

  Revision 1.35  2004/10/18 04:17:46  terui
  Added specification that creates variations in beacon intervals and scan intervals.

  Revision 1.34  2004/10/15 14:09:16  terui
  Fix comment.

  Revision 1.33  2004/10/05 09:45:28  terui
  Standardized the MAC address as the u8 type array

  Revision 1.32  2004/10/04 13:40:25  terui
  Standardized the game group ID as u32 type

  Revision 1.31  2004/10/03 07:51:10  ooe
  Merged with ipl_branch. Added support for ignoreFatalError flag.

  Revision 1.30  2004/10/01 04:09:26  terui
  Modified so that the features can be restricted with the WM_ENABLE_TESTMODE switch

  Revision 1.29  2004/09/20 10:30:21  ooe
  Added WM_SetBeaconPeriod.

  Revision 1.28  2004/09/16 02:59:28  seiki_masashi
  Fixed WM_GetMPReceiveBufferSize bug.

  Revision 1.27  2004/09/13 04:09:12  seiki_masashi
  Added WM_SetMPFrequency.

  Revision 1.26  2004/09/11 04:09:38  terui
  Only fix comment.

  Revision 1.25  2004/09/10 12:04:37  seiki_masashi
  Hid key sharing send byte number in library.

  Revision 1.24  2004/09/10 04:56:16  seiki_masashi
  Changed WM_SIZE_MP_*_BUFFER to an accurate value.

  Revision 1.23  2004/09/09 07:24:11  seiki_masashi
  Added WM_SetMPDataToPortEx.

  Revision 1.22  2004/09/09 01:58:20  terui
  Added prototype declaration in accordance with segmentation of
  initialization and end processes.

  Revision 1.21  2004/09/02 09:26:49  seiki_masashi
  fix typo.

  Revision 1.20  2004/09/02 09:15:33  terui
  Added WMi_GetStatusAddress function.

  Revision 1.19  2004/08/30 00:53:09  terui
  Move definition about LinkLevel to wm.h

  Revision 1.18  2004/08/27 06:44:20  seiki_masashi
  Added defaultRetryCount and fixFreqMode to WM_StartMPEx arguments.

  Revision 1.17  2004/08/27 02:16:00  terui
  Only fix comment.

  Revision 1.16  2004/08/25 08:20:38  seiki_masashi
  Added WM_StatMPEx.

  Revision 1.15  2004/08/25 07:59:06  terui
  Add WM_ConvGgid*.

  Revision 1.14  2004/08/24 13:20:04  terui
  Added enumerated type showing link strength acquisition function and strength.

  Revision 1.13  2004/08/23 04:39:10  ooe
  Changed WM_StartConnect() method. Added ssid to argument.

  Revision 1.12  2004/08/20 11:54:21  terui
  Childs -> Children

  Revision 1.11  2004/08/20 06:47:39  terui
  Added WM_DisconnectChilds.

  Revision 1.10  2004/08/19 15:25:25  miya
  modified SetGameInfo function.

  Revision 1.9  2004/08/18 12:54:30  seiki_masashi
  Changed name to WM_SIZE_MP_*_*_BUFFER.

  Revision 1.8  2004/08/18 06:47:28  terui
  Added WM_GetAllowedChannel function.
  Added WM_SetEntry function.

  Revision 1.7  2004/08/18 00:24:47  seiki_masashi
  Small change to WM_StartMP argument.

  Revision 1.6  2004/08/17 12:49:45  seiki_masashi
  Changed to specify the send buffer in the WM_StartMP argument.

  Revision 1.5  2004/08/11 04:27:09  seiki_masashi
  Added doubleMode to StartDataSharing arguments.

  Revision 1.4  2004/08/10 13:17:04  terui
  Fix comment.

  Revision 1.1  2004/08/10 09:10:17  terui
  Initial upload

  $NoKeywords: $
 *---------------------------------------------------------------------------*/

#ifndef NITRO_WM_ARM9_WM_API_H_
#define NITRO_WM_ARM9_WM_API_H_

#ifdef __cplusplus
extern "C" {
#endif

/*===========================================================================*/

/*---------------------------------------------------------------------------*
    Constant Definitions
 *---------------------------------------------------------------------------*/
#define     WM_DEFAULT_BEACON_PERIOD    200     // ms
#define     WM_DEFAULT_SCAN_PERIOD      30      // ms


/*---------------------------------------------------------------------------*
    Function definition
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------*
  Name:         WM_Init

  Description:  Performs the Initialization process of WM library.
                Synchronous function that only initializes ARM9.

  Arguments:    wmSysBuf    -   Pointer to the buffer allocated by the callback origin
                                As much as WM_SYSTEM_BUF_SIZE is required for buffer size.
                dmaNo       -   DMA number used by WM

  Returns:      WMErrCode   -   Returns the process result.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_Init( void* wmSysBuf , u16 dmaNo );

/*---------------------------------------------------------------------------*
  Name:         WM_Finish

  Description:  Performs the termination process of WM library. Synchronous function.
                Restores the state before WM_Init function was called.

  Arguments:    None.

  Returns:      WMErrCode   -   Returns the process result.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_Finish( void );

/*---------------------------------------------------------------------------*
  Name:         WM_Enable

  Description:  Makes the wireless hardware to the usable state.
                Internal state changes from READY state to STOP state.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_Enable( WMCallbackFunc callback );

/*---------------------------------------------------------------------------*
  Name:         WM_Disable

  Description:  Changes the wireless hardware to the use prohibited state.
                Internal state changes from STOP state to READY state.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_Disable( WMCallbackFunc callback );

/*---------------------------------------------------------------------------*
  Name:         WM_PowerOn

  Description:  Starts up the wireless hardware.
                Internal state changes from STOP state to IDLE state.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_PowerOn( WMCallbackFunc callback );

/*---------------------------------------------------------------------------*
  Name:         WM_PowerOff

  Description:  Shuts down the wireless hardware.
                Internal state changes from IDLE state to STOP state.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_PowerOff( WMCallbackFunc callback );

/*---------------------------------------------------------------------------*
  Name:         WM_Initialize

  Description:  Performs the WM initialization process.

  Arguments:    wmSysBuf    -   Pointer to the buffer allocated by the callback origin.
                                As much as WM_SYSTEM_BUF_SIZE is required for buffer size.
                callback    -   Callback function that is called when asynchronous process completed.
                dmaNo       -   DMA number used by WM

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_Initialize(
    void*            wmSysBuf ,
    WMCallbackFunc   callback ,
    u16              dmaNo
);

/*---------------------------------------------------------------------------*
  Name:         WM_SetIndCallback

  Description:  Sets a function that is called to the condition notification from WM7.
                This function itself is an synchronous function.

  Arguments:    callback    -   Specifies the callback function to be call when notifying the condition from the wireless firmware.

  Returns:      WMErrCode   -   Returns the process result.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_SetIndCallback( WMCallbackFunc callback );

/*---------------------------------------------------------------------------*
  Name:         WM_SetPortCallback

  Description:  Sets a function that is called to the communication frame receiving notification from WN7.

  Arguments:    port        -   Port number
                callback    -   Callback function to be called when notify the receiving.
                arg         -   Argument that is passed to the callback function as WMPortRecvCallback.arg

  Returns:      WMErrCode   -   Returns the process result.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_SetPortCallback(
    u16             port ,
    WMCallbackFunc  callback ,
    void*           arg
);

/*---------------------------------------------------------------------------*
  Name:         WM_Reset

  Description:  Resets the wireless library, and restores the state immediately after the initialization.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_Reset( WMCallbackFunc callback );

/*---------------------------------------------------------------------------*
  Name:         WM_End

  Description:  Ends the wireless library.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_End( WMCallbackFunc callback );

/*---------------------------------------------------------------------------*
  Name:         WM_ReadStatus

  Description:  Obtains the structure that indicates the condition of the wireless library. Synchronous function.

  Arguments:    statusBuf   -   Pointer to the variable that obtains the condition.

  Returns:      WMErrCode   -   Returns the process result.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_ReadStatus( WMStatus* statusBuf );

/*---------------------------------------------------------------------------*
  Name:         WM_SetParentParameter

  Description:  Sets the parent information.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                pparaBuf    -   Pointer to the structure that indicates the parent information
                                Note that pparaBuf and the entity of pparaBuf->userGameInfo are forcibly stored in cache.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_SetParentParameter( WMCallbackFunc callback , const WMParentParam* pparaBuf );

/*---------------------------------------------------------------------------*
  Name:         WM_StartParent

  Description:  Starts the communication a parent.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_StartParent( WMCallbackFunc callback );

/*---------------------------------------------------------------------------*
  Name:         WM_EndParent

  Description:  Stops the communication as a parent.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_EndParent( WMCallbackFunc callback );

/*---------------------------------------------------------------------------*
  Name:         WM_StartScan

  Description:  Starts scanning for a parent as a child.
                Obtains one parent information with one call back.
                It can be called repeatedly without calling WM_EndScan.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                param       -   Pointer to the structure that indicates the scan information.
                                ARM7 writes the information of the scan result directly, so it needs to line up with cache line.
                                Also, note that the entity of the param structure is forcibly stored in cache.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_StartScan( WMCallbackFunc callback , const WMScanParam* param );

/*
 * As of 10/29/2004
 * We made this function to be nonpublic because the operation is not fully verified.
 */
WMErrCode   WMi_StartScanEx( WMCallbackFunc callback , const WMScanParam* param );

/*---------------------------------------------------------------------------*
  Name:         WM_EndScan

  Description:  Stops the scan process as a child.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_EndScan( WMCallbackFunc callback );

/*---------------------------------------------------------------------------*
  Name:         WM_StartConnect

  Description:  Starts the connection to the parent as a child

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                pInfo       -   Information of the parent to be connected. Specify the structure obtained with WM_StartScan.
                                Note that entity of this structure is forcibly stored in cache.
                ssid        -   Child information to notify the parent (24Byte(WM_SIZE_CHILD_SSID) fixed size)

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_StartConnect( WMCallbackFunc callback , const WMBssDesc* pInfo, const u8 *ssid );

/*---------------------------------------------------------------------------*
  Name:         WM_Disconnect

  Description:  Cuts off the communication that had been established.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                aid         -   AID of the communication target to be disconnected.
                                As for parent, disconnects individual children with ID 1 to 15.
                                As for child, cuts off the communication with the parent with ID 0.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_Disconnect( WMCallbackFunc callback , u16 aid );

/*---------------------------------------------------------------------------*
  Name:         WM_DisconnectChildren

  Description:  Disconnects each of the children which the communication has been established. Function exclusive for parent.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                aidBitmap   -   AID bit field of the child to be disconnected.
                                The lowest bit is ignored, and each of the bits 1 to 15 corresponds to the children with AID 1 to 15.
                                Bit that indicates the child that is not connected is ignored, so specify 0xFFFF for disconnecting all children
                                regardless of their connection status.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_DisconnectChildren( WMCallbackFunc callback , u16 aidBitmap );

/*---------------------------------------------------------------------------*
  Name:         WM_GetMPSendBufferSize

  Description:  Calculates MP communication send buffer size  from the current WM state.

  Arguments:    None.

  Returns:      int      - send buffer size that has to be passed to WM_StartMP
 *---------------------------------------------------------------------------*/
int WM_GetMPSendBufferSize( void );

/*---------------------------------------------------------------------------*
  Name:         WM_GetMPReceiveBufferSize

  Description:  Calculates the MP communication receive buffer size from the current WM state.

  Arguments:    None.

  Returns:      int      - receive buffer size that has to be passed to WM_StartMP
 *---------------------------------------------------------------------------*/
int WM_GetMPReceiveBufferSize( void );

/*---------------------------------------------------------------------------*
  Name:         WM_StartMP

  Description:  Starts the MP communication. Function that is common to parent and child.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                recvBuf     -   Buffer that stores the receive data.
                                Pay attention to cache because ARM7 writes data directly.
                recvBufSize -   Size of the buffer that stores the receive data
                                It needs to be larger than the return value of WM_GetReceiveBufferSize().
                sendBuf     -   Buffer that stores the send data.
                                Pay attention to cache because ARM7 writes data directly.
                sendBufSize -   Size of the buffer that stores the send data.
                                It needs to be larger than the return value of WM_GetSendBufferSize().
                mpFreq      -   How many times to perform the MP communication in one frame.
                                0 is continuous send mode. It is meaningful only with a parent.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_StartMP(
    WMCallbackFunc callback ,
    u16*            recvBuf ,
    u16             recvBufSize ,
    u16*            sendBuf ,
    u16             sendBufSize ,
    u16             mpFreq
);

/*---------------------------------------------------------------------------*
  Name:         WM_StartMPEx

  Description:  Starts the MP communication. Possible to specify the detailed operation mode. Function that is common to parent and child.

  Arguments:    callback        -   Callback function that is called when asynchronous process completed.
                recvBuf         -   Buffer that stores the receive data.
                                    Pay attention to cache because ARM7 writes data directly.
                recvBufSize     -   Size of the buffer that stores the receive data
                                    It needs to be larger than the return value of WM_GetReceiveBufferSize().
                sendBuf         -   Buffer that stores the send data.
                                    Pay attention to cache because ARM7 writes data directly.
                sendBufSize     -   Size of the buffer that stores the send data.
                                    It needs to be larger than the return value of WM_GetSendBufferSize().
                mpFreq          -   How many times to perform the MP communication in one frame.
                                    0 is continuous send mode. It is meaningful only with a parent.
                defaultRetryCount - Number of retries if the transmission failed for the communication of Port 0 to 7. 0 does not perform retries.
                minPollBmpMode  -   Operation mode that limits to the smallest collection according to the address of the packet that sends pollBitmap during MP communication.
                singlePacketMode -  Special operation mode that sends only one packet with each MP.
                fixFreqMode     -   Special operation mode that prohibits the increase of the MP communication by retries.
                                    Fixed to exactly mpFreq times for the number of times during the MP communication in a frame.

                ignoreFatalError -  Does not perform AutoDisconnect when FatalError was generated.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_StartMPEx(
    WMCallbackFunc callback ,
    u16*            recvBuf ,
    u16             recvBufSize ,
    u16*            sendBuf ,
    u16             sendBufSize ,
    u16             mpFreq ,
    u16             defaultRetryCount ,
    BOOL            minPollBmpMode ,
    BOOL            singlePacketMode ,
    BOOL            fixFreqMode ,
    BOOL            ignoreFatalError
);

/*---------------------------------------------------------------------------*
  Name:         WM_SetMPFrequency

  Description:  Switches how many times to perform the MP communication in one frame. Function exclusive for parent.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                mpFreq      -   How many times to perform the MP communication in one frame.
                                0 is continuous send mode.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_SetMPFrequency(
    WMCallbackFunc  callback ,
    u16             mpFreq
);

/*---------------------------------------------------------------------------*
  Name:         WM_SetMPData

  Description:  Reserves the data to send by MP communication. Function that is common to parent and child.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                sendData    -   Pointer to the data reserved for transmission
                                Note that the entity of this data is forcibly stored in cache.
                sendDataSize -  Size of the data to be reserved for transmission
                tmptt       -   Sets the MP packet send time if it is in continuous send mode.
                                (valid only for parent) (ignored as of 07/26/2004)
                pollbmp     -   Specifies Poll map that indicates the send destination child if in continuous send mode.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_SetMPData(
    WMCallbackFunc  callback ,
    const u16*      sendData ,
    u16             sendDataSize ,
    u16             tmptt ,
    u16             pollbmp
);

/*---------------------------------------------------------------------------*
  Name:         WM_SetMPDataToPort

  Description:  Reserves the data to send by MP communication. Function that is common to parent and child.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                sendData    -   Pointer to the data reserved for transmission
                                Note that the entity of this data is forcibly stored in cache.
                sendDataSize -  Size of the data to be reserved for transmission
                destBitmap  -   Specifies bitmap of aid that indicates the send destination child.
                port        -   Number for port to send.
                prio        -   Priority (0: Highest to 3: Lowest)

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_SetMPDataToPort(
    WMCallbackFunc  callback ,
    const u16*      sendData ,
    u16             sendDataSize ,
    u16             destBitmap ,
    u16             port ,
    u16             prio
);

/*---------------------------------------------------------------------------*
  Name:         WM_SetMPDataToPortEx

  Description:  Reserves the data to send by MP communication. Function that is common to parent and child.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                arg         -   Argument to be passed to callback
                sendData    -   Pointer to the data reserved for transmission
                                Note that the entity of this data is forcibly stored in cache.
                sendDataSize -  Size of the data to be reserved for transmission
                destBitmap  -   Specifies bitmap of aid that indicates the send destination child.
                port        -   Number for port to send.
                prio        -   Priority (0: Highest to 3: Lowest)

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_SetMPDataToPortEx(
    WMCallbackFunc  callback ,
    void*           arg ,
    const u16*      sendData ,
    u16             sendDataSize ,
    u16             destBitmap ,
    u16             port ,
    u16             prio
);

/*---------------------------------------------------------------------------*
  Name:         WM_EndMP

  Description:  Stops MP communication. Function that is common to parent and child.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_EndMP( WMCallbackFunc callback );

/*---------------------------------------------------------------------------*
  Name:         WM_StartDCF

  Description:  Starts the communication in infrastructure mode.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                recvBuf     -   Pointer to the data receive buffer
                                Pay attention to cache because ARM7 writes data directly.
                recvBufSize -   Size of the data receive buffer

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_StartDCF(
    WMCallbackFunc  callback ,
    WMDcfRecvBuf*   recvBuf ,
    u16             recvBufSize
);

/*---------------------------------------------------------------------------*
  Name:         WM_SetDCFData

  Description:  Reserves the data to be transmitted by the infrastructure mode communication.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                destAdr     -   Pointer to the buffer that indicates the MAC address of the communication target.
                sendData    -   Pointer to the data reserved for transmission
                                Note that the entity of this data is forcibly stored in cache.
                sendDataSize -  Size of the data to be reserved for transmission

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_SetDCFData(
    WMCallbackFunc  callback ,
    const u8*       destAdr ,
    const u16*      sendData ,
    u16             sendDataSize
);

/*---------------------------------------------------------------------------*
  Name:         WM_EndDCF

  Description:  Stops the communication in infrastructure mode.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_EndDCF( WMCallbackFunc callback );

/*---------------------------------------------------------------------------*
  Name:         WM_SetWEPKey

  Description:  Sets the encryption feature and encryption key.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                wepmode     -   0: no encryption feature
                                1: RC4 (40 bit) encryption mode
                                2: RC4 (104 bit) encryption mode
                                3: RC4 (128 bit) encryption mode
                wepkey      -   Pointer to the encryption key data (80 bytes).
                                Key data consists of 4 sets of data. Each of them is 20 bytes.
                                Of each 20 bytes,
                                5 bytes in 40-bit mode
                                13 bytes in 104-bit mode
                                16 bytes in 128-bit mode
                                are used.
                                Also the entity of this data is forcibly stored in cache.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_SetWEPKey(
    WMCallbackFunc  callback ,
    u16             wepmode ,
    const u16*      wepkey
);

/*---------------------------------------------------------------------------*
  Name:         WM_ReadMPData

  Description:  Extracts only the data of the specified child from the entire received data. Synchronous function.

  Arguments:    header      -   Pointer that indicates the entire received data.
                aid         -   AID of the child to extract data.

  Returns:      WMMpRecvData* - Returns a pointer to the data received from the corresponding child.
                                Returns NULL if the extraction failed.
 *---------------------------------------------------------------------------*/
WMMpRecvData*   WM_ReadMPData( const WMMpRecvHeader* header , u16 aid );

/*---------------------------------------------------------------------------*
  Name:         WM_StartDataSharing

  Description:  Enables the data sharing feature. Synchronous function.
                By performing MP communication after enabling the feature, data sharing communication can be done along with MP communication.

  Arguments:    dsInfo      -   WMDataSharingInfo structure
                port        -   Number for port to use
                aidBitmap   -   AID of the partner for data sharing.
                dataLength  -   Data length of shared memory (make sure to specify an even number of bytes.)
                doubleMode  -   Specify TRUE if using WM_StepDataSharing in every frame

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_StartDataSharing(
    WMDataSharingInfo*  dsInfo ,
    u16                 port ,
    u16                 aidBitmap ,
    u16                 dataLength,
    BOOL                doubleMode
);

/*---------------------------------------------------------------------------*
  Name:         WM_EndDataSharing

  Description:  Disables the data sharing feature. Synchronous function.

  Arguments:    dsInfo      -   WMDataSharingInfo structure

  Returns:      WMErrCode   -   Returns the process result.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_EndDataSharing( WMDataSharingInfo* dsInfo );

/*---------------------------------------------------------------------------*
  Name:         WM_StepDataSharing

  Description:  Advances the synchronicity of data sharing once. Synchronous function.

  Arguments:    dsInfo      -   WMDataSharingInfo structure.
                sendData    -   Send data to be shared.
                receiveData -   Shared data that was received.

  Returns:      WMErrCode   -   Returns the process result.
                         *_SUCCESS      : Shared data send/receive successful
                         *_NO_DATASET   : Shared data not yet received
 *---------------------------------------------------------------------------*/
WMErrCode   WM_StepDataSharing(
    WMDataSharingInfo*  dsInfo ,
    const u16*          sendData ,
    WMDataSet*          receiveData
);

/*---------------------------------------------------------------------------*
  Name:         WM_GetSharedDataAddress

  Description:  Acquires the address of a particular AID that is in received shared data.
                Synchronous function

  Arguments:    dsInfo      - WMDataSharingInfo structure
                receiveData - Shared receive data
                aid         - AID.

  Returns:      u16*        - Address of received data Returns NULL if none exists.
 *---------------------------------------------------------------------------*/
u16* WM_GetSharedDataAddress(
    WMDataSharingInfo*  dsInfo ,
    WMDataSet*          receiveData ,
    u16                 aid
);

/*---------------------------------------------------------------------------*
  Name:         WM_StartKeySharing

  Description:  Enables the key sharing feature.
                By performing MP communication after enabling the feature, key sharing communication can be done along with MP communication.


  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                buf         -   Pointer to the buffer that stores the key information
                                Pay attention to cache because ARM7 writes data directly.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_StartKeySharing( WMCallbackFunc callback , WMKeySetBuf* buf );

/*---------------------------------------------------------------------------*
  Name:         WM_EndKeySharing

  Description:  Disables the key sharing feature.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_EndKeySharing( WMCallbackFunc callback );

/*---------------------------------------------------------------------------*
  Name:         WM_GetKeySet

  Description:  Load one key set data that is key shared. Synchronous function.

  Arguments:    keySet      -   Pointer to the buffer that reads key set.
                                Specify a different buffer from the one given by WM_StartKeySharing.

  Returns:      WMErrCode   -   Returns the process result.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_GetKeySet( WMKeySet* keySet );

/*---------------------------------------------------------------------------*
  Name:         WM_SetGameInfo

  Description:  Sets the game information. Initial value is set with WM_SetParentParameter, so use it when changing the initial setting.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                gameInfo    -   Pointer to the user game information.

                gameInfoSize -  Size of the user game information.
                ggid        -   Game group ID
                tgid        -   Temporary group ID
                attr        -   Flag group. Sets the logical sum of the following flags.
                                    WM_ATTR_FLAG_ENTRY - Entry permitted
                                    WM_ATTR_FLAG_MB    - Accepting multiboot
                                    WM_ATTR_FLAG_KS    - Key sharing
                                    WM_ATTR_FLAG_CS    - Continuous transfer mode
  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_SetGameInfo(
    WMCallbackFunc  callback ,
    const u16*      gameInfo ,
    u16             gameInfoSize ,
    u32             ggid ,
    u16             tgid ,
    u8              attr
);

/*---------------------------------------------------------------------------*
  Name:         WM_SetBeaconIndication

  Description:  Switches enable/disable of the beacon send/receive indicate.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                flag        -   0: Invalid
                                1: Valid

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_SetBeaconIndication( WMCallbackFunc callback , u16 flag );

#ifdef  WM_ENABLE_TESTMODE
/*---------------------------------------------------------------------------*
  Name:         WM_StartTestMode

  Description:  Starts communication in test mode.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                signal      -   0: No modulation (data=0)
                                1: No modulation (data=1)
                                2: PN 15 steps
                                3: 01 pattern (with scramble)
                                4: 01 pattern (without scramble)
                rate        -   1: 1Mbps
                                2: 2Mbps
                channel     -   Specifies the channel to send data (1 to 14).

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_StartTestMode(
    WMCallbackFunc  callback ,
    u16             signal ,
    u16             rate ,
    u16             channel
);

/*---------------------------------------------------------------------------*
  Name:         WM_StopTestMode

  Description:  Stops communication in test mode.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_StopTestMode( WMCallbackFunc callback );

#endif

/*---------------------------------------------------------------------------*
  Name:         WM_SetLifeTime

  Description:  Sets the life time.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                tableNumber -   CAM table number that sets the life time.
                                (all tables with 0xFFFF)
                camLifeTime -   Life time of CAM (in units of 100 ms: invalid with 0xFFFF)
                frameLifeTime - Beacon interval of the life time in the frame to be set
                camLifeTime   - MP communication lifetime (100ms units. 0xFFFF for disable)
                               (in units of 100 ms: invalid with 0xFFFF)

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_SetLifeTime(
    WMCallbackFunc  callback ,
    u16             tableNumber ,
    u16             camLifeTime ,
    u16             frameLifeTime ,
    u16             mpLifeTime
);

/*---------------------------------------------------------------------------*
  Name:         WM_MeasureChannel

  Description:  Measures the status of usage of channel.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                ccaMode     -   CCA operation mode
                                0: Only carrier sense. ED threshold value is ignored.
                                1: Valid only with ED threshold value
                                2: Logical product of carrier sense and ED threshold value.
                                3: Logical sum of carrier sense and ED threshold value.
                EDThreshold -   ED threshold value (0 to 61) -60 dBm -- -80 dBm
                channel     -   Channel to investigate.
                                (Only one channel with one MeasureChannel)
                measureTime -   Time to investigate.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_MeasureChannel(
    WMCallbackFunc  callback ,
    u16             ccaMode ,
    u16             edThreshold ,
    u16             channel ,
    u16             measureTime
);

/*---------------------------------------------------------------------------*
  Name:         WM_InitWirelessCounter

  Description:  Initializes WirelessCounter.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_InitWirelessCounter( WMCallbackFunc callback );

/*---------------------------------------------------------------------------*
  Name:         WM_GetWirelessCounter

  Description:  Obtains the Wireless NIC send/receive frame count and send/receive error frame count.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_GetWirelessCounter( WMCallbackFunc callback );

/*---------------------------------------------------------------------------*
  Name:         WM_GetAllowedChannel

  Description:  Obtains the channel that was permitted to use for the communication. Synchronous function.

  Arguments:    None.

  Returns:      u16 -   Returns the bit field of the use permitted channel. The lowest bit indicates 1 channel, and
                        the highest channel indicates 16 channel. The channel with the bit set to 1 is the use permitted,
                        and the channel with the bit set to 0 is the use prohibited.
                        Normally the value with some of the bits in 1 to 13 channels set to 1 is returned.
                        When 0x0000 is returned, there is no channel that is permitted for use. Therefore, the wireless feature
                        cannot be used.
                        Also, in case the function failed, such as when it is not yet initialized, 0x8000 is returned.
 *---------------------------------------------------------------------------*/
u16 WM_GetAllowedChannel( void );

/*---------------------------------------------------------------------------*
  Name:         WM_SetEntry

  Description:  Switches accepting/refusing of a connection from a child as a parent.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                enabled     -   Entry permitted / not permitted flag. TRUE: permitted, FALSE: not permitted.

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WM_SetEntry( WMCallbackFunc callback , BOOL enabled );

/*---------------------------------------------------------------------------*
  Name:         WM_GetLinkLevel

  Description:  Gets link level during communication. This is a synchronous function.

  Arguments:    None.

  Returns:      WMLinkLevel -   Returns one of four evaluation grades for link level.
 *---------------------------------------------------------------------------*/
WMLinkLevel WM_GetLinkLevel( void );


/*---------------------------------------------------------------------------*
  Name:         WMi_SetBeaconPeriod

  Description:  Changes the beacon intervals.

  Arguments:    callback    -   Callback function that is called when asynchronous process completed.
                beaconPeriod -  Beacon interval (10 to1000 TU (1024us))

  Returns:      WMErrCode   -   Returns the process result. If the asynchronous process started normally,
                                WM_ERRCODE_OPERATING is returned, and then the result
                                of the asynchronous process is passed to the callback again.
 *---------------------------------------------------------------------------*/
WMErrCode   WMi_SetBeaconPeriod( WMCallbackFunc callback , u16 beaconPeriod );
/* Changed to nonpublic temporarily to make it a use prohibited function because a problem occurs
   when the beacon interval was changed while performing communication as of 10/18/2004.   */


/*---------------------------------------------------------------------------*
  Name:         WM_GetDispersionBeaconPeriod

  Description:  Obtains the beacon interval value that should be set to operate as a parent.
                Synchronous function.

  Arguments:    None.

  Returns:      u16 -   Beacon interval value that should be set (ms).
 *---------------------------------------------------------------------------*/
u16 WM_GetDispersionBeaconPeriod( void );

/*---------------------------------------------------------------------------*
  Name:         WM_GetDispersionScanPeriod

  Description:  Obtains the search limit time that should be set for a child to search for a parent.
                Synchronous function

  Arguments:    None.

  Returns:      u16 -   Search limit time that should be set (ms).
 *---------------------------------------------------------------------------*/
u16 WM_GetDispersionScanPeriod( void );


// for debug
void WMi_DebugPrintSendQueue( WMPortSendQueue* queue );
void WMi_DebugPrintAllSendQueue( void );
const WMStatus* WMi_GetStatusAddress( void );


/*===========================================================================*/

/*---------------------------------------------------------------------------*
  Name:         WM_SIZE_MP_PARENT_RECEIVE_BUFFER

  Description:  Calculates parent receive buffer size.

  Arguments:    childMaxSize - maximum number of bytes of data you want to receive from child
                maxEntry     - number of children you want to connect
                ksFlag       - "do/do not do Key Sharing" bool value

  Returns:      int      - receive buffer size that must be passed to the WM_StartMP
 *---------------------------------------------------------------------------*/
#define WM_SIZE_MP_PARENT_RECEIVE_BUFFER( childMaxSize, maxEntry, ksFlag ) \
            (((sizeof( WMMpRecvHeader ) - sizeof( WMMpRecvData ) + \
            ( ( sizeof( WMMpRecvData ) + (childMaxSize) + WM_HEADER_CHILD_MAX_SIZE - 2 + 2/*MACBUG*/ + ((ksFlag) ? WM_SIZE_KS_CHILD_DATA + WM_SIZE_MP_CHILD_PADDING : 0) ) * (maxEntry) ) \
             + 31) & ~0x1f) * 2)

/*---------------------------------------------------------------------------*
  Name:         WM_SIZE_MP_CHILD_RECEIVE_BUFFER

  Description:  Calculates the size of the child receive buffer.

  Arguments:    parentMaxSize - maximum byte size of data you want to receive from the parent
                ksFlag       - "do/do not do Key Sharing" bool value

  Returns:      int      - size of the receive buffer that must be passed to the WM_StartMP
 *---------------------------------------------------------------------------*/
#define WM_SIZE_MP_CHILD_RECEIVE_BUFFER( parentMaxSize, ksFlag ) \
            (((sizeof( WMMpRecvBuf ) + (parentMaxSize) + WM_HEADER_PARENT_MAX_SIZE - 4 + ((ksFlag) ? WM_SIZE_KS_PARENT_DATA + WM_SIZE_MP_PARENT_PADDING : 0) + 31) & ~0x1f) * 2)

/*---------------------------------------------------------------------------*
  Name:         WM_SIZE_MP_PARENT_SEND_BUFFER

  Description:  Calculates the size of the parent send buffer.

  Arguments:    parentMaxSize - maximum byte size of data you want to send
                ksFlag       - "do/do not do Key Sharing" bool value

  Returns:      int      - size of send buffer that must be passed to the WM_StartMP
 *---------------------------------------------------------------------------*/
#define WM_SIZE_MP_PARENT_SEND_BUFFER( parentMaxSize, ksFlag ) \
            (((parentMaxSize) + WM_HEADER_PARENT_MAX_SIZE + ((ksFlag) ? WM_SIZE_KS_PARENT_DATA + WM_SIZE_MP_PARENT_PADDING : 0) + 31) & ~0x1f)

/*---------------------------------------------------------------------------*
  Name:         WM_SIZE_MP_CHILD_SEND_BUFFER

  Description:  Calculates the size of the child send buffer.

  Arguments:    childMaxSize - maximum byte size of the data you want to send
                ksFlag       - "do/do not do Key Sharing" bool value

  Returns:      int      - size of send buffer that must be passed to the WM_StartMP
 *---------------------------------------------------------------------------*/
#define WM_SIZE_MP_CHILD_SEND_BUFFER( childMaxSize, ksFlag ) \
            (((childMaxSize) + WM_HEADER_CHILD_MAX_SIZE + ((ksFlag) ? WM_SIZE_KS_CHILD_DATA + WM_SIZE_MP_CHILD_PADDING : 0) + 31) & ~0x1f)

#define WM_SIZE_CHILD_SEND_BUFFER WM_SIZE_MP_CHILD_SEND_BUFFER
#define WM_SIZE_CHILD_RECEIVE_BUFFER WM_SIZE_MP_CHILD_RECEIVE_BUFFER
#define WM_SIZE_PARENT_SEND_BUFFER WM_SIZE_MP_PARENT_SEND_BUFFER
#define WM_SIZE_PARENT_RECEIVE_BUFFER WM_SIZE_MP_PARENT_RECEIVE_BUFFER


/*===========================================================================*/

/*---------------------------------------------------------------------------*
  Name:         WM_ConvGgid32to16

  Description:  Changes game group ID from "32 bit format" to "16 bit  X 2 format."

  Arguments:    src     -   Pointer to the change source GGID shown by 32 bit.
                dest    -   Pointer to buffer storing the GGID after change.
                            4-byte data is written at the top of this address.

  Returns:      None.
 *---------------------------------------------------------------------------*/
static inline void
WM_ConvGgid32to16( u32* src , u16* dst )
{
    dst[ 0 ] = (u16)( *src & 0x0000ffff );
    dst[ 1 ] = (u16)( *src >> 16 );
}

/*---------------------------------------------------------------------------*
  Name:         WM_ConvGgid16to32

  Description:  Converted game group ID from 16-bit x 2 type to 32 bit type.

  Arguments:    src     -   Pointer to the conversion source GGID that is expressed by 16 bit arrays.
                dest    -   Pointer to the buffer that will hold the converted GGID
                            4-byte data will be written, beginning from this address.

  Returns:      None.
 *---------------------------------------------------------------------------*/
static inline void
WM_ConvGgid16to32( u16* src , u32* dst )
{
    *dst = ( (u32)src[ 1 ] << 16 ) | src[ 0 ];
}

/*---------------------------------------------------------------------------*
  Name:         WM_IsBssidEqual

  Description:  Checks whether 2 BSSID are equal.

  Arguments:    idp1     -   Pointer to a BSSID that will be compared
                idp2     -   Pointer to a BSSID that will be compared

  Returns:      Returns TRUE if they are equal.
                Returns FALSE if they differ.
 *---------------------------------------------------------------------------*/
static inline BOOL
WM_IsBssidEqual( const u8* idp1 , const u8* idp2 )
{
    return ( ( *(u16*)idp1 == *(u16*)idp2 ) &&
             ( *(u16*)(idp1 + 2) == *(u16*)(idp2 + 2) ) &&
             ( *(u16*)(idp1 + 4) == *(u16*)(idp2 + 4) ) );
}

/*---------------------------------------------------------------------------*
  Name:         WM_CopyBssid

  Description:  Copies BSSID.

  Arguments:    src     -   Pointer to the BSSID copy source
                dest     -   Pointer to the BSSID copy destination

  Returns:      None.
 *---------------------------------------------------------------------------*/
static inline void
WM_CopyBssid( const u8* src , u8* dst )
{
    *(u16*)dst       = *(u16*)src;
    *(u16*)(dst + 2) = *(u16*)(src + 2);
    *(u16*)(dst + 4) = *(u16*)(src + 4);
}


/*===========================================================================*/

#ifdef  __cplusplus
}       /* extern "C" */
#endif

#endif  /* NITRO_WM_ARM9_WM_API_H_ */

/*---------------------------------------------------------------------------*
  End of file
 *---------------------------------------------------------------------------*/
