~kris/9p

9hist

7b28ff979e4770232c1caa8e1a3258f26295aa85 — David du Colombier 24 years ago 2ec3d95
Plan 9 from Bell Labs 2002-06-07
1 files changed, 36 insertions(+), 11 deletions(-)

M bitsy/devpcmcia.c
M bitsy/devpcmcia.c => bitsy/devpcmcia.c +36 -11
@@ 106,6 106,31 @@ bitno(ulong x)
}

/*
 * power up/down pcmcia
 */
static void
pcmciapower(int up)
{
	/* if there's no pcmcia sleave, no interrupts */
	if(gpioregs->level & GPIO_OPT_IND_i)
		return;
	if (up){
		/* set timing to the default, 300 */
		slottiming(0, 300, 300, 300, 0);
		slottiming(1, 300, 300, 300, 0);

		/* if there's no pcmcia sleave, no interrupts */
		if(gpioregs->level & GPIO_OPT_IND_i)
			return;

		/* sleave there, interrupt on card removal */
		intrenable(GPIOrising, bitno(GPIO_CARD_IND1_i), slotinfo, nil, "pcmcia slot1 status");
		intrenable(GPIOrising, bitno(GPIO_CARD_IND0_i), slotinfo, nil, "pcmcia slot0 status");
	}else{
	}
}

/*
 *  set up the cards, default timing is 300 ns
 */
static void


@@ 115,17 140,7 @@ pcmciareset(void)
	slotmap(0, PHYSPCM0REGS, PYHSPCM0ATTR, PYHSPCM0MEM);
	slotmap(1, PHYSPCM1REGS, PYHSPCM1ATTR, PYHSPCM1MEM);

	/* set timing to the default, 300 */
	slottiming(0, 300, 300, 300, 0);
	slottiming(1, 300, 300, 300, 0);

	/* if there's no pcmcia sleave, no interrupts */
	if(gpioregs->level & GPIO_OPT_IND_i)
		return;

	/* sleave there, interrupt on card removal */
	intrenable(GPIOrising, bitno(GPIO_CARD_IND1_i), slotinfo, nil, "pcmcia slot1 status");
	intrenable(GPIOrising, bitno(GPIO_CARD_IND0_i), slotinfo, nil, "pcmcia slot0 status");
	pcmciapower(1);
}

static Chan*


@@ 348,6 363,16 @@ pcmctlwrite(char *p, long n, ulong, PCMslot *sp)

		/* don't let the power turn off */
		increfp(sp);
	}else if(strcmp(cmd->f[0], "remove") == 0){
		wlock(sp);
		if(waserror()){
			wunlock(sp);
			nexterror();
		}


		wunlock(sp);
		poperror();
	}
	free(cmd);