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
|
---|---|---|---|---|---|---|---|
/* Remove name cache entry from its caches and free it. */ | static void pohmelfs_name_free(struct pohmelfs_inode *parent, struct pohmelfs_name *node) | /* Remove name cache entry from its caches and free it. */
static void pohmelfs_name_free(struct pohmelfs_inode *parent, struct pohmelfs_name *node) | {
__pohmelfs_name_del(parent, node);
list_del(&node->sync_create_entry);
kfree(node);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks whether the specified XFMC flag is set or not. */ | FlagStatus XFMC_GetFlag(XFMC_Bank23_Module *Bank, uint32_t XFMC_FLAG) | /* Checks whether the specified XFMC flag is set or not. */
FlagStatus XFMC_GetFlag(XFMC_Bank23_Module *Bank, uint32_t XFMC_FLAG) | {
FlagStatus bitstatus = RESET;
assert_param(IS_XFMC_NAND_BANK(Bank));
assert_param(IS_XFMC_NAND_FLAG(XFMC_FLAG));
if ((Bank->STSx & XFMC_FLAG) != (uint16_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function will config an desc in alternate setting object. */ | rt_err_t rt_usbd_altsetting_config_descriptor(ualtsetting_t setting, const void *desc, rt_off_t intf_pos) | /* This function will config an desc in alternate setting object. */
rt_err_t rt_usbd_altsetting_config_descriptor(ualtsetting_t setting, const void *desc, rt_off_t intf_pos) | {
RT_ASSERT(setting != RT_NULL);
RT_ASSERT(setting->desc !=RT_NULL);
rt_memcpy(setting->desc, desc, setting->desc_size);
setting->intf_desc = (uintf_desc_t)((char *)setting->desc + intf_pos);
return RT_EOK;
} | armink/FreeModbus_Slave-Master-RTT-STM32 | C++ | Other | 1,477 |
/* xs_tcp_print_stats - display TCP socket-specifc stats @xprt: rpc_xprt struct containing statistics @seq: output file */ | static void xs_tcp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq) | /* xs_tcp_print_stats - display TCP socket-specifc stats @xprt: rpc_xprt struct containing statistics @seq: output file */
static void xs_tcp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq) | {
struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
long idle_time = 0;
if (xprt_connected(xprt))
idle_time = (long)(jiffies - xprt->last_used) / HZ;
seq_printf(seq, "\txprt:\ttcp %u %lu %lu %lu %ld %lu %lu %lu %Lu %Lu\n",
transport->srcport,
xprt->stat.bind_count,
xprt->stat.connect_count,
xprt->stat.connect_time,
idle_time,
xprt->stat.sends,
xprt->stat.recvs,
xprt->stat.bad_xids,
xprt->stat.req_u,
xprt->stat.bklog_u);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* param src USB HS PHY PLL clock source. param freq The frequency specified by src. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */ | bool CLOCK_EnableUsbhs0PhyPllClock(clock_usb_phy_src_t src, uint32_t freq) | /* param src USB HS PHY PLL clock source. param freq The frequency specified by src. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */
bool CLOCK_EnableUsbhs0PhyPllClock(clock_usb_phy_src_t src, uint32_t freq) | {
static const clock_usb_pll_config_t g_ccmConfigUsbPll = {.loopDivider = 0U};
if ((CCM_ANALOG->PLL_USB1 & CCM_ANALOG_PLL_USB1_ENABLE_MASK) != 0U)
{
CCM_ANALOG->PLL_USB1 |= CCM_ANALOG_PLL_USB1_EN_USB_CLKS_MASK;
}
else
{
CLOCK_InitUsb1Pll(&g_ccmConfigUsbPll);
}
USBPHY1->CTRL &= ~USBPHY_CTRL_SFTRST_MASK;
USBPHY1->CTRL &= ~USBPHY_CTRL_CLKGATE_MASK;
USBPHY1->PWD = 0;
USBPHY1->CTRL |= USBPHY_CTRL_ENAUTOCLR_PHY_PWD_MASK | USBPHY_CTRL_ENAUTOCLR_CLKGATE_MASK |
USBPHY_CTRL_ENUTMILEVEL2_MASK | USBPHY_CTRL_ENUTMILEVEL3_MASK;
return true;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* If we don't find it, attempt to add an entry for it, with the specified flags and description, and, if that succeeds, return 0, otherwise return -1 and set errbuf to an error message. */ | pcap_if_t* find_or_add_dev(pcap_if_list_t *devlistp, const char *name, bpf_u_int32 flags, get_if_flags_func get_flags_func, const char *description, char *errbuf) | /* If we don't find it, attempt to add an entry for it, with the specified flags and description, and, if that succeeds, return 0, otherwise return -1 and set errbuf to an error message. */
pcap_if_t* find_or_add_dev(pcap_if_list_t *devlistp, const char *name, bpf_u_int32 flags, get_if_flags_func get_flags_func, const char *description, char *errbuf) | {
pcap_if_t *curdev;
curdev = find_dev(devlistp, name);
if (curdev != NULL) {
return (curdev);
}
if ((*get_flags_func)(name, &flags, errbuf) == -1) {
return (NULL);
}
return (add_dev(devlistp, name, flags, description, errbuf));
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Hook return address of SMM Save State so that semaphore code can be executed immediately after AP exits SMM to indicate to the BSP that an AP has exited SMM after SMBASE relocation. */ | VOID SemaphoreHook(IN UINTN CpuIndex, IN volatile BOOLEAN *RebasedFlag) | /* Hook return address of SMM Save State so that semaphore code can be executed immediately after AP exits SMM to indicate to the BSP that an AP has exited SMM after SMBASE relocation. */
VOID SemaphoreHook(IN UINTN CpuIndex, IN volatile BOOLEAN *RebasedFlag) | {
SMRAM_SAVE_STATE_MAP *CpuState;
UINTN TempValue;
mRebasedFlag = RebasedFlag;
PatchInstructionX86 (
gPatchRebasedFlagAddr32,
(UINT32)(UINTN)mRebasedFlag,
4
);
CpuState = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET);
mSmmRelocationOriginalAddress = HookReturnFromSmm (
CpuIndex,
CpuState,
(UINT64)(UINTN)&SmmRelocationSemaphoreComplete32,
(UINT64)(UINTN)&SmmRelocationSemaphoreComplete
);
TempValue = (UINTN)&mSmmRelocationOriginalAddress;
PatchInstructionX86 (
gPatchSmmRelocationOriginalAddressPtr32,
(UINT32)TempValue,
4
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set the specified data holding register value for dual DAC channel. */ | void DAC_ConfigDualChannelData(DAC_ALIGN_T align, uint16_t data2, uint16_t data1) | /* Set the specified data holding register value for dual DAC channel. */
void DAC_ConfigDualChannelData(DAC_ALIGN_T align, uint16_t data2, uint16_t data1) | {
uint32_t data = 0, temp = 0;
if (align == DAC_ALIGN_8BIT_R)
{
data = ((uint32_t)data2 << 8) | data1;
}
else
{
data = ((uint32_t)data2 << 16) | data1;
}
temp = (uint32_t)DAC_BASE;
temp += 0x00000020 + align;
*(__IO uint32_t *)temp = data;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Module insertion : initialisation of the module. Register the card with cardmgr... */ | static int __init init_ipwireless(void) | /* Module insertion : initialisation of the module. Register the card with cardmgr... */
static int __init init_ipwireless(void) | {
int ret;
printk(KERN_INFO IPWIRELESS_PCCARD_NAME " "
IPWIRELESS_PCMCIA_VERSION " by " IPWIRELESS_PCMCIA_AUTHOR "\n");
ret = ipwireless_tty_init();
if (ret != 0)
return ret;
ret = pcmcia_register_driver(&me);
if (ret != 0)
ipwireless_tty_release();
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Note that even though the names are different for manual mode, the values are the same. For example */ | void FanIntEnable(unsigned long ulBase, unsigned long ulFlags) | /* Note that even though the names are different for manual mode, the values are the same. For example */
void FanIntEnable(unsigned long ulBase, unsigned long ulFlags) | {
ASSERT(ulBase == FAN0_BASE);
HWREG(ulBase + FAN_O_IM) |= ulFlags;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* IO TOV timer callback. Fail any pending IO requests. */ | static void bfa_itnim_iotov(void *itnim_arg) | /* IO TOV timer callback. Fail any pending IO requests. */
static void bfa_itnim_iotov(void *itnim_arg) | {
struct bfa_itnim_s *itnim = itnim_arg;
itnim->iotov_active = BFA_FALSE;
bfa_cb_itnim_tov_begin(itnim->ditn);
bfa_itnim_iotov_cleanup(itnim);
bfa_cb_itnim_tov(itnim->ditn);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The control element is supposed to have the private_value field set up via HDA_COMPOSE_AMP_VAL*() or related macros. */ | int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | /* The control element is supposed to have the private_value field set up via HDA_COMPOSE_AMP_VAL*() or related macros. */
int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | {
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
hda_nid_t nid = get_amp_nid(kcontrol);
int chs = get_amp_channels(kcontrol);
int dir = get_amp_direction(kcontrol);
int idx = get_amp_index(kcontrol);
long *valp = ucontrol->value.integer.value;
if (chs & 1)
*valp++ = (snd_hda_codec_amp_read(codec, nid, 0, dir, idx) &
HDA_AMP_MUTE) ? 0 : 1;
if (chs & 2)
*valp = (snd_hda_codec_amp_read(codec, nid, 1, dir, idx) &
HDA_AMP_MUTE) ? 0 : 1;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check if a interrupt line is pending.
Checks if the requested interrupt vector is pending. */ | bool system_interrupt_is_pending(const enum system_interrupt_vector vector) | /* Check if a interrupt line is pending.
Checks if the requested interrupt vector is pending. */
bool system_interrupt_is_pending(const enum system_interrupt_vector vector) | {
bool result;
if (vector >= _SYSTEM_INTERRUPT_EXTERNAL_VECTOR_START) {
result = ((NVIC->ISPR[0] & (1 << vector)) != 0);
} else if (vector == SYSTEM_INTERRUPT_SYSTICK) {
result = ((SCB->ICSR & SCB_ICSR_PENDSTSET_Msk) != 0);
} else {
Assert(false);
result = false;
}
return result;
} | memfault/zero-to-main | C++ | null | 200 |
/* @discussion This function is to release all internal resource inside Elementary libary belonging to this object. Applicatoin need make sure the object is not being used by elmentary library any more when calling this function. If an EBO is being destroyed and it's attached to one EVO, it need to guarantee that EVO is not being used by elementary library too. */ | BOOL ElmDestroyObject(ElmHandle object) | /* @discussion This function is to release all internal resource inside Elementary libary belonging to this object. Applicatoin need make sure the object is not being used by elmentary library any more when calling this function. If an EBO is being destroyed and it's attached to one EVO, it need to guarantee that EVO is not being used by elementary library too. */
BOOL ElmDestroyObject(ElmHandle object) | {
int result = destroy_object(object);
return (result >= 0);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Switch master clock source selection to main clock. */ | uint32_t pmc_switch_mck_to_mainck(uint32_t ul_pres) | /* Switch master clock source selection to main clock. */
uint32_t pmc_switch_mck_to_mainck(uint32_t ul_pres) | {
uint32_t ul_timeout;
PMC->PMC_MCKR = (PMC->PMC_MCKR & (~PMC_MCKR_CSS_Msk)) |
PMC_MCKR_CSS_MAIN_CLK;
for (ul_timeout = PMC_TIMEOUT; !(PMC->PMC_SR & PMC_SR_MCKRDY);
--ul_timeout) {
if (ul_timeout == 0) {
return 1;
}
}
PMC->PMC_MCKR = (PMC->PMC_MCKR & (~PMC_MCKR_PRES_Msk)) | ul_pres;
for (ul_timeout = PMC_TIMEOUT; !(PMC->PMC_SR & PMC_SR_MCKRDY);
--ul_timeout) {
if (ul_timeout == 0) {
return 1;
}
}
return 0;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Look up qdisc by its parent in the provided cache */ | struct rtnl_qdisc* rtnl_qdisc_get_by_parent(struct nl_cache *cache, int ifindex, uint32_t parent) | /* Look up qdisc by its parent in the provided cache */
struct rtnl_qdisc* rtnl_qdisc_get_by_parent(struct nl_cache *cache, int ifindex, uint32_t parent) | {
struct rtnl_qdisc *q;
if (cache->c_ops != &rtnl_qdisc_ops)
return NULL;
nl_list_for_each_entry(q, &cache->c_items, ce_list) {
if (q->q_parent == parent && q->q_ifindex == ifindex) {
nl_object_get((struct nl_object *) q);
return q;
}
}
return NULL;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* read() .. non-blocking: ipppd calls it only after select() reports, that there is data */ | int isdn_ppp_read(int min, struct file *file, char __user *buf, int count) | /* read() .. non-blocking: ipppd calls it only after select() reports, that there is data */
int isdn_ppp_read(int min, struct file *file, char __user *buf, int count) | {
struct ippp_struct *is;
struct ippp_buf_queue *b;
u_long flags;
u_char *save_buf;
is = file->private_data;
if (!(is->state & IPPP_OPEN))
return 0;
if (!access_ok(VERIFY_WRITE, buf, count))
return -EFAULT;
spin_lock_irqsave(&is->buflock, flags);
b = is->first->next;
save_buf = b->buf;
if (!save_buf) {
spin_unlock_irqrestore(&is->buflock, flags);
return -EAGAIN;
}
if (b->len < count)
count = b->len;
b->buf = NULL;
is->first = b;
spin_unlock_irqrestore(&is->buflock, flags);
if (copy_to_user(buf, save_buf, count))
count = -EFAULT;
kfree(save_buf);
return count;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Function for selecting a timer resource. This function may be called directly, or through dtm_cmd() specifying DTM_PKT_VENDORSPECIFIC as payload, SELECT_TIMER as length, and the timer as freq. */ | bool dtm_set_timer(uint32_t new_timer) | /* Function for selecting a timer resource. This function may be called directly, or through dtm_cmd() specifying DTM_PKT_VENDORSPECIFIC as payload, SELECT_TIMER as length, and the timer as freq. */
bool dtm_set_timer(uint32_t new_timer) | {
if (m_state > STATE_IDLE)
{
return false;
}
if (new_timer == 0)
{
mp_timer = NRF_TIMER0;
m_timer_irq = TIMER0_IRQn;
}
else if (new_timer == 1)
{
mp_timer = NRF_TIMER1;
m_timer_irq = TIMER1_IRQn;
}
else if (new_timer == 2)
{
mp_timer = NRF_TIMER2;
m_timer_irq = TIMER2_IRQn;
}
else
{
return false;
}
return true;
} | labapart/polymcu | C++ | null | 201 |
/* This routine is registered to the PCI subsystem for error handling. It is called when kernel error recovery tells the lpfc driver that it is OK to resume normal PCI operation after PCI bus error recovery. When this routine is invoked, it dispatches the action to the proper SLI-3 or SLI-4 device io_resume routine, which will resume the device operation. */ | static void lpfc_io_resume(struct pci_dev *pdev) | /* This routine is registered to the PCI subsystem for error handling. It is called when kernel error recovery tells the lpfc driver that it is OK to resume normal PCI operation after PCI bus error recovery. When this routine is invoked, it dispatches the action to the proper SLI-3 or SLI-4 device io_resume routine, which will resume the device operation. */
static void lpfc_io_resume(struct pci_dev *pdev) | {
struct Scsi_Host *shost = pci_get_drvdata(pdev);
struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
switch (phba->pci_dev_grp) {
case LPFC_PCI_DEV_LP:
lpfc_io_resume_s3(pdev);
break;
case LPFC_PCI_DEV_OC:
lpfc_io_resume_s4(pdev);
break;
default:
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"1429 Invalid PCI device group: 0x%x\n",
phba->pci_dev_grp);
break;
}
return;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: the unsigned 32-bit integer from the attribute, or 0. */ | guint32 _g_file_attribute_value_get_uint32(const GFileAttributeValue *attr) | /* Returns: the unsigned 32-bit integer from the attribute, or 0. */
guint32 _g_file_attribute_value_get_uint32(const GFileAttributeValue *attr) | {
if (attr == NULL)
return 0;
g_return_val_if_fail (attr->type == G_FILE_ATTRIBUTE_TYPE_UINT32, 0);
return attr->u.uint32;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* NOTE: normally the GPIO has to be put into HiZ when de-activated to cause minmal side effect when scanning other columns, here it is configured to be input, and it should work on most platforms. */ | static void __activate_col(const struct matrix_keypad_platform_data *pdata, int col, bool on) | /* NOTE: normally the GPIO has to be put into HiZ when de-activated to cause minmal side effect when scanning other columns, here it is configured to be input, and it should work on most platforms. */
static void __activate_col(const struct matrix_keypad_platform_data *pdata, int col, bool on) | {
bool level_on = !pdata->active_low;
if (on) {
gpio_direction_output(pdata->col_gpios[col], level_on);
} else {
gpio_set_value_cansleep(pdata->col_gpios[col], !level_on);
gpio_direction_input(pdata->col_gpios[col]);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Time period register for step detection on delta time (r/w).. */ | int32_t lsm6dsl_pedo_steps_period_get(stmdev_ctx_t *ctx, uint8_t *buff) | /* Time period register for step detection on delta time (r/w).. */
int32_t lsm6dsl_pedo_steps_period_get(stmdev_ctx_t *ctx, uint8_t *buff) | {
int32_t ret;
ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_BANK_A);
if(ret == 0){
ret = lsm6dsl_read_reg(ctx, LSM6DSL_STEP_COUNT_DELTA, buff, 1);
if(ret == 0){
ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_USER_BANK);
}
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Configure dma_config_t structure using default parameter. User can invoked this function, before configure dma_config_t. */ | void ald_dma_config_struct(ald_dma_config_t *config) | /* Configure dma_config_t structure using default parameter. User can invoked this function, before configure dma_config_t. */
void ald_dma_config_struct(ald_dma_config_t *config) | {
config->size = 0;
config->src_data_width = ALD_DMA_DATA_SIZE_BYTE;
config->dst_data_width = ALD_DMA_DATA_SIZE_BYTE;
config->src_inc = ALD_DMA_DATA_INC_DISABLE;
config->dst_inc = ALD_DMA_DATA_INC_DISABLE;
config->R_power = ALD_DMA_R_POWER_1;
config->priority = ALD_DMA_LOW_PRIORITY;
config->mem_to_mem = DISABLE;
config->circle_mode = DISABLE;
config->msel = ALD_DMA_MSEL_NONE;
config->msigsel = ALD_DMA_MSIGSEL_NONE;
config->channel = ALD_DMA_CH_0;
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Gets the states of the RI, DCD, DSR and CTS modem status signals. */ | uint32_t UARTModemStatusGet(uint32_t ui32Base) | /* Gets the states of the RI, DCD, DSR and CTS modem status signals. */
uint32_t UARTModemStatusGet(uint32_t ui32Base) | {
ASSERT(ui32Base == UART1_BASE);
return(HWREG(ui32Base + UART_O_FR) & (UART_INPUT_RI | UART_INPUT_DCD |
UART_INPUT_CTS | UART_INPUT_DSR));
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Helper function to convert a UINT64 value in binary to a string. */ | VOID Uint64ToBinString(IN UINT64 Value, OUT CHAR8 *BinString) | /* Helper function to convert a UINT64 value in binary to a string. */
VOID Uint64ToBinString(IN UINT64 Value, OUT CHAR8 *BinString) | {
UINTN Index;
if (BinString == NULL) {
return;
}
for (Index = 64; Index > 0; --Index) {
BinString[Index - 1] = '0' + (Value & 1);
Value = RShiftU64 (Value, 1);
}
BinString[64] = '\0';
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables or disables the selected ADC software start conversion . */ | void ADC_SoftwareStartConvCmd(ADC_TypeDef *adc, FunctionalState state) | /* Enables or disables the selected ADC software start conversion . */
void ADC_SoftwareStartConvCmd(ADC_TypeDef *adc, FunctionalState state) | {
(state) ? (adc->ADCR |= ADC_CR_ADST) : (adc->ADCR &= ~ADC_CR_ADST);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enables or disables the specified SPI peripheral (in I2S mode). */ | void I2S_Enable(SPI_Module *SPIx, FunctionalState Cmd) | /* Enables or disables the specified SPI peripheral (in I2S mode). */
void I2S_Enable(SPI_Module *SPIx, FunctionalState Cmd) | {
assert_param(IS_SPI_PERIPH(SPIx));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
SPIx->I2SCFG |= I2SCFG_I2SEN_ENABLE;
}
else
{
SPIx->I2SCFG &= I2SCFG_I2SEN_DISABLE;
}
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* TIM OC MSP Initialization This function configures the hardware resources used in this example: */ | void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim) | /* TIM OC MSP Initialization This function configures the hardware resources used in this example: */
void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim) | {
GPIO_InitTypeDef GPIO_InitStruct;
__HAL_RCC_TIM3_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIO_InitStruct.Alternate = GPIO_AF2_TIM3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Pin = GPIO_PIN_4;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
GPIO_InitStruct.Alternate = GPIO_AF2_TIM3;
GPIO_InitStruct.Pin = GPIO_PIN_5;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Starts the TIMER PWM signal generation on the complementary output. in DMA mode. */ | void ald_timer_pwmn_stop_by_dma(ald_timer_handle_t *hperh, ald_timer_channel_t ch) | /* Starts the TIMER PWM signal generation on the complementary output. in DMA mode. */
void ald_timer_pwmn_stop_by_dma(ald_timer_handle_t *hperh, ald_timer_channel_t ch) | {
ald_timer_ocn_stop_by_dma(hperh, ch);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Read or write specified flag of a UFS device. */ | EFI_STATUS UfsRwFlags(IN UFS_PASS_THRU_PRIVATE_DATA *Private, IN BOOLEAN Read, IN UINT8 FlagId, IN OUT UINT8 *Value) | /* Read or write specified flag of a UFS device. */
EFI_STATUS UfsRwFlags(IN UFS_PASS_THRU_PRIVATE_DATA *Private, IN BOOLEAN Read, IN UINT8 FlagId, IN OUT UINT8 *Value) | {
UFS_DEVICE_MANAGEMENT_REQUEST_PACKET Packet;
if (Value == NULL) {
return EFI_INVALID_PARAMETER;
}
ZeroMem (&Packet, sizeof (UFS_DEVICE_MANAGEMENT_REQUEST_PACKET));
if (Read) {
ASSERT (Value != NULL);
Packet.DataDirection = UfsDataIn;
Packet.Opcode = UtpQueryFuncOpcodeRdFlag;
} else {
Packet.DataDirection = UfsDataOut;
if (*Value == 1) {
Packet.Opcode = UtpQueryFuncOpcodeSetFlag;
} else if (*Value == 0) {
Packet.Opcode = UtpQueryFuncOpcodeClrFlag;
} else {
return EFI_INVALID_PARAMETER;
}
}
Packet.DataBuffer = Value;
Packet.DescId = FlagId;
Packet.Index = 0;
Packet.Selector = 0;
Packet.Timeout = UFS_TIMEOUT;
return UfsSendDmRequest (Private, &Packet);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* External Trigger Enable and Polarity Selection for regular channels. */ | void ADC_ExternalTriggerConfig(ADC_TypeDef *ADCx, uint16_t ADC_ExternalTrigConvEvent, uint16_t ADC_ExternalTrigEventEdge) | /* External Trigger Enable and Polarity Selection for regular channels. */
void ADC_ExternalTriggerConfig(ADC_TypeDef *ADCx, uint16_t ADC_ExternalTrigConvEvent, uint16_t ADC_ExternalTrigEventEdge) | {
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_ADC_EXT_TRIG(ADC_ExternalTrigConvEvent));
assert_param(IS_EXTERNALTRIG_EDGE(ADC_ExternalTrigEventEdge));
ADCx->CFGR &= ~(ADC_CFGR_EXTEN | ADC_CFGR_EXTSEL);
ADCx->CFGR |= (uint32_t)(ADC_ExternalTrigEventEdge | ADC_ExternalTrigConvEvent);
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* MSS_GPIO_config See "mss_gpio.h" for details of how to use this function. */ | void MSS_GPIO_config(mss_gpio_id_t port_id, uint32_t config) | /* MSS_GPIO_config See "mss_gpio.h" for details of how to use this function. */
void MSS_GPIO_config(mss_gpio_id_t port_id, uint32_t config) | {
uint32_t gpio_idx = (uint32_t)port_id;
ASSERT( gpio_idx < NB_OF_GPIO );
if ( gpio_idx < NB_OF_GPIO )
{
*(g_config_reg_lut[gpio_idx]) = config;
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* This API used to get the x and y repetition in the register 0x51 bit 0 to 7. */ | BMM050_RETURN_FUNCTION_TYPE bmm050_get_rep_XY(u8 *v_rep_xy_u8) | /* This API used to get the x and y repetition in the register 0x51 bit 0 to 7. */
BMM050_RETURN_FUNCTION_TYPE bmm050_get_rep_XY(u8 *v_rep_xy_u8) | {
BMM050_RETURN_FUNCTION_TYPE com_rslt = ERROR;
u8 v_data_u8 = BMM050_INIT_VALUE;
if (p_bmm050 == BMM050_NULL)
{
return E_BMM050_NULL_PTR;
}
else
{
com_rslt = p_bmm050->BMM050_BUS_READ_FUNC(
p_bmm050->dev_addr,
BMM050_REP_XY,
&v_data_u8, BMM050_GEN_READ_WRITE_DATA_LENGTH);
*v_rep_xy_u8 = v_data_u8;
}
return com_rslt;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* configure the PREDV0 division factor and clock source */ | void rcu_predv0_config(uint32_t predv0_source, uint32_t predv0_div) | /* configure the PREDV0 division factor and clock source */
void rcu_predv0_config(uint32_t predv0_source, uint32_t predv0_div) | {
uint32_t reg = 0U;
reg = RCU_CFG1;
reg &= ~(RCU_CFG1_PREDV0SEL | RCU_CFG1_PREDV0);
reg |= (predv0_source | predv0_div);
RCU_CFG1 = reg;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Output: void, but we will add to proto tree if !NULL. */ | static void dissect_lsp_partition_dis_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int id_length, int length) | /* Output: void, but we will add to proto tree if !NULL. */
static void dissect_lsp_partition_dis_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int id_length, int length) | {
if ( length < id_length ) {
proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_packet, tvb, offset, -1,
"short lsp partition DIS(%d vs %d)", length, id_length );
return;
}
proto_tree_add_item( tree, hf_isis_lsp_partition_designated_l2_is, tvb, offset, id_length, ENC_NA);
length -= id_length;
offset += id_length;
if ( length > 0 ) {
proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_long_packet, tvb, offset, -1,
"Long lsp partition DIS, %d left over", length );
return;
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Set the file creation context in a set of credentials to the same as the objective context of the specified inode */ | static int smack_kernel_create_files_as(struct cred *new, struct inode *inode) | /* Set the file creation context in a set of credentials to the same as the objective context of the specified inode */
static int smack_kernel_create_files_as(struct cred *new, struct inode *inode) | {
struct inode_smack *isp = inode->i_security;
new->security = isp->smk_inode;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* disable the DMA1 channel 5 Full_Data transfer mode */ | void dma_1_channel_5_fulldata_transfer_disable(void) | /* disable the DMA1 channel 5 Full_Data transfer mode */
void dma_1_channel_5_fulldata_transfer_disable(void) | {
DMA_ACFG &= ~DMA_ACFG_FD_CH5EN;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Iterate to next block in device-path, terminating (returning NULL) at /End* node. */ | struct efi_device_path* efi_dp_next(const struct efi_device_path *dp) | /* Iterate to next block in device-path, terminating (returning NULL) at /End* node. */
struct efi_device_path* efi_dp_next(const struct efi_device_path *dp) | {
if (dp == NULL)
return NULL;
if (dp->type == DEVICE_PATH_TYPE_END)
return NULL;
dp = ((void *)dp) + dp->length;
if (dp->type == DEVICE_PATH_TYPE_END)
return NULL;
return (struct efi_device_path *)dp;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Requests ownership of an outbound mailbox resource and binds a callback function to the resource. Returns 0 on success. */ | int rio_request_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries, void(*moutb)(struct rio_mport *mport, void *dev_id, int mbox, int slot)) | /* Requests ownership of an outbound mailbox resource and binds a callback function to the resource. Returns 0 on success. */
int rio_request_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries, void(*moutb)(struct rio_mport *mport, void *dev_id, int mbox, int slot)) | {
int rc = 0;
struct resource *res = kmalloc(sizeof(struct resource), GFP_KERNEL);
if (res) {
rio_init_mbox_res(res, mbox, mbox);
if ((rc =
request_resource(&mport->riores[RIO_OUTB_MBOX_RESOURCE],
res)) < 0) {
kfree(res);
goto out;
}
mport->outb_msg[mbox].res = res;
mport->outb_msg[mbox].mcback = moutb;
rc = rio_open_outb_mbox(mport, dev_id, mbox, entries);
} else
rc = -ENOMEM;
out:
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* empty string disables _OSI string starting with '!' disables that string otherwise string is added to list, augmenting built-in strings */ | int __init acpi_osi_setup(char *str) | /* empty string disables _OSI string starting with '!' disables that string otherwise string is added to list, augmenting built-in strings */
int __init acpi_osi_setup(char *str) | {
if (str == NULL || *str == '\0') {
printk(KERN_INFO PREFIX "_OSI method disabled\n");
acpi_gbl_create_osi_method = FALSE;
} else if (!strcmp("!Linux", str)) {
acpi_cmdline_osi_linux(0);
} else if (*str == '!') {
if (acpi_osi_invalidate(++str) == AE_OK)
printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str);
} else if (!strcmp("Linux", str)) {
acpi_cmdline_osi_linux(1);
} else if (*osi_additional_string == '\0') {
strncpy(osi_additional_string, str, OSI_STRING_LENGTH_MAX);
printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str);
}
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Verify 3-bytes hamming codes for a data block whose size is multiple of 256 bytes. Each 256-bytes block is verified with its own code. */ | uint32_t hamming_verify_256x(uint8_t *puc_data, uint32_t dw_size, const uint8_t *puc_code) | /* Verify 3-bytes hamming codes for a data block whose size is multiple of 256 bytes. Each 256-bytes block is verified with its own code. */
uint32_t hamming_verify_256x(uint8_t *puc_data, uint32_t dw_size, const uint8_t *puc_code) | {
uint32_t error;
uint32_t result = 0;
while (dw_size > 0) {
error = verify256(puc_data, puc_code);
if (error == HAMMING_ERROR_SINGLE_BIT) {
result = HAMMING_ERROR_SINGLE_BIT;
} else {
if (error) {
return error;
}
}
puc_data += 256;
puc_code += 3;
dw_size -= 256;
}
return result;
} | memfault/zero-to-main | C++ | null | 200 |
/* The constructor function caches the pointer of EMU Thunk protocol. */ | EFI_STATUS EFIAPI DxeEmuLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* The constructor function caches the pointer of EMU Thunk protocol. */
EFI_STATUS EFIAPI DxeEmuLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_HOB_GUID_TYPE *GuidHob;
GuidHob = GetFirstGuidHob (&gEmuThunkProtocolGuid);
ASSERT (GuidHob != NULL);
gEmuThunk = (EMU_THUNK_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob)));
ASSERT (gEmuThunk != NULL);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If the vma has a linear pfn mapping for the entire range, we get the prot from pte and reserve the entire vma range with single reserve_pfn_range call. */ | int track_pfn_vma_copy(struct vm_area_struct *vma) | /* If the vma has a linear pfn mapping for the entire range, we get the prot from pte and reserve the entire vma range with single reserve_pfn_range call. */
int track_pfn_vma_copy(struct vm_area_struct *vma) | {
resource_size_t paddr;
unsigned long prot;
unsigned long vma_size = vma->vm_end - vma->vm_start;
pgprot_t pgprot;
if (is_linear_pfn_mapping(vma)) {
if (follow_phys(vma, vma->vm_start, 0, &prot, &paddr)) {
WARN_ON_ONCE(1);
return -EINVAL;
}
pgprot = __pgprot(prot);
return reserve_pfn_range(paddr, vma_size, &pgprot, 1);
}
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Remove IrLAP and all allocated memory. Stop any pending timers. */ | static void __irlap_close(struct irlap_cb *self) | /* Remove IrLAP and all allocated memory. Stop any pending timers. */
static void __irlap_close(struct irlap_cb *self) | {
IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
del_timer(&self->slot_timer);
del_timer(&self->query_timer);
del_timer(&self->discovery_timer);
del_timer(&self->final_timer);
del_timer(&self->poll_timer);
del_timer(&self->wd_timer);
del_timer(&self->backoff_timer);
del_timer(&self->media_busy_timer);
irlap_flush_all_queues(self);
self->magic = 0;
kfree(self);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This is a convenience function that may save client code calls to */ | RETURN_STATUS EFIAPI PciCapListFindCapVersion(IN PCI_CAP_LIST *CapList, IN PCI_CAP_DOMAIN Domain, IN UINT16 CapId, IN UINT8 MinVersion, OUT PCI_CAP **Cap OPTIONAL) | /* This is a convenience function that may save client code calls to */
RETURN_STATUS EFIAPI PciCapListFindCapVersion(IN PCI_CAP_LIST *CapList, IN PCI_CAP_DOMAIN Domain, IN UINT16 CapId, IN UINT8 MinVersion, OUT PCI_CAP **Cap OPTIONAL) | {
PCI_CAP_KEY Key;
ORDERED_COLLECTION_ENTRY *PciCapEntry;
Key.Domain = Domain;
Key.CapId = CapId;
Key.Instance = 0;
for (PciCapEntry = OrderedCollectionFind (CapList->Capabilities, &Key);
PciCapEntry != NULL;
PciCapEntry = OrderedCollectionNext (PciCapEntry))
{
PCI_CAP *PciCap;
PciCap = OrderedCollectionUserStruct (PciCapEntry);
if ((PciCap->Key.Domain != Domain) || (PciCap->Key.CapId != CapId)) {
break;
}
if (PciCap->Version >= MinVersion) {
if (Cap != NULL) {
*Cap = PciCap;
}
return RETURN_SUCCESS;
}
}
return RETURN_NOT_FOUND;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Checks whether the specified DMAy Channelx interrupt has occurred or not. */ | ITStatus DMA_GetITStatus(uint32_t DMA_IT) | /* Checks whether the specified DMAy Channelx interrupt has occurred or not. */
ITStatus DMA_GetITStatus(uint32_t DMA_IT) | {
ITStatus bitstatus = RESET;
assert_param(IS_DMA_GET_IT(DMA_IT));
if ((DMA1->ISR & DMA_IT) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Return a pointer to the first item in the AIL. If the AIL is empty, then return NULL. */ | STATIC xfs_log_item_t * xfs_ail_min(struct xfs_ail *) | /* Return a pointer to the first item in the AIL. If the AIL is empty, then return NULL. */
STATIC xfs_log_item_t * xfs_ail_min(struct xfs_ail *) | {
if (list_empty(&ailp->xa_ail))
return NULL;
return list_first_entry(&ailp->xa_ail, xfs_log_item_t, li_ail);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function raises the system's current task priority level to the task priority level of the mutual exclusion lock. Then, it places the lock in the acquired state. If Lock is NULL, then ASSERT(). If Lock is not initialized, then ASSERT(). If Lock is already in the acquired state, then ASSERT(). */ | VOID EFIAPI EfiAcquireLock(IN EFI_LOCK *Lock) | /* This function raises the system's current task priority level to the task priority level of the mutual exclusion lock. Then, it places the lock in the acquired state. If Lock is NULL, then ASSERT(). If Lock is not initialized, then ASSERT(). If Lock is already in the acquired state, then ASSERT(). */
VOID EFIAPI EfiAcquireLock(IN EFI_LOCK *Lock) | {
ASSERT (Lock != NULL);
ASSERT (Lock->Lock == EfiLockReleased);
Lock->OwnerTpl = gBS->RaiseTPL (Lock->Tpl);
Lock->Lock = EfiLockAcquired;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Feed WDT. This function is used to Feed WDT Module in case of WDT time-out. */ | void WDTFeed(void) | /* Feed WDT. This function is used to Feed WDT Module in case of WDT time-out. */
void WDTFeed(void) | {
xHWREG(WDT_BASE + WDT_FEED) = (unsigned long) 0xAA;
xHWREG(WDT_BASE + WDT_FEED) = (unsigned long) 0x55;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* For licensing information, see the file 'LICENCE' in this directory. */ | static int jffs2_trusted_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size, int type) | /* For licensing information, see the file 'LICENCE' in this directory. */
static int jffs2_trusted_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size, int type) | {
if (!strcmp(name, ""))
return -EINVAL;
return do_jffs2_getxattr(dentry->d_inode, JFFS2_XPREFIX_TRUSTED,
name, buffer, size);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Starts the PWM output, and stops after the specified number of pulses. */ | void pwmStartFixed(uint32_t pulses) | /* Starts the PWM output, and stops after the specified number of pulses. */
void pwmStartFixed(uint32_t pulses) | {
pwmMaxPulses = pulses;
TMR_TMR16B1MCR |= (TMR_TMR16B1MCR_MR3_INT_ENABLED);
TMR_TMR16B1TCR = TMR_TMR16B1TCR_COUNTERENABLE_ENABLED;
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* The return value is the disposition of the chunk. */ | sctp_disposition_t sctp_sf_not_impl(const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) | /* The return value is the disposition of the chunk. */
sctp_disposition_t sctp_sf_not_impl(const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) | {
return SCTP_DISPOSITION_NOT_IMPL;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Wait for User push-button press to start transfer. */ | void WaitForUserButtonPress(void) | /* Wait for User push-button press to start transfer. */
void WaitForUserButtonPress(void) | {
while (ubButtonPress == 0)
{
LL_GPIO_TogglePin(LED2_GPIO_PORT, LED2_PIN);
LL_mDelay(LED_BLINK_FAST);
}
LED_Off();
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Return the (rotated) index for floating point register REGNUM (REGNUM must be in the range from 32-127, result is in the range from 0-95. */ | static unsigned long fph_index(struct pt_regs *regs, long regnum) | /* Return the (rotated) index for floating point register REGNUM (REGNUM must be in the range from 32-127, result is in the range from 0-95. */
static unsigned long fph_index(struct pt_regs *regs, long regnum) | {
unsigned long rrb_fr = (regs->cr_ifs >> 25) & 0x7f;
return rotate_reg(96, rrb_fr, (regnum - IA64_FIRST_ROTATING_FR));
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Return the number of entries in the gRegisters */ | UINTN MaxRegisterCount(VOID) | /* Return the number of entries in the gRegisters */
UINTN MaxRegisterCount(VOID) | {
return sizeof (gRegisterOffsets) / sizeof (UINTN);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If found the device path is not a valid device path, remove the variable. */ | VOID BdsFormalizeConsoleVariable(IN CHAR16 *VariableName) | /* If found the device path is not a valid device path, remove the variable. */
VOID BdsFormalizeConsoleVariable(IN CHAR16 *VariableName) | {
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
UINTN VariableSize;
EFI_STATUS Status;
GetEfiGlobalVariable2 (VariableName, (VOID **)&DevicePath, &VariableSize);
if ((DevicePath != NULL) && !IsDevicePathValid (DevicePath, VariableSize)) {
Status = gRT->SetVariable (
VariableName,
&gEfiGlobalVariableGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
0,
NULL
);
ASSERT_EFI_ERROR (Status);
}
if (DevicePath != NULL) {
FreePool (DevicePath);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Map the hardware event indicated by the processor IRQ to a virtual IRQ. */ | int systemasic_irq_demux(int irq) | /* Map the hardware event indicated by the processor IRQ to a virtual IRQ. */
int systemasic_irq_demux(int irq) | {
__u32 emr, esr, status, level;
__u32 j, bit;
switch (irq) {
case 13:
level = 0;
break;
case 11:
level = 1;
break;
case 9:
level = 2;
break;
default:
return irq;
}
emr = EMR_BASE + (level << 4) + (level << 2);
esr = ESR_BASE + (level << 2);
status = inl(esr);
status &= inl(emr);
for (bit = 1, j = 0; j < 32; bit <<= 1, j++) {
if (status & bit) {
irq = HW_EVENT_IRQ_BASE + j + (level << 5);
return irq;
}
}
return irq;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This code finds variable in storage blocks of volatile and non-volatile storage areas. If VariableName is an empty string, then we just return the first qualified variable without comparing VariableName and VendorGuid. */ | EFI_STATUS AuthServiceInternalFindVariable(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT VOID **Data, OUT UINTN *DataSize) | /* This code finds variable in storage blocks of volatile and non-volatile storage areas. If VariableName is an empty string, then we just return the first qualified variable without comparing VariableName and VendorGuid. */
EFI_STATUS AuthServiceInternalFindVariable(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT VOID **Data, OUT UINTN *DataSize) | {
EFI_STATUS Status;
AUTH_VARIABLE_INFO AuthVariableInfo;
ZeroMem (&AuthVariableInfo, sizeof (AuthVariableInfo));
Status = mAuthVarLibContextIn->FindVariable (
VariableName,
VendorGuid,
&AuthVariableInfo
);
*Data = AuthVariableInfo.Data;
*DataSize = AuthVariableInfo.DataSize;
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Local function to send a command to the USB protocol engine and read data */ | static U8 USBHwCmdRead(U8 bCmd) | /* Local function to send a command to the USB protocol engine and read data */
static U8 USBHwCmdRead(U8 bCmd) | {
USBHwCmd(bCmd);
LPC_USB->USBCmdCode = 0x00000200 | (bCmd << 16);
Wait4DevInt(CDFULL);
return LPC_USB->USBCmdData;
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* This request sets up the specified Ethernet power management pattern filter as described in the data structure. */ | EFI_STATUS EFIAPI SetUsbEthPowerFilter(IN EDKII_USB_ETHERNET_PROTOCOL *This, IN UINT16 Value, IN UINT16 Length, IN VOID *PatternFilter) | /* This request sets up the specified Ethernet power management pattern filter as described in the data structure. */
EFI_STATUS EFIAPI SetUsbEthPowerFilter(IN EDKII_USB_ETHERNET_PROTOCOL *This, IN UINT16 Value, IN UINT16 Length, IN VOID *PatternFilter) | {
EFI_USB_DEVICE_REQUEST Request;
UINT32 TransStatus;
USB_ETHERNET_DRIVER *UsbEthDriver;
UsbEthDriver = USB_ETHERNET_DEV_FROM_THIS (This);
Request.RequestType = USB_ETHERNET_SET_REQ_TYPE;
Request.Request = SET_ETH_POWER_MANAGEMENT_PATTERN_FILTER_REQ;
Request.Value = Value;
Request.Index = UsbEthDriver->NumOfInterface;
Request.Length = Length;
return UsbEthDriver->UsbIo->UsbControlTransfer (
UsbEthDriver->UsbIo,
&Request,
EfiUsbDataOut,
USB_ETHERNET_TRANSFER_TIMEOUT,
PatternFilter,
Length,
&TransStatus
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If provided device exists it's partitions are deleted, device is removed from device list and device memory is freed. */ | static int device_del(struct mtd_device *dev) | /* If provided device exists it's partitions are deleted, device is removed from device list and device memory is freed. */
static int device_del(struct mtd_device *dev) | {
part_delall(&dev->parts);
list_del(&dev->link);
free(dev);
if (dev == current_mtd_dev) {
if (list_empty(&devices)) {
current_mtd_dev = NULL;
} else {
current_mtd_dev = list_entry(devices.next, struct mtd_device, link);
current_mtd_partnum = 0;
}
current_save();
return 0;
}
index_partitions();
return 0;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Parse the pin default config value and returns the string of the jack type, i.e. the purpose of the jack, such as Line-Out or CD. */ | const char* snd_hda_get_jack_type(u32 cfg) | /* Parse the pin default config value and returns the string of the jack type, i.e. the purpose of the jack, such as Line-Out or CD. */
const char* snd_hda_get_jack_type(u32 cfg) | {
static char *jack_types[16] = {
"Line Out", "Speaker", "HP Out", "CD",
"SPDIF Out", "Digital Out", "Modem Line", "Modem Hand",
"Line In", "Aux", "Mic", "Telephony",
"SPDIF In", "Digitial In", "Reserved", "Other"
};
return jack_types[(cfg & AC_DEFCFG_DEVICE)
>> AC_DEFCFG_DEVICE_SHIFT];
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: TRUE if the attributes were copied successfully, FALSE otherwise. */ | gboolean g_file_copy_attributes(GFile *source, GFile *destination, GFileCopyFlags flags, GCancellable *cancellable, GError **error) | /* Returns: TRUE if the attributes were copied successfully, FALSE otherwise. */
gboolean g_file_copy_attributes(GFile *source, GFile *destination, GFileCopyFlags flags, GCancellable *cancellable, GError **error) | {
char *attrs_to_read;
gboolean res;
GFileInfo *info;
gboolean source_nofollow_symlinks;
if (!build_attribute_list_for_copy (destination, flags, &attrs_to_read,
cancellable, error))
return FALSE;
source_nofollow_symlinks = flags & G_FILE_COPY_NOFOLLOW_SYMLINKS;
info = g_file_query_info (source, attrs_to_read,
source_nofollow_symlinks ? G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS:0,
cancellable,
NULL);
g_free (attrs_to_read);
res = TRUE;
if (info)
{
res = g_file_set_attributes_from_info (destination,
info,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
cancellable,
error);
g_object_unref (info);
}
return res;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Converts a text device path node to URI device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUri(IN CHAR16 *TextDeviceNode) | /* Converts a text device path node to URI device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUri(IN CHAR16 *TextDeviceNode) | {
CHAR16 *UriStr;
UINTN UriLength;
URI_DEVICE_PATH *Uri;
UriStr = GetNextParamStr (&TextDeviceNode);
UriLength = StrnLenS (UriStr, MAX_UINT16 - sizeof (URI_DEVICE_PATH));
Uri = (URI_DEVICE_PATH *)CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_URI_DP,
(UINT16)(sizeof (URI_DEVICE_PATH) + UriLength)
);
while (UriLength-- != 0) {
Uri->Uri[UriLength] = (CHAR8)UriStr[UriLength];
}
return (EFI_DEVICE_PATH_PROTOCOL *)Uri;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function divides the 64-bit signed value Dividend by the 64-bit signed value Divisor and generates a 64-bit signed quotient. If Remainder is not NULL, then the 64-bit signed remainder is returned in Remainder. This function returns the 64-bit signed quotient. */ | INT64 EFIAPI InternalMathDivRemS64x64(IN INT64 Dividend, IN INT64 Divisor, OUT INT64 *Remainder OPTIONAL) | /* This function divides the 64-bit signed value Dividend by the 64-bit signed value Divisor and generates a 64-bit signed quotient. If Remainder is not NULL, then the 64-bit signed remainder is returned in Remainder. This function returns the 64-bit signed quotient. */
INT64 EFIAPI InternalMathDivRemS64x64(IN INT64 Dividend, IN INT64 Divisor, OUT INT64 *Remainder OPTIONAL) | {
INT64 Quot;
Quot = InternalMathDivRemU64x64 (
(UINT64)(Dividend >= 0 ? Dividend : -Dividend),
(UINT64)(Divisor >= 0 ? Divisor : -Divisor),
(UINT64 *)Remainder
);
if ((Remainder != NULL) && (Dividend < 0)) {
*Remainder = -*Remainder;
}
return (Dividend ^ Divisor) >= 0 ? Quot : -Quot;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* clk_get_rate - obtain the current clock rate (in Hz) for a clock source */ | unsigned long clk_get_rate(struct clk *clk) | /* clk_get_rate - obtain the current clock rate (in Hz) for a clock source */
unsigned long clk_get_rate(struct clk *clk) | {
unsigned long rate;
if (clk->clk_get_rate)
rate = clk->clk_get_rate(clk);
else
rate = clk->rate;
return rate;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Update the Joystick state via input report to host */ | unsigned char HIDDJoystickDriver_ChangeJoystickState(const HIDDJoystickInputReport *report) | /* Update the Joystick state via input report to host */
unsigned char HIDDJoystickDriver_ChangeJoystickState(const HIDDJoystickInputReport *report) | {
memcpy(&(hiddJoystickDriver.inputReport), report, sizeof(HIDDJoystickInputReport));
return USBD_Write(HIDDJoystickDriverDescriptors_INTERRUPTIN,
&(hiddJoystickDriver.inputReport),
sizeof(HIDDJoystickInputReport),
0,
0);
} | opentx/opentx | C++ | GNU General Public License v2.0 | 2,025 |
/* This board provides the Ready/Busy state in the status register of the FPGA. Bit zero indicates the RDY(1)/BSY(0) signal. */ | static int rtc_from4_nand_device_ready(struct mtd_info *mtd) | /* This board provides the Ready/Busy state in the status register of the FPGA. Bit zero indicates the RDY(1)/BSY(0) signal. */
static int rtc_from4_nand_device_ready(struct mtd_info *mtd) | {
unsigned short status;
status = *((volatile unsigned short *)(rtc_from4_fio_base + RTC_FROM4_FPGA_SR));
return (status & RTC_FROM4_DEVICE_READY);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* initialise an cookie jar slab element prior to any use */ | void fscache_cookie_init_once(void *_cookie) | /* initialise an cookie jar slab element prior to any use */
void fscache_cookie_init_once(void *_cookie) | {
struct fscache_cookie *cookie = _cookie;
memset(cookie, 0, sizeof(*cookie));
spin_lock_init(&cookie->lock);
spin_lock_init(&cookie->stores_lock);
INIT_HLIST_HEAD(&cookie->backing_objects);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This routine will put a word on the process kernel stack. */ | static int put_stack_long(struct task_struct *task, int offset, unsigned long data) | /* This routine will put a word on the process kernel stack. */
static int put_stack_long(struct task_struct *task, int offset, unsigned long data) | {
unsigned long *stack;
stack = (unsigned long *)task_pt_regs(task);
stack[offset] = data;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Apply pitch lag to the fixed vector (AMR section 6.1.2). */ | static void pitch_sharpening(int pitch_lag_int, float beta, float *fixed_vector) | /* Apply pitch lag to the fixed vector (AMR section 6.1.2). */
static void pitch_sharpening(int pitch_lag_int, float beta, float *fixed_vector) | {
int i;
for (i = pitch_lag_int; i < SUBFR_SIZE; i++)
fixed_vector[i] += beta * fixed_vector[i - pitch_lag_int];
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Subdissector command for the Superframe specification sub-field within the beacon frame. */ | void dissect_ieee802154_superframe(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset) | /* Subdissector command for the Superframe specification sub-field within the beacon frame. */
void dissect_ieee802154_superframe(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset) | {
static const int * superframe[] = {
&hf_ieee802154_beacon_order,
&hf_ieee802154_superframe_order,
&hf_ieee802154_cap,
&hf_ieee802154_superframe_battery_ext,
&hf_ieee802154_superframe_coord,
&hf_ieee802154_assoc_permit,
NULL
};
proto_tree_add_bitmask_text(tree, tvb, *offset, 2, "Superframe Specification: ", NULL , ett_ieee802154_superframe, superframe, ENC_LITTLE_ENDIAN, BMT_NO_INT|BMT_NO_TFS);
(*offset) += 2;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns SDL_TRUE if mouse is haptic, SDL_FALSE if it isn't. */ | int SDL_MouseIsHaptic(void) | /* Returns SDL_TRUE if mouse is haptic, SDL_FALSE if it isn't. */
int SDL_MouseIsHaptic(void) | {
if (SDL_SYS_HapticMouse() < 0)
return SDL_FALSE;
return SDL_TRUE;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Enables interrupts and triggers for the specified PWM generator block. */ | void PWMGenIntTrigEnable(uint32_t ui32Base, uint32_t ui32Gen, uint32_t ui32IntTrig) | /* Enables interrupts and triggers for the specified PWM generator block. */
void PWMGenIntTrigEnable(uint32_t ui32Base, uint32_t ui32Gen, uint32_t ui32IntTrig) | {
ASSERT((ui32Base == PWM0_BASE) || (ui32Base == PWM1_BASE));
ASSERT(_PWMGenValid(ui32Gen));
ASSERT((ui32IntTrig & ~(PWM_INT_CNT_ZERO | PWM_INT_CNT_LOAD |
PWM_INT_CNT_AU | PWM_INT_CNT_AD | PWM_INT_CNT_BU |
PWM_INT_CNT_BD | PWM_TR_CNT_ZERO |
PWM_TR_CNT_LOAD | PWM_TR_CNT_AU | PWM_TR_CNT_AD |
PWM_TR_CNT_BU | PWM_TR_CNT_BD)) == 0);
HWREG(PWM_GEN_BADDR(ui32Base, ui32Gen) + PWM_O_X_INTEN) |= ui32IntTrig;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* channel = IDMA channel number from 0 to 7 */ | int mvDmaIsChannelActive(int) | /* channel = IDMA channel number from 0 to 7 */
int mvDmaIsChannelActive(int) | {
ulong data;
data = GTREGREAD (MV64460_DMA_CHANNEL0_CONTROL + 4 * channel);
if (data & BIT14)
return 1;
return 0;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* XXX: does no error checking on @path size */ | static char* sysfs_pathname(struct sysfs_dirent *sd, char *path) | /* XXX: does no error checking on @path size */
static char* sysfs_pathname(struct sysfs_dirent *sd, char *path) | {
if (sd->s_parent) {
sysfs_pathname(sd->s_parent, path);
strcat(path, "/");
}
strcat(path, sd->s_name);
return path;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* __vxge_hw_ring_block_memblock_idx_set - Sets the memblock index This function sets index to a memory block */ | static void __vxge_hw_ring_block_memblock_idx_set(u8 *block, u32 memblock_idx) | /* __vxge_hw_ring_block_memblock_idx_set - Sets the memblock index This function sets index to a memory block */
static void __vxge_hw_ring_block_memblock_idx_set(u8 *block, u32 memblock_idx) | {
*((u64 *)(block + VXGE_HW_RING_MEMBLOCK_IDX_OFFSET)) = memblock_idx;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* "Generic" get version. (Not that generic: not valid for integers, which may be in array part, nor for floats with integral values.) */ | static const TValue* getgeneric(Table *t, const TValue *key) | /* "Generic" get version. (Not that generic: not valid for integers, which may be in array part, nor for floats with integral values.) */
static const TValue* getgeneric(Table *t, const TValue *key) | {
if (luaV_rawequalobj(gkey(n), key))
return gval(n);
else {
int nx = gnext(n);
if (nx == 0)
return luaO_nilobject;
n += nx;
}
}
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* This file is part of the Simba project. */ | int mock_write_timer_module_init(int res) | /* This file is part of the Simba project. */
int mock_write_timer_module_init(int res) | {
harness_mock_write("timer_module_init()",
NULL,
0);
harness_mock_write("timer_module_init(): return (res)",
&res,
sizeof(res));
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* IDL long BrowserrQueryOtherDomains( IDL wchar_t *element_21, IDL TYPE_1 *element_22, IDL long element_23 IDL ); */ | static int dissect_browser_browserr_query_other_domains_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | /* IDL long BrowserrQueryOtherDomains( IDL wchar_t *element_21, IDL TYPE_1 *element_22, IDL long element_23 IDL ); */
static int dissect_browser_browserr_query_other_domains_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | {
offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, di, drep,
NDR_POINTER_UNIQUE, "unknown string",
hf_browser_unknown_string, 0);
offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, di, drep,
dissect_browser_TYPE_1, NDR_POINTER_REF,
"unknown TYPE_1", -1);
return offset;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Determine whether or not value is within range, get state structure, and enter (above). */ | int pm_suspend(suspend_state_t state) | /* Determine whether or not value is within range, get state structure, and enter (above). */
int pm_suspend(suspend_state_t state) | {
if (state > PM_SUSPEND_ON && state <= PM_SUSPEND_MAX)
return enter_state(state);
return -EINVAL;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Import n from unsigned binary data, big endian. */ | int rt_hwcrypto_bignum_import_bin(struct hw_bignum_mpi *n, rt_uint8_t *buf, int len) | /* Import n from unsigned binary data, big endian. */
int rt_hwcrypto_bignum_import_bin(struct hw_bignum_mpi *n, rt_uint8_t *buf, int len) | {
int cp_len, i, j;
void *temp_p;
if (n == RT_NULL || buf == RT_NULL)
{
return 0;
}
if ((int)n->total < len)
{
temp_p = rt_malloc(len);
if (temp_p == RT_NULL)
{
return 0;
}
rt_free(n->p);
n->p = temp_p;
n->total = len;
}
n->sign = 1;
rt_memset(n->p, 0, n->total);
cp_len = (int)n->total > len ? len : n->total;
for(i = cp_len, j = 0; i > 0; i--, j++)
{
n->p[j] = buf[i - 1];
}
return cp_len;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Sets the user name within @op to @username. */ | void g_mount_operation_set_username(GMountOperation *op, const char *username) | /* Sets the user name within @op to @username. */
void g_mount_operation_set_username(GMountOperation *op, const char *username) | {
g_return_if_fail (G_IS_MOUNT_OPERATION (op));
g_free (op->priv->user);
op->priv->user = g_strdup (username);
g_object_notify (G_OBJECT (op), "username");
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* The total pulse clock count is an 18 bit pulse width timer count as the most significant part and (up to) 16 bit clock divider count as a modulus. When the Rx clock divider ticks down to 0, it increments the 18 bit pulse width timer count's least significant bit. */ | static u64 ns_to_pulse_clocks(u32 ns) | /* The total pulse clock count is an 18 bit pulse width timer count as the most significant part and (up to) 16 bit clock divider count as a modulus. When the Rx clock divider ticks down to 0, it increments the 18 bit pulse width timer count's least significant bit. */
static u64 ns_to_pulse_clocks(u32 ns) | {
u64 clocks;
u32 rem;
clocks = CX23888_IR_REFCLK_FREQ / 1000000 * (u64) ns;
rem = do_div(clocks, 1000);
if (rem >= 1000 / 2)
clocks++;
return clocks;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Select the micro SD card and wait for the card to become ready. */ | int MICROSD_Select(void) | /* Select the micro SD card and wait for the card to become ready. */
int MICROSD_Select(void) | {
GPIO->P[ MICROSD_GPIOPORT ].DOUTCLR = 1 << MICROSD_CSPIN;
if (WaitReady() != 0xFF)
{
MICROSD_Deselect();
return 0;
}
return 1;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* second stage init callback, good time to panic if we couldn't identify on which board we're running since early printk is working */ | void __init board_setup(void) | /* second stage init callback, good time to panic if we couldn't identify on which board we're running since early printk is working */
void __init board_setup(void) | {
if (!board.name[0])
panic("unable to detect bcm963xx board");
printk(KERN_INFO PFX "board name: %s\n", board.name);
if (bcm63xx_get_cpu_id() != board.expected_cpu_id)
panic("unexpected CPU for bcm963xx board");
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Local function to send a command to the USB protocol engine */ | static void USBHwCmd(unsigned char bCmd) | /* Local function to send a command to the USB protocol engine */
static void USBHwCmd(unsigned char bCmd) | {
USB->USBDevIntClr = CDFULL | CCEMTY;
USB->USBCmdCode = 0x00000500 | (bCmd << 16);
Wait4DevInt(CCEMTY);
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Callback function which provided by user to remove one node in NetDestroyLinkList process. */ | EFI_STATUS EFIAPI RestExDestroyChildEntryInHandleBuffer(IN LIST_ENTRY *Entry, IN VOID *Context) | /* Callback function which provided by user to remove one node in NetDestroyLinkList process. */
EFI_STATUS EFIAPI RestExDestroyChildEntryInHandleBuffer(IN LIST_ENTRY *Entry, IN VOID *Context) | {
RESTEX_INSTANCE *Instance;
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
UINTN NumberOfChildren;
EFI_HANDLE *ChildHandleBuffer;
if ((Entry == NULL) || (Context == NULL)) {
return EFI_INVALID_PARAMETER;
}
Instance = NET_LIST_USER_STRUCT_S (Entry, RESTEX_INSTANCE, Link, RESTEX_INSTANCE_SIGNATURE);
ServiceBinding = ((RESTEX_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->ServiceBinding;
NumberOfChildren = ((RESTEX_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->NumberOfChildren;
ChildHandleBuffer = ((RESTEX_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->ChildHandleBuffer;
if (!NetIsInHandleBuffer (Instance->ChildHandle, NumberOfChildren, ChildHandleBuffer)) {
RemoveEntryList (&Instance->Link);
return EFI_SUCCESS;
}
return ServiceBinding->DestroyChild (ServiceBinding, Instance->ChildHandle);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Retrieves the size, in bytes, of the context buffer required for AES operations. */ | UINTN EFIAPI AesGetContextSize(VOID) | /* Retrieves the size, in bytes, of the context buffer required for AES operations. */
UINTN EFIAPI AesGetContextSize(VOID) | {
return (UINTN)(2 * sizeof (AES_KEY));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Kick off a purge of the outstanding lazy areas. */ | static void purge_vmap_area_lazy(void) | /* Kick off a purge of the outstanding lazy areas. */
static void purge_vmap_area_lazy(void) | {
unsigned long start = ULONG_MAX, end = 0;
__purge_vmap_area_lazy(&start, &end, 1, 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Called after the bus reset interrupt - this function readies all the end points for communication. */ | static void prvResetEndPoints(void) | /* Called after the bus reset interrupt - this function readies all the end points for communication. */
static void prvResetEndPoints(void) | {
unsigned long ulTemp;
eDriverState = eJUST_RESET;
AT91C_BASE_UDP->UDP_RSTEP = usbEND_POINT_RESET_MASK;
AT91C_BASE_UDP->UDP_RSTEP = ( unsigned long ) 0x00;
AT91C_BASE_UDP->UDP_FADDR = AT91C_UDP_FEN;
portENTER_CRITICAL();
{
ulTemp = AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_0 ];
usbCSR_SET_BIT( &ulTemp, ( ( unsigned long ) ( AT91C_UDP_EPEDS | AT91C_UDP_EPTYPE_CTRL ) ) );
AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_0 ] = ulTemp;
AT91C_BASE_UDP->UDP_IER = AT91C_UDP_EPINT0;
}
portEXIT_CRITICAL();
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* If 8-bit I/O port operations are not supported, then ASSERT(). */ | VOID EFIAPI IoReadFifo8(IN UINTN Port, IN UINTN Count, OUT VOID *Buffer) | /* If 8-bit I/O port operations are not supported, then ASSERT(). */
VOID EFIAPI IoReadFifo8(IN UINTN Port, IN UINTN Count, OUT VOID *Buffer) | {
IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint8, Count, Buffer);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */ | int main(void) | /* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void) | {
SetupHardware();
puts_P(PSTR(ESC_FG_CYAN "Keyboard Host Demo running.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
KeyboardHost_Task();
HID_Host_USBTask(&Keyboard_HID_Interface);
USB_USBTask();
}
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Find the offset on the compressed stream given and index in the kallsyms array. */ | static unsigned int get_symbol_offset(unsigned long pos) | /* Find the offset on the compressed stream given and index in the kallsyms array. */
static unsigned int get_symbol_offset(unsigned long pos) | {
const u8 *name;
int i;
name = &kallsyms_names[kallsyms_markers[pos >> 8]];
for (i = 0; i < (pos & 0xFF); i++)
name = name + (*name) + 1;
return name - kallsyms_names;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* returns the numbers of bytes in the character, -1 on format error */ | int xmlUTF8Size(const xmlChar *utf) | /* returns the numbers of bytes in the character, -1 on format error */
int xmlUTF8Size(const xmlChar *utf) | {
if (!(*utf & mask))
return len;
len++;
}
return -1;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* If EntryPoint is NULL, then ASSERT(). If NewStack is NULL, then ASSERT(). */ | VOID EFIAPI PeiSwitchStacks(IN SWITCH_STACK_ENTRY_POINT EntryPoint, IN VOID *Context1 OPTIONAL, IN VOID *Context2 OPTIONAL, IN VOID *NewStack) | /* If EntryPoint is NULL, then ASSERT(). If NewStack is NULL, then ASSERT(). */
VOID EFIAPI PeiSwitchStacks(IN SWITCH_STACK_ENTRY_POINT EntryPoint, IN VOID *Context1 OPTIONAL, IN VOID *Context2 OPTIONAL, IN VOID *NewStack) | {
BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
ASSERT (EntryPoint != NULL);
ASSERT (NewStack != NULL);
ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
JumpBuffer.Eip = (UINTN)EntryPoint;
JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID *);
JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2);
((VOID **)JumpBuffer.Esp)[1] = Context1;
((VOID **)JumpBuffer.Esp)[2] = Context2;
LongJump (&JumpBuffer, (UINTN)-1);
ASSERT (FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* param base SPDIF base pointer. param handle Pointer to the spdif_handle_t structure which stores the transfer state. param xfer Pointer to the spdif_transfer_t structure. retval kStatus_Success Successfully started the data receive. retval kStatus_SPDIF_TxBusy Previous receive still not finished. retval kStatus_InvalidArgument The input parameter is invalid. */ | status_t SPDIF_TransferSendNonBlocking(SPDIF_Type *base, spdif_handle_t *handle, spdif_transfer_t *xfer) | /* param base SPDIF base pointer. param handle Pointer to the spdif_handle_t structure which stores the transfer state. param xfer Pointer to the spdif_transfer_t structure. retval kStatus_Success Successfully started the data receive. retval kStatus_SPDIF_TxBusy Previous receive still not finished. retval kStatus_InvalidArgument The input parameter is invalid. */
status_t SPDIF_TransferSendNonBlocking(SPDIF_Type *base, spdif_handle_t *handle, spdif_transfer_t *xfer) | {
assert(handle);
if (handle->spdifQueue[handle->queueUser].data)
{
return kStatus_SPDIF_QueueFull;
}
handle->transferSize[handle->queueUser] = xfer->dataSize;
handle->spdifQueue[handle->queueUser].data = xfer->data;
handle->spdifQueue[handle->queueUser].dataSize = xfer->dataSize;
handle->queueUser = (handle->queueUser + 1) % SPDIF_XFER_QUEUE_SIZE;
handle->state = kSPDIF_Busy;
SPDIF_EnableInterrupts(base, kSPDIF_TxFIFOEmpty);
SPDIF_TxEnable(base, true);
return kStatus_Success;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Find occurrence of mem (with length mem_len) in pbuf p, starting at offset start_offset. */ | u16_t pbuf_memfind(struct pbuf *p, const void *mem, u16_t mem_len, u16_t start_offset) | /* Find occurrence of mem (with length mem_len) in pbuf p, starting at offset start_offset. */
u16_t pbuf_memfind(struct pbuf *p, const void *mem, u16_t mem_len, u16_t start_offset) | {
u16_t i;
u16_t max = p->tot_len - mem_len;
if (p->tot_len >= mem_len + start_offset) {
for(i = start_offset; i <= max; ) {
u16_t plus = pbuf_memcmp(p, i, mem, mem_len);
if (plus == 0) {
return i;
} else {
i += plus;
}
}
}
return 0xFFFF;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Stalls the CPU for the number of nanoseconds specified by NanoSeconds. */ | UINTN EFIAPI NanoSecondDelay(IN UINTN NanoSeconds) | /* Stalls the CPU for the number of nanoseconds specified by NanoSeconds. */
UINTN EFIAPI NanoSecondDelay(IN UINTN NanoSeconds) | {
InternalAcpiDelay (
(UINT32)DivU64x32 (
MultU64x32 (
NanoSeconds,
ACPI_TIMER_FREQUENCY
),
1000000000u
)
);
return NanoSeconds;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns 1 (TRUE) if it is a 'type' device, 0 otherwise. */ | static int edd_dev_is_type(struct edd_device *edev, const char *type) | /* Returns 1 (TRUE) if it is a 'type' device, 0 otherwise. */
static int edd_dev_is_type(struct edd_device *edev, const char *type) | {
struct edd_info *info;
if (!edev)
return 0;
info = edd_dev_get_info(edev);
if (type && info) {
if (!strncmp(info->params.host_bus_type, type, strlen(type)) ||
!strncmp(info->params.interface_type, type, strlen(type)))
return 1;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
Subsets and Splits