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
/* Returns current SQ size parameter, this paramater determines the number outstanding iSCSI commands supported on a connection */
static ssize_t bnx2i_show_sq_info(struct device *dev, struct device_attribute *attr, char *buf)
/* Returns current SQ size parameter, this paramater determines the number outstanding iSCSI commands supported on a connection */ static ssize_t bnx2i_show_sq_info(struct device *dev, struct device_attribute *attr, char *buf)
{ struct bnx2i_hba *hba = bnx2i_dev_to_hba(dev); return sprintf(buf, "0x%x\n", hba->max_sqes); }
robutest/uclinux
C++
GPL-2.0
60
/* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */
status_t HAL_CODEC_WM8904_Init(void *handle, void *config)
/* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */ status_t HAL_CODEC_WM8904_Init(void *handle, void *config)
{ assert((config != NULL) && (handle != NULL)); codec_config_t *codecConfig = (codec_config_t *)config; wm8904_config_t *devConfig = (wm8904_config_t *)(codecConfig->codecDevConfig); wm8904_handle_t *devHandle = (wm8904_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)); ((codec_handle_t *)handle)->codecCapability = &s_wm8904_capability; return WM8904_Init(devHandle, devConfig); }
eclipse-threadx/getting-started
C++
Other
310
/* Start IO TOV timer for failing back pending IO requests in offline state. */
static void bfa_itnim_iotov_start(struct bfa_itnim_s *itnim)
/* Start IO TOV timer for failing back pending IO requests in offline state. */ static void bfa_itnim_iotov_start(struct bfa_itnim_s *itnim)
{ if (itnim->fcpim->path_tov > 0) { itnim->iotov_active = BFA_TRUE; bfa_assert(bfa_itnim_hold_io(itnim)); bfa_timer_start(itnim->bfa, &itnim->timer, bfa_itnim_iotov, itnim, itnim->fcpim->path_tov); } }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the match register for the timer, which will set the 'delay' between each tick on the timer. */
void sensorpollSetMatch(uint16_t value)
/* Configures the match register for the timer, which will set the 'delay' between each tick on the timer. */ void sensorpollSetMatch(uint16_t value)
{ LPC_CT16B1->MR0 = value; return; }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* Minimum value of absolute values of a floating-point vector. */
void arm_absmin_no_idx_f32(const float32_t *pSrc, uint32_t blockSize, float32_t *pResult)
/* Minimum value of absolute values of a floating-point vector. */ void arm_absmin_no_idx_f32(const float32_t *pSrc, uint32_t blockSize, float32_t *pResult)
{ float32_t minVal, out; uint32_t blkCnt; out = fabsf(*pSrc++); blkCnt = (blockSize - 1U); while (blkCnt > 0U) { minVal = fabsf(*pSrc++); if (out > minVal) { out = minVal; } blkCnt--; } *pResult = out; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Try to make 'e' a K expression with an index in the range of R/K indices. Return true iff succeeded. */
static int luaK_exp2K(FuncState *fs, expdesc *e)
/* Try to make 'e' a K expression with an index in the range of R/K indices. Return true iff succeeded. */ static int luaK_exp2K(FuncState *fs, expdesc *e)
{ int info; switch (e->k) { case VTRUE: info = boolT(fs); break; case VFALSE: info = boolF(fs); break; case VNIL: info = nilK(fs); break; case VKINT: info = luaK_intK(fs, e->u.ival); break; case VKFLT: info = luaK_numberK(fs, e->u.nval); break; case VKSTR: info = stringK(fs, e->u.strval); break; case VK: info = e->u.info; break; default: return 0; } if (info <= MAXINDEXRK) { e->k = VK; e->u.info = info; return 1; } } return 0; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Handles a notification that a find-information response has been fully processed for the specified discover-all-descriptors proc. */
static int ble_gattc_disc_all_dscs_rx_complete(struct ble_gattc_proc *proc, int status)
/* Handles a notification that a find-information response has been fully processed for the specified discover-all-descriptors proc. */ static int ble_gattc_disc_all_dscs_rx_complete(struct ble_gattc_proc *proc, int status)
{ int rc; ble_gattc_dbg_assert_proc_not_inserted(proc); if (status != 0) { ble_gattc_disc_all_dscs_cb(proc, status, 0, NULL); return BLE_HS_EDONE; } if (proc->disc_all_dscs.prev_handle == proc->disc_all_dscs.end_handle) { ble_gattc_disc_all_dscs_cb(proc, BLE_HS_EDONE, 0, NULL); return BLE_HS_EDONE; } rc = ble_gattc_disc_all_dscs_resume(proc); if (rc != 0) { return BLE_HS_EDONE; } return 0; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Enables or disables the specified ETHERNET MMC interrupts. */
void ETH_EnableMmcInt(uint32_t ETH_MMC_IT, FunctionalState Cmd)
/* Enables or disables the specified ETHERNET MMC interrupts. */ void ETH_EnableMmcInt(uint32_t ETH_MMC_IT, FunctionalState Cmd)
{ assert_param(IS_ETH_MMC_INT(ETH_MMC_IT)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); if ((ETH_MMC_IT & (uint32_t)0x10000000) != (uint32_t)RESET) { ETH_MMC_IT &= 0xEFFFFFFF; if (Cmd != DISABLE) { ETH->MMCRXINTMSK &= (~(uint32_t)ETH_MMC_IT); } else { ETH->MMCRXINTMSK |= ETH_MMC_IT; } } else { if (Cmd != DISABLE) { ETH->MMCTXINTMSK &= (~(uint32_t)ETH_MMC_IT); } else { ETH->MMCTXINTMSK |= ETH_MMC_IT; } } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Pass a received packet to tcpip_thread for input processing */
err_t tcpip_input(struct pbuf *p, struct netif *inp)
/* Pass a received packet to tcpip_thread for input processing */ err_t tcpip_input(struct pbuf *p, struct netif *inp)
{ struct tcpip_msg *msg; if (mbox != SYS_MBOX_NULL) { msg = memp_malloc(MEMP_TCPIP_MSG_INPKT); if (msg == NULL) { return ERR_MEM; } msg->type = TCPIP_MSG_INPKT; msg->msg.inp.p = p; msg->msg.inp.netif = inp; if (sys_mbox_trypost(mbox, msg) != ERR_OK) { memp_free(MEMP_TCPIP_MSG_INPKT, msg); return ERR_MEM; } return ERR_OK; } return ERR_VAL; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* This service searches for files with a specific name, within either the specified firmware volume or all firmware volumes. */
EFI_STATUS EFIAPI PeiFfsFvPpiFindFileByName(IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This, IN CONST EFI_GUID *FileName, IN EFI_PEI_FV_HANDLE *FvHandle, OUT EFI_PEI_FILE_HANDLE *FileHandle)
/* This service searches for files with a specific name, within either the specified firmware volume or all firmware volumes. */ EFI_STATUS EFIAPI PeiFfsFvPpiFindFileByName(IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This, IN CONST EFI_GUID *FileName, IN EFI_PEI_FV_HANDLE *FvHandle, OUT EFI_PEI_FILE_HANDLE *FileHandle)
{ EFI_STATUS Status; PEI_CORE_INSTANCE *PrivateData; UINTN Index; if ((FvHandle == NULL) || (FileName == NULL) || (FileHandle == NULL)) { return EFI_INVALID_PARAMETER; } if (*FvHandle != NULL) { Status = FindFileEx (*FvHandle, FileName, 0, FileHandle, NULL); if (Status == EFI_NOT_FOUND) { *FileHandle = NULL; } } else { Status = EFI_NOT_FOUND; PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (GetPeiServicesTablePointer ()); for (Index = 0; Index < PrivateData->FvCount; Index++) { if (PrivateData->Fv[Index].FvPpi != NULL) { Status = FindFileEx (PrivateData->Fv[Index].FvHandle, FileName, 0, FileHandle, NULL); if (!EFI_ERROR (Status)) { *FvHandle = PrivateData->Fv[Index].FvHandle; break; } } } } return Status; }
tianocore/edk2
C++
Other
4,240
/* Waits until the RTC Time and Date registers (RTC_TR and RTC_DR) are synchronized with RTC APB clock. */
ErrorStatus RTC_WaitForSynchro(void)
/* Waits until the RTC Time and Date registers (RTC_TR and RTC_DR) are synchronized with RTC APB clock. */ ErrorStatus RTC_WaitForSynchro(void)
{ __IO uint32_t synchrocounter = 0; ErrorStatus status = ERROR; uint32_t synchrostatus = 0x00; if ((RTC->CR & RTC_CR_BYPSHAD) != RESET) { status = SUCCESS; } else { RTC->WPR = 0xCA; RTC->WPR = 0x53; RTC->ISR &= (uint32_t)RTC_RSF_MASK; do { synchrostatus = RTC->ISR & RTC_ISR_RSF; synchrocounter++; } while((synchrocounter != SYNCHRO_TIMEOUT) && (synchrostatus == 0x00)); if ((RTC->ISR & RTC_ISR_RSF) != RESET) { status = SUCCESS; } else { status = ERROR; } RTC->WPR = 0xFF; } return (status); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Routine: rx51_kp_getc Description: Get last pressed key (from buffer). */
int rx51_kp_getc(struct stdio_dev *sdev)
/* Routine: rx51_kp_getc Description: Get last pressed key (from buffer). */ int rx51_kp_getc(struct stdio_dev *sdev)
{ keybuf_head %= KEYBUF_SIZE; while (!rx51_kp_tstc(sdev)) WATCHDOG_RESET(); return keybuf[keybuf_head++]; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Reference value for interrupt generation. LSB = ~16@2g / ~31@4g / ~63@8g / ~127@16g. */
int32_t lis2dh12_filter_reference_get(stmdev_ctx_t *ctx, uint8_t *buff)
/* Reference value for interrupt generation. LSB = ~16@2g / ~31@4g / ~63@8g / ~127@16g. */ int32_t lis2dh12_filter_reference_get(stmdev_ctx_t *ctx, uint8_t *buff)
{ int32_t ret; ret = lis2dh12_read_reg(ctx, LIS2DH12_REFERENCE, buff, 1); return ret; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Return the PCI bus clocking for the SC1200 chipset configuration in use. We return 0 for 33MHz 1 for 48MHz and 2 for 66Mhz */
static int sc1200_clock(void)
/* Return the PCI bus clocking for the SC1200 chipset configuration in use. We return 0 for 33MHz 1 for 48MHz and 2 for 66Mhz */ static int sc1200_clock(void)
{ u8 chip_id = inb(0x903C); u8 silicon_rev = inb(0x903D); u16 pci_clock; if (chip_id == 0x04 && silicon_rev < SC1200_REV_B1) return 0; pci_clock = inw(0x901E); pci_clock >>= 8; pci_clock &= 0x03; if (pci_clock == 3) pci_clock = 0; return pci_clock; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciSegmentRead16(IN UINT64 Address)
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ UINT16 EFIAPI PciSegmentRead16(IN UINT64 Address)
{ ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1); return PciRead16 (PCI_SEGMENT_TO_PCI_ADDRESS (Address)); }
tianocore/edk2
C++
Other
4,240
/* Receives multiple bytes from the SPI bus and writes them to a buffer. */
void spi_cc_rec_data(uint8 *buffer, uint16 len)
/* Receives multiple bytes from the SPI bus and writes them to a buffer. */ void spi_cc_rec_data(uint8 *buffer, uint16 len)
{ *buffer++ = spi_rec_byte(); } while(--len); }
DC-SWAT/DreamShell
C++
null
404
/* Note: blk_init_queue() must be paired with a blk_cleanup_queue() call when the block device is deactivated (such as at module unload). */
struct request_queue* blk_init_queue(request_fn_proc *rfn, spinlock_t *lock)
/* Note: blk_init_queue() must be paired with a blk_cleanup_queue() call when the block device is deactivated (such as at module unload). */ struct request_queue* blk_init_queue(request_fn_proc *rfn, spinlock_t *lock)
{ return blk_init_queue_node(rfn, lock, -1); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set Dualtimer module timer1/timer2 disable. Disable the Dualtimer module timer1/timer2 */
void dualtimer_disable(enum dualtimer_timer timer)
/* Set Dualtimer module timer1/timer2 disable. Disable the Dualtimer module timer1/timer2 */ void dualtimer_disable(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
/* Called for each key in the table of all dissector tables. This is used if we get a list of table names, sort it, and process the list. */
static void dissector_all_heur_tables_foreach_list_func(gpointer key, gpointer user_data)
/* Called for each key in the table of all dissector tables. This is used if we get a list of table names, sort it, and process the list. */ static void dissector_all_heur_tables_foreach_list_func(gpointer key, gpointer user_data)
{ struct heur_dissector_list *list; heur_dissector_foreach_table_info_t *info; list = (struct heur_dissector_list *)g_hash_table_lookup(heur_dissector_lists, key); info = (heur_dissector_foreach_table_info_t *)user_data; (*info->caller_func)((gchar*)key, list, info->caller_data); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* index - interface to set the handler for handler - The func ptr to call on send. If NULL, set to default handler */
void sandbox_eth_set_tx_handler(int index, sandbox_eth_tx_hand_f *handler)
/* index - interface to set the handler for handler - The func ptr to call on send. If NULL, set to default handler */ void sandbox_eth_set_tx_handler(int index, sandbox_eth_tx_hand_f *handler)
{ struct udevice *dev; struct eth_sandbox_priv *priv; int ret; ret = uclass_get_device(UCLASS_ETH, index, &dev); if (ret) return; priv = dev_get_priv(dev); if (handler) priv->tx_handler = handler; else priv->tx_handler = sb_default_handler; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Combine the tonal band spectrum and regular band spectrum Return position of the last tonal coefficient */
static int addTonalComponents(float *pSpectrum, int numComponents, tonal_component *pComponent)
/* Combine the tonal band spectrum and regular band spectrum Return position of the last tonal coefficient */ static int addTonalComponents(float *pSpectrum, int numComponents, tonal_component *pComponent)
{ int cnt, i, lastPos = -1; float *pIn, *pOut; for (cnt = 0; cnt < numComponents; cnt++){ lastPos = FFMAX(pComponent[cnt].pos + pComponent[cnt].numCoefs, lastPos); pIn = pComponent[cnt].coef; pOut = &(pSpectrum[pComponent[cnt].pos]); for (i=0 ; i<pComponent[cnt].numCoefs ; i++) pOut[i] += pIn[i]; } return lastPos; }
DC-SWAT/DreamShell
C++
null
404
/* ks8695_get_msglevel - Get the messages enabled for emission @ndev: The network device to read from */
static u32 ks8695_get_msglevel(struct net_device *ndev)
/* ks8695_get_msglevel - Get the messages enabled for emission @ndev: The network device to read from */ static u32 ks8695_get_msglevel(struct net_device *ndev)
{ struct ks8695_priv *ksp = netdev_priv(ndev); return ksp->msg_enable; }
robutest/uclinux
C++
GPL-2.0
60
/* Attempt to initiate a splice from pipe to file. */
static long do_splice_from(struct pipe_inode_info *pipe, struct file *out, loff_t *ppos, size_t len, unsigned int flags)
/* Attempt to initiate a splice from pipe to file. */ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out, loff_t *ppos, size_t len, unsigned int flags)
{ ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); int ret; if (unlikely(!(out->f_mode & FMODE_WRITE))) return -EBADF; if (unlikely(out->f_flags & O_APPEND)) return -EINVAL; ret = rw_verify_area(WRITE, out, ppos, len); if (unlikely(ret < 0)) return ret; if (out->f_op && out->f_op->splice_write) splice_write = out->f_op->splice_write; else splice_write = default_file_splice_write; return splice_write(pipe, out, ppos, len, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* De-initialize a memory queue to be empty and invalid. */
memq_link_t* memq_deinit(memq_link_t **head, memq_link_t **tail)
/* De-initialize a memory queue to be empty and invalid. */ memq_link_t* memq_deinit(memq_link_t **head, memq_link_t **tail)
{ memq_link_t *old_head; if (*head != *tail) { return NULL; } old_head = *head; *head = *tail = NULL; return old_head; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* param handle codec handle. param module audio codec module. param powerOn true is power on, false is power down. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_WM8960_SetPower(void *handle, uint32_t module, bool powerOn)
/* param handle codec handle. param module audio codec module. param powerOn true is power on, false is power down. return kStatus_Success is success, else configure failed. */ status_t HAL_CODEC_WM8960_SetPower(void *handle, uint32_t module, bool powerOn)
{ assert(handle != NULL); return WM8960_SetModule((wm8960_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), HAL_WM8960_MAP_MODULE(module), powerOn); }
eclipse-threadx/getting-started
C++
Other
310
/* Returns 0 if write succeed, -EINVAL on bad parameters -ETIME on timeout */
static int mvneta_mdio_write(struct mii_dev *bus, int addr, int devad, int reg, u16 value)
/* Returns 0 if write succeed, -EINVAL on bad parameters -ETIME on timeout */ static int mvneta_mdio_write(struct mii_dev *bus, int addr, int devad, int reg, u16 value)
{ struct mvneta_port *pp = bus->priv; u32 smi_reg; if (addr > MVNETA_PHY_ADDR_MASK) { printf("Error: Invalid PHY address %d\n", addr); return -EFAULT; } if (reg > MVNETA_PHY_REG_MASK) { printf("Err: Invalid register offset %d\n", reg); return -EFAULT; } if (smi_wait_ready(pp) < 0) return -EFAULT; smi_reg = value << MVNETA_SMI_DATA_OFFS; smi_reg |= (addr << MVNETA_SMI_DEV_ADDR_OFFS) | (reg << MVNETA_SMI_REG_ADDR_OFFS); smi_reg &= ~MVNETA_SMI_OPCODE_READ; mvreg_write(pp, MVNETA_SMI, smi_reg); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* If the WUSB HC is inactive (i.e., the ASL is stopped) then the update must be skipped as the hardware may not respond to update requests. */
void asl_update(struct whc *whc, uint32_t wusbcmd)
/* If the WUSB HC is inactive (i.e., the ASL is stopped) then the update must be skipped as the hardware may not respond to update requests. */ void asl_update(struct whc *whc, uint32_t wusbcmd)
{ struct wusbhc *wusbhc = &whc->wusbhc; long t; mutex_lock(&wusbhc->mutex); if (wusbhc->active) { whc_write_wusbcmd(whc, wusbcmd, wusbcmd); t = wait_event_timeout( whc->async_list_wq, (le_readl(whc->base + WUSBCMD) & WUSBCMD_ASYNC_UPDATED) == 0, msecs_to_jiffies(1000)); if (t == 0) whc_hw_error(whc, "ASL update timeout"); } mutex_unlock(&wusbhc->mutex); }
robutest/uclinux
C++
GPL-2.0
60
/* Transfers a single SPI character. Note that this function does not handle the SS (Slave Select) pin(s) in master mode; this must be handled from the user application. */
enum status_code spi_write(struct spi_module *module, uint8_t tx_data)
/* Transfers a single SPI character. Note that this function does not handle the SS (Slave Select) pin(s) in master mode; this must be handled from the user application. */ enum status_code spi_write(struct spi_module *module, uint8_t tx_data)
{ Assert(module); Assert(module->hw); Spi *const spi_module = (module->hw); if (!_spi_is_ready_to_write(spi_module)) { return STATUS_BUSY; } spi_module->TRANSMIT_DATA.reg = tx_data & SPI_TRANSMIT_DATA_MASK; return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* Process a block of memory though the hash */
static int SHA256_Update(struct sha256_state *md, const unsigned char *in, unsigned long inlen)
/* Process a block of memory though the hash */ static int SHA256_Update(struct sha256_state *md, const unsigned char *in, unsigned long inlen)
{ unsigned long n; #define block_size 64 if(md->curlen > sizeof(md->buf)) return -1; while(inlen > 0) { if(md->curlen == 0 && inlen >= block_size) { if(sha256_compress(md, (unsigned char *)in) < 0) return -1; md->length += block_size * 8; in += block_size; inlen -= block_size; } else { n = CURLMIN(inlen, (block_size - md->curlen)); memcpy(md->buf + md->curlen, in, n); md->curlen += n; in += n; inlen -= n; if(md->curlen == block_size) { if(sha256_compress(md, md->buf) < 0) return -1; md->length += 8 * block_size; md->curlen = 0; } } } return 0; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Populates the Hash Low register with the data supplied. This function is called when the Hash filtering is to be enabled. */
void synopGMAC_write_hash_table_low(synopGMACdevice *gmacdev, u32 data)
/* Populates the Hash Low register with the data supplied. This function is called when the Hash filtering is to be enabled. */ void synopGMAC_write_hash_table_low(synopGMACdevice *gmacdev, u32 data)
{ synopGMACWriteReg(gmacdev->MacBase, GmacHashLow, data); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ADC Enable Deep-Power-Down Mdoe. Deep-power-down mode allows additional power saving by internally switching off to reduce leakage currents. */
void adc_enable_deeppwd(uint32_t adc)
/* ADC Enable Deep-Power-Down Mdoe. Deep-power-down mode allows additional power saving by internally switching off to reduce leakage currents. */ void adc_enable_deeppwd(uint32_t adc)
{ ADC_CR(adc) |= ADC_CR_DEEPPWD; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Search for a gap in the e820 memory space from start_addr to end_addr. */
__init int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize, unsigned long start_addr, unsigned long long end_addr)
/* Search for a gap in the e820 memory space from start_addr to end_addr. */ __init int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize, unsigned long start_addr, unsigned long long end_addr)
{ unsigned long long last; int i = e820.nr_map; int found = 0; last = (end_addr && end_addr < MAX_GAP_END) ? end_addr : MAX_GAP_END; while (--i >= 0) { unsigned long long start = e820.map[i].addr; unsigned long long end = start + e820.map[i].size; if (end < start_addr) continue; if (last > end) { unsigned long gap = last - end; if (gap >= *gapsize) { *gapsize = gap; *gapstart = end; found = 1; } } if (start < last) last = start; } return found; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Load the upvalues for a function. The names must be filled first, because the filling of the other fields can raise read errors and the creation of the error message can call an emergency collection; in that case all prototypes must be consistent for the GC. */
static void loadUpvalues(LoadState *S, Proto *f)
/* Load the upvalues for a function. The names must be filled first, because the filling of the other fields can raise read errors and the creation of the error message can call an emergency collection; in that case all prototypes must be consistent for the GC. */ static void loadUpvalues(LoadState *S, Proto *f)
{ f->upvalues[i].instack = loadByte(S); f->upvalues[i].idx = loadByte(S); f->upvalues[i].kind = loadByte(S); } }
Nicholas3388/LuaNode
C++
Other
1,055
/* Function for handling the application packet retransmission timeout. This function is registered in the app_timer module when a timer is created on hci_transport_open. */
void hci_transport_timeout_handle(void *p_context)
/* Function for handling the application packet retransmission timeout. This function is registered in the app_timer module when a timer is created on hci_transport_open. */ void hci_transport_timeout_handle(void *p_context)
{ tx_sm_event_handle(TX_EVENT_TIMEOUT); }
labapart/polymcu
C++
null
201
/* Configures the RTC clock (RTCCLK). Once the RTC clock is selected it can be changed unless the Backup domain is reset. */
void RCC_RTCCLKConfig(RCC_RTCCLKSOURCE_TypeDef rtc_clk_src)
/* Configures the RTC clock (RTCCLK). Once the RTC clock is selected it can be changed unless the Backup domain is reset. */ void RCC_RTCCLKConfig(RCC_RTCCLKSOURCE_TypeDef rtc_clk_src)
{ MODIFY_REG(RCC->BDCR, RCC_BDCR_RTCSEL, rtc_clk_src); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Traverse the attached ATA devices list to find out the device with given index. */
PEI_AHCI_ATA_DEVICE_DATA* SearchDeviceByIndex(IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINTN DeviceIndex)
/* Traverse the attached ATA devices list to find out the device with given index. */ PEI_AHCI_ATA_DEVICE_DATA* SearchDeviceByIndex(IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINTN DeviceIndex)
{ PEI_AHCI_ATA_DEVICE_DATA *DeviceData; LIST_ENTRY *Node; if ((DeviceIndex == 0) || (DeviceIndex > Private->ActiveDevices)) { return NULL; } Node = GetFirstNode (&Private->DeviceList); while (!IsNull (&Private->DeviceList, Node)) { DeviceData = AHCI_PEI_ATA_DEVICE_INFO_FROM_THIS (Node); if (DeviceData->DeviceIndex == DeviceIndex) { return DeviceData; } Node = GetNextNode (&Private->DeviceList, Node); } return NULL; }
tianocore/edk2
C++
Other
4,240
/* Registers the callback function that this server calls, whenever a client requests the reading of a specific holding register. */
void TbxMbServerSetCallbackReadHoldingReg(tTbxMbServer channel, tTbxMbServerReadHoldingReg callback)
/* Registers the callback function that this server calls, whenever a client requests the reading of a specific holding register. */ void TbxMbServerSetCallbackReadHoldingReg(tTbxMbServer channel, tTbxMbServerReadHoldingReg callback)
{ TBX_ASSERT((channel != NULL) && (callback != NULL)); if ((channel != NULL) && (callback != NULL)) { tTbxMbServerCtx * serverCtx = (tTbxMbServerCtx *)channel; TBX_ASSERT(serverCtx->type == TBX_MB_SERVER_CONTEXT_TYPE); TbxCriticalSectionEnter(); serverCtx->readHoldingRegFcn = callback; TbxCriticalSectionExit(); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Called very early, MMU is off, device-tree isn't unflattened */
static int __init kmeter1_probe(void)
/* Called very early, MMU is off, device-tree isn't unflattened */ static int __init kmeter1_probe(void)
{ unsigned long root = of_get_flat_dt_root(); return of_flat_dt_is_compatible(root, "keymile,KMETER1"); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* __vxge_hw_ring_rxdblock_link - Link the RxD blocks This function returns the dma address of a given item */
static void __vxge_hw_ring_rxdblock_link(struct vxge_hw_mempool *mempoolh, struct __vxge_hw_ring *ring, u32 from, u32 to)
/* __vxge_hw_ring_rxdblock_link - Link the RxD blocks This function returns the dma address of a given item */ static void __vxge_hw_ring_rxdblock_link(struct vxge_hw_mempool *mempoolh, struct __vxge_hw_ring *ring, u32 from, u32 to)
{ u8 *to_item , *from_item; dma_addr_t to_dma; from_item = mempoolh->items_arr[from]; vxge_assert(from_item); to_item = mempoolh->items_arr[to]; vxge_assert(to_item); to_dma = __vxge_hw_ring_item_dma_addr(mempoolh, to_item); __vxge_hw_ring_block_next_pointer_set(from_item, to_dma); }
robutest/uclinux
C++
GPL-2.0
60
/* Unlike the 802.3 datalink we have a list of 802.2 entries as there are multiple protocols to demux. The list is currently short (3 or 4 entries at most). The current demux assumes this. */
static int p8022_request(struct datalink_proto *dl, struct sk_buff *skb, unsigned char *dest)
/* Unlike the 802.3 datalink we have a list of 802.2 entries as there are multiple protocols to demux. The list is currently short (3 or 4 entries at most). The current demux assumes this. */ static int p8022_request(struct datalink_proto *dl, struct sk_buff *skb, unsigned char *dest)
{ llc_build_and_send_ui_pkt(dl->sap, skb, dest, dl->sap->laddr.lsap); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* TEI interrupt processing for UART mode. The TEI interrupt fires after the last byte is transmitted on the TX pin. The user callback function is called with the UART_EVENT_TX_COMPLETE event code (if it is registered in */
void sci_b_uart_tei_isr(void)
/* TEI interrupt processing for UART mode. The TEI interrupt fires after the last byte is transmitted on the TX pin. The user callback function is called with the UART_EVENT_TX_COMPLETE event code (if it is registered in */ void sci_b_uart_tei_isr(void)
{ FSP_CONTEXT_SAVE IRQn_Type irq = R_FSP_CurrentIrqGet(); sci_b_uart_instance_ctrl_t * p_ctrl = (sci_b_uart_instance_ctrl_t *) R_FSP_IsrContextGet(irq); p_ctrl->p_reg->CCR0 &= (uint32_t) ~(R_SCI_B0_CCR0_TE_Msk | R_SCI_B0_CCR0_TIE_Msk | R_SCI_B0_CCR0_TEIE_Msk); if (NULL != p_ctrl->p_callback) { r_sci_b_uart_call_callback(p_ctrl, 0U, UART_EVENT_TX_COMPLETE); } R_BSP_IrqStatusClear(irq); FSP_CONTEXT_RESTORE }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check the busy status of the specified SPI port. */
xtBoolean xSPIIsBusy(unsigned long ulBase)
/* Check the busy status of the specified SPI port. */ xtBoolean xSPIIsBusy(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) ); return ((xHWREG(ulBase + SPI_STATUS) & SPI_STATUS_BUSY) ? xtrue : xfalse); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Next the mux select. Both the "master" and "slave" 'cards' (controllers) use this routine. The routine finds the "master" for the card, maps the controller number from the detected position over to the logical number, writes the appropriate data to the analog switch, and housekeeps the local copy of the switch information. The parameter 'input' is the requested camera number (0 - 15). */
static void kodicom4400r_muxsel(struct bttv *btv, unsigned int input)
/* Next the mux select. Both the "master" and "slave" 'cards' (controllers) use this routine. The routine finds the "master" for the card, maps the controller number from the detected position over to the logical number, writes the appropriate data to the analog switch, and housekeeps the local copy of the switch information. The parameter 'input' is the requested camera number (0 - 15). */ static void kodicom4400r_muxsel(struct bttv *btv, unsigned int input)
{ char *sw_status; int xaddr, yaddr; struct bttv *mctlr; static unsigned char map[4] = {3, 0, 2, 1}; mctlr = master[btv->c.nr]; if (mctlr == NULL) { return; } yaddr = (btv->c.nr - mctlr->c.nr + 1) & 3; yaddr = map[yaddr]; sw_status = (char *)(&mctlr->mbox_we); xaddr = input & 0xf; if (sw_status[yaddr] != xaddr) { kodicom4400r_write(mctlr, sw_status[yaddr], yaddr, 0); sw_status[yaddr] = xaddr; kodicom4400r_write(mctlr, xaddr, yaddr, 1); } }
robutest/uclinux
C++
GPL-2.0
60
/* Return list of attributes present in an object */
char* nl_object_attr_list(struct nl_object *obj, char *buf, size_t len)
/* Return list of attributes present in an object */ char* nl_object_attr_list(struct nl_object *obj, char *buf, size_t len)
{ return nl_object_attrs2str(obj, obj->ce_mask, buf, len); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Take gfn and return the reverse mapping to it. Note: gfn must be unaliased before this function get called */
static unsigned long* gfn_to_rmap(struct kvm *kvm, gfn_t gfn, int level)
/* Take gfn and return the reverse mapping to it. Note: gfn must be unaliased before this function get called */ static unsigned long* gfn_to_rmap(struct kvm *kvm, gfn_t gfn, int level)
{ struct kvm_memory_slot *slot; unsigned long idx; slot = gfn_to_memslot(kvm, gfn); if (likely(level == PT_PAGE_TABLE_LEVEL)) return &slot->rmap[gfn - slot->base_gfn]; idx = (gfn / KVM_PAGES_PER_HPAGE(level)) - (slot->base_gfn / KVM_PAGES_PER_HPAGE(level)); return &slot->lpage_info[level - 2][idx].rmap_pde; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* calculate the asn1 bitstring length of the xdr_netobject */
void asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits)
/* calculate the asn1 bitstring length of the xdr_netobject */ void asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits)
{ int i, zbit = 0,elen = in->len; char *ptr; ptr = &in->data[in->len -1]; for(i = in->len; i > 0; i--) { if (*ptr == 0) { ptr--; elen--; } else break; } ptr = &in->data[elen - 1]; for(i = 0; i < 8; i++) { short mask = 0x01; if (!((mask << i) & *ptr)) zbit++; else break; } *enclen = elen; *zerobits = zbit; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Write a buffer of data to a selected endpoint. */
void USBD_WriteDataToEP(USBD_EP_T ep, uint8_t *wBuf, uint32_t wLen)
/* Write a buffer of data to a selected endpoint. */ void USBD_WriteDataToEP(USBD_EP_T ep, uint8_t *wBuf, uint32_t wLen)
{ uint32_t i; uint32_t *addrEP; uint32_t tmp; wLen = (wLen + 1) >> 1; addrEP = (uint32_t *)((uint32_t)USBD_ReadEPTxAddr(ep)); addrEP = (uint32_t *)(((uint32_t)addrEP << 1) + USBD_PMA_ADDR); for(i = 0; i < wLen; i++) { tmp = *wBuf++; tmp = ((*wBuf++) << 8) | tmp; *addrEP++ = tmp; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* assuming the pin is muxed as a gpio output, set its value. */
int at91_set_pio_value(unsigned port, unsigned pin, int value)
/* assuming the pin is muxed as a gpio output, set its value. */ int at91_set_pio_value(unsigned port, unsigned pin, int value)
{ struct at91_port *at91_port = at91_pio_get_port(port); if (at91_port && (pin < GPIO_PER_BANK)) at91_set_port_value(at91_port, pin, value); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Get the MCAN instance from peripheral base address. */
uint32_t MCAN_GetInstance(CAN_Type *base)
/* Get the MCAN instance from peripheral base address. */ uint32_t MCAN_GetInstance(CAN_Type *base)
{ uint32_t instance; for (instance = 0; instance < ARRAY_SIZE(s_mcanBases); instance++) { if (s_mcanBases[instance] == base) { break; } } assert(instance < ARRAY_SIZE(s_mcanBases)); return instance; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Command response callback function for sd_ble_gap_adv_stop BLE command. Callback for decoding the output parameters and the command response return code. */
static uint32_t gap_adv_stop_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ble_gap_adv_stop BLE command. Callback for decoding the output parameters and the command response return code. */ static uint32_t gap_adv_stop_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{ uint32_t result_code = 0; const uint32_t err_code = ble_gap_adv_stop_rsp_dec(p_buffer, length, &result_code); APP_ERROR_CHECK(err_code); return result_code; }
labapart/polymcu
C++
null
201
/* Utility to ready all the lists used by the scheduler. This is called automatically upon the creation of the first co-routine. */
static void prvInitialiseCoRoutineLists(void)
/* Utility to ready all the lists used by the scheduler. This is called automatically upon the creation of the first co-routine. */ static void prvInitialiseCoRoutineLists(void)
{ unsigned portBASE_TYPE uxPriority; for( uxPriority = 0; uxPriority < configMAX_CO_ROUTINE_PRIORITIES; uxPriority++ ) { vListInitialise( ( xList * ) &( pxReadyCoRoutineLists[ uxPriority ] ) ); } vListInitialise( ( xList * ) &xDelayedCoRoutineList1 ); vListInitialise( ( xList * ) &xDelayedCoRoutineList2 ); vListInitialise( ( xList * ) &xPendingReadyCoRoutineList ); pxDelayedCoRoutineList = &xDelayedCoRoutineList1; pxOverflowDelayedCoRoutineList = &xDelayedCoRoutineList2; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* This function returns the CA-supplied certificate revocation list data which was currently set in the specified TLS object. */
EFI_STATUS EFIAPI CryptoServiceTlsGetCertRevocationList(OUT VOID *Data, IN OUT UINTN *DataSize)
/* This function returns the CA-supplied certificate revocation list data which was currently set in the specified TLS object. */ EFI_STATUS EFIAPI CryptoServiceTlsGetCertRevocationList(OUT VOID *Data, IN OUT UINTN *DataSize)
{ return CALL_BASECRYPTLIB (TlsGet.Services.CertRevocationList, TlsGetCertRevocationList, (Data, DataSize), EFI_UNSUPPORTED); }
tianocore/edk2
C++
Other
4,240
/* try to convert a value to an integer, rounding according to 'mode', without string coercion. ("Fast track" handled by macro 'tointegerns'.) */
int luaV_tointegerns(const TValue *obj, lua_Integer *p, F2Imod mode)
/* try to convert a value to an integer, rounding according to 'mode', without string coercion. ("Fast track" handled by macro 'tointegerns'.) */ int luaV_tointegerns(const TValue *obj, lua_Integer *p, F2Imod mode)
{ *p = ivalue(obj); return 1; } else return 0; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Resets the discovery state and disables it in firmware. */
static s32 brcmf_p2p_deinit_discovery(struct brcmf_p2p_info *p2p)
/* Resets the discovery state and disables it in firmware. */ static s32 brcmf_p2p_deinit_discovery(struct brcmf_p2p_info *p2p)
{ struct brcmf_cfg80211_vif *vif; brcmf_dbg(TRACE, "enter\n"); vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; (void)brcmf_p2p_set_discover_state(vif->ifp, WL_P2P_DISC_ST_SCAN, 0, 0); vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; (void)brcmf_fil_iovar_int_set(vif->ifp, "p2p_disc", 0); return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function initializes a DES encryption algorithm, i.e. fills the psCipherContext_t structure pointed to by ctx with necessary data. */
int tls_crypto_des_init(psCipherContext_t *ctx, const unsigned char *IV, const unsigned char *key, u32 keylen, CRYPTO_MODE cbc)
/* This function initializes a DES encryption algorithm, i.e. fills the psCipherContext_t structure pointed to by ctx with necessary data. */ int tls_crypto_des_init(psCipherContext_t *ctx, const unsigned char *IV, const unsigned char *key, u32 keylen, CRYPTO_MODE cbc)
{ unsigned int x; if (keylen != DES_KEY_LEN) return ERR_FAILURE; memcpy(ctx->des3.key.ek[0], key, keylen); ctx->des3.key.ek[1][0] = cbc; ctx->des3.blocklen = DES3_IV_LEN; if(IV) { for (x = 0; x < ctx->des3.blocklen; x++) { ctx->des3.IV[x] = IV[x]; } } return ERR_CRY_OK; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Return a 32-bit mask indicating which cores are present on this SOC. */
u32 cpu_mask(void)
/* Return a 32-bit mask indicating which cores are present on this SOC. */ u32 cpu_mask(void)
{ return (1 << cpu_numcores()) - 1; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Insert new item(s) into the extent records for incore inode fork 'ifp'. 'count' new items are inserted at index 'idx'. */
void xfs_iext_insert(xfs_inode_t *ip, xfs_extnum_t idx, xfs_extnum_t count, xfs_bmbt_irec_t *new, int state)
/* Insert new item(s) into the extent records for incore inode fork 'ifp'. 'count' new items are inserted at index 'idx'. */ void xfs_iext_insert(xfs_inode_t *ip, xfs_extnum_t idx, xfs_extnum_t count, xfs_bmbt_irec_t *new, int state)
{ xfs_ifork_t *ifp = (state & BMAP_ATTRFORK) ? ip->i_afp : &ip->i_df; xfs_extnum_t i; trace_xfs_iext_insert(ip, idx, new, state, _RET_IP_); ASSERT(ifp->if_flags & XFS_IFEXTENTS); xfs_iext_add(ifp, idx, count); for (i = idx; i < idx + count; i++, new++) xfs_bmbt_set_all(xfs_iext_get_ext(ifp, i), new); }
robutest/uclinux
C++
GPL-2.0
60
/* Set the retransmit timer for the packet. It will select from either the discover timeouts/request timeouts or the default timeout values. */
VOID DhcpSetTransmitTimer(IN OUT DHCP_SERVICE *DhcpSb)
/* Set the retransmit timer for the packet. It will select from either the discover timeouts/request timeouts or the default timeout values. */ VOID DhcpSetTransmitTimer(IN OUT DHCP_SERVICE *DhcpSb)
{ UINT32 *Times; ASSERT (DhcpSb->MaxRetries > DhcpSb->CurRetry); if (DhcpSb->DhcpState == Dhcp4Selecting) { Times = DhcpSb->ActiveConfig.DiscoverTimeout; } else { Times = DhcpSb->ActiveConfig.RequestTimeout; } if (Times == NULL) { Times = mDhcp4DefaultTimeout; } DhcpSb->PacketToLive = Times[DhcpSb->CurRetry]; DhcpSb->LastTimeout = DhcpSb->PacketToLive; return; }
tianocore/edk2
C++
Other
4,240
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
/* UART MSP Initialization This function configures the hardware resources used in this example. */ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(huart->Instance==USART2) { __HAL_RCC_USART2_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF4_USART2; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Disables interrupts for the specified pin(s). The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinIntDisable(unsigned long ulPort, unsigned long ulPins)
/* Disables interrupts for the specified pin(s). The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIOPinIntDisable(unsigned long ulPort, unsigned long ulPins)
{ xASSERT(GPIOBaseValid(ulPort)); xHWREG(ulPort + GPIO_IEN) &= ~(ulPins); xHWREG(ulPort + GPIO_IEN) &= ~(ulPins << 16); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function returns zero in case of success and a negative error code in case of failure. If the volume is damaged because of an interrupted update this function just returns immediately with %-EBADF code. */
int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum)
/* This function returns zero in case of success and a negative error code in case of failure. If the volume is damaged because of an interrupted update this function just returns immediately with %-EBADF code. */ int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum)
{ struct ubi_volume *vol = desc->vol; struct ubi_device *ubi = vol->ubi; dbg_msg("unmap LEB %d:%d", vol->vol_id, lnum); if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) return -EROFS; if (lnum < 0 || lnum >= vol->reserved_pebs) return -EINVAL; if (vol->upd_marker) return -EBADF; return ubi_eba_unmap_leb(ubi, vol, lnum); }
EmcraftSystems/u-boot
C++
Other
181
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciRead32(IN UINTN Address)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI PciRead32(IN UINTN Address)
{ return PciCf8Read32 (Address); }
tianocore/edk2
C++
Other
4,240
/* If there is no room in the transmit FIFO, then this function will return immediately without writing any data to the FIFO. */
long I2STxDataPutNonBlocking(unsigned long ulBase, unsigned long ulData)
/* If there is no room in the transmit FIFO, then this function will return immediately without writing any data to the FIFO. */ long I2STxDataPutNonBlocking(unsigned long ulBase, unsigned long ulData)
{ ASSERT(ulBase == I2S0_BASE); if(HWREG(ulBase + I2S_O_TXLEV) < 16) { HWREG(ulBase + I2S_O_TXFIFO) = ulData; return(1); } else { return(0); } }
watterott/WebRadio
C++
null
71
/* ADC Hardware Averaging mode. This function configures the ADC as hardware averaging mode and converts the ADC input applied on positive input then prints the ADC input voltage on serial console after hardware averaging done and disable the ADC */
void adc_hardware_averaging(void)
/* ADC Hardware Averaging mode. This function configures the ADC as hardware averaging mode and converts the ADC input applied on positive input then prints the ADC input voltage on serial console after hardware averaging done and disable the ADC */ void adc_hardware_averaging(void)
{ configure_adc_averaging(); raw_result = adc_start_read_result(); result = ((float)raw_result * (float)ADC_REFERENCE_INTVCC1_VALUE)/(float)ADC_12BIT_FULL_SCALE_VALUE; printf("\nADC Input Voltage with Averaging = %fV", result); adc_disable(&adc_instance); }
memfault/zero-to-main
C++
null
200
/* Shifts the contents of the frame buffer up the specified number of pixels. */
void ssd1306ShiftFrameBuffer(uint8_t height)
/* Shifts the contents of the frame buffer up the specified number of pixels. */ void ssd1306ShiftFrameBuffer(uint8_t height)
{ if (height == 0) return; if (height >= SSD1306_LCDHEIGHT) { ssd1306ClearScreen(); return; } uint8_t y, x; for (y = 0; y < SSD1306_LCDHEIGHT; y++) { for (x = 0; x < SSD1306_LCDWIDTH; x++) { if ((SSD1306_LCDHEIGHT - 1) - y > height) { ssd1306GetPixel(x, y + height) ? ssd1306DrawPixel(x, y) : ssd1306ClearPixel(x, y); } else { ssd1306ClearPixel(x, y); } } } }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Enable direction change to up interrupt (UPIE). @rmtoll IER UPIE LPTIM_EnableIT_UP. */
void LPTIM_EnableIT_UP(LPTIM_Module *LPTIMx)
/* Enable direction change to up interrupt (UPIE). @rmtoll IER UPIE LPTIM_EnableIT_UP. */ void LPTIM_EnableIT_UP(LPTIM_Module *LPTIMx)
{ SET_BIT(LPTIMx->INTEN, LPTIM_INTEN_UPIE); }
pikasTech/PikaPython
C++
MIT License
1,403
/* This function is used to start calculating elapsed time. */
void tls_watchdog_start_cal_elapsed_time(void)
/* This function is used to start calculating elapsed time. */ void tls_watchdog_start_cal_elapsed_time(void)
{ if (wdg_enable) { wdg_jumpclear_flag = 1; __tls_watchdog_deinit(); __tls_watchdog_init(WDG_LOAD_VALUE_MAX); } else { wdg_jumpclear_flag = 2; __tls_watchdog_init(WDG_LOAD_VALUE_MAX); } }
Nicholas3388/LuaNode
C++
Other
1,055
/* NOTE: Regulator system constraints must be set for this regulator before calling this function otherwise this call will fail. */
int regulator_set_mode(struct regulator *regulator, unsigned int mode)
/* NOTE: Regulator system constraints must be set for this regulator before calling this function otherwise this call will fail. */ int regulator_set_mode(struct regulator *regulator, unsigned int mode)
{ struct regulator_dev *rdev = regulator->rdev; int ret; mutex_lock(&rdev->mutex); if (!rdev->desc->ops->set_mode) { ret = -EINVAL; goto out; } ret = regulator_check_mode(rdev, mode); if (ret < 0) goto out; ret = rdev->desc->ops->set_mode(rdev, mode); out: mutex_unlock(&rdev->mutex); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The allocated memory is filled with bytes of value zero. */
void* mem_calloc(mem_size_t count, mem_size_t size)
/* The allocated memory is filled with bytes of value zero. */ void* mem_calloc(mem_size_t count, mem_size_t size)
{ void *p; p = mem_malloc(count * size); if (p) { os_memset(p, 0, count * size); } return p; }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Checks whether the specified TIM flag is set or not. */
FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, uint16_t TIM_FLAG)
/* Checks whether the specified TIM flag is set or not. */ FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, uint16_t TIM_FLAG)
{ ITStatus bitstatus = RESET; assert_param(IS_TIM_ALL_PERIPH(TIMx)); assert_param(IS_TIM_GET_FLAG(TIM_FLAG)); if ((TIMx->SR & TIM_FLAG) != (uint16_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Real Video 3.0/4.0 inverse transform Code is almost the same as in SVQ3, only scaling is different. */
static void rv34_inv_transform(DCTELEM *block)
/* Real Video 3.0/4.0 inverse transform Code is almost the same as in SVQ3, only scaling is different. */ static void rv34_inv_transform(DCTELEM *block)
{ const int z0= 13*(temp[4*0+i] + temp[4*2+i]) + 0x200; const int z1= 13*(temp[4*0+i] - temp[4*2+i]) + 0x200; const int z2= 7* temp[4*1+i] - 17*temp[4*3+i]; const int z3= 17* temp[4*1+i] + 7*temp[4*3+i]; block[i*8+0]= (z0 + z3)>>10; block[i*8+1]= (z1 + z2)>>10; block[i*8+2]= (z1 - z2)>>10; block[i*8+3]= (z0 - z3)>>10; } }
DC-SWAT/DreamShell
C++
null
404
/* pdcs_osid_read - Stable Storage OS ID register output. @buf: The output buffer to write to. */
static ssize_t pdcs_osid_read(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
/* pdcs_osid_read - Stable Storage OS ID register output. @buf: The output buffer to write to. */ static ssize_t pdcs_osid_read(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
{ char *out = buf; if (!buf) return -EINVAL; out += sprintf(out, "%s dependent data (0x%.4x)\n", os_id_to_string(pdcs_osid), pdcs_osid); return out - buf; }
robutest/uclinux
C++
GPL-2.0
60
/* OLPC XO-1's V_REFOUT is a mic bias enable. */
void olpc_mic_bias(struct snd_ac97 *ac97, int on)
/* OLPC XO-1's V_REFOUT is a mic bias enable. */ void olpc_mic_bias(struct snd_ac97 *ac97, int on)
{ int err; if (!machine_is_olpc()) return; on = on ? 0 : 1; err = snd_ac97_update_bits(ac97, AC97_AD_MISC, 1 << AC97_AD_VREFD_SHIFT, on << AC97_AD_VREFD_SHIFT); if (err < 0) snd_printk(KERN_ERR "setting MIC Bias - %d\n", err); }
robutest/uclinux
C++
GPL-2.0
60
/* This file is part of the Simba project. */
static int test_power_module_init(void)
/* This file is part of the Simba project. */ static int test_power_module_init(void)
{ BTASSERT(power_module_init() == 0); return (0); }
eerimoq/simba
C++
Other
337
/* Check the amount of space used in the FIFO. This function returns the available data in the overall FIFO yet to be read by the host. This takes into account the SRAM buffer and hardware FIFO */
uint32_t am_hal_ios_fifo_space_used(void)
/* Check the amount of space used in the FIFO. This function returns the available data in the overall FIFO yet to be read by the host. This takes into account the SRAM buffer and hardware FIFO */ uint32_t am_hal_ios_fifo_space_used(void)
{ uint32_t ui32Val; uint32_t ui32Primask; ui32Primask = am_hal_interrupt_master_disable(); ui32Val = g_sSRAMBuffer.ui32Length; ui32Val += AM_BFR(IOSLAVE, FIFOPTR, FIFOSIZ); am_hal_interrupt_master_set(ui32Primask); return ui32Val; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Allocate a new attribute search context, initialize it with @ni and @mrec, and return it. Return NULL if allocation failed. */
ntfs_attr_search_ctx* ntfs_attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec)
/* Allocate a new attribute search context, initialize it with @ni and @mrec, and return it. Return NULL if allocation failed. */ ntfs_attr_search_ctx* ntfs_attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec)
{ ntfs_attr_search_ctx *ctx; ctx = kmem_cache_alloc(ntfs_attr_ctx_cache, GFP_NOFS); if (ctx) ntfs_attr_init_search_ctx(ctx, ni, mrec); return ctx; }
robutest/uclinux
C++
GPL-2.0
60
/* load a scatterlist with a potentially split-page buffer */
static void rxkad_sg_set_buf2(struct scatterlist sg[2], void *buf, size_t buflen)
/* load a scatterlist with a potentially split-page buffer */ static void rxkad_sg_set_buf2(struct scatterlist sg[2], void *buf, size_t buflen)
{ int nsg = 1; sg_init_table(sg, 2); sg_set_buf(&sg[0], buf, buflen); if (sg[0].offset + buflen > PAGE_SIZE) { sg[0].length = PAGE_SIZE - sg[0].offset; sg_set_buf(&sg[1], buf + sg[0].length, buflen - sg[0].length); nsg++; } sg_mark_end(&sg[nsg - 1]); ASSERTCMP(sg[0].length + sg[1].length, ==, buflen); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* And for microcontrollers that have a USB peripheral: */
tBoolean uDMAChannelIsEnabled(unsigned long ulChannel)
/* And for microcontrollers that have a USB peripheral: */ tBoolean uDMAChannelIsEnabled(unsigned long ulChannel)
{ ASSERT(ulChannel < 32); return((HWREG(UDMA_ENASET) & (1 << ulChannel)) ? true : false); }
watterott/WebRadio
C++
null
71
/* Abort a DMA transfer. This function will abort a DMA transfer. The DMA channel used for the DMA resource will be disabled. The block transfer count will also be calculated and written to the DMA resource structure. */
void dma_abort_job(struct dma_resource *resource)
/* Abort a DMA transfer. This function will abort a DMA transfer. The DMA channel used for the DMA resource will be disabled. The block transfer count will also be calculated and written to the DMA resource structure. */ void dma_abort_job(struct dma_resource *resource)
{ uint32_t write_size; uint32_t total_size; Assert(resource); Assert(resource->channel_id != DMA_INVALID_CHANNEL); system_interrupt_enter_critical_section(); DMAC->CHID.reg = DMAC_CHID_ID(resource->channel_id); DMAC->CHCTRLA.reg = 0; system_interrupt_leave_critical_section(); total_size = descriptor_section[resource->channel_id].BTCNT.reg; write_size = _write_back_section[resource->channel_id].BTCNT.reg; resource->transfered_size = total_size - write_size; resource->job_status = STATUS_ABORTED; }
memfault/zero-to-main
C++
null
200
/* Disables endpoint interrupts on a given USB controller. */
void USBIntDisableEndpoint(uint32_t ui32Base, uint32_t ui32Flags)
/* Disables endpoint interrupts on a given USB controller. */ void USBIntDisableEndpoint(uint32_t ui32Base, uint32_t ui32Flags)
{ ASSERT(ui32Base == USB0_BASE); HWREGH(ui32Base + USB_O_TXIE) &= ~(ui32Flags & (USB_INTEP_HOST_OUT | USB_INTEP_DEV_IN | USB_INTEP_0)); HWREGH(ui32Base + USB_O_RXIE) &= ~((ui32Flags & (USB_INTEP_HOST_IN | USB_INTEP_DEV_OUT)) >> USB_INTEP_RX_SHIFT); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* USB Device Configure Function Parameters: cfg: Device Configure/Deconfigure Return Value: None */
void USBD_Configure(BOOL cfg)
/* USB Device Configure Function Parameters: cfg: Device Configure/Deconfigure Return Value: None */ void USBD_Configure(BOOL cfg)
{ s_next_ep_buf_addr = EP1_BUF_BASE; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Gets the time required for the board plus radio to get out of sleep.. */
uint32_t RadioGetWakeupTime(void)
/* Gets the time required for the board plus radio to get out of sleep.. */ uint32_t RadioGetWakeupTime(void)
{ return SX126xGetBoardTcxoWakeupTime( ) + RADIO_WAKEUP_TIME; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Disable the PWM interrupt of the PWM module. The */
void PWMIntDisable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
/* Disable the PWM interrupt of the PWM module. The */ void PWMIntDisable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
{ xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE) || (ulBase == PWMC_BASE)); if(ulBase == PWMA_BASE) { xASSERT((ulChannel >= 0) && (ulChannel <= 5)); } else { xASSERT((ulChannel >= 0) && (ulChannel <= 1)); } xASSERT((ulIntType == PWM_INT_CHXF) || (ulIntType == PWM_INT_TOF)); if (ulIntType == PWM_INT_TOF) { xHWREG(ulBase + TPM_SC) &= ~TPM_SC_TOIE; } else { xHWREG(ulBase + TPM_C0SC + 8 * ulChannel) &= ~TPM_CNSC_CHIE; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* The function is used to return if the provided JSON value contains a JSON number. */
BOOLEAN EFIAPI JsonValueIsNumber(IN EDKII_JSON_VALUE Json)
/* The function is used to return if the provided JSON value contains a JSON number. */ BOOLEAN EFIAPI JsonValueIsNumber(IN EDKII_JSON_VALUE Json)
{ return json_is_number ((json_t *)Json); }
tianocore/edk2
C++
Other
4,240
/* Disconnect the driver specified by ImageHandle from all the devices in the handle database. Uninstall all the protocols installed in the driver entry point. */
EFI_STATUS EFIAPI RestJsonStructureUnload(IN EFI_HANDLE ImageHandle)
/* Disconnect the driver specified by ImageHandle from all the devices in the handle database. Uninstall all the protocols installed in the driver entry point. */ EFI_STATUS EFIAPI RestJsonStructureUnload(IN EFI_HANDLE ImageHandle)
{ EFI_STATUS Status; REST_JSON_STRUCTURE_INSTANCE *Instance; REST_JSON_STRUCTURE_INSTANCE *NextInstance; Status = gBS->UninstallProtocolInterface ( mProtocolHandle, &gEfiRestJsonStructureProtocolGuid, (VOID *)&mRestJsonStructureProtocol ); if (IsListEmpty (&mRestJsonStructureList)) { return Status; } Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetFirstNode (&mRestJsonStructureList); do { NextInstance = NULL; if (!IsNodeAtEnd (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) { NextInstance = (REST_JSON_STRUCTURE_INSTANCE *)GetNextNode (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance); } FreePool ((VOID *)Instance); Instance = NextInstance; } while (Instance != NULL); return Status; }
tianocore/edk2
C++
Other
4,240
/* Checks the subsystem id of the device to see if it supports btcoex */
bool ath9k_hw_btcoex_supported(struct ath_hw *ah)
/* Checks the subsystem id of the device to see if it supports btcoex */ bool ath9k_hw_btcoex_supported(struct ath_hw *ah)
{ int i; if (!ah->hw_version.subsysid) return false; for (i = 0; i < ARRAY_SIZE(ath_subsysid_tbl); i++) if (ah->hw_version.subsysid == ath_subsysid_tbl[i]) return true; return false; }
robutest/uclinux
C++
GPL-2.0
60
/* Called from cnic_register_driver() context to initialize all enumerated cnic devices. This routine allocate adapter structure and other device specific resources. */
void bnx2i_ulp_init(struct cnic_dev *dev)
/* Called from cnic_register_driver() context to initialize all enumerated cnic devices. This routine allocate adapter structure and other device specific resources. */ void bnx2i_ulp_init(struct cnic_dev *dev)
{ struct bnx2i_hba *hba; hba = bnx2i_alloc_hba(dev); if (!hba) { printk(KERN_ERR "bnx2i init: hba initialization failed\n"); return; } clear_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic); if (bnx2i_init_one(hba, dev)) { printk(KERN_ERR "bnx2i - hba %p init failed\n", hba); bnx2i_free_hba(hba); } else hba->cnic = dev; }
robutest/uclinux
C++
GPL-2.0
60
/* Interrupt enabling new requests after bearer congestion or blocking: See bearer_send(). */
void tipc_continue(struct tipc_bearer *tb_ptr)
/* Interrupt enabling new requests after bearer congestion or blocking: See bearer_send(). */ void tipc_continue(struct tipc_bearer *tb_ptr)
{ struct bearer *b_ptr = (struct bearer *)tb_ptr; spin_lock_bh(&b_ptr->publ.lock); b_ptr->continue_count++; if (!list_empty(&b_ptr->cong_links)) tipc_k_signal((Handler)tipc_bearer_lock_push, (unsigned long)b_ptr); b_ptr->publ.blocked = 0; spin_unlock_bh(&b_ptr->publ.lock); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get the MAC address for a multicast IP address. Call Mnp's McastIpToMac to find the MAC address in stead of hard code the NIC to be Ethernet. */
EFI_STATUS Ip4GetMulticastMac(IN EFI_MANAGED_NETWORK_PROTOCOL *Mnp, IN IP4_ADDR Multicast, OUT EFI_MAC_ADDRESS *Mac)
/* Get the MAC address for a multicast IP address. Call Mnp's McastIpToMac to find the MAC address in stead of hard code the NIC to be Ethernet. */ EFI_STATUS Ip4GetMulticastMac(IN EFI_MANAGED_NETWORK_PROTOCOL *Mnp, IN IP4_ADDR Multicast, OUT EFI_MAC_ADDRESS *Mac)
{ EFI_IP_ADDRESS EfiIp; EFI_IP4 (EfiIp.v4) = HTONL (Multicast); return Mnp->McastIpToMac (Mnp, FALSE, &EfiIp, Mac); }
tianocore/edk2
C++
Other
4,240
/* Function ota_app_vtor_reconfig Description Set Vector Table base location to the start addr of app(RT_APP_PART_ADDR). */
static int ota_app_vtor_reconfig(void)
/* Function ota_app_vtor_reconfig Description Set Vector Table base location to the start addr of app(RT_APP_PART_ADDR). */ static int ota_app_vtor_reconfig(void)
{ #define RT_APP_PART_ADDR 0x08020000 #define NVIC_VTOR_MASK 0x3FFFFF80 SCB->VTOR = RT_APP_PART_ADDR & NVIC_VTOR_MASK; return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* VQ Reply bufs are local host memory copies of a outstanding Verb Request reply message. The are always allocated by the kernel verbs handlers, and */
int vq_init(struct c2_dev *c2dev)
/* VQ Reply bufs are local host memory copies of a outstanding Verb Request reply message. The are always allocated by the kernel verbs handlers, and */ int vq_init(struct c2_dev *c2dev)
{ sprintf(c2dev->vq_cache_name, "c2-vq:dev%c", (char) ('0' + c2dev->devnum)); c2dev->host_msg_cache = kmem_cache_create(c2dev->vq_cache_name, c2dev->rep_vq.msg_size, 0, SLAB_HWCACHE_ALIGN, NULL); if (c2dev->host_msg_cache == NULL) { return -ENOMEM; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Function for checking that the whitelist has entries. */
static bool whitelist_has_entries(ble_gap_whitelist_t const *whitelist)
/* Function for checking that the whitelist has entries. */ static bool whitelist_has_entries(ble_gap_whitelist_t const *whitelist)
{ if ((whitelist->addr_count != 0) || (whitelist->irk_count != 0)) { return true; } return false; }
labapart/polymcu
C++
null
201
/* Get the peripheral interrupt number through peripheral base. */
unsigned long xSysCtlPeripheralIntNumGet(unsigned long ulPeripheralBase)
/* Get the peripheral interrupt number through peripheral base. */ unsigned long xSysCtlPeripheralIntNumGet(unsigned long ulPeripheralBase)
{ unsigned long i; xASSERT((ulPeripheralBase == xTIMER0_BASE)|| (ulPeripheralBase == xTIMER1_BASE)|| (ulPeripheralBase == xUART0_BASE)|| (ulPeripheralBase == xUART1_BASE)|| (ulPeripheralBase == xACMP0_BASE)|| (ulPeripheralBase == xSPI0_BASE)|| (ulPeripheralBase == xSPI1_BASE)|| (ulPeripheralBase == xI2C0_BASE)|| (ulPeripheralBase == xI2C1_BASE)|| (ulPeripheralBase == xADC0_BASE)|| (ulPeripheralBase == xWDT_BASE) ); for(i=0; g_pPeripherals[i].ulPeripheralBase != 0; i++) { if(ulPeripheralBase == g_pPeripherals[i].ulPeripheralBase) { break; } } return g_pPeripherals[i].ulPeripheralIntNum; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* the resultant list is a double NULL terminated list of NULL terminated strings. */
EFI_STATUS CopyListOfCommandNames(IN OUT CHAR16 **DestList, IN OUT UINTN *DestSize, IN CONST COMMAND_LIST *SourceList)
/* the resultant list is a double NULL terminated list of NULL terminated strings. */ EFI_STATUS CopyListOfCommandNames(IN OUT CHAR16 **DestList, IN OUT UINTN *DestSize, IN CONST COMMAND_LIST *SourceList)
{ CONST COMMAND_LIST *Node; for ( Node = (COMMAND_LIST *)GetFirstNode (&SourceList->Link) ; SourceList != NULL && !IsListEmpty (&SourceList->Link) && !IsNull (&SourceList->Link, &Node->Link) ; Node = (COMMAND_LIST *)GetNextNode (&SourceList->Link, &Node->Link) ) { LexicalInsertIntoList (DestList, DestSize, Node->CommandString); } return (EFI_SUCCESS); }
tianocore/edk2
C++
Other
4,240
/* Setup function invoked at boot to parse the ncr53c400a= command line. */
static int __init do_NCR53C400A_setup(char *str)
/* Setup function invoked at boot to parse the ncr53c400a= command line. */ static int __init do_NCR53C400A_setup(char *str)
{ int ints[10]; get_options(str, ARRAY_SIZE(ints), ints); internal_setup(BOARD_NCR53C400A, str, ints); return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Convert to little endian format. Returns the offset upto which the fixup was performed. */
static size_t fix_member(void *data, size_t offset, size_t size_bytes)
/* Convert to little endian format. Returns the offset upto which the fixup was performed. */ static size_t fix_member(void *data, size_t offset, size_t size_bytes)
{ uint8_t *src = (uint8_t *)data + offset; switch (size_bytes) { case 1: write_at_le8(data, *(uint8_t *)src, offset); break; case 2: write_at_le16(data, *(uint16_t *)src, offset); break; case 4: write_at_le32(data, *(uint32_t *)src, offset); break; case 8: write_at_le64(data, *(uint64_t *)src, offset); break; default: ERROR("Write size not supported %zd\n", size_bytes); exit(-1); } return (offset + size_bytes); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Set the channel to run in parking mode */
int XAxiVdma_ChannelStartParking(XAxiVdma_Channel *Channel)
/* Set the channel to run in parking mode */ int XAxiVdma_ChannelStartParking(XAxiVdma_Channel *Channel)
{ u32 CrBits; if (!XAxiVdma_ChannelIsRunning(Channel)) { PRINTF( "Channel is not running, cannot start park mode\r\n"); return XST_FAILURE; } CrBits = XAxiVdma_ReadReg(Channel->ChanBase, XAXIVDMA_CR_OFFSET) & ~XAXIVDMA_CR_TAIL_EN_MASK; XAxiVdma_WriteReg(Channel->ChanBase, XAXIVDMA_CR_OFFSET, CrBits); return XST_SUCCESS; }
ua1arn/hftrx
C++
null
69
/* Convert the signals returned from the slave into a local TIOCM type signals value. We keep them locally in TIOCM format. */
static long stli_mktiocm(unsigned long sigvalue)
/* Convert the signals returned from the slave into a local TIOCM type signals value. We keep them locally in TIOCM format. */ static long stli_mktiocm(unsigned long sigvalue)
{ long tiocm = 0; tiocm |= ((sigvalue & SG_DCD) ? TIOCM_CD : 0); tiocm |= ((sigvalue & SG_CTS) ? TIOCM_CTS : 0); tiocm |= ((sigvalue & SG_RI) ? TIOCM_RI : 0); tiocm |= ((sigvalue & SG_DSR) ? TIOCM_DSR : 0); tiocm |= ((sigvalue & SG_DTR) ? TIOCM_DTR : 0); tiocm |= ((sigvalue & SG_RTS) ? TIOCM_RTS : 0); return(tiocm); }
robutest/uclinux
C++
GPL-2.0
60
/* At the end of a Deflate-compressed PPP packet, we expect to have seen a */
static int zlib_inflateSyncPacket(z_streamp strm)
/* At the end of a Deflate-compressed PPP packet, we expect to have seen a */ static int zlib_inflateSyncPacket(z_streamp strm)
{ struct inflate_state *state; if (strm == NULL || strm->state == NULL) return Z_STREAM_ERROR; state = (struct inflate_state *)strm->state; if (state->mode == STORED && state->bits == 0) { state->mode = TYPE; return Z_OK; } return Z_DATA_ERROR; }
robutest/uclinux
C++
GPL-2.0
60
/* This function enables the floating-point unit, allowing the floating-point instructions to be executed. This function must be called prior to performing any hardware floating-point operations; failure to do so results in a NOCP usage fault. */
void FPUEnable(void)
/* This function enables the floating-point unit, allowing the floating-point instructions to be executed. This function must be called prior to performing any hardware floating-point operations; failure to do so results in a NOCP usage fault. */ void FPUEnable(void)
{ HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); }
feaser/openblt
C++
GNU General Public License v3.0
601