[IMPROVE] Driver: implement pause/continue msg send 20/15620/4
authorAlexander Aksenov <a.aksenov@samsung.com>
Thu, 23 Jan 2014 12:11:46 +0000 (16:11 +0400)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Thu, 27 Feb 2014 12:44:34 +0000 (04:44 -0800)
Change-Id: I0244e64e6d5d0e1bde9ade4040118151ebf48c63
Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
driver/app_manage.h [new file with mode: 0644]
driver/driver_to_buffer.c

diff --git a/driver/app_manage.h b/driver/app_manage.h
new file mode 100644 (file)
index 0000000..cae9950
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ *  SWAP device driver
+ *  modules/driver/app_manage.h
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) Samsung Electronics, 2014
+ *
+ * 2014         Alexander Aksenov <a.aksenov@samsung.com>: Driver user<-> kernel
+ *                                                  connect implement
+ *
+ */
+
+#ifndef __APP_MANAGE_H__
+#define __APP_MANAGE_H__
+
+#include "us_interaction.h"
+#include "us_interaction_msg.h"
+
+static inline int app_manage_pause_apps(void)
+{
+       enum us_interaction_k2u_msg_t us_int_msg = US_INT_PAUSE_APPS;
+
+       return us_interaction_send_msg(&us_int_msg, sizeof(us_int_msg));
+}
+
+static inline int app_manage_cont_apps(void)
+{
+       enum us_interaction_k2u_msg_t us_int_msg = US_INT_CONT_APPS;
+
+       return us_interaction_send_msg(&us_int_msg, sizeof(us_int_msg));
+}
+
+#endif /* __APP_MANAGE_H__ */
index 1578da7..fc8751b 100644 (file)
@@ -37,6 +37,7 @@
 #include "driver_defs.h"
 #include "swap_driver_errors.h"
 #include "device_driver_to_driver_to_buffer.h"
+#include "app_manage.h"
 
 /* Current busy buffer */
 static struct swap_subbuffer *busy_buffer = NULL;
@@ -251,9 +252,9 @@ int driver_to_buffer_initialize(size_t size, unsigned int count)
                .nr_subbuffers = count,
                .subbuffer_full_cb = driver_to_buffer_callback,
                .lower_threshold = 20,
-               .low_mem_cb = NULL,
+               .low_mem_cb = app_manage_pause_apps,
                .top_threshold = 80,
-               .enough_mem_cb = NULL,
+               .enough_mem_cb = app_manage_cont_apps,
        };
 
        if (size == 0 && count == 0) {