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 maximum number of memory blocks in a Memory Pool. */
uint32_t osMemoryPoolGetCapacity(osMemoryPoolId_t mp_id)
/* Get maximum number of memory blocks in a Memory Pool. */ uint32_t osMemoryPoolGetCapacity(osMemoryPoolId_t mp_id)
{ capacity = svcRtxMemoryPoolGetCapacity(mp_id); } else { capacity = __svcMemoryPoolGetCapacity(mp_id); } return capacity; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* The DN command is used to resolve a NI (Node Identifier) string to a physical address. */
xtBoolean xBeeNodeConnect(unsigned char *pucBuf)
/* The DN command is used to resolve a NI (Node Identifier) string to a physical address. */ xtBoolean xBeeNodeConnect(unsigned char *pucBuf)
{ int i=1000; xUARTCharPut(XBEE_UART, 'a'); xUARTCharPut(XBEE_UART, 't'); xUARTCharPut(XBEE_UART, 'd'); xUARTCharPut(XBEE_UART, 'n'); xBeeUartSendBuf(pucBuf,20); xUARTCharPut(XBEE_UART, '\r'); xSysCtlDelay(300000); while((!(BufferStrFind("OK", 2)!=-1))&& (i--)); if (i<=0) { BufferClear(); return xfalse; } else { BufferClear(); return xtrue; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Free the existing file lines and reset the modified flag. */
EFI_STATUS FileBufferFree(VOID)
/* Free the existing file lines and reset the modified flag. */ EFI_STATUS FileBufferFree(VOID)
{ FileBufferFreeLines (); FileBuffer.FileModified = FALSE; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Abort when the target/lun does not match or when our SCB is not busy. Used for tagged commands. */
static int initio_msgout_abort_tag(struct initio_host *host)
/* Abort when the target/lun does not match or when our SCB is not busy. Used for tagged commands. */ static int initio_msgout_abort_tag(struct initio_host *host)
{ outb(((inb(host->addr + TUL_SSignal) & (TSC_SET_ACK | 7)) | TSC_SET_ATN), host->addr + TUL_SSignal); if (initio_msgin_accept(host) == -1) return -1; if (host->phase != MSG_OUT) return initio_bad_seq(host); outb(MSG_ABORT_TAG, host->addr + TUL_SFifo); outb(TSC_XF_FIFO_OUT, host->addr + TUL_SCmd); return initio_wait_disc(host); }
robutest/uclinux
C++
GPL-2.0
60
/* Sets the selected timer interrupt. ui32Interrupt should be the logical OR of one or more of the following values: */
void am_hal_ctimer_int_set(uint32_t ui32Interrupt)
/* Sets the selected timer interrupt. ui32Interrupt should be the logical OR of one or more of the following values: */ void am_hal_ctimer_int_set(uint32_t ui32Interrupt)
{ AM_REGn(CTIMER, 0, INTSET) = ui32Interrupt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The available mappings are supplied on a per-device basis in */
void GPIOPinConfigure(unsigned long ulPinConfig)
/* The available mappings are supplied on a per-device basis in */ void GPIOPinConfigure(unsigned long ulPinConfig)
{ unsigned long ulBase, ulShift; ASSERT(((ulPinConfig >> 16) & 0xff) < 15); ASSERT(((ulPinConfig >> 8) & 0xe3) == 0); ulBase = (ulPinConfig >> 16) & 0xff; if(HWREG(SYSCTL_GPIOHBCTL) & (1 << ulBase)) { ulBase = g_pulGPIOBaseAddrs[(ulBase << 1) + 1]; } else { ulBase = g_pulGPIOBaseAddrs[ulBase << 1]; } ulShift = (ulPinConfig >> 8) & 0xff; HWREG(ulBase + GPIO_O_PCTL) = ((HWREG(ulBase + GPIO_O_PCTL) & ~(0xf << ulShift)) | ((ulPinConfig & 0xf) << ulShift)); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* ADC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
/* ADC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hadc->Instance==ADC1) { __HAL_RCC_ADC_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_0; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ufshcd_print_pwr_info - print power params as saved in hba power info */
static void ufshcd_print_pwr_info(struct ufs_hba *hba)
/* ufshcd_print_pwr_info - print power params as saved in hba power info */ static void ufshcd_print_pwr_info(struct ufs_hba *hba)
{ static const char * const names[] = { "INVALID MODE", "FAST MODE", "SLOW_MODE", "INVALID MODE", "FASTAUTO_MODE", "SLOWAUTO_MODE", "INVALID MODE", }; dev_err(hba->dev, "[RX, TX]: gear=[%d, %d], lane[%d, %d], pwr[%s, %s], rate = %d\n", hba->pwr_info.gear_rx, hba->pwr_info.gear_tx, hba->pwr_info.lane_rx, hba->pwr_info.lane_tx, names[hba->pwr_info.pwr_rx], names[hba->pwr_info.pwr_tx], hba->pwr_info.hs_rate); }
4ms/stm32mp1-baremetal
C++
Other
137
/* fcoe_logo_resp() - FCoE specific LOGO response handler @seq: active sequence in the LOGO exchange @fp: response frame, or error encoded in a pointer (timeout) */
static void fcoe_logo_resp(struct fc_seq *seq, struct fc_frame *fp, void *arg)
/* fcoe_logo_resp() - FCoE specific LOGO response handler @seq: active sequence in the LOGO exchange @fp: response frame, or error encoded in a pointer (timeout) */ static void fcoe_logo_resp(struct fc_seq *seq, struct fc_frame *fp, void *arg)
{ struct fc_lport *lport = arg; static u8 zero_mac[ETH_ALEN] = { 0 }; if (!IS_ERR(fp)) fcoe_update_src_mac(lport, zero_mac); fc_lport_logo_resp(seq, fp, lport); }
robutest/uclinux
C++
GPL-2.0
60
/* MCU decoding for DC successive approximation refinement scan. Note: we assume such scans can be multi-component, although the spec is not very clear on the point. */
decode_mcu_DC_refine(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* MCU decoding for DC successive approximation refinement scan. Note: we assume such scans can be multi-component, although the spec is not very clear on the point. */ decode_mcu_DC_refine(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{ huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; int p1 = 1 << cinfo->Al; int blkn; JBLOCKROW block; BITREAD_STATE_VARS; if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) if (! process_restart(cinfo)) return FALSE; } BITREAD_LOAD_STATE(cinfo,entropy->bitstate); for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { block = MCU_data[blkn]; CHECK_BIT_BUFFER(br_state, 1, return FALSE); if (GET_BITS(1)) (*block)[0] |= p1; } BITREAD_SAVE_STATE(cinfo,entropy->bitstate); entropy->restarts_to_go--; return TRUE; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* __vxge_hw_device_id_get This routine returns sets the device id and revision numbers into the device structure */
void __vxge_hw_device_id_get(struct __vxge_hw_device *hldev)
/* __vxge_hw_device_id_get This routine returns sets the device id and revision numbers into the device structure */ void __vxge_hw_device_id_get(struct __vxge_hw_device *hldev)
{ u64 val64; val64 = readq(&hldev->common_reg->titan_asic_id); hldev->device_id = (u16)VXGE_HW_TITAN_ASIC_ID_GET_INITIAL_DEVICE_ID(val64); hldev->major_revision = (u8)VXGE_HW_TITAN_ASIC_ID_GET_INITIAL_MAJOR_REVISION(val64); hldev->minor_revision = (u8)VXGE_HW_TITAN_ASIC_ID_GET_INITIAL_MINOR_REVISION(val64); return; }
robutest/uclinux
C++
GPL-2.0
60
/* Get part of a pbuf's payload as contiguous memory. The returned memory is either a pointer into the pbuf's payload or, if split over multiple pbufs, a copy into the user-supplied buffer. */
void* pbuf_get_contiguous(const struct pbuf *p, void *buffer, size_t bufsize, u16_t len, u16_t offset)
/* Get part of a pbuf's payload as contiguous memory. The returned memory is either a pointer into the pbuf's payload or, if split over multiple pbufs, a copy into the user-supplied buffer. */ void* pbuf_get_contiguous(const struct pbuf *p, void *buffer, size_t bufsize, u16_t len, u16_t offset)
{ const struct pbuf *q; u16_t out_offset; LWIP_ERROR("pbuf_get_contiguous: invalid buf", (p != NULL), return NULL;); LWIP_ERROR("pbuf_get_contiguous: invalid dataptr", (buffer != NULL), return NULL;); LWIP_ERROR("pbuf_get_contiguous: invalid dataptr", (bufsize >= len), return NULL;); q = pbuf_skip_const(p, offset, &out_offset); if (q != NULL) { if (q->len >= (out_offset + len)) { return (u8_t *)q->payload + out_offset; } if (pbuf_copy_partial(q, buffer, len, out_offset) != len) { return NULL; } return buffer; } return NULL; }
ua1arn/hftrx
C++
null
69
/* Specifies the operation which is operated after check error occurred. */
void SRAM_SetErrorMode(uint32_t u32SramSel, uint32_t u32ErrMode)
/* Specifies the operation which is operated after check error occurred. */ void SRAM_SetErrorMode(uint32_t u32SramSel, uint32_t u32ErrMode)
{ DDL_ASSERT(IS_SRAM_SEL(u32SramSel)); DDL_ASSERT(IS_SRAM_ERR_MD(u32ErrMode)); DDL_ASSERT(IS_SRAM_CKPR_UNLOCK()); if ((u32SramSel & (SRAM_SRAM123 | SRAM_SRAMH)) != 0U) { WRITE_REG32(bCM_SRAMC->CKCR_b.PYOAD, u32ErrMode); } if ((u32SramSel & SRAM_SRAM4) != 0U) { WRITE_REG32(bCM_SRAMC->CKCR_b.ECCOAD, u32ErrMode); } if ((u32SramSel & SRAM_SRAMB) != 0U) { WRITE_REG32(bCM_SRAMC->CKCR_b.BECCOAD, u32ErrMode); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* performs a full GC cycle; if "isemergency", does not call finalizers (which could change stack positions) */
void luaC_fullgc(lua_State *L, int isemergency)
/* performs a full GC cycle; if "isemergency", does not call finalizers (which could change stack positions) */ void luaC_fullgc(lua_State *L, int isemergency)
{ g->gckind = KGC_NORMAL; callallpendingfinalizers(L, 1); } if (keepinvariant(g)) { entersweep(L); } luaC_runtilstate(L, bitmask(GCSpause)); luaC_runtilstate(L, ~bitmask(GCSpause)); luaC_runtilstate(L, bitmask(GCSpause)); if (origkind == KGC_GEN) { luaC_runtilstate(L, bitmask(GCSpropagate)); } g->gckind = origkind; setpause(g, gettotalbytes(g)); if (!isemergency) callallpendingfinalizers(L, 1); }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* Convert an u32_t from host- to network byte order. */
u32_t htonl(u32_t n)
/* Convert an u32_t from host- to network byte order. */ u32_t htonl(u32_t n)
{ return ((n & 0xff) << 24) | ((n & 0xff00) << 8) | ((n & 0xff0000UL) >> 8) | ((n & 0xff000000UL) >> 24); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Set the fields of structure stc_dcu_init_t to default values. */
int32_t DCU_StructInit(stc_dcu_init_t *pstcDcuInit)
/* Set the fields of structure stc_dcu_init_t to default values. */ int32_t DCU_StructInit(stc_dcu_init_t *pstcDcuInit)
{ int32_t i32Ret = LL_ERR_INVD_PARAM; if (NULL != pstcDcuInit) { pstcDcuInit->u32Mode = DCU_MD_INVD; pstcDcuInit->u32DataWidth = DCU_DATA_WIDTH_8BIT; i32Ret = LL_OK; } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function for freeing a device instance allocated for bonded device. */
static __INLINE ret_code_t device_instance_free(uint32_t device_index)
/* Function for freeing a device instance allocated for bonded device. */ static __INLINE ret_code_t device_instance_free(uint32_t device_index)
{ ret_code_t err_code; pstorage_handle_t block_handle; err_code = pstorage_block_identifier_get(&m_storage_handle, device_index, &block_handle); if (err_code == NRF_SUCCESS) { DM_TRC("[DM]:[DI 0x%02X]: Freeing Instance.\r\n", device_index); err_code = pstorage_clear(&block_handle, ALL_CONTEXT_SIZE); if (err_code == NRF_SUCCESS) { peer_instance_init(device_index); } } return err_code; }
labapart/polymcu
C++
null
201
/* Return pointer to the tccb associated with this tcw. */
struct tccb* tcw_get_tccb(struct tcw *tcw)
/* Return pointer to the tccb associated with this tcw. */ struct tccb* tcw_get_tccb(struct tcw *tcw)
{ return (struct tccb *) ((addr_t) tcw->tccb); }
robutest/uclinux
C++
GPL-2.0
60
/* param config User configuration structure. return status of the request */
status_t CAAM_RNG_GetDefaultConfig(caam_rng_config_t *config)
/* param config User configuration structure. return status of the request */ status_t CAAM_RNG_GetDefaultConfig(caam_rng_config_t *config)
{ status_t status; if (config != NULL) { config->autoReseedInterval = 0; config->personalString = NULL; status = kStatus_Success; } else { status = kStatus_InvalidArgument; } return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* helper to read a given tree block, doing retries as required when the checksums don't match and we have alternate mirrors to try. */
static int btree_read_extent_buffer_pages(struct btrfs_root *root, struct extent_buffer *eb, u64 start, u64 parent_transid)
/* helper to read a given tree block, doing retries as required when the checksums don't match and we have alternate mirrors to try. */ static int btree_read_extent_buffer_pages(struct btrfs_root *root, struct extent_buffer *eb, u64 start, u64 parent_transid)
{ struct extent_io_tree *io_tree; int ret; int num_copies = 0; int mirror_num = 0; io_tree = &BTRFS_I(root->fs_info->btree_inode)->io_tree; while (1) { ret = read_extent_buffer_pages(io_tree, eb, start, 1, btree_get_extent, mirror_num); if (!ret && !verify_parent_transid(io_tree, eb, parent_transid)) return ret; num_copies = btrfs_num_copies(&root->fs_info->mapping_tree, eb->start, eb->len); if (num_copies == 1) return ret; mirror_num++; if (mirror_num > num_copies) return ret; } return -EIO; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns : OK if uninstall ISR succeeded, others if failed. */
s32 uninstall_isr(u32 intno, __pISR_hdle_t pisr)
/* Returns : OK if uninstall ISR succeeded, others if failed. */ s32 uninstall_isr(u32 intno, __pISR_hdle_t pisr)
{ if (isr_table[intno].pisr == pisr) { isr_table[intno].pisr = isr_default; isr_table[intno].parg = NULL; } else { return -1; } return OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Add up all the per-cpu counts, return the result. This is a more accurate but much slower version of percpu_counter_read_positive() */
s64 __percpu_counter_sum(struct percpu_counter *fbc)
/* Add up all the per-cpu counts, return the result. This is a more accurate but much slower version of percpu_counter_read_positive() */ s64 __percpu_counter_sum(struct percpu_counter *fbc)
{ s64 ret; int cpu; spin_lock(&fbc->lock); ret = fbc->count; for_each_online_cpu(cpu) { s32 *pcount = per_cpu_ptr(fbc->counters, cpu); ret += *pcount; } spin_unlock(&fbc->lock); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* The function is used to set Low Voltage Detect Level threshold voltage. The */
void SysCtlLVDVoltSelect(unsigned long ulVoltage)
/* The function is used to set Low Voltage Detect Level threshold voltage. The */ void SysCtlLVDVoltSelect(unsigned long ulVoltage)
{ xASSERT((ulVoltage == PWRCU_LVDCSR_LVDS_2V7) || (ulVoltage == PWRCU_LVDCSR_LVDS_2V8) || (ulVoltage == PWRCU_LVDCSR_LVDS_2V9) || (ulVoltage == PWRCU_LVDCSR_LVDS_3V0) ); xHWREG(PWRCU_LVDCSR) &= ~PWRCU_LVDCSR_LVDS_M; xHWREG(PWRCU_LVDCSR) |= ulVoltage; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Downcount for deallocation. This rides on two assumptions: */
static void ub_put(struct ub_dev *sc)
/* Downcount for deallocation. This rides on two assumptions: */ static void ub_put(struct ub_dev *sc)
{ unsigned long flags; spin_lock_irqsave(&ub_lock, flags); --sc->openc; if (sc->openc == 0 && atomic_read(&sc->poison)) { spin_unlock_irqrestore(&ub_lock, flags); ub_cleanup(sc); } else { spin_unlock_irqrestore(&ub_lock, flags); } }
robutest/uclinux
C++
GPL-2.0
60
/* Returns '1' if this is the "Any" adapter, '0' otherwise */
int airpcap_if_is_any(airpcap_if_info_t *if_info)
/* Returns '1' if this is the "Any" adapter, '0' otherwise */ int airpcap_if_is_any(airpcap_if_info_t *if_info)
{ if (g_ascii_strcasecmp(if_info->name,AIRPCAP_DEVICE_ANY_EXTRACT_STRING)==0) return 1; else return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* reading a request-key authorisation key retrieves the callout information */
static void request_key_auth_describe(const struct key *, struct seq_file *)
/* reading a request-key authorisation key retrieves the callout information */ static void request_key_auth_describe(const struct key *, struct seq_file *)
{ struct request_key_auth *rka = key->payload.data; seq_puts(m, "key:"); seq_puts(m, key->description); seq_printf(m, " pid:%d ci:%zu", rka->pid, rka->callout_len); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This routine checks for WIP(write in progress)bit in Status register(SMSR-b0) The routine checks for #timeout loops, each at interval of 1 milli-second. If successful the routine returns 0. */
static int smi_wait_till_ready(int bank, int timeout)
/* This routine checks for WIP(write in progress)bit in Status register(SMSR-b0) The routine checks for #timeout loops, each at interval of 1 milli-second. If successful the routine returns 0. */ static int smi_wait_till_ready(int bank, int timeout)
{ int count; unsigned int sr; for (count = 0; count < timeout; count++) { sr = smi_read_sr(bank); if (sr < 0) break; else if (!(sr & WIP_BIT)) return 0; udelay(1000); } printf("SMI controller is still in wait, timeout=%d\n", timeout); return -EIO; }
EmcraftSystems/u-boot
C++
Other
181
/* Contributed to the OpenSSL Project 2004 by Richard Levitte ( */
static int i2r_pci(X509V3_EXT_METHOD *method, PROXY_CERT_INFO_EXTENSION *ext, BIO *out, int indent)
/* Contributed to the OpenSSL Project 2004 by Richard Levitte ( */ static int i2r_pci(X509V3_EXT_METHOD *method, PROXY_CERT_INFO_EXTENSION *ext, BIO *out, int indent)
{ BIO_printf(out, "%*sPath Length Constraint: ", indent, ""); if (pci->pcPathLengthConstraint) i2a_ASN1_INTEGER(out, pci->pcPathLengthConstraint); else BIO_printf(out, "infinite"); BIO_puts(out, "\n"); BIO_printf(out, "%*sPolicy Language: ", indent, ""); i2a_ASN1_OBJECT(out, pci->proxyPolicy->policyLanguage); BIO_puts(out, "\n"); if (pci->proxyPolicy->policy && pci->proxyPolicy->policy->data) BIO_printf(out, "%*sPolicy Text: %s\n", indent, "", pci->proxyPolicy->policy->data); return 1; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Return value: number of bytes printed to buffer */
static ssize_t ipr_show_write_caching(struct device *dev, struct device_attribute *attr, char *buf)
/* Return value: number of bytes printed to buffer */ static ssize_t ipr_show_write_caching(struct device *dev, struct device_attribute *attr, char *buf)
{ struct Scsi_Host *shost = class_to_shost(dev); struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; unsigned long lock_flags = 0; int i, len = 0; spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); for (i = 0; i < ARRAY_SIZE(cache_state); i++) { if (cache_state[i].state == ioa_cfg->cache_state) { len = snprintf(buf, PAGE_SIZE, "%s\n", cache_state[i].name); break; } } spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); return len; }
robutest/uclinux
C++
GPL-2.0
60
/* Toggles the LED at a fixed time interval. */
void LedToggle(void)
/* Toggles the LED at a fixed time interval. */ void LedToggle(void)
{ static unsigned char led_toggle_state = 0; static unsigned long timer_counter_last = 0; unsigned long timer_counter_now; timer_counter_now = TimerGet(); if ( (timer_counter_now - timer_counter_last) < LED_TOGGLE_MS) { return; } if (led_toggle_state == 0) { led_toggle_state = 1; LCD_Symbol(LCD, LCD_SYMBOL_OLIMEX, 1); } else { led_toggle_state = 0; LCD_Symbol(LCD, LCD_SYMBOL_OLIMEX, 0); } timer_counter_last = timer_counter_now; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Disable the specified interrupt triggering on the specified (UCB_RISING, UCB_FALLING or both) edges. */
void ucb1x00_disable_irq(struct ucb1x00 *ucb, unsigned int idx, int edges)
/* Disable the specified interrupt triggering on the specified (UCB_RISING, UCB_FALLING or both) edges. */ void ucb1x00_disable_irq(struct ucb1x00 *ucb, unsigned int idx, int edges)
{ unsigned long flags; if (idx < 16) { spin_lock_irqsave(&ucb->lock, flags); ucb1x00_enable(ucb); if (edges & UCB_RISING) { ucb->irq_ris_enbl &= ~(1 << idx); ucb1x00_reg_write(ucb, UCB_IE_RIS, ucb->irq_ris_enbl); } if (edges & UCB_FALLING) { ucb->irq_fal_enbl &= ~(1 << idx); ucb1x00_reg_write(ucb, UCB_IE_FAL, ucb->irq_fal_enbl); } ucb1x00_disable(ucb); spin_unlock_irqrestore(&ucb->lock, flags); } }
robutest/uclinux
C++
GPL-2.0
60
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciExpressWrite16(IN UINTN Address, IN UINT16 Value)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ UINT16 EFIAPI PciExpressWrite16(IN UINTN Address, IN UINT16 Value)
{ ASSERT_INVALID_PCI_ADDRESS (Address); if (Address >= PcdPciExpressBaseSize ()) { return (UINT16)-1; } return MmioWrite16 ((UINTN)GetPciExpressBaseAddress () + Address, Value); }
tianocore/edk2
C++
Other
4,240
/* lc_seq_printf_stats - print stats about @lc into @seq @seq: the seq_file to print into @lc: the lru cache to print statistics of */
size_t lc_seq_printf_stats(struct seq_file *seq, struct lru_cache *lc)
/* lc_seq_printf_stats - print stats about @lc into @seq @seq: the seq_file to print into @lc: the lru cache to print statistics of */ size_t lc_seq_printf_stats(struct seq_file *seq, struct lru_cache *lc)
{ return seq_printf(seq, "\t%s: used:%u/%u " "hits:%lu misses:%lu starving:%lu dirty:%lu changed:%lu\n", lc->name, lc->used, lc->nr_elements, lc->hits, lc->misses, lc->starving, lc->dirty, lc->changed); }
robutest/uclinux
C++
GPL-2.0
60
/* ads7846_dev_init : Requests & sets GPIO line for pen-irq */
static void ads7846_dev_init(void)
/* ads7846_dev_init : Requests & sets GPIO line for pen-irq */ static void ads7846_dev_init(void)
{ if (gpio_request(ts_gpio, "ads7846 irq") < 0) { printk(KERN_ERR "can't get ads746 pen down GPIO\n"); return; } gpio_direction_input(ts_gpio); omap_set_gpio_debounce(ts_gpio, 1); omap_set_gpio_debounce_time(ts_gpio, 0xa); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Function to set the port feature for non-root hub. */
EFI_STATUS UsbHubSetPortFeature(IN USB_INTERFACE *HubIf, IN UINT8 Port, IN EFI_USB_PORT_FEATURE Feature)
/* Function to set the port feature for non-root hub. */ EFI_STATUS UsbHubSetPortFeature(IN USB_INTERFACE *HubIf, IN UINT8 Port, IN EFI_USB_PORT_FEATURE Feature)
{ EFI_STATUS Status; Status = UsbHubCtrlSetPortFeature (HubIf->Device, Port, (UINT8)Feature); return Status; }
tianocore/edk2
C++
Other
4,240
/* SPI Enable Receive Transfers via DMA. This allows received data streams to proceed unattended using DMA to move data from the receive buffer as data becomes available. The DMA channels provided for each SPI peripheral are given in the Technical Manual DMA section. */
void spi_enable_rx_dma(uint32_t spi)
/* SPI Enable Receive Transfers via DMA. This allows received data streams to proceed unattended using DMA to move data from the receive buffer as data becomes available. The DMA channels provided for each SPI peripheral are given in the Technical Manual DMA section. */ void spi_enable_rx_dma(uint32_t spi)
{ SPI_CR2(spi) |= SPI_CR2_RXDMAEN; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* switch to the first thread,it just call one time */
void rt_hw_context_switch_to(rt_uint32_t to)
/* switch to the first thread,it just call one time */ void rt_hw_context_switch_to(rt_uint32_t to)
{ rt_interrupt_from_thread = 0; rt_interrupt_to_thread = to; rt_thread_switch_interrupt_flag = 1; _IEN( _ICU_SWINT ) = 1; _IR( _ICU_SWINT ) = 0; _IPR( _ICU_SWINT ) = MAX_SYSCALL_INTERRUPT_PRIORITY + 1; ENTER_INTERRUPT(); while(1); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Preprocess dependency expression and update DriverEntry to reflect the state of Before, After, and SOR dependencies. If DriverEntry->Before or DriverEntry->After is set it will never be cleared. If SOR is set it will be cleared by CoreSchedule(), and then the driver can be dispatched. */
EFI_STATUS CorePreProcessDepex(IN EFI_CORE_DRIVER_ENTRY *DriverEntry)
/* Preprocess dependency expression and update DriverEntry to reflect the state of Before, After, and SOR dependencies. If DriverEntry->Before or DriverEntry->After is set it will never be cleared. If SOR is set it will be cleared by CoreSchedule(), and then the driver can be dispatched. */ EFI_STATUS CorePreProcessDepex(IN EFI_CORE_DRIVER_ENTRY *DriverEntry)
{ UINT8 *Iterator; Iterator = DriverEntry->Depex; if (*Iterator == EFI_DEP_SOR) { DriverEntry->Unrequested = TRUE; } else { DriverEntry->Dependent = TRUE; } if (*Iterator == EFI_DEP_BEFORE) { DriverEntry->Before = TRUE; } else if (*Iterator == EFI_DEP_AFTER) { DriverEntry->After = TRUE; } if (DriverEntry->Before || DriverEntry->After) { CopyMem (&DriverEntry->BeforeAfterGuid, Iterator + 1, sizeof (EFI_GUID)); } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* param handle The RTOS LPSPI handle. param transfer Structure specifying the transfer parameters. return status of the operation. */
status_t LPSPI_RTOS_Transfer(lpspi_rtos_handle_t *handle, lpspi_transfer_t *transfer)
/* param handle The RTOS LPSPI handle. param transfer Structure specifying the transfer parameters. return status of the operation. */ status_t LPSPI_RTOS_Transfer(lpspi_rtos_handle_t *handle, lpspi_transfer_t *transfer)
{ status_t status; if (xSemaphoreTake(handle->mutex, portMAX_DELAY) != pdTRUE) { return kStatus_LPSPI_Busy; } status = LPSPI_MasterTransferNonBlocking(handle->base, &handle->drv_handle, transfer); if (status != kStatus_Success) { (void)xSemaphoreGive(handle->mutex); return status; } if (xSemaphoreTake(handle->event, portMAX_DELAY) != pdTRUE) { return kStatus_LPSPI_Error; } (void)xSemaphoreGive(handle->mutex); return handle->async_status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* @chip: address of the chip which is to be read @addr: i2c data address within the chip @alen: length of the i2c data address (1..2 bytes) @buffer: where to write the data @len: how much byte do we want to read */
int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
/* @chip: address of the chip which is to be read @addr: i2c data address within the chip @alen: length of the i2c data address (1..2 bytes) @buffer: where to write the data @len: how much byte do we want to read */ int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
{ u8 addr_bytes[4]; addr_bytes[0] = (addr >> 0) & 0xFF; addr_bytes[1] = (addr >> 8) & 0xFF; addr_bytes[2] = (addr >> 16) & 0xFF; addr_bytes[3] = (addr >> 24) & 0xFF; return __i2c_read(base_glob, chip, addr_bytes, alen, buffer, len); }
4ms/stm32mp1-baremetal
C++
Other
137
/* vxge_hw_vpath_enable - Enable vpath. This routine clears the vpath reset thereby enabling a vpath to start forwarding frames and generating interrupts. */
void vxge_hw_vpath_enable(struct __vxge_hw_vpath_handle *vp)
/* vxge_hw_vpath_enable - Enable vpath. This routine clears the vpath reset thereby enabling a vpath to start forwarding frames and generating interrupts. */ void vxge_hw_vpath_enable(struct __vxge_hw_vpath_handle *vp)
{ struct __vxge_hw_device *hldev; u64 val64; hldev = vp->vpath->hldev; val64 = VXGE_HW_CMN_RSTHDLR_CFG1_CLR_VPATH_RESET( 1 << (16 - vp->vpath->vp_id)); __vxge_hw_pio_mem_write32_upper((u32)vxge_bVALn(val64, 0, 32), &hldev->common_reg->cmn_rsthdlr_cfg1); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns 1 if an IDE interface/drive exists at 0x170, Returns 0 otherwise. */
static int __init secondary_port_responding(void)
/* Returns 1 if an IDE interface/drive exists at 0x170, Returns 0 otherwise. */ static int __init secondary_port_responding(void)
{ unsigned long flags; spin_lock_irqsave(&cmd640_lock, flags); outb_p(0x0a, 0x176); udelay(100); if ((inb_p(0x176) & 0x1f) != 0x0a) { outb_p(0x1a, 0x176); udelay(100); if ((inb_p(0x176) & 0x1f) != 0x1a) { spin_unlock_irqrestore(&cmd640_lock, flags); return 0; } } spin_unlock_irqrestore(&cmd640_lock, flags); return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* We can optionally program the RF directly through CR regs, if supported by the hardware. This is much faster than the older method. */
int zd_rfwrite_cr_locked(struct zd_chip *chip, u32 value)
/* We can optionally program the RF directly through CR regs, if supported by the hardware. This is much faster than the older method. */ int zd_rfwrite_cr_locked(struct zd_chip *chip, u32 value)
{ struct zd_ioreq16 ioreqs[] = { { CR244, (value >> 16) & 0xff }, { CR243, (value >> 8) & 0xff }, { CR242, value & 0xff }, }; ZD_ASSERT(mutex_is_locked(&chip->mutex)); return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); }
robutest/uclinux
C++
GPL-2.0
60
/* Fail commands. session lock held and recv side suspended and xmit thread flushed */
static void fail_scsi_tasks(struct iscsi_conn *conn, unsigned lun, int error)
/* Fail commands. session lock held and recv side suspended and xmit thread flushed */ static void fail_scsi_tasks(struct iscsi_conn *conn, unsigned lun, int error)
{ struct iscsi_task *task; int i; for (i = 0; i < conn->session->cmds_max; i++) { task = conn->session->cmds[i]; if (!task->sc || task->state == ISCSI_TASK_FREE) continue; if (lun != -1 && lun != task->sc->device->lun) continue; ISCSI_DBG_SESSION(conn->session, "failing sc %p itt 0x%x state %d\n", task->sc, task->itt, task->state); fail_scsi_task(task, error); } }
robutest/uclinux
C++
GPL-2.0
60
/* configfs_detach_group() and configfs_detach_item() behave similarly on the way out. They assume that the proper semaphores are held, they clean up the configfs items, and they expect their callers will handle the dcache bits. */
static int configfs_attach_item(struct config_item *parent_item, struct config_item *item, struct dentry *dentry)
/* configfs_detach_group() and configfs_detach_item() behave similarly on the way out. They assume that the proper semaphores are held, they clean up the configfs items, and they expect their callers will handle the dcache bits. */ static int configfs_attach_item(struct config_item *parent_item, struct config_item *item, struct dentry *dentry)
{ int ret; ret = configfs_create_dir(item, dentry); if (!ret) { ret = populate_attrs(item); if (ret) { mutex_lock(&dentry->d_inode->i_mutex); configfs_remove_dir(item); dentry->d_inode->i_flags |= S_DEAD; mutex_unlock(&dentry->d_inode->i_mutex); d_delete(dentry); } } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* If called multiple times, then the data written will continue at the offset of the firmware configuration item where the previous write ended. */
VOID EFIAPI QemuFwCfgWriteBytes(IN UINTN Size, IN VOID *Buffer)
/* If called multiple times, then the data written will continue at the offset of the firmware configuration item where the previous write ended. */ VOID EFIAPI QemuFwCfgWriteBytes(IN UINTN Size, IN VOID *Buffer)
{ if (InternalQemuFwCfgIsAvailable ()) { if (InternalQemuFwCfgDmaIsAvailable () && (Size <= MAX_UINT32)) { InternalQemuFwCfgDmaBytes ((UINT32)Size, Buffer, FW_CFG_DMA_CTL_WRITE); return; } IoWriteFifo8 (FW_CFG_IO_DATA, Size, Buffer); } }
tianocore/edk2
C++
Other
4,240
/* Helper functions Do linear interpolation between two given (x, y) points */
static s16 ath5k_get_interpolated_value(s16 target, s16 x_left, s16 x_right, s16 y_left, s16 y_right)
/* Helper functions Do linear interpolation between two given (x, y) points */ static s16 ath5k_get_interpolated_value(s16 target, s16 x_left, s16 x_right, s16 y_left, s16 y_right)
{ s16 ratio, result; if ((x_left == x_right) || (y_left == y_right)) return y_left; ratio = ((100 * y_right - 100 * y_left)/(x_right - x_left)); result = y_left + (ratio * (target - x_left) / 100); return result; }
robutest/uclinux
C++
GPL-2.0
60
/* Set the specified data holding register value for DAC channel1. */
void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data)
/* Set the specified data holding register value for DAC channel1. */ void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data)
{ assert_param(IS_DAC_ALIGN(DAC_Align)); assert_param(IS_DAC_DATA(Data)); *((__IO uint32_t *)(DAC_BASE + DHR12R1_Offset + DAC_Align)) = (uint32_t)Data; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Main program entry point. This routine configures the hardware required by the bootloader, then continuously runs the bootloader processing routine until instructed to soft-exit, or hard-reset via the watchdog to start the loaded application code. */
int main(void)
/* Main program entry point. This routine configures the hardware required by the bootloader, then continuously runs the bootloader processing routine until instructed to soft-exit, or hard-reset via the watchdog to start the loaded application code. */ int main(void)
{ SetupHardware(); LEDs_SetAllLEDs(LEDS_LED1); GlobalInterruptEnable(); while (RunBootloader) { CDC_Task(); USB_USBTask(); } _delay_us(1000); USB_Detach(); MagicBootKey = MAGIC_BOOT_KEY; wdt_enable(WDTO_250MS); for (;;); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Every sync period we need to unpin all items, reclaim inodes, sync quota and write out the superblock. We might need to cover the log to indicate it is idle. */
STATIC void xfs_sync_worker(struct xfs_mount *mp, void *unused)
/* Every sync period we need to unpin all items, reclaim inodes, sync quota and write out the superblock. We might need to cover the log to indicate it is idle. */ STATIC void xfs_sync_worker(struct xfs_mount *mp, void *unused)
{ int error; if (!(mp->m_flags & XFS_MOUNT_RDONLY)) { xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE); xfs_reclaim_inodes(mp, XFS_IFLUSH_DELWRI_ELSE_ASYNC); error = xfs_qm_sync(mp, SYNC_TRYLOCK); error = xfs_sync_fsdata(mp, SYNC_TRYLOCK); } mp->m_sync_seq++; wake_up(&mp->m_wait_single_sync_task); }
robutest/uclinux
C++
GPL-2.0
60
/* Sets the repeat count for the next IOM command. */
void am_hal_iom_command_repeat_set(uint32_t ui32Module, uint32_t ui32CmdCount)
/* Sets the repeat count for the next IOM command. */ void am_hal_iom_command_repeat_set(uint32_t ui32Module, uint32_t ui32CmdCount)
{ if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES ) { return; } AM_REGn(IOMSTR, ui32Module, CMDRPT) = ui32CmdCount; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Send a request to start or stop the PTA. */
sl_status_t sl_wfx_pta_state(uint32_t pta_state)
/* Send a request to start or stop the PTA. */ sl_status_t sl_wfx_pta_state(uint32_t pta_state)
{ sl_status_t result; sl_wfx_pta_state_req_body_t payload; payload.pta_state = sl_wfx_htole32(pta_state); result = sl_wfx_send_command(SL_WFX_PTA_STATE_REQ_ID, &payload, sizeof(payload), SL_WFX_STA_INTERFACE, NULL); return result; }
eclipse-threadx/getting-started
C++
Other
310
/* This function checks if static volume @vol_id is corrupted by fully reading it and checking data CRC. This function returns %0 if the volume is not corrupted, %1 if it is corrupted and a negative error code in case of failure. Dynamic volumes are not checked and zero is returned immediately. */
int ubi_check_volume(struct ubi_device *ubi, int vol_id)
/* This function checks if static volume @vol_id is corrupted by fully reading it and checking data CRC. This function returns %0 if the volume is not corrupted, %1 if it is corrupted and a negative error code in case of failure. Dynamic volumes are not checked and zero is returned immediately. */ int ubi_check_volume(struct ubi_device *ubi, int vol_id)
{ void *buf; int err = 0, i; struct ubi_volume *vol = ubi->volumes[vol_id]; if (vol->vol_type != UBI_STATIC_VOLUME) return 0; buf = vmalloc(vol->usable_leb_size); if (!buf) return -ENOMEM; for (i = 0; i < vol->used_ebs; i++) { int size; if (i == vol->used_ebs - 1) size = vol->last_eb_bytes; else size = vol->usable_leb_size; err = ubi_eba_read_leb(ubi, vol, i, buf, 0, size, 1); if (err) { if (err == -EBADMSG) err = 1; break; } } vfree(buf); return err; }
EmcraftSystems/u-boot
C++
Other
181
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
static void drm_vm_open(struct vm_area_struct *vma)
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ static void drm_vm_open(struct vm_area_struct *vma)
{ struct drm_file *priv = vma->vm_file->private_data; struct drm_device *dev = priv->minor->dev; mutex_lock(&dev->struct_mutex); drm_vm_open_locked(vma); mutex_unlock(&dev->struct_mutex); }
robutest/uclinux
C++
GPL-2.0
60
/* Set packet loss correlation probability of netem qdisc. */
int rtnl_netem_set_loss_correlation(struct rtnl_qdisc *qdisc, int prob)
/* Set packet loss correlation probability of netem qdisc. */ int rtnl_netem_set_loss_correlation(struct rtnl_qdisc *qdisc, int prob)
{ struct rtnl_netem *netem; netem = netem_alloc(qdisc); if (!netem) return -NLE_NOMEM; netem->qnm_corr.nmc_loss = prob; netem->qnm_mask |= SCH_NETEM_ATTR_LOSS_CORR; return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If the given key is contained in the list, returns TRUE. Returns FALSE otherwise. */
gboolean key_is_in_list(decryption_key_t *dk, GList *list)
/* If the given key is contained in the list, returns TRUE. Returns FALSE otherwise. */ gboolean key_is_in_list(decryption_key_t *dk, GList *list)
{ guint i,n; decryption_key_t *curr_key = NULL; gboolean found = FALSE; if ( (list == NULL) || (dk == NULL) ) return FALSE; n = g_list_length(list); if (n < 1) return FALSE; for(i = 0; i < n; i++) { curr_key = (decryption_key_t*)g_list_nth_data(list,i); if (keys_are_equals(dk,curr_key)) found = TRUE; } return found; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Finds the protocol entry for the requested protocol. */
PROTOCOL_ENTRY* UnitTestFindProtocolEntry(IN EFI_GUID *Protocol, IN BOOLEAN Create)
/* Finds the protocol entry for the requested protocol. */ PROTOCOL_ENTRY* UnitTestFindProtocolEntry(IN EFI_GUID *Protocol, IN BOOLEAN Create)
{ LIST_ENTRY *Link; PROTOCOL_ENTRY *Item; PROTOCOL_ENTRY *ProtEntry; ProtEntry = NULL; for (Link = mProtocolDatabase.ForwardLink; Link != &mProtocolDatabase; Link = Link->ForwardLink) { Item = CR (Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE); if (CompareGuid (&Item->ProtocolID, Protocol)) { ProtEntry = Item; break; } } if ((ProtEntry == NULL) && Create) { ProtEntry = AllocatePool (sizeof (PROTOCOL_ENTRY)); if (ProtEntry != NULL) { ProtEntry->Signature = PROTOCOL_ENTRY_SIGNATURE; CopyGuid ((VOID *)&ProtEntry->ProtocolID, Protocol); InitializeListHead (&ProtEntry->Protocols); InitializeListHead (&ProtEntry->Notify); InsertTailList (&mProtocolDatabase, &ProtEntry->AllEntries); } } return ProtEntry; }
tianocore/edk2
C++
Other
4,240
/* This function enables software control of a WM8400 regulator via the regulator API. It is intended to be called from the platform_init() callback of the WM8400 MFD driver. */
int wm8400_register_regulator(struct device *dev, int reg, struct regulator_init_data *initdata)
/* This function enables software control of a WM8400 regulator via the regulator API. It is intended to be called from the platform_init() callback of the WM8400 MFD driver. */ int wm8400_register_regulator(struct device *dev, int reg, struct regulator_init_data *initdata)
{ struct wm8400 *wm8400 = dev_get_drvdata(dev); if (wm8400->regulators[reg].name) return -EBUSY; initdata->driver_data = wm8400; wm8400->regulators[reg].name = "wm8400-regulator"; wm8400->regulators[reg].id = reg; wm8400->regulators[reg].dev.parent = dev; wm8400->regulators[reg].dev.platform_data = initdata; dev_set_drvdata(&wm8400->regulators[reg].dev, wm8400); return platform_device_register(&wm8400->regulators[reg]); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Derived from Beagle Board and 3430 SDP code by Richard Woodruff <r-woodruff2 at ti.com> Syed Mohammed Khasim <khasim at ti.com> */
void twl4030_led_init(unsigned char ledon_mask)
/* Derived from Beagle Board and 3430 SDP code by Richard Woodruff <r-woodruff2 at ti.com> Syed Mohammed Khasim <khasim at ti.com> */ void twl4030_led_init(unsigned char ledon_mask)
{ if (ledon_mask & TWL4030_LED_LEDEN_LEDAON) ledon_mask |= TWL4030_LED_LEDEN_LEDAPWM; if (ledon_mask & TWL4030_LED_LEDEN_LEDBON) ledon_mask |= TWL4030_LED_LEDEN_LEDBPWM; twl4030_i2c_write_u8(TWL4030_CHIP_LED, TWL4030_LED_LEDEN, ledon_mask); }
4ms/stm32mp1-baremetal
C++
Other
137
/* count() counts the number of strings in array ARGV. */
static int count(char __user *__user *argv, int max)
/* count() counts the number of strings in array ARGV. */ static int count(char __user *__user *argv, int max)
{ int i = 0; if (argv != NULL) { for (;;) { char __user * p; if (get_user(p, argv)) return -EFAULT; if (!p) break; argv++; if (i++ >= max) return -E2BIG; cond_resched(); } } return i; }
robutest/uclinux
C++
GPL-2.0
60
/* This is called with mon_lock taken, so we can decrement mbus->ref. */
void mon_reader_del(struct mon_bus *mbus, struct mon_reader *r)
/* This is called with mon_lock taken, so we can decrement mbus->ref. */ void mon_reader_del(struct mon_bus *mbus, struct mon_reader *r)
{ unsigned long flags; spin_lock_irqsave(&mbus->lock, flags); list_del(&r->r_link); --mbus->nreaders; if (mbus->nreaders == 0) mon_stop(mbus); spin_unlock_irqrestore(&mbus->lock, flags); kref_put(&mbus->ref, mon_bus_drop); }
robutest/uclinux
C++
GPL-2.0
60
/* Flush output from our internal buffers. Called for the TCFLSH ioctl. Can be entered in parallel but this is covered by the xmit_lock. */
static void ppp_async_flush_output(struct asyncppp *ap)
/* Flush output from our internal buffers. Called for the TCFLSH ioctl. Can be entered in parallel but this is covered by the xmit_lock. */ static void ppp_async_flush_output(struct asyncppp *ap)
{ int done = 0; spin_lock_bh(&ap->xmit_lock); ap->optr = ap->olim; if (ap->tpkt != NULL) { kfree_skb(ap->tpkt); ap->tpkt = NULL; clear_bit(XMIT_FULL, &ap->xmit_flags); done = 1; } spin_unlock_bh(&ap->xmit_lock); if (done) ppp_output_wakeup(&ap->chan); }
robutest/uclinux
C++
GPL-2.0
60
/* @queue: Input queue to setup RED on (0-7) @pass_thresh: Packets will begin slowly dropping when there are less than this many packet buffers free in FPA 0. @drop_thresh: All incomming packets will be dropped when there are less than this many free packet buffers in FPA 0. Returns Zero on success. Negative on failure */
int cvmx_helper_setup_red_queue(int queue, int pass_thresh, int drop_thresh)
/* @queue: Input queue to setup RED on (0-7) @pass_thresh: Packets will begin slowly dropping when there are less than this many packet buffers free in FPA 0. @drop_thresh: All incomming packets will be dropped when there are less than this many free packet buffers in FPA 0. Returns Zero on success. Negative on failure */ int cvmx_helper_setup_red_queue(int queue, int pass_thresh, int drop_thresh)
{ union cvmx_ipd_qosx_red_marks red_marks; union cvmx_ipd_red_quex_param red_param; red_marks.u64 = 0; red_marks.s.drop = drop_thresh; red_marks.s.pass = pass_thresh; cvmx_write_csr(CVMX_IPD_QOSX_RED_MARKS(queue), red_marks.u64); red_param.u64 = 0; red_param.s.prb_con = (255ul << 24) / (red_marks.s.pass - red_marks.s.drop); red_param.s.avg_con = 1; red_param.s.new_con = 255; red_param.s.use_pcnt = 1; cvmx_write_csr(CVMX_IPD_RED_QUEX_PARAM(queue), red_param.u64); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Read a PHY register through the MDIO interface. */
int32_t ETH_PHY_IO_ReadReg(uint32_t DevAddr, uint32_t RegAddr, uint32_t *pRegVal)
/* Read a PHY register through the MDIO interface. */ int32_t ETH_PHY_IO_ReadReg(uint32_t DevAddr, uint32_t RegAddr, uint32_t *pRegVal)
{ if(HAL_ETH_ReadPHYRegister(&EthHandle, DevAddr, RegAddr, pRegVal) != HAL_OK) { return -1; } return 0; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This API initializes the configuration structure for LPSPI_SlaveInit(). The initialized structure can remain unchanged in LPSPI_SlaveInit() or can be modified before calling the LPSPI_SlaveInit(). Example: code lpspi_slave_config_t slaveConfig; LPSPI_SlaveGetDefaultConfig(&slaveConfig); endcode param slaveConfig pointer to lpspi_slave_config_t structure. */
void LPSPI_SlaveGetDefaultConfig(lpspi_slave_config_t *slaveConfig)
/* This API initializes the configuration structure for LPSPI_SlaveInit(). The initialized structure can remain unchanged in LPSPI_SlaveInit() or can be modified before calling the LPSPI_SlaveInit(). Example: code lpspi_slave_config_t slaveConfig; LPSPI_SlaveGetDefaultConfig(&slaveConfig); endcode param slaveConfig pointer to lpspi_slave_config_t structure. */ void LPSPI_SlaveGetDefaultConfig(lpspi_slave_config_t *slaveConfig)
{ assert(slaveConfig); memset(slaveConfig, 0, sizeof(*slaveConfig)); slaveConfig->bitsPerFrame = 8; slaveConfig->cpol = kLPSPI_ClockPolarityActiveHigh; slaveConfig->cpha = kLPSPI_ClockPhaseFirstEdge; slaveConfig->direction = kLPSPI_MsbFirst; slaveConfig->whichPcs = kLPSPI_Pcs0; slaveConfig->pcsActiveHighOrLow = kLPSPI_PcsActiveLow; slaveConfig->pinCfg = kLPSPI_SdiInSdoOut; slaveConfig->dataOutConfig = kLpspiDataOutRetained; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* we need to detect all attempts to write to the EBC entry point argument stack area and adjust the address (which will initially point into the VM stack) to point into the EBC entry point arguments. */
EFI_STATUS VmWriteMem16(IN VM_CONTEXT *VmPtr, IN UINTN Addr, IN UINT16 Data)
/* we need to detect all attempts to write to the EBC entry point argument stack area and adjust the address (which will initially point into the VM stack) to point into the EBC entry point arguments. */ EFI_STATUS VmWriteMem16(IN VM_CONTEXT *VmPtr, IN UINTN Addr, IN UINT16 Data)
{ EFI_STATUS Status; Addr = ConvertStackAddr (VmPtr, Addr); if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT16))) { *(UINT16 *)Addr = Data; } else { MemoryFence (); if ((Status = VmWriteMem8 (VmPtr, Addr, (UINT8)Data)) != EFI_SUCCESS) { return Status; } MemoryFence (); if ((Status = VmWriteMem8 (VmPtr, Addr + 1, (UINT8)(Data >> 8))) != EFI_SUCCESS) { return Status; } MemoryFence (); } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Enables or Disables the Precharge of Tamper pin. */
void RTC_TamperPullUpCmd(FunctionalState NewState)
/* Enables or Disables the Precharge of Tamper pin. */ void RTC_TamperPullUpCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RTC->TAFCR &= (uint32_t)~RTC_TAFCR_TAMPPUDIS; } else { RTC->TAFCR |= (uint32_t)RTC_TAFCR_TAMPPUDIS; } }
MaJerle/stm32f429
C++
null
2,036
/* find the leaf ref for a given extent. This returns the ref struct with a usage reference incremented */
struct btrfs_leaf_ref* btrfs_lookup_leaf_ref(struct btrfs_root *root, u64 bytenr)
/* find the leaf ref for a given extent. This returns the ref struct with a usage reference incremented */ struct btrfs_leaf_ref* btrfs_lookup_leaf_ref(struct btrfs_root *root, u64 bytenr)
{ struct rb_node *rb; struct btrfs_leaf_ref *ref = NULL; struct btrfs_leaf_ref_tree *tree = root->ref_tree; again: if (tree) { spin_lock(&tree->lock); rb = tree_search(&tree->root, bytenr); if (rb) ref = rb_entry(rb, struct btrfs_leaf_ref, rb_node); if (ref) atomic_inc(&ref->usage); spin_unlock(&tree->lock); if (ref) return ref; } if (tree != &root->fs_info->shared_ref_tree) { tree = &root->fs_info->shared_ref_tree; goto again; } return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* This API function is used to generate random number with specified length. */
status_t NBOOT_GenerateRandom(uint8_t *output, size_t outputByteLen)
/* This API function is used to generate random number with specified length. */ status_t NBOOT_GenerateRandom(uint8_t *output, size_t outputByteLen)
{ assert(BOOTLOADER_API_TREE_POINTER); return BOOTLOADER_API_TREE_POINTER->nbootDriver->romapi_rng_generate_random(output, outputByteLen); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the most recent received data by the SPIx/I2Sx peripheral. */
uint8_t SPI_ReceiveData8(SPI_TypeDef *SPIx)
/* Returns the most recent received data by the SPIx/I2Sx peripheral. */ uint8_t SPI_ReceiveData8(SPI_TypeDef *SPIx)
{ uint32_t spixbase = 0x00; spixbase = (uint32_t)SPIx; spixbase += 0x0C; return *(__IO uint8_t *) spixbase; }
ajhc/demo-cortex-m3
C++
null
38
/* WARNING: The hash_table must have no running iterators in it when _cairo_hash_table_destroy is called. It is a fatal error otherwise, and this function will halt. */
void _cairo_hash_table_destroy(cairo_hash_table_t *hash_table)
/* WARNING: The hash_table must have no running iterators in it when _cairo_hash_table_destroy is called. It is a fatal error otherwise, and this function will halt. */ void _cairo_hash_table_destroy(cairo_hash_table_t *hash_table)
{ assert (hash_table->live_entries == 0); assert (hash_table->iterating == 0); free (hash_table->entries); free (hash_table); }
xboot/xboot
C++
MIT License
779
/* Check to see if there are any method tables for this class still in use */
static int check_class_table(struct ib_mad_mgmt_class_table *class)
/* Check to see if there are any method tables for this class still in use */ static int check_class_table(struct ib_mad_mgmt_class_table *class)
{ int i; for (i = 0; i < MAX_MGMT_CLASS; i++) if (class->method_table[i]) return 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* For Td guest TDVMCALL_MMIO is invoked to write MMIO registers. */
UINT8 EFIAPI MmioWrite8(IN UINTN Address, IN UINT8 Value)
/* For Td guest TDVMCALL_MMIO is invoked to write MMIO registers. */ UINT8 EFIAPI MmioWrite8(IN UINTN Address, IN UINT8 Value)
{ BOOLEAN Flag; Flag = FilterBeforeMmIoWrite (FilterWidth8, Address, &Value); if (Flag) { MemoryFence (); if (IsTdxGuest ()) { TdMmioWrite8 (Address, Value); } else { *(volatile UINT8 *)Address = Value; } MemoryFence (); } FilterAfterMmIoWrite (FilterWidth8, Address, &Value); return Value; }
tianocore/edk2
C++
Other
4,240
/* This function handles External lines 9 to 5 interrupt request. */
void EXTI9_5_IRQHandler(void)
/* This function handles External lines 9 to 5 interrupt request. */ void EXTI9_5_IRQHandler(void)
{ GPIO_ResetBits(GPIO_CMDVCC, SC_CMDVCC); GPIO_ResetBits(GPIO_RESET, SC_RESET); GPIO_SetBits(GPIO_RESET, SC_RESET); EXTI_ClearITPendingBit(SC_EXTI); CardInserted = 1; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Make the controller start grabbing images. Everything must be set up before doing this. */
static void cafe_ctlr_start(struct cafe_camera *cam)
/* Make the controller start grabbing images. Everything must be set up before doing this. */ static void cafe_ctlr_start(struct cafe_camera *cam)
{ cafe_reg_set_bit(cam, REG_CTRL0, C0_ENABLE); }
robutest/uclinux
C++
GPL-2.0
60
/* Enables internal loopback mode for a UART port */
void UARTLoopbackEnable(uint32_t ui32Base)
/* Enables internal loopback mode for a UART port */ void UARTLoopbackEnable(uint32_t ui32Base)
{ ASSERT(_UARTBaseValid(ui32Base)); HWREG(ui32Base + UART_O_CTL) |= UART_CTL_LBE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Delays for a desired amount of cycles while also waiting for a status change. */
uint32_t am_hal_flash_delay_status_change(uint32_t ui32usMaxDelay, uint32_t ui32Address, uint32_t ui32Mask, uint32_t ui32Value)
/* Delays for a desired amount of cycles while also waiting for a status change. */ uint32_t am_hal_flash_delay_status_change(uint32_t ui32usMaxDelay, uint32_t ui32Address, uint32_t ui32Mask, uint32_t ui32Value)
{ while ( ui32usMaxDelay-- ) { if ( ( AM_REGVAL(ui32Address) & ui32Mask ) == ui32Value ) { return 1; } am_hal_flash_delay( FLASH_CYCLES_US(1) ); } return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* called when the device is closed. makes sure that the device flushes the internal cache before we close. */
static void pkt_release_dev(struct pktcdvd_device *pd, int flush)
/* called when the device is closed. makes sure that the device flushes the internal cache before we close. */ static void pkt_release_dev(struct pktcdvd_device *pd, int flush)
{ if (flush && pkt_flush_cache(pd)) DPRINTK(DRIVER_NAME": %s not flushing cache\n", pd->name); pkt_lock_door(pd, 0); pkt_set_speed(pd, MAX_SPEED, MAX_SPEED); bd_release(pd->bdev); blkdev_put(pd->bdev, FMODE_READ); pkt_shrink_pktlist(pd); }
robutest/uclinux
C++
GPL-2.0
60
/* Gets the width in pixels of the LCD screen (varies depending on the current screen orientation) */
uint16_t lcdGetWidth(void)
/* Gets the width in pixels of the LCD screen (varies depending on the current screen orientation) */ uint16_t lcdGetWidth(void)
{ return hx8347dProperties.width; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Initialize the Core clock to given frequency (48 or 144 MHz). This function turns on FIRC and select the given frequency as the source of fro_hf. */
status_t CLOCK_SetupFROHFClocking(uint32_t iFreq)
/* Initialize the Core clock to given frequency (48 or 144 MHz). This function turns on FIRC and select the given frequency as the source of fro_hf. */ status_t CLOCK_SetupFROHFClocking(uint32_t iFreq)
{ if ((iFreq != 48000000U) && (iFreq != 144000000U)) { return kStatus_Fail; } SCG0->FIRCCFG = SCG_FIRCCFG_RANGE((iFreq == 48000000U) ? 0 : 1); SCG0->FIRCCSR &= ~SCG_FIRCCSR_LK_MASK; SCG0->FIRCCSR |= SCG_FIRCCSR_FIRC_SCLK_PERIPH_EN_MASK; SCG0->FIRCCSR |= SCG_FIRCCSR_FIRC_FCLK_PERIPH_EN_MASK; SCG0->FIRCCSR |= SCG_FIRCCSR_FIRCEN_MASK; while ((SCG0->FIRCCSR & SCG_FIRCCSR_FIRCVLD_MASK) == 0U) { } return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Allocate a page and add it freelist of given pool. */
static int grow_pool(struct xv_pool *pool, gfp_t flags)
/* Allocate a page and add it freelist of given pool. */ static int grow_pool(struct xv_pool *pool, gfp_t flags)
{ struct page *page; struct block_header *block; page = alloc_page(flags); if (unlikely(!page)) return -ENOMEM; stat_inc(&pool->total_pages); spin_lock(&pool->lock); block = get_ptr_atomic(page, 0, KM_USER0); block->size = PAGE_SIZE - XV_ALIGN; set_flag(block, BLOCK_FREE); clear_flag(block, PREV_FREE); set_blockprev(block, 0); insert_block(pool, page, 0, block); put_ptr_atomic(block, KM_USER0); spin_unlock(&pool->lock); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Convert ch from a hex digit to an int */
static int hex(unsigned char ch)
/* Convert ch from a hex digit to an int */ static int hex(unsigned char ch)
{ if (ch >= 'a' && ch <= 'f') return ch - 'a' + 10; if (ch >= '0' && ch <= '9') return ch - '0'; if (ch >= 'A' && ch <= 'F') return ch - 'A' + 10; return -1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The function is used to Get Bus Clock. */
unsigned long SysCtlBusClkGet(void)
/* The function is used to Get Bus Clock. */ unsigned long SysCtlBusClkGet(void)
{ unsigned long ulHclk = 0, ulBusClk = 0, ulSysDiv; ulHclk = SysCtlHClockGet(); ulSysDiv = (xHWREG(SIM_CLKDIV1) & SIM_CLKDIV1_OUTDIV4_M) >> SIM_CLKDIV1_OUTDIV4_S; ulBusClk = ulHclk/(ulSysDiv+1); return ulBusClk; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Enables or Disables the master & slave Timer synchronous function. */
void TimerSyncConfigure(unsigned long ulBase, unsigned long ulConfigure)
/* Enables or Disables the master & slave Timer synchronous function. */ void TimerSyncConfigure(unsigned long ulBase, unsigned long ulConfigure)
{ xASSERT((ulBase == TIMER1_BASE) || (ulBase == TIMER0_BASE)); xASSERT((ulConfigure == TIMER_SYNC_ENABLE) || (ulConfigure == TIMER_SYNC_DISABLE)); xHWREG(ulBase + TIMER_MDCFR) &= ~TIMER_MDCFR_SMSEL_TSE; xHWREG(ulBase + TIMER_MDCFR) |= ulConfigure; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Check that we have indeed attached to the thing.. */
int ptrace_check_attach(struct task_struct *child, int kill)
/* Check that we have indeed attached to the thing.. */ int ptrace_check_attach(struct task_struct *child, int kill)
{ int ret = -ESRCH; read_lock(&tasklist_lock); if ((child->ptrace & PT_PTRACED) && child->parent == current) { ret = 0; spin_lock_irq(&child->sighand->siglock); if (task_is_stopped(child)) child->state = TASK_TRACED; else if (!task_is_traced(child) && !kill) ret = -ESRCH; spin_unlock_irq(&child->sighand->siglock); } read_unlock(&tasklist_lock); if (!ret && !kill) ret = wait_task_inactive(child, TASK_TRACED) ? 0 : -ESRCH; return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function returns the enabled interrupts read from the Interrupt Mask Register (IPIER). Use the XADCPS_IPIXR_* constants defined in xadcps_hw.h to interpret the returned value. */
u32 XAdcPs_IntrGetEnabled(XAdcPs *InstancePtr)
/* This function returns the enabled interrupts read from the Interrupt Mask Register (IPIER). Use the XADCPS_IPIXR_* constants defined in xadcps_hw.h to interpret the returned value. */ u32 XAdcPs_IntrGetEnabled(XAdcPs *InstancePtr)
{ Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); return (~ XAdcPs_ReadReg(InstancePtr->Config.BaseAddress, XADCPS_INT_MASK_OFFSET) & XADCPS_INTX_ALL_MASK); }
ua1arn/hftrx
C++
null
69
/* Change Logs: Date Author Notes ZYH first version Zohar_Lee format file */
static void bsp_clock_config(void)
/* Change Logs: Date Author Notes ZYH first version Zohar_Lee format file */ static void bsp_clock_config(void)
{ SystemInit(); SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND); SysTick->CTRL |= 0x00000004UL; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Append an active boot option to BootOrder, reallocating the latter if needed. */
STATIC RETURN_STATUS BootOrderAppend(IN OUT BOOT_ORDER *BootOrder, IN OUT ACTIVE_OPTION *ActiveOption)
/* Append an active boot option to BootOrder, reallocating the latter if needed. */ STATIC RETURN_STATUS BootOrderAppend(IN OUT BOOT_ORDER *BootOrder, IN OUT ACTIVE_OPTION *ActiveOption)
{ if (BootOrder->Produced == BootOrder->Allocated) { UINTN AllocatedNew; UINT16 *DataNew; ASSERT (BootOrder->Allocated > 0); AllocatedNew = BootOrder->Allocated * 2; DataNew = ReallocatePool ( BootOrder->Allocated * sizeof (*BootOrder->Data), AllocatedNew * sizeof (*DataNew), BootOrder->Data ); if (DataNew == NULL) { return RETURN_OUT_OF_RESOURCES; } BootOrder->Allocated = AllocatedNew; BootOrder->Data = DataNew; } BootOrder->Data[BootOrder->Produced++] = (UINT16)ActiveOption->BootOption->OptionNumber; ActiveOption->Appended = TRUE; return RETURN_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* This function is used to get gpio interrupt status. */
u8 tls_get_gpio_irq_status(enum tls_io_name gpio_pin)
/* This function is used to get gpio interrupt status. */ u8 tls_get_gpio_irq_status(enum tls_io_name gpio_pin)
{ u32 reg; u8 pin; u16 offset; if (gpio_pin >= WM_IO_PB_00) { pin = gpio_pin - WM_IO_PB_00; offset = TLS_IO_AB_OFFSET; } else { pin = gpio_pin; offset = 0; } reg = tls_reg_read32(HR_GPIO_RIS + offset); if(reg & (0x1 << pin)) return 1; else return 0; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Since loff_t is a 64 bit type we avoid a lot of ABI hassle with a different argument ordering. */
asmlinkage long sys_arm_fadvise64_64(int fd, int advice, loff_t offset, loff_t len)
/* Since loff_t is a 64 bit type we avoid a lot of ABI hassle with a different argument ordering. */ asmlinkage long sys_arm_fadvise64_64(int fd, int advice, loff_t offset, loff_t len)
{ return sys_fadvise64_64(fd, offset, len, advice); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciExpressAnd16(IN UINTN Address, IN UINT16 AndData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ UINT16 EFIAPI PciExpressAnd16(IN UINTN Address, IN UINT16 AndData)
{ ASSERT_INVALID_PCI_ADDRESS (Address); if (Address >= PcdPciExpressBaseSize ()) { return (UINT16)-1; } return MmioAnd16 ((UINTN)GetPciExpressBaseAddress () + Address, AndData); }
tianocore/edk2
C++
Other
4,240
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */
static void expand_constraint(isl_vec *v, unsigned dim, isl_int *c, int *div_map, unsigned n_div)
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */ static void expand_constraint(isl_vec *v, unsigned dim, isl_int *c, int *div_map, unsigned n_div)
{ int i; isl_seq_cpy(v->el, c, 1 + dim); isl_seq_clr(v->el + 1 + dim, v->size - (1 + dim)); for (i = 0; i < n_div; ++i) isl_int_set(v->el[1 + dim + div_map[i]], c[1 + dim + i]); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* param base LPUART peripheral base address. param handle LPUART handle pointer. param count Receive bytes count. retval kStatus_NoTransferInProgress No receive in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */
status_t LPUART_TransferGetReceiveCount(LPUART_Type *base, lpuart_handle_t *handle, uint32_t *count)
/* param base LPUART peripheral base address. param handle LPUART handle pointer. param count Receive bytes count. retval kStatus_NoTransferInProgress No receive in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */ status_t LPUART_TransferGetReceiveCount(LPUART_Type *base, lpuart_handle_t *handle, uint32_t *count)
{ assert(NULL != handle); assert(NULL != count); status_t status = kStatus_Success; size_t tmprxDataSize = handle->rxDataSize; if ((uint8_t)kLPUART_RxIdle == handle->rxState) { status = kStatus_NoTransferInProgress; } else { *count = handle->rxDataSizeAll - tmprxDataSize; } return status; }
eclipse-threadx/getting-started
C++
Other
310
/* Returns the value of ISR for the PIO controller of the pin. Reading this register acknoledges all the ITs. */
unsigned int PIO_GetISR(const Pin *pin)
/* Returns the value of ISR for the PIO controller of the pin. Reading this register acknoledges all the ITs. */ unsigned int PIO_GetISR(const Pin *pin)
{ return (READ(pin->pio, PIO_ISR)); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* To prevent stale data from being read, tmio_nand_hwcontrol() clears tmio->read_good. */
static u_char tmio_nand_read_byte(struct mtd_info *mtd)
/* To prevent stale data from being read, tmio_nand_hwcontrol() clears tmio->read_good. */ static u_char tmio_nand_read_byte(struct mtd_info *mtd)
{ struct tmio_nand *tmio = mtd_to_tmio(mtd); unsigned int data; if (tmio->read_good--) return tmio->read; data = tmio_ioread16(tmio->fcr + FCR_DATA); tmio->read = data >> 8; return data; }
robutest/uclinux
C++
GPL-2.0
60
/* This method will free @invocation, you cannot use it afterwards. */
void _g_freedesktop_dbus_complete_start_service_by_name(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation, guint value)
/* This method will free @invocation, you cannot use it afterwards. */ void _g_freedesktop_dbus_complete_start_service_by_name(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation, guint value)
{ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(u)", value)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Map selected interrupt request to the selected channel. */
void vimChannelMap(uint32 request, uint32 channel, t_isrFuncPTR handler)
/* Map selected interrupt request to the selected channel. */ void vimChannelMap(uint32 request, uint32 channel, t_isrFuncPTR handler)
{ uint32 i,j; i = channel >> 2U; j = channel -(i<<2U); j = 3U-j; j = j<<3U; vimREG->CHANCTRL[i] &= ~(0xFFU << j); vimREG->CHANCTRL[i] |= (request << j); vimRAM->ISR[channel+1] = handler; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Callback function called when a command is received from the cloud. */
int Leds_Controll(const char *str)
/* Callback function called when a command is received from the cloud. */ int Leds_Controll(const char *str)
{ JsonNode *_main = json_decode(str); JsonNode *red = json_find_member(_main, "red"); JsonNode *blue = json_find_member(_main, "blue"); JsonNode *green = json_find_member(_main, "green"); red->number_ = atof(red->string_); blue->number_ = atof(blue->string_); green->number_ = atof(green->string_); cn0410->Controll((float)red->number_, (float)blue->number_, (float)green->number_); json_delete(_main); return 0; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Get the peripheral clock speed for the Timer at base specified. */
uint32_t rcc_get_timer_clk_freq(uint32_t timer __attribute__((unused)))
/* Get the peripheral clock speed for the Timer at base specified. */ uint32_t rcc_get_timer_clk_freq(uint32_t timer __attribute__((unused)))
{ uint8_t ppre = (RCC_CFGR >> RCC_CFGR_PPRE_SHIFT) & RCC_CFGR_PPRE_MASK; return (ppre == RCC_CFGR_PPRE_NODIV) ? rcc_apb1_frequency : 2 * rcc_apb1_frequency; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Rx flow control enable. When Enabled GMAC will decode the rx pause frame and disable the tx for a specified time. */
void synopGMAC_rx_flow_control_enable(synopGMACdevice *gmacdev)
/* Rx flow control enable. When Enabled GMAC will decode the rx pause frame and disable the tx for a specified time. */ void synopGMAC_rx_flow_control_enable(synopGMACdevice *gmacdev)
{ synopGMACSetBits(gmacdev -> MacBase, GmacFlowControl, GmacRxFlowControl); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535