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
/* Release buffers and URBs for the interrupt and control endpoint. */
void st5481_release_usb(struct st5481_adapter *adapter)
/* Release buffers and URBs for the interrupt and control endpoint. */ void st5481_release_usb(struct st5481_adapter *adapter)
{ struct st5481_intr *intr = &adapter->intr; struct st5481_ctrl *ctrl = &adapter->ctrl; DBG(1,""); usb_kill_urb(ctrl->urb); kfree(ctrl->urb->transfer_buffer); usb_free_urb(ctrl->urb); ctrl->urb = NULL; usb_kill_urb(intr->urb); kfree(intr->urb->transfer_buffer); usb_free_urb(intr->urb); intr->urb = NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* If Buffer is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32* EFIAPI MmioWriteBuffer32(IN UINTN StartAddress, IN UINTN Length, IN CONST UINT32 *Buffer)
/* If Buffer is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32* EFIAPI MmioWriteBuffer32(IN UINTN StartAddress, IN UINTN Length, IN CONST UINT32 *Buffer)
{ UINT32 *ReturnBuffer; ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0); ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); ASSERT ((Length & (sizeof (UINT32) - 1)) == 0); ASSERT (((UINTN)Buffer & (sizeof (UINT32) - 1)) == 0); ReturnBuffer = (UINT32 *)Buffer; while (Length > 0) { MmioWrite32 (StartAddress, *(Buffer++)); StartAddress += sizeof (UINT32); Length -= sizeof (UINT32); } return ReturnBuffer; }
tianocore/edk2
C++
Other
4,240
/* param base Quad Timer peripheral base address param channel Quad Timer channel number param mask The status flags to clear. This is a logical OR of members of the enumeration ::qtmr_status_flags_t */
void QTMR_ClearStatusFlags(TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask)
/* param base Quad Timer peripheral base address param channel Quad Timer channel number param mask The status flags to clear. This is a logical OR of members of the enumeration ::qtmr_status_flags_t */ void QTMR_ClearStatusFlags(TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask)
{ uint16_t reg; reg = base->CHANNEL[channel].SCTRL; if (mask & kQTMR_CompareFlag) { reg &= ~TMR_SCTRL_TCF_MASK; } if (mask & kQTMR_OverflowFlag) { reg &= ~TMR_SCTRL_TOF_MASK; } if (mask & kQTMR_EdgeFlag) { reg &= ~TMR_SCTRL_IEF_MASK; } base->CHANNEL[channel].SCTRL = reg; reg = base->CHANNEL[channel].CSCTRL; if (mask & kQTMR_Compare1Flag) { reg &= ~TMR_CSCTRL_TCF1_MASK; } if (mask & kQTMR_Compare2Flag) { reg &= ~TMR_CSCTRL_TCF2_MASK; } base->CHANNEL[channel].CSCTRL = reg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Service request This message is sent by the UE to the network to request the establishment of a NAS signalling connection and of the radio and S1 bearers. Its structure does not follow the structure of a standard layer 3 message. See table .1. */
static void nas_emm_service_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
/* Service request This message is sent by the UE to the network to request the establishment of a NAS signalling connection and of the radio and S1 bearers. Its structure does not follow the structure of a standard layer 3 message. See table .1. */ static void nas_emm_service_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
{ guint32 curr_offset; guint32 consumed; guint curr_len; curr_offset = offset; curr_len = len; pinfo->link_dir = P2P_DIR_UL; ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_KSI_AND_SEQ_NO, NULL); ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_SHORT_MAC, " - Message authentication code (short)"); EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_nas_eps_extraneous_data); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* param base CSI peripheral base address. param index Buffer index. param addr Frame buffer address to set. */
void CSI_SetRxBufferAddr(CSI_Type *base, uint8_t index, uint32_t addr)
/* param base CSI peripheral base address. param index Buffer index. param addr Frame buffer address to set. */ void CSI_SetRxBufferAddr(CSI_Type *base, uint8_t index, uint32_t addr)
{ addr = CSI_ADDR_CPU_2_IP(addr); if (0U != index) { CSI_REG_DMASA_FB2(base) = addr; } else { CSI_REG_DMASA_FB1(base) = addr; } }
eclipse-threadx/getting-started
C++
Other
310
/* Fills a memory region with the given value. Returns a pointer to the memory region. */
void* memset(void *pBuffer, int value, size_t num)
/* Fills a memory region with the given value. Returns a pointer to the memory region. */ void* memset(void *pBuffer, int value, size_t num)
{ unsigned char *pByteDestination; unsigned int *pAlignedDestination = (unsigned int *) pBuffer; unsigned int alignedValue = (value << 24) | (value << 16) | (value << 8) | value; if ((((unsigned int) pAlignedDestination & 0x3) == 0) && (num >= 4)) { while (num >= 4) { *pAlignedDestination++ = alignedValue; num -= 4; } } pByteDestination = (unsigned char *) pAlignedDestination; while (num--) { *pByteDestination++ = value; } return pBuffer; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* DSI MSP Initialization This function configures the hardware resources used in this example. */
void HAL_DSI_MspInit(DSI_HandleTypeDef *hdsi)
/* DSI MSP Initialization This function configures the hardware resources used in this example. */ void HAL_DSI_MspInit(DSI_HandleTypeDef *hdsi)
{ if(hdsi->Instance==DSI) { __HAL_RCC_DSI_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The alarm clock time may be rounded from the set alarm clock time to be within the resolution of the alarm clock device. The resolution of the alarm clock device is defined to be one second. During runtime, if a PC-AT CMOS device is present in the platform the caller must synchronize access to the device before calling GetWakeupTime(). */
EFI_STATUS EFIAPI EfiGetWakeupTime(OUT BOOLEAN *Enabled, OUT BOOLEAN *Pending, OUT EFI_TIME *Time)
/* The alarm clock time may be rounded from the set alarm clock time to be within the resolution of the alarm clock device. The resolution of the alarm clock device is defined to be one second. During runtime, if a PC-AT CMOS device is present in the platform the caller must synchronize access to the device before calling GetWakeupTime(). */ EFI_STATUS EFIAPI EfiGetWakeupTime(OUT BOOLEAN *Enabled, OUT BOOLEAN *Pending, OUT EFI_TIME *Time)
{ return mInternalRT->GetWakeupTime (Enabled, Pending, Time); }
tianocore/edk2
C++
Other
4,240
/* If the BSP cannot be switched prior to the return from this service, then EFI_UNSUPPORTED must be returned. */
EFI_STATUS EFIAPI SwitchBSP(IN EFI_MP_SERVICES_PROTOCOL *This, IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
/* If the BSP cannot be switched prior to the return from this service, then EFI_UNSUPPORTED must be returned. */ EFI_STATUS EFIAPI SwitchBSP(IN EFI_MP_SERVICES_PROTOCOL *This, IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
{ return MpInitLibSwitchBSP (ProcessorNumber, EnableOldBSP); }
tianocore/edk2
C++
Other
4,240
/* Walk list of mounted file systems in the guest, and discard unused areas. */
void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err)
/* Walk list of mounted file systems in the guest, and discard unused areas. */ void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err)
{ error_set(err, QERR_UNSUPPORTED); }
ve3wwg/teensy3_qemu
C++
Other
15
/* Set up timer interrupt, and return the current time in seconds. */
void __init bcmring_init_timer(void)
/* Set up timer interrupt, and return the current time in seconds. */ void __init bcmring_init_timer(void)
{ printk(KERN_INFO "bcmring_init_timer\n"); writel(0, TIMER0_VA_BASE + TIMER_CTRL); writel(0, TIMER1_VA_BASE + TIMER_CTRL); writel(0, TIMER2_VA_BASE + TIMER_CTRL); writel(0, TIMER3_VA_BASE + TIMER_CTRL); setup_irq(IRQ_TIMER0, &bcmring_timer_irq); bcmring_clocksource_init(); timer0_clockevent.mult = div_sc(1000000, NSEC_PER_SEC, timer0_clockevent.shift); timer0_clockevent.max_delta_ns = clockevent_delta2ns(0xffffffff, &timer0_clockevent); timer0_clockevent.min_delta_ns = clockevent_delta2ns(0xf, &timer0_clockevent); timer0_clockevent.cpumask = cpumask_of(0); clockevents_register_device(&timer0_clockevent); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return a string matching the given error code */
const char* uwb_rc_strerror(unsigned code)
/* Return a string matching the given error code */ const char* uwb_rc_strerror(unsigned code)
{ if (code == 255) return "time out"; if (code >= ARRAY_SIZE(__strerror)) return "unknown error"; return __strerror[code]; }
robutest/uclinux
C++
GPL-2.0
60
/* return the proper MTR register as determine by the csrow and channel desired */
static int determine_mtr(struct i5000_pvt *pvt, int csrow, int channel)
/* return the proper MTR register as determine by the csrow and channel desired */ static int determine_mtr(struct i5000_pvt *pvt, int csrow, int channel)
{ int mtr; if (channel < CHANNELS_PER_BRANCH) mtr = pvt->b0_mtr[csrow >> 1]; else mtr = pvt->b1_mtr[csrow >> 1]; return mtr; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: -1, 0 or +1, for a less than, equal to or greater than result */
gint g_param_values_cmp(GParamSpec *pspec, const GValue *value1, const GValue *value2)
/* Returns: -1, 0 or +1, for a less than, equal to or greater than result */ gint g_param_values_cmp(GParamSpec *pspec, const GValue *value1, const GValue *value2)
{ gint cmp; g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), 0); g_return_val_if_fail (G_IS_VALUE (value1), 0); g_return_val_if_fail (G_IS_VALUE (value2), 0); g_return_val_if_fail (PSPEC_APPLIES_TO_VALUE (pspec, value1), 0); g_return_val_if_fail (PSPEC_APPLIES_TO_VALUE (pspec, value2), 0); cmp = G_PARAM_SPEC_GET_CLASS (pspec)->values_cmp (pspec, value1, value2); return CLAMP (cmp, -1, 1); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Sets the decode enable register to indicate if BCD or HEX decoding should be used. Set to 0 for no BCD on all digits. */
as1115Error_t as1115SetDecodeMode(uint8_t x)
/* Sets the decode enable register to indicate if BCD or HEX decoding should be used. Set to 0 for no BCD on all digits. */ as1115Error_t as1115SetDecodeMode(uint8_t x)
{ as1115Error_t error = AS1115_ERROR_OK; error = as1115WriteCmdData(AS1115_SUBADDRESS, AS1115_DECODEMODE, x); return error; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Sets the attribute value to the given boolean value. */
void _g_file_attribute_value_set_boolean(GFileAttributeValue *attr, gboolean value)
/* Sets the attribute value to the given boolean value. */ void _g_file_attribute_value_set_boolean(GFileAttributeValue *attr, gboolean value)
{ g_return_if_fail (attr != NULL); _g_file_attribute_value_clear (attr); attr->type = G_FILE_ATTRIBUTE_TYPE_BOOLEAN; attr->u.boolean = !!value; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set the relevant directory entry into disk for the volume. */
EFI_STATUS FatSetVolumeEntry(IN FAT_VOLUME *Volume, IN CHAR16 *Name)
/* Set the relevant directory entry into disk for the volume. */ EFI_STATUS FatSetVolumeEntry(IN FAT_VOLUME *Volume, IN CHAR16 *Name)
{ EFI_STATUS Status; FAT_DIRENT LabelDirEnt; FAT_OFILE *Root; Root = Volume->Root; Status = FatSeekVolumeId (Volume->Root, &LabelDirEnt); if (EFI_ERROR (Status)) { return Status; } if (LabelDirEnt.Invalid) { ZeroMem (&LabelDirEnt, sizeof (FAT_DIRENT)); LabelDirEnt.EntryCount = 1; Status = FatNewEntryPos (Root, &LabelDirEnt); if (EFI_ERROR (Status)) { return Status; } LabelDirEnt.Entry.Attributes = FAT_ATTRIBUTE_VOLUME_ID; } SetMem (LabelDirEnt.Entry.FileName, FAT_NAME_LEN, ' '); if (FatStrToFat (Name, FAT_NAME_LEN, LabelDirEnt.Entry.FileName)) { return EFI_UNSUPPORTED; } FatGetCurrentFatTime (&LabelDirEnt.Entry.FileModificationTime); return FatStoreDirEnt (Root, &LabelDirEnt); }
tianocore/edk2
C++
Other
4,240
/* Routine called when a device is disconnected from the USB. */
static void keyspan_disconnect(struct usb_interface *interface)
/* Routine called when a device is disconnected from the USB. */ static void keyspan_disconnect(struct usb_interface *interface)
{ struct usb_keyspan *remote; remote = usb_get_intfdata(interface); usb_set_intfdata(interface, NULL); if (remote) { input_unregister_device(remote->input); usb_kill_urb(remote->irq_urb); usb_free_urb(remote->irq_urb); usb_buffer_free(remote->udev, RECV_SIZE, remote->in_buffer, remote->in_dma); kfree(remote); } }
robutest/uclinux
C++
GPL-2.0
60
/* 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 ShellGetFilePosition(IN SHELL_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 ShellGetFilePosition(IN SHELL_FILE_HANDLE FileHandle, OUT UINT64 *Position)
{ return (FileFunctionMap.GetFilePosition (FileHandle, Position)); }
tianocore/edk2
C++
Other
4,240
/* A callback function for the directory diff calculation routine, produces G_FILE_MONITOR_EVENT_RENAMED event on a move. */
static void handle_moved(void *udata, const char *from_path, ino_t from_inode, const char *to_path, ino_t to_inode)
/* A callback function for the directory diff calculation routine, produces G_FILE_MONITOR_EVENT_RENAMED event on a move. */ static void handle_moved(void *udata, const char *from_path, ino_t from_inode, const char *to_path, ino_t to_inode)
{ handle_ctx *ctx = NULL; (void) from_inode; (void) to_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_RENAMED, from_path, to_path, NULL, g_get_monotonic_time ()); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Given a PCI bus and slot/function number, the desired PCI device is located in the list of PCI devices. If the device is found, its reference count is increased and this function returns a pointer to its data structure. The caller must decrement the reference count by calling pci_dev_put(). If no device is found, NULL is returned. */
struct pci_dev* pci_get_slot(struct pci_bus *bus, unsigned int devfn)
/* Given a PCI bus and slot/function number, the desired PCI device is located in the list of PCI devices. If the device is found, its reference count is increased and this function returns a pointer to its data structure. The caller must decrement the reference count by calling pci_dev_put(). If no device is found, NULL is returned. */ struct pci_dev* pci_get_slot(struct pci_bus *bus, unsigned int devfn)
{ struct list_head *tmp; struct pci_dev *dev; WARN_ON(in_interrupt()); down_read(&pci_bus_sem); list_for_each(tmp, &bus->devices) { dev = pci_dev_b(tmp); if (dev->devfn == devfn) goto out; } dev = NULL; out: pci_dev_get(dev); up_read(&pci_bus_sem); return dev; }
robutest/uclinux
C++
GPL-2.0
60
/* System shutdown should not return, if it returns, it means the system does not support shut down reset. */
VOID EFIAPI ResetShutdown(VOID)
/* System shutdown should not return, if it returns, it means the system does not support shut down reset. */ VOID EFIAPI ResetShutdown(VOID)
{ UINT16 AcpiPmBaseAddress; UINT16 HostBridgeDevId; AcpiPmBaseAddress = 0; HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID); switch (HostBridgeDevId) { case INTEL_82441_DEVICE_ID: AcpiPmBaseAddress = PIIX4_PMBA_VALUE; break; case INTEL_Q35_MCH_DEVICE_ID: AcpiPmBaseAddress = ICH9_PMBASE_VALUE; break; case CLOUDHV_DEVICE_ID: IoWrite8 (CLOUDHV_ACPI_SHUTDOWN_IO_ADDRESS, 5 << 2 | 1 << 5); CpuDeadLoop (); default: ASSERT (FALSE); CpuDeadLoop (); } IoBitFieldWrite16 (AcpiPmBaseAddress + 4, 10, 13, 0); IoOr16 (AcpiPmBaseAddress + 4, BIT13); CpuDeadLoop (); }
tianocore/edk2
C++
Other
4,240
/* Enables or disables the ADC Power Down during Delay and/or Idle phase. */
void ADC_PowerDownCmd(ADC_TypeDef *ADCx, uint32_t ADC_PowerDown, FunctionalState NewState)
/* Enables or disables the ADC Power Down during Delay and/or Idle phase. */ void ADC_PowerDownCmd(ADC_TypeDef *ADCx, uint32_t ADC_PowerDown, FunctionalState NewState)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); assert_param(IS_ADC_POWER_DOWN(ADC_PowerDown)); if (NewState != DISABLE) { ADCx->CR1 |= ADC_PowerDown; } else { ADCx->CR1 &= (uint32_t)~ADC_PowerDown; } }
avem-labs/Avem
C++
MIT License
1,752
/* FLEXIO UART EDMA receive finished callback function. This function is called when FLEXIO UART EDMA receive finished. It disables the UART RX EDMA request and sends kStatus_FLEXIO_UART_RxIdle to UART callback. */
static void FLEXIO_UART_TransferReceiveEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
/* FLEXIO UART EDMA receive finished callback function. This function is called when FLEXIO UART EDMA receive finished. It disables the UART RX EDMA request and sends kStatus_FLEXIO_UART_RxIdle to UART callback. */ static void FLEXIO_UART_TransferReceiveEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
{ flexio_uart_edma_private_handle_t *uartPrivateHandle = (flexio_uart_edma_private_handle_t *)param; assert(uartPrivateHandle->handle); handle = handle; tcds = tcds; if (transferDone) { FLEXIO_UART_TransferAbortReceiveEDMA(uartPrivateHandle->base, uartPrivateHandle->handle); if (uartPrivateHandle->handle->callback) { uartPrivateHandle->handle->callback(uartPrivateHandle->base, uartPrivateHandle->handle, kStatus_FLEXIO_UART_RxIdle, uartPrivateHandle->handle->userData); } } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is used to send Rx command to flash to get status register or flash id, and lock CPU when Rx. */
IMAGE2_RAM_TEXT_SECTION void FLASH_RxCmdXIP(u8 cmd, u32 read_len, u8 *read_data)
/* This function is used to send Rx command to flash to get status register or flash id, and lock CPU when Rx. */ IMAGE2_RAM_TEXT_SECTION void FLASH_RxCmdXIP(u8 cmd, u32 read_len, u8 *read_data)
{ FLASH_Write_Lock(); FLASH_RxCmd(cmd, read_len, read_data); FLASH_Write_Unlock(); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function returns a a wear leveling entry in case of success and NULL in case of failure. */
static struct ubi_wl_entry* wl_get_wle(struct ubi_device *ubi)
/* This function returns a a wear leveling entry in case of success and NULL in case of failure. */ static struct ubi_wl_entry* wl_get_wle(struct ubi_device *ubi)
{ struct ubi_wl_entry *e; e = find_mean_wl_entry(ubi, &ubi->free); if (!e) { ubi_err(ubi, "no free eraseblocks"); return NULL; } self_check_in_wl_tree(ubi, e, &ubi->free); rb_erase(&e->u.rb, &ubi->free); ubi->free_count--; dbg_wl("PEB %d EC %d", e->pnum, e->ec); return e; }
4ms/stm32mp1-baremetal
C++
Other
137
/* SDIO disable or enable interrupt by modify the interrupt mask. */
VOID SDIO_INTConfig(u16 IntMask, u32 NewState)
/* SDIO disable or enable interrupt by modify the interrupt mask. */ VOID SDIO_INTConfig(u16 IntMask, u32 NewState)
{ u16 IntMaskTmp = HAL_SDIO_READ16(REG_SPDIO_CPU_INT_MASK); if (NewState == ENABLE) { IntMaskTmp |= IntMask; } else { IntMaskTmp &= ~IntMask; } HAL_SDIO_WRITE16(REG_SPDIO_CPU_INT_MASK, IntMaskTmp); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Reads the specified I2C register and returns its value. */
uint16_t I2C_ReadRegister(I2C_TypeDef *I2Cx, uint8_t I2C_Register)
/* Reads the specified I2C register and returns its value. */ uint16_t I2C_ReadRegister(I2C_TypeDef *I2Cx, uint8_t I2C_Register)
{ assert_param(IS_I2C_ALL_PERIPH(I2Cx)); assert_param(IS_I2C_REGISTER(I2C_Register)); return (*(__IO uint16_t *)(*((__IO uint32_t *)&I2Cx) + I2C_Register)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Locking Note: The lport lock is exected to be held before calling this function. */
static void fc_lport_recv_logo_req(struct fc_seq *sp, struct fc_frame *fp, struct fc_lport *lport)
/* Locking Note: The lport lock is exected to be held before calling this function. */ static void fc_lport_recv_logo_req(struct fc_seq *sp, struct fc_frame *fp, struct fc_lport *lport)
{ lport->tt.seq_els_rsp_send(sp, ELS_LS_ACC, NULL); fc_lport_enter_reset(lport); fc_frame_free(fp); }
robutest/uclinux
C++
GPL-2.0
60
/* \classmethod \constructor(]) initial data must be given if block_size wants to be passed */
STATIC mp_obj_t hash_make_new(mp_obj_t type_in, size_t n_args, size_t n_kw, const mp_obj_t *args)
/* \classmethod \constructor(]) initial data must be given if block_size wants to be passed */ STATIC mp_obj_t hash_make_new(mp_obj_t type_in, size_t n_args, size_t n_kw, const mp_obj_t *args)
{ self->algo = SHAMD5_ALGO_SHA1; self->h_size = 20; } else { self->algo = SHAMD5_ALGO_SHA256; self->h_size = 32; } if (n_args) { if (n_args > 1) { self->fixedlen = true; self->b_size = mp_obj_get_int(args[1]); hash_update_internal(self, args[0], true); } else { hash_update_internal(self, args[0], false); } } return self; }
micropython/micropython
C++
Other
18,334
/* Tpm measure and log data, and extend the measurement result into a specific PCR. */
EFI_STATUS EFIAPI TpmMeasureAndLogData(IN UINT32 PcrIndex, IN UINT32 EventType, IN VOID *EventLog, IN UINT32 LogLen, IN VOID *HashData, IN UINT64 HashDataLen)
/* Tpm measure and log data, and extend the measurement result into a specific PCR. */ EFI_STATUS EFIAPI TpmMeasureAndLogData(IN UINT32 PcrIndex, IN UINT32 EventType, IN VOID *EventLog, IN UINT32 LogLen, IN VOID *HashData, IN UINT64 HashDataLen)
{ EFI_STATUS Status; EDKII_TCG_PPI *TcgPpi; TCG_PCR_EVENT_HDR TcgEventHdr; Status = PeiServicesLocatePpi ( &gEdkiiTcgPpiGuid, 0, NULL, (VOID **)&TcgPpi ); if (EFI_ERROR (Status)) { return Status; } TcgEventHdr.PCRIndex = PcrIndex; TcgEventHdr.EventType = EventType; TcgEventHdr.EventSize = LogLen; Status = TcgPpi->HashLogExtendEvent ( TcgPpi, 0, HashData, (UINTN)HashDataLen, &TcgEventHdr, EventLog ); return Status; }
tianocore/edk2
C++
Other
4,240
/* Slow send and receive a byte to/from the SPI bus. */
uint8 spi_slow_sr_byte(register uint8 b)
/* Slow send and receive a byte to/from the SPI bus. */ uint8 spi_slow_sr_byte(register uint8 b)
{ pwork = b & MSB ? (pwork | SCSPTR2_SPB2DT) : (pwork & ~SCSPTR2_SPB2DT); reg_write_16(SCSPTR2, pwork); spi_low_speed_delay(); pwork |= SCSPTR2_CTSDT; reg_write_16(SCSPTR2, pwork); b = (b << 1) | RX_BIT(); spi_low_speed_delay(); pwork &= ~SCSPTR2_CTSDT; reg_write_16(SCSPTR2, pwork); } irq_restore(old); return b; }
DC-SWAT/DreamShell
C++
null
404
/* Check if there is media according to sense data. */
BOOLEAN IsNoMedia(IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts)
/* Check if there is media according to sense data. */ BOOLEAN IsNoMedia(IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts)
{ ATAPI_REQUEST_SENSE_DATA *SensePtr; UINTN Index; BOOLEAN NoMedia; NoMedia = FALSE; SensePtr = SenseData; for (Index = 0; Index < SenseCounts; Index++) { switch (SensePtr->sense_key) { case ATA_SK_NOT_READY: switch (SensePtr->addnl_sense_code) { case ATA_ASC_NO_MEDIA: NoMedia = TRUE; break; default: break; } break; default: break; } SensePtr++; } return NoMedia; }
tianocore/edk2
C++
Other
4,240
/* Quiet time is the time after the first detected tap in which there must not be any over threshold event. The default value of these bits is 00b which corresponds to 2*ODR_XL time. If the QUIET bits are set to a different value, 1LSB corresponds to 4*ODR_XL time.. */
int32_t lsm6dso_tap_quiet_set(lsm6dso_ctx_t *ctx, uint8_t val)
/* Quiet time is the time after the first detected tap in which there must not be any over threshold event. The default value of these bits is 00b which corresponds to 2*ODR_XL time. If the QUIET bits are set to a different value, 1LSB corresponds to 4*ODR_XL time.. */ int32_t lsm6dso_tap_quiet_set(lsm6dso_ctx_t *ctx, uint8_t val)
{ lsm6dso_int_dur2_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_INT_DUR2, (uint8_t*)&reg, 1); if (ret == 0) { reg.quiet = val; ret = lsm6dso_write_reg(ctx, LSM6DSO_INT_DUR2, (uint8_t*)&reg, 1); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* Allocate new memory and then copy the Unicode string Source to Destination. */
VOID NewStringCopy(IN OUT CHAR16 **Dest, IN CHAR16 *Src)
/* Allocate new memory and then copy the Unicode string Source to Destination. */ VOID NewStringCopy(IN OUT CHAR16 **Dest, IN CHAR16 *Src)
{ if (*Dest != NULL) { FreePool (*Dest); } *Dest = AllocateCopyPool (StrSize (Src), Src); }
tianocore/edk2
C++
Other
4,240
/* Need to release with wusb_cluster_id_put() when done w/ it. */
u8 wusb_cluster_id_get(void)
/* Need to release with wusb_cluster_id_put() when done w/ it. */ u8 wusb_cluster_id_get(void)
{ u8 id; spin_lock(&wusb_cluster_ids_lock); id = find_first_zero_bit(wusb_cluster_id_table, CLUSTER_IDS); if (id > CLUSTER_IDS) { id = 0; goto out; } set_bit(id, wusb_cluster_id_table); id = (u8) 0xff - id; out: spin_unlock(&wusb_cluster_ids_lock); return id; }
robutest/uclinux
C++
GPL-2.0
60
/* Paints a macroblock using the pattern in paint_lut. */
static void yop_paint_block(YopDecContext *s, int tag)
/* Paints a macroblock using the pattern in paint_lut. */ static void yop_paint_block(YopDecContext *s, int tag)
{ s->dstptr[0] = s->srcptr[0]; s->dstptr[1] = s->srcptr[paint_lut[tag][0]]; s->dstptr[s->frame.linesize[0]] = s->srcptr[paint_lut[tag][1]]; s->dstptr[s->frame.linesize[0] + 1] = s->srcptr[paint_lut[tag][2]]; s->srcptr += paint_lut[tag][3]; }
DC-SWAT/DreamShell
C++
null
404
/* Show/Init PCI devices on the specified bus number. */
void pci_mousse_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
/* Show/Init PCI devices on the specified bus number. */ void pci_mousse_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
{ unsigned int line; switch(PCI_DEV(dev)) { case 0x0d: line = 0x00000101; break; case 0x0e: default: line = 0x00000303; break; } pci_write_config_dword(dev, PCI_INTERRUPT_LINE, line); }
EmcraftSystems/u-boot
C++
Other
181
/* Dump out the message pending in the shared message area */
static void sep_dump_message(struct sep_device *sep)
/* Dump out the message pending in the shared message area */ static void sep_dump_message(struct sep_device *sep)
{ int count; for (count = 0; count < 12 * 4; count += 4) edbg("Word %d of the message is %u\n", count, *((u32 *) (sep->shared_addr + count))); }
robutest/uclinux
C++
GPL-2.0
60
/* Compatible with *BSD: the result is always a valid NUL-terminated string that fits in the buffer (unless, of course, the buffer size is zero). It does not pad out the result like strncpy() does. */
size_t strlcpy(char *dest, const char *src, size_t size)
/* Compatible with *BSD: the result is always a valid NUL-terminated string that fits in the buffer (unless, of course, the buffer size is zero). It does not pad out the result like strncpy() does. */ size_t strlcpy(char *dest, const char *src, size_t size)
{ size_t ret = __strend(src) - src; if (size) { size_t len = (ret >= size) ? size-1 : ret; dest[len] = '\0'; __builtin_memcpy(dest, src, len); } return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns the current speed of the USB device connected. */
uint32_t USBHostSpeedGet(uint32_t ui32Base)
/* Returns the current speed of the USB device connected. */ uint32_t USBHostSpeedGet(uint32_t ui32Base)
{ ASSERT(ui32Base == USB0_BASE); if (HWREGB(ui32Base + USB_O_POWER) & USB_POWER_HSMODE) { return (USB_HIGH_SPEED); } if (HWREGB(ui32Base + USB_O_DEVCTL) & USB_DEVCTL_FSDEV) { return (USB_FULL_SPEED); } if (HWREGB(ui32Base + USB_O_DEVCTL) & USB_DEVCTL_LSDEV) { return (USB_LOW_SPEED); } return (USB_UNDEF_SPEED); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Perform cable detection for ATA66 capable cable. Return a libata cable type. */
static int cs5536_cable_detect(struct ata_port *ap)
/* Perform cable detection for ATA66 capable cable. Return a libata cable type. */ static int cs5536_cable_detect(struct ata_port *ap)
{ struct pci_dev *pdev = to_pci_dev(ap->host->dev); u32 cfg; cs5536_read(pdev, CFG, &cfg); if (cfg & (IDE_CFG_CABLE << ap->port_no)) return ATA_CBL_PATA80; else return ATA_CBL_PATA40; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* De-initialize WDT Interface. stops operation and releases the software resources used by the interface. */
int32_t csi_wdt_uninitialize(wdt_handle_t handle)
/* De-initialize WDT Interface. stops operation and releases the software resources used by the interface. */ int32_t csi_wdt_uninitialize(wdt_handle_t handle)
{ WDT_NULL_PARAM_CHK(handle); dw_wdt_priv_t *wdt_priv = handle; wdt_priv->cb_event = NULL; drv_nvic_disable_irq(wdt_priv->irq); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Malta Platform-specific hooks for SMP operation Cause the specified action to be performed on a targeted "CPU" */
static void msmtc_send_ipi_single(int cpu, unsigned int action)
/* Malta Platform-specific hooks for SMP operation Cause the specified action to be performed on a targeted "CPU" */ static void msmtc_send_ipi_single(int cpu, unsigned int action)
{ smtc_send_ipi(cpu, LINUX_SMP_IPI, action); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set a property that requires code to evaluate. */
int ecParseSpecialProperty(RTF_Context *ctx, IPROP iprop, int val)
/* Set a property that requires code to evaluate. */ int ecParseSpecialProperty(RTF_Context *ctx, IPROP iprop, int val)
{ switch (iprop) { case ipropFontFamily: ctx->values[0] = val; return ecOK; case ipropColorRed: ctx->values[0] = val; return ecOK; case ipropColorGreen: ctx->values[1] = val; return ecOK; case ipropColorBlue: ctx->values[2] = val; return ecOK; case ipropPard: memset(&ctx->pap, 0, sizeof(ctx->pap)); return ecOK; case ipropPlain: memset(&ctx->chp, 0, sizeof(ctx->chp)); return ecOK; case ipropSectd: memset(&ctx->sep, 0, sizeof(ctx->sep)); return ecOK; default: return ecBadTable; } return ecBadTable; }
DC-SWAT/DreamShell
C++
null
404
/* What types of comments does this capture file have? */
guint32 cf_comment_types(capture_file *cf)
/* What types of comments does this capture file have? */ guint32 cf_comment_types(capture_file *cf)
{ guint32 comment_types = 0; if (cf_read_shb_comment(cf) != NULL) comment_types |= WTAP_COMMENT_PER_SECTION; if (cf->packet_comment_count != 0) comment_types |= WTAP_COMMENT_PER_PACKET; return comment_types; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If 64-bit MMIO register 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 Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT64 EFIAPI S3MmioBitFieldWrite64(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 Value)
/* If 64-bit MMIO register 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 Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT64 EFIAPI S3MmioBitFieldWrite64(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 Value)
{ return InternalSaveMmioWrite64ValueToBootScript (Address, MmioBitFieldWrite64 (Address, StartBit, EndBit, Value)); }
tianocore/edk2
C++
Other
4,240
/* Initialize all fields of the specified tcw data structure with zero and fill in the format, flags, r and w fields. */
void tcw_init(struct tcw *tcw, int r, int w)
/* Initialize all fields of the specified tcw data structure with zero and fill in the format, flags, r and w fields. */ void tcw_init(struct tcw *tcw, int r, int w)
{ memset(tcw, 0, sizeof(struct tcw)); tcw->format = TCW_FORMAT_DEFAULT; tcw->flags = TCW_FLAGS_TIDAW_FORMAT(TCW_TIDAW_FORMAT_DEFAULT); if (r) tcw->r = 1; if (w) tcw->w = 1; }
robutest/uclinux
C++
GPL-2.0
60
/* O: Offset On: Offset (NULL) Ox: Offset Onx: Offset (NULL) */
otv_x_Ox(FT_Bytes table, OTV_Validator otvalid)
/* O: Offset On: Offset (NULL) Ox: Offset Onx: Offset (NULL) */ otv_x_Ox(FT_Bytes table, OTV_Validator otvalid)
{ FT_Bytes p = table; FT_UInt Count; OTV_Validate_Func func; OTV_ENTER; OTV_LIMIT_CHECK( 2 ); Count = FT_NEXT_USHORT( p ); OTV_TRACE(( " (Count = %d)\n", Count )); OTV_LIMIT_CHECK( Count * 2 ); otvalid->nesting_level++; func = otvalid->func[otvalid->nesting_level]; for ( ; Count > 0; Count-- ) func( table + FT_NEXT_USHORT( p ), otvalid ); otvalid->nesting_level--; OTV_EXIT; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Writes a 16/32-bit data word to a protected Remote CPU System address */
uint16_t IPCLiteLtoRDataWrite_Protected(uint32_t ulFlag, uint32_t ulAddress, uint32_t ulData, uint16_t usLength, uint32_t ulStatusFlag)
/* Writes a 16/32-bit data word to a protected Remote CPU System address */ uint16_t IPCLiteLtoRDataWrite_Protected(uint32_t ulFlag, uint32_t ulAddress, uint32_t ulData, uint16_t usLength, uint32_t ulStatusFlag)
{ uint16_t returnStatus; if (IpcRegs.IPCFLG.all & (ulFlag | ulStatusFlag)) { returnStatus = STATUS_FAIL; } else { if (usLength == IPC_LENGTH_16_BITS) { IpcRegs.IPCSENDCOM = IPC_DATA_WRITE_16_PROTECTED; } else if (usLength == IPC_LENGTH_32_BITS) { IpcRegs.IPCSENDCOM = IPC_DATA_WRITE_32_PROTECTED; } IpcRegs.IPCSENDADDR = ulAddress; IpcRegs.IPCSENDDATA = ulData; IpcRegs.IPCSET.all |= (ulFlag | ulStatusFlag); returnStatus = STATUS_PASS; } return returnStatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads and returns the lower 32-bits of the MSR specified by Index. No parameter checking is performed on Index, and some Index values may cause CPU exceptions. The caller must either guarantee that Index is valid, or the caller must set up exception handlers to catch the exceptions. This function is only available on IA-32 and x64. */
UINT32 EFIAPI AsmReadMsr32(IN UINT32 Index)
/* Reads and returns the lower 32-bits of the MSR specified by Index. No parameter checking is performed on Index, and some Index values may cause CPU exceptions. The caller must either guarantee that Index is valid, or the caller must set up exception handlers to catch the exceptions. This function is only available on IA-32 and x64. */ UINT32 EFIAPI AsmReadMsr32(IN UINT32 Index)
{ return (UINT32)AsmReadMsr64 (Index); }
tianocore/edk2
C++
Other
4,240
/* stricmp - A small but sufficient implementation for case insensitive strcmp. @str1: @str2: */
LIBC_ROM_TEXT_SECTION _LONG_CALL_ int _stricmp(const char *str1, const char *str2)
/* stricmp - A small but sufficient implementation for case insensitive strcmp. @str1: @str2: */ LIBC_ROM_TEXT_SECTION _LONG_CALL_ int _stricmp(const char *str1, const char *str2)
{ char c1, c2; do { c1 = *str1++; c2 = *str2++; if (c1 != c2) { char c1_upc = c1 | 0x20; if ((c1_upc >= 'a') && (c1_upc <= 'z')) { char c2_upc = c2 | 0x20; if (c1_upc != c2_upc) { return 1; } } else { return 1; } } } while (c1 != 0); return 0; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Currently trivial. Write the real->protected mode bootstrap into the page concerned. The caller has made sure it's suitably aligned. */
unsigned long __trampinit setup_trampoline(void)
/* Currently trivial. Write the real->protected mode bootstrap into the page concerned. The caller has made sure it's suitably aligned. */ unsigned long __trampinit setup_trampoline(void)
{ memcpy(trampoline_base, trampoline_data, TRAMPOLINE_SIZE); return virt_to_phys(trampoline_base); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Read two words of data from SPI Rx registers. */
void SPIBurstDataRead(unsigned long ulBase, unsigned long *pulData)
/* Read two words of data from SPI Rx registers. */ void SPIBurstDataRead(unsigned long ulBase, unsigned long *pulData)
{ xASSERT(ulBase == SPI0_BASE); while((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY)) { } pulData[0] = xHWREG(ulBase + SPI_RX0); pulData[1] = xHWREG(ulBase + SPI_RX1); xHWREG(ulBase + SPI_CNTRL) |= SPI_CNTRL_GO_BUSY; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Check whether an ACL Data Package is available in the input-copy queue. */
static void le_data_ready(uint16_t size)
/* Check whether an ACL Data Package is available in the input-copy queue. */ static void le_data_ready(uint16_t size)
{ struct has_data_resp { uint16_t response; uint16_t size; uint8_t empty; } __packed; struct has_data_resp le_response = { .response = sys_cpu_to_le16(CMD_LE_DATA_READY_RSP), .size = sys_cpu_to_le16(1), .empty = 0 }; if (size > 0) { read_excess_bytes(size); } if (k_fifo_is_empty(&data_queue)) { le_response.empty = 1; } edtt_write((uint8_t *)&le_response, sizeof(le_response), EDTTT_BLOCK); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* iop_adma_is_complete - poll the status of an ADMA transaction @chan: ADMA channel handle @cookie: ADMA transaction identifier */
static enum dma_status iop_adma_is_complete(struct dma_chan *chan, dma_cookie_t cookie, dma_cookie_t *done, dma_cookie_t *used)
/* iop_adma_is_complete - poll the status of an ADMA transaction @chan: ADMA channel handle @cookie: ADMA transaction identifier */ static enum dma_status iop_adma_is_complete(struct dma_chan *chan, dma_cookie_t cookie, dma_cookie_t *done, dma_cookie_t *used)
{ struct iop_adma_chan *iop_chan = to_iop_adma_chan(chan); dma_cookie_t last_used; dma_cookie_t last_complete; enum dma_status ret; last_used = chan->cookie; last_complete = iop_chan->completed_cookie; if (done) *done = last_complete; if (used) *used = last_used; ret = dma_async_is_complete(cookie, last_complete, last_used); if (ret == DMA_SUCCESS) return ret; iop_adma_slot_cleanup(iop_chan); last_used = chan->cookie; last_complete = iop_chan->completed_cookie; if (done) *done = last_complete; if (used) *used = last_used; return dma_async_is_complete(cookie, last_complete, last_used); }
robutest/uclinux
C++
GPL-2.0
60
/* Process all characters in the RX FIFO of the UART. Check all char status bytes as well, and process as required. We need to check all bytes in the FIFO, in case some more enter the FIFO while we are here. To get the exact character error type we need to switch into CHAR error mode (that is why we need to make sure we empty the FIFO). */
static void stl_sc26198rxbadchars(struct stlport *portp)
/* Process all characters in the RX FIFO of the UART. Check all char status bytes as well, and process as required. We need to check all bytes in the FIFO, in case some more enter the FIFO while we are here. To get the exact character error type we need to switch into CHAR error mode (that is why we need to make sure we empty the FIFO). */ static void stl_sc26198rxbadchars(struct stlport *portp)
{ unsigned char status, mr1; char ch; mr1 = stl_sc26198getreg(portp, MR1); stl_sc26198setreg(portp, MR1, (mr1 & ~MR1_ERRBLOCK)); while ((status = stl_sc26198getreg(portp, SR)) & SR_RXRDY) { stl_sc26198setreg(portp, SCCR, CR_CLEARRXERR); ch = stl_sc26198getreg(portp, RXFIFO); stl_sc26198rxbadch(portp, status, ch); } stl_sc26198setreg(portp, MR1, mr1); }
robutest/uclinux
C++
GPL-2.0
60
/* Do AND operation with the value of AHCI Operation register. */
VOID EFIAPI AhciAndReg(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT32 Offset, IN UINT32 AndData)
/* Do AND operation with the value of AHCI Operation register. */ VOID EFIAPI AhciAndReg(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT32 Offset, IN UINT32 AndData)
{ UINT32 Data; ASSERT (PciIo != NULL); Data = AhciReadReg (PciIo, Offset); Data &= AndData; AhciWriteReg (PciIo, Offset, Data); }
tianocore/edk2
C++
Other
4,240
/* Do the basic setup for the SCC hardware interface and then do the MMIO setup. */
static void __devinit init_iops_scc(ide_hwif_t *hwif)
/* Do the basic setup for the SCC hardware interface and then do the MMIO setup. */ static void __devinit init_iops_scc(ide_hwif_t *hwif)
{ struct pci_dev *dev = to_pci_dev(hwif->dev); hwif->hwif_data = NULL; if (pci_get_drvdata(dev) == NULL) return; init_mmio_iops_scc(hwif); }
robutest/uclinux
C++
GPL-2.0
60
/* Program Retaining Registers with device lists. This will program the retaining register with the controller itself */
static void cdns_i3c_program_controller_retaining_reg(const struct device *dev)
/* Program Retaining Registers with device lists. This will program the retaining register with the controller itself */ static void cdns_i3c_program_controller_retaining_reg(const struct device *dev)
{ const struct cdns_i3c_config *config = dev->config; struct cdns_i3c_data *data = dev->data; uint8_t controller_da = I3C_CONTROLLER_ADDR; if (!i3c_addr_slots_is_free(&data->common.attached_dev.addr_slots, controller_da)) { controller_da = i3c_addr_slots_next_free_find(&data->common.attached_dev.addr_slots, 0); LOG_DBG("%s: 0x%02x DA selected for controller", dev->name, controller_da); } sys_write32(prepare_rr0_dev_address(controller_da), config->base + DEV_ID_RR0(0)); i3c_addr_slots_mark_i3c(&data->common.attached_dev.addr_slots, controller_da); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Worker function to clean bit operation on CPU feature supported bits mask buffer. */
VOID SupportedMaskCleanBit(IN UINT8 *SupportedFeatureMask, IN UINT8 *AndFeatureBitMask, IN UINT32 BitMaskSize)
/* Worker function to clean bit operation on CPU feature supported bits mask buffer. */ VOID SupportedMaskCleanBit(IN UINT8 *SupportedFeatureMask, IN UINT8 *AndFeatureBitMask, IN UINT32 BitMaskSize)
{ UINTN Index; UINT8 *Data1; UINT8 *Data2; Data1 = SupportedFeatureMask; Data2 = AndFeatureBitMask; for (Index = 0; Index < BitMaskSize; Index++) { *(Data1++) &= ~(*(Data2++)); } }
tianocore/edk2
C++
Other
4,240
/* Miscelaneous platform dependent initialisations after monitor has been relocated into ram */
int misc_init_r(void)
/* Miscelaneous platform dependent initialisations after monitor has been relocated into ram */ int misc_init_r(void)
{ printf ("misc_init_r\n"); return (0); }
EmcraftSystems/u-boot
C++
Other
181
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
gboolean _g_freedesktop_dbus_call_list_activatable_names_finish(_GFreedesktopDBus *proxy, gchar ***out_activatable_names, GAsyncResult *res, GError **error)
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */ gboolean _g_freedesktop_dbus_call_list_activatable_names_finish(_GFreedesktopDBus *proxy, gchar ***out_activatable_names, GAsyncResult *res, GError **error)
{ GVariant *_ret; _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "(^as)", out_activatable_names); g_variant_unref (_ret); _out: return _ret != NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Enables or disables the Internal Low Speed oscillator (LSI). LSI can not be disabled if the IWDG is running. */
void RCC_LSICmd(FunctionalState NewState)
/* Enables or disables the Internal Low Speed oscillator (LSI). LSI can not be disabled if the IWDG is running. */ void RCC_LSICmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RCC->CSR |= CSR_LSION_Set; } else { RCC->CSR &= CSR_LSION_Reset; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Start a new MMC custom command request for a host, and wait for the command to complete. Does not attempt to parse the response. */
int32_t mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq)
/* Start a new MMC custom command request for a host, and wait for the command to complete. Does not attempt to parse the response. */ int32_t mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq)
{ mrq->cmd->data = mrq->data; return HAL_SDC_Request(host, mrq); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Simple function to wait for a given 8-bit value to be returned from a reg_read call. Returns: negative is error or timeout, zero is success. */
static int reg_r_wait(struct gspca_dev *gspca_dev, __u16 reg, __u16 index, __u16 value)
/* Simple function to wait for a given 8-bit value to be returned from a reg_read call. Returns: negative is error or timeout, zero is success. */ static int reg_r_wait(struct gspca_dev *gspca_dev, __u16 reg, __u16 index, __u16 value)
{ int ret, cnt = 20; while (--cnt > 0) { ret = reg_r_12(gspca_dev, reg, index, 1); if (ret == value) return 0; msleep(50); } return -EIO; }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the TIM Capture Compare Channel x. */
void TIM_CCxCmd(TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_CCx)
/* Enables or disables the TIM Capture Compare Channel x. */ void TIM_CCxCmd(TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_CCx)
{ uint32_t tmp = 0; assert_param(IS_TIM_LIST1_PERIPH(TIMx)); assert_param(IS_TIM_CHANNEL(TIM_Channel)); assert_param(IS_TIM_CCX(TIM_CCx)); tmp = (uint32_t)CCER_CCE_SET << (uint32_t)TIM_Channel; TIMx->CCER &= (uint32_t)(~tmp); TIMx->CCER |= ((uint32_t)TIM_CCx << (uint32_t)TIM_Channel); }
avem-labs/Avem
C++
MIT License
1,752
/* The originating slot should not be part of any active DMA transfer. */
void edma_link(unsigned from, unsigned to)
/* The originating slot should not be part of any active DMA transfer. */ void edma_link(unsigned from, unsigned to)
{ unsigned ctlr_from, ctlr_to; ctlr_from = EDMA_CTLR(from); from = EDMA_CHAN_SLOT(from); ctlr_to = EDMA_CTLR(to); to = EDMA_CHAN_SLOT(to); if (from >= edma_cc[ctlr_from]->num_slots) return; if (to >= edma_cc[ctlr_to]->num_slots) return; edma_parm_modify(ctlr_from, PARM_LINK_BCNTRLD, from, 0xffff0000, PARM_OFFSET(to)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initialize an events configuration structure to defaults. The default configuration is as follows: */
void events_get_config_defaults(struct events_conf *const config)
/* Initialize an events configuration structure to defaults. The default configuration is as follows: */ void events_get_config_defaults(struct events_conf *const config)
{ Assert(config); config->igf_divider = EVENT_IGF_DIVIDER_1024; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Note that this will interrupt immediately if the interrupt is not masked and IRQs are not locked, and this interrupt has higher priority than a possibly currently running interrupt */
void posix_sw_set_pending_IRQ(unsigned int IRQn)
/* Note that this will interrupt immediately if the interrupt is not masked and IRQs are not locked, and this interrupt has higher priority than a possibly currently running interrupt */ void posix_sw_set_pending_IRQ(unsigned int IRQn)
{ hw_irq_ctrl_raise_im_from_sw(IRQn); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Fills each RTC_TimeStruct member with its default value (Time = 00h:00min:00sec). */
void RTC_TimeStructInit(RTC_TimeTypeDef *RTC_TimeStruct)
/* Fills each RTC_TimeStruct member with its default value (Time = 00h:00min:00sec). */ void RTC_TimeStructInit(RTC_TimeTypeDef *RTC_TimeStruct)
{ RTC_TimeStruct->RTC_H12 = RTC_H12_AM; RTC_TimeStruct->RTC_Hours = 0; RTC_TimeStruct->RTC_Minutes = 0; RTC_TimeStruct->RTC_Seconds = 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Decodes the result of scsi READ 10 command. */
static void uhi_msc_scsi_read_10_done(bool b_cbw_succes)
/* Decodes the result of scsi READ 10 command. */ static void uhi_msc_scsi_read_10_done(bool b_cbw_succes)
{ if ((!b_cbw_succes) || (uhi_msc_csw.bCSWStatus != USB_CSW_STATUS_PASS) || uhi_msc_csw.dCSWDataResidue) { uhi_msc_lun_sel->status = LUN_FAIL; uhi_msc_scsi_callback(false); return; } uhi_msc_scsi_callback(true); }
remotemcu/remcu-chip-sdks
C++
null
436
/* For Td guest TDVMCALL_IO is invoked to write I/O port. */
UINT32 EFIAPI IoWrite32(IN UINTN Port, IN UINT32 Value)
/* For Td guest TDVMCALL_IO is invoked to write I/O port. */ UINT32 EFIAPI IoWrite32(IN UINTN Port, IN UINT32 Value)
{ BOOLEAN Flag; ASSERT ((Port & 3) == 0); Flag = FilterBeforeIoWrite (FilterWidth32, Port, &Value); if (Flag) { if (IsTdxGuest ()) { TdIoWrite32 (Port, Value); } else { __asm__ __volatile__ ("outl %0,%w1" : : "a" (Value), "d" ((UINT16)Port)); } } FilterAfterIoWrite (FilterWidth32, Port, &Value); return Value; }
tianocore/edk2
C++
Other
4,240
/* 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 = 0xFF; 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
/* Check if Frame transmission buffer has been emptied @rmtoll ISR TXBEF LL_SWPMI_IsActiveFlag_TXBE. */
uint32_t LL_SWPMI_IsActiveFlag_TXBE(SWPMI_TypeDef *SWPMIx)
/* Check if Frame transmission buffer has been emptied @rmtoll ISR TXBEF LL_SWPMI_IsActiveFlag_TXBE. */ uint32_t LL_SWPMI_IsActiveFlag_TXBE(SWPMI_TypeDef *SWPMIx)
{ return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_TXBEF) == (SWPMI_ISR_TXBEF)) ? 1UL : 0UL); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Event handler for the library USB Disconnection event. */
void EVENT_USB_Device_Reset(void)
/* Event handler for the library USB Disconnection event. */ void EVENT_USB_Device_Reset(void)
{ if(device.IsConfigured) { USB_Init(); device.IsConfigured=0; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Hard resets the chip, disables HA interrupts, downloads the sequnecer microcode and starts the sequencers. The caller has to explicitly enable HA interrupts with asd_enable_ints(asd_ha). */
static int asd_init_chip(struct asd_ha_struct *asd_ha)
/* Hard resets the chip, disables HA interrupts, downloads the sequnecer microcode and starts the sequencers. The caller has to explicitly enable HA interrupts with asd_enable_ints(asd_ha). */ static int asd_init_chip(struct asd_ha_struct *asd_ha)
{ int err; err = asd_chip_hardrst(asd_ha); if (err) { asd_printk("couldn't hard reset %s\n", pci_name(asd_ha->pcidev)); goto out; } asd_disable_ints(asd_ha); err = asd_init_seqs(asd_ha); if (err) { asd_printk("couldn't init seqs for %s\n", pci_name(asd_ha->pcidev)); goto out; } err = asd_start_seqs(asd_ha); if (err) { asd_printk("coudln't start seqs for %s\n", pci_name(asd_ha->pcidev)); goto out; } out: return err; }
robutest/uclinux
C++
GPL-2.0
60
/* Return with a pointer to the previous screen. Only used during screen transitions. */
lv_obj_t* lv_disp_get_scr_prev(lv_disp_t *disp)
/* Return with a pointer to the previous screen. Only used during screen transitions. */ lv_obj_t* lv_disp_get_scr_prev(lv_disp_t *disp)
{ if(!disp) disp = lv_disp_get_default(); if(!disp) { LV_LOG_WARN("no display registered to get its previous screen"); return NULL; } return disp->prev_scr; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Perform a single read of an MII 16bit register. Returns zero on success or -ETIMEDOUT if the PHY did not respond. */
static int velocity_mii_read(struct mac_regs __iomem *regs, u8 index, u16 *data)
/* Perform a single read of an MII 16bit register. Returns zero on success or -ETIMEDOUT if the PHY did not respond. */ static int velocity_mii_read(struct mac_regs __iomem *regs, u8 index, u16 *data)
{ u16 ww; safe_disable_mii_autopoll(regs); writeb(index, &regs->MIIADR); BYTE_REG_BITS_ON(MIICR_RCMD, &regs->MIICR); for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { if (!(readb(&regs->MIICR) & MIICR_RCMD)) break; } *data = readw(&regs->MIIDATA); enable_mii_autopoll(regs); if (ww == W_MAX_TIMEOUT) return -ETIMEDOUT; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* param base eDMA peripheral base address. param channel eDMA channel number. param config Pointer to eDMA transfer configuration structure. param nextTcd Point to TCD structure. It can be NULL if users do not want to enable scatter/gather feature. note If nextTcd is not NULL, it means scatter gather feature is enabled and DREQ bit is cleared in the previous transfer configuration, which is set in the eDMA_ResetChannel. */
void EDMA_SetTransferConfig(DMA_Type *base, uint32_t channel, const edma_transfer_config_t *config, edma_tcd_t *nextTcd)
/* param base eDMA peripheral base address. param channel eDMA channel number. param config Pointer to eDMA transfer configuration structure. param nextTcd Point to TCD structure. It can be NULL if users do not want to enable scatter/gather feature. note If nextTcd is not NULL, it means scatter gather feature is enabled and DREQ bit is cleared in the previous transfer configuration, which is set in the eDMA_ResetChannel. */ void EDMA_SetTransferConfig(DMA_Type *base, uint32_t channel, const edma_transfer_config_t *config, edma_tcd_t *nextTcd)
{ assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL); assert(config != NULL); assert(((uint32_t)nextTcd & 0x1FU) == 0); EDMA_TcdSetTransferConfig((edma_tcd_t *)&base->TCD[channel], config, nextTcd); }
nanoframework/nf-interpreter
C++
MIT License
293
/* For ESP32 FreeRTOS, vTaskExitCritical implements both portEXIT_CRITICAL and portEXIT_CRITICAL_ISR. */
TickType_t uxTaskResetEventItemValue(void)
/* For ESP32 FreeRTOS, vTaskExitCritical implements both portEXIT_CRITICAL and portEXIT_CRITICAL_ISR. */ TickType_t uxTaskResetEventItemValue(void)
{ TickType_t uxReturn; taskENTER_CRITICAL(&xTaskQueueMutex); uxReturn = listGET_LIST_ITEM_VALUE( &( pxCurrentTCB[ xPortGetCoreID() ]->xEventListItem ) ); listSET_LIST_ITEM_VALUE( &( pxCurrentTCB[ xPortGetCoreID() ]->xEventListItem ), ( ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxCurrentTCB[ xPortGetCoreID() ]->uxPriority ) ); taskEXIT_CRITICAL(&xTaskQueueMutex); return uxReturn; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Set the HwErrRecSupport variable contains a binary UINT16 that supplies the level of support for Hardware Error Record Persistence that is implemented by the platform. */
VOID InitializeHwErrRecSupport(VOID)
/* Set the HwErrRecSupport variable contains a binary UINT16 that supplies the level of support for Hardware Error Record Persistence that is implemented by the platform. */ VOID InitializeHwErrRecSupport(VOID)
{ EFI_STATUS Status; UINT16 HardwareErrorRecordLevel; HardwareErrorRecordLevel = PcdGet16 (PcdHardwareErrorRecordLevel); if (HardwareErrorRecordLevel != 0) { Status = gRT->SetVariable ( L"HwErrRecSupport", &gEfiGlobalVariableGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, sizeof (UINT16), &HardwareErrorRecordLevel ); ASSERT_EFI_ERROR (Status); } }
tianocore/edk2
C++
Other
4,240
/* Performs an atomic compare exchange operation on the 16-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. */
UINT16 EFIAPI InternalSyncCompareExchange16(IN volatile UINT16 *Value, IN UINT16 CompareValue, IN UINT16 ExchangeValue)
/* Performs an atomic compare exchange operation on the 16-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. */ UINT16 EFIAPI InternalSyncCompareExchange16(IN volatile UINT16 *Value, IN UINT16 CompareValue, IN UINT16 ExchangeValue)
{ return *Value != CompareValue ? *Value : ((*Value = ExchangeValue), CompareValue); }
tianocore/edk2
C++
Other
4,240
/* param base SPDIF base pointer. param buffer Pointer to the data to be written. param size Bytes to be written. */
void SPDIF_WriteBlocking(SPDIF_Type *base, uint8_t *buffer, uint32_t size)
/* param base SPDIF base pointer. param buffer Pointer to the data to be written. param size Bytes to be written. */ void SPDIF_WriteBlocking(SPDIF_Type *base, uint8_t *buffer, uint32_t size)
{ assert(buffer); assert(size % 6U == 0U); uint32_t i = 0, j = 0, data = 0; while (i < size) { while ((SPDIF_GetStatusFlag(base) & kSPDIF_TxFIFOEmpty) == 0U) { } for (j = 0; j < 3U; j++) { data |= ((uint32_t)(*buffer) << (j * 8U)); buffer++; } SPDIF_WriteLeftData(base, data); data = 0; for (j = 0; j < 3U; j++) { data |= ((uint32_t)(*buffer) << (j * 8U)); buffer++; } SPDIF_WriteRightData(base, data); i += 6U; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Refer to EMMC Electrical Standard Spec 5.1 Section 6.10.4 for details. */
EFI_STATUS EmmcPeimGetExtCsd(IN EMMC_PEIM_HC_SLOT *Slot, OUT EMMC_EXT_CSD *ExtCsd)
/* Refer to EMMC Electrical Standard Spec 5.1 Section 6.10.4 for details. */ EFI_STATUS EmmcPeimGetExtCsd(IN EMMC_PEIM_HC_SLOT *Slot, OUT EMMC_EXT_CSD *ExtCsd)
{ EMMC_COMMAND_BLOCK EmmcCmdBlk; EMMC_STATUS_BLOCK EmmcStatusBlk; EMMC_COMMAND_PACKET Packet; EFI_STATUS Status; ZeroMem (&EmmcCmdBlk, sizeof (EmmcCmdBlk)); ZeroMem (&EmmcStatusBlk, sizeof (EmmcStatusBlk)); ZeroMem (&Packet, sizeof (Packet)); Packet.EmmcCmdBlk = &EmmcCmdBlk; Packet.EmmcStatusBlk = &EmmcStatusBlk; Packet.Timeout = EMMC_TIMEOUT; EmmcCmdBlk.CommandIndex = EMMC_SEND_EXT_CSD; EmmcCmdBlk.CommandType = EmmcCommandTypeAdtc; EmmcCmdBlk.ResponseType = EmmcResponceTypeR1; EmmcCmdBlk.CommandArgument = 0x00000000; Packet.InDataBuffer = ExtCsd; Packet.InTransferLength = sizeof (EMMC_EXT_CSD); Status = EmmcPeimExecCmd (Slot, &Packet); return Status; }
tianocore/edk2
C++
Other
4,240
/* Because there may be INSERT boot script at runtime in SMM. The boot time copy will be used to restore data after back from S3. Otherwise the data inserted may cause some boot time boot script data lost if only BootScriptData used. */
VOID SaveBootTimeDataToLockBox(VOID)
/* Because there may be INSERT boot script at runtime in SMM. The boot time copy will be used to restore data after back from S3. Otherwise the data inserted may cause some boot time boot script data lost if only BootScriptData used. */ VOID SaveBootTimeDataToLockBox(VOID)
{ EFI_STATUS Status; Status = RestoreLockBox ( &mBootScriptDataGuid, NULL, NULL ); ASSERT_EFI_ERROR (Status); Status = SaveLockBox ( &mBootScriptDataBootTimeGuid, (VOID *)mS3BootScriptTablePtr->TableBase, mS3BootScriptTablePtr->BootTimeScriptLength ); ASSERT_EFI_ERROR (Status); }
tianocore/edk2
C++
Other
4,240
/* Releases all PCI I/O and memory resources previously reserved by a successful call to pci_request_regions. Call this function only after all use of the PCI regions has ceased. */
void pci_release_regions(struct pci_dev *pdev)
/* Releases all PCI I/O and memory resources previously reserved by a successful call to pci_request_regions. Call this function only after all use of the PCI regions has ceased. */ void pci_release_regions(struct pci_dev *pdev)
{ pci_release_selected_regions(pdev, (1 << 6) - 1); }
robutest/uclinux
C++
GPL-2.0
60
/* Sets @mask on @info to match specific attribute types. */
void g_file_info_set_attribute_mask(GFileInfo *info, GFileAttributeMatcher *mask)
/* Sets @mask on @info to match specific attribute types. */ void g_file_info_set_attribute_mask(GFileInfo *info, GFileAttributeMatcher *mask)
{ GFileAttribute *attr; int i; g_return_if_fail (G_IS_FILE_INFO (info)); if (mask != info->mask) { if (info->mask != NO_ATTRIBUTE_MASK) g_file_attribute_matcher_unref (info->mask); info->mask = g_file_attribute_matcher_ref (mask); for (i = 0; i < info->attributes->len; i++) { attr = &g_array_index (info->attributes, GFileAttribute, i); if (!_g_file_attribute_matcher_matches_id (mask, attr->attribute)) { _g_file_attribute_value_clear (&attr->value); g_array_remove_index (info->attributes, i); i--; } } } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Initializes the SPI Flash module. Initializes the SPI Flash module */
void spi_flash_init(void)
/* Initializes the SPI Flash module. Initializes the SPI Flash module */ void spi_flash_init(void)
{ LPMCU_MISC_REGS0->PINMUX_SEL_3.reg = \ LPMCU_MISC_REGS_PINMUX_SEL_3_LP_SIP_0_SEL_SPI_FLASH0_SCK | \ LPMCU_MISC_REGS_PINMUX_SEL_3_LP_SIP_1_SEL_SPI_FLASH0_TXD | \ LPMCU_MISC_REGS_PINMUX_SEL_3_LP_SIP_2_SEL_SPI_FLASH0_SSN | \ LPMCU_MISC_REGS_PINMUX_SEL_3_LP_SIP_3_SEL_SPI_FLASH0_RXD; SPI_FLASH0->MODE_CTRL.reg = SPI_FLASH_MODE_CTRL_RESETVALUE; spi_flash_leave_low_power_mode(); }
memfault/zero-to-main
C++
null
200
/* Once this space has been set aside, the bootmem maps are initialized. We could probably move the allocation of the per-cpu and ia64_node_data space outside of this function and use alloc_bootmem_node(), but doing it here is straightforward and we get the alignments we want so... */
static int __init find_pernode_space(unsigned long start, unsigned long len, int node)
/* Once this space has been set aside, the bootmem maps are initialized. We could probably move the allocation of the per-cpu and ia64_node_data space outside of this function and use alloc_bootmem_node(), but doing it here is straightforward and we get the alignments we want so... */ static int __init find_pernode_space(unsigned long start, unsigned long len, int node)
{ unsigned long spfn, epfn; unsigned long pernodesize = 0, pernode, pages, mapsize; struct bootmem_data *bdp = &bootmem_node_data[node]; spfn = start >> PAGE_SHIFT; epfn = (start + len) >> PAGE_SHIFT; pages = bdp->node_low_pfn - bdp->node_min_pfn; mapsize = bootmem_bootmap_pages(pages) << PAGE_SHIFT; if (spfn < bdp->node_min_pfn || epfn > bdp->node_low_pfn) return 0; if (mem_data[node].pernode_addr) return 0; pernodesize = compute_pernodesize(node); pernode = NODEDATA_ALIGN(start, node); if (start + len > (pernode + pernodesize + mapsize)) fill_pernode(node, pernode, pernodesize); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return codes PCI_ERS_RESULT_NEED_RESET - need to reset before recovery PCI_ERS_RESULT_DISCONNECT - device could not be recovered */
static pci_ers_result_t lpfc_io_error_detected_s4(struct pci_dev *pdev, pci_channel_state_t state)
/* Return codes PCI_ERS_RESULT_NEED_RESET - need to reset before recovery PCI_ERS_RESULT_DISCONNECT - device could not be recovered */ static pci_ers_result_t lpfc_io_error_detected_s4(struct pci_dev *pdev, pci_channel_state_t state)
{ return PCI_ERS_RESULT_NEED_RESET; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is derived from PowerPC code (timebase clock frequency). On ARM it returns the number of timer ticks per second. */
ulong get_tbclk(void)
/* This function is derived from PowerPC code (timebase clock frequency). On ARM it returns the number of timer ticks per second. */ ulong get_tbclk(void)
{ ulong tbclk; tbclk = timer_load_val * 100; return tbclk; }
EmcraftSystems/u-boot
C++
Other
181
/* genphy_restart_aneg - Enable and Restart Autonegotiation @phydev: target phy_device struct */
int genphy_restart_aneg(struct phy_device *phydev)
/* genphy_restart_aneg - Enable and Restart Autonegotiation @phydev: target phy_device struct */ int genphy_restart_aneg(struct phy_device *phydev)
{ int ctl; ctl = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR); if (ctl < 0) return ctl; ctl |= (BMCR_ANENABLE | BMCR_ANRESTART); ctl &= ~(BMCR_ISOLATE); ctl = phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, ctl); return ctl; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Big-endian to little-endian byte-swapping/bitmaps by David S. Miller ( */
static int ext2_add_nondir(struct dentry *dentry, struct inode *inode)
/* Big-endian to little-endian byte-swapping/bitmaps by David S. Miller ( */ static int ext2_add_nondir(struct dentry *dentry, struct inode *inode)
{ int err = ext2_add_link(dentry, inode); if (!err) { d_instantiate(dentry, inode); unlock_new_inode(inode); return 0; } inode_dec_link_count(inode); unlock_new_inode(inode); iput(inode); return err; }
robutest/uclinux
C++
GPL-2.0
60
/* kref_get - increment refcount for object. @kref: object. */
void kref_get(struct kref *kref)
/* kref_get - increment refcount for object. @kref: object. */ void kref_get(struct kref *kref)
{ WARN_ON(!atomic_read(&kref->refcount)); atomic_inc(&kref->refcount); smp_mb__after_atomic_inc(); }
robutest/uclinux
C++
GPL-2.0
60
/* Writes data to the specified GPIO data port bit. */
void GPIO_WriteBitValue(GPIO_T *port, uint16_t pin, uint8_t bitVal)
/* Writes data to the specified GPIO data port bit. */ void GPIO_WriteBitValue(GPIO_T *port, uint16_t pin, uint8_t bitVal)
{ if (bitVal != BIT_RESET) { port->BSCL = pin; } else { port->BSCH = pin ; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function returns the contents of the specified Alarm Threshold Register. */
u16 XAdcPs_GetAlarmThreshold(XAdcPs *InstancePtr, u8 AlarmThrReg)
/* This function returns the contents of the specified Alarm Threshold Register. */ u16 XAdcPs_GetAlarmThreshold(XAdcPs *InstancePtr, u8 AlarmThrReg)
{ u32 RegData; Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); Xil_AssertNonvoid(AlarmThrReg <= XADCPS_ATR_VCCPDRO_LOWER); RegData = XAdcPs_ReadInternalReg(InstancePtr, (XADCPS_ATR_TEMP_UPPER_OFFSET + (u32)AlarmThrReg)); return (u16) RegData; }
ua1arn/hftrx
C++
null
69
/* This API write the data to the given register. */
BMM050_RETURN_FUNCTION_TYPE bmm050_write_register(u8 v_addr_u8, u8 *v_data_u8, u8 v_len_u8)
/* This API write the data to the given register. */ BMM050_RETURN_FUNCTION_TYPE bmm050_write_register(u8 v_addr_u8, u8 *v_data_u8, u8 v_len_u8)
{ BMM050_RETURN_FUNCTION_TYPE com_rslt = ERROR; if (p_bmm050 == BMM050_NULL) { return E_BMM050_NULL_PTR; } else { com_rslt = p_bmm050->BMM050_BUS_WRITE_FUNC(p_bmm050->dev_addr, v_addr_u8, v_data_u8, v_len_u8); } return com_rslt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* 8-bit unpacked samples => RGBA w/ associated alpha */
DECLARESepPutFunc(putRGBAAseparate8bittile)
/* 8-bit unpacked samples => RGBA w/ associated alpha */ DECLARESepPutFunc(putRGBAAseparate8bittile)
{ (void) img; (void) x; (void) y; for( ; h > 0; --h) { UNROLL8(w, NOP, *cp++ = PACK4(*r++, *g++, *b++, *a++)); SKEW4(r, g, b, a, fromskew); cp += toskew; } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Read blocks from SDIO fifo. Reads blocks from SDIO register, treating it as a fifo. Reads will all be done from same address. */
int sdio_read_blocks_fifo(struct sdio_func *func, uint32_t reg, uint8_t *data, uint32_t blocks)
/* Read blocks from SDIO fifo. Reads blocks from SDIO register, treating it as a fifo. Reads will all be done from same address. */ int sdio_read_blocks_fifo(struct sdio_func *func, uint32_t reg, uint8_t *data, uint32_t blocks)
{ int ret; if ((func->card->type != CARD_SDIO) && (func->card->type != CARD_COMBO)) { LOG_WRN("Card does not support SDIO commands"); return -ENOTSUP; } ret = k_mutex_lock(&func->card->lock, K_MSEC(CONFIG_SD_DATA_TIMEOUT)); if (ret) { LOG_WRN("Could not get SD card mutex"); return -EBUSY; } ret = sdio_io_rw_extended(func->card, SDIO_IO_READ, func->num, reg, false, data, blocks, func->block_size); k_mutex_unlock(&func->card->lock); return ret; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573