intel_810: Style cleanup. No functional change

* I think the FunctionNames need to change to function_name
This commit is contained in:
Alexander von Gluck IV 2012-05-30 16:09:52 -05:00
parent e0ee3b7971
commit 0e8316cc90
11 changed files with 97 additions and 102 deletions

View File

@ -5,7 +5,6 @@
* Authors:
* Gerald Zajac
*/
#ifndef DRIVERINTERFACE_H
#define DRIVERINTERFACE_H
@ -23,7 +22,6 @@
#define ENABLE_DEBUG_TRACE // if defined, turns on debug output to syslog
#define ARRAY_SIZE(a) (int(sizeof(a) / sizeof(a[0]))) // get number of elements in an array
@ -81,12 +79,12 @@ struct SharedInfo {
bool bAccelerantInUse; // true = accelerant has been initialized
// Memory mappings.
area_id regsArea; // area_id for the memory mapped registers. It will
// be cloned into accelerant's address space.
area_id videoMemArea; // video memory area_id. Addr's shared with all teams.
area_id regsArea; // area_id for the memory mapped registers. It
// will be cloned into accelerant address space.
area_id videoMemArea; // addr shared with all teams.
addr_t videoMemAddr; // virtual video memory addr
phys_addr_t videoMemPCI; // physical video memory addr
uint32 videoMemSize; // video memory size in bytes (for frame buffer).
uint32 videoMemSize; // video memory size in bytes (for frame buffer)
uint32 maxFrameBufferSize; // max available video memory for frame buffer
@ -95,7 +93,7 @@ struct SharedInfo {
uint32 colorSpaceCount; // number of color spaces in array colorSpaces
// List of screen modes.
area_id modeArea; // area containing list of display modes the driver supports
area_id modeArea; // area containing list of display modes
uint32 modeCount; // number of display modes in the list
DisplayModeEx displayMode; // current display mode configuration
@ -103,7 +101,7 @@ struct SharedInfo {
edid1_info edidInfo;
bool bHaveEDID; // true = EDID info from device is in edidInfo
Benaphore engineLock; // for serializing access to the acceleration engine
Benaphore engineLock; // serializing access to the acceleration engine
};

View File

@ -6,6 +6,7 @@
* Gerald Zajac
*/
#include "accelerant.h"
#include <errno.h>
@ -13,7 +14,6 @@
#include <unistd.h>
AccelerantInfo gInfo; // global data used by source files of accelerant
static uint32 videoValue;
@ -40,8 +40,7 @@ SuppressArtifacts(void* dataPtr)
SharedInfo& si = *((SharedInfo*)dataPtr);
while (true)
{
while (true) {
uint32* src = ((uint32*)(si.videoMemAddr)) + si.videoMemSize / 4 - 1;
uint32 count = 65000;

View File

@ -5,12 +5,11 @@
* Authors:
* Gerald Zajac
*/
#ifndef _ACCELERANT_H
#define _ACCELERANT_H
#include "DriverInterface.h"
#include "DriverInterface.h"
#undef TRACE
@ -24,7 +23,6 @@ extern "C" void _sPrintf(const char* format, ...);
// Global data used by various source files of the accelerant.
struct AccelerantInfo {
int deviceFileDesc; // file descriptor of kernel driver
@ -48,7 +46,7 @@ extern AccelerantInfo gInfo;
// the functions that are unique to a particular chip family, will be prefixed
// with the name of the family, and the functions that are applicable to all
// chips will have no prefix.
//================================================================
// ================================================================
#if defined(__cplusplus)
extern "C" {
@ -95,11 +93,9 @@ status_t SyncToToken(sync_token* st);
#endif
// Prototypes for other functions that are called from source files other than
// where they are defined.
//============================================================================
// ============================================================================
status_t CreateModeList(bool (*checkMode)(const display_mode* mode));
bool IsModeUsable(const display_mode* mode);

View File

@ -6,6 +6,7 @@
* Gerald Zajac
*/
#include "accelerant.h"
#include "i810_regs.h"
@ -73,9 +74,9 @@ GetSyncToken(engine_token* engineToken, sync_token* syncToken)
status_t
SyncToToken(sync_token* syncToken)
{
(void)syncToken; // avoid compiler warning for unused arg
(void)syncToken;
// avoid compiler warning for unused arg
WaitEngineIdle();
return B_OK;
}

View File

@ -6,13 +6,15 @@
* Gerald Zajac
*/
#include "accelerant.h"
extern "C" void*
get_accelerant_hook(uint32 feature, void* data)
{
(void)data; // avoid compiler warning for unused arg
(void)data;
// avoid compiler warning for unused arg
switch (feature) {
// General

View File

@ -19,7 +19,6 @@
#include "i810_regs.h"
bool
I810_GetColorSpaceParams(int colorSpace, uint8& bitsPerPixel,
uint32& maxPixelClock)

View File

@ -14,6 +14,7 @@
All Rights Reserved.
*/
#include "accelerant.h"
#include "i810_regs.h"
@ -22,15 +23,14 @@
#include <unistd.h>
// I810_CalcVCLK -- Determine closest clock frequency to the one requested.
#define MAX_VCO_FREQ 600.0
#define TARGET_MAX_N 30
#define REF_FREQ 24.0
#define CALC_VCLK(m,n,p) (double)m / ((double)n * (1 << p)) * 4 * REF_FREQ
static void
CalcVCLK(double freq, uint16& clkM, uint16& clkN, uint16& clkP) {
int m, n, p;
@ -65,8 +65,8 @@ CalcVCLK(double freq, uint16& clkM, uint16& clkN, uint16& clkP) {
f_best = f_out;
errBest = f_err;
}
} while ((fabs(f_err) >= errTarget) &&
((n <= TARGET_MAX_N) || (fabs(errBest) > errMax)));
} while ((fabs(f_err) >= errTarget) && ((n <= TARGET_MAX_N)
|| (fabs(errBest) > errMax)));
if (fabs(f_err) < errTarget) {
m_best = m;
@ -236,8 +236,8 @@ I810_SetDisplayMode(const DisplayModeEx& mode)
OUTREG16(EIR, 0);
temp32 = INREG32(FWATER_BLC);
temp32 &= ~(LM_BURST_LENGTH | LM_FIFO_WATERMARK |
MM_BURST_LENGTH | MM_FIFO_WATERMARK);
temp32 &= ~(LM_BURST_LENGTH | LM_FIFO_WATERMARK
| MM_BURST_LENGTH | MM_FIFO_WATERMARK);
temp32 |= I810_GetWatermark(mode);
OUTREG32(FWATER_BLC, temp32);

View File

@ -13,7 +13,6 @@
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved.
*/
#ifndef __I810_REGS_H__
#define __I810_REGS_H__
@ -123,37 +122,48 @@
(OUTREG(addr, (INREG(addr) & ~mask) | (value & mask)))
static inline uint8 ReadCrtcReg(uint8 index)
static inline uint8
ReadCrtcReg(uint8 index)
{
OUTREG8(CRTC_INDEX, index);
return INREG8(CRTC_DATA);
}
static inline void WriteCrtcReg(uint8 index, uint8 value)
static inline void
WriteCrtcReg(uint8 index, uint8 value)
{
OUTREG8(CRTC_INDEX, index);
OUTREG8(CRTC_DATA, value);
}
static inline uint8 ReadGraphReg(uint8 index)
static inline uint8
ReadGraphReg(uint8 index)
{
OUTREG8(GRAPH_INDEX, index);
return INREG8(GRAPH_DATA);
}
static inline void WriteGraphReg(uint8 index, uint8 value)
static inline void
WriteGraphReg(uint8 index, uint8 value)
{
OUTREG8(GRAPH_INDEX, index);
OUTREG8(GRAPH_DATA, value);
}
static inline uint8 ReadSeqReg(uint8 index)
static inline uint8
ReadSeqReg(uint8 index)
{
OUTREG8(SEQ_INDEX, index);
return INREG8(SEQ_DATA);
}
static inline void WriteSeqReg(uint8 index, uint8 value)
static inline void
WriteSeqReg(uint8 index, uint8 value)
{
OUTREG8(SEQ_INDEX, index);
OUTREG8(SEQ_DATA, value);

View File

@ -34,6 +34,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
#include "accelerant.h"
@ -104,7 +105,6 @@ static WatermarkInfo watermarks_16[] = {
};
uint32
I810_GetWatermark(const DisplayModeEx& mode)
{

View File

@ -1,11 +1,12 @@
/*
* Copyright 2007-2012 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*
* Authors:
* Gerald Zajac
*/
#include "accelerant.h"
#include <create_display_modes.h> // common accelerant header file
@ -13,7 +14,6 @@
#include <unistd.h>
static bool
IsThereEnoughFBMemory(const display_mode* mode, uint32 bitsPerPixel)
{
@ -35,7 +35,6 @@ IsThereEnoughFBMemory(const display_mode* mode, uint32 bitsPerPixel)
}
bool
IsModeUsable(const display_mode* mode)
{
@ -134,7 +133,6 @@ CreateModeList(bool (*checkMode)(const display_mode* mode))
}
status_t
ProposeDisplayMode(display_mode* target, const display_mode* low,
const display_mode* high)
@ -223,7 +221,6 @@ SetDisplayMode(display_mode* pMode)
}
status_t
MoveDisplay(uint16 horizontalStart, uint16 verticalStart)
{
@ -269,7 +266,7 @@ GetModeList(display_mode* dmList)
status_t
GetDisplayMode(display_mode* current_mode)
{
*current_mode = gInfo.sharedInfo->displayMode; // return current display mode
*current_mode = gInfo.sharedInfo->displayMode; // current display mode
return B_OK;
}
@ -317,9 +314,7 @@ GetPixelClockLimits(display_mode* mode, uint32* low, uint32* high)
}
#ifdef __HAIKU__
status_t
GetEdidInfo(void* info, size_t size, uint32* _version)
{
@ -335,5 +330,4 @@ GetEdidInfo(void* info, size_t size, uint32* _version)
*_version = EDID_VERSION_1;
return B_OK;
}
#endif // __HAIKU__

View File

@ -6,6 +6,7 @@
* Gerald Zajac
*/
#include <AGP.h>
#include <KernelExport.h>
#include <PCI.h>
@ -56,9 +57,9 @@ static const ChipInfo chipTable[] = {
struct DeviceInfo {
uint32 openCount; // count of how many times device has been opened
uint32 openCount; // how many times device has been opened
int32 flags;
area_id sharedArea; // area shared between driver and accelerants
area_id sharedArea; // shared between driver and accelerants
SharedInfo* sharedInfo; // pointer to shared info area memory
vuint8* regs; // pointer to memory mapped registers
const ChipInfo* pChipInfo; // info about the selected chip
@ -76,7 +77,6 @@ static pci_module_info* gPCI;
// Prototypes for device hook functions.
static status_t device_open(const char* name, uint32 flags, void** cookie);
static status_t device_close(void* dev);
static status_t device_free(void* dev);
@ -100,9 +100,8 @@ static device_hooks gDeviceHooks =
};
// Video chip register definitions.
//=================================
// =================================
#define INTERRUPT_ENABLED 0x020a0
#define INTERRUPT_MASK 0x020a8
@ -116,7 +115,7 @@ static device_hooks gDeviceHooks =
// Macros for memory mapped I/O.
//==============================
// ==============================
#define INREG16(addr) (*((vuint16*)(di.regs + (addr))))
#define INREG32(addr) (*((vuint32*)(di.regs + (addr))))
@ -125,7 +124,6 @@ static device_hooks gDeviceHooks =
#define OUTREG32(addr, val) (*((vuint32*)(di.regs + (addr))) = (val))
static inline uint32
GetPCI(pci_info& info, uint8 offset, uint8 size)
{
@ -147,8 +145,8 @@ GetEdidFromBIOS(edid1_raw& edidRaw)
{
// Get the EDID info from the video BIOS, and return B_OK if successful.
#define ADDRESS_SEGMENT(address) ((addr_t)(address) >> 4)
#define ADDRESS_OFFSET(address) ((addr_t)(address) & 0xf)
#define ADDRESS_SEGMENT(address) ((addr_t)(address) >> 4)
#define ADDRESS_OFFSET(address) ((addr_t)(address) & 0xf)
vm86_state vmState;
@ -408,7 +406,6 @@ GetNextSupportedDevice(uint32& pciIndex, pci_info& pciInfo)
}
// #pragma mark - Kernel Interface
@ -526,7 +523,6 @@ find_device(const char* name)
}
// #pragma mark - Device Hooks