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
/* If any reserved bits in Address are set, then ASSERT(). */
UINT8 EFIAPI PciSegmentRead8(IN UINT64 Address)
/* If any reserved bits in Address are set, then ASSERT(). */ UINT8 EFIAPI PciSegmentRead8(IN UINT64 Address)
{ ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); return PciRead8 (PCI_SEGMENT_TO_PCI_ADDRESS (Address)); }
tianocore/edk2
C++
Other
4,240
/* This function will set the gibven GList of decryption_key_t structures as the defoult for both Wireshark and the AirPcap adapters... */
void airpcap_save_decryption_keys(GList *key_list, GList *adapters_list)
/* This function will set the gibven GList of decryption_key_t structures as the defoult for both Wireshark and the AirPcap adapters... */ void airpcap_save_decryption_keys(GList *key_list, GList *adapters_list)
{ gint if_n = 0; gint i = 0; airpcap_if_info_t* curr_if = NULL; GList* empty_key_list = NULL; if ( (key_list == NULL) || (adapters_list == NULL)) return; if_n = g_list_length(adapters_list); write_wlan_driver_wep_keys_to_registry(key_list); for(i = 0; i < if_n; i++) { curr...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The hardware priority mechanism will only look at the upper N bits of the priority level (where N is 3 for the Stellaris family), so any prioritization must be performed in those bits. The remaining bits can be used to sub-prioritize the interrupt sources, and may be used by the hardware priority mechanism on a futu...
void xIntPrioritySet(unsigned long ulInterrupt, unsigned char ucPriority)
/* The hardware priority mechanism will only look at the upper N bits of the priority level (where N is 3 for the Stellaris family), so any prioritization must be performed in those bits. The remaining bits can be used to sub-prioritize the interrupt sources, and may be used by the hardware priority mechanism on a futu...
{ unsigned long ulTemp; xASSERT(((ulInterrupt & 0xFF) == 0) || (((ulInterrupt & 0xFF) >= 4) && ((ulInterrupt & 0xFF) < NUM_INTERRUPTS))); if((ulInterrupt & 0xFF) != 0) { ulTemp = xHWREG(g_pulRegs[(ulInterrupt & 0xFF) >> 2]); ulTemp &= ~(0xFF << (8 * ((ulInterrupt & 0xFF) & 3)...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Configures the RTC clock (RTCCLK). Once the RTC clock is selected it can't be changed unless the Backup domain is reset. */
void RCC_RTCCLKConfig(uint32_t RCC_RTCCLKSource)
/* Configures the RTC clock (RTCCLK). Once the RTC clock is selected it can't be changed unless the Backup domain is reset. */ void RCC_RTCCLKConfig(uint32_t RCC_RTCCLKSource)
{ assert_param(IS_RCC_RTCCLK_SOURCE(RCC_RTCCLKSource)); RCC->BDCR |= RCC_RTCCLKSource; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Thread (LED_Thread1) used to toggle a LED when getting the appropriate signal. */
static void LED_Thread1(void const *argument)
/* Thread (LED_Thread1) used to toggle a LED when getting the appropriate signal. */ static void LED_Thread1(void const *argument)
{ (void) argument; osEvent event; for(;;) { event = osSignalWait( BIT_0, osWaitForever); if(event.value.signals == BIT_0) { BSP_LED_Toggle(LED1); } } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask must be called under priv->lock and mac access */
void iwl5000_txq_set_sched(struct iwl_priv *priv, u32 mask)
/* Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask must be called under priv->lock and mac access */ void iwl5000_txq_set_sched(struct iwl_priv *priv, u32 mask)
{ iwl_write_prph(priv, IWL50_SCD_TXFACT, mask); }
robutest/uclinux
C++
GPL-2.0
60
/* Check if the device is in Configured state. */
static bool is_device_configured(void)
/* Check if the device is in Configured state. */ static bool is_device_configured(void)
{ return (usb_dev.configuration != 0); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Handles an incoming ATT error response for the specified read-long-characteristic proc. */
static void ble_gattc_read_long_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
/* Handles an incoming ATT error response for the specified read-long-characteristic proc. */ static void ble_gattc_read_long_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
{ ble_gattc_dbg_assert_proc_not_inserted(proc); ble_gattc_read_long_cb(proc, status, att_handle, NULL); }
Nicholas3388/LuaNode
C++
Other
1,055
/* Wrapper around the f_readdir() function which also returns ".." entry for sub-dirs. (FatFS 0.12 does not return ".", ".." dirs anymore) */
FRESULT sdReadDir(DIR *dir, FILINFO *fno, bool &firstTime)
/* Wrapper around the f_readdir() function which also returns ".." entry for sub-dirs. (FatFS 0.12 does not return ".", ".." dirs anymore) */ FRESULT sdReadDir(DIR *dir, FILINFO *fno, bool &firstTime)
{ FRESULT res; if (firstTime && !isCwdAtRoot()) { strcpy(fno->fname, ".."); fno->fattrib = AM_DIR; res = FR_OK; } else { res = f_readdir(dir, fno); } firstTime = false; return res; }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* Registers an interrupt handler for the PECI module. */
void PECIIntRegister(unsigned long ulBase, void(*pfnHandler)(void))
/* Registers an interrupt handler for the PECI module. */ void PECIIntRegister(unsigned long ulBase, void(*pfnHandler)(void))
{ ASSERT(ulBase == PECI0_BASE); ASSERT(pfnHandler != 0); IntRegister(INT_PECI0, pfnHandler); IntEnable(INT_PECI0); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Trigger the DAC by a Software Trigger. If the trigger source is set to be a software trigger, cause a trigger to occur. The trigger is cleared by hardware after conversion. */
void dac_software_trigger(uint32_t dac, int channel)
/* Trigger the DAC by a Software Trigger. If the trigger source is set to be a software trigger, cause a trigger to occur. The trigger is cleared by hardware after conversion. */ void dac_software_trigger(uint32_t dac, int channel)
{ switch (channel) { case DAC_CHANNEL1: DAC_SWTRIGR(dac) |= DAC_SWTRIGR_SWTRIG1; break; case DAC_CHANNEL2: DAC_SWTRIGR(dac) |= DAC_SWTRIGR_SWTRIG2; break; case DAC_CHANNEL_BOTH: DAC_SWTRIGR(dac) |= (DAC_SWTRIGR_SWTRIG1 | DAC_SWTRIGR_SWTRIG2); break; default: break; } } /**@}
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Configure the selected source to generate a global interrupt or not. */
void mfxstm32l152_TS_ClearIT(uint16_t DeviceAddr)
/* Configure the selected source to generate a global interrupt or not. */ void mfxstm32l152_TS_ClearIT(uint16_t DeviceAddr)
{ mfxstm32l152_ClearGlobalIT(DeviceAddr, MFXSTM32L152_IRQ_TS); }
eclipse-threadx/getting-started
C++
Other
310
/* This function updates AML table checksum. It will search the ACPI table installed by ACPI_TABLE protocol. */
EFI_STATUS SdtUpdateAmlChecksum(IN VOID *Buffer)
/* This function updates AML table checksum. It will search the ACPI table installed by ACPI_TABLE protocol. */ EFI_STATUS SdtUpdateAmlChecksum(IN VOID *Buffer)
{ EFI_ACPI_TABLE_LIST *CurrentTableList; CurrentTableList = FindTableByBuffer (Buffer); if (CurrentTableList == NULL) { return EFI_NOT_FOUND; } AcpiPlatformChecksum ( (VOID *)CurrentTableList->Table, CurrentTableList->Table->Length, OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, Checksum) ); r...
tianocore/edk2
C++
Other
4,240
/* Angular velocity (degrees per second) in body frame. */
int inv_get_sensor_type_gyro(long *data, int8_t *accuracy, inv_time_t *timestamp)
/* Angular velocity (degrees per second) in body frame. */ int inv_get_sensor_type_gyro(long *data, int8_t *accuracy, inv_time_t *timestamp)
{ inv_get_gyro_set(data, accuracy, timestamp); if (eMPL_out.gyro_status & INV_NEW_DATA) return 1; else return 0; }
Luos-io/luos_engine
C++
MIT License
496
/* Get the current CPU ID, this is platform specific. */
uint32_t sse_200_platform_get_cpu_id(void)
/* Get the current CPU ID, this is platform specific. */ uint32_t sse_200_platform_get_cpu_id(void)
{ volatile uint32_t *p_cpu_id = (volatile uint32_t *)SSE_200_CPU_ID_UNIT_BASE; return (uint32_t)*p_cpu_id; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This internal function checks if a Unicode character is a decimal character. The valid characters are L'0' to L'9'. */
BOOLEAN EFIAPI ShellIsDecimalDigitCharacter(IN CHAR16 Char)
/* This internal function checks if a Unicode character is a decimal character. The valid characters are L'0' to L'9'. */ BOOLEAN EFIAPI ShellIsDecimalDigitCharacter(IN CHAR16 Char)
{ return (BOOLEAN)(Char >= L'0' && Char <= L'9'); }
tianocore/edk2
C++
Other
4,240
/* Normally, the status interrupt is cleared by reading the controller status using */
void CANIntClear(uint32_t ui32Base, uint32_t ui32IntClr)
/* Normally, the status interrupt is cleared by reading the controller status using */ void CANIntClear(uint32_t ui32Base, uint32_t ui32IntClr)
{ ASSERT(_CANBaseValid(ui32Base)); ASSERT((ui32IntClr == CAN_INT_INTID_STATUS) || ((ui32IntClr >= 1) && (ui32IntClr <= 32))); if (ui32IntClr == CAN_INT_INTID_STATUS) { HWREG(ui32Base + CAN_O_STS); } else { while (HWREG(ui32Base + CAN_O_IF1CRQ) & CAN_IF1CRQ_BUSY) ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If Output is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceRandomBytes(OUT UINT8 *Output, IN UINTN Size)
/* If Output is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI CryptoServiceRandomBytes(OUT UINT8 *Output, IN UINTN Size)
{ return CALL_BASECRYPTLIB (Random.Services.Bytes, RandomBytes, (Output, Size), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Unregisters the interrupt handler for an ADC interrupt. */
void ADCIntUnregister(uint32_t ui32Base, uint32_t ui32SequenceNum)
/* Unregisters the interrupt handler for an ADC interrupt. */ void ADCIntUnregister(uint32_t ui32Base, uint32_t ui32SequenceNum)
{ uint_fast8_t ui8Int; ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE)); ASSERT(ui32SequenceNum < 4); ui8Int = _ADCIntNumberGet(ui32Base, ui32SequenceNum); ASSERT(ui8Int != 0); IntDisable(ui8Int); IntUnregister(ui8Int); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Config all pins to the right pull state based on pmap_func table before soc sleep. */
CONFIG_FW_CRITICAL_CODE_SECTION void pinmap_sleep(void)
/* Config all pins to the right pull state based on pmap_func table before soc sleep. */ CONFIG_FW_CRITICAL_CODE_SECTION void pinmap_sleep(void)
{ int i = 0; int PinName = 0; for (;;) { if (pmap_func_sleep[i].PinName == _PNC) { break; } if (pmap_func_sleep[i].SleepPuPd == GPIO_PuPd_KEEP) goto next; PinName = pmap_func_sleep[i].PinName; if (pmap_func_sleep[i].SleepPuPd == GPIO_PuPd_SHUTDOWN) { PAD_CMD(PinName, DISABLE); } else { PAD_CM...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Use the TDVMCALL instruction to handle cpuid #ve */
STATIC UINT64 EFIAPI CpuIdExit(IN EFI_SYSTEM_CONTEXT_X64 *Regs, IN TDCALL_VEINFO_RETURN_DATA *Veinfo)
/* Use the TDVMCALL instruction to handle cpuid #ve */ STATIC UINT64 EFIAPI CpuIdExit(IN EFI_SYSTEM_CONTEXT_X64 *Regs, IN TDCALL_VEINFO_RETURN_DATA *Veinfo)
{ CPUID_DATA CpuIdData; UINT64 Status; Status = TdVmCallCpuid (Regs->Rax, Regs->Rcx, &CpuIdData); if (Status == 0) { Regs->Rax = CpuIdData.Regs[0]; Regs->Rbx = CpuIdData.Regs[1]; Regs->Rcx = CpuIdData.Regs[2]; Regs->Rdx = CpuIdData.Regs[3]; } return Status; }
tianocore/edk2
C++
Other
4,240
/* This routine is invoked to unset the PCI device memory space for device with SLI-3 interface spec. */
static void lpfc_sli_pci_mem_unset(struct lpfc_hba *phba)
/* This routine is invoked to unset the PCI device memory space for device with SLI-3 interface spec. */ static void lpfc_sli_pci_mem_unset(struct lpfc_hba *phba)
{ struct pci_dev *pdev; if (!phba->pcidev) return; else pdev = phba->pcidev; dma_free_coherent(&pdev->dev, lpfc_sli_hbq_size(), phba->hbqslimp.virt, phba->hbqslimp.phys); dma_free_coherent(&pdev->dev, SLI2_SLIM_SIZE, phba->slim2p.virt, phba->slim2p.phys); iounmap(phba->ctrl_regs_memmap_p); iounmap(...
robutest/uclinux
C++
GPL-2.0
60
/* Helper dissector for ZCL Read Attributes Response command. */
void dissect_zcl_read_attr_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset, guint16 cluster_id)
/* Helper dissector for ZCL Read Attributes Response command. */ void dissect_zcl_read_attr_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset, guint16 cluster_id)
{ proto_tree *sub_tree; guint tvb_len; guint i = 0; guint16 attr_id; tvb_len = tvb_captured_length(tvb); while ( *offset < tvb_len && i < ZBEE_ZCL_NUM_ATTR_ETT ) { sub_tree = proto_tree_add_subtree(tree, tvb, *offset, 0, ett_zbee_zcl_attr[i], NULL, "Status Record"); i++; ...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* sunxi_lcd_dsi_dcs_write - write command and para to mipi panel. @screen_id: The index of screen. @command: Command to be transfer. @para: The pointer to para. @para_num: The number of para */
s32 sunxi_lcd_dsi_dcs_write(u32 screen_id, u8 command, u8 *para, u32 para_num)
/* sunxi_lcd_dsi_dcs_write - write command and para to mipi panel. @screen_id: The index of screen. @command: Command to be transfer. @para: The pointer to para. @para_num: The number of para */ s32 sunxi_lcd_dsi_dcs_write(u32 screen_id, u8 command, u8 *para, u32 para_num)
{ if (g_lcd_drv.src_ops.sunxi_lcd_dsi_dcs_write) return g_lcd_drv.src_ops.sunxi_lcd_dsi_dcs_write(screen_id, command, para, para_num); return -1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function places the processor into deep-sleep mode; it will not return until the processor returns to run mode. The peripherals that are enabled via */
void SysCtlDeepSleep(void)
/* This function places the processor into deep-sleep mode; it will not return until the processor returns to run mode. The peripherals that are enabled via */ void SysCtlDeepSleep(void)
{ HWREG(NVIC_SYS_CTRL) |= NVIC_SYS_CTRL_SLEEPDEEP; CPUwfi(); HWREG(NVIC_SYS_CTRL) &= ~(NVIC_SYS_CTRL_SLEEPDEEP); }
watterott/WebRadio
C++
null
71
/* Polls the EEPROM status bit for either read or write completion based upon the value of 'ee_reg'. */
static s32 igb_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg)
/* Polls the EEPROM status bit for either read or write completion based upon the value of 'ee_reg'. */ static s32 igb_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg)
{ u32 attempts = 100000; u32 i, reg = 0; s32 ret_val = -E1000_ERR_NVM; for (i = 0; i < attempts; i++) { if (ee_reg == E1000_NVM_POLL_READ) reg = rd32(E1000_EERD); else reg = rd32(E1000_EEWR); if (reg & E1000_NVM_RW_REG_DONE) { ret_val = 0; break; } udelay(5); } return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the mute feature on the audio codec. */
static uint32_t Codec_Mute(uint32_t Cmd)
/* Enables or disables the mute feature on the audio codec. */ static uint32_t Codec_Mute(uint32_t Cmd)
{ uint32_t counter = 0; if (Cmd == AUDIO_MUTE_ON) { counter += Codec_WriteRegister(0x04, 0xFF); } else { counter += Codec_WriteRegister(0x04, OutputDev); } return counter; }
remotemcu/remcu-chip-sdks
C++
null
436
/* The function is used to Clear reset source by write 1. The */
void SysCtlResetSrcClear(unsigned long ulSrc)
/* The function is used to Clear reset source by write 1. The */ void SysCtlResetSrcClear(unsigned long ulSrc)
{ xASSERT((ulSrc == SYSCTL_RSTSRC_POR) || (ulSrc == SYSCTL_RSTSRC_PAD) || (ulSrc == SYSCTL_RSTSRC_WDG) || (ulSrc == SYSCTL_RSTSRC_LVR) || (ulSrc == SYSCTL_RSTSRC_BOD) || (ulSrc == SYSCTL_RSTSRC_SYS) || (ulSrc == SYSCTL_RSTSRC_CPU)); xHWREG(...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Internal function to add Save jmp address according to DISPATCH_OPCODE2. The "Context" parameter is not ignored. */
EFI_STATUS BootScriptWriteDispatch2(IN VA_LIST Marker)
/* Internal function to add Save jmp address according to DISPATCH_OPCODE2. The "Context" parameter is not ignored. */ EFI_STATUS BootScriptWriteDispatch2(IN VA_LIST Marker)
{ VOID *EntryPoint; VOID *Context; EntryPoint = (VOID *)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS); Context = (VOID *)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS); return S3BootScriptSaveDispatch2 (EntryPoint, Context); }
tianocore/edk2
C++
Other
4,240
/* Enables or disables the TIMx's Hall sensor interface. */
void TIM_SelectHallSensor(TIM_TypeDef *TIMx, FunctionalState NewState)
/* Enables or disables the TIMx's Hall sensor interface. */ void TIM_SelectHallSensor(TIM_TypeDef *TIMx, FunctionalState NewState)
{ assert_param(IS_TIM_123458_PERIPH(TIMx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { TIMx->CR2 |= CR2_TI1S_Set; } else { TIMx->CR2 &= CR2_TI1S_Reset; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* @ifp: low-level interface object. @state: discover state to set. @chanspec: channel parameters (for state @WL_P2P_DISC_ST_LISTEN only). @listen_ms: duration to listen (for state @WL_P2P_DISC_ST_LISTEN only). */
static s32 brcmf_p2p_set_discover_state(struct brcmf_if *ifp, u8 state, u16 chanspec, u16 listen_ms)
/* @ifp: low-level interface object. @state: discover state to set. @chanspec: channel parameters (for state @WL_P2P_DISC_ST_LISTEN only). @listen_ms: duration to listen (for state @WL_P2P_DISC_ST_LISTEN only). */ static s32 brcmf_p2p_set_discover_state(struct brcmf_if *ifp, u8 state, u16 chanspec, u16 listen_ms)
{ struct brcmf_p2p_disc_st_le discover_state; s32 ret = 0; brcmf_dbg(TRACE, "enter\n"); discover_state.state = state; discover_state.chspec = cpu_to_le16(chanspec); discover_state.dwell = cpu_to_le16(listen_ms); ret = brcmf_fil_bsscfg_data_set(ifp, "p2p_state", &discover_state, sizeof(discover_state)); ret...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Convert some rows of samples to the JPEG colorspace. This version handles RGB->grayscale conversion, which is the same as the RGB->Y portion of RGB->YCbCr. We assume rgb_ycc_start has been called (we only use the Y tables). */
rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
/* Convert some rows of samples to the JPEG colorspace. This version handles RGB->grayscale conversion, which is the same as the RGB->Y portion of RGB->YCbCr. We assume rgb_ycc_start has been called (we only use the Y tables). */ rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIME...
{ my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; register int r, g, b; register INT32 * ctab = cconvert->rgb_ycc_tab; register JSAMPROW inptr; register JSAMPROW outptr; register JDIMENSION col; JDIMENSION num_cols = cinfo->image_width; while (--num_rows >= 0) { inptr = *input_buf++; ...
xboot/xboot
C++
MIT License
779
/* Writes the specified register reg with the reg_value passed. */
void at30tse_write_register(uint8_t reg, uint8_t reg_type, uint8_t reg_size, uint16_t reg_value)
/* Writes the specified register reg with the reg_value passed. */ void at30tse_write_register(uint8_t reg, uint8_t reg_type, uint8_t reg_size, uint16_t reg_value)
{ uint8_t data[3]; data[0] = reg | reg_type; data[1] = 0x00FF & (reg_value >> 8); data[2] = 0x00FF & reg_value; struct i2c_master_packet transfer = { .address = AT30TSE_TEMPERATURE_TWI_ADDR, .data_length = 1 + reg_size, .data = data, .ten_bit_address = false, .high_speed = false, .hs...
memfault/zero-to-main
C++
null
200
/* Start the specified timer and enable update interrupt. */
void gtimer_start(gtimer_t *obj)
/* Start the specified timer and enable update interrupt. */ void gtimer_start(gtimer_t *obj)
{ uint32_t tid = obj->timer_id; assert_param(tid < GTIMER_MAX); RTIM_INTConfig(TIMx[tid], TIM_IT_Update, ENABLE); RTIM_Cmd(TIMx[tid], ENABLE); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* ACPI doesn't have known method to determine the state of the attention status LED, so we use a callback that was registered with us. This allows hardware specific ACPI implementations to determine its state. */
static int get_attention_status(struct hotplug_slot *slot, u8 *value)
/* ACPI doesn't have known method to determine the state of the attention status LED, so we use a callback that was registered with us. This allows hardware specific ACPI implementations to determine its state. */ static int get_attention_status(struct hotplug_slot *slot, u8 *value)
{ int retval = -EINVAL; dbg("%s - physical_slot = %s\n", __func__, hotplug_slot_name(hotplug_slot)); if (attention_info && try_module_get(attention_info->owner)) { retval = attention_info->get_attn(hotplug_slot, value); module_put(attention_info->owner); } else attention_info = NULL; return retval; }
robutest/uclinux
C++
GPL-2.0
60
/* omap_nand_hwcontrol - Set the address pointers corretly for the following address/data/command operation */
static void omap_nand_hwcontrol(struct mtd_info *mtd, int32_t cmd, uint32_t ctrl)
/* omap_nand_hwcontrol - Set the address pointers corretly for the following address/data/command operation */ static void omap_nand_hwcontrol(struct mtd_info *mtd, int32_t cmd, uint32_t ctrl)
{ register struct nand_chip *this = mtd->priv; switch (ctrl) { case NAND_CTRL_CHANGE | NAND_CTRL_CLE: this->IO_ADDR_W = (void __iomem *)&gpmc_cfg->cs[cs].nand_cmd; break; case NAND_CTRL_CHANGE | NAND_CTRL_ALE: this->IO_ADDR_W = (void __iomem *)&gpmc_cfg->cs[cs].nand_adr; break; case NAND_CTRL_CHANGE | NAND...
EmcraftSystems/u-boot
C++
Other
181
/* This can be used to, for example, retrieve the IP header in the packet. It also can be used to get the fragment that contains the byte which is used mainly by the library implementation itself. */
UINT8* EFIAPI NetbufGetByte(IN NET_BUF *Nbuf, IN UINT32 Offset, OUT UINT32 *Index OPTIONAL)
/* This can be used to, for example, retrieve the IP header in the packet. It also can be used to get the fragment that contains the byte which is used mainly by the library implementation itself. */ UINT8* EFIAPI NetbufGetByte(IN NET_BUF *Nbuf, IN UINT32 Offset, OUT UINT32 *Index OPTIONAL)
{ NET_BLOCK_OP *BlockOp; UINT32 Loop; UINT32 Len; NET_CHECK_SIGNATURE (Nbuf, NET_BUF_SIGNATURE); if (Offset >= Nbuf->TotalSize) { return NULL; } BlockOp = Nbuf->BlockOp; Len = 0; for (Loop = 0; Loop < Nbuf->BlockOpNum; Loop++) { if (Len + BlockOp[Loop].Size <= Offset) { ...
tianocore/edk2
C++
Other
4,240
/* The core 100MHz BLCK is disabled in deeper c-states. One needs to calibrate the 100MHz BCLCK against the 24MHz BLCK to restore the clocks properly when a core is woken up */
static int pcode_ready(void)
/* The core 100MHz BLCK is disabled in deeper c-states. One needs to calibrate the 100MHz BCLCK against the 24MHz BLCK to restore the clocks properly when a core is woken up */ static int pcode_ready(void)
{ int wait_count; const int delay_step = 10; wait_count = 0; do { if (!(readl(MCHBAR_REG(BIOS_MAILBOX_INTERFACE)) & MAILBOX_RUN_BUSY)) return 0; wait_count += delay_step; udelay(delay_step); } while (wait_count < 1000); return -ETIMEDOUT; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Look up link by interface index in the provided cache */
struct rtnl_link* rtnl_link_get(struct nl_cache *cache, int ifindex)
/* Look up link by interface index in the provided cache */ struct rtnl_link* rtnl_link_get(struct nl_cache *cache, int ifindex)
{ struct rtnl_link *link; if (cache->c_ops != &rtnl_link_ops) return NULL; nl_list_for_each_entry(link, &cache->c_items, ce_list) { if (link->l_index == ifindex) { nl_object_get((struct nl_object *) link); return link; } } return NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Note: we do this only in the NFSv2 case, since v3 and higher have a better tool (separate unstable writes and commits) for solving this problem. */
static int wait_for_concurrent_writes(struct file *file)
/* Note: we do this only in the NFSv2 case, since v3 and higher have a better tool (separate unstable writes and commits) for solving this problem. */ static int wait_for_concurrent_writes(struct file *file)
{ struct inode *inode = file->f_path.dentry->d_inode; static ino_t last_ino; static dev_t last_dev; int err = 0; if (atomic_read(&inode->i_writecount) > 1 || (last_ino == inode->i_ino && last_dev == inode->i_sb->s_dev)) { dprintk("nfsd: write defer %d\n", task_pid_nr(current)); msleep(10); dprintk("nfsd...
robutest/uclinux
C++
GPL-2.0
60
/* Provide default implementations of the DMA mapping callbacks for busses using the iommu infrastructure Generic iommu implementation */
static void* dma_iommu_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag)
/* Provide default implementations of the DMA mapping callbacks for busses using the iommu infrastructure Generic iommu implementation */ static void* dma_iommu_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag)
{ return iommu_alloc_coherent(dev, get_iommu_table_base(dev), size, dma_handle, device_to_mask(dev), flag, dev_to_node(dev)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* restart a DMA channel that's been stopped in circular addressing mode by comparison-end */
void frv_dma_restart_circular(int dma, unsigned long six)
/* restart a DMA channel that's been stopped in circular addressing mode by comparison-end */ void frv_dma_restart_circular(int dma, unsigned long six)
{ unsigned long ioaddr = frv_dma_channels[dma].ioaddr; ___set_DMAC(ioaddr, SIX, six); ___set_DMAC(ioaddr, CSTR, __get_DMAC(ioaddr, CSTR) & ~DMAC_CSTRx_CE); mb(); __set_DMAC(ioaddr, CCTR, __get_DMAC(ioaddr, CCTR) | DMAC_CCTRx_ACT); frv_set_dma_inprogress(dma); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* retval kStatus_Success Enable Core High Voltage Detect in low power mode successfully. */
status_t SPC_EnableLowPowerModeCoreHighVoltageDetect(SPC_Type *base, bool enable)
/* retval kStatus_Success Enable Core High Voltage Detect in low power mode successfully. */ status_t SPC_EnableLowPowerModeCoreHighVoltageDetect(SPC_Type *base, bool enable)
{ status_t status = kStatus_Success; if (enable) { base->LP_CFG |= SPC_LP_CFG_CORE_HVDE_MASK; } else { base->LP_CFG &= ~SPC_LP_CFG_CORE_HVDE_MASK; } return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If HmacSha384Context is NULL, then return FALSE. If NewHmacSha384Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceHmacSha384Duplicate(IN CONST VOID *HmacSha384Context, OUT VOID *NewHmacSha384Context)
/* If HmacSha384Context is NULL, then return FALSE. If NewHmacSha384Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI CryptoServiceHmacSha384Duplicate(IN CONST VOID *HmacSha384Context, OUT VOID *NewHmacSha384Context)
{ return CALL_BASECRYPTLIB (HmacSha384.Services.Duplicate, HmacSha256Duplicate, (HmacSha384Context, NewHmacSha384Context), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Finish up a receive by completing the process of receiving data and disabling the interrupt. */
static void smartcard_emvsim_CompleteReceiveData(EMVSIM_Type *base, smartcard_context_t *context)
/* Finish up a receive by completing the process of receiving data and disabling the interrupt. */ static void smartcard_emvsim_CompleteReceiveData(EMVSIM_Type *base, smartcard_context_t *context)
{ assert((NULL != context)); base->INT_MASK |= (EMVSIM_INT_MASK_RDT_IM_MASK | EMVSIM_INT_MASK_RX_DATA_IM_MASK); while (((base->RX_STATUS & EMVSIM_RX_STATUS_RX_CNT_MASK) != 0u) && ((context->xSize) > 0u)) { *context->xBuff = (uint8_t)(base->RX_BUF); ++context->xBuff; --context->xS...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Per section 7.4.8 of the SBP-2 spec, a mgt_ORB_timeout value can be provided in the config rom. Most devices do provide a value, which we'll use for login management orbs, but with some sane limits. */
static void sbp2_clamp_management_orb_timeout(struct sbp2_target *tgt)
/* Per section 7.4.8 of the SBP-2 spec, a mgt_ORB_timeout value can be provided in the config rom. Most devices do provide a value, which we'll use for login management orbs, but with some sane limits. */ static void sbp2_clamp_management_orb_timeout(struct sbp2_target *tgt)
{ unsigned int timeout = tgt->mgt_orb_timeout; if (timeout > 40000) fw_notify("%s: %ds mgt_ORB_timeout limited to 40s\n", tgt->bus_id, timeout / 1000); tgt->mgt_orb_timeout = clamp_val(timeout, 5000, 40000); }
robutest/uclinux
C++
GPL-2.0
60
/* Processes incoming V2 Protocol commands from the host, returning a response when required. */
void AVRISP_Task(void)
/* Processes incoming V2 Protocol commands from the host, returning a response when required. */ void AVRISP_Task(void)
{ if (USB_DeviceState != DEVICE_STATE_Configured) return; V2Params_UpdateParamValues(); Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPADDR); if (Endpoint_IsOUTReceived()) { LEDs_SetAllLEDs(LEDMASK_BUSY); V2Protocol_ProcessCommand(); LEDs_SetAllLEDs(LEDMASK_USB_READY); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* sends a setup packet to the control EP of the USB device */
void usb_host_sendctrlsetup(usb_core_instance *pdev, uint8_t *buff, uint8_t hc_num)
/* sends a setup packet to the control EP of the USB device */ void usb_host_sendctrlsetup(usb_core_instance *pdev, uint8_t *buff, uint8_t hc_num)
{ pdev->host.hc[hc_num].is_epin = 0U; pdev->host.hc[hc_num].pid_type = PID_SETUP; pdev->host.hc[hc_num].xfer_buff = buff; pdev->host.hc[hc_num].xfer_len = 8; (void)host_driver_submitrequest(pdev, hc_num); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This must only be called for memory allocated or reserved via the boot memory allocator. */
void platform_release_memory(void *ptr, int size)
/* This must only be called for memory allocated or reserved via the boot memory allocator. */ void platform_release_memory(void *ptr, int size)
{ unsigned long addr; unsigned long end; addr = ((unsigned long)ptr + (PAGE_SIZE - 1)) & PAGE_MASK; end = ((unsigned long)ptr + size) & PAGE_MASK; for (; addr < end; addr += PAGE_SIZE) { ClearPageReserved(virt_to_page(__va(addr))); init_page_count(virt_to_page(__va(addr))); free_page((unsigned long)__va(addr...
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function handles EXTI line 4 to 15 interrupts. */
void EXTI4_15_IRQHandler(void)
/* This function handles EXTI line 4 to 15 interrupts. */ void EXTI4_15_IRQHandler(void)
{ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_8); HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_13); }
Luos-io/luos_engine
C++
MIT License
496
/* Returns if 2 Ascii strings are not overlapped. */
BOOLEAN InternalSafeStringNoAsciiStrOverlap(IN CHAR8 *Str1, IN UINTN Size1, IN CHAR8 *Str2, IN UINTN Size2)
/* Returns if 2 Ascii strings are not overlapped. */ BOOLEAN InternalSafeStringNoAsciiStrOverlap(IN CHAR8 *Str1, IN UINTN Size1, IN CHAR8 *Str2, IN UINTN Size2)
{ return !InternalSafeStringIsOverlap (Str1, Size1, Str2, Size2); }
tianocore/edk2
C++
Other
4,240
/* Process a device trap. This is called via schedule_work(), outside of interrupt context, no locks held. */
void prism54_process_trap(struct work_struct *work)
/* Process a device trap. This is called via schedule_work(), outside of interrupt context, no locks held. */ void prism54_process_trap(struct work_struct *work)
{ struct islpci_mgmtframe *frame = container_of(work, struct islpci_mgmtframe, ws); struct net_device *ndev = frame->ndev; enum oid_num_t n = mgt_oidtonum(frame->header->oid); if (n != OID_NUM_LAST) prism54_process_trap_helper(netdev_priv(ndev), n, frame->data); islpci_mgt_release(frame); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: TRUE if @seekable can be seeked. FALSE otherwise. */
gboolean g_seekable_can_seek(GSeekable *seekable)
/* Returns: TRUE if @seekable can be seeked. FALSE otherwise. */ gboolean g_seekable_can_seek(GSeekable *seekable)
{ GSeekableIface *iface; g_return_val_if_fail (G_IS_SEEKABLE (seekable), FALSE); iface = G_SEEKABLE_GET_IFACE (seekable); return (* iface->can_seek) (seekable); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set output offsets to 3270 datastream fragment of a tty string. (TO_SBA offset at the start and TO_RA offset at the end of the string) */
static void tty3270_update_string(struct tty3270 *tp, struct string *line, int nr)
/* Set output offsets to 3270 datastream fragment of a tty string. (TO_SBA offset at the start and TO_RA offset at the end of the string) */ static void tty3270_update_string(struct tty3270 *tp, struct string *line, int nr)
{ unsigned char *cp; raw3270_buffer_address(tp->view.dev, line->string + 1, tp->view.cols * nr); cp = line->string + line->len - 4; if (*cp == TO_RA) raw3270_buffer_address(tp->view.dev, cp + 1, tp->view.cols * (nr + 1)); }
robutest/uclinux
C++
GPL-2.0
60
/* Get the counting direction of the specified TMRA unit. */
uint8_t TMRA_GetCountDir(const CM_TMRA_TypeDef *TMRAx)
/* Get the counting direction of the specified TMRA unit. */ uint8_t TMRA_GetCountDir(const CM_TMRA_TypeDef *TMRAx)
{ DDL_ASSERT(IS_TMRA_UNIT(TMRAx)); return READ_REG8_BIT(TMRAx->BCSTRL, TMRA_BCSTRL_DIR); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function parses all dissectors associated with a table to find the one whose protocol has the specified filter name. It is called as a reference function in a call to dissector_table_foreach_handle. The name we are looking for, as well as the results, are stored in the */
static void find_protocol_name_func(const gchar *table, gpointer handle, gpointer user_data)
/* This function parses all dissectors associated with a table to find the one whose protocol has the specified filter name. It is called as a reference function in a call to dissector_table_foreach_handle. The name we are looking for, as well as the results, are stored in the */ static void find_protocol_name_func(co...
{ int proto_id; const gchar *protocol_filter_name; protocol_name_search_t search_info; g_assert(handle); search_info = (protocol_name_search_t)user_data; proto_id = dissector_handle_get_protocol_index((dissector_handle_t)handle); if (proto_id != -1) { protoc...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Print CPU information Convert all NIC-301 AMBA slaves from secure to non-secure */
static void socfpga_nic301_slave_ns(void)
/* Print CPU information Convert all NIC-301 AMBA slaves from secure to non-secure */ static void socfpga_nic301_slave_ns(void)
{ writel(0x1, &nic301_regs->lwhps2fpgaregs); writel(0x1, &nic301_regs->hps2fpgaregs); writel(0x1, &nic301_regs->acp); writel(0x1, &nic301_regs->rom); writel(0x1, &nic301_regs->ocram); writel(0x1, &nic301_regs->sdrdata); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Hitachi SolutionEngine Support. Configure the Super I/O chip */
static void __init smsc_config(int index, int data)
/* Hitachi SolutionEngine Support. Configure the Super I/O chip */ static void __init smsc_config(int index, int data)
{ outb_p(index, INDEX_PORT); outb_p(data, DATA_PORT); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initial EMMC host controller with lowest clock frequency, max power and max timeout value at initialization. */
EFI_STATUS EmmcPeimHcInitHost(IN UINTN Bar)
/* Initial EMMC host controller with lowest clock frequency, max power and max timeout value at initialization. */ EFI_STATUS EmmcPeimHcInitHost(IN UINTN Bar)
{ EFI_STATUS Status; Status = EmmcPeimHcInitClockFreq (Bar); if (EFI_ERROR (Status)) { return Status; } Status = EmmcPeimHcInitPowerVoltage (Bar); if (EFI_ERROR (Status)) { return Status; } Status = EmmcPeimHcInitTimeoutCtrl (Bar); return Status; }
tianocore/edk2
C++
Other
4,240
/* (*) get_dumpable regards interim value of 10 as 11. */
void set_dumpable(struct mm_struct *mm, int value)
/* (*) get_dumpable regards interim value of 10 as 11. */ void set_dumpable(struct mm_struct *mm, int value)
{ switch (value) { case 0: clear_bit(MMF_DUMPABLE, &mm->flags); smp_wmb(); clear_bit(MMF_DUMP_SECURELY, &mm->flags); break; case 1: set_bit(MMF_DUMPABLE, &mm->flags); smp_wmb(); clear_bit(MMF_DUMP_SECURELY, &mm->flags); break; case 2: set_bit(MMF_DUMP_SECURELY, &mm->flags); smp_wmb(); set_bit(...
robutest/uclinux
C++
GPL-2.0
60
/* brief Return Frequency of Usb1 Clock return Frequency of Usb1 Clock. */
uint32_t CLOCK_GetUsb1ClkFreq(void)
/* brief Return Frequency of Usb1 Clock return Frequency of Usb1 Clock. */ uint32_t CLOCK_GetUsb1ClkFreq(void)
{ return ((ANACTRL->XO32M_CTRL & ANACTRL_XO32M_CTRL_ENABLE_PLL_USB_OUT_MASK) != 0UL) ? s_Ext_Clk_Freq : 0U; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Restore the SSP configuration saved previously by ssp_save_state. */
void ssp_restore_state(struct ssp_state *ssp)
/* Restore the SSP configuration saved previously by ssp_save_state. */ void ssp_restore_state(struct ssp_state *ssp)
{ Ser4SSSR = SSSR_ROR; Ser4SSCR0 = ssp->cr0 & ~SSCR0_SSE; Ser4SSCR1 = ssp->cr1; Ser4SSCR0 = ssp->cr0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Install a sensor event handler. The event handler can subsequently be enabled and disabled using the sensor_event_enable() and sensor_event_disable() routines. */
bool sensor_add_event(sensor_t *sensor, sensor_event_t sensor_event, sensor_event_callback handler, volatile void *arg, bool enable)
/* Install a sensor event handler. The event handler can subsequently be enabled and disabled using the sensor_event_enable() and sensor_event_disable() routines. */ bool sensor_add_event(sensor_t *sensor, sensor_event_t sensor_event, sensor_event_callback handler, volatile void *arg, bool enable)
{ sensor_event_callback_t callback; callback.handler = (handler != NULL) ? handler : default_event_handler; callback.arg = arg; return SENSOR_DRV_CALL(sensor, event, sensor_event, &callback, enable); }
memfault/zero-to-main
C++
null
200
/* SPI MSP Initialization This function configures the hardware resources used in this example. */
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
/* SPI MSP Initialization This function configures the hardware resources used in this example. */ void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hspi->Instance==SPI5) { __HAL_RCC_SPI5_CLK_ENABLE(); __HAL_RCC_GPIOF_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_S...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This debounces changes: it does not write the register if the flag already has the proper value. Returns 0 on success, negative on error. */
int mdio_set_flag(const struct mdio_if_info *mdio, int prtad, int devad, u16 addr, int mask, bool sense)
/* This debounces changes: it does not write the register if the flag already has the proper value. Returns 0 on success, negative on error. */ int mdio_set_flag(const struct mdio_if_info *mdio, int prtad, int devad, u16 addr, int mask, bool sense)
{ int old_val = mdio->mdio_read(mdio->dev, prtad, devad, addr); int new_val; if (old_val < 0) return old_val; if (sense) new_val = old_val | mask; else new_val = old_val & ~mask; if (old_val == new_val) return 0; return mdio->mdio_write(mdio->dev, prtad, devad, addr, new_val); }
robutest/uclinux
C++
GPL-2.0
60
/* Return value: number of bytes accepted for sending (skb->len) if ok, error code < 0 (eg. -ENOMEM) on error */
int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb)
/* Return value: number of bytes accepted for sending (skb->len) if ok, error code < 0 (eg. -ENOMEM) on error */ int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb)
{ struct cardstate *cs = bcs->cs; unsigned len = skb->len; unsigned long flags; if (bcs->proto2 == L2_HDLC) skb = HDLC_Encode(skb); else skb = iraw_encode(skb); if (!skb) { dev_err(cs->dev, "unable to allocate memory for encoding!\n"); return -ENOMEM; } skb_queue_tail(&bcs->squeue, skb); spin_lock_i...
robutest/uclinux
C++
GPL-2.0
60
/* Configures the PLL clock source and multiplication factor. */
void RCC_PLLConfig(uint32_t RCC_PLLSource, uint32_t RCC_PLLMul)
/* Configures the PLL clock source and multiplication factor. */ void RCC_PLLConfig(uint32_t RCC_PLLSource, uint32_t RCC_PLLMul)
{ uint32_t tmpreg = 0; assert_param(IS_RCC_PLL_SOURCE(RCC_PLLSource)); assert_param(IS_RCC_PLL_MUL(RCC_PLLMul)); tmpreg = RCC->CFGR; tmpreg &= CFGR_PLL_Mask; tmpreg |= RCC_PLLSource | RCC_PLLMul; RCC->CFGR = tmpreg; }
pikasTech/PikaPython
C++
MIT License
1,403
/* This function is executed in case of error occurrence. */
static void Error_Handler(void)
/* This function is executed in case of error occurrence. */ static void Error_Handler(void)
{ BSP_LED_Off(LED1); BSP_LED_On(LED3); while(1) { } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Turn on or turn off the clock of register bank of audio codec. */
void AUDIO_SI_ClkCmd(u8 new_state)
/* Turn on or turn off the clock of register bank of audio codec. */ void AUDIO_SI_ClkCmd(u8 new_state)
{ AUDIO_SI_TypeDef* SIx = AUDIO_SI_DEV; if (new_state == ENABLE) { SIx->SI_CLK_EN |= BIT_SI_CLK_EN; } else { SIx->SI_CLK_EN &= ~ BIT_SI_CLK_EN; } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* uSDHC Controller initialization - enble clock and iomux configuration */
void host_init(uint32_t instance)
/* uSDHC Controller initialization - enble clock and iomux configuration */ void host_init(uint32_t instance)
{ usdhc_iomux_config(instance); usdhc_gpio_config(instance); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Query has taken too long time, so abort */
static void iriap_watchdog_timer_expired(void *data)
/* Query has taken too long time, so abort */ static void iriap_watchdog_timer_expired(void *data)
{ struct iriap_cb *self = (struct iriap_cb *) data; IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IAS_MAGIC, return;); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Big-endian to little-endian byte-swapping/bitmaps by David S. Miller ( */
static int nilfs_add_nondir(struct dentry *dentry, struct inode *inode)
/* Big-endian to little-endian byte-swapping/bitmaps by David S. Miller ( */ static int nilfs_add_nondir(struct dentry *dentry, struct inode *inode)
{ int err = nilfs_add_link(dentry, inode); if (!err) { d_instantiate(dentry, inode); return 0; } inode_dec_link_count(inode); iput(inode); return err; }
robutest/uclinux
C++
GPL-2.0
60
/* Function: SendFlashAddr Arguments: flash_address, 32 bit flash memory address io_mode, I/O mode to transfer address addr_4byte_mode, Description: Send flash address with 3-byte or 4-byte mode. Return Message: None */
void SendFlashAddr(uint32_t flash_address, uint8_t io_mode, bool addr_4byte_mode)
/* Function: SendFlashAddr Arguments: flash_address, 32 bit flash memory address io_mode, I/O mode to transfer address addr_4byte_mode, Description: Send flash address with 3-byte or 4-byte mode. Return Message: None */ void SendFlashAddr(uint32_t flash_address, uint8_t io_mode, bool addr_4byte_mode)
{ if( addr_4byte_mode == TRUE ){ SendByte( (flash_address >> 24), io_mode ); } SendByte( (flash_address >> 16), io_mode ); SendByte( (flash_address >> 8), io_mode ); SendByte( (flash_address), io_mode ); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Ensures the 'buff' string uses a dot as the radix character. */
static void checkdp(char *buff, int nb)
/* Ensures the 'buff' string uses a dot as the radix character. */ static void checkdp(char *buff, int nb)
{ char point = lua_getlocaledecpoint(); char *ppoint = (char *)memchr(buff, point, nb); if (ppoint) *ppoint = '.'; } }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Starts the TIMER one pulse signal generation on the complementary output. in interrupt mode. */
void ald_timer_one_pulse_n_start_by_it(ald_timer_handle_t *hperh, ald_timer_channel_t ch)
/* Starts the TIMER one pulse signal generation on the complementary output. in interrupt mode. */ void ald_timer_one_pulse_n_start_by_it(ald_timer_handle_t *hperh, ald_timer_channel_t ch)
{ ald_timer_ocn_start_by_it(hperh, ch); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Converts a text device path node to UART Flow Control device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUartFlowCtrl(CHAR16 *TextDeviceNode)
/* Converts a text device path node to UART Flow Control device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUartFlowCtrl(CHAR16 *TextDeviceNode)
{ CHAR16 *ValueStr; UART_FLOW_CONTROL_DEVICE_PATH *UartFlowControl; ValueStr = GetNextParamStr (&TextDeviceNode); UartFlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) CreateDeviceNode ( MESSAGING_DEVICE_PATH, ...
tianocore/edk2
C++
Other
4,240
/* Internal function to retrieves the 64-bit frequency in Hz. */
UINT64 InternalGetPerformanceCounterFrequency(VOID)
/* Internal function to retrieves the 64-bit frequency in Hz. */ UINT64 InternalGetPerformanceCounterFrequency(VOID)
{ UINT64 *PerformanceCounterFrequency; EFI_HOB_GUID_TYPE *GuidHob; PerformanceCounterFrequency = NULL; GuidHob = GetFirstGuidHob (&mFrequencyHobGuid); if (GuidHob == NULL) { PerformanceCounterFrequency = (UINT64 *)BuildGuidHob (&mFrequencyHobGuid, sizeof (*PerformanceCount...
tianocore/edk2
C++
Other
4,240
/* Enable/disable the DIV_ONE feature of the specified SPI port. */
void SPI3WireFunction(unsigned long ulBase, xtBoolean xtEnable)
/* Enable/disable the DIV_ONE feature of the specified SPI port. */ void SPI3WireFunction(unsigned long ulBase, xtBoolean xtEnable)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) ); if (xtEnable) { xHWREG(ulBase + SPI_CNTRL2) |= SPI_CNTRL2_NOSLVSEL; xHWREG(ulBase + SPI_SSR) |= SPI_SS_LTRIG; } else { xHWREG(ulBase + SPI_CNTRL2) &= ~SP...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* By the time this is called we can't have any more ioctls called on the socket so we don't need to worry about racing with others. */
void rds_rdma_drop_keys(struct rds_sock *rs)
/* By the time this is called we can't have any more ioctls called on the socket so we don't need to worry about racing with others. */ void rds_rdma_drop_keys(struct rds_sock *rs)
{ struct rds_mr *mr; struct rb_node *node; while ((node = rb_first(&rs->rs_rdma_keys))) { mr = container_of(node, struct rds_mr, r_rb_node); if (mr->r_trans == rs->rs_transport) mr->r_invalidate = 0; rds_mr_put(mr); } if (rs->rs_transport && rs->rs_transport->flush_mrs) rs->rs_transport->flush_mrs(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get the timeout period of the Reinforced Safety WatchDog Timer in microseconds. */
uint32_t rswdt_get_us_timeout_period(Rswdt *p_rswdt, uint32_t ul_sclk)
/* Get the timeout period of the Reinforced Safety WatchDog Timer in microseconds. */ uint32_t rswdt_get_us_timeout_period(Rswdt *p_rswdt, uint32_t ul_sclk)
{ return RSWDT_MR_WDV(p_rswdt->RSWDT_MR) * RSWDT_SLCK_DIV / ul_sclk * 1000000; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Returns: TRUE if successful. If an error has occurred, this function will return FALSE and set @error appropriately if present. */
gboolean g_seekable_seek(GSeekable *seekable, goffset offset, GSeekType type, GCancellable *cancellable, GError **error)
/* Returns: TRUE if successful. If an error has occurred, this function will return FALSE and set @error appropriately if present. */ gboolean g_seekable_seek(GSeekable *seekable, goffset offset, GSeekType type, GCancellable *cancellable, GError **error)
{ GSeekableIface *iface; g_return_val_if_fail (G_IS_SEEKABLE (seekable), FALSE); iface = G_SEEKABLE_GET_IFACE (seekable); return (* iface->seek) (seekable, offset, type, cancellable, error); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Add a new value to the configuration string. */
static void define_config(const char *name, int len)
/* Add a new value to the configuration string. */ static void define_config(const char *name, int len)
{ grow_config(len + 1); memcpy(str_config+len_config, name, len); len_config += len; str_config[len_config++] = '\n'; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This routine registers the Section Extraction Protocols that have been registered with the Section Extraction Library. */
EFI_STATUS EFIAPI SectionExtractionDxeEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* This routine registers the Section Extraction Protocols that have been registered with the Section Extraction Library. */ EFI_STATUS EFIAPI SectionExtractionDxeEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; EFI_GUID *ExtractHandlerGuidTable; UINTN ExtractHandlerNumber; ExtractHandlerNumber = ExtractGuidedSectionGetGuidList (&ExtractHandlerGuidTable); while (ExtractHandlerNumber-- > 0) { Status = gBS->InstallMultipleProtocolInterfaces ( &mSectionExtractionHan...
tianocore/edk2
C++
Other
4,240
/* Converts a VLAN device path structure to its string representative. */
VOID DevPathToTextVlan(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
/* Converts a VLAN device path structure to its string representative. */ VOID DevPathToTextVlan(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
{ VLAN_DEVICE_PATH *Vlan; Vlan = DevPath; UefiDevicePathLibCatPrint (Str, L"Vlan(%d)", Vlan->VlanId); }
tianocore/edk2
C++
Other
4,240
/* Set the port FIFO timeout value. The @cflag value should reflect the actual hardware settings. */
void uart_update_timeout(struct uart_port *port, unsigned int cflag, unsigned int baud)
/* Set the port FIFO timeout value. The @cflag value should reflect the actual hardware settings. */ void uart_update_timeout(struct uart_port *port, unsigned int cflag, unsigned int baud)
{ unsigned int bits; switch (cflag & CSIZE) { case CS5: bits = 7; break; case CS6: bits = 8; break; case CS7: bits = 9; break; default: bits = 10; break; } if (cflag & CSTOPB) bits++; if (cflag & PARENB) bits++; bits = bits * port->fifosize; port->timeout = (HZ * bits) / baud + HZ/50; }
robutest/uclinux
C++
GPL-2.0
60
/* The TD size is the number of bytes remaining in the TD (including this TRB), right shifted by 10. It must fit in bits 21:17, so it can't be bigger than 31. */
static u32 xhci_td_remainder(unsigned int remainder)
/* The TD size is the number of bytes remaining in the TD (including this TRB), right shifted by 10. It must fit in bits 21:17, so it can't be bigger than 31. */ static u32 xhci_td_remainder(unsigned int remainder)
{ u32 max = (1 << (21 - 17 + 1)) - 1; if ((remainder >> 10) >= max) return max << 17; else return (remainder >> 10) << 17; }
robutest/uclinux
C++
GPL-2.0
60
/* Trim a single NET_BLOCK by Len bytes from the header or tail. */
VOID NetblockTrim(IN OUT NET_BLOCK_OP *BlockOp, IN UINT32 Len, IN BOOLEAN FromHead)
/* Trim a single NET_BLOCK by Len bytes from the header or tail. */ VOID NetblockTrim(IN OUT NET_BLOCK_OP *BlockOp, IN UINT32 Len, IN BOOLEAN FromHead)
{ ASSERT ((BlockOp != NULL) && (BlockOp->Size >= Len)); BlockOp->Size -= Len; if (FromHead) { BlockOp->Head += Len; } else { BlockOp->Tail -= Len; } }
tianocore/edk2
C++
Other
4,240
/* beiscsi_get_cid - Allocate a cid @phba: The phba instance */
static int beiscsi_get_cid(struct beiscsi_hba *phba)
/* beiscsi_get_cid - Allocate a cid @phba: The phba instance */ static int beiscsi_get_cid(struct beiscsi_hba *phba)
{ unsigned short cid = 0xFFFF; if (!phba->avlbl_cids) return cid; cid = phba->cid_array[phba->cid_alloc++]; if (phba->cid_alloc == phba->params.cxns_per_ctrl) phba->cid_alloc = 0; phba->avlbl_cids--; return cid; }
robutest/uclinux
C++
GPL-2.0
60
/* Selects the clock source to output on MCO pin. */
void RCC_MCOConfig(uint8_t RCC_MCO)
/* Selects the clock source to output on MCO pin. */ void RCC_MCOConfig(uint8_t RCC_MCO)
{ assert_param(IS_RCC_MCO(RCC_MCO)); *(__IO uint8_t *) CFGR_BYTE4_ADDRESS = RCC_MCO; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Attaches an SPI peripheral slave. This function will initialize the software SPI peripheral slave, based on the values of the config struct. The slave can then be selected and optionally addressed by the */
void spi_attach_slave(struct spi_slave_inst *const slave, struct spi_slave_inst_config *const config)
/* Attaches an SPI peripheral slave. This function will initialize the software SPI peripheral slave, based on the values of the config struct. The slave can then be selected and optionally addressed by the */ void spi_attach_slave(struct spi_slave_inst *const slave, struct spi_slave_inst_config *const config)
{ Assert(slave); Assert(config); slave->ss_pin = config->ss_pin; slave->address_enabled = config->address_enabled; slave->address = config->address; struct gpio_config config_gpio; gpio_get_config_defaults(&config_gpio); config_gpio.direction = GPIO_PIN_DIR_OUTPUT; gpio_pin_set_config(slave->s...
memfault/zero-to-main
C++
null
200
/* This function returns the current status of the last program or erase operation performed by the EEPROM. It is intended to provide error information to applications programming or setting EEPROM protection options under interrupt control. */
uint32_t EEPROMStatusGet(void)
/* This function returns the current status of the last program or erase operation performed by the EEPROM. It is intended to provide error information to applications programming or setting EEPROM protection options under interrupt control. */ uint32_t EEPROMStatusGet(void)
{ return (HWREG(EEPROM_EEDONE)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initialize the memory management pool for the host controller. */
USBHC_MEM_POOL* UsbHcInitMemPool(VOID)
/* Initialize the memory management pool for the host controller. */ USBHC_MEM_POOL* UsbHcInitMemPool(VOID)
{ USBHC_MEM_POOL *Pool; UINTN PageNumber; EFI_STATUS Status; EFI_PHYSICAL_ADDRESS TempPtr; PageNumber = EFI_SIZE_TO_PAGES (sizeof (USBHC_MEM_POOL)); Status = PeiServicesAllocatePages ( EfiBootServicesData, PageNumber, ...
tianocore/edk2
C++
Other
4,240
/* There is a need for the value of integer N' such that B^-1(B-1)-N^-1N'=1, where B^-1(B-1) mod N=1. Actually, only the least significant part of N' is needed, hence the definition N0'=N' mod b. We reproduce below the simple algorithm from an article by Dusse and Kaliski to efficiently find N0' from N0 and b */
static mbedtls_mpi_uint modular_inverse(const mbedtls_mpi *M)
/* There is a need for the value of integer N' such that B^-1(B-1)-N^-1N'=1, where B^-1(B-1) mod N=1. Actually, only the least significant part of N' is needed, hence the definition N0'=N' mod b. We reproduce below the simple algorithm from an article by Dusse and Kaliski to efficiently find N0' from N0 and b */ stati...
{ int i; uint64_t t = 1; uint64_t two_2_i_minus_1 = 2; uint64_t two_2_i = 4; uint64_t N = M->p[0]; for (i = 2; i <= 32; i++) { if ((mbedtls_mpi_uint) N * t % two_2_i >= two_2_i_minus_1) { t += two_2_i_minus_1; } two_2_i_minus_1 <<= 1; two_2_i <<= 1; ...
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Initialize GPIO config structure. Fill each pstcGpioInit with default value. */
int32_t GPIO_StructInit(stc_gpio_init_t *pstcGpioInit)
/* Initialize GPIO config structure. Fill each pstcGpioInit with default value. */ int32_t GPIO_StructInit(stc_gpio_init_t *pstcGpioInit)
{ int32_t i32Ret = LL_OK; if (NULL == pstcGpioInit) { i32Ret = LL_ERR_INVD_PARAM; } else { pstcGpioInit->u16PinState = PIN_STAT_RST; pstcGpioInit->u16PinDir = PIN_DIR_IN; pstcGpioInit->u16PinDrv = PIN_LOW_DRV; pstcGpioInit->u16PinAttr = PI...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* In all cases the return value is guaranteed to be non-negative. */
signed long __sched schedule_timeout(signed long timeout)
/* In all cases the return value is guaranteed to be non-negative. */ signed long __sched schedule_timeout(signed long timeout)
{ struct timer_list timer; unsigned long expire; switch (timeout) { case MAX_SCHEDULE_TIMEOUT: schedule(); goto out; default: if (timeout < 0) { printk(KERN_ERR "schedule_timeout: wrong timeout " "value %lx\n", timeout); dump_stack(); current->state = TASK_RUNNING; goto out; } } expire =...
EmcraftSystems/linux-emcraft
C++
Other
266
/* The following functions return memory parameters: bus and device width, device size */
u32 hws_ddr3_get_bus_width(void)
/* The following functions return memory parameters: bus and device width, device size */ u32 hws_ddr3_get_bus_width(void)
{ struct mv_ddr_topology_map *tm = mv_ddr_topology_map_get(); return (DDR3_IS_16BIT_DRAM_MODE(tm->bus_act_mask) == 1) ? 16 : 32; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function will provide the caller with the specified block device's media information. If the media changes, calling this function will update the media information accordingly. */
EFI_STATUS EFIAPI AhciBlockIoGetMediaInfo2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo)
/* This function will provide the caller with the specified block device's media information. If the media changes, calling this function will update the media information accordingly. */ EFI_STATUS EFIAPI AhciBlockIoGetMediaInfo2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN Devi...
{ PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private; PEI_AHCI_ATA_DEVICE_DATA *DeviceData; if ((This == NULL) || (MediaInfo == NULL)) { return EFI_INVALID_PARAMETER; } Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO2 (This); DeviceData = SearchDeviceByIndex (Private, DeviceIndex); if (Dev...
tianocore/edk2
C++
Other
4,240
/* Return a clock value for the specified clock. */
ulong clock_get(enum clock clck)
/* Return a clock value for the specified clock. */ ulong clock_get(enum clock clck)
{ ulong res = 0; if (clck >= 0 && clck < CLOCK_END) { res = clock[clck]; } return res; }
EmcraftSystems/u-boot
C++
Other
181
/* The following routines are taken from page 170 of the 7th ARRL Computer Networking Conference paper, as is the whole state machine. */
void x25_enquiry_response(struct sock *sk)
/* The following routines are taken from page 170 of the 7th ARRL Computer Networking Conference paper, as is the whole state machine. */ void x25_enquiry_response(struct sock *sk)
{ struct x25_sock *x25 = x25_sk(sk); if (x25->condition & X25_COND_OWN_RX_BUSY) x25_write_internal(sk, X25_RNR); else x25_write_internal(sk, X25_RR); x25->vl = x25->vr; x25->condition &= ~X25_COND_ACK_PENDING; x25_stop_timer(sk); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Callback function which provided by user to remove one node in NetDestroyLinkList process. */
EFI_STATUS EFIAPI Udp6DestroyChildEntryInHandleBuffer(IN LIST_ENTRY *Entry, IN VOID *Context)
/* Callback function which provided by user to remove one node in NetDestroyLinkList process. */ EFI_STATUS EFIAPI Udp6DestroyChildEntryInHandleBuffer(IN LIST_ENTRY *Entry, IN VOID *Context)
{ UDP6_INSTANCE_DATA *Instance; EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; UINTN NumberOfChildren; EFI_HANDLE *ChildHandleBuffer; if ((Entry == NULL) || (Context == NULL)) { return EFI_INVALID_PARAMETER; } Instance = NET_LIST_USER_STRU...
tianocore/edk2
C++
Other
4,240