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
/* Status Register (Read Only): Driver will read this register to get the ready/busy status of the IPC block and error status of the IPC command that was just processed by SCU Format: |rfu3(8)|error code(8)|initiator id(8)|cmd id(4)|rfu1(2)|error(1)|busy(1)| */
static int scu_ipc_check_status(struct ipc_regs *regs)
/* Status Register (Read Only): Driver will read this register to get the ready/busy status of the IPC block and error status of the IPC command that was just processed by SCU Format: |rfu3(8)|error code(8)|initiator id(8)|cmd id(4)|rfu1(2)|error(1)|busy(1)| */ static int scu_ipc_check_status(struct ipc_regs *regs)
{ int loop_count = 100000; int status; do { status = readl(&regs->status); if (!(status & BIT(0))) break; udelay(1); } while (--loop_count); if (!loop_count) return -ETIMEDOUT; if (status & BIT(1)) { printf("%s() status=0x%08x\n", __func__, status); return -EIO; } return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Try to release a page associated with block device when the system is under memory pressure. */
static int blkdev_releasepage(struct page *page, gfp_t wait)
/* Try to release a page associated with block device when the system is under memory pressure. */ static int blkdev_releasepage(struct page *page, gfp_t wait)
{ struct super_block *super = BDEV_I(page->mapping->host)->bdev.bd_super; if (super && super->s_op->bdev_try_to_free_page) return super->s_op->bdev_try_to_free_page(super, page, wait); return try_to_free_buffers(page); }
robutest/uclinux
C++
GPL-2.0
60
/* Aggregate handlers for multiple kprobes support - these handlers take care of invoking the individual kprobe handlers on p->list */
static int __kprobes aggr_pre_handler(struct kprobe *p, struct pt_regs *regs)
/* Aggregate handlers for multiple kprobes support - these handlers take care of invoking the individual kprobe handlers on p->list */ static int __kprobes aggr_pre_handler(struct kprobe *p, struct pt_regs *regs)
{ struct kprobe *kp; list_for_each_entry_rcu(kp, &p->list, list) { if (kp->pre_handler && likely(!kprobe_disabled(kp))) { set_kprobe_instance(kp); if (kp->pre_handler(kp, regs)) return 1; } reset_kprobe_instance(); } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The functions for inserting/removing us as a module. */
static int __init gunze_init(void)
/* The functions for inserting/removing us as a module. */ static int __init gunze_init(void)
{ return serio_register_driver(&gunze_drv); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns CR_OK upon successful completion, an error code otherwise. Note that all the out parameters of this method are valid if and only if this method returns CR_OK. */
enum CRStatus cr_input_end_of_input(CRInput *a_this, gboolean *a_end_of_input)
/* Returns CR_OK upon successful completion, an error code otherwise. Note that all the out parameters of this method are valid if and only if this method returns CR_OK. */ enum CRStatus cr_input_end_of_input(CRInput *a_this, gboolean *a_end_of_input)
{ g_return_val_if_fail (a_this && PRIVATE (a_this) && a_end_of_input, CR_BAD_PARAM_ERROR); *a_end_of_input = (PRIVATE (a_this)->next_byte_index >= PRIVATE (a_this)->in_buf_size) ? TRUE : FALSE; return CR_OK; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Depending on the previous state of the MMCs, start, stop or change the sent MMC. This effectively switches the host controller on and off (radio wise). */
int wusbhc_chid_set(struct wusbhc *wusbhc, const struct wusb_ckhdid *chid)
/* Depending on the previous state of the MMCs, start, stop or change the sent MMC. This effectively switches the host controller on and off (radio wise). */ int wusbhc_chid_set(struct wusbhc *wusbhc, const struct wusb_ckhdid *chid)
{ int result = 0; if (memcmp(chid, &wusb_ckhdid_zero, sizeof(chid)) == 0) chid = NULL; mutex_lock(&wusbhc->mutex); if (chid) { if (wusbhc->active) { mutex_unlock(&wusbhc->mutex); return -EBUSY; } wusbhc->chid = *chid; } mutex_unlock(&wusbhc->mutex); if (chid) result = uwb_radio_start(&wusbhc->pal); else uwb_radio_stop(&wusbhc->pal); return result; }
robutest/uclinux
C++
GPL-2.0
60
/* param config transceiver configurations. param bitWidth audio data bitWidth. param mode audio data channel. param saiChannelMask channel mask value to enable. */
void SAI_GetLeftJustifiedConfig(sai_transceiver_t *config, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)
/* param config transceiver configurations. param bitWidth audio data bitWidth. param mode audio data channel. param saiChannelMask channel mask value to enable. */ void SAI_GetLeftJustifiedConfig(sai_transceiver_t *config, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)
{ assert(NULL != config); assert(saiChannelMask != 0U); SAI_GetCommonConfig(config, bitWidth, mode, saiChannelMask); config->frameSync.frameSyncEarly = false; config->frameSync.frameSyncPolarity = kSAI_PolarityActiveHigh; }
eclipse-threadx/getting-started
C++
Other
310
/* @handle: handle of the loaded image @systable: system table */
static int setup(const efi_handle_t img_handle, const struct efi_system_table *systable)
/* @handle: handle of the loaded image @systable: system table */ static int setup(const efi_handle_t img_handle, const struct efi_system_table *systable)
{ void *acpi; systemtab = systable; boottime = systable->boottime; acpi = efi_st_get_config_table(&acpi_guid); fdt = efi_st_get_config_table(&fdt_guid); if (!fdt) { efi_st_error("Missing device tree\n"); return EFI_ST_FAILURE; } if (acpi) { efi_st_error("Found ACPI table and device tree\n"); return EFI_ST_FAILURE; } return EFI_ST_SUCCESS; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function returns zero if the erase counter header contains valid values, and %-EINVAL if not. */
static int self_check_ec_hdr(const struct ubi_device *ubi, int pnum, const struct ubi_ec_hdr *ec_hdr)
/* This function returns zero if the erase counter header contains valid values, and %-EINVAL if not. */ static int self_check_ec_hdr(const struct ubi_device *ubi, int pnum, const struct ubi_ec_hdr *ec_hdr)
{ int err; uint32_t magic; if (!ubi_dbg_chk_io(ubi)) return 0; magic = be32_to_cpu(ec_hdr->magic); if (magic != UBI_EC_HDR_MAGIC) { ubi_err(ubi, "bad magic %#08x, must be %#08x", magic, UBI_EC_HDR_MAGIC); goto fail; } err = validate_ec_hdr(ubi, ec_hdr); if (err) { ubi_err(ubi, "self-check failed for PEB %d", pnum); goto fail; } return 0; fail: ubi_dump_ec_hdr(ec_hdr); dump_stack(); return -EINVAL; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Set a flag to indicate the IRQ in question was received. This is used by the IRQ probe code. */
static irqreturn_t __init probe_intr(int irq, void *dev_id)
/* Set a flag to indicate the IRQ in question was received. This is used by the IRQ probe code. */ static irqreturn_t __init probe_intr(int irq, void *dev_id)
{ probe_irq = irq; return IRQ_HANDLED; }
robutest/uclinux
C++
GPL-2.0
60
/* Like "tvb_format_text_wsp()", but for null-padded strings; don't show the null padding characters as "\000". */
gchar* tvb_format_stringzpad_wsp(tvbuff_t *tvb, const gint offset, const gint size)
/* Like "tvb_format_text_wsp()", but for null-padded strings; don't show the null padding characters as "\000". */ gchar* tvb_format_stringzpad_wsp(tvbuff_t *tvb, const gint offset, const gint size)
{ const guint8 *ptr, *p; gint len; gint stringlen; len = (size > 0) ? size : 0; ptr = ensure_contiguous(tvb, offset, size); for (p = ptr, stringlen = 0; stringlen < len && *p != '\0'; p++, stringlen++) ; return format_text_wsp(ptr, stringlen); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI Sm3HashAll(IN CONST VOID *Data, IN UINTN DataSize, OUT UINT8 *HashValue)
/* If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI Sm3HashAll(IN CONST VOID *Data, IN UINTN DataSize, OUT UINT8 *HashValue)
{ SM3_CTX Ctx; if (HashValue == NULL) { return FALSE; } if ((Data == NULL) && (DataSize != 0)) { return FALSE; } ossl_sm3_init (&Ctx); ossl_sm3_update (&Ctx, Data, DataSize); ossl_sm3_final (HashValue, &Ctx); return TRUE; }
tianocore/edk2
C++
Other
4,240
/* Bind this to Shift-NumLock if you work in application keypad mode but want to be able to change the NumLock flag. Bind this to NumLock if you prefer that the NumLock key always changes the NumLock flag. */
static void fn_bare_num(struct vc_data *vc)
/* Bind this to Shift-NumLock if you work in application keypad mode but want to be able to change the NumLock flag. Bind this to NumLock if you prefer that the NumLock key always changes the NumLock flag. */ static void fn_bare_num(struct vc_data *vc)
{ if (!rep) chg_vc_kbd_led(kbd, VC_NUMLOCK); }
robutest/uclinux
C++
GPL-2.0
60
/* Uses the scalar orientation value to convert from chip frame to body frame and apply appropriate scaling. */
void inv_convert_to_body_with_scale(unsigned short orientation, long sensitivity, const long *input, long *output)
/* Uses the scalar orientation value to convert from chip frame to body frame and apply appropriate scaling. */ void inv_convert_to_body_with_scale(unsigned short orientation, long sensitivity, const long *input, long *output)
{ output[0] = inv_q30_mult(input[orientation & 0x03] * SIGNSET(orientation & 0x004), sensitivity); output[1] = inv_q30_mult(input[(orientation>>3) & 0x03] * SIGNSET(orientation & 0x020), sensitivity); output[2] = inv_q30_mult(input[(orientation>>6) & 0x03] * SIGNSET(orientation & 0x100), sensitivity); }
Luos-io/luos_engine
C++
MIT License
496
/* The fd_write() callback, invoked if the fd is marked as writable after a poll. Unregister the handler and flush any buffered packets. */
static void netmap_writable(void *opaque)
/* The fd_write() callback, invoked if the fd is marked as writable after a poll. Unregister the handler and flush any buffered packets. */ static void netmap_writable(void *opaque)
{ NetmapState *s = opaque; netmap_write_poll(s, false); qemu_flush_queued_packets(&s->nc); }
ve3wwg/teensy3_qemu
C++
Other
15
/* 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_WM8904_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_WM8904_SetPower(void *handle, uint32_t module, bool powerOn)
{ assert(handle != NULL); return WM8904_SetModulePower((wm8904_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), HAL_WM8904_MAP_MODULE(module), powerOn); }
eclipse-threadx/getting-started
C++
Other
310
/* Get ultra low frequency RC oscillator clock frequency for target system. */
uint32_t SystemULFRCOClockGet(void)
/* Get ultra low frequency RC oscillator clock frequency for target system. */ uint32_t SystemULFRCOClockGet(void)
{ return EFR32_ULFRCO_FREQ; }
eclipse-threadx/getting-started
C++
Other
310
/* Checks the string for indicators of "flag" status. this is a leading '/', '-', or '+' */
BOOLEAN InternalIsFlag(IN CONST CHAR16 *Name, IN CONST BOOLEAN AlwaysAllowNumbers, IN CONST BOOLEAN TimeNumbers)
/* Checks the string for indicators of "flag" status. this is a leading '/', '-', or '+' */ BOOLEAN InternalIsFlag(IN CONST CHAR16 *Name, IN CONST BOOLEAN AlwaysAllowNumbers, IN CONST BOOLEAN TimeNumbers)
{ ASSERT (Name != NULL); if ((((Name[0] == L'-') || (Name[0] == L'+')) && InternalShellIsHexOrDecimalNumber (Name+1, FALSE, FALSE, TimeNumbers)) && AlwaysAllowNumbers) { return (FALSE); } if ((Name[0] == L'/') || (Name[0] == L'-') || (Name[0] == L'+') ) { return (TRUE); } return (FALSE); }
tianocore/edk2
C++
Other
4,240
/* RCC Disable Bypass. Re-enable the internal clock (high speed and low speed clocks only). The internal clock must be disabled (see */
void rcc_osc_bypass_disable(enum rcc_osc osc)
/* RCC Disable Bypass. Re-enable the internal clock (high speed and low speed clocks only). The internal clock must be disabled (see */ void rcc_osc_bypass_disable(enum rcc_osc osc)
{ switch (osc) { case RCC_HSE: RCC_CR &= ~RCC_CR_HSEBYP; break; case RCC_LSE: RCC_BDCR &= ~RCC_BDCR_LSEBYP; break; case RCC_PLL: case RCC_PLL2: case RCC_PLL3: case RCC_HSI: case RCC_LSI: break; } }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Set the slave select pins of the specified SPI port. The */
void xSPISSSet(unsigned long ulBase, unsigned long ulSSMode, unsigned long ulSlaveSel)
/* Set the slave select pins of the specified SPI port. The */ void xSPISSSet(unsigned long ulBase, unsigned long ulSSMode, unsigned long ulSlaveSel)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) || (ulBase == SPI3_BASE)); xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0) || (ulSlaveSel == SPI_SS1) || (ulSlaveSel == SPI_SS0_SS1)); xHWREG(ulBase + SPI_SSR) |= ulSSMode; xHWREG(ulBase + SPI_SSR) &= ~SPI_SSR_SSR_M; xHWREG(ulBase + SPI_SSR) |= ulSlaveSel; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Programs a half word at a specified Option Byte Data address. */
FLASH_STS FLASH_ProgramOBData(uint32_t Address, uint32_t Data)
/* Programs a half word at a specified Option Byte Data address. */ FLASH_STS FLASH_ProgramOBData(uint32_t Address, uint32_t Data)
{ FLASH_STS status = FLASH_COMPL; assert_param(IS_OB_DATA_ADDRESS(Address)); if (FLASH_GetReadOutProtectionL2STS() != RESET) { status = FLASH_ERR_RDP2; return status; } FLASH_ClearFlag(FLASH_STS_CLRFLAG); status = FLASH_WaitForLastOpt(ProgramTimeout); if (status == FLASH_COMPL) { FLASH->OPTKEY = FLASH_KEY1; FLASH->OPTKEY = FLASH_KEY2; FLASH->CTRL |= CTRL_Set_OPTPG; *(__IO uint32_t*)Address = (uint32_t)Data; status = FLASH_WaitForLastOpt(ProgramTimeout); if (status != FLASH_TIMEOUT) { FLASH->CTRL &= CTRL_Reset_OPTPG; } } return status; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Enable a riscv PLIC-specific interrupt line. This routine enables a RISCV PLIC-specific interrupt line. riscv_plic_irq_enable is called by RISCV_PRIVILEGED arch_irq_enable function to enable external interrupts for IRQS level == 2, whenever CONFIG_RISCV_HAS_PLIC variable is set. */
void riscv_plic_irq_enable(uint32_t irq)
/* Enable a riscv PLIC-specific interrupt line. This routine enables a RISCV PLIC-specific interrupt line. riscv_plic_irq_enable is called by RISCV_PRIVILEGED arch_irq_enable function to enable external interrupts for IRQS level == 2, whenever CONFIG_RISCV_HAS_PLIC variable is set. */ void riscv_plic_irq_enable(uint32_t irq)
{ plic_irq_enable_set_state(irq, true); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Description: This function is designed to be used as a callback to the call_rcu() function so that memory allocated to a hash table node entry can be released safely. */
static void sel_netnode_free(struct rcu_head *p)
/* Description: This function is designed to be used as a callback to the call_rcu() function so that memory allocated to a hash table node entry can be released safely. */ static void sel_netnode_free(struct rcu_head *p)
{ struct sel_netnode *node = container_of(p, struct sel_netnode, rcu); kfree(node); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* There are three register spaces: two per-channel ones and a shared one. We have to define accessors appropriately. All registers are 64-bit and all but the Baud Rate Clock registers only define 8 least significant bits. There is also a workaround to take into account. Raw accessors use the full register width, but cooked ones truncate it intentionally so that the rest of the driver does not care. */
static u64 __read_sbdchn(struct sbd_port *sport, int reg)
/* There are three register spaces: two per-channel ones and a shared one. We have to define accessors appropriately. All registers are 64-bit and all but the Baud Rate Clock registers only define 8 least significant bits. There is also a workaround to take into account. Raw accessors use the full register width, but cooked ones truncate it intentionally so that the rest of the driver does not care. */ static u64 __read_sbdchn(struct sbd_port *sport, int reg)
{ void __iomem *csr = sport->port.membase + reg; return __raw_readq(csr); }
robutest/uclinux
C++
GPL-2.0
60
/* brief DMA instance 0, channel 13 IRQ handler. */
void EDMA_0_CH13_DriverIRQHandler(void)
/* brief DMA instance 0, channel 13 IRQ handler. */ void EDMA_0_CH13_DriverIRQHandler(void)
{ EDMA_DriverIRQHandler(0U, 13U); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set L3 Destination address filter value of IPv4. */
void ETH_MAC_SetIpv4DestAddrFilterValue(uint32_t u32Addr)
/* Set L3 Destination address filter value of IPv4. */ void ETH_MAC_SetIpv4DestAddrFilterValue(uint32_t u32Addr)
{ WRITE_REG32(CM_ETH->MAC_L3ADDRR1, u32Addr); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */
static struct isl_vec* empty_sample(struct isl_basic_set *bset)
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */ static struct isl_vec* empty_sample(struct isl_basic_set *bset)
{ struct isl_vec *vec; vec = isl_vec_alloc(bset->ctx, 0); isl_basic_set_free(bset); return vec; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* In case trace filter starts with "C" character then all following characters are interpreted as command. Followings commands are available: */
static int diva_mnt_cmp_nmbr(const char *nmbr)
/* In case trace filter starts with "C" character then all following characters are interpreted as command. Followings commands are available: */ static int diva_mnt_cmp_nmbr(const char *nmbr)
{ if (diva_dbg_cmp_key (&ref[1], "single")) { return (0); } return (-1); } if (!ref_len || (ref_len > nmbr_len)) { return (-1); } nmbr = nmbr + nmbr_len - 1; ref = ref + ref_len - 1; while (ref_len--) { if (*nmbr-- != *ref--) { return (-1); } } return (0); }
robutest/uclinux
C++
GPL-2.0
60
/* Clears or safeguards the OCREF2 signal on an external event. */
void TMR_ClearOC2Ref(TMR_T *tmr, TMR_OC_CLEAR_T OCClear)
/* Clears or safeguards the OCREF2 signal on an external event. */ void TMR_ClearOC2Ref(TMR_T *tmr, TMR_OC_CLEAR_T OCClear)
{ tmr->CCM1_COMPARE_B.OC2CEN = OCClear; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Get a position value according to Position Huffman Table. */
UINT32 DecodeP(IN SCRATCH_DATA *Sd)
/* Get a position value according to Position Huffman Table. */ UINT32 DecodeP(IN SCRATCH_DATA *Sd)
{ UINT16 Val; UINT32 Mask; UINT32 Pos; Val = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)]; if (Val >= MAXNP) { Mask = 1U << (BITBUFSIZ - 1 - 8); do { if ((Sd->mBitBuf & Mask) != 0) { Val = Sd->mRight[Val]; } else { Val = Sd->mLeft[Val]; } Mask >>= 1; } while (Val >= MAXNP); } FillBuf (Sd, Sd->mPTLen[Val]); Pos = Val; if (Val > 1) { Pos = (UINT32)((1U << (Val - 1)) + GetBits (Sd, (UINT16)(Val - 1))); } return Pos; }
tianocore/edk2
C++
Other
4,240
/* Clears bits in UDCCR, leaving DME and FST bits as they were. */
static void udc_clear_mask_UDCCR(struct pxa_udc *udc, int mask)
/* Clears bits in UDCCR, leaving DME and FST bits as they were. */ static void udc_clear_mask_UDCCR(struct pxa_udc *udc, int mask)
{ u32 udccr = udc_readl(udc, UDCCR); udc_writel(udc, UDCCR, (udccr & UDCCR_MASK_BITS) & ~(mask & UDCCR_MASK_BITS)); }
robutest/uclinux
C++
GPL-2.0
60
/* invalidate_bh_lrus() is called rarely - but not only at unmount. This doesn't race because it runs in each cpu either in irq or with preempt disabled. */
static void invalidate_bh_lru(void *arg)
/* invalidate_bh_lrus() is called rarely - but not only at unmount. This doesn't race because it runs in each cpu either in irq or with preempt disabled. */ static void invalidate_bh_lru(void *arg)
{ struct bh_lru *b = &get_cpu_var(bh_lrus); int i; for (i = 0; i < BH_LRU_SIZE; i++) { brelse(b->bhs[i]); b->bhs[i] = NULL; } put_cpu_var(bh_lrus); }
robutest/uclinux
C++
GPL-2.0
60
/* Clears out all files from the Fv buffer in memory */
EFI_STATUS FvBufChecksumHeader(IN OUT VOID *Fv)
/* Clears out all files from the Fv buffer in memory */ EFI_STATUS FvBufChecksumHeader(IN OUT VOID *Fv)
{ EFI_FIRMWARE_VOLUME_HEADER* FvHeader = (EFI_FIRMWARE_VOLUME_HEADER*)Fv; FvHeader->Checksum = 0; FvHeader->Checksum = FvBufCalculateChecksum16 ( (UINT16*) FvHeader, FvHeader->HeaderLength / sizeof (UINT16) ); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* step13 of enumeration - Get all USB configuration descriptor */
static void main_usb_enum_step13(void)
/* step13 of enumeration - Get all USB configuration descriptor */ static void main_usb_enum_step13(void)
{ main_usb_wait_setup_packet(); main_conf_desc.conf.bLength = sizeof(usb_conf_desc_t); main_conf_desc.conf.bDescriptorType = USB_DT_CONFIGURATION; main_conf_desc.conf.bMaxPower = USB_CONFIG_MAX_POWER(USB_DEVICE_POWER), main_conf_desc.conf.bmAttributes = USB_CONFIG_ATTR_MUST_SET | USB_DEVICE_ATTR, main_conf_desc.iface.bInterfaceProtocol = HID_PROTOCOL_MOUSE; main_conf_desc.ep.wMaxPacketSize = LE16(8); main_usb_send_in((uint8_t*)&main_conf_desc, sizeof(main_conf_desc)); main_usb_wait_out(NULL,0); }
remotemcu/remcu-chip-sdks
C++
null
436
/* start lcs device and make it runnable This function will be called by user doing ifconfig xxx up */
static int lcs_open_device(struct net_device *dev)
/* start lcs device and make it runnable This function will be called by user doing ifconfig xxx up */ static int lcs_open_device(struct net_device *dev)
{ struct lcs_card *card; int rc; LCS_DBF_TEXT(2, trace, "opendev"); card = (struct lcs_card *) dev->ml_priv; rc = lcs_detect(card); if (rc) { pr_err("Error in opening device!\n"); } else { dev->flags |= IFF_UP; netif_carrier_on(dev); netif_wake_queue(dev); card->state = DEV_STATE_UP; } return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* Add an exported symbol - it may have already been added without a CRC, in this case just update the CRC */
static struct symbol* sym_add_exported(const char *name, struct module *mod, enum export export)
/* Add an exported symbol - it may have already been added without a CRC, in this case just update the CRC */ static struct symbol* sym_add_exported(const char *name, struct module *mod, enum export export)
{ struct symbol *s = find_symbol(name); if (!s) { s = new_symbol(name, mod, export); } else { if (!s->preloaded) { warn("%s: '%s' exported twice. Previous export " "was in %s%s\n", mod->name, name, s->module->name, is_vmlinux(s->module->name) ?"":".ko"); } else { s->module = mod; } } s->preloaded = 0; s->vmlinux = is_vmlinux(mod->name); s->kernel = 0; s->export = export; return s; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initializes the display with explanatory text for the buttons. */
static void init_display(void)
/* Initializes the display with explanatory text for the buttons. */ static void init_display(void)
{ gfx_mono_draw_circle(10, SQUARE3_Y, CIRCLE_SIZE, GFX_PIXEL_SET, GFX_WHOLE); gfx_mono_draw_circle((LCD_WIDTH_PIXELS / 3) + 10, SQUARE3_Y, CIRCLE_SIZE, GFX_PIXEL_SET, GFX_WHOLE); gfx_mono_draw_circle((LCD_WIDTH_PIXELS / 3) * 2 + 10, SQUARE3_Y, CIRCLE_SIZE, GFX_PIXEL_SET, GFX_WHOLE); gfx_mono_draw_string("LEFT", 0, SQUARE6_Y, &sysfont); gfx_mono_draw_string("OK", (LCD_WIDTH_PIXELS / 3), SQUARE6_Y, &sysfont); gfx_mono_draw_string("RIGHT", (LCD_WIDTH_PIXELS / 3) * 2, SQUARE6_Y, &sysfont); }
memfault/zero-to-main
C++
null
200
/* Enable the ETH DMA Rx Desc receive interrupt. */
void ETH_EnableDMARxDescReceiveInterrupt(ETH_DMADescConfig_T *DMARxDesc)
/* Enable the ETH DMA Rx Desc receive interrupt. */ void ETH_EnableDMARxDescReceiveInterrupt(ETH_DMADescConfig_T *DMARxDesc)
{ DMARxDesc->ControlBufferSize &=(~(uint32_t)ETH_DMARXDESC_DINTC); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Released under the terms of the GNU GPL v2.0. */
struct file* file_lookup(const char *name)
/* Released under the terms of the GNU GPL v2.0. */ struct file* file_lookup(const char *name)
{ struct file *file; char *file_name = sym_expand_string_value(name); for (file = file_list; file; file = file->next) { if (!strcmp(name, file->name)) { free(file_name); return file; } } file = xmalloc(sizeof(*file)); memset(file, 0, sizeof(*file)); file->name = file_name; file->next = file_list; file_list = file; return file; }
4ms/stm32mp1-baremetal
C++
Other
137
/* TCP Reno congestion control This is special case used for fallback as well. */
void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
/* TCP Reno congestion control This is special case used for fallback as well. */ void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
{ struct tcp_sock *tp = tcp_sk(sk); if (!tcp_is_cwnd_limited(sk, in_flight)) return; if (tp->snd_cwnd <= tp->snd_ssthresh) tcp_slow_start(tp); else if (sysctl_tcp_abc) { if (tp->bytes_acked >= tp->snd_cwnd*tp->mss_cache) { tp->bytes_acked -= tp->snd_cwnd*tp->mss_cache; if (tp->snd_cwnd < tp->snd_cwnd_clamp) tp->snd_cwnd++; } } else { tcp_cong_avoid_ai(tp, tp->snd_cwnd); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Alternate function GPIO pins. Configure a group of Pins in alternate function. */
void gpio_set_af(uint32_t gpioport, uint8_t af, uint32_t gpios)
/* Alternate function GPIO pins. Configure a group of Pins in alternate function. */ void gpio_set_af(uint32_t gpioport, uint8_t af, uint32_t gpios)
{ uint32_t reg = PORT_WRCONFIG_WRPINCFG | PORT_WRCONFIG_WRPMUX | PORT_WRCONFIG_PMUX(af) | PORT_WRCONFIG_PMUXEN; PORT_WRCONFIG(gpioport) = reg | PORT_WRCONFIG_PINMASK(gpios); PORT_WRCONFIG(gpioport) = reg | PORT_WRCONFIG_HWSEL | PORT_WRCONFIG_PINMASK(gpios >> 16); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Disables GPIO pins and USART from FPGA register access. */
static void SPI_BC_Disable(void)
/* Disables GPIO pins and USART from FPGA register access. */ static void SPI_BC_Disable(void)
{ USART_Reset(USART_USED); GPIO_PinModeSet(PORT_SPI_TX, PIN_SPI_TX, gpioModeDisabled, 0); GPIO_PinModeSet(PORT_SPI_RX, PIN_SPI_RX, gpioModeDisabled, 0); GPIO_PinModeSet(PORT_SPI_CLK, PIN_SPI_CLK, gpioModeDisabled, 0); GPIO_PinModeSet(PORT_SPI_CS, PIN_SPI_CS, gpioModeDisabled, 0); CMU_ClockEnable(USART_CLK, false); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reset the text output device hardware and optionally run diagnostics */
EFI_STATUS EFIAPI ConsoleLoggerReset(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
/* Reset the text output device hardware and optionally run diagnostics */ EFI_STATUS EFIAPI ConsoleLoggerReset(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
{ EFI_STATUS Status; CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo; ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This); Status = ConsoleInfo->OldConOut->Reset (ConsoleInfo->OldConOut, ExtendedVerification); if (!EFI_ERROR (Status)) { ConsoleLoggerResetBuffers (ConsoleInfo); if (ExtendedVerification) { ConsoleInfo->OriginalStartRow = 0; ConsoleInfo->CurrentStartRow = 0; } } return Status; }
tianocore/edk2
C++
Other
4,240
/* Write a data to the slave when the bus is idle, and waiting for all bus transmiton complete.(Write Step1) This function is always used in thread mode. */
unsigned long xI2CMasterWriteS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char ucData, xtBoolean bEndTransmition)
/* Write a data to the slave when the bus is idle, and waiting for all bus transmiton complete.(Write Step1) This function is always used in thread mode. */ unsigned long xI2CMasterWriteS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char ucData, xtBoolean bEndTransmition)
{ unsigned long ulStatus; xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE) || (ulBase == I2C2_BASE) || (ulBase == I2C3_BASE) || (ulBase == I2C4_BASE)); xASSERT(!(ucSlaveAddr & 0x80)); xI2CMasterWriteRequestS1(ulBase, ucSlaveAddr, ucData, xfalse); while (!(xHWREG(ulBase + I2C_CON) & I2C_CON_SI)); ulStatus = xHWREG(ulBase + I2C_STATUS) & I2C_STATUS_M; if(!(ulStatus == I2C_I2STAT_M_TX_DAT_ACK)) { ulStatus = xI2CMasterError(ulBase); I2CStopSend(ulBase); return ulStatus; } if(bEndTransmition) { I2CStopSend(ulBase); } return xI2C_MASTER_ERR_NONE; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Function finding a free position in m_im.connections. @detail All connection handles in the m_im.connections array are checked against the connection state module. The index of the first one that is not a connection handle for a current connection is returned. This position in the array can safely be used for a new connection. */
uint8_t get_free_connection()
/* Function finding a free position in m_im.connections. @detail All connection handles in the m_im.connections array are checked against the connection state module. The index of the first one that is not a connection handle for a current connection is returned. This position in the array can safely be used for a new connection. */ uint8_t get_free_connection()
{ for (uint32_t i = 0; i < IM_MAX_CONN_HANDLES; i++) { if (!ble_conn_state_user_flag_get(m_im.connections[i].conn_handle, m_im.conn_state_user_flag_id)) { return i; } } return IM_NO_INVALID_CONN_HANDLES; }
labapart/polymcu
C++
null
201
/* Calculate the final channel that we should advertise upon when we start an advertising event. */
static uint8_t ble_ll_adv_final_chan(struct ble_ll_adv_sm *advsm)
/* Calculate the final channel that we should advertise upon when we start an advertising event. */ static uint8_t ble_ll_adv_final_chan(struct ble_ll_adv_sm *advsm)
{ uint8_t adv_chan; if (advsm->adv_chanmask & 0x04) { adv_chan = BLE_PHY_ADV_CHAN_START + 2; } else if (advsm->adv_chanmask & 0x02) { adv_chan = BLE_PHY_ADV_CHAN_START + 1; } else { adv_chan = BLE_PHY_ADV_CHAN_START; } return adv_chan; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Checks if a netmask is valid (starting with ones, then only zeros) */
u8_t ip4_addr_netmask_valid(u32_t netmask)
/* Checks if a netmask is valid (starting with ones, then only zeros) */ u8_t ip4_addr_netmask_valid(u32_t netmask)
{ u32_t mask; u32_t nm_hostorder = lwip_htonl(netmask); for (mask = 1U << 31 ; mask != 0; mask >>= 1) { if ((nm_hostorder & mask) == 0) { break; } } for (; mask != 0; mask >>= 1) { if ((nm_hostorder & mask) != 0) { return 0; } } return 1; }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* ZSTD_getDictID_fromDict() : Provides the dictID stored within dictionary. if */
unsigned ZSTD_getDictID_fromDict(const void *dict, size_t dictSize)
/* ZSTD_getDictID_fromDict() : Provides the dictID stored within dictionary. if */ unsigned ZSTD_getDictID_fromDict(const void *dict, size_t dictSize)
{ if (dictSize < 8) return 0; if (ZSTD_readLE32(dict) != ZSTD_DICT_MAGIC) return 0; return ZSTD_readLE32((const char *)dict + 4); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Sets the "is_symlink" attribute in a #GFileInfo according to @is_symlink. See G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK. */
void g_file_info_set_is_symlink(GFileInfo *info, gboolean is_symlink)
/* Sets the "is_symlink" attribute in a #GFileInfo according to @is_symlink. See G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK. */ void g_file_info_set_is_symlink(GFileInfo *info, gboolean is_symlink)
{ static guint32 attr = 0; GFileAttributeValue *value; g_return_if_fail (G_IS_FILE_INFO (info)); if (attr == 0) attr = lookup_attribute (G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK); value = g_file_info_create_value (info, attr); if (value) _g_file_attribute_value_set_boolean (value, is_symlink); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* allocate the set of arrays for certs, cert_len, key */
static void vcard_emul_alloc_arrays(unsigned char ***certsp, int **cert_lenp, VCardKey ***keysp, int cert_count)
/* allocate the set of arrays for certs, cert_len, key */ static void vcard_emul_alloc_arrays(unsigned char ***certsp, int **cert_lenp, VCardKey ***keysp, int cert_count)
{ *certsp = (unsigned char **)g_malloc(sizeof(unsigned char *)*cert_count); *cert_lenp = (int *)g_malloc(sizeof(int)*cert_count); *keysp = (VCardKey **)g_malloc(sizeof(VCardKey *)*cert_count); }
ve3wwg/teensy3_qemu
C++
Other
15
/* Wait for command inhibit(CMD) and command inhibit(DAT) idle for issuing next SD/MMC command. */
static int usdhc_wait_cmd_data_lines(uint32_t instance, int data_present)
/* Wait for command inhibit(CMD) and command inhibit(DAT) idle for issuing next SD/MMC command. */ static int usdhc_wait_cmd_data_lines(uint32_t instance, int data_present)
{ int count = ZERO; while (HW_USDHC_PRES_STATE(instance).B.CIHB) { if (count == ESDHC_CIHB_CHK_COUNT) { return FAIL; } count++; hal_delay_us(ESDHC_STATUS_CHK_TIMEOUT); } if (data_present == DATA_PRESENT) { count = ZERO; while (HW_USDHC_PRES_STATE(instance).B.CDIHB) { if (count == ESDHC_CDIHB_CHK_COUNT) { return FAIL; } count++; hal_delay_us(ESDHC_STATUS_CHK_TIMEOUT); } } return SUCCESS; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This routine prepares the mailbox command for reading information stored in the HBA's NVRAM. Specifically, the HBA's WWNN and WWPN. */
void lpfc_read_nv(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
/* This routine prepares the mailbox command for reading information stored in the HBA's NVRAM. Specifically, the HBA's WWNN and WWPN. */ void lpfc_read_nv(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
{ MAILBOX_t *mb; mb = &pmb->u.mb; memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); mb->mbxCommand = MBX_READ_NV; mb->mbxOwner = OWN_HOST; return; }
robutest/uclinux
C++
GPL-2.0
60
/* Read all bytes waiting in the PS2 port. There should be at the most one, but we loop for safety. */
static irqreturn_t altera_ps2_rxint(int irq, void *dev_id)
/* Read all bytes waiting in the PS2 port. There should be at the most one, but we loop for safety. */ static irqreturn_t altera_ps2_rxint(int irq, void *dev_id)
{ struct ps2if *ps2if = dev_id; unsigned int status; int handled = IRQ_NONE; while ((status = readl(ps2if->base)) & 0xffff0000) { serio_interrupt(ps2if->io, status & 0xff, 0); handled = IRQ_HANDLED; } return handled; }
robutest/uclinux
C++
GPL-2.0
60
/* Waits for a Flash operation to complete or a TIMEOUT to occur. */
FLASH_Status FLASH_WaitForLastOperation(u32 time_out)
/* Waits for a Flash operation to complete or a TIMEOUT to occur. */ FLASH_Status FLASH_WaitForLastOperation(u32 time_out)
{ u32 i; FLASH_Status ret; do { ret = FLASH_GetStatus(); time_out--; for (i = 0xFF; i != 0; i--) ; } while ((ret == FLASH_BUSY) && (time_out != 0x00)); FLASH->CR = 0; FLASH->SR = FLASH_SR_EOP | FLASH_SR_WRPRTERR | FLASH_SR_PGERR; return (FLASH_Status)((time_out == 0x00) ? FLASH_TIMEOUT : ret); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* USART Wait for Received Data Available. Blocks until the receive data buffer holds a valid received data word. */
void usart_wait_recv_ready(uint32_t usart)
/* USART Wait for Received Data Available. Blocks until the receive data buffer holds a valid received data word. */ void usart_wait_recv_ready(uint32_t usart)
{ while ((USART_SR(usart) & USART_SR_RXNE) == 0); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Sets the attribute value to a given signed 64-bit integer. */
void _g_file_attribute_value_set_int64(GFileAttributeValue *attr, gint64 value)
/* Sets the attribute value to a given signed 64-bit integer. */ void _g_file_attribute_value_set_int64(GFileAttributeValue *attr, gint64 value)
{ g_return_if_fail (attr != NULL); _g_file_attribute_value_clear (attr); attr->type = G_FILE_ATTRIBUTE_TYPE_INT64; attr->u.int64 = value; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Read the EFI variable (VendorGuid/Name) and return a dynamically allocated buffer, and the size of the buffer. If failure return NULL. */
VOID* EFIAPI GetVariableAndSize(IN CHAR16 *Name, IN EFI_GUID *VendorGuid, OUT UINTN *VariableSize)
/* Read the EFI variable (VendorGuid/Name) and return a dynamically allocated buffer, and the size of the buffer. If failure return NULL. */ VOID* EFIAPI GetVariableAndSize(IN CHAR16 *Name, IN EFI_GUID *VendorGuid, OUT UINTN *VariableSize)
{ EFI_STATUS Status; UINTN BufferSize; VOID *Buffer; Buffer = NULL; BufferSize = 0; Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer); if (Status == EFI_BUFFER_TOO_SMALL) { Buffer = AllocateZeroPool (BufferSize); if (Buffer == NULL) { return NULL; } Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer); if (EFI_ERROR (Status)) { BufferSize = 0; } } *VariableSize = BufferSize; return Buffer; }
tianocore/edk2
C++
Other
4,240
/* fill the target region with a given 32bit colour */
arm_fsm_rt_t arm_2dp_rgb32_fill_colour(arm_2d_op_fill_cl_t *ptOP, const arm_2d_tile_t *ptTarget, const arm_2d_region_t *ptRegion, uint32_t wColour)
/* fill the target region with a given 32bit colour */ arm_fsm_rt_t arm_2dp_rgb32_fill_colour(arm_2d_op_fill_cl_t *ptOP, const arm_2d_tile_t *ptTarget, const arm_2d_region_t *ptRegion, uint32_t wColour)
{ assert(NULL != ptTarget); ARM_2D_IMPL(arm_2d_op_fill_cl_t, ptOP); if (!__arm_2d_op_acquire((arm_2d_op_core_t *)ptThis)) { return arm_fsm_rt_on_going; } OP_CORE.ptOp = &ARM_2D_OP_FILL_COLOUR_RGB32; this.Target.ptTile = ptTarget; this.Target.ptRegion = ptRegion; this.wColour = wColour; return __arm_2d_op_invoke((arm_2d_op_core_t *)ptThis); }
pikasTech/PikaPython
C++
MIT License
1,403
/* initialize _native_null_in_pipe to allow for reading from stdin */
void _native_null_in(char *stdiotype)
/* initialize _native_null_in_pipe to allow for reading from stdin */ void _native_null_in(char *stdiotype)
{ if (real_pipe(_native_null_in_pipe) == -1) { err(EXIT_FAILURE, "_native_null_in(): pipe()"); } if (strcmp(stdiotype, "stdio") == 0) { return; } if (real_dup2(_native_null_in_pipe[0], STDIN_FILENO) == -1) { err(EXIT_FAILURE, "_native_null_in: dup2(STDIN_FILENO)"); } }
labapart/polymcu
C++
null
201
/* It will perform CPU features initialization, except for PcdCpuFeaturesInitOnS3Resume is FALSE on S3 resume. */
EFI_STATUS EFIAPI CpuFeaturesPeimInitialize(IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
/* It will perform CPU features initialization, except for PcdCpuFeaturesInitOnS3Resume is FALSE on S3 resume. */ EFI_STATUS EFIAPI CpuFeaturesPeimInitialize(IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
{ EFI_STATUS Status; EFI_BOOT_MODE BootMode; Status = PeiServicesGetBootMode (&BootMode); ASSERT_EFI_ERROR (Status); if ((BootMode == BOOT_ON_S3_RESUME) && !PcdGetBool (PcdCpuFeaturesInitOnS3Resume)) { return EFI_SUCCESS; } CpuFeaturesDetect (); CpuFeaturesInitialize (); Status = PeiServicesInstallPpi (&mPeiCpuFeaturesInitDonePpiDesc); ASSERT_EFI_ERROR (Status); BuildGuidHob (&gEdkiiCpuFeaturesInitDoneGuid, 0); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* The pressure offset value is 16-bit data that can be used to implement one-point calibration (OPC) after soldering.. */
int32_t lps22hb_pressure_offset_get(stmdev_ctx_t *ctx, uint8_t *buff)
/* The pressure offset value is 16-bit data that can be used to implement one-point calibration (OPC) after soldering.. */ int32_t lps22hb_pressure_offset_get(stmdev_ctx_t *ctx, uint8_t *buff)
{ int32_t ret; ret = lps22hb_read_reg(ctx, LPS22HB_RPDS_L, buff, 2); return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* 'write_file()' - Copy a file to the output. */
static void write_file(FILE *out, const char *file)
/* 'write_file()' - Copy a file to the output. */ static void write_file(FILE *out, const char *file)
{ FILE *fp; char line[8192]; if ((fp = fopen(file, "r")) == NULL) { fprintf(stderr, "mxmldoc: Unable to open \"%s\": %s\n", file, strerror(errno)); return; } while (fgets(line, sizeof(line), fp)) fputs(line, out); fclose(fp); }
DC-SWAT/DreamShell
C++
null
404
/* This is called from eventpoll_release() to unlink files from the eventpoll interface. We need to have this facility to cleanup correctly files that are closed without being removed from the eventpoll interface. */
void eventpoll_release_file(struct file *file)
/* This is called from eventpoll_release() to unlink files from the eventpoll interface. We need to have this facility to cleanup correctly files that are closed without being removed from the eventpoll interface. */ void eventpoll_release_file(struct file *file)
{ struct list_head *lsthead = &file->f_ep_links; struct eventpoll *ep; struct epitem *epi; mutex_lock(&epmutex); while (!list_empty(lsthead)) { epi = list_first_entry(lsthead, struct epitem, fllink); ep = epi->ep; list_del_init(&epi->fllink); mutex_lock(&ep->mtx); ep_remove(ep, epi); mutex_unlock(&ep->mtx); } mutex_unlock(&epmutex); }
robutest/uclinux
C++
GPL-2.0
60
/* Retrieves all embedded certificates from PKCS#7 signed data as described in "PKCS #7: Cryptographic Message Syntax Standard", and outputs two certificate lists chained and unchained to the signer's certificates. The input signed data could be wrapped in a ContentInfo structure. */
BOOLEAN EFIAPI Pkcs7GetCertificatesList(IN CONST UINT8 *P7Data, IN UINTN P7Length, OUT UINT8 **SignerChainCerts, OUT UINTN *ChainLength, OUT UINT8 **UnchainCerts, OUT UINTN *UnchainLength)
/* Retrieves all embedded certificates from PKCS#7 signed data as described in "PKCS #7: Cryptographic Message Syntax Standard", and outputs two certificate lists chained and unchained to the signer's certificates. The input signed data could be wrapped in a ContentInfo structure. */ BOOLEAN EFIAPI Pkcs7GetCertificatesList(IN CONST UINT8 *P7Data, IN UINTN P7Length, OUT UINT8 **SignerChainCerts, OUT UINTN *ChainLength, OUT UINT8 **UnchainCerts, OUT UINTN *UnchainLength)
{ CALL_CRYPTO_SERVICE (Pkcs7GetCertificatesList, (P7Data, P7Length, SignerChainCerts, ChainLength, UnchainCerts, UnchainLength), FALSE); }
tianocore/edk2
C++
Other
4,240
/* param base RTC peripheral base address param datetime Pointer to structure where the date and time details are stored. */
void RTC_GetDatetime(RTC_Type *base, rtc_datetime_t *datetime)
/* param base RTC peripheral base address param datetime Pointer to structure where the date and time details are stored. */ void RTC_GetDatetime(RTC_Type *base, rtc_datetime_t *datetime)
{ assert(datetime); uint32_t seconds = 0; seconds = RTC_GetSecondsTimerCount(base); RTC_ConvertSecondsToDatetime(seconds, datetime); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* MSS_SPI_set_frame_rx_handler() See "mss_spi.h" for details of how to use this function. */
void MSS_SPI_set_frame_rx_handler(mss_spi_instance_t *this_spi, mss_spi_frame_rx_handler_t rx_handler)
/* MSS_SPI_set_frame_rx_handler() See "mss_spi.h" for details of how to use this function. */ void MSS_SPI_set_frame_rx_handler(mss_spi_instance_t *this_spi, mss_spi_frame_rx_handler_t rx_handler)
{ ASSERT( (this_spi == &g_mss_spi0) || (this_spi == &g_mss_spi1) ); ASSERT( this_spi->hw_reg_bit->CTRL_MASTER == MSS_SPI_MODE_SLAVE ); this_spi->block_rx_handler = 0U; this_spi->frame_rx_handler = rx_handler; this_spi->hw_reg_bit->CTRL_RX_INT_EN = 1U; NVIC_EnableIRQ( this_spi->irqn ); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* omap_modify_dma_chain_param : Modify the chain's params - Modify the params after setting it. Dont do this while dma is running!! */
int omap_modify_dma_chain_params(int chain_id, struct omap_dma_channel_params params)
/* omap_modify_dma_chain_param : Modify the chain's params - Modify the params after setting it. Dont do this while dma is running!! */ int omap_modify_dma_chain_params(int chain_id, struct omap_dma_channel_params params)
{ int *channels; u32 i; if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) { printk(KERN_ERR "Invalid chain id\n"); return -EINVAL; } if (dma_linked_lch[chain_id].linked_dmach_q == NULL) { printk(KERN_ERR "Chain doesn't exists\n"); return -EINVAL; } channels = dma_linked_lch[chain_id].linked_dmach_q; for (i = 0; i < dma_linked_lch[chain_id].no_of_lchs_linked; i++) { omap_set_dma_params(channels[i], &params); } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get a value from the fdt and format it to be set in the environment */
static int fdt_value_env_set(const void *nodep, int len, const char *var)
/* Get a value from the fdt and format it to be set in the environment */ static int fdt_value_env_set(const void *nodep, int len, const char *var)
{ if (is_printable_string(nodep, len)) env_set(var, (void *)nodep); else if (len == 4) { char buf[11]; sprintf(buf, "0x%08X", fdt32_to_cpu(*(fdt32_t *)nodep)); env_set(var, buf); } else if (len%4 == 0 && len <= 20) { char buf[41]; int i; for (i = 0; i < len; i += sizeof(unsigned int)) sprintf(buf + (i * 2), "%08x", *(unsigned int *)(nodep + i)); env_set(var, buf); } else { printf("error: unprintable value\n"); return 1; } return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function clears the handler to be called when the flash interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler is no longer called. */
void FlashIntUnregister(void)
/* This function clears the handler to be called when the flash interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler is no longer called. */ void FlashIntUnregister(void)
{ IntDisable(INT_FLASH_BLIZZARD); IntUnregister(INT_FLASH_BLIZZARD); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* MSISDN is defined in 3GPP TS 23.003 Editor's note: MSISDN coding will be defined in TS 24.301. */
static void dissect_gtpv2_msisdn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_, session_args_t *args _U_)
/* MSISDN is defined in 3GPP TS 23.003 Editor's note: MSISDN coding will be defined in TS 24.301. */ static void dissect_gtpv2_msisdn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_, session_args_t *args _U_)
{ const char *digit_str; digit_str = dissect_e164_msisdn(tvb, tree, 0, length, E164_ENC_BCD); proto_item_append_text(item, "%s", digit_str); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* device attribute for showing all segments in a device */
static ssize_t dcssblk_seglist_show(struct device *dev, struct device_attribute *attr, char *buf)
/* device attribute for showing all segments in a device */ static ssize_t dcssblk_seglist_show(struct device *dev, struct device_attribute *attr, char *buf)
{ int i; struct dcssblk_dev_info *dev_info; struct segment_info *entry; down_read(&dcssblk_devices_sem); dev_info = container_of(dev, struct dcssblk_dev_info, dev); i = 0; buf[0] = '\0'; list_for_each_entry(entry, &dev_info->seg_list, lh) { strcpy(&buf[i], entry->segment_name); i += strlen(entry->segment_name); buf[i] = '\n'; i++; } up_read(&dcssblk_devices_sem); return i; }
robutest/uclinux
C++
GPL-2.0
60
/* The attach() and detach() entry points are used to create and destroy "instances" of the driver, where each instance represents everything needed to manage one actual PCMCIA card. */
static void atmel_detach(struct pcmcia_device *p_dev)
/* The attach() and detach() entry points are used to create and destroy "instances" of the driver, where each instance represents everything needed to manage one actual PCMCIA card. */ static void atmel_detach(struct pcmcia_device *p_dev)
{ dev_dbg(&link->dev, "atmel_detach\n"); atmel_release(link); kfree(link->priv); }
robutest/uclinux
C++
GPL-2.0
60
/* This operates at 1MHz and counts downwards. It will wrap about every hour (2^32 microseconds). */
static unsigned long timer_get_us_down(void)
/* This operates at 1MHz and counts downwards. It will wrap about every hour (2^32 microseconds). */ static unsigned long timer_get_us_down(void)
{ struct s5p_timer *const timer = s5p_get_base_timer(); return readl(&timer->tcnto4); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Pauses and resumes playing on the audio codec. */
static uint32_t Codec_PauseResume(uint32_t Cmd)
/* Pauses and resumes playing on the audio codec. */ static uint32_t Codec_PauseResume(uint32_t Cmd)
{ uint32_t counter = 0; if (Cmd == AUDIO_PAUSE) { counter += Codec_Mute(AUDIO_MUTE_ON); counter += Codec_WriteRegister(0x02, 0x01); } else { counter += Codec_Mute(AUDIO_MUTE_OFF); counter += Codec_WriteRegister(0x04, OutputDev); counter += Codec_WriteRegister(0x02, 0x9E); } return counter; }
avem-labs/Avem
C++
MIT License
1,752
/* This file is part of the Simba project. */
int mock_write_foo(int res)
/* This file is part of the Simba project. */ int mock_write_foo(int res)
{ harness_mock_write("foo(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* Resets the IO Expander by Software (SYS_CTRL1, RESET bit). */
uint8_t IOE_Reset(uint8_t DeviceAddr)
/* Resets the IO Expander by Software (SYS_CTRL1, RESET bit). */ uint8_t IOE_Reset(uint8_t DeviceAddr)
{ I2C_WriteDeviceRegister(DeviceAddr, IOE_REG_SYS_CTRL1, 0x02); _delay_(2); I2C_WriteDeviceRegister(DeviceAddr, IOE_REG_SYS_CTRL1, 0x00); return IOE_OK; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Enables or disables TIMx peripheral Preload register on ARR. */
void TIM_ARRPreloadConfig(TIM_TypeDef *TIMx, FunctionalState NewState)
/* Enables or disables TIMx peripheral Preload register on ARR. */ void TIM_ARRPreloadConfig(TIM_TypeDef *TIMx, FunctionalState NewState)
{ assert_param(IS_TIM_ALL_PERIPH(TIMx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { TIMx->CR1 |= TIM_CR1_ARPE; } else { TIMx->CR1 &= (uint16_t)~TIM_CR1_ARPE; } }
MaJerle/stm32f429
C++
null
2,036
/* This function is called to start a grace period. */
void locks_start_grace(struct lock_manager *lm)
/* This function is called to start a grace period. */ void locks_start_grace(struct lock_manager *lm)
{ spin_lock(&grace_lock); list_add(&lm->list, &grace_list); spin_unlock(&grace_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* 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 GPIOPinTypeUSBDigital(uint32_t ui32Port, uint8_t ui8Pins)
/* 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 GPIOPinTypeUSBDigital(uint32_t ui32Port, uint8_t ui8Pins)
{ ASSERT(_GPIOBaseValid(ui32Port)); GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW); GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Calculate a 32-bit CRC for a given data word (8 bits) */
uint32_t CRC_CalculateCRC8bits(uint8_t data)
/* Calculate a 32-bit CRC for a given data word (8 bits) */ uint32_t CRC_CalculateCRC8bits(uint8_t data)
{ *(uint8_t*)(CRC_BASE) = (uint8_t) data; return (CRC->DATA); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Initially, ima_measure points to the default policy rules, now point to the new policy rules, and remove the securityfs policy file, assuming a valid policy. */
static int ima_release_policy(struct inode *inode, struct file *file)
/* Initially, ima_measure points to the default policy rules, now point to the new policy rules, and remove the securityfs policy file, assuming a valid policy. */ static int ima_release_policy(struct inode *inode, struct file *file)
{ if (!valid_policy) { ima_delete_rules(); valid_policy = 1; atomic_set(&policy_opencount, 1); return 0; } ima_update_policy(); securityfs_remove(ima_policy); ima_policy = NULL; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Kill the callback thread if it's no longer being used. */
void nfs_callback_down(int minorversion)
/* Kill the callback thread if it's no longer being used. */ void nfs_callback_down(int minorversion)
{ struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion]; mutex_lock(&nfs_callback_mutex); cb_info->users--; if (cb_info->users == 0 && cb_info->task != NULL) { kthread_stop(cb_info->task); svc_exit_thread(cb_info->rqst); cb_info->serv = NULL; cb_info->rqst = NULL; cb_info->task = NULL; } mutex_unlock(&nfs_callback_mutex); }
robutest/uclinux
C++
GPL-2.0
60
/* This function handles buffer containing received data on PC com port. */
void UserDataTreatment(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
/* This function handles buffer containing received data on PC com port. */ void UserDataTreatment(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
{ uint8_t* pBuff = pData; uint8_t i; for (i = 0; i < Size; i++) { while (!(__HAL_UART_GET_FLAG(huart, UART_FLAG_TXE))) {} huart->Instance->DR = *pBuff; pBuff++; } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* SCPNT_TO_LOOKUP_IDX - searches for a given scmd in the ScsiLookup array list @ioc: Pointer to MPT_ADAPTER structure @sc: scsi_cmnd pointer */
static int SCPNT_TO_LOOKUP_IDX(MPT_ADAPTER *ioc, struct scsi_cmnd *scmd)
/* SCPNT_TO_LOOKUP_IDX - searches for a given scmd in the ScsiLookup array list @ioc: Pointer to MPT_ADAPTER structure @sc: scsi_cmnd pointer */ static int SCPNT_TO_LOOKUP_IDX(MPT_ADAPTER *ioc, struct scsi_cmnd *scmd)
{ unsigned long flags; int i, index=-1; spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); for (i = 0; i < ioc->req_depth; i++) { if (ioc->ScsiLookup[i] == sc) { index = i; goto out; } } out: spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); return index; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the GPIO pin number from a short Pin. */
unsigned long GPIOPinToPin(unsigned long ulPort, unsigned long ulPin)
/* Get the GPIO pin number from a short Pin. */ unsigned long GPIOPinToPin(unsigned long ulPort, unsigned long ulPin)
{ xASSERT(GPIOBaseValid(ulPort)); return ulPin; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Sets a TCC module compare value. If double buffering is enabled it always write to the buffer register. The value will then be updated immediately by calling tcc_force_double_buffer_update(), or be updated when the lock update bit is cleared and the UPDATE condition happen. */
enum status_code tcc_set_compare_value(const struct tcc_module *const module_inst, const enum tcc_match_capture_channel channel_index, const uint32_t compare)
/* Sets a TCC module compare value. If double buffering is enabled it always write to the buffer register. The value will then be updated immediately by calling tcc_force_double_buffer_update(), or be updated when the lock update bit is cleared and the UPDATE condition happen. */ enum status_code tcc_set_compare_value(const struct tcc_module *const module_inst, const enum tcc_match_capture_channel channel_index, const uint32_t compare)
{ Assert(module_inst); return _tcc_set_compare_value(module_inst, channel_index, compare, module_inst->double_buffering_enabled); }
memfault/zero-to-main
C++
null
200
/* Some #GFile operations almost always take a noticeable amount of time, and so do not have synchronous analogs. Notable cases include: */
static void g_file_real_query_info_async(GFile *file, const char *attributes, GFileQueryInfoFlags flags, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
/* Some #GFile operations almost always take a noticeable amount of time, and so do not have synchronous analogs. Notable cases include: */ static void g_file_real_query_info_async(GFile *file, const char *attributes, GFileQueryInfoFlags flags, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
{ GTask *task; QueryInfoAsyncData *data; data = g_new0 (QueryInfoAsyncData, 1); data->attributes = g_strdup (attributes); data->flags = flags; task = g_task_new (file, cancellable, callback, user_data); g_task_set_task_data (task, data, (GDestroyNotify)query_info_data_free); g_task_set_priority (task, io_priority); g_task_run_in_thread (task, query_info_async_thread); g_object_unref (task); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This file is part of the Simba project. */
int mock_write_bus_module_init(int res)
/* This file is part of the Simba project. */ int mock_write_bus_module_init(int res)
{ harness_mock_write("bus_module_init()", NULL, 0); harness_mock_write("bus_module_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* The constructor function locates Print2 protocol from protocol database. It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. */
EFI_STATUS EFIAPI FileExplorerConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The constructor function locates Print2 protocol from protocol database. It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. */ EFI_STATUS EFIAPI FileExplorerConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; Status = SystemTable->BootServices->LocateProtocol ( &gEfiFileExplorerProtocolGuid, NULL, (VOID **)&mProtocol ); ASSERT_EFI_ERROR (Status); ASSERT (mProtocol != NULL); return Status; }
tianocore/edk2
C++
Other
4,240
/* DMA Stream Set the Base Memory Address 0. This is the default base memory address used in direct mode. */
void dma_set_memory_address(uint32_t dma, uint8_t stream, uint32_t address)
/* DMA Stream Set the Base Memory Address 0. This is the default base memory address used in direct mode. */ void dma_set_memory_address(uint32_t dma, uint8_t stream, uint32_t address)
{ uint32_t reg32 = DMA_SCR(dma, stream); if (!(reg32 & DMA_SxCR_EN) || ((reg32 & DMA_SxCR_CT) && (reg32 & DMA_SxCR_DBM))) { DMA_SM0AR(dma, stream) = (uint32_t *) address; } }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Release lock to notify calling thread that netif job is done. */
void os_hook_notify(void)
/* Release lock to notify calling thread that netif job is done. */ void os_hook_notify(void)
{ xSemaphoreGive(hif_notify_sem); }
remotemcu/remcu-chip-sdks
C++
null
436
/* cpuidle_remove_sysfs - deletes a sysfs instance on the target device @sysdev: the target device */
void cpuidle_remove_sysfs(struct sys_device *sysdev)
/* cpuidle_remove_sysfs - deletes a sysfs instance on the target device @sysdev: the target device */ void cpuidle_remove_sysfs(struct sys_device *sysdev)
{ int cpu = sysdev->id; struct cpuidle_device *dev; dev = per_cpu(cpuidle_devices, cpu); kobject_put(&dev->kobj); }
robutest/uclinux
C++
GPL-2.0
60
/* To get the start address from which a new runtime(after SmmReadyToLock) s3 boot script entry will write into. In this case, it should be ensured that there is enough buffer to hold the entry. */
UINT8* S3BootScriptGetRuntimeEntryAddAddress(UINT8 EntryLength)
/* To get the start address from which a new runtime(after SmmReadyToLock) s3 boot script entry will write into. In this case, it should be ensured that there is enough buffer to hold the entry. */ UINT8* S3BootScriptGetRuntimeEntryAddAddress(UINT8 EntryLength)
{ UINT8 *NewEntryPtr; NewEntryPtr = NULL; if ((mS3BootScriptTablePtr->TableLength + EntryLength + sizeof (EFI_BOOT_SCRIPT_TERMINATE)) <= EFI_PAGES_TO_SIZE ((UINTN)(mS3BootScriptTablePtr->TableMemoryPageNumber))) { NewEntryPtr = mS3BootScriptTablePtr->TableBase + mS3BootScriptTablePtr->TableLength; mS3BootScriptTablePtr->TableLength = mS3BootScriptTablePtr->TableLength + EntryLength; S3BootScriptInternalCloseTable (); } return (UINT8 *)NewEntryPtr; }
tianocore/edk2
C++
Other
4,240
/* xread() is the same a read(), but it automatically restarts read() operations with a recoverable error (EAGAIN and EINTR). xread() DOES NOT GUARANTEE that "len" bytes is read even if the data is available. */
static ssize_t xread(int fd, void *buf, size_t len)
/* xread() is the same a read(), but it automatically restarts read() operations with a recoverable error (EAGAIN and EINTR). xread() DOES NOT GUARANTEE that "len" bytes is read even if the data is available. */ static ssize_t xread(int fd, void *buf, size_t len)
{ ssize_t nr; while (1) { nr = read(fd, buf, len); if ((nr < 0) && (errno == EAGAIN || errno == EINTR)) continue; return nr; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Output: void, but we will add to proto tree if !NULL. */
void isis_dissect_te_router_id_clv(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, expert_field *expert, int offset, int length, int tree_id)
/* Output: void, but we will add to proto tree if !NULL. */ void isis_dissect_te_router_id_clv(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, expert_field *expert, int offset, int length, int tree_id)
{ if ( length <= 0 ) { return; } if ( length != 4 ) { proto_tree_add_expert_format(tree, pinfo, expert, tvb, offset, -1, "malformed Traffic Engineering Router ID (%d vs 4)",length ); return; } proto_tree_add_item(tree, tree_id, tvb, offset, 4, ENC_BIG_ENDIAN); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* IRL0 = erase switch IRL1 = eth0 IRL2 = eth1 IRL3 = crypto */
static void __init init_snapgear_IRQ(void)
/* IRL0 = erase switch IRL1 = eth0 IRL2 = eth1 IRL3 = crypto */ static void __init init_snapgear_IRQ(void)
{ printk("Setup SnapGear IRQ/IPR ...\n"); plat_irq_setup_pins(IRQ_MODE_IRQ); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* An abort indicates that the current memory access cannot be completed, which occurs during a data access. */
void rt_hw_trap_dabt(struct rt_hw_register *regs)
/* An abort indicates that the current memory access cannot be completed, which occurs during a data access. */ void rt_hw_trap_dabt(struct rt_hw_register *regs)
{ rt_hw_show_register(regs); rt_kprintf("data abort\n"); rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name); rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry); rt_hw_cpu_shutdown(); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function handles TIM1 Trigger and Commutation Interrupt and TIM11 Handler. */
void TIM1_TRG_COM_TIM11_IRQHandler(void)
/* This function handles TIM1 Trigger and Commutation Interrupt and TIM11 Handler. */ void TIM1_TRG_COM_TIM11_IRQHandler(void)
{ if(LL_TIM_IsActiveFlag_COM(TIM1) == 1) { LL_TIM_ClearFlag_COM(TIM1); TimerCommutationEvent_Callback(); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Get number of available slots for messages in a Message Queue. */
uint32_t osMessageQueueGetSpace(osMessageQueueId_t mq_id)
/* Get number of available slots for messages in a Message Queue. */ uint32_t osMessageQueueGetSpace(osMessageQueueId_t mq_id)
{ space = svcRtxMessageQueueGetSpace(mq_id); } else { space = __svcMessageQueueGetSpace(mq_id); } return space; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* This function sets the status callback function. The callback function is called by the XGpioPs_IntrHandler when an interrupt occurs. */
void XGpioPs_SetCallbackHandler(XGpioPs *InstancePtr, void *CallBackRef, XGpioPs_Handler FuncPointer)
/* This function sets the status callback function. The callback function is called by the XGpioPs_IntrHandler when an interrupt occurs. */ void XGpioPs_SetCallbackHandler(XGpioPs *InstancePtr, void *CallBackRef, XGpioPs_Handler FuncPointer)
{ Xil_AssertVoid(InstancePtr != NULL); Xil_AssertVoid(FuncPointer != NULL); Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); InstancePtr->Handler = FuncPointer; InstancePtr->CallBackRef = CallBackRef; }
ua1arn/hftrx
C++
null
69