/******************************************************************************/
/*                       Copyright 2001 Broadcom Corporation                  */
/*                                                                            */
/* This material is the confidential trade secret and proprietary information */
/* of Broadcom Corp.  It may not be reproduced, used, sold or transferred to  */
/* any third party without the prior written consent of Broadcom Corp.        */
/* All rights reserved.                                                       */
/******************************************************************************/
/*   FileName        : bcm_hostFunctions.h                                    */
/*   Purpose         : Header for all available host functions                */
/*   Limitations     : None                                                   */
/*   Author          : Emmanuel Hanssens                                      */
/*   Creation Date   : 17-Sep-2001                                            */
/*   History         : Compiled by CVS                                        */
/******************************************************************************/
/*   $Id: bcm_hostFunctions.h,v 1.13 2004/06/22 13:51:03 hanssens Exp $  */
/******************************************************************************/
#ifndef HOST_FUNCTIONS_H
# define HOST_FUNCTIONS_H

# include "bcm_userdef.h"
# include "bcm_types.h"

/* FP_RQST_HOST_INT_REG bits signification */
# define INTERRUPT_WATCHDOG_TIMER         (1<<0) /* bit 0 is watchdog timer */
# define INTERRUPT_DEVICE_READY           (1<<1) /* bit 1 is device ready */
# define INTERRUPT_DEVICE_MAJOR_EXCEPTION (1<<2) /* bit 2 is major exception */
# define INTERRUPT_DEVICE_MINOR_EXCEPTION (1<<3) /* bit 3 is minor exception */
# define INTERRUPT_BOOTER_READY           (1<<4) /* bit 4 is booter ready */
# define INTERRUPT_REPLY_AVAILABLE        (1<<6) /* bit 6 is HMI reply avbl */


# ifndef NO_FULL_ERROR_HANDLING
/* error codes */
#  define EHOSTMAXP 1
#  define EHOSTINTO 2
#  define EHOSTBTRD 3

extern const char * hostErr[];
# endif

typedef struct HostDev HostDev;
struct HostDev
{
  uint16 devId;
};

void     hostDriverInit          (void);
HostDev *hostOpen                (uint16 bcm6410Id);
void     hostInit                (HostDev  *dev);
void     hostClose               (HostDev *dev);
void     hostResetBCM6410        (HostDev  *dev);
void     hostEnableBCM6410       (HostDev  *dev);
uint8    hostReadInterruptStatus (HostDev  *dev);
uint8    hostReadPage            (HostDev *dev);
uint32   hostReadChipId          (HostDev *dev);
void     hostSetPage             (HostDev *dev, uint8 page);
uint8    hostPROMonBoard         (HostDev *dev);
int      hostIsBCM6410enabled    (HostDev *dev);
void     hostWriteImage          (HostDev  *dev, 
                                  uint8     firstPageIndex, 
                                  uint8    *image, 
                                  uint32    imageSize);
void     hostGetSelfTest         (HostDev  *dev,
                                  SelfTest *selfTest);
int      hostDumpMemLong(HostDev  *dev,
                         uint32    memAddr,
                         uint8    *data);

#endif
