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
/* Returns the current SPIx Transmission FIFO filled level. */
uint16_t SPI_GetTransmissionFIFOStatus(SPI_TypeDef *SPIx)
/* Returns the current SPIx Transmission FIFO filled level. */ uint16_t SPI_GetTransmissionFIFOStatus(SPI_TypeDef *SPIx)
{ return (uint16_t)((SPIx->SR & SPI_SR_FTLVL)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Allocate a new board structure. Fill out the basic info in it. */
static struct stlbrd* stl_allocbrd(void)
/* Allocate a new board structure. Fill out the basic info in it. */ static struct stlbrd* stl_allocbrd(void)
{ struct stlbrd *brdp; brdp = kzalloc(sizeof(struct stlbrd), GFP_KERNEL); if (!brdp) { printk("STALLION: failed to allocate memory (size=%Zd)\n", sizeof(struct stlbrd)); return NULL; } brdp->magic = STL_BOARDMAGIC; return brdp; }
robutest/uclinux
C++
GPL-2.0
60
/* Create a TCP segment usable for passing to tcp_input */
struct pbuf* tcp_create_rx_segment(struct tcp_pcb *pcb, void *data, size_t data_len, u32_t seqno_offset, u32_t ackno_offset, u8_t headerflags)
/* Create a TCP segment usable for passing to tcp_input */ struct pbuf* tcp_create_rx_segment(struct tcp_pcb *pcb, void *data, size_t data_len, u32_t seqno_offset, u32_t ackno_offset, u8_t headerflags)
{ return tcp_create_segment(&pcb->remote_ip, &pcb->local_ip, pcb->remote_port, pcb->local_port, data, data_len, pcb->rcv_nxt + seqno_offset, pcb->lastack + ackno_offset, headerflags); }
ua1arn/hftrx
C++
null
69
/* stm32_copro_load() - Loadup the STM32 remote processor @dev: corresponding STM32 remote processor device @addr: Address in memory where image is stored @size: Size in bytes of the image */
static int stm32_copro_load(struct udevice *dev, ulong addr, ulong size)
/* stm32_copro_load() - Loadup the STM32 remote processor @dev: corresponding STM32 remote processor device @addr: Address in memory where image is stored @size: Size in bytes of the image */ static int stm32_copro_load(struct udevice *dev, ulong addr, ulong size)
{ struct stm32_copro_privdata *priv; ulong rsc_table_size; int ret; priv = dev_get_priv(dev); ret = stm32_copro_set_hold_boot(dev, true); if (ret) return ret; ret = reset_assert(&priv->reset_ctl); if (ret) { dev_err(dev, "Unable to assert reset line (ret=%d)\n", ret); return ret; } if (rproc_elf32_load_rsc_table(dev, addr, size, &priv->rsc_table_addr, &rsc_table_size)) { priv->rsc_table_addr = 0; dev_warn(dev, "No valid resource table for this firmware\n"); } return rproc_elf32_load_image(dev, addr, size); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Changing playback levels at an ESS chip with record mixer means having to take care of recording levels of recorded inputs (devc->recmask) too! */
int ess_mixer_set(sb_devc *devc, int dev, int left, int right)
/* Changing playback levels at an ESS chip with record mixer means having to take care of recording levels of recorded inputs (devc->recmask) too! */ int ess_mixer_set(sb_devc *devc, int dev, int left, int right)
{ if (ess_has_rec_mixer (devc->submodel) && (devc->recmask & (1 << dev))) { sb_common_mixer_set (devc, dev + ES_REC_MIXER_RECDIFF, left, right); } return sb_common_mixer_set (devc, dev, left, right); }
robutest/uclinux
C++
GPL-2.0
60
/* Verifies the hardware needs to allow ARPs to be processed by the host returns: - true/false */
u32 e1000_enable_mng_pass_thru(struct e1000_hw *hw)
/* Verifies the hardware needs to allow ARPs to be processed by the host returns: - true/false */ u32 e1000_enable_mng_pass_thru(struct e1000_hw *hw)
{ u32 manc; if (hw->asf_firmware_present) { manc = er32(MANC); if (!(manc & E1000_MANC_RCV_TCO_EN) || !(manc & E1000_MANC_EN_MAC_ADDR_FILTER)) return false; if ((manc & E1000_MANC_SMBUS_EN) && !(manc & E1000_MANC_ASF_EN)) return true; } return false; }
robutest/uclinux
C++
GPL-2.0
60
/* Stalls the CPU for the number of microseconds specified by MicroSeconds. */
UINTN EFIAPI S3Stall(IN UINTN MicroSeconds)
/* Stalls the CPU for the number of microseconds specified by MicroSeconds. */ UINTN EFIAPI S3Stall(IN UINTN MicroSeconds)
{ RETURN_STATUS Status; Status = S3BootScriptSaveStall (MicroSecondDelay (MicroSeconds)); ASSERT (Status == RETURN_SUCCESS); return MicroSeconds; }
tianocore/edk2
C++
Other
4,240
/* Initialize Framework Layer. Initialize companion module and register callback. */
ADI_WIFI_RESULT adi_wifi_Init(ADI_CALLBACK const pCallbackFunc, void *const pCBParam)
/* Initialize Framework Layer. Initialize companion module and register callback. */ ADI_WIFI_RESULT adi_wifi_Init(ADI_CALLBACK const pCallbackFunc, void *const pCBParam)
{ ASSERT(pCallbackFunc != NULL); pApplicationCallback = pCallbackFunc; pApplicationParameter = pCBParam; if((adi_tmr_Init(ADI_WIFI_NOOS_GP_TIMER_CFG, adi_wifi_TimerCallback, NULL, true) == ADI_TMR_SUCCESS) && (adi_tmr_Init(ADI_WIFI_BROKER_CONNECTION_GP_TIMER_CFG, adi_wifi_PingTimerCallback, NULL, true) == ADI_TMR_SUCCESS)) { return(adi_wifi_radio_Init(adi_wifi_NoosCallback)); } return(ADI_WIFI_FAILURE); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Similar to pbuf_header(-size) but de-refs header pbufs for (size >= p->len) */
struct pbuf* pbuf_free_header(struct pbuf *q, u16_t size)
/* Similar to pbuf_header(-size) but de-refs header pbufs for (size >= p->len) */ struct pbuf* pbuf_free_header(struct pbuf *q, u16_t size)
{ struct pbuf *p = q; u16_t free_left = size; while (free_left && p) { if (free_left >= p->len) { struct pbuf *f = p; free_left = (u16_t)(free_left - p->len); p = p->next; f->next = 0; pbuf_free(f); } else { pbuf_remove_header(p, free_left); free_left = 0; } } return p; }
ua1arn/hftrx
C++
null
69
/* enable or disable USI UART TX DMA . */
void USI_UARTTXDMACmd(USI_TypeDef *USIx, u32 NewState)
/* enable or disable USI UART TX DMA . */ void USI_UARTTXDMACmd(USI_TypeDef *USIx, u32 NewState)
{ assert_param(IS_ALL_USI_PERIPH(USIx)); if(NewState != DISABLE ){ USIx->DMA_ENABLE |= USI_TX_DMA_ENABLE; } else { USIx->DMA_ENABLE &= (~ USI_TX_DMA_ENABLE); } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* To recreate the curves we read here the points and interpolate later. Note that in most cases only 2 (higher and lower) curves are used (like RF5112) but vendors have the oportunity to include all 4 curves on eeprom. The final curve (higher power) has an extra point for better accuracy like RF5112. */
static unsigned int ath5k_pdgains_size_2413(struct ath5k_eeprom_info *ee, unsigned int mode)
/* To recreate the curves we read here the points and interpolate later. Note that in most cases only 2 (higher and lower) curves are used (like RF5112) but vendors have the oportunity to include all 4 curves on eeprom. The final curve (higher power) has an extra point for better accuracy like RF5112. */ static unsigned int ath5k_pdgains_size_2413(struct ath5k_eeprom_info *ee, unsigned int mode)
{ static const unsigned int pdgains_size[] = { 4, 6, 9, 12 }; unsigned int sz; sz = pdgains_size[ee->ee_pd_gains[mode] - 1]; sz *= ee->ee_n_piers[mode]; return sz; }
robutest/uclinux
C++
GPL-2.0
60
/* For licensing information, see the file 'LICENCE' in this directory. */
int jffs2_init_security(struct inode *inode, struct inode *dir)
/* For licensing information, see the file 'LICENCE' in this directory. */ int jffs2_init_security(struct inode *inode, struct inode *dir)
{ int rc; size_t len; void *value; char *name; rc = security_inode_init_security(inode, dir, &name, &value, &len); if (rc) { if (rc == -EOPNOTSUPP) return 0; return rc; } rc = do_jffs2_setxattr(inode, JFFS2_XPREFIX_SECURITY, name, value, len, 0); kfree(name); kfree(value); return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: (transfer full): a #GFile for the given @parse_name. Free the returned object with g_object_unref(). */
GFile* g_vfs_parse_name(GVfs *vfs, const char *parse_name)
/* Returns: (transfer full): a #GFile for the given @parse_name. Free the returned object with g_object_unref(). */ GFile* g_vfs_parse_name(GVfs *vfs, const char *parse_name)
{ GVfsClass *class; g_return_val_if_fail (G_IS_VFS (vfs), NULL); g_return_val_if_fail (parse_name != NULL, NULL); class = G_VFS_GET_CLASS (vfs); if (g_str_has_prefix (parse_name, "resource:")) return _g_resource_file_new (parse_name); return (* class->parse_name) (vfs, parse_name); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* brief Return Frequency of FRO 12MHz return Frequency of FRO 12MHz */
static uint32_t CLOCK_GetFro12MFreq(void)
/* brief Return Frequency of FRO 12MHz return Frequency of FRO 12MHz */ static uint32_t CLOCK_GetFro12MFreq(void)
{ return ((SCG0->SIRCCSR & SCG_SIRCCSR_SIRC_CLK_PERIPH_EN_MASK) != 0UL) ? 12000000U : 0U; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check for the presence of an ATA66 capable cable on the interface. */
static u8 sil_cable_detect(ide_hwif_t *hwif)
/* Check for the presence of an ATA66 capable cable on the interface. */ static u8 sil_cable_detect(ide_hwif_t *hwif)
{ struct pci_dev *dev = to_pci_dev(hwif->dev); unsigned long addr = siimage_selreg(hwif, 0); u8 ata66 = sil_ioread8(dev, addr); return (ata66 & 0x01) ? ATA_CBL_PATA80 : ATA_CBL_PATA40; }
robutest/uclinux
C++
GPL-2.0
60
/* Send 5 bytes command to the SD card. */
void SD_SendCmd(uint8_t Cmd, uint32_t Arg, uint8_t Crc)
/* Send 5 bytes command to the SD card. */ void SD_SendCmd(uint8_t Cmd, uint32_t Arg, uint8_t Crc)
{ uint32_t i = 0x00; uint8_t Frame[6]; Frame[0] = (Cmd | 0x40); Frame[1] = (uint8_t)(Arg >> 24); Frame[2] = (uint8_t)(Arg >> 16); Frame[3] = (uint8_t)(Arg >> 8); Frame[4] = (uint8_t)(Arg); Frame[5] = (Crc); for (i = 0; i < 6; i++) { SD_WriteByte(Frame[i]); } }
avem-labs/Avem
C++
MIT License
1,752
/* Initializes the LCD peripheral according to the specified parameters in the LCD_InitStruct. */
void LCD_Init(LCD_InitTypeDef *LCD_InitStruct)
/* Initializes the LCD peripheral according to the specified parameters in the LCD_InitStruct. */ void LCD_Init(LCD_InitTypeDef *LCD_InitStruct)
{ assert_param(IS_LCD_PRESCALER(LCD_InitStruct->LCD_Prescaler)); assert_param(IS_LCD_DIVIDER(LCD_InitStruct->LCD_Divider)); assert_param(IS_LCD_DUTY(LCD_InitStruct->LCD_Duty)); assert_param(IS_LCD_BIAS(LCD_InitStruct->LCD_Bias)); assert_param(IS_LCD_VOLTAGE_SOURCE(LCD_InitStruct->LCD_VoltageSource)); LCD->FCR &= (uint32_t)FCR_MASK; LCD->FCR |= (uint32_t)(LCD_InitStruct->LCD_Prescaler | LCD_InitStruct->LCD_Divider); LCD_WaitForSynchro(); LCD->CR &= (uint32_t)CR_MASK; LCD->CR |= (uint32_t)(LCD_InitStruct->LCD_Duty | LCD_InitStruct->LCD_Bias | \ LCD_InitStruct->LCD_VoltageSource); }
avem-labs/Avem
C++
MIT License
1,752
/* Simple routines for masking and unmasking SCC interrupts in cases where this can't be done in hardware (only the PSC can do that.) */
static void scc_irq_enable(unsigned int)
/* Simple routines for masking and unmasking SCC interrupts in cases where this can't be done in hardware (only the PSC can do that.) */ static void scc_irq_enable(unsigned int)
{ int irq_idx = IRQ_IDX(irq); scc_mask |= (1 << irq_idx); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* SB600: Disable BAR1 on device 14.0 to avoid HPET resources from confusing the PCI engine: */
static void sb600_disable_hpet_bar(struct pci_dev *dev)
/* SB600: Disable BAR1 on device 14.0 to avoid HPET resources from confusing the PCI engine: */ static void sb600_disable_hpet_bar(struct pci_dev *dev)
{ u8 val; pci_read_config_byte(dev, 0x08, &val); if (val < 0x2F) { outb(0x55, 0xCD6); val = inb(0xCD7); outb(0x55, 0xCD6); outb(val | 0x80, 0xCD7); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Determine a default network mask, based on the IP address. */
static int inet_abc_len(__be32 addr)
/* Determine a default network mask, based on the IP address. */ static int inet_abc_len(__be32 addr)
{ int rc = -1; if (ipv4_is_zeronet(addr)) rc = 0; else { __u32 haddr = ntohl(addr); if (IN_CLASSA(haddr)) rc = 8; else if (IN_CLASSB(haddr)) rc = 16; else if (IN_CLASSC(haddr)) rc = 24; } return rc; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* De-configure the VirtIo GPU device that underlies VgpuDev. */
VOID VirtioGpuUninit(IN OUT VGPU_DEV *VgpuDev)
/* De-configure the VirtIo GPU device that underlies VgpuDev. */ VOID VirtioGpuUninit(IN OUT VGPU_DEV *VgpuDev)
{ VgpuDev->VirtIo->SetDeviceStatus (VgpuDev->VirtIo, 0); VgpuDev->VirtIo->UnmapSharedBuffer (VgpuDev->VirtIo, VgpuDev->RingMap); VirtioRingUninit (VgpuDev->VirtIo, &VgpuDev->Ring); }
tianocore/edk2
C++
Other
4,240
/* This function works like g_param_spec_set_qdata(), but in addition, a */
void g_param_spec_set_qdata_full(GParamSpec *pspec, GQuark quark, gpointer data, GDestroyNotify destroy)
/* This function works like g_param_spec_set_qdata(), but in addition, a */ void g_param_spec_set_qdata_full(GParamSpec *pspec, GQuark quark, gpointer data, GDestroyNotify destroy)
{ g_return_if_fail (G_IS_PARAM_SPEC (pspec)); g_return_if_fail (quark > 0); g_datalist_id_set_data_full (&pspec->qdata, quark, data, data ? destroy : (GDestroyNotify) NULL); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns 0 if recovery has been triggered, < 0 if not. */
int zfcp_erp_port_reopen(struct zfcp_port *port, int clear, char *id, void *ref)
/* Returns 0 if recovery has been triggered, < 0 if not. */ int zfcp_erp_port_reopen(struct zfcp_port *port, int clear, char *id, void *ref)
{ int retval; unsigned long flags; struct zfcp_adapter *adapter = port->adapter; write_lock_irqsave(&adapter->erp_lock, flags); retval = _zfcp_erp_port_reopen(port, clear, id, ref); write_unlock_irqrestore(&adapter->erp_lock, flags); return retval; }
robutest/uclinux
C++
GPL-2.0
60
/* parport_ip32_epp_write_addr - write a block of addresses in EPP mode */
static size_t parport_ip32_epp_write_addr(struct parport *p, const void *buf, size_t len, int flags)
/* parport_ip32_epp_write_addr - write a block of addresses in EPP mode */ static size_t parport_ip32_epp_write_addr(struct parport *p, const void *buf, size_t len, int flags)
{ struct parport_ip32_private * const priv = p->physport->private_data; return parport_ip32_epp_write(priv->regs.eppAddr, p, buf, len, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* vx_pcm_hw_free - hw_free callback for playback and capture */
static int vx_pcm_hw_free(struct snd_pcm_substream *subs)
/* vx_pcm_hw_free - hw_free callback for playback and capture */ static int vx_pcm_hw_free(struct snd_pcm_substream *subs)
{ return snd_pcm_free_vmalloc_buffer(subs); }
robutest/uclinux
C++
GPL-2.0
60
/* Set Input Filter and Dead-time Clock Divider Ratio. This forms the sampling clock for the input filters and the dead-time clock in the advanced timers 1 and 8, by division from the timer clock. */
void timer_set_clock_division(uint32_t timer_peripheral, uint32_t clock_div)
/* Set Input Filter and Dead-time Clock Divider Ratio. This forms the sampling clock for the input filters and the dead-time clock in the advanced timers 1 and 8, by division from the timer clock. */ void timer_set_clock_division(uint32_t timer_peripheral, uint32_t clock_div)
{ clock_div &= TIM_CR1_CKD_CK_INT_MASK; TIM_CR1(timer_peripheral) &= ~TIM_CR1_CKD_CK_INT_MASK; TIM_CR1(timer_peripheral) |= clock_div; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Send words out from source data buffer and get returned datas into destination data buffer. */
void QspiSendAndGetWords(uint32_t *pSrcData, uint32_t *pDstData, uint32_t cnt)
/* Send words out from source data buffer and get returned datas into destination data buffer. */ void QspiSendAndGetWords(uint32_t *pSrcData, uint32_t *pDstData, uint32_t cnt)
{ uint32_t num = 0; uint32_t timeout = 0; while (num < cnt) { QspiSendWord(*(pSrcData++)); num++; } while (!GetQspiRxHaveDataStatus()) { if (++timeout >= QSPI_TIME_OUT_CNT) { break; } } timeout = 0; while (QSPI->RXFN < cnt) { if (++timeout >= QSPI_TIME_OUT_CNT) { break; } } num = 0; while (num < cnt) { *(pDstData++) = QspiReadWord(); num++; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* mca_device_set_claim - set the claim value of the driver @mca_dev: device to set value for @val: claim value to set (1 claimed, 0 unclaimed) */
void mca_device_set_claim(struct mca_device *mca_dev, int val)
/* mca_device_set_claim - set the claim value of the driver @mca_dev: device to set value for @val: claim value to set (1 claimed, 0 unclaimed) */ void mca_device_set_claim(struct mca_device *mca_dev, int val)
{ mca_dev->driver_loaded = val; }
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 PciBusComponentNameGetDriverName(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 PciBusComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mPciBusDriverNameTable, DriverName, (BOOLEAN)(This == &gPciBusComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* Read SEEPROM. A zero is written to the flag register when the addres is written to the Control register. The hardware device will set the flag to a one when 4B have been transferred to the Data register. */
int t1_seeprom_read(adapter_t *adapter, u32 addr, __le32 *data)
/* Read SEEPROM. A zero is written to the flag register when the addres is written to the Control register. The hardware device will set the flag to a one when 4B have been transferred to the Data register. */ int t1_seeprom_read(adapter_t *adapter, u32 addr, __le32 *data)
{ int i = EEPROM_MAX_POLL; u16 val; u32 v; if (addr >= EEPROMSIZE || (addr & 3)) return -EINVAL; pci_write_config_word(adapter->pdev, A_PCICFG_VPD_ADDR, (u16)addr); do { udelay(50); pci_read_config_word(adapter->pdev, A_PCICFG_VPD_ADDR, &val); } while (!(val & F_VPD_OP_FLAG) && --i); if (!(val & F_VPD_OP_FLAG)) { CH_ERR("%s: reading EEPROM address 0x%x failed\n", adapter->name, addr); return -EIO; } pci_read_config_dword(adapter->pdev, A_PCICFG_VPD_DATA, &v); *data = cpu_to_le32(v); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* System calibration rtc enable. Use this function to able system calibration rtc. */
void system_rtc_calibration_enable(void)
/* System calibration rtc enable. Use this function to able system calibration rtc. */ void system_rtc_calibration_enable(void)
{ LP_CLK_CAL_REGS0->CONFIG_REG.reg |= \ LP_CLK_CAL_REGS_CONFIG_REG_START_RTC_CALIB; }
memfault/zero-to-main
C++
null
200
/* Returns zero on success, a negative error code otherwise. */
int mtd_ooblayout_get_eccbytes(struct mtd_info *mtd, u8 *eccbuf, const u8 *oobbuf, int start, int nbytes)
/* Returns zero on success, a negative error code otherwise. */ int mtd_ooblayout_get_eccbytes(struct mtd_info *mtd, u8 *eccbuf, const u8 *oobbuf, int start, int nbytes)
{ return mtd_ooblayout_get_bytes(mtd, eccbuf, oobbuf, start, nbytes, mtd_ooblayout_ecc); }
4ms/stm32mp1-baremetal
C++
Other
137
/* This API reads the data from the given register address of sensor. */
int8_t bme68x_get_regs(uint8_t reg_addr, uint8_t *reg_data, uint32_t len, struct bme68x_dev *dev)
/* This API reads the data from the given register address of sensor. */ int8_t bme68x_get_regs(uint8_t reg_addr, uint8_t *reg_data, uint32_t len, struct bme68x_dev *dev)
{ int8_t rslt; rslt = null_ptr_check(dev); if ((rslt == BME68X_OK) && reg_data) { if (dev->intf == BME68X_SPI_INTF) { rslt = set_mem_page(reg_addr, dev); if (rslt == BME68X_OK) { reg_addr = reg_addr | BME68X_SPI_RD_MSK; } } dev->intf_rslt = dev->read(reg_addr, reg_data, len, dev->intf_ptr); if (dev->intf_rslt != 0) { rslt = BME68X_E_COM_FAIL; } } else { rslt = BME68X_E_NULL_PTR; } return rslt; }
eclipse-threadx/getting-started
C++
Other
310
/* This function will enable the controller's transmitter and receiver, and will reset the receive FIFO. */
void EthernetEnable(unsigned long ulBase)
/* This function will enable the controller's transmitter and receiver, and will reset the receive FIFO. */ void EthernetEnable(unsigned long ulBase)
{ ASSERT(ulBase == ETH_BASE); HWREG(ulBase + MAC_O_RCTL) |= MAC_RCTL_RSTFIFO; HWREG(ulBase + MAC_O_RCTL) |= MAC_RCTL_RXEN; HWREG(ulBase + MAC_O_TCTL) |= MAC_TCTL_TXEN; HWREG(ulBase + MAC_O_RCTL) |= MAC_RCTL_RSTFIFO; }
watterott/WebRadio
C++
null
71
/* Release all the fragments of a packet, then free the assemble entry. */
VOID Ip6FreeAssembleEntry(IN IP6_ASSEMBLE_ENTRY *Assemble)
/* Release all the fragments of a packet, then free the assemble entry. */ VOID Ip6FreeAssembleEntry(IN IP6_ASSEMBLE_ENTRY *Assemble)
{ LIST_ENTRY *Entry; LIST_ENTRY *Next; NET_BUF *Fragment; NET_LIST_FOR_EACH_SAFE (Entry, Next, &Assemble->Fragments) { Fragment = NET_LIST_USER_STRUCT (Entry, NET_BUF, List); RemoveEntryList (Entry); NetbufFree (Fragment); } if (Assemble->Packet != NULL) { NetbufFree (Assemble->Packet); } FreePool (Assemble); }
tianocore/edk2
C++
Other
4,240
/* This actually sends the interrupt for this virtqueue, if we've used a buffer. */
static void trigger_irq(struct virtqueue *vq)
/* This actually sends the interrupt for this virtqueue, if we've used a buffer. */ static void trigger_irq(struct virtqueue *vq)
{ unsigned long buf[] = { LHREQ_IRQ, vq->config.irq }; if (!vq->pending_used) return; vq->pending_used = 0; if (vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT) { if (!vq->dev->irq_on_empty || lg_last_avail(vq) != vq->vring.avail->idx) return; } if (write(lguest_fd, buf, sizeof(buf)) != 0) err(1, "Triggering irq %i", vq->config.irq); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reads the I/O port specified by Port with registers width specified by Width. The read value is returned. If such operations are not supported, then ASSERT(). This function must guarantee that all I/O read and write operations are serialized. */
UINT64 EFIAPI IoReadWorker(IN UINTN Port, IN EFI_SMM_IO_WIDTH Width)
/* Reads the I/O port specified by Port with registers width specified by Width. The read value is returned. If such operations are not supported, then ASSERT(). This function must guarantee that all I/O read and write operations are serialized. */ UINT64 EFIAPI IoReadWorker(IN UINTN Port, IN EFI_SMM_IO_WIDTH Width)
{ EFI_STATUS Status; UINT64 Data; Status = gSmst->SmmIo.Io.Read (&gSmst->SmmIo, Width, Port, 1, &Data); ASSERT_EFI_ERROR (Status); return Data; }
tianocore/edk2
C++
Other
4,240
/* If this device is either the dock station itself, or is a device dependent on the dock station, then it is a dock device */
int is_dock_device(acpi_handle handle)
/* If this device is either the dock station itself, or is a device dependent on the dock station, then it is a dock device */ int is_dock_device(acpi_handle handle)
{ struct dock_station *dock_station; if (!dock_station_count) return 0; if (is_dock(handle)) return 1; list_for_each_entry(dock_station, &dock_stations, sibling) if (find_dock_dependent_device(dock_station, handle)) return 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This places the pte into ENTRYLO0 and writes it with tlbwi or tlbwr as appropriate. This is because the index register may have the probe fail bit set as a result of a trap on a kseg2 access, i.e. without refill. Then it returns. */
static void __cpuinit build_r3000_tlb_reload_write(u32 **p, struct uasm_label **l, struct uasm_reloc **r, unsigned int pte, unsigned int tmp)
/* This places the pte into ENTRYLO0 and writes it with tlbwi or tlbwr as appropriate. This is because the index register may have the probe fail bit set as a result of a trap on a kseg2 access, i.e. without refill. Then it returns. */ static void __cpuinit build_r3000_tlb_reload_write(u32 **p, struct uasm_label **l, struct uasm_reloc **r, unsigned int pte, unsigned int tmp)
{ uasm_i_mfc0(p, tmp, C0_INDEX); uasm_i_mtc0(p, pte, C0_ENTRYLO0); uasm_il_bltz(p, r, tmp, label_r3000_write_probe_fail); uasm_i_mfc0(p, tmp, C0_EPC); uasm_i_tlbwi(p); uasm_i_jr(p, tmp); uasm_i_rfe(p); uasm_l_r3000_write_probe_fail(l, *p); uasm_i_tlbwr(p); uasm_i_jr(p, tmp); uasm_i_rfe(p); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set the boot bank to the default bank */
void cpld_set_defbank(void)
/* Set the boot bank to the default bank */ void cpld_set_defbank(void)
{ u8 reg = CPLD_READ(flash_ctl_status); reg = (reg & ~CPLD_BANK_SEL_MASK) | CPLD_LBMAP_DFLTBANK; CPLD_WRITE(flash_ctl_status, reg); CPLD_WRITE(reset_ctl1, CPLD_LBMAP_RESET); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Configure push button 0 to generate an EIC interrupt. */
static void configure_button(void)
/* Configure push button 0 to generate an EIC interrupt. */ static void configure_button(void)
{ struct eic_line_config eic_line_conf; eic_line_conf.eic_mode = EIC_MODE_EDGE_TRIGGERED; eic_line_conf.eic_edge = EIC_EDGE_FALLING_EDGE; eic_line_conf.eic_level = EIC_LEVEL_LOW_LEVEL; eic_line_conf.eic_filter = EIC_FILTER_DISABLED; eic_line_conf.eic_async = EIC_ASYNCH_MODE; eic_enable(EIC); eic_line_set_config(EIC, GPIO_PUSH_BUTTON_EIC_LINE, &eic_line_conf); eic_line_set_callback(EIC, GPIO_PUSH_BUTTON_EIC_LINE, set_toggle_flag, GPIO_PUSH_BUTTON_EIC_IRQ, 1); eic_line_enable(EIC, GPIO_PUSH_BUTTON_EIC_LINE); }
remotemcu/remcu-chip-sdks
C++
null
436
/* This bios swaps the APM minute reporting bytes over (Many sony laptops have this problem). */
static int __init swab_apm_power_in_minutes(const struct dmi_system_id *d)
/* This bios swaps the APM minute reporting bytes over (Many sony laptops have this problem). */ static int __init swab_apm_power_in_minutes(const struct dmi_system_id *d)
{ apm_info.get_power_status_swabinminutes = 1; printk(KERN_WARNING "BIOS strings suggest APM reports battery life " "in minutes and wrong byte order.\n"); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Hook in SELinux. This is not quite correct yet, what we really need here (as we do for default ACLs) is a mechanism by which creation of these attrs can be journalled at inode creation time (along with the inode, of course, such that log replay can't cause these to be lost). */
STATIC int xfs_init_security(struct inode *inode, struct inode *dir)
/* Hook in SELinux. This is not quite correct yet, what we really need here (as we do for default ACLs) is a mechanism by which creation of these attrs can be journalled at inode creation time (along with the inode, of course, such that log replay can't cause these to be lost). */ STATIC int xfs_init_security(struct inode *inode, struct inode *dir)
{ struct xfs_inode *ip = XFS_I(inode); size_t length; void *value; char *name; int error; error = security_inode_init_security(inode, dir, &name, &value, &length); if (error) { if (error == -EOPNOTSUPP) return 0; return -error; } error = xfs_attr_set(ip, name, value, length, ATTR_SECURE); kfree(name); kfree(value); return error; }
robutest/uclinux
C++
GPL-2.0
60
/* This function will init timer0 for system ticks */
void rt_hw_timer_init()
/* This function will init timer0 for system ticks */ void rt_hw_timer_init()
{ volatile timer_regs_t *regs = (volatile timer_regs_t*)DAVINCI_TIMER1_BASE; psc_change_state(DAVINCI_DM365_LPSC_TIMER0, 3); psc_change_state(DAVINCI_DM365_LPSC_TIMER1, 3); regs->tcr &= ~(0x3UL << 6); regs->tgcr |=(0x1UL << 2); regs->tgcr |= (0x1UL << 0); regs->prd12 = 24000000/RT_TICK_PER_SECOND; regs->tim12 = 0; regs->tcr |= (0x2UL << 6); rt_hw_interrupt_install(IRQ_DM365_TINT2, rt_timer_handler, RT_NULL, "timer1_12"); rt_hw_interrupt_umask(IRQ_DM365_TINT2); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Turns off the display and puts it into sleep mode Does not turn off backlight. */
EMSTATUS DMD_sleep(void)
/* Turns off the display and puts it into sleep mode Does not turn off backlight. */ EMSTATUS DMD_sleep(void)
{ return DMD_ERROR_DRIVER_NOT_INITIALIZED; } data = DMD_SSD2119_SLEEP_MODE_1_SLP; DMDIF_writeReg(DMD_SSD2119_SLEEP_MODE_1, data); data = 0; DMDIF_writeReg(DMD_SSD2119_DISPLAY_CONTROL, 0x0000); return DMD_OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the dedicated dividers after the PLLSAI configuration. */
void rcc_pllsai_postscalers(uint8_t q, uint8_t r)
/* Set the dedicated dividers after the PLLSAI configuration. */ void rcc_pllsai_postscalers(uint8_t q, uint8_t r)
{ uint32_t reg32 = RCC_DCKCFGR; reg32 &= ((RCC_DCKCFGR_PLLSAIDIVR_MASK << RCC_DCKCFGR_PLLSAIDIVR_SHIFT) | (RCC_DCKCFGR_PLLSAIDIVQ_MASK << RCC_DCKCFGR_PLLSAIDIVQ_SHIFT)); RCC_DCKCFGR = reg32 | ((q << RCC_DCKCFGR_PLLSAIDIVQ_SHIFT) | (r << RCC_DCKCFGR_PLLSAIDIVR_SHIFT)); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Refer to SD Host Controller Simplified spec 3.0 Section for details. */
EFI_STATUS SdPeimHcInitTimeoutCtrl(IN UINTN Bar)
/* Refer to SD Host Controller Simplified spec 3.0 Section for details. */ EFI_STATUS SdPeimHcInitTimeoutCtrl(IN UINTN Bar)
{ EFI_STATUS Status; UINT8 Timeout; Timeout = 0x0E; Status = SdPeimHcRwMmio (Bar + SD_HC_TIMEOUT_CTRL, FALSE, sizeof (Timeout), &Timeout); return Status; }
tianocore/edk2
C++
Other
4,240
/* Called when the velocity module is loaded. The PCI driver is registered with the PCI layer, and in turn will call the probe functions for each velocity adapter installed in the system. */
static int __init velocity_init_module(void)
/* Called when the velocity module is loaded. The PCI driver is registered with the PCI layer, and in turn will call the probe functions for each velocity adapter installed in the system. */ static int __init velocity_init_module(void)
{ int ret; velocity_register_notifier(); ret = pci_register_driver(&velocity_driver); if (ret < 0) velocity_unregister_notifier(); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* ADC Setup the A/D Clock. The ADC's have a common clock prescale setting. */
void rcc_set_adcpre(uint32_t adcpre)
/* ADC Setup the A/D Clock. The ADC's have a common clock prescale setting. */ void rcc_set_adcpre(uint32_t adcpre)
{ RCC_CFGR = (RCC_CFGR & ~RCC_CFGR_ADCPRE) | (adcpre << RCC_CFGR_ADCPRE_SHIFT); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* @pool_type: type of the pool from which memory is to be allocated @size: number of bytes to be allocated @buffer: allocated memory Return: status code */
efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, void **buffer)
/* @pool_type: type of the pool from which memory is to be allocated @size: number of bytes to be allocated @buffer: allocated memory Return: status code */ efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, void **buffer)
{ efi_status_t r; u64 addr; struct efi_pool_allocation *alloc; u64 num_pages = efi_size_in_pages(size + sizeof(struct efi_pool_allocation)); if (!buffer) return EFI_INVALID_PARAMETER; if (size == 0) { *buffer = NULL; return EFI_SUCCESS; } r = efi_allocate_pages(EFI_ALLOCATE_ANY_PAGES, pool_type, num_pages, &addr); if (r == EFI_SUCCESS) { alloc = (struct efi_pool_allocation *)(uintptr_t)addr; alloc->num_pages = num_pages; alloc->checksum = checksum(alloc); *buffer = alloc->data; } return r; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Disable use of MSG_PEEK when reading from socket */
void nl_socket_disable_msg_peek(struct nl_sock *sk)
/* Disable use of MSG_PEEK when reading from socket */ void nl_socket_disable_msg_peek(struct nl_sock *sk)
{ sk->s_flags &= ~NL_MSG_PEEK; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Get USI-SPI Interrupt Status. bit 0 : USI_TXFIFO_ALMOST_EMTY_INTS */
u32 USI_SSI_GetIsr(USI_TypeDef *usi_dev)
/* Get USI-SPI Interrupt Status. bit 0 : USI_TXFIFO_ALMOST_EMTY_INTS */ u32 USI_SSI_GetIsr(USI_TypeDef *usi_dev)
{ return usi_dev->INTERRUPT_STATUS; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Writes a value to one of the devices registers using port I/O (as opposed to memory mapped I/O). Only 82544 and newer devices support port I/O. */
static void e1000_write_reg_io(struct e1000_hw *hw, u32 offset, u32 value)
/* Writes a value to one of the devices registers using port I/O (as opposed to memory mapped I/O). Only 82544 and newer devices support port I/O. */ static void e1000_write_reg_io(struct e1000_hw *hw, u32 offset, u32 value)
{ unsigned long io_addr = hw->io_base; unsigned long io_data = hw->io_base + 4; e1000_io_write(hw, io_addr, offset); e1000_io_write(hw, io_data, value); }
robutest/uclinux
C++
GPL-2.0
60
/* Input: buf: C string containing a "-" followed by a transport name and an unsigned integer value representing the port to listen on, separated by whitespace size: non-zero length of C string in @buf Output: On success: returns zero; NFS service no longer listens on that transport On error: return code is a negative errno value */
static ssize_t write_ports(struct file *file, char *buf, size_t size)
/* Input: buf: C string containing a "-" followed by a transport name and an unsigned integer value representing the port to listen on, separated by whitespace size: non-zero length of C string in @buf Output: On success: returns zero; NFS service no longer listens on that transport On error: return code is a negative errno value */ static ssize_t write_ports(struct file *file, char *buf, size_t size)
{ ssize_t rv; mutex_lock(&nfsd_mutex); rv = __write_ports(file, buf, size); mutex_unlock(&nfsd_mutex); return rv; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: The number of the corresponding hash bucket */
static unsigned int gl_hash(const struct gfs2_sbd *sdp, const struct lm_lockname *name)
/* Returns: The number of the corresponding hash bucket */ static unsigned int gl_hash(const struct gfs2_sbd *sdp, const struct lm_lockname *name)
{ unsigned int h; h = jhash(&name->ln_number, sizeof(u64), 0); h = jhash(&name->ln_type, sizeof(unsigned int), h); h = jhash(&sdp, sizeof(struct gfs2_sbd *), h); h &= GFS2_GL_HASH_MASK; return h; }
robutest/uclinux
C++
GPL-2.0
60
/* Last of all, we look at what happens first of all. The very first time the Guest makes a hypercall, we end up here to set things up: */
static void initialize(struct lg_cpu *cpu)
/* Last of all, we look at what happens first of all. The very first time the Guest makes a hypercall, we end up here to set things up: */ static void initialize(struct lg_cpu *cpu)
{ if (cpu->hcall->arg0 != LHCALL_LGUEST_INIT) { kill_guest(cpu, "hypercall %li before INIT", cpu->hcall->arg0); return; } if (lguest_arch_init_hypercalls(cpu)) kill_guest(cpu, "bad guest page %p", cpu->lg->lguest_data); if (get_user(cpu->lg->noirq_start, &cpu->lg->lguest_data->noirq_start) || get_user(cpu->lg->noirq_end, &cpu->lg->lguest_data->noirq_end)) kill_guest(cpu, "bad guest page %p", cpu->lg->lguest_data); write_timestamp(cpu); page_table_guest_data_init(cpu); guest_pagetable_clear_all(cpu); }
robutest/uclinux
C++
GPL-2.0
60
/* Misc low power initializations. This function performs low power initializations that aren't specifically handled elsewhere. */
void am_hal_pwrctrl_low_power_init(void)
/* Misc low power initializations. This function performs low power initializations that aren't specifically handled elsewhere. */ void am_hal_pwrctrl_low_power_init(void)
{ AM_REG(PWRCTRL, SRAMCTRL) |= AM_REG_PWRCTRL_SRAMCTRL_SRAM_MASTER_CLKGATE_EN | AM_REG_PWRCTRL_SRAMCTRL_SRAM_CLKGATE_EN | AM_REG_PWRCTRL_SRAMCTRL_SRAM_LIGHT_SLEEP_DIS; AM_REG(PWRCTRL, SUPPLYSRC) &= ~AM_REG_PWRCTRL_SUPPLYSRC_SWITCH_LDO_IN_SLEEP_M; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Selects master trigger output source of the Timer. */
void TimerMasterOutputSrcSelect(unsigned long ulBase, unsigned long ulSelect)
/* Selects master trigger output source of the Timer. */ void TimerMasterOutputSrcSelect(unsigned long ulBase, unsigned long ulSelect)
{ xASSERT((ulBase == TIMER1_BASE) || (ulBase == TIMER0_BASE)); xASSERT((ulSelect == TIMER_MMSEL_RESET) || (ulSelect == TIMER_MMSEL_ENABLE) || (ulSelect == TIMER_MMSEL_UPDATE) || (ulSelect == TIMER_MMSEL_CH0CC) || (ulSelect == TIMER_MMSEL_CH0OREF) || (ulSelect == TIMER_MMSEL_CH1OREF) || (ulSelect == TIMER_MMSEL_CH2OREF) || (ulSelect == TIMER_MMSEL_CH3OREF)); xHWREG(ulBase + TIMER_MDCFR) &= ~TIMER_MDCFR_MMSEL_M; xHWREG(ulBase + TIMER_MDCFR) |= ulSelect; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* During commit it is sometimes necessary to copy a pnode (see dirty_cow_pnode). When that happens, references in category lists and heaps must be replaced. This function does that. */
static void replace_cats(struct ubifs_info *c, struct ubifs_pnode *old_pnode, struct ubifs_pnode *new_pnode)
/* During commit it is sometimes necessary to copy a pnode (see dirty_cow_pnode). When that happens, references in category lists and heaps must be replaced. This function does that. */ static void replace_cats(struct ubifs_info *c, struct ubifs_pnode *old_pnode, struct ubifs_pnode *new_pnode)
{ int i; for (i = 0; i < UBIFS_LPT_FANOUT; i++) { if (!new_pnode->lprops[i].lnum) return; ubifs_replace_cat(c, &old_pnode->lprops[i], &new_pnode->lprops[i]); } }
EmcraftSystems/u-boot
C++
Other
181
/* Read a data from a slave when the bus is idle, and waiting for all bus transmiton complete.(Read Step1) This function is usually used in thread mode. */
unsigned long I2CMasterReadS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char *pucData, xtBoolean bEndTransmition)
/* Read a data from a slave when the bus is idle, and waiting for all bus transmiton complete.(Read Step1) This function is usually used in thread mode. */ unsigned long I2CMasterReadS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char *pucData, xtBoolean bEndTransmition)
{ unsigned long ulStatus; xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE))); xASSERT(pucData); xI2CMasterReadRequestS1(ulBase, ucSlaveAddr, xfalse); SysCtlDelay(100); xHWREGB(ulBase + I2C_STATUS) |= I2C_STATUS_IF; while (!(xHWREGB(ulBase + I2C_STATUS) & I2C_STATUS_IF)); *pucData = xHWREGB(ulBase + I2C_DAT); ulStatus = (xHWREGB(ulBase + I2C_STATUS)); if (ulStatus != I2C_MASTER_EVENT_RX) { ulStatus = xI2CMasterError(ulBase); I2CStopSend(ulBase); return ulStatus; } if(bEndTransmition) { I2CStopSend(ulBase); } return xI2C_MASTER_ERR_NONE; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Check that a directory does not belong to a directory hierarchy being attached and not validated yet. @sd configfs_dirent of the directory to check */
int configfs_dirent_is_ready(struct configfs_dirent *sd)
/* Check that a directory does not belong to a directory hierarchy being attached and not validated yet. @sd configfs_dirent of the directory to check */ int configfs_dirent_is_ready(struct configfs_dirent *sd)
{ int ret; spin_lock(&configfs_dirent_lock); ret = !(sd->s_type & CONFIGFS_USET_CREATING); spin_unlock(&configfs_dirent_lock); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* pcmcia_do_loop_config() is the internal callback for the call from pcmcia_loop_config() to pccard_loop_tuple(). Data is transferred by a struct */
static int pcmcia_do_loop_config(tuple_t *tuple, cisparse_t *parse, void *priv)
/* pcmcia_do_loop_config() is the internal callback for the call from pcmcia_loop_config() to pccard_loop_tuple(). Data is transferred by a struct */ static int pcmcia_do_loop_config(tuple_t *tuple, cisparse_t *parse, void *priv)
{ cistpl_cftable_entry_t *cfg = &parse->cftable_entry; struct pcmcia_cfg_mem *cfg_mem = priv; cfg_mem->p_dev->conf.ConfigIndex = cfg->index; if (cfg->flags & CISTPL_CFTABLE_DEFAULT) cfg_mem->dflt = *cfg; return cfg_mem->conf_check(cfg_mem->p_dev, cfg, &cfg_mem->dflt, cfg_mem->p_dev->socket->socket.Vcc, cfg_mem->priv_data); }
robutest/uclinux
C++
GPL-2.0
60
/* Virtual COM Port change communication settings. The function changes communication settings of the port used as the Virtual COM Port. */
int32_t USBD_CDC_ACM_PortSetLineCoding(CDC_LINE_CODING *line_coding)
/* Virtual COM Port change communication settings. The function changes communication settings of the port used as the Virtual COM Port. */ int32_t USBD_CDC_ACM_PortSetLineCoding(CDC_LINE_CODING *line_coding)
{ UART_Config.Baudrate = line_coding->dwDTERate; UART_Config.DataBits = (UART_DataBits) line_coding->bDataBits; UART_Config.Parity = (UART_Parity) line_coding->bParityType; UART_Config.StopBits = (UART_StopBits) line_coding->bCharFormat; UART_Config.FlowControl = UART_FLOW_CONTROL_NONE; return uart_set_configuration(&UART_Config); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Return: The number of bytes successfully transmitted or a negative error code on failure. */
ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, u8 cmd, const void *data, size_t len)
/* Return: The number of bytes successfully transmitted or a negative error code on failure. */ ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, u8 cmd, const void *data, size_t len)
{ ssize_t err; size_t size; u8 *tx; if (len > 0) { size = 1 + len; tx = kmalloc(size, GFP_KERNEL); if (!tx) return -ENOMEM; tx[0] = cmd; memcpy(&tx[1], data, len); } else { tx = &cmd; size = 1; } err = mipi_dsi_dcs_write_buffer(dsi, tx, size); if (len > 0) kfree(tx); return err; }
4ms/stm32mp1-baremetal
C++
Other
137
/* SPI Standard Mode selection. Set SPI standard Modes */
void spi_set_standard_mode(uint32_t spi, uint8_t mode)
/* SPI Standard Mode selection. Set SPI standard Modes */ void spi_set_standard_mode(uint32_t spi, uint8_t mode)
{ if (mode > 3) { return; } uint32_t reg32 = SPI_CR1(spi) & ~(SPI_CR1_CPOL | SPI_CR1_CPHA); SPI_CR1(spi) = reg32 | mode; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Process metric steps for packet with packet sequence number Called by oonf_api after the whole packet was processed */
static enum rfc5444_result _nhdp_pkt_end_cb(struct rfc5444_reader_tlvblock_context *context, bool dropped __attribute__((unused)))
/* Process metric steps for packet with packet sequence number Called by oonf_api after the whole packet was processed */ static enum rfc5444_result _nhdp_pkt_end_cb(struct rfc5444_reader_tlvblock_context *context, bool dropped __attribute__((unused)))
{ if ((originator_link_tuple != NULL) && (context->has_pktseqno)) { iib_process_metric_pckt(originator_link_tuple, lt_metric_val, context->pkt_seqno); } originator_link_tuple = NULL; lt_metric_val = NHDP_METRIC_UNKNOWN; return RFC5444_OKAY; }
labapart/polymcu
C++
null
201
/* Enable the PWM output of the PWM module. The */
void xPWMOutputEnable(unsigned long ulBase, unsigned long ulChannel)
/* Enable the PWM output of the PWM module. The */ void xPWMOutputEnable(unsigned long ulBase, unsigned long ulChannel)
{ unsigned long ulChannelTemp; ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4); xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE)); xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3))); xHWREG(ulBase + PWM_POE) |= (PWM_POE_PWM0 << (ulChannelTemp)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* ps3_repository_read_pu_id - Read the logical PU id. @pu_index: Zero based index. @pu_id: The logical PU id. */
int ps3_repository_read_pu_id(unsigned int pu_index, u64 *pu_id)
/* ps3_repository_read_pu_id - Read the logical PU id. @pu_index: Zero based index. @pu_id: The logical PU id. */ int ps3_repository_read_pu_id(unsigned int pu_index, u64 *pu_id)
{ return read_node(PS3_LPAR_ID_CURRENT, make_first_field("bi", 0), make_field("pu", pu_index), 0, 0, pu_id, NULL); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base XRDC2 peripheral base address. param mem The memory region to operate. retval kStatus_Fail Failed to lock. retval kStatus_Success Locked succussfully. */
status_t XRDC2_TryLockMemExclAccess(XRDC2_Type *base, xrdc2_mem_t mem)
/* param base XRDC2 peripheral base address. param mem The memory region to operate. retval kStatus_Fail Failed to lock. retval kStatus_Success Locked succussfully. */ status_t XRDC2_TryLockMemExclAccess(XRDC2_Type *base, xrdc2_mem_t mem)
{ status_t status; uint8_t curDomainID; uint32_t mrc = XRDC2_GET_MRC((uint32_t)mem); uint32_t mrgd = XRDC2_GET_MRGD((uint32_t)mem); volatile uint32_t *lockReg = &(base->MRCI_MRGDJ[mrc][mrgd].MRC_MRGD_W6); curDomainID = XRDC2_GetCurrentMasterDomainId(base); *lockReg = XRDC2_EAL_LOCKED; if (curDomainID != XRDC2_GetMemExclAccessLockDomainOwner(base, mem)) { status = kStatus_Fail; } else { status = kStatus_Success; } return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* @type: HOB type to search @hob_list: A pointer to the HOB list */
const struct hob_header* hob_get_next_hob(uint type, const void *hob_list)
/* @type: HOB type to search @hob_list: A pointer to the HOB list */ const struct hob_header* hob_get_next_hob(uint type, const void *hob_list)
{ const struct hob_header *hdr; hdr = hob_list; while (!end_of_hob(hdr)) { if (hdr->type == type) return hdr; hdr = get_next_hob(hdr); } return NULL; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Destroy all the pci device node under the bridge. Bridge itself is not included. */
VOID DestroyPciDeviceTree(IN PCI_IO_DEVICE *Bridge)
/* Destroy all the pci device node under the bridge. Bridge itself is not included. */ VOID DestroyPciDeviceTree(IN PCI_IO_DEVICE *Bridge)
{ LIST_ENTRY *CurrentLink; PCI_IO_DEVICE *Temp; while (!IsListEmpty (&Bridge->ChildList)) { CurrentLink = Bridge->ChildList.ForwardLink; RemoveEntryList (CurrentLink); Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink); if (!IsListEmpty (&Temp->ChildList)) { DestroyPciDeviceTree (Temp); } FreePciDevice (Temp); } }
tianocore/edk2
C++
Other
4,240
/* LOCKING: host lock, or some other form of serialization. */
void ata_port_disable(struct ata_port *ap)
/* LOCKING: host lock, or some other form of serialization. */ void ata_port_disable(struct ata_port *ap)
{ ap->link.device[0].class = ATA_DEV_NONE; ap->link.device[1].class = ATA_DEV_NONE; ap->flags |= ATA_FLAG_DISABLED; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Add a reference to the global map of cpus to pools (and vice versa). Initialise the map if we're the first user. Returns the number of pools. */
static unsigned int svc_pool_map_get(void)
/* Add a reference to the global map of cpus to pools (and vice versa). Initialise the map if we're the first user. Returns the number of pools. */ static unsigned int svc_pool_map_get(void)
{ struct svc_pool_map *m = &svc_pool_map; int npools = -1; mutex_lock(&svc_pool_map_mutex); if (m->count++) { mutex_unlock(&svc_pool_map_mutex); return m->npools; } if (m->mode == SVC_POOL_AUTO) m->mode = svc_pool_map_choose_mode(); switch (m->mode) { case SVC_POOL_PERCPU: npools = svc_pool_map_init_percpu(m); break; case SVC_POOL_PERNODE: npools = svc_pool_map_init_pernode(m); break; } if (npools < 0) { npools = 1; m->mode = SVC_POOL_GLOBAL; } m->npools = npools; mutex_unlock(&svc_pool_map_mutex); return m->npools; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* MIMO (dual stream) requires at least 2, but works better with 3. This does not determine */
static int iwl_get_active_rx_chain_count(struct iwl_priv *priv)
/* MIMO (dual stream) requires at least 2, but works better with 3. This does not determine */ static int iwl_get_active_rx_chain_count(struct iwl_priv *priv)
{ if (is_single_rx_stream(priv)) return IWL_NUM_RX_CHAINS_SINGLE; else return IWL_NUM_RX_CHAINS_MULTIPLE; }
robutest/uclinux
C++
GPL-2.0
60
/* Check if the daylight is valid. Valid values are: 0 : Time is not affected. 1 : Time is affected, and has not been adjusted for daylight savings. 3 : Time is affected, and has been adjusted for daylight savings. All other values are invalid. */
BOOLEAN EFIAPI IsValidDaylight(IN INT8 Daylight)
/* Check if the daylight is valid. Valid values are: 0 : Time is not affected. 1 : Time is affected, and has not been adjusted for daylight savings. 3 : Time is affected, and has been adjusted for daylight savings. All other values are invalid. */ BOOLEAN EFIAPI IsValidDaylight(IN INT8 Daylight)
{ return Daylight == 0 || Daylight == EFI_TIME_ADJUST_DAYLIGHT || Daylight == (EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT); }
tianocore/edk2
C++
Other
4,240
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeOneWire(uint32_t ui32Port, uint8_t ui8Pins)
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIOPinTypeOneWire(uint32_t ui32Port, uint8_t ui8Pins)
{ ASSERT(_GPIOBaseValid(ui32Port)); GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW); GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the USB Host Speed from the Low Level Driver. */
USBH_SpeedTypeDef USBH_LL_GetSpeed(USBH_HandleTypeDef *phost)
/* Returns the USB Host Speed from the Low Level Driver. */ USBH_SpeedTypeDef USBH_LL_GetSpeed(USBH_HandleTypeDef *phost)
{ USBH_SpeedTypeDef speed = USBH_SPEED_FULL; switch (HAL_HCD_GetCurrentSpeed(phost->pData)) { case 0: speed = USBH_SPEED_HIGH; break; case 1: speed = USBH_SPEED_FULL; break; case 2: speed = USBH_SPEED_LOW; break; default: speed = USBH_SPEED_FULL; break; } return speed; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Enables offset cancellation in single measurement mode. The OFF_CANC bit must be set to 1 when enabling offset cancellation in single measurement mode this means a call function: set_rst_mode(SENS_OFF_CANC_EVERY_ODR) is need.. */
int32_t lis2mdl_set_rst_sensor_single_get(stmdev_ctx_t *ctx, uint8_t *val)
/* Enables offset cancellation in single measurement mode. The OFF_CANC bit must be set to 1 when enabling offset cancellation in single measurement mode this means a call function: set_rst_mode(SENS_OFF_CANC_EVERY_ODR) is need.. */ int32_t lis2mdl_set_rst_sensor_single_get(stmdev_ctx_t *ctx, uint8_t *val)
{ lis2mdl_cfg_reg_b_t reg; int32_t ret; ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_B, (uint8_t*)&reg, 1); *val = reg.off_canc_one_shot; return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
{ if(hadc->Instance==ADC1) { __HAL_RCC_ADC1_CLK_DISABLE(); } else if(hadc->Instance==ADC3) { __HAL_RCC_ADC3_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOF, GPIO_PIN_10); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Make sure there's writeable room. Wait for room if we can, otherwise return an appropriate error. */
static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
/* Make sure there's writeable room. Wait for room if we can, otherwise return an appropriate error. */ static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
{ int ret; if (pipe->nrbufs < PIPE_BUFFERS) return 0; ret = 0; pipe_lock(pipe); while (pipe->nrbufs >= PIPE_BUFFERS) { if (!pipe->readers) { send_sig(SIGPIPE, current, 0); ret = -EPIPE; break; } if (flags & SPLICE_F_NONBLOCK) { ret = -EAGAIN; break; } if (signal_pending(current)) { ret = -ERESTARTSYS; break; } pipe->waiting_writers++; pipe_wait(pipe); pipe->waiting_writers--; } pipe_unlock(pipe); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Find the first mapping in the list matching the one we want. */
static struct if_mapping* mapping_find(struct if_mapping *target)
/* Find the first mapping in the list matching the one we want. */ static struct if_mapping* mapping_find(struct if_mapping *target)
{ struct if_mapping * ifnode; int i; for(ifnode = mapping_list; ifnode != NULL; ifnode = ifnode->next) { int matches = 1; for(i = 0; i < SELECT_NUM; i++) { if(ifnode->active[i] != 0) { if((target->active[i] == 0) || (selector_list[i].cmp_fn(ifnode, target) != 0)) { matches = 0; break; } } } if(matches) return(ifnode); } return(NULL); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This routine is required by IAR DLIB library since EWAVR V6.10 the implementation is empty to be compatible with old IAR version. */
long __lseek(int handle, long val, int val2)
/* This routine is required by IAR DLIB library since EWAVR V6.10 the implementation is empty to be compatible with old IAR version. */ long __lseek(int handle, long val, int val2)
{ (void)(handle); (void)(val2); return val; }
eclipse-threadx/getting-started
C++
Other
310
/* this function is a POSIX compliant version, which will reset directory stream. */
void rewinddir(DIR *d)
/* this function is a POSIX compliant version, which will reset directory stream. */ void rewinddir(DIR *d)
{ if (d && d->fd > 0) { if (dfs_file_lseek(fd_get(d->fd), 0, SEEK_SET) >= 0) d->num = d->cur = 0; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* In all cases, LCD controller register values are preserved across these resets. */
void LCDClockReset(uint32_t ui32Base, uint32_t ui32Clocks)
/* In all cases, LCD controller register values are preserved across these resets. */ void LCDClockReset(uint32_t ui32Base, uint32_t ui32Clocks)
{ ASSERT(ui32Base == LCD0_BASE); ASSERT(!(ui32Clocks & ~(LCD_CLOCK_MAIN | LCD_CLOCK_LIDD | LCD_CLOCK_DMA | LCD_CLOCK_CORE))); HWREG(LCD0_BASE + 0x70) = ui32Clocks; SysCtlDelay(10); HWREG(LCD0_BASE + 0x70) = 0x00000000; SysCtlDelay(10); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciExpressAnd32(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 PciExpressAnd32(IN UINTN Address, IN UINT32 AndData)
{ if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) { return (UINT32)-1; } return MmioAnd32 (GetPciExpressAddress (Address), AndData); }
tianocore/edk2
C++
Other
4,240
/* Set the chip active time (idle time before it enters halt). */
static void lm8323_set_active_time(struct lm8323_chip *lm, int time)
/* Set the chip active time (idle time before it enters halt). */ static void lm8323_set_active_time(struct lm8323_chip *lm, int time)
{ lm8323_write(lm, 2, LM8323_CMD_SET_ACTIVE, time >> 2); }
robutest/uclinux
C++
GPL-2.0
60
/* Set the USCI_SPI bus clock. Only available in Master mode. */
uint32_t USPI_SetBusClock(USPI_T *uspi, uint32_t u32BusClock)
/* Set the USCI_SPI bus clock. Only available in Master mode. */ uint32_t USPI_SetBusClock(USPI_T *uspi, uint32_t u32BusClock)
{ uint32_t u32ClkDiv; uint32_t u32Pclk; if (uspi == USPI0) { u32Pclk = CLK_GetPCLK0Freq(); } else { u32Pclk = CLK_GetPCLK1Freq(); } u32ClkDiv = (uint32_t)((((((u32Pclk / 2UL) * 10UL) / (u32BusClock)) + 5UL) / 10UL) - 1UL); uspi->BRGEN &= ~USPI_BRGEN_CLKDIV_Msk; uspi->BRGEN |= (u32ClkDiv << USPI_BRGEN_CLKDIV_Pos); return (u32Pclk / ((u32ClkDiv + 1UL) << 1UL)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* calculate_totalreserve_pages - called when sysctl_lower_zone_reserve_ratio or min_free_kbytes changes. */
static void calculate_totalreserve_pages(void)
/* calculate_totalreserve_pages - called when sysctl_lower_zone_reserve_ratio or min_free_kbytes changes. */ static void calculate_totalreserve_pages(void)
{ struct pglist_data *pgdat; unsigned long reserve_pages = 0; enum zone_type i, j; for_each_online_pgdat(pgdat) { for (i = 0; i < MAX_NR_ZONES; i++) { struct zone *zone = pgdat->node_zones + i; unsigned long max = 0; for (j = i; j < MAX_NR_ZONES; j++) { if (zone->lowmem_reserve[j] > max) max = zone->lowmem_reserve[j]; } max += high_wmark_pages(zone); if (max > zone->present_pages) max = zone->present_pages; reserve_pages += max; } } totalreserve_pages = reserve_pages; }
robutest/uclinux
C++
GPL-2.0
60
/* 7.3.2.4 Access unit delimiter RBSP syntax access_unit_delimiter_rbsp( ) */
static void dissect_h264_access_unit_delimiter_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
/* 7.3.2.4 Access unit delimiter RBSP syntax access_unit_delimiter_rbsp( ) */ static void dissect_h264_access_unit_delimiter_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
{ proto_tree_add_expert(tree, pinfo, &ei_h264_undecoded, tvb, offset, -1); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */
status_t HAL_CODEC_SGTL5000_Init(void *handle, void *config)
/* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */ status_t HAL_CODEC_SGTL5000_Init(void *handle, void *config)
{ assert((config != NULL) && (handle != NULL)); codec_config_t *codecConfig = (codec_config_t *)config; sgtl_config_t *devConfig = (sgtl_config_t *)(codecConfig->codecDevConfig); sgtl_handle_t *devHandle = (sgtl_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)); ((codec_handle_t *)handle)->codecCapability = &s_sgtl5000_capability; return SGTL_Init(devHandle, devConfig); }
eclipse-threadx/getting-started
C++
Other
310
/* Enable time stamp snapshot for IPV6 frames. When enabled, time stamp snapshot is taken for IPV6 frames Reserved when "Advanced Time Stamp" is not selected */
void synopGMAC_TS_IPV6_enable(synopGMACdevice *gmacdev)
/* Enable time stamp snapshot for IPV6 frames. When enabled, time stamp snapshot is taken for IPV6 frames Reserved when "Advanced Time Stamp" is not selected */ void synopGMAC_TS_IPV6_enable(synopGMACdevice *gmacdev)
{ synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSIPV6ENA); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Description: This function grabs an extra reference to @buf. It's used in in the tee() system call, when we duplicate the buffers in one pipe into another. */
void generic_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *buf)
/* Description: This function grabs an extra reference to @buf. It's used in in the tee() system call, when we duplicate the buffers in one pipe into another. */ void generic_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *buf)
{ page_cache_get(buf->page); }
robutest/uclinux
C++
GPL-2.0
60
/* Calculate the device context index by endpoint address and direction. */
UINT8 XhcPeiEndpointToDci(IN UINT8 EpAddr, IN EFI_USB_DATA_DIRECTION Direction)
/* Calculate the device context index by endpoint address and direction. */ UINT8 XhcPeiEndpointToDci(IN UINT8 EpAddr, IN EFI_USB_DATA_DIRECTION Direction)
{ UINT8 Index; ASSERT (EpAddr <= 15); if (EpAddr == 0) { return 1; } else { Index = (UINT8)(2 * EpAddr); if (Direction == EfiUsbDataIn) { Index += 1; } return Index; } }
tianocore/edk2
C++
Other
4,240
/* Push packet to the tx packet queue and notity the wfx process thread */
static UINT nx_sl_driver_packet_enqueue(NX_PACKET *packet_ptr)
/* Push packet to the tx packet queue and notity the wfx process thread */ static UINT nx_sl_driver_packet_enqueue(NX_PACKET *packet_ptr)
{ UINT status = NX_SUCCESS; sl_wfx_tx_lock(); sl_wfx_packet_enqueue(packet_ptr); status = sl_wfx_process_notify(SL_WFX_TX_PACKET_AVAILABLE); sl_wfx_tx_unlock(); return status; }
eclipse-threadx/getting-started
C++
Other
310
/* History LAPB 001 Jonathan Naylor Started Coding This routine purges all the queues of frames. */
void lapb_clear_queues(struct lapb_cb *lapb)
/* History LAPB 001 Jonathan Naylor Started Coding This routine purges all the queues of frames. */ void lapb_clear_queues(struct lapb_cb *lapb)
{ skb_queue_purge(&lapb->write_queue); skb_queue_purge(&lapb->ack_queue); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables control interrupts on a given USB controller. */
void USBIntEnableControl(uint32_t ui32Base, uint32_t ui32Flags)
/* Enables control interrupts on a given USB controller. */ void USBIntEnableControl(uint32_t ui32Base, uint32_t ui32Flags)
{ ASSERT(ui32Base == USB0_BASE); ASSERT((ui32Flags & (~USB_INTCTRL_ALL)) == 0); if(ui32Flags & USB_INTCTRL_STATUS) { HWREGB(ui32Base + USB_O_IE) |= ui32Flags; } if(ui32Flags & USB_INTCTRL_POWER_FAULT) { HWREG(ui32Base + USB_O_EPCIM) = USB_EPCIM_PF; } if(ui32Flags & USB_INTCTRL_MODE_DETECT) { HWREG(USB0_BASE + USB_O_IDVIM) = USB_IDVIM_ID; } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* It is possible to use this function if @dwork rearms itself via queue_work() or queue_delayed_work(). See also the comment for cancel_work_sync(). */
int cancel_delayed_work_sync(struct delayed_work *dwork)
/* It is possible to use this function if @dwork rearms itself via queue_work() or queue_delayed_work(). See also the comment for cancel_work_sync(). */ int cancel_delayed_work_sync(struct delayed_work *dwork)
{ return __cancel_work_timer(&dwork->work, &dwork->timer); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* zfcp_qdio_sbale_req - return ptr to SBALE of req_q for a struct zfcp_fsf_req @qdio: pointer to struct zfcp_qdio @q_rec: pointer to struct zfcp_queue_rec Returns: pointer to qdio_buffer_element (SBALE) structure */
struct qdio_buffer_element* zfcp_qdio_sbale_req(struct zfcp_qdio *qdio, struct zfcp_queue_req *q_req)
/* zfcp_qdio_sbale_req - return ptr to SBALE of req_q for a struct zfcp_fsf_req @qdio: pointer to struct zfcp_qdio @q_rec: pointer to struct zfcp_queue_rec Returns: pointer to qdio_buffer_element (SBALE) structure */ struct qdio_buffer_element* zfcp_qdio_sbale_req(struct zfcp_qdio *qdio, struct zfcp_queue_req *q_req)
{ return zfcp_qdio_sbale(&qdio->req_q, q_req->sbal_last, 0); }
robutest/uclinux
C++
GPL-2.0
60
/* igb_read_clock - read raw cycle counter (to be used by time counter) */
static cycle_t igb_read_clock(const struct cyclecounter *tc)
/* igb_read_clock - read raw cycle counter (to be used by time counter) */ static cycle_t igb_read_clock(const struct cyclecounter *tc)
{ struct igb_adapter *adapter = container_of(tc, struct igb_adapter, cycles); struct e1000_hw *hw = &adapter->hw; u64 stamp = 0; int shift = 0; if (hw->mac.type == e1000_82580) { stamp = rd32(E1000_SYSTIMR) >> 8; shift = IGB_82580_TSYNC_SHIFT; } stamp |= (u64)rd32(E1000_SYSTIML) << shift; stamp |= (u64)rd32(E1000_SYSTIMH) << (shift + 32); return stamp; }
robutest/uclinux
C++
GPL-2.0
60
/* Disables callback. Disables the callback specified by the callback_type. */
void rtc_calendar_disable_callback(struct rtc_module *const module, enum rtc_calendar_callback callback_type)
/* Disables callback. Disables the callback specified by the callback_type. */ void rtc_calendar_disable_callback(struct rtc_module *const module, enum rtc_calendar_callback callback_type)
{ Assert(module); Assert(module->hw); Rtc *const rtc_module = module->hw; if (callback_type == RTC_CALENDAR_CALLBACK_OVERFLOW) { rtc_module->MODE2.INTENCLR.reg = RTC_MODE2_INTFLAG_OVF; } else { rtc_module->MODE2.INTENCLR.reg = RTC_MODE2_INTFLAG_ALARM(1 << callback_type); } module->enabled_callback &= ~(1 << callback_type); }
memfault/zero-to-main
C++
null
200