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
/* __psmouse_set_state() sets new psmouse state and resets all flags. */
static void __psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state)
/* __psmouse_set_state() sets new psmouse state and resets all flags. */ static void __psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state)
{ psmouse->state = new_state; psmouse->pktcnt = psmouse->out_of_sync_cnt = 0; psmouse->ps2dev.flags = 0; psmouse->last = jiffies; }
robutest/uclinux
C++
GPL-2.0
60
/* More details for reference count strategy can refer to the API description for */
EDKII_JSON_VALUE EFIAPI JsonValueInitUnicodeString(IN CHAR16 *String)
/* More details for reference count strategy can refer to the API description for */ EDKII_JSON_VALUE EFIAPI JsonValueInitUnicodeString(IN CHAR16 *String)
{ EFI_STATUS Status; CHAR8 *Utf8Str; if (String == NULL) { return NULL; } Utf8Str = NULL; Status = UCS2StrToUTF8 (String, &Utf8Str); if (EFI_ERROR (Status)) { return NULL; } return (EDKII_JSON_VALUE)json_string (Utf8Str); }
tianocore/edk2
C++
Other
4,240
/* ERRORS EFAULT BUF points outside your accessible address space. */
asmlinkage long sys_getunwind(void __user *buf, size_t buf_size)
/* ERRORS EFAULT BUF points outside your accessible address space. */ asmlinkage long sys_getunwind(void __user *buf, size_t buf_size)
{ if (buf && buf_size >= unw.gate_table_size) if (copy_to_user(buf, unw.gate_table, unw.gate_table_size) != 0) return -EFAULT; return unw.gate_table_size; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Deletes all objects from the BLE host store. */
int ble_store_clear(void)
/* Deletes all objects from the BLE host store. */ int ble_store_clear(void)
{ const uint8_t obj_types[] = { BLE_STORE_OBJ_TYPE_OUR_SEC, BLE_STORE_OBJ_TYPE_PEER_SEC, BLE_STORE_OBJ_TYPE_CCCD, }; union ble_store_key key; int obj_type; int rc; int i; memset(&key, 0, sizeof key); for (i = 0; i < sizeof obj_types / sizeof obj_types[0]; i++) { obj_type = obj_types[i]; do { rc = ble_store_delete(obj_type, &key); } while (rc == 0); if (rc != BLE_HS_ENOENT) { return rc; } } return 0; }
Nicholas3388/LuaNode
C++
Other
1,055
/* This function check if the system has resumed from WWDG reset. */
void Check_WWDG_Reset(void)
/* This function check if the system has resumed from WWDG reset. */ void Check_WWDG_Reset(void)
{ if (LL_RCC_IsActiveFlag_WWDGRST()) { LL_RCC_ClearResetFlags(); LED_On(); while(KeyPressed != 1) { } KeyPressed = 0; } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Returns: a value suitable for writing into a PRCI PLL configuration register */
static u32 __prci_wrpll_pack(const struct wrpll_cfg *c)
/* Returns: a value suitable for writing into a PRCI PLL configuration register */ static u32 __prci_wrpll_pack(const struct wrpll_cfg *c)
{ u32 r = 0; r |= c->divr << PRCI_COREPLLCFG0_DIVR_SHIFT; r |= c->divf << PRCI_COREPLLCFG0_DIVF_SHIFT; r |= c->divq << PRCI_COREPLLCFG0_DIVQ_SHIFT; r |= c->range << PRCI_COREPLLCFG0_RANGE_SHIFT; r |= PRCI_COREPLLCFG0_FSE_MASK; return r; }
4ms/stm32mp1-baremetal
C++
Other
137
/* The user changed the custom field entry box or the field entry box has been updated because a new column row with custom format has been selected. If the current field entry matches that of the current column row, this is just an update because a new column row has been selected. Do nothing. If the two are different, then update the column row & etc. */
static void column_field_changed_cb(GtkEditable *, gpointer)
/* The user changed the custom field entry box or the field entry box has been updated because a new column row with custom format has been selected. If the current field entry matches that of the current column row, this is just an update because a new column row has been selected. Do nothing. If the two are different, then update the column row & etc. */ static void column_field_changed_cb(GtkEditable *, gpointer)
{ return; } field = gtk_editable_get_chars(te, 0, -1); gtk_tree_model_get(model, &iter, DATA_COLUMN, &clp, -1); cfmt = (fmt_data *) clp->data; if (strcmp(cfmt->custom_fields, field) == 0) { return; } if (cfmt->custom_occurrence) { fmt = g_strdup_printf("%s (%s#%d)", col_format_desc(cfmt->fmt), field, cfmt->custom_occurrence); } else { fmt = g_strdup_printf("%s (%s)", col_format_desc(cfmt->fmt), field); } gtk_list_store_set(GTK_LIST_STORE(model), &iter, FORMAT_COLUMN, fmt, -1); g_free(fmt); g_free(cfmt->custom_fields); cfmt->custom_fields = field; cfile.columns_changed = TRUE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function changes the System Clock. Currently MOSC and SOSC are not connected on RA2L1 board. So these needs to be turned OFF. */
static void preffered_ra_clock_setting(void)
/* This function changes the System Clock. Currently MOSC and SOSC are not connected on RA2L1 board. So these needs to be turned OFF. */ static void preffered_ra_clock_setting(void)
{ fsp_err_t err = FSP_SUCCESS; err = R_CGC_ClockStop(&g_cgc0_ctrl, CGC_CLOCK_MAIN_OSC); if (FSP_SUCCESS != err) { LOG_E("Returned Error Code: 0x%x", err); } err = R_CGC_ClockStop(&g_cgc0_ctrl, CGC_CLOCK_SUBCLOCK); if (FSP_SUCCESS != err) { LOG_E("Returned Error Code: 0x%x", err); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* LETIMER register synchronization freeze control. Some LETIMER registers require synchronization into the low frequency (LF) domain. The freeze feature allows for several such registers to be modified before passing them to the LF domain simultaneously (which takes place when the freeze mode is disabled). */
void LETIMER_FreezeEnable(LETIMER_TypeDef *letimer, bool enable)
/* LETIMER register synchronization freeze control. Some LETIMER registers require synchronization into the low frequency (LF) domain. The freeze feature allows for several such registers to be modified before passing them to the LF domain simultaneously (which takes place when the freeze mode is disabled). */ void LETIMER_FreezeEnable(LETIMER_TypeDef *letimer, bool enable)
{ if (enable) { while (letimer->SYNCBUSY) ; letimer->FREEZE = LETIMER_FREEZE_REGFREEZE; } else { letimer->FREEZE = 0; } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector39_handler(void)
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ void Vector39_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (39 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Waits to send a packet from the Ethernet controller. */
long EthernetPacketPut(unsigned long ulBase, unsigned char *pucBuf, long lBufLen)
/* Waits to send a packet from the Ethernet controller. */ long EthernetPacketPut(unsigned long ulBase, unsigned char *pucBuf, long lBufLen)
{ ASSERT(ulBase == ETH_BASE); ASSERT(pucBuf != 0); ASSERT(lBufLen > 0); while(HWREG(ulBase + MAC_O_TR) & MAC_TR_NEWTX) { } return(EthernetPacketPutInternal(ulBase, pucBuf, lBufLen)); }
watterott/WebRadio
C++
null
71
/* SYSCTRL GPIOC Bus Clock Disable and Reset Assert. */
void LL_SYSCTRL_GPIOC_ClkDisRstAssert(void)
/* SYSCTRL GPIOC Bus Clock Disable and Reset Assert. */ void LL_SYSCTRL_GPIOC_ClkDisRstAssert(void)
{ __LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL); __LL_SYSCTRL_GPIOCBusClk_Dis(SYSCTRL); __LL_SYSCTRL_GPIOCSoftRst_Assert(SYSCTRL); __LL_SYSCTRL_Reg_Lock(SYSCTRL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Print a null-terminated string character by character to the UART interface */
void print_uart(char *buf)
/* Print a null-terminated string character by character to the UART interface */ void print_uart(char *buf)
{ int msg_len = strlen(buf); for (int i = 0; i < msg_len; i++) { uart_poll_out(uart_dev, buf[i]); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Set the receive buffer size for a given USB endpoint. */
void st_usbfs_set_ep_rx_bufsize(usbd_device *dev, uint8_t ep, uint32_t size)
/* Set the receive buffer size for a given USB endpoint. */ void st_usbfs_set_ep_rx_bufsize(usbd_device *dev, uint8_t ep, uint32_t size)
{ (void)dev; if (size > 62) { if (size & 0x1f) { size -= 32; } USB_SET_EP_RX_COUNT(ep, (size << 5) | 0x8000); } else { if (size & 1) { size++; } USB_SET_EP_RX_COUNT(ep, size << 10); } }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Returns: (transfer none): The @closure passed in, for convenience */
GClosure* g_closure_ref(GClosure *closure)
/* Returns: (transfer none): The @closure passed in, for convenience */ GClosure* g_closure_ref(GClosure *closure)
{ guint new_ref_count; g_return_val_if_fail (closure != NULL, NULL); g_return_val_if_fail (closure->ref_count > 0, NULL); g_return_val_if_fail (closure->ref_count < CLOSURE_MAX_REF_COUNT, NULL); INC_ASSIGN (closure, ref_count, &new_ref_count); g_return_val_if_fail (new_ref_count > 1, NULL); return closure; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* 5.18 Enhanced Measurement Report IE The Enhanced Measurement Results field is encoded as the contents of the ENHANCED MEASUREMENT REPORT message in 3GPP TS 44.018 (excluding the fields: "RR short PD", "Message type" and "Short layer 2 header")... */
static guint16 de_enh_meas_rep(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
/* 5.18 Enhanced Measurement Report IE The Enhanced Measurement Results field is encoded as the contents of the ENHANCED MEASUREMENT REPORT message in 3GPP TS 44.018 (excluding the fields: "RR short PD", "Message type" and "Short layer 2 header")... */ static guint16 de_enh_meas_rep(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
{ guint32 curr_offset; curr_offset = offset; proto_tree_add_expert(tree, pinfo, &ei_gsm_bsslap_not_decoded_yet, tvb, curr_offset, len); return(len); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Wait for interrupt flag (polled - not real hardware interrupt) */
static int ql_wai(struct qlogicfas408_priv *priv)
/* Wait for interrupt flag (polled - not real hardware interrupt) */ static int ql_wai(struct qlogicfas408_priv *priv)
{ int k; int qbase = priv->qbase; unsigned long i; k = 0; i = jiffies + WATCHDOG; while (time_before(jiffies, i) && !priv->qabort && !((k = inb(qbase + 4)) & 0xe0)) { barrier(); cpu_relax(); } if (time_after_eq(jiffies, i)) return (DID_TIME_OUT); if (priv->qabort) return (priv->qabort == 1 ? DID_ABORT : DID_RESET); if (k & 0x60) ql_zap(priv); if (k & 0x20) return (DID_PARITY); if (k & 0x40) return (DID_ERROR); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Populate IO resources from FDT that not added to GCD by its driver in the DXE phase. */
STATIC VOID PopulateIoResources(VOID *FdtBase, CONST CHAR8 *Compatible)
/* Populate IO resources from FDT that not added to GCD by its driver in the DXE phase. */ STATIC VOID PopulateIoResources(VOID *FdtBase, CONST CHAR8 *Compatible)
{ UINT64 *Reg; INT32 Node, LenP; Node = fdt_node_offset_by_compatible (FdtBase, -1, Compatible); while (Node != -FDT_ERR_NOTFOUND) { Reg = (UINT64 *)fdt_getprop (FdtBase, Node, "reg", &LenP); if (Reg) { ASSERT (LenP == (2 * sizeof (UINT64))); AddIoMemoryBaseSizeHob (SwapBytes64 (Reg[0]), SwapBytes64 (Reg[1])); } Node = fdt_node_offset_by_compatible (FdtBase, Node, Compatible); } }
tianocore/edk2
C++
Other
4,240
/* This does a check to see if the buffer belongs to one of these lost pages before doing the final put_bh. If page->mapping was null, it tries to free buffers on the page, which should make the final page_cache_release drop the page from the lru. */
static void release_buffer_page(struct buffer_head *bh)
/* This does a check to see if the buffer belongs to one of these lost pages before doing the final put_bh. If page->mapping was null, it tries to free buffers on the page, which should make the final page_cache_release drop the page from the lru. */ static void release_buffer_page(struct buffer_head *bh)
{ struct page *page = bh->b_page; if (!page->mapping && trylock_page(page)) { page_cache_get(page); put_bh(bh); if (!page->mapping) try_to_free_buffers(page); unlock_page(page); page_cache_release(page); } else { put_bh(bh); } }
robutest/uclinux
C++
GPL-2.0
60
/* ADC Disable The Temperature Sensor. Disabling this will reduce power consumption from the sensor and the reference voltage measurements. */
void adc_disable_temperature_sensor(uint32_t adc)
/* ADC Disable The Temperature Sensor. Disabling this will reduce power consumption from the sensor and the reference voltage measurements. */ void adc_disable_temperature_sensor(uint32_t adc)
{ ADC_CR2(adc) &= ~ADC_CR2_TSVREFE; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Enables or disables the USART's most significant bit first transmitted/received following the start bit. */
void USART_MSBFirstCmd(USART_TypeDef *USARTx, FunctionalState NewState)
/* Enables or disables the USART's most significant bit first transmitted/received following the start bit. */ void USART_MSBFirstCmd(USART_TypeDef *USARTx, FunctionalState NewState)
{ assert_param(IS_USART_ALL_PERIPH(USARTx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { USARTx->CR2 |= USART_CR2_MSBFIRST; } else { USARTx->CR2 &= (uint32_t)~((uint32_t)USART_CR2_MSBFIRST); } }
ajhc/demo-cortex-m3
C++
null
38
/* Return with the pointer of the next node after 'n_act' */
void* lv_ll_get_next(const lv_ll_t *ll_p, const void *n_act)
/* Return with the pointer of the next node after 'n_act' */ void* lv_ll_get_next(const lv_ll_t *ll_p, const void *n_act)
{ void * next = NULL; if(ll_p != NULL) { const lv_ll_node_t * n_act_d = n_act; memcpy(&next, n_act_d + LL_NEXT_P_OFFSET(ll_p), sizeof(void *)); } return next; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Enables or disables the CRC value calculation of the transferred bytes. */
void SPI_CalculateCRC(SPI_TypeDef *SPIx, FunctionalState NewState)
/* Enables or disables the CRC value calculation of the transferred bytes. */ void SPI_CalculateCRC(SPI_TypeDef *SPIx, FunctionalState NewState)
{ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { SPIx->CR1 |= CR1_CRCEN_Set; } else { SPIx->CR1 &= CR1_CRCEN_Reset; } }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* If 32-bit MMIO register operations are not supported, then ASSERT(). */
UINT32 EFIAPI MmioRead32(IN UINTN Address)
/* If 32-bit MMIO register operations are not supported, then ASSERT(). */ UINT32 EFIAPI MmioRead32(IN UINTN Address)
{ BOOLEAN Flag; UINT32 Value; ASSERT ((Address & 3) == 0); Flag = FilterBeforeMmIoRead (FilterWidth32, Address, &Value); if (Flag) { Value = MmioRead32Internal (Address); } FilterAfterMmIoRead (FilterWidth32, Address, &Value); return Value; }
tianocore/edk2
C++
Other
4,240
/* handle an interrupt from the serial transmission "virtual DMA" driver */
static void mn10300_serial_transmit_interrupt(struct mn10300_serial_port *port)
/* handle an interrupt from the serial transmission "virtual DMA" driver */ static void mn10300_serial_transmit_interrupt(struct mn10300_serial_port *port)
{ _enter("%s", port->name); if (!port->uart.state || !port->uart.state->port.tty) { mn10300_serial_dis_tx_intr(port); return; } if (uart_tx_stopped(&port->uart) || uart_circ_empty(&port->uart.state->xmit)) mn10300_serial_dis_tx_intr(port); if (uart_circ_chars_pending(&port->uart.state->xmit) < WAKEUP_CHARS) uart_write_wakeup(&port->uart); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Resets the RCC clock configuration to the default reset state. */
void RCC_DeInit(void)
/* Resets the RCC clock configuration to the default reset state. */ void RCC_DeInit(void)
{ RCC->CR |= (uint32_t)0x00000001; RCC->CFGR &= (uint32_t)0xF8FFB80C; RCC->CR &= (uint32_t)0xFEF6FFFF; RCC->CR &= (uint32_t)0xFFFBFFFF; RCC->CFGR &= (uint32_t)0xFFC0FFFF; RCC->CFGR2 &= (uint32_t)0xFFFFFFF0; RCC->CFGR3 &= (uint32_t)0xFFFFFEAC; RCC->CR2 &= (uint32_t)0xFFFFFFFE; RCC->CIR = 0x00000000; }
ajhc/demo-cortex-m3
C++
null
38
/* RCC Turn off an Oscillator. Disable an oscillator and power off. */
void rcc_osc_off(enum rcc_osc osc)
/* RCC Turn off an Oscillator. Disable an oscillator and power off. */ void rcc_osc_off(enum rcc_osc osc)
{ switch (osc) { case RCC_PLL: RCC_CR &= ~RCC_CR_PLLON; break; case RCC_HSE: RCC_CR &= ~RCC_CR_HSEON; break; case RCC_HSI: RCC_CR &= ~RCC_CR_HSION; break; case RCC_LSE: RCC_BDCR &= ~RCC_BDCR_LSEON; break; case RCC_LSI: RCC_CSR &= ~RCC_CSR_LSION; break; } }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Enables or disables the High Speed APB (APB2) peripheral clock. */
void RCC_EnableAPB2PeriphClk(uint32_t RCC_APB2Periph, FunctionalState Cmd)
/* Enables or disables the High Speed APB (APB2) peripheral clock. */ void RCC_EnableAPB2PeriphClk(uint32_t RCC_APB2Periph, FunctionalState Cmd)
{ assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { RCC->APB2PCLKEN |= RCC_APB2Periph; } else { RCC->APB2PCLKEN &= ~RCC_APB2Periph; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Translate a physical address to a logical address. This will return the logical address of the first match. */
unsigned long vdma_phys2log(unsigned long paddr)
/* Translate a physical address to a logical address. This will return the logical address of the first match. */ unsigned long vdma_phys2log(unsigned long paddr)
{ int i; int frame; frame = paddr & ~(VDMA_PAGESIZE - 1); for (i = 0; i < VDMA_PGTBL_ENTRIES; i++) { if (pgtbl[i].frame == frame) break; } if (i == VDMA_PGTBL_ENTRIES) return ~0UL; return (i << 12) + (paddr & (VDMA_PAGESIZE - 1)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This is a special case, and normally, the dma_transfer_xxx functions should be used. */
int dma_start_transfer(DMA_Handle_t handle)
/* This is a special case, and normally, the dma_transfer_xxx functions should be used. */ int dma_start_transfer(DMA_Handle_t handle)
{ DMA_Channel_t *channel; DMA_DeviceAttribute_t *devAttr; channel = HandleToChannel(handle); if (channel == NULL) { return -ENODEV; } devAttr = &DMA_gDeviceAttribute[channel->devType]; dmacHw_initiateTransfer(channel->dmacHwHandle, &devAttr->config, devAttr->ring.virtAddr); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Copies data currently in flash to the block->data and sets the base address. */
static blt_bool FlashInitBlock(tFlashBlockInfo *block, blt_addr address)
/* Copies data currently in flash to the block->data and sets the base address. */ static blt_bool FlashInitBlock(tFlashBlockInfo *block, blt_addr address)
{ if ((address % FLASH_WRITE_BLOCK_SIZE) != 0) { return BLT_FALSE; } if (block->base_addr == address) { return BLT_TRUE; } block->base_addr = address; CpuMemCopy((blt_addr)block->data, address, FLASH_WRITE_BLOCK_SIZE); return BLT_TRUE; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* When we mask an IO APIC routing entry, we need to write the low word first, in order to set the mask bit before we change the high bits! */
static void ioapic_mask_entry(int apic, int pin)
/* When we mask an IO APIC routing entry, we need to write the low word first, in order to set the mask bit before we change the high bits! */ static void ioapic_mask_entry(int apic, int pin)
{ unsigned long flags; union entry_union eu = { .entry.mask = 1 }; spin_lock_irqsave(&ioapic_lock, flags); io_apic_write(apic, 0x10 + 2*pin, eu.w1); io_apic_write(apic, 0x11 + 2*pin, eu.w2); spin_unlock_irqrestore(&ioapic_lock, flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Drivers for RIO devices should normally record such references in their probe() methods, when they bind to a device, and release them by calling rio_dev_put(), in their disconnect() methods. */
struct rio_dev* rio_dev_get(struct rio_dev *rdev)
/* Drivers for RIO devices should normally record such references in their probe() methods, when they bind to a device, and release them by calling rio_dev_put(), in their disconnect() methods. */ struct rio_dev* rio_dev_get(struct rio_dev *rdev)
{ if (rdev) get_device(&rdev->dev); return rdev; }
robutest/uclinux
C++
GPL-2.0
60
/* Sets the active setting of the given interface if the configuration supports it; otherwise, the control pipe is STALLed. If the setting of an interface changes. \parma pDriver Pointer to a USBDDriver instance. \parma infnum Interface number. \parma setting New active setting for the interface. */
static void SetInterface(USBDDriver *pDriver, unsigned char infnum, unsigned char setting)
/* Sets the active setting of the given interface if the configuration supports it; otherwise, the control pipe is STALLed. If the setting of an interface changes. \parma pDriver Pointer to a USBDDriver instance. \parma infnum Interface number. \parma setting New active setting for the interface. */ static void SetInterface(USBDDriver *pDriver, unsigned char infnum, unsigned char setting)
{ if (!pDriver->pInterfaces) { USBD_Stall(0); } else { if (pDriver->pInterfaces[infnum] != setting) { pDriver->pInterfaces[infnum] = setting; } USBD_Write(0, 0, 0, 0, 0); } }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* It tries to locate Unicode Collation 2 protocol and matches it with current platform language code. If for any reason the first attempt fails, it then tries to use Unicode Collation Protocol. */
EFI_STATUS InitializeUnicodeCollationSupport(IN EFI_HANDLE AgentHandle)
/* It tries to locate Unicode Collation 2 protocol and matches it with current platform language code. If for any reason the first attempt fails, it then tries to use Unicode Collation Protocol. */ EFI_STATUS InitializeUnicodeCollationSupport(IN EFI_HANDLE AgentHandle)
{ EFI_STATUS Status; Status = EFI_UNSUPPORTED; Status = InitializeUnicodeCollationSupportWorker ( AgentHandle, &gEfiUnicodeCollation2ProtocolGuid, L"PlatformLang", (CONST CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultPlatformLang) ); if (EFI_ERROR (Status)) { Status = InitializeUnicodeCollationSupportWorker ( AgentHandle, &gEfiUnicodeCollationProtocolGuid, L"Lang", (CONST CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultLang) ); } return Status; }
tianocore/edk2
C++
Other
4,240
/* Retrieve exception handler from IDT table by ExceptionNum. */
VOID* GetExceptionHandlerInIdtEntry(IN UINTN ExceptionNum)
/* Retrieve exception handler from IDT table by ExceptionNum. */ VOID* GetExceptionHandlerInIdtEntry(IN UINTN ExceptionNum)
{ IA32_IDT_GATE_DESCRIPTOR *IdtEntry; IA32_DESCRIPTOR IdtDescriptor; AsmReadIdtr (&IdtDescriptor); IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor.Base; return (VOID *)(((UINTN)IdtEntry[ExceptionNum].Bits.OffsetLow) | (((UINTN)IdtEntry[ExceptionNum].Bits.OffsetHigh) << 16)); }
tianocore/edk2
C++
Other
4,240
/* Configure ADT7301 temperature convertion mode. This function is to set and change ADT7301 temperature convertion mode,you */
void ADT7301Configure(unsigned short usMode)
/* Configure ADT7301 temperature convertion mode. This function is to set and change ADT7301 temperature convertion mode,you */ void ADT7301Configure(unsigned short usMode)
{ unsigned short usWrite; xASSERT((usMode == ADT7301_MODE_NORMAL) || (usMode == ADT7301_MODE_SHUTDOWN)); xGPIOSPinWrite(ADT7301_PIN_SPI_CS, 0); if(usMode == ADT7301_MODE_NORMAL) { usWrite =ADT7301_MODE_NORMAL; } else { usWrite = ADT7301_MODE_SHUTDOWN; } xSPISingleDataReadWrite(ADT7301_PIN_SPI_PORT, usWrite); xGPIOSPinWrite(ADT7301_PIN_SPI_CS, 1); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This file is part of the Simba project. */
int mock_write_upgrade_kermit_init(void *chin_p, void *chout_p, int res)
/* This file is part of the Simba project. */ int mock_write_upgrade_kermit_init(void *chin_p, void *chout_p, int res)
{ harness_mock_write("upgrade_kermit_init(chin_p)", chin_p, sizeof(chin_p)); harness_mock_write("upgrade_kermit_init(chout_p)", chout_p, sizeof(chout_p)); harness_mock_write("upgrade_kermit_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* function: nstime_to_sec converts nstime to double, time base is seconds */
double nstime_to_sec(const nstime_t *nstime)
/* function: nstime_to_sec converts nstime to double, time base is seconds */ double nstime_to_sec(const nstime_t *nstime)
{ return ((double)nstime->secs + (double)nstime->nsecs/NS_PER_S); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* DAC960_RequestFunction is the I/O Request Function for DAC960 Controllers. */
static void DAC960_RequestFunction(struct request_queue *RequestQueue)
/* DAC960_RequestFunction is the I/O Request Function for DAC960 Controllers. */ static void DAC960_RequestFunction(struct request_queue *RequestQueue)
{ DAC960_ProcessRequest(RequestQueue->queuedata); }
robutest/uclinux
C++
GPL-2.0
60
/* For this reason only those processes can call into the filesystem, for which the owner of the mount has ptrace privilege. This excludes processes started by other users, suid or sgid processes. */
int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task)
/* For this reason only those processes can call into the filesystem, for which the owner of the mount has ptrace privilege. This excludes processes started by other users, suid or sgid processes. */ int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task)
{ const struct cred *cred; int ret; if (fc->flags & FUSE_ALLOW_OTHER) return 1; rcu_read_lock(); ret = 0; cred = __task_cred(task); if (cred->euid == fc->user_id && cred->suid == fc->user_id && cred->uid == fc->user_id && cred->egid == fc->group_id && cred->sgid == fc->group_id && cred->gid == fc->group_id) ret = 1; rcu_read_unlock(); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Add 16 bit integer attribute to netlink message. */
int nla_put_u16(struct nl_msg *msg, int attrtype, uint16_t value)
/* Add 16 bit integer attribute to netlink message. */ int nla_put_u16(struct nl_msg *msg, int attrtype, uint16_t value)
{ return nla_put(msg, attrtype, sizeof(uint16_t), &value); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The idle thread. There's no useful work to be done, so just try to conserve power and have a low exit latency (ie sit in a loop waiting for somebody to say that they'd like to reschedule) */
void cpu_idle(void)
/* The idle thread. There's no useful work to be done, so just try to conserve power and have a low exit latency (ie sit in a loop waiting for somebody to say that they'd like to reschedule) */ void cpu_idle(void)
{ int cpu = smp_processor_id(); boot_init_stack_canary(); current_thread_info()->status |= TS_POLLING; while (1) { tick_nohz_stop_sched_tick(1); while (!need_resched()) { check_pgt_cache(); rmb(); if (cpu_is_offline(cpu)) play_dead(); local_irq_disable(); stop_critical_timings(); pm_idle(); start_critical_timings(); } tick_nohz_restart_sched_tick(); preempt_enable_no_resched(); schedule(); preempt_disable(); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* fcoe_interface_release() - fcoe_port kref release function @kref: Embedded reference count in an fcoe_interface struct */
static void fcoe_interface_release(struct kref *kref)
/* fcoe_interface_release() - fcoe_port kref release function @kref: Embedded reference count in an fcoe_interface struct */ static void fcoe_interface_release(struct kref *kref)
{ struct fcoe_interface *fcoe; struct net_device *netdev; fcoe = container_of(kref, struct fcoe_interface, kref); netdev = fcoe->netdev; fcoe_ctlr_destroy(&fcoe->ctlr); kfree(fcoe); dev_put(netdev); }
robutest/uclinux
C++
GPL-2.0
60
/* function: filetime_to_nstime converts a Windows FILETIME value to an nstime_t returns TRUE if the conversion succeeds, FALSE if it doesn't (for example, with a 32-bit time_t, the time overflows or underflows time_t) */
gboolean filetime_to_nstime(nstime_t *nstime, guint64 filetime)
/* function: filetime_to_nstime converts a Windows FILETIME value to an nstime_t returns TRUE if the conversion succeeds, FALSE if it doesn't (for example, with a 32-bit time_t, the time overflows or underflows time_t) */ gboolean filetime_to_nstime(nstime_t *nstime, guint64 filetime)
{ guint64 ftsecs; int nsecs; ftsecs = filetime / 10000000; nsecs = (int)((filetime % 10000000)*100); return common_filetime_to_nstime(nstime, ftsecs, nsecs); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* param base Key Manager peripheral address. param select select source for OTFAD1 key. param lock setting for lock OTFAD1 key. return status of OTFAD1 key control operation */
status_t KEYMGR_OTFAD1KeyControll(KEY_MANAGER_Type *base, keymgr_select_t select, keymgr_lock_t lock)
/* param base Key Manager peripheral address. param select select source for OTFAD1 key. param lock setting for lock OTFAD1 key. return status of OTFAD1 key control operation */ status_t KEYMGR_OTFAD1KeyControll(KEY_MANAGER_Type *base, keymgr_select_t select, keymgr_lock_t lock)
{ if ((select != (uint8_t)(KEYMGR_SEL_OCOTP)) && (select != (uint8_t)(KEYMGR_SEL_PUF))) { return kStatus_InvalidArgument; } base->OTFAD1_KEY_CTRL &= ~KEY_MANAGER_OTFAD1_KEY_CTRL_SELECT_MASK; base->OTFAD1_KEY_CTRL |= KEY_MANAGER_OTFAD1_KEY_CTRL_SELECT(select) | KEY_MANAGER_OTFAD1_KEY_CTRL_LOCK(lock); return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Dump this object according to the specified parameters */
void nl_object_dump(struct nl_object *obj, struct nl_dump_params *params)
/* Dump this object according to the specified parameters */ void nl_object_dump(struct nl_object *obj, struct nl_dump_params *params)
{ dump_from_ops(obj, params); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* @np: device node from which the property value is to be read. @propname: name of the property to be searched. @len: requested length of property value */
static void* dtb_node_find_property_value_of_size(const struct dtb_node *dn, const char *propname, uint32_t len)
/* @np: device node from which the property value is to be read. @propname: name of the property to be searched. @len: requested length of property value */ static void* dtb_node_find_property_value_of_size(const struct dtb_node *dn, const char *propname, uint32_t len)
{ struct dtb_property *prop = dtb_node_get_dtb_node_property(dn, propname, NULL); if (!prop) return ERR_PTR(-EINVAL); if (!prop->value) return ERR_PTR(-ENODATA); if (len > prop->size) return ERR_PTR(-EOVERFLOW); return prop->value; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns success (0) or appropriate error code (none as of now) */
static void emac_setmac(struct emac_priv *priv, rt_uint32_t ch, char *mac_addr)
/* Returns success (0) or appropriate error code (none as of now) */ static void emac_setmac(struct emac_priv *priv, rt_uint32_t ch, char *mac_addr)
{ if (priv->rx_addr_type == 0) { emac_set_type0addr(priv, ch, mac_addr); } else if (priv->rx_addr_type == 1) { rt_uint32_t cnt; for (cnt = 0; cnt < EMAC_MAX_TXRX_CHANNELS; cnt++) emac_set_type1addr(priv, ch, mac_addr); } else if (priv->rx_addr_type == 2) { emac_set_type2addr(priv, ch, mac_addr, ch, 1); emac_set_type0addr(priv, ch, mac_addr); } else { rt_kprintf("DaVinci EMAC: Wrong addressing\n"); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ADC Disable an External Trigger for Regular Channels. */
void adc_disable_external_trigger_regular(uint32_t adc)
/* ADC Disable an External Trigger for Regular Channels. */ void adc_disable_external_trigger_regular(uint32_t adc)
{ ADC_CR2(adc) &= ~ADC_CR2_EXTEN_MASK; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Adds the RegNumber-th register's value to the output buffer, starting at the given OutBufPtr */
CHAR8* BasicWriteRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN UINTN RegNumber, IN CHAR8 *InBufPtr)
/* Adds the RegNumber-th register's value to the output buffer, starting at the given OutBufPtr */ CHAR8* BasicWriteRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN UINTN RegNumber, IN CHAR8 *InBufPtr)
{ UINTN RegSize; UINTN TempValue; UINT32 NewValue; NewValue = 0; RegSize = 0; while (RegSize < REG_SIZE) { TempValue = HexCharToInt (*InBufPtr++); if (TempValue < 0) { SendError (GDB_EBADMEMDATA); return NULL; } NewValue += (TempValue << (RegSize+4)); TempValue = HexCharToInt (*InBufPtr++); if (TempValue < 0) { SendError (GDB_EBADMEMDATA); return NULL; } NewValue += (TempValue << RegSize); RegSize = RegSize + 8; } *(FindPointerToRegister (SystemContext, RegNumber)) = NewValue; return InBufPtr; }
tianocore/edk2
C++
Other
4,240
/* Generate a block of noise, used when restart sync word == 0x31eb. */
static void fill_noise_buffer(MLPDecodeContext *m, unsigned int substr)
/* Generate a block of noise, used when restart sync word == 0x31eb. */ static void fill_noise_buffer(MLPDecodeContext *m, unsigned int substr)
{ SubStream *s = &m->substream[substr]; unsigned int i; uint32_t seed = s->noisegen_seed; for (i = 0; i < m->access_unit_size_pow2; i++) { uint8_t seed_shr15 = seed >> 15; m->noise_buffer[i] = noise_table[seed_shr15]; seed = (seed << 8) ^ seed_shr15 ^ (seed_shr15 << 5); } s->noisegen_seed = seed; }
DC-SWAT/DreamShell
C++
null
404
/* Clears a calibration point from the given buffer. */
static void clear_calibration_point(const rtouch_point_t *p_point)
/* Clears a calibration point from the given buffer. */ static void clear_calibration_point(const rtouch_point_t *p_point)
{ lcd_set_foreground_color(UNI_COLOR_WHITE); lcd_draw_filled_rectangle(p_point->x - POINTS_SIZE / 2, p_point->y - POINTS_SIZE / 2, p_point->x - POINTS_SIZE / 2 + POINTS_SIZE, p_point->y - POINTS_SIZE / 2 + POINTS_SIZE ); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Returns the clock source used as system clock. */
uint8_t RCC_GetSYSCLKSource(void)
/* Returns the clock source used as system clock. */ uint8_t RCC_GetSYSCLKSource(void)
{ return ((uint8_t)(RCC->CFGR & CFGR_SWS_Mask)); }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* For the old diag subcode 4 with simple data format we have to use real memory. If we use subcode 6 or 7 with extended data format, we can (and should) use vmalloc, since we need a lot of memory in that case. Currently up to 93 pages! */
static void diag204_free_buffer(void)
/* For the old diag subcode 4 with simple data format we have to use real memory. If we use subcode 6 or 7 with extended data format, we can (and should) use vmalloc, since we need a lot of memory in that case. Currently up to 93 pages! */ static void diag204_free_buffer(void)
{ if (!diag204_buf) return; if (diag204_buf_vmalloc) { vfree(diag204_buf_vmalloc); diag204_buf_vmalloc = NULL; } else { free_pages((unsigned long) diag204_buf, 0); } diag204_buf_pages = 0; diag204_buf = NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Description: Update all the ndlp's dev loss tmo with the vport devloss tmo value. */
static void lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport)
/* Description: Update all the ndlp's dev loss tmo with the vport devloss tmo value. */ static void lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport)
{ struct Scsi_Host *shost; struct lpfc_nodelist *ndlp; shost = lpfc_shost_from_vport(vport); spin_lock_irq(shost->host_lock); list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) if (NLP_CHK_NODE_ACT(ndlp) && ndlp->rport) ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo; spin_unlock_irq(shost->host_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Set the IO bank information from the details calculated earlier from calling s3c2412_iotiming_calc(). */
void s3c2412_iotiming_set(struct s3c_cpufreq_config *cfg, struct s3c_iotimings *iot)
/* Set the IO bank information from the details calculated earlier from calling s3c2412_iotiming_calc(). */ void s3c2412_iotiming_set(struct s3c_cpufreq_config *cfg, struct s3c_iotimings *iot)
{ struct s3c2412_iobank_timing *bt; void __iomem *regs; int bank; for (bank = 0; bank < MAX_BANKS; bank++) { bt = iot->bank[bank].io_2412; if (!bt) continue; regs = S3C2412_SSMC_BANK(bank); __raw_writel(bt->smbidcyr, regs + SMBIDCYR); __raw_writel(bt->smbwstrd, regs + SMBWSTRDR); __raw_writel(bt->smbwstwr, regs + SMBWSTWRR); __raw_writel(bt->smbwstoen, regs + SMBWSTOENR); __raw_writel(bt->smbwstwen, regs + SMBWSTWENR); __raw_writel(bt->smbwstbrd, regs + SMBWSTBRDR); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* TIM_PWM MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim_pwm)
/* TIM_PWM MSP Initialization This function configures the hardware resources used in this example. */ void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim_pwm)
{ if(htim_pwm->Instance==TIM2) { __HAL_RCC_TIM2_CLK_ENABLE(); } else if(htim_pwm->Instance==TIM3) { __HAL_RCC_TIM3_CLK_ENABLE(); } else if(htim_pwm->Instance==TIM4) { __HAL_RCC_TIM4_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The periodical timer function for IGMP. It does the following things: */
VOID Ip4IgmpTicking(IN IP4_SERVICE *IpSb)
/* The periodical timer function for IGMP. It does the following things: */ VOID Ip4IgmpTicking(IN IP4_SERVICE *IpSb)
{ IGMP_SERVICE_DATA *IgmpCtrl; LIST_ENTRY *Entry; IGMP_GROUP *Group; IgmpCtrl = &IpSb->IgmpCtrl; if (IgmpCtrl->Igmpv1QuerySeen > 0) { IgmpCtrl->Igmpv1QuerySeen--; } NET_LIST_FOR_EACH (Entry, &IgmpCtrl->Groups) { Group = NET_LIST_USER_STRUCT (Entry, IGMP_GROUP, Link); ASSERT (Group->DelayTime >= 0); if (Group->DelayTime > 0) { Group->DelayTime--; if (Group->DelayTime == 0) { Ip4SendIgmpReport (IpSb, Group->Address); Group->ReportByUs = TRUE; } } } }
tianocore/edk2
C++
Other
4,240
/* This function finds MAX AML buffer size. It will search the ACPI table installed by ACPI_TABLE protocol. */
EFI_STATUS SdtGetMaxAmlBufferSize(IN VOID *Buffer, OUT UINTN *MaxSize)
/* This function finds MAX AML buffer size. It will search the ACPI table installed by ACPI_TABLE protocol. */ EFI_STATUS SdtGetMaxAmlBufferSize(IN VOID *Buffer, OUT UINTN *MaxSize)
{ EFI_ACPI_TABLE_LIST *CurrentTableList; CurrentTableList = FindTableByBuffer (Buffer); if (CurrentTableList == NULL) { return EFI_NOT_FOUND; } *MaxSize = (UINTN)CurrentTableList->Table + CurrentTableList->Table->Length - (UINTN)Buffer; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Returns: (transfer none) (type GObject.TypeInterface): the corresponding #GTypeInterface structure of the parent type of the instance type to which @g_iface belongs, or NULL if the parent type doesn't conform to the interface */
gpointer g_type_interface_peek_parent(gpointer g_iface)
/* Returns: (transfer none) (type GObject.TypeInterface): the corresponding #GTypeInterface structure of the parent type of the instance type to which @g_iface belongs, or NULL if the parent type doesn't conform to the interface */ gpointer g_type_interface_peek_parent(gpointer g_iface)
{ TypeNode *node; TypeNode *iface; gpointer vtable = NULL; GTypeInterface *iface_class = g_iface; g_return_val_if_fail (g_iface != NULL, NULL); iface = lookup_type_node_I (iface_class->g_type); node = lookup_type_node_I (iface_class->g_instance_type); if (node) node = lookup_type_node_I (NODE_PARENT_TYPE (node)); if (node && node->is_instantiatable && iface) type_lookup_iface_vtable_I (node, iface, &vtable); else if (node) g_warning (G_STRLOC ": invalid interface pointer '%p'", g_iface); return vtable; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If udev->state is already USB_STATE_NOTATTACHED then no change is made. Otherwise udev->state is set to new_state, and if new_state is USB_STATE_NOTATTACHED then all of udev's descendants' states are also set to USB_STATE_NOTATTACHED. */
void usb_set_device_state(struct usb_host_virt_dev *udev, enum usb_device_state new_state)
/* If udev->state is already USB_STATE_NOTATTACHED then no change is made. Otherwise udev->state is set to new_state, and if new_state is USB_STATE_NOTATTACHED then all of udev's descendants' states are also set to USB_STATE_NOTATTACHED. */ void usb_set_device_state(struct usb_host_virt_dev *udev, enum usb_device_state new_state)
{ uint32_t flags; flags = hal_spin_lock_irqsave(&device_lock); if (udev->state == USB_STATE_NOTATTACHED) ; else if (new_state != USB_STATE_NOTATTACHED) { udev->state = new_state; } else { recursively_mark_NOTATTACHED(udev); } hal_spin_unlock_irqrestore(&device_lock, flags); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Copy a RAM buffer to a user page memory section. */
static void mem_user_write(isp_addr_t dst, const void *src, uint16_t nbytes)
/* Copy a RAM buffer to a user page memory section. */ static void mem_user_write(isp_addr_t dst, const void *src, uint16_t nbytes)
{ flash_api_memcpy(FLASH_API_USER_PAGE + dst, src, nbytes, true); }
memfault/zero-to-main
C++
null
200
/* param base IRTC peripheral base address param cloOut select clock to use for output */
void IRTC_ConfigClockOut(RTC_Type *base, irtc_clockout_sel_t clkOut)
/* param base IRTC peripheral base address param cloOut select clock to use for output */ void IRTC_ConfigClockOut(RTC_Type *base, irtc_clockout_sel_t clkOut)
{ uint16_t ctrlVal = base->CTRL; ctrlVal &= (uint16_t)(~RTC_CTRL_CLKOUT_MASK); ctrlVal |= RTC_CTRL_CLKOUT((uint16_t)clkOut); if (clkOut == kIRTC_ClkoutCoarse1Hz) { ctrlVal |= RTC_CTRL_COMP_EN_MASK; } else if (clkOut == kIRTC_ClkoutFine1Hz) { ctrlVal |= RTC_CTRL_FINEEN_MASK; } else { } base->CTRL = ctrlVal; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is the callback function of hub's int endpoint, it is invoked when data comes. */
static void rt_usbh_hub_irq(void *context)
/* This function is the callback function of hub's int endpoint, it is invoked when data comes. */ static void rt_usbh_hub_irq(void *context)
{ upipe_t pipe; uhub_t hub; int timeout = USB_TIMEOUT_BASIC; RT_ASSERT(context != RT_NULL); pipe = (upipe_t)context; hub = (uhub_t)pipe->user_data; if(pipe->status != UPIPE_STATUS_OK) { LOG_D("hub irq error"); return; } rt_usbh_hub_port_change(hub); LOG_D("hub int xfer..."); RT_ASSERT(pipe->inst->hcd != RT_NULL); rt_usb_hcd_pipe_xfer(hub->self->hcd, pipe, hub->buffer, pipe->ep.wMaxPacketSize, timeout); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return the current static memory controller clock frequency in units of 10kHz */
unsigned int pxa3xx_get_memclk_frequency_10khz(void)
/* Return the current static memory controller clock frequency in units of 10kHz */ unsigned int pxa3xx_get_memclk_frequency_10khz(void)
{ unsigned long acsr; unsigned int smcfs, clk = 0; acsr = ACSR; smcfs = (acsr >> 23) & 0x7; clk = (acsr & ACCR_D0CS) ? RO_CLK : smcfs_mult[smcfs] * BASE_CLK; return (clk / 10000); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This takes an OID in text string form as an argument. */
gssapi_oid_value* gssapi_lookup_oid_str(const char *oid_key)
/* This takes an OID in text string form as an argument. */ gssapi_oid_value* gssapi_lookup_oid_str(const char *oid_key)
{ gssapi_oid_value *value; if(!oid_key){ return NULL; } value = (gssapi_oid_value *)g_hash_table_lookup(gssapi_oids, oid_key); return value; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Unregisters an interrupt handler for the I2C module. */
void I2CIntUnregister(uint32_t ui32Base)
/* Unregisters an interrupt handler for the I2C module. */ void I2CIntUnregister(uint32_t ui32Base)
{ uint32_t ui32Int; ASSERT(_I2CBaseValid(ui32Base)); ui32Int = _I2CIntNumberGet(ui32Base); ASSERT(ui32Int != 0); IntDisable(ui32Int); IntUnregister(ui32Int); }
micropython/micropython
C++
Other
18,334
/* Return non-zero if there is a path group, zero otherwise. */
int ccw_device_is_pathgroup(struct ccw_device *cdev)
/* Return non-zero if there is a path group, zero otherwise. */ int ccw_device_is_pathgroup(struct ccw_device *cdev)
{ return cdev->private->flags.pgroup; }
robutest/uclinux
C++
GPL-2.0
60
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
{ if(hadc->Instance==ADC1) { __HAL_RCC_ADC_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_2|GPIO_PIN_4); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Download one of boot file in the list, and it's special for IPv6. */
EFI_STATUS PxeBcReadBootFileList(IN PXEBC_PRIVATE_DATA *Private, IN OUT UINT64 *BufferSize, IN VOID *Buffer OPTIONAL)
/* Download one of boot file in the list, and it's special for IPv6. */ EFI_STATUS PxeBcReadBootFileList(IN PXEBC_PRIVATE_DATA *Private, IN OUT UINT64 *BufferSize, IN VOID *Buffer OPTIONAL)
{ EFI_STATUS Status; EFI_PXE_BASE_CODE_PROTOCOL *PxeBc; PxeBc = &Private->PxeBc; if (Buffer != NULL) { Status = PxeBc->Mtftp ( PxeBc, EFI_PXE_BASE_CODE_TFTP_READ_FILE, Buffer, FALSE, BufferSize, &Private->BlockSize, &Private->ServerIp, Private->BootFileName, NULL, FALSE ); } else { Status = EFI_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* Cancels ongoing read/write operation. Cancels the ongoing read/write operation modifying parameters in the USART software struct. */
void usart_abort_job(struct usart_module *const module, enum usart_transceiver_type transceiver_type)
/* Cancels ongoing read/write operation. Cancels the ongoing read/write operation modifying parameters in the USART software struct. */ void usart_abort_job(struct usart_module *const module, enum usart_transceiver_type transceiver_type)
{ Assert(module); Assert(module->hw); SercomUsart *const usart_hw = &(module->hw->USART); switch(transceiver_type) { case USART_TRANSCEIVER_RX: usart_hw->INTFLAG.reg = SERCOM_USART_INTFLAG_RXC; module->remaining_rx_buffer_length = 0; break; case USART_TRANSCEIVER_TX: usart_hw->INTFLAG.reg = SERCOM_USART_INTFLAG_TXC; module->remaining_tx_buffer_length = 0; break; } }
memfault/zero-to-main
C++
null
200
/* Insert a new entry after the specified head. This is good for implementing stacks. */
static void list_add(struct list_head *new, struct list_head *head)
/* Insert a new entry after the specified head. This is good for implementing stacks. */ static void list_add(struct list_head *new, struct list_head *head)
{ __list_add(new, head, head->next); }
robutest/uclinux
C++
GPL-2.0
60
/* Prints a character to the default console, at the supplied cursor position, using L"%c" format. */
UINTN PrintCharAt(IN UINTN Column, IN UINTN Row, CHAR16 Character)
/* Prints a character to the default console, at the supplied cursor position, using L"%c" format. */ UINTN PrintCharAt(IN UINTN Column, IN UINTN Row, CHAR16 Character)
{ UINTN ScreenWidth; UINTN ScreenRows; gST->ConOut->SetCursorPosition (gST->ConOut, Column, Row); gST->ConOut->QueryMode ( gST->ConOut, gST->ConOut->Mode->Mode, &ScreenWidth, &ScreenRows ); if ((Column > (ScreenWidth - 1)) || (Row > (ScreenRows - 1))) { return 0; } return Print (L"%c", Character); }
tianocore/edk2
C++
Other
4,240
/* Get TC module count value. Retrieves the current count value of a TC module. The specified TC module may be started or stopped. */
uint32_t tc_get_count_value(const struct tc_module *const module_inst)
/* Get TC module count value. Retrieves the current count value of a TC module. The specified TC module may be started or stopped. */ uint32_t tc_get_count_value(const struct tc_module *const module_inst)
{ Assert(module_inst); Assert(module_inst->hw); Tc *const tc_module = module_inst->hw; while (tc_is_syncing(module_inst)) { } switch (module_inst->counter_size) { case TC_COUNTER_SIZE_8BIT: return (uint32_t)tc_module->COUNT8.COUNT.reg; case TC_COUNTER_SIZE_16BIT: return (uint32_t)tc_module->COUNT16.COUNT.reg; case TC_COUNTER_SIZE_32BIT: return tc_module->COUNT32.COUNT.reg; } Assert(false); return 0; }
memfault/zero-to-main
C++
null
200
/* If a custom request handler was installed, this handler is called first. */
BOOL USBHandleStandardRequest(TSetupPacket *pSetup, int *piLen, unsigned char **ppbData)
/* If a custom request handler was installed, this handler is called first. */ BOOL USBHandleStandardRequest(TSetupPacket *pSetup, int *piLen, unsigned char **ppbData)
{ if ((pfnHandleCustomReq != NULL) && pfnHandleCustomReq(pSetup, piLen, ppbData)) { return TRUE; } switch (REQTYPE_GET_RECIP(pSetup->bmRequestType)) { case REQTYPE_RECIP_DEVICE: return HandleStdDeviceReq(pSetup, piLen, ppbData); case REQTYPE_RECIP_INTERFACE: return HandleStdInterfaceReq(pSetup, piLen, ppbData); case REQTYPE_RECIP_ENDPOINT: return HandleStdEndPointReq(pSetup, piLen, ppbData); default: return FALSE; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Function for the Advertising functionality initialization. Encodes the required advertising data and passes it to the stack. Also builds a structure to be passed to the stack when starting advertising. */
static void advertising_init(uint8_t adv_flags)
/* Function for the Advertising functionality initialization. Encodes the required advertising data and passes it to the stack. Also builds a structure to be passed to the stack when starting advertising. */ static void advertising_init(uint8_t adv_flags)
{ uint32_t err_code; ble_advdata_t advdata; ble_uuid_t service_uuid; service_uuid.type = m_dfu.uuid_type; service_uuid.uuid = BLE_DFU_SERVICE_UUID; memset(&advdata, 0, sizeof(advdata)); advdata.name_type = BLE_ADVDATA_FULL_NAME; advdata.include_appearance = false; advdata.flags = adv_flags; advdata.uuids_more_available.uuid_cnt = 1; advdata.uuids_more_available.p_uuids = &service_uuid; err_code = ble_advdata_set(&advdata, NULL); APP_ERROR_CHECK(err_code); }
labapart/polymcu
C++
null
201
/* This function initializes a 3DES encryption algorithm, i.e. fills the psCipherContext_t structure pointed to by ctx with necessary data. */
int tls_crypto_3des_init(psCipherContext_t *ctx, const unsigned char *IV, const unsigned char *key, u32 keylen, CRYPTO_MODE cbc)
/* This function initializes a 3DES encryption algorithm, i.e. fills the psCipherContext_t structure pointed to by ctx with necessary data. */ int tls_crypto_3des_init(psCipherContext_t *ctx, const unsigned char *IV, const unsigned char *key, u32 keylen, CRYPTO_MODE cbc)
{ unsigned int x; if (keylen != DES3_KEY_LEN) return ERR_FAILURE; memcpy(ctx->des3.key.ek[0], key, keylen); ctx->des3.key.ek[1][0] = cbc; ctx->des3.blocklen = DES3_IV_LEN; if(IV) { for (x = 0; x < ctx->des3.blocklen; x++) { ctx->des3.IV[x] = IV[x]; } } return ERR_CRY_OK; }
Nicholas3388/LuaNode
C++
Other
1,055
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUintnToUint16(IN UINTN Operand, OUT UINT16 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUintnToUint16(IN UINTN Operand, OUT UINT16 *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if (Operand <= MAX_UINT16) { *Result = (UINT16)Operand; Status = RETURN_SUCCESS; } else { *Result = UINT16_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* Initialize runtime Driver Lib if it has not yet been initialized. It will ASSERT() if gRT is NULL or gBS is NULL. It will ASSERT() if that operation fails. */
EFI_STATUS EFIAPI RuntimeDriverLibConstruct(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* Initialize runtime Driver Lib if it has not yet been initialized. It will ASSERT() if gRT is NULL or gBS is NULL. It will ASSERT() if that operation fails. */ EFI_STATUS EFIAPI RuntimeDriverLibConstruct(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; ASSERT (gRT != NULL); ASSERT (gBS != NULL); mInternalRT = gRT; Status = gBS->CreateEvent ( EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE, TPL_NOTIFY, RuntimeLibVirtualNotifyEvent, NULL, &mEfiVirtualNotifyEvent ); ASSERT_EFI_ERROR (Status); Status = gBS->CreateEvent ( EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_NOTIFY, RuntimeLibExitBootServicesEvent, NULL, &mEfiExitBootServicesEvent ); ASSERT_EFI_ERROR (Status); return Status; }
tianocore/edk2
C++
Other
4,240
/* Reads the value from a PHY register hw - Struct containing variables accessed by shared code reg_addr - address of the PHY register to read */
static s32 atl2_read_phy_reg(struct atl2_hw *hw, u16 reg_addr, u16 *phy_data)
/* Reads the value from a PHY register hw - Struct containing variables accessed by shared code reg_addr - address of the PHY register to read */ static s32 atl2_read_phy_reg(struct atl2_hw *hw, u16 reg_addr, u16 *phy_data)
{ u32 val; int i; val = ((u32)(reg_addr & MDIO_REG_ADDR_MASK)) << MDIO_REG_ADDR_SHIFT | MDIO_START | MDIO_SUP_PREAMBLE | MDIO_RW | MDIO_CLK_25_4 << MDIO_CLK_SEL_SHIFT; ATL2_WRITE_REG(hw, REG_MDIO_CTRL, val); wmb(); for (i = 0; i < MDIO_WAIT_TIMES; i++) { udelay(2); val = ATL2_READ_REG(hw, REG_MDIO_CTRL); if (!(val & (MDIO_START | MDIO_BUSY))) break; wmb(); } if (!(val & (MDIO_START | MDIO_BUSY))) { *phy_data = (u16)val; return 0; } return ATLX_ERR_PHY; }
robutest/uclinux
C++
GPL-2.0
60
/* Return the state of the driver rooted at the given store path, or XenbusStateUnknown if no state can be read. */
enum xenbus_state xenbus_read_driver_state(const char *path)
/* Return the state of the driver rooted at the given store path, or XenbusStateUnknown if no state can be read. */ enum xenbus_state xenbus_read_driver_state(const char *path)
{ enum xenbus_state result; int err = xenbus_gather(XBT_NIL, path, "state", "%d", &result, NULL); if (err) result = XenbusStateUnknown; return result; }
robutest/uclinux
C++
GPL-2.0
60
/* idx_pblock: combine low and high parts of a leaf physical block number into ext4_fsblk_t */
ext4_fsblk_t idx_pblock(struct ext4_extent_idx *ix)
/* idx_pblock: combine low and high parts of a leaf physical block number into ext4_fsblk_t */ ext4_fsblk_t idx_pblock(struct ext4_extent_idx *ix)
{ ext4_fsblk_t block; block = le32_to_cpu(ix->ei_leaf_lo); block |= ((ext4_fsblk_t) le16_to_cpu(ix->ei_leaf_hi) << 31) << 1; return block; }
robutest/uclinux
C++
GPL-2.0
60
/* general configuration to ETM to enable hardware synchronization. */
void ETM_HardwareSync(ETM_Type *pETM, uint8_t u8TriggerN)
/* general configuration to ETM to enable hardware synchronization. */ void ETM_HardwareSync(ETM_Type *pETM, uint8_t u8TriggerN)
{ ASSERT(ETM2 == pETM); pETM->SYNCONF |= ETM_SYNCONF_SYNCMODE_MASK; switch(u8TriggerN) { case ETM_SYNC_TRIGGER_TRIGGER2: pETM->SYNC |= ETM_SYNC_TRIG2_MASK; break; case ETM_SYNC_TRIGGER_TRIGGER1: pETM->SYNC |= ETM_SYNC_TRIG1_MASK; break; case ETM_SYNC_TRIGGER_TRIGGER0: pETM->SYNC |= ETM_SYNC_TRIG0_MASK; break; default: break; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function finds an unused CMT channel, configures it for the requested period, associates a user callback function with the timer’s interrupt, and powers up and starts the timer. */
bool R_CMT_CreateOneShot(uint32_t period_us, void(*callback)(void *pdata), uint32_t *channel)
/* This function finds an unused CMT channel, configures it for the requested period, associates a user callback function with the timer’s interrupt, and powers up and starts the timer. */ bool R_CMT_CreateOneShot(uint32_t period_us, void(*callback)(void *pdata), uint32_t *channel)
{ return cmt_create((1000000/period_us), callback, CMT_RX_MODE_ONE_SHOT, channel); }
eclipse-threadx/getting-started
C++
Other
310
/* Reload the count of the running Watchdog Timer. Reload the value of WDT Load register. When this register is written to, the count is immediately restarted from the new value. */
enum status_code wdt_set_reload_count(struct wdt_module *const module, uint32_t load_value)
/* Reload the count of the running Watchdog Timer. Reload the value of WDT Load register. When this register is written to, the count is immediately restarted from the new value. */ enum status_code wdt_set_reload_count(struct wdt_module *const module, uint32_t load_value)
{ if (load_value == 0) { return STATUS_ERR_BAD_DATA; } else { if (module->hw->WDOGLOCK.bit.ENABLE_STATUS) { module->hw->WDOGLOCK.reg = WDT_WRITE_ACCESS_KEY; module->hw->WDOGLOAD.reg = load_value; module->hw->WDOGLOCK.reg = WDT_WDOGLOCK_ENABLE_STATUS; } else { module->hw->WDOGLOAD.reg = load_value; } } return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* ps3_repository_read_num_pu - Number of logical PU processors for this lpar. */
int ps3_repository_read_num_pu(u64 *num_pu)
/* ps3_repository_read_num_pu - Number of logical PU processors for this lpar. */ int ps3_repository_read_num_pu(u64 *num_pu)
{ *num_pu = 0; return read_node(PS3_LPAR_ID_CURRENT, make_first_field("bi", 0), make_field("pun", 0), 0, 0, num_pu, NULL); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* For Td guest TDVMCALL_MMIO is invoked to read MMIO registers. */
UINT32 EFIAPI MmioRead32(IN UINTN Address)
/* For Td guest TDVMCALL_MMIO is invoked to read MMIO registers. */ UINT32 EFIAPI MmioRead32(IN UINTN Address)
{ UINT32 Value; BOOLEAN Flag; ASSERT ((Address & 3) == 0); Flag = FilterBeforeMmIoRead (FilterWidth32, Address, &Value); if (Flag) { MemoryFence (); if (IsTdxGuest ()) { Value = TdMmioRead32 (Address); } else { Value = *(volatile UINT32 *)Address; } MemoryFence (); } FilterAfterMmIoRead (FilterWidth32, Address, &Value); return Value; }
tianocore/edk2
C++
Other
4,240
/* Transfer AP to safe hlt-loop after it finished restore CPU features on S3 patch. */
VOID TransferApToSafeState(IN UINTN ApHltLoopCode, IN UINTN TopOfStack, IN UINTN NumberToFinishAddress)
/* Transfer AP to safe hlt-loop after it finished restore CPU features on S3 patch. */ VOID TransferApToSafeState(IN UINTN ApHltLoopCode, IN UINTN TopOfStack, IN UINTN NumberToFinishAddress)
{ SwitchStack ( (SWITCH_STACK_ENTRY_POINT)ApHltLoopCode, (VOID *)NumberToFinishAddress, NULL, (VOID *)TopOfStack ); ASSERT (FALSE); }
tianocore/edk2
C++
Other
4,240
/* Toggles the LED at a fixed time interval. */
void LedToggle(void)
/* Toggles the LED at a fixed time interval. */ void LedToggle(void)
{ static unsigned char led_toggle_state = 0; static unsigned long timer_counter_last = 0; unsigned long timer_counter_now; timer_counter_now = TimerGet(); if ( (timer_counter_now - timer_counter_last) < LED_TOGGLE_MS) { return; } if (led_toggle_state == 0) { led_toggle_state = 1; HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_SET); } else { led_toggle_state = 0; HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_RESET); } timer_counter_last = timer_counter_now; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* brief Return Frequency of LPFLEXCOMM Clock return Frequency of LPFLEXCOMM Clock. */
uint32_t CLOCK_GetLPFlexCommClkFreq(uint32_t id)
/* brief Return Frequency of LPFLEXCOMM Clock return Frequency of LPFLEXCOMM Clock. */ uint32_t CLOCK_GetLPFlexCommClkFreq(uint32_t id)
{ uint32_t freq = 0U; switch (SYSCON->FCCLKSEL[id]) { case 1U: freq = CLOCK_GetPllClkDivFreq(); break; case 2U: freq = CLOCK_GetFro12MFreq(); break; case 3U: freq = CLOCK_GetFroHfFreq() / ((SYSCON->FROHFDIV & 0xffU) + 1U); break; case 4U: freq = CLOCK_GetClk1MFreq(); break; case 5U: break; case 6U: freq = CLOCK_GetLposcFreq(); break; default: freq = 0U; break; } return freq / ((SYSCON->FLEXCOMMCLKDIV[id] & 0xffU) + 1U); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Perform Subsystem Function. It is necessary to trigger CIO for channel revalidation since this call might change behaviour of DASD devices. */
static int dasd_eckd_psf_ssc(struct dasd_device *device, int enable_pav)
/* Perform Subsystem Function. It is necessary to trigger CIO for channel revalidation since this call might change behaviour of DASD devices. */ static int dasd_eckd_psf_ssc(struct dasd_device *device, int enable_pav)
{ struct dasd_ccw_req *cqr; int rc; cqr = dasd_eckd_build_psf_ssc(device, enable_pav); if (IS_ERR(cqr)) return PTR_ERR(cqr); rc = dasd_sleep_on(cqr); if (!rc) css_schedule_reprobe(); dasd_sfree_request(cqr, cqr->memdev); return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* Routine implementing u-boot chpart command. Sets new current partition based on the user supplied partition id. For partition id format see find_dev_and_part(). */
int do_chpart(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
/* Routine implementing u-boot chpart command. Sets new current partition based on the user supplied partition id. For partition id format see find_dev_and_part(). */ int do_chpart(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{ struct mtd_device *dev; struct part_info *part; u8 pnum; if (mtdparts_init() !=0) return 1; if (argc < 2) { printf("no partition id specified\n"); return 1; } if (find_dev_and_part(argv[1], &dev, &pnum, &part) != 0) return 1; current_mtd_dev = dev; current_mtd_partnum = pnum; current_save(); printf("partition changed to %s%d,%d\n", MTD_DEV_TYPE(dev->id->type), dev->id->num, pnum); return 0; }
EmcraftSystems/u-boot
C++
Other
181
/* The small/large bit is included in the descriptor Id, but the size bits are not included for small resource data elements. */
AML_RD_HEADER EFIAPI AmlRdGetDescId(IN CONST AML_RD_HEADER *Header)
/* The small/large bit is included in the descriptor Id, but the size bits are not included for small resource data elements. */ AML_RD_HEADER EFIAPI AmlRdGetDescId(IN CONST AML_RD_HEADER *Header)
{ if (Header == NULL) { ASSERT (0); return FALSE; } if (AML_RD_IS_LARGE (Header)) { return *Header; } return *Header & AML_RD_SMALL_ID_MASK; }
tianocore/edk2
C++
Other
4,240
/* Read a word from the NV E2PROM device */
static u16 initio_se2_rd(unsigned long base, u8 addr)
/* Read a word from the NV E2PROM device */ static u16 initio_se2_rd(unsigned long base, u8 addr)
{ u8 instr, rb; u16 val = 0; int i; instr = (u8) (addr | 0x80); initio_se2_instr(base, instr); for (i = 15; i >= 0; i--) { outb(SE2CS | SE2CLK, base + TUL_NVRAM); udelay(30); outb(SE2CS, base + TUL_NVRAM); rb = inb(base + TUL_NVRAM); rb &= SE2DI; val += (rb << i); udelay(30); } outb(0, base + TUL_NVRAM); udelay(30); return val; }
robutest/uclinux
C++
GPL-2.0
60
/* Interface for inode allocation to force the pag data to be initialized. */
int xfs_alloc_pagf_init(xfs_mount_t *mp, xfs_trans_t *tp, xfs_agnumber_t agno, int flags)
/* Interface for inode allocation to force the pag data to be initialized. */ int xfs_alloc_pagf_init(xfs_mount_t *mp, xfs_trans_t *tp, xfs_agnumber_t agno, int flags)
{ xfs_buf_t *bp; int error; if ((error = xfs_alloc_read_agf(mp, tp, agno, flags, &bp))) return error; if (bp) xfs_trans_brelse(tp, bp); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* The function is used to Clear reset source by write 1. The */
void SysCtlResetSrcClear(unsigned long ulSrc)
/* The function is used to Clear reset source by write 1. The */ void SysCtlResetSrcClear(unsigned long ulSrc)
{ xASSERT((ulSrc == RSTCU_GRSR_PORSTF) || (ulSrc == RSTCU_GRSR_WDTRSTF) || (ulSrc == RSTCU_GRSR_EXTRSTF) || (ulSrc == RSTCU_GRSR_SYSRSTF) ); xHWREG(RSTCU_GRSR) |= ulSrc; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Return : 0 - OK 1 - Could not transmit (dev_queue_xmit will queue it) and try to sent it later */
static netdev_tx_t wl3501_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Return : 0 - OK 1 - Could not transmit (dev_queue_xmit will queue it) and try to sent it later */ static netdev_tx_t wl3501_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
{ int enabled, rc; struct wl3501_card *this = netdev_priv(dev); unsigned long flags; spin_lock_irqsave(&this->lock, flags); enabled = wl3501_block_interrupt(this); dev->trans_start = jiffies; rc = wl3501_send_pkt(this, skb->data, skb->len); if (enabled) wl3501_unblock_interrupt(this); if (rc) { ++dev->stats.tx_dropped; netif_stop_queue(dev); } else { ++dev->stats.tx_packets; dev->stats.tx_bytes += skb->len; kfree_skb(skb); if (this->tx_buffer_cnt < 2) netif_stop_queue(dev); } spin_unlock_irqrestore(&this->lock, flags); return NETDEV_TX_OK; }
robutest/uclinux
C++
GPL-2.0
60
/* Set the value of a status to X. */
SQLITE_PRIVATE void sqlite3StatusSet(int, int)
/* Set the value of a status to X. */ SQLITE_PRIVATE void sqlite3StatusSet(int, int)
{ wsdStatInit; assert( op>=0 && op<ArraySize(wsdStat.nowValue) ); wsdStat.nowValue[op] = X; if( wsdStat.nowValue[op]>wsdStat.mxValue[op] ){ wsdStat.mxValue[op] = wsdStat.nowValue[op]; } }
DC-SWAT/DreamShell
C++
null
404
/* After waiting for a given time this puts a job in the kernel-global workqueue. */
int schedule_delayed_work(struct delayed_work *dwork, unsigned long delay)
/* After waiting for a given time this puts a job in the kernel-global workqueue. */ int schedule_delayed_work(struct delayed_work *dwork, unsigned long delay)
{ return queue_delayed_work(keventd_wq, dwork, delay); }
EmcraftSystems/linux-emcraft
C++
Other
266