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
/* This is the top level routine of the printer. 'p' points to the Network_Header of the packet, 'h->ts' is the timestamp, 'h->len' is the length of the packet off the wire, and 'h->caplen' is the number of bytes actually captured. */
u_int ipfc_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p)
/* This is the top level routine of the printer. 'p' points to the Network_Header of the packet, 'h->ts' is the timestamp, 'h->len' is the length of the packet off the wire, and 'h->caplen' is the number of bytes actually captured. */ u_int ipfc_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p)
{ return (ipfc_print(ndo, p, h->len, h->caplen)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The col_list is only partly managed by the custom preference API because its data is shared between multiple preferences, so it's freed here */
static void free_col_info(GList *)
/* The col_list is only partly managed by the custom preference API because its data is shared between multiple preferences, so it's freed here */ static void free_col_info(GList *)
{ fmt_data *cfmt; GList *list_head = list; while (list != NULL) { cfmt = (fmt_data *)list->data; g_free(cfmt->title); g_free(cfmt->custom_fields); g_free(cfmt); list = g_list_next(list); } g_list_free(list_head); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If the application is using a static interrupt vector table stored in flash, then it is not necessary to register the interrupt handler this way. Instead, IntEnable() is used to enable AES interrupts on the interrupt controller. */
void AESIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
/* If the application is using a static interrupt vector table stored in flash, then it is not necessary to register the interrupt handler this way. Instead, IntEnable() is used to enable AES interrupts on the interrupt controller. */ void AESIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
{ ASSERT(ui32Base == AES_BASE); IntRegister(INT_AES0, pfnHandler); IntEnable(INT_AES0); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Clear All Status Flags. Program error, end of operation, write protect error, busy. */
void flash_clear_status_flags(void)
/* Clear All Status Flags. Program error, end of operation, write protect error, busy. */ void flash_clear_status_flags(void)
{ flash_clear_pgerr_flag(); flash_clear_eop_flag(); flash_clear_wrprterr_flag(); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Writes a data byte to the I2C transmit FIFO. */
uint32_t I2CFIFODataPutNonBlocking(uint32_t ui32Base, uint8_t ui8Data)
/* Writes a data byte to the I2C transmit FIFO. */ uint32_t I2CFIFODataPutNonBlocking(uint32_t ui32Base, uint8_t ui8Data)
{ ASSERT(_I2CBaseValid(ui32Base)); if (HWREG(ui32Base + I2C_O_FIFOSTATUS) & I2C_FIFOSTATUS_TXFF) { return (0); } else { HWREG(ui32Base + I2C_O_FIFODATA) = ui8Data; return (1); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Init the Comp n Interrupt Callback function. param of pfnCallback */
void xACMPIntCallbackInit(unsigned long ulBase, unsigned long ulCompID, xtEventCallback pfnCallback)
/* Init the Comp n Interrupt Callback function. param of pfnCallback */ void xACMPIntCallbackInit(unsigned long ulBase, unsigned long ulCompID, xtEventCallback pfnCallback)
{ unsigned long Base; xASSERT((ulBase == ACMP01_BASE) || (ulBase == ACMP23_BASE)); xASSERT((ulCompID == xACMP_0) || (ulCompID == xACMP_1)); Base = ((ulBase == ACMP01_BASE) ? 0 : 2); switch(ulCompID) { case xACMP_0: { g_pfnACMPHandlerCallbacks[Base+0] = pfnCallback; break; } case xACMP_1: { g_pfnACMPHandlerCallbacks[Base+1] = pfnCallback; break; } } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function retrieves the current file position for the file handle. For directories, the current file position has no meaning outside of the file system driver and as such the operation is not supported. An error is returned if FileHandle is a directory. */
EFI_STATUS EFIAPI FileHandleGetPosition(IN EFI_FILE_HANDLE FileHandle, OUT UINT64 *Position)
/* This function retrieves the current file position for the file handle. For directories, the current file position has no meaning outside of the file system driver and as such the operation is not supported. An error is returned if FileHandle is a directory. */ EFI_STATUS EFIAPI FileHandleGetPosition(IN EFI_FILE_HANDLE FileHandle, OUT UINT64 *Position)
{ if ((Position == NULL) || (FileHandle == NULL)) { return (EFI_INVALID_PARAMETER); } return (FileHandle->GetPosition (FileHandle, Position)); }
tianocore/edk2
C++
Other
4,240
/* Clean up process after a packet is received. */
void EMAC_RecvPktDone(EMAC_MEMMGR_T *psMemMgr)
/* Clean up process after a packet is received. */ void EMAC_RecvPktDone(EMAC_MEMMGR_T *psMemMgr)
{ EMAC_T *EMAC = psMemMgr->psEmac; EMAC_DESCRIPTOR_T *desc = (EMAC_DESCRIPTOR_T *)psMemMgr->psCurrentRxDesc; desc->u32Data = desc->u32Backup1; desc->u32Next = desc->u32Backup2; desc->u32Status1 |= EMAC_DESC_OWN_EMAC; desc = (EMAC_DESCRIPTOR_T *)desc->u32Next; psMemMgr->psCurrentRxDesc = desc; EMAC_TRIGGER_RX(EMAC); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Generic udelay assumes that if preemption is allowed and the thread migrates to another CPU, that the ITC values are synchronized across all CPUs. */
static void ia64_itc_udelay(unsigned long usecs)
/* Generic udelay assumes that if preemption is allowed and the thread migrates to another CPU, that the ITC values are synchronized across all CPUs. */ static void ia64_itc_udelay(unsigned long usecs)
{ unsigned long start = ia64_get_itc(); unsigned long end = start + usecs*local_cpu_data->cyc_per_usec; while (time_before(ia64_get_itc(), end)) cpu_relax(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Command response callback function for sd_ble_gap_sec_params_reply BLE command. Callback for decoding the command response return code. */
static uint32_t gap_sec_params_reply_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ble_gap_sec_params_reply BLE command. Callback for decoding the command response return code. */ static uint32_t gap_sec_params_reply_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{ uint32_t result_code = 0; uint32_t err_code = ble_gap_sec_params_reply_rsp_dec(p_buffer, length, m_output_params.gap_sec_params_reply_out_params.p_sec_keyset, &result_code); APP_ERROR_CHECK(err_code); if (result_code) { err_code = app_ble_gap_sec_context_destroy(m_output_params.gap_sec_params_reply_out_params.conn_handle); SER_ASSERT(err_code == NRF_SUCCESS, err_code); } return result_code; }
labapart/polymcu
C++
null
201
/* However, if a system exists that shares Wake and Run-time events on the same GPE this flag is available to tell Linux to keep the wake-time GPEs enabled at run-time. */
static int __init acpi_wake_gpes_always_on_setup(char *str)
/* However, if a system exists that shares Wake and Run-time events on the same GPE this flag is available to tell Linux to keep the wake-time GPEs enabled at run-time. */ static int __init acpi_wake_gpes_always_on_setup(char *str)
{ printk(KERN_INFO PREFIX "wake GPEs not disabled\n"); acpi_gbl_leave_wake_gpes_disabled = FALSE; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* This function prepares the state before issuing the class specific commands. */
USBH_StatusTypeDef USBH_CDC_Receive(USBH_HandleTypeDef *phost, uint8_t *pbuff, uint32_t length)
/* This function prepares the state before issuing the class specific commands. */ USBH_StatusTypeDef USBH_CDC_Receive(USBH_HandleTypeDef *phost, uint8_t *pbuff, uint32_t length)
{ USBH_StatusTypeDef Status = USBH_BUSY; CDC_HandleTypeDef *CDC_Handle = phost->pActiveClass->pData; if((CDC_Handle->state == CDC_IDLE_STATE) || (CDC_Handle->state == CDC_TRANSFER_DATA)) { CDC_Handle->pRxData = pbuff; CDC_Handle->RxDataLength = length; CDC_Handle->state = CDC_TRANSFER_DATA; CDC_Handle->data_rx_state = CDC_RECEIVE_DATA; Status = USBH_OK; } return Status; }
micropython/micropython
C++
Other
18,334
/* The callback is invoked by the driver within interrupt context, so it needs to do its job quickly. If there are potentially slow operations within the callback, these should be done at task-level. */
void XEmac_SetSgSendHandler(XEmac *InstancePtr, void *CallBackRef, XEmac_SgHandler FuncPtr)
/* The callback is invoked by the driver within interrupt context, so it needs to do its job quickly. If there are potentially slow operations within the callback, these should be done at task-level. */ void XEmac_SetSgSendHandler(XEmac *InstancePtr, void *CallBackRef, XEmac_SgHandler FuncPtr)
{ XASSERT_VOID(InstancePtr != NULL); XASSERT_VOID(FuncPtr != NULL); XASSERT_VOID(XEmac_mIsSgDma(InstancePtr)); XASSERT_VOID(InstancePtr->IsReady == XCOMPONENT_IS_READY); InstancePtr->SgSendHandler = FuncPtr; InstancePtr->SgSendRef = CallBackRef; }
EmcraftSystems/u-boot
C++
Other
181
/* Suspend can't complete until all the I/O is processed so if the last path fails we must error any remaining I/O. Note that if the freeze_bdev fails while suspending, the queue_if_no_path state is lost - userspace should reset it. */
static void multipath_presuspend(struct dm_target *ti)
/* Suspend can't complete until all the I/O is processed so if the last path fails we must error any remaining I/O. Note that if the freeze_bdev fails while suspending, the queue_if_no_path state is lost - userspace should reset it. */ static void multipath_presuspend(struct dm_target *ti)
{ struct multipath *m = (struct multipath *) ti->private; queue_if_no_path(m, 0, 1); }
robutest/uclinux
C++
GPL-2.0
60
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */
int main(void)
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */ int main(void)
{ SetupHardware(); LoggingInterval500MS_SRAM = eeprom_read_byte(&LoggingInterval500MS_EEPROM); if (LoggingInterval500MS_SRAM == 0xFF) LoggingInterval500MS_SRAM = DEFAULT_LOG_INTERVAL; OpenLogFile(); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { MS_Device_USBTask(&Disk_MS_Interface); HID_Device_USBTask(&Generic_HID_Interface); USB_USBTask(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* This API is used to get Water Mark Level in the register 0x3D bit from 0 to 6. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_fifo_wm_level(u8 *v_fifo_wm_level_u8)
/* This API is used to get Water Mark Level in the register 0x3D bit from 0 to 6. */ BMG160_RETURN_FUNCTION_TYPE bmg160_get_fifo_wm_level(u8 *v_fifo_wm_level_u8)
{ BMG160_RETURN_FUNCTION_TYPE comres = ERROR; u8 v_data_u8 = BMG160_INIT_VALUE; if (p_bmg160 == BMG160_NULL) { return E_BMG160_NULL_PTR; } else { comres = p_bmg160->BMG160_BUS_READ_FUNC(p_bmg160->dev_addr, BMG160_FIFO_CGF1_ADDR_WML__REG, &v_data_u8, BMG160_GEN_READ_WRITE_DATA_LENGTH); *v_fifo_wm_level_u8 = BMG160_GET_BITSLICE(v_data_u8, BMG160_FIFO_CGF1_ADDR_WML); } return comres; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read accelerometer data. Along with the actual sensor data, the LSB byte contains a "new" flag indicating if the data for this axis has been updated since the last time the axis data was read. Reading either LSB or MSB data will clear this flag. */
static bool bma180_get_accel(sensor_hal_t *hal, sensor_data_t *data)
/* Read accelerometer data. Along with the actual sensor data, the LSB byte contains a "new" flag indicating if the data for this axis has been updated since the last time the axis data was read. Reading either LSB or MSB data will clear this flag. */ static bool bma180_get_accel(sensor_hal_t *hal, sensor_data_t *data)
{ bma_axis_t axis[3]; size_t const count = sensor_bus_read(hal, hal->burst_addr, axis, sizeof(axis)); format_axis_data(hal, axis, data); return (count == sizeof(axis)); }
memfault/zero-to-main
C++
null
200
/* Determines whether the UART transmitter is busy or not. */
xtBoolean xUARTBusy(unsigned long ulBase)
/* Determines whether the UART transmitter is busy or not. */ xtBoolean xUARTBusy(unsigned long ulBase)
{ xASSERT(UARTBaseValid(ulBase)); return (!(xHWREG(ulBase + UART_FSR) & UART_FSR_TE_FLAG)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* LPSCI DMA receive finished callback function. This function is called when LPSCI DMA receive finished. It disables the LPSCI RX DMA request and sends kStatus_LPSCI_RxIdle to LPSCI callback. */
static void LPSCI_TransferReceiveDMACallback(dma_handle_t *handle, void *param)
/* LPSCI DMA receive finished callback function. This function is called when LPSCI DMA receive finished. It disables the LPSCI RX DMA request and sends kStatus_LPSCI_RxIdle to LPSCI callback. */ static void LPSCI_TransferReceiveDMACallback(dma_handle_t *handle, void *param)
{ assert(handle); assert(param); lpsci_dma_private_handle_t *lpsciPrivateHandle = (lpsci_dma_private_handle_t *)param; LPSCI_EnableRxDMA(lpsciPrivateHandle->base, false); DMA_DisableInterrupts(handle->base, handle->channel); lpsciPrivateHandle->handle->rxState = kLPSCI_RxIdle; if (lpsciPrivateHandle->handle->callback) { lpsciPrivateHandle->handle->callback(lpsciPrivateHandle->base, lpsciPrivateHandle->handle, kStatus_LPSCI_RxIdle, lpsciPrivateHandle->handle->userData); } }
labapart/polymcu
C++
null
201
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely. */
static const char* GetSensorTypeString(SDL_SensorType type)
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely. */ static const char* GetSensorTypeString(SDL_SensorType type)
{ static char unknown_type[64]; switch (type) { case SDL_SENSOR_INVALID: return "SDL_SENSOR_INVALID"; case SDL_SENSOR_UNKNOWN: return "SDL_SENSOR_UNKNOWN"; case SDL_SENSOR_ACCEL: return "SDL_SENSOR_ACCEL"; case SDL_SENSOR_GYRO: return "SDL_SENSOR_GYRO"; default: SDL_snprintf(unknown_type, sizeof(unknown_type), "UNKNOWN (%d)", type); return unknown_type; } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Get string by string id from HII Interface. */
CHAR16* PhysicalPresenceGetStringById(IN EFI_STRING_ID Id)
/* Get string by string id from HII Interface. */ CHAR16* PhysicalPresenceGetStringById(IN EFI_STRING_ID Id)
{ return HiiGetString (mPpStringPackHandle, Id, NULL); }
tianocore/edk2
C++
Other
4,240
/* System control can generate interrupts when the PLL achieves lock, if the internal LDO current limit is exceeded, if the internal oscillator fails, if the main oscillator fails, if the internal LDO output voltage droops too much, if the external voltage droops too much, or if the PLL fails. */
void SysCtlIntRegister(void(*pfnHandler)(void))
/* System control can generate interrupts when the PLL achieves lock, if the internal LDO current limit is exceeded, if the internal oscillator fails, if the main oscillator fails, if the internal LDO output voltage droops too much, if the external voltage droops too much, or if the PLL fails. */ void SysCtlIntRegister(void(*pfnHandler)(void))
{ IntRegister(INT_SYSCTL_TM4C123, pfnHandler); IntEnable(INT_SYSCTL_TM4C123); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get the data and length for a byte view, given the byte view page. Return the pointer, or NULL on error, and set "*data_len" to the length. */
const guint8* get_byte_view_data_and_length(GtkWidget *byte_view, guint *data_len)
/* Get the data and length for a byte view, given the byte view page. Return the pointer, or NULL on error, and set "*data_len" to the length. */ const guint8* get_byte_view_data_and_length(GtkWidget *byte_view, guint *data_len)
{ tvbuff_t *byte_view_tvb; const guint8 *data_ptr; byte_view_tvb = (tvbuff_t *)g_object_get_data(G_OBJECT(byte_view), E_BYTE_VIEW_TVBUFF_KEY); if (byte_view_tvb == NULL) return NULL; if ((*data_len = tvb_captured_length(byte_view_tvb))) { data_ptr = tvb_get_ptr(byte_view_tvb, 0, -1); return data_ptr; } else return ""; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The initialization function. We must explicitly call this function from the system initialization code, some time after uip_init() is called. */
void hello_world_init(void)
/* The initialization function. We must explicitly call this function from the system initialization code, some time after uip_init() is called. */ void hello_world_init(void)
{ uip_listen(HTONS(1000)); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* if the register index is invalid or unsupported in current APIC mode, then ASSERT. */
VOID EFIAPI WriteLocalApicReg(IN UINTN MmioOffset, IN UINT32 Value)
/* if the register index is invalid or unsupported in current APIC mode, then ASSERT. */ VOID EFIAPI WriteLocalApicReg(IN UINTN MmioOffset, IN UINT32 Value)
{ UINT32 MsrIndex; ASSERT ((MmioOffset & 0xf) == 0); if (GetApicMode () == LOCAL_APIC_MODE_XAPIC) { MmioWrite32 (GetLocalApicBaseAddress () + MmioOffset, Value); } else { ASSERT (MmioOffset != XAPIC_ICR_DFR_OFFSET); ASSERT (MmioOffset != XAPIC_ICR_HIGH_OFFSET); ASSERT (MmioOffset != XAPIC_ICR_LOW_OFFSET); MsrIndex = (UINT32)(MmioOffset >> 4) + X2APIC_MSR_BASE_ADDRESS; MemoryFence (); LocalApicWriteMsrReg32 (MsrIndex, Value); } }
tianocore/edk2
C++
Other
4,240
/* Checks whether the swap function enable or disable. */
en_flag_status_t EFM_GetSwapStatus(void)
/* Checks whether the swap function enable or disable. */ en_flag_status_t EFM_GetSwapStatus(void)
{ return ((0UL == READ_REG32(bCM_EFM->FSWP_b.FSWP)) ? RESET : SET); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* mzap_lookup: Looks up property described by "name" and returns the value in "value". */
static int mzap_lookup(mzap_phys_t *zapobj, zfs_endian_t endian, int objsize, char *name, uint64_t *value)
/* mzap_lookup: Looks up property described by "name" and returns the value in "value". */ static int mzap_lookup(mzap_phys_t *zapobj, zfs_endian_t endian, int objsize, char *name, uint64_t *value)
{ int i, chunks; mzap_ent_phys_t *mzap_ent = zapobj->mz_chunk; chunks = objsize / MZAP_ENT_LEN - 1; for (i = 0; i < chunks; i++) { if (strcmp(mzap_ent[i].mze_name, name) == 0) { *value = zfs_to_cpu64(mzap_ent[i].mze_value, endian); return ZFS_ERR_NONE; } } printf("couldn't find '%s'\n", name); return ZFS_ERR_FILE_NOT_FOUND; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Initializes the AES Initialization Vector IV according to the specified parameters in the AES_IVInitStruct. */
void AES_IVInit(AES_IVInitTypeDef *AES_IVInitStruct)
/* Initializes the AES Initialization Vector IV according to the specified parameters in the AES_IVInitStruct. */ void AES_IVInit(AES_IVInitTypeDef *AES_IVInitStruct)
{ AES->IVR0 = AES_IVInitStruct->AES_IV0; AES->IVR1 = AES_IVInitStruct->AES_IV1; AES->IVR2 = AES_IVInitStruct->AES_IV2; AES->IVR3 = AES_IVInitStruct->AES_IV3; }
avem-labs/Avem
C++
MIT License
1,752
/* Returns: the found #GNode, or NULL if the data is not found */
GNode* g_node_find(GNode *root, GTraverseType order, GTraverseFlags flags, gpointer data)
/* Returns: the found #GNode, or NULL if the data is not found */ GNode* g_node_find(GNode *root, GTraverseType order, GTraverseFlags flags, gpointer data)
{ gpointer d[2]; g_return_val_if_fail (root != NULL, NULL); g_return_val_if_fail (order <= G_LEVEL_ORDER, NULL); g_return_val_if_fail (flags <= G_TRAVERSE_MASK, NULL); d[0] = data; d[1] = NULL; g_node_traverse (root, order, flags, -1, g_node_find_func, d); return d[1]; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Closes an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
/* Closes an endpoint of the Low Level Driver. */ USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
{ HAL_PCD_EP_Close(pdev->pData, ep_addr); return USBD_OK; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Directory tree accounting is implemented using project quotas, where the project identifier is inherited from parent directories. A statvfs (df, etc.) of a directory that is using project quota should return a statvfs of the project, not the entire filesystem. This makes such trees appear as if they are filesystems in themselves. */
void xfs_qm_statvfs(xfs_inode_t *ip, struct kstatfs *statp)
/* Directory tree accounting is implemented using project quotas, where the project identifier is inherited from parent directories. A statvfs (df, etc.) of a directory that is using project quota should return a statvfs of the project, not the entire filesystem. This makes such trees appear as if they are filesystems in themselves. */ void xfs_qm_statvfs(xfs_inode_t *ip, struct kstatfs *statp)
{ xfs_mount_t *mp = ip->i_mount; xfs_dquot_t *dqp; if (!xfs_qm_dqget(mp, NULL, ip->i_d.di_projid, XFS_DQ_PROJ, 0, &dqp)) { xfs_fill_statvfs_from_dquot(statp, &dqp->q_core); xfs_qm_dqput(dqp); } }
robutest/uclinux
C++
GPL-2.0
60
/* Closes an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
/* Closes an endpoint of the Low Level Driver. */ USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
{ HAL_PCD_EP_Close(pdev->pData, ep_addr); return USBD_OK; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Draws a single pixel at the specified X/Y location. */
void lcdDrawPixel(uint16_t x, uint16_t y, uint16_t color)
/* Draws a single pixel at the specified X/Y location. */ void lcdDrawPixel(uint16_t x, uint16_t y, uint16_t color)
{ if ((x >= ssd1351Properties.width) || (y >= ssd1351Properties.height)) return; ssd1351SetCursor((uint8_t)x, (uint8_t)y); CMD(SSD1351_CMD_WRITERAM); DATA(color >> 8); DATA(color); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Function for handling the reception of a SLIP end byte. If the number of bytes received is greater than zero it will call m_slip_event_handler with number of bytes received and invalidate the mp_rx_buffer to protect against data corruption. No new bytes can be received until a new RX buffer is supplied. */
static void handle_slip_end(void)
/* Function for handling the reception of a SLIP end byte. If the number of bytes received is greater than zero it will call m_slip_event_handler with number of bytes received and invalidate the mp_rx_buffer to protect against data corruption. No new bytes can be received until a new RX buffer is supplied. */ static void handle_slip_end(void)
{ if (m_rx_received_count > 0) { if (m_slip_event_handler != NULL) { hci_slip_evt_t event = {HCI_SLIP_RX_RDY, mp_rx_buffer, m_rx_received_count}; m_rx_received_count = 0; mp_rx_buffer = NULL; m_slip_event_handler(event); } } }
labapart/polymcu
C++
null
201
/* Function to turn on this module. This is automatically called by */
inv_error_t inv_start_results_holder(void)
/* Function to turn on this module. This is automatically called by */ inv_error_t inv_start_results_holder(void)
{ inv_register_data_cb(inv_generate_results, INV_PRIORITY_RESULTS_HOLDER, INV_GYRO_NEW | INV_ACCEL_NEW | INV_MAG_NEW); return INV_SUCCESS; }
Luos-io/luos_engine
C++
MIT License
496
/* Get the result of the last executed command. */
uint32_t efc_get_result(Efc *p_efc)
/* Get the result of the last executed command. */ uint32_t efc_get_result(Efc *p_efc)
{ return p_efc->EEFC_FRR; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Find out the actual device address according to the requested device address from UsbBus. */
UINT8 XhcPeiBusDevAddrToSlotId(IN PEI_XHC_DEV *Xhc, IN UINT8 BusDevAddr)
/* Find out the actual device address according to the requested device address from UsbBus. */ UINT8 XhcPeiBusDevAddrToSlotId(IN PEI_XHC_DEV *Xhc, IN UINT8 BusDevAddr)
{ UINT8 Index; for (Index = 0; Index < 255; Index++) { if (Xhc->UsbDevContext[Index + 1].Enabled && (Xhc->UsbDevContext[Index + 1].SlotId != 0) && (Xhc->UsbDevContext[Index + 1].BusDevAddr == BusDevAddr)) { break; } } if (Index == 255) { return 0; } return Xhc->UsbDevContext[Index + 1].SlotId; }
tianocore/edk2
C++
Other
4,240
/* Polling the FPGA configuration status. Return 0 for success, non-zero for error. */
static int reconfig_status_polling_resp(void)
/* Polling the FPGA configuration status. Return 0 for success, non-zero for error. */ static int reconfig_status_polling_resp(void)
{ int ret; unsigned long start = get_timer(0); while (1) { ret = mbox_get_fpga_config_status(MBOX_RECONFIG_STATUS); if (!ret) return 0; if (ret != MBOX_CFGSTAT_STATE_CONFIG) return ret; if (get_timer(start) > RECONFIG_STATUS_POLL_RESP_TIMEOUT_MS) break; puts("."); udelay(RECONFIG_STATUS_INTERVAL_DELAY_US); } return -ETIMEDOUT; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This deallocates the parameter RAM slots allocated by edma_alloc_cont_slots. Callers/applications need to keep track of sets of contiguous parameter RAM slots that have been allocated using the edma_alloc_cont_slots API. Callers are responsible for ensuring the slots are inactive, and will not be activated. */
int edma_free_cont_slots(unsigned slot, int count)
/* This deallocates the parameter RAM slots allocated by edma_alloc_cont_slots. Callers/applications need to keep track of sets of contiguous parameter RAM slots that have been allocated using the edma_alloc_cont_slots API. Callers are responsible for ensuring the slots are inactive, and will not be activated. */ int edma_free_cont_slots(unsigned slot, int count)
{ unsigned ctlr, slot_to_free; int i; ctlr = EDMA_CTLR(slot); slot = EDMA_CHAN_SLOT(slot); if (slot < edma_info[ctlr]->num_channels || slot >= edma_info[ctlr]->num_slots || count < 1) return -EINVAL; for (i = slot; i < slot + count; ++i) { ctlr = EDMA_CTLR(i); slot_to_free = EDMA_CHAN_SLOT(i); memcpy_toio(edmacc_regs_base[ctlr] + PARM_OFFSET(slot_to_free), &dummy_paramset, PARM_SIZE); clear_bit(slot_to_free, edma_info[ctlr]->edma_inuse); } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Free all nodes in IP6_ADDRESS_INFO_ENTRY in the list array specified with ListHead. */
VOID Ip6FreeAddressInfoList(IN LIST_ENTRY *ListHead)
/* Free all nodes in IP6_ADDRESS_INFO_ENTRY in the list array specified with ListHead. */ VOID Ip6FreeAddressInfoList(IN LIST_ENTRY *ListHead)
{ IP6_ADDRESS_INFO_ENTRY *Node; LIST_ENTRY *Entry; LIST_ENTRY *NextEntry; NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, ListHead) { Node = NET_LIST_USER_STRUCT (Entry, IP6_ADDRESS_INFO_ENTRY, Link); RemoveEntryList (&Node->Link); FreePool (Node); } }
tianocore/edk2
C++
Other
4,240
/* Gets the remaining bytes of the current DMA descriptor transfer. */
uint32_t DMA_GetRemainingBytes(DMA_Type *base, uint32_t channel)
/* Gets the remaining bytes of the current DMA descriptor transfer. */ uint32_t DMA_GetRemainingBytes(DMA_Type *base, uint32_t channel)
{ assert(channel < FSL_FEATURE_DMA_NUMBER_OF_CHANNELSn(base)); if ((!DMA_ChannelIsActive(base, channel)) && (0x3FF == ((base->CHANNEL[channel].XFERCFG & DMA_CHANNEL_XFERCFG_XFERCOUNT_MASK) >> DMA_CHANNEL_XFERCFG_XFERCOUNT_SHIFT))) { return 0; } return ((base->CHANNEL[channel].XFERCFG & DMA_CHANNEL_XFERCFG_XFERCOUNT_MASK) >> DMA_CHANNEL_XFERCFG_XFERCOUNT_SHIFT) + 1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This file is part of the Simba project. */
int main()
/* This file is part of the Simba project. */ int main()
{ struct inet_if_ip_info_t info; sys_start(); esp_wifi_set_op_mode(esp_wifi_op_mode_station_t); inet_aton("192.168.0.200", &info.address); inet_aton("255.255.255.0", &info.netmask); inet_aton("192.168.0.1", &info.gateway); if (esp_wifi_station_init("Qvist2", "maxierik", (uint8_t[]){0xc8, 0xd7, 0x19, 0x0f, 0x04, 0x65}, &info) != 0) { std_printf(FSTR("Failed to configure the Station.\r\n")); } while (1) { esp_wifi_print(sys_get_stdout()); thrd_sleep(2); } return (0); }
eerimoq/simba
C++
Other
337
/* Return the total number of open files in the system */
static int get_nr_files(void)
/* Return the total number of open files in the system */ static int get_nr_files(void)
{ return percpu_counter_read_positive(&nr_files); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the sum of kt and nsec in ktime_t format */
ktime_t ktime_add_ns(const ktime_t kt, u64 nsec)
/* Returns the sum of kt and nsec in ktime_t format */ ktime_t ktime_add_ns(const ktime_t kt, u64 nsec)
{ ktime_t tmp; if (likely(nsec < NSEC_PER_SEC)) { tmp.tv64 = nsec; } else { unsigned long rem = do_div(nsec, NSEC_PER_SEC); tmp = ktime_set((long)nsec, rem); } return ktime_add(kt, tmp); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* @dev: pin controller device @group: the pin group name to look up */
static int pinctrl_group_name_to_selector(struct udevice *dev, const char *group)
/* @dev: pin controller device @group: the pin group name to look up */ static int pinctrl_group_name_to_selector(struct udevice *dev, const char *group)
{ const struct pinctrl_ops *ops = pinctrl_get_ops(dev); unsigned ngroups, selector; if (!ops->get_groups_count || !ops->get_group_name) { dev_dbg(dev, "get_groups_count or get_group_name missing\n"); return -ENOSYS; } ngroups = ops->get_groups_count(dev); for (selector = 0; selector < ngroups; selector++) { const char *gname = ops->get_group_name(dev, selector); if (!strcmp(group, gname)) return selector; } return -ENOSYS; }
4ms/stm32mp1-baremetal
C++
Other
137
/* The 'fixed delay' co-routine as described at the top of the file. */
static void prvFixedDelayCoRoutine(xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex)
/* The 'fixed delay' co-routine as described at the top of the file. */ static void prvFixedDelayCoRoutine(xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex)
{ signed portBASE_TYPE xResult; static const portTickType xFlashRates[ crfMAX_FLASH_TASKS ] = { 150 / portTICK_RATE_MS, 200 / portTICK_RATE_MS, 250 / portTICK_RATE_MS, 300 / portTICK_RATE_MS, 350 / portTICK_RATE_MS, 400 / portTICK_RATE_MS, 450 / portTICK_RATE_MS, 500 / portTICK_RATE_MS }; crSTART( xHandle ); for( ;; ) { crQUEUE_SEND( xHandle, xFlashQueue, ( void * ) &uxIndex, crfPOSTING_BLOCK_TIME, &xResult ); if( xResult != pdPASS ) { xCoRoutineFlashStatus = pdFAIL; } crDELAY( xHandle, xFlashRates[ uxIndex ] ); } crEND(); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Return the local rtp port used by the RTP connection */
int rtp_get_local_port(URLContext *h)
/* Return the local rtp port used by the RTP connection */ int rtp_get_local_port(URLContext *h)
{ RTPContext *s = h->priv_data; return udp_get_local_port(s->rtp_hd); }
DC-SWAT/DreamShell
C++
null
404
/* Enables the timer/counter for a PWM generator block. */
void PWMGenEnable(uint32_t ui32Base, uint32_t ui32Gen)
/* Enables the timer/counter for a PWM generator block. */ void PWMGenEnable(uint32_t ui32Base, uint32_t ui32Gen)
{ ASSERT((ui32Base == PWM0_BASE) || (ui32Base == PWM1_BASE)); ASSERT(_PWMGenValid(ui32Gen)); HWREG(PWM_GEN_BADDR(ui32Base, ui32Gen) + PWM_O_X_CTL) |= PWM_X_CTL_ENABLE; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* cxgb3i_ddp_release_gl - release a page buffer list @gl: a ddp page buffer list @pdev: pci_dev used for pci_unmap free a ddp page buffer list resulted from cxgb3i_ddp_make_gl(). */
void cxgb3i_ddp_release_gl(struct cxgb3i_gather_list *gl, struct pci_dev *pdev)
/* cxgb3i_ddp_release_gl - release a page buffer list @gl: a ddp page buffer list @pdev: pci_dev used for pci_unmap free a ddp page buffer list resulted from cxgb3i_ddp_make_gl(). */ void cxgb3i_ddp_release_gl(struct cxgb3i_gather_list *gl, struct pci_dev *pdev)
{ ddp_gl_unmap(pdev, gl); kfree(gl); }
robutest/uclinux
C++
GPL-2.0
60
/* Change Logs: Date Author Notes armink first version */
int main(void)
/* Change Logs: Date Author Notes armink first version */ int main(void)
{ rt_kprintf("Hello RT-Thread!\n"); return RT_EOK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns CR_OK upon sucessful completion, an error code otherwise. */
enum CRStatus cr_font_family_destroy(CRFontFamily *a_this)
/* Returns CR_OK upon sucessful completion, an error code otherwise. */ enum CRStatus cr_font_family_destroy(CRFontFamily *a_this)
{ CRFontFamily *cur_ff = NULL; g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR); for (cur_ff = a_this; cur_ff && cur_ff->next; cur_ff = cur_ff->next) ; for (; cur_ff; cur_ff = cur_ff->prev) { if (a_this->name) { g_free (a_this->name); a_this->name = NULL; } if (cur_ff->next) { g_free (cur_ff->next); } if (cur_ff->prev == NULL) { g_free (a_this); } } return CR_OK; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Emit a SETLIST instruction. 'base' is register that keeps table; 'nelems' is #table plus those to be stored now; 'tostore' is number of values (in registers 'base + 1',...) to add to table (or LUA_MULTRET to add up to stack top). */
void luaK_setlist(FuncState *fs, int base, int nelems, int tostore)
/* Emit a SETLIST instruction. 'base' is register that keeps table; 'nelems' is #table plus those to be stored now; 'tostore' is number of values (in registers 'base + 1',...) to add to table (or LUA_MULTRET to add up to stack top). */ void luaK_setlist(FuncState *fs, int base, int nelems, int tostore)
{ int extra = nelems / (MAXARG_C + 1); nelems %= (MAXARG_C + 1); luaK_codeABCk(fs, OP_SETLIST, base, tostore, nelems, 1); codeextraarg(fs, extra); } fs->freereg = base + 1; }
Nicholas3388/LuaNode
C++
Other
1,055
/* STUSB1602 checks the VCONN power switch RVP Fault on CC1 (bit5 0x13 */
VCONN_SW_RVP_Fault_CC1_TypeDef STUSB1602_VCONN_SW_RVP_Fault_CC1_Get(uint8_t Addr)
/* STUSB1602 checks the VCONN power switch RVP Fault on CC1 (bit5 0x13 */ VCONN_SW_RVP_Fault_CC1_TypeDef STUSB1602_VCONN_SW_RVP_Fault_CC1_Get(uint8_t Addr)
{ STUSB1602_HW_FAULT_STATUS_RegTypeDef reg; STUSB1602_ReadReg(&reg.d8, Addr, STUSB1602_HW_FAULT_STATUS_REG, 1); return (VCONN_SW_RVP_Fault_CC1_TypeDef)(reg.b.VCONN_SW_RVP_FAULT_CC1); }
st-one/X-CUBE-USB-PD
C++
null
110
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void)
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */ int main(void)
{ SetupHardware(); puts_P(PSTR(ESC_FG_CYAN "Mouse Host Demo running.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { MouseHost_Task(); HID_Host_USBTask(&Mouse_HID_Interface); USB_USBTask(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Clears a Stall condition on an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
/* Clears a Stall condition on an endpoint of the Low Level Driver. */ USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
{ HAL_PCD_EP_ClrStall((PCD_HandleTypeDef*) pdev->pData, ep_addr); return USBD_OK; }
st-one/X-CUBE-USB-PD
C++
null
110
/* tdb_hash(): based on the hash agorithm from gdbm, via tdb (from module-init-tools) */
static unsigned int tdb_hash(const char *name)
/* tdb_hash(): based on the hash agorithm from gdbm, via tdb (from module-init-tools) */ static unsigned int tdb_hash(const char *name)
{ unsigned value; unsigned i; for (value = 0x238F13AF * strlen(name), i=0; name[i]; i++) value = (value + (((const unsigned char *)name)[i] << (i*5 % 24))); return (1103515243 * value + 12345); }
ve3wwg/teensy3_qemu
C++
Other
15
/* Hands off the Zcl Appliance Statistics cluster dissector. */
void proto_reg_handoff_zbee_zcl_appl_stats(void)
/* Hands off the Zcl Appliance Statistics cluster dissector. */ void proto_reg_handoff_zbee_zcl_appl_stats(void)
{ dissector_handle_t appl_stats_handle; appl_stats_handle = find_dissector(ZBEE_PROTOABBREV_ZCL_APPLSTATS); dissector_add_uint("zbee.zcl.cluster", ZBEE_ZCL_CID_APPLIANCE_STATISTICS, appl_stats_handle); zbee_zcl_init_cluster( proto_zbee_zcl_appl_stats, ett_zbee_zcl_appl_stats, ZBEE_ZCL_CID_APPLIANCE_STATISTICS, hf_zbee_zcl_appl_stats_attr_id, hf_zbee_zcl_appl_stats_srv_rx_cmd_id, hf_zbee_zcl_appl_stats_srv_tx_cmd_id, NULL ); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Removes mac address from the internal hash table */
static int hash_del(struct emac_priv *priv, u8 *mac_addr)
/* Removes mac address from the internal hash table */ static int hash_del(struct emac_priv *priv, u8 *mac_addr)
{ u32 hash_value; u32 hash_bit; hash_value = hash_get(mac_addr); if (priv->multicast_hash_cnt[hash_value] > 0) { --priv->multicast_hash_cnt[hash_value]; } if (priv->multicast_hash_cnt[hash_value] > 0) return 0; if (hash_value < 32) { hash_bit = BIT(hash_value); priv->mac_hash1 &= ~hash_bit; } else { hash_bit = BIT((hash_value - 32)); priv->mac_hash2 &= ~hash_bit; } return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Clear pending bit in Comparator Wakeup ADC/SYS Status Register. */
void CMP_INTClearPendingBit(u32 Cmp_IT)
/* Clear pending bit in Comparator Wakeup ADC/SYS Status Register. */ void CMP_INTClearPendingBit(u32 Cmp_IT)
{ CMP_TypeDef *comparator = COMPARATOR; comparator->COMP_WK_STS = Cmp_IT; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Actual virtual to bus physical address translator for 32 bit addressable DMAable memory. */
dma_addr_t __vtobus(m_pool_ident_t dev_dmat, void *m)
/* Actual virtual to bus physical address translator for 32 bit addressable DMAable memory. */ dma_addr_t __vtobus(m_pool_ident_t dev_dmat, void *m)
{ unsigned long flags; m_pool_p mp; int hc = VTOB_HASH_CODE(m); m_vtob_p vp = NULL; void *a = (void *)((unsigned long)m & ~SYM_MEM_CLUSTER_MASK); dma_addr_t b; spin_lock_irqsave(&sym53c8xx_lock, flags); mp = ___get_dma_pool(dev_dmat); if (mp) { vp = mp->vtob[hc]; while (vp && vp->vaddr != a) vp = vp->next; } if (!vp) panic("sym: VTOBUS FAILED!\n"); b = vp->baddr + (m - a); spin_unlock_irqrestore(&sym53c8xx_lock, flags); return b; }
robutest/uclinux
C++
GPL-2.0
60
/* Initialization function for the floating-point transposed direct form II Biquad cascade filter. */
void arm_biquad_cascade_df2T_init_f64(arm_biquad_cascade_df2T_instance_f64 *S, uint8_t numStages, const float64_t *pCoeffs, float64_t *pState)
/* Initialization function for the floating-point transposed direct form II Biquad cascade filter. */ void arm_biquad_cascade_df2T_init_f64(arm_biquad_cascade_df2T_instance_f64 *S, uint8_t numStages, const float64_t *pCoeffs, float64_t *pState)
{ S->numStages = numStages; S->pCoeffs = pCoeffs; memset(pState, 0, (2U * (uint32_t) numStages) * sizeof(float64_t)); S->pState = pState; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* vasprintf() and asprintf() for platforms with a C99-compliant snprintf() - so that, if you format into a 1-byte buffer, it will return how many characters it would have produced had it been given an infinite-sized buffer. */
int pcap_vasprintf(char **strp, const char *format, va_list args)
/* vasprintf() and asprintf() for platforms with a C99-compliant snprintf() - so that, if you format into a 1-byte buffer, it will return how many characters it would have produced had it been given an infinite-sized buffer. */ int pcap_vasprintf(char **strp, const char *format, va_list args)
{ char buf; int len; size_t str_size; char *str; int ret; len = vsnprintf(&buf, sizeof buf, format, args); if (len == -1) { *strp = NULL; return (-1); } str_size = len + 1; str = malloc(str_size); if (str == NULL) { *strp = NULL; return (-1); } ret = vsnprintf(str, str_size, format, args); if (ret == -1) { free(str); *strp = NULL; return (-1); } *strp = str; return (ret); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns the "position" in the "directory stream" which can be used with seekdir to go back to an old entry. We simply return the value in stat. */
long _ttelldir(_TDIR *dirp)
/* Returns the "position" in the "directory stream" which can be used with seekdir to go back to an old entry. We simply return the value in stat. */ long _ttelldir(_TDIR *dirp)
{ errno = 0; if (!dirp) { errno = EFAULT; return -1; } return dirp->dd_stat; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This call will set the output drive mode for the @gpio to output. */
int msp71xx_set_output_drive(unsigned gpio, int value)
/* This call will set the output drive mode for the @gpio to output. */ int msp71xx_set_output_drive(unsigned gpio, int value)
{ unsigned long flags; u32 data; if (gpio > 15 || gpio < 0) return -EINVAL; spin_lock_irqsave(&gpio_lock, flags); data = __raw_readl((void __iomem *)(MSP71XX_GPIO_BASE + 0x190)); if (value) data |= (1 << gpio); else data &= ~(1 << gpio); __raw_writel(data, (void __iomem *)(MSP71XX_GPIO_BASE + 0x190)); spin_unlock_irqrestore(&gpio_lock, flags); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Changes the mapping of the chip so that the remap area mirrors the internal ROM or the EBI CS0 (depending on the BMS input). */
void BOARD_RemapRom(void)
/* Changes the mapping of the chip so that the remap area mirrors the internal ROM or the EBI CS0 (depending on the BMS input). */ void BOARD_RemapRom(void)
{ WRITE(AT91C_BASE_MATRIX, MATRIX_MRCR, 0); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Here's 3 ways to calculate the OUI from the ID registers. */
static int mii_get_oui(u_char phyaddr, u_long ioaddr)
/* Here's 3 ways to calculate the OUI from the ID registers. */ static int mii_get_oui(u_char phyaddr, u_long ioaddr)
{ int r2, r3; r2 = mii_rd(MII_ID0, phyaddr, ioaddr); r3 = mii_rd(MII_ID1, phyaddr, ioaddr); return r2; }
robutest/uclinux
C++
GPL-2.0
60
/* ip_vs_app unregistration routine We are sure there are no app incarnations attached to services */
void unregister_ip_vs_app(struct ip_vs_app *app)
/* ip_vs_app unregistration routine We are sure there are no app incarnations attached to services */ void unregister_ip_vs_app(struct ip_vs_app *app)
{ struct ip_vs_app *inc, *nxt; mutex_lock(&__ip_vs_app_mutex); list_for_each_entry_safe(inc, nxt, &app->incs_list, a_list) { ip_vs_app_inc_release(inc); } list_del(&app->a_list); mutex_unlock(&__ip_vs_app_mutex); ip_vs_use_count_dec(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* 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)
{ MS_Device_ProcessControlRequest(&Disk_MS_Interface); HID_Device_ProcessControlRequest(&Generic_HID_Interface); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* this function is a POSIX compliant version, which shall perform a variety of control functions on devices. */
int fcntl(int fildes, int cmd,...)
/* this function is a POSIX compliant version, which shall perform a variety of control functions on devices. */ int fcntl(int fildes, int cmd,...)
{ int ret = -1; struct dfs_file *file; file = fd_get(fildes); if (file) { void *arg; va_list ap; va_start(ap, cmd); arg = va_arg(ap, void *); va_end(ap); ret = dfs_file_ioctl(file, cmd, arg); if (ret < 0) { ret = dfs_file_fcntl(fildes, cmd, (unsigned long)arg); } } else { ret = -EBADF; } if (ret < 0) { rt_set_errno(ret); ret = -1; } return ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads the status of the Ethernet system time interrupt. */
uint32_t EMACTimestampIntStatus(uint32_t ui32Base)
/* Reads the status of the Ethernet system time interrupt. */ uint32_t EMACTimestampIntStatus(uint32_t ui32Base)
{ ASSERT(ui32Base == EMAC0_BASE); return (HWREG(ui32Base + EMAC_O_TIMSTAT)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIODirModeSet(unsigned long ulPort, unsigned char ucPins, unsigned long ulPinIO)
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIODirModeSet(unsigned long ulPort, unsigned char ucPins, unsigned long ulPinIO)
{ ASSERT(GPIOBaseValid(ulPort)); ASSERT((ulPinIO == GPIO_DIR_MODE_IN) || (ulPinIO == GPIO_DIR_MODE_OUT) || (ulPinIO == GPIO_DIR_MODE_HW)); HWREG(ulPort + GPIO_O_DIR) = ((ulPinIO & 1) ? (HWREG(ulPort + GPIO_O_DIR) | ucPins) : (HWREG(ulPort + GPIO_O_DIR) & ~(ucPins))); HWREG(ulPort + GPIO_O_AFSEL) = ((ulPinIO & 2) ? (HWREG(ulPort + GPIO_O_AFSEL) | ucPins) : (HWREG(ulPort + GPIO_O_AFSEL) & ~(ucPins))); }
watterott/WebRadio
C++
null
71
/* Look up the hardware configuration for a device instance */
XLlFifo_Config* XLlFfio_LookupConfig(u32 DeviceId)
/* Look up the hardware configuration for a device instance */ XLlFifo_Config* XLlFfio_LookupConfig(u32 DeviceId)
{ extern XLlFifo_Config XLlFifo_ConfigTable[]; XLlFifo_Config *CfgPtr; u32 Index; CfgPtr = NULL; for (Index = 0; Index < XPAR_XLLFIFO_NUM_INSTANCES; Index++) { if (XLlFifo_ConfigTable[Index].DeviceId == DeviceId) { CfgPtr = &XLlFifo_ConfigTable[Index]; break; } } return CfgPtr; } /** @}
ua1arn/hftrx
C++
null
69
/* Forces or releases Low Speed APB (APB1) peripheral reset. */
void RCC_APB1PeriphResetCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
/* Forces or releases Low Speed APB (APB1) peripheral reset. */ void RCC_APB1PeriphResetCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
{ assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RCC->APB1RSTR |= RCC_APB1Periph; } else { RCC->APB1RSTR &= ~RCC_APB1Periph; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sets count value for the given TCC module. Sets the timer count value of an initialized TCC module. The specified TCC module can remain running or stopped. */
enum status_code tcc_set_count_value(const struct tcc_module *const module_inst, const uint32_t count)
/* Sets count value for the given TCC module. Sets the timer count value of an initialized TCC module. The specified TCC module can remain running or stopped. */ enum status_code tcc_set_count_value(const struct tcc_module *const module_inst, const uint32_t count)
{ Assert(module_inst); Assert(module_inst->hw); Tcc *const tcc_module = module_inst->hw; uint8_t module_index = _tcc_get_inst_index(tcc_module); uint32_t max_count = _tcc_maxs[module_index]; if (count > max_count) { return STATUS_ERR_INVALID_ARG; } while (tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_COUNT) { } tcc_module->COUNT.reg = (count); return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* : BT controller callback function, to transfer data packet to upper controller is ready to receive command */
static int host_rcv_pkt(uint8_t *data, uint16_t len)
/* : BT controller callback function, to transfer data packet to upper controller is ready to receive command */ static int host_rcv_pkt(uint8_t *data, uint16_t len)
{ printf("host rcv pkt: "); for (uint16_t i = 0; i < len; i++) { printf("%02x", data[i]); } printf("\n"); return 0; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* This function checks if static volume @vol_id is corrupted by fully reading it and checking data CRC. This function returns %0 if the volume is not corrupted, %1 if it is corrupted and a negative error code in case of failure. Dynamic volumes are not checked and zero is returned immediately. */
int ubi_check_volume(struct ubi_device *ubi, int vol_id)
/* This function checks if static volume @vol_id is corrupted by fully reading it and checking data CRC. This function returns %0 if the volume is not corrupted, %1 if it is corrupted and a negative error code in case of failure. Dynamic volumes are not checked and zero is returned immediately. */ int ubi_check_volume(struct ubi_device *ubi, int vol_id)
{ void *buf; int err = 0, i; struct ubi_volume *vol = ubi->volumes[vol_id]; if (vol->vol_type != UBI_STATIC_VOLUME) return 0; buf = vmalloc(vol->usable_leb_size); if (!buf) return -ENOMEM; for (i = 0; i < vol->used_ebs; i++) { int size; cond_resched(); if (i == vol->used_ebs - 1) size = vol->last_eb_bytes; else size = vol->usable_leb_size; err = ubi_eba_read_leb(ubi, vol, i, buf, 0, size, 1); if (err) { if (mtd_is_eccerr(err)) err = 1; break; } } vfree(buf); return err; }
4ms/stm32mp1-baremetal
C++
Other
137
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeComparator(uint32_t ui32Port, uint8_t ui8Pins)
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIOPinTypeComparator(uint32_t ui32Port, uint8_t ui8Pins)
{ ASSERT(_GPIOBaseValid(ui32Port)); GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_IN); GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_ANALOG); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Enable ROM decoding on @dev. This involves simply turning on the last bit of the PCI ROM BAR. Note that some cards may share address decoders between the ROM and other resources, so enabling it may disable access to MMIO registers or other card memory. */
int pci_enable_rom(struct pci_dev *pdev)
/* Enable ROM decoding on @dev. This involves simply turning on the last bit of the PCI ROM BAR. Note that some cards may share address decoders between the ROM and other resources, so enabling it may disable access to MMIO registers or other card memory. */ int pci_enable_rom(struct pci_dev *pdev)
{ struct resource *res = pdev->resource + PCI_ROM_RESOURCE; struct pci_bus_region region; u32 rom_addr; if (!res->flags) return -1; pcibios_resource_to_bus(pdev, &region, res); pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_addr); rom_addr &= ~PCI_ROM_ADDRESS_MASK; rom_addr |= region.start | PCI_ROM_ADDRESS_ENABLE; pci_write_config_dword(pdev, pdev->rom_base_reg, rom_addr); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Look for a drive in the blacklist and the whitelist tables Returns 1 if the drive is found in the table. */
int ide_in_drive_list(u16 *id, const struct drive_list_entry *table)
/* Look for a drive in the blacklist and the whitelist tables Returns 1 if the drive is found in the table. */ int ide_in_drive_list(u16 *id, const struct drive_list_entry *table)
{ for ( ; table->id_model; table++) if ((!strcmp(table->id_model, (char *)&id[ATA_ID_PROD])) && (!table->id_firmware || strstr((char *)&id[ATA_ID_FW_REV], table->id_firmware))) return 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Message: DeleteConferenceResMessage Opcode: 0x0036 Type: IntraCCM Direction: pbx2pbx VarLength: no */
static void handle_DeleteConferenceResMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: DeleteConferenceResMessage Opcode: 0x0036 Type: IntraCCM Direction: pbx2pbx VarLength: no */ static void handle_DeleteConferenceResMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ ptvcursor_add(cursor, hf_skinny_conferenceID, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_delete_conf_result, 4, ENC_LITTLE_ENDIAN); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Enable engine clock and turn on the pipe. */
void CAP_SetPipeEnable(BOOL bEngEnable, E_CAP_PIPE ePipeEnable)
/* Enable engine clock and turn on the pipe. */ void CAP_SetPipeEnable(BOOL bEngEnable, E_CAP_PIPE ePipeEnable)
{ outp32(REG_CAP_CTL, (inp32(REG_CAP_CTL) & ~(CAPEN | PKTEN | PLNEN)) | (((bEngEnable ? CAPEN : 0x0)) | ((ePipeEnable & 0x03) << 5))); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ufshcd_init_pwr_info - setting the POR (power on reset) values in hba power info */
static void ufshcd_init_pwr_info(struct ufs_hba *hba)
/* ufshcd_init_pwr_info - setting the POR (power on reset) values in hba power info */ static void ufshcd_init_pwr_info(struct ufs_hba *hba)
{ hba->pwr_info.gear_rx = UFS_PWM_G1; hba->pwr_info.gear_tx = UFS_PWM_G1; hba->pwr_info.lane_rx = 1; hba->pwr_info.lane_tx = 1; hba->pwr_info.pwr_rx = SLOWAUTO_MODE; hba->pwr_info.pwr_tx = SLOWAUTO_MODE; hba->pwr_info.hs_rate = 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* If 64-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT64 EFIAPI S3IoBitFieldAnd64(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 AndData)
/* If 64-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT64 EFIAPI S3IoBitFieldAnd64(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 AndData)
{ return InternalSaveIoWrite64ValueToBootScript (Port, IoBitFieldAnd64 (Port, StartBit, EndBit, AndData)); }
tianocore/edk2
C++
Other
4,240
/* This function returns the flags representing the wake configuration for the Hibernation module. The return value is a combination of the following flags: */
uint32_t HibernateWakeGet(void)
/* This function returns the flags representing the wake configuration for the Hibernation module. The return value is a combination of the following flags: */ uint32_t HibernateWakeGet(void)
{ uint32_t ui32Ctrl; if(HIBERNATE_WAKE_IO) { ui32Ctrl = HWREG(HIB_CTL); return((ui32Ctrl & (HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RTC | HIBERNATE_WAKE_LOW_BAT)) | ((HWREG(HIB_IO) << 16) & (HIBERNATE_WAKE_RESET | HIBERNATE_WAKE_GPIO))); } else { return(HWREG(HIB_CTL) & (HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RTC | HIBERNATE_WAKE_LOW_BAT)); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* SPI1 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */
void SPI1_IRQHandler(void)
/* SPI1 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */ void SPI1_IRQHandler(void)
{ unsigned long ulEventFlags; unsigned long ulBase = SPI1_BASE; ulEventFlags = xHWREG(ulBase + SPI_STATUS); xHWREG(ulBase + SPI_STATUS) |= ulEventFlags; if(g_pfnSPIHandlerCallbacks[1]) { g_pfnSPIHandlerCallbacks[1](0, 0, ulEventFlags, 0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Invalidate the entire contents of both caches, after writing back to memory any dirty data from the D-cache. */
static void sh5_flush_cache_all(void *unused)
/* Invalidate the entire contents of both caches, after writing back to memory any dirty data from the D-cache. */ static void sh5_flush_cache_all(void *unused)
{ sh64_dcache_purge_all(); sh64_icache_inv_all(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Store, in the ethernet_context for master interface, the original eth_tx() function, which will send packet with tag appended. */
int dsa_register_master_tx(struct net_if *iface, dsa_send_t fn)
/* Store, in the ethernet_context for master interface, the original eth_tx() function, which will send packet with tag appended. */ int dsa_register_master_tx(struct net_if *iface, dsa_send_t fn)
{ struct ethernet_context *ctx = net_if_l2_data(iface); ctx->dsa_send = fn; return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Gets Graphics Console device's foreground color and background color. */
EFI_STATUS GetTextColors(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground, OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background)
/* Gets Graphics Console device's foreground color and background color. */ EFI_STATUS GetTextColors(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground, OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background)
{ INTN Attribute; Attribute = This->Mode->Attribute & 0x7F; *Foreground = mGraphicsEfiColors[Attribute & 0x0f]; *Background = mGraphicsEfiColors[Attribute >> 4]; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Calls upon relay_mmap_buf() to map the file into user space. */
static int relay_file_mmap(struct file *filp, struct vm_area_struct *vma)
/* Calls upon relay_mmap_buf() to map the file into user space. */ static int relay_file_mmap(struct file *filp, struct vm_area_struct *vma)
{ struct rchan_buf *buf = filp->private_data; return relay_mmap_buf(buf, vma); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns a negative error code on failure, zero on success. */
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, enum pci_mmap_state mmap_state, int write_combine)
/* Returns a negative error code on failure, zero on success. */ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, enum pci_mmap_state mmap_state, int write_combine)
{ int ret; ret = __pci_mmap_make_offset(dev, vma, mmap_state); if (ret < 0) return ret; __pci_mmap_set_pgprot(dev, vma, mmap_state, write_combine); ret = io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, vma->vm_end - vma->vm_start,vma->vm_page_prot); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Perform basic hardware initialization at boot. This needs to be run from the very beginning. So the init priority has to be 0 (zero). */
static int stm32f3_init(void)
/* Perform basic hardware initialization at boot. This needs to be run from the very beginning. So the init priority has to be 0 (zero). */ static int stm32f3_init(void)
{ SystemCoreClock = 8000000; LL_DBGMCU_EnableDBGSleepMode(); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function is called by BSP and APs to accept memory. Note: The input PhysicalStart/PhysicalEnd indicates the whole memory region to be accepted. BSP or AP only accepts one piece in the whole memory region. */
STATIC EFI_STATUS EFIAPI BspApAcceptMemoryResourceRange(UINT32 CpuIndex, UINT32 CpusNum, EFI_PHYSICAL_ADDRESS PhysicalStart, EFI_PHYSICAL_ADDRESS PhysicalEnd)
/* This function is called by BSP and APs to accept memory. Note: The input PhysicalStart/PhysicalEnd indicates the whole memory region to be accepted. BSP or AP only accepts one piece in the whole memory region. */ STATIC EFI_STATUS EFIAPI BspApAcceptMemoryResourceRange(UINT32 CpuIndex, UINT32 CpusNum, EFI_PHYSICAL_ADDRESS PhysicalStart, EFI_PHYSICAL_ADDRESS PhysicalEnd)
{ UINT64 Status; UINT64 Pages; UINT64 Stride; UINT64 AcceptPageSize; EFI_PHYSICAL_ADDRESS PhysicalAddress; AcceptPageSize = (UINT64)(UINTN)FixedPcdGet32 (PcdTdxAcceptPageSize); Status = EFI_SUCCESS; Stride = (UINTN)CpusNum * ACCEPT_CHUNK_SIZE; PhysicalAddress = PhysicalStart + ACCEPT_CHUNK_SIZE * (UINTN)CpuIndex; while (!EFI_ERROR (Status) && PhysicalAddress < PhysicalEnd) { Pages = MIN (ACCEPT_CHUNK_SIZE, PhysicalEnd - PhysicalAddress) / AcceptPageSize; Status = TdAcceptPages (PhysicalAddress, Pages, (UINT32)(UINTN)AcceptPageSize); ASSERT (!EFI_ERROR (Status)); PhysicalAddress += Stride; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* I2C MSP Initialization This function configures the hardware resources used in this example. */
void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c)
/* I2C MSP Initialization This function configures the hardware resources used in this example. */ void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hi2c->Instance==I2C1) { __HAL_RCC_GPIOB_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7; GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); __HAL_RCC_I2C1_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Write one page of bytes to specified main memory page address. */
unsigned char AT45DBxxxDPageWrite(unsigned long ulPageAddr, unsigned char *pucBuffer)
/* Write one page of bytes to specified main memory page address. */ unsigned char AT45DBxxxDPageWrite(unsigned long ulPageAddr, unsigned char *pucBuffer)
{ unsigned int i = 0; if(ulPageAddr >= AT45DBxxxDInfo.ulTatalPages) return AT45DBxxxD_OP_INVALID; while(!AT45DBxxxDWaitReady()) { if(++i > AT45DBxxxD_OVERTIME) { return AT45DBxxxD_OP_BUSY; } } AT45DBxxxDBufferWrite(AT45DBxxxD_BUF1, pucBuffer, 0, AT45DBxxxDInfo.usPageSize); AT45DBxxxDBuftoMm(AT45DBxxxD_BUF1, ulPageAddr); return AT45DBxxxD_OP_OK; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Get peak rate cell size of TBF qdisc. */
int rtnl_qdisc_tbf_get_peakrate_cell(struct rtnl_qdisc *qdisc)
/* Get peak rate cell size of TBF qdisc. */ int rtnl_qdisc_tbf_get_peakrate_cell(struct rtnl_qdisc *qdisc)
{ struct rtnl_tbf *tbf; tbf = tbf_qdisc(qdisc); if (tbf && (tbf->qt_mask & TBF_ATTR_PEAKRATE)) return (1 << tbf->qt_peakrate.rs_cell_log); else return -1; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Asserts the interrupt flag and increments the software prescaler. Standard format for callback functions. */
static void timer0_adc_update_callback(void *cb_param, uint32_t event, void *arg)
/* Asserts the interrupt flag and increments the software prescaler. Standard format for callback functions. */ static void timer0_adc_update_callback(void *cb_param, uint32_t event, void *arg)
{ adc_channel_flag = 1; adc_sw_prescaler++; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* writes 'guest_tsc' into guest's timestamp counter "register" guest_tsc = host_tsc + tsc_offset ==> tsc_offset = guest_tsc - host_tsc */
static void guest_write_tsc(u64 guest_tsc, u64 host_tsc)
/* writes 'guest_tsc' into guest's timestamp counter "register" guest_tsc = host_tsc + tsc_offset ==> tsc_offset = guest_tsc - host_tsc */ static void guest_write_tsc(u64 guest_tsc, u64 host_tsc)
{ vmcs_write64(TSC_OFFSET, guest_tsc - host_tsc); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* __kill_pgrp_info() sends a signal to a process group: this is what the tty control characters do (^C, ^Z etc) */
int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp)
/* __kill_pgrp_info() sends a signal to a process group: this is what the tty control characters do (^C, ^Z etc) */ int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp)
{ struct task_struct *p = NULL; int retval, success; success = 0; retval = -ESRCH; do_each_pid_task(pgrp, PIDTYPE_PGID, p) { int err = group_send_sig_info(sig, info, p); success |= !err; retval = err; } while_each_pid_task(pgrp, PIDTYPE_PGID, p); return success ? 0 : retval; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This file is part of the Simba project. */
int mock_write_circular_heap_init(void *buf_p, size_t size, int res)
/* This file is part of the Simba project. */ int mock_write_circular_heap_init(void *buf_p, size_t size, int res)
{ harness_mock_write("circular_heap_init(buf_p)", buf_p, size); harness_mock_write("circular_heap_init(size)", &size, sizeof(size)); harness_mock_write("circular_heap_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* This function performs platform specific way of SMM BSP election. */
EFI_STATUS EFIAPI PlatformSmmBspElection(OUT BOOLEAN *IsBsp)
/* This function performs platform specific way of SMM BSP election. */ EFI_STATUS EFIAPI PlatformSmmBspElection(OUT BOOLEAN *IsBsp)
{ MSR_IA32_APIC_BASE_REGISTER ApicBaseMsr; ApicBaseMsr.Uint64 = AsmReadMsr64 (MSR_IA32_APIC_BASE); *IsBsp = (BOOLEAN)(ApicBaseMsr.Bits.BSP == 1); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240