Default [Q] How do I write a camera HAL for the raspberry pi

I Want to write camera hal for raspberry pi for the gingerbread 2.3.
Can any help in better understading of camera architecture.
How camera service talks with HAL and how HAL returns back the data to camera service.?