/******************************************************************************/
/*                 Copyright C 1998-2002 Broadcom Corporation                 */
/*                                                                            */
/* This material is the confidential trade secret and proprietary information */
/* of Broadcom Corporation.  It may not be reproduced, used, sold or          */
/* transferred to any third party without the prior written consent of        */
/* Broadcom Corporation.   All rights reserved.                               */
/******************************************************************************/
/*   FileName        : bcm_devObject.h                                        */
/*   Purpose         : Header for the dev object                              */
/*   Limitations     : None                                                   */
/*   Author          : Emmanuel Hanssens                                      */
/*   Creation Date   : 04-Apr-2002                                            */
/*   History         : Compiled by RCS                                        */
/******************************************************************************/
/*   $Id: bcm_devObject.h,v 1.11 2004/09/23 07:12:18 hanssens Exp $  */
/******************************************************************************/
#ifndef BCM_DEV_OBJECT_H
# define BCM_DEV_OBJECT_H

# include "bcm_userdef.h"
# include "bcm_types.h"
# include "bcm_hmiQA.h"
# include "bcm_timer.h"
# include "bcm_hmiCoreMsg.h"

# define getDevPtr(dev)     (&devObjects[dev])

/* {{{ semaphore macros: empties as this minimal version is for no OS */

# define CREATE_DEV_OBJECT_SEMAPHORE(name, devPtr)

# define LOCK_DEV_OBJECT(devPtr)

# define RELEASE_DEV_OBJECT(devPtr)

# define CREATE_DEV_ACCESS_SEMAPHORE(name, devPtr)

# define LOCK_DEVICE_ACCESS(devPtr)

# define RELEASE_DEVICE_ACCESS(devPtr)

# define PAUSE_FOR_ONE_SECOND(devPtr) \
         {MyTime pauseTime = {1, 0};  \
          goSleep(pauseTime); }

/* }}} */

typedef enum {DEVICE_IDLE         = 0,
              DEVICE_BOOTING      = 1,
              DEVICE_BOOTER_READY = 2,
              DEVICE_FW_READY     = 3,
              DEVICE_HMI_READY    = 4} DevState;

struct DevObject
{
  uint8                         devId;
  DevState                      devState;
  HmiDev                       *hmiDev;
  LineObject                   *linePtr; /* line 0 of this device */
  GetFirmwareVersionInfoMsgRep  fwVersion;
};

/* global objects */
extern DevObject  devObjects[];

void initDevObject(uint8 devId);

#endif
