NVRAM read/write functions.
This commit is contained in:
parent
ab68dc3e40
commit
a2ded1ab73
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pm_direct.c,v 1.4 1999/06/22 11:29:11 tsubai Exp $ */
|
||||
/* $NetBSD: pm_direct.c,v 1.5 1999/06/22 13:12:11 tsubai Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 Takashi Hamada
|
||||
|
@ -96,8 +96,8 @@ signed char pm_send_cmd_type[] = {
|
|||
0x00, 0x00, -1, -1, -1, -1, -1, 0x00,
|
||||
-1, 0x00, 0x02, 0x01, 0x01, -1, -1, -1,
|
||||
0x00, -1, -1, -1, -1, -1, -1, -1,
|
||||
0x04, 0x14, -1, -1, -1, -1, -1, -1,
|
||||
0x00, 0x00, 0x02, -1, -1, -1, -1, -1,
|
||||
0x04, 0x14, -1, 0x03, -1, -1, -1, -1,
|
||||
0x00, 0x00, 0x02, 0x02, -1, -1, -1, -1,
|
||||
0x01, 0x01, -1, -1, -1, -1, -1, -1,
|
||||
0x00, 0x00, -1, -1, -1, -1, -1, -1,
|
||||
0x01, 0x00, 0x02, 0x02, -1, 0x01, 0x03, 0x01,
|
||||
|
@ -133,7 +133,7 @@ signed char pm_receive_cmd_type[] = {
|
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x05, 0x15, -1, -1, -1, -1, -1, -1,
|
||||
0x05, 0x15, -1, 0x02, -1, -1, -1, -1,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x02, 0x02, -1, -1, -1, -1, -1, -1,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
@ -1199,3 +1199,34 @@ pm_set_date_time(time)
|
|||
bcopy(&time, p.data, 4);
|
||||
pmgrop(&p);
|
||||
}
|
||||
|
||||
int
|
||||
pm_read_nvram(addr)
|
||||
int addr;
|
||||
{
|
||||
PMData p;
|
||||
|
||||
p.command = PMU_READ_NVRAM;
|
||||
p.num_data = 2;
|
||||
p.s_buf = p.r_buf = p.data;
|
||||
p.data[0] = addr >> 8;
|
||||
p.data[1] = addr;
|
||||
pmgrop(&p);
|
||||
|
||||
return p.data[0];
|
||||
}
|
||||
|
||||
void
|
||||
pm_write_nvram(addr, val)
|
||||
int addr, val;
|
||||
{
|
||||
PMData p;
|
||||
|
||||
p.command = PMU_WRITE_NVRAM;
|
||||
p.num_data = 3;
|
||||
p.s_buf = p.r_buf = p.data;
|
||||
p.data[0] = addr >> 8;
|
||||
p.data[1] = addr;
|
||||
p.data[2] = val;
|
||||
pmgrop(&p);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pm_direct.h,v 1.2 1999/06/16 07:43:58 tsubai Exp $ */
|
||||
/* $NetBSD: pm_direct.h,v 1.3 1999/06/22 13:12:11 tsubai Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 Takashi Hamada
|
||||
|
@ -44,7 +44,12 @@ typedef struct {
|
|||
char data[32]; /* data buffer (is it too much?) */
|
||||
} PMData;
|
||||
|
||||
int pmgrop(PMData *);
|
||||
int pmgrop __P((PMData *));
|
||||
void pm_adb_restart __P((void));
|
||||
void pm_read_date_time __P((u_long *));
|
||||
void pm_set_date_time __P((u_long));
|
||||
int pm_read_nvram __P((int));
|
||||
void pm_write_nvram __P((int, int));
|
||||
|
||||
/* PMU commands */
|
||||
#define PMU_POWER_OFF 0x7e /* Turn Power off */
|
||||
|
|
Loading…
Reference in New Issue