docstring
stringlengths
22
576
signature
stringlengths
9
317
prompt
stringlengths
57
886
code
stringlengths
20
1.36k
repository
stringclasses
49 values
language
stringclasses
2 values
license
stringclasses
9 values
stars
int64
15
21.3k
/* This detects PHY chip from address 0-31 by reading PHY status registers. PHY chip can be connected at any of this address. */
static int ethernet_phy_detect(struct eth_device *dev)
/* This detects PHY chip from address 0-31 by reading PHY status registers. PHY chip can be connected at any of this address. */ static int ethernet_phy_detect(struct eth_device *dev)
{ u32 val; u16 tmp, mii_status; u8 addr; for (addr = 0; addr < 32; addr++) { if (miiphy_read(dev->name, addr, MII_BMSR, &mii_status) != 0) continue; if (mii_status == 0 || mii_status == 0xffff) continue; if (miiphy_read(dev->name, addr, MII_PHYSID1, &tmp) != 0) continue; val = tmp << 16; if (miip...
4ms/stm32mp1-baremetal
C++
Other
137
/* Function used by tinflate_partial to read a byte from an address in the output buffer here it is implemented to directly read from the object memory of the d11 core */
unsigned char tinflate_read_objmem(void *out_base, unsigned long idx)
/* Function used by tinflate_partial to read a byte from an address in the output buffer here it is implemented to directly read from the object memory of the d11 core */ unsigned char tinflate_read_objmem(void *out_base, unsigned long idx)
{ return wlc_bmac_read_objmem_byte((struct wlc_hw_info *) out_base, idx, OBJADDR_UCM_SEL); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Init the Comp n Interrupt Callback function. param of pfnCallback */
void xACMPIntCallbackInit(unsigned long ulBase, unsigned long ulCompID, xtEventCallback pfnCallback)
/* Init the Comp n Interrupt Callback function. param of pfnCallback */ void xACMPIntCallbackInit(unsigned long ulBase, unsigned long ulCompID, xtEventCallback pfnCallback)
{ xASSERT(ulBase == ACMP_BASE); xASSERT((ulCompID == xACMP_0) || (ulCompID == xACMP_1)); switch(ulCompID) { case xACMP_0: { g_pfnACMPHandlerCallbacks[0] = pfnCallback; break; } case xACMP_1: { g_pfnACMPHandlerCallbacks[1] = pfnC...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Fills each RTC_AlarmStruct member with its default value (Time = 00h:00mn:00sec / Date = 1st day of the month/Mask = all fields are masked). */
void RTC_AlarmStructInit(RTC_AlarmTypeDef *RTC_AlarmStruct)
/* Fills each RTC_AlarmStruct member with its default value (Time = 00h:00mn:00sec / Date = 1st day of the month/Mask = all fields are masked). */ void RTC_AlarmStructInit(RTC_AlarmTypeDef *RTC_AlarmStruct)
{ RTC_AlarmStruct->RTC_AlarmTime.RTC_H12 = RTC_H12_AM; RTC_AlarmStruct->RTC_AlarmTime.RTC_Hours = 0; RTC_AlarmStruct->RTC_AlarmTime.RTC_Minutes = 0; RTC_AlarmStruct->RTC_AlarmTime.RTC_Seconds = 0; RTC_AlarmStruct->RTC_AlarmDateWeekDaySel = RTC_AlarmDateWeekDaySel_Date; RTC_AlarmStruct->RTC_AlarmDateWeekDay ...
remotemcu/remcu-chip-sdks
C++
null
436
/* Send a request to configure the CCA mode. */
sl_status_t sl_wfx_set_cca_config(uint8_t cca_thr_mode)
/* Send a request to configure the CCA mode. */ sl_status_t sl_wfx_set_cca_config(uint8_t cca_thr_mode)
{ sl_status_t result; sl_wfx_set_cca_config_req_body_t payload; payload.cca_thr_mode = cca_thr_mode; payload.reserved[0] = 0; payload.reserved[1] = 0; payload.reserved[2] = 0; result = sl_wfx_send_command(SL_WFX_SET_CCA_CONFIG_REQ_ID, &payload, sizeof(payload), SL_WFX_STA_INTERFACE, NULL); return result...
eclipse-threadx/getting-started
C++
Other
310
/* Function for Timer 2 initialization. Initializes Timer 2 peripheral, creates event and interrupt every 2 seconds by configuring CC to half of timer overflow value. Events are created at odd number of seconds. For example, events are created at 1,3,5,... seconds. This event can be used to start Timer 0 with Timer2->...
static void timer2_init(void)
/* Function for Timer 2 initialization. Initializes Timer 2 peripheral, creates event and interrupt every 2 seconds by configuring CC to half of timer overflow value. Events are created at odd number of seconds. For example, events are created at 1,3,5,... seconds. This event can be used to start Timer 0 with Timer2->...
{ nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG; timer_cfg.frequency = NRF_TIMER_FREQ_31250Hz; ret_code_t err_code = nrf_drv_timer_init(&timer2, &timer_cfg, timer_event_handler); APP_ERROR_CHECK(err_code); nrf_drv_timer_extended_compare(&timer2, NRF_TIMER_CC_CHANNEL0, 0x7FFFUL, NRF...
remotemcu/remcu-chip-sdks
C++
null
436
/* Configures the ADCx external trigger edge for injected channels conversion. */
void ADC_ConfigExternalTrigInjectedConvEdge(ADC_T *adc, ADC_EXT_TRIG_INJEC_EDGE_T extTrigInjecConvEdge)
/* Configures the ADCx external trigger edge for injected channels conversion. */ void ADC_ConfigExternalTrigInjectedConvEdge(ADC_T *adc, ADC_EXT_TRIG_INJEC_EDGE_T extTrigInjecConvEdge)
{ adc->CTRL2_B.INJEXTTRGEN = extTrigInjecConvEdge; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Mark device non-existent. This disables writes, ioctls and prevents new users from opening the device. Already posted blocking reads will stay, however new ones will fail. */
static void mousedev_mark_dead(struct mousedev *mousedev)
/* Mark device non-existent. This disables writes, ioctls and prevents new users from opening the device. Already posted blocking reads will stay, however new ones will fail. */ static void mousedev_mark_dead(struct mousedev *mousedev)
{ mutex_lock(&mousedev->mutex); mousedev->exist = 0; mutex_unlock(&mousedev->mutex); }
robutest/uclinux
C++
GPL-2.0
60
/* MPC Group Station - not part of FSM CTCM_PROTO_MPC only called from add_channel in ctcm_main.c */
void mpc_action_send_discontact(unsigned long thischan)
/* MPC Group Station - not part of FSM CTCM_PROTO_MPC only called from add_channel in ctcm_main.c */ void mpc_action_send_discontact(unsigned long thischan)
{ int rc; struct channel *ch = (struct channel *)thischan; unsigned long saveflags = 0; spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); rc = ccw_device_start(ch->cdev, &ch->ccw[15], (unsigned long)ch, 0xff, 0); spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags); if (rc != 0) { ctcm_ccw_...
robutest/uclinux
C++
GPL-2.0
60
/* Returns positive length of the filled-in string on success; otherwise a negative errno value is returned if an error occurs. */
int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen)
/* Returns positive length of the filled-in string on success; otherwise a negative errno value is returned if an error occurs. */ int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen)
{ struct svc_xprt *xprt; int len, totlen; char *pos; if (!serv) return 0; spin_lock_bh(&serv->sv_lock); pos = buf; totlen = 0; list_for_each_entry(xprt, &serv->sv_permsocks, xpt_list) { len = svc_one_xprt_name(xprt, pos, buflen - totlen); if (len < 0) { *buf = '\0'; totlen = len; } if (len <= 0)...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns the current frequency in Hz (meaning 97.5MHz will be returned as 97,500,000 etc. */
uint32_t tea5767GetFrequency(void)
/* Returns the current frequency in Hz (meaning 97.5MHz will be returned as 97,500,000 etc. */ uint32_t tea5767GetFrequency(void)
{ uint32_t frequency = 0; uint8_t buffer[5] = { 0, 0, 0, 0, 0 }; if (!_tea5767Initialised) tea5767Init(); tea5767ReadData(&buffer[0]); frequency = ((buffer[0] & 0x3F) << 8) + buffer[1]; frequency = frequency * 32768 / 4 - 225000; return frequency; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Converts a text device path node to NVM Express Namespace device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextNVMe(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to NVM Express Namespace device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextNVMe(IN CHAR16 *TextDeviceNode)
{ CHAR16 *NamespaceIdStr; CHAR16 *NamespaceUuidStr; NVME_NAMESPACE_DEVICE_PATH *Nvme; UINT8 *Uuid; UINTN Index; NamespaceIdStr = GetNextParamStr (&TextDeviceNode); NamespaceUuidStr = GetNextParamStr (&TextDeviceNode);...
tianocore/edk2
C++
Other
4,240
/* RETURN: 0 - Successfull reset. -1 - Timeout. */
static int mv88e1xxx_reset(struct cphy *cphy, int wait)
/* RETURN: 0 - Successfull reset. -1 - Timeout. */ static int mv88e1xxx_reset(struct cphy *cphy, int wait)
{ u32 ctl; int time_out = 1000; mdio_set_bit(cphy, MII_BMCR, BMCR_RESET); do { (void) simple_mdio_read(cphy, MII_BMCR, &ctl); ctl &= BMCR_RESET; if (ctl) udelay(1); } while (ctl && --time_out); return ctl ? -1 : 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Close an interface. Called from generic network layer when ifconfig down is run. */
static int netiucv_close(struct net_device *dev)
/* Close an interface. Called from generic network layer when ifconfig down is run. */ static int netiucv_close(struct net_device *dev)
{ struct netiucv_priv *priv = netdev_priv(dev); fsm_event(priv->fsm, DEV_EVENT_STOP, dev); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Clear the PWM interrupt flag of the PWM module. The */
void PWMIntFlagClear(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
/* Clear the PWM interrupt flag of the PWM module. The */ void PWMIntFlagClear(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
{ xASSERT(ulBase == PWMA_BASE); xASSERT(((ulChannel >= 0) || (ulChannel <= 3))); xASSERT((ulIntType == PWM_INT_CAP_BOTH) || (ulIntType == PWM_INT_CAP_FALL) || (ulIntType == PWM_INT_CAP_RISE) || (ulIntType == PWM_INT_PWM)); if (ulIntType == PWM_INT_PWM) { xHWREG(ulBase + PWM_PIIR)...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function sets this icon button to be the single icon button selected within its group. If another icon button was selected, it will be deselected. Both widgets will be redrawn if visible. */
void wtk_icon_button_select(struct wtk_icon_button *icon_button)
/* This function sets this icon button to be the single icon button selected within its group. If another icon button was selected, it will be deselected. Both widgets will be redrawn if visible. */ void wtk_icon_button_select(struct wtk_icon_button *icon_button)
{ struct wtk_icon_button *old_selected; Assert(icon_button); if (icon_button->group->selected == icon_button) { return; } old_selected = icon_button->group->selected; icon_button->group->selected = icon_button; if (old_selected) { win_redraw(old_selected->container); } win_redraw(icon_button->container); }
memfault/zero-to-main
C++
null
200
/* The time is "clock". old is what we think the time is. Adjust the value by a multiple of jiffies and add the delta to ntp. "delay" is an approximation how long the synchronization took. If the time correction is positive, then "delay" is subtracted from the time difference and only the remaining part is passed to nt...
static unsigned long long adjust_time(unsigned long long old, unsigned long long clock, unsigned long long delay)
/* The time is "clock". old is what we think the time is. Adjust the value by a multiple of jiffies and add the delta to ntp. "delay" is an approximation how long the synchronization took. If the time correction is positive, then "delay" is subtracted from the time difference and only the remaining part is passed to nt...
{ unsigned long long delta, ticks; struct timex adjust; if (clock > old) { delta = ticks = clock - old; delta = ticks = (delta < delay) ? 0 : delta - delay; delta -= do_div(ticks, CLK_TICKS_PER_JIFFY); adjust.offset = ticks * (1000000 / HZ); } else { delta = ticks = old - clock; delta -= do_div(ticks, C...
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function returns the ACPI table parser proc from the list of registered parsers. */
EFI_STATUS EFIAPI GetParser(IN UINT32 Signature, OUT PARSE_ACPI_TABLE_PROC *ParserProc)
/* This function returns the ACPI table parser proc from the list of registered parsers. */ EFI_STATUS EFIAPI GetParser(IN UINT32 Signature, OUT PARSE_ACPI_TABLE_PROC *ParserProc)
{ UINT32 Index; if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) { return EFI_INVALID_PARAMETER; } for (Index = 0; Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); Index++) { if (Signature == mTableParserList[Index].Signature) { *ParserProc...
tianocore/edk2
C++
Other
4,240
/* Internal worker to determine whether there is a BlockIo somewhere upon the device path specified. */
BOOLEAN InternalShellProtocolIsBlockIoPresent(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
/* Internal worker to determine whether there is a BlockIo somewhere upon the device path specified. */ BOOLEAN InternalShellProtocolIsBlockIoPresent(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
{ EFI_DEVICE_PATH_PROTOCOL *DevicePathCopy; EFI_STATUS Status; EFI_HANDLE Handle; Handle = NULL; DevicePathCopy = (EFI_DEVICE_PATH_PROTOCOL *)DevicePath; Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &DevicePathCopy, &Handle); if ((Handle != NULL) && (!EF...
tianocore/edk2
C++
Other
4,240
/* RETURNS: Percpu pointer to the allocated area on success, NULL on failure. */
void* __alloc_percpu(size_t size, size_t align)
/* RETURNS: Percpu pointer to the allocated area on success, NULL on failure. */ void* __alloc_percpu(size_t size, size_t align)
{ return pcpu_alloc(size, align, false); }
robutest/uclinux
C++
GPL-2.0
60
/* Function for transferring a SLIP escape byte (0xDB) when special bytes are transferred, that is 0xC0 and 0xDB. */
static uint32_t send_tx_byte_esc(void)
/* Function for transferring a SLIP escape byte (0xDB) when special bytes are transferred, that is 0xC0 and 0xDB. */ static uint32_t send_tx_byte_esc(void)
{ uint32_t err_code = app_uart_put(APP_SLIP_ESC); if (err_code == NRF_SUCCESS) { send_tx_byte = send_tx_byte_encoded; } return err_code; }
labapart/polymcu
C++
null
201
/* 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_On(LED3); while(1) { } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* 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_On(LED4); while (1) { } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This function returns the TLS/SSL client random data currently used in the specified TLS connection. */
VOID EFIAPI TlsGetClientRandom(IN VOID *Tls, IN OUT UINT8 *ClientRandom)
/* This function returns the TLS/SSL client random data currently used in the specified TLS connection. */ VOID EFIAPI TlsGetClientRandom(IN VOID *Tls, IN OUT UINT8 *ClientRandom)
{ CALL_VOID_CRYPTO_SERVICE (TlsGetClientRandom, (Tls, ClientRandom)); }
tianocore/edk2
C++
Other
4,240
/* Detects if IA32_MCG_CTL feature supported on current processor. */
BOOLEAN EFIAPI McgCtlSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
/* Detects if IA32_MCG_CTL feature supported on current processor. */ BOOLEAN EFIAPI McgCtlSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
{ MSR_IA32_MCG_CAP_REGISTER McgCap; if (!McaSupport (ProcessorNumber, CpuInfo, ConfigData)) { return FALSE; } McgCap.Uint64 = AsmReadMsr64 (MSR_IA32_MCG_CAP); return (McgCap.Bits.MCG_CTL_P == 1); }
tianocore/edk2
C++
Other
4,240
/* This function is called by the TCP/IP stack when an IP packet should be sent. It calls the function called low_level_output() to do the actual transmission of the packet. */
static err_t xemacpsif_output(struct netif *netif, struct pbuf *p, const ip_addr_t *ipaddr)
/* This function is called by the TCP/IP stack when an IP packet should be sent. It calls the function called low_level_output() to do the actual transmission of the packet. */ static err_t xemacpsif_output(struct netif *netif, struct pbuf *p, const ip_addr_t *ipaddr)
{ return etharp_output(netif, p, ipaddr); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Provide a separate write service for the feature control MSR in order to kick the VCPU out of VMXON or even guest mode on reset. This has to be done before writing any other state because forcibly leaving nested mode invalidates the VCPU state. */
static int kvm_put_msr_feature_control(X86CPU *cpu)
/* Provide a separate write service for the feature control MSR in order to kick the VCPU out of VMXON or even guest mode on reset. This has to be done before writing any other state because forcibly leaving nested mode invalidates the VCPU state. */ static int kvm_put_msr_feature_control(X86CPU *cpu)
{ struct { struct kvm_msrs info; struct kvm_msr_entry entry; } msr_data; kvm_msr_entry_set(&msr_data.entry, MSR_IA32_FEATURE_CONTROL, cpu->env.msr_ia32_feature_control); msr_data.info.nmsrs = 1; return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_MSRS, &msr_data); }
ve3wwg/teensy3_qemu
C++
Other
15
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI S3PciSegmentAndThenOr32(IN UINT64 Address, IN UINT32 AndData, IN UINT32 OrData)
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI S3PciSegmentAndThenOr32(IN UINT64 Address, IN UINT32 AndData, IN UINT32 OrData)
{ return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentAndThenOr32 (Address, AndData, OrData)); }
tianocore/edk2
C++
Other
4,240
/* Reads a 16 bit word from the EEPROM using the EERD register. */
s32 ixgbe_read_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 *data)
/* Reads a 16 bit word from the EEPROM using the EERD register. */ s32 ixgbe_read_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 *data)
{ u32 eerd; s32 status; hw->eeprom.ops.init_params(hw); if (offset >= hw->eeprom.word_size) { status = IXGBE_ERR_EEPROM; goto out; } eerd = (offset << IXGBE_EEPROM_READ_ADDR_SHIFT) + IXGBE_EEPROM_READ_REG_START; IXGBE_WRITE_REG(hw, IXGBE_EERD, eerd); status = ixgbe_poll_eeprom_eerd_done(hw); if (st...
robutest/uclinux
C++
GPL-2.0
60
/* Free volume structure (including the contents of directory cache and disk cache). */
VOID FatFreeVolume(IN FAT_VOLUME *Volume)
/* Free volume structure (including the contents of directory cache and disk cache). */ VOID FatFreeVolume(IN FAT_VOLUME *Volume)
{ if (Volume->CacheBuffer != NULL) { FreePool (Volume->CacheBuffer); } FatCleanupODirCache (Volume); FreePool (Volume); }
tianocore/edk2
C++
Other
4,240
/* Config the SPI peripheral according to the specified parameters in the spiConfig. */
void SPI_Config(SPI_T *spi, SPI_Config_T *spiConfig)
/* Config the SPI peripheral according to the specified parameters in the spiConfig. */ void SPI_Config(SPI_T *spi, SPI_Config_T *spiConfig)
{ spi->CTRL1 &= 0x3040; spi->CTRL1 |= (uint16_t)((uint32_t)spiConfig->direction | spiConfig->mode | spiConfig->length | spiConfig->polarity | spiConfig->phase | spiConfig->nss | spiConfig->baudrateDiv | spiConfig->firstBit); spi->CRCPOLY = spiConfig->...
pikasTech/PikaPython
C++
MIT License
1,403
/* Enables a basic capture on the designed capture unit. */
void HRTIM_SimpleCaptureStart(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx, uint32_t CaptureChannel)
/* Enables a basic capture on the designed capture unit. */ void HRTIM_SimpleCaptureStart(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx, uint32_t CaptureChannel)
{ __HRTIM_ENABLE(HRTIMx, TimerIdxToTimerId[TimerIdx]); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Unregisters a callback. Unregisters and disable a callback function implemented by the user. */
void quad_decoder_unregister_callback(enum quad_decoder_axis qdec)
/* Unregisters a callback. Unregisters and disable a callback function implemented by the user. */ void quad_decoder_unregister_callback(enum quad_decoder_axis qdec)
{ switch (qdec) { case QDEC_AXIS_X: quad_decoder0_callback = NULL; break; case QDEC_AXIS_Y: quad_decoder1_callback = NULL; break; case QDEC_AXIS_Z: quad_decoder2_callback = NULL; break; } }
memfault/zero-to-main
C++
null
200
/* This file is part of the Simba project. */
static int to_nibble(int ch)
/* This file is part of the Simba project. */ static int to_nibble(int ch)
{ ch = tolower(ch); if ((ch >= '0') && (ch <= '9')) { return (ch - '0'); } else if ((ch >= 'a') && (ch <= 'f')) { return (ch - 'a' + 10); } else { return (-EINVAL); } }
eerimoq/simba
C++
Other
337
/* Function for printing speed or cadence page4 data. */
static void page4_data_log(ant_bsc_page4_data_t const *p_page_data)
/* Function for printing speed or cadence page4 data. */ static void page4_data_log(ant_bsc_page4_data_t const *p_page_data)
{ LOG_PAGE4("%-30s %u.%03uV\r\n", "Battery voltage:", (unsigned int)p_page_data->coarse_bat_volt, (unsigned int)ANT_BSC_BAT_VOLTAGE_FRACTION_MV(p_page_data->fract_bat_volt)); LOG_PAGE4("%-30s %u\n\r", "Battery status:", (unsigned int)p_page_data->bat_status); }
labapart/polymcu
C++
null
201
/* Return the child objects buffer from AML Handle's object child list. */
EFI_STATUS AmlGetChildFromObjectChildList(IN EFI_AML_HANDLE *AmlParentHandle, IN EFI_AML_HANDLE *AmlHandle, OUT VOID **Buffer)
/* Return the child objects buffer from AML Handle's object child list. */ EFI_STATUS AmlGetChildFromObjectChildList(IN EFI_AML_HANDLE *AmlParentHandle, IN EFI_AML_HANDLE *AmlHandle, OUT VOID **Buffer)
{ EFI_STATUS Status; UINT8 *CurrentBuffer; CurrentBuffer = NULL; if ((AmlParentHandle->AmlByteEncoding->Attribute & AML_HAS_CHILD_OBJ) == 0) { *Buffer = NULL; return EFI_SUCCESS; } Status = AmlGetOffsetAfterLastOption (AmlParentHandle, &CurrentBuffer); if (EFI_ERROR (Status)) { return E...
tianocore/edk2
C++
Other
4,240
/* Check the status of the Tx buffer of the specified SPI port. */
xtBoolean SPIIsTxFull(unsigned long ulBase)
/* Check the status of the Tx buffer of the specified SPI port. */ xtBoolean SPIIsTxFull(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) ); return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_TX_FULL)? xtrue : xfalse); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* configure the PLL clock source selection and PLL multiply factor */
void rcu_pll_config(uint32_t pll_src, uint32_t pll_mul)
/* configure the PLL clock source selection and PLL multiply factor */ void rcu_pll_config(uint32_t pll_src, uint32_t pll_mul)
{ RCU_CFG0 &= ~(RCU_CFG0_PLLSEL | RCU_CFG0_PLLMF); RCU_CFG0 |= (pll_src | pll_mul); }
liuxuming/trochili
C++
Apache License 2.0
132
/* Wrap function to use free() to free allocated memory for certificates. */
VOID EFIAPI Pkcs7FreeSigners(IN UINT8 *Certs)
/* Wrap function to use free() to free allocated memory for certificates. */ VOID EFIAPI Pkcs7FreeSigners(IN UINT8 *Certs)
{ if (Certs == NULL) { return; } free (Certs); }
tianocore/edk2
C++
Other
4,240
/* Un-Register the Service B.1 and all its Characteristics... */
void service_b_1_3_remove(void)
/* Un-Register the Service B.1 and all its Characteristics... */ void service_b_1_3_remove(void)
{ bt_gatt_service_unregister(&service_b_1_3_svc); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* 6.. FMS Request Domain Download (Confirmed Service Id = 15) 6..1. Request Message Parameters */
static void dissect_ff_msg_fms_req_dom_download_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
/* 6.. FMS Request Domain Download (Confirmed Service Id = 15) 6..1. Request Message Parameters */ static void dissect_ff_msg_fms_req_dom_download_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
{ proto_tree *sub_tree; col_set_str(pinfo->cinfo, COL_INFO, "FMS Request Domain Download Request"); if (!tree) { return; } sub_tree = proto_tree_add_subtree(tree, tvb, offset, length, ett_ff_fms_req_dom_download_req, NULL, "FMS Request Domain Download Request"); proto_tree_add_it...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* brief Return Frequency of FlexSpi clock return Frequency of FlexSpi Clock */
uint32_t CLOCK_GetFlexspiClkFreq(void)
/* brief Return Frequency of FlexSpi clock return Frequency of FlexSpi Clock */ uint32_t CLOCK_GetFlexspiClkFreq(void)
{ uint32_t freq = 0U; switch (SYSCON->FLEXSPICLKSEL) { case 1U: freq = CLOCK_GetPll0OutFreq(); break; case 3U: freq = CLOCK_GetFroHfFreq(); break; case 5U: freq = CLOCK_GetPll1OutFreq(); break; case 6U: ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Must be called with user context, may sleep. */
void scsi_device_resume(struct scsi_device *sdev)
/* Must be called with user context, may sleep. */ void scsi_device_resume(struct scsi_device *sdev)
{ if(scsi_device_set_state(sdev, SDEV_RUNNING)) return; scsi_run_queue(sdev->request_queue); }
robutest/uclinux
C++
GPL-2.0
60
/* Get the captured data from a sample sequence. This function copies data from the specified sample sequence FIFO to a memory resident buffer. The number of samples available in the FIFO are copied into the buffer, which is assumed to be large enough to hold that many samples. This will only return the samples that ar...
unsigned long xADCDataGet(unsigned long ulBase, unsigned long *pulBuffer)
/* Get the captured data from a sample sequence. This function copies data from the specified sample sequence FIFO to a memory resident buffer. The number of samples available in the FIFO are copied into the buffer, which is assumed to be large enough to hold that many samples. This will only return the samples that ar...
{ unsigned long i = 0; unsigned long cnt = 0; unsigned long ulTmpReg = 0; xASSERT(ulBase == xADC0_BASE); xASSERT(pulBuffer != NULL); ulTmpReg = xHWREG(ulBase + AD_STAT); for(i = 0; i < 7; i++) { if( ulTmpReg & (1<<i) ) { cnt++; *pulBuff...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Find the AML NameSeg in the children of AmlParentNodeList. */
EFI_AML_NODE_LIST* AmlFindNodeInThis(IN UINT8 *NameSeg, IN EFI_AML_NODE_LIST *AmlParentNodeList, IN BOOLEAN Create)
/* Find the AML NameSeg in the children of AmlParentNodeList. */ EFI_AML_NODE_LIST* AmlFindNodeInThis(IN UINT8 *NameSeg, IN EFI_AML_NODE_LIST *AmlParentNodeList, IN BOOLEAN Create)
{ EFI_AML_NODE_LIST *CurrentAmlNodeList; LIST_ENTRY *CurrentLink; LIST_ENTRY *StartLink; EFI_AML_NODE_LIST *AmlNodeList; StartLink = &AmlParentNodeList->Children; CurrentLink = StartLink->ForwardLink; while (CurrentLink != StartLink) { CurrentAmlNodeList = EFI_AML_NODE_LIST_FROM_LI...
tianocore/edk2
C++
Other
4,240
/* if StartupRoutine >= 1M, then ASSERT. if StartupRoutine is not multiple of 4K, then ASSERT. */
VOID EFIAPI SendInitSipiSipiAllExcludingSelf(IN UINT32 StartupRoutine)
/* if StartupRoutine >= 1M, then ASSERT. if StartupRoutine is not multiple of 4K, then ASSERT. */ VOID EFIAPI SendInitSipiSipiAllExcludingSelf(IN UINT32 StartupRoutine)
{ SendInitIpiAllExcludingSelf (); MicroSecondDelay (PcdGet32 (PcdCpuInitIpiDelayInMicroSeconds)); SendStartupIpiAllExcludingSelf (StartupRoutine); if (!StandardSignatureIsAuthenticAMD ()) { MicroSecondDelay (200); SendStartupIpiAllExcludingSelf (StartupRoutine); } }
tianocore/edk2
C++
Other
4,240
/* print_parisc_devices - Print out a list of devices found in this system */
void print_parisc_devices(void)
/* print_parisc_devices - Print out a list of devices found in this system */ void print_parisc_devices(void)
{ for_each_padev(print_one_device, NULL); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check whether the ITflag is set or reset. */
uint16_t TMR_ReadIntFlag(TMR_T *tmr, TMR_INT_T flag)
/* Check whether the ITflag is set or reset. */ uint16_t TMR_ReadIntFlag(TMR_T *tmr, TMR_INT_T flag)
{ if (((tmr->STS & flag) != RESET) && ((tmr->DIEN & flag) != RESET)) { return SET; } else { return RESET; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Internal function gets the current position of opcode buffer. */
UINTN EFIAPI InternalHiiOpCodeHandlePosition(IN VOID *OpCodeHandle)
/* Internal function gets the current position of opcode buffer. */ UINTN EFIAPI InternalHiiOpCodeHandlePosition(IN VOID *OpCodeHandle)
{ return ((HII_LIB_OPCODE_BUFFER *)OpCodeHandle)->Position; }
tianocore/edk2
C++
Other
4,240
/* Reads the voltage and the current on a specified port. */
USBPD_StatusTypeDef USBPD_PWR_IF_ReadVA(uint8_t PortNum, uint16_t *pVoltage, uint16_t *pCurrent)
/* Reads the voltage and the current on a specified port. */ USBPD_StatusTypeDef USBPD_PWR_IF_ReadVA(uint8_t PortNum, uint16_t *pVoltage, uint16_t *pCurrent)
{ if (!USBPD_PORT_IsValid(PortNum)) { return USBPD_ERROR; } USBPD_StatusTypeDef ret = USBPD_ERROR; if (pVoltage != NULL) { *pVoltage = HW_IF_PWR_GetVoltage(PortNum); ret = USBPD_OK; } if (pCurrent != NULL) { *pCurrent = HW_IF_PWR_GetCurrent(PortNum); ret = USBPD_OK; } return re...
st-one/X-CUBE-USB-PD
C++
null
110
/* This function will add an alternate setting to an interface. */
rt_err_t rt_usbd_interface_add_altsetting(uintf_t intf, ualtsetting_t setting)
/* This function will add an alternate setting to an interface. */ rt_err_t rt_usbd_interface_add_altsetting(uintf_t intf, ualtsetting_t setting)
{ LOG_D("rt_usbd_interface_add_altsetting"); RT_ASSERT(intf != RT_NULL); RT_ASSERT(setting != RT_NULL); setting->intf_desc->bInterfaceNumber = intf->intf_num; rt_list_insert_before(&intf->setting_list, &setting->list); return RT_EOK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Note that anything more complicated than checking if no bits are toggling (including checking DQ5 for an error status) is tricky to get working correctly and is therefore not done (particulary with interleaved chips as each chip must be checked independantly of the others). */
static int __xipram chip_good(struct map_info *map, unsigned long addr, map_word expected)
/* Note that anything more complicated than checking if no bits are toggling (including checking DQ5 for an error status) is tricky to get working correctly and is therefore not done (particulary with interleaved chips as each chip must be checked independantly of the others). */ static int __xipram chip_good(struct m...
{ map_word oldd, curd; oldd = map_read(map, addr); curd = map_read(map, addr); return map_word_equal(map, oldd, curd) && map_word_equal(map, curd, expected); }
robutest/uclinux
C++
GPL-2.0
60
/* This function returns the pointer to first HOB in the list. */
VOID* EFIAPI PrePeiGetHobList(VOID)
/* This function returns the pointer to first HOB in the list. */ VOID* EFIAPI PrePeiGetHobList(VOID)
{ return (VOID *)ArmReadTpidrurw (); }
tianocore/edk2
C++
Other
4,240
/* Poll AP device for pending replies and send new messages. If either ap_poll_read or ap_poll_write returns -ENODEV unregister the device. Returns 0. */
static int ap_poll_queue(struct ap_device *ap_dev, unsigned long *flags)
/* Poll AP device for pending replies and send new messages. If either ap_poll_read or ap_poll_write returns -ENODEV unregister the device. Returns 0. */ static int ap_poll_queue(struct ap_device *ap_dev, unsigned long *flags)
{ int rc; rc = ap_poll_read(ap_dev, flags); if (rc) return rc; return ap_poll_write(ap_dev, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* SPI NSS pin high level in software mode. */
void spi_nss_internal_high(uint32_t spi_periph)
/* SPI NSS pin high level in software mode. */ void spi_nss_internal_high(uint32_t spi_periph)
{ SPI_CTL0(spi_periph) |= (uint32_t)SPI_CTL0_SWNSS; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* : this draws a line on the frame buffer */
void iot_epaper_draw_line(epaper_handle_t dev, int x0, int y0, int x1, int y1, int colored)
/* : this draws a line on the frame buffer */ void iot_epaper_draw_line(epaper_handle_t dev, int x0, int y0, int x1, int y1, int colored)
{ int dx = x1 - x0 >= 0 ? x1 - x0 : x0 - x1; int sx = x0 < x1 ? 1 : -1; int dy = y1 - y0 <= 0 ? y1 - y0 : y0 - y1; int sy = y0 < y1 ? 1 : -1; int err = dx + dy; epaper_dev_t* device = (epaper_dev_t*) dev; xSemaphoreTakeRecursive(device->spi_mux, portMAX_DELAY); while ((x0 != x1) && (y0 !...
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Check whether a channel group can be used by an application. */
__STATIC_INLINE bool is_app_group(nrf_ppi_channel_group_t group)
/* Check whether a channel group can be used by an application. */ __STATIC_INLINE bool is_app_group(nrf_ppi_channel_group_t group)
{ return ((NRF_PPI_ALL_APP_GROUPS_MASK & group_to_mask(group)) != 0); }
labapart/polymcu
C++
null
201
/* Get regulator driver private data. This call can be used in the consumer driver context when non API regulator specific functions need to be called. */
void* regulator_get_drvdata(struct regulator *regulator)
/* Get regulator driver private data. This call can be used in the consumer driver context when non API regulator specific functions need to be called. */ void* regulator_get_drvdata(struct regulator *regulator)
{ return regulator->rdev->reg_data; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function handles the control transfer in status phase */
static int ctrlreq_in_status_phase(struct usb_device *dev)
/* This function handles the control transfer in status phase */ static int ctrlreq_in_status_phase(struct usb_device *dev)
{ u16 csr; int result; csr = MUSB_CSR0_H_DIS_PING | MUSB_CSR0_H_REQPKT | MUSB_CSR0_H_STATUSPKT; writew(csr, &musbr->txcsr); result = wait_until_ep0_ready(dev, MUSB_CSR0_H_REQPKT); csr = readw(&musbr->txcsr); csr &= ~(MUSB_CSR0_RXPKTRDY | MUSB_CSR0_H_STATUSPKT); writew(csr, &musbr->txcsr); return result; }
EmcraftSystems/u-boot
C++
Other
181
/* Change protections to allow amo operations on non-Shub 1.1 systems. */
static enum xp_retval xpc_allow_amo_ops_sn2(struct amo *amos_page)
/* Change protections to allow amo operations on non-Shub 1.1 systems. */ static enum xp_retval xpc_allow_amo_ops_sn2(struct amo *amos_page)
{ enum xp_retval ret = xpSuccess; if (!enable_shub_wars_1_1()) ret = xp_expand_memprotect(ia64_tpa((u64)amos_page), PAGE_SIZE); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Return the current status of the integrated USB DMA interrupts. */
uint32_t USBDMAChannelIntStatus(uint32_t ui32Base)
/* Return the current status of the integrated USB DMA interrupts. */ uint32_t USBDMAChannelIntStatus(uint32_t ui32Base)
{ ASSERT(ui32Base == USB0_BASE); return(HWREG(ui32Base + USB_O_DMAINTR)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Prints firmware version and build time to serial console. */
STATIC VOID PrintFirmwareVersion(VOID)
/* Prints firmware version and build time to serial console. */ STATIC VOID PrintFirmwareVersion(VOID)
{ CHAR8 Buffer[100]; UINTN CharCount; CharCount = AsciiSPrint ( Buffer, sizeof (Buffer), "UEFI firmware (version %s built at %a on %a)\n\r", (CHAR16 *)PcdGetPtr (PcdFirmwareVersionString), __TIME__, __DATE__ ...
tianocore/edk2
C++
Other
4,240
/* Allocate a new object of kind specified by the name */
int nl_object_alloc_name(const char *kind, struct nl_object **result)
/* Allocate a new object of kind specified by the name */ int nl_object_alloc_name(const char *kind, struct nl_object **result)
{ struct nl_cache_ops *ops; ops = nl_cache_ops_lookup(kind); if (!ops) return -NLE_OPNOTSUPP; if (!(*result = nl_object_alloc(ops->co_obj_ops))) return -NLE_NOMEM; return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If changing the UART baud clock source (via */
void UARTConfigGetExpClk(uint32_t ui32Base, uint32_t ui32UARTClk, uint32_t *pui32Baud, uint32_t *pui32Config)
/* If changing the UART baud clock source (via */ void UARTConfigGetExpClk(uint32_t ui32Base, uint32_t ui32UARTClk, uint32_t *pui32Baud, uint32_t *pui32Config)
{ uint32_t ui32Int, ui32Frac; ASSERT(_UARTBaseValid(ui32Base)); ui32Int = HWREG(ui32Base + UART_O_IBRD); ui32Frac = HWREG(ui32Base + UART_O_FBRD); *pui32Baud = (ui32UARTClk * 4) / ((64 * ui32Int) + ui32Frac); if (HWREG(ui32Base + UART_O_CTL) & UART_CTL_HSE) { *pui32Baud *= 2; } ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Gets the total number of pages in the flash array. */
uint32_t flashcalw_get_page_count(void)
/* Gets the total number of pages in the flash array. */ uint32_t flashcalw_get_page_count(void)
{ return flashcalw_get_flash_size() / FLASH_PAGE_SIZE; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Check the status of the Tx buffer of the specified SPI port. */
xtBoolean xSPIIsTxFull(unsigned long ulBase)
/* Check the status of the Tx buffer of the specified SPI port. */ xtBoolean xSPIIsTxFull(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) || (ulBase == SPI3_BASE)); return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_TX_FULL)? xtrue : xfalse); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Clears or safeguards the OCREF3 signal on an external event. */
void TIM_ClearOC3Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
/* Clears or safeguards the OCREF3 signal on an external event. */ void TIM_ClearOC3Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
{ uint16_t tmpccmr2 = 0; assert_param(IS_TIM_LIST3_PERIPH(TIMx)); assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear)); tmpccmr2 = TIMx->CCMR2; tmpccmr2 &= (uint16_t)~TIM_CCMR2_OC3CE; tmpccmr2 |= TIM_OCClear; TIMx->CCMR2 = tmpccmr2; }
MaJerle/stm32f429
C++
null
2,036
/* Set I/O capability of the local device. Dynamically sets the I/O capability of the device */
ADI_BLER_RESULT adi_radio_SetIOCapability(const ADI_BLER_IO_CAP eIOCapability)
/* Set I/O capability of the local device. Dynamically sets the I/O capability of the device */ ADI_BLER_RESULT adi_radio_SetIOCapability(const ADI_BLER_IO_CAP eIOCapability)
{ ADI_BLER_RESULT bleResult; ADI_BLE_LOGEVENT(LOGID_CMD_BLESMP_SET_IO_CAPABILITY); ADI_BLE_RADIO_CMD_START(CMD_BLESMP_SET_IO_CAPABILITY); memcpy(&pBLERadio->cmdPkt[ADI_RADIO_CMD_HEADER_LEN], &eIOCapability, 1u); bleResult = bler_process_cmd(CMD_BLESMP_SET_IO_CAPABILITY, 1u, NULL, 0u); if(bleResu...
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Enable I2C slave independent baud rate of the specified I2C port. The */
void I2CSlaveBaudEnable(unsigned long ulBase)
/* Enable I2C slave independent baud rate of the specified I2C port. The */ void I2CSlaveBaudEnable(unsigned long ulBase)
{ xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE))); xHWREGB(ulBase + I2C_CON2) |= I2C_CON2_SBRC; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Return total size of values defined by a type string. */
size_t type_string_get_space_size(const char *type_str)
/* Return total size of values defined by a type string. */ size_t type_string_get_space_size(const char *type_str)
{ size_t size; for (size = 0; *type_str; type_str++) { switch (*type_str) { case 'b': size += 1; break; case 'w': size += 2; break; case 'd': size += 4; break; default: return 0; } } return size; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This routine marks a HBA's management interface as blocked. Once the HBA's management interface is marked as blocked, all the user space access to the HBA, whether they are from sysfs interface or libdfc interface will all be blocked. The HBA is set to block the management interface when the driver prepares the HBA ...
static void lpfc_block_mgmt_io(struct lpfc_hba *phba)
/* This routine marks a HBA's management interface as blocked. Once the HBA's management interface is marked as blocked, all the user space access to the HBA, whether they are from sysfs interface or libdfc interface will all be blocked. The HBA is set to block the management interface when the driver prepares the HBA ...
{ unsigned long iflag; spin_lock_irqsave(&phba->hbalock, iflag); phba->sli.sli_flag |= LPFC_BLOCK_MGMT_IO; spin_unlock_irqrestore(&phba->hbalock, iflag); }
robutest/uclinux
C++
GPL-2.0
60
/* This function is used for copying data between a data structure with big endian representation to local endianness. This function can be called with or without lock. */
void lpfc_sli_bemem_bcopy(void *srcp, void *destp, uint32_t cnt)
/* This function is used for copying data between a data structure with big endian representation to local endianness. This function can be called with or without lock. */ void lpfc_sli_bemem_bcopy(void *srcp, void *destp, uint32_t cnt)
{ uint32_t *src = srcp; uint32_t *dest = destp; uint32_t ldata; int i; for (i = 0; i < (int)cnt; i += sizeof(uint32_t)) { ldata = *src; ldata = be32_to_cpu(ldata); *dest = ldata; src++; dest++; } }
robutest/uclinux
C++
GPL-2.0
60
/* : Converted from XRenderCompositeDoublePoly to #cairo_trap_t. Carl D. Worth */
void _cairo_traps_init(cairo_traps_t *traps)
/* : Converted from XRenderCompositeDoublePoly to #cairo_trap_t. Carl D. Worth */ void _cairo_traps_init(cairo_traps_t *traps)
{ VG (VALGRIND_MAKE_MEM_UNDEFINED (traps, sizeof (cairo_traps_t))); traps->status = CAIRO_STATUS_SUCCESS; traps->maybe_region = 1; traps->is_rectilinear = 0; traps->is_rectangular = 0; traps->num_traps = 0; traps->traps_size = ARRAY_LENGTH (traps->traps_embedded); traps->traps = traps->t...
xboot/xboot
C++
MIT License
779
/* The author disclaims all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the author be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of c...
void Iso7816_CreateSimpleAtr(uint8_t *const attr, uint8_t *const attrLength)
/* The author disclaims all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the author be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of c...
{ attr[0] = 0x3B; uint8_t interfaceBytesPresence = 0; uint8_t historicalBytes[14] = "LUFA CCID Demo"; uint8_t historicalBytesLength = sizeof(historicalBytes); attr[1] = (interfaceBytesPresence << 4) + historicalBytesLength; memcpy(attr + 2, historicalBytes, historicalBytesLength); *attrLength = historicalBytes...
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Determines if the feature bit mask is in dependent CPU feature bit mask buffer. */
BOOLEAN IsBitMaskMatchCheck(IN UINT8 *FeatureMask, IN UINT8 *DependentBitMask)
/* Determines if the feature bit mask is in dependent CPU feature bit mask buffer. */ BOOLEAN IsBitMaskMatchCheck(IN UINT8 *FeatureMask, IN UINT8 *DependentBitMask)
{ UINTN Index; UINT8 *Data1; UINT8 *Data2; CPU_FEATURES_DATA *CpuFeaturesData; CpuFeaturesData = GetCpuFeaturesData (); Data1 = FeatureMask; Data2 = DependentBitMask; for (Index = 0; Index < CpuFeaturesData->BitMaskSize; Index++) { if (((*(Data1++)) & (*(Data2...
tianocore/edk2
C++
Other
4,240
/* IDL long NetrGetDcName( IDL wchar_t *logon_server, IDL wchar_t *domainname, IDL wchar_t *dcname, IDL }; */
static int netlogon_dissect_netrgetdcname_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
/* IDL long NetrGetDcName( IDL wchar_t *logon_server, IDL wchar_t *domainname, IDL wchar_t *dcname, IDL }; */ static int netlogon_dissect_netrgetdcname_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
{ offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, di, drep, NDR_POINTER_REF, "Server Handle", hf_netlogon_logonsrv_handle, 0); offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, di, drep, NDR_POINTER...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If Buffer was not allocated with a page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */
VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages)
/* If Buffer was not allocated with a page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */ VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages)
{ EFI_STATUS Status; ASSERT (Pages != 0); if (!gEmuThunk->Free (Buffer)) { Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages); ASSERT_EFI_ERROR (Status); } }
tianocore/edk2
C++
Other
4,240
/* Try to compile line on the stack as 'return <line>;'; on return, stack has either compiled chunk or original line (if compilation failed). */
static int addreturn(lua_State *L)
/* Try to compile line on the stack as 'return <line>;'; on return, stack has either compiled chunk or original line (if compilation failed). */ static int addreturn(lua_State *L)
{ lua_remove(L, -2); if (line[0] != '\0') lua_saveline(L, line); } else lua_pop(L, 2); return status; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Parameters and return values are exactly the same of pcap_setfilter(). */
static int pcap_setfilter_rpcap(pcap_t *fp, struct bpf_program *prog)
/* Parameters and return values are exactly the same of pcap_setfilter(). */ static int pcap_setfilter_rpcap(pcap_t *fp, struct bpf_program *prog)
{ struct pcap_rpcap *pr = fp->priv; if (!pr->rmt_capstarted) { if (install_bpf_program(fp, prog) == -1) return -1; return 0; } if (pcap_updatefilter_remote(fp, prog)) return -1; return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Internal function to draw vertical line of RGBA color with alpha blending. */
int _VLineAlpha(SDL_Surface *dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
/* Internal function to draw vertical line of RGBA color with alpha blending. */ int _VLineAlpha(SDL_Surface *dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
{ return (filledRectAlpha(dst, x, y1, x, y2, color)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Converts a generic messaging text device path node to messaging device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextMsg(IN CHAR16 *TextDeviceNode)
/* Converts a generic messaging text device path node to messaging device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextMsg(IN CHAR16 *TextDeviceNode)
{ return DevPathFromTextGenericPath (MESSAGING_DEVICE_PATH, TextDeviceNode); }
tianocore/edk2
C++
Other
4,240
/* Checks whether the swap function enable or disable. */
en_flag_status_t EFM_GetSwapStatus(void)
/* Checks whether the swap function enable or disable. */ en_flag_status_t EFM_GetSwapStatus(void)
{ return ((0UL == READ_REG32(bCM_EFM->FSWP_b.FSWP)) ? SET : RESET); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Description: For use by do_sendfile(). splice can easily emulate sendfile, but doing it in the application would incur an extra system call (splice in + splice out, as compared to just sendfile()). So this helper can splice directly through a process-private pipe. */
long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, size_t len, unsigned int flags)
/* Description: For use by do_sendfile(). splice can easily emulate sendfile, but doing it in the application would incur an extra system call (splice in + splice out, as compared to just sendfile()). So this helper can splice directly through a process-private pipe. */ long do_splice_direct(struct file *in, loff_t *p...
{ struct splice_desc sd = { .len = len, .total_len = len, .flags = flags, .pos = *ppos, .u.file = out, }; long ret; ret = splice_direct_to_actor(in, &sd, direct_splice_actor); if (ret > 0) *ppos = sd.pos; return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the integer divisor upon success or 0 on error. */
u32 omap2_clksel_get_divisor(struct clk *clk)
/* Returns the integer divisor upon success or 0 on error. */ u32 omap2_clksel_get_divisor(struct clk *clk)
{ u32 v; if (!clk->clksel_mask) return 0; v = __raw_readl(clk->clksel_reg) & clk->clksel_mask; v >>= __ffs(clk->clksel_mask); return omap2_clksel_to_divisor(clk, v); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function returns %1 in there are only @patt bytes in @buf, and %0 if something else was also found. */
static int check_pattern(const void *buf, uint8_t patt, int size)
/* This function returns %1 in there are only @patt bytes in @buf, and %0 if something else was also found. */ static int check_pattern(const void *buf, uint8_t patt, int size)
{ int i; for (i = 0; i < size; i++) if (((const uint8_t *)buf)[i] != patt) return 0; return 1; }
EmcraftSystems/u-boot
C++
Other
181
/* VmbusOnMsgDPC - DPC routine to handle messages from the hypervisior */
static void VmbusOnMsgDPC(struct hv_driver *drv)
/* VmbusOnMsgDPC - DPC routine to handle messages from the hypervisior */ static void VmbusOnMsgDPC(struct hv_driver *drv)
{ int cpu = smp_processor_id(); void *page_addr = gHvContext.synICMessagePage[cpu]; struct hv_message *msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; struct hv_message *copied; while (1) { if (msg->Header.MessageType == HvMessageTypeNone) { break; } else { copied = kmalloc(sizeof(*copie...
robutest/uclinux
C++
GPL-2.0
60
/* onenand_memory_bbt - create a memory based bad block table */
static int onenand_memory_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd)
/* onenand_memory_bbt - create a memory based bad block table */ static int onenand_memory_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd)
{ unsigned char data_buf[MAX_ONENAND_PAGESIZE]; return create_bbt(mtd, data_buf, bd, -1); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Configures the external input/output synchronization of the HRTIMx. */
void HRTIM_SynchronizationConfig(HRTIM_TypeDef *HRTIMx, HRTIM_SynchroCfgTypeDef *pSynchroCfg)
/* Configures the external input/output synchronization of the HRTIMx. */ void HRTIM_SynchronizationConfig(HRTIM_TypeDef *HRTIMx, HRTIM_SynchroCfgTypeDef *pSynchroCfg)
{ uint32_t HRTIM_mcr; assert_param(IS_HRTIM_SYNCINPUTSOURCE(pSynchroCfg->SyncInputSource)); assert_param(IS_HRTIM_SYNCOUTPUTSOURCE(pSynchroCfg->SyncOutputSource)); assert_param(IS_HRTIM_SYNCOUTPUTPOLARITY(pSynchroCfg->SyncOutputPolarity)); HRTIM_mcr = HRTIMx->HRTIM_MASTER.MCR; HRTIM_mcr &= ~(HRTIM_MCR_SYNC_...
remotemcu/remcu-chip-sdks
C++
null
436
/* encode/decode the User Defined Part of the Display */
static int aty128_decode_var(struct fb_var_screeninfo *var, struct aty128fb_par *par)
/* encode/decode the User Defined Part of the Display */ static int aty128_decode_var(struct fb_var_screeninfo *var, struct aty128fb_par *par)
{ int err; struct aty128_crtc crtc; struct aty128_pll pll; struct aty128_ddafifo fifo_reg; if ((err = aty128_var_to_crtc(var, &crtc, par))) return err; if ((err = aty128_var_to_pll(var->pixclock, &pll, par))) return err; if ((err = aty128_ddafifo(&fifo_reg, &pll, crtc.depth, par))) return err; par->crtc =...
robutest/uclinux
C++
GPL-2.0
60
/* The Receive Buffer Full IRQ is enabled in the following conditions: */
void sci_spi_rxi_isr(void)
/* The Receive Buffer Full IRQ is enabled in the following conditions: */ void sci_spi_rxi_isr(void)
{ FSP_CONTEXT_SAVE; IRQn_Type irq = R_FSP_CurrentIrqGet(); R_BSP_IrqStatusClear(irq); sci_spi_instance_ctrl_t * p_ctrl = (sci_spi_instance_ctrl_t *) R_FSP_IsrContextGet(irq); r_sci_spi_transmit(p_ctrl); if (p_ctrl->rx_count < p_ctrl->count) { p_ctrl->p_dest[p_ctrl->rx_count++] = p_ct...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Callback function which provided by user to remove one node in NetDestroyLinkList process. */
EFI_STATUS EFIAPI MnpDestoryChildEntry(IN LIST_ENTRY *Entry, IN VOID *Context)
/* Callback function which provided by user to remove one node in NetDestroyLinkList process. */ EFI_STATUS EFIAPI MnpDestoryChildEntry(IN LIST_ENTRY *Entry, IN VOID *Context)
{ MNP_INSTANCE_DATA *Instance; EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; ServiceBinding = (EFI_SERVICE_BINDING_PROTOCOL *)Context; Instance = CR (Entry, MNP_INSTANCE_DATA, InstEntry, MNP_INSTANCE_DATA_SIGNATURE); return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle); }
tianocore/edk2
C++
Other
4,240
/* regAdress: Address that has to be read length: Length of data block buffer: Buffer where data will be stored returns: number of bytes that have been read successfully NOTE! This is not always equal to length due to rx-Buffer overflow etc. */
int16_t readBlock(uint8_t regAddress, uint8_t length, uint8_t *buffer)
/* regAdress: Address that has to be read length: Length of data block buffer: Buffer where data will be stored returns: number of bytes that have been read successfully NOTE! This is not always equal to length due to rx-Buffer overflow etc. */ int16_t readBlock(uint8_t regAddress, uint8_t length, uint8_t *buffer)
{ int ret; if (buffer == NULL) { return 0; } ret = sensor_i2c_read(&(dps310_ctx.i2c), regAddress, buffer, length, I2C_OP_RETRIES); if (ret != 0) { return 0; } return length; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Change Logs: Date Author Notes lizhirui porting to ls2k */
u64 ata_id_n_sectors(u16 *id)
/* Change Logs: Date Author Notes lizhirui porting to ls2k */ u64 ata_id_n_sectors(u16 *id)
{ if (ata_id_has_lba(id)) { if (ata_id_has_lba48(id)) return ata_id_u64(id, ATA_ID_LBA48_SECTORS); else return ata_id_u32(id, ATA_ID_LBA_SECTORS); } else { return 0; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Change Logs: Date Author Notes supperthomas first version */
int main(void)
/* Change Logs: Date Author Notes supperthomas first version */ int main(void)
{ while (1) { rt_thread_mdelay(500); } return RT_EOK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* SPI3 interrupt handler. Clear the SPI interrupt flag and execute the callback function. The */
void xSPISSSet(unsigned long ulBase, unsigned long ulSSMode, unsigned long ulSlaveSel)
/* SPI3 interrupt handler. Clear the SPI interrupt flag and execute the callback function. The */ void xSPISSSet(unsigned long ulBase, unsigned long ulSSMode, unsigned long ulSlaveSel)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) ); xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0) || (ulSlaveSel == SPI_SS1) || (ulSlaveSel == SPI_SS0_SS1)); xHWREG(ulBase + SPI_SSR) |= ulSSMode; xHWREG(ulBase + SPI_SSR) &= ~SPI_SS...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Switch main clock source selection to external Xtal/Bypass. */
void pmc_switch_mainck_to_xtal(uint32_t ul_bypass, uint32_t ul_xtal_startup_time)
/* Switch main clock source selection to external Xtal/Bypass. */ void pmc_switch_mainck_to_xtal(uint32_t ul_bypass, uint32_t ul_xtal_startup_time)
{ if (ul_bypass) { PMC->CKGR_MOR = (PMC->CKGR_MOR & ~CKGR_MOR_MOSCXTEN) | CKGR_MOR_KEY_PASSWD | CKGR_MOR_MOSCXTBY | CKGR_MOR_MOSCSEL; } else { PMC->CKGR_MOR = (PMC->CKGR_MOR & ~CKGR_MOR_MOSCXTBY) | CKGR_MOR_KEY_PASSWD | CKGR_MOR_MOSCXTEN | CKGR_MOR_MOSCXTST(ul_xtal_startup_time); while (!(PMC->P...
remotemcu/remcu-chip-sdks
C++
null
436
/* So __pagevec_release() will drain those queues here. __pagevec_lru_add() and __pagevec_lru_add_active() call release_pages() directly to avoid mutual recursion. */
void __pagevec_release(struct pagevec *pvec)
/* So __pagevec_release() will drain those queues here. __pagevec_lru_add() and __pagevec_lru_add_active() call release_pages() directly to avoid mutual recursion. */ void __pagevec_release(struct pagevec *pvec)
{ lru_add_drain(); release_pages(pvec->pages, pagevec_count(pvec), pvec->cold); pagevec_reinit(pvec); }
robutest/uclinux
C++
GPL-2.0
60
/* Handler for Button 1 rising edge interrupt. Set button1 event flag (g_button_event). */
static void button_handler(uint32_t id, uint32_t mask)
/* Handler for Button 1 rising edge interrupt. Set button1 event flag (g_button_event). */ static void button_handler(uint32_t id, uint32_t mask)
{ if ((PUSH_BUTTON_ID == id) && (PUSH_BUTTON_PIN_MSK == mask)) { g_button_event = 1; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* xprt_disconnect_done - mark a transport as disconnected @xprt: transport to flag for disconnect */
void xprt_disconnect_done(struct rpc_xprt *xprt)
/* xprt_disconnect_done - mark a transport as disconnected @xprt: transport to flag for disconnect */ void xprt_disconnect_done(struct rpc_xprt *xprt)
{ dprintk("RPC: disconnected transport %p\n", xprt); spin_lock_bh(&xprt->transport_lock); xprt_clear_connected(xprt); xprt_wake_pending_tasks(xprt, -EAGAIN); spin_unlock_bh(&xprt->transport_lock); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Create an absolute path of given path by prepending the CWD environment variable. */
static int create_absolute_path(char *dst_p, const char *path_p)
/* Create an absolute path of given path by prepending the CWD environment variable. */ static int create_absolute_path(char *dst_p, const char *path_p)
{ ssize_t res; const char *cwd_p; const char *slash_p; cwd_p = ""; slash_p = ""; if (path_p[0] != '/') { cwd_p = thrd_get_env("CWD"); if ((cwd_p == NULL) || (cwd_p[0] == '\0')) { cwd_p = "/"; } if (cwd_p[strlen(cwd_p) - 1] != '/') { slash_p...
eerimoq/simba
C++
Other
337