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 |
|---|---|---|---|---|---|---|---|
/* SH-4 has virtually indexed and physically tagged cache. */ | void __init sh4_cache_init(void) | /* SH-4 has virtually indexed and physically tagged cache. */
void __init sh4_cache_init(void) | {
printk("PVR=%08x CVR=%08x PRR=%08x\n",
ctrl_inl(CCN_PVR),
ctrl_inl(CCN_CVR),
ctrl_inl(CCN_PRR));
local_flush_icache_range = sh4_flush_icache_range;
local_flush_dcache_page = sh4_flush_dcache_page;
local_flush_cache_all = sh4_flush_cache_all;
local_flush_cache_mm = sh4_flush_cache_mm;
local_flush_cache_dup_mm = sh4_flush_cache_mm;
local_flush_cache_page = sh4_flush_cache_page;
local_flush_cache_range = sh4_flush_cache_range;
sh4__flush_region_init();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns: an unsigned 8-bit/1-byte value read from the @stream or %0 if an error occurred. */ | guchar g_data_input_stream_read_byte(GDataInputStream *stream, GCancellable *cancellable, GError **error) | /* Returns: an unsigned 8-bit/1-byte value read from the @stream or %0 if an error occurred. */
guchar g_data_input_stream_read_byte(GDataInputStream *stream, GCancellable *cancellable, GError **error) | {
guchar c;
g_return_val_if_fail (G_IS_DATA_INPUT_STREAM (stream), '\0');
if (read_data (stream, &c, 1, cancellable, error))
return c;
return 0;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Used to check for read/write/execute permissions on a file. We use "fsuid" for this, letting us set arbitrary permissions for filesystem access without changing the "normal" uids which are used for other things.. */ | int generic_permission(struct inode *inode, int mask, int(*check_acl)(struct inode *inode, int mask)) | /* Used to check for read/write/execute permissions on a file. We use "fsuid" for this, letting us set arbitrary permissions for filesystem access without changing the "normal" uids which are used for other things.. */
int generic_permission(struct inode *inode, int mask, int(*check_acl)(struct inode *inode, int mask)) | {
int ret;
ret = acl_permission_check(inode, mask, check_acl);
if (ret != -EACCES)
return ret;
if (!(mask & MAY_EXEC) || execute_ok(inode))
if (capable(CAP_DAC_OVERRIDE))
return 0;
mask &= MAY_READ | MAY_WRITE | MAY_EXEC;
if (mask == MAY_READ || (S_ISDIR(inode->i_mode) && !(mask & MAY_WRITE)))
if (capable(CAP_DAC_READ_SEARCH))
return 0;
return -EACCES;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* gcc-3.4 accidentally inlines this function, so use noinline. */ | static noinline void __init_refok rest_init(void) | /* gcc-3.4 accidentally inlines this function, so use noinline. */
static noinline void __init_refok rest_init(void) | {
int pid;
rcu_scheduler_starting();
kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND);
numa_default_policy();
pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);
kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
unlock_kernel();
init_idle_bootup_task(current);
preempt_enable_no_resched();
schedule();
preempt_disable();
cpu_idle();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns the FLASH PC Read/Write Protection Option Bytes value. */ | uint16_t FLASH_OB_GetPCROP(void) | /* Returns the FLASH PC Read/Write Protection Option Bytes value. */
uint16_t FLASH_OB_GetPCROP(void) | {
return (*(__IO uint16_t *)(OPTCR_BYTE2_ADDRESS));
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* enables or disables Egress tagging for one VLAN ID */ | IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBEgressVlanEntryTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanId vlanID, BOOL enabled) | /* enables or disables Egress tagging for one VLAN ID */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBEgressVlanEntryTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanId vlanID, BOOL enabled) | {
IX_ETH_DB_CHECK_PORT(portID);
IX_ETH_DB_CHECK_SINGLE_NPE(portID);
IX_ETH_DB_CHECK_VLAN_ID(vlanID);
IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
return ixEthDBPortVlanMembershipChange(portID, vlanID, ixEthDBPortInfo[portID].transmitTaggingInfo, enabled? ADD_VLAN : REMOVE_VLAN);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* We can use __set_current_state() here because schedule_timeout() calls schedule() unconditionally. */ | signed long __sched schedule_timeout_interruptible(signed long timeout) | /* We can use __set_current_state() here because schedule_timeout() calls schedule() unconditionally. */
signed long __sched schedule_timeout_interruptible(signed long timeout) | {
__set_current_state(TASK_INTERRUPTIBLE);
return schedule_timeout(timeout);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Hands off the ZCL Pump Configuration and Control dissector. */ | void proto_reg_handoff_zbee_zcl_pump_config_control(void) | /* Hands off the ZCL Pump Configuration and Control dissector. */
void proto_reg_handoff_zbee_zcl_pump_config_control(void) | {
dissector_handle_t pump_config_ctrl_handle;
pump_config_ctrl_handle = find_dissector(ZBEE_PROTOABBREV_ZCL_PUMP_CONFIG_CTRL);
dissector_add_uint("zbee.zcl.cluster", ZBEE_ZCL_CID_PUMP_CONFIG_CONTROL, pump_config_ctrl_handle);
zbee_zcl_init_cluster( proto_zbee_zcl_pump_config_control,
ett_zbee_zcl_pump_config_control,
ZBEE_ZCL_CID_PUMP_CONFIG_CONTROL,
hf_zbee_zcl_pump_config_control_attr_id,
-1, -1,
(zbee_zcl_fn_attr_data)dissect_zcl_pump_config_control_attr_data
);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function may only be called at Runtime. */ | EFI_STATUS EFIAPI MonotonicCounterDriverGetNextHighMonotonicCount(OUT UINT32 *HighCount) | /* This function may only be called at Runtime. */
EFI_STATUS EFIAPI MonotonicCounterDriverGetNextHighMonotonicCount(OUT UINT32 *HighCount) | {
EFI_TPL OldTpl;
if (HighCount == NULL) {
return EFI_INVALID_PARAMETER;
}
if (!EfiAtRuntime ()) {
OldTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
*HighCount = (UINT32)RShiftU64 (mEfiMtc, 32) + 1;
mEfiMtc = LShiftU64 (*HighCount, 32);
gBS->RestoreTPL (OldTpl);
} else {
*HighCount = (UINT32)RShiftU64 (mEfiMtc, 32) + 1;
mEfiMtc = LShiftU64 (*HighCount, 32);
}
return EfiSetVariable (
MTC_VARIABLE_NAME,
&gMtcVendorGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
sizeof (UINT32),
HighCount
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Loop through the list of powerdomains, registering all that are available on the current CPU. If pwrdm_list is supplied and not null, all of the referenced powerdomains will be registered. No return value. */ | void pwrdm_init(struct powerdomain **pwrdm_list) | /* Loop through the list of powerdomains, registering all that are available on the current CPU. If pwrdm_list is supplied and not null, all of the referenced powerdomains will be registered. No return value. */
void pwrdm_init(struct powerdomain **pwrdm_list) | {
struct powerdomain **p = NULL;
if (pwrdm_list) {
for (p = pwrdm_list; *p; p++) {
pwrdm_register(*p);
_pwrdm_setup(*p);
}
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Prepare controller for a transaction and call i2c_davinci_xfer_msg */ | static int i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) | /* Prepare controller for a transaction and call i2c_davinci_xfer_msg */
static int i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) | {
struct davinci_i2c_dev *dev = i2c_get_adapdata(adap);
int i;
int ret;
dev_dbg(dev->dev, "%s: msgs: %d\n", __func__, num);
ret = i2c_davinci_wait_bus_not_busy(dev, 1);
if (ret < 0) {
dev_warn(dev->dev, "timeout waiting for bus ready\n");
return ret;
}
for (i = 0; i < num; i++) {
ret = i2c_davinci_xfer_msg(adap, &msgs[i], (i == (num - 1)));
dev_dbg(dev->dev, "%s [%d/%d] ret: %d\n", __func__, i + 1, num,
ret);
if (ret < 0)
return ret;
}
return num;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The index should never point to the link TRB. After incrementing, if it is point to the link TRB, wrap around to the beginning and revert cycle state bit The link TRB is always at the last TRB entry. */ | static void cdns3_ep_inc_trb(int *index, u8 *cs, int trb_in_seg) | /* The index should never point to the link TRB. After incrementing, if it is point to the link TRB, wrap around to the beginning and revert cycle state bit The link TRB is always at the last TRB entry. */
static void cdns3_ep_inc_trb(int *index, u8 *cs, int trb_in_seg) | {
(*index)++;
if (*index == (trb_in_seg - 1)) {
*index = 0;
*cs ^= 1;
}
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Configure pins as Analog Input Output EVENT_OUT EXTI */ | static void MX_GPIO_Init(void) | /* Configure pins as Analog Input Output EVENT_OUT EXTI */
static void MX_GPIO_Init(void) | {
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOH_CLK_ENABLE();
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* Enables or disables connecting the OPAMP's internal reference to ADC. */ | void OPAMP_VrefConnectADCCmd(uint32_t OPAMP_Selection, FunctionalState NewState) | /* Enables or disables connecting the OPAMP's internal reference to ADC. */
void OPAMP_VrefConnectADCCmd(uint32_t OPAMP_Selection, FunctionalState NewState) | {
assert_param(IS_OPAMP_ALL_PERIPH(OPAMP_Selection));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
*(__IO uint32_t *) (OPAMP_BASE + OPAMP_Selection) |= (uint32_t) (OPAMP_CSR_TSTREF);
}
else
{
*(__IO uint32_t *) (OPAMP_BASE + OPAMP_Selection) &= (uint32_t)(~OPAMP_CSR_TSTREF);
}
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* fb_unregister_client - unregister a client notifier @nb: notifier block to callback on events */ | int fb_unregister_client(struct notifier_block *nb) | /* fb_unregister_client - unregister a client notifier @nb: notifier block to callback on events */
int fb_unregister_client(struct notifier_block *nb) | {
return blocking_notifier_chain_unregister(&fb_notifier_list, nb);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write 16 or 32 bits depending on the current size of the counter. Counters 4, 5, 6 & 7 are always 16 bit. */ | void ps3_write_ctr(u32 cpu, u32 ctr, u32 val) | /* Write 16 or 32 bits depending on the current size of the counter. Counters 4, 5, 6 & 7 are always 16 bit. */
void ps3_write_ctr(u32 cpu, u32 ctr, u32 val) | {
u32 phys_ctr;
u32 phys_val;
phys_ctr = ctr & (NR_PHYS_CTRS - 1);
if (ps3_get_ctr_size(cpu, phys_ctr) == 16) {
phys_val = ps3_read_phys_ctr(cpu, phys_ctr);
if (ctr < NR_PHYS_CTRS)
val = (val << 16) | (phys_val & 0xffff);
else
val = (val & 0xffff) | (phys_val & 0xffff0000);
}
ps3_write_phys_ctr(cpu, phys_ctr, val);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get the SPI interrupt flag of the specified SPI port. */ | unsigned long SPIIntFlagGet(unsigned long ulBase, xtBoolean xbMasked) | /* Get the SPI interrupt flag of the specified SPI port. */
unsigned long SPIIntFlagGet(unsigned long ulBase, xtBoolean xbMasked) | {
xASSERT(ulBase == SPI0_BASE);
xASSERT(xbMasked == xfalse);
return (xHWREG(ulBase + SPI_SR));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* If the inode has an IS_ROOT, DCACHE_DISCONNECTED alias, then prefer any other hashed alias over that one unless @want_discon is set, in which case only return an IS_ROOT, DCACHE_DISCONNECTED alias. */ | static struct dentry* __d_find_alias(struct inode *inode, int want_discon) | /* If the inode has an IS_ROOT, DCACHE_DISCONNECTED alias, then prefer any other hashed alias over that one unless @want_discon is set, in which case only return an IS_ROOT, DCACHE_DISCONNECTED alias. */
static struct dentry* __d_find_alias(struct inode *inode, int want_discon) | {
struct list_head *head, *next, *tmp;
struct dentry *alias, *discon_alias=NULL;
head = &inode->i_dentry;
next = inode->i_dentry.next;
while (next != head) {
tmp = next;
next = tmp->next;
prefetch(next);
alias = list_entry(tmp, struct dentry, d_alias);
if (S_ISDIR(inode->i_mode) || !d_unhashed(alias)) {
if (IS_ROOT(alias) &&
(alias->d_flags & DCACHE_DISCONNECTED))
discon_alias = alias;
else if (!want_discon) {
__dget_locked(alias);
return alias;
}
}
}
if (discon_alias)
__dget_locked(discon_alias);
return discon_alias;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable the PWM interrupt of the PWM module.
//! The */ | void xPWMIntEnable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType) | /* Enable the PWM interrupt of the PWM module.
//! The */
void xPWMIntEnable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType) | {
xASSERT(ulBase == PWMA_BASE);
xASSERT(((ulChannel >= 0) || (ulChannel <= 3)));
xASSERT((ulIntType == PWM_INT_CAP_BOTH) || (ulIntType == PWM_INT_CAP_FALL) ||
(ulIntType == PWM_INT_CAP_RISE) || (ulIntType == PWM_INT_PWM));
if (ulIntType == PWM_INT_PWM)
{
xHWREG(ulBase + PWM_PIER) |= (PWM_PIER_PWMIE0 << ulChannel);
}
else
{
xHWREG(ulBase + PWM_CCR0 + (ulChannel >> 1)*4) |=
(ulIntType << ((ulChannel % 2) ? 16 : 0));
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Applies a pullup operation to the supplied mbuf and returns a pointer to the start of the mbuf data. This is simply a convenience function which allows the user to access the mbuf data without a cast. On failure, the provided mbuf is freed. */ | void* mem_pullup_obj(struct os_mbuf **om, uint16_t len) | /* Applies a pullup operation to the supplied mbuf and returns a pointer to the start of the mbuf data. This is simply a convenience function which allows the user to access the mbuf data without a cast. On failure, the provided mbuf is freed. */
void* mem_pullup_obj(struct os_mbuf **om, uint16_t len) | {
*om = os_mbuf_pullup(*om, len);
if (*om == NULL) {
return NULL;
}
return (*om)->om_data;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Detaches the USB device of the USB line (= remove USB pull_up) */ | static void main_detach(void) | /* Detaches the USB device of the USB line (= remove USB pull_up) */
static void main_detach(void) | {
udd_detach_device();
delay_ms(TST_DETACH_DELAY);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* write field of ipu registers, without affecting other bits. */ | void ipu_write_field(int32_t ipu_index, uint32_t ID_addr, uint32_t ID_mask, uint32_t data) | /* write field of ipu registers, without affecting other bits. */
void ipu_write_field(int32_t ipu_index, uint32_t ID_addr, uint32_t ID_mask, uint32_t data) | {
uint32_t rdata;
ID_addr += REGS_IPU_BASE(ipu_index);
rdata = readl(ID_addr);
rdata &= ~ID_mask;
rdata |= (data * (ID_mask & -ID_mask)) & ID_mask;
writel(rdata, ID_addr);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns the UART hardware flow control mode currently in use. */ | unsigned long xUARTFlowControlGet(unsigned long ulBase) | /* Returns the UART hardware flow control mode currently in use. */
unsigned long xUARTFlowControlGet(unsigned long ulBase) | {
xASSERT((ulBase == UART0_BASE) ||(ulBase == UART1_BASE));
return(xHWREG(ulBase + UART_IER) & (UART_FLOWCONTROL_TX |
UART_FLOWCONTROL_RX));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This function returns %1 in there are only @patt bytes in @buf, and %0 if something else was also found. */ | int ubi_check_pattern(const void *buf, uint8_t patt, int size) | /* This function returns %1 in there are only @patt bytes in @buf, and %0 if something else was also found. */
int ubi_check_pattern(const void *buf, uint8_t patt, int size) | {
int i;
for (i = 0; i < size; i++)
if (((const uint8_t *)buf)[i] != patt)
return 0;
return 1;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Delay number of clock cycles Parameters: Delay length Return Value: None */ | void delay(uint32_t length) | /* Delay number of clock cycles Parameters: Delay length Return Value: None */
void delay(uint32_t length) | {
__asm volatile("nop");
}
return;
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* This function call the pEntry callback from a different context. */ | OsiReturnVal_e osi_Spawn(P_OSI_SPAWN_ENTRY pEntry, void *pValue, unsigned long flags) | /* This function call the pEntry callback from a different context. */
OsiReturnVal_e osi_Spawn(P_OSI_SPAWN_ENTRY pEntry, void *pValue, unsigned long flags) | {
tSimpleLinkSpawnMsg Msg;
Msg.pEntry = pEntry;
Msg.pValue = pValue;
xHigherPriorityTaskWoken = pdFALSE;
if(pdTRUE == xQueueSendFromISR( xSimpleLinkSpawnQueue, &Msg, &xHigherPriorityTaskWoken ))
{
if( xHigherPriorityTaskWoken )
{
taskYIELD ();
}
return OSI_OK;
}
return OSI_OPERATION_FAILED;
} | micropython/micropython | C++ | Other | 18,334 |
/* Each counter is 8-bits, and saturates at 255 (0xFF). They are copied to the EEPROM (aka flash) whenever ipath_update_eeprom_log() is called, but it can only be called in a context that allows sleep. This function can be called even at interrupt level. */ | void ipath_inc_eeprom_err(struct ipath_devdata *dd, u32 eidx, u32 incr) | /* Each counter is 8-bits, and saturates at 255 (0xFF). They are copied to the EEPROM (aka flash) whenever ipath_update_eeprom_log() is called, but it can only be called in a context that allows sleep. This function can be called even at interrupt level. */
void ipath_inc_eeprom_err(struct ipath_devdata *dd, u32 eidx, u32 incr) | {
uint new_val;
unsigned long flags;
spin_lock_irqsave(&dd->ipath_eep_st_lock, flags);
new_val = dd->ipath_eep_st_new_errs[eidx] + incr;
if (new_val > 255)
new_val = 255;
dd->ipath_eep_st_new_errs[eidx] = new_val;
spin_unlock_irqrestore(&dd->ipath_eep_st_lock, flags);
return;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The PWMA default IRQ, declared in StartUp code. */ | void PWM0CH3_IRQHandler(void) | /* The PWMA default IRQ, declared in StartUp code. */
void PWM0CH3_IRQHandler(void) | {
unsigned long ulPWMStastus;
unsigned long ulBase = PWMA_BASE;
ulPWMStastus = xHWREG(ulBase + PWM_INTSTS) & 0x08080808;
xHWREG(ulBase + PWM_INTSTS) = ulPWMStastus;
if (g_pfnPWMHandlerCallbacks[0] != 0)
{
if(ulPWMStastus & 0x0808)
{
g_pfnPWMHandlerCallbacks[0](0, PWM_EVENT_PWM, ulPWMStastus, 0);
}
if((ulPWMStastus & 0x08080000))
{
g_pfnPWMHandlerCallbacks[0](0, PWM_EVENT_CAP, (1 << PWM_CHANNEL3), 0);
}
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc) | /* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc) | {
if(hadc->Instance==ADC1)
{
__HAL_RCC_ADC_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_2);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Disable the 3-wire SPI start interrupt of the specified SPI port. */ | void SPI3WireStartIntDisable(unsigned long ulBase) | /* Disable the 3-wire SPI start interrupt of the specified SPI port. */
void SPI3WireStartIntDisable(unsigned long ulBase) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) || (ulBase == SPI3_BASE));
xHWREG(ulBase + SPI_CNTRL2) &= ~SPI_CNTRL2_SSTA_INTEN;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* RTC Leave Configuration Mode.
Revert the RTC to operational state. */ | void rtc_exit_config_mode(void) | /* RTC Leave Configuration Mode.
Revert the RTC to operational state. */
void rtc_exit_config_mode(void) | {
uint32_t reg32;
RTC_CRL &= ~RTC_CRL_CNF;
while ((reg32 = (RTC_CRL & RTC_CRL_RTOFF)) == 0);
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* ubi_ensure_anchor_pebs - schedule wear-leveling to produce an anchor PEB. @ubi: UBI device description object */ | int ubi_ensure_anchor_pebs(struct ubi_device *ubi) | /* ubi_ensure_anchor_pebs - schedule wear-leveling to produce an anchor PEB. @ubi: UBI device description object */
int ubi_ensure_anchor_pebs(struct ubi_device *ubi) | {
struct ubi_work *wrk;
spin_lock(&ubi->wl_lock);
if (ubi->wl_scheduled) {
spin_unlock(&ubi->wl_lock);
return 0;
}
ubi->wl_scheduled = 1;
spin_unlock(&ubi->wl_lock);
wrk = kmalloc(sizeof(struct ubi_work), GFP_NOFS);
if (!wrk) {
spin_lock(&ubi->wl_lock);
ubi->wl_scheduled = 0;
spin_unlock(&ubi->wl_lock);
return -ENOMEM;
}
wrk->anchor = 1;
wrk->func = &wear_leveling_worker;
schedule_ubi_work(ubi, wrk);
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This file is part of mbed TLS ( */ | mbedtls_time_t mbedtls_time(mbedtls_time_t *timer) | /* This file is part of mbed TLS ( */
mbedtls_time_t mbedtls_time(mbedtls_time_t *timer) | {
return (mbedtls_time_t)tls_os_get_time();
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Disables the selected stimer interrupt.
ui32Interrupt should be the logical OR of one or more of the following values: */ | void am_hal_stimer_int_disable(uint32_t ui32Interrupt) | /* Disables the selected stimer interrupt.
ui32Interrupt should be the logical OR of one or more of the following values: */
void am_hal_stimer_int_disable(uint32_t ui32Interrupt) | {
AM_REGn(CTIMER, 0, STMINTEN) &= ~ui32Interrupt;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Gets the direction and mode of a pin. */ | unsigned long xGPIODirModeGet(unsigned long ulPort, unsigned long ulPin) | /* Gets the direction and mode of a pin. */
unsigned long xGPIODirModeGet(unsigned long ulPort, unsigned long ulPin) | {
unsigned long ulBits;
xASSERT(GPIOBaseValid(ulPort));
for(ulBits=0; ulBits<16; ulBits++)
{
if(ulPin & (1 << ulBits))
{
break;
}
}
return GPIODirModeGet(ulPort, ulBits);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Function to store the given bit into the given bit buffer. */ | void BitBuffer_StoreNextBit(BitBuffer_t *const Buffer, const bool Bit) | /* Function to store the given bit into the given bit buffer. */
void BitBuffer_StoreNextBit(BitBuffer_t *const Buffer, const bool Bit) | {
if (Bit)
*Buffer->In.CurrentByte |= Buffer->In.ByteMask;
Buffer->Elements++;
if (Buffer->In.ByteMask == (1 << 7))
{
if (Buffer->In.CurrentByte != &Buffer->Data[sizeof(Buffer->Data) - 1])
Buffer->In.CurrentByte++;
else
Buffer->In.CurrentByte = Buffer->Data;
Buffer->In.ByteMask = (1 << 0);
}
else
{
Buffer->In.ByteMask <<= 1;
}
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Command response callback function for sd_ble_gap_address_set BLE command.
Callback for decoding the output parameters and the command response return code. */ | static uint32_t gap_address_set_rsp_dec(const uint8_t *p_buffer, uint16_t length) | /* Command response callback function for sd_ble_gap_address_set BLE command.
Callback for decoding the output parameters and the command response return code. */
static uint32_t gap_address_set_rsp_dec(const uint8_t *p_buffer, uint16_t length) | {
uint32_t result_code = 0;
const uint32_t err_code = ble_gap_address_set_rsp_dec(p_buffer,
length,
&result_code);
APP_ERROR_CHECK(err_code);
return result_code;
} | labapart/polymcu | C++ | null | 201 |
/* Sends the data access command to the LCD controller to prepare for one or more writes or reads using the DMDIF_writeData() and DMDIF_readData() */ | EMSTATUS DMDIF_prepareDataAccess(void) | /* Sends the data access command to the LCD controller to prepare for one or more writes or reads using the DMDIF_writeData() and DMDIF_readData() */
EMSTATUS DMDIF_prepareDataAccess(void) | {
setNextReg(DMD_SSD2119_ACCESS_DATA);
return DMD_OK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Adds a pointer to the end of the pointer array. The array will grow in size automatically if necessary. */ | void g_ptr_array_add(GPtrArray *array, gpointer data) | /* Adds a pointer to the end of the pointer array. The array will grow in size automatically if necessary. */
void g_ptr_array_add(GPtrArray *array, gpointer data) | {
GRealPtrArray *rarray = (GRealPtrArray *)array;
g_return_if_fail (rarray);
g_ptr_array_maybe_expand (rarray, 1);
rarray->pdata[rarray->len++] = data;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Reset the Instruction Cache The instruction cache must be disabled for this to have effect. */ | void flash_icache_reset(void) | /* Reset the Instruction Cache The instruction cache must be disabled for this to have effect. */
void flash_icache_reset(void) | {
FLASH_ACR |= FLASH_ACR_ICRST;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Function for decoding messages received by Bicycle Power sensor message. */ | static void sens_message_decode(ant_bpwr_profile_t *p_profile, uint8_t *p_message_payload) | /* Function for decoding messages received by Bicycle Power sensor message. */
static void sens_message_decode(ant_bpwr_profile_t *p_profile, uint8_t *p_message_payload) | {
const ant_bpwr_message_layout_t * p_bpwr_message_payload =
(ant_bpwr_message_layout_t *)p_message_payload;
ant_bpwr_page1_data_t page1;
switch (p_bpwr_message_payload->page_number)
{
case ANT_BPWR_PAGE_1:
ant_bpwr_page_1_decode(p_bpwr_message_payload->page_payload, &page1);
p_profile->_cb.p_sens_cb->calib_stat = BPWR_SENS_CALIB_REQUESTED;
p_profile->_cb.p_sens_cb->calib_handler(p_profile, &page1);
break;
default:
break;
}
} | labapart/polymcu | C++ | null | 201 |
/* Controls XOSC32K output switch back to the external clock.
Controls XOSC32K output switch back to the external clock or OSCULP32K oscillator in case of clock recovery. */ | void system_clock_source_xosc32k_set_switch_back(void) | /* Controls XOSC32K output switch back to the external clock.
Controls XOSC32K output switch back to the external clock or OSCULP32K oscillator in case of clock recovery. */
void system_clock_source_xosc32k_set_switch_back(void) | {
OSC32KCTRL->CFDCTRL.reg |= OSC32KCTRL_CFDCTRL_SWBACK;
} | memfault/zero-to-main | C++ | null | 200 |
/* See mss_uart.h for details of how to use this function. */ | void MSS_UART_set_modemstatus_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_modemstatus_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->modemsts_handler = handler;
NVIC_ClearPendingIRQ(this_uart->irqn);
set_bit_reg8(&this_uart->hw_reg->IER,EDSSI);
NVIC_EnableIRQ(this_uart->irqn);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Do an SMC call to return 2 registers by having reg1 passed in by reference */ | unsigned long call_imx_sip_ret2(unsigned long id, unsigned long reg0, unsigned long *reg1, unsigned long reg2, unsigned long reg3) | /* Do an SMC call to return 2 registers by having reg1 passed in by reference */
unsigned long call_imx_sip_ret2(unsigned long id, unsigned long reg0, unsigned long *reg1, unsigned long reg2, unsigned long reg3) | {
struct pt_regs regs;
regs.regs[0] = id;
regs.regs[1] = reg0;
regs.regs[2] = *reg1;
regs.regs[3] = reg2;
regs.regs[4] = reg3;
smc_call(®s);
*reg1 = regs.regs[1];
return regs.regs[0];
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Description: Find inode @ino in the filesystem described by @sbp using the structural inode list. Returns the matching VxFS inode on success, else a NULL pointer. */ | struct vxfs_inode_info* vxfs_stiget(struct super_block *sbp, ino_t ino) | /* Description: Find inode @ino in the filesystem described by @sbp using the structural inode list. Returns the matching VxFS inode on success, else a NULL pointer. */
struct vxfs_inode_info* vxfs_stiget(struct super_block *sbp, ino_t ino) | {
struct vxfs_inode_info *vip;
vip = __vxfs_iget(ino, VXFS_SBI(sbp)->vsi_stilist);
return IS_ERR(vip) ? NULL : vip;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. retval #kStatus_Success A transaction was successfully aborted. retval #kStatus_LPI2C_Idle There is not a non-blocking transaction currently in progress. */ | void LPI2C_MasterTransferAbort(LPI2C_Type *base, lpi2c_master_handle_t *handle) | /* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. retval #kStatus_Success A transaction was successfully aborted. retval #kStatus_LPI2C_Idle There is not a non-blocking transaction currently in progress. */
void LPI2C_MasterTransferAbort(LPI2C_Type *base, lpi2c_master_handle_t *handle) | {
if (handle->state != (uint8_t)kIdleState)
{
LPI2C_MasterDisableInterrupts(base, (uint32_t)kLPI2C_MasterIrqFlags);
base->MCR |= LPI2C_MCR_RRF_MASK | LPI2C_MCR_RTF_MASK;
if ((LPI2C_MasterGetStatusFlags(base) & ((uint32_t)kLPI2C_MasterStopDetectFlag |
(uint32_t)kLPI2C_MasterBusyFlag)) == (uint32_t)kLPI2C_MasterBusyFlag)
{
base->MTDR = (uint32_t)kStopCmd;
}
handle->state = (uint8_t)kIdleState;
}
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Get the width of the letter without overwriting it with the */ | uint8_t lv_font_get_real_width(const lv_font_t *font_p, uint32_t letter) | /* Get the width of the letter without overwriting it with the */
uint8_t lv_font_get_real_width(const lv_font_t *font_p, uint32_t letter) | {
const lv_font_t * font_i = font_p;
int16_t w;
while(font_i != NULL) {
w = font_i->get_width(font_i, letter);
if(w >= 0) return w;
font_i = font_i->next_page;
}
return 0;
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* UART MSP De-Initialization This function frees the hardware resources used in this application: */ | void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | /* UART MSP De-Initialization This function frees the hardware resources used in this application: */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | {
USARTx_FORCE_RESET();
USARTx_RELEASE_RESET();
HAL_GPIO_DeInit(USARTx_TX_GPIO_PORT, USARTx_TX_PIN);
HAL_GPIO_DeInit(USARTx_RX_GPIO_PORT, USARTx_RX_PIN);
HAL_NVIC_DisableIRQ(USARTx_IRQn);
TIMx_FORCE_RESET();
TIMx_RELEASE_RESET();
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Called for each kind of ipc when an ipc_namespace exits. */ | void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids, void(*free)(struct ipc_namespace *, struct kern_ipc_perm *)) | /* Called for each kind of ipc when an ipc_namespace exits. */
void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids, void(*free)(struct ipc_namespace *, struct kern_ipc_perm *)) | {
struct kern_ipc_perm *perm;
int next_id;
int total, in_use;
down_write(&ids->rw_mutex);
in_use = ids->in_use;
for (total = 0, next_id = 0; total < in_use; next_id++) {
perm = idr_find(&ids->ipcs_idr, next_id);
if (perm == NULL)
continue;
ipc_lock_by_ptr(perm);
free(ns, perm);
total++;
}
up_write(&ids->rw_mutex);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Add two values in F255. Partial reduction is performed (down to less than twice the modulus). */ | static void f255_add(uint32_t *d, const uint32_t *a, const uint32_t *b) | /* Add two values in F255. Partial reduction is performed (down to less than twice the modulus). */
static void f255_add(uint32_t *d, const uint32_t *a, const uint32_t *b) | {
int i;
uint32_t cc, w;
cc = 0;
for (i = 0; i < 20; i ++) {
w = a[i] + b[i] + cc;
d[i] = w & 0x1FFF;
cc = w >> 13;
}
cc = MUL15(w >> 8, 19);
d[19] &= 0xFF;
for (i = 0; i < 20; i ++) {
w = d[i] + cc;
d[i] = w & 0x1FFF;
cc = w >> 13;
}
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* param base ITRC peripheral base address return Status of the ITRC */ | status_t ITRC_ClearAllStatus(ITRC_Type *base) | /* param base ITRC peripheral base address return Status of the ITRC */
status_t ITRC_ClearAllStatus(ITRC_Type *base) | {
base->STATUS |= (IN_EVENTS_MASK | OUT_ACTIONS_MASK);
return kStatus_Success;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Use of supply names configured via regulator_set_device_supply() is strongly encouraged. It is recommended that the supply name used should match the name used for the supply and/or the relevant device pins in the datasheet. */ | struct regulator* regulator_get_exclusive(struct device *dev, const char *id) | /* Use of supply names configured via regulator_set_device_supply() is strongly encouraged. It is recommended that the supply name used should match the name used for the supply and/or the relevant device pins in the datasheet. */
struct regulator* regulator_get_exclusive(struct device *dev, const char *id) | {
return _regulator_get(dev, id, 1);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enables or disables the selected ADC start of the injected channels conversion. */ | void ADC_InjectedConvCmd(ADC_TypeDef *adc, FunctionalState state) | /* Enables or disables the selected ADC start of the injected channels conversion. */
void ADC_InjectedConvCmd(ADC_TypeDef *adc, FunctionalState state) | {
(state) ? (adc->ANYCR |= ADC_ANY_CR_JCEN) : (adc->ANYCR &= ~ADC_ANY_CR_JCEN);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This API is only intended to be used by implementations of #GSource. Do not call this API on a #GSource that you did not create. */ | void g_source_remove_poll(GSource *source, GPollFD *fd) | /* This API is only intended to be used by implementations of #GSource. Do not call this API on a #GSource that you did not create. */
void g_source_remove_poll(GSource *source, GPollFD *fd) | {
GMainContext *context;
g_return_if_fail (source != NULL);
g_return_if_fail (fd != NULL);
g_return_if_fail (!SOURCE_DESTROYED (source));
context = source->context;
if (context)
LOCK_CONTEXT (context);
source->poll_fds = g_slist_remove (source->poll_fds, fd);
if (context)
{
if (!SOURCE_BLOCKED (source))
g_main_context_remove_poll_unlocked (context, fd);
UNLOCK_CONTEXT (context);
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* RETURNS: An appropriate -ERRNO error value on error, or zero for success. */ | int pci_try_set_mwi(struct pci_dev *dev) | /* RETURNS: An appropriate -ERRNO error value on error, or zero for success. */
int pci_try_set_mwi(struct pci_dev *dev) | {
int rc = pci_set_mwi(dev);
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function clears the handler to be called when the flash interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler is no longer called. */ | void FlashLibIntUnregister(void) | /* This function clears the handler to be called when the flash interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler is no longer called. */
void FlashLibIntUnregister(void) | {
IntDisable(INT_FLASH_BLIZZARD);
IntUnregister(INT_FLASH_BLIZZARD);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Function: MX25_REMS Arguments: REMS_Identification, 16 bit buffer to store id fsptr, pointer of flash status structure Description: The REMS instruction is to read the Device manufacturer ID and electric ID of 1-byte. Return Message: FlashOperationSuccess */ | ReturnMsg MX25_REMS(uint16_t *REMS_Identification, FlashStatus *fsptr) | /* Function: MX25_REMS Arguments: REMS_Identification, 16 bit buffer to store id fsptr, pointer of flash status structure Description: The REMS instruction is to read the Device manufacturer ID and electric ID of 1-byte. Return Message: FlashOperationSuccess */
ReturnMsg MX25_REMS(uint16_t *REMS_Identification, FlashStatus *fsptr) | {
uint8_t gDataBuffer[2];
CS_Low();
SendByte( FLASH_CMD_REMS, SIO );
InsertDummyCycle( 16 );
SendByte( fsptr->ArrangeOpt, SIO );
gDataBuffer[0] = GetByte( SIO );
gDataBuffer[1] = GetByte( SIO );
*REMS_Identification = (gDataBuffer[0] << 8) | gDataBuffer[1];
CS_High();
return FlashOperationSuccess;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */ | status_t HAL_CODEC_Init(void *handle, void *config) | /* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */
status_t HAL_CODEC_Init(void *handle, void *config) | {
assert((config != NULL) && (handle != NULL));
codec_config_t *codecConfig = (codec_config_t *)config;
wm8960_config_t *wm8960Config = (wm8960_config_t *)(codecConfig->codecDevConfig);
wm8960_handle_t *wm8960Handle = (wm8960_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle));
((codec_handle_t *)handle)->codecCapability = &s_wm8960_capability;
return WM8960_Init(wm8960Handle, wm8960Config);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Returns the current operating mode for the UART transmit interrupt. */ | uint32_t UARTTxIntModeGet(uint32_t ui32Base) | /* Returns the current operating mode for the UART transmit interrupt. */
uint32_t UARTTxIntModeGet(uint32_t ui32Base) | {
ASSERT(_UARTBaseValid(ui32Base));
return(HWREG(ui32Base + UART_O_CTL) & (UART_TXINT_MODE_EOT |
UART_TXINT_MODE_FIFO));
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* SPI flash write disable.
Disable SPI flash write */ | static void spi_flash_write_disable(void) | /* SPI flash write disable.
Disable SPI flash write */
static void spi_flash_write_disable(void) | {
SPI_FLASH0->READ_CTRL.reg = SPI_FLASH_READ_CTRL_RDATA_COUNT(0);
SPI_FLASH0->CMD_BUFFER0.reg = SPI_FLASH_CMD_WRITE_DISABLE;
SPI_FLASH0->DIRECTION.reg = SPI_FLASH_DIRECTION_CMD;
SPI_FLASH0->DMA_START_ADDRESS.reg = SPI_FLASH_DMA_START_ADDRESS_MASK;
SPI_FLASH0->TRANSACTION_CTRL.reg = \
SPI_FLASH_TRANSACTION_CTRL_FLASH_TRANS_START | \
SPI_FLASH_TRANSACTION_CTRL_CMD_COUNT(0x01);
while (SPI_FLASH0->IRQ_STATUS.bit.FLASH_TRANS_DONE != \
SPI_FLASH_IRQ_STATUS_FLASH_TRANS_DONE) {
}
} | memfault/zero-to-main | C++ | null | 200 |
/* Call to resume task management cmnd waiting for room in request queue. */ | static void bfa_tskim_qresume(void *cbarg) | /* Call to resume task management cmnd waiting for room in request queue. */
static void bfa_tskim_qresume(void *cbarg) | {
struct bfa_tskim_s *tskim = cbarg;
bfa_fcpim_stats(tskim->fcpim, qresumes);
bfa_stats(tskim->itnim, tm_qresumes);
bfa_sm_send_event(tskim, BFA_TSKIM_SM_QRESUME);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* These devices are always present and don't need any board-specific setup. */ | static int __init at91_add_standard_devices(void) | /* These devices are always present and don't need any board-specific setup. */
static int __init at91_add_standard_devices(void) | {
at91_add_device_rtt();
at91_add_device_watchdog();
at91_add_device_tc();
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ | RETURN_STATUS EFIAPI SafeIntnToUint32(IN INTN Operand, OUT UINT32 *Result) | /* If the conversion results in an overflow or an underflow condition, then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeIntnToUint32(IN INTN Operand, OUT UINT32 *Result) | {
RETURN_STATUS Status;
if (Result == NULL) {
return RETURN_INVALID_PARAMETER;
}
if (sizeof (UINTN) == sizeof (UINT32)) {
if (Operand >= 0) {
*Result = (UINT32)Operand;
Status = RETURN_SUCCESS;
} else {
*Result = UINT32_ERROR;
Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
}
return SafeInt64ToUint32 ((INT64)Operand, Result);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Make a HART transmission. The HART output channels must be routed to the boards output headers by enabling the output demultiplexer and disabling the input demultiplexer. */ | int32_t cn0414_hart_transmit(struct cn0414_dev *dev, uint8_t *arg) | /* Make a HART transmission. The HART output channels must be routed to the boards output headers by enabling the output demultiplexer and disabling the input demultiplexer. */
int32_t cn0414_hart_transmit(struct cn0414_dev *dev, uint8_t *arg) | {
int32_t ret;
uint32_t size;
ret = cn0414_hart_enable_modulator(dev, true);
if(ret != CN0414_SUCCESS)
return ret;
size = strlen((char *)arg);
NVIC_DisableIRQ(TMR0_INT);
NVIC_DisableIRQ(HART_CD_INT);
ret = ad5700_transmit(dev->ad5700_device, arg, size);
if(ret != CN0414_SUCCESS)
usr_uart_write_string(dev->uart_descriptor,
(uint8_t*)"Transmission failed!\n");
NVIC_EnableIRQ(TMR0_INT);
NVIC_EnableIRQ(HART_CD_INT);
return cn0414_hart_enable_modulator(dev, false);
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* Get the list of supported Redfish schema from platform configuration. */ | EFI_STATUS EFIAPI RedfishPlatformConfigGetSupportedSchema(OUT CHAR8 **SupportedSchema) | /* Get the list of supported Redfish schema from platform configuration. */
EFI_STATUS EFIAPI RedfishPlatformConfigGetSupportedSchema(OUT CHAR8 **SupportedSchema) | {
if (mRedfishPlatformConfigLibPrivate.Protocol == NULL) {
return EFI_NOT_READY;
}
return mRedfishPlatformConfigLibPrivate.Protocol->GetSupportedSchema (
mRedfishPlatformConfigLibPrivate.Protocol,
SupportedSchema
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* When the virtio_ring code wants to prod the Host, it calls us here and we make a hypercall. We hand the physical address of the virtqueue so the Host knows which virtqueue we're talking about. */ | static void lg_notify(struct virtqueue *vq) | /* When the virtio_ring code wants to prod the Host, it calls us here and we make a hypercall. We hand the physical address of the virtqueue so the Host knows which virtqueue we're talking about. */
static void lg_notify(struct virtqueue *vq) | {
struct lguest_vq_info *lvq = vq->priv;
kvm_hypercall1(LHCALL_NOTIFY, lvq->config.pfn << PAGE_SHIFT);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Note: This is in section 7.5.2.1 of the IEEE 802.15.4-2006 document. */ | static int fake_scan_req(struct net_device *dev, u8 type, u32 channels, u8 page, u8 duration) | /* Note: This is in section 7.5.2.1 of the IEEE 802.15.4-2006 document. */
static int fake_scan_req(struct net_device *dev, u8 type, u32 channels, u8 page, u8 duration) | {
u8 edl[27] = {};
return ieee802154_nl_scan_confirm(dev, IEEE802154_SUCCESS, type,
channels, page,
type == IEEE802154_MAC_SCAN_ED ? edl : NULL);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Write contents of register REGNO in task TASK. */ | static int put_reg(struct task_struct *task, int regno, unsigned long data) | /* Write contents of register REGNO in task TASK. */
static int put_reg(struct task_struct *task, int regno, unsigned long data) | {
unsigned long *addr;
if (regno == PT_USP)
addr = &task->thread.usp;
else if (regno < ARRAY_SIZE(regoff))
addr = (unsigned long *) (task->thread.esp0 + regoff[regno]);
else
return -1;
*addr = data;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Reads three signed 16 bit values over I2C. */ | err_t l3gd20Read48(uint8_t reg, int16_t *x, int16_t *y, int16_t *z) | /* Reads three signed 16 bit values over I2C. */
err_t l3gd20Read48(uint8_t reg, int16_t *x, int16_t *y, int16_t *z) | {
I2CWriteLength = 2;
I2CReadLength = 0;
I2CMasterBuffer[0] = L3GD20_ADDRESS;
I2CMasterBuffer[1] = reg | (0x80);
i2cEngine();
I2CWriteLength = 0;
I2CReadLength = 6;
I2CMasterBuffer[0] = L3GD20_ADDRESS | L3GD20_READBIT;
ASSERT_I2C_STATUS(i2cEngine());
*x = (int16_t)(I2CSlaveBuffer[1] << 8 | I2CSlaveBuffer[0]);
*y = (int16_t)(I2CSlaveBuffer[3] << 8 | I2CSlaveBuffer[2]);
*z = (int16_t)(I2CSlaveBuffer[5] << 8 | I2CSlaveBuffer[4]);
return ERROR_NONE;
} | microbuilder/LPC11U_LPC13U_CodeBase | C++ | Other | 54 |
/* For function-return probes, init_kprobes() establishes a probepoint here. When a retprobed function returns, this probe is hit and trampoline_probe_handler() runs, calling the kretprobe's handler. */ | static void __used kretprobe_trampoline_holder(void) | /* For function-return probes, init_kprobes() establishes a probepoint here. When a retprobed function returns, this probe is hit and trampoline_probe_handler() runs, calling the kretprobe's handler. */
static void __used kretprobe_trampoline_holder(void) | {
asm volatile (".globl kretprobe_trampoline\n"
"kretprobe_trampoline:\n\t"
"nop\n");
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* calculate if there was disk-io in the system */ | static __inline__ int led_get_diskio_activity(void) | /* calculate if there was disk-io in the system */
static __inline__ int led_get_diskio_activity(void) | { static unsigned long last_pgpgin, last_pgpgout;
unsigned long events[NR_VM_EVENT_ITEMS];
int changed;
all_vm_events(events);
changed = (events[PGPGIN] != last_pgpgin) ||
(events[PGPGOUT] != last_pgpgout);
last_pgpgin = events[PGPGIN];
last_pgpgout = events[PGPGOUT];
return (changed ? LED_DISK_IO : 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns true if the utf8 character 'c' is a multibyte continuation character and the terminal is in unicode mode. */ | static int is_continuation(unsigned char c, struct tty_struct *tty) | /* Returns true if the utf8 character 'c' is a multibyte continuation character and the terminal is in unicode mode. */
static int is_continuation(unsigned char c, struct tty_struct *tty) | {
return I_IUTF8(tty) && is_utf8_continuation(c);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns the status of EN bit for the specified DMAy channelx. */ | uint8_t DMA_ReadCmdStatus(DMA_Stream_T *stream) | /* Returns the status of EN bit for the specified DMAy channelx. */
uint8_t DMA_ReadCmdStatus(DMA_Stream_T *stream) | {
return (uint8_t)(stream->SCFG_B.EN);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function will rest hub port, it is invoked when sub device attached to the hub port. */ | rt_err_t rt_usbh_hub_reset_port(uhub_t hub, rt_uint16_t port) | /* This function will rest hub port, it is invoked when sub device attached to the hub port. */
rt_err_t rt_usbh_hub_reset_port(uhub_t hub, rt_uint16_t port) | {
rt_err_t ret;
rt_uint32_t pstatus;
RT_ASSERT(hub != RT_NULL);
rt_thread_delay(50);
ret = rt_usbh_hub_set_port_feature(hub, port, PORT_FEAT_RESET);
if(ret != RT_EOK) return ret;
while(1)
{
ret = rt_usbh_hub_get_port_status(hub, port, &pstatus);
if(!(pstatus & PORT_PRS)) break;
}
ret = rt_usbh_hub_clear_port_feature(hub, port, PORT_FEAT_C_RESET);
if(ret != RT_EOK) return ret;
rt_thread_delay(50);
return RT_EOK;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Removes Protocol from the protocol list (but not the handle list). */ | PROTOCOL_INTERFACE* CoreRemoveInterfaceFromProtocol(IN IHANDLE *Handle, IN EFI_GUID *Protocol, IN VOID *Interface) | /* Removes Protocol from the protocol list (but not the handle list). */
PROTOCOL_INTERFACE* CoreRemoveInterfaceFromProtocol(IN IHANDLE *Handle, IN EFI_GUID *Protocol, IN VOID *Interface) | {
PROTOCOL_INTERFACE *Prot;
PROTOCOL_NOTIFY *ProtNotify;
PROTOCOL_ENTRY *ProtEntry;
LIST_ENTRY *Link;
ASSERT_LOCKED (&gProtocolDatabaseLock);
Prot = CoreFindProtocolInterface (Handle, Protocol, Interface);
if (Prot != NULL) {
ProtEntry = Prot->Protocol;
for (Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link = Link->ForwardLink) {
ProtNotify = CR (Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
if (ProtNotify->Position == &Prot->ByProtocol) {
ProtNotify->Position = Prot->ByProtocol.BackLink;
}
}
RemoveEntryList (&Prot->ByProtocol);
}
return Prot;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Clear the previsouly set out of band data.
Clear the previously set out of band data in order to not use it anymore as pairing information */ | ADI_BLER_RESULT adi_radio_ClearOobData(void) | /* Clear the previsouly set out of band data.
Clear the previously set out of band data in order to not use it anymore as pairing information */
ADI_BLER_RESULT adi_radio_ClearOobData(void) | {
ADI_BLER_RESULT bleResult;
ADI_BLE_LOGEVENT(LOGID_CMD_BLESMP_CLEAR_OOB_DATA);
ADI_BLE_RADIO_CMD_START(CMD_BLESMP_CLEAR_OOB_DATA);
bleResult = bler_process_cmd(CMD_BLESMP_CLEAR_OOB_DATA, 0u, NULL, 0u);
if(bleResult == ADI_BLER_SUCCESS){
bleResult |= ADI_BLE_WAIT_FOR_COMPLETION(ADI_EVENT_FLAG_RESP_SUCCESS,ADI_BLER_CMD_TIMEOUT);
}
ADI_BLE_RADIO_CMD_END();
return (bleResult);
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* Enable a DMA channel (by index ch: 0 .. 31) by setting a bit in DMA_ERQ. */ | int kinetis_dma_ch_enable(int ch, int single) | /* Enable a DMA channel (by index ch: 0 .. 31) by setting a bit in DMA_ERQ. */
int kinetis_dma_ch_enable(int ch, int single) | {
return __kinetis_dma_ch_enable(ch, 1, single);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Read a word (16 bits) from a memory location, and byte swap the value before returning to the caller. */ | unsigned short mpc824x_mpc107_read16(unsigned int address) | /* Read a word (16 bits) from a memory location, and byte swap the value before returning to the caller. */
unsigned short mpc824x_mpc107_read16(unsigned int address) | {
unsigned short retVal;
retVal = BYTE_SWAP_16_BIT (*(unsigned short *) address);
return retVal;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* On devices supporting extended PWM fault handling, the state the affected output pins are driven to can be configured with */ | void PWMOutputFault(unsigned long ulBase, unsigned long ulPWMOutBits, tBoolean bFaultSuppress) | /* On devices supporting extended PWM fault handling, the state the affected output pins are driven to can be configured with */
void PWMOutputFault(unsigned long ulBase, unsigned long ulPWMOutBits, tBoolean bFaultSuppress) | {
ASSERT(ulBase == PWM_BASE);
ASSERT(!(ulPWMOutBits & ~(PWM_OUT_0_BIT | PWM_OUT_1_BIT | PWM_OUT_2_BIT |
PWM_OUT_3_BIT | PWM_OUT_4_BIT | PWM_OUT_5_BIT |
PWM_OUT_6_BIT | PWM_OUT_7_BIT)));
if(bFaultSuppress == true)
{
HWREG(ulBase + PWM_O_FAULT) |= ulPWMOutBits;
}
else
{
HWREG(ulBase + PWM_O_FAULT) &= ~(ulPWMOutBits);
}
} | watterott/WebRadio | C++ | null | 71 |
/* This default encode_fh function assumes that the 32 inode number is suitable for locating an inode, and that the generation number can be used to check that it is still valid. It places them in the filehandle fragment where export_decode_fh expects to find them. */ | static int export_encode_fh(struct dentry *dentry, struct fid *fid, int *max_len, int connectable) | /* This default encode_fh function assumes that the 32 inode number is suitable for locating an inode, and that the generation number can be used to check that it is still valid. It places them in the filehandle fragment where export_decode_fh expects to find them. */
static int export_encode_fh(struct dentry *dentry, struct fid *fid, int *max_len, int connectable) | {
struct inode * inode = dentry->d_inode;
int len = *max_len;
int type = FILEID_INO32_GEN;
if (len < 2 || (connectable && len < 4))
return 255;
len = 2;
fid->i32.ino = inode->i_ino;
fid->i32.gen = inode->i_generation;
if (connectable && !S_ISDIR(inode->i_mode)) {
struct inode *parent;
spin_lock(&dentry->d_lock);
parent = dentry->d_parent->d_inode;
fid->i32.parent_ino = parent->i_ino;
fid->i32.parent_gen = parent->i_generation;
spin_unlock(&dentry->d_lock);
len = 4;
type = FILEID_INO32_GEN_PARENT;
}
*max_len = len;
return type;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Based on smc91111_eeprom.c which: Heavily borrowed from the following peoples GPL'ed software: */ | static int smsc_ctrlc(void) | /* Based on smc91111_eeprom.c which: Heavily borrowed from the following peoples GPL'ed software: */
static int smsc_ctrlc(void) | {
return (tstc() && getc() == 0x03);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This function converts an input device structure to a Unicode string. */ | CHAR16* UiDevicePathToStr(IN EFI_DEVICE_PATH_PROTOCOL *DevPath) | /* This function converts an input device structure to a Unicode string. */
CHAR16* UiDevicePathToStr(IN EFI_DEVICE_PATH_PROTOCOL *DevPath) | {
EFI_STATUS Status;
CHAR16 *ToText;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText;
if (DevPath == NULL) {
return NULL;
}
Status = gBS->LocateProtocol (
&gEfiDevicePathToTextProtocolGuid,
NULL,
(VOID **)&DevPathToText
);
ASSERT_EFI_ERROR (Status);
ToText = DevPathToText->ConvertDevicePathToText (
DevPath,
FALSE,
TRUE
);
ASSERT (ToText != NULL);
return ToText;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* FSM long counter status register. Long counter value is an unsigned integer value (16-bit format).. */ | int32_t lsm6dso_long_cnt_set(lsm6dso_ctx_t *ctx, uint8_t *buff) | /* FSM long counter status register. Long counter value is an unsigned integer value (16-bit format).. */
int32_t lsm6dso_long_cnt_set(lsm6dso_ctx_t *ctx, uint8_t *buff) | {
int32_t ret;
ret = lsm6dso_mem_bank_set(ctx, LSM6DSO_EMBEDDED_FUNC_BANK);
if (ret == 0) {
ret = lsm6dso_write_reg(ctx, LSM6DSO_FSM_LONG_COUNTER_L, buff, 2);
}
if (ret == 0) {
ret = lsm6dso_mem_bank_set(ctx, LSM6DSO_USER_BANK);
}
return ret;
} | alexander-g-dean/ESF | C++ | null | 41 |
/* __ibmvfc_reset_host - Reset the connection to the server (no locking) @vhost: struct ibmvfc host to reset */ | static void __ibmvfc_reset_host(struct ibmvfc_host *vhost) | /* __ibmvfc_reset_host - Reset the connection to the server (no locking) @vhost: struct ibmvfc host to reset */
static void __ibmvfc_reset_host(struct ibmvfc_host *vhost) | {
if (vhost->logged_in && vhost->action != IBMVFC_HOST_ACTION_LOGO_WAIT &&
!ibmvfc_set_host_state(vhost, IBMVFC_INITIALIZING)) {
scsi_block_requests(vhost->host);
ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_LOGO);
vhost->job_step = ibmvfc_npiv_logout;
wake_up(&vhost->work_wait_q);
} else
ibmvfc_hard_reset_host(vhost);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Function used to load the WEP keys for a selected interface */ | gboolean airpcap_if_load_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info) | /* Function used to load the WEP keys for a selected interface */
gboolean airpcap_if_load_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info) | {
if (!if_info) return FALSE;
if_info->keysCollectionSize = 0;
if_info->keysCollection = NULL;
if (!airpcap_if_get_device_keys(ad, NULL, &(if_info->keysCollectionSize)))
{
if (if_info->keysCollectionSize == 0)
{
if_info->keysCollection = NULL;
airpcap_if_close(ad);
return FALSE;
}
if_info->keysCollection = (PAirpcapKeysCollection)g_malloc(if_info->keysCollectionSize);
if (!if_info->keysCollection)
{
if_info->keysCollectionSize = 0;
if_info->keysCollection = NULL;
airpcap_if_close(ad);
return FALSE;
}
airpcap_if_get_device_keys(ad, if_info->keysCollection, &(if_info->keysCollectionSize));
return TRUE;
}
airpcap_if_close(ad);
return FALSE;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Decodes the block data for a constant block */ | static void decode_const_block_data(ALSDecContext *ctx, ALSBlockData *bd) | /* Decodes the block data for a constant block */
static void decode_const_block_data(ALSDecContext *ctx, ALSBlockData *bd) | {
int smp = bd->block_length;
int32_t val = bd->const_val;
int32_t *dst = bd->raw_samples;
for (; smp; smp--)
*dst++ = val;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Reset the port and re-configure the usb device. */ | EFI_STATUS EFIAPI PeiUsbPortReset(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *This) | /* Reset the port and re-configure the usb device. */
EFI_STATUS EFIAPI PeiUsbPortReset(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *This) | {
PEI_USB_DEVICE *PeiUsbDev;
EFI_STATUS Status;
UINT8 Address;
PeiUsbDev = PEI_USB_DEVICE_FROM_THIS (This);
ResetRootPort (
PeiServices,
PeiUsbDev->UsbHcPpi,
PeiUsbDev->Usb2HcPpi,
PeiUsbDev->DeviceAddress,
0
);
Address = PeiUsbDev->DeviceAddress;
PeiUsbDev->DeviceAddress = 0;
Status = PeiUsbSetDeviceAddress (
PeiServices,
This,
Address
);
if (EFI_ERROR (Status)) {
return Status;
}
PeiUsbDev->DeviceAddress = Address;
Status = PeiUsbSetConfiguration (
PeiServices,
This
);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* IDL BOOL CloseServiceHandle( IDL SC_HANDLE handle IDL ); */ | static int svcctl_dissect_CloseServiceHandle_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | /* IDL BOOL CloseServiceHandle( IDL SC_HANDLE handle IDL ); */
static int svcctl_dissect_CloseServiceHandle_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | {
e_ctx_hnd policy_hnd;
char *pol_name;
offset = dissect_nt_policy_hnd(
tvb, offset, pinfo, tree, di, drep, hf_svcctl_hnd, &policy_hnd,
NULL, FALSE, TRUE);
dcerpc_fetch_polhnd_data(&policy_hnd, &pol_name, NULL, NULL, NULL,
pinfo->num);
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
pol_name);
return offset;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Constructor of #CRAdditionalSel. Returns the newly built instance of #CRAdditionalSel. */ | CRAdditionalSel* cr_additional_sel_new_with_type(enum AddSelectorType a_sel_type) | /* Constructor of #CRAdditionalSel. Returns the newly built instance of #CRAdditionalSel. */
CRAdditionalSel* cr_additional_sel_new_with_type(enum AddSelectorType a_sel_type) | {
CRAdditionalSel *result = NULL;
result = cr_additional_sel_new ();
g_return_val_if_fail (result, NULL);
result->type = a_sel_type;
return result;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Scroll the display right without changing the RAM. */ | void samsungvfdScrollDisplayRight(void) | /* Scroll the display right without changing the RAM. */
void samsungvfdScrollDisplayRight(void) | {
samsungvfd_command(SAMSUNGVFD_CURSORSHIFT | SAMSUNGVFD_DISPLAYMOVE | SAMSUNGVFD_MOVERIGHT);
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* Write a data to the slave when the bus is idle, and waiting for all bus transmiton complete.(Write Step1)
This function is always used in thread mode. */ | unsigned long xI2CMasterWriteS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char ucData, xtBoolean bEndTransmition) | /* Write a data to the slave when the bus is idle, and waiting for all bus transmiton complete.(Write Step1)
This function is always used in thread mode. */
unsigned long xI2CMasterWriteS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char ucData, xtBoolean bEndTransmition) | {
unsigned long ulStatus;
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE));
xASSERT(!(ucSlaveAddr & 0x80));
xI2CMasterWriteRequestS1(ulBase, ucSlaveAddr, ucData, xfalse);
while (!(xHWREG(ulBase + I2C_CON) & I2C_CON_SI));
ulStatus = xHWREG(ulBase + I2C_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 |
/* @tport: transport registering handlers @msg_handler: receive message handler callback @event_handler: receive event handler callback */ | int scsi_nl_add_transport(u8 tport, int(*msg_handler)(struct sk_buff *), void(*event_handler)(struct notifier_block *, unsigned long, void *)) | /* @tport: transport registering handlers @msg_handler: receive message handler callback @event_handler: receive event handler callback */
int scsi_nl_add_transport(u8 tport, int(*msg_handler)(struct sk_buff *), void(*event_handler)(struct notifier_block *, unsigned long, void *)) | {
unsigned long flags;
int err = 0;
if (tport >= SCSI_NL_MAX_TRANSPORTS)
return -EINVAL;
spin_lock_irqsave(&scsi_nl_lock, flags);
if (scsi_nl_state & STATE_EHANDLER_BSY) {
spin_unlock_irqrestore(&scsi_nl_lock, flags);
msleep(1);
spin_lock_irqsave(&scsi_nl_lock, flags);
}
if (transports[tport].msg_handler || transports[tport].event_handler) {
err = -EALREADY;
goto register_out;
}
transports[tport].msg_handler = msg_handler;
transports[tport].event_handler = event_handler;
transports[tport].flags = 0;
transports[tport].refcnt = 0;
register_out:
spin_unlock_irqrestore(&scsi_nl_lock, flags);
return err;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* USB host mode management task. This function manages the RNDIS Host class driver and uIP stack when the device is initialized in USB host mode. */ | void USBHostMode_USBTask(void) | /* USB host mode management task. This function manages the RNDIS Host class driver and uIP stack when the device is initialized in USB host mode. */
void USBHostMode_USBTask(void) | {
if (USB_CurrentMode != USB_MODE_Host)
return;
uIPManagement_ManageNetwork();
RNDIS_Host_USBTask(&Ethernet_RNDIS_Interface_Host);
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* This is used directly or indirectly to implement gpio_cansleep(). It returns nonzero if access reading or writing the GPIO value can sleep. */ | int __gpio_cansleep(unsigned gpio) | /* This is used directly or indirectly to implement gpio_cansleep(). It returns nonzero if access reading or writing the GPIO value can sleep. */
int __gpio_cansleep(unsigned gpio) | {
struct gpio_chip *chip;
chip = gpio_to_chip(gpio);
return chip->can_sleep;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ic3_type @port: Port to operate with (we ignore since we only have one port) */ | static const char* ic3_type(struct uart_port *the_port) | /* ic3_type @port: Port to operate with (we ignore since we only have one port) */
static const char* ic3_type(struct uart_port *the_port) | {
if (IS_RS232(the_port->line))
return "SGI IOC3 Serial [rs232]";
else
return "SGI IOC3 Serial [rs422]";
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the information of the specified flash area */ | int32_t hal_flash_info_get(hal_partition_t in_partition, hal_logic_partition_t *partition) | /* Get the information of the specified flash area */
int32_t hal_flash_info_get(hal_partition_t in_partition, hal_logic_partition_t *partition) | {
int32_t ret = -1;
hal_logic_partition_t *logic_partition;
hal_partition_t partition_id = 0;
if ((partition != NULL) && (in_partition < hal_partitions_amount)) {
ENTER_FUNCTION();
partition_id = bes_get_operate_partition(in_partition);
if (partition_id < 0) {
TRACE("bes_get_operate_partition fail\n");
}
else {
logic_partition = (hal_logic_partition_t *)&hal_partitions[partition_id];
memcpy(partition, logic_partition, sizeof(hal_logic_partition_t));
ret = 0;
}
LEAVE_FUNCTION();
}
return ret;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* USART Read a Received Data Word.
If parity is enabled the MSB (bit 7 or 8 depending on the word length) is the parity bit. */ | uint8_t usart_recv(uint32_t usart) | /* USART Read a Received Data Word.
If parity is enabled the MSB (bit 7 or 8 depending on the word length) is the parity bit. */
uint8_t usart_recv(uint32_t usart) | {
return USART_RDR(usart);
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Enable the appropriate interrupts on the ET131x according to our configuration */ | void et131x_enable_interrupts(struct et131x_adapter *adapter) | /* Enable the appropriate interrupts on the ET131x according to our configuration */
void et131x_enable_interrupts(struct et131x_adapter *adapter) | {
u32 mask;
if (adapter->FlowControl == TxOnly || adapter->FlowControl == Both)
mask = INT_MASK_ENABLE;
else
mask = INT_MASK_ENABLE_NO_FLOW;
adapter->CachedMaskValue = mask;
writel(mask, &adapter->regs->global.int_mask);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The tick ISR handler. The peripheral used is configured by the application via a hook/callback function. */ | __interrupt void vTickISR(void) | /* The tick ISR handler. The peripheral used is configured by the application via a hook/callback function. */
__interrupt void vTickISR(void) | {
__enable_interrupt();
__set_interrupt_level( configMAX_SYSCALL_INTERRUPT_PRIORITY );
{
if( xTaskIncrementTick() != pdFALSE )
{
taskYIELD();
}
}
__set_interrupt_level( configKERNEL_INTERRUPT_PRIORITY );
} | labapart/polymcu | C++ | null | 201 |
/* Check whether we're fsgid/egid or in the supplemental group.. */ | int in_group_p(gid_t grp) | /* Check whether we're fsgid/egid or in the supplemental group.. */
int in_group_p(gid_t grp) | {
const struct cred *cred = current_cred();
int retval = 1;
if (grp != cred->fsgid)
retval = groups_search(cred->group_info, grp);
return retval;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.