Subject: port-amiga/740: fix the savebug of the amiga clock
To: None <gnats-admin@NetBSD.ORG>
From: None <root@arresum.inka.de>
List: netbsd-bugs
Date: 01/19/1995 15:50:03
>Number:         740
>Category:       port-amiga
>Synopsis:       fix the savebug of the amiga clock
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 19 15:50:02 1995
>Originator:     Superuser
>Organization:
"	"
>Release:        NetBSD-current 01-15-95
>Environment:
	
System: NetBSD arresum.inka.de 1.0A NetBSD 1.0A (VEEGO) #17: Wed Jan 18 13:02:31 GMT+0100 1995 root@arresum.inka.de:/src/sys/arch/amiga/compile/VEEGO amiga


>Description:
There was some typing mistakes in the clock.c source and therefore this code was
disabled by some #ifdef 0
>How-To-Repeat:
see above
>Fix:

*** clock.c-orig	Wed Dec 28 12:21:15 1994
--- clock.c	Fri Jan  6 13:42:52 1995
***************
*** 703,709 ****
  a3gettod()
  {
  	struct rtclock3000 *rt;
! 	int i, year, month, day, hour, min, sec;
  	u_long tmp;
  
  	rt = clockaddr;
--- 703,709 ----
  a3gettod()
  {
  	struct rtclock3000 *rt;
! 	int i, year, month, day, wday, hour, min, sec;
  	u_long tmp;
  
  	rt = clockaddr;
***************
*** 715,720 ****
--- 715,721 ----
  	sec   = rt->second1 * 10 + rt->second2;
  	min   = rt->minute1 * 10 + rt->minute2;
  	hour  = rt->hour1   * 10 + rt->hour2;
+ 	wday  = rt->weekday;
  	day   = rt->day1    * 10 + rt->day2;
  	month = rt->month1  * 10 + rt->month2;
  	year  = rt->year1   * 10 + rt->year2   + 1900;
***************
*** 724,729 ****
--- 725,732 ----
  
  	if (range_test(hour, 0, 23))
  		return(0);
+ 	if (range_test(wday, 0, 6))
+ 		return(0);
  	if (range_test(day, 1, 31))
  		return(0);
  	if (range_test(month, 1, 12))
***************
*** 756,761 ****
--- 759,765 ----
  	u_char sec1, sec2;
  	u_char min1, min2;
  	u_char hour1, hour2;
+ /*	u_char wday; */
  	u_char day1, day2;
  	u_char mon1, mon2;
  	u_char year1, year2;
***************
*** 766,774 ****
  	 * there seem to be problems with the bitfield addressing
  	 * currently used..
  	 */
! return(0);
! #if not_yet
! 	if (rt)
  		return 0;
  
  	/* prepare values to be written to clock */
--- 770,777 ----
  	 * there seem to be problems with the bitfield addressing
  	 * currently used..
  	 */
! 
! 	if (! rt)
  		return 0;
  
  	/* prepare values to be written to clock */
***************
*** 809,831 ****
  	day1 = day / 10;
  	day2 = day % 10;
  
! 	rt->control1 = CONTROL1_HOLD_CLOCK;
  	rt->second1 = sec1;
  	rt->second2 = sec2;
  	rt->minute1 = min1;
  	rt->minute2 = min2;
  	rt->hour1   = hour1;
  	rt->hour2   = hour2;
  	rt->day1    = day1;
  	rt->day2    = day2;
  	rt->month1  = mon1;
  	rt->month2  = mon2;
  	rt->year1   = year1;
  	rt->year2   = year2;
! 	rt->control2 = CONTROL1_FREE_CLOCK;
  
  	return 1;
- #endif
  }
  
  long
--- 812,834 ----
  	day1 = day / 10;
  	day2 = day % 10;
  
! 	rt->control1 = A3CONTROL1_HOLD_CLOCK;
  	rt->second1 = sec1;
  	rt->second2 = sec2;
  	rt->minute1 = min1;
  	rt->minute2 = min2;
  	rt->hour1   = hour1;
  	rt->hour2   = hour2;
+ /*	rt->weekday = wday; */
  	rt->day1    = day1;
  	rt->day2    = day2;
  	rt->month1  = mon1;
  	rt->month2  = mon2;
  	rt->year1   = year1;
  	rt->year2   = year2;
! 	rt->control1 = A3CONTROL1_FREE_CLOCK;
  
  	return 1;
  }
  
  long
***************
*** 917,924 ****
  	 *
  	 * XXX Check out the above where we (hour1 & 3)
  	 */
! return(0);
! #if not_yet
  	if (! rt)
  		return 0;
  
--- 920,926 ----
  	 *
  	 * XXX Check out the above where we (hour1 & 3)
  	 */
! 
  	if (! rt)
  		return 0;
  
***************
*** 963,969 ****
  	/* 
  	 * XXXX spin wait as with reading???
  	 */
! 	rt->control1 = A2CONTROL1_HOLD_CLOCK;
  	rt->second1 = sec1;
  	rt->second2 = sec2;
  	rt->minute1 = min1;
--- 965,971 ----
  	/* 
  	 * XXXX spin wait as with reading???
  	 */
! 	rt->control1 |= A2CONTROL1_HOLD;
  	rt->second1 = sec1;
  	rt->second2 = sec2;
  	rt->minute1 = min1;
***************
*** 976,983 ****
  	rt->month2  = mon2;
  	rt->year1   = year1;
  	rt->year2   = year2;
! 	rt->control2 = CONTROL1_FREE_CLOCK;
  
    return 1;
- #endif
  }
--- 978,984 ----
  	rt->month2  = mon2;
  	rt->year1   = year1;
  	rt->year2   = year2;
! 	rt->control2 &= ~A2CONTROL1_HOLD;
  
    return 1;
  }
>Audit-Trail:
>Unformatted: