initial commit of lk (little kernel) project
diff --git a/dev/dev.c b/dev/dev.c
new file mode 100644
index 0000000..5288b51
--- /dev/null
+++ b/dev/dev.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2008 Travis Geiselbrecht
+ *
+ * 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 THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+
+void dev_init(void)
+{
+
+}
+
diff --git a/dev/net/smc91c96/include/dev/net/smc91c96.h b/dev/net/smc91c96/include/dev/net/smc91c96.h
new file mode 100644
index 0000000..acd543e
--- /dev/null
+++ b/dev/net/smc91c96/include/dev/net/smc91c96.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2008 Travis Geiselbrecht
+ *
+ * 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 THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+#ifndef _DEV_NET_SMC91C96_H
+#define _DEV_NET_SMC91C96_H
+
+void smc91c96_init(void);
+
+#endif
+
diff --git a/dev/net/smc91c96/rules.mk b/dev/net/smc91c96/rules.mk
new file mode 100644
index 0000000..d675117
--- /dev/null
+++ b/dev/net/smc91c96/rules.mk
@@ -0,0 +1,8 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+INCLUDES += \
+	-I$(LOCAL_DIR)/include
+
+OBJS += \
+	$(LOCAL_DIR)/smc91c96.o
+
diff --git a/dev/net/smc91c96/smc91c96.c b/dev/net/smc91c96/smc91c96.c
new file mode 100644
index 0000000..0bab5d7
--- /dev/null
+++ b/dev/net/smc91c96/smc91c96.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2008 Travis Geiselbrecht
+ *
+ * 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 THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+#include <sys/types.h>
+#include <debug.h>
+#include <printf.h>
+#include <dev/net/smc91c96.h>
+#include "smc91c96_p.h"
+
+#if !defined(SMC91C96_BASE_ADDR) || !defined(SMC91C96_IRQ)
+#error need to define SMC91C96_BASE_ADDR and SMC91C96_IRQ in project
+#endif
+
+static addr_t smc91c96_base = SMC91C96_BASE_ADDR;
+static uint8_t mac_addr[6];
+
+#define SMC_REG16(reg) ((volatile uint16_t *)(smc91c96_base + (reg)))
+#define SMC_REG8(reg) ((volatile uint8_t *)(smc91c96_base + (reg)))
+
+static inline void smc_bank(int bank)
+{
+	*SMC_REG16(SMC_BSR) = bank;
+}
+
+void smc91c96_init(void)
+{
+	int i;
+
+	TRACE;
+
+	// try to detect it
+	if ((*SMC_REG16(SMC_BSR) & 0xff00) != 0x3300) {
+		TRACEF("didn't see smc91c96 chip at 0x%x\n", (unsigned int)smc91c96_base);
+	}
+
+	// read revision
+	smc_bank(3);
+	TRACEF("detected, revision 0x%x\n", *SMC_REG16(SMC_REV));
+
+	// read in the mac address
+	smc_bank(1);
+	for (i=0; i < 6; i++) {
+		mac_addr[i] = *SMC_REG8(SMC_IAR0 + i);
+	}
+	TRACEF("mac address %02x:%02x:%02x:%02x:%02x:%02x\n", 
+		mac_addr[0], mac_addr[1], mac_addr[2],
+		mac_addr[3], mac_addr[4], mac_addr[5]);
+
+	smc_bank(0);
+}
+
diff --git a/dev/net/smc91c96/smc91c96_p.h b/dev/net/smc91c96/smc91c96_p.h
new file mode 100644
index 0000000..0baf210
--- /dev/null
+++ b/dev/net/smc91c96/smc91c96_p.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2008 Travis Geiselbrecht
+ *
+ * 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 THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+#ifndef __SMC91C96_P_H
+#define __SMC91C96_P_H
+
+// LAN91C96 stuffs
+
+/* registers */
+
+#define SMC_BSR   14
+
+/* bank 0 */
+#define SMC_TCR	  0
+#define SMC_EPHSR 2
+#define SMC_RCR   4
+#define SMC_ECR   6
+#define SMC_MIR   8
+#define SMC_MCR   10
+
+/* bank 1 */
+#define SMC_CR    0
+#define SMC_BAR   2
+#define SMC_IAR0  4
+#define SMC_IAR1  5
+#define SMC_IAR2  6
+#define SMC_IAR3  7
+#define SMC_IAR4  8
+#define SMC_IAR5  9
+#define SMC_GPR   10
+#define SMC_CTR   12
+
+/* bank 2 */
+#define SMC_MMUCR 0
+#define SMC_AUTOTX 1
+#define SMC_PNR   2
+#define SMC_ARR   3
+#define SMC_FIFO  4
+#define SMC_PTR   6
+#define SMC_DATA0 8
+#define SMC_DATA1 10
+#define SMC_IST   12
+#define SMC_ACK   12
+#define SMC_MSK   13
+
+/* bank 3 */
+#define SMC_MT0   0
+#define SMC_MT1   1
+#define SMC_MT2   2
+#define SMC_MT3   3
+#define SMC_MT4   4
+#define SMC_MT5   5
+#define SMC_MT6   6
+#define SMC_MT7   7
+#define SMC_MGMT  8
+#define SMC_REV   10
+#define SMC_ERCV  12
+
+
+#endif
+
diff --git a/dev/rules.mk b/dev/rules.mk
new file mode 100644
index 0000000..f03105e
--- /dev/null
+++ b/dev/rules.mk
@@ -0,0 +1,5 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+KOBJS += \
+	$(LOCAL_DIR)/dev.o
+