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 |
|---|---|---|---|---|---|---|---|
/* If Buffer is not aligned on a 32-bit boundary, then ASSERT(). */ | UINT32* EFIAPI S3MmioWriteBuffer32(IN UINTN StartAddress, IN UINTN Length, IN CONST UINT32 *Buffer) | /* If Buffer is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32* EFIAPI S3MmioWriteBuffer32(IN UINTN StartAddress, IN UINTN Length, IN CONST UINT32 *Buffer) | {
UINT32 *ReturnBuffer;
RETURN_STATUS Status;
ReturnBuffer = MmioWriteBuffer32 (StartAddress, Length, Buffer);
Status = S3BootScriptSaveMemWrite (
S3BootScriptWidthUint32,
StartAddress,
Length / sizeof (UINT32),
ReturnBuffer
);
ASSERT (Status == RETURN_SUCCESS);
return ReturnBuffer;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* igb_get_hw_control sets CTRL_EXT:DRV_LOAD bit. For ASF and Pass Through versions of f/w this means that the driver is loaded. */ | static void igb_get_hw_control(struct igb_adapter *adapter) | /* igb_get_hw_control sets CTRL_EXT:DRV_LOAD bit. For ASF and Pass Through versions of f/w this means that the driver is loaded. */
static void igb_get_hw_control(struct igb_adapter *adapter) | {
struct e1000_hw *hw = &adapter->hw;
u32 ctrl_ext;
ctrl_ext = rd32(E1000_CTRL_EXT);
wr32(E1000_CTRL_EXT,
ctrl_ext | E1000_CTRL_EXT_DRV_LOAD);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks whether the specified RTC flag is set or not. */ | FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG) | /* Checks whether the specified RTC flag is set or not. */
FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG) | {
FlagStatus bitstatus = RESET;
assert_param(IS_RTC_GET_FLAG(RTC_FLAG));
if ((RTC->CRL & RTC_FLAG) != (uint16_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Reset the timer by placing the timer back into it's default reset configuration. */ | void TimerReset(void) | /* Reset the timer by placing the timer back into it's default reset configuration. */
void TimerReset(void) | {
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* setup_per_zone_lowmem_reserve - called whenever sysctl_lower_zone_reserve_ratio changes. Ensures that each zone has a correct pages reserved value, so an adequate number of pages are left in the zone after a successful __alloc_pages(). */ | static void setup_per_zone_lowmem_reserve(void) | /* setup_per_zone_lowmem_reserve - called whenever sysctl_lower_zone_reserve_ratio changes. Ensures that each zone has a correct pages reserved value, so an adequate number of pages are left in the zone after a successful __alloc_pages(). */
static void setup_per_zone_lowmem_reserve(void) | {
struct pglist_data *pgdat;
enum zone_type j, idx;
for_each_online_pgdat(pgdat) {
for (j = 0; j < MAX_NR_ZONES; j++) {
struct zone *zone = pgdat->node_zones + j;
unsigned long present_pages = zone->present_pages;
zone->lowmem_reserve[j] = 0;
idx = j;
while (idx) {
struct zone *lower_zone;
idx--;
if (sysctl_lowmem_reserve_ratio[idx] < 1)
sysctl_lowmem_reserve_ratio[idx] = 1;
lower_zone = pgdat->node_zones + idx;
lower_zone->lowmem_reserve[j] = present_pages /
sysctl_lowmem_reserve_ratio[idx];
present_pages += lower_zone->present_pages;
}
}
}
calculate_totalreserve_pages();
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Converts a text device path node to Vendor defined UTF8 device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVenUtf8(CHAR16 *TextDeviceNode) | /* Converts a text device path node to Vendor defined UTF8 device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVenUtf8(CHAR16 *TextDeviceNode) | {
VENDOR_DEVICE_PATH *Vendor;
Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_VENDOR_DP,
(UINT16) sizeof (VENDOR_DEVICE_PATH));
CopyGuid (&Vendor->Guid, &gEfiVTUTF8Guid);
return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The function fills the exchange data for the AP. */ | VOID FillExchangeInfoDataSevEs(IN volatile MP_CPU_EXCHANGE_INFO *ExchangeInfo) | /* The function fills the exchange data for the AP. */
VOID FillExchangeInfoDataSevEs(IN volatile MP_CPU_EXCHANGE_INFO *ExchangeInfo) | {
UINT32 StdRangeMax;
AsmCpuid (CPUID_SIGNATURE, &StdRangeMax, NULL, NULL, NULL);
if (StdRangeMax >= CPUID_EXTENDED_TOPOLOGY) {
CPUID_EXTENDED_TOPOLOGY_EBX ExtTopoEbx;
AsmCpuidEx (
CPUID_EXTENDED_TOPOLOGY,
0,
NULL,
&ExtTopoEbx.Uint32,
NULL,
NULL
);
ExchangeInfo->ExtTopoAvail = !!ExtTopoEbx.Bits.LogicalProcessors;
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Support for External interrupts on the Pb1200 Development platform. */ | static void pb1200_cascade_handler(unsigned int irq, struct irq_desc *d) | /* Support for External interrupts on the Pb1200 Development platform. */
static void pb1200_cascade_handler(unsigned int irq, struct irq_desc *d) | {
unsigned short bisr = bcsr->int_status;
for ( ; bisr; bisr &= bisr - 1)
generic_handle_irq(PB1200_INT_BEGIN + __ffs(bisr));
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Convenience functions to obtain memory types and attributes */ | u32 efi_mem_type(unsigned long phys_addr) | /* Convenience functions to obtain memory types and attributes */
u32 efi_mem_type(unsigned long phys_addr) | {
efi_memory_desc_t *md;
void *p;
for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
md = p;
if ((md->phys_addr <= phys_addr) &&
(phys_addr < (md->phys_addr +
(md->num_pages << EFI_PAGE_SHIFT))))
return md->type;
}
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function should be called after wake up from STOP/VLPS/LLS/VLLS modes. It is used with ref SMC_PreEnterStopModes. */ | void SMC_PostExitStopModes(void) | /* This function should be called after wake up from STOP/VLPS/LLS/VLLS modes. It is used with ref SMC_PreEnterStopModes. */
void SMC_PostExitStopModes(void) | {
EnableGlobalIRQ(g_savedPrimask);
__ISB();
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Get the PWM interrupt flag of the PWM module.
The */ | xtBoolean PWMIntFlagGet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType) | /* Get the PWM interrupt flag of the PWM module.
The */
xtBoolean PWMIntFlagGet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType) | {
unsigned long ulChannelTemp;
ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4);
xASSERT(ulBase == PWMA_BASE);
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3)));
if (ulIntType == PWM_INT_PWM)
{
return ((xHWREG(ulBase + PWM_PIIR) & (PWM_PIIR_PWMIF0 << ulChannelTemp))
? xtrue : xfalse);
}
else if (ulIntType == PWM_INT_DUTY)
{
return ((xHWREG(ulBase + PWM_PIIR) & (PWM_PIIR_PWMDIF0 << ulChannelTemp))
? xtrue : xfalse);
}
else
{
return ((xHWREG(ulBase + PWM_CCR0 + (ulChannelTemp << 1)) &
(PWM_CCR0_CAPIF0 << ((ulChannel % 2) ? 16 : 0))) ? xtrue : xfalse);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This function queues a completion wait command into the command buffer of an IOMMU */ | static int __iommu_completion_wait(struct amd_iommu *iommu) | /* This function queues a completion wait command into the command buffer of an IOMMU */
static int __iommu_completion_wait(struct amd_iommu *iommu) | {
struct iommu_cmd cmd;
memset(&cmd, 0, sizeof(cmd));
cmd.data[0] = CMD_COMPL_WAIT_INT_MASK;
CMD_SET_TYPE(&cmd, CMD_COMPL_WAIT);
return __iommu_queue_command(iommu, &cmd);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function configures the system to enter Standby mode for current consumption measurement purpose. */ | void StandbyMode_Measure(void) | /* This function configures the system to enter Standby mode for current consumption measurement purpose. */
void StandbyMode_Measure(void) | {
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWR_EnableBkUpAccess();
__HAL_RCC_BACKUPRESET_FORCE();
__HAL_RCC_BACKUPRESET_RELEASE();
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);
HAL_PWR_EnterSTANDBYMode();
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* param tcd A point to the TCD structure. param config A pointer to the minor offset configuration structure. */ | void EDMA_TcdSetMinorOffsetConfig(edma_tcd_t *tcd, const edma_minor_offset_config_t *config) | /* param tcd A point to the TCD structure. param config A pointer to the minor offset configuration structure. */
void EDMA_TcdSetMinorOffsetConfig(edma_tcd_t *tcd, const edma_minor_offset_config_t *config) | {
assert(tcd != NULL);
assert(((uint32_t)tcd & 0x1FU) == 0U);
uint32_t tmpreg;
tmpreg = tcd->NBYTES &
~(DMA_NBYTES_MLOFFYES_SMLOE_MASK | DMA_NBYTES_MLOFFYES_DMLOE_MASK | DMA_NBYTES_MLOFFYES_MLOFF_MASK);
tmpreg |=
(DMA_NBYTES_MLOFFYES_SMLOE(config->enableSrcMinorOffset) |
DMA_NBYTES_MLOFFYES_DMLOE(config->enableDestMinorOffset) | DMA_NBYTES_MLOFFYES_MLOFF(config->minorOffset));
tcd->NBYTES = tmpreg;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* This is used to install ACPI Firmware Performance Data Table for basic boot records. */ | VOID EFIAPI FpdtEndOfDxeEventNotify(IN EFI_EVENT Event, IN VOID *Context) | /* This is used to install ACPI Firmware Performance Data Table for basic boot records. */
VOID EFIAPI FpdtEndOfDxeEventNotify(IN EFI_EVENT Event, IN VOID *Context) | {
if ((PcdGet8 (PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0) {
return;
}
ASSERT (mReceivedAcpiBootPerformanceTable == NULL);
InstallFirmwarePerformanceDataTable ();
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Read sensor data.
This routine calls the appropriate internal data function to obtain the specified type of data from the sensor device. */ | static bool kxtf9_read(sensor_t *sensor, sensor_read_t type, sensor_data_t *data) | /* Read sensor data.
This routine calls the appropriate internal data function to obtain the specified type of data from the sensor device. */
static bool kxtf9_read(sensor_t *sensor, sensor_read_t type, sensor_data_t *data) | {
sensor_hal_t *const hal = sensor->hal;
switch (type) {
case SENSOR_READ_ACCELERATION:
return kxtf9_get_accel(hal, data);
case SENSOR_READ_ID:
return kxtf9_device_id(hal, data);
default:
sensor->err = SENSOR_ERR_FUNCTION;
return false;
}
} | memfault/zero-to-main | C++ | null | 200 |
/* Add 64 bit integer attribute to netlink message. */ | int nla_put_u64(struct nl_msg *msg, int attrtype, uint64_t value) | /* Add 64 bit integer attribute to netlink message. */
int nla_put_u64(struct nl_msg *msg, int attrtype, uint64_t value) | {
return nla_put(msg, attrtype, sizeof(uint64_t), &value);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function returns LEB properties for a freeable index LEB or NULL if the function is unable to find a freeable index LEB quickly. */ | const struct ubifs_lprops* ubifs_fast_find_frdi_idx(struct ubifs_info *c) | /* This function returns LEB properties for a freeable index LEB or NULL if the function is unable to find a freeable index LEB quickly. */
const struct ubifs_lprops* ubifs_fast_find_frdi_idx(struct ubifs_info *c) | {
struct ubifs_lprops *lprops;
ubifs_assert(mutex_is_locked(&c->lp_mutex));
if (list_empty(&c->frdi_idx_list))
return NULL;
lprops = list_entry(c->frdi_idx_list.next, struct ubifs_lprops, list);
ubifs_assert(!(lprops->flags & LPROPS_TAKEN));
ubifs_assert((lprops->flags & LPROPS_INDEX));
ubifs_assert(lprops->free + lprops->dirty == c->leb_size);
return lprops;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* unix_bind() Returns a unix socket bound to the given path */ | int unix_bind(char *) | /* unix_bind() Returns a unix socket bound to the given path */
int unix_bind(char *) | {
struct sockaddr_un sun;
int s;
if ((s = socket(AF_UNIX, uflag ? SOCK_DGRAM : SOCK_STREAM,
0)) < 0)
return (-1);
memset(&sun, 0, sizeof(struct sockaddr_un));
sun.sun_family = AF_UNIX;
if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >=
sizeof(sun.sun_path)) {
close(s);
errno = ENAMETOOLONG;
return (-1);
}
if (bind(s, (struct sockaddr *)&sun, SUN_LEN(&sun)) < 0) {
close(s);
return (-1);
}
return (s);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Get the handle number for the calling processor. */ | EFI_STATUS MpServicesUnitTestWhoAmI(IN MP_SERVICES MpServices, OUT UINTN *ProcessorNumber) | /* Get the handle number for the calling processor. */
EFI_STATUS MpServicesUnitTestWhoAmI(IN MP_SERVICES MpServices, OUT UINTN *ProcessorNumber) | {
return MpServices.Ppi->WhoAmI (MpServices.Ppi, ProcessorNumber);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Read one byte out of the RX buffer. This function will return the byte located at the array index of the read pointer, and then increment the read pointer index. If the read pointer exceeds the maximum buffer size, it will roll over to zero. */ | uint8_t cdcBufferRead() | /* Read one byte out of the RX buffer. This function will return the byte located at the array index of the read pointer, and then increment the read pointer index. If the read pointer exceeds the maximum buffer size, it will roll over to zero. */
uint8_t cdcBufferRead() | {
uint8_t data;
data = cdcfifo.buf[cdcfifo.rd_ptr];
cdcfifo.rd_ptr = (cdcfifo.rd_ptr + 1) % CFG_USBCDC_BUFFERSIZE;
cdcfifo.len--;
return data;
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* change the DFS bit according rate for Delta1010 */ | static void delta_1010_set_rate_val(struct snd_ice1712 *ice, unsigned int rate) | /* change the DFS bit according rate for Delta1010 */
static void delta_1010_set_rate_val(struct snd_ice1712 *ice, unsigned int rate) | {
unsigned char tmp, tmp2;
if (rate == 0)
return;
mutex_lock(&ice->gpio_mutex);
tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
tmp2 = tmp & ~ICE1712_DELTA_DFS;
if (rate > 48000)
tmp2 |= ICE1712_DELTA_DFS;
if (tmp != tmp2)
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp2);
mutex_unlock(&ice->gpio_mutex);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Ok, this is hosed by design. It's necessary to know what machine the NIC is in in order to know how to read the NIC address. We also have to know if it's a PCI card or a NIC in on the node board ... */ | static void ioc3_get_eaddr(struct ioc3_private *ip) | /* Ok, this is hosed by design. It's necessary to know what machine the NIC is in in order to know how to read the NIC address. We also have to know if it's a PCI card or a NIC in on the node board ... */
static void ioc3_get_eaddr(struct ioc3_private *ip) | {
ioc3_get_eaddr_nic(ip);
printk("Ethernet address is %pM.\n", priv_netdev(ip)->dev_addr);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Gets the direction and mode of a pin. */ | unsigned long GPIODirModeGet(unsigned long ulPort, unsigned long ulBit) | /* Gets the direction and mode of a pin. */
unsigned long GPIODirModeGet(unsigned long ulPort, unsigned long ulBit) | {
xASSERT(GPIOBaseValid(ulPort));
xASSERT(ulBit < 16);
return((xHWREG(ulPort + GPIO_PMD) & (3 << (ulBit * 2))) >> (ulBit * 2));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* param base SPC peripheral base address. return Current isolation status for each power domains. */ | uint8_t SPC_GetPeriphIOIsolationStatus(SPC_Type *base) | /* param base SPC peripheral base address. return Current isolation status for each power domains. */
uint8_t SPC_GetPeriphIOIsolationStatus(SPC_Type *base) | {
uint32_t reg;
reg = base->SC;
return (uint8_t)((reg & SPC_SC_ISO_CLR_MASK) >> SPC_SC_ISO_CLR_SHIFT);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns true for the channel numbers used without all_channels modparam. */ | static bool ath5k_is_standard_channel(short chan) | /* Returns true for the channel numbers used without all_channels modparam. */
static bool ath5k_is_standard_channel(short chan) | {
return ((chan <= 14) ||
((chan & 3) == 0 && chan >= 36 && chan <= 64) ||
((chan & 3) == 0 && chan >= 100 && chan <= 140) ||
((chan & 3) == 1 && chan >= 149 && chan <= 165));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* LOCKING: host lock, or some other form of serialization. */ | void ata_port_probe(struct ata_port *ap) | /* LOCKING: host lock, or some other form of serialization. */
void ata_port_probe(struct ata_port *ap) | {
ap->flags &= ~ATA_FLAG_DISABLED;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Description: Write a CIPSO header into the beginning of @buffer. */ | static void cipso_v4_gentag_hdr(const struct cipso_v4_doi *doi_def, unsigned char *buf, u32 len) | /* Description: Write a CIPSO header into the beginning of @buffer. */
static void cipso_v4_gentag_hdr(const struct cipso_v4_doi *doi_def, unsigned char *buf, u32 len) | {
buf[0] = IPOPT_CIPSO;
buf[1] = CIPSO_V4_HDR_LEN + len;
*(__be32 *)&buf[2] = htonl(doi_def->doi);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* fill the length and offset of each urb descriptor. the fixed 10.14 frequency is passed through the pipe. */ | static int prepare_capture_sync_urb(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *urb) | /* fill the length and offset of each urb descriptor. the fixed 10.14 frequency is passed through the pipe. */
static int prepare_capture_sync_urb(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *urb) | {
unsigned char *cp = urb->transfer_buffer;
struct snd_urb_ctx *ctx = urb->context;
urb->dev = ctx->subs->dev;
urb->iso_frame_desc[0].length = 3;
urb->iso_frame_desc[0].offset = 0;
cp[0] = subs->freqn >> 2;
cp[1] = subs->freqn >> 10;
cp[2] = subs->freqn >> 18;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Create vme slave window (access: vme -> gcsr) */ | int tsi148_vme_gcsr_window(unsigned int vmeAddr, int vam) | /* Create vme slave window (access: vme -> gcsr) */
int tsi148_vme_gcsr_window(unsigned int vmeAddr, int vam) | {
int result;
unsigned int ctl;
result = 0;
if (NULL == dev) {
result = 1;
} else {
__raw_writel(htonl(vmeAddr), &dev->uregs->gbal);
__raw_writel(0x00000000, &dev->uregs->gbau);
ctl = tsi148_eval_vam(vam);
ctl |= 0x00000080;
__raw_writel(htonl(ctl), &dev->uregs->gcsrat);
}
return result;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Sets the UPLL monitor mode.
This function sets the UPLL monitor mode. The mode can be disabled, it can generate an interrupt when the error is disabled, or reset when the error is detected. */ | void CLOCK_SetUpllMonitorMode(scg_upll_monitor_mode_t mode) | /* Sets the UPLL monitor mode.
This function sets the UPLL monitor mode. The mode can be disabled, it can generate an interrupt when the error is disabled, or reset when the error is detected. */
void CLOCK_SetUpllMonitorMode(scg_upll_monitor_mode_t mode) | {
uint32_t reg = SCG0->UPLLCSR;
reg &= ~(SCG_UPLLCSR_UPLLCM_MASK | SCG_UPLLCSR_UPLLCMRE_MASK);
reg |= (uint32_t)mode;
SCG0->UPLLCSR = reg;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Clear pending interrupt vector.
Clear a pending interrupt vector, so the software handler is not executed. */ | enum status_code system_interrupt_clear_pending(const enum system_interrupt_vector vector) | /* Clear pending interrupt vector.
Clear a pending interrupt vector, so the software handler is not executed. */
enum status_code system_interrupt_clear_pending(const enum system_interrupt_vector vector) | {
enum status_code status = STATUS_OK;
if (vector >= _SYSTEM_INTERRUPT_EXTERNAL_VECTOR_START) {
NVIC->ICPR[0] = (1 << vector);
} else if (vector == SYSTEM_INTERRUPT_NON_MASKABLE) {
return STATUS_ERR_INVALID_ARG;
} else if (vector == SYSTEM_INTERRUPT_SYSTICK) {
SCB->ICSR = SCB_ICSR_PENDSTCLR_Msk;
} else {
Assert(false);
status = STATUS_ERR_INVALID_ARG;
}
return status;
} | memfault/zero-to-main | C++ | null | 200 |
/* Return value: 1 - work queued for execution 0 - work is already queued -EINVAL - work queue doesn't exist */ | int scsi_queue_work(struct Scsi_Host *shost, struct work_struct *work) | /* Return value: 1 - work queued for execution 0 - work is already queued -EINVAL - work queue doesn't exist */
int scsi_queue_work(struct Scsi_Host *shost, struct work_struct *work) | {
if (unlikely(!shost->work_q)) {
printk(KERN_ERR
"ERROR: Scsi host '%s' attempted to queue scsi-work, "
"when no workqueue created.\n", shost->hostt->name);
dump_stack();
return -EINVAL;
}
return queue_work(shost->work_q, work);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* omap_pm_enter - Actually enter a sleep state. @state: State we're entering. */ | static int omap_pm_enter(suspend_state_t state) | /* omap_pm_enter - Actually enter a sleep state. @state: State we're entering. */
static int omap_pm_enter(suspend_state_t state) | {
switch (state)
{
case PM_SUSPEND_STANDBY:
case PM_SUSPEND_MEM:
omap1_pm_suspend();
break;
default:
return -EINVAL;
}
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Parse parameters stored in dasd The 'dasd=...' parameter allows to specify a comma separated list of keywords and device ranges. When the dasd driver is build into the kernel, the complete list will be stored as one element of the dasd array. When the dasd driver is build as a module, then the list is broken into it's elements and each dasd entry contains one element. */ | int dasd_parse(void) | /* Parse parameters stored in dasd The 'dasd=...' parameter allows to specify a comma separated list of keywords and device ranges. When the dasd driver is build into the kernel, the complete list will be stored as one element of the dasd array. When the dasd driver is build as a module, then the list is broken into it's elements and each dasd entry contains one element. */
int dasd_parse(void) | {
int rc, i;
char *parsestring;
rc = 0;
for (i = 0; i < 256; i++) {
if (dasd[i] == NULL)
break;
parsestring = dasd[i];
while (*parsestring) {
parsestring = dasd_parse_next_element(parsestring);
if(IS_ERR(parsestring)) {
rc = PTR_ERR(parsestring);
break;
}
}
if (rc) {
DBF_EVENT(DBF_ALERT, "%s", "invalid range found");
break;
}
}
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables gyroscope digital LPF1 if auxiliary SPI is disabled; the bandwidth can be selected through FTYPE in CTRL6_C (15h).. */ | int32_t lsm6dso_gy_filter_lp1_get(lsm6dso_ctx_t *ctx, uint8_t *val) | /* Enables gyroscope digital LPF1 if auxiliary SPI is disabled; the bandwidth can be selected through FTYPE in CTRL6_C (15h).. */
int32_t lsm6dso_gy_filter_lp1_get(lsm6dso_ctx_t *ctx, uint8_t *val) | {
lsm6dso_ctrl4_c_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL4_C, (uint8_t*)®, 1);
*val = reg.lpf1_sel_g;
return ret;
} | alexander-g-dean/ESF | C++ | null | 41 |
/* Reads and returns the current value of DR3. This function is only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on X64. */ | UINTN EFIAPI AsmReadDr3(VOID) | /* Reads and returns the current value of DR3. This function is only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on X64. */
UINTN EFIAPI AsmReadDr3(VOID) | {
UINTN Data;
__asm__ __volatile__ (
"mov %%dr3, %0"
: "=r" (Data)
);
return Data;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Notify the application about changes to the BC1.2 partner. */ | static void pi3usb9201_update_charging_partner(const struct device *dev, struct bc12_partner_state *const state) | /* Notify the application about changes to the BC1.2 partner. */
static void pi3usb9201_update_charging_partner(const struct device *dev, struct bc12_partner_state *const state) | {
struct pi3usb9201_data *pi3usb9201_data = dev->data;
if (!pi3usb9201_partner_has_changed(dev, state)) {
return;
}
if (state) {
pi3usb9201_data->partner_state = *state;
pi3usb9201_notify_callback(dev, state);
} else {
pi3usb9201_data->partner_state.bc12_role = BC12_DISCONNECTED;
pi3usb9201_notify_callback(dev, NULL);
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* __device_refresh_sync - request a synchronous refresh from the accelerometer. We wait for the refresh to complete. Returns zero if successful and nonzero on error. Callers must hold hdaps_mtx. */ | static int __device_refresh_sync(void) | /* __device_refresh_sync - request a synchronous refresh from the accelerometer. We wait for the refresh to complete. Returns zero if successful and nonzero on error. Callers must hold hdaps_mtx. */
static int __device_refresh_sync(void) | {
__device_refresh();
return __wait_latch(0x1604, STATE_FRESH);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* lpfc_bsg_hst_vendor - process a vendor-specific fc_bsg_job @job: fc_bsg_job to handle */ | static int lpfc_bsg_hst_vendor(struct fc_bsg_job *job) | /* lpfc_bsg_hst_vendor - process a vendor-specific fc_bsg_job @job: fc_bsg_job to handle */
static int lpfc_bsg_hst_vendor(struct fc_bsg_job *job) | {
int command = job->request->rqst_data.h_vendor.vendor_cmd[0];
switch (command) {
case LPFC_BSG_VENDOR_SET_CT_EVENT:
return lpfc_bsg_set_event(job);
break;
case LPFC_BSG_VENDOR_GET_CT_EVENT:
return lpfc_bsg_get_event(job);
break;
default:
return -EINVAL;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* General Purpose Input/Outputs Set a Group of Pins Atomic.
Set one or more pins of the given GPIO port to 1 in an atomic operation. */ | void gpio_set(uint32_t gpioport, uint8_t gpios) | /* General Purpose Input/Outputs Set a Group of Pins Atomic.
Set one or more pins of the given GPIO port to 1 in an atomic operation. */
void gpio_set(uint32_t gpioport, uint8_t gpios) | {
GPIO_DATA(gpioport)[gpios] = 0xFF;
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* Configure RTC in calendar mode.
This function configures the RTC in calendar mode with alarm enabled */ | void configure_rtc_calendar(void) | /* Configure RTC in calendar mode.
This function configures the RTC in calendar mode with alarm enabled */
void configure_rtc_calendar(void) | {
struct rtc_calendar_config config_rtc_calendar;
rtc_calendar_get_config_defaults(&config_rtc_calendar);
config_rtc_calendar.clock_24h = false;
config_rtc_calendar.alarm[0].time = alarm.time;
config_rtc_calendar.alarm[0].mask = RTC_CALENDAR_ALARM_MASK_YEAR;
rtc_calendar_init(&rtc_instance, RTC, &config_rtc_calendar);
rtc_calendar_enable(&rtc_instance);
} | memfault/zero-to-main | C++ | null | 200 |
/* This function reads light by ap3216c sensor measurement */ | uint16_t ap3216c_read_ambient_light(void) | /* This function reads light by ap3216c sensor measurement */
uint16_t ap3216c_read_ambient_light(void) | {
uint16_t brightness = 0;
uint16_t read_data;
uint8_t range;
read_data = (uint16_t)read_low_and_high(AP3216C_ALS_DATA_L_REG, 1);
ap3216c_get_param(AP3216C_ALS_RANGE, &range);
if (range == AP3216C_ALS_RANGE_20661) {
brightness =
0.35 * read_data;
} else if (range == AP3216C_ALS_RANGE_5162) {
brightness =
0.0788 * read_data;
} else if (range == AP3216C_ALS_RANGE_1291) {
brightness =
0.0197 * read_data;
} else if (range == AP3216C_ALS_RANGE_323) {
brightness =
0.0049 * read_data;
}
return brightness;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Function for the Timer initialization.
Initializes the timer module. This creates and starts application timers. */ | static void timers_init(void) | /* Function for the Timer initialization.
Initializes the timer module. This creates and starts application timers. */
static void timers_init(void) | {
uint32_t err_code;
APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
err_code = app_timer_create(&m_battery_timer_id,
APP_TIMER_MODE_REPEATED,
battery_level_meas_timeout_handler);
APP_ERROR_CHECK(err_code);
err_code = app_timer_create(&m_heart_rate_timer_id,
APP_TIMER_MODE_REPEATED,
heart_rate_meas_timeout_handler);
APP_ERROR_CHECK(err_code);
err_code = app_timer_create(&m_rr_interval_timer_id,
APP_TIMER_MODE_REPEATED,
rr_interval_timeout_handler);
APP_ERROR_CHECK(err_code);
err_code = app_timer_create(&m_sensor_contact_timer_id,
APP_TIMER_MODE_REPEATED,
sensor_contact_detected_timeout_handler);
APP_ERROR_CHECK(err_code);
} | labapart/polymcu | C++ | null | 201 |
/* Internal function to add PciCfg2 write opcode to the table. */ | EFI_STATUS BootScriptWritePciCfg2Write(IN VA_LIST Marker) | /* Internal function to add PciCfg2 write opcode to the table. */
EFI_STATUS BootScriptWritePciCfg2Write(IN VA_LIST Marker) | {
S3_BOOT_SCRIPT_LIB_WIDTH Width;
UINT64 Address;
UINTN Count;
UINT8 *Buffer;
UINT16 Segment;
Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
Segment = VA_ARG (Marker, UINT16);
Address = VA_ARG (Marker, UINT64);
Count = VA_ARG (Marker, UINTN);
Buffer = VA_ARG (Marker, UINT8 *);
return S3BootScriptSavePciCfg2Write (Width, Segment, Address, Count, Buffer);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* returns SUCCESS if it successfully received a message notification and copied it into the receive buffer. */ | static s32 e1000_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size) | /* returns SUCCESS if it successfully received a message notification and copied it into the receive buffer. */
static s32 e1000_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size) | {
struct e1000_mbx_info *mbx = &hw->mbx;
s32 ret_val = -E1000_ERR_MBX;
if (!mbx->ops.read)
goto out;
ret_val = e1000_poll_for_msg(hw);
if (!ret_val)
ret_val = mbx->ops.read(hw, msg, size);
out:
return ret_val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This must be called under preempt disabled or must be called by a thread which is pinned to local cpu. */ | static void drain_local_stock(struct work_struct *dummy) | /* This must be called under preempt disabled or must be called by a thread which is pinned to local cpu. */
static void drain_local_stock(struct work_struct *dummy) | {
struct memcg_stock_pcp *stock = &__get_cpu_var(memcg_stock);
drain_stock(stock);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This buffer is required to safely transfer AP from real address mode to protected mode or long mode, due to the fact that the buffer returned by */ | UINTN AllocateCodeBuffer(IN UINTN BufferSize) | /* This buffer is required to safely transfer AP from real address mode to protected mode or long mode, due to the fact that the buffer returned by */
UINTN AllocateCodeBuffer(IN UINTN BufferSize) | {
EFI_STATUS Status;
EFI_PHYSICAL_ADDRESS Address;
Status = PeiServicesAllocatePages (EfiBootServicesCode, EFI_SIZE_TO_PAGES (BufferSize), &Address);
if (EFI_ERROR (Status)) {
Address = 0;
}
return (UINTN)Address;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* @fdt: ptr to device tree @alias: alias of node to update @status: FDT_STATUS_OKAY, FDT_STATUS_DISABLED, FDT_STATUS_FAIL, FDT_STATUS_FAIL_ERROR_CODE @error_code: optional, only used if status is FDT_STATUS_FAIL_ERROR_CODE */ | int fdt_set_status_by_alias(void *fdt, const char *alias, enum fdt_status status, unsigned int error_code) | /* @fdt: ptr to device tree @alias: alias of node to update @status: FDT_STATUS_OKAY, FDT_STATUS_DISABLED, FDT_STATUS_FAIL, FDT_STATUS_FAIL_ERROR_CODE @error_code: optional, only used if status is FDT_STATUS_FAIL_ERROR_CODE */
int fdt_set_status_by_alias(void *fdt, const char *alias, enum fdt_status status, unsigned int error_code) | {
int offset = fdt_path_offset(fdt, alias);
return fdt_set_node_status(fdt, offset, status, error_code);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* User-defined threshold value for xl interrupt event on generator. Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG.. */ | int32_t lis2mdl_int_gen_treshold_set(stmdev_ctx_t *ctx, uint8_t *buff) | /* User-defined threshold value for xl interrupt event on generator. Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG.. */
int32_t lis2mdl_int_gen_treshold_set(stmdev_ctx_t *ctx, uint8_t *buff) | {
int32_t ret;
ret = lis2mdl_write_reg(ctx, LIS2MDL_INT_THS_L_REG, buff, 2);
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Enables the generation of the waveform signal on the designated output(s) Outputs can be combined (ORed) to allow for simultaneous output enabling. */ | void HRTIM_WaveformOutputStart(HRTIM_TypeDef *HRTIMx, uint32_t OutputsToStart) | /* Enables the generation of the waveform signal on the designated output(s) Outputs can be combined (ORed) to allow for simultaneous output enabling. */
void HRTIM_WaveformOutputStart(HRTIM_TypeDef *HRTIMx, uint32_t OutputsToStart) | {
HRTIMx->HRTIM_COMMON.OENR = OutputsToStart;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* @field: an initialized field @value: a string of byte values */ | int eeprom_field_update_bin_rev(struct eeprom_field *field, char *value) | /* @field: an initialized field @value: a string of byte values */
int eeprom_field_update_bin_rev(struct eeprom_field *field, char *value) | {
return __eeprom_field_update_bin(field, value, true);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI HmacSha256All(IN CONST VOID *Data, IN UINTN DataSize, IN CONST UINT8 *Key, IN UINTN KeySize, OUT UINT8 *HmacValue) | /* If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI HmacSha256All(IN CONST VOID *Data, IN UINTN DataSize, IN CONST UINT8 *Key, IN UINTN KeySize, OUT UINT8 *HmacValue) | {
CALL_CRYPTO_SERVICE (HmacSha256All, (Data, DataSize, Key, KeySize, HmacValue), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Delete the given item from the AIL. Return a pointer to the item. */ | STATIC xfs_log_item_t * xfs_ail_delete(struct xfs_ail *, xfs_log_item_t *) | /* Delete the given item from the AIL. Return a pointer to the item. */
STATIC xfs_log_item_t * xfs_ail_delete(struct xfs_ail *, xfs_log_item_t *) | {
xfs_ail_check(ailp, lip);
list_del(&lip->li_ail);
return lip;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Counts the run of zero bits starting at bit up to max. It handles the case where a run might spill over a buffer. Called with bitmap lock. */ | static int count_run(unsigned long **addr, int nbits, int addrlen, int bit, int max) | /* Counts the run of zero bits starting at bit up to max. It handles the case where a run might spill over a buffer. Called with bitmap lock. */
static int count_run(unsigned long **addr, int nbits, int addrlen, int bit, int max) | {
int count = 0;
int x;
for (; addrlen > 0; addrlen--, addr++) {
x = find_next_bit(*addr, nbits, bit);
count += x - bit;
if (x < nbits || count > max)
return min(count, max);
bit = 0;
}
return min(count, max);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If we are mounting (or read-write remounting) a filesystem whose journal has recorded an error from a previous lifetime, move that error to the main filesystem now. */ | static void ext3_clear_journal_err(struct super_block *sb, struct ext3_super_block *es) | /* If we are mounting (or read-write remounting) a filesystem whose journal has recorded an error from a previous lifetime, move that error to the main filesystem now. */
static void ext3_clear_journal_err(struct super_block *sb, struct ext3_super_block *es) | {
journal_t *journal;
int j_errno;
const char *errstr;
journal = EXT3_SB(sb)->s_journal;
j_errno = journal_errno(journal);
if (j_errno) {
char nbuf[16];
errstr = ext3_decode_error(sb, j_errno, nbuf);
ext3_warning(sb, __func__, "Filesystem error recorded "
"from previous mount: %s", errstr);
ext3_warning(sb, __func__, "Marking fs in need of "
"filesystem check.");
EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
es->s_state |= cpu_to_le16(EXT3_ERROR_FS);
ext3_commit_super (sb, es, 1);
journal_clear_err(journal);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* sca3000_query_ring_int() is the hardware ring status interrupt enabled */ | static ssize_t sca3000_query_ring_int(struct device *dev, struct device_attribute *attr, char *buf) | /* sca3000_query_ring_int() is the hardware ring status interrupt enabled */
static ssize_t sca3000_query_ring_int(struct device *dev, struct device_attribute *attr, char *buf) | {
struct iio_event_attr *this_attr = to_iio_event_attr(attr);
int ret, len;
u8 *rx;
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct sca3000_state *st = indio_dev->dev_data;
mutex_lock(&st->lock);
ret = sca3000_read_data(st, SCA3000_REG_ADDR_INT_MASK, &rx, 1);
mutex_unlock(&st->lock);
if (ret)
return ret;
len = sprintf(buf, "%d\n", (rx[1] & this_attr->mask) ? 1 : 0);
kfree(rx);
return len;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Called by fabric for base port when fabric goes offline. Called by vport for virtual ports when virtual port becomes offline. */ | void bfa_fcs_port_offline(struct bfa_fcs_port_s *port) | /* Called by fabric for base port when fabric goes offline. Called by vport for virtual ports when virtual port becomes offline. */
void bfa_fcs_port_offline(struct bfa_fcs_port_s *port) | {
bfa_sm_send_event(port, BFA_FCS_PORT_SM_OFFLINE);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables/Disable OIS chain DRDY on INT2 pin. This setting has priority over all other INT2 settings.. */ | int32_t lsm6dso_aux_drdy_on_int2_set(lsm6dso_ctx_t *ctx, uint8_t val) | /* Enables/Disable OIS chain DRDY on INT2 pin. This setting has priority over all other INT2 settings.. */
int32_t lsm6dso_aux_drdy_on_int2_set(lsm6dso_ctx_t *ctx, uint8_t val) | {
lsm6dso_int_ois_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_INT_OIS, (uint8_t*)®, 1);
if (ret == 0) {
reg.int2_drdy_ois = val;
ret = lsm6dso_write_reg(ctx, LSM6DSO_INT_OIS, (uint8_t*)®, 1);
}
return ret;
} | alexander-g-dean/ESF | C++ | null | 41 |
/* Generate the PINx address of the given pin. */ | static uint8_t _pin_addr(gpio_t pin) | /* Generate the PINx address of the given pin. */
static uint8_t _pin_addr(gpio_t pin) | {
return (_port_addr(pin) - 0x02);
} | labapart/polymcu | C++ | null | 201 |
/* edac_mc_workq_function performs the operation scheduled by a workq request */ | static void edac_mc_workq_function(struct work_struct *work_req) | /* edac_mc_workq_function performs the operation scheduled by a workq request */
static void edac_mc_workq_function(struct work_struct *work_req) | {
struct delayed_work *d_work = to_delayed_work(work_req);
struct mem_ctl_info *mci = to_edac_mem_ctl_work(d_work);
mutex_lock(&mem_ctls_mutex);
if (mci->op_state == OP_OFFLINE) {
mutex_unlock(&mem_ctls_mutex);
return;
}
if (edac_mc_assert_error_check_and_clear() && (mci->edac_check != NULL))
mci->edac_check(mci);
mutex_unlock(&mem_ctls_mutex);
queue_delayed_work(edac_workqueue, &mci->work,
msecs_to_jiffies(edac_mc_get_poll_msec()));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Generate the operational state of the interface this IP4 config2 instance manages and output in EFI_IP4_CONFIG2_INTERFACE_INFO. */ | VOID Ip4Config2InitIfInfo(IN IP4_SERVICE *IpSb, OUT EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo) | /* Generate the operational state of the interface this IP4 config2 instance manages and output in EFI_IP4_CONFIG2_INTERFACE_INFO. */
VOID Ip4Config2InitIfInfo(IN IP4_SERVICE *IpSb, OUT EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo) | {
UnicodeSPrint (
IfInfo->Name,
EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE,
L"eth%d",
IpSb->Ip4Config2Instance.IfIndex
);
IfInfo->IfType = IpSb->SnpMode.IfType;
IfInfo->HwAddressSize = IpSb->SnpMode.HwAddressSize;
CopyMem (&IfInfo->HwAddress, &IpSb->SnpMode.CurrentAddress, IfInfo->HwAddressSize);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Reads a block of data from the EEPROM. */ | uint32_t sEE_ReadBuffer(uint8_t *pBuffer, uint16_t ReadAddr, uint16_t *NumByteToRead) | /* Reads a block of data from the EEPROM. */
uint32_t sEE_ReadBuffer(uint8_t *pBuffer, uint16_t ReadAddr, uint16_t *NumByteToRead) | {
sEE_CS_LOW();
sEE_SendByte(sEE_CMD_READ | (uint8_t)((ReadAddr & 0x100)>>5));
sEE_SendByte(ReadAddr & 0xFF);
while ((*NumByteToRead)--)
{
*pBuffer = sEE_SendByte(sEE_DUMMY_BYTE);
pBuffer++;
}
sEE_CS_HIGH();
return 0;
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* this worker thread exists because we must acquire a semaphore to read the phy, which we could msleep while waiting for it, and we can't msleep in a timer. */ | static void e1000e_update_phy_task(struct work_struct *work) | /* this worker thread exists because we must acquire a semaphore to read the phy, which we could msleep while waiting for it, and we can't msleep in a timer. */
static void e1000e_update_phy_task(struct work_struct *work) | {
struct e1000_adapter *adapter = container_of(work,
struct e1000_adapter, update_phy_task);
e1000_get_phy_info(&adapter->hw);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the DMA channel Interrupt Callback function that have been set. */ | xtEventCallback DMAChannelIntCallbackGet(unsigned long ulChannelID) | /* Get the DMA channel Interrupt Callback function that have been set. */
xtEventCallback DMAChannelIntCallbackGet(unsigned long ulChannelID) | {
int i;
xASSERT(xDMAChannelIDValid(ulChannelID));
for(i = 0; g_psDMAChannelAssignTable[i].ulChannelID !=
xDMA_CHANNEL_NOT_EXIST;
i++)
{
if(g_psDMAChannelAssignTable[i].ulChannelID == ulChannelID)
{
return g_psDMAChannelAssignTable[i].pfnDMAChannelHandlerCallback;
}
}
return 0;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Enable the Analog mode for each pin (default is as Digital pins) */ | void PINSEL_SetAnalogPinMode(uint8_t portnum, uint8_t pinnum, uint8_t enable) | /* Enable the Analog mode for each pin (default is as Digital pins) */
void PINSEL_SetAnalogPinMode(uint8_t portnum, uint8_t pinnum, uint8_t enable) | {
uint32_t *pPIN = NULL;
uint8_t condition = 0;
condition = ((portnum == 0) && (pinnum == 12)) || ((portnum == 0) && (pinnum == 13))
| ((portnum == 0) && (pinnum <= 26) && (pinnum >= 23))
| ((portnum == 1) && (pinnum == 30)) || ((portnum == 1) && (pinnum == 31));
if(!condition)
{
return;
}
pPIN = PIN_GetPointer(portnum, pinnum);
*(uint32_t *)pPIN &= ~(PINSEL_ADMODE_BITMASK << PINSEL_ADMODE_POS);
if(enable)
{
}
else
{
*(uint32_t *)pPIN |= (1 << PINSEL_ADMODE_POS);
}
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The return value is PDC_OK (0) in case accessing this address is valid. */ | int pdc_add_valid(unsigned long address) | /* The return value is PDC_OK (0) in case accessing this address is valid. */
int pdc_add_valid(unsigned long address) | {
int retval;
unsigned long flags;
spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_ADD_VALID, PDC_ADD_VALID_VERIFY, address);
spin_unlock_irqrestore(&pdc_lock, flags);
return retval;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Set the SinkTxNg value of the resistor, used in the collision avoidance. */ | void USBPD_PHY_SetResistor_SinkTxNG(uint8_t PortNum) | /* Set the SinkTxNg value of the resistor, used in the collision avoidance. */
void USBPD_PHY_SetResistor_SinkTxNG(uint8_t PortNum) | {
STUSB1602_Current_Advertised_Set(STUSB1602_I2C_Add(PortNum), USB_C_Current_1_5_A);
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* param base CMC peripheral base address. param mask Bitmap of the SRAM arrays to be powered off all modes. */ | void CMC_PowerOffSRAMAllMode(CMC_Type *base, uint32_t mask) | /* param base CMC peripheral base address. param mask Bitmap of the SRAM arrays to be powered off all modes. */
void CMC_PowerOffSRAMAllMode(CMC_Type *base, uint32_t mask) | {
uint32_t reg = base->SRAMDIS[0];
reg &= ~CMC_SRAMDIS_DIS_MASK;
reg |= CMC_SRAMDIS_DIS(mask);
base->SRAMDIS[0] = reg;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The caller is responsible for freeing the returned buffer. */ | u8* eap_peer_tls_derive_session_id(struct eap_sm *sm, struct eap_ssl_data *data, u8 eap_type, size_t *len) | /* The caller is responsible for freeing the returned buffer. */
u8* eap_peer_tls_derive_session_id(struct eap_sm *sm, struct eap_ssl_data *data, u8 eap_type, size_t *len) | {
struct tls_keys keys;
u8 *out;
if (tls_connection_get_keys(sm->ssl_ctx, data->conn, &keys))
return NULL;
if (keys.client_random == NULL || keys.server_random == NULL ||
keys.master_key == NULL)
return NULL;
*len = 1 + keys.client_random_len + keys.server_random_len;
out = os_malloc(*len);
if (out == NULL)
return NULL;
out[0] = eap_type;
os_memcpy(out + 1, keys.client_random, keys.client_random_len);
os_memcpy(out + 1 + keys.client_random_len, keys.server_random,
keys.server_random_len);
return out;
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* The function is used to Set Clock Output source. */ | void SysCtlClkOututSrcSet(unsigned long ulClkOutSrc) | /* The function is used to Set Clock Output source. */
void SysCtlClkOututSrcSet(unsigned long ulClkOutSrc) | {
xASSERT((ulClkOutSrc == SYSCTL_OUTPUT_CLKSRC_BUS)||
(ulClkOutSrc == SYSCTL_OUTPUT_CLKSRC_LPO)||
(ulClkOutSrc == SYSCTL_OUTPUT_CLKSRC_MCGIRCLK)||
(ulClkOutSrc == SYSCTL_OUTPUT_CLKSRC_OSCERCLK));
xHWREG(SIM_SOPT2) &= ~SIM_SOPT2_CLKOUTSEL_M;
xHWREG(SIM_SOPT2) |= ulClkOutSrc;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This function will detach a portal device from resource management */ | rt_err_t rt_portal_detach(struct rt_portal_device *portal) | /* This function will detach a portal device from resource management */
rt_err_t rt_portal_detach(struct rt_portal_device *portal) | {
return rt_device_unregister(&portal->parent);
} | armink/FreeModbus_Slave-Master-RTT-STM32 | C++ | Other | 1,477 |
/* Wait until the number of ticks has elapsed. This is a blocking delay. */ | void os_cputime_delay_ticks(uint32_t ticks) | /* Wait until the number of ticks has elapsed. This is a blocking delay. */
void os_cputime_delay_ticks(uint32_t ticks) | {
uint32_t until;
until = os_cputime_get32() + ticks;
while ((int32_t)(os_cputime_get32() - until) < 0) {
}
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Restores the current floating point/SSE/SSE2 state from the buffer specified by Buffer. Buffer must be aligned on a 16-byte boundary. This function is only available on IA-32 and X64. */ | VOID EFIAPI InternalX86FxRestore(IN CONST IA32_FX_BUFFER *Buffer) | /* Restores the current floating point/SSE/SSE2 state from the buffer specified by Buffer. Buffer must be aligned on a 16-byte boundary. This function is only available on IA-32 and X64. */
VOID EFIAPI InternalX86FxRestore(IN CONST IA32_FX_BUFFER *Buffer) | {
__asm__ __volatile__ (
"fxrstor %0"
:
: "m" (*Buffer)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Read the value for the AMP gain control. */ | static int speaker_gain_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | /* Read the value for the AMP gain control. */
static int speaker_gain_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | {
ucontrol->value.integer.value[0] = spk_gain;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get number of bytes left in transfer buffer. */ | int32_t _i2c_m_async_get_bytes_left(struct _i2c_m_async_device *const i2c_dev) | /* Get number of bytes left in transfer buffer. */
int32_t _i2c_m_async_get_bytes_left(struct _i2c_m_async_device *const i2c_dev) | {
if (i2c_dev->service.msg.flags & I2C_M_BUSY) {
return i2c_dev->service.msg.len;
}
return 0;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* param base Key Manager peripheral address. param select select source for OTFAD2 key. param lock setting for lock OTFAD2 key. return status of OTFAD2 key control operation */ | status_t KEYMGR_OTFAD2KeyControll(KEY_MANAGER_Type *base, keymgr_select_t select, keymgr_lock_t lock) | /* param base Key Manager peripheral address. param select select source for OTFAD2 key. param lock setting for lock OTFAD2 key. return status of OTFAD2 key control operation */
status_t KEYMGR_OTFAD2KeyControll(KEY_MANAGER_Type *base, keymgr_select_t select, keymgr_lock_t lock) | {
if ((select != (uint8_t)(KEYMGR_SEL_OCOTP)) && (select != (uint8_t)(KEYMGR_SEL_PUF)))
{
return kStatus_InvalidArgument;
}
base->OTFAD2_KEY_CTRL &= ~KEY_MANAGER_OTFAD2_KEY_CTRL_SELECT_MASK;
base->OTFAD2_KEY_CTRL |= KEY_MANAGER_OTFAD2_KEY_CTRL_SELECT(select) | KEY_MANAGER_OTFAD2_KEY_CTRL_LOCK(lock);
return kStatus_Success;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* param base ENET peripheral base address. param phyAddr The PHY address. param regAddr The PHY register. */ | void ENET_StartSMIRead(ENET_Type *base, uint8_t phyAddr, uint8_t regAddr) | /* param base ENET peripheral base address. param phyAddr The PHY address. param regAddr The PHY register. */
void ENET_StartSMIRead(ENET_Type *base, uint8_t phyAddr, uint8_t regAddr) | {
uint32_t reg = base->MAC_MDIO_ADDRESS & ENET_MAC_MDIO_ADDRESS_CR_MASK;
base->MAC_MDIO_ADDRESS = reg | ENET_MAC_MDIO_ADDRESS_GOC_0(1) | ENET_MAC_MDIO_ADDRESS_GOC_1(1) |
ENET_MAC_MDIO_ADDRESS_PA(phyAddr) | ENET_MAC_MDIO_ADDRESS_RDA(regAddr);
base->MAC_MDIO_ADDRESS |= ENET_MAC_MDIO_ADDRESS_GB_MASK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function closes and deletes a file. In all cases the file handle is closed. If the file cannot be deleted, the warning code EFI_WARN_DELETE_FAILURE is returned, but the handle is still closed. */ | EFI_STATUS EFIAPI FileHandleDelete(IN EFI_FILE_HANDLE FileHandle) | /* This function closes and deletes a file. In all cases the file handle is closed. If the file cannot be deleted, the warning code EFI_WARN_DELETE_FAILURE is returned, but the handle is still closed. */
EFI_STATUS EFIAPI FileHandleDelete(IN EFI_FILE_HANDLE FileHandle) | {
EFI_STATUS Status;
if (FileHandle == NULL) {
return (EFI_INVALID_PARAMETER);
}
Status = FileHandle->Delete (FileHandle);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Deinitializes the DVP peripheral registers to their default reset values. */ | void DVP_DeInit(void) | /* Deinitializes the DVP peripheral registers to their default reset values. */
void DVP_DeInit(void) | {
RCC_EnableAPB2PeriphReset(RCC_APB2_PERIPH_DVP, ENABLE);
RCC_EnableAPB2PeriphReset(RCC_APB2_PERIPH_DVP, DISABLE);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Process some data. This handles the simple case where no context is required. */ | process_data_simple_main(j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail) | /* Process some data. This handles the simple case where no context is required. */
process_data_simple_main(j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail) | {
my_main_ptr main = (my_main_ptr) cinfo->main;
JDIMENSION rowgroups_avail;
if (! main->buffer_full) {
if (! (*cinfo->coef->decompress_data) (cinfo, main->buffer))
return;
main->buffer_full = TRUE;
}
rowgroups_avail = (JDIMENSION) cinfo->min_DCT_v_scaled_size;
(*cinfo->post->post_process_data) (cinfo, main->buffer,
&main->rowgroup_ctr, rowgroups_avail,
output_buf, out_row_ctr, out_rows_avail);
if (main->rowgroup_ctr >= rowgroups_avail) {
main->buffer_full = FALSE;
main->rowgroup_ctr = 0;
}
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Write PHY register Return 1 if successfully, 0 if timeout. */ | unsigned char EMAC_WritePhy(unsigned char PhyAddress, unsigned char Address, unsigned int Value, unsigned int retry) | /* Write PHY register Return 1 if successfully, 0 if timeout. */
unsigned char EMAC_WritePhy(unsigned char PhyAddress, unsigned char Address, unsigned int Value, unsigned int retry) | {
AT91C_BASE_EMAC->EMAC_MAN = (AT91C_EMAC_SOF & (0x01 << 30))
| (AT91C_EMAC_CODE & (2 << 16))
| (AT91C_EMAC_RW & (1 << 28))
| (AT91C_EMAC_PHYA & ((PhyAddress & 0x1f) << 23))
| (AT91C_EMAC_REGA & (Address << 18))
| (AT91C_EMAC_DATA & Value) ;
if ( EMAC_WaitPhy(retry) == 0 ) {
TRACE_ERROR("TimeOut EMAC_WritePhy\n\r");
return 0;
}
return 1;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* This function displays information using LEDs about the SHA204 devices on the Security Xplained board. */ | void display_status(uint8_t device_present_mask, uint8_t sha204_revision) | /* This function displays information using LEDs about the SHA204 devices on the Security Xplained board. */
void display_status(uint8_t device_present_mask, uint8_t sha204_revision) | {
uint8_t i;
uint8_t shifter = 1;
for (i = 0; shifter < 0x10; shifter <<= 1)
if (shifter & device_present_mask)
i++;
if (i < SHA204_DEVICE_COUNT) {
uint8_t i;
for (i = 0; i < 4; i++) {
led_display_number(~device_present_mask);
sha204h_delay_ms(125);
led_display_number(0);
sha204h_delay_ms(125);
}
}
else {
led_display_number((device_present_mask << 4) | sha204_revision);
sha204h_delay_ms(1000);
led_display_number(0);
sha204h_delay_ms(1000);
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* copy src to dest, skipping leading and trailing blanks and null terminate the string "len" is the size of available memory including the terminating '\0' */ | static void ident_cpy(unsigned char *dest, unsigned char *src, unsigned int len) | /* copy src to dest, skipping leading and trailing blanks and null terminate the string "len" is the size of available memory including the terminating '\0' */
static void ident_cpy(unsigned char *dest, unsigned char *src, unsigned int len) | {
unsigned char *end, *last;
last = dst;
end = src + len - 1;
if (len < 2)
goto OUT;
while ((*src) && (src<end) && (*src==' '))
++src;
while ((*src) && (src<end)) {
*dst++ = *src;
if (*src++ != ' ')
last = dst;
}
OUT:
*last = '\0';
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* note This must be called after all the ENET initilization. And should be called when the ENET receive/transmit is required. */ | void ENET_UpdateRxDescriptor(enet_rx_bd_struct_t *rxDesc, void *buffer1, void *buffer2, bool intEnable, bool doubleBuffEnable) | /* note This must be called after all the ENET initilization. And should be called when the ENET receive/transmit is required. */
void ENET_UpdateRxDescriptor(enet_rx_bd_struct_t *rxDesc, void *buffer1, void *buffer2, bool intEnable, bool doubleBuffEnable) | {
assert(rxDesc);
uint32_t control = ENET_RXDESCRIP_RD_OWN_MASK | ENET_RXDESCRIP_RD_BUFF1VALID_MASK;
if (intEnable)
{
control |= ENET_RXDESCRIP_RD_IOC_MASK;
}
if (doubleBuffEnable)
{
control |= ENET_RXDESCRIP_RD_BUFF2VALID_MASK;
}
if (buffer1 != NULL)
{
rxDesc->rdes0 = (uint32_t)(uint32_t *)buffer1;
}
if (buffer2 != NULL)
{
rxDesc->rdes2 = (uint32_t)(uint32_t *)buffer2;
}
else
{
rxDesc->rdes2 = 0;
}
rxDesc->rdes1 = 0;
rxDesc->rdes3 = control;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function should not be called directly by device drivers. */ | int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state) | /* This function should not be called directly by device drivers. */
int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state) | {
return state > PCI_D0 ?
pci_platform_power_transition(dev, state) : -EINVAL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The function is used to enable BOD function. */ | void SysCtlBODEnable(xtBoolean bEnable) | /* The function is used to enable BOD function. */
void SysCtlBODEnable(xtBoolean bEnable) | {
if(bEnable)
{
xHWREG(PWRCU_LVDCSR) |= PWRCU_LVDCSR_BODEN;
}
else
{
xHWREG(PWRCU_LVDCSR) &= ~PWRCU_LVDCSR_BODEN;
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* processes a fatal error. Bring the ports down, reset the chip, bring the ports back up. */ | static void fatal_error_task(struct work_struct *work) | /* processes a fatal error. Bring the ports down, reset the chip, bring the ports back up. */
static void fatal_error_task(struct work_struct *work) | {
struct adapter *adapter = container_of(work, struct adapter,
fatal_error_handler_task);
int err = 0;
rtnl_lock();
err = t3_adapter_error(adapter, 1);
if (!err)
err = t3_reenable_adapter(adapter);
if (!err)
t3_resume_ports(adapter);
CH_ALERT(adapter, "adapter reset %s\n", err ? "failed" : "succeeded");
rtnl_unlock();
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Compare the first specified bytes of 2 given strings Return 0 if equals Return >0 if 1st string > 2nd string Return <0 if 1st string < 2nd string */ | int strncmp(const char *pString1, const char *pString2, size_t count) | /* Compare the first specified bytes of 2 given strings Return 0 if equals Return >0 if 1st string > 2nd string Return <0 if 1st string < 2nd string */
int strncmp(const char *pString1, const char *pString2, size_t count) | {
int r;
while(count) {
r = *pString1 - *pString2;
if (r == 0) {
if (*pString1 == 0) {
break;
}
pString1++;
pString2++;
count--;
continue;
}
return r;
}
return 0;
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* Read/write access functions for various sizes of values in config space. Return all 1's for disallowed accesses for a kludgy but adequate simulation of master aborts. */ | static int bcm1480_pcibios_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val) | /* Read/write access functions for various sizes of values in config space. Return all 1's for disallowed accesses for a kludgy but adequate simulation of master aborts. */
static int bcm1480_pcibios_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val) | {
u32 data = 0;
if ((size == 2) && (where & 1))
return PCIBIOS_BAD_REGISTER_NUMBER;
else if ((size == 4) && (where & 3))
return PCIBIOS_BAD_REGISTER_NUMBER;
if (bcm1480_pci_can_access(bus, devfn))
data = READCFG32(CFGADDR(bus, devfn, where));
else
data = 0xFFFFFFFF;
if (size == 1)
*val = (data >> ((where & 3) << 3)) & 0xff;
else if (size == 2)
*val = (data >> ((where & 3) << 3)) & 0xffff;
else
*val = data;
return PCIBIOS_SUCCESSFUL;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Check for a restart marker & resynchronize decoder. Returns FALSE if must suspend. */ | process_restart(j_decompress_ptr cinfo) | /* Check for a restart marker & resynchronize decoder. Returns FALSE if must suspend. */
process_restart(j_decompress_ptr cinfo) | {
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
int ci;
finish_pass_huff(cinfo);
if (! (*cinfo->marker->read_restart_marker) (cinfo))
return FALSE;
for (ci = 0; ci < cinfo->comps_in_scan; ci++)
entropy->saved.last_dc_val[ci] = 0;
entropy->saved.EOBRUN = 0;
entropy->restarts_to_go = cinfo->restart_interval;
if (cinfo->unread_marker == 0)
entropy->insufficient_data = FALSE;
return TRUE;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Driver done interrupt service routine for channel 3. We need this done ISR mainly because the driver needs to release the DMA program buffer. This is the one that connects the GIC */ | void XDmaPs_DoneISR_3(XDmaPs *InstPtr) | /* Driver done interrupt service routine for channel 3. We need this done ISR mainly because the driver needs to release the DMA program buffer. This is the one that connects the GIC */
void XDmaPs_DoneISR_3(XDmaPs *InstPtr) | {
XDmaPs_DoneISR_n(InstPtr, 3);
} | ua1arn/hftrx | C++ | null | 69 |
/* See mss_uart.h for details of how to use this function. */ | void MSS_UART_init(mss_uart_instance_t *this_uart, uint32_t baud_rate, uint8_t line_config) | /* See mss_uart.h for details of how to use this function. */
void MSS_UART_init(mss_uart_instance_t *this_uart, uint32_t baud_rate, uint8_t line_config) | {
ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1));
global_init(this_uart, baud_rate, line_config);
clear_bit_reg8(&this_uart->hw_reg->MM0, ELIN);
clear_bit_reg8(&this_uart->hw_reg->MM1, EIRD);
clear_bit_reg8(&this_uart->hw_reg->MM2, EERR);
this_uart->tx_handler = default_tx_handler;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ | RETURN_STATUS EFIAPI SafeUintnMult(IN UINTN Multiplicand, IN UINTN Multiplier, OUT UINTN *Result) | /* If the requested operation results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUintnMult(IN UINTN Multiplicand, IN UINTN Multiplier, OUT UINTN *Result) | {
return SafeUint64Mult ((UINT64)Multiplicand, (UINT64)Multiplier, (UINT64 *)Result);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Check that the device given is a valid AX.25 interface that is "up". called whith RTNL */ | static struct net_device* rose_ax25_dev_find(char *devname) | /* Check that the device given is a valid AX.25 interface that is "up". called whith RTNL */
static struct net_device* rose_ax25_dev_find(char *devname) | {
struct net_device *dev;
if ((dev = __dev_get_by_name(&init_net, devname)) == NULL)
return NULL;
if ((dev->flags & IFF_UP) && dev->type == ARPHRD_AX25)
return dev;
return NULL;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */ | static struct isl_vec* isl_vec_lin_to_aff(struct isl_vec *vec) | /* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */
static struct isl_vec* isl_vec_lin_to_aff(struct isl_vec *vec) | {
struct isl_vec *aff;
if (!vec)
return NULL;
aff = isl_vec_alloc(vec->ctx, 1 + vec->size);
if (!aff)
goto error;
isl_int_set_si(aff->el[0], 0);
isl_seq_cpy(aff->el + 1, vec->el, vec->size);
isl_vec_free(vec);
return aff;
error:
isl_vec_free(vec);
return NULL;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This file is part of the Simba project. */ | int channel_init(struct channel_t *self_p, int id, int32_t *buf_p, size_t length) | /* This file is part of the Simba project. */
int channel_init(struct channel_t *self_p, int id, int32_t *buf_p, size_t length) | {
self_p->id = id;
self_p->state = CHANNEL_STATE_ON;
self_p->length = 0;
self_p->waveform.buf_p = buf_p;
self_p->waveform.length = length;
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* Returns CR_OK upon successful completion, an error code otherwise. */ | enum CRStatus cr_font_size_clear(CRFontSize *a_this) | /* Returns CR_OK upon successful completion, an error code otherwise. */
enum CRStatus cr_font_size_clear(CRFontSize *a_this) | {
g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR);
switch (a_this->type) {
case PREDEFINED_ABSOLUTE_FONT_SIZE:
case RELATIVE_FONT_SIZE:
case INHERITED_FONT_SIZE:
memset (a_this, 0, sizeof (CRFontSize));
break;
case ABSOLUTE_FONT_SIZE:
memset (a_this, 0, sizeof (CRFontSize));
break;
default:
return CR_UNKNOWN_TYPE_ERROR;
}
return CR_OK;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Appends a formatted string onto the end of a #GString. This function is similar to g_string_printf() except that the text is appended to the #GString. */ | void g_string_append_printf(GString *string, const gchar *format,...) | /* Appends a formatted string onto the end of a #GString. This function is similar to g_string_printf() except that the text is appended to the #GString. */
void g_string_append_printf(GString *string, const gchar *format,...) | {
va_list args;
va_start (args, format);
g_string_append_vprintf (string, format, args);
va_end (args);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* In non-blocking execution mode, BSP is freed to return to the caller and then proceed to the next task without having to wait for APs. The following sequence needs to occur in a non-blocking execution mode: */ | EFI_STATUS EFIAPI StartupAllAPs(IN EFI_MP_SERVICES_PROTOCOL *This, IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, IN EFI_EVENT WaitEvent OPTIONAL, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL, OUT UINTN **FailedCpuList OPTIONAL) | /* In non-blocking execution mode, BSP is freed to return to the caller and then proceed to the next task without having to wait for APs. The following sequence needs to occur in a non-blocking execution mode: */
EFI_STATUS EFIAPI StartupAllAPs(IN EFI_MP_SERVICES_PROTOCOL *This, IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, IN EFI_EVENT WaitEvent OPTIONAL, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL, OUT UINTN **FailedCpuList OPTIONAL) | {
return MpInitLibStartupAllAPs (
Procedure,
SingleThread,
WaitEvent,
TimeoutInMicroseconds,
ProcedureArgument,
FailedCpuList
);
} | 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.