コード例 #1
0
ファイル: dsrlp_stats.c プロジェクト: bgtwoigu/1110
/*===========================================================================

FUNCTION DSRLP_LOG_TX_INIT_FRM_BUF

DESCRIPTION
  Initializes the dsrlp_log_tx_rlp_frm_buf structure

DEPENDENCIES
  None.

RETURN VALUE
  None.

SIDE EFFECTS
  None.

===========================================================================*/
void dsrlp_log_tx_init_frm_buf (void)
{
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  /*-------------------------------------------------------------------------
    Initialize RLP frames logging buffer
  -------------------------------------------------------------------------*/
  dsrlp_log_tx_rlp_frm_buf.hdr.code = LOG_RLP_TX_FRAMES_C;
  dsrlp_log_tx_rlp_frm_buf.hdr.len  = FPOS(log_rlp_frames_type, var_len_buf);
  dsrlp_log_tx_rlp_frm_buf.count    = 0;

}/* dsrlp_log_tx_init_frm_buf() */
コード例 #2
0
ファイル: dsrlp_stats.c プロジェクト: bgtwoigu/1110
/*===========================================================================

FUNCTION DSRLP_LOG_TX_INIT_FRAME

DESCRIPTION
  This function initializes the next frame packet, as well as the
  pointer to it, in the RLP Tx frames log buffer.

DEPENDENCIES
  None.

RETURN VALUE
  Pointer to frame log entry.

SIDE EFFECTS
  An RLP Tx partial frames log may be sent.

===========================================================================*/
log_rlp_pkt_type * dsrlp_log_tx_init_frame(void)
{
  log_rlp_pkt_type *frm_ptr = NULL;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

  /*-------------------------------------------------------------------------
    If logging is enabled.   
  -------------------------------------------------------------------------*/
  if (log_status(dsrlp_log_tx_rlp_frm_buf.hdr.code))
  {
    /*-----------------------------------------------------------------------
      If already exceeding threshold for RLP bytes, log it.   
    -----------------------------------------------------------------------*/
    if (dsrlp_log_tx_rlp_frm_buf.hdr.len >= LOG_RLP_FRM_BUF_THRESHOLD)
    {
      dsrlp_log_tx_send_frames();
    }

    /*-----------------------------------------------------------------------
      Set up log entry for RLP frames    
    -----------------------------------------------------------------------*/
    frm_ptr = (log_rlp_pkt_type *)
    &dsrlp_log_tx_rlp_frm_buf.var_len_buf.buf_ref[DSRLP_LOG_TX_FRAMES_OFFSET];

    if (frm_ptr == &dsrlp_log_tx_rlp_frm_buf.var_len_buf.pkt[0])
    {
      /*---------------------------------------------------------------------
        First frame, log time stamp. 
      ---------------------------------------------------------------------*/
      ts_get((unsigned long *) dsrlp_log_tx_rlp_frm_buf.hdr.ts);
    }

    /*-----------------------------------------------------------------------
      Update packet length 
    -----------------------------------------------------------------------*/
    dsrlp_log_tx_rlp_frm_buf.hdr.len += FPOS(log_rlp_pkt_type, payload);

    /*-----------------------------------------------------------------------
      # of frames in packet   
    -----------------------------------------------------------------------*/
    dsrlp_log_tx_rlp_frm_buf.count++;

    /*-----------------------------------------------------------------------
      Set reserved fields to 0    
    -----------------------------------------------------------------------*/
    frm_ptr->mux_chan.rsvd  = 0;
    frm_ptr->time_rate.rsvd = 0;
  }

  return frm_ptr;

} /* dsrlp_log_tx_init_frame() */
コード例 #3
0
ファイル: dsrlp_stats.c プロジェクト: bgtwoigu/1110
/*===========================================================================

FUNCTION DSRLP_LOG_TX_SEND_FRAMES

DESCRIPTION
  Terminate and send the accumulated RLP Tx partial frames log.

DEPENDENCIES
  None.

RETURN VALUE
  None.

SIDE EFFECTS
  An RLP Tx partial frames log may be sent.

===========================================================================*/
void dsrlp_log_tx_send_frames (void)
{
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  /*-------------------------------------------------------------------------
    Only send log if there is data in the buffer
  -------------------------------------------------------------------------*/
  if (dsrlp_log_tx_rlp_frm_buf.hdr.len > FPOS(log_rlp_frames_type, var_len_buf))
  {
    (void) log_submit((log_type *) &dsrlp_log_tx_rlp_frm_buf);

    /*-----------------------------------------------------------------------
      Re-initialize 
    -----------------------------------------------------------------------*/
    dsrlp_log_tx_init_frm_buf();
  }

} /* dsrlp_log_tx_send_frames() */
コード例 #4
0
ファイル: alchemy3d.c プロジェクト: dreamsxin/zero3d
AS3_Val initialize3DS( void* self, AS3_Val args )
{
	FILE * file;
	void * dest;
	Entity * entity;
	A3DS * a3ds;
	DWORD render_mode;

	AS3_ArrayValue(args, "AS3ValType, PtrType, IntType", &dest, &entity, &render_mode);

	file = funopen((void *)dest, readByteArray, writeByteArray, seekByteArray, closeByteArray);

	a3ds = A3DS_Create( file, entity, render_mode );

	return AS3_Array( "PtrType, IntType, IntType, PtrType, IntType, IntType, IntType", a3ds, a3ds->mNum, a3ds->tNum, a3ds->a3d_materialList->next, FPOS( A3DS_MaterialList, next ), FPOS( A3DS_MaterialList, texture ), FPOS( Texture, name ) );
}
コード例 #5
0
/*===========================================================================

FUNCTION LOG_ALLOC

DESCRIPTION
  This function allocates a buffer of size 'length' for logging data.  The
  specified length is the length of the entire log, including the log
  header.  This operation is inteneded only for logs that do not require
  data accumulation.

  !!! The header is filled in automatically by this routine.

DEPENDENCIES:
   Diag log service must be initialized.
   log_commit() or log_free() must be called ASAP after this call.

RETURN VALUE
  A pointer to the allocated buffer is returned on success.
  If the log code is disabled or there is not enough space, NULL is returned.

SIDE EFFECTS
  Since this allocation is made from a shared resource pool, log_commit()
  or log_free() must be called as soon as possible and in a timely fashion.
  This allocation system has no garbage collection.  Calling this routine
  places the log buffer in a FIFO queue.  If you hold the pointer for a
  significant period of time, the diag task will be blocked waiting for
  you to call log_commit().

  If you need to log accumulated data, store the accumulated data in your
  own memory space and use log_submit() to log the data.
===========================================================================*/
PACK(void *) log_alloc (
   log_code_type code,
   unsigned int length
)
{
   diag_log_rsp_type *plog_pkt_ptr; /* Pointer to packet being created */
   log_header_type *phdr_ptr = NULL;
   void *return_ptr = NULL;
   uint32 enabled_mask = 0;

   if(-1 == fd || !log_inited)
   {
      return NULL;
   }
  if (length <= sizeof(log_header_type))
  {
     DIAG_LOGE(" Alloc invalid length %d", length);
  }
  else if ((enabled_mask = log_status_mask(code)) != 0)
  {
    /*------------------------------------------------
     Allocate enough for entire LOG response packet,
     not just the log given.
    ------------------------------------------------*/

     /*WM7 prototyping: need to allocate bytes that indicate diag data type,.*/
      plog_pkt_ptr = (diag_log_rsp_type *) DiagSvc_Malloc
          (DIAG_REST_OF_DATA_POS + FPOS (diag_log_rsp_type, log) + length, GEN_SVC_ID);

      if (plog_pkt_ptr != NULL)
      {
          byte* temp = (byte*)plog_pkt_ptr;
          diag_data* pdiag_data = (diag_data*) plog_pkt_ptr;
          //Prototyping Diag 1.5 WM7:Fill in the fact that this is a log.
	  pdiag_data->diag_data_type = enabled_mask;
          //Prototyping Diag 1.5 WM7:Advance the pointer to point to the log_header_type part
          temp += DIAG_REST_OF_DATA_POS;
          plog_pkt_ptr = (diag_log_rsp_type*)temp;

          plog_pkt_ptr->cmd_code = DIAG_LOG_F;
          phdr_ptr = (log_header_type *) &(plog_pkt_ptr->log);
          ts_get_lohi(&(phdr_ptr->ts_lo), &(phdr_ptr->ts_hi));
          phdr_ptr->len = (uint16)length;
          phdr_ptr->code = code;

         /* Fill in top of packet. */
          plog_pkt_ptr->more = 0;
          plog_pkt_ptr->len  = (uint16)length;

          return_ptr = (void *) &(plog_pkt_ptr->log);
      }
      else
      {
         /* Dropped a log. */
         //MSG_LOW("Dropped log 0x%x", code, 0, 0);
         /*  WM7 prototyping */
         DIAG_LOGE(" Dropped log 0x%x", code);
      }

  } /* if valid and enabled */

  // removed masking for Phase I
  else
  {
     //printf("log_alloc: mask check returned FALSE \n");
  }

  return return_ptr;

} /* log_alloc */