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
/* Performs a delay of the specified amount of milliseconds. */
void UtilTimeDelayMs(uint16_t delay)
/* Performs a delay of the specified amount of milliseconds. */ void UtilTimeDelayMs(uint16_t delay)
{ (void)usleep(1000u * delay); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Scans the superblock list and finds the superblock of the file system mounted on the device given. NULL is returned if no match is found. */
struct super_block* get_super(struct block_device *bdev)
/* Scans the superblock list and finds the superblock of the file system mounted on the device given. NULL is returned if no match is found. */ struct super_block* get_super(struct block_device *bdev)
{ struct super_block *sb; if (!bdev) return NULL; spin_lock(&sb_lock); rescan: list_for_each_entry(sb, &super_blocks, s_list) { if (sb->s_bdev == bdev) { sb->s_count++; spin_unlock(&sb_lock); down_read(&sb->s_umount); if (sb->s_root) return sb; up_read(&sb->s_umount); spin_lock(&sb_lock); if (__put_super_and_need_restart(sb)) goto rescan; } } spin_unlock(&sb_lock); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* This function handles USB OTG FS Wakeup IRQ Handler. */
void OTG_FS_WKUP_IRQHandler(void)
/* This function handles USB OTG FS Wakeup IRQ Handler. */ void OTG_FS_WKUP_IRQHandler(void)
{ __HAL_USB_OTG_FS_WAKEUP_EXTI_CLEAR_FLAG(); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Write authorization request event handler. The write authorization request event handler is only called when writing to the control point. */
static void on_rw_authorize_req(ble_lncp_t *p_lncp, ble_evt_t const *p_ble_evt)
/* Write authorization request event handler. The write authorization request event handler is only called when writing to the control point. */ static void on_rw_authorize_req(ble_lncp_t *p_lncp, ble_evt_t const *p_ble_evt)
{ const ble_gatts_evt_rw_authorize_request_t * p_auth_req = &p_ble_evt->evt.gatts_evt.params.authorize_request; if ( (p_auth_req->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) && (p_auth_req->request.write.handle == p_lncp->ctrlpt_handles.value_handle) && (p_auth_req->request.write.op != BLE_GATTS_OP_PREP_WRITE_REQ) && (p_auth_req->request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) && (p_auth_req->request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL) ) { on_ctrlpt_write(p_lncp, &p_auth_req->request.write); } }
labapart/polymcu
C++
null
201
/* this function is will cause the regular file referenced by fd to be truncated to a size of precisely length bytes. */
int dfs_file_ftruncate(struct dfs_fd *fd, off_t length)
/* this function is will cause the regular file referenced by fd to be truncated to a size of precisely length bytes. */ int dfs_file_ftruncate(struct dfs_fd *fd, off_t length)
{ int result; if (fd == NULL || fd->type != FT_REGULAR || length < 0) return -EINVAL; if (fd->fops->ioctl == NULL) return -ENOSYS; result = fd->fops->ioctl(fd, RT_FIOFTRUNCATE, (void*)&length); if (result == 0) fd->size = length; return result; }
pikasTech/PikaPython
C++
MIT License
1,403
/* The offset starts at 0. You can obtain the region information from cros_ec_flash_offset() to find out where to read for a particular region. */
static int cros_ec_flash_read_block(struct udevice *dev, uint8_t *data, uint32_t offset, uint32_t size)
/* The offset starts at 0. You can obtain the region information from cros_ec_flash_offset() to find out where to read for a particular region. */ static int cros_ec_flash_read_block(struct udevice *dev, uint8_t *data, uint32_t offset, uint32_t size)
{ struct ec_params_flash_read p; p.offset = offset; p.size = size; return ec_command(dev, EC_CMD_FLASH_READ, 0, &p, sizeof(p), data, size) >= 0 ? 0 : -1; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Thru this function the IRQ controller can raise an immediate interrupt which will interrupt the SW itself (this function should only be called from the HW model code, from SW threads) */
void nsif_cpu0_irq_raised_from_sw(void)
/* Thru this function the IRQ controller can raise an immediate interrupt which will interrupt the SW itself (this function should only be called from the HW model code, from SW threads) */ void nsif_cpu0_irq_raised_from_sw(void)
{ if (hw_irq_ctrl_get_highest_prio_irq() != -1) { if (!posix_is_cpu_running()) { posix_print_error_and_exit("programming error: %s " "called from a HW model thread\n", __func__); } posix_irq_handler(); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* this is the slow path from userspace. they can seek and write to the fb. it's inefficient to do anything less than a full screen draw */
static ssize_t broadsheetfb_write(struct fb_info *info, const char __user *buf, size_t count, loff_t *ppos)
/* this is the slow path from userspace. they can seek and write to the fb. it's inefficient to do anything less than a full screen draw */ static ssize_t broadsheetfb_write(struct fb_info *info, const char __user *buf, size_t count, loff_t *ppos)
{ struct broadsheetfb_par *par = info->par; unsigned long p = *ppos; void *dst; int err = 0; unsigned long total_size; if (info->state != FBINFO_STATE_RUNNING) return -EPERM; total_size = info->fix.smem_len; if (p > total_size) return -EFBIG; if (count > total_size) { err = -EFBIG; count = total_size; } if (count + p > total_size) { if (!err) err = -ENOSPC; count = total_size - p; } dst = (void *)(info->screen_base + p); if (copy_from_user(dst, buf, count)) err = -EFAULT; if (!err) *ppos += count; broadsheetfb_dpy_update(par); return (err) ? err : count; }
robutest/uclinux
C++
GPL-2.0
60
/* The function is used to enable the HFIRC auto trim, and select the Trim Calculation Loop. */
void SysCtlHFIRCTrimEnable(xtBoolean bEnable, unsigned char ulTrimLoop)
/* The function is used to enable the HFIRC auto trim, and select the Trim Calculation Loop. */ void SysCtlHFIRCTrimEnable(xtBoolean bEnable, unsigned char ulTrimLoop)
{ xASSERT((ulTrimLoop == SYSCTL_TRIM_L00P_4) || (ulTrimLoop == SYSCTL_TRIM_L00P_8) || (ulTrimLoop == SYSCTL_TRIM_L00P_16) || (ulTrimLoop == SYSCTL_TRIM_L00P_32)); if(bEnable) { xHWREG(GCR_IRCTRIMCTL) |= GCR_IRCTRIMCTL_TRIM_SEL; xHWREG(GCR_IRCTRIMCTL) &= ~GCR_IRCTRIMCTL_TRIM_LOOP_M; xHWREG(GCR_IRCTRIMCTL) |= ulTrimLoop; } else { xHWREG(GCR_IRCTRIMCTL) &= ~GCR_IRCTRIMCTL_TRIM_SEL; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Get pointer to slider window. Returns a reference to the window that should be used when managing the widget, such as destroying, moving or reparenting it. */
struct win_window* wtk_slider_as_child(struct wtk_slider *slider)
/* Get pointer to slider window. Returns a reference to the window that should be used when managing the widget, such as destroying, moving or reparenting it. */ struct win_window* wtk_slider_as_child(struct wtk_slider *slider)
{ Assert(slider); return slider->container; }
memfault/zero-to-main
C++
null
200
/* Initialize NMI. Fill each pstcNmiInit with default value. */
int32_t NMI_StructInit(stc_nmi_init_t *pstcNmiInit)
/* Initialize NMI. Fill each pstcNmiInit with default value. */ int32_t NMI_StructInit(stc_nmi_init_t *pstcNmiInit)
{ int32_t i32Ret = LL_OK; if (NULL == pstcNmiInit) { i32Ret = LL_ERR_INVD_PARAM; } else { pstcNmiInit->u32Src = 0UL; } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This is it. Register the PCI driver information for the cards we control the OS will call our registered routines when it finds one of our cards. */
static int __init hpsa_init(void)
/* This is it. Register the PCI driver information for the cards we control the OS will call our registered routines when it finds one of our cards. */ static int __init hpsa_init(void)
{ int err; hpsa_scan_thread = kthread_run(hpsa_scan_func, NULL, "hpsa_scan"); if (IS_ERR(hpsa_scan_thread)) { err = PTR_ERR(hpsa_scan_thread); return -ENODEV; } err = pci_register_driver(&hpsa_pci_driver); if (err) kthread_stop(hpsa_scan_thread); return err; }
robutest/uclinux
C++
GPL-2.0
60
/* hwint 3 should deal with the PCI A - D interrupts, */
static void pcimt_hwint3(void)
/* hwint 3 should deal with the PCI A - D interrupts, */ static void pcimt_hwint3(void)
{ u8 pend = *(volatile char *)PCIMT_CSITPEND; int irq; pend &= (IT_INTA | IT_INTB | IT_INTC | IT_INTD); pend ^= (IT_INTA | IT_INTB | IT_INTC | IT_INTD); clear_c0_status(IE_IRQ3); irq = PCIMT_IRQ_INT2 + ffs(pend) - 1; do_IRQ(irq); set_c0_status(IE_IRQ3); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns 0 on success or a negative error code. */
int genl_unregister_family(struct genl_family *family)
/* Returns 0 on success or a negative error code. */ int genl_unregister_family(struct genl_family *family)
{ struct genl_family *rc; genl_lock(); genl_unregister_mc_groups(family); list_for_each_entry(rc, genl_family_chain(family->id), family_list) { if (family->id != rc->id || strcmp(rc->name, family->name)) continue; list_del(&rc->family_list); INIT_LIST_HEAD(&family->ops_list); genl_unlock(); kfree(family->attrbuf); genl_ctrl_event(CTRL_CMD_DELFAMILY, family); return 0; } genl_unlock(); return -ENOENT; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return value number of tags or 0 if the task is not tagged */
static u8 pmcraid_task_attributes(struct scsi_cmnd *scsi_cmd)
/* Return value number of tags or 0 if the task is not tagged */ static u8 pmcraid_task_attributes(struct scsi_cmnd *scsi_cmd)
{ char tag[2]; u8 rc = 0; if (scsi_populate_tag_msg(scsi_cmd, tag)) { switch (tag[0]) { case MSG_SIMPLE_TAG: rc = TASK_TAG_SIMPLE; break; case MSG_HEAD_TAG: rc = TASK_TAG_QUEUE_HEAD; break; case MSG_ORDERED_TAG: rc = TASK_TAG_ORDERED; break; }; } return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* Ensure that we do not do DMA on CD devices. We may be able to fix that later on. Also ensure we do not do UDMA on WDC drives */
static unsigned long ali_20_filter(struct ata_device *adev, unsigned long mask)
/* Ensure that we do not do DMA on CD devices. We may be able to fix that later on. Also ensure we do not do UDMA on WDC drives */ static unsigned long ali_20_filter(struct ata_device *adev, unsigned long mask)
{ char model_num[ATA_ID_PROD_LEN + 1]; if (adev->class != ATA_DEV_ATA) mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); ata_id_c_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num)); if (strstr(model_num, "WDC")) return mask &= ~ATA_MASK_UDMA; return ata_bmdma_mode_filter(adev, mask); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Autoselect a master bus to use for the transfer. Slave will be the chosen as victim in case src & dest are not similarly aligned. i.e. If after aligning masters address with width requirements of transfer (by sending few byte by byte data), slave is still not aligned, then its width will be reduced to BYTE. */
static void pl08x_choose_master_bus(struct pl08x_lli_build_data *bd, struct pl08x_bus_data **mbus, struct pl08x_bus_data **sbus, u32 cctl)
/* Autoselect a master bus to use for the transfer. Slave will be the chosen as victim in case src & dest are not similarly aligned. i.e. If after aligning masters address with width requirements of transfer (by sending few byte by byte data), slave is still not aligned, then its width will be reduced to BYTE. */ static void pl08x_choose_master_bus(struct pl08x_lli_build_data *bd, struct pl08x_bus_data **mbus, struct pl08x_bus_data **sbus, u32 cctl)
{ if (!(cctl & PL080_CONTROL_DST_INCR)) { *mbus = &bd->dstbus; *sbus = &bd->srcbus; } else if (!(cctl & PL080_CONTROL_SRC_INCR)) { *mbus = &bd->srcbus; *sbus = &bd->dstbus; } else { if (bd->dstbus.buswidth >= bd->srcbus.buswidth) { *mbus = &bd->dstbus; *sbus = &bd->srcbus; } else { *mbus = &bd->srcbus; *sbus = &bd->dstbus; } } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Stops transmission. Function will wait until transmit operation enters stop state. */
static int32_t MAC_stop_transmission(void)
/* Stops transmission. Function will wait until transmit operation enters stop state. */ static int32_t MAC_stop_transmission(void)
{ int32_t retval = MAC_OK; MAC_set_time_out( (uint16_t)STATE_CHANGE_TIME_OUT ); while( (((MAC->CSR5 & CSR5_TS_MASK) >> CSR5_TS_SHIFT) != CSR5_TS_STOPPED) && (retval == MAC_OK) ) { MAC_BITBAND->CSR6_ST = 0u; if( MAC_get_time_out() == 0u ) { retval = MAC_TIME_OUT; } } return retval; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* param base FLEXSPI peripheral base address. param index From which index start to update. It could be any index of the LUT table, which also allows user to update command content inside a command. Each command consists of up to 8 instructions and occupy 4*32-bit memory. param cmd Command sequence array. param count Number of sequences. */
void FLEXSPI_UpdateLUT(FLEXSPI_Type *base, uint32_t index, const uint32_t *cmd, uint32_t count)
/* param base FLEXSPI peripheral base address. param index From which index start to update. It could be any index of the LUT table, which also allows user to update command content inside a command. Each command consists of up to 8 instructions and occupy 4*32-bit memory. param cmd Command sequence array. param count Number of sequences. */ void FLEXSPI_UpdateLUT(FLEXSPI_Type *base, uint32_t index, const uint32_t *cmd, uint32_t count)
{ assert(index < 64U); uint8_t i = 0; volatile uint32_t *lutBase; while (!FLEXSPI_GetBusIdleStatus(base)) { } base->LUTKEY = FLEXSPI_LUT_KEY_VAL; base->LUTCR = 0x02; lutBase = &base->LUT[index]; for (i = 0; i < count; i++) { *lutBase++ = *cmd++; } base->LUTKEY = FLEXSPI_LUT_KEY_VAL; base->LUTCR = 0x01; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check the HostAdapter status and re-interpret it in EFI_STATUS. */
EFI_STATUS CheckHostAdapterStatus(IN UINT8 HostAdapterStatus)
/* Check the HostAdapter status and re-interpret it in EFI_STATUS. */ EFI_STATUS CheckHostAdapterStatus(IN UINT8 HostAdapterStatus)
{ switch (HostAdapterStatus) { case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK: return EFI_SUCCESS; case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT: case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT: case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND: return EFI_TIMEOUT; case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT: case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PARITY_ERROR: case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED: case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN: case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_RESET: return EFI_NOT_READY; case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_FREE: case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR: return EFI_DEVICE_ERROR; default: return EFI_SUCCESS; } }
tianocore/edk2
C++
Other
4,240
/* stack dumps generator - this is used by arch-independent code. And this is identical to i386 currently. */
void dump_stack(void)
/* stack dumps generator - this is used by arch-independent code. And this is identical to i386 currently. */ void dump_stack(void)
{ unsigned long stack; show_trace(current, &stack); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Requests the bootloader to program the specified data to memory. In case of non-volatile memory, the application needs to make sure the memory range was erased beforehand. */
bool SessionWriteData(uint32_t address, uint32_t len, uint8_t const *data)
/* Requests the bootloader to program the specified data to memory. In case of non-volatile memory, the application needs to make sure the memory range was erased beforehand. */ bool SessionWriteData(uint32_t address, uint32_t len, uint8_t const *data)
{ bool result = false; assert(data != NULL); assert(len > 0); if ( (data != NULL) && (len > 0) ) { result = protocolPtr->WriteData(address, len, data); } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* See "mss_ace.h" for details of how to use this function. */
void ACE_disable_comp_rise_irq(comparator_id_t comp_id)
/* See "mss_ace.h" for details of how to use this function. */ void ACE_disable_comp_rise_irq(comparator_id_t comp_id)
{ ASSERT( comp_id < NB_OF_COMPARATORS ); ACE->COMP_IRQ_EN &= ~(FIRST_RISE_IRQ_MASK << (uint32_t)comp_id); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Enables or disables the specified I2C DMA requests. */
void I2C_DMACmd(I2C_TypeDef *i2c, FunctionalState state)
/* Enables or disables the specified I2C DMA requests. */ void I2C_DMACmd(I2C_TypeDef *i2c, FunctionalState state)
{ if (state) { if (I2C_DMA_DIR == TDMAE_SET) i2c->IC_DMA_CR |= TDMAE_SET; else i2c->IC_DMA_CR |= RDMAE_SET; } else i2c->IC_DMA_CR &= ~(I2C_DMA_RXEN | I2C_DMA_TXEN); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* set SIM clock gating registers to enable or disable peripheral clocks. */
void SIM_SetClockGating(uint32_t u32PeripheralMask, uint8_t u8GateOn)
/* set SIM clock gating registers to enable or disable peripheral clocks. */ void SIM_SetClockGating(uint32_t u32PeripheralMask, uint8_t u8GateOn)
{ uint32_t u32Scgc; u32Scgc = SIM->SCGC; if(u8GateOn) { u32Scgc |= u32PeripheralMask; } else { u32Scgc &= ~u32PeripheralMask; } SIM->SCGC = u32Scgc; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: TRUE on success, FALSE if there was an error */
gboolean g_output_stream_write_all(GOutputStream *stream, const void *buffer, gsize count, gsize *bytes_written, GCancellable *cancellable, GError **error)
/* Returns: TRUE on success, FALSE if there was an error */ gboolean g_output_stream_write_all(GOutputStream *stream, const void *buffer, gsize count, gsize *bytes_written, GCancellable *cancellable, GError **error)
{ gsize _bytes_written; gssize res; g_return_val_if_fail (G_IS_OUTPUT_STREAM (stream), FALSE); g_return_val_if_fail (buffer != NULL, FALSE); _bytes_written = 0; while (_bytes_written < count) { res = g_output_stream_write (stream, (char *)buffer + _bytes_written, count - _bytes_written, cancellable, error); if (res == -1) { if (bytes_written) *bytes_written = _bytes_written; return FALSE; } if (res == 0) g_warning ("Write returned zero without error"); _bytes_written += res; } if (bytes_written) *bytes_written = _bytes_written; return TRUE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Find vmap_areas end addresses of which enclose @end. ie. if not NULL, *pnext->va_end > @end and *pprev->va_end <= @end. */
static bool pvm_find_next_prev(unsigned long end, struct vmap_area **pnext, struct vmap_area **pprev)
/* Find vmap_areas end addresses of which enclose @end. ie. if not NULL, *pnext->va_end > @end and *pprev->va_end <= @end. */ static bool pvm_find_next_prev(unsigned long end, struct vmap_area **pnext, struct vmap_area **pprev)
{ struct rb_node *n = vmap_area_root.rb_node; struct vmap_area *va = NULL; while (n) { va = rb_entry(n, struct vmap_area, rb_node); if (end < va->va_end) n = n->rb_left; else if (end > va->va_end) n = n->rb_right; else break; } if (!va) return false; if (va->va_end > end) { *pnext = va; *pprev = node_to_va(rb_prev(&(*pnext)->rb_node)); } else { *pprev = va; *pnext = node_to_va(rb_next(&(*pprev)->rb_node)); } return true; }
robutest/uclinux
C++
GPL-2.0
60
/* To generate entropy from hardware entropy source (TRNG) */
int32_t RNG_EntropyPoll(uint8_t *pu8Out, int32_t i32Len)
/* To generate entropy from hardware entropy source (TRNG) */ int32_t RNG_EntropyPoll(uint8_t *pu8Out, int32_t i32Len)
{ int32_t timeout; int32_t i; if ((TRNG->CTL & TRNG_CTL_READY_Msk) == 0) { printf("trng is not active\n"); return -1; } TRNG->CTL |= TRNG_CTL_TRNGEN_Msk; for (i = 0; i < i32Len; i++) { timeout = SystemCoreClock; while ((TRNG->CTL & TRNG_CTL_DVIF_Msk) == 0) { if (timeout-- <= 0) { printf("timeout\n"); return -1; } } *pu8Out++ = TRNG->DATA; } return i32Len; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The function is used to (Software)Reset Backup Domain. */
void SysCtlBackupDomainReset(void)
/* The function is used to (Software)Reset Backup Domain. */ void SysCtlBackupDomainReset(void)
{ xHWREG(PWRCU_BAKCR) |= PWRCU_BAKCR_BAKRST; while(xHWREG(PWRCU_BAKCR)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Add packet header with sequence number to current packet Called by oonf_api during packet creation */
static void _nhdp_add_packet_header_cb(struct rfc5444_writer *writer, struct rfc5444_writer_target *rfc5444_target)
/* Add packet header with sequence number to current packet Called by oonf_api during packet creation */ static void _nhdp_add_packet_header_cb(struct rfc5444_writer *writer, struct rfc5444_writer_target *rfc5444_target)
{ rfc5444_writer_set_pkt_header(writer, rfc5444_target, true); rfc5444_writer_set_pkt_seqno(writer, rfc5444_target, ++nhdp_wr_curr_if_entry->seq_no); }
labapart/polymcu
C++
null
201
/* The IfConfig6 cleanup process, free the allocated memory. */
VOID IfConfig6Cleanup(IN IFCONFIG6_PRIVATE_DATA *Private)
/* The IfConfig6 cleanup process, free the allocated memory. */ VOID IfConfig6Cleanup(IN IFCONFIG6_PRIVATE_DATA *Private)
{ LIST_ENTRY *Entry; LIST_ENTRY *NextEntry; IFCONFIG6_INTERFACE_CB *IfCb; ASSERT (Private != NULL); if (Private->VarArg != NULL) { IfConfig6FreeArgList (Private->VarArg); } if (Private->IfName != NULL) { FreePool (Private->IfName); } Entry = Private->IfList.ForwardLink; NextEntry = Entry->ForwardLink; while (Entry != &Private->IfList) { IfCb = BASE_CR (Entry, IFCONFIG6_INTERFACE_CB, Link); RemoveEntryList (&IfCb->Link); if (IfCb->IfId != NULL) { FreePool (IfCb->IfId); } if (IfCb->IfInfo != NULL) { FreePool (IfCb->IfInfo); } FreePool (IfCb); Entry = NextEntry; NextEntry = Entry->ForwardLink; } FreePool (Private); }
tianocore/edk2
C++
Other
4,240
/* returns : (jornada_ssp_byte(byte)) on success : %-ETIMEDOUT on timeout failure */
int jornada_ssp_inout(u8 byte)
/* returns : (jornada_ssp_byte(byte)) on success : %-ETIMEDOUT on timeout failure */ int jornada_ssp_inout(u8 byte)
{ int ret, i; if (byte != TXDUMMY) { ret = jornada_ssp_byte(byte); if (ret != TXDUMMY) { for (i = 0; i < 256; i++) if (jornada_ssp_byte(TXDUMMY) == -1) break; return -ETIMEDOUT; } } else ret = jornada_ssp_byte(TXDUMMY); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* MTBSFM: Backward space over 'count' file marks. The tape is positioned at the BOT (Begin Of Tape) side of the last skipped file mark. */
int tape_std_mtbsfm(struct tape_device *device, int mt_count)
/* MTBSFM: Backward space over 'count' file marks. The tape is positioned at the BOT (Begin Of Tape) side of the last skipped file mark. */ int tape_std_mtbsfm(struct tape_device *device, int mt_count)
{ struct tape_request *request; struct ccw1 *ccw; request = tape_alloc_request(mt_count + 2, 0); if (IS_ERR(request)) return PTR_ERR(request); request->op = TO_BSF; ccw = tape_ccw_cc(request->cpaddr, MODE_SET_DB, 1, device->modeset_byte); ccw = tape_ccw_repeat(ccw, BACKSPACEFILE, mt_count); ccw = tape_ccw_end(ccw, NOP, 0, NULL); return tape_do_io_free(device, request); }
robutest/uclinux
C++
GPL-2.0
60
/* Initializes config with predefined default values. This function will initialize a given Dualtimer configuration structure to a set of known default values. This function should be called on any new instance of the configuration structures before being modified by the user application. */
void dualtimer_get_config_defaults(struct dualtimer_config *config)
/* Initializes config with predefined default values. This function will initialize a given Dualtimer configuration structure to a set of known default values. This function should be called on any new instance of the configuration structures before being modified by the user application. */ void dualtimer_get_config_defaults(struct dualtimer_config *config)
{ config->timer1.timer_enable = true; config->timer2.timer_enable = true; config->timer1.counter_mode = DUALTIMER_PERIODIC_MODE; config->timer2.counter_mode = DUALTIMER_PERIODIC_MODE; config->timer1.counter_size = DUALTIMER_COUNTER_SIZE_32BIT; config->timer2.counter_size = DUALTIMER_COUNTER_SIZE_32BIT; config->timer1.clock_prescaler = DUALTIMER_CLOCK_PRESCALER_DIV1; config->timer2.clock_prescaler = DUALTIMER_CLOCK_PRESCALER_DIV1; config->timer1.interrup_enable = true; config->timer2.interrup_enable = true; config->timer1.load_value = 0; config->timer2.load_value = 0; config->clock_source = DUALTIMER_CLK_INPUT_0; }
memfault/zero-to-main
C++
null
200
/* Return the timebase clock frequency i.e. how often the timer decrements */
ulong get_tbclk(void)
/* Return the timebase clock frequency i.e. how often the timer decrements */ ulong get_tbclk(void)
{ unsigned long long tmp = CONFIG_SYS_HZ_CLOCK; do_div(tmp, div_clock); return tmp; }
EmcraftSystems/u-boot
C++
Other
181
/* The first part of the allocated buffer is EFI_ARP_FIND_DATA, following which are protocol address pairs and hardware address pairs. When finding a specific protocol address (BySwAddress is TRUE and AddressBuffer is not NULL), the ARP cache timeout for the found entry is reset if Refresh is set to TRUE. If the found ARP cache entry is a permanent entry, it is not affected by Refresh. */
EFI_STATUS EFIAPI ArpFind(IN EFI_ARP_PROTOCOL *This, IN BOOLEAN BySwAddress, IN VOID *AddressBuffer OPTIONAL, OUT UINT32 *EntryLength OPTIONAL, OUT UINT32 *EntryCount OPTIONAL, OUT EFI_ARP_FIND_DATA **Entries OPTIONAL, IN BOOLEAN Refresh)
/* The first part of the allocated buffer is EFI_ARP_FIND_DATA, following which are protocol address pairs and hardware address pairs. When finding a specific protocol address (BySwAddress is TRUE and AddressBuffer is not NULL), the ARP cache timeout for the found entry is reset if Refresh is set to TRUE. If the found ARP cache entry is a permanent entry, it is not affected by Refresh. */ EFI_STATUS EFIAPI ArpFind(IN EFI_ARP_PROTOCOL *This, IN BOOLEAN BySwAddress, IN VOID *AddressBuffer OPTIONAL, OUT UINT32 *EntryLength OPTIONAL, OUT UINT32 *EntryCount OPTIONAL, OUT EFI_ARP_FIND_DATA **Entries OPTIONAL, IN BOOLEAN Refresh)
{ EFI_STATUS Status; ARP_INSTANCE_DATA *Instance; EFI_TPL OldTpl; if ((This == NULL) || (!Refresh && (EntryCount == NULL) && (EntryLength == NULL)) || ((Entries != NULL) && ((EntryLength == NULL) || (EntryCount == NULL)))) { return EFI_INVALID_PARAMETER; } Instance = ARP_INSTANCE_DATA_FROM_THIS (This); if (!Instance->Configured) { return EFI_NOT_STARTED; } OldTpl = gBS->RaiseTPL (TPL_CALLBACK); Status = ArpFindCacheEntry ( Instance, BySwAddress, AddressBuffer, EntryLength, EntryCount, Entries, Refresh ); gBS->RestoreTPL (OldTpl); return Status; }
tianocore/edk2
C++
Other
4,240
/* Initialized the controller for the ADuCM3029 external interrupts. */
int32_t irq_ctrl_init(struct irq_ctrl_desc **desc, const struct irq_init_param *param)
/* Initialized the controller for the ADuCM3029 external interrupts. */ int32_t irq_ctrl_init(struct irq_ctrl_desc **desc, const struct irq_init_param *param)
{ struct aducm_irq_ctrl_desc *aducm_desc; if (!desc || !param || initialized) return FAILURE; *desc = (struct irq_ctrl_desc *)calloc(1, sizeof(**desc)); if (!*desc) return FAILURE; aducm_desc = (struct aducm_irq_ctrl_desc *) calloc(1, sizeof(*aducm_desc)); if (!aducm_desc) { free(*desc); *desc = NULL; return FAILURE; } (*desc)->extra = aducm_desc; (*desc)->irq_ctrl_id = param->irq_ctrl_id; adi_xint_Init(aducm_desc->irq_memory, ADI_XINT_MEMORY_SIZE); initialized = 1; return SUCCESS; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* This function is used to create the MsgQ. */
OsiReturnVal_e osi_MsgQCreate(OsiMsgQ_t *pMsgQ, char *pMsgQName, unsigned long MsgSize, unsigned long MaxMsgs)
/* This function is used to create the MsgQ. */ OsiReturnVal_e osi_MsgQCreate(OsiMsgQ_t *pMsgQ, char *pMsgQName, unsigned long MsgSize, unsigned long MaxMsgs)
{ QueueHandle_t handle; handle = xQueueCreate( MaxMsgs, MsgSize ); ASSERT (handle != NULL); *pMsgQ = (OsiMsgQ_t)handle; return OSI_OK; }
micropython/micropython
C++
Other
18,334
/* Checks whether the descriptor is empty. If the buffer1 and buffer2 lengths are zero in ring mode descriptor is empty. In chain mode buffer2 length is 0 but buffer2 itself contains the next descriptor address. */
bool synopGMAC_is_desc_empty(DmaDesc *desc)
/* Checks whether the descriptor is empty. If the buffer1 and buffer2 lengths are zero in ring mode descriptor is empty. In chain mode buffer2 length is 0 but buffer2 itself contains the next descriptor address. */ bool synopGMAC_is_desc_empty(DmaDesc *desc)
{ return(((desc->length & DescSize1Mask) == 0) && ((desc->length & DescSize2Mask) == 0) ); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Converts a text device path node to USB mass storage device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbMassStorage(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to USB mass storage device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbMassStorage(IN CHAR16 *TextDeviceNode)
{ USB_CLASS_TEXT UsbClassText; UsbClassText.ClassExist = FALSE; UsbClassText.Class = USB_CLASS_MASS_STORAGE; UsbClassText.SubClassExist = TRUE; return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); }
tianocore/edk2
C++
Other
4,240
/* Read sensor data. This routine calls the appropriate internal data function to obtain the specified type of data from the sensor device. */
static bool hmc5883l_read(sensor_t *sensor, sensor_read_t type, sensor_data_t *data)
/* Read sensor data. This routine calls the appropriate internal data function to obtain the specified type of data from the sensor device. */ static bool hmc5883l_read(sensor_t *sensor, sensor_read_t type, sensor_data_t *data)
{ sensor_hal_t *const hal = sensor->hal; switch (type) { case SENSOR_READ_FIELD: return hmc5883l_get_field(hal, data); case SENSOR_READ_HEADING: return hmc5883l_get_heading(hal, data); case SENSOR_READ_ID: return hmc5883l_device_id(hal, data); default: sensor->err = SENSOR_ERR_FUNCTION; return false; } }
memfault/zero-to-main
C++
null
200
/* Nokia cards are not really multiport cards. Shouldn't this be handled by setting the quirk entry .multi = 0 | 1 ? */
static void quirk_config_nokia(struct pcmcia_device *link)
/* Nokia cards are not really multiport cards. Shouldn't this be handled by setting the quirk entry .multi = 0 | 1 ? */ static void quirk_config_nokia(struct pcmcia_device *link)
{ struct serial_info *info = link->priv; if (info->multi > 1) info->multi = 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Enable Jumbo frame support. When Enabled GMAC supports jumbo frames of 9018/9022(VLAN tagged). Giant frame error is not reported in receive frame status. */
void synopGMAC_jumbo_frame_enable(synopGMACdevice *gmacdev)
/* Enable Jumbo frame support. When Enabled GMAC supports jumbo frames of 9018/9022(VLAN tagged). Giant frame error is not reported in receive frame status. */ void synopGMAC_jumbo_frame_enable(synopGMACdevice *gmacdev)
{ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacJumboFrame); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check the file size bounds and adjusts count as needed. This would not be needed if the file size didn't reset to 0 after a write. */
static size_t w1_f23_fix_count(loff_t off, size_t count, size_t size)
/* Check the file size bounds and adjusts count as needed. This would not be needed if the file size didn't reset to 0 after a write. */ static size_t w1_f23_fix_count(loff_t off, size_t count, size_t size)
{ if (off > size) return 0; if ((off + count) > size) return (size - off); return count; }
robutest/uclinux
C++
GPL-2.0
60
/* Specifies the low threshold and high threshold of analog watchdog. */
void ADC_AWD_SetThreshold(CM_ADC_TypeDef *ADCx, uint8_t u8AwdUnit, uint16_t u16LowThreshold, uint16_t u16HighThreshold)
/* Specifies the low threshold and high threshold of analog watchdog. */ void ADC_AWD_SetThreshold(CM_ADC_TypeDef *ADCx, uint8_t u8AwdUnit, uint16_t u16LowThreshold, uint16_t u16HighThreshold)
{ DDL_ASSERT(IS_ADC_UNIT(ADCx)); DDL_ASSERT(IS_ADC_AWD(u8AwdUnit)); (void)(u8AwdUnit); WRITE_REG16(ADCx->AWDDR0, u16LowThreshold); WRITE_REG16(ADCx->AWDDR1, u16HighThreshold); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Shuts down the internal operations of the velocity and disables interrupts, autopolling, transmit and receive */
static void velocity_shutdown(struct velocity_info *vptr)
/* Shuts down the internal operations of the velocity and disables interrupts, autopolling, transmit and receive */ static void velocity_shutdown(struct velocity_info *vptr)
{ struct mac_regs __iomem *regs = vptr->mac_regs; mac_disable_int(regs); writel(CR0_STOP, &regs->CR0Set); writew(0xFFFF, &regs->TDCSRClr); writeb(0xFF, &regs->RDCSRClr); safe_disable_mii_autopoll(regs); mac_clear_isr(regs); }
robutest/uclinux
C++
GPL-2.0
60
/* Calculate remainder: BnRes = BnA % BnB. Please note, all "out" Big number arguments should be properly initialized by calling to BigNumInit() or BigNumFromBin() functions. */
BOOLEAN EFIAPI BigNumMod(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes)
/* Calculate remainder: BnRes = BnA % BnB. Please note, all "out" Big number arguments should be properly initialized by calling to BigNumInit() or BigNumFromBin() functions. */ BOOLEAN EFIAPI BigNumMod(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes)
{ BOOLEAN RetVal; BN_CTX *Ctx; Ctx = BN_CTX_new (); if (Ctx == NULL) { return FALSE; } RetVal = (BOOLEAN)BN_mod (BnRes, BnA, BnB, Ctx); BN_CTX_free (Ctx); return RetVal; }
tianocore/edk2
C++
Other
4,240
/* show_dock_uid - read method for "uid" file in sysfs */
static ssize_t show_dock_uid(struct device *dev, struct device_attribute *attr, char *buf)
/* show_dock_uid - read method for "uid" file in sysfs */ static ssize_t show_dock_uid(struct device *dev, struct device_attribute *attr, char *buf)
{ unsigned long long lbuf; struct dock_station *dock_station = dev->platform_data; acpi_status status = acpi_evaluate_integer(dock_station->handle, "_UID", NULL, &lbuf); if (ACPI_FAILURE(status)) return 0; return snprintf(buf, PAGE_SIZE, "%llx\n", lbuf); }
robutest/uclinux
C++
GPL-2.0
60
/* This function read the state of the M24SR GPO. */
void NFC_IO_ReadState(uint8_t *pPinState)
/* This function read the state of the M24SR GPO. */ void NFC_IO_ReadState(uint8_t *pPinState)
{ *pPinState = (uint8_t)HAL_GPIO_ReadPin(NFC_GPIO_GPO_PIN_PORT,NFC_GPIO_GPO_PIN); }
eclipse-threadx/getting-started
C++
Other
310
/* Helper dissector for ZCL Write Attribute Response command. */
static void dissect_zcl_write_attr_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset, guint16 cluster_id)
/* Helper dissector for ZCL Write Attribute Response command. */ static void dissect_zcl_write_attr_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset, guint16 cluster_id)
{ proto_tree *sub_tree; guint tvb_len; guint i = 0; tvb_len = tvb_captured_length(tvb); while ( *offset < tvb_len && i < ZBEE_ZCL_NUM_ATTR_ETT ) { sub_tree = proto_tree_add_subtree(tree, tvb, *offset, 0, ett_zbee_zcl_attr[i], NULL, "Status Record"); i++; if ( dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_status) != ZBEE_ZCL_STAT_SUCCESS ) { dissect_zcl_attr_id(tvb, sub_tree, offset, cluster_id); } } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function returns zero if the volume identifier header is all right, and %-EINVAL if not. */
static int self_check_vid_hdr(const struct ubi_device *ubi, int pnum, const struct ubi_vid_hdr *vid_hdr)
/* This function returns zero if the volume identifier header is all right, and %-EINVAL if not. */ static int self_check_vid_hdr(const struct ubi_device *ubi, int pnum, const struct ubi_vid_hdr *vid_hdr)
{ int err; uint32_t magic; if (!ubi_dbg_chk_io(ubi)) return 0; magic = be32_to_cpu(vid_hdr->magic); if (magic != UBI_VID_HDR_MAGIC) { ubi_err(ubi, "bad VID header magic %#08x at PEB %d, must be %#08x", magic, pnum, UBI_VID_HDR_MAGIC); goto fail; } err = validate_vid_hdr(ubi, vid_hdr); if (err) { ubi_err(ubi, "self-check failed for PEB %d", pnum); goto fail; } return err; fail: ubi_err(ubi, "self-check failed for PEB %d", pnum); ubi_dump_vid_hdr(vid_hdr); dump_stack(); return -EINVAL; }
4ms/stm32mp1-baremetal
C++
Other
137
/* SPI Hole a count Received bytes in next receive process. */
void SPI_RxBytes(SPI_TypeDef *spi, u16 number)
/* SPI Hole a count Received bytes in next receive process. */ void SPI_RxBytes(SPI_TypeDef *spi, u16 number)
{ WRITE_REG(spi->RDNR, number); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Some localbus EIDE interfaces require a special access sequence when using 32-bit I/O instructions to transfer data. We call this the "vlb_sync" sequence, which consists of three successive reads of the sector count register location, with interrupts disabled to ensure that the reads all happen together. */
static void ata_vlb_sync(unsigned long port)
/* Some localbus EIDE interfaces require a special access sequence when using 32-bit I/O instructions to transfer data. We call this the "vlb_sync" sequence, which consists of three successive reads of the sector count register location, with interrupts disabled to ensure that the reads all happen together. */ static void ata_vlb_sync(unsigned long port)
{ (void)inb(port); (void)inb(port); (void)inb(port); }
robutest/uclinux
C++
GPL-2.0
60
/* param base PXP peripheral base address. param config Pointer to the configuration. */
void PXP_SetLutConfig(PXP_Type *base, const pxp_lut_config_t *config)
/* param base PXP peripheral base address. param config Pointer to the configuration. */ void PXP_SetLutConfig(PXP_Type *base, const pxp_lut_config_t *config)
{ base->LUT_CTRL = (base->LUT_CTRL & ~(PXP_LUT_CTRL_OUT_MODE_MASK | PXP_LUT_CTRL_LOOKUP_MODE_MASK)) | PXP_LUT_CTRL_LRU_UPD_MASK | PXP_LUT_CTRL_OUT_MODE(config->outMode) | PXP_LUT_CTRL_LOOKUP_MODE(config->lookupMode); if (kPXP_LutOutRGBW4444CFA == config->outMode) { base->CFA = config->cfaValue; } }
eclipse-threadx/getting-started
C++
Other
310
/* Remove attribute from hashbin and, if it was the last attribute of the object, remove the object as well. */
int irias_delete_attrib(struct ias_object *obj, struct ias_attrib *attrib, int cleanobject)
/* Remove attribute from hashbin and, if it was the last attribute of the object, remove the object as well. */ int irias_delete_attrib(struct ias_object *obj, struct ias_attrib *attrib, int cleanobject)
{ struct ias_attrib *node; IRDA_ASSERT(obj != NULL, return -1;); IRDA_ASSERT(obj->magic == IAS_OBJECT_MAGIC, return -1;); IRDA_ASSERT(attrib != NULL, return -1;); node = hashbin_remove_this(obj->attribs, (irda_queue_t *) attrib); if (!node) return 0; __irias_delete_attrib(node); node = (struct ias_attrib *) hashbin_get_first(obj->attribs); if (cleanobject && !node) irias_delete_object(obj); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The function gets the ADCCLK divisor from the Configuration Register 2. */
u8 XAdcPs_GetAdcClkDivisor(XAdcPs *InstancePtr)
/* The function gets the ADCCLK divisor from the Configuration Register 2. */ u8 XAdcPs_GetAdcClkDivisor(XAdcPs *InstancePtr)
{ u16 Divisor; Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); Divisor = (u16) XAdcPs_ReadInternalReg(InstancePtr, XADCPS_CFR2_OFFSET); return (u8) (Divisor >> XADCPS_CFR2_CD_SHIFT); }
ua1arn/hftrx
C++
null
69
/* Intel recommends to set DFR, LDR and TPR before enabling an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel document number 292116). So here it goes... */
static void flat_init_apic_ldr(void)
/* Intel recommends to set DFR, LDR and TPR before enabling an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel document number 292116). So here it goes... */ static void flat_init_apic_ldr(void)
{ unsigned long val; unsigned long num, id; num = smp_processor_id(); id = 1UL << num; apic_write(APIC_DFR, APIC_DFR_FLAT); val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; val |= SET_APIC_LOGICAL_ID(id); apic_write(APIC_LDR, val); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* this function is a POSIX compliant version, which will return current location in directory stream. */
long telldir(DIR *d)
/* this function is a POSIX compliant version, which will return current location in directory stream. */ long telldir(DIR *d)
{ struct dfs_file *file; long result; if (d == NULL) { rt_set_errno(-EBADF); return -1; } file = fd_get(d->fd); if (file == NULL) { rt_set_errno(-EBADF); return 0; } result = file->fpos - d->num + d->cur; return result; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* tioca_error_intr_handler - SGI TIO CA error interrupt handler @irq: unused */
static irqreturn_t tioca_error_intr_handler(int irq, void *arg)
/* tioca_error_intr_handler - SGI TIO CA error interrupt handler @irq: unused */ static irqreturn_t tioca_error_intr_handler(int irq, void *arg)
{ struct tioca_common *soft = arg; struct ia64_sal_retval ret_stuff; u64 segment; u64 busnum; ret_stuff.status = 0; ret_stuff.v0 = 0; segment = soft->ca_common.bs_persist_segment; busnum = soft->ca_common.bs_persist_busnum; SAL_CALL_NOLOCK(ret_stuff, (u64) SN_SAL_IOIF_ERROR_INTERRUPT, segment, busnum, 0, 0, 0, 0, 0); return IRQ_HANDLED; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Vertical synchronisation handler for the OV7740 image sensor. */
void ISI_Handler(void)
/* Vertical synchronisation handler for the OV7740 image sensor. */ void ISI_Handler(void)
{ NVIC_DisableIRQ(ISI_IRQn); g_ul_vsync_flag = true; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Remove @mode from @connector's mode list, then free it. */
void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode)
/* Remove @mode from @connector's mode list, then free it. */ void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode)
{ list_del(&mode->head); kfree(mode); }
robutest/uclinux
C++
GPL-2.0
60
/* Function : ice_error_init Purpose : initialize the error handling requirements for a given tio. Parameters : cnode, the compact nodeid. Assumptions : Called only once per tio. Returns : None */
void ice_error_init(struct hubdev_info *hubdev_info)
/* Function : ice_error_init Purpose : initialize the error handling requirements for a given tio. Parameters : cnode, the compact nodeid. Assumptions : Called only once per tio. Returns : None */ void ice_error_init(struct hubdev_info *hubdev_info)
{ if (request_irq (SGI_TIO_ERROR, (void *)hub_eint_handler, IRQF_SHARED, "SN_TIO_error", (void *)hubdev_info)) { printk("ice_error_init: request_irq() error hubdev_info 0x%p\n", hubdev_info); return; } sn_set_err_irq_affinity(SGI_TIO_ERROR); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Writes the Initial Vector (IV) register, needed in some of the AES Modes. */
void AESIVSet(uint32_t ui32Base, uint32_t *pui32IVdata)
/* Writes the Initial Vector (IV) register, needed in some of the AES Modes. */ void AESIVSet(uint32_t ui32Base, uint32_t *pui32IVdata)
{ ASSERT(ui32Base == AES_BASE); HWREG(ui32Base + AES_O_IV_IN_0) = pui32IVdata[0]; HWREG(ui32Base + AES_O_IV_IN_1) = pui32IVdata[1]; HWREG(ui32Base + AES_O_IV_IN_2) = pui32IVdata[2]; HWREG(ui32Base + AES_O_IV_IN_3) = pui32IVdata[3]; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the period of the specified channel in millseconds. */
void pwmout_period_ms(pwmout_t *obj, int ms)
/* Set the period of the specified channel in millseconds. */ void pwmout_period_ms(pwmout_t *obj, int ms)
{ pwmout_period_us(obj, (int)(ms * 1000)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* TIM MSP Initialization This function configures the hardware resources used in this example: */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim)
/* TIM MSP Initialization This function configures the hardware resources used in this example: */ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim)
{ __HAL_RCC_TIM6_CLK_ENABLE(); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This file is part of the Simba project. */
int mock_write_mutex_module_init(int res)
/* This file is part of the Simba project. */ int mock_write_mutex_module_init(int res)
{ harness_mock_write("mutex_module_init()", NULL, 0); harness_mock_write("mutex_module_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* Allocates resources for an SGE descriptor ring, such as Tx queues, free buffer lists, or response queues. Each SGE ring requires space for its HW descriptors plus, optionally, space for the SW state associated with each HW entry (the metadata). The function returns three values: the virtual address for the HW ring (the return value of the function), the physical address of the HW ring, and the address of the SW ring. */
static void* alloc_ring(struct pci_dev *pdev, size_t nelem, size_t elem_size, size_t sw_size, dma_addr_t *phys, void *metadata)
/* Allocates resources for an SGE descriptor ring, such as Tx queues, free buffer lists, or response queues. Each SGE ring requires space for its HW descriptors plus, optionally, space for the SW state associated with each HW entry (the metadata). The function returns three values: the virtual address for the HW ring (the return value of the function), the physical address of the HW ring, and the address of the SW ring. */ static void* alloc_ring(struct pci_dev *pdev, size_t nelem, size_t elem_size, size_t sw_size, dma_addr_t *phys, void *metadata)
{ size_t len = nelem * elem_size; void *s = NULL; void *p = dma_alloc_coherent(&pdev->dev, len, phys, GFP_KERNEL); if (!p) return NULL; if (sw_size && metadata) { s = kcalloc(nelem, sw_size, GFP_KERNEL); if (!s) { dma_free_coherent(&pdev->dev, len, p, *phys); return NULL; } *(void **)metadata = s; } memset(p, 0, len); return p; }
robutest/uclinux
C++
GPL-2.0
60
/* Retrieve the EC Public Key from one DER-encoded X509 certificate. */
BOOLEAN EFIAPI CryptoServiceEcGetPublicKeyFromX509(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT VOID **EcContext)
/* Retrieve the EC Public Key from one DER-encoded X509 certificate. */ BOOLEAN EFIAPI CryptoServiceEcGetPublicKeyFromX509(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT VOID **EcContext)
{ return CALL_BASECRYPTLIB (Ec.Services.GetPublicKeyFromX509, EcGetPublicKeyFromX509, (Cert, CertSize, EcContext), FALSE); }
tianocore/edk2
C++
Other
4,240
/* NOTE: calling this function always switches to the stream mode. you'll need to disconnect the host to get back to the normal mode. */
static int vx_query_hbuffer_size(struct vx_core *chip, struct vx_pipe *pipe)
/* NOTE: calling this function always switches to the stream mode. you'll need to disconnect the host to get back to the normal mode. */ static int vx_query_hbuffer_size(struct vx_core *chip, struct vx_pipe *pipe)
{ int result; struct vx_rmh rmh; vx_init_rmh(&rmh, CMD_SIZE_HBUFFER); vx_set_pipe_cmd_params(&rmh, pipe->is_capture, pipe->number, 0); if (pipe->is_capture) rmh.Cmd[0] |= 0x00000001; result = vx_send_msg(chip, &rmh); if (! result) result = rmh.Stat[0] & 0xffff; return result; }
robutest/uclinux
C++
GPL-2.0
60
/* Output a single byte to the serial port. */
void serial_putc(const char c)
/* Output a single byte to the serial port. */ void serial_putc(const char c)
{ while ((LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_TEMT) == 0); THR(CONFIG_SYS_IXP425_CONSOLE) = c; if (c == '\n') serial_putc ('\r'); }
EmcraftSystems/u-boot
C++
Other
181
/* send OSS raw events - SEQ_PRIVATE and SEQ_VOLUME */
int snd_seq_oss_synth_raw_event(struct seq_oss_devinfo *dp, int dev, unsigned char *data, struct snd_seq_event *ev)
/* send OSS raw events - SEQ_PRIVATE and SEQ_VOLUME */ int snd_seq_oss_synth_raw_event(struct seq_oss_devinfo *dp, int dev, unsigned char *data, struct snd_seq_event *ev)
{ if (! snd_seq_oss_synth_is_valid(dp, dev) || is_midi_dev(dp, dev)) return -ENXIO; ev->type = SNDRV_SEQ_EVENT_OSS; memcpy(ev->data.raw8.d, data, 8); return snd_seq_oss_synth_addr(dp, dev, ev); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns true if a response descriptor contains a yet unprocessed response. */
static int is_new_response(const struct rsp_desc *r, const struct sge_rspq *q)
/* Returns true if a response descriptor contains a yet unprocessed response. */ static int is_new_response(const struct rsp_desc *r, const struct sge_rspq *q)
{ return (r->intr_gen & F_RSPD_GEN2) == q->gen; }
robutest/uclinux
C++
GPL-2.0
60
/* fsnotify_get_cookie - return a unique cookie for use in synchronizing events. Called from fsnotify_move, which is inlined into filesystem modules. */
u32 fsnotify_get_cookie(void)
/* fsnotify_get_cookie - return a unique cookie for use in synchronizing events. Called from fsnotify_move, which is inlined into filesystem modules. */ u32 fsnotify_get_cookie(void)
{ return atomic_inc_return(&fsnotify_sync_cookie); }
robutest/uclinux
C++
GPL-2.0
60
/* In the longer term this should become an architecture specific section so that this can become a generic driver interface for all platforms. For now we only handle PC I/O ports with or without the dread 5uS sanity delay. */
static void z8530_write_port(unsigned long p, u8 d)
/* In the longer term this should become an architecture specific section so that this can become a generic driver interface for all platforms. For now we only handle PC I/O ports with or without the dread 5uS sanity delay. */ static void z8530_write_port(unsigned long p, u8 d)
{ outb(d,Z8530_PORT_OF(p)); if(p&Z8530_PORT_SLEEP) udelay(5); }
robutest/uclinux
C++
GPL-2.0
60
/* Reads and returns the current value of DR5. This function is only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on X64. */
UINTN EFIAPI AsmReadDr5(VOID)
/* Reads and returns the current value of DR5. This function is only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on X64. */ UINTN EFIAPI AsmReadDr5(VOID)
{ UINTN Data; __asm__ __volatile__ ( "mov %%dr5, %0" : "=r" (Data) ); return Data; }
tianocore/edk2
C++
Other
4,240
/* Display information for all handles on a list. */
SHELL_STATUS DoDhForHandleList(IN CONST EFI_HANDLE *HandleList, IN CONST BOOLEAN Verbose, IN CONST BOOLEAN Sfo, IN CONST CHAR8 *Language, IN CONST BOOLEAN DriverInfo)
/* Display information for all handles on a list. */ SHELL_STATUS DoDhForHandleList(IN CONST EFI_HANDLE *HandleList, IN CONST BOOLEAN Verbose, IN CONST BOOLEAN Sfo, IN CONST CHAR8 *Language, IN CONST BOOLEAN DriverInfo)
{ CONST EFI_HANDLE *HandleWalker; SHELL_STATUS ShellStatus; ShellStatus = SHELL_SUCCESS; for (HandleWalker = HandleList; HandleWalker != NULL && *HandleWalker != NULL; HandleWalker++) { DoDhByHandle (*HandleWalker, Verbose, Sfo, Language, DriverInfo, TRUE); if (ShellGetExecutionBreakFlag ()) { ShellStatus = SHELL_ABORTED; break; } } return (ShellStatus); }
tianocore/edk2
C++
Other
4,240
/* Return an allocated copy pool of the NOR flash information structure. */
EFI_STATUS EFIAPI NorFlashGetInfo(IN UINT8 *Id, IN OUT NOR_FLASH_INFO **FlashInfo, IN BOOLEAN AllocateForRuntime)
/* Return an allocated copy pool of the NOR flash information structure. */ EFI_STATUS EFIAPI NorFlashGetInfo(IN UINT8 *Id, IN OUT NOR_FLASH_INFO **FlashInfo, IN BOOLEAN AllocateForRuntime)
{ CONST NOR_FLASH_INFO *TmpInfo; TmpInfo = NorFlashIds; for ( ; TmpInfo->Name != NULL; TmpInfo++) { if (CompareMem (TmpInfo->Id, Id, TmpInfo->IdLen) == 0) { break; } } if (TmpInfo->Name == NULL) { return EFI_NOT_FOUND; } if (AllocateForRuntime) { *FlashInfo = AllocateRuntimeCopyPool (sizeof (NOR_FLASH_INFO), TmpInfo); } else { *FlashInfo = AllocateCopyPool (sizeof (NOR_FLASH_INFO), TmpInfo); } if (FlashInfo == NULL) { return EFI_OUT_OF_RESOURCES; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Disable DMA mode for reception @rmtoll CR RXDMA LL_SWPMI_DisableDMAReq_RX. */
void LL_SWPMI_DisableDMAReq_RX(SWPMI_TypeDef *SWPMIx)
/* Disable DMA mode for reception @rmtoll CR RXDMA LL_SWPMI_DisableDMAReq_RX. */ void LL_SWPMI_DisableDMAReq_RX(SWPMI_TypeDef *SWPMIx)
{ CLEAR_BIT(SWPMIx->CR, SWPMI_CR_RXDMA); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Gets the value (1 or 0) of the specified pixel from the buffer. */
uint8_t ssd1306GetPixel(uint8_t x, uint8_t y)
/* Gets the value (1 or 0) of the specified pixel from the buffer. */ uint8_t ssd1306GetPixel(uint8_t x, uint8_t y)
{ if ((x >= SSD1306_LCDWIDTH) || (y >=SSD1306_LCDHEIGHT)) return 0; return _ssd1306buffer[x+ (y/8)*SSD1306_LCDWIDTH] & (1 << y%8) ? 1 : 0; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Initializes the Low Level portion of the Device driver. */
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
/* Initializes the Low Level portion of the Device driver. */ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
{ hpcd.Instance = USB; hpcd.Init.dev_endpoints = 8; hpcd.Init.ep0_mps = 0x40; hpcd.Init.phy_itface = PCD_PHY_EMBEDDED; hpcd.Init.speed = PCD_SPEED_FULL; hpcd.Init.low_power_enable = 0; hpcd.pData = pdev; pdev->pData = &hpcd; HAL_PCD_Init(&hpcd); HAL_PCDEx_PMAConfig(&hpcd , 0x00 , PCD_SNG_BUF, 0x18); HAL_PCDEx_PMAConfig(&hpcd , 0x80 , PCD_SNG_BUF, 0x58); HAL_PCDEx_PMAConfig(&hpcd , 0x81 , PCD_SNG_BUF, 0x100); return USBD_OK; }
st-one/X-CUBE-USB-PD
C++
null
110
/* Sets the horizontal timings of the LCD controller. Meaningful for both STN and TFT displays. */
void LCD_SetHorizontalTimings(unsigned int hbp, unsigned int hpw, unsigned int hfp)
/* Sets the horizontal timings of the LCD controller. Meaningful for both STN and TFT displays. */ void LCD_SetHorizontalTimings(unsigned int hbp, unsigned int hpw, unsigned int hfp)
{ ASSERT(((hbp-1) & 0xFFFFFF00) == 0, "LCD_SetHorizontalTimings: Wrong hbp value.\n\r"); ASSERT(((hpw-1) & 0xFFFFFFC0) == 0, "LCD_SetHorizontalTimings: Wrong hpw value.\n\r"); ASSERT(((hfp-1) & 0xFFFFFF00) == 0, "LCD_SetHorizontalTimings: Wrong hfp value.\n\r"); AT91C_BASE_LCDC->LCDC_TIM2 = (hbp-1) | ((hpw-1) << 8) | ((hfp-1) << 24); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Process and validate that backends got expected content. */
static void process_and_validate(bool backend2_enable, bool panic)
/* Process and validate that backends got expected content. */ static void process_and_validate(bool backend2_enable, bool panic)
{ if (!panic) { flush_log(); } mock_log_frontend_validate(panic); if (NO_BACKENDS) { int cnt; STRUCT_SECTION_COUNT(log_backend, &cnt); zassert_equal(cnt, 0); return; } if (IS_ENABLED(CONFIG_LOG_FRONTEND_ONLY)) { return; } mock_log_backend_validate(&backend1, panic); if (backend2_enable) { mock_log_backend_validate(&backend2, panic); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Disables asynchronous callback generation for a given type. Disables asynchronous callbacks for a given callback type. */
enum status_code wdt_disable_callback(const enum wdt_callback type)
/* Disables asynchronous callback generation for a given type. Disables asynchronous callbacks for a given callback type. */ enum status_code wdt_disable_callback(const enum wdt_callback type)
{ Wdt *const WDT_module = WDT; switch (type) { case WDT_CALLBACK_EARLY_WARNING: WDT_module->INTENCLR.reg = WDT_INTENCLR_EW; return STATUS_OK; default: Assert(false); return STATUS_ERR_INVALID_ARG; } }
memfault/zero-to-main
C++
null
200
/* Allocate a new netlink message and inherit netlink message header */
struct nl_msg* nlmsg_inherit(struct nlmsghdr *hdr)
/* Allocate a new netlink message and inherit netlink message header */ struct nl_msg* nlmsg_inherit(struct nlmsghdr *hdr)
{ struct nl_msg *nm; nm = nlmsg_alloc(); if (nm && hdr) { struct nlmsghdr *new = nm->nm_nlh; new->nlmsg_type = hdr->nlmsg_type; new->nlmsg_flags = hdr->nlmsg_flags; new->nlmsg_seq = hdr->nlmsg_seq; new->nlmsg_pid = hdr->nlmsg_pid; } return nm; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Perform the encrypt/decrypt operation (can use it for either since this is a stream cipher). NOTE: *msg and *out must be the same pointer (performance tweak) */
void ICACHE_FLASH_ATTR RC4_crypt(RC4_CTX *ctx, const uint8_t *msg, uint8_t *out, int length)
/* Perform the encrypt/decrypt operation (can use it for either since this is a stream cipher). NOTE: *msg and *out must be the same pointer (performance tweak) */ void ICACHE_FLASH_ATTR RC4_crypt(RC4_CTX *ctx, const uint8_t *msg, uint8_t *out, int length)
{ int i; uint8_t *m, x, y, a, b; x = ctx->x; y = ctx->y; m = ctx->m; for (i = 0; i < length; i++) { a = m[++x]; y += a; m[x] = b = m[y]; m[y] = a; out[i] ^= m[(uint8_t)(a + b)]; } ctx->x = x; ctx->y = y; }
eerimoq/simba
C++
Other
337
/* param base LPSPI peripheral address. param handle pointer to lpspi_slave_handle_t structure which stores the transfer state. */
void LPSPI_SlaveTransferAbort(LPSPI_Type *base, lpspi_slave_handle_t *handle)
/* param base LPSPI peripheral address. param handle pointer to lpspi_slave_handle_t structure which stores the transfer state. */ void LPSPI_SlaveTransferAbort(LPSPI_Type *base, lpspi_slave_handle_t *handle)
{ assert(handle); LPSPI_DisableInterrupts(base, kLPSPI_TxInterruptEnable | kLPSPI_RxInterruptEnable); LPSPI_Reset(base); handle->state = kLPSPI_Idle; handle->txRemainingByteCount = 0; handle->rxRemainingByteCount = 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* SD MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd)
/* SD MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd)
{ if(hsd->Instance==SDMMC1) { __HAL_RCC_SDMMC1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_12|GPIO_PIN_11|GPIO_PIN_10|GPIO_PIN_9 |GPIO_PIN_8); HAL_GPIO_DeInit(GPIOD, GPIO_PIN_2); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads the current configuration and output settings for the DAC. */
void mcp4725ReadConfig(uint8_t *status, uint16_t *value)
/* Reads the current configuration and output settings for the DAC. */ void mcp4725ReadConfig(uint8_t *status, uint16_t *value)
{ if (!_mcp4725Initialised) mcp4725Init(); uint32_t i; for ( i = 0; i < I2C_BUFSIZE; i++ ) { I2CMasterBuffer[i] = 0x00; } I2CWriteLength = 1; I2CReadLength = 3; I2CMasterBuffer[0] = MCP4725_ADDRESS | MCP4725_READ; i2cEngine(); *status = I2CSlaveBuffer[0]; *value = ((I2CSlaveBuffer[1] << 4) | (I2CSlaveBuffer[2] >> 4)); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* activate_task - move a task to the runqueue. */
static void activate_task(struct rq *rq, struct task_struct *p, int wakeup)
/* activate_task - move a task to the runqueue. */ static void activate_task(struct rq *rq, struct task_struct *p, int wakeup)
{ if (task_contributes_to_load(p)) rq->nr_uninterruptible--; enqueue_task(rq, p, wakeup); inc_nr_running(rq); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function is called when user wants to accept a connection being established. */
static int winc1500_accept(struct net_context *context, net_tcp_accept_cb_t cb, int32_t timeout, void *user_data)
/* This function is called when user wants to accept a connection being established. */ static int winc1500_accept(struct net_context *context, net_tcp_accept_cb_t cb, int32_t timeout, void *user_data)
{ SOCKET socket = (int)context->offload_context; int ret; w1500_data.socket_data[socket].accept_cb = cb; w1500_data.socket_data[socket].accept_user_data = user_data; ret = accept(socket, NULL, 0); if (ret) { LOG_ERR("accept error %d %s!", ret, socket_error_string(ret)); return ret; } if (timeout) { if (k_sem_take(&w1500_data.socket_data[socket].wait_sem, K_MSEC(timeout))) { return -ETIMEDOUT; } } return w1500_data.socket_data[socket].ret_code; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* update the given register with and/or mask and save the data to the cache */
static int wm8776_write_bits(struct snd_ice1712 *ice, struct snd_wm8776 *wm, unsigned char reg, unsigned short mask, unsigned short val)
/* update the given register with and/or mask and save the data to the cache */ static int wm8776_write_bits(struct snd_ice1712 *ice, struct snd_wm8776 *wm, unsigned char reg, unsigned short mask, unsigned short val)
{ val |= wm->regs[reg] & ~mask; if (val != wm->regs[reg]) { wm8776_write(ice, wm, reg, val); return 1; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* The function masks all msix interrupt for the given vpath */
void vxge_hw_vpath_msix_mask_all(struct __vxge_hw_vpath_handle *vp)
/* The function masks all msix interrupt for the given vpath */ void vxge_hw_vpath_msix_mask_all(struct __vxge_hw_vpath_handle *vp)
{ __vxge_hw_pio_mem_write32_upper( (u32)vxge_bVALn(vxge_mBIT(vp->vpath->vp_id), 0, 32), &vp->vpath->hldev->common_reg->set_msix_mask_all_vect); return; }
robutest/uclinux
C++
GPL-2.0
60
/* Initializes the tim Channel5 according to the specified parameters in the init_struct. */
void TIM_OC5Init(TIM_TypeDef *tim, TIM_OCInitTypeDef *init_struct)
/* Initializes the tim Channel5 according to the specified parameters in the init_struct. */ void TIM_OC5Init(TIM_TypeDef *tim, TIM_OCInitTypeDef *init_struct)
{ MODIFY_REG(tim->CCMR3, TIM_CCMR3_OC5M, (init_struct->TIM_OCMode) << 4); MODIFY_REG(tim->CCER, TIM_CCER_CC5EN | TIM_CCER_CC5P, (init_struct->TIM_OCPolarity << 16) | (init_struct->TIM_OutputState << 16)); WRITE_REG(tim->CCR4, init_struct->TIM_Pulse); if ((tim == TIM1) || (tim == TIM8)) MODIFY_REG(tim->CR2, TIM_CR2_OIS5, init_struct->TIM_OCIdleState << 8); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the number of uart receive data intterupt trigger. @method UART_SetRxITNum */
void UART_SetRxITNum(UART_TypeDef *UARTx, uint8_t Bcnt)
/* Set the number of uart receive data intterupt trigger. @method UART_SetRxITNum */ void UART_SetRxITNum(UART_TypeDef *UARTx, uint8_t Bcnt)
{ _ASSERT(IS_UART(UARTx)); UARTx->RX_INT_LEN.reg = Bcnt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Shift the entire display n unit to the left. */
void SPLC780DisplayLeftShift(unsigned char n)
/* Shift the entire display n unit to the left. */ void SPLC780DisplayLeftShift(unsigned char n)
{ int i = n; while(i--) { while(SPLC780Busy()); SPLC780WriteCmd(SPLC780_CMD_CURSOR_DISPLAY_SHIFT( SPLC780_CURSOR_DISPLAY_SHIFT_SC_S | SPLC780_CURSOR_DISPLAY_SHIFT_RL_L)); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI S3PciBitFieldWrite8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 Value)
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT8 EFIAPI S3PciBitFieldWrite8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 Value)
{ return InternalSavePciWrite8ValueToBootScript (Address, PciBitFieldWrite8 (Address, StartBit, EndBit, Value)); }
tianocore/edk2
C++
Other
4,240
/* Count the number of directories in a file. */
uint16 TIFFNumberOfDirectories(TIFF *tif)
/* Count the number of directories in a file. */ uint16 TIFFNumberOfDirectories(TIFF *tif)
{ static const char module[] = "TIFFNumberOfDirectories"; uint64 nextdir; uint16 n; if (!(tif->tif_flags&TIFF_BIGTIFF)) nextdir = tif->tif_header.classic.tiff_diroff; else nextdir = tif->tif_header.big.tiff_diroff; n = 0; while (nextdir != 0 && TIFFAdvanceDirectory(tif, &nextdir, NULL)) { if (n != 65535) { ++n; } else { TIFFErrorExt(tif->tif_clientdata, module, "Directory count exceeded 65535 limit," " giving up on counting."); return (65535); } } return (n); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function takes a given start page (page aligned user virtual address) and pins it and the following specified number of pages. For now, num_pages is always 1, but that will probably change at some point (because caller is doing expected sends on a single virtually contiguous buffer, so we can do all pages at once). */
int ipath_get_user_pages(unsigned long start_page, size_t num_pages, struct page **p)
/* This function takes a given start page (page aligned user virtual address) and pins it and the following specified number of pages. For now, num_pages is always 1, but that will probably change at some point (because caller is doing expected sends on a single virtually contiguous buffer, so we can do all pages at once). */ int ipath_get_user_pages(unsigned long start_page, size_t num_pages, struct page **p)
{ int ret; down_write(&current->mm->mmap_sem); ret = __get_user_pages(start_page, num_pages, p, NULL); up_write(&current->mm->mmap_sem); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* applesmc_read_motion_sensor - Read motion sensor (X, Y or Z). Callers must hold applesmc_lock. */
static int applesmc_read_motion_sensor(int index, s16 *value)
/* applesmc_read_motion_sensor - Read motion sensor (X, Y or Z). Callers must hold applesmc_lock. */ static int applesmc_read_motion_sensor(int index, s16 *value)
{ u8 buffer[2]; int ret; switch (index) { case SENSOR_X: ret = applesmc_read_key(MOTION_SENSOR_X_KEY, buffer, 2); break; case SENSOR_Y: ret = applesmc_read_key(MOTION_SENSOR_Y_KEY, buffer, 2); break; case SENSOR_Z: ret = applesmc_read_key(MOTION_SENSOR_Z_KEY, buffer, 2); break; default: ret = -EINVAL; } *value = ((s16)buffer[0] << 8) | buffer[1]; return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the External High Speed oscillator (HSE). HSE can not be stopped if it is used directly or through the PLL as system clock. */
void RCC_HSEConfig(uint32_t RCC_HSE)
/* Configures the External High Speed oscillator (HSE). HSE can not be stopped if it is used directly or through the PLL as system clock. */ void RCC_HSEConfig(uint32_t RCC_HSE)
{ assert_param(IS_RCC_HSE(RCC_HSE)); RCC->CR &= CR_HSEON_Reset; RCC->CR &= CR_HSEBYP_Reset; switch(RCC_HSE) { case RCC_HSE_ON: RCC->CR |= CR_HSEON_Set; break; case RCC_HSE_Bypass: RCC->CR |= CR_HSEBYP_Set | CR_HSEON_Set; break; default: break; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535