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
/* Map the physical node id to a virtual node id (virtual node ids are contiguous). */
cnodeid_t get_compact_nodeid(void)
/* Map the physical node id to a virtual node id (virtual node ids are contiguous). */ cnodeid_t get_compact_nodeid(void)
{ return NASID_TO_COMPACT_NODEID(get_nasid()); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return (-1) on error Return (0) if was initiated or pending Return (1) if removal is complete */
static int DivaSTraceLibraryStop(void *hLib)
/* Return (-1) on error Return (0) if was initiated or pending Return (1) if removal is complete */ static int DivaSTraceLibraryStop(void *hLib)
{ return (1); } switch (pLib->removal_state) { case 0: pLib->removal_state = 1; ScheduleNextTraceRequest(pLib); break; case 3: return (1); } return (0); }
robutest/uclinux
C++
GPL-2.0
60
/* return The status flags. This is the logical OR of members of the enumeration ::qtmr_status_flags_t */
uint32_t QTMR_GetStatus(TMR_Type *base, qtmr_channel_selection_t channel)
/* return The status flags. This is the logical OR of members of the enumeration ::qtmr_status_flags_t */ uint32_t QTMR_GetStatus(TMR_Type *base, qtmr_channel_selection_t channel)
{ uint32_t statusFlags = 0; uint16_t reg; reg = base->CHANNEL[channel].SCTRL; if (reg & TMR_SCTRL_TCF_MASK) { statusFlags |= kQTMR_CompareFlag; } if (reg & TMR_SCTRL_TOF_MASK) { statusFlags |= kQTMR_OverflowFlag; } if (reg & TMR_SCTRL_IEF_MASK) { statusFlags |= kQTMR_EdgeFlag; } reg = base->CHANNEL[channel].CSCTRL; if (reg & TMR_CSCTRL_TCF1_MASK) { statusFlags |= kQTMR_Compare1Flag; } if (reg & TMR_CSCTRL_TCF2_MASK) { statusFlags |= kQTMR_Compare2Flag; } return statusFlags; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sets a high output level on one or more pin(s) (if configured as output(s)). */
void PIO_Set(const Pin *pin)
/* Sets a high output level on one or more pin(s) (if configured as output(s)). */ void PIO_Set(const Pin *pin)
{ WRITE(pin->pio, PIO_SODR, pin->mask); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Return total number of SCMI protocols supported by the SCP firmware. */
STATIC EFI_STATUS BaseGetTotalProtocols(IN SCMI_BASE_PROTOCOL *This, OUT UINT32 *TotalProtocols)
/* Return total number of SCMI protocols supported by the SCP firmware. */ STATIC EFI_STATUS BaseGetTotalProtocols(IN SCMI_BASE_PROTOCOL *This, OUT UINT32 *TotalProtocols)
{ EFI_STATUS Status; UINT32 *ReturnValues; Status = ScmiGetProtocolAttributes (ScmiProtocolIdBase, &ReturnValues); if (EFI_ERROR (Status)) { return Status; } *TotalProtocols = SCMI_TOTAL_PROTOCOLS (ReturnValues[0]); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Releases ownership of a context previously acquired by this thread with g_main_context_acquire(). If the context was acquired multiple times, the ownership will be released only when g_main_context_release() is called as many times as it was acquired. */
void g_main_context_release(GMainContext *context)
/* Releases ownership of a context previously acquired by this thread with g_main_context_acquire(). If the context was acquired multiple times, the ownership will be released only when g_main_context_release() is called as many times as it was acquired. */ void g_main_context_release(GMainContext *context)
{ if (context == NULL) context = g_main_context_default (); LOCK_CONTEXT (context); context->owner_count--; if (context->owner_count == 0) { context->owner = NULL; if (context->waiters) { GMainWaiter *waiter = context->waiters->data; gboolean loop_internal_waiter = (waiter->mutex == &context->mutex); context->waiters = g_slist_delete_link (context->waiters, context->waiters); if (!loop_internal_waiter) g_mutex_lock (waiter->mutex); g_cond_signal (waiter->cond); if (!loop_internal_waiter) g_mutex_unlock (waiter->mutex); } } UNLOCK_CONTEXT (context); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Get the captured data for the ADC sample channel. */
unsigned long ADCDataGet(unsigned long ulBase, unsigned long ulChannel)
/* Get the captured data for the ADC sample channel. */ unsigned long ADCDataGet(unsigned long ulBase, unsigned long ulChannel)
{ unsigned long ulData; unsigned long ulCRReg; xASSERT(ulBase == ADC_BASE); xASSERT((ulChannel >= 0) && (ulChannel < 8)); ulData = xHWREG(ulBase + ADC_DR0 + (ulChannel * 4)); return (ulData & ADC_DATA_MASK); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Get remaining space in FIFO. As this function only reads the read and write pointers once, this function is reentrant and thus thread and ISR save without any mutexes. */
uint16_t tu_fifo_remaining(tu_fifo_t *f)
/* Get remaining space in FIFO. As this function only reads the read and write pointers once, this function is reentrant and thus thread and ISR save without any mutexes. */ uint16_t tu_fifo_remaining(tu_fifo_t *f)
{ return _ff_remaining(f->depth, f->wr_idx, f->rd_idx); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Return value: pointer to buffer with description string */
static const char* ipr_ioa_info(struct Scsi_Host *host)
/* Return value: pointer to buffer with description string */ static const char* ipr_ioa_info(struct Scsi_Host *host)
{ static char buffer[512]; struct ipr_ioa_cfg *ioa_cfg; unsigned long lock_flags = 0; ioa_cfg = (struct ipr_ioa_cfg *) host->hostdata; spin_lock_irqsave(host->host_lock, lock_flags); sprintf(buffer, "IBM %X Storage Adapter", ioa_cfg->type); spin_unlock_irqrestore(host->host_lock, lock_flags); return buffer; }
robutest/uclinux
C++
GPL-2.0
60
/* Grab a ref against this buffer_head's journal_head. If it ended up not having a journal_head, return NULL */
struct journal_head* journal_grab_journal_head(struct buffer_head *bh)
/* Grab a ref against this buffer_head's journal_head. If it ended up not having a journal_head, return NULL */ struct journal_head* journal_grab_journal_head(struct buffer_head *bh)
{ struct journal_head *jh = NULL; jbd_lock_bh_journal_head(bh); if (buffer_jbd(bh)) { jh = bh2jh(bh); jh->b_jcount++; } jbd_unlock_bh_journal_head(bh); return jh; }
robutest/uclinux
C++
GPL-2.0
60
/* User-defined threshold value for Tap/Double Tap event. 1 LSB = full scale/128. */
int32_t lis2dh12_tap_threshold_get(stmdev_ctx_t *ctx, uint8_t *val)
/* User-defined threshold value for Tap/Double Tap event. 1 LSB = full scale/128. */ int32_t lis2dh12_tap_threshold_get(stmdev_ctx_t *ctx, uint8_t *val)
{ lis2dh12_click_ths_t click_ths; int32_t ret; ret = lis2dh12_read_reg(ctx, LIS2DH12_CLICK_THS, (uint8_t *)&click_ths, 1); *val = (uint8_t)click_ths.ths; return ret; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Registers a callback. Registers a callback function which is implemented by the user. */
enum status_code trng_register_callback(struct trng_module *const module, trng_callback_t callback_func, const enum trng_callback callback_type)
/* Registers a callback. Registers a callback function which is implemented by the user. */ enum status_code trng_register_callback(struct trng_module *const module, trng_callback_t callback_func, const enum trng_callback callback_type)
{ Assert(module); Assert(callback_func); module->callback[callback_type] = callback_func; module->register_callback_mask |= (1 << callback_type); system_interrupt_enable(SYSTEM_INTERRUPT_MODULE_TRNG); return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* ps3_repository_read_num_spu_reserved - Number of physical spus reserved. @num_spu: Number of physical spus. */
int ps3_repository_read_num_spu_reserved(unsigned int *num_spu_reserved)
/* ps3_repository_read_num_spu_reserved - Number of physical spus reserved. @num_spu: Number of physical spus. */ int ps3_repository_read_num_spu_reserved(unsigned int *num_spu_reserved)
{ int result; u64 v1; result = read_node(PS3_LPAR_ID_CURRENT, make_first_field("bi", 0), make_field("spun", 0), 0, 0, &v1, NULL); *num_spu_reserved = v1; return result; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reconnect serio port and all its children (re-initialize attached devices) */
static void serio_reconnect_chain(struct serio *serio)
/* Reconnect serio port and all its children (re-initialize attached devices) */ static void serio_reconnect_chain(struct serio *serio)
{ do { if (serio_reconnect_port(serio)) { break; } serio = serio->child; } while (serio); }
robutest/uclinux
C++
GPL-2.0
60
/* Receive an item from a queue without removing the item from the queue. */
osEvent osMessagePeek(osMessageQId queue_id, uint32_t millisec)
/* Receive an item from a queue without removing the item from the queue. */ osEvent osMessagePeek(osMessageQId queue_id, uint32_t millisec)
{ TickType_t ticks; osEvent event; event.def.message_id = queue_id; if (queue_id == NULL) { event.status = osErrorParameter; return event; } ticks = 0; if (millisec == osWaitForever) { ticks = portMAX_DELAY; } else if (millisec != 0) { ticks = millisec / portTICK_PERIOD_MS; if (ticks == 0) { ticks = 1; } } if (xQueuePeek(queue_id, &event.value.v, ticks) == pdTRUE) { event.status = osEventMessage; } else { event.status = (ticks == 0) ? osOK : osEventTimeout; } return event; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* For historical reasons, it only allows reserved pages. Only old drivers should use this, and they needed to mark their pages reserved for the old functions anyway. */
static int insert_page(struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot)
/* For historical reasons, it only allows reserved pages. Only old drivers should use this, and they needed to mark their pages reserved for the old functions anyway. */ static int insert_page(struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot)
{ struct mm_struct *mm = vma->vm_mm; int retval; pte_t *pte; spinlock_t *ptl; retval = -EINVAL; if (PageAnon(page)) goto out; retval = -ENOMEM; flush_dcache_page(page); pte = get_locked_pte(mm, addr, &ptl); if (!pte) goto out; retval = -EBUSY; if (!pte_none(*pte)) goto out_unlock; get_page(page); inc_mm_counter(mm, file_rss); page_add_file_rmap(page); set_pte_at(mm, addr, pte, mk_pte(page, prot)); retval = 0; pte_unmap_unlock(pte, ptl); return retval; out_unlock: pte_unmap_unlock(pte, ptl); out: return retval; }
robutest/uclinux
C++
GPL-2.0
60
/* Write full pathname from the root of the filesystem into the buffer. */
char* dentry_path(struct dentry *dentry, char *buf, int buflen)
/* Write full pathname from the root of the filesystem into the buffer. */ char* dentry_path(struct dentry *dentry, char *buf, int buflen)
{ char *end = buf + buflen; char *retval; spin_lock(&dcache_lock); prepend(&end, &buflen, "\0", 1); if (d_unlinked(dentry) && (prepend(&end, &buflen, " goto Elong; if (buflen < 1) goto Elong; retval = end-1; *retval = '/'; while (!IS_ROOT(dentry)) { struct dentry *parent = dentry->d_parent; prefetch(parent); if ((prepend_name(&end, &buflen, &dentry->d_name) != 0) || (prepend(&end, &buflen, "/", 1) != 0)) goto Elong; retval = end; dentry = parent; } spin_unlock(&dcache_lock); return retval; Elong: spin_unlock(&dcache_lock); return ERR_PTR(-ENAMETOOLONG); }
robutest/uclinux
C++
GPL-2.0
60
/* register & return a new board mac address */
static int board_get_mac_address(u8 *mac)
/* register & return a new board mac address */ static int board_get_mac_address(u8 *mac)
{ u8 *p; int count; if (mac_addr_used >= nvram.mac_addr_count) { printk(KERN_ERR PFX "not enough mac address\n"); return -ENODEV; } memcpy(mac, nvram.mac_addr_base, ETH_ALEN); p = mac + ETH_ALEN - 1; count = mac_addr_used; while (count--) { do { (*p)++; if (*p != 0) break; p--; } while (p != mac); } if (p == mac) { printk(KERN_ERR PFX "unable to fetch mac address\n"); return -ENODEV; } mac_addr_used++; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function will let current thread delay for some milliseconds. */
rt_err_t rt_thread_mdelay(rt_int32_t ms)
/* This function will let current thread delay for some milliseconds. */ rt_err_t rt_thread_mdelay(rt_int32_t ms)
{ rt_tick_t tick; tick = rt_tick_from_millisecond(ms); return rt_thread_sleep(tick); }
pikasTech/PikaPython
C++
MIT License
1,403
/* This function is to restore boot time boot script data from LockBox. */
VOID RestoreBootTimeDataFromLockBox(VOID)
/* This function is to restore boot time boot script data from LockBox. */ VOID RestoreBootTimeDataFromLockBox(VOID)
{ EFI_STATUS Status; UINTN LockBoxLength; LockBoxLength = mS3BootScriptTablePtr->BootTimeScriptLength; Status = RestoreLockBox ( &mBootScriptDataBootTimeGuid, (VOID *)mS3BootScriptTablePtr->TableBase, &LockBoxLength ); ASSERT_EFI_ERROR (Status); Status = UpdateLockBox ( &mBootScriptDataGuid, 0, (VOID *)mS3BootScriptTablePtr->TableBase, LockBoxLength ); ASSERT_EFI_ERROR (Status); mS3BootScriptTablePtr->TableLength = (UINT32)(mS3BootScriptTablePtr->BootTimeScriptLength - sizeof (EFI_BOOT_SCRIPT_TERMINATE)); }
tianocore/edk2
C++
Other
4,240
/* Maximum receive ring size; that is, the number of packets we can buffer before overflow happens. Basically, this just needs to be enough to prevent a packet being discarded while we are processing the previous one. */
static int ks8851_mll_recv(struct eth_device *dev)
/* Maximum receive ring size; that is, the number of packets we can buffer before overflow happens. Basically, this just needs to be enough to prevent a packet being discarded while we are processing the previous one. */ static int ks8851_mll_recv(struct eth_device *dev)
{ u16 status; status = ks_rdreg16(dev, KS_ISR); ks_wrreg16(dev, KS_ISR, status); if ((status & IRQ_RXI)) ks_rcv(dev, (uchar **)net_rx_packets); if ((status & IRQ_LDI)) { u16 pmecr = ks_rdreg16(dev, KS_PMECR); pmecr &= ~PMECR_WKEVT_MASK; ks_wrreg16(dev, KS_PMECR, pmecr | PMECR_WKEVT_LINK); } return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* return 0 in case more bandwidth is available, else errorcode */
static int c67x00_add_int_urb(struct c67x00_hcd *c67x00, struct urb *urb)
/* return 0 in case more bandwidth is available, else errorcode */ static int c67x00_add_int_urb(struct c67x00_hcd *c67x00, struct urb *urb)
{ struct c67x00_urb_priv *urbp = urb->hcpriv; if (frame_after_eq(c67x00->current_frame, urbp->ep_data->next_frame)) { urbp->ep_data->next_frame = frame_add(urbp->ep_data->next_frame, urb->interval); return c67x00_add_data_urb(c67x00, urb); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* llist_move - delete from one llist and add as another's head @llist: the entry to move @head: the head that will precede our entry */
void llist_move(llist_head *llist, llist_head *head)
/* llist_move - delete from one llist and add as another's head @llist: the entry to move @head: the head that will precede our entry */ void llist_move(llist_head *llist, llist_head *head)
{ __llist_del(llist->prev, llist->next); llist_add(llist, head); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return value: count on success / other on failure */
static ssize_t ipr_store_reset_adapter(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
/* Return value: count on success / other on failure */ static ssize_t ipr_store_reset_adapter(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ struct Scsi_Host *shost = class_to_shost(dev); struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; unsigned long lock_flags; int result = count; if (!capable(CAP_SYS_ADMIN)) return -EACCES; spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); if (!ioa_cfg->in_reset_reload) ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NORMAL); spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); return result; }
robutest/uclinux
C++
GPL-2.0
60
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM2) { __HAL_RCC_TIM2_CLK_ENABLE(); } else if(htim_base->Instance==TIM3) { __HAL_RCC_TIM3_CLK_ENABLE(); } else if(htim_base->Instance==TIM4) { __HAL_RCC_TIM4_CLK_ENABLE(); } else if(htim_base->Instance==TIM5) { __HAL_RCC_TIM5_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base LPCMP peripheral base address. param positiveChannel Positive side input channel number. Available range is 0-7. param negativeChannel Negative side input channel number. Available range is 0-7. */
void LPCMP_SetInputChannels(LPCMP_Type *base, uint32_t positiveChannel, uint32_t negativeChannel)
/* param base LPCMP peripheral base address. param positiveChannel Positive side input channel number. Available range is 0-7. param negativeChannel Negative side input channel number. Available range is 0-7. */ void LPCMP_SetInputChannels(LPCMP_Type *base, uint32_t positiveChannel, uint32_t negativeChannel)
{ uint32_t tmp32; tmp32 = base->CCR2 & ~(LPCMP_CCR2_PSEL_MASK | LPCMP_CCR2_MSEL_MASK); tmp32 |= LPCMP_CCR2_PSEL(positiveChannel) | LPCMP_CCR2_MSEL(negativeChannel); base->CCR2 = tmp32; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Adjusts the Internal High Speed oscillator (HSI) calibration value. */
void RCC_AdjustHSICalibrationValue(uint8_t HSICalibrationValue)
/* Adjusts the Internal High Speed oscillator (HSI) calibration value. */ void RCC_AdjustHSICalibrationValue(uint8_t HSICalibrationValue)
{ uint32_t tmpreg = 0; assert_param(IS_RCC_CALIBRATION_VALUE(HSICalibrationValue)); tmpreg = RCC->CR; tmpreg &= CR_HSITRIM_Mask; tmpreg |= (uint32_t)HSICalibrationValue << 3; RCC->CR = tmpreg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function multiples the 64-bit unsigned value Multiplicand by the 32-bit unsigned value Multiplier and generates a 64-bit unsigned result. This 64- bit unsigned result is returned. */
UINT64 EFIAPI InternalMathMultU64x32(IN UINT64 Multiplicand, IN UINT32 Multiplier)
/* This function multiples the 64-bit unsigned value Multiplicand by the 32-bit unsigned value Multiplier and generates a 64-bit unsigned result. This 64- bit unsigned result is returned. */ UINT64 EFIAPI InternalMathMultU64x32(IN UINT64 Multiplicand, IN UINT32 Multiplier)
{ _asm { mov ecx, Multiplier mov eax, ecx imul ecx, dword ptr [Multiplicand + 4] mul dword ptr [Multiplicand + 0] add edx, ecx } }
tianocore/edk2
C++
Other
4,240
/* Restore the "system address" and "host ID" from NV memory. */
static bool gzp_params_restore(void)
/* Restore the "system address" and "host ID" from NV memory. */ static bool gzp_params_restore(void)
{ uint8_t i; uint8_t temp_element[GZP_PARAMS_DB_ELEMENT_SIZE]; if(!gzp_index_db_full() && !gzp_index_db_empty()) { i = gzp_index_db_read(); if(i < GZP_PARAMS_DB_MAX_ENTRIES) { gzp_params_db_read(temp_element, i); memcpy(gzp_system_address, &temp_element[GZP_PARAMS_DB_ELEMENT_SYSTEM_ADDRESS], GZP_SYSTEM_ADDRESS_WIDTH); gzp_set_host_id(&temp_element[GZP_PARAMS_DB_ELEMENT_HOST_ID]); return true; } } return false; }
labapart/polymcu
C++
null
201
/* Refer to SD Host Controller Simplified spec 3.0 Section for details. */
EFI_STATUS SdMmcHcInitTimeoutCtrl(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Slot)
/* Refer to SD Host Controller Simplified spec 3.0 Section for details. */ EFI_STATUS SdMmcHcInitTimeoutCtrl(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Slot)
{ EFI_STATUS Status; UINT8 Timeout; Timeout = 0x0E; Status = SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_TIMEOUT_CTRL, FALSE, sizeof (Timeout), &Timeout); return Status; }
tianocore/edk2
C++
Other
4,240
/* To document this is very odd - it won't make sense to a person reading the API docs to see this metamethod as a method, but oh well. */
WSLUA_METAMETHOD Columns__newindex(lua_State *L)
/* To document this is very odd - it won't make sense to a person reading the API docs to see this metamethod as a method, but oh well. */ WSLUA_METAMETHOD Columns__newindex(lua_State *L)
{ luaL_error(L,"expired column"); return 0; } colname = luaL_checkstring(L,WSLUA_ARG_Columns__newindex_COLUMN); text = luaL_checkstring(L,WSLUA_ARG_Columns__newindex_TEXT); for(cn = colnames; cn->name; cn++) { if( g_str_equal(cn->name,colname) ) { col_add_str(cols->cinfo, cn->id, text); return 0; } } WSLUA_ARG_ERROR(Columns__newindex,COLUMN,"the column name must be a valid column"); return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Note: The caller must provide a valid region index. */
static void region_init(const uint32_t index, const struct pma_region *region_conf)
/* Note: The caller must provide a valid region index. */ static void region_init(const uint32_t index, const struct pma_region *region_conf)
{ unsigned long pmaaddr; uint8_t pmacfg; if (region_conf->size == 4) { pmaaddr = NA4_ENCODING(region_conf->start); pmacfg = region_conf->attr.pmacfg | PMACFG_ETYPE_NA4; } else { pmaaddr = NAPOT_ENCODING(region_conf->start, region_conf->size); pmacfg = region_conf->attr.pmacfg | PMACFG_ETYPE_NAPOT; } write_pmaaddr_csr(index, pmaaddr); write_pmacfg_entry(index, pmacfg); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Function to set the MDC clock for mdio transactiona */
s32 synopGMAC_set_mdc_clk_div(synopGMACdevice *gmacdev, u32 clk_div_val)
/* Function to set the MDC clock for mdio transactiona */ s32 synopGMAC_set_mdc_clk_div(synopGMACdevice *gmacdev, u32 clk_div_val)
{ u32 orig_data; orig_data = synopGMACReadReg(gmacdev -> MacBase, GmacGmiiAddr); orig_data &= (~GmiiCsrClkMask); orig_data |= clk_div_val; synopGMACWriteReg(gmacdev -> MacBase, GmacGmiiAddr, orig_data); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Look up the hardware configuration for a device instance */
XAxiVdma_Config* XAxiVdma_LookupConfig(u16 DeviceId)
/* Look up the hardware configuration for a device instance */ XAxiVdma_Config* XAxiVdma_LookupConfig(u16 DeviceId)
{ extern XAxiVdma_Config XAxiVdma_ConfigTable[]; XAxiVdma_Config *CfgPtr = NULL; u32 i; for (i = 0U; i < XPAR_XAXIVDMA_NUM_INSTANCES; i++) { if (XAxiVdma_ConfigTable[i].DeviceId == DeviceId) { CfgPtr = &XAxiVdma_ConfigTable[i]; break; } } return CfgPtr; } /** @}
ua1arn/hftrx
C++
null
69
/* For now we avoid this problem by imposing a hard limit on the number of delegations, which varies according to the server's memory size. */
static void set_max_delegations(void)
/* For now we avoid this problem by imposing a hard limit on the number of delegations, which varies according to the server's memory size. */ static void set_max_delegations(void)
{ max_delegations = nr_free_buffer_pages() >> (20 - 2 - PAGE_SHIFT); }
robutest/uclinux
C++
GPL-2.0
60
/* param base HSCMP peripheral base address. param config Pointer to "hscmp_filter_config_t" structure. */
void HSCMP_SetFilterConfig(HSCMP_Type *base, const hscmp_filter_config_t *config)
/* param base HSCMP peripheral base address. param config Pointer to "hscmp_filter_config_t" structure. */ void HSCMP_SetFilterConfig(HSCMP_Type *base, const hscmp_filter_config_t *config)
{ assert(config != NULL); uint32_t tmp32; tmp32 = base->CCR1 & ~(HSCMP_CCR1_FILT_PER_MASK | HSCMP_CCR1_FILT_CNT_MASK | HSCMP_CCR1_SAMPLE_EN_MASK); if (config->enableSample) { tmp32 |= HSCMP_CCR1_SAMPLE_EN_MASK; } tmp32 |= HSCMP_CCR1_FILT_PER(config->filterSamplePeriod) | HSCMP_CCR1_FILT_CNT(config->filterSampleCount); base->CCR1 = tmp32; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This returns the copy of the @match descriptor made for @copy. Its intended use is to help remembering the endpoint descriptor to use when enabling a given endpoint. */
struct usb_endpoint_descriptor* __init usb_find_endpoint(struct usb_descriptor_header **src, struct usb_descriptor_header **copy, struct usb_endpoint_descriptor *match)
/* This returns the copy of the @match descriptor made for @copy. Its intended use is to help remembering the endpoint descriptor to use when enabling a given endpoint. */ struct usb_endpoint_descriptor* __init usb_find_endpoint(struct usb_descriptor_header **src, struct usb_descriptor_header **copy, struct usb_endpoint_descriptor *match)
{ while (*src) { if (*src == (void *) match) return (void *)*copy; src++; copy++; } return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* DAC960_AllocateCommand allocates a Command structure from Controller's free list. During driver initialization, a special initialization command has been placed on the free list to guarantee that command allocation can never fail. */
static DAC960_Command_T* DAC960_AllocateCommand(DAC960_Controller_T *Controller)
/* DAC960_AllocateCommand allocates a Command structure from Controller's free list. During driver initialization, a special initialization command has been placed on the free list to guarantee that command allocation can never fail. */ static DAC960_Command_T* DAC960_AllocateCommand(DAC960_Controller_T *Controller)
{ DAC960_Command_T *Command = Controller->FreeCommands; if (Command == NULL) return NULL; Controller->FreeCommands = Command->Next; Command->Next = NULL; return Command; }
robutest/uclinux
C++
GPL-2.0
60
/* If the conversion results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUint32ToIntn(IN UINT32 Operand, OUT INTN *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUint32ToIntn(IN UINT32 Operand, OUT INTN *Result)
{ if (Result == NULL) { return RETURN_INVALID_PARAMETER; } *Result = Operand; return RETURN_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* v9fs_blank_wstat - helper function to setup a 9P stat structure @wstat: structure to initialize */
void v9fs_blank_wstat(struct p9_wstat *wstat)
/* v9fs_blank_wstat - helper function to setup a 9P stat structure @wstat: structure to initialize */ void v9fs_blank_wstat(struct p9_wstat *wstat)
{ wstat->type = ~0; wstat->dev = ~0; wstat->qid.type = ~0; wstat->qid.version = ~0; *((long long *)&wstat->qid.path) = ~0; wstat->mode = ~0; wstat->atime = ~0; wstat->mtime = ~0; wstat->length = ~0; wstat->name = NULL; wstat->uid = NULL; wstat->gid = NULL; wstat->muid = NULL; wstat->n_uid = ~0; wstat->n_gid = ~0; wstat->n_muid = ~0; wstat->extension = NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* The destructor function closes the End of DXE event. */
EFI_STATUS EFIAPI DxeCapsuleLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The destructor function closes the End of DXE event. */ EFI_STATUS EFIAPI DxeCapsuleLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; Status = gBS->CloseEvent (mDxeCapsuleLibEndOfDxeEvent); ASSERT_EFI_ERROR (Status); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Unregisters an interrupt handler for the watchdog timer interrupt. */
void WatchdogIntUnregister(unsigned long ulBase)
/* Unregisters an interrupt handler for the watchdog timer interrupt. */ void WatchdogIntUnregister(unsigned long ulBase)
{ ASSERT((ulBase == WDT_BASE)); IntDisable(INT_WDT); IntUnregister(INT_WDT); }
micropython/micropython
C++
Other
18,334
/* Returns: (transfer none): paramspec to which requests on this paramspec should be redirected, or NULL if none. */
GParamSpec* g_param_spec_get_redirect_target(GParamSpec *pspec)
/* Returns: (transfer none): paramspec to which requests on this paramspec should be redirected, or NULL if none. */ GParamSpec* g_param_spec_get_redirect_target(GParamSpec *pspec)
{ GTypeInstance *inst = (GTypeInstance *)pspec; if (inst && inst->g_class && inst->g_class->g_type == G_TYPE_PARAM_OVERRIDE) return ((GParamSpecOverride*)pspec)->overridden; else return NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Override the global weak sched_clock symbol with this local implementation which uses the clocksource to get some better resolution when scheduling the kernel. We accept that this wraps around for now, since it is just a relative time stamp. (Inspired by OMAP implementation.) */
unsigned long long notrace sched_clock(void)
/* Override the global weak sched_clock symbol with this local implementation which uses the clocksource to get some better resolution when scheduling the kernel. We accept that this wraps around for now, since it is just a relative time stamp. (Inspired by OMAP implementation.) */ unsigned long long notrace sched_clock(void)
{ return clocksource_cyc2ns(clocksource_u300_1mhz.read( &clocksource_u300_1mhz), clocksource_u300_1mhz.mult, clocksource_u300_1mhz.shift); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Waits the start of USB reset signal This routine waits the end of SOF. */
static void main_usb_wait_reset_start(void)
/* Waits the start of USB reset signal This routine waits the end of SOF. */ static void main_usb_wait_reset_start(void)
{ do { udd_ack_sof(); delay_ms(2); } while (Is_udd_sof()); }
remotemcu/remcu-chip-sdks
C++
null
436
/* prepare_task_switch sets up locking and calls architecture specific hooks. */
static void prepare_task_switch(struct rq *rq, struct task_struct *prev, struct task_struct *next)
/* prepare_task_switch sets up locking and calls architecture specific hooks. */ static void prepare_task_switch(struct rq *rq, struct task_struct *prev, struct task_struct *next)
{ fire_sched_out_preempt_notifiers(prev, next); prepare_lock_switch(rq, next); prepare_arch_switch(next); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* In TDX a serial of TdIoWrite16 is invoked to write data to the I/O port. */
VOID EFIAPI IoWriteFifo16(IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
/* In TDX a serial of TdIoWrite16 is invoked to write data to the I/O port. */ VOID EFIAPI IoWriteFifo16(IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
{ if (IsTdxGuest ()) { TdIoWriteFifo16 (Port, Count, Buffer); } else { SevIoWriteFifo16 (Port, Count, Buffer); } }
tianocore/edk2
C++
Other
4,240
/* get information about the i-th capture. If there are no captures and 'i==0', return information about the whole match, which is the range 's'..'e'. If the capture is a string, return its length and put its address in '*cap'. If it is an integer (a position), push it on the stack and return CAP_POSITION. */
static size_t get_onecapture(MatchState *ms, int i, const char *s, const char *e, const char **cap)
/* get information about the i-th capture. If there are no captures and 'i==0', return information about the whole match, which is the range 's'..'e'. If the capture is a string, return its length and put its address in '*cap'. If it is an integer (a position), push it on the stack and return CAP_POSITION. */ static size_t get_onecapture(MatchState *ms, int i, const char *s, const char *e, const char **cap)
{ if (i >= ms->level) { if (l_unlikely(i != 0)) luaL_error(ms->L, "invalid capture index %%%d", i + 1); *cap = s; return e - s; } else { ptrdiff_t capl = ms->capture[i].len; *cap = ms->capture[i].init; if (l_unlikely(capl == CAP_UNFINISHED)) luaL_error(ms->L, "unfinished capture"); else if (capl == CAP_POSITION) lua_pushinteger(ms->L, (ms->capture[i].init - ms->src_init) + 1); return capl; } }
Nicholas3388/LuaNode
C++
Other
1,055
/* During I/O bi_private points at the dio. After I/O, bi_private is used to implement a singly-linked list of completed BIOs, at dio->bio_list. */
static void dio_bio_end_io(struct bio *bio, int error)
/* During I/O bi_private points at the dio. After I/O, bi_private is used to implement a singly-linked list of completed BIOs, at dio->bio_list. */ static void dio_bio_end_io(struct bio *bio, int error)
{ struct dio *dio = bio->bi_private; unsigned long flags; spin_lock_irqsave(&dio->bio_lock, flags); bio->bi_private = dio->bio_list; dio->bio_list = bio; if (--dio->refcount == 1 && dio->waiter) wake_up_process(dio->waiter); spin_unlock_irqrestore(&dio->bio_lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified EXTI line is asserted or not. */
ITStatus EXTI_GetITStatus(uint32_t EXTI_Line)
/* Checks whether the specified EXTI line is asserted or not. */ ITStatus EXTI_GetITStatus(uint32_t EXTI_Line)
{ ITStatus bitstatus = RESET; uint32_t enablestatus = 0; assert_param(IS_GET_EXTI_LINE(EXTI_Line)); enablestatus = *(__IO uint32_t *) (((uint32_t) &(EXTI->IMR)) + ((EXTI_Line) >> 5 ) * 0x20) & (uint32_t)(1 << (EXTI_Line & 0x1F)); if ( (((*(__IO uint32_t *) (((uint32_t) &(EXTI->PR)) + (((EXTI_Line) >> 5 ) * 0x20) )) & (uint32_t)(1 << (EXTI_Line & 0x1F))) != (uint32_t)RESET) && (enablestatus != (uint32_t)RESET)) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
ajhc/demo-cortex-m3
C++
null
38
/* gfs2_consist_rgrpd_i - Flag a RG consistency error and withdraw Returns: -1 if this call withdrew the machine, 0 if it was already withdrawn */
int gfs2_consist_rgrpd_i(struct gfs2_rgrpd *rgd, int cluster_wide, const char *function, char *file, unsigned int line)
/* gfs2_consist_rgrpd_i - Flag a RG consistency error and withdraw Returns: -1 if this call withdrew the machine, 0 if it was already withdrawn */ int gfs2_consist_rgrpd_i(struct gfs2_rgrpd *rgd, int cluster_wide, const char *function, char *file, unsigned int line)
{ struct gfs2_sbd *sdp = rgd->rd_sbd; int rv; rv = gfs2_lm_withdraw(sdp, "GFS2: fsid=%s: fatal: filesystem consistency error\n" "GFS2: fsid=%s: RG = %llu\n" "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", sdp->sd_fsname, sdp->sd_fsname, (unsigned long long)rgd->rd_addr, sdp->sd_fsname, function, file, line); return rv; }
robutest/uclinux
C++
GPL-2.0
60
/* Removes all items from the linked list. Keep in mind that it is the caller's responsibility to release the memory of the items that were placed in the list, before calling this function. */
void TbxListClear(tTbxList *list)
/* Removes all items from the linked list. Keep in mind that it is the caller's responsibility to release the memory of the items that were placed in the list, before calling this function. */ void TbxListClear(tTbxList *list)
{ tTbxListNode * currentListNodePtr; TBX_ASSERT(list != NULL); if (list != NULL) { TbxCriticalSectionEnter(); currentListNodePtr = list->firstNodePtr; while (currentListNodePtr != NULL) { tTbxListNode * tempListNodePtr = currentListNodePtr; currentListNodePtr = currentListNodePtr->nextNodePtr; TbxMemPoolRelease(tempListNodePtr); } list->firstNodePtr = NULL; list->lastNodePtr = NULL; list->nodeCount = 0U; TbxCriticalSectionExit(); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* When the MAC is in power-down mode, software may exit the mode by calling this function with the */
void EMACPowerManagementControlSet(uint32_t ui32Base, uint32_t ui32Flags)
/* When the MAC is in power-down mode, software may exit the mode by calling this function with the */ void EMACPowerManagementControlSet(uint32_t ui32Base, uint32_t ui32Flags)
{ uint32_t ui32Value; ASSERT(ui32Base == EMAC0_BASE); ASSERT(~(ui32Flags & ~(EMAC_PMT_GLOBAL_UNICAST_ENABLE | EMAC_PMT_WAKEUP_PACKET_ENABLE | EMAC_PMT_MAGIC_PACKET_ENABLE | EMAC_PMT_POWER_DOWN))); ui32Value = HWREG(ui32Base + EMAC_O_PMTCTLSTAT); ui32Value &= ~(EMAC_PMTCTLSTAT_GLBLUCAST | EMAC_PMTCTLSTAT_WUPFREN | EMAC_PMTCTLSTAT_MGKPKTEN | EMAC_PMTCTLSTAT_PWRDWN); ui32Value |= ui32Flags; HWREG(ui32Base + EMAC_O_PMTCTLSTAT) = ui32Value; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Shut down the SPI controller @s SPI slave */
static void spi_m2s_hw_release(struct m2s_spi_dsc *s)
/* Shut down the SPI controller @s SPI slave */ static void spi_m2s_hw_release(struct m2s_spi_dsc *s)
{ M2S_PDMA(s)->chan[s->drx].control = PDMA_CONTROL_RESET; M2S_PDMA(s)->chan[s->dtx].control = PDMA_CONTROL_RESET; M2S_SPI(s)->control &= ~SPI_CONTROL_ENABLE; M2S_SYSREG->soft_reset_cr |= s->rst_clr; }
robutest/uclinux
C++
GPL-2.0
60
/* brief Exit Limp mode warning The PLL should be set and locked prior to exiting Limp mode */
void clock_exit_limp(void)
/* brief Exit Limp mode warning The PLL should be set and locked prior to exiting Limp mode */ void clock_exit_limp(void)
{ ccm_t *ccm = (ccm_t *)MMAP_CCM; pll_t *pll = (pll_t *)MMAP_PLL; clrbits_be16(&ccm->misccr, CCM_MISCCR_LIMP); while (!(in_be32(&pll->psr) & PLL_PSR_LOCK)) ; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Return the absolute address of the soft power switch register */
int __init pdc_soft_power_info(unsigned long *power_reg)
/* Return the absolute address of the soft power switch register */ int __init pdc_soft_power_info(unsigned long *power_reg)
{ int retval; unsigned long flags; *power_reg = (unsigned long) (-1); spin_lock_irqsave(&pdc_lock, flags); retval = mem_pdc_call(PDC_SOFT_POWER, PDC_SOFT_POWER_INFO, __pa(pdc_result), 0); if (retval == PDC_OK) { convert_to_wide(pdc_result); *power_reg = f_extend(pdc_result[0]); } spin_unlock_irqrestore(&pdc_lock, flags); return retval; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The decompressor output side looks only at the saved quant tables, not at the current Q-table slots. */
latch_quant_tables(j_decompress_ptr cinfo)
/* The decompressor output side looks only at the saved quant tables, not at the current Q-table slots. */ latch_quant_tables(j_decompress_ptr cinfo)
{ int ci, qtblno; jpeg_component_info *compptr; JQUANT_TBL * qtbl; for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; if (compptr->quant_table != NULL) continue; qtblno = compptr->quant_tbl_no; if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS || cinfo->quant_tbl_ptrs[qtblno] == NULL) ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno); qtbl = (JQUANT_TBL *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(JQUANT_TBL)); MEMCOPY(qtbl, cinfo->quant_tbl_ptrs[qtblno], SIZEOF(JQUANT_TBL)); compptr->quant_table = qtbl; } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Sets the callback function storing the data as a refcounted callback "object". This is used internally. Note that calling g_source_set_callback_indirect() assumes an initial reference count on @callback_data, and thus @callback_funcs->unref will eventually be called once more than @callback_funcs->ref. */
void g_source_set_callback_indirect(GSource *source, gpointer callback_data, GSourceCallbackFuncs *callback_funcs)
/* Sets the callback function storing the data as a refcounted callback "object". This is used internally. Note that calling g_source_set_callback_indirect() assumes an initial reference count on @callback_data, and thus @callback_funcs->unref will eventually be called once more than @callback_funcs->ref. */ void g_source_set_callback_indirect(GSource *source, gpointer callback_data, GSourceCallbackFuncs *callback_funcs)
{ GMainContext *context; gpointer old_cb_data; GSourceCallbackFuncs *old_cb_funcs; g_return_if_fail (source != NULL); g_return_if_fail (callback_funcs != NULL || callback_data == NULL); context = source->context; if (context) LOCK_CONTEXT (context); old_cb_data = source->callback_data; old_cb_funcs = source->callback_funcs; source->callback_data = callback_data; source->callback_funcs = callback_funcs; if (context) UNLOCK_CONTEXT (context); if (old_cb_funcs) old_cb_funcs->unref (old_cb_data); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function should be called with the sas_topology_mutex already held */
static struct mptsas_portinfo* mptsas_find_portinfo_by_handle(MPT_ADAPTER *ioc, u16 handle)
/* This function should be called with the sas_topology_mutex already held */ static struct mptsas_portinfo* mptsas_find_portinfo_by_handle(MPT_ADAPTER *ioc, u16 handle)
{ struct mptsas_portinfo *port_info, *rc=NULL; int i; list_for_each_entry(port_info, &ioc->sas_topology, list) for (i = 0; i < port_info->num_phys; i++) if (port_info->phy_info[i].identify.handle == handle) { rc = port_info; goto out; } out: return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* interact_open() is a callback from the input open routine. */
static int interact_open(struct input_dev *dev)
/* interact_open() is a callback from the input open routine. */ static int interact_open(struct input_dev *dev)
{ struct interact *interact = input_get_drvdata(dev); gameport_start_polling(interact->gameport); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* this function is a POSIX compliant version, which will open a file and return a file descriptor according specified flags. */
int open(const char *file, int flags,...)
/* this function is a POSIX compliant version, which will open a file and return a file descriptor according specified flags. */ int open(const char *file, int flags,...)
{ int fd, result; struct dfs_file *d; fd = fd_new(); if (fd < 0) { rt_set_errno(-ENOMEM); return -1; } d = fd_get(fd); result = dfs_file_open(d, file, flags); if (result < 0) { fd_release(fd); rt_set_errno(result); return -1; } return fd; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The only subtle point is that another CPU may be still using the pagetable because of lazy tlb flushing. This means we need need to switch all CPUs off this pagetable before we can unpin it. */
void xen_exit_mmap(struct mm_struct *mm)
/* The only subtle point is that another CPU may be still using the pagetable because of lazy tlb flushing. This means we need need to switch all CPUs off this pagetable before we can unpin it. */ void xen_exit_mmap(struct mm_struct *mm)
{ get_cpu(); xen_drop_mm_ref(mm); put_cpu(); spin_lock(&mm->page_table_lock); if (xen_page_pinned(mm->pgd)) xen_pgd_unpin(mm); spin_unlock(&mm->page_table_lock); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Decrease the reference count of the net buffer by one. Free the associated net vector and itself if the reference count of the net buffer is decreased to 0. The net vector free operation just decrease the reference count of the net vector by one and do the real resource free operation when the reference count of the net vector is 0. */
VOID EFIAPI NetbufFree(IN NET_BUF *Nbuf)
/* Decrease the reference count of the net buffer by one. Free the associated net vector and itself if the reference count of the net buffer is decreased to 0. The net vector free operation just decrease the reference count of the net vector by one and do the real resource free operation when the reference count of the net vector is 0. */ VOID EFIAPI NetbufFree(IN NET_BUF *Nbuf)
{ ASSERT (Nbuf != NULL); NET_CHECK_SIGNATURE (Nbuf, NET_BUF_SIGNATURE); ASSERT (Nbuf->RefCnt > 0); Nbuf->RefCnt--; if (Nbuf->RefCnt == 0) { NetbufFreeVector (Nbuf->Vector); FreePool (Nbuf); } }
tianocore/edk2
C++
Other
4,240
/* Set callback to be called in interrupt handler. */
int32_t _i2c_m_async_register_callback(struct _i2c_m_async_device *const i2c_dev, enum _i2c_m_async_callback_type type, FUNC_PTR func)
/* Set callback to be called in interrupt handler. */ int32_t _i2c_m_async_register_callback(struct _i2c_m_async_device *const i2c_dev, enum _i2c_m_async_callback_type type, FUNC_PTR func)
{ switch (type) { case I2C_M_ASYNC_DEVICE_ERROR: i2c_dev->cb.error = (_i2c_error_cb_t)func; break; case I2C_M_ASYNC_DEVICE_TX_COMPLETE: i2c_dev->cb.tx_complete = (_i2c_complete_cb_t)func; break; case I2C_M_ASYNC_DEVICE_RX_COMPLETE: i2c_dev->cb.rx_complete = (_i2c_complete_cb_t)func; break; default: break; } return ERR_NONE; }
eclipse-threadx/getting-started
C++
Other
310
/* Returns: (transfer full) (type GThemedIcon): a new #GThemedIcon. */
GIcon* g_themed_icon_new(const char *iconname)
/* Returns: (transfer full) (type GThemedIcon): a new #GThemedIcon. */ GIcon* g_themed_icon_new(const char *iconname)
{ g_return_val_if_fail (iconname != NULL, NULL); return G_ICON (g_object_new (G_TYPE_THEMED_ICON, "name", iconname, NULL)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Shut down the timer that polls for relock occasions, if needed this is "hooked" from ipath_7220_quiet_serdes(), which is called just before ipath_shutdown_device() in ipath_driver.c shuts down all the other timers */
void ipath_shutdown_relock_poll(struct ipath_devdata *dd)
/* Shut down the timer that polls for relock occasions, if needed this is "hooked" from ipath_7220_quiet_serdes(), which is called just before ipath_shutdown_device() in ipath_driver.c shuts down all the other timers */ void ipath_shutdown_relock_poll(struct ipath_devdata *dd)
{ struct ipath_relock *irp = &dd->ipath_relock_singleton; if (atomic_read(&irp->ipath_relock_timer_active)) { del_timer_sync(&irp->ipath_relock_timer); atomic_set(&irp->ipath_relock_timer_active, 0); } }
robutest/uclinux
C++
GPL-2.0
60
/* If the conversion results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUint16ToChar8(IN UINT16 Operand, OUT CHAR8 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUint16ToChar8(IN UINT16 Operand, OUT CHAR8 *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if (Operand <= MAX_INT8) { *Result = (INT8)Operand; Status = RETURN_SUCCESS; } else { *Result = CHAR8_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* This expects that a journal write has been reserved on lookup->dl_prev_leaf_bh or lookup->dl_dx_root_bh */
static void ocfs2_recalc_free_list(struct inode *dir, handle_t *handle, struct ocfs2_dir_lookup_result *lookup)
/* This expects that a journal write has been reserved on lookup->dl_prev_leaf_bh or lookup->dl_dx_root_bh */ static void ocfs2_recalc_free_list(struct inode *dir, handle_t *handle, struct ocfs2_dir_lookup_result *lookup)
{ int max_rec_len; struct ocfs2_dir_block_trailer *trailer; max_rec_len = ocfs2_find_max_rec_len(dir->i_sb, lookup->dl_leaf_bh); if (max_rec_len) { trailer = ocfs2_trailer_from_bh(lookup->dl_leaf_bh, dir->i_sb); trailer->db_free_rec_len = cpu_to_le16(max_rec_len); ocfs2_journal_dirty(handle, lookup->dl_leaf_bh); } else { ocfs2_remove_block_from_free_list(dir, handle, lookup); } }
robutest/uclinux
C++
GPL-2.0
60
/* Starts intermediate checksum computation. Configures the CRC module for the specified CRC protocol. */
static void CRC_SetRawProtocolConfig(CRC_Type *base, const crc_config_t *protocolConfig)
/* Starts intermediate checksum computation. Configures the CRC module for the specified CRC protocol. */ static void CRC_SetRawProtocolConfig(CRC_Type *base, const crc_config_t *protocolConfig)
{ crc_module_config_t moduleConfig; moduleConfig.polynomial = protocolConfig->polynomial; moduleConfig.seed = protocolConfig->seed; moduleConfig.readTranspose = kCrcTransposeNone; moduleConfig.writeTranspose = CRC_GetTransposeTypeFromReflectIn(protocolConfig->reflectIn); moduleConfig.complementChecksum = false; moduleConfig.crcBits = protocolConfig->crcBits; CRC_ConfigureAndStart(base, &moduleConfig); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read a single byte from the transport channel. */
static int read_byte(struct gnss_driver_t *self_p, char *byte_p)
/* Read a single byte from the transport channel. */ static int read_byte(struct gnss_driver_t *self_p, char *byte_p)
{ int res; res = chan_read(self_p->chin_p, byte_p, sizeof(*byte_p)); if (res == 0) { res = -EIO; } return (res); }
eerimoq/simba
C++
Other
337
/* Status command helper function. Display the update rate of the ADC registers. */
static int32_t cn0414_status_update_rate(struct cn0414_dev *dev)
/* Status command helper function. Display the update rate of the ADC registers. */ static int32_t cn0414_status_update_rate(struct cn0414_dev *dev)
{ int32_t ret; uint8_t buff[20]; ret = usr_uart_write_string(dev->uart_descriptor, (uint8_t*)"Channel update rate: "); if(ret != CN0414_SUCCESS) return ret; sprintf((char *)buff, "%f", dev->adc_update_desc->f_update); ret = usr_uart_write_string(dev->uart_descriptor, buff); if(ret != CN0414_SUCCESS) return ret; return usr_uart_write_string(dev->uart_descriptor, (uint8_t*)"Hz\n"); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Sample a per-thread clock for the given task. */
static int cpu_clock_sample(const clockid_t which_clock, struct task_struct *p, union cpu_time_count *cpu)
/* Sample a per-thread clock for the given task. */ static int cpu_clock_sample(const clockid_t which_clock, struct task_struct *p, union cpu_time_count *cpu)
{ switch (CPUCLOCK_WHICH(which_clock)) { default: return -EINVAL; case CPUCLOCK_PROF: cpu->cpu = prof_ticks(p); break; case CPUCLOCK_VIRT: cpu->cpu = virt_ticks(p); break; case CPUCLOCK_SCHED: cpu->sched = task_sched_runtime(p); break; } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* igb_has_link - check shared code for link and determine up/down @adapter: pointer to driver private info */
static bool igb_has_link(struct igb_adapter *adapter)
/* igb_has_link - check shared code for link and determine up/down @adapter: pointer to driver private info */ static bool igb_has_link(struct igb_adapter *adapter)
{ struct e1000_hw *hw = &adapter->hw; bool link_active = false; s32 ret_val = 0; switch (hw->phy.media_type) { case e1000_media_type_copper: if (hw->mac.get_link_status) { ret_val = hw->mac.ops.check_for_link(hw); link_active = !hw->mac.get_link_status; } else { link_active = true; } break; case e1000_media_type_internal_serdes: ret_val = hw->mac.ops.check_for_link(hw); link_active = hw->mac.serdes_has_link; break; default: case e1000_media_type_unknown: break; } return link_active; }
robutest/uclinux
C++
GPL-2.0
60
/* Report Error if xflag is set in addition to default */
static int kwbimage_check_params(struct mkimage_params *params)
/* Report Error if xflag is set in addition to default */ static int kwbimage_check_params(struct mkimage_params *params)
{ if (!strlen (params->imagename)) { printf ("Error:%s - Configuration file not specified, " "it is needed for kwbimage generation\n", params->cmdname); return CFG_INVALID; } return ((params->dflag && (params->fflag || params->lflag)) || (params->fflag && (params->dflag || params->lflag)) || (params->lflag && (params->dflag || params->fflag)) || (params->xflag) || !(strlen (params->imagename))); }
EmcraftSystems/u-boot
C++
Other
181
/* atlx_tx_timeout - Respond to a Tx Hang @netdev: network interface device structure */
static void atlx_tx_timeout(struct net_device *netdev)
/* atlx_tx_timeout - Respond to a Tx Hang @netdev: network interface device structure */ static void atlx_tx_timeout(struct net_device *netdev)
{ struct atlx_adapter *adapter = netdev_priv(netdev); schedule_work(&adapter->tx_timeout_task); }
robutest/uclinux
C++
GPL-2.0
60
/* Change stack's location to DTCM. The function changes the stack's location from SRAM to DTCM */
static void tcm_stackinit(void)
/* Change stack's location to DTCM. The function changes the stack's location from SRAM to DTCM */ static void tcm_stackinit(void)
{ uint32_t offset = (uint32_t)SRAM_STACK_LIMIT - (uint32_t)DTCM_STACK_LIMIT; volatile char *dst = (volatile char *)DTCM_STACK_LIMIT; volatile char *src = (volatile char *)SRAM_STACK_LIMIT; while(src > (volatile char *)SRAM_STACK_BASE){ *--dst = *--src; } __set_MSP(__get_MSP() - offset); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Adds the driver structure to the list of registered drivers Returns zero or a negative error value. */
int dio_register_driver(struct dio_driver *drv)
/* Adds the driver structure to the list of registered drivers Returns zero or a negative error value. */ int dio_register_driver(struct dio_driver *drv)
{ drv->driver.name = drv->name; drv->driver.bus = &dio_bus_type; return driver_register(&drv->driver); }
robutest/uclinux
C++
GPL-2.0
60
/* Wait ~100us for the serial eeprom to satisfy our request. */
static int ahd_wait_seeprom(struct ahd_softc *ahd)
/* Wait ~100us for the serial eeprom to satisfy our request. */ static int ahd_wait_seeprom(struct ahd_softc *ahd)
{ int cnt; cnt = 5000; while ((ahd_inb(ahd, SEESTAT) & (SEEARBACK|SEEBUSY)) != 0 && --cnt) ahd_delay(5); if (cnt == 0) return (ETIMEDOUT); return (0); }
robutest/uclinux
C++
GPL-2.0
60
/* create data byte 25 from color 1 and 2 GBC */
static uint8_t tlc5971_data_byte25(uint8_t gbc_color_1, uint8_t gbc_color_2)
/* create data byte 25 from color 1 and 2 GBC */ static uint8_t tlc5971_data_byte25(uint8_t gbc_color_1, uint8_t gbc_color_2)
{ return FIELD_PREP(TLC5971_BYTE25_GBC1_MASK, gbc_color_1 << 6) | FIELD_PREP(TLC5971_BYTE25_GBC2_MASK, gbc_color_2 >> 1); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This is called when the refcount of the edd structure reaches 0. This should happen right after we unregister, but just in case, we use the release callback anyway. */
static void edd_release(struct kobject *kobj)
/* This is called when the refcount of the edd structure reaches 0. This should happen right after we unregister, but just in case, we use the release callback anyway. */ static void edd_release(struct kobject *kobj)
{ struct edd_device * dev = to_edd_device(kobj); kfree(dev); }
robutest/uclinux
C++
GPL-2.0
60
/* set up a shared mapping on a file (the driver or filesystem provides and pins the storage) */
static int do_mmap_shared_file(struct vm_area_struct *vma)
/* set up a shared mapping on a file (the driver or filesystem provides and pins the storage) */ static int do_mmap_shared_file(struct vm_area_struct *vma)
{ int ret; ret = vma->vm_file->f_op->mmap(vma->vm_file, vma); if (ret == 0) { vma->vm_region->vm_top = vma->vm_region->vm_end; return 0; } if (ret != -ENOSYS) return ret; return -ENODEV; }
robutest/uclinux
C++
GPL-2.0
60
/* scheduler tick hitting a task of our scheduling class: */
static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued)
/* scheduler tick hitting a task of our scheduling class: */ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued)
{ struct cfs_rq *cfs_rq; struct sched_entity *se = &curr->se; for_each_sched_entity(se) { cfs_rq = cfs_rq_of(se); entity_tick(cfs_rq, se, queued); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function is used for getting the count of block I/O devices that one specific block driver detects. To the PEI ATAPI driver, it returns the number of all the detected ATAPI devices it detects during the enumeration process. To the PEI legacy floppy driver, it returns the number of all the legacy devices it finds during its enumeration process. If no device is detected, then the function will return zero. */
EFI_STATUS EFIAPI EmmcBlockIoPeimGetDeviceNo2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, OUT UINTN *NumberBlockDevices)
/* This function is used for getting the count of block I/O devices that one specific block driver detects. To the PEI ATAPI driver, it returns the number of all the detected ATAPI devices it detects during the enumeration process. To the PEI legacy floppy driver, it returns the number of all the legacy devices it finds during its enumeration process. If no device is detected, then the function will return zero. */ EFI_STATUS EFIAPI EmmcBlockIoPeimGetDeviceNo2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, OUT UINTN *NumberBlockDevices)
{ EMMC_PEIM_HC_PRIVATE_DATA *Private; Private = GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS2 (This); *NumberBlockDevices = Private->TotalBlkIoDevices; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Routine to get the next Handle, when you are searching for a given protocol. */
IHANDLE* UnitTestGetNextLocateByProtocol(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface)
/* Routine to get the next Handle, when you are searching for a given protocol. */ IHANDLE* UnitTestGetNextLocateByProtocol(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface)
{ IHANDLE *Handle; LIST_ENTRY *Link; PROTOCOL_INTERFACE *Prot; Handle = NULL; *Interface = NULL; for ( ; ;) { Link = Position->Position->ForwardLink; Position->Position = Link; if (Link == &Position->ProtEntry->Protocols) { Handle = NULL; break; } Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE); Handle = Prot->Handle; *Interface = Prot->Interface; if (Handle->LocateRequest != mEfiLocateHandleRequest) { Handle->LocateRequest = mEfiLocateHandleRequest; break; } } return Handle; }
tianocore/edk2
C++
Other
4,240
/* Disables SIR (IrDA) mode on the specified UART. */
void UARTDisableIrDA(unsigned long ulBase)
/* Disables SIR (IrDA) mode on the specified UART. */ void UARTDisableIrDA(unsigned long ulBase)
{ xASSERT(UARTBaseValid(ulBase)); xHWREG(ulBase + USART_CR3) &= ~(USART_CR3_IREN); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Indicate whether the driver is currently executing in the SMM Initialization phase. */
EFI_STATUS EFIAPI SmmBase2InSmram(IN CONST EFI_SMM_BASE2_PROTOCOL *This, OUT BOOLEAN *InSmram)
/* Indicate whether the driver is currently executing in the SMM Initialization phase. */ EFI_STATUS EFIAPI SmmBase2InSmram(IN CONST EFI_SMM_BASE2_PROTOCOL *This, OUT BOOLEAN *InSmram)
{ if (InSmram == NULL) { return EFI_INVALID_PARAMETER; } *InSmram = gSmmCorePrivate->InSmm; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* After the DRAM is powered up or reset, the DDR3 spec requires to wait at least 500 us before driving the CKE pin (Clock Enable) high. The dram->idct (SDR_IDCR) register appears to configure this delay, which gets applied right at the time when the DRAM initialization is activated in the 'mctl_ddr3_initialize' function. */
static void mctl_set_cke_delay(void)
/* After the DRAM is powered up or reset, the DDR3 spec requires to wait at least 500 us before driving the CKE pin (Clock Enable) high. The dram->idct (SDR_IDCR) register appears to configure this delay, which gets applied right at the time when the DRAM initialization is activated in the 'mctl_ddr3_initialize' function. */ static void mctl_set_cke_delay(void)
{ struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE; setbits_le32(&dram->idcr, 0x1ffff); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Handling an interrupt is a two-step process: first you claim the interrupt by reading the claim register, then you complete the interrupt by writing that source ID back to the same claim register. This automatically enables and disables the interrupt, so there's nothing else to do. */
void plic_handle_irq(void)
/* Handling an interrupt is a two-step process: first you claim the interrupt by reading the claim register, then you complete the interrupt by writing that source ID back to the same claim register. This automatically enables and disables the interrupt, so there's nothing else to do. */ void plic_handle_irq(void)
{ int cpu = 0; unsigned int irq; struct plic_handler *handler = &c906_plic_handlers[cpu]; void *claim = (void *)((rt_size_t)handler->hart_base + CONTEXT_CLAIM); if (c906_plic_regs == RT_NULL || !handler->present) { LOG_E("plic state not initialized."); return; } clear_csr(sie, SIE_SEIE); while ((irq = readl(claim))) { if (irq == 0) { LOG_E("irq no is zero."); } else { generic_handle_irq(irq); } } set_csr(sie, SIE_SEIE); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Generate indication for 'Value V6' attribute, if indications are enabled. */
void service_b_3_3_value_v6_indicate(void)
/* Generate indication for 'Value V6' attribute, if indications are enabled. */ void service_b_3_3_value_v6_indicate(void)
{ if (!value_v6_ind_active) return; ind_params.attr = &service_b_3_3_attrs[2]; ind_params.func = value_v6_indicate_cb; ind_params.destroy = NULL; ind_params.data = &value_v6_value; ind_params.len = sizeof(value_v6_value); bt_gatt_indicate(NULL, &ind_params); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Airpcap wrapper, used to turn on the led of an airpcap adapter */
gboolean airpcap_if_turn_led_on(PAirpcapHandle AdapterHandle, guint LedNumber)
/* Airpcap wrapper, used to turn on the led of an airpcap adapter */ gboolean airpcap_if_turn_led_on(PAirpcapHandle AdapterHandle, guint LedNumber)
{ if (!AirpcapLoaded) return FALSE; return g_PAirpcapTurnLedOn(AdapterHandle,LedNumber); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The functions for inserting/removing us as a module. */
static int __init twidjoy_init(void)
/* The functions for inserting/removing us as a module. */ static int __init twidjoy_init(void)
{ return serio_register_driver(&twidjoy_drv); }
robutest/uclinux
C++
GPL-2.0
60
/* Called by main(), after creating QemuConsoles and before initializing ui (sdl/vnc/...). */
DisplayState* init_displaystate(void)
/* Called by main(), after creating QemuConsoles and before initializing ui (sdl/vnc/...). */ DisplayState* init_displaystate(void)
{ Error *local_err = NULL; gchar *name; int i; if (!display_state) { display_state = g_new0(DisplayState, 1); } for (i = 0; i < nb_consoles; i++) { if (consoles[i]->console_type != GRAPHIC_CONSOLE && consoles[i]->ds == NULL) { text_console_do_init(consoles[i]->chr, display_state); } name = g_strdup_printf("console[%d]", i); object_property_add_child(container_get(object_get_root(), "/backend"), name, OBJECT(consoles[i]), &local_err); g_free(name); } return display_state; }
ve3wwg/teensy3_qemu
C++
Other
15
/* Used to process(transform) blocks of data, either encrypt or decrypt it. */
bool AESDataProcess(uint32_t ui32Base, uint32_t *pui32Src, uint32_t *pui32Dest, uint32_t ui32Length)
/* Used to process(transform) blocks of data, either encrypt or decrypt it. */ bool AESDataProcess(uint32_t ui32Base, uint32_t *pui32Src, uint32_t *pui32Dest, uint32_t ui32Length)
{ uint32_t ui32Count; ASSERT(ui32Base == AES_BASE); AESLengthSet(AES_BASE, (uint64_t)ui32Length); for(ui32Count = 0; ui32Count < ui32Length; ui32Count += 16) { AESDataWrite(ui32Base, pui32Src + (ui32Count / 4)); AESDataRead(ui32Base, pui32Dest + (ui32Count / 4)); } return(true); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The common case is 1:1 IRQ<->pin mappings. Sometimes there are shared ISA-space IRQs, so we have to support them. We are super fast in the common case, and fast for shared ISA-space IRQs. */
static int add_pin_to_irq_node_nopanic(struct irq_cfg *cfg, int node, int apic, int pin)
/* The common case is 1:1 IRQ<->pin mappings. Sometimes there are shared ISA-space IRQs, so we have to support them. We are super fast in the common case, and fast for shared ISA-space IRQs. */ static int add_pin_to_irq_node_nopanic(struct irq_cfg *cfg, int node, int apic, int pin)
{ struct irq_pin_list **last, *entry; last = &cfg->irq_2_pin; for_each_irq_pin(entry, cfg->irq_2_pin) { if (entry->apic == apic && entry->pin == pin) return 0; last = &entry->next; } entry = get_one_free_irq_2_pin(node); if (!entry) { printk(KERN_ERR "can not alloc irq_pin_list (%d,%d,%d)\n", node, apic, pin); return -ENOMEM; } entry->apic = apic; entry->pin = pin; *last = entry; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Write data element to the SPI interface with block. */
void xSPIDataPut(unsigned long ulBase, unsigned long ulData)
/* Write data element to the SPI interface with block. */ void xSPIDataPut(unsigned long ulBase, unsigned long ulData)
{ unsigned char ucBitLength = SPIBitLengthGet(ulBase); unsigned long ulFlag; xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)); ulFlag = xHWREG(ulBase + SPI_FCR) & SPI_FCR_FIFOEN; if(ulFlag != SPI_FCR_FIFOEN) { while(!(xHWREG(ulBase + SPI_SR) & SPI_SR_TXE)) { } } else { while(!(xHWREG(ulBase + SPI_SR) & SPI_SR_TXBE)) { } } if(ucBitLength <= 8 && ucBitLength != 0) { xHWREG(ulBase + SPI_DR) = ulData & 0xFF; } else { xHWREG(ulBase + SPI_DR) = ulData & 0xFFFF; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* IDL typedef struct { IDL long element_55; IDL byte *element_56; IDL } TYPE_9; */
static int dissect_browser_TYPE_9_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
/* IDL typedef struct { IDL long element_55; IDL byte *element_56; IDL } TYPE_9; */ static int dissect_browser_TYPE_9_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
{ guint32 len; if(di->conformant_run){ offset =dissect_ndr_ucarray(tvb, offset, pinfo, tree, di, drep, NULL); return offset; } offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_browser_unknown_long, &len); proto_tree_add_item(tree, hf_browser_unknown_bytes, tvb, offset, len, ENC_NA); offset += len; return offset; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Enable the watch dog timer's function. This function is to Enable the watch dog timer's function such as Interrupt reset. */
void xWDTFunctionEnable(unsigned long ulBase, unsigned long ulFunction)
/* Enable the watch dog timer's function. This function is to Enable the watch dog timer's function such as Interrupt reset. */ void xWDTFunctionEnable(unsigned long ulBase, unsigned long ulFunction)
{ xASSERT(ulBase == xWDT_BASE); xASSERT(((ulFunction & WDT_INT_FUNCTION) == WDT_INT_FUNCTION) || ((ulFunction & WDT_RESET_FUNCTION) == WDT_RESET_FUNCTION) || ((ulFunction & WDT_WAKEUP_FUNCTION) == WDT_WAKEUP_FUNCTION) || ((ulFunction & WDT_HOLD_IN_ICE) == WDT_HOLD_IN_ICE)); SysCtlKeyAddrUnlock(); xHWREG(WDT_WTCR) |= ulFunction; SysCtlKeyAddrLock(); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Returns zero on success, CMD_RET_USAGE in case of misuse and negative on error. */
static int do_dek_blob(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
/* Returns zero on success, CMD_RET_USAGE in case of misuse and negative on error. */ static int do_dek_blob(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
{ uint32_t src_addr, dst_addr, len; uint8_t *src_ptr, *dst_ptr; int ret = 0; if (argc != 4) return CMD_RET_USAGE; src_addr = simple_strtoul(argv[1], NULL, 16); dst_addr = simple_strtoul(argv[2], NULL, 16); len = simple_strtoul(argv[3], NULL, 10); src_ptr = map_sysmem(src_addr, len/8); dst_ptr = map_sysmem(dst_addr, BLOB_SIZE(len/8)); ret = blob_encap_dek(src_ptr, dst_ptr, len); return ret; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Reconnect gameport port and all its children (re-initialize attached devices) */
static void gameport_reconnect_port(struct gameport *gameport)
/* Reconnect gameport port and all its children (re-initialize attached devices) */ static void gameport_reconnect_port(struct gameport *gameport)
{ do { if (!gameport->drv || !gameport->drv->reconnect || gameport->drv->reconnect(gameport)) { gameport_disconnect_port(gameport); gameport_find_driver(gameport); break; } gameport = gameport->child; } while (gameport); }
robutest/uclinux
C++
GPL-2.0
60
/* If Map is NULL, then ASSERT(). If Key is NULL, then ASSERT(). */
EFI_STATUS EFIAPI NetMapInsertTail(IN OUT NET_MAP *Map, IN VOID *Key, IN VOID *Value OPTIONAL)
/* If Map is NULL, then ASSERT(). If Key is NULL, then ASSERT(). */ EFI_STATUS EFIAPI NetMapInsertTail(IN OUT NET_MAP *Map, IN VOID *Key, IN VOID *Value OPTIONAL)
{ NET_MAP_ITEM *Item; ASSERT (Map != NULL && Key != NULL); Item = NetMapAllocItem (Map); if (Item == NULL) { return EFI_OUT_OF_RESOURCES; } Item->Key = Key; Item->Value = Value; InsertTailList (&Map->Used, &Item->Link); Map->Count++; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240