Multifunctional charging topology for electric vehicle