예제 #1
0
파일: perf_proc.c 프로젝트: janfj/dd-wrt
static int proc_write_perf(struct file *file, const char *buffer,
				unsigned long count, void *data)
{
	int len;
	int nparsed;
	int index;
	char mybuf[TXTBUFSZ];

	int which[4];
	unsigned long control[4];
	long long ctrdata[4];

	if(count >= TXTBUFSZ) len = TXTBUFSZ-1;
	else len = count;
	memset(mybuf,0,TXTBUFSZ);
	if(copy_from_user(mybuf, buffer, len)) return -EFAULT;

	nparsed = sscanf(mybuf,
			"%d %lx %Ld %d %lx %Ld %d %lx %Ld %d %lx %Ld",
				&which[0], &control[0], &ctrdata[0],
				&which[1], &control[1], &ctrdata[1],
				&which[2], &control[2], &ctrdata[2],
				&which[3], &control[3], &ctrdata[3]);

	for(index = 0; nparsed >= 3; index++) {
		switch (which[index]) {
		case 0:
			write_c0_perfctrl0(control[index]);
			if(ctrdata[index] != -1) {
			    extencount[0] = (unsigned long long)ctrdata[index];
			    write_c0_perfcntr0((unsigned long)0);
			}
			break;
		case 1:
			write_c0_perfctrl1(control[index]);
			if(ctrdata[index] != -1) {
			    extencount[1] = (unsigned long long)ctrdata[index];
			    write_c0_perfcntr1((unsigned long)0);
			}
			break;
		case 2:
			write_c0_perfctrl2(control[index]);
			if(ctrdata[index] != -1) {
			    extencount[2] = (unsigned long long)ctrdata[index];
			    write_c0_perfcntr2((unsigned long)0);
			}
			break;
		case 3:
			write_c0_perfctrl3(control[index]);
			if(ctrdata[index] != -1) {
			    extencount[3] = (unsigned long long)ctrdata[index];
			    write_c0_perfcntr3((unsigned long)0);
			}
			break;
		}
		nparsed -= 3;
	}
	return (len);
}
예제 #2
0
파일: setup.c 프로젝트: KHATEEBNSIT/AP
void start_cntrs(unsigned int event0, unsigned int event1)
{
	write_c0_perfcntr0(0x00000000);
	write_c0_perfcntr1(0x00000000);
	/*
	 * go...
	 */
	write_c0_perfctrl0(0x80000000 | M_PERFCTL_EVENT(event0) | 0xf);
	write_c0_perfctrl1(0x00000000 | M_PERFCTL_EVENT(event1) | 0xf);
}
예제 #3
0
파일: setup.c 프로젝트: KHATEEBNSIT/AP
void stop_cntrs(void)
{
	write_c0_perfctrl0(0);
	write_c0_perfctrl1(0);
}