2 * Copyright (c) 2010-2011 by Luc Verhaegen <libv@codethink.co.uk>
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include <linux/mutex.h>
22 #include "services_headers.h"
23 #include "pvr_pdump.h"
24 #include "pvr_pdumpfs.h"
26 static struct mutex pdumpfs_mutex[1];
29 PDUMPFS_MODE_DISABLED,
30 PDUMPFS_MODE_STANDARD,
34 static enum pdumpfs_mode pdumpfs_mode = PDUMPFS_MODE_DISABLED;
35 static u32 pdumpfs_frame_number;
38 pdumpfs_frame_set(u32 frame)
40 mutex_lock(pdumpfs_mutex);
42 pdumpfs_frame_number = frame;
44 mutex_unlock(pdumpfs_mutex);
48 pdumpfs_capture_enabled(void)
52 mutex_lock(pdumpfs_mutex);
54 if (pdumpfs_mode == PDUMPFS_MODE_FULL)
59 mutex_unlock(pdumpfs_mutex);
65 pdumpfs_flags_check(u32 flags)
69 if (flags & PDUMP_FLAGS_NEVER)
72 mutex_lock(pdumpfs_mutex);
74 if (pdumpfs_mode == PDUMPFS_MODE_FULL)
76 else if ((pdumpfs_mode == PDUMPFS_MODE_STANDARD) &&
77 (flags & PDUMP_FLAGS_CONTINUOUS))
82 mutex_unlock(pdumpfs_mutex);
88 pdumpfs_write_data(void *buffer, size_t size, bool from_user)
90 mutex_lock(pdumpfs_mutex);
92 mutex_unlock(pdumpfs_mutex);
98 pdumpfs_write_string(char *string)
100 mutex_lock(pdumpfs_mutex);
102 mutex_unlock(pdumpfs_mutex);
108 mutex_init(pdumpfs_mutex);
114 pdumpfs_cleanup(void)