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
/* Get Connection Information. This funtions is used to get the information about the current connection. */
void adi_ble_GetConnectionInfo(ADI_BLER_CONN_INFO *pConnectionInfo)
/* Get Connection Information. This funtions is used to get the information about the current connection. */ void adi_ble_GetConnectionInfo(ADI_BLER_CONN_INFO *pConnectionInfo)
{ ASSERT(pConnectionInfo != NULL); memcpy(pConnectionInfo, &pBLERadio->eBleConnInfo, sizeof(ADI_BLER_CONN_INFO)); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Linear acceleration output register. The value is expressed as a 16-bit word in two’s complement.. */
int32_t lsm6dso_acceleration_raw_get(lsm6dso_ctx_t *ctx, uint8_t *buff)
/* Linear acceleration output register. The value is expressed as a 16-bit word in two’s complement.. */ int32_t lsm6dso_acceleration_raw_get(lsm6dso_ctx_t *ctx, uint8_t *buff)
{ int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_OUTX_L_A, buff, 6); return ret; }
alexander-g-dean/ESF
C++
null
41
/* Locking note: Must be called with skt_mutex held! */
static int pcmcia_nonstatic_validate_mem(struct pcmcia_socket *s)
/* Locking note: Must be called with skt_mutex held! */ static int pcmcia_nonstatic_validate_mem(struct pcmcia_socket *s)
{ struct socket_data *s_data = s->resource_data; unsigned int probe_mask = MEM_PROBE_LOW; int ret = 0; if (!probe_mem) return 0; mutex_lock(&rsrc_mutex); if (s->features & SS_CAP_PAGE_REGS) probe_mask = MEM_PROBE_HIGH; if (probe_mask & ~s_data->rsrc_mem_probe) { if (s->state & SOCKET_PRESENT) ret = validate_mem(s, probe_mask); if (!ret) s_data->rsrc_mem_probe |= probe_mask; } mutex_unlock(&rsrc_mutex); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* DAC Channel Enable. Enable a digital to analog converter channel. After setting this enable, the DAC requires a t */
void dac_enable(data_channel dac_channel)
/* DAC Channel Enable. Enable a digital to analog converter channel. After setting this enable, the DAC requires a t */ void dac_enable(data_channel dac_channel)
{ switch (dac_channel) { case CHANNEL_1: DAC_CR |= DAC_CR_EN1; break; case CHANNEL_2: DAC_CR |= DAC_CR_EN2; break; case CHANNEL_D: DAC_CR |= (DAC_CR_EN1 | DAC_CR_EN2); break; } }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Verify that this device can be reprovisioned after resets. */
static void test_device_pb_adv_reprovision(void)
/* Verify that this device can be reprovisioned after resets. */ static void test_device_pb_adv_reprovision(void)
{ k_sem_init(&prov_sem, 0, 1); bt_mesh_device_setup(&prov, &comp); ASSERT_OK(bt_mesh_prov_enable(BT_MESH_PROV_ADV)); LOG_INF("Mesh initialized\n"); for (int i = 0; i < PROV_REPROV_COUNT; i++) { LOG_INF("Dev prov loop #%d, waiting for prov ...\n", i); ASSERT_OK(k_sem_take(&prov_sem, K_SECONDS(20))); } PASS(); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Stops the TIMER Input Capture measurement in interrupt mode. */
void ald_timer_ic_stop_by_it(ald_timer_handle_t *hperh, ald_timer_channel_t ch)
/* Stops the TIMER Input Capture measurement in interrupt mode. */ void ald_timer_ic_stop_by_it(ald_timer_handle_t *hperh, ald_timer_channel_t ch)
{ assert_param(IS_TIMER_CCX_INSTANCE(hperh->perh, ch)); switch (ch) { case ALD_TIMER_CHANNEL_1: ald_timer_interrupt_config(hperh, ALD_TIMER_IT_CC1, DISABLE); break; case ALD_TIMER_CHANNEL_2: ald_timer_interrupt_config(hperh, ALD_TIMER_IT_CC2, DISABLE); break; case ALD_TIMER_CHANNEL_3: ald_timer_interrupt_config(hperh, ALD_TIMER_IT_CC3, DISABLE); break; case ALD_TIMER_CHANNEL_4: ald_timer_interrupt_config(hperh, ALD_TIMER_IT_CC4, DISABLE); break; default: break; } timer_ccx_channel_cmd(hperh->perh, ch, DISABLE); ALD_TIMER_DISABLE(hperh); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* __vxge_hw_kdfc_swapper_set - Set the swapper bits for the kdfc. Set the swapper bits appropriately for the vpath. */
enum vxge_hw_status __vxge_hw_kdfc_swapper_set(struct vxge_hw_legacy_reg __iomem *legacy_reg, struct vxge_hw_vpath_reg __iomem *vpath_reg)
/* __vxge_hw_kdfc_swapper_set - Set the swapper bits for the kdfc. Set the swapper bits appropriately for the vpath. */ enum vxge_hw_status __vxge_hw_kdfc_swapper_set(struct vxge_hw_legacy_reg __iomem *legacy_reg, struct vxge_hw_vpath_reg __iomem *vpath_reg)
{ u64 val64; val64 = readq(&legacy_reg->pifm_wr_swap_en); if (val64 == VXGE_HW_SWAPPER_WRITE_BYTE_SWAP_ENABLE) { val64 = readq(&vpath_reg->kdfcctl_cfg0); wmb(); val64 |= VXGE_HW_KDFCCTL_CFG0_BYTE_SWAPEN_FIFO0 | VXGE_HW_KDFCCTL_CFG0_BYTE_SWAPEN_FIFO1 | VXGE_HW_KDFCCTL_CFG0_BYTE_SWAPEN_FIFO2; writeq(val64, &vpath_reg->kdfcctl_cfg0); wmb(); } return VXGE_HW_OK; }
robutest/uclinux
C++
GPL-2.0
60
/* device attribute for save operation on current copy of the segment. If the segment is busy, saving will become pending until it gets released, which can be undone by storing a non-true value to this entry. (show + store) */
static ssize_t dcssblk_save_show(struct device *dev, struct device_attribute *attr, char *buf)
/* device attribute for save operation on current copy of the segment. If the segment is busy, saving will become pending until it gets released, which can be undone by storing a non-true value to this entry. (show + store) */ static ssize_t dcssblk_save_show(struct device *dev, struct device_attribute *attr, char *buf)
{ struct dcssblk_dev_info *dev_info; dev_info = container_of(dev, struct dcssblk_dev_info, dev); return sprintf(buf, dev_info->save_pending ? "1\n" : "0\n"); }
robutest/uclinux
C++
GPL-2.0
60
/* Return: The next state machine state to advance to */
static int training_state_adjust_link_rate(struct udevice *dev)
/* Return: The next state machine state to advance to */ static int training_state_adjust_link_rate(struct udevice *dev)
{ struct dp_tx *dp_tx = dev_get_priv(dev); int status; switch (dp_tx->link_config.link_rate) { case LINK_BW_SET_540GBPS: status = set_link_rate(dev, LINK_BW_SET_270GBPS); if (status) { status = TS_FAILURE; break; } status = TS_CLOCK_RECOVERY; break; case LINK_BW_SET_270GBPS: status = set_link_rate(dev, LINK_BW_SET_162GBPS); if (status) { status = TS_FAILURE; break; } status = TS_CLOCK_RECOVERY; break; default: status = TS_ADJUST_LANE_COUNT; break; } return status; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Calculate volume parameter byte for a given volume. */
static unsigned char volume_to_hw(int volume_percent)
/* Calculate volume parameter byte for a given volume. */ static unsigned char volume_to_hw(int volume_percent)
{ unsigned char ret = 0; if (volume_percent < 0) volume_percent = 0; if (volume_percent > 100) volume_percent = 100; if (volume_percent >= 0) ret = 7; if (volume_percent >= 13) ret = 6; if (volume_percent >= 25) ret = 5; if (volume_percent >= 38) ret = 4; if (volume_percent >= 50) ret = 3; if (volume_percent >= 63) ret = 2; if (volume_percent >= 75) ret = 1; if (volume_percent >= 88) ret = 0; ret |= 0x80; return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* RETURNS: Pointer to allocated memory on success, NULL on failure. */
void* dmam_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp)
/* RETURNS: Pointer to allocated memory on success, NULL on failure. */ void* dmam_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp)
{ struct dma_devres *dr; void *vaddr; dr = devres_alloc(dmam_coherent_release, sizeof(*dr), gfp); if (!dr) return NULL; vaddr = dma_alloc_coherent(dev, size, dma_handle, gfp); if (!vaddr) { devres_free(dr); return NULL; } dr->vaddr = vaddr; dr->dma_handle = *dma_handle; dr->size = size; devres_add(dev, dr); return vaddr; }
robutest/uclinux
C++
GPL-2.0
60
/* Get a pointer to the window attribute struct. This function returns a pointer to the internal attribute struct of a window. It cannot be modified, but could be copied from. */
const struct win_attributes* win_get_attributes(const struct win_window *win)
/* Get a pointer to the window attribute struct. This function returns a pointer to the internal attribute struct of a window. It cannot be modified, but could be copied from. */ const struct win_attributes* win_get_attributes(const struct win_window *win)
{ Assert(win != NULL); return &win->attributes; }
memfault/zero-to-main
C++
null
200
/* This function retrieves the period of timer interrupts in 100 ns units, returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is returned, then the timer is currently disabled. */
STATIC EFI_STATUS EFIAPI SP805GetTimerPeriod(IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, OUT UINT64 *TimerPeriod)
/* This function retrieves the period of timer interrupts in 100 ns units, returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is returned, then the timer is currently disabled. */ STATIC EFI_STATUS EFIAPI SP805GetTimerPeriod(IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, OUT UINT64 *TimerPeriod)
{ if (TimerPeriod == NULL) { return EFI_INVALID_PARAMETER; } *TimerPeriod = mTimerPeriod; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Handle a fault on the vmalloc or module mapping area */
static noinline int vmalloc_fault(unsigned long address)
/* Handle a fault on the vmalloc or module mapping area */ static noinline int vmalloc_fault(unsigned long address)
{ pgd_t *pgd_k; pmd_t *pmd_k; pte_t *pte_k; if (!(address >= VMALLOC_START && address < P3_ADDR_MAX)) return -1; pgd_k = get_TTB(); pmd_k = vmalloc_sync_one(pgd_k, address); if (!pmd_k) return -1; pte_k = pte_offset_kernel(pmd_k, address); if (!pte_present(*pte_k)) return -1; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Handle complete OUT transfer on EP0. Handles the OUT packet based on the state of endpoint 0. Starts a new read for new SETUP packets, when in OUT_STATUS. When endpoint 0 is in OUT_DATA state, it handles the received data and starts a write transaction for IN_STATUS. */
void USBD_HandleEP0_OUT()
/* Handle complete OUT transfer on EP0. Handles the OUT packet based on the state of endpoint 0. Starts a new read for new SETUP packets, when in OUT_STATUS. When endpoint 0 is in OUT_DATA state, it handles the received data and starts a write transaction for IN_STATUS. */ void USBD_HandleEP0_OUT()
{ USB_Device_ProcessControlRequest(); device.Driver->EndpointWrite(ENDPOINT_DIR_MASK & 0,0,0); device.EP0_State = IN_STATUS; } if (device.EP0_State == OUT_STATUS) { device.Driver->EndpointReadStart(device.Endpoints[0].Address,24); device.EP0_State = IDLE; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Read from a SSD2828 hardware register (regnum >= 0xB0) */
static u32 read_hw_register(const struct ssd2828_config *cfg, u8 regnum)
/* Read from a SSD2828 hardware register (regnum >= 0xB0) */ static u32 read_hw_register(const struct ssd2828_config *cfg, u8 regnum)
{ soft_spi_xfer_24bit_3wire(cfg, 0x700000 | regnum); return soft_spi_xfer_24bit_3wire(cfg, 0x730000); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Deactivate immediately Single wire protocol bus (immediate transition to DEACTIVATED state) @rmtoll CR SWPACT LL_SWPMI_Deactivate. */
void LL_SWPMI_Deactivate(SWPMI_TypeDef *SWPMIx)
/* Deactivate immediately Single wire protocol bus (immediate transition to DEACTIVATED state) @rmtoll CR SWPACT LL_SWPMI_Deactivate. */ void LL_SWPMI_Deactivate(SWPMI_TypeDef *SWPMIx)
{ CLEAR_BIT(SWPMIx->CR, SWPMI_CR_SWPACT); }
remotemcu/remcu-chip-sdks
C++
null
436
/* PCI_EXT_CAP_ID_ERR Advanced Error Reporting PCI_EXT_CAP_ID_VC Virtual Channel PCI_EXT_CAP_ID_DSN Device Serial Number PCI_EXT_CAP_ID_PWR Power Budgeting */
int pci_find_ext_capability(struct pci_dev *dev, int cap)
/* PCI_EXT_CAP_ID_ERR Advanced Error Reporting PCI_EXT_CAP_ID_VC Virtual Channel PCI_EXT_CAP_ID_DSN Device Serial Number PCI_EXT_CAP_ID_PWR Power Budgeting */ int pci_find_ext_capability(struct pci_dev *dev, int cap)
{ u32 header; int ttl; int pos = PCI_CFG_SPACE_SIZE; ttl = (PCI_CFG_SPACE_EXP_SIZE - PCI_CFG_SPACE_SIZE) / 8; if (dev->cfg_size <= PCI_CFG_SPACE_SIZE) return 0; if (pci_read_config_dword(dev, pos, &header) != PCIBIOS_SUCCESSFUL) return 0; if (header == 0) return 0; while (ttl-- > 0) { if (PCI_EXT_CAP_ID(header) == cap) return pos; pos = PCI_EXT_CAP_NEXT(header); if (pos < PCI_CFG_SPACE_SIZE) break; if (pci_read_config_dword(dev, pos, &header) != PCIBIOS_SUCCESSFUL) break; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Fills in a level of the btree based on the highs of the level below it. */
static int setup_btree_index(unsigned int l, struct dm_table *t)
/* Fills in a level of the btree based on the highs of the level below it. */ static int setup_btree_index(unsigned int l, struct dm_table *t)
{ unsigned int n, k; sector_t *node; for (n = 0U; n < t->counts[l]; n++) { node = get_node(t, l, n); for (k = 0U; k < KEYS_PER_NODE; k++) node[k] = high(t, l + 1, get_child(n, k)); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* param base FLEXSPI peripheral base address. param handle pointer to flexspi_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. retval kStatus_InvalidArgument count is Invalid. retval kStatus_Success Successfully return the count. */
status_t FLEXSPI_TransferGetCount(FLEXSPI_Type *base, flexspi_handle_t *handle, size_t *count)
/* param base FLEXSPI peripheral base address. param handle pointer to flexspi_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. retval kStatus_InvalidArgument count is Invalid. retval kStatus_Success Successfully return the count. */ status_t FLEXSPI_TransferGetCount(FLEXSPI_Type *base, flexspi_handle_t *handle, size_t *count)
{ assert(handle); status_t result = kStatus_Success; if (handle->state == kFLEXSPI_Idle) { result = kStatus_NoTransferInProgress; } else { *count = handle->transferTotalSize - handle->dataSize; } return result; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* creates a new string and anchors it in function's table so that it will not be collected until the end of the function's compilation (by that time it should be anchored in function's prototype) */
TString* luaX_newstring(LexState *ls, const char *str, size_t l)
/* creates a new string and anchors it in function's table so that it will not be collected until the end of the function's compilation (by that time it should be anchored in function's prototype) */ TString* luaX_newstring(LexState *ls, const char *str, size_t l)
{ setbvalue(o, 1); luaC_checkGC(L); } L->top--; return ts; }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* Find the handler for the prefix and dispatch its set() operation. */
int generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags)
/* Find the handler for the prefix and dispatch its set() operation. */ int generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags)
{ struct xattr_handler *handler; if (size == 0) value = ""; handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); if (!handler) return -EOPNOTSUPP; return handler->set(dentry, name, value, size, 0, handler->flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Mark the end of PATH TOV handling. All pending IOs are already cleaned up. */
void bfa_cb_itnim_tov(void *cb_arg)
/* Mark the end of PATH TOV handling. All pending IOs are already cleaned up. */ void bfa_cb_itnim_tov(void *cb_arg)
{ struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *)cb_arg; bfa_trc(itnim->fcs, itnim->rport->pwwn); bfa_fcb_itnim_tov(itnim->itnim_drv); }
robutest/uclinux
C++
GPL-2.0
60
/* We don't use supersection mappings for mmap() on /dev/mem, which means that we can't map the memory area above the 4G barrier into userspace. */
int valid_mmap_phys_addr_range(unsigned long pfn, size_t size)
/* We don't use supersection mappings for mmap() on /dev/mem, which means that we can't map the memory area above the 4G barrier into userspace. */ int valid_mmap_phys_addr_range(unsigned long pfn, size_t size)
{ return !(pfn + (size >> PAGE_SHIFT) > 0x00100000); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* serport_ldisc_ioctl() allows to set the port protocol, and device ID */
static int serport_ldisc_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg)
/* serport_ldisc_ioctl() allows to set the port protocol, and device ID */ static int serport_ldisc_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg)
{ struct serport *serport = (struct serport*) tty->disc_data; unsigned long type; if (cmd == SPIOCSTYPE) { if (get_user(type, (unsigned long __user *) arg)) return -EFAULT; serport->id.proto = type & 0x000000ff; serport->id.id = (type & 0x0000ff00) >> 8; serport->id.extra = (type & 0x00ff0000) >> 16; return 0; } return -EINVAL; }
robutest/uclinux
C++
GPL-2.0
60
/* ADC Enable The Temperature Sensor. This enables both the sensor and the reference voltage measurements on channels 16 and 17. These are only available on ADC1 channel 16 and 17 respectively. */
void adc_enable_temperature_sensor()
/* ADC Enable The Temperature Sensor. This enables both the sensor and the reference voltage measurements on channels 16 and 17. These are only available on ADC1 channel 16 and 17 respectively. */ void adc_enable_temperature_sensor()
{ ADC_CCR |= ADC_CCR_TSVREFE; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Verify that the segment is in good shape. */
INTN TcpVerifySegment(IN NET_BUF *Nbuf)
/* Verify that the segment is in good shape. */ INTN TcpVerifySegment(IN NET_BUF *Nbuf)
{ TCP_HEAD *Head; TCP_SEG *Seg; UINT32 Len; if (Nbuf == NULL) { return 1; } NET_CHECK_SIGNATURE (Nbuf, NET_BUF_SIGNATURE); Seg = TCPSEG_NETBUF (Nbuf); Len = Nbuf->TotalSize; Head = Nbuf->Tcp; if (Head != NULL) { if (Head->Flag != Seg->Flag) { return 0; } Len -= (Head->HeadLen << 2); } if (TCP_FLG_ON (Seg->Flag, TCP_FLG_SYN)) { Len++; } if (TCP_FLG_ON (Seg->Flag, TCP_FLG_FIN)) { Len++; } if (Seg->Seq + Len != Seg->End) { return 0; } return 1; }
tianocore/edk2
C++
Other
4,240
/* The open funcion. This is mostly needed to keep refcounting, but also to support media checks on removable media drives. */
static int ub_bd_open(struct block_device *bdev, fmode_t mode)
/* The open funcion. This is mostly needed to keep refcounting, but also to support media checks on removable media drives. */ static int ub_bd_open(struct block_device *bdev, fmode_t mode)
{ struct ub_lun *lun = bdev->bd_disk->private_data; struct ub_dev *sc = lun->udev; unsigned long flags; int rc; spin_lock_irqsave(&ub_lock, flags); if (atomic_read(&sc->poison)) { spin_unlock_irqrestore(&ub_lock, flags); return -ENXIO; } sc->openc++; spin_unlock_irqrestore(&ub_lock, flags); if (lun->removable || lun->readonly) check_disk_change(bdev); if (lun->removable && lun->changed && !(mode & FMODE_NDELAY)) { rc = -ENOMEDIUM; goto err_open; } if (lun->readonly && (mode & FMODE_WRITE)) { rc = -EROFS; goto err_open; } return 0; err_open: ub_put(sc); return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* Return value: index into cmd_status / -EINVAL on failure */
static int ibmvfc_get_err_index(u16 status, u16 error)
/* Return value: index into cmd_status / -EINVAL on failure */ static int ibmvfc_get_err_index(u16 status, u16 error)
{ int i; for (i = 0; i < ARRAY_SIZE(cmd_status); i++) if ((cmd_status[i].status & status) == cmd_status[i].status && cmd_status[i].error == error) return i; return -EINVAL; }
robutest/uclinux
C++
GPL-2.0
60
/* Given an ucsA string, this function returns the size (in bytes) this string would have occupied if it was encoded in utf-8. */
enum CRStatus cr_utils_ucs1_str_len_as_utf8(const guchar *a_in_start, const guchar *a_in_end, gulong *a_len)
/* Given an ucsA string, this function returns the size (in bytes) this string would have occupied if it was encoded in utf-8. */ enum CRStatus cr_utils_ucs1_str_len_as_utf8(const guchar *a_in_start, const guchar *a_in_end, gulong *a_len)
{ gint len = 0; guchar *char_ptr = NULL; g_return_val_if_fail (a_in_start && a_in_end && a_len, CR_BAD_PARAM_ERROR); for (char_ptr = (guchar *) a_in_start; char_ptr <= a_in_end; char_ptr++) { if (*char_ptr <= 0x7F) { len += 1; } else { len += 2; } } *a_len = len; return CR_OK; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set Dualtimer module timer1/timer2 enable. Enable the Dualtimer module timer1/timer2 */
void dualtimer_enable(enum dualtimer_timer timer)
/* Set Dualtimer module timer1/timer2 enable. Enable the Dualtimer module timer1/timer2 */ void dualtimer_enable(enum dualtimer_timer timer)
{ if (timer == DUALTIMER_TIMER1) { DUALTIMER0->TIMER1CONTROL.reg |= DUALTIMER_TIMER1CONTROL_TIMER_ENABLE; } else { DUALTIMER0->TIMER2CONTROL.reg |= DUALTIMER_TIMER2CONTROL_TIMER_ENABLE; } }
memfault/zero-to-main
C++
null
200
/* Reads the PS measurement data from the Si1147. */
static void readPSData(HANDLE si114x_handle, Si114x_Sample_TypeDef *sample)
/* Reads the PS measurement data from the Si1147. */ static void readPSData(HANDLE si114x_handle, Si114x_Sample_TypeDef *sample)
{ sample->ps1 = Si114xReadFromRegister(si114x_handle, REG_PS1_DATA0); sample->ps1 |= Si114xReadFromRegister(si114x_handle, REG_PS1_DATA1) << 8; sample->ps2 = Si114xReadFromRegister(si114x_handle, REG_PS2_DATA0); sample->ps2 |= Si114xReadFromRegister(si114x_handle, REG_PS2_DATA1) << 8; sample->ps3 = Si114xReadFromRegister(si114x_handle, REG_PS3_DATA0); sample->ps3 |= Si114xReadFromRegister(si114x_handle, REG_PS3_DATA1) << 8; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Check the status of the selected IO interrupt pending bit. */
uint32_t mfxstm32l152_IO_ITStatus(uint16_t DeviceAddr, uint32_t IO_Pin)
/* Check the status of the selected IO interrupt pending bit. */ uint32_t mfxstm32l152_IO_ITStatus(uint16_t DeviceAddr, uint32_t IO_Pin)
{ uint8_t tmp1 = 0; uint16_t tmp2 = 0; uint32_t tmp3 = 0; if(IO_Pin & 0xFF) { tmp1 = MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_GPI_PENDING1); } if(IO_Pin & 0xFFFF00) { tmp2 = (uint16_t) MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_GPI_PENDING2); } if(IO_Pin & 0xFFFF0000) { tmp3 = (uint32_t) MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_GPI_PENDING3); } tmp3 = tmp1 + (tmp2 << 8) + (tmp3 << 16); return(tmp3 & IO_Pin); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return - The descriptor allocated. NULL for failed. */
static struct fsl_desc_sw* fsl_dma_alloc_descriptor(struct fsl_dma_chan *fsl_chan)
/* Return - The descriptor allocated. NULL for failed. */ static struct fsl_desc_sw* fsl_dma_alloc_descriptor(struct fsl_dma_chan *fsl_chan)
{ dma_addr_t pdesc; struct fsl_desc_sw *desc_sw; desc_sw = dma_pool_alloc(fsl_chan->desc_pool, GFP_ATOMIC, &pdesc); if (desc_sw) { memset(desc_sw, 0, sizeof(struct fsl_desc_sw)); INIT_LIST_HEAD(&desc_sw->tx_list); dma_async_tx_descriptor_init(&desc_sw->async_tx, &fsl_chan->common); desc_sw->async_tx.tx_submit = fsl_dma_tx_submit; desc_sw->async_tx.phys = pdesc; } return desc_sw; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the coarse grained time at the softirq based on xtime and wall_to_monotonic. */
static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)
/* Get the coarse grained time at the softirq based on xtime and wall_to_monotonic. */ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)
{ ktime_t xtim, tomono; struct timespec xts, tom; unsigned long seq; do { seq = read_seqbegin(&xtime_lock); xts = current_kernel_time(); tom = wall_to_monotonic; } while (read_seqretry(&xtime_lock, seq)); xtim = timespec_to_ktime(xts); tomono = timespec_to_ktime(tom); base->clock_base[CLOCK_REALTIME].softirq_time = xtim; base->clock_base[CLOCK_MONOTONIC].softirq_time = ktime_add(xtim, tomono); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function will init pit for system ticks */
void rt_hw_timer_init()
/* This function will init pit for system ticks */ void rt_hw_timer_init()
{ at91sam926x_pit_init(); rt_hw_interrupt_install(AT91_ID_SYS, rt_timer_handler, RT_NULL, "system"); rt_hw_interrupt_umask(AT91_ID_SYS); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Config the ETH DMA Tx Desc buffer1 and buffer2 sizes. */
void ETH_ConfigDMATxDescBufferSize(ETH_DMADescConfig_T *DMATxDesc, uint32_t bufferSize1, uint32_t bufferSize2)
/* Config the ETH DMA Tx Desc buffer1 and buffer2 sizes. */ void ETH_ConfigDMATxDescBufferSize(ETH_DMADescConfig_T *DMATxDesc, uint32_t bufferSize1, uint32_t bufferSize2)
{ DMATxDesc->ControlBufferSize |= (bufferSize1 | (bufferSize2 << ETH_DMATXDESC_BUFFER2_SIZESHIFT)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* RTC interrupt handler @rtc RTC private data structure */
static irqreturn_t kinetis_rtc_irq(int irq, void *dev_id)
/* RTC interrupt handler @rtc RTC private data structure */ static irqreturn_t kinetis_rtc_irq(int irq, void *dev_id)
{ struct kinetis_rtc *rtc = (struct kinetis_rtc *) dev_id; long unsigned int secs; spin_lock(&rtc->lock); writel(readl(&KINETIS_RTC(rtc)->rtc_ier) & ~KINETIS_RTC_IER_TAIE, &KINETIS_RTC(rtc)->rtc_ier); secs = 0; writel(&secs, &KINETIS_RTC(rtc)->rtc_tar); spin_unlock(&rtc->lock); d_printk(2, "RTC interrupt\n"); return IRQ_HANDLED; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set shake rejection time. Sets the length of time that the gyro must be outside of the threshold set by */
int dmp_set_shake_reject_time(unsigned short time)
/* Set shake rejection time. Sets the length of time that the gyro must be outside of the threshold set by */ int dmp_set_shake_reject_time(unsigned short time)
{ unsigned char tmp[2]; time /= (1000 / DMP_SAMPLE_RATE); tmp[0] = time >> 8; tmp[1] = time & 0xFF; return mpu_write_mem(D_1_90,2,tmp); }
Luos-io/luos_engine
C++
MIT License
496
/* This function is executed in case of error occurrence. */
static void Error_Handler(void)
/* This function is executed in case of error occurrence. */ static void Error_Handler(void)
{ while(1) { BSP_LED_Toggle(LED2); HAL_Delay(1000); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Get the L_STATUS value of a given link tuple */
static iib_link_tuple_status_t get_tuple_status(iib_link_set_entry_t *ls_entry, timex_t *now)
/* Get the L_STATUS value of a given link tuple */ static iib_link_tuple_status_t get_tuple_status(iib_link_set_entry_t *ls_entry, timex_t *now)
{ if (ls_entry->pending) { return IIB_LT_STATUS_PENDING; } else if (ls_entry->lost) { return IIB_LT_STATUS_LOST; } else if (timex_cmp(ls_entry->sym_time, *now) == 1) { return IIB_LT_STATUS_SYM; } else if (timex_cmp(ls_entry->heard_time, *now) == 1) { return IIB_LT_STATUS_HEARD; } return IIB_LT_STATUS_UNKNOWN; }
labapart/polymcu
C++
null
201
/* If the pointer to the HOB list is NULL, then ASSERT(). If Guid is NULL, then ASSERT(). */
VOID* EFIAPI GetFirstGuidHob(IN CONST EFI_GUID *Guid)
/* If the pointer to the HOB list is NULL, then ASSERT(). If Guid is NULL, then ASSERT(). */ VOID* EFIAPI GetFirstGuidHob(IN CONST EFI_GUID *Guid)
{ VOID *HobList; HobList = GetHobList (); return GetNextGuidHob (Guid, HobList); }
tianocore/edk2
C++
Other
4,240
/* For each device we remove, delete the device structure from the device lists, remove the /proc entry, and notify userspace (/sbin/hotplug). */
void pci_remove_bus_device(struct pci_dev *dev)
/* For each device we remove, delete the device structure from the device lists, remove the /proc entry, and notify userspace (/sbin/hotplug). */ void pci_remove_bus_device(struct pci_dev *dev)
{ pci_stop_bus_device(dev); if (dev->subordinate) { struct pci_bus *b = dev->subordinate; pci_remove_behind_bridge(dev); pci_remove_bus(b); dev->subordinate = NULL; } pci_destroy_dev(dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Read an environment variable as a boolean Return -1 if variable does not exist (default to true) */
int env_get_yesno(const char *var)
/* Read an environment variable as a boolean Return -1 if variable does not exist (default to true) */ int env_get_yesno(const char *var)
{ char *s = env_get(var); if (s == NULL) return -1; return (*s == '1' || *s == 'y' || *s == 'Y' || *s == 't' || *s == 'T') ? 1 : 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Command response callback function for sd_ble_gap_connect BLE command. Callback for decoding the output parameters and the command response return code. */
static uint32_t gap_connect_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ble_gap_connect BLE command. Callback for decoding the output parameters and the command response return code. */ static uint32_t gap_connect_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{ uint32_t result_code = 0; const uint32_t err_code = ble_gap_connect_rsp_dec(p_buffer, length, &result_code); APP_ERROR_CHECK(err_code); return result_code; }
labapart/polymcu
C++
null
201
/* On devices that support the VBUS glitch filter, the */
void USBHostPwrConfig(uint32_t ui32Base, uint32_t ui32Flags)
/* On devices that support the VBUS glitch filter, the */ void USBHostPwrConfig(uint32_t ui32Base, uint32_t ui32Flags)
{ ASSERT(ui32Base == USB0_BASE); ASSERT((ui32Flags & ~(USB_HOST_PWREN_FILTER | USB_EPC_PFLTACT_M | USB_EPC_PFLTAEN | USB_EPC_PFLTSEN_HIGH | USB_EPC_EPEN_M)) == 0); HWREG(ui32Base + USB_O_VDC) = ui32Flags >> 16; HWREGH(ui32Base + USB_O_EPC) = (ui32Flags | (HWREGH(ui32Base + USB_O_EPC) & ~(USB_EPC_PFLTACT_M | USB_EPC_PFLTAEN | USB_EPC_PFLTSEN_HIGH | USB_EPC_EPEN_M))); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. */
void FLEXIO_UART_TransferAbortReceive(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle)
/* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. */ void FLEXIO_UART_TransferAbortReceive(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle)
{ if (!handle->rxRingBuffer) { FLEXIO_UART_DisableInterrupts(base, kFLEXIO_UART_RxDataRegFullInterruptEnable); } handle->rxDataSize = 0U; handle->rxState = kFLEXIO_UART_RxIdle; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The netlink_* functions cannot be called inside an irq context, so the audit buffer is placed on a queue and a tasklet is scheduled to remove them from the queue outside the irq context. May be called in any context. */
void audit_log_end(struct audit_buffer *ab)
/* The netlink_* functions cannot be called inside an irq context, so the audit buffer is placed on a queue and a tasklet is scheduled to remove them from the queue outside the irq context. May be called in any context. */ void audit_log_end(struct audit_buffer *ab)
{ if (!ab) return; if (!audit_rate_check()) { audit_log_lost("rate limit exceeded"); } else { struct nlmsghdr *nlh = nlmsg_hdr(ab->skb); nlh->nlmsg_len = ab->skb->len - NLMSG_SPACE(0); if (audit_pid) { skb_queue_tail(&audit_skb_queue, ab->skb); wake_up_interruptible(&kauditd_wait); } else { audit_printk_skb(ab->skb); } ab->skb = NULL; } audit_buffer_free(ab); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check validity of algoritm. This function checks the validity of input argument. */
static status_t dcp_hash_check_input_alg(dcp_hash_algo_t algo)
/* Check validity of algoritm. This function checks the validity of input argument. */ static status_t dcp_hash_check_input_alg(dcp_hash_algo_t algo)
{ if ((algo != kDCP_Sha256) && (algo != kDCP_Sha1) && (algo != kDCP_Crc32)) { return kStatus_InvalidArgument; } return kStatus_Success; }
eclipse-threadx/getting-started
C++
Other
310
/* return SUCCESS if we obtained the mailbox lock */
static s32 igb_obtain_mbx_lock_pf(struct e1000_hw *hw, u16 vf_number)
/* return SUCCESS if we obtained the mailbox lock */ static s32 igb_obtain_mbx_lock_pf(struct e1000_hw *hw, u16 vf_number)
{ s32 ret_val = -E1000_ERR_MBX; u32 p2v_mailbox; wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_PFU); p2v_mailbox = rd32(E1000_P2VMAILBOX(vf_number)); if (p2v_mailbox & E1000_P2VMAILBOX_PFU) ret_val = 0; return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* param base PXP peripheral base address. param config Pointer to the configuration structure. */
void PXP_SetAlphaSurfaceBlendConfig(PXP_Type *base, const pxp_as_blend_config_t *config)
/* param base PXP peripheral base address. param config Pointer to the configuration structure. */ void PXP_SetAlphaSurfaceBlendConfig(PXP_Type *base, const pxp_as_blend_config_t *config)
{ assert(config); uint32_t reg; reg = base->AS_CTRL; reg &= ~(PXP_AS_CTRL_ALPHA0_INVERT_MASK | PXP_AS_CTRL_ROP_MASK | PXP_AS_CTRL_ALPHA_MASK | PXP_AS_CTRL_ALPHA_CTRL_MASK); reg |= (PXP_AS_CTRL_ROP(config->ropMode) | PXP_AS_CTRL_ALPHA(config->alpha) | PXP_AS_CTRL_ALPHA_CTRL(config->alphaMode)); if (config->invertAlpha) { reg |= PXP_AS_CTRL_ALPHA0_INVERT_MASK; } base->AS_CTRL = reg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return if given address is in Flash RWWEE array range. */
static bool _is_valid_rww_flash_address(uint32_t addr)
/* Return if given address is in Flash RWWEE array range. */ static bool _is_valid_rww_flash_address(uint32_t addr)
{ #define RWWEE_ADDR_START NVMCTRL_RWW_EEPROM_ADDR #define RWWEE_ADDR_END (NVMCTRL_RWW_EEPROM_ADDR + NVMCTRL_PAGE_SIZE * NVMCTRL_RWWEE_PAGES) if ((addr < NVMCTRL_RWW_EEPROM_ADDR) || (addr > (NVMCTRL_RWW_EEPROM_ADDR + NVMCTRL_PAGE_SIZE * NVMCTRL_RWWEE_PAGES))) { return false; } return true; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Resume console: If there are cached messages, emit them. */
static void sclp_vt220_resume(void)
/* Resume console: If there are cached messages, emit them. */ static void sclp_vt220_resume(void)
{ unsigned long flags; spin_lock_irqsave(&sclp_vt220_lock, flags); sclp_vt220_suspended = 0; spin_unlock_irqrestore(&sclp_vt220_lock, flags); sclp_vt220_emit_current(); }
robutest/uclinux
C++
GPL-2.0
60
/* Return the data value specified when kthread @task was created. The caller is responsible for ensuring the validity of @task when calling this function. */
void* kthread_data(struct task_struct *task)
/* Return the data value specified when kthread @task was created. The caller is responsible for ensuring the validity of @task when calling this function. */ void* kthread_data(struct task_struct *task)
{ return to_kthread(task)->data; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If Alignment is not a power of two and Alignment is not zero, then ASSERT(). If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). */
VOID* EFIAPI AllocateAlignedPages(IN UINTN Pages, IN UINTN Alignment)
/* If Alignment is not a power of two and Alignment is not zero, then ASSERT(). If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). */ VOID* EFIAPI AllocateAlignedPages(IN UINTN Pages, IN UINTN Alignment)
{ return InternalAllocateAlignedPages (EfiRuntimeServicesData, Pages, Alignment); }
tianocore/edk2
C++
Other
4,240
/* Control Endpoint Process when underflow condition has occurred. */
static void udd_ctrl_underflow(void *pointer)
/* Control Endpoint Process when underflow condition has occurred. */ static void udd_ctrl_underflow(void *pointer)
{ struct usb_endpoint_callback_parameter *ep_callback_para = (struct usb_endpoint_callback_parameter*)pointer; if (UDD_EPCTRL_DATA_OUT == udd_ep_control_state) { udd_ctrl_send_zlp_in(); } else if (UDD_EPCTRL_HANDSHAKE_WAIT_OUT_ZLP == udd_ep_control_state) { usb_device_endpoint_set_halt(&usb_device, ep_callback_para->endpoint_address); } }
memfault/zero-to-main
C++
null
200
/* Returns non-zero if the page was successfully invalidated. */
static int invalidate_complete_page(struct address_space *mapping, struct page *page)
/* Returns non-zero if the page was successfully invalidated. */ static int invalidate_complete_page(struct address_space *mapping, struct page *page)
{ int ret; if (page->mapping != mapping) return 0; if (page_has_private(page) && !try_to_release_page(page, 0)) return 0; clear_page_mlock(page); ret = remove_mapping(mapping, page); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* If Sha384Context is NULL, then return FALSE. If NewSha384Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI Sha384Duplicate(IN CONST VOID *Sha384Context, OUT VOID *NewSha384Context)
/* If Sha384Context is NULL, then return FALSE. If NewSha384Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI Sha384Duplicate(IN CONST VOID *Sha384Context, OUT VOID *NewSha384Context)
{ if ((Sha384Context == NULL) || (NewSha384Context == NULL)) { return FALSE; } mbedtls_sha512_clone (NewSha384Context, Sha384Context); return TRUE; }
tianocore/edk2
C++
Other
4,240
/* Read then Measure and log an EFI boot variable, and extend the measurement result into PCR. */
EFI_STATUS EFIAPI ReadAndMeasureBootVariable(IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, OUT UINTN *VarSize, OUT VOID **VarData)
/* Read then Measure and log an EFI boot variable, and extend the measurement result into PCR. */ EFI_STATUS EFIAPI ReadAndMeasureBootVariable(IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, OUT UINTN *VarSize, OUT VOID **VarData)
{ EFI_STATUS Status; *VarData = ReadVariable (VarName, VendorGuid, VarSize); if (*VarData == NULL) { return EFI_NOT_FOUND; } Status = MeasureVariable ( 5, EV_EFI_VARIABLE_BOOT, VarName, VendorGuid, *VarData, *VarSize ); return Status; }
tianocore/edk2
C++
Other
4,240
/* Approximates the integral which uses the arclength and curvature of the parabola. */
static vg_lite_float_t approx_integral(vg_lite_float_t x)
/* Approximates the integral which uses the arclength and curvature of the parabola. */ static vg_lite_float_t approx_integral(vg_lite_float_t x)
{ const vg_lite_float_t D = 0.67; return x / (1.0 - D + FPOWF(FPOWF(D, 4) + 0.25 * x * x, 0.25)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Put in the log file the RDMA gid addressing information, useful for folks who have trouble understanding the RDMA device hierarchy in the kernel. */
static void qemu_rdma_dump_gid(const char *who, struct rdma_cm_id *id)
/* Put in the log file the RDMA gid addressing information, useful for folks who have trouble understanding the RDMA device hierarchy in the kernel. */ static void qemu_rdma_dump_gid(const char *who, struct rdma_cm_id *id)
{ char sgid[33]; char dgid[33]; inet_ntop(AF_INET6, &id->route.addr.addr.ibaddr.sgid, sgid, sizeof sgid); inet_ntop(AF_INET6, &id->route.addr.addr.ibaddr.dgid, dgid, sizeof dgid); DPRINTF("%s Source GID: %s, Dest GID: %s\n", who, sgid, dgid); }
ve3wwg/teensy3_qemu
C
Other
15
/* Get the peripheral clock speed for the I2C device at base specified. */
uint32_t rcc_get_i2c_clk_freq(uint32_t i2c __attribute__((unused)))
/* Get the peripheral clock speed for the I2C device at base specified. */ uint32_t rcc_get_i2c_clk_freq(uint32_t i2c __attribute__((unused)))
{ return rcc_apb1_frequency; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* This function tags the current thread as essential to system operation. Exceptions raised by this thread will be treated as a fatal system error. */
void z_thread_essential_set(void)
/* This function tags the current thread as essential to system operation. Exceptions raised by this thread will be treated as a fatal system error. */ void z_thread_essential_set(void)
{ _current->base.user_options |= K_ESSENTIAL; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Enables or disables the Mute mode for the selected SAI block. */
void SAI_MuteModeCmd(SAI_Block_TypeDef *SAI_Block_x, FunctionalState NewState)
/* Enables or disables the Mute mode for the selected SAI block. */ void SAI_MuteModeCmd(SAI_Block_TypeDef *SAI_Block_x, FunctionalState NewState)
{ assert_param(IS_SAI_BLOCK_PERIPH(SAI_Block_x)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { SAI_Block_x->CR2 |= SAI_xCR2_MUTE; } else { SAI_Block_x->CR2 &= ~(SAI_xCR2_MUTE); } }
MaJerle/stm32f429
C++
null
2,036
/* This function will detach a static object from object system, and the memory of static object is not freed. */
void rt_object_detach(rt_object_t object)
/* This function will detach a static object from object system, and the memory of static object is not freed. */ void rt_object_detach(rt_object_t object)
{ register rt_base_t temp; RT_ASSERT(object != RT_NULL); RT_OBJECT_HOOK_CALL(rt_object_detach_hook, (object)); temp = rt_hw_interrupt_disable(); rt_list_remove(&(object->list)); rt_hw_interrupt_enable(temp); }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* This function allocates memory for extended status code data, caches the report status code service, and registers events. */
EFI_STATUS EFIAPI RuntimeResetSystemLibConstruct(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* This function allocates memory for extended status code data, caches the report status code service, and registers events. */ EFI_STATUS EFIAPI RuntimeResetSystemLibConstruct(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; mInternalRT = gRT; Status = gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_NOTIFY, RuntimeResetSystemLibVirtualAddressChange, NULL, &gEfiEventVirtualAddressChangeGuid, &mRuntimeResetSystemLibVirtualAddressChangeEvent ); ASSERT_EFI_ERROR (Status); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Update the slave idle mode bits in @v to be @idlemode for the @oh hwmod. Does not write to the hardware. Returns -EINVAL upon error or 0 upon success. */
static int _set_slave_idlemode(struct omap_hwmod *oh, u8 idlemode, u32 *v)
/* Update the slave idle mode bits in @v to be @idlemode for the @oh hwmod. Does not write to the hardware. Returns -EINVAL upon error or 0 upon success. */ static int _set_slave_idlemode(struct omap_hwmod *oh, u8 idlemode, u32 *v)
{ if (!oh->sysconfig || !(oh->sysconfig->sysc_flags & SYSC_HAS_SIDLEMODE)) return -EINVAL; *v &= ~SYSC_SIDLEMODE_MASK; *v |= __ffs(idlemode) << SYSC_SIDLEMODE_SHIFT; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* NOTE: Please make sure the Attribute Start values all contain an equal sign even in cases where they do not contain the start of an Attribute Value. */
static char* ext_t_0_wml_10(tvbuff_t *tvb, guint32 value, guint32 str_tbl)
/* NOTE: Please make sure the Attribute Start values all contain an equal sign even in cases where they do not contain the start of an Attribute Value. */ static char* ext_t_0_wml_10(tvbuff_t *tvb, guint32 value, guint32 str_tbl)
{ char *str = wmem_strdup_printf(wmem_packet_scope(), "Variable substitution - escaped: '%s'", tvb_get_const_stringz(tvb, str_tbl + value, NULL)); return str; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* TIM MSP Initialization This function configures the hardware resources used in this example: */
void HAL_TIM_OnePulse_MspInit(TIM_HandleTypeDef *htim)
/* TIM MSP Initialization This function configures the hardware resources used in this example: */ void HAL_TIM_OnePulse_MspInit(TIM_HandleTypeDef *htim)
{ GPIO_InitTypeDef GPIO_InitStruct; TIMx_CLK_ENABLE(); TIMx_CHANNEL_GPIO_PORT(); GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; GPIO_InitStruct.Alternate = GPIO_AF_TIMx; GPIO_InitStruct.Pull = GPIO_PUPD_CHANNEL1; GPIO_InitStruct.Pin = GPIO_PIN_CHANNEL1; HAL_GPIO_Init(TIMx_GPIO_PORT, &GPIO_InitStruct); GPIO_InitStruct.Pull = GPIO_PUPD_CHANNEL2; GPIO_InitStruct.Pin = GPIO_PIN_CHANNEL2; HAL_GPIO_Init(TIMx_GPIO_PORT, &GPIO_InitStruct); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* try to support NOMMU mmaps on concatenated devices */
static unsigned long concat_get_unmapped_area(struct mtd_info *mtd, unsigned long len, unsigned long offset, unsigned long flags)
/* try to support NOMMU mmaps on concatenated devices */ static unsigned long concat_get_unmapped_area(struct mtd_info *mtd, unsigned long len, unsigned long offset, unsigned long flags)
{ struct mtd_concat *concat = CONCAT(mtd); int i; for (i = 0; i < concat->num_subdev; i++) { struct mtd_info *subdev = concat->subdev[i]; if (offset >= subdev->size) { offset -= subdev->size; continue; } if (offset + len > subdev->size) return (unsigned long) -EINVAL; if (subdev->get_unmapped_area) return subdev->get_unmapped_area(subdev, len, offset, flags); break; } return (unsigned long) -ENOSYS; }
robutest/uclinux
C++
GPL-2.0
60
/* Space is available in request queue, resume queueing request to firmware. */
static void bfa_lps_reqq_resume(void *lps_arg)
/* Space is available in request queue, resume queueing request to firmware. */ static void bfa_lps_reqq_resume(void *lps_arg)
{ struct bfa_lps_s *lps = lps_arg; bfa_sm_send_event(lps, BFA_LPS_SM_RESUME); }
robutest/uclinux
C++
GPL-2.0
60
/* If Sha256Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */
BOOLEAN EFIAPI Sha256Final(IN OUT VOID *Sha256Context, OUT UINT8 *HashValue)
/* If Sha256Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */ BOOLEAN EFIAPI Sha256Final(IN OUT VOID *Sha256Context, OUT UINT8 *HashValue)
{ if ((Sha256Context == NULL) || (HashValue == NULL)) { return FALSE; } return (BOOLEAN)(SHA256_Final (HashValue, (SHA256_CTX *)Sha256Context)); }
tianocore/edk2
C++
Other
4,240
/* This function is used to display a string on console, normally, it's invoked by rt_kprintf */
void rt_hw_console_output(const char *str)
/* This function is used to display a string on console, normally, it's invoked by rt_kprintf */ void rt_hw_console_output(const char *str)
{ while (*str) { if (*str=='\n') { at91_usart_putc('\r'); } at91_usart_putc(*str++); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* show_boot_progress: - indicate state of the boot process */
void show_boot_progress(int status)
/* show_boot_progress: - indicate state of the boot process */ void show_boot_progress(int status)
{ switch(status) { } return; }
EmcraftSystems/u-boot
C++
Other
181
/* Purpose: Let user call ioctl() to get info when the UART physically is emptied. On bus types like RS485, the transmitter must release the bus after transmitting. This must be done when the transmit shift register is empty, not be done when the transmit holding register is empty. This functionality allows an RS485 driver to be written in user space. */
static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value)
/* Purpose: Let user call ioctl() to get info when the UART physically is emptied. On bus types like RS485, the transmitter must release the bus after transmitting. This must be done when the transmit shift register is empty, not be done when the transmit holding register is empty. This functionality allows an RS485 driver to be written in user space. */ static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value)
{ struct cyclades_card *card = info->card; unsigned int result; unsigned long flags; u8 status; if (!cy_is_Z(card)) { spin_lock_irqsave(&card->card_lock, flags); status = cyy_readb(info, CySRER) & (CyTxRdy | CyTxMpty); spin_unlock_irqrestore(&card->card_lock, flags); result = (status ? 0 : TIOCSER_TEMT); } else { return -EINVAL; } return put_user(result, (unsigned long __user *)value); }
robutest/uclinux
C++
GPL-2.0
60
/* This function will return the amout of WCLK delay on the given channel, rank as an absolute PI count. */
uint32_t get_wclk(uint8_t channel, uint8_t rank)
/* This function will return the amout of WCLK delay on the given channel, rank as an absolute PI count. */ uint32_t get_wclk(uint8_t channel, uint8_t rank)
{ uint32_t reg; uint32_t temp; uint32_t pi_count; ENTERFN(); reg = CCPTRREG + channel * DDRIOCCC_CH_OFFSET; temp = msg_port_alt_read(DDRPHY, reg); temp >>= rank ? 12 : 8; temp &= 0xf; pi_count = temp * HALF_CLK; reg = rank ? ECCB1DLLPICODER0 : ECCB1DLLPICODER0; reg += (channel * DDRIOCCC_CH_OFFSET); temp = msg_port_alt_read(DDRPHY, reg); temp >>= rank ? 16 : 8; temp &= 0x3f; pi_count += temp; LEAVEFN(); return pi_count; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Determins if the specified Generic Clock channel is enabled. */
bool system_gclk_chan_is_enabled(const uint8_t channel)
/* Determins if the specified Generic Clock channel is enabled. */ bool system_gclk_chan_is_enabled(const uint8_t channel)
{ bool enabled; system_interrupt_enter_critical_section(); enabled = GCLK->PCHCTRL[channel].bit.CHEN; system_interrupt_leave_critical_section(); return enabled; }
memfault/zero-to-main
C++
null
200
/* Receives datas through the UART DMA. @method UART_ReceiveBuf */
uint32_t UART_ReceiveBuf(UART_TypeDef *UARTx, uint8_t *buf, uint32_t len)
/* Receives datas through the UART DMA. @method UART_ReceiveBuf */ uint32_t UART_ReceiveBuf(UART_TypeDef *UARTx, uint8_t *buf, uint32_t len)
{ _ASSERT(IS_UART(UARTx)); _ASSERT(NULL != buf); _ASSERT(len < 0xfffff); uint32_t rcv_len = 0; while ((UART_ReceiveDataLen(UARTx) > 0) && (rcv_len < len)) { buf[rcv_len++] = UARTx->RX_DATA.bit.VAL; } return rcv_len; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Starts no hold measurement of relative humidity and temperature from a Si7013 sensor. */
int32_t Si7013_StartNoHoldMeasureRHAndTemp(I2C_TypeDef *i2c, uint8_t addr)
/* Starts no hold measurement of relative humidity and temperature from a Si7013 sensor. */ int32_t Si7013_StartNoHoldMeasureRHAndTemp(I2C_TypeDef *i2c, uint8_t addr)
{ int ret = Si7013_StartNoHoldMeasure(i2c, addr, SI7013_READ_RH_NH); return ret; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Wrapper for the carrier detect logic. For the moment this is used to hide some internal details. This will eventually become entirely internal to the tty port. */
int tty_port_carrier_raised(struct tty_port *port)
/* Wrapper for the carrier detect logic. For the moment this is used to hide some internal details. This will eventually become entirely internal to the tty port. */ int tty_port_carrier_raised(struct tty_port *port)
{ if (port->ops->carrier_raised == NULL) return 1; return port->ops->carrier_raised(port); }
robutest/uclinux
C++
GPL-2.0
60
/* Take the provided iface admin-down. Called automatically by conn_mgr when an iface has lost connection and will not attempt to regain it. */
static void conn_mgr_conn_if_auto_admin_down(struct net_if *iface)
/* Take the provided iface admin-down. Called automatically by conn_mgr when an iface has lost connection and will not attempt to regain it. */ static void conn_mgr_conn_if_auto_admin_down(struct net_if *iface)
{ if (!conn_mgr_if_is_bound(iface)) { return; } if (IS_ENABLED(CONFIG_NET_CONNECTION_MANAGER_AUTO_IF_DOWN) && !conn_mgr_if_get_flag(iface, CONN_MGR_IF_NO_AUTO_DOWN)) { net_if_down(iface); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Dissect 802.11 with a variable-length link-layer header and with the FCS presence or absence indicated by the pseudo-header, if there is one. */
static int dissect_ieee80211(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
/* Dissect 802.11 with a variable-length link-layer header and with the FCS presence or absence indicated by the pseudo-header, if there is one. */ static int dissect_ieee80211(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{ struct ieee_802_11_phdr *phdr = (struct ieee_802_11_phdr *)data; struct ieee_802_11_phdr ourphdr; if (phdr == NULL) { memset(&ourphdr, 0, sizeof(ourphdr)); ourphdr.fcs_len = -1; ourphdr.decrypted = FALSE; ourphdr.datapad = FALSE; ourphdr.phy = PHDR_802_11_PHY_UNKNOWN; phdr = &ourphdr; } return dissect_ieee80211_common(tvb, pinfo, tree, IEEE80211_COMMON_OPT_NORMAL_QOS, phdr); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Description: Remove an existing interface record from the network interface table. */
static void sel_netif_destroy(struct sel_netif *netif)
/* Description: Remove an existing interface record from the network interface table. */ static void sel_netif_destroy(struct sel_netif *netif)
{ list_del_rcu(&netif->list); sel_netif_total--; call_rcu(&netif->rcu_head, sel_netif_free); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function exports keying material using the mechanism described in RFC 5705. */
EFI_STATUS EFIAPI CryptoServiceTlsGetExportKey(IN VOID *Tls, IN CONST VOID *Label, IN CONST VOID *Context, IN UINTN ContextLen, OUT VOID *KeyBuffer, IN UINTN KeyBufferLen)
/* This function exports keying material using the mechanism described in RFC 5705. */ EFI_STATUS EFIAPI CryptoServiceTlsGetExportKey(IN VOID *Tls, IN CONST VOID *Label, IN CONST VOID *Context, IN UINTN ContextLen, OUT VOID *KeyBuffer, IN UINTN KeyBufferLen)
{ return CALL_BASECRYPTLIB ( TlsGet.Services.ExportKey, TlsGetExportKey, (Tls, Label, Context, ContextLen, KeyBuffer, KeyBufferLen), EFI_UNSUPPORTED ); }
tianocore/edk2
C++
Other
4,240
/* Add a multicast address to the multicast filter whitelist. */
sl_status_t sl_wfx_add_multicast_address(const sl_wfx_mac_address_t *mac_address, sl_wfx_interface_t interface)
/* Add a multicast address to the multicast filter whitelist. */ sl_status_t sl_wfx_add_multicast_address(const sl_wfx_mac_address_t *mac_address, sl_wfx_interface_t interface)
{ sl_wfx_add_multicast_addr_req_body_t payload; memcpy(payload.mac, &mac_address->octet, sizeof(payload.mac) ); return sl_wfx_send_command(SL_WFX_ADD_MULTICAST_ADDR_REQ_ID, &payload, sizeof(payload), interface, NULL); }
eclipse-threadx/getting-started
C++
Other
310
/* Covert the input memory size to internal register set value. */
static status_t SEMC_CovertMemorySize(uint32_t size_kbytes, uint8_t *sizeConverted)
/* Covert the input memory size to internal register set value. */ static status_t SEMC_CovertMemorySize(uint32_t size_kbytes, uint8_t *sizeConverted)
{ assert(sizeConverted != NULL); uint32_t memsize; status_t status = kStatus_Success; if ((size_kbytes < SEMC_BR_MEMSIZE_MIN) || (size_kbytes > SEMC_BR_MEMSIZE_MAX)) { status = kStatus_SEMC_InvalidMemorySize; } else { *sizeConverted = 0U; memsize = size_kbytes / 8U; while (memsize != 0x00U) { memsize >>= 1U; (*sizeConverted)++; } } return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Call Visitor function for each variable in variable storage. */
VOID BmForEachVariable(BM_VARIABLE_VISITOR Visitor, VOID *Context)
/* Call Visitor function for each variable in variable storage. */ VOID BmForEachVariable(BM_VARIABLE_VISITOR Visitor, VOID *Context)
{ EFI_STATUS Status; CHAR16 *Name; EFI_GUID Guid; UINTN NameSize; UINTN NewNameSize; NameSize = sizeof (CHAR16); Name = AllocateZeroPool (NameSize); ASSERT (Name != NULL); while (TRUE) { NewNameSize = NameSize; Status = gRT->GetNextVariableName (&NewNameSize, Name, &Guid); if (Status == EFI_BUFFER_TOO_SMALL) { Name = ReallocatePool (NameSize, NewNameSize, Name); ASSERT (Name != NULL); Status = gRT->GetNextVariableName (&NewNameSize, Name, &Guid); NameSize = NewNameSize; } if (Status == EFI_NOT_FOUND) { break; } ASSERT_EFI_ERROR (Status); Visitor (Name, &Guid, Context); } FreePool (Name); }
tianocore/edk2
C++
Other
4,240
/* Set the base reachable time of a neighbour table to the specified value */
void rtnl_neightbl_set_base_reachable_time(struct rtnl_neightbl *ntbl, uint64_t ms)
/* Set the base reachable time of a neighbour table to the specified value */ void rtnl_neightbl_set_base_reachable_time(struct rtnl_neightbl *ntbl, uint64_t ms)
{ ntbl->nt_parms.ntp_base_reachable_time = ms; ntbl->nt_parms.ntp_mask |= NEIGHTBLPARM_ATTR_BASE_REACHABLE_TIME; ntbl->ce_mask |= NEIGHTBL_ATTR_PARMS; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Change Logs: Date Author Notes whik first version */
void boardInit(void)
/* Change Logs: Date Author Notes whik first version */ void boardInit(void)
{ SYSREG->WDOG_CR = 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* On a newly forked process, the TLS descriptors haven't yet been flushed. So we mark them as such and the first switch_to will do the job. */
void clear_flushed_tls(struct task_struct *task)
/* On a newly forked process, the TLS descriptors haven't yet been flushed. So we mark them as such and the first switch_to will do the job. */ void clear_flushed_tls(struct task_struct *task)
{ int i; for (i = GDT_ENTRY_TLS_MIN; i < GDT_ENTRY_TLS_MAX; i++) { struct uml_tls_struct* curr = &task->thread.arch.tls_array[i - GDT_ENTRY_TLS_MIN]; if (!curr->present) continue; curr->flushed = 0; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Convert the ascii fat name to the unicode string and strip trailing spaces, and if necessary, convert the unicode string to lower case. */
VOID FatNameToStr(IN CHAR8 *FatName, IN UINTN Len, IN UINTN LowerCase, OUT CHAR16 *Str)
/* Convert the ascii fat name to the unicode string and strip trailing spaces, and if necessary, convert the unicode string to lower case. */ VOID FatNameToStr(IN CHAR8 *FatName, IN UINTN Len, IN UINTN LowerCase, OUT CHAR16 *Str)
{ Len = FatTrimAsciiTrailingBlanks (FatName, Len); FatFatToStr (Len, FatName, Str); if (LowerCase != 0) { FatStrLwr (Str); } }
tianocore/edk2
C++
Other
4,240
/* param base TDET peripheral base address return kStatus_Fail when writing to TDET Control Register is not allowed return kStatus_Success when operation completes successfully */
status_t TDET_SoftwareReset(DIGTMP_Type *base)
/* param base TDET peripheral base address return kStatus_Fail when writing to TDET Control Register is not allowed return kStatus_Success when operation completes successfully */ status_t TDET_SoftwareReset(DIGTMP_Type *base)
{ status_t retval = kStatus_Fail; if (tdet_IsRegisterWriteAllowed(base, DIGTMP_LR_CRL_MASK)) { base->CR = DIGTMP_CR_SWR_MASK; retval = kStatus_Success; } else { retval = kStatus_Fail; } return retval; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Dissects the Event Packet specified in Section 2.3.8 Note: many of the fields in this packet move from PTP/IP to PTP layer of the stack. Work will need to be done in future iterations to make this compatible with PTP/USB. */
void dissect_ptpIP_event(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 *offset)
/* Dissects the Event Packet specified in Section 2.3.8 Note: many of the fields in this packet move from PTP/IP to PTP layer of the stack. Work will need to be done in future iterations to make this compatible with PTP/USB. */ void dissect_ptpIP_event(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 *offset)
{ col_set_str( pinfo->cinfo, COL_INFO, "Event Packet "); proto_tree_add_item(tree, hf_ptp_eventCode, tvb, *offset, 2, ENC_LITTLE_ENDIAN); *offset += 2; dissect_ptp_transactionID(tvb, pinfo, tree, offset); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* since (b->bm_bits % BITS_PER_LONG) != 0, this masks out the remaining bits. Returns the number of bits cleared. */
static int bm_clear_surplus(struct drbd_bitmap *b)
/* since (b->bm_bits % BITS_PER_LONG) != 0, this masks out the remaining bits. Returns the number of bits cleared. */ static int bm_clear_surplus(struct drbd_bitmap *b)
{ const unsigned long mask = (1UL << (b->bm_bits & (BITS_PER_LONG-1))) - 1; size_t w = b->bm_bits >> LN2_BPL; int cleared = 0; unsigned long *p_addr, *bm; p_addr = bm_map_paddr(b, w); bm = p_addr + MLPP(w); if (w < b->bm_words) { cleared = hweight_long(*bm & ~mask); *bm &= mask; w++; bm++; } if (w < b->bm_words) { cleared += hweight_long(*bm); *bm = 0; } bm_unmap(p_addr); return cleared; }
robutest/uclinux
C++
GPL-2.0
60
/* wait for an array data from uart device with a timeout */
static int uart_wait_for(const struct device *dev, uint8_t *data, int len, int timeout)
/* wait for an array data from uart device with a timeout */ static int uart_wait_for(const struct device *dev, uint8_t *data, int len, int timeout)
{ int matched_size = 0; int64_t timeout_time = k_uptime_get() + timeout; while (1) { uint8_t c; if (k_uptime_get() > timeout_time) { return -ETIME; } if (uart_poll_in(dev, &c) == 0) { if (c == data[matched_size]) { matched_size++; if (matched_size == len) { break; } } else if (c == data[0]) { matched_size = 1; } else { matched_size = 0; } } } return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Calls the callback function for an interrupt if a callback has been registered. */
static void bsp_group_irq_call(bsp_grp_irq_t irq)
/* Calls the callback function for an interrupt if a callback has been registered. */ static void bsp_group_irq_call(bsp_grp_irq_t irq)
{ if (NULL != g_bsp_group_irq_sources[irq]) { g_bsp_group_irq_sources[irq](irq); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check if Execute Disable feature is enabled or not. */
BOOLEAN IsExecuteDisableEnabled(VOID)
/* Check if Execute Disable feature is enabled or not. */ BOOLEAN IsExecuteDisableEnabled(VOID)
{ MSR_CORE_IA32_EFER_REGISTER MsrEfer; MsrEfer.Uint64 = AsmReadMsr64 (MSR_IA32_EFER); return (MsrEfer.Bits.NXE == 1); }
tianocore/edk2
C++
Other
4,240
/* Make a copy of the global hotkey info. */
VOID UpdateHotkeyList(VOID)
/* Make a copy of the global hotkey info. */ VOID UpdateHotkeyList(VOID)
{ BROWSER_HOT_KEY *HotKey; BROWSER_HOT_KEY *CopyKey; LIST_ENTRY *Link; Link = GetFirstNode (&gBrowserHotKeyList); while (!IsNull (&gBrowserHotKeyList, Link)) { HotKey = BROWSER_HOT_KEY_FROM_LINK (Link); CopyKey = AllocateCopyPool (sizeof (BROWSER_HOT_KEY), HotKey); ASSERT (CopyKey != NULL); CopyKey->KeyData = AllocateCopyPool (sizeof (EFI_INPUT_KEY), HotKey->KeyData); ASSERT (CopyKey->KeyData != NULL); CopyKey->HelpString = AllocateCopyPool (StrSize (HotKey->HelpString), HotKey->HelpString); ASSERT (CopyKey->HelpString != NULL); InsertTailList (&gDisplayFormData.HotKeyListHead, &CopyKey->Link); Link = GetNextNode (&gBrowserHotKeyList, Link); } }
tianocore/edk2
C++
Other
4,240
/* Note, the delays are in there as a caution to ensure that the reset has time to take effect and then complete. Since the datasheet does not currently specify the exact sequence, we have chosen something that seems to work with our device. */
static void ks_soft_reset(struct eth_device *dev, unsigned op)
/* Note, the delays are in there as a caution to ensure that the reset has time to take effect and then complete. Since the datasheet does not currently specify the exact sequence, we have chosen something that seems to work with our device. */ static void ks_soft_reset(struct eth_device *dev, unsigned op)
{ ks_wrreg16(dev, KS_IER, 0x0000); ks_wrreg16(dev, KS_GRR, op); mdelay(10); ks_wrreg16(dev, KS_GRR, 0); mdelay(1); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Return TRUE if all AP services are available. */
EFI_STATUS CoreAllEfiServicesAvailable(VOID)
/* Return TRUE if all AP services are available. */ EFI_STATUS CoreAllEfiServicesAvailable(VOID)
{ EFI_CORE_PROTOCOL_NOTIFY_ENTRY *Entry; for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) { if (!Entry->Present) { return EFI_NOT_FOUND; } } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240