{\it We follow a functional analytic approach to study the problem
of chaotic behaviour in time-perturbed discontinuous systems whose
unperturbed part has a piecewise $C^1$ homoclinic solution that
crosses transversally the discontinuity manifold. We show that if a
certain Melnikov function has a simple zero at some point, then the
system has solutions that behave chaotically. Application of this
result to quasi periodic systems are also given.}
