forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 61598093bbdd283a7edc367d900f223070ead8d2
kernel/drivers/gpu/arm/mali400/mali/common/mali_osk.h
....@@ -950,24 +950,23 @@
950950
951951 /** @brief Initialize a timer
952952 *
953
- * Initializes a given timer instance.
954
- * This does not start the timer.
955
-
956
- * @param tim the timer to init.
957
- * @param callback the callback that would be called when 'tim' times out.
953
+ * Allocates resources for a new timer, and initializes them. This does not
954
+ * start the timer.
955
+ *
956
+ * @return a pointer to the allocated timer object, or NULL on failure.
958957 */
959
-void _mali_osk_timer_init(_mali_osk_timer_t *tim, _mali_osk_timer_callback_t callback);
958
+_mali_osk_timer_t *_mali_osk_timer_init(_mali_osk_timer_callback_t callback);
960959
961960 /** @brief Start a timer
962961 *
963962 * It is an error to start a timer without setting the callback via
964
- * _mali_osk_timer_init().
963
+ * _mali_osk_timer_setcallback().
965964 *
966965 * It is an error to use this to start an already started timer.
967966 *
968967 * The timer will expire in \a ticks_to_expire ticks, at which point, the
969968 * callback function will be invoked with the callback-specific data,
970
- * as registered by _mali_osk_timer_init().
969
+ * as registered by _mali_osk_timer_setcallback().
971970 *
972971 * @param tim the timer to start
973972 * @param ticks_to_expire the amount of time in ticks for the timer to run
....@@ -981,11 +980,11 @@
981980 * stopped. If \a ticks_to_expire 0 the timer fires immediately.
982981 *
983982 * It is an error to modify a timer without setting the callback via
984
- * _mali_osk_timer_init().
983
+ * _mali_osk_timer_setcallback().
985984 *
986985 * The timer will expire at \a ticks_to_expire from the time of the call, at
987986 * which point, the callback function will be invoked with the
988
- * callback-specific data, as set by _mali_osk_timer_init().
987
+ * callback-specific data, as set by _mali_osk_timer_setcallback().
989988 *
990989 * @param tim the timer to modify, and start if necessary
991990 * @param ticks_to_expire the \em absolute time in ticks at which this timer
....@@ -1035,6 +1034,34 @@
10351034 */
10361035 mali_bool _mali_osk_timer_pending(_mali_osk_timer_t *tim);
10371036
1037
+/** @brief Set a timer's callback parameters.
1038
+ *
1039
+ * This must be called at least once before a timer is started/modified.
1040
+ *
1041
+ * After a timer has been stopped or expires, the callback remains set. This
1042
+ * means that restarting the timer will call the same function with the same
1043
+ * parameters on expiry.
1044
+ *
1045
+ * @param tim the timer to set callback on.
1046
+ * @param callback Function to call when timer expires
1047
+ * @param data Function-specific data to supply to the function on expiry.
1048
+ */
1049
+void _mali_osk_timer_setcallback(_mali_osk_timer_t *tim, _mali_osk_timer_callback_t callback, void *data);
1050
+
1051
+/** @brief Terminate a timer, and deallocate resources.
1052
+ *
1053
+ * The timer must first be stopped by calling _mali_osk_timer_del().
1054
+ *
1055
+ * It is a programming error for _mali_osk_timer_term() to be called on:
1056
+ * - timer that is currently running
1057
+ * - a timer that is currently executing its callback.
1058
+ *
1059
+ * @param tim the timer to deallocate.
1060
+ */
1061
+void _mali_osk_timer_term(_mali_osk_timer_t *tim);
1062
+/** @} */ /* end group _mali_osk_timer */
1063
+
1064
+
10381065 /** @defgroup _mali_osk_time OSK Time functions
10391066 *
10401067 * \ref _mali_osk_time use the OS's representation of time, which are