Commit d7ce296f57740c076279fd6a0282bea255ec0842

Authored by bellard
1 parent f8407028

power down support + date fix (Thayne Harbaugh)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1275 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 10 additions and 1 deletions
hw/cuda.c
... ... @@ -87,6 +87,9 @@
87 87 #define CUDA_TIMER_FREQ (4700000 / 6)
88 88 #define CUDA_ADB_POLL_FREQ 50
89 89  
  90 +/* CUDA returns time_t's offset from Jan 1, 1904, not 1970 */
  91 +#define RTC_OFFSET 2082844800
  92 +
90 93 typedef struct CUDATimer {
91 94 unsigned int latch;
92 95 uint16_t counter_value; /* counter value at load time */
... ... @@ -503,7 +506,7 @@ static void cuda_receive_packet(CUDAState *s,
503 506 break;
504 507 case CUDA_GET_TIME:
505 508 /* XXX: add time support ? */
506   - ti = time(NULL);
  509 + ti = time(NULL) + RTC_OFFSET;
507 510 obuf[0] = CUDA_PACKET;
508 511 obuf[1] = 0;
509 512 obuf[2] = 0;
... ... @@ -522,6 +525,12 @@ static void cuda_receive_packet(CUDAState *s,
522 525 obuf[1] = 0;
523 526 cuda_send_packet_to_host(s, obuf, 2);
524 527 break;
  528 + case CUDA_POWERDOWN:
  529 + obuf[0] = CUDA_PACKET;
  530 + obuf[1] = 0;
  531 + cuda_send_packet_to_host(s, obuf, 2);
  532 + qemu_system_shutdown_request();
  533 + break;
525 534 default:
526 535 break;
527 536 }
... ...