/********* BitMap::Clear() *************************************/ VOID MNAME_BM(Clear)(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_Clear *msg) { IPTR width, height; struct bitmap_data *data = OOP_INST_DATA(cl, o); struct Box box = {0, 0, 0, 0}; /* Get width & height from bitmap superclass */ OOP_GetAttr(o, aHidd_BitMap_Width, &width); OOP_GetAttr(o, aHidd_BitMap_Height, &height); box.x2 = width - 1; box.y2 = height - 1; memset(data->VideoData, GC_BG(msg->gc), width*height); #ifdef OnBitmap ObtainSemaphore(&XSD(cl)->HW_acc); vgaRefreshArea(data, 1, &box); draw_mouse(XSD(cl)); ReleaseSemaphore(&XSD(cl)->HW_acc); #endif /* OnBitmap */ return; }
AROS_UFH3(IPTR, ACPIButton_PowerEventHandle, AROS_UFHA(struct Hook *, hook, A0), AROS_UFHA(APTR, object, A2), AROS_UFHA(APTR, message, A1) ) { AROS_USERFUNC_INIT struct Task *sigTask = NULL; OOP_Class *cl; IPTR powerSig = 0; // ACPI_HANDLE device = (ACPI_HANDLE)message; D(bug("[HWACPIButton] %s()\n", __func__)); cl = OOP_OCLASS(object); OOP_GetAttr(object, aHW_ACPIButton_ServiceTask, (IPTR *)&sigTask); OOP_GetAttr(object, aHW_ACPIButton_ServiceSigPower, &powerSig); if (sigTask) { D(bug("[HWACPIButton] %s: Signalling service task to handle Power Button event..\n", __func__)); Signal(sigTask, (1 << powerSig)); } return 0; AROS_USERFUNC_EXIT }
AROS_UFH3(void, PCI_Enumerator, AROS_UFHA(struct Hook *, hook, A0), AROS_UFHA(OOP_Object *, pciDevice, A2), AROS_UFHA(APTR, message, A1)) { AROS_USERFUNC_INIT D(bug("[SiS900] PCI_Enumerator()\n")); LIBBASETYPEPTR LIBBASE = (LIBBASETYPEPTR)hook->h_Data; BOOL FoundCompatNIC = FALSE; IPTR DeviceID, VendorID, RevisionID; char *CardName, *CardChipName; struct SiS900Unit *unit; OOP_GetAttr(pciDevice, aHidd_PCIDevice_VendorID, &VendorID); OOP_GetAttr(pciDevice, aHidd_PCIDevice_ProductID, &DeviceID); OOP_GetAttr(pciDevice, aHidd_PCIDevice_RevisionID, &RevisionID); if ((DeviceID == 0x0900)) { FoundCompatNIC = TRUE; CardName = "SiS 900 PCI Fast Ethernet"; CardChipName = "SiS900"; } else if ((DeviceID == 0x7016)) { FoundCompatNIC = TRUE; CardName = "SiS 7016 PCI Fast Ethernet"; CardChipName = "SiS7016"; } if (FoundCompatNIC) { D(bug("[SiS900] PCI_Enumerator: Found %s NIC, PCI_ID %04x:%04x Rev:%d\n", CardName, VendorID, DeviceID, RevisionID)); if ((unit = CreateUnit(LIBBASE, pciDevice, CardName, CardChipName))) { AddTail(&LIBBASE->sis900b_Units, &unit->sis900u_Node); } else { D(bug("[SIS900] PCI_Enumerator: Failed to create unit!\n")); return; } D(bug("[%s] PCI_Enumerator: %s NIC I/O MEM @ %08x\n", unit->sis900u_name, unit->sis900u_rtl_chipname, unit->sis900u_BaseMem)); } AROS_USERFUNC_EXIT }
VOID METHOD(VC4Gallium, Hidd_Gallium, DisplayResource) { struct RastPort * rp; #if (0) OOP_GetAttr(o, aHidd_Gallium_WinSys, &vc4_ws); if (vc4_ws) { if ((data == NULL) && (spr->dt != NULL)) data = vc4_ws->displaytarget_map(vc4_ws, spr->dt, 0); if (data) { rp = CreateRastPort(); rp->BitMap = msg->bitmap; WritePixelArray( data, msg->srcx, msg->srcy, spr->stride[0], rp, msg->dstx, msg->dsty, msg->width, msg->height, AROS_PIXFMT); FreeRastPort(rp); } if ((spr->data == NULL) && (data != NULL)) vc4_ws->displaytarget_unmap(vc4_ws, spr->dt); } #endif }
/*********** BitMap::New() *************************************/ OOP_Object *MNAME_ROOT(New)(OOP_Class *cl, OOP_Object *o, struct pRoot_New *msg) { EnterFunc(bug("VesaGfx.BitMap::New()\n")); o = (OOP_Object *)OOP_DoSuperMethod(cl, o, (OOP_Msg) msg); if (o) { struct BitmapData *data; IPTR width, height, depth, multi; OOP_Object *friend, *pf; data = OOP_INST_DATA(cl, o); /* clear all data */ memset(data, 0, sizeof(struct BitmapData)); /* Get attr values */ OOP_GetAttr(o, aHidd_BitMap_Width, &width); OOP_GetAttr(o, aHidd_BitMap_Height, &height); OOP_GetAttr(o, aHidd_BitMap_GfxHidd, (IPTR *)&data->gfxhidd); OOP_GetAttr(o, aHidd_BitMap_PixFmt, (IPTR *)&pf); data->pixfmtobj = pf; OOP_GetAttr(pf, aHidd_PixFmt_Depth, &depth); OOP_GetAttr(pf, aHidd_PixFmt_BytesPerPixel, &multi); /* Get the friend bitmap. This should be a displayable bitmap */ OOP_GetAttr(o, aHidd_BitMap_Friend, (IPTR *)&friend); /* If you got a friend bitmap, copy its colormap */ if (friend) { struct BitmapData *src = OOP_INST_DATA(cl, friend); CopyMem(&src->cmap, &data->cmap, 4*16); } ASSERT (width != 0 && height != 0 && depth != 0); width=(width+15) & ~15; data->width = width; data->height = height; data->bpp = depth; data->disp = 0; data->bytesperpix = multi; data->bytesperline = width * multi; data->VideoData = AllocVec(width*height*multi, MEMF_PUBLIC | MEMF_CLEAR); if (data->VideoData) { data->data = &XSD(cl)->data; if (XSD(cl)->activecallback) XSD(cl)->activecallback(XSD(cl)->callbackdata, o, TRUE); ReturnPtr("VesaGfx.BitMap::New()", OOP_Object *, o); } /* if got data->VideoData */ { OOP_MethodID disp_mid = OOP_GetMethodID(IID_Root, moRoot_Dispose); OOP_CoerceMethod(cl, o, (OOP_Msg) &disp_mid); } o = NULL; } /* if created object */
OOP_Object *PCVGAOnBM__Root__New(OOP_Class *cl, OOP_Object *o, struct pRoot_New *msg) { EnterFunc(bug("VGAGfx.BitMap::New()\n")); o = (OOP_Object *)OOP_DoSuperMethod(cl, o, (OOP_Msg) msg); if (o) { struct bitmap_data *data; OOP_Object *pf; IPTR width, height, depth; data = OOP_INST_DATA(cl, o); /* clear all data */ memset(data, 0, sizeof(struct bitmap_data)); /* Get attr values */ OOP_GetAttr(o, aHidd_BitMap_Width, &width); OOP_GetAttr(o, aHidd_BitMap_Height, &height); OOP_GetAttr(o, aHidd_BitMap_PixFmt, &pf); OOP_GetAttr(pf, aHidd_PixFmt_Depth, &depth); ASSERT (width != 0 && height != 0 && depth != 0); /* We must only create depths that are supported by the friend drawable Currently we only support the default depth */ data->width = width; data->height = height; data->bpp = depth; data->Regs = AllocVec(sizeof(struct vgaHWRec),MEMF_PUBLIC|MEMF_CLEAR); data->disp = -1; width=(width+15) & ~15; /* Here there is brand new method of getting pixelclock data. It was introduced here to make the code more portable. Besides it may now be used as a base for creating other low level video drivers */ if (data->Regs) { data->VideoData = AllocVec(width*height,MEMF_PUBLIC|MEMF_CLEAR); if (data->VideoData) { struct vgaModeDesc mode; HIDDT_ModeID modeid; OOP_Object *sync; OOP_Object *pf; ULONG pixelc; /* We should be able to get modeID from the bitmap */ OOP_GetAttr(o, aHidd_BitMap_ModeID, &modeid); if (modeid != vHidd_ModeID_Invalid) { struct Box box = {0, 0, width-1, height-1}; /* Get Sync and PixelFormat properties */ HIDD_Gfx_GetMode(XSD(cl)->vgahidd, modeid, &sync, &pf); mode.Width = width; mode.Height = height; mode.Depth = depth; OOP_GetAttr(sync, aHidd_Sync_PixelClock, &pixelc); mode.clock = (pixelc > 26000000) ? 1 : 0; mode.Flags = 0; mode.HSkew = 0; OOP_GetAttr(sync, aHidd_Sync_HDisp, &mode.HDisplay); OOP_GetAttr(sync, aHidd_Sync_VDisp, &mode.VDisplay); OOP_GetAttr(sync, aHidd_Sync_HSyncStart, &mode.HSyncStart); OOP_GetAttr(sync, aHidd_Sync_VSyncStart, &mode.VSyncStart); OOP_GetAttr(sync, aHidd_Sync_HSyncEnd, &mode.HSyncEnd); OOP_GetAttr(sync, aHidd_Sync_VSyncEnd, &mode.VSyncEnd); OOP_GetAttr(sync, aHidd_Sync_HTotal, &mode.HTotal); OOP_GetAttr(sync, aHidd_Sync_VTotal, &mode.VTotal); ObtainSemaphore(&XSD(cl)->HW_acc); /* Now, when the best display mode is chosen, we can build it */ vgaInitMode(&mode, data->Regs); vgaLoadPalette(data->Regs,(unsigned char *)NULL); /* Because of not defined BitMap_Show method show bitmap immediately */ vgaRestore(data->Regs, FALSE); vgaRefreshArea(data, 1, &box); ReleaseSemaphore(&XSD(cl)->HW_acc); XSD(cl)->visible = data; /* Set created object as visible */ ReturnPtr("VGAGfx.BitMap::New()", OOP_Object *, o); } } /* if got data->VideoData */ FreeVec(data->Regs); } /* if got data->Regs */ { OOP_MethodID disp_mid = OOP_GetMethodID(IID_Root, moRoot_Dispose); OOP_CoerceMethod(cl, o, (OOP_Msg) &disp_mid); } o = NULL; } /* if created object */
static AROS_UFH3(void, Enumerator, AROS_UFHA(struct Hook *, hook, A0), AROS_UFHA(OOP_Object *, device, A2), AROS_UFHA(APTR, msg, A1)) { AROS_USERFUNC_INIT ULONG VendorID,ProductID; int i; OOP_GetAttr(device, aHidd_PCIDevice_ProductID, &ProductID); OOP_GetAttr(device, aHidd_PCIDevice_VendorID, &VendorID); D(bug("[ac97] Found audio device %04x:%04x\n", VendorID, ProductID)); for (i=0; support[i].VendorID; i++) { if (VendorID == support[i].VendorID && ProductID == support[i].ProductID) { struct TagItem attrs[] = { { aHidd_PCIDevice_isIO, TRUE }, { aHidd_PCIDevice_isMEM, FALSE }, { aHidd_PCIDevice_isMaster, TRUE }, { TAG_DONE, 0UL }, }; D(bug("[ac97] Found supported '%s' card\n", support[i].Model)); ac97Base->cardfound = TRUE; ac97Base->mixer_set_reg = i8x0_set_reg; ac97Base->mixer_get_reg = i8x0_get_reg; OOP_SetAttrs(device, (struct TagItem *)&attrs); OOP_GetAttr(device, aHidd_PCIDevice_Base0, &ac97Base->mixerbase); OOP_GetAttr(device, aHidd_PCIDevice_Base1, &ac97Base->dmabase); OOP_GetAttr(device, aHidd_PCIDevice_INTLine, &ac97Base->irq_num); D(bug("[ac97] Mixer IO base %x\n", ac97Base->mixerbase)); D(bug("[ac97] DMA IO base %x\n", ac97Base->dmabase)); outl(2, ac97Base->dmabase + GLOB_CNT); ac97Base->mixer_set_reg(ac97Base, AC97_RESET, 0); ac97Base->mixer_set_reg(ac97Base, AC97_POWERDOWN, 0); /* Set master volume to no attenuation, mute off */ ac97Base->mixer_set_reg(ac97Base, AC97_MASTER_VOL, 0x0000); ac97Base->mixer_set_reg(ac97Base, AC97_HEADPHONE_VOL, 0x0000); ac97Base->mixer_set_reg(ac97Base, AC97_TONE, 0x0f0f); D(bug("[ac97] Powerdown = %02x\n", ac97Base->mixer_get_reg(ac97Base, AC97_POWERDOWN))); D(bug("[ac97] GLOB_CNT = %08x\n", inl(ac97Base->dmabase + GLOB_CNT))); D(bug("[ac97] GLOB_STA = %08x\n", inl(ac97Base->dmabase + GLOB_STA))); /* int i; for (i=0; i < 64; i+=2) { D(bug("[ac97] reg %02x = %04x\n", i, ac97Base->mixer_get_reg(ac97Base, i))); } */ outl(ac97Base->PCM_out, ac97Base->dmabase + PO_BDBAR); D(bug("[ac97] PO_BDBAR=%08x\n", inl(ac97Base->dmabase + PO_BDBAR))); D(bug("[ac97] PO_REGS=%08x\n", inl(ac97Base->dmabase + PO_CIV))); D(bug("[ac97] PO_PICB=%04x\n", inw(ac97Base->dmabase + PO_PICB))); D(bug("[ac97] PO_PIV=%02x\n", inb(ac97Base->dmabase + PO_PIV))); D(bug("[ac97] PO_CR=%02x\n", inb(ac97Base->dmabase + PO_CR))); } } AROS_USERFUNC_EXIT }
AROS_UFH3(void, PCI_Enumerator, AROS_UFHA(struct Hook *, hook, A0), AROS_UFHA(OOP_Object *, pciDevice, A2), AROS_UFHA(APTR, message, A1)) { AROS_USERFUNC_INIT char *CardName, *CardChipName; IPTR DeviceID, VendorID, RevisionID, CardCapabilities; BOOL FoundCompatNIC = FALSE; D(bug("[rtl8139] PCI_Enumerator(PCI Device Obj @ %p)\n", pciDevice)); LIBBASETYPEPTR LIBBASE = (LIBBASETYPEPTR)hook->h_Data; OOP_GetAttr(pciDevice, aHidd_PCIDevice_VendorID, &VendorID); OOP_GetAttr(pciDevice, aHidd_PCIDevice_ProductID, &DeviceID); OOP_GetAttr(pciDevice, aHidd_PCIDevice_RevisionID, &RevisionID); if ((VendorID == 0x10ec) && (DeviceID == 0x8129)) { FoundCompatNIC = TRUE; CardCapabilities = RTLc_HAS_MII_XCVR; CardName = "RealTek RTL8129"; CardChipName = "RTL8129"; } else if ((VendorID == 0x10ec) && ((DeviceID == 0x8138) || (DeviceID == 0x8139))) { FoundCompatNIC = TRUE; if ((DeviceID == 0x8139) && (RevisionID >= 0x20)) { CardCapabilities = RTLc_HAS_CHIP_XCVR | RTLc_HAS_LNK_CHNG | RTLc_HAS_DESC; CardName = "RealTek RTL8139D"; CardChipName = "RTL8139D"; } else { CardCapabilities = RTLc_HAS_CHIP_XCVR | RTLc_HAS_LNK_CHNG; CardName = "RealTek RTL8139C"; CardChipName = "RTL8139C"; } } else if ((VendorID == 0x1113) && (DeviceID == 0x1211)) { FoundCompatNIC = TRUE; CardCapabilities = RTLc_HAS_CHIP_XCVR | RTLc_HAS_LNK_CHNG; CardName = "Accton EN-1207D Fast Ethernet"; CardChipName = "RTL8139"; } else if ((VendorID == 0x1186) && (DeviceID == 0x1300)) { FoundCompatNIC = TRUE; CardCapabilities = RTLc_HAS_CHIP_XCVR | RTLc_HAS_LNK_CHNG; CardName = "D-Link DFE-538TX"; CardChipName = "RTL8139"; } else if ((VendorID == 0x018a) && (DeviceID == 0x0106)) { FoundCompatNIC = TRUE; CardCapabilities = RTLc_HAS_CHIP_XCVR | RTLc_HAS_LNK_CHNG; CardName = "LevelOne FPC-0106Tx"; CardChipName = "RTL8139"; } else if ((VendorID == 0x021b) && (DeviceID == 0x8139)) { FoundCompatNIC = TRUE; CardCapabilities = RTLc_HAS_CHIP_XCVR | RTLc_HAS_LNK_CHNG; CardName = "Compaq HNE-300"; CardChipName = "RTL8139"; } if (FoundCompatNIC) { D(bug("[rtl8139] PCI_Enumerator: Found %s NIC [%s], PCI_ID %04x:%04x Rev:%d\n", CardName, CardChipName, VendorID, DeviceID, RevisionID)); struct RTL8139Unit *unit = NULL; if ((unit = CreateUnit(LIBBASE, pciDevice, CardCapabilities, CardName, CardChipName)) != NULL) { AddTail(&LIBBASE->rtl8139b_Units, &unit->rtl8139u_Node); } else { D(bug("[rtl8139] PCI_Enumerator: Failed to create unit!\n")); return; } RTLD(bug("[%s] PCI_Enumerator: %s NIC I/O MEM @ %08x\n", unit->rtl8139u_name, unit->rtl8139u_rtl_chipname, unit->rtl8139u_BaseMem)) } AROS_USERFUNC_EXIT }