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
/* Register address automatically incremented during a multiple byte access with a serial interface.. */
int32_t lsm6dso_auto_increment_get(stmdev_ctx_t *ctx, uint8_t *val)
/* Register address automatically incremented during a multiple byte access with a serial interface.. */ int32_t lsm6dso_auto_increment_get(stmdev_ctx_t *ctx, uint8_t *val)
{ lsm6dso_ctrl3_c_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL3_C, (uint8_t *)&reg, 1); *val = reg.if_inc; return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* This function configures the source of the time base. The time source is configured to have 1ms time base with a dedicated Tick interrupt priority. */
__weak void ald_tick_init(uint32_t prio)
/* This function configures the source of the time base. The time source is configured to have 1ms time base with a dedicated Tick interrupt priority. */ __weak void ald_tick_init(uint32_t prio)
{ SysTick_Config(ald_cmu_get_sys_clock() / SYSTICK_INTERVAL_1MS); if (prio != 3) NVIC_SetPriority(SysTick_IRQn, prio); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Checks whether the specified I2C flag is set or not. */
FlagStatus I2C_GetFlagStatus(I2C_TypeDef *i2c, u32 flag)
/* Checks whether the specified I2C flag is set or not. */ FlagStatus I2C_GetFlagStatus(I2C_TypeDef *i2c, u32 flag)
{ if (flag & 0x8000) return ((i2c->IC_STATUS & flag) ? SET : RESET); if ((flag == I2C_FLAG_RX_FULL) && (I2C_CMD_DIR == 0)) { i2c->IC_DATA_CMD = I2C_DR_CMD; I2C_CMD_DIR = 1; } return (((i2c->IC_RAW_INTR_STAT & flag)) ? SET : RESET); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Attribute read call back for the Long descriptor V2D2 attribute. */
static ssize_t read_long_des_v2d2_2(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
/* Attribute read call back for the Long descriptor V2D2 attribute. */ static ssize_t read_long_des_v2d2_2(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
{ const uint8_t *value = attr->user_data; if (!bAuthorized) return BT_GATT_ERR(BT_ATT_ERR_AUTHORIZATION); return bt_gatt_attr_read(conn, attr, buf, len, offset, value, sizeof(long_des_v2d2_2_value)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* display mapping lines for a particular process's /proc/pid/maps */
static int show_map(struct seq_file *m, void *_p)
/* display mapping lines for a particular process's /proc/pid/maps */ static int show_map(struct seq_file *m, void *_p)
{ struct rb_node *p = _p; return nommu_vma_show(m, rb_entry(p, struct vm_area_struct, vm_rb)); }
robutest/uclinux
C++
GPL-2.0
60
/* If Buffer was not allocated with a pool allocation function in the Memory Allocation Library, then ASSERT(). */
VOID EFIAPI FreePool(IN VOID *Buffer)
/* If Buffer was not allocated with a pool allocation function in the Memory Allocation Library, then ASSERT(). */ VOID EFIAPI FreePool(IN VOID *Buffer)
{ EFI_STATUS Status; Status = gBS->FreePool (Buffer); ASSERT_EFI_ERROR (Status); }
tianocore/edk2
C++
Other
4,240
/* Slaves start using C here. Indirectly called from smp_slave_stext. Do what start_kernel() and main() do for boot strap processor (aka monarch) */
void __init smp_callin(void)
/* Slaves start using C here. Indirectly called from smp_slave_stext. Do what start_kernel() and main() do for boot strap processor (aka monarch) */ void __init smp_callin(void)
{ int slave_id = cpu_now_booting; smp_cpu_init(slave_id); preempt_disable(); flush_cache_all_local(); flush_tlb_all_local(NULL); local_irq_enable(); cpu_idle(); panic("smp_callin() AAAAaaaaahhhh....\n"); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* After the last attribute is removed revert to original inode format, making all literal area available to the data fork once more. */
STATIC void xfs_attr_fork_reset(struct xfs_inode *ip, struct xfs_trans *tp)
/* After the last attribute is removed revert to original inode format, making all literal area available to the data fork once more. */ STATIC void xfs_attr_fork_reset(struct xfs_inode *ip, struct xfs_trans *tp)
{ xfs_idestroy_fork(ip, XFS_ATTR_FORK); ip->i_d.di_forkoff = 0; ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS; ASSERT(ip->i_d.di_anextents == 0); ASSERT(ip->i_afp == NULL); ip->i_df.if_ext_max = XFS_IFORK_DSIZE(ip) / sizeof(xfs_bmbt_rec_t); xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); }
robutest/uclinux
C++
GPL-2.0
60
/* Determines the flash sector the address is in. */
static blt_int8u FlashGetSector(blt_addr address)
/* Determines the flash sector the address is in. */ static blt_int8u FlashGetSector(blt_addr address)
{ blt_int8u sectorIdx; for (sectorIdx = 0; sectorIdx < FLASH_TOTAL_SECTORS; sectorIdx++) { CopService(); if ((address >= flashLayout[sectorIdx].sector_start) && \ (address < (flashLayout[sectorIdx].sector_start + \ flashLayout[sectorIdx].sector_size))) { return flashLayout[sectorIdx].sector_num; } } return FLASH_INVALID_SECTOR; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Finds the minimum angle difference ang1-ang2 such that difference is between */
float inv_angle_diff(float ang1, float ang2)
/* Finds the minimum angle difference ang1-ang2 such that difference is between */ float inv_angle_diff(float ang1, float ang2)
{ float d; ang1 = inv_wrap_angle(ang1); ang2 = inv_wrap_angle(ang2); d = ang1 - ang2; if (d > M_PI) d -= 2 * (float)M_PI; else if (d < -(float)M_PI) d += 2 * (float)M_PI; return d; }
Luos-io/luos_engine
C++
MIT License
496
/* nlmsg_validate - validate a netlink message including attributes */
int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype, struct nla_policy *policy)
/* nlmsg_validate - validate a netlink message including attributes */ int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype, struct nla_policy *policy)
{ if (!nlmsg_valid_hdr(nlh, hdrlen)) return -NLE_MSG_TOOSHORT; return nla_validate(nlmsg_attrdata(nlh, hdrlen), nlmsg_attrlen(nlh, hdrlen), maxtype, policy); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* QSPI MSP De-Initialization This function frees the hardware resources used in this example: */
void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi)
/* QSPI MSP De-Initialization This function frees the hardware resources used in this example: */ void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi)
{ static DMA_HandleTypeDef hdma; HAL_NVIC_DisableIRQ(QSPI_DMA_IRQ); HAL_NVIC_DisableIRQ(QUADSPI_IRQn); hdma.Instance = QSPI_DMA_INSTANCE; HAL_DMA_DeInit(&hdma); HAL_GPIO_DeInit(QSPI_CS_GPIO_PORT, QSPI_CS_PIN); HAL_GPIO_DeInit(QSPI_CLK_GPIO_PORT, QSPI_CLK_PIN); HAL_GPIO_DeInit(QSPI_D0_GPIO_PORT, QSPI_D0_PIN); HAL_GPIO_DeInit(QSPI_D1_GPIO_PORT, QSPI_D1_PIN); HAL_GPIO_DeInit(QSPI_D2_GPIO_PORT, QSPI_D2_PIN); HAL_GPIO_DeInit(QSPI_D3_GPIO_PORT, QSPI_D3_PIN); QSPI_FORCE_RESET(); QSPI_RELEASE_RESET(); QSPI_CLK_DISABLE(); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* check EXMC interrupt flag is set or not */
FlagStatus exmc_interrupt_flag_get(uint32_t bank, uint32_t interrupt_source)
/* check EXMC interrupt flag is set or not */ FlagStatus exmc_interrupt_flag_get(uint32_t bank, uint32_t interrupt_source)
{ uint32_t status = 0x00000000U, interrupt_enable = 0x00000000U, interrupt_state = 0x00000000U; if((EXMC_BANK1_NAND == bank) || (EXMC_BANK2_NAND == bank) || (EXMC_BANK3_PCCARD == bank)){ status = EXMC_NPINTEN(bank); interrupt_state = (status & (interrupt_source >> INTEN_INTS_OFFSET)); }else{ status = EXMC_SDARI; interrupt_state = (EXMC_SDSTAT & EXMC_SDSDAT_REIF); } interrupt_enable = (status & interrupt_source); if ((interrupt_enable) && (interrupt_state)){ return SET; }else{ return RESET; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The processor will generate this exception if any x87 FPU, MMX, or SSEx instruction is executed while CR0=1. The handler then enables the current thread to use all supported floating point registers. */
void _FpNotAvailableExcHandler(z_arch_esf_t *pEsf)
/* The processor will generate this exception if any x87 FPU, MMX, or SSEx instruction is executed while CR0=1. The handler then enables the current thread to use all supported floating point registers. */ void _FpNotAvailableExcHandler(z_arch_esf_t *pEsf)
{ ARG_UNUSED(pEsf); k_float_enable(_current, _FP_USER_MASK); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* See mss_uart.h for details of how to use this function. */
int8_t MSS_UART_tx_complete(mss_uart_instance_t *this_uart)
/* See mss_uart.h for details of how to use this function. */ int8_t MSS_UART_tx_complete(mss_uart_instance_t *this_uart)
{ int8_t ret_value = 0; uint8_t status = 0u; ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)); if((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) { status = this_uart->hw_reg->LSR; this_uart->status |= status; if((TX_COMPLETE == this_uart->tx_buff_size) && ((status & MSS_UART_TEMT) != 0u)) { ret_value = (int8_t)1; } } return ret_value; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Program a 32 bit Word to FLASH. Status bit polling is used to detect end of operation. */
void flash_program_word(uint32_t address, uint32_t data)
/* Program a 32 bit Word to FLASH. Status bit polling is used to detect end of operation. */ void flash_program_word(uint32_t address, uint32_t data)
{ flash_program_half_word(address, (uint16_t)data); flash_program_half_word(address+2, (uint16_t)(data>>16)); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Function for initializing services that will be used by the application. */
static void services_init(void)
/* Function for initializing services that will be used by the application. */ static void services_init(void)
{ uint32_t err_code; ble_nus_init_t nus_init; memset(&nus_init, 0, sizeof(nus_init)); nus_init.data_handler = nus_data_handler; err_code = ble_nus_init(&m_nus, &nus_init); APP_ERROR_CHECK(err_code); }
labapart/polymcu
C++
null
201
/* Return TRUE if the firmware volume has been processed, FALSE if not. */
BOOLEAN FvHasBeenProcessed(IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader)
/* Return TRUE if the firmware volume has been processed, FALSE if not. */ BOOLEAN FvHasBeenProcessed(IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader)
{ LIST_ENTRY *Link; KNOWN_FWVOL *KnownFwVol; for (Link = mFwVolList.ForwardLink; Link != &mFwVolList; Link = Link->ForwardLink) { KnownFwVol = CR (Link, KNOWN_FWVOL, Link, KNOWN_FWVOL_SIGNATURE); if (KnownFwVol->FwVolHeader == FwVolHeader) { return TRUE; } } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* Deinitializes the EXTI peripheral registers to their default reset values. */
void EXTI_DeInit(void)
/* Deinitializes the EXTI peripheral registers to their default reset values. */ void EXTI_DeInit(void)
{ EXTI->IMR = 0x1F800000; EXTI->EMR = 0x00000000; EXTI->RTSR = 0x00000000; EXTI->FTSR = 0x00000000; EXTI->SWIER = 0x00000000; EXTI->PR = 0xE07FFFFF; EXTI->IMR2 = 0x0000000C; EXTI->EMR2 = 0x00000000; EXTI->RTSR2 = 0x00000000; EXTI->FTSR2 = 0x00000000; EXTI->SWIER2 = 0x00000000; EXTI->PR2 = 0x00000003; }
ajhc/demo-cortex-m3
C++
null
38
/* Returns the ancestor dentry of p2 which is a child of p1, if p1 is an ancestor of p2, else NULL. */
struct dentry* d_ancestor(struct dentry *p1, struct dentry *p2)
/* Returns the ancestor dentry of p2 which is a child of p1, if p1 is an ancestor of p2, else NULL. */ struct dentry* d_ancestor(struct dentry *p1, struct dentry *p2)
{ struct dentry *p; for (p = p2; !IS_ROOT(p); p = p->d_parent) { if (p->d_parent == p1) return p; } return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Fills each RTC_AlarmStruct member with its default value (Time = 00h:00mn:00sec / Date = 1st day of the month/Mask = all fields are masked). */
void RTC_AlarmStructInit(RTC_AlarmTypeDef *RTC_AlarmStruct)
/* Fills each RTC_AlarmStruct member with its default value (Time = 00h:00mn:00sec / Date = 1st day of the month/Mask = all fields are masked). */ void RTC_AlarmStructInit(RTC_AlarmTypeDef *RTC_AlarmStruct)
{ RTC_AlarmStruct->RTC_AlarmTime.RTC_H12 = RTC_H12_AM; RTC_AlarmStruct->RTC_AlarmTime.RTC_Hours = 0; RTC_AlarmStruct->RTC_AlarmTime.RTC_Minutes = 0; RTC_AlarmStruct->RTC_AlarmTime.RTC_Seconds = 0; RTC_AlarmStruct->RTC_AlarmDateWeekDaySel = RTC_AlarmDateWeekDaySel_Date; RTC_AlarmStruct->RTC_AlarmDateWeekDay = 1; RTC_AlarmStruct->RTC_AlarmMask = RTC_AlarmMask_None; }
MaJerle/stm32f429
C++
null
2,036
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. retval #kStatus_Success A transaction was successfully aborted. retval #kStatus_LPI2C_Idle There is not a DMA transaction currently in progress. */
status_t LPI2C_MasterTransferAbortEDMA(LPI2C_Type *base, lpi2c_master_edma_handle_t *handle)
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. retval #kStatus_Success A transaction was successfully aborted. retval #kStatus_LPI2C_Idle There is not a DMA transaction currently in progress. */ status_t LPI2C_MasterTransferAbortEDMA(LPI2C_Type *base, lpi2c_master_edma_handle_t *handle)
{ if (!handle->isBusy) { return kStatus_LPI2C_Idle; } EDMA_AbortTransfer(handle->rx); if (FSL_FEATURE_LPI2C_HAS_SEPARATE_DMA_RX_TX_REQn(base) != 0) { EDMA_AbortTransfer(handle->tx); } base->MCR |= LPI2C_MCR_RRF_MASK | LPI2C_MCR_RTF_MASK; LPI2C_MasterDisableInterrupts(base, (uint32_t)kLPI2C_MasterIrqFlags); if ((LPI2C_MasterGetStatusFlags(base) & ((uint32_t)kLPI2C_MasterStopDetectFlag | (uint32_t)kLPI2C_MasterBusyFlag)) == (uint32_t)kLPI2C_MasterBusyFlag) { base->MTDR = (uint32_t)kStopCmd; } handle->isBusy = false; return kStatus_Success; }
eclipse-threadx/getting-started
C++
Other
310
/* Calculate the number of performance counter ticks required for a timeout. If TimeoutInMicroseconds is 0, return value is also 0, which is recognized as infinity. */
UINT64 CalculateTimeout(IN UINTN TimeoutInMicroseconds, OUT UINT64 *CurrentTime)
/* Calculate the number of performance counter ticks required for a timeout. If TimeoutInMicroseconds is 0, return value is also 0, which is recognized as infinity. */ UINT64 CalculateTimeout(IN UINTN TimeoutInMicroseconds, OUT UINT64 *CurrentTime)
{ UINT64 TimeoutInSeconds; UINT64 TimestampCounterFreq; *CurrentTime = GetPerformanceCounter (); if (TimeoutInMicroseconds == 0) { return 0; } TimestampCounterFreq = GetPerformanceCounterProperties (NULL, NULL); if (DivU64x64Remainder (MAX_UINT64, TimeoutInMicroseconds, NULL) < TimestampCounterFreq) { TimeoutInSeconds = DivU64x32 (TimeoutInMicroseconds, 1000000); ASSERT (DivU64x64Remainder (MAX_UINT64, TimeoutInSeconds, NULL) >= TimestampCounterFreq); return MultU64x64 (TimestampCounterFreq, TimeoutInSeconds); } else { return DivU64x32 ( MultU64x64 ( TimestampCounterFreq, TimeoutInMicroseconds ), 1000000 ); } }
tianocore/edk2
C++
Other
4,240
/* Note that this filter uses CRC16 rather than CRC32 as used in frame checksums. */
void EMACRemoteWakeUpFrameFilterGet(uint32_t ui32Base, tEMACWakeUpFrameFilter *pFilter)
/* Note that this filter uses CRC16 rather than CRC32 as used in frame checksums. */ void EMACRemoteWakeUpFrameFilterGet(uint32_t ui32Base, tEMACWakeUpFrameFilter *pFilter)
{ uint32_t *pui32Data; uint32_t ui32Loop; ASSERT(ui32Base == EMAC0_BASE); ASSERT(pFilter); HWREG(ui32Base + EMAC_O_PMTCTLSTAT) |= EMAC_PMTCTLSTAT_WUPFRRST; pui32Data = (uint32_t *)pFilter; for(ui32Loop = 0; ui32Loop < 8; ui32Loop++) { pui32Data[ui32Loop] = HWREG(ui32Base + EMAC_O_RWUFF); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* libc/string/strlcpy.c A variant of strcpy that truncates the result to fit in the destination buffer */
size_t strlcpy(char *dest, const char *src, size_t n)
/* libc/string/strlcpy.c A variant of strcpy that truncates the result to fit in the destination buffer */ size_t strlcpy(char *dest, const char *src, size_t n)
{ size_t len; size_t ret = strlen(src); if (n) { len = (ret >= n) ? n - 1 : ret; memcpy(dest, src, len); dest[len] = '\0'; } return ret; }
xboot/xboot
C++
MIT License
779
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param volume volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. return kStatus_Success is success, else configure failed. */
status_t CODEC_SetVolume(codec_handle_t *handle, uint32_t playChannel, uint32_t volume)
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param volume volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. return kStatus_Success is success, else configure failed. */ status_t CODEC_SetVolume(codec_handle_t *handle, uint32_t playChannel, uint32_t volume)
{ assert((handle != NULL) && (handle->codecConfig != NULL)); assert(volume <= CODEC_VOLUME_MAX_VALUE); assert(handle->codecCapability != NULL); if ((GET_PLAY_CHANNEL_CAPABILITY(handle->codecCapability->codecPlayCapability) & playChannel) == 0U) { return kStatus_CODEC_NotSupport; } return HAL_CODEC_SetVolume(handle, playChannel, volume); }
eclipse-threadx/getting-started
C++
Other
310
/* Checks whether the specified SDIO flag is set or not. */
FlagStatus SDIO_GetFlag(uint32_t SDIO_FLAG)
/* Checks whether the specified SDIO flag is set or not. */ FlagStatus SDIO_GetFlag(uint32_t SDIO_FLAG)
{ FlagStatus bitstatus = RESET; assert_param(IS_SDIO_FLAG(SDIO_FLAG)); if ((SDIO->STS & SDIO_FLAG) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Determines whether the SSI transmitter is busy or not. */
bool SSIBusy(uint32_t ui32Base)
/* Determines whether the SSI transmitter is busy or not. */ bool SSIBusy(uint32_t ui32Base)
{ ASSERT(_SSIBaseValid(ui32Base)); return ((HWREG(ui32Base + SSI_O_SR) & SSI_SR_BSY) ? true : false); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Confirm we have "samplesperpixel" ink names separated by \0. Returns zero if the ink names are not as expected. */
static uint32 checkInkNamesString(TIFF *tif, uint32 slen, const char *s)
/* Confirm we have "samplesperpixel" ink names separated by \0. Returns zero if the ink names are not as expected. */ static uint32 checkInkNamesString(TIFF *tif, uint32 slen, const char *s)
{ TIFFDirectory* td = &tif->tif_dir; uint16 i = td->td_samplesperpixel; if (slen > 0) { const char* ep = s+slen; const char* cp = s; for (; i > 0; i--) { for (; cp < ep && *cp != '\0'; cp++) {} if (cp >= ep) goto bad; cp++; } return ((uint32)(cp-s)); } bad: TIFFErrorExt(tif->tif_clientdata, "TIFFSetField", "%s: Invalid InkNames value; expecting %d names, found %d", tif->tif_name, td->td_samplesperpixel, td->td_samplesperpixel-i); return (0); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Try to find if this argument is in the list (and it is not manual) if it does, try to parse it, set its dest accordingly, and return true if it is not found, return false */
bool cmd_parse_one_arg(char *argv, struct args_struct_t args_struct[])
/* Try to find if this argument is in the list (and it is not manual) if it does, try to parse it, set its dest accordingly, and return true if it is not found, return false */ bool cmd_parse_one_arg(char *argv, struct args_struct_t args_struct[])
{ int count = 0; int ret; if (cmd_is_help_option(argv)) { cmd_print_long_help(args_struct); posix_exit(0); } while (args_struct[count].option != NULL) { if (args_struct[count].manual) { count++; continue; } ret = cmd_is_option(argv, args_struct[count].option, !args_struct[count].is_switch); if (ret) { cmd_handle_this_matched_arg(argv, ret, &args_struct[count]); return true; } count++; } return false; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function returns a reference to the window that should be used when managing the widget, such as move, resize, destroy and reparenting. */
struct win_window* wtk_label_as_child(struct wtk_label *label)
/* This function returns a reference to the window that should be used when managing the widget, such as move, resize, destroy and reparenting. */ struct win_window* wtk_label_as_child(struct wtk_label *label)
{ Assert(label); return label->container; }
memfault/zero-to-main
C++
null
200
/* It may also be possible to leave the 66MHz clock on and readjust the timing parameters. */
static void pdc_old_enable_66MHz_clock(ide_hwif_t *hwif)
/* It may also be possible to leave the 66MHz clock on and readjust the timing parameters. */ static void pdc_old_enable_66MHz_clock(ide_hwif_t *hwif)
{ unsigned long clock_reg = hwif->extra_base + 0x01; u8 clock = inb(clock_reg); outb(clock | (hwif->channel ? 0x08 : 0x02), clock_reg); }
robutest/uclinux
C++
GPL-2.0
60
/* Clears the SAI Block x interrupt pending bit. */
void SAI_ClearITPendingBit(SAI_Block_TypeDef *SAI_Block_x, uint32_t SAI_IT)
/* Clears the SAI Block x interrupt pending bit. */ void SAI_ClearITPendingBit(SAI_Block_TypeDef *SAI_Block_x, uint32_t SAI_IT)
{ assert_param(IS_SAI_BLOCK_PERIPH(SAI_Block_x)); assert_param(IS_SAI_BLOCK_CONFIG_IT(SAI_IT)); SAI_Block_x->CLRFR |= SAI_IT; }
MaJerle/stm32f429
C++
null
2,036
/* Return Value: 0: transmit successfully otherwise: transmit fail */
static int rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev)
/* Return Value: 0: transmit successfully otherwise: transmit fail */ static int rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev)
{ struct rt_rtmp_adapter *pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, net_dev); if (!(net_dev->flags & IFF_UP)) { RELEASE_NDIS_PACKET(pAd, (void *)skb_p, NDIS_STATUS_FAILURE); return NETDEV_TX_OK; } NdisZeroMemory((u8 *)& skb_p->cb[CB_OFF], 15); RTMP_SET_PACKET_NET_DEVICE_MBSSID(skb_p, MAIN_MBSSID); return rt28xx_packet_xmit(skb_p); }
robutest/uclinux
C++
GPL-2.0
60
/* Fills each adcConfig member with its default value. */
void ADC_ConfigStructInit(ADC_Config_T *adcConfig)
/* Fills each adcConfig member with its default value. */ void ADC_ConfigStructInit(ADC_Config_T *adcConfig)
{ adcConfig->resolution = ADC_RESOLUTION_12B; adcConfig->dataAlign = ADC_DATA_ALIGN_RIGHT; adcConfig->scanDir = ADC_SCAN_DIR_UPWARD; adcConfig->convMode = ADC_CONVERSION_SINGLE; adcConfig->extTrigConv = ADC_EXT_TRIG_CONV_TRG0; adcConfig->extTrigEdge = ADC_EXT_TRIG_EDGE_NONE; }
pikasTech/PikaPython
C++
MIT License
1,403
/* 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; USARTx_TX_GPIO_CLK_ENABLE(); USARTx_RX_GPIO_CLK_ENABLE(); USARTx_CLK_ENABLE(); GPIO_InitStruct.Pin = USARTx_TX_PIN; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = USARTx_TX_AF; HAL_GPIO_Init(USARTx_TX_GPIO_PORT, &GPIO_InitStruct); GPIO_InitStruct.Pin = USARTx_RX_PIN; GPIO_InitStruct.Alternate = USARTx_RX_AF; HAL_GPIO_Init(USARTx_RX_GPIO_PORT, &GPIO_InitStruct); HAL_NVIC_SetPriority(USARTx_IRQn, 0, 1); HAL_NVIC_EnableIRQ(USARTx_IRQn); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Return the number of words that can be safely pushed into the write fifo. */
static u32 fifo_icap_write_fifo_vacancy(struct hwicap_drvdata *drvdata)
/* Return the number of words that can be safely pushed into the write fifo. */ static u32 fifo_icap_write_fifo_vacancy(struct hwicap_drvdata *drvdata)
{ return in_be32(drvdata->base_address + XHI_WFV_OFFSET); }
robutest/uclinux
C++
GPL-2.0
60
/* Sets new shortcut configuration bitmask for I2C peripheral. */
void i2c_set_shorts(uint32_t i2c, uint32_t shorts)
/* Sets new shortcut configuration bitmask for I2C peripheral. */ void i2c_set_shorts(uint32_t i2c, uint32_t shorts)
{ I2C_SHORTS(i2c) = shorts; } /**@}
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Display the application header (title) on the LCD screen. */
void LCD_LOG_SetHeader(uint8_t *Title)
/* Display the application header (title) on the LCD screen. */ void LCD_LOG_SetHeader(uint8_t *Title)
{ sFONT *cFont; uint32_t size = 0 , idx; uint8_t *ptr = Title; uint8_t tmp[27]; while (*ptr++) size ++ ; if(size > 26) { size = 26; } for (idx = 0 ; idx < 27 ; idx ++) { tmp[idx] = ' '; } for (idx = 0 ; idx < size ; idx ++) { tmp[idx + (27 - size)/2] = Title[idx]; } LCD_Clear(Black); LCD_SetFont (&Font12x12); cFont = LCD_GetFont(); LCD_SetTextColor(White); LCD_SetBackColor(Blue); LCD_ClearLine(0); LCD_DisplayStringLine(cFont->Height, tmp); LCD_ClearLine(2 * cFont->Height); LCD_SetBackColor(Black); LCD_SetFont (&Font8x12); }
avem-labs/Avem
C++
MIT License
1,752
/* Give the semaphore, setting its count to 1, meaning that it's available. */
void TbxMbOsalSemGive(tTbxMbOsalSem sem, uint8_t fromIsr)
/* Give the semaphore, setting its count to 1, meaning that it's available. */ void TbxMbOsalSemGive(tTbxMbOsalSem sem, uint8_t fromIsr)
{ TBX_UNUSED_ARG(fromIsr); TBX_ASSERT(sem != NULL); if (sem != NULL) { tTbxMbOsalSemCtx * semCtx = (tTbxMbOsalSemCtx *)sem; TBX_ASSERT(semCtx->type == TBX_MB_OSAL_SEM_CONTEXT_TYPE); TbxCriticalSectionEnter(); semCtx->count = 1U; TbxCriticalSectionExit(); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Written since there is no pow() in math.h. Only for exponent and base above 0. Used for calculating scaling factor for frequency margin */
static uint32_t litex_clk_pow(uint32_t base, uint32_t exp)
/* Written since there is no pow() in math.h. Only for exponent and base above 0. Used for calculating scaling factor for frequency margin */ static uint32_t litex_clk_pow(uint32_t base, uint32_t exp)
{ int ret = 1; while (exp--) { ret *= base; } return ret; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Checks all the children of @parent for a matching @id. If none found, it allocates a new device and returns it. */
static struct parisc_device* alloc_tree_node(struct device *parent, char id)
/* Checks all the children of @parent for a matching @id. If none found, it allocates a new device and returns it. */ static struct parisc_device* alloc_tree_node(struct device *parent, char id)
{ struct match_id_data d = { .id = id, }; if (device_for_each_child(parent, &d, match_by_id)) return d.dev; else return create_tree_node(id, parent); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check if SWPMI transceiver ready interrupt is enabled @rmtoll IER RDYIE LL_SWPMI_IsEnabledIT_RDY. */
uint32_t LL_SWPMI_IsEnabledIT_RDY(SWPMI_TypeDef *SWPMIx)
/* Check if SWPMI transceiver ready interrupt is enabled @rmtoll IER RDYIE LL_SWPMI_IsEnabledIT_RDY. */ uint32_t LL_SWPMI_IsEnabledIT_RDY(SWPMI_TypeDef *SWPMIx)
{ return ((READ_BIT(SWPMIx->IER, SWPMI_IER_RDYIE) == (SWPMI_IER_RDYIE)) ? 1UL : 0UL); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Signal to the hardware that the End Of Interrupt state has been reached. */
STATIC EFI_STATUS EFIAPI GicV2EndOfInterrupt(IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This, IN HARDWARE_INTERRUPT_SOURCE Source)
/* Signal to the hardware that the End Of Interrupt state has been reached. */ STATIC EFI_STATUS EFIAPI GicV2EndOfInterrupt(IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This, IN HARDWARE_INTERRUPT_SOURCE Source)
{ if (Source >= mGicNumInterrupts) { ASSERT (FALSE); return EFI_UNSUPPORTED; } ArmGicV2EndOfInterrupt (mGicInterruptInterfaceBase, Source); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* param base LPUART peripheral base address. param handle LPUART handle pointer. */
void LPUART_TransferAbortReceive(LPUART_Type *base, lpuart_handle_t *handle)
/* param base LPUART peripheral base address. param handle LPUART handle pointer. */ void LPUART_TransferAbortReceive(LPUART_Type *base, lpuart_handle_t *handle)
{ assert(NULL != handle); if (NULL == handle->rxRingBuffer) { uint32_t irqMask = DisableGlobalIRQ(); base->CTRL &= ~(uint32_t)(LPUART_CTRL_RIE_MASK | LPUART_CTRL_ILIE_MASK | LPUART_CTRL_ORIE_MASK); EnableGlobalIRQ(irqMask); } handle->rxDataSize = 0U; handle->rxState = (uint8_t)kLPUART_RxIdle; }
eclipse-threadx/getting-started
C++
Other
310
/* This function starts a flash cycle and waits for its completion. */
static s32 e1000_flash_cycle_ich8lan(struct e1000_hw *hw, u32 timeout)
/* This function starts a flash cycle and waits for its completion. */ static s32 e1000_flash_cycle_ich8lan(struct e1000_hw *hw, u32 timeout)
{ union ich8_hws_flash_ctrl hsflctl; union ich8_hws_flash_status hsfsts; s32 ret_val = -E1000_ERR_NVM; u32 i = 0; hsflctl.regval = er16flash(ICH_FLASH_HSFCTL); hsflctl.hsf_ctrl.flcgo = 1; ew16flash(ICH_FLASH_HSFCTL, hsflctl.regval); do { hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); if (hsfsts.hsf_status.flcdone == 1) break; udelay(1); } while (i++ < timeout); if (hsfsts.hsf_status.flcdone == 1 && hsfsts.hsf_status.flcerr == 0) return 0; return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* Unmap all cards, because some of them may be mapped accidetly during autoprobing of some network drivers (SMC-driver?) */
static void icn_disable_cards(void)
/* Unmap all cards, because some of them may be mapped accidetly during autoprobing of some network drivers (SMC-driver?) */ static void icn_disable_cards(void)
{ icn_card *card = cards; while (card) { if (!request_region(card->port, ICN_PORTLEN, "icn-isdn")) { printk(KERN_WARNING "icn: (%s) ports 0x%03x-0x%03x in use.\n", CID, card->port, card->port + ICN_PORTLEN); } else { OUTB_P(0, ICN_RUN); OUTB_P(0, ICN_MAPRAM); release_region(card->port, ICN_PORTLEN); } card = card->next; } }
robutest/uclinux
C++
GPL-2.0
60
/* USB Device MSC Service Action (16-Byte) Callback Parameters: None Return Value: None */
void USBD_MSC_ServiceActionIn16(void)
/* USB Device MSC Service Action (16-Byte) Callback Parameters: None Return Value: None */ void USBD_MSC_ServiceActionIn16(void)
{ if (!USBD_MSC_DataInFormat()) { return; } USBD_MSC_BulkBuf[ 0] = 0x20; USBD_MSC_BulkBuf[ 1] = 0x00; USBD_MSC_BulkBuf[31] = 0x00; BulkLen = 32; BulkStage = MSC_BS_DATA_IN_LAST; USBD_WriteEP(usbd_msc_ep_bulkin | 0x80, USBD_MSC_BulkBuf, BulkLen); USBD_MSC_CSW.dDataResidue -= BulkLen; USBD_MSC_CSW.bStatus = CSW_CMD_FAILED; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* All the functions below are part of public USB device support API. */
int usbd_device_set_bcd(struct usbd_contex *const uds_ctx, const uint16_t bcd)
/* All the functions below are part of public USB device support API. */ int usbd_device_set_bcd(struct usbd_contex *const uds_ctx, const uint16_t bcd)
{ struct usb_device_descriptor *desc = uds_ctx->desc; int ret = 0; usbd_device_lock(uds_ctx); if (usbd_is_enabled(uds_ctx)) { ret = -EALREADY; goto set_bcd_exit; } desc->bcdUSB = sys_cpu_to_le16(bcd); set_bcd_exit: usbd_device_unlock(uds_ctx); return ret; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function handles SPI communication timeout in interrupt function. */
static ald_status_t spi_wait_flag_irq(ald_spi_handle_t *hperh, ald_spi_flag_t flag, flag_status_t status, uint32_t timeout)
/* This function handles SPI communication timeout in interrupt function. */ static ald_status_t spi_wait_flag_irq(ald_spi_handle_t *hperh, ald_spi_flag_t flag, flag_status_t status, uint32_t timeout)
{ assert_param(timeout > 0); while (((ald_spi_get_flag_status(hperh, flag)) != status) && (--timeout)); if (timeout) return ALD_OK; ald_spi_interrupt_config(hperh, ALD_SPI_IT_TXE, DISABLE); ald_spi_interrupt_config(hperh, ALD_SPI_IT_RXTH, DISABLE); ald_spi_interrupt_config(hperh, ALD_SPI_IT_CRCERR, DISABLE); ald_spi_interrupt_config(hperh, ALD_SPI_IT_MODF, DISABLE); return ALD_TIMEOUT; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Configure UART parameters in single call. Any pin number can be set to 0xff (or any number larger than UART_MAX_PIN) to disconnect that pin. */
void uart_configure(uint32_t uart, uint32_t tx_pin, uint32_t rx_pin, uint32_t rts_pin, uint32_t cts_pin, enum uart_baud br, bool enable_parity)
/* Configure UART parameters in single call. Any pin number can be set to 0xff (or any number larger than UART_MAX_PIN) to disconnect that pin. */ void uart_configure(uint32_t uart, uint32_t tx_pin, uint32_t rx_pin, uint32_t rts_pin, uint32_t cts_pin, enum uart_baud br, bool enable_parity)
{ uart_set_pins(uart, rx_pin, tx_pin, cts_pin, rts_pin); uint32_t reg_config = enable_parity ? UART_CONFIG_PARITY : 0; if (rts_pin <= UART_MAX_PIN || cts_pin <= UART_MAX_PIN) { reg_config |= UART_CONFIG_HWFC; } UART_CONFIG(uart) = reg_config; uart_set_baudrate(uart, br); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
{ if(huart->Instance==LPUART1) { __HAL_RCC_LPUART1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOG, GPIO_PIN_7|GPIO_PIN_8); } else if(huart->Instance==USART1) { __HAL_RCC_USART1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, USART1_TX_Pin|USART1_RX_Pin); } else if(huart->Instance==USART2) { __HAL_RCC_USART2_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Command response callback function for sd_ble_gap_connect_cancel BLE command. Callback for decoding the output parameters and the command response return code. */
static uint32_t gap_connect_cancel_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ble_gap_connect_cancel BLE command. Callback for decoding the output parameters and the command response return code. */ static uint32_t gap_connect_cancel_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{ uint32_t result_code = 0; const uint32_t err_code = ble_gap_connect_cancel_rsp_dec(p_buffer, length, &result_code); APP_ERROR_CHECK(err_code); return result_code; }
labapart/polymcu
C++
null
201
/* Set "auto commit" property of the connection. Modes ON/OFF */
static int conn_setautocommit(lua_State *L)
/* Set "auto commit" property of the connection. Modes ON/OFF */ static int conn_setautocommit(lua_State *L)
{ mysql_autocommit(conn->my_conn, 1); } else { mysql_autocommit(conn->my_conn, 0); } lua_pushboolean(L, 1); return 1; }
DC-SWAT/DreamShell
C++
null
404
/* Clear Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_ClrStallEP(U32 EPNum)
/* Clear Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ void USBD_ClrStallEP(U32 EPNum)
{ uint32_t u32Ep, u32Num; u32Num = EPNum & 0x0F; u32Ep = USBD_NUM_TO_EP(u32Num); if (u32Ep == CEP) { HSUSBD_SET_CEP_STATE(HSUSBD_CEPCTL_NAKCLR_Msk); } else { HSUSBD->EP[u32Ep].EPRSPCTL = (HSUSBD->EP[u32Ep].EPRSPCTL & HSUSBD_EP_RSPCTL_MODE_MASK) | HSUSBD_EP_RSPCTL_TOGGLE; } }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* The functions for inserting/removing us as a module. */
static int __init pm_init(void)
/* The functions for inserting/removing us as a module. */ static int __init pm_init(void)
{ return serio_register_driver(&pm_drv); }
robutest/uclinux
C++
GPL-2.0
60
/* Starts the SP805 counting down by enabling interrupts. The count down will start from the value stored in the Load register, not from the value where it was previously stopped. */
STATIC VOID SP805Start(VOID)
/* Starts the SP805 counting down by enabling interrupts. The count down will start from the value stored in the Load register, not from the value where it was previously stopped. */ STATIC VOID SP805Start(VOID)
{ if ((MmioRead32 (SP805_WDOG_CONTROL_REG) & SP805_WDOG_CTRL_INTEN) == 0) { MmioOr32 (SP805_WDOG_CONTROL_REG, SP805_WDOG_CTRL_INTEN); } }
tianocore/edk2
C++
Other
4,240
/* Return Value: TRUE if succeeded; FALSE if failed. */
BOOL CARDbAddBasicRate(PVOID pDeviceHandler, WORD wRateIdx)
/* Return Value: TRUE if succeeded; FALSE if failed. */ BOOL CARDbAddBasicRate(PVOID pDeviceHandler, WORD wRateIdx)
{ PSDevice pDevice = (PSDevice) pDeviceHandler; WORD wRate = (WORD)(1<<wRateIdx); pDevice->wBasicRate |= wRate; CARDvUpdateBasicTopRate((PVOID)pDevice); return(TRUE); }
robutest/uclinux
C++
GPL-2.0
60
/* Check if this interface is USB Rndis SubType */
BOOLEAN IsSupportedDevice(IN EFI_USB_IO_PROTOCOL *UsbIo)
/* Check if this interface is USB Rndis SubType */ BOOLEAN IsSupportedDevice(IN EFI_USB_IO_PROTOCOL *UsbIo)
{ EFI_STATUS Status; EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor; Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &InterfaceDescriptor); if (EFI_ERROR (Status)) { return FALSE; } if (((InterfaceDescriptor.InterfaceClass == USB_CDC_CLASS) && (InterfaceDescriptor.InterfaceSubClass == USB_CDC_ACM_SUBCLASS) && (InterfaceDescriptor.InterfaceProtocol == USB_VENDOR_PROTOCOL)) || \ ((InterfaceDescriptor.InterfaceClass == USB_MISC_CLASS) && (InterfaceDescriptor.InterfaceSubClass == USB_RNDIS_SUBCLASS) && (InterfaceDescriptor.InterfaceProtocol == USB_RNDIS_ETHERNET_PROTOCOL)) || \ ((InterfaceDescriptor.InterfaceClass == USB_CDC_DATA_CLASS) && (InterfaceDescriptor.InterfaceSubClass == USB_CDC_DATA_SUBCLASS) && (InterfaceDescriptor.InterfaceProtocol == USB_NO_CLASS_PROTOCOL)) ) { return TRUE; } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* The value of the timer field correponds to a number of seconds in powers of 2. */
static ssize_t pdcs_timer_read(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
/* The value of the timer field correponds to a number of seconds in powers of 2. */ static ssize_t pdcs_timer_read(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
{ char *out = buf; struct pdcspath_entry *pathentry; if (!buf) return -EINVAL; pathentry = &pdcspath_entry_primary; read_lock(&pathentry->rw_lock); out += sprintf(out, "%u\n", (pathentry->devpath.flags & PF_TIMER) ? (1 << (pathentry->devpath.flags & PF_TIMER)) : 0); read_unlock(&pathentry->rw_lock); return out - buf; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns zero on success, a negative error code otherwise. */
static int mtd_ooblayout_get_bytes(struct mtd_info *mtd, u8 *buf, const u8 *oobbuf, int start, int nbytes, int(*iter)(struct mtd_info *, int section, struct mtd_oob_region *oobregion))
/* Returns zero on success, a negative error code otherwise. */ static int mtd_ooblayout_get_bytes(struct mtd_info *mtd, u8 *buf, const u8 *oobbuf, int start, int nbytes, int(*iter)(struct mtd_info *, int section, struct mtd_oob_region *oobregion))
{ struct mtd_oob_region oobregion; int section, ret; ret = mtd_ooblayout_find_region(mtd, start, &section, &oobregion, iter); while (!ret) { int cnt; cnt = min_t(int, nbytes, oobregion.length); memcpy(buf, oobbuf + oobregion.offset, cnt); buf += cnt; nbytes -= cnt; if (!nbytes) break; ret = iter(mtd, ++section, &oobregion); } return ret; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Attach a capture/tv driver to the core CyberX0X0 driver. */
int cyber2000fb_attach(struct cyberpro_info *info, int idx)
/* Attach a capture/tv driver to the core CyberX0X0 driver. */ int cyber2000fb_attach(struct cyberpro_info *info, int idx)
{ if (int_cfb_info != NULL) { info->dev = int_cfb_info->dev; info->regs = int_cfb_info->regs; info->fb = int_cfb_info->fb.screen_base; info->fb_size = int_cfb_info->fb.fix.smem_len; info->enable_extregs = cyber2000fb_enable_extregs; info->disable_extregs = cyber2000fb_disable_extregs; info->info = int_cfb_info; strlcpy(info->dev_name, int_cfb_info->fb.fix.id, sizeof(info->dev_name)); } return int_cfb_info != NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Bunch of low level function for managing interface names. Compare two interface names, with wildcards. We can't use fnmatch() because we don't want expansion of '' expressions, '\' sequences and matching of '.'. We only want to match a single '*' (converted to a d at that point) to a numerical value (no ascii). Return 0 is matches. */
static int if_match_ifname(const char *pattern, const char *value)
/* Bunch of low level function for managing interface names. Compare two interface names, with wildcards. We can't use fnmatch() because we don't want expansion of '' expressions, '\' sequences and matching of '.'. We only want to match a single '*' (converted to a d at that point) to a numerical value (no ascii). Return 0 is matches. */ static int if_match_ifname(const char *pattern, const char *value)
{ const char * p; const char * v; int n; int ret; p = strchr(pattern, '*'); if(p == NULL) return(strcmp(pattern, value)); n = (p - pattern); ret = strncmp(pattern, value, n); if(ret) return(ret); v = value + n; if(!isdigit(*v)) return(-1); do v++; while(isdigit(*v)); p += 1; return(strcmp(p, v)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Find a block with a given NLM cookie. */
static struct nlm_block* nlmsvc_find_block(struct nlm_cookie *cookie)
/* Find a block with a given NLM cookie. */ static struct nlm_block* nlmsvc_find_block(struct nlm_cookie *cookie)
{ struct nlm_block *block; list_for_each_entry(block, &nlm_blocked, b_list) { if (nlm_cookie_match(&block->b_call->a_args.cookie,cookie)) goto found; } return NULL; found: dprintk("nlmsvc_find_block(%s): block=%p\n", nlmdbg_cookie2a(cookie), block); kref_get(&block->b_count); return block; }
robutest/uclinux
C++
GPL-2.0
60
/* Get Value for given Name from a NameValue Storage. */
EFI_STATUS GetValueByName(IN HII_FORMSET_STORAGE *Storage, IN CHAR16 *Name, IN OUT CHAR16 **Value)
/* Get Value for given Name from a NameValue Storage. */ EFI_STATUS GetValueByName(IN HII_FORMSET_STORAGE *Storage, IN CHAR16 *Name, IN OUT CHAR16 **Value)
{ LIST_ENTRY *Link; HII_NAME_VALUE_NODE *Node; if ((Storage == NULL) || (Value == NULL)) { return EFI_INVALID_PARAMETER; } *Value = NULL; Link = GetFirstNode (&Storage->NameValueList); while (!IsNull (&Storage->NameValueList, Link)) { Node = HII_NAME_VALUE_NODE_FROM_LINK (Link); if (StrCmp (Name, Node->Name) == 0) { NewStringCopy (Value, Node->Value); return EFI_SUCCESS; } Link = GetNextNode (&Storage->NameValueList, Link); } return EFI_NOT_FOUND; }
tianocore/edk2
C++
Other
4,240
/* refills descriptors in the rx chain: allocates skbs and iommu-maps them. */
static void spider_net_refill_rx_chain(struct spider_net_card *card)
/* refills descriptors in the rx chain: allocates skbs and iommu-maps them. */ static void spider_net_refill_rx_chain(struct spider_net_card *card)
{ struct spider_net_descr_chain *chain = &card->rx_chain; unsigned long flags; if (!spin_trylock_irqsave(&chain->lock, flags)) return; while (spider_net_get_descr_status(chain->head->hwdescr) == SPIDER_NET_DESCR_NOT_IN_USE) { if (spider_net_prepare_rx_descr(card, chain->head)) break; chain->head = chain->head->next; } spin_unlock_irqrestore(&chain->lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Turn mipi sensor into sleep mode through I2C. */
static void i2c2_sensor_off(uint32_t i2c_base)
/* Turn mipi sensor into sleep mode through I2C. */ static void i2c2_sensor_off(uint32_t i2c_base)
{ mipi_sensor_write_reg(i2c_base, 0x3008, 0x42); mipi_sensor_write_reg(i2c_base, 0x3503, 0x7); mipi_sensor_write_reg(i2c_base, 0x483b, 0xff); mipi_sensor_write_reg(i2c_base, 0x3007, 0xf7); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Fills each ADCTHD_InitType member with its default value. */
void ADC_THDStructInit(ADCTHD_InitType *ADC_THDStruct)
/* Fills each ADCTHD_InitType member with its default value. */ void ADC_THDStructInit(ADCTHD_InitType *ADC_THDStruct)
{ ADC_THDStruct->THDChannel = ADC_THDCHANNEL0; ADC_THDStruct->UpperTHD = 0x0000; ADC_THDStruct->LowerTHD = 0x0000; ADC_THDStruct->TriggerSel = ADC_THDSEL_HIGH; ADC_THDStruct->THDSource = ADC_CHANNEL_GND0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* e1000_init_function_pointers_vf - Inits function pointers @hw: pointer to the HW structure */
void e1000_init_function_pointers_vf(struct e1000_hw *hw)
/* e1000_init_function_pointers_vf - Inits function pointers @hw: pointer to the HW structure */ void e1000_init_function_pointers_vf(struct e1000_hw *hw)
{ hw->mac.ops.init_params = e1000_init_mac_params_vf; hw->mbx.ops.init_params = e1000_init_mbx_params_vf; }
robutest/uclinux
C++
GPL-2.0
60
/* param base DCP peripheral base address. param handle Specifies DCP channel. return kStatus_Success When data processing completes without error. return kStatus_Fail When error occurs. */
status_t DCP_WaitForChannelComplete(DCP_Type *base, dcp_handle_t *handle)
/* param base DCP peripheral base address. param handle Specifies DCP channel. return kStatus_Success When data processing completes without error. return kStatus_Fail When error occurs. */ status_t DCP_WaitForChannelComplete(DCP_Type *base, dcp_handle_t *handle)
{ while ((base->STAT & (uint32_t)handle->channel) == handle->channel) { } if (dcp_get_channel_status(base, handle->channel) != kStatus_Success) { dcp_clear_status(base); dcp_clear_channel_status(base, handle->channel); return kStatus_Fail; } return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* timer callback to defer refill rx queue in case we're OOM */
static void bcm_enet_refill_rx_timer(unsigned long data)
/* timer callback to defer refill rx queue in case we're OOM */ static void bcm_enet_refill_rx_timer(unsigned long data)
{ struct net_device *dev; struct bcm_enet_priv *priv; dev = (struct net_device *)data; priv = netdev_priv(dev); spin_lock(&priv->rx_lock); bcm_enet_refill_rx((struct net_device *)data); spin_unlock(&priv->rx_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* inform the correct pnp protocol so that resources can be used by other devices */
int pnp_disable_dev(struct pnp_dev *dev)
/* inform the correct pnp protocol so that resources can be used by other devices */ int pnp_disable_dev(struct pnp_dev *dev)
{ int error; if (!dev->active) return 0; error = pnp_stop_dev(dev); if (error) return error; dev->active = 0; mutex_lock(&pnp_res_mutex); pnp_clean_resource_table(dev); mutex_unlock(&pnp_res_mutex); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Gets the status of a job running on serializer. Gets the status of an ongoing or the last job. */
enum status_code i2s_serializer_get_job_status(const struct i2s_module *const module_inst, const enum i2s_serializer serializer, const enum i2s_job_type job_type)
/* Gets the status of a job running on serializer. Gets the status of an ongoing or the last job. */ enum status_code i2s_serializer_get_job_status(const struct i2s_module *const module_inst, const enum i2s_serializer serializer, const enum i2s_job_type job_type)
{ Assert(module_inst); Assert(serializer < I2S_SERIALIZER_N); if (job_type == I2S_JOB_WRITE_BUFFER || job_type == I2S_JOB_READ_BUFFER) { return module_inst->serializer[serializer].job_status; } else { return STATUS_ERR_INVALID_ARG; } }
memfault/zero-to-main
C++
null
200
/* inc->i_saddr isn't used here because it is only set in the receive path. */
void rds_inc_info_copy(struct rds_incoming *inc, struct rds_info_iterator *iter, __be32 saddr, __be32 daddr, int flip)
/* inc->i_saddr isn't used here because it is only set in the receive path. */ void rds_inc_info_copy(struct rds_incoming *inc, struct rds_info_iterator *iter, __be32 saddr, __be32 daddr, int flip)
{ struct rds_info_message minfo; minfo.seq = be64_to_cpu(inc->i_hdr.h_sequence); minfo.len = be32_to_cpu(inc->i_hdr.h_len); if (flip) { minfo.laddr = daddr; minfo.faddr = saddr; minfo.lport = inc->i_hdr.h_dport; minfo.fport = inc->i_hdr.h_sport; } else { minfo.laddr = saddr; minfo.faddr = daddr; minfo.lport = inc->i_hdr.h_sport; minfo.fport = inc->i_hdr.h_dport; } rds_info_copy(iter, &minfo, sizeof(minfo)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The function is used to Enable frequency clock output and set its divider value. */
void SysCtlFreqDividerOutputEnable(xtBoolean bEnable, unsigned char u8Divider)
/* The function is used to Enable frequency clock output and set its divider value. */ void SysCtlFreqDividerOutputEnable(xtBoolean bEnable, unsigned char u8Divider)
{ xASSERT(u8Divider<=15); if(bEnable) { xHWREG(SYSCLK_FRQDIV) &= ~SYSCLK_FRQDIV_FSEL_M; xHWREG(SYSCLK_FRQDIV) |= u8Divider; xHWREG(SYSCLK_FRQDIV) |= SYSCLK_FRQDIV_FDIV_EN; xSysCtlPeripheralEnable(SYSCTL_PERIPH_FDIV); } else { xHWREG(SYSCLK_FRQDIV) &= ~SYSCLK_FRQDIV_FDIV_EN; xSysCtlPeripheralDisable(SYSCTL_PERIPH_FDIV); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Convert the poll rate to the maximum 2^n that is smaller than Interval. */
UINTN UhciConvertPollRate(IN UINTN Interval)
/* Convert the poll rate to the maximum 2^n that is smaller than Interval. */ UINTN UhciConvertPollRate(IN UINTN Interval)
{ UINTN BitCount; ASSERT (Interval != 0); if (Interval == 0) { Interval = 1; } BitCount = 0; while (Interval != 0) { Interval >>= 1; BitCount++; } return (UINTN)1 << (BitCount - 1); }
tianocore/edk2
C++
Other
4,240
/* AES128 encryption: Given AES128 key and 16 bytes plain text, cipher text of 16 bytes is computed. The AES implementation is in mode ECB (Electronic Code Book). aes_encrypt */
void aes_encrypt(UINT8 *state, UINT8 *key)
/* AES128 encryption: Given AES128 key and 16 bytes plain text, cipher text of 16 bytes is computed. The AES implementation is in mode ECB (Electronic Code Book). aes_encrypt */ void aes_encrypt(UINT8 *state, UINT8 *key)
{ expandKey(expandedKey, key); aes_encr(state, expandedKey); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Drop destination transaction entry when we know it and when we already removed dst from state tree. */
void netfs_trans_drop_dst_nostate(struct netfs_trans_dst *dst)
/* Drop destination transaction entry when we know it and when we already removed dst from state tree. */ void netfs_trans_drop_dst_nostate(struct netfs_trans_dst *dst)
{ struct netfs_trans *t = dst->trans; spin_lock(&t->dst_lock); list_del_init(&dst->trans_entry); spin_unlock(&t->dst_lock); netfs_trans_free_dst(dst); }
robutest/uclinux
C++
GPL-2.0
60
/* Drop a reference to the resource addressed by a key. The hash bucket spinlock must not be held. */
static void drop_futex_key_refs(union futex_key *key)
/* Drop a reference to the resource addressed by a key. The hash bucket spinlock must not be held. */ static void drop_futex_key_refs(union futex_key *key)
{ if (!key->both.ptr) { WARN_ON_ONCE(1); return; } switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) { case FUT_OFF_INODE: iput(key->shared.inode); break; case FUT_OFF_MMSHARED: mmdrop(key->private.mm); break; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* LTDC MSP De-Initialization This function frees the hardware resources used in this example: */
void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc)
/* LTDC MSP De-Initialization This function frees the hardware resources used in this example: */ void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc)
{ __HAL_RCC_LTDC_FORCE_RESET(); __HAL_RCC_LTDC_RELEASE_RESET(); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* The following attributes must be set in the template: */
int rtnl_neigh_build_add_request(struct rtnl_neigh *tmpl, int flags, struct nl_msg **result)
/* The following attributes must be set in the template: */ int rtnl_neigh_build_add_request(struct rtnl_neigh *tmpl, int flags, struct nl_msg **result)
{ return build_neigh_msg(tmpl, RTM_NEWNEIGH, flags, result); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* helper to check if a given offset is inside a given entry */
static int offset_in_entry(struct btrfs_ordered_extent *entry, u64 file_offset)
/* helper to check if a given offset is inside a given entry */ static int offset_in_entry(struct btrfs_ordered_extent *entry, u64 file_offset)
{ if (file_offset < entry->file_offset || entry->file_offset + entry->len <= file_offset) return 0; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Set the specified data holding register value for DAC channel 1. */
void DAC_ConfigChannel1Data(DAC_ALIGN_T align, uint16_t data)
/* Set the specified data holding register value for DAC channel 1. */ void DAC_ConfigChannel1Data(DAC_ALIGN_T align, uint16_t data)
{ __IO uint32_t tmp = 0; tmp = (uint32_t)DAC_BASE; tmp += 0x00000008 + align; *(__IO uint32_t *) tmp = data; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Connects the USB controller to the bus in device mode. */
void USBDevConnect(unsigned long ulBase)
/* Connects the USB controller to the bus in device mode. */ void USBDevConnect(unsigned long ulBase)
{ ASSERT(ulBase == USB0_BASE); HWREGB(ulBase + USB_O_POWER) |= USB_POWER_SOFTCONN; }
watterott/WebRadio
C++
null
71
/* edac_device_workq_teardown stop the workq processing on this edac_dev */
void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev)
/* edac_device_workq_teardown stop the workq processing on this edac_dev */ void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev)
{ int status; status = cancel_delayed_work(&edac_dev->work); if (status == 0) { flush_workqueue(edac_workqueue); } }
robutest/uclinux
C++
GPL-2.0
60
/* This helper function reads properties of a LEB @lnum and stores them in @lp. Returns zero in case of success and a negative error code in case of failure. */
int ubifs_read_one_lp(struct ubifs_info *c, int lnum, struct ubifs_lprops *lp)
/* This helper function reads properties of a LEB @lnum and stores them in @lp. Returns zero in case of success and a negative error code in case of failure. */ int ubifs_read_one_lp(struct ubifs_info *c, int lnum, struct ubifs_lprops *lp)
{ int err = 0; const struct ubifs_lprops *lpp; ubifs_get_lprops(c); lpp = ubifs_lpt_lookup(c, lnum); if (IS_ERR(lpp)) { err = PTR_ERR(lpp); ubifs_err(c, "cannot read properties of LEB %d, error %d", lnum, err); goto out; } memcpy(lp, lpp, sizeof(struct ubifs_lprops)); out: ubifs_release_lprops(c); return err; }
4ms/stm32mp1-baremetal
C++
Other
137
/* As well as checking the version compatibility this always copies the kernel interface version out. */
static int check_dev_ioctl_version(int cmd, struct autofs_dev_ioctl *param)
/* As well as checking the version compatibility this always copies the kernel interface version out. */ static int check_dev_ioctl_version(int cmd, struct autofs_dev_ioctl *param)
{ int err = 0; if ((AUTOFS_DEV_IOCTL_VERSION_MAJOR != param->ver_major) || (AUTOFS_DEV_IOCTL_VERSION_MINOR < param->ver_minor)) { AUTOFS_WARN("ioctl control interface version mismatch: " "kernel(%u.%u), user(%u.%u), cmd(%d)", AUTOFS_DEV_IOCTL_VERSION_MAJOR, AUTOFS_DEV_IOCTL_VERSION_MINOR, param->ver_major, param->ver_minor, cmd); err = -EINVAL; } param->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR; param->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR; return err; }
robutest/uclinux
C++
GPL-2.0
60
/* USBH_MSC_IsReady The function check if the MSC function is ready. */
uint8_t USBH_MSC_IsReady(USBH_HandleTypeDef *phost)
/* USBH_MSC_IsReady The function check if the MSC function is ready. */ uint8_t USBH_MSC_IsReady(USBH_HandleTypeDef *phost)
{ if ((phost->device.is_connected == 0U) || (phost->gState != HOST_CLASS)) { return 0; } if (phost->pActiveClass == NULL || phost->pActiveClass->pData == NULL) { return 0; } MSC_HandleTypeDef *MSC_Handle = (MSC_HandleTypeDef*) phost->pActiveClass->pData; uint8_t res; if ((phost->gState == HOST_CLASS) && (MSC_Handle->state == MSC_IDLE)) { res = 1U; } else { res = 0U; } return res; }
ua1arn/hftrx
C++
null
69
/* Returns values used to fill in the AttributesSupported and AttributesSettings fields of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo() service of the Firmware Management Protocol. The following bit values from the Firmware Management Protocol may be combined: IMAGE_ATTRIBUTE_IMAGE_UPDATABLE IMAGE_ATTRIBUTE_RESET_REQUIRED IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED IMAGE_ATTRIBUTE_IN_USE IMAGE_ATTRIBUTE_UEFI_IMAGE */
EFI_STATUS EFIAPI FmpDeviceGetAttributes(OUT UINT64 *Supported, OUT UINT64 *Setting)
/* Returns values used to fill in the AttributesSupported and AttributesSettings fields of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo() service of the Firmware Management Protocol. The following bit values from the Firmware Management Protocol may be combined: IMAGE_ATTRIBUTE_IMAGE_UPDATABLE IMAGE_ATTRIBUTE_RESET_REQUIRED IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED IMAGE_ATTRIBUTE_IN_USE IMAGE_ATTRIBUTE_UEFI_IMAGE */ EFI_STATUS EFIAPI FmpDeviceGetAttributes(OUT UINT64 *Supported, OUT UINT64 *Setting)
{ if ((Supported == NULL) || (Setting == NULL)) { return EFI_INVALID_PARAMETER; } *Supported = 0; *Setting = 0; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Lookup a cache description string from the mCpuidCacheInfoDescription table. */
CPUID_CACHE_INFO_DESCRIPTION* LookupCacheDescription(UINT8 CacheDescriptor)
/* Lookup a cache description string from the mCpuidCacheInfoDescription table. */ CPUID_CACHE_INFO_DESCRIPTION* LookupCacheDescription(UINT8 CacheDescriptor)
{ UINTN NumDescriptors; UINTN Descriptor; if (CacheDescriptor == 0x00) { return NULL; } NumDescriptors = sizeof (mCpuidCacheInfoDescription)/sizeof (mCpuidCacheInfoDescription[0]); for (Descriptor = 0; Descriptor < NumDescriptors; Descriptor++) { if (CacheDescriptor == mCpuidCacheInfoDescription[Descriptor].CacheDescriptor) { return &mCpuidCacheInfoDescription[Descriptor]; } } return NULL; }
tianocore/edk2
C++
Other
4,240
/* Cyrix: nibble offset 0x5C 0x5C bits 7:4 is INTB bits 3:0 is INTA 0x5D bits 7:4 is INTD bits 3:0 is INTC */
static int pirq_cyrix_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
/* Cyrix: nibble offset 0x5C 0x5C bits 7:4 is INTB bits 3:0 is INTA 0x5D bits 7:4 is INTD bits 3:0 is INTC */ static int pirq_cyrix_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
{ return read_config_nybble(router, 0x5C, (pirq-1)^1); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set the target cores to receive the specified common interrupt when it is triggered */
void z_arc_connect_idu_set_dest(uint32_t irq_num, uint32_t core_mask)
/* Set the target cores to receive the specified common interrupt when it is triggered */ void z_arc_connect_idu_set_dest(uint32_t irq_num, uint32_t core_mask)
{ K_SPINLOCK(&arc_connect_spinlock) { z_arc_connect_cmd_data(ARC_CONNECT_CMD_IDU_SET_DEST, irq_num, core_mask); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function validates the Device Handle Type field in the Generic Initiator Affinity Structure. */
STATIC VOID EFIAPI ValidateSratDeviceHandleType(IN UINT8 *Ptr, IN VOID *Context)
/* This function validates the Device Handle Type field in the Generic Initiator Affinity Structure. */ STATIC VOID EFIAPI ValidateSratDeviceHandleType(IN UINT8 *Ptr, IN VOID *Context)
{ UINT8 DeviceHandleType; DeviceHandleType = *Ptr; if (DeviceHandleType > EFI_ACPI_6_3_PCI_DEVICE_HANDLE) { IncrementErrorCount (); Print ( L"\nERROR: Invalid Device Handle Type: %d. Must be between 0 and %d.", DeviceHandleType, EFI_ACPI_6_3_PCI_DEVICE_HANDLE ); } }
tianocore/edk2
C++
Other
4,240
/* Insert a new node in front of the n_act node */
void* _lv_ll_ins_prev(lv_ll_t *ll_p, void *n_act)
/* Insert a new node in front of the n_act node */ void* _lv_ll_ins_prev(lv_ll_t *ll_p, void *n_act)
{ lv_ll_node_t * n_new; if(NULL == ll_p || NULL == n_act) return NULL; if(_lv_ll_get_head(ll_p) == n_act) { n_new = _lv_ll_ins_head(ll_p); if(n_new == NULL) return NULL; } else { n_new = lv_mem_alloc(ll_p->n_size + LL_NODE_META_SIZE); if(n_new == NULL) return NULL; lv_ll_node_t * n_prev; n_prev = _lv_ll_get_prev(ll_p, n_act); node_set_next(ll_p, n_prev, n_new); node_set_prev(ll_p, n_new, n_prev); node_set_prev(ll_p, n_act, n_new); node_set_next(ll_p, n_new, n_act); } return n_new; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Close a cache and release the kmem_cache structure (must be used for caches created using kmem_cache_create) */
void kmem_cache_destroy(struct kmem_cache *s)
/* Close a cache and release the kmem_cache structure (must be used for caches created using kmem_cache_create) */ void kmem_cache_destroy(struct kmem_cache *s)
{ down_write(&slub_lock); s->refcount--; if (!s->refcount) { list_del(&s->list); up_write(&slub_lock); if (kmem_cache_close(s)) { printk(KERN_ERR "SLUB %s: %s called for cache that " "still has objects.\n", s->name, __func__); dump_stack(); } if (s->flags & SLAB_DESTROY_BY_RCU) rcu_barrier(); sysfs_slab_remove(s); } else up_write(&slub_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Clear the overflow condition on the ADC sample sequence. */
void xADCOverflowClear(unsigned long ulBase)
/* Clear the overflow condition on the ADC sample sequence. */ void xADCOverflowClear(unsigned long ulBase)
{ unsigned long i; unsigned long ulOverRunChannels; volatile unsigned long ulDump; xASSERT(ulBase == ADC0_BASE); ulOverRunChannels = (xHWREG(ulBase + ADC_STATUS1) & ADC_STATUS1_OV_M) >> ADC_STATUS1_OV_S; for(i = 0; i < 8; i++) { if(ulOverRunChannels & (1 << i)) { ulDump = xHWREG(ulBase + ADC_DR0 + (4 * i)); } } ulOverRunChannels = ulDump; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Subtract two Big Numbers. Please note, all "out" Big number arguments should be properly initialized by calling to */
BOOLEAN EFIAPI BigNumSub(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes)
/* Subtract two Big Numbers. Please note, all "out" Big number arguments should be properly initialized by calling to */ BOOLEAN EFIAPI BigNumSub(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes)
{ CALL_CRYPTO_SERVICE (BigNumSub, (BnA, BnB, BnRes), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Add a trace buffer entry for arguments, for int, fsblock, rec. */
void xfs_btree_trace_argipr(const char *func, struct xfs_btree_cur *cur, int i, union xfs_btree_ptr ptr, union xfs_btree_rec *rec, int line)
/* Add a trace buffer entry for arguments, for int, fsblock, rec. */ void xfs_btree_trace_argipr(const char *func, struct xfs_btree_cur *cur, int i, union xfs_btree_ptr ptr, union xfs_btree_rec *rec, int line)
{ __psunsigned_t high, low; __uint64_t l0, l1, l2; xfs_btree_trace_ptr(cur, ptr, &high, &low); cur->bc_ops->trace_record(cur, rec, &l0, &l1, &l2); cur->bc_ops->trace_enter(cur, func, XBT_ARGS, XFS_BTREE_KTRACE_ARGIPR, line, i, high, low, l0 >> 32, (int)l0, l1 >> 32, (int)l1, l2 >> 32, (int)l2, 0, 0); }
robutest/uclinux
C++
GPL-2.0
60
/* This API is used to get the nvm program ready in the register bit 2. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_nvmprog_ready(u8 *nvprog_ready_u8)
/* This API is used to get the nvm program ready in the register bit 2. */ BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_nvmprog_ready(u8 *nvprog_ready_u8)
{ BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR; u8 data_u8 = BMA2x2_INIT_VALUE; if (p_bma2x2 == BMA2x2_NULL) { com_rslt = E_BMA2x2_NULL_PTR; } else { com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC (p_bma2x2->dev_addr, BMA2x2_EE_PROG_READY_REG, &data_u8, BMA2x2_GEN_READ_WRITE_LENGTH); *nvprog_ready_u8 = BMA2x2_GET_BITSLICE (data_u8, BMA2x2_EE_PROG_READY); } return com_rslt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* See the vsnprintf() documentation for format string extensions over C99. */
int vsprintf(char *buf, const char *fmt, va_list args)
/* See the vsnprintf() documentation for format string extensions over C99. */ int vsprintf(char *buf, const char *fmt, va_list args)
{ return vsnprintf(buf, INT_MAX, fmt, args); }
robutest/uclinux
C++
GPL-2.0
60