* Separated I2C from DDC a bit more.

* i2c_bus now contains a i2c_timing structure, so that you don't need
  both to talk to the I2C bus.
* Therefore, there is now a void ddc2_init_timing() function to get the
  the timing DDC needs.
* Cleanup in radeon's monitor_detection.c, and updated it to work with
  the DDC/I2C changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22265 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-09-19 22:36:55 +00:00
parent b15c8e82c2
commit 93a1ccabb9
5 changed files with 1034 additions and 1046 deletions
+9 -10
View File
@@ -1,21 +1,20 @@
/*
Copyright (c) 2003, Thomas Kurschel
Part of DDC driver
Main DDC communication
* Copyright (c) 2003, Thomas Kurschel
* Distributed under the terms of the MIT License.
*/
#ifndef _DDC_H
#define _DDC_H
#include "i2c.h"
#include "edid.h"
void ddc2_init_timing(i2c_bus *bus);
// read EDID and VDIF from monitor via ddc2
// (currently, *vdif and *vdif_len is always set to null)
status_t ddc2_read_edid1( const i2c_bus *bus, edid1_info *edid,
void **vdif, size_t *vdif_len );
status_t ddc2_read_edid1(const i2c_bus *bus, edid1_info *edid,
void **vdif, size_t *vdifLength);
#endif
#endif /* _DDC_H */
+14 -19
View File
@@ -1,17 +1,14 @@
/*
Copyright (c) 2003, Thomas Kurschel
Part of DDC driver
I2C protocoll
*/
* Copyright 2003, Thomas Kurschel. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _I2C_H
#define _I2C_H
#include <OS.h>
// timing for i2c bus
typedef struct i2c_timing {
// general timing as defined by standard
@@ -39,31 +36,29 @@ typedef struct i2c_timing {
// set signals on bus
typedef status_t (*i2c_set_signals)( void *cookie, int scl, int sda );
typedef status_t (*i2c_set_signals)(void *cookie, int clock, int data);
// read signals from bus
typedef status_t (*i2c_get_signals)( void *cookie, int *scl, int *sda );
typedef status_t (*i2c_get_signals)(void *cookie, int *clock, int *data);
// i2c bus definition
typedef struct i2c_bus {
void *cookie; // user-defined cookie
i2c_timing timing;
i2c_set_signals set_signals; // callback to set signals
i2c_get_signals get_signals; // callback to detect signals
} i2c_bus;
// send and receive data via i2c bus
status_t i2c_send_receive( const i2c_bus *bus, const i2c_timing *timing,
int slave_address,
const uint8 *write_buffer, size_t write_len,
uint8 *read_buffer, size_t read_len );
status_t i2c_send_receive(const i2c_bus *bus, int slave_address,
const uint8 *writeBuffer, size_t writeLength, uint8 *readBuffer,
size_t readLength);
// fill <timing> with standard 100kHz bus timing
void i2c_get100k_timing( i2c_timing *timing );
void i2c_get100k_timing(i2c_timing *timing);
// fill <timing> with standard 400kHz bus timing
// (as timing resolution is 1 microsecond, we cannot reach full speed!)
void i2c_get400k_timing( i2c_timing *timing );
void i2c_get400k_timing(i2c_timing *timing);
#endif
#endif /* _I2C_H */