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
/* Frees the hardware status page, whether it's a physical address or a virtual address set up by the X Server. */
static void i915_free_hws(struct drm_device *dev)
/* Frees the hardware status page, whether it's a physical address or a virtual address set up by the X Server. */ static void i915_free_hws(struct drm_device *dev)
{ drm_i915_private_t *dev_priv = dev->dev_private; if (dev_priv->status_page_dmah) { drm_pci_free(dev, dev_priv->status_page_dmah); dev_priv->status_page_dmah = NULL; } if (dev_priv->status_gfx_addr) { dev_priv->status_gfx_addr = 0; drm_core_ioremapfree(&dev_priv->hws_map, dev); } I915_WRITE(HWS_PGA, 0x1ffff000); }
robutest/uclinux
C++
GPL-2.0
60
/* Enables critical writes operation on a serial flash device, such as sector protection, status register, etc. */
void s25fl1xx_set_read_latency_control(struct qspid_t *qspid, uint8_t latency)
/* Enables critical writes operation on a serial flash device, such as sector protection, status register, etc. */ void s25fl1xx_set_read_latency_control(struct qspid_t *qspid, uint8_t latency)
{ uint8_t status[3]; status[0] = s25fl1xx_read_status1(qspid); status[1] = s25fl1xx_read_status2(qspid); status[2] = s25fl1xx_read_status3(qspid); status[2] |= latency; qspid->qspi_buffer.data_tx = (uint32_t *)&status[2]; while((status[2] & S25FL1XX_STATUS_LATENCY_CTRL) != latency) { s25fl1xx_write_volatile_status(qspid, status); status[2] = s25fl1xx_read_status3(qspid); delay_ms(50); } }
remotemcu/remcu-chip-sdks
C++
null
436
/* beiscsi_free_ep - free endpoint @ep: pointer to iscsi endpoint structure */
static void beiscsi_free_ep(struct iscsi_endpoint *ep)
/* beiscsi_free_ep - free endpoint @ep: pointer to iscsi endpoint structure */ static void beiscsi_free_ep(struct iscsi_endpoint *ep)
{ struct beiscsi_endpoint *beiscsi_ep = ep->dd_data; struct beiscsi_hba *phba = beiscsi_ep->phba; beiscsi_put_cid(phba, beiscsi_ep->ep_cid); beiscsi_ep->phba = NULL; iscsi_destroy_endpoint(ep); }
robutest/uclinux
C++
GPL-2.0
60
/* Completes a request by converting the data into events for the input subsystem. */
static void report_key(struct cm109_dev *dev, int key)
/* Completes a request by converting the data into events for the input subsystem. */ static void report_key(struct cm109_dev *dev, int key)
{ struct input_dev *idev = dev->idev; if (dev->key_code >= 0) { input_report_key(idev, dev->key_code, 0); } dev->key_code = key; if (key >= 0) { input_report_key(idev, key, 1); } input_sync(idev); }
robutest/uclinux
C++
GPL-2.0
60
/* Check the driver configuration if it's double buffered (both */
bool lv_disp_is_double_buf(lv_disp_t *disp)
/* Check the driver configuration if it's double buffered (both */ bool lv_disp_is_double_buf(lv_disp_t *disp)
{ if(disp->driver.buffer->buf1 && disp->driver.buffer->buf2) return true; else return false; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Disable tracing on the given ITM stimulus port. */
void am_hal_itm_trace_port_disable(uint8_t ui8portNum)
/* Disable tracing on the given ITM stimulus port. */ void am_hal_itm_trace_port_disable(uint8_t ui8portNum)
{ AM_REGVAL(AM_REG_ITM_TPR_O) &= ~(0x00000001 << (ui8portNum >> 3)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Calculate the logical drive number based on the information in scsi command and the channel number. */
static int mega_get_ldrv_num(adapter_t *adapter, Scsi_Cmnd *cmd, int channel)
/* Calculate the logical drive number based on the information in scsi command and the channel number. */ static int mega_get_ldrv_num(adapter_t *adapter, Scsi_Cmnd *cmd, int channel)
{ int tgt; int ldrv_num; tgt = cmd->device->id; if ( tgt > adapter->this_id ) tgt--; ldrv_num = (channel * 15) + tgt; if( adapter->boot_ldrv_enabled ) { if( ldrv_num == 0 ) { ldrv_num = adapter->boot_ldrv; } else { if( ldrv_num <= adapter->boot_ldrv ) { ldrv_num--; } } } if (adapter->support_random_del && adapter->read_ldidmap ) switch (cmd->cmnd[0]) { case READ_6: case WRITE_6: case READ_10: case WRITE_10: ldrv_num += 0x80; } return ldrv_num; }
robutest/uclinux
C++
GPL-2.0
60
/* Add the NewNode to the head of the variable list of arguments of the ParentNode. */
EFI_STATUS EFIAPI AmlVarListAddHead(IN AML_NODE_HEADER *ParentNode, IN AML_NODE_HEADER *NewNode)
/* Add the NewNode to the head of the variable list of arguments of the ParentNode. */ EFI_STATUS EFIAPI AmlVarListAddHead(IN AML_NODE_HEADER *ParentNode, IN AML_NODE_HEADER *NewNode)
{ EFI_STATUS Status; UINT32 NewSize; LIST_ENTRY *ChildrenList; if ((!IS_AML_ROOT_NODE (ParentNode) && !IS_AML_OBJECT_NODE (ParentNode)) || (!IS_AML_DATA_NODE (NewNode) && !IS_AML_OBJECT_NODE (NewNode)) || !AML_NODE_IS_DETACHED (NewNode)) { ASSERT (0); return EFI_INVALID_PARAMETER; } ChildrenList = AmlNodeGetVariableArgList (ParentNode); if (ChildrenList == NULL) { ASSERT (0); return EFI_INVALID_PARAMETER; } InsertHeadList (ChildrenList, &NewNode->Link); NewNode->Parent = ParentNode; Status = AmlComputeSize (NewNode, &NewSize); if (EFI_ERROR (Status)) { ASSERT (0); return Status; } Status = AmlPropagateInformation (ParentNode, TRUE, NewSize, 1); ASSERT_EFI_ERROR (Status); return Status; }
tianocore/edk2
C++
Other
4,240
/* NOTE: If the regulator is disabled it will return the current value. This function should not be used to determine regulator state. */
int regulator_get_current_limit(struct regulator *regulator)
/* NOTE: If the regulator is disabled it will return the current value. This function should not be used to determine regulator state. */ int regulator_get_current_limit(struct regulator *regulator)
{ return _regulator_get_current_limit(regulator->rdev); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check if the block is marked as reserved. */
static int nand_block_isreserved(struct mtd_info *mtd, loff_t ofs)
/* Check if the block is marked as reserved. */ static int nand_block_isreserved(struct mtd_info *mtd, loff_t ofs)
{ struct nand_chip *chip = mtd_to_nand(mtd); if (!chip->bbt) return 0; return nand_isreserved_bbt(mtd, ofs); }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function gets the channel sequencer mode from the Configuration Register 1. */
u8 XAdcPs_GetSequencerMode(XAdcPs *InstancePtr)
/* This function gets the channel sequencer mode from the Configuration Register 1. */ u8 XAdcPs_GetSequencerMode(XAdcPs *InstancePtr)
{ Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); return ((u8) ((XAdcPs_ReadInternalReg(InstancePtr, XADCPS_CFR1_OFFSET) & XADCPS_CFR1_SEQ_VALID_MASK) >> XADCPS_CFR1_SEQ_SHIFT)); }
ua1arn/hftrx
C++
null
69
/* This is easy using the virtual page table address. */
static void* find_pa(unsigned long *vptb, void *ptr)
/* This is easy using the virtual page table address. */ static void* find_pa(unsigned long *vptb, void *ptr)
{ unsigned long address = (unsigned long) ptr; unsigned long result; result = vptb[address >> 13]; result >>= 32; result <<= 13; result |= address & 0x1fff; return (void *) result; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set frame size (making an assumption that the supplied size is supported by this controller) */
static int spi_stm32_hw_bt_set(struct spi_stm32 *c, int bt)
/* Set frame size (making an assumption that the supplied size is supported by this controller) */ static int spi_stm32_hw_bt_set(struct spi_stm32 *c, int bt)
{ unsigned int v = readl(&SPI(c)->spi_cr1); int ret = 0; if (bt == 8) { v &= ~SPI_CR1_DFF; } else { v |= SPI_CR1_DFF; } writel(v, &SPI(c)->spi_cr1); d_printk(2, "bus=%d,bt=%d,spi_cr1=%x,ret=%d\n", c->bus, bt, readl(&SPI(c)->spi_cr1), ret); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* This function frees any allocated memory for input buffers and resets input state. */
void eap_peer_tls_reset_input(struct eap_ssl_data *data)
/* This function frees any allocated memory for input buffers and resets input state. */ void eap_peer_tls_reset_input(struct eap_ssl_data *data)
{ data->tls_in_left = data->tls_in_total = 0; wpabuf_free(data->tls_in); data->tls_in = NULL; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* This function is used to Start the DMA controller by Wrap. */
unsigned char tls_dma_start_by_wrap(unsigned char ch, struct tls_dma_descriptor *dma_desc, unsigned char auto_reload, unsigned short src_zize, unsigned short dest_zize)
/* This function is used to Start the DMA controller by Wrap. */ unsigned char tls_dma_start_by_wrap(unsigned char ch, struct tls_dma_descriptor *dma_desc, unsigned char auto_reload, unsigned short src_zize, unsigned short dest_zize)
{ if((ch > 7) && !dma_desc) return 1; DMA_SRCWRAPADDR_REG(ch) = dma_desc->src_addr; DMA_DESTWRAPADDR_REG(ch) = dma_desc->dest_addr; DMA_WRAPSIZE_REG(ch) = (dest_zize << 16) | src_zize; DMA_CTRL_REG(ch) = ((dma_desc->dma_ctrl & 0x1ffff) << 1) | (auto_reload ? 0x1: 0x0); DMA_CHNLCTRL_REG(ch) |= DMA_CHNL_CTRL_CHNL_ON; return 0; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Writes the current value of MM1. This function is only available on IA32 and X64. */
VOID EFIAPI AsmWriteMm1(IN UINT64 Value)
/* Writes the current value of MM1. This function is only available on IA32 and X64. */ VOID EFIAPI AsmWriteMm1(IN UINT64 Value)
{ __asm__ __volatile__ ( "movq %0, %%mm1" : : "m" (Value) ); }
tianocore/edk2
C++
Other
4,240
/* Calls the @complete_interface_info function from the #GTypePluginClass of @plugin. There should be no need to use this function outside of the GObject type system itself. */
void g_type_plugin_complete_interface_info(GTypePlugin *plugin, GType instance_type, GType interface_type, GInterfaceInfo *info)
/* Calls the @complete_interface_info function from the #GTypePluginClass of @plugin. There should be no need to use this function outside of the GObject type system itself. */ void g_type_plugin_complete_interface_info(GTypePlugin *plugin, GType instance_type, GType interface_type, GInterfaceInfo *info)
{ GTypePluginClass *iface; g_return_if_fail (G_IS_TYPE_PLUGIN (plugin)); g_return_if_fail (info != NULL); iface = G_TYPE_PLUGIN_GET_CLASS (plugin); iface->complete_interface_info (plugin, instance_type, interface_type, info); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Move an address byte to the correspondent internal register. */
static void accept_addr_byte(struct nandsim *ns, u_char bt)
/* Move an address byte to the correspondent internal register. */ static void accept_addr_byte(struct nandsim *ns, u_char bt)
{ uint byte = (uint)bt; if (ns->regs.count < (ns->geom.pgaddrbytes - ns->geom.secaddrbytes)) ns->regs.column |= (byte << 8 * ns->regs.count); else { ns->regs.row |= (byte << 8 * (ns->regs.count - ns->geom.pgaddrbytes + ns->geom.secaddrbytes)); } return; }
robutest/uclinux
C++
GPL-2.0
60
/* edac_remove_mci_instance_attributes remove MC driver specific attributes at the topmost level directory of this mci instance. */
static void edac_remove_mci_instance_attributes(struct mem_ctl_info *mci)
/* edac_remove_mci_instance_attributes remove MC driver specific attributes at the topmost level directory of this mci instance. */ static void edac_remove_mci_instance_attributes(struct mem_ctl_info *mci)
{ struct mcidev_sysfs_attribute *sysfs_attrib; sysfs_attrib = mci->mc_driver_sysfs_attributes; while (sysfs_attrib && sysfs_attrib->attr.name) { sysfs_remove_file(&mci->edac_mci_kobj, (struct attribute *) sysfs_attrib); sysfs_attrib++; } }
robutest/uclinux
C++
GPL-2.0
60
/* bad_page_fault is called when we have a bad access from the kernel. It is called from the DSI and ISI handlers in head.S and from some of the procedures in traps.c. */
void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
/* bad_page_fault is called when we have a bad access from the kernel. It is called from the DSI and ISI handlers in head.S and from some of the procedures in traps.c. */ void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
{ const struct exception_table_entry *entry; if ((entry = search_exception_tables(regs->nip)) != NULL) { regs->nip = entry->fixup; return; } switch (regs->trap) { case 0x300: case 0x380: printk(KERN_ALERT "Unable to handle kernel paging request for " "data at address 0x%08lx\n", regs->dar); break; case 0x400: case 0x480: printk(KERN_ALERT "Unable to handle kernel paging request for " "instruction fetch\n"); break; default: printk(KERN_ALERT "Unable to handle kernel paging request for " "unknown fault\n"); break; } printk(KERN_ALERT "Faulting instruction address: 0x%08lx\n", regs->nip); die("Kernel access of bad area", regs, sig); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Determines if the UART is in mute mode or not. */
void UART_ReceiverWakeUpCmd(UART_TypeDef *uart, FunctionalState state)
/* Determines if the UART is in mute mode or not. */ void UART_ReceiverWakeUpCmd(UART_TypeDef *uart, FunctionalState state)
{ MODIFY_REG(uart->CCR, UART_CCR_RWU, state << UART_CCR_RWU_Pos); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Calculate the crc value of data by halfword. */
uint32_t ald_crc_calculate_halfword(ald_crc_handle_t *hperh, uint16_t *buf, uint32_t size)
/* Calculate the crc value of data by halfword. */ uint32_t ald_crc_calculate_halfword(ald_crc_handle_t *hperh, uint16_t *buf, uint32_t size)
{ uint32_t i; uint32_t ret; assert_param(IS_CRC(hperh->perh)); if (buf == NULL || size == 0) return 0; __LOCK(hperh); MODIFY_REG(hperh->perh->CR, CRC_CR_DATLEN_MSK, ALD_CRC_DATASIZE_16 << CRC_CR_DATLEN_POSS); hperh->state = ALD_CRC_STATE_BUSY; for (i = 0; i < size; i++) *((volatile uint16_t *)&(hperh->perh->DATA)) = buf[i]; ret = CRC->CHECKSUM; hperh->state = ALD_CRC_STATE_READY; __UNLOCK(hperh); return ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Find a property with a given name for a given node and return the value. */
const void* of_get_property(const struct device_node *np, const char *name, int *lenp)
/* Find a property with a given name for a given node and return the value. */ const void* of_get_property(const struct device_node *np, const char *name, int *lenp)
{ struct property *pp = of_find_property(np, name, lenp); return pp ? pp->value : NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Accept only packets explicitly sent to this node, or broadcast packets; ignores packets sent using Ethernet multicast, and traffic sent to other nodes (which can happen if interface is running in promiscuous mode). Routine truncates any Ethernet padding/CRC appended to the message, and ensures message size matches actual length */
static int recv_msg(struct sk_buff *buf, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
/* Accept only packets explicitly sent to this node, or broadcast packets; ignores packets sent using Ethernet multicast, and traffic sent to other nodes (which can happen if interface is running in promiscuous mode). Routine truncates any Ethernet padding/CRC appended to the message, and ensures message size matches actual length */ static int recv_msg(struct sk_buff *buf, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
{ struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv; u32 size; if (!net_eq(dev_net(dev), &init_net)) { kfree_skb(buf); return 0; } if (likely(eb_ptr->bearer)) { if (likely(buf->pkt_type <= PACKET_BROADCAST)) { size = msg_size((struct tipc_msg *)buf->data); skb_trim(buf, size); if (likely(buf->len == size)) { buf->next = NULL; tipc_recv_msg(buf, eb_ptr->bearer); return 0; } } } kfree_skb(buf); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set CITER and BITER in the DMA channel's TCD to iter. */
int kinetis_dma_ch_set_iter_num(int ch, u16 iter)
/* Set CITER and BITER in the DMA channel's TCD to iter. */ int kinetis_dma_ch_set_iter_num(int ch, u16 iter)
{ DMAAPI_LOCKED_BEGIN KINETIS_DMA->tcd[ch].citer = iter; KINETIS_DMA->tcd[ch].biter = iter; DMAAPI_LOCKED_END }
EmcraftSystems/linux-emcraft
C++
Other
266
/* A zone is low on free memory, so wake its kswapd task to service it. */
void wakeup_kswapd(struct zone *zone, int order)
/* A zone is low on free memory, so wake its kswapd task to service it. */ void wakeup_kswapd(struct zone *zone, int order)
{ pg_data_t *pgdat; if (!populated_zone(zone)) return; pgdat = zone->zone_pgdat; if (zone_watermark_ok(zone, order, low_wmark_pages(zone), 0, 0)) return; if (pgdat->kswapd_max_order < order) pgdat->kswapd_max_order = order; if (!cpuset_zone_allowed_hardwall(zone, GFP_KERNEL)) return; if (!waitqueue_active(&pgdat->kswapd_wait)) return; wake_up_interruptible(&pgdat->kswapd_wait); }
robutest/uclinux
C++
GPL-2.0
60
/* Packet receive callback function provided to IP_IO, used to call the proper function to handle the packet received by IP. */
VOID EFIAPI TcpRxCallback(IN EFI_STATUS Status, IN UINT8 IcmpErr, IN EFI_NET_SESSION_DATA *NetSession, IN NET_BUF *Pkt, IN VOID *Context OPTIONAL)
/* Packet receive callback function provided to IP_IO, used to call the proper function to handle the packet received by IP. */ VOID EFIAPI TcpRxCallback(IN EFI_STATUS Status, IN UINT8 IcmpErr, IN EFI_NET_SESSION_DATA *NetSession, IN NET_BUF *Pkt, IN VOID *Context OPTIONAL)
{ if (EFI_SUCCESS == Status) { TcpInput (Pkt, &NetSession->Source, &NetSession->Dest, NetSession->IpVersion); } else { TcpIcmpInput ( Pkt, IcmpErr, &NetSession->Source, &NetSession->Dest, NetSession->IpVersion ); } }
tianocore/edk2
C++
Other
4,240
/* Request the PE to send a Display Port status. */
USBPD_StatusTypeDef USBPD_DPM_RequestDisplayPortStatus(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID)
/* Request the PE to send a Display Port status. */ USBPD_StatusTypeDef USBPD_DPM_RequestDisplayPortStatus(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID)
{ return USBPD_PE_SVDM_RequestSpecific(PortNum, SOPType, SVDM_SPECIFIC_1, SVID); }
st-one/X-CUBE-USB-PD
C++
null
110
/* bank_is_io - return true if bank is (possibly) IO. @bank: The bank number. @bankcfg: The value of S3C2412_EBI_BANKCFG. */
static bool bank_is_io(unsigned int bank, u32 bankcfg)
/* bank_is_io - return true if bank is (possibly) IO. @bank: The bank number. @bankcfg: The value of S3C2412_EBI_BANKCFG. */ static bool bank_is_io(unsigned int bank, u32 bankcfg)
{ if (bank < 2) return true; return !(bankcfg & (1 << bank)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function is passed the number of inodes to scan, and it returns the total number of remaining possibly-reclaimable inodes. */
static int shrink_icache_memory(int nr, gfp_t gfp_mask)
/* This function is passed the number of inodes to scan, and it returns the total number of remaining possibly-reclaimable inodes. */ static int shrink_icache_memory(int nr, gfp_t gfp_mask)
{ if (nr) { if (!(gfp_mask & __GFP_FS)) return -1; prune_icache(nr); } return (inodes_stat.nr_unused / 100) * sysctl_vfs_cache_pressure; }
robutest/uclinux
C++
GPL-2.0
60
/* ASN1_ITEM version of dup: this follows the model above except we don't need to allocate the buffer. At some point this could be rewritten to directly dup the underlying structure instead of doing and encode and decode. */
void* ASN1_item_dup(const ASN1_ITEM *it, void *x)
/* ASN1_ITEM version of dup: this follows the model above except we don't need to allocate the buffer. At some point this could be rewritten to directly dup the underlying structure instead of doing and encode and decode. */ void* ASN1_item_dup(const ASN1_ITEM *it, void *x)
{ unsigned char *b = NULL; const unsigned char *p; long i; void *ret; if (x == NULL) return (NULL); i = ASN1_item_i2d(x, &b, it); if (b == NULL) { OPENSSL_PUT_ERROR(ASN1, ERR_R_MALLOC_FAILURE); return (NULL); } p = b; ret = ASN1_item_d2i(NULL, &p, i, it); OPENSSL_free(b); return (ret); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void)
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */ int main(void)
{ SetupHardware(); puts_P(PSTR(ESC_FG_CYAN "Mouse HID Host Demo running.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { MouseHost_Task(); USB_USBTask(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Enables or disables the RTC clock. This function must be used only after the RTC clock was selected using the RCC_RTCCLKConfig function. */
void RCC_RTCCLKCmd(FunctionalState NewState)
/* Enables or disables the RTC clock. This function must be used only after the RTC clock was selected using the RCC_RTCCLKConfig function. */ void RCC_RTCCLKCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RCC->BDCR |= 0x00008000; } else { RCC->BDCR &= 0xffff7fff; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function for starting the internal LFCLK XTAL oscillator. Note that when using a SoftDevice, LFCLK is always on. */
static ret_code_t clock_config(void)
/* Function for starting the internal LFCLK XTAL oscillator. Note that when using a SoftDevice, LFCLK is always on. */ static ret_code_t clock_config(void)
{ ret_code_t err_code; err_code = nrf_drv_clock_init(); if (err_code != NRF_SUCCESS) { return err_code; } nrf_drv_clock_lfclk_request(NULL); return NRF_SUCCESS; }
remotemcu/remcu-chip-sdks
C++
null
436
/* fills the memblock of <size> bytes from <startaddr> with walking bit pattern */
void RAM_MemTest_WriteWalkBit(unsigned long startaddr, unsigned long size)
/* fills the memblock of <size> bytes from <startaddr> with walking bit pattern */ void RAM_MemTest_WriteWalkBit(unsigned long startaddr, unsigned long size)
{ volatile unsigned long *p, *pe; unsigned long i; p = (unsigned long *) startaddr; pe = (unsigned long *) (startaddr + size); i = 0; while (p < pe) { *p = 1UL << i; i = (i + 1 + (((unsigned long) p) >> 7)) % 32; p++; } }
EmcraftSystems/u-boot
C++
Other
181
/* Move the cursor n unit to the left. */
void HD44780CursorLeftMove(unsigned char n)
/* Move the cursor n unit to the left. */ void HD44780CursorLeftMove(unsigned char n)
{ int i = n; while(i--) { while(HD44780Busy()); HD44780WriteCmd(HD44780_CMD_CURSOR_DISPLAY_SHIFT( HD44780_CURSOR_DISPLAY_SHIFT_SC_C | HD44780_CURSOR_DISPLAY_SHIFT_RL_L)); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Stop the two CAN controllers, CAN0 and CAN1. */
static int stop()
/* Stop the two CAN controllers, CAN0 and CAN1. */ static int stop()
{ BTASSERT(can_stop(&can0) == 0); BTASSERT(can_stop(&can1) == 0); return (0); }
eerimoq/simba
C++
Other
337
/* param base ASRC base pointer. param handle ASRC eDMA handle pointer. */
void ASRC_TransferOutAbortEDMA(ASRC_Type *base, asrc_edma_handle_t *handle)
/* param base ASRC base pointer. param handle ASRC eDMA handle pointer. */ void ASRC_TransferOutAbortEDMA(ASRC_Type *base, asrc_edma_handle_t *handle)
{ assert(handle != NULL); EDMA_AbortTransfer(handle->out.outDmaHandle); handle->out.asrcQueue[handle->out.queueDriver] = NULL; handle->out.queueDriver = (handle->out.queueDriver + 1U) % ASRC_XFER_QUEUE_SIZE; handle->out.state = kStatus_ASRCIdle; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Callback all the functions that want to be notified when inv_start_mpl() was called. */
inv_error_t inv_execute_mpl_start_notification(void)
/* Callback all the functions that want to be notified when inv_start_mpl() was called. */ inv_error_t inv_execute_mpl_start_notification(void)
{ inv_error_t result,first_error; int kk; first_error = INV_SUCCESS; for (kk = 0; kk < inv_start_cb.num_cb; ++kk) { result = inv_start_cb.start_cb[kk](); if (result && (first_error == INV_SUCCESS)) { first_error = result; } } return first_error; }
Luos-io/luos_engine
C++
MIT License
496
/* Selects a w1 channel. The 1-wire interface must be idle before calling this function. */
static int ds2482_set_channel(struct ds2482_data *pdev, u8 channel)
/* Selects a w1 channel. The 1-wire interface must be idle before calling this function. */ static int ds2482_set_channel(struct ds2482_data *pdev, u8 channel)
{ if (i2c_smbus_write_byte_data(pdev->client, DS2482_CMD_CHANNEL_SELECT, ds2482_chan_wr[channel]) < 0) return -1; pdev->read_prt = DS2482_PTR_CODE_CHANNEL; pdev->channel = -1; if (i2c_smbus_read_byte(pdev->client) == ds2482_chan_rd[channel]) { pdev->channel = channel; return 0; } return -1; }
robutest/uclinux
C++
GPL-2.0
60
/* bcm_rx_update_and_send - process a detected relevant receive content change */
static void bcm_rx_update_and_send(struct bcm_op *op, struct can_frame *lastdata, const struct can_frame *rxdata)
/* bcm_rx_update_and_send - process a detected relevant receive content change */ static void bcm_rx_update_and_send(struct bcm_op *op, struct can_frame *lastdata, const struct can_frame *rxdata)
{ memcpy(lastdata, rxdata, CFSIZ); lastdata->can_dlc |= (RX_RECV|RX_THR); if (!op->kt_ival2.tv64) { bcm_rx_changed(op, lastdata); return; } if (hrtimer_active(&op->thrtimer)) return; if (!op->kt_lastmsg.tv64) goto rx_changed_settime; if (ktime_us_delta(ktime_get(), op->kt_lastmsg) < ktime_to_us(op->kt_ival2)) { hrtimer_start(&op->thrtimer, ktime_add(op->kt_lastmsg, op->kt_ival2), HRTIMER_MODE_ABS); return; } rx_changed_settime: bcm_rx_changed(op, lastdata); op->kt_lastmsg = ktime_get(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This is the code that gets called on processor reset. To initialize the device, and call the main() routine. */
void Reset_Handler(void)
/* This is the code that gets called on processor reset. To initialize the device, and call the main() routine. */ void Reset_Handler(void)
{ uint32_t *pSrc, *pDest; pSrc = &_etext; pDest = &_srelocate; if (pSrc != pDest) { for (; pDest < &_erelocate;) { *pDest++ = *pSrc++; } } for (pDest = &_szero; pDest < &_ezero;) { *pDest++ = 0; } pSrc = (uint32_t *) & _sfixed; SCB->VTOR = ((uint32_t) pSrc & SCB_VTOR_TBLOFF_Msk); if (((uint32_t) pSrc >= IRAM0_ADDR) && ((uint32_t) pSrc < NFC_RAM_ADDR)) { SCB->VTOR |= 1 << SCB_VTOR_TBLBASE_Pos; } __libc_init_array(); main(); while (1); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Programs flash with data at locations passed in through parameters. This function programs the flash memory with the desired data for a given flash area as determined by the start address and the length. */
status_t FLASH_Program(flash_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes)
/* Programs flash with data at locations passed in through parameters. This function programs the flash memory with the desired data for a given flash area as determined by the start address and the length. */ status_t FLASH_Program(flash_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes)
{ assert(BOOTLOADER_API_TREE_POINTER); return BOOTLOADER_API_TREE_POINTER->flashDriver->flash_program(config, start, src, lengthInBytes); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Fills each COMP_InitStruct member with its default value. */
void COMP_StructInit(COMP_InitTypeDef *COMP_InitStruct)
/* Fills each COMP_InitStruct member with its default value. */ void COMP_StructInit(COMP_InitTypeDef *COMP_InitStruct)
{ COMP_InitStruct->COMP_InvertingInput = COMP_InvertingInput_1_4VREFINT; COMP_InitStruct->COMP_Output = COMP_Output_None; COMP_InitStruct->COMP_OutputPol = COMP_OutputPol_NonInverted; COMP_InitStruct->COMP_Hysteresis = COMP_Hysteresis_No; COMP_InitStruct->COMP_Mode = COMP_Mode_UltraLowPower; }
ajhc/demo-cortex-m3
C++
null
38
/* Since RCU callback function is called in bh, we need to defer the vfree to schedule_work(). */
static void ipc_schedule_free(struct rcu_head *head)
/* Since RCU callback function is called in bh, we need to defer the vfree to schedule_work(). */ static void ipc_schedule_free(struct rcu_head *head)
{ struct ipc_rcu_grace *grace; struct ipc_rcu_sched *sched; grace = container_of(head, struct ipc_rcu_grace, rcu); sched = container_of(&(grace->data[0]), struct ipc_rcu_sched, data[0]); INIT_WORK(&sched->work, ipc_do_vfree); schedule_work(&sched->work); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If Password or Salt or OutKey is NULL, then return FALSE. If the hash algorithm could not be determined, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI Pkcs5HashPassword(IN UINTN PasswordLength, IN CONST CHAR8 *Password, IN UINTN SaltLength, IN CONST UINT8 *Salt, IN UINTN IterationCount, IN UINTN DigestSize, IN UINTN KeyLength, OUT UINT8 *OutKey)
/* If Password or Salt or OutKey is NULL, then return FALSE. If the hash algorithm could not be determined, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI Pkcs5HashPassword(IN UINTN PasswordLength, IN CONST CHAR8 *Password, IN UINTN SaltLength, IN CONST UINT8 *Salt, IN UINTN IterationCount, IN UINTN DigestSize, IN UINTN KeyLength, OUT UINT8 *OutKey)
{ CALL_CRYPTO_SERVICE (Pkcs5HashPassword, (PasswordLength, Password, SaltLength, Salt, IterationCount, DigestSize, KeyLength, OutKey), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Define the rectangle for the next command to be applied. */
void LCD_SetRect_For_Cmd(s16 x, s16 y, s16 width, s16 height)
/* Define the rectangle for the next command to be applied. */ void LCD_SetRect_For_Cmd(s16 x, s16 y, s16 width, s16 height)
{ LCD_SendLCDCmd( ST7637_CASET ); LCD_SendLCDData( y + OrientationOffsetX[ CurrentScreenOrientation ] ); LCD_SendLCDData( y + OrientationOffsetX[ CurrentScreenOrientation ] + height - 1 ); LCD_SendLCDCmd( ST7637_RASET ); LCD_SendLCDData( x + OrientationOffsetY[ CurrentScreenOrientation ] ); LCD_SendLCDData( x + OrientationOffsetY[ CurrentScreenOrientation ] + width - 1 ); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* This function is used to get pmu rtc time. */
void tls_get_rtc(struct tm *tblock)
/* This function is used to get pmu rtc time. */ void tls_get_rtc(struct tm *tblock)
{ int ctrl1 = 0; int ctrl2 = 0; ctrl1 = tls_reg_read32(HR_PMU_RTC_CTRL1); ctrl2 = tls_reg_read32(HR_PMU_RTC_CTRL2); tblock->tm_year = ((int)((int)ctrl2 & 0x00007f00) >> 8); tblock->tm_mon = (ctrl2 & 0x0000000f); tblock->tm_mday = (ctrl1 & 0x1f000000) >> 24; tblock->tm_hour = (ctrl1 & 0x001f0000) >> 16; tblock->tm_min = (ctrl1 & 0x00003f00) >> 8; tblock->tm_sec = ctrl1 & 0x0000003f; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Clear the DMA interrupt flag of a channel. */
void DMAChannelIntFlagClear(unsigned long ulChannelID, unsigned long ulIntFlags)
/* Clear the DMA interrupt flag of a channel. */ void DMAChannelIntFlagClear(unsigned long ulChannelID, unsigned long ulIntFlags)
{ xASSERT(xDMAChannelIDValid(ulChannelID)); xASSERT((ulIntFlags == DMA_EVENT_TC) || (ulIntFlags == DMA_EVENT_ERROR) || (ulIntFlags == DMA_EVENT_TEMPTY)); if(ulIntFlags == DMA_EVENT_TC) { xHWREG(DMA0_BASE + DMA_TDF) |= (1 << ulChannelID); } if(ulIntFlags == DMA_EVENT_ERROR) { xHWREG(DMA0_BASE + DMA_ABTF) |= (1 << ulChannelID); } if(ulIntFlags == DMA_EVENT_TEMPTY) { xHWREG(DMA0_BASE + DMA_SCATDF) |= (1 << ulChannelID); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* ib_query_device() returns the attributes of a device through the @device_attr pointer. */
int ib_query_device(struct ib_device *device, struct ib_device_attr *device_attr)
/* ib_query_device() returns the attributes of a device through the @device_attr pointer. */ int ib_query_device(struct ib_device *device, struct ib_device_attr *device_attr)
{ return device->query_device(device, device_attr); }
robutest/uclinux
C++
GPL-2.0
60
/* Verify the new serial port information contained within serinfo is suitable for this port type. */
static int mux_verify_port(struct uart_port *port, struct serial_struct *ser)
/* Verify the new serial port information contained within serinfo is suitable for this port type. */ static int mux_verify_port(struct uart_port *port, struct serial_struct *ser)
{ if(port->membase == NULL) return -EINVAL; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified RTC flag is set or not. */
FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG)
/* Checks whether the specified RTC flag is set or not. */ FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG)
{ FlagStatus bitstatus = RESET; assert_param(IS_RTC_GET_FLAG(RTC_FLAG)); if ((RTC->CRL & RTC_FLAG) != (uint16_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Convenience functions to add extensions to a certificate, CRL and request */
int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509 *cert)
/* Convenience functions to add extensions to a certificate, CRL and request */ int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509 *cert)
{ STACK_OF(X509_EXTENSION) **sk = NULL; if (cert) sk = &cert->cert_info->extensions; return X509V3_EXT_add_nconf_sk(conf, ctx, section, sk); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Routine: cm_t54_palmas_regulator_set Description: select voltage and turn on/off Palmas PMIC regulator. */
static int cm_t54_palmas_regulator_set(u8 vreg, u8 vval, u8 creg, u8 cval)
/* Routine: cm_t54_palmas_regulator_set Description: select voltage and turn on/off Palmas PMIC regulator. */ static int cm_t54_palmas_regulator_set(u8 vreg, u8 vval, u8 creg, u8 cval)
{ int err; err = palmas_i2c_write_u8(TWL603X_CHIP_P1, vreg, vval); if (err) { printf("cm_t54: could not set regulator 0x%02x voltage : %d\n", vreg, err); return err; } err = palmas_i2c_write_u8(TWL603X_CHIP_P1, creg, cval); if (err) { printf("cm_t54: could not turn on/off regulator 0x%02x : %d\n", creg, err); return err; } return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns: TRUE if @data was successfully added to the @stream. */
gboolean g_data_output_stream_put_uint16(GDataOutputStream *stream, guint16 data, GCancellable *cancellable, GError **error)
/* Returns: TRUE if @data was successfully added to the @stream. */ gboolean g_data_output_stream_put_uint16(GDataOutputStream *stream, guint16 data, GCancellable *cancellable, GError **error)
{ gsize bytes_written; g_return_val_if_fail (G_IS_DATA_OUTPUT_STREAM (stream), FALSE); switch (stream->priv->byte_order) { case G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN: data = GUINT16_TO_BE (data); break; case G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN: data = GUINT16_TO_LE (data); break; case G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN: default: break; } return g_output_stream_write_all (G_OUTPUT_STREAM (stream), &data, 2, &bytes_written, cancellable, error); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function will put the two arguments in the right place (registers) and invoke the hypercall identified by HypercallID. */
INTN EFIAPI XenHypercall2(IN UINTN HypercallID, IN OUT INTN Arg1, IN OUT INTN Arg2)
/* This function will put the two arguments in the right place (registers) and invoke the hypercall identified by HypercallID. */ INTN EFIAPI XenHypercall2(IN UINTN HypercallID, IN OUT INTN Arg1, IN OUT INTN Arg2)
{ ASSERT (HyperPage != NULL); return __XenHypercall2 ((UINT8 *)HyperPage + HypercallID * 32, Arg1, Arg2); }
tianocore/edk2
C++
Other
4,240
/* Enables or disables the TIMx peripheral Preload register on CCR4. */
void TIM_OC4PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
/* Enables or disables the TIMx peripheral Preload register on CCR4. */ void TIM_OC4PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
{ uint16_t tmpccmr2 = 0; assert_param(IS_TIM_123458_PERIPH(TIMx)); assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload)); tmpccmr2 = TIMx->CCMR2; tmpccmr2 &= CCMR_OC24PE_Reset; tmpccmr2 |= (uint16_t)(TIM_OCPreload << 8); TIMx->CCMR2 = tmpccmr2; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Put Accelerometer in power down mode or not. */
void LSM303C_AccLowPower(uint16_t Mode)
/* Put Accelerometer in power down mode or not. */ void LSM303C_AccLowPower(uint16_t Mode)
{ uint8_t ctrl = 0x00; ctrl = ACCELERO_IO_Read(LSM303C_CTRL_REG1_A); ctrl &= ~(LSM303C_ACC_ODR_BITPOSITION); ctrl |= (uint8_t)Mode; ACCELERO_IO_Write(LSM303C_CTRL_REG1_A, ctrl); }
eclipse-threadx/getting-started
C++
Other
310
/* Return a delta between the system time and the RTC time, such that system time can be restored later with restore_time_delta() */
void save_time_delta(struct timespec *delta, struct timespec *rtc)
/* Return a delta between the system time and the RTC time, such that system time can be restored later with restore_time_delta() */ void save_time_delta(struct timespec *delta, struct timespec *rtc)
{ set_normalized_timespec(delta, xtime.tv_sec - rtc->tv_sec, xtime.tv_nsec - rtc->tv_nsec); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Handles an incoming ATT error response for the specified discover-characteristic-by-uuid proc. */
static void ble_gattc_disc_chr_uuid_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
/* Handles an incoming ATT error response for the specified discover-characteristic-by-uuid proc. */ static void ble_gattc_disc_chr_uuid_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
{ ble_gattc_dbg_assert_proc_not_inserted(proc); if (status == BLE_HS_ATT_ERR(BLE_ATT_ERR_ATTR_NOT_FOUND)) { status = BLE_HS_EDONE; } ble_gattc_disc_chr_uuid_cb(proc, status, att_handle, NULL); }
Nicholas3388/LuaNode
C++
Other
1,055
/* @priv: Private driver data @reg: Register number to read @data: Data to write */
static int rt5677_i2c_write(struct rt5677_priv *priv, uint reg, uint data)
/* @priv: Private driver data @reg: Register number to read @data: Data to write */ static int rt5677_i2c_write(struct rt5677_priv *priv, uint reg, uint data)
{ u8 buf[2]; buf[0] = (data >> 8) & 0xff; buf[1] = data & 0xff; return dm_i2c_write(priv->dev, reg, buf, sizeof(u16)); }
4ms/stm32mp1-baremetal
C++
Other
137
/* See page 86 of the data sheet for details. */
static void deplete(struct mtd_info *mtd, int chip)
/* See page 86 of the data sheet for details. */ static void deplete(struct mtd_info *mtd, int chip)
{ struct nand_chip *this = mtd->priv; while (!this->dev_ready(mtd)) ; this->select_chip(mtd, chip); this->cmdfunc(mtd, NAND_CMD_DEPLETE1, 0x0000, 0x0000); this->cmdfunc(mtd, NAND_CMD_DEPLETE2, -1, -1); this->cmdfunc(mtd, NAND_CMD_DEPLETE1, 0x0000, 0x0004); this->cmdfunc(mtd, NAND_CMD_DEPLETE2, -1, -1); }
robutest/uclinux
C++
GPL-2.0
60
/* brief Return PLL1 output clock rate param recompute : Forces a PLL rate recomputation if true return PLL1 output clock rate note The PLL rate is cached in the driver in a variable as the rate computation function can take some time to perform. It is recommended to use 'false' with the 'recompute' parameter. */
uint32_t CLOCK_GetPLL1OutClockRate(bool recompute)
/* brief Return PLL1 output clock rate param recompute : Forces a PLL rate recomputation if true return PLL1 output clock rate note The PLL rate is cached in the driver in a variable as the rate computation function can take some time to perform. It is recommended to use 'false' with the 'recompute' parameter. */ uint32_t CLOCK_GetPLL1OutClockRate(bool recompute)
{ pll_setup_t Setup; uint32_t rate; if ((recompute) || (s_Pll1_Freq == 0U)) { Setup.pllctrl = SYSCON->PLL1CTRL; Setup.pllndec = SYSCON->PLL1NDEC; Setup.pllpdec = SYSCON->PLL1PDEC; Setup.pllmdec = SYSCON->PLL1MDEC; CLOCK_GetPLL1OutFromSetupUpdate(&Setup); } rate = s_Pll1_Freq; return rate; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Try to boot the boot option triggered by hot key. */
VOID EFIAPI EfiBootManagerHotkeyBoot(VOID)
/* Try to boot the boot option triggered by hot key. */ VOID EFIAPI EfiBootManagerHotkeyBoot(VOID)
{ if (mBmHotkeyBootOption.OptionNumber != LoadOptionNumberUnassigned) { EfiBootManagerBoot (&mBmHotkeyBootOption); EfiBootManagerFreeLoadOption (&mBmHotkeyBootOption); mBmHotkeyBootOption.OptionNumber = LoadOptionNumberUnassigned; } }
tianocore/edk2
C++
Other
4,240
/* Copy data from NVRAM to system memory. This is a special form of the READ command used by some Ramtron/Cypress 4Kbit FRAM devices which puts the 9th address bit inside the command byte to be able to use one byte for addressing instead of two. */
static int nvram_spi_read_9bit_addr(nvram_t *dev, uint8_t *dst, uint32_t src, size_t len)
/* Copy data from NVRAM to system memory. This is a special form of the READ command used by some Ramtron/Cypress 4Kbit FRAM devices which puts the 9th address bit inside the command byte to be able to use one byte for addressing instead of two. */ static int nvram_spi_read_9bit_addr(nvram_t *dev, uint8_t *dst, uint32_t src, size_t len)
{ nvram_spi_params_t *spi_dev = (nvram_spi_params_t *) dev->extra; int status; uint8_t cmd; uint8_t addr; cmd = NVRAM_SPI_CMD_READ; if (src > 0xff) { cmd |= 0x08; } addr = (src & 0xff); spi_acquire(spi_dev->spi); gpio_clear(spi_dev->cs); status = spi_transfer_reg(spi_dev->spi, (char)cmd, addr, NULL); if (status < 0) { return status; } status = spi_transfer_bytes(spi_dev->spi, NULL, (char *)dst, len); if (status < 0) { return status; } gpio_set(spi_dev->cs); spi_release(spi_dev->spi); return status; }
labapart/polymcu
C++
null
201
/* This is a helper function for 'ubifs_recover_leb()' which drops the last node of the scanned LEB. */
static void drop_last_node(struct ubifs_scan_leb *sleb, int *offs)
/* This is a helper function for 'ubifs_recover_leb()' which drops the last node of the scanned LEB. */ static void drop_last_node(struct ubifs_scan_leb *sleb, int *offs)
{ struct ubifs_scan_node *snod; if (!list_empty(&sleb->nodes)) { snod = list_entry(sleb->nodes.prev, struct ubifs_scan_node, list); dbg_rcvry("dropping last node at %d:%d", sleb->lnum, snod->offs); *offs = snod->offs; list_del(&snod->list); kfree(snod); sleb->nodes_cnt -= 1; } }
4ms/stm32mp1-baremetal
C++
Other
137
/* Cancel a crypto request. This is done by removing the request from the device pending or request queue. Note that the request stays on the AP queue. When it finishes the message reply will be discarded because the psmid can't be found. */
void ap_cancel_message(struct ap_device *ap_dev, struct ap_message *ap_msg)
/* Cancel a crypto request. This is done by removing the request from the device pending or request queue. Note that the request stays on the AP queue. When it finishes the message reply will be discarded because the psmid can't be found. */ void ap_cancel_message(struct ap_device *ap_dev, struct ap_message *ap_msg)
{ struct ap_message *tmp; spin_lock_bh(&ap_dev->lock); if (!list_empty(&ap_msg->list)) { list_for_each_entry(tmp, &ap_dev->pendingq, list) if (tmp->psmid == ap_msg->psmid) { ap_dev->pendingq_count--; goto found; } ap_dev->requestq_count--; found: list_del_init(&ap_msg->list); } spin_unlock_bh(&ap_dev->lock); }
robutest/uclinux
C++
GPL-2.0
60
/* ADC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
/* ADC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hadc->Instance==ADC1) { __HAL_RCC_ADC12_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_1; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Change the mode of the USB controller to host. */
void USBHostMode(uint32_t ui32Base)
/* Change the mode of the USB controller to host. */ void USBHostMode(uint32_t ui32Base)
{ ASSERT(ui32Base == USB0_BASE); HWREGB(ui32Base + USB_O_GPCS) = USB_GPCS_DEVMODOTG; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* For Td guest TDVMCALL_MMIO is invoked to write MMIO registers. */
UINT32 EFIAPI MmioWrite32(IN UINTN Address, IN UINT32 Value)
/* For Td guest TDVMCALL_MMIO is invoked to write MMIO registers. */ UINT32 EFIAPI MmioWrite32(IN UINTN Address, IN UINT32 Value)
{ BOOLEAN Flag; ASSERT ((Address & 3) == 0); Flag = FilterBeforeMmIoWrite (FilterWidth32, Address, &Value); if (Flag) { MemoryFence (); if (IsTdxGuest ()) { TdMmioWrite32 (Address, Value); } else { *(volatile UINT32 *)Address = Value; } MemoryFence (); } FilterAfterMmIoWrite (FilterWidth32, Address, &Value); return Value; }
tianocore/edk2
C++
Other
4,240
/* the usage count for the device is incremented on open() and decremented on release() */
static int ftdi_elan_open(struct inode *inode, struct file *file)
/* the usage count for the device is incremented on open() and decremented on release() */ static int ftdi_elan_open(struct inode *inode, struct file *file)
{ int subminor = iminor(inode); struct usb_interface *interface = usb_find_interface(&ftdi_elan_driver, subminor); if (!interface) { printk(KERN_ERR "can't find device for minor %d\n", subminor); return -ENODEV; } else { struct usb_ftdi *ftdi = usb_get_intfdata(interface); if (!ftdi) { return -ENODEV; } else { if (down_interruptible(&ftdi->sw_lock)) { return -EINTR; } else { ftdi_elan_get_kref(ftdi); file->private_data = ftdi; return 0; } } } }
robutest/uclinux
C++
GPL-2.0
60
/* Enable Off-State in Run Mode. Enables the off-state in run mode for the break function of an advanced timer in which the complementary outputs have been configured. It has no effect if no complementary output is present. When the capture-compare output is disabled while the complementary output is enabled, the output is set to its inactive level as defined by the output polarity. */
void timer_set_enabled_off_state_in_run_mode(uint32_t timer_peripheral)
/* Enable Off-State in Run Mode. Enables the off-state in run mode for the break function of an advanced timer in which the complementary outputs have been configured. It has no effect if no complementary output is present. When the capture-compare output is disabled while the complementary output is enabled, the output is set to its inactive level as defined by the output polarity. */ void timer_set_enabled_off_state_in_run_mode(uint32_t timer_peripheral)
{ TIM_BDTR(timer_peripheral) |= TIM_BDTR_OSSR; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Determine gfx aperature size. This has already been determined by the CA driver init, so just need to set agp_bridge values accordingly. */
static int sgi_tioca_fetch_size(void)
/* Determine gfx aperature size. This has already been determined by the CA driver init, so just need to set agp_bridge values accordingly. */ static int sgi_tioca_fetch_size(void)
{ struct tioca_kernel *info = (struct tioca_kernel *)agp_bridge->dev_private_data; sgi_tioca_sizes[0].size = info->ca_gfxap_size / MB(1); sgi_tioca_sizes[0].num_entries = info->ca_gfxgart_entries; return sgi_tioca_sizes[0].size; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is called by garbage collection to determine if commit should be run. If commit state is @COMMIT_BACKGROUND, which means that the journal is full enough to start commit, this function returns true. It is not absolutely necessary to commit yet, but it feels like this should be better then to keep doing GC. This function returns %1 if GC has to initiate commit and %0 if not. */
int ubifs_gc_should_commit(struct ubifs_info *c)
/* This function is called by garbage collection to determine if commit should be run. If commit state is @COMMIT_BACKGROUND, which means that the journal is full enough to start commit, this function returns true. It is not absolutely necessary to commit yet, but it feels like this should be better then to keep doing GC. This function returns %1 if GC has to initiate commit and %0 if not. */ int ubifs_gc_should_commit(struct ubifs_info *c)
{ int ret = 0; spin_lock(&c->cs_lock); if (c->cmt_state == COMMIT_BACKGROUND) { dbg_cmt("commit required now"); c->cmt_state = COMMIT_REQUIRED; } else dbg_cmt("commit not requested"); if (c->cmt_state == COMMIT_REQUIRED) ret = 1; spin_unlock(&c->cs_lock); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* When this function is called, the engine is triggered to start using this context for GCM and CCM. */
void AESAuthLengthSet(uint32_t ui32Base, uint32_t ui32Length)
/* When this function is called, the engine is triggered to start using this context for GCM and CCM. */ void AESAuthLengthSet(uint32_t ui32Base, uint32_t ui32Length)
{ ASSERT(ui32Base == AES_BASE); HWREG(ui32Base + AES_O_AUTH_LENGTH) = ui32Length; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Configure USB Device Endpoint according to Descriptor Parameters: pEPD: Pointer to Device Endpoint Descriptor Return Value: None */
void USBD_ConfigEP(USB_ENDPOINT_DESCRIPTOR *pEPD)
/* Configure USB Device Endpoint according to Descriptor Parameters: pEPD: Pointer to Device Endpoint Descriptor Return Value: None */ void USBD_ConfigEP(USB_ENDPOINT_DESCRIPTOR *pEPD)
{ U32 EPNum; EPNum = pEPD->bEndpointAddress & EPNUM_MASK; if (EPNum < MXC_USB_NUM_EP) { MXC_USB->ep[EPNum] = MXC_F_USB_EP_DT; if (pEPD->bEndpointAddress & USB_ENDPOINT_DIRECTION_MASK) { ep_info[EPNum].type = MXC_S_USB_EP_DIR_IN; } else { ep_info[EPNum].type = MXC_S_USB_EP_DIR_OUT; } ep_info[EPNum].len = pEPD->wMaxPacketSize; } }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Determines the length of the MQTT connect packet that would be produced using the supplied connect options. */
static int connect_length(mqtt_packet_connect_data_t *options)
/* Determines the length of the MQTT connect packet that would be produced using the supplied connect options. */ static int connect_length(mqtt_packet_connect_data_t *options)
{ int len = 0; FUNC_ENTRY; if (options->MQTTVersion == 3) len = 12; else if (options->MQTTVersion == 4) len = 10; len += mqtt_strlen(options->clientID)+2; if (options->willFlag) len += mqtt_strlen(options->will.topicName)+2 + mqtt_strlen(options->will.message)+2; if (options->username.cstring || options->username.lenstring.data) len += mqtt_strlen(options->username)+2; if (options->password.cstring || options->password.lenstring.data) len += mqtt_strlen(options->password)+2; FUNC_EXIT_RC(len); return len; }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* This API configure the source of data(filter & pre-filter) for high-g interrupt. */
static int8_t config_high_g_data_src(const struct bmi160_acc_high_g_int_cfg *high_g_int_cfg, const struct bmi160_dev *dev)
/* This API configure the source of data(filter & pre-filter) for high-g interrupt. */ static int8_t config_high_g_data_src(const struct bmi160_acc_high_g_int_cfg *high_g_int_cfg, const struct bmi160_dev *dev)
{ int8_t rslt; uint8_t data = 0; uint8_t temp = 0; rslt = bmi160_get_regs(BMI160_INT_DATA_0_ADDR, &data, 1, dev); if (rslt == BMI160_OK) { temp = data & ~BMI160_LOW_HIGH_SRC_INT_MASK; data = temp | ((high_g_int_cfg->high_data_src << 7) & BMI160_LOW_HIGH_SRC_INT_MASK); rslt = bmi160_set_regs(BMI160_INT_DATA_0_ADDR, &data, 1, dev); } return rslt; }
eclipse-threadx/getting-started
C++
Other
310
/* omap_read_buf8 - read data from NAND controller into buffer @mtd: MTD device structure @buf: buffer to store date @len: number of bytes to read */
static void omap_read_buf8(struct mtd_info *mtd, u_char *buf, int len)
/* omap_read_buf8 - read data from NAND controller into buffer @mtd: MTD device structure @buf: buffer to store date @len: number of bytes to read */ static void omap_read_buf8(struct mtd_info *mtd, u_char *buf, int len)
{ struct nand_chip *nand = mtd->priv; ioread8_rep(nand->IO_ADDR_R, buf, len); }
robutest/uclinux
C++
GPL-2.0
60
/* Reads a 32-bit value into BAR0 using MMIO */
STATIC EFI_STATUS PvScsiMmioRead32(IN CONST PVSCSI_DEV *Dev, IN UINT64 Offset, OUT UINT32 *Value)
/* Reads a 32-bit value into BAR0 using MMIO */ STATIC EFI_STATUS PvScsiMmioRead32(IN CONST PVSCSI_DEV *Dev, IN UINT64 Offset, OUT UINT32 *Value)
{ return Dev->PciIo->Mem.Read ( Dev->PciIo, EfiPciIoWidthUint32, PCI_BAR_IDX0, Offset, 1, Value ); }
tianocore/edk2
C++
Other
4,240
/* Enable/disable the FIFO mode of the specified SPI port. */
void SPIFIFOModeSet(unsigned long ulBase, unsigned long ulEnable)
/* Enable/disable the FIFO mode of the specified SPI port. */ void SPIFIFOModeSet(unsigned long ulBase, unsigned long ulEnable)
{ xASSERT(ulBase == SPI0_BASE); xASSERT((ulEnable == SPI_FIFO_ENABLE) || (ulEnable == SPI_FIFO_DISABLE)); if (ulEnable == SPI_FIFO_ENABLE) { xHWREG(ulBase + SPI_FCR) |= SPI_FCR_FIFOEN; } else { xHWREG(ulBase + SPI_FCR) &= ~SPI_FCR_FIFOEN; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* We do not implement any tricks to guarantee strict lock ordering, because VFS has already done it for us on the @i_mutex. So this is just a simple wrapper function. */
static void lock_3_inodes(struct inode *inode1, struct inode *inode2, struct inode *inode3)
/* We do not implement any tricks to guarantee strict lock ordering, because VFS has already done it for us on the @i_mutex. So this is just a simple wrapper function. */ static void lock_3_inodes(struct inode *inode1, struct inode *inode2, struct inode *inode3)
{ mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_1); if (inode2 != inode1) mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_2); if (inode3) mutex_lock_nested(&ubifs_inode(inode3)->ui_mutex, WB_MUTEX_3); }
robutest/uclinux
C++
GPL-2.0
60
/* This API gets the oversampling, filter and standby duration (normal mode) settings from the sensor. */
int8_t bme280_get_sensor_settings(struct bme280_dev *dev)
/* This API gets the oversampling, filter and standby duration (normal mode) settings from the sensor. */ int8_t bme280_get_sensor_settings(struct bme280_dev *dev)
{ int8_t rslt; uint8_t reg_data[4]; rslt = null_ptr_check(dev); if (rslt == BME280_OK) { rslt = bme280_get_regs(BME280_CTRL_HUM_ADDR, reg_data, 4, dev); if (rslt == BME280_OK) { parse_device_settings(reg_data, &dev->settings); } } return rslt; }
eclipse-threadx/getting-started
C++
Other
310
/* Reads the PHY register at offset and stores the retrieved information in data. Assumes semaphore already acquired. */
s32 e1000e_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data)
/* Reads the PHY register at offset and stores the retrieved information in data. Assumes semaphore already acquired. */ s32 e1000e_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data)
{ return __e1000e_read_phy_reg_igp(hw, offset, data, true); }
robutest/uclinux
C++
GPL-2.0
60
/* This function is used for the soft reset The soft reset register will be written with 0xB6 in the register 0x14. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_soft_rst(void)
/* This function is used for the soft reset The soft reset register will be written with 0xB6 in the register 0x14. */ BMA2x2_RETURN_FUNCTION_TYPE bma2x2_soft_rst(void)
{ BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR; u8 data_u8 = BMA2x2_ENABLE_SOFT_RESET_VALUE; if (p_bma2x2 == BMA2x2_NULL) { return E_BMA2x2_NULL_PTR; } else { com_rslt = bma2x2_write_reg(BMA2x2_RST_ADDR, &data_u8, BMA2x2_GEN_READ_WRITE_LENGTH); } return com_rslt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Converts a text device path node to BMC device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextBmc(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to BMC device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextBmc(IN CHAR16 *TextDeviceNode)
{ CHAR16 *InterfaceTypeStr; CHAR16 *BaseAddressStr; BMC_DEVICE_PATH *BmcDp; InterfaceTypeStr = GetNextParamStr (&TextDeviceNode); BaseAddressStr = GetNextParamStr (&TextDeviceNode); BmcDp = (BMC_DEVICE_PATH *)CreateDeviceNode ( HARDWARE_DEVICE_PATH, HW_BMC_DP, (UINT16)sizeof (BMC_DEVICE_PATH) ); BmcDp->InterfaceType = (UINT8)Strtoi (InterfaceTypeStr); WriteUnaligned64 ( (UINT64 *)(&BmcDp->BaseAddress), StrHexToUint64 (BaseAddressStr) ); return (EFI_DEVICE_PATH_PROTOCOL *)BmcDp; }
tianocore/edk2
C++
Other
4,240
/* SPI1 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */
void SPI1IntHandler(void)
/* SPI1 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */ void SPI1IntHandler(void)
{ unsigned long ulEventFlags, ulCR1; ulEventFlags = xHWREG(SPI1_BASE + SPI_SR); if((ulEventFlags & SPI_SR_OVR) != 0) { xHWREG(SPI1_BASE + SPI_DR); xHWREG(SPI1_BASE + SPI_SR); } else if((ulEventFlags & SPI_SR_MODF) != 0) { (void)xHWREG(SPI1_BASE + SPI_SR); ulCR1 = xHWREG(SPI1_BASE + SPI_CR1); xHWREG(SPI1_BASE + SPI_CR1) = ulCR1; } else if((ulEventFlags & SPI_SR_CRCERR) != 0) { xHWREG(SPI1_BASE + SPI_SR) &= ~SPI_SR_CRCERR; } if(g_pfnSPIHandlerCallbacks[0]) { g_pfnSPIHandlerCallbacks[0](0, 0, ulEventFlags, 0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeInt64ToInt16(IN INT64 Operand, OUT INT16 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeInt64ToInt16(IN INT64 Operand, OUT INT16 *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if ((Operand >= MIN_INT16) && (Operand <= MAX_INT16)) { *Result = (INT16)Operand; Status = RETURN_SUCCESS; } else { *Result = INT16_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* void rtl8192_restart(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); */
void rtl8192_restart(struct work_struct *work)
/* void rtl8192_restart(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); */ void rtl8192_restart(struct work_struct *work)
{ struct r8192_priv *priv = container_of(work, struct r8192_priv, reset_wq); struct net_device *dev = priv->ieee80211->dev; down(&priv->wx_sem); rtl8192_commit(dev); up(&priv->wx_sem); }
robutest/uclinux
C++
GPL-2.0
60
/* This function re-uses a previously-allocated Command, there is no failure mode from trying to allocate a command. */
static void DAC960_queue_partial_rw(DAC960_Command_T *Command)
/* This function re-uses a previously-allocated Command, there is no failure mode from trying to allocate a command. */ static void DAC960_queue_partial_rw(DAC960_Command_T *Command)
{ DAC960_Controller_T *Controller = Command->Controller; struct request *Request = Command->Request; struct request_queue *req_q = Controller->RequestQueue[Command->LogicalDriveNumber]; if (Command->DmaDirection == PCI_DMA_FROMDEVICE) Command->CommandType = DAC960_ReadRetryCommand; else Command->CommandType = DAC960_WriteRetryCommand; (void)blk_rq_map_sg(req_q, Command->Request, Command->cmd_sglist); (void)pci_map_sg(Controller->PCIDevice, Command->cmd_sglist, 1, Command->DmaDirection); Command->SegmentCount = 1; Command->BlockNumber = blk_rq_pos(Request); Command->BlockCount = 1; DAC960_QueueReadWriteCommand(Command); return; }
robutest/uclinux
C++
GPL-2.0
60
/* The function is used to enable extern WakeUp pin interrupt. */
void SysCtlWakeUpIntEnable(xtBoolean bEnable)
/* The function is used to enable extern WakeUp pin interrupt. */ void SysCtlWakeUpIntEnable(xtBoolean bEnable)
{ if(bEnable) { xHWREG(PWRCU_BAKCR) |= PWRCU_BAKCR_WUPIEN; } else { xHWREG(PWRCU_BAKCR) &= ~PWRCU_BAKCR_WUPIEN; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Return the 128-bit message digest into the user's array */
EXP_FUNC void STDCALL ICACHE_FLASH_ATTR MD5_Final(uint8_t *digest, MD5_CTX *ctx)
/* Return the 128-bit message digest into the user's array */ EXP_FUNC void STDCALL ICACHE_FLASH_ATTR MD5_Final(uint8_t *digest, MD5_CTX *ctx)
{ uint8_t bits[8]; uint32_t x, padLen; Encode(bits, ctx->count, 8); x = (uint32_t)((ctx->count[0] >> 3) & 0x3f); padLen = (x < 56) ? (56 - x) : (120 - x); MD5_Update(ctx, PADDING, padLen); MD5_Update(ctx, bits, 8); Encode(digest, ctx->state, MD5_SIZE); }
eerimoq/simba
C++
Other
337
/* TEMPDRV Interrupt Handler. This function handles the EMU_IF_TEMPHIGH, EMU_IF_TEMPLOW interrupt flags from the EMU internal temperature sensor. */
void TEMPDRV_IRQHandler(void)
/* TEMPDRV Interrupt Handler. This function handles the EMU_IF_TEMPHIGH, EMU_IF_TEMPLOW interrupt flags from the EMU internal temperature sensor. */ void TEMPDRV_IRQHandler(void)
{ uint32_t flags = EMU_IntGetEnabled(); TEMPDRV_Callback_t activeCallback; if (flags & EMU_IF_TEMPHIGH) { if (lowCallback->callback != NULL) { activeCallback = lowCallback->callback; memset(lowCallback, 0, sizeof(TEMPDRV_CallbackSet_t)); activeCallback(TEMPDRV_GetTemp(), TEMPDRV_LIMIT_LOW); } EMU_IntClear(EMU_IFC_TEMPHIGH); } else if (flags & EMU_IF_TEMPLOW) { if (highCallback->callback != NULL) { activeCallback = highCallback->callback; memset(highCallback, 0, sizeof(TEMPDRV_CallbackSet_t)); activeCallback(TEMPDRV_GetTemp(), TEMPDRV_LIMIT_HIGH); } EMU_IntClear(EMU_IFC_TEMPLOW); } updateInterrupts(); }
remotemcu/remcu-chip-sdks
C++
null
436
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector36_handler(void)
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ void Vector36_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (36 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Transmit a char, if you want to use printf(), you need implement this function. */
void PrintChar(char c)
/* Transmit a char, if you want to use printf(), you need implement this function. */ void PrintChar(char c)
{ xUARTCharPut(USART1_BASE, c); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* megasas_fire_cmd_xscale - Sends command to the FW @frame_phys_addr : Physical address of cmd @frame_count : Number of frames for the command @regs : MFI register set */
static void megasas_fire_cmd_xscale(struct megasas_instance *instance, dma_addr_t frame_phys_addr, u32 frame_count, struct megasas_register_set __iomem *regs)
/* megasas_fire_cmd_xscale - Sends command to the FW @frame_phys_addr : Physical address of cmd @frame_count : Number of frames for the command @regs : MFI register set */ static void megasas_fire_cmd_xscale(struct megasas_instance *instance, dma_addr_t frame_phys_addr, u32 frame_count, struct megasas_register_set __iomem *regs)
{ writel((frame_phys_addr >> 3)|(frame_count), &(regs)->inbound_queue_port); }
robutest/uclinux
C++
GPL-2.0
60
/* port_uc_addr_set - This function Set the port Unicast address. */
static void port_uc_addr_set(struct mvgbe_device *dmvgbe, u8 *p_addr)
/* port_uc_addr_set - This function Set the port Unicast address. */ static void port_uc_addr_set(struct mvgbe_device *dmvgbe, u8 *p_addr)
{ struct mvgbe_registers *regs = dmvgbe->regs; u32 mac_h; u32 mac_l; mac_l = (p_addr[4] << 8) | (p_addr[5]); mac_h = (p_addr[0] << 24) | (p_addr[1] << 16) | (p_addr[2] << 8) | (p_addr[3] << 0); MVGBE_REG_WR(regs->macal, mac_l); MVGBE_REG_WR(regs->macah, mac_h); port_uc_addr(regs, p_addr[5], ACCEPT_MAC_ADDR); }
4ms/stm32mp1-baremetal
C++
Other
137
/* High pass data from internal filter sent to output register and FIFO.. */
int32_t lis2dh12_high_pass_on_outputs_get(stmdev_ctx_t *ctx, uint8_t *val)
/* High pass data from internal filter sent to output register and FIFO.. */ int32_t lis2dh12_high_pass_on_outputs_get(stmdev_ctx_t *ctx, uint8_t *val)
{ lis2dh12_ctrl_reg2_t ctrl_reg2; int32_t ret; ret = lis2dh12_read_reg(ctx, LIS2DH12_CTRL_REG2, (uint8_t *)&ctrl_reg2, 1); *val = (uint8_t)ctrl_reg2.fds; return ret; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* If the cpuset being removed has its flag 'sched_load_balance' enabled, then simulate turning sched_load_balance off, which will call async_rebuild_sched_domains(). */
static void cpuset_destroy(struct cgroup_subsys *ss, struct cgroup *cont)
/* If the cpuset being removed has its flag 'sched_load_balance' enabled, then simulate turning sched_load_balance off, which will call async_rebuild_sched_domains(). */ static void cpuset_destroy(struct cgroup_subsys *ss, struct cgroup *cont)
{ struct cpuset *cs = cgroup_cs(cont); if (is_sched_load_balance(cs)) update_flag(CS_SCHED_LOAD_BALANCE, cs, 0); number_of_cpusets--; free_cpumask_var(cs->cpus_allowed); kfree(cs); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Checks whether the specified RTC interrupt has occurred or not. */
ITStatus LCD_GetITStatus(uint32_t LCD_IT)
/* Checks whether the specified RTC interrupt has occurred or not. */ ITStatus LCD_GetITStatus(uint32_t LCD_IT)
{ ITStatus bitstatus = RESET; assert_param(IS_LCD_GET_IT(LCD_IT)); if ((LCD->SR & LCD_IT) != (uint16_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } if (((LCD->FCR & LCD_IT) != (uint16_t)RESET) && (bitstatus != (uint32_t)RESET)) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
avem-labs/Avem
C++
MIT License
1,752