Commit f5300ab2 authored by wdenk's avatar wdenk

Move TRAB burn-in tests to TRAB board directory

parent 68ce8957
......@@ -76,6 +76,7 @@ export CROSS_COMPILE
# The "tools" are needed early, so put this first
SUBDIRS = tools \
examples \
lib_generic \
lib_$(ARCH) \
cpu/$(CPU) \
......@@ -89,8 +90,7 @@ SUBDIRS = tools \
drivers \
drivers/sk98lin \
post \
post/cpu \
examples
post/cpu
#########################################################################
# U-Boot objects....order is important (i.e. start must be first)
......@@ -921,6 +921,7 @@ clean:
rm -f tools/gdb/astest tools/gdb/gdbcont tools/gdb/gdbsend
rm -f tools/env/fw_printenv tools/env/fw_setenv
rm -f board/cray/L1/bootscript.c board/cray/L1/bootscript.image
rm -f board/trab/trab_fkt
clobber: clean
find . -type f \
......
......@@ -28,9 +28,27 @@ LIB = lib$(BOARD).a
OBJS := trab.o flash.o vfd.o cmd_trab.o memory.o tsc2000.o
SOBJS := memsetup.o
gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
LOAD_ADDR = 0xc100000
#########################################################################
all: $(LIB) trab_fkt.srec trab_fkt.bin
$(LIB): $(OBJS) $(SOBJS)
$(AR) crv $@ $(OBJS) $(SOBJS)
trab_fkt.srec: trab_fkt.o rs485.o tsc2000.o $(LIB)
$(LD) -g -Ttext $(LOAD_ADDR) -o $(<:.o=) -e $(<:.o=) $^ $(LIB) \
-L../../examples -lstubs \
-L../../lib_generic -lgeneric \
-L$(gcclibdir) -lgcc
$(OBJCOPY) -O srec $(<:.o=) $@
trab_fkt.bin: trab_fkt.srec
$(OBJCOPY) -O binary $< $@ 2>/dev/null
clean:
rm -f $(SOBJS) $(OBJS)
......
/*
* (C) Copyright 2003
* Martin Krause, TQ-Systems GmbH, <martin.krause@tqs.de>
*
* Based on cpu/arm920t/serial.c, by Gary Jennejohn
* (C) Copyright 2002 Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <common.h>
#include <s3c2400.h>
#include "rs485.h"
static void rs485_setbrg (void);
static void rs485_cfgio (void);
static void set_rs485re(unsigned char rs485re_state);
static void set_rs485de(unsigned char rs485de_state);
static void rs485_setbrg (void);
#ifdef NOT_USED
static void trab_rs485_disable_tx(void);
static void trab_rs485_disable_rx(void);
#endif
#define UART_NR S3C24X0_UART1
/* CPLD-Register for controlling TRAB hardware functions */
#define CPLD_RS485_RE ((volatile unsigned long *)0x04028000)
static void rs485_setbrg (void)
{
S3C24X0_UART * const uart = S3C24X0_GetBase_UART(UART_NR);
int i;
unsigned int reg = 0;
/* value is calculated so : (int)(PCLK/16./baudrate) -1 */
/* reg = (33000000 / (16 * gd->baudrate)) - 1; */
reg = (33000000 / (16 * 38.400)) - 1;
/* FIFO enable, Tx/Rx FIFO clear */
uart->UFCON = 0x07;
uart->UMCON = 0x0;
/* Normal,No parity,1 stop,8 bit */
uart->ULCON = 0x3;
/*
* tx=level,rx=edge,disable timeout int.,enable rx error int.,
* normal,interrupt or polling
*/
uart->UCON = 0x245;
uart->UBRDIV = reg;
for (i = 0; i < 100; i++);
}
static void rs485_cfgio (void)
{
S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
gpio->PFCON &= ~(0x3 << 2);
gpio->PFCON |= (0x2 << 2); /* configure GPF1 as RXD1 */
gpio->PFCON &= ~(0x3 << 6);
gpio->PFCON |= (0x2 << 6); /* configure GPF3 as TXD1 */
gpio->PFUP |= (1 << 1); /* disable pullup on GPF1 */
gpio->PFUP |= (1 << 3); /* disable pullup on GPF3 */
gpio->PACON &= ~(1 << 11); /* set GPA11 (RS485_DE) to output */
}
/*
* Initialise the rs485 port with the given baudrate. The settings
* are always 8 data bits, no parity, 1 stop bit, no start bits.
*
*/
int rs485_init (void)
{
rs485_cfgio ();
rs485_setbrg ();
return (0);
}
/*
* Read a single byte from the rs485 port. Returns 1 on success, 0
* otherwise. When the function is succesfull, the character read is
* written into its argument c.
*/
int rs485_getc (void)
{
S3C24X0_UART * const uart = S3C24X0_GetBase_UART(UART_NR);
/* wait for character to arrive */
while (!(uart->UTRSTAT & 0x1));
return uart->URXH & 0xff;
}
/*
* Output a single byte to the rs485 port.
*/
void rs485_putc (const char c)
{
S3C24X0_UART * const uart = S3C24X0_GetBase_UART(UART_NR);
/* wait for room in the tx FIFO */
while (!(uart->UTRSTAT & 0x2));
uart->UTXH = c;
/* If \n, also do \r */
if (c == '\n')
rs485_putc ('\r');
}
/*
* Test whether a character is in the RX buffer
*/
int rs485_tstc (void)
{
S3C24X0_UART * const uart = S3C24X0_GetBase_UART(UART_NR);
return uart->UTRSTAT & 0x1;
}
void rs485_puts (const char *s)
{
while (*s) {
rs485_putc (*s++);
}
}
/*
* State table:
* RE DE Result
* 1 1 XMIT
* 0 0 RCV
* 1 0 Shutdown
*/
/* function that controls the receiver enable for the rs485 */
/* rs485re_state reflects the level (0/1) of the RE pin */
static void set_rs485re(unsigned char rs485re_state)
{
if(rs485re_state)
*CPLD_RS485_RE = 0x010000;
else
*CPLD_RS485_RE = 0x0;
}
/* function that controls the sender enable for the rs485 */
/* rs485de_state reflects the level (0/1) of the DE pin */
static void set_rs485de(unsigned char rs485de_state)
{
S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
/* This is on PORT A bit 11 */
if(rs485de_state)
gpio->PADAT |= (1 << 11);
else
gpio->PADAT &= ~(1 << 11);
}
void trab_rs485_enable_tx(void)
{
set_rs485de(1);
set_rs485re(1);
}
void trab_rs485_enable_rx(void)
{
set_rs485re(0);
set_rs485de(0);
}
#ifdef NOT_USED
static void trab_rs485_disable_tx(void)
{
set_rs485de(0);
}
static void trab_rs485_disable_rx(void)
{
set_rs485re(1);
}
#endif
/*
* (C) Copyright 2003
* Martin Krause, TQ-Systems GmbH, <martin.krause@tqs.de>
*
* Based on cpu/arm920t/serial.c, by Gary Jennejohn
* (C) Copyright 2002 Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _RS485_H_
#define _RS485_H_
#include <s3c2400.h>
int rs485_init (void);
int rs485_getc (void);
void rs485_putc (const char c);
int rs485_tstc (void);
void rs485_puts (const char *s);
void trab_rs485_enable_tx(void);
void trab_rs485_enable_rx(void);
#endif /* _RS485_H_ */
This diff is collapsed.
......@@ -29,6 +29,8 @@
#include <s3c2400.h>
#include "tsc2000.h"
#include "Pt1000_temp_data.h"
void spi_init(void)
{
S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
......@@ -56,7 +58,7 @@ void spi_init(void)
}
static void spi_wait_transmit_done(void)
void spi_wait_transmit_done(void)
{
S3C24X0_SPI * const spi = S3C24X0_GetBase_SPI();
......@@ -64,7 +66,7 @@ static void spi_wait_transmit_done(void)
}
static void tsc2000_write(unsigned short reg, unsigned short data)
void tsc2000_write(unsigned short reg, unsigned short data)
{
S3C24X0_SPI * const spi = S3C24X0_GetBase_SPI();
unsigned int command;
......@@ -84,7 +86,7 @@ static void tsc2000_write(unsigned short reg, unsigned short data)
}
static unsigned short tsc2000_read (unsigned short reg)
unsigned short tsc2000_read (unsigned short reg)
{
unsigned short command, data;
S3C24X0_SPI * const spi = S3C24X0_GetBase_SPI();
......@@ -108,7 +110,7 @@ static unsigned short tsc2000_read (unsigned short reg)
}
static void tsc2000_set_mux (unsigned int channel)
void tsc2000_set_mux (unsigned int channel)
{
S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
......@@ -185,7 +187,7 @@ static void tsc2000_set_mux (unsigned int channel)
}
static void tsc2000_set_range (unsigned int range)
void tsc2000_set_range (unsigned int range)
{
S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
......@@ -206,7 +208,7 @@ static void tsc2000_set_range (unsigned int range)
}
static u16 tsc2000_read_channel (unsigned int channel)
u16 tsc2000_read_channel (unsigned int channel)
{
u16 res;
......@@ -284,7 +286,7 @@ void tsc2000_reg_init (void)
}
static int tsc2000_interpolate(long value, long data[][2], long *result)
int tsc2000_interpolate(long value, long data[][2], long *result)
{
int i;
......@@ -311,7 +313,7 @@ static int tsc2000_interpolate(long value, long data[][2], long *result)
}
static void adc_wait_conversion_done(void)
void adc_wait_conversion_done(void)
{
while (!(tsc2000_read(TSC2000_REG_ADC) & (1 << 14)));
}
......@@ -28,8 +28,6 @@
#ifndef _TSC2000_H_
#define _TSC2000_H_
#include "Pt1000_temp_data.h"
/* temperature channel multiplexer definitions */
#define CON_MUX0 (gpio->PCCON = (gpio->PCCON & 0x0FFFFFCFF) | 0x00000100)
#define CLR_MUX0 (gpio->PCDAT &= 0x0FFEF)
......@@ -116,17 +114,17 @@
#define ERROR_BATTERY 220 /* must be adjusted, if R68 is changed on
* TRAB */
static void tsc2000_write(unsigned short, unsigned short);
static unsigned short tsc2000_read (unsigned short);
static u16 tsc2000_read_channel (unsigned int);
static void tsc2000_set_mux (unsigned int);
static void tsc2000_set_range (unsigned int);
void tsc2000_write(unsigned short, unsigned short);
unsigned short tsc2000_read (unsigned short);
u16 tsc2000_read_channel (unsigned int);
void tsc2000_set_mux (unsigned int);
void tsc2000_set_range (unsigned int);
void tsc2000_reg_init (void);
s32 tsc2000_contact_temp (void);
static void spi_wait_transmit_done (void);
void spi_wait_transmit_done (void);
void spi_init(void);
static int tsc2000_interpolate(long value, long data[][2], long *result);
static void adc_wait_conversion_done(void);
int tsc2000_interpolate(long value, long data[][2], long *result);
void adc_wait_conversion_done(void);
static inline void SET_CS_TOUCH(void)
......
......@@ -69,11 +69,6 @@ ifeq ($(BOARD),oxc)
SREC += eepro100_eeprom.srec
endif
##ifeq ($(BOARD),trab)
##SREC += trab_fkt.srec
##BIN += trab_fkt.bin
##endif
OBJS = $(SREC:.srec=.o)
LIB = libstubs.a
......
......@@ -10,6 +10,8 @@ EXPORT_FUNC(malloc)
EXPORT_FUNC(free)
EXPORT_FUNC(udelay)
EXPORT_FUNC(get_timer)
EXPORT_FUNC(vprintf)
EXPORT_FUNC(do_reset)
#if (CONFIG_COMMANDS & CFG_CMD_I2C)
EXPORT_FUNC(i2c_write)
EXPORT_FUNC(i2c_read)
......
......@@ -18,6 +18,8 @@ void *malloc(size_t);
void free(void*);
void udelay(unsigned long);
unsigned long get_timer(unsigned long);
void vprintf(const char *, va_list);
void do_reset (void);
#if (CONFIG_COMMANDS & CFG_CMD_I2C)
int i2c_write (uchar, uint, int , uchar* , int);
int i2c_read (uchar, uint, int , uchar* , int);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment