[PATCH] drivers/char/rocket.c: cleanups

This patch contains the following cleanups:
- make needlessly global code static
- remove the TRUE/FALSE macros

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Adrian Bunk and committed by Linus Torvalds f15313bf 681ea4b9

+119 -147
+119 -107
drivers/char/rocket.c
··· 161 UPCI_AIOP_INTR_BIT_3 162 }; 163 164 /* 165 * Line number is the ttySIx number (x), the Minor number. We 166 * assign them sequentially, starting at zero. The following ··· 235 static unsigned char GetLineNumber(int ctrl, int aiop, int ch); 236 static unsigned char SetLineNumber(int ctrl, int aiop, int ch); 237 static void rp_start(struct tty_struct *tty); 238 239 #ifdef MODULE 240 MODULE_AUTHOR("Theodore Ts'o"); ··· 1876 * init's aiopic and serial port hardware. 1877 * Inputs: i is the board number (0-n) 1878 */ 1879 - __init int register_PCI(int i, struct pci_dev *dev) 1880 { 1881 int num_aiops, aiop, max_num_aiops, num_chan, chan; 1882 unsigned int aiopio[MAX_AIOPS_PER_BOARD]; ··· 2531 } 2532 #endif 2533 2534 - #ifndef TRUE 2535 - #define TRUE 1 2536 - #endif 2537 - 2538 - #ifndef FALSE 2539 - #define FALSE 0 2540 - #endif 2541 - 2542 - static Byte_t RData[RDATASIZE] = { 2543 - 0x00, 0x09, 0xf6, 0x82, 2544 - 0x02, 0x09, 0x86, 0xfb, 2545 - 0x04, 0x09, 0x00, 0x0a, 2546 - 0x06, 0x09, 0x01, 0x0a, 2547 - 0x08, 0x09, 0x8a, 0x13, 2548 - 0x0a, 0x09, 0xc5, 0x11, 2549 - 0x0c, 0x09, 0x86, 0x85, 2550 - 0x0e, 0x09, 0x20, 0x0a, 2551 - 0x10, 0x09, 0x21, 0x0a, 2552 - 0x12, 0x09, 0x41, 0xff, 2553 - 0x14, 0x09, 0x82, 0x00, 2554 - 0x16, 0x09, 0x82, 0x7b, 2555 - 0x18, 0x09, 0x8a, 0x7d, 2556 - 0x1a, 0x09, 0x88, 0x81, 2557 - 0x1c, 0x09, 0x86, 0x7a, 2558 - 0x1e, 0x09, 0x84, 0x81, 2559 - 0x20, 0x09, 0x82, 0x7c, 2560 - 0x22, 0x09, 0x0a, 0x0a 2561 - }; 2562 - 2563 - static Byte_t RRegData[RREGDATASIZE] = { 2564 - 0x00, 0x09, 0xf6, 0x82, /* 00: Stop Rx processor */ 2565 - 0x08, 0x09, 0x8a, 0x13, /* 04: Tx software flow control */ 2566 - 0x0a, 0x09, 0xc5, 0x11, /* 08: XON char */ 2567 - 0x0c, 0x09, 0x86, 0x85, /* 0c: XANY */ 2568 - 0x12, 0x09, 0x41, 0xff, /* 10: Rx mask char */ 2569 - 0x14, 0x09, 0x82, 0x00, /* 14: Compare/Ignore #0 */ 2570 - 0x16, 0x09, 0x82, 0x7b, /* 18: Compare #1 */ 2571 - 0x18, 0x09, 0x8a, 0x7d, /* 1c: Compare #2 */ 2572 - 0x1a, 0x09, 0x88, 0x81, /* 20: Interrupt #1 */ 2573 - 0x1c, 0x09, 0x86, 0x7a, /* 24: Ignore/Replace #1 */ 2574 - 0x1e, 0x09, 0x84, 0x81, /* 28: Interrupt #2 */ 2575 - 0x20, 0x09, 0x82, 0x7c, /* 2c: Ignore/Replace #2 */ 2576 - 0x22, 0x09, 0x0a, 0x0a /* 30: Rx FIFO Enable */ 2577 - }; 2578 - 2579 - CONTROLLER_T sController[CTL_SIZE] = { 2580 - {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0}, 2581 - {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}}, 2582 - {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0}, 2583 - {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}}, 2584 - {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0}, 2585 - {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}}, 2586 - {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0}, 2587 - {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}} 2588 - }; 2589 - 2590 - Byte_t sBitMapClrTbl[8] = { 2591 - 0xfe, 0xfd, 0xfb, 0xf7, 0xef, 0xdf, 0xbf, 0x7f 2592 - }; 2593 - 2594 - Byte_t sBitMapSetTbl[8] = { 2595 - 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 2596 - }; 2597 - 2598 - int sClockPrescale = 0x14; 2599 - 2600 /*************************************************************************** 2601 Function: sInitController 2602 Purpose: Initialization of controller global registers and controller ··· 2566 FREQ_4HZ - 4 Hertz 2567 If IRQNum is set to 0 the Frequency parameter is 2568 overidden, it is forced to a value of FREQ_DIS. 2569 - int PeriodicOnly: TRUE if all interrupts except the periodic 2570 interrupt are to be blocked. 2571 - FALSE is both the periodic interrupt and 2572 other channel interrupts are allowed. 2573 If IRQNum is set to 0 the PeriodicOnly parameter is 2574 - overidden, it is forced to a value of FALSE. 2575 Return: int: Number of AIOPs on the controller, or CTLID_NULL if controller 2576 initialization failed. 2577 2578 Comments: 2579 If periodic interrupts are to be disabled but AIOP interrupts 2580 - are allowed, set Frequency to FREQ_DIS and PeriodicOnly to FALSE. 2581 2582 If interrupts are to be completely disabled set IRQNum to 0. 2583 2584 - Setting Frequency to FREQ_DIS and PeriodicOnly to TRUE is an 2585 invalid combination. 2586 2587 This function performs initialization of global interrupt modes, ··· 2601 After this function all AIOPs on the controller are disabled, 2602 they can be enabled with sEnAiop(). 2603 */ 2604 - int sInitController(CONTROLLER_T * CtlP, int CtlNum, ByteIO_t MudbacIO, 2605 - ByteIO_t * AiopIOList, int AiopIOListSize, int IRQNum, 2606 - Byte_t Frequency, int PeriodicOnly) 2607 { 2608 int i; 2609 ByteIO_t io; ··· 2699 FREQ_4HZ - 4 Hertz 2700 If IRQNum is set to 0 the Frequency parameter is 2701 overidden, it is forced to a value of FREQ_DIS. 2702 - int PeriodicOnly: TRUE if all interrupts except the periodic 2703 interrupt are to be blocked. 2704 - FALSE is both the periodic interrupt and 2705 other channel interrupts are allowed. 2706 If IRQNum is set to 0 the PeriodicOnly parameter is 2707 - overidden, it is forced to a value of FALSE. 2708 Return: int: Number of AIOPs on the controller, or CTLID_NULL if controller 2709 initialization failed. 2710 2711 Comments: 2712 If periodic interrupts are to be disabled but AIOP interrupts 2713 - are allowed, set Frequency to FREQ_DIS and PeriodicOnly to FALSE. 2714 2715 If interrupts are to be completely disabled set IRQNum to 0. 2716 2717 - Setting Frequency to FREQ_DIS and PeriodicOnly to TRUE is an 2718 invalid combination. 2719 2720 This function performs initialization of global interrupt modes, ··· 2734 After this function all AIOPs on the controller are disabled, 2735 they can be enabled with sEnAiop(). 2736 */ 2737 - int sPCIInitController(CONTROLLER_T * CtlP, int CtlNum, 2738 - ByteIO_t * AiopIOList, int AiopIOListSize, 2739 - WordIO_t ConfigIO, int IRQNum, Byte_t Frequency, 2740 - int PeriodicOnly, int altChanRingIndicator, 2741 - int UPCIRingInd) 2742 { 2743 int i; 2744 ByteIO_t io; ··· 2796 Warnings: No context switches are allowed while executing this function. 2797 2798 */ 2799 - int sReadAiopID(ByteIO_t io) 2800 { 2801 Byte_t AiopID; /* ID byte from AIOP */ 2802 ··· 2822 AIOP, otherwise it is an 8 channel. 2823 Warnings: No context switches are allowed while executing this function. 2824 */ 2825 - int sReadAiopNumChan(WordIO_t io) 2826 { 2827 Word_t x; 2828 static Byte_t R[4] = { 0x00, 0x00, 0x34, 0x12 }; ··· 2846 CHANNEL_T *ChP; Ptr to channel structure 2847 int AiopNum; AIOP number within controller 2848 int ChanNum; Channel number within AIOP 2849 - Return: int: TRUE if initialization succeeded, FALSE if it fails because channel 2850 number exceeds number of channels available in AIOP. 2851 Comments: This function must be called before a channel can be used. 2852 Warnings: No range checking on any of the parameters is done. 2853 2854 No context switches are allowed while executing this function. 2855 */ 2856 - int sInitChan(CONTROLLER_T * CtlP, CHANNEL_T * ChP, int AiopNum, 2857 - int ChanNum) 2858 { 2859 int i; 2860 WordIO_t AiopIO; ··· 2865 int brd9600; 2866 2867 if (ChanNum >= CtlP->AiopNumChan[AiopNum]) 2868 - return (FALSE); /* exceeds num chans in AIOP */ 2869 2870 /* Channel, AIOP, and controller identifiers */ 2871 ChP->CtlP = CtlP; ··· 2980 ChP->TxPrioBuf = ChOff + _TXP_BUF; 2981 sEnRxProcessor(ChP); /* start the Rx processor */ 2982 2983 - return (TRUE); 2984 } 2985 2986 /*************************************************************************** ··· 3001 After calling this function a delay of 4 uS is required to ensure 3002 that the receive processor is no longer processing this channel. 3003 */ 3004 - void sStopRxProcessor(CHANNEL_T * ChP) 3005 { 3006 Byte_t R[4]; 3007 ··· 3026 this function. 3027 Warnings: No context switches are allowed while executing this function. 3028 */ 3029 - void sFlushRxFIFO(CHANNEL_T * ChP) 3030 { 3031 int i; 3032 Byte_t Ch; /* channel number within AIOP */ 3033 - int RxFIFOEnabled; /* TRUE if Rx FIFO enabled */ 3034 3035 if (sGetRxCnt(ChP) == 0) /* Rx FIFO empty */ 3036 return; /* don't need to flush */ 3037 3038 - RxFIFOEnabled = FALSE; 3039 if (ChP->R[0x32] == 0x08) { /* Rx FIFO is enabled */ 3040 - RxFIFOEnabled = TRUE; 3041 sDisRxFIFO(ChP); /* disable it */ 3042 for (i = 0; i < 2000 / 200; i++) /* delay 2 uS to allow proc to disable FIFO */ 3043 sInB(ChP->IntChan); /* depends on bus i/o timing */ ··· 3068 this function. 3069 Warnings: No context switches are allowed while executing this function. 3070 */ 3071 - void sFlushTxFIFO(CHANNEL_T * ChP) 3072 { 3073 int i; 3074 Byte_t Ch; /* channel number within AIOP */ 3075 - int TxEnabled; /* TRUE if transmitter enabled */ 3076 3077 if (sGetTxCnt(ChP) == 0) /* Tx FIFO empty */ 3078 return; /* don't need to flush */ 3079 3080 - TxEnabled = FALSE; 3081 if (ChP->TxControl[3] & TX_ENABLE) { 3082 - TxEnabled = TRUE; 3083 sDisTransmit(ChP); /* disable transmitter */ 3084 } 3085 sStopRxProcessor(ChP); /* stop Rx processor */ ··· 3108 3109 Warnings: No context switches are allowed while executing this function. 3110 */ 3111 - int sWriteTxPrioByte(CHANNEL_T * ChP, Byte_t Data) 3112 { 3113 Byte_t DWBuf[4]; /* buffer for double word writes */ 3114 Word_t *WordPtr; /* must be far because Win SS != DS */ ··· 3170 enable channel interrupts. This would allow the global interrupt 3171 status register to be used to determine which AIOPs need service. 3172 */ 3173 - void sEnInterrupts(CHANNEL_T * ChP, Word_t Flags) 3174 { 3175 Byte_t Mask; /* Interrupt Mask Register */ 3176 ··· 3214 this channel's bit from being set in the AIOP's Interrupt Channel 3215 Register. 3216 */ 3217 - void sDisInterrupts(CHANNEL_T * ChP, Word_t Flags) 3218 { 3219 Byte_t Mask; /* Interrupt Mask Register */ 3220 ··· 3230 } 3231 } 3232 3233 - void sSetInterfaceMode(CHANNEL_T * ChP, Byte_t mode) 3234 { 3235 sOutB(ChP->CtlP->AiopIO[2], (mode & 0x18) | ChP->ChanNum); 3236 } ··· 3239 * Not an official SSCI function, but how to reset RocketModems. 3240 * ISA bus version 3241 */ 3242 - void sModemReset(CONTROLLER_T * CtlP, int chan, int on) 3243 { 3244 ByteIO_t addr; 3245 Byte_t val; ··· 3264 * Not an official SSCI function, but how to reset RocketModems. 3265 * PCI bus version 3266 */ 3267 - void sPCIModemReset(CONTROLLER_T * CtlP, int chan, int on) 3268 { 3269 ByteIO_t addr; 3270
··· 161 UPCI_AIOP_INTR_BIT_3 162 }; 163 164 + static Byte_t RData[RDATASIZE] = { 165 + 0x00, 0x09, 0xf6, 0x82, 166 + 0x02, 0x09, 0x86, 0xfb, 167 + 0x04, 0x09, 0x00, 0x0a, 168 + 0x06, 0x09, 0x01, 0x0a, 169 + 0x08, 0x09, 0x8a, 0x13, 170 + 0x0a, 0x09, 0xc5, 0x11, 171 + 0x0c, 0x09, 0x86, 0x85, 172 + 0x0e, 0x09, 0x20, 0x0a, 173 + 0x10, 0x09, 0x21, 0x0a, 174 + 0x12, 0x09, 0x41, 0xff, 175 + 0x14, 0x09, 0x82, 0x00, 176 + 0x16, 0x09, 0x82, 0x7b, 177 + 0x18, 0x09, 0x8a, 0x7d, 178 + 0x1a, 0x09, 0x88, 0x81, 179 + 0x1c, 0x09, 0x86, 0x7a, 180 + 0x1e, 0x09, 0x84, 0x81, 181 + 0x20, 0x09, 0x82, 0x7c, 182 + 0x22, 0x09, 0x0a, 0x0a 183 + }; 184 + 185 + static Byte_t RRegData[RREGDATASIZE] = { 186 + 0x00, 0x09, 0xf6, 0x82, /* 00: Stop Rx processor */ 187 + 0x08, 0x09, 0x8a, 0x13, /* 04: Tx software flow control */ 188 + 0x0a, 0x09, 0xc5, 0x11, /* 08: XON char */ 189 + 0x0c, 0x09, 0x86, 0x85, /* 0c: XANY */ 190 + 0x12, 0x09, 0x41, 0xff, /* 10: Rx mask char */ 191 + 0x14, 0x09, 0x82, 0x00, /* 14: Compare/Ignore #0 */ 192 + 0x16, 0x09, 0x82, 0x7b, /* 18: Compare #1 */ 193 + 0x18, 0x09, 0x8a, 0x7d, /* 1c: Compare #2 */ 194 + 0x1a, 0x09, 0x88, 0x81, /* 20: Interrupt #1 */ 195 + 0x1c, 0x09, 0x86, 0x7a, /* 24: Ignore/Replace #1 */ 196 + 0x1e, 0x09, 0x84, 0x81, /* 28: Interrupt #2 */ 197 + 0x20, 0x09, 0x82, 0x7c, /* 2c: Ignore/Replace #2 */ 198 + 0x22, 0x09, 0x0a, 0x0a /* 30: Rx FIFO Enable */ 199 + }; 200 + 201 + static CONTROLLER_T sController[CTL_SIZE] = { 202 + {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0}, 203 + {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}}, 204 + {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0}, 205 + {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}}, 206 + {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0}, 207 + {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}}, 208 + {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0}, 209 + {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}} 210 + }; 211 + 212 + static Byte_t sBitMapClrTbl[8] = { 213 + 0xfe, 0xfd, 0xfb, 0xf7, 0xef, 0xdf, 0xbf, 0x7f 214 + }; 215 + 216 + static Byte_t sBitMapSetTbl[8] = { 217 + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 218 + }; 219 + 220 + static int sClockPrescale = 0x14; 221 + 222 /* 223 * Line number is the ttySIx number (x), the Minor number. We 224 * assign them sequentially, starting at zero. The following ··· 177 static unsigned char GetLineNumber(int ctrl, int aiop, int ch); 178 static unsigned char SetLineNumber(int ctrl, int aiop, int ch); 179 static void rp_start(struct tty_struct *tty); 180 + static int sInitChan(CONTROLLER_T * CtlP, CHANNEL_T * ChP, int AiopNum, 181 + int ChanNum); 182 + static void sSetInterfaceMode(CHANNEL_T * ChP, Byte_t mode); 183 + static void sFlushRxFIFO(CHANNEL_T * ChP); 184 + static void sFlushTxFIFO(CHANNEL_T * ChP); 185 + static void sEnInterrupts(CHANNEL_T * ChP, Word_t Flags); 186 + static void sDisInterrupts(CHANNEL_T * ChP, Word_t Flags); 187 + static void sModemReset(CONTROLLER_T * CtlP, int chan, int on); 188 + static void sPCIModemReset(CONTROLLER_T * CtlP, int chan, int on); 189 + static int sWriteTxPrioByte(CHANNEL_T * ChP, Byte_t Data); 190 + static int sPCIInitController(CONTROLLER_T * CtlP, int CtlNum, 191 + ByteIO_t * AiopIOList, int AiopIOListSize, 192 + WordIO_t ConfigIO, int IRQNum, Byte_t Frequency, 193 + int PeriodicOnly, int altChanRingIndicator, 194 + int UPCIRingInd); 195 + static int sInitController(CONTROLLER_T * CtlP, int CtlNum, ByteIO_t MudbacIO, 196 + ByteIO_t * AiopIOList, int AiopIOListSize, 197 + int IRQNum, Byte_t Frequency, int PeriodicOnly); 198 + static int sReadAiopID(ByteIO_t io); 199 + static int sReadAiopNumChan(WordIO_t io); 200 201 #ifdef MODULE 202 MODULE_AUTHOR("Theodore Ts'o"); ··· 1798 * init's aiopic and serial port hardware. 1799 * Inputs: i is the board number (0-n) 1800 */ 1801 + static __init int register_PCI(int i, struct pci_dev *dev) 1802 { 1803 int num_aiops, aiop, max_num_aiops, num_chan, chan; 1804 unsigned int aiopio[MAX_AIOPS_PER_BOARD]; ··· 2453 } 2454 #endif 2455 2456 /*************************************************************************** 2457 Function: sInitController 2458 Purpose: Initialization of controller global registers and controller ··· 2554 FREQ_4HZ - 4 Hertz 2555 If IRQNum is set to 0 the Frequency parameter is 2556 overidden, it is forced to a value of FREQ_DIS. 2557 + int PeriodicOnly: 1 if all interrupts except the periodic 2558 interrupt are to be blocked. 2559 + 0 is both the periodic interrupt and 2560 other channel interrupts are allowed. 2561 If IRQNum is set to 0 the PeriodicOnly parameter is 2562 + overidden, it is forced to a value of 0. 2563 Return: int: Number of AIOPs on the controller, or CTLID_NULL if controller 2564 initialization failed. 2565 2566 Comments: 2567 If periodic interrupts are to be disabled but AIOP interrupts 2568 + are allowed, set Frequency to FREQ_DIS and PeriodicOnly to 0. 2569 2570 If interrupts are to be completely disabled set IRQNum to 0. 2571 2572 + Setting Frequency to FREQ_DIS and PeriodicOnly to 1 is an 2573 invalid combination. 2574 2575 This function performs initialization of global interrupt modes, ··· 2589 After this function all AIOPs on the controller are disabled, 2590 they can be enabled with sEnAiop(). 2591 */ 2592 + static int sInitController(CONTROLLER_T * CtlP, int CtlNum, ByteIO_t MudbacIO, 2593 + ByteIO_t * AiopIOList, int AiopIOListSize, 2594 + int IRQNum, Byte_t Frequency, int PeriodicOnly) 2595 { 2596 int i; 2597 ByteIO_t io; ··· 2687 FREQ_4HZ - 4 Hertz 2688 If IRQNum is set to 0 the Frequency parameter is 2689 overidden, it is forced to a value of FREQ_DIS. 2690 + int PeriodicOnly: 1 if all interrupts except the periodic 2691 interrupt are to be blocked. 2692 + 0 is both the periodic interrupt and 2693 other channel interrupts are allowed. 2694 If IRQNum is set to 0 the PeriodicOnly parameter is 2695 + overidden, it is forced to a value of 0. 2696 Return: int: Number of AIOPs on the controller, or CTLID_NULL if controller 2697 initialization failed. 2698 2699 Comments: 2700 If periodic interrupts are to be disabled but AIOP interrupts 2701 + are allowed, set Frequency to FREQ_DIS and PeriodicOnly to 0. 2702 2703 If interrupts are to be completely disabled set IRQNum to 0. 2704 2705 + Setting Frequency to FREQ_DIS and PeriodicOnly to 1 is an 2706 invalid combination. 2707 2708 This function performs initialization of global interrupt modes, ··· 2722 After this function all AIOPs on the controller are disabled, 2723 they can be enabled with sEnAiop(). 2724 */ 2725 + static int sPCIInitController(CONTROLLER_T * CtlP, int CtlNum, 2726 + ByteIO_t * AiopIOList, int AiopIOListSize, 2727 + WordIO_t ConfigIO, int IRQNum, Byte_t Frequency, 2728 + int PeriodicOnly, int altChanRingIndicator, 2729 + int UPCIRingInd) 2730 { 2731 int i; 2732 ByteIO_t io; ··· 2784 Warnings: No context switches are allowed while executing this function. 2785 2786 */ 2787 + static int sReadAiopID(ByteIO_t io) 2788 { 2789 Byte_t AiopID; /* ID byte from AIOP */ 2790 ··· 2810 AIOP, otherwise it is an 8 channel. 2811 Warnings: No context switches are allowed while executing this function. 2812 */ 2813 + static int sReadAiopNumChan(WordIO_t io) 2814 { 2815 Word_t x; 2816 static Byte_t R[4] = { 0x00, 0x00, 0x34, 0x12 }; ··· 2834 CHANNEL_T *ChP; Ptr to channel structure 2835 int AiopNum; AIOP number within controller 2836 int ChanNum; Channel number within AIOP 2837 + Return: int: 1 if initialization succeeded, 0 if it fails because channel 2838 number exceeds number of channels available in AIOP. 2839 Comments: This function must be called before a channel can be used. 2840 Warnings: No range checking on any of the parameters is done. 2841 2842 No context switches are allowed while executing this function. 2843 */ 2844 + static int sInitChan(CONTROLLER_T * CtlP, CHANNEL_T * ChP, int AiopNum, 2845 + int ChanNum) 2846 { 2847 int i; 2848 WordIO_t AiopIO; ··· 2853 int brd9600; 2854 2855 if (ChanNum >= CtlP->AiopNumChan[AiopNum]) 2856 + return 0; /* exceeds num chans in AIOP */ 2857 2858 /* Channel, AIOP, and controller identifiers */ 2859 ChP->CtlP = CtlP; ··· 2968 ChP->TxPrioBuf = ChOff + _TXP_BUF; 2969 sEnRxProcessor(ChP); /* start the Rx processor */ 2970 2971 + return 1; 2972 } 2973 2974 /*************************************************************************** ··· 2989 After calling this function a delay of 4 uS is required to ensure 2990 that the receive processor is no longer processing this channel. 2991 */ 2992 + static void sStopRxProcessor(CHANNEL_T * ChP) 2993 { 2994 Byte_t R[4]; 2995 ··· 3014 this function. 3015 Warnings: No context switches are allowed while executing this function. 3016 */ 3017 + static void sFlushRxFIFO(CHANNEL_T * ChP) 3018 { 3019 int i; 3020 Byte_t Ch; /* channel number within AIOP */ 3021 + int RxFIFOEnabled; /* 1 if Rx FIFO enabled */ 3022 3023 if (sGetRxCnt(ChP) == 0) /* Rx FIFO empty */ 3024 return; /* don't need to flush */ 3025 3026 + RxFIFOEnabled = 0; 3027 if (ChP->R[0x32] == 0x08) { /* Rx FIFO is enabled */ 3028 + RxFIFOEnabled = 1; 3029 sDisRxFIFO(ChP); /* disable it */ 3030 for (i = 0; i < 2000 / 200; i++) /* delay 2 uS to allow proc to disable FIFO */ 3031 sInB(ChP->IntChan); /* depends on bus i/o timing */ ··· 3056 this function. 3057 Warnings: No context switches are allowed while executing this function. 3058 */ 3059 + static void sFlushTxFIFO(CHANNEL_T * ChP) 3060 { 3061 int i; 3062 Byte_t Ch; /* channel number within AIOP */ 3063 + int TxEnabled; /* 1 if transmitter enabled */ 3064 3065 if (sGetTxCnt(ChP) == 0) /* Tx FIFO empty */ 3066 return; /* don't need to flush */ 3067 3068 + TxEnabled = 0; 3069 if (ChP->TxControl[3] & TX_ENABLE) { 3070 + TxEnabled = 1; 3071 sDisTransmit(ChP); /* disable transmitter */ 3072 } 3073 sStopRxProcessor(ChP); /* stop Rx processor */ ··· 3096 3097 Warnings: No context switches are allowed while executing this function. 3098 */ 3099 + static int sWriteTxPrioByte(CHANNEL_T * ChP, Byte_t Data) 3100 { 3101 Byte_t DWBuf[4]; /* buffer for double word writes */ 3102 Word_t *WordPtr; /* must be far because Win SS != DS */ ··· 3158 enable channel interrupts. This would allow the global interrupt 3159 status register to be used to determine which AIOPs need service. 3160 */ 3161 + static void sEnInterrupts(CHANNEL_T * ChP, Word_t Flags) 3162 { 3163 Byte_t Mask; /* Interrupt Mask Register */ 3164 ··· 3202 this channel's bit from being set in the AIOP's Interrupt Channel 3203 Register. 3204 */ 3205 + static void sDisInterrupts(CHANNEL_T * ChP, Word_t Flags) 3206 { 3207 Byte_t Mask; /* Interrupt Mask Register */ 3208 ··· 3218 } 3219 } 3220 3221 + static void sSetInterfaceMode(CHANNEL_T * ChP, Byte_t mode) 3222 { 3223 sOutB(ChP->CtlP->AiopIO[2], (mode & 0x18) | ChP->ChanNum); 3224 } ··· 3227 * Not an official SSCI function, but how to reset RocketModems. 3228 * ISA bus version 3229 */ 3230 + static void sModemReset(CONTROLLER_T * CtlP, int chan, int on) 3231 { 3232 ByteIO_t addr; 3233 Byte_t val; ··· 3252 * Not an official SSCI function, but how to reset RocketModems. 3253 * PCI bus version 3254 */ 3255 + static void sPCIModemReset(CONTROLLER_T * CtlP, int chan, int on) 3256 { 3257 ByteIO_t addr; 3258
-40
drivers/char/rocket_int.h
··· 1130 */ 1131 #define sWriteTxByte(IO,DATA) sOutB(IO,DATA) 1132 1133 - int sInitController(CONTROLLER_T * CtlP, 1134 - int CtlNum, 1135 - ByteIO_t MudbacIO, 1136 - ByteIO_t * AiopIOList, 1137 - int AiopIOListSize, 1138 - int IRQNum, Byte_t Frequency, int PeriodicOnly); 1139 - 1140 - int sPCIInitController(CONTROLLER_T * CtlP, 1141 - int CtlNum, 1142 - ByteIO_t * AiopIOList, 1143 - int AiopIOListSize, 1144 - WordIO_t ConfigIO, 1145 - int IRQNum, 1146 - Byte_t Frequency, 1147 - int PeriodicOnly, 1148 - int altChanRingIndicator, int UPCIRingInd); 1149 - 1150 - int sReadAiopID(ByteIO_t io); 1151 - int sReadAiopNumChan(WordIO_t io); 1152 - int sInitChan(CONTROLLER_T * CtlP, 1153 - CHANNEL_T * ChP, int AiopNum, int ChanNum); 1154 - Byte_t sGetRxErrStatus(CHANNEL_T * ChP); 1155 - void sStopRxProcessor(CHANNEL_T * ChP); 1156 - void sStopSWInFlowCtl(CHANNEL_T * ChP); 1157 - void sFlushRxFIFO(CHANNEL_T * ChP); 1158 - void sFlushTxFIFO(CHANNEL_T * ChP); 1159 - int sWriteTxPrioByte(CHANNEL_T * ChP, Byte_t Data); 1160 - void sEnInterrupts(CHANNEL_T * ChP, Word_t Flags); 1161 - void sDisInterrupts(CHANNEL_T * ChP, Word_t Flags); 1162 - void sModemReset(CONTROLLER_T * CtlP, int chan, int on); 1163 - void sPCIModemReset(CONTROLLER_T * CtlP, int chan, int on); 1164 - void sSetInterfaceMode(CHANNEL_T * ChP, Byte_t mode); 1165 - 1166 - extern Byte_t R[RDATASIZE]; 1167 - extern CONTROLLER_T sController[CTL_SIZE]; 1168 - extern Byte_t sIRQMap[16]; 1169 - extern Byte_t sBitMapClrTbl[8]; 1170 - extern Byte_t sBitMapSetTbl[8]; 1171 - extern int sClockPrescale; 1172 - 1173 /* 1174 * Begin Linux specific definitions for the Rocketport driver 1175 *
··· 1130 */ 1131 #define sWriteTxByte(IO,DATA) sOutB(IO,DATA) 1132 1133 /* 1134 * Begin Linux specific definitions for the Rocketport driver 1135 *