Ejemplo n.º 1
0
static void acpi_test(int ac, char **av)
{
    unsigned int i;
    unsigned int k;

    unsigned int sleep_gpio_save[13];
    ls1a_save_gpio_val(sleep_gpio_save);

    suspend_save();

    i = strtoul(av[1], 0, 0);
//	printf ("you set %d for test !\n", i);
    if (i & 1)
        *(volatile unsigned int *)0xbfe7c004 = 1 << 8;	//power button
    k = *(volatile unsigned int *)0xbfe7c024;
    k &= ~((1 << 8) | (1 << 9));
    *(volatile unsigned int *)0xbfe7c024 = (i & 0x3) << 8;	//[8:9]RI_EN、PME_EN
//	*(volatile unsigned int *)0xbfe7c008 = (1 << 13) | (5 << 10);	//sleep to ram
    flushcache();

    __asm__ volatile (
        "la	$2, 2f\n\t"
        "li	$3, 0xa01ffc00\n\t"
        "sw	$2, 0x0($3)\n\t"		//save return address
        "li	$2, 0xaffffe34\n\t"
        "lw	$3, 0x0($2)\n\t"
        "or	$3, 0x1\n\t"
        "sw	$3, 0x0($2)\n\t"	//enable ddr autorefresh
        "li	$2, 0xbfe7c008\n\t"
        "li	$3, (1<<13) | (5<<10)\n\t"
        "sw	$3, 0x0($2)\n\t"		//go to sleep
        "1:\n\t"
        "bal 1b\n\t"
        "nop\n\t"
        "2:\n\t"
        ::
        : "$2","$3","memory"
//			"move %0,$2\n\t"
//			: "=r" (p)
//			: "0" (p), "r" (len), "r" (1)
//			: "$2","$3","$4","$5"
    );

    ls1a_restore_gpio_val(sleep_gpio_save);
    dc_init();
    outstring("acpi resume back here !\n");
//	printf ("acpi resume back here !\n");

}
Ejemplo n.º 2
0
NOINLINE int32_t upb_pbdecoder_checktag_slow(upb_pbdecoder *d,
                                             uint64_t expected) {
  uint64_t data = 0;
  size_t bytes = upb_value_size(expected);
  size_t read = peekbytes(d, &data, bytes);
  if (read == bytes && data == expected) {
    // Advance past matched bytes.
    int32_t ok = getbytes(d, &data, read);
    UPB_ASSERT_VAR(ok, ok < 0);
    return DECODE_OK;
  } else if (read < bytes && memcmp(&data, &expected, read) == 0) {
    return suspend_save(d);
  } else {
    return DECODE_MISMATCH;
  }
}
Ejemplo n.º 3
0
// Slow path for getting the next "bytes" bytes, regardless of whether they are
// available in the current buffer or not.  Returns a status code as described
// in decoder.int.h.
static NOINLINE int32_t getbytes_slow(upb_pbdecoder *d, void *buf,
                                      size_t bytes) {
  const size_t avail = curbufleft(d);
  consumebytes(d, buf, avail);
  bytes -= avail;
  assert(bytes > 0);
  if (in_residual_buf(d, d->ptr)) {
    advancetobuf(d, d->buf_param, d->size_param);
  }
  if (curbufleft(d) >= bytes) {
    consumebytes(d, buf + avail, bytes);
    return DECODE_OK;
  } else if (d->data_end == d->delim_end) {
    seterr(d, "Submessage ended in the middle of a value or group");
    return upb_pbdecoder_suspend(d);
  } else {
    return suspend_save(d);
  }
}