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
/* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd)
/* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd)
{ if(hpcd->Instance==USB_OTG_FS) { __HAL_RCC_USB_OTG_FS_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_12|GPIO_PIN_11); HAL_NVIC_DisableIRQ(OTG_FS_IRQn); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Description: Searches the IPv4 address list given by @head. If a matching address entry is found it is returned, otherwise NULL is returned. The caller is responsible for calling the rcu_read_lock() functions. */
struct netlbl_af4list* netlbl_af4list_search(__be32 addr, struct list_head *head)
/* Description: Searches the IPv4 address list given by @head. If a matching address entry is found it is returned, otherwise NULL is returned. The caller is responsible for calling the rcu_read_lock() functions. */ struct netlbl_af4list* netlbl_af4list_search(__be32 addr, struct list_head *head)
{ struct netlbl_af4list *iter; list_for_each_entry_rcu(iter, head, list) if (iter->valid && (addr & iter->mask) == iter->addr) return iter; return NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Must use 32 bit timer ~12ns tick, 84MHz, 1s period. */
HAL_StatusTypeDef tick_timer_init()
/* Must use 32 bit timer ~12ns tick, 84MHz, 1s period. */ HAL_StatusTypeDef tick_timer_init()
{ return HAL_TIM_Base_Start_IT(&h_tick_tim); } return status; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Set specified GPIO as wake up source at Stand-by Power down mode. */
void CLK_EnableSPDWKPin(uint32_t u32Port, uint32_t u32Pin, uint32_t u32TriggerType, uint32_t u32DebounceEn)
/* Set specified GPIO as wake up source at Stand-by Power down mode. */ void CLK_EnableSPDWKPin(uint32_t u32Port, uint32_t u32Pin, uint32_t u32TriggerType, uint32_t u32DebounceEn)
{ uint32_t u32tmpAddr = 0UL; uint32_t u32tmpVal = 0UL; u32tmpAddr = (uint32_t)&CLK->PASWKCTL; u32tmpAddr += (0x4UL * u32Port); u32tmpVal = inpw((uint32_t *)u32tmpAddr); u32tmpVal = (u32tmpVal & ~(CLK_PASWKCTL_WKPSEL_Msk | CLK_PASWKCTL_PRWKEN_Msk | CLK_PASWKCTL_PFWKEN_Msk | CLK_PASWKCTL_DBEN_Msk | CLK_PASWKCTL_WKEN_Msk)) | (u32Pin << CLK_PASWKCTL_WKPSEL_Pos) | u32TriggerType | u32DebounceEn | CLK_SPDWKPIN_ENABLE; outpw((uint32_t *)u32tmpAddr, u32tmpVal); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Forces or releases High Speed APB (APB2) peripheral reset. */
void RCC_EnableAPB2PeriphReset(uint32_t RCC_APB2Periph, FunctionalState Cmd)
/* Forces or releases High Speed APB (APB2) peripheral reset. */ void RCC_EnableAPB2PeriphReset(uint32_t RCC_APB2Periph, FunctionalState Cmd)
{ assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { RCC->APB2PRST |= RCC_APB2Periph; } else { RCC->APB2PRST &= ~RCC_APB2Periph; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If the RTA or its host appears in the RIOBindTab structure then we mustn't boot the RTA and should return 0. This operation is slightly different from the other drivers for RIO in that this is designed to work with the new utilities not config.rio and is FAR SIMPLER. We no longer support the RIOBootMode variable. It is all done from the "boot/noboot" field in the rio.cf file. */
int RIOBootOk(struct rio_info *p, struct Host *HostP, unsigned long RtaUniq)
/* If the RTA or its host appears in the RIOBindTab structure then we mustn't boot the RTA and should return 0. This operation is slightly different from the other drivers for RIO in that this is designed to work with the new utilities not config.rio and is FAR SIMPLER. We no longer support the RIOBootMode variable. It is all done from the "boot/noboot" field in the rio.cf file. */ int RIOBootOk(struct rio_info *p, struct Host *HostP, unsigned long RtaUniq)
{ int Entry; unsigned int HostUniq = HostP->UniqueNum; for (Entry = 0; (Entry < MAX_RTA_BINDINGS) && (p->RIOBindTab[Entry] != 0); Entry++) { if ((p->RIOBindTab[Entry] == HostUniq) || (p->RIOBindTab[Entry] == RtaUniq)) return 0; } return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Unconditionally switch the system clock source to HSI. */
static __unused void stm32_clock_switch_to_hsi(void)
/* Unconditionally switch the system clock source to HSI. */ static __unused void stm32_clock_switch_to_hsi(void)
{ if (LL_RCC_HSI_IsReady() != 1) { LL_RCC_HSI_Enable(); while (LL_RCC_HSI_IsReady() != 1) { } } LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSI); while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSI) { } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI EmuSnpDriverComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */ EFI_STATUS EFIAPI EmuSnpDriverComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mEmuSnpDriverNameTable, DriverName, (BOOLEAN)(This == &gEmuSnpDriverComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* check whether, in an assignment to an upvalue/local variable, the upvalue/local variable is begin used in a previous assignment to a table. If so, save original upvalue/local value in a safe place and use this safe copy in the previous assignment. */
static void check_conflict(LexState *ls, struct LHS_assign *lh, expdesc *v)
/* check whether, in an assignment to an upvalue/local variable, the upvalue/local variable is begin used in a previous assignment to a table. If so, save original upvalue/local value in a safe place and use this safe copy in the previous assignment. */ static void check_conflict(LexState *ls, struct LHS_assign *lh, expdesc *v)
{ if (lh->v.k == VINDEXED) { if (lh->v.u.ind.vt == v->k && lh->v.u.ind.t == v->u.info) { conflict = 1; lh->v.u.ind.vt = VLOCAL; lh->v.u.ind.t = extra; } if (v->k == VLOCAL && lh->v.u.ind.idx == v->u.info) { conflict = 1; lh->v.u.ind.idx = extra; } } } if (conflict) { OpCode op = (v->k == VLOCAL) ? OP_MOVE : OP_GETUPVAL; luaK_codeABC(fs, op, extra, v->u.info, 0); luaK_reserveregs(fs, 1); } }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* Function for notifying an application of command completion and transitioning to an error state. */
static void app_notify_error_state_transit(uint32_t result)
/* Function for notifying an application of command completion and transitioning to an error state. */ static void app_notify_error_state_transit(uint32_t result)
{ app_notify(result, &m_cmd_queue.cmd[m_cmd_queue.rp]); sm_state_change(STATE_ERROR); }
labapart/polymcu
C++
null
201
/* Initializes the WWDG peripheral. This function set Window Register = WindowValue, Counter Register according to Counter and */
void WWDG_Init(uint8_t Counter, uint8_t WindowValue)
/* Initializes the WWDG peripheral. This function set Window Register = WindowValue, Counter Register according to Counter and */ void WWDG_Init(uint8_t Counter, uint8_t WindowValue)
{ assert_param(IS_WWDG_WINDOW_LIMIT_VALUE(WindowValue)); WWDG->WR = WWDG_WR_RESET_VALUE; WWDG->CR = (uint8_t)(WWDG_CR_WDGA | Counter); WWDG->WR = (uint8_t)((uint8_t)BIT_MASK & (uint8_t) WindowValue); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Selects Batching Data Rate (writing frequency in FIFO) for gyroscope data.. */
int32_t lsm6dso_fifo_gy_batch_set(lsm6dso_ctx_t *ctx, lsm6dso_bdr_gy_t val)
/* Selects Batching Data Rate (writing frequency in FIFO) for gyroscope data.. */ int32_t lsm6dso_fifo_gy_batch_set(lsm6dso_ctx_t *ctx, lsm6dso_bdr_gy_t val)
{ lsm6dso_fifo_ctrl3_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_FIFO_CTRL3, (uint8_t*)&reg, 1); if (ret == 0) { reg.bdr_gy = (uint8_t)val; ret = lsm6dso_write_reg(ctx, LSM6DSO_FIFO_CTRL3, (uint8_t*)&reg, 1); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* brief DMA instance 0, channel 15 IRQ handler. */
void EDMA_0_CH15_DriverIRQHandler(void)
/* brief DMA instance 0, channel 15 IRQ handler. */ void EDMA_0_CH15_DriverIRQHandler(void)
{ EDMA_DriverIRQHandler(0U, 15U); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* BACnetDateTime ::= SEQUENCE { date Date, time Time } */
static guint fDateTime(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, const gchar *label)
/* BACnetDateTime ::= SEQUENCE { date Date, time Time } */ static guint fDateTime(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, const gchar *label)
{ proto_tree *subtree = tree; if (label != NULL) { subtree = proto_tree_add_subtree(subtree, tvb, offset, 10, ett_bacapp_value, NULL, label); } offset = fDate(tvb, pinfo, subtree, offset, "Date: "); return fTime(tvb, pinfo, subtree, offset, "Time: "); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Register a function to be called on shutdown. Only use this if you can't reset your device in the second kernel. */
int crash_shutdown_register(crash_shutdown_t handler)
/* Register a function to be called on shutdown. Only use this if you can't reset your device in the second kernel. */ int crash_shutdown_register(crash_shutdown_t handler)
{ unsigned int i, rc; spin_lock(&crash_handlers_lock); for (i = 0 ; i < CRASH_HANDLER_MAX; i++) if (!crash_shutdown_handles[i]) { crash_shutdown_handles[i] = handler; rc = 0; break; } if (i == CRASH_HANDLER_MAX) { printk(KERN_ERR "Crash shutdown handles full, " "not registered.\n"); rc = 1; } spin_unlock(&crash_handlers_lock); return rc; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This routine simulates a hangup on the tty, to arrange that users are given clean terminals at login time. */
SYSCALL_DEFINE0(vhangup)
/* This routine simulates a hangup on the tty, to arrange that users are given clean terminals at login time. */ SYSCALL_DEFINE0(vhangup)
{ if (capable(CAP_SYS_TTY_CONFIG)) { tty_vhangup_self(); return 0; } return -EPERM; }
robutest/uclinux
C++
GPL-2.0
60
/* hcu_led_set value to be placed into the LEDs (max 6 bit) */
void hcu_led_set(u32 value)
/* hcu_led_set value to be placed into the LEDs (max 6 bit) */ void hcu_led_set(u32 value)
{ out16(SYS_IO_ADDRESS, value); }
EmcraftSystems/u-boot
C++
Other
181
/* ERXRDPT need to be set always at odd addresses, refer to errata datasheet */
static u16 erxrdpt_workaround(u16 next_packet_ptr, u16 start, u16 end)
/* ERXRDPT need to be set always at odd addresses, refer to errata datasheet */ static u16 erxrdpt_workaround(u16 next_packet_ptr, u16 start, u16 end)
{ u16 erxrdpt; if ((next_packet_ptr - 1 < start) || (next_packet_ptr - 1 > end)) erxrdpt = end; else erxrdpt = next_packet_ptr - 1; return erxrdpt; }
robutest/uclinux
C++
GPL-2.0
60
/* iommu_put - Put back iommu handler @obj: target iommu */
void iommu_put(struct iommu *obj)
/* iommu_put - Put back iommu handler @obj: target iommu */ void iommu_put(struct iommu *obj)
{ if (!obj || IS_ERR(obj)) return; mutex_lock(&obj->iommu_lock); if (--obj->refcount == 0) iommu_disable(obj); module_put(obj->owner); mutex_unlock(&obj->iommu_lock); dev_dbg(obj->dev, "%s: %s\n", __func__, obj->name); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get Sign, NaturalUnits, and ConstantUnits of the DWORD data. */
BOOLEAN EdbGetNaturalIndex32(IN UINT32 Data32, OUT UINTN *NaturalUnits, OUT UINTN *ConstantUnits)
/* Get Sign, NaturalUnits, and ConstantUnits of the DWORD data. */ BOOLEAN EdbGetNaturalIndex32(IN UINT32 Data32, OUT UINTN *NaturalUnits, OUT UINTN *ConstantUnits)
{ BOOLEAN Sign; UINTN NaturalUnitBit; Sign = (BOOLEAN)(Data32 >> 31); NaturalUnitBit = (UINTN)((Data32 >> 28) & 0x7); NaturalUnitBit *= 4; Data32 = Data32 & 0xFFFFFFF; *NaturalUnits = (UINTN)(Data32 & ((1 << NaturalUnitBit) - 1)); *ConstantUnits = (UINTN)((Data32 >> NaturalUnitBit) & ((1 << (28 - NaturalUnitBit)) - 1)); return Sign; }
tianocore/edk2
C++
Other
4,240
/* If SourceSize is less than LZMA_HEADER_SIZE, then ASSERT(). */
RETURN_STATUS EFIAPI LzmaUefiDecompressGetInfo(IN CONST VOID *Source, IN UINT32 SourceSize, OUT UINT32 *DestinationSize, OUT UINT32 *ScratchSize)
/* If SourceSize is less than LZMA_HEADER_SIZE, then ASSERT(). */ RETURN_STATUS EFIAPI LzmaUefiDecompressGetInfo(IN CONST VOID *Source, IN UINT32 SourceSize, OUT UINT32 *DestinationSize, OUT UINT32 *ScratchSize)
{ UInt64 DecodedSize; ASSERT (SourceSize >= LZMA_HEADER_SIZE); DecodedSize = GetDecodedSizeOfBuf ((UINT8 *)Source); if (DecodedSize > MAX_UINT32) { return RETURN_UNSUPPORTED; } *DestinationSize = (UINT32)DecodedSize; *ScratchSize = SCRATCH_BUFFER_REQUEST_SIZE; return RETURN_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Go from a u32 'context' to a struct scsi_cmnd * . This could probably be made more efficient. */
static struct scsi_cmnd* adpt_cmd_from_context(adpt_hba *pHba, u32 context)
/* Go from a u32 'context' to a struct scsi_cmnd * . This could probably be made more efficient. */ static struct scsi_cmnd* adpt_cmd_from_context(adpt_hba *pHba, u32 context)
{ struct scsi_cmnd * cmd; struct scsi_device * d; if (context == 0) return NULL; spin_unlock(pHba->host->host_lock); shost_for_each_device(d, pHba->host) { unsigned long flags; spin_lock_irqsave(&d->list_lock, flags); list_for_each_entry(cmd, &d->cmd_list, list) { if (((u32)cmd->serial_number == context)) { spin_unlock_irqrestore(&d->list_lock, flags); scsi_device_put(d); spin_lock(pHba->host->host_lock); return cmd; } } spin_unlock_irqrestore(&d->list_lock, flags); } spin_lock(pHba->host->host_lock); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Check for AMD CPUs, which have potentially C1E support */
static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
/* Check for AMD CPUs, which have potentially C1E support */ static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
{ if (c->x86_vendor != X86_VENDOR_AMD) return 0; if (c->x86 < 0x0F) return 0; if (c->x86 == 0x0f && c->x86_model < 0x40) return 0; return 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables or disables the TIMx peripheral Preload register on CCR2. */
void TIM_OC2PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
/* Enables or disables the TIMx peripheral Preload register on CCR2. */ void TIM_OC2PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
{ uint16_t tmpccmr1 = 0; assert_param(IS_TIM_123458_PERIPH(TIMx)); assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload)); tmpccmr1 = TIMx->CCMR1; tmpccmr1 &= CCMR_OC24PE_Reset; tmpccmr1 |= (uint16_t)(TIM_OCPreload << 8); TIMx->CCMR1 = tmpccmr1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enables or disables TIMx peripheral Preload register on ARR. */
void TIM_ARRPreloadConfig(TIM_TypeDef *TIMx, FunctionalState NewState)
/* Enables or disables TIMx peripheral Preload register on ARR. */ void TIM_ARRPreloadConfig(TIM_TypeDef *TIMx, FunctionalState NewState)
{ assert_param(IS_TIM_ALL_PERIPH(TIMx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { TIMx->CR1 |= CR1_ARPE_Set; } else { TIMx->CR1 &= CR1_ARPE_Reset; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the 8-bit data stored in the Independent Data(ID) register. */
uint8_t CRC_GetIDRegister(void)
/* Returns the 8-bit data stored in the Independent Data(ID) register. */ uint8_t CRC_GetIDRegister(void)
{ return (uint8_t)(CRC->IDR); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Update CR6 value Firstly stop ULI526X, then written value and start */
static void update_cr6(u32, unsigned long)
/* Update CR6 value Firstly stop ULI526X, then written value and start */ static void update_cr6(u32, unsigned long)
{ outl(cr6_data, ioaddr + DCR6); udelay(5); }
EmcraftSystems/u-boot
C++
Other
181
/* Called in case unsolicited event from type HCI_EVNT_DATA_UNSOL_FREE_BUFF has received. Keep track on the number of packets transmitted and update the number of free buffer in the SL device. hci_event_unsol_flowcontrol_handler */
INT32 hci_event_unsol_flowcontrol_handler(CHAR *pEvent)
/* Called in case unsolicited event from type HCI_EVNT_DATA_UNSOL_FREE_BUFF has received. Keep track on the number of packets transmitted and update the number of free buffer in the SL device. hci_event_unsol_flowcontrol_handler */ INT32 hci_event_unsol_flowcontrol_handler(CHAR *pEvent)
{ INT32 temp, value; UINT16 i; UINT16 pusNumberOfHandles=0; CHAR *pReadPayload; STREAM_TO_UINT16((CHAR *)pEvent,HCI_EVENT_HEADER_SIZE,pusNumberOfHandles); pReadPayload = ((CHAR *)pEvent + HCI_EVENT_HEADER_SIZE + sizeof(pusNumberOfHandles)); temp = 0; for(i = 0; i < pusNumberOfHandles ; i++) { STREAM_TO_UINT16(pReadPayload, FLOW_CONTROL_EVENT_FREE_BUFFS_OFFSET, value); temp += value; pReadPayload += FLOW_CONTROL_EVENT_SIZE; } tSLInformation.usNumberOfFreeBuffers += temp; tSLInformation.NumberOfReleasedPackets += temp; return(ESUCCESS); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This file is part of the Simba project. */
int mock_write_chan_module_init(int res)
/* This file is part of the Simba project. */ int mock_write_chan_module_init(int res)
{ harness_mock_write("chan_module_init()", NULL, 0); harness_mock_write("chan_module_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* Return the number of memory types in range [BaseAddress, BaseAddress + Length). */
UINT8 MtrrLibGetNumberOfTypes(IN CONST MTRR_MEMORY_RANGE *Ranges, IN UINTN RangeCount, IN UINT64 BaseAddress, IN UINT64 Length, IN OUT UINT8 *Types OPTIONAL)
/* Return the number of memory types in range [BaseAddress, BaseAddress + Length). */ UINT8 MtrrLibGetNumberOfTypes(IN CONST MTRR_MEMORY_RANGE *Ranges, IN UINTN RangeCount, IN UINT64 BaseAddress, IN UINT64 Length, IN OUT UINT8 *Types OPTIONAL)
{ UINTN Index; UINT8 TypeCount; UINT8 LocalTypes; TypeCount = 0; LocalTypes = 0; for (Index = 0; Index < RangeCount; Index++) { if ((Ranges[Index].BaseAddress <= BaseAddress) && (BaseAddress < Ranges[Index].BaseAddress + Ranges[Index].Length) ) { if ((LocalTypes & (1 << Ranges[Index].Type)) == 0) { LocalTypes |= (UINT8)(1 << Ranges[Index].Type); TypeCount++; } if (BaseAddress + Length > Ranges[Index].BaseAddress + Ranges[Index].Length) { Length -= Ranges[Index].BaseAddress + Ranges[Index].Length - BaseAddress; BaseAddress = Ranges[Index].BaseAddress + Ranges[Index].Length; } else { break; } } } if (Types != NULL) { *Types = LocalTypes; } return TypeCount; }
tianocore/edk2
C++
Other
4,240
/* Release all the resources used by the TLS instance. */
VOID TlsCleanInstance(IN TLS_INSTANCE *Instance)
/* Release all the resources used by the TLS instance. */ VOID TlsCleanInstance(IN TLS_INSTANCE *Instance)
{ if (Instance != NULL) { if (Instance->TlsConn != NULL) { TlsFree (Instance->TlsConn); } FreePool (Instance); } }
tianocore/edk2
C++
Other
4,240
/* Retrieve the amount of cycles to delay for the given amount of ms. */
static uint32_t _get_cycles_for_ms_internal(const uint16_t ms, const uint32_t freq, const uint8_t power)
/* Retrieve the amount of cycles to delay for the given amount of ms. */ static uint32_t _get_cycles_for_ms_internal(const uint16_t ms, const uint32_t freq, const uint8_t power)
{ switch (power) { case 9: return (ms * (freq / 1000000) + 2) / 3 * 1000; case 8: return (ms * (freq / 100000) + 2) / 3 * 100; case 7: return (ms * (freq / 10000) + 2) / 3 * 10; case 6: return (ms * (freq / 1000) + 2) / 3; case 5: return (ms * (freq / 100) + 29) / 30; case 4: return (ms * (freq / 10) + 299) / 300; default: return (ms * (freq / 1) + 2999) / 3000; } }
eclipse-threadx/getting-started
C++
Other
310
/* ... except in early boot when the kernel sets up the initial pagetables, which makes booting astonishingly slow: 1.83 seconds! So we don't even tell the Host anything changed until we've done the first page table switch, which brings boot back to 0.25 seconds. */
static void lguest_set_pte(pte_t *ptep, pte_t pteval)
/* ... except in early boot when the kernel sets up the initial pagetables, which makes booting astonishingly slow: 1.83 seconds! So we don't even tell the Host anything changed until we've done the first page table switch, which brings boot back to 0.25 seconds. */ static void lguest_set_pte(pte_t *ptep, pte_t pteval)
{ native_set_pte(ptep, pteval); if (cr3_changed) lazy_hcall1(LHCALL_FLUSH_TLB, 1); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ETH MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
/* ETH MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
{ if(heth->Instance==ETH) { __HAL_RCC_ETH1MAC_CLK_DISABLE(); __HAL_RCC_ETH1TX_CLK_DISABLE(); __HAL_RCC_ETH1RX_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOG, GPIO_PIN_14|GPIO_PIN_13|GPIO_PIN_11); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_7); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Convert from struct device to struct vio_dev and pass to driver. dev->driver has already been set by generic code because vio_bus_match succeeded. */
static int vio_bus_probe(struct device *dev)
/* Convert from struct device to struct vio_dev and pass to driver. dev->driver has already been set by generic code because vio_bus_match succeeded. */ static int vio_bus_probe(struct device *dev)
{ struct vio_dev *viodev = to_vio_dev(dev); struct vio_driver *viodrv = to_vio_driver(dev->driver); const struct vio_device_id *id; int error = -ENODEV; if (!viodrv->probe) return error; id = vio_match_device(viodrv->id_table, viodev); if (id) { memset(&viodev->cmo, 0, sizeof(viodev->cmo)); if (firmware_has_feature(FW_FEATURE_CMO)) { error = vio_cmo_bus_probe(viodev); if (error) return error; } error = viodrv->probe(viodev, id); if (error && firmware_has_feature(FW_FEATURE_CMO)) vio_cmo_bus_remove(viodev); } return error; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check validity of internal software context. This function checks if the internal context structure looks correct. */
static status_t cau3_hash_check_context(cau3_hash_ctx_internal_t *ctxInternal, const uint8_t *message)
/* Check validity of internal software context. This function checks if the internal context structure looks correct. */ static status_t cau3_hash_check_context(cau3_hash_ctx_internal_t *ctxInternal, const uint8_t *message)
{ if ((NULL == message) || (NULL == ctxInternal) || (kStatus_Success != cau3_hash_check_input_alg(ctxInternal->algo))) { return kStatus_InvalidArgument; } return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Invoke a command with an immediate output parameter (and copy the output into the caller's out_param pointer after the command executes). */
static int mthca_cmd_imm(struct mthca_dev *dev, u64 in_param, u64 *out_param, u32 in_modifier, u8 op_modifier, u16 op, unsigned long timeout, u8 *status)
/* Invoke a command with an immediate output parameter (and copy the output into the caller's out_param pointer after the command executes). */ static int mthca_cmd_imm(struct mthca_dev *dev, u64 in_param, u64 *out_param, u32 in_modifier, u8 op_modifier, u16 op, unsigned long timeout, u8 *status)
{ if (dev->cmd.flags & MTHCA_CMD_USE_EVENTS) return mthca_cmd_wait(dev, in_param, out_param, 1, in_modifier, op_modifier, op, timeout, status); else return mthca_cmd_poll(dev, in_param, out_param, 1, in_modifier, op_modifier, op, timeout, status); }
robutest/uclinux
C++
GPL-2.0
60
/* The callback should return 0 if the device doesn't match and non-zero if it does. If the callback returns non-zero and a reference to the current device can be obtained, this function will return to the caller and not iterate over any more devices. */
struct device* device_find_child(struct device *parent, void *data, int(*match)(struct device *dev, void *data))
/* The callback should return 0 if the device doesn't match and non-zero if it does. If the callback returns non-zero and a reference to the current device can be obtained, this function will return to the caller and not iterate over any more devices. */ struct device* device_find_child(struct device *parent, void *data, int(*match)(struct device *dev, void *data))
{ struct klist_iter i; struct device *child; if (!parent) return NULL; klist_iter_init(&parent->p->klist_children, &i); while ((child = next_device(&i))) if (match(child, data) && get_device(child)) break; klist_iter_exit(&i); return child; }
robutest/uclinux
C++
GPL-2.0
60
/* We don't do error checking on the address for writes. It's assumed that the user checked for the device existing first by doing a read first. */
static int ixp23xx_pci_write_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value)
/* We don't do error checking on the address for writes. It's assumed that the user checked for the device existing first by doing a read first. */ static int ixp23xx_pci_write_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value)
{ u32 mask; u32 *addr; u32 temp; mask = ~(bytemask[size] << ((where % 0x4) * 8)); addr = ixp23xx_pci_config_addr(bus->number, devfn, where); if (!addr) return PCIBIOS_DEVICE_NOT_FOUND; temp = (u32) (value) << ((where % 0x4) * 8); *addr = (*addr & mask) | temp; clear_master_aborts(); return PCIBIOS_SUCCESSFUL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Function to start a delayed output after RAW3215_TIMEOUT seconds */
static void raw3215_timeout(unsigned long __data)
/* Function to start a delayed output after RAW3215_TIMEOUT seconds */ static void raw3215_timeout(unsigned long __data)
{ struct raw3215_info *raw = (struct raw3215_info *) __data; unsigned long flags; spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); if (raw->flags & RAW3215_TIMER_RUNS) { del_timer(&raw->timer); raw->flags &= ~RAW3215_TIMER_RUNS; if (!(raw->flags & RAW3215_FROZEN)) { raw3215_mk_write_req(raw); raw3215_start_io(raw); } } spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); }
robutest/uclinux
C++
GPL-2.0
60
/* v9fs_set_super - set the superblock @s: super block @data: file system specific data */
static int v9fs_set_super(struct super_block *s, void *data)
/* v9fs_set_super - set the superblock @s: super block @data: file system specific data */ static int v9fs_set_super(struct super_block *s, void *data)
{ s->s_fs_info = data; return set_anon_super(s, data); }
robutest/uclinux
C++
GPL-2.0
60
/* The CS5535/CS5536 GPIOs support a number of extra features not defined by the gpio_chip API, so these are exported. For a full list of the registers, see include/linux/cs5535.h. */
static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, unsigned int reg)
/* The CS5535/CS5536 GPIOs support a number of extra features not defined by the gpio_chip API, so these are exported. For a full list of the registers, see include/linux/cs5535.h. */ static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, unsigned int reg)
{ if (offset < 16) outl(1 << offset, chip->base + reg); else outl(1 << (offset - 16), chip->base + 0x80 + reg); }
robutest/uclinux
C++
GPL-2.0
60
/* "Pins" a 256MB TLB entry in AS0 for kernel lowmem */
static void __init ppc44x_pin_tlb(unsigned int virt, unsigned int phys)
/* "Pins" a 256MB TLB entry in AS0 for kernel lowmem */ static void __init ppc44x_pin_tlb(unsigned int virt, unsigned int phys)
{ unsigned int entry = tlb_44x_hwater--; ppc44x_update_tlb_hwater(); __asm__ __volatile__( "tlbwe %2,%3,%4\n" "tlbwe %1,%3,%5\n" "tlbwe %0,%3,%6\n" : : "r" (PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_SX | PPC44x_TLB_G), "r" (phys), "r" (virt | PPC44x_TLB_VALID | PPC44x_TLB_256M), "r" (entry), "i" (PPC44x_TLB_PAGEID), "i" (PPC44x_TLB_XLAT), "i" (PPC44x_TLB_ATTRIB)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get rid of a port on module removal */
static void pmz_dispose_port(struct uart_pmac_port *uap)
/* Get rid of a port on module removal */ static void pmz_dispose_port(struct uart_pmac_port *uap)
{ struct device_node *np; np = uap->node; iounmap(uap->rx_dma_regs); iounmap(uap->tx_dma_regs); iounmap(uap->control_reg); uap->node = NULL; of_node_put(np); memset(uap, 0, sizeof(struct uart_pmac_port)); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns an 32bit unfolded checksum of the buffer. */
__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
/* Returns an 32bit unfolded checksum of the buffer. */ __wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
{ return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Essentially, calls g_hash_table_resize() if the table has strayed too far from its ideal size for its number of nodes. */
static void g_hash_table_maybe_resize(GHashTable *hash_table)
/* Essentially, calls g_hash_table_resize() if the table has strayed too far from its ideal size for its number of nodes. */ static void g_hash_table_maybe_resize(GHashTable *hash_table)
{ gint noccupied = hash_table->noccupied; gint size = hash_table->size; if ((size > hash_table->nnodes * 4 && size > 1 << HASH_TABLE_MIN_SHIFT) || (size <= noccupied + (noccupied / 16))) g_hash_table_resize (hash_table); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Description: Searches the domain hash table and returns a pointer to the hash table entry if found, otherwise NULL is returned. The caller is responsibile for the rcu hash table locks (i.e. the caller much call rcu_read_lock()). */
static struct netlbl_dom_map* netlbl_domhsh_search(const char *domain)
/* Description: Searches the domain hash table and returns a pointer to the hash table entry if found, otherwise NULL is returned. The caller is responsibile for the rcu hash table locks (i.e. the caller much call rcu_read_lock()). */ static struct netlbl_dom_map* netlbl_domhsh_search(const char *domain)
{ u32 bkt; struct list_head *bkt_list; struct netlbl_dom_map *iter; if (domain != NULL) { bkt = netlbl_domhsh_hash(domain); bkt_list = &rcu_dereference(netlbl_domhsh)->tbl[bkt]; list_for_each_entry_rcu(iter, bkt_list, list) if (iter->valid && strcmp(iter->domain, domain) == 0) return iter; } return NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function sets the signature algorithms for use by a specified TLS object. */
EFI_STATUS EFIAPI CryptoServiceTlsSetSignatureAlgoList(IN VOID *Tls, IN UINT8 *Data, IN UINTN DataSize)
/* This function sets the signature algorithms for use by a specified TLS object. */ EFI_STATUS EFIAPI CryptoServiceTlsSetSignatureAlgoList(IN VOID *Tls, IN UINT8 *Data, IN UINTN DataSize)
{ return CALL_BASECRYPTLIB (TlsSet.Services.SignatureAlgoList, TlsSetSignatureAlgoList, (Tls, Data, DataSize), EFI_UNSUPPORTED); }
tianocore/edk2
C++
Other
4,240
/* Walk the list of devices that the bus has on it and try to match the driver with each one. If driver_probe_device() returns 0 and the @dev->driver is set, we've found a compatible pair. */
int driver_attach(struct device_driver *drv)
/* Walk the list of devices that the bus has on it and try to match the driver with each one. If driver_probe_device() returns 0 and the @dev->driver is set, we've found a compatible pair. */ int driver_attach(struct device_driver *drv)
{ return bus_for_each_dev(drv->bus, NULL, drv, __driver_attach); }
robutest/uclinux
C++
GPL-2.0
60
/* param base pointer to FLEXIO_MCULCD_Type structure. param handle FlexIO MCULCD eDMA handle pointer. param count Number of count transferred so far by the eDMA transaction. retval kStatus_Success Get the transferred count Successfully. retval kStatus_NoTransferInProgress No transfer in process. */
status_t FLEXIO_MCULCD_TransferGetCountEDMA(FLEXIO_MCULCD_Type *base, flexio_mculcd_edma_handle_t *handle, size_t *count)
/* param base pointer to FLEXIO_MCULCD_Type structure. param handle FlexIO MCULCD eDMA handle pointer. param count Number of count transferred so far by the eDMA transaction. retval kStatus_Success Get the transferred count Successfully. retval kStatus_NoTransferInProgress No transfer in process. */ status_t FLEXIO_MCULCD_TransferGetCountEDMA(FLEXIO_MCULCD_Type *base, flexio_mculcd_edma_handle_t *handle, size_t *count)
{ assert(handle); assert(count); uint32_t state = handle->state; if (kFLEXIO_MCULCD_StateIdle == state) { return kStatus_NoTransferInProgress; } else { *count = handle->dataCount - handle->remainingCount; if (kFLEXIO_MCULCD_StateReadArray == state) { *count -= handle->minorLoopBytes * EDMA_GetRemainingMajorLoopCount(handle->rxDmaHandle->base, handle->rxDmaHandle->channel); } else { *count -= handle->minorLoopBytes * EDMA_GetRemainingMajorLoopCount(handle->txDmaHandle->base, handle->txDmaHandle->channel); } } return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Called to put a packet on the Link Layer transmit packet queue. */
void ble_ll_acl_data_in(struct os_mbuf *txpkt)
/* Called to put a packet on the Link Layer transmit packet queue. */ void ble_ll_acl_data_in(struct os_mbuf *txpkt)
{ os_sr_t sr; struct os_mbuf_pkthdr *pkthdr; pkthdr = OS_MBUF_PKTHDR(txpkt); OS_ENTER_CRITICAL(sr); STAILQ_INSERT_TAIL(&g_ble_ll_data.ll_tx_pkt_q, pkthdr, omp_next); OS_EXIT_CRITICAL(sr); ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &g_ble_ll_data.ll_tx_pkt_ev); }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Disable the SPI interrupt of the specified SPI port. */
void xSPIIntDisable(unsigned long ulBase, unsigned long ulIntFlags)
/* Disable the SPI interrupt of the specified SPI port. */ void xSPIIntDisable(unsigned long ulBase, unsigned long ulIntFlags)
{ SPIIntDisable(ulBase, ulIntFlags); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Returns 1 if one or more PIO of the given Pin instance currently have a high level; otherwise returns 0. This method returns the actual value that is being read on the pin. To return the supposed output value of a pin, use PIO_GetOutputDataStatus() instead. */
unsigned char PIO_Get(const Pin *pin)
/* Returns 1 if one or more PIO of the given Pin instance currently have a high level; otherwise returns 0. This method returns the actual value that is being read on the pin. To return the supposed output value of a pin, use PIO_GetOutputDataStatus() instead. */ unsigned char PIO_Get(const Pin *pin)
{ unsigned int reg; if ((pin->type == PIO_OUTPUT_0) || (pin->type == PIO_OUTPUT_1)) { reg = pin->pio->PIO_ODSR; } else { reg = pin->pio->PIO_PDSR; } if ((reg & pin->mask) == 0) { return 0; } else { return 1; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Registers the callback function that this server calls, whenever a client requests the writing of a specific holding register. */
void TbxMbServerSetCallbackWriteHoldingReg(tTbxMbServer channel, tTbxMbServerWriteHoldingReg callback)
/* Registers the callback function that this server calls, whenever a client requests the writing of a specific holding register. */ void TbxMbServerSetCallbackWriteHoldingReg(tTbxMbServer channel, tTbxMbServerWriteHoldingReg callback)
{ TBX_ASSERT((channel != NULL) && (callback != NULL)); if ((channel != NULL) && (callback != NULL)) { tTbxMbServerCtx * serverCtx = (tTbxMbServerCtx *)channel; TBX_ASSERT(serverCtx->type == TBX_MB_SERVER_CONTEXT_TYPE); TbxCriticalSectionEnter(); serverCtx->writeHoldingRegFcn = callback; TbxCriticalSectionExit(); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Changes the state of a network interface from "started" to "stopped". */
EFI_STATUS EFIAPI EmuSnpStop(IN EFI_SIMPLE_NETWORK_PROTOCOL *This)
/* Changes the state of a network interface from "started" to "stopped". */ EFI_STATUS EFIAPI EmuSnpStop(IN EFI_SIMPLE_NETWORK_PROTOCOL *This)
{ EFI_STATUS Status; EMU_SNP_PRIVATE_DATA *Private; Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This); Status = Private->Io->Stop (Private->Io); return Status; }
tianocore/edk2
C++
Other
4,240
/* Remove all the cache entries bearing the Tag. When a route cache entry is created, it is tagged with the address of route entry from which it is spawned. When a route entry is deleted, the cache entries spawned from it are also deleted. */
VOID Ip4PurgeRouteCache(IN OUT IP4_ROUTE_CACHE *RtCache, IN UINTN Tag)
/* Remove all the cache entries bearing the Tag. When a route cache entry is created, it is tagged with the address of route entry from which it is spawned. When a route entry is deleted, the cache entries spawned from it are also deleted. */ VOID Ip4PurgeRouteCache(IN OUT IP4_ROUTE_CACHE *RtCache, IN UINTN Tag)
{ LIST_ENTRY *Entry; LIST_ENTRY *Next; IP4_ROUTE_CACHE_ENTRY *RtCacheEntry; UINT32 Index; for (Index = 0; Index < IP4_ROUTE_CACHE_HASH_VALUE; Index++) { NET_LIST_FOR_EACH_SAFE (Entry, Next, &RtCache->CacheBucket[Index]) { RtCacheEntry = NET_LIST_USER_STRUCT (Entry, IP4_ROUTE_CACHE_ENTRY, Link); if (RtCacheEntry->Tag == Tag) { RemoveEntryList (Entry); Ip4FreeRouteCacheEntry (RtCacheEntry); } } } }
tianocore/edk2
C++
Other
4,240
/* RDR_to_PC_Escape Provide the Escaped data block response to the host Response for PC_to_RDR_Escape. */
void RDR_to_PC_Escape(uint8_t errorCode, USBD_HandleTypeDef *pdev)
/* RDR_to_PC_Escape Provide the Escaped data block response to the host Response for PC_to_RDR_Escape. */ void RDR_to_PC_Escape(uint8_t errorCode, USBD_HandleTypeDef *pdev)
{ USBD_CCID_HandleTypeDef *hccid = (USBD_CCID_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId]; uint32_t length = CCID_RESPONSE_HEADER_SIZE; hccid->UsbBlkInData.bMessageType = RDR_TO_PC_ESCAPE; hccid->UsbBlkInData.bSpecific = 0U; hccid->UsbBlkInData.bError = errorCode; if (errorCode == SLOT_NO_ERROR) { length += hccid->UsbBlkInData.dwLength; } (void)USBD_CCID_Transfer_Data_Request(pdev, (uint8_t *)(&hccid->UsbBlkInData), (uint16_t)length); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Executes an SMBUS read data byte command on the SMBUS device specified by SmBusAddress. Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. The 8-bit value read from the SMBUS is returned. If Status is not NULL, then the status of the executed command is returned in Status. If Length in SmBusAddress is not zero, then ASSERT(). If any reserved bits of SmBusAddress are set, then ASSERT(). */
UINT8 EFIAPI SmBusReadDataByte(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL)
/* Executes an SMBUS read data byte command on the SMBUS device specified by SmBusAddress. Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. The 8-bit value read from the SMBUS is returned. If Status is not NULL, then the status of the executed command is returned in Status. If Length in SmBusAddress is not zero, then ASSERT(). If any reserved bits of SmBusAddress are set, then ASSERT(). */ UINT8 EFIAPI SmBusReadDataByte(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL)
{ ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); if (Status != NULL) { *Status = RETURN_UNSUPPORTED; } return 0; }
tianocore/edk2
C++
Other
4,240
/* Reset ADC peripheral registers to their default reset values. */
void ADC_Reset(ADC_T *adc)
/* Reset ADC peripheral registers to their default reset values. */ void ADC_Reset(ADC_T *adc)
{ if(adc == ADC1) { RCM_EnableAPB2PeriphReset(RCM_APB2_PERIPH_ADC1); RCM_DisableAPB2PeriphReset(RCM_APB2_PERIPH_ADC1); } else if(adc == ADC2) { RCM_EnableAPB2PeriphReset(RCM_APB2_PERIPH_ADC2); RCM_DisableAPB2PeriphReset(RCM_APB2_PERIPH_ADC2); } else if (adc == ADC3) { RCM_EnableAPB2PeriphReset(RCM_APB2_PERIPH_ADC3); RCM_DisableAPB2PeriphReset(RCM_APB2_PERIPH_ADC3); } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Unpacks utf8 string from the buffer from the offset requested. */
static int unpack_utf8_str(struct buf_ctx *buf, struct mqtt_utf8 *str)
/* Unpacks utf8 string from the buffer from the offset requested. */ static int unpack_utf8_str(struct buf_ctx *buf, struct mqtt_utf8 *str)
{ uint16_t utf8_strlen; int err_code; NET_DBG(">> cur:%p, end:%p", (void *)buf->cur, (void *)buf->end); err_code = unpack_uint16(buf, &utf8_strlen); if (err_code != 0) { return err_code; } if ((buf->end - buf->cur) < utf8_strlen) { return -EINVAL; } str->size = utf8_strlen; if (utf8_strlen) { str->utf8 = buf->cur; buf->cur += utf8_strlen; } else { str->utf8 = NULL; } NET_DBG("<< str_size:%08x", (uint32_t)GET_UT8STR_BUFFER_SIZE(str)); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* No colorspace change, but conversion from separate-planes to interleaved representation. */
rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
/* No colorspace change, but conversion from separate-planes to interleaved representation. */ rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{ register JSAMPROW outptr; register JSAMPROW inptr0, inptr1, inptr2; register JDIMENSION col; JDIMENSION num_cols = cinfo->output_width; while (--num_rows >= 0) { inptr0 = input_buf[0][input_row]; inptr1 = input_buf[1][input_row]; inptr2 = input_buf[2][input_row]; input_row++; outptr = *output_buf++; for (col = 0; col < num_cols; col++) { outptr[RGB_RED] = inptr0[col]; outptr[RGB_GREEN] = inptr1[col]; outptr[RGB_BLUE] = inptr2[col]; outptr += RGB_PIXELSIZE; } } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Scan timer should get fired every ORPHAN_SCAN_SCHEDULE_TIMEOUT. Add some randomness to the timeout to minimize multple nodes firing the timer at the same time. */
static unsigned long ocfs2_orphan_scan_timeout(void)
/* Scan timer should get fired every ORPHAN_SCAN_SCHEDULE_TIMEOUT. Add some randomness to the timeout to minimize multple nodes firing the timer at the same time. */ static unsigned long ocfs2_orphan_scan_timeout(void)
{ unsigned long time; get_random_bytes(&time, sizeof(time)); time = ORPHAN_SCAN_SCHEDULE_TIMEOUT + (time % 5000); return msecs_to_jiffies(time); }
robutest/uclinux
C++
GPL-2.0
60
/* Get the captured data for the ADC sample channel. */
unsigned long ADCDataGet(unsigned long ulBase, unsigned long ulChannel)
/* Get the captured data for the ADC sample channel. */ unsigned long ADCDataGet(unsigned long ulBase, unsigned long ulChannel)
{ unsigned long ulData; unsigned long ulCRReg; xASSERT(ulBase == ADC0_BASE); xASSERT((ulChannel >= 0) && (ulChannel < 8)); ulData = xHWREG(ulBase + ADC_DR0 + (ulChannel * 4)); ulCRReg = xHWREG(ulBase + ADC_CR); if(ulCRReg & ADC_CR_DIFFEN) { if(ulCRReg & ADC_CR_DMOF) { if (ulData & 0x8000) { return (ulData | 0xFFFF0000); } else { return (ulData & 0xFFF); } } else { return (ulData & 0xFFF); } } else { return (ulData & 0xFFF); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This file is part of the Simba project. */
int mock_write_heap_init(void *buf_p, size_t size, size_t sizes[HEAP_FIXED_SIZES_MAX], int res)
/* This file is part of the Simba project. */ int mock_write_heap_init(void *buf_p, size_t size, size_t sizes[HEAP_FIXED_SIZES_MAX], int res)
{ harness_mock_write("heap_init(buf_p)", buf_p, size); harness_mock_write("heap_init(size)", &size, sizeof(size)); harness_mock_write("heap_init(sizes[HEAP_FIXED_SIZES_MAX])", &sizes[HEAP_FIXED_SIZES_MAX], sizeof(sizes[HEAP_FIXED_SIZES_MAX])); harness_mock_write("heap_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* Sends the current thread sleeping and sets a reference variable. */
msg_t osalThreadSuspendTimeoutS(thread_reference_t *trp, sysinterval_t timeout)
/* Sends the current thread sleeping and sets a reference variable. */ msg_t osalThreadSuspendTimeoutS(thread_reference_t *trp, sysinterval_t timeout)
{ TX_TIMER timer; msg_t msg; osalDbgCheck(trp != NULL); if (TIME_IMMEDIATE == timeout) { return MSG_TIMEOUT; } if (TIME_INFINITE == timeout) { return osalThreadSuspendS(trp); } tx_timer_create(&timer, NULL, SuspendTimeoutCallback, (uint32_t)trp, timeout, 0, TX_AUTO_ACTIVATE); msg = osalThreadSuspendS(trp); tx_timer_delete(&timer); return msg; }
nanoframework/nf-interpreter
C++
MIT License
293
/* stmmac_dma_start_rx @ioaddr: device I/O address Description: this function starts the DMA rx process. */
static void stmmac_dma_start_rx(unsigned long ioaddr)
/* stmmac_dma_start_rx @ioaddr: device I/O address Description: this function starts the DMA rx process. */ static void stmmac_dma_start_rx(unsigned long ioaddr)
{ u32 value = readl(ioaddr + DMA_CONTROL); value |= DMA_CONTROL_SR; writel(value, ioaddr + DMA_CONTROL); return; }
robutest/uclinux
C++
GPL-2.0
60
/* LTDC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc)
/* LTDC MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc)
{ if(hltdc->Instance==LTDC) { __HAL_RCC_LTDC_CLK_DISABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Gets the number of bits transferred per frame. */
unsigned char SPIBitLengthGet(unsigned long ulBase)
/* Gets the number of bits transferred per frame. */ unsigned char SPIBitLengthGet(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) ); return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_TX_BIT_LEN_M) >> SPI_CNTRL_TX_BIT_LEN_S); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* pc_stop and pc_start provide software flow control to the routine and the pc_ioctl routine. */
static void pc_stop(struct tty_struct *)
/* pc_stop and pc_start provide software flow control to the routine and the pc_ioctl routine. */ static void pc_stop(struct tty_struct *)
{ struct channel *ch; unsigned long flags; ch = verifyChannel(tty); if (ch != NULL) { spin_lock_irqsave(&epca_lock, flags); if ((ch->statusflags & TXSTOPPED) == 0) { globalwinon(ch); fepcmd(ch, PAUSETX, 0, 0, 0, 0); ch->statusflags |= TXSTOPPED; memoff(ch); } spin_unlock_irqrestore(&epca_lock, flags); } }
robutest/uclinux
C++
GPL-2.0
60
/* Check if a row is a full row because the page is a invalid page, so if two pages have data, it is the full row. */
static bool _eeprom_emulator_is_full_row(uint16_t phy_page)
/* Check if a row is a full row because the page is a invalid page, so if two pages have data, it is the full row. */ static bool _eeprom_emulator_is_full_row(uint16_t phy_page)
{ if((_eeprom_instance.flash[phy_page].header.logical_page == _eeprom_instance.flash[phy_page+2].header.logical_page) || (_eeprom_instance.flash[phy_page+1].header.logical_page == _eeprom_instance.flash[phy_page+2].header.logical_page )) { return true; } else { return false; } }
memfault/zero-to-main
C++
null
200
/* 3. Source RNC to target RNC transparent information (cdma2000) */
static guint16 be_src_rnc_to_tar_rnc_cdma(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
/* 3. Source RNC to target RNC transparent information (cdma2000) */ static guint16 be_src_rnc_to_tar_rnc_cdma(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
{ guint32 curr_offset; curr_offset = offset; proto_tree_add_expert(tree, pinfo, &ei_gsm_a_bssmap_not_decoded_yet, tvb, curr_offset, len); return(len); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Make sure single step bits etc are not set. */
void ptrace_disable(struct task_struct *task)
/* Make sure single step bits etc are not set. */ void ptrace_disable(struct task_struct *task)
{ clear_tsk_thread_flag(task, TIF_SINGLESTEP); clear_tsk_thread_flag(task, TIF_BLOCKSTEP); pa_psw(task)->r = 0; pa_psw(task)->t = 0; pa_psw(task)->h = 0; pa_psw(task)->l = 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Init irq param with the given sercom hardware instance. */
static void _sercom_init_irq_param(const void *const hw, void *dev)
/* Init irq param with the given sercom hardware instance. */ static void _sercom_init_irq_param(const void *const hw, void *dev)
{ if (hw == SERCOM2) { _sercom2_dev = (struct _usart_async_device *)dev; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return a pointer to a newly allocated handle, or NULL on failure */
handle_t* journal_start(journal_t *journal, int nblocks)
/* Return a pointer to a newly allocated handle, or NULL on failure */ handle_t* journal_start(journal_t *journal, int nblocks)
{ handle_t *handle = journal_current_handle(); int err; if (!journal) return ERR_PTR(-EROFS); if (handle) { J_ASSERT(handle->h_transaction->t_journal == journal); handle->h_ref++; return handle; } handle = new_handle(nblocks); if (!handle) return ERR_PTR(-ENOMEM); current->journal_info = handle; err = start_this_handle(journal, handle); if (err < 0) { jbd_free_handle(handle); current->journal_info = NULL; handle = ERR_PTR(err); goto out; } out: return handle; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: (transfer full) (element-type utf8): a list of the children on @settings */
gchar** g_settings_list_children(GSettings *settings)
/* Returns: (transfer full) (element-type utf8): a list of the children on @settings */ gchar** g_settings_list_children(GSettings *settings)
{ return g_settings_schema_list_children (settings->priv->schema); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Reads the values present of the specified pin(s). The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
long GPIOPinRead(unsigned long ulPort, unsigned long ulPins)
/* Reads the values present of the specified pin(s). The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ long GPIOPinRead(unsigned long ulPort, unsigned long ulPins)
{ xASSERT(GPIOBaseValid(ulPort)); return(xHWREG(ulPort + GPIO_PDIR) & (ulPins)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Returns TRUE if the instance as been destroyed, FALSE otherwise. */
gboolean cr_doc_handler_unref(CRDocHandler *a_this)
/* Returns TRUE if the instance as been destroyed, FALSE otherwise. */ gboolean cr_doc_handler_unref(CRDocHandler *a_this)
{ g_return_val_if_fail (a_this, FALSE); if (a_this->ref_count > 0) { a_this->ref_count--; } if (a_this->ref_count == 0) { cr_doc_handler_destroy (a_this); return TRUE; } return FALSE ; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* #GTypeModule is an implementation of #GTypePlugin that already implements most of this except for the actual module loading and unloading. It even handles multiple registered types per module. */
GType g_type_plugin_get_type(void)
/* #GTypeModule is an implementation of #GTypePlugin that already implements most of this except for the actual module loading and unloading. It even handles multiple registered types per module. */ GType g_type_plugin_get_type(void)
{ static GType type_plugin_type = 0; if (!type_plugin_type) { const GTypeInfo type_plugin_info = { sizeof (GTypePluginClass), NULL, NULL, }; type_plugin_type = g_type_register_static (G_TYPE_INTERFACE, g_intern_static_string ("GTypePlugin"), &type_plugin_info, 0); } return type_plugin_type; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* @dev: device @blknr: first block to be write @blkcnt: number of blocks to write @buffer: input buffer Return: number of blocks transferred */
static ulong efi_bl_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, const void *buffer)
/* @dev: device @blknr: first block to be write @blkcnt: number of blocks to write @buffer: input buffer Return: number of blocks transferred */ static ulong efi_bl_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, const void *buffer)
{ struct efi_blk_platdata *platdata = dev_get_platdata(dev); struct efi_block_io *io = platdata->io; efi_status_t ret; EFI_PRINT("%s: write '%s', from block " LBAFU ", " LBAFU " blocks\n", __func__, dev->name, blknr, blkcnt); ret = EFI_CALL(io->write_blocks( io, io->media->media_id, (u64)blknr, (efi_uintn_t)blkcnt * (efi_uintn_t)io->media->block_size, (void *)buffer)); EFI_PRINT("%s: r = %u\n", __func__, (unsigned int)(ret & ~EFI_ERROR_MASK)); if (ret != EFI_SUCCESS) return 0; return blkcnt; }
4ms/stm32mp1-baremetal
C++
Other
137
/* About: Purpose Implementation of the USBEndpointDescriptor class. Returns the number of an endpoint given its descriptor. */
unsigned char USBEndpointDescriptor_GetNumber(const USBEndpointDescriptor *endpoint)
/* About: Purpose Implementation of the USBEndpointDescriptor class. Returns the number of an endpoint given its descriptor. */ unsigned char USBEndpointDescriptor_GetNumber(const USBEndpointDescriptor *endpoint)
{ return endpoint->bEndpointAddress & 0xF; }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* Enables or disables the TIM Capture Compare Channel xN. */
void TIM_CCxNCmd(TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_CCxN)
/* Enables or disables the TIM Capture Compare Channel xN. */ void TIM_CCxNCmd(TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_CCxN)
{ uint16_t tmp = 0; assert_param(IS_TIM_LIST2_PERIPH(TIMx)); assert_param(IS_TIM_COMPLEMENTARY_CHANNEL(TIM_Channel)); assert_param(IS_TIM_CCXN(TIM_CCxN)); tmp = CCER_CCNE_Set << TIM_Channel; TIMx->CCER &= (uint16_t) ~tmp; TIMx->CCER |= (uint16_t)(TIM_CCxN << TIM_Channel); }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* Clear the 3-wire SPI start interrupt flag of the specified SPI port. */
void SPI3WireStartIntFlagClear(unsigned long ulBase)
/* Clear the 3-wire SPI start interrupt flag of the specified SPI port. */ void SPI3WireStartIntFlagClear(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)); xHWREG(ulBase + SPI_CNTRL2) |= SPI_CNTRL2_SLV_START_INTSTS; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* The following procedures deal with the recovery of locks after a server crash. Reclaim all locks on server host. We do this by spawning a separate reclaimer thread. */
void nlmclnt_recovery(struct nlm_host *host)
/* The following procedures deal with the recovery of locks after a server crash. Reclaim all locks on server host. We do this by spawning a separate reclaimer thread. */ void nlmclnt_recovery(struct nlm_host *host)
{ struct task_struct *task; if (!host->h_reclaiming++) { nlm_get_host(host); task = kthread_run(reclaimer, host, "%s-reclaim", host->h_name); if (IS_ERR(task)) printk(KERN_ERR "lockd: unable to spawn reclaimer " "thread. Locks for %s won't be reclaimed! " "(%ld)\n", host->h_name, PTR_ERR(task)); } }
robutest/uclinux
C++
GPL-2.0
60
/* This comparator searches for the next Endpoint descriptor inside the current interface descriptor, aborting the search if another interface descriptor is found before the required endpoint. */
uint8_t DComp_NextKeyboardInterfaceDataEndpoint(void *CurrentDescriptor)
/* This comparator searches for the next Endpoint descriptor inside the current interface descriptor, aborting the search if another interface descriptor is found before the required endpoint. */ uint8_t DComp_NextKeyboardInterfaceDataEndpoint(void *CurrentDescriptor)
{ USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); if (Header->Type == DTYPE_Endpoint) return DESCRIPTOR_SEARCH_Found; else if (Header->Type == DTYPE_Interface) return DESCRIPTOR_SEARCH_Fail; else return DESCRIPTOR_SEARCH_NotFound; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* ocfs2_invalidatepage() and ocfs2_releasepage() are shamelessly stolen from ext3. PageChecked() bits have been removed as OCFS2 does not do journalled data. */
static void ocfs2_invalidatepage(struct page *page, unsigned long offset)
/* ocfs2_invalidatepage() and ocfs2_releasepage() are shamelessly stolen from ext3. PageChecked() bits have been removed as OCFS2 does not do journalled data. */ static void ocfs2_invalidatepage(struct page *page, unsigned long offset)
{ journal_t *journal = OCFS2_SB(page->mapping->host->i_sb)->journal->j_journal; jbd2_journal_invalidatepage(journal, page, offset); }
robutest/uclinux
C++
GPL-2.0
60
/* param base SPDIF base pointer param enable True means enable SPDIF Tx, false means disable. */
void SPDIF_TxEnable(SPDIF_Type *base, bool enable)
/* param base SPDIF base pointer param enable True means enable SPDIF Tx, false means disable. */ void SPDIF_TxEnable(SPDIF_Type *base, bool enable)
{ uint32_t val = 0; if (enable) { val = base->SCR & (~SPDIF_SCR_TXFIFO_CTRL_MASK); val |= SPDIF_SCR_TXFIFO_CTRL(1U); base->SCR = val; base->STC |= SPDIF_STC_TX_ALL_CLK_EN_MASK; } else { base->SCR &= ~(SPDIF_SCR_TXFIFO_CTRL_MASK | SPDIF_SCR_TXSEL_MASK); base->STC &= ~SPDIF_STC_TX_ALL_CLK_EN_MASK; } }
eclipse-threadx/getting-started
C++
Other
310
/* Module initialisation and all that jazz... Hook our device callbacks in the filesystem, to connect our code to /dev/irnet */
static int __init ppp_irnet_init(void)
/* Module initialisation and all that jazz... Hook our device callbacks in the filesystem, to connect our code to /dev/irnet */ static int __init ppp_irnet_init(void)
{ int err = 0; DENTER(MODULE_TRACE, "()\n"); err = misc_register(&irnet_misc_device); DEXIT(MODULE_TRACE, "\n"); return err; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Resets the bus and then selects the slave by sending either a skip rom or a rom match. The w1 master lock must be held. */
int w1_reset_select_slave(struct w1_slave *sl)
/* Resets the bus and then selects the slave by sending either a skip rom or a rom match. The w1 master lock must be held. */ int w1_reset_select_slave(struct w1_slave *sl)
{ if (w1_reset_bus(sl->master)) return -1; if (sl->master->slave_count == 1) w1_write_8(sl->master, W1_SKIP_ROM); else { u8 match[9] = {W1_MATCH_ROM, }; u64 rn = le64_to_cpu(*((u64*)&sl->reg_num)); memcpy(&match[1], &rn, 8); w1_write_block(sl->master, match, 9); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* These have to be protected by the irq controller spinlock before being called. */
static void shark_disable_8259A_irq(unsigned int irq)
/* These have to be protected by the irq controller spinlock before being called. */ static void shark_disable_8259A_irq(unsigned int irq)
{ unsigned int mask; if (irq<8) { mask = 1 << irq; cached_irq_mask[0] |= mask; outb(cached_irq_mask[1],0xA1); } else { mask = 1 << (irq-8); cached_irq_mask[1] |= mask; outb(cached_irq_mask[0],0x21); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Stop the PWM of the PWM module. The */
void xPWMStop(unsigned long ulBase, unsigned long ulChannel)
/* Stop the PWM of the PWM module. The */ void xPWMStop(unsigned long ulBase, unsigned long ulChannel)
{ unsigned long ulChannelTemp; ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4); xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE)); xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3))); xHWREG(ulBase + PWM_PCR) &= ~(PWM_PCR_CH0EN << (ulChannelTemp << 3)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function is a helper function for the wtk_frame_handler() function. It is called when a pointer PRESS event is sent to the resize window. This function prepares a drag operation. */
static void wtk_handle_resize_press(struct wtk_frame *frame, struct win_pointer_event const *event)
/* This function is a helper function for the wtk_frame_handler() function. It is called when a pointer PRESS event is sent to the resize window. This function prepares a drag operation. */ static void wtk_handle_resize_press(struct wtk_frame *frame, struct win_pointer_event const *event)
{ switch (frame->state) { case WTK_FRAME_NORMAL: wtk_prepare_drag(&(event->pos)); win_grab_pointer(frame->resize); frame->state = WTK_FRAME_AWAITING_RESIZE; break; default: break; } }
memfault/zero-to-main
C++
null
200
/* Return the count of just the current iov_iter segment. */
size_t iov_iter_single_seg_count(struct iov_iter *i)
/* Return the count of just the current iov_iter segment. */ size_t iov_iter_single_seg_count(struct iov_iter *i)
{ const struct iovec *iov = i->iov; if (i->nr_segs == 1) return i->count; else return min(i->count, iov->iov_len - i->iov_offset); }
robutest/uclinux
C++
GPL-2.0
60
/* Prevent the PCI layer from seeing the resources allocated to this device if it is the host bridge by marking it as such. These resources are of no consequence to the PCI layer (they are handled elsewhere). */
static void __devinit pci_fixup_dec21285(struct pci_dev *dev)
/* Prevent the PCI layer from seeing the resources allocated to this device if it is the host bridge by marking it as such. These resources are of no consequence to the PCI layer (they are handled elsewhere). */ static void __devinit pci_fixup_dec21285(struct pci_dev *dev)
{ int i; if (dev->devfn == 0) { dev->class &= 0xff; dev->class |= PCI_CLASS_BRIDGE_HOST << 8; for (i = 0; i < PCI_NUM_RESOURCES; i++) { dev->resource[i].start = 0; dev->resource[i].end = 0; dev->resource[i].flags = 0; } } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Creates a new surface identical to the existing surface */
SDL_Surface* SDL_DuplicateSurface(SDL_Surface *surface)
/* Creates a new surface identical to the existing surface */ SDL_Surface* SDL_DuplicateSurface(SDL_Surface *surface)
{ return SDL_ConvertSurface(surface, surface->format, surface->flags); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Forces the output 4 waveform to active or inactive level. */
void TMR_ConfigForcedOC4(TMR_T *tmr, TMR_FORCED_ACTION_T forcesAction)
/* Forces the output 4 waveform to active or inactive level. */ void TMR_ConfigForcedOC4(TMR_T *tmr, TMR_FORCED_ACTION_T forcesAction)
{ tmr->CCM2_COMPARE_B.OC4MOD = BIT_RESET; tmr->CCM2_COMPARE_B.OC4MOD = forcesAction; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Displays the code value as a character, not its ASCII value, as would be done by BASE_DEC and friends. */
static void format_broken_trade_reason(gchar *buf, guint32 value)
/* Displays the code value as a character, not its ASCII value, as would be done by BASE_DEC and friends. */ static void format_broken_trade_reason(gchar *buf, guint32 value)
{ g_snprintf(buf, ITEM_LABEL_LENGTH, "%s (%c)", val_to_str_const(value, ouch_broken_trade_reason_val, "Unknown"), value); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Handler called for DFU Class requests not handled by the USB stack. */
static int dfu_class_handle_req(struct usb_setup_packet *setup, int32_t *data_len, uint8_t **data)
/* Handler called for DFU Class requests not handled by the USB stack. */ static int dfu_class_handle_req(struct usb_setup_packet *setup, int32_t *data_len, uint8_t **data)
{ if (usb_reqtype_is_to_host(setup)) { return dfu_class_handle_to_host(setup, data_len, data); } else { return dfu_class_handle_to_device(setup, data_len, data); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* reverse of qh_urb_transaction: free a list of TDs. used for cleanup after errors, before HC sees an URB's TDs. */
static void qtd_list_free(struct ehci_hcd *ehci, struct urb *urb, struct list_head *qtd_list)
/* reverse of qh_urb_transaction: free a list of TDs. used for cleanup after errors, before HC sees an URB's TDs. */ static void qtd_list_free(struct ehci_hcd *ehci, struct urb *urb, struct list_head *qtd_list)
{ struct list_head *entry, *temp; list_for_each_safe (entry, temp, qtd_list) { struct ehci_qtd *qtd; qtd = list_entry (entry, struct ehci_qtd, qtd_list); list_del (&qtd->qtd_list); ehci_qtd_free (ehci, qtd); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Unregisters an interrupt handler for the SHA/MD5 module. */
void SHAMD5IntUnregister(uint32_t ui32Base)
/* Unregisters an interrupt handler for the SHA/MD5 module. */ void SHAMD5IntUnregister(uint32_t ui32Base)
{ ASSERT(ui32Base == SHAMD5_BASE); IntDisable(INT_SHA0); IntUnregister(INT_SHA0); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Select an appropriate bss from current scan list regarding current settings from userspace. The caller must hold wl->scan_lock, and on the state of wl->scan_state == GELIC_WL_SCAN_GOT_LIST */
static void update_best(struct gelic_wl_scan_info **best, struct gelic_wl_scan_info *candid, int *best_weight, int *weight)
/* Select an appropriate bss from current scan list regarding current settings from userspace. The caller must hold wl->scan_lock, and on the state of wl->scan_state == GELIC_WL_SCAN_GOT_LIST */ static void update_best(struct gelic_wl_scan_info **best, struct gelic_wl_scan_info *candid, int *best_weight, int *weight)
{ if (*best_weight < ++(*weight)) { *best_weight = *weight; *best = candid; } }
robutest/uclinux
C++
GPL-2.0
60