/****************************************************************************
*
*	Name:			BlDefs.c
*
*	Description:	Bootloader definitions.
*
*	Copyright:		(c) 1999 Conexant Systems Inc.
*
*	Revision:	Date:		Author:				Description:
*
*	00.00.0000	01/01/00	George G. Vlasov	Created.
*	Linux-1.0	May 29 2002	Shen Wei Wang			Modified.
*					shenwei.wang@conexant.com
*
*****************************************************************************
*	$Author:   Shen Wei Wang  $
*	$Revision:   1.0  $
*	$Modtime:   May 29 2002 10:30:48  $
****************************************************************************/

#ifndef BLDEFS_H
#define BLDEFS_H

#include "ntdef.h"
/****************************************************************************
*  Helper definitions
****************************************************************************/



#define BL_MEMORY_WRITE_DWORD(DeviceObject, dwMemoryAddress, dwValue, pdwTemp)	\
(																				\
	*(pdwTemp) = (dwValue),														\
																				\
	BlMemoryWrite																\
	(																			\
		(DeviceObject), 														\
		(dwMemoryAddress), 														\
		(pdwTemp), 																\
		sizeof(DWORD), 															\
		MA_DWORD																\
	) 																			\
)																				\

#define BL_MEMORY_WRITE_BYTE(DeviceObject, dwMemoryAddress, cValue, pcTemp)	\
(																				\
	*(pcTemp) = (cValue),														\
																				\
	BlMemoryWrite																\
	(																			\
		(DeviceObject), 														\
		(dwMemoryAddress), 														\
		(pcTemp), 																\
		sizeof(BYTE), 															\
		MA_BYTE																\
	) 																			\
)	

/****************************************************************************
*  Constant definitions
****************************************************************************/

/****************************************************************************
*  Type definitions
****************************************************************************/

typedef enum
{
	MA_BYTE,
	MA_WORD,
	MA_DWORD
} BL_MEMORY_ACCESS;

/****************************************************************************
*  Function prototypes
****************************************************************************/

NTSTATUS 
USBADSL_ProcessMPXFR
(
    IN PDEVICE_OBJECT DeviceObject,
    IN PCHAR buffer,
    IN ULONG count,
    IN MINIPORTCOMPLETIONROUTINE  CallBack,
    IN PVOID MPContext,
    IN ULONG pipeNumber,
    IN BOOLEAN   IOFlag
);

BOOLEAN
BlMemoryWrite
(
	IN PDEVICE_OBJECT	DeviceObject, 
	DWORD				dwAddress, 
	PVOID				pBuffer, 
	ULONG				uSize, 
	BL_MEMORY_ACCESS				uAccessType
);

DWORD 
BlCalculateChecksum
(
	PBYTE	pBuffer, 
	ULONG	uSize
);

BOOLEAN
BlVerifyChecksum
(
	IN PDEVICE_OBJECT	DeviceObject, 
	DWORD				dwChecksum, 
	DWORD				dwAddress, 
	ULONG				uSize
);

BOOLEAN
BlGoToAddress
(
	IN PDEVICE_OBJECT	DeviceObject, 
	DWORD				dwAddress
);

BOOLEAN
BlDelay
(
	IN	ULONG	uInterval	/* milliseconds */ 
);

BOOLEAN
FwLoad
(
	IN PDEVICE_OBJECT	DeviceObject
);

BOOLEAN
FwPostLoad
(
	IN PDEVICE_OBJECT	DeviceObject
);

BOOLEAN
FwPreLoad
(
	IN PDEVICE_OBJECT	DeviceObject
);

#endif //BLDEFS_H


