Commit affd3b6b authored by Kirk Webb's avatar Kirk Webb
Browse files

Bug fixes for the FreeBSD version of healthd. The Heceta-2 chip was not being...

Bug fixes for the FreeBSD version of healthd.  The Heceta-2 chip was not being properly initialized (PC850s).  These changes also internalize the initilization, so the external program that used to do it is deprecated (h2init).
parent 78f2275f
......@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: getMBinfo-bsd.c,v 1.1 2001-12-05 18:45:08 kwebb Exp $
* $Id: getMBinfo-bsd.c,v 1.2 2002-03-05 20:35:37 kwebb Exp $
*/
/************************************************
......@@ -41,6 +41,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <unistd.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
......@@ -64,6 +65,8 @@ static struct lm_methods *this_method;
#define ReadByte(addr) (this_method->Read((addr)))
#define WriteByte(addr, val) (this_method->Write((addr), (val)))
#define MAXTRIES 4
/*----------------------
Restarting Chip
----------------------*/
......@@ -91,7 +94,14 @@ FiniMBInfo(void)
int
RstChip(void) {
return WriteByte(0x40,0x01);
int i;
for (i = 0; i < MAXTRIES; ++i) {
WriteByte(0x40,0x01);
usleep(200);
if (ReadByte(0x40) == 0x01) return 0;
}
return -1;
}
unsigned int
......
......@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: healthd.c,v 1.1 2001-12-05 18:45:08 kwebb Exp $
* $Id: healthd.c,v 1.2 2002-03-05 20:35:37 kwebb Exp $
*/
/*
*
......@@ -282,7 +282,7 @@ main(int argc, char *argv[]) {
struct servent *sp;
struct timeval to;
unsigned long port;
int psd;
int psd = -1;
struct sockaddr_in paddr;
struct hostent *hent;
......@@ -340,9 +340,9 @@ main(int argc, char *argv[]) {
LocalOnly = 0;
#ifdef INET6
while((ch=getopt(argc, argv, "1246BDILSP:Vc:df:t:p:")) != -1) {
while((ch=getopt(argc, argv, "1246BDILSP:Vc:df:t:p:q")) != -1) {
#else /* !INET6 */
while((ch=getopt(argc, argv, "12BDILSP:Vc:df:t:p:")) != -1) {
while((ch=getopt(argc, argv, "12BDILSP:Vc:df:t:p:q")) != -1) {
#endif /* !INET6 */
switch(ch){
case '1':
......@@ -482,6 +482,11 @@ main(int argc, char *argv[]) {
exit(1);
}
if (RstChip() < 0) {
perror("RstChip");
exit(1);
}
if (local || debug) {
/* If debug mode or local mode don't open a socket */
LocalOnly = 1;
......
Supports Markdown
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