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
/* sys_pipe() is the normal C calling standard for creating a pipe. It's not the way Unix traditionally does this, though. */
asmlinkage int sys_sh_pipe(unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7, struct pt_regs __regs)
/* sys_pipe() is the normal C calling standard for creating a pipe. It's not the way Unix traditionally does this, though. */ asmlinkage int sys_sh_pipe(unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7, struct pt_regs __regs)
{ struct pt_regs *regs = RELOC_HIDE(&__regs, 0); int fd[2]; int error; error = do_pipe_flags(fd, 0); if (!error) { regs->regs[1] = fd[1]; return fd[0]; } return error; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Handles an incoming ATT error response for the specified discover-all-descriptors proc. */
static void ble_gattc_disc_all_dscs_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
/* Handles an incoming ATT error response for the specified discover-all-descriptors proc. */ static void ble_gattc_disc_all_dscs_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
{ ble_gattc_dbg_assert_proc_not_inserted(proc); if (status == BLE_HS_ATT_ERR(BLE_ATT_ERR_ATTR_NOT_FOUND)) { status = BLE_HS_EDONE; } ble_gattc_disc_all_dscs_cb(proc, status, att_handle, NULL); }
Nicholas3388/LuaNode
C++
Other
1,055
/* function to register callback to be called when device gets disconnected */
void register_ble_disconnected_event_cb(ble_gap_event_callback_t disconnected_cb_fn)
/* function to register callback to be called when device gets disconnected */ void register_ble_disconnected_event_cb(ble_gap_event_callback_t disconnected_cb_fn)
{ ble_disconnected_cb = disconnected_cb_fn; }
remotemcu/remcu-chip-sdks
C++
null
436
/* param base UART peripheral base address. param handle UART handle pointer. param xfer UART eDMA transfer structure. See #uart_transfer_t. retval kStatus_Success if succeeded; otherwise failed. retval kStatus_UART_TxBusy Previous transfer ongoing. retval kStatus_InvalidArgument Invalid argument. */
status_t UART_SendEDMA(UART_Type *base, uart_edma_handle_t *handle, uart_transfer_t *xfer)
/* param base UART peripheral base address. param handle UART handle pointer. param xfer UART eDMA transfer structure. See #uart_transfer_t. retval kStatus_Success if succeeded; otherwise failed. retval kStatus_UART_TxBusy Previous transfer ongoing. retval kStatus_InvalidArgument Invalid argument. */ status_t UART_SendEDMA(UART_Type *base, uart_edma_handle_t *handle, uart_transfer_t *xfer)
{ assert(handle); assert(handle->txEdmaHandle); assert(xfer); assert(xfer->data); assert(xfer->dataSize); edma_transfer_config_t xferConfig; status_t status; if (kUART_TxBusy == handle->txState) { status = kStatus_UART_TxBusy; } else { handle->txState = kUART_TxBusy; handle->txDataSizeAll = xfer->dataSize; EDMA_PrepareTransfer(&xferConfig, xfer->data, sizeof(uint8_t), (void *)UART_GetDataRegisterAddress(base), sizeof(uint8_t), sizeof(uint8_t), xfer->dataSize, kEDMA_MemoryToPeripheral); handle->nbytes = sizeof(uint8_t); EDMA_SubmitTransfer(handle->txEdmaHandle, &xferConfig); EDMA_StartTransfer(handle->txEdmaHandle); UART_EnableTxDMA(base, true); status = kStatus_Success; } return status; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* If Alignment is not a power of two and Alignment is not zero, then ASSERT(). If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). */
VOID* EFIAPI AllocateAlignedReservedPages(IN UINTN Pages, IN UINTN Alignment)
/* If Alignment is not a power of two and Alignment is not zero, then ASSERT(). If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). */ VOID* EFIAPI AllocateAlignedReservedPages(IN UINTN Pages, IN UINTN Alignment)
{ VOID *Buffer; Buffer = InternalAllocateAlignedPages (EfiReservedMemoryType, Pages, Alignment); if (Buffer != NULL) { MemoryProfileLibRecord ( (PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0), MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RESERVED_PAGES, EfiReservedMemoryType, Buffer, EFI_PAGES_TO_SIZE (Pages), NULL ); } return Buffer; }
tianocore/edk2
C++
Other
4,240
/* Get the target settings for the bus mode. */
VOID SdGetTargetBusMode(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN UINT8 *SwitchQueryResp, IN BOOLEAN IsInUhsI, OUT SD_MMC_BUS_SETTINGS *BusMode)
/* Get the target settings for the bus mode. */ VOID SdGetTargetBusMode(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN UINT8 *SwitchQueryResp, IN BOOLEAN IsInUhsI, OUT SD_MMC_BUS_SETTINGS *BusMode)
{ BusMode->BusTiming = SdGetTargetBusTiming (Private, SlotIndex, SwitchQueryResp[13], IsInUhsI); BusMode->BusWidth = SdGetTargetBusWidth (Private, SlotIndex, BusMode->BusTiming); BusMode->ClockFreq = SdGetTargetBusClockFreq (Private, SlotIndex, BusMode->BusTiming); BusMode->DriverStrength = SdGetTargetDriverStrength (Private, SlotIndex, SwitchQueryResp[9], BusMode->BusTiming); }
tianocore/edk2
C++
Other
4,240
/* Allocate new abstract address object based on a binary address. */
struct nl_addr* nl_addr_build(int family, void *buf, size_t size)
/* Allocate new abstract address object based on a binary address. */ struct nl_addr* nl_addr_build(int family, void *buf, size_t size)
{ struct nl_addr *addr; addr = nl_addr_alloc(size); if (!addr) return NULL; addr->a_family = family; addr->a_len = size; addr->a_prefixlen = size*8; if (size) memcpy(addr->a_addr, buf, size); return addr; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Enables USB related GPIOs to perform their USB function. */
void USBGPIOEnable(void)
/* Enables USB related GPIOs to perform their USB function. */ void USBGPIOEnable(void)
{ EALLOW; GpioCtrlRegs.GPBLOCK.all = 0x00000000; GpioCtrlRegs.GPBAMSEL.bit.GPIO42 = 1; GpioCtrlRegs.GPBAMSEL.bit.GPIO43 = 1; GpioCtrlRegs.GPBDIR.bit.GPIO46 = 0; GpioCtrlRegs.GPBDIR.bit.GPIO47 = 0; GpioCtrlRegs.GPDGMUX2.bit.GPIO120 = 3; GpioCtrlRegs.GPDMUX2.bit.GPIO120 = 3; GpioCtrlRegs.GPDGMUX2.bit.GPIO121 = 3; GpioCtrlRegs.GPDMUX2.bit.GPIO121 = 3; EDIS; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enable the MDIO bit in MAC control register When not called from an interrupt-handler, access to the PHY must be protected by a spinlock. */
static void enable_mdi(void)
/* Enable the MDIO bit in MAC control register When not called from an interrupt-handler, access to the PHY must be protected by a spinlock. */ static void enable_mdi(void)
{ unsigned long ctl; ctl = at91_emac_read(AT91_EMAC_CTL); at91_emac_write(AT91_EMAC_CTL, ctl | AT91_EMAC_MPE); }
robutest/uclinux
C++
GPL-2.0
60
/* XXX - should we use g_strdup_sprintf() here, so we're not limited by XCEPT_BUFFER_SIZE? We could then just use this to generate formatted messages. */
WS_NORETURN void except_throwf(long group, long code, const char *fmt,...)
/* XXX - should we use g_strdup_sprintf() here, so we're not limited by XCEPT_BUFFER_SIZE? We could then just use this to generate formatted messages. */ WS_NORETURN void except_throwf(long group, long code, const char *fmt,...)
{ char *buf = (char *)except_alloc(XCEPT_BUFFER_SIZE); va_list vl; va_start (vl, fmt); g_vsnprintf(buf, XCEPT_BUFFER_SIZE, fmt, vl); va_end (vl); except_throwd(group, code, buf, buf); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The initial reference count of new nodes is 1. Use the */
int mxmlGetRefCount(mxml_node_t *node)
/* The initial reference count of new nodes is 1. Use the */ int mxmlGetRefCount(mxml_node_t *node)
{ if (!node) return (0); return (node->ref_count); }
DC-SWAT/DreamShell
C++
null
404
/* Called from _init_clocks(). Populates the @oh OCP slave interface clock pointers. Returns 0 on success or -EINVAL on error. */
static int _init_interface_clks(struct omap_hwmod *oh)
/* Called from _init_clocks(). Populates the @oh OCP slave interface clock pointers. Returns 0 on success or -EINVAL on error. */ static int _init_interface_clks(struct omap_hwmod *oh)
{ struct omap_hwmod_ocp_if *os; struct clk *c; int i; int ret = 0; if (oh->slaves_cnt == 0) return 0; for (i = 0, os = *oh->slaves; i < oh->slaves_cnt; i++, os++) { if (!os->clkdev_con_id) continue; c = clk_get_sys(os->clkdev_dev_id, os->clkdev_con_id); WARN(IS_ERR(c), "omap_hwmod: %s: cannot clk_get " "interface_clk %s.%s\n", oh->name, os->clkdev_dev_id, os->clkdev_con_id); if (IS_ERR(c)) ret = -EINVAL; os->_clk = c; } return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Farm this off into its own function because it could be more complex once multiple partners support is added. This function should be called with the hvcsd->lock held. */
static int hvcs_has_pi(struct hvcs_struct *hvcsd)
/* Farm this off into its own function because it could be more complex once multiple partners support is added. This function should be called with the hvcsd->lock held. */ static int hvcs_has_pi(struct hvcs_struct *hvcsd)
{ if ((!hvcsd->p_unit_address) || (!hvcsd->p_partition_ID)) return 0; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Retrieve ordinal number of the given SERCOM USART hardware instance. */
uint8_t _usart_sync_get_hardware_index(const struct _usart_sync_device *const device)
/* Retrieve ordinal number of the given SERCOM USART hardware instance. */ uint8_t _usart_sync_get_hardware_index(const struct _usart_sync_device *const device)
{ return _sercom_get_hardware_index(device->hw); }
eclipse-threadx/getting-started
C++
Other
310
/* Handler for reinforced safety watchdog interrupt.RSWDT and WDT are the same as the interrupt number. */
void WDT_Handler(void)
/* Handler for reinforced safety watchdog interrupt.RSWDT and WDT are the same as the interrupt number. */ void WDT_Handler(void)
{ puts("Enter reinforced safety watchdog interrupt.\r"); rswdt_get_status(RSWDT); rswdt_restart(RSWDT); puts("The reinforced safety watchdog timer was restarted.\r"); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Caution: This function may receive untrusted input. PE/COFF image is external input, so this function will validate its data structure within this image buffer before use. */
EFI_STATUS HashPeImageByType(IN UINT8 *AuthData, IN UINTN AuthDataSize)
/* Caution: This function may receive untrusted input. PE/COFF image is external input, so this function will validate its data structure within this image buffer before use. */ EFI_STATUS HashPeImageByType(IN UINT8 *AuthData, IN UINTN AuthDataSize)
{ UINT8 Index; for (Index = 0; Index < HASHALG_MAX; Index++) { if ((*(AuthData + 1) & TWO_BYTE_ENCODE) != TWO_BYTE_ENCODE) { continue; } if (AuthDataSize < 32 + mHash[Index].OidLength) { return EFI_UNSUPPORTED; } if (CompareMem (AuthData + 32, mHash[Index].OidValue, mHash[Index].OidLength) == 0) { break; } } if (Index == HASHALG_MAX) { return EFI_UNSUPPORTED; } if (!HashPeImage (Index)) { return EFI_UNSUPPORTED; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Update the BAT table entry with the new file offset, and the new entry state */
static void vhdx_update_bat_table_entry(BlockDriverState *bs, BDRVVHDXState *s, VHDXSectorInfo *sinfo, uint64_t *bat_entry_le, uint64_t *bat_offset, int state)
/* Update the BAT table entry with the new file offset, and the new entry state */ static void vhdx_update_bat_table_entry(BlockDriverState *bs, BDRVVHDXState *s, VHDXSectorInfo *sinfo, uint64_t *bat_entry_le, uint64_t *bat_offset, int state)
{ s->bat[sinfo->bat_idx] = sinfo->file_offset; s->bat[sinfo->bat_idx] |= state & VHDX_BAT_STATE_BIT_MASK; *bat_entry_le = cpu_to_le64(s->bat[sinfo->bat_idx]); *bat_offset = s->bat_offset + sinfo->bat_idx * sizeof(VHDXBatEntry); }
ve3wwg/teensy3_qemu
C++
Other
15
/* Internal function to add PciCfg write opcode to the table. */
EFI_STATUS BootScriptWritePciCfgWrite(IN VA_LIST Marker)
/* Internal function to add PciCfg write opcode to the table. */ EFI_STATUS BootScriptWritePciCfgWrite(IN VA_LIST Marker)
{ S3_BOOT_SCRIPT_LIB_WIDTH Width; UINT64 Address; UINTN Count; UINT8 *Buffer; Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH); Address = VA_ARG (Marker, UINT64); Count = VA_ARG (Marker, UINTN); Buffer = VA_ARG (Marker, UINT8 *); return S3BootScriptSavePciCfgWrite (Width, Address, Count, Buffer); }
tianocore/edk2
C++
Other
4,240
/* param base CMP peripheral base address. param mask Mask value for interrupts. See "_cmp_interrupt_enable". */
void CMP_DisableInterrupts(CMP_Type *base, uint32_t mask)
/* param base CMP peripheral base address. param mask Mask value for interrupts. See "_cmp_interrupt_enable". */ void CMP_DisableInterrupts(CMP_Type *base, uint32_t mask)
{ uint8_t tmp8 = (uint8_t)(base->SCR & ~(CMP_SCR_CFR_MASK | CMP_SCR_CFF_MASK)); if (0U != ((uint32_t)kCMP_OutputRisingInterruptEnable & mask)) { tmp8 &= ~(uint8_t)CMP_SCR_IER_MASK; } if (0U != ((uint32_t)kCMP_OutputFallingInterruptEnable & mask)) { tmp8 &= ~(uint8_t)CMP_SCR_IEF_MASK; } base->SCR = tmp8; }
eclipse-threadx/getting-started
C++
Other
310
/* Account multiple ticks of idle time. @ticks: number of stolen ticks */
void account_idle_ticks(unsigned long ticks)
/* Account multiple ticks of idle time. @ticks: number of stolen ticks */ void account_idle_ticks(unsigned long ticks)
{ account_idle_time(jiffies_to_cputime(ticks)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Allocate the memory for a spinlock and initialize it. */
acpi_status acpi_os_create_lock(acpi_spinlock *handle)
/* Allocate the memory for a spinlock and initialize it. */ acpi_status acpi_os_create_lock(acpi_spinlock *handle)
{ spin_lock_init(*handle); return AE_OK; }
robutest/uclinux
C++
GPL-2.0
60
/* VTData-Request ::= SEQUENCE { vtSessionIdentifier Unsigned8, vtNewData OCTET STRING, vtDataFlag Unsigned (0..1) } */
static guint fVtDataRequest(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
/* VTData-Request ::= SEQUENCE { vtSessionIdentifier Unsigned8, vtNewData OCTET STRING, vtDataFlag Unsigned (0..1) } */ static guint fVtDataRequest(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
{ offset= fApplicationTypes(tvb, pinfo, tree, offset, "VT Session ID: "); offset = fApplicationTypes(tvb, pinfo, tree, offset, "VT New Data: "); return fApplicationTypes(tvb, pinfo, tree, offset, "VT Data Flag: "); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set the msi run time range. Can only be called when MSI is either OFF, or when MSI is on */
void rcc_set_msi_range(uint32_t msi_range)
/* Set the msi run time range. Can only be called when MSI is either OFF, or when MSI is on */ void rcc_set_msi_range(uint32_t msi_range)
{ uint32_t reg = RCC_CR; reg &= ~(RCC_CR_MSIRANGE_MASK << RCC_CR_MSIRANGE_SHIFT); reg |= msi_range << RCC_CR_MSIRANGE_SHIFT; RCC_CR = reg | RCC_CR_MSIRGSEL; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* This call does not sleep therefore it can not guarantee all CPU's that are in middle of receiving packets will see the new packet type (until the next received packet). */
void dev_add_pack(struct packet_type *pt)
/* This call does not sleep therefore it can not guarantee all CPU's that are in middle of receiving packets will see the new packet type (until the next received packet). */ void dev_add_pack(struct packet_type *pt)
{ int hash; spin_lock_bh(&ptype_lock); if (pt->type == htons(ETH_P_ALL)) list_add_rcu(&pt->list, &ptype_all); else { hash = ntohs(pt->type) & PTYPE_HASH_MASK; list_add_rcu(&pt->list, &ptype_base[hash]); } spin_unlock_bh(&ptype_lock); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Receive a sequence of bytes from a SPI device. All bytes sent out on SPI bus are sent as value 0. */
status_code_t spi_read_packet(volatile void *spi, uint8_t *data, size_t len)
/* Receive a sequence of bytes from a SPI device. All bytes sent out on SPI bus are sent as value 0. */ status_code_t spi_read_packet(volatile void *spi, uint8_t *data, size_t len)
{ while (len) { spi_write_single(spi, CONFIG_SPI_MASTER_DUMMY); while (!spi_is_rx_full(spi)) { } *data = SPDR; data++; len--; } return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* This API is used to set the reset interrupt in the register 0x21 bit 7. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_rst_intr(u8 rst_intr_u8)
/* This API is used to set the reset interrupt in the register 0x21 bit 7. */ BMA2x2_RETURN_FUNCTION_TYPE bma2x2_rst_intr(u8 rst_intr_u8)
{ u8 data_u8 = BMA2x2_INIT_VALUE; BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR; if (p_bma2x2 == BMA2x2_NULL) { return E_BMA2x2_NULL_PTR; } else { com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC (p_bma2x2->dev_addr, BMA2x2_RESET_INTR_REG, &data_u8, BMA2x2_GEN_READ_WRITE_LENGTH); data_u8 = BMA2x2_SET_BITSLICE (data_u8, BMA2x2_RESET_INTR, rst_intr_u8); com_rslt += bma2x2_write_reg(BMA2x2_RESET_INTR_REG, &data_u8, BMA2x2_GEN_READ_WRITE_LENGTH); } return com_rslt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Finish up a transmit by completing the process of sending data and disabling the interrupt. */
static void smartcard_emvsim_CompleteSendData(EMVSIM_Type *base, smartcard_context_t *context)
/* Finish up a transmit by completing the process of sending data and disabling the interrupt. */ static void smartcard_emvsim_CompleteSendData(EMVSIM_Type *base, smartcard_context_t *context)
{ assert((NULL != context)); base->INT_MASK |= (EMVSIM_INT_MASK_ETC_IM_MASK | EMVSIM_INT_MASK_TDT_IM_MASK); base->CTRL &= ~EMVSIM_CTRL_XMT_EN_MASK; base->RX_STATUS = EMVSIM_RX_STATUS_RX_DATA_MASK; base->CTRL |= EMVSIM_CTRL_RCV_EN_MASK; context->xIsBusy = false; context->transferState = kSMARTCARD_IdleState; context->xSize = 0u; if (NULL != context->transferCallback) { context->transferCallback(context, context->transferCallbackParam); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base GPIO base pointer. param pin GPIO port pin number. param output GPIOpin output logic level. */
void GPIO_PinWrite(GPIO_Type *base, uint32_t pin, uint8_t output)
/* param base GPIO base pointer. param pin GPIO port pin number. param output GPIOpin output logic level. */ void GPIO_PinWrite(GPIO_Type *base, uint32_t pin, uint8_t output)
{ assert(pin < 32U); if (output == 0U) { base->DR &= ~(1UL << pin); } else { base->DR |= (1UL << pin); } }
eclipse-threadx/getting-started
C++
Other
310
/* Call generate_mtdparts to process all devices and generate corresponding mtdparts string, save it in mtdparts environment variable. */
static int generate_mtdparts_save(char *buf, u32 buflen)
/* Call generate_mtdparts to process all devices and generate corresponding mtdparts string, save it in mtdparts environment variable. */ static int generate_mtdparts_save(char *buf, u32 buflen)
{ int ret; ret = generate_mtdparts(buf, buflen); if ((buf[0] != '\0') && (ret == 0)) setenv("mtdparts", buf); else setenv("mtdparts", NULL); return ret; }
EmcraftSystems/u-boot
C++
Other
181
/* Start up processing on an ARM based AAC adapter */
static void aac_sa_start_adapter(struct aac_dev *dev)
/* Start up processing on an ARM based AAC adapter */ static void aac_sa_start_adapter(struct aac_dev *dev)
{ struct aac_init *init; init = dev->init; init->HostElapsedSeconds = cpu_to_le32(get_seconds()); sa_sync_cmd(dev, INIT_STRUCT_BASE_ADDRESS, (u32)(ulong)dev->init_pa, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL); }
robutest/uclinux
C++
GPL-2.0
60
/* subscribe callback - allow output to rawmidi device */
static int snd_virmidi_subscribe(void *private_data, struct snd_seq_port_subscribe *info)
/* subscribe callback - allow output to rawmidi device */ static int snd_virmidi_subscribe(void *private_data, struct snd_seq_port_subscribe *info)
{ struct snd_virmidi_dev *rdev; rdev = private_data; if (!try_module_get(rdev->card->module)) return -EFAULT; rdev->flags |= SNDRV_VIRMIDI_SUBSCRIBE; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Defines the Own Address of the CEC device. */
void CEC_OwnAddressConfig(uint8_t CEC_OwnAddress)
/* Defines the Own Address of the CEC device. */ void CEC_OwnAddressConfig(uint8_t CEC_OwnAddress)
{ uint32_t tmp =0x00; assert_param(IS_CEC_ADDRESS(CEC_OwnAddress)); tmp = 1 <<(CEC_OwnAddress + 16); CEC->CFGR |= tmp; }
avem-labs/Avem
C++
MIT License
1,752
/* The constructor function caches the PCI Express Base Address and creates a Set Virtual Address Map event to convert physical address to virtual addresses. */
EFI_STATUS EFIAPI DxeRuntimePciExpressLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The constructor function caches the PCI Express Base Address and creates a Set Virtual Address Map event to convert physical address to virtual addresses. */ EFI_STATUS EFIAPI DxeRuntimePciExpressLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; mDxeRuntimePciExpressLibPciExpressBaseAddress = (UINTN)PcdGet64 (PcdPciExpressBaseAddress); mDxeRuntimePciExpressLibPciExpressBaseSize = (UINTN)PcdGet64 (PcdPciExpressBaseSize); Status = gBS->CreateEvent ( EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE, TPL_NOTIFY, DxeRuntimePciExpressLibVirtualNotify, NULL, &mDxeRuntimePciExpressLibVirtualNotifyEvent ); ASSERT_EFI_ERROR (Status); return Status; }
tianocore/edk2
C++
Other
4,240
/* Returns 1 if no transfer is currently pending on the given channel; otherwise, returns 0. */
unsigned char AC97C_IsFinished(unsigned char channel)
/* Returns 1 if no transfer is currently pending on the given channel; otherwise, returns 0. */ unsigned char AC97C_IsFinished(unsigned char channel)
{ SANITY_CHECK(channel <= AC97C_CHANNEL_B_TRANSMIT); if (ac97c.transfers[channel].numSamples > 0) { return 0; } else { return 1; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Translates boot script width and address stride to MDE library interface. */
EFI_STATUS BuildLoopData(IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, OUT UINTN *AddressStride, OUT UINTN *BufferStride)
/* Translates boot script width and address stride to MDE library interface. */ EFI_STATUS BuildLoopData(IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, OUT UINTN *AddressStride, OUT UINTN *BufferStride)
{ UINTN AlignMask; if (Width >= S3BootScriptWidthMaximum) { return EFI_INVALID_PARAMETER; } *AddressStride = (UINT32)(1 << (Width & 0x03)); *BufferStride = *AddressStride; AlignMask = *AddressStride - 1; if ((Address & AlignMask) != 0) { return EFI_INVALID_PARAMETER; } if ((Width >= S3BootScriptWidthFifoUint8) && (Width <= S3BootScriptWidthFifoUint64)) { *AddressStride = 0; } if ((Width >= S3BootScriptWidthFillUint8) && (Width <= S3BootScriptWidthFillUint64)) { *BufferStride = 0; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Configures the ADCx external trigger for injected channels conversion. */
void ADC_ExternalTrigInjectedConvConfig(ADC_TypeDef *ADCx, uint32_t ADC_ExternalTrigInjecConv)
/* Configures the ADCx external trigger for injected channels conversion. */ void ADC_ExternalTrigInjectedConvConfig(ADC_TypeDef *ADCx, uint32_t ADC_ExternalTrigInjecConv)
{ uint32_t tmpreg = 0; assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_ADC_EXT_INJEC_TRIG(ADC_ExternalTrigInjecConv)); tmpreg = ADCx->ADCR; tmpreg &= ADCR_EXTSEL_Reset; tmpreg |= ADC_ExternalTrigInjecConv; ADCx->ADCR = tmpreg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If Buffer is not aligned on a 16-bit boundary, then ASSERT(). If an error would be returned, then the function will also ASSERT(). */
RETURN_STATUS EFIAPI UnicodeValueToStringS(IN OUT CHAR16 *Buffer, IN UINTN BufferSize, IN UINTN Flags, IN INT64 Value, IN UINTN Width)
/* If Buffer is not aligned on a 16-bit boundary, then ASSERT(). If an error would be returned, then the function will also ASSERT(). */ RETURN_STATUS EFIAPI UnicodeValueToStringS(IN OUT CHAR16 *Buffer, IN UINTN BufferSize, IN UINTN Flags, IN INT64 Value, IN UINTN Width)
{ ASSERT_UNICODE_BUFFER (Buffer); return BasePrintLibConvertValueToStringS ((CHAR8 *)Buffer, BufferSize, Flags, Value, Width, 2); }
tianocore/edk2
C++
Other
4,240
/* msleep - sleep safely even with waitqueue interruptions @msecs: Time in milliseconds to sleep for */
void msleep(unsigned int msecs)
/* msleep - sleep safely even with waitqueue interruptions @msecs: Time in milliseconds to sleep for */ void msleep(unsigned int msecs)
{ unsigned long timeout = msecs_to_jiffies(msecs) + 1; while (timeout) timeout = schedule_timeout_uninterruptible(timeout); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* USB Device Remote Wakeup Function Called automatically on USB Device Remote Wakeup Return Value: None */
void USBD_WakeUp(void)
/* USB Device Remote Wakeup Function Called automatically on USB Device Remote Wakeup Return Value: None */ void USBD_WakeUp(void)
{ USBHS->PORTSC1 |= (1UL << 6); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* acpi_enable_wakeup_device - enable wakeup devices @sleep_state: ACPI state Enable all wakup devices's GPE */
void acpi_enable_wakeup_device(u8 sleep_state)
/* acpi_enable_wakeup_device - enable wakeup devices @sleep_state: ACPI state Enable all wakup devices's GPE */ void acpi_enable_wakeup_device(u8 sleep_state)
{ struct list_head *node, *next; list_for_each_safe(node, next, &acpi_wakeup_device_list) { struct acpi_device *dev = container_of(node, struct acpi_device, wakeup_list); if (!dev->wakeup.flags.valid) continue; if ((!dev->wakeup.state.enabled && !dev->wakeup.prepare_count) || sleep_state > (u32) dev->wakeup.sleep_state) { if (dev->wakeup.flags.run_wake) { acpi_set_gpe_type(dev->wakeup.gpe_device, dev->wakeup.gpe_number, ACPI_GPE_TYPE_RUNTIME); } continue; } if (!dev->wakeup.flags.run_wake) acpi_enable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number); } }
robutest/uclinux
C++
GPL-2.0
60
/* __vxge_hw_ring_block_next_pointer_set - Sets the next block pointer in RxD block Sets the next block pointer in RxD block */
static void __vxge_hw_ring_block_next_pointer_set(u8 *block, dma_addr_t dma_next)
/* __vxge_hw_ring_block_next_pointer_set - Sets the next block pointer in RxD block Sets the next block pointer in RxD block */ static void __vxge_hw_ring_block_next_pointer_set(u8 *block, dma_addr_t dma_next)
{ *((u64 *)(block + VXGE_HW_RING_NEXT_BLOCK_POINTER_OFFSET)) = dma_next; }
robutest/uclinux
C++
GPL-2.0
60
/* Calculates a 4 or 16 color lookup table between the specified bg and fore colors for use with anti-aliased fonts. */
void aafontsCalculateColorTable(uint16_t bgColor, uint16_t foreColor, uint16_t *colorTable, size_t tableSize)
/* Calculates a 4 or 16 color lookup table between the specified bg and fore colors for use with anti-aliased fonts. */ void aafontsCalculateColorTable(uint16_t bgColor, uint16_t foreColor, uint16_t *colorTable, size_t tableSize)
{ uint16_t i, stepsize; if ((tableSize != 4) && (tableSize != 16)) return; colorTable[0] = bgColor; colorTable[tableSize - 1] = foreColor; stepsize = 100/(tableSize-1); for (i = 1; i < tableSize - 1; i++) { colorTable[i] = colorsAlphaBlend(bgColor, foreColor, 100-i*stepsize); } }
microbuilder/LPC1343CodeBase
C++
Other
73
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypePWM(uint32_t ui32Port, uint8_t ui8Pins)
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIOPinTypePWM(uint32_t ui32Port, uint8_t ui8Pins)
{ ASSERT(_GPIOBaseValid(ui32Port)); GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW); GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* cpuidle_uninstall_idle_handler - uninstalls the cpuidle idle loop handler */
void cpuidle_uninstall_idle_handler(void)
/* cpuidle_uninstall_idle_handler - uninstalls the cpuidle idle loop handler */ void cpuidle_uninstall_idle_handler(void)
{ if (enabled_devices && pm_idle_old && (pm_idle != pm_idle_old)) { pm_idle = pm_idle_old; cpuidle_kick_cpus(); } }
robutest/uclinux
C++
GPL-2.0
60
/* Set the display bottom right drawing limit. Use this function to set the bottom right corner of the drawing limit box. */
void ili9325_set_bottom_right_limit(ili9325_coord_t x, ili9325_coord_t y)
/* Set the display bottom right drawing limit. Use this function to set the bottom right corner of the drawing limit box. */ void ili9325_set_bottom_right_limit(ili9325_coord_t x, ili9325_coord_t y)
{ limit_end_x = x; limit_end_y = y; ili9325_send_draw_limits(true); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Walk the blacklist table running matching functions until someone returns non zero or we hit the end. Callback function is called for each successful match. Returns the number of matches. */
int dmi_check_system(const struct dmi_system_id *list)
/* Walk the blacklist table running matching functions until someone returns non zero or we hit the end. Callback function is called for each successful match. Returns the number of matches. */ int dmi_check_system(const struct dmi_system_id *list)
{ int count = 0; const struct dmi_system_id *d; for (d = list; !dmi_is_end_of_table(d); d++) if (dmi_matches(d)) { count++; if (d->callback && d->callback(d)) break; } return count; }
robutest/uclinux
C++
GPL-2.0
60
/* Clear All Status Flags. Program error, end of operation, write protect error, busy. Both banks cleared. */
void flash_clear_status_flags(void)
/* Clear All Status Flags. Program error, end of operation, write protect error, busy. Both banks cleared. */ void flash_clear_status_flags(void)
{ flash_clear_pgerr_flag(); flash_clear_eop_flag(); flash_clear_wrprterr_flag(); if (desig_get_flash_size() > 512) { flash_clear_pgerr_flag_upper(); flash_clear_eop_flag_upper(); flash_clear_wrprterr_flag_upper(); } }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Get the click enable attribute of an object */
bool lv_obj_get_click(const lv_obj_t *obj)
/* Get the click enable attribute of an object */ bool lv_obj_get_click(const lv_obj_t *obj)
{ return obj->click == 0 ? false : true; }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* ks8695_readreg - Read from a KS8695 ethernet register @ksp: The device to read from @reg: The register to read */
static u32 ks8695_readreg(struct ks8695_priv *ksp, int reg)
/* ks8695_readreg - Read from a KS8695 ethernet register @ksp: The device to read from @reg: The register to read */ static u32 ks8695_readreg(struct ks8695_priv *ksp, int reg)
{ return readl(ksp->io_regs + reg); }
robutest/uclinux
C++
GPL-2.0
60
/* register record key types All filtering records use the MAC address as the key. WiFi and Firewall records use a compound key consisting in both the MAC address and the port ID. */
IX_ETH_DB_PUBLIC UINT32 ixEthDBKeyTypeRegister(UINT32 *keyType)
/* register record key types All filtering records use the MAC address as the key. WiFi and Firewall records use a compound key consisting in both the MAC address and the port ID. */ IX_ETH_DB_PUBLIC UINT32 ixEthDBKeyTypeRegister(UINT32 *keyType)
{ memset(keyType, 0, sizeof (keyType)); keyType[IX_ETH_DB_FILTERING_RECORD] = IX_ETH_DB_MAC_KEY; keyType[IX_ETH_DB_FILTERING_VLAN_RECORD] = IX_ETH_DB_MAC_KEY; keyType[IX_ETH_DB_ALL_FILTERING_RECORDS] = IX_ETH_DB_MAC_KEY; keyType[IX_ETH_DB_WIFI_RECORD] = IX_ETH_DB_MAC_PORT_KEY; keyType[IX_ETH_DB_FIREWALL_RECORD] = IX_ETH_DB_MAC_PORT_KEY; return 5; }
EmcraftSystems/u-boot
C++
Other
181
/* Reset GPIO peripheral registers to their default reset values. */
void GPIO_Reset(GPIO_T *port)
/* Reset GPIO peripheral registers to their default reset values. */ void GPIO_Reset(GPIO_T *port)
{ RCM_APB2_PERIPH_T APB2Periph; if (port == GPIOA) { APB2Periph = RCM_APB2_PERIPH_GPIOA; } else if (port == GPIOB) { APB2Periph = RCM_APB2_PERIPH_GPIOB; } else if (port == GPIOC) { APB2Periph = RCM_APB2_PERIPH_GPIOC; } else if (port == GPIOD) { APB2Periph = RCM_APB2_PERIPH_GPIOD; } else if (port == GPIOE) { APB2Periph = RCM_APB2_PERIPH_GPIOE; } RCM_EnableAPB2PeriphReset(APB2Periph); RCM_DisableAPB2PeriphReset(APB2Periph); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns link specific information like speed, duplex etc.. to ethtool. Return value : return 0 on success. */
static int vxge_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
/* Returns link specific information like speed, duplex etc.. to ethtool. Return value : return 0 on success. */ static int vxge_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
{ info->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE); info->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE); info->port = PORT_FIBRE; info->transceiver = XCVR_EXTERNAL; if (netif_carrier_ok(dev)) { info->speed = SPEED_10000; info->duplex = DUPLEX_FULL; } else { info->speed = -1; info->duplex = -1; } info->autoneg = AUTONEG_DISABLE; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the events that can cause an ADC trigger event. */
uint32_t TimerADCEventGet(uint32_t ui32Base)
/* Returns the events that can cause an ADC trigger event. */ uint32_t TimerADCEventGet(uint32_t ui32Base)
{ ASSERT(_TimerBaseValid(ui32Base)); return(HWREG(ui32Base + TIMER_O_ADCEV)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Checks if target device is ready for communication. */
HAL_StatusTypeDef SENSOR_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials)
/* Checks if target device is ready for communication. */ HAL_StatusTypeDef SENSOR_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials)
{ return (I2Cx_IsDeviceReady(&hI2cHandler, DevAddress, Trials)); }
eclipse-threadx/getting-started
C++
Other
310
/* Get the wakeup pin flag of the specified index. */
xtBoolean SysCtlWakeupPinFlagGet(unsigned long ulPinIndex)
/* Get the wakeup pin flag of the specified index. */ xtBoolean SysCtlWakeupPinFlagGet(unsigned long ulPinIndex)
{ xtBoolean xtFlag = 0; xASSERT((ulPinIndex >= 0 && ulPinIndex <= 15)); xtFlag = (xHWREGB(LLWU_F1+ulPinIndex/8) & (LLWU_F1_WUF0 << ulPinIndex)); if(xtFlag) { return xtrue; } else { return xfalse; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* The constructor function caches the pointer of Runtime Services Table. It will ASSERT() if the pointer of Runtime Services Table is NULL. It will always return EFI_SUCCESS. */
EFI_STATUS EFIAPI UefiRuntimeServicesTableLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The constructor function caches the pointer of Runtime Services Table. It will ASSERT() if the pointer of Runtime Services Table is NULL. It will always return EFI_SUCCESS. */ EFI_STATUS EFIAPI UefiRuntimeServicesTableLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ gRT = SystemTable->RuntimeServices; ASSERT (gRT != NULL); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Read a data from a slave when the bus is idle, and waiting for all bus transmiton complete.(Read Step1) This function is usually used in thread mode. */
unsigned long I2CMasterReadS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char *pucData, xtBoolean bEndTransmition)
/* Read a data from a slave when the bus is idle, and waiting for all bus transmiton complete.(Read Step1) This function is usually used in thread mode. */ unsigned long I2CMasterReadS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char *pucData, xtBoolean bEndTransmition)
{ unsigned long ulStatus; xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE)); xASSERT(pucData); I2CMasterReadRequestS1(ulBase, ucSlaveAddr, xfalse); if(bEndTransmition) { xHWREG(ulBase + I2C_CR) &= ~I2C_CR_AA; } do { ulStatus = I2CStatusGet(ulBase); if(xHWREG(ulBase + I2C_CSR) & 0x0700) break; } while(!(ulStatus == I2C_MASTER_RX_NOT_EMPTY)); ulStatus &= (I2C_CSR_ARBLOS | I2C_CSR_RXNACK); if(!ulStatus) { *pucData = xHWREG(ulBase + I2C_DR); } if(bEndTransmition) { I2CStopSend(ulBase); } return ulStatus; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Returns information for the given variable namespace if available. */
CONST VAR_POLICY_CMD_VAR_NAMESPACE* GetNameSpaceInfo(IN EFI_GUID *VariableGuid)
/* Returns information for the given variable namespace if available. */ CONST VAR_POLICY_CMD_VAR_NAMESPACE* GetNameSpaceInfo(IN EFI_GUID *VariableGuid)
{ UINTN Index; if (VariableGuid == NULL) { ASSERT (VariableGuid != NULL); return NULL; } for (Index = 0; Index < ARRAY_SIZE (mVarNamespaces); Index++) { if (CompareGuid (mVarNamespaces[Index].VendorGuid, VariableGuid)) { return &mVarNamespaces[Index]; } } return NULL; }
tianocore/edk2
C++
Other
4,240
/* return after the repeated start condition has occurred */
static int pca_repeated_start(struct i2c_algo_pca_data *adap)
/* return after the repeated start condition has occurred */ static int pca_repeated_start(struct i2c_algo_pca_data *adap)
{ int sta = pca_get_con(adap); DEB2("=== REPEATED START\n"); sta |= I2C_PCA_CON_STA; sta &= ~(I2C_PCA_CON_STO|I2C_PCA_CON_SI); pca_set_con(adap, sta); return pca_wait(adap); }
robutest/uclinux
C++
GPL-2.0
60
/* Enable Continuous Conversion Mode In this mode the ADC starts a new conversion of a single channel or a channel group immediately following completion of the previous channel group conversion. */
void adc_set_continuous_conversion_mode(uint32_t adc)
/* Enable Continuous Conversion Mode In this mode the ADC starts a new conversion of a single channel or a channel group immediately following completion of the previous channel group conversion. */ void adc_set_continuous_conversion_mode(uint32_t adc)
{ ADC_CFGR1(adc) |= ADC_CFGR1_CONT; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Get constant Big number with value of "1". This may be used to save expensive allocations. */
CONST VOID* EFIAPI CryptoServiceBigNumValueOne(VOID)
/* Get constant Big number with value of "1". This may be used to save expensive allocations. */ CONST VOID* EFIAPI CryptoServiceBigNumValueOne(VOID)
{ return CALL_BASECRYPTLIB (Bn.Services.ValueOne, BigNumValueOne, (), NULL); }
tianocore/edk2
C++
Other
4,240
/* acct_init_pacct - initialize a new pacct_struct @pacct: per-process accounting info struct to initialize */
void acct_init_pacct(struct pacct_struct *pacct)
/* acct_init_pacct - initialize a new pacct_struct @pacct: per-process accounting info struct to initialize */ void acct_init_pacct(struct pacct_struct *pacct)
{ memset(pacct, 0, sizeof(struct pacct_struct)); pacct->ac_utime = pacct->ac_stime = cputime_zero; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This API initializes the configuration structure for LPSPI_SlaveInit(). The initialized structure can remain unchanged in LPSPI_SlaveInit() or can be modified before calling the LPSPI_SlaveInit(). Example: code lpspi_slave_config_t slaveConfig; LPSPI_SlaveGetDefaultConfig(&slaveConfig); endcode param slaveConfig pointer to lpspi_slave_config_t structure. */
void LPSPI_SlaveGetDefaultConfig(lpspi_slave_config_t *slaveConfig)
/* This API initializes the configuration structure for LPSPI_SlaveInit(). The initialized structure can remain unchanged in LPSPI_SlaveInit() or can be modified before calling the LPSPI_SlaveInit(). Example: code lpspi_slave_config_t slaveConfig; LPSPI_SlaveGetDefaultConfig(&slaveConfig); endcode param slaveConfig pointer to lpspi_slave_config_t structure. */ void LPSPI_SlaveGetDefaultConfig(lpspi_slave_config_t *slaveConfig)
{ assert(slaveConfig); memset(slaveConfig, 0, sizeof(*slaveConfig)); slaveConfig->bitsPerFrame = 8; slaveConfig->cpol = kLPSPI_ClockPolarityActiveHigh; slaveConfig->cpha = kLPSPI_ClockPhaseFirstEdge; slaveConfig->direction = kLPSPI_MsbFirst; slaveConfig->whichPcs = kLPSPI_Pcs0; slaveConfig->pcsActiveHighOrLow = kLPSPI_PcsActiveLow; slaveConfig->pinCfg = kLPSPI_SdiInSdoOut; slaveConfig->dataOutConfig = kLpspiDataOutRetained; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* passed tables_size covers whole StateTable, including kern fmt1 header */
static void gxv_kern_subtable_fmt1_subtable_setup(FT_UShort table_size, FT_UShort classTable, FT_UShort stateArray, FT_UShort entryTable, FT_UShort *classTable_length_p, FT_UShort *stateArray_length_p, FT_UShort *entryTable_length_p, GXV_Validator valid)
/* passed tables_size covers whole StateTable, including kern fmt1 header */ static void gxv_kern_subtable_fmt1_subtable_setup(FT_UShort table_size, FT_UShort classTable, FT_UShort stateArray, FT_UShort entryTable, FT_UShort *classTable_length_p, FT_UShort *stateArray_length_p, FT_UShort *entryTable_length_p, GXV_Validator valid)
{ FT_UShort o[4]; FT_UShort *l[4]; FT_UShort buff[5]; GXV_kern_fmt1_StateOptRecData optdata = (GXV_kern_fmt1_StateOptRecData)valid->statetable.optdata; o[0] = classTable; o[1] = stateArray; o[2] = entryTable; o[3] = optdata->valueTable; l[0] = classTable_length_p; l[1] = stateArray_length_p; l[2] = entryTable_length_p; l[3] = &(optdata->valueTable_length); gxv_set_length_by_ushort_offset( o, l, buff, 4, table_size, valid ); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* parport_ip32_epp_read_data - read a block of data in EPP mode */
static size_t parport_ip32_epp_read_data(struct parport *p, void *buf, size_t len, int flags)
/* parport_ip32_epp_read_data - read a block of data in EPP mode */ static size_t parport_ip32_epp_read_data(struct parport *p, void *buf, size_t len, int flags)
{ struct parport_ip32_private * const priv = p->physport->private_data; return parport_ip32_epp_read(priv->regs.eppData0, p, buf, len, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* If 32-bit I/O port operations are not supported, then ASSERT(). */
VOID EFIAPI IoReadFifo32(IN UINTN Port, IN UINTN Count, OUT VOID *Buffer)
/* If 32-bit I/O port operations are not supported, then ASSERT(). */ VOID EFIAPI IoReadFifo32(IN UINTN Port, IN UINTN Count, OUT VOID *Buffer)
{ ASSERT ((Port & 3) == 0); IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint32, Count, Buffer); }
tianocore/edk2
C++
Other
4,240
/* Airpcap wrapper, used to save the settings for the selected_if */
gboolean airpcap_if_set_device_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection)
/* Airpcap wrapper, used to save the settings for the selected_if */ gboolean airpcap_if_set_device_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection)
{ if (!AirpcapLoaded) return FALSE; return g_PAirpcapSetDeviceKeys(AdapterHandle,KeysCollection); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Retrieves the current value of a 64-bit free running performance counter. The counter can either count up by 1 or count down by 1. If the physical performance counter counts by a larger increment, then the counter values must be translated. The properties of the counter can be retrieved from */
UINT64 EFIAPI GetPerformanceCounter(VOID)
/* Retrieves the current value of a 64-bit free running performance counter. The counter can either count up by 1 or count down by 1. If the physical performance counter counts by a larger increment, then the counter values must be translated. The properties of the counter can be retrieved from */ UINT64 EFIAPI GetPerformanceCounter(VOID)
{ return (UINT64)InternalAcpiGetTimerTick (); }
tianocore/edk2
C++
Other
4,240
/* Trigger pci bus reset under a given bus. Called via qbus_reset_all on RST# assert, after the devices have been reset qdev_reset_all-ed already. */
static void pcibus_reset(BusState *qbus)
/* Trigger pci bus reset under a given bus. Called via qbus_reset_all on RST# assert, after the devices have been reset qdev_reset_all-ed already. */ static void pcibus_reset(BusState *qbus)
{ PCIBus *bus = DO_UPCAST(PCIBus, qbus, qbus); int i; for (i = 0; i < ARRAY_SIZE(bus->devices); ++i) { if (bus->devices[i]) { pci_do_device_reset(bus->devices[i]); } } for (i = 0; i < bus->nirq; i++) { assert(bus->irq_count[i] == 0); } }
ve3wwg/teensy3_qemu
C++
Other
15
/* Returns whether CRYP peripheral is enabled or disabled. */
FunctionalState CRYP_GetCmdStatus(void)
/* Returns whether CRYP peripheral is enabled or disabled. */ FunctionalState CRYP_GetCmdStatus(void)
{ FunctionalState state = DISABLE; if ((CRYP->CR & CRYP_CR_CRYPEN) != 0) { state = ENABLE; } else { state = DISABLE; } return state; }
MaJerle/stm32f429
C++
null
2,036
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI S3PciOr32(IN UINTN Address, IN UINT32 OrData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI S3PciOr32(IN UINTN Address, IN UINT32 OrData)
{ return InternalSavePciWrite32ValueToBootScript (Address, PciOr32 (Address, OrData)); }
tianocore/edk2
C++
Other
4,240
/* Registers the callback function that this server calls, whenever a client requests the writing of a specific coil. */
void TbxMbServerSetCallbackWriteCoil(tTbxMbServer channel, tTbxMbServerWriteCoil callback)
/* Registers the callback function that this server calls, whenever a client requests the writing of a specific coil. */ void TbxMbServerSetCallbackWriteCoil(tTbxMbServer channel, tTbxMbServerWriteCoil callback)
{ TBX_ASSERT((channel != NULL) && (callback != NULL)); if ((channel != NULL) && (callback != NULL)) { tTbxMbServerCtx * serverCtx = (tTbxMbServerCtx *)channel; TBX_ASSERT(serverCtx->type == TBX_MB_SERVER_CONTEXT_TYPE); TbxCriticalSectionEnter(); serverCtx->writeCoilFcn = callback; TbxCriticalSectionExit(); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Length is the number of bytes following (the ftp data). */
MODEM_CMD_DEFINE(on_cmd_ftpget)
/* Length is the number of bytes following (the ftp data). */ MODEM_CMD_DEFINE(on_cmd_ftpget)
{ int nbytes = atoi(argv[0]); int bytes_to_skip; size_t out_len; if (nbytes == 0) { mdata.ftp.nread = 0; return 0; } bytes_to_skip = strlen(argv[0]) + 2; if (net_buf_frags_len(data->rx_buf) <= nbytes + bytes_to_skip) { return -EAGAIN; } out_len = net_buf_linearize(mdata.ftp.read_buffer, mdata.ftp.nread, data->rx_buf, bytes_to_skip, nbytes); if (out_len != nbytes) { LOG_WRN("FTP read size differs!"); } data->rx_buf = net_buf_skip(data->rx_buf, nbytes + bytes_to_skip); mdata.ftp.nread = nbytes; return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Reset the ring buffer object, and clear all contents in the buffer. */
void rt_ringbuffer_reset(struct rt_ringbuffer *rb)
/* Reset the ring buffer object, and clear all contents in the buffer. */ void rt_ringbuffer_reset(struct rt_ringbuffer *rb)
{ RT_ASSERT(rb != RT_NULL); rb->read_mirror = 0; rb->read_index = 0; rb->write_mirror = 0; rb->write_index = 0; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Enables or disables access to the RTC and backup registers. */
void PWR_BackupAccessEnable(FunctionalState Cmd)
/* Enables or disables access to the RTC and backup registers. */ void PWR_BackupAccessEnable(FunctionalState Cmd)
{ assert_param(IS_FUNCTIONAL_STATE(Cmd)); *(__IO uint32_t*)CTRL_DBKP_BB = (uint32_t)Cmd; }
pikasTech/PikaPython
C++
MIT License
1,403
/* 8.64 eMLPP Priority The eMLPP-Priority shall be coded as depicted in Figure 8.64-1. The eMLPP Priority is coded as the value part of the eMLPP-Priority IE defined in 3GPP TS 48.008 */
static void dissect_gtpv2_emlpp_pri(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_, session_args_t *args _U_)
/* 8.64 eMLPP Priority The eMLPP-Priority shall be coded as depicted in Figure 8.64-1. The eMLPP Priority is coded as the value part of the eMLPP-Priority IE defined in 3GPP TS 48.008 */ static void dissect_gtpv2_emlpp_pri(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_, session_args_t *args _U_)
{ be_emlpp_prio(tvb, tree, pinfo, 0, length, NULL, 0); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Compute PLL settings (M, N, R) F_VCO = (F_BASE * M) / N F_OUT = F_VCO / (2^R) */
static u32 abs_diff(u32 a, u32 b)
/* Compute PLL settings (M, N, R) F_VCO = (F_BASE * M) / N F_OUT = F_VCO / (2^R) */ static u32 abs_diff(u32 a, u32 b)
{ return (a > b) ? (a - b) : (b - a); }
robutest/uclinux
C++
GPL-2.0
60
/* pm_runtime_idle - Notify device bus type if the device can be suspended. @dev: Device to notify the bus type about. */
int pm_runtime_idle(struct device *dev)
/* pm_runtime_idle - Notify device bus type if the device can be suspended. @dev: Device to notify the bus type about. */ int pm_runtime_idle(struct device *dev)
{ int retval; spin_lock_irq(&dev->power.lock); retval = __pm_runtime_idle(dev); spin_unlock_irq(&dev->power.lock); return retval; }
robutest/uclinux
C++
GPL-2.0
60
/* Unpacks binary string from the buffer from the offset requested. */
static int unpack_data(uint32_t length, struct buf_ctx *buf, struct mqtt_binstr *str)
/* Unpacks binary string from the buffer from the offset requested. */ static int unpack_data(uint32_t length, struct buf_ctx *buf, struct mqtt_binstr *str)
{ NET_DBG(">> cur:%p, end:%p", (void *)buf->cur, (void *)buf->end); if ((buf->end - buf->cur) < length) { return -EINVAL; } str->len = length; if (length > 0) { str->data = buf->cur; buf->cur += length; } else { str->data = NULL; } NET_DBG("<< bin len:%08x", GET_BINSTR_BUFFER_SIZE(str)); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Returns zero on success or %-ENOENT on failure. */
int raw_notifier_chain_unregister(struct raw_notifier_head *nh, struct notifier_block *n)
/* Returns zero on success or %-ENOENT on failure. */ int raw_notifier_chain_unregister(struct raw_notifier_head *nh, struct notifier_block *n)
{ return notifier_chain_unregister(&nh->head, n); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Allocate new memory and concatinate Source on the end of Destination. */
VOID NewStringCat(IN OUT CHAR16 **Dest, IN CHAR16 *Src)
/* Allocate new memory and concatinate Source on the end of Destination. */ VOID NewStringCat(IN OUT CHAR16 **Dest, IN CHAR16 *Src)
{ CHAR16 *NewString; UINTN MaxLen; if (*Dest == NULL) { NewStringCpy (Dest, Src); return; } MaxLen = (StrSize (*Dest) + StrSize (Src) - 1) / sizeof (CHAR16); NewString = AllocateZeroPool (MaxLen * sizeof (CHAR16)); ASSERT (NewString != NULL); StrCpyS (NewString, MaxLen, *Dest); StrCatS (NewString, MaxLen, Src); FreePool (*Dest); *Dest = NewString; }
tianocore/edk2
C++
Other
4,240
/* 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)
{ unsigned long ulChannelTemp; ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4); xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE)); xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 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) |= (PWM_PIER_PWMIE0 << ulChannelTemp); } else { xHWREG(ulBase + PWM_CCR0 + (ulChannelTemp << 1)) |= (PWM_CCR0_CAPIF0 << ((ulChannel % 2) ? 16 : 0)) ; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Set Timer 1 Input to Channel 1. The first timer capture input is taken from the timer input channel 1 only. */
void timer_set_ti1_ch1(uint32_t timer_peripheral)
/* Set Timer 1 Input to Channel 1. The first timer capture input is taken from the timer input channel 1 only. */ void timer_set_ti1_ch1(uint32_t timer_peripheral)
{ TIM_CR2(timer_peripheral) &= ~TIM_CR2_TI1S; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Allocate enough 32bit PA addressable pages to cover @size from the page level allocator and map them into contiguous kernel virtual space. */
void* vmalloc_32(unsigned long size)
/* Allocate enough 32bit PA addressable pages to cover @size from the page level allocator and map them into contiguous kernel virtual space. */ void* vmalloc_32(unsigned long size)
{ return __vmalloc_node(size, 1, GFP_VMALLOC32, PAGE_KERNEL, -1, __builtin_return_address(0)); }
robutest/uclinux
C++
GPL-2.0
60
/* Note that, although the EPI peripheral can handle counts of up to 65535, a single uDMA transfer has a maximum length of 1024 units so */
void EPIDMATxCount(uint32_t ui32Base, uint32_t ui32Count)
/* Note that, although the EPI peripheral can handle counts of up to 65535, a single uDMA transfer has a maximum length of 1024 units so */ void EPIDMATxCount(uint32_t ui32Base, uint32_t ui32Count)
{ ASSERT(ui32Base == EPI0_BASE); ASSERT(ui32Count <= 1024); HWREG(ui32Base + EPI_O_DMATXCNT) = ui32Count & 0xffff; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Config the slave select pins of the specified SPI port. The */
void SPISSConfig(unsigned long ulBase, unsigned long ulSSTriggerMode, unsigned long ulSSActType)
/* Config the slave select pins of the specified SPI port. The */ void SPISSConfig(unsigned long ulBase, unsigned long ulSSTriggerMode, unsigned long ulSSActType)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)); xASSERT((ulSSTriggerMode == SPI_SS_EDGE_TRIGGER) || (ulSSTriggerMode == SPI_SS_LEVEL_TRIGGER)); xASSERT((ulSSActType == SPI_SS_ACTIVE_LOW_FALLING) || (ulSSActType == SPI_SS_ACTIVE_HIGH_RISING)); xHWREG(ulBase + SPI_SSR) |= ulSSTriggerMode | ulSSActType; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocateRuntimeZeroPool(IN UINTN AllocationSize)
/* Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ VOID* EFIAPI AllocateRuntimeZeroPool(IN UINTN AllocationSize)
{ return InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize); }
tianocore/edk2
C++
Other
4,240
/* Deinitialize SPI peripheral. Turn off the SPI peripheral and disable SPI GPIO pins. */
void MICROSD_Deinit(void)
/* Deinitialize SPI peripheral. Turn off the SPI peripheral and disable SPI GPIO pins. */ void MICROSD_Deinit(void)
{ USART_Reset(MICROSD_USART); GPIO_PinModeSet(MICROSD_GPIOPORT, MICROSD_MOSIPIN, gpioModeDisabled, 0); GPIO_PinModeSet(MICROSD_GPIOPORT, MICROSD_MISOPIN, gpioModeDisabled, 0); GPIO_PinModeSet(MICROSD_GPIOPORT, MICROSD_CSPIN, gpioModeDisabled, 0); GPIO_PinModeSet(MICROSD_GPIOPORT, MICROSD_CLKPIN, gpioModeDisabled, 0); }
remotemcu/remcu-chip-sdks
C++
null
436
/* basically do an itoa using as little ram as possible */
void UnityPrintNumberUnsigned(const _U_UINT number)
/* basically do an itoa using as little ram as possible */ void UnityPrintNumberUnsigned(const _U_UINT number)
{ _U_UINT divisor = 1; _U_UINT next_divisor; while (number / divisor > 9) { next_divisor = divisor * 10; if (next_divisor > divisor) divisor = next_divisor; else break; } do { UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); divisor /= 10; } while (divisor > 0); }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* Bind ip_vs_conn to its ip_vs_app (called by cp constructor) */
int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp)
/* Bind ip_vs_conn to its ip_vs_app (called by cp constructor) */ int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp)
{ return pp->app_conn_bind(cp); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. */
EFI_STATUS EFIAPI IScsiExtScsiPassThruGetNextTarget(IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This, IN OUT UINT8 **Target)
/* Retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. */ EFI_STATUS EFIAPI IScsiExtScsiPassThruGetNextTarget(IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This, IN OUT UINT8 **Target)
{ UINT8 TargetId[TARGET_MAX_BYTES]; SetMem (TargetId, TARGET_MAX_BYTES, 0xFF); if (CompareMem (*Target, TargetId, TARGET_MAX_BYTES) == 0) { (*Target)[0] = 0; return EFI_SUCCESS; } else if ((*Target)[0] == 0) { return EFI_NOT_FOUND; } else { return EFI_INVALID_PARAMETER; } }
tianocore/edk2
C++
Other
4,240
/* The entry point for Arp driver which installs the driver binding and component name protocol on its ImageHandle. */
EFI_STATUS EFIAPI ArpDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The entry point for Arp driver which installs the driver binding and component name protocol on its ImageHandle. */ EFI_STATUS EFIAPI ArpDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ return EfiLibInstallDriverBindingComponentName2 ( ImageHandle, SystemTable, &gArpDriverBinding, ImageHandle, &gArpComponentName, &gArpComponentName2 ); }
tianocore/edk2
C++
Other
4,240
/* Deinitializes the ITC registers to their default reset value. */
void ITC_DeInit(void)
/* Deinitializes the ITC registers to their default reset value. */ void ITC_DeInit(void)
{ ITC->ISPR1 = ITC_SPRX_RESET_VALUE; ITC->ISPR2 = ITC_SPRX_RESET_VALUE; ITC->ISPR3 = ITC_SPRX_RESET_VALUE; ITC->ISPR4 = ITC_SPRX_RESET_VALUE; ITC->ISPR5 = ITC_SPRX_RESET_VALUE; ITC->ISPR6 = ITC_SPRX_RESET_VALUE; ITC->ISPR7 = ITC_SPRX_RESET_VALUE; ITC->ISPR8 = ITC_SPRX_RESET_VALUE; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Read a value from the @channel with the proper locking and sleep until either the read completes or we timeout awaiting the ADC core to get back to us. */
static int s3c_hwmon_read_ch(struct device *dev, struct s3c_hwmon *hwmon, int channel)
/* Read a value from the @channel with the proper locking and sleep until either the read completes or we timeout awaiting the ADC core to get back to us. */ static int s3c_hwmon_read_ch(struct device *dev, struct s3c_hwmon *hwmon, int channel)
{ int ret; ret = down_interruptible(&hwmon->lock); if (ret < 0) return ret; dev_dbg(dev, "reading channel %d\n", channel); ret = s3c_adc_read(hwmon->client, channel); up(&hwmon->lock); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Adds a new label/goto in the corresponding list. */
static int newlabelentry(LexState *ls, Labellist *l, TString *name, int line, int pc)
/* Adds a new label/goto in the corresponding list. */ static int newlabelentry(LexState *ls, Labellist *l, TString *name, int line, int pc)
{ int n = l->n; luaM_growvector(ls->L, l->arr, n, l->size, Labeldesc, SHRT_MAX, "labels/gotos"); l->arr[n].name = name; l->arr[n].line = line; l->arr[n].nactvar = ls->fs->nactvar; l->arr[n].close = 0; l->arr[n].pc = pc; l->n = n + 1; return n; }
Nicholas3388/LuaNode
C++
Other
1,055
/* THE SOFTWARE IS PROVIDED "AS IS" AND 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, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
void zfCwmInit(zdev_t *dev)
/* THE SOFTWARE IS PROVIDED "AS IS" AND 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, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ void zfCwmInit(zdev_t *dev)
{ case ZM_MODE_AP: wd->cwm.cw_mode = CWM_MODE2040; wd->cwm.cw_width = CWM_WIDTH40; wd->cwm.cw_enable = 1; break; case ZM_MODE_INFRASTRUCTURE: case ZM_MODE_PSEUDO: case ZM_MODE_IBSS: default: wd->cwm.cw_mode = CWM_MODE2040; wd->cwm.cw_width = CWM_WIDTH20; wd->cwm.cw_enable = 1; break; } }
robutest/uclinux
C++
GPL-2.0
60
/* Iterate through the children of an object (start from the "oldest") */
lv_obj_t* lv_obj_get_child_back(const lv_obj_t *obj, const lv_obj_t *child)
/* Iterate through the children of an object (start from the "oldest") */ lv_obj_t* lv_obj_get_child_back(const lv_obj_t *obj, const lv_obj_t *child)
{ lv_obj_t * result = NULL; if(child == NULL) { result = lv_ll_get_tail(&obj->child_ll); } else { result = lv_ll_get_prev(&obj->child_ll, child); } return result; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Function for handling Service errors. A pointer to this function will be passed to the DFU service which may need to inform the application about an error. */
static void service_error_handler(uint32_t nrf_error)
/* Function for handling Service errors. A pointer to this function will be passed to the DFU service which may need to inform the application about an error. */ static void service_error_handler(uint32_t nrf_error)
{ APP_ERROR_HANDLER(nrf_error); }
labapart/polymcu
C++
null
201
/* Decode given GLL sentence by validating and splitting the source string into values. */
static ssize_t decode_gll(struct nmea_sentence_t *dst_p, char *src_p)
/* Decode given GLL sentence by validating and splitting the source string into values. */ static ssize_t decode_gll(struct nmea_sentence_t *dst_p, char *src_p)
{ dst_p->type = nmea_sentence_type_gll_t; dst_p->gll.latitude.angle_p = strsep(&src_p, ","); dst_p->gll.latitude.direction_p = strsep(&src_p, ","); dst_p->gll.longitude.angle_p = strsep(&src_p, ","); dst_p->gll.longitude.direction_p = strsep(&src_p, ","); dst_p->gll.time_of_fix_p = strsep(&src_p, ","); dst_p->gll.data_active_p = strsep(&src_p, ","); (void)strsep(&src_p, "*"); if (src_p == NULL) { return (-EPROTO); } return (0); }
eerimoq/simba
C++
Other
337
/* CDC class driver callback function the processing of changes to the virtual control lines sent from the host.. */
void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t *const CDCInterfaceInfo)
/* CDC class driver callback function the processing of changes to the virtual control lines sent from the host.. */ void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t *const CDCInterfaceInfo)
{ bool HostReady = (CDCInterfaceInfo->State.ControlLineStates.HostToDevice & CDC_CONTROL_LINE_OUT_DTR) != 0; (void)HostReady; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019