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
/* Here we want the physical address of the memory. This is used when initializing the contents of the area. */
static void* usbvision_rvmalloc(unsigned long size)
/* Here we want the physical address of the memory. This is used when initializing the contents of the area. */ static void* usbvision_rvmalloc(unsigned long size)
{ void *mem; unsigned long adr; size = PAGE_ALIGN(size); mem = vmalloc_32(size); if (!mem) return NULL; memset(mem, 0, size); adr = (unsigned long) mem; while (size > 0) { SetPageReserved(vmalloc_to_page((void *)adr)); adr += PAGE_SIZE; size -= PAGE_SIZE; } return mem; }
robutest/uclinux
C++
GPL-2.0
60
/* Update CCH tlb interrupt select. Required when all the following is true: */
static int gru_retarget_intr(struct gru_thread_state *gts)
/* Update CCH tlb interrupt select. Required when all the following is true: */ static int gru_retarget_intr(struct gru_thread_state *gts)
{ if (gts->ts_tlb_int_select < 0 || gts->ts_tlb_int_select == gru_cpu_fault_map_id()) return 0; gru_dbg(grudev, "retarget from %d to %d\n", gts->ts_tlb_int_select, gru_cpu_fault_map_id()); return gru_update_cch(gts); }
robutest/uclinux
C++
GPL-2.0
60
/* enable or disable channel capture/compare control shadow register */
void timer_channel_control_shadow_config(uint32_t timer_periph, ControlStatus newvalue)
/* enable or disable channel capture/compare control shadow register */ void timer_channel_control_shadow_config(uint32_t timer_periph, ControlStatus newvalue)
{ if(ENABLE == newvalue) { TIMER_CTL1(timer_periph) |= (uint32_t)TIMER_CTL1_CCSE; } else { TIMER_CTL1(timer_periph) &= (~(uint32_t)TIMER_CTL1_CCSE); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Turn off the SSP port, optionally powering it down. */
void ssp_disable(struct ssp_dev *dev)
/* Turn off the SSP port, optionally powering it down. */ void ssp_disable(struct ssp_dev *dev)
{ struct ssp_device *ssp = dev->ssp; uint32_t sscr0; sscr0 = __raw_readl(ssp->mmio_base + SSCR0); sscr0 &= ~SSCR0_SSE; __raw_writel(sscr0, ssp->mmio_base + SSCR0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Otherwise (i.e., if this slash character is not the one standing for the root directory), then the slash character, and the pathname component preceding it, are removed by decrementing Position further. In this case, the slash character preceding the removed pathname component will reside at the new end of the parser's output buffer. */
STATIC VOID ParserRewindDotDot(IN CHAR8 *Buffer, IN OUT UINTN *Position, OUT BOOLEAN *RootEscape)
/* Otherwise (i.e., if this slash character is not the one standing for the root directory), then the slash character, and the pathname component preceding it, are removed by decrementing Position further. In this case, the slash character preceding the removed pathname component will reside at the new end of the parser's output buffer. */ STATIC VOID ParserRewindDotDot(IN CHAR8 *Buffer, IN OUT UINTN *Position, OUT BOOLEAN *RootEscape)
{ ASSERT (*Position >= 3); ASSERT (Buffer[*Position - 1] == '.'); ASSERT (Buffer[*Position - 2] == '.'); ASSERT (Buffer[*Position - 3] == '/'); (*Position) -= 2; if (*Position == 1) { *RootEscape = TRUE; return; } (*Position)--; do { ASSERT (*Position > 0); (*Position)--; } while (Buffer[*Position] != '/'); (*Position)++; }
tianocore/edk2
C++
Other
4,240
/* param base I2C base pointer. param handle pointer to i2c_slave_handle_t structure to store the transfer state. param callback pointer to user callback function. param userData user parameter passed to the callback function. */
void I2C_SlaveTransferCreateHandle(I2C_Type *base, i2c_slave_handle_t *handle, i2c_slave_transfer_callback_t callback, void *userData)
/* param base I2C base pointer. param handle pointer to i2c_slave_handle_t structure to store the transfer state. param callback pointer to user callback function. param userData user parameter passed to the callback function. */ void I2C_SlaveTransferCreateHandle(I2C_Type *base, i2c_slave_handle_t *handle, i2c_slave_transfer_callback_t callback, void *userData)
{ assert(NULL != handle); uint32_t instance = I2C_GetInstance(base); (void)memset(handle, 0, sizeof(*handle)); handle->callback = callback; handle->userData = userData; s_i2cHandle[instance] = handle; s_i2cSlaveIsr = I2C_SlaveTransferHandleIRQ; (void)EnableIRQ(s_i2cIrqs[instance]); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Load an address or vlan tag into a CAM */
static void mac_set_cam(struct mac_regs __iomem *regs, int idx, const u8 *addr)
/* Load an address or vlan tag into a CAM */ static void mac_set_cam(struct mac_regs __iomem *regs, int idx, const u8 *addr)
{ int i; BYTE_REG_BITS_SET(CAMCR_PS_CAM_DATA, CAMCR_PS1 | CAMCR_PS0, &regs->CAMCR); idx &= (64 - 1); writeb(CAMADDR_CAMEN | idx, &regs->CAMADDR); for (i = 0; i < 6; i++) writeb(*addr++, &(regs->MARCAM[i])); BYTE_REG_BITS_ON(CAMCR_CAMWR, &regs->CAMCR); udelay(10); writeb(0, &regs->CAMADDR); BYTE_REG_BITS_SET(CAMCR_PS_MAR, CAMCR_PS1 | CAMCR_PS0, &regs->CAMCR); }
robutest/uclinux
C++
GPL-2.0
60
/* Disables LIN Function mode on the specified UART. */
void UARTDisableLIN(unsigned long ulBase)
/* Disables LIN Function mode on the specified UART. */ void UARTDisableLIN(unsigned long ulBase)
{ xASSERT(UARTBaseValid(ulBase)); xHWREG(ulBase + USART_CR2) &= ~(USART_CR2_LINEN); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Function for preparing swap before receiving application or bootloader image. This function will erase current swap area to ensure flash is ready for storage of the Application or Bootloader image. Upon erase complete a callback will be done. See dfu_bank_prepare_t for further details. */
static void dfu_prepare_func_swap_erase(uint32_t image_size)
/* Function for preparing swap before receiving application or bootloader image. This function will erase current swap area to ensure flash is ready for storage of the Application or Bootloader image. Upon erase complete a callback will be done. See dfu_bank_prepare_t for further details. */ static void dfu_prepare_func_swap_erase(uint32_t image_size)
{ uint32_t err_code; mp_storage_handle_active = &m_storage_handle_swap; m_dfu_state = DFU_STATE_PREPARING; err_code = pstorage_clear(&m_storage_handle_swap, DFU_IMAGE_MAX_SIZE_BANKED); APP_ERROR_CHECK(err_code); }
labapart/polymcu
C++
null
201
/* See mss_uart.h for details of how to use this function. */
void MSS_UART_enable_tx_time_guard(mss_uart_instance_t *this_uart, uint8_t timeguard)
/* See mss_uart.h for details of how to use this function. */ void MSS_UART_enable_tx_time_guard(mss_uart_instance_t *this_uart, uint8_t timeguard)
{ ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)); if((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) { this_uart->hw_reg->TTG = timeguard; set_bit_reg8(&this_uart->hw_reg->MM0,ETTG); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function returns the CBFC status data for each of the Traffic Classes. */
s32 ixgbe_dcb_get_pfc_stats_82599(struct ixgbe_hw *hw, struct ixgbe_hw_stats *stats, u8 tc_count)
/* This function returns the CBFC status data for each of the Traffic Classes. */ s32 ixgbe_dcb_get_pfc_stats_82599(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->pxofftxc[tc] += IXGBE_READ_REG(hw, IXGBE_PXOFFTXC(tc)); stats->pxoffrxc[tc] += IXGBE_READ_REG(hw, IXGBE_PXOFFRXCNT(tc)); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Search an Option of a Question by its value. */
QUESTION_OPTION* ValueToOption(IN FORM_BROWSER_STATEMENT *Question, IN EFI_HII_VALUE *OptionValue)
/* Search an Option of a Question by its value. */ QUESTION_OPTION* ValueToOption(IN FORM_BROWSER_STATEMENT *Question, IN EFI_HII_VALUE *OptionValue)
{ LIST_ENTRY *Link; QUESTION_OPTION *Option; INTN Result; Link = GetFirstNode (&Question->OptionListHead); while (!IsNull (&Question->OptionListHead, Link)) { Option = QUESTION_OPTION_FROM_LINK (Link); if ((CompareHiiValue (&Option->Value, OptionValue, &Result, NULL) == EFI_SUCCESS) && (Result == 0)) { if ((Option->SuppressExpression == NULL) || ((EvaluateExpressionList (Option->SuppressExpression, FALSE, NULL, NULL) == ExpressFalse))) { return Option; } } Link = GetNextNode (&Question->OptionListHead, Link); } return NULL; }
tianocore/edk2
C++
Other
4,240
/* Return: false - we are done with this request true - still buffers pending for this request */
bool __blk_end_request(struct request *rq, int error, unsigned int nr_bytes)
/* Return: false - we are done with this request true - still buffers pending for this request */ bool __blk_end_request(struct request *rq, int error, unsigned int nr_bytes)
{ return __blk_end_bidi_request(rq, error, nr_bytes, 0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function traces the Device Handle field inside Generic Initiator Affinity Structure. */
STATIC VOID EFIAPI DumpSratDeviceHandle(IN CONST CHAR16 *Format, IN UINT8 *Ptr)
/* This function traces the Device Handle field inside Generic Initiator Affinity Structure. */ STATIC VOID EFIAPI DumpSratDeviceHandle(IN CONST CHAR16 *Format, IN UINT8 *Ptr)
{ if (SratDeviceHandleType == NULL) { IncrementErrorCount (); Print (L"\nERROR: Device Handle Type read incorrectly.\n"); return; } Print (L"\n"); if (*SratDeviceHandleType == EFI_ACPI_6_3_ACPI_DEVICE_HANDLE) { ParseAcpi ( TRUE, 2, NULL, Ptr, sizeof (EFI_ACPI_6_3_DEVICE_HANDLE_ACPI), PARSER_PARAMS (SratDeviceHandleAcpiParser) ); } else if (*SratDeviceHandleType == EFI_ACPI_6_3_PCI_DEVICE_HANDLE) { ParseAcpi ( TRUE, 2, NULL, Ptr, sizeof (EFI_ACPI_6_3_DEVICE_HANDLE_PCI), PARSER_PARAMS (SratDeviceHandlePciParser) ); } }
tianocore/edk2
C++
Other
4,240
/* ixgbe_update_eeprom_checksum_generic - Updates the EEPROM checksum @hw: pointer to hardware structure */
s32 ixgbe_update_eeprom_checksum_generic(struct ixgbe_hw *hw)
/* ixgbe_update_eeprom_checksum_generic - Updates the EEPROM checksum @hw: pointer to hardware structure */ s32 ixgbe_update_eeprom_checksum_generic(struct ixgbe_hw *hw)
{ s32 status; u16 checksum; status = hw->eeprom.ops.read(hw, 0, &checksum); if (status == 0) { checksum = ixgbe_calc_eeprom_checksum(hw); status = hw->eeprom.ops.write(hw, IXGBE_EEPROM_CHECKSUM, checksum); } else { hw_dbg(hw, "EEPROM read failed\n"); } return status; }
robutest/uclinux
C++
GPL-2.0
60
/* Produces and returns an RNG value using either the default or specified RNG algorithm. */
EFI_STATUS EFIAPI RngGetRNG(IN EFI_RNG_PROTOCOL *This, IN EFI_RNG_ALGORITHM *RNGAlgorithm OPTIONAL, IN UINTN RNGValueLength, OUT UINT8 *RNGValue)
/* Produces and returns an RNG value using either the default or specified RNG algorithm. */ EFI_STATUS EFIAPI RngGetRNG(IN EFI_RNG_PROTOCOL *This, IN EFI_RNG_ALGORITHM *RNGAlgorithm OPTIONAL, IN UINTN RNGValueLength, OUT UINT8 *RNGValue)
{ EFI_STATUS Status; if ((This == NULL) || (RNGValueLength == 0) || (RNGValue == NULL)) { return EFI_INVALID_PARAMETER; } Status = EFI_UNSUPPORTED; if (RNGAlgorithm == NULL) { RNGAlgorithm = &gEfiRngAlgorithmSp80090Ctr256Guid; } if (CompareGuid (RNGAlgorithm, &gEfiRngAlgorithmSp80090Ctr256Guid)) { Status = RngGetBytes (RNGValueLength, RNGValue); return Status; } if (CompareGuid (RNGAlgorithm, &gEfiRngAlgorithmRaw)) { if (RNGValueLength < 32) { return EFI_INVALID_PARAMETER; } Status = GenerateEntropy (RNGValueLength, RNGValue); return Status; } return Status; }
tianocore/edk2
C++
Other
4,240
/* Convenience function to directly set a property given the path to the node. */
int fdt_find_and_setprop(void *fdt, const char *node, const char *prop, const void *val, int len, int create)
/* Convenience function to directly set a property given the path to the node. */ int fdt_find_and_setprop(void *fdt, const char *node, const char *prop, const void *val, int len, int create)
{ int nodeoff = fdt_path_offset(fdt, node); if (nodeoff < 0) return nodeoff; if ((!create) && (fdt_get_property(fdt, nodeoff, prop, 0) == NULL)) return 0; return fdt_setprop(fdt, nodeoff, prop, val, len); }
EmcraftSystems/u-boot
C++
Other
181
/* futex_wait_queue_me() - queue_me() and wait for wakeup, timeout, or signal @hb: the futex hash bucket, must be locked by the caller @q: the */
static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q, struct hrtimer_sleeper *timeout)
/* futex_wait_queue_me() - queue_me() and wait for wakeup, timeout, or signal @hb: the futex hash bucket, must be locked by the caller @q: the */ static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q, struct hrtimer_sleeper *timeout)
{ set_current_state(TASK_INTERRUPTIBLE); queue_me(q, hb); if (timeout) { hrtimer_start_expires(&timeout->timer, HRTIMER_MODE_ABS); if (!hrtimer_active(&timeout->timer)) timeout->task = NULL; } if (likely(!plist_node_empty(&q->list))) { if (!timeout || timeout->task) schedule(); } __set_current_state(TASK_RUNNING); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* mux the pin to the "A" internal peripheral role. */
int at91_pio3_set_a_periph(unsigned port, unsigned pin, int use_pullup)
/* mux the pin to the "A" internal peripheral role. */ int at91_pio3_set_a_periph(unsigned port, unsigned pin, int use_pullup)
{ struct at91_port *at91_port = at91_pio_get_port(port); u32 mask; if (at91_port && (pin < GPIO_PER_BANK)) { mask = 1 << pin; writel(mask, &at91_port->idr); at91_set_pio_pullup(port, pin, use_pullup); writel(readl(&at91_port->mux.pio3.abcdsr1) & ~mask, &at91_port->mux.pio3.abcdsr1); writel(readl(&at91_port->mux.pio3.abcdsr2) & ~mask, &at91_port->mux.pio3.abcdsr2); writel(mask, &at91_port->pdr); } return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* 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 Vector19_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 Vector19_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (19 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* The macros are here to save on coding. They assume that the current offset is in 'offset', and that the offset should be incremented after performing the macro's operation. */
static void OUT_RXArray8(ptvcursor_t *cursor, int field, int field_size, int encoding)
/* The macros are here to save on coding. They assume that the current offset is in 'offset', and that the offset should be incremented after performing the macro's operation. */ static void OUT_RXArray8(ptvcursor_t *cursor, int field, int field_size, int encoding)
{ unsigned int i, size = tvb_get_guint8(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); ptvcursor_advance(cursor, 1); for (i=0; i<size; i++) { ptvcursor_add(cursor, field, field_size, encoding); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Fills each ADC_InitStruct member with its default value. */
void ADC_StructInit(ADC_InitTypeDef *ADC_InitStruct)
/* Fills each ADC_InitStruct member with its default value. */ void ADC_StructInit(ADC_InitTypeDef *ADC_InitStruct)
{ ADC_InitStruct->ADC_Resolution = ADC_Resolution_12b; ADC_InitStruct->ADC_ContinuousConvMode = DISABLE; ADC_InitStruct->ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None; ADC_InitStruct->ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_TRGO; ADC_InitStruct->ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStruct->ADC_ScanDirection = ADC_ScanDirection_Upward; }
ajhc/demo-cortex-m3
C++
null
38
/* Append a single value to persisted config. Don't store duplicate value. */
int settings_save_one(const char *name, const void *value, size_t val_len)
/* Append a single value to persisted config. Don't store duplicate value. */ int settings_save_one(const char *name, const void *value, size_t val_len)
{ int rc; struct settings_store *cs; cs = settings_save_dst; if (!cs) { return -ENOENT; } k_mutex_lock(&settings_lock, K_FOREVER); rc = cs->cs_itf->csi_save(cs, name, (char *)value, val_len); k_mutex_unlock(&settings_lock); return rc; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* param base LPUART peripheral base address. param handle Pointer to lpuart_edma_handle_t structure. */
void LPUART_TransferAbortReceiveEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle)
/* param base LPUART peripheral base address. param handle Pointer to lpuart_edma_handle_t structure. */ void LPUART_TransferAbortReceiveEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle)
{ assert(NULL != handle); assert(NULL != handle->rxEdmaHandle); LPUART_EnableRxDMA(base, false); EDMA_AbortTransfer(handle->rxEdmaHandle); handle->rxState = (uint8_t)kLPUART_RxIdle; }
eclipse-threadx/getting-started
C++
Other
310
/* platform_init_cpus() - Tell the world about how many cores we have. This is called while setting up the architecture support (setup_arch()), so don't be too demanding here with respect to available kernel services. */
void __init platform_init_cpus(void)
/* platform_init_cpus() - Tell the world about how many cores we have. This is called while setting up the architecture support (setup_arch()), so don't be too demanding here with respect to available kernel services. */ void __init platform_init_cpus(void)
{ cpu_set(0, cpu_possible_map); cpu_set(1, cpu_possible_map); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Parameters: t: the tree pgno: page number index: page index */
void __bt_setcur(BTREE *t, pgno_t pgno, u_int index)
/* Parameters: t: the tree pgno: page number index: page index */ void __bt_setcur(BTREE *t, pgno_t pgno, u_int index)
{ if (t->bt_cursor.key.data != NULL) { free(t->bt_cursor.key.data); t->bt_cursor.key.size = 0; t->bt_cursor.key.data = NULL; } F_CLR(&t->bt_cursor, CURS_ACQUIRE | CURS_AFTER | CURS_BEFORE); t->bt_cursor.pg.pgno = pgno; t->bt_cursor.pg.index = index; F_SET(&t->bt_cursor, CURS_INIT); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This internal API sets the filter and/or standby duration settings in the sensor according to the settings selected by the user. */
static int8_t set_filter_standby_settings(uint8_t desired_settings, const struct bme280_settings *settings, struct bme280_dev *dev)
/* This internal API sets the filter and/or standby duration settings in the sensor according to the settings selected by the user. */ static int8_t set_filter_standby_settings(uint8_t desired_settings, const struct bme280_settings *settings, struct bme280_dev *dev)
{ int8_t rslt; uint8_t reg_addr = BME280_CONFIG_ADDR; uint8_t reg_data; rslt = bme280_get_regs(reg_addr, &reg_data, 1, dev); if (rslt == BME280_OK) { if (desired_settings & BME280_FILTER_SEL) { fill_filter_settings(&reg_data, settings); } if (desired_settings & BME280_STANDBY_SEL) { fill_standby_settings(&reg_data, settings); } rslt = bme280_set_regs(&reg_addr, &reg_data, 1, dev); } return rslt; }
eclipse-threadx/getting-started
C++
Other
310
/* Disables asynchronous callback generation for a given channel and type. Disables asynchronous callbacks for a given logical DAC channel and type. */
enum status_code dac_chan_disable_callback(struct dac_module *const module_inst, const enum dac_channel channel, const enum dac_callback type)
/* Disables asynchronous callback generation for a given channel and type. Disables asynchronous callbacks for a given logical DAC channel and type. */ enum status_code dac_chan_disable_callback(struct dac_module *const module_inst, const enum dac_channel channel, const enum dac_callback type)
{ Assert(module_inst); UNUSED(channel); if (module_inst->start_on_event == false) { return STATUS_ERR_UNSUPPORTED_DEV; } module_inst->callback_enable[type] = false; return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* create a new memory block with the given size the block is linked next to prev */
struct snd_util_memblk* __snd_util_memblk_new(struct snd_util_memhdr *hdr, unsigned int units, struct list_head *prev)
/* create a new memory block with the given size the block is linked next to prev */ struct snd_util_memblk* __snd_util_memblk_new(struct snd_util_memhdr *hdr, unsigned int units, struct list_head *prev)
{ struct snd_util_memblk *blk; blk = kmalloc(sizeof(struct snd_util_memblk) + hdr->block_extra_size, GFP_KERNEL); if (blk == NULL) return NULL; if (prev == &hdr->block) blk->offset = 0; else { struct snd_util_memblk *p = get_memblk(prev); blk->offset = p->offset + p->size; } blk->size = units; list_add(&blk->list, prev); hdr->nblocks++; hdr->used += units; return blk; }
robutest/uclinux
C++
GPL-2.0
60
/* Return CRC16 of data, in the on-the-wire format used by SD protocol. */
uint16_t sdspi_crc16(const uint8_t *data, size_t size)
/* Return CRC16 of data, in the on-the-wire format used by SD protocol. */ uint16_t sdspi_crc16(const uint8_t *data, size_t size)
{ return __builtin_bswap16(crc16_be(UINT16_MAX, data, size) ^ UINT16_MAX); }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Open the file information on the DirHandle and verify that the Attribute includes EFI_FILE_DIRECTORY bit set. */
EFI_STATUS EFIAPI FileHandleIsDirectory(IN EFI_FILE_HANDLE DirHandle)
/* Open the file information on the DirHandle and verify that the Attribute includes EFI_FILE_DIRECTORY bit set. */ EFI_STATUS EFIAPI FileHandleIsDirectory(IN EFI_FILE_HANDLE DirHandle)
{ EFI_FILE_INFO *DirInfo; if (DirHandle == NULL) { return (EFI_INVALID_PARAMETER); } DirInfo = FileHandleGetInfo (DirHandle); if (DirInfo == NULL) { return (EFI_INVALID_PARAMETER); } if ((DirInfo->Attribute & EFI_FILE_DIRECTORY) == 0) { FreePool (DirInfo); return (EFI_NOT_FOUND); } FreePool (DirInfo); return (EFI_SUCCESS); }
tianocore/edk2
C++
Other
4,240
/* note This is an internal used function, upper layer should not use. */
void FLEXIO_MCULCD_ClearSingleBeatReadConfig(FLEXIO_MCULCD_Type *base)
/* note This is an internal used function, upper layer should not use. */ void FLEXIO_MCULCD_ClearSingleBeatReadConfig(FLEXIO_MCULCD_Type *base)
{ base->flexioBase->TIMCTL[base->timerIndex] = 0U; base->flexioBase->TIMCFG[base->timerIndex] = 0U; base->flexioBase->TIMSTAT = (1UL << base->timerIndex); base->flexioBase->SHIFTCTL[base->rxShifterEndIndex] = 0U; base->flexioBase->SHIFTCFG[base->rxShifterEndIndex] = 0U; base->flexioBase->SHIFTSTAT = (1UL << base->rxShifterEndIndex); }
eclipse-threadx/getting-started
C++
Other
310
/* SPI MSP Initialization This function configures the hardware resources used in this example: */
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
/* SPI MSP Initialization This function configures the hardware resources used in this example: */ void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
{ GPIO_InitTypeDef GPIO_InitStruct; SPIx_SCK_GPIO_CLK_ENABLE(); SPIx_MISO_GPIO_CLK_ENABLE(); SPIx_MOSI_GPIO_CLK_ENABLE(); GPIO_InitStruct.Pin = SPIx_SCK_PIN; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLDOWN; GPIO_InitStruct.Speed = GPIO_SPEED_FAST; GPIO_InitStruct.Alternate = SPIx_SCK_AF; HAL_GPIO_Init(SPIx_SCK_GPIO_PORT, &GPIO_InitStruct); GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Pin = SPIx_MISO_PIN; HAL_GPIO_Init(SPIx_MISO_GPIO_PORT, &GPIO_InitStruct); GPIO_InitStruct.Pin = SPIx_MOSI_PIN; HAL_GPIO_Init(SPIx_MOSI_GPIO_PORT, &GPIO_InitStruct); SPIx_CLK_ENABLE(); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Reset USB Device Core Parameters: None Return Value: None */
void usbd_reset_core(void)
/* Reset USB Device Core Parameters: None Return Value: None */ void usbd_reset_core(void)
{ USBD_DeviceStatus = usbd_power; USBD_DeviceAddress = 0; USBD_Configuration = 0; USBD_EndPointMask = 0x00010001; USBD_EndPointHalt = 0x00000000; USBD_EndPointStall = 0x00000000; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Authenticate entry function with ARENA allocator init. This is called by ROM boot or by ROM API g_skbootAuthenticateInterface */
skboot_status_t skboot_authenticate(const uint8_t *imageStartAddr, secure_bool_t *isSignVerified)
/* Authenticate entry function with ARENA allocator init. This is called by ROM boot or by ROM API g_skbootAuthenticateInterface */ skboot_status_t skboot_authenticate(const uint8_t *imageStartAddr, secure_bool_t *isSignVerified)
{ assert(BOOTLOADER_API_TREE_POINTER); return BOOTLOADER_API_TREE_POINTER->skbootAuthenticate->skboot_authenticate_function(imageStartAddr, isSignVerified); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* returns SUCCESS if it successfully received a message notification */
static s32 e1000_poll_for_msg(struct e1000_hw *hw)
/* returns SUCCESS if it successfully received a message notification */ static s32 e1000_poll_for_msg(struct e1000_hw *hw)
{ struct e1000_mbx_info *mbx = &hw->mbx; int countdown = mbx->timeout; if (!mbx->ops.check_for_msg) goto out; while (countdown && mbx->ops.check_for_msg(hw)) { countdown--; udelay(mbx->usec_delay); } if (!countdown) mbx->timeout = 0; out: return countdown ? E1000_SUCCESS : -E1000_ERR_MBX; }
robutest/uclinux
C++
GPL-2.0
60
/* Ensure data for SATA controller is flushed out of dcache and written to physical memory. */
static void ahci_dcache_flush_sata_cmd(struct ahci_ioports *pp)
/* Ensure data for SATA controller is flushed out of dcache and written to physical memory. */ static void ahci_dcache_flush_sata_cmd(struct ahci_ioports *pp)
{ ahci_dcache_flush_range((unsigned long)pp->cmd_slot, AHCI_PORT_PRIV_DMA_SZ); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Read the bios version. Return the version as an integer corresponding to the ascii value, for example "A17" is returned as 0x00413137. */
static int i8k_get_bios_version(void)
/* Read the bios version. Return the version as an integer corresponding to the ascii value, for example "A17" is returned as 0x00413137. */ static int i8k_get_bios_version(void)
{ struct smm_regs regs = { .eax = I8K_SMM_BIOS_VERSION, }; return i8k_smm(&regs) ? : regs.eax; }
robutest/uclinux
C++
GPL-2.0
60
/* Function for scheduling a Timer Stop All operation. */
static uint32_t timer_stop_all_op_schedule(timer_user_id_t user_id)
/* Function for scheduling a Timer Stop All operation. */ static uint32_t timer_stop_all_op_schedule(timer_user_id_t user_id)
{ uint8_t last_index; timer_user_op_t * p_user_op = user_op_alloc(&mp_users[user_id], &last_index); if (p_user_op == NULL) { return NRF_ERROR_NO_MEM; } p_user_op->op_type = TIMER_USER_OP_TYPE_STOP_ALL; p_user_op->p_node = NULL; user_op_enque(&mp_users[user_id], last_index); timer_list_handler_sched(); return NRF_SUCCESS; }
labapart/polymcu
C++
null
201
/* Add a metric value to the address if a corresponding TLV exists in the message */
static void add_temp_metric_value(nhdp_addr_t *address)
/* Add a metric value to the address if a corresponding TLV exists in the message */ static void add_temp_metric_value(nhdp_addr_t *address)
{ if (_nhdp_addr_tlvs[RFC5444_ADDRTLV_LINK_METRIC].tlv) { uint16_t metric_enc = *((uint16_t*)_nhdp_addr_tlvs[RFC5444_ADDRTLV_LINK_METRIC] .tlv->single_value); if (metric_enc & (NHDP_KD_LM_INC | NHDP_KD_NM_INC)) { address->tmp_metric_val = metric_enc; } } }
labapart/polymcu
C++
null
201
/* Enter Deep Power Down mode with co-operated instruction by the Cortex-M3. */
void CLKPWR_DeepPowerDown(void)
/* Enter Deep Power Down mode with co-operated instruction by the Cortex-M3. */ void CLKPWR_DeepPowerDown(void)
{ SCB->SCR = 0x4; LPC_SC->PCON = 0x03; __WFI(); }
ajhc/demo-cortex-m3
C++
null
38
/* Returns: TRUE if @data was successfully added to the @stream. */
gboolean g_data_output_stream_put_byte(GDataOutputStream *stream, guchar data, GCancellable *cancellable, GError **error)
/* Returns: TRUE if @data was successfully added to the @stream. */ gboolean g_data_output_stream_put_byte(GDataOutputStream *stream, guchar data, GCancellable *cancellable, GError **error)
{ gsize bytes_written; g_return_val_if_fail (G_IS_DATA_OUTPUT_STREAM (stream), FALSE); return g_output_stream_write_all (G_OUTPUT_STREAM (stream), &data, 1, &bytes_written, cancellable, error); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* In instruction register encoding 31 can refer to ZR (zero register) or the SP (stack pointer) depending on context. In QEMU's case we map SP to cpu_X and ZR accesses to a temporary which can be discarded. This is the point of the _sp forms. */
static TCGv_i64 cpu_reg(DisasContext *s, int reg)
/* In instruction register encoding 31 can refer to ZR (zero register) or the SP (stack pointer) depending on context. In QEMU's case we map SP to cpu_X and ZR accesses to a temporary which can be discarded. This is the point of the _sp forms. */ static TCGv_i64 cpu_reg(DisasContext *s, int reg)
{ if (reg == 31) { return new_tmp_a64_zero(s); } else { return cpu_X[reg]; } }
ve3wwg/teensy3_qemu
C++
Other
15
/* Check whether a given upvalue from a given closure exists and returns its index */
static void* checkupval(lua_State *L, int argf, int argnup, int *pnup)
/* Check whether a given upvalue from a given closure exists and returns its index */ static void* checkupval(lua_State *L, int argf, int argnup, int *pnup)
{ luaL_argcheck(L, id != NULL, argnup, "invalid upvalue index"); *pnup = nup; } return id; }
Nicholas3388/LuaNode
C++
Other
1,055
/* This function returns the number of padding bytes on success and SCANNED_GARBAGE on failure. */
static int scan_padding_bytes(void *buf, int len)
/* This function returns the number of padding bytes on success and SCANNED_GARBAGE on failure. */ static int scan_padding_bytes(void *buf, int len)
{ int pad_len = 0, max_pad_len = min_t(int, UBIFS_PAD_NODE_SZ, len); uint8_t *p = buf; dbg_scan("not a node"); while (pad_len < max_pad_len && *p++ == UBIFS_PADDING_BYTE) pad_len += 1; if (!pad_len || (pad_len & 7)) return SCANNED_GARBAGE; dbg_scan("%d padding bytes", pad_len); return pad_len; }
EmcraftSystems/u-boot
C++
Other
181
/* If called for a synchronised ADC conversion, it may sleep with the ADC semaphore held. */
unsigned int ucb1x00_adc_read(struct ucb1x00 *ucb, int adc_channel, int sync)
/* If called for a synchronised ADC conversion, it may sleep with the ADC semaphore held. */ unsigned int ucb1x00_adc_read(struct ucb1x00 *ucb, int adc_channel, int sync)
{ unsigned int val; if (sync) adc_channel |= UCB_ADC_SYNC_ENA; ucb1x00_reg_write(ucb, UCB_ADC_CR, ucb->adc_cr | adc_channel); ucb1x00_reg_write(ucb, UCB_ADC_CR, ucb->adc_cr | adc_channel | UCB_ADC_START); for (;;) { val = ucb1x00_reg_read(ucb, UCB_ADC_DATA); if (val & UCB_ADC_DAT_VAL) break; set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(1); } return UCB_ADC_DAT(val); }
robutest/uclinux
C++
GPL-2.0
60
/* This set option will delete a shared secret key from use. */
static int sctp_setsockopt_del_key(struct sock *sk, char __user *optval, unsigned int optlen)
/* This set option will delete a shared secret key from use. */ static int sctp_setsockopt_del_key(struct sock *sk, char __user *optval, unsigned int optlen)
{ struct sctp_authkeyid val; struct sctp_association *asoc; if (!sctp_auth_enable) return -EACCES; if (optlen != sizeof(struct sctp_authkeyid)) return -EINVAL; if (copy_from_user(&val, optval, optlen)) return -EFAULT; asoc = sctp_id2assoc(sk, val.scact_assoc_id); if (!asoc && val.scact_assoc_id && sctp_style(sk, UDP)) return -EINVAL; return sctp_auth_del_key_id(sctp_sk(sk)->ep, asoc, val.scact_keynumber); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If 16-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI MmioBitFieldWrite16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
/* If 16-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT16 EFIAPI MmioBitFieldWrite16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
{ return MmioWrite16 ( Address, BitFieldWrite16 (MmioRead16 (Address), StartBit, EndBit, Value) ); }
tianocore/edk2
C++
Other
4,240
/* This API is used to get the axis enable of fifo data select in the register 0x3E bit 0 and 1. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_fifo_data_select(u8 *fifo_data_select_u8)
/* This API is used to get the axis enable of fifo data select in the register 0x3E bit 0 and 1. */ BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_fifo_data_select(u8 *fifo_data_select_u8)
{ BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR; u8 data_u8 = BMA2x2_INIT_VALUE; if (p_bma2x2 == BMA2x2_NULL) { return E_BMA2x2_NULL_PTR; } else { com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC( p_bma2x2->dev_addr, BMA2x2_FIFO_DATA_SELECT_REG, &data_u8, BMA2x2_GEN_READ_WRITE_LENGTH); *fifo_data_select_u8 = BMA2x2_GET_BITSLICE(data_u8, BMA2x2_FIFO_DATA_SELECT); } return com_rslt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* NOTE: This call will fail if the architectural ResetSystem underpinnings are not initialized. For DXE, you can add gEfiResetArchProtocolGuid to your DEPEX. */
VOID EFIAPI ResetPlatformSpecificGuid(IN CONST GUID *ResetSubtype)
/* NOTE: This call will fail if the architectural ResetSystem underpinnings are not initialized. For DXE, you can add gEfiResetArchProtocolGuid to your DEPEX. */ VOID EFIAPI ResetPlatformSpecificGuid(IN CONST GUID *ResetSubtype)
{ ResetSystemWithSubtype (EfiResetPlatformSpecific, ResetSubtype); }
tianocore/edk2
C++
Other
4,240
/* set_attention_status - Turns the Amber LED for a slot on, off or blink */
static int set_attention_status(struct hotplug_slot *slot, u8 value)
/* set_attention_status - Turns the Amber LED for a slot on, off or blink */ static int set_attention_status(struct hotplug_slot *slot, u8 value)
{ struct slot *slot = hotplug_slot->private; ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", __func__, slot_name(slot)); return pciehp_set_attention_status(slot, status); }
robutest/uclinux
C++
GPL-2.0
60
/* ixgbe_atr_get_vm_pool_82599 - Gets the Virtual Machine pool @input: input stream to modify @vm_pool: the Virtual Machine pool to load */
s32 ixgbe_atr_get_vm_pool_82599(struct ixgbe_atr_input *input, u8 *vm_pool)
/* ixgbe_atr_get_vm_pool_82599 - Gets the Virtual Machine pool @input: input stream to modify @vm_pool: the Virtual Machine pool to load */ s32 ixgbe_atr_get_vm_pool_82599(struct ixgbe_atr_input *input, u8 *vm_pool)
{ *vm_pool = input->byte_stream[IXGBE_ATR_VM_POOL_OFFSET]; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Gets a data element from the SPI interface. */
void xSPIDataRead(unsigned long ulBase, void *pulRData, unsigned long ulLen)
/* Gets a data element from the SPI interface. */ void xSPIDataRead(unsigned long ulBase, void *pulRData, unsigned long ulLen)
{ SPIDataRead(ulBase, pulRData, ulLen); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Prints a float variable with max numbers after decimal. */
static void print_float(float f, uint32_t max)
/* Prints a float variable with max numbers after decimal. */ static void print_float(float f, uint32_t max)
{ uint32_t i = 0; uint32_t smax = max; i = (uint32_t)f; printf("%d.", (int)i); f -= i; while (f >= 0.0 && max--) { f *= 10; i = (uint32_t)f; printf("%d", (int)i); f -= i; } if (smax == max) { printf("0"); } }
remotemcu/remcu-chip-sdks
C++
null
436
/* __ad_timer_to_ticks - convert a given timer type to AD module ticks @timer_type: which timer to operate */
static u16 __ad_timer_to_ticks(u16 timer_type, u16 par)
/* __ad_timer_to_ticks - convert a given timer type to AD module ticks @timer_type: which timer to operate */ static u16 __ad_timer_to_ticks(u16 timer_type, u16 par)
{ u16 retval=0; switch (timer_type) { case AD_CURRENT_WHILE_TIMER: if (par) { retval = (AD_SHORT_TIMEOUT_TIME*ad_ticks_per_sec); } else { retval = (AD_LONG_TIMEOUT_TIME*ad_ticks_per_sec); } break; case AD_ACTOR_CHURN_TIMER: retval = (AD_CHURN_DETECTION_TIME*ad_ticks_per_sec); break; case AD_PERIODIC_TIMER: retval = (par*ad_ticks_per_sec); break; case AD_PARTNER_CHURN_TIMER: retval = (AD_CHURN_DETECTION_TIME*ad_ticks_per_sec); break; case AD_WAIT_WHILE_TIMER: retval = (AD_AGGREGATE_WAIT_TIME*ad_ticks_per_sec); break; } return retval; }
robutest/uclinux
C++
GPL-2.0
60
/* 1.) resume CPUfreq hardware support (cpufreq_driver->resume()) 2.) schedule call cpufreq_update_policy() ASAP as interrupts are restored. It will verify that the current freq is in sync with what we believe it to be. This is a bit later than when it should be, but nonethteless it's better than calling cpufreq_driver->get() here which might re-enable interrupts... */
static int cpufreq_resume(struct sys_device *sysdev)
/* 1.) resume CPUfreq hardware support (cpufreq_driver->resume()) 2.) schedule call cpufreq_update_policy() ASAP as interrupts are restored. It will verify that the current freq is in sync with what we believe it to be. This is a bit later than when it should be, but nonethteless it's better than calling cpufreq_driver->get() here which might re-enable interrupts... */ static int cpufreq_resume(struct sys_device *sysdev)
{ int ret = 0; int cpu = sysdev->id; struct cpufreq_policy *cpu_policy; dprintk("resuming cpu %u\n", cpu); if (!cpu_online(cpu)) return 0; cpu_policy = cpufreq_cpu_get(cpu); if (!cpu_policy) return -EINVAL; if (unlikely(cpu_policy->cpu != cpu)) goto fail; if (cpufreq_driver->resume) { ret = cpufreq_driver->resume(cpu_policy); if (ret) { printk(KERN_ERR "cpufreq: resume failed in ->resume " "step on CPU %u\n", cpu_policy->cpu); goto fail; } } schedule_work(&cpu_policy->update); fail: cpufreq_cpu_put(cpu_policy); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* This function searches the next MSG_USB_DP device path node. */
EFI_DEVICE_PATH_PROTOCOL* UsbNicGetNextMsgUsbDp(IN EFI_DEVICE_PATH_PROTOCOL *ThisDevicePath)
/* This function searches the next MSG_USB_DP device path node. */ EFI_DEVICE_PATH_PROTOCOL* UsbNicGetNextMsgUsbDp(IN EFI_DEVICE_PATH_PROTOCOL *ThisDevicePath)
{ if (ThisDevicePath == NULL) { return NULL; } while (TRUE) { ThisDevicePath = NextDevicePathNode (ThisDevicePath); if (IsDevicePathEnd (ThisDevicePath)) { return NULL; } if ((ThisDevicePath->Type == MESSAGING_DEVICE_PATH) && (ThisDevicePath->SubType == MSG_USB_DP)) { return ThisDevicePath; } } return NULL; }
tianocore/edk2
C++
Other
4,240
/* The uIP network application that detects the XCP connect command on the port used by the bootloader. This indicates that the bootloader should be activated. */
void NetApp(void)
/* The uIP network application that detects the XCP connect command on the port used by the bootloader. This indicates that the bootloader should be activated. */ void NetApp(void)
{ unsigned char *newDataPtr; unsigned short newDataLen; if (uip_connected()) { return; } if (uip_newdata()) { newDataPtr = uip_appdata; newDataPtr += 4; newDataLen = uip_datalen() - 4; if ((newDataPtr[0] == 0xff) && (newDataLen == 2)) { SharedParamsWriteByIndex(0, 1); BootActivate(); } } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* The caller of do_ur_io is responsible for kfree()ing the channel program address pointer that alloc_chan_prog returned. */
static void free_chan_prog(struct ccw1 *cpa)
/* The caller of do_ur_io is responsible for kfree()ing the channel program address pointer that alloc_chan_prog returned. */ static void free_chan_prog(struct ccw1 *cpa)
{ struct ccw1 *ptr = cpa; while (ptr->cda) { kfree((void *)(addr_t) ptr->cda); ptr++; } kfree(cpa); }
robutest/uclinux
C++
GPL-2.0
60
/* Set DAC Channel LFSR Mask or Triangle Wave Amplitude. Sets the digital to analog converter superimposed waveform generation characteristics. */
void dac_set_waveform_characteristics(uint32_t dac, int channel, int mamp)
/* Set DAC Channel LFSR Mask or Triangle Wave Amplitude. Sets the digital to analog converter superimposed waveform generation characteristics. */ void dac_set_waveform_characteristics(uint32_t dac, int channel, int mamp)
{ uint32_t reg = DAC_CR(dac); switch(channel) { case DAC_CHANNEL1: reg &= ~(DAC_CR_MAMPx_MASK << DAC_CR_MAMP1_SHIFT); reg |= mamp << DAC_CR_MAMP1_SHIFT; break; case DAC_CHANNEL2: reg &= ~(DAC_CR_MAMPx_MASK << DAC_CR_MAMP2_SHIFT); reg |= mamp << DAC_CR_MAMP2_SHIFT; break; case DAC_CHANNEL_BOTH: reg &= ~(DAC_CR_MAMPx_MASK << DAC_CR_MAMP1_SHIFT) | ~(DAC_CR_MAMPx_MASK << DAC_CR_MAMP2_SHIFT); reg |= mamp << DAC_CR_MAMP1_SHIFT; reg |= mamp << DAC_CR_MAMP2_SHIFT; break; default: break; } DAC_CR(dac) = reg; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Creates user areas with defined lengths. Needs the I2C Password presentation to be effective. */
int32_t BSP_NFCTAG_CreateUserZone(uint32_t Instance, uint16_t Zone1Length, uint16_t Zone2Length, uint16_t Zone3Length, uint16_t Zone4Length)
/* Creates user areas with defined lengths. Needs the I2C Password presentation to be effective. */ int32_t BSP_NFCTAG_CreateUserZone(uint32_t Instance, uint16_t Zone1Length, uint16_t Zone2Length, uint16_t Zone3Length, uint16_t Zone4Length)
{ UNUSED(Instance); return ST25DV_CreateUserZone(&NfcTagObj, Zone1Length, Zone2Length, Zone3Length, Zone4Length); }
eclipse-threadx/getting-started
C++
Other
310
/* brief Return Frequency of Usb0 Clock return Frequency of Usb0 Clock. */
uint32_t CLOCK_GetUsb0ClkFreq(void)
/* brief Return Frequency of Usb0 Clock return Frequency of Usb0 Clock. */ uint32_t CLOCK_GetUsb0ClkFreq(void)
{ uint32_t freq = 0U; switch (SYSCON->USB0CLKSEL) { case 0U: freq = CLOCK_GetCoreSysClkFreq(); break; case 1U: freq = CLOCK_GetPll0OutFreq(); break; case 3U: freq = CLOCK_GetFroHfFreq(); break; case 5U: freq = CLOCK_GetPll1OutFreq(); break; case 7U: freq = 0U; break; default: assert(false); break; } return freq / ((SYSCON->USB0CLKDIV & 0xffU) + 1U); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Sets the receive address array register at index to the address passed in by addr. */
void igb_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
/* Sets the receive address array register at index to the address passed in by addr. */ void igb_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
{ u32 rar_low, rar_high; rar_low = ((u32) addr[0] | ((u32) addr[1] << 8) | ((u32) addr[2] << 16) | ((u32) addr[3] << 24)); rar_high = ((u32) addr[4] | ((u32) addr[5] << 8)); if (rar_low || rar_high) rar_high |= E1000_RAH_AV; wr32(E1000_RAL(index), rar_low); wrfl(); wr32(E1000_RAH(index), rar_high); wrfl(); }
robutest/uclinux
C++
GPL-2.0
60
/* send the command of get HID descriptor to the device */
static usbh_status usbh_hid_desc_get(usbh_host *uhost, uint16_t len)
/* send the command of get HID descriptor to the device */ static usbh_status usbh_hid_desc_get(usbh_host *uhost, uint16_t len)
{ usbh_status status = USBH_BUSY; if (CTL_IDLE == uhost->control.ctl_state) { uhost->control.setup.req = (usb_req) { .bmRequestType = USB_TRX_IN | USB_RECPTYPE_ITF | USB_REQTYPE_STRD, .bRequest = USB_GET_DESCRIPTOR, .wValue = USBH_DESC(USB_DESCTYPE_HID), .wIndex = 0U, .wLength = len }; usbh_ctlstate_config (uhost, uhost->dev_prop.data, len); } status = usbh_ctl_handler (uhost); return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Called by the upper tty layer when the tty buffers are almost full. The driver should stop send more data. */
static void ntty_throttle(struct tty_struct *tty)
/* Called by the upper tty layer when the tty buffers are almost full. The driver should stop send more data. */ static void ntty_throttle(struct tty_struct *tty)
{ struct nozomi *dc = get_dc_by_tty(tty); unsigned long flags; DBG1("THROTTLE"); spin_lock_irqsave(&dc->spin_mutex, flags); set_rts(tty, 0); spin_unlock_irqrestore(&dc->spin_mutex, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Initialize the DE4X5 operating conditions. NB: a chip problem with the DC21140 requires using perfect filtering mode for that chip. Since I can't see why I'd want > 14 multicast addresses, I have changed all chips to use the perfect filtering mode. Keep the DMA burst length at 8: there seems to be data corruption problems if it is larger (UDP errors seen from a ttcp source). */
static int de4x5_init(struct net_device *dev)
/* Initialize the DE4X5 operating conditions. NB: a chip problem with the DC21140 requires using perfect filtering mode for that chip. Since I can't see why I'd want > 14 multicast addresses, I have changed all chips to use the perfect filtering mode. Keep the DMA burst length at 8: there seems to be data corruption problems if it is larger (UDP errors seen from a ttcp source). */ static int de4x5_init(struct net_device *dev)
{ netif_stop_queue(dev); de4x5_sw_reset(dev); autoconf_media(dev); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Find a dissector by name and add parent protocol as a depedency */
dissector_handle_t find_dissector_add_dependency(const char *name, const int parent_proto)
/* Find a dissector by name and add parent protocol as a depedency */ dissector_handle_t find_dissector_add_dependency(const char *name, const int parent_proto)
{ dissector_handle_t handle = (dissector_handle_t)g_hash_table_lookup(registered_dissectors, name); if ((handle != NULL) && (parent_proto > 0)) { register_depend_dissector(proto_get_protocol_short_name(find_protocol_by_id(parent_proto)), dissector_handle_get_short_name(handle)); } return handle; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* get the number of remaining data to be transferred by the DMA */
uint32_t dma_transfer_number_get(dma_channel_enum channelx)
/* get the number of remaining data to be transferred by the DMA */ uint32_t dma_transfer_number_get(dma_channel_enum channelx)
{ return (uint32_t)DMA_CHCNT(channelx); }
liuxuming/trochili
C++
Apache License 2.0
132
/* Write data out to VME space from a buffer. */
ssize_t vme_master_write(struct vme_resource *resource, void *buf, size_t count, loff_t offset)
/* Write data out to VME space from a buffer. */ ssize_t vme_master_write(struct vme_resource *resource, void *buf, size_t count, loff_t offset)
{ struct vme_bridge *bridge = find_bridge(resource); struct vme_master_resource *image; size_t length; if (bridge->master_write == NULL) { printk("Writing to resource not supported\n"); return -EINVAL; } if (resource->type != VME_MASTER) { printk("Not a master resource\n"); return -EINVAL; } image = list_entry(resource->entry, struct vme_master_resource, list); length = vme_get_size(resource); if (offset > length) { printk("Invalid Offset\n"); return -EFAULT; } if ((offset + count) > length) count = length - offset; return bridge->master_write(image, buf, count, offset); }
robutest/uclinux
C++
GPL-2.0
60
/* Access the Scratchpad registers 0..7 of the Intel bridge. */
void i2155x_write_scrapad(int idx, u32 val)
/* Access the Scratchpad registers 0..7 of the Intel bridge. */ void i2155x_write_scrapad(int idx, u32 val)
{ if (idx >= 0 && idx < I2155X_SCRAPAD_MAX) out_le32(i2155x.csr + (I2155X_SCRAPAD_ADDR/4) + idx, val); else printf("i2155x_write_scrapad: invalid index\n"); }
EmcraftSystems/u-boot
C++
Other
181
/* frees smsclient object and all subclients associated with it */
void smscore_unregister_client(struct smscore_client_t *client)
/* frees smsclient object and all subclients associated with it */ void smscore_unregister_client(struct smscore_client_t *client)
{ struct smscore_device_t *coredev = client->coredev; unsigned long flags; spin_lock_irqsave(&coredev->clientslock, flags); while (!list_empty(&client->idlist)) { struct smscore_idlist_t *identry = (struct smscore_idlist_t *) client->idlist.next; list_del(&identry->entry); kfree(identry); } sms_info("%p", client->context); list_del(&client->entry); kfree(client); spin_unlock_irqrestore(&coredev->clientslock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Enable Snapshot for messages relevant to Master. When enabled, snapshot is taken for messages relevant to master mode only, else snapshot is taken for messages relevant to slave node. Valid only for Ordinary clock and Boundary clock Reserved when "Advanced Time Stamp" is not selected */
void synopGMAC_TS_master_enable(synopGMACdevice *gmacdev)
/* Enable Snapshot for messages relevant to Master. When enabled, snapshot is taken for messages relevant to master mode only, else snapshot is taken for messages relevant to slave node. Valid only for Ordinary clock and Boundary clock Reserved when "Advanced Time Stamp" is not selected */ void synopGMAC_TS_master_enable(synopGMACdevice *gmacdev)
{ synopGMACSetBits(gmacdev->MacBase, GmacTSControl, GmacTSMSTRENA); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This informs the device driver that the device is permanently dead, and that no further recovery attempts will be made on it. */
static int eeh_report_failure(struct pci_dev *dev, void *userdata)
/* This informs the device driver that the device is permanently dead, and that no further recovery attempts will be made on it. */ static int eeh_report_failure(struct pci_dev *dev, void *userdata)
{ struct pci_driver *driver = dev->driver; dev->error_state = pci_channel_io_perm_failure; if (!driver) return 0; eeh_disable_irq(dev); if (!driver->err_handler || !driver->err_handler->error_detected) return 0; driver->err_handler->error_detected(dev, pci_channel_io_perm_failure); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Sets slow clock counter match value to interrupt the processor. */
void PRCMSlowClkCtrMatchSet(unsigned long long ullValue)
/* Sets slow clock counter match value to interrupt the processor. */ void PRCMSlowClkCtrMatchSet(unsigned long long ullValue)
{ MAP_PRCMHIBRegWrite(HIB3P3_BASE + HIB3P3_O_MEM_HIB_RTC_IRQ_LSW_CONF, (unsigned long)(ullValue)); MAP_PRCMHIBRegWrite(HIB3P3_BASE + HIB3P3_O_MEM_HIB_RTC_IRQ_MSW_CONF, (unsigned long)(ullValue>>32)); }
micropython/micropython
C++
Other
18,334
/* Redirect a SCHEDULER handler. Set the current SCHEDULER handler. With */
void UTIL_SetSchHandler(enum eSchHandler Ix, tHandler pHDL)
/* Redirect a SCHEDULER handler. Set the current SCHEDULER handler. With */ void UTIL_SetSchHandler(enum eSchHandler Ix, tHandler pHDL)
{ if (Ix<SCH_HDL_MAX) SchHandler[Ix] = pHDL; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Initiate the reap timer running on the target CPU. We run at around 1 to 2Hz via the workqueue/eventd. Add the CPU number into the expiration time to minimize the possibility of the CPUs getting into lockstep and contending for the global cache chain lock. */
static void __cpuinit start_cpu_timer(int cpu)
/* Initiate the reap timer running on the target CPU. We run at around 1 to 2Hz via the workqueue/eventd. Add the CPU number into the expiration time to minimize the possibility of the CPUs getting into lockstep and contending for the global cache chain lock. */ static void __cpuinit start_cpu_timer(int cpu)
{ struct delayed_work *reap_work = &per_cpu(slab_reap_work, cpu); if (keventd_up() && reap_work->work.func == NULL) { init_reap_node(cpu); INIT_DELAYED_WORK(reap_work, cache_reap); schedule_delayed_work_on(cpu, reap_work, __round_jiffies_relative(HZ, cpu)); } }
robutest/uclinux
C++
GPL-2.0
60
/* This opens a file, reads it into memory and returns a memory file object. */
EFI_STATUS GetMemoryFile(IN CHAR8 *InputFileName, OUT EFI_HANDLE *OutputMemoryFile)
/* This opens a file, reads it into memory and returns a memory file object. */ EFI_STATUS GetMemoryFile(IN CHAR8 *InputFileName, OUT EFI_HANDLE *OutputMemoryFile)
{ EFI_STATUS Status; CHAR8 *InputFileImage; UINT32 BytesRead; MEMORY_FILE *NewMemoryFile; Status = GetFileImage (InputFileName, &InputFileImage, &BytesRead); if (EFI_ERROR (Status)) { return Status; } NewMemoryFile = malloc (sizeof (*NewMemoryFile)); if (NewMemoryFile == NULL) { free (InputFileImage); return EFI_OUT_OF_RESOURCES; } NewMemoryFile->FileImage = InputFileImage; NewMemoryFile->CurrentFilePointer = InputFileImage; NewMemoryFile->Eof = InputFileImage + BytesRead; *OutputMemoryFile = (EFI_HANDLE)NewMemoryFile; CheckMemoryFileState (*OutputMemoryFile); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Caller can NOT assume anything about the contents of the buffer_heads - they are passed back only so that it can be passed into any one of the manipulation functions (add entry, delete entry, etc). As an example, bh in the extent directory case is a data block, in the inline-data case it actually points to an inode, in the indexed directory case, multiple buffers are involved. */
int ocfs2_find_entry(const char *name, int namelen, struct inode *dir, struct ocfs2_dir_lookup_result *lookup)
/* Caller can NOT assume anything about the contents of the buffer_heads - they are passed back only so that it can be passed into any one of the manipulation functions (add entry, delete entry, etc). As an example, bh in the extent directory case is a data block, in the inline-data case it actually points to an inode, in the indexed directory case, multiple buffers are involved. */ int ocfs2_find_entry(const char *name, int namelen, struct inode *dir, struct ocfs2_dir_lookup_result *lookup)
{ struct buffer_head *bh; struct ocfs2_dir_entry *res_dir = NULL; if (ocfs2_dir_indexed(dir)) return ocfs2_find_entry_dx(name, namelen, dir, lookup); if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL) bh = ocfs2_find_entry_id(name, namelen, dir, &res_dir); else bh = ocfs2_find_entry_el(name, namelen, dir, &res_dir); if (bh == NULL) return -ENOENT; lookup->dl_leaf_bh = bh; lookup->dl_entry = res_dir; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Notifies the USB High-Speed bus events to the device stack */
sl_status_t sli_usbd_core_high_speed_event(void)
/* Notifies the USB High-Speed bus events to the device stack */ sl_status_t sli_usbd_core_high_speed_event(void)
{ usbd_core_set_event(SLI_USBD_EVENT_BUS_HS); return SL_STATUS_OK; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Callers are responsible for ensuring the channel mapping logic is included in that particular EDMA variant (Eg : dm646x) */
static void map_dmach_param(unsigned ctlr)
/* Callers are responsible for ensuring the channel mapping logic is included in that particular EDMA variant (Eg : dm646x) */ static void map_dmach_param(unsigned ctlr)
{ int i; for (i = 0; i < EDMA_MAX_DMACH; i++) edma_write_array(ctlr, EDMA_DCHMAP , i , (i << 5)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Fills each LCD_InitStruct member with its default value. */
void LCD_StructInit(LCD_InitTypeDef *LCD_InitStruct)
/* Fills each LCD_InitStruct member with its default value. */ void LCD_StructInit(LCD_InitTypeDef *LCD_InitStruct)
{ LCD_InitStruct->LCD_Prescaler = LCD_Prescaler_1; LCD_InitStruct->LCD_Divider = LCD_Divider_16; LCD_InitStruct->LCD_Duty = LCD_Duty_Static; LCD_InitStruct->LCD_Bias = LCD_Bias_1_4; LCD_InitStruct->LCD_VoltageSource = LCD_VoltageSource_Internal; }
avem-labs/Avem
C++
MIT License
1,752
/* Clear the status of the specified TMR2 flag. */
void TMR2_ClearStatus(CM_TMR2_TypeDef *TMR2x, uint32_t u32Flag)
/* Clear the status of the specified TMR2 flag. */ void TMR2_ClearStatus(CM_TMR2_TypeDef *TMR2x, uint32_t u32Flag)
{ DDL_ASSERT(IS_TMR2_UNIT(TMR2x)); DDL_ASSERT(IS_TMR2_FLAG(u32Flag)); CLR_REG32_BIT(TMR2x->STFLR, u32Flag); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Add a new entry to the list. Insert a new entry before the specified head. This is good for implementing queues. */
void ListAddToTail(PRT_LIST_ENTRY ListNew, PRT_LIST_HEAD ListHead)
/* Add a new entry to the list. Insert a new entry before the specified head. This is good for implementing queues. */ void ListAddToTail(PRT_LIST_ENTRY ListNew, PRT_LIST_HEAD ListHead)
{ ListAdd(ListNew, ListHead->Prev, ListHead); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Atomic bitwise inclusive OR primitive. is atomically bitwise OR'ed with the value at <target>, placing the result at <target>, and the previous value at <target> is returned. */
atomic_val_t z_impl_atomic_or(atomic_t *target, atomic_val_t value)
/* Atomic bitwise inclusive OR primitive. is atomically bitwise OR'ed with the value at <target>, placing the result at <target>, and the previous value at <target> is returned. */ atomic_val_t z_impl_atomic_or(atomic_t *target, atomic_val_t value)
{ k_spinlock_key_t key; atomic_val_t ret; key = k_spin_lock(&lock); ret = *target; *target |= value; k_spin_unlock(&lock, key); return ret; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Master sends single byte through the I2Cx peripheral according to the set of the upper layer. */
void I2C_MasterSend(I2C_TypeDef *I2Cx, u8 *pBuf, u8 I2CCmd, u8 I2CStop, u8 I2CReSTR)
/* Master sends single byte through the I2Cx peripheral according to the set of the upper layer. */ void I2C_MasterSend(I2C_TypeDef *I2Cx, u8 *pBuf, u8 I2CCmd, u8 I2CStop, u8 I2CReSTR)
{ assert_param(IS_I2C_ALL_PERIPH(I2Cx)); I2Cx->IC_DATA_CMD = *(pBuf) | (I2CReSTR << 10) | (I2CCmd << 8) | (I2CStop << 9); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Check if there are any bad blocks, and whether length including bad blocks fits into device */
static int check_skip_len(struct mtd_info *mtd, loff_t offset, size_t length, size_t *used)
/* Check if there are any bad blocks, and whether length including bad blocks fits into device */ static int check_skip_len(struct mtd_info *mtd, loff_t offset, size_t length, size_t *used)
{ size_t len_excl_bad = 0; int ret = 0; while (len_excl_bad < length) { size_t block_len, block_off; loff_t block_start; if (offset >= mtd->size) return -1; block_start = offset & ~(loff_t)(mtd->erasesize - 1); block_off = offset & (mtd->erasesize - 1); block_len = mtd->erasesize - block_off; if (!nand_block_isbad(mtd, block_start)) len_excl_bad += block_len; else ret = 1; offset += block_len; *used += block_len; } if (len_excl_bad > length) *used -= (len_excl_bad - length); return ret; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function does not setup any error status, that must be done before this function gets called. */
static void ibmvfc_scsi_eh_done(struct ibmvfc_event *evt)
/* This function does not setup any error status, that must be done before this function gets called. */ static void ibmvfc_scsi_eh_done(struct ibmvfc_event *evt)
{ struct scsi_cmnd *cmnd = evt->cmnd; if (cmnd) { scsi_dma_unmap(cmnd); cmnd->scsi_done(cmnd); } if (evt->eh_comp) complete(evt->eh_comp); ibmvfc_free_event(evt); }
robutest/uclinux
C++
GPL-2.0
60
/* See mss_uart.h for details of how to use this function. */
void MSS_UART_set_rx_timeout_handler(mss_uart_instance_t *this_uart, mss_uart_irq_handler_t handler)
/* See mss_uart.h for details of how to use this function. */ void MSS_UART_set_rx_timeout_handler(mss_uart_instance_t *this_uart, mss_uart_irq_handler_t handler)
{ ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)); ASSERT(handler != INVALID_IRQ_HANDLER); if(((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) && (handler != INVALID_IRQ_HANDLER)) { this_uart->rto_handler = handler; NVIC_ClearPendingIRQ( this_uart->irqn ); set_bit_reg8(&this_uart->hw_reg->IEM,ERTOI); NVIC_EnableIRQ(this_uart->irqn); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Attempt to get a coherent snapshot of stepper positions across axes NOTE: suspending */
static void sample_stepper_positions(int32_t *pos, const uint8_t cnt)
/* Attempt to get a coherent snapshot of stepper positions across axes NOTE: suspending */ static void sample_stepper_positions(int32_t *pos, const uint8_t cnt)
{ for (uint8_t i = 0; i != cnt; ++i) buf[i] = stepper.position((AxisEnum)i); bool unchanged = true; for (uint8_t i = 0; i != cnt; ++i) { if (pos[i] != buf[i]) { pos[i] = buf[i]; unchanged = false; } } if (unchanged) break; } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* It would be far better for everyone if the Guest had its own clock, but until then the Host gives us the time on every interrupt. */
static unsigned long lguest_get_wallclock(void)
/* It would be far better for everyone if the Guest had its own clock, but until then the Host gives us the time on every interrupt. */ static unsigned long lguest_get_wallclock(void)
{ return lguest_data.time.tv_sec; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Write a data to the slave, when the master have obtained control of the bus, and waiting for all bus transmiton complete.(Write Step2) This function is always used in thread mode. */
unsigned long xI2CMasterWriteS2(unsigned long ulBase, unsigned char ucData, xtBoolean bEndTransmition)
/* Write a data to the slave, when the master have obtained control of the bus, and waiting for all bus transmiton complete.(Write Step2) This function is always used in thread mode. */ unsigned long xI2CMasterWriteS2(unsigned long ulBase, unsigned char ucData, xtBoolean bEndTransmition)
{ unsigned long ulStatus; xASSERT((ulBase == I2C0_BASE)); xI2CMasterWriteRequestS2(ulBase, ucData, xfalse); while (!(xHWREG(ulBase + I2C_O_CON) & I2C_CON_SI)); ulStatus = xHWREG(ulBase + I2C_O_STATUS) & I2C_STATUS_M; if(!(ulStatus == I2C_I2STAT_M_TX_DAT_ACK)) { ulStatus = xI2CMasterError(ulBase); I2CStopSend(ulBase); return ulStatus; } if(bEndTransmition) { I2CStopSend(ulBase); } return xI2C_MASTER_ERR_NONE; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function checks the 8-bit BCD value specified by Value. If valid, the function converts it to an 8-bit value and returns it. Otherwise, return 0xff. */
UINT8 CheckAndConvertBcd8ToDecimal8(IN UINT8 Value)
/* This function checks the 8-bit BCD value specified by Value. If valid, the function converts it to an 8-bit value and returns it. Otherwise, return 0xff. */ UINT8 CheckAndConvertBcd8ToDecimal8(IN UINT8 Value)
{ if ((Value < 0xa0) && ((Value & 0xf) < 0xa)) { return BcdToDecimal8 (Value); } return 0xff; }
tianocore/edk2
C++
Other
4,240
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). */
UINT16 EFIAPI PciCf8AndThenOr16(IN UINTN Address, IN UINT16 AndData, IN UINT16 OrData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). */ UINT16 EFIAPI PciCf8AndThenOr16(IN UINTN Address, IN UINT16 AndData, IN UINT16 OrData)
{ BOOLEAN InterruptState; UINT32 AddressPort; UINT16 Result; ASSERT_INVALID_PCI_ADDRESS (Address, 1); InterruptState = SaveAndDisableInterrupts (); AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); Result = IoAndThenOr16 ( PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 2), AndData, OrData ); IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); SetInterruptState (InterruptState); return Result; }
tianocore/edk2
C++
Other
4,240
/* Queues a PDU to send to the MAC layer. */
static void llc_station_send_pdu(struct sk_buff *skb)
/* Queues a PDU to send to the MAC layer. */ static void llc_station_send_pdu(struct sk_buff *skb)
{ skb_queue_tail(&llc_main_station.mac_pdu_q, skb); while ((skb = skb_dequeue(&llc_main_station.mac_pdu_q)) != NULL) if (dev_queue_xmit(skb)) break; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* DMA Stream Disable Interrupt on Transfer Half Complete. */
void dma_disable_half_transfer_interrupt(uint32_t dma, uint8_t stream)
/* DMA Stream Disable Interrupt on Transfer Half Complete. */ void dma_disable_half_transfer_interrupt(uint32_t dma, uint8_t stream)
{ DMA_SCR(dma, stream) &= ~DMA_SxCR_HTIE; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Stores data in the non-volatile memory of the Hibernation module. */
void HibernateDataSet(unsigned long *pulData, unsigned long ulCount)
/* Stores data in the non-volatile memory of the Hibernation module. */ void HibernateDataSet(unsigned long *pulData, unsigned long ulCount)
{ unsigned int uIdx; ASSERT(ulCount <= 64); ASSERT(pulData != 0); for(uIdx = 0; uIdx < ulCount; uIdx++) { HWREG(HIB_DATA + (uIdx * 4)) = pulData[uIdx]; if(CLASS_IS_FURY) { SysCtlDelay(g_ulWriteDelay); } else { HibernateWriteComplete(); } } }
watterott/WebRadio
C++
null
71
/* qla4xxx_wait_for_hba_online - waits for HBA to come online @ha: Pointer to host adapter structure */
static int qla4xxx_wait_for_hba_online(struct scsi_qla_host *ha)
/* qla4xxx_wait_for_hba_online - waits for HBA to come online @ha: Pointer to host adapter structure */ static int qla4xxx_wait_for_hba_online(struct scsi_qla_host *ha)
{ unsigned long wait_online; wait_online = jiffies + (30 * HZ); while (time_before(jiffies, wait_online)) { if (adapter_up(ha)) return QLA_SUCCESS; else if (ha->retry_reset_ha_cnt == 0) return QLA_ERROR; msleep(2000); } return QLA_ERROR; }
robutest/uclinux
C++
GPL-2.0
60
/* This function will not return until the protection has been saved. */
long FlashUserSave(void)
/* This function will not return until the protection has been saved. */ long FlashUserSave(void)
{ if(CLASS_IS_SANDSTORM) { return(-1); } HWREG(FLASH_FMA) = 0x80000000; HWREG(FLASH_FMC) = FLASH_FMC_WRKEY | FLASH_FMC_COMT; while(HWREG(FLASH_FMC) & FLASH_FMC_COMT) { } HWREG(FLASH_FMA) = 0x80000001; HWREG(FLASH_FMC) = FLASH_FMC_WRKEY | FLASH_FMC_COMT; while(HWREG(FLASH_FMC) & FLASH_FMC_COMT) { } return(0); }
watterott/WebRadio
C++
null
71
/* Factorization helper for the command state machine: Submit a CSW read. */
static int __ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
/* Factorization helper for the command state machine: Submit a CSW read. */ static int __ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
{ int rc; UB_INIT_COMPLETION(sc->work_done); sc->last_pipe = sc->recv_bulk_pipe; usb_fill_bulk_urb(&sc->work_urb, sc->dev, sc->recv_bulk_pipe, &sc->work_bcs, US_BULK_CS_WRAP_LEN, ub_urb_complete, sc); if ((rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC)) != 0) { ub_complete(&sc->work_done); ub_state_done(sc, cmd, rc); return -1; } if (cmd->timeo) sc->work_timer.expires = jiffies + cmd->timeo; else sc->work_timer.expires = jiffies + UB_STAT_TIMEOUT; add_timer(&sc->work_timer); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is used to set IP divider number from the corresponding clock source. The divider number is chosen with one of the following values: divider 1-16 for peripheral */
void SysCtlIPClockDividerSet(unsigned long ulConfig)
/* This function is used to set IP divider number from the corresponding clock source. The divider number is chosen with one of the following values: divider 1-16 for peripheral */ void SysCtlIPClockDividerSet(unsigned long ulConfig)
{ xASSERT((ulConfig & 0xFF)<=256); xHWREG(g_pulCLKDivRegs[SYSCTL_PERIPH_INDEX_CLK(ulConfig)]) &= ~(((ulConfig) >> 8) << (ulConfig >> 16)); xHWREG(g_pulCLKDivRegs[SYSCTL_PERIPH_INDEX_CLK(ulConfig)]) |= (((ulConfig & 0xff) - 1) << (ulConfig >> 16)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104