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 comparator searches for the next Interface descriptor containing the correct Android Accessory Mode Class, Subclass and Protocol values. */
uint8_t DCOMP_NextAndroidAccessoryInterface(void *const CurrentDescriptor)
/* This comparator searches for the next Interface descriptor containing the correct Android Accessory Mode Class, Subclass and Protocol values. */ uint8_t DCOMP_NextAndroidAccessoryInterface(void *const 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 == AOA_CSCP_AOADataClass) && (Interfa...
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* this function will flush buffer on a file descriptor. */
int dfs_file_flush(struct dfs_fd *fd)
/* this function will flush buffer on a file descriptor. */ int dfs_file_flush(struct dfs_fd *fd)
{ if (fd == NULL) return -EINVAL; if (fd->fops->flush == NULL) return -ENOSYS; return fd->fops->flush(fd); }
pikasTech/PikaPython
C++
MIT License
1,403
/* This routine purges the input queue of those frames that have been acknowledged. This replaces the boxes labelled "V(a) <- N(r)" on the SDL diagram. */
void ax25_frames_acked(ax25_cb *ax25, unsigned short nr)
/* This routine purges the input queue of those frames that have been acknowledged. This replaces the boxes labelled "V(a) <- N(r)" on the SDL diagram. */ void ax25_frames_acked(ax25_cb *ax25, unsigned short nr)
{ struct sk_buff *skb; if (ax25->va != nr) { while (skb_peek(&ax25->ack_queue) != NULL && ax25->va != nr) { skb = skb_dequeue(&ax25->ack_queue); kfree_skb(skb); ax25->va = (ax25->va + 1) % ax25->modulus; } } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If this interface is not supported, then ASSERT(). */
VOID EFIAPI CryptoServicePkcs7FreeSigners(IN UINT8 *Certs)
/* If this interface is not supported, then ASSERT(). */ VOID EFIAPI CryptoServicePkcs7FreeSigners(IN UINT8 *Certs)
{ CALL_VOID_BASECRYPTLIB (Pkcs.Services.Pkcs7FreeSigners, Pkcs7FreeSigners, (Certs)); }
tianocore/edk2
C++
Other
4,240
/* Search global mtdids list and find id of requested type and number. */
static struct mtdids* id_find(u8 type, u8 num)
/* Search global mtdids list and find id of requested type and number. */ static struct mtdids* id_find(u8 type, u8 num)
{ struct list_head *entry; struct mtdids *id; list_for_each(entry, &mtdids) { id = list_entry(entry, struct mtdids, link); if ((id->type == type) && (id->num == num)) return id; } return NULL; }
EmcraftSystems/u-boot
C++
Other
181
/* This file is for defining functions for specific to KEIL-RL. */
FILE* wolfSSL_fopen(const char *name, const char *openmode)
/* This file is for defining functions for specific to KEIL-RL. */ FILE* wolfSSL_fopen(const char *name, const char *openmode)
{ int i ; FILE * ret ; #define PATHSIZE 100 char path[PATHSIZE] ; char *p ; if(strlen(name) > PATHSIZE)return(NULL) ; for(i = 0; i<= strlen(name); i++) { if(name[i] == '/')path[i] = '\\' ; else path[i] = name[i] ; } if(path[0] == '.' && path[1] == '\\') p = path...
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Update the DB form base on the input file path info. */
BOOLEAN EFIAPI UpdateDBFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
/* Update the DB form base on the input file path info. */ BOOLEAN EFIAPI UpdateDBFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
{ return UpdatePage (FilePath, SECUREBOOT_ENROLL_SIGNATURE_TO_DB); }
tianocore/edk2
C++
Other
4,240
/* Event handler for the CDC Class driver Line Encoding Changed event. */
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t *const CDCInterfaceInfo)
/* Event handler for the CDC Class driver Line Encoding Changed event. */ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t *const CDCInterfaceInfo)
{ SoftUART_SetBaud(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Enables callback. Enables the callback specified by the callback_type. */
void rtc_count_enable_callback(struct rtc_module *const module, enum rtc_count_callback callback_type)
/* Enables callback. Enables the callback specified by the callback_type. */ void rtc_count_enable_callback(struct rtc_module *const module, enum rtc_count_callback callback_type)
{ Assert(module); Assert(module->hw); Rtc *const rtc_module = module->hw; if (callback_type == RTC_COUNT_CALLBACK_OVERFLOW) { rtc_module->MODE0.INTENSET.reg = RTC_MODE0_INTFLAG_OVF; } else { rtc_module->MODE0.INTENSET.reg = RTC_MODE1_INTFLAG_CMP(1 << callback_type); } module->enabled_callback |= (1 << callba...
memfault/zero-to-main
C++
null
200
/* This API is used to get the auto offset(auto_offset_enable) interrupt enable bits of the sensor in the registers 0x15 bit 3. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_auto_offset_enable(u8 *v_offset_enable_u8)
/* This API is used to get the auto offset(auto_offset_enable) interrupt enable bits of the sensor in the registers 0x15 bit 3. */ BMG160_RETURN_FUNCTION_TYPE bmg160_get_auto_offset_enable(u8 *v_offset_enable_u8)
{ BMG160_RETURN_FUNCTION_TYPE comres = ERROR; u8 v_data_u8 = BMG160_INIT_VALUE; if (p_bmg160 == BMG160_NULL) { return E_BMG160_NULL_PTR; } else { comres = p_bmg160->BMG160_BUS_READ_FUNC(p_bmg160->dev_addr, BMG160_INTR_ENABLE0_...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Serializes a pubrel packet into the supplied buffer. */
int MQTTSerialize_pubrel(unsigned char *buf, int buflen, unsigned char dup, unsigned short packetid)
/* Serializes a pubrel packet into the supplied buffer. */ int MQTTSerialize_pubrel(unsigned char *buf, int buflen, unsigned char dup, unsigned short packetid)
{ return MQTTSerialize_ack(buf, buflen, PUBREL, dup, packetid); }
pikasTech/PikaPython
C++
MIT License
1,403
/* This function is called on when the commit operation was finished. It moves log tail to new position and updates the master node so that it stores the new log tail LEB number. Returns zero in case of success and a negative error code in case of failure. */
int ubifs_log_end_commit(struct ubifs_info *c, int ltail_lnum)
/* This function is called on when the commit operation was finished. It moves log tail to new position and updates the master node so that it stores the new log tail LEB number. Returns zero in case of success and a negative error code in case of failure. */ int ubifs_log_end_commit(struct ubifs_info *c, int ltail_ln...
{ int err; mutex_lock(&c->log_mutex); dbg_log("old tail was LEB %d:0, new tail is LEB %d:0", c->ltail_lnum, ltail_lnum); c->ltail_lnum = ltail_lnum; c->min_log_bytes = c->leb_size; spin_lock(&c->buds_lock); c->bud_bytes -= c->cmt_bud_bytes; spin_unlock(&c->buds_lock); err = dbg_check_bud_bytes(c); if (err) ...
4ms/stm32mp1-baremetal
C++
Other
137
/* Check the status of the Rx buffer of the specified SPI port. */
xtBoolean xSPIIsRxEmpty(unsigned long ulBase)
/* Check the status of the Rx buffer of the specified SPI port. */ xtBoolean xSPIIsRxEmpty(unsigned long ulBase)
{ xASSERT(ulBase == SPI0_BASE); return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_RX_EMPTY)? xtrue : xfalse); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function returns the string of Redfish service version. */
EFI_STATUS RedfishBuildRedpathUseId(IN CHAR8 *ServiceVersionStr, IN CHAR8 *Url, IN CHAR8 *Id, OUT CHAR8 **Redpath)
/* This function returns the string of Redfish service version. */ EFI_STATUS RedfishBuildRedpathUseId(IN CHAR8 *ServiceVersionStr, IN CHAR8 *Url, IN CHAR8 *Id, OUT CHAR8 **Redpath)
{ UINTN RedpathSize; if ((Redpath == NULL) || (ServiceVersionStr == NULL) || (Url == NULL) || (Id == NULL)) { return EFI_INVALID_PARAMETER; } RedpathSize = AsciiStrLen ("/") + AsciiStrLen (ServiceVersionStr) + AsciiStrLen (Url) + AsciiStrLen ("[Id=]") + ...
tianocore/edk2
C++
Other
4,240
/* The function is used to enable UART specified interrupt and enable NVIC UART IRQ. */
void UART_EnableInt(UART_T *uart, uint32_t u32InterruptFlag)
/* The function is used to enable UART specified interrupt and enable NVIC UART IRQ. */ void UART_EnableInt(UART_T *uart, uint32_t u32InterruptFlag)
{ UART_ENABLE_INT(uart, u32InterruptFlag); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* This routine places a MPT request frame back on the MPT adapter's FreeQ. */
static void mpt_add_sge(void *pAddr, u32 flagslength, dma_addr_t dma_addr)
/* This routine places a MPT request frame back on the MPT adapter's FreeQ. */ static void mpt_add_sge(void *pAddr, u32 flagslength, dma_addr_t dma_addr)
{ SGESimple32_t *pSge = (SGESimple32_t *) pAddr; pSge->FlagsLength = cpu_to_le32(flagslength); pSge->Address = cpu_to_le32(dma_addr); }
robutest/uclinux
C++
GPL-2.0
60
/* create_mnt_ns - creates a private namespace and adds a root filesystem @mnt: pointer to the new root filesystem mountpoint */
struct mnt_namespace* create_mnt_ns(struct vfsmount *mnt)
/* create_mnt_ns - creates a private namespace and adds a root filesystem @mnt: pointer to the new root filesystem mountpoint */ struct mnt_namespace* create_mnt_ns(struct vfsmount *mnt)
{ struct mnt_namespace *new_ns; new_ns = alloc_mnt_ns(); if (!IS_ERR(new_ns)) { mnt->mnt_ns = new_ns; new_ns->root = mnt; list_add(&new_ns->list, &new_ns->root->mnt_list); } return new_ns; }
robutest/uclinux
C++
GPL-2.0
60
/* Calculate the CRC value of a 32-bit data buffer. */
static int32_t CRC_WriteData32(const uint32_t au32Data[], uint32_t u32Len)
/* Calculate the CRC value of a 32-bit data buffer. */ static int32_t CRC_WriteData32(const uint32_t au32Data[], uint32_t u32Len)
{ uint32_t i; int32_t i32Ret = LL_ERR_INVD_PARAM; const uint32_t u32DataAddr = CRC_DATA_ADDR; if ((au32Data != NULL) && (u32Len != 0UL)) { for (i = 0UL; i < u32Len; i++) { RW_MEM32(u32DataAddr) = au32Data[i]; } i32Ret = LL_OK; } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function for initializing Timer 0 in 24 bit timer mode with 1 us resolution. */
static void timer0_init(uint8_t delayms)
/* Function for initializing Timer 0 in 24 bit timer mode with 1 us resolution. */ static void timer0_init(uint8_t delayms)
{ NRF_TIMER0->TASKS_STOP = 1; NRF_TIMER0->SHORTS = (TIMER_SHORTS_COMPARE0_CLEAR_Enabled << TIMER_SHORTS_COMPARE0_CLEAR_Pos); NRF_TIMER0->MODE = TIMER_MODE_MODE_Timer; NRF_TIMER0->BITMODE = (TIMER_BITMODE_BITMODE_24Bit << TIMER_BITMODE_BITMODE_Pos); NRF_TIMER0->PRESCALER = 4; NRF_TI...
remotemcu/remcu-chip-sdks
C++
null
436
/* Works like a stack, last one to allocate must be first one to free. */
int sh64_put_wired_dtlb_entry(unsigned long long entry)
/* Works like a stack, last one to allocate must be first one to free. */ int sh64_put_wired_dtlb_entry(unsigned long long entry)
{ __flush_tlb_slot(entry); if (entry <= DTLB_FIXED) return -EINVAL; if (entry < (cpu_data->dtlb.first - cpu_data->dtlb.step)) return -EINVAL; cpu_data->dtlb.first -= cpu_data->dtlb.step; cpu_data->dtlb.next = entry; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns the events that can trigger a uDMA request. */
uint32_t TimerDMAEventGet(uint32_t ui32Base)
/* Returns the events that can trigger a uDMA request. */ uint32_t TimerDMAEventGet(uint32_t ui32Base)
{ ASSERT(_TimerBaseValid(ui32Base)); return (HWREG(ui32Base + TIMER_O_DMAEV)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* eeprom_emu_get_address: read the address from a change block */
static uint32_t eeprom_emu_get_address(const struct device *dev, const uint8_t *blk)
/* eeprom_emu_get_address: read the address from a change block */ static uint32_t eeprom_emu_get_address(const struct device *dev, const uint8_t *blk)
{ const struct eeprom_emu_config *dev_config = dev->config; uint32_t address = 0U; blk += dev_config->flash_cbs / 2; for (int i = 0; i < sizeof(address); i++) { if (2 * i == dev_config->flash_cbs) { break; } address += ((uint32_t)(*blk) << (8 * i)); blk++; } return address; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Double disarming on the other hand is allowed, and may occur when a fault and mmiotrace shutdown happen simultaneously. */
static int arm_kmmio_fault_page(struct kmmio_fault_page *f)
/* Double disarming on the other hand is allowed, and may occur when a fault and mmiotrace shutdown happen simultaneously. */ static int arm_kmmio_fault_page(struct kmmio_fault_page *f)
{ int ret; WARN_ONCE(f->armed, KERN_ERR pr_fmt("kmmio page already armed.\n")); if (f->armed) { pr_warning("double-arm: page 0x%08lx, ref %d, old %d\n", f->page, f->count, !!f->old_presence); } ret = clear_page_presence(f, true); WARN_ONCE(ret < 0, KERN_ERR pr_fmt("arming 0x%08lx failed.\n"), f->page)...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Disable an expio pin's interrupt by setting the bit in the imr. */
static void expio_mask_irq(uint32_t irq)
/* Disable an expio pin's interrupt by setting the bit in the imr. */ static void expio_mask_irq(uint32_t irq)
{ uint16_t reg; uint32_t expio = MXC_IRQ_TO_EXPIO(irq); reg = __raw_readw(CPLD_INT_MASK_REG); reg |= 1 << expio; __raw_writew(reg, CPLD_INT_MASK_REG); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check the send packet FIFO for errors. FIFO error interrupts are: */
void XEmac_CheckFifoSendError(XEmac *InstancePtr)
/* Check the send packet FIFO for errors. FIFO error interrupts are: */ void XEmac_CheckFifoSendError(XEmac *InstancePtr)
{ if (XPF_V100B_IS_DEADLOCKED(&InstancePtr->SendFifo)) { u32 IntrEnable; InstancePtr->Stats.FifoErrors++; IntrEnable = XIIF_V123B_READ_DIER(InstancePtr->BaseAddress); XIIF_V123B_WRITE_DIER(InstancePtr->BaseAddress, IntrEnable & ~XEM_IPIF_SEND_FIFO_MASK); InstancePtr->ErrorHandler(InstancePtr->Error...
EmcraftSystems/u-boot
C++
Other
181
/* EP stall lock function to avoid stall clear by USB SET FEATURE request. */
void USBD_LockEpStall(uint32_t u32EpBitmap)
/* EP stall lock function to avoid stall clear by USB SET FEATURE request. */ void USBD_LockEpStall(uint32_t u32EpBitmap)
{ g_u32EpStallLock = u32EpBitmap; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Master selection of compression modules for transcoding. This substitutes for jcinit.c's initialization of the full compressor. */
transencode_master_selection(j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays)
/* Master selection of compression modules for transcoding. This substitutes for jcinit.c's initialization of the full compressor. */ transencode_master_selection(j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays)
{ jpeg_calc_trans_dimensions(cinfo); jinit_c_master_control(cinfo, TRUE); if (cinfo->arith_code) jinit_arith_encoder(cinfo); else { jinit_huff_encoder(cinfo); } transencode_coef_controller(cinfo, coef_arrays); jinit_marker_writer(cinfo); (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);...
xboot/xboot
C++
MIT License
779
/* No locking against reading these values from userspace, as for the CPU loadavg code. */
static void spu_calc_load(void)
/* No locking against reading these values from userspace, as for the CPU loadavg code. */ static void spu_calc_load(void)
{ unsigned long active_tasks; active_tasks = count_active_contexts() * FIXED_1; CALC_LOAD(spu_avenrun[0], EXP_1, active_tasks); CALC_LOAD(spu_avenrun[1], EXP_5, active_tasks); CALC_LOAD(spu_avenrun[2], EXP_15, active_tasks); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enable the Watchdog timer module. This function is to Enable the Watchdog timer and start counter. */
void xWDTEnable(unsigned long ulBase)
/* Enable the Watchdog timer module. This function is to Enable the Watchdog timer and start counter. */ void xWDTEnable(unsigned long ulBase)
{ xASSERT(ulBase == xWDT_BASE); SysCtlKeyAddrUnlock(); xHWREG(WDT_WTCR) |= WDT_WTCR_WTE; SysCtlKeyAddrLock(); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* pdcs_auto_read - Stable Storage autoboot/search flag output. @buf: The output buffer to write to. @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag */
static ssize_t pdcs_auto_read(struct kobject *kobj, struct kobj_attribute *attr, char *buf, int knob)
/* pdcs_auto_read - Stable Storage autoboot/search flag output. @buf: The output buffer to write to. @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag */ static ssize_t pdcs_auto_read(struct kobject *kobj, struct kobj_attribute *attr, char *buf, int knob)
{ char *out = buf; struct pdcspath_entry *pathentry; if (!buf) return -EINVAL; pathentry = &pdcspath_entry_primary; read_lock(&pathentry->rw_lock); out += sprintf(out, "%s\n", (pathentry->devpath.flags & knob) ? "On" : "Off"); read_unlock(&pathentry->rw_lock); return out - buf; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the type of parity mode currently being used. */
unsigned long UARTParityModeGet(unsigned long ulBase)
/* Get the type of parity mode currently being used. */ unsigned long UARTParityModeGet(unsigned long ulBase)
{ xASSERT(UARTBaseValid(ulBase)); return(xHWREG(ulBase + USART_LCR) & (USART_LCR_PBE | USART_LCR_EPE | USART_LCR_SPE)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* If AesContext is NULL, then return FALSE. If Input is NULL, then return FALSE. If InputSize is not multiple of block size (16 bytes), then return FALSE. If Ivec is NULL, then return FALSE. If Output is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceAesCbcEncrypt(IN VOID *AesContext, IN CONST UINT8 *Input, IN UINTN InputSize, IN CONST UINT8 *Ivec, OUT UINT8 *Output)
/* If AesContext is NULL, then return FALSE. If Input is NULL, then return FALSE. If InputSize is not multiple of block size (16 bytes), then return FALSE. If Ivec is NULL, then return FALSE. If Output is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI CryptoServiceAesC...
{ return CALL_BASECRYPTLIB (Aes.Services.CbcEncrypt, AesCbcEncrypt, (AesContext, Input, InputSize, Ivec, Output), FALSE); }
tianocore/edk2
C++
Other
4,240
/* @cbh: coreboot table header address @cbr: to be added table entry address */
static u32 cb_table_add_entry(struct cb_header *cbh, struct cb_record *cbr)
/* @cbh: coreboot table header address @cbr: to be added table entry address */ static u32 cb_table_add_entry(struct cb_header *cbh, struct cb_record *cbr)
{ cbh->table_bytes += cbr->size; cbh->table_entries++; return (u32)cbr + cbr->size; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Check if the device path is EFI system Partition. */
BOOLEAN IsEfiSysPartitionDevicePath(EFI_DEVICE_PATH_PROTOCOL *DevicePath)
/* Check if the device path is EFI system Partition. */ BOOLEAN IsEfiSysPartitionDevicePath(EFI_DEVICE_PATH_PROTOCOL *DevicePath)
{ EFI_STATUS Status; EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; HARDDRIVE_DEVICE_PATH *Hd; EFI_HANDLE Handle; TempDevicePath = DevicePath; while (!IsDevicePathEnd (TempDevicePath)) { if ((DevicePathType (TempDevicePath) == MEDIA_DEVICE_PATH) && (DevicePathSubTyp...
tianocore/edk2
C++
Other
4,240
/* Locks learning tree updates and port disable. This function locks portUpdateLock single mutex. It is primarily used to avoid executing 'port disable' during ELT maintenance. */
IX_ETH_DB_PUBLIC void ixEthDBUpdateLock(void)
/* Locks learning tree updates and port disable. This function locks portUpdateLock single mutex. It is primarily used to avoid executing 'port disable' during ELT maintenance. */ IX_ETH_DB_PUBLIC void ixEthDBUpdateLock(void)
{ ixOsalMutexLock(&portUpdateLock, IX_OSAL_WAIT_FOREVER); }
EmcraftSystems/u-boot
C++
Other
181
/* initialize the structure of IPA destination parameter struct with the default values, it is suggested that call this function after an ipa_destination_parameter_struct structure is defined */
void ipa_destination_struct_para_init(ipa_destination_parameter_struct *destination_struct)
/* initialize the structure of IPA destination parameter struct with the default values, it is suggested that call this function after an ipa_destination_parameter_struct structure is defined */ void ipa_destination_struct_para_init(ipa_destination_parameter_struct *destination_struct)
{ destination_struct->destination_pf = IPA_DPF_ARGB8888; destination_struct->destination_lineoff = IPA_DEFAULT_VALUE; destination_struct->destination_prealpha = IPA_DEFAULT_VALUE; destination_struct->destination_prered = IPA_DEFAULT_VALUE; destination_struct->destination_pregreen = IPA_DEFAULT_VALUE...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If latched faults are configured, the application must call */
uint32_t PWMGenFaultStatus(uint32_t ui32Base, uint32_t ui32Gen, uint32_t ui32Group)
/* If latched faults are configured, the application must call */ uint32_t PWMGenFaultStatus(uint32_t ui32Base, uint32_t ui32Gen, uint32_t ui32Group)
{ ASSERT(ui32Base == PWM0_BASE); ASSERT(_PWMGenValid(ui32Gen)); ASSERT((ui32Group == PWM_FAULT_GROUP_0) || (ui32Group == PWM_FAULT_GROUP_1)); if (ui32Group == PWM_FAULT_GROUP_0) { return (HWREG(PWM_GEN_EXT_BADDR(ui32Base, ui32Gen) + PWM_O_X_FLTSTAT0)); } else { ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* One word (16 bit) configuration read on PSII. Currently fixes destination PCI bus to PCI2, onboard pci. */
static int psII_read_config_word(struct pci_controller *hose, pci_dev_t dev, int reg, u16 *val)
/* One word (16 bit) configuration read on PSII. Currently fixes destination PCI bus to PCI2, onboard pci. */ static int psII_read_config_word(struct pci_controller *hose, pci_dev_t dev, int reg, u16 *val)
{ write4be (PSII_CONFIG_ADDR, PSII_CONFIG_DEST_PCI2 | (PCI_BUS (dev) << 16) | (PCI_DEV (dev) << 11) | (PCI_FUNC (dev) << 8) | ((reg & 0xFF) & ~3)); *val = read2 (PSII_CONFIG_DATA + (reg & 0x03)); return (0); }
EmcraftSystems/u-boot
C++
Other
181
/* If 16-bit I/O port operations are not supported, then ASSERT(). If Port 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 speci...
UINT16 EFIAPI IoBitFieldWrite16(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
/* If 16-bit I/O port operations are not supported, then ASSERT(). If Port 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 speci...
{ return IoWrite16 ( Port, BitFieldWrite16 (IoRead16 (Port), StartBit, EndBit, Value) ); }
tianocore/edk2
C++
Other
4,240
/* Function used to serialise reads of Allocation Descriptors. */
EFI_STATUS GrowUpBufferToNextAd(IN UDF_FE_RECORDING_FLAGS RecordingFlags, IN VOID *Ad, IN OUT VOID **Buffer, IN UINT64 Length)
/* Function used to serialise reads of Allocation Descriptors. */ EFI_STATUS GrowUpBufferToNextAd(IN UDF_FE_RECORDING_FLAGS RecordingFlags, IN VOID *Ad, IN OUT VOID **Buffer, IN UINT64 Length)
{ UINT32 ExtentLength; ExtentLength = GET_EXTENT_LENGTH (RecordingFlags, Ad); if (*Buffer == NULL) { *Buffer = AllocatePool (ExtentLength); if (*Buffer == NULL) { return EFI_OUT_OF_RESOURCES; } } else { *Buffer = ReallocatePool ((UINTN)Length, (UINTN)(Length + ExtentLength), *Buffer); ...
tianocore/edk2
C++
Other
4,240
/* Advance/Retreat lines and set CurrentLine in BufferImage to it. */
HEFI_EDITOR_LINE* HMoveCurrentLine(IN INTN Count)
/* Advance/Retreat lines and set CurrentLine in BufferImage to it. */ HEFI_EDITOR_LINE* HMoveCurrentLine(IN INTN Count)
{ HEFI_EDITOR_LINE *Line; UINTN AbsCount; if (Count <= 0) { AbsCount = (UINTN)ABS (Count); Line = HLineRetreat (AbsCount); } else { Line = HLineAdvance ((UINTN)Count); } if (Line == NULL) { return NULL; } HMainEditor.BufferImage->CurrentLine = Line; return Line; }
tianocore/edk2
C++
Other
4,240
/* Free the svc_sock's socket resources and the svc_sock itself. */
static void svc_sock_free(struct svc_xprt *)
/* Free the svc_sock's socket resources and the svc_sock itself. */ static void svc_sock_free(struct svc_xprt *)
{ struct svc_sock *svsk = container_of(xprt, struct svc_sock, sk_xprt); dprintk("svc: svc_sock_free(%p)\n", svsk); if (svsk->sk_sock->file) sockfd_put(svsk->sk_sock); else sock_release(svsk->sk_sock); kfree(svsk); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Builds a pdu frame as a DM response. */
void llc_pdu_init_as_dm_rsp(struct sk_buff *skb, u8 f_bit)
/* Builds a pdu frame as a DM response. */ void llc_pdu_init_as_dm_rsp(struct sk_buff *skb, u8 f_bit)
{ struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 |= LLC_2_PDU_RSP_DM; pdu->ctrl_1 |= ((f_bit & 1) << 4) & LLC_U_PF_BIT_MASK; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* this function is a POSIX compliant version, which will set position of next directory structure in the directory stream. */
void seekdir(DIR *d, off_t offset)
/* this function is a POSIX compliant version, which will set position of next directory structure in the directory stream. */ void seekdir(DIR *d, off_t offset)
{ struct dfs_fd *fd; fd = fd_get(d->fd); if (fd == NULL) { rt_set_errno(-EBADF); return ; } if (dfs_file_lseek(fd, offset) >= 0) d->num = d->cur = 0; fd_put(fd); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Returns 3-element vector of accelerometer data in body frame. */
inv_error_t inv_get_accel(long *data)
/* Returns 3-element vector of accelerometer data in body frame. */ inv_error_t inv_get_accel(long *data)
{ if (data != NULL) { inv_get_accel_set(data, NULL, NULL); return INV_SUCCESS; } else { return INV_ERROR_INVALID_PARAMETER; } }
Luos-io/luos_engine
C++
MIT License
496
/* Since: 2.24 Returns: the allocated memory, or NULL. */
gpointer g_try_realloc_n(gpointer mem, gsize n_blocks, gsize n_block_bytes)
/* Since: 2.24 Returns: the allocated memory, or NULL. */ gpointer g_try_realloc_n(gpointer mem, gsize n_blocks, gsize n_block_bytes)
{ if (SIZE_OVERFLOWS (n_blocks, n_block_bytes)) return NULL; return g_try_realloc (mem, n_blocks * n_block_bytes); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set the limits of how many errors, warnings, and errors+warnings we will print. */
VOID SetPrintLimits(UINT32 MaxErrors, UINT32 MaxWarnings, UINT32 MaxWarningsPlusErrors)
/* Set the limits of how many errors, warnings, and errors+warnings we will print. */ VOID SetPrintLimits(UINT32 MaxErrors, UINT32 MaxWarnings, UINT32 MaxWarningsPlusErrors)
{ mMaxErrors = MaxErrors; mMaxWarnings = MaxWarnings; mMaxWarningsPlusErrors = MaxWarningsPlusErrors; mPrintLimitsSet = 1; }
tianocore/edk2
C++
Other
4,240
/* Check the references of all open files on the volume. Any open file (that is checked) that is no longer referenced, is freed - and its parent open file is then referenced checked. */
STATIC VOID FatCheckVolumeRef(IN FAT_VOLUME *Volume)
/* Check the references of all open files on the volume. Any open file (that is checked) that is no longer referenced, is freed - and its parent open file is then referenced checked. */ STATIC VOID FatCheckVolumeRef(IN FAT_VOLUME *Volume)
{ FAT_OFILE *OFile; FAT_OFILE *Parent; while (!IsListEmpty (&Volume->CheckRef)) { Parent = OFILE_FROM_CHECKLINK (Volume->CheckRef.ForwardLink); while (Parent != NULL) { OFile = Parent; Parent = OFile->Parent; if (!FatCheckOFileRef (OFile)) { break; } } } }
tianocore/edk2
C++
Other
4,240
/* Setup interrupt masks, etc to enable wakeup by power switch */
static void __default_power_switch_setup(void)
/* Setup interrupt masks, etc to enable wakeup by power switch */ static void __default_power_switch_setup(void)
{ __irq_mask = *(unsigned long *)0xfeff9820; *(unsigned long *)0xfeff9820 = 0xfffe0000; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If Cert is NULL, then return FALSE. If RsaContext is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI RsaGetPublicKeyFromX509(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT VOID **RsaContext)
/* If Cert is NULL, then return FALSE. If RsaContext is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI RsaGetPublicKeyFromX509(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT VOID **RsaContext)
{ CALL_CRYPTO_SERVICE (RsaGetPublicKeyFromX509, (Cert, CertSize, RsaContext), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Loads firmware data from the specified file using the firmware file parser that was specified during the initialization of this module. */
LIBOPENBLT_EXPORT uint32_t BltFirmwareLoadFromFile(char const *firmwareFile, uint32_t addressOffset)
/* Loads firmware data from the specified file using the firmware file parser that was specified during the initialization of this module. */ LIBOPENBLT_EXPORT uint32_t BltFirmwareLoadFromFile(char const *firmwareFile, uint32_t addressOffset)
{ uint32_t result = BLT_RESULT_ERROR_GENERIC; assert(firmwareFile != NULL); if (firmwareFile != NULL) { if (FirmwareLoadFromFile(firmwareFile, addressOffset)) { result = BLT_RESULT_OK; } } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This routine implements a generic reset handler for device, bus and host reset requests. Device, bus and host specific reset handlers can use this function after they do their specific tasks. */
static int megasas_generic_reset(struct scsi_cmnd *scmd)
/* This routine implements a generic reset handler for device, bus and host reset requests. Device, bus and host specific reset handlers can use this function after they do their specific tasks. */ static int megasas_generic_reset(struct scsi_cmnd *scmd)
{ int ret_val; struct megasas_instance *instance; instance = (struct megasas_instance *)scmd->device->host->hostdata; scmd_printk(KERN_NOTICE, scmd, "megasas: RESET -%ld cmd=%x retries=%x\n", scmd->serial_number, scmd->cmnd[0], scmd->retries); if (instance->hw_crit_error) { printk(KERN_ERR "megasas: cannot re...
robutest/uclinux
C++
GPL-2.0
60
/* The range must be contiguous but may span node boundaries. */
void __init free_bootmem(unsigned long addr, unsigned long size)
/* The range must be contiguous but may span node boundaries. */ void __init free_bootmem(unsigned long addr, unsigned long size)
{ unsigned long start, end; kmemleak_free_part(__va(addr), size); start = PFN_UP(addr); end = PFN_DOWN(addr + size); mark_bootmem(start, end, 0, 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the last data output value of the selected DAC cahnnel. */
u16 DAC_GetDataOutputValue(emDACCH_TypeDef channel)
/* Returns the last data output value of the selected DAC cahnnel. */ u16 DAC_GetDataOutputValue(emDACCH_TypeDef channel)
{ return (*(vu32*)(DAC_BASE + DOR_Offset + (channel >> 2))); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check whether the register table is empty or not. */
BOOLEAN IsRegisterTableEmpty(IN CPU_REGISTER_TABLE *RegisterTable, IN UINT32 NumberOfCpus)
/* Check whether the register table is empty or not. */ BOOLEAN IsRegisterTableEmpty(IN CPU_REGISTER_TABLE *RegisterTable, IN UINT32 NumberOfCpus)
{ UINTN Index; if (RegisterTable != NULL) { for (Index = 0; Index < NumberOfCpus; Index++) { if (RegisterTable[Index].TableLength != 0) { return FALSE; } } } return TRUE; }
tianocore/edk2
C++
Other
4,240
/* When releasing a hugetlb pool reservation, any surplus pages that were allocated to satisfy the reservation must be explicitly freed if they were never used. Called with hugetlb_lock held. */
static void return_unused_surplus_pages(struct hstate *h, unsigned long unused_resv_pages)
/* When releasing a hugetlb pool reservation, any surplus pages that were allocated to satisfy the reservation must be explicitly freed if they were never used. Called with hugetlb_lock held. */ static void return_unused_surplus_pages(struct hstate *h, unsigned long unused_resv_pages)
{ unsigned long nr_pages; h->resv_huge_pages -= unused_resv_pages; if (h->order >= MAX_ORDER) return; nr_pages = min(unused_resv_pages, h->surplus_huge_pages); while (nr_pages--) { if (!free_pool_huge_page(h, &node_states[N_HIGH_MEMORY], 1)) break; } }
robutest/uclinux
C++
GPL-2.0
60
/* Parse the Wireless Event and print it out Dump a buffer as a serie of hex Maybe should go in iwlib... Maybe we should have better formatting like iw_print_key... */
static char* iw_hexdump(char *buf, size_t buflen, const unsigned char *data, size_t datalen)
/* Parse the Wireless Event and print it out Dump a buffer as a serie of hex Maybe should go in iwlib... Maybe we should have better formatting like iw_print_key... */ static char* iw_hexdump(char *buf, size_t buflen, const unsigned char *data, size_t datalen)
{ size_t i; char * pos = buf; for(i = 0; i < datalen; i++) pos += snprintf(pos, buf + buflen - pos, "%02X", data[i]); return buf; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Used to generate message authentication code (MAC) using CBC-MAC and F9 mode. */
bool AESDataMAC(uint32_t ui32Base, uint8_t *pui8Src, uint32_t ui32Length, uint8_t *pui8Tag)
/* Used to generate message authentication code (MAC) using CBC-MAC and F9 mode. */ bool AESDataMAC(uint32_t ui32Base, uint8_t *pui8Src, uint32_t ui32Length, uint8_t *pui8Tag)
{ uint32_t ui32Count, ui32BlkCount, ui32ByteCount; ASSERT(ui32Base == AES_BASE); AESDataLengthSet(AES_BASE, (uint64_t) ui32Length); ui32BlkCount = ui32Length/16; for(ui32Count = 0; ui32Count < ui32BlkCount; ui32Count += 1) { AESDataWrite(ui32Base, pui8Src + ui32Count*16 ,16); } ui32B...
micropython/micropython
C++
Other
18,334
/* g e t I S o r t A r r a y */
returnValue Indexlist_getISortArray(Indexlist *_THIS, int **const iSortArray)
/* g e t I S o r t A r r a y */ returnValue Indexlist_getISortArray(Indexlist *_THIS, int **const iSortArray)
{ *iSortArray = _THIS->iSort; return SUCCESSFUL_RETURN; }
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* returns pointer to the struct that contains 3 strings(element name, attribute name, attribute value) */
gpointer xmpp_name_attr_struct(const gchar *name, const gchar *attr_name, const gchar *attr_value)
/* returns pointer to the struct that contains 3 strings(element name, attribute name, attribute value) */ gpointer xmpp_name_attr_struct(const gchar *name, const gchar *attr_name, const gchar *attr_value)
{ name_attr_t *result; result = wmem_new(wmem_packet_scope(), name_attr_t); result->name = name; result->attr_name = attr_name; result->attr_value = attr_value; return result; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function will do USB_REQ_GET_DESCRIPTO' bRequest for the usb device instance, */
rt_err_t rt_usbh_get_descriptor(uinst_t device, rt_uint8_t type, void *buffer, int nbytes)
/* This function will do USB_REQ_GET_DESCRIPTO' bRequest for the usb device instance, */ rt_err_t rt_usbh_get_descriptor(uinst_t device, rt_uint8_t type, void *buffer, int nbytes)
{ struct urequest setup; int timeout = USB_TIMEOUT_BASIC; RT_ASSERT(device != RT_NULL); setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_STANDARD | USB_REQ_TYPE_DEVICE; setup.bRequest = USB_REQ_GET_DESCRIPTOR; setup.wIndex = 0; setup.wLength = nbytes; setup.wValue = type <...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get the ENET instance from peripheral base address. */
uint32_t ENET_GetInstance(ENET_Type *base)
/* Get the ENET instance from peripheral base address. */ uint32_t ENET_GetInstance(ENET_Type *base)
{ uint32_t instance; for (instance = 0; instance < FSL_FEATURE_SOC_LPC_ENET_COUNT; instance++) { if (s_enetBases[instance] == base) { break; } } assert(instance < FSL_FEATURE_SOC_LPC_ENET_COUNT); return instance; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The idle thread. There's no useful work to be done, so just try to conserve power and have a low exit latency (ie sit in a loop waiting for somebody to say that they'd like to reschedule) */
void cpu_idle(void)
/* The idle thread. There's no useful work to be done, so just try to conserve power and have a low exit latency (ie sit in a loop waiting for somebody to say that they'd like to reschedule) */ void cpu_idle(void)
{ while (1) { while (!need_resched()) { check_pgt_cache(); if (!frv_dma_inprogress && idle) idle(); } preempt_enable_no_resched(); schedule(); preempt_disable(); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Turn 16bit ratios into best small ratio the chipset can grok */
static void pms_vertdeci(struct pms *dev, unsigned short decinum, unsigned short deciden)
/* Turn 16bit ratios into best small ratio the chipset can grok */ static void pms_vertdeci(struct pms *dev, unsigned short decinum, unsigned short deciden)
{ if (decinum % 5 == 0) { deciden /= 5; decinum /= 5; } while (decinum % 3 == 0 && deciden % 3 == 0) { deciden /= 3; decinum /= 3; } while (decinum % 2 == 0 && deciden % 2 == 0) { decinum /= 2; deciden /= 2; } while (deciden > 32) { deciden /= 2; decinum = (decinum + 1) / 2; } if (deciden == 32...
robutest/uclinux
C++
GPL-2.0
60
/* This functoin implements a non-recursive way of freeing all of the nodes in the red-black tree. */
static void free_rb_tree_fname(struct rb_root *root)
/* This functoin implements a non-recursive way of freeing all of the nodes in the red-black tree. */ static void free_rb_tree_fname(struct rb_root *root)
{ struct rb_node *n = root->rb_node; struct rb_node *parent; struct fname *fname; while (n) { if (n->rb_left) { n = n->rb_left; continue; } if (n->rb_right) { n = n->rb_right; continue; } parent = rb_parent(n); fname = rb_entry(n, struct fname, rb_hash); while (fname) { struct fname *ol...
robutest/uclinux
C++
GPL-2.0
60
/* exported, called by kernel clients to perform same functions as with userland ioctl() */
int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg)
/* exported, called by kernel clients to perform same functions as with userland ioctl() */ int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg)
{ struct snd_seq_client *client; mm_segment_t fs; int result; client = clientptr(clientid); if (client == NULL) return -ENXIO; fs = snd_enter_user(); result = snd_seq_do_ioctl(client, cmd, (void __user *)arg); snd_leave_user(fs); return result; }
robutest/uclinux
C++
GPL-2.0
60
/* Stop any interrupts from executing so that, once this function returns, other layers of the driver can be sure they won't get any more callbacks. Thus must be called on a proper process context. */
void ipwireless_stop_interrupts(struct ipw_hardware *hw)
/* Stop any interrupts from executing so that, once this function returns, other layers of the driver can be sure they won't get any more callbacks. Thus must be called on a proper process context. */ void ipwireless_stop_interrupts(struct ipw_hardware *hw)
{ if (!hw->shutting_down) { hw->shutting_down = 1; del_timer(&hw->setup_timer); do_close_hardware(hw); } }
robutest/uclinux
C++
GPL-2.0
60
/* brief DMA instance 1, channel 8 IRQ handler. */
void EDMA_1_CH8_DriverIRQHandler(void)
/* brief DMA instance 1, channel 8 IRQ handler. */ void EDMA_1_CH8_DriverIRQHandler(void)
{ EDMA_DriverIRQHandler(1U, 8U); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Fixup internal data so that EFI can be call in virtual mode. Call the passed in Child Notify event and convert any pointers in lib to virtual mode. */
STATIC VOID EFIAPI VirtualNotifyEvent(IN EFI_EVENT Event, IN VOID *Context)
/* Fixup internal data so that EFI can be call in virtual mode. Call the passed in Child Notify event and convert any pointers in lib to virtual mode. */ STATIC VOID EFIAPI VirtualNotifyEvent(IN EFI_EVENT Event, IN VOID *Context)
{ EfiConvertPointer (0x0, (VOID **)&mPL031RtcBase); return; }
tianocore/edk2
C++
Other
4,240
/* reenable_crq_queue: - reenables a crq after @queue: crq_queue to initialize and register @hostdata: ibmvscsi_host_data of host */
static int rpavscsi_reenable_crq_queue(struct crq_queue *queue, struct ibmvscsi_host_data *hostdata)
/* reenable_crq_queue: - reenables a crq after @queue: crq_queue to initialize and register @hostdata: ibmvscsi_host_data of host */ static int rpavscsi_reenable_crq_queue(struct crq_queue *queue, struct ibmvscsi_host_data *hostdata)
{ int rc; struct vio_dev *vdev = to_vio_dev(hostdata->dev); do { rc = plpar_hcall_norets(H_ENABLE_CRQ, vdev->unit_address); } while ((rc == H_IN_PROGRESS) || (rc == H_BUSY) || (H_IS_LONG_BUSY(rc))); if (rc) dev_err(hostdata->dev, "Error %d enabling adapter\n", rc); return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* Some versions of firmware stuff packets with 0xff 0x03 (PPP: ALLSTATIONS, UI) bytes, which are required on sent packet, but not always present on received packets */
static struct sk_buff* ipw_packet_received_skb(unsigned char *data, unsigned int length)
/* Some versions of firmware stuff packets with 0xff 0x03 (PPP: ALLSTATIONS, UI) bytes, which are required on sent packet, but not always present on received packets */ static struct sk_buff* ipw_packet_received_skb(unsigned char *data, unsigned int length)
{ struct sk_buff *skb; if (length > 2 && data[0] == PPP_ALLSTATIONS && data[1] == PPP_UI) { length -= 2; data += 2; } skb = dev_alloc_skb(length + 4); skb_reserve(skb, 2); memcpy(skb_put(skb, length), data, length); return skb; }
robutest/uclinux
C++
GPL-2.0
60
/* Write to TX register using non-blocking method. This function writes data to the TX register directly, upper layer must make sure the TX register is empty before calling this function. */
static void LPSCI_WriteNonBlocking(UART0_Type *base, const uint8_t *data, size_t length)
/* Write to TX register using non-blocking method. This function writes data to the TX register directly, upper layer must make sure the TX register is empty before calling this function. */ static void LPSCI_WriteNonBlocking(UART0_Type *base, const uint8_t *data, size_t length)
{ assert(data); size_t i; for (i = 0; i < length; i++) { base->D = data[i]; } }
labapart/polymcu
C++
null
201
/* Returns the UART hardware flow control mode currently in use. */
unsigned long UARTFlowControlGet(unsigned long ulBase)
/* Returns the UART hardware flow control mode currently in use. */ unsigned long UARTFlowControlGet(unsigned long ulBase)
{ xASSERT((ulBase == UART0_BASE) ||(ulBase == UART1_BASE)); return(xHWREG(ulBase + UART_IER) & (UART_FLOWCONTROL_TX | UART_FLOWCONTROL_RX)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Poll the DataFlash device until it is READY. This usually takes 5-20 msec or so; more for sector erase. ready: return > 0 */
static int dataflash_waitready(struct spi_slave *spi)
/* Poll the DataFlash device until it is READY. This usually takes 5-20 msec or so; more for sector erase. ready: return > 0 */ static int dataflash_waitready(struct spi_slave *spi)
{ int status; int timeout = 2 * CONFIG_SYS_HZ; int timebase; timebase = get_timer(0); do { status = dataflash_status(spi); if (status < 0) status = 0; if (status & (1 << 7)) return status; mdelay(3); } while (get_timer(timebase) < timeout); return -ETIME; }
4ms/stm32mp1-baremetal
C++
Other
137
/* brief DMA instance 0, channel 0 IRQ handler. */
void EDMA_0_CH0_DriverIRQHandler(void)
/* brief DMA instance 0, channel 0 IRQ handler. */ void EDMA_0_CH0_DriverIRQHandler(void)
{ EDMA_DriverIRQHandler(0U, 0U); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function should be called with the sas_topology_mutex already held */
static struct mptsas_portinfo * mptsas_find_portinfo_by_sas_address(MPT_ADAPTER *ioc, u64 sas_address)
/* This function should be called with the sas_topology_mutex already held */ static struct mptsas_portinfo * mptsas_find_portinfo_by_sas_address(MPT_ADAPTER *ioc, u64 sas_address)
{ struct mptsas_portinfo *port_info, *rc = NULL; int i; if (sas_address >= ioc->hba_port_sas_addr && sas_address < (ioc->hba_port_sas_addr + ioc->hba_port_num_phy)) return ioc->hba_port_info; mutex_lock(&ioc->sas_topology_mutex); list_for_each_entry(port_info, &ioc->sas_topology, list) for (i = 0; i ...
robutest/uclinux
C++
GPL-2.0
60
/* Returns: TRUE if @appinfo1 is equal to @appinfo2. FALSE otherwise. */
gboolean g_app_info_equal(GAppInfo *appinfo1, GAppInfo *appinfo2)
/* Returns: TRUE if @appinfo1 is equal to @appinfo2. FALSE otherwise. */ gboolean g_app_info_equal(GAppInfo *appinfo1, GAppInfo *appinfo2)
{ GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo1), FALSE); g_return_val_if_fail (G_IS_APP_INFO (appinfo2), FALSE); if (G_TYPE_FROM_INSTANCE (appinfo1) != G_TYPE_FROM_INSTANCE (appinfo2)) return FALSE; iface = G_APP_INFO_GET_IFACE (appinfo1); return (* iface->equal) (appinfo1, appinf...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Reset USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_ResetEP(U32 EPNum)
/* Reset USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ void USBD_ResetEP(U32 EPNum)
{ uint32_t u32Ep, u32Num; u32Num = EPNum & 0x0F; u32Ep = USBD_NUM_TO_EP(u32Num); HSUSBD->EP[u32Ep].EPRSPCTL = (HSUSBD->EP[u32Ep].EPRSPCTL & HSUSBD_EP_RSPCTL_MODE_MASK) | HSUSBD_EPRSPCTL_FLUSH_Msk; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* On 32-bit we just access the address and let hash_page create a HPTE if necessary, so there is no need to fall back to reading the page tables. Since this is called at interrupt level, do_page_fault() won't treat a DSI as a page fault. */
static int read_user_stack_32(unsigned int __user *ptr, unsigned int *ret)
/* On 32-bit we just access the address and let hash_page create a HPTE if necessary, so there is no need to fall back to reading the page tables. Since this is called at interrupt level, do_page_fault() won't treat a DSI as a page fault. */ static int read_user_stack_32(unsigned int __user *ptr, unsigned int *ret)
{ if ((unsigned long)ptr > TASK_SIZE - sizeof(unsigned int) || ((unsigned long)ptr & 3)) return -EFAULT; return __get_user_inatomic(*ret, ptr); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function MUST handle the 'c' and 's' command packets, as well packets to set / remove a hardware breakpoint, if used. If there are additional packets which the hardware needs to handle, they are handled here. The code should return -1 if it wants to process more packets, and a %0 or %1 if it wants to exit from ...
int kgdb_arch_handle_exception(int e_vector, int signo, int err_code, char *remcomInBuffer, char *remcomOutBuffer, struct pt_regs *linux_regs)
/* This function MUST handle the 'c' and 's' command packets, as well packets to set / remove a hardware breakpoint, if used. If there are additional packets which the hardware needs to handle, they are handled here. The code should return -1 if it wants to process more packets, and a %0 or %1 if it wants to exit from ...
{ unsigned long addr; char *ptr; int newPC; switch (remcomInBuffer[0]) { case 'c': case 's': ptr = &remcomInBuffer[1]; if (kgdb_hex2long(&ptr, &addr)) linux_regs->ip = addr; case 'D': case 'k': newPC = linux_regs->ip; linux_regs->flags &= ~X86_EFLAGS_TF; atomic_set(&kgdb_cpu_doing_single_step, -1);...
EmcraftSystems/linux-emcraft
C++
Other
266
/* @handle: handle to find @count: number of entries in the array @buffer: array to search */
efi_status_t find_in_buffer(efi_handle_t handle, size_t count, efi_handle_t *buffer)
/* @handle: handle to find @count: number of entries in the array @buffer: array to search */ efi_status_t find_in_buffer(efi_handle_t handle, size_t count, efi_handle_t *buffer)
{ size_t i; for (i = 0; i < count; ++i) { if (buffer[i] == handle) return EFI_SUCCESS; } return EFI_NOT_FOUND; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Perform a "final reduction" in field F255 (field for Curve25519) The source value must be less than twice the modulus. If the value is not lower than the modulus, then the modulus is subtracted and this function returns 1; otherwise, it leaves it untouched and it returns 0. */
static uint32_t reduce_final_f255(uint32_t *d)
/* Perform a "final reduction" in field F255 (field for Curve25519) The source value must be less than twice the modulus. If the value is not lower than the modulus, then the modulus is subtracted and this function returns 1; otherwise, it leaves it untouched and it returns 0. */ static uint32_t reduce_final_f255(uint...
{ uint32_t t[20]; uint32_t cc; int i; memcpy(t, d, sizeof t); cc = 19; for (i = 0; i < 20; i ++) { uint32_t w; w = t[i] + cc; cc = w >> 13; t[i] = w & 0x1FFF; } cc = t[19] >> 8; t[19] &= 0xFF; CCOPY(cc, d, t, sizeof t); return cc; }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* This function is executed in case of error occurrence. */
static void Error_Handler(void)
/* This function is executed in case of error occurrence. */ static void Error_Handler(void)
{ while(1) { BSP_LED_Toggle(LED2); HAL_Delay(500); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* USBD_CtlSendStatus send zero lzngth packet on the ctl pipe. */
USBD_StatusTypeDef USBD_CtlSendStatus(USBD_HandleTypeDef *pdev)
/* USBD_CtlSendStatus send zero lzngth packet on the ctl pipe. */ USBD_StatusTypeDef USBD_CtlSendStatus(USBD_HandleTypeDef *pdev)
{ pdev->ep0_state = USBD_EP0_STATUS_IN; USBD_LL_Transmit (pdev, 0x00, NULL, 0); return USBD_OK; }
micropython/micropython
C++
Other
18,334
/* This function can be used by drives like qla4xxx to report to the scsi layer when the scans it kicked off at module load time are done. */
int iscsi_scan_finished(struct Scsi_Host *shost, unsigned long time)
/* This function can be used by drives like qla4xxx to report to the scsi layer when the scans it kicked off at module load time are done. */ int iscsi_scan_finished(struct Scsi_Host *shost, unsigned long time)
{ struct iscsi_cls_host *ihost = shost->shost_data; return !atomic_read(&ihost->nr_scans); }
robutest/uclinux
C++
GPL-2.0
60
/* If this service is called from an AP, then EFI_DEVICE_ERROR is returned. If NumberOfProcessors or NumberOfEnabledProcessors is NULL, then EFI_INVALID_PARAMETER is returned. Otherwise, the total number of processors is returned in NumberOfProcessors, the number of currently enabled processor is returned in NumberOfEn...
EFI_STATUS EFIAPI CpuMpServicesGetNumberOfProcessors(IN EFI_MP_SERVICES_PROTOCOL *This, OUT UINTN *NumberOfProcessors, OUT UINTN *NumberOfEnabledProcessors)
/* If this service is called from an AP, then EFI_DEVICE_ERROR is returned. If NumberOfProcessors or NumberOfEnabledProcessors is NULL, then EFI_INVALID_PARAMETER is returned. Otherwise, the total number of processors is returned in NumberOfProcessors, the number of currently enabled processor is returned in NumberOfEn...
{ if ((NumberOfProcessors == NULL) || (NumberOfEnabledProcessors == NULL)) { return EFI_INVALID_PARAMETER; } if (!IsBSP ()) { return EFI_DEVICE_ERROR; } *NumberOfProcessors = gMPSystem.NumberOfProcessors; *NumberOfEnabledProcessors = gMPSystem.NumberOfEnabledProcessors; return EFI_SUCCESS; ...
tianocore/edk2
C++
Other
4,240
/* @params pCBParam - Application passed pointer. @params nEvent - Code of the event that triggered the interrupt. @params pArg - Driver passed pointer. */
static void timer2_delay_callback(void *pCBParam, uint32_t nEvent, void *pArg)
/* @params pCBParam - Application passed pointer. @params nEvent - Code of the event that triggered the interrupt. @params pArg - Driver passed pointer. */ static void timer2_delay_callback(void *pCBParam, uint32_t nEvent, void *pArg)
{ if(universal_delay_flag != 0) universal_delay_flag--; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* platform_add_devices - add a numbers of platform devices @devs: array of platform devices to add @num: number of platform devices in array */
int platform_add_devices(struct platform_device **devs, int num)
/* platform_add_devices - add a numbers of platform devices @devs: array of platform devices to add @num: number of platform devices in array */ int platform_add_devices(struct platform_device **devs, int num)
{ int i, ret = 0; for (i = 0; i < num; i++) { ret = platform_device_register(devs[i]); if (ret) { while (--i >= 0) platform_device_unregister(devs[i]); break; } } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* This function gets the base address of the channel control table. This table resides in system memory and holds control information for each uDMA channel. */
void* uDMAControlBaseGet(void)
/* This function gets the base address of the channel control table. This table resides in system memory and holds control information for each uDMA channel. */ void* uDMAControlBaseGet(void)
{ return((void *)HWREG(UDMA_CTLBASE)); }
watterott/WebRadio
C++
null
71
/* Write to TX register using non-blocking method. This function writes data to the TX register directly, upper layer must make sure the TX register is empty or TX FIFO has empty room before calling this function. */
static void UART_WriteNonBlocking(UART_Type *base, const uint8_t *data, size_t length)
/* Write to TX register using non-blocking method. This function writes data to the TX register directly, upper layer must make sure the TX register is empty or TX FIFO has empty room before calling this function. */ static void UART_WriteNonBlocking(UART_Type *base, const uint8_t *data, size_t length)
{ assert(data); size_t i; for (i = 0; i < length; i++) { base->D = data[i]; } }
labapart/polymcu
C++
null
201
/* Set tracking index, TSC operation mode or enable the TSC. */
void STMPE811SetOperatingMode(unsigned long ulMode)
/* Set tracking index, TSC operation mode or enable the TSC. */ void STMPE811SetOperatingMode(unsigned long ulMode)
{ STMPE811Write (STMPE811_TSC_CTRL, 1, ulMode); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Produce the DynamicCommand protocol to handle "initrd" command. */
EFI_STATUS EFIAPI LinuxInitrdDynamicShellCommandEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* Produce the DynamicCommand protocol to handle "initrd" command. */ EFI_STATUS EFIAPI LinuxInitrdDynamicShellCommandEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; mLinuxInitrdShellCommandHiiHandle = InitializeHiiPackage (ImageHandle); if (mLinuxInitrdShellCommandHiiHandle == NULL) { return EFI_ABORTED; } Status = gBS->InstallProtocolInterface ( &ImageHandle, &gEfiShellDynamicCommandProtocolGuid, ...
tianocore/edk2
C++
Other
4,240
/* OUCH prices are integers, with four implicit decimal places. So we insert the decimal point, and add a leading dollar sign as well. */
static void format_price(char *buf, guint32 value)
/* OUCH prices are integers, with four implicit decimal places. So we insert the decimal point, and add a leading dollar sign as well. */ static void format_price(char *buf, guint32 value)
{ if (value == 0x7fffffff) { g_snprintf(buf, ITEM_LABEL_LENGTH, "%s", "Market"); } else { g_snprintf(buf, ITEM_LABEL_LENGTH, "$%u.%04u", value / 10000, value % 10000); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* SYSCTRL GPIOA Bus Clock Enable and Reset Release. */
void LL_SYSCTRL_GPIOA_ClkEnRstRelease(void)
/* SYSCTRL GPIOA Bus Clock Enable and Reset Release. */ void LL_SYSCTRL_GPIOA_ClkEnRstRelease(void)
{ __LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL); __LL_SYSCTRL_GPIOABusClk_En(SYSCTRL); __LL_SYSCTRL_GPIOASoftRst_Release(SYSCTRL); __LL_SYSCTRL_Reg_Lock(SYSCTRL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns %0 on success or negative error code on failure. */
int ubifs_tnc_remove(struct ubifs_info *c, const union ubifs_key *key)
/* Returns %0 on success or negative error code on failure. */ int ubifs_tnc_remove(struct ubifs_info *c, const union ubifs_key *key)
{ int found, n, err = 0; struct ubifs_znode *znode; mutex_lock(&c->tnc_mutex); dbg_tnck(key, "key "); found = lookup_level0_dirty(c, key, &znode, &n); if (found < 0) { err = found; goto out_unlock; } if (found == 1) err = tnc_delete(c, znode, n); if (!err) err = dbg_check_tnc(c, 0); out_unlock: mutex_...
4ms/stm32mp1-baremetal
C++
Other
137
/* param base Pointer to the FLEXIO_SPI_Type structure. param handle Pointer to the flexio_spi_slave_handle_t structure to store the transfer state. param callback The callback function. param userData The parameter of the callback function. retval kStatus_Success Successfully create the handle. retval kStatus_OutOfRan...
status_t FLEXIO_SPI_SlaveTransferCreateHandle(FLEXIO_SPI_Type *base, flexio_spi_slave_handle_t *handle, flexio_spi_slave_transfer_callback_t callback, void *userData)
/* param base Pointer to the FLEXIO_SPI_Type structure. param handle Pointer to the flexio_spi_slave_handle_t structure to store the transfer state. param callback The callback function. param userData The parameter of the callback function. retval kStatus_Success Successfully create the handle. retval kStatus_OutOfRan...
{ assert(handle != NULL); IRQn_Type flexio_irqs[] = FLEXIO_IRQS; (void)memset(handle, 0, sizeof(*handle)); handle->callback = callback; handle->userData = userData; (void)EnableIRQ(flexio_irqs[FLEXIO_SPI_GetInstance(base)]); return FLEXIO_RegisterHandleIRQ(base, handle, FLEXIO_SPI_SlaveTrans...
eclipse-threadx/getting-started
C++
Other
310
/* Sets a Stall condition on an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
/* Sets a Stall condition on an endpoint of the Low Level Driver. */ USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
{ HAL_PCD_EP_SetStall(pdev->pData, ep_addr); return USBD_OK; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Set the packet wait bound timer for this driver/device. The device must be stopped before setting the timer value. The packet wait bound is used during interrupt coalescing to trigger an interrupt when not enough packets have been received to reach the packet count threshold. A packet is a generic term used by the s...
XStatus XEmac_SetPktWaitBound(XEmac *InstancePtr, u32 Direction, u32 TimerValue)
/* Set the packet wait bound timer for this driver/device. The device must be stopped before setting the timer value. The packet wait bound is used during interrupt coalescing to trigger an interrupt when not enough packets have been received to reach the packet count threshold. A packet is a generic term used by the s...
{ XASSERT_NONVOID(InstancePtr != NULL); XASSERT_NONVOID(Direction == XEM_SEND || Direction == XEM_RECV); XASSERT_NONVOID(TimerValue <= XEM_SGDMA_MAX_WAITBOUND); XASSERT_NONVOID(InstancePtr->IsReady == XCOMPONENT_IS_READY); if (!XEmac_mIsSgDma(InstancePtr)) { return XST_NOT_SGDMA; } if (InstancePtr->IsStarted =...
EmcraftSystems/u-boot
C++
Other
181
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
/* UART MSP Initialization This function configures the hardware resources used in this example. */ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(huart->Instance==USART3) { __HAL_RCC_USART3_CLK_ENABLE(); __HAL_RCC_GPIOD_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_F...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Converts a text device path node to USB device firmware update device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbDeviceFirmwareUpdate(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to USB device firmware update device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbDeviceFirmwareUpdate(IN CHAR16 *TextDeviceNode)
{ USB_CLASS_TEXT UsbClassText; UsbClassText.ClassExist = FALSE; UsbClassText.Class = USB_CLASS_RESERVE; UsbClassText.SubClassExist = FALSE; UsbClassText.SubClass = USB_SUBCLASS_FW_UPDATE; return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); }
tianocore/edk2
C++
Other
4,240