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 |
|---|---|---|---|---|---|---|---|
/* change the audio source if necessary and possible returns 1 if the source is actually changed. */ | int vx_sync_audio_source(struct vx_core *chip) | /* change the audio source if necessary and possible returns 1 if the source is actually changed. */
int vx_sync_audio_source(struct vx_core *chip) | {
if (chip->audio_source_target == chip->audio_source ||
chip->pcm_running)
return 0;
vx_change_audio_source(chip, chip->audio_source_target);
chip->audio_source = chip->audio_source_target;
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Context is NULL, then ASSERT(). If CpuIndex exceeds the range of all CPUs in the system, then ASSERT(). */ | RETURN_STATUS EFIAPI SmmCpuSyncCheckOutCpu(IN OUT SMM_CPU_SYNC_CONTEXT *Context, IN UINTN CpuIndex) | /* If Context is NULL, then ASSERT(). If CpuIndex exceeds the range of all CPUs in the system, then ASSERT(). */
RETURN_STATUS EFIAPI SmmCpuSyncCheckOutCpu(IN OUT SMM_CPU_SYNC_CONTEXT *Context, IN UINTN CpuIndex) | {
ASSERT (Context != NULL);
ASSERT (CpuIndex < Context->NumberOfCpus);
if (InternalWaitForSemaphore (Context->CpuCount) == MAX_UINT32) {
return RETURN_ABORTED;
}
return RETURN_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Search thru events of the current state of the station until list exhausted or it's obvious that the event is not valid for the current state. Returns the address of the transition if cound, NULL otherwise. */ | static struct llc_station_state_trans* llc_find_station_trans(struct sk_buff *skb) | /* Search thru events of the current state of the station until list exhausted or it's obvious that the event is not valid for the current state. Returns the address of the transition if cound, NULL otherwise. */
static struct llc_station_state_trans* llc_find_station_trans(struct sk_buff *skb) | {
int i = 0;
struct llc_station_state_trans *rc = NULL;
struct llc_station_state_trans **next_trans;
struct llc_station_state *curr_state =
&llc_station_state_table[llc_main_station.state - 1];
for (next_trans = curr_state->transitions; next_trans[i]->ev; i++)
if (!next_trans[i]->ev(skb)) {
rc = next_trans[i];
break;
}
return rc;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* "m68k_fork()".. By the time we get here, the non-volatile registers have also been saved on the stack. We do some ugly pointer stuff here.. (see also copy_thread) */ | asmlinkage int m68k_fork(struct pt_regs *regs) | /* "m68k_fork()".. By the time we get here, the non-volatile registers have also been saved on the stack. We do some ugly pointer stuff here.. (see also copy_thread) */
asmlinkage int m68k_fork(struct pt_regs *regs) | {
return do_fork(SIGCHLD, rdusp(), regs, 0, NULL, NULL);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Generic function for queueing a TRB on a ring. The caller must have checked to make sure there's room on the ring. */ | static void queue_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer, u32 field1, u32 field2, u32 field3, u32 field4) | /* Generic function for queueing a TRB on a ring. The caller must have checked to make sure there's room on the ring. */
static void queue_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer, u32 field1, u32 field2, u32 field3, u32 field4) | {
struct xhci_generic_trb *trb;
trb = &ring->enqueue->generic;
trb->field[0] = field1;
trb->field[1] = field2;
trb->field[2] = field3;
trb->field[3] = field4;
inc_enq(xhci, ring, consumer);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Low-level data read callback for the simplified SSL I/O API. */ | static int sock_read(void *ctx, unsigned char *buf, size_t len) | /* Low-level data read callback for the simplified SSL I/O API. */
static int sock_read(void *ctx, unsigned char *buf, size_t len) | {
for (;;) {
ssize_t rlen;
rlen = read(*(int *)ctx, buf, len);
if (rlen <= 0) {
if (rlen < 0 && errno == EINTR) {
continue;
}
return -1;
}
return (int)rlen;
}
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* RCC global IRQ, declared in start up code. */ | void RCCIntHandler(void) | /* RCC global IRQ, declared in start up code. */
void RCCIntHandler(void) | {
unsigned long ulStatus;
ulStatus = xHWREG(RCC_CIR);
if (g_pfnRCCHandlerCallbacks[0] != 0)
{
g_pfnRCCHandlerCallbacks[0](0, 0, ulStatus, 0);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Most of the permission checking is done by xattr_permission in the vfs. The local file system is responsible for handling the system.* namespace. We also need to verify that this is a namespace that we recognize. */ | static int can_set_xattr(struct inode *inode, const char *name, const void *value, size_t value_len) | /* Most of the permission checking is done by xattr_permission in the vfs. The local file system is responsible for handling the system.* namespace. We also need to verify that this is a namespace that we recognize. */
static int can_set_xattr(struct inode *inode, const char *name, const void *value, size_t value_len) | {
if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
return can_set_system_xattr(inode, name, value, value_len);
if (strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) &&
strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) &&
strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) &&
strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN))
return -EOPNOTSUPP;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: a string containing the next attribute or NULL if no more attribute exist. */ | const char* g_file_attribute_matcher_enumerate_next(GFileAttributeMatcher *matcher) | /* Returns: a string containing the next attribute or NULL if no more attribute exist. */
const char* g_file_attribute_matcher_enumerate_next(GFileAttributeMatcher *matcher) | {
int i;
SubMatcher *sub_matcher;
if (matcher == NULL)
return NULL;
while (1)
{
i = matcher->iterator_pos++;
if (matcher->sub_matchers == NULL)
return NULL;
if (i < matcher->sub_matchers->len)
sub_matcher = &g_array_index (matcher->sub_matchers, SubMatcher, i);
else
return NULL;
if (sub_matcher->mask == 0xffffffff &&
(sub_matcher->id & (NS_MASK << NS_POS)) == matcher->iterator_ns)
return get_attribute_for_id (sub_matcher->id);
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns: 0 (to ignore the i/o request and thus fall back to buffered i/o) 1 (to accept the i/o request) */ | static int gfs2_ok_for_dio(struct gfs2_inode *ip, int rw, loff_t offset) | /* Returns: 0 (to ignore the i/o request and thus fall back to buffered i/o) 1 (to accept the i/o request) */
static int gfs2_ok_for_dio(struct gfs2_inode *ip, int rw, loff_t offset) | {
if (gfs2_is_stuffed(ip))
return 0;
if (offset >= i_size_read(&ip->i_inode))
return 0;
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The attach() and detach() entry points are used to create and destroy "instances" of the driver, where each instance represents everything needed to manage one actual PCMCIA card. */ | static int labpc_cs_attach(struct pcmcia_device *) | /* The attach() and detach() entry points are used to create and destroy "instances" of the driver, where each instance represents everything needed to manage one actual PCMCIA card. */
static int labpc_cs_attach(struct pcmcia_device *) | {
struct local_info_t *local;
dev_dbg(&link->dev, "labpc_cs_attach()\n");
local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL);
if (!local)
return -ENOMEM;
local->link = link;
link->priv = local;
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_FORCED_PULSE;
link->irq.Handler = NULL;
link->conf.Attributes = 0;
link->conf.IntType = INT_MEMORY_AND_IO;
pcmcia_cur_dev = link;
labpc_config(link);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* do_IRQ handles all hardware IRQ's. Decoded IRQs should not come via this function. Instead, they should provide their own 'handler' */ | asmlinkage void __exception asm_do_IRQ(unsigned int irq, struct pt_regs *regs) | /* do_IRQ handles all hardware IRQ's. Decoded IRQs should not come via this function. Instead, they should provide their own 'handler' */
asmlinkage void __exception asm_do_IRQ(unsigned int irq, struct pt_regs *regs) | {
struct pt_regs *old_regs = set_irq_regs(regs);
irq_enter();
if (unlikely(irq >= NR_IRQS)) {
if (printk_ratelimit())
printk(KERN_WARNING "Bad IRQ%u\n", irq);
ack_bad_irq(irq);
} else {
generic_handle_irq(irq);
}
irq_finish(irq);
irq_exit();
set_irq_regs(old_regs);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Determines if the Lowest Supported Version checks should be performed. The expected result from this function is TRUE. A platform can choose to return FALSE (e.g. during manufacturing or servicing) to allow a capsule update to a version below the current Lowest Supported Version. */ | BOOLEAN EFIAPI IsLowestSupportedVersionCheckRequired(VOID) | /* Determines if the Lowest Supported Version checks should be performed. The expected result from this function is TRUE. A platform can choose to return FALSE (e.g. during manufacturing or servicing) to allow a capsule update to a version below the current Lowest Supported Version. */
BOOLEAN EFIAPI IsLowestSupportedVersionCheckRequired(VOID) | {
if (LookupCapsuleUpdatePolicyProtocol ()) {
return mCapsuleUpdatePolicy->IsLowestSupportedVersionCheckRequired (mCapsuleUpdatePolicy);
}
return TRUE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns zero on success, a negative error code otherwise. */ | int mtd_ooblayout_count_eccbytes(struct mtd_info *mtd) | /* Returns zero on success, a negative error code otherwise. */
int mtd_ooblayout_count_eccbytes(struct mtd_info *mtd) | {
return mtd_ooblayout_count_bytes(mtd, mtd_ooblayout_ecc);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Configure the RTC AlarmA/B Subseconds value and mask.*. */ | void RTC_ConfigAlarmSubSecond(uint32_t RTC_Alarm, uint32_t RTC_AlarmSubSecondValue, uint32_t RTC_AlarmSubSecondMask) | /* Configure the RTC AlarmA/B Subseconds value and mask.*. */
void RTC_ConfigAlarmSubSecond(uint32_t RTC_Alarm, uint32_t RTC_AlarmSubSecondValue, uint32_t RTC_AlarmSubSecondMask) | {
uint32_t tmpregister = 0;
assert_param(IS_RTC_ALARM_SEL(RTC_Alarm));
assert_param(IS_RTC_ALARM_SUB_SECOND_VALUE(RTC_AlarmSubSecondValue));
assert_param(IS_RTC_ALARM_SUB_SECOND_MASK_MODE(RTC_AlarmSubSecondMask));
RTC->WRP = 0xCA;
RTC->WRP = 0x53;
tmpregister = (uint32_t)(uint32_t)(RTC_AlarmSubSecondValue) | (uint32_t)(RTC_AlarmSubSecondMask);
if (RTC_Alarm == RTC_A_ALARM)
{
RTC->ALRMASS = tmpregister;
}
else
{
RTC->ALRMBSS = tmpregister;
}
RTC->WRP = 0xFF;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Set the current count value to desired value.
Sets the value of the counter to the specified value. */ | enum status_code rtc_count_set_count(struct rtc_module *const module, const uint32_t count_value) | /* Set the current count value to desired value.
Sets the value of the counter to the specified value. */
enum status_code rtc_count_set_count(struct rtc_module *const module, const uint32_t count_value) | {
Assert(module);
Assert(module->hw);
Rtc *const rtc_module = module->hw;
while (rtc_count_is_syncing(module)) {
}
switch(module->mode){
case RTC_COUNT_MODE_32BIT:
rtc_module->MODE0.COUNT.reg = count_value;
break;
case RTC_COUNT_MODE_16BIT:
if(count_value > 0xffff){
return STATUS_ERR_INVALID_ARG;
}
rtc_module->MODE1.COUNT.reg = (uint32_t)count_value;
break;
default:
Assert(false);
return STATUS_ERR_INVALID_ARG;
}
return STATUS_OK;
} | memfault/zero-to-main | C++ | null | 200 |
/* Acquires semaphore then reads the PHY register at offset using the kumeran interface. The information retrieved is stored in data. Release the acquired semaphore before exiting. */ | s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data) | /* Acquires semaphore then reads the PHY register at offset using the kumeran interface. The information retrieved is stored in data. Release the acquired semaphore before exiting. */
s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data) | {
return __e1000_read_kmrn_reg(hw, offset, data, false);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* memory copy routine impletemented using DCP channel 1
@para dst pointer to destination address @para src pointer to source address @para size bytes to copy */ | int dcp_memcpy(void *dst, void *src, uint32_t size) | /* memory copy routine impletemented using DCP channel 1
@para dst pointer to destination address @para src pointer to source address @para size bytes to copy */
int dcp_memcpy(void *dst, void *src, uint32_t size) | {
dcp_work_pkt_p pkt = (dcp_work_pkt_p)malloc(sizeof(dcp_work_pkt_t));
pkt->next_pkt = 0;
pkt->ctrl0.U = 0;
pkt->ctrl0.B.ENABLE_MEMCOPY = 1;
pkt->ctrl0.B.DECR_SEMAPHORE = 1;
pkt->ctrl0.B.ENABLE_BLIT = 0;
pkt->ctrl0.B.INTERRUPT = 1;
pkt->ctrl1.U = 0;
pkt->dst_buf = dst;
pkt->src_buf = src;
pkt->buf_size = size;
HW_DCP_CHnCMDPTR_WR(DCP_CHANNEL_1, (unsigned int)pkt);
dcp_start_channel(DCP_CHANNEL_1, 1);
dcp_wait_channel_cmpl(DCP_CHANNEL_1);
free(pkt);
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Reads data from the specified data Backup Register. */ | u16 BKP_ReadBackupRegister(BKPDR_Typedef bkp_dr) | /* Reads data from the specified data Backup Register. */
u16 BKP_ReadBackupRegister(BKPDR_Typedef bkp_dr) | {
return (*(vu16*)(BKP_BASE + bkp_dr));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* fcoe_dev_setup() - Setup the link change notification interface */ | static void fcoe_dev_setup(void) | /* fcoe_dev_setup() - Setup the link change notification interface */
static void fcoe_dev_setup(void) | {
register_netdevice_notifier(&fcoe_notifier);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* UART MSP Initialization This function configures the hardware resources used in this example: */ | void HAL_UART_MspInit(UART_HandleTypeDef *huart) | /* UART MSP Initialization This function configures the hardware resources used in this example: */
void HAL_UART_MspInit(UART_HandleTypeDef *huart) | {
GPIO_InitTypeDef GPIO_InitStruct;
USARTx_TX_GPIO_CLK_ENABLE();
USARTx_RX_GPIO_CLK_ENABLE();
USARTx_CLK_ENABLE();
GPIO_InitStruct.Pin = USARTx_TX_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
GPIO_InitStruct.Alternate = USARTx_TX_AF;
HAL_GPIO_Init(USARTx_TX_GPIO_PORT, &GPIO_InitStruct);
GPIO_InitStruct.Pin = USARTx_RX_PIN;
GPIO_InitStruct.Alternate = USARTx_RX_AF;
HAL_GPIO_Init(USARTx_RX_GPIO_PORT, &GPIO_InitStruct);
HAL_NVIC_SetPriority(USARTx_IRQn, 0, 1);
HAL_NVIC_EnableIRQ(USARTx_IRQn);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Create driver option base on the input file path info. */ | BOOLEAN EFIAPI CreateDriverOptionFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath) | /* Create driver option base on the input file path info. */
BOOLEAN EFIAPI CreateDriverOptionFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath) | {
return ReSendForm (FilePath, FORM_DRV_ADD_FILE_ID);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set per-packet size overhead used in rate computations of HTB class. */ | void rtnl_htb_set_overhead(struct rtnl_class *class, uint8_t overhead) | /* Set per-packet size overhead used in rate computations of HTB class. */
void rtnl_htb_set_overhead(struct rtnl_class *class, uint8_t overhead) | {
struct rtnl_htb_class *d = htb_class(class);
if (d == NULL)
return;
d->ch_overhead = overhead;
d->ch_mask |= SCH_HTB_HAS_OVERHEAD;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */ | EFI_STATUS EFIAPI UsbBusComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName) | /* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI UsbBusComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName) | {
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mUsbBusDriverNameTable,
DriverName,
(BOOLEAN)(This == &mUsbBusComponentName)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function will read the EEPROM location for the device capabilities, and return the word through device_caps. */ | static s32 ixgbe_get_device_caps_82599(struct ixgbe_hw *hw, u16 *device_caps) | /* This function will read the EEPROM location for the device capabilities, and return the word through device_caps. */
static s32 ixgbe_get_device_caps_82599(struct ixgbe_hw *hw, u16 *device_caps) | {
hw->eeprom.ops.read(hw, IXGBE_DEVICE_CAPS, device_caps);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Gets the status of a job.
Gets the status of an ongoing or the last job. */ | enum status_code m2m_get_job_status(struct m2m_module *const m2m, enum m2m_job_type type) | /* Gets the status of a job.
Gets the status of an ongoing or the last job. */
enum status_code m2m_get_job_status(struct m2m_module *const m2m, enum m2m_job_type type) | {
Assert(m2m);
if (M2M_JOB_TRANSFER == type) {
return m2m->job_status;
} else if (M2M_JOB_BUFFER == type) {
if (ERR_BUSY == m2m->job_status) {
return (0 == m2m->hw->MEM2MEM_RCR) ? STATUS_OK : ERR_BUSY;
} else {
return m2m->job_status;
}
} else {
return ERR_INVALID_ARG;
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Send a command to stop the softap mode. */ | sl_status_t sl_wfx_stop_ap_command(void) | /* Send a command to stop the softap mode. */
sl_status_t sl_wfx_stop_ap_command(void) | {
return sl_wfx_send_command(SL_WFX_STOP_AP_REQ_ID, NULL, 0, SL_WFX_SOFTAP_INTERFACE, NULL);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* VTClose-Error ::= SEQUENCE { errorType Error, listOfVTSessionIdentifiers SEQUENCE OF Unsigned8 OPTIONAL } } */ | static guint fVTCloseError(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) | /* VTClose-Error ::= SEQUENCE { errorType Error, listOfVTSessionIdentifiers SEQUENCE OF Unsigned8 OPTIONAL } } */
static guint fVTCloseError(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) | {
guint8 tag_no = 0, tag_info = 0;
guint32 lvt = 0;
if (fTagNo(tvb, offset) == 0) {
offset = fContextTaggedError(tvb, pinfo, tree, offset);
if (fTagNo(tvb, offset) == 1) {
offset += fTagHeaderTree(tvb, pinfo, tree, offset, &tag_no, &tag_info, &lvt);
offset = fVtCloseRequest(tvb, pinfo, tree, offset);
offset += fTagHeaderTree(tvb, pinfo, tree, offset, &tag_no, &tag_info, &lvt);
}
}
return offset;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Get EC group order. This function will set the provided Big Number object to the corresponding value. The caller needs to make sure that the "out" BigNumber parameter is properly initialized. */ | BOOLEAN EFIAPI EcGroupGetOrder(IN VOID *EcGroup, OUT VOID *BnOrder) | /* Get EC group order. This function will set the provided Big Number object to the corresponding value. The caller needs to make sure that the "out" BigNumber parameter is properly initialized. */
BOOLEAN EFIAPI EcGroupGetOrder(IN VOID *EcGroup, OUT VOID *BnOrder) | {
CALL_CRYPTO_SERVICE (EcGroupGetOrder, (EcGroup, BnOrder), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Write data element to the SPI interface with block. */ | void xSPIDataPut(unsigned long ulBase, unsigned long ulData) | /* Write data element to the SPI interface with block. */
void xSPIDataPut(unsigned long ulBase, unsigned long ulData) | {
xASSERT(ulBase == SPI0_BASE);
while(xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY)
{
}
xHWREG(ulBase + SPI_TX0) = ulData;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Check the status of the Tx buffer of the specified SPI port. */ | xtBoolean SPIIsTxFull(unsigned long ulBase) | /* Check the status of the Tx buffer of the specified SPI port. */
xtBoolean SPIIsTxFull(unsigned long ulBase) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE));
return ((xHWREG(ulBase + SPI_SR) & SPI_SR_TXBE)? xtrue : xfalse);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Stop ADC conversion of normal group (and insert channels in case of auto_injection mode), disable ADC peripheral. */ | ald_status_t ald_adc_normal_stop(ald_adc_handle_t *hperh) | /* Stop ADC conversion of normal group (and insert channels in case of auto_injection mode), disable ADC peripheral. */
ald_status_t ald_adc_normal_stop(ald_adc_handle_t *hperh) | {
assert_param(IS_ADC_TYPE(hperh->perh));
ALD_ADC_DISABLE(hperh);
hperh->state = ALD_ADC_STATE_READY;
return ALD_OK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* @eeprom: The eeprom data strucutre to show details for. */ | static void __devinit print_eeprom_settings(struct NvRamType *eeprom) | /* @eeprom: The eeprom data strucutre to show details for. */
static void __devinit print_eeprom_settings(struct NvRamType *eeprom) | {
dprintkl(KERN_INFO, "Used settings: AdapterID=%02i, Speed=%i(%02i.%01iMHz), dev_mode=0x%02x\n",
eeprom->scsi_id,
eeprom->target[0].period,
clock_speed[eeprom->target[0].period] / 10,
clock_speed[eeprom->target[0].period] % 10,
eeprom->target[0].cfg0);
dprintkl(KERN_INFO, " AdaptMode=0x%02x, Tags=%i(%02i), DelayReset=%is\n",
eeprom->channel_cfg, eeprom->max_tag,
1 << eeprom->max_tag, eeprom->delay_time);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Given state of Eddystone beacon, get advertisement parameters. */ | static void get_adv_params(ble_gap_adv_params_t *p_adv_params, bool non_connectable, bool remain_connectable) | /* Given state of Eddystone beacon, get advertisement parameters. */
static void get_adv_params(ble_gap_adv_params_t *p_adv_params, bool non_connectable, bool remain_connectable) | {
memset(p_adv_params, 0, sizeof(ble_gap_adv_params_t));
p_adv_params->type =
non_connectable ? BLE_GAP_ADV_TYPE_ADV_NONCONN_IND : BLE_GAP_ADV_TYPE_ADV_IND;
p_adv_params->p_peer_addr = NULL;
p_adv_params->fp = BLE_GAP_ADV_FP_ANY;
p_adv_params->interval = non_connectable ? BLE_GAP_ADV_INTERVAL_MAX : 1000;
p_adv_params->timeout = non_connectable
? APP_CFG_NON_CONN_ADV_TIMEOUT
: (remain_connectable ? 0 : APP_CFG_CONNECTABLE_ADV_TIMEOUT);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* There are several places in the diAlloc* routines where we initialize the inode. */ | static void diInitInode(struct inode *ip, int iagno, int ino, int extno, struct iag *iagp) | /* There are several places in the diAlloc* routines where we initialize the inode. */
static void diInitInode(struct inode *ip, int iagno, int ino, int extno, struct iag *iagp) | {
struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
struct jfs_inode_info *jfs_ip = JFS_IP(ip);
ip->i_ino = (iagno << L2INOSPERIAG) + ino;
jfs_ip->ixpxd = iagp->inoext[extno];
jfs_ip->agno = BLKTOAG(le64_to_cpu(iagp->agstart), sbi);
jfs_ip->active_ag = -1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the ADC converted data for the specified channel. */ | u16 XAdcPs_GetAdcData(XAdcPs *InstancePtr, u8 Channel) | /* Get the ADC converted data for the specified channel. */
u16 XAdcPs_GetAdcData(XAdcPs *InstancePtr, u8 Channel) | {
u32 RegData;
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Xil_AssertNonvoid((Channel <= XADCPS_CH_VBRAM) ||
((Channel >= XADCPS_CH_VCCPINT) &&
(Channel <= XADCPS_CH_AUX_MAX)));
RegData = XAdcPs_ReadInternalReg(InstancePtr,
(XADCPS_TEMP_OFFSET + (u32)Channel));
return (u16) RegData;
} | ua1arn/hftrx | C++ | null | 69 |
/* Locking functions for card level locking. We need to own both the kernel lock for the card and have the card in a position that it wants to talk. */ | static int WaitTillCardIsFree(unsigned long base) | /* Locking functions for card level locking. We need to own both the kernel lock for the card and have the card in a position that it wants to talk. */
static int WaitTillCardIsFree(unsigned long base) | {
unsigned int count = 0;
unsigned int a = in_atomic();
while (!(inw(base + 0xe) & 0x1) && count++ < 100)
if (a)
mdelay(1);
else
msleep(1);
return !(inw(base + 0xe) & 0x1);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* USBD_CDC_RNDIS_ProcessUnsupportedMsg Parse, extract data and check correctness of CDC_RNDIS KeepAlive command. */ | static uint8_t USBD_CDC_RNDIS_ProcessUnsupportedMsg(USBD_HandleTypeDef *pdev, USBD_CDC_RNDIS_CtrlMsgTypeDef *Msg) | /* USBD_CDC_RNDIS_ProcessUnsupportedMsg Parse, extract data and check correctness of CDC_RNDIS KeepAlive command. */
static uint8_t USBD_CDC_RNDIS_ProcessUnsupportedMsg(USBD_HandleTypeDef *pdev, USBD_CDC_RNDIS_CtrlMsgTypeDef *Msg) | {
USBD_CDC_RNDIS_HandleTypeDef *hcdc = (USBD_CDC_RNDIS_HandleTypeDef *)pdev->pClassData;
USBD_CDC_RNDIS_StsChangeMsgTypeDef *Response = (USBD_CDC_RNDIS_StsChangeMsgTypeDef *)(void *)Msg;
if (hcdc == NULL)
{
return (uint8_t)USBD_FAIL;
}
Response->MsgType = CDC_RNDIS_INDICATE_STATUS_MSG_ID;
Response->MsgLength = sizeof(USBD_CDC_RNDIS_StsChangeMsgTypeDef);
Response->Status = CDC_RNDIS_STATUS_NOT_SUPPORTED;
Response->StsBufLength = 0U;
Response->StsBufOffset = 20U;
hcdc->ResponseRdy = 1U;
(void)USBD_CDC_RNDIS_SendNotification(pdev, RESPONSE_AVAILABLE, 0U, NULL);
UNUSED(Msg);
return (uint8_t)USBD_OK;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* In order to support the fast lookup of devices based on addresses, we maintain a cache of devices that can be quickly searched. This routine adds a device to that cache. */ | void pci_addr_cache_insert_device(struct pci_dev *dev) | /* In order to support the fast lookup of devices based on addresses, we maintain a cache of devices that can be quickly searched. This routine adds a device to that cache. */
void pci_addr_cache_insert_device(struct pci_dev *dev) | {
unsigned long flags;
if ((dev->class >> 16) == PCI_BASE_CLASS_BRIDGE)
return;
spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags);
__pci_addr_cache_insert_device(dev);
spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns the current MDC divider value programmed in the ip. */ | u32 synopGMAC_get_mdc_clk_div(synopGMACdevice *gmacdev) | /* Returns the current MDC divider value programmed in the ip. */
u32 synopGMAC_get_mdc_clk_div(synopGMACdevice *gmacdev) | {
u32 data;
data = synopGMACReadReg(gmacdev->MacBase,GmacGmiiAddr);
data &= GmiiCsrClkMask;
return data;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Deinitializes the WWDG peripheral registers to their default reset values. */ | void WWDG_DeInit() | /* Deinitializes the WWDG peripheral registers to their default reset values. */
void WWDG_DeInit() | {
exRCC_APB1PeriphReset(RCC_APB1RSTR_WWDG);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* USBH_MTP_SelectStorage Select the storage Unit to be used. */ | USBH_StatusTypeDef USBH_MTP_SelectStorage(USBH_HandleTypeDef *phost, uint8_t storage_idx) | /* USBH_MTP_SelectStorage Select the storage Unit to be used. */
USBH_StatusTypeDef USBH_MTP_SelectStorage(USBH_HandleTypeDef *phost, uint8_t storage_idx) | {
USBH_StatusTypeDef status = USBH_FAIL;
MTP_HandleTypeDef *MTP_Handle = phost->pActiveClass->pData;
if((storage_idx < MTP_Handle->info.storids.n) && (MTP_Handle->is_ready))
{
MTP_Handle->params.CurrentStorageId = MTP_Handle->info.storids.Storage[storage_idx];
status = USBH_OK;
}
return status;
} | micropython/micropython | C++ | Other | 18,334 |
/* Post-processes a command given the case identified during the pre-processing step. Depending on the case, one of the following actions can be done: */ | static unsigned char MSDD_PostProcessCommand(MSDDriver *pMsdDriver) | /* Post-processes a command given the case identified during the pre-processing step. Depending on the case, one of the following actions can be done: */
static unsigned char MSDD_PostProcessCommand(MSDDriver *pMsdDriver) | {
MSDCommandState *commandState = &(pMsdDriver->commandState);
MSCsw *csw = &(commandState->csw);
unsigned char haltStatus = 0;
if ((commandState->postprocess & MSDD_CASE_STALL_IN) != 0) {
TRACE_INFO_WP("StallIn ");
MSDD_Halt(MSDD_CASE_STALL_IN);
haltStatus = 1;
}
if ((commandState->postprocess & MSDD_CASE_STALL_OUT) != 0) {
TRACE_INFO_WP("StallOut ");
MSDD_Halt(MSDD_CASE_STALL_OUT);
haltStatus = 1;
}
if ((commandState->postprocess & MSDD_CASE_PHASE_ERROR) != 0) {
TRACE_INFO_WP("PhaseErr ");
csw->bCSWStatus = MSD_CSW_PHASE_ERROR;
}
return haltStatus;
} | opentx/opentx | C++ | GNU General Public License v2.0 | 2,025 |
/* DMAMUX Get Request Generator Trigger Overrun Interrupt Flag.
Get DMA Request Synchronization Overrun Interrupt Flag for given Request Generator Channel */ | uint32_t dmamux_get_request_generator_trigger_overrun_interrupt(uint32_t dmamux, uint8_t rg_channel) | /* DMAMUX Get Request Generator Trigger Overrun Interrupt Flag.
Get DMA Request Synchronization Overrun Interrupt Flag for given Request Generator Channel */
uint32_t dmamux_get_request_generator_trigger_overrun_interrupt(uint32_t dmamux, uint8_t rg_channel) | {
return DMAMUX_RGSR(dmamux) & DMAMUX_RGSR_OF(rg_channel);
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* Stop this driver on ControllerHandle. This service is called by the EFI boot service DisconnectController(). In order to make drivers as small as possible, there are a few calling restrictions for this service. DisconnectController() must follow these calling restrictions. If any other agent wishes to call Stop() it must also follow these calling restrictions. */ | EFI_STATUS EFIAPI PxeBcIp4DriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer) | /* Stop this driver on ControllerHandle. This service is called by the EFI boot service DisconnectController(). In order to make drivers as small as possible, there are a few calling restrictions for this service. DisconnectController() must follow these calling restrictions. If any other agent wishes to call Stop() it must also follow these calling restrictions. */
EFI_STATUS EFIAPI PxeBcIp4DriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer) | {
return PxeBcStop (
This,
ControllerHandle,
NumberOfChildren,
ChildHandleBuffer,
IP_VERSION_4
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ | UINT32 EFIAPI PciSegmentAndThenOr32(IN UINT64 Address, IN UINT32 AndData, IN UINT32 OrData) | /* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciSegmentAndThenOr32(IN UINT64 Address, IN UINT32 AndData, IN UINT32 OrData) | {
UINTN Count;
PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioAndThenOr32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData, OrData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function configures desired CMT channel for the requested frequency and desired interrupt priority level, associates a user callback function with the timer’s interrupt, powers up and starts the timer. */ | bool R_CMT_CreatePeriodicAssignChannelPriority(uint32_t frequency_hz, void(*callback)(void *pdata), uint32_t channel, cmt_priority_t priority) | /* This function configures desired CMT channel for the requested frequency and desired interrupt priority level, associates a user callback function with the timer’s interrupt, powers up and starts the timer. */
bool R_CMT_CreatePeriodicAssignChannelPriority(uint32_t frequency_hz, void(*callback)(void *pdata), uint32_t channel, cmt_priority_t priority) | {
return cmt_create_priority(frequency_hz, callback, CMT_RX_MODE_PERIODIC, channel, priority);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Device close function to count number of users. */ | static int zcrypt_release(struct inode *inode, struct file *filp) | /* Device close function to count number of users. */
static int zcrypt_release(struct inode *inode, struct file *filp) | {
atomic_dec(&zcrypt_open_count);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This code gets the size of variable data. */ | UINTN DataSizeOfVariable(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFormat) | /* This code gets the size of variable data. */
UINTN DataSizeOfVariable(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFormat) | {
AUTHENTICATED_VARIABLE_HEADER *AuthVariable;
AuthVariable = (AUTHENTICATED_VARIABLE_HEADER *)Variable;
if (AuthFormat) {
if ((AuthVariable->State == (UINT8)(-1)) ||
(AuthVariable->DataSize == (UINT32)(-1)) ||
(AuthVariable->NameSize == (UINT32)(-1)) ||
(AuthVariable->Attributes == (UINT32)(-1)))
{
return 0;
}
return (UINTN)AuthVariable->DataSize;
} else {
if ((Variable->State == (UINT8)(-1)) ||
(Variable->DataSize == (UINT32)(-1)) ||
(Variable->NameSize == (UINT32)(-1)) ||
(Variable->Attributes == (UINT32)(-1)))
{
return 0;
}
return (UINTN)Variable->DataSize;
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Return the length of the MQTTstring - C string if there is one, otherwise the length delimited string */ | int mqtt_strlen(mqtt_string_t mqttstring) | /* Return the length of the MQTTstring - C string if there is one, otherwise the length delimited string */
int mqtt_strlen(mqtt_string_t mqttstring) | {
int rc = 0;
if (mqttstring.cstring)
rc = strlen(mqttstring.cstring);
else
rc = mqttstring.lenstring.len;
return rc;
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* Set the wake-up inputs for fast startup mode registers (event generation). */ | void pmc_set_fast_startup_input(uint32_t ul_inputs) | /* Set the wake-up inputs for fast startup mode registers (event generation). */
void pmc_set_fast_startup_input(uint32_t ul_inputs) | {
ul_inputs &= PMC_FAST_STARTUP_Msk;
PMC->PMC_FSMR |= ul_inputs;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This function gets a free command node if available in command free queue.
This file contains the handling of command. It prepares command and sends it to firmware when it is ready. */ | static struct cmd_ctrl_node * lbs_get_cmd_ctrl_node(struct lbs_private *priv) | /* This function gets a free command node if available in command free queue.
This file contains the handling of command. It prepares command and sends it to firmware when it is ready. */
static struct cmd_ctrl_node * lbs_get_cmd_ctrl_node(struct lbs_private *priv) | {
struct cmd_ctrl_node *tempnode;
unsigned long flags;
lbs_deb_enter(LBS_DEB_HOST);
if (!priv)
return NULL;
spin_lock_irqsave(&priv->driver_lock, flags);
if (!list_empty(&priv->cmdfreeq)) {
tempnode = list_first_entry(&priv->cmdfreeq,
struct cmd_ctrl_node, list);
list_del(&tempnode->list);
} else {
lbs_deb_host("GET_CMD_NODE: cmd_ctrl_node is not available\n");
tempnode = NULL;
}
spin_unlock_irqrestore(&priv->driver_lock, flags);
lbs_deb_leave(LBS_DEB_HOST);
return tempnode;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ADC Disable an External Trigger for Regular Channels. */ | void adc_disable_external_trigger_regular(uint32_t adc) | /* ADC Disable an External Trigger for Regular Channels. */
void adc_disable_external_trigger_regular(uint32_t adc) | {
ADC_CFGR1(adc) &= ~ADC_CFGR1_EXTEN_MASK;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* We need to wake up the LynxEM+, and make sure its in linear memory mode. */ | static void sm7xx_init_hw(void) | /* We need to wake up the LynxEM+, and make sure its in linear memory mode. */
static void sm7xx_init_hw(void) | {
outb_p(0x18, 0x3c4);
outb_p(0x11, 0x3c5);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* And bear in mind, this is about reading from the target PEB, i.e. the PEB which we have just written. */ | static int is_error_sane(int err) | /* And bear in mind, this is about reading from the target PEB, i.e. the PEB which we have just written. */
static int is_error_sane(int err) | {
if (err == -EIO || err == -ENOMEM || err == UBI_IO_BAD_VID_HDR ||
err == -ETIMEDOUT)
return 0;
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Programs a half word at a specified Option Byte Data address. */ | FLASH_STS FLASH_ProgramOBData(uint32_t Address, uint32_t Data) | /* Programs a half word at a specified Option Byte Data address. */
FLASH_STS FLASH_ProgramOBData(uint32_t Address, uint32_t Data) | {
FLASH_STS status = FLASH_COMPL;
assert_param(IS_OB_DATA_ADDRESS(Address));
if (FLASH_GetReadOutProtectionL2STS() != RESET)
{
status = FLASH_ERR_RDP2;
return status;
}
FLASH_ClearFlag(FLASH_STS_CLRFLAG);
status = FLASH_WaitForLastOpt(ProgramTimeout);
if (status == FLASH_COMPL)
{
FLASH->OPTKEY = FLASH_KEY1;
FLASH->OPTKEY = FLASH_KEY2;
FLASH->CTRL |= CTRL_Set_OPTPG;
*(__IO uint32_t*)Address = (uint32_t)Data;
status = FLASH_WaitForLastOpt(ProgramTimeout);
if (status != FLASH_TIMEOUT)
{
FLASH->CTRL &= CTRL_Reset_OPTPG;
}
}
return status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Clears all of the I2S interrupt pending bit. */ | void I2S_INTClearAll(I2S_TypeDef *I2Sx) | /* Clears all of the I2S interrupt pending bit. */
void I2S_INTClearAll(I2S_TypeDef *I2Sx) | {
I2Sx->IS_TX_STATUS_INT = 0x1ff;
I2Sx->IS_RX_STATUS_INT = 0x1ff;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* This driver manages the dma addresss unless message->is_dma_mapped. */ | static int atmel_spi_dma_map_xfer(struct atmel_spi *as, struct spi_transfer *xfer) | /* This driver manages the dma addresss unless message->is_dma_mapped. */
static int atmel_spi_dma_map_xfer(struct atmel_spi *as, struct spi_transfer *xfer) | {
struct device *dev = &as->pdev->dev;
xfer->tx_dma = xfer->rx_dma = INVALID_DMA_ADDRESS;
if (xfer->tx_buf) {
xfer->tx_dma = dma_map_single(dev,
(void *) xfer->tx_buf, xfer->len,
DMA_TO_DEVICE);
if (dma_mapping_error(dev, xfer->tx_dma))
return -ENOMEM;
}
if (xfer->rx_buf) {
xfer->rx_dma = dma_map_single(dev,
xfer->rx_buf, xfer->len,
DMA_FROM_DEVICE);
if (dma_mapping_error(dev, xfer->rx_dma)) {
if (xfer->tx_buf)
dma_unmap_single(dev,
xfer->tx_dma, xfer->len,
DMA_TO_DEVICE);
return -ENOMEM;
}
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ADC MSP De-Initialization This function frees the hardware resources used in this example: */ | void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc) | /* ADC MSP De-Initialization This function frees the hardware resources used in this example: */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc) | {
static DMA_HandleTypeDef hdma_adc;
ADCxy_FORCE_RESET();
ADCxy_RELEASE_RESET();
HAL_GPIO_DeInit(ADCxy_CHANNEL_GPIO_PORT, ADCxy_CHANNEL_PIN);
HAL_DMA_DeInit(&hdma_adc);
HAL_NVIC_DisableIRQ(ADCxy_DMA_IRQn);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* The function is used to configure a receive message object. */ | int32_t CAN_SetRxMsg(CAN_T *tCAN, uint32_t u32MsgNum, uint32_t u32IDType, uint32_t u32ID) | /* The function is used to configure a receive message object. */
int32_t CAN_SetRxMsg(CAN_T *tCAN, uint32_t u32MsgNum, uint32_t u32IDType, uint32_t u32ID) | {
int32_t rev = (int32_t)TRUE;
uint32_t u32TimeOutCount = 0ul;
while (CAN_SetRxMsgObj(tCAN, (uint8_t)u32MsgNum, (uint8_t)u32IDType, u32ID, (uint8_t)TRUE) == (int32_t)FALSE)
{
if (++u32TimeOutCount >= RETRY_COUNTS)
{
rev = (int32_t)(FALSE);
break;
}
else
{
}
}
return rev;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This is just a wrapper for unregister_netdevice that takes the rtnl semaphore. In general you want to use this and not unregister_netdevice. */ | void unregister_netdev(struct net_device *dev) | /* This is just a wrapper for unregister_netdevice that takes the rtnl semaphore. In general you want to use this and not unregister_netdevice. */
void unregister_netdev(struct net_device *dev) | {
rtnl_lock();
unregister_netdevice(dev);
rtnl_unlock();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Global pages have to be flushed a bit differently. Not a real performance problem because this does not happen often. */ | static void native_flush_tlb_global(void) | /* Global pages have to be flushed a bit differently. Not a real performance problem because this does not happen often. */
static void native_flush_tlb_global(void) | {
__native_flush_tlb_global();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enables or disables simultaneously the two DAC channels software triggers. */ | void DAC_DualSoftwareTriggerCmd(DAC_TypeDef *DACx, FunctionalState NewState) | /* Enables or disables simultaneously the two DAC channels software triggers. */
void DAC_DualSoftwareTriggerCmd(DAC_TypeDef *DACx, FunctionalState NewState) | {
assert_param(IS_DAC_LIST1_PERIPH(DACx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
DACx->SWTRIGR |= DUAL_SWTRIG_SET;
}
else
{
DACx->SWTRIGR &= DUAL_SWTRIG_RESET;
}
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Check whether we have working codec for the specific coding scheme. */ | int TIFFIsCODECConfigured(uint16 scheme) | /* Check whether we have working codec for the specific coding scheme. */
int TIFFIsCODECConfigured(uint16 scheme) | {
const TIFFCodec* codec = TIFFFindCODEC(scheme);
if(codec == NULL) {
return 0;
}
if(codec->init == NULL) {
return 0;
}
if(codec->init != NotConfigured){
return 1;
}
return 0;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* LEB properties are categorized to enable fast find operations. */ | static void ubifs_remove_from_cat(struct ubifs_info *c, struct ubifs_lprops *lprops, int cat) | /* LEB properties are categorized to enable fast find operations. */
static void ubifs_remove_from_cat(struct ubifs_info *c, struct ubifs_lprops *lprops, int cat) | {
switch (cat) {
case LPROPS_DIRTY:
case LPROPS_DIRTY_IDX:
case LPROPS_FREE:
remove_from_lpt_heap(c, lprops, cat);
break;
case LPROPS_FREEABLE:
c->freeable_cnt -= 1;
ubifs_assert(c->freeable_cnt >= 0);
case LPROPS_UNCAT:
case LPROPS_EMPTY:
case LPROPS_FRDI_IDX:
ubifs_assert(!list_empty(&lprops->list));
list_del(&lprops->list);
break;
default:
ubifs_assert(0);
}
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Driver for the LanMedia LMC5200, LMC5245, LMC1000, LMC1200 cards. */ | void lmc_proto_attach(lmc_softc_t *sc) | /* Driver for the LanMedia LMC5200, LMC5245, LMC1000, LMC1200 cards. */
void lmc_proto_attach(lmc_softc_t *sc) | {
lmc_trace(sc->lmc_device, "lmc_proto_attach in");
if (sc->if_type == LMC_NET) {
struct net_device *dev = sc->lmc_device;
dev->flags |= IFF_POINTOPOINT;
dev->hard_header_len = 0;
dev->addr_len = 0;
}
lmc_trace(sc->lmc_device, "lmc_proto_attach out");
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks whether the specified interrupt has occurred or not. */ | uint8_t ADC_ReadIntFlag(ADC_INT_FLAG_T flag) | /* Checks whether the specified interrupt has occurred or not. */
uint8_t ADC_ReadIntFlag(ADC_INT_FLAG_T flag) | {
uint8_t intEnable;
uint8_t intStatus;
intEnable = (uint8_t)(ADC->INT & (uint32_t)flag);
intStatus = (uint8_t)(ADC->STS & (uint32_t)(flag & 0xff));
if (intEnable && intStatus)
{
return SET;
}
return RESET;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Measures the supply voltage by averaging multiple readings. */ | static float measureSupplyVoltage(unsigned int avg) | /* Measures the supply voltage by averaging multiple readings. */
static float measureSupplyVoltage(unsigned int avg) | {
uint16_t adcData;
float supplyVoltage;
int i;
adcInit();
supplyVoltage = 0;
for( i = 0; i < avg; i++ ) {
adcData = getAdcSample();
supplyVoltage += (float) adcData * 5.0 / 4095.0;
}
adcDeInit();
supplyVoltage = supplyVoltage / (float) avg;
return supplyVoltage;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Draw filled polygon with alpha blending.
Note: Standard filledPolygon function is calling multithreaded version with NULL parameters to use the global vertex cache. */ | int filledPolygonColor(SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color) | /* Draw filled polygon with alpha blending.
Note: Standard filledPolygon function is calling multithreaded version with NULL parameters to use the global vertex cache. */
int filledPolygonColor(SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color) | {
return (filledPolygonColorMT(dst, vx, vy, n, color, NULL, NULL));
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Retrieve the TBSCertificate from one given X.509 certificate. */ | BOOLEAN EFIAPI CryptoServiceX509GetTBSCert(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 **TBSCert, OUT UINTN *TBSCertSize) | /* Retrieve the TBSCertificate from one given X.509 certificate. */
BOOLEAN EFIAPI CryptoServiceX509GetTBSCert(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 **TBSCert, OUT UINTN *TBSCertSize) | {
return CALL_BASECRYPTLIB (X509.Services.GetTBSCert, X509GetTBSCert, (Cert, CertSize, TBSCert, TBSCertSize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Timer6 valid period function configuration for special compare function. */ | int32_t TMR6_ValidPeriodConfig(CM_TMR6_TypeDef *TMR6x, const stc_tmr6_valid_period_config_t *pstcValidperiodConfig) | /* Timer6 valid period function configuration for special compare function. */
int32_t TMR6_ValidPeriodConfig(CM_TMR6_TypeDef *TMR6x, const stc_tmr6_valid_period_config_t *pstcValidperiodConfig) | {
int32_t i32Ret = LL_ERR_INVD_PARAM;
if (NULL != pstcValidperiodConfig) {
DDL_ASSERT(IS_VALID_TMR6_UNIT(TMR6x));
DDL_ASSERT(IS_VALID_PERIOD_CNT_COND(pstcValidperiodConfig->u32CountCond));
DDL_ASSERT(IS_VALID_PERIOD_CNT(pstcValidperiodConfig->u32PeriodInterval));
MODIFY_REG32(TMR6x->VPERR, TMR6_VPERR_PCNTS | TMR6_VPERR_PCNTE, \
pstcValidperiodConfig->u32CountCond | pstcValidperiodConfig->u32PeriodInterval);
i32Ret = LL_OK;
}
return i32Ret;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* returns SUCCESS if the PF has set the ACK bit or else ERR_MBX */ | static s32 e1000_check_for_ack_vf(struct e1000_hw *hw) | /* returns SUCCESS if the PF has set the ACK bit or else ERR_MBX */
static s32 e1000_check_for_ack_vf(struct e1000_hw *hw) | {
s32 ret_val = -E1000_ERR_MBX;
if (!e1000_check_for_bit_vf(hw, E1000_V2PMAILBOX_PFACK)) {
ret_val = E1000_SUCCESS;
hw->mbx.stats.acks++;
}
return ret_val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Function irda_insert_no_value (self, buf, len, pi, type, func) */ | static int irda_insert_no_value(void *self, __u8 *buf, int len, __u8 pi, PV_TYPE type, PI_HANDLER func) | /* Function irda_insert_no_value (self, buf, len, pi, type, func) */
static int irda_insert_no_value(void *self, __u8 *buf, int len, __u8 pi, PV_TYPE type, PI_HANDLER func) | {
irda_param_t p;
int ret;
p.pi = pi;
p.pl = 0;
ret = (*func)(self, &p, PV_GET);
irda_param_pack(buf, "bb", p.pi, p.pl);
if (ret < 0)
return ret;
return 2;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Equivalent to ARDI's call: ROMlib_RelString(s1+1, s2+1, true, false, (s1<<16) | s2) */ | int hfs_strcmp(const unsigned char *s1, unsigned int len1, const unsigned char *s2, unsigned int len2) | /* Equivalent to ARDI's call: ROMlib_RelString(s1+1, s2+1, true, false, (s1<<16) | s2) */
int hfs_strcmp(const unsigned char *s1, unsigned int len1, const unsigned char *s2, unsigned int len2) | {
int len, tmp;
len = (len1 > len2) ? len2 : len1;
while (len--) {
tmp = (int)caseorder[*(s1++)] - (int)caseorder[*(s2++)];
if (tmp)
return tmp;
}
return len1 - len2;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* entry point for using the compiler with no pcap open pass in all the stuff that is needed explicitly instead. */ | int pcap_compile_nopcap(int snaplen_arg, int linktype_arg, struct bpf_program *program, const char *buf, int optimize, bpf_u_int32 mask) | /* entry point for using the compiler with no pcap open pass in all the stuff that is needed explicitly instead. */
int pcap_compile_nopcap(int snaplen_arg, int linktype_arg, struct bpf_program *program, const char *buf, int optimize, bpf_u_int32 mask) | {
pcap_t *p;
int ret;
p = pcap_open_dead(linktype_arg, snaplen_arg);
if (p == NULL)
return (-1);
ret = pcap_compile(p, program, buf, optimize, mask);
pcap_close(p);
return (ret);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Wrapper functions for 16bit uid back compatibility. All nicely tied together in the faint hope we can take the out in five years time. */ | SYSCALL_DEFINE3(chown16, const char __user *, filename, old_uid_t, user, old_gid_t, group) | /* Wrapper functions for 16bit uid back compatibility. All nicely tied together in the faint hope we can take the out in five years time. */
SYSCALL_DEFINE3(chown16, const char __user *, filename, old_uid_t, user, old_gid_t, group) | {
long ret = sys_chown(filename, low2highuid(user), low2highgid(group));
asmlinkage_protect(3, ret, filename, user, group);
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get the UART instance from peripheral base address. */ | static uint32_t smartcard_emvsim_GetInstance(EMVSIM_Type *base) | /* Get the UART instance from peripheral base address. */
static uint32_t smartcard_emvsim_GetInstance(EMVSIM_Type *base) | {
uint8_t instance = 0;
uint32_t emvsimArrayCount = (sizeof(s_emvsimBases) / sizeof(s_emvsimBases[0]));
for (instance = 0; instance < emvsimArrayCount; instance++)
{
if (s_emvsimBases[instance] == base)
{
break;
}
}
assert(instance < emvsimArrayCount);
return instance;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Both of these changes to the XDR layer would in fact be quite minor, but I decided to leave them for a subsequent patch. */ | static int _nfs4_proc_readlink(struct inode *inode, struct page *page, unsigned int pgbase, unsigned int pglen) | /* Both of these changes to the XDR layer would in fact be quite minor, but I decided to leave them for a subsequent patch. */
static int _nfs4_proc_readlink(struct inode *inode, struct page *page, unsigned int pgbase, unsigned int pglen) | {
struct nfs4_readlink args = {
.fh = NFS_FH(inode),
.pgbase = pgbase,
.pglen = pglen,
.pages = &page,
};
struct nfs4_readlink_res res;
struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READLINK],
.rpc_argp = &args,
.rpc_resp = &res,
};
return nfs4_call_sync(NFS_SERVER(inode), &msg, &args, &res, 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Parses the +CAOPEN command and gives back the connect semaphore. */ | MODEM_CMD_DEFINE(on_cmd_caopen) | /* Parses the +CAOPEN command and gives back the connect semaphore. */
MODEM_CMD_DEFINE(on_cmd_caopen) | {
int result = atoi(argv[1]);
LOG_INF("+CAOPEN: %d", result);
modem_cmd_handler_set_error(data, result);
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* bfin_bmdma_status - Read IDE DMA status @ap: Port associated with this ATA transaction. */ | static unsigned char bfin_bmdma_status(struct ata_port *ap) | /* bfin_bmdma_status - Read IDE DMA status @ap: Port associated with this ATA transaction. */
static unsigned char bfin_bmdma_status(struct ata_port *ap) | {
unsigned char host_stat = 0;
void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr;
unsigned short int_status = ATAPI_GET_INT_STATUS(base);
if (ATAPI_GET_STATUS(base) & (MULTI_XFER_ON|ULTRA_XFER_ON))
host_stat |= ATA_DMA_ACTIVE;
if (int_status & (MULTI_DONE_INT|UDMAIN_DONE_INT|UDMAOUT_DONE_INT|
ATAPI_DEV_INT))
host_stat |= ATA_DMA_INTR;
if (int_status & (MULTI_TERM_INT|UDMAIN_TERM_INT|UDMAOUT_TERM_INT))
host_stat |= ATA_DMA_ERR|ATA_DMA_INTR;
dev_dbg(ap->dev, "ATAPI: host_stat=0x%x\n", host_stat);
return host_stat;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Activate DMA auto-request cycle (used for memory-memory transfers).
Prior to activating the DMA cycle, the channel and descriptor to be used must have been properly configured. */ | void DMA_ActivateAuto(unsigned int channel, bool primary, void *dst, void *src, unsigned int nMinus1) | /* Activate DMA auto-request cycle (used for memory-memory transfers).
Prior to activating the DMA cycle, the channel and descriptor to be used must have been properly configured. */
void DMA_ActivateAuto(unsigned int channel, bool primary, void *dst, void *src, unsigned int nMinus1) | {
uint32_t chBit;
EFM_ASSERT(channel < DMA_CHAN_COUNT);
EFM_ASSERT(nMinus1 <= (_DMA_CTRL_N_MINUS_1_MASK >> _DMA_CTRL_N_MINUS_1_SHIFT));
DMA_Prepare(channel,
dmaCycleCtrlAuto,
primary,
false,
dst,
src,
nMinus1);
chBit = 1 << channel;
DMA->CHENS = chBit;
DMA->CHSWREQ = chBit;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Returns standard filter start address in message RAM */ | struct fdcan_standard_filter* fdcan_get_flssa_addr(uint32_t canport) | /* Returns standard filter start address in message RAM */
struct fdcan_standard_filter* fdcan_get_flssa_addr(uint32_t canport) | {
struct fdcan_standard_filter *lfssa = (struct fdcan_standard_filter *)
(CAN_MSG_BASE + FDCAN_LFSSA_OFFSET(canport));
return lfssa;
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* This function is used to config the block guard time param in 7816 mode. */ | void wm_sc_set_bgt(uint8_t bgt) | /* This function is used to config the block guard time param in 7816 mode. */
void wm_sc_set_bgt(uint8_t bgt) | {
uint32_t reg;
bgt = (bgt > 0x1f) ? 0x1F : bgt;
reg = tls_reg_read32(HR_UART2_LINE_CTRL);
reg &= ~(0x1f << 11);
reg |= (bgt << 11);
tls_reg_write32(HR_UART2_LINE_CTRL, reg);
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* This API sets the register access on MAG_IF, MAG_IF, MAG_IF in the sensor. This implies that the DATA registers are not updated with Mag values automatically. */ | uint16_t bma4_set_mag_manual_enable(uint8_t mag_manual, struct bma4_dev *dev) | /* This API sets the register access on MAG_IF, MAG_IF, MAG_IF in the sensor. This implies that the DATA registers are not updated with Mag values automatically. */
uint16_t bma4_set_mag_manual_enable(uint8_t mag_manual, struct bma4_dev *dev) | {
uint16_t rslt = 0;
uint8_t data = 0;
if (dev == NULL) {
rslt |= BMA4_E_NULL_PTR;
} else {
rslt |= bma4_read_regs(BMA4_AUX_IF_CONF_ADDR, &data, 1, dev);
dev->delay(BMA4_GEN_READ_WRITE_DELAY);
if (rslt == BMA4_OK) {
data = BMA4_SET_BITSLICE(data, BMA4_MAG_MANUAL_ENABLE, mag_manual);
rslt |= bma4_write_regs(BMA4_AUX_IF_CONF_ADDR, &data, 1, dev);
if (rslt == BMA4_OK)
dev->aux_config.manual_enable = (uint8_t)mag_manual;
} else {
dev->aux_config.manual_enable = 0;
}
}
return rslt;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* If 32-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ | UINT32 EFIAPI S3IoBitFieldRead32(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit) | /* If 32-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT32 EFIAPI S3IoBitFieldRead32(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit) | {
return InternalSaveIoWrite32ValueToBootScript (Port, IoBitFieldRead32 (Port, StartBit, EndBit));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* param base XRDC2 peripheral base address. param periph The peripheral to operate. param enable True to enable, false to disable. */ | void XRDC2_EnablePeriphExclAccessLock(XRDC2_Type *base, xrdc2_periph_t periph, bool enable) | /* param base XRDC2 peripheral base address. param periph The peripheral to operate. param enable True to enable, false to disable. */
void XRDC2_EnablePeriphExclAccessLock(XRDC2_Type *base, xrdc2_periph_t periph, bool enable) | {
uint32_t pac = XRDC2_GET_PAC((uint32_t)periph);
uint32_t pdac = XRDC2_GET_PDAC((uint32_t)periph);
if (enable)
{
base->PACI_PDACJ[pac][pdac].PAC_PDAC_W1 = XRDC2_EAL_UNLOCKED;
}
else
{
base->PACI_PDACJ[pac][pdac].PAC_PDAC_W1 = XRDC2_EAL_DISABLE_UNTIL_RESET;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* param base CRC peripheral address. param config CRC protocol configuration structure */ | void CRC_GetConfig(CRC_Type *base, crc_config_t *config) | /* param base CRC peripheral address. param config CRC protocol configuration structure */
void CRC_GetConfig(CRC_Type *base, crc_config_t *config) | {
uint32_t mode = base->MODE;
config->polynomial =
(crc_polynomial_t)(uint32_t)(((uint32_t)(mode & CRC_MODE_CRC_POLY_MASK)) >> CRC_MODE_CRC_POLY_SHIFT);
config->reverseIn = (bool)(mode & CRC_MODE_BIT_RVS_WR_MASK);
config->complementIn = (bool)(mode & CRC_MODE_CMPL_WR_MASK);
config->reverseOut = (bool)(mode & CRC_MODE_BIT_RVS_SUM_MASK);
config->complementOut = (bool)(mode & CRC_MODE_CMPL_SUM_MASK);
base->MODE = mode & ~((1U << CRC_MODE_BIT_RVS_SUM_SHIFT) | (1U << CRC_MODE_CMPL_SUM_SHIFT));
config->seed = base->SUM;
base->MODE = mode;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* adi_open() is a callback from the input open routine. */ | static int adi_open(struct input_dev *dev) | /* adi_open() is a callback from the input open routine. */
static int adi_open(struct input_dev *dev) | {
struct adi_port *port = input_get_drvdata(dev);
gameport_start_polling(port->gameport);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Functions for getting the pages from a list. */ | static void list_get_page(struct dpages *dp, struct page **p, unsigned long *len, unsigned *offset) | /* Functions for getting the pages from a list. */
static void list_get_page(struct dpages *dp, struct page **p, unsigned long *len, unsigned *offset) | {
unsigned o = dp->context_u;
struct page_list *pl = (struct page_list *) dp->context_ptr;
*p = pl->page;
*len = PAGE_SIZE - o;
*offset = o;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Disable speical ADC interrupt. This function can be used to disable ADC convert done interrupt. */ | void ADCIntDisable(unsigned long ulBase, unsigned long ulChs) | /* Disable speical ADC interrupt. This function can be used to disable ADC convert done interrupt. */
void ADCIntDisable(unsigned long ulBase, unsigned long ulChs) | {
unsigned long ulTmpReg = 0;
xASSERT(ulBase == ADC_BASE);
xASSERT( (ulChs & ~ADC_CH_M) == 0 );
ulTmpReg = xHWREG(ulBase + AD_INTEN);
ulTmpReg &= ~INTEN_GEN;
ulTmpReg &= ~ulChs;
xHWREG(ulBase + AD_INTEN) = ulTmpReg;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Returns: (transfer full): a new #GFile for the given @uri. Free the returned object with g_object_unref(). */ | GFile* g_file_new_for_uri(const char *uri) | /* Returns: (transfer full): a new #GFile for the given @uri. Free the returned object with g_object_unref(). */
GFile* g_file_new_for_uri(const char *uri) | {
g_return_val_if_fail (uri != NULL, NULL);
return g_vfs_get_file_for_uri (g_vfs_get_default (), uri);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns: (transfer full): the user data for @res. */ | gpointer g_async_result_get_user_data(GAsyncResult *res) | /* Returns: (transfer full): the user data for @res. */
gpointer g_async_result_get_user_data(GAsyncResult *res) | {
GAsyncResultIface *iface;
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), NULL);
iface = G_ASYNC_RESULT_GET_IFACE (res);
return (* iface->get_user_data) (res);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* We don't check here for the merged mmap wrapping around the end of pagecache indices (16TB on ia32) because do_mmap_pgoff() does not permit mmap's which wrap, nor mmaps which cover the final page at index -1UL. */ | static int can_vma_merge_before(struct vm_area_struct *vma, unsigned long vm_flags, struct anon_vma *anon_vma, struct file *file, pgoff_t vm_pgoff) | /* We don't check here for the merged mmap wrapping around the end of pagecache indices (16TB on ia32) because do_mmap_pgoff() does not permit mmap's which wrap, nor mmaps which cover the final page at index -1UL. */
static int can_vma_merge_before(struct vm_area_struct *vma, unsigned long vm_flags, struct anon_vma *anon_vma, struct file *file, pgoff_t vm_pgoff) | {
if (is_mergeable_vma(vma, file, vm_flags) &&
is_mergeable_anon_vma(anon_vma, vma->anon_vma)) {
if (vma->vm_pgoff == vm_pgoff)
return 1;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base SAI base pointer. param handle SAI eDMA handle pointer. */ | void SAI_TransferTerminateSend(I2S_Type *base, sai_handle_t *handle) | /* param base SAI base pointer. param handle SAI eDMA handle pointer. */
void SAI_TransferTerminateSend(I2S_Type *base, sai_handle_t *handle) | {
assert(handle != NULL);
SAI_TransferAbortSend(base, handle);
(void)memset(handle->saiQueue, 0, sizeof(handle->saiQueue));
(void)memset(handle->transferSize, 0, sizeof(handle->transferSize));
handle->queueUser = 0U;
handle->queueDriver = 0U;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Get the captured data for the ADC sample channel. */ | unsigned long ADCDataGet(unsigned long ulBase, unsigned long ulChannel) | /* Get the captured data for the ADC sample channel. */
unsigned long ADCDataGet(unsigned long ulBase, unsigned long ulChannel) | {
unsigned long ulData;
unsigned long ulCRReg;
xASSERT(ulBase == ADC_BASE);
xASSERT((ulChannel >= 0) && (ulChannel < 8));
ulData = xHWREG(ulBase + ADC_DR0 + (ulChannel * 4));
ulCRReg = xHWREG(ulBase + ADC_CR);
if(ulCRReg & ADC_CR_DIFFEN)
{
if(ulCRReg & ADC_CR_DMOF)
{
if (ulData & 0x8000)
{
return (ulData | 0xFFFF0000);
}
else
{
return (ulData & 0xFFF);
}
}
else
{
return (ulData & 0xFFF);
}
}
else
{
return (ulData & 0xFFF);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Returns a VME-encoded number, usually used to indicate the bit length of an SIR/SDR command. */ | long int ispVMDataSize(void) | /* Returns a VME-encoded number, usually used to indicate the bit length of an SIR/SDR command. */
long int ispVMDataSize(void) | {
long int iSize = 0;
signed char cCurrentByte = 0;
signed char cIndex = 0;
cIndex = 0;
while ((cCurrentByte = GetByte()) & 0x80) {
iSize |= ((long int) (cCurrentByte & 0x7F)) << cIndex;
cIndex += 7;
}
iSize |= ((long int) (cCurrentByte & 0x7F)) << cIndex;
return iSize;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Write out inode metadata (attributes) for the whole filesystem. */ | int xfs_sync_attr(struct xfs_mount *mp, int flags) | /* Write out inode metadata (attributes) for the whole filesystem. */
int xfs_sync_attr(struct xfs_mount *mp, int flags) | {
ASSERT((flags & ~SYNC_WAIT) == 0);
return xfs_inode_ag_iterator(mp, xfs_sync_inode_attr, flags,
XFS_ICI_NO_TAG, 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is called in the allocator slow-path if the allocation request is of sufficient urgency to ignore watermarks and take other desperate measures */ | static struct page* __alloc_pages_high_priority(gfp_t gfp_mask, unsigned int order, struct zonelist *zonelist, enum zone_type high_zoneidx, nodemask_t *nodemask, struct zone *preferred_zone, int migratetype) | /* This is called in the allocator slow-path if the allocation request is of sufficient urgency to ignore watermarks and take other desperate measures */
static struct page* __alloc_pages_high_priority(gfp_t gfp_mask, unsigned int order, struct zonelist *zonelist, enum zone_type high_zoneidx, nodemask_t *nodemask, struct zone *preferred_zone, int migratetype) | {
struct page *page;
do {
page = get_page_from_freelist(gfp_mask, nodemask, order,
zonelist, high_zoneidx, ALLOC_NO_WATERMARKS,
preferred_zone, migratetype);
if (!page && gfp_mask & __GFP_NOFAIL)
congestion_wait(BLK_RW_ASYNC, HZ/50);
} while (!page && (gfp_mask & __GFP_NOFAIL));
return page;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Reads the device exclusion range from ACPI and initialize IOMMU with it */ | static void __init set_device_exclusion_range(u16 devid, struct ivmd_header *m) | /* Reads the device exclusion range from ACPI and initialize IOMMU with it */
static void __init set_device_exclusion_range(u16 devid, struct ivmd_header *m) | {
struct amd_iommu *iommu = amd_iommu_rlookup_table[devid];
if (!(m->flags & IVMD_FLAG_EXCL_RANGE))
return;
if (iommu) {
set_dev_entry_bit(m->devid, DEV_ENTRY_EX);
iommu->exclusion_start = m->range_start;
iommu->exclusion_length = m->range_length;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function swaps the bytes in a 16-bit unsigned value to switch the value from little endian to big endian or vice versa. The byte swapped value is returned. */ | UINT16 EFIAPI SwapBytes16(IN UINT16 Value) | /* This function swaps the bytes in a 16-bit unsigned value to switch the value from little endian to big endian or vice versa. The byte swapped value is returned. */
UINT16 EFIAPI SwapBytes16(IN UINT16 Value) | {
return (UINT16)((Value<< 8) | (Value>> 8));
} | tianocore/edk2 | C++ | Other | 4,240 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.