plan 9 kernel history: overview | file list | diff list

2000/0516/mpc/devrtc.c (diff list | history)

1999/0618/sys/src/9/mpc/devrtc.c:11,162000/0516/sys/src/9/mpc/devrtc.c:11,17 (short | long | prev | next)
1999/0121    
	Qrtc = 1, 
1999/0608    
	Qnvram, 
1999/0612    
	Qnvram2, 
2000/0516    
	Qled, 
1999/0121    
 
	/* sccr */ 
	RTDIV=	1<<24, 
1999/0618/sys/src/9/mpc/devrtc.c:29,392000/0516/sys/src/9/mpc/devrtc.c:30,40
1999/0121    
static	QLock	rtclock;		/* mutex on clock operations */ 
1999/0608    
static Lock nvrtlock; 
1999/0121    
 
1999/0608    
                 
1999/0121    
static Dirtab rtcdir[]={ 
	"rtc",		{Qrtc, 0},	12,	0666, 
1999/0608    
	"nvram",	{Qnvram, 0},	Nvsize,	0664, 
1999/0612    
	"nvram2",	{Qnvram2, 0},	Nvsize,	0664, 
2000/0516    
	"led",	{Qled, 0},	0,	0664, 
1999/0121    
}; 
#define	NRTC	(sizeof(rtcdir)/sizeof(rtcdir[0])) 
 
1999/0618/sys/src/9/mpc/devrtc.c:77,822000/0516/sys/src/9/mpc/devrtc.c:78,84
1999/0121    
	omode = openmode(omode); 
	switch(c->qid.path){ 
	case Qrtc: 
2000/0516    
	case Qled: 
1999/0121    
		if(strcmp(up->user, eve)!=0 && omode!=OREAD) 
			error(Eperm); 
		break; 
1999/0618/sys/src/9/mpc/devrtc.c:108,1132000/0516/sys/src/9/mpc/devrtc.c:110,116
1999/0121    
		n = readnum(offset, buf, n, t, 12); 
		return n; 
1999/0608    
	case Qnvram: 
2000/0516    
		return 0; 
1999/0608    
		if(offset >= Nvsize) 
			return 0; 
		t = offset; 
1999/0618/sys/src/9/mpc/devrtc.c:118,1232000/0516/sys/src/9/mpc/devrtc.c:121,127
1999/0608    
		iunlock(&nvrtlock); 
		return n; 
1999/0612    
	case Qnvram2: 
2000/0516    
		return 0; 
1999/0612    
		if(offset >= Nvsize2) 
			return 0; 
		t = offset; 
1999/0618/sys/src/9/mpc/devrtc.c:127,1322000/0516/sys/src/9/mpc/devrtc.c:131,138
1999/0612    
		memmove(buf, (uchar*)(NVRAMMEM + Nvoff2 + t), n); 
		iunlock(&nvrtlock); 
		return n; 
2000/0516    
	case Qled: 
		return 0; 
1999/0121    
	} 
	error(Egreg); 
	return 0;		/* not reached */ 
1999/0618/sys/src/9/mpc/devrtc.c:165,1702000/0516/sys/src/9/mpc/devrtc.c:171,177
1999/0121    
		iopunlock(); 
		return n; 
1999/0608    
	case Qnvram: 
2000/0516    
		return 0; 
1999/0608    
		if(offset >= Nvsize) 
			return 0; 
		t = offset; 
1999/0618/sys/src/9/mpc/devrtc.c:175,1802000/0516/sys/src/9/mpc/devrtc.c:182,188
1999/0612    
		iunlock(&nvrtlock); 
		return n; 
	case Qnvram2: 
2000/0516    
		return 0; 
1999/0612    
		if(offset >= Nvsize2) 
			return 0; 
		t = offset; 
1999/0618/sys/src/9/mpc/devrtc.c:183,1882000/0516/sys/src/9/mpc/devrtc.c:191,204
1999/0612    
		ilock(&nvrtlock); 
		memmove((uchar*)(NVRAMMEM + Nvoff2 + offset), buf, n); 
1999/0608    
		iunlock(&nvrtlock); 
2000/0516    
		return n; 
	case Qled: 
		if(strncmp(buf, "on", 2) == 0) 
			powerupled(); 
		else if(strncmp(buf, "off", 3) == 0) 
			powerdownled(); 
		else 
			error("unknown command"); 
1999/0608    
		return n; 
1999/0121    
	} 
	error(Egreg); 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)