Clean spi.h and spi-target.h

Only target-specific (list of SPI targets) go in spi-target.h
API go into spi.h

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31615 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rafaël Carré 2012-01-07 22:04:12 +00:00
parent 12ef8723f8
commit 28d1af853c
6 changed files with 19 additions and 20 deletions

View File

@ -20,6 +20,15 @@
****************************************************************************/ ****************************************************************************/
#ifndef __SPI_H__ #ifndef __SPI_H__
#define __SPI_H__ #define __SPI_H__
#include "spi-target.h"
#include <inttypes.h>
#include <stdbool.h>
#include "spi-target.h" /* for SPI_target */
void spi_init(void);
int spi_block_transfer(enum SPI_target target,
const uint8_t *tx_bytes, unsigned int tx_size,
uint8_t *rx_bytes, unsigned int rx_size);
#endif #endif

View File

@ -28,7 +28,6 @@
#include "string-extra.h" /* memset16() */ #include "string-extra.h" /* memset16() */
#include "cpu.h" #include "cpu.h"
#include "spi.h" #include "spi.h"
#include "spi-target.h"
#include "lcd-target.h" #include "lcd-target.h"
#include "ltv350qv.h" #include "ltv350qv.h"

View File

@ -26,7 +26,7 @@
#include "backlight.h" #include "backlight.h"
#include "lcd.h" #include "lcd.h"
#include "power.h" #include "power.h"
#include "spi-target.h" #include "spi.h"
#include "lcd-target.h" #include "lcd-target.h"
short read_brightness = 0x0; short read_brightness = 0x0;

View File

@ -26,7 +26,6 @@
#include "backlight.h" #include "backlight.h"
#include "lcd.h" #include "lcd.h"
#include "power.h" #include "power.h"
#include "spi-target.h"
#include "lcd-target.h" #include "lcd-target.h"
static void _backlight_write_brightness(int brightness) static void _backlight_write_brightness(int brightness)

View File

@ -43,9 +43,12 @@ struct SPI_info {
bool clk_invert; bool clk_invert;
}; };
static const struct SPI_info spi_targets[] = static const struct SPI_info spi_targets[SPI_MAX_TARGETS] =
{ {
#ifndef CREATIVE_ZVx #if defined(CREATIVE_ZVx)
[SPI_target_LTV250QV] = { &IO_GIO_BITCLR2, &IO_GIO_BITSET2,
GIO_LCD_ENABLE, true, 0x07},
#elif defined(MROBE_500)
[SPI_target_TSC2100] = { &IO_GIO_BITCLR1, &IO_GIO_BITSET1, [SPI_target_TSC2100] = { &IO_GIO_BITCLR1, &IO_GIO_BITSET1,
GIO_TS_ENABLE, 0x260D, true}, GIO_TS_ENABLE, 0x260D, true},
/* RTC seems to have timing problems if the CLK idles low */ /* RTC seems to have timing problems if the CLK idles low */
@ -54,9 +57,6 @@ static const struct SPI_info spi_targets[] =
/* This appears to work properly idling low, idling high is very glitchy */ /* This appears to work properly idling low, idling high is very glitchy */
[SPI_target_BACKLIGHT] = { &IO_GIO_BITCLR1, &IO_GIO_BITSET1, [SPI_target_BACKLIGHT] = { &IO_GIO_BITCLR1, &IO_GIO_BITSET1,
GIO_BL_ENABLE, 0x2656, false}, GIO_BL_ENABLE, 0x2656, false},
#else
[SPI_target_LTV250QV] = { &IO_GIO_BITCLR2, &IO_GIO_BITSET2,
GIO_LCD_ENABLE, true, 0x07},
#endif #endif
}; };

View File

@ -22,23 +22,15 @@
#ifndef SPI_TARGET_H #ifndef SPI_TARGET_H
#define SPI_TARGET_H #define SPI_TARGET_H
#include <inttypes.h>
#include <stdbool.h>
enum SPI_target { enum SPI_target {
#ifndef CREATIVE_ZVx #if defined(CREATIVE_ZVx)
SPI_target_LTV250QV = 0,
#elif defined(MROBE_500)
SPI_target_TSC2100 = 0, SPI_target_TSC2100 = 0,
SPI_target_RX5X348AB, SPI_target_RX5X348AB,
SPI_target_BACKLIGHT, SPI_target_BACKLIGHT,
#else
SPI_target_LTV250QV = 0,
#endif #endif
SPI_MAX_TARGETS, SPI_MAX_TARGETS,
}; };
void spi_init(void);
int spi_block_transfer(enum SPI_target target,
const uint8_t *tx_bytes, unsigned int tx_size,
uint8_t *rx_bytes, unsigned int rx_size);
#endif #endif