aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_tbuf.c
blob: b47cde286756b55a6dd0ff1a56c9221e05f0ed71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/******************************************************************************
 * xc_tbuf.c
 * 
 * API for manipulating and accessing trace buffer parameters
 * 
 * Copyright (c) 2005, Rob Gardner
 */

#include "xc_private.h"

int xc_tbuf_enable(int xc_handle, int enable)
{
  dom0_op_t op;

  op.cmd = DOM0_TBUFCONTROL;
  op.interface_version = DOM0_INTERFACE_VERSION;
  if (enable)
    op.u.tbufcontrol.op  = DOM0_TBUF_ENABLE;
  else
    op.u.tbufcontrol.op  = DOM0_TBUF_DISABLE;
  
  return xc_dom0_op(xc_handle, &op);
}

int xc_tbuf_set_size(int xc_handle, uint32_t size)
{
  dom0_op_t op;

  op.cmd = DOM0_TBUFCONTROL;
  op.interface_version = DOM0_INTERFACE_VERSION;
  op.u.tbufcontrol.op  = DOM0_TBUF_SET_SIZE;
  op.u.tbufcontrol.size = size;
  
  return xc_dom0_op(xc_handle, &op);
}
  
int xc_tbuf_get_size(int xc_handle, uint32_t *size)
{
  int rc;
  dom0_op_t op;

  op.cmd = DOM0_TBUFCONTROL;
  op.interface_version = DOM0_INTERFACE_VERSION;
  op.u.tbufcontrol.op  = DOM0_TBUF_GET_INFO;

  rc = xc_dom0_op(xc_handle, &op);
  if (rc == 0)
    *size = op.u.tbufcontrol.size;
  return rc;
}