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
/* I2C Set the 7 bit Slave Address for the Peripheral. This sets an address for Slave mode operation, in 7 bit form. */
void i2c_set_own_7bit_slave_address(uint32_t i2c, uint8_t slave)
/* I2C Set the 7 bit Slave Address for the Peripheral. This sets an address for Slave mode operation, in 7 bit form. */ void i2c_set_own_7bit_slave_address(uint32_t i2c, uint8_t slave)
{ uint16_t val = (uint16_t)(slave << 1); val |= (1 << 14); I2C_OAR1(i2c) = val; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* \classmethod dict() Get or set the pin mapper dictionary. */
STATIC mp_obj_t pin_map_dict(size_t n_args, const mp_obj_t *args)
/* \classmethod dict() Get or set the pin mapper dictionary. */ STATIC mp_obj_t pin_map_dict(size_t n_args, const mp_obj_t *args)
{ MP_STATE_PORT(pin_class_map_dict) = args[1]; return mp_const_none; } return MP_STATE_PORT(pin_class_map_dict); }
micropython/micropython
C++
Other
18,334
/* read function for 16bit buswith without endianess conversion */
static u16 au_read_word(struct mtd_info *mtd)
/* read function for 16bit buswith without endianess conversion */ static u16 au_read_word(struct mtd_info *mtd)
{ struct nand_chip *this = mtd->priv; u16 ret = readw(this->IO_ADDR_R); au_sync(); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Return whether there is a pagecache page to back given address within VMA. Caller follow_hugetlb_page() holds page_table_lock so we cannot lock_page. */
static bool hugetlbfs_pagecache_present(struct hstate *h, struct vm_area_struct *vma, unsigned long address)
/* Return whether there is a pagecache page to back given address within VMA. Caller follow_hugetlb_page() holds page_table_lock so we cannot lock_page. */ static bool hugetlbfs_pagecache_present(struct hstate *h, struct vm_area_struct *vma, unsigned long address)
{ struct address_space *mapping; pgoff_t idx; struct page *page; mapping = vma->vm_file->f_mapping; idx = vma_hugecache_offset(h, vma, address); page = find_get_page(mapping, idx); if (page) put_page(page); return page != NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Accepts an array of octets as the next portion of the message. */
EXP_FUNC void STDCALL ICACHE_FLASH_ATTR MD5_Update(MD5_CTX *ctx, const uint8_t *msg, int len)
/* Accepts an array of octets as the next portion of the message. */ EXP_FUNC void STDCALL ICACHE_FLASH_ATTR MD5_Update(MD5_CTX *ctx, const uint8_t *msg, int len)
{ uint32_t x; int i, partLen; x = (uint32_t)((ctx->count[0] >> 3) & 0x3F); if ((ctx->count[0] += ((uint32_t)len << 3)) < ((uint32_t)len << 3)) ctx->count[1]++; ctx->count[1] += ((uint32_t)len >> 29); partLen = 64 - x; if (len >= partLen) { memcpy(&ctx->buffer[x], msg, partLen); MD5Transform(ctx->state, ctx->buffer); for (i = partLen; i + 63 < len; i += 64) MD5Transform(ctx->state, &msg[i]); x = 0; } else i = 0; memcpy(&ctx->buffer[x], &msg[i], len-i); }
eerimoq/simba
C++
Other
337
/* USB host abort a pipe job. USB host pipe abort job by freeze the pipe. */
enum status_code usb_host_pipe_abort_job(struct usb_module *module_inst, uint8_t pipe_num)
/* USB host abort a pipe job. USB host pipe abort job by freeze the pipe. */ enum status_code usb_host_pipe_abort_job(struct usb_module *module_inst, uint8_t pipe_num)
{ Assert(module_inst); Assert(module_inst->hw); Assert(pipe_num < USB_PIPE_NUM); if (module_inst->hw->HOST.HostPipe[pipe_num].PCFG.bit.PTYPE == USB_HOST_PIPE_TYPE_DISABLE) { return STATUS_ERR_NOT_INITIALIZED; } module_inst->hw->HOST.HostPipe[pipe_num].PSTATUSSET.reg = USB_HOST_PSTATUSSET_PFREEZE; host_pipe_job_busy_status &= ~(1 << pipe_num); return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* update the period when the dirty threshold changes. */
static void update_completion_period(void)
/* update the period when the dirty threshold changes. */ static void update_completion_period(void)
{ int shift = calc_period_shift(); prop_change_shift(&vm_completions, shift); prop_change_shift(&vm_dirties, shift); }
robutest/uclinux
C++
GPL-2.0
60
/* Return if there is touches detected or not. Try to detect new touches and forget the old ones (reset internal global variables). */
uint8_t ft3x67_TS_DetectTouch(uint16_t DeviceAddr)
/* Return if there is touches detected or not. Try to detect new touches and forget the old ones (reset internal global variables). */ uint8_t ft3x67_TS_DetectTouch(uint16_t DeviceAddr)
{ volatile uint8_t nbTouch = 0U; nbTouch = TS_IO_Read(DeviceAddr, FT3X67_TD_STAT_REG); nbTouch &= FT3X67_TD_STAT_MASK; if(nbTouch > FT3X67_MAX_DETECTABLE_TOUCH) { nbTouch = 0U; } ft3x67_handle.currActiveTouchNb = nbTouch; ft3x67_handle.currActiveTouchIdx = 0U; return(nbTouch); }
eclipse-threadx/getting-started
C++
Other
310
/* param base XRDC2 peripheral base address. param mem Which memory region descriptor to set. param valid True to set valid, false to set invalid. */
void XRDC2_SetMemAccessValid(XRDC2_Type *base, xrdc2_mem_t mem, bool valid)
/* param base XRDC2 peripheral base address. param mem Which memory region descriptor to set. param valid True to set valid, false to set invalid. */ void XRDC2_SetMemAccessValid(XRDC2_Type *base, xrdc2_mem_t mem, bool valid)
{ uint32_t mrc = XRDC2_GET_MRC((uint32_t)mem); uint32_t mrgd = XRDC2_GET_MRGD((uint32_t)mem); uint32_t reg = base->MRCI_MRGDJ[mrc][mrgd].MRC_MRGD_W6 & ~XRDC2_EAL_MASK; if (valid) { base->MRCI_MRGDJ[mrc][mrgd].MRC_MRGD_W6 = (reg | XRDC2_MRC_MRGD_W6_VLD_MASK); } else { base->MRCI_MRGDJ[mrc][mrgd].MRC_MRGD_W6 = (reg & ~XRDC2_MRC_MRGD_W6_VLD_MASK); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Release the memory region(s) being used by 'port'. */
static void pnx8xxx_release_port(struct uart_port *port)
/* Release the memory region(s) being used by 'port'. */ static void pnx8xxx_release_port(struct uart_port *port)
{ struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; release_mem_region(sport->port.mapbase, UART_PORT_SIZE); }
robutest/uclinux
C++
GPL-2.0
60
/* This file is part of the Simba project. */
int mock_write_console_module_init(int res)
/* This file is part of the Simba project. */ int mock_write_console_module_init(int res)
{ harness_mock_write("console_module_init()", NULL, 0); harness_mock_write("console_module_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* Returns the total number of free MPU regions available in the form of a mask. A bit of 1 in the returned 16 bit value represents the corresponding region number to be available. For example, if this function returns 0xC0000, this would mean, the regions 14 and 15 are available to users. */
u16 Xil_GetMPUFreeRegMask(void)
/* Returns the total number of free MPU regions available in the form of a mask. A bit of 1 in the returned 16 bit value represents the corresponding region number to be available. For example, if this function returns 0xC0000, this would mean, the regions 14 and 15 are available to users. */ u16 Xil_GetMPUFreeRegMask(void)
{ if (MPU_REG_DISABLED == Mpu_Config[Index].RegionStatus) { FreeRegMask |= (1U << Index); } Index++; } return FreeRegMask; }
pikasTech/PikaPython
C++
MIT License
1,403
/* This function returns current integrated compression methods used by the specified TLS connection. */
EFI_STATUS EFIAPI CryptoServiceTlsGetCurrentCompressionId(IN VOID *Tls, IN OUT UINT8 *CompressionId)
/* This function returns current integrated compression methods used by the specified TLS connection. */ EFI_STATUS EFIAPI CryptoServiceTlsGetCurrentCompressionId(IN VOID *Tls, IN OUT UINT8 *CompressionId)
{ return CALL_BASECRYPTLIB (TlsGet.Services.CurrentCompressionId, TlsGetCurrentCompressionId, (Tls, CompressionId), EFI_UNSUPPORTED); }
tianocore/edk2
C++
Other
4,240
/* Finalize WRITE command. Function should be called when write command is finished. It sets memory pointer and write all received data to memory array */
static void ees_writeEnd(size_t cnt)
/* Finalize WRITE command. Function should be called when write command is finished. It sets memory pointer and write all received data to memory array */ static void ees_writeEnd(size_t cnt)
{ if (cnt > 0) { size_t n; ees_setAddr(m_rxbuff[0]); for (n=1; n<cnt; ++n) { ees_write(m_rxbuff[n]); } } }
remotemcu/remcu-chip-sdks
C++
null
436
/* re200b_motion_detect_handler which allow to know comparison result (CMP_GREATER or CMP_LESS) */
void re200b_motion_detect_handler(void)
/* re200b_motion_detect_handler which allow to know comparison result (CMP_GREATER or CMP_LESS) */ void re200b_motion_detect_handler(void)
{ uint32_t ul_status; ul_status = acc_get_interrupt_status(ACC); if ((ul_status & ACC_IER_CE) == ACC_IER_CE) { g_ul_compare_event_flag = true; if (acc_get_comparison_result(ACC)) { g_compare_result = CMP_GREATER; } else { g_compare_result = CMP_LESS; } } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Returns: signed 8 bit integer contents of @value Since: 2.32 */
gint8 g_value_get_schar(const GValue *value)
/* Returns: signed 8 bit integer contents of @value Since: 2.32 */ gint8 g_value_get_schar(const GValue *value)
{ g_return_val_if_fail (G_VALUE_HOLDS_CHAR (value), 0); return value->data[0].v_int; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Parameters: In: dwIoBase - I/O base address byContntOffset - address of EEPROM byBits - bits to turn off Out: none */
void SROMvRegBitsOff(DWORD_PTR dwIoBase, BYTE byContntOffset, BYTE byBits)
/* Parameters: In: dwIoBase - I/O base address byContntOffset - address of EEPROM byBits - bits to turn off Out: none */ void SROMvRegBitsOff(DWORD_PTR dwIoBase, BYTE byContntOffset, BYTE byBits)
{ BYTE byOrgData; byOrgData = SROMbyReadEmbedded(dwIoBase, byContntOffset); SROMbWriteEmbedded(dwIoBase, byContntOffset,(BYTE)(byOrgData & (~byBits))); }
robutest/uclinux
C++
GPL-2.0
60
/* Function for extracting the BSP event valid at startup. When a button was used to wake up the device, the button press will not generate an interrupt. This function reads which button was pressed at startup, and returns the appropriate BSP event. */
static void startup_event_extract(bsp_event_t *p_startup_event)
/* Function for extracting the BSP event valid at startup. When a button was used to wake up the device, the button press will not generate an interrupt. This function reads which button was pressed at startup, and returns the appropriate BSP event. */ static void startup_event_extract(bsp_event_t *p_startup_event)
{ if (bsp_button_is_pressed(BTN_ID_WAKEUP_BOND_DELETE)) { *p_startup_event = BSP_EVENT_CLEAR_BONDING_DATA; } else if (bsp_button_is_pressed(BTN_ID_WAKEUP)) { *p_startup_event = BSP_EVENT_WAKEUP; } else { *p_startup_event = BSP_EVENT_NOTHING; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* 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 AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI PciExpressBitFieldAnd16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData)
/* 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 AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT16 EFIAPI PciExpressBitFieldAnd16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData)
{ ASSERT_INVALID_PCI_ADDRESS (Address); if (Address >= PcdPciExpressBaseSize ()) { return (UINT16)-1; } return MmioBitFieldAnd16 ( (UINTN)GetPciExpressBaseAddress () + Address, StartBit, EndBit, AndData ); }
tianocore/edk2
C++
Other
4,240
/* The function that is called for file truncation. */
void minix_truncate(struct inode *inode)
/* The function that is called for file truncation. */ void minix_truncate(struct inode *inode)
{ if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) return; if (INODE_VERSION(inode) == MINIX_V1) V1_minix_truncate(inode); else V2_minix_truncate(inode); }
robutest/uclinux
C++
GPL-2.0
60
/* LZ4F_createDecompressionContext() : Create a decompressionContext object, which will track all decompression operations. Provides a pointer to a fully allocated and initialized LZ4F_decompressionContext object. Object can later be released using LZ4F_freeDecompressionContext(). */
LZ4F_errorCode_t LZ4F_createDecompressionContext(LZ4F_dctx **LZ4F_decompressionContextPtr, unsigned versionNumber)
/* LZ4F_createDecompressionContext() : Create a decompressionContext object, which will track all decompression operations. Provides a pointer to a fully allocated and initialized LZ4F_decompressionContext object. Object can later be released using LZ4F_freeDecompressionContext(). */ LZ4F_errorCode_t LZ4F_createDecompressionContext(LZ4F_dctx **LZ4F_decompressionContextPtr, unsigned versionNumber)
{ LZ4F_dctx* const dctx = (LZ4F_dctx*)ALLOC_AND_ZERO(sizeof(LZ4F_dctx)); if (dctx == NULL) { *LZ4F_decompressionContextPtr = NULL; return err0r(LZ4F_ERROR_allocation_failed); } dctx->version = versionNumber; *LZ4F_decompressionContextPtr = dctx; return LZ4F_OK_NoError; }
xboot/xboot
C++
MIT License
779
/* Write contents of register REGNO in task TASK. */
static int put_reg(struct task_struct *task, int regno, unsigned long data)
/* Write contents of register REGNO in task TASK. */ static int put_reg(struct task_struct *task, int regno, unsigned long data)
{ unsigned long *addr; if (regno == PT_USP) addr = &task->thread.usp; else if (regno < ARRAY_SIZE(regoff)) addr = (unsigned long *)(task->thread.esp0 + regoff[regno]); else return -1; if (regno == PT_SR || regno == PT_PC) { long stkadj = *(long *)(task->thread.esp0 + PT_REG(stkadj)); addr = (unsigned long *) ((unsigned long)addr + stkadj); if (regno == PT_SR) { *(unsigned short *)addr = data; return 0; } } *addr = data; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This API is used to get low_g mode in the registers 0x24 bit 2. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_low_g_mode(u8 *low_g_mode_u8)
/* This API is used to get low_g mode in the registers 0x24 bit 2. */ BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_low_g_mode(u8 *low_g_mode_u8)
{ u8 data_u8 = BMA2x2_INIT_VALUE; BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR; if (p_bma2x2 == BMA2x2_NULL) { return E_BMA2x2_NULL_PTR; } else { com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC (p_bma2x2->dev_addr, BMA2x2_LOW_G_INTR_MODE_REG, &data_u8, BMA2x2_GEN_READ_WRITE_LENGTH); *low_g_mode_u8 = BMA2x2_GET_BITSLICE(data_u8, BMA2x2_LOW_G_INTR_MODE); } return com_rslt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If OpCodeHandle is NULL, then ASSERT(). If any reserved bits are set in Flags, then ASSERT(). If Scope > 1, then ASSERT(). */
UINT8* EFIAPI HiiCreateSubTitleOpCode(IN VOID *OpCodeHandle, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 Flags, IN UINT8 Scope)
/* If OpCodeHandle is NULL, then ASSERT(). If any reserved bits are set in Flags, then ASSERT(). If Scope > 1, then ASSERT(). */ UINT8* EFIAPI HiiCreateSubTitleOpCode(IN VOID *OpCodeHandle, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 Flags, IN UINT8 Scope)
{ EFI_IFR_SUBTITLE OpCode; ASSERT (Scope <= 1); ASSERT ((Flags & (~(EFI_IFR_FLAGS_HORIZONTAL))) == 0); ZeroMem (&OpCode, sizeof (OpCode)); OpCode.Statement.Prompt = Prompt; OpCode.Statement.Help = Help; OpCode.Flags = Flags; return InternalHiiCreateOpCodeExtended ( OpCodeHandle, &OpCode, EFI_IFR_SUBTITLE_OP, sizeof (OpCode), 0, Scope ); }
tianocore/edk2
C++
Other
4,240
/* This function "closes" SMRAM so that it is not visible while outside of SMM. The function should return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. */
STATIC EFI_STATUS EFIAPI SmmAccess2DxeClose(IN EFI_SMM_ACCESS2_PROTOCOL *This)
/* This function "closes" SMRAM so that it is not visible while outside of SMM. The function should return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. */ STATIC EFI_STATUS EFIAPI SmmAccess2DxeClose(IN EFI_SMM_ACCESS2_PROTOCOL *This)
{ return SmramAccessClose (&This->LockState, &This->OpenState); }
tianocore/edk2
C++
Other
4,240
/* Description: returns 1 if valid, 0 on error. */
static int is_pte_valid(const gpt_entry *pte, const u64 lastlba)
/* Description: returns 1 if valid, 0 on error. */ static int is_pte_valid(const gpt_entry *pte, const u64 lastlba)
{ if ((!efi_guidcmp(pte->partition_type_guid, NULL_GUID)) || le64_to_cpu(pte->starting_lba) > lastlba || le64_to_cpu(pte->ending_lba) > lastlba) return 0; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* free_bch - free the BCH control structure @bch: BCH control structure to release */
void free_bch(struct bch_control *bch)
/* free_bch - free the BCH control structure @bch: BCH control structure to release */ void free_bch(struct bch_control *bch)
{ unsigned int i; if (bch) { kfree(bch->a_pow_tab); kfree(bch->a_log_tab); kfree(bch->mod8_tab); kfree(bch->ecc_buf); kfree(bch->ecc_buf2); kfree(bch->xi_tab); kfree(bch->syn); kfree(bch->cache); kfree(bch->elp); for (i = 0; i < ARRAY_SIZE(bch->poly_2t); i++) kfree(bch->poly_2t[i]); kfree(bch); } }
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns 0 on success or a negative error code. */
int gen_replace_estimator(struct gnet_stats_basic_packed *bstats, struct gnet_stats_rate_est *rate_est, spinlock_t *stats_lock, struct nlattr *opt)
/* Returns 0 on success or a negative error code. */ int gen_replace_estimator(struct gnet_stats_basic_packed *bstats, struct gnet_stats_rate_est *rate_est, spinlock_t *stats_lock, struct nlattr *opt)
{ gen_kill_estimator(bstats, rate_est); return gen_new_estimator(bstats, rate_est, stats_lock, opt); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Sets the states of the CTS modem control signals trigger level. The */
void UARTModemStatusSet(unsigned long ulBase, unsigned long ulCtsTirg)
/* Sets the states of the CTS modem control signals trigger level. The */ void UARTModemStatusSet(unsigned long ulBase, unsigned long ulCtsTirg)
{ xASSERT((ulBase == UART0_BASE)); xHWREG(ulBase + UART_MSR) &= ~(UART_TRIGGER_CTS_H); xHWREG(ulBase + UART_MSR) |= (ulCtsTirg); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Return the number of blocks used by the group descriptor table (primary or backup) in this group. In the future there may be a different number of descriptor blocks in each group. */
unsigned long ext4_bg_num_gdb(struct super_block *sb, ext4_group_t group)
/* Return the number of blocks used by the group descriptor table (primary or backup) in this group. In the future there may be a different number of descriptor blocks in each group. */ unsigned long ext4_bg_num_gdb(struct super_block *sb, ext4_group_t group)
{ unsigned long first_meta_bg = le32_to_cpu(EXT4_SB(sb)->s_es->s_first_meta_bg); unsigned long metagroup = group / EXT4_DESC_PER_BLOCK(sb); if (!EXT4_HAS_INCOMPAT_FEATURE(sb,EXT4_FEATURE_INCOMPAT_META_BG) || metagroup < first_meta_bg) return ext4_bg_num_gdb_nometa(sb, group); return ext4_bg_num_gdb_meta(sb,group); }
robutest/uclinux
C++
GPL-2.0
60
/* umc_match_pci_id - match a UMC driver to a UMC device's parent PCI device. @umc_drv: umc driver with match_data pointing to a zero-terminated table of pci_device_id's. @umc: umc device whose parent is to be matched. */
int umc_match_pci_id(struct umc_driver *umc_drv, struct umc_dev *umc)
/* umc_match_pci_id - match a UMC driver to a UMC device's parent PCI device. @umc_drv: umc driver with match_data pointing to a zero-terminated table of pci_device_id's. @umc: umc device whose parent is to be matched. */ int umc_match_pci_id(struct umc_driver *umc_drv, struct umc_dev *umc)
{ const struct pci_device_id *id_table = umc_drv->match_data; struct pci_dev *pci; if (umc->dev.parent->bus != &pci_bus_type) return 0; pci = to_pci_dev(umc->dev.parent); return pci_match_id(id_table, pci) != NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Note: Should always be called with the Page Lock held to prevent races if we have to add a new request. Also assumes that the caller has already called nfs_flush_incompatible() if necessary. */
static struct nfs_page* nfs_setup_write_request(struct nfs_open_context *ctx, struct page *page, unsigned int offset, unsigned int bytes)
/* Note: Should always be called with the Page Lock held to prevent races if we have to add a new request. Also assumes that the caller has already called nfs_flush_incompatible() if necessary. */ static struct nfs_page* nfs_setup_write_request(struct nfs_open_context *ctx, struct page *page, unsigned int offset, unsigned int bytes)
{ struct inode *inode = page->mapping->host; struct nfs_page *req; int error; req = nfs_try_to_update_request(inode, page, offset, bytes); if (req != NULL) goto out; req = nfs_create_request(ctx, inode, page, offset, bytes); if (IS_ERR(req)) goto out; error = nfs_inode_add_request(inode, req); if (error != 0) { nfs_release_request(req); req = ERR_PTR(error); } out: return req; }
robutest/uclinux
C++
GPL-2.0
60
/* USBD_VIDEO_GetVideoHeaderDesc This function return the Video Header descriptor. */
static void * USBD_VIDEO_GetVideoHeaderDesc(uint8_t *pConfDesc)
/* USBD_VIDEO_GetVideoHeaderDesc This function return the Video Header descriptor. */ static void * USBD_VIDEO_GetVideoHeaderDesc(uint8_t *pConfDesc)
{ USBD_ConfigDescTypeDef *desc = (USBD_ConfigDescTypeDef *)(void *)pConfDesc; USBD_DescHeaderTypeDef *pdesc = (USBD_DescHeaderTypeDef *)(void *)pConfDesc; uint8_t *pVideoDesc = NULL; uint16_t ptr; if (desc->wTotalLength > desc->bLength) { ptr = desc->bLength; while (ptr < desc->wTotalLength) { pdesc = USBD_GetNextDesc((uint8_t *)pdesc, &ptr); if ((pdesc->bDescriptorType == CS_INTERFACE) && (pdesc->bDescriptorSubType == VC_HEADER)) { pVideoDesc = (uint8_t *)pdesc; break; } } } return pVideoDesc; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* USB Host HCI (OHCI/EHCI) Root HUB Port VBUS on/off. */
int32_t USBH_HCI_PortVbusOnOff(uint8_t port, bool power)
/* USB Host HCI (OHCI/EHCI) Root HUB Port VBUS on/off. */ int32_t USBH_HCI_PortVbusOnOff(uint8_t port, bool power)
{ return ARM_DRIVER_ERROR; } return ARM_DRIVER_OK; }
labapart/polymcu
C++
null
201
/* Request io on as many buffer heads as we can currently get for a particular job. */
static int run_io_job(struct kcopyd_job *job)
/* Request io on as many buffer heads as we can currently get for a particular job. */ static int run_io_job(struct kcopyd_job *job)
{ int r; struct dm_io_request io_req = { .bi_rw = job->rw | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG), .mem.type = DM_IO_PAGE_LIST, .mem.ptr.pl = job->pages, .mem.offset = job->offset, .notify.fn = complete_io, .notify.context = job, .client = job->kc->io_client, }; if (job->rw == READ) r = dm_io(&io_req, 1, &job->source, NULL); else r = dm_io(&io_req, job->num_dests, job->dests, NULL); return r; }
robutest/uclinux
C++
GPL-2.0
60
/* Return the local port used by the UDP connexion */
int udp_get_local_port(URLContext *h)
/* Return the local port used by the UDP connexion */ int udp_get_local_port(URLContext *h)
{ UDPContext *s = h->priv_data; return s->local_port; }
DC-SWAT/DreamShell
C++
null
404
/* Set the device and all the used Endpoints addresses. */
void USB_SetDeviceAddress(uint8_t Val)
/* Set the device and all the used Endpoints addresses. */ void USB_SetDeviceAddress(uint8_t Val)
{ uint32_t i; uint32_t nEP = Device_Table.TotalEndpoint; for (i = 0; i < nEP; i++) { _SetEPAddress((uint8_t)i, (uint8_t)i); } _SetDADDR(Val | ADDR_EFUC); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Drop a superblock's refcount. Returns non-zero if the superblock was destroyed. The caller must hold sb_lock. */
static int __put_super(struct super_block *sb)
/* Drop a superblock's refcount. Returns non-zero if the superblock was destroyed. The caller must hold sb_lock. */ static int __put_super(struct super_block *sb)
{ int ret = 0; if (!--sb->s_count) { destroy_super(sb); ret = 1; } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Send data through an IPC channel with no reply. */
rt_err_t rt_raw_channel_send(rt_channel_t ch, rt_channel_msg_t data)
/* Send data through an IPC channel with no reply. */ rt_err_t rt_raw_channel_send(rt_channel_t ch, rt_channel_msg_t data)
{ return _send_recv_timeout(ch, data, 0, 0, RT_WAITING_FOREVER); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* STUSB1602 checks the SINK DISCONNECT MODE (bit5 0x18 */
SNK_Disconnect_Mode_TypeDef STUSB1602_SNK_Disconnect_Mode_Status_Get(uint8_t Addr)
/* STUSB1602 checks the SINK DISCONNECT MODE (bit5 0x18 */ SNK_Disconnect_Mode_TypeDef STUSB1602_SNK_Disconnect_Mode_Status_Get(uint8_t Addr)
{ STUSB1602_CC_CAPABILITY_CTRL_RegTypeDef reg; STUSB1602_ReadReg(&reg.d8, Addr, STUSB1602_CC_CAPABILITY_CTRL_REG, 1); return (SNK_Disconnect_Mode_TypeDef)(reg.b.SNK_DISCONNECT_MODE); }
st-one/X-CUBE-USB-PD
C++
null
110
/* Return with area of an area (x * y) */
uint32_t lv_area_get_size(const lv_area_t *area_p)
/* Return with area of an area (x * y) */ uint32_t lv_area_get_size(const lv_area_t *area_p)
{ uint32_t size; size = (uint32_t)(area_p->x2 - area_p->x1 + 1) * (area_p->y2 - area_p->y1 + 1); return size; }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Compare two conversation keys, except for the port 2 value. We don't check both directions of the conversation - the routine doing the hash lookup has to do two searches, as the hash key will be different for the two directions. */
static gint conversation_match_no_port2(gconstpointer v, gconstpointer w)
/* Compare two conversation keys, except for the port 2 value. We don't check both directions of the conversation - the routine doing the hash lookup has to do two searches, as the hash key will be different for the two directions. */ static gint conversation_match_no_port2(gconstpointer v, gconstpointer w)
{ const conversation_key *v1 = (const conversation_key *)v; const conversation_key *v2 = (const conversation_key *)w; if (v1->ptype != v2->ptype) return 0; if (v1->port1 == v2->port1 && addresses_equal(&v1->addr1, &v2->addr1) && addresses_equal(&v1->addr2, &v2->addr2)) { return 1; } return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Dumps the current instance of #CRRgb to a file. */
void cr_rgb_dump(CRRgb *a_this, FILE *a_fp)
/* Dumps the current instance of #CRRgb to a file. */ void cr_rgb_dump(CRRgb *a_this, FILE *a_fp)
{ guchar *str = NULL; g_return_if_fail (a_this); str = cr_rgb_to_string (a_this); if (str) { fprintf (a_fp, "%s", str); g_free (str); str = NULL; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The VIA pirq rules are nibble-based, like ALI, but without the ugly irq number munging. However, PIRQD is in the upper instead of lower 4 bits. */
static int pirq_via_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
/* The VIA pirq rules are nibble-based, like ALI, but without the ugly irq number munging. However, PIRQD is in the upper instead of lower 4 bits. */ static int pirq_via_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
{ return read_config_nybble(router, 0x55, pirq == 4 ? 5 : pirq); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function will create a ring fifo for ulog. */
int uring_fifo_init()
/* This function will create a ring fifo for ulog. */ int uring_fifo_init()
{ int rc = -1; if (ulog_buffer == NULL) { ulog_buffer = aos_malloc(DEFAULT_ASYNC_BUF_SIZE); if (ulog_buffer != NULL) { rc = aos_queue_new(&ulog_queue, ulog_buffer, DEFAULT_ASYNC_BUF_SIZE, ULOG_SIZE); if (0 != rc) { aos_free(ulog_buffer); ulog_buffer = NULL; } } } return rc; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Creates hid/cid(s) string needed for modalias and uevent e.g. on a device with hid:IBM0001 and cid:ACPI0001 you get: char *modalias: "acpi:IBM0001:ACPI0001" */
static int create_modalias(struct acpi_device *acpi_dev, char *modalias, int size)
/* Creates hid/cid(s) string needed for modalias and uevent e.g. on a device with hid:IBM0001 and cid:ACPI0001 you get: char *modalias: "acpi:IBM0001:ACPI0001" */ static int create_modalias(struct acpi_device *acpi_dev, char *modalias, int size)
{ int len; int count; struct acpi_hardware_id *id; len = snprintf(modalias, size, "acpi:"); size -= len; list_for_each_entry(id, &acpi_dev->pnp.ids, list) { count = snprintf(&modalias[len], size, "%s:", id->id); if (count < 0 || count >= size) return -EINVAL; len += count; size -= count; } modalias[len] = '\0'; return len; }
robutest/uclinux
C++
GPL-2.0
60
/* ZigBee ZCL Temperature Measurement cluster dissector for wireshark. */
static int dissect_zbee_zcl_temp_meas(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_)
/* ZigBee ZCL Temperature Measurement cluster dissector for wireshark. */ static int dissect_zbee_zcl_temp_meas(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_)
{ return tvb_captured_length(tvb); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* param base LPSPI peripheral address. param handle pointer to lpspi_slave_handle_t structure which stores the transfer state. */
void LPSPI_SlaveTransferAbort(LPSPI_Type *base, lpspi_slave_handle_t *handle)
/* param base LPSPI peripheral address. param handle pointer to lpspi_slave_handle_t structure which stores the transfer state. */ void LPSPI_SlaveTransferAbort(LPSPI_Type *base, lpspi_slave_handle_t *handle)
{ assert(handle != NULL); LPSPI_DisableInterrupts(base, (uint32_t)kLPSPI_TxInterruptEnable | (uint32_t)kLPSPI_RxInterruptEnable); LPSPI_Reset(base); handle->state = (uint8_t)kLPSPI_Idle; handle->txRemainingByteCount = 0U; handle->rxRemainingByteCount = 0U; }
eclipse-threadx/getting-started
C++
Other
310
/* We figure this out by seeing if we have two or more keys in the same column, as well as two or more keys in the same row. */
static int has_ghosting(struct key_matrix *config, struct key_matrix_key *keys, int valid)
/* We figure this out by seeing if we have two or more keys in the same column, as well as two or more keys in the same row. */ static int has_ghosting(struct key_matrix *config, struct key_matrix_key *keys, int valid)
{ int key_in_same_col = 0, key_in_same_row = 0; int i, j; if (!config->ghost_filter || valid < 3) return 0; for (i = 0; i < valid; i++) { for (j = i + 1; j < valid; j++) { if (keys[j].col == keys[i].col) key_in_same_col = 1; if (keys[j].row == keys[i].row) key_in_same_row = 1; } } if (key_in_same_col && key_in_same_row) return 1; else return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Calculate the current priority, i.e. the priority taken into account by the scheduler. This value might be boosted by RT tasks, or might be boosted by interactivity modifiers. Will be RT if the task got RT-boosted. If not then it returns p->normal_prio. */
static int effective_prio(struct task_struct *p)
/* Calculate the current priority, i.e. the priority taken into account by the scheduler. This value might be boosted by RT tasks, or might be boosted by interactivity modifiers. Will be RT if the task got RT-boosted. If not then it returns p->normal_prio. */ static int effective_prio(struct task_struct *p)
{ p->normal_prio = normal_prio(p); if (!rt_prio(p->prio)) return p->normal_prio; return p->prio; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If ModuleName is NULL, then ASSERT(). If there is no additional space for HOB creation, then ASSERT(). */
VOID EFIAPI BuildModuleHob(IN CONST EFI_GUID *ModuleName, IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule, IN UINT64 ModuleLength, IN EFI_PHYSICAL_ADDRESS EntryPoint)
/* If ModuleName is NULL, then ASSERT(). If there is no additional space for HOB creation, then ASSERT(). */ VOID EFIAPI BuildModuleHob(IN CONST EFI_GUID *ModuleName, IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule, IN UINT64 ModuleLength, IN EFI_PHYSICAL_ADDRESS EntryPoint)
{ EFI_HOB_MEMORY_ALLOCATION_MODULE *Hob; ASSERT ( ((MemoryAllocationModule & (EFI_PAGE_SIZE - 1)) == 0) && ((ModuleLength & (EFI_PAGE_SIZE - 1)) == 0) ); Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16)sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE)); if (Hob == NULL) { return; } CopyGuid (&(Hob->MemoryAllocationHeader.Name), &gEfiHobMemoryAllocModuleGuid); Hob->MemoryAllocationHeader.MemoryBaseAddress = MemoryAllocationModule; Hob->MemoryAllocationHeader.MemoryLength = ModuleLength; Hob->MemoryAllocationHeader.MemoryType = EfiBootServicesCode; ZeroMem (Hob->MemoryAllocationHeader.Reserved, sizeof (Hob->MemoryAllocationHeader.Reserved)); CopyGuid (&Hob->ModuleName, ModuleName); Hob->EntryPoint = EntryPoint; }
tianocore/edk2
C++
Other
4,240
/* If P7Data, TrustedCert or InData is NULL, then return FALSE. If P7Length, CertLength or DataLength overflow, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI Pkcs7Verify(IN CONST UINT8 *P7Data, IN UINTN P7Length, IN CONST UINT8 *TrustedCert, IN UINTN CertLength, IN CONST UINT8 *InData, IN UINTN DataLength)
/* If P7Data, TrustedCert or InData is NULL, then return FALSE. If P7Length, CertLength or DataLength overflow, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI Pkcs7Verify(IN CONST UINT8 *P7Data, IN UINTN P7Length, IN CONST UINT8 *TrustedCert, IN UINTN CertLength, IN CONST UINT8 *InData, IN UINTN DataLength)
{ CALL_CRYPTO_SERVICE (Pkcs7Verify, (P7Data, P7Length, TrustedCert, CertLength, InData, DataLength), FALSE); }
tianocore/edk2
C++
Other
4,240
/* allow the slow work item processor to get a ref on an object */
static int fscache_object_slow_work_get_ref(struct slow_work *)
/* allow the slow work item processor to get a ref on an object */ static int fscache_object_slow_work_get_ref(struct slow_work *)
{ struct fscache_object *object = container_of(work, struct fscache_object, work); int ret; fscache_stat(&fscache_n_cop_grab_object); ret = object->cache->ops->grab_object(object) ? 0 : -EAGAIN; fscache_stat_d(&fscache_n_cop_grab_object); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is used to create a IOV VF resource node. */
PCI_RESOURCE_NODE* CreateVfResourceNode(IN PCI_IO_DEVICE *PciDev, IN UINT64 Length, IN UINT64 Alignment, IN UINT8 Bar, IN PCI_BAR_TYPE ResType, IN PCI_RESOURCE_USAGE ResUsage)
/* This function is used to create a IOV VF resource node. */ PCI_RESOURCE_NODE* CreateVfResourceNode(IN PCI_IO_DEVICE *PciDev, IN UINT64 Length, IN UINT64 Alignment, IN UINT8 Bar, IN PCI_BAR_TYPE ResType, IN PCI_RESOURCE_USAGE ResUsage)
{ PCI_RESOURCE_NODE *Node; Node = CreateResourceNode (PciDev, Length, Alignment, Bar, ResType, ResUsage); if (Node == NULL) { return Node; } Node->Virtual = TRUE; return Node; }
tianocore/edk2
C++
Other
4,240
/* Write the proper values into the I/O ports following a reset */
static void setup_ports(int card)
/* Write the proper values into the I/O ports following a reset */ static void setup_ports(int card)
{ outb((sc_adapter[card]->rambase >> 12), sc_adapter[card]->ioport[EXP_BASE]); outb((sc_adapter[card]->interrupt | 0x80), sc_adapter[card]->ioport[IRQ_SELECT]); }
robutest/uclinux
C++
GPL-2.0
60
/* Checks if VBUS is at a particular level. */
static bool adc_vbus_check_level(const struct device *dev, enum tc_vbus_level level)
/* Checks if VBUS is at a particular level. */ static bool adc_vbus_check_level(const struct device *dev, enum tc_vbus_level level)
{ int meas; int ret; ret = adc_vbus_measure(dev, &meas); if (ret) { return false; } switch (level) { case TC_VBUS_SAFE0V: return (meas < PD_V_SAFE_0V_MAX_MV); case TC_VBUS_PRESENT: return (meas >= PD_V_SAFE_5V_MIN_MV); case TC_VBUS_REMOVED: return (meas < TC_V_SINK_DISCONNECT_MAX_MV); } return false; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* returns 1 when diag buffer support is enabled in firmware */
static u8 _ctl_diag_capability(struct MPT2SAS_ADAPTER *ioc, u8 buffer_type)
/* returns 1 when diag buffer support is enabled in firmware */ static u8 _ctl_diag_capability(struct MPT2SAS_ADAPTER *ioc, u8 buffer_type)
{ u8 rc = 0; switch (buffer_type) { case MPI2_DIAG_BUF_TYPE_TRACE: if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_DIAG_TRACE_BUFFER) rc = 1; break; case MPI2_DIAG_BUF_TYPE_SNAPSHOT: if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_SNAPSHOT_BUFFER) rc = 1; break; case MPI2_DIAG_BUF_TYPE_EXTENDED: if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_EXTENDED_BUFFER) rc = 1; } return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* whether or not to response to a general call */
void i2c_slave_response_to_gcall_config(uint32_t i2c_periph, uint32_t gcallpara)
/* whether or not to response to a general call */ void i2c_slave_response_to_gcall_config(uint32_t i2c_periph, uint32_t gcallpara)
{ uint32_t ctl = 0U; ctl = I2C_CTL0(i2c_periph); ctl &= ~(I2C_CTL0_GCEN); ctl |= gcallpara; I2C_CTL0(i2c_periph) = ctl; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Walk a ucs2le string and return the number of bytes that the string will be after being converted to the given charset, not including any null termination required. Don't walk past maxbytes in the source buffer. */
int cifs_ucs2_bytes(const __le16 *from, int maxbytes, const struct nls_table *codepage)
/* Walk a ucs2le string and return the number of bytes that the string will be after being converted to the given charset, not including any null termination required. Don't walk past maxbytes in the source buffer. */ int cifs_ucs2_bytes(const __le16 *from, int maxbytes, const struct nls_table *codepage)
{ int i; int charlen, outlen = 0; int maxwords = maxbytes / 2; char tmp[NLS_MAX_CHARSET_SIZE]; for (i = 0; i < maxwords && from[i]; i++) { charlen = codepage->uni2char(le16_to_cpu(from[i]), tmp, NLS_MAX_CHARSET_SIZE); if (charlen > 0) outlen += charlen; else outlen++; } return outlen; }
robutest/uclinux
C++
GPL-2.0
60
/* Parse whether channels are to be excluded from Dynamic Range Compression; reference: table 4.53. */
static int decode_drc_channel_exclusions(DynamicRangeControl *che_drc, GetBitContext *gb)
/* Parse whether channels are to be excluded from Dynamic Range Compression; reference: table 4.53. */ static int decode_drc_channel_exclusions(DynamicRangeControl *che_drc, GetBitContext *gb)
{ int i; int num_excl_chan = 0; do { for (i = 0; i < 7; i++) che_drc->exclude_mask[num_excl_chan++] = get_bits1(gb); } while (num_excl_chan < MAX_CHANNELS - 7 && get_bits1(gb)); return num_excl_chan / 7; }
DC-SWAT/DreamShell
C++
null
404
/* Link up indication handler. The function is invoked by HW when Titan indicates that the link is up for programmable amount of time. */
enum vxge_hw_status __vxge_hw_device_handle_link_up_ind(struct __vxge_hw_device *hldev)
/* Link up indication handler. The function is invoked by HW when Titan indicates that the link is up for programmable amount of time. */ enum vxge_hw_status __vxge_hw_device_handle_link_up_ind(struct __vxge_hw_device *hldev)
{ if (hldev->link_state == VXGE_HW_LINK_UP) goto exit; hldev->link_state = VXGE_HW_LINK_UP; if (hldev->uld_callbacks.link_up) hldev->uld_callbacks.link_up(hldev); exit: return VXGE_HW_OK; }
robutest/uclinux
C++
GPL-2.0
60
/* Writes a formatted string into a #GString. This is similar to the standard sprintf() function, except that the #GString buffer automatically expands to contain the results. The previous contents of the #GString are destroyed. */
void g_string_printf(GString *string, const gchar *format,...)
/* Writes a formatted string into a #GString. This is similar to the standard sprintf() function, except that the #GString buffer automatically expands to contain the results. The previous contents of the #GString are destroyed. */ void g_string_printf(GString *string, const gchar *format,...)
{ va_list args; g_string_truncate (string, 0); va_start (args, format); g_string_append_vprintf (string, format, args); va_end (args); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* reset the ENET initpara struct, call it before using */
void enet_initpara_reset(void)
/* reset the ENET initpara struct, call it before using */ void enet_initpara_reset(void)
{ enet_initpara.option_enable = 0U; enet_initpara.forward_frame = 0U; enet_initpara.dmabus_mode = 0U; enet_initpara.dma_maxburst = 0U; enet_initpara.dma_arbitration = 0U; enet_initpara.store_forward_mode = 0U; enet_initpara.dma_function = 0U; enet_initpara.vlan_config = 0U; enet_initpara.flow_control = 0U; enet_initpara.hashtable_high = 0U; enet_initpara.hashtable_low = 0U; enet_initpara.framesfilter_mode = 0U; enet_initpara.halfduplex_param = 0U; enet_initpara.timer_config = 0U; enet_initpara.interframegap = 0U; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void)
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */ int main(void)
{ SetupHardware(); puts_P(PSTR(ESC_FG_CYAN "Android Accessory Host Demo running.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { AOAHost_Task(); AOA_Host_USBTask(&AndroidDevice_AOA_Interface); USB_USBTask(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Read gyroscope integrated temperature sensor data. This function reads IMU-3000 integrated temperature sensor data. The temperature is always returned in scaled engineering units (degrees Celsius). */
static bool imu3000_get_temperature(sensor_hal_t *hal, sensor_data_t *data)
/* Read gyroscope integrated temperature sensor data. This function reads IMU-3000 integrated temperature sensor data. The temperature is always returned in scaled engineering units (degrees Celsius). */ static bool imu3000_get_temperature(sensor_hal_t *hal, sensor_data_t *data)
{ int16_t temp_data; size_t const count = sensor_bus_read(hal, IMU3000_TEMP_OUT_H, &temp_data, sizeof(temp_data)); data->temperature.value = (int16_t)be16_to_cpu(temp_data); if (data->scaled) { data->temperature.value -= TEMP_OFFSET; data->temperature.value /= TEMP_COUNTS_PER_DEG_C; data->temperature.value += TEMP_REF_DEG; } return (count == sizeof(temp_data)); }
memfault/zero-to-main
C++
null
200
/* This function expects an IP packet with a prepended Ethernet header in the uip_buf buffer, and the length of the packet in the global variable uip_len. */
void uip_arp_ipin(void)
/* This function expects an IP packet with a prepended Ethernet header in the uip_buf buffer, and the length of the packet in the global variable uip_len. */ void uip_arp_ipin(void)
{ uip_len -= sizeof( struct uip_eth_hdr ); if( (IPBUF->srcipaddr[0] & uip_netmask[0]) != (uip_hostaddr[0] & uip_netmask[0]) ) { return; } if( (IPBUF->srcipaddr[1] & uip_netmask[1]) != (uip_hostaddr[1] & uip_netmask[1]) ) { return; } uip_arp_update( IPBUF->srcipaddr, &(IPBUF->ethhdr.src) ); return; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Set SMBus Bytes Counts of Transmission or Reception. */
void I2C_SMBusSetPacketByteCount(I2C_T *i2c, uint32_t u32PktSize)
/* Set SMBus Bytes Counts of Transmission or Reception. */ void I2C_SMBusSetPacketByteCount(I2C_T *i2c, uint32_t u32PktSize)
{ i2c->PKTSIZE = u32PktSize; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return value: 0 if reset not allowed / non-zero if reset is allowed */
static int ipr_reset_allowed(struct ipr_ioa_cfg *ioa_cfg)
/* Return value: 0 if reset not allowed / non-zero if reset is allowed */ static int ipr_reset_allowed(struct ipr_ioa_cfg *ioa_cfg)
{ volatile u32 temp_reg; temp_reg = readl(ioa_cfg->regs.sense_interrupt_reg); return ((temp_reg & IPR_PCII_CRITICAL_OPERATION) == 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Context: IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise. */
void sg_miter_stop(struct sg_mapping_iter *miter)
/* Context: IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise. */ void sg_miter_stop(struct sg_mapping_iter *miter)
{ WARN_ON(miter->consumed > miter->length); if (miter->addr) { miter->__offset += miter->consumed; if (miter->__flags & SG_MITER_TO_SG) flush_kernel_dcache_page(miter->page); if (miter->__flags & SG_MITER_ATOMIC) { WARN_ON(!irqs_disabled()); kunmap_atomic(miter->addr, KM_BIO_SRC_IRQ); } else kunmap(miter->page); miter->page = NULL; miter->addr = NULL; miter->length = 0; miter->consumed = 0; } }
robutest/uclinux
C++
GPL-2.0
60
/* Perform the necessary post write multi sector transfer fixup, not checking for any errors, because we assume we have just used pre_write_mst_fixup(), thus the data will be fine or we would never have gotten here. */
void post_write_mst_fixup(NTFS_RECORD *b)
/* Perform the necessary post write multi sector transfer fixup, not checking for any errors, because we assume we have just used pre_write_mst_fixup(), thus the data will be fine or we would never have gotten here. */ void post_write_mst_fixup(NTFS_RECORD *b)
{ le16 *usa_pos, *data_pos; u16 usa_ofs = le16_to_cpu(b->usa_ofs); u16 usa_count = le16_to_cpu(b->usa_count) - 1; usa_pos = (le16*)b + usa_ofs/sizeof(le16); data_pos = (le16*)b + NTFS_BLOCK_SIZE/sizeof(le16) - 1; while (usa_count--) { *data_pos = *(++usa_pos); data_pos += NTFS_BLOCK_SIZE/sizeof(le16); } }
robutest/uclinux
C++
GPL-2.0
60
/* This prepares the SW controllable LED for use. */
static s32 e1000_setup_led_pchlan(struct e1000_hw *hw)
/* This prepares the SW controllable LED for use. */ static s32 e1000_setup_led_pchlan(struct e1000_hw *hw)
{ return hw->phy.ops.write_reg(hw, HV_LED_CONFIG, (u16)hw->mac.ledctl_mode1); }
robutest/uclinux
C++
GPL-2.0
60
/* Don't. But if you did, this is what happens. */
static int lguest_panic(struct notifier_block *nb, unsigned long l, void *p)
/* Don't. But if you did, this is what happens. */ static int lguest_panic(struct notifier_block *nb, unsigned long l, void *p)
{ kvm_hypercall2(LHCALL_SHUTDOWN, __pa(p), LGUEST_SHUTDOWN_POWEROFF); return NOTIFY_DONE; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This API reads acceleration data X values from location 02h and 03h bit resolution support 8bit. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_read_accel_eight_resolution_x(s8 *accel_x_s8)
/* This API reads acceleration data X values from location 02h and 03h bit resolution support 8bit. */ BMA2x2_RETURN_FUNCTION_TYPE bma2x2_read_accel_eight_resolution_x(s8 *accel_x_s8)
{ BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR; u8 data = BMA2x2_INIT_VALUE; if (p_bma2x2 == BMA2x2_NULL) { return E_BMA2x2_NULL_PTR; } else { com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC (p_bma2x2->dev_addr, BMA2x2_X_AXIS_MSB_ADDR, &data, BMA2x2_GEN_READ_WRITE_LENGTH); *accel_x_s8 = BMA2x2_GET_BITSLICE(data, BMA2x2_ACCEL_X_MSB); } return com_rslt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Atomic bitwise AND primitive. is atomically bitwise AND'ed with the value at <target>, placing the result at <target>, and the previous value at <target> is returned. */
atomic_val_t atomic_and(atomic_t *target, atomic_val_t value)
/* Atomic bitwise AND primitive. is atomically bitwise AND'ed with the value at <target>, placing the result at <target>, and the previous value at <target> is returned. */ atomic_val_t atomic_and(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
/* This function does the following to cleanup driver FCoE function resources: */
int lpfc_sli4_hba_down(struct lpfc_hba *phba)
/* This function does the following to cleanup driver FCoE function resources: */ int lpfc_sli4_hba_down(struct lpfc_hba *phba)
{ lpfc_stop_port(phba); lpfc_sli4_queue_unset(phba); lpfc_sli4_fcfi_unreg(phba, phba->fcf.fcfi); return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Called by the Protocol Layer to informs the Policy Engine that a message has been received. */
void pe_message_received(const struct device *dev)
/* Called by the Protocol Layer to informs the Policy Engine that a message has been received. */ void pe_message_received(const struct device *dev)
{ struct usbc_port_data *data = dev->data; struct policy_engine *pe = data->pe; atomic_set_bit(pe->flags, PE_FLAGS_MSG_RECEIVED); usbc_bypass_next_sleep(dev); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* pkcs7_free_message - Free a PKCS#7 message @pkcs7: The PKCS#7 message to free */
void pkcs7_free_message(struct pkcs7_message *pkcs7)
/* pkcs7_free_message - Free a PKCS#7 message @pkcs7: The PKCS#7 message to free */ void pkcs7_free_message(struct pkcs7_message *pkcs7)
{ struct x509_certificate *cert; struct pkcs7_signed_info *sinfo; if (pkcs7) { while (pkcs7->certs) { cert = pkcs7->certs; pkcs7->certs = cert->next; x509_free_certificate(cert); } while (pkcs7->crl) { cert = pkcs7->crl; pkcs7->crl = cert->next; x509_free_certificate(cert); } while (pkcs7->signed_infos) { sinfo = pkcs7->signed_infos; pkcs7->signed_infos = sinfo->next; pkcs7_free_signed_info(sinfo); } kfree(pkcs7); } }
4ms/stm32mp1-baremetal
C++
Other
137
/* Check if stall has been sent from the endpoint. */
static bool _usbd_ep_is_stall_sent(uint8_t epn, uint8_t bank_n)
/* Check if stall has been sent from the endpoint. */ static bool _usbd_ep_is_stall_sent(uint8_t epn, uint8_t bank_n)
{ Usb *hw = USB; return (hri_usbendpoint_read_EPINTFLAG_reg(hw, epn) & (USB_DEVICE_EPINTFLAG_STALL0 << bank_n)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Updates the fusion calculation with a new gyro data. */
void IMU_fuseGyroUpdate(IMU_SensorFusion *f, float gvec[3])
/* Updates the fusion calculation with a new gyro data. */ void IMU_fuseGyroUpdate(IMU_SensorFusion *f, float gvec[3])
{ float dgvec[3]; float rgvec[3]; IMU_vectorScalarMultiplication( dgvec, gvec, f->gDeltaTimeScale ); IMU_vectorAdd( rgvec, dgvec, f->angleCorrection ); IMU_dcmRotate ( f->dcm, rgvec ); IMU_dcmNormalize( f->dcm ); IMU_dcmGetAngles( f->dcm, f->orientation ); return; }
remotemcu/remcu-chip-sdks
C++
null
436
/* DFSDM_Channel MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_DFSDM_ChannelMspDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
/* DFSDM_Channel MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_DFSDM_ChannelMspDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
{ DFSDM1_Init-- ; if(DFSDM1_Init == 0) { __HAL_RCC_DFSDM1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOC, DATIN3_Pin|DF_CKOUT_Pin); HAL_GPIO_DeInit(DFDATIN1_GPIO_Port, DFDATIN1_Pin); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Writes a value to an extended PHY register. */
void EMACPHYExtendedWrite(uint32_t ui32Base, uint8_t ui8PhyAddr, uint16_t ui16RegAddr, uint16_t ui16Value)
/* Writes a value to an extended PHY register. */ void EMACPHYExtendedWrite(uint32_t ui32Base, uint8_t ui8PhyAddr, uint16_t ui16RegAddr, uint16_t ui16Value)
{ ASSERT(ui8PhyAddr < 32); ASSERT(ui32Base == EMAC0_BASE); EMACPHYWrite(EMAC0_BASE, ui8PhyAddr, EPHY_REGCTL, 0x001F); EMACPHYWrite(EMAC0_BASE, ui8PhyAddr, EPHY_ADDAR, ui16RegAddr); EMACPHYWrite(EMAC0_BASE, ui8PhyAddr, EPHY_REGCTL, 0x401F); EMACPHYWrite(EMAC0_BASE, ui8PhyAddr, EPHY_ADDAR, ui16Value); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Checks whether the specified FLASH flag is set or not. */
FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG)
/* Checks whether the specified FLASH flag is set or not. */ FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG)
{ FlagStatus bitstatus = RESET; assert_param(IS_FLASH_GET_FLAG(FLASH_FLAG)); if((FLASH->SR & FLASH_FLAG) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
ajhc/demo-cortex-m3
C++
null
38
/* Free the memory block from the memory pool. */
VOID EmmcPeimFreeMemBlock(IN EMMC_PEIM_MEM_POOL *Pool, IN EMMC_PEIM_MEM_BLOCK *Block)
/* Free the memory block from the memory pool. */ VOID EmmcPeimFreeMemBlock(IN EMMC_PEIM_MEM_POOL *Pool, IN EMMC_PEIM_MEM_BLOCK *Block)
{ ASSERT ((Pool != NULL) && (Block != NULL)); IoMmuFreeBuffer (EFI_SIZE_TO_PAGES (Block->BufLen), Block->BufHost, Block->Mapping); }
tianocore/edk2
C++
Other
4,240
/* The tasks as described in the comments at the top of this file. */
static void prvQueueReceiveTask(void *pvParameters)
/* The tasks as described in the comments at the top of this file. */ static void prvQueueReceiveTask(void *pvParameters)
{ unsigned long ulReceivedValue; for( ;; ) { xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); if( ulReceivedValue == 100UL ) { STM32vldiscovery_LEDToggle( LED3 ); } } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Draws a horizontral line from (x1,y) to (x2,y) of GrayScale level. */
void halLcdHLine(int x1, int x2, int y, unsigned char GrayScale)
/* Draws a horizontral line from (x1,y) to (x2,y) of GrayScale level. */ void halLcdHLine(int x1, int x2, int y, unsigned char GrayScale)
{ int x_dir, x; if ( x1 < x2 ) x_dir = 1; else x_dir = -1; x = x1; while (x != x2) { halLcdPixel( x,y, GrayScale); x += x_dir; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Transport Layer Read. Reads nBufSize bytes tp pBuf from the device */
ADI_BLE_TRANSPORT_RESULT adi_tal_Read(void *pBuf, const uint32_t nBufSize, uint8_t *nBytes)
/* Transport Layer Read. Reads nBufSize bytes tp pBuf from the device */ ADI_BLE_TRANSPORT_RESULT adi_tal_Read(void *pBuf, const uint32_t nBufSize, uint8_t *nBytes)
{ ADI_BLE_TRANSPORT_RESULT eTransportResult; ASSERT(nBytes != NULL); ASSERT(pBuf != NULL); ASSERT(nBufSize > 0u); ASSERT(nBufSize <= ADI_RADIO_BUFFER_BYTES); eTransportResult = RadioTransaction(false, pBuf, nBufSize, nBytes); return (eTransportResult); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* This routine is called when the user clicks the "Apply" button in the "Decode As..." dialog window. This routine calls various helper routines to set/clear dissector values as requested by the user. These routines accumulate information on what actions they have taken, and this summary information is printed by this routine. */
static void decode_apply_cb(GtkWidget *apply_bt _U_, gpointer parent_w)
/* This routine is called when the user clicks the "Apply" button in the "Decode As..." dialog window. This routine calls various helper routines to set/clear dissector values as requested by the user. These routines accumulate information on what actions they have taken, and this summary information is printed by this routine. */ static void decode_apply_cb(GtkWidget *apply_bt _U_, gpointer parent_w)
{ GtkWidget *notebook, *notebook_pg; void (* func)(GtkWidget *); gint page_num; notebook = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_NOTEBOOK); page_num = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)); notebook_pg = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), page_num); func = (void (*)(GtkWidget *))g_object_get_data(G_OBJECT(notebook_pg), E_PAGE_ACTION); func(notebook_pg); redissect_packets(); redissect_all_packet_windows(); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* this syscall returns the maximum rt_priority that can be used by a given scheduling class. */
SYSCALL_DEFINE1(sched_get_priority_max, int, policy)
/* this syscall returns the maximum rt_priority that can be used by a given scheduling class. */ SYSCALL_DEFINE1(sched_get_priority_max, int, policy)
{ int ret = -EINVAL; switch (policy) { case SCHED_FIFO: case SCHED_RR: ret = MAX_USER_RT_PRIO-1; break; case SCHED_NORMAL: case SCHED_BATCH: case SCHED_IDLE: ret = 0; break; } return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base Base address of the DMIC peripheral. param cb callback Pointer to store callback function. retval None. */
void DMIC_EnableIntCallback(DMIC_Type *base, dmic_callback_t cb)
/* param base Base address of the DMIC peripheral. param cb callback Pointer to store callback function. retval None. */ void DMIC_EnableIntCallback(DMIC_Type *base, dmic_callback_t cb)
{ uint32_t instance; instance = DMIC_GetInstance(base); NVIC_ClearPendingIRQ(s_dmicIRQ[instance]); s_dmicCallback[instance] = cb; (void)EnableIRQ(s_dmicIRQ[instance]); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* On external journals the journal blocks are identity-mapped, so this is a no-op. If needed, we can use j_blk_offset - everything is ready. */
int jbd2_journal_bmap(journal_t *journal, unsigned long blocknr, unsigned long long *retp)
/* On external journals the journal blocks are identity-mapped, so this is a no-op. If needed, we can use j_blk_offset - everything is ready. */ int jbd2_journal_bmap(journal_t *journal, unsigned long blocknr, unsigned long long *retp)
{ int err = 0; unsigned long long ret; if (journal->j_inode) { ret = bmap(journal->j_inode, blocknr); if (ret) *retp = ret; else { printk(KERN_ALERT "%s: journal block not found " "at offset %lu on %s\n", __func__, blocknr, journal->j_devname); err = -EIO; __journal_abort_soft(journal, err); } } else { *retp = blocknr; } return err; }
robutest/uclinux
C++
GPL-2.0
60
/* s3c_hsotg_irq_fifoempty - TX FIFO empty interrupt handler @hsotg: The device state: @periodic: True if this is a periodic FIFO interrupt */
static void s3c_hsotg_irq_fifoempty(struct s3c_hsotg *hsotg, bool periodic)
/* s3c_hsotg_irq_fifoempty - TX FIFO empty interrupt handler @hsotg: The device state: @periodic: True if this is a periodic FIFO interrupt */ static void s3c_hsotg_irq_fifoempty(struct s3c_hsotg *hsotg, bool periodic)
{ struct s3c_hsotg_ep *ep; int epno, ret; for (epno = 0; epno < hsotg->num_of_eps; epno++) { ep = index_to_ep(hsotg, epno, 1); if (!ep) continue; if (!ep->dir_in) continue; if ((periodic && !ep->periodic) || (!periodic && ep->periodic)) continue; ret = s3c_hsotg_trytx(hsotg, ep); if (ret < 0) break; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciRead32(IN UINTN Address)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI PciRead32(IN UINTN Address)
{ ASSERT_INVALID_PCI_ADDRESS (Address, 3); return SmmPciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint32); }
tianocore/edk2
C++
Other
4,240
/* The Timer 2 default IRQ, declared in start up code. */
void TIMER2IntHandler(void)
/* The Timer 2 default IRQ, declared in start up code. */ void TIMER2IntHandler(void)
{ unsigned long ulBase = TIMER2_BASE; unsigned long ulTemp0,ulTemp1; ulTemp0 = (xHWREG(ulBase + TIMER_TISR) & TIMER_TISR_TIF); xHWREG(ulBase + TIMER_TISR) = ulTemp0; ulTemp1 = (xHWREG(ulBase + TIMER_TEISR) & TIMER_TISR_TIF); xHWREG(ulBase + TIMER_TEISR) = ulTemp1; if (g_pfnTimerHandlerCallbacks[2] != 0) { g_pfnTimerHandlerCallbacks[2](0, 0, ulTemp0 | ulTemp1, 0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Returns a refcounted instance of the pid struct for the process group controlling the tty. */
struct pid* tty_get_pgrp(struct tty_struct *tty)
/* Returns a refcounted instance of the pid struct for the process group controlling the tty. */ struct pid* tty_get_pgrp(struct tty_struct *tty)
{ unsigned long flags; struct pid *pgrp; spin_lock_irqsave(&tty->ctrl_lock, flags); pgrp = get_pid(tty->pgrp); spin_unlock_irqrestore(&tty->ctrl_lock, flags); return pgrp; }
robutest/uclinux
C++
GPL-2.0
60
/* Calculate the device context index by endpoint address and direction. */
UINT8 XhcEndpointToDci(IN UINT8 EpAddr, IN UINT8 Direction)
/* Calculate the device context index by endpoint address and direction. */ UINT8 XhcEndpointToDci(IN UINT8 EpAddr, IN UINT8 Direction)
{ UINT8 Index; if (EpAddr == 0) { return 1; } else { Index = (UINT8)(2 * EpAddr); if (Direction == EfiUsbDataIn) { Index += 1; } return Index; } }
tianocore/edk2
C++
Other
4,240
/* Computes and encodes length for the MQTT fixed header. */
static uint8_t packet_length_encode(uint32_t length, struct buf_ctx *buf)
/* Computes and encodes length for the MQTT fixed header. */ static uint8_t packet_length_encode(uint32_t length, struct buf_ctx *buf)
{ uint8_t encoded_bytes = 0U; NET_DBG(">> length:0x%08x cur:%p, end:%p", length, (buf == NULL) ? 0 : (void *)buf->cur, (buf == NULL) ? 0 : (void *)buf->end); do { encoded_bytes++; if (buf != NULL) { *(buf->cur) = length & MQTT_LENGTH_VALUE_MASK; } length >>= MQTT_LENGTH_SHIFT; if (buf != NULL) { if (length > 0) { *(buf->cur) |= MQTT_LENGTH_CONTINUATION_BIT; } buf->cur++; } } while (length > 0); return encoded_bytes; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* LOCKING: Defined by SCSI layer. We don't really care. */
void ata_scsi_slave_destroy(struct scsi_device *sdev)
/* LOCKING: Defined by SCSI layer. We don't really care. */ void ata_scsi_slave_destroy(struct scsi_device *sdev)
{ struct ata_port *ap = ata_shost_to_port(sdev->host); struct request_queue *q = sdev->request_queue; unsigned long flags; struct ata_device *dev; if (!ap->ops->error_handler) return; spin_lock_irqsave(ap->lock, flags); dev = __ata_scsi_find_dev(ap, sdev); if (dev && dev->sdev) { dev->sdev = NULL; dev->flags |= ATA_DFLAG_DETACH; ata_port_schedule_eh(ap); } spin_unlock_irqrestore(ap->lock, flags); kfree(q->dma_drain_buffer); q->dma_drain_buffer = NULL; q->dma_drain_size = 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* As an example, using digital rollover mode and a 25-MHz main oscillator clock with a desired IEEE 1588 clock accuracy of 12.5 MHz, and having made a previous call to */
void EMACTimestampAddendSet(uint32_t ui32Base, uint32_t ui32Increment)
/* As an example, using digital rollover mode and a 25-MHz main oscillator clock with a desired IEEE 1588 clock accuracy of 12.5 MHz, and having made a previous call to */ void EMACTimestampAddendSet(uint32_t ui32Base, uint32_t ui32Increment)
{ ASSERT(ui32Base == EMAC0_BASE); HWREG(ui32Base + EMAC_O_TIMADD) = ui32Increment; while(HWREG(ui32Base + EMAC_O_TIMSTCTRL) & EMAC_TIMSTCTRL_ADDREGUP) { } HWREG(ui32Base + EMAC_O_TIMSTCTRL) |= EMAC_TIMSTCTRL_ADDREGUP; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sends a data byte through the I2Cx peripheral. */
void I2C_SendData(I2C_Module *I2Cx, uint8_t Data)
/* Sends a data byte through the I2Cx peripheral. */ void I2C_SendData(I2C_Module *I2Cx, uint8_t Data)
{ assert_param(IS_I2C_PERIPH(I2Cx)); I2Cx->DAT = Data; }
pikasTech/PikaPython
C++
MIT License
1,403
/* pzl_qset_delete - delete a qset from the PZL */
void pzl_qset_delete(struct whc *whc, struct whc_qset *qset)
/* pzl_qset_delete - delete a qset from the PZL */ void pzl_qset_delete(struct whc *whc, struct whc_qset *qset)
{ qset->remove = 1; queue_work(whc->workqueue, &whc->periodic_work); qset_delete(whc, qset); }
robutest/uclinux
C++
GPL-2.0
60