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