osd-contiki/tests/romimg.c
Mariano Alvira 87cd9c7a36 update build system for board specific code that's 'local' to the
program you are building.

update tests to consolidate common code.
2010-02-26 14:04:10 -05:00

68 lines
1.2 KiB
C

#include <mc1322x.h>
#include <board.h>
#include "tests.h"
#include "put.h"
/* INC = 767; MOD = 9999 works: 115200 @ 24 MHz 16 bit sample */
#define INC 767
#define MOD 9999
void putc(uint8_t c);
void puts(uint8_t *s);
void put_hex(uint8_t x);
void put_hex16(uint16_t x);
void put_hex32(uint32_t x);
const uint8_t hex[16]={'0','1','2','3','4','5','6','7',
'8','9','a','b','c','d','e','f'};
#define DUMP_BASE 0x00000000
#define DUMP_LEN 0x00014000
//#define DUMP_LEN 16
void main(void) {
volatile uint32_t i;
volatile uint8_t *data;
uart_init(inc, mod);
for(data=DUMP_BASE; data<(DUMP_BASE+DUMP_LEN); data++) {
putc(*data);
}
while(1);
}
void putc(uint8_t c) {
while(reg(UT1CON)==31); /* wait for there to be room in the buffer */
reg(UART1_DATA) = c;
}
void puts(uint8_t *s) {
while(s && *s!=0) {
putc(*s++);
}
}
void put_hex(uint8_t x)
{
putc(hex[x >> 4]);
putc(hex[x & 15]);
}
void put_hex16(uint16_t x)
{
put_hex((x >> 8) & 0xFF);
put_hex((x) & 0xFF);
}
void put_hex32(uint32_t x)
{
put_hex((x >> 24) & 0xFF);
put_hex((x >> 16) & 0xFF);
put_hex((x >> 8) & 0xFF);
put_hex((x) & 0xFF);
}