author | Gareth Long <garethl@symbian.org> |
Tue, 29 Jun 2010 15:10:15 +0100 | |
branch | nvmemory |
changeset 80 | e9514b7eeead |
parent 45 | 01c1ffcc4fca |
permissions | -rw-r--r-- |
45
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
1 |
/* |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
2 |
* This component and the accompanying materials are made available |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
3 |
* under the terms of the License "Eclipse Public License v1.0" |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
4 |
* which accompanies this distribution, and is available |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
5 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
6 |
* |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
7 |
* Initial Contributors: |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
8 |
* Accenture Ltd |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
9 |
* |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
10 |
* Contributors: |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
11 |
* |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
12 |
* Description: This file is a part of sound driver for Syborg adaptation. |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
13 |
* |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
14 |
*/ |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
15 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
16 |
#ifndef VIRTIO_IO_H |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
17 |
#define VIRTIO_IO_H |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
18 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
19 |
#include "virtio.h" |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
20 |
#include <e32def.h> |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
21 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
22 |
namespace VirtIo |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
23 |
{ |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
24 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
25 |
class DIo : public DBase, public MIo |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
26 |
{ |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
27 |
public: |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
28 |
DIo( TAny* aIoBase ): iIoBase( reinterpret_cast<TUint32*>( aIoBase ) ) |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
29 |
{ } |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
30 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
31 |
virtual void GetDeviceIds( TUint32 &aPeripheralId, TUint32 &aDeviceId ); |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
32 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
33 |
virtual void SetQueueBase( TUint aQId, TAny* iDescRegion ); |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
34 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
35 |
virtual TAny* GetQueueBase( TUint aQId); |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
36 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
37 |
virtual TUint GetQueueCount( TUint aQId ) |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
38 |
{ |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
39 |
write(EIoQueueSelect, aQId); |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
40 |
return read(EIoQueueSize); |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
41 |
} |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
42 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
43 |
virtual void PostQueue( TUint aQId ) |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
44 |
{ write(EIoQueueNotify, aQId); SYBORG_VIRTIO_DEBUG("PostQueue Q%d", aQId ); } |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
45 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
46 |
virtual TBool EnableInterrupt( TBool aEnable ) |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
47 |
{ return swap(EIoInterruptEnable, aEnable?1:0); } |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
48 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
49 |
virtual void SetStatus( TUint status ) |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
50 |
{ write(EIoStatus, status ); } |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
51 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
52 |
virtual void ClearInteruptStatus() |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
53 |
{ write( EIoInterruptStatus, 1 ); } |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
54 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
55 |
virtual TBool InteruptStatus() |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
56 |
{ return read( EIoInterruptStatus ); } |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
57 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
58 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
59 |
void Reset() |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
60 |
{ SetStatus( EStatusReset ); }; |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
61 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
62 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
63 |
private: |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
64 |
void write(TUint idx, TUint32 value ) |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
65 |
{ iIoBase[idx] = value; } |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
66 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
67 |
TUint32 read(TUint idx) |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
68 |
{ return iIoBase[idx]; } |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
69 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
70 |
TUint32 swap(TUint idx, TUint32 value ) |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
71 |
{ |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
72 |
TUint32 t = iIoBase[idx]; |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
73 |
iIoBase[idx] = value; |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
74 |
return t; |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
75 |
} |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
76 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
77 |
volatile TUint32* iIoBase; |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
78 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
79 |
}; |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
80 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
81 |
} // namespace VirtIo |
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
82 |
|
01c1ffcc4fca
Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents:
diff
changeset
|
83 |
#endif |