I am beginner to embedded device driver writing. I am trying to write a custom device driver for my embedded device. as I am familiar with writing Char drivers, UIO, MISC frameworks. let's say I want to write my own kernel device driver for RTC (real-time clock)module.
Declare custom device struct
struct rtc685_device{
struct device dev;
struct module *owner;
int id
const struct rtc685_class_ops *ops
.....
}
Declare RTC custom struct operations
struct rtc685_class_ops{
int (*open) (struct device*)
void(*release)(struct device*)
int(*get_time)(struct device *, struct rtc685_data*)
....
}
Register device with kernel
struct rtc685_device *rtc685_device_register(const char *name,
struct device *dev, const struct rtc685_class_ops *ops,
struct module *owner)
my question is how to write source code for this function ? i can see some random code for this register function . but i can't understand . please help me to understand the steps to create full custom device driver registration function. lastly, I am a hardware guy and don't understand much about kernel things. Thanks