Ejemplo n.º 1
0
/* isgpio():
 *	Return 1 if the specified bit is configured to be gpio;
 *	else return 0.
 */
int
isgpio(int bitnum, int verbose)
{
	if ((bitnum >= 1) && (bitnum <= 9)) {
		if ((ppcMfcntrl0() & maskbit(4)) == 0)
			return(1);
	}
	else if ((bitnum >= 5) && (bitnum <= 23)) {
		if (ppcMfcntrl0() & maskbit(bitnum-5))
			return(1);
	}
	if (verbose)
		printf("Bit is not configured as GPIO\n");
	return(0);
}
Ejemplo n.º 2
0
void
pioset(char port_notused,int bitnum)
{
	if (!isgpio(bitnum,0))
		return;
	*(ulong *)(GPIO0_OR) = (*(ulong *)(GPIO0_OR) | maskbit(bitnum));
}
Ejemplo n.º 3
0
    void dispatch()
    {
        INT::Bar bar;

        auto status=bar.get_IRQStatus();
        auto status2=bar.get_IRQStatus2();

        for(ulen i=0; i<Int_TableLen ; i++)
        {
            if( reg_select[i] )
            {
                if( status2.maskbit(bit[i]) ) table[i]();
            }
            else
            {
                if( status.maskbit(bit[i]) ) table[i]();
            }
        }
    }
Ejemplo n.º 4
0
int
pioget(char port_notused,int bitnum)
{
	if (!isgpio(bitnum,0))
		return(-1);

	if (*(ulong *)(GPIO0_IR) & maskbit(bitnum))
		return(1);
	else
		return(0);
}