added skeleton for planned i2c API

This commit is contained in:
Markus Fröschle
2015-01-12 14:00:20 +00:00
parent 15a4e1fd55
commit fd1a2ff603
4 changed files with 55 additions and 1 deletions

View File

@@ -196,3 +196,4 @@ util/bas_string.c
util/printf_helper.S util/printf_helper.S
util/wait.c util/wait.c
bas.lk.in bas.lk.in
i2c/i2c.c

View File

@@ -52,7 +52,7 @@ TRGTDIRS= ./firebee ./m5484lite ./m54455
OBJDIRS=$(patsubst %, %/objs,$(TRGTDIRS)) OBJDIRS=$(patsubst %, %/objs,$(TRGTDIRS))
TOOLDIR=util TOOLDIR=util
VPATH=dma exe flash fs if kbd pci spi sys usb net util video radeon x86emu xhdi VPATH=dma exe flash fs i2c if kbd pci spi sys usb net util video radeon x86emu xhdi
# Linker control file. The final $(LDCFILE) is intermediate only (preprocessed version of $(LDCSRC) # Linker control file. The final $(LDCFILE) is intermediate only (preprocessed version of $(LDCSRC)
LDCFILE=bas.lk LDCFILE=bas.lk
@@ -85,6 +85,7 @@ CSRCS= \
s19reader.c \ s19reader.c \
flash.c \ flash.c \
dma.c \ dma.c \
i2c.c \
xhdi_sd.c \ xhdi_sd.c \
xhdi_interface.c \ xhdi_interface.c \
pci.c \ pci.c \

41
BaS_gcc/i2c/i2c.c Normal file
View File

@@ -0,0 +1,41 @@
#include <bas_types.h>
void i2c_init(void)
{
}
void i2c_set_frequency(int hz)
{
}
int i2c_read(int address, char *data, int lengt, bool repeated)
{
return 0;
}
int i2c_read_byte(int ack)
{
return 0;
}
int i2c_write(int address, const char *data, int length, bool repeated)
{
return 0;
}
int i2c_write_byte(int data)
{
return 0;
}
void i2c_start(void)
{
}
void i2c_stop(void)
{
}

View File

@@ -28,6 +28,8 @@
#ifndef _I2C_H #ifndef _I2C_H
#define _I2C_H #define _I2C_H
#include "bas_types.h"
/* --- General options ------------------------------------------------ */ /* --- General options ------------------------------------------------ */
struct i2c_msg; struct i2c_msg;
@@ -82,4 +84,13 @@ struct i2c_msg
unsigned char *buf; /* pointer to msg data */ unsigned char *buf; /* pointer to msg data */
}; };
extern void i2c_init(void);
extern void i2c_set_frequency(int hz);
extern int i2c_read(int address, char *data, int lengt, bool repeated);
extern int i2c_read_byte(int ack);
extern int i2c_write(int address, const char *data, int length, bool repeated);
extern int i2c_write_byte(int data);
extern void i2c_start(void);
extern void i2c_stop(void);
#endif /* _I2C_H */ #endif /* _I2C_H */