/** * @brief Configures and activates the EXT peripheral. * * @param[in] extp pointer to the @p EXTDriver object * * @notapi */ void ext_lld_start(EXTDriver *extp) { int i; /* Configure all pins as edge sensitive */ #if LPC122x_EXT_USE_EXT0 if (extp == &EXTD0) { LPC_GPIO0->IS = 0; ext_lld_exti_irq_enable(EXTI0_IRQ); } #endif #if LPC122x_EXT_USE_EXT1 if (extp == &EXTD1) { LPC_GPIO1->IS = 0; ext_lld_exti_irq_enable(EXTI1_IRQ); } #endif #if LPC122x_EXT_USE_EXT2 if (extp == &EXTD2) { LPC_GPIO2->IS = 0; ext_lld_exti_irq_enable(EXTI2_IRQ); } #endif /* Configuration of autostart channels.*/ for (i = 0; i < EXT_MAX_CHANNELS; i++) if (extp->config->channels[i].mode & EXT_CH_MODE_AUTOSTART) ext_lld_channel_enable(extp, i); else ext_lld_channel_disable(extp, i); }
/** * @brief Configures and activates the EXT peripheral. * * @param[in] extp pointer to the @p EXTDriver object * * @notapi */ void ext_lld_start(EXTDriver *extp) { int i; LPC_SYSCON->SYSAHBCLKCTRL |= (1<<6); /* Configuration of automatic channels.*/ for (i = 0; i < EXT_MAX_CHANNELS; i++) if (extp->config->channels[i].mode & EXT_CH_MODE_AUTOSTART) ext_lld_channel_enable(extp, i); else ext_lld_channel_disable(extp, i); }
/** * @brief Configures and activates the EXT peripheral. * * @param[in] extp pointer to the @p EXTDriver object * * @notapi */ void ext_lld_start(EXTDriver *extp) { expchannel_t line; if (extp->state == EXT_STOP) osalSysUnlock(); /* Configuration of automatic channels. */ for (line = 0; line < EXT_MAX_CHANNELS; line++) { if (extp->config->channels[line].mode & EXT_CH_MODE_AUTOSTART) ext_lld_channel_enable(extp, line); else ext_lld_channel_disable(extp, line); } }
/** * @brief Configures and activates the EXT peripheral. * * @param[in] extp pointer to the @p EXTDriver object * * @notapi */ void ext_lld_start(EXTDriver *extp) { if (extp->state == EXT_STOP) ext_lld_exti_irq_enable(); /* Configuration of automatic channels.*/ for (expchannel_t channel = 0; channel < EXT_MAX_CHANNELS; channel++) { uint32_t mode = extp->config->channels[channel].mode; PORT_TypeDef *port = extp->config->channels[channel].port; uint32_t pin = extp->config->channels[channel].pin; /* Initialize the channel map */ #if KINETIS_EXT_PORTA_WIDTH > 0 if (port == PORTA) porta_channel_map[pin] = channel; else #endif #if KINETIS_EXT_PORTB_WIDTH > 0 if (port == PORTB) portb_channel_map[pin] = channel; else #endif #if KINETIS_EXT_PORTC_WIDTH > 0 if (port == PORTC) portc_channel_map[pin] = channel; else #endif #if KINETIS_EXT_PORTD_WIDTH > 0 if (port == PORTD) portd_channel_map[pin] = channel; else #endif #if KINETIS_EXT_PORTE_WIDTH > 0 if (port == PORTE) porte_channel_map[pin] = channel; else #endif {} if (mode & EXT_CH_MODE_AUTOSTART) ext_lld_channel_enable(extp, channel); else if (port != NULL) ext_lld_channel_disable(extp, channel); } }
/** * @brief Configures and activates the EXT peripheral. * * @param[in] extp pointer to the @p EXTDriver object * * @notapi */ void ext_lld_start(EXTDriver *extp) { uint8_t i; if (extp->state == EXT_STOP) { ext_lld_irq_enable(); } /* Configuration of automatic channels.*/ for (i = 0; i < EXT_MAX_CHANNELS; i++) { if (extp->config->channels[i].mode & EXT_CH_MODE_AUTOSTART) { ext_lld_channel_enable(extp, i); } else { ext_lld_channel_disable(extp, i); } } }
/** * @brief Changes the operation mode of a channel. * @note This function attempts to write over the current configuration * structure that must have been not declared constant. This * violates the @p const qualifier in @p extStart() but it is * intentional. * @note This function cannot be used if the configuration structure is * declared @p const. * @note The effect of this function on constant configuration structures * is not defined. * * @param[in] extp pointer to the @p EXTDriver object * @param[in] channel channel to be changed * @param[in] extcp new configuration for the channel * * @iclass */ void extSetChannelModeI(EXTDriver *extp, expchannel_t channel, const EXTChannelConfig *extcp) { EXTChannelConfig *oldcp; chDbgCheck((extp != NULL) && (channel < EXT_MAX_CHANNELS) && (extcp != NULL), "extSetChannelModeI"); chDbgAssert(extp->state == EXT_ACTIVE, "extSetChannelModeI(), #1", "invalid state"); /* Note that here the access is enforced as non-const, known access violation.*/ oldcp = (EXTChannelConfig *)&extp->config->channels[channel]; /* Overwiting the old channels configuration then the channel is reconfigured by the low level driver.*/ *oldcp = *extcp; ext_lld_channel_enable(extp, channel); }
/** * @brief Changes the operation mode of a channel. * @note This function attempts to write over the current configuration * structure that must have been not declared constant. This * violates the @p const qualifier in @p extStart() but it is * intentional. * @note This function cannot be used if the configuration structure is * declared @p const. * @note The effect of this function on constant configuration structures * is not defined. * * @param[in] extp pointer to the @p EXTDriver object * @param[in] channel channel to be changed * @param[in] extcp new configuration for the channel * * @iclass */ void extSetChannelModeI(EXTDriver *extp, expchannel_t channel, const EXTChannelConfig *extcp) { EXTChannelConfig *oldcp; osalDbgCheck((extp != NULL) && (channel < (expchannel_t)EXT_MAX_CHANNELS) && (extcp != NULL)); osalDbgAssert(extp->state == EXT_ACTIVE, "invalid state"); /* Note that here the access is enforced as non-const, known access violation.*/ /*lint -save -e9005 [11.8] Known issue, the driver needs rework here.*/ oldcp = (EXTChannelConfig *)&extp->config->channels[channel]; /*lint -restore*/ /* Overwriting the old channels configuration then the channel is reconfigured by the low level driver.*/ *oldcp = *extcp; ext_lld_channel_enable(extp, channel); }