source: rtems/c/src/lib/libbsp/sparc/shared/can/occan_pci.c @ 44b06ca

4.104.115
Last change on this file since 44b06ca was 44b06ca, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/29/09 at 15:33:28

Whitespace removal.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1
2/* PCI cannot do byte accesses to addresses aligned byte wise
3 * Use alternative reg map.
4 */
5#define OCCAN_WORD_REGS
6
7/* Set registered device name */
8#define OCCAN_DEVNAME "/dev/occanpci0"
9#define OCCAN_DEVNAME_NO(devstr,no) ((devstr)[13]='0'+(no))
10
11/* Any non-static function will begin with */
12#define OCCAN_PREFIX(name) occanpci##name
13
14/* do nothing, assume that the interrupt handler is called
15 * setup externally calling b1553_interrupt_handler.
16 */
17#define OCCAN_REG_INT(handler,irq,arg) \
18 if ( occan_pci_int_reg ) \
19   occan_pci_int_reg(handler,irq,arg);
20
21void (*occan_pci_int_reg)(void *handler, int irq, void *arg) = 0;
22
23void occanpci_interrupt_handler(int irq, void *arg);
24
25/* AMBA Bus is clocked using the PCI clock (33.3MHz) */
26#define SYS_FREQ_HZ 33333333
27
28/* Enable two redundant channels */
29#define REDUNDANT_CHANNELS 2
30
31#define OCCAN_SET_CHANNEL(priv,channel) occanpci_set_channel(priv,channel)
32
33#include "occan.c"
34
35/* Define method that sets redundant channel
36 * The channel select register:
37 *  0x00 = byte regs
38 *  0x40 = channel select
39 *  0x80 = word regs
40 */
41static void inline occanpci_set_channel(occan_priv *priv, int channel){
42        unsigned int *chan_sel = (unsigned int *)(((unsigned int)priv->regs & ~0xff)+0x40);
43        if ( channel == 0 )
44          *chan_sel = 0;
45        else
46                *chan_sel = 0xffffffff;
47}
48
49int occan_pci_register(amba_confarea_type *bus)
50{
51        /* Setup configuration */
52
53        /* Register the driver */
54        return OCCAN_PREFIX(_register)(bus);
55}
56
57
58/* Call this from PCI interrupt handler
59 * irq = the irq number of the HW device local to that IRQMP controller
60 *
61 */
62void occanpci_interrupt_handler(int irq, void *arg){
63        occan_interrupt(arg);
64}
Note: See TracBrowser for help on using the repository browser.