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
/* Fills each CEC_InitStruct member with its default value. */
void CEC_StructInit(CEC_InitTypeDef *CEC_InitStruct)
/* Fills each CEC_InitStruct member with its default value. */ void CEC_StructInit(CEC_InitTypeDef *CEC_InitStruct)
{ CEC_InitStruct->CEC_SignalFreeTime = CEC_SignalFreeTime_Standard; CEC_InitStruct->CEC_RxTolerance = CEC_RxTolerance_Standard; CEC_InitStruct->CEC_StopReception = CEC_StopReception_Off; CEC_InitStruct->CEC_BitRisingError = CEC_BitRisingError_Off; CEC_InitStruct->CEC_LongBitPeriodError = CEC_LongBitPeriodError_Off; CEC_InitStruct->CEC_BRDNoGen = CEC_BRDNoGen_Off; CEC_InitStruct->CEC_SFTOption = CEC_SFTOption_Off; }
ajhc/demo-cortex-m3
C++
null
38
/* Returns a boolean to indicate whether SEV-ES is enabled. */
BOOLEAN EFIAPI MemEncryptSevEsIsEnabled(VOID)
/* Returns a boolean to indicate whether SEV-ES is enabled. */ BOOLEAN EFIAPI MemEncryptSevEsIsEnabled(VOID)
{ return ConfidentialComputingGuestHas (CCAttrAmdSevEs); }
tianocore/edk2
C++
Other
4,240
/* Take the passed in Buffer of size ElementSize and grow the buffer by CONSOLE_SPLITTER_ALLOC_UNIT * ElementSize bytes. Copy the current data in Buffer to the new version of Buffer and free the old version of buffer. */
EFI_STATUS ConSplitterGrowBuffer(IN UINTN ElementSize, IN OUT UINTN *Count, IN OUT VOID **Buffer)
/* Take the passed in Buffer of size ElementSize and grow the buffer by CONSOLE_SPLITTER_ALLOC_UNIT * ElementSize bytes. Copy the current data in Buffer to the new version of Buffer and free the old version of buffer. */ EFI_STATUS ConSplitterGrowBuffer(IN UINTN ElementSize, IN OUT UINTN *Count, IN OUT VOID **Buffer)
{ VOID *Ptr; Ptr = ReallocatePool ( ElementSize * (*Count), ElementSize * ((*Count) + CONSOLE_SPLITTER_ALLOC_UNIT), *Buffer ); if (Ptr == NULL) { return EFI_OUT_OF_RESOURCES; } *Count += CONSOLE_SPLITTER_ALLOC_UNIT; *Buffer = Ptr; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* mptsas_del_device_components - Cleaning the list @ioc: Pointer to MPT_ADAPTER structure */
static void mptsas_del_device_components(MPT_ADAPTER *ioc)
/* mptsas_del_device_components - Cleaning the list @ioc: Pointer to MPT_ADAPTER structure */ static void mptsas_del_device_components(MPT_ADAPTER *ioc)
{ struct mptsas_device_info *sas_info, *next; mutex_lock(&ioc->sas_device_info_mutex); list_for_each_entry_safe(sas_info, next, &ioc->sas_device_info_list, list) { list_del(&sas_info->list); kfree(sas_info); } mutex_unlock(&ioc->sas_device_info_mutex); }
robutest/uclinux
C++
GPL-2.0
60
/* Generates a 16-bit random number used as initial seed for srand() Also in case the function is called from a different state than TRX_OFF, additional trx state handling is required, such as reading the original value and restoring this state after finishing the sequence. Since in our case the function is called from TRX_OFF, this is not required here. */
static void generate_rand_seed(void)
/* Generates a 16-bit random number used as initial seed for srand() Also in case the function is called from a different state than TRX_OFF, additional trx state handling is required, such as reading the original value and restoring this state after finishing the sequence. Since in our case the function is called from TRX_OFF, this is not required here. */ static void generate_rand_seed(void)
{ uint16_t seed = 0; uint8_t cur_random_val = 0; set_trx_state(CMD_RX_ON); ENTER_TRX_REGION(); for (uint8_t i = 0; i < 8; i++) { cur_random_val = pal_trx_bit_read(SR_RND_VALUE); seed = seed << 2; seed |= cur_random_val; } set_trx_state(CMD_TRX_OFF); pal_trx_reg_read(RG_IRQ_STATUS); CLEAR_TRX_IRQ(); LEAVE_TRX_REGION(); srand(seed); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Sets the given PCM operators to the pcm instance. */
void snd_pcm_set_ops(struct snd_pcm *pcm, int direction, struct snd_pcm_ops *ops)
/* Sets the given PCM operators to the pcm instance. */ void snd_pcm_set_ops(struct snd_pcm *pcm, int direction, struct snd_pcm_ops *ops)
{ struct snd_pcm_str *stream = &pcm->streams[direction]; struct snd_pcm_substream *substream; for (substream = stream->substream; substream != NULL; substream = substream->next) substream->ops = ops; }
robutest/uclinux
C++
GPL-2.0
60
/* Set CC3000 in mDNS advertiser mode in order to advertise itself. mdnsAdvertiser */
INT16 CC3000_EXPORT() mdnsAdvertiser(UINT16 mdnsEnabled, CHAR *deviceServiceName, UINT16 deviceServiceNameLength)
/* Set CC3000 in mDNS advertiser mode in order to advertise itself. mdnsAdvertiser */ INT16 CC3000_EXPORT() mdnsAdvertiser(UINT16 mdnsEnabled, CHAR *deviceServiceName, UINT16 deviceServiceNameLength)
{ INT8 ret; UINT8 *pTxBuffer, *pArgs; if (deviceServiceNameLength > MDNS_DEVICE_SERVICE_MAX_LENGTH) { return EFAIL; } pTxBuffer = tSLInformation.pucTxCommandBuffer; pArgs = (pTxBuffer + SIMPLE_LINK_HCI_CMND_TRANSPORT_HEADER_SIZE); pArgs = UINT32_TO_STREAM(pArgs, mdnsEnabled); pArgs = UINT32_TO_STREAM(pArgs, 8); pArgs = UINT32_TO_STREAM(pArgs, deviceServiceNameLength); ARRAY_TO_STREAM(pArgs, deviceServiceName, deviceServiceNameLength); hci_command_send(HCI_CMND_MDNS_ADVERTISE, pTxBuffer, SOCKET_MDNS_ADVERTISE_PARAMS_LEN + deviceServiceNameLength); SimpleLinkWaitEvent(HCI_EVNT_MDNS_ADVERTISE, &ret); return ret; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Preset and Initialize the MMC counters to almost-full value: 0xFFFF_FFF0 (full - 16) MMC functions */
void ETH_PresetMMCCounterFull(void)
/* Preset and Initialize the MMC counters to almost-full value: 0xFFFF_FFF0 (full - 16) MMC functions */ void ETH_PresetMMCCounterFull(void)
{ ETH->CTRL_B.MCNTP = SET; ETH->CTRL_B.MCNTVALP = SET; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initialize peripherals used by the I2C EEPROM driver. */
void sEE_Init(sEE_InitTypeDef *sEEInitStruct)
/* Initialize peripherals used by the I2C EEPROM driver. */ void sEE_Init(sEE_InitTypeDef *sEEInitStruct)
{ CPAL_I2C_Init(sEEInitStruct->sEE_CPALStructure); }
avem-labs/Avem
C++
MIT License
1,752
/* If the pointer to the HOB list is NULL, then ASSERT(). */
EFI_BOOT_MODE EFIAPI GetBootModeHob(VOID)
/* If the pointer to the HOB list is NULL, then ASSERT(). */ EFI_BOOT_MODE EFIAPI GetBootModeHob(VOID)
{ EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *)GetHobList (); return HandOffHob->BootMode; }
tianocore/edk2
C++
Other
4,240
/* Disable HART reception by disabling the demultiplexer that routes the AD5700 to the circuit inputs. To enable these multipliers the AD4111 GPIO0 must be driven low. */
int32_t cn0414_hart_disable(struct cn0414_dev *dev, uint8_t *arg)
/* Disable HART reception by disabling the demultiplexer that routes the AD5700 to the circuit inputs. To enable these multipliers the AD4111 GPIO0 must be driven low. */ int32_t cn0414_hart_disable(struct cn0414_dev *dev, uint8_t *arg)
{ ad717x_st_reg *preg; NVIC_DisableIRQ(TMR0_INT); NVIC_DisableIRQ(HART_CD_INT); AD717X_ReadRegister(dev->ad4111_device, AD717X_GPIOCON_REG); preg = AD717X_GetReg(dev->ad4111_device, AD717X_GPIOCON_REG); preg->value &= ~AD4111_GPIOCON_REG_DATA0; NVIC_EnableIRQ(TMR0_INT); NVIC_EnableIRQ(HART_CD_INT); return AD717X_WriteRegister(dev->ad4111_device, AD717X_GPIOCON_REG); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* This function handles DMA Channel 4 to 7 interrupts. */
void DMA1_Channel4_5_6_7_IRQHandler(void)
/* This function handles DMA Channel 4 to 7 interrupts. */ void DMA1_Channel4_5_6_7_IRQHandler(void)
{ USBPD_DMA_PORT0_IRQHandler(); }
st-one/X-CUBE-USB-PD
C++
null
110
/* Description: The SCSI spec says that INQUIRY vendor, product, and revision strings must consist entirely of graphic ASCII characters, padded on the right with spaces. Since not all devices obey this rule, we will replace non-graphic or non-ASCII characters with spaces. Exception: a NUL character is interpreted as a string terminator, so all the following characters are set to spaces. */
static void sanitize_inquiry_string(unsigned char *s, int len)
/* Description: The SCSI spec says that INQUIRY vendor, product, and revision strings must consist entirely of graphic ASCII characters, padded on the right with spaces. Since not all devices obey this rule, we will replace non-graphic or non-ASCII characters with spaces. Exception: a NUL character is interpreted as a string terminator, so all the following characters are set to spaces. */ static void sanitize_inquiry_string(unsigned char *s, int len)
{ int terminated = 0; for (; len > 0; (--len, ++s)) { if (*s == 0) terminated = 1; if (terminated || *s < 0x20 || *s > 0x7e) *s = ' '; } }
robutest/uclinux
C++
GPL-2.0
60
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciAnd32(IN UINTN Address, IN UINT32 AndData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI PciAnd32(IN UINTN Address, IN UINT32 AndData)
{ return PciExpressAnd32 (Address, AndData); }
tianocore/edk2
C++
Other
4,240
/* Indicates error in rx frame length. Retruns true if received frame length doesnot match with the length field */
bool synopGMAC_is_rx_frame_length_errors(u32 status)
/* Indicates error in rx frame length. Retruns true if received frame length doesnot match with the length field */ bool synopGMAC_is_rx_frame_length_errors(u32 status)
{ return((status & DescRxLengthError) == DescRxLengthError); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Create and start a thread. This function starts a new thread. The new thread starts execution by invoking entry(). The argument arg is passed as the sole argument of entry(). */
OS_Status OS_ThreadCreate(OS_Thread_t *thread, const char *name, OS_ThreadEntry_t entry, void *arg, OS_Priority priority, uint32_t stackSize)
/* Create and start a thread. This function starts a new thread. The new thread starts execution by invoking entry(). The argument arg is passed as the sole argument of entry(). */ OS_Status OS_ThreadCreate(OS_Thread_t *thread, const char *name, OS_ThreadEntry_t entry, void *arg, OS_Priority priority, uint32_t stackSize)
{ BaseType_t ret; OS_HANDLE_ASSERT(!OS_ThreadIsValid(thread), thread->handle); ret = xTaskCreate(entry, name, stackSize / sizeof(StackType_t), arg, priority, &thread->handle); if (ret != pdPASS) { OS_ERR("err %"OS_BASETYPE_F"\n", ret); OS_ThreadSetInvalid(thread); return OS_FAIL; } return OS_OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* We are going ot alloc a page during init per window for small transfers. Small transfers will go VME -> buffer -> user space. Larger (more than a page) transfers will lock the user space buffer into memory and then transfer the data directly into the user space buffers. */
static ssize_t resource_to_user(int minor, char __user *buf, size_t count, loff_t *ppos)
/* We are going ot alloc a page during init per window for small transfers. Small transfers will go VME -> buffer -> user space. Larger (more than a page) transfers will lock the user space buffer into memory and then transfer the data directly into the user space buffers. */ static ssize_t resource_to_user(int minor, char __user *buf, size_t count, loff_t *ppos)
{ ssize_t retval; ssize_t copied = 0; if (count <= image[minor].size_buf) { copied = vme_master_read(image[minor].resource, image[minor].kern_buf, count, *ppos); if (copied < 0) { return (int)copied; } retval = __copy_to_user(buf, image[minor].kern_buf, (unsigned long)copied); if (retval != 0) { copied = (copied - retval); printk("User copy failed\n"); return -EINVAL; } } else { printk("Currently don't support large transfers\n"); return -EINVAL; } return copied; }
robutest/uclinux
C++
GPL-2.0
60
/* Send a START condition and the given command */
static void send_seeprom_cmd(struct seeprom_descriptor *sd, const struct seeprom_cmd *cmd)
/* Send a START condition and the given command */ static void send_seeprom_cmd(struct seeprom_descriptor *sd, const struct seeprom_cmd *cmd)
{ uint8_t temp; int i = 0; temp = sd->sd_MS ^ sd->sd_CS; SEEPROM_OUTB(sd, temp ^ sd->sd_CK); CLOCK_PULSE(sd, sd->sd_RDY); for (i = 0; i < cmd->len; i++) { if (cmd->bits[i] != 0) temp ^= sd->sd_DO; SEEPROM_OUTB(sd, temp); CLOCK_PULSE(sd, sd->sd_RDY); SEEPROM_OUTB(sd, temp ^ sd->sd_CK); CLOCK_PULSE(sd, sd->sd_RDY); if (cmd->bits[i] != 0) temp ^= sd->sd_DO; } }
robutest/uclinux
C++
GPL-2.0
60
/* configure the ADC clock for all the ADCs */
void adc_clock_config(uint32_t prescaler)
/* configure the ADC clock for all the ADCs */ void adc_clock_config(uint32_t prescaler)
{ ADC_SYNCCTL &= ~((uint32_t)ADC_SYNCCTL_ADCCK); ADC_SYNCCTL |= (uint32_t) prescaler; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* We try to reduce the number of interrupts caused by unexpected phase changes due to disconnects. A typical harddisk may disconnect before ANY block. If we wanted to avoid unexpected phase changes at all we had to use a break point every 512 bytes. Of course the number of scatter/gather blocks is limited. Under Linux, the scatter/gatter blocks are provided by the generic driver. We just have to copy addresses and sizes to the data segment array. */
static int ncr_scatter(struct ncb *np, struct ccb *cp, struct scsi_cmnd *cmd)
/* We try to reduce the number of interrupts caused by unexpected phase changes due to disconnects. A typical harddisk may disconnect before ANY block. If we wanted to avoid unexpected phase changes at all we had to use a break point every 512 bytes. Of course the number of scatter/gather blocks is limited. Under Linux, the scatter/gatter blocks are provided by the generic driver. We just have to copy addresses and sizes to the data segment array. */ static int ncr_scatter(struct ncb *np, struct ccb *cp, struct scsi_cmnd *cmd)
{ int segment = 0; int use_sg = scsi_sg_count(cmd); cp->data_len = 0; use_sg = map_scsi_sg_data(np, cmd); if (use_sg > 0) { struct scatterlist *sg; struct scr_tblmove *data; if (use_sg > MAX_SCATTER) { unmap_scsi_data(np, cmd); return -1; } data = &cp->phys.data[MAX_SCATTER - use_sg]; scsi_for_each_sg(cmd, sg, use_sg, segment) { dma_addr_t baddr = sg_dma_address(sg); unsigned int len = sg_dma_len(sg); ncr_build_sge(np, &data[segment], baddr, len); cp->data_len += len; } } else segment = -2; return segment; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns 0 if access is allowed, error code otherwise */
static int smack_sem_semop(struct sem_array *sma, struct sembuf *sops, unsigned nsops, int alter)
/* Returns 0 if access is allowed, error code otherwise */ static int smack_sem_semop(struct sem_array *sma, struct sembuf *sops, unsigned nsops, int alter)
{ return smk_curacc_sem(sma, MAY_READWRITE); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function builds a HOB for the memory allocation. It can only be invoked during PEI phase; for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. If there is no additional space for HOB creation, then ASSERT(). */
VOID EFIAPI BuildMemoryAllocationHob(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN EFI_MEMORY_TYPE MemoryType)
/* This function builds a HOB for the memory allocation. It can only be invoked during PEI phase; for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. If there is no additional space for HOB creation, then ASSERT(). */ VOID EFIAPI BuildMemoryAllocationHob(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN EFI_MEMORY_TYPE MemoryType)
{ EFI_HOB_MEMORY_ALLOCATION *Hob; ASSERT ( ((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) && ((Length & (EFI_PAGE_SIZE - 1)) == 0) ); Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION)); ASSERT (Hob != NULL); if (Hob == NULL) { return; } ZeroMem (&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID)); Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress; Hob->AllocDescriptor.MemoryLength = Length; Hob->AllocDescriptor.MemoryType = MemoryType; ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Reserved)); }
tianocore/edk2
C++
Other
4,240
/* Registers the event callback functions that should be called by the CAN interface. */
static void IxxatVciRegisterEvents(tCanEvents const *events)
/* Registers the event callback functions that should be called by the CAN interface. */ static void IxxatVciRegisterEvents(tCanEvents const *events)
{ assert(events != NULL); if (events != NULL) { ixxatVciEventsList = realloc(ixxatVciEventsList, (sizeof(tCanEvents) * (ixxatVciEventsEntries + 1))); assert(ixxatVciEventsList != NULL); if (ixxatVciEventsList != NULL) { ixxatVciEventsEntries++; ixxatVciEventsList[ixxatVciEventsEntries - 1] = *events; } else { ixxatVciEventsEntries = 0; } } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Scroll up/down for the number of specified lines. */
void hx8347a_scroll(int32_t ul_lines)
/* Scroll up/down for the number of specified lines. */ void hx8347a_scroll(int32_t ul_lines)
{ hx8347a_write_register(HX8347A_VERTICAL_SCROLL_START_ADDR2, HX8347A_VERTICAL_SCROLL_START_ADDR2_VSP((ul_lines >> 8) & 0xF)); hx8347a_write_register(HX8347A_VERTICAL_SCROLL_START_ADDR1, HX8347A_VERTICAL_SCROLL_START_ADDR1_VSP(ul_lines & 0xF)); }
remotemcu/remcu-chip-sdks
C++
null
436
/* nand_resume - Resume the NAND flash @mtd: MTD device structure */
static void nand_resume(struct mtd_info *mtd)
/* nand_resume - Resume the NAND flash @mtd: MTD device structure */ static void nand_resume(struct mtd_info *mtd)
{ struct nand_chip *chip = mtd->priv; if (chip->state == FL_PM_SUSPENDED) nand_release_device(mtd); else printk(KERN_ERR "nand_resume() called for a chip which is not " "in suspended state\n"); }
EmcraftSystems/u-boot
C++
Other
181
/* Set the timer clock divider, based off of the 18MHz oscillator */
void timer_clock_div(uint8_t div)
/* Set the timer clock divider, based off of the 18MHz oscillator */ void timer_clock_div(uint8_t div)
{ div = (div <= 1) ? 1 : (div & ~0x1); SYSCTL_SYS_CFG_0 = (~TIMER_DIV_MASK & SYSCTL_SYS_CFG_0) | (div << 16); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* cp210x_get_termios Reads the baud rate, data bits, parity, stop bits and flow control mode from the device, corrects any unsupported values, and configures the termios structure to reflect the state of the device */
static void cp210x_get_termios(struct tty_struct *, struct usb_serial_port *port)
/* cp210x_get_termios Reads the baud rate, data bits, parity, stop bits and flow control mode from the device, corrects any unsupported values, and configures the termios structure to reflect the state of the device */ static void cp210x_get_termios(struct tty_struct *, struct usb_serial_port *port)
{ unsigned int baud; if (tty) { cp210x_get_termios_port(tty->driver_data, &tty->termios->c_cflag, &baud); tty_encode_baud_rate(tty, baud, baud); } else { unsigned int cflag; cflag = 0; cp210x_get_termios_port(port, &cflag, &baud); } }
robutest/uclinux
C++
GPL-2.0
60
/* Poll the device for input. This is a non-blocking function. */
static int uart_altera_poll_in(const struct device *dev, unsigned char *p_char)
/* Poll the device for input. This is a non-blocking function. */ static int uart_altera_poll_in(const struct device *dev, unsigned char *p_char)
{ const struct uart_altera_device_config *config = dev->config; struct uart_altera_device_data *data = dev->data; int ret_val = -1; uint32_t status; __ASSERT(p_char != NULL, "p_char is null pointer!"); if (p_char == NULL) { return -EINVAL; } k_spinlock_key_t key = k_spin_lock(&data->lock); status = sys_read32(config->base + ALTERA_AVALON_UART_STATUS_REG_OFFSET); if (status & ALTERA_AVALON_UART_STATUS_RRDY_MSK) { *p_char = sys_read32(config->base + ALTERA_AVALON_UART_RXDATA_REG_OFFSET); ret_val = 0; } k_spin_unlock(&data->lock, key); return ret_val; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Set the startoff field in a bmap extent record. */
void xfs_bmbt_set_startoff(xfs_bmbt_rec_host_t *r, xfs_fileoff_t v)
/* Set the startoff field in a bmap extent record. */ void xfs_bmbt_set_startoff(xfs_bmbt_rec_host_t *r, xfs_fileoff_t v)
{ ASSERT((v & xfs_mask64hi(9)) == 0); r->l0 = (r->l0 & (xfs_bmbt_rec_base_t) xfs_mask64hi(1)) | ((xfs_bmbt_rec_base_t)v << 9) | (r->l0 & (xfs_bmbt_rec_base_t)xfs_mask64lo(9)); }
robutest/uclinux
C++
GPL-2.0
60
/* Check if the RTOS kernel is already started. */
int32_t osKernelRunning(void)
/* Check if the RTOS kernel is already started. */ int32_t osKernelRunning(void)
{ return os_running; } else { return __svcKernelRunning(); } }
ajhc/demo-cortex-m3
C++
null
38
/* This function is called in the SLI initialization code path to restart a SLI4 HBA. The caller is not required to hold any lock. At the end of the function, it calls lpfc_hba_down_post function to free any pending commands. */
static int lpfc_sli_brdrestart_s4(struct lpfc_hba *phba)
/* This function is called in the SLI initialization code path to restart a SLI4 HBA. The caller is not required to hold any lock. At the end of the function, it calls lpfc_hba_down_post function to free any pending commands. */ static int lpfc_sli_brdrestart_s4(struct lpfc_hba *phba)
{ struct lpfc_sli *psli = &phba->sli; lpfc_printf_log(phba, KERN_INFO, LOG_SLI, "0296 Restart HBA Data: x%x x%x\n", phba->pport->port_state, psli->sli_flag); lpfc_sli4_brdreset(phba); spin_lock_irq(&phba->hbalock); phba->pport->stopped = 0; phba->link_state = LPFC_INIT_START; phba->hba_flag = 0; spin_unlock_irq(&phba->hbalock); memset(&psli->lnk_stat_offsets, 0, sizeof(psli->lnk_stat_offsets)); psli->stats_start = get_seconds(); lpfc_hba_down_post(phba); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Allocates pages that are suitable for an EfiUfsHcOperationBusMasterCommonBuffer mapping. */
EFI_STATUS EFIAPI UfsHcAllocateBuffer(IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, OUT VOID **HostAddress, IN UINT64 Attributes)
/* Allocates pages that are suitable for an EfiUfsHcOperationBusMasterCommonBuffer mapping. */ EFI_STATUS EFIAPI UfsHcAllocateBuffer(IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, OUT VOID **HostAddress, IN UINT64 Attributes)
{ UFS_HOST_CONTROLLER_PRIVATE_DATA *Private; EFI_PCI_IO_PROTOCOL *PciIo; EFI_STATUS Status; if ((This == NULL) || (HostAddress == NULL)) { return EFI_INVALID_PARAMETER; } Private = UFS_HOST_CONTROLLER_PRIVATE_DATA_FROM_UFSHC (This); PciIo = Private->PciIo; Status = PciIo->AllocateBuffer (PciIo, Type, MemoryType, Pages, HostAddress, Attributes); return Status; }
tianocore/edk2
C++
Other
4,240
/* Create performance record with event description and a timestamp. */
RETURN_STATUS EFIAPI LogPerformanceMeasurement(IN CONST VOID *CallerIdentifier, IN CONST VOID *Guid OPTIONAL, IN CONST CHAR8 *String OPTIONAL, IN UINT64 Address OPTIONAL, IN UINT32 Identifier)
/* Create performance record with event description and a timestamp. */ RETURN_STATUS EFIAPI LogPerformanceMeasurement(IN CONST VOID *CallerIdentifier, IN CONST VOID *Guid OPTIONAL, IN CONST CHAR8 *String OPTIONAL, IN UINT64 Address OPTIONAL, IN UINT32 Identifier)
{ return (RETURN_STATUS)InsertFpdtRecord (CallerIdentifier, Guid, String, 0, Address, (UINT16)Identifier, PerfEntry); }
tianocore/edk2
C++
Other
4,240
/* Called when an internally generated command times out */
static void ibmvscsi_timeout(struct srp_event_struct *evt_struct)
/* Called when an internally generated command times out */ static void ibmvscsi_timeout(struct srp_event_struct *evt_struct)
{ struct ibmvscsi_host_data *hostdata = evt_struct->hostdata; dev_err(hostdata->dev, "Command timed out (%x). Resetting connection\n", evt_struct->iu.srp.cmd.opcode); ibmvscsi_reset_host(hostdata); }
robutest/uclinux
C++
GPL-2.0
60
/* This function divides the 64-bit unsigned value Dividend by the 32-bit unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder is not NULL, then the 32-bit unsigned remainder is returned in Remainder. This function returns the 64-bit unsigned quotient. */
UINT64 EFIAPI InternalMathDivRemU64x32(IN UINT64 Dividend, IN UINT32 Divisor, OUT UINT32 *Remainder OPTIONAL)
/* This function divides the 64-bit unsigned value Dividend by the 32-bit unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder is not NULL, then the 32-bit unsigned remainder is returned in Remainder. This function returns the 64-bit unsigned quotient. */ UINT64 EFIAPI InternalMathDivRemU64x32(IN UINT64 Dividend, IN UINT32 Divisor, OUT UINT32 *Remainder OPTIONAL)
{ if (Remainder != NULL) { *Remainder = (UINT32)(Dividend % Divisor); } return Dividend / Divisor; }
tianocore/edk2
C++
Other
4,240
/* Allocate dmareq0 to the current channel unless it's already taken */
static int tusb_omap_use_shared_dmareq(struct tusb_omap_dma_ch *chdat)
/* Allocate dmareq0 to the current channel unless it's already taken */ static int tusb_omap_use_shared_dmareq(struct tusb_omap_dma_ch *chdat)
{ u32 reg = musb_readl(chdat->tbase, TUSB_DMA_EP_MAP); if (reg != 0) { DBG(3, "ep%i dmareq0 is busy for ep%i\n", chdat->epnum, reg & 0xf); return -EAGAIN; } if (chdat->tx) reg = (1 << 4) | chdat->epnum; else reg = chdat->epnum; musb_writel(chdat->tbase, TUSB_DMA_EP_MAP, reg); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* converts an integer to a "floating point byte", represented as (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if eeeee != 0 and (xxx) otherwise. */
int luaO_int2fb(unsigned int x)
/* converts an integer to a "floating point byte", represented as (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if eeeee != 0 and (xxx) otherwise. */ int luaO_int2fb(unsigned int x)
{ x = (x + 0xf) >> 4; e += 4; } while (x >= (8 << 1)) { x = (x + 1) >> 1; e++; } return ((e+1) << 3) | (cast_int(x) - 8); }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Finalize MTO initialized by sclp_initialize_mto(), updating the sizes of MTO, enclosing MDB, event buffer and SCCB. */
static void sclp_finalize_mto(struct sclp_buffer *buffer)
/* Finalize MTO initialized by sclp_initialize_mto(), updating the sizes of MTO, enclosing MDB, event buffer and SCCB. */ static void sclp_finalize_mto(struct sclp_buffer *buffer)
{ struct write_sccb *sccb; struct mto *mto; int str_len, mto_size; str_len = buffer->current_length; buffer->current_line = NULL; buffer->current_length = 0; mto_size = sizeof(struct mto) + str_len; sccb = buffer->sccb; mto = (struct mto *)(((addr_t) sccb) + sccb->header.length); mto->length = mto_size; sccb->header.length += mto_size; sccb->msg_buf.header.length += mto_size; sccb->msg_buf.mdb.header.length += mto_size; buffer->mto_number++; buffer->mto_char_sum += str_len; }
robutest/uclinux
C++
GPL-2.0
60
/* Optimised routine to draw a vertical line faster than setting individual pixels. */
void lcdDrawVLine(uint16_t x, uint16_t y0, uint16_t y1, uint16_t color)
/* Optimised routine to draw a vertical line faster than setting individual pixels. */ void lcdDrawVLine(uint16_t x, uint16_t y0, uint16_t y1, uint16_t color)
{ ssd1331DrawLine((uint8_t)x, (uint8_t)y0, (uint8_t)x, (uint8_t)y1, color); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Reads the state of the SDA and SCL pins. */
uint32_t I2CMasterLineStateGet(uint32_t ui32Base)
/* Reads the state of the SDA and SCL pins. */ uint32_t I2CMasterLineStateGet(uint32_t ui32Base)
{ ASSERT(_I2CBaseValid(ui32Base)); return(HWREG(ui32Base + I2C_O_MBMON)); }
micropython/micropython
C++
Other
18,334
/* USART Set Hardware Flow Control. The flow control bit can be selected as none, RTS, CTS or RTS+CTS. */
void usart_set_flow_control(uint32_t usart, uint32_t flowctrl)
/* USART Set Hardware Flow Control. The flow control bit can be selected as none, RTS, CTS or RTS+CTS. */ void usart_set_flow_control(uint32_t usart, uint32_t flowctrl)
{ USART_CR3(usart) = (USART_CR3(usart) & ~USART_FLOWCONTROL) | flowctrl; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* The Dma Control register is programmed with the value given. The bits to be set are bit wise or'ed and sent as the second argument to this function. */
s32 synopGMAC_dma_control_init(synopGMACdevice *gmacdev, u32 init_value)
/* The Dma Control register is programmed with the value given. The bits to be set are bit wise or'ed and sent as the second argument to this function. */ s32 synopGMAC_dma_control_init(synopGMACdevice *gmacdev, u32 init_value)
{ synopGMACWriteReg(gmacdev -> DmaBase, DmaControl, init_value); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The idle thread. There's no useful work to be done, so just try to conserve power and have a low exit latency (ie sit in a loop waiting for somebody to say that they'd like to reschedule) */
void __noreturn cpu_idle(void)
/* The idle thread. There's no useful work to be done, so just try to conserve power and have a low exit latency (ie sit in a loop waiting for somebody to say that they'd like to reschedule) */ void __noreturn cpu_idle(void)
{ while (1) { while (!need_resched()) barrier(); preempt_enable_no_resched(); schedule(); preempt_disable(); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Implemented here due to commonality of the object. */
bool_t xdr_netobj(XDR *xdrs, struct netobj *np)
/* Implemented here due to commonality of the object. */ bool_t xdr_netobj(XDR *xdrs, struct netobj *np)
{ return (xdr_bytes(xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ)); }
pikasTech/PikaPython
C++
MIT License
1,403
/* general configuration to ETM_No to start software synchronization. @无返回 */
void ETM_PWMDeadETMeSet(ETM_Type *pETM, uint8_t u8PrescalerValue, uint8_t u8DeadETMeValue)
/* general configuration to ETM_No to start software synchronization. @无返回 */ void ETM_PWMDeadETMeSet(ETM_Type *pETM, uint8_t u8PrescalerValue, uint8_t u8DeadETMeValue)
{ ASSERT(ETM2 == pETM); pETM->COMBINE |= 0x101010; if(!(pETM->MODE & ETM_MODE_WPDIS_MASK)) { pETM->MODE |= ETM_MODE_WPDIS_MASK; pETM->DEADETME = (ETM_DEADETME_DTVAL(u8DeadETMeValue & 0x3F) | ETM_DEADETME_DTPS(u8PrescalerValue & 0x3)); pETM->MODE &= ~ETM_MODE_WPDIS_MASK; } else { pETM->DEADETME = (ETM_DEADETME_DTVAL(u8DeadETMeValue & 0x3F) | ETM_DEADETME_DTPS(u8PrescalerValue & 0x3)); } pETM->SYNC |= ETM_SYNC_SWSYNC_MASK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* returns: the phandle pointed by the target property 0, if the phandle was not found -1, if the phandle was malformed */
static uint32_t overlay_get_target_phandle(const void *fdto, int fragment)
/* returns: the phandle pointed by the target property 0, if the phandle was not found -1, if the phandle was malformed */ static uint32_t overlay_get_target_phandle(const void *fdto, int fragment)
{ const fdt32_t *val; int len; val = fdt_getprop(fdto, fragment, "target", &len); if (!val) return 0; if ((len != sizeof(*val)) || (fdt32_to_cpu(*val) == (uint32_t)-1)) return (uint32_t)-1; return fdt32_to_cpu(*val); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Are any of the nodes in the nodemask allowed in current->mems_allowed? */
int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
/* Are any of the nodes in the nodemask allowed in current->mems_allowed? */ int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
{ return nodes_intersects(*nodemask, current->mems_allowed); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return value: Number of bytes of IO data the driver will need to perform well. */
static unsigned long ibmvscsi_get_desired_dma(struct vio_dev *vdev)
/* Return value: Number of bytes of IO data the driver will need to perform well. */ static unsigned long ibmvscsi_get_desired_dma(struct vio_dev *vdev)
{ unsigned long desired_io = max_events * sizeof(union viosrp_iu); desired_io += (IBMVSCSI_MAX_SECTORS_DEFAULT * 512 * IBMVSCSI_CMDS_PER_LUN_DEFAULT); return desired_io; }
robutest/uclinux
C++
GPL-2.0
60
/* This function handles I2C Communication timeout for specific usage of TXE flag. */
static ald_status_t i2c_wait_txe_to_timeout(ald_i2c_handle_t *hperh, uint32_t timeout)
/* This function handles I2C Communication timeout for specific usage of TXE flag. */ static ald_status_t i2c_wait_txe_to_timeout(ald_i2c_handle_t *hperh, uint32_t timeout)
{ uint32_t tickstart = ald_get_tick(); while (ALD_I2C_GET_FLAG(hperh, ALD_I2C_STAT_TXE) == RESET) { if (ALD_I2C_GET_IT_FLAG(hperh, ALD_I2C_IT_ARLO)) { hperh->error_code |= ALD_I2C_ERROR_ARLO; return ALD_ERROR; } if (ALD_I2C_GET_IT_FLAG(hperh, ALD_I2C_IT_NACK) == SET) { hperh->error_code |= ALD_I2C_ERROR_AF; return ALD_ERROR; } if ((timeout == 0) || ((ald_get_tick() - tickstart) > timeout)) { hperh->error_code |= ALD_I2C_ERROR_TIMEOUT; return ALD_ERROR; } } return ALD_OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Internal function to add Save jmp address according to DISPATCH_OPCODE. We ignore "Context" parameter */
EFI_STATUS BootScriptWriteDispatch(IN VA_LIST Marker)
/* Internal function to add Save jmp address according to DISPATCH_OPCODE. We ignore "Context" parameter */ EFI_STATUS BootScriptWriteDispatch(IN VA_LIST Marker)
{ VOID *EntryPoint; EntryPoint = (VOID *)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS); return S3BootScriptSaveDispatch (EntryPoint); }
tianocore/edk2
C++
Other
4,240
/* the minimum size is snd_minimum_buffer. it should be power of 2. */
static int preallocate_pcm_pages(struct snd_pcm_substream *substream, size_t size)
/* the minimum size is snd_minimum_buffer. it should be power of 2. */ static int preallocate_pcm_pages(struct snd_pcm_substream *substream, size_t size)
{ struct snd_dma_buffer *dmab = &substream->dma_buffer; int err; if (snd_dma_get_reserved_buf(dmab, substream->dma_buf_id) > 0) { if (dmab->bytes >= size) return 0; snd_dma_free_pages(dmab); dmab->bytes = 0; } do { if ((err = snd_dma_alloc_pages(dmab->dev.type, dmab->dev.dev, size, dmab)) < 0) { if (err != -ENOMEM) return err; } else return 0; size >>= 1; } while (size >= snd_minimum_buffer); dmab->bytes = 0; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Release a handle to a cache entry. When the last handle to a cache entry is released it is either freed (if it is invalid) or otherwise inserted in to the lru list. */
void mb_cache_entry_release(struct mb_cache_entry *ce)
/* Release a handle to a cache entry. When the last handle to a cache entry is released it is either freed (if it is invalid) or otherwise inserted in to the lru list. */ void mb_cache_entry_release(struct mb_cache_entry *ce)
{ spin_lock(&mb_cache_spinlock); __mb_cache_entry_release_unlock(ce); }
robutest/uclinux
C++
GPL-2.0
60
/* MSS_GPIO_enable_irq See "mss_gpio.h" for details of how to use this function. */
void MSS_GPIO_enable_irq(mss_gpio_id_t port_id)
/* MSS_GPIO_enable_irq See "mss_gpio.h" for details of how to use this function. */ void MSS_GPIO_enable_irq(mss_gpio_id_t port_id)
{ uint32_t cfg_value; uint32_t gpio_idx = (uint32_t)port_id; ASSERT(gpio_idx < NB_OF_GPIO); if(gpio_idx < NB_OF_GPIO) { cfg_value = *(g_config_reg_lut[gpio_idx]); *(g_config_reg_lut[gpio_idx]) = (cfg_value | GPIO_INT_ENABLE_MASK); NVIC_EnableIRQ(g_gpio_irqn_lut[gpio_idx]); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads a block of data from the EEPROM. */
uint32_t sEE_ReadBuffer(uint8_t *pBuffer, uint16_t ReadAddr, uint16_t *NumByteToRead)
/* Reads a block of data from the EEPROM. */ uint32_t sEE_ReadBuffer(uint8_t *pBuffer, uint16_t ReadAddr, uint16_t *NumByteToRead)
{ sEE_CS_LOW(); sEE_SendByte(sEE_CMD_READ); sEE_SendByte((ReadAddr & 0xFF0000) >> 16); sEE_SendByte((ReadAddr & 0xFF00) >> 8); sEE_SendByte(ReadAddr & 0xFF); while ((*NumByteToRead)--) { *pBuffer = sEE_SendByte(sEE_DUMMY_BYTE); pBuffer++; } sEE_CS_HIGH(); return 0; }
avem-labs/Avem
C++
MIT License
1,752
/* Function for calling the handler of module events. */
static void ant_encrypt_user_handler_try_to_run(uint8_t ant_channel, ant_encrypt_user_evt_t event)
/* Function for calling the handler of module events. */ static void ant_encrypt_user_handler_try_to_run(uint8_t ant_channel, ant_encrypt_user_evt_t event)
{ if (m_ant_enc_evt_handler != NULL) { m_ant_enc_evt_handler(ant_channel, event); } }
labapart/polymcu
C++
null
201
/* platform_end - tell the platform driver that we've entered the working state */
static void platform_end(int platform_mode)
/* platform_end - tell the platform driver that we've entered the working state */ static void platform_end(int platform_mode)
{ if (platform_mode && hibernation_ops) hibernation_ops->end(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function reads back parameters of the flash as reported by the EC */
int cros_ec_read_flashinfo(struct udevice *dev, struct ec_response_flash_info *info)
/* This function reads back parameters of the flash as reported by the EC */ int cros_ec_read_flashinfo(struct udevice *dev, struct ec_response_flash_info *info)
{ int ret; ret = ec_command(dev, EC_CMD_FLASH_INFO, 0, NULL, 0, info, sizeof(*info)); if (ret < 0) return ret; return ret < sizeof(*info) ? -1 : 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* lis2dw12_set_odr - set new sampling frequency @dev: Pointer to instance of struct device (I2C or SPI) @odr: Output data rate */
static int lis2dw12_set_odr(const struct device *dev, uint16_t odr)
/* lis2dw12_set_odr - set new sampling frequency @dev: Pointer to instance of struct device (I2C or SPI) @odr: Output data rate */ static int lis2dw12_set_odr(const struct device *dev, uint16_t odr)
{ const struct lis2dw12_device_config *cfg = dev->config; stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx; struct lis2dw12_data *lis2dw12 = dev->data; uint8_t val; if (odr == 0U) { return lis2dw12_data_rate_set(ctx, LIS2DW12_XL_ODR_OFF); } val = LIS2DW12_ODR_TO_REG(odr); if (val > LIS2DW12_XL_ODR_1k6Hz) { LOG_ERR("ODR too high"); return -ENOTSUP; } lis2dw12->odr = odr; return lis2dw12_data_rate_set(ctx, val); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* All directory operations under NFS are synchronous, so fsync() is a dummy operation. */
static int nfs_fsync_dir(struct file *, struct dentry *, int)
/* All directory operations under NFS are synchronous, so fsync() is a dummy operation. */ static int nfs_fsync_dir(struct file *, struct dentry *, int)
{ dfprintk(FILE, "NFS: fsync dir(%s/%s) datasync %d\n", dentry->d_parent->d_name.name, dentry->d_name.name, datasync); nfs_inc_stats(dentry->d_inode, NFSIOS_VFSFSYNC); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Internal worker function that moves the specified periodic SMI handler from the list of managed periodic SMI handlers to the list of free periodic SMI handlers. */
VOID ReclaimPeriodicSmiLibraryHandler(PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler)
/* Internal worker function that moves the specified periodic SMI handler from the list of managed periodic SMI handlers to the list of free periodic SMI handlers. */ VOID ReclaimPeriodicSmiLibraryHandler(PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler)
{ ASSERT (PeriodicSmiLibraryHandler->DispatchHandle == NULL); if (PeriodicSmiLibraryHandler->Stack != NULL) { FreePages ( PeriodicSmiLibraryHandler->Stack, EFI_SIZE_TO_PAGES (PeriodicSmiLibraryHandler->StackSize) ); PeriodicSmiLibraryHandler->Stack = NULL; } RemoveEntryList (&PeriodicSmiLibraryHandler->Link); InsertHeadList (&gFreePeriodicSmiLibraryHandlers, &PeriodicSmiLibraryHandler->Link); }
tianocore/edk2
C++
Other
4,240
/* Called by the usb core when the device is removed from the system. */
static void usb_tranzport_disconnect(struct usb_interface *intf)
/* Called by the usb core when the device is removed from the system. */ static void usb_tranzport_disconnect(struct usb_interface *intf)
{ struct usb_tranzport *dev; int minor; mutex_lock(&disconnect_mutex); dev = usb_get_intfdata(intf); usb_set_intfdata(intf, NULL); down(&dev->sem); minor = intf->minor; usb_deregister_dev(intf, &usb_tranzport_class); if (!dev->open_count) { up(&dev->sem); usb_tranzport_delete(dev); } else { dev->intf = NULL; up(&dev->sem); } mutex_unlock(&disconnect_mutex); dev_info(&intf->dev, "Tranzport Surface #%d now disconnected\n", (minor - USB_TRANZPORT_MINOR_BASE)); }
robutest/uclinux
C++
GPL-2.0
60
/* transfer the pending playback buffer data to DSP called from interrupt handler */
static void vx_pcm_playback_transfer(struct vx_core *chip, struct snd_pcm_substream *subs, struct vx_pipe *pipe, int nchunks)
/* transfer the pending playback buffer data to DSP called from interrupt handler */ static void vx_pcm_playback_transfer(struct vx_core *chip, struct snd_pcm_substream *subs, struct vx_pipe *pipe, int nchunks)
{ int i, err; struct snd_pcm_runtime *runtime = subs->runtime; if (! pipe->prepared || (chip->chip_status & VX_STAT_IS_STALE)) return; for (i = 0; i < nchunks; i++) { if ((err = vx_pcm_playback_transfer_chunk(chip, runtime, pipe, chip->ibl.size)) < 0) return; } }
robutest/uclinux
C++
GPL-2.0
60
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI MmcGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */ EFI_STATUS EFIAPI MmcGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mMmcDriverNameTable, DriverName, (BOOLEAN)(This == &gMmcComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* Stops a timer and resets its value back to zero. Valid values for ui32TimerSegment are: */
void am_hal_ctimer_clear(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment)
/* Stops a timer and resets its value back to zero. Valid values for ui32TimerSegment are: */ void am_hal_ctimer_clear(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment)
{ volatile uint32_t *pui32ConfigReg; pui32ConfigReg = (uint32_t *)(AM_REG_CTIMERn(0) + AM_REG_CTIMER_CTRL0_O + (ui32TimerNumber * TIMER_OFFSET)); AM_CRITICAL_BEGIN_ASM AM_REGVAL(pui32ConfigReg) |= (ui32TimerSegment & (AM_REG_CTIMER_CTRL0_TMRA0CLR_M | AM_REG_CTIMER_CTRL0_TMRB0CLR_M)); AM_CRITICAL_END_ASM }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* It needs to be called at the beginning of each independent compression stream (i.e., at the beginning of a frame in blockLinked mode, or at the beginning of each block in blockIndependent mode). */
static void LZ4F_initStream(void *ctx, const LZ4F_CDict *cdict, int level, LZ4F_blockMode_t blockMode)
/* It needs to be called at the beginning of each independent compression stream (i.e., at the beginning of a frame in blockLinked mode, or at the beginning of each block in blockIndependent mode). */ static void LZ4F_initStream(void *ctx, const LZ4F_CDict *cdict, int level, LZ4F_blockMode_t blockMode)
{ if (level < LZ4HC_CLEVEL_MIN) { if (cdict != NULL || blockMode == LZ4F_blockLinked) { LZ4_resetStream_fast((LZ4_stream_t*)ctx); } LZ4_attach_dictionary((LZ4_stream_t *)ctx, cdict ? cdict->fastCtx : NULL); } else { LZ4_resetStreamHC_fast((LZ4_streamHC_t*)ctx, level); LZ4_attach_HC_dictionary((LZ4_streamHC_t *)ctx, cdict ? cdict->HCCtx : NULL); } }
xboot/xboot
C++
MIT License
779
/* PMON is a fragile beast. It'll blow up once the mappings it's littering right into the middle of KSEG3 are blown away so we have to grab the slave core early and keep it in a waiting loop. */
void __init prom_grab_secondary(void)
/* PMON is a fragile beast. It'll blow up once the mappings it's littering right into the middle of KSEG3 are blown away so we have to grab the slave core early and keep it in a waiting loop. */ void __init prom_grab_secondary(void)
{ spin_lock(&launch_lock); pmon_cpustart(1, &prom_smp_bootstrap, launchstack + LAUNCHSTACK_SIZE, 0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Tracking Area Code Octets 3 to 5 contain the value part (starting with octet 2) of the TAC IE defined in 3GPP TS 24.301. Redirect Attempt Flag */
static guint16 de_bssgp_redir_attempt_flg(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
/* Tracking Area Code Octets 3 to 5 contain the value part (starting with octet 2) of the TAC IE defined in 3GPP TS 24.301. Redirect Attempt Flag */ static guint16 de_bssgp_redir_attempt_flg(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
{ guint32 curr_offset; curr_offset = offset; proto_tree_add_item(tree, hf_bssgp_spare, tvb, curr_offset, 1, ENC_NA); curr_offset += 1; return(curr_offset-offset); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This is called when we receive an interrupt with apparently comes from this chip - check, returning the highest interrupt generated or return NO_IRQ */
unsigned int gef_pic_get_irq(void)
/* This is called when we receive an interrupt with apparently comes from this chip - check, returning the highest interrupt generated or return NO_IRQ */ unsigned int gef_pic_get_irq(void)
{ u32 cause, mask, active; unsigned int virq = NO_IRQ; int hwirq; cause = in_be32(gef_pic_irq_reg_base + GEF_PIC_INTR_STATUS); mask = in_be32(gef_pic_irq_reg_base + GEF_PIC_INTR_MASK(0)); active = cause & mask; if (active) { for (hwirq = GEF_PIC_NUM_IRQS - 1; hwirq > -1; hwirq--) { if (active & (0x1 << hwirq)) break; } virq = irq_linear_revmap(gef_pic_irq_host, (irq_hw_number_t)hwirq); } return virq; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Callback to update volatile variable used by pooling. */
static void uhi_msc_mem_stop_pooling(bool b_success)
/* Callback to update volatile variable used by pooling. */ static void uhi_msc_mem_stop_pooling(bool b_success)
{ uhi_msc_mem_command_ongoing = false; uhi_msc_mem_command_status = b_success; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Event handler for the library USB Configuration Changed event. */
void EVENT_USB_Device_ConfigurationChanged(void)
/* Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void)
{ bool ConfigSuccess = true; ConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface); LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* This function frees all resources for volume @vol but does not remove it. Used only when the UBI device is detached. */
void ubi_free_volume(struct ubi_device *ubi, struct ubi_volume *vol)
/* This function frees all resources for volume @vol but does not remove it. Used only when the UBI device is detached. */ void ubi_free_volume(struct ubi_device *ubi, struct ubi_volume *vol)
{ dbg_gen("free volume %d", vol->vol_id); ubi->volumes[vol->vol_id] = NULL; cdev_del(&vol->cdev); volume_sysfs_close(vol); }
robutest/uclinux
C++
GPL-2.0
60
/* DMA Stream Set DMA Flow Control. Ensure that the stream is disabled otherwise the setting will not be changed. */
void dma_set_dma_flow_control(uint32_t dma, uint8_t stream)
/* DMA Stream Set DMA Flow Control. Ensure that the stream is disabled otherwise the setting will not be changed. */ void dma_set_dma_flow_control(uint32_t dma, uint8_t stream)
{ DMA_SCR(dma, stream) &= ~DMA_SxCR_PFCTRL; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Get the SPI interrupt flag of the specified SPI port. */
unsigned long SPIIntFlagGet(unsigned long ulBase, xtBoolean xbMasked)
/* Get the SPI interrupt flag of the specified SPI port. */ unsigned long SPIIntFlagGet(unsigned long ulBase, xtBoolean xbMasked)
{ unsigned long ulFlag, ulFlag1; xASSERT(ulBase == SPI0_BASE); xASSERT(xbMasked == xfalse); ulFlag = xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_IF; ulFlag1 = xHWREG(ulBase + SPI_CNTRL2) & SPI_CNTRL2_SLV_START_INTSTS; if(ulFlag != 0) { return SPI_CNTRL_IF; } else if(ulFlag1 != 0) { return SPI_CNTRL2_SLV_START_INTSTS; } else { return 0; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* We fill out the fields in the waiter to store the information about the deadlock. We print when we return. act_waiter can be NULL in case of a remove waiter operation. */
void debug_rt_mutex_deadlock(int detect, struct rt_mutex_waiter *act_waiter, struct rt_mutex *lock)
/* We fill out the fields in the waiter to store the information about the deadlock. We print when we return. act_waiter can be NULL in case of a remove waiter operation. */ void debug_rt_mutex_deadlock(int detect, struct rt_mutex_waiter *act_waiter, struct rt_mutex *lock)
{ struct task_struct *task; if (!rt_trace_on || detect || !act_waiter) return; task = rt_mutex_owner(act_waiter->lock); if (task && task != current) { act_waiter->deadlock_task_pid = get_pid(task_pid(task)); act_waiter->deadlock_lock = lock; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Parse out a DHCPv6 option by OptTag, and find the position in buffer. */
EFI_DHCP6_PACKET_OPTION* HttpBootParseDhcp6Options(IN UINT8 *Buffer, IN UINT32 Length, IN UINT16 OptTag)
/* Parse out a DHCPv6 option by OptTag, and find the position in buffer. */ EFI_DHCP6_PACKET_OPTION* HttpBootParseDhcp6Options(IN UINT8 *Buffer, IN UINT32 Length, IN UINT16 OptTag)
{ EFI_DHCP6_PACKET_OPTION *Option; UINT32 Offset; Option = (EFI_DHCP6_PACKET_OPTION *)Buffer; Offset = 0; while (Offset < Length) { if (NTOHS (Option->OpCode) == OptTag) { return Option; } Offset += (NTOHS (Option->OpLen) + 4); Option = (EFI_DHCP6_PACKET_OPTION *)(Buffer + Offset); } return NULL; }
tianocore/edk2
C++
Other
4,240
/* Write one byte to 93LC46A in the specific address. */
void eep_93LC46A_Write(const char data, char addr)
/* Write one byte to 93LC46A in the specific address. */ void eep_93LC46A_Write(const char data, char addr)
{ xGPIOPinWrite(_93LC46A_PIN_PORT, _93LC46A_PIN_SEL, 1); delay(DELAY_TIME_1); unsigned int op; if(addr != (char)-1) op = ((_93LC46A_Write | addr)<<8) | data; else op = (_93LC46A_WriteAll<<8) | data; int i; char byte; for(i=2; i>=0; i--) { byte = op>>(i*8) & 0xff; eep_93LC46A_WriteByte(byte); } xGPIOPinWrite(_93LC46A_PIN_PORT, _93LC46A_PIN_SEL, 0); delay(DELAY_TIME_1); eep_93LC46A_WaitForWriteEnd(); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* function to determine if FullPath is under current filesystem. */
BOOLEAN IsCurrentFileSystem(IN CONST CHAR16 *FullPath, IN CONST CHAR16 *Cwd)
/* function to determine if FullPath is under current filesystem. */ BOOLEAN IsCurrentFileSystem(IN CONST CHAR16 *FullPath, IN CONST CHAR16 *Cwd)
{ CHAR16 *Splitter1; CHAR16 *Splitter2; Splitter1 = NULL; Splitter2 = NULL; ASSERT (FullPath != NULL); Splitter1 = StrStr (FullPath, L":"); if (Splitter1 == NULL) { return TRUE; } Splitter2 = StrStr (Cwd, L":"); if (((UINTN)Splitter1 - (UINTN)FullPath) != ((UINTN)Splitter2 - (UINTN)Cwd)) { return FALSE; } else { if (StrniCmp (FullPath, Cwd, ((UINTN)Splitter1 - (UINTN)FullPath) / sizeof (CHAR16)) == 0) { return TRUE; } else { return FALSE; } } }
tianocore/edk2
C++
Other
4,240
/* Определение типа для списка, используется SLIST из библиотеки newlib */
typedef SLIST_HEAD(TrashItemList, TrashItem)
/* Определение типа для списка, используется SLIST из библиотеки newlib */ typedef SLIST_HEAD(TrashItemList, TrashItem)
{ switch(action) { case EVENT_ACTION_RENDER: GUI_ScreenDoUpdate(GUI_GetScreen(), 0); break; case EVENT_ACTION_UPDATE: { App_t *app = GetCurApp(); if(app != NULL && app->body != NULL) { GUI_WidgetMarkChanged(app->body); } break; } default: break; } }
DC-SWAT/DreamShell
C++
null
404
/* Generate indication for 'Value V6' attribute, if indications are enabled. */
void service_b_3_2_value_v6_indicate(void)
/* Generate indication for 'Value V6' attribute, if indications are enabled. */ void service_b_3_2_value_v6_indicate(void)
{ if (!value_v6_ind_active) return; ind_params.attr = &service_b_3_2_attrs[2]; ind_params.func = value_v6_indicate_cb; ind_params.destroy = NULL; ind_params.data = &value_v6_value; ind_params.len = sizeof(value_v6_value); bt_gatt_indicate(NULL, &ind_params); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* The URB is returned to the USB subsystem. */
void qset_remove_urb(struct whc *whc, struct whc_qset *qset, struct urb *urb, int status)
/* The URB is returned to the USB subsystem. */ void qset_remove_urb(struct whc *whc, struct whc_qset *qset, struct urb *urb, int status)
{ struct wusbhc *wusbhc = &whc->wusbhc; struct whc_urb *wurb = urb->hcpriv; usb_hcd_unlink_urb_from_ep(&wusbhc->usb_hcd, urb); spin_unlock(&whc->lock); wusbhc_giveback_urb(wusbhc, urb, status); spin_lock(&whc->lock); kfree(wurb); }
robutest/uclinux
C++
GPL-2.0
60
/* copy from ds while checksumming, otherwise like csum_partial */
__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
/* copy from ds while checksumming, otherwise like csum_partial */ __wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
{ memcpy(dst, src, len); return csum_partial(dst, len, sum); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check if the Trb is a transaction of the URB. */
BOOLEAN XhcPeiIsTransferRingTrb(IN TRB_TEMPLATE *Trb, IN URB *Urb)
/* Check if the Trb is a transaction of the URB. */ BOOLEAN XhcPeiIsTransferRingTrb(IN TRB_TEMPLATE *Trb, IN URB *Urb)
{ TRB_TEMPLATE *CheckedTrb; UINTN Index; CheckedTrb = Urb->Ring->RingSeg0; ASSERT (Urb->Ring->TrbNumber == CMD_RING_TRB_NUMBER || Urb->Ring->TrbNumber == TR_RING_TRB_NUMBER); for (Index = 0; Index < Urb->Ring->TrbNumber; Index++) { if (Trb == CheckedTrb) { return TRUE; } CheckedTrb++; } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* Returns: a #GFileAttributeType for the given @attribute, or G_FILE_ATTRIBUTE_TYPE_INVALID if the key is not set. */
GFileAttributeType g_file_info_get_attribute_type(GFileInfo *info, const char *attribute)
/* Returns: a #GFileAttributeType for the given @attribute, or G_FILE_ATTRIBUTE_TYPE_INVALID if the key is not set. */ GFileAttributeType g_file_info_get_attribute_type(GFileInfo *info, const char *attribute)
{ GFileAttributeValue *value; g_return_val_if_fail (G_IS_FILE_INFO (info), G_FILE_ATTRIBUTE_TYPE_INVALID); g_return_val_if_fail (attribute != NULL && *attribute != '\0', G_FILE_ATTRIBUTE_TYPE_INVALID); value = g_file_info_find_value_by_name (info, attribute); if (value) return value->type; else return G_FILE_ATTRIBUTE_TYPE_INVALID; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* A recording surface can be "replayed" against any target surface, after which the results in target will be identical to the results that would have been obtained if the original operations applied to the recording surface had instead been applied to the target surface. */
cairo_status_t _cairo_recording_surface_replay(cairo_surface_t *surface, cairo_surface_t *target)
/* A recording surface can be "replayed" against any target surface, after which the results in target will be identical to the results that would have been obtained if the original operations applied to the recording surface had instead been applied to the target surface. */ cairo_status_t _cairo_recording_surface_replay(cairo_surface_t *surface, cairo_surface_t *target)
{ return _cairo_recording_surface_replay_internal ((cairo_recording_surface_t *) surface, NULL, NULL, target, NULL, FALSE, CAIRO_RECORDING_REPLAY, CAIRO_RECORDING_REGION_ALL); }
xboot/xboot
C++
MIT License
779
/* Set the clock rate of the specified I2C port. The */
void xI2CMasterInit(unsigned long ulBase, unsigned long ulI2CClk)
/* Set the clock rate of the specified I2C port. The */ void xI2CMasterInit(unsigned long ulBase, unsigned long ulI2CClk)
{ unsigned long ulHclk; unsigned long ulDiv; xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE)); switch(ulBase) { case I2C0_BASE: xSysCtlPeripheralReset(xSYSCTL_PERIPH_I2C0); break; case I2C1_BASE: xSysCtlPeripheralReset(xSYSCTL_PERIPH_I2C1); break; default: break; } ulHclk = xSysCtlClockGet(); ulDiv = (unsigned long) (((ulHclk * 10)/(ulI2CClk * 4) + 5) / 10 - 1); xHWREG(ulBase + I2C_CLKDIV) = ulDiv; xHWREG(ulBase + I2C_CON) = 0; xHWREG(ulBase + I2C_CON) = I2C_CON_ENS1; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Call memcmp after checking if enough chars left, returning 0 if it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1. */
gint tvb_memeql(tvbuff_t *tvb, const gint offset, const guint8 *str, size_t size)
/* Call memcmp after checking if enough chars left, returning 0 if it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1. */ gint tvb_memeql(tvbuff_t *tvb, const gint offset, const guint8 *str, size_t size)
{ const guint8 *ptr; ptr = ensure_contiguous_no_exception(tvb, offset, (gint) size, NULL); if (ptr) { int cmp = memcmp(ptr, str, size); return (cmp == 0 ? 0 : -1); } else { return -1; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Waits until one frame is received on a SSC peripheral, and returns it. */
unsigned int SSC_Read(AT91S_SSC *ssc)
/* Waits until one frame is received on a SSC peripheral, and returns it. */ unsigned int SSC_Read(AT91S_SSC *ssc)
{ while ((ssc->SSC_SR & AT91C_SSC_RXRDY) == 0); return ssc->SSC_RHR; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* This function writes the SPI interface using the configuration parameter within the sc structure. The op code parameter is used to specify which control register to access. This controller has the following seven control register commands */
void enc28j60_lwip_write_spi(uint32_t spiHandle, uint8_t opcode, uint8_t address, uint8_t byteData)
/* This function writes the SPI interface using the configuration parameter within the sc structure. The op code parameter is used to specify which control register to access. This controller has the following seven control register commands */ void enc28j60_lwip_write_spi(uint32_t spiHandle, uint8_t opcode, uint8_t address, uint8_t byteData)
{ uint8_t opcodeArg; uint8_t commandWithData[2]; opcodeArg = ENC28J60_SPI_OPCODE_ARGUMENT(opcode, address); commandWithData[0] = opcodeArg; commandWithData[1] = byteData; SPI_WRITE_READ_SETTINGS wrc{false, 0, false, 0, ENC28J60_CS, ENC28J60_CS_ACTIVE}; nanoSPI_Write_Read(spiHandle, wrc, commandWithData, 2, 0, 0); }
nanoframework/nf-interpreter
C++
MIT License
293
/* BACnetDeviceObjectReference ::= SEQUENCE { deviceIdentifier BACnetObjectIdentifier OPTIONAL, objectIdentifier BACnetObjectIdentifier } */
static guint fDeviceObjectReference(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
/* BACnetDeviceObjectReference ::= SEQUENCE { deviceIdentifier BACnetObjectIdentifier OPTIONAL, objectIdentifier BACnetObjectIdentifier } */ static guint fDeviceObjectReference(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
{ guint lastoffset = 0; while (tvb_reported_length_remaining(tvb, offset) > 0) { lastoffset = offset; switch (fTagNo(tvb, offset)) { case 0: offset = fObjectIdentifier(tvb, pinfo, tree, offset); break; case 1: offset = fObjectIdentifier(tvb, pinfo, tree, offset); break; default: return offset; } if (offset == lastoffset) break; } return offset; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* must be called with the lock held and interrupts disabled. */
static void enable_link_interrupt(struct xircom_private *card)
/* must be called with the lock held and interrupts disabled. */ static void enable_link_interrupt(struct xircom_private *card)
{ unsigned int val; enter("enable_link_interrupt"); val = inl(card->io_port + CSR7); val = val | (1 << 27); outl(val, card->io_port + CSR7); leave("enable_link_interrupt"); }
robutest/uclinux
C++
GPL-2.0
60
/* D8 - cfgerr D7 - dalign D6 - rip D5 - in_abort_l D4 - Always 1 D3 - Always 1 D2 - Always 1 D1 - Always 1 D0 - Done bit */
u32 fifo_icap_get_status(struct hwicap_drvdata *drvdata)
/* D8 - cfgerr D7 - dalign D6 - rip D5 - in_abort_l D4 - Always 1 D3 - Always 1 D2 - Always 1 D1 - Always 1 D0 - Done bit */ u32 fifo_icap_get_status(struct hwicap_drvdata *drvdata)
{ u32 status = in_be32(drvdata->base_address + XHI_SR_OFFSET); dev_dbg(drvdata->dev, "Getting status = %x\n", status); return status; }
robutest/uclinux
C++
GPL-2.0
60
/* The protocols list is initialized. The handle is added to the list of known UEFI objects. */
void efi_add_handle(efi_handle_t handle)
/* The protocols list is initialized. The handle is added to the list of known UEFI objects. */ void efi_add_handle(efi_handle_t handle)
{ if (!handle) return; INIT_LIST_HEAD(&handle->protocols); list_add_tail(&handle->link, &efi_obj_list); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Reads and returns the current value of DR7. This function is only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on X64. */
UINTN EFIAPI AsmReadDr7(VOID)
/* Reads and returns the current value of DR7. This function is only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on X64. */ UINTN EFIAPI AsmReadDr7(VOID)
{ UINTN Data; __asm__ __volatile__ ( "mov %%dr7, %0" : "=r" (Data) ); return Data; }
tianocore/edk2
C++
Other
4,240
/* Disables sending NACK on address match. Disables sending of NACK on address match, thus acknowledging incoming transactions. */
void i2c_slave_disable_nack_on_address(struct i2c_slave_module *const module)
/* Disables sending NACK on address match. Disables sending of NACK on address match, thus acknowledging incoming transactions. */ void i2c_slave_disable_nack_on_address(struct i2c_slave_module *const module)
{ Assert(module); module->nack_on_address = false; }
memfault/zero-to-main
C++
null
200
/* adv_rx_ring could be inlined to increase performance, but its called a */
static void adv_rx_ring(struct net_device *dev)
/* adv_rx_ring could be inlined to increase performance, but its called a */ static void adv_rx_ring(struct net_device *dev)
{ struct xl_private *xl_priv=netdev_priv(dev); int n = xl_priv->rx_ring_tail; int prev_ring_loc; prev_ring_loc = (n + XL_RX_RING_SIZE - 1) & (XL_RX_RING_SIZE - 1); xl_priv->xl_rx_ring[prev_ring_loc].upnextptr = cpu_to_le32(xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * n)); xl_priv->xl_rx_ring[n].framestatus = 0; xl_priv->xl_rx_ring[n].upnextptr = 0; xl_priv->rx_ring_tail++; xl_priv->rx_ring_tail &= (XL_RX_RING_SIZE-1); }
robutest/uclinux
C++
GPL-2.0
60
/* Read a certain amount of bytes from a file in WINC's Flash using HIF transfer. */
NMI_API m2m_ota_host_file_read_hif(uint8 u8Handler, uint32 u32Offset, uint32 u32Size, tpfFileReadCb pfHFDReadCb)
/* Read a certain amount of bytes from a file in WINC's Flash using HIF transfer. */ NMI_API m2m_ota_host_file_read_hif(uint8 u8Handler, uint32 u32Offset, uint32 u32Size, tpfFileReadCb pfHFDReadCb)
{ sint8 s8Ret = M2M_ERR_INVALID_ARG; FileBlock.u32Offset = u32Offset; FileBlock.u32Size = u32Size; if((u8Handler != gu8CurrFileHandlerID) || (HFD_INVALID_HANDLER == gu8CurrFileHandlerID) || (NULL == pfHFDReadCb)) goto EXIT; s8Ret = hif_send(M2M_REQ_GROUP_OTA, M2M_OTA_REQ_HOST_FILE_READ, (uint8 *) &FileBlock, sizeof(FileBlockDescriptor), NULL, 0, 0); if(M2M_SUCCESS == s8Ret) gpfHFDReadCb = pfHFDReadCb; EXIT: return s8Ret; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Configure the FT6206 device to generate IT on given INT pin connected to MCU as EXTI. */
void ft6x06_TS_EnableIT(uint16_t DeviceAddr)
/* Configure the FT6206 device to generate IT on given INT pin connected to MCU as EXTI. */ void ft6x06_TS_EnableIT(uint16_t DeviceAddr)
{ uint8_t regValue = 0; regValue = (FT6206_G_MODE_INTERRUPT_TRIGGER & (FT6206_G_MODE_INTERRUPT_MASK >> FT6206_G_MODE_INTERRUPT_SHIFT)) << FT6206_G_MODE_INTERRUPT_SHIFT; TS_IO_Write(DeviceAddr, FT6206_GMODE_REG, regValue); }
eclipse-threadx/getting-started
C++
Other
310
/* This function sets the memory attributes for a section covering 1MB, of memory in the translation table. */
void Xil_SetTlbAttributes(INTPTR addr, u32 attrib)
/* This function sets the memory attributes for a section covering 1MB, of memory in the translation table. */ void Xil_SetTlbAttributes(INTPTR addr, u32 attrib)
{ INTPTR Localaddr = addr; Localaddr &= (~(0xFFFFFU)); Xil_SetMPURegion(Localaddr, 0x100000, attrib); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Internal function used to apply dither on the PWM signal. */
int32_t pwm_dither_apply(struct pwm_desc *dev)
/* Internal function used to apply dither on the PWM signal. */ int32_t pwm_dither_apply(struct pwm_desc *dev)
{ int32_t ret = 0; int32_t duty; uint32_t temp; if(dev->has_dither == 1) { if(dither_period) { if (dev->dither_amplitude >= 1) { temp = dev->duty_cycle; duty = dev->duty_cycle + (int16_t)dith_ampl; if(duty < 0) duty = 0; if(duty > 10000) duty = 10000; ret = pwm_set_duty_cycle(dev, (uint32_t)duty); if(ret != 0) return ret; dev->duty_cycle = temp; dither_period = false; } } } return ret; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Run handler function in the netif thread context and wait for function return. */
void os_hook_dispatch_wait(wifi_task_cb handler, struct params_dispatch *p, void *pv)
/* Run handler function in the netif thread context and wait for function return. */ void os_hook_dispatch_wait(wifi_task_cb handler, struct params_dispatch *p, void *pv)
{ hif_msg_t msg; if (hif_thread == xTaskGetCurrentTaskHandle()) { p->signal_semaphore = 0; handler(pv); } else { p->signal_semaphore = 1; msg.id = MSG_CMD; msg.handler = handler; msg.priv = pv; os_hif_task_msg_post_counter++; xQueueSend(hif_queue, (void *)&msg, portMAX_DELAY); xSemaphoreTake(hif_notify_sem, portMAX_DELAY); } }
remotemcu/remcu-chip-sdks
C++
null
436