1 /* 2 * TimeSync API driver. 3 * 4 * Copyright 2016 Google Inc. 5 * Copyright 2016 Linaro Ltd. 6 * 7 * Released under the GPLv2 only. 8 */ 9 10 #ifndef __TIMESYNC_H 11 #define __TIMESYNC_H 12 13 struct gb_svc; 14 struct gb_interface; 15 struct gb_timesync_svc; 16 17 /* Platform */ 18 u64 gb_timesync_platform_get_counter(void); 19 u32 gb_timesync_platform_get_clock_rate(void); 20 int gb_timesync_platform_lock_bus(struct gb_timesync_svc *pdata); 21 void gb_timesync_platform_unlock_bus(void); 22 23 int gb_timesync_platform_init(void); 24 void gb_timesync_platform_exit(void); 25 26 /* Core API */ 27 int gb_timesync_interface_add(struct gb_interface *interface); 28 void gb_timesync_interface_remove(struct gb_interface *interface); 29 int gb_timesync_svc_add(struct gb_svc *svc); 30 void gb_timesync_svc_remove(struct gb_svc *svc); 31 32 u64 gb_timesync_get_frame_time_by_interface(struct gb_interface *interface); 33 u64 gb_timesync_get_frame_time_by_svc(struct gb_svc *svc); 34 int gb_timesync_to_timespec_by_svc(struct gb_svc *svc, u64 frame_time, 35 struct timespec *ts); 36 int gb_timesync_to_timespec_by_interface(struct gb_interface *interface, 37 u64 frame_time, struct timespec *ts); 38 39 int gb_timesync_schedule_synchronous(struct gb_interface *intf); 40 void gb_timesync_schedule_asynchronous(struct gb_interface *intf); 41 void gb_timesync_irq(struct gb_timesync_svc *timesync_svc); 42 int gb_timesync_init(void); 43 void gb_timesync_exit(void); 44 45 #endif /* __TIMESYNC_H */ 46