docstring
stringlengths
22
576
signature
stringlengths
9
317
prompt
stringlengths
57
886
code
stringlengths
20
1.36k
repository
stringclasses
49 values
language
stringclasses
2 values
license
stringclasses
9 values
stars
int64
15
21.3k
/* This interrupt occurs 10 ms before the watchdog WILL bark. */
static irqreturn_t coh901327_interrupt(int irq, void *data)
/* This interrupt occurs 10 ms before the watchdog WILL bark. */ static irqreturn_t coh901327_interrupt(int irq, void *data)
{ u16 val; clk_enable(clk); val = readw(virtbase + U300_WDOG_IER); if (val == U300_WDOG_IER_WILL_BARK_IRQ_EVENT_IND) writew(U300_WDOG_IER_WILL_BARK_IRQ_ACK_ENABLE, virtbase + U300_WDOG_IER); writew(0x0000U, virtbase + U300_WDOG_IMR); clk_disable(clk); dev_crit(parent, "watchdog is barking!\n"); return IRQ_HANDLED; }
robutest/uclinux
C++
GPL-2.0
60
/* Selects the loop mode. This has no use in PWM mode. In loop mode with counter mode, the counter will constantly loop. In loop mode with the capture modes, the values will be captured again and again. In single mode, these operations happen only once. */
void timer_loop_mode(uint32_t timer, enum timer_loop_modes mode)
/* Selects the loop mode. This has no use in PWM mode. In loop mode with counter mode, the counter will constantly loop. In loop mode with the capture modes, the values will be captured again and again. In single mode, these operations happen only once. */ void timer_loop_mode(uint32_t timer, enum timer_loop_modes mode)
{ if (mode) { TIMER_CTRL(timer) |= TIMER_CTRL_LMOD; } else { TIMER_CTRL(timer) &= ~TIMER_CTRL_LMOD; } }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* get EXTI lines flag when the interrupt flag is set */
FlagStatus exti_interrupt_flag_get(exti_line_enum linex)
/* get EXTI lines flag when the interrupt flag is set */ FlagStatus exti_interrupt_flag_get(exti_line_enum linex)
{ if((RESET != (EXTI_PD & linex)) && (RESET != (EXTI_INTEN & linex))){ return SET; }else{ return RESET; } }
liuxuming/trochili
C++
Apache License 2.0
132
/* Update the clockactivity mode bits in @v to be @clockact for the @oh hwmod. Used for additional powersaving on some modules. Does not write to the hardware. Returns -EINVAL upon error or 0 upon success. */
static int _set_clockactivity(struct omap_hwmod *oh, u8 clockact, u32 *v)
/* Update the clockactivity mode bits in @v to be @clockact for the @oh hwmod. Used for additional powersaving on some modules. Does not write to the hardware. Returns -EINVAL upon error or 0 upon success. */ static int _set_clockactivity(struct omap_hwmod *oh, u8 clockact, u32 *v)
{ if (!oh->sysconfig || !(oh->sysconfig->sysc_flags & SYSC_HAS_CLOCKACTIVITY)) return -EINVAL; *v &= ~SYSC_CLOCKACTIVITY_MASK; *v |= clockact << SYSC_CLOCKACTIVITY_SHIFT; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* We hash on the keys returned from get_futex_key (see below). */
static struct futex_hash_bucket* hash_futex(union futex_key *key)
/* We hash on the keys returned from get_futex_key (see below). */ static struct futex_hash_bucket* hash_futex(union futex_key *key)
{ u32 hash = jhash2((u32*)&key->both.word, (sizeof(key->both.word)+sizeof(key->both.ptr))/4, key->both.offset); return &futex_queues[hash & ((1 << FUTEX_HASHBITS)-1)]; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* tioce_error_intr_handler - SGI TIO CE error interrupt handler @irq: unused */
static irqreturn_t tioce_error_intr_handler(int irq, void *arg)
/* tioce_error_intr_handler - SGI TIO CE error interrupt handler @irq: unused */ static irqreturn_t tioce_error_intr_handler(int irq, void *arg)
{ struct tioce_common *soft = arg; struct ia64_sal_retval ret_stuff; ret_stuff.status = 0; ret_stuff.v0 = 0; SAL_CALL_NOLOCK(ret_stuff, (u64) SN_SAL_IOIF_ERROR_INTERRUPT, soft->ce_pcibus.bs_persist_segment, soft->ce_pcibus.bs_persist_busnum, 0, 0, 0, 0, 0); if (ret_stuff.v0) panic("tioce_error_intr_handler: Fatal TIOCE error"); return IRQ_HANDLED; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Copy the first number of bytes from source string to destination string Return the pointer to the destination string. */
char* strncpy(char *pDestination, const char *pSource, size_t count)
/* Copy the first number of bytes from source string to destination string Return the pointer to the destination string. */ char* strncpy(char *pDestination, const char *pSource, size_t count)
{ char *pSaveDest = pDestination; while (count) { *pDestination = *pSource; if (*pSource == 0) { break; } pDestination++; pSource++; count--; } return pSaveDest; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Get WDT status. This function is used to get WDT status. */
unsigned long WDTStatusFlagGet(void)
/* Get WDT status. This function is used to get WDT status. */ unsigned long WDTStatusFlagGet(void)
{ return xHWREG(WDT_BASE + WDT_MOD); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Called by the driver when there's room for more data. If we have more packets to send, we send them here. */
static void slip_write_wakeup(struct tty_struct *tty)
/* Called by the driver when there's room for more data. If we have more packets to send, we send them here. */ static void slip_write_wakeup(struct tty_struct *tty)
{ int actual; struct slip *sl = tty->disc_data; if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) return; if (sl->xleft <= 0) { sl->tx_packets++; clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); sl_unlock(sl); return; } actual = tty->ops->write(tty, sl->xhead, sl->xleft); sl->xleft -= actual; sl->xhead += actual; }
robutest/uclinux
C++
GPL-2.0
60
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void)
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */ int main(void)
{ SetupHardware(); puts_P(PSTR(ESC_FG_CYAN "Printer Host Demo running.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { PrinterHost_Task(); PRNT_Host_USBTask(&Printer_PRNT_Interface); USB_USBTask(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Get the level-trigger transmission status of the specified SPI port. */
xtBoolean SPILevelTriggerStatusGet(unsigned long ulBase)
/* Get the level-trigger transmission status of the specified SPI port. */ xtBoolean SPILevelTriggerStatusGet(unsigned long ulBase)
{ xASSERT(ulBase == SPI0_BASE); return ((xHWREG(ulBase + SPI_SSR) & SPI_LTRIG_FLAG) ? xtrue : xfalse); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* nand_suspend - Suspend the NAND flash @mtd: MTD device structure */
static int nand_suspend(struct mtd_info *mtd)
/* nand_suspend - Suspend the NAND flash @mtd: MTD device structure */ static int nand_suspend(struct mtd_info *mtd)
{ struct nand_chip *chip = mtd->priv; return nand_get_device(chip, mtd, FL_PM_SUSPENDED); }
EmcraftSystems/u-boot
C++
Other
181
/* Retrieves the size, in bytes, of the context buffer required for SHA-512 hash operations. */
UINTN EFIAPI CryptoServiceSha512GetContextSize(VOID)
/* Retrieves the size, in bytes, of the context buffer required for SHA-512 hash operations. */ UINTN EFIAPI CryptoServiceSha512GetContextSize(VOID)
{ return CALL_BASECRYPTLIB (Sha512.Services.GetContextSize, Sha512GetContextSize, (), 0); }
tianocore/edk2
C++
Other
4,240
/* RTC update frequency Parameters: reg_value - current RTCCON register or his new value */
static void exynos4210_rtc_update_freq(Exynos4210RTCState *s, uint32_t reg_value)
/* RTC update frequency Parameters: reg_value - current RTCCON register or his new value */ static void exynos4210_rtc_update_freq(Exynos4210RTCState *s, uint32_t reg_value)
{ uint32_t freq; freq = s->freq; s->freq = RTC_BASE_FREQ / (1 << TICCKSEL(reg_value)); if (freq != s->freq) { ptimer_set_freq(s->ptimer, s->freq); DPRINTF("freq=%dHz\n", s->freq); } }
ve3wwg/teensy3_qemu
C++
Other
15
/* Enable IEEE1588 time stamp function and set current time. */
void EMAC_EnableTS(uint32_t u32Sec, uint32_t u32Nsec)
/* Enable IEEE1588 time stamp function and set current time. */ void EMAC_EnableTS(uint32_t u32Sec, uint32_t u32Nsec)
{ double f; uint32_t reg; EMAC->TSCTL = EMAC_TSCTL_TSEN_Msk; EMAC->UPDSEC = u32Sec; EMAC->UPDSUBSEC = EMAC_Nsec2Subsec(u32Nsec); f = (100.0 * 2147483648.0) / (1000000000.0) + 0.5; EMAC->TSINC = (reg = (uint32_t)f); f = (double)9223372036854775808.0 / ((double)(CLK_GetHCLKFreq()) * (double)reg); EMAC->TSADDEND = (uint32_t)f; EMAC->TSCTL |= (EMAC_TSCTL_TSUPDATE_Msk | EMAC_TSCTL_TSIEN_Msk | EMAC_TSCTL_TSMODE_Msk); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Schedule a cull of the thread pool at some time in the near future */
static void slow_work_schedule_cull(void)
/* Schedule a cull of the thread pool at some time in the near future */ static void slow_work_schedule_cull(void)
{ mod_timer(&slow_work_cull_timer, round_jiffies(jiffies + SLOW_WORK_CULL_TIMEOUT)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set LED2 to Blinking mode for an infinite loop (toggle period based on value provided as input parameter). */
void LED_Blinking(uint32_t Period)
/* Set LED2 to Blinking mode for an infinite loop (toggle period based on value provided as input parameter). */ void LED_Blinking(uint32_t Period)
{ while (1) { LL_GPIO_TogglePin(LED2_GPIO_PORT, LED2_PIN); LL_mDelay(Period); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* If RsaContext is NULL, then return FALSE. If Message is NULL, then return FALSE. If MsgSize is zero or > INT_MAX, then return FALSE. If DigestLen is NOT 32, 48 or 64, return FALSE. If SaltLen is not equal to DigestLen, then return FALSE. If SigSize is large enough but Signature is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI RsaPssSign(IN VOID *RsaContext, IN CONST UINT8 *Message, IN UINTN MsgSize, IN UINT16 DigestLen, IN UINT16 SaltLen, OUT UINT8 *Signature, IN OUT UINTN *SigSize)
/* If RsaContext is NULL, then return FALSE. If Message is NULL, then return FALSE. If MsgSize is zero or > INT_MAX, then return FALSE. If DigestLen is NOT 32, 48 or 64, return FALSE. If SaltLen is not equal to DigestLen, then return FALSE. If SigSize is large enough but Signature is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI RsaPssSign(IN VOID *RsaContext, IN CONST UINT8 *Message, IN UINTN MsgSize, IN UINT16 DigestLen, IN UINT16 SaltLen, OUT UINT8 *Signature, IN OUT UINTN *SigSize)
{ CALL_CRYPTO_SERVICE (RsaPssSign, (RsaContext, Message, MsgSize, DigestLen, SaltLen, Signature, SigSize), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Returns the number of characters in the string or -1 in case of error */
int xmlUTF8Strlen(const xmlChar *utf)
/* Returns the number of characters in the string or -1 in case of error */ int xmlUTF8Strlen(const xmlChar *utf)
{ if (utf[0] & 0x80) { if ((utf[1] & 0xc0) != 0x80) return(-1); if ((utf[0] & 0xe0) == 0xe0) { if ((utf[2] & 0xc0) != 0x80) return(-1); if ((utf[0] & 0xf0) == 0xf0) { if ((utf[0] & 0xf8) != 0xf0 || (utf[3] & 0xc0) != 0x80) return(-1); utf += 4; } else { utf += 3; } } else { utf += 2; } } else { utf++; } ret++; } return(ret); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function will init led on the board */
static void rt_hw_board_led_init(void)
/* This function will init led on the board */ static void rt_hw_board_led_init(void)
{ rt_uint32_t status; led_data = 0; cnt = 0; status = XGpio_Initialize(&gpio_output, LEDS_DEVICE_ID); if (status != XST_SUCCESS) { return; } XGpio_SetDataDirection(&gpio_output, 1, 0x0); XGpio_DiscreteWrite(&gpio_output, 1, 3); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Deinitializes CRC peripheral registers to their default reset values. */
void CRC_DeInit(void)
/* Deinitializes CRC peripheral registers to their default reset values. */ void CRC_DeInit(void)
{ CRC->DR = 0xFFFFFFFF; CRC->IDR = 0x00; CRC->INIT = 0xFFFFFFFF; CRC->CR = CRC_CR_RESET; }
ajhc/demo-cortex-m3
C++
null
38
/* Check whether the sqrt calculation is in progress. */
en_flag_status_t MAU_SqrtGetStatus(const CM_MAU_TypeDef *MAUx)
/* Check whether the sqrt calculation is in progress. */ en_flag_status_t MAU_SqrtGetStatus(const CM_MAU_TypeDef *MAUx)
{ DDL_ASSERT(IS_VALID_UNIT(MAUx)); return (0UL != READ_REG32_BIT(MAUx->CSR, MAU_CSR_BUSY)) ? SET : RESET; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return: 0 if all went fine, else return appropriate error. */
static int ti_sci_cmd_dev_get_clcnt(const struct ti_sci_handle *handle, u32 id, u32 *count)
/* Return: 0 if all went fine, else return appropriate error. */ static int ti_sci_cmd_dev_get_clcnt(const struct ti_sci_handle *handle, u32 id, u32 *count)
{ return ti_sci_get_device_state(handle, id, count, NULL, NULL, NULL); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Enable the automatic slave select function of the specified SPI port. The */
void SPIAutoSSEnable(unsigned long ulBase, unsigned long ulSlaveSel)
/* Enable the automatic slave select function of the specified SPI port. The */ void SPIAutoSSEnable(unsigned long ulBase, unsigned long ulSlaveSel)
{ xASSERT(ulBase == SPI0_BASE); xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0) || (ulSlaveSel == SPI_SS1) || (ulSlaveSel == SPI_SS0_SS1)); xHWREG(ulBase + SPI_SSR) |= SPI_SSR_AUTOSS; xHWREG(ulBase + SPI_SSR) &= ~SPI_SSR_SSR_M; xHWREG(ulBase + SPI_SSR) |= ulSlaveSel; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Read TC77 temperature value and handle data in decimal. */
short TC77TemperReadDec(void)
/* Read TC77 temperature value and handle data in decimal. */ short TC77TemperReadDec(void)
{ short sTempValue; sTempValue = TC77TemperRead(); sTempValue = sTempValue >> 3; sTempValue = sTempValue * 0.0625; return sTempValue; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Change Logs: Date Author Notes Bernard The first version for LPC40xx RT_learning The first version for LPC5410x */
static uint32_t _UART_DivClk(uint32_t pclk, uint32_t m)
/* Change Logs: Date Author Notes Bernard The first version for LPC40xx RT_learning The first version for LPC5410x */ static uint32_t _UART_DivClk(uint32_t pclk, uint32_t m)
{ uint32_t q, r, u = pclk >> 24, l = pclk << 8; m = m + 256; q = (1 << 24) / m; r = (1 << 24) - (q * m); return ((q * u) << 8) + (((r * u) << 8) + l) / m; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Drop a reference to a group. Free it if it's through. */
void fsnotify_put_group(struct fsnotify_group *group)
/* Drop a reference to a group. Free it if it's through. */ void fsnotify_put_group(struct fsnotify_group *group)
{ if (!atomic_dec_and_mutex_lock(&group->refcnt, &fsnotify_grp_mutex)) return; __fsnotify_evict_group(group); mutex_unlock(&fsnotify_grp_mutex); synchronize_srcu(&fsnotify_grp_srcu); fsnotify_recalc_global_mask(); fsnotify_destroy_group(group); }
robutest/uclinux
C++
GPL-2.0
60
/* Return: Pointer to the newly allocated QH, or NULL on error */
static struct dwc2_qh* dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg, struct dwc2_hcd_urb *urb, gfp_t mem_flags)
/* Return: Pointer to the newly allocated QH, or NULL on error */ static struct dwc2_qh* dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg, struct dwc2_hcd_urb *urb, gfp_t mem_flags)
{ struct dwc2_qh *qh; if (!urb->priv) return NULL; qh = kzalloc(sizeof(*qh), mem_flags); if (!qh) return NULL; dwc2_qh_init(hsotg, qh, urb); if (hsotg->core_params->dma_desc_enable > 0 && dwc2_hcd_qh_init_ddma(hsotg, qh, mem_flags) < 0) { dwc2_hcd_qh_free(hsotg, qh); return NULL; } return qh; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely. */
static void log_locales(void)
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely. */ static void log_locales(void)
{ SDL_Locale *locales = SDL_GetPreferredLocales(); if (locales == NULL) { SDL_Log("Couldn't determine locales: %s", SDL_GetError()); } else { SDL_Locale *l; unsigned int total = 0; SDL_Log("Locales, in order of preference:"); for (l = locales; l->language; l++) { const char *c = l->country; SDL_Log(" - %s%s%s", l->language, c ? "_" : "", c ? c : ""); total++; } SDL_Log("%u locales seen.", total); SDL_free(locales); } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Disable I2C interrupt of the specified I2C port. The */
void I2CIntDisable(unsigned long ulBase)
/* Disable I2C interrupt of the specified I2C port. The */ void I2CIntDisable(unsigned long ulBase)
{ xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE)); xHWREG(ulBase + I2C_O_CON) &= ~I2C_CON_EI; if (ulBase == I2C0_BASE) { xIntDisable(INT_I2C0); } else if (ulBase == I2C1_BASE) { xIntDisable(INT_I2C1); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Clear the RPC credential cache, and delete those credentials that are not referenced. */
void rpcauth_clear_credcache(struct rpc_cred_cache *cache)
/* Clear the RPC credential cache, and delete those credentials that are not referenced. */ void rpcauth_clear_credcache(struct rpc_cred_cache *cache)
{ LIST_HEAD(free); struct hlist_head *head; struct rpc_cred *cred; int i; spin_lock(&rpc_credcache_lock); spin_lock(&cache->lock); for (i = 0; i < RPC_CREDCACHE_NR; i++) { head = &cache->hashtable[i]; while (!hlist_empty(head)) { cred = hlist_entry(head->first, struct rpc_cred, cr_hash); get_rpccred(cred); if (!list_empty(&cred->cr_lru)) { list_del(&cred->cr_lru); number_cred_unused--; } list_add_tail(&cred->cr_lru, &free); rpcauth_unhash_cred_locked(cred); } } spin_unlock(&cache->lock); spin_unlock(&rpc_credcache_lock); rpcauth_destroy_credlist(&free); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Callback notifying an application that a remote device connection is currently congested and cannot receive any more data. An application should avoid sending more data until a further callback is received indicating the congestion status has been cleared. */
void btgattc_congestion_callback(int conn_id, uint8_t congested)
/* Callback notifying an application that a remote device connection is currently congested and cannot receive any more data. An application should avoid sending more data until a further callback is received indicating the congestion status has been cleared. */ void btgattc_congestion_callback(int conn_id, uint8_t congested)
{ int index = -1; TLS_BT_APPL_TRACE_VERBOSE("%s, conn_id=%d\r\n", __FUNCTION__, conn_id); index = get_app_env_index_by_conn_id(conn_id); if(index<0) { TLS_BT_APPL_TRACE_ERROR("%s, congested=%d, conn_id=%d\r\n", __FUNCTION__, congested, conn_id); return; } TLS_HAL_CBACK(app_env[index].ps_callbak, congestion_cb, conn_id, congested); }
Nicholas3388/LuaNode
C++
Other
1,055
/* param base USDHC peripheral base address. param handle USDHC handle pointer. param callback Structure pointer to contain all callback functions. param userData Callback function parameter. */
void USDHC_TransferCreateHandle(USDHC_Type *base, usdhc_handle_t *handle, const usdhc_transfer_callback_t *callback, void *userData)
/* param base USDHC peripheral base address. param handle USDHC handle pointer. param callback Structure pointer to contain all callback functions. param userData Callback function parameter. */ void USDHC_TransferCreateHandle(USDHC_Type *base, usdhc_handle_t *handle, const usdhc_transfer_callback_t *callback, void *userData)
{ assert(handle != NULL); assert(callback != NULL); (void)memset(handle, 0, sizeof(*handle)); handle->callback.CardInserted = callback->CardInserted; handle->callback.CardRemoved = callback->CardRemoved; handle->callback.SdioInterrupt = callback->SdioInterrupt; handle->callback.BlockGap = callback->BlockGap; handle->callback.TransferComplete = callback->TransferComplete; handle->callback.ReTuning = callback->ReTuning; handle->userData = userData; s_usdhcHandle[USDHC_GetInstance(base)] = handle; s_usdhcIsr = USDHC_TransferHandleIRQ; (void)EnableIRQ(s_usdhcIRQ[USDHC_GetInstance(base)]); }
eclipse-threadx/getting-started
C++
Other
310
/* revoke_exclusive - revoke exclusive mode. @desc: volume descriptor @mode: new mode to switch to */
static void revoke_exclusive(struct ubi_volume_desc *desc, int mode)
/* revoke_exclusive - revoke exclusive mode. @desc: volume descriptor @mode: new mode to switch to */ static void revoke_exclusive(struct ubi_volume_desc *desc, int mode)
{ struct ubi_volume *vol = desc->vol; spin_lock(&vol->ubi->volumes_lock); ubi_assert(vol->readers == 0 && vol->writers == 0); ubi_assert(vol->exclusive == 1 && desc->mode == UBI_EXCLUSIVE); vol->exclusive = 0; if (mode == UBI_READONLY) vol->readers = 1; else if (mode == UBI_READWRITE) vol->writers = 1; else vol->exclusive = 1; spin_unlock(&vol->ubi->volumes_lock); desc->mode = mode; }
robutest/uclinux
C++
GPL-2.0
60
/* client sent a GRANTED_RES, let's remove the associated block */
static __be32 nlmsvc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp, void *resp)
/* client sent a GRANTED_RES, let's remove the associated block */ static __be32 nlmsvc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp, void *resp)
{ if (!nlmsvc_ops) return rpc_success; dprintk("lockd: GRANTED_RES called\n"); nlmsvc_grant_reply(&argp->cookie, argp->status); return rpc_success; }
robutest/uclinux
C++
GPL-2.0
60
/* Gets the current device hub address for this endpoint. */
uint32_t USBHostHubAddrGet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Flags)
/* Gets the current device hub address for this endpoint. */ uint32_t USBHostHubAddrGet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Flags)
{ ASSERT(ui32Base == USB0_BASE); ASSERT((ui32Endpoint == USB_EP_0) || (ui32Endpoint == USB_EP_1) || (ui32Endpoint == USB_EP_2) || (ui32Endpoint == USB_EP_3) || (ui32Endpoint == USB_EP_4) || (ui32Endpoint == USB_EP_5) || (ui32Endpoint == USB_EP_6) || (ui32Endpoint == USB_EP_7)); if(ui32Flags & USB_EP_HOST_OUT) { return(HWREGB(ui32Base + USB_O_TXHUBADDR0 + (ui32Endpoint >> 1))); } else { return(HWREGB(ui32Base + USB_O_TXHUBADDR0 + 4 + (ui32Endpoint >> 1))); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* add_virt_timer_int - add an interval virtual CPU timer */
void add_virt_timer_periodic(void *new)
/* add_virt_timer_int - add an interval virtual CPU timer */ void add_virt_timer_periodic(void *new)
{ struct vtimer_list *timer; timer = (struct vtimer_list *)new; prepare_vtimer(timer); timer->interval = timer->expires; internal_add_vtimer(timer); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Powers down the MEMS microphone stops the ADC and frees up the DMA channel. */
void MIC_deInit(void)
/* Powers down the MEMS microphone stops the ADC and frees up the DMA channel. */ void MIC_deInit(void)
{ adcEnable( false ); PRS_SourceAsyncSignalSet( MIC_CONFIG_PRS_CH, 0, 0 ); BOARD_micEnable( false ); DMADRV_FreeChannel( dmadrvChannelId ); return; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Vendor handler is executed in the ISR context, queue data for later processing */
static int wpanusb_vendor_handler(struct usb_setup_packet *setup, int32_t *len, uint8_t **data)
/* Vendor handler is executed in the ISR context, queue data for later processing */ static int wpanusb_vendor_handler(struct usb_setup_packet *setup, int32_t *len, uint8_t **data)
{ struct net_pkt *pkt; if (usb_reqtype_is_to_host(setup)) { return -ENOTSUP; } pkt = net_pkt_alloc_with_buffer(NULL, *len + 2, AF_UNSPEC, 0, K_NO_WAIT); if (!pkt) { return -ENOMEM; } net_pkt_write_u8(pkt, setup->bRequest); if (setup->bRequest == TX) { net_pkt_write_u8(pkt, setup->wIndex); } net_pkt_write(pkt, *data, *len); LOG_DBG("pkt %p len %u seq %u", pkt, *len, setup->wIndex); k_fifo_put(&tx_queue, pkt); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function destroys an MTD object obtained from concat_mtd_devs() */
void mtd_concat_destroy(struct mtd_info *mtd)
/* This function destroys an MTD object obtained from concat_mtd_devs() */ void mtd_concat_destroy(struct mtd_info *mtd)
{ struct mtd_concat *concat = CONCAT(mtd); if (concat->mtd.numeraseregions) kfree(concat->mtd.eraseregions); kfree(concat); }
robutest/uclinux
C++
GPL-2.0
60
/* shmem_zero_setup - setup a shared anonymous mapping @vma: the vma to be mmapped is prepared by do_mmap_pgoff */
int shmem_zero_setup(struct vm_area_struct *vma)
/* shmem_zero_setup - setup a shared anonymous mapping @vma: the vma to be mmapped is prepared by do_mmap_pgoff */ int shmem_zero_setup(struct vm_area_struct *vma)
{ struct file *file; loff_t size = vma->vm_end - vma->vm_start; file = shmem_file_setup("dev/zero", size, vma->vm_flags); if (IS_ERR(file)) return PTR_ERR(file); if (vma->vm_file) fput(vma->vm_file); vma->vm_file = file; vma->vm_ops = &shmem_vm_ops; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Validates PDU Type.1 Validaes the encoding. Adds Expert Info if format invalid This also validates Spec Type.1.1. */
static void validate_c2(packet_info *pinfo, proto_item *pi, guint16, gint len)
/* Validates PDU Type.1 Validaes the encoding. Adds Expert Info if format invalid This also validates Spec Type.1.1. */ static void validate_c2(packet_info *pinfo, proto_item *pi, guint16, gint len)
{ if (len > 1 && val < 0x80) { expert_add_info_format(pinfo, pi, &ei_c2_c3_c4_format, "DOF Violation: Type.1.1: Compressed 16-bit Compression Manditory." ); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Latch interrupt request on INT2_SRC (35h) register, with INT2_SRC (35h) register cleared by reading INT2_SRC(35h) itself.. */
int32_t lis2dh12_int2_pin_notification_mode_set(stmdev_ctx_t *ctx, lis2dh12_lir_int2_t val)
/* Latch interrupt request on INT2_SRC (35h) register, with INT2_SRC (35h) register cleared by reading INT2_SRC(35h) itself.. */ int32_t lis2dh12_int2_pin_notification_mode_set(stmdev_ctx_t *ctx, lis2dh12_lir_int2_t val)
{ lis2dh12_ctrl_reg5_t ctrl_reg5; int32_t ret; ret = lis2dh12_read_reg(ctx, LIS2DH12_CTRL_REG5, (uint8_t *)&ctrl_reg5, 1); if (ret == 0) { ctrl_reg5.lir_int2 = (uint8_t)val; ret = lis2dh12_write_reg(ctx, LIS2DH12_CTRL_REG5, (uint8_t *)&ctrl_reg5, 1); } return ret; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Returns the "i2c type". This is a pointer to a struct that describes the I2C chain on this board. To minimize impact on struct ipath_devdata, the (small integer) index into the table is actually memoized, rather then the pointer. Memoization is because the type is determined on the first call per chip. An alternative would be to move type determination to early init code. */
static struct i2c_chain_desc* ipath_i2c_type(struct ipath_devdata *dd)
/* Returns the "i2c type". This is a pointer to a struct that describes the I2C chain on this board. To minimize impact on struct ipath_devdata, the (small integer) index into the table is actually memoized, rather then the pointer. Memoization is because the type is determined on the first call per chip. An alternative would be to move type determination to early init code. */ static struct i2c_chain_desc* ipath_i2c_type(struct ipath_devdata *dd)
{ int idx; idx = dd->ipath_i2c_chain_type - 1; if (idx >= 0 && idx < (ARRAY_SIZE(i2c_chains) - 1)) goto done; idx = 0; while (i2c_chains[idx].probe_dev != IPATH_NO_DEV) { if (!i2c_probe(dd, i2c_chains[idx].probe_dev)) break; ++idx; } if (idx == 0) eeprom_reset(dd); if (i2c_chains[idx].probe_dev == IPATH_NO_DEV) idx = -1; else dd->ipath_i2c_chain_type = idx + 1; done: return (idx >= 0) ? i2c_chains + idx : NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns a pointer to the first non-whitespace character in @str. */
char* skip_spaces(const char *str)
/* Returns a pointer to the first non-whitespace character in @str. */ char* skip_spaces(const char *str)
{ while (isspace(*str)) ++str; return (char *)str; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function is used to display a string on console, normally, it's invoked by rt_kprintf */
void rt_console_puts(const char *str)
/* This function is used to display a string on console, normally, it's invoked by rt_kprintf */ void rt_console_puts(const char *str)
{ while (*str) { rt_serial_putc (*str++); } }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* param config Pointer to configuration structure. See to "dcdc_loop_control_config_t" */
void DCDC_GetDefaultLoopControlConfig(dcdc_loop_control_config_t *config)
/* param config Pointer to configuration structure. See to "dcdc_loop_control_config_t" */ void DCDC_GetDefaultLoopControlConfig(dcdc_loop_control_config_t *config)
{ assert(NULL != config); (void)memset(config, 0, sizeof(*config)); config->enableCommonHysteresis = false; config->enableCommonThresholdDetection = false; config->enableInvertHysteresisSign = false; config->enableRCThresholdDetection = false; config->enableRCScaleCircuit = 0U; config->complementFeedForwardStep = 0U; config->controlParameterMagnitude = 2U; config->integralProportionalRatio = 2U; }
eclipse-threadx/getting-started
C++
Other
310
/* Allocate a memory block from a memory pool. */
void* osPoolAlloc(osPoolId pool_id)
/* Allocate a memory block from a memory pool. */ void* osPoolAlloc(osPoolId pool_id)
{ return rt_mp_alloc(pool_id, 0); }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* Dissect a parameter given its type, offset into tvb, and length. */
static guint16 dissect_bssap_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bssap_tree, proto_tree *tree, guint8 parameter_type, gint offset, guint16 parameter_length, struct _sccp_msg_info_t *sccp_info)
/* Dissect a parameter given its type, offset into tvb, and length. */ static guint16 dissect_bssap_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bssap_tree, proto_tree *tree, guint8 parameter_type, gint offset, guint16 parameter_length, struct _sccp_msg_info_t *sccp_info)
{ tvbuff_t *parameter_tvb; parameter_tvb = tvb_new_subset_length(tvb, offset, parameter_length); switch (parameter_type) { case PARAMETER_DLCI: dissect_bssap_dlci_param(parameter_tvb, bssap_tree, parameter_length); break; case PARAMETER_LENGTH: dissect_bssap_length_param(parameter_tvb, bssap_tree, parameter_length); break; case PARAMETER_DATA: dissect_bssap_data_param(parameter_tvb, pinfo, bssap_tree, tree, sccp_info); break; default: proto_tree_add_expert_format(bssap_tree, pinfo, &ei_bssap_unknown_parameter, parameter_tvb, 0, parameter_length, "Unknown parameter 0x%x (%u byte%s)", parameter_type, parameter_length, plurality(parameter_length, "", "s")); break; } return(parameter_length); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If Buffer was not allocated with a page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */
VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages)
/* If Buffer was not allocated with a page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */ VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages)
{ EFI_STATUS Status; ASSERT (Pages != 0); Status = gMmst->MmFreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages); ASSERT_EFI_ERROR (Status); }
tianocore/edk2
C++
Other
4,240
/* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */
status_t HAL_CODEC_Init(void *handle, void *config)
/* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */ status_t HAL_CODEC_Init(void *handle, void *config)
{ assert((config != NULL) && (handle != NULL)); codec_config_t *codecConfig = (codec_config_t *)config; da7212_config_t *da7212Config = (da7212_config_t *)(codecConfig->codecDevConfig); da7212_handle_t *da7212Handle = (da7212_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)); ((codec_handle_t *)handle)->codecCapability = &s_da7212_capability; return DA7212_Init(da7212Handle, da7212Config); }
eclipse-threadx/getting-started
C++
Other
310
/* Sets the number of bits per pixel used by the LCD display. */
void LCD_SetBitsPerPixel(unsigned int bitsPerPixel)
/* Sets the number of bits per pixel used by the LCD display. */ void LCD_SetBitsPerPixel(unsigned int bitsPerPixel)
{ unsigned int value; ASSERT((bitsPerPixel & ~AT91C_LCDC_PIXELSIZE) == 0, "LCD_SetScanMode: Wrong bitsPerPixel value.\n\r"); value = AT91C_BASE_LCDC->LCDC_LCDCON2; value &= ~AT91C_LCDC_PIXELSIZE; value |= bitsPerPixel; AT91C_BASE_LCDC->LCDC_LCDCON2 = value; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Change Logs: Date Author Notes lizhirui first version */
void mmu_enable_user_page_access()
/* Change Logs: Date Author Notes lizhirui first version */ void mmu_enable_user_page_access()
{ set_csr(sstatus,SSTATUS_SUM); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* return kStatus_Success: Success in setting the time and starting the SNVS SRTC kStatus_InvalidArgument: Error because the datetime format is incorrect */
status_t SNVS_LP_SRTC_SetDatetime(SNVS_Type *base, const snvs_lp_srtc_datetime_t *datetime)
/* return kStatus_Success: Success in setting the time and starting the SNVS SRTC kStatus_InvalidArgument: Error because the datetime format is incorrect */ status_t SNVS_LP_SRTC_SetDatetime(SNVS_Type *base, const snvs_lp_srtc_datetime_t *datetime)
{ assert(datetime); uint32_t seconds = 0U; uint32_t tmp = base->LPCR; SNVS_LP_SRTC_StopTimer(base); if (!(SNVS_LP_CheckDatetimeFormat(datetime))) { return kStatus_InvalidArgument; } seconds = SNVS_LP_ConvertDatetimeToSeconds(datetime); base->LPSRTCMR = (uint32_t)(seconds >> 17U); base->LPSRTCLR = (uint32_t)(seconds << 15U); if (tmp & SNVS_LPCR_SRTC_ENV_MASK) { SNVS_LP_SRTC_StartTimer(base); } return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* DMA Channel Disable Memory Increment after Transfer. Ensure that the stream is disabled otherwise the setting will not be changed. */
void dma_disable_memory_increment_mode(uint32_t dma, uint8_t stream)
/* DMA Channel Disable Memory Increment after Transfer. Ensure that the stream is disabled otherwise the setting will not be changed. */ void dma_disable_memory_increment_mode(uint32_t dma, uint8_t stream)
{ DMA_SCR(dma, stream) &= ~DMA_SxCR_MINC; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Returns 1 if successful, -EINVAL if m is NULL, or -ENOMEM if there is insufficient memory to add the menu item. */
int menu_item_add(struct menu *m, char *item_key, void *item_data)
/* Returns 1 if successful, -EINVAL if m is NULL, or -ENOMEM if there is insufficient memory to add the menu item. */ int menu_item_add(struct menu *m, char *item_key, void *item_data)
{ struct menu_item *item; if (!m) return -EINVAL; item = menu_item_by_key(m, item_key); if (item) { item->data = item_data; return 1; } item = malloc(sizeof *item); if (!item) return -ENOMEM; item->key = strdup(item_key); if (!item->key) { free(item); return -ENOMEM; } item->data = item_data; list_add_tail(&item->list, &m->items); m->item_cnt++; return 1; }
4ms/stm32mp1-baremetal
C++
Other
137
/* ixgbe_receive_skb - Send a completed packet up the stack @adapter: board private structure @skb: packet to send up @status: hardware indication of status of receive @rx_ring: rx descriptor ring (for a specific queue) to setup @rx_desc: rx descriptor */
static void ixgbe_receive_skb(struct ixgbe_q_vector *q_vector, struct sk_buff *skb, u8 status, struct ixgbe_ring *ring, union ixgbe_adv_rx_desc *rx_desc)
/* ixgbe_receive_skb - Send a completed packet up the stack @adapter: board private structure @skb: packet to send up @status: hardware indication of status of receive @rx_ring: rx descriptor ring (for a specific queue) to setup @rx_desc: rx descriptor */ static void ixgbe_receive_skb(struct ixgbe_q_vector *q_vector, struct sk_buff *skb, u8 status, struct ixgbe_ring *ring, union ixgbe_adv_rx_desc *rx_desc)
{ struct ixgbe_adapter *adapter = q_vector->adapter; struct napi_struct *napi = &q_vector->napi; bool is_vlan = (status & IXGBE_RXD_STAT_VP); u16 tag = le16_to_cpu(rx_desc->wb.upper.vlan); skb_record_rx_queue(skb, ring->queue_index); if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) { if (adapter->vlgrp && is_vlan && (tag & VLAN_VID_MASK)) vlan_gro_receive(napi, adapter->vlgrp, tag, skb); else napi_gro_receive(napi, skb); } else { if (adapter->vlgrp && is_vlan && (tag & VLAN_VID_MASK)) vlan_hwaccel_rx(skb, adapter->vlgrp, tag); else netif_rx(skb); } }
robutest/uclinux
C++
GPL-2.0
60
/* De-initialize GPIO handle. stops operation and releases the software resources used by the handle. */
int32_t csi_gpio_port_uninitialize(gpio_port_handle_t handle)
/* De-initialize GPIO handle. stops operation and releases the software resources used by the handle. */ int32_t csi_gpio_port_uninitialize(gpio_port_handle_t handle)
{ GPIO_NULL_PARAM_CHK(handle); dw_gpio_priv_t *gpio_priv = handle; gpio_priv->cb = NULL; drv_nvic_disable_irq(gpio_priv->irq); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads the values present of the specified Port. */
unsigned long xGPIOPortRead(unsigned long ulPort)
/* Reads the values present of the specified Port. */ unsigned long xGPIOPortRead(unsigned long ulPort)
{ return xHWREG(ulPort +GPIO_PIN ); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* param pfd Which PFD clock to enable. param pfdFrac The PFD FRAC value. note It is recommended that PFD settings are kept between 12-35. */
void CLOCK_InitSysPfd(clock_pfd_t pfd, uint8_t pfdFrac)
/* param pfd Which PFD clock to enable. param pfdFrac The PFD FRAC value. note It is recommended that PFD settings are kept between 12-35. */ void CLOCK_InitSysPfd(clock_pfd_t pfd, uint8_t pfdFrac)
{ uint32_t pfdIndex = (uint32_t)pfd; uint32_t pfd528; pfd528 = CCM_ANALOG->PFD_528 & ~(((uint32_t)((uint32_t)CCM_ANALOG_PFD_528_PFD0_CLKGATE_MASK | (uint32_t)CCM_ANALOG_PFD_528_PFD0_FRAC_MASK) << (8UL * pfdIndex))); CCM_ANALOG->PFD_528 = pfd528 | ((uint32_t)CCM_ANALOG_PFD_528_PFD0_CLKGATE_MASK << (8UL * pfdIndex)); CCM_ANALOG->PFD_528 = pfd528 | (CCM_ANALOG_PFD_528_PFD0_FRAC(pfdFrac) << (8UL * pfdIndex)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Note, if channel = -1, multi-channel receive is enabled. */
struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host, unsigned int data_buf_size, unsigned int buf_packets, int channel, int dma_mode, int irq_interval, void(*callback)(struct hpsb_iso *))
/* Note, if channel = -1, multi-channel receive is enabled. */ struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host, unsigned int data_buf_size, unsigned int buf_packets, int channel, int dma_mode, int irq_interval, void(*callback)(struct hpsb_iso *))
{ struct hpsb_iso *iso = hpsb_iso_common_init(host, HPSB_ISO_RECV, data_buf_size, buf_packets, channel, dma_mode, irq_interval, callback); if (!iso) return NULL; if (host->driver->isoctl(iso, RECV_INIT, 0)) goto err; iso->flags |= HPSB_ISO_DRIVER_INIT; return iso; err: hpsb_iso_shutdown(iso); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Check if we have pending interrupts to process. Returns 1 if we have pending interrupts and 0 if we haven't. */
bool ath5k_hw_is_intr_pending(struct ath5k_hw *ah)
/* Check if we have pending interrupts to process. Returns 1 if we have pending interrupts and 0 if we haven't. */ bool ath5k_hw_is_intr_pending(struct ath5k_hw *ah)
{ ATH5K_TRACE(ah->ah_sc); return ath5k_hw_reg_read(ah, AR5K_INTPEND) == 1 ? 1 : 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Sets the feature bit (controls blinking, clock source, etc.) */
as1115Error_t as1115SetFeature(uint8_t feature)
/* Sets the feature bit (controls blinking, clock source, etc.) */ as1115Error_t as1115SetFeature(uint8_t feature)
{ as1115Error_t error = AS1115_ERROR_OK; error = as1115WriteCmdData(AS1115_SUBADDRESS, AS1115_FEATURE, feature); return error; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Write the graphical memory with a single color pixel. Limits have to be set prior to calling this function, e.g.: */
void ili9325_write_gram(ili9325_color_t color)
/* Write the graphical memory with a single color pixel. Limits have to be set prior to calling this function, e.g.: */ void ili9325_write_gram(ili9325_color_t color)
{ Assert(sizeof(color) == 2); LCD_IR(0); LCD_IR(ILI9325_GRAM_DATA_REG); LCD_WD((color >> 16) & 0xFF); LCD_WD((color >> 8) & 0xFF); LCD_WD(color & 0xFF); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Add a new offload packet to an SGE response queue's offload packet queue. If the packet is the first on the queue it schedules the RX softirq to process the queue. */
static void offload_enqueue(struct sge_rspq *q, struct sk_buff *skb)
/* Add a new offload packet to an SGE response queue's offload packet queue. If the packet is the first on the queue it schedules the RX softirq to process the queue. */ static void offload_enqueue(struct sge_rspq *q, struct sk_buff *skb)
{ int was_empty = skb_queue_empty(&q->rx_queue); __skb_queue_tail(&q->rx_queue, skb); if (was_empty) { struct sge_qset *qs = rspq_to_qset(q); napi_schedule(&qs->napi); } }
robutest/uclinux
C++
GPL-2.0
60
/* Search for an interface by index. Returns NULL if the device is not found or a pointer to the device. The device has not had its reference counter increased so the caller must be careful about locking. The caller must hold either the RTNL semaphore or @dev_base_lock. */
struct net_device* __dev_get_by_index(struct net *net, int ifindex)
/* Search for an interface by index. Returns NULL if the device is not found or a pointer to the device. The device has not had its reference counter increased so the caller must be careful about locking. The caller must hold either the RTNL semaphore or @dev_base_lock. */ struct net_device* __dev_get_by_index(struct net *net, int ifindex)
{ struct hlist_node *p; struct net_device *dev; struct hlist_head *head = dev_index_hash(net, ifindex); hlist_for_each_entry(dev, p, head, index_hlist) if (dev->ifindex == ifindex) return dev; return NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns a textual description of the method or response code. */
static const char* msg_code_string(uint8_t c)
/* Returns a textual description of the method or response code. */ static const char* msg_code_string(uint8_t c)
{ "0.00", "GET", "POST", "PUT", "DELETE", "PATCH" }; static char buf[5]; if (c < sizeof(methods)/sizeof(char *)) { return methods[c]; } else { snprintf(buf, sizeof(buf), "%u.%02u", c >> 5, c & 0x1f); return buf; } }
Nicholas3388/LuaNode
C++
Other
1,055
/* Decrease the reference count of the net vector by one. The real resource free operation isn't performed until the reference count of the net vector is decreased to 0. */
VOID NetbufFreeVector(IN NET_VECTOR *Vector)
/* Decrease the reference count of the net vector by one. The real resource free operation isn't performed until the reference count of the net vector is decreased to 0. */ VOID NetbufFreeVector(IN NET_VECTOR *Vector)
{ UINT32 Index; ASSERT (Vector != NULL); NET_CHECK_SIGNATURE (Vector, NET_VECTOR_SIGNATURE); ASSERT (Vector->RefCnt > 0); Vector->RefCnt--; if (Vector->RefCnt > 0) { return; } if (Vector->Free != NULL) { if ((Vector->Flag & NET_VECTOR_OWN_FIRST) != 0) { gBS->FreePool (Vector->Block[0].Bulk); } Vector->Free (Vector->Arg); } else { for (Index = 0; Index < Vector->BlockNum; Index++) { gBS->FreePool (Vector->Block[Index].Bulk); } } FreePool (Vector); }
tianocore/edk2
C++
Other
4,240
/* Write the value @value of size @size from offset @offset within the configuration space of the device identified by the bus, device & function numbers in @bdf on the PCI bus @bus. */
static int pci_generic_ecam_write_config(struct udevice *bus, pci_dev_t bdf, uint offset, ulong value, enum pci_size_t size)
/* Write the value @value of size @size from offset @offset within the configuration space of the device identified by the bus, device & function numbers in @bdf on the PCI bus @bus. */ static int pci_generic_ecam_write_config(struct udevice *bus, pci_dev_t bdf, uint offset, ulong value, enum pci_size_t size)
{ return pci_generic_mmap_write_config(bus, pci_generic_ecam_conf_address, bdf, offset, value, size); }
4ms/stm32mp1-baremetal
C++
Other
137
/* sc6000_irq_to_softcfg - Decode irq number into cfg code. */
static __devinit unsigned char sc6000_irq_to_softcfg(int irq)
/* sc6000_irq_to_softcfg - Decode irq number into cfg code. */ static __devinit unsigned char sc6000_irq_to_softcfg(int irq)
{ unsigned char val = 0; switch (irq) { case 5: val = 0x28; break; case 7: val = 0x8; break; case 9: val = 0x10; break; case 10: val = 0x18; break; case 11: val = 0x20; break; default: break; } return val; }
robutest/uclinux
C++
GPL-2.0
60
/* As much as I'd like to make X509_check_purpose use a "const" X509* I really can't because it does recalculate hashes and do other non-const things. */
int X509_check_purpose(X509 *x, int id, int ca)
/* As much as I'd like to make X509_check_purpose use a "const" X509* I really can't because it does recalculate hashes and do other non-const things. */ int X509_check_purpose(X509 *x, int id, int ca)
{ int idx; const X509_PURPOSE *pt; if (!(x->ex_flags & EXFLAG_SET)) { x509v3_cache_extensions(x); } if (id == -1) return 1; idx = X509_PURPOSE_get_by_id(id); if (idx == -1) return -1; pt = X509_PURPOSE_get0(idx); return pt->check_purpose(pt, x, ca); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Sets the threshold value of the constrast PWM. */
void LCD_SetContrastValue(unsigned int value)
/* Sets the threshold value of the constrast PWM. */ void LCD_SetContrastValue(unsigned int value)
{ ASSERT((value & ~AT91C_LCDC_CVAL) == 0, "LCD_SetContrastValue: Wrong value.\n\r"); AT91C_BASE_LCDC->LCDC_CTRSTVAL = value; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Enables or disables ADC upper threshold detect function. */
void ADC_UpperTHDCmd(uint32_t THDChannel, uint32_t NewState)
/* Enables or disables ADC upper threshold detect function. */ void ADC_UpperTHDCmd(uint32_t THDChannel, uint32_t NewState)
{ assert_parameters(IS_ADC_THDCHANNEL(THDChannel)); assert_parameters(IS_FUNCTIONAL_STATE(NewState)); if (NewState == DISABLE) { ANA->ADCCTRL1 &= ~(ANA_ADCCTRL1_UPPER_THD0_EN << (THDChannel*2)); } else { ANA->ADCCTRL1 |= (ANA_ADCCTRL1_UPPER_THD0_EN << (THDChannel*2)); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads data from a serial device into a buffer. */
UINTN EFIAPI SerialPortRead(OUT UINT8 *Buffer, IN UINTN NumberOfBytes)
/* Reads data from a serial device into a buffer. */ UINTN EFIAPI SerialPortRead(OUT UINT8 *Buffer, IN UINTN NumberOfBytes)
{ UINTN Result; UINT8 Data; if (NULL == Buffer) { return 0; } Result = NumberOfBytes; while ((NumberOfBytes--) != 0) { do { Data = IoRead8 ((UINT16)gUartBase + LSR_OFFSET); } while ((Data & LSR_RXDA) == 0); *Buffer++ = IoRead8 ((UINT16)gUartBase); } return Result; }
tianocore/edk2
C++
Other
4,240
/* The accuracy of the interrupt timing depends on the Ethernet timer update frequency and the subsecond increment value currently in use. The interrupt is generated on the first timer increment that causes the system time to be greater than or equal to the target time set. */
void EMACTimestampTargetSet(uint32_t ui32Base, uint32_t ui32Seconds, uint32_t ui32SubSeconds)
/* The accuracy of the interrupt timing depends on the Ethernet timer update frequency and the subsecond increment value currently in use. The interrupt is generated on the first timer increment that causes the system time to be greater than or equal to the target time set. */ void EMACTimestampTargetSet(uint32_t ui32Base, uint32_t ui32Seconds, uint32_t ui32SubSeconds)
{ ASSERT(ui32Base == EMAC0_BASE); while (HWREG(ui32Base + EMAC_O_TARGNANO) & EMAC_TARGNANO_TRGTBUSY) { } HWREG(ui32Base + EMAC_O_TARGSEC) = ui32Seconds; HWREG(ui32Base + EMAC_O_TARGNANO) = ui32SubSeconds; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* brief Return Frequency of FlexSpi clock return Frequency of FlexSpi Clock */
uint32_t CLOCK_GetFlexSpiClkFreq(void)
/* brief Return Frequency of FlexSpi clock return Frequency of FlexSpi Clock */ uint32_t CLOCK_GetFlexSpiClkFreq(void)
{ uint32_t freq = 0U; switch (SYSCON->FLEXSPICLKSEL) { case 0U: freq = CLOCK_GetCoreSysClkFreq(); break; case 1U: freq = CLOCK_GetPll0OutFreq(); break; case 3U: freq = CLOCK_GetFroHfFreq(); break; case 5U: freq = CLOCK_GetPll1OutFreq(); break; case 7U: freq = 0U; break; default: freq = 0U; break; } return freq / ((SYSCON->FLEXSPICLKDIV & SYSCON_FLEXSPICLKDIV_DIV_MASK) + 1U); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Please refer to the official documentation for function purpose and expected parameters. */
int ph7_result_null(ph7_context *pCtx)
/* Please refer to the official documentation for function purpose and expected parameters. */ int ph7_result_null(ph7_context *pCtx)
{ return ph7_value_double(pCtx->pRet,Value); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Checks whether the specified DAC flag is set or not. */
FlagStatus DAC_GetFlagStatus(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t DAC_FLAG)
/* Checks whether the specified DAC flag is set or not. */ FlagStatus DAC_GetFlagStatus(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t DAC_FLAG)
{ FlagStatus bitstatus = RESET; assert_param(IS_DAC_ALL_PERIPH(DACx)); assert_param(IS_DAC_CHANNEL(DAC_Channel)); assert_param(IS_DAC_FLAG(DAC_FLAG)); if ((DACx->SR & (DAC_FLAG << DAC_Channel)) != (uint8_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
avem-labs/Avem
C++
MIT License
1,752
/* phy_stop_interrupts - disable interrupts from a PHY device @phydev: target phy_device struct */
int phy_stop_interrupts(struct phy_device *phydev)
/* phy_stop_interrupts - disable interrupts from a PHY device @phydev: target phy_device struct */ int phy_stop_interrupts(struct phy_device *phydev)
{ int err; err = phy_disable_interrupts(phydev); if (err) phy_error(phydev); free_irq(phydev->irq, phydev); cancel_work_sync(&phydev->phy_queue); while (atomic_dec_return(&phydev->irq_disable) >= 0) enable_irq(phydev->irq); return err; }
robutest/uclinux
C++
GPL-2.0
60
/* Set the cursor, the display and address counter to zero. */
void LCD1602Home(void)
/* Set the cursor, the display and address counter to zero. */ void LCD1602Home(void)
{ LCD1602IICWriteCmd(LCD1602IIC_RETURNHOME); IICDelay(50000); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Poll timer has expired. Normally we must now send a RR frame to the remote device */
static void irlap_poll_timer_expired(void *data)
/* Poll timer has expired. Normally we must now send a RR frame to the remote device */ static void irlap_poll_timer_expired(void *data)
{ struct irlap_cb *self = (struct irlap_cb *) data; IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == LAP_MAGIC, return;); irlap_do_event(self, POLL_TIMER_EXPIRED, NULL, NULL); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This API is used to set the status of fast offset compensation(cal_rdy) in the register 0x36 bit 4(Read Only Possible) */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_set_cal_trigger(u8 cal_trigger_u8)
/* This API is used to set the status of fast offset compensation(cal_rdy) in the register 0x36 bit 4(Read Only Possible) */ BMA2x2_RETURN_FUNCTION_TYPE bma2x2_set_cal_trigger(u8 cal_trigger_u8)
{ u8 data_u8 = BMA2x2_INIT_VALUE; BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR; if (p_bma2x2 == BMA2x2_NULL) { return E_BMA2x2_NULL_PTR; } else { com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC (p_bma2x2->dev_addr, BMA2x2_CAL_TRIGGER_REG, &data_u8, BMA2x2_GEN_READ_WRITE_LENGTH); data_u8 = BMA2x2_SET_BITSLICE(data_u8, BMA2x2_CAL_TRIGGER, cal_trigger_u8); com_rslt += bma2x2_write_reg( BMA2x2_CAL_TRIGGER_REG, &data_u8, BMA2x2_GEN_READ_WRITE_LENGTH); } return com_rslt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Serialize a floating-point number in such a way that it can be scanned back by Lua. Use hexadecimal format for "common" numbers (to preserve precision); inf, -inf, and NaN are handled separately. (NaN cannot be expressed as a numeral, so we write '(0/0)' for it.) */
static int quotefloat(lua_State *L, char *buff, lua_Number n)
/* Serialize a floating-point number in such a way that it can be scanned back by Lua. Use hexadecimal format for "common" numbers (to preserve precision); inf, -inf, and NaN are handled separately. (NaN cannot be expressed as a numeral, so we write '(0/0)' for it.) */ static int quotefloat(lua_State *L, char *buff, lua_Number n)
{ int nb = lua_number2strx(L, buff, MAX_ITEM, "%" LUA_NUMBER_FRMLEN "a", n); if (memchr(buff, '.', nb) == NULL) { char point = lua_getlocaledecpoint(); char *ppoint = (char *)memchr(buff, point, nb); if (ppoint) *ppoint = '.'; } return nb; } return l_sprintf(buff, MAX_ITEM, "%s", s); }
Nicholas3388/LuaNode
C++
Other
1,055
/* Initialise the serial port with the given baudrate. The settings are always 8 data bits, no parity, 1 stop bit, no start bits. */
static int mxc_serial_init(void)
/* Initialise the serial port with the given baudrate. The settings are always 8 data bits, no parity, 1 stop bit, no start bits. */ static int mxc_serial_init(void)
{ _mxc_serial_init(mxc_base, false); serial_setbrg(); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Unaligned safe copy of a uint64 value from an octet array. */
static uint64 TIFFReadUInt64(const uint8 *value)
/* Unaligned safe copy of a uint64 value from an octet array. */ static uint64 TIFFReadUInt64(const uint8 *value)
{ UInt64Aligned_t result; result.c[0]=value[0]; result.c[1]=value[1]; result.c[2]=value[2]; result.c[3]=value[3]; result.c[4]=value[4]; result.c[5]=value[5]; result.c[6]=value[6]; result.c[7]=value[7]; return result.l; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Power config will reset and load initial firmware if required */
static int ds3000_initfe(struct dvb_frontend *fe)
/* Power config will reset and load initial firmware if required */ static int ds3000_initfe(struct dvb_frontend *fe)
{ dprintk("%s()\n", __func__); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
/* UART MSP Initialization This function configures the hardware resources used in this example. */ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(huart->Instance==USART3) { __HAL_RCC_USART3_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_11; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF7_USART3; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function sets up the seed value for the pseudorandom number generator. If Seed is not NULL, then the seed passed in is used. If Seed is NULL, then default seed is used. */
BOOLEAN EFIAPI RandomSeed(IN CONST UINT8 *Seed OPTIONAL, IN UINTN SeedSize)
/* This function sets up the seed value for the pseudorandom number generator. If Seed is not NULL, then the seed passed in is used. If Seed is NULL, then default seed is used. */ BOOLEAN EFIAPI RandomSeed(IN CONST UINT8 *Seed OPTIONAL, IN UINTN SeedSize)
{ CHAR8 DefaultSeed[128]; if (SeedSize > INT_MAX) { return FALSE; } if (EVP_add_digest (EVP_sha1 ()) == 0) { return FALSE; } if (Seed != NULL) { RAND_seed (Seed, (UINT32)SeedSize); } else { AsciiSPrint ( DefaultSeed, sizeof (DefaultSeed), "UEFI Crypto Library default seed (%ld)", AsmReadTsc () ); RAND_seed (DefaultSeed, sizeof (DefaultSeed)); } if (RAND_status () == 1) { return TRUE; } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* Returns NULL if there is an error, otherwise, returns a pointer to a pxe_menu struct populated with the results of parsing the pxe file (and any files it includes). The resulting pxe_menu struct can be free()'d by using the destroy_pxe_menu() function. */
struct pxe_menu* parse_pxefile(cmd_tbl_t *cmdtp, unsigned long menucfg)
/* Returns NULL if there is an error, otherwise, returns a pointer to a pxe_menu struct populated with the results of parsing the pxe file (and any files it includes). The resulting pxe_menu struct can be free()'d by using the destroy_pxe_menu() function. */ struct pxe_menu* parse_pxefile(cmd_tbl_t *cmdtp, unsigned long menucfg)
{ struct pxe_menu *cfg; char *buf; int r; cfg = malloc(sizeof(struct pxe_menu)); if (!cfg) return NULL; memset(cfg, 0, sizeof(struct pxe_menu)); INIT_LIST_HEAD(&cfg->labels); buf = map_sysmem(menucfg, 0); r = parse_pxefile_top(cmdtp, buf, menucfg, cfg, 1); unmap_sysmem(buf); if (r < 0) { destroy_pxe_menu(cfg); return NULL; } return cfg; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Given the flash address, return the block number. Return error if the address is not a start block address. */
static s32 stm32_flash_get_block(u8 *addr)
/* Given the flash address, return the block number. Return error if the address is not a start block address. */ static s32 stm32_flash_get_block(u8 *addr)
{ s32 i = 0; u8 *base = (u8 *)CONFIG_MEM_NVM_BASE; while (i < STM32_FLASH_BLOCKS) { if (addr == base) break; base += flash_bsize[i]; i++; } if (i == STM32_FLASH_BLOCKS) i = -EINVAL; return i; }
EmcraftSystems/u-boot
C++
Other
181
/* In NFSv3 we can have 64bit inode numbers. In order to support this, and re-exported directories (also seen in NFSv2) we are forced to allow 2 different inodes to have the same i_ino. */
static int nfs_find_actor(struct inode *inode, void *opaque)
/* In NFSv3 we can have 64bit inode numbers. In order to support this, and re-exported directories (also seen in NFSv2) we are forced to allow 2 different inodes to have the same i_ino. */ static int nfs_find_actor(struct inode *inode, void *opaque)
{ struct nfs_find_desc *desc = (struct nfs_find_desc *)opaque; struct nfs_fh *fh = desc->fh; struct nfs_fattr *fattr = desc->fattr; if (NFS_FILEID(inode) != fattr->fileid) return 0; if (nfs_compare_fh(NFS_FH(inode), fh)) return 0; if (is_bad_inode(inode) || NFS_STALE(inode)) return 0; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Unregister a function that was added to be called by ftrace profiling. */
int unregister_ftrace_function(struct ftrace_ops *ops)
/* Unregister a function that was added to be called by ftrace profiling. */ int unregister_ftrace_function(struct ftrace_ops *ops)
{ int ret; mutex_lock(&ftrace_lock); ret = __unregister_ftrace_function(ops); ftrace_shutdown(0); mutex_unlock(&ftrace_lock); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Release all memory associated with X.25 neighbour structures. */
void __exit x25_link_free(void)
/* Release all memory associated with X.25 neighbour structures. */ void __exit x25_link_free(void)
{ struct x25_neigh *nb; struct list_head *entry, *tmp; write_lock_bh(&x25_neigh_list_lock); list_for_each_safe(entry, tmp, &x25_neigh_list) { nb = list_entry(entry, struct x25_neigh, node); __x25_remove_neigh(nb); } write_unlock_bh(&x25_neigh_list_lock); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Calls the given function for each data element which is associated with the given location. Note that this function is NOT thread-safe. So unless @datalist can be protected from any modifications during invocation of this function, it should not be called. */
void g_dataset_foreach(gconstpointer dataset_location, GDataForeachFunc func, gpointer user_data)
/* Calls the given function for each data element which is associated with the given location. Note that this function is NOT thread-safe. So unless @datalist can be protected from any modifications during invocation of this function, it should not be called. */ void g_dataset_foreach(gconstpointer dataset_location, GDataForeachFunc func, gpointer user_data)
{ GDataset *dataset; g_return_if_fail (dataset_location != NULL); g_return_if_fail (func != NULL); G_LOCK (g_dataset_global); if (g_dataset_location_ht) { dataset = g_dataset_lookup (dataset_location); G_UNLOCK (g_dataset_global); if (dataset) g_datalist_foreach (&dataset->datalist, func, user_data); } else { G_UNLOCK (g_dataset_global); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Checks whether the specified I2C flag is set or not. */
FlagStatus I2C_GetFlagStatus(I2C_TypeDef *I2Cx, uint32_t I2C_FLAG)
/* Checks whether the specified I2C flag is set or not. */ FlagStatus I2C_GetFlagStatus(I2C_TypeDef *I2Cx, uint32_t I2C_FLAG)
{ FlagStatus bitstatus = RESET; __IO uint32_t i2creg = 0, i2cxbase = 0; assert_param(IS_I2C_ALL_PERIPH(I2Cx)); assert_param(IS_I2C_GET_FLAG(I2C_FLAG)); i2cxbase = (uint32_t)I2Cx; i2creg = I2C_FLAG >> 28; I2C_FLAG &= FLAG_MASK; if(i2creg != 0) { i2cxbase += 0x14; } else { I2C_FLAG = (uint32_t)(I2C_FLAG >> 16); i2cxbase += 0x18; } if(((*(__IO uint32_t *)i2cxbase) & I2C_FLAG) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
MaJerle/stm32f429
C++
null
2,036
/* Writes a 16/32-bit data word to Remote CPU System address */
uint16_t IPCLiteLtoRDataWrite(uint32_t ulFlag, uint32_t ulAddress, uint32_t ulData, uint16_t usLength, uint32_t ulStatusFlag)
/* Writes a 16/32-bit data word to Remote CPU System address */ uint16_t IPCLiteLtoRDataWrite(uint32_t ulFlag, uint32_t ulAddress, uint32_t ulData, uint16_t usLength, uint32_t ulStatusFlag)
{ uint16_t returnStatus; if (IpcRegs.IPCFLG.all & (ulFlag | ulStatusFlag)) { returnStatus = STATUS_FAIL; } else { if (usLength == IPC_LENGTH_16_BITS) { IpcRegs.IPCSENDCOM = IPC_DATA_WRITE_16; } else if (usLength == IPC_LENGTH_32_BITS) { IpcRegs.IPCSENDCOM = IPC_DATA_WRITE_32; } IpcRegs.IPCSENDADDR = ulAddress; IpcRegs.IPCSENDDATA = ulData; IpcRegs.IPCSET.all |= (ulFlag | ulStatusFlag); returnStatus = STATUS_PASS; } return returnStatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the combo box entry string given a channel frequency */
void airpcap_channel_combo_set_by_frequency(GtkWidget *cb, guint chan_freq)
/* Set the combo box entry string given a channel frequency */ void airpcap_channel_combo_set_by_frequency(GtkWidget *cb, guint chan_freq)
{ guint i; for (i = 0; i < airpcap_if_selected->numSupportedChannels; i++) { if (airpcap_if_selected->pSupportedChannels[i].Frequency == chan_freq) { gtk_combo_box_set_active(GTK_COMBO_BOX(cb), i); break; } } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* atl1c_phy_config - Timer Call-back @data: pointer to netdev cast into an unsigned long */
static void atl1c_phy_config(unsigned long data)
/* atl1c_phy_config - Timer Call-back @data: pointer to netdev cast into an unsigned long */ static void atl1c_phy_config(unsigned long data)
{ struct atl1c_adapter *adapter = (struct atl1c_adapter *) data; struct atl1c_hw *hw = &adapter->hw; unsigned long flags; spin_lock_irqsave(&adapter->mdio_lock, flags); atl1c_restart_autoneg(hw); spin_unlock_irqrestore(&adapter->mdio_lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Disable the MMC ipc rx checksum offload interrupt. The MMC ipc rx checksum offload interrupts are masked out as per the mask specified. */
void synopGMAC_disable_mmc_ipc_rx_interrupt(synopGMACdevice *gmacdev, u32 mask)
/* Disable the MMC ipc rx checksum offload interrupt. The MMC ipc rx checksum offload interrupts are masked out as per the mask specified. */ void synopGMAC_disable_mmc_ipc_rx_interrupt(synopGMACdevice *gmacdev, u32 mask)
{ synopGMACSetBits(gmacdev->MacBase, GmacMmcRxIpcIntrMask, mask); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Handler for feature unit mute control requests. This function handles feature unit mute control request. */
static int handle_fu_mute_req(struct usb_audio_dev_data *audio_dev_data, struct usb_setup_packet *setup, int32_t *len, uint8_t **data, struct usb_audio_fu_evt *evt, uint8_t device)
/* Handler for feature unit mute control requests. This function handles feature unit mute control request. */ static int handle_fu_mute_req(struct usb_audio_dev_data *audio_dev_data, struct usb_setup_packet *setup, int32_t *len, uint8_t **data, struct usb_audio_fu_evt *evt, uint8_t device)
{ uint8_t ch = (setup->wValue) & 0xFF; uint8_t ch_cnt = audio_dev_data->ch_cnt[device]; uint8_t *controls = audio_dev_data->controls[device]; uint8_t *control_val = &controls[POS(MUTE, ch, ch_cnt)]; if (usb_reqtype_is_to_device(setup)) { if (*len != LEN(1, MUTE)) { return -EINVAL; } if (setup->bRequest == USB_AUDIO_SET_CUR) { evt->val = control_val; evt->val_len = *len; memcpy(control_val, *data, *len); return 0; } } else { if (setup->bRequest == USB_AUDIO_GET_CUR) { *data = control_val; *len = LEN(1, MUTE); return 0; } } return -EINVAL; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573