A Hilbert space approach to homogenization of linear ordinary differential equations including delay and memory terms