diff options
Diffstat (limited to 'board/MAI')
-rw-r--r-- | board/MAI/AmigaOneG3SE/AmigaOneG3SE.c | 86 | ||||
-rw-r--r-- | board/MAI/AmigaOneG3SE/enet.c | 601 | ||||
-rw-r--r-- | board/MAI/AmigaOneG3SE/interrupts.c | 6 | ||||
-rw-r--r-- | board/MAI/AmigaOneG3SE/ps2kbd.c | 455 | ||||
-rw-r--r-- | board/MAI/AmigaOneG3SE/start.txt | 4 | ||||
-rw-r--r-- | board/MAI/AmigaOneG3SE/u-boot.lds | 8 | ||||
-rw-r--r-- | board/MAI/AmigaOneG3SE/usb_uhci.c | 2 | ||||
-rw-r--r-- | board/MAI/AmigaOneG3SE/via686.c | 8 | ||||
-rw-r--r-- | board/MAI/menu/menu.h | 92 |
9 files changed, 613 insertions, 649 deletions
diff --git a/board/MAI/AmigaOneG3SE/AmigaOneG3SE.c b/board/MAI/AmigaOneG3SE/AmigaOneG3SE.c index b472176..3bbc09d 100644 --- a/board/MAI/AmigaOneG3SE/AmigaOneG3SE.c +++ b/board/MAI/AmigaOneG3SE/AmigaOneG3SE.c @@ -14,7 +14,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -30,48 +30,48 @@ #include "memio.h" #include "via686.h" -__asm__(" .globl send_kb \n " - "send_kb: \n " - " lis r9, 0xfe00 \n " - " \n " - " li r4, 0x10 # retries \n " - " mtctr r4 \n " - " \n " - "idle: \n " - " lbz r4, 0x64(r9) \n " - " andi. r4, r4, 0x02 \n " - " bne idle \n " - - "ready: \n " - " stb r3, 0x60(r9) \n " - " \n " - "check: \n " - " lbz r4, 0x64(r9) \n " - " andi. r4, r4, 0x01 \n " - " beq check \n " - " \n " - " lbz r4, 0x60(r9) \n " - " cmpwi r4, 0xfa \n " - " beq done \n " - - " bdnz idle \n " - - " li r3, 0 \n " - " blr \n " - - "done: \n " - " li r3, 1 \n " - " blr \n " - - ".globl test_kb \n " - "test_kb: \n " - " mflr r10 \n " - " li r3, 0xed \n " - " bl send_kb \n " - " li r3, 0x01 \n " - " bl send_kb \n " - " mtlr r10 \n " - " blr " +__asm__(" .globl send_kb \n " + "send_kb: \n " + " lis r9, 0xfe00 \n " + " \n " + " li r4, 0x10 # retries \n " + " mtctr r4 \n " + " \n " + "idle: \n " + " lbz r4, 0x64(r9) \n " + " andi. r4, r4, 0x02 \n " + " bne idle \n " + + "ready: \n " + " stb r3, 0x60(r9) \n " + " \n " + "check: \n " + " lbz r4, 0x64(r9) \n " + " andi. r4, r4, 0x01 \n " + " beq check \n " + " \n " + " lbz r4, 0x60(r9) \n " + " cmpwi r4, 0xfa \n " + " beq done \n " + + " bdnz idle \n " + + " li r3, 0 \n " + " blr \n " + + "done: \n " + " li r3, 1 \n " + " blr \n " + + ".globl test_kb \n " + "test_kb: \n " + " mflr r10 \n " + " li r3, 0xed \n " + " bl send_kb \n " + " li r3, 0x01 \n " + " bl send_kb \n " + " mtlr r10 \n " + " blr \n " ); diff --git a/board/MAI/AmigaOneG3SE/enet.c b/board/MAI/AmigaOneG3SE/enet.c index ad2bcde..5a90cc5 100644 --- a/board/MAI/AmigaOneG3SE/enet.c +++ b/board/MAI/AmigaOneG3SE/enet.c @@ -90,8 +90,8 @@ #define DMADone (1<<8) #define DownComplete (1<<9) #define UpComplete (1<<10) -#define DMAInProgress (1<<11) /* DMA controller is still busy.*/ -#define CmdInProgress (1<<12) /* EL3_CMD is still busy.*/ +#define DMAInProgress (1<<11) /* DMA controller is still busy.*/ +#define CmdInProgress (1<<12) /* EL3_CMD is still busy.*/ /* Polling Registers */ @@ -100,17 +100,17 @@ /* Register window 0 offets */ -#define Wn0EepromCmd 10 /* Window 0: EEPROM command register. */ -#define Wn0EepromData 12 /* Window 0: EEPROM results register. */ -#define IntrStatus 0x0E /* Valid in all windows. */ +#define Wn0EepromCmd 10 /* Window 0: EEPROM command register. */ +#define Wn0EepromData 12 /* Window 0: EEPROM results register. */ +#define IntrStatus 0x0E /* Valid in all windows. */ /* Register window 0 EEPROM bits */ #define EEPROM_Read 0x80 #define EEPROM_WRITE 0x40 #define EEPROM_ERASE 0xC0 -#define EEPROM_EWENB 0x30 /* Enable erasing/writing for 10 msec. */ -#define EEPROM_EWDIS 0x00 /* Disable EWENB before 10 msec timeout. */ +#define EEPROM_EWENB 0x30 /* Enable erasing/writing for 10 msec. */ +#define EEPROM_EWDIS 0x00 /* Disable EWENB before 10 msec timeout. */ /* EEPROM locations. */ @@ -135,7 +135,7 @@ #define RxStatus 0x18 #define Timer 0x1A #define TxStatus 0x1B -#define TxFree 0x1C /* Remaining free bytes in Tx buffer. */ +#define TxFree 0x1C /* Remaining free bytes in Tx buffer. */ /* Register Window 2 */ @@ -143,23 +143,23 @@ /* Register Window 3: MAC/config bits */ -#define Wn3_Config 0 /* Internal Configuration */ +#define Wn3_Config 0 /* Internal Configuration */ #define Wn3_MAC_Ctrl 6 #define Wn3_Options 8 #define BFEXT(value, offset, bitcount) \ ((((unsigned long)(value)) >> (offset)) & ((1 << (bitcount)) - 1)) -#define BFINS(lhs, rhs, offset, bitcount) \ +#define BFINS(lhs, rhs, offset, bitcount) \ (((lhs) & ~((((1 << (bitcount)) - 1)) << (offset))) | \ (((rhs) & ((1 << (bitcount)) - 1)) << (offset))) -#define RAM_SIZE(v) BFEXT(v, 0, 3) +#define RAM_SIZE(v) BFEXT(v, 0, 3) #define RAM_WIDTH(v) BFEXT(v, 3, 1) -#define RAM_SPEED(v) BFEXT(v, 4, 2) -#define ROM_SIZE(v) BFEXT(v, 6, 2) +#define RAM_SPEED(v) BFEXT(v, 4, 2) +#define ROM_SIZE(v) BFEXT(v, 6, 2) #define RAM_SPLIT(v) BFEXT(v, 16, 2) -#define XCVR(v) BFEXT(v, 20, 4) +#define XCVR(v) BFEXT(v, 20, 4) #define AUTOSELECT(v) BFEXT(v, 24, 1) /* Register Window 4: Xcvr/media bits */ @@ -186,20 +186,20 @@ #define DownListPtr 0x24 #define FragAddr 0x28 #define FragLen 0x2c -#define TxFreeThreshold 0x2f +#define TxFreeThreshold 0x2f #define UpPktStatus 0x30 -#define UpListPtr 0x38 +#define UpListPtr 0x38 /* The Rx and Tx descriptor lists. */ -#define LAST_FRAG 0x80000000 /* Last Addr/Len pair in descriptor. */ -#define DN_COMPLETE 0x00010000 /* This packet has been downloaded */ +#define LAST_FRAG 0x80000000 /* Last Addr/Len pair in descriptor. */ +#define DN_COMPLETE 0x00010000 /* This packet has been downloaded */ struct rx_desc_3com { - u32 next; /* Last entry points to 0 */ - u32 status; /* FSH -> Frame Start Header */ - u32 addr; /* Up to 63 addr/len pairs possible */ - u32 length; /* Set LAST_FRAG to indicate last pair */ + u32 next; /* Last entry points to 0 */ + u32 status; /* FSH -> Frame Start Header */ + u32 addr; /* Up to 63 addr/len pairs possible */ + u32 length; /* Set LAST_FRAG to indicate last pair */ }; /* Values for the Rx status entry. */ @@ -214,8 +214,8 @@ struct rx_desc_3com { #define UDPChksumValid (1<<31) struct tx_desc_3com { - u32 next; /* Last entry points to 0 */ - u32 status; /* bits 0:12 length, others see below */ + u32 next; /* Last entry points to 0 */ + u32 status; /* bits 0:12 length, others see below */ u32 addr; u32 length; }; @@ -227,7 +227,7 @@ struct tx_desc_3com { #define AddIPChksum 0x02000000 #define AddTCPChksum 0x04000000 #define AddUDPChksum 0x08000000 -#define TxIntrUploaded 0x80000000 /* IRQ when in FIFO, but maybe not sent. */ +#define TxIntrUploaded 0x80000000 /* IRQ when in FIFO, but maybe not sent. */ /* XCVR Types */ @@ -240,19 +240,19 @@ struct tx_desc_3com { #define XCVR_MII 6 #define XCVR_NWAY 8 #define XCVR_ExtMII 9 -#define XCVR_Default 10 /* I don't think this is correct -> should have been 0x10 if Auto Negotiate */ +#define XCVR_Default 10 /* I don't think this is correct -> should have been 0x10 if Auto Negotiate */ -struct descriptor { /* A generic descriptor. */ - u32 next; /* Last entry points to 0 */ - u32 status; /* FSH -> Frame Start Header */ - u32 addr; /* Up to 63 addr/len pairs possible */ - u32 length; /* Set LAST_FRAG to indicate last pair */ +struct descriptor { /* A generic descriptor. */ + u32 next; /* Last entry points to 0 */ + u32 status; /* FSH -> Frame Start Header */ + u32 addr; /* Up to 63 addr/len pairs possible */ + u32 length; /* Set LAST_FRAG to indicate last pair */ }; /* Misc. definitions */ -#define NUM_RX_DESC PKTBUFSRX * 10 -#define NUM_TX_DESC 1 /* Number of TX descriptors */ +#define NUM_RX_DESC PKTBUFSRX * 10 +#define NUM_TX_DESC 1 /* Number of TX descriptors */ #define TOUT_LOOP 1000000 @@ -266,17 +266,17 @@ struct descriptor { /* A generic descriptor. */ #undef ETH_DEBUG #ifdef ETH_DEBUG -#define PRINTF(fmt,args...) printf (fmt ,##args) +#define PRINTF(fmt,args...) printf (fmt ,##args) #else #define PRINTF(fmt,args...) #endif -static struct rx_desc_3com *rx_ring; /* RX descriptor ring */ -static struct tx_desc_3com *tx_ring; /* TX descriptor ring */ -static u8 rx_buffer[NUM_RX_DESC][PKTSIZE_ALIGN]; /* storage for the incoming messages */ -static int rx_next = 0; /* RX descriptor ring pointer */ -static int tx_next = 0; /* TX descriptor ring pointer */ +static struct rx_desc_3com *rx_ring; /* RX descriptor ring */ +static struct tx_desc_3com *tx_ring; /* TX descriptor ring */ +static u8 rx_buffer[NUM_RX_DESC][PKTSIZE_ALIGN];/* storage for the incoming messages */ +static int rx_next = 0; /* RX descriptor ring pointer */ +static int tx_next = 0; /* TX descriptor ring pointer */ static int tx_threshold; static void init_rx_ring(struct eth_device* dev); @@ -369,171 +369,163 @@ static int issue_and_wait(struct eth_device* dev, int command) return 0; } -/* Determine network media type and set up 3com accordingly */ +/* Determine network media type and set up 3com accordingly */ /* I think I'm going to start with something known first like 10baseT */ -static int auto_negotiate(struct eth_device* dev) +static int auto_negotiate (struct eth_device *dev) { - int i; + int i; - EL3WINDOW(dev, 1); + EL3WINDOW (dev, 1); - /* Wait for Auto negotiation to complete */ - for (i = 0; i <= 1000; i++) - { - if (ETH_INW(dev, 2) & 0x04) - break; - udelay(100); + /* Wait for Auto negotiation to complete */ + for (i = 0; i <= 1000; i++) { + if (ETH_INW (dev, 2) & 0x04) + break; + udelay (100); - if (i == 1000) - { - PRINTF("Error: Auto negotiation failed\n"); - return 0; + if (i == 1000) { + PRINTF ("Error: Auto negotiation failed\n"); + return 0; + } } - } - return 1; + return 1; } -void eth_interrupt(struct eth_device *dev) +void eth_interrupt (struct eth_device *dev) { - u16 status = ETH_STATUS(dev); + u16 status = ETH_STATUS (dev); - printf("eth0: status = 0x%04x\n", status); + printf ("eth0: status = 0x%04x\n", status); - if (!(status & IntLatch)) - return; + if (!(status & IntLatch)) + return; + + if (status & (1 << 6)) { + ETH_CMD (dev, AckIntr | (1 << 6)); + printf ("Acknowledged Interrupt command\n"); + } + + if (status & DownComplete) { + ETH_CMD (dev, AckIntr | DownComplete); + printf ("Acknowledged DownComplete\n"); + } + + if (status & UpComplete) { + ETH_CMD (dev, AckIntr | UpComplete); + printf ("Acknowledged UpComplete\n"); + } - if (status & (1<<6)) - { - ETH_CMD(dev, AckIntr | (1<<6)); - printf("Acknowledged Interrupt command\n"); - } - - if (status & DownComplete) - { - ETH_CMD(dev, AckIntr | DownComplete); - printf("Acknowledged DownComplete\n"); - } - - if (status & UpComplete) - { - ETH_CMD(dev, AckIntr | UpComplete); - printf("Acknowledged UpComplete\n"); - } - - ETH_CMD(dev, AckIntr | IntLatch); - printf("Acknowledged IntLatch\n"); + ETH_CMD (dev, AckIntr | IntLatch); + printf ("Acknowledged IntLatch\n"); } -int eth_3com_initialize(bd_t *bis) +int eth_3com_initialize (bd_t * bis) { u32 eth_iobase = 0, status; int card_number = 0, ret; - struct eth_device* dev; + struct eth_device *dev; pci_dev_t devno; char *s; - s = getenv("3com_base"); + s = getenv ("3com_base"); /* Find ethernet controller on the PCI bus */ - if ((devno = pci_find_device(PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905C, 0)) < 0) - { - PRINTF("Error: Cannot find the ethernet device on the PCI bus\n"); + if ((devno = + pci_find_device (PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905C, + 0)) < 0) { + PRINTF ("Error: Cannot find the ethernet device on the PCI bus\n"); goto Done; } - if (s) - { - unsigned long base = atoi(s); - pci_write_config_dword(devno, PCI_BASE_ADDRESS_0, base | 0x01); + if (s) { + unsigned long base = atoi (s); + + pci_write_config_dword (devno, PCI_BASE_ADDRESS_0, + base | 0x01); } - ret = pci_read_config_dword(devno, PCI_BASE_ADDRESS_0, ð_iobase); + ret = pci_read_config_dword (devno, PCI_BASE_ADDRESS_0, ð_iobase); eth_iobase &= ~0xf; - PRINTF("eth: 3Com Found at Address: 0x%x\n", eth_iobase); + PRINTF ("eth: 3Com Found at Address: 0x%x\n", eth_iobase); - pci_write_config_dword(devno, PCI_COMMAND, PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); + pci_write_config_dword (devno, PCI_COMMAND, + PCI_COMMAND_IO | PCI_COMMAND_MEMORY | + PCI_COMMAND_MASTER); - /* Check if I/O accesses and Bus Mastering are enabled */ + /* Check if I/O accesses and Bus Mastering are enabled */ - ret = pci_read_config_dword(devno, PCI_COMMAND, &status); + ret = pci_read_config_dword (devno, PCI_COMMAND, &status); - if (!(status & PCI_COMMAND_IO)) - { - printf("Error: Cannot enable IO access.\n"); + if (!(status & PCI_COMMAND_IO)) { + printf ("Error: Cannot enable IO access.\n"); goto Done; } - if (!(status & PCI_COMMAND_MEMORY)) - { - printf("Error: Cannot enable MEMORY access.\n"); + if (!(status & PCI_COMMAND_MEMORY)) { + printf ("Error: Cannot enable MEMORY access.\n"); goto Done; } - if (!(status & PCI_COMMAND_MASTER)) - { - printf("Error: Cannot enable Bus Mastering.\n"); + if (!(status & PCI_COMMAND_MASTER)) { + printf ("Error: Cannot enable Bus Mastering.\n"); goto Done; } - dev = (struct eth_device*) malloc(sizeof(*dev)); /*struct eth_device)); */ + dev = (struct eth_device *) malloc (sizeof (*dev)); /*struct eth_device)); */ - sprintf(dev->name, "3Com 3c920c#%d", card_number); + sprintf (dev->name, "3Com 3c920c#%d", card_number); dev->iobase = eth_iobase; - dev->priv = (void*) devno; - dev->init = eth_3com_init; - dev->halt = eth_3com_halt; - dev->send = eth_3com_send; - dev->recv = eth_3com_recv; + dev->priv = (void *) devno; + dev->init = eth_3com_init; + dev->halt = eth_3com_halt; + dev->send = eth_3com_send; + dev->recv = eth_3com_recv; - eth_register(dev); + eth_register (dev); -/* { */ -/* char interrupt; */ -/* devno = pci_find_device(PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905C, 0); */ -/* pci_read_config_byte(devno, PCI_INTERRUPT_LINE, &interrupt); */ +/* { */ +/* char interrupt; */ +/* devno = pci_find_device(PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905C, 0); */ +/* pci_read_config_byte(devno, PCI_INTERRUPT_LINE, &interrupt); */ -/* printf("Installing eth0 interrupt handler to %d\n", interrupt); */ -/* irq_install_handler(interrupt, eth_interrupt, dev); */ -/* } */ +/* printf("Installing eth0 interrupt handler to %d\n", interrupt); */ +/* irq_install_handler(interrupt, eth_interrupt, dev); */ +/* } */ card_number++; /* Set the latency timer for value */ - s = getenv("3com_latency"); - if (s) - { - ret = pci_write_config_byte(devno, PCI_LATENCY_TIMER, (unsigned char)atoi(s)); - } - else ret = pci_write_config_byte(devno, PCI_LATENCY_TIMER, 0x0a); + s = getenv ("3com_latency"); + if (s) { + ret = pci_write_config_byte (devno, PCI_LATENCY_TIMER, + (unsigned char) atoi (s)); + } else + ret = pci_write_config_byte (devno, PCI_LATENCY_TIMER, 0x0a); - read_hw_addr(dev, bis); /* get the MAC address from Window 2*/ + read_hw_addr (dev, bis); /* get the MAC address from Window 2 */ /* Reset the ethernet controller */ PRINTF ("Issuing reset command....\n"); - if (!issue_and_wait(dev, TotalReset)) - { - printf("Error: Cannot reset ethernet controller.\n"); + if (!issue_and_wait (dev, TotalReset)) { + printf ("Error: Cannot reset ethernet controller.\n"); goto Done; - } - else + } else PRINTF ("Ethernet controller reset.\n"); /* allocate memory for rx and tx rings */ - if(!(rx_ring = memalign(sizeof(struct rx_desc_3com) * NUM_RX_DESC, 16))) - { + if (!(rx_ring = memalign (sizeof (struct rx_desc_3com) * NUM_RX_DESC, 16))) { PRINTF ("Cannot allocate memory for RX_RING.....\n"); goto Done; } - if (!(tx_ring = memalign(sizeof(struct tx_desc_3com) * NUM_TX_DESC, 16))) - { + if (!(tx_ring = memalign (sizeof (struct tx_desc_3com) * NUM_TX_DESC, 16))) { PRINTF ("Cannot allocate memory for TX_RING.....\n"); goto Done; } @@ -543,219 +535,208 @@ Done: } -static int eth_3com_init(struct eth_device* dev, bd_t *bis) +static int eth_3com_init (struct eth_device *dev, bd_t * bis) { int i, status = 0; int tx_cur, loop; u16 status_enable, intr_enable; struct descriptor *ias_cmd; - /* Determine what type of network the machine is connected to */ - /* presently drops the connect to 10Mbps */ + /* Determine what type of network the machine is connected to */ + /* presently drops the connect to 10Mbps */ - if (!auto_negotiate(dev)) - { - printf("Error: Cannot determine network media.\n"); + if (!auto_negotiate (dev)) { + printf ("Error: Cannot determine network media.\n"); goto Done; } - issue_and_wait(dev, TxReset); - issue_and_wait(dev, RxReset|0x04); + issue_and_wait (dev, TxReset); + issue_and_wait (dev, RxReset | 0x04); /* Switch to register set 7 for normal use. */ - EL3WINDOW(dev, 7); + EL3WINDOW (dev, 7); /* Initialize Rx and Tx rings */ - init_rx_ring(dev); - purge_tx_ring(dev); + init_rx_ring (dev); + purge_tx_ring (dev); - ETH_CMD(dev, SetRxFilter | RxStation | RxBroadcast | RxProm); + ETH_CMD (dev, SetRxFilter | RxStation | RxBroadcast | RxProm); - issue_and_wait(dev,SetTxStart|0x07ff); + issue_and_wait (dev, SetTxStart | 0x07ff); /* Below sets which indication bits to be seen. */ - status_enable = SetStatusEnb | HostError | DownComplete | UpComplete | (1<<6); - ETH_CMD(dev, status_enable); + status_enable = + SetStatusEnb | HostError | DownComplete | UpComplete | (1 << + 6); + ETH_CMD (dev, status_enable); /* Below sets no bits are to cause an interrupt since this is just polling */ - intr_enable = SetIntrEnb; + intr_enable = SetIntrEnb; /* intr_enable = SetIntrEnb | (1<<9) | (1<<10) | (1<<6); */ - ETH_CMD(dev, intr_enable); - ETH_OUTB(dev, 127, UpPoll); + ETH_CMD (dev, intr_enable); + ETH_OUTB (dev, 127, UpPoll); /* Ack all pending events, and set active indicator mask */ - ETH_CMD(dev, AckIntr | IntLatch | TxAvailable | RxEarly | IntReq); - ETH_CMD(dev, intr_enable); + ETH_CMD (dev, AckIntr | IntLatch | TxAvailable | RxEarly | IntReq); + ETH_CMD (dev, intr_enable); /* Tell the adapter where the RX ring is located */ - issue_and_wait(dev,UpStall); /* Stall and set the UplistPtr */ - ETH_OUTL(dev, (u32)&rx_ring[rx_next], UpListPtr); - ETH_CMD(dev, RxEnable); /* Enable the receiver. */ - issue_and_wait(dev,UpUnstall); + issue_and_wait (dev, UpStall); /* Stall and set the UplistPtr */ + ETH_OUTL (dev, (u32) & rx_ring[rx_next], UpListPtr); + ETH_CMD (dev, RxEnable); /* Enable the receiver. */ + issue_and_wait (dev, UpUnstall); /* Send the Individual Address Setup frame */ - tx_cur = tx_next; - tx_next = ((tx_next+1) % NUM_TX_DESC); + tx_cur = tx_next; + tx_next = ((tx_next + 1) % NUM_TX_DESC); - ias_cmd = (struct descriptor *)&tx_ring[tx_cur]; - ias_cmd->status = cpu_to_le32(1<<31); /* set DnIndicate bit. */ - ias_cmd->next = 0; - ias_cmd->addr = cpu_to_le32((u32)&bis->bi_enetaddr[0]); - ias_cmd->length = cpu_to_le32(6 | LAST_FRAG); + ias_cmd = (struct descriptor *) &tx_ring[tx_cur]; + ias_cmd->status = cpu_to_le32 (1 << 31); /* set DnIndicate bit. */ + ias_cmd->next = 0; + ias_cmd->addr = cpu_to_le32 ((u32) & bis->bi_enetaddr[0]); + ias_cmd->length = cpu_to_le32 (6 | LAST_FRAG); /* Tell the adapter where the TX ring is located */ - ETH_CMD(dev, TxEnable); /* Enable transmitter. */ - issue_and_wait(dev, DownStall); /* Stall and set the DownListPtr. */ - ETH_OUTL(dev, (u32)&tx_ring[tx_cur], DownListPtr); - issue_and_wait(dev, DownUnstall); - for (i=0; !(ETH_STATUS(dev) & DownComplete); i++) - { - if (i >= TOUT_LOOP) - { - PRINTF("TX Ring status (Init): 0x%4x\n", le32_to_cpu(tx_ring[tx_cur].status)); - PRINTF("ETH_STATUS: 0x%x\n", ETH_STATUS(dev)); + ETH_CMD (dev, TxEnable); /* Enable transmitter. */ + issue_and_wait (dev, DownStall); /* Stall and set the DownListPtr. */ + ETH_OUTL (dev, (u32) & tx_ring[tx_cur], DownListPtr); + issue_and_wait (dev, DownUnstall); + for (i = 0; !(ETH_STATUS (dev) & DownComplete); i++) { + if (i >= TOUT_LOOP) { + PRINTF ("TX Ring status (Init): 0x%4x\n", + le32_to_cpu (tx_ring[tx_cur].status)); + PRINTF ("ETH_STATUS: 0x%x\n", ETH_STATUS (dev)); goto Done; } } - if (ETH_STATUS(dev) & DownComplete) /* If DownLoad Complete ACK the bit */ - { - ETH_CMD(dev, AckIntr | DownComplete); /* acknowledge the indication bit */ - issue_and_wait(dev, DownStall); /* stall and clear DownListPtr */ - ETH_OUTL(dev, 0, DownListPtr); - issue_and_wait(dev, DownUnstall); + if (ETH_STATUS (dev) & DownComplete) { /* If DownLoad Complete ACK the bit */ + ETH_CMD (dev, AckIntr | DownComplete); /* acknowledge the indication bit */ + issue_and_wait (dev, DownStall); /* stall and clear DownListPtr */ + ETH_OUTL (dev, 0, DownListPtr); + issue_and_wait (dev, DownUnstall); } status = 1; - Done: return status; } -int eth_3com_send(struct eth_device* dev, volatile void *packet, int length) +int eth_3com_send (struct eth_device *dev, volatile void *packet, int length) { int i, status = 0; int tx_cur; - if (length <= 0) - { - PRINTF("eth: bad packet size: %d\n", length); + if (length <= 0) { + PRINTF ("eth: bad packet size: %d\n", length); goto Done; } - tx_cur = tx_next; - tx_next = (tx_next+1) % NUM_TX_DESC; + tx_cur = tx_next; + tx_next = (tx_next + 1) % NUM_TX_DESC; - tx_ring[tx_cur].status = cpu_to_le32(1<<31); /* set DnIndicate bit */ - tx_ring[tx_cur].next = 0; - tx_ring[tx_cur].addr = cpu_to_le32(((u32) packet)); - tx_ring[tx_cur].length = cpu_to_le32(length | LAST_FRAG); + tx_ring[tx_cur].status = cpu_to_le32 (1 << 31); /* set DnIndicate bit */ + tx_ring[tx_cur].next = 0; + tx_ring[tx_cur].addr = cpu_to_le32 (((u32) packet)); + tx_ring[tx_cur].length = cpu_to_le32 (length | LAST_FRAG); /* Send the packet */ - issue_and_wait(dev, DownStall); /* stall and set the DownListPtr */ - ETH_OUTL(dev, (u32) &tx_ring[tx_cur], DownListPtr); - issue_and_wait(dev, DownUnstall); + issue_and_wait (dev, DownStall); /* stall and set the DownListPtr */ + ETH_OUTL (dev, (u32) & tx_ring[tx_cur], DownListPtr); + issue_and_wait (dev, DownUnstall); - for (i=0; !(ETH_STATUS(dev) & DownComplete); i++) - { - if (i >= TOUT_LOOP) - { - PRINTF("TX Ring status (send): 0x%4x\n", le32_to_cpu(tx_ring[tx_cur].status)); + for (i = 0; !(ETH_STATUS (dev) & DownComplete); i++) { + if (i >= TOUT_LOOP) { + PRINTF ("TX Ring status (send): 0x%4x\n", + le32_to_cpu (tx_ring[tx_cur].status)); goto Done; } } - if (ETH_STATUS(dev) & DownComplete) /* If DownLoad Complete ACK the bit */ - { - ETH_CMD(dev, AckIntr | DownComplete); /* acknowledge the indication bit */ - issue_and_wait(dev, DownStall); /* stall and clear DownListPtr */ - ETH_OUTL(dev, 0, DownListPtr); - issue_and_wait(dev, DownUnstall); + if (ETH_STATUS (dev) & DownComplete) { /* If DownLoad Complete ACK the bit */ + ETH_CMD (dev, AckIntr | DownComplete); /* acknowledge the indication bit */ + issue_and_wait (dev, DownStall); /* stall and clear DownListPtr */ + ETH_OUTL (dev, 0, DownListPtr); + issue_and_wait (dev, DownUnstall); } - status=1; - Done: + status = 1; +Done: return status; } -void PrintPacket (uchar *packet, int length) +void PrintPacket (uchar * packet, int length) { -int loop; -uchar *ptr; + int loop; + uchar *ptr; printf ("Printing packet of length %x.\n\n", length); ptr = packet; - for (loop = 1; loop <= length; loop++) - { + for (loop = 1; loop <= length; loop++) { printf ("%2x ", *ptr++); - if ((loop % 40)== 0) + if ((loop % 40) == 0) printf ("\n"); } } -int eth_3com_recv(struct eth_device* dev) +int eth_3com_recv (struct eth_device *dev) { u16 stat = 0; u32 status; int rx_prev, length = 0; - while (!(ETH_STATUS(dev) & UpComplete)) /* wait on receipt of packet */ + while (!(ETH_STATUS (dev) & UpComplete)) /* wait on receipt of packet */ ; - status = le32_to_cpu(rx_ring[rx_next].status); /* packet status */ + status = le32_to_cpu (rx_ring[rx_next].status); /* packet status */ - while (status & (1<<15)) - { + while (status & (1 << 15)) { /* A packet has been received */ - if (status & (1<<15)) - { + if (status & (1 << 15)) { /* A valid frame received */ - length = le32_to_cpu(rx_ring[rx_next].status) & 0x1fff; /* length is in bits 0 - 12 */ + length = le32_to_cpu (rx_ring[rx_next].status) & 0x1fff; /* length is in bits 0 - 12 */ /* Pass the packet up to the protocol layers */ - NetReceive((uchar *)le32_to_cpu(rx_ring[rx_next].addr), length); - rx_ring[rx_next].status = 0; /* clear the status word */ - ETH_CMD(dev, AckIntr | UpComplete); - issue_and_wait(dev, UpUnstall); - } - else - if (stat & HostError) - { + NetReceive ((uchar *) + le32_to_cpu (rx_ring[rx_next].addr), + length); + rx_ring[rx_next].status = 0; /* clear the status word */ + ETH_CMD (dev, AckIntr | UpComplete); + issue_and_wait (dev, UpUnstall); + } else if (stat & HostError) { /* There was an error */ - printf("Rx error status: 0x%4x\n", stat); - init_rx_ring(dev); + printf ("Rx error status: 0x%4x\n", stat); + init_rx_ring (dev); goto Done; } rx_prev = rx_next; rx_next = (rx_next + 1) % NUM_RX_DESC; - stat = ETH_STATUS(dev); /* register status */ - status = le32_to_cpu(rx_ring[rx_next].status); /* packet status */ + stat = ETH_STATUS (dev); /* register status */ + status = le32_to_cpu (rx_ring[rx_next].status); /* packet status */ } - Done: return length; } -void eth_3com_halt(struct eth_device* dev) +void eth_3com_halt (struct eth_device *dev) { - if (!(dev->iobase)) - { + if (!(dev->iobase)) { goto Done; } - issue_and_wait(dev, DownStall); /* shut down transmit and receive */ - issue_and_wait(dev, UpStall); - issue_and_wait(dev, RxDisable); - issue_and_wait(dev, TxDisable); + issue_and_wait (dev, DownStall); /* shut down transmit and receive */ + issue_and_wait (dev, UpStall); + issue_and_wait (dev, RxDisable); + issue_and_wait (dev, TxDisable); /* free(tx_ring); /###* release memory allocated to the DPD and UPD rings */ /* free(rx_ring); */ @@ -764,41 +745,41 @@ Done: return; } -static void init_rx_ring(struct eth_device* dev) +static void init_rx_ring (struct eth_device *dev) { int i; - PRINTF("Initializing rx_ring. rx_buffer = %p\n", rx_buffer); - issue_and_wait(dev, UpStall); + PRINTF ("Initializing rx_ring. rx_buffer = %p\n", rx_buffer); + issue_and_wait (dev, UpStall); - for (i = 0; i < NUM_RX_DESC; i++) - { - rx_ring[i].next = cpu_to_le32(((u32) &rx_ring[(i+1) % NUM_RX_DESC])); - rx_ring[i].status = 0; - rx_ring[i].addr = cpu_to_le32(((u32) &rx_buffer[i][0])); - rx_ring[i].length = cpu_to_le32(PKTSIZE_ALIGN | LAST_FRAG); + for (i = 0; i < NUM_RX_DESC; i++) { + rx_ring[i].next = + cpu_to_le32 (((u32) & + rx_ring[(i + 1) % NUM_RX_DESC])); + rx_ring[i].status = 0; + rx_ring[i].addr = cpu_to_le32 (((u32) & rx_buffer[i][0])); + rx_ring[i].length = cpu_to_le32 (PKTSIZE_ALIGN | LAST_FRAG); } rx_next = 0; } -static void purge_tx_ring(struct eth_device* dev) +static void purge_tx_ring (struct eth_device *dev) { int i; - PRINTF("Purging tx_ring.\n"); + PRINTF ("Purging tx_ring.\n"); - tx_next = 0; + tx_next = 0; - for (i = 0; i < NUM_TX_DESC; i++) - { - tx_ring[i].next = 0; - tx_ring[i].status = 0; - tx_ring[i].addr = 0; - tx_ring[i].length = 0; + for (i = 0; i < NUM_TX_DESC; i++) { + tx_ring[i].next = 0; + tx_ring[i].status = 0; + tx_ring[i].addr = 0; + tx_ring[i].length = 0; } } -static void read_hw_addr(struct eth_device* dev, bd_t *bis) +static void read_hw_addr (struct eth_device *dev, bd_t * bis) { u8 hw_addr[ETH_ALEN]; unsigned int eeprom[0x40]; @@ -807,77 +788,77 @@ static void read_hw_addr(struct eth_device* dev, bd_t *bis) /* Read the station address from the EEPROM. */ - EL3WINDOW(dev, 0); - for (i = 0; i < 0x40; i++) - { - ETH_OUTW(dev, EEPROM_Read + i, Wn0EepromCmd); + EL3WINDOW (dev, 0); + for (i = 0; i < 0x40; i++) { + ETH_OUTW (dev, EEPROM_Read + i, Wn0EepromCmd); /* Pause for at least 162 us. for the read to take place. */ - for (timer = 10; timer >= 0; timer--) - { - udelay(162); - if ((ETH_INW(dev, Wn0EepromCmd) & 0x8000) == 0) + for (timer = 10; timer >= 0; timer--) { + udelay (162); + if ((ETH_INW (dev, Wn0EepromCmd) & 0x8000) == 0) break; } - eeprom[i] = ETH_INW(dev, Wn0EepromData); + eeprom[i] = ETH_INW (dev, Wn0EepromData); } /* Checksum calculation. I'm not sure about this part and there seems to be a bug on the 3com side of things */ for (i = 0; i < 0x21; i++) - checksum ^= eeprom[i]; + checksum ^= eeprom[i]; checksum = (checksum ^ (checksum >> 8)) & 0xff; if (checksum != 0xbb) - printf(" *** INVALID EEPROM CHECKSUM %4.4x *** \n", checksum); + printf (" *** INVALID EEPROM CHECKSUM %4.4x *** \n", + checksum); - for (i = 0, j = 0; i < 3; i++) - { - hw_addr[j++] = (u8)((eeprom[i+10] >> 8) & 0xff); - hw_addr[j++] = (u8)(eeprom[i+10] & 0xff); + for (i = 0, j = 0; i < 3; i++) { + hw_addr[j++] = (u8) ((eeprom[i + 10] >> 8) & 0xff); + hw_addr[j++] = (u8) (eeprom[i + 10] & 0xff); } /* MAC Address is in window 2, write value from EEPROM to window 2 */ - EL3WINDOW(dev, 2); + EL3WINDOW (dev, 2); for (i = 0; i < 6; i++) - ETH_OUTB(dev, hw_addr[i], i); + ETH_OUTB (dev, hw_addr[i], i); - for (j = 0; j < ETH_ALEN; j+=2) - { - hw_addr[j] = (u8)(ETH_INW(dev, j) & 0xff); - hw_addr[j+1] = (u8)((ETH_INW(dev, j) >> 8) & 0xff); + for (j = 0; j < ETH_ALEN; j += 2) { + hw_addr[j] = (u8) (ETH_INW (dev, j) & 0xff); + hw_addr[j + 1] = (u8) ((ETH_INW (dev, j) >> 8) & 0xff); } - for (i=0;i<ETH_ALEN;i++) - { - if (hw_addr[i] != bis->bi_enetaddr[i]) - { -/* printf("Warning: HW address don't match:\n"); */ -/* printf("Address in 3Com Window 2 is " */ -/* "%02X:%02X:%02X:%02X:%02X:%02X\n", */ -/* hw_addr[0], hw_addr[1], hw_addr[2], */ -/* hw_addr[3], hw_addr[4], hw_addr[5]); */ -/* printf("Address used by U-Boot is " */ -/* "%02X:%02X:%02X:%02X:%02X:%02X\n", */ -/* bis->bi_enetaddr[0], bis->bi_enetaddr[1], */ -/* bis->bi_enetaddr[2], bis->bi_enetaddr[3], */ -/* bis->bi_enetaddr[4], bis->bi_enetaddr[5]); */ -/* goto Done; */ - char buffer[256]; - if (bis->bi_enetaddr[0] == 0 && bis->bi_enetaddr[1] == 0 && - bis->bi_enetaddr[2] == 0 && bis->bi_enetaddr[3] == 0 && - bis->bi_enetaddr[4] == 0 && bis->bi_enetaddr[5] == 0) - { - - sprintf(buffer, "%02X:%02X:%02X:%02X:%02X:%02X", - hw_addr[0], hw_addr[1], hw_addr[2], - hw_addr[3], hw_addr[4], hw_addr[5]); - setenv("ethaddr", buffer); - } + for (i = 0; i < ETH_ALEN; i++) { + if (hw_addr[i] != bis->bi_enetaddr[i]) { +/* printf("Warning: HW address don't match:\n"); */ +/* printf("Address in 3Com Window 2 is " */ +/* "%02X:%02X:%02X:%02X:%02X:%02X\n", */ +/* hw_addr[0], hw_addr[1], hw_addr[2], */ +/* hw_addr[3], hw_addr[4], hw_addr[5]); */ +/* printf("Address used by U-Boot is " */ +/* "%02X:%02X:%02X:%02X:%02X:%02X\n", */ +/* bis->bi_enetaddr[0], bis->bi_enetaddr[1], */ +/* bis->bi_enetaddr[2], bis->bi_enetaddr[3], */ +/* bis->bi_enetaddr[4], bis->bi_enetaddr[5]); */ +/* goto Done; */ + char buffer[256]; + + if (bis->bi_enetaddr[0] == 0 + && bis->bi_enetaddr[1] == 0 + && bis->bi_enetaddr[2] == 0 + && bis->bi_enetaddr[3] == 0 + && bis->bi_enetaddr[4] == 0 + && bis->bi_enetaddr[5] == 0) { + + sprintf (buffer, + "%02X:%02X:%02X:%02X:%02X:%02X", + hw_addr[0], hw_addr[1], hw_addr[2], + hw_addr[3], hw_addr[4], hw_addr[5]); + setenv ("ethaddr", buffer); + } } } - for(i=0; i<ETH_ALEN; i++) dev->enetaddr[i] = hw_addr[i]; + for (i = 0; i < ETH_ALEN; i++) + dev->enetaddr[i] = hw_addr[i]; Done: return; diff --git a/board/MAI/AmigaOneG3SE/interrupts.c b/board/MAI/AmigaOneG3SE/interrupts.c index 5b314a8..86b4415 100644 --- a/board/MAI/AmigaOneG3SE/interrupts.c +++ b/board/MAI/AmigaOneG3SE/interrupts.c @@ -176,9 +176,9 @@ external_interrupt(struct pt_regs *regs) else { PRINTF ("\nBogus External Interrupt IRQ %d\n", irq); /* - * turn off the bogus interrupt, otherwise it - * might repeat forever - */ + * turn off the bogus interrupt, otherwise it + * might repeat forever + */ unmask = 0; } diff --git a/board/MAI/AmigaOneG3SE/ps2kbd.c b/board/MAI/AmigaOneG3SE/ps2kbd.c index cf4f4d0..39d8149 100644 --- a/board/MAI/AmigaOneG3SE/ps2kbd.c +++ b/board/MAI/AmigaOneG3SE/ps2kbd.c @@ -58,7 +58,7 @@ void i8259_unmask_irq(unsigned int irq); #define KBD_STAT_KOBF 0x01 #define KBD_STAT_IBF 0x02 #define KBD_STAT_SYS 0x04 -#define KBD_STAT_CD 0x08 +#define KBD_STAT_CD 0x08 #define KBD_STAT_LOCK 0x10 #define KBD_STAT_MOBF 0x20 #define KBD_STAT_TI_OUT 0x40 @@ -71,50 +71,50 @@ void i8259_unmask_irq(unsigned int irq); * Keyboard Controller Commands */ -#define KBD_CCMD_READ_MODE 0x20 /* Read mode bits */ -#define KBD_CCMD_WRITE_MODE 0x60 /* Write mode bits */ -#define KBD_CCMD_GET_VERSION 0xA1 /* Get controller version */ +#define KBD_CCMD_READ_MODE 0x20 /* Read mode bits */ +#define KBD_CCMD_WRITE_MODE 0x60 /* Write mode bits */ +#define KBD_CCMD_GET_VERSION 0xA1 /* Get controller version */ #define KBD_CCMD_MOUSE_DISABLE 0xA7 /* Disable mouse interface */ -#define KBD_CCMD_MOUSE_ENABLE 0xA8 /* Enable mouse interface */ -#define KBD_CCMD_TEST_MOUSE 0xA9 /* Mouse interface test */ -#define KBD_CCMD_SELF_TEST 0xAA /* Controller self test */ -#define KBD_CCMD_KBD_TEST 0xAB /* Keyboard interface test */ -#define KBD_CCMD_KBD_DISABLE 0xAD /* Keyboard interface disable */ -#define KBD_CCMD_KBD_ENABLE 0xAE /* Keyboard interface enable */ +#define KBD_CCMD_MOUSE_ENABLE 0xA8 /* Enable mouse interface */ +#define KBD_CCMD_TEST_MOUSE 0xA9 /* Mouse interface test */ +#define KBD_CCMD_SELF_TEST 0xAA /* Controller self test */ +#define KBD_CCMD_KBD_TEST 0xAB /* Keyboard interface test */ +#define KBD_CCMD_KBD_DISABLE 0xAD /* Keyboard interface disable */ +#define KBD_CCMD_KBD_ENABLE 0xAE /* Keyboard interface enable */ #define KBD_CCMD_WRITE_AUX_OBUF 0xD3 /* Write to output buffer as if initiated by the auxiliary device */ -#define KBD_CCMD_WRITE_MOUSE 0xD4 /* Write the following byte to the mouse */ +#define KBD_CCMD_WRITE_MOUSE 0xD4 /* Write the following byte to the mouse */ /* * Keyboard Commands */ -#define KBD_CMD_SET_LEDS 0xED /* Set keyboard leds */ -#define KBD_CMD_SET_RATE 0xF3 /* Set typematic rate */ -#define KBD_CMD_ENABLE 0xF4 /* Enable scanning */ -#define KBD_CMD_DISABLE 0xF5 /* Disable scanning */ -#define KBD_CMD_RESET 0xFF /* Reset */ +#define KBD_CMD_SET_LEDS 0xED /* Set keyboard leds */ +#define KBD_CMD_SET_RATE 0xF3 /* Set typematic rate */ +#define KBD_CMD_ENABLE 0xF4 /* Enable scanning */ +#define KBD_CMD_DISABLE 0xF5 /* Disable scanning */ +#define KBD_CMD_RESET 0xFF /* Reset */ /* * Keyboard Replies */ -#define KBD_REPLY_POR 0xAA /* Power on reset */ -#define KBD_REPLY_ACK 0xFA /* Command ACK */ -#define KBD_REPLY_RESEND 0xFE /* Command NACK, send the cmd again */ +#define KBD_REPLY_POR 0xAA /* Power on reset */ +#define KBD_REPLY_ACK 0xFA /* Command ACK */ +#define KBD_REPLY_RESEND 0xFE /* Command NACK, send the cmd again */ /* * Status Register Bits */ -#define KBD_STAT_OBF 0x01 /* Keyboard output buffer full */ -#define KBD_STAT_IBF 0x02 /* Keyboard input buffer full */ -#define KBD_STAT_SELFTEST 0x04 /* Self test successful */ -#define KBD_STAT_CMD 0x08 /* Last write was a command write (0=data) */ -#define KBD_STAT_UNLOCKED 0x10 /* Zero if keyboard locked */ -#define KBD_STAT_MOUSE_OBF 0x20 /* Mouse output buffer full */ -#define KBD_STAT_GTO 0x40 /* General receive/xmit timeout */ -#define KBD_STAT_PERR 0x80 /* Parity error */ +#define KBD_STAT_OBF 0x01 /* Keyboard output buffer full */ +#define KBD_STAT_IBF 0x02 /* Keyboard input buffer full */ +#define KBD_STAT_SELFTEST 0x04 /* Self test successful */ +#define KBD_STAT_CMD 0x08 /* Last write was a command write (0=data) */ +#define KBD_STAT_UNLOCKED 0x10 /* Zero if keyboard locked */ +#define KBD_STAT_MOUSE_OBF 0x20 /* Mouse output buffer full */ +#define KBD_STAT_GTO 0x40 /* General receive/xmit timeout */ +#define KBD_STAT_PERR 0x80 /* Parity error */ #define AUX_STAT_OBF (KBD_STAT_OBF | KBD_STAT_MOUSE_OBF) @@ -122,24 +122,24 @@ void i8259_unmask_irq(unsigned int irq); * Controller Mode Register Bits */ -#define KBD_MODE_KBD_INT 0x01 /* Keyboard data generate IRQ1 */ -#define KBD_MODE_MOUSE_INT 0x02 /* Mouse data generate IRQ12 */ -#define KBD_MODE_SYS 0x04 /* The system flag (?) */ -#define KBD_MODE_NO_KEYLOCK 0x08 /* The keylock doesn't affect the keyboard if set */ -#define KBD_MODE_DISABLE_KBD 0x10 /* Disable keyboard interface */ +#define KBD_MODE_KBD_INT 0x01 /* Keyboard data generate IRQ1 */ +#define KBD_MODE_MOUSE_INT 0x02 /* Mouse data generate IRQ12 */ +#define KBD_MODE_SYS 0x04 /* The system flag (?) */ +#define KBD_MODE_NO_KEYLOCK 0x08 /* The keylock doesn't affect the keyboard if set */ +#define KBD_MODE_DISABLE_KBD 0x10 /* Disable keyboard interface */ #define KBD_MODE_DISABLE_MOUSE 0x20 /* Disable mouse interface */ -#define KBD_MODE_KCC 0x40 /* Scan code conversion to PC format */ -#define KBD_MODE_RFU 0x80 +#define KBD_MODE_KCC 0x40 /* Scan code conversion to PC format */ +#define KBD_MODE_RFU 0x80 -#define KDB_DATA_PORT 0x60 +#define KDB_DATA_PORT 0x60 #define KDB_COMMAND_PORT 0x64 -#define LED_SCR 0x01 /* scroll lock led */ -#define LED_CAP 0x04 /* caps lock led */ -#define LED_NUM 0x02 /* num lock led */ +#define LED_SCR 0x01 /* scroll lock led */ +#define LED_CAP 0x04 /* caps lock led */ +#define LED_NUM 0x02 /* num lock led */ -#define KBD_BUFFER_LEN 0x20 /* size of the keyboardbuffer */ +#define KBD_BUFFER_LEN 0x20 /* size of the keyboardbuffer */ static volatile char kbd_buffer[KBD_BUFFER_LEN]; @@ -194,21 +194,22 @@ static unsigned char kbd_ctrl_xlate[] = { * Init ******************************************************************/ -int isa_kbd_init(void) +int isa_kbd_init (void) { - char* result; - result=kbd_initialize(); - if (result != NULL) - { - result = kbd_initialize(); + char *result; + + result = kbd_initialize (); + if (result != NULL) { + result = kbd_initialize (); } - if(result==NULL) { - printf("AT Keyboard initialized\n"); - irq_install_handler(KBD_INTERRUPT, (interrupt_handler_t *)kbd_interrupt, NULL); + if (result == NULL) { + printf ("AT Keyboard initialized\n"); + irq_install_handler (KBD_INTERRUPT, + (interrupt_handler_t *) kbd_interrupt, + NULL); return (1); - } - else { - printf("%s\n",result); + } else { + printf ("%s\n", result); return (-1); } } @@ -225,20 +226,20 @@ int overwrite_console (void) int drv_isa_kbd_init (void) { int error; - device_t kbddev ; + device_t kbddev ; char *stdinname = getenv ("stdin"); if(isa_kbd_init()==-1) return -1; - memset (&kbddev, 0, sizeof(kbddev)); - strcpy(kbddev.name, DEVNAME); - kbddev.flags = DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM; - kbddev.putc = NULL ; + memset (&kbddev, 0, sizeof(kbddev)); + strcpy(kbddev.name, DEVNAME); + kbddev.flags = DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM; + kbddev.putc = NULL ; kbddev.puts = NULL ; kbddev.getc = kbd_getc ; kbddev.tstc = kbd_testc ; - error = device_register (&kbddev); + error = device_register (&kbddev); if(error==0) { /* check if this is the standard input device */ if(strcmp(stdinname,DEVNAME)==0) { @@ -301,7 +302,6 @@ int kbd_getc(void) } - /* set LEDs */ void kbd_set_leds(void) @@ -322,140 +322,139 @@ void kbd_set_leds(void) kbd_send_data(leds); } - -void handle_keyboard_event(unsigned char scancode) +void handle_keyboard_event (unsigned char scancode) { unsigned char keycode; /* Convert scancode to keycode */ - PRINTF("scancode %x\n",scancode); - if(scancode==0xe0) { - e0=1; /* special charakters */ + PRINTF ("scancode %x\n", scancode); + if (scancode == 0xe0) { + e0 = 1; /* special charakters */ return; } - if(e0==1) { - e0=0; /* delete flag */ - if(!( ((scancode&0x7F)==0x38)|| /* the right ctrl key */ - ((scancode&0x7F)==0x1D)|| /* the right alt key */ - ((scancode&0x7F)==0x35)|| /* the right '/' key */ - ((scancode&0x7F)==0x1C)|| /* the right enter key */ - ((scancode)==0x48)|| /* arrow up */ - ((scancode)==0x50)|| /* arrow down */ - ((scancode)==0x4b)|| /* arrow left */ - ((scancode)==0x4d))) /* arrow right */ + if (e0 == 1) { + e0 = 0; /* delete flag */ + if (!(((scancode & 0x7F) == 0x38) || /* the right ctrl key */ + ((scancode & 0x7F) == 0x1D) || /* the right alt key */ + ((scancode & 0x7F) == 0x35) || /* the right '/' key */ + ((scancode & 0x7F) == 0x1C) || /* the right enter key */ + ((scancode) == 0x48) || /* arrow up */ + ((scancode) == 0x50) || /* arrow down */ + ((scancode) == 0x4b) || /* arrow left */ + ((scancode) == 0x4d))) + /* arrow right */ /* we swallow unknown e0 codes */ return; } /* special cntrl keys */ - switch(scancode) - { + switch (scancode) { case 0x48: - kbd_put_queue(27); - kbd_put_queue(91); - kbd_put_queue('A'); - return; + kbd_put_queue (27); + kbd_put_queue (91); + kbd_put_queue ('A'); + return; case 0x50: - kbd_put_queue(27); - kbd_put_queue(91); - kbd_put_queue('B'); - return; + kbd_put_queue (27); + kbd_put_queue (91); + kbd_put_queue ('B'); + return; case 0x4b: - kbd_put_queue(27); - kbd_put_queue(91); - kbd_put_queue('D'); - return; + kbd_put_queue (27); + kbd_put_queue (91); + kbd_put_queue ('D'); + return; case 0x4D: - kbd_put_queue(27); - kbd_put_queue(91); - kbd_put_queue('C'); - return; - case 0x58: /* F12 key */ - if (ctrl == 1) - { - extern int console_changed; - setenv("stdin", DEVNAME); - setenv("stdout", "vga"); - console_changed = 1; - } - return; + kbd_put_queue (27); + kbd_put_queue (91); + kbd_put_queue ('C'); + return; + case 0x58: /* F12 key */ + if (ctrl == 1) { + extern int console_changed; + + setenv ("stdin", DEVNAME); + setenv ("stdout", "vga"); + console_changed = 1; + } + return; case 0x2A: - case 0x36: /* shift pressed */ - shift=1; - return; /* do nothing else */ - case 0xAA: - case 0xB6: /* shift released */ - shift=0; - return; /* do nothing else */ - case 0x38: /* alt pressed */ - alt=1; - return; /* do nothing else */ - case 0xB8: /* alt released */ - alt=0; - return; /* do nothing else */ - case 0x1d: /* ctrl pressed */ - ctrl=1; - return; /* do nothing else */ - case 0x9d: /* ctrl released */ - ctrl=0; - return; /* do nothing else */ - case 0x46: /* scrollock pressed */ - scroll_lock=~scroll_lock; - kbd_set_leds(); - return; /* do nothing else */ - case 0x3A: /* capslock pressed */ - caps_lock=~caps_lock; - kbd_set_leds(); - return; - case 0x45: /* numlock pressed */ - num_lock=~num_lock; - kbd_set_leds(); - return; - case 0xC6: /* scroll lock released */ - case 0xC5: /* num lock released */ - case 0xBA: /* caps lock released */ - return; /* just swallow */ + case 0x36: /* shift pressed */ + shift = 1; + return; /* do nothing else */ + case 0xAA: + case 0xB6: /* shift released */ + shift = 0; + return; /* do nothing else */ + case 0x38: /* alt pressed */ + alt = 1; + return; /* do nothing else */ + case 0xB8: /* alt released */ + alt = 0; + return; /* do nothing else */ + case 0x1d: /* ctrl pressed */ + ctrl = 1; + return; /* do nothing else */ + case 0x9d: /* ctrl released */ + ctrl = 0; + return; /* do nothing else */ + case 0x46: /* scrollock pressed */ + scroll_lock = ~scroll_lock; + kbd_set_leds (); + return; /* do nothing else */ + case 0x3A: /* capslock pressed */ + caps_lock = ~caps_lock; + kbd_set_leds (); + return; + case 0x45: /* numlock pressed */ + num_lock = ~num_lock; + kbd_set_leds (); + return; + case 0xC6: /* scroll lock released */ + case 0xC5: /* num lock released */ + case 0xBA: /* caps lock released */ + return; /* just swallow */ } - if((scancode&0x80)==0x80) /* key released */ + if ((scancode & 0x80) == 0x80) /* key released */ return; /* now, decide which table we need */ - if(scancode > (sizeof(kbd_plain_xlate)/sizeof(kbd_plain_xlate[0]))) { /* scancode not in list */ - PRINTF("unkown scancode %X\n",scancode); - return; /* swallow it */ + if (scancode > (sizeof (kbd_plain_xlate) / sizeof (kbd_plain_xlate[0]))) { /* scancode not in list */ + PRINTF ("unkown scancode %X\n", scancode); + return; /* swallow it */ } /* setup plain code first */ - keycode=kbd_plain_xlate[scancode]; - if(caps_lock==1) { /* caps_lock is pressed, overwrite plain code */ - if(scancode > (sizeof(kbd_shift_xlate)/sizeof(kbd_shift_xlate[0]))) { /* scancode not in list */ - PRINTF("unkown caps-locked scancode %X\n",scancode); - return; /* swallow it */ + keycode = kbd_plain_xlate[scancode]; + if (caps_lock == 1) { /* caps_lock is pressed, overwrite plain code */ + if (scancode > (sizeof (kbd_shift_xlate) / sizeof (kbd_shift_xlate[0]))) { /* scancode not in list */ + PRINTF ("unkown caps-locked scancode %X\n", scancode); + return; /* swallow it */ } - keycode=kbd_shift_xlate[scancode]; - if(keycode<'A') { /* we only want the alphas capital */ - keycode=kbd_plain_xlate[scancode]; + keycode = kbd_shift_xlate[scancode]; + if (keycode < 'A') { /* we only want the alphas capital */ + keycode = kbd_plain_xlate[scancode]; } } - if(shift==1) { /* shift overwrites caps_lock */ - if(scancode > (sizeof(kbd_shift_xlate)/sizeof(kbd_shift_xlate[0]))) { /* scancode not in list */ - PRINTF("unkown shifted scancode %X\n",scancode); - return; /* swallow it */ + if (shift == 1) { /* shift overwrites caps_lock */ + if (scancode > (sizeof (kbd_shift_xlate) / sizeof (kbd_shift_xlate[0]))) { /* scancode not in list */ + PRINTF ("unkown shifted scancode %X\n", scancode); + return; /* swallow it */ } - keycode=kbd_shift_xlate[scancode]; + keycode = kbd_shift_xlate[scancode]; } - if(ctrl==1) { /* ctrl overwrites caps_lock and shift */ - if(scancode > (sizeof(kbd_ctrl_xlate)/sizeof(kbd_ctrl_xlate[0]))) { /* scancode not in list */ - PRINTF("unkown ctrl scancode %X\n",scancode); - return; /* swallow it */ + if (ctrl == 1) { /* ctrl overwrites caps_lock and shift */ + if (scancode > (sizeof (kbd_ctrl_xlate) / sizeof (kbd_ctrl_xlate[0]))) { /* scancode not in list */ + PRINTF ("unkown ctrl scancode %X\n", scancode); + return; /* swallow it */ } - keycode=kbd_ctrl_xlate[scancode]; + keycode = kbd_ctrl_xlate[scancode]; } /* check if valid keycode */ - if(keycode==0xff) { - PRINTF("unkown scancode %X\n",scancode); - return; /* swallow unknown codes */ + if (keycode == 0xff) { + PRINTF ("unkown scancode %X\n", scancode); + return; /* swallow unknown codes */ } - kbd_put_queue(keycode); - PRINTF("%x\n",keycode); + kbd_put_queue (keycode); + PRINTF ("%x\n", keycode); } /* @@ -463,34 +462,31 @@ void handle_keyboard_event(unsigned char scancode) * appropriate action. * */ -unsigned char handle_kbd_event(void) +unsigned char handle_kbd_event (void) { - unsigned char status = kbd_read_status(); + unsigned char status = kbd_read_status (); unsigned int work = 10000; while ((--work > 0) && (status & KBD_STAT_OBF)) { unsigned char scancode; - scancode = kbd_read_input(); + scancode = kbd_read_input (); /* Error bytes must be ignored to make the Synaptics touchpads compaq use work */ /* Ignore error bytes */ - if (!(status & (KBD_STAT_GTO | KBD_STAT_PERR))) - { - if (status & KBD_STAT_MOUSE_OBF) - ; /* not supported: handle_mouse_event(scancode); */ + if (!(status & (KBD_STAT_GTO | KBD_STAT_PERR))) { + if (status & KBD_STAT_MOUSE_OBF); /* not supported: handle_mouse_event(scancode); */ else - handle_keyboard_event(scancode); + handle_keyboard_event (scancode); } - status = kbd_read_status(); + status = kbd_read_status (); } if (!work) - PRINTF("pc_keyb: controller jammed (0x%02X).\n", status); + PRINTF ("pc_keyb: controller jammed (0x%02X).\n", status); return status; } - /****************************************************************************** * Lowlevel Part of keyboard section */ @@ -529,90 +525,91 @@ int kbd_read_data(void) return val; } -int kbd_wait_for_input(void) +int kbd_wait_for_input (void) { unsigned long timeout; int val; timeout = KBD_TIMEOUT; - val=kbd_read_data(); - while(val < 0) - { - if(timeout--==0) + val = kbd_read_data (); + while (val < 0) { + if (timeout-- == 0) return -1; - udelay(1000); - val=kbd_read_data(); + udelay (1000); + val = kbd_read_data (); } return val; } -int kb_wait(void) +int kb_wait (void) { unsigned long timeout = KBC_TIMEOUT * 10; do { - unsigned char status = handle_kbd_event(); + unsigned char status = handle_kbd_event (); + if (!(status & KBD_STAT_IBF)) - return 0; /* ok */ - udelay(1000); + return 0; /* ok */ + udelay (1000); timeout--; } while (timeout); return 1; } -void kbd_write_command_w(int data) +void kbd_write_command_w (int data) { - if(kb_wait()) - PRINTF("timeout in kbd_write_command_w\n"); - kbd_write_command(data); + if (kb_wait ()) + PRINTF ("timeout in kbd_write_command_w\n"); + kbd_write_command (data); } -void kbd_write_output_w(int data) +void kbd_write_output_w (int data) { - if(kb_wait()) - PRINTF("timeout in kbd_write_output_w\n"); - kbd_write_output(data); + if (kb_wait ()) + PRINTF ("timeout in kbd_write_output_w\n"); + kbd_write_output (data); } -void kbd_send_data(unsigned char data) +void kbd_send_data (unsigned char data) { unsigned char status; - i8259_mask_irq(KBD_INTERRUPT); /* disable interrupt */ - kbd_write_output_w(data); - status = kbd_wait_for_input(); + + i8259_mask_irq (KBD_INTERRUPT); /* disable interrupt */ + kbd_write_output_w (data); + status = kbd_wait_for_input (); if (status == KBD_REPLY_ACK) - i8259_unmask_irq(KBD_INTERRUPT); /* enable interrupt */ + i8259_unmask_irq (KBD_INTERRUPT); /* enable interrupt */ } -char * kbd_initialize(void) +char *kbd_initialize (void) { int status; - in_pointer = 0; /* delete in Buffer */ + in_pointer = 0; /* delete in Buffer */ out_pointer = 0; /* * 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_command_w(KBD_CCMD_SELF_TEST); - if (kbd_wait_for_input() != 0x55) + kbd_write_command_w (KBD_CCMD_SELF_TEST); + if (kbd_wait_for_input () != 0x55) return "Kbd: failed self test"; /* * 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_command_w(KBD_CCMD_KBD_TEST); - if (kbd_wait_for_input() != 0x00) + kbd_write_command_w (KBD_CCMD_KBD_TEST); + if (kbd_wait_for_input () != 0x00) return "Kbd: interface failed self test"; /* * Enable the keyboard by allowing the keyboard clock to run. */ - kbd_write_command_w(KBD_CCMD_KBD_ENABLE); - status = kbd_wait_for_input(); + kbd_write_command_w (KBD_CCMD_KBD_ENABLE); + status = kbd_wait_for_input (); /* * Reset keyboard. If the read times out * then the assumption is that no keyboard is @@ -622,17 +619,16 @@ char * kbd_initialize(void) * Set up to try again if the keyboard asks for RESEND. */ do { - kbd_write_output_w(KBD_CMD_RESET); - status = kbd_wait_for_input(); + kbd_write_output_w (KBD_CMD_RESET); + status = kbd_wait_for_input (); if (status == KBD_REPLY_ACK) break; - if (status != KBD_REPLY_RESEND) - { - PRINTF("status: %X\n",status); + if (status != KBD_REPLY_RESEND) { + PRINTF ("status: %X\n", status); return "Kbd: reset failed, no ACK"; } } while (1); - if (kbd_wait_for_input() != KBD_REPLY_POR) + if (kbd_wait_for_input () != KBD_REPLY_POR) return "Kbd: reset failed, no POR"; /* @@ -642,44 +638,43 @@ char * kbd_initialize(void) * Set up to try again if the keyboard asks for RESEND. */ do { - kbd_write_output_w(KBD_CMD_DISABLE); - status = kbd_wait_for_input(); + kbd_write_output_w (KBD_CMD_DISABLE); + status = kbd_wait_for_input (); if (status == KBD_REPLY_ACK) break; if (status != KBD_REPLY_RESEND) return "Kbd: disable keyboard: no ACK"; } while (1); - kbd_write_command_w(KBD_CCMD_WRITE_MODE); - kbd_write_output_w(KBD_MODE_KBD_INT - | KBD_MODE_SYS - | KBD_MODE_DISABLE_MOUSE - | KBD_MODE_KCC); + kbd_write_command_w (KBD_CCMD_WRITE_MODE); + kbd_write_output_w (KBD_MODE_KBD_INT + | KBD_MODE_SYS + | KBD_MODE_DISABLE_MOUSE | KBD_MODE_KCC); /* AMCC powerpc portables need this to use scan-code set 1 -- Cort */ - kbd_write_command_w(KBD_CCMD_READ_MODE); - if (!(kbd_wait_for_input() & KBD_MODE_KCC)) { + kbd_write_command_w (KBD_CCMD_READ_MODE); + if (!(kbd_wait_for_input () & KBD_MODE_KCC)) { /* * If the controller does not support conversion, * Set the keyboard to scan-code set 1. */ - kbd_write_output_w(0xF0); - kbd_wait_for_input(); - kbd_write_output_w(0x01); - kbd_wait_for_input(); + kbd_write_output_w (0xF0); + kbd_wait_for_input (); + kbd_write_output_w (0x01); + kbd_wait_for_input (); } - kbd_write_output_w(KBD_CMD_ENABLE); - if (kbd_wait_for_input() != KBD_REPLY_ACK) + kbd_write_output_w (KBD_CMD_ENABLE); + if (kbd_wait_for_input () != KBD_REPLY_ACK) return "Kbd: enable keyboard: no ACK"; /* * Finally, set the typematic rate to maximum. */ - kbd_write_output_w(KBD_CMD_SET_RATE); - if (kbd_wait_for_input() != KBD_REPLY_ACK) + kbd_write_output_w (KBD_CMD_SET_RATE); + if (kbd_wait_for_input () != KBD_REPLY_ACK) return "Kbd: Set rate: no ACK"; - kbd_write_output_w(0x00); - if (kbd_wait_for_input() != KBD_REPLY_ACK) + kbd_write_output_w (0x00); + if (kbd_wait_for_input () != KBD_REPLY_ACK) return "Kbd: Set rate: no ACK"; return NULL; } diff --git a/board/MAI/AmigaOneG3SE/start.txt b/board/MAI/AmigaOneG3SE/start.txt index e421462..2526ed2 100644 --- a/board/MAI/AmigaOneG3SE/start.txt +++ b/board/MAI/AmigaOneG3SE/start.txt @@ -39,11 +39,11 @@ DIM0_TIM_CTL_0 = 0x737d737d (0xc9) /* DRAM timing control for dimm0 & dimm1; set wait one clock */ - /* cycle for next data access */ + /* cycle for next data access */ DIM2_TIM_CTL_0 = 0x737d737d (0xca) /* DRAM timing control for dimm2 & dimm3; set wait one clock */ - /* cycle for next data access */ + /* cycle for next data access */ DIM0_BNK0_CTL_0 = BNK0_RAM_SIZ_128MB (0x90) /* set dimm0 bank0 for 128 MB */ diff --git a/board/MAI/AmigaOneG3SE/u-boot.lds b/board/MAI/AmigaOneG3SE/u-boot.lds index 11b28d7..7386ea7 100644 --- a/board/MAI/AmigaOneG3SE/u-boot.lds +++ b/board/MAI/AmigaOneG3SE/u-boot.lds @@ -40,11 +40,11 @@ SECTIONS .dynsym : { *(.dynsym) } .dynstr : { *(.dynstr) } .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } + .rela.text : { *(.rela.text) } .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } + .rela.data : { *(.rela.data) } + .rel.rodata : { *(.rel.rodata) } + .rela.rodata : { *(.rela.rodata) } .rel.got : { *(.rel.got) } .rela.got : { *(.rela.got) } .rel.ctors : { *(.rel.ctors) } diff --git a/board/MAI/AmigaOneG3SE/usb_uhci.c b/board/MAI/AmigaOneG3SE/usb_uhci.c index 14e8043..479beed 100644 --- a/board/MAI/AmigaOneG3SE/usb_uhci.c +++ b/board/MAI/AmigaOneG3SE/usb_uhci.c @@ -522,7 +522,7 @@ void usb_check_int_chain(void) link=swap_32(td_int[i].link) & 0xfffffff0; /* next in chain */ td=(uhci_td_t *)link; /* assign it */ /* all interrupt TDs are finally linked to the td_int[0]. - * so we process all until we find the td_int[0]. + * so we process all until we find the td_int[0]. * if int0 chain points to a QH, we're also done */ while(((i>0) && (link != (unsigned long)&td_int[0])) || diff --git a/board/MAI/AmigaOneG3SE/via686.c b/board/MAI/AmigaOneG3SE/via686.c index 3606db8..2427ce5 100644 --- a/board/MAI/AmigaOneG3SE/via686.c +++ b/board/MAI/AmigaOneG3SE/via686.c @@ -97,7 +97,7 @@ void via_isa_init(pci_dev_t dev, struct pci_config_table *table) pci_write_config_byte(dev, 0x80, 0); pci_write_config_byte(dev, 0x85, 0x01); -/* pci_write_config_byte(dev, 0x77, 0x00); */ +/* pci_write_config_byte(dev, 0x77, 0x00); */ } } @@ -212,7 +212,7 @@ void via_cfgfunc_via686(struct pci_controller *host, pci_dev_t dev, struct pci_c } __asm (" .globl via_calibrate_time_base \n" - "via_calibrate_time_base: \n" + "via_calibrate_time_base: \n" " lis 9, 0xfe00 \n" " li 0, 0x00 \n" " mttbu 0 \n" @@ -262,9 +262,9 @@ void ide_led(uchar led, uchar status) /* unsigned char c = in_byte(0x92); */ /* if (!status) */ -/* out_byte(0x92, c | 0xC0); */ +/* out_byte(0x92, c | 0xC0); */ /* else */ -/* out_byte(0x92, c & ~0xC0); */ +/* out_byte(0x92, c & ~0xC0); */ } diff --git a/board/MAI/menu/menu.h b/board/MAI/menu/menu.h index 8aebb7d..23d89a7 100644 --- a/board/MAI/menu/menu.h +++ b/board/MAI/menu/menu.h @@ -4,15 +4,14 @@ /* A single menu */ typedef void (*menu_finish_callback)(struct menu_s *menu); -typedef struct menu_s -{ - char *name; /* Menu name */ - int num_options; /* Number of options in this menu */ - int flags; /* Various flags - see below */ - int option_align; /* Aligns options to a field width of this much characters if != 0 */ - - struct menu_option_s **options; /* Pointer to this menu's options */ - menu_finish_callback callback; /* Called when the menu closes */ +typedef struct menu_s { + char *name; /* Menu name */ + int num_options; /* Number of options in this menu */ + int flags; /* Various flags - see below */ + int option_align; /* Aligns options to a field width of this much characters if != 0 */ + + struct menu_option_s **options; /* Pointer to this menu's options */ + menu_finish_callback callback; /* Called when the menu closes */ } menu_t; /* @@ -23,13 +22,12 @@ typedef struct menu_s * sys : pointer for system-specific data, init to NULL and don't touch */ -#define OPTION_PREAMBLE \ - int type; \ - char *name; \ - char *help; \ - int id; \ - void *sys; \ - +#define OPTION_PREAMBLE \ + int type; \ + char *name; \ + char *help; \ + int id; \ + void *sys; /* * Menu option types. @@ -110,59 +108,49 @@ typedef struct menu_text_s #define MENU_SELECTION_TYPE 3 -typedef struct menu_select_option_s -{ - char *map_from; /* Map this variable contents ... */ - char *map_to; /* ... to this menu text and vice versa */ +typedef struct menu_select_option_s { + char *map_from; /* Map this variable contents ... */ + char *map_to; /* ... to this menu text and vice versa */ } menu_select_option_t; -typedef struct menu_select_s -{ - OPTION_PREAMBLE - - int num_options; /* Number of mappings */ - menu_select_option_t **options; - /* Option list array */ +typedef struct menu_select_s { + OPTION_PREAMBLE int num_options; /* Number of mappings */ + menu_select_option_t **options; + /* Option list array */ } menu_select_t; #define MENU_ROUTINE_TYPE 4 -typedef void (*menu_routine_callback)(struct menu_routine_s *); +typedef void (*menu_routine_callback) (struct menu_routine_s *); -typedef struct menu_routine_s -{ - OPTION_PREAMBLE - menu_routine_callback callback; - /* routine to be called */ - void *user_data; /* User data, don't care for system */ +typedef struct menu_routine_s { + OPTION_PREAMBLE menu_routine_callback callback; + /* routine to be called */ + void *user_data; /* User data, don't care for system */ } menu_routine_t; #define MENU_CUSTOM_TYPE 5 -typedef void (*menu_custom_draw)(struct menu_custom_s *); -typedef void (*menu_custom_key)(struct menu_custom_s *, int); +typedef void (*menu_custom_draw) (struct menu_custom_s *); +typedef void (*menu_custom_key) (struct menu_custom_s *, int); -typedef struct menu_custom_s -{ - OPTION_PREAMBLE - menu_custom_draw drawfunc; - menu_custom_key keyfunc; - void *user_data; +typedef struct menu_custom_s { + OPTION_PREAMBLE menu_custom_draw drawfunc; + menu_custom_key keyfunc; + void *user_data; } menu_custom_t; /* * The menu option superstructure */ -typedef struct menu_option_s -{ - union - { - menu_submenu_t m_sub_menu; - menu_boolean_t m_boolean; - menu_text_t m_text; - menu_select_t m_select; - menu_routine_t m_routine; - }; +typedef struct menu_option_s { + union { + menu_submenu_t m_sub_menu; + menu_boolean_t m_boolean; + menu_text_t m_text; + menu_select_t m_select; + menu_routine_t m_routine; + }; } menu_option_t; /* Init the menu system. Returns <0 on error */ |