#ifdef CONFIG_COCOSDC
devsdc_init( );
#endif
- dwtime_init( );
+ if ( ! dw_init() )
+ dwtime_init( );
inittod();
sock_init();
}
#include <drivewire.h>
#include <printf.h>
#include <kdata.h>
+#include <ttydw.h>
#include "config.h"
#define DISC __attribute__((section(".discard")))
static int get_time( uint8_t *tbuf )
{
int ret;
-
+
+ if ( dwtype == DWTYPE_NOTFOUND )
+ return -1;
tbuf[0]=0x23;
ret=dw_transaction( tbuf, 1, tbuf, 6, 0 );
if( ret ) return -1;
#include "cpu.h"
+int strcmp( char *a, char *b ){
+ int ret;
+ while (1){
+ ret = *a - *b++;
+ if( ! *a || ret )
+ return ret;
+ a++;
+ }
+}
size_t strlen(const char *p)
{
#include <kdata.h>
#include <printf.h>
#include <devtty.h>
+#include <ttydw.h>
+
+#define DISC __attribute__((section(".discard")))
struct blkbuf *bufpool_end = bufpool + NBUFS;
+
void platform_discard(void)
{
extern uint8_t discard_size;
}
/* Scan memory return number of 8k pages found */
-__attribute__((section(".discard")))
+DISC
int scanmem(void)
{
volatile uint8_t *mmu=(uint8_t *)0xffa8;
Map handling: We have flexible paging. Each map table consists
of a set of pages with the last page repeated to fill any holes.
*/
-
+DISC
void pagemap_init(void)
{
int i;
pagemap_add(6);
}
-
+DISC
void map_init(void)
{
}
-
+DISC
uint8_t platform_param(char *p)
{
+ if( !strcmp(p,"NODW") ){
+ dwtype = DWTYPE_NOTFOUND;
+ return -1;
+ }
return 0;
}
#include <printf.h>
#include <tty.h>
#include <devdw.h>
+#include <ttydw.h>
#define DW_FASTWRITE 0x80
#define DW_SETSTAT 0xC4
#define DW_SERREAD 0x43
#define DW_SERREADM 0x63
#define DW_INIT 0x5a
+#define DW_TIME 0x23
#define DW_VOPEN 0x29
#define DW_VCLOSE 0x2A
#define DW_NS_OFF ( DW_MIN_OFF + DW_VSER_NUM )
+/* type of connected drivewire server */
+uint8_t dwtype = 0;
+
/* Internal Structure to represent state of DW ports */
struct dw_in{
uint8_t flags; /* flags for port */
/* (re) Initializes DW */
-void dw_init( ){
- unsigned char buf[2];
+__attribute__((section(".discard")))
+int dw_init( ){
+ unsigned char buf[6];
+ char *s;
buf[0]=DW_INIT;
buf[1]=0x42;
- dw_transaction( buf,2,buf,1,0 );
+ kprintf("DW: ");
+ if ( dwtype == DWTYPE_NOTFOUND ){
+ kprintf("disabled\n");
+ return -1;
+ }
+ if ( dw_transaction( buf,2,buf,1,0 ) ){
+ buf[0] = DW_TIME;
+ if (dw_transaction( buf,1,buf,6,0 ) ){
+ dwtype = DWTYPE_NOTFOUND;
+ kprintf("not found\n");
+ return -1;
+ }
+ else {
+ s = "dw3";
+ dwtype = DWTYPE_DW3;
+ }
+ }
+ else {
+ kprintf(" 0x%x: ", buf[0] );
+ switch ( buf[0] ){
+ case DWTYPE_DW4:
+ s = "dw4";
+ break;
+ case DWTYPE_LWWIRE:
+ s = "lwwire";
+ break;
+ case DWTYPE_PYDRIVEWIRE:
+ s = "n6il";
+ break;
+ default:
+ s = "unknown";
+ buf[0] = DWTYPE_UNKNOWN;
+ break;
+ }
+ dwtype = buf[0];
+ }
+ kprintf("%s\n", s);
+ return 0;
}
+
#ifndef __TTYDW_DOT_H__
#define __TTYDW_DOT_H__
+/* Stores drivewire server type on boot */
+extern uint8_t dwtype;
+#define DWTYPE_DW3 0xfc
+#define DWTYPE_UNKNOWN 0xfd
+#define DWTYPE_NOTFOUND 0xfe
+#define DWTYPE_PYDRIVEWIRE 0xff
+#define DWTYPE_DW4 0x04
+#define DWTYPE_LWWIRE 0x80
+
+
void dw_putc( uint8_t minor, unsigned char c );
void dw_vopen( uint8_t minor );
void dw_vclose( uint8_t minor );
int dw_carrier( uint8_t minor );
-void dw_vpoll( );
+void dw_vpoll( void );
+int dw_init( void );
+
#endif