xref: /haiku/src/add-ons/media/media-add-ons/radeon/VIPPort.h (revision 83b1a68c52ba3e0e8796282759f694b7fdddf06d)
1 /******************************************************************************
2 /
3 /	File:			VIP.h
4 /
5 /	Description:	ATI Radeon Video Input Port (VIP) interface.
6 /
7 /	Copyright 2001, Carlos Hasan
8 /
9 *******************************************************************************/
10 
11 #ifndef __VIP_PORT_H__
12 #define __VIP_PORT_H__
13 
14 #include "Radeon.h"
15 
16 enum vip_port_device {
17 	C_VIP_PORT_DEVICE_0 		= 0,
18 	C_VIP_PORT_DEVICE_1 		= 1,
19 	C_VIP_PORT_DEVICE_2 		= 2,
20 	C_VIP_PORT_DEVICE_3 		= 3
21 };
22 
23 enum vip_port_register {
24 	C_VIP_VENDOR_DEVICE_ID		= 0x0000,
25 		C_VIP_VENDOR_ID			= BITS(15:0),
26 		C_VIP_DEVICE_ID			= BITS(31:16),
27 
28 	C_VIP_SUB_VENDOR_DEVICE_ID	= 0x0004,
29 		C_VIP_SUB_VENDOR_ID		= BITS(15:0),
30 		C_VIP_SUB_DEVICE_ID		= BITS(31:16),
31 
32 	C_VIP_COMMAND_STATUS		= 0x0008,
33 		C_VIP_POWER_ST			= BITS(1:0),
34 		C_VIP_XHOST_ON			= BITS(2:2),
35 		C_VIP_P1_SUPPORT		= BITS(16:16),
36 		C_VIP_P2_SUPPORT		= BITS(17:17),
37 		C_VIP_HOST_CAP			= BITS(19:18),
38 
39 	C_VIP_REVISION_ID			= 0x000c,
40 		C_VIP_REVISION_ID_MASK	= BITS(15:0)
41 };
42 
43 class CVIPPort {
44 public:
45 	CVIPPort(CRadeon & radeon);
46 
47 	~CVIPPort();
48 
49 	status_t InitCheck() const;
50 
51 	CRadeon & Radeon();
52 
53 	int Register(int device, int address) {
54 		return fRadeon.VIPRegister( device, address );
55 	}
56 
57 	void SetRegister(int device, int address, int value) {
58 		fRadeon.SetVIPRegister( device, address, value );
59 	}
60 
61 	int ReadFifo(int device, uint32 address, uint32 count, uint8 *buffer) {
62 		return fRadeon.VIPReadFifo( device, address, count, buffer );
63 	}
64 
65 	int WriteFifo(int device, uint32 address, uint32 count, uint8 *buffer) {
66 		return fRadeon.VIPWriteFifo( device, address, count, buffer );
67 	}
68 
69 	int FindVIPDevice( uint32 device_id ) {
70 		return fRadeon.FindVIPDevice( device_id );
71 	}
72 
73 private:
74 	CRadeon & fRadeon;
75 };
76 
77 #endif
78