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 |
|---|---|---|---|---|---|---|---|
/* Caller enables or disables an AP from this point onward. */ | EFI_STATUS MpServicesUnitTestEnableDisableAP(IN MP_SERVICES MpServices, IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag) | /* Caller enables or disables an AP from this point onward. */
EFI_STATUS MpServicesUnitTestEnableDisableAP(IN MP_SERVICES MpServices, IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag) | {
return MpServices.Ppi->EnableDisableAP (MpServices.Ppi, ProcessorNumber, EnableAP, HealthFlag);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Initializes the TMRx peripheral registers to their default reset values. */ | void TMR_DeInit(TMR_TypeDef *TMRx) | /* Initializes the TMRx peripheral registers to their default reset values. */
void TMR_DeInit(TMR_TypeDef *TMRx) | {
assert_parameters(IS_TMR_ALL_INSTANCE(TMRx));
TMRx->CTRL &= ~TMR_CTRL_EN;
TMRx->INT = TMR_INT_INT;
TMRx->CTRL = TMR_CTRL_RSTValue;
TMRx->RELOAD = TMR_RELOAD_RSTValue;
TMRx->VALUE = TMR_VALUE_RSTValue;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This is the entry point for the bootloader application and is called by the reset interrupt vector after the C-startup routines executed. */ | void main(void) | /* This is the entry point for the bootloader application and is called by the reset interrupt vector after the C-startup routines executed. */
void main(void) | {
Init();
while (1)
{
LedToggle();
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* (1) Enqueue data nodes. Dequeue and verify order of the data nodes from (1). Verify Tx Queue is empty. */ | ZTEST(tx_q, test_data) | /* (1) Enqueue data nodes. Dequeue and verify order of the data nodes from (1). Verify Tx Queue is empty. */
ZTEST(tx_q, test_data) | {
struct ull_tx_q tx_q;
struct node_tx *node;
struct node_tx nodes[SIZE] = { 0 };
ull_tx_q_init(&tx_q);
for (int i = 0U; i < SIZE; i++) {
ull_tx_q_enqueue_data(&tx_q, &nodes[i]);
}
for (int i = 0U; i < SIZE; i++) {
node = ull_tx_q_dequeue(&tx_q);
zassert_equal_ptr(node, &nodes[i], NULL);
}
node = ull_tx_... | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Routine: cl_eeprom_read_mac_addr Description: read mac address and store it in buf. */ | int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus) | /* Routine: cl_eeprom_read_mac_addr Description: read mac address and store it in buf. */
int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus) | {
uint offset;
int err;
err = cl_eeprom_setup(eeprom_bus);
if (err)
return err;
offset = (cl_eeprom_layout != LAYOUT_LEGACY) ?
MAC_ADDR_OFFSET : MAC_ADDR_OFFSET_LEGACY;
return cl_eeprom_read(offset, buf, 6);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This is actually a contract between the driver and the tty layer outlining how much write room the driver can guarantee will be sent OR BUFFERED. This driver MUST honor the return value. */ | static int hvc_write_room(struct tty_struct *tty) | /* This is actually a contract between the driver and the tty layer outlining how much write room the driver can guarantee will be sent OR BUFFERED. This driver MUST honor the return value. */
static int hvc_write_room(struct tty_struct *tty) | {
struct hvc_struct *hp = tty->driver_data;
if (!hp)
return -1;
return hp->outbuf_size - hp->n_outbuf;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Update the AMP values like snd_hda_codec_amp_update(), but for a stereo widget with the same mask and value. */ | int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid, int direction, int idx, int mask, int val) | /* Update the AMP values like snd_hda_codec_amp_update(), but for a stereo widget with the same mask and value. */
int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid, int direction, int idx, int mask, int val) | {
int ch, ret = 0;
for (ch = 0; ch < 2; ch++)
ret |= snd_hda_codec_amp_update(codec, nid, ch, direction,
idx, mask, val);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* returns: 0 on success Negative error code on failure */ | static int overlay_fixup_phandles(void *fdt, void *fdto) | /* returns: 0 on success Negative error code on failure */
static int overlay_fixup_phandles(void *fdt, void *fdto) | {
int fixups_off, symbols_off;
int property;
fixups_off = fdt_path_offset (fdto, "/__fixups__");
if (fixups_off == -FDT_ERR_NOTFOUND) {
return 0;
}
if (fixups_off < 0) {
return fixups_off;
}
symbols_off = fdt_path_offset (fdt, "/__symbols__");
if (((symbols_off < 0) && (symbols_off != -FDT_E... | tianocore/edk2 | C++ | Other | 4,240 |
/* So we shoe-horn the building of tcpdump with '-DUSE_ETHER_NTOHOST' to make 'init_etherarray()' call the below 'ether_ntohost()' instead. Return TRUE if running under Win-95/98/ME. */ | static BOOL is_win9x(void) | /* So we shoe-horn the building of tcpdump with '-DUSE_ETHER_NTOHOST' to make 'init_etherarray()' call the below 'ether_ntohost()' instead. Return TRUE if running under Win-95/98/ME. */
static BOOL is_win9x(void) | {
OSVERSIONINFO ovi;
DWORD os_ver = GetVersion();
DWORD major_ver = LOBYTE (LOWORD(os_ver));
return (os_ver >= 0x80000000 && major_ver >= 4);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Get number of available slots for messages in a Message Queue. */ | static uint32_t svcRtxMessageQueueGetSpace(osMessageQueueId_t mq_id) | /* Get number of available slots for messages in a Message Queue. */
static uint32_t svcRtxMessageQueueGetSpace(osMessageQueueId_t mq_id) | {
EvrRtxMessageQueueGetSpace(mq, 0U);
return 0U;
}
EvrRtxMessageQueueGetSpace(mq, mq->mp_info.max_blocks - mq->msg_count);
return (mq->mp_info.max_blocks - mq->msg_count);
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed. */ | bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t *const MSInterfaceInfo) | /* Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed. */
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t *const MSInterfaceInfo) | {
bool CommandSuccess;
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
CommandSuccess = SCSI_DecodeSCSICommand(MSInterfaceInfo);
LEDs_SetAllLEDs(LEDMASK_USB_READY);
TicksSinceLastCommand = 0;
return CommandSuccess;
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Worker function to get MP PPI service pointer. */ | MP_SERVICES GetMpService(VOID) | /* Worker function to get MP PPI service pointer. */
MP_SERVICES GetMpService(VOID) | {
EFI_STATUS Status;
MP_SERVICES MpService;
Status = PeiServicesLocatePpi (
&gEdkiiPeiMpServices2PpiGuid,
0,
NULL,
(VOID **)&MpService.Ppi
);
ASSERT_EFI_ERROR (Status);
return MpService;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Clocksource: just a monotonic counter of MCK/16 cycles. We don't care whether or not PIT irqs are enabled. */ | static cycle_t read_pit_clk(struct clocksource *cs) | /* Clocksource: just a monotonic counter of MCK/16 cycles. We don't care whether or not PIT irqs are enabled. */
static cycle_t read_pit_clk(struct clocksource *cs) | {
unsigned long flags;
u32 elapsed;
u32 t;
raw_local_irq_save(flags);
elapsed = pit_cnt;
t = at91_sys_read(AT91_PIT_PIIR);
raw_local_irq_restore(flags);
elapsed += PIT_PICNT(t) * pit_cycle;
elapsed += PIT_CPIV(t);
return elapsed;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function decodes the Move to Color Temperature payload. */ | static void dissect_zcl_color_control_move_to_color_temp(tvbuff_t *tvb, proto_tree *tree, guint *offset) | /* This function decodes the Move to Color Temperature payload. */
static void dissect_zcl_color_control_move_to_color_temp(tvbuff_t *tvb, proto_tree *tree, guint *offset) | {
proto_tree_add_item(tree, hf_zbee_zcl_color_control_color_temp, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
*offset += 2;
proto_tree_add_item(tree, hf_zbee_zcl_color_control_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
*offset += 2;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Return the maximum data that can be queued in one go on a given endpoint so that transfers that are too long can be split. */ | static unsigned get_ep_limit(struct s3c_hsotg_ep *hs_ep) | /* Return the maximum data that can be queued in one go on a given endpoint so that transfers that are too long can be split. */
static unsigned get_ep_limit(struct s3c_hsotg_ep *hs_ep) | {
int index = hs_ep->index;
unsigned maxsize;
unsigned maxpkt;
if (index != 0) {
maxsize = S3C_DxEPTSIZ_XferSize_LIMIT + 1;
maxpkt = S3C_DxEPTSIZ_PktCnt_LIMIT + 1;
} else {
if (hs_ep->dir_in) {
maxsize = 64+64+1;
maxpkt = S3C_DIEPTSIZ0_PktCnt_LIMIT + 1;
} else {
maxsize = 0x3f;
maxpkt = 2;
}
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Description: Reads the ID registers of the PHY at @addr on the @bus, then allocates and returns the phy_device to represent it. */ | static struct phy_device* get_phy_device(struct mii_dev *bus, int addr, phy_interface_t interface) | /* Description: Reads the ID registers of the PHY at @addr on the @bus, then allocates and returns the phy_device to represent it. */
static struct phy_device* get_phy_device(struct mii_dev *bus, int addr, phy_interface_t interface) | {
return get_phy_device_by_mask(bus, 1 << addr, interface);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Core registration and callback routines for MTD drivers and users. */ | static int mtd_cls_suspend(struct device *dev, pm_message_t state) | /* Core registration and callback routines for MTD drivers and users. */
static int mtd_cls_suspend(struct device *dev, pm_message_t state) | {
struct mtd_info *mtd = dev_to_mtd(dev);
if (mtd && mtd->suspend)
return mtd->suspend(mtd);
else
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Host controller drivers should call this routine before calling usb_hcd_giveback_urb(). The HCD's private spinlock must be held and interrupts must be disabled. The actions carried out here are required for URB completion. */ | void usb_hcd_unlink_urb_from_ep(struct usb_hcd *hcd, struct urb *urb) | /* Host controller drivers should call this routine before calling usb_hcd_giveback_urb(). The HCD's private spinlock must be held and interrupts must be disabled. The actions carried out here are required for URB completion. */
void usb_hcd_unlink_urb_from_ep(struct usb_hcd *hcd, struct urb *urb) | {
spin_lock(&hcd_urb_list_lock);
list_del_init(&urb->urb_list);
spin_unlock(&hcd_urb_list_lock);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Verify K_MEM_SLAB_DEFINE() with allocates/frees blocks.
Initialize 3 memory blocks of block size 8 bytes using */ | ZTEST(mslab_api, test_mslab_kdefine) | /* Verify K_MEM_SLAB_DEFINE() with allocates/frees blocks.
Initialize 3 memory blocks of block size 8 bytes using */
ZTEST(mslab_api, test_mslab_kdefine) | {
zassert_equal(k_mem_slab_num_used_get(&kmslab), 0);
zassert_equal(k_mem_slab_num_free_get(&kmslab), BLK_NUM);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* ks8695_get_drvinfo - Retrieve driver information @ndev: The network device to retrieve info about @info: The info structure to fill out. */ | static void ks8695_get_drvinfo(struct net_device *ndev, struct ethtool_drvinfo *info) | /* ks8695_get_drvinfo - Retrieve driver information @ndev: The network device to retrieve info about @info: The info structure to fill out. */
static void ks8695_get_drvinfo(struct net_device *ndev, struct ethtool_drvinfo *info) | {
strlcpy(info->driver, MODULENAME, sizeof(info->driver));
strlcpy(info->version, MODULEVERSION, sizeof(info->version));
strlcpy(info->bus_info, dev_name(ndev->dev.parent),
sizeof(info->bus_info));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This returns the new i2c client, which should be saved for later use with i2c_unregister_device(); or NULL to indicate an error. */ | struct i2c_client* i2c_new_dummy(struct i2c_adapter *adapter, u16 address) | /* This returns the new i2c client, which should be saved for later use with i2c_unregister_device(); or NULL to indicate an error. */
struct i2c_client* i2c_new_dummy(struct i2c_adapter *adapter, u16 address) | {
struct i2c_board_info info = {
I2C_BOARD_INFO("dummy", address),
};
return i2c_new_device(adapter, &info);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* retval #kStatus_Success Slave transfers were successfully started. retval #kStatus_I3C_Busy Slave transfers have already been started on this handle. */ | status_t I3C_SlaveTransferNonBlocking(I3C_Type *base, i3c_slave_handle_t *handle, uint32_t eventMask) | /* retval #kStatus_Success Slave transfers were successfully started. retval #kStatus_I3C_Busy Slave transfers have already been started on this handle. */
status_t I3C_SlaveTransferNonBlocking(I3C_Type *base, i3c_slave_handle_t *handle, uint32_t eventMask) | {
assert(NULL != handle);
if (handle->isBusy)
{
return kStatus_I3C_Busy;
}
I3C_SlaveDisableInterrupts(base, (uint32_t)kSlaveIrqFlags);
(void)memset(&handle->transfer, 0, sizeof(handle->transfer));
handle->eventMask = eventMask | (uint32_t)kI3C_SlaveTransmitEvent | (uint32_t)kI3C_Slav... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function should be used by low level device drivers in a similar way as ether_setup() is used by normal network device drivers */ | static void irda_device_setup(struct net_device *dev) | /* This function should be used by low level device drivers in a similar way as ether_setup() is used by normal network device drivers */
static void irda_device_setup(struct net_device *dev) | {
dev->hard_header_len = 0;
dev->addr_len = LAP_ALEN;
dev->type = ARPHRD_IRDA;
dev->tx_queue_len = 8;
memset(dev->broadcast, 0xff, LAP_ALEN);
dev->mtu = 2048;
dev->flags = IFF_NOARP;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Deinitializes the DAC peripheral registers to their default reset values. */ | void DAC_DeInit(void) | /* Deinitializes the DAC peripheral registers to their default reset values. */
void DAC_DeInit(void) | {
RCC_APB1PeriphResetCmd(RCC_APB1Periph_DAC, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_DAC, DISABLE);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Initialise the serial port with the given baudrate. The settings are always 8 data bits, no parity, 1 stop bit, no start bits. */ | int pxa_init_dev(unsigned int uart_index) | /* Initialise the serial port with the given baudrate. The settings are always 8 data bits, no parity, 1 stop bit, no start bits. */
int pxa_init_dev(unsigned int uart_index) | {
pxa_setbrg_dev (uart_index);
return (0);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Function for generating an 8 bit random number using the internal random generator. */ | static uint32_t rnd8(void) | /* Function for generating an 8 bit random number using the internal random generator. */
static uint32_t rnd8(void) | {
NRF_RNG->EVENTS_VALRDY = 0;
while (NRF_RNG->EVENTS_VALRDY == 0)
{
}
return NRF_RNG->VALUE;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This function gets the structure containing partitioning information for the given device @devt. */ | struct gendisk* get_gendisk(dev_t devt, int *partno) | /* This function gets the structure containing partitioning information for the given device @devt. */
struct gendisk* get_gendisk(dev_t devt, int *partno) | {
struct gendisk *disk = NULL;
if (MAJOR(devt) != BLOCK_EXT_MAJOR) {
struct kobject *kobj;
kobj = kobj_lookup(bdev_map, devt, partno);
if (kobj)
disk = dev_to_disk(kobj_to_dev(kobj));
} else {
struct hd_struct *part;
mutex_lock(&ext_devt_mutex);
part = idr_find(&ext_devt_idr, blk_mangle_minor(MINOR(de... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Calculates the watchdog counter value (wdogcmp0) and scaler (wdogscale) to be installed in the watchdog timer. */ | static uint32_t wdt_atcwdt200_convtime(uint32_t timeout, uint32_t *scaler) | /* Calculates the watchdog counter value (wdogcmp0) and scaler (wdogscale) to be installed in the watchdog timer. */
static uint32_t wdt_atcwdt200_convtime(uint32_t timeout, uint32_t *scaler) | {
int i;
uint32_t rst_period, cnt;
cnt = (uint32_t)((timeout * EXT_CLOCK_FREQ) / 1000);
rst_period = cnt;
for (i = 0; i < 14 && cnt > 0; i++) {
cnt >>= 1;
}
*scaler = i;
return rst_period;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Handler called for Class requests not handled by the USB stack. */ | static int audio_class_handle_req(struct usb_setup_packet *pSetup, int32_t *len, uint8_t **data) | /* Handler called for Class requests not handled by the USB stack. */
static int audio_class_handle_req(struct usb_setup_packet *pSetup, int32_t *len, uint8_t **data) | {
LOG_DBG("bmRT 0x%02x, bR 0x%02x, wV 0x%04x, wI 0x%04x, wL 0x%04x",
pSetup->bmRequestType, pSetup->bRequest, pSetup->wValue,
pSetup->wIndex, pSetup->wLength);
switch (pSetup->RequestType.recipient) {
case USB_REQTYPE_RECIPIENT_INTERFACE:
return handle_interface_req(pSetup, len, data);
default:
LOG_ERR("Req... | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* All files are marked read-only. We don't care about pending delete files so this should be used in 'force' mode only. */ | void mark_files_ro(struct super_block *sb) | /* All files are marked read-only. We don't care about pending delete files so this should be used in 'force' mode only. */
void mark_files_ro(struct super_block *sb) | {
struct file *f;
retry:
file_list_lock();
list_for_each_entry(f, &sb->s_files, f_u.fu_list) {
struct vfsmount *mnt;
if (!S_ISREG(f->f_path.dentry->d_inode->i_mode))
continue;
if (!file_count(f))
continue;
if (!(f->f_mode & FMODE_WRITE))
continue;
f->f_mode &= ~FMODE_WRITE;
if (file_check_... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* NOTE: This routine doesn't need to take the socket lock since it doesn't access any non-constant socket information. */ | static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len) | /* NOTE: This routine doesn't need to take the socket lock since it doesn't access any non-constant socket information. */
static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len) | {
struct sockaddr_tipc *addr = (struct sockaddr_tipc *)uaddr;
u32 portref = tipc_sk_port(sock->sk)->ref;
if (unlikely(!uaddr_len))
return tipc_withdraw(portref, 0, NULL);
if (uaddr_len < sizeof(struct sockaddr_tipc))
return -EINVAL;
if (addr->family != AF_TIPC)
return -EAFNOSUPPORT;
if (addr->addrtype == TI... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* brief Return Frequency of SystickClock return Frequency of Systick Clock */ | uint32_t CLOCK_GetSystickClkFreq(void) | /* brief Return Frequency of SystickClock return Frequency of Systick Clock */
uint32_t CLOCK_GetSystickClkFreq(void) | {
uint32_t freq = 0U;
switch (SYSCON->SYSTICKCLKSEL0)
{
case 0U:
freq = CLOCK_GetCoreSysClkFreq() / (((SYSCON->SYSTICKCLKDIV[0]) & 0xffU) + 1U);
break;
case 1U:
freq = CLOCK_GetFro1MFreq();
break;
case 2U:
freq = CLOCK_GetOs... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enables or disables the tim peripheral Preload register on CCR2. */ | void TIM_OC2PreloadConfig(TIM_TypeDef *tim, TIMOCPE_Typedef preload) | /* Enables or disables the tim peripheral Preload register on CCR2. */
void TIM_OC2PreloadConfig(TIM_TypeDef *tim, TIMOCPE_Typedef preload) | {
MODIFY_REG(tim->CCMR1, TIM_CCMR1_OC2PEN, preload << 8);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Wait for device to signal completion of submitted requests */ | STATIC EFI_STATUS PvScsiWaitForRequestCompletion(IN CONST PVSCSI_DEV *Dev) | /* Wait for device to signal completion of submitted requests */
STATIC EFI_STATUS PvScsiWaitForRequestCompletion(IN CONST PVSCSI_DEV *Dev) | {
EFI_STATUS Status;
UINT32 IntrStatus;
for ( ; ;) {
Status = PvScsiMmioRead32 (Dev, PvScsiRegOffsetIntrStatus, &IntrStatus);
if (EFI_ERROR (Status)) {
return Status;
}
if ((IntrStatus & PVSCSI_INTR_CMPL_MASK) != 0) {
break;
}
gBS->Stall (Dev->WaitForCmpStallInUsecs);
}... | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns the absolute FIFO address for a given endpoint. */ | uint32_t USBFIFOAddrGet(uint32_t ui32Base, uint32_t ui32Endpoint) | /* Returns the absolute FIFO address for a given endpoint. */
uint32_t USBFIFOAddrGet(uint32_t ui32Base, uint32_t ui32Endpoint) | {
return(ui32Base + USB_O_FIFO0 + (ui32Endpoint >> 2));
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* megasas_fire_cmd_gen2 - Sends command to the FW @frame_phys_addr : Physical address of cmd @frame_count : Number of frames for the command @regs : MFI register set */ | static void megasas_fire_cmd_gen2(struct megasas_instance *instance, dma_addr_t frame_phys_addr, u32 frame_count, struct megasas_register_set __iomem *regs) | /* megasas_fire_cmd_gen2 - Sends command to the FW @frame_phys_addr : Physical address of cmd @frame_count : Number of frames for the command @regs : MFI register set */
static void megasas_fire_cmd_gen2(struct megasas_instance *instance, dma_addr_t frame_phys_addr, u32 frame_count, struct megasas_register_set __iomem... | {
writel((frame_phys_addr | (frame_count<<1))|1,
&(regs)->inbound_queue_port);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables the TIM peripheral Main Outputs. */ | void TIM_CtrlPWMOutputs(TIM_TypeDef *TIMx, FunctionalState NewState) | /* Enables or disables the TIM peripheral Main Outputs. */
void TIM_CtrlPWMOutputs(TIM_TypeDef *TIMx, FunctionalState NewState) | {
assert_param(IS_TIM_LIST2_PERIPH(TIMx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
TIMx->BDTR |= TIM_BDTR_MOE;
}
else
{
TIMx->BDTR &= (uint16_t)(~((uint16_t)TIM_BDTR_MOE));
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Gets the value (1 or 0) of the specified pixel from the buffer. */ | uint8_t st7565GetPixel(uint8_t x, uint8_t y) | /* Gets the value (1 or 0) of the specified pixel from the buffer. */
uint8_t st7565GetPixel(uint8_t x, uint8_t y) | {
if ((x >= 128) || (y >= 64)) return 0;
return _st7565buffer[x+ (y/8)*128] & (1 << (7-(y%8)));
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* The central event handler. Send_event() sends an event to the 16-bit subsystem, which then calls the relevant device drivers. Parse_events() interprets the event bits from a card status change report. Do_shutdown() handles the high priority stuff associated with a card removal. */ | static int send_event(struct pcmcia_socket *s, event_t event, int priority) | /* The central event handler. Send_event() sends an event to the 16-bit subsystem, which then calls the relevant device drivers. Parse_events() interprets the event bits from a card status change report. Do_shutdown() handles the high priority stuff associated with a card removal. */
static int send_event(struct pcmci... | {
int ret;
if (s->state & SOCKET_CARDBUS)
return 0;
dev_dbg(&s->dev, "send_event(event %d, pri %d, callback 0x%p)\n",
event, priority, s->callback);
if (!s->callback)
return 0;
if (!try_module_get(s->callback->owner))
return 0;
ret = s->callback->event(s, event, priority);
module_put(s->callback->owner... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Show and set the bonding mode. The bond interface must be down to change the mode. */ | static ssize_t bonding_show_mode(struct device *d, struct device_attribute *attr, char *buf) | /* Show and set the bonding mode. The bond interface must be down to change the mode. */
static ssize_t bonding_show_mode(struct device *d, struct device_attribute *attr, char *buf) | {
struct bonding *bond = to_bond(d);
return sprintf(buf, "%s %d\n",
bond_mode_tbl[bond->params.mode].modename,
bond->params.mode);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* LPUART EDMA receive finished callback function.
This function is called when LPUART EDMA receive finished. It disables the LPUART RX EDMA request and sends kStatus_LPUART_RxIdle to LPUART callback. */ | static void LPUART_ReceiveEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds) | /* LPUART EDMA receive finished callback function.
This function is called when LPUART EDMA receive finished. It disables the LPUART RX EDMA request and sends kStatus_LPUART_RxIdle to LPUART callback. */
static void LPUART_ReceiveEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds) | {
assert(NULL != param);
lpuart_edma_private_handle_t *lpuartPrivateHandle = (lpuart_edma_private_handle_t *)param;
handle = handle;
tcds = tcds;
if (transferDone)
{
LPUART_TransferAbortReceiveEDMA(lpuartPrivateHandle->base, lpuartPrivateHandle->handle);
if (NULL != lpuartPriva... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* register wifi event callback for station or AP mode */ | MX_WIFI_STATUS_T MX_WIFI_RegisterStatusCallback_if(MX_WIFIObject_t *Obj, mx_wifi_status_callback_t cb, void *arg, mwifi_if_t interface) | /* register wifi event callback for station or AP mode */
MX_WIFI_STATUS_T MX_WIFI_RegisterStatusCallback_if(MX_WIFIObject_t *Obj, mx_wifi_status_callback_t cb, void *arg, mwifi_if_t interface) | {
MX_WIFI_STATUS_T rc;
if (NULL == Obj)
{
rc = MX_WIFI_STATUS_ERROR;
}
else
{
if ((mwifi_if_t)MC_SOFTAP == interface)
{
Obj->Runtime.status_cb[1] = cb;
Obj->Runtime.callback_arg[1] = arg;
}
else
{
Obj->Runtime.status_cb[0] = cb;
Obj->Runtime.callback_arg[0] = ... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ | UINT16 EFIAPI PciWrite16(IN UINTN Address, IN UINT16 Value) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciWrite16(IN UINTN Address, IN UINT16 Value) | {
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
return (UINT16)PeiPciLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint16, Value);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Sets the output voltage of the LDO when the device enters deep-sleep mode. */ | void SysCtlLDODeepSleepSet(uint32_t ui32Voltage) | /* Sets the output voltage of the LDO when the device enters deep-sleep mode. */
void SysCtlLDODeepSleepSet(uint32_t ui32Voltage) | {
ASSERT((ui32Voltage == SYSCTL_LDO_0_90V) ||
(ui32Voltage == SYSCTL_LDO_0_95V) ||
(ui32Voltage == SYSCTL_LDO_1_00V) ||
(ui32Voltage == SYSCTL_LDO_1_05V) ||
(ui32Voltage == SYSCTL_LDO_1_10V) ||
(ui32Voltage == SYSCTL_LDO_1_15V) ||
(ui32Voltage == SYS... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Initializes the TIMER Input Capture Time base according to the specified parameters in the timer_handle_t and create the associated handle. */ | ald_status_t ald_timer_ic_init(ald_timer_handle_t *hperh) | /* Initializes the TIMER Input Capture Time base according to the specified parameters in the timer_handle_t and create the associated handle. */
ald_status_t ald_timer_ic_init(ald_timer_handle_t *hperh) | {
return ald_timer_base_init(hperh);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Architectures that do not implement save_stack_trace_tsk get this weak alias and a once-per-bootup warning (whenever this facility is utilized - for example by procfs): */ | __weak void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) | /* Architectures that do not implement save_stack_trace_tsk get this weak alias and a once-per-bootup warning (whenever this facility is utilized - for example by procfs): */
__weak void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) | {
WARN_ONCE(1, KERN_INFO "save_stack_trace_tsk() not implemented yet.\n");
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Clear the specified pin interrupts.
Clears the specified pin interrupts. Edge-triggered interrupts must be cleared by software. */ | void gpio_int_clear(uint16_t gpios) | /* Clear the specified pin interrupts.
Clears the specified pin interrupts. Edge-triggered interrupts must be cleared by software. */
void gpio_int_clear(uint16_t gpios) | {
GPIO_INTEOI_A |= gpios;
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* Make the transfer_buffer contiguous by copying from the iso descriptors if necessary. */ | static int st5481_isoc_flatten(struct urb *urb) | /* Make the transfer_buffer contiguous by copying from the iso descriptors if necessary. */
static int st5481_isoc_flatten(struct urb *urb) | {
struct usb_iso_packet_descriptor *pipd,*pend;
unsigned char *src,*dst;
unsigned int len;
if (urb->status < 0) {
return urb->status;
}
for (pipd = &urb->iso_frame_desc[0],
pend = &urb->iso_frame_desc[urb->number_of_packets],
dst = urb->transfer_buffer;
pipd < pend;
pipd++) {
if (p... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Setup loopback of outgoing multicasts on a sending socket */ | static void set_mcast_loop(struct sock *sk, u_char loop) | /* Setup loopback of outgoing multicasts on a sending socket */
static void set_mcast_loop(struct sock *sk, u_char loop) | {
struct inet_sock *inet = inet_sk(sk);
lock_sock(sk);
inet->mc_loop = loop ? 1 : 0;
release_sock(sk);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Multiply 64.16 fixed point value by (2^scalebits) and convert to 128-bit integer. */ | static force_inline void fixed_64_16_to_int128(int64_t hi, int64_t lo, int64_t *rhi, int64_t *rlo, int scalebits) | /* Multiply 64.16 fixed point value by (2^scalebits) and convert to 128-bit integer. */
static force_inline void fixed_64_16_to_int128(int64_t hi, int64_t lo, int64_t *rhi, int64_t *rlo, int scalebits) | {
hi += lo >> 16;
lo &= 0xFFFF;
if (scalebits <= 0)
{
*rlo = hi >> (-scalebits);
*rhi = *rlo >> 63;
}
else
{
*rhi = hi >> (64 - scalebits);
*rlo = (uint64_t)hi << scalebits;
if (scalebits < 16)
*rlo += lo >> (16 - scalebits);
else
... | xboot/xboot | C++ | MIT License | 779 |
/* Return if hash alg is supported in HashAlgorithmMask. */ | BOOLEAN EFIAPI IsHashAlgSupportedInHashAlgorithmMask(IN TPMI_ALG_HASH HashAlg, IN UINT32 HashAlgorithmMask) | /* Return if hash alg is supported in HashAlgorithmMask. */
BOOLEAN EFIAPI IsHashAlgSupportedInHashAlgorithmMask(IN TPMI_ALG_HASH HashAlg, IN UINT32 HashAlgorithmMask) | {
switch (HashAlg) {
case TPM_ALG_SHA1:
if ((HashAlgorithmMask & HASH_ALG_SHA1) != 0) {
return TRUE;
}
break;
case TPM_ALG_SHA256:
if ((HashAlgorithmMask & HASH_ALG_SHA256) != 0) {
return TRUE;
}
break;
case TPM_ALG_SHA384:
if ((HashAlgorithmMask &... | tianocore/edk2 | C++ | Other | 4,240 |
/* Decodes the message length according to the MQTT algorithm */ | int MQTTPacket_decode(int(*getcharfn)(unsigned char *, int), int *value) | /* Decodes the message length according to the MQTT algorithm */
int MQTTPacket_decode(int(*getcharfn)(unsigned char *, int), int *value) | {
int rc = MQTTPACKET_READ_ERROR;
if (++len > MAX_NO_OF_REMAINING_LENGTH_BYTES) {
rc = MQTTPACKET_READ_ERROR;
goto exit;
}
rc = (*getcharfn)(&c, 1);
if (rc != 1)
goto exit;
*value += (c & 127) * multiplier;
multiplier *= 128;
... | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* HID class driver callback function for the creation of HID reports to the host. */ | bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t *const HIDInterfaceInfo, uint8_t *const ReportID, const uint8_t ReportType, void *ReportData, uint16_t *const ReportSize) | /* HID class driver callback function for the creation of HID reports to the host. */
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t *const HIDInterfaceInfo, uint8_t *const ReportID, const uint8_t ReportType, void *ReportData, uint16_t *const ReportSize) | {
USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
static bool IsKeyReleaseReport;
IsKeyReleaseReport = !IsKeyReleaseReport;
if ((IsKeyReleaseReport) || (CurrentTrackBuffer == &TrackDataBuffers[TOTAL_TRACKS]))
{
KeyboardReport->KeyCode[0] = KEY_NONE;
}
else if (!(CurrentTrack... | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* 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) | {
count++;
TM_OneWire_GetFullROM(&OneWire1, device[count - 1]);
devices = TM_OneWire_Next(&OneWire1);
}
if (count > 0) {
sprintf(buf, "Devices found on 1-wire instance: %d\n", count);
TM_USART_Puts(USART1, buf);
for (j = 0; j < count; j++) {
for (i = 0; i < 8; i++) {
sprintf(buf, "0x%02X ", device[... | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Configures the PLL clock source and multiplication factor. */ | void RCC_PLLConfig(uint32_t RCC_PLLSource, uint32_t RCC_PLLMul) | /* Configures the PLL clock source and multiplication factor. */
void RCC_PLLConfig(uint32_t RCC_PLLSource, uint32_t RCC_PLLMul) | {
uint32_t tmpreg = 0;
assert_param(IS_RCC_PLL_SOURCE(RCC_PLLSource));
assert_param(IS_RCC_PLL_MUL(RCC_PLLMul));
tmpreg = RCC->CFGR;
tmpreg &= CFGR_PLL_Mask;
tmpreg |= RCC_PLLSource | RCC_PLLMul;
RCC->CFGR = tmpreg;
} | gcallipo/RadioDSP-Stm32f103 | C++ | Common Creative - Attribution 3.0 | 51 |
/* We unregister by all the data we used to register instead of by pointer to the @entry array because we might have used the same table for a bunch of IDs (for example). */ | int uwb_est_unregister(u8 type, u8 event_high, u16 vendor, u16 product, const struct uwb_est_entry *entry, size_t entries) | /* We unregister by all the data we used to register instead of by pointer to the @entry array because we might have used the same table for a bunch of IDs (for example). */
int uwb_est_unregister(u8 type, u8 event_high, u16 vendor, u16 product, const struct uwb_est_entry *entry, size_t entries) | {
unsigned long flags;
unsigned itr;
struct uwb_est est_cmp = {
.type_event_high = type << 8 | event_high,
.vendor = vendor,
.product = product,
.entry = entry,
.entries = entries
};
write_lock_irqsave(&uwb_est_lock, flags);
for (itr = 0; itr < uwb_est_used; itr++)
if (!memcmp(&uwb_est[itr], &est_cmp,... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* at_dma_off - disable DMA controller @atdma: the Atmel HDAMC device */ | static void at_dma_off(struct at_dma *atdma) | /* at_dma_off - disable DMA controller @atdma: the Atmel HDAMC device */
static void at_dma_off(struct at_dma *atdma) | {
dma_writel(atdma, EN, 0);
dma_writel(atdma, EBCIDR, -1L);
while (dma_readl(atdma, CHSR) & atdma->all_chan_mask)
cpu_relax();
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* De-Initializes the low level portion of the device driver. */ | USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev) | /* De-Initializes the low level portion of the device driver. */
USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev) | {
HAL_StatusTypeDef hal_status = HAL_OK;
USBD_StatusTypeDef usb_status = USBD_OK;
hal_status = HAL_PCD_DeInit(pdev->pData);
switch (hal_status) {
case HAL_OK :
usb_status = USBD_OK;
break;
case HAL_ERROR :
usb_status = USBD_FAIL;
break;
case HAL_BUSY :
usb_status = USBD_BUS... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* The ND command is used to discover and report all modules on its current operating channel (CH parameter) and PAN ID (ID parameter). */ | unsigned long xBeeNodeGet(void) | /* The ND command is used to discover and report all modules on its current operating channel (CH parameter) and PAN ID (ID parameter). */
unsigned long xBeeNodeGet(void) | {
int i=0;
BufferClear();
xBeeUartSendBuf("ATND\r\n",6);
xSysCtlDelay(30000000);
while(BufferLenGet()>=i*48)
{
i++;
}
return i;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* The cluster offset may be an allocated byte offset in the image file, the zero cluster marker, or the unallocated cluster marker. */ | static void qed_update_l2_table(BDRVQEDState *s, QEDTable *table, int index, unsigned int n, uint64_t cluster) | /* The cluster offset may be an allocated byte offset in the image file, the zero cluster marker, or the unallocated cluster marker. */
static void qed_update_l2_table(BDRVQEDState *s, QEDTable *table, int index, unsigned int n, uint64_t cluster) | {
int i;
for (i = index; i < index + n; i++) {
table->offsets[i] = cluster;
if (!qed_offset_is_unalloc_cluster(cluster) &&
!qed_offset_is_zero_cluster(cluster)) {
cluster += s->header.cluster_size;
}
}
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Internal helper notify function in which update the result of the non-blocking SCSI Read/Write commands and signal caller event. */ | VOID EFIAPI ScsiLibNotify(IN EFI_EVENT Event, IN VOID *Context) | /* Internal helper notify function in which update the result of the non-blocking SCSI Read/Write commands and signal caller event. */
VOID EFIAPI ScsiLibNotify(IN EFI_EVENT Event, IN VOID *Context) | {
EFI_SCSI_LIB_ASYNC_CONTEXT *LibContext;
EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket;
EFI_EVENT CallerEvent;
LibContext = (EFI_SCSI_LIB_ASYNC_CONTEXT *)Context;
CommandPacket = &LibContext->CommandPacket;
CallerEvent = LibContext->CallerEvent;
*LibContext->SenseDataL... | tianocore/edk2 | C++ | Other | 4,240 |
/* Slow start is used when congestion window is less than slow start threshold. This version implements the basic RFC2581 version and optionally supports: RFC3742 Limited Slow Start - growth limited to max_ssthresh RFC3465 Appropriate Byte Counting - growth limited by bytes acknowledged */ | void tcp_slow_start(struct tcp_sock *tp) | /* Slow start is used when congestion window is less than slow start threshold. This version implements the basic RFC2581 version and optionally supports: RFC3742 Limited Slow Start - growth limited to max_ssthresh RFC3465 Appropriate Byte Counting - growth limited by bytes acknowledged */
void tcp_slow_start(struct t... | {
int cnt;
if (sysctl_tcp_abc && tp->bytes_acked < tp->mss_cache)
return;
if (sysctl_tcp_max_ssthresh > 0 && tp->snd_cwnd > sysctl_tcp_max_ssthresh)
cnt = sysctl_tcp_max_ssthresh >> 1;
else
cnt = tp->snd_cwnd;
if (sysctl_tcp_abc > 1 && tp->bytes_acked >= 2*tp->mss_cache)
cnt <<= 1;
tp->bytes_acked = 0;
t... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* atl2_link_chg_task - deal with link change event Out of interrupt context @netdev: network interface device structure */ | static void atl2_link_chg_task(struct work_struct *work) | /* atl2_link_chg_task - deal with link change event Out of interrupt context @netdev: network interface device structure */
static void atl2_link_chg_task(struct work_struct *work) | {
struct atl2_adapter *adapter;
unsigned long flags;
adapter = container_of(work, struct atl2_adapter, link_chg_task);
spin_lock_irqsave(&adapter->stats_lock, flags);
atl2_check_link(adapter);
spin_unlock_irqrestore(&adapter->stats_lock, flags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Software SMI handler that is called when an Exit Boot Services event is signalled. Then the SMM Core also install SMM Exit Boot Services protocol to notify SMM driver that system enter exit boot services. */ | EFI_STATUS EFIAPI SmmExitBootServicesHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL) | /* Software SMI handler that is called when an Exit Boot Services event is signalled. Then the SMM Core also install SMM Exit Boot Services protocol to notify SMM driver that system enter exit boot services. */
EFI_STATUS EFIAPI SmmExitBootServicesHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, I... | {
EFI_STATUS Status;
EFI_HANDLE SmmHandle;
UINTN Index;
SmmHandle = NULL;
Status = SmmInstallProtocolInterface (
&SmmHandle,
&gEdkiiSmmExitBootServicesProtocolGuid,
EFI_NATIVE_INTERFACE,
NULL
);
SmiHandlerUnRegister (... | tianocore/edk2 | C++ | Other | 4,240 |
/* Look for "BUS".. Data is not Null terminated. PHBID of 0xFF indicates PHB was not found in VPD Data. */ | static u8 __init iseries_parse_phbid(u8 *area, int len) | /* Look for "BUS".. Data is not Null terminated. PHBID of 0xFF indicates PHB was not found in VPD Data. */
static u8 __init iseries_parse_phbid(u8 *area, int len) | {
while (len > 0) {
if ((*area == 'B') && (*(area + 1) == 'U')
&& (*(area + 2) == 'S')) {
area += 3;
while (*area == ' ')
area++;
return *area & 0x0F;
}
area++;
len--;
}
return 0xff;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* RCC Turn off an Oscillator.
Disable an oscillator and power off. */ | void rcc_osc_off(enum rcc_osc osc) | /* RCC Turn off an Oscillator.
Disable an oscillator and power off. */
void rcc_osc_off(enum rcc_osc osc) | {
switch (osc) {
case RCC_PLL:
RCC_CR &= ~RCC_CR_PLLON;
break;
case RCC_PLL2:
RCC_CR &= ~RCC_CR_PLL2ON;
break;
case RCC_PLL3:
RCC_CR &= ~RCC_CR_PLL3ON;
break;
case RCC_HSE:
RCC_CR &= ~RCC_CR_HSEON;
break;
case RCC_HSI:
RCC_CR &= ~RCC_CR_HSION;
break;
case RCC_LSE:
RCC_BDCR &= ~RCC_BDCR_LSEO... | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* (1) Enqueue ctrl nodes. Dequeue and verify order of the ctrl nodes from (1). Verify Tx Queue is empty. */ | ZTEST(tx_q, test_ctrl) | /* (1) Enqueue ctrl nodes. Dequeue and verify order of the ctrl nodes from (1). Verify Tx Queue is empty. */
ZTEST(tx_q, test_ctrl) | {
struct ull_tx_q tx_q;
struct node_tx *node;
struct node_tx ctrl_nodes1[SIZE] = { 0 };
ull_tx_q_init(&tx_q);
for (int i = 0U; i < SIZE; i++) {
ull_tx_q_enqueue_ctrl(&tx_q, &ctrl_nodes1[i]);
}
for (int i = 0U; i < SIZE; i++) {
node = ull_tx_q_dequeue(&tx_q);
zassert_equal_ptr(node, &ctrl_nodes1[i], NULL);
... | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* sk_filter_rcu_release: Release a socket filter by rcu_head @rcu: rcu_head that contains the sk_filter to free */ | static void sk_filter_rcu_release(struct rcu_head *rcu) | /* sk_filter_rcu_release: Release a socket filter by rcu_head @rcu: rcu_head that contains the sk_filter to free */
static void sk_filter_rcu_release(struct rcu_head *rcu) | {
struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu);
sk_filter_release(fp);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Read the device status register and set the device speed. */ | static void usb_enumfinish_isr(usb_core_instance *pdev) | /* Read the device status register and set the device speed. */
static void usb_enumfinish_isr(usb_core_instance *pdev) | {
usb_ep0activate(&pdev->regs);
usb_setaroundtim(pdev);
WRITE_REG32(pdev->regs.GREGS->GINTSTS, USBFS_GINTSTS_ENUMDNE);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* checks whether destination address filter failed in the rx frame. */ | bool synopGMAC_is_da_filter_failed(DmaDesc *desc) | /* checks whether destination address filter failed in the rx frame. */
bool synopGMAC_is_da_filter_failed(DmaDesc *desc) | {
return ((desc->status & DescDAFilterFail) == DescDAFilterFail);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Check ADC status flag. This function is used to check whether special flag is set or not. */ | xtBoolean SPIIntFlagCheck(unsigned long ulBase, unsigned long ulFlags) | /* Check ADC status flag. This function is used to check whether special flag is set or not. */
xtBoolean SPIIntFlagCheck(unsigned long ulBase, unsigned long ulFlags) | {
xASSERT(ulBase == SPI0_BASE);
xASSERT(ulFlags == SPI_INT_SPIF);
if(xHWREG(ulBase + S0SPINT) & ulFlags)
{
return (xtrue);
}
else
{
return (xfalse);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Emit code to go through if 'e' is true, jump otherwise. */ | void luaK_goiftrue(FuncState *fs, expdesc *e) | /* Emit code to go through if 'e' is true, jump otherwise. */
void luaK_goiftrue(FuncState *fs, expdesc *e) | {
case VJMP: {
negatecondition(fs, e);
pc = e->u.info;
break;
}
case VK: case VKFLT: case VKINT: case VTRUE: {
pc = NO_JUMP;
break;
}
default: {
pc = jumponcond(fs, e, 0);
break;
}
}
luaK_concat(fs, &e->f, pc);
luaK_patchtohere(fs, e->t);
e->t = ... | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* This function changes the mtu of the device. It restarts the device to initialize the descriptor with new receive buffers. */ | static int amd8111e_change_mtu(struct net_device *dev, int new_mtu) | /* This function changes the mtu of the device. It restarts the device to initialize the descriptor with new receive buffers. */
static int amd8111e_change_mtu(struct net_device *dev, int new_mtu) | {
struct amd8111e_priv *lp = netdev_priv(dev);
int err;
if ((new_mtu < AMD8111E_MIN_MTU) || (new_mtu > AMD8111E_MAX_MTU))
return -EINVAL;
if (!netif_running(dev)) {
dev->mtu = new_mtu;
return 0;
}
spin_lock_irq(&lp->lock);
writel(RUN, lp->mmio + CMD0);
dev->mtu = new_mtu;
err = amd8111e_restart(dev);
sp... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Initializes the DAC peripheral according to the specified parameters in the dacConfig. */ | void DAC_Config(uint32_t channel, DAC_Config_T *dacConfig) | /* Initializes the DAC peripheral according to the specified parameters in the dacConfig. */
void DAC_Config(uint32_t channel, DAC_Config_T *dacConfig) | {
uint32_t tmpcfg;
tmpcfg = (dacConfig->trigger | dacConfig->waveGeneration |
dacConfig->maskAmplitudeSelect | dacConfig->outputBuff);
DAC->CTRL = (tmpcfg << channel);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Returns 0 if mmiotrace is disabled, or if the fault is not handled by mmiotrace: */ | static int __kprobes kmmio_fault(struct pt_regs *regs, unsigned long addr) | /* Returns 0 if mmiotrace is disabled, or if the fault is not handled by mmiotrace: */
static int __kprobes kmmio_fault(struct pt_regs *regs, unsigned long addr) | {
if (unlikely(is_kmmio_active()))
if (kmmio_handler(regs, addr) == 1)
return -1;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Handle allocation of temporary space for name translation and handling split directory entries.. The real work is done by "do_isofs_readdir()". */ | static int isofs_readdir(struct file *filp, void *dirent, filldir_t filldir) | /* Handle allocation of temporary space for name translation and handling split directory entries.. The real work is done by "do_isofs_readdir()". */
static int isofs_readdir(struct file *filp, void *dirent, filldir_t filldir) | {
int result;
char *tmpname;
struct iso_directory_record *tmpde;
struct inode *inode = filp->f_path.dentry->d_inode;
tmpname = (char *)__get_free_page(GFP_KERNEL);
if (tmpname == NULL)
return -ENOMEM;
lock_kernel();
tmpde = (struct iso_directory_record *) (tmpname+1024);
result = do_isofs_readdir(inode, filp... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* IDL long BrowserrQueryStatistics( IDL wchar_t *element_47, IDL TYPE_5 **element_48 IDL ); */ | static int dissect_browser_browserr_query_statistics_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | /* IDL long BrowserrQueryStatistics( IDL wchar_t *element_47, IDL TYPE_5 **element_48 IDL ); */
static int dissect_browser_browserr_query_statistics_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | {
offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, di, drep,
NDR_POINTER_UNIQUE, "unknown string",
hf_browser_unknown_string, 0);
return offset;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Compare the Previous Interface Name of two mappings Note : this one is special. */ | static int mapping_cmpprevname(struct if_mapping *ifnode, struct if_mapping *target) | /* Compare the Previous Interface Name of two mappings Note : this one is special. */
static int mapping_cmpprevname(struct if_mapping *ifnode, struct if_mapping *target) | {
return(fnmatch(ifnode->prevname, target->ifname, FNM_CASEFOLD));
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* LSM hook that controls access to unlabelled packets. If a xfrm_state is authorizable (defined by macro) then it was already authorized by the IPSec process. If not, then we need to check for unlabelled access since this may not have gone thru the IPSec process. */ | int selinux_xfrm_sock_rcv_skb(u32 isec_sid, struct sk_buff *skb, struct common_audit_data *ad) | /* LSM hook that controls access to unlabelled packets. If a xfrm_state is authorizable (defined by macro) then it was already authorized by the IPSec process. If not, then we need to check for unlabelled access since this may not have gone thru the IPSec process. */
int selinux_xfrm_sock_rcv_skb(u32 isec_sid, struct ... | {
int i, rc = 0;
struct sec_path *sp;
u32 sel_sid = SECINITSID_UNLABELED;
sp = skb->sp;
if (sp) {
for (i = 0; i < sp->len; i++) {
struct xfrm_state *x = sp->xvec[i];
if (x && selinux_authorizable_xfrm(x)) {
struct xfrm_sec_ctx *ctx = x->security;
sel_sid = ctx->ctx_sid;
break;
}
}
}
rc =... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* this function is a POSIX compliant version, which will get file information. */ | int stat(const char *file, struct stat *buf) | /* this function is a POSIX compliant version, which will get file information. */
int stat(const char *file, struct stat *buf) | {
int result;
result = dfs_file_stat(file, buf);
if (result < 0)
{
rt_set_errno(result);
return -1;
}
return result;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Do the basic setup for the SIIMAGE hardware interface and then do the MMIO setup if we can. This is the first look in we get for setting up the hwif so that we can get the iops right before using them. */ | static void __devinit init_iops_siimage(ide_hwif_t *hwif) | /* Do the basic setup for the SIIMAGE hardware interface and then do the MMIO setup if we can. This is the first look in we get for setting up the hwif so that we can get the iops right before using them. */
static void __devinit init_iops_siimage(ide_hwif_t *hwif) | {
struct pci_dev *dev = to_pci_dev(hwif->dev);
struct ide_host *host = pci_get_drvdata(dev);
hwif->hwif_data = NULL;
hwif->rqsize = 15;
if (host->host_priv)
init_mmio_iops_siimage(hwif);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Attribute read call back for the Aggregate Format attribute. */ | static ssize_t read_agg_format(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) | /* Attribute read call back for the Aggregate Format attribute. */
static ssize_t read_agg_format(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) | {
const struct agg_format_t *value = attr->user_data;
struct agg_format_t agg_format_conv;
agg_format_conv.field_a = sys_cpu_to_le16(value->field_a);
agg_format_conv.field_b = sys_cpu_to_le16(value->field_b);
agg_format_conv.field_c = sys_cpu_to_le16(value->field_c);
return bt_gatt_attr_read(conn, attr, buf, len,... | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Returns a offset of first node which includes the given name. */ | INT32 EFIAPI FdtSubnodeOffsetNameLen(IN CONST VOID *Fdt, IN INT32 ParentOffset, IN CONST CHAR8 *Name, IN INT32 NameLength) | /* Returns a offset of first node which includes the given name. */
INT32 EFIAPI FdtSubnodeOffsetNameLen(IN CONST VOID *Fdt, IN INT32 ParentOffset, IN CONST CHAR8 *Name, IN INT32 NameLength) | {
return fdt_subnode_offset_namelen (Fdt, ParentOffset, Name, NameLength);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Find the matched variable from the input variable storage. */ | VARIABLE_HEADER* FindVariableData(IN VARIABLE_STORE_HEADER *VariableStorage, IN EFI_GUID *VarGuid, IN UINT32 VarAttribute, IN CHAR16 *VarName) | /* Find the matched variable from the input variable storage. */
VARIABLE_HEADER* FindVariableData(IN VARIABLE_STORE_HEADER *VariableStorage, IN EFI_GUID *VarGuid, IN UINT32 VarAttribute, IN CHAR16 *VarName) | {
VARIABLE_HEADER *VariableHeader;
VARIABLE_HEADER *VariableEnd;
VariableEnd = (VARIABLE_HEADER *)((UINT8 *)VariableStorage + VariableStorage->Size);
VariableHeader = (VARIABLE_HEADER *)(VariableStorage + 1);
VariableHeader = (VARIABLE_HEADER *)HEADER_ALIGN (VariableHeader);
while (VariableHeader < Var... | tianocore/edk2 | C++ | Other | 4,240 |
/* Changes the prescaler value of the given RTT and restarts it. This function disables RTT interrupt sources. */ | void RTT_SetPrescaler(AT91S_RTTC *rtt, unsigned short prescaler) | /* Changes the prescaler value of the given RTT and restarts it. This function disables RTT interrupt sources. */
void RTT_SetPrescaler(AT91S_RTTC *rtt, unsigned short prescaler) | {
rtt->RTTC_RTMR = (prescaler | AT91C_RTTC_RTTRST);
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Callback function for events from the Security Dispatcher module. */ | static void smd_evt_handler(smd_evt_t const *p_event) | /* Callback function for events from the Security Dispatcher module. */
static void smd_evt_handler(smd_evt_t const *p_event) | {
switch (p_event->evt_id)
{
case SMD_EVT_BONDING_INFO_STORED:
local_db_update_in_evt(p_event->conn_handle);
break;
default:
break;
}
} | labapart/polymcu | C++ | null | 201 |
/* Allocate a memory block from a Memory Pool. */ | __STATIC_INLINE void* isrRtxMemoryPoolAlloc(osMemoryPoolId_t mp_id, uint32_t timeout) | /* Allocate a memory block from a Memory Pool. */
__STATIC_INLINE void* isrRtxMemoryPoolAlloc(osMemoryPoolId_t mp_id, uint32_t timeout) | {
EvrRtxMemoryPoolError(mp, (int32_t)osErrorParameter);
return NULL;
}
block = osRtxMemoryPoolAlloc(&mp->mp_info);
if (block == NULL) {
EvrRtxMemoryPoolAllocFailed(mp);
} else {
EvrRtxMemoryPoolAllocated(mp, block);
}
return block;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Get the current state of a GPIO input pin */ | static int kinetis_gpio_get_value(struct gpio_chip *chip, unsigned gpio) | /* Get the current state of a GPIO input pin */
static int kinetis_gpio_get_value(struct gpio_chip *chip, unsigned gpio) | {
return (KINETIS_GPIO(KINETIS_GPIO_GETPORT(gpio))->pdir >>
KINETIS_GPIO_GETPIN(gpio)) & 1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns: TRUE if file is a backup file, FALSE otherwise. */ | gboolean g_file_info_get_is_backup(GFileInfo *info) | /* Returns: TRUE if file is a backup file, FALSE otherwise. */
gboolean g_file_info_get_is_backup(GFileInfo *info) | {
static guint32 attr = 0;
GFileAttributeValue *value;
g_return_val_if_fail (G_IS_FILE_INFO (info), FALSE);
if (attr == 0)
attr = lookup_attribute (G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP);
value = g_file_info_find_value (info, attr);
return (GFileType)_g_file_attribute_value_get_boolean (value);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* agp_backend_acquire - attempt to acquire an agp backend. */ | struct agp_bridge_data* agp_backend_acquire(struct pci_dev *pdev) | /* agp_backend_acquire - attempt to acquire an agp backend. */
struct agp_bridge_data* agp_backend_acquire(struct pci_dev *pdev) | {
struct agp_bridge_data *bridge;
bridge = agp_find_bridge(pdev);
if (!bridge)
return NULL;
if (atomic_read(&bridge->agp_in_use))
return NULL;
atomic_inc(&bridge->agp_in_use);
return bridge;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Add a dashboard light sensor and add all elements to the dashboard. */ | static void adp_window_add_dashboard_light_sensor(void) | /* Add a dashboard light sensor and add all elements to the dashboard. */
static void adp_window_add_dashboard_light_sensor(void) | {
struct adp_msg_conf_dashboard dashboard = {
.dashboard_id = DASHBOARD_ID_LIGHT_SENSOR,
.color = {ADP_COLOR_WHITE},
.height = 300,
};
adp_add_dashboard(&dashboard, DASHBOARD_DIS_LABEL);
adp_window_add_label_to_light_sensor_dashboard();
adp_window_add_element_strem_to_light_sensor_dashboard();
} | memfault/zero-to-main | C++ | null | 200 |
/* i2c_get_bus_speed - get i2c bus speed @speed: bus speed (in HZ) */ | unsigned int i2c_get_bus_speed(void) | /* i2c_get_bus_speed - get i2c bus speed @speed: bus speed (in HZ) */
unsigned int i2c_get_bus_speed(void) | {
return 5000000 / (bfin_read_TWI_CLKDIV() & 0xff);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* strrchr - Find the last occurrence of a character in a string @s: The string to be searched */ | char* strrchr(const char *s, int c) | /* strrchr - Find the last occurrence of a character in a string @s: The string to be searched */
char* strrchr(const char *s, int c) | {
const char *p = s + strlen(s);
do {
if (*p == (char)c)
return (char *)p;
} while (--p >= s);
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* @id returns a value in the range 0 ... 0x7fffffff. */ | int ida_get_new(struct ida *ida, int *p_id) | /* @id returns a value in the range 0 ... 0x7fffffff. */
int ida_get_new(struct ida *ida, int *p_id) | {
return ida_get_new_above(ida, 0, p_id);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* runs a program on the hash register engine. */ | int hre_run_program(struct udevice *tpm, const uint8_t *code, size_t code_size) | /* runs a program on the hash register engine. */
int hre_run_program(struct udevice *tpm, const uint8_t *code, size_t code_size) | {
size_t code_left;
const uint8_t *ip = code;
code_left = code_size;
hre_tpm_err = 0;
hre_err = HRE_E_OK;
while (code_left > 0)
if (!hre_execute_op(tpm, &ip, &code_left))
return -1;
return hre_err;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Sync a file As this calls fsync (not fdatasync) there is no need for a write_inode after it. */ | static int nfsd_dosync(struct file *filp, struct dentry *dp, const struct file_operations *fop) | /* Sync a file As this calls fsync (not fdatasync) there is no need for a write_inode after it. */
static int nfsd_dosync(struct file *filp, struct dentry *dp, const struct file_operations *fop) | {
struct inode *inode = dp->d_inode;
int (*fsync) (struct file *, struct dentry *, int);
int err;
err = filemap_write_and_wait(inode->i_mapping);
if (err == 0 && fop && (fsync = fop->fsync))
err = fsync(filp, dp, 0);
return err;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* XXX - shouldn't there be a centralized routine for dissecting NSAPs? See also "dissect_atm_nsap()" in epan/dissectors/packet-arp.c and "dissect_nsap()" in epan/dissectors/packet-isup.c. */ | gchar* print_nsap_net(tvbuff_t *tvb, const gint offset, int length) | /* XXX - shouldn't there be a centralized routine for dissecting NSAPs? See also "dissect_atm_nsap()" in epan/dissectors/packet-arp.c and "dissect_nsap()" in epan/dissectors/packet-isup.c. */
gchar* print_nsap_net(tvbuff_t *tvb, const gint offset, int length) | {
gchar *cur;
cur = (gchar *)wmem_alloc(wmem_packet_scope(), MAX_NSAP_LEN * 3 + 50);
print_nsap_net_buf( tvb_get_ptr(tvb, offset, length), length, cur, MAX_NSAP_LEN * 3 + 50);
return( cur );
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* An abort indicates that the current memory access cannot be completed, which occurs during an instruction prefetch. */ | void rt_hw_trap_pabt(struct rt_hw_register *regs) | /* An abort indicates that the current memory access cannot be completed, which occurs during an instruction prefetch. */
void rt_hw_trap_pabt(struct rt_hw_register *regs) | {
rt_hw_show_register(regs);
rt_kprintf("prefetch abort\n");
rt_hw_cpu_shutdown();
} | armink/FreeModbus_Slave-Master-RTT-STM32 | C++ | Other | 1,477 |
/* Clear the state of the wdt interrupt status bit.
This function clear the interrupt bit. */ | void am_hal_wdt_int_clear(void) | /* Clear the state of the wdt interrupt status bit.
This function clear the interrupt bit. */
void am_hal_wdt_int_clear(void) | {
AM_REGn(WDT, 0, INTCLR) = AM_REG_WDT_INTCLR_WDT_M;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Fills the LCD with the specified 16-bit color. */ | void lcdFillRGB(uint16_t color) | /* Fills the LCD with the specified 16-bit color. */
void lcdFillRGB(uint16_t color) | {
uint32_t i;
i = lcdGetWidth() * lcdGetHeight();
hx8347gSetCursor(0,0);
hx8347gWriteCommand(HX8347G_CMD_SRAMWRITECONTROL);
while (i--)
{
hx8347gWriteData(color);
}
} | microbuilder/LPC11U_LPC13U_CodeBase | C++ | Other | 54 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.