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 |
|---|---|---|---|---|---|---|---|
/* GPIO interrupt handler. This function is the GPIO interrupt handler, it simple execute the callback function if there be one. */ | void EINT3IntHandler(void) | /* GPIO interrupt handler. This function is the GPIO interrupt handler, it simple execute the callback function if there be one. */
void EINT3IntHandler(void) | {
unsigned long i = 0;
for(i = 0; i < 64; i++)
{
if(g_psGPIOPinIntAssignTable[i])
{
g_psGPIOPinIntAssignTable[i](0,0,0,0);
}
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This function is available for architecture code, only. So it is not exported. */ | int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom) | /* This function is available for architecture code, only. So it is not exported. */
int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom) | {
if (fallback_sprom)
return -EEXIST;
fallback_sprom = sprom;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Change Logs: Date Author Notes Grissiom first version */ | void rt_wm_que_set_mark(struct rt_watermark_queue *wg, unsigned int low, unsigned int high) | /* Change Logs: Date Author Notes Grissiom first version */
void rt_wm_que_set_mark(struct rt_watermark_queue *wg, unsigned int low, unsigned int high) | {
RT_ASSERT(low <= high);
wg->high_mark = high;
wg->low_mark = low;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* this function calls the 'stop' function on all other CPUs in the system. */ | asmlinkage void smp_reboot_interrupt(void) | /* this function calls the 'stop' function on all other CPUs in the system. */
asmlinkage void smp_reboot_interrupt(void) | {
ack_APIC_irq();
irq_enter();
stop_this_cpu(NULL);
irq_exit();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Disables all udc endpoints (even control endpoint), report disconnect to the gadget user. */ | static void stop_activity(struct pxa_udc *udc, struct usb_gadget_driver *driver) | /* Disables all udc endpoints (even control endpoint), report disconnect to the gadget user. */
static void stop_activity(struct pxa_udc *udc, struct usb_gadget_driver *driver) | {
int i;
if (udc->gadget.speed == USB_SPEED_UNKNOWN)
driver = NULL;
udc->gadget.speed = USB_SPEED_UNKNOWN;
for (i = 0; i < NR_USB_ENDPOINTS; i++)
pxa_ep_disable(&udc->udc_usb_ep[i].usb_ep);
if (driver)
driver->disconnect(&udc->gadget);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Can be called only after the mac address of the bond is set. */ | void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution, int lacp_fast) | /* Can be called only after the mac address of the bond is set. */
void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution, int lacp_fast) | {
if (MAC_ADDRESS_COMPARE(&(BOND_AD_INFO(bond).system.sys_mac_addr),
bond->dev->dev_addr)) {
aggregator_identifier = 0;
BOND_AD_INFO(bond).lacp_fast = lacp_fast;
BOND_AD_INFO(bond).system.sys_priority = 0xFFFF;
BOND_AD_INFO(bond).system.sys_mac_addr = *((struct mac_addr *)bond->dev->dev_addr);
ad_ticks_p... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Show all content of the LCD glass.
This function sets all pixels and areas of the LCD glass XPRO_LCD. */ | void xpro_lcd_show_all(void) | /* Show all content of the LCD glass.
This function sets all pixels and areas of the LCD glass XPRO_LCD. */
void xpro_lcd_show_all(void) | {
slcd_disable();
slcd_disable_blink();
slcd_disable_circular_shift();
slcd_set_display_memory();
slcd_enable();
} | memfault/zero-to-main | C++ | null | 200 |
/* Converts a text device path node to Hardware memory map device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextMemoryMapped(CHAR16 *TextDeviceNode) | /* Converts a text device path node to Hardware memory map device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextMemoryMapped(CHAR16 *TextDeviceNode) | {
CHAR16 *MemoryTypeStr;
CHAR16 *StartingAddressStr;
CHAR16 *EndingAddressStr;
MEMMAP_DEVICE_PATH *MemMap;
MemoryTypeStr = GetNextParamStr (&TextDeviceNode);
StartingAddressStr = GetNextParamStr (&TextDeviceNode);
EndingAddressStr = GetNextParamStr (&TextDevi... | tianocore/edk2 | C++ | Other | 4,240 |
/* Checks whether the specified FLASH flag is set or not. */ | FlagStatus FLASH_GetFlagStatus(u16 flag) | /* Checks whether the specified FLASH flag is set or not. */
FlagStatus FLASH_GetFlagStatus(u16 flag) | {
return ((flag == FLASH_FLAG_OPTERR) ? (FLASH->OBR & FLASH_FLAG_OPTERR) : (FLASH->SR & flag)) ? SET : RESET;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* set up codec register and write the value @codec: the codec id, 0 or 1 @reg: register index @val: data value */ | static void vx_set_codec_reg(struct vx_core *chip, int codec, int reg, int val) | /* set up codec register and write the value @codec: the codec id, 0 or 1 @reg: register index @val: data value */
static void vx_set_codec_reg(struct vx_core *chip, int codec, int reg, int val) | {
union vx_codec_data data;
SET_CDC_DATA_INIT(data);
SET_CDC_DATA_REG(data, reg);
SET_CDC_DATA_VAL(data, val);
vx_write_codec_reg(chip, codec, data.l);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Reads and returns the current value of MM4. This function is only available on IA-32 and X64. */ | UINT64 EFIAPI AsmReadMm4(VOID) | /* Reads and returns the current value of MM4. This function is only available on IA-32 and X64. */
UINT64 EFIAPI AsmReadMm4(VOID) | {
UINT64 Data;
__asm__ __volatile__ (
"movd %%mm4, %0 \n\t"
: "=r" (Data)
);
return Data;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* pio_irq_disable - Disables irq generation for one endpoint @ep: udc endpoint */ | static void pio_irq_disable(struct pxa_ep *ep) | /* pio_irq_disable - Disables irq generation for one endpoint @ep: udc endpoint */
static void pio_irq_disable(struct pxa_ep *ep) | {
struct pxa_udc *udc = ep->dev;
int index = EPIDX(ep);
u32 udcicr0 = udc_readl(udc, UDCICR0);
u32 udcicr1 = udc_readl(udc, UDCICR1);
if (index < 16)
udc_writel(udc, UDCICR0, udcicr0 & ~(3 << (index * 2)));
else
udc_writel(udc, UDCICR1, udcicr1 & ~(3 << ((index - 16) * 2)));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Callback function called by PE to inform DPM about PE event. */ | void USBPD_DPM_Notification(uint8_t PortNum, USBPD_NotifyEventValue_TypeDef EventVal) | /* Callback function called by PE to inform DPM about PE event. */
void USBPD_DPM_Notification(uint8_t PortNum, USBPD_NotifyEventValue_TypeDef EventVal) | {
switch(EventVal)
{
case USBPD_NOTIFY_POWER_EXPLICIT_CONTRACT :
Led_Set((PortNum == USBPD_PORT_0 ? LED_PORT0_VBUS : LED_PORT1_VBUS) , LED_MODE_ON, 0);
break;
case USBPD_NOTIFY_REQUEST_ACCEPTED:
if (USBPD_PORTPOWERROLE_SNK == DPM_Params[PortNum].PE_PowerRole)
{
USBPD_SNKRDO_T... | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* Deinitializes peripherals used by the I2C NFCTAG driver. */ | void BSP_NFCTAG_DeInit(uint32_t Instance) | /* Deinitializes peripherals used by the I2C NFCTAG driver. */
void BSP_NFCTAG_DeInit(uint32_t Instance) | {
UNUSED(Instance);
if(Nfctag_Drv != NULL)
{
Nfctag_Drv = NULL;
NfctagInitialized = 0;
}
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Return a mask specifying which quadrants of customer INFO space have been disabled for programming.
Use this function to determine whether programming of customer INFO space has been disabled. */ | uint32_t am_hal_flash_info_program_disable_get(void) | /* Return a mask specifying which quadrants of customer INFO space have been disabled for programming.
Use this function to determine whether programming of customer INFO space has been disabled. */
uint32_t am_hal_flash_info_program_disable_get(void) | {
if ( customer_info_signature_erased() )
{
return 0xFFFFFFFF;
}
if ( !am_hal_flash_customer_info_signature_check() )
{
return 0xFFFFFFFF;
}
return ((AM_REGVAL(AM_HAL_FLASH_INFO_SECURITY_ADDR) &
AM_HAL_FLASH_INFO_SECURITY_ENINFOPRGM_M) ^
AM_HA... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Clear a Group of Pins Atomic.
Clear one or more pins of the given GPIO port to 0 in an atomic operation. */ | void gpio_clear(uint32_t gpioport, uint16_t gpios) | /* Clear a Group of Pins Atomic.
Clear one or more pins of the given GPIO port to 0 in an atomic operation. */
void gpio_clear(uint32_t gpioport, uint16_t gpios) | {
GPIO_BSRR(gpioport) = (gpios << 16);
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Returns zero on success, a negative error code otherwise. */ | static int mtd_ooblayout_find_region(struct mtd_info *mtd, int byte, int *sectionp, struct mtd_oob_region *oobregion, int(*iter)(struct mtd_info *, int section, struct mtd_oob_region *oobregion)) | /* Returns zero on success, a negative error code otherwise. */
static int mtd_ooblayout_find_region(struct mtd_info *mtd, int byte, int *sectionp, struct mtd_oob_region *oobregion, int(*iter)(struct mtd_info *, int section, struct mtd_oob_region *oobregion)) | {
int pos = 0, ret, section = 0;
memset(oobregion, 0, sizeof(*oobregion));
while (1) {
ret = iter(mtd, section, oobregion);
if (ret)
return ret;
if (pos + oobregion->length > byte)
break;
pos += oobregion->length;
section++;
}
oobregion->offset += byte - pos;
oobregion->length -= byte - pos;
*sec... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This file is part of the Simba project. */ | int mock_write_uart_module_init(int res) | /* This file is part of the Simba project. */
int mock_write_uart_module_init(int res) | {
harness_mock_write("uart_module_init()",
NULL,
0);
harness_mock_write("uart_module_init(): return (res)",
&res,
sizeof(res));
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* Before you start, select your target, on the right of the "Load" button */ | int main(void) | /* Before you start, select your target, on the right of the "Load" button */
int main(void) | {
if (TM_DISCO_ButtonOnPressed()) {
printf("Software reset will happen in a moment\n");
Delayms(500);
TM_GENERAL_SystemReset();
}
}
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Gets interrupt status for the specified GPIO port. */ | unsigned long GPIOPinIntStatus(unsigned long ulPort) | /* Gets interrupt status for the specified GPIO port. */
unsigned long GPIOPinIntStatus(unsigned long ulPort) | {
xASSERT(GPIOBaseValid(ulPort));
return(xHWREG(ulPort + GPIO_ISRC));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Carnegie Mellon encourages users to contribute improvements to the Coda project. Contact Peter Braam ( */ | static int coda_symlink_filler(struct file *file, struct page *page) | /* Carnegie Mellon encourages users to contribute improvements to the Coda project. Contact Peter Braam ( */
static int coda_symlink_filler(struct file *file, struct page *page) | {
struct inode *inode = page->mapping->host;
int error;
struct coda_inode_info *cii;
unsigned int len = PAGE_SIZE;
char *p = kmap(page);
lock_kernel();
cii = ITOC(inode);
error = venus_readlink(inode->i_sb, &cii->c_fid, p, &len);
unlock_kernel();
if (error)
goto fail;
SetPageUptodate(page);
kunmap(page);
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Generate a VME bus interrupt at the requested level & vector. Wait for interrupt to be acked. */ | int tsi148_irq_generate(int level, int statid) | /* Generate a VME bus interrupt at the requested level & vector. Wait for interrupt to be acked. */
int tsi148_irq_generate(int level, int statid) | {
u32 tmp;
mutex_lock(&(vme_int));
tmp = ioread32be(tsi148_bridge->base + TSI148_LCSR_VICR);
tmp = (tmp & ~TSI148_LCSR_VICR_STID_M) |
(statid & TSI148_LCSR_VICR_STID_M);
iowrite32be(tmp, tsi148_bridge->base + TSI148_LCSR_VICR);
tmp = tmp | TSI148_LCSR_VICR_IRQL[level];
iowrite32be(tmp, tsi148_bridge->base + TS... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Locking Note: The lport lock is expected to be held before calling this routine. */ | static void fc_lport_enter_ready(struct fc_lport *) | /* Locking Note: The lport lock is expected to be held before calling this routine. */
static void fc_lport_enter_ready(struct fc_lport *) | {
FC_LPORT_DBG(lport, "Entered READY from state %s\n",
fc_lport_state(lport));
fc_lport_state_enter(lport, LPORT_ST_READY);
if (lport->vport)
fc_vport_set_state(lport->vport, FC_VPORT_ACTIVE);
fc_vports_linkchange(lport);
if (!lport->ptp_rdata)
lport->tt.disc_start(fc_lport_disc_callback, lport);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: TRUE if g_value_copy() is possible with @src_type and @dest_type. */ | gboolean g_value_type_compatible(GType src_type, GType dest_type) | /* Returns: TRUE if g_value_copy() is possible with @src_type and @dest_type. */
gboolean g_value_type_compatible(GType src_type, GType dest_type) | {
g_return_val_if_fail (G_TYPE_IS_VALUE (src_type), FALSE);
g_return_val_if_fail (G_TYPE_IS_VALUE (dest_type), FALSE);
return (g_type_is_a (src_type, dest_type) &&
g_type_value_table_peek (dest_type) == g_type_value_table_peek (src_type));
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Sets the network to public or private. Updates the sync byte. */ | void RadioSetPublicNetwork(bool enable) | /* Sets the network to public or private. Updates the sync byte. */
void RadioSetPublicNetwork(bool enable) | {
RadioPublicNetwork.Current = RadioPublicNetwork.Previous = enable;
RadioSetModem( MODEM_LORA );
if( enable == true )
{
SX126xWriteRegister( REG_LR_SYNCWORD, ( LORA_MAC_PUBLIC_SYNCWORD >> 8 ) & 0xFF );
SX126xWriteRegister( REG_LR_SYNCWORD + 1, LORA_MAC_PUBLIC_SYNCWORD & 0xFF );
}
... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Execute task if its the priority is appropriate */ | static bool lv_task_exec(lv_task_t *task) | /* Execute task if its the priority is appropriate */
static bool lv_task_exec(lv_task_t *task) | {
bool exec = false;
uint32_t elp = lv_tick_elaps(task->last_run);
if(elp >= task->period) {
task->last_run = lv_tick_get();
task_deleted = false;
task_created = false;
if(task->task_cb) task->task_cb(task);
if(task_deleted == false) {
if(task->once !=... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Set up the autonegotiation state according to whether we will be negotiating the state or forcing a speed. */ | static void ET1310_PhyAutoNeg(struct et131x_adapter *etdev, bool enable) | /* Set up the autonegotiation state according to whether we will be negotiating the state or forcing a speed. */
static void ET1310_PhyAutoNeg(struct et131x_adapter *etdev, bool enable) | {
u16 data;
MiRead(etdev, PHY_CONTROL, &data);
data &= ~0x1000;
if (enable)
data |= 0x1000;
MiWrite(etdev, PHY_CONTROL, data);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks if a bus off or bus heavy situation occurred. */ | static bool SocketCanIsBusError(void) | /* Checks if a bus off or bus heavy situation occurred. */
static bool SocketCanIsBusError(void) | {
bool result= false;
UtilCriticalSectionEnter();
if (socketCanErrorDetected)
{
result = true;
socketCanErrorDetected = false;
}
UtilCriticalSectionExit();
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* USBD_CtlContinueRx continue receive data on the ctl pipe. */ | USBD_Status USBD_CtlContinueRx(USB_OTG_CORE_HANDLE *pdev, uint8_t *pbuf, uint16_t len) | /* USBD_CtlContinueRx continue receive data on the ctl pipe. */
USBD_Status USBD_CtlContinueRx(USB_OTG_CORE_HANDLE *pdev, uint8_t *pbuf, uint16_t len) | {
USBD_Status ret = USBD_OK;
DCD_EP_PrepareRx (pdev,
0,
pbuf,
len);
return ret;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* EXTI0_IRQHandler This function handles External line 0 interrupt request. */ | void EXTI0_IRQHandler(void) | /* EXTI0_IRQHandler This function handles External line 0 interrupt request. */
void EXTI0_IRQHandler(void) | {
if (EXTI_GetITStatus(EXTI_Line0) != RESET)
{
STM_EVAL_LEDOn(LED6);
EXTI_ClearITPendingBit(EXTI_Line0);
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This file is part of the Simba project. */ | int mock_write_exti_module_init(int res) | /* This file is part of the Simba project. */
int mock_write_exti_module_init(int res) | {
harness_mock_write("exti_module_init()",
NULL,
0);
harness_mock_write("exti_module_init(): return (res)",
&res,
sizeof(res));
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* Convert the physical PCI Express MMIO addresses for all registered PCI devices to virtual addresses. */ | VOID EFIAPI DxeRuntimePciSegmentLibVirtualNotify(IN EFI_EVENT Event, IN VOID *Context) | /* Convert the physical PCI Express MMIO addresses for all registered PCI devices to virtual addresses. */
VOID EFIAPI DxeRuntimePciSegmentLibVirtualNotify(IN EFI_EVENT Event, IN VOID *Context) | {
UINTN Index;
EFI_STATUS Status;
if (mDxeRuntimePciSegmentLibRegistrationTable == NULL) {
return;
}
for (Index = 0; Index < mDxeRuntimePciSegmentLibNumberOfRuntimeRanges; Index++) {
Status = EfiConvertPointer (0, (VOID **)&(mDxeRuntimePciSegmentLibRegistrationTable[Index].VirtualAddress));
... | tianocore/edk2 | C++ | Other | 4,240 |
/* This is in fact very similar to the above: The open routines always need to watch out for a prepared wrapper handle to use replaced normal I/O. Two cases to consider: */ | int attribute_align_arg mpg123_open_fd(mpg123_handle *mh, int fd) | /* This is in fact very similar to the above: The open routines always need to watch out for a prepared wrapper handle to use replaced normal I/O. Two cases to consider: */
int attribute_align_arg mpg123_open_fd(mpg123_handle *mh, int fd) | {
struct wrap_data* ioh;
if(mh == NULL) return MPG123_ERR;
mpg123_close(mh);
ioh = mh->wrapperdata;
if(ioh != NULL && ioh->iotype == IO_FD)
{
int err;
err = MPG123_LARGENAME(mpg123_replace_reader_handle)(mh, wrap_read, wrap_lseek, wrap_io_cleanup);
if(err != MPG123_OK) return MPG123_ERR;
ioh->fd = fd;
e... | DC-SWAT/DreamShell | C++ | null | 404 |
/* USBD_CtlReceiveStatus receive zero lzngth packet on the ctl pipe. */ | USBD_StatusTypeDef USBD_CtlReceiveStatus(USBD_HandleTypeDef *pdev) | /* USBD_CtlReceiveStatus receive zero lzngth packet on the ctl pipe. */
USBD_StatusTypeDef USBD_CtlReceiveStatus(USBD_HandleTypeDef *pdev) | {
pdev->ep0_state = USBD_EP0_STATUS_OUT;
USBD_LL_PrepareReceive(pdev, 0U, NULL, 0U);
return USBD_OK;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* We do async lookups on rsb's that need new masters. The rsb's waiting for a lookup reply are kept on the recover_list. */ | static int recover_master(struct dlm_rsb *r) | /* We do async lookups on rsb's that need new masters. The rsb's waiting for a lookup reply are kept on the recover_list. */
static int recover_master(struct dlm_rsb *r) | {
struct dlm_ls *ls = r->res_ls;
int error, dir_nodeid, ret_nodeid, our_nodeid = dlm_our_nodeid();
dir_nodeid = dlm_dir_nodeid(r);
if (dir_nodeid == our_nodeid) {
error = dlm_dir_lookup(ls, our_nodeid, r->res_name,
r->res_length, &ret_nodeid);
if (error)
log_error(ls, "recover dir lookup error %d"... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Converts a text device path node to URI device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUri(CHAR16 *TextDeviceNode) | /* Converts a text device path node to URI device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUri(CHAR16 *TextDeviceNode) | {
CHAR16 *UriStr;
UINTN UriLength;
URI_DEVICE_PATH *Uri;
UriStr = GetNextParamStr (&TextDeviceNode);
UriLength = StrnLenS (UriStr, MAX_UINT16 - sizeof (URI_DEVICE_PATH));
Uri = (URI_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
... | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables or disables the peripheral Preload register on CCM1. */ | void TMR_ConfigOC1Preload(TMR_T *tmr, TMR_OC_PRELOAD_T OCPreload) | /* Enables or disables the peripheral Preload register on CCM1. */
void TMR_ConfigOC1Preload(TMR_T *tmr, TMR_OC_PRELOAD_T OCPreload) | {
tmr->CCM1_COMPARE_B.OC1PEN = OCPreload;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Converts a text device path node to Vendor defined VT100 Plus device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVenVt100Plus(CHAR16 *TextDeviceNode) | /* Converts a text device path node to Vendor defined VT100 Plus device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVenVt100Plus(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, &gEfiVT100PlusGuid);
... | tianocore/edk2 | C++ | Other | 4,240 |
/* Set the callback that controls the sourcing of VCONN from the Device Policy Manager. */ | void usbc_set_vconn_control_cb(const struct device *dev, const tcpc_vconn_control_cb_t cb) | /* Set the callback that controls the sourcing of VCONN from the Device Policy Manager. */
void usbc_set_vconn_control_cb(const struct device *dev, const tcpc_vconn_control_cb_t cb) | {
struct usbc_port_data *data = dev->data;
const struct device *tcpc = data->tcpc;
tcpc_set_vconn_cb(tcpc, cb);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Optimization used to recover some slots in ddr3 inst_rom could be applied to other protocols if we wanted to */ | static void set_jump_as_return(struct socfpga_sdrseq *seq) | /* Optimization used to recover some slots in ddr3 inst_rom could be applied to other protocols if we wanted to */
static void set_jump_as_return(struct socfpga_sdrseq *seq) | {
writel(0xff, &sdr_rw_load_mgr_regs->load_cntr0);
writel(seq->rwcfg->rreturn, &sdr_rw_load_jump_mgr_regs->load_jump_add0);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This function caculate the OS tick from PM tick */ | static rt_tick_t stm32l4_os_tick_from_pm_tick(rt_uint32_t tick) | /* This function caculate the OS tick from PM tick */
static rt_tick_t stm32l4_os_tick_from_pm_tick(rt_uint32_t tick) | {
static rt_uint32_t os_tick_remain = 0;
rt_uint32_t ret, freq;
freq = stm32l4_lptim_get_countfreq();
ret = (tick * RT_TICK_PER_SECOND + os_tick_remain) / freq;
os_tick_remain += (tick * RT_TICK_PER_SECOND);
os_tick_remain %= freq;
return ret;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* socrates_nand_verify_buf - Verify chip data against buffer @mtd: MTD device structure @buf: buffer containing the data to compare @len: number of bytes to compare */ | static int socrates_nand_verify_buf(struct mtd_info *mtd, const u8 *buf, int len) | /* socrates_nand_verify_buf - Verify chip data against buffer @mtd: MTD device structure @buf: buffer containing the data to compare @len: number of bytes to compare */
static int socrates_nand_verify_buf(struct mtd_info *mtd, const u8 *buf, int len) | {
int i;
for (i = 0; i < len; i++) {
if (buf[i] != socrates_nand_read_byte(mtd))
return -EFAULT;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return the first image record, whose covered by . */ | STATIC IMAGE_PROPERTIES_RECORD* GetImageRecordByAddress(IN EFI_PHYSICAL_ADDRESS Buffer, IN UINT64 Length, IN LIST_ENTRY *ImageRecordList) | /* Return the first image record, whose covered by . */
STATIC IMAGE_PROPERTIES_RECORD* GetImageRecordByAddress(IN EFI_PHYSICAL_ADDRESS Buffer, IN UINT64 Length, IN LIST_ENTRY *ImageRecordList) | {
IMAGE_PROPERTIES_RECORD *ImageRecord;
LIST_ENTRY *ImageRecordLink;
for (ImageRecordLink = ImageRecordList->ForwardLink;
ImageRecordLink != ImageRecordList;
ImageRecordLink = ImageRecordLink->ForwardLink)
{
ImageRecord = CR (
ImageRecordLink,
... | tianocore/edk2 | C++ | Other | 4,240 |
/* This function returns %0 on success and a negative error code on failure. */ | int ubifs_log_post_commit(struct ubifs_info *c, int old_ltail_lnum) | /* This function returns %0 on success and a negative error code on failure. */
int ubifs_log_post_commit(struct ubifs_info *c, int old_ltail_lnum) | {
int lnum, err = 0;
while (!list_empty(&c->old_buds)) {
struct ubifs_bud *bud;
bud = list_entry(c->old_buds.next, struct ubifs_bud, list);
err = ubifs_return_leb(c, bud->lnum);
if (err)
return err;
list_del(&bud->list);
kfree(bud);
}
mutex_lock(&c->log_mutex);
for (lnum = old_ltail_lnum; lnum != c-... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This function disables the Hibernation module for operation. After this function is called, none of the Hibernation module features are available. */ | void HibernateDisable(void) | /* This function disables the Hibernation module for operation. After this function is called, none of the Hibernation module features are available. */
void HibernateDisable(void) | {
HWREG(HIB_CTL) &= ~HIB_CTL_CLK32EN;
HibernateWriteComplete();
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Generates a multicast address hash value which is used to determine the multicast filter table array address and new table value. See igb_mta_set() */ | static u32 igb_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr) | /* Generates a multicast address hash value which is used to determine the multicast filter table array address and new table value. See igb_mta_set() */
static u32 igb_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr) | {
u32 hash_value, hash_mask;
u8 bit_shift = 0;
hash_mask = (hw->mac.mta_reg_count * 32) - 1;
while (hash_mask >> bit_shift != 0xFF)
bit_shift++;
switch (hw->mac.mc_filter_type) {
default:
case 0:
break;
case 1:
bit_shift += 1;
break;
case 2:
bit_shift += 2;
break;
case 3:
bit_shift += 4;
break... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function tries to open and MTD device described by @mtd_dev string, which is first treated as an ASCII number, and if it is not true, it is treated as MTD device name. Returns MTD device description object in case of success and a negative error code in case of failure. */ | static struct mtd_info* __init open_mtd_device(const char *mtd_dev) | /* This function tries to open and MTD device described by @mtd_dev string, which is first treated as an ASCII number, and if it is not true, it is treated as MTD device name. Returns MTD device description object in case of success and a negative error code in case of failure. */
static struct mtd_info* __init open_m... | {
struct mtd_info *mtd;
int mtd_num;
char *endp;
mtd_num = simple_strtoul(mtd_dev, &endp, 0);
if (*endp != '\0' || mtd_dev == endp) {
mtd = get_mtd_device_nm(mtd_dev);
} else
mtd = get_mtd_device(NULL, mtd_num);
return mtd;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This function enable frequency output function and configure frequency clock source and divider. */ | void CLK_EnableCKO(uint32_t u32ClkSrc, uint32_t u32ClkDiv, uint32_t u32ClkDivBy1En) | /* This function enable frequency output function and configure frequency clock source and divider. */
void CLK_EnableCKO(uint32_t u32ClkSrc, uint32_t u32ClkDiv, uint32_t u32ClkDivBy1En) | {
CLK->CLKOCTL = CLK_CLKOCTL_CLKOEN_Msk | u32ClkDiv | (u32ClkDivBy1En << CLK_CLKOCTL_DIV1EN_Pos);
CLK->APBCLK0 |= CLK_APBCLK0_CLKOCKEN_Msk;
CLK->CLKSEL1 = (CLK->CLKSEL1 & (~CLK_CLKSEL1_CLKOSEL_Msk)) | (u32ClkSrc);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Tile-oriented Read Support Contributed by Nancy Cam (Silicon Graphics). Read and decompress a tile of data. The tile is selected by the (x,y,z,s) coordinates. */ | tmsize_t TIFFReadTile(TIFF *tif, void *buf, uint32 x, uint32 y, uint32 z, uint16 s) | /* Tile-oriented Read Support Contributed by Nancy Cam (Silicon Graphics). Read and decompress a tile of data. The tile is selected by the (x,y,z,s) coordinates. */
tmsize_t TIFFReadTile(TIFF *tif, void *buf, uint32 x, uint32 y, uint32 z, uint16 s) | {
if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s))
return ((tmsize_t)(-1));
return (TIFFReadEncodedTile(tif,
TIFFComputeTile(tif, x, y, z, s), buf, (tmsize_t)(-1)));
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Gets the cuurent sd card data transfer status. */ | SDTransferState SD_GetStatus(void) | /* Gets the cuurent sd card data transfer status. */
SDTransferState SD_GetStatus(void) | {
SDCardState cardstate = SD_CARD_TRANSFER;
cardstate = SD_GetState();
if (cardstate == SD_CARD_TRANSFER)
{
return(SD_TRANSFER_OK);
}
else if(cardstate == SD_CARD_ERROR)
{
return (SD_TRANSFER_ERROR);
}
else
{
return(SD_TRANSFER_BUSY);
}
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Returns the available number of integrated USB DMA channels. */ | uint32_t USBDMANumChannels(uint32_t ui32Base) | /* Returns the available number of integrated USB DMA channels. */
uint32_t USBDMANumChannels(uint32_t ui32Base) | {
ASSERT(ui32Base == USB0_BASE);
return (HWREG(ui32Base + USB_O_RAMINFO) >> USB_RAMINFO_DMACHAN_S);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The function returns whether or not the device is Opal Enabled. TRUE means that the device is partially or fully locked. This will perform a Level 0 Discovery and parse the locking feature descriptor */ | BOOLEAN EFIAPI OpalFeatureEnabled(OPAL_DISK_SUPPORT_ATTRIBUTE *SupportedAttributes, TCG_LOCKING_FEATURE_DESCRIPTOR *LockingFeature) | /* The function returns whether or not the device is Opal Enabled. TRUE means that the device is partially or fully locked. This will perform a Level 0 Discovery and parse the locking feature descriptor */
BOOLEAN EFIAPI OpalFeatureEnabled(OPAL_DISK_SUPPORT_ATTRIBUTE *SupportedAttributes, TCG_LOCKING_FEATURE_DESCRIPTOR... | {
NULL_CHECK (SupportedAttributes);
NULL_CHECK (LockingFeature);
if (!OpalFeatureSupported (SupportedAttributes)) {
return FALSE;
}
if (LockingFeature->LockingSupported && LockingFeature->LockingEnabled) {
return TRUE;
}
return FALSE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Initialize the Hashcrypt engine for new operation.
This function sets NEW and MODE fields in Hashcrypt Control register to start new operation. */ | static void hashcrypt_engine_init(HASHCRYPT_Type *base, hashcrypt_algo_t algo) | /* Initialize the Hashcrypt engine for new operation.
This function sets NEW and MODE fields in Hashcrypt Control register to start new operation. */
static void hashcrypt_engine_init(HASHCRYPT_Type *base, hashcrypt_algo_t algo) | {
base->CTRL = HASHCRYPT_CTRL_NEW_HASH(1);
base->CTRL = HASHCRYPT_CTRL_MODE(algo) | HASHCRYPT_CTRL_NEW_HASH(1);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* hibernation_set_ops - set the global hibernate operations @ops: the hibernation operations to use in subsequent hibernation transitions */ | void hibernation_set_ops(struct platform_hibernation_ops *ops) | /* hibernation_set_ops - set the global hibernate operations @ops: the hibernation operations to use in subsequent hibernation transitions */
void hibernation_set_ops(struct platform_hibernation_ops *ops) | {
if (ops && !(ops->begin && ops->end && ops->pre_snapshot
&& ops->prepare && ops->finish && ops->enter && ops->pre_restore
&& ops->restore_cleanup)) {
WARN_ON(1);
return;
}
mutex_lock(&pm_mutex);
hibernation_ops = ops;
if (ops)
hibernation_mode = HIBERNATION_PLATFORM;
else if (hibernation_mode =... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* perform checks if the last bit was not incorrect */ | static void rc5_modify_last_bit(trc5_last_bit_type bit) | /* perform checks if the last bit was not incorrect */
static void rc5_modify_last_bit(trc5_last_bit_type bit) | {
if(RC5_NAN != bit){
if(RC5_INV != rc5_tmp_packet.last_bit){
rc5_tmp_packet.last_bit = bit;
rc5_write_bit(rc5_tmp_packet.last_bit);
}else{
rc5_reset_packet();
}
}
} | liuxuming/trochili | C++ | Apache License 2.0 | 132 |
/* Wait for I/O to driver to complete and unregister PPP channel. This is already done by the close routine, so just call that. */ | static int ppp_sync_hangup(struct tty_struct *tty) | /* Wait for I/O to driver to complete and unregister PPP channel. This is already done by the close routine, so just call that. */
static int ppp_sync_hangup(struct tty_struct *tty) | {
ppp_sync_close(tty);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Process the ICMPv6 error packet, and deliver the packet to upper layer. */ | EFI_STATUS Ip6ProcessIcmpError(IN IP6_SERVICE *IpSb, IN EFI_IP6_HEADER *Head, IN NET_BUF *Packet) | /* Process the ICMPv6 error packet, and deliver the packet to upper layer. */
EFI_STATUS Ip6ProcessIcmpError(IN IP6_SERVICE *IpSb, IN EFI_IP6_HEADER *Head, IN NET_BUF *Packet) | {
IP6_ICMP_ERROR_HEAD Icmp;
if (Packet->TotalSize < sizeof (Icmp)) {
goto DROP;
}
NetbufCopy (Packet, 0, sizeof (Icmp), (UINT8 *)&Icmp);
if (Icmp.Head.Type == ICMP_V6_PACKET_TOO_BIG) {
return Ip6ProcessPacketTooBig (IpSb, Head, Packet);
}
IP6_GET_CLIP_INFO (Packet)->Status = EFI_ICMP_ERROR;
ret... | tianocore/edk2 | C++ | Other | 4,240 |
/* This function retrieves a pointer to the currently selected icon in an icon group. */ | struct wtk_icon_button* wtk_icon_group_get_selected(struct wtk_icon_group *group) | /* This function retrieves a pointer to the currently selected icon in an icon group. */
struct wtk_icon_button* wtk_icon_group_get_selected(struct wtk_icon_group *group) | {
Assert(group);
return group->selected;
} | memfault/zero-to-main | C++ | null | 200 |
/* Set up the internal fields in the SCSI command. */ | static __inline__ void initialize_SCp(Scsi_Cmnd *cmd) | /* Set up the internal fields in the SCSI command. */
static __inline__ void initialize_SCp(Scsi_Cmnd *cmd) | {
if (scsi_bufflen(cmd)) {
cmd->SCp.buffer = scsi_sglist(cmd);
cmd->SCp.buffers_residual = scsi_sg_count(cmd) - 1;
cmd->SCp.ptr = sg_virt(cmd->SCp.buffer);
cmd->SCp.this_residual = cmd->SCp.buffer->length;
} else {
cmd->SCp.buffer = NULL;
cmd->SCp.buffers_residual = 0;
cmd->SCp.ptr = NULL;
cmd->SCp.th... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Determines if the system thermal state supports a capsule update. */ | EFI_STATUS EFIAPI CheckSystemThermal(OUT BOOLEAN *Good) | /* Determines if the system thermal state supports a capsule update. */
EFI_STATUS EFIAPI CheckSystemThermal(OUT BOOLEAN *Good) | {
if (LookupCapsuleUpdatePolicyProtocol ()) {
return mCapsuleUpdatePolicy->CheckSystemThermal (mCapsuleUpdatePolicy, Good);
}
*Good = TRUE;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* reg_callback - inform TIPC user about current operating mode */ | static void reg_callback(struct tipc_user *user_ptr) | /* reg_callback - inform TIPC user about current operating mode */
static void reg_callback(struct tipc_user *user_ptr) | {
tipc_mode_event cb;
void *arg;
spin_lock_bh(®_lock);
cb = user_ptr->callback;
arg = user_ptr->usr_handle;
spin_unlock_bh(®_lock);
if (cb)
cb(arg, tipc_mode, tipc_own_addr);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration of the USB device after enumeration, and configures the RNDIS device endpoints and starts the relevant tasks. */ | void EVENT_USB_Device_ConfigurationChanged(void) | /* Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration of the USB device after enumeration, and configures the RNDIS device endpoints and starts the relevant tasks. */
void EVENT_USB_Device_ConfigurationChanged(void) | {
bool ConfigSuccess = true;
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_TX_EPADDR, EP_TYPE_BULK, CDC_TXRX_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_RX_EPADDR, EP_TYPE_BULK, CDC_TXRX_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPADDR, EP_TYPE_INTERRUPT, CDC_NOTIFIC... | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Registers an interrupt handler for a GPIO port. */ | void GPIOIntRegister(unsigned long ulPort, void(*pfnIntHandler)(void)) | /* Registers an interrupt handler for a GPIO port. */
void GPIOIntRegister(unsigned long ulPort, void(*pfnIntHandler)(void)) | {
ASSERT(GPIOBaseValid(ulPort));
ulPort = GPIOGetIntNumber(ulPort);
IntRegister(ulPort, pfnIntHandler);
IntEnable(ulPort);
} | micropython/micropython | C++ | Other | 18,334 |
/* param base pointer to FLEXIO_MCULCD_Type structure. param handle FlexIO MCULCD eDMA handle pointer. */ | void FLEXIO_MCULCD_TransferAbortEDMA(FLEXIO_MCULCD_Type *base, flexio_mculcd_edma_handle_t *handle) | /* param base pointer to FLEXIO_MCULCD_Type structure. param handle FlexIO MCULCD eDMA handle pointer. */
void FLEXIO_MCULCD_TransferAbortEDMA(FLEXIO_MCULCD_Type *base, flexio_mculcd_edma_handle_t *handle) | {
assert(NULL != handle);
if (NULL != handle->txDmaHandle)
{
EDMA_AbortTransfer(handle->txDmaHandle);
}
if (NULL != handle->rxDmaHandle)
{
EDMA_AbortTransfer(handle->rxDmaHandle);
}
FLEXIO_MCULCD_EnableTxDMA(handle->base, false);
FLEXIO_MCULCD_EnableRxDMA(handle->base... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Configure PTRA register, data in this address will be read out to do the CRYPT calculation. */ | void CRYPT_AddressAConfig(uint16_t AddrA) | /* Configure PTRA register, data in this address will be read out to do the CRYPT calculation. */
void CRYPT_AddressAConfig(uint16_t AddrA) | {
assert_parameters(IS_CRYPT_ADDR(AddrA));
CRYPT->PTRA = AddrA & CRYPT_PTRA_PTRA;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Constructor variant for modules (where we know from /proc/modules where they are loaded) and for vmlinux, where only after we load all the symbols we'll know where it starts and ends. */ | static struct map * map__new2(u64 start, struct dso *dso, enum map_type type) | /* Constructor variant for modules (where we know from /proc/modules where they are loaded) and for vmlinux, where only after we load all the symbols we'll know where it starts and ends. */
static struct map * map__new2(u64 start, struct dso *dso, enum map_type type) | {
struct map *self = malloc(sizeof(*self));
if (self != NULL) {
map__init(self, type, start, 0, 0, dso);
}
return self;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Creates a new SSL_CTX object as framework to establish TLS/SSL enabled connections. */ | VOID* EFIAPI CryptoServiceTlsCtxNew(IN UINT8 MajorVer, IN UINT8 MinorVer) | /* Creates a new SSL_CTX object as framework to establish TLS/SSL enabled connections. */
VOID* EFIAPI CryptoServiceTlsCtxNew(IN UINT8 MajorVer, IN UINT8 MinorVer) | {
return CALL_BASECRYPTLIB (Tls.Services.CtxNew, TlsCtxNew, (MajorVer, MinorVer), NULL);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* get_0124 - turn 0/1/2/4 divider into cycle time @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds. @val: The bank timing register value, shifed down. */ | static unsigned int get_0124(unsigned long hclk_tns, unsigned long val) | /* get_0124 - turn 0/1/2/4 divider into cycle time @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds. @val: The bank timing register value, shifed down. */
static unsigned int get_0124(unsigned long hclk_tns, unsigned long val) | {
val &= 3;
return hclk_tns * ((val == 3) ? 4 : val);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The accuracy of the interrupt timing depends on the Ethernet timer update frequency and the subsecond increment value currently in use. The interrupt is generated on the first timer increment that causes the system time to be greater than or equal to the target time set. */ | void EMACTimestampTargetSet(uint32_t ui32Base, uint32_t ui32Seconds, uint32_t ui32SubSeconds) | /* The accuracy of the interrupt timing depends on the Ethernet timer update frequency and the subsecond increment value currently in use. The interrupt is generated on the first timer increment that causes the system time to be greater than or equal to the target time set. */
void EMACTimestampTargetSet(uint32_t ui32B... | {
ASSERT(ui32Base == EMAC0_BASE);
while(HWREG(ui32Base + EMAC_O_TARGNANO) & EMAC_TARGNANO_TRGTBUSY)
{
}
HWREG(ui32Base + EMAC_O_TARGSEC) = ui32Seconds;
HWREG(ui32Base + EMAC_O_TARGNANO) = ui32SubSeconds;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Forces or releases High Speed APB (APB2) peripheral reset. */ | void RCC_APB2PeriphResetCmd(uint32_t RCC_APB2Periph, FunctionalState NewState) | /* Forces or releases High Speed APB (APB2) peripheral reset. */
void RCC_APB2PeriphResetCmd(uint32_t RCC_APB2Periph, FunctionalState NewState) | {
assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
RCC->APB2RSTR |= RCC_APB2Periph;
}
else
{
RCC->APB2RSTR &= ~RCC_APB2Periph;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Performs an atomic compare exchange operation on the 64-bit unsigned integer specified by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. The compare exchange operation must be performed using MP... | UINT64 EFIAPI InternalSyncCompareExchange64(IN OUT volatile UINT64 *Value, IN UINT64 CompareValue, IN UINT64 ExchangeValue) | /* Performs an atomic compare exchange operation on the 64-bit unsigned integer specified by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. The compare exchange operation must be performed using MP... | {
__asm__ __volatile__ (
"lock \n\t"
"cmpxchg8b (%1) \n\t"
: "+A" (CompareValue)
: "S" (Value),
"b" ((UINT32) ExchangeValue),
"c" ((UINT32) (ExchangeValue >> 32))
: "memory",
"cc"
);
return CompareValue;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Output a single byte to the serial port. */ | void serial_putc(const char c) | /* Output a single byte to the serial port. */
void serial_putc(const char c) | {
int tmo;
if (c == '\n')
serial_putc ('\r');
tmo = get_timer (0) + 1 * CONFIG_SYS_HZ;
while (IO_SYSFLG1 & SYSFLG1_UTXFF)
if (get_timer (0) > tmo)
break;
IO_UARTDR1 = c;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Pass control to next thread that is in READY state. */ | osStatus osThreadYield(void) | /* Pass control to next thread that is in READY state. */
osStatus osThreadYield(void) | {
if (k_is_in_isr()) {
return osErrorISR;
}
k_yield();
return osOK;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* The function is used to read Rx data from RX FIFO. */ | uint32_t SCUART_Read(SC_T *sc, uint8_t pu8RxBuf[], uint32_t u32ReadBytes) | /* The function is used to read Rx data from RX FIFO. */
uint32_t SCUART_Read(SC_T *sc, uint8_t pu8RxBuf[], uint32_t u32ReadBytes) | {
uint32_t u32Count;
for (u32Count = 0UL; u32Count < u32ReadBytes; u32Count++)
{
if (SCUART_GET_RX_EMPTY(sc))
{
break;
}
pu8RxBuf[u32Count] = (uint8_t)SCUART_READ(sc);
}
return u32Count;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* start_mpc() puts the MPC on line. All the packets destined to the lec underneath us are now being monitored and shortcuts will be established. */ | static void start_mpc(struct mpoa_client *mpc, struct net_device *dev) | /* start_mpc() puts the MPC on line. All the packets destined to the lec underneath us are now being monitored and shortcuts will be established. */
static void start_mpc(struct mpoa_client *mpc, struct net_device *dev) | {
dprintk("mpoa: (%s) start_mpc:\n", mpc->dev->name);
if (!dev->netdev_ops)
printk("mpoa: (%s) start_mpc not starting\n", dev->name);
else {
mpc->old_ops = dev->netdev_ops;
mpc->new_ops = *mpc->old_ops;
mpc->new_ops.ndo_start_xmit = mpc_send_packet;
dev->netdev_ops = &mpc->new_ops;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Indicates a change in attribute assignment to all subscribed peers. Unconnected bonded peers receive an indication when they next connect. */ | void ble_svc_gatt_changed(uint16_t start_handle, uint16_t end_handle) | /* Indicates a change in attribute assignment to all subscribed peers. Unconnected bonded peers receive an indication when they next connect. */
void ble_svc_gatt_changed(uint16_t start_handle, uint16_t end_handle) | {
ble_svc_gatt_start_handle = start_handle;
ble_svc_gatt_end_handle = end_handle;
ble_gatts_chr_updated(ble_svc_gatt_changed_val_handle);
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* free all resources used by low layer and stops audio-play function */ | static uint8_t deinit(void) | /* free all resources used by low layer and stops audio-play function */
static uint8_t deinit(void) | {
audio_state = AD_STATE_INACTIVE;
return AD_OK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* make header for precompiled chunks if you change the code below be sure to update LoadHeader and FORMAT above and LUAC_HEADERSIZE in lundump.h */ | void luaU_header(lu_byte *h) | /* make header for precompiled chunks if you change the code below be sure to update LoadHeader and FORMAT above and LUAC_HEADERSIZE in lundump.h */
void luaU_header(lu_byte *h) | {
int x=1;
memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-sizeof(char));
h+=sizeof(LUA_SIGNATURE)-sizeof(char);
*h++=cast_byte(VERSION_INT);
*h++=cast_byte(FORMAT);
*h++=cast_byte(*(char*)&x);
*h++=cast_byte(sizeof(int));
*h++=cast_byte(sizeof(size_t));
*h++=cast_byte(sizeof(Instruction));
*h++=cast_byte(sizeof... | opentx/opentx | C++ | GNU General Public License v2.0 | 2,025 |
/* NOTE: It is the responsibility of the caller to kfree buffer */ | int msm_rpc_read(struct msm_rpc_endpoint *ept, void **buffer, unsigned user_len, long timeout) | /* NOTE: It is the responsibility of the caller to kfree buffer */
int msm_rpc_read(struct msm_rpc_endpoint *ept, void **buffer, unsigned user_len, long timeout) | {
struct rr_fragment *frag, *next;
char *buf;
int rc;
rc = __msm_rpc_read(ept, &frag, user_len, timeout);
if (rc <= 0)
return rc;
if (frag->next == 0) {
*buffer = (void*) frag;
return rc;
}
buf = rr_malloc(rc);
*buffer = buf;
while (frag != NULL) {
memcpy(buf, frag->data, frag->length);
next = frag-... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get remain key count of specified Key Store memory. */ | uint32_t KS_GetRemainKeyCount(KS_MEM_Type mem) | /* Get remain key count of specified Key Store memory. */
uint32_t KS_GetRemainKeyCount(KS_MEM_Type mem) | {
uint32_t u32Reg;
uint32_t u32SramRemain, u32FlashRemain;
u32Reg = KS->REMKCNT;
u32SramRemain = (u32Reg & KS_REMKCNT_RRMKCNT_Msk) >> KS_REMKCNT_RRMKCNT_Pos;
u32FlashRemain = (u32Reg & KS_REMKCNT_FRMKCNT_Msk) >> KS_REMKCNT_FRMKCNT_Pos;
if(mem == KS_SRAM)
return u32SramRemain;
else
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function calculates and updates a UINT8 checksum in an ACPI description table header. */ | EFI_STATUS EFIAPI AcpiUpdateChecksum(IN OUT UINT8 *Buffer, IN UINTN Size) | /* This function calculates and updates a UINT8 checksum in an ACPI description table header. */
EFI_STATUS EFIAPI AcpiUpdateChecksum(IN OUT UINT8 *Buffer, IN UINTN Size) | {
UINTN ChecksumOffset;
if ((Buffer == NULL) || (Size == 0)) {
return EFI_INVALID_PARAMETER;
}
ChecksumOffset = OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, Checksum);
Buffer[ChecksumOffset] = 0;
Buffer[ChecksumOffset] = CalculateCheckSum8 (Buffer, Size);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function adds the CA certificate to the list of CAs when requesting Server or Client authentication for the chosen TLS connection. */ | EFI_STATUS EFIAPI TlsSetCaCertificate(IN VOID *Tls, IN VOID *Data, IN UINTN DataSize) | /* This function adds the CA certificate to the list of CAs when requesting Server or Client authentication for the chosen TLS connection. */
EFI_STATUS EFIAPI TlsSetCaCertificate(IN VOID *Tls, IN VOID *Data, IN UINTN DataSize) | {
CALL_CRYPTO_SERVICE (TlsSetCaCertificate, (Tls, Data, DataSize), EFI_UNSUPPORTED);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* spider_net_remove is called to remove the device and unregisters the net_device */ | static void __devexit spider_net_remove(struct pci_dev *pdev) | /* spider_net_remove is called to remove the device and unregisters the net_device */
static void __devexit spider_net_remove(struct pci_dev *pdev) | {
struct net_device *netdev;
struct spider_net_card *card;
netdev = pci_get_drvdata(pdev);
card = netdev_priv(netdev);
wait_event(card->waitq,
atomic_read(&card->tx_timeout_task_counter) == 0);
unregister_netdev(netdev);
spider_net_write_reg(card, SPIDER_NET_CKRCTRL,
SPIDER_NET_CKRCTRL_STOP_VALUE);
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Converts a device node to its string representation. */ | CHAR16* EFIAPI ConvertDeviceNodeToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts) | /* Converts a device node to its string representation. */
CHAR16* EFIAPI ConvertDeviceNodeToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts) | {
if (mDevicePathLibDevicePathToText == NULL) {
mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid);
}
if (mDevicePathLibDevicePathToText != NULL) {
return mDevicePathLibDevicePathToText->ConvertDeviceNodeToText (DeviceNode, DisplayOnly, AllowShortcuts);
... | tianocore/edk2 | C++ | Other | 4,240 |
/* This function tries to fill 512-byte ATAPI_IDENTIFY_DATA for ATAPI device to implement Identify() interface for DiskInfo protocol. The ATA command is sent via SCSI Request Packet. */ | EFI_STATUS AtapiIdentifyDevice(IN OUT SCSI_DISK_DEV *ScsiDiskDevice) | /* This function tries to fill 512-byte ATAPI_IDENTIFY_DATA for ATAPI device to implement Identify() interface for DiskInfo protocol. The ATA command is sent via SCSI Request Packet. */
EFI_STATUS AtapiIdentifyDevice(IN OUT SCSI_DISK_DEV *ScsiDiskDevice) | {
EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
UINT8 Cdb[6];
ZeroMem (&CommandPacket, sizeof (CommandPacket));
ZeroMem (Cdb, sizeof (Cdb));
Cdb[0] = ATA_CMD_IDENTIFY_DEVICE;
CommandPacket.Timeout = SCSI_DISK_TIMEOUT;
CommandPacket.Cdb ... | tianocore/edk2 | C++ | Other | 4,240 |
/* This function is called each second during the boot manager waits the timeout. */ | VOID EFIAPI PlatformBootManagerWaitCallback(UINT16 TimeoutRemain) | /* This function is called each second during the boot manager waits the timeout. */
VOID EFIAPI PlatformBootManagerWaitCallback(UINT16 TimeoutRemain) | {
EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Black;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION White;
UINT16 Timeout;
Timeout = PcdGet16 (PcdPlatformBootTimeOut);
Black.Raw = 0x00000000;
White.Raw = 0x00FFFFFF;
BootLogoUpdateProgress (
White.Pixel,
Black.Pixel,
L"Start boot o... | tianocore/edk2 | C++ | Other | 4,240 |
/* This function deletes all Simple Font packages from a package list node. This is a internal function. */ | EFI_STATUS RemoveSimpleFontPackages(IN HII_DATABASE_PRIVATE_DATA *Private, IN EFI_HII_HANDLE Handle, IN OUT HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageList) | /* This function deletes all Simple Font packages from a package list node. This is a internal function. */
EFI_STATUS RemoveSimpleFontPackages(IN HII_DATABASE_PRIVATE_DATA *Private, IN EFI_HII_HANDLE Handle, IN OUT HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageList) | {
LIST_ENTRY *ListHead;
HII_SIMPLE_FONT_PACKAGE_INSTANCE *Package;
EFI_STATUS Status;
ListHead = &PackageList->SimpleFontPkgHdr;
while (!IsListEmpty (ListHead)) {
Package = CR (
ListHead->ForwardLink,
HII_SIMPLE_FONT_PACKAGE_IN... | tianocore/edk2 | C++ | Other | 4,240 |
/* This helper function checks if the inode mtime/ctime should be updated or not. If current values of the time-stamps are within the UBIFS inode time granularity, they are not updated. This is an optimization. */ | static int mctime_update_needed(const struct inode *inode, const struct timespec *now) | /* This helper function checks if the inode mtime/ctime should be updated or not. If current values of the time-stamps are within the UBIFS inode time granularity, they are not updated. This is an optimization. */
static int mctime_update_needed(const struct inode *inode, const struct timespec *now) | {
if (!timespec_equal(&inode->i_mtime, now) ||
!timespec_equal(&inode->i_ctime, now))
return 1;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Translate the given offset into the appropriate command and offset. This does the mapping using the 16bit interleave layout defined by M-Systems, and looks like this for a sector pair: +-------- */ | static unsigned int DoC_GetDataOffset(struct mtd_info *mtd, loff_t *from) | /* Translate the given offset into the appropriate command and offset. This does the mapping using the 16bit interleave layout defined by M-Systems, and looks like this for a sector pair: +-------- */
static unsigned int DoC_GetDataOffset(struct mtd_info *mtd, loff_t *from) | {
struct DiskOnChip *this = mtd->priv;
if (this->interleave) {
unsigned int ofs = *from & 0x3ff;
unsigned int cmd;
if (ofs < 512) {
cmd = NAND_CMD_READ0;
ofs &= 0x1ff;
} else if (ofs < 1014) {
cmd = NAND_CMD_READ1;
ofs = (ofs & 0x1ff) + 10;
} else {
cmd = NAND_CMD_READOOB;
ofs = ofs - 1014... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Executes a WBINVD instruction. This function is only available on IA-32 and X64. */ | VOID EFIAPI AsmWbinvd(VOID) | /* Executes a WBINVD instruction. This function is only available on IA-32 and X64. */
VOID EFIAPI AsmWbinvd(VOID) | {
__asm__ __volatile__ ("wbinvd":::"memory");
} | tianocore/edk2 | C++ | Other | 4,240 |
/* basic flash erase, only used with offset aligned to flash page and len a multiple of the flash page size */ | static int eeprom_emu_flash_erase(const struct device *dev, off_t offset, size_t len) | /* basic flash erase, only used with offset aligned to flash page and len a multiple of the flash page size */
static int eeprom_emu_flash_erase(const struct device *dev, off_t offset, size_t len) | {
const struct eeprom_emu_config *dev_config = dev->config;
int rc;
rc = flash_erase(dev_config->flash_dev, dev_config->flash_offset +
offset, len);
return rc;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Writes msr value into into the appropriate "register". Returns 0 on success, non-0 otherwise. Assumes vcpu_load() was already called. */ | int kvm_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data) | /* Writes msr value into into the appropriate "register". Returns 0 on success, non-0 otherwise. Assumes vcpu_load() was already called. */
int kvm_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data) | {
return kvm_x86_ops->set_msr(vcpu, msr_index, data);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* calculate diff between comparator value and current ticks */ | static uint64_t hpet_calculate_diff(HPETTimer *t, uint64_t current) | /* calculate diff between comparator value and current ticks */
static uint64_t hpet_calculate_diff(HPETTimer *t, uint64_t current) | {
if (t->config & HPET_TN_32BIT) {
uint32_t diff, cmp;
cmp = (uint32_t)t->cmp;
diff = cmp - (uint32_t)current;
diff = (int32_t)diff > 0 ? diff : (uint32_t)1;
return (uint64_t)diff;
} else {
uint64_t diff, cmp;
cmp = t->cmp;
diff = cmp - current;
... | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* If Buffer was not allocated with an aligned page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */ | VOID EFIAPI FreeAlignedPages(IN VOID *Buffer, IN UINTN Pages) | /* If Buffer was not allocated with an aligned page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */
VOID EFIAPI FreeAlignedPages(IN VOID *Buffer, IN UINTN Pages) | {
EFI_STATUS Status;
ASSERT (Pages != 0);
Status = gMmst->MmFreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
ASSERT_EFI_ERROR (Status);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function is to set the EBIU(EXTERNAL BUS INTERFACE UNIT). */ | static void rt_hw_ebiu_init(void) | /* This function is to set the EBIU(EXTERNAL BUS INTERFACE UNIT). */
static void rt_hw_ebiu_init(void) | {
*pEBIU_AMBCTL0 = 0xffc2ffc2;
*pEBIU_AMBCTL1 = 0xffc2ffc3;
*pEBIU_AMGCTL = 0x010f;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function makes USB host to recognize the device. */ | void USBD_Start(void) | /* This function makes USB host to recognize the device. */
void USBD_Start(void) | {
USBD_CLR_SE0();
USBD_CLR_INT_FLAG(USBD_INT_BUS | USBD_INT_USB | USBD_INT_FLDET | USBD_INT_WAKEUP);
USBD_ENABLE_INT(USBD_INT_BUS | USBD_INT_USB | USBD_INT_FLDET | USBD_INT_WAKEUP);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* ps2_handle_response() is supposed to be used in interrupt handler to properly store device's response to a command and notify process waiting for completion of the command. */ | int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data) | /* ps2_handle_response() is supposed to be used in interrupt handler to properly store device's response to a command and notify process waiting for completion of the command. */
int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data) | {
if (ps2dev->cmdcnt)
ps2dev->cmdbuf[--ps2dev->cmdcnt] = data;
if (ps2dev->flags & PS2_FLAG_CMD1) {
ps2dev->flags &= ~PS2_FLAG_CMD1;
if (ps2dev->cmdcnt)
wake_up(&ps2dev->wait);
}
if (!ps2dev->cmdcnt) {
ps2dev->flags &= ~PS2_FLAG_CMD;
wake_up(&ps2dev->wait);
}
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write RTC through its registers using MMIO access. */ | STATIC VOID MmioRtcWrite(IN UINTN Address, IN UINT8 Data) | /* Write RTC through its registers using MMIO access. */
STATIC VOID MmioRtcWrite(IN UINTN Address, IN UINT8 Data) | {
MmioWrite8 (
mRtcIndexRegister,
(UINT8)(Address | (UINT8)(MmioRead8 (mRtcIndexRegister) & 0x80))
);
MmioWrite8 (mRtcTargetRegister, Data);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If the node is floppy type then populate the MappingItem. */ | EFI_STATUS DevPathSerialAcpi(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath) | /* If the node is floppy type then populate the MappingItem. */
EFI_STATUS DevPathSerialAcpi(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath) | {
ACPI_HID_DEVICE_PATH *Acpi;
ASSERT (DevicePathNode != NULL);
ASSERT (MappingItem != NULL);
Acpi = (ACPI_HID_DEVICE_PATH *)DevicePathNode;
if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
if (EISA_ID_TO_NUM (Acpi->HID) == 0x0604) {
MappingItem->Mtd = MTDTypeFloppy;
return AppendCSD... | tianocore/edk2 | C++ | Other | 4,240 |
/* This call will set the mode for the @gpio to output. It will set the gpio pin low if value is 0 otherwise it will be high. */ | static int msp71xx_exd_direction_output(struct gpio_chip *chip, unsigned offset, int value) | /* This call will set the mode for the @gpio to output. It will set the gpio pin low if value is 0 otherwise it will be high. */
static int msp71xx_exd_direction_output(struct gpio_chip *chip, unsigned offset, int value) | {
struct msp71xx_exd_gpio_chip *msp71xx_chip =
to_msp71xx_exd_gpio_chip(chip);
msp71xx_exd_gpio_set(chip, offset, value);
__raw_writel(1 << MSP71XX_CFG_OUT_OFFSET(offset), msp71xx_chip->reg);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.