Commit b20e998e authored by Wesley W. Terpstra's avatar Wesley W. Terpstra

Replaced CERN 1wire software with code capable of addressing multiple devices.

Read the MAC address either from EEPROM or sensor ID (preferring EEPROM).
parent 01aac71f
......@@ -86,6 +86,7 @@ OBJS_PLATFORM=arch/lm32/crt0.o arch/lm32/irq.o arch/lm32/debug.o
include shell/shell.mk
include tests/tests.mk
include lib/lib.mk
include sockitowm/sockitowm.mk
include softpll/softpll.mk
include dev/dev.mk
......@@ -96,7 +97,7 @@ SIZE=$(CROSS_COMPILE)size
CFLAGS= $(CFLAGS_PLATFORM) $(CFLAGS_PTPD) $(INCLUDE_DIRS) -ffunction-sections -fdata-sections -Os -Iinclude -include include/trace.h $(PTPD_CFLAGS) -I$(PTP_NOPOSIX)/PTPWRd -I. -Isoftpll
LDFLAGS= $(LDFLAGS_PLATFORM) -ffunction-sections -fdata-sections -Wl,--gc-sections -Os -Iinclude
OBJS=$(OBJS_PLATFORM) $(OBJS_WRC) $(OBJS_PTPD) $(OBJS_SHELL) $(OBJS_TESTS) $(OBJS_LIB) $(OBJS_SOFTPLL) $(OBJS_DEV)
OBJS=$(OBJS_PLATFORM) $(OBJS_WRC) $(OBJS_PTPD) $(OBJS_SHELL) $(OBJS_TESTS) $(OBJS_LIB) $(OBJS_SOCKITOWM) $(OBJS_SOFTPLL) $(OBJS_DEV)
OUTPUT=wrc
REVISION=$(shell git rev-parse HEAD)
......
......@@ -3,8 +3,8 @@ OBJS_DEV = dev/eeprom.o \
dev/ep_pfilter.o \
dev/i2c.o \
dev/minic.o \
dev/onewire.o \
dev/pps_gen.o \
dev/syscon.o \
dev/uart.o \
dev/sfp.o
dev/sfp.o \
dev/persistent_mac.o
#include <stdio.h>
#include "board.h"
#define R_CSR 0x0
#define R_CDR 0x4
#define CSR_DAT_MSK (1<<0)
#define CSR_RST_MSK (1<<1)
#define CSR_OVD_MSK (1<<2)
#define CSR_CYC_MSK (1<<3)
#define CSR_PWR_MSK (1<<4)
#define CSR_IRQ_MSK (1<<6)
#define CSR_IEN_MSK (1<<7)
#define CSR_SEL_OFS 8
#define CSR_SEL_MSK (0xF<<8)
#define CSR_POWER_OFS 16
#define CSR_POWER_MSK (0xFFFF<<16)
#define CDR_NOR_MSK (0xFFFF<<0)
#define CDR_OVD_OFS 16
#define CDR_OVD_MSK (0xFFFF<<16)
#define CLK_DIV_NOR 175 //clock divider for normal mode
#define CLK_DIV_OVD 124/2 //clock divider for overdrive mode
static inline void ow_writel(uint32_t reg, uint32_t data)
{
*(volatile uint32_t *) (BASE_ONEWIRE + reg) = data;
}
static inline uint32_t ow_readl(uint32_t reg)
{
return *(volatile uint32_t *)(BASE_ONEWIRE + reg);
}
void ow_init()
{
//set clock dividers for normal and overdrive mode
ow_writel( R_CDR, ((CLK_DIV_NOR & CDR_NOR_MSK) | (( CLK_DIV_OVD << CDR_OVD_OFS) & CDR_OVD_MSK)) );
}
static uint32_t ow_reset(uint32_t port)
{
uint32_t reg, data;
data = ( (port<<CSR_SEL_OFS) & CSR_SEL_MSK) |
CSR_CYC_MSK | CSR_RST_MSK; //start cycle, rst pulse request
ow_writel(R_CSR, data);
//wait until cycle done
while(ow_readl(R_CSR) & CSR_CYC_MSK);
reg = ow_readl(R_CSR);
return ~reg & CSR_DAT_MSK;
}
static uint32_t slot(uint32_t port, uint32_t bit)
{
uint32_t data, reg;
data = ( (port<<CSR_SEL_OFS) & CSR_SEL_MSK) |
CSR_CYC_MSK | (bit & CSR_DAT_MSK); //start cycle, write bit
ow_writel(R_CSR, data);
//wait until cycle done
while( ow_readl(R_CSR) & CSR_CYC_MSK );
reg = ow_readl(R_CSR);
return reg & CSR_DAT_MSK;
}
static inline uint32_t ow_read_bit(uint32_t port) { return slot(port, 0x1); }
static inline uint32_t ow_write_bit(uint32_t port, uint32_t bit) { return slot(port, bit); }
uint8_t ow_read_byte(uint32_t port)
{
uint32_t data = 0, i;
for(i=0;i<8;i++)
data |= ow_read_bit(port) << i;
return (uint8_t)data;
}
int8_t ow_write_byte(uint32_t port, uint32_t byte)
{
uint32_t data = 0;
uint8_t i;
uint32_t byte_old = byte;
for (i=0;i<8;i++)
{
data |= ow_write_bit(port, (byte & 0x1)) << i;
byte >>= 1;
}
return byte_old == data ? 0 : -1;
}
int ow_write_block(int port, uint8_t *block, int len)
{
uint32_t i;
for(i=0;i<len;i++)
*block++ = ow_write_byte(port, *block);
return 0;
}
int ow_read_block(int port, uint8_t *block, int len)
{
uint32_t i;
for(i=0;i<len;i++)
*block++ = ow_read_byte(port);
return 0;
}
#define ROM_SEARCH 0xF0
#define ROM_READ 0x33
#define ROM_MATCH 0x55
#define ROM_SKIP 0xCC
#define ROM_ALARM_SEARCH 0xEC
#define CONVERT_TEMP 0x44
#define WRITE_SCRATCHPAD 0x4E
#define READ_SCRATCHPAD 0xBE
#define COPY_SCRATCHPAD 0x48
#define RECALL_EEPROM 0xB8
#define READ_POWER_SUPPLY 0xB4
static uint8_t ds18x_id [8];
int8_t ds18x_read_serial(uint8_t *id)
{
uint8_t i;
if(!ow_reset(0))
return -1;
if(ow_write_byte(0, ROM_READ) < 0)
return -1;
for(i=0;i<8;i++)
{
*id = ow_read_byte(0);
id++;
}
return 0;
}
static int8_t ds18x_access(uint8_t *id)
{
int i;
if(!ow_reset(0))
return -1;
if(ow_write_byte(0, ROM_MATCH) < 0)
return -1;
for(i=0;i<8;i++)
if(ow_write_byte(0, id[i]) < 0)
return -1;
return 0;
}
int8_t ds18x_read_temp(uint8_t *id, int *temp_r)
{
int i, temp;
uint8_t data[9];
if(ds18x_access(id) < 0)
return -1;
ow_write_byte(0, READ_SCRATCHPAD);
for(i=0;i<9;i++) data[i] = ow_read_byte(0);
temp = ((int)data[1] << 8) | ((int)data[0]);
if(temp & 0x1000)
temp = -0x10000 + temp;
ds18x_access(id);
ow_write_byte(0, CONVERT_TEMP);
if(temp_r) *temp_r = temp;
return 0;
}
int ds18x_init()
{
ow_init();
if(ds18x_read_serial(ds18x_id) < 0)
return -1;
return ds18x_read_temp(ds18x_id, NULL);
}
#include "persistent_mac.h"
#include "../sockitowm/ownet.h"
#include "../sockitowm/findtype.h"
#define MAX_DEV1WIRE 8
#define DEBUG_PMAC 0
/* 0 = success, -1 = error */
int get_persistent_mac(unsigned char* mac)
{
unsigned char FamilySN[MAX_DEV1WIRE][8];
unsigned char read_buffer[32];
unsigned char portnum = ONEWIRE_PORT;
int i, devices, out;
// Find the device(s)
devices = 0;
devices += FindDevices(portnum, &FamilySN[devices], 0x28, MAX_DEV1WIRE - devices); /* Temperature 28 sensor (SPEC) */
devices += FindDevices(portnum, &FamilySN[devices], 0x42, MAX_DEV1WIRE - devices); /* Temperature 42 sensor (SCU) */
devices += FindDevices(portnum, &FamilySN[devices], 0x43, MAX_DEV1WIRE - devices); /* EEPROM */
out = -1;
for (i = 0; i < devices; ++i) {
/* If there is a temperature sensor, use it for the low three MAC values */
if (FamilySN[i][0] == 0x28 || FamilySN[i][0] == 0x42) {
mac[3] = FamilySN[i][3];
mac[4] = FamilySN[i][2];
mac[5] = FamilySN[i][1];
out = 0;
#ifdef DEBUG_PMAC
mprintf("Using temperature sensor ID: %x:%x:%x:%x:%x:%x:%x:%x\n",
FamilySN[i][7], FamilySN[i][6], FamilySN[i][5], FamilySN[i][4],
FamilySN[i][3], FamilySN[i][2], FamilySN[i][1], FamilySN[i][0]);
#endif
}
/* If there is an EEPROM, read page 0 for the MAC */
if (FamilySN[i][0] == 0x43) {
owLevel(portnum, MODE_NORMAL);
if (ReadMem43(portnum, FamilySN[i], EEPROM_MAC_PAGE, &read_buffer) == TRUE) {
if (read_buffer[0] == 0 && read_buffer[1] == 0 && read_buffer[2] == 0) {
/* Skip the EEPROM since it has not been programmed! */
#ifdef DEBUG_PMAC
mprintf("EEPROM %x:%x:%x:%x:%x:%x:%x:%x has not been programmed with a MAC\n",
FamilySN[i][7], FamilySN[i][6], FamilySN[i][5], FamilySN[i][4],
FamilySN[i][3], FamilySN[i][2], FamilySN[i][1], FamilySN[i][0]);
#endif
} else {
memcpy(mac, read_buffer, 6);
out = 0;
#ifdef DEBUG_PMAC
mprintf("Using EEPROM page: %x:%x:%x:%x:%x:%x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
}
#endif
}
}
}
return out;
}
/* 0 = success, -1 = error */
int set_persistent_mac(unsigned char* mac)
{
unsigned char FamilySN[MAX_DEV1WIRE][8];
unsigned char write_buffer[32];
unsigned char portnum = ONEWIRE_PORT;
int i, devices;
// Find the device(s)
devices = FindDevices(portnum, &FamilySN[0], 0x43, MAX_DEV1WIRE); /* EEPROM */
if (devices == 0) return -1;
memset(write_buffer, 0, sizeof(write_buffer));
memcpy(write_buffer, mac, 6);
/* Write the last EEPROM with the MAC */
owLevel(portnum, MODE_NORMAL);
if (Write43(portnum, FamilySN[devices-1], EEPROM_MAC_PAGE, &write_buffer) == TRUE)
return 0;
return -1;
}
#ifndef __ONEWIRE_H
#define __ONEWIRE_H
void ow_init();
uint32_t ow_reset(uint32_t port);
uint8_t ow_read_byte(uint32_t port);
int8_t ow_write_byte(uint32_t port, uint32_t byte);
int ow_write_block(int port, uint8_t *block, int len);
int ow_read_block(int port, uint8_t *block, int len);
int8_t ds18x_read_serial(uint8_t *id);
int8_t ds18x_read_temp(uint8_t *id, int *temp_r);
int ds18x_init();
#endif
#ifndef PERSISTENT_MAC_H
#define PERSISTENT_MAC_H
#define ONEWIRE_PORT 0
#define EEPROM_MAC_PAGE 0
/* 0 = success, -1 = error */
int get_persistent_mac(unsigned char* mac);
int set_persistent_mac(unsigned char* mac);
#endif
......@@ -136,7 +136,7 @@ void shell_init()
env_init();
cmd_len = cmd_pos = 0;
state = SH_PROMPT;
mprintf("\033[2J\033[1;1H");
// mprintf("\033[2J\033[1;1H");
}
void shell_interactive()
......
//---------------------------------------------------------------------------
// Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES
// OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
// Except as contained in this notice, the name of Dallas Semiconductor
// shall not be used except as stated in the Dallas Semiconductor
// Branding Policy.
//--------------------------------------------------------------------------
//
// crcutil.c - Keeps track of the CRC for 16 and 8 bit operations
// version 2.00
// Include files
#include "ownet.h"
// Local global variables
ushort utilcrc16[MAX_PORTNUM];
uchar utilcrc8[MAX_PORTNUM];
static short oddparity[16] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 };
static uchar dscrc_table[] = {
0, 94,188,226, 97, 63,221,131,194,156,126, 32,163,253, 31, 65,
157,195, 33,127,252,162, 64, 30, 95, 1,227,189, 62, 96,130,220,
35,125,159,193, 66, 28,254,160,225,191, 93, 3,128,222, 60, 98,
190,224, 2, 92,223,129, 99, 61,124, 34,192,158, 29, 67,161,255,
70, 24,250,164, 39,121,155,197,132,218, 56,102,229,187, 89, 7,
219,133,103, 57,186,228, 6, 88, 25, 71,165,251,120, 38,196,154,
101, 59,217,135, 4, 90,184,230,167,249, 27, 69,198,152,122, 36,
248,166, 68, 26,153,199, 37,123, 58,100,134,216, 91, 5,231,185,
140,210, 48,110,237,179, 81, 15, 78, 16,242,172, 47,113,147,205,
17, 79,173,243,112, 46,204,146,211,141,111, 49,178,236, 14, 80,
175,241, 19, 77,206,144,114, 44,109, 51,209,143, 12, 82,176,238,
50,108,142,208, 83, 13,239,177,240,174, 76, 18,145,207, 45,115,
202,148,118, 40,171,245, 23, 73, 8, 86,180,234,105, 55,213,139,
87, 9,235,181, 54,104,138,212,149,203, 41,119,244,170, 72, 22,
233,183, 85, 11,136,214, 52,106, 43,117,151,201, 74, 20,246,168,
116, 42,200,150, 21, 75,169,247,182,232, 10, 84,215,137,107, 53};
//--------------------------------------------------------------------------
// Reset crc16 to the value passed in
//
// 'reset' - data to set crc16 to.
//
void setcrc16(int portnum, ushort reset)
{
utilcrc16[portnum&0x0FF] = reset;
return;
}
//--------------------------------------------------------------------------
// Reset crc8 to the value passed in
//
// 'portnum' - number 0 to MAX_PORTNUM-1. This number is provided to
// indicate the symbolic port number.
// 'reset' - data to set crc8 to
//
void setcrc8(int portnum, uchar reset)
{
utilcrc8[portnum&0x0FF] = reset;
return;
}
//--------------------------------------------------------------------------
// Calculate a new CRC16 from the input data short. Return the current
// CRC16 and also update the global variable CRC16.
//
// 'portnum' - number 0 to MAX_PORTNUM-1. This number is provided to
// indicate the symbolic port number.
// 'data' - data to perform a CRC16 on
//
// Returns: the current CRC16
//
ushort docrc16(int portnum, ushort cdata)
{
cdata = (cdata ^ (utilcrc16[portnum&0x0FF] & 0xff)) & 0xff;
utilcrc16[portnum&0x0FF] >>= 8;
if (oddparity[cdata & 0xf] ^ oddparity[cdata >> 4])
utilcrc16[portnum&0x0FF] ^= 0xc001;
cdata <<= 6;
utilcrc16[portnum&0x0FF] ^= cdata;
cdata <<= 1;
utilcrc16[portnum&0x0FF] ^= cdata;
return utilcrc16[portnum&0x0FF];
}
//--------------------------------------------------------------------------
// Update the Dallas Semiconductor One Wire CRC (utilcrc8) from the global
// variable utilcrc8 and the argument.
//
// 'portnum' - number 0 to MAX_PORTNUM-1. This number is provided to
// indicate the symbolic port number.
// 'x' - data byte to calculate the 8 bit crc from
//
// Returns: the updated utilcrc8.
//
uchar docrc8(int portnum, uchar x)
{
utilcrc8[portnum&0x0FF] = dscrc_table[utilcrc8[portnum&0x0FF] ^ x];
return utilcrc8[portnum&0x0FF];
}
#include "ownet.h"
#define READ_SCRATCH_CMD 0xaa
#define WRITE_SCRATCH_CMD 0x0f
#define COPY_SCRATCH_CMD 0x55
#define READ_MEM_CMD 0xf0
#define E_READ_MEM_CMD 0xa5
int Write43(int portnum, uchar *SerialNum, int page, uchar *page_buffer)
{
uchar rt=FALSE;
ushort lastcrc16;
int i;
owSerialNum(portnum, SerialNum, FALSE);
if(owAccess(portnum))
{
mprintf(" Writing Scratchpad...\n");
if (!owWriteBytePower(portnum, WRITE_SCRATCH_CMD))
return FALSE;
setcrc16(portnum, 0);
docrc16(portnum,(ushort)WRITE_SCRATCH_CMD);
owLevel(portnum, MODE_NORMAL);
owWriteBytePower(portnum, 0x00); //write LSB of target addr
docrc16(portnum,(ushort)0x00);
owLevel(portnum, MODE_NORMAL);
owWriteBytePower(portnum, 0x00); //write MSB of target addr
docrc16(portnum,(ushort)0x00);
for(i = 0; i < 32; i++) //write 32 data bytes to scratchpad
{
owLevel(portnum,MODE_NORMAL);
owWriteBytePower(portnum, i);
lastcrc16 = docrc16(portnum,i);
// mprintf(" CRC16: %x\n", lastcrc16);
}
for(i = 0; i < 2; i++) //read two bytes CRC16
{
owLevel(portnum,MODE_NORMAL);
lastcrc16 = docrc16(portnum,(ushort)owReadBytePower(portnum));
}
mprintf(" CRC16: %x\n", lastcrc16);
if(lastcrc16 == 0xb001)
{
//copy to mem
owLevel(portnum, MODE_NORMAL);
if(Copy2Mem43(portnum, SerialNum))
rt=TRUE;
}
}
return rt;
}
int Copy2Mem43(int portnum, uchar *SerialNum)
{
uchar rt=FALSE;
ushort lastcrc16;
int i;
uchar read_data;
owSerialNum(portnum, SerialNum, FALSE);
if(owAccess(portnum))
{
if (!owWriteBytePower(portnum, COPY_SCRATCH_CMD))
return FALSE;
owLevel(portnum, MODE_NORMAL);
owWriteBytePower(portnum, 0x00); //write LSB of target addr
owLevel(portnum, MODE_NORMAL);
owWriteBytePower(portnum, 0x00); //write MSB of target addr
owLevel(portnum, MODE_NORMAL);
owWriteBytePower(portnum, 0x1f); //write E/S
msDelay(500);
owLevel(portnum,MODE_NORMAL);
read_data = owReadBytePower(portnum);
if (read_data == 0xaa)
rt=TRUE;
}
return rt;
}
// routine for reading the scratchpad of a DS28EC20P EEPROM
// 80 pages of 32byte
// 32byte scratchpad
// expects 32 byte deep buffer
int ReadScratch43(int portnum, uchar *SerialNum, uchar *page_buffer)
{
uchar rt=FALSE;
ushort lastcrc16;
int i;
ushort target_addr = 0;
uchar read_data;
owSerialNum(portnum, SerialNum, FALSE);
if(owAccess(portnum))
{
mprintf(" Reading Scratchpad...\n");
if (!owWriteBytePower(portnum, READ_SCRATCH_CMD))
return FALSE;
setcrc16(portnum, 0); //init crc
docrc16(portnum,(ushort)READ_SCRATCH_CMD);
owLevel(portnum,MODE_NORMAL); //read 2 byte address and 1 byte status
read_data = owReadBytePower(portnum);
lastcrc16 = docrc16(portnum, read_data);
target_addr = read_data;
owLevel(portnum,MODE_NORMAL);
read_data = owReadBytePower(portnum);
lastcrc16 = docrc16(portnum, read_data);
target_addr |= read_data << 8;
owLevel(portnum,MODE_NORMAL);
read_data = owReadBytePower(portnum);
lastcrc16 = docrc16(portnum, read_data);
mprintf("E/S: 0x%x\n", read_data);
for(i = 0; i < 32; i++)
{
owLevel(portnum,MODE_NORMAL);
page_buffer[i] = owReadBytePower(portnum);
lastcrc16 = docrc16(portnum, page_buffer[i]);
// mprintf("send_block[%d]: %x", i, send_block[i]);
// mprintf(" CRC16: %x", lastcrc16);
// mprintf(" CRC16i: %x\n", ~lastcrc16);
}
for(i = 0; i < 2; i++)
{
owLevel(portnum,MODE_NORMAL);
read_data = owReadBytePower(portnum);
lastcrc16 = docrc16(portnum, read_data);
}
if (lastcrc16 == 0xb001)
rt=TRUE;
}
return rt;
}
// routine for reading a memory page of a DS28EC20P EEPROM
// expects 32 byte deep buffer
int ReadMem43(int portnum, uchar *SerialNum, int page, uchar *page_buffer)
{
uchar rt=FALSE;
ushort lastcrc16;
int i;
ushort target_addr = 0;
uchar read_data;
owSerialNum(portnum, SerialNum, FALSE);
if(owAccess(portnum))
{
if (!owWriteBytePower(portnum, E_READ_MEM_CMD))
return FALSE;
setcrc16(portnum, 0); //init crc
docrc16(portnum,(ushort)E_READ_MEM_CMD);
owLevel(portnum, MODE_NORMAL);
owWriteBytePower(portnum, 0x00); //write LSB of target addr
docrc16(portnum,(ushort)0x00);
owLevel(portnum, MODE_NORMAL);
owWriteBytePower(portnum, 0x00); //write MSB of target addr
docrc16(portnum,(ushort)0x00);
for(i = 0; i < 32; i++)
{
owLevel(portnum,MODE_NORMAL);
page_buffer[i] = owReadBytePower(portnum);
lastcrc16 = docrc16(portnum, page_buffer[i]);
// mprintf("send_block[%d]: %x", i, send_block[i]);
// mprintf(" CRC16: %x", lastcrc16);
// mprintf(" CRC16i: %x\n", ~lastcrc16);
}
for(i = 0; i < 2; i++)
{
owLevel(portnum,MODE_NORMAL);
read_data = owReadBytePower(portnum);
lastcrc16 = docrc16(portnum, read_data);
}
if (lastcrc16 == 0xb001)
rt=TRUE;
}
return rt;
}
#ifndef EEP43_H
#define EEP43_H
/* returns TRUE for success */
int Write43(int portnum, uchar *SerialNum, int page, uchar *page_buffer);
int ReadMem43(int portnum, uchar *SerialNum, int page, uchar *page_buffer);
#endif
//---------------------------------------------------------------------------
// Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES
// OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
// Except as contained in this notice, the name of Dallas Semiconductor
// shall not be used except as stated in the Dallas Semiconductor
// Branding Policy.
//---------------------------------------------------------------------------
//
// findtype.c - Test module to find all devices of one type.
//
// Version: 2.00
//
//----------------------------------------------------------------------
//
//
#include "ownet.h"
#include "findtype.h"
//----------------------------------------------------------------------
// Search for devices
//
// 'portnum' - number 0 to MAX_PORTNUM-1. This number is provided to
// indicate the symbolic port number.
// 'FamilySN' - an array of all the serial numbers with the matching