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
/* Indentifies a DMA channel causing interrupt. This functions returns a channel causing interrupt of type dmacHw_INTERRUPT_STATUS_e */
dmacHw_HANDLE_t dmacHw_getInterruptSource(void)
/* Indentifies a DMA channel causing interrupt. This functions returns a channel causing interrupt of type dmacHw_INTERRUPT_STATUS_e */ dmacHw_HANDLE_t dmacHw_getInterruptSource(void)
{ uint32_t i; for (i = 0; i < dmaChannelCount_0 + dmaChannelCount_1; i++) { if ((dmacHw_REG_INT_STAT_TRAN(dmacHw_gCblk[i].module) & ((0x00000001 << dmacHw_gCblk[i].channel))) || (dmacHw_REG_INT_STAT_BLOCK(dmacHw_gCblk[i].module) & ((0x00000001 << dmacHw_gCblk[i].channel))) || (dmacHw_REG_INT_STAT_ERROR(dmacHw_gCblk[i].module) & ((0x00000001 << dmacHw_gCblk[i].channel))) ) { return dmacHw_CBLK_TO_HANDLE(&dmacHw_gCblk[i]); } } return dmacHw_CBLK_TO_HANDLE(NULL); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function returns a reference to the window that should be used when managing the widget, such as move, resize, destroy and reparenting. */
struct win_window* wtk_button_as_child(struct wtk_button *button)
/* This function returns a reference to the window that should be used when managing the widget, such as move, resize, destroy and reparenting. */ struct win_window* wtk_button_as_child(struct wtk_button *button)
{ Assert(button); return button->container; }
memfault/zero-to-main
C++
null
200
/* Compute the highest mode possible if we are not using iordy. Return -1 if no iordy mode is available. */
static u32 ata_pio_mask_no_iordy(const struct ata_device *adev)
/* Compute the highest mode possible if we are not using iordy. Return -1 if no iordy mode is available. */ static u32 ata_pio_mask_no_iordy(const struct ata_device *adev)
{ if (adev->id[ATA_ID_FIELD_VALID] & 2) { u16 pio = adev->id[ATA_ID_EIDE_PIO]; if (pio) { if (pio > 240) return 3 << ATA_SHIFT_PIO; return 7 << ATA_SHIFT_PIO; } } return 3 << ATA_SHIFT_PIO; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI SdMmcPciHcComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */ EFI_STATUS EFIAPI SdMmcPciHcComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mSdMmcPciHcDriverNameTable, DriverName, (BOOLEAN)(This == &gSdMmcPciHcComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* Simple form of proto_reg_handoff_lisp which can be used if there are no prefs-dependent registration function calls. */
void proto_reg_handoff_lisp(void)
/* Simple form of proto_reg_handoff_lisp which can be used if there are no prefs-dependent registration function calls. */ void proto_reg_handoff_lisp(void)
{ dissector_add_uint("udp.port", LISP_CONTROL_PORT, lisp_handle); ipv4_handle = find_dissector_add_dependency("ip", proto_lisp); ipv6_handle = find_dissector_add_dependency("ipv6", proto_lisp); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Retrieves the raw acceleration data from the IMU. */
void IMU_getAccelerometerData(float avec[3])
/* Retrieves the raw acceleration data from the IMU. */ void IMU_getAccelerometerData(float avec[3])
{ if( IMU_state != IMU_STATE_READY ){ avec[0] = 0; avec[1] = 0; avec[2] = 0; return; } ICM20648_accelDataRead( avec ); return; }
remotemcu/remcu-chip-sdks
C++
null
436
/* If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 16-bit boundary, then ASSERT(). If Length is not aligned on a 16-bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
UINT16 EFIAPI CalculateSum16(IN CONST UINT16 *Buffer, IN UINTN Length)
/* If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 16-bit boundary, then ASSERT(). If Length is not aligned on a 16-bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */ UINT16 EFIAPI CalculateSum16(IN CONST UINT16 *Buffer, IN UINTN Length)
{ UINT16 Sum; UINTN Count; UINTN Total; ASSERT (Buffer != NULL); ASSERT (((UINTN)Buffer & 0x1) == 0); ASSERT ((Length & 0x1) == 0); ASSERT (Length <= (MAX_ADDRESS - ((UINTN)Buffer) + 1)); Total = Length / sizeof (*Buffer); for (Sum = 0, Count = 0; Count < Total; Count++) { Sum = (UINT16)(Sum + *(Buffer + Count)); } return Sum; }
tianocore/edk2
C++
Other
4,240
/* Get WDT interrupt status. Get WDT interrupt status. */
uint8_t wdt_get_interrupt_status(struct wdt_module *const module)
/* Get WDT interrupt status. Get WDT interrupt status. */ uint8_t wdt_get_interrupt_status(struct wdt_module *const module)
{ return module->hw->WDOGMIS.reg; }
memfault/zero-to-main
C++
null
200
/* One time initialization to let the world know Dino is here. This is the only routine which is NOT static. Must be called exactly once before pci_init(). */
int __init dino_init(void)
/* One time initialization to let the world know Dino is here. This is the only routine which is NOT static. Must be called exactly once before pci_init(). */ int __init dino_init(void)
{ register_parisc_driver(&dino_driver); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Return pointers to various CE-related structures for the CE upstream of @pci_dev. */
static void pcidev_to_tioce(struct pci_dev *pdev, struct tioce __iomem **base, struct tioce_kernel **kernel, int *port)
/* Return pointers to various CE-related structures for the CE upstream of @pci_dev. */ static void pcidev_to_tioce(struct pci_dev *pdev, struct tioce __iomem **base, struct tioce_kernel **kernel, int *port)
{ struct pcidev_info *pcidev_info; struct tioce_common *ce_common; struct tioce_kernel *ce_kernel; pcidev_info = SN_PCIDEV_INFO(pdev); ce_common = (struct tioce_common *)pcidev_info->pdi_pcibus_info; ce_kernel = (struct tioce_kernel *)ce_common->ce_kernel_private; if (base) *base = (struct tioce __iomem *)ce_common->ce_pcibus.bs_base; if (kernel) *kernel = ce_kernel; if (port) *port = (pdev->bus->number < ce_kernel->ce_port1_secondary) ? 0 : 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reverses the effect of usb_hcd_pxa27x_probe(), first invoking the HCD's stop() method. It is always called from a thread context, normally "rmmod", "apmd", or something similar. */
void usb_hcd_pxa27x_remove(struct usb_hcd *hcd, struct platform_device *pdev)
/* Reverses the effect of usb_hcd_pxa27x_probe(), first invoking the HCD's stop() method. It is always called from a thread context, normally "rmmod", "apmd", or something similar. */ void usb_hcd_pxa27x_remove(struct usb_hcd *hcd, struct platform_device *pdev)
{ struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); usb_remove_hcd(hcd); pxa27x_stop_hc(ohci, &pdev->dev); iounmap(hcd->regs); release_mem_region(hcd->rsrc_start, hcd->rsrc_len); usb_put_hcd(hcd); clk_put(ohci->clk); }
robutest/uclinux
C++
GPL-2.0
60
/* @read a character from the modem line with timeout. @eat parity, XON and XOFF characters. */
rt_int16_t zxor_read(void)
/* @read a character from the modem line with timeout. @eat parity, XON and XOFF characters. */ rt_int16_t zxor_read(void)
{ rt_int16_t res; for (;;) { if ((res = zread_line(100)) < 0) return res; switch (res &= 0177) { case XON: case XOFF: continue; case '\r': case '\n': case ZDLE: default: return res; } } }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* The EDA cache is removed and reinitilized when the WSS is removed. We thus loose knowledge of members of this WSS at that time and need not do it here. */
void wlp_wss_release(struct kobject *kobj)
/* The EDA cache is removed and reinitilized when the WSS is removed. We thus loose knowledge of members of this WSS at that time and need not do it here. */ void wlp_wss_release(struct kobject *kobj)
{ struct wlp_wss *wss = container_of(kobj, struct wlp_wss, kobj); wlp_wss_reset(wss); }
robutest/uclinux
C++
GPL-2.0
60
/* Read the next element, but only the header. The contents are supposed to be sub-elements which can be read separately. 0 is success, < 0 is failure. */
static int ebml_read_master(MatroskaDemuxContext *matroska, int length)
/* Read the next element, but only the header. The contents are supposed to be sub-elements which can be read separately. 0 is success, < 0 is failure. */ static int ebml_read_master(MatroskaDemuxContext *matroska, int length)
{ ByteIOContext *pb = matroska->ctx->pb; MatroskaLevel *level; if (matroska->num_levels >= EBML_MAX_DEPTH) { av_log(matroska->ctx, AV_LOG_ERROR, "File moves beyond max. allowed depth (%d)\n", EBML_MAX_DEPTH); return AVERROR(ENOSYS); } level = &matroska->levels[matroska->num_levels++]; level->start = url_ftell(pb); level->length = length; return 0; }
DC-SWAT/DreamShell
C++
null
404
/* This function resets the adapter and re-initializes it. This function assumes that all new host commands have been stopped. Return value: SUCCESS / FAILED */
static int ipr_reset_reload(struct ipr_ioa_cfg *ioa_cfg, enum ipr_shutdown_type shutdown_type)
/* This function resets the adapter and re-initializes it. This function assumes that all new host commands have been stopped. Return value: SUCCESS / FAILED */ static int ipr_reset_reload(struct ipr_ioa_cfg *ioa_cfg, enum ipr_shutdown_type shutdown_type)
{ if (!ioa_cfg->in_reset_reload) ipr_initiate_ioa_reset(ioa_cfg, shutdown_type); spin_unlock_irq(ioa_cfg->host->host_lock); wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); spin_lock_irq(ioa_cfg->host->host_lock); if (ioa_cfg->ioa_is_dead) { ipr_trace; return FAILED; } return SUCCESS; }
robutest/uclinux
C++
GPL-2.0
60
/* Master sends single byte through the USIx peripheral according to the set of the upper layer. */
void USI_I2C_MasterSendNullData(USI_TypeDef *USIx, u8 *pBuf, u8 I2CCmd, u8 I2CStop, u8 I2CReSTR)
/* Master sends single byte through the USIx peripheral according to the set of the upper layer. */ void USI_I2C_MasterSendNullData(USI_TypeDef *USIx, u8 *pBuf, u8 I2CCmd, u8 I2CStop, u8 I2CReSTR)
{ assert_param(IS_USI_I2C_ALL_PERIPH(USIx)); USIx->TX_FIFO_WRITE = *(pBuf) | (1 << 11) | (I2CReSTR << 10) | (I2CCmd << 8) | (I2CStop << 9); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Enable the HW timer tick interrupts with a period <period> in microseconds */
void hwtimer_enable(uint64_t period)
/* Enable the HW timer tick interrupts with a period <period> in microseconds */ void hwtimer_enable(uint64_t period)
{ tick_p = period; hw_timer_tick_timer = hwm_get_time() + tick_p; hwtimer_update_timer(); hwm_find_next_timer(); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function will install a interrupt service routine to a interrupt. */
rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, void *param, const char *name)
/* This function will install a interrupt service routine to a interrupt. */ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, void *param, const char *name)
{ rt_isr_handler_t old_handler = RT_NULL; if (vector < IRQ_TOTAL_NUM) { uint32_t cpu_ie = PICCON & BIT(0); PICCON &= ~BIT(0); old_handler = tbl_irq_vector[vector]; tbl_irq_vector[vector] = handler; irq_mask |= BIT(vector); PICCON |= cpu_ie; PICPR &= ~BIT(vector); PICEN |= BIT(vector); } return old_handler; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function may sleep. Locking for SCU accesses is handled for the caller. */
int scu_ipc_simple_command(u32 cmd, u32 sub)
/* This function may sleep. Locking for SCU accesses is handled for the caller. */ int scu_ipc_simple_command(u32 cmd, u32 sub)
{ struct scu *scu; struct udevice *dev; int ret; ret = syscon_get_by_driver_data(X86_SYSCON_SCU, &dev); if (ret) return ret; scu = dev_get_priv(dev); scu_ipc_send_command(scu->regs, sub << 12 | cmd); return scu_ipc_check_status(scu->regs); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Converts an ucs1 string into an utf8 string. */
enum CRStatus cr_utils_ucs1_str_to_utf8(const guchar *a_in, gulong *a_in_len, guchar **a_out, gulong *a_out_len)
/* Converts an ucs1 string into an utf8 string. */ enum CRStatus cr_utils_ucs1_str_to_utf8(const guchar *a_in, gulong *a_in_len, guchar **a_out, gulong *a_out_len)
{ gulong in_len = 0, out_len = 0; enum CRStatus status = CR_OK; g_return_val_if_fail (a_in && a_in_len && a_out && a_out_len, CR_BAD_PARAM_ERROR); if (*a_in_len < 1) { *a_out_len = 0; *a_out = NULL; return CR_OK; } status = cr_utils_ucs1_str_len_as_utf8 (a_in, &a_in[*a_in_len - 1], &out_len); g_return_val_if_fail (status == CR_OK, status); in_len = *a_in_len; *a_out = g_malloc0 (out_len); status = cr_utils_ucs1_to_utf8 (a_in, a_in_len, *a_out, &out_len); *a_out_len = out_len; return status; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Halt HC, turn off all ports, and let the BIOS use the companion controllers. Should be called with ehci->lock held. */
static void ehci_silence_controller(struct ehci_hcd *ehci)
/* Halt HC, turn off all ports, and let the BIOS use the companion controllers. Should be called with ehci->lock held. */ static void ehci_silence_controller(struct ehci_hcd *ehci)
{ ehci_halt(ehci); ehci_turn_off_all_ports(ehci); ehci_writel(ehci, 0, &ehci->regs->configured_flag); ehci_readl(ehci, &ehci->regs->configured_flag); }
robutest/uclinux
C++
GPL-2.0
60
/* The application entry point. Created on: Oct 27, 2021 Author: derek */
int main(void)
/* The application entry point. Created on: Oct 27, 2021 Author: derek */ int main(void)
{ HAL_Init(); SystemClock_Config(CPU_CLK_240M); MX_FREERTOS_Init(); while (1) { HAL_Delay(10); } }
pikasTech/PikaPython
C++
MIT License
1,403
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C slave driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */
void LPI2C_SlaveTransferCreateHandle(LPI2C_Type *base, lpi2c_slave_handle_t *handle, lpi2c_slave_transfer_callback_t callback, void *userData)
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C slave driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */ void LPI2C_SlaveTransferCreateHandle(LPI2C_Type *base, lpi2c_slave_handle_t *handle, lpi2c_slave_transfer_callback_t callback, void *userData)
{ uint32_t instance; assert(NULL != handle); lpi2c_to_lpflexcomm_t handler; (void)memset(&handler, 0, sizeof(handler)); (void)memset(handle, 0, sizeof(*handle)); instance = LPI2C_GetInstance(base); handle->callback = callback; handle->userData = userData; handler.lpi2c_slave_handler = LPI2C_SlaveTransferHandleIRQ; LP_FLEXCOMM_SetIRQHandler(LPI2C_GetInstance(base), handler.lpflexcomm_handler, handle, LP_FLEXCOMM_PERIPH_LPI2C); LPI2C_SlaveDisableInterrupts(base, (uint32_t)kLPI2C_SlaveIrqFlags); (void)EnableIRQ(kLpi2cIrqs[instance]); base->STAR = LPI2C_STAR_TXNACK_MASK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function increments the last byte of the counter by one and continues rolling over to more significant bytes if the byte was incremented from 0xff to 0x00. */
void inc_byte_array(u8 *counter, int len)
/* This function increments the last byte of the counter by one and continues rolling over to more significant bytes if the byte was incremented from 0xff to 0x00. */ void inc_byte_array(u8 *counter, int len)
{ int pos = len - 1; while (pos >= 0) { counter[pos]++; if (counter[pos] != 0) break; pos--; } }
robutest/uclinux
C++
GPL-2.0
60
/* If 32-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI IoRead32(IN UINTN Port)
/* If 32-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI IoRead32(IN UINTN Port)
{ CONST EFI_PEI_SERVICES **PeiServices; EFI_PEI_CPU_IO_PPI *CpuIo; PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; ASSERT (CpuIo != NULL); ASSERT ((Port & 3) == 0); return CpuIo->IoRead32 (PeiServices, CpuIo, (UINT64)Port); }
tianocore/edk2
C++
Other
4,240
/* Returns SRTC time in seconds. This function is used internally to get actual SRTC time in seconds. */
static uint32_t SNVS_LP_SRTC_GetSeconds(SNVS_Type *base)
/* Returns SRTC time in seconds. This function is used internally to get actual SRTC time in seconds. */ static uint32_t SNVS_LP_SRTC_GetSeconds(SNVS_Type *base)
{ uint32_t seconds = 0; uint32_t tmp = 0; do { seconds = tmp; tmp = (base->LPSRTCMR << 17U) | (base->LPSRTCLR >> 15U); } while (tmp != seconds); return seconds; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Unregisters a callback. Unregisters and disable a callback function implemented by the user. */
void aon_sleep_timer_unregister_callback(void)
/* Unregisters a callback. Unregisters and disable a callback function implemented by the user. */ void aon_sleep_timer_unregister_callback(void)
{ aon_sleep_timer_callback = NULL; }
memfault/zero-to-main
C++
null
200
/* On UP this means the setting of the need_resched flag, on SMP it might also involve a cross-CPU call to trigger the scheduler on the target CPU. */
static void resched_task(struct task_struct *p)
/* On UP this means the setting of the need_resched flag, on SMP it might also involve a cross-CPU call to trigger the scheduler on the target CPU. */ static void resched_task(struct task_struct *p)
{ assert_raw_spin_locked(&task_rq(p)->lock); set_tsk_need_resched(p); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Determines the description of a fieldbus adapter of the device list and increases the internal list index so that a subsequent call of the function supplies the description to the next adapter. */
static HRESULT IxxatVciLibFuncVciEnumDeviceNext(HANDLE hEnum, PVCIDEVICEINFO pInfo)
/* Determines the description of a fieldbus adapter of the device list and increases the internal list index so that a subsequent call of the function supplies the description to the next adapter. */ static HRESULT IxxatVciLibFuncVciEnumDeviceNext(HANDLE hEnum, PVCIDEVICEINFO pInfo)
{ HRESULT result = VCI_E_UNEXPECTED; assert(ixxatVciLibFuncVciEnumDeviceNextPtr != NULL); assert(ixxatVciDllHandle != NULL); if ((ixxatVciLibFuncVciEnumDeviceNextPtr != NULL) && (ixxatVciDllHandle != NULL)) { result = ixxatVciLibFuncVciEnumDeviceNextPtr(hEnum, pInfo); } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* i8042_flush() flushes all data that may be in the keyboard and mouse buffers of the i8042 down the toilet. */
static int i8042_flush(void)
/* i8042_flush() flushes all data that may be in the keyboard and mouse buffers of the i8042 down the toilet. */ static int i8042_flush(void)
{ unsigned long flags; unsigned char data, str; int i = 0; spin_lock_irqsave(&i8042_lock, flags); while (((str = i8042_read_status()) & I8042_STR_OBF) && (i < I8042_BUFFER_SIZE)) { udelay(50); data = i8042_read_data(); i++; dbg("%02x <- i8042 (flush, %s)", data, str & I8042_STR_AUXDATA ? "aux" : "kbd"); } spin_unlock_irqrestore(&i8042_lock, flags); return i; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the next name in '*path' = 'name1;name2;name3;...', changing the ending ';' to '\0' to create a zero-terminated string. Return NULL when list ends. */
static const char* getnextfilename(char **path, char *end)
/* Get the next name in '*path' = 'name1;name2;name3;...', changing the ending ';' to '\0' to create a zero-terminated string. Return NULL when list ends. */ static const char* getnextfilename(char **path, char *end)
{ *name = *LUA_PATH_SEP; name++; } sep = strchr(name, *LUA_PATH_SEP); if (sep == NULL) sep = end; *sep = '\0'; *path = sep; return name; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Change Logs: Date Author Notes Fan YANG first version */
void thread_entry(void *arg)
/* Change Logs: Date Author Notes Fan YANG first version */ void thread_entry(void *arg)
{ while(1){ app_led_write(0, APP_LED_ON); rt_thread_mdelay(500); app_led_write(0, APP_LED_OFF); rt_thread_mdelay(500); app_led_write(1, APP_LED_ON); rt_thread_mdelay(500); app_led_write(1, APP_LED_OFF); rt_thread_mdelay(500); app_led_write(2, APP_LED_ON); rt_thread_mdelay(500); app_led_write(2, APP_LED_OFF); rt_thread_mdelay(500); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enable the window prober timer and set the timeout value. */
VOID TcpSetProbeTimer(IN OUT TCP_CB *Tcb)
/* Enable the window prober timer and set the timeout value. */ VOID TcpSetProbeTimer(IN OUT TCP_CB *Tcb)
{ if (!Tcb->ProbeTimerOn) { Tcb->ProbeTime = Tcb->Rto; Tcb->ProbeTimerOn = TRUE; } else { Tcb->ProbeTime <<= 1; } if (Tcb->ProbeTime < TCP_RTO_MIN) { Tcb->ProbeTime = TCP_RTO_MIN; } else if (Tcb->ProbeTime > TCP_RTO_MAX) { Tcb->ProbeTime = TCP_RTO_MAX; } TcpSetTimer (Tcb, TCP_TIMER_PROBE, Tcb->ProbeTime); }
tianocore/edk2
C++
Other
4,240
/* Return: 0 in case of success, a negative error code otherwise. */
int spi_controller_dma_map_mem_op_data(struct spi_controller *ctlr, const struct spi_mem_op *op, struct sg_table *sgt)
/* Return: 0 in case of success, a negative error code otherwise. */ int spi_controller_dma_map_mem_op_data(struct spi_controller *ctlr, const struct spi_mem_op *op, struct sg_table *sgt)
{ struct device *dmadev; if (!op->data.nbytes) return -EINVAL; if (op->data.dir == SPI_MEM_DATA_OUT && ctlr->dma_tx) dmadev = ctlr->dma_tx->device->dev; else if (op->data.dir == SPI_MEM_DATA_IN && ctlr->dma_rx) dmadev = ctlr->dma_rx->device->dev; else dmadev = ctlr->dev.parent; if (!dmadev) return -EINVAL; return spi_map_buf(ctlr, dmadev, sgt, op->data.buf.in, op->data.nbytes, op->data.dir == SPI_MEM_DATA_IN ? DMA_FROM_DEVICE : DMA_TO_DEVICE); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Shared IRQ handler that can call both master and slave ISRs. The master and slave ISRs are called through function pointers in order to decouple this code from the ISR functions. Without this, the linker would always pull in both ISRs and every function they call, even if only the functional API was used. */
static void LPI2C_CommonIRQHandler(LPI2C_Type *base, uint32_t instance)
/* Shared IRQ handler that can call both master and slave ISRs. The master and slave ISRs are called through function pointers in order to decouple this code from the ISR functions. Without this, the linker would always pull in both ISRs and every function they call, even if only the functional API was used. */ static void LPI2C_CommonIRQHandler(LPI2C_Type *base, uint32_t instance)
{ if ((base->MCR & LPI2C_MCR_MEN_MASK) && s_lpi2cMasterIsr) { s_lpi2cMasterIsr(base, s_lpi2cMasterHandle[instance]); } if ((base->SCR & LPI2C_SCR_SEN_MASK) && s_lpi2cSlaveIsr) { s_lpi2cSlaveIsr(base, s_lpi2cSlaveHandle[instance]); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* edma_read_slot - read parameter RAM data from slot @slot: number of parameter RAM slot being copied */
void edma_read_slot(unsigned slot, struct edmacc_param *param)
/* edma_read_slot - read parameter RAM data from slot @slot: number of parameter RAM slot being copied */ void edma_read_slot(unsigned slot, struct edmacc_param *param)
{ unsigned ctlr; ctlr = EDMA_CTLR(slot); slot = EDMA_CHAN_SLOT(slot); if (slot >= edma_cc[ctlr]->num_slots) return; rt_memcpy(param, (void *)(edmacc_regs_base[ctlr] + PARM_OFFSET(slot)), PARM_SIZE); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* CAN Initialize a 16bit Message ID Mask Filter. */
void can_filter_id_mask_16bit_init(uint32_t nr, uint16_t id1, uint16_t mask1, uint16_t id2, uint16_t mask2, uint32_t fifo, bool enable)
/* CAN Initialize a 16bit Message ID Mask Filter. */ void can_filter_id_mask_16bit_init(uint32_t nr, uint16_t id1, uint16_t mask1, uint16_t id2, uint16_t mask2, uint32_t fifo, bool enable)
{ can_filter_init(nr, false, false, ((uint32_t)mask1 << 16) | (uint32_t)id1, ((uint32_t)mask2 << 16) | (uint32_t)id2, fifo, enable); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Returns: TRUE if the returned charset is UTF-8 */
gboolean g_get_charset(const char **charset)
/* Returns: TRUE if the returned charset is UTF-8 */ gboolean g_get_charset(const char **charset)
{ static GPrivate cache_private = G_PRIVATE_INIT (charset_cache_free); GCharsetCache *cache = g_private_get (&cache_private); const gchar *raw; if (!cache) { cache = g_new0 (GCharsetCache, 1); g_private_set (&cache_private, cache); } G_LOCK (aliases); raw = _g_locale_charset_raw (); G_UNLOCK (aliases); if (!(cache->raw && strcmp (cache->raw, raw) == 0)) { const gchar *new_charset; g_free (cache->raw); g_free (cache->charset); cache->raw = g_strdup (raw); cache->is_utf8 = g_utf8_get_charset_internal (raw, &new_charset); cache->charset = g_strdup (new_charset); } if (charset) *charset = cache->charset; return cache->is_utf8; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* device_shutdown - call ->shutdown() on each device to shutdown. */
void device_shutdown(void)
/* device_shutdown - call ->shutdown() on each device to shutdown. */ void device_shutdown(void)
{ struct device *dev, *devn; list_for_each_entry_safe_reverse(dev, devn, &devices_kset->list, kobj.entry) { if (dev->bus && dev->bus->shutdown) { dev_dbg(dev, "shutdown\n"); dev->bus->shutdown(dev); } else if (dev->driver && dev->driver->shutdown) { dev_dbg(dev, "shutdown\n"); dev->driver->shutdown(dev); } } async_synchronize_full(); }
robutest/uclinux
C++
GPL-2.0
60
/* Decode and handle standard end point requests originating on the control end point. */
static void prvHandleStandardEndPointRequest(xUSB_REQUEST *pxRequest)
/* Decode and handle standard end point requests originating on the control end point. */ static void prvHandleStandardEndPointRequest(xUSB_REQUEST *pxRequest)
{ switch( pxRequest->ucRequest ) { case usbGET_STATUS_REQUEST: case usbCLEAR_FEATURE_REQUEST: case usbSET_FEATURE_REQUEST: default: prvSendStall(); break; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* This file is part of the Simba project. */
int mock_write_gnss_module_init(int res)
/* This file is part of the Simba project. */ int mock_write_gnss_module_init(int res)
{ harness_mock_write("gnss_module_init()", NULL, 0); harness_mock_write("gnss_module_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* Enable the output direction of the specified GPIO. */
int32_t gpio_direction_output(gpio_desc *desc, uint8_t value)
/* Enable the output direction of the specified GPIO. */ int32_t gpio_direction_output(gpio_desc *desc, uint8_t value)
{ int32_t ret; uint16_t pin; uint8_t port; gpio_get_portpin(desc, &pin, &port); ret = adi_gpio_OutputEnable(port, pin, true); if(ret != 0) return ret; if(value == 1) return adi_gpio_SetHigh(port, pin); else return adi_gpio_SetLow(port, pin); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Derive SHA256 HMAC-based Extract-and-Expand Key Derivation Function (HKDF). */
BOOLEAN EFIAPI HkdfSha256ExtractAndExpand(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Salt, IN UINTN SaltSize, IN CONST UINT8 *Info, IN UINTN InfoSize, OUT UINT8 *Out, IN UINTN OutSize)
/* Derive SHA256 HMAC-based Extract-and-Expand Key Derivation Function (HKDF). */ BOOLEAN EFIAPI HkdfSha256ExtractAndExpand(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Salt, IN UINTN SaltSize, IN CONST UINT8 *Info, IN UINTN InfoSize, OUT UINT8 *Out, IN UINTN OutSize)
{ return HkdfMdExtractAndExpand (MBEDTLS_MD_SHA256, Key, KeySize, Salt, SaltSize, Info, InfoSize, Out, OutSize); }
tianocore/edk2
C++
Other
4,240
/* param name The name of the selected ldo. Please see the enumeration pmu_ldo_name_t for details. param setpointMap The map of setpoints that the LDO low power mode will be enabled in those setpoints if STBY assert, this value should be the OR'ed Value of _pmu_setpoint_map. */
void PMU_GPCEnableLdoStandbyMode(pmu_ldo_name_t name, uint32_t setpointMap)
/* param name The name of the selected ldo. Please see the enumeration pmu_ldo_name_t for details. param setpointMap The map of setpoints that the LDO low power mode will be enabled in those setpoints if STBY assert, this value should be the OR'ed Value of _pmu_setpoint_map. */ void PMU_GPCEnableLdoStandbyMode(pmu_ldo_name_t name, uint32_t setpointMap)
{ assert(name != kPMU_SnvsDigLdo); uint32_t ldoStandbyEnableRegArray[] = PMU_LDO_STBY_EN_REGISTERS; (*(volatile uint32_t *)ldoStandbyEnableRegArray[(uint8_t)name]) = setpointMap; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function parses the IORT Named Component node. */
STATIC VOID DumpIortNodeNamedComponent(IN UINT8 *Ptr, IN UINT16 Length, IN UINT32 MappingCount, IN UINT32 MappingOffset)
/* This function parses the IORT Named Component node. */ STATIC VOID DumpIortNodeNamedComponent(IN UINT8 *Ptr, IN UINT16 Length, IN UINT32 MappingCount, IN UINT32 MappingOffset)
{ UINT32 Offset; Offset = ParseAcpi ( TRUE, 2, "Named Component Node", Ptr, Length, PARSER_PARAMS (IortNodeNamedComponentParser) ); PrintFieldName (2, L"Device Object Name"); while ((*(Ptr + Offset) != 0) && (Offset < Length)) { Print (L"%c", *(Ptr + Offset)); Offset++; } Print (L"\n"); DumpIortNodeIdMappings ( Ptr + MappingOffset, Length - MappingOffset, MappingCount ); }
tianocore/edk2
C++
Other
4,240
/* Compose two values, using a bitmask as decision value This is equivalent to (a & mask) | (b & ~mask) */
static unsigned long comp(unsigned long a, unsigned long b, unsigned long mask)
/* Compose two values, using a bitmask as decision value This is equivalent to (a & mask) | (b & ~mask) */ static unsigned long comp(unsigned long a, unsigned long b, unsigned long mask)
{ return ((a ^ b) & mask) ^ b; }
robutest/uclinux
C++
GPL-2.0
60
/* This file contains the IRQ specific code for hvc_console */
static irqreturn_t hvc_handle_interrupt(int irq, void *dev_instance)
/* This file contains the IRQ specific code for hvc_console */ static irqreturn_t hvc_handle_interrupt(int irq, void *dev_instance)
{ if (hvc_poll(dev_instance)) hvc_kick(); return IRQ_HANDLED; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the current stimer value. This function can be used to read, uninvasively, the value in the stimer. */
uint32_t am_hal_stimer_counter_get(void)
/* Get the current stimer value. This function can be used to read, uninvasively, the value in the stimer. */ uint32_t am_hal_stimer_counter_get(void)
{ return AM_REG(CTIMER, STTMR); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return if there is touch detected or not. */
uint8_t mfxstm32l152_TS_DetectTouch(uint16_t DeviceAddr)
/* Return if there is touch detected or not. */ uint8_t mfxstm32l152_TS_DetectTouch(uint16_t DeviceAddr)
{ uint8_t state; uint8_t ret = 0; state = MFX_IO_Read(DeviceAddr, MFXSTM32L152_TS_FIFO_STA); state = ((state & (uint8_t)MFXSTM32L152_TS_CTRL_STATUS) == (uint8_t)MFXSTM32L152_TS_CTRL_STATUS); if(state > 0) { if(MFX_IO_Read(DeviceAddr, MFXSTM32L152_TS_FIFO_LEVEL) > 0) { ret = 1; } } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Pass the current system state to the bios via the hii_G_Configuration. */
VOID OpalHiiSetBrowserData(VOID)
/* Pass the current system state to the bios via the hii_G_Configuration. */ VOID OpalHiiSetBrowserData(VOID)
{ HiiSetBrowserData ( &gHiiSetupVariableGuid, (CHAR16 *)L"OpalHiiConfig", sizeof (gHiiConfiguration), (UINT8 *)&gHiiConfiguration, NULL ); }
tianocore/edk2
C++
Other
4,240
/* This function removes the TLS object pointed to by Tls and frees up the allocated memory. If Tls is NULL, nothing is done. */
VOID EFIAPI TlsFree(IN VOID *Tls)
/* This function removes the TLS object pointed to by Tls and frees up the allocated memory. If Tls is NULL, nothing is done. */ VOID EFIAPI TlsFree(IN VOID *Tls)
{ TLS_CONNECTION *TlsConn; TlsConn = (TLS_CONNECTION *)Tls; if (TlsConn == NULL) { return; } if (TlsConn->Ssl != NULL) { SSL_free (TlsConn->Ssl); } OPENSSL_free (Tls); }
tianocore/edk2
C++
Other
4,240
/* Configure the OPAMP peripheral (secondary inputs) for timer-controlled mux mode according to the specified parameters in OPAMP_InitStruct. */
void OPAMP_TimerControlledMuxConfig(uint32_t OPAMP_Selection, OPAMP_InitTypeDef *OPAMP_InitStruct)
/* Configure the OPAMP peripheral (secondary inputs) for timer-controlled mux mode according to the specified parameters in OPAMP_InitStruct. */ void OPAMP_TimerControlledMuxConfig(uint32_t OPAMP_Selection, OPAMP_InitTypeDef *OPAMP_InitStruct)
{ uint32_t tmpreg = 0; assert_param(IS_OPAMP_ALL_PERIPH(OPAMP_Selection)); assert_param(IS_OPAMP_SECONDARY_INVINPUT(OPAMP_InitStruct->OPAMP_InvertingInput)); assert_param(IS_OPAMP_NONINVERTING_INPUT(OPAMP_InitStruct->OPAMP_NonInvertingInput)); tmpreg = *(__IO uint32_t *) (OPAMP_BASE + OPAMP_Selection); tmpreg &= (uint32_t) (OPAMP_CSR_TIMERMUX_MASK); tmpreg |= (uint32_t)((uint32_t)(OPAMP_InitStruct->OPAMP_InvertingInput<<3) | (uint32_t)(OPAMP_InitStruct->OPAMP_NonInvertingInput<<7)); *(__IO uint32_t *) (OPAMP_BASE + OPAMP_Selection) = tmpreg; }
ajhc/demo-cortex-m3
C++
null
38
/* Closes the CAN channel. Note that the closing of the CAN channel takes a long time in the Lawicel CANUSB API, therefore this is not done in CanUsbDisconnect() for this CAN interface. */
static bool CanUsbCloseChannel(void)
/* Closes the CAN channel. Note that the closing of the CAN channel takes a long time in the Lawicel CANUSB API, therefore this is not done in CanUsbDisconnect() for this CAN interface. */ static bool CanUsbCloseChannel(void)
{ bool result = false; if (canUsbCanHandle != 0) { if (CanUsbLibFuncClose(canUsbCanHandle) >= 0) { result = true; } canUsbCanHandle = 0; } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* We will call this function to change the current boot flags. We expect a precise syntax: "n" (n == 0 or 1) to toggle AutoSearch Off or On */
static ssize_t pdcs_autosearch_write(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count)
/* We will call this function to change the current boot flags. We expect a precise syntax: "n" (n == 0 or 1) to toggle AutoSearch Off or On */ static ssize_t pdcs_autosearch_write(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count)
{ return pdcs_auto_write(kobj, attr, buf, count, PF_AUTOSEARCH); }
robutest/uclinux
C++
GPL-2.0
60
/* Wake up duration event. 1LSb = 1 / ODR. */
int32_t lsm6dso_wkup_dur_set(lsm6dso_ctx_t *ctx, uint8_t val)
/* Wake up duration event. 1LSb = 1 / ODR. */ int32_t lsm6dso_wkup_dur_set(lsm6dso_ctx_t *ctx, uint8_t val)
{ lsm6dso_wake_up_dur_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_WAKE_UP_DUR, (uint8_t*)&reg, 1); if (ret == 0) { reg.wake_dur = val; ret = lsm6dso_write_reg(ctx, LSM6DSO_WAKE_UP_DUR, (uint8_t*)&reg, 1); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* Create a new Cursor object and push it on top of the stack. */
static int create_cursor(lua_State *L, int o, conn_data *conn, OCIStmt *stmt, const char *text)
/* Create a new Cursor object and push it on top of the stack. */ static int create_cursor(lua_State *L, int o, conn_data *conn, OCIStmt *stmt, const char *text)
{ int ret = alloc_column_buffer (L, cur, i); if (ret) return ret; } return 1; }
DC-SWAT/DreamShell
C++
null
404
/* Allocates pages that are suitable for an OperationBusMasterCommonBuffer or OperationBusMasterCommonBuffer64 mapping. */
STATIC EFI_STATUS EFIAPI NonCoherentIoMmuAllocateBuffer(IN EDKII_IOMMU_PROTOCOL *This, IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, IN OUT VOID **HostAddress, IN UINT64 Attributes)
/* Allocates pages that are suitable for an OperationBusMasterCommonBuffer or OperationBusMasterCommonBuffer64 mapping. */ STATIC EFI_STATUS EFIAPI NonCoherentIoMmuAllocateBuffer(IN EDKII_IOMMU_PROTOCOL *This, IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, IN OUT VOID **HostAddress, IN UINT64 Attributes)
{ return DmaAllocateBuffer (MemoryType, Pages, HostAddress); }
tianocore/edk2
C++
Other
4,240
/* Returns the xmlChar * for the first occurrence or NULL. */
const xmlChar* xmlStrstr(const xmlChar *str, const xmlChar *val)
/* Returns the xmlChar * for the first occurrence or NULL. */ const xmlChar* xmlStrstr(const xmlChar *str, const xmlChar *val)
{ if (*str == *val) { if (!xmlStrncmp(str, val, n)) return((const xmlChar *) str); } str++; } return(NULL); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Copy data from IO memory space to "real" memory space. This needs to be optimized. */
void _memcpy_fromio(void *to, const volatile void __iomem *from, size_t count)
/* Copy data from IO memory space to "real" memory space. This needs to be optimized. */ void _memcpy_fromio(void *to, const volatile void __iomem *from, size_t count)
{ unsigned char *t = to; while (count) { count--; *t = readb(from); t++; from++; } }
robutest/uclinux
C++
GPL-2.0
60
/* This function stops the operation of the davinci usb module. */
int usb_lowlevel_stop(int index)
/* This function stops the operation of the davinci usb module. */ int usb_lowlevel_stop(int index)
{ musb_platform_deinit(); writeb(0, &musbr->devctl); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* 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) == 0); 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_DREQ(true); tcd->BITER = 0U; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Increases the ref count of the current instance of #CRDeclaration. */
void cr_declaration_ref(CRDeclaration *a_this)
/* Increases the ref count of the current instance of #CRDeclaration. */ void cr_declaration_ref(CRDeclaration *a_this)
{ g_return_if_fail (a_this); a_this->ref_count++; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns 1 if the Timeout bit is clear, and 0 otherwise. */
static unsigned int parport_ip32_clear_epp_timeout(struct parport *p)
/* Returns 1 if the Timeout bit is clear, and 0 otherwise. */ static unsigned int parport_ip32_clear_epp_timeout(struct parport *p)
{ struct parport_ip32_private * const priv = p->physport->private_data; unsigned int cleared; if (!(parport_ip32_read_status(p) & DSR_TIMEOUT)) cleared = 1; else { unsigned int r; parport_ip32_read_status(p); r = parport_ip32_read_status(p); writeb(r | DSR_TIMEOUT, priv->regs.dsr); writeb(r & ~DSR_TIMEOUT, priv->regs.dsr); r = parport_ip32_read_status(p); cleared = !(r & DSR_TIMEOUT); } pr_trace(p, "(): %s", cleared ? "cleared" : "failed"); return cleared; }
robutest/uclinux
C++
GPL-2.0
60
/* This function returns the status data for each of the Traffic Classes in use. */
s32 ixgbe_dcb_get_tc_stats_82598(struct ixgbe_hw *hw, struct ixgbe_hw_stats *stats, u8 tc_count)
/* This function returns the status data for each of the Traffic Classes in use. */ s32 ixgbe_dcb_get_tc_stats_82598(struct ixgbe_hw *hw, struct ixgbe_hw_stats *stats, u8 tc_count)
{ int tc; if (tc_count > MAX_TRAFFIC_CLASS) return DCB_ERR_PARAM; for (tc = 0; tc < tc_count; tc++) { stats->qptc[tc] += IXGBE_READ_REG(hw, IXGBE_QPTC(tc)); stats->qbtc[tc] += IXGBE_READ_REG(hw, IXGBE_QBTC(tc)); stats->qprc[tc] += IXGBE_READ_REG(hw, IXGBE_QPRC(tc)); stats->qbrc[tc] += IXGBE_READ_REG(hw, IXGBE_QBRC(tc)); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Get a random prime of length 'size' bits. This function also guarantees that x-1 is not a multiple of 65537. */
static void rand_prime(mpz_t x, int size)
/* Get a random prime of length 'size' bits. This function also guarantees that x-1 is not a multiple of 65537. */ static void rand_prime(mpz_t x, int size)
{ for (;;) { mpz_urandomb(x, RNG, size - 1); mpz_setbit(x, 0); mpz_setbit(x, size - 1); if (mpz_probab_prime_p(x, 50)) { mpz_sub_ui(x, x, 1); if (mpz_divisible_ui_p(x, 65537)) { continue; } mpz_add_ui(x, x, 1); return; } } }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Cleanup interrupt masks, etc after wakeup by power switch */
static void __default_power_switch_cleanup(void)
/* Cleanup interrupt masks, etc after wakeup by power switch */ static void __default_power_switch_cleanup(void)
{ *(unsigned long *)0xfeff9820 = __irq_mask; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* TIM MSP Initialization This function configures the hardware resources used in this example: */
void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim)
/* TIM MSP Initialization This function configures the hardware resources used in this example: */ void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim)
{ GPIO_InitTypeDef GPIO_InitStruct; __HAL_RCC_TIM1_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOE_CLK_ENABLE(); GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; GPIO_InitStruct.Alternate = GPIO_AF1_TIM1; GPIO_InitStruct.Pin = GPIO_PIN_8; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); GPIO_InitStruct.Pin = GPIO_PIN_11; HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* CAN MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan)
/* CAN MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan)
{ if(hcan->Instance==CAN1) { HAL_RCC_CAN1_CLK_ENABLED--; if(HAL_RCC_CAN1_CLK_ENABLED==0){ __HAL_RCC_CAN1_CLK_DISABLE(); } HAL_GPIO_DeInit(GPIOD, GPIO_PIN_0|GPIO_PIN_1); } else if(hcan->Instance==CAN2) { __HAL_RCC_CAN2_CLK_DISABLE(); HAL_RCC_CAN1_CLK_ENABLED--; if(HAL_RCC_CAN1_CLK_ENABLED==0){ __HAL_RCC_CAN1_CLK_DISABLE(); } HAL_GPIO_DeInit(GPIOB, GPIO_PIN_5|GPIO_PIN_6); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If the conversion results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeInt16ToChar8(IN INT16 Operand, OUT CHAR8 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeInt16ToChar8(IN INT16 Operand, OUT CHAR8 *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if ((Operand >= 0) && (Operand <= MAX_INT8)) { *Result = (CHAR8)Operand; Status = RETURN_SUCCESS; } else { *Result = CHAR8_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* This function initializes the memory map. It is called during the system startup to create static physical to virtual memory mappings for the IO modules. */
void __init mx25_map_io(void)
/* This function initializes the memory map. It is called during the system startup to create static physical to virtual memory mappings for the IO modules. */ void __init mx25_map_io(void)
{ mxc_set_cpu_type(MXC_CPU_MX25); mxc_iomux_v3_init(MX25_IO_ADDRESS(MX25_IOMUXC_BASE_ADDR)); mxc_arch_reset_init(MX25_IO_ADDRESS(MX25_WDOG_BASE_ADDR)); iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Sets the priority grouping of the interrupt controller. */
void IntPriorityGroupingSet(uint32_t ui32Bits)
/* Sets the priority grouping of the interrupt controller. */ void IntPriorityGroupingSet(uint32_t ui32Bits)
{ ASSERT(ui32Bits < NUM_PRIORITY); HWREG(NVIC_APINT) = NVIC_APINT_VECTKEY | g_pui32Priority[ui32Bits]; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Get specified SMI register based on given register ID */
PLD_GENERIC_REGISTER* GetRegisterById(UINT64 Id)
/* Get specified SMI register based on given register ID */ PLD_GENERIC_REGISTER* GetRegisterById(UINT64 Id)
{ UINT32 Index; for (Index = 0; Index < mSmmRegisterHob->Count; Index++) { if (mSmmRegisterHob->Registers[Index].Id == Id) { return &mSmmRegisterHob->Registers[Index]; } } return NULL; }
tianocore/edk2
C++
Other
4,240
/* igb_tx_timeout - Respond to a Tx Hang @netdev: network interface device structure */
static void igb_tx_timeout(struct net_device *)
/* igb_tx_timeout - Respond to a Tx Hang @netdev: network interface device structure */ static void igb_tx_timeout(struct net_device *)
{ struct igb_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; adapter->tx_timeout_count++; if (hw->mac.type == e1000_82580) hw->dev_spec._82575.global_device_reset = true; schedule_work(&adapter->reset_task); wr32(E1000_EICS, (adapter->eims_enable_mask & ~adapter->eims_other)); }
robutest/uclinux
C++
GPL-2.0
60
/* Start this driver on ControllerHandle. This service is called by the EFI boot service ConnectController(). In order to make drivers as small as possible, there are a few calling restrictions for this service. ConnectController() must follow these calling restrictions. If any other agent wishes to call Start() it must also follow these calling restrictions. */
EFI_STATUS EFIAPI Udp4DriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
/* Start this driver on ControllerHandle. This service is called by the EFI boot service ConnectController(). In order to make drivers as small as possible, there are a few calling restrictions for this service. ConnectController() must follow these calling restrictions. If any other agent wishes to call Start() it must also follow these calling restrictions. */ EFI_STATUS EFIAPI Udp4DriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
{ EFI_STATUS Status; UDP4_SERVICE_DATA *Udp4Service; Udp4Service = AllocatePool (sizeof (UDP4_SERVICE_DATA)); if (Udp4Service == NULL) { return EFI_OUT_OF_RESOURCES; } Status = Udp4CreateService (Udp4Service, This->DriverBindingHandle, ControllerHandle); if (EFI_ERROR (Status)) { FreePool (Udp4Service); return Status; } Status = gBS->InstallMultipleProtocolInterfaces ( &ControllerHandle, &gEfiUdp4ServiceBindingProtocolGuid, &Udp4Service->ServiceBinding, NULL ); if (EFI_ERROR (Status)) { Udp4CleanService (Udp4Service); FreePool (Udp4Service); } return Status; }
tianocore/edk2
C++
Other
4,240
/* The ARC write and read functions seem to interfere with the serial lines in some way. You should be careful with them. */
void prom_putchar(char c)
/* The ARC write and read functions seem to interfere with the serial lines in some way. You should be careful with them. */ void prom_putchar(char c)
{ ULONG cnt; CHAR it = c; bc_disable(); ArcWrite(1, &it, 1, &cnt); bc_enable(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Checks whether the specified RTC interrupt has occurred or not. */
ITStatus RTC_GetITStatus(uint16_t RTC_IT)
/* Checks whether the specified RTC interrupt has occurred or not. */ ITStatus RTC_GetITStatus(uint16_t RTC_IT)
{ ITStatus bitstatus = RESET; assert_param(IS_RTC_GET_IT(RTC_IT)); bitstatus = (ITStatus)(RTC->CRL & RTC_IT); if (((RTC->CRH & RTC_IT) != (uint16_t)RESET) && (bitstatus != (uint16_t)RESET)) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function tells how many days in a month of a year. */
static u8 days_in_month(u8 month, u8 year)
/* This function tells how many days in a month of a year. */ static u8 days_in_month(u8 month, u8 year)
{ u8 ret = dim[month]; if (ret == 0) ret = is_leap_year (year) ? 29 : 28; return ret; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This is called to wait for the given dquot to be unpinned. Most of these pin/unpin routines are plagiarized from inode code. */
void xfs_qm_dqunpin_wait(xfs_dquot_t *dqp)
/* This is called to wait for the given dquot to be unpinned. Most of these pin/unpin routines are plagiarized from inode code. */ void xfs_qm_dqunpin_wait(xfs_dquot_t *dqp)
{ ASSERT(XFS_DQ_IS_LOCKED(dqp)); if (atomic_read(&dqp->q_pincount) == 0) return; xfs_log_force(dqp->q_mount, (xfs_lsn_t)0, XFS_LOG_FORCE); wait_event(dqp->q_pinwait, (atomic_read(&dqp->q_pincount) == 0)); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: %1 if the device represents a SAS remote PHY, %0 else */
int scsi_is_sas_rphy(const struct device *dev)
/* Returns: %1 if the device represents a SAS remote PHY, %0 else */ int scsi_is_sas_rphy(const struct device *dev)
{ return dev->release == sas_end_device_release || dev->release == sas_expander_release; }
robutest/uclinux
C++
GPL-2.0
60
/* Wait at most 2 seconds for flexport arbitration to succeed. */
static int ahd_wait_flexport(struct ahd_softc *ahd)
/* Wait at most 2 seconds for flexport arbitration to succeed. */ static int ahd_wait_flexport(struct ahd_softc *ahd)
{ int cnt; AHD_ASSERT_MODES(ahd, AHD_MODE_SCSI_MSK, AHD_MODE_SCSI_MSK); cnt = 1000000 * 2 / 5; while ((ahd_inb(ahd, BRDCTL) & FLXARBACK) == 0 && --cnt) ahd_delay(5); if (cnt == 0) return (ETIMEDOUT); return (0); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: a #gssize containing the size of the data spliced, or -1 if an error occurred. Note that if the number of bytes spliced is greater than G_MAXSSIZE, then that will be returned, and there is no way to determine the actual number of bytes spliced. */
gssize g_output_stream_splice(GOutputStream *stream, GInputStream *source, GOutputStreamSpliceFlags flags, GCancellable *cancellable, GError **error)
/* Returns: a #gssize containing the size of the data spliced, or -1 if an error occurred. Note that if the number of bytes spliced is greater than G_MAXSSIZE, then that will be returned, and there is no way to determine the actual number of bytes spliced. */ gssize g_output_stream_splice(GOutputStream *stream, GInputStream *source, GOutputStreamSpliceFlags flags, GCancellable *cancellable, GError **error)
{ GOutputStreamClass *class; gssize bytes_copied; g_return_val_if_fail (G_IS_OUTPUT_STREAM (stream), -1); g_return_val_if_fail (G_IS_INPUT_STREAM (source), -1); if (g_input_stream_is_closed (source)) { g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_CLOSED, _("Source stream is already closed")); return -1; } if (!g_output_stream_set_pending (stream, error)) return -1; class = G_OUTPUT_STREAM_GET_CLASS (stream); if (cancellable) g_cancellable_push_current (cancellable); bytes_copied = class->splice (stream, source, flags, cancellable, error); if (cancellable) g_cancellable_pop_current (cancellable); g_output_stream_clear_pending (stream); return bytes_copied; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* 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((PCD_HandleTypeDef*)pdev->pData); return USBD_OK; }
st-one/X-CUBE-USB-PD
C++
null
110
/* This function is executed in case of error occurrence. */
static void Timeout_Error_Handler(void)
/* This function is executed in case of error occurrence. */ static void Timeout_Error_Handler(void)
{ while(1) { BSP_LED_On(LED2); HAL_Delay(500); BSP_LED_Off(LED2); HAL_Delay(500); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* len <= NILFS_NAME_LEN and de != NULL are guaranteed by caller. */
static int nilfs_match(int len, const char *const name, struct nilfs_dir_entry *de)
/* len <= NILFS_NAME_LEN and de != NULL are guaranteed by caller. */ static int nilfs_match(int len, const char *const name, struct nilfs_dir_entry *de)
{ if (len != de->name_len) return 0; if (!de->inode) return 0; return !memcmp(name, de->name, len); }
robutest/uclinux
C++
GPL-2.0
60
/* param src USB HS PHY PLL clock source. param freq The frequency specified by src. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */
bool CLOCK_EnableUsbhs1PhyPllClock(clock_usb_phy_src_t src, uint32_t freq)
/* param src USB HS PHY PLL clock source. param freq The frequency specified by src. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */ bool CLOCK_EnableUsbhs1PhyPllClock(clock_usb_phy_src_t src, uint32_t freq)
{ const clock_usb_pll_config_t g_ccmConfigUsbPll = {.loopDivider = 0U}; CLOCK_InitUsb2Pll(&g_ccmConfigUsbPll); USBPHY2->CTRL &= ~USBPHY_CTRL_SFTRST_MASK; USBPHY2->CTRL &= ~USBPHY_CTRL_CLKGATE_MASK; USBPHY2->PWD = 0; USBPHY2->CTRL |= USBPHY_CTRL_ENAUTOCLR_PHY_PWD_MASK | USBPHY_CTRL_ENAUTOCLR_CLKGATE_MASK | USBPHY_CTRL_ENUTMILEVEL2_MASK | USBPHY_CTRL_ENUTMILEVEL3_MASK; return true; }
eclipse-threadx/getting-started
C++
Other
310
/* This event aggregates all the events of the ConIn devices in the spliter. If any events of physical ConIn devices are signaled, signal the ConIn spliter event. This will cause the calling code to call ConSplitterTextInReadKeyStroke (). */
VOID EFIAPI ConSplitterSimplePointerWaitForInput(IN EFI_EVENT Event, IN VOID *Context)
/* This event aggregates all the events of the ConIn devices in the spliter. If any events of physical ConIn devices are signaled, signal the ConIn spliter event. This will cause the calling code to call ConSplitterTextInReadKeyStroke (). */ VOID EFIAPI ConSplitterSimplePointerWaitForInput(IN EFI_EVENT Event, IN VOID *Context)
{ EFI_STATUS Status; TEXT_IN_SPLITTER_PRIVATE_DATA *Private; UINTN Index; Private = (TEXT_IN_SPLITTER_PRIVATE_DATA *)Context; if (Private->InputEventSignalState) { gBS->SignalEvent (Event); return; } for (Index = 0; Index < Private->CurrentNumberOfPointers; Index++) { Status = gBS->CheckEvent (Private->PointerList[Index]->WaitForInput); if (!EFI_ERROR (Status)) { gBS->SignalEvent (Event); Private->InputEventSignalState = TRUE; } } }
tianocore/edk2
C++
Other
4,240
/* Returns zero if unsuccessful or an error if not. */
int scsi_device_quiesce(struct scsi_device *sdev)
/* Returns zero if unsuccessful or an error if not. */ int scsi_device_quiesce(struct scsi_device *sdev)
{ int err = scsi_device_set_state(sdev, SDEV_QUIESCE); if (err) return err; scsi_run_queue(sdev->request_queue); while (sdev->device_busy) { msleep_interruptible(200); scsi_run_queue(sdev->request_queue); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the count value of the TMR4 counter. */
uint16_t TMR4_GetCountValue(const CM_TMR4_TypeDef *TMR4x)
/* Get the count value of the TMR4 counter. */ uint16_t TMR4_GetCountValue(const CM_TMR4_TypeDef *TMR4x)
{ DDL_ASSERT(IS_TMR4_UNIT(TMR4x)); return READ_REG16(TMR4x->CNTR); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* this function is a POSIX compliant version, which will remove a directory. */
int rmdir(const char *pathname)
/* this function is a POSIX compliant version, which will remove a directory. */ int rmdir(const char *pathname)
{ int result; result = dfs_file_unlink(pathname); if (result < 0) { rt_set_errno(result); return -1; } return 0; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Description: Reads the ID registers of the PHY at @addr on the @bus, stores it in @phy_id and returns zero on success. */
int get_phy_id(struct mii_dev *bus, int addr, int devad, uint32_t *phy_id)
/* Description: Reads the ID registers of the PHY at @addr on the @bus, stores it in @phy_id and returns zero on success. */ int get_phy_id(struct mii_dev *bus, int addr, int devad, uint32_t *phy_id)
{ int phy_reg; phy_reg = bus->read(bus, addr, devad, MII_PHYSID1); if (phy_reg < 0) return -EIO; *phy_id = (phy_reg & 0xffff) << 16; phy_reg = bus->read(bus, addr, devad, MII_PHYSID2); if (phy_reg < 0) return -EIO; *phy_id |= (phy_reg & 0xffff); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sets the pin mode and configures the pin for use by GPIO peripheral */
void PinTypeGPIO(unsigned long ulPin, unsigned long ulPinMode, tBoolean bOpenDrain)
/* Sets the pin mode and configures the pin for use by GPIO peripheral */ void PinTypeGPIO(unsigned long ulPin, unsigned long ulPinMode, tBoolean bOpenDrain)
{ if(bOpenDrain) { PinConfigSet(ulPin, PIN_STRENGTH_2MA, PIN_TYPE_OD); } else { PinConfigSet(ulPin, PIN_STRENGTH_2MA, PIN_TYPE_STD); } PinModeSet(ulPin, ulPinMode); }
micropython/micropython
C++
Other
18,334
/* Some devices and their resources require reserved physical memory from the end of the available RAM. This function traverses the list of devices and assigns actual adresses to these. */
static void __init u300_assign_physmem(void)
/* Some devices and their resources require reserved physical memory from the end of the available RAM. This function traverses the list of devices and assigns actual adresses to these. */ static void __init u300_assign_physmem(void)
{ unsigned long curr_start = __pa(high_memory); int i, j; for (i = 0; i < ARRAY_SIZE(platform_devs); i++) { for (j = 0; j < platform_devs[i]->num_resources; j++) { struct resource *const res = &platform_devs[i]->resource[j]; if (IORESOURCE_MEM == res->flags && 0 == res->start) { res->start = curr_start; res->end += curr_start; curr_start += (res->end - res->start + 1); printk(KERN_INFO "core.c: Mapping RAM " \ "%#x-%#x to device %s:%s\n", res->start, res->end, platform_devs[i]->name, res->name); } } } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Provides an interface that a software module can call to report a status code. */
EFI_STATUS EFIAPI ReportDispatcher(IN CONST EFI_MM_STATUS_CODE_PROTOCOL *This, IN EFI_STATUS_CODE_TYPE CodeType, IN EFI_STATUS_CODE_VALUE Value, IN UINT32 Instance, IN CONST EFI_GUID *CallerId, IN EFI_STATUS_CODE_DATA *Data OPTIONAL)
/* Provides an interface that a software module can call to report a status code. */ EFI_STATUS EFIAPI ReportDispatcher(IN CONST EFI_MM_STATUS_CODE_PROTOCOL *This, IN EFI_STATUS_CODE_TYPE CodeType, IN EFI_STATUS_CODE_VALUE Value, IN UINT32 Instance, IN CONST EFI_GUID *CallerId, IN EFI_STATUS_CODE_DATA *Data OPTIONAL)
{ LIST_ENTRY *Link; MM_RSC_HANDLER_CALLBACK_ENTRY *CallbackEntry; if (InterlockedCompareExchange32 (&mStatusCodeNestStatus, 0, 1) == 1) { return EFI_DEVICE_ERROR; } for (Link = GetFirstNode (&mCallbackListHead); !IsNull (&mCallbackListHead, Link);) { CallbackEntry = CR (Link, MM_RSC_HANDLER_CALLBACK_ENTRY, Node, MM_RSC_HANDLER_CALLBACK_ENTRY_SIGNATURE); Link = GetNextNode (&mCallbackListHead, Link); CallbackEntry->RscHandlerCallback ( CodeType, Value, Instance, (EFI_GUID *)CallerId, Data ); } InterlockedCompareExchange32 (&mStatusCodeNestStatus, 1, 0); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* @event notified event @context pointer to the timeout */
static void EFIAPI notify(struct efi_event *event, void *context)
/* @event notified event @context pointer to the timeout */ static void EFIAPI notify(struct efi_event *event, void *context)
{ struct notify_context *notify_context = context; efi_status_t ret = EFI_SUCCESS; if (!notify_context) return; ret = boottime->set_watchdog_timer(1, 0, 0, NULL); if (ret != EFI_SUCCESS) notify_context->status = ret; notify_context->timer_ticks++; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Additionally, a DMA bus error may be signaled using */
uint32_t EMACDMAStateGet(uint32_t ui32Base)
/* Additionally, a DMA bus error may be signaled using */ uint32_t EMACDMAStateGet(uint32_t ui32Base)
{ return (HWREG(ui32Base + EMAC_O_DMARIS) & (EMAC_DMARIS_FBI | EMAC_DMARIS_AE_M | EMAC_DMARIS_RS_M | EMAC_DMARIS_TS_M)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* \breif This function is used to generate a falling edge, as the of Timer counting source. */
void EdgeGenerate(void)
/* \breif This function is used to generate a falling edge, as the of Timer counting source. */ void EdgeGenerate(void)
{ int i; xGPIOSPinWrite(PC12, 0); for(i = 0; i < 5; i++); xGPIOSPinWrite(PC12, 1); for(i = 0; i < 5; i++); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Set the contents of a G_TYPE_FLAGS #GValue to @v_flags. */
void g_value_set_flags(GValue *value, guint v_flags)
/* Set the contents of a G_TYPE_FLAGS #GValue to @v_flags. */ void g_value_set_flags(GValue *value, guint v_flags)
{ g_return_if_fail (G_VALUE_HOLDS_FLAGS (value)); value->data[0].v_ulong = v_flags; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Find a routing entry, we only return a FULL match */
static struct ipddp_route * __ipddp_find_route(struct ipddp_route *rt)
/* Find a routing entry, we only return a FULL match */ static struct ipddp_route * __ipddp_find_route(struct ipddp_route *rt)
{ struct ipddp_route *f; for(f = ipddp_route_list; f != NULL; f = f->next) { if(f->ip == rt->ip && f->at.s_net == rt->at.s_net && f->at.s_node == rt->at.s_node) return (f); } return (NULL); }
robutest/uclinux
C++
GPL-2.0
60
/* Set the fields of structure stc_tmr4_init_t to default values. */
int32_t TMR4_StructInit(stc_tmr4_init_t *pstcTmr4Init)
/* Set the fields of structure stc_tmr4_init_t to default values. */ int32_t TMR4_StructInit(stc_tmr4_init_t *pstcTmr4Init)
{ int32_t i32Ret = LL_ERR_INVD_PARAM; if (NULL != pstcTmr4Init) { pstcTmr4Init->u16PeriodValue = 0xFFFFU; pstcTmr4Init->u16CountMode = TMR4_MD_SAWTOOTH; pstcTmr4Init->u16ClockSrc = TMR4_CLK_SRC_INTERNCLK; pstcTmr4Init->u16ClockDiv = TMR4_CLK_DIV1; i32Ret = LL_OK; } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This code sets variable in storage blocks (Volatile or Non-Volatile). */
EFI_STATUS EFIAPI SmmVariableSetVariable(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Data)
/* This code sets variable in storage blocks (Volatile or Non-Volatile). */ EFI_STATUS EFIAPI SmmVariableSetVariable(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Data)
{ EFI_STATUS Status; mRequestSource = VarCheckFromTrusted; Status = VariableServiceSetVariable ( VariableName, VendorGuid, Attributes, DataSize, Data ); mRequestSource = VarCheckFromUntrusted; return Status; }
tianocore/edk2
C++
Other
4,240