ATmega128 programming a CPLD over JTAG

If I remember correctly, JTAG is a kind of SPI: clock, data in, data out and some control signal. You could probably use the SPI and some IO lines.

Angelo