1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/* timskmodutils.h
*
* Copyright � 2010 - 2013 UNISYS CORPORATION
* All rights reserved.
*
* 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, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for more
* details.
*/
#ifndef __TIMSKMODUTILS_H__
#define __TIMSKMODUTILS_H__
#include "timskmod.h"
void *kmalloc_kernel(size_t siz);
void myprintk(const char *myDrvName, const char *devname,
const char *template, ...);
/*--------------------------------*
*--- GENERAL MESSAGEQ STUFF ---*
*--------------------------------*/
struct MessageQEntry;
/** the data structure used to hold an arbitrary data item that you want
* to place on a #MESSAGEQ. Declare and initialize as follows:
*
* This structure should be considered opaque; the client using it should
* never access the fields directly.
* Refer to these functions for more info:
*
* @ingroup messageq
*/
typedef struct MessageQEntry {
void *data;
struct MessageQEntry *qNext;
struct MessageQEntry *qPrev;
} MESSAGEQENTRY;
/** the data structure used to hold a FIFO queue of #MESSAGEQENTRY<b></b>s.
* Declare and initialize as follows:
* @code
* MESSAGEQ myQueue;
* @endcode
* This structure should be considered opaque; the client using it should
* never access the fields directly.
* Refer to these functions for more info:
*
* @ingroup messageq
*/
typedef struct MessageQ {
MESSAGEQENTRY *qHead;
MESSAGEQENTRY *qTail;
struct semaphore nQEntries;
spinlock_t queueLock;
} MESSAGEQ;
char *cyclesToSeconds(u64 cycles, u64 cyclesPerSecond,
char *buf, size_t bufsize);
char *cyclesToIterationSeconds(u64 cycles, u64 cyclesPerSecond,
u64 iterations, char *buf, size_t bufsize);
char *cyclesToSomethingsPerSecond(u64 cycles, u64 cyclesPerSecond,
u64 somethings, char *buf, size_t bufsize);
struct seq_file *visor_seq_file_new_buffer(void *buf, size_t buf_size);
void visor_seq_file_done_buffer(struct seq_file *m);
#endif
|