docstring
stringlengths
22
576
signature
stringlengths
9
317
prompt
stringlengths
57
886
code
stringlengths
20
1.36k
repository
stringclasses
49 values
language
stringclasses
2 values
license
stringclasses
9 values
stars
int64
15
21.3k
/* This function will fill a formatted string to buffer. */
int pika_platform_vsnprintf(char *buff, size_t size, const char *fmt, va_list args)
/* This function will fill a formatted string to buffer. */ int pika_platform_vsnprintf(char *buff, size_t size, const char *fmt, va_list args)
{ return __vsnprintf(out_buffer, buff, size, fmt, args); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Factorization helper for the command state machine: Finish the command. */
static void ub_state_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd, int rc)
/* Factorization helper for the command state machine: Finish the command. */ static void ub_state_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd, int rc)
{ cmd->error = rc; cmd->state = UB_CMDST_DONE; ub_cmdq_pop(sc); (*cmd->done)(sc, cmd); }
robutest/uclinux
C++
GPL-2.0
60
/* Displays firmware data information on the standard output. */
static void DisplayFirmwareDataInfo(uint32_t segments, uint32_t base, uint32_t size)
/* Displays firmware data information on the standard output. */ static void DisplayFirmwareDataInfo(uint32_t segments, uint32_t base, uint32_t size)
{ printf(" -> Number of segments: %u\n", segments); printf(" -> Base memory address: 0x%08x\n", base); printf(" -> Total data size: %u bytes\n", size); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* The chip gives us an interrupt when the ON pin is asserted but we then need to poll to see when the pin is deasserted. */
static void wm831x_poll_on(struct work_struct *work)
/* The chip gives us an interrupt when the ON pin is asserted but we then need to poll to see when the pin is deasserted. */ static void wm831x_poll_on(struct work_struct *work)
{ struct wm831x_on *wm831x_on = container_of(work, struct wm831x_on, work.work); struct wm831x *wm831x = wm831x_on->wm831x; int poll, ret; ret = wm831x_reg_read(wm831x, WM831X_ON_PIN_CONTROL); if (ret >= 0) { poll = !(ret & WM831X_ON_PIN_STS); input_report_key(wm831x_on->dev, KEY_POWER, poll); input...
robutest/uclinux
C++
GPL-2.0
60
/* t h r o w W a r n i n g */
returnValue MessageHandling_throwWarning(MessageHandling *_THIS, returnValue Wnumber, const char *additionaltext, const char *functionname, const char *filename, const unsigned long linenumber, VisibilityStatus localVisibilityStatus)
/* t h r o w W a r n i n g */ returnValue MessageHandling_throwWarning(MessageHandling *_THIS, returnValue Wnumber, const char *additionaltext, const char *functionname, const char *filename, const unsigned long linenumber, VisibilityStatus localVisibilityStatus)
{ if ( Wnumber <= SUCCESSFUL_RETURN ) return MessageHandling_throwError( _THIS,RET_WARNING_UNDEFINED,0,__FUNC__,__FILE__,__LINE__,VS_VISIBLE ); if ( _THIS->warningVisibility == VS_VISIBLE ) return MessageHandling_throwMessage( _THIS,Wnumber,additionaltext,functionname,filename,linenumber,localVisibilityStatus,"...
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* Return the EFI handle associated with a package list. */
EFI_STATUS EFIAPI HiiGetPackageListHandle(IN CONST EFI_HII_DATABASE_PROTOCOL *This, IN EFI_HII_HANDLE PackageListHandle, OUT EFI_HANDLE *DriverHandle)
/* Return the EFI handle associated with a package list. */ EFI_STATUS EFIAPI HiiGetPackageListHandle(IN CONST EFI_HII_DATABASE_PROTOCOL *This, IN EFI_HII_HANDLE PackageListHandle, OUT EFI_HANDLE *DriverHandle)
{ HII_DATABASE_PRIVATE_DATA *Private; HII_DATABASE_RECORD *Node; LIST_ENTRY *Link; if ((This == NULL) || (DriverHandle == NULL)) { return EFI_INVALID_PARAMETER; } if (!IsHiiHandleValid (PackageListHandle)) { return EFI_INVALID_PARAMETER; } Private = HII_DATABASE_DATABASE_...
tianocore/edk2
C++
Other
4,240
/* Memory accesses are permitted and maintenance operation begins. Until this bit is set to a 1, the memory controller will not accept DRAM requests from the MEMORY_MANAGER or HTE. */
void set_ddr_init_complete(struct mrc_params *mrc_params)
/* Memory accesses are permitted and maintenance operation begins. Until this bit is set to a 1, the memory controller will not accept DRAM requests from the MEMORY_MANAGER or HTE. */ void set_ddr_init_complete(struct mrc_params *mrc_params)
{ u32 dco; ENTERFN(); dco = msg_port_read(MEM_CTLR, DCO); dco &= ~DCO_PMICTL; dco |= DCO_IC; msg_port_write(MEM_CTLR, DCO, dco); LEAVEFN(); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Function called in case of error detected in USART IT Handler. */
void USART_TransferError_Callback(void)
/* Function called in case of error detected in USART IT Handler. */ void USART_TransferError_Callback(void)
{ NVIC_DisableIRQ(USART1_IRQn); LED_Blinking(LED_BLINK_ERROR); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciAndThenOr32(IN UINTN Address, IN UINT32 AndData, IN UINT32 OrData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI PciAndThenOr32(IN UINTN Address, IN UINT32 AndData, IN UINT32 OrData)
{ return mRunningOnQ35 ? PciExpressAndThenOr32 (Address, AndData, OrData) : PciCf8AndThenOr32 (Address, AndData, OrData); }
tianocore/edk2
C++
Other
4,240
/* All xfs metadata buffers except log state machine buffers get this attached as their b_bdstrat callback function. This is so that we can catch a buffer after prematurely unpinning it to forcibly shutdown the filesystem. */
int xfs_bdstrat_cb(struct xfs_buf *bp)
/* All xfs metadata buffers except log state machine buffers get this attached as their b_bdstrat callback function. This is so that we can catch a buffer after prematurely unpinning it to forcibly shutdown the filesystem. */ int xfs_bdstrat_cb(struct xfs_buf *bp)
{ if (XFS_FORCED_SHUTDOWN(bp->b_mount)) { trace_xfs_bdstrat_shut(bp, _RET_IP_); if (XFS_BUF_IODONE_FUNC(bp) == NULL && (XFS_BUF_ISREAD(bp)) == 0) return (xfs_bioerror_relse(bp)); else return (xfs_bioerror(bp)); } xfs_buf_iorequest(bp); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Check for Disabled FLASH INFO space. Use this function to determine whether FLASH INFO erasure is disabled. */
bool am_hal_flash_info_erase_disable_check(void)
/* Check for Disabled FLASH INFO space. Use this function to determine whether FLASH INFO erasure is disabled. */ bool am_hal_flash_info_erase_disable_check(void)
{ if ( customer_info_signature_erased() ) { return false; } if ( !am_hal_flash_customer_info_signature_check() ) { return false; } return AM_REGVAL(AM_HAL_FLASH_INFO_SECURITY_ADDR) & AM_HAL_FLASH_INFO_SECURITY_ENINFOERASE_M ? false : true; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* SSP macro: read 1 bytes from FIFO buffer */
STATIC void SSP_Read2BFifo(LPC_SSP_T *pSSP, Chip_SSP_DATA_SETUP_T *xf_setup)
/* SSP macro: read 1 bytes from FIFO buffer */ STATIC void SSP_Read2BFifo(LPC_SSP_T *pSSP, Chip_SSP_DATA_SETUP_T *xf_setup)
{ uint16_t rDat; while ((Chip_SSP_GetStatus(pSSP, SSP_STAT_RNE) == SET) && (xf_setup->rx_cnt < xf_setup->length)) { rDat = Chip_SSP_ReceiveFrame(pSSP); if (xf_setup->rx_data) { *(uint16_t *) ((uint32_t) xf_setup->rx_data + xf_setup->rx_cnt) = rDat; } xf_setup->rx_cnt += 2; } }
labapart/polymcu
C++
null
201
/* Time period register for step detection on delta time (r/w).. */
int32_t lsm6dso_pedo_steps_period_set(stmdev_ctx_t *ctx, uint16_t val)
/* Time period register for step detection on delta time (r/w).. */ int32_t lsm6dso_pedo_steps_period_set(stmdev_ctx_t *ctx, uint16_t val)
{ uint8_t buff[2]; int32_t ret; buff[1] = (uint8_t) (val / 256U); buff[0] = (uint8_t) (val - (buff[1] * 256U)); ret = lsm6dso_ln_pg_write_byte(ctx, LSM6DSO_PEDO_SC_DELTAT_L, &buff[0]); if (ret == 0) { ret = lsm6dso_ln_pg_write_byte(ctx, LSM6DSO_PEDO_SC_DELTAT_H, ...
eclipse-threadx/getting-started
C++
Other
310
/* Get the specified pixel/segment state from the LCDCA display memory. */
bool lcdca_get_pixel(uint8_t pix_com, uint8_t pix_seg)
/* Get the specified pixel/segment state from the LCDCA display memory. */ bool lcdca_get_pixel(uint8_t pix_com, uint8_t pix_seg)
{ uint64_t register_value = lcdca_get_pixel_register(pix_com); return register_value & ((uint64_t)1 << pix_seg); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Called by the usb core when the device is removed from the system. */
static void ld_usb_disconnect(struct usb_interface *intf)
/* Called by the usb core when the device is removed from the system. */ static void ld_usb_disconnect(struct usb_interface *intf)
{ struct ld_usb *dev; int minor; dev = usb_get_intfdata(intf); usb_set_intfdata(intf, NULL); minor = intf->minor; usb_deregister_dev(intf, &ld_usb_class); mutex_lock(&dev->mutex); if (!dev->open_count) { mutex_unlock(&dev->mutex); ld_usb_delete(dev); } else { dev->intf = NULL; wake_up_interruptible_all...
robutest/uclinux
C++
GPL-2.0
60
/* jornada_ssp_end - disable mcu and turn off lock */
void jornada_ssp_end(void)
/* jornada_ssp_end - disable mcu and turn off lock */ void jornada_ssp_end(void)
{ GPSR = GPIO_GPIO25; spin_unlock_irqrestore(&jornada_ssp_lock, jornada_ssp_flags); return; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This comparator searches for the next Bidirectional Printer Interface descriptor of the current Printer interface, aborting the search if the end of the descriptors is found. */
uint8_t DComp_NextBidirectionalPrinterInterface(void *CurrentDescriptor)
/* This comparator searches for the next Bidirectional Printer Interface descriptor of the current Printer interface, aborting the search if the end of the descriptors is found. */ uint8_t DComp_NextBidirectionalPrinterInterface(void *CurrentDescriptor)
{ USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); if (Header->Type == DTYPE_Interface) { USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); if ((Interface->Class == PRNT_CSCP_PrinterClass) && (Interf...
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Unbond a remote device. Unbond a remote device. This will remove all persistent information saved for this device */
ADI_BLER_RESULT adi_radio_UnBond(uint8_t *const pAddr)
/* Unbond a remote device. Unbond a remote device. This will remove all persistent information saved for this device */ ADI_BLER_RESULT adi_radio_UnBond(uint8_t *const pAddr)
{ ADI_BLER_RESULT bleResult; ASSERT(pAddr != NULL); ADI_BLE_LOGEVENT(LOGID_CMD_BLESMP_UN_BOND); ADI_BLE_RADIO_CMD_START(CMD_BLESMP_UN_BOND); memcpy(&pBLERadio->cmdPkt[ADI_RADIO_CMD_HEADER_LEN], pAddr, 6u); bleResult = bler_process_cmd(CMD_BLESMP_UN_BOND, 6u, NULL, 0u); if(bleResult == ADI_BL...
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Retrieves the current module status. Retrieves the status of the module, giving overall state information. */
uint32_t adc_get_status(struct adc_module *const module_inst)
/* Retrieves the current module status. Retrieves the status of the module, giving overall state information. */ uint32_t adc_get_status(struct adc_module *const module_inst)
{ Assert(module_inst); Assert(module_inst->hw); Adc *const adc_module = module_inst->hw; uint32_t int_flags = adc_module->INTFLAG.reg; uint32_t status_flags = 0; if (int_flags & ADC_INTFLAG_RESRDY) { status_flags |= ADC_STATUS_RESULT_READY; } if (int_flags & ADC_INTFLAG_WINMON) { status_flags |= ADC_STATUS_...
remotemcu/remcu-chip-sdks
C++
null
436
/* ZigBee helper function. Appends the info to the info column */
void zbee_append_info(proto_item *item, packet_info *pinfo, const gchar *format,...)
/* ZigBee helper function. Appends the info to the info column */ void zbee_append_info(proto_item *item, packet_info *pinfo, const gchar *format,...)
{ static gchar buffer[512]; va_list ap; va_start(ap, format); g_vsnprintf(buffer, 512, format, ap); va_end(ap); proto_item_append_text(item, "%s", buffer); col_append_str(pinfo->cinfo, COL_INFO, buffer); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* When cap bits have been already read, this doesn't read again but returns the cached value. */
u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction)
/* When cap bits have been already read, this doesn't read again but returns the cached value. */ u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction)
{ struct hda_amp_info *info; info = get_alloc_amp_hash(codec, HDA_HASH_KEY(nid, direction, 0)); if (!info) return 0; if (!(info->head.val & INFO_AMP_CAPS)) { if (!(get_wcaps(codec, nid) & AC_WCAP_AMP_OVRD)) nid = codec->afg; info->amp_caps = snd_hda_param_read(codec, nid, direction == HDA_OUTPUT ...
robutest/uclinux
C++
GPL-2.0
60
/* Function called in case of error detected in USART IT Handler. */
void Error_Callback(void)
/* Function called in case of error detected in USART IT Handler. */ void Error_Callback(void)
{ __IO uint32_t sr_reg; NVIC_DisableIRQ(USART1_IRQn); sr_reg = LL_USART_ReadReg(USART1, SR); if (sr_reg & LL_USART_SR_NE) { LL_USART_ClearFlag_NE(USART1); } else { LED_Blinking(LED_BLINK_ERROR); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This function copies at most @len bytes at @offset from the FIFO into the @to buffer and returns the number of copied bytes. The data is not removed from the FIFO. */
unsigned int kfifo_out_peek(struct kfifo *fifo, void *to, unsigned int len, unsigned offset)
/* This function copies at most @len bytes at @offset from the FIFO into the @to buffer and returns the number of copied bytes. The data is not removed from the FIFO. */ unsigned int kfifo_out_peek(struct kfifo *fifo, void *to, unsigned int len, unsigned offset)
{ len = min(kfifo_len(fifo), len + offset); __kfifo_out_data(fifo, to, len, offset); return len; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Notes: There is no timeout for this operation. if this operation is unreliable for a given host, then the host itself needs to put a timer on it, and set the host back to a consistent state prior to returning. */
static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd)
/* Notes: There is no timeout for this operation. if this operation is unreliable for a given host, then the host itself needs to put a timer on it, and set the host back to a consistent state prior to returning. */ static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd)
{ int rtn; if (!scmd->device->host->hostt->eh_device_reset_handler) return FAILED; rtn = scmd->device->host->hostt->eh_device_reset_handler(scmd); if (rtn == SUCCESS) __scsi_report_device_reset(scmd->device, NULL); return rtn; }
robutest/uclinux
C++
GPL-2.0
60
/* Printing of the unreferenced objects information to the seq file. The print_unreferenced function must be called with the object->lock held. */
static void print_unreferenced(struct seq_file *seq, struct kmemleak_object *object)
/* Printing of the unreferenced objects information to the seq file. The print_unreferenced function must be called with the object->lock held. */ static void print_unreferenced(struct seq_file *seq, struct kmemleak_object *object)
{ int i; unsigned int msecs_age = jiffies_to_msecs(jiffies - object->jiffies); seq_printf(seq, "unreferenced object 0x%08lx (size %zu):\n", object->pointer, object->size); seq_printf(seq, " comm \"%s\", pid %d, jiffies %lu (age %d.%03ds)\n", object->comm, object->pid, object->jiffies, msecs_age / 10...
robutest/uclinux
C++
GPL-2.0
60
/* Checks if a USB Gecko adapter is inserted in any memory card slot. */
static void __iomem* ug_udbg_probe(void __iomem *exi_io_base)
/* Checks if a USB Gecko adapter is inserted in any memory card slot. */ static void __iomem* ug_udbg_probe(void __iomem *exi_io_base)
{ int i; for (i = 0; i < 2; i++) { ug_io_base = exi_io_base + 0x14 * i; if (ug_is_adapter_present()) break; } if (i == 2) ug_io_base = NULL; return ug_io_base; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function configures and then enables an alternative PLL clock source for the DC-DC converters. */
void mxs_power_switch_dcdc_clocksource(uint32_t freqsel)
/* This function configures and then enables an alternative PLL clock source for the DC-DC converters. */ void mxs_power_switch_dcdc_clocksource(uint32_t freqsel)
{ struct mxs_power_regs *power_regs = (struct mxs_power_regs *)MXS_POWER_BASE; clrsetbits_le32(&power_regs->hw_power_misc, POWER_MISC_FREQSEL_MASK, freqsel); setbits_le32(&power_regs->hw_power_misc, POWER_MISC_SEL_PLLCLK); }
4ms/stm32mp1-baremetal
C++
Other
137
/* @ 成功/失败的标准 :无 @ 警告 必须运行在调试接口没有没有接线的状态下 @ 参看 ICS_ConfigType */
void FBI_to_FBILP(ICS_ConfigType *pConfig)
/* @ 成功/失败的标准 :无 @ 警告 必须运行在调试接口没有没有接线的状态下 @ 参看 ICS_ConfigType */ void FBI_to_FBILP(ICS_ConfigType *pConfig)
{ ICS->C2 |= ICS_C2_LP_MASK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read a word from the EEPROM using the regular EEPROM access register. Assume that we are in register window zero. */
static word read_eeprom(dword ioaddr, int index)
/* Read a word from the EEPROM using the regular EEPROM access register. Assume that we are in register window zero. */ static word read_eeprom(dword ioaddr, int index)
{ int i; outw(EEPROM_READ + index, ioaddr + 0xa); for (i = 1620; i >= 0; i--) if ((inw(ioaddr + 10) & EEPROM_BUSY) == 0) break; return inw(ioaddr + 0xc); }
EmcraftSystems/u-boot
C++
Other
181
/* Split TLB address into TLB way, entry index and VPN (with index). See ISA, 4.6.5.5 - 4.6.5.8 for the TLB addressing format */
static void split_tlb_entry_spec(CPUXtensaState *env, uint32_t v, bool dtlb, uint32_t *vpn, uint32_t *wi, uint32_t *ei)
/* Split TLB address into TLB way, entry index and VPN (with index). See ISA, 4.6.5.5 - 4.6.5.8 for the TLB addressing format */ static void split_tlb_entry_spec(CPUXtensaState *env, uint32_t v, bool dtlb, uint32_t *vpn, uint32_t *wi, uint32_t *ei)
{ if (xtensa_option_enabled(env->config, XTENSA_OPTION_MMU)) { *wi = v & (dtlb ? 0xf : 0x7); split_tlb_entry_spec_way(env, v, dtlb, vpn, *wi, ei); } else { *vpn = v & REGION_PAGE_MASK; *wi = 0; *ei = (v >> 29) & 0x7; } }
ve3wwg/teensy3_qemu
C++
Other
15
/* Stop the PWM of the PWM module. The */
void PWMStop(unsigned long ulBase, unsigned long ulChannel)
/* Stop the PWM of the PWM module. The */ void PWMStop(unsigned long ulBase, unsigned long ulChannel)
{ unsigned long ulChannelTemp; ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4); xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE)); xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3))); xHWREG(ulBase + PWM_PCR) &= ~(PWM_PCR_CH0EN << (ulChannelTemp << 3)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* param tcd Pointer to the TCD structure. note This function enables the auto stop request feature. */
void EDMA_TcdReset(edma_tcd_t *tcd)
/* param tcd Pointer to the TCD structure. note This function enables the auto stop request feature. */ void EDMA_TcdReset(edma_tcd_t *tcd)
{ assert(tcd != NULL); assert(((uint32_t)tcd & 0x1FU) == 0U); tcd->SADDR = 0U; tcd->SOFF = 0U; tcd->ATTR = 0U; tcd->NBYTES = 0U; tcd->SLAST = 0U; tcd->DADDR = 0U; tcd->DOFF = 0U; tcd->CITER = 0U; tcd->DLAST_SGA = 0U; tcd->CSR = DMA_CSR_...
eclipse-threadx/getting-started
C++
Other
310
/* If the page does not get brought uptodate, return -EIO. */
struct page* read_cache_page_gfp(struct address_space *mapping, pgoff_t index, gfp_t gfp)
/* If the page does not get brought uptodate, return -EIO. */ struct page* read_cache_page_gfp(struct address_space *mapping, pgoff_t index, gfp_t gfp)
{ filler_t *filler = (filler_t *)mapping->a_ops->readpage; return wait_on_page_read(do_read_cache_page(mapping, index, filler, NULL, gfp)); }
robutest/uclinux
C++
GPL-2.0
60
/* The Poll() function can be used by network drivers and applications to increase the rate that data packets are moved between the communications device and the transmit and receive queues. In some systems, the periodic timer event in the managed network driver may not poll the underlying communications device fast en...
EFI_STATUS EFIAPI Dns4Poll(IN EFI_DNS4_PROTOCOL *This)
/* The Poll() function can be used by network drivers and applications to increase the rate that data packets are moved between the communications device and the transmit and receive queues. In some systems, the periodic timer event in the managed network driver may not poll the underlying communications device fast en...
{ DNS_INSTANCE *Instance; EFI_UDP4_PROTOCOL *Udp; if (This == NULL) { return EFI_INVALID_PARAMETER; } Instance = DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This); if (Instance->State == DNS_STATE_UNCONFIGED) { return EFI_NOT_STARTED; } else if (Instance->State == DNS_STATE_DESTROY) { return EFI_...
tianocore/edk2
C++
Other
4,240
/* Create refresh hook event for statement which has refresh event or interval. */
VOID CreateRefreshEventForStatement(IN FORM_BROWSER_STATEMENT *Statement)
/* Create refresh hook event for statement which has refresh event or interval. */ VOID CreateRefreshEventForStatement(IN FORM_BROWSER_STATEMENT *Statement)
{ EFI_STATUS Status; EFI_EVENT RefreshEvent; FORM_BROWSER_REFRESH_EVENT_NODE *EventNode; Status = gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_CALLBACK, RefreshEventNotifyForStatement, Statement,...
tianocore/edk2
C++
Other
4,240
/* The constructor function caches the pointer to HOB list by calling */
EFI_STATUS EFIAPI HobLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The constructor function caches the pointer to HOB list by calling */ EFI_STATUS EFIAPI HobLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ GetHobList (); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Enter deep power down mode. The DP instruction is for setting the device on the minimizing the power consumption. */
enum status_code mx25l_enter_deep_powerdown(void)
/* Enter deep power down mode. The DP instruction is for setting the device on the minimizing the power consumption. */ enum status_code mx25l_enter_deep_powerdown(void)
{ enum status_code status; uint8_t tx_buf[1] = {MX25L_CMD_DP}; _mx25l_chip_select(); status = spi_write_buffer_wait(&_mx25l_spi, tx_buf, 1); if (status != STATUS_OK) { return STATUS_ERR_IO; } _mx25l_chip_deselect(); return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* Adjusts the frame frequency. Frequency = FsCLK / (prescaler * divider . NCOM) */
void SLCDC_SetFrameFreq(unsigned int prescalerValue, unsigned int dividerValue)
/* Adjusts the frame frequency. Frequency = FsCLK / (prescaler * divider . NCOM) */ void SLCDC_SetFrameFreq(unsigned int prescalerValue, unsigned int dividerValue)
{ SANITY_CHECK((prescalerValue & ~AT91C_SLCDC_PRESC) == 0); SANITY_CHECK((dividerValue & (~(0x07 << 8))) == 0); AT91C_BASE_SLCDC->SLCDC_FRR = prescalerValue | dividerValue; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* A special thanks goes to Realtek for their support ! */
static void ieee80211_monitor_rx(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats)
/* A special thanks goes to Realtek for their support ! */ static void ieee80211_monitor_rx(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats)
{ struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *)skb->data; u16 fc = le16_to_cpu(hdr->frame_ctl); skb->dev = ieee->dev; skb_reset_mac_header(skb); skb_pull(skb, ieee80211_get_hdrlen(fc)); skb->pkt_type = PACKET_OTHERHOST; skb->protocol = __constant_htons(ETH_P_80211_RAW); memset(skb->cb,...
robutest/uclinux
C++
GPL-2.0
60
/* This function initiates TX and RX DMA transfers by enabling DMA channels. */
void StartTransfers(void)
/* This function initiates TX and RX DMA transfers by enabling DMA channels. */ void StartTransfers(void)
{ LL_USART_TransmitData8(USART1, aUSART1TxBuffer[ubSend++]); LL_USART_EnableIT_TXE(USART1); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Message: ModifyConferenceReqMessage Opcode: 0x0139 Type: IntraCCM Direction: pbx2pbx VarLength: no */
static void handle_ModifyConferenceReqMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: ModifyConferenceReqMessage Opcode: 0x0139 Type: IntraCCM Direction: pbx2pbx VarLength: no */ static void handle_ModifyConferenceReqMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ guint32 dataLength = 0; ptvcursor_add(cursor, hf_skinny_conferenceID, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_numberOfReservedParticipants, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_appID, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_appConfID, 32, ENC_ASCII|ENC_NA); ...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Acquires semaphore, if necessary, then reads the PHY register at offset and storing the retrieved information in data. Release any acquired semaphores before exiting. */
s32 e1000e_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data)
/* Acquires semaphore, if necessary, then reads the PHY register at offset and storing the retrieved information in data. Release any acquired semaphores before exiting. */ s32 e1000e_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data)
{ s32 ret_val; ret_val = hw->phy.ops.acquire(hw); if (ret_val) return ret_val; ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, data); hw->phy.ops.release(hw); return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeIntnToUintn(IN INTN Operand, OUT UINTN *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeIntnToUintn(IN INTN Operand, OUT UINTN *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if (Operand >= 0) { *Result = (UINTN)Operand; Status = RETURN_SUCCESS; } else { *Result = UINTN_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* em28xx_write_ac97() write a 16 bit value to the specified AC97 address (LSB first!) */
int em28xx_write_ac97(struct em28xx *dev, u8 reg, u16 val)
/* em28xx_write_ac97() write a 16 bit value to the specified AC97 address (LSB first!) */ int em28xx_write_ac97(struct em28xx *dev, u8 reg, u16 val)
{ int ret; u8 addr = reg & 0x7f; __le16 value; value = cpu_to_le16(val); ret = em28xx_is_ac97_ready(dev); if (ret < 0) return ret; ret = em28xx_write_regs(dev, EM28XX_R40_AC97LSB, (u8 *) &value, 2); if (ret < 0) return ret; ret = em28xx_write_regs(dev, EM28XX_R42_AC97ADDR, &addr, 1); if (ret < 0) return...
robutest/uclinux
C++
GPL-2.0
60
/* Find the handler for the prefix and dispatch its get() operation. */
ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size)
/* Find the handler for the prefix and dispatch its get() operation. */ ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size)
{ struct xattr_handler *handler; handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); if (!handler) return -EOPNOTSUPP; return handler->get(dentry, name, buffer, size, handler->flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Retrieves a Unicode string that is the user-readable name of the EFI Driver. */
EFI_STATUS EFIAPI XenBusDxeComponentNameGetDriverName(IN EFI_COMPONENT_NAME2_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
/* Retrieves a Unicode string that is the user-readable name of the EFI Driver. */ EFI_STATUS EFIAPI XenBusDxeComponentNameGetDriverName(IN EFI_COMPONENT_NAME2_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mXenBusDxeDriverNameTable, DriverName, (BOOLEAN)(This != &gXenBusDxeComponentName2) ); }
tianocore/edk2
C++
Other
4,240
/* The common notify function associated with various TcpIo events. */
VOID EFIAPI TcpIoCommonNotify(IN EFI_EVENT Event, IN VOID *Context)
/* The common notify function associated with various TcpIo events. */ VOID EFIAPI TcpIoCommonNotify(IN EFI_EVENT Event, IN VOID *Context)
{ if ((Event == NULL) || (Context == NULL)) { return; } *((BOOLEAN *)Context) = TRUE; }
tianocore/edk2
C++
Other
4,240
/* Output: void, will modify proto_tree if not null. */
static void dissect_hello_instance_identifier_clv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, int id_length _U_, int length)
/* Output: void, will modify proto_tree if not null. */ static void dissect_hello_instance_identifier_clv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, int id_length _U_, int length)
{ isis_dissect_instance_identifier_clv(tree, pinfo, tvb, &ei_isis_hello_short_packet, hf_isis_hello_instance_identifier, hf_isis_hello_supported_itid, offset, length); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* : Select the can work as peli mode or basic mode */
void CAN_Mode_Cmd(CAN_TypeDef *CANx, uint32_t CAN_MODE)
/* : Select the can work as peli mode or basic mode */ void CAN_Mode_Cmd(CAN_TypeDef *CANx, uint32_t CAN_MODE)
{ assert_param(IS_CAN_ALL_PERIPH(CANx)); CANx->CDR |= CAN_MODE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Remove and free all elements from a linked list. The list remain valid but become empty. */
void _lv_ll_clear(lv_ll_t *ll_p)
/* Remove and free all elements from a linked list. The list remain valid but become empty. */ void _lv_ll_clear(lv_ll_t *ll_p)
{ void * i; void * i_next; i = _lv_ll_get_head(ll_p); i_next = NULL; while(i != NULL) { i_next = _lv_ll_get_next(ll_p, i); _lv_ll_remove(ll_p, i); lv_mem_free(i); i = i_next; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Mark black 'OLD1' objects when starting a new young collection. Gray objects are already in some gray list, and so will be visited in the atomic step. */
static void markold(global_State *g, GCObject *from, GCObject *to)
/* Mark black 'OLD1' objects when starting a new young collection. Gray objects are already in some gray list, and so will be visited in the atomic step. */ static void markold(global_State *g, GCObject *from, GCObject *to)
{ if (getage(p) == G_OLD1) { lua_assert(!iswhite(p)); changeage(p, G_OLD1, G_OLD); if (isblack(p)) reallymarkobject(g, p); } } }
Nicholas3388/LuaNode
C++
Other
1,055
/* Enables or disables the NSS pulse management mode. */
void SPI_NSSPulseModeCmd(SPI_TypeDef *SPIx, FunctionalState NewState)
/* Enables or disables the NSS pulse management mode. */ void SPI_NSSPulseModeCmd(SPI_TypeDef *SPIx, FunctionalState NewState)
{ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { SPIx->CR2 |= SPI_CR2_NSSP; } else { SPIx->CR2 &= (uint16_t)~((uint16_t)SPI_CR2_NSSP); } }
ajhc/demo-cortex-m3
C++
null
38
/* Returns true if the RX fifo is ready for transmission. */
static int ug_is_rxfifo_ready(void)
/* Returns true if the RX fifo is ready for transmission. */ static int ug_is_rxfifo_ready(void)
{ return ug_io_transaction(0xd0000000) & 0x04000000; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Convert the absolute value of Bn into big-endian form and store it at Buf. The Buf array should have at least BigNumBytes() in it. */
INTN EFIAPI BigNumToBin(IN CONST VOID *Bn, OUT UINT8 *Buf)
/* Convert the absolute value of Bn into big-endian form and store it at Buf. The Buf array should have at least BigNumBytes() in it. */ INTN EFIAPI BigNumToBin(IN CONST VOID *Bn, OUT UINT8 *Buf)
{ return BN_bn2bin (Bn, Buf); }
tianocore/edk2
C++
Other
4,240
/* Return true if WP pin is configured and is low. */
static bool card_write_protected(int slot)
/* Return true if WP pin is configured and is low. */ static bool card_write_protected(int slot)
{ if (s_slots[slot].gpio_wp == GPIO_UNUSED) { return false; } return gpio_get_level(s_slots[slot].gpio_wp) == 0; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Starts the Low Level portion of the Device driver. */
USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev)
/* Starts the Low Level portion of the Device driver. */ USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev)
{ HAL_PCD_Start(pdev->pData); return USBD_OK; }
4ms/stm32mp1-baremetal
C++
Other
137
/* If the reservation window is outside the goal allocation group, return 0; grp_goal (given goal block) could be -1, which means no specific goal block. In this case, always return 1. If the goal block is within the reservation window, return 1; otherwise, return 0; */
static int goal_in_my_reservation(struct ext3_reserve_window *rsv, ext3_grpblk_t grp_goal, unsigned int group, struct super_block *sb)
/* If the reservation window is outside the goal allocation group, return 0; grp_goal (given goal block) could be -1, which means no specific goal block. In this case, always return 1. If the goal block is within the reservation window, return 1; otherwise, return 0; */ static int goal_in_my_reservation(struct ext3_re...
{ ext3_fsblk_t group_first_block, group_last_block; group_first_block = ext3_group_first_block_no(sb, group); group_last_block = group_first_block + (EXT3_BLOCKS_PER_GROUP(sb) - 1); if ((rsv->_rsv_start > group_last_block) || (rsv->_rsv_end < group_first_block)) return 0; if ((grp_goal >= 0) && ((grp_goal +...
robutest/uclinux
C++
GPL-2.0
60
/* When this returns zero, the specified adapter became available for clients using the bus number provided in adap->nr. Also, the table of I2C devices pre-declared using i2c_register_board_info() is scanned, and the appropriate driver model device nodes are created. Otherwise, a negative errno value is returned. */
int i2c_add_numbered_adapter(struct i2c_adapter *adap)
/* When this returns zero, the specified adapter became available for clients using the bus number provided in adap->nr. Also, the table of I2C devices pre-declared using i2c_register_board_info() is scanned, and the appropriate driver model device nodes are created. Otherwise, a negative errno value is returned. */ i...
{ int id; int status; if (adap->nr & ~MAX_ID_MASK) return -EINVAL; retry: if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0) return -ENOMEM; mutex_lock(&core_lock); status = idr_get_new_above(&i2c_adapter_idr, adap, adap->nr, &id); if (status == 0 && id != adap->nr) { status = -EBUSY; idr_remove(&i2c_ad...
robutest/uclinux
C++
GPL-2.0
60
/* CAUTION: The unscaled->face field must be NULL before calling this function. This is because the #cairo_ft_unscaled_font_t_map keeps a count of these faces (font_map->num_open_faces) so it maintains the unscaled->face field while it has its lock held. See _font_map_release_face_lock_held(). */
static void _cairo_ft_unscaled_font_fini(cairo_ft_unscaled_font_t *unscaled)
/* CAUTION: The unscaled->face field must be NULL before calling this function. This is because the #cairo_ft_unscaled_font_t_map keeps a count of these faces (font_map->num_open_faces) so it maintains the unscaled->face field while it has its lock held. See _font_map_release_face_lock_held(). */ static void _cairo_ft...
{ assert (unscaled->face == NULL); free (unscaled->filename); unscaled->filename = NULL; free (unscaled->variations); CAIRO_MUTEX_FINI (unscaled->mutex); }
xboot/xboot
C++
MIT License
779
/* Function for handling Disconnected event received from the SoftDevice. This function check if the disconnect event is happening on the link associated with the current instance of the module, if so it will set its conn_handle to invalid. */
static void on_disconnected(ble_ancs_c_t *p_ancs, const ble_evt_t *p_ble_evt)
/* Function for handling Disconnected event received from the SoftDevice. This function check if the disconnect event is happening on the link associated with the current instance of the module, if so it will set its conn_handle to invalid. */ static void on_disconnected(ble_ancs_c_t *p_ancs, const ble_evt_t *p_ble_ev...
{ if (p_ancs->conn_handle == p_ble_evt->evt.gap_evt.conn_handle) { p_ancs->conn_handle = BLE_CONN_HANDLE_INVALID; } }
labapart/polymcu
C++
null
201
/* The available mappings are supplied on a per-device basis in */
void GPIOPinConfigure(uint32_t ui32PinConfig)
/* The available mappings are supplied on a per-device basis in */ void GPIOPinConfigure(uint32_t ui32PinConfig)
{ uint32_t ui32Base, ui32Shift; ASSERT(((ui32PinConfig >> 16) & 0xff) < 18); ASSERT(((ui32PinConfig >> 8) & 0xe3) == 0); ui32Base = (ui32PinConfig >> 16) & 0xff; ui32Base = g_pui32GPIOBaseAddrs[ui32Base]; ui32Shift = (ui32PinConfig >> 8) & 0xff; HWREG(ui32Base + GPIO_O_PCTL) = ((HWREG(ui32Ba...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* performs a basic GC step if collector is running */
void luaC_step(lua_State *L)
/* performs a basic GC step if collector is running */ void luaC_step(lua_State *L)
{ if(isdecGCmodegen(g)) genstep(L, g); else incstep(L, g); } }
Nicholas3388/LuaNode
C++
Other
1,055
/* Set the directory's cursor to the next and get the next directory entry. */
EFI_STATUS FatGetNextDirEnt(IN FAT_OFILE *OFile, OUT FAT_DIRENT **PtrDirEnt)
/* Set the directory's cursor to the next and get the next directory entry. */ EFI_STATUS FatGetNextDirEnt(IN FAT_OFILE *OFile, OUT FAT_DIRENT **PtrDirEnt)
{ EFI_STATUS Status; FAT_DIRENT *DirEnt; FAT_ODIR *ODir; ODir = OFile->ODir; ASSERT (ODir != NULL); if (ODir->CurrentCursor->ForwardLink == &ODir->ChildList) { if (!ODir->EndOfDir) { Status = FatLoadNextDirEnt (OFile, &DirEnt); if (EFI_ERROR (Status)) { return Status; } ...
tianocore/edk2
C++
Other
4,240
/* To start a timer, you write to FRCI_LOAD_ADDRESS, and that starts the counting down. When it reaches zero, the interrupt fires */
static void ICACHE_RAM_ATTR set_timer(int delay, const char *caller)
/* To start a timer, you write to FRCI_LOAD_ADDRESS, and that starts the counting down. When it reaches zero, the interrupt fires */ static void ICACHE_RAM_ATTR set_timer(int delay, const char *caller)
{ delay = 1; } int32_t time_left = (RTC_REG_READ(FRC1_COUNT_ADDRESS)) & ((1 << 23) - 1); RTC_REG_WRITE(FRC1_LOAD_ADDRESS, delay); if (time_left > last_timer_load) { time_left -= 1 << 23; } NODE_DBG("%s(%x): time_next=%d, left=%d (load=%d), delay=%d => %d\n", caller, active->owner, time_next_expiry,...
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* This routine will be the interface to the ReadPromByte function above. */
static void nicstar_read_eprom(virt_addr_t base, u_int8_t prom_offset, u_int8_t *buffer, u_int32_t nbytes)
/* This routine will be the interface to the ReadPromByte function above. */ static void nicstar_read_eprom(virt_addr_t base, u_int8_t prom_offset, u_int8_t *buffer, u_int32_t nbytes)
{ u_int i; for (i=0; i<nbytes; i++) { buffer[i] = read_eprom_byte( base, prom_offset ); ++prom_offset; osp_MicroDelay( CYCLE_DELAY ); } }
robutest/uclinux
C++
GPL-2.0
60
/* Strictly speaking, for a somewhat constant set of clients where each client gets a constant bandwidth and is just enabled or disabled (somewhat dynamically), no action is necessary here to avoid starvation for non-zero-allocation clients, as the allocated slots will just be unused. However, handing out those unused ...
void crisv32_arbiter_deallocate_bandwidth(int client, int region)
/* Strictly speaking, for a somewhat constant set of clients where each client gets a constant bandwidth and is just enabled or disabled (somewhat dynamically), no action is necessary here to avoid starvation for non-zero-allocation clients, as the allocated slots will just be unused. However, handing out those unused ...
{ int i; int total_assigned = 0; int arbiter = 0; if (client & 0xffff0000) arbiter = 1; arbiters[arbiter].requested_slots[region][client] = 0; arbiters[arbiter].active_clients[region][client] = 0; for (i = 0; i < arbiters[arbiter].nbr_clients; i++) total_assigned += arbiters[arbiter].requested_slots[region][...
EmcraftSystems/linux-emcraft
C++
Other
266
/* DAC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_DAC_MspInit(DAC_HandleTypeDef *hdac)
/* DAC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_DAC_MspInit(DAC_HandleTypeDef *hdac)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hdac->Instance==DAC1) { __HAL_RCC_DAC1_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_5; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read available data from the read FIFO, as 8-bit data items. */
unsigned long EPINonBlockingReadGet8(unsigned long ulBase, unsigned long ulCount, unsigned char *pucBuf)
/* Read available data from the read FIFO, as 8-bit data items. */ unsigned long EPINonBlockingReadGet8(unsigned long ulBase, unsigned long ulCount, unsigned char *pucBuf)
{ unsigned long ulCountRead = 0; ASSERT(ulBase == EPI0_BASE); ASSERT(ulCount < 4096); ASSERT(pucBuf); while(HWREG(ulBase + EPI_O_RFIFOCNT) && ulCount--) { *pucBuf = (unsigned char)HWREG(ulBase + EPI_O_READFIFO); pucBuf++; ulCountRead++; } return(ulCountRead); }
watterott/WebRadio
C++
null
71
/* RETURNS: 0 on success, -EEXIST if entry with the given name already exists. */
int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
/* RETURNS: 0 on success, -EEXIST if entry with the given name already exists. */ int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
{ struct sysfs_inode_attrs *ps_iattr; if (sysfs_find_dirent(acxt->parent_sd, sd->s_name)) return -EEXIST; sd->s_parent = sysfs_get(acxt->parent_sd); sysfs_link_sibling(sd); ps_iattr = acxt->parent_sd->s_iattr; if (ps_iattr) { struct iattr *ps_iattrs = &ps_iattr->ia_iattr; ps_iattrs->ia_ctime = ps_iattrs->ia...
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the Flash Power Down in STOP mode. */
void PWR_FlashPowerDownCmd(FunctionalState NewState)
/* Enables or disables the Flash Power Down in STOP mode. */ void PWR_FlashPowerDownCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); *(__IO uint32_t *) CR_FPDS_BB = (uint32_t)NewState; }
MaJerle/stm32f429
C++
null
2,036
/* On SMP it's slightly faster (but much more power-consuming!) to poll the ->work.need_resched flag instead of waiting for the cross-CPU IPI to arrive. Use this option with caution. */
static void poll_idle(void)
/* On SMP it's slightly faster (but much more power-consuming!) to poll the ->work.need_resched flag instead of waiting for the cross-CPU IPI to arrive. Use this option with caution. */ static void poll_idle(void)
{ trace_power_start(POWER_CSTATE, 0); local_irq_enable(); while (!need_resched()) cpu_relax(); trace_power_end(0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ubi_close_volume - close UBI volume. @desc: volume descriptor */
void ubi_close_volume(struct ubi_volume_desc *desc)
/* ubi_close_volume - close UBI volume. @desc: volume descriptor */ void ubi_close_volume(struct ubi_volume_desc *desc)
{ struct ubi_volume *vol = desc->vol; struct ubi_device *ubi = vol->ubi; dbg_gen("close device %d, volume %d, mode %d", ubi->ubi_num, vol->vol_id, desc->mode); spin_lock(&ubi->volumes_lock); switch (desc->mode) { case UBI_READONLY: vol->readers -= 1; break; case UBI_READWRITE: vol->writers -= 1; break;...
4ms/stm32mp1-baremetal
C++
Other
137
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM4) { __HAL_RCC_TIM4_CLK_DISABLE(); } else if(htim_base->Instance==TIM14) { __HAL_RCC_TIM14_CLK_DISABLE(); } else if(htim_base->Instance==TIM16) { __HAL_RCC_TIM16_CLK_DISABLE(); } else if(htim_base->Instance==TIM17) { __HAL_RCC_TIM17_CLK_DISABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read a value from ucPhyReg within the PHY. *plStatus will be set to pdFALSE if there is an error. */
static unsigned short prvReadPHY(unsigned char ucPhyReg, long *plStatus)
/* Read a value from ucPhyReg within the PHY. *plStatus will be set to pdFALSE if there is an error. */ static unsigned short prvReadPHY(unsigned char ucPhyReg, long *plStatus)
{ long x; const long lMaxTime = 10; LPC_EMAC->MADR = DP83848C_DEF_ADR | ucPhyReg; LPC_EMAC->MCMD = MCMD_READ; for( x = 0; x < lMaxTime; x++ ) { if( ( LPC_EMAC->MIND & MIND_BUSY ) == 0 ) { break; } vTaskDelay( emacSHORT_DELAY ); } LPC_EMAC->MCMD = 0; if( x >= lMaxTime ) { *plStatus = pdFAIL; } ret...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Correlation distance between two vectors. The input vectors are modified in place ! */
float32_t arm_correlation_distance_f32(float32_t *pA, float32_t *pB, uint32_t blockSize)
/* Correlation distance between two vectors. The input vectors are modified in place ! */ float32_t arm_correlation_distance_f32(float32_t *pA, float32_t *pB, uint32_t blockSize)
{ float32_t ma,mb,pwra,pwrb,dot,tmp; arm_mean_f32(pA, blockSize, &ma); arm_mean_f32(pB, blockSize, &mb); arm_offset_f32(pA, -ma, pA, blockSize); arm_offset_f32(pB, -mb, pB, blockSize); arm_power_f32(pA, blockSize, &pwra); arm_power_f32(pB, blockSize, &pwrb); arm_dot_prod_f32(pA,pB,blockS...
STMicroelectronics/STM32CubeF4
C++
Other
789
/* new_wbuf_timer - start new write-buffer timer. @wbuf: write-buffer descriptor */
static void new_wbuf_timer_nolock(struct ubifs_wbuf *wbuf)
/* new_wbuf_timer - start new write-buffer timer. @wbuf: write-buffer descriptor */ static void new_wbuf_timer_nolock(struct ubifs_wbuf *wbuf)
{ ubifs_assert(!hrtimer_active(&wbuf->timer)); if (wbuf->no_timer) return; dbg_io("set timer for jhead %s, %llu-%llu millisecs", dbg_jhead(wbuf->jhead), div_u64(ktime_to_ns(wbuf->softlimit), USEC_PER_SEC), div_u64(ktime_to_ns(wbuf->softlimit) + wbuf->delta, USEC_PER_SEC)); hrtimer...
robutest/uclinux
C++
GPL-2.0
60
/* Return: true if the block is bad, false otherwise. */
bool nanddev_isbad(struct nand_device *nand, const struct nand_pos *pos)
/* Return: true if the block is bad, false otherwise. */ bool nanddev_isbad(struct nand_device *nand, const struct nand_pos *pos)
{ if (nanddev_bbt_is_initialized(nand)) { unsigned int entry; int status; entry = nanddev_bbt_pos_to_entry(nand, pos); status = nanddev_bbt_get_block_status(nand, entry); if (status == NAND_BBT_BLOCK_STATUS_UNKNOWN) { if (nand->ops->isbad(nand, pos)) status = NAND_BBT_BLOCK_FACTORY_BAD; else st...
4ms/stm32mp1-baremetal
C++
Other
137
/* Schedules a notification or indication for the specified peer-CCCD pair. If the update should be sent immediately, it is indicated in the return code. */
static uint8_t ble_gatts_schedule_update(struct ble_hs_conn *conn, struct ble_gatts_clt_cfg *clt_cfg)
/* Schedules a notification or indication for the specified peer-CCCD pair. If the update should be sent immediately, it is indicated in the return code. */ static uint8_t ble_gatts_schedule_update(struct ble_hs_conn *conn, struct ble_gatts_clt_cfg *clt_cfg)
{ uint8_t att_op; if (!(clt_cfg->flags & BLE_GATTS_CLT_CFG_F_MODIFIED)) { att_op = 0; } else if (clt_cfg->flags & BLE_GATTS_CLT_CFG_F_NOTIFY) { att_op = BLE_ATT_OP_NOTIFY_REQ; } else if (clt_cfg->flags & BLE_GATTS_CLT_CFG_F_INDICATE) { if (conn->bhc_gatt_svr.indicate_val_handle !...
Nicholas3388/LuaNode
C++
Other
1,055
/* Note: Multiple calls to _cairo_cache_freeze() will stack, in that the cache will remain "frozen" until a corresponding number of calls are made to _cairo_cache_thaw(). */
void _cairo_cache_freeze(cairo_cache_t *cache)
/* Note: Multiple calls to _cairo_cache_freeze() will stack, in that the cache will remain "frozen" until a corresponding number of calls are made to _cairo_cache_thaw(). */ void _cairo_cache_freeze(cairo_cache_t *cache)
{ assert (cache->freeze_count >= 0); cache->freeze_count++; }
xboot/xboot
C++
MIT License
779
/* Standard device request to get descriptors about USB device. */
static bool udc_req_std_dev_get_descriptor(void)
/* Standard device request to get descriptors about USB device. */ static bool udc_req_std_dev_get_descriptor(void)
{ switch ((uint8_t) (udd_g_ctrlreq.req.wValue >> 8)) { case USB_DT_DEVICE: udd_set_setup_payload( (uint8_t*)&udc_device_desc, udc_device_desc.bLength); break; case USB_DT_CONFIGURATION: udd_set_setup_payload( (uint8_t*)&udc_desc_fs, le16_to_cpu(udc_desc_fs.conf.wTotalLength)); break; case US...
remotemcu/remcu-chip-sdks
C++
null
436
/* Set the timer TOP/PERIOD value. When using MFRQ, the top value is defined by the CC0 register value and the PER value is ignored, so */
enum status_code tcc_set_top_value(const struct tcc_module *const module_inst, const uint32_t top_value)
/* Set the timer TOP/PERIOD value. When using MFRQ, the top value is defined by the CC0 register value and the PER value is ignored, so */ enum status_code tcc_set_top_value(const struct tcc_module *const module_inst, const uint32_t top_value)
{ Assert(module_inst); return _tcc_set_top_value(module_inst, top_value, module_inst->double_buffering_enabled); }
memfault/zero-to-main
C++
null
200
/* Converts a NVM Express Namespace device path structure to its string representative. */
VOID DevPathToTextNVMe(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
/* Converts a NVM Express Namespace device path structure to its string representative. */ VOID DevPathToTextNVMe(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
{ NVME_NAMESPACE_DEVICE_PATH *Nvme; UINT8 *Uuid; Nvme = DevPath; Uuid = (UINT8 *)&Nvme->NamespaceUuid; UefiDevicePathLibCatPrint ( Str, L"NVMe(0x%x,%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)", Nvme->NamespaceId, Uuid[7], Uuid[6], Uuid[5], Uuid[4], Uuid[3], ...
tianocore/edk2
C++
Other
4,240
/* The PWMB default IRQ, declared in StartUp code. */
void PWM1_BRK_IRQHandler(void)
/* The PWMB default IRQ, declared in StartUp code. */ void PWM1_BRK_IRQHandler(void)
{ unsigned long ulPWMStastus; unsigned long ulBase = PWMB_BASE; ulPWMStastus = xHWREG(ulBase + PWM_INTSTS) & 0xC0; xHWREG(ulBase + PWM_INTSTS) = ulPWMStastus; if (g_pfnPWMHandlerCallbacks[0] != 0) { if(ulPWMStastus & 0xC0) { g_pfnPWMHandlerCallbacks[1](0, PWM_EVENT_PWM, (ulPWMStastus), 0); } } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This API is used to get the fifo(int1_fifo) interrupt1 enable bits of the sensor in the registers 0x18 bit 5. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_intr1_fifo(u8 *v_intr_fifo_u8)
/* This API is used to get the fifo(int1_fifo) interrupt1 enable bits of the sensor in the registers 0x18 bit 5. */ BMG160_RETURN_FUNCTION_TYPE bmg160_get_intr1_fifo(u8 *v_intr_fifo_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_MAP_ONE_INTR1...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* reset is done by pulling bit 2 of DOR low for a while (old FDCs), or by setting the self clearing bit 7 of STATUS (newer FDCs) */
static void reset_fdc(void)
/* reset is done by pulling bit 2 of DOR low for a while (old FDCs), or by setting the self clearing bit 7 of STATUS (newer FDCs) */ static void reset_fdc(void)
{ unsigned long flags; do_floppy = reset_interrupt; FDCS->reset = 0; reset_fdc_info(0); flags = claim_dma_lock(); fd_disable_dma(); release_dma_lock(flags); if (FDCS->version >= FDC_82072A) fd_outb(0x80 | (FDCS->dtr & 3), FD_STATUS); else { fd_outb(FDCS->dor & ~0x04, FD_DOR); udelay(FD_RESET_DELAY); fd...
robutest/uclinux
C++
GPL-2.0
60
/* User-defined threshold value for xl interrupt event on generator 2. LSb = 16mg@2g / 32mg@4g / 62mg@8g / 186mg@16g. */
int32_t lis2dh12_int2_gen_threshold_set(stmdev_ctx_t *ctx, uint8_t val)
/* User-defined threshold value for xl interrupt event on generator 2. LSb = 16mg@2g / 32mg@4g / 62mg@8g / 186mg@16g. */ int32_t lis2dh12_int2_gen_threshold_set(stmdev_ctx_t *ctx, uint8_t val)
{ lis2dh12_int2_ths_t int2_ths; int32_t ret; ret = lis2dh12_read_reg(ctx, LIS2DH12_INT2_THS, (uint8_t *)&int2_ths, 1); if (ret == 0) { int2_ths.ths = val; ret = lis2dh12_write_reg(ctx, LIS2DH12_INT2_THS, (uint8_t *)&int2_ths, 1); } return ret; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Execute an SQL statement. Return a Cursor object if the statement is a query, otherwise return the number of tuples affected by the statement. */
static int conn_execute(lua_State *L)
/* Execute an SQL statement. Return a Cursor object if the statement is a query, otherwise return the number of tuples affected by the statement. */ static int conn_execute(lua_State *L)
{ lua_pushnumber(L, atof(PQcmdTuples(res))); PQclear (res); return 1; } else if (res && PQresultStatus(res)==PGRES_TUPLES_OK) return create_cursor (L, 1, res); else { PQclear (res); return luasql_faildirect(L, PQerrorMessage(conn->pg_conn)); } }
DC-SWAT/DreamShell
C++
null
404
/* Computes the 16-bit CRC of a given 16-bit data. */
uint32_t CRC_CalcCRC16bits(uint16_t CRC_Data)
/* Computes the 16-bit CRC of a given 16-bit data. */ uint32_t CRC_CalcCRC16bits(uint16_t CRC_Data)
{ *(uint16_t*)(CRC_BASE) = (uint16_t) CRC_Data; return (CRC->DR); }
ajhc/demo-cortex-m3
C++
null
38
/* Enables or disables the HRTIMx burst mode controller. */
void HRTIM_BurstModeCtl(HRTIM_TypeDef *HRTIMx, uint32_t Enable)
/* Enables or disables the HRTIMx burst mode controller. */ void HRTIM_BurstModeCtl(HRTIM_TypeDef *HRTIMx, uint32_t Enable)
{ uint32_t HRTIM_bmcr; assert_param(IS_HRTIM_BURSTMODECTL(Enable)); HRTIM_bmcr = HRTIMx->HRTIM_COMMON.BMCR; HRTIM_bmcr &= ~(HRTIM_BMCR_BME); HRTIM_bmcr |= Enable; HRTIMx->HRTIM_COMMON.BMCR = HRTIM_bmcr; }
remotemcu/remcu-chip-sdks
C++
null
436
/* This function segments the given skb and stores the list of segments in skb->next. */
static int dev_gso_segment(struct sk_buff *skb)
/* This function segments the given skb and stores the list of segments in skb->next. */ static int dev_gso_segment(struct sk_buff *skb)
{ struct net_device *dev = skb->dev; struct sk_buff *segs; int features = dev->features & ~(illegal_highdma(dev, skb) ? NETIF_F_SG : 0); segs = skb_gso_segment(skb, features); if (!segs) return 0; if (IS_ERR(segs)) return PTR_ERR(segs); skb->next = segs; DEV_GSO_CB(skb)->destructor = skb->destructor; ...
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function is derived from PowerPC code (timebase clock frequency). On ARM it returns the number of timer ticks per second. */
ulong get_tbclk(void)
/* This function is derived from PowerPC code (timebase clock frequency). On ARM it returns the number of timer ticks per second. */ ulong get_tbclk(void)
{ unsigned long freq; asm volatile("mrc p15, 0, %0, c14, c0, 0" : "=r" (freq)); return freq; }
4ms/stm32mp1-baremetal
C++
Other
137
/* param base LPUART peripheral base address. param handle LPUART handle pointer. param xfer LPUART transfer structure, see #lpuart_transfer_t. retval kStatus_Success Successfully start the data transmission. retval kStatus_LPUART_TxBusy Previous transmission still not finished, data not all written to the TX register....
status_t LPUART_TransferSendNonBlocking(LPUART_Type *base, lpuart_handle_t *handle, lpuart_transfer_t *xfer)
/* param base LPUART peripheral base address. param handle LPUART handle pointer. param xfer LPUART transfer structure, see #lpuart_transfer_t. retval kStatus_Success Successfully start the data transmission. retval kStatus_LPUART_TxBusy Previous transmission still not finished, data not all written to the TX register....
{ assert(handle); assert(xfer); assert(xfer->data); assert(xfer->dataSize); status_t status; if (kLPUART_TxBusy == handle->txState) { status = kStatus_LPUART_TxBusy; } else { handle->txData = xfer->data; handle->txDataSize = xfer->dataSize; handle-...
nanoframework/nf-interpreter
C++
MIT License
293
/* Just add 0xc0 at the end of skb, we can also use this to add 0xc0 at start while there is no data in skb */
static void h5_slip_msgdelim(sk_buff *skb)
/* Just add 0xc0 at the end of skb, we can also use this to add 0xc0 at start while there is no data in skb */ static void h5_slip_msgdelim(sk_buff *skb)
{ const char pkt_delim = 0xc0; memcpy(hci_skb_put(skb, 1), &pkt_delim, 1); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function takes a pointer to MAC address string (i.e."XX:XX:XX:XX:XX:XX", where "XX" is a two-digit hex number) and stores it in one of the MAC address fields of the EEPROM local copy. */
static void set_mac_address(unsigned int index, const char *string)
/* This function takes a pointer to MAC address string (i.e."XX:XX:XX:XX:XX:XX", where "XX" is a two-digit hex number) and stores it in one of the MAC address fields of the EEPROM local copy. */ static void set_mac_address(unsigned int index, const char *string)
{ char *p = (char *) string; unsigned int i; if ((index >= MAX_NUM_PORTS) || !string) { printf("Usage: mac <n> XX:XX:XX:XX:XX:XX\n"); return; } for (i = 0; *p && (i < 6); i++) { e.mac[index][i] = simple_strtoul(p, &p, 16); if (*p == ':') p++; } update_crc(); }
4ms/stm32mp1-baremetal
C++
Other
137
/* fi An instance of a channel statemachine. event The event, just happened. arg Generic pointer, casted from channel * upon call. */
static void ctcm_chx_rxinitfail(fsm_instance *fi, int event, void *arg)
/* fi An instance of a channel statemachine. event The event, just happened. arg Generic pointer, casted from channel * upon call. */ static void ctcm_chx_rxinitfail(fsm_instance *fi, int event, void *arg)
{ struct channel *ch = arg; struct net_device *dev = ch->netdev; struct ctcm_priv *priv = dev->ml_priv; CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, "%s(%s): RX %s busy, init. fail", CTCM_FUNTAIL, dev->name, ch->id); fsm_newstate(fi, CTC_STATE_RXERR); fsm_event(priv->fsm, DEV_EVENT_RXDOWN, dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Determines if the hardware module(s) are currently synchronizing to the bus. Checks to see if the underlying hardware peripheral module(s) are currently synchronizing across multiple clock domains to the hardware bus, This function can be used to delay further operations on a module until such time that it is ready...
static bool extint_is_syncing(void)
/* Determines if the hardware module(s) are currently synchronizing to the bus. Checks to see if the underlying hardware peripheral module(s) are currently synchronizing across multiple clock domains to the hardware bus, This function can be used to delay further operations on a module until such time that it is ready...
{ Eic *const eics[EIC_INST_NUM] = EIC_INSTS; for (uint32_t i = 0; i < EIC_INST_NUM; i++) { if((eics[i]->SYNCBUSY.reg & EIC_SYNCBUSY_ENABLE) || (eics[i]->SYNCBUSY.reg & EIC_SYNCBUSY_SWRST)){ return true; } } return false; }
memfault/zero-to-main
C++
null
200
/* This is the first entry point into the dissector, called on program launch. */
void proto_register_dof(void)
/* This is the first entry point into the dissector, called on program launch. */ void proto_register_dof(void)
{ dof_tun_register(); dof_register(); oid_register(); dof_dnp_register(); dof_dpp_register(); app_register(); dof_dsp_register(); dof_ccm_register(); dof_oap_register(); dof_sgmp_register(); dof_tep_register(); dof_trp_register(); register_init_routine(&dof_reset_rout...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Event notification function for SIMPLE_TEXT_INPUT_EX_PROTOCOL.WaitForKeyEx event. Signal the event if there is key available */
VOID EFIAPI VirtualKeyboardWaitForKeyEx(IN EFI_EVENT Event, IN VOID *Context)
/* Event notification function for SIMPLE_TEXT_INPUT_EX_PROTOCOL.WaitForKeyEx event. Signal the event if there is key available */ VOID EFIAPI VirtualKeyboardWaitForKeyEx(IN EFI_EVENT Event, IN VOID *Context)
{ VIRTUAL_KEYBOARD_DEV *VirtualKeyboardPrivate; VirtualKeyboardPrivate = TEXT_INPUT_EX_VIRTUAL_KEYBOARD_DEV_FROM_THIS (Context); VirtualKeyboardWaitForKey (Event, &VirtualKeyboardPrivate->SimpleTextIn); }
tianocore/edk2
C++
Other
4,240
/* Returns CR_OK upon successfull completion, an errror code otherwise. */
enum CRStatus cr_statement_set_parent_sheet(CRStatement *a_this, CRStyleSheet *a_sheet)
/* Returns CR_OK upon successfull completion, an errror code otherwise. */ enum CRStatus cr_statement_set_parent_sheet(CRStatement *a_this, CRStyleSheet *a_sheet)
{ g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR); a_this->parent_sheet = a_sheet; return CR_OK; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Return 1 if the buffer has some data that has been logged (at any point, not just the current transaction) and 0 if not. */
uint xfs_buf_item_dirty(xfs_buf_log_item_t *bip)
/* Return 1 if the buffer has some data that has been logged (at any point, not just the current transaction) and 0 if not. */ uint xfs_buf_item_dirty(xfs_buf_log_item_t *bip)
{ return (bip->bli_flags & XFS_BLI_DIRTY); }
robutest/uclinux
C++
GPL-2.0
60