OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 854 to Rev 855
    Reverse comparison

Rev 854 → Rev 855

/trunk/orpmon/reset.S
17,8 → 17,6
/* Used by global.src_addr for default value */
.extern _src_addr
.global _lolev_ie
.global _lolev_idis
.global _align
.global _calc_mycrc32
.global _mycrc32
381,8 → 379,8
l.sw 0x74(r1),r31
l.sw 0x78(r1),r3
 
l.movhi r3,hi(_eth_int)
l.ori r3,r3,lo(_eth_int)
l.movhi r3,hi(_int_main)
l.ori r3,r3,lo(_int_main)
l.jalr r3
l.nop
 
630,21 → 628,3
l.lwz r31,0x7c(r1)
l.addi r1,r1,128
l.rfe
 
.section .text
_lolev_ie:
l.mfspr r3,r0,SPR_SR
l.ori r3,r3,SPR_SR_IEE
l.mtspr r0,r3,SPR_SR
l.movhi r3,hi(ETH0_INT)
l.ori r3,r3,lo(ETH0_INT)
l.mtspr r0,r3,SPR_PICMR
 
l.jr r9
l.nop
 
_lolev_idis:
l.mtspr r0,r0,SPR_PICMR
 
l.jr r9
l.nop
/trunk/orpmon/include/int.h
0,0 → 1,14
 
/* Number of interrupt handlers */
#define MAX_INT_HANDLERS 32
 
/* Handler entry */
struct ihnd {
void (*handler)(void);
};
 
/* Add interrupt handler */
int int_add(unsigned long vect, void (* handler)(void));
 
/* Initialize routine */
int int_init(void);
trunk/orpmon/include/int.h Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: trunk/orpmon/include/eth.h =================================================================== --- trunk/orpmon/include/eth.h (revision 854) +++ trunk/orpmon/include/eth.h (revision 855) @@ -19,6 +19,8 @@ extern void eth_send (void *buf, unsigned long len); extern unsigned long eth_rx (void); extern void eth_halt(void); +extern void init_rx_bd_pool(void); +extern void init_tx_bd_pool(void); /* Tx BD */ #define ETH_TX_BD_READY 0x8000 /* Tx BD Ready */
/trunk/orpmon/include/keyboard.h
0,0 → 1,51
#if KBD_ENABLED
 
/*
* keyboard controller registers
*/
#define KBD_STATUS_REG (unsigned int) KBD_BASE_ADD+0x4
#define KBD_CNTL_REG (unsigned int) KBD_BASE_ADD+0x4
#define KBD_DATA_REG (unsigned int) KBD_BASE_ADD+0x0
/*
* controller commands
*/
#define KBD_READ_MODE (unsigned int) 0x20
#define KBD_WRITE_MODE (unsigned int) 0x60
#define KBD_SELF_TEST (unsigned int) 0xAA
#define KBD_SELF_TEST2 (unsigned int) 0xAB
#define KBD_CNTL_ENABLE (unsigned int) 0xAE
/*
* keyboard commands
*/
#define KBD_ENABLE (unsigned int) 0xF4
#define KBD_DISABLE (unsigned int) 0xF5
#define KBD_RESET (unsigned int) 0xFF
/*
* keyboard replies
*/
#define KBD_ACK (unsigned int) 0xFA
#define KBD_POR (unsigned int) 0xAA
/*
* status register bits
*/
#define KBD_OBF (unsigned int) 0x01
#define KBD_IBF (unsigned int) 0x02
#define KBD_GTO (unsigned int) 0x40
#define KBD_PERR (unsigned int) 0x80
/*
* keyboard controller mode register bits
*/
#define KBD_EKI (unsigned int) 0x01
#define KBD_SYS (unsigned int) 0x04
#define KBD_DMS (unsigned int) 0x20
#define KBD_KCC (unsigned int) 0x40
 
#define TIMEOUT_CONST 500000
 
extern int kbd_tail;
extern int kbd_head;
extern int kbd_buf[KBDBUF_SIZE];
 
extern int kbd_init(void);
 
