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
/* Description: Remove all the NetLabel labeling from @req. */
void netlbl_req_delattr(struct request_sock *req)
/* Description: Remove all the NetLabel labeling from @req. */ void netlbl_req_delattr(struct request_sock *req)
{ cipso_v4_req_delattr(req); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns CR_OK upon successfull completion, an error code otherwise. */
enum CRStatus cr_parser_parse_file(CRParser *a_this, const guchar *a_file_uri, enum CREncoding a_enc)
/* Returns CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_parser_parse_file(CRParser *a_this, const guchar *a_file_uri, enum CREncoding a_enc)
{ enum CRStatus status = CR_ERROR; CRTknzr *tknzr = NULL; g_return_val_if_fail (a_this && PRIVATE (a_this) && a_file_uri, CR_BAD_PARAM_ERROR); tknzr = cr_tknzr_new_from_uri (a_file_uri, a_enc); g_return_val_if_fail (tknzr != NULL, CR_ERROR); status = cr_parser_set_tknzr (a_this, tknzr); g_return_val_if_fail (status == CR_OK, CR_ERROR); status = cr_parser_parse (a_this); return status; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Extracts ebp, esp and eip values understandable by gdb from the values saved by switch_to. thread.esp points to ebp. flags and ebp are pushed in switch_to hence esp prior to entering switch_to is 8 greater than the value that is saved. If switch_to changes, change following code appropriately. */
void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
/* Extracts ebp, esp and eip values understandable by gdb from the values saved by switch_to. thread.esp points to ebp. flags and ebp are pushed in switch_to hence esp prior to entering switch_to is 8 greater than the value that is saved. If switch_to changes, change following code appropriately. */ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
{ gdb_regs[BFIN_SP] = p->thread.ksp; gdb_regs[BFIN_PC] = p->thread.pc; gdb_regs[BFIN_SEQSTAT] = p->thread.seqstat; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return true if any register that is used on exit from 'succ', has an exit value that is different from the corresponding exit value from 'b'. */
static int use_conflict(struct block *b, struct block *succ)
/* Return true if any register that is used on exit from 'succ', has an exit value that is different from the corresponding exit value from 'b'. */ static int use_conflict(struct block *b, struct block *succ)
{ int atom; atomset use = succ->out_use; if (use == 0) return 0; for (atom = 0; atom < N_ATOMS; ++atom) if (ATOMELEM(use, atom)) if (b->val[atom] != succ->val[atom]) return 1; return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Adjust an existing IO region allocation, but making sure that we don't encroach outside the resources which the user supplied. */
static int nonstatic_adjust_io_region(struct resource *res, unsigned long r_start, unsigned long r_end, struct pcmcia_socket *s)
/* Adjust an existing IO region allocation, but making sure that we don't encroach outside the resources which the user supplied. */ static int nonstatic_adjust_io_region(struct resource *res, unsigned long r_start, unsigned long r_end, struct pcmcia_socket *s)
{ struct resource_map *m; struct socket_data *s_data = s->resource_data; int ret = -ENOMEM; mutex_lock(&rsrc_mutex); for (m = s_data->io_db.next; m != &s_data->io_db; m = m->next) { unsigned long start = m->base; unsigned long end = m->base + m->num - 1; if (start > r_start || r_end > end) continue; ret = adjust_resource(res, r_start, r_end - r_start + 1); break; } mutex_unlock(&rsrc_mutex); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* SHARE: create a DOS share or alter existing share. */
static __be32 nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, struct nlm_res *resp)
/* SHARE: create a DOS share or alter existing share. */ static __be32 nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, struct nlm_res *resp)
{ struct nlm_host *host; struct nlm_file *file; dprintk("lockd: SHARE called\n"); resp->cookie = argp->cookie; if (locks_in_grace() && !argp->reclaim) { resp->status = nlm_lck_denied_grace_period; return rpc_success; } if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; resp->status = nlmsvc_share_file(host, file, argp); dprintk("lockd: SHARE status %d\n", ntohl(resp->status)); nlm_release_host(host); nlm_release_file(file); return rpc_success; }
robutest/uclinux
C++
GPL-2.0
60
/* All files which have been polled are linked to RB tree fuse_conn->polled_files which is indexed by kh. Walk the tree and find the matching one. */
static struct rb_node** fuse_find_polled_node(struct fuse_conn *fc, u64 kh, struct rb_node **parent_out)
/* All files which have been polled are linked to RB tree fuse_conn->polled_files which is indexed by kh. Walk the tree and find the matching one. */ static struct rb_node** fuse_find_polled_node(struct fuse_conn *fc, u64 kh, struct rb_node **parent_out)
{ struct rb_node **link = &fc->polled_files.rb_node; struct rb_node *last = NULL; while (*link) { struct fuse_file *ff; last = *link; ff = rb_entry(last, struct fuse_file, polled_node); if (kh < ff->kh) link = &last->rb_left; else if (kh > ff->kh) link = &last->rb_right; else return link; } if (parent_out) *parent_out = last; return link; }
robutest/uclinux
C++
GPL-2.0
60
/* This routine wait for all AP processors to arrive in SMM. */
EFI_STATUS EFIAPI SmmWaitForAllProcessor(IN BOOLEAN BlockingMode)
/* This routine wait for all AP processors to arrive in SMM. */ EFI_STATUS EFIAPI SmmWaitForAllProcessor(IN BOOLEAN BlockingMode)
{ EFI_STATUS Status; if ((mRegistration == NULL) && (mSmmCpuRendezvous == NULL)) { Status = gMmst->MmLocateProtocol ( &gEdkiiSmmCpuRendezvousProtocolGuid, NULL, (VOID **)&mSmmCpuRendezvous ); if (EFI_ERROR (Status)) { Status = gMmst->MmRegisterProtocolNotify ( &gEdkiiSmmCpuRendezvousProtocolGuid, SmmCpuRendezvousProtocolNotify, &mRegistration ); if (EFI_ERROR (Status)) { return Status; } } } if (mSmmCpuRendezvous == NULL) { return EFI_SUCCESS; } Status = mSmmCpuRendezvous->WaitForAllProcessor ( mSmmCpuRendezvous, BlockingMode ); return Status; }
tianocore/edk2
C++
Other
4,240
/* Description: vxfs_put_super frees all resources allocated for @sbp after the last instance of the filesystem is unmounted. */
static void vxfs_put_super(struct super_block *)
/* Description: vxfs_put_super frees all resources allocated for @sbp after the last instance of the filesystem is unmounted. */ static void vxfs_put_super(struct super_block *)
{ struct vxfs_sb_info *infp = VXFS_SBI(sbp); lock_kernel(); vxfs_put_fake_inode(infp->vsi_fship); vxfs_put_fake_inode(infp->vsi_ilist); vxfs_put_fake_inode(infp->vsi_stilist); brelse(infp->vsi_bp); kfree(infp); unlock_kernel(); }
robutest/uclinux
C++
GPL-2.0
60
/* Low power mode shrinks power consumption about 100x, so we'd like the chip to be in that mode whenever it's inactive. (However, we can't stay in lowpower mode during suspend with WOL active.) */
static void enc28j60_lowpower(struct enc28j60_net *priv, bool is_low)
/* Low power mode shrinks power consumption about 100x, so we'd like the chip to be in that mode whenever it's inactive. (However, we can't stay in lowpower mode during suspend with WOL active.) */ static void enc28j60_lowpower(struct enc28j60_net *priv, bool is_low)
{ if (netif_msg_drv(priv)) dev_dbg(&priv->spi->dev, "%s power...\n", is_low ? "low" : "high"); mutex_lock(&priv->lock); if (is_low) { nolock_reg_bfclr(priv, ECON1, ECON1_RXEN); poll_ready(priv, ESTAT, ESTAT_RXBUSY, 0); poll_ready(priv, ECON1, ECON1_TXRTS, 0); nolock_reg_bfset(priv, ECON2, ECON2_PWRSV); } else { nolock_reg_bfclr(priv, ECON2, ECON2_PWRSV); poll_ready(priv, ESTAT, ESTAT_CLKRDY, ESTAT_CLKRDY); } mutex_unlock(&priv->lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Scan the ACPI System Descriptor Table (STD) for a table matching @id, run @handler on it. Return 0 if table found, return on if not. */
int __init acpi_table_parse(char *id, acpi_table_handler handler)
/* Scan the ACPI System Descriptor Table (STD) for a table matching @id, run @handler on it. Return 0 if table found, return on if not. */ int __init acpi_table_parse(char *id, acpi_table_handler handler)
{ struct acpi_table_header *table = NULL; acpi_size tbl_size; if (acpi_disabled && !acpi_ht) return -ENODEV; if (!handler) return -EINVAL; if (strncmp(id, ACPI_SIG_MADT, 4) == 0) acpi_get_table_with_size(id, acpi_apic_instance, &table, &tbl_size); else acpi_get_table_with_size(id, 0, &table, &tbl_size); if (table) { handler(table); early_acpi_os_unmap_memory(table, tbl_size); return 0; } else return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Get None Cache address according to Cache address. */
int ATTR_TCM_SECTION L1C_Get_None_Cache_Addr(uintptr_t addr)
/* Get None Cache address according to Cache address. */ int ATTR_TCM_SECTION L1C_Get_None_Cache_Addr(uintptr_t addr)
{ return (addr&0x0FFFFFFF)|0x20000000; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The idle thread. There's no useful work to be done, so just try to conserve power and have a low exit latency (ie sit in a loop waiting for somebody to say that they'd like to reschedule) */
void cpu_idle(void)
/* The idle thread. There's no useful work to be done, so just try to conserve power and have a low exit latency (ie sit in a loop waiting for somebody to say that they'd like to reschedule) */ void cpu_idle(void)
{ while (1) { while (!need_resched()) { void (*idle)(void); idle = pm_idle; if (!idle) idle = default_idle; idle(); } preempt_enable_no_resched(); schedule(); preempt_disable(); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* tipc_ref_lock - lock referenced object and return pointer to it */
void* tipc_ref_lock(u32 ref)
/* tipc_ref_lock - lock referenced object and return pointer to it */ void* tipc_ref_lock(u32 ref)
{ if (likely(tipc_ref_table.entries)) { struct reference *entry; entry = &tipc_ref_table.entries[ref & tipc_ref_table.index_mask]; if (likely(entry->ref != 0)) { spin_lock_bh(&entry->lock); if (likely((entry->ref == ref) && (entry->object))) return entry->object; spin_unlock_bh(&entry->lock); } } return NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* IPCC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_IPCC_MspInit(IPCC_HandleTypeDef *hipcc)
/* IPCC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_IPCC_MspInit(IPCC_HandleTypeDef *hipcc)
{ if(hipcc->Instance==IPCC) { __HAL_RCC_IPCC_CLK_ENABLE(); HAL_NVIC_SetPriority(IPCC_RX1_IRQn, 0, 0); HAL_NVIC_EnableIRQ(IPCC_RX1_IRQn); HAL_NVIC_SetPriority(IPCC_TX1_IRQn, 0, 0); HAL_NVIC_EnableIRQ(IPCC_TX1_IRQn); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get USB Device Last Frame Number Parameters: None Return Value: Frame Number */
U32 USBD_GetFrame(void)
/* Get USB Device Last Frame Number Parameters: None Return Value: Frame Number */ U32 USBD_GetFrame(void)
{ return (LPC_USB->INFO & 0x7FF); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* This function calls check_input 6 times with the input name and a short string, which is printed properly by check_input. */
void print_loop(const char *name)
/* This function calls check_input 6 times with the input name and a short string, which is printed properly by check_input. */ void print_loop(const char *name)
{ while (count < 6) { check_input(name, "Stack ok"); count++; } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Retrieve the basic constraints from one X.509 certificate. */
BOOLEAN EFIAPI X509GetExtendedBasicConstraints(CONST UINT8 *Cert, UINTN CertSize, UINT8 *BasicConstraints, UINTN *BasicConstraintsSize)
/* Retrieve the basic constraints from one X.509 certificate. */ BOOLEAN EFIAPI X509GetExtendedBasicConstraints(CONST UINT8 *Cert, UINTN CertSize, UINT8 *BasicConstraints, UINTN *BasicConstraintsSize)
{ BOOLEAN Status; if ((Cert == NULL) || (CertSize == 0) || (BasicConstraintsSize == NULL)) { return FALSE; } Status = X509GetExtensionData ( (UINT8 *)Cert, CertSize, mOidBasicConstraints, sizeof (mOidBasicConstraints), BasicConstraints, BasicConstraintsSize ); return Status; }
tianocore/edk2
C++
Other
4,240
/* Adds the RegNumber-th register's value to the output buffer, starting at the given OutBufPtr */
CHAR8* BasicReadRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN UINTN RegNumber, IN CHAR8 *OutBufPtr)
/* Adds the RegNumber-th register's value to the output buffer, starting at the given OutBufPtr */ CHAR8* BasicReadRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN UINTN RegNumber, IN CHAR8 *OutBufPtr)
{ UINTN RegSize; RegSize = 0; while (RegSize < 64) { *OutBufPtr++ = mHexToStr[((*FindPointerToRegister (SystemContext, RegNumber) >> (RegSize+4)) & 0xf)]; *OutBufPtr++ = mHexToStr[((*FindPointerToRegister (SystemContext, RegNumber) >> RegSize) & 0xf)]; RegSize = RegSize + 8; } return OutBufPtr; }
tianocore/edk2
C++
Other
4,240
/* SYSCTRL DAC Bus Clock Enable and Reset Release. */
void LL_SYSCTRL_DAC_ClkEnRstRelease(void)
/* SYSCTRL DAC Bus Clock Enable and Reset Release. */ void LL_SYSCTRL_DAC_ClkEnRstRelease(void)
{ __LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL); __LL_SYSCTRL_DACBusClk_En(SYSCTRL); __LL_SYSCTRL_DACSoftRst_Release(SYSCTRL); __LL_SYSCTRL_Reg_Lock(SYSCTRL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the power mode used as a station. The Wi-Fi chip will enable the Wi-Fi power mode feature. */
sl_status_t sl_wfx_set_power_mode(sl_wfx_pm_mode_t mode, uint16_t interval)
/* Set the power mode used as a station. The Wi-Fi chip will enable the Wi-Fi power mode feature. */ sl_status_t sl_wfx_set_power_mode(sl_wfx_pm_mode_t mode, uint16_t interval)
{ sl_wfx_set_pm_mode_req_body_t payload; payload.power_mode = sl_wfx_htole16(mode); payload.listen_interval = sl_wfx_htole16(interval); return sl_wfx_send_command(SL_WFX_SET_PM_MODE_REQ_ID, &payload, sizeof(payload), SL_WFX_STA_INTERFACE, NULL); }
eclipse-threadx/getting-started
C++
Other
310
/* Do a read and write of a register to update only part of a register. */
int32_t adpd410x_reg_write_mask(struct adpd410x_dev *dev, uint16_t address, uint16_t data, uint16_t mask)
/* Do a read and write of a register to update only part of a register. */ int32_t adpd410x_reg_write_mask(struct adpd410x_dev *dev, uint16_t address, uint16_t data, uint16_t mask)
{ int32_t ret; uint16_t reg_val; uint32_t bit_pos; ret = adpd410x_reg_read(dev, address, &reg_val); if (ret != SUCCESS) return FAILURE; reg_val &= ~mask; bit_pos = find_first_set_bit((uint32_t)mask); reg_val |= (data << bit_pos) & mask; return adpd410x_reg_write(dev, address, reg_val); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Enable the functions of the Madge chipset needed for full working order. */
static int madgemc_chipset_init(struct net_device *dev)
/* Enable the functions of the Madge chipset needed for full working order. */ static int madgemc_chipset_init(struct net_device *dev)
{ outb(0, dev->base_addr + MC_CONTROL_REG1); tms380tr_wait(100); outb(MC_CONTROL_REG1_NSRESET, dev->base_addr + MC_CONTROL_REG1); madgemc_setsifsel(dev, 1); madgemc_setint(dev, 1); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Description: Starting at @offset, walk the bitmap from left to right until either the desired bit is found or we reach the end. Return the bit offset, -1 if not found, or -2 if error. */
static int cipso_v4_bitmap_walk(const unsigned char *bitmap, u32 bitmap_len, u32 offset, u8 state)
/* Description: Starting at @offset, walk the bitmap from left to right until either the desired bit is found or we reach the end. Return the bit offset, -1 if not found, or -2 if error. */ static int cipso_v4_bitmap_walk(const unsigned char *bitmap, u32 bitmap_len, u32 offset, u8 state)
{ u32 bit_spot; u32 byte_offset; unsigned char bitmask; unsigned char byte; byte_offset = offset / 8; byte = bitmap[byte_offset]; bit_spot = offset; bitmask = 0x80 >> (offset % 8); while (bit_spot < bitmap_len) { if ((state && (byte & bitmask) == bitmask) || (state == 0 && (byte & bitmask) == 0)) return bit_spot; bit_spot++; bitmask >>= 1; if (bitmask == 0) { byte = bitmap[++byte_offset]; bitmask = 0x80; } } return -1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* highs, and targets are managed as dynamic arrays during a table load. */
static int alloc_targets(struct dm_table *t, unsigned int num)
/* highs, and targets are managed as dynamic arrays during a table load. */ static int alloc_targets(struct dm_table *t, unsigned int num)
{ sector_t *n_highs; struct dm_target *n_targets; int n = t->num_targets; n_highs = (sector_t *) dm_vcalloc(num + 1, sizeof(struct dm_target) + sizeof(sector_t)); if (!n_highs) return -ENOMEM; n_targets = (struct dm_target *) (n_highs + num); if (n) { memcpy(n_highs, t->highs, sizeof(*n_highs) * n); memcpy(n_targets, t->targets, sizeof(*n_targets) * n); } memset(n_highs + n, -1, sizeof(*n_highs) * (num - n)); vfree(t->highs); t->num_allocated = num; t->highs = n_highs; t->targets = n_targets; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This API gets the power mode of the sensor. */
int8_t bmi160_get_power_mode(struct bmi160_pmu_status *pmu_status, const struct bmi160_dev *dev)
/* This API gets the power mode of the sensor. */ int8_t bmi160_get_power_mode(struct bmi160_pmu_status *pmu_status, const struct bmi160_dev *dev)
{ int8_t rslt = 0; uint8_t power_mode = 0; if ((dev == NULL) || (dev->delay_ms == NULL)) { rslt = BMI160_E_NULL_PTR; } else { rslt = bmi160_get_regs(BMI160_PMU_STATUS_ADDR, &power_mode, 1, dev); if (rslt == BMI160_OK) { pmu_status->aux_pmu_status = BMI160_GET_BITS_POS_0(power_mode, BMI160_MAG_POWER_MODE); pmu_status->gyro_pmu_status = BMI160_GET_BITS(power_mode, BMI160_GYRO_POWER_MODE); pmu_status->accel_pmu_status = BMI160_GET_BITS(power_mode, BMI160_ACCEL_POWER_MODE); } } return rslt; }
eclipse-threadx/getting-started
C++
Other
310
/* Stop any pending DMA operation, aborting the DMA if neccessary */
static void initio_stop_bm(struct initio_host *host)
/* Stop any pending DMA operation, aborting the DMA if neccessary */ static void initio_stop_bm(struct initio_host *host)
{ if (inb(host->addr + TUL_XStatus) & XPEND) { outb(TAX_X_ABT | TAX_X_CLR_FIFO, host->addr + TUL_XCmd); while ((inb(host->addr + TUL_Int) & XABT) == 0) cpu_relax(); } outb(TSC_FLUSH_FIFO, host->addr + TUL_SCtrl0); }
robutest/uclinux
C++
GPL-2.0
60
/* PE_DRS_Send_Swap Entry state NOTE: 8..1.5 PE_DRS_DFP_UFP_Send_Swap State 8..2.5 PE_DRS_UFP_DFP_Send_Swap State. */
static void pe_drs_send_swap_entry(void *obj)
/* PE_DRS_Send_Swap Entry state NOTE: 8..1.5 PE_DRS_DFP_UFP_Send_Swap State 8..2.5 PE_DRS_UFP_DFP_Send_Swap State. */ static void pe_drs_send_swap_entry(void *obj)
{ struct policy_engine *pe = (struct policy_engine *)obj; const struct device *dev = pe->dev; pe_send_ctrl_msg(dev, PD_PACKET_SOP, PD_CTRL_DR_SWAP); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Disable Write Protect on pages marked as read-only. */
STATIC VOID DisableReadOnlyPageWriteProtect(VOID)
/* Disable Write Protect on pages marked as read-only. */ STATIC VOID DisableReadOnlyPageWriteProtect(VOID)
{ AsmWriteCr0 (AsmReadCr0 () & ~BIT16); }
tianocore/edk2
C++
Other
4,240
/* This function returns the flags representing the wake configuration for the Hibernation module. The return value is a combination of the following flags: */
uint32_t HibernateWakeGet(void)
/* This function returns the flags representing the wake configuration for the Hibernation module. The return value is a combination of the following flags: */ uint32_t HibernateWakeGet(void)
{ uint32_t ui32Ctrl; ui32Ctrl = HWREG(HIB_CTL); return ((ui32Ctrl & (HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RTC | HIBERNATE_WAKE_LOW_BAT)) | ((HWREG(HIB_IO) << 16) & (HIBERNATE_WAKE_RESET | HIBERNATE_WAKE_GPIO))); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* called very early in the boot process to fetch data out of the multiboot info struct. we need to grab the relevant data before any dynamic memory allocation takes place, lest the struct itself or any data it points to be overwritten before we read it. */
static void clear_memmap(int index)
/* called very early in the boot process to fetch data out of the multiboot info struct. we need to grab the relevant data before any dynamic memory allocation takes place, lest the struct itself or any data it points to be overwritten before we read it. */ static void clear_memmap(int index)
{ while (index < CONFIG_X86_MEMMAP_ENTRIES) { x86_memmap[index].type = X86_MEMMAP_ENTRY_UNUSED; ++index; } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* ixgbe_sfp_timer - worker thread to find a missing module @data: pointer to our adapter struct */
static void ixgbe_sfp_timer(unsigned long data)
/* ixgbe_sfp_timer - worker thread to find a missing module @data: pointer to our adapter struct */ static void ixgbe_sfp_timer(unsigned long data)
{ struct ixgbe_adapter *adapter = (struct ixgbe_adapter *)data; schedule_work(&adapter->sfp_task); }
robutest/uclinux
C++
GPL-2.0
60
/* Enables gyroscope digital high-pass filter. The filter is enabled only if the gyro is in HP mode.. */
int32_t lsm6dso_gy_hp_path_internal_set(lsm6dso_ctx_t *ctx, lsm6dso_hpm_g_t val)
/* Enables gyroscope digital high-pass filter. The filter is enabled only if the gyro is in HP mode.. */ int32_t lsm6dso_gy_hp_path_internal_set(lsm6dso_ctx_t *ctx, lsm6dso_hpm_g_t val)
{ lsm6dso_ctrl7_g_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL7_G, (uint8_t*)&reg, 1); if (ret == 0) { reg.hp_en_g = ((uint8_t)val & 0x80U) >> 7; reg.hpm_g = (uint8_t)val & 0x03U; ret = lsm6dso_write_reg(ctx, LSM6DSO_CTRL7_G, (uint8_t*)&reg, 1); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* wdog is the iomem address of the cfg register */
void sbwdog_set(char __iomem *wdog, unsigned long t)
/* wdog is the iomem address of the cfg register */ void sbwdog_set(char __iomem *wdog, unsigned long t)
{ spin_lock(&sbwd_lock); __raw_writeb(0, wdog - 0x10); __raw_writeq(t & 0x7fffffUL, wdog); spin_unlock(&sbwd_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Created on: Oct 27, 2021 Author: jiangyuanyuan Configure pins as Analog Input Output EVENT_OUT EXTI */
void MY_BSP_Init(void)
/* Created on: Oct 27, 2021 Author: jiangyuanyuan Configure pins as Analog Input Output EVENT_OUT EXTI */ void MY_BSP_Init(void)
{ APP_INT(MY_KEY); APP_INT(MY_LED); APP_INT(MY_TIM); APP_INT(MY_ADC); APP_INT(MY_I2C); APP_INT(MY_OLED); APP_INT(MY_PWM); APP_INT(MY_MOTOR); APP_INT(MY_RGB); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Change Logs: Date Author Notes sundm75 first version */
unsigned char set_reset_mode(CAN_TypeDef *CANx)
/* Change Logs: Date Author Notes sundm75 first version */ unsigned char set_reset_mode(CAN_TypeDef *CANx)
{ unsigned char status; int i; status = CANx->MOD; CANx->IER = 0x00; for (i = 0; i < 100; i++) { if((status & CAN_Mode_RM) == CAN_Mode_RM) return 1; CANx->MOD |= ((unsigned char)CAN_Mode_RM); delay_us(10); status = CANx->MOD; } printf("\r\nSetting SJA1000 into reset mode failed!\r\n"); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Create a new child for a given parent node. */
STATIC VOID MakeChild(IN NODE q, IN UINT8 c, IN NODE r)
/* Create a new child for a given parent node. */ STATIC VOID MakeChild(IN NODE q, IN UINT8 c, IN NODE r)
{ NODE h, t; h = (NODE)HASH(q, c); t = mNext[h]; mNext[h] = r; mNext[r] = t; mPrev[t] = r; mPrev[r] = h; mParent[r] = q; mChildCount[q]++; }
tianocore/edk2
C++
Other
4,240
/* Initialize sysfs for each bond. This sets up and registers the 'bondctl' directory for each individual bond under /sys/class/net. */
void bond_prepare_sysfs_group(struct bonding *bond)
/* Initialize sysfs for each bond. This sets up and registers the 'bondctl' directory for each individual bond under /sys/class/net. */ void bond_prepare_sysfs_group(struct bonding *bond)
{ bond->dev->sysfs_groups[0] = &bonding_group; }
robutest/uclinux
C++
GPL-2.0
60
/* Sets the clipping area. All coordinates given to writeData/writeColor/readData are relative to this clipping area. */
EMSTATUS DMD_setClippingArea(uint16_t xStart, uint16_t yStart, uint16_t width, uint16_t height)
/* Sets the clipping area. All coordinates given to writeData/writeColor/readData are relative to this clipping area. */ EMSTATUS DMD_setClippingArea(uint16_t xStart, uint16_t yStart, uint16_t width, uint16_t height)
{ if (!initialized) { return DMD_ERROR_DRIVER_NOT_INITIALIZED; } if (xStart + width > dimensions.xSize || yStart + height > dimensions.ySize) { return DMD_ERROR_PIXEL_OUT_OF_BOUNDS; } if (width == 0 || height == 0) { return DMD_ERROR_EMPTY_CLIPPING_AREA; } dimensions.xClipStart = xStart; dimensions.yClipStart = yStart; dimensions.clipWidth = width; dimensions.clipHeight = height; return DMD_OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Vector base address configuration. It should no longer be at the start of flash memory but moved forward because the first part of flash is reserved for the bootloader. Note that this is already done by the bootloader before starting this program. Unfortunately, function SystemInit() overwrites this change again. */
static void VectorBase_Config(void)
/* Vector base address configuration. It should no longer be at the start of flash memory but moved forward because the first part of flash is reserved for the bootloader. Note that this is already done by the bootloader before starting this program. Unfortunately, function SystemInit() overwrites this change again. */ static void VectorBase_Config(void)
{ extern const unsigned long __isr_vector[]; SCB->VTOR = (unsigned long)&__isr_vector[0]; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Output: void, will modify proto_tree if not null. */
static void dissect_lsp_hostname_clv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, int id_length _U_, int length)
/* Output: void, will modify proto_tree if not null. */ static void dissect_lsp_hostname_clv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, int id_length _U_, int length)
{ isis_dissect_hostname_clv(tvb, tree, offset, length, hf_isis_lsp_hostname); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Exit the local-reset state. A CAN node will participate in CAN communication after RESET is switched to 0 after 11 CAN bit times. */
void CAN_ExitLocalReset(CM_CAN_TypeDef *CANx)
/* Exit the local-reset state. A CAN node will participate in CAN communication after RESET is switched to 0 after 11 CAN bit times. */ void CAN_ExitLocalReset(CM_CAN_TypeDef *CANx)
{ DDL_ASSERT(IS_CAN_UNIT(CANx)); CLR_REG8_BIT(CANx->CFG_STAT, CAN_CFG_STAT_RESET); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This routine is called when the user clicks the "Clear" button in the "Decode As:Show..." dialog window. This routine resets all the dissector values and then destroys the dialog box and performs other housekeeping functions. */
static void decode_show_clear_cb(GtkWidget *clear_bt _U_, gpointer parent_w)
/* This routine is called when the user clicks the "Clear" button in the "Decode As:Show..." dialog window. This routine resets all the dissector values and then destroys the dialog box and performs other housekeeping functions. */ static void decode_show_clear_cb(GtkWidget *clear_bt _U_, gpointer parent_w)
{ decode_clear_all(); redissect_packets(); redissect_all_packet_windows(); window_destroy(GTK_WIDGET(parent_w)); decode_show_cb(NULL, NULL); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set the slave select pins of the specified SPI port. */
void SPISSModeConfig(unsigned long ulBase, unsigned long ulSSMode)
/* Set the slave select pins of the specified SPI port. */ void SPISSModeConfig(unsigned long ulBase, unsigned long ulSSMode)
{ xASSERT((ulBase == SPI3_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)); xHWREG(ulBase + SPI_CR1) &= ~SPI_CR1_SSM; xHWREG(ulBase + SPI_CR1) |= ulSSMode; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Return amount of bytes we can accept at this offset */
static int raid0_mergeable_bvec(struct request_queue *q, struct bvec_merge_data *bvm, struct bio_vec *biovec)
/* Return amount of bytes we can accept at this offset */ static int raid0_mergeable_bvec(struct request_queue *q, struct bvec_merge_data *bvm, struct bio_vec *biovec)
{ mddev_t *mddev = q->queuedata; sector_t sector = bvm->bi_sector + get_start_sect(bvm->bi_bdev); int max; unsigned int chunk_sectors = mddev->chunk_sectors; unsigned int bio_sectors = bvm->bi_size >> 9; if (is_power_of_2(chunk_sectors)) max = (chunk_sectors - ((sector & (chunk_sectors-1)) + bio_sectors)) << 9; else max = (chunk_sectors - (sector_div(sector, chunk_sectors) + bio_sectors)) << 9; if (max < 0) max = 0; if (max <= biovec->bv_len && bio_sectors == 0) return biovec->bv_len; else return max; }
robutest/uclinux
C++
GPL-2.0
60
/* Set the player index of an opened game controller */
void SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index)
/* Set the player index of an opened game controller */ void SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index)
{ SDL_JoystickSetPlayerIndex(SDL_GameControllerGetJoystick(gamecontroller), player_index); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Checks whether the Tamper Pin Interrupt has occurred or not. */
ITStatus BKP_GetITStatus(void)
/* Checks whether the Tamper Pin Interrupt has occurred or not. */ ITStatus BKP_GetITStatus(void)
{ return ((BKP->CSR & BKP_CSR_TIF) ? SET : RESET); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* get the bit state of ADCx software start conversion */
FlagStatus adc_regular_software_startconv_flag_get(uint32_t adc_periph)
/* get the bit state of ADCx software start conversion */ FlagStatus adc_regular_software_startconv_flag_get(uint32_t adc_periph)
{ FlagStatus reval = RESET; if((uint32_t)RESET != (ADC_CTL1(adc_periph) & ADC_CTL1_SWRCST)){ reval = SET; } return reval; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is normally called after a transfer is done and the host channel is being released */
void dwc2_hc_cleanup(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan)
/* This function is normally called after a transfer is done and the host channel is being released */ void dwc2_hc_cleanup(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan)
{ u32 hcintmsk; chan->xfer_started = 0; writel(0, hsotg->regs + HCINTMSK(chan->hc_num)); hcintmsk = 0xffffffff; hcintmsk &= ~HCINTMSK_RESERVED14_31; writel(hcintmsk, hsotg->regs + HCINT(chan->hc_num)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Find an ICPLB entry to be evicted and return its index. */
static int evict_one_icplb(unsigned int cpu)
/* Find an ICPLB entry to be evicted and return its index. */ static int evict_one_icplb(unsigned int cpu)
{ int i; for (i = first_switched_icplb; i < MAX_CPLBS; i++) if ((icplb_tbl[cpu][i].data & CPLB_VALID) == 0) return i; i = first_switched_icplb + icplb_rr_index[cpu]; if (i >= MAX_CPLBS) { i -= MAX_CPLBS - first_switched_icplb; icplb_rr_index[cpu] -= MAX_CPLBS - first_switched_icplb; } icplb_rr_index[cpu]++; return i; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Disable/Enable LTDC activity as in DSI Video mode the LTDC is all the time in active window pumping data with its DMA, it creates a huge bandwidth consumption that can penalize other IPs, here the save to SD functionality. */
static void LTDC_Operation(uint32_t Enable_LTDC)
/* Disable/Enable LTDC activity as in DSI Video mode the LTDC is all the time in active window pumping data with its DMA, it creates a huge bandwidth consumption that can penalize other IPs, here the save to SD functionality. */ static void LTDC_Operation(uint32_t Enable_LTDC)
{ DSI->WCR &= ~(DSI_WCR_DSIEN); if(Enable_LTDC == 1) { __HAL_LTDC_ENABLE(&hltdc_eval); } else if (Enable_LTDC == 0) { __HAL_LTDC_DISABLE(&hltdc_eval); } DSI->WCR |= DSI_WCR_DSIEN; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* bignum_get_unsigned_bin - Get length of bignum as an unsigned binary buffer */
size_t bignum_get_unsigned_bin_len(struct bignum *n)
/* bignum_get_unsigned_bin - Get length of bignum as an unsigned binary buffer */ size_t bignum_get_unsigned_bin_len(struct bignum *n)
{ return mp_unsigned_bin_size((mp_int *) n); }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* ADC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
/* ADC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hadc->Instance==ADC1) { __HAL_RCC_ADC_CLK_ENABLE(); __HAL_RCC_GPIOC_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG_ADC_CONTROL; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* allocate a keyring and link into the destination keyring */
struct key* keyring_alloc(const char *description, uid_t uid, gid_t gid, const struct cred *cred, unsigned long flags, struct key *dest)
/* allocate a keyring and link into the destination keyring */ struct key* keyring_alloc(const char *description, uid_t uid, gid_t gid, const struct cred *cred, unsigned long flags, struct key *dest)
{ struct key *keyring; int ret; keyring = key_alloc(&key_type_keyring, description, uid, gid, cred, (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_ALL, flags); if (!IS_ERR(keyring)) { ret = key_instantiate_and_link(keyring, NULL, 0, dest, NULL); if (ret < 0) { key_put(keyring); keyring = ERR_PTR(ret); } } return keyring; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* USBH_MTP_IsReady Select the storage Unit to be used. */
uint8_t USBH_MTP_IsReady(USBH_HandleTypeDef *phost)
/* USBH_MTP_IsReady Select the storage Unit to be used. */ uint8_t USBH_MTP_IsReady(USBH_HandleTypeDef *phost)
{ MTP_HandleTypeDef *MTP_Handle = (MTP_HandleTypeDef *)phost->pActiveClass->pData; return ((uint8_t)MTP_Handle->is_ready); }
ua1arn/hftrx
C++
null
69
/* Return: 1 (true) for active line and 0 (false) for no link */
static int is_link_up(const void *regs_base)
/* Return: 1 (true) for active line and 0 (false) for no link */ static int is_link_up(const void *regs_base)
{ u32 mask = PCIE_GLB_STS_RDLH_LINK_UP | PCIE_GLB_STS_PHY_LINK_UP; u32 reg; reg = readl(regs_base + PCIE_GLOBAL_STATUS); if ((reg & mask) == mask) return 1; return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* scsi_unlock_floptical - unlock device via a special MODE SENSE command @sdev: scsi device to send command to */
static void scsi_unlock_floptical(struct scsi_device *sdev, unsigned char *result)
/* scsi_unlock_floptical - unlock device via a special MODE SENSE command @sdev: scsi device to send command to */ static void scsi_unlock_floptical(struct scsi_device *sdev, unsigned char *result)
{ unsigned char scsi_cmd[MAX_COMMAND_SIZE]; printk(KERN_NOTICE "scsi: unlocking floptical drive\n"); scsi_cmd[0] = MODE_SENSE; scsi_cmd[1] = 0; scsi_cmd[2] = 0x2e; scsi_cmd[3] = 0; scsi_cmd[4] = 0x2a; scsi_cmd[5] = 0; scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, result, 0x2a, NULL, SCSI_TIMEOUT, 3, NULL); }
robutest/uclinux
C++
GPL-2.0
60
/* Delete a Mutex that was created by osMutexCreate. */
osStatus svcMutexDelete(osMutexId mutex_id)
/* Delete a Mutex that was created by osMutexCreate. */ osStatus svcMutexDelete(osMutexId mutex_id)
{ return osErrorParameter; } if (((P_MUCB)mut)->cb_type != MUCB) { return osErrorParameter; } rt_mut_delete(mut); return osOK; }
labapart/polymcu
C++
null
201
/* Free all kernel contexts that are not currently in use. Returns 0 if all freed, else number of inuse context. */
static int gru_free_kernel_contexts(void)
/* Free all kernel contexts that are not currently in use. Returns 0 if all freed, else number of inuse context. */ static int gru_free_kernel_contexts(void)
{ struct gru_blade_state *bs; struct gru_thread_state *kgts; int bid, ret = 0; for (bid = 0; bid < GRU_MAX_BLADES; bid++) { bs = gru_base[bid]; if (!bs) continue; if (down_write_trylock(&bs->bs_kgts_sema)) { kgts = bs->bs_kgts; if (kgts && kgts->ts_gru) gru_unload_context(kgts, 0); bs->bs_kgts = NULL; up_write(&bs->bs_kgts_sema); kfree(kgts); } else { ret++; } } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the specified DMA peripheral Clock. */
void RCC_DMA_ClockCmd(DMA_TypeDef *peripheral, FunctionalState state)
/* Enables or disables the specified DMA peripheral Clock. */ void RCC_DMA_ClockCmd(DMA_TypeDef *peripheral, FunctionalState state)
{ if(DMA1 == peripheral) { (state) ? (RCC->AHBENR |= RCC_AHBENR_DMA1) : (RCC->AHBENR &= ~RCC_AHBENR_DMA1); } if(DMA2 == peripheral) { (state) ? (RCC->AHBENR |= RCC_AHBENR_DMA2) : (RCC->AHBENR &= ~RCC_AHBENR_DMA2); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the set of fault triggers currently configured for a given PWM generator. */
unsigned long PWMGenFaultTriggerGet(unsigned long ulBase, unsigned long ulGen, unsigned long ulGroup)
/* Returns the set of fault triggers currently configured for a given PWM generator. */ unsigned long PWMGenFaultTriggerGet(unsigned long ulBase, unsigned long ulGen, unsigned long ulGroup)
{ ASSERT(HWREG(SYSCTL_DC5) & SYSCTL_DC5_PWMEFLT); ASSERT(ulBase == PWM_BASE); ASSERT(PWMGenValid(ulGen)); ASSERT((ulGroup == PWM_FAULT_GROUP_0) || (ulGroup == PWM_FAULT_GROUP_1)); if(ulGroup == PWM_FAULT_GROUP_0) { return(HWREG(PWM_GEN_BADDR(ulBase, ulGen) + PWM_O_X_FLTSRC0)); } else { return(HWREG(PWM_GEN_BADDR(ulBase, ulGen) + PWM_O_X_FLTSRC1)); } }
watterott/WebRadio
C++
null
71
/* Note that the destination address is modified during the DMA transfer according to edma3_set_dest_index(). */
void edma3_set_dest(u32 base, int slot, u32 dst, enum edma3_address_mode mode, enum edma3_fifo_width width)
/* Note that the destination address is modified during the DMA transfer according to edma3_set_dest_index(). */ void edma3_set_dest(u32 base, int slot, u32 dst, enum edma3_address_mode mode, enum edma3_fifo_width width)
{ u32 opt; struct edma3_slot_layout *rg; rg = (struct edma3_slot_layout *)(base + EDMA3_SL_BASE(slot)); opt = __raw_readl(&rg->opt); if (mode == FIFO) opt = (opt & EDMA3_SLOPT_FIFO_WIDTH_MASK) | (EDMA3_SLOPT_DST_ADDR_CONST_MODE | EDMA3_SLOPT_FIFO_WIDTH_SET(width)); else opt &= ~EDMA3_SLOPT_DST_ADDR_CONST_MODE; __raw_writel(opt, &rg->opt); __raw_writel(dst, &rg->dst); }
4ms/stm32mp1-baremetal
C++
Other
137
/* param base LPUART peripheral base address. param handle LPUART handle pointer. */
void LPUART_TransferAbortSend(LPUART_Type *base, lpuart_handle_t *handle)
/* param base LPUART peripheral base address. param handle LPUART handle pointer. */ void LPUART_TransferAbortSend(LPUART_Type *base, lpuart_handle_t *handle)
{ assert(NULL != handle); LPUART_DisableInterrupts( base, (uint32_t)kLPUART_TxDataRegEmptyInterruptEnable | (uint32_t)kLPUART_TransmissionCompleteInterruptEnable); handle->txDataSize = 0; handle->txState = (uint8_t)kLPUART_TxIdle; }
eclipse-threadx/getting-started
C++
Other
310
/* megasas_clear_interrupt_skinny - Check & clear interrupt @regs: MFI register set */
static int megasas_clear_intr_skinny(struct megasas_register_set __iomem *regs)
/* megasas_clear_interrupt_skinny - Check & clear interrupt @regs: MFI register set */ static int megasas_clear_intr_skinny(struct megasas_register_set __iomem *regs)
{ u32 status; status = readl(&regs->outbound_intr_status); if (!(status & MFI_SKINNY_ENABLE_INTERRUPT_MASK)) { return 1; } writel(status, &regs->outbound_intr_status); readl(&regs->outbound_intr_status); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Send command to set or reset WEL bit. The WREN instruction is for setting Write Enable Latch (WEL) bit. The WRDI instruction is to reset Write Enable Latch (WEL) bit. */
static enum status_code _mx25v_send_cmd_write_latch(uint8_t cmd)
/* Send command to set or reset WEL bit. The WREN instruction is for setting Write Enable Latch (WEL) bit. The WRDI instruction is to reset Write Enable Latch (WEL) bit. */ static enum status_code _mx25v_send_cmd_write_latch(uint8_t cmd)
{ enum status_code status; uint8_t tx_buf[1] = {cmd}; _mx25v_chip_select(); status = spi_write_buffer_wait(&_mx25v_spi, tx_buf, 1); if (status != STATUS_OK) { return STATUS_ERR_IO; } _mx25v_chip_deselect(); return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* This function converts a date in a given time zone to a UNIX timestamp. */
uint32_t calendar_date_to_timestamp_tz(struct calendar_date *date, int8_t hour, uint8_t min)
/* This function converts a date in a given time zone to a UNIX timestamp. */ uint32_t calendar_date_to_timestamp_tz(struct calendar_date *date, int8_t hour, uint8_t min)
{ uint32_t timestamp = calendar_date_to_timestamp(date); if (timestamp == 0) { return 0; } else { if (hour >= 0) { return (timestamp - (SECS_PER_HOUR * hour + SECS_PER_MINUTE * min)); } else { return (timestamp - (SECS_PER_HOUR * hour - SECS_PER_MINUTE * min)); } } }
memfault/zero-to-main
C++
null
200
/* Return the size of the pages allocated when backing a VMA. In the majority cases this will be same size as used by the page table entries. */
unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
/* Return the size of the pages allocated when backing a VMA. In the majority cases this will be same size as used by the page table entries. */ unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
{ struct hstate *hstate; if (!is_vm_hugetlb_page(vma)) return PAGE_SIZE; hstate = hstate_vma(vma); return 1UL << (hstate->order + PAGE_SHIFT); }
robutest/uclinux
C++
GPL-2.0
60
/* The module Entry Point of the Esrt DXE driver that manages cached ESRT repository & publishes ESRT table */
EFI_STATUS EFIAPI EsrtDxeEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The module Entry Point of the Esrt DXE driver that manages cached ESRT repository & publishes ESRT table */ EFI_STATUS EFIAPI EsrtDxeEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; EfiInitializeLock (&mPrivate.FmpLock, TPL_CALLBACK); EfiInitializeLock (&mPrivate.NonFmpLock, TPL_CALLBACK); Status = gBS->InstallMultipleProtocolInterfaces ( &mPrivate.Handle, &gEsrtManagementProtocolGuid, &mEsrtManagementProtocolTemplate, NULL ); ASSERT_EFI_ERROR (Status); Status = gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_CALLBACK, EsrtReadyToBootEventNotify, NULL, &gEfiEventReadyToBootGuid, &mPrivate.Event ); ASSERT_EFI_ERROR (Status); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Wakes up a thread waiting on a thread reference object. */
void osalThreadResumeS(thread_reference_t *trp, msg_t msg)
/* Wakes up a thread waiting on a thread reference object. */ void osalThreadResumeS(thread_reference_t *trp, msg_t msg)
{ osalDbgCheck(trp != NULL); osalThreadResumeI(trp, msg); }
nanoframework/nf-interpreter
C++
MIT License
293
/* DAC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_DAC_MspDeInit(DAC_HandleTypeDef *hdac)
/* DAC MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_DAC_MspDeInit(DAC_HandleTypeDef *hdac)
{ if(hdac->Instance==DAC1) { __HAL_RCC_DAC1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_4|GPIO_PIN_5); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the newly built instance of CRCascade or NULL if an error arose during constrution. */
CRCascade* cr_cascade_new(CRStyleSheet *a_author_sheet, CRStyleSheet *a_user_sheet, CRStyleSheet *a_ua_sheet)
/* Returns the newly built instance of CRCascade or NULL if an error arose during constrution. */ CRCascade* cr_cascade_new(CRStyleSheet *a_author_sheet, CRStyleSheet *a_user_sheet, CRStyleSheet *a_ua_sheet)
{ CRCascade *result = NULL; result = g_try_malloc (sizeof (CRCascade)); if (!result) { cr_utils_trace_info ("Out of memory"); return NULL; } memset (result, 0, sizeof (CRCascade)); PRIVATE (result) = g_try_malloc (sizeof (CRCascadePriv)); if (!PRIVATE (result)) { cr_utils_trace_info ("Out of memory"); return NULL; } memset (PRIVATE (result), 0, sizeof (CRCascadePriv)); if (a_author_sheet) { cr_cascade_set_sheet (result, a_author_sheet, ORIGIN_AUTHOR); } if (a_user_sheet) { cr_cascade_set_sheet (result, a_user_sheet, ORIGIN_USER); } if (a_ua_sheet) { cr_cascade_set_sheet (result, a_ua_sheet, ORIGIN_UA); } return result; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This is the tasklet that updates LED state on all keyboards attached to the box. The reason we use tasklet is that we need to handle the scenario when keyboard handler is not registered yet but we already getting updates form VT to update led state. */
static void kbd_bh(unsigned long dummy)
/* This is the tasklet that updates LED state on all keyboards attached to the box. The reason we use tasklet is that we need to handle the scenario when keyboard handler is not registered yet but we already getting updates form VT to update led state. */ static void kbd_bh(unsigned long dummy)
{ unsigned char leds = getleds(); if (leds != ledstate) { input_handler_for_each_handle(&kbd_handler, &leds, kbd_update_leds_helper); ledstate = leds; } }
robutest/uclinux
C++
GPL-2.0
60
/* Enter a critical section. Critical sections are needed in an interrupt driven software program to obtain mutual exclusive access shared resources such as global data and certain peripherals. Note that each call to this function should always be followed by a call to */
void TbxCriticalSectionEnter(void)
/* Enter a critical section. Critical sections are needed in an interrupt driven software program to obtain mutual exclusive access shared resources such as global data and certain peripherals. Note that each call to this function should always be followed by a call to */ void TbxCriticalSectionEnter(void)
{ tTbxPortCpuSR cpuSR; cpuSR = TbxPortInterruptsDisable(); if (tbxCritSectNestingCounter == 0U) { tbxCritSectCpuSR = cpuSR; } tbxCritSectNestingCounter++; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Configures the TIMx Output Compare 3 Fast feature. */
void TIM_OC3FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
/* Configures the TIMx Output Compare 3 Fast feature. */ void TIM_OC3FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
{ uint16_t tmpccmr2 = 0; assert_param(IS_TIM_LIST3_PERIPH(TIMx)); assert_param(IS_TIM_OCFAST_STATE(TIM_OCFast)); tmpccmr2 = TIMx->CCMR2; tmpccmr2 &= (uint16_t)~TIM_CCMR2_OC3FE; tmpccmr2 |= TIM_OCFast; TIMx->CCMR2 = tmpccmr2; }
MaJerle/stm32f429
C++
null
2,036
/* draw a point with a given 32bit colour */
arm_fsm_rt_t arm_2dp_rgb32_draw_point(arm_2d_op_drw_pt_t *ptOP, const arm_2d_tile_t *ptTarget, const arm_2d_location_t tLocation, uint32_t wColour)
/* draw a point with a given 32bit colour */ arm_fsm_rt_t arm_2dp_rgb32_draw_point(arm_2d_op_drw_pt_t *ptOP, const arm_2d_tile_t *ptTarget, const arm_2d_location_t tLocation, uint32_t wColour)
{ assert(NULL != ptTarget); ARM_2D_IMPL(arm_2d_op_drw_pt_t, ptOP); if (!__arm_2d_op_acquire((arm_2d_op_core_t *)ptThis)) { return arm_fsm_rt_on_going; } arm_2d_region_t tPointRegion = { .tLocation = tLocation, .tSize = {1,1}, }; OP_CORE.ptOp = &ARM_2D_OP_DRAW_POINT_RGB32; OP_CORE.Preference.u2ACCMethods = ARM_2D_PREF_ACC_SW_ONLY; this.Target.ptTile = ptTarget; this.Target.ptRegion = &tPointRegion; this.wColour = wColour; return __arm_2d_op_invoke((arm_2d_op_core_t *)ptThis); }
pikasTech/PikaPython
C++
MIT License
1,403
/* This function is used to register pmu rtc interrupt. */
void tls_rtc_isr_register(tls_rtc_irq_callback callback, void *arg)
/* This function is used to register pmu rtc interrupt. */ void tls_rtc_isr_register(tls_rtc_irq_callback callback, void *arg)
{ rtc_context.callback = callback; rtc_context.arg = arg; tls_irq_enable(PMU_IRQn); return; }
Nicholas3388/LuaNode
C++
Other
1,055
/* param base eDMA peripheral base address. param channel eDMA channel number. param type A channel link type, which can be one of the following: arg kEDMA_LinkNone arg kEDMA_MinorLink arg kEDMA_MajorLink param linkedChannel The linked channel number. note Users should ensure that DONE flag is cleared before calling this interface, or the configuration is invalid. */
void EDMA_SetChannelLink(DMA_Type *base, uint32_t channel, edma_channel_link_type_t type, uint32_t linkedChannel)
/* param base eDMA peripheral base address. param channel eDMA channel number. param type A channel link type, which can be one of the following: arg kEDMA_LinkNone arg kEDMA_MinorLink arg kEDMA_MajorLink param linkedChannel The linked channel number. note Users should ensure that DONE flag is cleared before calling this interface, or the configuration is invalid. */ void EDMA_SetChannelLink(DMA_Type *base, uint32_t channel, edma_channel_link_type_t type, uint32_t linkedChannel)
{ assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL); assert(linkedChannel < FSL_FEATURE_EDMA_MODULE_CHANNEL); EDMA_TcdSetChannelLink((edma_tcd_t *)&base->TCD[channel], type, linkedChannel); }
nanoframework/nf-interpreter
C++
MIT License
293
/* Check for packet available from the Ethernet controller. */
tBoolean EthernetPacketAvail(unsigned long ulBase)
/* Check for packet available from the Ethernet controller. */ tBoolean EthernetPacketAvail(unsigned long ulBase)
{ ASSERT(ulBase == ETH_BASE); return((HWREG(ulBase + MAC_O_NP) & MAC_NP_NPR_M) ? true : false); }
watterott/WebRadio
C++
null
71
/* retrieves the default port VLAN tag (the lower 3 bytes are the PVID) */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPortVlanTagGet(IxEthDBPortId portID, IxEthDBVlanTag *vlanTag)
/* retrieves the default port VLAN tag (the lower 3 bytes are the PVID) */ IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPortVlanTagGet(IxEthDBPortId portID, IxEthDBVlanTag *vlanTag)
{ IX_ETH_DB_CHECK_PORT(portID); IX_ETH_DB_CHECK_SINGLE_NPE(portID); IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS); IX_ETH_DB_CHECK_REFERENCE(vlanTag); *vlanTag = ixEthDBPortInfo[portID].vlanTag; return IX_ETH_DB_SUCCESS; }
EmcraftSystems/u-boot
C++
Other
181
/* Set the volume of a possibly already playing note */
static void set_volume(struct snd_emu8000 *hw, struct snd_emux_voice *vp)
/* Set the volume of a possibly already playing note */ static void set_volume(struct snd_emu8000 *hw, struct snd_emux_voice *vp)
{ int ifatn; ifatn = (unsigned char)vp->acutoff; ifatn = (ifatn << 8); ifatn |= (unsigned char)vp->avol; EMU8000_IFATN_WRITE(hw, vp->ch, ifatn); }
robutest/uclinux
C++
GPL-2.0
60
/* The following rounding modes are available (as specified by */
void FPURoundingModeSet(uint32_t ui32Mode)
/* The following rounding modes are available (as specified by */ void FPURoundingModeSet(uint32_t ui32Mode)
{ HWREG(NVIC_FPDSC) = (HWREG(NVIC_FPDSC) & ~(NVIC_FPDSC_RMODE_M)) | ui32Mode; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* If 16-bit operations are not supported, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI BitFieldAndThenOr16(IN UINT16 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData, IN UINT16 OrData)
/* If 16-bit operations are not supported, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT16 EFIAPI BitFieldAndThenOr16(IN UINT16 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData, IN UINT16 OrData)
{ ASSERT (EndBit < 16); ASSERT (StartBit <= EndBit); return BitFieldOr16 ( BitFieldAnd16 (Operand, StartBit, EndBit, AndData), StartBit, EndBit, OrData ); }
tianocore/edk2
C++
Other
4,240
/* param base SAI base pointer param order Data order MSB or LSB */
void SAI_TxSetFrameSyncPolarity(I2S_Type *base, sai_clock_polarity_t polarity)
/* param base SAI base pointer param order Data order MSB or LSB */ void SAI_TxSetFrameSyncPolarity(I2S_Type *base, sai_clock_polarity_t polarity)
{ uint32_t val = (base->TCR4) & (~I2S_TCR4_FSP_MASK); val |= I2S_TCR4_FSP(polarity); base->TCR4 = val; }
eclipse-threadx/getting-started
C++
Other
310
/* Serializes a 0-length packet into the supplied buffer, ready for writing to a socket */
int MQTTSerialize_zero(unsigned char *buf, int buflen, unsigned char packettype)
/* Serializes a 0-length packet into the supplied buffer, ready for writing to a socket */ int MQTTSerialize_zero(unsigned char *buf, int buflen, unsigned char packettype)
{ MQTTHeader header = {0}; int rc = -1; unsigned char* ptr = buf; FUNC_ENTRY; if (buflen < 2) { rc = MQTTPACKET_BUFFER_TOO_SHORT; goto exit; } header.byte = 0; header.bits.type = packettype; writeChar(&ptr, header.byte); ptr += MQTTPacket_encode(ptr, 0); rc = ptr - buf; exit: FUNC_EXIT_RC(rc); return rc; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Sensor synchronization time frame with the step of 500 ms and full range of 5s. Unsigned 8-bit.. */
int32_t lsm6dsl_sh_sync_sens_frame_set(stmdev_ctx_t *ctx, uint8_t val)
/* Sensor synchronization time frame with the step of 500 ms and full range of 5s. Unsigned 8-bit.. */ int32_t lsm6dsl_sh_sync_sens_frame_set(stmdev_ctx_t *ctx, uint8_t val)
{ lsm6dsl_sensor_sync_time_frame_t sensor_sync_time_frame; int32_t ret; ret = lsm6dsl_read_reg(ctx, LSM6DSL_SENSOR_SYNC_TIME_FRAME, (uint8_t*)&sensor_sync_time_frame, 1); if(ret == 0){ sensor_sync_time_frame.tph = val; ret = lsm6dsl_write_reg(ctx, LSM6DSL_SENSOR_SYNC_TIME_FRAME, (uint8_t*)&sensor_sync_time_frame, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Registers an interrupt handler for a SPI interrupt. */
void SPIIntRegister(unsigned long ulBase, void(*pfnHandler)(void))
/* Registers an interrupt handler for a SPI interrupt. */ void SPIIntRegister(unsigned long ulBase, void(*pfnHandler)(void))
{ unsigned long ulInt; ulInt = SPIIntNumberGet(ulBase); IntRegister(ulInt, pfnHandler); IntEnable(ulInt); }
micropython/micropython
C++
Other
18,334
/* ADC START and Read Result. This function starts the ADC and wait for the ADC conversation to be complete and read the ADC result register and return the same to calling function. */
uint16_t adc_start_read_result(void)
/* ADC START and Read Result. This function starts the ADC and wait for the ADC conversation to be complete and read the ADC result register and return the same to calling function. */ uint16_t adc_start_read_result(void)
{ uint16_t adc_result = 0; adc_start_conversion(&adc_instance); while((adc_get_status(&adc_instance) & ADC_STATUS_RESULT_READY) != 1); adc_read(&adc_instance, &adc_result); return adc_result; }
memfault/zero-to-main
C++
null
200
/* Please add a note about your changes to smbfs in the ChangeLog file. */
static int smb_fsync(struct file *file, struct dentry *dentry, int datasync)
/* Please add a note about your changes to smbfs in the ChangeLog file. */ static int smb_fsync(struct file *file, struct dentry *dentry, int datasync)
{ struct smb_sb_info *server = server_from_dentry(dentry); int result; VERBOSE("sync file %s/%s\n", DENTRY_PATH(dentry)); result = smb_proc_flush(server, SMB_I(dentry->d_inode)->fileid); return result; }
robutest/uclinux
C++
GPL-2.0
60
/* If writing, bounce the data to the buffer before the request is sent to the host driver */
void mmc_queue_bounce_pre(struct mmc_queue *mq)
/* If writing, bounce the data to the buffer before the request is sent to the host driver */ void mmc_queue_bounce_pre(struct mmc_queue *mq)
{ unsigned long flags; if (!mq->bounce_buf) return; if (rq_data_dir(mq->req) != WRITE) return; local_irq_save(flags); sg_copy_to_buffer(mq->bounce_sg, mq->bounce_sg_len, mq->bounce_buf, mq->sg[0].length); local_irq_restore(flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Initialise the rs485 port with the given baudrate. The settings are always 8 data bits, no parity, 1 stop bit, no start bits. */
int rs485_init(void)
/* Initialise the rs485 port with the given baudrate. The settings are always 8 data bits, no parity, 1 stop bit, no start bits. */ int rs485_init(void)
{ rs485_cfgio (); rs485_setbrg (); return (0); }
EmcraftSystems/u-boot
C++
Other
181
/* This routine wraps the actual SLI3 or SLI4 hba restart routine from the API jump table function pointer from the lpfc_hba struct. */
int lpfc_sli_brdrestart(struct lpfc_hba *phba)
/* This routine wraps the actual SLI3 or SLI4 hba restart routine from the API jump table function pointer from the lpfc_hba struct. */ int lpfc_sli_brdrestart(struct lpfc_hba *phba)
{ return phba->lpfc_sli_brdrestart(phba); }
robutest/uclinux
C++
GPL-2.0
60
/* Writes data to the specified GPIO data port. */
void GPIO_PinAFConfig(GPIO_TypeDef *GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF)
/* Writes data to the specified GPIO data port. */ void GPIO_PinAFConfig(GPIO_TypeDef *GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF)
{ uint32_t temp = 0x00; uint32_t temp_2 = 0x00; assert_param(IS_GPIO_LIST_PERIPH(GPIOx)); assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource)); assert_param(IS_GPIO_AF(GPIO_AF)); temp = ((uint32_t)(GPIO_AF) << ((uint32_t)((uint32_t)GPIO_PinSource & (uint32_t)0x07) * 4)); GPIOx->AFR[GPIO_PinSource >> 0x03] &= ~((uint32_t)0xF << ((uint32_t)((uint32_t)GPIO_PinSource & (uint32_t)0x07) * 4)); temp_2 = GPIOx->AFR[GPIO_PinSource >> 0x03] | temp; GPIOx->AFR[GPIO_PinSource >> 0x03] = temp_2; }
ajhc/demo-cortex-m3
C++
null
38
/* Wait for a device to report an event */
static int dev_wait(struct dm_ioctl *param, size_t param_size)
/* Wait for a device to report an event */ static int dev_wait(struct dm_ioctl *param, size_t param_size)
{ int r; struct mapped_device *md; struct dm_table *table; md = find_device(param); if (!md) return -ENXIO; if (dm_wait_event(md, param->event_nr)) { r = -ERESTARTSYS; goto out; } r = __dev_status(md, param); if (r) goto out; table = dm_get_live_or_inactive_table(md, param); if (table) { retrieve_status(table, param, param_size); dm_table_put(table); } out: dm_put(md); return r; }
robutest/uclinux
C++
GPL-2.0
60
/* This routine returns the chars number in the transmission buffer o returns 0 */
static int cpc_tty_chars_in_buffer(struct tty_struct *tty)
/* This routine returns the chars number in the transmission buffer o returns 0 */ static int cpc_tty_chars_in_buffer(struct tty_struct *tty)
{ st_cpc_tty_area *cpc_tty; if (!tty || !tty->driver_data ) { CPC_TTY_DBG("hdlcX-tty: no TTY to chars in buffer\n"); return -ENODEV; } cpc_tty = (st_cpc_tty_area *) tty->driver_data; if ((cpc_tty->tty != tty) || (cpc_tty->state != CPC_TTY_ST_OPEN)) { CPC_TTY_DBG("%s: TTY is not opened\n",cpc_tty->name); return -ENODEV; } return(0); }
robutest/uclinux
C++
GPL-2.0
60
/* Starting with HUB rev 2.0, the UV RTC register is replicated across all cachelines of it's own page. This allows faster simultaneous reads from a given socket. */
static cycle_t uv_read_rtc(struct clocksource *cs)
/* Starting with HUB rev 2.0, the UV RTC register is replicated across all cachelines of it's own page. This allows faster simultaneous reads from a given socket. */ static cycle_t uv_read_rtc(struct clocksource *cs)
{ unsigned long offset; if (uv_get_min_hub_revision_id() == 1) offset = 0; else offset = (uv_blade_processor_id() * L1_CACHE_BYTES) % PAGE_SIZE; return (cycle_t)uv_read_local_mmr(UVH_RTC | offset); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* SPI MSP Initialization This function configures the hardware resources used in this example. */
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
/* SPI MSP Initialization This function configures the hardware resources used in this example. */ void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hspi->Instance==SPI2) { __HAL_RCC_SPI2_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; GPIO_InitStruct.Alternate = GPIO_AF5_SPI2; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param isMute true is mute, false is unmute. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_SetMute(void *handle, uint32_t playChannel, bool isMute)
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param isMute true is mute, false is unmute. return kStatus_Success is success, else configure failed. */ status_t HAL_CODEC_SetMute(void *handle, uint32_t playChannel, bool isMute)
{ assert(handle != NULL); status_t retVal = kStatus_Success; if (playChannel & (kCODEC_PlayChannelHeadphoneLeft | kCODEC_PlayChannelHeadphoneRight)) { retVal = SGTL_SetMute((sgtl_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), kSGTL_ModuleHP, isMute); } if ((playChannel & (kCODEC_PlayChannelLineOutLeft | kCODEC_PlayChannelLineOutRight)) && (retVal == kStatus_Success)) { retVal = SGTL_SetMute((sgtl_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), kSGTL_ModuleLineOut, isMute); } return retVal; }
eclipse-threadx/getting-started
C++
Other
310
/* Controls peripheral clock gating in sleep and deep-sleep mode. */
void SysCtlPeripheralClockGating(bool bEnable)
/* Controls peripheral clock gating in sleep and deep-sleep mode. */ void SysCtlPeripheralClockGating(bool bEnable)
{ if(bEnable) { HWREG(SYSCTL_RCC) |= SYSCTL_RCC_ACG; } else { HWREG(SYSCTL_RCC) &= ~(SYSCTL_RCC_ACG); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* meson_spifc_fill_buffer() - copy data from memory to device buffer @spifc: the Meson SPI device @buf: the source buffer @len: number of bytes to copy */
static void meson_spifc_fill_buffer(struct meson_spifc_priv *spifc, const u8 *buf, int len)
/* meson_spifc_fill_buffer() - copy data from memory to device buffer @spifc: the Meson SPI device @buf: the source buffer @len: number of bytes to copy */ static void meson_spifc_fill_buffer(struct meson_spifc_priv *spifc, const u8 *buf, int len)
{ u32 data = 0; int i = 0; while (i < len) { if (len - i >= 4) data = *(u32 *)buf; else memcpy(&data, buf, len - i); regmap_write(spifc->regmap, REG_C0 + i, data); buf += 4; i += 4; } }
4ms/stm32mp1-baremetal
C++
Other
137
/* This is the fast-track version for just changing the three TLS entries. Remember that this happens on every context switch, so it's worth optimizing. But wouldn't it be neater to have a single hypercall to cover both cases? */
void guest_load_tls(struct lg_cpu *cpu, unsigned long gtls)
/* This is the fast-track version for just changing the three TLS entries. Remember that this happens on every context switch, so it's worth optimizing. But wouldn't it be neater to have a single hypercall to cover both cases? */ void guest_load_tls(struct lg_cpu *cpu, unsigned long gtls)
{ struct desc_struct *tls = &cpu->arch.gdt[GDT_ENTRY_TLS_MIN]; __lgread(cpu, tls, gtls, sizeof(*tls)*GDT_ENTRY_TLS_ENTRIES); fixup_gdt_table(cpu, GDT_ENTRY_TLS_MIN, GDT_ENTRY_TLS_MAX+1); cpu->changed |= CHANGED_GDT_TLS; }
robutest/uclinux
C++
GPL-2.0
60