void sysSerialHwInit2(void) { for (uint32_t i = 0; i < ARRAY_SIZE(stm32f1xxUartChan); i++) { intConnect(uartParas[i].intid, stm32f1xxUartInt, (uint32_t)&stm32f1xxUartChan[i]); intEnable(uartParas[i].intid); } }
INLINE void vmeio_int_attach(const DWORD base_adr, DWORD base_vect, int intnum, void (*isr) (void)) /**************************************************************\ Purpose: Book an ISR for a bitwise set of interrupt input (0xff). The interrupt vector is then the VECTOR_BASE+intnum Input: DWORD * base_addr : base address of the VMEIO DWORD base_vect : base vector of the module DWORD intnum : interrupt number (0:7) DWORD isr_routine : interrupt routine pointer Output: none Function value: none \**************************************************************/ { vmeio_int_clear(base_adr); /* clear any pending front panel interrupts */ vmeio_int_disable(base_adr, intnum); /* bitwise input */ #ifdef OS_VXWORKS if (intnum < 8) intConnect(INUM_TO_IVEC(base_vect + intnum), (VOIDFUNCPTR) isr, intnum); #else printf("vector : 0x%x\n", base_vect + intnum); #endif vmeio_int_enable(base_adr, intnum); /* bitwise input */ }
// ADC初始化 void adc_init(void) { SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC); //使能ADC模块 SysCtlADCSpeedSet(SYSCTL_ADCSPEED_500KSPS); //设置ADC采样速率 ADCSequenceDisable(ADC_BASE, 0); // 配置前先禁止采样序列 ADCSequenceConfigure(ADC_BASE, 0, ADC_TRIGGER_PROCESSOR, 0); //配置ADC采样序列的触发事件和优先级:ADC基址,采样序列编号,触发事件,采样优先级 ADCSequenceStepConfigure(ADC_BASE, 0, 0, ADC_CTL_END | ADC_CTL_CH0 | ADC_CTL_IE); //配置ADC采样序列发生器的步进 :ADC基址,采样序列编号,步值,通道设置 intConnect(INT_ADC0, ADC_Sequence_0_ISR, 0u); ADCIntEnable(ADC_BASE, 0); //使能ADC采样序列的中断 // IntEnable(INT_ADC0); // 使能ADC采样序列中断 intEnable(INT_ADC0); IntMasterEnable(); // 使能处理器中断 ADCSequenceEnable(ADC_BASE, 0); // 使能一个ADC采样序列 the_lock = semBCreate(0); // printf("%x\n", the_lock); }
/* * * vxDevDisconnectInterruptVME() * * wrapper to minimize driver dependency on vxWorks * * The parameter pFunction should be set to the C function pointer that * was connected. It is used as a key to prevent a driver from removing * an interrupt handler that was installed by another driver * */ static long vxDevDisconnectInterruptVME ( unsigned vectorNumber, void (*pFunction)() ) { void (*psub)(); int status; # if CPU_FAMILY == PPC return S_dev_vecInstlFail; # endif /* * If pFunction not connected to this vector * then they are probably disconnecting from the wrong vector */ psub = isrFetch(vectorNumber); if(psub != pFunction){ return S_dev_vectorNotInUse; } status = intConnect( (void *)INUM_TO_IVEC(vectorNumber), unsolicitedHandlerEPICS, (int) vectorNumber); if(status<0){ return S_dev_vecInstlFail; } return 0; }
STATUS pciIntConnect (VOIDFUNCPTR *vector, VOIDFUNCPTR routine, int parameter) { static int alreadyConnected=FALSE; int irq = IVEC_TO_INUM ((int)vector) - sysVectorIRQ0; PCI_INT_RTN *pRtn; int oldLevel; pRtn = (PCI_INT_RTN *)malloc (sizeof (PCI_INT_RTN)); if (pRtn == NULL) { return (ERROR); } pRtn->routine = routine; pRtn->parameter = parameter; oldLevel = intLock (); /* LOCK INTERRUPT */ dllAdd (&pciIntList[irq], &pRtn->node); intUnlock (oldLevel); /* UNLOCK INTERRUPT */ if (!alreadyConnected) { if (intConnect(vector, (VOIDFUNCPTR) pciInt, irq) == ERROR) { return -1; } alreadyConnected=TRUE; } return (OK); }
STATUS pcmciaInit (void) { PCMCIA_CTRL *pCtrl = &pcmciaCtrl; PCMCIA_CHIP *pChip = &pCtrl->chip; PCMCIA_CARD *pCard; PCMCIA_ADAPTER *pAdapter = NULL; int sock; int ix; pcmciaMsgQId = msgQCreate (PCMCIA_MAX_MSGS, sizeof(PCMCIA_MSG), MSG_Q_FIFO); if (pcmciaMsgQId == NULL) return (ERROR); pcmciadId = taskSpawn ("tPcmciad", pcmciadPriority, pcmciadOptions, pcmciadStackSize, (FUNCPTR) pcmciad, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); if (pcmciadId == ERROR) return (ERROR); for (ix = 0; ix < pcmciaAdapterNumEnt; ix++) { pAdapter = &pcmciaAdapter[ix]; if ((* pAdapter->initRtn) (pAdapter->ioBase, pAdapter->intVec, pAdapter->intLevel, pAdapter->showRtn) == OK) break; } if (ix >= pcmciaAdapterNumEnt) return (ERROR); semMInit (&cisMuteSem, SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE); (void) intConnect ((VOIDFUNCPTR *)INUM_TO_IVEC(pAdapter->intVec), (VOIDFUNCPTR)pcmciaCscIntr, 0); if (pCtrl->socks != 0) /* if explicitely defined, use it */ pChip->socks = pCtrl->socks; for (sock = 0; sock < pChip->socks; sock++) { pCard = &pCtrl->card[sock]; if ((pCard->cardStatus = (* pChip->status) (sock)) & PC_IS_CARD) (void) cisGet (sock); (void) (* pChip->cscPoll) (sock); (void) (* pChip->cscOn) (sock, pChip->intLevel); } sysIntEnablePIC (pAdapter->intLevel); return (OK); }
void sysHwInit2 (void) { static BOOL initialized = FALSE; // volatile UINT32 tempData; if (initialized) { return; } #ifdef _WRS_CONFIG_SMP /* enable the snoop control unit */ *(UINT32 *)(PBXA9_SCU_CTRL) = PBXA9_SCU_CTRL_EN; #endif /* _WRS_CONFIG_SMP */ intLibInit(INT_LVL_MAX,INT_LVL_MAX,INT_MODE); armGicCtlInit(); (void)intConnect ((VOIDFUNCPTR*)INT_LVL_SYSTIMER, sysClkInt, 0); //(void)intConnect (INUM_TO_IVEC (AUX_TIMER_INT_LVL), sysAuxClkInt, 0); #ifdef INCLUDE_TTY_DEV sysSerialHwInit2 (); #endif initialized = TRUE; }
/************ INLINE function for General command ***********/ INLINE void sis3803_int_detach(const DWORD base_adr, DWORD base_vect, int level) /**************************************************************\ Purpose: Unbook an ISR for a bitwise set of interrupt input (0xff). The interrupt vector is then the VECTOR_BASE+intnum Input: DWORD * base_addr : base address of the sis3803 DWORD base_vect : base vector of the module int level : IRQ level (1..7) Output: none Function value: none \**************************************************************/ { /* disable all IRQ sources */ /* Should be done but not in detach sis3803_int_source(base_adr , DISABLE_IRQ_DI_BS0 | DISABLE_IRQ_DI_BS1 | DISABLE_IRQ_DI_BS2); */ #ifdef OS_VXWORKS /* Suppose to save the default isr before attach but would * required isr table in case of multiple IRQ * for now restore with myStub() */ intConnect(INUM_TO_IVEC(base_vect), (VOIDFUNCPTR) myStub_sis3803, 0); sysIntDisable(level); /* interrupt level */ #else printf("vector : 0x%x\n", base_vect + intnum); #endif }
void sysSerialHwInit2(void) { uint32_t i; // 串口 for (i = 0; i < ARRAY_SIZE(lm811UartChan); i++){ intConnect(uartParas[i].intid, lm811UartInt, (uint32_t)&lm811UartChan[i]); intEnable(uartParas[i].intid); } }
void sysSerialHwInit2 (void) { int i; for (i = 0; i < AMBA_UART_CHANNELS_NUM; i++) { (void)intConnect (INUM_TO_IVEC(dev_paras[i].vector), balongv7r2_uart_irq_handler, (int) &amba_chan[i] ); (void)intEnable ((int)dev_paras[i].int_level); } }
void Tmr_TickInit (void) { pLgeTimer0->clear = 1; /* Enable Timer #0 for uC/OS-II Tick Interrupts */ pLgeTimer0->load = SYS_TIMER_CLK / OS_TICKS_PER_SEC; pLgeTimer0->control = TMRCTRL_ENABLE | TMRCTRL_MODE_PERIODIC | TMRCTRL_PRESCALE16 | TMRCTRL_COUNTER32; #if 1 intConnect(INT_LVL_TIMER_0, (PFNCT)Tmr_TickISR, 0, "tick"); #else fastintConnect(INT_LVL_TIMER_0, (PFNCT)Tmr_TickISR, 0, "tick"); #endif intEnable(INT_LVL_TIMER_0); }
void main (void) { unsigned char tempOut; /* Connect interrupt service routine to vector and all stuff */ intConnect (INUM_TO_IVEC(aioIntNum), my_ISR, aioIntNum); sysIntEnablePIC (aioIRQNum); /* Enable interrupts on the aio: * All interrupts and interrupt from counter 1 too */ tempOut = 0x24; sysOutByte (aioBase + intEnAddress, tempOut); /* Start counter 1 as timer with 50 ms period * It has a clock input of 1 MHz = 1 µs * Therefore the load value is 0xC350 = 50000 */ tempOut = 0x74; sysOutByte (aioBase + cntCntrlReg, tempOut); tempOut = 0x50; sysOutByte (aioBase + cnt1Address, tempOut); tempOut = 0xC3; sysOutByte (aioBase + cnt1Address, tempOut); /* Add your code here: create tasks, semaphores, ... */ //printf("Hello World!"); /*The second task shall do the following: * - It starts counter a as an auto-reload timer with a period of 50 ms. * - The interrupt generated by this counter activates the task. * This shall be done with a semaphore. * - The task reads the analog inputs of both the potentiometer and the temperature. * - If the values have changed compared to the previous ones, these shall be written into global * variables (AIn). * - A hysteresis of e.g. 10 – 20 bit is necessary due to the noise of the analog inputs. * * */ initHardware(0); int readTask; readTask = taskSpawn("tRead", 101, 0, 0x1000, (FUNCPTR) tRead,0,0,0,0,0,0,0,0,0,0); timIntSem = semBCreate(SEM_Q_PRIORITY, SEM_EMPTY); /* The third task shall do the following: * - It writes the values of the global variables (AIn) onto the display. * - This shall happen approx. each 100 ms */ int writeTask; writeTask = taskSpawn("tWrite",102,0,0x1000, (FUNCPTR) tWrite,0,0,0,0,0,0,0,0,0,0); /* Suspend own task */ taskSuspend (0); //suspended sich selber } /* main */
/****************************************************************************** ** Function: CFE_PSP_Init1HzTone() ** ** Purpose: ** Initializes the 1Hz Tone interrupt ** ** Arguments: ** ** Return: ** */ void CFE_PSP_Init1HzTone() { uint32 val; uint32 tone1HzPin = (1 << 7); /* GPIO0_7 */ val = am335xInLong (AM335X_GPIO0_BASE + AM335X_GPIO_IRQSTATUS_SET1); am335xOutLong (AM335X_GPIO0_BASE + AM335X_GPIO_IRQSTATUS_SET1, val | tone1HzPin); val = am335xInLong (AM335X_GPIO0_BASE + AM335X_GPIO_RISINGDETECT); am335xOutLong (AM335X_GPIO0_BASE + AM335X_GPIO_RISINGDETECT, val | tone1HzPin); intConnect((VOIDFUNCPTR *)INUM_TO_IVEC (AM335X_GPIOINT0B), CFE_PSP_ToneISR, 0); intEnable(AM335X_GPIOINT0B); }
/** ****************************************************************************** * @brief intLibInit - 中断初始化 * @param[in] None * @param[out] None * @retval None * * @details * * @note ****************************************************************************** */ extern void intLibInit(void) { uint32_t int_num; // 初始化中断表 for (int_num = 16; int_num < INT_COUNT; int_num++) { intConnect(int_num, dummy, (uint32_t)NULL); } // 使能BusFault、memFault、usgFault CPU_REG_NVIC_SHCSR |= CPU_REG_NVIC_SHCSR_BUSFAULTENA | CPU_REG_NVIC_SHCSR_MEMFAULTENA | CPU_REG_NVIC_SHCSR_USGFAULTENA; }
void init(void) { int tacheSynchID; mailBox = msgQCreate( 2, 4, MSG_Q_FIFO); if (mailBox!=NULL) printf("Boite aux lettres créée\n"); else printf("ERREUR\n"); *GPT_IR = 0x1; *GPT_CR = 0x1c3; *GPT_PR = 0x0; *GPT_OCR1 = 24000000; // Initialisation des GPIO pour la broche GPIO9 *IOMUXC1_GPIO9=0x05; *IOMUXC2_GPIO9=0x1B0B0; erreur = intConnect(87, (VOIDFUNCPTR)ITserver, 0); if (erreur !=OK) { printf("ERREUR intConnect\n"); taskDelete(0); } erreur = intEnable(87); if (erreur != OK) { printf("Erreur intEnable\n"); taskDelete(0); } tacheSynchID = taskSpawn(tacheSynch, 100, 0, 5000, (FUNCPTR)tacheSynch, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); taskDelete(0); }
void GPIO_Init(void) { SetGpioConfig(0, 0x8D, GPIO_WRITE); SetGpioConfig(0, 0x72, GPIO_READ); SetGpioConfig(0, 0x02, GPIO_READ | GPIO_INT_EN | GPIO_INT_F_EDGE ); SetGpioConfig(1, 0xC3, GPIO_WRITE); SetGpioIsr(0, 1, IR_handler); intConnect (INT_VEC_GPIO0, (PFNCT)GPIO_ISR, 0, "GPIO0"); intEnable (INT_VEC_GPIO0); GPIO_PowerLEDR(0); GPIO_PowerLEDG(1); GPIO_VcrMute(TRUE); GPIO_MainAudioMute(TRUE); GPIO_DelayedAGCOn(FALSE); //default : Self AGC return; }
/* * devConnectInterruptVME * * wrapper to minimize driver dependency on vxWorks */ static long vxDevConnectInterruptVME ( unsigned vectorNumber, void (*pFunction)(), void *parameter) { int status; if (vxDevInterruptInUseVME(vectorNumber)) { return S_dev_vectorInUse; } status = intConnect( (void *)INUM_TO_IVEC(vectorNumber), pFunction, (int) parameter); if (status<0) { return S_dev_vecInstlFail; } return 0; }
PUBLIC IX_STATUS ixOsalIrqUnbind (UINT32 irqLevel) { /* * disable interrupts for this vector */ if (intDisable (IVEC_TO_INUM (irqLevel)) != OK) { return IX_FAIL; } /* * register a dummy ISR */ if (intConnect ((IxOsalVoidFnVoidPtr *) irqLevel, (IxOsalVoidFnVoidPtr) ixOsalDummyIsr, 0) != OK) { return IX_FAIL; } return IX_SUCCESS; }
/* Wrap the VxWorks intConnect routine. The VRX driver still calls this function with the original VRX ISR and PARAMS. So here we catch the origional VRX driver informations for later use !!! */ LOCAL STATUS MEI_MyIntConnect_Wrap( VOIDFUNCPTR *pIntVector, VOIDFUNCPTR pISRRoutine, int ISRParams) { STATUS ret; int IrqIdx = ((int)pIntVector) / 2; if (IrqIdx > 8) { printf( "ERROR: INT Wrap the intConnect - invalid IRQ %d (max 16)\r\r", (int)pIntVector); return ERROR; } printf("INT Wrap - intConnect\r\n"); /* save the original VRX ISR and call it later */ MEI_MyIsrParams[IrqIdx].MEI_OrgDrvIsr = pISRRoutine; MEI_MyIsrParams[IrqIdx].MEI_OrgIsrParams = ISRParams; /* pre: do own stuff here */ /* now it is time for the intConnect with the own params and ISR */ ret = intConnect( pIntVector, MEI_MyInterruptVxWorks, (int)&MEI_MyIsrParams[IrqIdx]); /* post: do own stuff here */ return ret; }
void sysSerialHwInit2 (void) { int i; AT91DBGUDevInit2( &at91DBGUChan ); for (i = 0; i < N_SIO_CHANNELS; i++) { /* * Connect and enable the interrupt. * We would like to check the return value from this and log a message * if it failed. However, logLib has not been initialised yet, so we * cannot log a message, so there's little point in checking it. * URAT still in quiet state */ (void) intConnect ( INUM_TO_IVEC(devParas[i].vector), AT91UartInt, (UINT32) &at91UartChan[i] ); intEnable (devParas[i].intLevel); AT91UartDevInit2( &at91UartChan[i] ); } }
PUBLIC IX_STATUS ixOsalIrqBind (UINT32 irqLevel, IxOsalVoidFnVoidPtr routine, void *parameter) { #if CPU==SIMSPARCSOLARIS /* * No Irq support in simulation env */ return IX_FAIL; #else if (intConnect ((IxOsalVoidFnVoidPtr *) irqLevel, (IxOsalVoidFnVoidPtr) routine, (int) parameter) != OK) { return IX_FAIL; } intEnable (irqLevel); return IX_SUCCESS; #endif }
int readInputs (void) { unsigned char tempOut; /* Connect interrupt service routine to vector and all stuff */ intConnect (INUM_TO_IVEC(aioIntNum), my_ISR, aioIntNum); sysIntEnablePIC (aioIRQNum); /* Enable interrupts on the aio: * All interrupts and interrupt from counter 1 too */ tempOut = 0x24; sysOutByte (aioBase + intEnAddress, tempOut); /* Start counter 1 as timer with 50 ms period * It has a clock input of 1 MHz = 1 µs * Therefore the load value is 0xC350 = 50000 */ tempOut = 0x74; sysOutByte (aioBase + cntCntrlReg, tempOut); tempOut = 0x50; sysOutByte (aioBase + cnt1Address, tempOut); tempOut = 0xC3; sysOutByte (aioBase + cnt1Address, tempOut); int poti; int temp; int hyst = 15; while(1){ semTake (analogInputs, WAIT_FOREVER); poti = readAnalog (2, 0); temp = readAnalog (5, 2); //printf ("Werte %d %d \n", poti, temp); if ((poti > globalPoti+hyst) | (poti < globalPoti-hyst)) { globalPoti = poti; } if ((temp > globalTemp+hyst) | (temp < globalTemp-hyst)) { globalTemp = temp; } } }
void GPIO_Init(void) { SetGpioConfig(0, 0x8D, GPIO_WRITE); SetGpioConfig(0, 0x72, GPIO_READ); SetGpioConfig(0, 0x02, GPIO_READ | GPIO_INT_EN | GPIO_INT_F_EDGE ); SetGpioConfig(1, 0x43, GPIO_WRITE); SetGpioConfig(1, 0x20, GPIO_WRITE); #if (USE_IR>0) SetGpioIsr(0, 1, IR_handler); #endif /* USE_IR > 0 */ intConnect (INT_VEC_GPIO0, (PFNCT)GPIO_ISR, 0, "GPIO0"); intEnable (INT_VEC_GPIO0); GPIO_PowerLEDR(0); GPIO_PowerLEDG(1); GPIO_VcrMute(FALSE); GPIO_MainAudioMute(FALSE); return; }
INLINE void vmeio_int_detach(const DWORD base_adr, DWORD base_vect, int intnum) /**************************************************************\ Purpose: Unbook an ISR for a bitwise set of interrupt input (0xff). The interrupt vector is then the VECTOR_BASE+intnum Input: DWORD * base_addr : base address of the VMEIO DWORD base_vect : base vector of the module DWORD intnum : interrupt number (0:7) Output: none Function value: none \**************************************************************/ { vmeio_int_clear(base_adr); /* clear any pending front panel interrupts */ vmeio_int_disable(base_adr, intnum); /* mask off external interrupt x */ #ifdef OS_VXWORKS if (intnum < 8) intConnect(INUM_TO_IVEC(base_vect + intnum), (VOIDFUNCPTR) myStub, intnum); #else printf("vector : 0x%x\n", base_vect + intnum); #endif }
/************ INLINE function for General command ***********/ INLINE void sis3803_int_attach(const DWORD base_adr, DWORD base_vect, int level, void (*isr) (void)) /**************************************************************\ Purpose: Book an ISR for a bitwise set of interrupt input (0xff). The interrupt vector is then the VECTOR_BASE+intnum Input: DWORD * base_addr : base address of the sis3803 DWORD base_vect : base vector of the module int level : IRQ level (1..7) DWORD isr_routine : interrupt routine pointer Output: none Function value: none \**************************************************************/ { volatile DWORD *spec_adr; /* disable all IRQ sources */ /* Should be done but not in attach sis3803_int_source(base_adr , DISABLE_IRQ_DI_BS0 | DISABLE_IRQ_DI_BS1 | DISABLE_IRQ_DI_BS2); */ #ifdef OS_VXWORKS if ((level < 8) && (level > 0) && (base_vect < 0x100)) { spec_adr = (DWORD *) (A32D24 + base_adr + IRQ_REG); *spec_adr = (level << 8) | VME_IRQ_ENABLE | base_vect; sysIntEnable(level); /* interrupt level */ } intConnect(INUM_TO_IVEC(base_vect), (VOIDFUNCPTR) isr, 0); #else printf("Not implemented for this OS\n"); #endif }
int rapiInit(pwr_tUInt8* pRapiDPMBase, int irq) { #if 0 RAPI_HEADER* pRapiHeader; RAPI_DEV* pRapiDevtab; RAPI_IMREG* pRapiImReg; #endif if(cRapi >= NUM_RAPI - 1) /* No free rapi module block's */ { #ifdef DEBUG printf("rapiInit: no free rapi module block\n"); #endif return(RAPI_ERR); } pRapiHeader = (RAPI_HEADER *) pRapiDPMBase; /* Setup RAPI header pointer */ #ifdef DEBUG printf("rapiInit: pRapiDPMBase = 0x%x\n", (unsigned int) pRapiDPMBase); printf("Id 0 : %d\n", pRapiHeader->rapiId[0]); /* Printout of RAPI ID */ printf("Id 0 : %d\n", pRapiHeader->rapiId[1]); printf("Id 0 : %d\n", pRapiHeader->rapiId[2]); printf("Id 0 : %d\n", pRapiHeader->rapiId[3]); #endif if((pRapiHeader->rapiId[0] != 'R') || /* Test for valid RAPI ID structure */ (pRapiHeader->rapiId[1] != 'A') || (pRapiHeader->rapiId[2] != 'P') || (pRapiHeader->rapiId[3] != 'I') ) { #ifdef DEBUG printf("rapiInit: ""RAPI"" string missing in header\n"); #endif return(RAPI_ERR); } if(pRapiHeader->crc != rapiCrcCalc(pRapiDPMBase)) /* Check CRC */ { #ifdef DEBUG printf("rapiInit: crc error\n"); #endif return(RAPI_ERR); } #ifdef DEBUG printf("RAPI rev %d\n", pRapiHeader->rapiRev); printf("Module ID %d, Nr %d, Rev %d\n", pRapiHeader->modId, pRapiHeader->modNr, pRapiHeader->modRev); #endif pRapiDevtab = (RAPI_DEV *)&pRapiDPMBase[wordSwapChk(pRapiHeader->devtab)]; /* Get pointer to device table */ pRapiImReg = (RAPI_IMREG *)&pRapiDPMBase[wordSwapChk(pRapiHeader->vectab)]; /* Get pointer to interrupt vector table */ #ifdef DEBUG printf("rapiInit: pRapiDevtab = 0x%x\n", (unsigned int) pRapiDevtab); printf("rapiInit: pRapiImReg = 0x%x\n", (unsigned int) pRapiImReg); #endif rapiModule[cRapi].pRapiDPM = pRapiDPMBase; /* Store pointer to Dual Ported Memory */ rapiModule[cRapi].pRapiHeader = pRapiHeader; /* Store pointer to RAPI_HEADER */ rapiModule[cRapi].pRapiDevtab = pRapiDevtab; /* Store pointer to RAPI_DEV */ rapiModule[cRapi].pRapiImReg = pRapiImReg; /* Store pointer to RAPI_IMREG */ #if 0 /* Obsolete in Lynx/SSPA case !?!? */ pRapiImReg->irqVec1 = irq; pRapiImReg->irqVec2 = irq; intConnect(INUM_TO_IVEC(irq), rapiInt, (unsigned int) cRapi); #endif /* Obsolete in Lynx/SSPA case !?!? */ rapiModeSet(cRapi, RAPI_RESET); /* Initialize to RESET mode */ cRapi++; /* Increment initialized module count */ return(cRapi - 1); /* Return index for the module we just initialized */ }
//STATUS dac3550DevCreate (char *devName, int port, int irq) DEV_HDR* dac3550DevCreate (char *devName, int port, int irq) { SND_DEV *pDev; if (DrvNum < 1) { errno = S_ioLib_NO_DRIVER; return ERROR; } if(dac3550Dev) return &(dac3550Dev->devHdr); pDev = (SND_DEV *)malloc (sizeof(SND_DEV)); if (!pDev) return 0; bzero ((char *)pDev, sizeof(SND_DEV)); if(port==0) port = (int)AT91C_BASE_SSC1; if(irq==0) irq = AT91C_ID_SSC1; pDev->port = port; pDev->irq = irq; /* pDev->dma8 = dma8; pDev->dma16 = dma16; */ pDev->devSem = semBCreate (SEM_Q_FIFO, SEM_FULL); pDev->intSem = semCCreate (SEM_Q_FIFO, 0); pDev->bufSem = semCCreate (SEM_Q_FIFO, MAX_DMA_MSGS); pDev->dmaQ = msgQCreate (MAX_DMA_MSGS, sizeof (DMA_MSG), MSG_Q_FIFO); pDev->dmaIndex = 0; if (createDmaBuffer () < 0) { free (pDev); return 0; } if (dsp_init (pDev) < 0) { free (pDev); return 0; } if (iosDevAdd (&pDev->devHdr, devName, DrvNum) == ERROR) { free ((char *)pDev); return 0; } /* pDev->tid = taskSpawn ("tSndTask", TASK_PRIORITY, TASK_OPTIONS, TASK_STACK_SIZE, dspHelperTask, (int)pDev, 0, 0, 0, 0, 0, 0, 0, 0, 0); if (pDev->tid == ERROR) { free (pDev); return ERROR; } */ intConnect (INUM_TO_IVEC ( (irq)), dspInterrupt, (int)pDev); dac3550Dev = pDev; return &(pDev->devHdr); }