2 Copyright (c) 2003, Thomas Kurschel
5 Part of Radeon accelerant
10 #include "radeon_accelerant.h"
11 #include <sys/ioctl.h>
12 #include "rbbm_regs.h"
16 status_t
Radeon_WaitForIdle( accelerator_info
*ai
, bool keep_lock
)
18 radeon_wait_for_idle wfi
;
20 wfi
.magic
= RADEON_PRIVATE_DATA_MAGIC
;
21 wfi
.keep_lock
= keep_lock
;
23 return ioctl( ai
->fd
, RADEON_WAITFORIDLE
, &wfi
, sizeof( wfi
));
26 // wait until "entries" FIFO entries are empty
28 status_t
Radeon_WaitForFifo( accelerator_info
*ai
, int entries
)
31 bigtime_t start_time
= system_time();
34 int slots
= INREG( ai
->regs
, RADEON_RBBM_STATUS
) & RADEON_RBBM_FIFOCNT_MASK
;
36 if ( slots
>= entries
)
40 } while( system_time() - start_time
< 1000000 );
42 Radeon_ResetEngine( ai
);
48 void Radeon_ResetEngine( accelerator_info
*ai
)
52 na
.magic
= RADEON_PRIVATE_DATA_MAGIC
;
54 ioctl( ai
->fd
, RADEON_RESETENGINE
, &na
, sizeof( na
));
58 status_t
Radeon_VIPRead( accelerator_info
*ai
, uint channel
, uint address
, uint32
*data
)
63 vr
.magic
= RADEON_PRIVATE_DATA_MAGIC
;
68 res
= ioctl( ai
->fd
, RADEON_VIPREAD
, &vr
, sizeof( vr
));
77 status_t
Radeon_VIPWrite( accelerator_info
*ai
, uint8 channel
, uint address
, uint32 data
)
81 vw
.magic
= RADEON_PRIVATE_DATA_MAGIC
;
87 return ioctl( ai
->fd
, RADEON_VIPWRITE
, &vw
, sizeof( vw
));
90 int Radeon_FindVIPDevice( accelerator_info
*ai
, uint32 device_id
)
92 radeon_find_vip_device fvd
;
95 fvd
.magic
= RADEON_PRIVATE_DATA_MAGIC
;
96 fvd
.device_id
= device_id
;
98 res
= ioctl( ai
->fd
, RADEON_FINDVIPDEVICE
, &fvd
, sizeof( fvd
));