PERFORCE change 131475 for review
Robert Watson
rwatson at FreeBSD.org
Sun Dec 23 07:56:33 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=131475
Change 131475 by rwatson at rwatson_cinnamon on 2007/12/23 15:55:54
Integrate zcopybpf.
Affected files ...
.. //depot/projects/zcopybpf/src/sys/boot/arm/at91/boot2/bwct_board.c#2 integrate
.. //depot/projects/zcopybpf/src/sys/boot/arm/at91/libat91/spi_flash.c#3 integrate
.. //depot/projects/zcopybpf/src/sys/net/bpf.c#27 integrate
.. //depot/projects/zcopybpf/src/sys/net/bpf.h#14 integrate
Differences ...
==== //depot/projects/zcopybpf/src/sys/boot/arm/at91/boot2/bwct_board.c#2 (text+ko) ====
@@ -1,81 +1,115 @@
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/boot/arm/at91/boot2/bwct_board.c,v 1.1 2007/07/13 14:27:04 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/arm/at91/boot2/bwct_board.c,v 1.2 2007/12/23 14:57:35 ticso Exp $");
#include <sys/param.h>
+#include "at91rm9200_lowlevel.h"
+#include "at91rm9200.h"
#include "emac.h"
#include "lib.h"
#include "ee.h"
#include "board.h"
#include "sd-card.h"
-unsigned char mac[6];
+unsigned char mac[6] = { 0x00, 0x0e, 0x42, 0x02, 0x00, 0x28 };
+
+static void USART0_Init();
+static void USART1_Init();
+static void USART2_Init();
+static void USART3_Init();
+static void DS1672_Init();
static void
-MacFromEE()
-{
-#if 0
- uint32_t sig;
+DS1672_Init() {
+ uint8_t buf[] = {0x00, 0xa9};
- sig = 0;
- EERead(0, (uint8_t *)&sig, sizeof(sig));
- if (sig != 0xaa55aa55)
- return;
- EERead(48, mac, 3);
- EERead(48+5, mac+3, 3);
-#else
- mac[0] = 0x00;
- mac[1] = 0x0e;
- mac[2] = 0x42;
- mac[3] = 0x02;
- mac[4] = 0x00;
- mac[5] = 0x21;
-#endif
- printf("MAC %x:%x:%x:%x:%x:%x\n", mac[0],
- mac[1], mac[2], mac[3], mac[4], mac[5]);
+ EEWrite(0xd0, buf, sizeof(buf));
}
-#ifdef XMODEM_DL
-#define FLASH_OFFSET (0 * FLASH_PAGE_SIZE)
-#define KERNEL_OFFSET (220 * FLASH_PAGE_SIZE)
-#define KERNEL_LEN (6 * 1024 * FLASH_PAGE_SIZE)
+static void
+USART0_Init() {
+
+ AT91PS_PIO pPio = (AT91PS_PIO)AT91C_BASE_PIOA;
+ AT91PS_PMC pPMC = (AT91PS_PMC)AT91C_BASE_PMC;
+
+ // setup GPIO
+ pPio->PIO_ASR = AT91C_PA17_TXD0 | AT91C_PA18_RXD0;
+ pPio->PIO_PDR = AT91C_PA17_TXD0 | AT91C_PA18_RXD0;
+
+ // enable power
+ pPMC->PMC_PCER = 1u << AT91C_ID_US0;
+}
static void
-UpdateFlash(int offset)
-{
- char *addr = (char *)0x20000000 + (1 << 20); /* Load to base + 1MB */
- int len, i, off;
+USART1_Init() {
+
+ AT91PS_PIO pPio = (AT91PS_PIO)AT91C_BASE_PIOA;
+ AT91PS_PMC pPMC = (AT91PS_PMC)AT91C_BASE_PMC;
+
+ // setup GPIO
+ pPio->PIO_ASR = AT91C_PB20_TXD1 | AT91C_PB21_RXD1;
+ pPio->PIO_PDR = AT91C_PB20_TXD1 | AT91C_PB21_RXD1;
- while ((len = xmodem_rx(addr)) == -1)
- continue;
- printf("\nDownloaded %u bytes.\n", len);
- for (i = 0; i < len; i+= FLASH_PAGE_SIZE) {
- off = i + offset;
- SPI_WriteFlash(off, addr + i, FLASH_PAGE_SIZE);
- }
+ // enable power
+ pPMC->PMC_PCER = 1u << AT91C_ID_US1;
}
-void
-Update(void)
-{
- UpdateFlash(FLASH_OFFSET);
+
+static void
+USART2_Init() {
+
+ AT91PS_PIO pPio = (AT91PS_PIO)AT91C_BASE_PIOA;
+ AT91PS_PMC pPMC = (AT91PS_PMC)AT91C_BASE_PMC;
+
+ // setup GPIO
+ pPio->PIO_ASR = AT91C_PA23_TXD2 | AT91C_PA22_RXD2;
+ pPio->PIO_PDR = AT91C_PA23_TXD2 | AT91C_PA22_RXD2;
+
+ // enable power
+ pPMC->PMC_PCER = 1u << AT91C_ID_US2;
}
-#else
-void
-Update(void)
-{
+static void
+USART3_Init() {
+
+ AT91PS_PIO pPio = (AT91PS_PIO)AT91C_BASE_PIOA;
+ AT91PS_PMC pPMC = (AT91PS_PMC)AT91C_BASE_PMC;
+
+ // setup GPIO
+ pPio->PIO_BSR = AT91C_PA5_TXD3 | AT91C_PA6_RXD3;
+ pPio->PIO_PDR = AT91C_PA5_TXD3 | AT91C_PA6_RXD3;
+
+ // enable power
+ pPMC->PMC_PCER = 1u << AT91C_ID_US3;
}
-#endif
void
board_init(void)
{
- EEInit();
- MacFromEE();
- EMAC_Init();
- sdcard_init();
- EMAC_SetMACAddress(mac);
+ printf("\n\n");
+ printf("BWCT FSB-A920-1\n");
+ printf("http://www.bwct.de\n");
+ printf("\n");
+ printf("AT92RM9200 180MHz\n");
+ printf("Initialising USART0\n");
+ USART0_Init();
+ printf("Initialising USART1\n");
+ USART1_Init();
+ printf("Initialising USART2\n");
+ USART2_Init();
+ printf("Initialising USART3\n");
+ USART3_Init();
+ printf("Initialising TWI\n");
+ EEInit();
+ printf("Initialising DS1672\n");
+ DS1672_Init();
+ printf("Initialising Ethernet\n");
+ printf("MAC %x:%x:%x:%x:%x:%x\n", mac[0],
+ mac[1], mac[2], mac[3], mac[4], mac[5]);
+ EMAC_Init();
+ EMAC_SetMACAddress(mac);
+ printf("Initialising SD-card\n");
+ sdcard_init();
}
#include "../bootspi/ee.c"
==== //depot/projects/zcopybpf/src/sys/boot/arm/at91/libat91/spi_flash.c#3 (text+ko) ====
@@ -19,7 +19,7 @@
* only.
* END_BLOCK
*
- * $FreeBSD: src/sys/boot/arm/at91/libat91/spi_flash.c,v 1.4 2007/03/28 22:38:01 imp Exp $
+ * $FreeBSD: src/sys/boot/arm/at91/libat91/spi_flash.c,v 1.5 2007/12/23 14:46:30 ticso Exp $
*****************************************************************************/
#include "at91rm9200.h"
@@ -256,11 +256,12 @@
value = pSPI->SPI_RDR;
value = pSPI->SPI_SR;
+ value = GetFlashStatus() & 0xFC;
#ifdef BOOT_BWCT
- if (((value = GetFlashStatus()) & 0xFC) != 0xB4)
+ if (value != 0xB4 && value != 0xAC)
printf(" Bad SPI status: 0x%x\n", value);
#else
- if (((value = GetFlashStatus()) & 0xFC) != 0xBC)
+ if (value != 0xBC)
printf(" Bad SPI status: 0x%x\n", value);
#endif
}
==== //depot/projects/zcopybpf/src/sys/net/bpf.c#27 (text+ko) ====
@@ -33,7 +33,7 @@
*
* @(#)bpf.c 8.4 (Berkeley) 1/9/95
*
- * $FreeBSD: src/sys/net/bpf.c,v 1.183 2007/10/24 19:03:57 rwatson Exp $
+ * $FreeBSD: src/sys/net/bpf.c,v 1.184 2007/12/23 14:10:33 rwatson Exp $
*/
#include "opt_bpf.h"
@@ -982,7 +982,7 @@
struct bpf_d *d = dev->si_drv1;
int error = 0;
- /*
+ /*
* Refresh PID associated with this descriptor.
*/
BPFD_LOCK(d);
@@ -997,7 +997,7 @@
case BIOCGBLEN:
case BIOCFLUSH:
case BIOCGDLT:
- case BIOCGDLTLIST:
+ case BIOCGDLTLIST:
case BIOCGETIF:
case BIOCGRTIMEOUT:
case BIOCGSTATS:
@@ -1548,7 +1548,7 @@
if (kn->kn_filter != EVFILT_READ)
return (1);
- /*
+ /*
* Refresh PID associated with this descriptor.
*/
BPFD_LOCK(d);
==== //depot/projects/zcopybpf/src/sys/net/bpf.h#14 (text+ko) ====
@@ -34,7 +34,7 @@
* @(#)bpf.h 8.1 (Berkeley) 6/10/93
* @(#)bpf.h 1.34 (LBL) 6/16/96
*
- * $FreeBSD: src/sys/net/bpf.h,v 1.48 2007/10/21 13:23:32 mlaier Exp $
+ * $FreeBSD: src/sys/net/bpf.h,v 1.49 2007/12/23 14:10:33 rwatson Exp $
*/
#ifndef _NET_BPF_H_
@@ -590,7 +590,7 @@
/*
* Juniper-private data link type, as per request from
- * Hannes Gredler <hannes at juniper.net>.
+ * Hannes Gredler <hannes at juniper.net>.
* The DLT_ are used for prepending meta-information
* like interface index, interface name
* before standard Ethernet, PPP, Frelay & C-HDLC Frames
@@ -607,7 +607,7 @@
/*
* Juniper-private data link type, as per request from
- * Hannes Gredler <hannes at juniper.net>.
+ * Hannes Gredler <hannes at juniper.net>.
* The DLT_ is used for internal communication with a
* voice Adapter Card (PIC)
*/
@@ -682,7 +682,7 @@
/*
* Juniper-private data link type, as per request from
- * Hannes Gredler <hannes at juniper.net>.
+ * Hannes Gredler <hannes at juniper.net>.
* The DLT_ is used for internal communication with a
* integrated service module (ISM).
*/
@@ -723,7 +723,7 @@
/*
* Juniper-private data link type, as per request from
- * Hannes Gredler <hannes at juniper.net>.
+ * Hannes Gredler <hannes at juniper.net>.
* The DLT_ is used for capturing data on a secure tunnel interface.
*/
#define DLT_JUNIPER_ST 200
More information about the p4-projects
mailing list