gator: Version 5.21.1
[firefly-linux-kernel-4.4.55.git] / tools / gator / daemon / ExternalSource.h
1 /**
2  * Copyright (C) ARM Limited 2010-2015. All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  */
8
9 #ifndef EXTERNALSOURCE_H
10 #define EXTERNALSOURCE_H
11
12 #include <semaphore.h>
13
14 #include "Buffer.h"
15 #include "Monitor.h"
16 #include "OlySocket.h"
17 #include "Source.h"
18
19 // Counters from external sources like graphics drivers and annotations
20 class ExternalSource : public Source {
21 public:
22         ExternalSource(sem_t *senderSem);
23         ~ExternalSource();
24
25         bool prepare();
26         void run();
27         void interrupt();
28
29         bool isDone();
30         void write(Sender *sender);
31
32 private:
33         void waitFor(const int bytes);
34         void configureConnection(const int fd, const char *const handshake, size_t size);
35         bool connectMali();
36         bool connectMve();
37
38         sem_t mBufferSem;
39         Buffer mBuffer;
40         Monitor mMonitor;
41         OlyServerSocket mMveStartupUds;
42         OlyServerSocket mMaliStartupUds;
43         OlyServerSocket mAnnotate;
44         OlyServerSocket mAnnotateUds;
45         int mInterruptFd;
46         int mMaliUds;
47         int mMveUds;
48
49         // Intentionally unimplemented
50         ExternalSource(const ExternalSource &);
51         ExternalSource &operator=(const ExternalSource &);
52 };
53
54 #endif // EXTERNALSOURCE_H