#endif /* KBD_ENABLED */
trunk/orpmon/include/keyboard.h Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: trunk/orpmon/include/board.h =================================================================== --- trunk/orpmon/include/board.h (revision 854) +++ trunk/orpmon/include/board.h (revision 855) @@ -8,9 +8,9 @@ #endif #define IC_ENABLE 0 -#define IC_SIZE 8192 +#define IC_SIZE 8192 #define DC_ENABLE 0 -#define DC_SIZE 8192 +#define DC_SIZE 8192 #define MC_CSR_VAL 0x0B000300 #define MC_MASK_VAL 0x000000e0 @@ -21,8 +21,6 @@ #define SDRAM_BASE_ADDR 0x00000000 #define SDRAM_TMS_VAL 0x07248230 - - #ifdef XESS #define IN_CLK 10000000 #else @@ -29,9 +27,9 @@ #define IN_CLK 25000000 #endif -#define TICKS_PER_SEC 100 +#define TICKS_PER_SEC 100 -#define STACK_SIZE 0x10000 +#define STACK_SIZE 0x10000 #ifdef XESS #define UART_BAUD_RATE 19200 @@ -40,19 +38,19 @@ #endif #define UART_BASE 0x90000000 +#define UART_IRQ 19 #ifdef XESS -#define ETH_BASE 0x92000000 +#define ETH_BASE 0x92000000 #else #define ETH_BASE 0xD0000000 #endif -#define MC_BASE_ADDR 0x60000000 - -#define ETH0_INT _int_main /* was: 0x00080000 */ /* Not correct */ +#define ETH_IRQ 15 +#define MC_BASE_ADDR 0x60000000 #ifdef XESS - #define ETH_DATA_BASE 0x00100000 /* Address for ETH_DATA */ + #define ETH_DATA_BASE 0x00100000 /* Address for ETH_DATA */ #else - #define ETH_DATA_BASE 0xa8000000 /* Address for ETH_DATA */ + #define ETH_DATA_BASE 0xa8000000 /* Address for ETH_DATA */ #endif #define BOARD_DEF_IP 0x0a010185 @@ -59,21 +57,32 @@ #define BOARD_DEF_MASK 0xff000000 #define BOARD_DEF_GW 0x0a010101 -#define ETH_MACADDR0 0x00 -#define ETH_MACADDR1 0x12 -#define ETH_MACADDR2 0x34 -#define ETH_MACADDR3 0x56 -#define ETH_MACADDR4 0x78 -#define ETH_MACADDR5 0x9a +#define ETH_MACADDR0 0x00 +#define ETH_MACADDR1 0x12 +#define ETH_MACADDR2 0x34 +#define ETH_MACADDR3 0x56 +#define ETH_MACADDR4 0x78 +#define ETH_MACADDR5 0x9a -#define CRT_ENABLED 1 -#define CRT_BASE_ADDR 0xc0000000 -#define FB_BASE_ADDR 0xa8000000 +#define CRT_ENABLED 1 +#define CRT_BASE_ADDR 0xc0000000 +#define FB_BASE_ADDR 0xa8000000 /* Whether online help is available -- saves space */ -#define HELP_ENABLED 1 +#define HELP_ENABLED 1 /* Whether self check is enabled */ -#define SELF_CHECK 1 +#define SELF_CHECK 1 +/* Whether we have keyboard suppport */ +#define KBD_ENABLED 1 + +/* Keyboard base address */ +#define KBD_BASE_ADD 0x98000000 + +#define KBD_IRQ 12 + +/* Keyboard buffer size */ +#define KBDBUF_SIZE 256 + #endif
/trunk/orpmon/cmds/eth.c
1,37 → 1,38
#include "common.h"
#include "uart.h"
#include "eth.h"
#include "support.h"
#include "spr_defs.h"
 
#if 0
extern int tx_pointer_index;
unsigned long dest_mac_addr[6];
 
#if 0
void show_tx_bd(int start, int max)
{
int cnt, i;
int i;
for(i = start; i <= max; i++) {
/* Read Tx BD */
printf ("LEN:%04", REG32(ETH_BD_BASE + (i << 3)) >> 16);
printf (" RD:%04", (REG32(ETH_BD_BASE + (i << 3)) >> 15) & 0x1);
printf (" IRQ:%04", (REG32(ETH_BD_BASE + (i << 3)) >> 14) & 0x1);
printf (" WR:%04", (REG32(ETH_BD_BASE + (i << 3)) >> 13) & 0x1);
printf (" PAD:%04", (REG32(ETH_BD_BASE + (i << 3)) >> 12) & 0x1);
printf (" CRC:%04", (REG32(ETH_BD_BASE + (i << 3)) >> 11) & 0x1);
printf (" UR:%04", (REG32(ETH_BD_BASE + (i << 3)) >> 8) & 0x1);
printf (" RTRY:%04", (REG32(ETH_BD_BASE + (i << 3)) >> 4) & 0xf);
printf (" RL:%04", (REG32(ETH_BD_BASE + (i << 3)) >> 3) & 0x1);
printf (" LC:%04", (REG32(ETH_BD_BASE + (i << 3)) >> 2) & 0x1);
printf (" DF:%04", (REG32(ETH_BD_BASE + (i << 3)) >> 1) & 0x1);
printf (" CS:%04", (REG32(ETH_BD_BASE + (i << 3)) >> 0) & 0x1);
printf ("\nTx Buffer Pointer: %08x\n", REG32(ETH_BD_BASE + (i << 3) + 4));
printf ("LEN:%04lx", REG32(ETH_BD_BASE + (i << 3)) >> 16);
printf (" RD:%04lx", (REG32(ETH_BD_BASE + (i << 3)) >> 15) & 0x1);
printf (" IRQ:%04lx", (REG32(ETH_BD_BASE + (i << 3)) >> 14) & 0x1);
printf (" WR:%04lx", (REG32(ETH_BD_BASE + (i << 3)) >> 13) & 0x1);
printf (" PAD:%04lx", (REG32(ETH_BD_BASE + (i << 3)) >> 12) & 0x1);
printf (" CRC:%04lx", (REG32(ETH_BD_BASE + (i << 3)) >> 11) & 0x1);
printf (" UR:%04lx", (REG32(ETH_BD_BASE + (i << 3)) >> 8) & 0x1);
printf (" RTRY:%04lx", (REG32(ETH_BD_BASE + (i << 3)) >> 4) & 0xf);
printf (" RL:%04lx", (REG32(ETH_BD_BASE + (i << 3)) >> 3) & 0x1);
printf (" LC:%04lx", (REG32(ETH_BD_BASE + (i << 3)) >> 2) & 0x1);
printf (" DF:%04lx", (REG32(ETH_BD_BASE + (i << 3)) >> 1) & 0x1);
printf (" CS:%04lx", (REG32(ETH_BD_BASE + (i << 3)) >> 0) & 0x1);
printf ("\nTx Buffer Pointer: %08lx\n", REG32(ETH_BD_BASE + (i << 3) + 4));
}
}
 
