1 /* 2 Copyright (c) 2003, Thomas Kurschel 3 4 5 Part of Radeon accelerant 6 7 Kernel driver wrapper 8 */ 9 10 #include "radeon_accelerant.h" 11 #include <sys/ioctl.h> 12 13 status_t Radeon_WaitForIdle( accelerator_info *ai, bool keep_lock ) 14 { 15 radeon_wait_for_idle wfi; 16 17 wfi.magic = RADEON_PRIVATE_DATA_MAGIC; 18 wfi.keep_lock = keep_lock; 19 20 return ioctl( ai->fd, RADEON_WAITFORIDLE, &wfi, sizeof( wfi )); 21 } 22 23 24 void Radeon_ResetEngine( accelerator_info *ai ) 25 { 26 radeon_no_arg na; 27 28 na.magic = RADEON_PRIVATE_DATA_MAGIC; 29 30 ioctl( ai->fd, RADEON_RESETENGINE, &na, sizeof( na )); 31 } 32 33 34 status_t Radeon_VIPRead( accelerator_info *ai, uint channel, uint address, uint32 *data ) 35 { 36 radeon_vip_read vr; 37 status_t res; 38 39 vr.magic = RADEON_PRIVATE_DATA_MAGIC; 40 vr.channel = channel; 41 vr.address = address; 42 vr.lock = false; 43 44 res = ioctl( ai->fd, RADEON_VIPREAD, &vr, sizeof( vr )); 45 46 if( res == B_OK ) 47 *data = vr.data; 48 49 return res; 50 } 51 52 53 status_t Radeon_VIPWrite( accelerator_info *ai, uint8 channel, uint address, uint32 data ) 54 { 55 radeon_vip_write vw; 56 57 vw.magic = RADEON_PRIVATE_DATA_MAGIC; 58 vw.channel = channel; 59 vw.address = address; 60 vw.data = data; 61 vw.lock = false; 62 63 return ioctl( ai->fd, RADEON_VIPWRITE, &vw, sizeof( vw )); 64 } 65 66 int Radeon_FindVIPDevice( accelerator_info *ai, uint32 device_id ) 67 { 68 radeon_find_vip_device fvd; 69 status_t res; 70 71 fvd.magic = RADEON_PRIVATE_DATA_MAGIC; 72 fvd.device_id = device_id; 73 74 res = ioctl( ai->fd, RADEON_FINDVIPDEVICE, &fvd, sizeof( fvd )); 75 76 if( res == B_OK ) 77 return fvd.channel; 78 else 79 return -1; 80 } 81