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
/* This function returns a 32-bit inode number if the boot parameter nfs.enable_ino64 is zero. */
u64 nfs_compat_user_ino64(u64 fileid)
/* This function returns a 32-bit inode number if the boot parameter nfs.enable_ino64 is zero. */ u64 nfs_compat_user_ino64(u64 fileid)
{ int ino; if (enable_ino64) return fileid; ino = fileid; if (sizeof(ino) < sizeof(fileid)) ino ^= fileid >> (sizeof(fileid)-sizeof(ino)) * 8; return ino; }
robutest/uclinux
C++
GPL-2.0
60
/* All MAS are available initially. The RC will inform use which slots are used for the BP (it may change in size). */
void uwb_drp_avail_init(struct uwb_rc *rc)
/* All MAS are available initially. The RC will inform use which slots are used for the BP (it may change in size). */ void uwb_drp_avail_init(struct uwb_rc *rc)
{ bitmap_fill(rc->drp_avail.global, UWB_NUM_MAS); bitmap_fill(rc->drp_avail.local, UWB_NUM_MAS); bitmap_fill(rc->drp_avail.pending, UWB_NUM_MAS); }
robutest/uclinux
C++
GPL-2.0
60
/* Change Logs: Date Author Notes Wayne first version */
void plat_delay(u32 delay)
/* Change Logs: Date Author Notes Wayne first version */ void plat_delay(u32 delay)
{ volatile u32 loop = delay; while (loop--); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads three signed 16 bit values over I2C. */
err_t lsm303magRead48(uint8_t addr, uint8_t reg, uint8_t buffer[6])
/* Reads three signed 16 bit values over I2C. */ err_t lsm303magRead48(uint8_t addr, uint8_t reg, uint8_t buffer[6])
{ I2CWriteLength = 2; I2CReadLength = 0; I2CMasterBuffer[0] = addr; I2CMasterBuffer[1] = reg | (0x80); i2cEngine(); I2CWriteLength = 0; I2CReadLength = 6; I2CMasterBuffer[0] = addr | 0x01; ASSERT_I2C_STATUS(i2cEngine()); uint8_t i; for (i = 0; i < 6; i++) { buffer[i] = I2CSlaveBuffer[i]; }...
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* check how to process the changed data in current form or form set. */
BOOLEAN ProcessChangedData(IN OUT UI_MENU_SELECTION *Selection, IN BROWSER_SETTING_SCOPE Scope)
/* check how to process the changed data in current form or form set. */ BOOLEAN ProcessChangedData(IN OUT UI_MENU_SELECTION *Selection, IN BROWSER_SETTING_SCOPE Scope)
{ BOOLEAN RetValue; EFI_STATUS Status; RetValue = TRUE; switch (mFormDisplay->ConfirmDataChange ()) { case BROWSER_ACTION_DISCARD: DiscardForm (Selection->FormSet, Selection->Form, Scope); break; case BROWSER_ACTION_SUBMIT: Status = SubmitForm (Selection->FormSet, Selection->Form,...
tianocore/edk2
C++
Other
4,240
/* Write to port 'port' register 'reg', where the registers for the different ports are 'spacing' registers apart. */
static void pm3386_port_reg_write(int port, int _reg, int spacing, u16 value)
/* Write to port 'port' register 'reg', where the registers for the different ports are 'spacing' registers apart. */ static void pm3386_port_reg_write(int port, int _reg, int spacing, u16 value)
{ int reg; reg = _reg; if (port & 1) reg += spacing; pm3386_reg_write(port >> 1, reg, value); }
robutest/uclinux
C++
GPL-2.0
60
/* Converts a text device path node to Vendor defined VT100 device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVenVt100(CHAR16 *TextDeviceNode)
/* Converts a text device path node to Vendor defined VT100 device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVenVt100(CHAR16 *TextDeviceNode)
{ VENDOR_DEVICE_PATH *Vendor; Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode ( MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, (UINT16) sizeof (VENDOR_DEVICE_PATH)); CopyGuid (&Vendor->Guid, &gEfiVT100Guid); ret...
tianocore/edk2
C++
Other
4,240
/* pulls a cnode off the free list, or returns NULL on failure */
static struct reiserfs_journal_cnode* get_cnode(struct super_block *sb)
/* pulls a cnode off the free list, or returns NULL on failure */ static struct reiserfs_journal_cnode* get_cnode(struct super_block *sb)
{ struct reiserfs_journal_cnode *cn; struct reiserfs_journal *journal = SB_JOURNAL(sb); reiserfs_check_lock_depth(sb, "get_cnode"); if (journal->j_cnode_free <= 0) { return NULL; } journal->j_cnode_used++; journal->j_cnode_free--; cn = journal->j_cnode_free_list; if (!cn) { return cn; } if (cn->next) { ...
robutest/uclinux
C++
GPL-2.0
60
/* If Irq is larger than the maximum number I/O APIC redirection entries, then ASSERT(). */
VOID EFIAPI IoApicEnableInterrupt(IN UINTN Irq, IN BOOLEAN Enable)
/* If Irq is larger than the maximum number I/O APIC redirection entries, then ASSERT(). */ VOID EFIAPI IoApicEnableInterrupt(IN UINTN Irq, IN BOOLEAN Enable)
{ IO_APIC_VERSION_REGISTER Version; IO_APIC_REDIRECTION_TABLE_ENTRY Entry; Version.Uint32 = IoApicRead (IO_APIC_VERSION_REGISTER_INDEX); ASSERT (Version.Bits.MaximumRedirectionEntry < 0xF0); ASSERT (Irq <= Version.Bits.MaximumRedirectionEntry); Entry.Uint32.Low = IoApicRead (IO_APIC_REDIRECTION_TAB...
tianocore/edk2
C++
Other
4,240
/* Atomic subtraction primitive. is atomically subtracted from the value at <target>, placing the result at <target>, and the old value from <target> is returned. */
atomic_val_t atomic_sub(atomic_t *target, atomic_val_t value)
/* Atomic subtraction primitive. is atomically subtracted from the value at <target>, placing the result at <target>, and the old value from <target> is returned. */ atomic_val_t atomic_sub(atomic_t *target, atomic_val_t value)
{ unsigned int key; atomic_val_t ret; key = irq_lock(); ret = *target; *target -= value; irq_unlock(key); return ret; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and ...
UINT16 EFIAPI PciBitFieldWrite16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and ...
{ return PciCf8BitFieldWrite16 (Address, StartBit, EndBit, Value); }
tianocore/edk2
C++
Other
4,240
/* convert ecc bytes to aligned, zero-padded 32-bit ecc words */
static void load_ecc8(struct bch_control *bch, uint32_t *dst, const uint8_t *src)
/* convert ecc bytes to aligned, zero-padded 32-bit ecc words */ static void load_ecc8(struct bch_control *bch, uint32_t *dst, const uint8_t *src)
{ uint8_t pad[4] = {0, 0, 0, 0}; unsigned int i, nwords = BCH_ECC_WORDS(bch)-1; for (i = 0; i < nwords; i++, src += 4) dst[i] = (src[0] << 24)|(src[1] << 16)|(src[2] << 8)|src[3]; memcpy(pad, src, BCH_ECC_BYTES(bch)-4*nwords); dst[nwords] = (pad[0] << 24)|(pad[1] << 16)|(pad[2] << 8)|pad[3]; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns: (element-type GAppInfo) (transfer full): #GList of #GAppInfos for given @content_type or NULL on error. */
GList* g_app_info_get_all_for_type(const char *content_type)
/* Returns: (element-type GAppInfo) (transfer full): #GList of #GAppInfos for given @content_type or NULL on error. */ GList* g_app_info_get_all_for_type(const char *content_type)
{ gchar **desktop_ids; GList *infos; gint i; g_return_val_if_fail (content_type != NULL, NULL); desktop_ids = g_desktop_app_info_get_desktop_ids_for_content_type (content_type, TRUE); infos = NULL; for (i = 0; desktop_ids[i]; i++) { GDesktopAppInfo *info; info = g_desktop_app_info_new (des...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* usbvision_empty_framequeues() prepare queues for incoming and outgoing frames */
void usbvision_empty_framequeues(struct usb_usbvision *usbvision)
/* usbvision_empty_framequeues() prepare queues for incoming and outgoing frames */ void usbvision_empty_framequeues(struct usb_usbvision *usbvision)
{ u32 i; INIT_LIST_HEAD(&(usbvision->inqueue)); INIT_LIST_HEAD(&(usbvision->outqueue)); for (i = 0; i < USBVISION_NUMFRAMES; i++) { usbvision->frame[i].grabstate = FrameState_Unused; usbvision->frame[i].bytes_read = 0; } }
robutest/uclinux
C++
GPL-2.0
60
/* @ops: contains AVB ops handlers @partition: partition name (NUL-terminated UTF-8 string) @guid_buf: buf, used to copy in GUID string. Example of value: 527c1c6d-6361-4593-8842-3c78fcd39219 @guid_buf_size: @guid_buf buffer size */
static AvbIOResult get_unique_guid_for_partition(AvbOps *ops, const char *partition, char *guid_buf, size_t guid_buf_size)
/* @ops: contains AVB ops handlers @partition: partition name (NUL-terminated UTF-8 string) @guid_buf: buf, used to copy in GUID string. Example of value: 527c1c6d-6361-4593-8842-3c78fcd39219 @guid_buf_size: @guid_buf buffer size */ static AvbIOResult get_unique_guid_for_partition(AvbOps *ops, const char *partition, ch...
{ struct mmc_part *part; size_t uuid_size; part = get_partition(ops, partition); if (!part) return AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION; uuid_size = sizeof(part->info.uuid); if (uuid_size > guid_buf_size) return AVB_IO_RESULT_ERROR_IO; memcpy(guid_buf, part->info.uuid, uuid_size); guid_buf[uuid_size - 1] =...
4ms/stm32mp1-baremetal
C++
Other
137
/* Initialize a work space when there is no work space. */
EFI_STATUS InitWorkSpaceHeader(IN EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *WorkingHeader)
/* Initialize a work space when there is no work space. */ EFI_STATUS InitWorkSpaceHeader(IN EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *WorkingHeader)
{ if (WorkingHeader == NULL) { return EFI_INVALID_PARAMETER; } CopyMem (WorkingHeader, &mWorkingBlockHeader, sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER)); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Print the information for an unreferenced object to the seq file. */
static int kmemleak_seq_show(struct seq_file *seq, void *v)
/* Print the information for an unreferenced object to the seq file. */ static int kmemleak_seq_show(struct seq_file *seq, void *v)
{ struct kmemleak_object *object = v; unsigned long flags; spin_lock_irqsave(&object->lock, flags); if ((object->flags & OBJECT_REPORTED) && unreferenced_object(object)) print_unreferenced(seq, object); spin_unlock_irqrestore(&object->lock, flags); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Registers a USB device endpoint callback. Registers a callback function which is implemented by the user. */
enum status_code usb_device_endpoint_register_callback(struct usb_module *module_inst, uint8_t ep_num, enum usb_device_endpoint_callback callback_type, usb_device_endpoint_callback_t callback_func)
/* Registers a USB device endpoint callback. Registers a callback function which is implemented by the user. */ enum status_code usb_device_endpoint_register_callback(struct usb_module *module_inst, uint8_t ep_num, enum usb_device_endpoint_callback callback_type, usb_device_endpoint_callback_t callback_func)
{ Assert(module_inst); Assert(ep_num < USB_EPT_NUM); Assert(callback_func); module_inst->device_endpoint_callback[ep_num][callback_type] = callback_func; module_inst->device_endpoint_registered_callback_mask[ep_num] |= _usb_endpoint_irq_bits[callback_type]; return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* This function should be only used for timestamps returned by current_kernel_time() or CURRENT_TIME, not with do_gettimeofday() because it doesn't handle the better resolution of the latter. */
struct timespec timespec_trunc(struct timespec t, unsigned gran)
/* This function should be only used for timestamps returned by current_kernel_time() or CURRENT_TIME, not with do_gettimeofday() because it doesn't handle the better resolution of the latter. */ struct timespec timespec_trunc(struct timespec t, unsigned gran)
{ if (gran <= jiffies_to_usecs(1) * 1000) { } else if (gran == 1000000000) { t.tv_nsec = 0; } else { t.tv_nsec -= t.tv_nsec % gran; } return t; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The interrupt handler for DMA interrupts from the memory channel. */
void DMA0IntHandler(void)
/* The interrupt handler for DMA interrupts from the memory channel. */ void DMA0IntHandler(void)
{ unsigned long ulEvent = 0; ulEvent = xHWREG(DMA0_BASE + DMA_DSR_BCR) & 0x71000000; xHWREG(DMA0_BASE + DMA_DSR_BCR) |= DMA_DSR_BCR_DONE; if(g_psDMAChannelAssignTable[0].pfnDMAChannelHandlerCallback != 0) { g_psDMAChannelAssignTable[0].pfnDMAChannelHandlerCallback(0,0,ulEvent,0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Request the PE to send a Display Port Config. */
USBPD_StatusTypeDef USBPD_DPM_RequestDisplayPortConfig(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID)
/* Request the PE to send a Display Port Config. */ USBPD_StatusTypeDef USBPD_DPM_RequestDisplayPortConfig(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID)
{ return USBPD_PE_SVDM_RequestSpecific(PortNum, SOPType, SVDM_SPECIFIC_2, SVID); }
st-one/X-CUBE-USB-PD
C++
null
110
/* Return the number of bytes of data available in the circular buffer. */
static int serial_buf_data_avail(struct circ_buf *cb)
/* Return the number of bytes of data available in the circular buffer. */ static int serial_buf_data_avail(struct circ_buf *cb)
{ return CIRC_CNT(cb->head, cb->tail, AIRCABLE_BUF_SIZE); }
robutest/uclinux
C++
GPL-2.0
60
/* The created task to handle the USB demo functionality. */
void vUSBDemoTask(void *pvParameters)
/* The created task to handle the USB demo functionality. */ void vUSBDemoTask(void *pvParameters)
{ xISRStatus *pxMessage; ( void ) pvParameters; portENTER_CRITICAL(); vInitUSBInterface(); portEXIT_CRITICAL(); for( ;; ) { if( xQueueReceive( xUSBInterruptQueue, &pxMessage, usbSHORT_DELAY ) ) { if( pxMessage->ulISR & AT91C_UDP_EPINT0 ) { prvProcessEndPoint0Interrupt( pxMessage ); } ...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Unlocks a GPIO pin which had been previously locked. */
void GPIOUnlockPin(uint32_t ui32Port, uint8_t ui8Pins)
/* Unlocks a GPIO pin which had been previously locked. */ void GPIOUnlockPin(uint32_t ui32Port, uint8_t ui8Pins)
{ ASSERT(_GPIOBaseValid(ui32Port)); HWREG(ui32Port + GPIO_O_LOCK) = GPIO_LOCK_KEY; HWREG(ui32Port + GPIO_O_CR) |= ui8Pins; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* CAN Init Initialize the selected CAN peripheral block. */
void can_init(uint32_t canport, bool listen_only, uint32_t sjw, uint32_t tseg1, uint32_t tseg2, bool sam3, uint32_t brp)
/* CAN Init Initialize the selected CAN peripheral block. */ void can_init(uint32_t canport, bool listen_only, uint32_t sjw, uint32_t tseg1, uint32_t tseg2, bool sam3, uint32_t brp)
{ CAN_ISR_SR_CMR_MR(canport) = CAN_MR_RM; CAN_ISR_SR_CMR_MR_SET(canport, CAN_MR_AFM); if (listen_only) { CAN_ISR_SR_CMR_MR_SET(canport, CAN_MR_LOM); } CAN_BTR1_BTR0_RMC_IMR(canport) = CAN_BTR0_BRP(brp) | CAN_BTR0_SJW(sjw) | CAN_BTR1_TSEG1(tseg1) | CAN_BTR1_TSEG2(tseg2); if (sam3) { CAN_BTR1_BTR0_RMC_IMR(can...
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* The client station's actual transmit power shall be within +/- 5dB of */
void ChangeToCellPowerLimit(struct rt_rtmp_adapter *pAd, u8 AironetCellPowerLimit)
/* The client station's actual transmit power shall be within +/- 5dB of */ void ChangeToCellPowerLimit(struct rt_rtmp_adapter *pAd, u8 AironetCellPowerLimit)
{ if (AironetCellPowerLimit == 0xFF) return; if (AironetCellPowerLimit < 6) pAd->CommonCfg.TxPowerPercentage = 6; else if (AironetCellPowerLimit < 9) pAd->CommonCfg.TxPowerPercentage = 10; else if (AironetCellPowerLimit < 12) pAd->CommonCfg.TxPowerPercentage = 25; else if (AironetCellPowerLimit < 14) pAd...
robutest/uclinux
C++
GPL-2.0
60
/* Process 1st operand 'v' of binary operation 'op' before reading 2nd operand. */
void luaK_infix(FuncState *fs, BinOpr op, expdesc *v)
/* Process 1st operand 'v' of binary operation 'op' before reading 2nd operand. */ void luaK_infix(FuncState *fs, BinOpr op, expdesc *v)
{ case OPR_AND: { luaK_goiftrue(fs, v); break; } case OPR_OR: { luaK_goiffalse(fs, v); break; } case OPR_CONCAT: { luaK_exp2nextreg(fs, v); break; } case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV: case OPR_IDIV: case OPR_MOD: case OPR_POW: ...
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Indicate if the device emitted a reboot barker that indicates "signed boot" */
static unsigned i2400m_boot_is_signed(struct i2400m *i2400m)
/* Indicate if the device emitted a reboot barker that indicates "signed boot" */ static unsigned i2400m_boot_is_signed(struct i2400m *i2400m)
{ return likely(i2400m->sboot); }
robutest/uclinux
C++
GPL-2.0
60
/* This function is used when filesystem needs to initialize quotas during mount time. */
int vfs_quota_on_mount(struct super_block *sb, char *qf_name, int format_id, int type)
/* This function is used when filesystem needs to initialize quotas during mount time. */ int vfs_quota_on_mount(struct super_block *sb, char *qf_name, int format_id, int type)
{ struct dentry *dentry; int error; mutex_lock(&sb->s_root->d_inode->i_mutex); dentry = lookup_one_len(qf_name, sb->s_root, strlen(qf_name)); mutex_unlock(&sb->s_root->d_inode->i_mutex); if (IS_ERR(dentry)) return PTR_ERR(dentry); if (!dentry->d_inode) { error = -ENOENT; goto out; } error = security_quot...
robutest/uclinux
C++
GPL-2.0
60
/* param base LPSPI peripheral address. param handle pointer to lpspi_master_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. return status of status_t. */
status_t LPSPI_MasterTransferGetCount(LPSPI_Type *base, lpspi_master_handle_t *handle, size_t *count)
/* param base LPSPI peripheral address. param handle pointer to lpspi_master_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. return status of status_t. */ status_t LPSPI_MasterTransferGetCount(LPSPI_Type *base, lpspi_master_handle_t *h...
{ assert(handle); if (NULL == count) { return kStatus_InvalidArgument; } if (handle->state != (uint8_t)kLPSPI_Busy) { *count = 0; return kStatus_NoTransferInProgress; } size_t remainingByte; if (handle->rxData != NULL) { remainingByte = handle->rxR...
eclipse-threadx/getting-started
C++
Other
310
/* This function returns with %1 if the write-buffer contains some data from the given inode otherwise it returns with %0. */
static int wbuf_has_ino(struct ubifs_wbuf *wbuf, ino_t inum)
/* This function returns with %1 if the write-buffer contains some data from the given inode otherwise it returns with %0. */ static int wbuf_has_ino(struct ubifs_wbuf *wbuf, ino_t inum)
{ int i, ret = 0; spin_lock(&wbuf->lock); for (i = 0; i < wbuf->next_ino; i++) if (inum == wbuf->inodes[i]) { ret = 1; break; } spin_unlock(&wbuf->lock); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* @dev: Device to change @rq: the request @cmd: the command Returns Zero on success */
int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
/* @dev: Device to change @rq: the request @cmd: the command Returns Zero on success */ int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{ struct octeon_ethernet *priv = netdev_priv(dev); if (!netif_running(dev)) return -EINVAL; if (!priv->phydev) return -EINVAL; return phy_mii_ioctl(priv->phydev, if_mii(rq), cmd); }
robutest/uclinux
C++
GPL-2.0
60
/* Disable Peripheral Clock in running mode. Disable the clock on particular peripheral. */
void rcc_periph_clock_disable(enum rcc_periph_clken clken)
/* Disable Peripheral Clock in running mode. Disable the clock on particular peripheral. */ void rcc_periph_clock_disable(enum rcc_periph_clken clken)
{ _RCC_REG(clken) &= ~_RCC_BIT(clken); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* param base PWM peripheral base address param subModule PWM submodule to configure param pwmChannel Channel to configure param mode Signal to output when a FORCE_OUT is triggered */
void PWM_SetupForceSignal(PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel, pwm_force_signal_t mode)
/* param base PWM peripheral base address param subModule PWM submodule to configure param pwmChannel Channel to configure param mode Signal to output when a FORCE_OUT is triggered */ void PWM_SetupForceSignal(PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel, pwm_force_signal_t mode)
{ uint16_t shift; uint16_t reg; shift = ((uint16_t)subModule * 4U) + ((uint16_t)pwmChannel * 2U); reg = base->DTSRCSEL; reg &= ~((uint16_t)0x3U << shift); reg |= (uint16_t)((uint16_t)mode << shift); base->DTSRCSEL = reg; }
eclipse-threadx/getting-started
C++
Other
310
/* Convert the decimal-constant string or hex-constant string into a numerical value. */
UINTN IScsiNetNtoi(IN CHAR8 *Str)
/* Convert the decimal-constant string or hex-constant string into a numerical value. */ UINTN IScsiNetNtoi(IN CHAR8 *Str)
{ if ((Str[0] == '0') && ((Str[1] == 'x') || (Str[1] == 'X'))) { Str += 2; return AsciiStrHexToUintn (Str); } return AsciiStrDecimalToUintn (Str); }
tianocore/edk2
C++
Other
4,240
/* Allocate enough pages to cover @size from the page level allocator with @gfp_mask flags. Map them into contiguous kernel virtual space, using a pagetable protection of @prot. */
static void * __vmalloc_node(unsigned long size, unsigned long align, gfp_t gfp_mask, pgprot_t prot, int node, void *caller)
/* Allocate enough pages to cover @size from the page level allocator with @gfp_mask flags. Map them into contiguous kernel virtual space, using a pagetable protection of @prot. */ static void * __vmalloc_node(unsigned long size, unsigned long align, gfp_t gfp_mask, pgprot_t prot, int node, void *caller)
{ struct vm_struct *area; void *addr; unsigned long real_size = size; size = PAGE_ALIGN(size); if (!size || (size >> PAGE_SHIFT) > totalram_pages) return NULL; area = __get_vm_area_node(size, align, VM_ALLOC, VMALLOC_START, VMALLOC_END, node, gfp_mask, caller); if (!area) return NULL; addr = __vmalloc...
robutest/uclinux
C++
GPL-2.0
60
/* Returns 0 on success. Currently it always succeeds. */
int parport_register_driver(struct parport_driver *drv)
/* Returns 0 on success. Currently it always succeeds. */ int parport_register_driver(struct parport_driver *drv)
{ struct parport *port; if (list_empty(&portlist)) get_lowlevel_driver (); mutex_lock(&registration_lock); list_for_each_entry(port, &portlist, list) drv->attach(port); list_add(&drv->list, &drivers); mutex_unlock(&registration_lock); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Disable the clock via the clock gating registers */
static void local_clk_disable(struct clk *clk)
/* Disable the clock via the clock gating registers */ static void local_clk_disable(struct clk *clk)
{ kinetis_periph_enable(clk->gate, 0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If any reserved bits in Address are set, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than...
UINT8 EFIAPI S3PciSegmentBitFieldAndThenOr8(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData, IN UINT8 OrData)
/* If any reserved bits in Address are set, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than...
{ return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentBitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData)); }
tianocore/edk2
C++
Other
4,240
/* check to see if a page is being written to the cache */
bool __fscache_check_page_write(struct fscache_cookie *cookie, struct page *page)
/* check to see if a page is being written to the cache */ bool __fscache_check_page_write(struct fscache_cookie *cookie, struct page *page)
{ void *val; rcu_read_lock(); val = radix_tree_lookup(&cookie->stores, page->index); rcu_read_unlock(); return val != NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* 4D enable: 4D detection is enabled on INT1 pin when 6D bit on INT1_CFG(30h) is set to 1. */
int32_t lis2dh12_int1_pin_detect_4d_get(stmdev_ctx_t *ctx, uint8_t *val)
/* 4D enable: 4D detection is enabled on INT1 pin when 6D bit on INT1_CFG(30h) is set to 1. */ int32_t lis2dh12_int1_pin_detect_4d_get(stmdev_ctx_t *ctx, uint8_t *val)
{ lis2dh12_ctrl_reg5_t ctrl_reg5; int32_t ret; ret = lis2dh12_read_reg(ctx, LIS2DH12_CTRL_REG5, (uint8_t *)&ctrl_reg5, 1); *val = (uint8_t)ctrl_reg5.d4d_int1; return ret; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* NOTE: This is just an alias for sta_info_alloc(), see notes on it in the lifecycle management section! */
static struct sta_info* mesh_plink_alloc(struct ieee80211_sub_if_data *sdata, u8 *hw_addr, u32 rates)
/* NOTE: This is just an alias for sta_info_alloc(), see notes on it in the lifecycle management section! */ static struct sta_info* mesh_plink_alloc(struct ieee80211_sub_if_data *sdata, u8 *hw_addr, u32 rates)
{ struct ieee80211_local *local = sdata->local; struct sta_info *sta; if (local->num_sta >= MESH_MAX_PLINKS) return NULL; sta = sta_info_alloc(sdata, hw_addr, GFP_ATOMIC); if (!sta) return NULL; sta->flags = WLAN_STA_AUTHORIZED; sta->sta.supp_rates[local->hw.conf.channel->band] = rates; rate_control_rate_in...
EmcraftSystems/linux-emcraft
C++
Other
266
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit an...
UINT32 EFIAPI PciBitFieldAnd32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit an...
{ return PciExpressBitFieldAnd32 (Address, StartBit, EndBit, AndData); }
tianocore/edk2
C++
Other
4,240
/* Specifies the TIMx Counter Mode to be used. */
void TIM_CounterModeConfig(TIM_TypeDef *TIMx, uint16_t TIM_CounterMode)
/* Specifies the TIMx Counter Mode to be used. */ void TIM_CounterModeConfig(TIM_TypeDef *TIMx, uint16_t TIM_CounterMode)
{ uint16_t tmpcr1 = 0; assert_param(IS_TIM_LIST3_PERIPH(TIMx)); assert_param(IS_TIM_COUNTER_MODE(TIM_CounterMode)); tmpcr1 = TIMx->CR1; tmpcr1 &= (uint16_t)~(TIM_CR1_DIR | TIM_CR1_CMS); tmpcr1 |= TIM_CounterMode; TIMx->CR1 = tmpcr1; }
MaJerle/stm32f429
C++
null
2,036
/* Enables or disables the mute feature on the audio codec. */
uint32_t wm8994_SetMute(uint16_t DeviceAddr, uint32_t Cmd)
/* Enables or disables the mute feature on the audio codec. */ uint32_t wm8994_SetMute(uint16_t DeviceAddr, uint32_t Cmd)
{ uint32_t counter = 0; if (outputEnabled != 0) { if(Cmd == AUDIO_MUTE_ON) { counter += CODEC_IO_Write(DeviceAddr, 0x420, 0x0200); counter += CODEC_IO_Write(DeviceAddr, 0x422, 0x0200); } else { counter += CODEC_IO_Write(DeviceAddr, 0x420, 0x0010); counter += CODEC_IO_Wr...
eclipse-threadx/getting-started
C++
Other
310
/* Not so, for quite unobvious reasons - register pressure. In user mode vfork() cannot have a stack frame, and if done by calling the "clone()" system call directly, you do not have enough call-clobbered registers to hold all the information you need. */
asmlinkage int sys_vfork(unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7, struct pt_regs __regs)
/* Not so, for quite unobvious reasons - register pressure. In user mode vfork() cannot have a stack frame, and if done by calling the "clone()" system call directly, you do not have enough call-clobbered registers to hold all the information you need. */ asmlinkage int sys_vfork(unsigned long r4, unsigned long r5, un...
{ struct pt_regs *regs = RELOC_HIDE(&__regs, 0); return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->regs[15], regs, 0, NULL, NULL); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Change Logs: Date Author Notes Bernard first version Jesven add rt_hw_cpu_id() */
rt_weak int rt_hw_cpu_id(void)
/* Change Logs: Date Author Notes Bernard first version Jesven add rt_hw_cpu_id() */ rt_weak int rt_hw_cpu_id(void)
{ int cpu_id; __asm__ volatile ( "mrc p15, 0, %0, c0, c0, 5" :"=r"(cpu_id) ); cpu_id &= 0xf; return cpu_id; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Some USB barcode readers from cypress have usage min and usage max in the wrong order */
static void cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int rsize)
/* Some USB barcode readers from cypress have usage min and usage max in the wrong order */ static void cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int rsize)
{ unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); unsigned int i; if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX)) return; for (i = 0; i < rsize - 4; i++) if (rdesc[i] == 0x29 && rdesc[i + 2] == 0x19) { __u8 tmp; rdesc[i] = 0x19; rdesc[i + 2] = 0x29; tmp = rdesc[i + 3]; rdesc[i + 3] = rdesc...
robutest/uclinux
C++
GPL-2.0
60
/* param base LPSPI peripheral base address. param handle pointer to lpspi_slave_edma_handle_t structure which stores the transfer state. */
void LPSPI_SlaveTransferAbortEDMA(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle)
/* param base LPSPI peripheral base address. param handle pointer to lpspi_slave_edma_handle_t structure which stores the transfer state. */ void LPSPI_SlaveTransferAbortEDMA(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle)
{ assert(handle != NULL); LPSPI_DisableDMA(base, (uint32_t)kLPSPI_RxDmaEnable | (uint32_t)kLPSPI_TxDmaEnable); EDMA_AbortTransfer(handle->edmaRxRegToRxDataHandle); EDMA_AbortTransfer(handle->edmaTxDataToTxRegHandle); handle->state = (uint8_t)kLPSPI_Idle; }
eclipse-threadx/getting-started
C++
Other
310
/* writes to a specified block of 3 registers from the TCA6424A and stores it in a specified cache variable. */
static int write_port_regs(const struct device *dev, uint8_t reg, uint32_t value)
/* writes to a specified block of 3 registers from the TCA6424A and stores it in a specified cache variable. */ static int write_port_regs(const struct device *dev, uint8_t reg, uint32_t value)
{ const struct tca6424a_drv_cfg *const config = dev->config; uint8_t buf[4]; int ret; LOG_DBG("%s: Write: REG[0x%X] = 0x%X, REG[0x%X] = 0x%X, " "REG[0x%X] = 0x%X", dev->name, reg, (value & 0xFF), (reg + 1), ((value >> 8) & 0xFF), (reg + 2), ((value >> 16) & 0xFF)); buf[0] = reg; sys_put_le24(value, &buf[1])...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* work queue call back to started compression on a file and pages */
static noinline void async_cow_start(struct btrfs_work *work)
/* work queue call back to started compression on a file and pages */ static noinline void async_cow_start(struct btrfs_work *work)
{ struct async_cow *async_cow; int num_added = 0; async_cow = container_of(work, struct async_cow, work); compress_file_range(async_cow->inode, async_cow->locked_page, async_cow->start, async_cow->end, async_cow, &num_added); if (num_added == 0) async_cow->inode = NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* CLI command to get and display the optical paths mask. */
int32_t cn0503_ratmask_get(struct cn0503_dev *dev, uint8_t *arg)
/* CLI command to get and display the optical paths mask. */ int32_t cn0503_ratmask_get(struct cn0503_dev *dev, uint8_t *arg)
{ uint8_t buff[20]; sprintf((char *)buff, "%x", dev->ratmask); cli_write_string(dev->cli_handler, (uint8_t *)"RESP: RATMASK"); cli_write_string(dev->cli_handler, (uint8_t *)"?="); cli_write_string(dev->cli_handler, buff); cli_write_string(dev->cli_handler, (uint8_t *)"\n"); return SUCCESS; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* This routine sets up the initial Guest GDT for booting. All entries start as 0 (unusable). */
void setup_guest_gdt(struct lg_cpu *cpu)
/* This routine sets up the initial Guest GDT for booting. All entries start as 0 (unusable). */ void setup_guest_gdt(struct lg_cpu *cpu)
{ cpu->arch.gdt[GDT_ENTRY_KERNEL_CS] = FULL_EXEC_SEGMENT; cpu->arch.gdt[GDT_ENTRY_KERNEL_DS] = FULL_SEGMENT; cpu->arch.gdt[GDT_ENTRY_KERNEL_CS].b |= (GUEST_PL << 13); cpu->arch.gdt[GDT_ENTRY_KERNEL_DS].b |= (GUEST_PL << 13); }
robutest/uclinux
C++
GPL-2.0
60
/* Clears the pending bit of an external interrupt. */
void CORTEX_NVIC_ClearPendingIRQ(IRQn_Type IRQn)
/* Clears the pending bit of an external interrupt. */ void CORTEX_NVIC_ClearPendingIRQ(IRQn_Type IRQn)
{ assert_parameters(IS_CORTEX_NVIC_DEVICE_IRQ(IRQn)); NVIC_ClearPendingIRQ(IRQn); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Change Logs: Date Author Notes supperthomas first version supperthomas fix led */
int main(void)
/* Change Logs: Date Author Notes supperthomas first version supperthomas fix led */ int main(void)
{ int count = 1; rt_pin_mode(RT_BSP_LED_PIN, PIN_MODE_OUTPUT); while (count++) { rt_pin_write(RT_BSP_LED_PIN, PIN_HIGH); rt_thread_mdelay(500); rt_pin_write(RT_BSP_LED_PIN, PIN_LOW); rt_thread_mdelay(500); } return RT_EOK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* It enables or disables the notification of the CC Detection interrupt on ALERT pin. */
void HW_IF_STUSB1602_Interrupt_CC_Detection(uint8_t PortNum, FunctionalState status)
/* It enables or disables the notification of the CC Detection interrupt on ALERT pin. */ void HW_IF_STUSB1602_Interrupt_CC_Detection(uint8_t PortNum, FunctionalState status)
{ if (status == ENABLE) { STUSB1602_CC_Detect_Alrt_Int_Mask_Set(STUSB1602_I2C_Add(PortNum), CC_Detect_Int_UNMASKED); } else { STUSB1602_CC_Detect_Alrt_Int_Mask_Set(STUSB1602_I2C_Add(PortNum), CC_Detect_Int_MASKED); } }
st-one/X-CUBE-USB-PD
C++
null
110
/* A small number of vendors implemented early PCI ATA interfaces on bridge logic without the ATA interface being PCI visible. Where we have a matching PCI driver we must skip the relevant device here. If we don't know about it then the legacy driver is the right driver anyway. */
static void __init legacy_check_special_cases(struct pci_dev *p, int *primary, int *secondary)
/* A small number of vendors implemented early PCI ATA interfaces on bridge logic without the ATA interface being PCI visible. Where we have a matching PCI driver we must skip the relevant device here. If we don't know about it then the legacy driver is the right driver anyway. */ static void __init legacy_check_speci...
{ if (p->vendor == 0x1078 && p->device == 0x0000) { *primary = *secondary = 1; return; } if (p->vendor == 0x1078 && p->device == 0x0002) { *primary = *secondary = 1; return; } if (p->vendor == 0x8086 && p->device == 0x1234) { u16 r; pci_read_config_word(p, 0x6C, &r); if (r & 0x8000) { if (r & 0x40...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get Protected mode code segment with 16-bit default addressing from current GDT table. */
UINT16 GetProtectedMode16CS(VOID)
/* Get Protected mode code segment with 16-bit default addressing from current GDT table. */ UINT16 GetProtectedMode16CS(VOID)
{ IA32_DESCRIPTOR GdtrDesc; IA32_SEGMENT_DESCRIPTOR *GdtEntry; UINTN GdtEntryCount; UINT16 Index; Index = (UINT16)-1; AsmReadGdtr (&GdtrDesc); GdtEntryCount = (GdtrDesc.Limit + 1) / sizeof (IA32_SEGMENT_DESCRIPTOR); GdtEntry = (IA32_SEGMENT_DESCRIPTOR ...
tianocore/edk2
C++
Other
4,240
/* Delete specified RtkBuffer from a RtkQueue. It don't hold spinlock itself, so caller must hold it at someplace. */
void RtbRemoveNode(IN OUT RTB_QUEUE_HEAD *RtkQueueHead, IN RTK_BUFFER *RtkBuffer)
/* Delete specified RtkBuffer from a RtkQueue. It don't hold spinlock itself, so caller must hold it at someplace. */ void RtbRemoveNode(IN OUT RTB_QUEUE_HEAD *RtkQueueHead, IN RTK_BUFFER *RtkBuffer)
{ RtkQueueHead->QueueLen--; ListDeleteNode(&RtkBuffer->List); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Maximum heap_index that can be stored in a PST with index_bits bits */
static unsigned long prio_tree_maxindex(unsigned int bits)
/* Maximum heap_index that can be stored in a PST with index_bits bits */ static unsigned long prio_tree_maxindex(unsigned int bits)
{ return index_bits_to_maxindex[bits - 1]; }
robutest/uclinux
C++
GPL-2.0
60
/* In order to avoid memory starvation triggering more writebacks of NFS requests, we avoid using GFP_KERNEL. */
void* rpc_malloc(struct rpc_task *task, size_t size)
/* In order to avoid memory starvation triggering more writebacks of NFS requests, we avoid using GFP_KERNEL. */ void* rpc_malloc(struct rpc_task *task, size_t size)
{ struct rpc_buffer *buf; gfp_t gfp = RPC_IS_SWAPPER(task) ? GFP_ATOMIC : GFP_NOWAIT; size += sizeof(struct rpc_buffer); if (size <= RPC_BUFFER_MAXSIZE) buf = mempool_alloc(rpc_buffer_mempool, gfp); else buf = kmalloc(size, gfp); if (!buf) return NULL; buf->len = size; dprintk("RPC: %5u allocated buffer o...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get timebase clock frequency (like cpu_clk in Hz) This is the sys_logic_clk (memory bus) divided by 4 */
unsigned long get_tbclk(void)
/* Get timebase clock frequency (like cpu_clk in Hz) This is the sys_logic_clk (memory bus) divided by 4 */ unsigned long get_tbclk(void)
{ return ((get_bus_freq (0) + 2L) / 4L); }
EmcraftSystems/u-boot
C++
Other
181
/* Gets the captured data for a sample sequence. */
long ADCSequenceDataGet(unsigned long ulBase, unsigned long ulSequenceNum, unsigned long *pulBuffer)
/* Gets the captured data for a sample sequence. */ long ADCSequenceDataGet(unsigned long ulBase, unsigned long ulSequenceNum, unsigned long *pulBuffer)
{ unsigned long ulCount; ASSERT((ulBase == ADC0_BASE) || (ulBase == ADC1_BASE)); ASSERT(ulSequenceNum < 4); ulBase += ADC_SEQ + (ADC_SEQ_STEP * ulSequenceNum); ulCount = 0; while(!(HWREG(ulBase + ADC_SSFSTAT) & ADC_SSFSTAT0_EMPTY) && (ulCount < 8)) { *pulBuffer++ = HWREG(ulBase + ADC...
watterott/WebRadio
C++
null
71
/* Enable external trigger valid edge interrupt (EXTTRIGIE). @rmtoll IER EXTTRIGIE LPTIM_EnableIT_EXTTRIG. */
void LPTIM_EnableIT_EXTTRIG(LPTIM_Module *LPTIMx)
/* Enable external trigger valid edge interrupt (EXTTRIGIE). @rmtoll IER EXTTRIGIE LPTIM_EnableIT_EXTTRIG. */ void LPTIM_EnableIT_EXTTRIG(LPTIM_Module *LPTIMx)
{ SET_BIT(LPTIMx->INTEN, LPTIM_INTEN_EXTRIGIE); }
pikasTech/PikaPython
C++
MIT License
1,403
/* ADC reset. , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
void adc_deinit(void)
/* ADC reset. , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */ void adc_deinit(void)
{ rcu_periph_reset_enable(RCU_ADCRST); rcu_periph_reset_disable(RCU_ADCRST); }
liuxuming/trochili
C++
Apache License 2.0
132
/* ADC Set the Sample Time for Given Selection. */
void adc_set_selection_sample_time(uint32_t adc, uint8_t selection, uint8_t time)
/* ADC Set the Sample Time for Given Selection. */ void adc_set_selection_sample_time(uint32_t adc, uint8_t selection, uint8_t time)
{ uint32_t reg32; reg32 = ADC_SMPR1(adc); switch (selection) { case ADC_SMPR_SMPSEL_SMP1: reg32 &= ~(ADC_SMPR_SMP1_MASK << ADC_SMPR_SMP1_SHIFT); reg32 |= (time << ADC_SMPR_SMP1_SHIFT); break; case ADC_SMPR_SMPSEL_SMP2: reg32 &= ~(ADC_SMPR_SMP2_MASK << ADC_SMPR_SMP2_SHIFT); reg32 |= (time << ADC_SM...
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* This function is added in order to simulate arduino millis() function */
void __start_timer()
/* This function is added in order to simulate arduino millis() function */ void __start_timer()
{ clock_gettime(CLOCK_MONOTONIC_RAW, &start); }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI PciExpressBitFieldOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 OrData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT8 EFIAPI PciExpressBitFieldOr8(IN ...
{ ASSERT_INVALID_PCI_ADDRESS (Address); if (Address >= PcdPciExpressBaseSize ()) { return (UINT8)-1; } return MmioBitFieldOr8 ( (UINTN)GetPciExpressBaseAddress () + Address, StartBit, EndBit, OrData ); }
tianocore/edk2
C++
Other
4,240
/* We attach and possibly dirty the buffers atomically wrt __set_page_dirty_buffers() via private_lock. try_to_free_buffers is already excluded via the page lock. */
void create_empty_buffers(struct page *page, unsigned long blocksize, unsigned long b_state)
/* We attach and possibly dirty the buffers atomically wrt __set_page_dirty_buffers() via private_lock. try_to_free_buffers is already excluded via the page lock. */ void create_empty_buffers(struct page *page, unsigned long blocksize, unsigned long b_state)
{ struct buffer_head *bh, *head, *tail; head = alloc_page_buffers(page, blocksize, 1); bh = head; do { bh->b_state |= b_state; tail = bh; bh = bh->b_this_page; } while (bh); tail->b_this_page = head; spin_lock(&page->mapping->private_lock); if (PageUptodate(page) || PageDirty(page)) { bh = head; do { ...
robutest/uclinux
C++
GPL-2.0
60
/* reset camera sensor through GPIO on SMD board */
void sensor_reset(void)
/* reset camera sensor through GPIO on SMD board */ void sensor_reset(void)
{ int32_t reset_occupy = 1000, reset_delay = 1000; sensor_standby(0); gpio_set_gpio(GPIO_PORT1, 26); gpio_set_direction(GPIO_PORT1, 26, GPIO_GDIR_OUTPUT); gpio_set_level(GPIO_PORT1, 26, GPIO_LOW_LEVEL); hal_delay_us(reset_occupy); gpio_set_level(GPIO_PORT1, 26, GPIO_HIGH_LEVEL); hal_delay_us(rese...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* @handle: handle of the loaded image @systable: system table */
static int setup(const efi_handle_t handle, const struct efi_system_table *systable)
/* @handle: handle of the loaded image @systable: system table */ static int setup(const efi_handle_t handle, const struct efi_system_table *systable)
{ boottime = systable->boottime; return EFI_ST_SUCCESS; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Return Value 0 on success, non-zero error code otherwise. */
static int pmcraid_register_interrupt_handler(struct pmcraid_instance *pinstance)
/* Return Value 0 on success, non-zero error code otherwise. */ static int pmcraid_register_interrupt_handler(struct pmcraid_instance *pinstance)
{ struct pci_dev *pdev = pinstance->pdev; pinstance->hrrq_vector[0].hrrq_id = 0; pinstance->hrrq_vector[0].drv_inst = pinstance; pinstance->hrrq_vector[0].vector = 0; pinstance->num_hrrq = 1; return request_irq(pdev->irq, pmcraid_isr, IRQF_SHARED, PMCRAID_DRIVER_NAME, &pinstance->hrrq_vector[0]); }
robutest/uclinux
C++
GPL-2.0
60
/* flush the ENET transmit FIFO, and wait until the flush operation completes */
ErrStatus enet_txfifo_flush(void)
/* flush the ENET transmit FIFO, and wait until the flush operation completes */ ErrStatus enet_txfifo_flush(void)
{ uint32_t flush_state; uint32_t timeout = 0U; ErrStatus enet_state = ERROR; ENET_DMA_CTL |= ENET_DMA_CTL_FTF; do { flush_state = ENET_DMA_CTL & ENET_DMA_CTL_FTF; timeout++; } while((RESET != flush_state) && (timeout < ENET_DELAY_TO)); if(RESET == flush_state) { enet_...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base Quad Timer peripheral base address param channel Quad Timer channel number param ticks Timer period in units of ticks. */
void QTMR_SetCompareValue(TMR_Type *base, qtmr_channel_selection_t channel, uint16_t ticks)
/* param base Quad Timer peripheral base address param channel Quad Timer channel number param ticks Timer period in units of ticks. */ void QTMR_SetCompareValue(TMR_Type *base, qtmr_channel_selection_t channel, uint16_t ticks)
{ base->CHANNEL[channel].CTRL |= TMR_CTRL_LENGTH_MASK; if ((base->CHANNEL[channel].CTRL & TMR_CTRL_DIR_MASK) != 0U) { base->CHANNEL[channel].COMP2 = ticks; } else { base->CHANNEL[channel].COMP1 = ticks; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Wake up duration event. 1LSb = 1 / ODR. */
int32_t lsm6dso_xl_usr_offset_on_wkup_get(lsm6dso_ctx_t *ctx, uint8_t *val)
/* Wake up duration event. 1LSb = 1 / ODR. */ int32_t lsm6dso_xl_usr_offset_on_wkup_get(lsm6dso_ctx_t *ctx, uint8_t *val)
{ lsm6dso_wake_up_ths_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_WAKE_UP_THS, (uint8_t*)&reg, 1); *val = reg.usr_off_on_wu; return ret; }
alexander-g-dean/ESF
C++
null
41
/* Start beaconing on the specified channel, or stop beaconing. */
static ssize_t uwb_rc_beacon_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
/* Start beaconing on the specified channel, or stop beaconing. */ static ssize_t uwb_rc_beacon_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
{ struct uwb_dev *uwb_dev = to_uwb_dev(dev); struct uwb_rc *rc = uwb_dev->rc; int channel; ssize_t result = -EINVAL; result = sscanf(buf, "%d", &channel); if (result >= 1) result = uwb_radio_force_channel(rc, channel); return result < 0 ? result : size; }
robutest/uclinux
C++
GPL-2.0
60
/* See mss_uart.h for details of how to use this function. */
void MSS_UART_disable_irq(mss_uart_instance_t *this_uart, mss_uart_irq_t irq_mask)
/* See mss_uart.h for details of how to use this function. */ void MSS_UART_disable_irq(mss_uart_instance_t *this_uart, mss_uart_irq_t irq_mask)
{ ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)); if((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) { this_uart->hw_reg->IER &= ((uint8_t)(~((uint32_t)irq_mask & (uint32_t)IIRF_MASK))); this_uart->hw_reg->IEM |= (uint8_t)(~(((uint32_t)irq_mask & ~((uint32_t)I...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function multiplies the 64-bit unsigned value Multiplicand by the 64-bit unsigned value Multiplier and generates a 64-bit unsigned result. This 64- bit unsigned result is returned. */
UINT64 EFIAPI MultU64x64(IN UINT64 Multiplicand, IN UINT64 Multiplier)
/* This function multiplies the 64-bit unsigned value Multiplicand by the 64-bit unsigned value Multiplier and generates a 64-bit unsigned result. This 64- bit unsigned result is returned. */ UINT64 EFIAPI MultU64x64(IN UINT64 Multiplicand, IN UINT64 Multiplier)
{ UINT64 Result; Result = InternalMathMultU64x64 (Multiplicand, Multiplier); return Result; }
tianocore/edk2
C++
Other
4,240
/* Set the Conversion Settling value of a specific channel. */
static int fdc2x1x_set_settle_count(const struct device *dev, uint8_t chx, uint16_t settle_count)
/* Set the Conversion Settling value of a specific channel. */ static int fdc2x1x_set_settle_count(const struct device *dev, uint8_t chx, uint16_t settle_count)
{ return fdc2x1x_reg_write(dev, FDC2X1X_SETTLECOUNT_CH0 + chx, settle_count); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function handles USB On The Go FS global interrupt. */
void OTG_FS_IRQHandler(void)
/* This function handles USB On The Go FS global interrupt. */ void OTG_FS_IRQHandler(void)
{ HAL_HCD_IRQHandler(&hhcd_USB_OTG_FS); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Update inode->i_flags based on the btrfs internal flags. */
void btrfs_update_iflags(struct inode *inode)
/* Update inode->i_flags based on the btrfs internal flags. */ void btrfs_update_iflags(struct inode *inode)
{ struct btrfs_inode *ip = BTRFS_I(inode); inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); if (ip->flags & BTRFS_INODE_SYNC) inode->i_flags |= S_SYNC; if (ip->flags & BTRFS_INODE_IMMUTABLE) inode->i_flags |= S_IMMUTABLE; if (ip->flags & BTRFS_INODE_APPEND) inode->i_flags |= S_APPEND; i...
robutest/uclinux
C++
GPL-2.0
60
/* Disables the powerd down setting of GMAC. If the driver wants to bring up the GMAC from powerdown mode, even though the magic packet or the wake up frames received from the network, this function should be called. */
void synopGMAC_power_down_disable(synopGMACdevice *gmacdev)
/* Disables the powerd down setting of GMAC. If the driver wants to bring up the GMAC from powerdown mode, even though the magic packet or the wake up frames received from the network, this function should be called. */ void synopGMAC_power_down_disable(synopGMACdevice *gmacdev)
{ synopGMACClearBits(gmacdev->MacBase, GmacPmtCtrlStatus, GmacPmtPowerDown); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Fills each USART_InitStruct member with its default value. */
void USART_StructInit(USART_InitTypeDef *USART_InitStruct)
/* Fills each USART_InitStruct member with its default value. */ void USART_StructInit(USART_InitTypeDef *USART_InitStruct)
{ USART_InitStruct->USART_BaudRate = 9600; USART_InitStruct->USART_WordLength = USART_WordLength_8b; USART_InitStruct->USART_StopBits = USART_StopBits_1; USART_InitStruct->USART_Parity = USART_Parity_No ; USART_InitStruct->USART_Mode = USART_Mode_Rx | USART_Mode_Tx; USART_InitStruct->USART_Hardw...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return with the sys. layer. (Same on every screen and it is above the normal screen and the top layer) */
lv_obj_t* lv_disp_get_layer_sys(lv_disp_t *disp)
/* Return with the sys. layer. (Same on every screen and it is above the normal screen and the top layer) */ lv_obj_t* lv_disp_get_layer_sys(lv_disp_t *disp)
{ if(!disp) disp = lv_disp_get_default(); if(!disp) { LV_LOG_WARN("lv_layer_sys: no display registered to get its top layer"); return NULL; } return disp->sys_layer; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This comparator searches for the next Interface descriptor of the correct Keyboard HID Class and Protocol values. */
uint8_t DComp_NextKeyboardInterface(void *CurrentDescriptor)
/* This comparator searches for the next Interface descriptor of the correct Keyboard HID Class and Protocol values. */ uint8_t DComp_NextKeyboardInterface(void *CurrentDescriptor)
{ USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); if (Header->Type == DTYPE_Interface) { USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); if (Interface->Class == HID_CSCP_HIDClass) { return DESCRIPTOR_SEA...
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Get Most Recent Command. Get the most recent command sent to the radio. */
ADI_BLER_CMD_OPCODE adi_ble_GetCurCmd(void)
/* Get Most Recent Command. Get the most recent command sent to the radio. */ ADI_BLER_CMD_OPCODE adi_ble_GetCurCmd(void)
{ return(pBLERadio->curCmdOpCode); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Request the current MAC address of the device (the working mac address). (the function is Blocking until response received) */
NMI_API sint8 m2m_wifi_get_mac_address(uint8 *pu8MacAddr)
/* Request the current MAC address of the device (the working mac address). (the function is Blocking until response received) */ NMI_API sint8 m2m_wifi_get_mac_address(uint8 *pu8MacAddr)
{ sint8 ret = M2M_SUCCESS; ret = hif_chip_wake(); if(ret == M2M_SUCCESS) { ret = nmi_get_mac_address(pu8MacAddr); if(ret == M2M_SUCCESS) { ret = hif_chip_sleep(); } } return ret; }
remotemcu/remcu-chip-sdks
C++
null
436
/* ALSA create a PCM device: Called when initializing the board. Sets up the name and hooks up the callbacks */
static int snd_cx25821_pcm(snd_cx25821_card_t *chip, int device, char *name)
/* ALSA create a PCM device: Called when initializing the board. Sets up the name and hooks up the callbacks */ static int snd_cx25821_pcm(snd_cx25821_card_t *chip, int device, char *name)
{ struct snd_pcm *pcm; int err; err = snd_pcm_new(chip->card, name, device, 0, 1, &pcm); if (err < 0) { printk(KERN_INFO "ERROR: FAILED snd_pcm_new() in %s\n", __func__); return err; } pcm->private_data = chip; pcm->info_flags = 0; strcpy(pcm->name, name); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAP...
robutest/uclinux
C++
GPL-2.0
60
/* This routine can be used from both task and interrupt context. */
atomic_val_t rhino_atomic_and(atomic_t *target, atomic_val_t value)
/* This routine can be used from both task and interrupt context. */ atomic_val_t rhino_atomic_and(atomic_t *target, atomic_val_t value)
{ CPSR_ALLOC(); atomic_val_t old_value; RHINO_CPU_INTRPT_DISABLE(); old_value = *target; *target &= value; RHINO_CPU_INTRPT_ENABLE(); return old_value; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Set the specified data holding register value for DAC channel2. */
void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data)
/* Set the specified data holding register value for DAC channel2. */ void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data)
{ __IO uint32_t tmp = 0; assert_param(IS_DAC_ALIGN(DAC_Align)); assert_param(IS_DAC_DATA(Data)); tmp = (uint32_t)DAC_BASE; tmp += DHR12R2_Offset + DAC_Align; *(__IO uint32_t *)tmp = Data; }
ajhc/demo-cortex-m3
C++
null
38
/* Do core a soft reset of the core. Be careful with this because it resets all the internal state machines of the core. */
static void dwc_otg_core_reset(struct dwc2_core_regs *regs)
/* Do core a soft reset of the core. Be careful with this because it resets all the internal state machines of the core. */ static void dwc_otg_core_reset(struct dwc2_core_regs *regs)
{ int ret; ret = wait_for_bit_le32(&regs->grstctl, DWC2_GRSTCTL_AHBIDLE, true, 1000, false); if (ret) dev_info(dev, "%s: Timeout!\n", __func__); writel(DWC2_GRSTCTL_CSFTRST, &regs->grstctl); ret = wait_for_bit_le32(&regs->grstctl, DWC2_GRSTCTL_CSFTRST, false, 1000, false); if (ret) dev_info(dev, "%s: ...
4ms/stm32mp1-baremetal
C++
Other
137
/* Write one frame into wireshark (via the pipe). */
static void write_frame(uint8_t frame_len)
/* Write one frame into wireshark (via the pipe). */ static void write_frame(uint8_t frame_len)
{ uint8_t i; frame_len -= PACKET_FCS; write_frame_hdr(frame_len); rd_idx = (rd_idx + 1) % BUFSIZE; for (i=0; i<frame_len; i++) { data_write(&circ_buf[rd_idx], 1); rd_idx = (rd_idx + 1) % BUFSIZE; } rd_idx = (rd_idx + 1) % BUFSIZE; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* param i2cType Pointer to FLEXIO_I2C_Type structure param i2cHandle Pointer to flexio_i2c_master_transfer_t structure */
void FLEXIO_I2C_MasterTransferHandleIRQ(void *i2cType, void *i2cHandle)
/* param i2cType Pointer to FLEXIO_I2C_Type structure param i2cHandle Pointer to flexio_i2c_master_transfer_t structure */ void FLEXIO_I2C_MasterTransferHandleIRQ(void *i2cType, void *i2cHandle)
{ FLEXIO_I2C_Type *base = (FLEXIO_I2C_Type *)i2cType; flexio_i2c_master_handle_t *handle = (flexio_i2c_master_handle_t *)i2cHandle; uint32_t statusFlags; status_t result; statusFlags = FLEXIO_I2C_MasterGetStatusFlags(base); result = FLEXIO_I2C_MasterTransferRunStateMachine(base, han...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: the data element, or NULL if it is not found. */
gpointer g_datalist_get_data(GData **datalist, const gchar *key)
/* Returns: the data element, or NULL if it is not found. */ gpointer g_datalist_get_data(GData **datalist, const gchar *key)
{ gpointer res = NULL; GData *d; GDataElt *data, *data_end; g_return_val_if_fail (datalist != NULL, NULL); g_datalist_lock (datalist); d = G_DATALIST_GET_POINTER (datalist); if (d) { data = d->data; data_end = data + d->len; while (data < data_end) { if (g_strcmp0 (g_quark_to_str...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* To avoid deadlocks we always lock the quota structure with the lowerd id first. */
void xfs_dqlock2(xfs_dquot_t *d1, xfs_dquot_t *d2)
/* To avoid deadlocks we always lock the quota structure with the lowerd id first. */ void xfs_dqlock2(xfs_dquot_t *d1, xfs_dquot_t *d2)
{ if (d1 && d2) { ASSERT(d1 != d2); if (be32_to_cpu(d1->q_core.d_id) > be32_to_cpu(d2->q_core.d_id)) { mutex_lock(&d2->q_qlock); mutex_lock_nested(&d1->q_qlock, XFS_QLOCK_NESTED); } else { mutex_lock(&d1->q_qlock); mutex_lock_nested(&d2->q_qlock, XFS_QLOCK_NESTED); } } else if (d1) { mutex...
robutest/uclinux
C++
GPL-2.0
60
/* Sends one packet of data through the specified USART peripheral. This function operates synchronously, so it only returns when the data has been actually sent. */
void USART_Write(AT91S_USART *usart, unsigned short data, volatile unsigned int timeOut)
/* Sends one packet of data through the specified USART peripheral. This function operates synchronously, so it only returns when the data has been actually sent. */ void USART_Write(AT91S_USART *usart, unsigned short data, volatile unsigned int timeOut)
{ if (timeOut == 0) { while ((usart->US_CSR & AT91C_US_TXEMPTY) == 0); } else { while ((usart->US_CSR & AT91C_US_TXEMPTY) == 0) { if (timeOut == 0) { trace_LOG(trace_ERROR, "-E- USART_Write: Timed out.\n\r"); return; } timeO...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* For licensing information, see the file 'LICENCE' in this directory. */
static uint32_t xattr_datum_hashkey(int xprefix, const char *xname, const char *xvalue, int xsize)
/* For licensing information, see the file 'LICENCE' in this directory. */ static uint32_t xattr_datum_hashkey(int xprefix, const char *xname, const char *xvalue, int xsize)
{ int name_len = strlen(xname); return crc32(xprefix, xname, name_len) ^ crc32(xprefix, xvalue, xsize); }
robutest/uclinux
C++
GPL-2.0
60
/* Read & remove several bytes from the scancode buffer. This function is usually called after */
EFI_STATUS PopScancodeBufHead(IN SCAN_CODE_QUEUE *Queue, IN UINTN Count, OUT UINT8 *Buf OPTIONAL)
/* Read & remove several bytes from the scancode buffer. This function is usually called after */ EFI_STATUS PopScancodeBufHead(IN SCAN_CODE_QUEUE *Queue, IN UINTN Count, OUT UINT8 *Buf OPTIONAL)
{ UINTN Index; if (GetScancodeBufCount (Queue) < Count) { return EFI_NOT_READY; } for (Index = 0; Index < Count; Index++, Queue->Head = (Queue->Head + 1) % KEYBOARD_SCAN_CODE_MAX_COUNT) { if (Buf != NULL) { Buf[Index] = Queue->Buffer[Queue->Head]; } } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Submit a USB set HID report request for the USB device specified by UsbIo, Interface, ReportId, and ReportType, and set the report descriptor using the buffer specified by ReportLength and Report. If UsbIo is NULL, then ASSERT(). If Report is NULL, then ASSERT(). */
EFI_STATUS EFIAPI UsbSetReportRequest(IN EFI_USB_IO_PROTOCOL *UsbIo, IN UINT8 Interface, IN UINT8 ReportId, IN UINT8 ReportType, IN UINT16 ReportLen, IN UINT8 *Report)
/* Submit a USB set HID report request for the USB device specified by UsbIo, Interface, ReportId, and ReportType, and set the report descriptor using the buffer specified by ReportLength and Report. If UsbIo is NULL, then ASSERT(). If Report is NULL, then ASSERT(). */ EFI_STATUS EFIAPI UsbSetReportRequest(IN EFI_USB_I...
{ UINT32 Status; EFI_STATUS Result; EFI_USB_DEVICE_REQUEST Request; ASSERT (UsbIo != NULL); ASSERT (Report != NULL); Request.RequestType = USB_HID_CLASS_SET_REQ_TYPE; Request.Request = EFI_USB_SET_REPORT_REQUEST; Request.Value = (UINT16)((ReportType << 8) | Repor...
tianocore/edk2
C++
Other
4,240
/* Send channel dump data to the PODxt Pro. */
static void pod_dump(struct usb_line6_pod *pod, const unsigned char *data)
/* Send channel dump data to the PODxt Pro. */ static void pod_dump(struct usb_line6_pod *pod, const unsigned char *data)
{ int size = 1 + sizeof(pod->prog_data); char *sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_DUMP, size); if (!sysex) return; sysex[SYSEX_DATA_OFS] = 5; memcpy(sysex + SYSEX_DATA_OFS + 1, data, sizeof(pod->prog_data)); line6_send_sysex_message(&pod->line6, sysex, size); memcpy(&pod->prog_data, data, sizeof(pod...
robutest/uclinux
C++
GPL-2.0
60