Example #1
0
/* call-seq:
 * c = Xmms::Collection.new(type)
 *
 * Returns a new Xmms::Collection object of type _type_.
 */
static VALUE
c_coll_init (VALUE self, VALUE type)
{
	COLL_METHOD_HANDLER_HEADER

	coll->real = xmmsc_coll_new (check_uint32 (type));

	return self;
}
Example #2
0
File: testCSR.c Project: 8l/pulpino
void check_csr_op(testresult_t *result, void (*start)(), void (*stop)()) {
  unsigned int act = 0;
  unsigned int last = 0;
  unsigned int i;

  //-----------------------------------------------------------------
  // Check CSRRW
  //-----------------------------------------------------------------
  for(i = 0; i < (sizeof(g_csrrw_a)/4); i++) {
    // update and read CSR
    util_csrrw("mepc", g_csrrw_a[i], last);
    util_csrr ("mepc", act);

    // check write
    check_uint32(result, "csrrw", act, g_csrrw_exp[i]);
    // check previous content
    if (i != 0)
      check_uint32(result, "csrrw_prev", last, g_csrrw_exp[i-1]);
  }

  //-----------------------------------------------------------------
  // Check CSRRS
  //-----------------------------------------------------------------
  util_csrrw("mepc", 0, last);

  for(i = 0; i < (sizeof(g_csrrs_a)/4); i++) {
    // update and read CSR
    util_csrrs("mepc", g_csrrs_a[i], last);
    util_csrr ("mepc", act);

    // check write
    check_uint32(result, "csrrs", act, g_csrrs_exp[i]);
    // check previous content
    if (i != 0)
      check_uint32(result, "csrrs_prev", last, g_csrrs_exp[i-1]);
  }

  //-----------------------------------------------------------------
  // Check CSRRC
  //-----------------------------------------------------------------
  util_csrrw("mepc", 0xffffffff, last);

  for(i = 0; i < (sizeof(g_csrrc_a)/4); i++) {
    // update and read CSR
    util_csrrc("mepc", g_csrrc_a[i], last);
    util_csrr ("mepc", act);

    // check write
    check_uint32(result, "csrrc", act, g_csrrc_exp[i]);
    // check previous content
    if (i != 0)
      check_uint32(result, "csrrc_prev", last, g_csrrc_exp[i-1]);
  }
}