Ejemplo n.º 1
0
Archivo: kgdb.c Proyecto: 274914765/C
void kgdb_correct_hw_break(void)
{
    int breakno;
    int correctit;
    uint32_t wpdactl = bfin_read_WPDACTL();

    correctit = 0;
    for (breakno = 0; breakno < HW_BREAKPOINT_NUM; breakno++) {
        if (breakinfo[breakno].type == 1) {
            switch (breakno) {
            case 0:
                if (breakinfo[breakno].enabled && !(wpdactl & WPIAEN0)) {
                    correctit = 1;
                    wpdactl &= ~(WPIREN01|EMUSW0);
                    wpdactl |= WPIAEN0|WPICNTEN0;
                    bfin_write_WPIA0(breakinfo[breakno].addr);
                    bfin_write_WPIACNT0(breakinfo[breakno].skip);
                } else if (!breakinfo[breakno].enabled && (wpdactl & WPIAEN0)) {
                    correctit = 1;
                    wpdactl &= ~WPIAEN0;
                }
                break;

            case 1:
                if (breakinfo[breakno].enabled && !(wpdactl & WPIAEN1)) {
                    correctit = 1;
                    wpdactl &= ~(WPIREN01|EMUSW1);
                    wpdactl |= WPIAEN1|WPICNTEN1;
                    bfin_write_WPIA1(breakinfo[breakno].addr);
                    bfin_write_WPIACNT1(breakinfo[breakno].skip);
                } else if (!breakinfo[breakno].enabled && (wpdactl & WPIAEN1)) {
                    correctit = 1;
                    wpdactl &= ~WPIAEN1;
                }
                break;

            case 2:
                if (breakinfo[breakno].enabled && !(wpdactl & WPIAEN2)) {
                    correctit = 1;
                    wpdactl &= ~(WPIREN23|EMUSW2);
                    wpdactl |= WPIAEN2|WPICNTEN2;
                    bfin_write_WPIA2(breakinfo[breakno].addr);
                    bfin_write_WPIACNT2(breakinfo[breakno].skip);
                } else if (!breakinfo[breakno].enabled && (wpdactl & WPIAEN2)) {
                    correctit = 1;
                    wpdactl &= ~WPIAEN2;
                }
                break;

            case 3:
                if (breakinfo[breakno].enabled && !(wpdactl & WPIAEN3)) {
                    correctit = 1;
                    wpdactl &= ~(WPIREN23|EMUSW3);
                    wpdactl |= WPIAEN3|WPICNTEN3;
                    bfin_write_WPIA3(breakinfo[breakno].addr);
                    bfin_write_WPIACNT3(breakinfo[breakno].skip);
                } else if (!breakinfo[breakno].enabled && (wpdactl & WPIAEN3)) {
                    correctit = 1;
                    wpdactl &= ~WPIAEN3;
                }
                break;
            case 4:
                if (breakinfo[breakno].enabled && !(wpdactl & WPIAEN4)) {
                    correctit = 1;
                    wpdactl &= ~(WPIREN45|EMUSW4);
                    wpdactl |= WPIAEN4|WPICNTEN4;
                    bfin_write_WPIA4(breakinfo[breakno].addr);
                    bfin_write_WPIACNT4(breakinfo[breakno].skip);
                } else if (!breakinfo[breakno].enabled && (wpdactl & WPIAEN4)) {
                    correctit = 1;
                    wpdactl &= ~WPIAEN4;
                }
                break;
            case 5:
                if (breakinfo[breakno].enabled && !(wpdactl & WPIAEN5)) {
                    correctit = 1;
                    wpdactl &= ~(WPIREN45|EMUSW5);
                    wpdactl |= WPIAEN5|WPICNTEN5;
                    bfin_write_WPIA5(breakinfo[breakno].addr);
                    bfin_write_WPIACNT5(breakinfo[breakno].skip);
                } else if (!breakinfo[breakno].enabled && (wpdactl & WPIAEN5)) {
                    correctit = 1;
                    wpdactl &= ~WPIAEN5;
                }
                break;
            }
        }
    }
    if (correctit) {
        wpdactl &= ~WPAND;
        wpdactl |= WPPWR;
        /*printk("correct_hw_break: wpdactl=0x%x\n", wpdactl);*/
        bfin_write_WPDACTL(wpdactl);
        CSYNC();
        /*kgdb_show_info();*/
    }
}
Ejemplo n.º 2
0
void bfin_correct_hw_break(void)
{
	int breakno;
	unsigned int wpiactl = 0;
	unsigned int wpdactl = 0;
	int enable_wp = 0;

	for (breakno = 0; breakno < HW_WATCHPOINT_NUM; breakno++)
		if (breakinfo[breakno].enabled) {
			enable_wp = 1;

			switch (breakno) {
			case 0:
				wpiactl |= WPIAEN0|WPICNTEN0;
				bfin_write_WPIA0(breakinfo[breakno].addr);
				bfin_write_WPIACNT0(breakinfo[breakno].count
					+ breakinfo->skip);
				break;
			case 1:
				wpiactl |= WPIAEN1|WPICNTEN1;
				bfin_write_WPIA1(breakinfo[breakno].addr);
				bfin_write_WPIACNT1(breakinfo[breakno].count
					+ breakinfo->skip);
				break;
			case 2:
				wpiactl |= WPIAEN2|WPICNTEN2;
				bfin_write_WPIA2(breakinfo[breakno].addr);
				bfin_write_WPIACNT2(breakinfo[breakno].count
					+ breakinfo->skip);
				break;
			case 3:
				wpiactl |= WPIAEN3|WPICNTEN3;
				bfin_write_WPIA3(breakinfo[breakno].addr);
				bfin_write_WPIACNT3(breakinfo[breakno].count
					+ breakinfo->skip);
				break;
			case 4:
				wpiactl |= WPIAEN4|WPICNTEN4;
				bfin_write_WPIA4(breakinfo[breakno].addr);
				bfin_write_WPIACNT4(breakinfo[breakno].count
					+ breakinfo->skip);
				break;
			case 5:
				wpiactl |= WPIAEN5|WPICNTEN5;
				bfin_write_WPIA5(breakinfo[breakno].addr);
				bfin_write_WPIACNT5(breakinfo[breakno].count
					+ breakinfo->skip);
				break;
			case 6:
				wpdactl |= WPDAEN0|WPDCNTEN0|WPDSRC0;
				wpdactl |= breakinfo[breakno].dataacc
					<< WPDACC0_OFFSET;
				bfin_write_WPDA0(breakinfo[breakno].addr);
				bfin_write_WPDACNT0(breakinfo[breakno].count
					+ breakinfo->skip);
				break;
			case 7:
				wpdactl |= WPDAEN1|WPDCNTEN1|WPDSRC1;
				wpdactl |= breakinfo[breakno].dataacc
					<< WPDACC1_OFFSET;
				bfin_write_WPDA1(breakinfo[breakno].addr);
				bfin_write_WPDACNT1(breakinfo[breakno].count
					+ breakinfo->skip);
				break;
			}
		}

	/* Should enable WPPWR bit first before set any other
	 * WPIACTL and WPDACTL bits */
	if (enable_wp) {
		bfin_write_WPIACTL(WPPWR);
		CSYNC();
		bfin_write_WPIACTL(wpiactl|WPPWR);
		bfin_write_WPDACTL(wpdactl);
		CSYNC();
	}
}