#ifndef _DRIVEWIRE_H
#define _DRIVEWIRE_H
+/* Kernel definition */
+uint16_t dw_transaction( uint8_t *send, uint16_t scnt,
+ uint8_t *recv, uint16_t rcnt, uint8_t rawf );
+
struct dw_trans{
uint8_t *sbuf; /* pointer to user-space send buffer */
uint16_t sbufz; /* size of send buffer */
#include <drivewire.h>
#include <printf.h>
#include <kdata.h>
+#include "config.h"
#define DISC __attribute__((section(".discard")))
/* A Classic, as stolen from Gnu */
-DISC uint32_t __mulsi3( uint32_t a, uint32_t b)
+DISC static uint32_t mul( uint32_t a, uint32_t b)
{
uint32_t r=0;
while (a){
DISC int dwtime_init( void )
{
- char buffer[6];
+ uint8_t buffer[6];
uint32_t ret;
/* get time packet */
/* calculate days from years */
ret=365;
- ret *= year - 70;
+ ret = mul( ret, year - 70 );
/* count leap days in preceding years */
ret += (year - 69) >> 2;
+
/* calculate days from months */
ret += mktime_moffset[month];
/* add in days in this month */
ret += day - 1;
/* convert to hours */
- ret *= 24;
+ ret = mul( ret, 24 );
ret += hour;
/* convert to minutes */
- ret *= 60;
+ ret = mul( ret, 60 );
ret += minute;
/* convert to seconds */
- ret *= 60;
+ ret = mul( ret, 60 );
ret += second;
tod.low=ret;
}
-#define CONFIG_DWTIME_INTERVAL 10 /* time between dw timer polls in secs */
/* Called every every decisec from timer.c */
uint8_t rtc_secs(void)