예제 #1
0
파일: ow_k1wm.c 프로젝트: M-o-a-T/owfs
static GOOD_OR_BAD K1WM_create_channels(struct connection_in *head, int channels_count)
{
	int i;

	static char *channel_names[] = {
		"K1WM(0)", "K1WM(1)", "K1WM(2)", "K1WM(3)", "K1WM(4)", "K1WM(5)", "K1WM(6)", "K1WM(7)",
		"K1WM(8)", "K1WM(9)", "K1WM(10)", "K1WM(11)", "K1WM(12)", "K1WM(13)", "K1WM(14)", "K1WM(15)",
		"K1WM(16)", "K1WM(17)", "K1WM(18)", "K1WM(19)", "K1WM(20)", "K1WM(21)", "K1WM(22)", "K1WM(23)",
		"K1WM(24)", "K1WM(25)", "K1WM(26)", "K1WM(27)", "K1WM(28)", "K1WM(29)", "K1WM(30)", "K1WM(31)",
		"K1WM(32)", "K1WM(33)", "K1WM(34)", "K1WM(35)", "K1WM(36)", "K1WM(37)", "K1WM(38)", "K1WM(39)",
		"K1WM(40)", "K1WM(41)", "K1WM(42)", "K1WM(43)", "K1WM(44)", "K1WM(45)", "K1WM(46)", "K1WM(47)",
		"K1WM(48)", "K1WM(49)", "K1WM(50)", "K1WM(51)", "K1WM(52)", "K1WM(53)", "K1WM(54)", "K1WM(55)",
		"K1WM(56)", "K1WM(57)", "K1WM(58)", "K1WM(59)", "K1WM(60)", "K1WM(61)", "K1WM(62)", "K1WM(63)"
	};
	head->master.ds1wm.active_channel = 0;
	head->adapter_name = channel_names[0] ;
	for (i = 1; i < channels_count; ++i) {
		struct connection_in * added = AddtoPort(head->pown);
		if (added == NO_CONNECTION) {
			return gbBAD;
		}
		added->master.ds1wm.active_channel = i;
		added->adapter_name = channel_names[i] ;
	}
	return gbGOOD;
}
예제 #2
0
/* create more channels,
   inserts in connection_in chain
   "in" points to  first (head) channel
   called only for DS12482-800
   NOTE: coded assuming num = 1 or 8 only
 */
static GOOD_OR_BAD CreateChannels(struct connection_in *head)
{
    int i;
    char *name[] = { "DS2482-800(0)", "DS2482-800(1)", "DS2482-800(2)",
                     "DS2482-800(3)", "DS2482-800(4)", "DS2482-800(5)", "DS2482-800(6)",
                     "DS2482-800(7)",
                   };
    head->master.i2c.index = 0;
    head->adapter_name = name[0];
    for (i = 1; i < 8; ++i) {
        struct connection_in * added = AddtoPort(head->pown);
        if (added == NO_CONNECTION) {
            return gbBAD;
        }
        added->master.i2c.index = i;
        added->adapter_name = name[i];
    }
    return gbGOOD;
}