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
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
{ if(hspi->Instance==SPI5) { __HAL_RCC_SPI5_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOF, GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ‘p n’ Reads the n-th register's value into an output buffer and sends it as a packet */
VOID ReadNthRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *InBuffer)
/* ‘p n’ Reads the n-th register's value into an output buffer and sends it as a packet */ VOID ReadNthRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *InBuffer)
{ UINTN RegNumber; CHAR8 OutBuffer[17]; CHAR8 *OutBufPtr; RegNumber = AsciiStrHexToUintn (&InBuffer[1]); if ((RegNumber < 0) || (RegNumber >= MaxRegisterCount ())) { SendError (GDB_EINVALIDREGNUM); return; } OutBufPtr = OutBuffer; OutBufPtr = BasicReadRegister (SystemContext, RegNumber, OutBufPtr); *OutBufPtr = '\0'; SendPacket (OutBuffer); }
tianocore/edk2
C++
Other
4,240
/* Returns: Whether a transformation rule was found and could be applied. Upon failing transformations, @dest_value is left untouched. */
gboolean g_value_transform(const GValue *src_value, GValue *dest_value)
/* Returns: Whether a transformation rule was found and could be applied. Upon failing transformations, @dest_value is left untouched. */ gboolean g_value_transform(const GValue *src_value, GValue *dest_value)
{ GType dest_type; g_return_val_if_fail (G_IS_VALUE (src_value), FALSE); g_return_val_if_fail (G_IS_VALUE (dest_value), FALSE); dest_type = G_VALUE_TYPE (dest_value); if (g_value_type_compatible (G_VALUE_TYPE (src_value), dest_type)) { g_value_copy (src_value, dest_value); return TRUE; } else { GValueTransform transform = transform_func_lookup (G_VALUE_TYPE (src_value), dest_type); if (transform) { g_value_unset (dest_value); value_meminit (dest_value, dest_type); transform (src_value, dest_value); return TRUE; } } return FALSE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Reads the values present of the specified pin(s). The values at the specified pin(s) are read, as specified by */
unsigned long xGPIOPinRead(unsigned long ulPort, unsigned long ulPins)
/* Reads the values present of the specified pin(s). The values at the specified pin(s) are read, as specified by */ unsigned long xGPIOPinRead(unsigned long ulPort, unsigned long ulPins)
{ return GPIOPinRead(ulPort, ulPins); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Force an update of in-memory copy of the pioavail registers, when needed for any of a variety of reasons. We read the scratch register to make it highly likely that the update will have happened by the time we return. If already off (as in cancel_sends above), this routine is a nop, on the assumption that the caller will "do the right thing". */
void ipath_force_pio_avail_update(struct ipath_devdata *dd)
/* Force an update of in-memory copy of the pioavail registers, when needed for any of a variety of reasons. We read the scratch register to make it highly likely that the update will have happened by the time we return. If already off (as in cancel_sends above), this routine is a nop, on the assumption that the caller will "do the right thing". */ void ipath_force_pio_avail_update(struct ipath_devdata *dd)
{ unsigned long flags; spin_lock_irqsave(&dd->ipath_sendctrl_lock, flags); if (dd->ipath_sendctrl & INFINIPATH_S_PIOBUFAVAILUPD) { ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, dd->ipath_sendctrl & ~INFINIPATH_S_PIOBUFAVAILUPD); ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, dd->ipath_sendctrl); ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); } spin_unlock_irqrestore(&dd->ipath_sendctrl_lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Get Protected mode code segment with 16-bit default addressing from current GDT table. */
STATIC UINT16 GetProtectedMode16CS(VOID)
/* Get Protected mode code segment with 16-bit default addressing from current GDT table. */ STATIC UINT16 GetProtectedMode16CS(VOID)
{ IA32_DESCRIPTOR GdtrDesc; IA32_SEGMENT_DESCRIPTOR *GdtEntry; UINTN GdtEntryCount; UINT16 Index; Index = (UINT16)-1; AsmReadGdtr (&GdtrDesc); GdtEntryCount = (GdtrDesc.Limit + 1) / sizeof (IA32_SEGMENT_DESCRIPTOR); GdtEntry = (IA32_SEGMENT_DESCRIPTOR *)GdtrDesc.Base; for (Index = 0; Index < GdtEntryCount; Index++) { if ((GdtEntry->Bits.L == 0) && (GdtEntry->Bits.DB == 0) && (GdtEntry->Bits.Type > 8)) { break; } GdtEntry++; } ASSERT (Index != GdtEntryCount); return Index * 8; }
tianocore/edk2
C++
Other
4,240
/* Assert that a sample point is within a specified margin. Assert that values of a CAN timing struct results in a specified sample point within a given margin. */
static void assert_sp_within_margin(struct can_timing *timing, uint16_t sp, uint16_t sp_margin)
/* Assert that a sample point is within a specified margin. Assert that values of a CAN timing struct results in a specified sample point within a given margin. */ static void assert_sp_within_margin(struct can_timing *timing, uint16_t sp, uint16_t sp_margin)
{ const uint32_t ts = 1 + timing->prop_seg + timing->phase_seg1 + timing->phase_seg2; const uint16_t sp_calc = ((1 + timing->prop_seg + timing->phase_seg1) * 1000) / ts; zassert_within(sp, sp_calc, sp_margin, "sample point %d not within calculated sample point %d +/- %d", sp, sp_calc, sp_margin); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* INTERFACE: Finit at unload time return address of internal queue or zero if queue was external */
void* diva_maint_finit(void)
/* INTERFACE: Finit at unload time return address of internal queue or zero if queue was external */ void* diva_maint_finit(void)
{ diva_os_destroy_spin_lock(&dbg_q_lock, "dbg_finit"); diva_os_destroy_spin_lock(&dbg_adapter_lock, "dbg_finit"); } if (external_dbg_queue) { ret = NULL; } external_dbg_queue = 0; for (i = 1; i < ARRAY_SIZE(clients); i++) { if (clients[i].pmem) { diva_os_free (0, clients[i].pmem); } } return (ret); }
robutest/uclinux
C++
GPL-2.0
60
/* To be used by smem clients as a quick way to determine if any new allocations has been made. */
static int qcom_smem_get_free_space(unsigned int host)
/* To be used by smem clients as a quick way to determine if any new allocations has been made. */ static int qcom_smem_get_free_space(unsigned int host)
{ struct smem_partition_header *phdr; struct smem_header *header; unsigned int ret; if (!__smem) return -EPROBE_DEFER; if (host < SMEM_HOST_COUNT && __smem->partitions[host]) { phdr = __smem->partitions[host]; ret = le32_to_cpu(phdr->offset_free_cached) - le32_to_cpu(phdr->offset_free_uncached); } else if (__smem->global_partition) { phdr = __smem->global_partition; ret = le32_to_cpu(phdr->offset_free_cached) - le32_to_cpu(phdr->offset_free_uncached); } else { header = __smem->regions[0].virt_base; ret = le32_to_cpu(header->available); } return ret; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This file is part of the Simba project. */
int main()
/* This file is part of the Simba project. */ int main()
{ sys_start(); sys_panic(FSTR("Intentional %s!\r\n"), "panic"); return (0); }
eerimoq/simba
C++
Other
337
/* Checks whether the rx descriptor is valid. if rx descripor is not in error and complete frame is available in the same descriptor */
bool synopGMAC_is_rx_desc_valid(u32 status)
/* Checks whether the rx descriptor is valid. if rx descripor is not in error and complete frame is available in the same descriptor */ bool synopGMAC_is_rx_desc_valid(u32 status)
{ return ((status & DescError) == 0) && ((status & DescRxFirst) == DescRxFirst) && ((status & DescRxLast) == DescRxLast); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Flush logs. If processing thread is enabled keep sleeping until there are no pending messages else process logs here. */
static void flush_log(void)
/* Flush logs. If processing thread is enabled keep sleeping until there are no pending messages else process logs here. */ static void flush_log(void)
{ if (IS_ENABLED(CONFIG_LOG_PROCESS_THREAD)) { while (log_data_pending()) { k_msleep(10); } k_msleep(100); } else { while (LOG_PROCESS()) { } } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Simple custom function to set as value input function for emulated ADC channel. It returns arithmetic sequence with SEQUENCE_STEP as common difference, starting from param value. */
static int handle_seq(const struct device *dev, unsigned int channel, void *data, uint32_t *result)
/* Simple custom function to set as value input function for emulated ADC channel. It returns arithmetic sequence with SEQUENCE_STEP as common difference, starting from param value. */ static int handle_seq(const struct device *dev, unsigned int channel, void *data, uint32_t *result)
{ struct handle_seq_params *param = data; if (param->value == 0) { return -EINVAL; } *result = param->value; param->value += SEQUENCE_STEP; return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* USB Device Set Address Function Parameters: adr: USB Device Address setup: Called in setup stage (!=0), else after status stage Return Value: None */
void USBD_SetAddress(U32 adr, U32 setup)
/* USB Device Set Address Function Parameters: adr: USB Device Address setup: Called in setup stage (!=0), else after status stage Return Value: None */ void USBD_SetAddress(U32 adr, U32 setup)
{ if (setup) { return; } DADDR = DADDR_EF | adr; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* param base UART peripheral base address. param handle UART handle pointer. param count Receive bytes count. retval kStatus_NoTransferInProgress No receive in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */
status_t UART_TransferGetReceiveCountEDMA(UART_Type *base, uart_edma_handle_t *handle, uint32_t *count)
/* param base UART peripheral base address. param handle UART handle pointer. param count Receive bytes count. retval kStatus_NoTransferInProgress No receive in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */ status_t UART_TransferGetReceiveCountEDMA(UART_Type *base, uart_edma_handle_t *handle, uint32_t *count)
{ assert(handle); assert(handle->rxEdmaHandle); assert(count); if (kUART_RxIdle == handle->rxState) { return kStatus_NoTransferInProgress; } *count = handle->rxDataSizeAll - (uint32_t)handle->nbytes * EDMA_GetRemainingMajorLoopCount(handle->rxEdmaHandle->base, handle->rxEdmaHandle->channel); return kStatus_Success; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Sets up filter rule for frames having extended ID. Each FDCAN block can have its own set of filtering rules. It is only possible to configure as many filters as was configured previously using fdcan_init_filter. */
void fdcan_set_ext_filter(uint32_t canport, uint32_t nr, uint8_t id_list_mode, uint32_t id1, uint32_t id2, uint8_t action)
/* Sets up filter rule for frames having extended ID. Each FDCAN block can have its own set of filtering rules. It is only possible to configure as many filters as was configured previously using fdcan_init_filter. */ void fdcan_set_ext_filter(uint32_t canport, uint32_t nr, uint8_t id_list_mode, uint32_t id1, uint32_t id2, uint8_t action)
{ struct fdcan_extended_filter *lfesa = fdcan_get_flesa_addr(canport); lfesa[nr].conf_id1 = (action << FDCAN_EFEC_SHIFT) | ((id1 & FDCAN_EFID1_MASK) << FDCAN_EFID1_SHIFT); lfesa[nr].type_id2 = (id_list_mode << FDCAN_EFT_SHIFT) | ((id2 & FDCAN_EFID2_MASK) << FDCAN_EFID2_SHIFT); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Post-write operation, currently only supporting strong pullups. If a strong pullup was requested, clear it if the hardware supports them, or execute the delay otherwise, in either case clear the request. */
static void w1_post_write(struct w1_master *dev)
/* Post-write operation, currently only supporting strong pullups. If a strong pullup was requested, clear it if the hardware supports them, or execute the delay otherwise, in either case clear the request. */ static void w1_post_write(struct w1_master *dev)
{ if (dev->pullup_duration) { if (dev->enable_pullup && dev->bus_master->set_pullup) dev->bus_master->set_pullup(dev->bus_master->data, 0); else msleep(dev->pullup_duration); dev->pullup_duration = 0; } }
robutest/uclinux
C++
GPL-2.0
60
/* The functions sets the contents of the Config Register. */
void XAdcPs_SetConfigRegister(XAdcPs *InstancePtr, u32 Data)
/* The functions sets the contents of the Config Register. */ void XAdcPs_SetConfigRegister(XAdcPs *InstancePtr, u32 Data)
{ Xil_AssertVoid(InstancePtr != NULL); Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); XAdcPs_WriteReg((InstancePtr)->Config.BaseAddress, XADCPS_CFG_OFFSET, Data); }
ua1arn/hftrx
C++
null
69
/* This function make QSPI module be ready to transfer. */
uint32_t QSPI_Open(QSPI_T *qspi, uint32_t u32MasterSlave, uint32_t u32QSPIMode, uint32_t u32DataWidth, uint32_t u32BusClock)
/* This function make QSPI module be ready to transfer. */ uint32_t QSPI_Open(QSPI_T *qspi, uint32_t u32MasterSlave, uint32_t u32QSPIMode, uint32_t u32DataWidth, uint32_t u32BusClock)
{ uint32_t u32RetValue = 0U; if (u32DataWidth == 32U) { u32DataWidth = 0U; } if (u32MasterSlave == QSPI_MASTER) { qspi->SSCTL = QSPI_SS_ACTIVE_LOW; qspi->CTL = u32MasterSlave | (u32DataWidth << QSPI_CTL_DWIDTH_Pos) | (u32QSPIMode) | QSPI_CTL_QSPIEN_Msk; qspi->CLKDIV = ((150000000U / u32BusClock) - 1U); } else { qspi->SSCTL = QSPI_SS_ACTIVE_LOW; qspi->CTL = u32MasterSlave | (u32DataWidth << QSPI_CTL_DWIDTH_Pos) | (u32QSPIMode) | QSPI_CTL_QSPIEN_Msk; qspi->CLKDIV = 0U; } return u32RetValue; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This method will free @invocation, you cannot use it afterwards. */
void _g_freedesktop_dbus_complete_list_names(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation, const gchar *const *names)
/* This method will free @invocation, you cannot use it afterwards. */ void _g_freedesktop_dbus_complete_list_names(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation, const gchar *const *names)
{ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(^as)", names)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Determines whether or not the raster output is currently enabled. */
bool LCDRasterEnabled(uint32_t ui32Base)
/* Determines whether or not the raster output is currently enabled. */ bool LCDRasterEnabled(uint32_t ui32Base)
{ ASSERT(ui32Base == LCD0_BASE); return((HWREG(ui32Base + LCD_O_RASTRCTL) & LCD_RASTRCTL_LCDEN) ? true : false); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* convert an offset given in ms to abolute time in time in us */
static void fib_lifetime_to_absolute(uint32_t ms, uint64_t *target)
/* convert an offset given in ms to abolute time in time in us */ static void fib_lifetime_to_absolute(uint32_t ms, uint64_t *target)
{ *target = xtimer_now64() + (ms * 1000); }
labapart/polymcu
C++
null
201
/* List of supported fixups: geode-gx1/cs5530a - Jaya Kumar */
static void cs5530a_warm_reset(struct pci_dev *dev)
/* List of supported fixups: geode-gx1/cs5530a - Jaya Kumar */ static void cs5530a_warm_reset(struct pci_dev *dev)
{ pci_write_config_byte(dev, 0x44, 0x1); udelay(50); return; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Convert provided flags to status code, and clear any errors if present. */
static status_t LPI2C_SlaveCheckAndClearError(LPI2C_Type *base, uint32_t flags)
/* Convert provided flags to status code, and clear any errors if present. */ static status_t LPI2C_SlaveCheckAndClearError(LPI2C_Type *base, uint32_t flags)
{ status_t result = kStatus_Success; flags &= (uint32_t)kLPI2C_SlaveErrorFlags; if (0U != flags) { if (0U != (flags & (uint32_t)kLPI2C_SlaveBitErrFlag)) { result = kStatus_LPI2C_BitError; } else if (0U != (flags & (uint32_t)kLPI2C_SlaveFifoErrFlag)) { result = kStatus_LPI2C_FifoError; } else { ; } LPI2C_SlaveClearStatusFlags(base, flags); } else { ; } return result; }
eclipse-threadx/getting-started
C++
Other
310
/* ubi_wl_close - close the wear-leveling sub-system. @ubi: UBI device description object */
void ubi_wl_close(struct ubi_device *ubi)
/* ubi_wl_close - close the wear-leveling sub-system. @ubi: UBI device description object */ void ubi_wl_close(struct ubi_device *ubi)
{ dbg_wl("close the WL sub-system"); ubi_fastmap_close(ubi); shutdown_work(ubi); protection_queue_destroy(ubi); tree_destroy(ubi, &ubi->used); tree_destroy(ubi, &ubi->erroneous); tree_destroy(ubi, &ubi->free); tree_destroy(ubi, &ubi->scrub); kfree(ubi->lookuptbl); }
4ms/stm32mp1-baremetal
C++
Other
137
/* paging_init() sets up the page tables, initialises the zone memory maps, and sets up the zero page, bad page and bad page tables. */
void __init paging_init(struct machine_desc *mdesc)
/* paging_init() sets up the page tables, initialises the zone memory maps, and sets up the zero page, bad page and bad page tables. */ void __init paging_init(struct machine_desc *mdesc)
{ void *zero_page; build_mem_type_table(); sanity_check_meminfo(); prepare_page_table(); bootmem_init(); devicemaps_init(mdesc); kmap_init(); top_pmd = pmd_off_k(0xffff0000); zero_page = alloc_bootmem_low_pages(PAGE_SIZE); empty_zero_page = virt_to_page(zero_page); __flush_dcache_page(NULL, empty_zero_page); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Clear the time-base counter reached its maximum value flag of selected channel. */
void EPWM_ClearWrapAroundFlag(EPWM_T *epwm, uint32_t u32ChannelNum)
/* Clear the time-base counter reached its maximum value flag of selected channel. */ void EPWM_ClearWrapAroundFlag(EPWM_T *epwm, uint32_t u32ChannelNum)
{ (epwm)->STATUS = (EPWM_STATUS_CNTMAXF0_Msk << u32ChannelNum); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initializes the SDIO peripheral according to the specified parameters in the SDIO_InitStruct. */
void SDIO_Init(SDIO_InitType *SDIO_InitStruct)
/* Initializes the SDIO peripheral according to the specified parameters in the SDIO_InitStruct. */ void SDIO_Init(SDIO_InitType *SDIO_InitStruct)
{ uint32_t tmpregister = 0; assert_param(IS_SDIO_CLK_EDGE(SDIO_InitStruct->ClkEdge)); assert_param(IS_SDIO_CLK_BYPASS(SDIO_InitStruct->ClkBypass)); assert_param(IS_SDIO_CLK_POWER_SAVE(SDIO_InitStruct->ClkPwrSave)); assert_param(IS_SDIO_BUS_WIDTH(SDIO_InitStruct->BusWidth)); assert_param(IS_SDIO_HARDWARE_CLKCTRL(SDIO_InitStruct->HardwareClkCtrl)); tmpregister = SDIO->CLKCTRL; tmpregister &= CLKCTRL_CLR_MASK; tmpregister |= (SDIO_InitStruct->ClkDiv | SDIO_InitStruct->ClkPwrSave | SDIO_InitStruct->ClkBypass | SDIO_InitStruct->BusWidth | SDIO_InitStruct->ClkEdge | SDIO_InitStruct->HardwareClkCtrl); SDIO->CLKCTRL = tmpregister; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Copy a buffer from user memory area to packet memory area (PMA) */
void USB_CopyPMAToUserBuf(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes)
/* Copy a buffer from user memory area to packet memory area (PMA) */ void USB_CopyPMAToUserBuf(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes)
{ uint32_t n = (wNBytes + 1) >> 1; uint32_t i; uint32_t* pdwVal; pdwVal = (uint32_t*)(wPMABufAddr * 2 + PMAAddr); for (i = n; i != 0; i--) { *(uint16_t*)pbUsrBuf++ = *pdwVal++; pbUsrBuf++; EpOutDataPtrTmp = pbUsrBuf; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Unblocks lu->tgt as soon as all its logical units can be unblocked. Note, it is harmless to run scsi_unblock_requests() outside the card->lock protected section. On the other hand, running it inside the section might clash with shost->host_lock. */
static void sbp2_conditionally_unblock(struct sbp2_logical_unit *lu)
/* Unblocks lu->tgt as soon as all its logical units can be unblocked. Note, it is harmless to run scsi_unblock_requests() outside the card->lock protected section. On the other hand, running it inside the section might clash with shost->host_lock. */ static void sbp2_conditionally_unblock(struct sbp2_logical_unit *lu)
{ struct sbp2_target *tgt = lu->tgt; struct fw_card *card = target_device(tgt)->card; struct Scsi_Host *shost = container_of((void *)tgt, struct Scsi_Host, hostdata[0]); unsigned long flags; bool unblock = false; spin_lock_irqsave(&card->lock, flags); if (lu->blocked && lu->generation == card->generation) { lu->blocked = false; unblock = --tgt->blocked == 0; } spin_unlock_irqrestore(&card->lock, flags); if (unblock) scsi_unblock_requests(shost); }
robutest/uclinux
C++
GPL-2.0
60
/* The check summ offload engine is enabled to do TCPIP checsum assuming Pseudo header is available. Hardware computes the tcp ip checksum assuming pseudo header checksum is computed in software. Ipv4 header checksum is also inserted. */
void synopGMAC_tx_checksum_offload_tcponly(synopGMACdevice *gmacdev, DmaDesc *desc)
/* The check summ offload engine is enabled to do TCPIP checsum assuming Pseudo header is available. Hardware computes the tcp ip checksum assuming pseudo header checksum is computed in software. Ipv4 header checksum is also inserted. */ void synopGMAC_tx_checksum_offload_tcponly(synopGMACdevice *gmacdev, DmaDesc *desc)
{ desc->status = ((desc->status & (~DescTxCisMask)) | DescTxCisTcpOnlyCs); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Fill in the required fields of the "manager kprobe". Replace the earlier kprobe in the hlist with the manager kprobe */
static void add_aggr_kprobe(struct kprobe *ap, struct kprobe *p)
/* Fill in the required fields of the "manager kprobe". Replace the earlier kprobe in the hlist with the manager kprobe */ static void add_aggr_kprobe(struct kprobe *ap, struct kprobe *p)
{ copy_kprobe(p, ap); flush_insn_slot(ap); ap->addr = p->addr; ap->flags = p->flags; ap->pre_handler = aggr_pre_handler; ap->fault_handler = aggr_fault_handler; if (p->post_handler && !kprobe_gone(p)) ap->post_handler = aggr_post_handler; if (p->break_handler && !kprobe_gone(p)) ap->break_handler = aggr_break_handler; INIT_LIST_HEAD(&ap->list); list_add_rcu(&p->list, &ap->list); hlist_replace_rcu(&p->hlist, &ap->hlist); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Converts a text device path node to Fibre device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextFibre(CHAR16 *TextDeviceNode)
/* Converts a text device path node to Fibre device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextFibre(CHAR16 *TextDeviceNode)
{ CHAR16 *WWNStr; CHAR16 *LunStr; FIBRECHANNEL_DEVICE_PATH *Fibre; WWNStr = GetNextParamStr (&TextDeviceNode); LunStr = GetNextParamStr (&TextDeviceNode); Fibre = (FIBRECHANNEL_DEVICE_PATH *) CreateDeviceNode ( MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, (UINT16) sizeof (FIBRECHANNEL_DEVICE_PATH) ); Fibre->Reserved = 0; Strtoi64 (WWNStr, &Fibre->WWN); Strtoi64 (LunStr, &Fibre->Lun); return (EFI_DEVICE_PATH_PROTOCOL *) Fibre; }
tianocore/edk2
C++
Other
4,240
/* Enables or disables the RTC clock to be output through the relative pin. */
void RTC_CalibOutputCmd(FunctionalState NewState)
/* Enables or disables the RTC clock to be output through the relative pin. */ void RTC_CalibOutputCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); RTC->WPR = 0xCA; RTC->WPR = 0x53; if (NewState != DISABLE) { RTC->CR |= (uint32_t)RTC_CR_COE; } else { RTC->CR &= (uint32_t)~RTC_CR_COE; } RTC->WPR = 0xFF; }
MaJerle/stm32f429
C++
null
2,036
/* Show an out of memory error on the display. Shows a full screen error when called, signaling that the system ran out of memory when initializing a WTK application. */
static void show_out_of_memory_error(void)
/* Show an out of memory error on the display. Shows a full screen error when called, signaling that the system ran out of memory when initializing a WTK application. */ static void show_out_of_memory_error(void)
{ const char memory_string[] = "OUT OF MEMORY"; gfx_coord_t disp_width, disp_height; disp_width = gfx_get_width(); disp_height = gfx_get_height(); gfx_set_clipping(0, 0, disp_width, disp_height); gfx_draw_filled_rect(0, 0, disp_width, disp_height, GFX_COLOR_BLACK); gfx_draw_string_aligned(memory_string, disp_width / 2, disp_height / 2, &sysfont, GFX_COLOR_TRANSPARENT, GFX_COLOR_RED, TEXT_POS_CENTER, TEXT_ALIGN_CENTER); }
memfault/zero-to-main
C++
null
200
/* Go through the free lists for the given migratetype and remove the smallest available page from the freelists */
static struct page* __rmqueue_smallest(struct zone *zone, unsigned int order, int migratetype)
/* Go through the free lists for the given migratetype and remove the smallest available page from the freelists */ static struct page* __rmqueue_smallest(struct zone *zone, unsigned int order, int migratetype)
{ unsigned int current_order; struct free_area * area; struct page *page; for (current_order = order; current_order < MAX_ORDER; ++current_order) { area = &(zone->free_area[current_order]); if (list_empty(&area->free_list[migratetype])) continue; page = list_entry(area->free_list[migratetype].next, struct page, lru); list_del(&page->lru); rmv_page_order(page); area->nr_free--; expand(zone, page, order, current_order, area, migratetype); return page; } return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Get USB Device Last Frame Number Parameters: None Return Value: Frame Number */
uint32_t USBD_GetFrame(void)
/* Get USB Device Last Frame Number Parameters: None Return Value: Frame Number */ uint32_t USBD_GetFrame(void)
{ return (USBHSD->INFO & USBHSD_INFO_FRAME_NR_MASK); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* reverse map access control for MR/MW. This routine is used for MR and MW. */
void ehca_mrmw_reverse_map_acl(const u32 *hipz_acl, int *ib_acl)
/* reverse map access control for MR/MW. This routine is used for MR and MW. */ void ehca_mrmw_reverse_map_acl(const u32 *hipz_acl, int *ib_acl)
{ *ib_acl = 0; if (*hipz_acl & HIPZ_ACCESSCTRL_R_READ) *ib_acl |= IB_ACCESS_REMOTE_READ; if (*hipz_acl & HIPZ_ACCESSCTRL_R_WRITE) *ib_acl |= IB_ACCESS_REMOTE_WRITE; if (*hipz_acl & HIPZ_ACCESSCTRL_R_ATOMIC) *ib_acl |= IB_ACCESS_REMOTE_ATOMIC; if (*hipz_acl & HIPZ_ACCESSCTRL_L_WRITE) *ib_acl |= IB_ACCESS_LOCAL_WRITE; if (*hipz_acl & HIPZ_ACCESSCTRL_MW_BIND) *ib_acl |= IB_ACCESS_MW_BIND; }
robutest/uclinux
C++
GPL-2.0
60
/* Creates an events for the Architectural Protocols and the optional protocols that are fired everytime a Protocol of a specific type is installed. */
VOID CoreNotifyOnProtocolInstallation(VOID)
/* Creates an events for the Architectural Protocols and the optional protocols that are fired everytime a Protocol of a specific type is installed. */ VOID CoreNotifyOnProtocolInstallation(VOID)
{ CoreNotifyOnProtocolEntryTable (mArchProtocols); CoreNotifyOnProtocolEntryTable (mOptionalProtocols); }
tianocore/edk2
C++
Other
4,240
/* VW channel enable asserted flag. A 0-to-1 or 1-to-0 transition on "Virtual Wire Channel Enable" bit. */
static void espi_it8xxx2_vw_ch_en_isr(const struct device *dev, bool enable)
/* VW channel enable asserted flag. A 0-to-1 or 1-to-0 transition on "Virtual Wire Channel Enable" bit. */ static void espi_it8xxx2_vw_ch_en_isr(const struct device *dev, bool enable)
{ espi_it8xxx2_ch_notify_system_state(dev, ESPI_CHANNEL_VWIRE, enable); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Delete a Semaphore that was created by osSemaphoreCreate. */
osStatus osSemaphoreDelete(osSemaphoreId semaphore_id)
/* Delete a Semaphore that was created by osSemaphoreCreate. */ osStatus osSemaphoreDelete(osSemaphoreId semaphore_id)
{ vSemaphoreDelete(sem->sem); sem->sem = NULL; return osOK; } else { return osErrorParameter; } }
labapart/polymcu
C++
null
201
/* Registers a callback function that the EBC interpreter calls to flush the processor instruction cache following creation of thunks. */
EFI_STATUS EFIAPI EbcRegisterICacheFlush(IN EFI_EBC_PROTOCOL *This, IN EBC_ICACHE_FLUSH Flush)
/* Registers a callback function that the EBC interpreter calls to flush the processor instruction cache following creation of thunks. */ EFI_STATUS EFIAPI EbcRegisterICacheFlush(IN EFI_EBC_PROTOCOL *This, IN EBC_ICACHE_FLUSH Flush)
{ mEbcICacheFlush = Flush; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* This file is part of the Simba project. */
int mock_write_service_module_init(int res)
/* This file is part of the Simba project. */ int mock_write_service_module_init(int res)
{ harness_mock_write("service_module_init()", NULL, 0); harness_mock_write("service_module_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* Prompt the user, read a line, and push it into the Lua stack. */
static int pushline(lua_State *L, int firstline)
/* Prompt the user, read a line, and push it into the Lua stack. */ static int pushline(lua_State *L, int firstline)
{0}; char *b = buffer; size_t l; const char *prmt = get_prompt(L, firstline); int readstatus = lua_readline(L, b, prmt); if (readstatus == 0) { return 0; } lua_pop(L, 1); l = strlen(b); if (l > 0 && b[l-1] == '\n') { b[--l] = '\0'; } if (firstline && b[0] == '=') { lua_pushfstring(L, "return %s", b + 1); } else { lua_pushlstring(L, b, l); } return 1; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Returns success (0) or appropriate error code (none as of now) */
static void emac_set_type0addr(struct emac_priv *priv, u32 ch, char *mac_addr)
/* Returns success (0) or appropriate error code (none as of now) */ static void emac_set_type0addr(struct emac_priv *priv, u32 ch, char *mac_addr)
{ u32 val; val = ((mac_addr[5] << 8) | (mac_addr[4])); emac_write(EMAC_MACSRCADDRLO, val); val = ((mac_addr[3] << 24) | (mac_addr[2] << 16) | \ (mac_addr[1] << 8) | (mac_addr[0])); emac_write(EMAC_MACSRCADDRHI, val); val = emac_read(EMAC_RXUNICASTSET); val |= BIT(ch); emac_write(EMAC_RXUNICASTSET, val); val = emac_read(EMAC_RXUNICASTCLEAR); val &= ~BIT(ch); emac_write(EMAC_RXUNICASTCLEAR, val); }
robutest/uclinux
C++
GPL-2.0
60
/* Add two values in F255. Partial reduction is performed (down to less than twice the modulus). */
static void f255_add(uint32_t *d, const uint32_t *a, const uint32_t *b)
/* Add two values in F255. Partial reduction is performed (down to less than twice the modulus). */ static void f255_add(uint32_t *d, const uint32_t *a, const uint32_t *b)
{ int i; uint32_t cc, w; cc = 0; for (i = 0; i < 9; i ++) { w = a[i] + b[i] + cc; d[i] = w & 0x3FFFFFFF; cc = w >> 30; } cc = MUL15(w >> 15, 19); d[8] &= 0x7FFF; for (i = 0; i < 9; i ++) { w = d[i] + cc; d[i] = w & 0x3FFFFFFF; cc = w >> 30; } }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* For regular files, no data transfer shall occur past the offset maximum established in the open file description associated with aiocbp->aio_fildes. */
int aio_write(struct aiocb *cb)
/* For regular files, no data transfer shall occur past the offset maximum established in the open file description associated with aiocbp->aio_fildes. */ int aio_write(struct aiocb *cb)
{ int oflags; rt_ubase_t level; if (!cb || (cb->aio_buf == NULL)) return -EINVAL; oflags = fcntl(cb->aio_fildes, F_GETFL, 0); if ((oflags & O_ACCMODE) != O_WRONLY || (oflags & O_ACCMODE) != O_RDWR) return -EINVAL; level = rt_hw_interrupt_disable(); cb->aio_result = -EINPROGRESS; rt_hw_interrupt_enable(level); rt_work_init(&(cb->aio_work), aio_write_work, cb); rt_workqueue_dowork(aio_queue, &(cb->aio_work)); return 0; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Copy an openpromio structure into kernel space from user space. This routine does error checking to make sure that all memory accesses are within bounds. A pointer to the allocated openpromio structure will be placed in "*opp_p". Return value is the length of the user supplied buffer. */
static int copyin(struct openpromio __user *info, struct openpromio **opp_p)
/* Copy an openpromio structure into kernel space from user space. This routine does error checking to make sure that all memory accesses are within bounds. A pointer to the allocated openpromio structure will be placed in "*opp_p". Return value is the length of the user supplied buffer. */ static int copyin(struct openpromio __user *info, struct openpromio **opp_p)
{ unsigned int bufsize; if (!info || !opp_p) return -EFAULT; if (get_user(bufsize, &info->oprom_size)) return -EFAULT; if (bufsize == 0) return -EINVAL; if (bufsize > OPROMMAXPARAM) bufsize = OPROMMAXPARAM; if (!(*opp_p = kzalloc(sizeof(int) + bufsize + 1, GFP_KERNEL))) return -ENOMEM; if (copy_from_user(&(*opp_p)->oprom_array, &info->oprom_array, bufsize)) { kfree(*opp_p); return -EFAULT; } return bufsize; }
robutest/uclinux
C++
GPL-2.0
60
/* The eventfd context reference must have been previously acquired either with eventfd_ctx_get() or eventfd_ctx_fdget()). */
void eventfd_ctx_put(struct eventfd_ctx *ctx)
/* The eventfd context reference must have been previously acquired either with eventfd_ctx_get() or eventfd_ctx_fdget()). */ void eventfd_ctx_put(struct eventfd_ctx *ctx)
{ kref_put(&ctx->kref, eventfd_free); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the LSB of the 9-bit can Transmit Error Counter(TEC). */
u8 CAN_Peli_GetLSBTransmitErrorCounter(void)
/* Returns the LSB of the 9-bit can Transmit Error Counter(TEC). */ u8 CAN_Peli_GetLSBTransmitErrorCounter(void)
{ return (u8)(CAN1_PELI->TXERR); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Unregisters callback for the specified callback type. Removes the currently registered callback for the given callback type. */
void i2c_slave_unregister_callback(struct i2c_slave_module *const module, enum i2c_slave_callback callback_type)
/* Unregisters callback for the specified callback type. Removes the currently registered callback for the given callback type. */ void i2c_slave_unregister_callback(struct i2c_slave_module *const module, enum i2c_slave_callback callback_type)
{ Assert(module); Assert(module->hw); module->callbacks[callback_type] = NULL; module->registered_callback &= ~(1 << callback_type); }
memfault/zero-to-main
C++
null
200
/* Return value: the new copy of the path. If there is insufficient memory a pointer to a special static nil #cairo_path_t will be returned instead with status==CAIRO_STATUS_NO_MEMORY and data==NULL. */
cairo_path_t* _cairo_path_create(cairo_path_fixed_t *path, cairo_t *cr)
/* Return value: the new copy of the path. If there is insufficient memory a pointer to a special static nil #cairo_path_t will be returned instead with status==CAIRO_STATUS_NO_MEMORY and data==NULL. */ cairo_path_t* _cairo_path_create(cairo_path_fixed_t *path, cairo_t *cr)
{ return _cairo_path_create_internal (path, cr, FALSE); }
xboot/xboot
C++
MIT License
779
/* nlmsvc_is_client: returns 1 iff the host is a client. Used by nlmsvc_invalidate_all */
static int nlmsvc_mark_host(void *data, struct nlm_host *dummy)
/* nlmsvc_is_client: returns 1 iff the host is a client. Used by nlmsvc_invalidate_all */ static int nlmsvc_mark_host(void *data, struct nlm_host *dummy)
{ struct nlm_host *host = data; host->h_inuse = 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables I2C Extended Clock Timeout (SCL cumulative Timeout detection). */
void I2C_ExtendedClockTimeoutCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
/* Enables or disables I2C Extended Clock Timeout (SCL cumulative Timeout detection). */ void I2C_ExtendedClockTimeoutCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
{ assert_param(IS_I2C_ALL_PERIPH(I2Cx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { I2Cx->TIMEOUTR |= I2C_TIMEOUTR_TEXTEN; } else { I2Cx->TIMEOUTR &= (uint32_t)~((uint32_t)I2C_TIMEOUTR_TEXTEN); } }
ajhc/demo-cortex-m3
C++
null
38
/* This function returns %1 if @lnum:@offs matches, and %0 otherwise. */
static int matches_position(struct ubifs_zbranch *zbr, int lnum, int offs)
/* This function returns %1 if @lnum:@offs matches, and %0 otherwise. */ static int matches_position(struct ubifs_zbranch *zbr, int lnum, int offs)
{ if (zbr->lnum == lnum && zbr->offs == offs) return 1; else return 0; }
EmcraftSystems/u-boot
C++
Other
181
/* Called on completion of any requests the driver itself submitted for EP0 setup packets */
static void s3c_hsotg_complete_setup(struct usb_ep *ep, struct usb_request *req)
/* Called on completion of any requests the driver itself submitted for EP0 setup packets */ static void s3c_hsotg_complete_setup(struct usb_ep *ep, struct usb_request *req)
{ struct s3c_hsotg_ep *hs_ep = our_ep(ep); struct s3c_hsotg *hsotg = hs_ep->parent; if (req->status < 0) { dev_dbg(hsotg->dev, "%s: failed %d\n", __func__, req->status); return; } spin_lock(&hsotg->lock); if (req->actual == 0) s3c_hsotg_enqueue_setup(hsotg); else s3c_hsotg_process_control(hsotg, req->buf); spin_unlock(&hsotg->lock); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Library-wide function for pruning the DNS cache. This function takes and returns the appropriate locks. */
void Curl_hostcache_prune(struct Curl_easy *data)
/* Library-wide function for pruning the DNS cache. This function takes and returns the appropriate locks. */ void Curl_hostcache_prune(struct Curl_easy *data)
{ time_t now; if((data->set.dns_cache_timeout == -1) || !data->dns.hostcache) return; if(data->share) Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); time(&now); hostcache_prune(data->dns.hostcache, data->set.dns_cache_timeout, now); if(data->share) Curl_share_unlock(data, CURL_LOCK_DATA_DNS); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function will initialize a timer normally this function is used to initialize a static timer object. */
void rt_timer_init(rt_timer_t timer, const char *name, void(*timeout)(void *parameter), void *parameter, rt_tick_t time, rt_uint8_t flag)
/* This function will initialize a timer normally this function is used to initialize a static timer object. */ void rt_timer_init(rt_timer_t timer, const char *name, void(*timeout)(void *parameter), void *parameter, rt_tick_t time, rt_uint8_t flag)
{ RT_ASSERT(timer != RT_NULL); rt_object_init(&(timer->parent), RT_Object_Class_Timer, name); _rt_timer_init(timer, timeout, parameter, time, flag); }
pikasTech/PikaPython
C++
MIT License
1,403
/* This method will free @invocation, you cannot use it afterwards. */
void _g_freedesktop_dbus_complete_hello(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation, const gchar *assigned_name)
/* This method will free @invocation, you cannot use it afterwards. */ void _g_freedesktop_dbus_complete_hello(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation, const gchar *assigned_name)
{ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", assigned_name)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI MnpComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */ EFI_STATUS EFIAPI MnpComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mMnpDriverNameTable, DriverName, (BOOLEAN)(This == &gMnpComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* Directs the Protocol Layer to construct and transmit a Power Delivery Data message. */
void prl_send_data_msg(const struct device *dev, const enum pd_packet_type type, const enum pd_data_msg_type msg)
/* Directs the Protocol Layer to construct and transmit a Power Delivery Data message. */ void prl_send_data_msg(const struct device *dev, const enum pd_packet_type type, const enum pd_data_msg_type msg)
{ struct usbc_port_data *data = dev->data; struct protocol_layer_tx_t *prl_tx = data->prl_tx; prl_tx->emsg.type = type; prl_tx->msg_type = msg; atomic_set_bit(&prl_tx->flags, PRL_FLAGS_MSG_XMIT); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Set the fields of structure stc_tmr6_deadtime_config_t to default values. */
int32_t TMR6_DeadTimeStructInit(stc_tmr6_deadtime_config_t *pstcDeadTimeConfig)
/* Set the fields of structure stc_tmr6_deadtime_config_t to default values. */ int32_t TMR6_DeadTimeStructInit(stc_tmr6_deadtime_config_t *pstcDeadTimeConfig)
{ int32_t i32Ret = LL_ERR_INVD_PARAM; if (NULL != pstcDeadTimeConfig) { pstcDeadTimeConfig->u32EqualUpDown = TMR6_DEADTIME_EQUAL_OFF; pstcDeadTimeConfig->u32BufUp = TMR6_DEADTIME_CNT_UP_BUF_OFF; pstcDeadTimeConfig->u32BufDown = TMR6_DEADTIME_CNT_DOWN_BUF_OFF; i32Ret = LL_OK; } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Functions which are registered to receive notification of database events have this prototype. The actual event is encoded in NotifyType. The following table describes how PackageType, PackageGuid, Handle, and Package are used for each of the notification types. */
EFI_STATUS EFIAPI FormUpdateNotify(IN UINT8 PackageType, IN CONST EFI_GUID *PackageGuid, IN CONST EFI_HII_PACKAGE_HEADER *Package, IN EFI_HII_HANDLE Handle, IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType)
/* Functions which are registered to receive notification of database events have this prototype. The actual event is encoded in NotifyType. The following table describes how PackageType, PackageGuid, Handle, and Package are used for each of the notification types. */ EFI_STATUS EFIAPI FormUpdateNotify(IN UINT8 PackageType, IN CONST EFI_GUID *PackageGuid, IN CONST EFI_HII_PACKAGE_HEADER *Package, IN EFI_HII_HANDLE Handle, IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType)
{ mHiiPackageListUpdated = TRUE; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Disable control interrupts on a given USB controller. */
void USBIntDisableControl(unsigned long ulBase, unsigned long ulFlags)
/* Disable control interrupts on a given USB controller. */ void USBIntDisableControl(unsigned long ulBase, unsigned long ulFlags)
{ ASSERT(ulBase == USB0_BASE); ASSERT((ulFlags & ~(USB_INTCTRL_ALL)) == 0); if(ulFlags & USB_INTCTRL_STATUS) { HWREGB(ulBase + USB_O_IE) &= ~(ulFlags & USB_INTCTRL_STATUS); } if(ulFlags & USB_INTCTRL_POWER_FAULT) { HWREG(ulBase + USB_O_EPCIM) = 0; } if(ulFlags & USB_INTCTRL_MODE_DETECT) { HWREG(USB0_BASE + USB_O_IDVIM) = 0; } }
watterott/WebRadio
C++
null
71
/* sh_dma_free_chan_resources - Free all resources of the channel. */
static void sh_dmae_free_chan_resources(struct dma_chan *chan)
/* sh_dma_free_chan_resources - Free all resources of the channel. */ static void sh_dmae_free_chan_resources(struct dma_chan *chan)
{ struct sh_dmae_chan *sh_chan = to_sh_chan(chan); struct sh_desc *desc, *_desc; LIST_HEAD(list); if (!list_empty(&sh_chan->ld_queue)) sh_dmae_chan_ld_cleanup(sh_chan, true); spin_lock_bh(&sh_chan->desc_lock); list_splice_init(&sh_chan->ld_free, &list); sh_chan->descs_allocated = 0; spin_unlock_bh(&sh_chan->desc_lock); list_for_each_entry_safe(desc, _desc, &list, node) kfree(desc); }
robutest/uclinux
C++
GPL-2.0
60
/* Fast processing for the common case of 2:1 horizontal and 1:1 vertical. It's still a box filter. */
h2v1_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
/* Fast processing for the common case of 2:1 horizontal and 1:1 vertical. It's still a box filter. */ h2v1_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
{ JSAMPARRAY output_data = *output_data_ptr; register JSAMPROW inptr, outptr; register JSAMPLE invalue; JSAMPROW outend; int inrow; for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) { inptr = input_data[inrow]; outptr = output_data[inrow]; outend = outptr + cinfo->output_width; while (outptr < outend) { invalue = *inptr++; *outptr++ = invalue; *outptr++ = invalue; } } }
nanoframework/nf-interpreter
C++
MIT License
293
/* The function is to Enable Bandgap In VLPx Operation or not. */
void SysCtlBandgapEnable(xtBoolean bEnable)
/* The function is to Enable Bandgap In VLPx Operation or not. */ void SysCtlBandgapEnable(xtBoolean bEnable)
{ if(bEnable) { xHWREGB(PMC_REGSC) |= PMC_REGSC_BGEN; } else { xHWREGB(PMC_REGSC) &= ~PMC_REGSC_BGEN; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Packet counting of FACK is based on in-order assumptions, therefore TCP disables it when reordering is detected */
static void tcp_disable_fack(struct tcp_sock *tp)
/* Packet counting of FACK is based on in-order assumptions, therefore TCP disables it when reordering is detected */ static void tcp_disable_fack(struct tcp_sock *tp)
{ if (tcp_is_fack(tp)) tp->lost_skb_hint = NULL; tp->rx_opt.sack_ok &= ~2; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns a vector_desc entry for an intno/cpu. Either returns a preexisting one or allocates a new one and inserts it into the list. Returns NULL on malloc fail. */
static struct vector_desc_t* get_desc_for_int(int intno, int cpu)
/* Returns a vector_desc entry for an intno/cpu. Either returns a preexisting one or allocates a new one and inserts it into the list. Returns NULL on malloc fail. */ static struct vector_desc_t* get_desc_for_int(int intno, int cpu)
{ struct vector_desc_t *vd = find_desc_for_int(intno, cpu); if (vd == NULL) { struct vector_desc_t *newvd = k_malloc(sizeof(struct vector_desc_t)); if (newvd == NULL) { return NULL; } memset(newvd, 0, sizeof(struct vector_desc_t)); newvd->intno = intno; newvd->cpu = cpu; insert_vector_desc(newvd); return newvd; } else { return vd; } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* combine_8_to_16() utility function to munge to u8s into u16 */
static u16 combine_8_to_16(u8 lower, u8 upper)
/* combine_8_to_16() utility function to munge to u8s into u16 */ static u16 combine_8_to_16(u8 lower, u8 upper)
{ u16 _lower = lower; u16 _upper = upper; return _lower | (_upper << 8); }
robutest/uclinux
C++
GPL-2.0
60
/* this function is a POSIX compliant version, which will reset directory stream. */
void rewinddir(DIR *d)
/* this function is a POSIX compliant version, which will reset directory stream. */ void rewinddir(DIR *d)
{ struct dfs_file *fd; fd = fd_get(d->fd); if (fd == NULL) { rt_set_errno(-EBADF); return ; } if (dfs_file_lseek(fd, 0) >= 0) d->num = d->cur = 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Retrieves a list of devices used by a particular dm device. */
static void retrieve_deps(struct dm_table *table, struct dm_ioctl *param, size_t param_size)
/* Retrieves a list of devices used by a particular dm device. */ static void retrieve_deps(struct dm_table *table, struct dm_ioctl *param, size_t param_size)
{ unsigned int count = 0; struct list_head *tmp; size_t len, needed; struct dm_dev_internal *dd; struct dm_target_deps *deps; deps = get_result_buffer(param, param_size, &len); list_for_each (tmp, dm_table_get_devices(table)) count++; needed = sizeof(*deps) + (sizeof(*deps->dev) * count); if (len < needed) { param->flags |= DM_BUFFER_FULL_FLAG; return; } deps->count = count; count = 0; list_for_each_entry (dd, dm_table_get_devices(table), list) deps->dev[count++] = huge_encode_dev(dd->dm_dev.bdev->bd_dev); param->data_size = param->data_start + needed; }
robutest/uclinux
C++
GPL-2.0
60
/* Check if GPDMA channel is enabled or disabled. */
uint32_t GPDMA_ChannelGetStatus(uint8_t ch)
/* Check if GPDMA channel is enabled or disabled. */ uint32_t GPDMA_ChannelGetStatus(uint8_t ch)
{ return 0U; }; if (Channel_active & (1 << ch)) { return 1U; } else { return 0U; } }
labapart/polymcu
C++
null
201
/* Updates the touch screen threshhold level and saves it to EEPROM. */
int tsSetThreshhold(uint8_t value)
/* Updates the touch screen threshhold level and saves it to EEPROM. */ int tsSetThreshhold(uint8_t value)
{ if ((value < 0) || (value > 254)) { return -1; } _tsThreshhold = value; eepromWriteU8(CFG_EEPROM_TOUCHSCREEN_THRESHHOLD, value); return 0; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Returns : OK if initialize interrupt manager succeeded, others if failed. */
s32 interrupt_init(void)
/* Returns : OK if initialize interrupt manager succeeded, others if failed. */ s32 interrupt_init(void)
{ s32 index; intc_init(); for (index = 0; index < SUNXI_RINTC_IRQ_SOURCE_MAX; index++) { isr_table[index].pisr = isr_default; isr_table[index].parg = NULL; } return OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Deinitializes the ADCx peripheral registers to their default reset values. */
void ADC_DeInit(ADC_TypeDef *ADCx)
/* Deinitializes the ADCx peripheral registers to their default reset values. */ void ADC_DeInit(ADC_TypeDef *ADCx)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); switch (*(uint32_t*)&ADCx) { case ADC1_BASE: RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC1, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC1, DISABLE); break; case ADC2_BASE: RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC2, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC2, DISABLE); break; default: break; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base Pointer to the FLEXIO_UART_Type structure. param mask Status flag. The parameter can be any combination of the following values: arg kFLEXIO_UART_TxDataRegEmptyFlag arg kFLEXIO_UART_RxEmptyFlag arg kFLEXIO_UART_RxOverRunFlag */
void FLEXIO_UART_ClearStatusFlags(FLEXIO_UART_Type *base, uint32_t mask)
/* param base Pointer to the FLEXIO_UART_Type structure. param mask Status flag. The parameter can be any combination of the following values: arg kFLEXIO_UART_TxDataRegEmptyFlag arg kFLEXIO_UART_RxEmptyFlag arg kFLEXIO_UART_RxOverRunFlag */ void FLEXIO_UART_ClearStatusFlags(FLEXIO_UART_Type *base, uint32_t mask)
{ if (mask & kFLEXIO_UART_TxDataRegEmptyFlag) { FLEXIO_ClearShifterStatusFlags(base->flexioBase, 1U << base->shifterIndex[0]); } if (mask & kFLEXIO_UART_RxDataRegFullFlag) { FLEXIO_ClearShifterStatusFlags(base->flexioBase, 1U << base->shifterIndex[1]); } if (mask & kFLEXIO_UART_RxOverRunFlag) { FLEXIO_ClearShifterErrorFlags(base->flexioBase, 1U << base->shifterIndex[1]); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return the maximum data that can be queued in one go on a given endpoint so that transfers that are too long can be split. */
static unsigned get_ep_limit(struct s3c_hsotg_ep *hs_ep)
/* Return the maximum data that can be queued in one go on a given endpoint so that transfers that are too long can be split. */ static unsigned get_ep_limit(struct s3c_hsotg_ep *hs_ep)
{ int index = hs_ep->index; unsigned maxsize; unsigned maxpkt; if (index != 0) { maxsize = DXEPTSIZ_XFERSIZE_LIMIT + 1; maxpkt = DXEPTSIZ_PKTCNT_LIMIT + 1; } else { maxsize = 64+64; if (hs_ep->dir_in) maxpkt = DIEPTSIZ0_PKTCNT_LIMIT + 1; else maxpkt = 2; } maxpkt--; maxsize--; if ((maxpkt * hs_ep->ep.maxpacket) < maxsize) maxsize = maxpkt * hs_ep->ep.maxpacket; return maxsize; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function fixes up the interrupt value for platform ports as it couldn't be done earlier before interrupt maps have been parsed. It also "corrects" the IO address for PIO ports for the same reason, since earlier, the PHBs virtual IO space wasn't assigned yet. It then registers all those platform ports for use by the 8250 driver when it finally loads. */
static int __init serial_dev_init(void)
/* This function fixes up the interrupt value for platform ports as it couldn't be done earlier before interrupt maps have been parsed. It also "corrects" the IO address for PIO ports for the same reason, since earlier, the PHBs virtual IO space wasn't assigned yet. It then registers all those platform ports for use by the 8250 driver when it finally loads. */ static int __init serial_dev_init(void)
{ int i; if (legacy_serial_count == 0) return -ENODEV; DBG("Fixing serial ports interrupts and IO ports ...\n"); for (i = 0; i < legacy_serial_count; i++) { struct plat_serial8250_port *port = &legacy_serial_ports[i]; struct device_node *np = legacy_serial_infos[i].np; if (port->irq == NO_IRQ) fixup_port_irq(i, np, port); if (port->iotype == UPIO_PORT) fixup_port_pio(i, np, port); if ((port->iotype == UPIO_MEM) || (port->iotype == UPIO_TSI)) fixup_port_mmio(i, np, port); } DBG("Registering platform serial ports\n"); return platform_device_register(&serial_device); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reads and returns the current IDTR descriptor and returns it in Idtr. This function is only available on IA-32 and X64. */
VOID EFIAPI InternalX86ReadIdtr(OUT IA32_DESCRIPTOR *Idtr)
/* Reads and returns the current IDTR descriptor and returns it in Idtr. This function is only available on IA-32 and X64. */ VOID EFIAPI InternalX86ReadIdtr(OUT IA32_DESCRIPTOR *Idtr)
{ __asm__ __volatile__ ( "sidt %0" : "=m" (*Idtr) ); }
tianocore/edk2
C++
Other
4,240
/* Simple non-static link routines (i.e. referenced outside this file) */
int tipc_link_is_up(struct link *l_ptr)
/* Simple non-static link routines (i.e. referenced outside this file) */ int tipc_link_is_up(struct link *l_ptr)
{ if (!l_ptr) return 0; return (link_working_working(l_ptr) || link_working_unknown(l_ptr)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Toggles the LED at a fixed time interval. */
void LedToggle(void)
/* Toggles the LED at a fixed time interval. */ void LedToggle(void)
{ static unsigned char led_toggle_state = 0; static unsigned long timer_counter_last = 0; unsigned long timer_counter_now; timer_counter_now = TimerGet(); if ( (timer_counter_now - timer_counter_last) < LED_TOGGLE_MS) { return; } if (led_toggle_state == 0) { led_toggle_state = 1; HAL_GPIO_WritePin(GPIOE, GPIO_PIN_8, GPIO_PIN_SET); } else { led_toggle_state = 0; HAL_GPIO_WritePin(GPIOE, GPIO_PIN_8, GPIO_PIN_RESET); } timer_counter_last = timer_counter_now; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Command response callback function for sd_ble_gap_adv_start BLE command. Callback for decoding the command response return code. */
static uint32_t gap_adv_start_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ble_gap_adv_start BLE command. Callback for decoding the command response return code. */ static uint32_t gap_adv_start_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{ uint32_t result_code; const uint32_t err_code = ble_gap_adv_start_rsp_dec(p_buffer, length, &result_code); APP_ERROR_CHECK(err_code); return result_code; }
labapart/polymcu
C++
null
201
/* sha_init - initialize the vectors for a SHA1 digest @buf: vector to initialize */
void sha_init(__u32 *buf)
/* sha_init - initialize the vectors for a SHA1 digest @buf: vector to initialize */ void sha_init(__u32 *buf)
{ buf[0] = 0x67452301; buf[1] = 0xefcdab89; buf[2] = 0x98badcfe; buf[3] = 0x10325476; buf[4] = 0xc3d2e1f0; }
robutest/uclinux
C++
GPL-2.0
60
/* If the handler is non-null, the handler will be called after every period of this PWM channel. If the handler is null, this channel won't generate an IRQ. */
int pwm_channel_handler(struct pwm_channel *ch, void(*handler)(struct pwm_channel *ch))
/* If the handler is non-null, the handler will be called after every period of this PWM channel. If the handler is null, this channel won't generate an IRQ. */ int pwm_channel_handler(struct pwm_channel *ch, void(*handler)(struct pwm_channel *ch))
{ unsigned long flags; int t; spin_lock_irqsave(&pwm->lock, flags); t = pwmcheck(ch); if (t >= 0) { pwm->handler[t] = handler; pwm_writel(pwm, handler ? PWM_IER : PWM_IDR, 1 << t); t = 0; } spin_unlock_irqrestore(&pwm->lock, flags); return t; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the signal strength of the last packets received from an AP client. */
sl_status_t sl_wfx_get_ap_client_signal_strength(const sl_wfx_mac_address_t *client, uint32_t *signal_strength)
/* Get the signal strength of the last packets received from an AP client. */ sl_status_t sl_wfx_get_ap_client_signal_strength(const sl_wfx_mac_address_t *client, uint32_t *signal_strength)
{ sl_status_t result; sl_wfx_get_ap_client_signal_strength_req_body_t payload; sl_wfx_get_ap_client_signal_strength_cnf_t *reply = NULL; memcpy(payload.mac, &client->octet, sizeof(payload.mac) ); result = sl_wfx_send_command(SL_WFX_GET_AP_CLIENT_SIGNAL_STRENGTH_REQ_ID, &payload, sizeof(payload), SL_WFX_SOFTAP_INTERFACE, (sl_wfx_generic_confirmation_t **)&reply); if (result == SL_STATUS_OK) { result = sl_wfx_get_status_code(sl_wfx_htole32(reply->body.status), SL_WFX_GET_AP_CLIENT_SIGNAL_STRENGTH_REQ_ID); *signal_strength = sl_wfx_htole32(reply->body.rcpi); } return result; }
eclipse-threadx/getting-started
C++
Other
310
/* modify the property of existed varea by shrink its size. Mem_obj is notified to released the resource. */
static rt_err_t _shrink_varea(rt_varea_t varea, void *new_va, rt_size_t size)
/* modify the property of existed varea by shrink its size. Mem_obj is notified to released the resource. */ static rt_err_t _shrink_varea(rt_varea_t varea, void *new_va, rt_size_t size)
{ rt_err_t error; rt_aspace_t aspace; void *old_va; if (varea->mem_obj && varea->mem_obj->on_varea_shrink) error = varea->mem_obj->on_varea_shrink(varea, new_va, size); else error = -RT_EPERM; if (error == RT_EOK) { aspace = varea->aspace; old_va = varea->start; varea->size = size; if (old_va != new_va) { varea->start = new_va; varea->offset += ((long)new_va - (long)old_va) >> MM_PAGE_SHIFT; _aspace_bst_remove(aspace, varea); _aspace_bst_insert(aspace, varea); } } return error; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initialize POSIX timer handling for a single task. */
static void posix_cpu_timers_init(struct task_struct *tsk)
/* Initialize POSIX timer handling for a single task. */ static void posix_cpu_timers_init(struct task_struct *tsk)
{ tsk->cputime_expires.prof_exp = cputime_zero; tsk->cputime_expires.virt_exp = cputime_zero; tsk->cputime_expires.sched_exp = 0; INIT_LIST_HEAD(&tsk->cpu_timers[0]); INIT_LIST_HEAD(&tsk->cpu_timers[1]); INIT_LIST_HEAD(&tsk->cpu_timers[2]); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Function called in case of error detected in I2C IT Handler. */
void Error_Callback(void)
/* Function called in case of error detected in I2C IT Handler. */ void Error_Callback(void)
{ NVIC_DisableIRQ(DMA1_Stream5_IRQn); NVIC_DisableIRQ(DMA1_Stream1_IRQn); LED_Blinking(LED_BLINK_ERROR); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Returns 0 if the request was successfully queued, error code otherwise. The caller has no way to know whether the queued request will eventually succeed. */
int usb_driver_set_configuration(struct usb_device *udev, int config)
/* Returns 0 if the request was successfully queued, error code otherwise. The caller has no way to know whether the queued request will eventually succeed. */ int usb_driver_set_configuration(struct usb_device *udev, int config)
{ struct set_config_request *req; req = kmalloc(sizeof(*req), GFP_KERNEL); if (!req) return -ENOMEM; req->udev = udev; req->config = config; INIT_WORK(&req->work, driver_set_config_work); spin_lock(&set_config_lock); list_add(&req->node, &set_config_list); spin_unlock(&set_config_lock); usb_get_dev(udev); schedule_work(&req->work); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* IDL char *server; IDL char *client; IDL char *message; */
static int messenger_dissect_send_message_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
/* IDL char *server; IDL char *client; IDL char *message; */ static int messenger_dissect_send_message_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
{ offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, di, drep, dissect_ndr_char_cvstring, NDR_POINTER_REF, "Server", hf_messenger_server); offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, di, drep, dissect_ndr_char_cvstring, NDR_POINTER_REF, "Client", hf_messenger_client); offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, di, drep, dissect_ndr_char_cvstring, NDR_POINTER_REF, "Message", hf_messenger_message); return offset; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* dissect_reliable_message_number is a utility function which calculates the RMN if and only if the reliable flag in the message block is set to 1. */
static int dissect_reliable_message_number(tvbuff_t *buffer, int offset, proto_tree *tree)
/* dissect_reliable_message_number is a utility function which calculates the RMN if and only if the reliable flag in the message block is set to 1. */ static int dissect_reliable_message_number(tvbuff_t *buffer, int offset, proto_tree *tree)
{ int byte_count = 1; if(tvb_get_guint8(buffer, offset) & 0x80) byte_count = 2; proto_tree_add_item(tree, hf_knet_msg_reliable_message_number, buffer, offset, byte_count, ENC_LITTLE_ENDIAN); return byte_count; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Enables or disables the specified COMP peripheral Clock. */
void RCC_COMP_ClockCmd(COMP_TypeDef *peripheral, FunctionalState state)
/* Enables or disables the specified COMP peripheral Clock. */ void RCC_COMP_ClockCmd(COMP_TypeDef *peripheral, FunctionalState state)
{ if(COMP == peripheral) { (state) ? (RCC->APB2ENR |= RCC_APB2ENR_COMP) : (RCC->APB2ENR &= ~RCC_APB2ENR_COMP); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read a 8bit register from the chip, returning the result */
static unsigned ks8851_rdreg8(struct ks8851_net *ks, unsigned reg)
/* Read a 8bit register from the chip, returning the result */ static unsigned ks8851_rdreg8(struct ks8851_net *ks, unsigned reg)
{ u8 rxb[1]; ks8851_rdreg(ks, MK_OP(1 << (reg & 3), reg), rxb, 1); return rxb[0]; }
robutest/uclinux
C++
GPL-2.0
60
/* param base PDM base pointer param mask interrupt source The parameter can be a combination of the following sources if defined. arg kPDM_ErrorInterruptEnable arg kPDM_FIFOInterruptEnable */
void PDM_EnableInterrupts(PDM_Type *base, uint32_t mask)
/* param base PDM base pointer param mask interrupt source The parameter can be a combination of the following sources if defined. arg kPDM_ErrorInterruptEnable arg kPDM_FIFOInterruptEnable */ void PDM_EnableInterrupts(PDM_Type *base, uint32_t mask)
{ if ((mask & (uint32_t)kPDM_FIFOInterruptEnable) != 0U) { base->CTRL_1 = (base->CTRL_1 & (~PDM_CTRL_1_DISEL_MASK)) | (uint32_t)kPDM_FIFOInterruptEnable; } if ((mask & (uint32_t)kPDM_ErrorInterruptEnable) != 0U) { base->CTRL_1 = (base->CTRL_1 & (~PDM_CTRL_1_ERREN_MASK)) | (uint32_t)kPDM_ErrorInterruptEnable; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Removes the 'eth*addr' environment variable with the given index */
static void remove_ethaddr_env_var(int index)
/* Removes the 'eth*addr' environment variable with the given index */ static void remove_ethaddr_env_var(int index)
{ char env_var_name[9]; sprintf(env_var_name, index == 0 ? "ethaddr" : "eth%daddr", index); env_set(env_var_name, NULL); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Routine: pinmux_init Description: Do individual peripheral pinmux configs */
void pinmux_init(void)
/* Routine: pinmux_init Description: Do individual peripheral pinmux configs */ void pinmux_init(void)
{ pinmux_config_pingrp_table(tegra3_pinmux_common, ARRAY_SIZE(tegra3_pinmux_common)); pinmux_config_pingrp_table(unused_pins_lowpower, ARRAY_SIZE(unused_pins_lowpower)); pinmux_config_drvgrp_table(apalis_t30_padctrl, ARRAY_SIZE(apalis_t30_padctrl)); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns: a newly allocated copy of the string content of @value */
gchar* g_value_dup_string(const GValue *value)
/* Returns: a newly allocated copy of the string content of @value */ gchar* g_value_dup_string(const GValue *value)
{ g_return_val_if_fail (G_VALUE_HOLDS_STRING (value), NULL); return g_strdup (value->data[0].v_pointer); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Description: Initializes the CIPSO label mapping cache, this function should be called before any of the other functions defined in this file. Returns zero on success, negative values on error. */
static int cipso_v4_cache_init(void)
/* Description: Initializes the CIPSO label mapping cache, this function should be called before any of the other functions defined in this file. Returns zero on success, negative values on error. */ static int cipso_v4_cache_init(void)
{ u32 iter; cipso_v4_cache = kcalloc(CIPSO_V4_CACHE_BUCKETS, sizeof(struct cipso_v4_map_cache_bkt), GFP_KERNEL); if (cipso_v4_cache == NULL) return -ENOMEM; for (iter = 0; iter < CIPSO_V4_CACHE_BUCKETS; iter++) { spin_lock_init(&cipso_v4_cache[iter].lock); cipso_v4_cache[iter].size = 0; INIT_LIST_HEAD(&cipso_v4_cache[iter].list); } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* the resultant list is a double NULL terminated list of NULL terminated strings. */
STATIC EFI_STATUS CopyListOfCommandNamesWithDynamic(IN OUT CHAR16 **DestList, IN OUT UINTN *DestSize)
/* the resultant list is a double NULL terminated list of NULL terminated strings. */ STATIC EFI_STATUS CopyListOfCommandNamesWithDynamic(IN OUT CHAR16 **DestList, IN OUT UINTN *DestSize)
{ EFI_HANDLE *CommandHandleList; CONST EFI_HANDLE *NextCommand; EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand; EFI_STATUS Status; CommandHandleList = GetHandleListByProtocol (&gEfiShellDynamicCommandProtocolGuid); if (CommandHandleList == NULL) { return (EFI_SUCCESS); } Status = EFI_SUCCESS; for (NextCommand = CommandHandleList; *NextCommand != NULL && !EFI_ERROR (Status); NextCommand++) { Status = gBS->HandleProtocol ( *NextCommand, &gEfiShellDynamicCommandProtocolGuid, (VOID **)&DynamicCommand ); if (EFI_ERROR (Status)) { continue; } Status = LexicalInsertIntoList (DestList, DestSize, DynamicCommand->CommandName); } SHELL_FREE_NON_NULL (CommandHandleList); return (Status); }
tianocore/edk2
C++
Other
4,240