void show_rx_bd (int start, int max)
{
int cnt, i;
int i;
unsigned long rx_bd_base, rx_bd_num;
 
rx_bd_num = REG32(ETH_REG_BASE + ETH_RXBD_NUM);
39,19 → 40,19
 
for(i = start; i <= max; i++){
/* Read Rx BD */
printf ("LEN:%04", REG32(rx_bd_base + (i << 3)) >> 16);
printf (" E:%04", (REG32(rx_bd_base + (i << 3)) >> 15) & 0x1);
printf (" IRQ:%04", (REG32(rx_bd_base + (i << 3)) >> 14) & 0x1);
printf (" WR:%04", (REG32(rx_bd_base + (i << 3)) >> 13) & 0x1);
printf (" M:%04", (REG32(rx_bd_base + (i << 3)) >> 7) & 0x1);
printf (" OR:%04", (REG32(rx_bd_base + (i << 3)) >> 6) & 0x1);
printf (" IS:%04", (REG32(rx_bd_base + (i << 3)) >> 5) & 0x1);
printf (" DN:%04", (REG32(rx_bd_base + (i << 3)) >> 4) & 0x1);
printf (" TL:%04", (REG32(rx_bd_base + (i << 3)) >> 3) & 0x1);
printf (" SF:%04", (REG32(rx_bd_base + (i << 3)) >> 2) & 0x1);
printf (" CRC:%04", (REG32(rx_bd_base + (i << 3)) >> 1) & 0x1);
printf (" LC:%04", (REG32(rx_bd_base + (i << 3)) >> 0) & 0x1);
printf ("\nRx Buffer Pointer: %08x\n", REG32(rx_bd_base + (i << 3) + 4));
printf ("LEN:%04lx", REG32(rx_bd_base + (i << 3)) >> 16);
printf (" E:%04lx", (REG32(rx_bd_base + (i << 3)) >> 15) & 0x1);
printf (" IRQ:%04lx", (REG32(rx_bd_base + (i << 3)) >> 14) & 0x1);
printf (" WR:%04lx", (REG32(rx_bd_base + (i << 3)) >> 13) & 0x1);
printf (" M:%04lx", (REG32(rx_bd_base + (i << 3)) >> 7) & 0x1);
printf (" OR:%04lx", (REG32(rx_bd_base + (i << 3)) >> 6) & 0x1);
printf (" IS:%04lx", (REG32(rx_bd_base + (i << 3)) >> 5) & 0x1);
printf (" DN:%04lx", (REG32(rx_bd_base + (i << 3)) >> 4) & 0x1);
printf (" TL:%04lx", (REG32(rx_bd_base + (i << 3)) >> 3) & 0x1);
printf (" SF:%04lx", (REG32(rx_bd_base + (i << 3)) >> 2) & 0x1);
printf (" CRC:%04lx", (REG32(rx_bd_base + (i << 3)) >> 1) & 0x1);
printf (" LC:%04lx", (REG32(rx_bd_base + (i << 3)) >> 0) & 0x1);
printf ("\nRx Buffer Pointer: %08lx\n", REG32(rx_bd_base + (i << 3) + 4));
}
}
 
