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 |
|---|---|---|---|---|---|---|---|
/* Externally callable EC access functions. For now, assume 1 EC only */ | int ec_burst_enable(void) | /* Externally callable EC access functions. For now, assume 1 EC only */
int ec_burst_enable(void) | {
if (!first_ec)
return -ENODEV;
return acpi_ec_burst_enable(first_ec);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Look up a neighbour by interface index and destination address */ | struct rtnl_neigh* rtnl_neigh_get(struct nl_cache *cache, int ifindex, struct nl_addr *dst) | /* Look up a neighbour by interface index and destination address */
struct rtnl_neigh* rtnl_neigh_get(struct nl_cache *cache, int ifindex, struct nl_addr *dst) | {
struct rtnl_neigh *neigh;
nl_list_for_each_entry(neigh, &cache->c_items, ce_list) {
if (neigh->n_ifindex == ifindex &&
!nl_addr_cmp(neigh->n_dst, dst)) {
nl_object_get((struct nl_object *) neigh);
return neigh;
}
}
return NULL;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Handle case when CC value equals COUNTER+1.
Additionally, an information about CC adjustment is stored. This information is used in the callback to return original CC value which was requested by the user. */ | static void handle_next_tick_case(const struct device *dev, uint8_t chan, uint32_t now, uint32_t val) | /* Handle case when CC value equals COUNTER+1.
Additionally, an information about CC adjustment is stored. This information is used in the callback to return original CC value which was requested by the user. */
static void handle_next_tick_case(const struct device *dev, uint8_t chan, uint32_t now, uint32_t val) | {
const struct counter_nrfx_config *config = dev->config;
struct counter_nrfx_data *data = dev->data;
val = ticks_add(dev, val, 1, data->top);
nrfy_rtc_cc_set(config->rtc, chan, val);
atomic_or(&data->ipend_adj, CC_ADJ_MASK(chan));
if (nrfy_rtc_counter_get(config->rtc) != now) {
set_cc_int_pending(dev, chan);
} else {
nrfy_rtc_int_enable(config->rtc, NRF_RTC_CHANNEL_INT_MASK(chan));
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Skip the optional Controller device path node and return the pointer to the next device path node. */ | UART_DEVICE_PATH* SkipControllerDevicePathNode(EFI_DEVICE_PATH_PROTOCOL *DevicePath, BOOLEAN *ContainsControllerNode, UINT32 *ControllerNumber) | /* Skip the optional Controller device path node and return the pointer to the next device path node. */
UART_DEVICE_PATH* SkipControllerDevicePathNode(EFI_DEVICE_PATH_PROTOCOL *DevicePath, BOOLEAN *ContainsControllerNode, UINT32 *ControllerNumber) | {
if ((DevicePathType (DevicePath) == HARDWARE_DEVICE_PATH) &&
(DevicePathSubType (DevicePath) == HW_CONTROLLER_DP)
)
{
if (ContainsControllerNode != NULL) {
*ContainsControllerNode = TRUE;
}
if (ControllerNumber != NULL) {
*ControllerNumber = ((CONTROLLER_DEVICE_PATH *)DevicePath)->ControllerNumber;
}
DevicePath = NextDevicePathNode (DevicePath);
} else {
if (ContainsControllerNode != NULL) {
*ContainsControllerNode = FALSE;
}
}
return (UART_DEVICE_PATH *)DevicePath;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* We play with the resolve flag: 0 and 1 have the usual meaning, but -1 means to allocate the neighbour entry but not to ask atmarpd for resolution. Also, don't increment the usage count. This is used to create entries in clip_setentry. */ | static int clip_encap(struct atm_vcc *vcc, int mode) | /* We play with the resolve flag: 0 and 1 have the usual meaning, but -1 means to allocate the neighbour entry but not to ask atmarpd for resolution. Also, don't increment the usage count. This is used to create entries in clip_setentry. */
static int clip_encap(struct atm_vcc *vcc, int mode) | {
CLIP_VCC(vcc)->encap = mode;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* set the number of pending calls permitted on a listening socket */ | static int rxrpc_listen(struct socket *sock, int backlog) | /* set the number of pending calls permitted on a listening socket */
static int rxrpc_listen(struct socket *sock, int backlog) | {
struct sock *sk = sock->sk;
struct rxrpc_sock *rx = rxrpc_sk(sk);
int ret;
_enter("%p,%d", rx, backlog);
lock_sock(&rx->sk);
switch (rx->sk.sk_state) {
case RXRPC_UNCONNECTED:
ret = -EADDRNOTAVAIL;
break;
case RXRPC_CLIENT_BOUND:
case RXRPC_CLIENT_CONNECTED:
default:
ret = -EBUSY;
break;
case RXRPC_SERVER_BOUND:
ASSERT(rx->local != NULL);
sk->sk_max_ack_backlog = backlog;
rx->sk.sk_state = RXRPC_SERVER_LISTENING;
ret = 0;
break;
}
release_sock(&rx->sk);
_leave(" = %d", ret);
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ | UINT16 EFIAPI PciRead16(IN UINTN Address) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciRead16(IN UINTN Address) | {
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
return (UINT16)PeiPciLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint16);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* A callback function for the directory diff calculation routine, produces G_FILE_MONITOR_EVENT_DELETED/CREATED event pair when an overwrite occurs in the directory (see dep-list for details). */ | static void handle_overwritten(void *udata, const char *path, ino_t inode) | /* A callback function for the directory diff calculation routine, produces G_FILE_MONITOR_EVENT_DELETED/CREATED event pair when an overwrite occurs in the directory (see dep-list for details). */
static void handle_overwritten(void *udata, const char *path, ino_t inode) | {
handle_ctx *ctx = NULL;
(void) inode;
ctx = (handle_ctx *) udata;
g_assert (udata != NULL);
g_assert (ctx->sub != NULL);
g_assert (ctx->source != NULL);
g_file_monitor_source_handle_event (ctx->source, G_FILE_MONITOR_EVENT_DELETED,
path, NULL, NULL, g_get_monotonic_time ());
g_file_monitor_source_handle_event (ctx->source, G_FILE_MONITOR_EVENT_CREATED,
path, NULL, NULL, g_get_monotonic_time ());
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Use the API defined in xemacps_bd.h to modify individual BDs. Traversal of the BD set can be done using XEmacPs_BdRingNext() and XEmacPs_BdRingPrev(). */ | LONG XEmacPs_BdRingAlloc(XEmacPs_BdRing *RingPtr, u32 NumBd, XEmacPs_Bd **BdSetPtr) | /* Use the API defined in xemacps_bd.h to modify individual BDs. Traversal of the BD set can be done using XEmacPs_BdRingNext() and XEmacPs_BdRingPrev(). */
LONG XEmacPs_BdRingAlloc(XEmacPs_BdRing *RingPtr, u32 NumBd, XEmacPs_Bd **BdSetPtr) | {
LONG Status;
if (RingPtr->FreeCnt < NumBd) {
Status = (LONG)(XST_FAILURE);
} else {
*BdSetPtr = RingPtr->FreeHead;
XEMACPS_RING_SEEKAHEAD(RingPtr, RingPtr->FreeHead, NumBd);
RingPtr->FreeCnt -= NumBd;
RingPtr->PreCnt += NumBd;
Status = (LONG)(XST_SUCCESS);
}
return Status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* USB Device MSC Bulk In Callback Parameters: None Return Value: None */ | void USBD_MSC_BulkIn(void) | /* USB Device MSC Bulk In Callback Parameters: None Return Value: None */
void USBD_MSC_BulkIn(void) | {
switch (BulkStage) {
case MSC_BS_DATA_IN:
switch (USBD_MSC_CBW.CB[0]) {
case SCSI_READ10:
case SCSI_READ12:
USBD_MSC_MemoryRead();
break;
}
break;
case MSC_BS_DATA_IN_LAST:
USBD_MSC_SetCSW();
break;
case MSC_BS_DATA_IN_LAST_STALL:
USBD_MSC_SetStallEP(usbd_msc_ep_bulkin | 0x80);
USBD_MSC_SetCSW();
break;
case MSC_BS_CSW:
BulkStage = MSC_BS_CBW;
break;
default:
break;
}
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Only used by the i386 NUMA architecures, but relatively generic code. */ | unsigned long __init node_memmap_size_bytes(int nid, unsigned long start_pfn, unsigned long end_pfn) | /* Only used by the i386 NUMA architecures, but relatively generic code. */
unsigned long __init node_memmap_size_bytes(int nid, unsigned long start_pfn, unsigned long end_pfn) | {
unsigned long pfn;
unsigned long nr_pages = 0;
mminit_validate_memmodel_limits(&start_pfn, &end_pfn);
for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) {
if (nid != early_pfn_to_nid(pfn))
continue;
if (pfn_present(pfn))
nr_pages += PAGES_PER_SECTION;
}
return nr_pages * sizeof(struct page);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Read the specified EMMC interrupt has occurred or not. */ | uint8_t EMMC_ReadIntFlag(EMMC_BANK_NAND_T bank, EMMC_INT_T flag) | /* Read the specified EMMC interrupt has occurred or not. */
uint8_t EMMC_ReadIntFlag(EMMC_BANK_NAND_T bank, EMMC_INT_T flag) | {
uint32_t tmpsr = 0x0, itstatus = 0x0, itenable = 0x0;
if (bank == EMMC_BANK2_NAND)
{
tmpsr = EMMC_Bank2->STSINT2;
}
else if (bank == EMMC_BANK3_NAND)
{
tmpsr = EMMC_Bank3->STSINT3;
}
else
{
tmpsr = EMMC_Bank4->STSINT4;
}
itstatus = tmpsr & flag;
itenable = tmpsr & (flag >> 3);
if ((itstatus != RESET) && (itenable != RESET))
{
return SET;
}
else
{
return RESET;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Thread (LED_Thread1) used to toggle a LED when getting the appropriate signal. */ | static void LED_Thread1(void const *argument) | /* Thread (LED_Thread1) used to toggle a LED when getting the appropriate signal. */
static void LED_Thread1(void const *argument) | {
(void) argument;
osEvent event;
for(;;)
{
event = osSignalWait( BIT_0, osWaitForever);
if(event.value.signals == BIT_0)
{
BSP_LED_Toggle(LED3);
}
}
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Generic packet command support and error handling routines. */ | static void cdrom_saw_media_change(ide_drive_t *drive) | /* Generic packet command support and error handling routines. */
static void cdrom_saw_media_change(ide_drive_t *drive) | {
drive->dev_flags |= IDE_DFLAG_MEDIA_CHANGED;
drive->atapi_flags &= ~IDE_AFLAG_TOC_VALID;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Writes user data to the specified Data Backup Register. */ | void BKP_WriteBackupRegister(uint16_t BKP_DR, uint16_t Data) | /* Writes user data to the specified Data Backup Register. */
void BKP_WriteBackupRegister(uint16_t BKP_DR, uint16_t Data) | {
assert_param(IS_BKP_DR(BKP_DR));
*(__IO uint16_t *) (BKP_BASE + BKP_DR) = Data;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enable or disable write protection of SSC registers. */ | void ssc_set_writeprotect(Ssc *p_ssc, uint32_t ul_enable) | /* Enable or disable write protection of SSC registers. */
void ssc_set_writeprotect(Ssc *p_ssc, uint32_t ul_enable) | {
if (ul_enable) {
p_ssc->SSC_WPMR = SSC_WPMR_WPKEY_PASSWD | SSC_WPMR_WPEN;
} else {
p_ssc->SSC_WPMR = SSC_WPMR_WPKEY_PASSWD;
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* USBH_LL_Init Initialize the Low Level portion of the Host driver. */ | USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost) | /* USBH_LL_Init Initialize the Low Level portion of the Host driver. */
USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost) | {
hhcd.Instance = USB_OTG_FS;
hhcd.Init.Host_channels = 11;
hhcd.Init.dma_enable = 0;
hhcd.Init.low_power_enable = 0;
hhcd.Init.phy_itface = HCD_PHY_EMBEDDED;
hhcd.Init.Sof_enable = 0;
hhcd.Init.speed = HCD_SPEED_FULL;
hhcd.Init.vbus_sensing_enable = 0;
hhcd.Init.lpm_enable = 0;
hhcd.pData = phost;
phost->pData = &hhcd;
HAL_HCD_Init(&hhcd);
USBH_LL_SetTimer (phost, HAL_HCD_GetCurrentFrame(&hhcd));
return USBH_OK;
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Returns 0 if current can wait for p, error code otherwise */ | static int smack_task_wait(struct task_struct *p) | /* Returns 0 if current can wait for p, error code otherwise */
static int smack_task_wait(struct task_struct *p) | {
struct smk_audit_info ad;
char *sp = current_security();
char *tsp = task_security(p);
int rc;
rc = smk_access(sp, tsp, MAY_WRITE, NULL);
if (rc == 0)
goto out_log;
if (capable(CAP_MAC_OVERRIDE) || has_capability(p, CAP_MAC_OVERRIDE))
rc = 0;
out_log:
smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK);
smk_ad_setfield_u_tsk(&ad, p);
smack_log(sp, tsp, MAY_WRITE, rc, &ad);
return rc;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag */ | static int vfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) | /* This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag */
static int vfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) | {
if (var->vmode & FB_VMODE_YWRAP)
{
if (var->yoffset < 0
|| var->yoffset >= info->var.yres_virtual
|| var->xoffset)
return -EINVAL;
}
else
{
if (var->xoffset + var->xres > info->var.xres_virtual ||
var->yoffset + var->yres > info->var.yres_virtual)
return -EINVAL;
}
info->var.xoffset = var->xoffset;
info->var.yoffset = var->yoffset;
if (var->vmode & FB_VMODE_YWRAP)
info->var.vmode |= FB_VMODE_YWRAP;
else
info->var.vmode &= ~FB_VMODE_YWRAP;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* < declarations of function return codes
Support and FAQ: visit */ | uint8_t sha204c_check_crc(uint8_t *response) | /* < declarations of function return codes
Support and FAQ: visit */
uint8_t sha204c_check_crc(uint8_t *response) | {
uint8_t crc[SHA204_CRC_SIZE];
uint8_t count = response[SHA204_BUFFER_POS_COUNT];
count -= SHA204_CRC_SIZE;
sha204c_calculate_crc(count, response, crc);
return (crc[0] == response[count] && crc[1] == response[count + 1])
? SHA204_SUCCESS : SHA204_BAD_CRC;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* So, but default we assume that the board is a prototype, which is a most safe assumption. There is no way to determine board revision from a register, so we use hwconfig. */ | static int prototype_board(void) | /* So, but default we assume that the board is a prototype, which is a most safe assumption. There is no way to determine board revision from a register, so we use hwconfig. */
static int prototype_board(void) | {
if (hwconfig_subarg("board", "rev", NULL))
return hwconfig_subarg_cmp("board", "rev", "prototype");
return 1;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* disable the software interrupt event from EXTI line x */ | void exti_software_interrupt_disable(exti_line_enum linex) | /* disable the software interrupt event from EXTI line x */
void exti_software_interrupt_disable(exti_line_enum linex) | {
EXTI_SWIEV &= ~(uint32_t)linex;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Find a socket that wants to accept the SABM we have just received. */ | struct sock* ax25_find_listener(ax25_address *addr, int digi, struct net_device *dev, int type) | /* Find a socket that wants to accept the SABM we have just received. */
struct sock* ax25_find_listener(ax25_address *addr, int digi, struct net_device *dev, int type) | {
ax25_cb *s;
struct hlist_node *node;
spin_lock(&ax25_list_lock);
ax25_for_each(s, node, &ax25_list) {
if ((s->iamdigi && !digi) || (!s->iamdigi && digi))
continue;
if (s->sk && !ax25cmp(&s->source_addr, addr) &&
s->sk->sk_type == type && s->sk->sk_state == TCP_LISTEN) {
if (s->ax25_dev == NULL || s->ax25_dev->dev == dev) {
sock_hold(s->sk);
spin_unlock(&ax25_list_lock);
return s->sk;
}
}
}
spin_unlock(&ax25_list_lock);
return NULL;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Return: a positive integer DIVQ value to be programmed into the hardware upon success, or 0 upon error (since 0 is an invalid DIVQ value) */ | static u8 __wrpll_calc_divq(u32 target_rate, u64 *vco_rate) | /* Return: a positive integer DIVQ value to be programmed into the hardware upon success, or 0 upon error (since 0 is an invalid DIVQ value) */
static u8 __wrpll_calc_divq(u32 target_rate, u64 *vco_rate) | {
u64 s;
u8 divq = 0;
if (!vco_rate) {
WARN_ON(1);
goto wcd_out;
}
s = div_u64(MAX_VCO_FREQ, target_rate);
if (s <= 1) {
divq = 1;
*vco_rate = MAX_VCO_FREQ;
} else if (s > MAX_DIVQ_DIVISOR) {
divq = ilog2(MAX_DIVQ_DIVISOR);
*vco_rate = MIN_VCO_FREQ;
} else {
divq = ilog2(s);
*vco_rate = (u64)target_rate << divq;
}
wcd_out:
return divq;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Receive a byte from USART/LEUART and put into global buffer. */ | int RETARGET_ReadChar(void) | /* Receive a byte from USART/LEUART and put into global buffer. */
int RETARGET_ReadChar(void) | {
int c = -1;
CORE_DECLARE_IRQ_STATE;
if (initialized == false)
{
RETARGET_SerialInit();
}
CORE_ENTER_ATOMIC();
if (rxCount > 0)
{
c = rxBuffer[rxReadIndex];
rxReadIndex++;
if (rxReadIndex == RXBUFSIZE)
{
rxReadIndex = 0;
}
rxCount--;
}
CORE_EXIT_ATOMIC();
return c;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* TIM MSP Initialization This function configures the hardware resources used in this example: */ | void HAL_TIM_IC_MspInit(TIM_HandleTypeDef *htim) | /* TIM MSP Initialization This function configures the hardware resources used in this example: */
void HAL_TIM_IC_MspInit(TIM_HandleTypeDef *htim) | {
GPIO_InitTypeDef GPIO_InitStruct;
TIMx_CLK_ENABLE();
TIMx_CHANNEL_GPIO_PORT();
GPIO_InitStruct.Pin = GPIO_PIN_CHANNEL2;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF_TIMx;
HAL_GPIO_Init(GPIO_PORT, &GPIO_InitStruct);
HAL_NVIC_SetPriority(TIMx_IRQn, 0, 1);
HAL_NVIC_EnableIRQ(TIMx_IRQn);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* _detach is called to deconfigure a device. It should deallocate resources. This function is also called when _attach() fails, so it should be careful not to release resources that were not necessarily allocated by _attach(). dev->private and dev->subdevices are deallocated automatically by the core. */ | static int pcmda12_detach(struct comedi_device *dev) | /* _detach is called to deconfigure a device. It should deallocate resources. This function is also called when _attach() fails, so it should be careful not to release resources that were not necessarily allocated by _attach(). dev->private and dev->subdevices are deallocated automatically by the core. */
static int pcmda12_detach(struct comedi_device *dev) | {
printk("comedi%d: %s: remove\n", dev->minor, driver.driver_name);
if (dev->iobase)
release_region(dev->iobase, IOSIZE);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Performs sanity check for supplied partition. Offset and size are verified to be within valid range. Partition type is checked and part_validate_eraseblock() is called with the argument of part. */ | static int part_validate(struct mtdids *id, struct part_info *part) | /* Performs sanity check for supplied partition. Offset and size are verified to be within valid range. Partition type is checked and part_validate_eraseblock() is called with the argument of part. */
static int part_validate(struct mtdids *id, struct part_info *part) | {
if (part->size == SIZE_REMAINING)
part->size = id->size - part->offset;
if (part->offset > id->size) {
printf("%s: offset %08llx beyond flash size %08llx\n",
id->mtd_id, part->offset, id->size);
return 1;
}
if ((part->offset + part->size) <= part->offset) {
printf("%s%d: partition (%s) size too big\n",
MTD_DEV_TYPE(id->type), id->num, part->name);
return 1;
}
if (part->offset + part->size > id->size) {
printf("%s: partitioning exceeds flash size\n", id->mtd_id);
return 1;
}
return part_validate_eraseblock(id, part);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Event handler for the library USB Control Request reception event. */ | void EVENT_USB_Device_ControlRequest(void) | /* Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void) | {
if (CurrentFirmwareMode == MODE_USART_BRIDGE)
CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Returns true if a clock update is in progress */ | static unsigned char rtc_is_updating(void) | /* Returns true if a clock update is in progress */
static unsigned char rtc_is_updating(void) | {
unsigned long flags;
unsigned char uip;
spin_lock_irqsave(&rtc_lock, flags);
uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
spin_unlock_irqrestore(&rtc_lock, flags);
return uip;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Fetches the chassis status when it was last booted. */ | MISC_CHASSIS_STATE EFIAPI OemGetChassisBootupState(VOID) | /* Fetches the chassis status when it was last booted. */
MISC_CHASSIS_STATE EFIAPI OemGetChassisBootupState(VOID) | {
ASSERT (FALSE);
return ChassisStateSafe;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Checks that a minor device with the specified type is registered, and returns its user data pointer. */ | void* snd_lookup_minor_data(unsigned int minor, int type) | /* Checks that a minor device with the specified type is registered, and returns its user data pointer. */
void* snd_lookup_minor_data(unsigned int minor, int type) | {
struct snd_minor *mreg;
void *private_data;
if (minor >= ARRAY_SIZE(snd_minors))
return NULL;
mutex_lock(&sound_mutex);
mreg = snd_minors[minor];
if (mreg && mreg->type == type)
private_data = mreg->private_data;
else
private_data = NULL;
mutex_unlock(&sound_mutex);
return private_data;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* traverse one gray object, turning it to black. */ | static lu_mem propagatemark(global_State *g) | /* traverse one gray object, turning it to black. */
static lu_mem propagatemark(global_State *g) | {
case LUA_VTABLE: return traversetable(g, gco2t(o));
case LUA_VUSERDATA: return traverseudata(g, gco2u(o));
case LUA_VLCL: return traverseLclosure(g, gco2lcl(o));
case LUA_VCCL: return traverseCclosure(g, gco2ccl(o));
case LUA_VPROTO: return traverseproto(g, gco2p(o));
case LUA_VTHREAD: return traversethread(g, gco2th(o));
default: lua_assert(0); return 0;
}
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* The caller specifies the number of characters in the string to log, which may or may not be the entire string. */ | void audit_log_n_untrustedstring(struct audit_buffer *ab, const char *string, size_t len) | /* The caller specifies the number of characters in the string to log, which may or may not be the entire string. */
void audit_log_n_untrustedstring(struct audit_buffer *ab, const char *string, size_t len) | {
if (audit_string_contains_control(string, len))
audit_log_n_hex(ab, string, len);
else
audit_log_n_string(ab, string, len);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Sends data and read data in master mode through the I2Cx peripheral. */ | void I2C_MasterRepeatRead(I2C_TypeDef *I2Cx, u8 *pWriteBuf, u8 Writelen, u8 *pReadBuf, u8 Readlen) | /* Sends data and read data in master mode through the I2Cx peripheral. */
void I2C_MasterRepeatRead(I2C_TypeDef *I2Cx, u8 *pWriteBuf, u8 Writelen, u8 *pReadBuf, u8 Readlen) | {
u8 cnt = 0;
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
for(cnt = 0; cnt < Writelen; cnt++)
{
while((I2C_CheckFlagState(I2Cx, BIT_IC_STATUS_TFNF)) == 0);
if(cnt >= Writelen - 1)
{
I2Cx->IC_DATA_CMD = (*pWriteBuf++) | (1 << 10);
}
else
{
I2Cx->IC_DATA_CMD = (*pWriteBuf++);
}
}
while((I2C_CheckFlagState(I2Cx, BIT_IC_STATUS_TFNF)) == 0);
I2C_MasterRead(I2Cx, pReadBuf, Readlen);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Register the Service B.2 and all its Characteristics... */ | void service_b_2_2_init(void) | /* Register the Service B.2 and all its Characteristics... */
void service_b_2_2_init(void) | {
bt_gatt_service_register(&service_b_2_2_svc);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* 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 safe mechanisms. */ | 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 safe mechanisms. */
UINT64 EFIAPI InternalSyncCompareExchange64(IN OUT volatile UINT64 *Value, IN UINT64 CompareValue, IN UINT64 ExchangeValue) | {
__asm__ __volatile__ (
"lock \n\t"
"cmpxchgq %2, %1 \n\t"
: "+a" (CompareValue),
"+m" (*Value)
: "r" (ExchangeValue)
: "memory",
"cc"
);
return CompareValue;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Return value: 0 on success, negative errno on failure. */ | int hpsb_send_packet_and_wait(struct hpsb_packet *packet) | /* Return value: 0 on success, negative errno on failure. */
int hpsb_send_packet_and_wait(struct hpsb_packet *packet) | {
struct completion done;
int retval;
init_completion(&done);
hpsb_set_packet_complete_task(packet, complete_packet, &done);
retval = hpsb_send_packet(packet);
if (retval == 0)
wait_for_completion(&done);
return retval;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Workqueue for updating the TX power parameters in hardware. */ | void b43_phy_txpower_adjust_work(struct work_struct *work) | /* Workqueue for updating the TX power parameters in hardware. */
void b43_phy_txpower_adjust_work(struct work_struct *work) | {
struct b43_wl *wl = container_of(work, struct b43_wl,
txpower_adjust_work);
struct b43_wldev *dev;
mutex_lock(&wl->mutex);
dev = wl->current_dev;
if (likely(dev && (b43_status(dev) >= B43_STAT_STARTED)))
dev->phy.ops->adjust_txpower(dev);
mutex_unlock(&wl->mutex);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Step 1 of the initialization of a USB MSC device Sends the setup request GET_MAX_LUN. */ | static void uhi_msc_enable_step1(void) | /* Step 1 of the initialization of a USB MSC device Sends the setup request GET_MAX_LUN. */
static void uhi_msc_enable_step1(void) | {
uhi_msc_dev_sel->nb_lun = 0;
usb_setup_req_t req;
req.bmRequestType = USB_REQ_RECIP_INTERFACE|USB_REQ_TYPE_CLASS|USB_REQ_DIR_IN;
req.bRequest = USB_REQ_MSC_GET_MAX_LUN;
req.wValue = 0;
req.wIndex = uhi_msc_dev_sel->iface_num;
req.wLength = 1;
uhd_setup_request(uhi_msc_dev_sel->dev->address,
&req,
&(uhi_msc_dev_sel->nb_lun),
1,
NULL,
uhi_msc_enable_step2);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This function returns %1 if the buffer is empty (contains all 0xff) otherwise %0 is returned. */ | static int is_empty(void *buf, int len) | /* This function returns %1 if the buffer is empty (contains all 0xff) otherwise %0 is returned. */
static int is_empty(void *buf, int len) | {
uint8_t *p = buf;
int i;
for (i = 0; i < len; i++)
if (*p++ != 0xff)
return 0;
return 1;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* The function is to Enable Low-Voltage Detect Warning Interrupt or not. */ | void SysCtlLVDWarningIntEnable(xtBoolean bEnable) | /* The function is to Enable Low-Voltage Detect Warning Interrupt or not. */
void SysCtlLVDWarningIntEnable(xtBoolean bEnable) | {
if(bEnable)
{
xHWREGB(PMC_LVDSC2) |= PMC_LVDSC2_LVDRE;
}
else
{
xHWREGB(PMC_LVDSC2) &= ~PMC_LVDSC2_LVDRE;
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* 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 safe mechanisms. */ | UINT64 EFIAPI InternalSyncCompareExchange64(IN 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 safe mechanisms. */
UINT64 EFIAPI InternalSyncCompareExchange64(IN volatile UINT64 *Value, IN UINT64 CompareValue, IN UINT64 ExchangeValue) | {
_asm {
mov esi, Value
mov eax, dword ptr [CompareValue + 0]
mov edx, dword ptr [CompareValue + 4]
mov ebx, dword ptr [ExchangeValue + 0]
mov ecx, dword ptr [ExchangeValue + 4]
lock cmpxchg8b qword ptr [esi]
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Reset the platform ACPI table instance count for all SBBR-mandatory tables. */ | VOID EFIAPI ArmSbbrResetTableCounts(VOID) | /* Reset the platform ACPI table instance count for all SBBR-mandatory tables. */
VOID EFIAPI ArmSbbrResetTableCounts(VOID) | {
UINT32 Table;
for (Table = 0; Table < ARRAY_SIZE (ArmSbbrTableCounts); Table++) {
ArmSbbrTableCounts[Table].Count = 0;
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Location of the PRS to be output on GPIO. */ | void prs_set_output_loc(uint32_t loc) | /* Location of the PRS to be output on GPIO. */
void prs_set_output_loc(uint32_t loc) | {
PRS_ROUTE = (PRS_ROUTE & ~PRS_ROUTE_LOCATION_MASK) | loc;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Ripped from linux/time.h because it's a kernel header, and thus unusable from here. */ | static long long timeval_to_ns(const struct timeval *tv) | /* Ripped from linux/time.h because it's a kernel header, and thus unusable from here. */
static long long timeval_to_ns(const struct timeval *tv) | {
return ((long long) tv->tv_sec * UM_NSEC_PER_SEC) +
tv->tv_usec * UM_NSEC_PER_USEC;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Calculates a CRC8 checksum for the given buffer with the polynom 0x2F using the precompiled CRC table */ | guint8 crc8_0x2F(guint8 *buf, guint32 len, guint8 seed) | /* Calculates a CRC8 checksum for the given buffer with the polynom 0x2F using the precompiled CRC table */
guint8 crc8_0x2F(guint8 *buf, guint32 len, guint8 seed) | {
return crc8_precompiled(buf, len, seed, crc8_precompiled_2F);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Set new caption for label, return false if out of mem. */ | bool wtk_label_change(struct wtk_label *label, const char *caption) | /* Set new caption for label, return false if out of mem. */
bool wtk_label_change(struct wtk_label *label, const char *caption) | {
Assert(label);
Assert(caption);
uint8_t new_len = strlen(caption);
uint8_t old_len = 0;
if (caption) {
old_len = strlen(label->caption);
}
if (new_len > old_len) {
if (caption) {
membag_free(label->caption);
}
label->caption = membag_alloc((new_len + 1) * sizeof(char));
if (!label->caption) {
goto outofmem_caption;
}
}
wtk_copy_string(label->caption, caption);
win_redraw(label->container);
return true;
outofmem_caption:
return false;
} | memfault/zero-to-main | C++ | null | 200 |
/* FSM long counter status register. Long counter value is an unsigned integer value (16-bit format).. */ | int32_t lsm6dso_long_cnt_set(stmdev_ctx_t *ctx, uint16_t val) | /* FSM long counter status register. Long counter value is an unsigned integer value (16-bit format).. */
int32_t lsm6dso_long_cnt_set(stmdev_ctx_t *ctx, uint16_t val) | {
uint8_t buff[2];
int32_t ret;
buff[1] = (uint8_t) (val / 256U);
buff[0] = (uint8_t) (val - (buff[1] * 256U));
ret = lsm6dso_mem_bank_set(ctx, LSM6DSO_EMBEDDED_FUNC_BANK);
if (ret == 0) {
ret = lsm6dso_write_reg(ctx, LSM6DSO_FSM_LONG_COUNTER_L, buff, 2);
}
if (ret == 0) {
ret = lsm6dso_mem_bank_set(ctx, LSM6DSO_USER_BANK);
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Write one byte to the data EEPROM memory. */ | void __eeprom_program_byte(unsigned char __near *dst, unsigned char v) | /* Write one byte to the data EEPROM memory. */
void __eeprom_program_byte(unsigned char __near *dst, unsigned char v) | {
FLASH_ProgramByte((u32)dst, (u8)v);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ | void Vector35_handler(void) | /* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector35_handler(void) | {
asm
{
LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (35 * 2))
JMP 0,X
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Called by ib_destroy_cq() in the generic verbs code. */ | int ipath_destroy_cq(struct ib_cq *ibcq) | /* Called by ib_destroy_cq() in the generic verbs code. */
int ipath_destroy_cq(struct ib_cq *ibcq) | {
struct ipath_ibdev *dev = to_idev(ibcq->device);
struct ipath_cq *cq = to_icq(ibcq);
tasklet_kill(&cq->comptask);
spin_lock(&dev->n_cqs_lock);
dev->n_cqs_allocated--;
spin_unlock(&dev->n_cqs_lock);
if (cq->ip)
kref_put(&cq->ip->ref, ipath_release_mmap_info);
else
vfree(cq->queue);
kfree(cq);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* DAC960_V1_ExecuteType3D executes a DAC960 V1 Firmware Controller Type 3D Command and waits for completion. It returns true on success and false on failure. */ | static bool DAC960_V1_ExecuteType3D(DAC960_Controller_T *Controller, DAC960_V1_CommandOpcode_T CommandOpcode, unsigned char Channel, unsigned char TargetID, dma_addr_t DataDMA) | /* DAC960_V1_ExecuteType3D executes a DAC960 V1 Firmware Controller Type 3D Command and waits for completion. It returns true on success and false on failure. */
static bool DAC960_V1_ExecuteType3D(DAC960_Controller_T *Controller, DAC960_V1_CommandOpcode_T CommandOpcode, unsigned char Channel, unsigned char TargetID, dma_addr_t DataDMA) | {
DAC960_Command_T *Command = DAC960_AllocateCommand(Controller);
DAC960_V1_CommandMailbox_T *CommandMailbox = &Command->V1.CommandMailbox;
DAC960_V1_CommandStatus_T CommandStatus;
DAC960_V1_ClearCommand(Command);
Command->CommandType = DAC960_ImmediateCommand;
CommandMailbox->Type3D.CommandOpcode = CommandOpcode;
CommandMailbox->Type3D.Channel = Channel;
CommandMailbox->Type3D.TargetID = TargetID;
CommandMailbox->Type3D.BusAddress = DataDMA;
DAC960_ExecuteCommand(Command);
CommandStatus = Command->V1.CommandStatus;
DAC960_DeallocateCommand(Command);
return (CommandStatus == DAC960_V1_NormalCompletion);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If it returns zero, something really bad happened, as it means the works struct was already queued, but we have just allocated it, so it should not happen. */ | int i2400m_schedule_work(struct i2400m *i2400m, void(*fn)(struct work_struct *), gfp_t gfp_flags, const void *pl, size_t pl_size) | /* If it returns zero, something really bad happened, as it means the works struct was already queued, but we have just allocated it, so it should not happen. */
int i2400m_schedule_work(struct i2400m *i2400m, void(*fn)(struct work_struct *), gfp_t gfp_flags, const void *pl, size_t pl_size) | {
int result;
struct i2400m_work *iw;
result = -ENOMEM;
iw = __i2400m_work_setup(i2400m, fn, gfp_flags, pl, pl_size);
if (iw != NULL) {
result = schedule_work(&iw->ws);
if (WARN_ON(result == 0))
result = -ENXIO;
}
return result;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: the #GQuark identifying the string, or 0 if @string is NULL */ | GQuark g_quark_from_static_string(const gchar *string) | /* Returns: the #GQuark identifying the string, or 0 if @string is NULL */
GQuark g_quark_from_static_string(const gchar *string) | {
GQuark quark;
if (!string)
return 0;
G_LOCK (quark_global);
quark = quark_from_string (string, FALSE);
G_UNLOCK (quark_global);
return quark;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Detect the SMI flash by reading the ID. Initializes the flash_info structure with size, sector count etc. */ | static ulong flash_get_size(ulong base, int banknum) | /* Detect the SMI flash by reading the ID. Initializes the flash_info structure with size, sector count etc. */
static ulong flash_get_size(ulong base, int banknum) | {
flash_info_t *info = &flash_info[banknum];
struct flash_dev *dev;
unsigned int value;
unsigned int density;
int i;
value = smi_read_id(info, banknum);
density = (value >> 16) & 0xff;
for (i = 0, dev = &flash_ids[0]; dev->density != 0x0;
i++, dev = &flash_ids[i]) {
if (dev->density == density) {
info->size = dev->size;
info->sector_count = dev->sector_count;
break;
}
}
if (dev->density == 0x0)
return 0;
info->flash_id = value & 0xffff;
info->start[0] = base;
return info->size;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* bfa_sgpg_mod BFA SGPG Mode module Compute and return memory needed by FCP(im) module. */ | static void bfa_sgpg_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len, u32 *dm_len) | /* bfa_sgpg_mod BFA SGPG Mode module Compute and return memory needed by FCP(im) module. */
static void bfa_sgpg_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len, u32 *dm_len) | {
if (cfg->drvcfg.num_sgpgs < BFA_SGPG_MIN)
cfg->drvcfg.num_sgpgs = BFA_SGPG_MIN;
*km_len += (cfg->drvcfg.num_sgpgs + 1) * sizeof(struct bfa_sgpg_s);
*dm_len += (cfg->drvcfg.num_sgpgs + 1) * sizeof(struct bfi_sgpg_s);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables the specified I2C software reset. */ | void I2C_EnableSoftwareReset(I2C_Module *I2Cx, FunctionalState Cmd) | /* Enables or disables the specified I2C software reset. */
void I2C_EnableSoftwareReset(I2C_Module *I2Cx, FunctionalState Cmd) | {
assert_param(IS_I2C_PERIPH(I2Cx));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
I2Cx->CTRL1 |= CTRL1_SWRESET_SET;
}
else
{
I2Cx->CTRL1 &= CTRL1_SWRESET_RESET;
}
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* The user Entry Point for module EmuGop. The user code starts with this function. */ | EFI_STATUS EFIAPI InitializeEmuGop(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* The user Entry Point for module EmuGop. The user code starts with this function. */
EFI_STATUS EFIAPI InitializeEmuGop(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gEmuGopDriverBinding,
ImageHandle,
&gEmuGopComponentName,
&gEmuGopComponentName2
);
ASSERT_EFI_ERROR (Status);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ | UINT32 EFIAPI PciSegmentOr32(IN UINT64 Address, IN UINT32 OrData) | /* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciSegmentOr32(IN UINT64 Address, IN UINT32 OrData) | {
UINTN Count;
PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioOr32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), OrData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Locates the requested handle(s) and returns them in Buffer. */ | EFI_STATUS EFIAPI CoreLocateHandle(IN EFI_LOCATE_SEARCH_TYPE SearchType, IN EFI_GUID *Protocol OPTIONAL, IN VOID *SearchKey OPTIONAL, IN OUT UINTN *BufferSize, OUT EFI_HANDLE *Buffer) | /* Locates the requested handle(s) and returns them in Buffer. */
EFI_STATUS EFIAPI CoreLocateHandle(IN EFI_LOCATE_SEARCH_TYPE SearchType, IN EFI_GUID *Protocol OPTIONAL, IN VOID *SearchKey OPTIONAL, IN OUT UINTN *BufferSize, OUT EFI_HANDLE *Buffer) | {
EFI_STATUS Status;
CoreAcquireProtocolLock ();
Status = InternalCoreLocateHandle (SearchType, Protocol, SearchKey, BufferSize, Buffer);
CoreReleaseProtocolLock ();
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* stb0899_carr_width Compute the width of the carrier return: width of carrier (kHz or Mhz) */ | long stb0899_carr_width(struct stb0899_state *state) | /* stb0899_carr_width Compute the width of the carrier return: width of carrier (kHz or Mhz) */
long stb0899_carr_width(struct stb0899_state *state) | {
struct stb0899_internal *internal = &state->internal;
return (internal->srate + (internal->srate * internal->rolloff) / 100);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param volume volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. return kStatus_Success is success, else configure failed. */ | status_t HAL_CODEC_WM8960_SetVolume(void *handle, uint32_t playChannel, uint32_t volume) | /* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param volume volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_WM8960_SetVolume(void *handle, uint32_t playChannel, uint32_t volume) | {
assert(handle != NULL);
status_t retVal = kStatus_Success;
if ((playChannel & kWM8960_HeadphoneLeft) || (playChannel & kWM8960_HeadphoneRight))
{
retVal = WM8960_SetVolume((wm8960_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)),
kWM8960_ModuleHP, volume);
}
if ((playChannel & kWM8960_SpeakerLeft) || (playChannel & kWM8960_SpeakerRight))
{
retVal = WM8960_SetVolume((wm8960_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)),
kWM8960_ModuleSpeaker, volume);
}
return retVal;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Return the KS8851 register number for the corresponding MII PHY register if possible. Return zero if the MII register has no direct mapping to the KS8851 register set. */ | static int ks8851_phy_reg(int reg) | /* Return the KS8851 register number for the corresponding MII PHY register if possible. Return zero if the MII register has no direct mapping to the KS8851 register set. */
static int ks8851_phy_reg(int reg) | {
switch (reg) {
case MII_BMCR:
return KS_P1MBCR;
case MII_BMSR:
return KS_P1MBSR;
case MII_PHYSID1:
return KS_PHY1ILR;
case MII_PHYSID2:
return KS_PHY1IHR;
case MII_ADVERTISE:
return KS_P1ANAR;
case MII_LPA:
return KS_P1ANLPR;
}
return 0x0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Function for reading a pointer to the value field of a TLV block from the p_raw_data buffer.
This function reads a pointer to the value field of a TLV block and inserts it into a structure pointed by the p_tlv_buf pointer. If there is no value field present in the TLV block, NULL is inserted. */ | static ret_code_t type_2_tag_value_ptr_extract(type_2_tag_t *p_type_2_tag, uint8_t *p_raw_data, uint16_t *p_v_offset, tlv_block_t *p_tlv_buf) | /* Function for reading a pointer to the value field of a TLV block from the p_raw_data buffer.
This function reads a pointer to the value field of a TLV block and inserts it into a structure pointed by the p_tlv_buf pointer. If there is no value field present in the TLV block, NULL is inserted. */
static ret_code_t type_2_tag_value_ptr_extract(type_2_tag_t *p_type_2_tag, uint8_t *p_raw_data, uint16_t *p_v_offset, tlv_block_t *p_tlv_buf) | {
if (p_tlv_buf->length == 0)
{
p_tlv_buf->p_value = NULL;
}
else
{
if (!type_2_tag_is_field_within_data_range(p_type_2_tag, *p_v_offset, p_tlv_buf->length))
{
return NRF_ERROR_INVALID_DATA;
}
p_tlv_buf->p_value = p_raw_data + *p_v_offset;
*p_v_offset += p_tlv_buf->length;
}
return NRF_SUCCESS;
} | labapart/polymcu | C++ | null | 201 |
/* Detect whether specific FIFO is empty or not. */ | BOOLEAN SerialFifoEmpty(IN SERIAL_DEV_FIFO *Fifo) | /* Detect whether specific FIFO is empty or not. */
BOOLEAN SerialFifoEmpty(IN SERIAL_DEV_FIFO *Fifo) | {
return (BOOLEAN)(Fifo->Head == Fifo->Tail);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If Cert is NULL, then return FALSE. If CertSize is 0, then return FALSE. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI X509GetVersion(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINTN *Version) | /* If Cert is NULL, then return FALSE. If CertSize is 0, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI X509GetVersion(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINTN *Version) | {
BOOLEAN Status;
X509 *X509Cert;
X509Cert = NULL;
Status = X509ConstructCertificate (Cert, CertSize, (UINT8 **)&X509Cert);
if ((X509Cert == NULL) || (!Status)) {
Status = FALSE;
}
if (Status) {
*Version = X509_get_version (X509Cert);
}
if (X509Cert != NULL) {
X509_free (X509Cert);
}
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Register a simple callback for handling any AB3100 events. */ | int ab3100_event_register(struct ab3100 *ab3100, struct notifier_block *nb) | /* Register a simple callback for handling any AB3100 events. */
int ab3100_event_register(struct ab3100 *ab3100, struct notifier_block *nb) | {
return blocking_notifier_chain_register(&ab3100->event_subscribers,
nb);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Description: Add a new interface record to the network interface hash table. Returns zero on success, negative values on failure. */ | static int sel_netif_insert(struct sel_netif *netif) | /* Description: Add a new interface record to the network interface hash table. Returns zero on success, negative values on failure. */
static int sel_netif_insert(struct sel_netif *netif) | {
int idx;
if (sel_netif_total >= SEL_NETIF_HASH_MAX)
return -ENOSPC;
idx = sel_netif_hashfn(netif->nsec.ifindex);
list_add_rcu(&netif->list, &sel_netif_hash[idx]);
sel_netif_total++;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Description: Insert a fully prepared request at the back of the I/O scheduler queue for execution and wait for completion. */ | int blk_execute_rq(struct request_queue *q, struct gendisk *bd_disk, struct request *rq, int at_head) | /* Description: Insert a fully prepared request at the back of the I/O scheduler queue for execution and wait for completion. */
int blk_execute_rq(struct request_queue *q, struct gendisk *bd_disk, struct request *rq, int at_head) | {
DECLARE_COMPLETION_ONSTACK(wait);
char sense[SCSI_SENSE_BUFFERSIZE];
int err = 0;
rq->ref_count++;
if (!rq->sense) {
memset(sense, 0, sizeof(sense));
rq->sense = sense;
rq->sense_len = 0;
}
rq->end_io_data = &wait;
blk_execute_rq_nowait(q, bd_disk, rq, at_head, blk_end_sync_rq);
wait_for_completion(&wait);
if (rq->errors)
err = -EIO;
return err;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Modified by the GLib Team and others 1997-2000. See the AUTHORS file for a list of people on the GLib Team. See the ChangeLog files for a list of changes. These files are distributed with GLib at */ | static void g_thread_abort(gint status, const gchar *function) | /* Modified by the GLib Team and others 1997-2000. See the AUTHORS file for a list of people on the GLib Team. See the ChangeLog files for a list of changes. These files are distributed with GLib at */
static void g_thread_abort(gint status, const gchar *function) | {
fprintf (stderr, "GLib (gthread-win32.c): Unexpected error from C library during '%s': %s. Aborting.\n",
strerror (status), function);
abort ();
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This is our per-port timeout handler, for checking the modem status signals. */ | static void sa1100_timeout(unsigned long data) | /* This is our per-port timeout handler, for checking the modem status signals. */
static void sa1100_timeout(unsigned long data) | {
struct sa1100_port *sport = (struct sa1100_port *)data;
unsigned long flags;
if (sport->port.state) {
spin_lock_irqsave(&sport->port.lock, flags);
sa1100_mctrl_check(sport);
spin_unlock_irqrestore(&sport->port.lock, flags);
mod_timer(&sport->timer, jiffies + MCTRL_TIMEOUT);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If called multiple times, then the data written will continue at the offset of the firmware configuration item where the previous write ended. */ | VOID EFIAPI QemuFwCfgWriteBytes(IN UINTN Size, IN VOID *Buffer) | /* If called multiple times, then the data written will continue at the offset of the firmware configuration item where the previous write ended. */
VOID EFIAPI QemuFwCfgWriteBytes(IN UINTN Size, IN VOID *Buffer) | {
if (QemuFwCfgIsAvailable ()) {
InternalQemuFwCfgWriteBytes (Size, Buffer);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enable or Disable Host config 0x6 to reset System. */ | BL_Err_Type GLB_Config_SDIO_Host_Reset_System(uint8_t enable) | /* Enable or Disable Host config 0x6 to reset System. */
BL_Err_Type GLB_Config_SDIO_Host_Reset_System(uint8_t enable) | {
uint32_t tmpVal = 0;
tmpVal = BL_RD_REG(GLB_BASE, GLB_SDIO_CFG0);
if (enable) {
tmpVal = BL_SET_REG_BIT(tmpVal, GLB_REG_SYS_RST_SD_EN);
} else {
tmpVal = BL_CLR_REG_BIT(tmpVal, GLB_REG_SYS_RST_SD_EN);
}
BL_WR_REG(GLB_BASE, GLB_SDIO_CFG0, tmpVal);
return SUCCESS;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This PDC call reads from the IODC of the module specified by the hpa argument. */ | int pdc_iodc_read(unsigned long *actcnt, unsigned long hpa, unsigned int index, void *iodc_data, unsigned int iodc_data_size) | /* This PDC call reads from the IODC of the module specified by the hpa argument. */
int pdc_iodc_read(unsigned long *actcnt, unsigned long hpa, unsigned int index, void *iodc_data, unsigned int iodc_data_size) | {
int retval;
unsigned long flags;
spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_IODC, PDC_IODC_READ, __pa(pdc_result), hpa,
index, __pa(pdc_result2), iodc_data_size);
convert_to_wide(pdc_result);
*actcnt = pdc_result[0];
memcpy(iodc_data, pdc_result2, iodc_data_size);
spin_unlock_irqrestore(&pdc_lock, flags);
return retval;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* bio_integrity_mark_head - Advance bip_vec skip bytes @bip: Integrity vector to advance Number of bytes to advance it */ | void bio_integrity_mark_head(struct bio_integrity_payload *bip, unsigned int skip) | /* bio_integrity_mark_head - Advance bip_vec skip bytes @bip: Integrity vector to advance Number of bytes to advance it */
void bio_integrity_mark_head(struct bio_integrity_payload *bip, unsigned int skip) | {
struct bio_vec *iv;
unsigned int i;
bip_for_each_vec(iv, bip, i) {
if (skip == 0) {
bip->bip_idx = i;
return;
} else if (skip >= iv->bv_len) {
skip -= iv->bv_len;
} else {
iv->bv_offset += skip;
iv->bv_len -= skip;
bip->bip_idx = i;
return;
}
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Read the value of the 200R calibration resistor. */ | void CN0429_RdRcal(uint8_t *args) | /* Read the value of the 200R calibration resistor. */
void CN0429_RdRcal(uint8_t *args) | {
eSensorResult = pGasSensor->open(uiDefaultAddress);
flushBuff(TXbuff, sizeof(TXbuff));
flushBuff(gBuff, sizeof(gBuff));
eSensorResult = pGasSensor->Read200RCal(gBuff);
if (eSensorResult != SENSOR_ERROR_NONE) {
UART_TX("ERROR!" _EOS);
} else {
snprintf((char*) TXbuff, 256, "Rcal = %d ohm%s", gBuff[0], _EOS);
UART_TX((const char*) TXbuff);
}
pGasSensor->close();
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* set the interface value to the connected device */ | usbh_status usbh_setdevfeature(usbh_host *puhost, uint8_t feature_selector, uint16_t windex) | /* set the interface value to the connected device */
usbh_status usbh_setdevfeature(usbh_host *puhost, uint8_t feature_selector, uint16_t windex) | {
usbh_status status = USBH_BUSY;
usbh_control *usb_ctl = &puhost->control;
if (CTL_IDLE == usb_ctl->ctl_state) {
usb_ctl->setup.req = (usb_req) {
.bmRequestType = USB_TRX_OUT | USB_RECPTYPE_DEV | USB_REQTYPE_STRD,
.bRequest = USB_SET_FEATURE,
.wValue = feature_selector,
.wIndex = windex,
.wLength = 0U
};
usbh_ctlstate_config (puhost, NULL, 0U);
}
status = usbh_ctl_handler (puhost);
return status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* snt_poll_getc - Get a character from the console in polling mode */ | static int snt_poll_getc(void) | /* snt_poll_getc - Get a character from the console in polling mode */
static int snt_poll_getc(void) | {
int ch;
ia64_sn_console_getc(&ch);
return ch;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ | VOID* EFIAPI AllocateReservedPages(IN UINTN Pages) | /* Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocateReservedPages(IN UINTN Pages) | {
return InternalAllocatePages (EfiReservedMemoryType, Pages);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Configure USART to work in hardware handshaking mode. */ | uint32_t usart_init_hw_handshaking(Usart *p_usart, const sam_usart_opt_t *p_usart_opt, uint32_t ul_mck) | /* Configure USART to work in hardware handshaking mode. */
uint32_t usart_init_hw_handshaking(Usart *p_usart, const sam_usart_opt_t *p_usart_opt, uint32_t ul_mck) | {
if (usart_init_rs232(p_usart, p_usart_opt, ul_mck)) {
return 1;
}
p_usart->US_MR = (p_usart->US_MR & ~US_MR_USART_MODE_Msk) |
US_MR_USART_MODE_HW_HANDSHAKING;
return 0;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Set the fields of structure stc_usart_clocksync_init_t to default values. */ | int32_t USART_ClockSync_StructInit(stc_usart_clocksync_init_t *pstcClockSyncInit) | /* Set the fields of structure stc_usart_clocksync_init_t to default values. */
int32_t USART_ClockSync_StructInit(stc_usart_clocksync_init_t *pstcClockSyncInit) | {
int32_t i32Ret = LL_ERR_INVD_PARAM;
if (NULL != pstcClockSyncInit) {
pstcClockSyncInit->u32ClockSrc = USART_CLK_SRC_INTERNCLK;
pstcClockSyncInit->u32ClockDiv = USART_CLK_DIV1;
pstcClockSyncInit->u32Baudrate = USART_DEFAULT_BAUDRATE;
pstcClockSyncInit->u32FirstBit = USART_FIRST_BIT_LSB;
pstcClockSyncInit->u32HWFlowControl = USART_HW_FLOWCTRL_RTS;
i32Ret = LL_OK;
}
return i32Ret;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This work queue function performs the blocking parts of socket shutdown. A few paths lead here. set_nn_state will trigger this callback if it sees an sc detached from the nn. state_change will also trigger this callback directly when it sees errors. In that case we need to call set_nn_state ourselves as state_change couldn't get the nn_lock and call set_nn_state itself. */ | static void o2net_shutdown_sc(struct work_struct *work) | /* This work queue function performs the blocking parts of socket shutdown. A few paths lead here. set_nn_state will trigger this callback if it sees an sc detached from the nn. state_change will also trigger this callback directly when it sees errors. In that case we need to call set_nn_state ourselves as state_change couldn't get the nn_lock and call set_nn_state itself. */
static void o2net_shutdown_sc(struct work_struct *work) | {
struct o2net_sock_container *sc =
container_of(work, struct o2net_sock_container,
sc_shutdown_work);
struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num);
sclog(sc, "shutting down\n");
if (o2net_unregister_callbacks(sc->sc_sock->sk, sc)) {
del_timer_sync(&sc->sc_idle_timeout);
o2net_sc_cancel_delayed_work(sc, &sc->sc_keepalive_work);
sc_put(sc);
kernel_sock_shutdown(sc->sc_sock, SHUT_RDWR);
}
o2net_ensure_shutdown(nn, sc, 0);
sc_put(sc);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Resets the RCC clock configuration to the default reset state. */ | void RCC_DeInit(void) | /* Resets the RCC clock configuration to the default reset state. */
void RCC_DeInit(void) | {
RCC->CR |= (uint32_t)0x00000001;
RCC->CFGR &= (uint32_t)0xF8FFC000;
RCC->CR &= (uint32_t)0xFEF6FFFF;
RCC->CR &= (uint32_t)0xFFFBFFFF;
RCC->CFGR &= (uint32_t)0xFF80FFFF;
RCC->CFGR2 &= (uint32_t)0xFFFFC000;
RCC->CFGR3 &= (uint32_t)0xF00ECCC;
RCC->CIR = 0x00000000;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Write the number of data chunks into the mailbox.
Function prototypes. */ | void mailbox_put(uint32_t size, int count, uint32_t *time) | /* Write the number of data chunks into the mailbox.
Function prototypes. */
void mailbox_put(uint32_t size, int count, uint32_t *time) | {
int i;
unsigned int t;
timing_t start;
timing_t end;
message.rx_source_thread = K_ANY;
message.tx_target_thread = K_ANY;
k_sem_give(&SEM0);
start = timing_timestamp_get();
for (i = 0; i < count; i++) {
k_mbox_put(&MAILB1, &message, K_FOREVER);
}
end = timing_timestamp_get();
t = (unsigned int)timing_cycles_get(&start, &end);
*time = SYS_CLOCK_HW_CYCLES_TO_NS_AVG(t, count);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Spurious interrupt handler.
Installed in all dynamic interrupt slots at boot time. Throws an error if called. */ | void z_irq_spurious(const void *unused) | /* Spurious interrupt handler.
Installed in all dynamic interrupt slots at boot time. Throws an error if called. */
void z_irq_spurious(const void *unused) | {
ARG_UNUSED(unused);
z_fatal_error(K_ERR_SPURIOUS_IRQ, NULL);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Checks if target device is ready for communication. */ | uint32_t NFC_IO_IsDeviceReady(uint16_t Addr, uint32_t Trials) | /* Checks if target device is ready for communication. */
uint32_t NFC_IO_IsDeviceReady(uint16_t Addr, uint32_t Trials) | {
HAL_StatusTypeDef status;
uint32_t tickstart = 0;
uint32_t currenttick = 0;
tickstart = HAL_GetTick();
do
{
status = HAL_I2C_IsDeviceReady(&hI2cHandler, Addr, Trials, NFC_I2C_TIMEOUT_STD);
currenttick = HAL_GetTick();
} while( ( (currenttick - tickstart) < NFC_I2C_TIMEOUT_MAX) && (status != HAL_OK) );
if (status != HAL_OK)
{
return NFC_I2C_ERROR_TIMEOUT;
}
return NFC_I2C_STATUS_SUCCESS;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Set the terminal to a specified display mode. In this driver, we only support mode 0. */ | EFI_STATUS EFIAPI TerminalConOutSetMode(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN ModeNumber) | /* Set the terminal to a specified display mode. In this driver, we only support mode 0. */
EFI_STATUS EFIAPI TerminalConOutSetMode(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN ModeNumber) | {
EFI_STATUS Status;
TERMINAL_DEV *TerminalDevice;
TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
if (ModeNumber >= (UINTN)This->Mode->MaxMode) {
return EFI_UNSUPPORTED;
}
This->Mode->Mode = (INT32)ModeNumber;
This->ClearScreen (This);
TerminalDevice->OutputEscChar = TRUE;
Status = This->OutputString (This, mSetModeString);
TerminalDevice->OutputEscChar = FALSE;
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
This->Mode->Mode = (INT32)ModeNumber;
Status = This->ClearScreen (This);
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function enable clock divider output module clock, enable clock divider output function and set frequency selection. */ | void CLK_EnableCKO(uint32_t u32ClkSrc, uint32_t u32ClkDiv, uint32_t u32ClkDivBy1En) | /* This function enable clock divider output module clock, enable clock divider output function and set frequency selection. */
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_EnableModuleClock(CLKO_MODULE);
CLK_SetModuleClock(CLKO_MODULE, u32ClkSrc, 0UL);
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Calculates data rate corresponding to a given 802.11n MCS index, bandwidth, and guard interval. */ | float ieee80211_htrate(int mcs_index, gboolean bandwidth, gboolean short_gi) | /* Calculates data rate corresponding to a given 802.11n MCS index, bandwidth, and guard interval. */
float ieee80211_htrate(int mcs_index, gboolean bandwidth, gboolean short_gi) | {
return (float)(ieee80211_ht_Dbps[mcs_index] * (bandwidth ? 108 : 52) / 52.0 / (short_gi ? 3.6 : 4.0));
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function also removes requests which are currently processed ny the hardware and those which are not yet scheduled. Caller should take care of locking. */ | static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) | /* This function also removes requests which are currently processed ny the hardware and those which are not yet scheduled. Caller should take care of locking. */
static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) | {
struct dwc3 *dwc = dep->dwc;
u32 reg;
dwc3_remove_requests(dwc, dep);
if (dep->flags & DWC3_EP_STALL)
__dwc3_gadget_ep_set_halt(dep, 0, false);
reg = dwc3_readl(dwc->regs, DWC3_DALEPENA);
reg &= ~DWC3_DALEPENA_EP(dep->number);
dwc3_writel(dwc->regs, DWC3_DALEPENA, reg);
dep->stream_capable = false;
dep->endpoint.desc = NULL;
dep->comp_desc = NULL;
dep->type = 0;
dep->flags = 0;
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Extract device path for given HII handle and class guid. */ | CHAR16* DmExtractDevicePathFromHiiHandle(IN EFI_HII_HANDLE Handle) | /* Extract device path for given HII handle and class guid. */
CHAR16* DmExtractDevicePathFromHiiHandle(IN EFI_HII_HANDLE Handle) | {
EFI_STATUS Status;
EFI_HANDLE DriverHandle;
ASSERT (Handle != NULL);
if (Handle == NULL) {
return NULL;
}
Status = gHiiDatabase->GetPackageListHandle (gHiiDatabase, Handle, &DriverHandle);
if (EFI_ERROR (Status)) {
return NULL;
}
return ConvertDevicePathToText (DevicePathFromHandle (DriverHandle), FALSE, FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function gets the match value for slow clock counter. This is use to interrupt the processor when RTC counts to the specified value. */ | unsigned long long PRCMSlowClkCtrMatchGet(void) | /* This function gets the match value for slow clock counter. This is use to interrupt the processor when RTC counts to the specified value. */
unsigned long long PRCMSlowClkCtrMatchGet(void) | {
unsigned long long ullValue;
ullValue = MAP_PRCMHIBRegRead(HIB3P3_BASE + HIB3P3_O_MEM_HIB_RTC_IRQ_MSW_CONF);
ullValue = ullValue<<32;
ullValue |= MAP_PRCMHIBRegRead(HIB3P3_BASE + HIB3P3_O_MEM_HIB_RTC_IRQ_LSW_CONF);
return ullValue;
} | micropython/micropython | C++ | Other | 18,334 |
/* Allocates and Initializes one Elliptic Curve Context for subsequent use with the NID. */ | VOID* EFIAPI EcNewByNid(IN UINTN Nid) | /* Allocates and Initializes one Elliptic Curve Context for subsequent use with the NID. */
VOID* EFIAPI EcNewByNid(IN UINTN Nid) | {
CALL_CRYPTO_SERVICE (EcNewByNid, (Nid), NULL);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Checks whether the specified USART flag is set or not. */ | FlagStatus USART_GetFlagStatus(USART_TypeDef *USARTx, uint32_t USART_FLAG) | /* Checks whether the specified USART flag is set or not. */
FlagStatus USART_GetFlagStatus(USART_TypeDef *USARTx, uint32_t USART_FLAG) | {
FlagStatus bitstatus = RESET;
assert_param(IS_USART_ALL_PERIPH(USARTx));
assert_param(IS_USART_FLAG(USART_FLAG));
if ((USARTx->ISR & USART_FLAG) != (uint16_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Enables or disables the RTC clock to be output through the relative pin. */ | void RTC_CalibOutputCmd(FunctionalState NewState) | /* Enables or disables the RTC clock to be output through the relative pin. */
void RTC_CalibOutputCmd(FunctionalState NewState) | {
assert_param(IS_FUNCTIONAL_STATE(NewState));
RTC->WPR = 0xCA;
RTC->WPR = 0x53;
if (NewState != DISABLE)
{
RTC->CR |= (uint32_t)RTC_CR_COE;
}
else
{
RTC->CR &= (uint32_t)~RTC_CR_COE;
}
RTC->WPR = 0xFF;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The tasks as described in the comments at the top of this file. */ | static void prvQueueReceiveTask(void *pvParameters) | /* The tasks as described in the comments at the top of this file. */
static void prvQueueReceiveTask(void *pvParameters) | {
unsigned long ulReceivedValue;
for( ;; )
{
xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
if( ulReceivedValue == 100UL )
{
if( ( ucGPIOState & mainTASK_CONTROLLED_LED ) != 0 )
{
ucGPIOState &= ~mainTASK_CONTROLLED_LED;
}
else
{
ucGPIOState |= mainTASK_CONTROLLED_LED;
}
XGpio_DiscreteWrite( &xOutputGPIOInstance, ulGPIOOutputChannel, ucGPIOState );
}
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Restore a previous state of Kinetis Processor System (PS) cache */ | void kinetis_ps_cache_restore(unsigned long *flags) | /* Restore a previous state of Kinetis Processor System (PS) cache */
void kinetis_ps_cache_restore(unsigned long *flags) | {
KINETIS_LMEM_PSCCR =
KINETIS_LMEM_CCR_GO_MSK |
KINETIS_LMEM_CCR_INVW1_MSK | KINETIS_LMEM_CCR_INVW0_MSK |
(*flags);
while (KINETIS_LMEM_PSCCR & KINETIS_LMEM_CCR_GO_MSK);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This is a library function, which implements the writepages() address_space_operation. */ | int generic_writepages(struct address_space *mapping, struct writeback_control *wbc) | /* This is a library function, which implements the writepages() address_space_operation. */
int generic_writepages(struct address_space *mapping, struct writeback_control *wbc) | {
if (!mapping->a_ops->writepage)
return 0;
return write_cache_pages(mapping, wbc, __writepage, mapping);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Converts a device path to its text representation. */ | CHAR16* EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts) | /* Converts a device path to its text representation. */
CHAR16* EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts) | {
return UefiDevicePathLibConvertDevicePathToText (DevicePath, DisplayOnly, AllowShortcuts);
} | tianocore/edk2 | C++ | Other | 4,240 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.