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
/* simple_strtoul just ignores the successive invalid characters and return the converted value of prefix part of the string. */
int strict_strtoul(const char *cp, unsigned int base, unsigned long *res)
/* simple_strtoul just ignores the successive invalid characters and return the converted value of prefix part of the string. */ int strict_strtoul(const char *cp, unsigned int base, unsigned long *res)
{ char *tail; unsigned long val; size_t len; *res = 0; len = strlen(cp); if (len == 0) return -EINVAL; val = simple_strtoul(cp, &tail, base); if (tail == cp) return -EINVAL; if ((*tail == '\0') || ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) { *res = val; return 0; } return -EINVAL; }
robutest/uclinux
C++
GPL-2.0
60
/* The MFPGT timers on the CS5536 provide us with suitable timers to use as clock event sources - not as good as a HPET or APIC, but certainly better than the PIT. This isn't a general purpose MFGPT driver, but a simplified one designed specifically to act as a clock event source. For full details about the MFGPT, please consult the CS5536 data sheet. */
static void disable_timer(struct cs5535_mfgpt_timer *timer)
/* The MFPGT timers on the CS5536 provide us with suitable timers to use as clock event sources - not as good as a HPET or APIC, but certainly better than the PIT. This isn't a general purpose MFGPT driver, but a simplified one designed specifically to act as a clock event source. For full details about the MFGPT, please consult the CS5536 data sheet. */ static void disable_timer(struct cs5535_mfgpt_timer *timer)
{ cs5535_mfgpt_write(timer, MFGPT_REG_SETUP, (uint16_t) ~MFGPT_SETUP_CNTEN | MFGPT_SETUP_CMP1 | MFGPT_SETUP_CMP2); }
robutest/uclinux
C++
GPL-2.0
60
/* Routine: set_muxconf_regs Description: Setting up the configuration Mux registers specific to the hardware. Many pins need to be moved from protect to primary mode. */
void set_muxconf_regs(void)
/* Routine: set_muxconf_regs Description: Setting up the configuration Mux registers specific to the hardware. Many pins need to be moved from protect to primary mode. */ void set_muxconf_regs(void)
{ MUX_AM3517CRANE(); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Halts the DWC_otg host mode operations in a clean manner. USB transfers are stopped. */
static void _dwc2_hcd_stop(struct usb_hcd *hcd)
/* Halts the DWC_otg host mode operations in a clean manner. USB transfers are stopped. */ static void _dwc2_hcd_stop(struct usb_hcd *hcd)
{ struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd); unsigned long flags; spin_lock_irqsave(&hsotg->lock, flags); dwc2_hcd_stop(hsotg); spin_unlock_irqrestore(&hsotg->lock, flags); usleep_range(1000, 3000); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Output pkt hook. Will call bound ip_vs_app specific function called by ipvs packet handler, assumes previously checked cp!=NULL returns false if it can't handle packet (oom) */
int ip_vs_app_pkt_out(struct ip_vs_conn *cp, struct sk_buff *skb)
/* Output pkt hook. Will call bound ip_vs_app specific function called by ipvs packet handler, assumes previously checked cp!=NULL returns false if it can't handle packet (oom) */ int ip_vs_app_pkt_out(struct ip_vs_conn *cp, struct sk_buff *skb)
{ struct ip_vs_app *app; if ((app = cp->app) == NULL) return 1; if (cp->protocol == IPPROTO_TCP) return app_tcp_pkt_out(cp, skb, app); if (app->pkt_out == NULL) return 1; return app->pkt_out(app, cp, skb, NULL); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Detects if C1E feature supported on current processor. */
BOOLEAN EFIAPI C1eSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
/* Detects if C1E feature supported on current processor. */ BOOLEAN EFIAPI C1eSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
{ return IS_NEHALEM_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel); }
tianocore/edk2
C++
Other
4,240
/* This function will temporarily replace the signal mask of the calling thread with the mask given and then suspends the thread until delivery of an expected signal or a signal whose action is to terminate a process. */
int sigsuspend(const sigset_t *set)
/* This function will temporarily replace the signal mask of the calling thread with the mask given and then suspends the thread until delivery of an expected signal or a signal whose action is to terminate a process. */ int sigsuspend(const sigset_t *set)
{ int ret = 0; sigset_t origin_set; sigset_t suspend_set; siginfo_t info; sigpending(&origin_set); sigprocmask(SIG_BLOCK, set, RT_NULL); sigpending(&suspend_set); ret = rt_signal_wait(&suspend_set, &info, RT_WAITING_FOREVER); sigprocmask(SIG_UNBLOCK, (sigset_t *)0xffffUL, RT_NULL); sigprocmask(SIG_BLOCK, &origin_set, RT_NULL); return ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function returns the uDMA error status. It should be called from within the uDMA error interrupt handler to determine if a uDMA error occurred. */
unsigned long uDMAErrorStatusGet(void)
/* This function returns the uDMA error status. It should be called from within the uDMA error interrupt handler to determine if a uDMA error occurred. */ unsigned long uDMAErrorStatusGet(void)
{ return(HWREG(UDMA_ERRCLR)); }
watterott/WebRadio
C++
null
71
/* Add the ISO639-2 and RFC4646 component name both for the Serial IO device */
VOID AddName(IN SERIAL_DEV *SerialDevice, IN UINT32 Instance)
/* Add the ISO639-2 and RFC4646 component name both for the Serial IO device */ VOID AddName(IN SERIAL_DEV *SerialDevice, IN UINT32 Instance)
{ CHAR16 SerialPortName[SERIAL_PORT_NAME_LEN]; UnicodeSPrint ( SerialPortName, sizeof (SerialPortName), (SerialDevice->PciDeviceInfo != NULL) ? PCI_SERIAL_PORT_NAME : SIO_SERIAL_PORT_NAME, Instance ); AddUnicodeString2 ( "eng", gPciSioSerialComponentName.SupportedLanguages, &SerialDevice->ControllerNameTable, SerialPortName, TRUE ); AddUnicodeString2 ( "en", gPciSioSerialComponentName2.SupportedLanguages, &SerialDevice->ControllerNameTable, SerialPortName, FALSE ); }
tianocore/edk2
C++
Other
4,240
/* onenand_get_2x_blockpage - Get blockpage at 2x program mode */
static int onenand_get_2x_blockpage(struct mtd_info *mtd, loff_t addr)
/* onenand_get_2x_blockpage - Get blockpage at 2x program mode */ static int onenand_get_2x_blockpage(struct mtd_info *mtd, loff_t addr)
{ struct onenand_chip *this = mtd->priv; int blockpage, block, page; block = (int) (addr >> this->erase_shift) & ~1; if (addr & this->writesize) block++; page = (int) (addr >> (this->page_shift + 1)) & this->page_mask; blockpage = (block << 7) | page; return blockpage; }
EmcraftSystems/u-boot
C++
Other
181
/* Set the Length of ADC Converter Regular and Injected Conversion Sequence. */
void ADCConverLenSet(unsigned long ulBase, unsigned long ulSeqRegLen, unsigned long ulSeqInjLen)
/* Set the Length of ADC Converter Regular and Injected Conversion Sequence. */ void ADCConverLenSet(unsigned long ulBase, unsigned long ulSeqRegLen, unsigned long ulSeqInjLen)
{ xASSERT((ulBase == ADC1_BASE) || (ulBase == ADC2_BASE) || (ulBase == ADC3_BASE)); xASSERT((ulSeqRegLen > 0) && (ulSeqRegLen < 17)); xASSERT((ulSeqInjLen > 0) && (ulSeqInjLen < 5)); xHWREG(ulBase + ADC_SRQ1) &= ~ADC_SQR1_LEN_M; xHWREG(ulBase + ADC_SRQ1) |= ((ulSeqRegLen - 1)<<ADC_SQR1_LEN_S); xHWREG(ulBase + ADC_JSQR) &= ~ADC_JSQR_LEN_M; xHWREG(ulBase + ADC_JSQR) |= ((ulSeqInjLen - 1)<<ADC_JSQR_LEN_S); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Function called from device_id.c after sense id has completed. */
void ccw_device_sense_id_done(struct ccw_device *cdev, int err)
/* Function called from device_id.c after sense id has completed. */ void ccw_device_sense_id_done(struct ccw_device *cdev, int err)
{ switch (err) { case 0: ccw_device_recog_done(cdev, DEV_STATE_OFFLINE); break; case -ETIME: ccw_device_recog_done(cdev, DEV_STATE_BOXED); break; default: ccw_device_recog_done(cdev, DEV_STATE_NOT_OPER); break; } }
robutest/uclinux
C++
GPL-2.0
60
/* Update the current command size vector. Load the pointer to the list of recognized CLI commands sizes. */
void cli_load_command_sizes(struct cli_desc *dev, uint8_t *command_sizes)
/* Update the current command size vector. Load the pointer to the list of recognized CLI commands sizes. */ void cli_load_command_sizes(struct cli_desc *dev, uint8_t *command_sizes)
{ dev->command_size = command_sizes; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Configure the mode of the RSTC peripheral. The configuration is computed by the lib (AT91C_RSTC_*). */
void RSTC_ConfigureMode(AT91PS_RSTC rstc, unsigned int rmr)
/* Configure the mode of the RSTC peripheral. The configuration is computed by the lib (AT91C_RSTC_*). */ void RSTC_ConfigureMode(AT91PS_RSTC rstc, unsigned int rmr)
{ rmr &= ~AT91C_RSTC_KEY; WRITE_RSTC(rstc, RSTC_RMR, rmr | RSTC_KEY_PASSWORD); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* 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 NumberOfEnabledProcessors, and EFI_SUCCESS is returned. */
EFI_STATUS EFIAPI GetNumberOfProcessors(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 NumberOfEnabledProcessors, and EFI_SUCCESS is returned. */ EFI_STATUS EFIAPI GetNumberOfProcessors(IN EFI_MP_SERVICES_PROTOCOL *This, OUT UINTN *NumberOfProcessors, OUT UINTN *NumberOfEnabledProcessors)
{ if ((NumberOfProcessors == NULL) || (NumberOfEnabledProcessors == NULL)) { return EFI_INVALID_PARAMETER; } return MpInitLibGetNumberOfProcessors ( NumberOfProcessors, NumberOfEnabledProcessors ); }
tianocore/edk2
C++
Other
4,240
/* param handle codec handle. param module audio codec module. param powerOn true is power on, false is power down. return kStatus_Success is success, else configure failed. */
status_t CODEC_SetPower(codec_handle_t *handle, codec_module_t module, bool powerOn)
/* param handle codec handle. param module audio codec module. param powerOn true is power on, false is power down. return kStatus_Success is success, else configure failed. */ status_t CODEC_SetPower(codec_handle_t *handle, codec_module_t module, bool powerOn)
{ assert((handle != NULL) && (handle->codecConfig != NULL)); assert(handle->codecCapability != NULL); if ((handle->codecCapability->codecModuleCapability & (1U << module)) == 0U) { return kStatus_CODEC_NotSupport; } return HAL_CODEC_SetPower(handle, (uint32_t)module, powerOn); }
eclipse-threadx/getting-started
C++
Other
310
/* All flags specified in @flags are set, the remainder is left untouched. Returns: %0 on success, -EINVAL if an invalid flag combination would ensue. */
int ccw_device_set_options(struct ccw_device *cdev, unsigned long flags)
/* All flags specified in @flags are set, the remainder is left untouched. Returns: %0 on success, -EINVAL if an invalid flag combination would ensue. */ int ccw_device_set_options(struct ccw_device *cdev, unsigned long flags)
{ if (((flags & CCWDEV_EARLY_NOTIFICATION) && (flags & CCWDEV_REPORT_ALL)) || ((flags & CCWDEV_EARLY_NOTIFICATION) && cdev->private->options.repall) || ((flags & CCWDEV_REPORT_ALL) && cdev->private->options.fast)) return -EINVAL; cdev->private->options.fast |= (flags & CCWDEV_EARLY_NOTIFICATION) != 0; cdev->private->options.repall |= (flags & CCWDEV_REPORT_ALL) != 0; cdev->private->options.pgroup |= (flags & CCWDEV_DO_PATHGROUP) != 0; cdev->private->options.force |= (flags & CCWDEV_ALLOW_FORCE) != 0; cdev->private->options.mpath |= (flags & CCWDEV_DO_MULTIPATH) != 0; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function registers and enables the handler specified by InterruptHandler for a processor interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the handler for the processor interrupt or exception type specified by InterruptType is uninstalled. The installed handler is called once for each processor interrupt or exception. NOTE: This function should be invoked after */
EFI_STATUS EFIAPI RegisterCpuInterruptHandler(IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler)
/* This function registers and enables the handler specified by InterruptHandler for a processor interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the handler for the processor interrupt or exception type specified by InterruptType is uninstalled. The installed handler is called once for each processor interrupt or exception. NOTE: This function should be invoked after */ EFI_STATUS EFIAPI RegisterCpuInterruptHandler(IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler)
{ EXCEPTION_HANDLER_DATA *ExceptionHandlerData; ExceptionHandlerData = GetExceptionHandlerData (); return RegisterCpuInterruptHandlerWorker (InterruptType, InterruptHandler, ExceptionHandlerData); }
tianocore/edk2
C++
Other
4,240
/* Data transfer to the camera DMA starts from next starting frame. */
static void omap24xxcam_core_enable(const struct omap24xxcam_device *cam)
/* Data transfer to the camera DMA starts from next starting frame. */ static void omap24xxcam_core_enable(const struct omap24xxcam_device *cam)
{ omap24xxcam_reg_out(cam->mmio_base + CC_REG_OFFSET, CC_CTRL, cam->cc_ctrl); }
robutest/uclinux
C++
GPL-2.0
60
/* This is called on a life CPU, when a CPU is dead. So we cannot access the hardware device itself. We just set the mode and remove it from the lists. */
static void tick_shutdown(unsigned int *cpup)
/* This is called on a life CPU, when a CPU is dead. So we cannot access the hardware device itself. We just set the mode and remove it from the lists. */ static void tick_shutdown(unsigned int *cpup)
{ struct tick_device *td = &per_cpu(tick_cpu_device, *cpup); struct clock_event_device *dev = td->evtdev; unsigned long flags; raw_spin_lock_irqsave(&tick_device_lock, flags); td->mode = TICKDEV_MODE_PERIODIC; if (dev) { dev->mode = CLOCK_EVT_MODE_UNUSED; clockevents_exchange_device(dev, NULL); td->evtdev = NULL; } raw_spin_unlock_irqrestore(&tick_device_lock, flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Request the PE to send a VDM discovery identity. */
USBPD_StatusTypeDef USBPD_DPM_RequestVDM_DiscoveryIdentify(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType)
/* Request the PE to send a VDM discovery identity. */ USBPD_StatusTypeDef USBPD_DPM_RequestVDM_DiscoveryIdentify(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType)
{ return USBPD_PE_SVDM_RequestIdentity(PortNum, SOPType); }
st-one/X-CUBE-USB-PD
C++
null
110
/* Function for parsing bytes received on the UART until SLIP end byte is received. */
static void handle_rx_byte_wait_start(uint8_t byte)
/* Function for parsing bytes received on the UART until SLIP end byte is received. */ static void handle_rx_byte_wait_start(uint8_t byte)
{ if (byte == APP_SLIP_END) { handle_rx_byte = handle_rx_byte_default; } }
labapart/polymcu
C++
null
201
/* Takes s->dstptr to the next macroblock in sequence. */
static void yop_next_macroblock(YopDecContext *s)
/* Takes s->dstptr to the next macroblock in sequence. */ static void yop_next_macroblock(YopDecContext *s)
{ if (s->row_pos == s->frame.linesize[0] - 2) { s->dstptr += s->frame.linesize[0]; s->row_pos = 0; }else { s->row_pos += 2; } s->dstptr += 2; }
DC-SWAT/DreamShell
C++
null
404
/* RETURN: MV_NOT_ALLOWED in case PEX interface is PEX-X. MV_BAD_PARAM on bad parameters , otherwise MV_OK */
int pex_local_dev_num_set(u32 pex_if, u32 dev_num)
/* RETURN: MV_NOT_ALLOWED in case PEX interface is PEX-X. MV_BAD_PARAM on bad parameters , otherwise MV_OK */ int pex_local_dev_num_set(u32 pex_if, u32 dev_num)
{ u32 val; if (pex_if >= MV_PEX_MAX_IF) return MV_BAD_PARAM; val = reg_read(PEX_STATUS_REG(pex_if)); val &= ~PXSR_PEX_DEV_NUM_MASK; val |= (dev_num << PXSR_PEX_DEV_NUM_OFFS) & PXSR_PEX_DEV_NUM_MASK; reg_write(PEX_STATUS_REG(pex_if), val); return MV_OK; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Set the EINT peripheral registers to their default reset values. */
void EINT_Reset(void)
/* Set the EINT peripheral registers to their default reset values. */ void EINT_Reset(void)
{ EINT->IMASK = EINT_INTMASK_RESET_VALUE; EINT->EMASK = EINT_EVTMASK_RESET_VALUE; EINT->RTEN = EINT_RTSEL_RESET_VALUE; EINT->FTEN = EINT_FTSEL_RESET_VALUE; EINT->IPEND = EINT_PEND_RESET_VALUE; }
pikasTech/PikaPython
C++
MIT License
1,403
/* This function attempts to find an untaken index LEB with the most free and dirty space that can be used without overwriting index nodes that were in the last index committed. */
int ubifs_find_dirty_idx_leb(struct ubifs_info *c)
/* This function attempts to find an untaken index LEB with the most free and dirty space that can be used without overwriting index nodes that were in the last index committed. */ int ubifs_find_dirty_idx_leb(struct ubifs_info *c)
{ int err; ubifs_get_lprops(c); err = find_dirtiest_idx_leb(c); if (err == -ENOSPC) err = find_dirty_idx_leb(c); if (err == -ENOSPC) err = get_idx_gc_leb(c); ubifs_release_lprops(c); return err; }
robutest/uclinux
C++
GPL-2.0
60
/* The ISA IRQ number is found in bits 2 and 3 of the CfgLsw. It decodes as: 00: 10 01: 11 10: 12 11: 15 */
static unsigned int __devinit advansys_isa_irq_no(PortAddr iop_base)
/* The ISA IRQ number is found in bits 2 and 3 of the CfgLsw. It decodes as: 00: 10 01: 11 10: 12 11: 15 */ static unsigned int __devinit advansys_isa_irq_no(PortAddr iop_base)
{ unsigned short cfg_lsw = AscGetChipCfgLsw(iop_base); unsigned int chip_irq = ((cfg_lsw >> 2) & 0x03) + 10; if (chip_irq == 13) chip_irq = 15; return chip_irq; }
robutest/uclinux
C++
GPL-2.0
60
/* Search for an interface by index. Returns NULL if the device is not found or a pointer to the device. The device returned has had a reference added and the pointer is safe until the user calls dev_put to indicate they have finished with it. */
struct net_device* dev_get_by_index(struct net *net, int ifindex)
/* Search for an interface by index. Returns NULL if the device is not found or a pointer to the device. The device returned has had a reference added and the pointer is safe until the user calls dev_put to indicate they have finished with it. */ struct net_device* dev_get_by_index(struct net *net, int ifindex)
{ struct net_device *dev; rcu_read_lock(); dev = dev_get_by_index_rcu(net, ifindex); if (dev) dev_hold(dev); rcu_read_unlock(); return dev; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void)
/* Event handler for the library USB Control Request reception event. */ void EVENT_USB_Device_ControlRequest(void)
{ MIDI_Device_ProcessControlRequest(&Keyboard_MIDI_Interface); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Gets a data element from the SPI interface with block. */
void xSPIDataGet(unsigned long ulBase, unsigned long *pulData)
/* Gets a data element from the SPI interface with block. */ void xSPIDataGet(unsigned long ulBase, unsigned long *pulData)
{ unsigned char ucBitLength = xSPIBitLengthGet(ulBase); xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) || (ulBase == SPI3_BASE)); while((xHWREG(ulBase + SPI_STATUS) & SPI_STATUS_BUSY)) { } if (ucBitLength <= 8) { *pulData = xHWREG(ulBase + SPI_RX) & 0xFF; } else if(ucBitLength <= 16) { *pulData = xHWREG(ulBase + SPI_RX) & 0xFFFF; } else { *pulData = xHWREG(ulBase + SPI_RX); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Return with a pointer to the active screen */
lv_obj_t* lv_disp_get_scr_act(lv_disp_t *disp)
/* Return with a pointer to the active screen */ lv_obj_t* lv_disp_get_scr_act(lv_disp_t *disp)
{ if(!disp) disp = lv_disp_get_default(); if(!disp) { LV_LOG_WARN("no display registered to get its active screen"); return NULL; } return disp->act_scr; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Like insl but in the opposite direction. This is used by the IDE driver to write disk sectors. Works with any alignment in SRC. Performance is important, but the interfaces seems to be slow: just using the inlined version of the outl() breaks things. */
void iowrite32_rep(void __iomem *port, const void *src, unsigned long count)
/* Like insl but in the opposite direction. This is used by the IDE driver to write disk sectors. Works with any alignment in SRC. Performance is important, but the interfaces seems to be slow: just using the inlined version of the outl() breaks things. */ void iowrite32_rep(void __iomem *port, const void *src, unsigned long count)
{ if (unlikely((unsigned long)src & 0x3)) { while (count--) { struct S { int x __attribute__((packed)); }; iowrite32(((struct S *)src)->x, port); src += 4; } } else { while (count--) { iowrite32(*(unsigned int *)src, port); src += 4; } } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* SATA related function to get the PHY source clock. */
void sata_get_phy_src_clk(sata_phy_ref_clk_t *phy_ref_clk)
/* SATA related function to get the PHY source clock. */ void sata_get_phy_src_clk(sata_phy_ref_clk_t *phy_ref_clk)
{ *phy_ref_clk = CCM_PLL_ENET; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Change Logs: Date Author Notes tyx first implementation */
int main(void)
/* Change Logs: Date Author Notes tyx first implementation */ int main(void)
{ rt_wlan_set_mode(RT_WLAN_DEVICE_STA_NAME, RT_WLAN_STATION); rt_wlan_set_mode(RT_WLAN_DEVICE_AP_NAME, RT_WLAN_AP); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* compresses a vine/tree stage into a more balanced vine/tree */
IX_ETH_DB_PRIVATE void ixEthDBRebalanceCompression(MacTreeNode *root, UINT32 count)
/* compresses a vine/tree stage into a more balanced vine/tree */ IX_ETH_DB_PRIVATE void ixEthDBRebalanceCompression(MacTreeNode *root, UINT32 count)
{ MacTreeNode *scanner = root; MacTreeNode *child; UINT32 local_index; for (local_index = 0 ; local_index < count ; local_index++) { child = scanner->right; scanner->right = child->right; scanner = scanner->right; child->right = scanner->left; scanner->left = child; } }
EmcraftSystems/u-boot
C++
Other
181
/* spider_net_disable_rxdmac terminates processing on the DMA controller by turing off the DMA controller, with the force-end flag set. */
static void spider_net_disable_rxdmac(struct spider_net_card *card)
/* spider_net_disable_rxdmac terminates processing on the DMA controller by turing off the DMA controller, with the force-end flag set. */ static void spider_net_disable_rxdmac(struct spider_net_card *card)
{ spider_net_write_reg(card, SPIDER_NET_GDADMACCNTR, SPIDER_NET_DMA_RX_FEND_VALUE); }
robutest/uclinux
C++
GPL-2.0
60
/* Process some data in the one-pass (strip buffer) case. This is used for color precision reduction as well as one-pass quantization. */
post_process_1pass(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
/* Process some data in the one-pass (strip buffer) case. This is used for color precision reduction as well as one-pass quantization. */ post_process_1pass(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
{ my_post_ptr post = (my_post_ptr)cinfo->post; JDIMENSION num_rows, max_rows; max_rows = out_rows_avail - *out_row_ctr; if (max_rows > post->strip_height) max_rows = post->strip_height; num_rows = 0; (*cinfo->upsample->upsample) (cinfo, input_buf, in_row_group_ctr, in_row_groups_avail, post->buffer, &num_rows, max_rows); (*cinfo->cquantize->color_quantize) (cinfo, post->buffer, output_buf + *out_row_ctr, (int)num_rows); *out_row_ctr += num_rows; }
nanoframework/nf-interpreter
C++
MIT License
293
/* This function is mainly a wrapper around driver_unregister(). */
void ccwgroup_driver_unregister(struct ccwgroup_driver *cdriver)
/* This function is mainly a wrapper around driver_unregister(). */ void ccwgroup_driver_unregister(struct ccwgroup_driver *cdriver)
{ struct device *dev; get_driver(&cdriver->driver); while ((dev = driver_find_device(&cdriver->driver, NULL, NULL, __ccwgroup_match_all))) { struct ccwgroup_device *gdev = to_ccwgroupdev(dev); mutex_lock(&gdev->reg_mutex); __ccwgroup_remove_symlinks(gdev); device_unregister(dev); mutex_unlock(&gdev->reg_mutex); put_device(dev); } put_driver(&cdriver->driver); driver_unregister(&cdriver->driver); }
robutest/uclinux
C++
GPL-2.0
60
/* Sets the bit in the multicast table corresponding to the hash value. hw - Struct containing variables accessed by shared code hash_value - Multicast address hash value */
void atl1c_hash_set(struct atl1c_hw *hw, u32 hash_value)
/* Sets the bit in the multicast table corresponding to the hash value. hw - Struct containing variables accessed by shared code hash_value - Multicast address hash value */ void atl1c_hash_set(struct atl1c_hw *hw, u32 hash_value)
{ u32 hash_bit, hash_reg; u32 mta; hash_reg = (hash_value >> 31) & 0x1; hash_bit = (hash_value >> 26) & 0x1F; mta = AT_READ_REG_ARRAY(hw, REG_RX_HASH_TABLE, hash_reg); mta |= (1 << hash_bit); AT_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, hash_reg, mta); }
robutest/uclinux
C++
GPL-2.0
60
/* Purpose: Let user call ioctl() to get info when the UART physically is emptied. On bus types like RS485, the transmitter must release the bus after transmitting. This must be done when the transmit shift register is empty, not be done when the transmit holding register is empty. This functionality allows an RS485 driver to be written in user space. */
static int get_lsr_info(struct tty_struct *tty, struct moschip_port *mos7720_port, unsigned int __user *value)
/* Purpose: Let user call ioctl() to get info when the UART physically is emptied. On bus types like RS485, the transmitter must release the bus after transmitting. This must be done when the transmit shift register is empty, not be done when the transmit holding register is empty. This functionality allows an RS485 driver to be written in user space. */ static int get_lsr_info(struct tty_struct *tty, struct moschip_port *mos7720_port, unsigned int __user *value)
{ struct usb_serial_port *port = tty->driver_data; unsigned int result = 0; unsigned char data = 0; int port_number = port->number - port->serial->minor; int count; count = mos7720_chars_in_buffer(tty); if (count == 0) { send_mos_cmd(port->serial, MOS_READ, port_number, UART_LSR, &data); if ((data & (UART_LSR_TEMT | UART_LSR_THRE)) == (UART_LSR_TEMT | UART_LSR_THRE)) { dbg("%s -- Empty", __func__); result = TIOCSER_TEMT; } } if (copy_to_user(value, &result, sizeof(int))) return -EFAULT; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* FLEXIO CAMERA EDMA receive finished callback function. This function is called when FLEXIO CAMERA EDMA receive finished. It disables the CAMERA RX EDMA request and sends kStatus_FLEXIO_CAMERA_RxIdle to CAMERA callback. */
static void FLEXIO_CAMERA_TransferReceiveEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
/* FLEXIO CAMERA EDMA receive finished callback function. This function is called when FLEXIO CAMERA EDMA receive finished. It disables the CAMERA RX EDMA request and sends kStatus_FLEXIO_CAMERA_RxIdle to CAMERA callback. */ static void FLEXIO_CAMERA_TransferReceiveEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
{ flexio_camera_edma_private_handle_t *cameraPrivateHandle = (flexio_camera_edma_private_handle_t *)param; handle = handle; tcds = tcds; if (transferDone) { FLEXIO_CAMERA_TransferAbortReceiveEDMA(cameraPrivateHandle->base, cameraPrivateHandle->handle); if (cameraPrivateHandle->handle->callback != NULL) { cameraPrivateHandle->handle->callback(cameraPrivateHandle->base, cameraPrivateHandle->handle, kStatus_FLEXIO_CAMERA_RxIdle, cameraPrivateHandle->handle->userData); } } }
eclipse-threadx/getting-started
C++
Other
310
/* De-initializes the Si7210 chip. Disables the sensor power domain, this also disables other sensors. */
void SI7210_deInit(void)
/* De-initializes the Si7210 chip. Disables the sensor power domain, this also disables other sensors. */ void SI7210_deInit(void)
{ GPIOINT_CallbackUnRegister( SI7210_GPIO_PIN_OUT1 ); GPIO_IntConfig( SI7210_GPIO_PORT_OUT1, SI7210_GPIO_PIN_OUT1, false, false, false ); GPIO_PinModeSet( SI7210_GPIO_PORT_OUT1, SI7210_GPIO_PIN_OUT1, gpioModeDisabled, 0 ); BOARD_envSensEnable( false ); }
remotemcu/remcu-chip-sdks
C++
null
436
/* This routine is called to pack an combo_box into an aligment, so that it doesn't expand vertically to fill up the space available to it. */
static GtkWidget* decode_add_pack_combo_box(GtkWidget *combo_box)
/* This routine is called to pack an combo_box into an aligment, so that it doesn't expand vertically to fill up the space available to it. */ static GtkWidget* decode_add_pack_combo_box(GtkWidget *combo_box)
{ GtkWidget *alignment; alignment = gtk_alignment_new(0.0f, 0.5f, 0.0f, 0.0f); gtk_container_add(GTK_CONTAINER(alignment), combo_box); return(alignment); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Validate whether the NextHeader is a known valid protocol or one of the user configured protocols from the upper layer. */
BOOLEAN Ip6IsValidProtocol(IN IP6_SERVICE *IpSb, IN UINT8 NextHeader)
/* Validate whether the NextHeader is a known valid protocol or one of the user configured protocols from the upper layer. */ BOOLEAN Ip6IsValidProtocol(IN IP6_SERVICE *IpSb, IN UINT8 NextHeader)
{ LIST_ENTRY *Entry; IP6_PROTOCOL *IpInstance; if ((NextHeader == EFI_IP_PROTO_TCP) || (NextHeader == EFI_IP_PROTO_UDP) || (NextHeader == IP6_ICMP) || (NextHeader == IP6_ESP) ) { return TRUE; } if (IpSb == NULL) { return FALSE; } if (IpSb->Signature != IP6_SERVICE_SIGNATURE) { return FALSE; } NET_LIST_FOR_EACH (Entry, &IpSb->Children) { IpInstance = NET_LIST_USER_STRUCT_S (Entry, IP6_PROTOCOL, Link, IP6_PROTOCOL_SIGNATURE); if (IpInstance->State == IP6_STATE_CONFIGED) { if (IpInstance->ConfigData.DefaultProtocol == NextHeader) { return TRUE; } } } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* Enables or disables write access to IWDG_PR and IWDG_RLR registers. */
void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess)
/* Enables or disables write access to IWDG_PR and IWDG_RLR registers. */ void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess)
{ assert_param(IS_IWDG_WRITE_ACCESS(IWDG_WriteAccess)); IWDG->KR = IWDG_WriteAccess; }
avem-labs/Avem
C++
MIT License
1,752
/* Change the bus mode (open drain/push-pull) of a host. */
void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode)
/* Change the bus mode (open drain/push-pull) of a host. */ void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode)
{ host->ios.bus_mode = mode; mmc_set_ios(host); }
robutest/uclinux
C++
GPL-2.0
60
/* Called by the TTY driver when there's room for more data. If we have more packets to send, we send them here. */
static void sixpack_write_wakeup(struct tty_struct *tty)
/* Called by the TTY driver when there's room for more data. If we have more packets to send, we send them here. */ static void sixpack_write_wakeup(struct tty_struct *tty)
{ struct sixpack *sp = sp_get(tty); int actual; if (!sp) return; if (sp->xleft <= 0) { sp->dev->stats.tx_packets++; clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); sp->tx_enable = 0; netif_wake_queue(sp->dev); goto out; } if (sp->tx_enable) { actual = tty->ops->write(tty, sp->xhead, sp->xleft); sp->xleft -= actual; sp->xhead += actual; } out: sp_put(sp); }
robutest/uclinux
C++
GPL-2.0
60
/* This function will fill a formatted string to buffer */
rt_int32_t rt_vsprintf(char *buf, const char *format, va_list arg_ptr)
/* This function will fill a formatted string to buffer */ rt_int32_t rt_vsprintf(char *buf, const char *format, va_list arg_ptr)
{ return rt_vsnprintf(buf, (rt_size_t) -1, format, arg_ptr); }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and starts the library USB task to begin the enumeration and USB management process. */
void EVENT_USB_Host_DeviceAttached(void)
/* Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and starts the library USB task to begin the enumeration and USB management process. */ void EVENT_USB_Host_DeviceAttached(void)
{ puts_P(PSTR("Device Attached.\r\n")); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* User-defined threshold value for xl interrupt event on generator 1. LSb = 16mg@2g / 32mg@4g / 62mg@8g / 186mg@16g. */
int32_t lis2dh12_int1_gen_threshold_get(stmdev_ctx_t *ctx, uint8_t *val)
/* User-defined threshold value for xl interrupt event on generator 1. LSb = 16mg@2g / 32mg@4g / 62mg@8g / 186mg@16g. */ int32_t lis2dh12_int1_gen_threshold_get(stmdev_ctx_t *ctx, uint8_t *val)
{ lis2dh12_int1_ths_t int1_ths; int32_t ret; ret = lis2dh12_read_reg(ctx, LIS2DH12_INT1_THS, (uint8_t *)&int1_ths, 1); *val = (uint8_t)int1_ths.ths; return ret; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Returns the version described in the FMP Payload Header. */
EFI_STATUS EFIAPI GetFmpPayloadHeaderVersion(IN CONST VOID *Header, IN CONST UINTN FmpPayloadSize, OUT UINT32 *Version)
/* Returns the version described in the FMP Payload Header. */ EFI_STATUS EFIAPI GetFmpPayloadHeaderVersion(IN CONST VOID *Header, IN CONST UINTN FmpPayloadSize, OUT UINT32 *Version)
{ FMP_PAYLOAD_HEADER *FmpPayloadHeader; FmpPayloadHeader = NULL; if ((Header == NULL) || (Version == NULL)) { return EFI_INVALID_PARAMETER; } FmpPayloadHeader = (FMP_PAYLOAD_HEADER *)Header; if (((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) < (UINTN)FmpPayloadHeader) || ((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) >= (UINTN)FmpPayloadHeader + FmpPayloadSize) || (FmpPayloadHeader->HeaderSize < sizeof (FMP_PAYLOAD_HEADER))) { return EFI_INVALID_PARAMETER; } if (FmpPayloadHeader->Signature != FMP_PAYLOAD_HEADER_SIGNATURE) { return EFI_INVALID_PARAMETER; } *Version = FmpPayloadHeader->FwVersion; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Suspend/Resume support disable suspend until real resume implemented */
static int amd_iommu_resume(struct sys_device *dev)
/* Suspend/Resume support disable suspend until real resume implemented */ static int amd_iommu_resume(struct sys_device *dev)
{ enable_iommus(); amd_iommu_flush_all_devices(); amd_iommu_flush_all_domains(); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Note: The SP805 Watchdog Timer supports locking of its registers, i.e. it inhibits all writes to avoid rogue software accidentally corrupting their contents. */
STATIC VOID SP805Lock(VOID)
/* Note: The SP805 Watchdog Timer supports locking of its registers, i.e. it inhibits all writes to avoid rogue software accidentally corrupting their contents. */ STATIC VOID SP805Lock(VOID)
{ if (MmioRead32 (SP805_WDOG_LOCK_REG) == SP805_WDOG_LOCK_IS_UNLOCKED) { MmioWrite32 (SP805_WDOG_LOCK_REG, SP805_WDOG_LOCK_IS_LOCKED); } }
tianocore/edk2
C++
Other
4,240
/* i is 9.23 fixed point, other differences are 4.28 fixed point. */
static void fd_fixed(double d[4], int32_t i[4])
/* i is 9.23 fixed point, other differences are 4.28 fixed point. */ static void fd_fixed(double d[4], int32_t i[4])
{ i[0] = _cairo_fixed_16_16_from_double (256 * 2 * d[0]); i[1] = _cairo_fixed_16_16_from_double (256 * 16 * d[1]); i[2] = _cairo_fixed_16_16_from_double (256 * 16 * d[2]); i[3] = _cairo_fixed_16_16_from_double (256 * 16 * d[3]); }
xboot/xboot
C++
MIT License
779
/* Reads NumberOfBytes data bytes from a serial device into the buffer specified by Buffer. The number of bytes actually read is returned. If Buffer is NULL, then ASSERT(). If NumberOfBytes is zero, then return 0. */
UINTN EFIAPI SerialPortRead(OUT UINT8 *Buffer, IN UINTN NumberOfBytes)
/* Reads NumberOfBytes data bytes from a serial device into the buffer specified by Buffer. The number of bytes actually read is returned. If Buffer is NULL, then ASSERT(). If NumberOfBytes is zero, then return 0. */ UINTN EFIAPI SerialPortRead(OUT UINT8 *Buffer, IN UINTN NumberOfBytes)
{ XENCONS_RING_IDX Consumer, Producer; UINTN Received; ASSERT (Buffer != NULL); if (NumberOfBytes == 0) { return 0; } if (!mXenConsoleInterface) { return 0; } Consumer = mXenConsoleInterface->in_cons; Producer = mXenConsoleInterface->in_prod; MemoryFence (); Received = 0; while (Received < NumberOfBytes && Consumer < Producer) { Buffer[Received++] = mXenConsoleInterface->in[MASK_XENCONS_IDX (Consumer++, mXenConsoleInterface->in)]; } MemoryFence (); mXenConsoleInterface->in_cons = Consumer; XenHypercallEventChannelOp (EVTCHNOP_send, &mXenConsoleEventChain); return Received; }
tianocore/edk2
C++
Other
4,240
/* Finds image given hash of the image. Returns the slot number image is in, or -1 if not found. */
int img_mgmt_find_by_hash(uint8_t *find, struct image_version *ver)
/* Finds image given hash of the image. Returns the slot number image is in, or -1 if not found. */ int img_mgmt_find_by_hash(uint8_t *find, struct image_version *ver)
{ int i; uint8_t hash[IMAGE_HASH_LEN]; for (i = 0; i < 2 * CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER; i++) { if (img_mgmt_read_info(i, ver, hash, NULL) != 0) { continue; } if (!memcmp(hash, find, IMAGE_HASH_LEN)) { return i; } } return -1; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* kill the AFS mountpoint timer if it's still running */
void afs_mntpt_kill_timer(void)
/* kill the AFS mountpoint timer if it's still running */ void afs_mntpt_kill_timer(void)
{ _enter(""); ASSERT(list_empty(&afs_vfsmounts)); cancel_delayed_work(&afs_mntpt_expiry_timer); flush_scheduled_work(); }
robutest/uclinux
C++
GPL-2.0
60
/* CT waits for fBUFOUT = 1 then copies the message clears the flag and prints */
void ct(void *p1, void *p2, void *p3)
/* CT waits for fBUFOUT = 1 then copies the message clears the flag and prints */ void ct(void *p1, void *p2, void *p3)
{ ARG_UNUSED(p1); ARG_UNUSED(p2); ARG_UNUSED(p3); char tbuf[60]; while (1) { k_sem_take(&allforone, K_FOREVER); if (fBUFOUT == 1) { printk("CT Thread Received Message\n"); memset((void *)&tbuf, 0, sizeof(tbuf)); memcpy((void *)&tbuf, (void *)BUFOUT, SAMP_BLOCKSIZE); fBUFOUT = 0; printk("CT MSG: %s\n", (char *)&tbuf); } k_sem_give(&allforone); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Check whether the journal uses all of a given set of features. Return true (non-zero) if it does. */
int jbd2_journal_check_used_features(journal_t *journal, unsigned long compat, unsigned long ro, unsigned long incompat)
/* Check whether the journal uses all of a given set of features. Return true (non-zero) if it does. */ int jbd2_journal_check_used_features(journal_t *journal, unsigned long compat, unsigned long ro, unsigned long incompat)
{ journal_superblock_t *sb; if (!compat && !ro && !incompat) return 1; if (journal->j_format_version == 1) return 0; sb = journal->j_superblock; if (((be32_to_cpu(sb->s_feature_compat) & compat) == compat) && ((be32_to_cpu(sb->s_feature_ro_compat) & ro) == ro) && ((be32_to_cpu(sb->s_feature_incompat) & incompat) == incompat)) return 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Interrupt on "pin change" from switch to do wakeup on USB Callback running when USB Host enable mouse interface. Note: This interrupt is enable when the USB host enable remotewakeup feature This interrupt wakeup the CPU if this one is in idle mode */
ISR(PORTB_INT0_vect)
/* Interrupt on "pin change" from switch to do wakeup on USB Callback running when USB Host enable mouse interface. Note: This interrupt is enable when the USB host enable remotewakeup feature This interrupt wakeup the CPU if this one is in idle mode */ ISR(PORTB_INT0_vect)
{ PORT_t *port; port = ioport_pin_to_port(GPIO_PUSH_BUTTON_0); port->INTFLAGS = 0x01; udc_remotewakeup(); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Function: void queue_initialise (Queue_t *queue) Purpose : initialise a queue Params : queue - queue to initialise */
int queue_initialise(Queue_t *queue)
/* Function: void queue_initialise (Queue_t *queue) Purpose : initialise a queue Params : queue - queue to initialise */ int queue_initialise(Queue_t *queue)
{ unsigned int nqueues = NR_QE; QE_t *q; spin_lock_init(&queue->queue_lock); INIT_LIST_HEAD(&queue->head); INIT_LIST_HEAD(&queue->free); queue->alloc = q = kmalloc(sizeof(QE_t) * nqueues, GFP_KERNEL); if (q) { for (; nqueues; q++, nqueues--) { SET_MAGIC(q, QUEUE_MAGIC_FREE); q->SCpnt = NULL; list_add(&q->list, &queue->free); } } return queue->alloc != NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Adjusts the Internal High Speed oscillator for ADC (HSI14) calibration value. */
void RCC_AdjustHSI14CalibrationValue(uint8_t HSI14CalibrationValue)
/* Adjusts the Internal High Speed oscillator for ADC (HSI14) calibration value. */ void RCC_AdjustHSI14CalibrationValue(uint8_t HSI14CalibrationValue)
{ uint32_t tmpreg = 0; assert_param(IS_RCC_HSI14_CALIBRATION_VALUE(HSI14CalibrationValue)); tmpreg = RCC->CR2; tmpreg &= ~RCC_CR2_HSI14TRIM; tmpreg |= (uint32_t)HSI14CalibrationValue << 3; RCC->CR2 = tmpreg; }
ajhc/demo-cortex-m3
C++
null
38
/* Unsharing of tasks created with CLONE_THREAD is not supported yet */
static int unshare_thread(unsigned long unshare_flags)
/* Unsharing of tasks created with CLONE_THREAD is not supported yet */ static int unshare_thread(unsigned long unshare_flags)
{ if (unshare_flags & CLONE_THREAD) return -EINVAL; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* wait until IRC8M stabilization flag is SET, or IRC8M startup is timeout */
ErrStatus rcu_irc8m_stab_wait(void)
/* wait until IRC8M stabilization flag is SET, or IRC8M startup is timeout */ ErrStatus rcu_irc8m_stab_wait(void)
{ FlagStatus irc8m_stat = RESET; uint32_t stb_cnt = 0; while((RESET == irc8m_stat) && (IRC8M_STARTUP_TIMEOUT != stb_cnt++)){ irc8m_stat = rcu_flag_get(RCU_FLAG_IRC8MSTB); } if(RESET != rcu_flag_get(RCU_FLAG_IRC8MSTB)){ return SUCCESS; }else{ return ERROR; } }
liuxuming/trochili
C++
Apache License 2.0
132
/* 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)
{ size_t i; for (i = 0; i < length; i++) { base->D = data[i]; } }
labapart/polymcu
C++
null
201
/* @twsi: The MVTWSI register structure to use. @byte: The byte to send. @ack_flag: Flag that determines whether the received byte should be acknowledged by the controller or not (sent ACK/NAK). @tick: The duration of a clock cycle at the current I2C speed. */
static int twsi_recv(struct mvtwsi_registers *twsi, u8 *byte, int ack_flag, uint tick)
/* @twsi: The MVTWSI register structure to use. @byte: The byte to send. @ack_flag: Flag that determines whether the received byte should be acknowledged by the controller or not (sent ACK/NAK). @tick: The duration of a clock cycle at the current I2C speed. */ static int twsi_recv(struct mvtwsi_registers *twsi, u8 *byte, int ack_flag, uint tick)
{ int expected_status, status, control; expected_status = ack_flag ? MVTWSI_STATUS_DATA_R_ACK : MVTWSI_STATUS_DATA_R_NAK; control = MVTWSI_CONTROL_TWSIEN; control |= ack_flag == MVTWSI_READ_ACK ? MVTWSI_CONTROL_ACK : 0; writel(control | MVTWSI_CONTROL_CLEAR_IFLG, &twsi->control); status = twsi_wait(twsi, expected_status, tick); if (status == 0) *byte = readl(&twsi->data); return status; }
4ms/stm32mp1-baremetal
C++
Other
137
/* param base Pointer to FLEXIO_UART_Type param handle Pointer to flexio_uart_edma_handle_t structure param count Number of bytes received so far by the non-blocking transaction. retval kStatus_NoTransferInProgress transfer has finished or no transfer in progress. retval kStatus_Success Successfully return the count. */
status_t FLEXIO_UART_TransferGetReceiveCountEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle, size_t *count)
/* param base Pointer to FLEXIO_UART_Type param handle Pointer to flexio_uart_edma_handle_t structure param count Number of bytes received so far by the non-blocking transaction. retval kStatus_NoTransferInProgress transfer has finished or no transfer in progress. retval kStatus_Success Successfully return the count. */ status_t FLEXIO_UART_TransferGetReceiveCountEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle, size_t *count)
{ assert(handle); assert(handle->rxEdmaHandle); assert(count); if (kFLEXIO_UART_RxIdle == handle->rxState) { return kStatus_NoTransferInProgress; } *count = handle->rxDataSizeAll - (uint32_t)handle->nbytes * EDMA_GetRemainingMajorLoopCount(handle->rxEdmaHandle->base, handle->rxEdmaHandle->channel); return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initializes an External Interrupt channel configuration structure to defaults. The default configuration is as follows: */
void extint_chan_get_config_defaults(struct extint_chan_conf *const config)
/* Initializes an External Interrupt channel configuration structure to defaults. The default configuration is as follows: */ void extint_chan_get_config_defaults(struct extint_chan_conf *const config)
{ Assert(config); config->gpio_pin = 0; config->gpio_pin_mux = 0; config->gpio_pin_pull = EXTINT_PULL_UP; config->filter_input_signal = false; config->detection_criteria = EXTINT_DETECT_FALLING; config->enable_async_edge_detection = false; }
memfault/zero-to-main
C++
null
200
/* Dissector for IEEE 802.15.4 packet with an FCS containing a 16-bit CRC value. */
static int dissect_ieee802154(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
/* Dissector for IEEE 802.15.4 packet with an FCS containing a 16-bit CRC value. */ static int dissect_ieee802154(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{ tvbuff_t *new_tvb = dissect_zboss_specific(tvb, pinfo, tree); guint options = 0; if (ieee802154_cc24xx) { options = DISSECT_IEEE802154_OPTION_CC24xx; } if (new_tvb != tvb) { options = (DISSECT_IEEE802154_OPTION_CC24xx | DISSECT_IEEE802154_OPTION_ZBOSS); } dissect_ieee802154_common(new_tvb, pinfo, tree, options); return tvb_captured_length(tvb); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This routine prepares the mailbox command for reading out HBA link status. */
void lpfc_read_lnk_stat(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
/* This routine prepares the mailbox command for reading out HBA link status. */ void lpfc_read_lnk_stat(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
{ MAILBOX_t *mb; mb = &pmb->u.mb; memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); mb->mbxCommand = MBX_READ_LNK_STAT; mb->mbxOwner = OWN_HOST; return; }
robutest/uclinux
C++
GPL-2.0
60
/* Send a XID response PDU to the network layer via a XID INDICATION primitive. */
int llc_sap_action_xid_ind(struct llc_sap *sap, struct sk_buff *skb)
/* Send a XID response PDU to the network layer via a XID INDICATION primitive. */ int llc_sap_action_xid_ind(struct llc_sap *sap, struct sk_buff *skb)
{ llc_sap_rtn_pdu(sap, skb); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* High frequency interface mode selection. If the AHB frequency of the DAC is above 80MHz then this value needs setting to an appropriate value. */
void dac_set_high_frequency_mode(uint32_t dac, uint32_t hfsel)
/* High frequency interface mode selection. If the AHB frequency of the DAC is above 80MHz then this value needs setting to an appropriate value. */ void dac_set_high_frequency_mode(uint32_t dac, uint32_t hfsel)
{ uint32_t reg32 = DAC_MCR(dac); reg32 &= ~(DAC_MCR_HFSEL_MASK << DAC_MCR_HFSEL_SHIFT); reg32 |= hfsel; DAC_MCR(dac) = reg32; } /**@}
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Gets current sub-string from a string list, before return the list header is moved to next sub-string. The sub-string is separated by the specified character. For example, the separator is ',', the string list is "2,0,3", it returns "2", the remain list move to "0,3" */
CHAR16* SplitStr(CHAR16 **List, CHAR16 Separator)
/* Gets current sub-string from a string list, before return the list header is moved to next sub-string. The sub-string is separated by the specified character. For example, the separator is ',', the string list is "2,0,3", it returns "2", the remain list move to "0,3" */ CHAR16* SplitStr(CHAR16 **List, CHAR16 Separator)
{ CHAR16 *Str; CHAR16 *ReturnStr; Str = *List; ReturnStr = Str; if (IS_NULL (*Str)) { return ReturnStr; } while (!IS_NULL (*Str)) { if (*Str == Separator) { break; } Str++; } if (*Str == Separator) { *Str = L'\0'; Str++; } *List = Str; return ReturnStr; }
tianocore/edk2
C++
Other
4,240
/* discard all the volume location records for rmmod */
void afs_vlocation_purge(void)
/* discard all the volume location records for rmmod */ void afs_vlocation_purge(void)
{ afs_vlocation_timeout = 0; spin_lock(&afs_vlocation_updates_lock); list_del_init(&afs_vlocation_updates); spin_unlock(&afs_vlocation_updates_lock); cancel_delayed_work(&afs_vlocation_update); queue_delayed_work(afs_vlocation_update_worker, &afs_vlocation_update, 0); destroy_workqueue(afs_vlocation_update_worker); cancel_delayed_work(&afs_vlocation_reap); schedule_delayed_work(&afs_vlocation_reap, 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Write a data to the slave, when the master have obtained control of the bus, and waiting for all bus transmiton complete.(Write Step2) This function is always used in thread mode. */
unsigned long I2CMasterWriteS2(unsigned long ulBase, unsigned char ucData, xtBoolean bEndTransmition)
/* Write a data to the slave, when the master have obtained control of the bus, and waiting for all bus transmiton complete.(Write Step2) This function is always used in thread mode. */ unsigned long I2CMasterWriteS2(unsigned long ulBase, unsigned char ucData, xtBoolean bEndTransmition)
{ unsigned long ulStatus; xASSERT((ulBase == I2C0_BASE)); I2CMasterWriteRequestS2(ulBase, ucData, xfalse); do { ulStatus = I2CStatusGet(ulBase); if(xHWREG(ulBase + I2C_CSR) & 0x0700) break; } while(!(ulStatus == I2C_MASTER_TX_EMPTY)); if(bEndTransmition) { I2CStopSend(ulBase); } return (ulStatus & (I2C_CSR_ARBLOS | I2C_CSR_RXNACK)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Register the ISR. Use this function to register a ISR to the RAM table. */
void system_register_isr(enum ram_isr_table_index isr_index, uint32_t isr_address)
/* Register the ISR. Use this function to register a ISR to the RAM table. */ void system_register_isr(enum ram_isr_table_index isr_index, uint32_t isr_address)
{ uint32_t *temp; temp = (uint32_t *)(isr_index * 4 + ISR_RAM_MAP_START_ADDRESS); *temp = isr_address; }
memfault/zero-to-main
C++
null
200
/* ADC Configuration normal mode. This function configures ADC as normal mode with below Settings. GLCK for ADC -> GCLK_GENERATOR_1 (8MHz) CLK_ADC -> 512 KHz REFERENCE -> 1/2 VDDANA (1.65V) POSITIVE INPUT -> PA02 NEGATIVE INPUT -> GND */
void configure_adc(void)
/* ADC Configuration normal mode. This function configures ADC as normal mode with below Settings. GLCK for ADC -> GCLK_GENERATOR_1 (8MHz) CLK_ADC -> 512 KHz REFERENCE -> 1/2 VDDANA (1.65V) POSITIVE INPUT -> PA02 NEGATIVE INPUT -> GND */ void configure_adc(void)
{ struct adc_config conf_adc; adc_get_config_defaults(&conf_adc); conf_adc.clock_source = GCLK_GENERATOR_1; conf_adc.reference = ADC_REFERENCE_INTVCC1; conf_adc.clock_prescaler = ADC_CLOCK_PRESCALER_DIV16; conf_adc.positive_input = ADC_POSITIVE_INPUT_PIN0; conf_adc.negative_input = ADC_NEGATIVE_INPUT_GND; adc_init(&adc_instance, ADC, &conf_adc); adc_enable(&adc_instance); }
memfault/zero-to-main
C++
null
200
/* Get a pointer to first element in hashbin, this function must be called before any calls to hashbin_get_next()! */
irda_queue_t* hashbin_get_first(hashbin_t *hashbin)
/* Get a pointer to first element in hashbin, this function must be called before any calls to hashbin_get_next()! */ irda_queue_t* hashbin_get_first(hashbin_t *hashbin)
{ irda_queue_t *entry; int i; IRDA_ASSERT( hashbin != NULL, return NULL;); IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;); if ( hashbin == NULL) return NULL; for ( i = 0; i < HASHBIN_SIZE; i ++ ) { entry = hashbin->hb_queue[ i]; if ( entry) { hashbin->hb_current = entry; return entry; } } return NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function executes the _PS0/_PS3 ACPI method to set the power state. ACPI spec requires _PS0 when IDE power on and _PS3 when power off */
void ata_acpi_set_state(struct ata_port *ap, pm_message_t state)
/* This function executes the _PS0/_PS3 ACPI method to set the power state. ACPI spec requires _PS0 when IDE power on and _PS3 when power off */ void ata_acpi_set_state(struct ata_port *ap, pm_message_t state)
{ struct ata_device *dev; if (!ap->acpi_handle || (ap->flags & ATA_FLAG_ACPI_SATA)) return; if (state.event == PM_EVENT_ON) acpi_bus_set_power(ap->acpi_handle, ACPI_STATE_D0); ata_for_each_dev(dev, &ap->link, ENABLED) { if (dev->acpi_handle) acpi_bus_set_power(dev->acpi_handle, state.event == PM_EVENT_ON ? ACPI_STATE_D0 : ACPI_STATE_D3); } if (state.event != PM_EVENT_ON) acpi_bus_set_power(ap->acpi_handle, ACPI_STATE_D3); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Lookup the device configuration based on the unique device ID. The table EmacConfigTable contains the configuration info for each device in the system. */
XEmac_Config* XEmac_LookupConfig(u16 DeviceId)
/* Lookup the device configuration based on the unique device ID. The table EmacConfigTable contains the configuration info for each device in the system. */ XEmac_Config* XEmac_LookupConfig(u16 DeviceId)
{ XEmac_Config *CfgPtr = NULL; int i; for (i = 0; i < XPAR_XEMAC_NUM_INSTANCES; i++) { if (XEmac_ConfigTable[i].DeviceId == DeviceId) { CfgPtr = &XEmac_ConfigTable[i]; break; } } return CfgPtr; }
EmcraftSystems/u-boot
C++
Other
181
/* After this function is called, the kobject MUST be cleaned up by a call to kobject_put(), not by a call to kfree directly to ensure that all of the memory is cleaned up properly. */
void kobject_init(struct kobject *kobj, struct kobj_type *ktype)
/* After this function is called, the kobject MUST be cleaned up by a call to kobject_put(), not by a call to kfree directly to ensure that all of the memory is cleaned up properly. */ void kobject_init(struct kobject *kobj, struct kobj_type *ktype)
{ char *err_str; if (!kobj) { err_str = "invalid kobject pointer!"; goto error; } if (!ktype) { err_str = "must have a ktype to be initialized properly!\n"; goto error; } if (kobj->state_initialized) { printk(KERN_ERR "kobject (%p): tried to init an initialized " "object, something is seriously wrong.\n", kobj); dump_stack(); } kobject_init_internal(kobj); kobj->ktype = ktype; return; error: printk(KERN_ERR "kobject (%p): %s\n", kobj, err_str); dump_stack(); }
robutest/uclinux
C++
GPL-2.0
60
/* 10.27 Packet Measurement Report coded as the Packet Measurement Report message or the Packet Enhanced Measurement Report message starting with the 6-bit MESSAGE_TYPE (see clause 11 in 3GPP TS 44.060) and ending with the Non-distribution contents (i.e. the RLC/MAC padding bits are not included). The end of the message is padded with 0-bits to the nearest octet boundary. */
static guint16 be_packet_meas_rep(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
/* 10.27 Packet Measurement Report coded as the Packet Measurement Report message or the Packet Enhanced Measurement Report message starting with the 6-bit MESSAGE_TYPE (see clause 11 in 3GPP TS 44.060) and ending with the Non-distribution contents (i.e. the RLC/MAC padding bits are not included). The end of the message is padded with 0-bits to the nearest octet boundary. */ static guint16 be_packet_meas_rep(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
{ proto_tree_add_expert(tree, pinfo, &ei_gsm_a_bssmap_le_not_decoded_yet, tvb, offset, len); return len; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM1) { __HAL_RCC_TIM1_CLK_ENABLE(); } else if(htim_base->Instance==TIM2) { __HAL_RCC_TIM2_CLK_ENABLE(); } else if(htim_base->Instance==TIM3) { __HAL_RCC_TIM3_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* We have to be careful about racing with the incoming path. sock_orphan() sets SOCK_DEAD and we use that as an indicator to the rx path that new messages shouldn't be queued. */
static int rds_release(struct socket *sock)
/* We have to be careful about racing with the incoming path. sock_orphan() sets SOCK_DEAD and we use that as an indicator to the rx path that new messages shouldn't be queued. */ static int rds_release(struct socket *sock)
{ struct sock *sk = sock->sk; struct rds_sock *rs; unsigned long flags; if (sk == NULL) goto out; rs = rds_sk_to_rs(sk); sock_orphan(sk); rds_clear_recv_queue(rs); rds_cong_remove_socket(rs); rds_remove_bound(rs); rds_send_drop_to(rs, NULL); rds_rdma_drop_keys(rs); rds_notify_queue_get(rs, NULL); spin_lock_irqsave(&rds_sock_lock, flags); list_del_init(&rs->rs_item); rds_sock_count--; spin_unlock_irqrestore(&rds_sock_lock, flags); sock->sk = NULL; sock_put(sk); out: return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns: data from the queue or NULL, when no data is received before the timeout. */
gpointer g_async_queue_timeout_pop(GAsyncQueue *queue, guint64 timeout)
/* Returns: data from the queue or NULL, when no data is received before the timeout. */ gpointer g_async_queue_timeout_pop(GAsyncQueue *queue, guint64 timeout)
{ gint64 end_time = g_get_monotonic_time () + timeout; gpointer retval; g_mutex_lock (&queue->mutex); retval = g_async_queue_pop_intern_unlocked (queue, TRUE, end_time); g_mutex_unlock (&queue->mutex); return retval; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* param base ENET peripheral base address. param macAddr The six-byte Mac address pointer. The pointer is allocated by application and input into the API. */
void ENET_SetMacAddr(ENET_Type *base, uint8_t *macAddr)
/* param base ENET peripheral base address. param macAddr The six-byte Mac address pointer. The pointer is allocated by application and input into the API. */ void ENET_SetMacAddr(ENET_Type *base, uint8_t *macAddr)
{ uint32_t address; address = (uint32_t)(((uint32_t)macAddr[0] << 24U) | ((uint32_t)macAddr[1] << 16U) | ((uint32_t)macAddr[2] << 8U) | (uint32_t)macAddr[3]); base->PALR = address; address = (uint32_t)(((uint32_t)macAddr[4] << 8U) | ((uint32_t)macAddr[5])); base->PAUR = address << ENET_PAUR_PADDR2_SHIFT; }
nanoframework/nf-interpreter
C++
MIT License
293
/* LOCKING: the frame_rcvd_lock needs to be held since this parses the frame buffer. */
static void asd_get_attached_sas_addr(struct asd_phy *phy, u8 *sas_addr)
/* LOCKING: the frame_rcvd_lock needs to be held since this parses the frame buffer. */ static void asd_get_attached_sas_addr(struct asd_phy *phy, u8 *sas_addr)
{ if (phy->sas_phy.frame_rcvd[0] == 0x34 && phy->sas_phy.oob_mode == SATA_OOB_MODE) { struct asd_ha_struct *asd_ha = phy->sas_phy.ha->lldd_ha; u64 addr = be64_to_cpu(*(__be64 *)phy->phy_desc->sas_addr); addr += asd_ha->hw_prof.sata_name_base + ord_phy(asd_ha, phy); *(__be64 *)sas_addr = cpu_to_be64(addr); } else { struct sas_identify_frame *idframe = (void *) phy->sas_phy.frame_rcvd; memcpy(sas_addr, idframe->sas_addr, SAS_ADDR_SIZE); } }
robutest/uclinux
C++
GPL-2.0
60
/* Return 1 meaning mf should be freed from _base_interrupt 0 means the mf is freed from this function. */
u8 mpt2sas_base_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
/* Return 1 meaning mf should be freed from _base_interrupt 0 means the mf is freed from this function. */ u8 mpt2sas_base_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
{ MPI2DefaultReply_t *mpi_reply; mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply); if (mpi_reply && mpi_reply->Function == MPI2_FUNCTION_EVENT_ACK) return 1; if (ioc->base_cmds.status == MPT2_CMD_NOT_USED) return 1; ioc->base_cmds.status |= MPT2_CMD_COMPLETE; if (mpi_reply) { ioc->base_cmds.status |= MPT2_CMD_REPLY_VALID; memcpy(ioc->base_cmds.reply, mpi_reply, mpi_reply->MsgLength*4); } ioc->base_cmds.status &= ~MPT2_CMD_PENDING; complete(&ioc->base_cmds.done); return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Event handler for the USB device Start Of Frame event. */
void EVENT_USB_Device_StartOfFrame(void)
/* Event handler for the USB device Start Of Frame event. */ void EVENT_USB_Device_StartOfFrame(void)
{ HID_Device_MillisecondElapsed(&Keyboard_HID_Interface); HID_Device_MillisecondElapsed(&Mouse_HID_Interface); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Return index into pidff_reports for the given usage */
static int pidff_check_usage(int usage)
/* Return index into pidff_reports for the given usage */ static int pidff_check_usage(int usage)
{ int i; for (i = 0; i < sizeof(pidff_reports); i++) if (usage == (HID_UP_PID | pidff_reports[i])) return i; return -1; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the number of characters written to @buf or -1 if an error occurs. */
int XMLCDECL xmlStrPrintf(xmlChar *buf, int len, const xmlChar *msg,...)
/* Returns the number of characters written to @buf or -1 if an error occurs. */ int XMLCDECL xmlStrPrintf(xmlChar *buf, int len, const xmlChar *msg,...)
{ return(-1); } va_start(args, msg); ret = vsnprintf((char *) buf, len, (const char *) msg, args); va_end(args); buf[len - 1] = 0; return(ret); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* simple helper to read an inode off the disk from a given root This can only be called for subvolume roots and not for the log */
static noinline struct inode* read_one_inode(struct btrfs_root *root, u64 objectid)
/* simple helper to read an inode off the disk from a given root This can only be called for subvolume roots and not for the log */ static noinline struct inode* read_one_inode(struct btrfs_root *root, u64 objectid)
{ struct btrfs_key key; struct inode *inode; key.objectid = objectid; key.type = BTRFS_INODE_ITEM_KEY; key.offset = 0; inode = btrfs_iget(root->fs_info->sb, &key, root); if (IS_ERR(inode)) { inode = NULL; } else if (is_bad_inode(inode)) { iput(inode); inode = NULL; } return inode; }
robutest/uclinux
C++
GPL-2.0
60
/* Set the start address of display to specified address. */
void LCD1602SetCursor(unsigned char ucRow, unsigned char ucCol)
/* Set the start address of display to specified address. */ void LCD1602SetCursor(unsigned char ucRow, unsigned char ucCol)
{ unsigned char ucRowOffset[] = { 0x00, 0x40, 0x14, 0x54 }; if(ucCol<LCD1602Dev.ucNumCols&&ucRow<LCD1602Dev.ucNumRows) { LCD1602IICWriteCmd(LCD1602IIC_SETDDRAMADDR | (ucCol + ucRowOffset[ucRow])); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function checks copy protection for a range of flash chunks. */
bool am_hal_flash_copy_protect_check(uint32_t *pui32StartAddress, uint32_t *pui32StopAddress)
/* This function checks copy protection for a range of flash chunks. */ bool am_hal_flash_copy_protect_check(uint32_t *pui32StartAddress, uint32_t *pui32StopAddress)
{ uint64_t ui64Mask; uint32_t ui32Work; uint32_t *pui32Protection = (uint32_t *)AM_HAL_FLASH_INFO_COPYPROT_ADDR; ui64Mask = generate_chunk_mask(pui32StartAddress, pui32StopAddress); if ( ~ui64Mask == 0x0 ) { return false; } ui32Work = (uint32_t)ui64Mask; if ( ~ui32Work & pui32Protection[0] ) { return false; } ui32Work = (uint32_t)(ui64Mask >> 32); if ( ~ui32Work & pui32Protection[1] ) { return false; } return true; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function closes a specified file handle. All "dirty" cached file data is flushed to the device, and the file is closed. In all cases the handle is closed. */
EFI_STATUS EFIAPI ShellCloseFile(IN SHELL_FILE_HANDLE *FileHandle)
/* This function closes a specified file handle. All "dirty" cached file data is flushed to the device, and the file is closed. In all cases the handle is closed. */ EFI_STATUS EFIAPI ShellCloseFile(IN SHELL_FILE_HANDLE *FileHandle)
{ return (FileFunctionMap.CloseFile (*FileHandle)); }
tianocore/edk2
C++
Other
4,240
/* This function uses check boot option is wheher setup application or no */
BOOLEAN IsBootManagerMenu(IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption)
/* This function uses check boot option is wheher setup application or no */ BOOLEAN IsBootManagerMenu(IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption)
{ EFI_STATUS Status; EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu; Status = EfiBootManagerGetBootManagerMenu (&BootManagerMenu); if (!EFI_ERROR (Status)) { EfiBootManagerFreeLoadOption (&BootManagerMenu); } return (BOOLEAN)(!EFI_ERROR (Status) && (BootOption->OptionNumber == BootManagerMenu.OptionNumber)); }
tianocore/edk2
C++
Other
4,240
/* Configures the MMC to stop rollover. Programs MMC interface so that counters will not rollover after reaching maximum value. */
void synopGMAC_mmc_counters_disable_rollover(synopGMACdevice *gmacdev)
/* Configures the MMC to stop rollover. Programs MMC interface so that counters will not rollover after reaching maximum value. */ void synopGMAC_mmc_counters_disable_rollover(synopGMACdevice *gmacdev)
{ synopGMACSetBits(gmacdev->MacBase,GmacMmcCntrl,GmacMmcCounterStopRollover); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Prevent the hardware module @oh from entering idle while the hardare module initiator @init_oh is active. Useful when a module will be accessed by a particular initiator (e.g., if a module will be accessed by the IVA, there should be a sleepdep between the IVA initiator and the module). Only applies to modules in smart-idle mode. Returns -EINVAL upon error or passes along pwrdm_add_sleepdep() value upon success. */
static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
/* Prevent the hardware module @oh from entering idle while the hardare module initiator @init_oh is active. Useful when a module will be accessed by a particular initiator (e.g., if a module will be accessed by the IVA, there should be a sleepdep between the IVA initiator and the module). Only applies to modules in smart-idle mode. Returns -EINVAL upon error or passes along pwrdm_add_sleepdep() value upon success. */ static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
{ if (!oh->_clk) return -EINVAL; return pwrdm_add_sleepdep(oh->_clk->clkdm->pwrdm.ptr, init_oh->_clk->clkdm->pwrdm.ptr); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* uea_send_modem_cmd - Send a command for pre-firmware devices. */
static int uea_send_modem_cmd(struct usb_device *usb, u16 addr, u16 size, const u8 *buff)
/* uea_send_modem_cmd - Send a command for pre-firmware devices. */ static int uea_send_modem_cmd(struct usb_device *usb, u16 addr, u16 size, const u8 *buff)
{ int ret = -ENOMEM; u8 *xfer_buff; xfer_buff = kmemdup(buff, size, GFP_KERNEL); if (xfer_buff) { ret = usb_control_msg(usb, usb_sndctrlpipe(usb, 0), LOAD_INTERNAL, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, addr, 0, xfer_buff, size, CTRL_TIMEOUT); kfree(xfer_buff); } if (ret < 0) return ret; return (ret == size) ? 0 : -EIO; }
robutest/uclinux
C++
GPL-2.0
60
/* Writes a single byte to the NVM using the flash access registers. Goes through a retry algorithm before giving up. */
static s32 e1000_retry_write_flash_byte_ich8lan(struct e1000_hw *hw, u32 offset, u8 byte)
/* Writes a single byte to the NVM using the flash access registers. Goes through a retry algorithm before giving up. */ static s32 e1000_retry_write_flash_byte_ich8lan(struct e1000_hw *hw, u32 offset, u8 byte)
{ s32 ret_val; u16 program_retries; ret_val = e1000_write_flash_byte_ich8lan(hw, offset, byte); if (!ret_val) return ret_val; for (program_retries = 0; program_retries < 100; program_retries++) { e_dbg("Retrying Byte %2.2X at offset %u\n", byte, offset); udelay(100); ret_val = e1000_write_flash_byte_ich8lan(hw, offset, byte); if (!ret_val) break; } if (program_retries == 100) return -E1000_ERR_NVM; return 0; }
robutest/uclinux
C++
GPL-2.0
60