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
/* zynq_nand_write_page_swecc - software ecc based page write function @mtd: mtd info structure @chip: nand chip info structure @buf: data buffer @oob_required: must write chip->oob_poi to OOB */
static int zynq_nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip, const u8 *buf, int oob_required, int page)
/* zynq_nand_write_page_swecc - software ecc based page write function @mtd: mtd info structure @chip: nand chip info structure @buf: data buffer @oob_required: must write chip->oob_poi to OOB */ static int zynq_nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip, const u8 *buf, int oob_required, int p...
{ int i, eccsize = chip->ecc.size; int eccbytes = chip->ecc.bytes; int eccsteps = chip->ecc.steps; u8 *ecc_calc = chip->buffers->ecccalc; const u8 *p = buf; u32 *eccpos = chip->ecc.layout->eccpos; for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) chip->ecc.calculate(mtd, p, &ecc_calc[i]); for (i ...
4ms/stm32mp1-baremetal
C++
Other
137
/* Gets the direction and mode of a pin. */
unsigned long GPIODirModeGet(unsigned long ulPort, unsigned long ulBit)
/* Gets the direction and mode of a pin. */ unsigned long GPIODirModeGet(unsigned long ulPort, unsigned long ulBit)
{ xASSERT(GPIOBaseValid(ulPort)); xASSERT(ulBit < 16); if(ulBit < 8) { return((xHWREG(ulPort + GPIO_CRL) & (0xF << (ulBit * 4))) >> (ulBit * 4)); } else { return((xHWREG(ulPort + GPIO_CRH) & (0xF << ((ulBit - 8) * 4))) >> ((ulBit - 8) * 4)); ...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Using this API forces the linear scanning of event sources on each main loop iteration. Newly-written event sources should try to use g_source_add_unix_fd() instead of this API. */
void g_source_add_poll(GSource *source, GPollFD *fd)
/* Using this API forces the linear scanning of event sources on each main loop iteration. Newly-written event sources should try to use g_source_add_unix_fd() instead of this API. */ void g_source_add_poll(GSource *source, GPollFD *fd)
{ GMainContext *context; g_return_if_fail (source != NULL); g_return_if_fail (fd != NULL); g_return_if_fail (!SOURCE_DESTROYED (source)); context = source->context; if (context) LOCK_CONTEXT (context); source->poll_fds = g_slist_prepend (source->poll_fds, fd); if (context) { if (!SOURCE_BL...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function also caches the pointer to the HOB list retrieved. */
VOID* EFIAPI GetHobList(VOID)
/* This function also caches the pointer to the HOB list retrieved. */ VOID* EFIAPI GetHobList(VOID)
{ EFI_STATUS Status; if (mHobList == NULL) { Status = EfiGetSystemConfigurationTable (&gEfiHobListGuid, &mHobList); ASSERT_EFI_ERROR (Status); ASSERT (mHobList != NULL); } return mHobList; }
tianocore/edk2
C++
Other
4,240
/* Set the specified Thread Flags of a thread. */
uint32_t osThreadFlagsSet(osThreadId_t thread_id, uint32_t flags)
/* Set the specified Thread Flags of a thread. */ uint32_t osThreadFlagsSet(osThreadId_t thread_id, uint32_t flags)
{ unsigned int key; struct cv2_thread *tid = (struct cv2_thread *)thread_id; if ((thread_id == NULL) || (is_cmsis_rtos_v2_thread(thread_id) == NULL) || (flags & 0x80000000)) { return osFlagsErrorParameter; } key = irq_lock(); tid->signal_results |= flags; irq_unlock(key); k_poll_signal_raise(&tid->poll_s...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Returns the FMC Write Protection Option Bytes value. */
uint16_t FMC_OPT_ReadWriteProtect(void)
/* Returns the FMC Write Protection Option Bytes value. */ uint16_t FMC_OPT_ReadWriteProtect(void)
{ return (*(__IO uint16_t *)(OPTCTRL_BYTE2_ADDRESS)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read module hardware identification data from the I2C EEPROM. */
static void read_hw_id(hw_id_t hw_id)
/* Read module hardware identification data from the I2C EEPROM. */ static void read_hw_id(hw_id_t hw_id)
{ int i; for (i = 0; i < HW_ID_ELEM_COUNT; ++i) if (i2c_read(CONFIG_SYS_I2C_EEPROM, hw_id_format[i].offset, 2, (uchar *)&hw_id[i][0], hw_id_format[i].length) != 0) printf("ERROR: can't read HW ID from EEPROM\n"); }
EmcraftSystems/u-boot
C++
Other
181
/* Free a region of KVA allocated by alloc_vmap_area */
static void free_vmap_area(struct vmap_area *va)
/* Free a region of KVA allocated by alloc_vmap_area */ static void free_vmap_area(struct vmap_area *va)
{ spin_lock(&vmap_area_lock); __free_vmap_area(va); spin_unlock(&vmap_area_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Note, since we don't write any data to the TxFIFO, then it is currently believed that we do not need to wait for any space in the TxFIFO. */
static void s3c_hsotg_ep0_zlp(struct s3c_hsotg *hsotg, bool dir_in)
/* Note, since we don't write any data to the TxFIFO, then it is currently believed that we do not need to wait for any space in the TxFIFO. */ static void s3c_hsotg_ep0_zlp(struct s3c_hsotg *hsotg, bool dir_in)
{ hsotg->eps_out[0]->dir_in = dir_in; hsotg->ep0_state = dir_in ? DWC2_EP0_STATUS_IN : DWC2_EP0_STATUS_OUT; s3c_hsotg_program_zlp(hsotg, hsotg->eps_out[0]); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* C-Media CM106/CM106+ have four 16-bit internal registers that are nicely documented in the device's data sheet. */
static int snd_usb_cm106_write_int_reg(struct usb_device *dev, int reg, u16 value)
/* C-Media CM106/CM106+ have four 16-bit internal registers that are nicely documented in the device's data sheet. */ static int snd_usb_cm106_write_int_reg(struct usb_device *dev, int reg, u16 value)
{ u8 buf[4]; buf[0] = 0x20; buf[1] = value & 0xff; buf[2] = (value >> 8) & 0xff; buf[3] = reg; return snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), USB_REQ_SET_CONFIGURATION, USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_ENDPOINT, 0, 0, &buf, 4, 1000); }
robutest/uclinux
C++
GPL-2.0
60
/* Function for restore head state entry action. Function for restore head state entry action, which includes writing the head section back from swap to the data page. */
static void state_restore_head_entry_run(void)
/* Function for restore head state entry action. Function for restore head state entry action, which includes writing the head section back from swap to the data page. */ static void state_restore_head_entry_run(void)
{ flash_write((uint32_t *)((m_current_page_id - 1u) * PSTORAGE_FLASH_PAGE_SIZE), (uint32_t *)PSTORAGE_SWAP_ADDR, m_head_word_size); }
labapart/polymcu
C++
null
201
/* Locking: the function must me called withing a rcu_read_lock region */
void mesh_path_flush_pending(struct mesh_path *mpath)
/* Locking: the function must me called withing a rcu_read_lock region */ void mesh_path_flush_pending(struct mesh_path *mpath)
{ struct sk_buff *skb; while ((skb = skb_dequeue(&mpath->frame_queue)) && (mpath->flags & MESH_PATH_ACTIVE)) mesh_path_discard_frame(skb, mpath->sdata); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param config Pointer to configuration structure. See to "dcdc_low_power_config_t" */
void DCDC_GetDefaultLowPowerConfig(dcdc_low_power_config_t *config)
/* param config Pointer to configuration structure. See to "dcdc_low_power_config_t" */ void DCDC_GetDefaultLowPowerConfig(dcdc_low_power_config_t *config)
{ assert(NULL != config); (void)memset(config, 0, sizeof(*config)); config->enableOverloadDetection = true; config->enableAdjustHystereticValue = false; config->countChargingTimePeriod = kDCDC_CountChargingTimePeriod8Cycle; config->countChargingTimeThreshold = kDCDC_CountChargingTimeThr...
eclipse-threadx/getting-started
C++
Other
310
/* 64-bit file support on 64-bit platforms by Jakub Jelinek ( */
static int ext2_release_file(struct inode *inode, struct file *filp)
/* 64-bit file support on 64-bit platforms by Jakub Jelinek ( */ static int ext2_release_file(struct inode *inode, struct file *filp)
{ if (filp->f_mode & FMODE_WRITE) { mutex_lock(&EXT2_I(inode)->truncate_mutex); ext2_discard_reservation(inode); mutex_unlock(&EXT2_I(inode)->truncate_mutex); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Reads and returns the current value of DR0. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */
UINTN EFIAPI AsmReadDr0(VOID)
/* Reads and returns the current value of DR0. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */ UINTN EFIAPI AsmReadDr0(VOID)
{ __asm { mov eax, dr0 } }
tianocore/edk2
C++
Other
4,240
/* Returns: (nullable): the associated value, or NULL if the key is not found */
gpointer g_hash_table_lookup(GHashTable *hash_table, gconstpointer key)
/* Returns: (nullable): the associated value, or NULL if the key is not found */ gpointer g_hash_table_lookup(GHashTable *hash_table, gconstpointer key)
{ guint node_index; guint node_hash; g_return_val_if_fail (hash_table != NULL, NULL); node_index = g_hash_table_lookup_node (hash_table, key, &node_hash); return HASH_IS_REAL (hash_table->hashes[node_index]) ? hash_table->values[node_index] : NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Note: the TOD should store the current GMT */
int m48_tod_get(int *year, int *month, int *day, int *hour, int *minute, int *second)
/* Note: the TOD should store the current GMT */ int m48_tod_get(int *year, int *month, int *day, int *hour, int *minute, int *second)
{ int y; SYS_TOD_UNPROTECT(); M48_ADDR[CONTROL] |= 0x40; y = from_bcd(M48_ADDR[YEAR]); *year = y < 80 ? 2000 + y : 1900 + y; *month = from_bcd(M48_ADDR[MONTH]); *day = from_bcd(M48_ADDR[DAY]); *hour = from_bcd(M48_ADDR[HOUR]); *minute = from_bcd(M48_ADDR[MINUTE]); *second = from_...
EmcraftSystems/u-boot
C++
Other
181
/* Decode a recording mask into a mixer selection as follows: */
static unsigned int waveartist_select_input(wavnc_info *devc, unsigned int recmask, unsigned char *dev_l, unsigned char *dev_r)
/* Decode a recording mask into a mixer selection as follows: */ static unsigned int waveartist_select_input(wavnc_info *devc, unsigned int recmask, unsigned char *dev_l, unsigned char *dev_r)
{ unsigned int recdev = ADC_MUX_NONE; if (recmask & SOUND_MASK_IMIX) { recmask = SOUND_MASK_IMIX; recdev = ADC_MUX_MIXER; } else if (recmask & SOUND_MASK_LINE2) { recmask = SOUND_MASK_LINE2; recdev = ADC_MUX_AUX2; } else if (recmask & SOUND_MASK_LINE1) { recmask = SOUND_MASK_LINE1; recdev = ADC_MUX_AUX1...
robutest/uclinux
C++
GPL-2.0
60
/* Description: Initialize this blk_iopoll structure. Before being actively used, the driver must call blk_iopoll_enable(). */
void blk_iopoll_init(struct blk_iopoll *iop, int weight, blk_iopoll_fn *poll_fn)
/* Description: Initialize this blk_iopoll structure. Before being actively used, the driver must call blk_iopoll_enable(). */ void blk_iopoll_init(struct blk_iopoll *iop, int weight, blk_iopoll_fn *poll_fn)
{ memset(iop, 0, sizeof(*iop)); INIT_LIST_HEAD(&iop->list); iop->weight = weight; iop->poll = poll_fn; set_bit(IOPOLL_F_SCHED, &iop->state); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set file descriptor of socket to non-blocking state */
int nl_socket_set_nonblocking(struct nl_sock *sk)
/* Set file descriptor of socket to non-blocking state */ int nl_socket_set_nonblocking(struct nl_sock *sk)
{ if (sk->s_fd == -1) return -NLE_BAD_SOCK; if (fcntl(sk->s_fd, F_SETFL, O_NONBLOCK) < 0) return -nl_syserr2nlerr(errno); return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Since: 2.24 Returns: the allocated memory, or NULL */
gpointer g_try_malloc0_n(gsize n_blocks, gsize n_block_bytes)
/* Since: 2.24 Returns: the allocated memory, or NULL */ gpointer g_try_malloc0_n(gsize n_blocks, gsize n_block_bytes)
{ if (SIZE_OVERFLOWS (n_blocks, n_block_bytes)) return NULL; return g_try_malloc0 (n_blocks * n_block_bytes); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function assumes to be called rarely. Switching between 8259A registers is slow. This has to be protected by the irq controller spinlock before being called. */
static int i8259A_irq_real(unsigned int irq)
/* This function assumes to be called rarely. Switching between 8259A registers is slow. This has to be protected by the irq controller spinlock before being called. */ static int i8259A_irq_real(unsigned int irq)
{ int value; int irqmask = 1 << irq; if (irq < 8) { outb(0x0B, PIC_MASTER_CMD); value = inb(PIC_MASTER_CMD) & irqmask; outb(0x0A, PIC_MASTER_CMD); return value; } outb(0x0B, PIC_SLAVE_CMD); value = inb(PIC_SLAVE_CMD) & (irqmask >> 8); outb(0x0A, PIC_SLAVE_CMD); return value; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function gets the u-boot flash sector protection status (flash_info_t.protect) in sync with the sector protection status stored in hardware. */
static void flash_sync_real_protect(flash_info_t *info)
/* This function gets the u-boot flash sector protection status (flash_info_t.protect) in sync with the sector protection status stored in hardware. */ static void flash_sync_real_protect(flash_info_t *info)
{ int i; switch (info->flash_id & FLASH_TYPEMASK) { case FLASH_28F128J3A: for (i = 0; i < info->sector_count; ++i) { info->protect[i] = intel_sector_protected(info, i); } break; default: break; } }
EmcraftSystems/u-boot
C++
Other
181
/* Returns 0 on success, a negative error code otherwise. */
int nand_readid_op(struct nand_chip *chip, u8 addr, void *buf, unsigned int len)
/* Returns 0 on success, a negative error code otherwise. */ int nand_readid_op(struct nand_chip *chip, u8 addr, void *buf, unsigned int len)
{ struct mtd_info *mtd = nand_to_mtd(chip); unsigned int i; u8 *id = buf; if (len && !buf) return -EINVAL; chip->cmdfunc(mtd, NAND_CMD_READID, addr, -1); for (i = 0; i < len; i++) id[i] = chip->read_byte(mtd); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns: a #gssize containing the number of bytes written to the stream. */
gssize g_output_stream_write_finish(GOutputStream *stream, GAsyncResult *result, GError **error)
/* Returns: a #gssize containing the number of bytes written to the stream. */ gssize g_output_stream_write_finish(GOutputStream *stream, GAsyncResult *result, GError **error)
{ g_return_val_if_fail (G_IS_OUTPUT_STREAM (stream), FALSE); g_return_val_if_fail (g_task_is_valid (result, stream), FALSE); g_return_val_if_fail (g_async_result_is_tagged (result, g_output_stream_write_async), FALSE); return g_task_propagate_int (G_TASK (result), error); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function performs DA8xx platform specific deinitialization for usb0. */
void musb_platform_deinit(void)
/* This function performs DA8xx platform specific deinitialization for usb0. */ void musb_platform_deinit(void)
{ phy_off(); writel((DA8XX_USB_USBINT_MASK | DA8XX_USB_TXINT_MASK | DA8XX_USB_RXINT_MASK), &da8xx_usb_regs->intmsk_clr); writel(0, &da8xx_usb_regs->eoi); }
EmcraftSystems/u-boot
C++
Other
181
/* counts arguments in format string for sprintf view */
static int debug_count_numargs(char *string)
/* counts arguments in format string for sprintf view */ static int debug_count_numargs(char *string)
{ int numargs=0; while(*string) { if(*string++=='%') numargs++; } return(numargs); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The Timer 0 default IRQ, declared in start up code. */
void TMR0_IRQHandler(void)
/* The Timer 0 default IRQ, declared in start up code. */ void TMR0_IRQHandler(void)
{ unsigned long ulBase = TIMER0_BASE; unsigned long ulTemp0,ulTemp1; ulTemp0 = (xHWREG(ulBase + TIMER_O_TISR) & TIMER_TISR_TIF); xHWREG(ulBase + TIMER_O_TISR) = ulTemp0; ulTemp1 = (xHWREG(ulBase + TIMER_O_TEISR) & TIMER_TISR_TIF); xHWREG(ulBase + TIMER_O_TEISR) = ulTemp1; if (g_pfnTimer...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Called from parser to add SRV data to search result. */
static void _mdns_search_result_add_srv(mdns_search_once_t *search, const char *hostname, uint16_t port, tcpip_adapter_if_t tcpip_if, mdns_ip_protocol_t ip_protocol)
/* Called from parser to add SRV data to search result. */ static void _mdns_search_result_add_srv(mdns_search_once_t *search, const char *hostname, uint16_t port, tcpip_adapter_if_t tcpip_if, mdns_ip_protocol_t ip_protocol)
{ mdns_result_t * r = search->result; while (r) { if (r->tcpip_if == tcpip_if && r->ip_protocol == ip_protocol && !_str_null_or_empty(r->hostname) && !strcasecmp(hostname, r->hostname)) { return; } r = r->next; } if (!search->max_results || search->num_results < searc...
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Configures the TIMx Output Compare 1 Fast feature. */
void TIM_OC1FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
/* Configures the TIMx Output Compare 1 Fast feature. */ void TIM_OC1FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
{ uint16_t tmpccmr1 = 0; assert_param(IS_TIM_LIST4_PERIPH(TIMx)); assert_param(IS_TIM_OCFAST_STATE(TIM_OCFast)); tmpccmr1 = TIMx->CCMR1; tmpccmr1 &= (uint16_t)~((uint16_t)TIM_CCMR1_OC1FE); tmpccmr1 |= TIM_OCFast; TIMx->CCMR1 = tmpccmr1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get an error message string for a CANT_GET_INTERFACE_LIST error from "get_airpcap_interface_list()". */
static gchar* cant_get_airpcap_if_list_error_message(const char *err_str)
/* Get an error message string for a CANT_GET_INTERFACE_LIST error from "get_airpcap_interface_list()". */ static gchar* cant_get_airpcap_if_list_error_message(const char *err_str)
{ return g_strdup_printf("Can't get list of Wireless interfaces: %s", err_str); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Determines the link capabilities by reading the AUTOC register. */
static s32 ixgbe_get_copper_link_capabilities_82599(struct ixgbe_hw *hw, ixgbe_link_speed *speed, bool *autoneg)
/* Determines the link capabilities by reading the AUTOC register. */ static s32 ixgbe_get_copper_link_capabilities_82599(struct ixgbe_hw *hw, ixgbe_link_speed *speed, bool *autoneg)
{ s32 status = IXGBE_ERR_LINK_SETUP; u16 speed_ability; *speed = 0; *autoneg = true; status = hw->phy.ops.read_reg(hw, MDIO_SPEED, MDIO_MMD_PMAPMD, &speed_ability); if (status == 0) { if (speed_ability & MDIO_SPEED_10G) *speed |= IXGBE_LINK_SPEED_10GB_FULL; if (speed_abili...
robutest/uclinux
C++
GPL-2.0
60
/* Returns zero on success, or else the status code returned by the underlying usb_control_msg() call. */
int usb_clear_halt(struct usb_host_virt_dev *dev, int pipe)
/* Returns zero on success, or else the status code returned by the underlying usb_control_msg() call. */ int usb_clear_halt(struct usb_host_virt_dev *dev, int pipe)
{ int result; int endp = usb_pipeendpoint(pipe); if (usb_pipein(pipe)) { endp |= USB_DIR_IN; } result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), USB_REQ_CLEAR_FEATURE, USB_RECIP_ENDPOINT, ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* switches on rx irq by enabling them in the GHIINTnMSK register */
static void spider_net_rx_irq_on(struct spider_net_card *card)
/* switches on rx irq by enabling them in the GHIINTnMSK register */ static void spider_net_rx_irq_on(struct spider_net_card *card)
{ u32 regvalue; regvalue = SPIDER_NET_INT0_MASK_VALUE | SPIDER_NET_RXINT; spider_net_write_reg(card, SPIDER_NET_GHIINT0MSK, regvalue); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: 0 on SUCCESS 1 to indicate an external ERROR (i.e. key not found, etc) -1 to indicate an internal ERROR (i.e. out of memory, etc) */
static int hash_get(DB *dbp, const DBT *key, DBT *data, u_int32_t flag) const
/* Returns: 0 on SUCCESS 1 to indicate an external ERROR (i.e. key not found, etc) -1 to indicate an internal ERROR (i.e. out of memory, etc) */ static int hash_get(DB *dbp, const DBT *key, DBT *data, u_int32_t flag) const
{ HTAB *hashp; hashp = (HTAB *)dbp->internal; if (flag) { hashp->errno = errno = EINVAL; return (ERROR); } return (hash_access(hashp, HASH_GET, (DBT *)key, data)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* we emulate the request_irq behaviour on top of s390 extints */
static void kvm_extint_handler(u16 code)
/* we emulate the request_irq behaviour on top of s390 extints */ static void kvm_extint_handler(u16 code)
{ struct virtqueue *vq; u16 subcode; int config_changed; subcode = S390_lowcore.cpu_addr; if ((subcode & 0xff00) != VIRTIO_SUBCODE_64) return; vq = (struct virtqueue *) ((*(long *) __LC_PFAULT_INTPARM) & ~1UL); config_changed = (*(int *) __LC_EXT_PARAMS & 1); if (config_changed) { struct virtio_driver *dr...
robutest/uclinux
C++
GPL-2.0
60
/* Dump (unsigned) int 0..MAXINT using multibyte encoding (MBE). DumpInt is used for context dependent counts and sizes; no type information is embedded. */
static void DumpInt(lua_Integer x, DumpState *D)
/* Dump (unsigned) int 0..MAXINT using multibyte encoding (MBE). DumpInt is used for context dependent counts and sizes; no type information is embedded. */ static void DumpInt(lua_Integer x, DumpState *D)
{ *b-- = 0x80 + (x & 0x7f); x >>= 7; } b++; lua_assert (b >= buf); DumpVector(b, (buf - b) + sizeof(buf), D); }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* When double tap recognition is enabled, this register expresses the maximum time between two consecutive detected taps to determine a double tap event. The default value of these bits is 0000b which corresponds to 16*ODR_XL time. If the DUR bits are set to a different value, 1LSB corresponds to 32*ODR_XL time.. */
int32_t lsm6dso_tap_dur_set(stmdev_ctx_t *ctx, uint8_t val)
/* When double tap recognition is enabled, this register expresses the maximum time between two consecutive detected taps to determine a double tap event. The default value of these bits is 0000b which corresponds to 16*ODR_XL time. If the DUR bits are set to a different value, 1LSB corresponds to 32*ODR_XL time.. */ ...
{ lsm6dso_int_dur2_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_INT_DUR2, (uint8_t *)&reg, 1); if (ret == 0) { reg.dur = val; ret = lsm6dso_write_reg(ctx, LSM6DSO_INT_DUR2, (uint8_t *)&reg, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Callback function from exofs_delete_inode() - don't have much cleaning up to do. */
static void delete_done(struct exofs_io_state *ios, void *p)
/* Callback function from exofs_delete_inode() - don't have much cleaning up to do. */ static void delete_done(struct exofs_io_state *ios, void *p)
{ struct exofs_sb_info *sbi = p; exofs_put_io_state(ios); atomic_dec(&sbi->s_curr_pending); }
robutest/uclinux
C++
GPL-2.0
60
/* Description: Checks the given categories against the given DOI definition and returns a negative value if any of the categories do not have a valid mapping and a zero value if all of the categories are valid. */
static int cipso_v4_map_cat_rng_valid(const struct cipso_v4_doi *doi_def, const unsigned char *rngcat, u32 rngcat_len)
/* Description: Checks the given categories against the given DOI definition and returns a negative value if any of the categories do not have a valid mapping and a zero value if all of the categories are valid. */ static int cipso_v4_map_cat_rng_valid(const struct cipso_v4_doi *doi_def, const unsigned char *rngcat, u...
{ u16 cat_high; u16 cat_low; u32 cat_prev = CIPSO_V4_MAX_REM_CATS + 1; u32 iter; if (doi_def->type != CIPSO_V4_MAP_PASS || rngcat_len & 0x01) return -EFAULT; for (iter = 0; iter < rngcat_len; iter += 4) { cat_high = get_unaligned_be16(&rngcat[iter]); if ((iter + 4) <= rngcat_len) cat_low = get_unaligned_...
EmcraftSystems/linux-emcraft
C++
Other
266
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param volume volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_CS42888_SetVolume(void *handle, uint32_t playChannel, uint32_t volume)
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param volume volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. return kStatus_Success is success, else configure failed. */ status_t HAL_CODEC_CS42888_SetVolume(void *h...
{ assert(handle != NULL); uint32_t i = 0U; status_t ret = kStatus_Success; for (i = 0U; i < kCS42888_AOUT8; i++) { if ((playChannel & (1U << i)) == 0U) { continue; } ret = CS42888_SetAOUTVolume((cs42888_handle_t *)((uint32_t)(((codec_handle_t *)handle)->...
eclipse-threadx/getting-started
C++
Other
310
/* Return the 32bit CPU family and model value. */
UINT32 EFIAPI GetCpuFamilyModel(VOID)
/* Return the 32bit CPU family and model value. */ UINT32 EFIAPI GetCpuFamilyModel(VOID)
{ CPUID_VERSION_INFO_EAX Eax; AsmCpuid (CPUID_VERSION_INFO, &Eax.Uint32, NULL, NULL, NULL); Eax.Bits.SteppingId = 0; Eax.Bits.ProcessorType = 0; Eax.Bits.Reserved1 = 0; Eax.Bits.Reserved2 = 0; return Eax.Uint32; }
tianocore/edk2
C++
Other
4,240
/* param handle Pointer to DMA channel transfer handle. param linkAddr DMA link descriptor address. param num DMA link descriptor number. */
void DMIC_InstallDMADescriptorMemory(dmic_dma_handle_t *handle, void *linkAddr, size_t linkNum)
/* param handle Pointer to DMA channel transfer handle. param linkAddr DMA link descriptor address. param num DMA link descriptor number. */ void DMIC_InstallDMADescriptorMemory(dmic_dma_handle_t *handle, void *linkAddr, size_t linkNum)
{ assert(handle != NULL); handle->desLink = (dma_descriptor_t *)linkAddr; handle->linkNum = linkNum; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Add the image info to a deferred image list. */
VOID QueueImage(IN CONST EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath, IN BOOLEAN BootOption)
/* Add the image info to a deferred image list. */ VOID QueueImage(IN CONST EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath, IN BOOLEAN BootOption)
{ DEFERRED_3RD_PARTY_IMAGE_INFO *ImageInfo; ImageInfo = ReallocatePool ( mDeferred3rdPartyImage.Count * sizeof (DEFERRED_3RD_PARTY_IMAGE_INFO), (mDeferred3rdPartyImage.Count + 1) * sizeof (DEFERRED_3RD_PARTY_IMAGE_INFO), mDeferred3rdPartyImage.ImageInfo ...
tianocore/edk2
C++
Other
4,240
/* Returns whether an object is currently fenceable. If not, it may need to be unbound and have its pitch adjusted. */
bool i915_obj_fenceable(struct drm_device *dev, struct drm_gem_object *obj)
/* Returns whether an object is currently fenceable. If not, it may need to be unbound and have its pitch adjusted. */ bool i915_obj_fenceable(struct drm_device *dev, struct drm_gem_object *obj)
{ struct drm_i915_gem_object *obj_priv = obj->driver_private; if (IS_I965G(dev)) { if (obj->size & 4095) return false; return true; } else if (IS_I9XX(dev)) { if (obj_priv->gtt_offset & ~I915_FENCE_START_MASK) return false; } else { if (obj_priv->gtt_offset & ~I830_FENCE_START_MASK) return false; ...
robutest/uclinux
C++
GPL-2.0
60
/* Free the memory used by a menu item. This includes the memory used by its key. */
static void* menu_item_destroy(struct menu *m, struct menu_item *item, void *extra)
/* Free the memory used by a menu item. This includes the memory used by its key. */ static void* menu_item_destroy(struct menu *m, struct menu_item *item, void *extra)
{ if (item->key) free(item->key); free(item); return NULL; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Check to make sure the dock device is still present, then undock and hotremove all the devices that may need removing. */
static int handle_eject_request(struct dock_station *ds, u32 event)
/* Check to make sure the dock device is still present, then undock and hotremove all the devices that may need removing. */ static int handle_eject_request(struct dock_station *ds, u32 event)
{ if (dock_in_progress(ds)) return -EBUSY; dock_event(ds, event, UNDOCK_EVENT); hotplug_dock_devices(ds, ACPI_NOTIFY_EJECT_REQUEST); undock(ds); dock_lock(ds, 0); eject_dock(ds); if (dock_present(ds)) { printk(KERN_ERR PREFIX "Unable to undock!\n"); return -EBUSY; } complete_undock(ds); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* The operations to get and set the status word just access the status field of the device descriptor. */
static u8 lg_get_status(struct virtio_device *vdev)
/* The operations to get and set the status word just access the status field of the device descriptor. */ static u8 lg_get_status(struct virtio_device *vdev)
{ return to_lgdev(vdev)->desc->status; }
robutest/uclinux
C++
GPL-2.0
60
/* Return: 0: s1 == s2, > 0: s1 > s2, < 0: s1 < s2 */
static efi_intn_t EFIAPI efi_stri_coll(struct efi_unicode_collation_protocol *this, u16 *s1, u16 *s2)
/* Return: 0: s1 == s2, > 0: s1 > s2, < 0: s1 < s2 */ static efi_intn_t EFIAPI efi_stri_coll(struct efi_unicode_collation_protocol *this, u16 *s1, u16 *s2)
{ s32 c1, c2; efi_intn_t ret = 0; EFI_ENTRY("%p, %ls, %ls", this, s1, s2); for (; *s1 | *s2; ++s1, ++s2) { c1 = utf_to_upper(*s1); c2 = utf_to_upper(*s2); if (c1 < c2) { ret = -1; goto out; } else if (c1 > c2) { ret = 1; goto out; } } out: EFI_EXIT(EFI_SUCCESS); return ret; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Enables or disables the TIMx peripheral Preload register on CCR6. */
void TIM_OC6PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
/* Enables or disables the TIMx peripheral Preload register on CCR6. */ void TIM_OC6PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
{ uint32_t tmpccmr3 = 0; assert_param(IS_TIM_LIST4_PERIPH(TIMx)); assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload)); tmpccmr3 = TIMx->CCMR3; tmpccmr3 &= (uint32_t)(~TIM_CCMR3_OC6PE); tmpccmr3 |= (uint32_t)(TIM_OCPreload << 8); TIMx->CCMR3 = tmpccmr3; }
ajhc/demo-cortex-m3
C++
null
38
/* Reduce an iovec's length in-place. Return the resulting number of segments */
unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to)
/* Reduce an iovec's length in-place. Return the resulting number of segments */ unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to)
{ unsigned long seg = 0; size_t len = 0; while (seg < nr_segs) { seg++; if (len + iov->iov_len >= to) { iov->iov_len = to - len; break; } len += iov->iov_len; iov++; } return seg; }
robutest/uclinux
C++
GPL-2.0
60
/* Called when an application has failed to launch, so that it can cancel the application startup notification started in g_app_launch_context_get_startup_notify_id(). */
void g_app_launch_context_launch_failed(GAppLaunchContext *context, const char *startup_notify_id)
/* Called when an application has failed to launch, so that it can cancel the application startup notification started in g_app_launch_context_get_startup_notify_id(). */ void g_app_launch_context_launch_failed(GAppLaunchContext *context, const char *startup_notify_id)
{ g_return_if_fail (G_IS_APP_LAUNCH_CONTEXT (context)); g_return_if_fail (startup_notify_id != NULL); g_signal_emit (context, signals[LAUNCH_FAILED], 0, startup_notify_id); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The number of days since January 1. (0 to 365) */
int rtc_year_days(unsigned int day, unsigned int month, unsigned int year)
/* The number of days since January 1. (0 to 365) */ int rtc_year_days(unsigned int day, unsigned int month, unsigned int year)
{ return rtc_ydays[is_leap_year(year)][month] + day-1; }
robutest/uclinux
C++
GPL-2.0
60
/* Configures internally by software the NSS pin for the selected SPI. */
void SPI_SetNssLevel(SPI_Module *SPIx, uint16_t SPI_NSSInternalSoft)
/* Configures internally by software the NSS pin for the selected SPI. */ void SPI_SetNssLevel(SPI_Module *SPIx, uint16_t SPI_NSSInternalSoft)
{ assert_param(IS_SPI_PERIPH(SPIx)); assert_param(IS_SPI_NSS_LEVEL(SPI_NSSInternalSoft)); if (SPI_NSSInternalSoft != SPI_NSS_LOW) { SPIx->CTRL1 |= SPI_NSS_HIGH; } else { SPIx->CTRL1 &= SPI_NSS_LOW; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* @fh: file handle @attributes: attributes for newly created file Returns: 0 for success */
static int efi_create_file(struct file_handle *fh, u64 attributes)
/* @fh: file handle @attributes: attributes for newly created file Returns: 0 for success */ static int efi_create_file(struct file_handle *fh, u64 attributes)
{ loff_t actwrite; void *buffer = &actwrite; if (attributes & EFI_FILE_DIRECTORY) return fs_mkdir(fh->path); else return fs_write(fh->path, map_to_sysmem(buffer), 0, 0, &actwrite); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Configure pins as Analog Input Output EVENT_OUT EXTI */
void MX_GPIO_Init(void)
/* Configure pins as Analog Input Output EVENT_OUT EXTI */ void MX_GPIO_Init(void)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; __HAL_RCC_GPIOF_CLK_ENABLE(); __HAL_RCC_GPIOH_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); HAL_GPIO_WritePin(GPIOF, GPIO_PIN_9|GPIO_PIN_10, GPIO_PIN_RESET); GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_10; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct....
pikasTech/PikaPython
C++
MIT License
1,403
/* Return the powerdomain pointer associated with the OMAP module @oh's main clock. If @oh does not have a main clk, return the powerdomain associated with the interface clock associated with the module's MPU port. (XXX Perhaps this should use the SDMA port instead?) Returns NULL on error, or a struct powerdomain * on ...
struct powerdomain* omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
/* Return the powerdomain pointer associated with the OMAP module @oh's main clock. If @oh does not have a main clk, return the powerdomain associated with the interface clock associated with the module's MPU port. (XXX Perhaps this should use the SDMA port instead?) Returns NULL on error, or a struct powerdomain * on ...
{ struct clk *c; if (!oh) return NULL; if (oh->_clk) { c = oh->_clk; } else { if (oh->_int_flags & _HWMOD_NO_MPU_PORT) return NULL; c = oh->slaves[oh->_mpu_port_index]->_clk; } return c->clkdm->pwrdm.ptr; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If the update of the counter for the specified PWM generator has yet to be completed, the value returned may not be the active period. The value returned is the programmed period, measured in PWM clock ticks. */
uint32_t PWMGenPeriodGet(uint32_t ui32Base, uint32_t ui32Gen)
/* If the update of the counter for the specified PWM generator has yet to be completed, the value returned may not be the active period. The value returned is the programmed period, measured in PWM clock ticks. */ uint32_t PWMGenPeriodGet(uint32_t ui32Base, uint32_t ui32Gen)
{ ASSERT((ui32Base == PWM0_BASE) || (ui32Base == PWM1_BASE)); ASSERT(_PWMGenValid(ui32Gen)); ui32Gen = PWM_GEN_BADDR(ui32Base, ui32Gen); if(HWREG(ui32Gen + PWM_O_X_CTL) & PWM_X_CTL_MODE) { return(HWREG(ui32Gen + PWM_O_X_LOAD) * 2); } else { return(HWREG(ui32Gen + PWM_O_X_...
feaser/openblt
C++
GNU General Public License v3.0
601
/* Returns 0 on success or -EINVAL, -EFAULT, -EAGAIN in case of an error. */
static int convert_type86_xcrb(struct zcrypt_device *zdev, struct ap_message *reply, struct ica_xcRB *xcRB)
/* Returns 0 on success or -EINVAL, -EFAULT, -EAGAIN in case of an error. */ static int convert_type86_xcrb(struct zcrypt_device *zdev, struct ap_message *reply, struct ica_xcRB *xcRB)
{ struct type86_fmt2_msg *msg = reply->message; char *data = reply->message; if (copy_to_user(xcRB->reply_control_blk_addr, data + msg->fmt2.offset1, msg->fmt2.count1)) return -EFAULT; xcRB->reply_control_blk_length = msg->fmt2.count1; if (msg->fmt2.count2) if (copy_to_user(xcRB->reply_data_addr, data + m...
robutest/uclinux
C++
GPL-2.0
60
/* Find a route cache with the destination and source address. This is used by the ICMPv6 redirect message process. */
IP6_ROUTE_CACHE_ENTRY* Ip6FindRouteCache(IN IP6_ROUTE_TABLE *RtTable, IN EFI_IPv6_ADDRESS *Dest, IN EFI_IPv6_ADDRESS *Src)
/* Find a route cache with the destination and source address. This is used by the ICMPv6 redirect message process. */ IP6_ROUTE_CACHE_ENTRY* Ip6FindRouteCache(IN IP6_ROUTE_TABLE *RtTable, IN EFI_IPv6_ADDRESS *Dest, IN EFI_IPv6_ADDRESS *Src)
{ LIST_ENTRY *Entry; IP6_ROUTE_CACHE_ENTRY *RtCacheEntry; UINT32 Index; Index = IP6_ROUTE_CACHE_HASH (Dest, Src); NET_LIST_FOR_EACH (Entry, &RtTable->Cache.CacheBucket[Index]) { RtCacheEntry = NET_LIST_USER_STRUCT (Entry, IP6_ROUTE_CACHE_ENTRY, Link); if (EFI_IP6_EQUAL (De...
tianocore/edk2
C++
Other
4,240
/* __vxge_hw_vpath_reset_check - Check if resetting the vpath completed This routine checks the vpath_rst_in_prog register to see if adapter completed the reset process for the vpath */
enum vxge_hw_status __vxge_hw_vpath_reset_check(struct __vxge_hw_virtualpath *vpath)
/* __vxge_hw_vpath_reset_check - Check if resetting the vpath completed This routine checks the vpath_rst_in_prog register to see if adapter completed the reset process for the vpath */ enum vxge_hw_status __vxge_hw_vpath_reset_check(struct __vxge_hw_virtualpath *vpath)
{ enum vxge_hw_status status; status = __vxge_hw_device_register_poll( &vpath->hldev->common_reg->vpath_rst_in_prog, VXGE_HW_VPATH_RST_IN_PROG_VPATH_RST_IN_PROG( 1 << (16 - vpath->vp_id)), vpath->hldev->config.device_poll_millis); return status; }
robutest/uclinux
C++
GPL-2.0
60
/* atkbd_disable() tells input handler that all incoming data except for ACKs and command response should be dropped. */
static void atkbd_disable(struct atkbd *atkbd)
/* atkbd_disable() tells input handler that all incoming data except for ACKs and command response should be dropped. */ static void atkbd_disable(struct atkbd *atkbd)
{ serio_pause_rx(atkbd->ps2dev.serio); atkbd->enabled = 0; serio_continue_rx(atkbd->ps2dev.serio); }
robutest/uclinux
C++
GPL-2.0
60
/* Enables unicast hash filtering. When enabled GMAC performs the destination address filtering of unicast frames according to the hash table. */
void synopGMAC_unicast_hash_filter_enable(synopGMACdevice *gmacdev)
/* Enables unicast hash filtering. When enabled GMAC performs the destination address filtering of unicast frames according to the hash table. */ void synopGMAC_unicast_hash_filter_enable(synopGMACdevice *gmacdev)
{ synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacUcastHashFilter); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* They revolve around files there were unlinked from the directory, and this function updates the parent directory so that a full commit is properly done if it is fsync'd later after the unlinks are done. */
void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans, struct inode *dir, struct inode *inode, int for_rename)
/* They revolve around files there were unlinked from the directory, and this function updates the parent directory so that a full commit is properly done if it is fsync'd later after the unlinks are done. */ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans, struct inode *dir, struct inode *inode, int for...
{ if (S_ISREG(inode->i_mode)) BTRFS_I(inode)->last_unlink_trans = trans->transid; smp_mb(); if (BTRFS_I(dir)->logged_trans == trans->transid) return; if (BTRFS_I(inode)->logged_trans == trans->transid) return; if (for_rename) goto record; return; record: BTRFS_I(dir)->last_unlink_trans = trans->transid; ...
robutest/uclinux
C++
GPL-2.0
60
/* The maximum command line length is limited by the maximum space available in an SCCB */
static int chr_can_read(void *opaque)
/* The maximum command line length is limited by the maximum space available in an SCCB */ static int chr_can_read(void *opaque)
{ SCLPConsoleLM *scon = opaque; if (scon->event.event_pending) { return 0; } else if (SIZE_CONSOLE_BUFFER - scon->length) { return 1; } return 0; }
ve3wwg/teensy3_qemu
C++
Other
15
/* If Length is not aligned on a 16-bit boundary, then ASSERT(). If Buffer is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16* EFIAPI S3MmioReadBuffer16(IN UINTN StartAddress, IN UINTN Length, OUT UINT16 *Buffer)
/* If Length is not aligned on a 16-bit boundary, then ASSERT(). If Buffer is not aligned on a 16-bit boundary, then ASSERT(). */ UINT16* EFIAPI S3MmioReadBuffer16(IN UINTN StartAddress, IN UINTN Length, OUT UINT16 *Buffer)
{ UINT16 *ReturnBuffer; RETURN_STATUS Status; ReturnBuffer = MmioReadBuffer16 (StartAddress, Length, Buffer); Status = S3BootScriptSaveMemWrite ( S3BootScriptWidthUint16, StartAddress, Length / sizeof (UINT16), ReturnBuffer ); ASSERT (S...
tianocore/edk2
C++
Other
4,240
/* Writes a half-word to the LPC channel pool. */
void LPCHalfWordWrite(unsigned long ulBase, unsigned long ulOffset, unsigned short usData)
/* Writes a half-word to the LPC channel pool. */ void LPCHalfWordWrite(unsigned long ulBase, unsigned long ulOffset, unsigned short usData)
{ ASSERT(ulBase == LPC0_BASE); ASSERT((ulOffset & 1) == 0); ASSERT(ulOffset < (((HWREG(ulBase + LPC_O_STS) & LPC_STS_POOLSZ_M) >> 16) * 256)); HWREGH(ulBase + LPC_O_POOL + ulOffset) = usData; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* CAN Initialize a 32bit Message ID List Filter. */
void can_filter_id_list_32bit_init(uint32_t canport, uint32_t nr, uint32_t id1, uint32_t id2, uint32_t fifo, bool enable)
/* CAN Initialize a 32bit Message ID List Filter. */ void can_filter_id_list_32bit_init(uint32_t canport, uint32_t nr, uint32_t id1, uint32_t id2, uint32_t fifo, bool enable)
{ can_filter_init(canport, nr, true, true, id1, id2, fifo, enable); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Enables the timer/counter for a PWM generator block. */
void PWMGenEnable(uint32_t ui32Base, uint32_t ui32Gen)
/* Enables the timer/counter for a PWM generator block. */ void PWMGenEnable(uint32_t ui32Base, uint32_t ui32Gen)
{ ASSERT(ui32Base == PWM0_BASE); ASSERT(_PWMGenValid(ui32Gen)); HWREG(PWM_GEN_BADDR(ui32Base, ui32Gen) + PWM_O_X_CTL) |= PWM_X_CTL_ENABLE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sflash enable RCV mode to recovery for erase while power drop with lock. */
__WEAK int ATTR_TCM_SECTION bflb_xip_sflash_rcv_enable_with_lock(spi_flash_cfg_type *p_flash_cfg, uint8_t r_cmd, uint8_t w_cmd, uint8_t bit_pos)
/* Sflash enable RCV mode to recovery for erase while power drop with lock. */ __WEAK int ATTR_TCM_SECTION bflb_xip_sflash_rcv_enable_with_lock(spi_flash_cfg_type *p_flash_cfg, uint8_t r_cmd, uint8_t w_cmd, uint8_t bit_pos)
{ __disable_irq(); bflb_xip_sflash_rcv_enable_need_lock(p_flash_cfg, r_cmd, w_cmd, bit_pos, 0, 0); __enable_irq(); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Ctrl+E Go to the end of the line. */
static int handle_ctrl_e(struct shell_t *self_p)
/* Ctrl+E Go to the end of the line. */ static int handle_ctrl_e(struct shell_t *self_p)
{ line_seek_end(&self_p->line); return (0); }
eerimoq/simba
C++
Other
337
/* Get the touch screen X and Y positions values. */
void exc7200_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
/* Get the touch screen X and Y positions values. */ void exc7200_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
{ *X = (((aBufferTS[3]&0x00ff) << 4) | ((aBufferTS[2]&0x00f0) >> 4)) << 1; *Y = (((aBufferTS[5]&0x00ff) << 4) | ((aBufferTS[4]&0x00f0) >> 4)) << 1; IOE_ReadMultiple(DeviceAddr, EXC7200_READ_CMD, aBufferTS, 10); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* 3.2.2.3 Connection Release Requested No Data 3.2.2.4 Resource Available */
static guint16 be_res_avail(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
/* 3.2.2.3 Connection Release Requested No Data 3.2.2.4 Resource Available */ static guint16 be_res_avail(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
{ guint32 curr_offset; guint16 value; int i; proto_item* ti; curr_offset = offset; for (i=0; i < 5; i++) { value = tvb_get_ntohl(tvb, curr_offset); ti = proto_tree_add_uint_format(tree, hf_gsm_a_bssmap_full_rate_channels_available, tvb, curr_offset, 2, value, "Number of full ...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Function for doing action upon flash operation success event. */
static void flash_operation_success_run(void)
/* Function for doing action upon flash operation success event. */ static void flash_operation_success_run(void)
{ switch (m_state) { case STATE_STORE: store_sub_state_sm_run(); break; case STATE_DATA_ERASE: erase_sub_state_sm_run(); break; case STATE_DATA_ERASE_WITH_SWAP: swap_sub_state_sm_run(); ...
labapart/polymcu
C++
null
201
/* Un-Register the Service B.4 and all its Characteristics... */
void service_b_4_3_remove(void)
/* Un-Register the Service B.4 and all its Characteristics... */ void service_b_4_3_remove(void)
{ bt_gatt_service_unregister(&service_b_4_3_svc); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Retrieves a Unicode string that is the user readable name of the UEFI Driver. */
STATIC EFI_STATUS EFIAPI NonDiscoverablePciGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
/* Retrieves a Unicode string that is the user readable name of the UEFI Driver. */ STATIC EFI_STATUS EFIAPI NonDiscoverablePciGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mDriverNameTable, DriverName, (BOOLEAN)(This == &gComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* Reads a block of data from the Si1133 sensor. */
uint32_t SI1133_registerBlockRead(uint8_t reg, uint8_t length, uint8_t *data)
/* Reads a block of data from the Si1133 sensor. */ uint32_t SI1133_registerBlockRead(uint8_t reg, uint8_t length, uint8_t *data)
{ I2C_TransferSeq_TypeDef seq; I2C_TransferReturn_TypeDef ret; uint8_t i2c_write_data[1]; uint32_t retval; retval = SI1133_OK; seq.addr = SI1133_I2C_DEVICE_BUS_ADDRESS; seq.flags = I2C_FLAG_WRITE_READ; i2c_write_data[0] = reg; seq.buf[0].data = i2c_write_data; seq.buf[0].len = 1; seq.bu...
remotemcu/remcu-chip-sdks
C++
null
436
/* GMAC tries retransmission (Only in Half Duplex mode). If collision occurs on the GMII/MII, GMAC attempt retries based on the back off limit configured. */
void synopGMAC_retry_enable(synopGMACdevice *gmacdev)
/* GMAC tries retransmission (Only in Half Duplex mode). If collision occurs on the GMII/MII, GMAC attempt retries based on the back off limit configured. */ void synopGMAC_retry_enable(synopGMACdevice *gmacdev)
{ synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacRetry); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Searchs for a sap in the sap list of the LLC's station upon the sap ID. If the sap is found it will be refcounted and the user will have to do a llc_sap_put after use. Returns the sap or NULL if not found. */
struct llc_sap* llc_sap_find(unsigned char sap_value)
/* Searchs for a sap in the sap list of the LLC's station upon the sap ID. If the sap is found it will be refcounted and the user will have to do a llc_sap_put after use. Returns the sap or NULL if not found. */ struct llc_sap* llc_sap_find(unsigned char sap_value)
{ struct llc_sap* sap; read_lock_bh(&llc_sap_list_lock); sap = __llc_sap_find(sap_value); if (sap) llc_sap_hold(sap); read_unlock_bh(&llc_sap_list_lock); return sap; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Called by r300_do_cp_cmdbuf to update the internal buffer age and state. The actual age emit is done by r300_do_cp_cmdbuf, which is why you must be careful about how this function is called. */
static void r300_discard_buffer(struct drm_device *dev, struct drm_master *master, struct drm_buf *buf)
/* Called by r300_do_cp_cmdbuf to update the internal buffer age and state. The actual age emit is done by r300_do_cp_cmdbuf, which is why you must be careful about how this function is called. */ static void r300_discard_buffer(struct drm_device *dev, struct drm_master *master, struct drm_buf *buf)
{ drm_radeon_buf_priv_t *buf_priv = buf->dev_private; struct drm_radeon_master_private *master_priv = master->driver_priv; buf_priv->age = ++master_priv->sarea_priv->last_dispatch; buf->pending = 1; buf->used = 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Send a double command, receive one word (and throw it away) */
static int waveartist_cmd2(wavnc_info *devc, unsigned int cmd, unsigned int arg)
/* Send a double command, receive one word (and throw it away) */ static int waveartist_cmd2(wavnc_info *devc, unsigned int cmd, unsigned int arg)
{ unsigned int vals[2]; vals[0] = cmd; vals[1] = arg; return waveartist_cmd(devc, 2, vals, 1, vals); }
robutest/uclinux
C++
GPL-2.0
60
/* Release any memory and I/O resources that were allocated in qe_uart_request_port(). */
static void qe_uart_release_port(struct uart_port *port)
/* Release any memory and I/O resources that were allocated in qe_uart_request_port(). */ static void qe_uart_release_port(struct uart_port *port)
{ struct uart_qe_port *qe_port = container_of(port, struct uart_qe_port, port); struct ucc_slow_private *uccs = qe_port->us_private; dma_free_coherent(port->dev, qe_port->bd_size, qe_port->bd_virt, qe_port->bd_dma_addr); ucc_slow_free(uccs); }
robutest/uclinux
C++
GPL-2.0
60
/* This function enables the alarm outputs for the specified alarms in the Configuration Register 1. */
void XAdcPs_SetAlarmEnables(XAdcPs *InstancePtr, u16 AlmEnableMask)
/* This function enables the alarm outputs for the specified alarms in the Configuration Register 1. */ void XAdcPs_SetAlarmEnables(XAdcPs *InstancePtr, u16 AlmEnableMask)
{ u32 RegValue; Xil_AssertVoid(InstancePtr != NULL); Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); RegValue = XAdcPs_ReadInternalReg(InstancePtr, XADCPS_CFR1_OFFSET); RegValue &= ~XADCPS_CFR1_ALM_ALL_MASK; RegValue |= (~(u32)AlmEnableMask & XADCPS_CFR1_ALM_ALL_MASK); XAdcPs_WriteInternalReg(Ins...
ua1arn/hftrx
C++
null
69
/* The processor must either be the current processor and the thread pinned to the current processor or a processor that is not online. */
static void drain_pages(unsigned int cpu)
/* The processor must either be the current processor and the thread pinned to the current processor or a processor that is not online. */ static void drain_pages(unsigned int cpu)
{ unsigned long flags; struct zone *zone; for_each_populated_zone(zone) { struct per_cpu_pageset *pset; struct per_cpu_pages *pcp; pset = zone_pcp(zone, cpu); pcp = &pset->pcp; local_irq_save(flags); free_pcppages_bulk(zone, pcp->count, pcp); pcp->count = 0; local_irq_restore(flags); } }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: pointer to a struct fcoe_interface or NULL on error */
static struct fcoe_interface* fcoe_interface_create(struct net_device *netdev)
/* Returns: pointer to a struct fcoe_interface or NULL on error */ static struct fcoe_interface* fcoe_interface_create(struct net_device *netdev)
{ struct fcoe_interface *fcoe; int err; fcoe = kzalloc(sizeof(*fcoe), GFP_KERNEL); if (!fcoe) { FCOE_NETDEV_DBG(netdev, "Could not allocate fcoe structure\n"); return NULL; } dev_hold(netdev); kref_init(&fcoe->kref); fcoe_ctlr_init(&fcoe->ctlr); fcoe->ctlr.send = fcoe_fip_send; fcoe->ctlr.update_mac = fco...
robutest/uclinux
C++
GPL-2.0
60
/* Basic Configuration of TRNG and PRNG. The function is used to set the basic configuration for TRNG and PRNG. */
static void RNG_BasicConfig()
/* Basic Configuration of TRNG and PRNG. The function is used to set the basic configuration for TRNG and PRNG. */ static void RNG_BasicConfig()
{ int32_t i; int32_t timeout = 0x1000000; CLK->AHBCLK0 |= CLK_AHBCLK0_CRPTCKEN_Msk; CLK->APBCLK1 |= CLK_APBCLK1_TRNGCKEN_Msk; CLK->PWRCTL |= CLK_PWRCTL_LIRCEN_Msk; while ((CLK->STATUS & CLK_STATUS_LIRCSTB_Msk) == 0) { if (i++ > timeout) break; } CLK->CLKSEL2 = (CLK->CLKSEL2 &...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check that the effect_id is a valid effect and whether the user is the owner */
static int check_effect_access(struct ff_device *ff, int effect_id, struct file *file)
/* Check that the effect_id is a valid effect and whether the user is the owner */ static int check_effect_access(struct ff_device *ff, int effect_id, struct file *file)
{ if (effect_id < 0 || effect_id >= ff->max_effects || !ff->effect_owners[effect_id]) return -EINVAL; if (file && ff->effect_owners[effect_id] != file) return -EACCES; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Look up an AVC entry that is valid for the (@ssid, @tsid), interpreting the permissions based on @tclass. If a valid AVC entry exists, then this function return the */
static struct avc_node* avc_lookup(u32 ssid, u32 tsid, u16 tclass)
/* Look up an AVC entry that is valid for the (@ssid, @tsid), interpreting the permissions based on @tclass. If a valid AVC entry exists, then this function return the */ static struct avc_node* avc_lookup(u32 ssid, u32 tsid, u16 tclass)
{ struct avc_node *node; avc_cache_stats_incr(lookups); node = avc_search_node(ssid, tsid, tclass); if (node) avc_cache_stats_incr(hits); else avc_cache_stats_incr(misses); return node; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns: the ID (greater than 0) for the source */
guint g_source_get_id(GSource *source)
/* Returns: the ID (greater than 0) for the source */ guint g_source_get_id(GSource *source)
{ guint result; g_return_val_if_fail (source != NULL, 0); g_return_val_if_fail (source->context != NULL, 0); LOCK_CONTEXT (source->context); result = source->source_id; UNLOCK_CONTEXT (source->context); return result; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* UART MSP Initialization This function configures the hardware resources used in this example: */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
/* UART MSP Initialization This function configures the hardware resources used in this example: */ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{ GPIO_InitTypeDef GPIO_InitStruct; USARTx_TX_GPIO_CLK_ENABLE(); USARTx_RX_GPIO_CLK_ENABLE(); USARTx_CLK_ENABLE(); GPIO_InitStruct.Pin = USARTx_TX_PIN; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; GPIO_InitS...
STMicroelectronics/STM32CubeF4
C++
Other
789
/* time stamp Update This function updates (adds/subtracts) with the value specified in the Timestamp High Update and Timestamp Low Update register. */
s32 synopGMAC_TS_timestamp_update(synopGMACdevice *gmacdev, u32 high_value, u32 low_value)
/* time stamp Update This function updates (adds/subtracts) with the value specified in the Timestamp High Update and Timestamp Low Update register. */ s32 synopGMAC_TS_timestamp_update(synopGMACdevice *gmacdev, u32 high_value, u32 low_value)
{ u32 loop_variable; synopGMACWriteReg(gmacdev->MacBase, GmacTSHighUpdate, high_value); synopGMACWriteReg(gmacdev->MacBase, GmacTSLowUpdate, low_value); for (loop_variable = 0; loop_variable < DEFAULT_LOOP_VARIABLE; loop_variable++) { if (!((synopGMACReadReg(gmacdev->MacBase, GmacTSControl))...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* device attribute for switching shared/nonshared (exclusive) operation (show + store) */
static ssize_t dcssblk_shared_show(struct device *dev, struct device_attribute *attr, char *buf)
/* device attribute for switching shared/nonshared (exclusive) operation (show + store) */ static ssize_t dcssblk_shared_show(struct device *dev, struct device_attribute *attr, char *buf)
{ struct dcssblk_dev_info *dev_info; dev_info = container_of(dev, struct dcssblk_dev_info, dev); return sprintf(buf, dev_info->is_shared ? "1\n" : "0\n"); }
robutest/uclinux
C++
GPL-2.0
60
/* Task to read and process the HID report descriptor and HID reports from the device and display the results onto the board LEDs. */
void MouseHost_Task(void)
/* Task to read and process the HID report descriptor and HID reports from the device and display the results onto the board LEDs. */ void MouseHost_Task(void)
{ if (USB_HostState != HOST_STATE_Configured) return; Pipe_SelectPipe(MOUSE_DATA_IN_PIPE); Pipe_Unfreeze(); if (Pipe_IsINReceived()) { if (Pipe_IsReadWriteAllowed()) { uint8_t MouseReport[Pipe_BytesInPipe()]; Pipe_Read_Stream_LE(MouseReport, Pipe_BytesInPipe(), NULL); ProcessMouseReport(MouseReport...
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Put the app inc (only called from timer or net softirq) */
void ip_vs_app_inc_put(struct ip_vs_app *inc)
/* Put the app inc (only called from timer or net softirq) */ void ip_vs_app_inc_put(struct ip_vs_app *inc)
{ ip_vs_app_put(inc->app); atomic_dec(&inc->usecnt); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* UART DMA receive finished callback function. This function is called when UART DMA receive finished. It disables the UART RX DMA request and sends kStatus_UART_RxIdle to UART callback. */
static void UART_TransferReceiveDMACallback(dma_handle_t *handle, void *param)
/* UART DMA receive finished callback function. This function is called when UART DMA receive finished. It disables the UART RX DMA request and sends kStatus_UART_RxIdle to UART callback. */ static void UART_TransferReceiveDMACallback(dma_handle_t *handle, void *param)
{ uart_dma_private_handle_t *uartPrivateHandle = (uart_dma_private_handle_t *)param; UART_EnableRxDMA(uartPrivateHandle->base, false); DMA_DisableInterrupts(handle->base, handle->channel); uartPrivateHandle->handle->rxState = kUART_RxIdle; if (uartPrivateHandle->handle->callback) { uartP...
labapart/polymcu
C++
null
201
/* The SPI_Handler must be called by the SPI Interrupt Service Routine with the corresponding SPI instance to enable ILI9225 driver support. */
void ili9225_spi_handler(void)
/* The SPI_Handler must be called by the SPI Interrupt Service Routine with the corresponding SPI instance to enable ILI9225 driver support. */ void ili9225_spi_handler(void)
{ uint32_t ul_spi_reg; ul_spi_reg = spi_read_interrupt_mask(BOARD_ILI9225_SPI); spi_disable_interrupt(BOARD_ILI9225_SPI, ul_spi_reg); g_by_transfend_flag = 1; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Shift the entire display n unit to the right. */
void SPLC780DisplayRightShift(unsigned char n)
/* Shift the entire display n unit to the right. */ void SPLC780DisplayRightShift(unsigned char n)
{ int i = n; while(i--) { while(SPLC780Busy()); SPLC780WriteCmd(SPLC780_CMD_CURSOR_DISPLAY_SHIFT( SPLC780_CURSOR_DISPLAY_SHIFT_SC_S | SPLC780_CURSOR_DISPLAY_SHIFT_RL_R)); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Sends 3+3 bytes of data to the LCD using the format specified by the LCD Guide. */
void halLcdSendCommand(unsigned char Data[])
/* Sends 3+3 bytes of data to the LCD using the format specified by the LCD Guide. */ void halLcdSendCommand(unsigned char Data[])
{ unsigned char i; LCD_CS_RST_OUT &= ~LCD_CS_PIN; for ( i = 0; i < 6; i++ ) { while (!(UCB2IFG & UCTXIFG)); UCB2TXBUF = Data[i]; if (i == 2) { while (UCB2STAT & UCBUSY); LCD_CS_RST_OUT |= LCD_CS_PIN; LCD_CS_RST_OUT &= ~LCD_CS_PIN; } } while (UCB2STAT & UCBUSY); ...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Invoked when a new SETUP request is received from the host. Forwards the request to the Mass Storage device driver handler function. */
char MSDD_Read(void *data, unsigned int size, TransferCallback callback, void *argument)
/* Invoked when a new SETUP request is received from the host. Forwards the request to the Mass Storage device driver handler function. */ char MSDD_Read(void *data, unsigned int size, TransferCallback callback, void *argument)
{ return USBD_Read(MSDDriverDescriptors_BULKOUT, data, size, callback, argument); }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* For P->M transfers, disable the peripheral first to stop it filling the DMAC FIFO, and then pause the DMAC. */
static void pl08x_pause_phy_chan(struct pl08x_phy_chan *ch)
/* For P->M transfers, disable the peripheral first to stop it filling the DMAC FIFO, and then pause the DMAC. */ static void pl08x_pause_phy_chan(struct pl08x_phy_chan *ch)
{ u32 val; int timeout; val = readl(ch->base + PL080_CH_CONFIG); val |= PL080_CONFIG_HALT; writel(val, ch->base + PL080_CH_CONFIG); for (timeout = 1000; timeout; timeout--) { if (!pl08x_phy_channel_busy(ch)) break; udelay(1); } if (pl08x_phy_channel_busy(ch)) pr_err("pl08x: channel%u timeout waiting fo...
EmcraftSystems/linux-emcraft
C++
Other
266