73,7 → 74,7
{
if (!(REG32(rx_bd_base + (i << 3)) & ETH_RX_BD_EMPTY) || show_all)
{
printf ("Rx BD No. %04x located at %08x\n", i, rx_bd_base + (i << 3));
printf ("Rx BD No. %04x located at %08lx\n", i, rx_bd_base + (i << 3));
show_rx_bd(i, i);
show_buffer(REG32(rx_bd_base + (i << 3) + 4), REG32(rx_bd_base + (i << 3)) >> 16);
printf ("\n");
85,7 → 86,6
 
void show_tx_buffs(int max)
{
 
int i;
 
for(i=0; i<=max; i++)
109,7 → 109,7
 
if (start_addr == stop_addr)
{
printf ("\nSet MII RGAD ADDRESS to %08x", start_addr);
printf ("\nSet MII RGAD ADDRESS to %08lx", start_addr);
printf ("\nMII Command = Read Status\n");
}
 
118,15 → 118,15
REG32(ETH_REG_BASE + ETH_MIIADDRESS) = addr<<8;
REG32(ETH_REG_BASE + ETH_MIICOMMAND) = ETH_MIICOMMAND_RSTAT;
 
printf ("PHY %04x", REG32(ETH_REG_BASE + ETH_MIIADDRESS) & 0x1f);
printf (", addr %04x", REG32(ETH_REG_BASE + ETH_MIIADDRESS) >> 8);
printf (": %08x\n", REG32(ETH_REG_BASE + ETH_MIIRX_DATA));
printf ("PHY %04lx", REG32(ETH_REG_BASE + ETH_MIIADDRESS) & 0x1f);
printf (", addr %04lx", REG32(ETH_REG_BASE + ETH_MIIADDRESS) >> 8);
printf (": %08lx\n", REG32(ETH_REG_BASE + ETH_MIIRX_DATA));
}
}
 
void set_phy_reg (unsigned long addr, unsigned long val)
{
printf ("\nSet MII RGAD ADDRESS to %08x", addr);
printf ("\nSet MII RGAD ADDRESS to %08lx", addr);
 
REG32(ETH_REG_BASE + ETH_MIIADDRESS) = addr<<8;
 
180,11 → 180,11
 
int show_txbd_cmd (int argc, char *argv[])
{
int cnt, i;
int i;
int start, max;
if (argc == 1) show_tx_bd (strtoul (argv[0]), strtoul (argv[0]));
else if (argc == 2) show_tx_bd (strtoul (argv[0]), strtoul (argv[1]));
if (argc == 1) show_tx_bd (strtoul (argv[0], NULL, 0), strtoul (argv[0], NULL, 0));
else if (argc == 2) show_tx_bd (strtoul (argv[0], NULL, 0), strtoul (argv[1], NULL, 0));
else show_tx_bd (0, 63);
return 0;
}
191,8 → 191,8
 
int show_rxbd_cmd (int argc, char *argv[])
{
if (argc == 1) show_rx_bd (strtoul (argv[0]), strtoul (argv[0]));
else if (argc == 2) show_rx_bd (strtoul (argv[0]), strtoul (argv[1]));
if (argc == 1) show_rx_bd (strtoul (argv[0], NULL, 0), strtoul (argv[0], NULL, 0));
else if (argc == 2) show_rx_bd (strtoul (argv[0], NULL, 0), strtoul (argv[1], NULL, 0));
else show_rx_bd (0, 63);
return 0;
}
199,9 → 199,9
 
int send_packet_cmd (int argc, char *argv[])
{
if (argc == 1) send_packet(strtoul (argv[0]), 31, 1);
else if (argc == 2) send_packet(strtoul (argv[0]), strtoul (argv[1]), 1);
else if (argc == 3) send_packet(strtoul (argv[0]), strtoul (argv[1]), strtoul (argv[2]));
if (argc == 1) send_packet(strtoul (argv[0], NULL, 0), 31, 1);
else if (argc == 2) send_packet(strtoul (argv[0], NULL, 0), strtoul (argv[1], NULL, 0), 1);
else if (argc == 3) send_packet(strtoul (argv[0], NULL, 0), strtoul (argv[1], NULL, 0), strtoul (argv[2], NULL, 0));
else return -1;
return 0;
}
209,12 → 209,12
int set_dest_addr_cmd (int argc, char *argv[])
{
if (argc == 3) {
dest_mac_addr[0] = (strtoul (argv[0]) >> 8) & 0xff;
dest_mac_addr[1] = (strtoul (argv[0]) >> 0) & 0xff;
dest_mac_addr[2] = (strtoul (argv[1]) >> 8) & 0xff;
dest_mac_addr[3] = (strtoul (argv[1]) >> 0) & 0xff;
dest_mac_addr[4] = (strtoul (argv[2]) >> 8) & 0xff;
dest_mac_addr[5] = (strtoul (argv[2]) >> 0) & 0xff;
dest_mac_addr[0] = (strtoul (argv[0], NULL, 0) >> 8) & 0xff;
dest_mac_addr[1] = (strtoul (argv[0], NULL, 0) >> 0) & 0xff;
dest_mac_addr[2] = (strtoul (argv[1], NULL, 0) >> 8) & 0xff;
dest_mac_addr[3] = (strtoul (argv[1], NULL, 0) >> 0) & 0xff;
dest_mac_addr[4] = (strtoul (argv[2], NULL, 0) >> 8) & 0xff;
dest_mac_addr[5] = (strtoul (argv[2], NULL, 0) >> 0) & 0xff;
} else return -1;
return 0;
}
221,14 → 221,16
 
int init_txbd_pool_cmd (int argc, char *argv[])
{
if (argc == 1) init_tx_bd_pool(strtoul (argv[0]));
#if 0
if (argc == 1) init_tx_bd_pool(strtoul (argv[0], NULL, 0));
else return -1;
#endif
return 0;
}
 
int init_rxbd_pool_cmd (int argc, char *argv[])
{
if (argc == 1) init_rx_bd_pool(strtoul (argv[0]));
if (argc == 1) init_rx_bd_pool(strtoul (argv[0], NULL, 0));
else return -1;
return 0;
}
235,8 → 237,8
 
int show_phy_reg_cmd (int argc, char *argv[])
{
if (argc == 1) show_phy_reg(strtoul (argv[0]), strtoul (argv[0]));
else if (argc == 2) show_phy_reg(strtoul (argv[0]), strtoul (argv[1]));
if (argc == 1) show_phy_reg(strtoul (argv[0], NULL, 0), strtoul (argv[0], NULL, 0));
else if (argc == 2) show_phy_reg(strtoul (argv[0], NULL, 0), strtoul (argv[1], NULL, 0));
else show_phy_reg(0, 30);
return 0;
}
243,7 → 245,7
 
int set_phy_reg_cmd (int argc, char *argv[])
{
if (argc == 2) set_phy_reg(strtoul (argv[0]), strtoul (argv[1]));
if (argc == 2) set_phy_reg(strtoul (argv[0], NULL, 0), strtoul (argv[1], NULL, 0));
else return -1;
return 0;
}
252,64 → 254,64
{
if (argc) return -1;
printf ("\n %08x", ETH_REG_BASE + ETH_MODER);
printf (" MODER: %08x",REG32(ETH_REG_BASE + ETH_MODER));
printf (" MODER: %08lx",REG32(ETH_REG_BASE + ETH_MODER));
 
printf ("\n %08x", ETH_REG_BASE + ETH_INT);
printf (" INT: %08x", REG32(ETH_REG_BASE + ETH_INT));
printf (" INT: %08lx", REG32(ETH_REG_BASE + ETH_INT));
 
printf ("\n %08x", ETH_REG_BASE + ETH_INT_MASK);
printf (" INT_MASK: %08x", REG32(ETH_REG_BASE + ETH_INT_MASK));
printf (" INT_MASK: %08lx", REG32(ETH_REG_BASE + ETH_INT_MASK));
 
printf ("\n %08x", ETH_REG_BASE + ETH_IPGT);
printf (" IPGT: %08x", REG32(ETH_REG_BASE + ETH_IPGT));
printf (" IPGT: %08lx", REG32(ETH_REG_BASE + ETH_IPGT));
 
printf ("\n %08x", ETH_REG_BASE + ETH_IPGR1);
printf (" IPGR1: %08x", REG32(ETH_REG_BASE + ETH_IPGR1));
printf (" IPGR1: %08lx", REG32(ETH_REG_BASE + ETH_IPGR1));
 
printf ("\n %08x", ETH_REG_BASE + ETH_IPGR2);
printf (" IPGR2: %08x", REG32(ETH_REG_BASE + ETH_IPGR2));
printf (" IPGR2: %08lx", REG32(ETH_REG_BASE + ETH_IPGR2));
 
printf ("\n %08x", ETH_REG_BASE + ETH_PACKETLEN);
printf (" PACKETLEN: %08x", REG32(ETH_REG_BASE + ETH_PACKETLEN));
printf (" PACKETLEN: %08lx", REG32(ETH_REG_BASE + ETH_PACKETLEN));
 
printf ("\n %08x", ETH_REG_BASE + ETH_COLLCONF);
printf (" COLLCONF: %08x", REG32(ETH_REG_BASE + ETH_COLLCONF));
printf (" COLLCONF: %08lx", REG32(ETH_REG_BASE + ETH_COLLCONF));
 
printf ("\n %08x", ETH_REG_BASE + ETH_RXBD_NUM);
printf (" RX_BD_NUM: %08x", REG32(ETH_REG_BASE + ETH_RXBD_NUM));
printf (" RX_BD_NUM: %08lx", REG32(ETH_REG_BASE + ETH_RXBD_NUM));
 
printf ("\n %08x", ETH_REG_BASE + ETH_CTRLMODER);
printf (" CTRLMODER: %08x", REG32(ETH_REG_BASE + ETH_CTRLMODER));
printf (" CTRLMODER: %08lx", REG32(ETH_REG_BASE + ETH_CTRLMODER));
 
printf ("\n %08x", ETH_REG_BASE + ETH_MIIMODER);
printf (" MIIMODER: %08x", REG32(ETH_REG_BASE + ETH_MIIMODER));
printf (" MIIMODER: %08lx", REG32(ETH_REG_BASE + ETH_MIIMODER));
 
printf ("\n %08x", ETH_REG_BASE + ETH_MIICOMMAND);
printf (" MIICOMMAND: %08x", REG32(ETH_REG_BASE + ETH_MIICOMMAND));
printf (" MIICOMMAND: %08lx", REG32(ETH_REG_BASE + ETH_MIICOMMAND));
 
printf ("\n %08x", ETH_REG_BASE + ETH_MIIADDRESS);
printf (" MIIADDRESS: %08x", REG32(ETH_REG_BASE + ETH_MIIADDRESS));
printf (" MIIADDRESS: %08lx", REG32(ETH_REG_BASE + ETH_MIIADDRESS));
 
printf ("\n %08x", ETH_REG_BASE + ETH_MIITX_DATA);
printf (" MIITX_DATA: %08x", REG32(ETH_REG_BASE + ETH_MIITX_DATA));
printf (" MIITX_DATA: %08lx", REG32(ETH_REG_BASE + ETH_MIITX_DATA));
 
printf ("\n %08x", ETH_REG_BASE + ETH_MIIRX_DATA);
printf (" MIIRX_DATA: %08x", REG32(ETH_REG_BASE + ETH_MIIRX_DATA));
printf (" MIIRX_DATA: %08lx", REG32(ETH_REG_BASE + ETH_MIIRX_DATA));
 
printf ("\n %08x", ETH_REG_BASE + ETH_MIISTATUS);
printf (" MIISTATUS: %08x", REG32(ETH_REG_BASE + ETH_MIISTATUS));
printf (" MIISTATUS: %08lx", REG32(ETH_REG_BASE + ETH_MIISTATUS));
 
printf ("\n %08x", ETH_REG_BASE + ETH_MAC_ADDR0);
printf (" MAC_ADDR0: %08x", REG32(ETH_REG_BASE + ETH_MAC_ADDR0));
printf (" MAC_ADDR0: %08lx", REG32(ETH_REG_BASE + ETH_MAC_ADDR0));
 
printf ("\n %08x", ETH_REG_BASE + ETH_MAC_ADDR1);
printf (" MAC_ADDR1: %08x", REG32(ETH_REG_BASE + ETH_MAC_ADDR1));
printf (" MAC_ADDR1: %08lx", REG32(ETH_REG_BASE + ETH_MAC_ADDR1));
 
printf ("\n %08x", ETH_REG_BASE + ETH_HASH_ADDR0);
printf (" ETH_HASH_ADDR0: %08x", REG32(ETH_REG_BASE + ETH_HASH_ADDR0));
printf (" ETH_HASH_ADDR0: %08lx", REG32(ETH_REG_BASE + ETH_HASH_ADDR0));
 
printf ("\n %08x", ETH_REG_BASE + ETH_HASH_ADDR1);
printf (" ETH_HASH_ADDR1: %08x", REG32(ETH_REG_BASE + ETH_HASH_ADDR1));
printf (" ETH_HASH_ADDR1: %08lx", REG32(ETH_REG_BASE + ETH_HASH_ADDR1));
 
printf ("\n");
return 0;
335,8 → 337,8
else return -1;
return 0;
}
#endif
 
#endif
void module_eth_init (void)
{
#if 0
354,9 → 356,10
register_command ("show_rx_buffs", "[<show_all>]", "show receive buffers (optional arg will also show empty buffers)", show_rx_buffs_cmd);
register_command ("show_tx_buffs", "", "show transmit buffers", show_rx_buffs_cmd);
/* Initialize controller */
/* eth_init();*/
/* printf ("Ethernet not initialized (run eth_init command)\n");*/
/* init_rx_bd_pool(0); */
/* init_tx_bd_pool(3);*/
eth_init();
printf ("Ethernet not initialized (run eth_init command)\n");
init_rx_bd_pool(0);
init_tx_bd_pool(3);
#endif
}
 
/trunk/orpmon/cmds/camera.c
32,7 → 32,7
int camera_move_speed = 1;
int current_buf;
 
void int_main (void)
void camera_int (void)
{
/* Change base addresse of camera */
set_mem32 (CAMERA_BASE, CAMERA_BUF(current_buf)); /* Set address to store to */
/trunk/orpmon/common/common.c
2,6 → 2,7
#include "uart.h"
#include "screen.h"
#include "support.h"
#include "keyboard.h"
 
#define MAX_COMMANDS 100
 
27,7 → 28,9
case CT_UART:
uart_putc (c);
break;
#ifdef CRT_ENABLED
case CT_CRT:
#endif
screen_putc (c);
break;
case CT_SIM:
38,12 → 41,16
 
int getc ()
{
int ch = 0;
debug ("getc %i\n", bd.bi_console_type);
switch (bd.bi_console_type) {
case CT_NONE:
#if KBD_ENABLED
case CT_CRT:
case CT_SIM:
return -1;
while ((volatile int)kbd_head == (volatile int)kbd_tail);
ch = kbd_buf[kbd_tail];
kbd_tail = (kbd_tail + 1) % KBDBUF_SIZE;
return ch;
#endif
case CT_UART:
return uart_getc ();
}
54,10 → 61,11
{
debug ("testc %i\n", bd.bi_console_type);
switch (bd.bi_console_type) {
case CT_NONE:
#if KBD_ENABLED
case CT_CRT:
case CT_SIM:
return -1;
if (kbd_head == kbd_tail) return 0;
else return getc ();
#endif
case CT_UART:
return uart_testc ();
}
110,7 → 118,12
uart_init ();
break;
case CT_CRT:
#if CRT_ENABLED
screen_init ();
#endif
#if KBD_ENABLED
kbd_init ();
#endif
break;
case CT_SIM:
break;
/trunk/orpmon/doc/ORPmref.pdf Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
/trunk/orpmon/Makefile
18,11 → 18,11
 
#########################################################################
 
all: orpmon.or32 orpmon-flash.or32
 
docs: Makefile
$(MAKE) -C doc docs || exit 1
 
all: orpmon.or32 orpmon-flash.or32
 
reset.o: reset.S Makefile
$(CC) -c -o $@ $< $(CFLAGS) -DIN_FLASH=0
 
/trunk/orpmon/drivers/eth.c
3,6 → 3,7
#include "board.h"
#include "uart.h"
#include "eth.h"
#include "int.h"
#include "spr_defs.h"
 
extern int printf (const char *fmt, ...);
25,7 → 26,7
{
int i;
printf("ipacket: add = %x len = %d\n", add, len);
printf("ipacket: add = %lx len = %d\n", add, len);
for(i = 0; i < len; i++) {
if(!(i % 16))
printf("\n");
41,8 → 42,7
bd = (eth_bd *)ETH_BD_BASE;
 
for(i = 0; i < ETH_TXBD_NUM; i++){
 
for(i = 0; i < ETH_TXBD_NUM; i++) {
/* Set Tx BD status */
bd[i].len_status = 0 << 16 | ETH_TX_BD_PAD | ETH_TX_BD_CRC | ETH_RX_BD_IRQ;
 
72,9 → 72,13
bd[i-1].len_status |= ETH_RX_BD_WRAP; // Last Rx BD - Wrap
}
 
/* Ethernet interrupt handler */
void eth_int (void)
{
}
 
void eth_init (void (*rec)(volatile unsigned char *, int))
{
 
/* Reset ethernet core */
REG32(ETH_REG_BASE + ETH_MODER) = ETH_MODER_RST; /* Reset ON */
REG32(ETH_REG_BASE + ETH_MODER) &= ~ETH_MODER_RST; /* Reset OFF */
146,6 → 150,8
/* Enable receiver and transmiter */
REG32(ETH_REG_BASE + ETH_MODER) |= ETH_MODER_RXEN | ETH_MODER_TXEN;
 
/* Register interrupt handler */
int_add (ETH_IRQ, eth_int);
}
 
/* Returns pointer to next free buffer; NULL if none available */
259,7 → 265,3
/* Enable receiver and transmiter */
REG32(ETH_REG_BASE + ETH_MODER) &= ~(ETH_MODER_RXEN | ETH_MODER_TXEN);
}
 
void eth_int(void)
{
}
/trunk/orpmon/drivers/keyboard.c
0,0 → 1,177
#include "board.h"
#include "support.h"
#include "common.h"
#include "int.h"
#include "keyboard.h"
 
#if KBD_ENABLED
 
int kbd_tail = 0;
int kbd_head = 0;
int kbd_buf[KBDBUF_SIZE];
 
static const unsigned char scan2ascii[2][0x40] = {
{0x1f, 0x00, '1', '2', '3', '4', '5', '6', /* 0x00 */
'7', '8', '9', '0', '-', '=', '\b', '\t',
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', /* 0x10 */
'O', 'P', '[', ']', '\n', 0x00, 'A', 'S',
'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', /* 0x20 */
'\'', '`', 0xff, '\\', 'Z', 'X', 'C', 'V',
'B', 'N', 'M', ',', '.', '/', 0xff, 0x00, /* 0x30 */
0x00, ' ', 0x00, 0x00, 0x00, 0x00,0x00,0x00},
 
{0x00, 0x00, '!', '@', '#', '$', '%', '^', /* 0x00 */
'&', '*', '(', ')', '_', '+', 0x00,0x00,
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', /* 0x10 */
'o', 'p', '{', '}', '\n', 0x00, 'a', 's',
'd', 'f', 'g', 'h', 'j', 'k', 'l', ':', /* 0x20 */
'"', '~', 0xff, '|', 'z', 'x', 'c', 'v',
'b', 'n', 'm', '<', '>', '?', 0xff, 0x00,/* 0x30 */
0x00, ' ', 0x00, 0x00, 0x00, 0x00,0x00,0x00}};
 
static int shift_state = 0;
 
static void put_queue(int ch)
{
kbd_buf[kbd_head] = ch;
kbd_head = (kbd_head + 1) % KBDBUF_SIZE;
}
 
static void handle_scancode (unsigned char scan)
{
unsigned char c;
if (scan >= 0x40) return;
c = scan2ascii[shift_state][scan];
if (c == 0xff) shift_state = 1 - shift_state;
else put_queue (c);
}
 
static void keyboard_interrupt(void)
{
unsigned char status = REG8(KBD_BASE_ADD + 0x4);
do {
if (status & 0x01) handle_scancode(REG8(KBD_BASE_ADD + 0x0));
status = REG8(KBD_BASE_ADD + 0x4);
} while (status & 0x01);
}
 
static int kbd_wait_for_input(void)
{
int n;
int status, data;
 
n = TIMEOUT_CONST;
do {
status = REG8(KBD_STATUS_REG);
/*
* Wait for input data to become available. This bit will
* then be cleared by the following read of the DATA
* register.
*/
 
if (!(status & KBD_OBF)) continue;
 
data = REG8(KBD_DATA_REG);
 
/*
* Check to see if a timeout error has occurred. This means
* that transmission was started but did not complete in the
* normal time cycle. PERR is set when a parity error occurred
* in the last transmission.
*/
if (status & (KBD_GTO | KBD_PERR)) continue;
 
return (data & 0xff);
} while (--n);
return (-1); /* timed-out if fell through to here... */
}
 
static void kbd_write (int address, int data)
{
int status;
do {
status = REG8(KBD_STATUS_REG); /* spin until input buffer empty*/
} while (status & KBD_IBF);
REG8 (address) = data; /* write out the data*/
}
 
int kbd_init(void)
{
int_add (KBD_IRQ, keyboard_interrupt);
 
/* Flush any pending input. */
while (kbd_wait_for_input() != -1) continue;
 
/*
* Test the keyboard interface.
* This seems to be the only way to get it going.
* If the test is successful a x55 is placed in the input buffer.
*/
kbd_write(KBD_CNTL_REG, KBD_SELF_TEST);
if (kbd_wait_for_input() != 0x55) {
debug ("initialize_kbd: keyboard failed self test.\n");
return(-1);
}
 
/*
* Perform a keyboard interface test. This causes the controller
* to test the keyboard clock and data lines. The results of the
* test are placed in the input buffer.
*/
kbd_write(KBD_CNTL_REG, KBD_SELF_TEST2);
if (kbd_wait_for_input() != 0x00) {
debug ("initialize_kbd: keyboard failed self test 2.\n");
return(-1);
}
/* Enable the keyboard by allowing the keyboard clock to run. */
kbd_write(KBD_CNTL_REG, KBD_CNTL_ENABLE);
 
/*
* Reset keyboard. If the read times out
* then the assumption is that no keyboard is
* plugged into the machine.
* This defaults the keyboard to scan-code set 2.
*/
kbd_write(KBD_DATA_REG, KBD_RESET);
if (kbd_wait_for_input() != KBD_ACK) {
debug ("initialize_kbd: reset kbd failed, no ACK.\n");
return(-1);
}
 
if (kbd_wait_for_input() != KBD_POR) {
debug ("initialize_kbd: reset kbd failed, not POR.\n");
return(-1);
}
 
/*
* now do a DEFAULTS_DISABLE always
*/
kbd_write(KBD_DATA_REG, KBD_DISABLE);
if (kbd_wait_for_input() != KBD_ACK) {
debug ("initialize_kbd: disable kbd failed, no ACK.\n");
return(-1);
}
 
/*
* Enable keyboard interrupt, operate in "sys" mode,
* enable keyboard (by clearing the disable keyboard bit),
* disable mouse, do conversion of keycodes.
*/
kbd_write(KBD_CNTL_REG, KBD_WRITE_MODE);
kbd_write(KBD_DATA_REG, KBD_EKI|KBD_SYS|KBD_DMS|KBD_KCC);
 
/*
* now ENABLE the keyboard to set it scanning...
*/
kbd_write(KBD_DATA_REG, KBD_ENABLE);
if (kbd_wait_for_input() != KBD_ACK) {
debug ("initialize_kbd: keyboard enable failed.\n");
return(-1);
}
 
debug ("PS/2 keyboard initialized at 0x%x (irq = %d).\n", KBD_BASE_ADD, KBD_IRQ);
return (1);
}
 
#endif /* KBD_ENABLED */
trunk/orpmon/drivers/keyboard.c Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: trunk/orpmon/drivers/int.c =================================================================== --- trunk/orpmon/drivers/int.c (nonexistent) +++ trunk/orpmon/drivers/int.c (revision 855) @@ -0,0 +1,73 @@ +/* This file is part of test microkernel for OpenRISC 1000. */ +/* (C) 2001 Simon Srot, srot@opencores.org */ + +#include "support.h" +#include "spr_defs.h" +#include "int.h" + +#ifdef OR1K + +/* Interrupt handlers table */ +struct ihnd int_handlers[MAX_INT_HANDLERS]; + +/* Initialize routine */ +int int_init() +{ + int i; + + for(i = 0; i < MAX_INT_HANDLERS; i++) { + int_handlers[i].handler = 0; + } + + return 0; +} + +/* Add interrupt handler */ +int int_add(unsigned long vect, void (* handler)(void)) +{ + if(vect >= MAX_INT_HANDLERS) return -1; + + int_handlers[vect].handler = handler; + + mtspr(SPR_PICMR, mfspr(SPR_PICMR) | (0x00000001L << vect)); + return 0; +} + +/* Disable interrupt */ +int int_disable(unsigned long vect) +{ + if(vect >= MAX_INT_HANDLERS) return -1; + + mtspr(SPR_PICMR, mfspr(SPR_PICMR) & ~(0x00000001L << vect)); + + return 0; +} + +/* Enable interrupt */ +int int_enable(unsigned long vect) +{ + if(vect >= MAX_INT_HANDLERS) return -1; + + mtspr(SPR_PICMR, mfspr(SPR_PICMR) | (0x00000001L << vect)); + + return 0; +} + +/* Main interrupt handler */ +void int_main() +{ + unsigned long picsr = mfspr(SPR_PICSR); + unsigned long i = 0; + + mtspr(SPR_PICSR, 0); + + while(i < 32) { + if((picsr & (0x01L << i)) && (int_handlers[i].handler != 0)) { + (*int_handlers[i].handler)(); + mtspr(SPR_PICSR, mfspr(SPR_PICSR) & ~(0x00000001L << i)); + } + i++; + } +} + +#endif
trunk/orpmon/drivers/int.c Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: trunk/orpmon/drivers/Makefile =================================================================== --- trunk/orpmon/drivers/Makefile (revision 854) +++ trunk/orpmon/drivers/Makefile (revision 855) @@ -1,6 +1,6 @@ LIB = drivers.o -OBJS = eth.o uart.o tick.o flash.o +OBJS = int.o eth.o uart.o tick.o flash.o keyboard.o all: $(LIB)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.