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
/* Draw window, all its siblings and parents within dirty area. For windows that are partly transparent, e.g. drop shadows or round corners, the parent is asked to redraw all its child windows, in order to provide a fresh background for the window to draw upon. This applies to windows with the behavior flag REDRAW_PAR...
static void win_draw(struct win_window *win, const struct win_area *dirty_area)
/* Draw window, all its siblings and parents within dirty area. For windows that are partly transparent, e.g. drop shadows or round corners, the parent is asked to redraw all its child windows, in order to provide a fresh background for the window to draw upon. This applies to windows with the behavior flag REDRAW_PAR...
{ struct win_clip_region clip; if (!win_compute_clipping(win, dirty_area, &clip)) { return; } if (win->parent && (win->attributes.behavior & WIN_BEHAVIOR_REDRAW_PARENT)) { win_draw_parent(win, dirty_area); return; } win_draw_contents(win, &clip); while (win != &win_root) { clip.origin.x -= win->attrib...
memfault/zero-to-main
C++
null
200
/* Switches to specified vcpu, until a matching vcpu_put() */
void vcpu_load(struct kvm_vcpu *vcpu)
/* Switches to specified vcpu, until a matching vcpu_put() */ void vcpu_load(struct kvm_vcpu *vcpu)
{ int cpu; mutex_lock(&vcpu->mutex); cpu = get_cpu(); preempt_notifier_register(&vcpu->preempt_notifier); kvm_arch_vcpu_load(vcpu, cpu); put_cpu(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return the cable type attached to this port */
static int hpt3x2n_cable_detect(struct ata_port *ap)
/* Return the cable type attached to this port */ static int hpt3x2n_cable_detect(struct ata_port *ap)
{ u8 scr2, ata66; struct pci_dev *pdev = to_pci_dev(ap->host->dev); pci_read_config_byte(pdev, 0x5B, &scr2); pci_write_config_byte(pdev, 0x5B, scr2 & ~0x01); udelay(10); pci_read_config_byte(pdev, 0x5A, &ata66); pci_write_config_byte(pdev, 0x5B, scr2); if (ata66 & (2 >> ap->port_no)) return ATA_CBL_PATA40; e...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Teardown mappings after DMA has completed. This must be called after the completion of each use of ide_build_dmatable and before the next use of ide_build_dmatable. Failure to do so will cause an oops as only one mapping can be live for each target at a given time. */
void ide_dma_unmap_sg(ide_drive_t *drive, struct ide_cmd *cmd)
/* Teardown mappings after DMA has completed. This must be called after the completion of each use of ide_build_dmatable and before the next use of ide_build_dmatable. Failure to do so will cause an oops as only one mapping can be live for each target at a given time. */ void ide_dma_unmap_sg(ide_drive_t *drive, struc...
{ ide_hwif_t *hwif = drive->hwif; dma_unmap_sg(hwif->dev, hwif->sg_table, cmd->orig_sg_nents, cmd->sg_dma_direction); }
robutest/uclinux
C++
GPL-2.0
60
/* Set the contents of a G_TYPE_FLOAT #GValue to @v_float. */
void g_value_set_float(GValue *value, gfloat v_float)
/* Set the contents of a G_TYPE_FLOAT #GValue to @v_float. */ void g_value_set_float(GValue *value, gfloat v_float)
{ g_return_if_fail (G_VALUE_HOLDS_FLOAT (value)); value->data[0].v_float = v_float; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Assign all the hash buckets of the specified table with the service. */
static int ip_vs_sh_assign(struct ip_vs_sh_bucket *tbl, struct ip_vs_service *svc)
/* Assign all the hash buckets of the specified table with the service. */ static int ip_vs_sh_assign(struct ip_vs_sh_bucket *tbl, struct ip_vs_service *svc)
{ int i; struct ip_vs_sh_bucket *b; struct list_head *p; struct ip_vs_dest *dest; b = tbl; p = &svc->destinations; for (i=0; i<IP_VS_SH_TAB_SIZE; i++) { if (list_empty(p)) { b->dest = NULL; } else { if (p == &svc->destinations) p = p->next; dest = list_entry(p, struct ip_vs_dest, n_list); ato...
EmcraftSystems/linux-emcraft
C++
Other
266
/* where the second term is the sum of (1) reclaimable slab pages, (2) active and (3) inactive anonymouns pages, (4) active and (5) inactive file pages, minus mapped file pages. */
static unsigned long minimum_image_size(unsigned long saveable)
/* where the second term is the sum of (1) reclaimable slab pages, (2) active and (3) inactive anonymouns pages, (4) active and (5) inactive file pages, minus mapped file pages. */ static unsigned long minimum_image_size(unsigned long saveable)
{ unsigned long size; size = global_page_state(NR_SLAB_RECLAIMABLE) + global_page_state(NR_ACTIVE_ANON) + global_page_state(NR_INACTIVE_ANON) + global_page_state(NR_ACTIVE_FILE) + global_page_state(NR_INACTIVE_FILE) - global_page_state(NR_FILE_MAPPED); return saveable <= size ? 0 : saveable - size; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Input key must be a valid NULL terminated UTF8 encoded string. NULL will be returned when Key-Value is not found in this JSON object. */
EDKII_JSON_VALUE EFIAPI JsonObjectGetValue(IN CONST EDKII_JSON_OBJECT JsonObj, IN CONST CHAR8 *Key)
/* Input key must be a valid NULL terminated UTF8 encoded string. NULL will be returned when Key-Value is not found in this JSON object. */ EDKII_JSON_VALUE EFIAPI JsonObjectGetValue(IN CONST EDKII_JSON_OBJECT JsonObj, IN CONST CHAR8 *Key)
{ return (EDKII_JSON_VALUE)json_object_get ((const json_t *)JsonObj, (const char *)Key); }
tianocore/edk2
C++
Other
4,240
/* Get the interrupt status of the SHA/MD5 module. */
uint32_t SHAMD5IntStatus(uint32_t ui32Base, bool bMasked)
/* Get the interrupt status of the SHA/MD5 module. */ uint32_t SHAMD5IntStatus(uint32_t ui32Base, bool bMasked)
{ uint32_t ui32Temp; uint32_t ui32IrqEnable; ASSERT(ui32Base == SHAMD5_BASE); if(bMasked) { ui32Temp = HWREG(DTHE_BASE + DTHE_O_SHA_MIS); ui32IrqEnable = HWREG(ui32Base + SHAMD5_O_IRQENABLE); return((HWREG(ui32Base + SHAMD5_O_IRQSTATUS) & ui32IrqEnable) | (ui3...
micropython/micropython
C++
Other
18,334
/* If return value > 0 then tsn is changed to be tsn of head. */
static guint find_head(body_parts **body_parts_array, guint16 *tsn)
/* If return value > 0 then tsn is changed to be tsn of head. */ static guint find_head(body_parts **body_parts_array, guint16 *tsn)
{ guint length = 0; *tsn = (*tsn==0)? (guint16)(MAX_TSN-1) : (*tsn)-1; for (; body_parts_array[*tsn]->middle != NULL; *tsn = (*tsn==0)?(guint16)(MAX_TSN-1):(*tsn)-1) length += body_parts_array[*tsn]->middle->length; if (body_parts_array[*tsn]->head != NULL) return length+body_parts_array...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Clears the interrupt for the specified pin(s). 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 GPIOPinIntClear(unsigned long ulPort, unsigned long ulPins)
/* Clears the interrupt for the specified pin(s). 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 GPIOPinIntClear(unsigned long ulPort, unsigned l...
{ xASSERT(GPIOBaseValid(ulPort)); xHWREG(EXTI_PR) |= ulPins; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Remember that Fv protocol on FvHandle has had its drivers placed on the mDiscoveredList. This function adds entries on the mFvHandleList. Items are never removed/freed from the mFvHandleList. */
VOID FvIsBeingProcessed(IN EFI_HANDLE FvHandle)
/* Remember that Fv protocol on FvHandle has had its drivers placed on the mDiscoveredList. This function adds entries on the mFvHandleList. Items are never removed/freed from the mFvHandleList. */ VOID FvIsBeingProcessed(IN EFI_HANDLE FvHandle)
{ KNOWN_HANDLE *KnownHandle; KnownHandle = AllocatePool (sizeof (KNOWN_HANDLE)); ASSERT (KnownHandle != NULL); KnownHandle->Signature = KNOWN_HANDLE_SIGNATURE; KnownHandle->Handle = FvHandle; InsertTailList (&mFvHandleList, &KnownHandle->Link); }
tianocore/edk2
C++
Other
4,240
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit an...
UINT16 EFIAPI PciExpressBitFieldAnd16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit an...
{ if (Address >= mSmmPciExpressLibPciExpressBaseSize) { return (UINT16)-1; } return MmioBitFieldAnd16 ( GetPciExpressAddress (Address), StartBit, EndBit, AndData ); }
tianocore/edk2
C++
Other
4,240
/* Find variable with given name 'n'. If it is an upvalue, add this upvalue into all intermediate functions. */
static int singlevaraux(FuncState *fs, TString *n, expdesc *var, int base)
/* Find variable with given name 'n'. If it is an upvalue, add this upvalue into all intermediate functions. */ static int singlevaraux(FuncState *fs, TString *n, expdesc *var, int base)
{ int v = searchvar(fs, n); if (v >= 0) { init_exp(var, VLOCAL, v); if (!base) markupval(fs, v); return VLOCAL; } else { int idx = searchupvalue(fs, n); if (idx < 0) { if (singlevaraux(fs->prev, n, var, 0) == VVOID) return VVOID; idx = new...
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* Reset the BAKPR peripheral registers to their default reset values. */
void BAKPR_Reset(void)
/* Reset the BAKPR peripheral registers to their default reset values. */ void BAKPR_Reset(void)
{ RCM_EnableBackupReset(); RCM_DisableBackupReset(); }
pikasTech/PikaPython
C++
MIT License
1,403
/* If the requested operation results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeIntnMult(IN INTN Multiplicand, IN INTN Multiplier, OUT INTN *Result)
/* If the requested operation results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeIntnMult(IN INTN Multiplicand, IN INTN Multiplier, OUT INTN *Result)
{ return SafeInt64ToIntn (MultS64x64 (Multiplicand, Multiplier), Result); }
tianocore/edk2
C++
Other
4,240
/* Retrieve saved firmware trace from a prior IOC failure. */
bfa_status_t bfa_ioc_debug_fwsave(struct bfa_ioc_s *ioc, void *trcdata, int *trclen)
/* Retrieve saved firmware trace from a prior IOC failure. */ bfa_status_t bfa_ioc_debug_fwsave(struct bfa_ioc_s *ioc, void *trcdata, int *trclen)
{ int tlen; if (ioc->dbg_fwsave_len == 0) return BFA_STATUS_ENOFSAVE; tlen = *trclen; if (tlen > ioc->dbg_fwsave_len) tlen = ioc->dbg_fwsave_len; bfa_os_memcpy(trcdata, ioc->dbg_fwsave, tlen); *trclen = tlen; return BFA_STATUS_OK; }
robutest/uclinux
C++
GPL-2.0
60
/* Function to start the first task executing - written in asm code as direct access to registers is required. */
static void prvStartFirstTask(void)
/* Function to start the first task executing - written in asm code as direct access to registers is required. */ static void prvStartFirstTask(void)
{ SETPSW U MOV.L #_pxCurrentTCB, R15 MOV.L [R15], R15 MOV.L [R15], R0 POP R15 MVTACLO R15, A0 POP R15 MVTACHI R15, A0 POP R15 MVTACGU R15, A0 POP R15 MVTACLO R15, A1 POP R15 MVTACHI R15, A1 POP R15 MVTACGU R15, A1 POP R15 MVTC R15,FPSW POPM R1-R15 ...
labapart/polymcu
C++
null
201
/* EnumerationDone User response request is displayed to ask application jump to class. */
void USBH_USR_EnumerationDone(void)
/* EnumerationDone User response request is displayed to ask application jump to class. */ void USBH_USR_EnumerationDone(void)
{ USB_OTG_BSP_mDelay(500); USBH_USR_MSC_Application(); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Wait for one or more Signal Flags to become signaled for the current RUNNING thread. */
os_InRegs osEvent osSignalWait(int32_t signals, uint32_t millisec)
/* Wait for one or more Signal Flags to become signaled for the current RUNNING thread. */ os_InRegs osEvent osSignalWait(int32_t signals, uint32_t millisec)
{ ret.status = osErrorISR; return ret; } return __svcSignalWait(signals, millisec); }
ajhc/demo-cortex-m3
C++
null
38
/* Returns a ib_mad_port_private structure or NULL for a device/port Assumes ib_mad_port_list_lock is being held */
static struct ib_mad_port_private* __ib_get_mad_port(struct ib_device *device, int port_num)
/* Returns a ib_mad_port_private structure or NULL for a device/port Assumes ib_mad_port_list_lock is being held */ static struct ib_mad_port_private* __ib_get_mad_port(struct ib_device *device, int port_num)
{ struct ib_mad_port_private *entry; list_for_each_entry(entry, &ib_mad_port_list, port_list) { if (entry->device == device && entry->port_num == port_num) return entry; } return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Try to find a suspended protected call (a "recover point") for the given thread. */
static CallInfo* findpcall(lua_State *L)
/* Try to find a suspended protected call (a "recover point") for the given thread. */ static CallInfo* findpcall(lua_State *L)
{ if (ci->callstatus & CIST_YPCALL) return ci; } return NULL; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Use the DMA to get the results of the ADC converter. */
HAL_StatusTypeDef HAL_ADC_Dma(ADC_HandleTypeDef *hadc, uint32_t *pData, uint32_t Length)
/* Use the DMA to get the results of the ADC converter. */ HAL_StatusTypeDef HAL_ADC_Dma(ADC_HandleTypeDef *hadc, uint32_t *pData, uint32_t Length)
{ HAL_StatusTypeDef tmp_hal_status; if(!hadc->AdcResults) return HAL_ERROR; if(HAL_ADC_Start(hadc) != HAL_OK) return HAL_ERROR; if(!pData) return HAL_ERROR; hadc->AdcResults = pData; tmp_hal_status = HAL_ADC_Start_DMA(hadc,hadc->AdcResults,Length); if(tmp_hal_status != HAL_OK) return HAL_...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Abort a queued command that has been passed to the firmware layer if possible. This is all handled by the firmware. We aks the firmware and it either aborts the command or fails */
static int orchid_abort_scb(struct orc_host *host, struct orc_scb *scb)
/* Abort a queued command that has been passed to the firmware layer if possible. This is all handled by the firmware. We aks the firmware and it either aborts the command or fails */ static int orchid_abort_scb(struct orc_host *host, struct orc_scb *scb)
{ unsigned char data, status; outb(ORC_CMD_ABORT_SCB, host->base + ORC_HDATA); outb(HDO, host->base + ORC_HCTRL); if (wait_HDO_off(host) == 0) return 0; outb(scb->scbidx, host->base + ORC_HDATA); outb(HDO, host->base + ORC_HCTRL); if (wait_HDO_off(host) == 0) return 0; if (wait_hdi_set(host, &data) == 0) ...
robutest/uclinux
C++
GPL-2.0
60
/* Returns a positive value on success, a negative error code otherwise. */
static int mtd_ooblayout_count_bytes(struct mtd_info *mtd, int(*iter)(struct mtd_info *, int section, struct mtd_oob_region *oobregion))
/* Returns a positive value on success, a negative error code otherwise. */ static int mtd_ooblayout_count_bytes(struct mtd_info *mtd, int(*iter)(struct mtd_info *, int section, struct mtd_oob_region *oobregion))
{ struct mtd_oob_region oobregion; int section = 0, ret, nbytes = 0; while (1) { ret = iter(mtd, section++, &oobregion); if (ret) { if (ret == -ERANGE) ret = nbytes; break; } nbytes += oobregion.length; } return ret; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Setup the PC, SP, and GP of a secondary processor and start it running! */
static void __cpuinit sb1250_boot_secondary(int cpu, struct task_struct *idle)
/* Setup the PC, SP, and GP of a secondary processor and start it running! */ static void __cpuinit sb1250_boot_secondary(int cpu, struct task_struct *idle)
{ int retval; retval = cfe_cpu_start(cpu_logical_map(cpu), &smp_bootstrap, __KSTK_TOS(idle), (unsigned long)task_thread_info(idle), 0); if (retval != 0) printk("cfe_start_cpu(%i) returned %i\n" , cpu, retval); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Updates the CRC32 value in the table header. */
VOID PartitionSetCrc(IN OUT EFI_TABLE_HEADER *Hdr)
/* Updates the CRC32 value in the table header. */ VOID PartitionSetCrc(IN OUT EFI_TABLE_HEADER *Hdr)
{ PartitionSetCrcAltSize (Hdr->HeaderSize, Hdr); }
tianocore/edk2
C++
Other
4,240
/* Returns the number of characters written to @buf or -1 if an error occurs. */
int xmlStrVPrintf(xmlChar *buf, int len, const xmlChar *msg, va_list ap)
/* Returns the number of characters written to @buf or -1 if an error occurs. */ int xmlStrVPrintf(xmlChar *buf, int len, const xmlChar *msg, va_list ap)
{ return(-1); } ret = vsnprintf((char *) buf, len, (const char *) msg, ap); buf[len - 1] = 0; return(ret); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Return: 0 in case of success, a negative error code otherwise. */
int nanddev_erase(struct nand_device *nand, const struct nand_pos *pos)
/* Return: 0 in case of success, a negative error code otherwise. */ int nanddev_erase(struct nand_device *nand, const struct nand_pos *pos)
{ if (nanddev_isbad(nand, pos) || nanddev_isreserved(nand, pos)) { pr_warn("attempt to erase a bad/reserved block @%llx\n", nanddev_pos_to_offs(nand, pos)); return -EIO; } return nand->ops->erase(nand, pos); }
4ms/stm32mp1-baremetal
C++
Other
137
/* We should probably have a fallback mechanism to allocate virtual memory out of partially filled vmap blocks. However vmap block sizing should be fairly reasonable according to the vmalloc size, so it shouldn't be a big problem. */
static unsigned long addr_to_vb_idx(unsigned long addr)
/* We should probably have a fallback mechanism to allocate virtual memory out of partially filled vmap blocks. However vmap block sizing should be fairly reasonable according to the vmalloc size, so it shouldn't be a big problem. */ static unsigned long addr_to_vb_idx(unsigned long addr)
{ addr -= VMALLOC_START & ~(VMAP_BLOCK_SIZE-1); addr /= VMAP_BLOCK_SIZE; return addr; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the entry point structure for the table. */
VOID LibSmbios64BitGetEPS(OUT SMBIOS_TABLE_3_0_ENTRY_POINT **EntryPointStructure)
/* Get the entry point structure for the table. */ VOID LibSmbios64BitGetEPS(OUT SMBIOS_TABLE_3_0_ENTRY_POINT **EntryPointStructure)
{ *EntryPointStructure = mSmbios64BitTable; }
tianocore/edk2
C++
Other
4,240
/* The functions for inserting/removing us as a module. */
static int __init warrior_init(void)
/* The functions for inserting/removing us as a module. */ static int __init warrior_init(void)
{ return serio_register_driver(&warrior_drv); }
robutest/uclinux
C++
GPL-2.0
60
/* Send taskstats data in @skb to listener with nl_pid @pid */
static int send_reply(struct sk_buff *skb, struct genl_info *info)
/* Send taskstats data in @skb to listener with nl_pid @pid */ static int send_reply(struct sk_buff *skb, struct genl_info *info)
{ struct genlmsghdr *genlhdr = nlmsg_data(nlmsg_hdr(skb)); void *reply = genlmsg_data(genlhdr); int rc; rc = genlmsg_end(skb, reply); if (rc < 0) { nlmsg_free(skb); return rc; } return genlmsg_reply(skb, info); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Link up notification from BFA physical port module. */
void bfa_fcs_fabric_link_up(struct bfa_fcs_fabric_s *fabric)
/* Link up notification from BFA physical port module. */ void bfa_fcs_fabric_link_up(struct bfa_fcs_fabric_s *fabric)
{ bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn); bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LINK_UP); }
robutest/uclinux
C++
GPL-2.0
60
/* This service abstracts the capability to add an entry to the Event Log. */
EFI_STATUS EFIAPI TcgDxeLogEvent(IN EFI_TCG_PROTOCOL *This, IN TCG_PCR_EVENT *TCGLogData, IN OUT UINT32 *EventNumber, IN UINT32 Flags)
/* This service abstracts the capability to add an entry to the Event Log. */ EFI_STATUS EFIAPI TcgDxeLogEvent(IN EFI_TCG_PROTOCOL *This, IN TCG_PCR_EVENT *TCGLogData, IN OUT UINT32 *EventNumber, IN UINT32 Flags)
{ TCG_DXE_DATA *TcgData; if (TCGLogData == NULL) { return EFI_INVALID_PARAMETER; } TcgData = TCG_DXE_DATA_FROM_THIS (This); if (TcgData->BsCap.TPMDeactivatedFlag || (!TcgData->BsCap.TPMPresentFlag)) { return EFI_DEVICE_ERROR; } return TcgDxeLogEventI ( TcgData, (TCG_PCR_EVEN...
tianocore/edk2
C++
Other
4,240
/* mc32_flush_tx_ring - free transmit ring @lp: Local data of 3c527 to flush the tx ring of */
static void mc32_flush_tx_ring(struct net_device *dev)
/* mc32_flush_tx_ring - free transmit ring @lp: Local data of 3c527 to flush the tx ring of */ static void mc32_flush_tx_ring(struct net_device *dev)
{ struct mc32_local *lp = netdev_priv(dev); int i; for (i=0; i < TX_RING_LEN; i++) { if (lp->tx_ring[i].skb) { dev_kfree_skb(lp->tx_ring[i].skb); lp->tx_ring[i].skb = NULL; } } atomic_set(&lp->tx_count, 0); atomic_set(&lp->tx_ring_head, 0); lp->tx_ring_tail=0; }
robutest/uclinux
C++
GPL-2.0
60
/* ADC Enable Discontinuous Mode for Injected Conversions. In this mode the ADC converts sequentially one channel of the defined group of injected channels, cycling back to the first channel in the group once the entire group has been converted. */
void adc_enable_discontinuous_mode_injected(uint32_t adc)
/* ADC Enable Discontinuous Mode for Injected Conversions. In this mode the ADC converts sequentially one channel of the defined group of injected channels, cycling back to the first channel in the group once the entire group has been converted. */ void adc_enable_discontinuous_mode_injected(uint32_t adc)
{ ADC_CFGR1(adc) |= ADC_CFGR1_JDISCEN; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* This will return the event that will be read next, but does not increment the iterator. */
struct ring_buffer_event* ring_buffer_iter_peek(struct ring_buffer_iter *iter, u64 *ts)
/* This will return the event that will be read next, but does not increment the iterator. */ struct ring_buffer_event* ring_buffer_iter_peek(struct ring_buffer_iter *iter, u64 *ts)
{ struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer; struct ring_buffer_event *event; unsigned long flags; again: spin_lock_irqsave(&cpu_buffer->reader_lock, flags); event = rb_iter_peek(iter, ts); spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); if (event && event->type_len == RINGBUF_TYPE_PADD...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Clear Dualtimer module timer1/timer2 interrupt status. Clear the Dualtimer module timer1/timer2 interrupt status */
void dualtimer_clear_interrupt_status(enum dualtimer_timer timer)
/* Clear Dualtimer module timer1/timer2 interrupt status. Clear the Dualtimer module timer1/timer2 interrupt status */ void dualtimer_clear_interrupt_status(enum dualtimer_timer timer)
{ if (timer == DUALTIMER_TIMER1) { DUALTIMER0->TIMER1INTCLR.reg = 1; } else { DUALTIMER0->TIMER2INTCLR.reg = 1; } }
memfault/zero-to-main
C++
null
200
/* For use by USB host and peripheral drivers. */
void otg_put_transceiver(struct otg_transceiver *x)
/* For use by USB host and peripheral drivers. */ void otg_put_transceiver(struct otg_transceiver *x)
{ if (x) put_device(x->dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Recursively refresh the style of the children. Go deeper until a not NULL style is found because the NULL styles are inherited from the parent */
static void refresh_childen_style(lv_obj_t *obj)
/* Recursively refresh the style of the children. Go deeper until a not NULL style is found because the NULL styles are inherited from the parent */ static void refresh_childen_style(lv_obj_t *obj)
{ lv_obj_t * child = lv_obj_get_child(obj, NULL); while(child != NULL) { if(child->style_p == NULL) { refresh_childen_style(child); lv_obj_refresh_style(child); } else if(child->style_p->glass) { refresh_childen_style(child); } child = lv_obj_g...
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* This check should avoid most internal overflow cases. Clients should generally respond to */
static FT_Error cf2_checkTransform(const CF2_Matrix *transform, CF2_Int unitsPerEm)
/* This check should avoid most internal overflow cases. Clients should generally respond to */ static FT_Error cf2_checkTransform(const CF2_Matrix *transform, CF2_Int unitsPerEm)
{ CF2_Fixed maxScale; FT_ASSERT( unitsPerEm > 0 ); if ( transform->a <= 0 || transform->d <= 0 ) return FT_THROW( Invalid_Size_Handle ); FT_ASSERT( transform->b == 0 && transform->c == 0 ); FT_ASSERT( transform->tx == 0 && transform->ty == 0 ); if ( unitsPerEm > 0x7FFF ) return FT_T...
pikasTech/PikaPython
C++
MIT License
1,403
/* Disable a GPIO pin as a trigger to start an ADC capture. */
void GPIOADCTriggerDisable(uint32_t ui32Port, uint8_t ui8Pins)
/* Disable a GPIO pin as a trigger to start an ADC capture. */ void GPIOADCTriggerDisable(uint32_t ui32Port, uint8_t ui8Pins)
{ ASSERT(_GPIOBaseValid(ui32Port)); HWREG(ui32Port + GPIO_O_ADCCTL) &= (~ui8Pins); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Pin managed PCI device @pdev. Pinned device won't be disabled on driver detach. @pdev must have been enabled with pcim_enable_device(). */
void pcim_pin_device(struct pci_dev *pdev)
/* Pin managed PCI device @pdev. Pinned device won't be disabled on driver detach. @pdev must have been enabled with pcim_enable_device(). */ void pcim_pin_device(struct pci_dev *pdev)
{ struct pci_devres *dr; dr = find_pci_dr(pdev); WARN_ON(!dr || !dr->enabled); if (dr) dr->pinned = 1; }
robutest/uclinux
C++
GPL-2.0
60
/* @string: pointer to u16 string, on return advanced by one codepoint Return: first codepoint of string converted to lower case */
static s32 next_lower(const u16 **string)
/* @string: pointer to u16 string, on return advanced by one codepoint Return: first codepoint of string converted to lower case */ static s32 next_lower(const u16 **string)
{ return utf_to_lower(utf16_get(string)); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Configure the maximum size of packets that will be received */
static void igbvf_set_rlpml(struct igbvf_adapter *adapter)
/* Configure the maximum size of packets that will be received */ static void igbvf_set_rlpml(struct igbvf_adapter *adapter)
{ int max_frame_size = adapter->max_frame_size; struct e1000_hw *hw = &adapter->hw; if (adapter->vlgrp) max_frame_size += VLAN_TAG_SIZE; e1000_rlpml_set_vf(hw, max_frame_size); }
robutest/uclinux
C++
GPL-2.0
60
/* When allocating the initial buffer target we have not yet read in the superblock, so don't know what sized sectors are being used is at this early stage. Play safe. */
STATIC int xfs_setsize_buftarg_early(xfs_buftarg_t *btp, struct block_device *bdev)
/* When allocating the initial buffer target we have not yet read in the superblock, so don't know what sized sectors are being used is at this early stage. Play safe. */ STATIC int xfs_setsize_buftarg_early(xfs_buftarg_t *btp, struct block_device *bdev)
{ return xfs_setsize_buftarg_flags(btp, PAGE_CACHE_SIZE, bdev_logical_block_size(bdev), 0); }
robutest/uclinux
C++
GPL-2.0
60
/* check_pci_device_id - Checks if the device id is supported @id : device id Description: Function to check if the pci device id is supported by driver. Return value: Actual device id if supported else PCI_ANY_ID */
static u16 check_pci_device_id(u16 id)
/* check_pci_device_id - Checks if the device id is supported @id : device id Description: Function to check if the pci device id is supported by driver. Return value: Actual device id if supported else PCI_ANY_ID */ static u16 check_pci_device_id(u16 id)
{ switch (id) { case PCI_DEVICE_ID_HERC_WIN: case PCI_DEVICE_ID_HERC_UNI: return XFRAME_II_DEVICE; case PCI_DEVICE_ID_S2IO_UNI: case PCI_DEVICE_ID_S2IO_WIN: return XFRAME_I_DEVICE; default: return PCI_ANY_ID; } }
robutest/uclinux
C++
GPL-2.0
60
/* Remove all devices on the bus, except for the parent bridge. This also removes any child buses, and any devices they may contain in a depth-first manner. */
void pci_remove_behind_bridge(struct pci_dev *dev)
/* Remove all devices on the bus, except for the parent bridge. This also removes any child buses, and any devices they may contain in a depth-first manner. */ void pci_remove_behind_bridge(struct pci_dev *dev)
{ struct list_head *l, *n; if (dev->subordinate) list_for_each_safe(l, n, &dev->subordinate->devices) pci_remove_bus_device(pci_dev_b(l)); }
robutest/uclinux
C++
GPL-2.0
60
/* Get cache monitor event counter value from CMCC module. */
uint32_t _cmcc_get_monitor_event_count(const void *hw)
/* Get cache monitor event counter value from CMCC module. */ uint32_t _cmcc_get_monitor_event_count(const void *hw)
{ return hri_cmcc_read_MSR_reg(hw); }
eclipse-threadx/getting-started
C++
Other
310
/* Out-of-line map I/O functions for simple maps when CONFIG_COMPLEX_MAPPINGS is enabled. */
static map_word __xipram simple_map_read(struct map_info *map, unsigned long ofs)
/* Out-of-line map I/O functions for simple maps when CONFIG_COMPLEX_MAPPINGS is enabled. */ static map_word __xipram simple_map_read(struct map_info *map, unsigned long ofs)
{ return inline_map_read(map, ofs); }
robutest/uclinux
C++
GPL-2.0
60
/* This function will return the specified type of object information. */
struct rt_object_information* rt_object_get_information(enum rt_object_class_type type)
/* This function will return the specified type of object information. */ struct rt_object_information* rt_object_get_information(enum rt_object_class_type type)
{ int index; for (index = 0; index < RT_Object_Info_Unknown; index ++) if (_object_container[index].type == type) return &_object_container[index]; return RT_NULL; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Turns off creation and storage of HAL type results. */
inv_error_t inv_disable_eMPL_outputs(void)
/* Turns off creation and storage of HAL type results. */ inv_error_t inv_disable_eMPL_outputs(void)
{ inv_stop_eMPL_outputs(); return inv_unregister_mpl_start_notification(inv_start_eMPL_outputs); }
Luos-io/luos_engine
C++
MIT License
496
/* Clear transmit buffer empty flag @rmtoll ICR CTXBEF LL_SWPMI_ClearFlag_TXBE. */
void LL_SWPMI_ClearFlag_TXBE(SWPMI_TypeDef *SWPMIx)
/* Clear transmit buffer empty flag @rmtoll ICR CTXBEF LL_SWPMI_ClearFlag_TXBE. */ void LL_SWPMI_ClearFlag_TXBE(SWPMI_TypeDef *SWPMIx)
{ WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CTXBEF); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Get the width of a letter in a font. If */
uint8_t lv_font_get_width(const lv_font_t *font_p, uint32_t letter)
/* Get the width of a letter in a font. If */ uint8_t lv_font_get_width(const lv_font_t *font_p, uint32_t letter)
{ const lv_font_t * font_i = font_p; int16_t w; while(font_i != NULL) { w = font_i->get_width(font_i, letter); if(w >= 0) { uint8_t m = font_i->monospace; if(m) w = m; return w; } font_i = font_i->next_page; } return 0; }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Checks whether the specified DMAy Channelx flag is set or not. */
FlagStatus DMA_GetFlagStatus(uint32_t DMAy_FLAG)
/* Checks whether the specified DMAy Channelx flag is set or not. */ FlagStatus DMA_GetFlagStatus(uint32_t DMAy_FLAG)
{ FlagStatus bitstatus = RESET; uint32_t tmpreg = 0; assert_param(IS_DMA_GET_FLAG(DMAy_FLAG)); if ((DMAy_FLAG & FLAG_Mask) != (uint32_t)RESET) { ; } else { tmpreg = DMA1->ISR ; } if ((tmpreg & DMAy_FLAG) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Configures the TMRx Internal Trigger as External Clock. */
void TMR_ConfigIntTrigExternalClock(TMR_T *tmr, TMR_TRIGGER_SOURCE_T triggerSource)
/* Configures the TMRx Internal Trigger as External Clock. */ void TMR_ConfigIntTrigExternalClock(TMR_T *tmr, TMR_TRIGGER_SOURCE_T triggerSource)
{ TMR_SelectInputTrigger(tmr, triggerSource); tmr->SMCTRL_B.SMFSEL = TMR_SLAVE_MODE_EXTERNAL1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads the value of the specified register only when the device is ready to accept user requests. If the device ready flag is deactivated the read operation will be executed without checking the device state. */
int32_t ad7124_read_register(struct ad7124_dev *dev, struct ad7124_st_reg *p_reg)
/* Reads the value of the specified register only when the device is ready to accept user requests. If the device ready flag is deactivated the read operation will be executed without checking the device state. */ int32_t ad7124_read_register(struct ad7124_dev *dev, struct ad7124_st_reg *p_reg)
{ int32_t ret; if (p_reg->addr != AD7124_ERR_REG && dev->check_ready) { ret = ad7124_wait_for_spi_ready(dev, dev->spi_rdy_poll_cnt); if (ret < 0) return ret; } ret = ad7124_no_check_read_register(dev, p_reg); return ret; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd)
/* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd)
{ if(hpcd->Instance==USB_DRD_FS) { __HAL_RCC_USB_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, USB_FS_N_Pin|USB_FS_P_Pin); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param handle i2c master handle. param deviceAddress codec device address. param subAddress register address. param subaddressSize register address width. param rxBuff rx buffer pointer. param rxBuffSize rx buffer size. return kStatus_HAL_I2cSuccess is success, else receive failed. */
status_t CODEC_I2C_Receive(void *handle, uint8_t deviceAddress, uint32_t subAddress, uint8_t subaddressSize, uint8_t *rxBuff, uint8_t rxBuffSize)
/* param handle i2c master handle. param deviceAddress codec device address. param subAddress register address. param subaddressSize register address width. param rxBuff rx buffer pointer. param rxBuffSize rx buffer size. return kStatus_HAL_I2cSuccess is success, else receive failed. */ status_t CODEC_I2C_Receive(void...
{ hal_i2c_master_transfer_t masterXfer; masterXfer.slaveAddress = deviceAddress; masterXfer.direction = kHAL_I2cRead; masterXfer.subaddress = (uint32_t)subAddress; masterXfer.subaddressSize = subaddressSize; masterXfer.data = rxBuff; masterXfer.dataSize = rxBuffSiz...
eclipse-threadx/getting-started
C++
Other
310
/* There used to be a comment here about making the sort stable by using the addresses of the elements in the comparison function. This did not actually work, so any such code should be removed. */
void g_array_sort_with_data(GArray *farray, GCompareDataFunc compare_func, gpointer user_data)
/* There used to be a comment here about making the sort stable by using the addresses of the elements in the comparison function. This did not actually work, so any such code should be removed. */ void g_array_sort_with_data(GArray *farray, GCompareDataFunc compare_func, gpointer user_data)
{ GRealArray *array = (GRealArray*) farray; g_return_if_fail (array != NULL); g_qsort_with_data (array->data, array->len, array->elt_size, compare_func, user_data); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* 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 GPIOPinTypeADC(unsigned long ulPort, unsigned char ucPins)
/* 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 GPIOPinTypeADC(unsigned long ulPort, unsigned char ucPins)
{ ASSERT(GPIOBaseValid(ulPort)); GPIODirModeSet(ulPort, ucPins, GPIO_DIR_MODE_IN); GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_ANALOG); }
watterott/WebRadio
C++
null
71
/* Detemine SPIx Receive FIFO is empty or not. */
u32 SSI_Readable(SPI_TypeDef *spi_dev)
/* Detemine SPIx Receive FIFO is empty or not. */ u32 SSI_Readable(SPI_TypeDef *spi_dev)
{ u32 Status = SSI_GetStatus(spi_dev); u32 Readable = (((Status & BIT_SR_RFNE) != 0) ? 1 : 0); return Readable; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM7) { __HAL_RCC_TIM7_CLK_ENABLE(); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* count_fastmap_pebs - Counts the PEBs found by fastmap. @ai: The UBI attach info object */
static int count_fastmap_pebs(struct ubi_attach_info *ai)
/* count_fastmap_pebs - Counts the PEBs found by fastmap. @ai: The UBI attach info object */ static int count_fastmap_pebs(struct ubi_attach_info *ai)
{ struct ubi_ainf_peb *aeb; struct ubi_ainf_volume *av; struct rb_node *rb1, *rb2; int n = 0; list_for_each_entry(aeb, &ai->erase, u.list) n++; list_for_each_entry(aeb, &ai->free, u.list) n++; ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb) ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) n++; return...
4ms/stm32mp1-baremetal
C++
Other
137
/* get the SSL verifying mode of the SSL context */
int SSL_CTX_get_verify_mode(const SSL_CTX *ctx)
/* get the SSL verifying mode of the SSL context */ int SSL_CTX_get_verify_mode(const SSL_CTX *ctx)
{ SSL_ASSERT1(ctx); return ctx->verify_mode; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* This is the protosocket function that handles the communication. A protosocket function must always return an int, but must never explicitly return - all return statements are hidden in the PSOCK macros. */
static int handle_connection(struct hello_world_state *s)
/* This is the protosocket function that handles the communication. A protosocket function must always return an int, but must never explicitly return - all return statements are hidden in the PSOCK macros. */ static int handle_connection(struct hello_world_state *s)
{ PSOCK_BEGIN(&s->p); PSOCK_SEND_STR(&s->p, "Hello. What is your name?\n\r"); PSOCK_READTO(&s->p, '\n'); strncpy(s->name, s->inputbuffer, sizeof(s->name)); PSOCK_SEND_STR(&s->p, "Hello "); PSOCK_SEND_STR(&s->p, s->name); PSOCK_CLOSE(&s->p); PSOCK_END(&s->p); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* XXX: We should technically be able to change the new alert and unread alert catagories when we have no active connections. */
void ble_svc_ans_init(void)
/* XXX: We should technically be able to change the new alert and unread alert catagories when we have no active connections. */ void ble_svc_ans_init(void)
{ int rc; SYSINIT_ASSERT_ACTIVE(); rc = ble_gatts_count_cfg(ble_svc_ans_defs); SYSINIT_PANIC_ASSERT(rc == 0); rc = ble_gatts_add_svcs(ble_svc_ans_defs); SYSINIT_PANIC_ASSERT(rc == 0); ble_svc_ans_new_alert_cat = MYNEWT_VAL(BLE_SVC_ANS_NEW_ALERT_CAT); ble_svc_ans_unr_alert_cat = MYNEWT_VA...
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Configures the alternate function of a GPIO pin. */
void GPIOPinConfigure(unsigned long ulPinConfig)
/* Configures the alternate function of a GPIO pin. */ void GPIOPinConfigure(unsigned long ulPinConfig)
{ unsigned long ulBase, ulShift; ASSERT(((ulPinConfig >> 16) & 0xff) < 9); ASSERT(((ulPinConfig >> 8) & 0xe3) == 0); ulBase = (ulPinConfig >> 16) & 0xff; if(HWREG(SYSCTL_GPIOHSCTL) & (1 << ulBase)) { ulBase = g_pulGPIOBaseAddrs[(ulBase << 1) + 1]; } else { ulBase = g_...
watterott/WebRadio
C++
null
71
/* calculate the CRC value of an array of 32-bit values */
uint32_t crc_block_data_calculate(const uint32_t *array, uint32_t size)
/* calculate the CRC value of an array of 32-bit values */ uint32_t crc_block_data_calculate(const uint32_t *array, uint32_t size)
{ uint32_t index; for(index = 0U; index < size; index++){ CRC_DATA = *(array+index); } return (CRC_DATA); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Do AND operation with the value of the specified SD/MMC host controller mmio register. */
EFI_STATUS EFIAPI SdMmcHcAndMmio(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 BarIndex, IN UINT32 Offset, IN UINT8 Count, IN VOID *AndData)
/* Do AND operation with the value of the specified SD/MMC host controller mmio register. */ EFI_STATUS EFIAPI SdMmcHcAndMmio(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 BarIndex, IN UINT32 Offset, IN UINT8 Count, IN VOID *AndData)
{ EFI_STATUS Status; UINT64 Data; UINT64 And; Status = SdMmcHcRwMmio (PciIo, BarIndex, Offset, TRUE, Count, &Data); if (EFI_ERROR (Status)) { return Status; } if (Count == 1) { And = *(UINT8 *)AndData; } else if (Count == 2) { And = *(UINT16 *)AndData; } else if (Count == 4) { ...
tianocore/edk2
C++
Other
4,240
/* This API reads the data from the given register. */
BMM050_RETURN_FUNCTION_TYPE bmm050_read_register(u8 v_addr_u8, u8 *v_data_u8, u8 v_len_u8)
/* This API reads the data from the given register. */ BMM050_RETURN_FUNCTION_TYPE bmm050_read_register(u8 v_addr_u8, u8 *v_data_u8, u8 v_len_u8)
{ BMM050_RETURN_FUNCTION_TYPE com_rslt = ERROR; if (p_bmm050 == BMM050_NULL) { return E_BMM050_NULL_PTR; } else { com_rslt = p_bmm050->BMM050_BUS_READ_FUNC(p_bmm050->dev_addr, v_addr_u8, v_data_u8, v_len_u8); } return com_rslt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base Pointer to FLEXIO_I2S_Type structure. param handle Pointer to flexio_i2s_handle_t structure to store the transfer state. param callback FlexIO I2S callback function, which is called while finished a block. param userData User parameter for the FlexIO I2S callback. */
void FLEXIO_I2S_TransferRxCreateHandle(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_callback_t callback, void *userData)
/* param base Pointer to FLEXIO_I2S_Type structure. param handle Pointer to flexio_i2s_handle_t structure to store the transfer state. param callback FlexIO I2S callback function, which is called while finished a block. param userData User parameter for the FlexIO I2S callback. */ void FLEXIO_I2S_TransferRxCreateHandl...
{ assert(handle != NULL); IRQn_Type flexio_irqs[] = FLEXIO_IRQS; (void)memset(handle, 0, sizeof(*handle)); handle->callback = callback; handle->userData = userData; (void)FLEXIO_RegisterHandleIRQ(base, handle, FLEXIO_I2S_TransferRxHandleIRQ); handle->state = (uint32_t)kFLEXIO_I2S_Idle; (...
eclipse-threadx/getting-started
C++
Other
310
/* Set exception handler in IDT table by ExceptionNum. */
VOID SetExceptionHandlerInIdtEntry(IN UINTN ExceptionNum, IN VOID *ExceptionHandler)
/* Set exception handler in IDT table by ExceptionNum. */ VOID SetExceptionHandlerInIdtEntry(IN UINTN ExceptionNum, IN VOID *ExceptionHandler)
{ IA32_IDT_GATE_DESCRIPTOR *IdtEntry; IA32_DESCRIPTOR IdtDescriptor; AsmReadIdtr (&IdtDescriptor); IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor.Base; IdtEntry[ExceptionNum].Bits.OffsetLow = (UINT16)(UINTN)ExceptionHandler; IdtEntry[ExceptionNum].Bits.OffsetHigh = (UINT16)((UINTN)Exceptio...
tianocore/edk2
C++
Other
4,240
/* Description: Ends all I/O on a request. It does not handle partial completions, unless the driver actually implements this in its completion callback through requeueing. The actual completion happens out-of-order, through a softirq handler. The user must have registered a completion callback through blk_queue_softir...
void blk_complete_request(struct request *req)
/* Description: Ends all I/O on a request. It does not handle partial completions, unless the driver actually implements this in its completion callback through requeueing. The actual completion happens out-of-order, through a softirq handler. The user must have registered a completion callback through blk_queue_softir...
{ if (unlikely(blk_should_fake_timeout(req->q))) return; if (!blk_mark_rq_complete(req)) __blk_complete_request(req); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Disable the TIMERA3 ADC trigger. This function disables the ADC trigger within TIMERA3. */
void am_hal_ctimer_adc_trigger_disable(void)
/* Disable the TIMERA3 ADC trigger. This function disables the ADC trigger within TIMERA3. */ void am_hal_ctimer_adc_trigger_disable(void)
{ AM_CRITICAL_BEGIN_ASM AM_REGn(CTIMER, 0, CTRL3) &= ~AM_REG_CTIMER_CTRL3_ADCEN_M; AM_CRITICAL_END_ASM }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Registers an interrupt handler for an ADC interrupt. */
void ADCIntRegister(unsigned long ulBase, unsigned long ulSequenceNum, void(*pfnHandler)(void))
/* Registers an interrupt handler for an ADC interrupt. */ void ADCIntRegister(unsigned long ulBase, unsigned long ulSequenceNum, void(*pfnHandler)(void))
{ unsigned long ulInt; ASSERT((ulBase == ADC0_BASE) || (ulBase == ADC1_BASE)); ASSERT(ulSequenceNum < 4); ulInt = INT_ADC0 + ulSequenceNum; IntRegister(ulInt, pfnHandler); IntEnable(ulInt); }
watterott/WebRadio
C++
null
71
/* This function does not return until the protection has been saved. */
int32_t FlashAllUserRegisterSave(void)
/* This function does not return until the protection has been saved. */ int32_t FlashAllUserRegisterSave(void)
{ uint32_t ui32Index; for(ui32Index = 0; ui32Index < 4; ui32Index++) { HWREG(FLASH_FMA) = (0x80000000 + ui32Index); HWREG(FLASH_FMC) = FLASH_FMC_WRKEY | FLASH_FMC_COMT; while(HWREG(FLASH_FMC) & FLASH_FMC_COMT) { } } return(0); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* event input callback - just redirect events to subscribers */
static int dummy_input(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop)
/* event input callback - just redirect events to subscribers */ static int dummy_input(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop)
{ struct snd_seq_dummy_port *p; struct snd_seq_event tmpev; p = private_data; if (ev->source.client == SNDRV_SEQ_CLIENT_SYSTEM || ev->type == SNDRV_SEQ_EVENT_KERNEL_ERROR) return 0; tmpev = *ev; if (p->duplex) tmpev.source.port = p->connect; else tmpev.source.port = p->port; tmpev.dest.client = SNDRV...
robutest/uclinux
C++
GPL-2.0
60
/* bfa_ioim_api Allocate IOIM resource for initiator mode I/O request. */
struct bfa_ioim_s* bfa_ioim_alloc(struct bfa_s *bfa, struct bfad_ioim_s *dio, struct bfa_itnim_s *itnim, u16 nsges)
/* bfa_ioim_api Allocate IOIM resource for initiator mode I/O request. */ struct bfa_ioim_s* bfa_ioim_alloc(struct bfa_s *bfa, struct bfad_ioim_s *dio, struct bfa_itnim_s *itnim, u16 nsges)
{ struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); struct bfa_ioim_s *ioim; bfa_q_deq(&fcpim->ioim_free_q, &ioim); if (!ioim) { bfa_fcpim_stats(fcpim, no_iotags); return NULL; } ioim->dio = dio; ioim->itnim = itnim; ioim->nsges = nsges; ioim->nsgpgs = 0; bfa_stats(fcpim, total_ios); bfa_stats(itnim, i...
robutest/uclinux
C++
GPL-2.0
60
/* Return the number of bytes that can be queued to this device at the present time. The result should be treated as a guarantee and the driver cannot offer a value it later shrinks by more than the number of bytes written. If no method is provided 2K is always returned and data may be lost as there will be no flow con...
int tty_write_room(struct tty_struct *tty)
/* Return the number of bytes that can be queued to this device at the present time. The result should be treated as a guarantee and the driver cannot offer a value it later shrinks by more than the number of bytes written. If no method is provided 2K is always returned and data may be lost as there will be no flow con...
{ if (tty->ops->write_room) return tty->ops->write_room(tty); return 2048; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the page base address according to pool head address. */
VOID* AdjustPoolHeadF(IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NoPages, IN UINTN Size)
/* Get the page base address according to pool head address. */ VOID* AdjustPoolHeadF(IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NoPages, IN UINTN Size)
{ if ((Memory == 0) || ((PcdGet8 (PcdHeapGuardPropertyMask) & BIT7) != 0)) { return (VOID *)(UINTN)Memory; } return (VOID *)(UINTN)(Memory + Size - EFI_PAGES_TO_SIZE (NoPages)); }
tianocore/edk2
C++
Other
4,240
/* Returns: The disk address for the block or 0 on hole or error */
static sector_t gfs2_bmap(struct address_space *mapping, sector_t lblock)
/* Returns: The disk address for the block or 0 on hole or error */ static sector_t gfs2_bmap(struct address_space *mapping, sector_t lblock)
{ struct gfs2_inode *ip = GFS2_I(mapping->host); struct gfs2_holder i_gh; sector_t dblock = 0; int error; error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh); if (error) return 0; if (!gfs2_is_stuffed(ip)) dblock = generic_block_bmap(mapping, lblock, gfs2_block_map); gfs2_glock_dq_uninit(...
robutest/uclinux
C++
GPL-2.0
60
/* Description: This routine is called when the PCI bus has permanently failed. */
static void ipr_pci_perm_failure(struct pci_dev *pdev)
/* Description: This routine is called when the PCI bus has permanently failed. */ static void ipr_pci_perm_failure(struct pci_dev *pdev)
{ unsigned long flags = 0; struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(pdev); spin_lock_irqsave(ioa_cfg->host->host_lock, flags); if (ioa_cfg->sdt_state == WAIT_FOR_DUMP) ioa_cfg->sdt_state = ABORT_DUMP; ioa_cfg->reset_retries = IPR_NUM_RESET_RELOAD_RETRIES; ioa_cfg->in_ioa_bringdown = 1; ioa_cfg->allow_cmds...
robutest/uclinux
C++
GPL-2.0
60
/* brief Return Frequency of Ethernet RMII return Frequency of Ethernet RMII */
uint32_t CLOCK_GetEnetRmiiClkFreq(void)
/* brief Return Frequency of Ethernet RMII return Frequency of Ethernet RMII */ uint32_t CLOCK_GetEnetRmiiClkFreq(void)
{ uint32_t freq = 0U; switch (SYSCON->ENETRMIICLKSEL) { case 1U: freq = CLOCK_GetPll0OutFreq(); break; case 2U: freq = CLOCK_GetExtClkFreq(); break; case 5U: freq = CLOCK_GetPll1OutFreq() / (((SYSCON->PLL1CLK0DIV) & 0xffU) +...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base LPUART peripheral base address. param handle Pointer to lpuart_edma_handle_t structure. */
void LPUART_TransferAbortSendEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle)
/* param base LPUART peripheral base address. param handle Pointer to lpuart_edma_handle_t structure. */ void LPUART_TransferAbortSendEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle)
{ assert(handle); assert(handle->txEdmaHandle); LPUART_EnableTxDMA(base, false); EDMA_AbortTransfer(handle->txEdmaHandle); handle->txState = kLPUART_TxIdle; }
nanoframework/nf-interpreter
C++
MIT License
293
/* This API gets the status of FIFO self wake up functionality from the sensor. */
uint16_t bma4_get_fifo_self_wakeup(uint8_t *fifo_self_wake_up, struct bma4_dev *dev)
/* This API gets the status of FIFO self wake up functionality from the sensor. */ uint16_t bma4_get_fifo_self_wakeup(uint8_t *fifo_self_wake_up, struct bma4_dev *dev)
{ uint16_t rslt = 0; uint8_t data = 0; if (dev == NULL) { rslt |= BMA4_E_NULL_PTR; } else { rslt |= bma4_read_regs(BMA4_POWER_CONF_ADDR, &data, 1, dev); if (rslt == BMA4_OK) *fifo_self_wake_up = BMA4_GET_BITSLICE(data, BMA4_FIFO_SELF_WAKE_UP); } return rslt; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* NB: the following does not "round up" for non-power-of-2 'size'; but this is OK because many other things will break if 'size' is irregular... */
static int get_blk_adr_bytes(u64 size, u32 writesize)
/* NB: the following does not "round up" for non-power-of-2 'size'; but this is OK because many other things will break if 'size' is irregular... */ static int get_blk_adr_bytes(u64 size, u32 writesize)
{ return ALIGN(ilog2(size) - ilog2(writesize), 8) >> 3; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Check that k_thread_suspend() is a schedule point when called on the current thread. */
ZTEST(threads_lifecycle, test_threads_suspend)
/* Check that k_thread_suspend() is a schedule point when called on the current thread. */ ZTEST(threads_lifecycle, test_threads_suspend)
{ after_suspend = false; k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE, suspend_myself, NULL, NULL, NULL, 0, K_USER, K_NO_WAIT); k_msleep(100); zassert_false(after_suspend, "thread woke up unexpectedly"); k_thread_abort(tid); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* set 'performance' registers .. we must STOP lance for that */
static void ni65_set_performance(struct priv *p)
/* set 'performance' registers .. we must STOP lance for that */ static void ni65_set_performance(struct priv *p)
{ writereg(CSR0_STOP | CSR0_CLRALL,CSR0); if( !(cards[p->cardno].config & 0x02) ) return; outw(80,PORT+L_ADDRREG); if(inw(PORT+L_ADDRREG) != 80) return; writereg( (csr80 & 0x3fff) ,80); outw(0,PORT+L_ADDRREG); outw((short)isa0,PORT+L_BUSIF); outw(1,PORT+L_ADDRREG); outw((short)isa1,PORT+L_BUSIF); outw(C...
robutest/uclinux
C++
GPL-2.0
60
/* RETURNS: 1 if ok in workqueue, 0 otherwise. */
static int ata_hsm_ok_in_wq(struct ata_port *ap, struct ata_queued_cmd *qc)
/* RETURNS: 1 if ok in workqueue, 0 otherwise. */ static int ata_hsm_ok_in_wq(struct ata_port *ap, struct ata_queued_cmd *qc)
{ if (qc->tf.flags & ATA_TFLAG_POLLING) return 1; if (ap->hsm_task_state == HSM_ST_FIRST) { if (qc->tf.protocol == ATA_PROT_PIO && (qc->tf.flags & ATA_TFLAG_WRITE)) return 1; if (ata_is_atapi(qc->tf.protocol) && !(qc->dev->flags & ATA_DFLAG_CDB_INTR)) return 1; } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The entry point for IP6 driver which installs the driver binding and component name protocol on its image. */
EFI_STATUS EFIAPI Ip6DriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The entry point for IP6 driver which installs the driver binding and component name protocol on its image. */ EFI_STATUS EFIAPI Ip6DriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ VOID *Registration; EfiCreateProtocolNotifyEvent ( &gEfiIpSec2ProtocolGuid, TPL_CALLBACK, IpSec2InstalledCallback, NULL, &Registration ); return EfiLibInstallDriverBindingComponentName2 ( ImageHandle, SystemTable, &gIp6DriverBinding, ImageHand...
tianocore/edk2
C++
Other
4,240
/* Set the pitch of a possibly playing note. */
static void set_pitch(struct snd_emu8000 *hw, struct snd_emux_voice *vp)
/* Set the pitch of a possibly playing note. */ static void set_pitch(struct snd_emu8000 *hw, struct snd_emux_voice *vp)
{ EMU8000_IP_WRITE(hw, vp->ch, vp->apitch); }
robutest/uclinux
C++
GPL-2.0
60
/* Retrieves the size, in bytes, of the context buffer required for SM3 hash operations. */
UINTN EFIAPI Sm3GetContextSize(VOID)
/* Retrieves the size, in bytes, of the context buffer required for SM3 hash operations. */ UINTN EFIAPI Sm3GetContextSize(VOID)
{ CALL_CRYPTO_SERVICE (Sm3GetContextSize, (), 0); }
tianocore/edk2
C++
Other
4,240
/* ksm_do_scan - the ksm scanner main worker function. @scan_npages - number of pages we want to scan before we return. */
static void ksm_do_scan(unsigned int scan_npages)
/* ksm_do_scan - the ksm scanner main worker function. @scan_npages - number of pages we want to scan before we return. */ static void ksm_do_scan(unsigned int scan_npages)
{ struct rmap_item *rmap_item; struct page *page; while (scan_npages--) { cond_resched(); rmap_item = scan_get_next_rmap_item(&page); if (!rmap_item) return; if (!PageKsm(page) || !in_stable_tree(rmap_item)) cmp_and_merge_page(page, rmap_item); put_page(page); } }
robutest/uclinux
C++
GPL-2.0
60
/* Set the ACC output. Where the input parameter */
void acc_set_output(Acc *p_acc, uint32_t ul_invert, uint32_t ul_fault_enable, uint32_t ul_fault_source)
/* Set the ACC output. Where the input parameter */ void acc_set_output(Acc *p_acc, uint32_t ul_invert, uint32_t ul_fault_enable, uint32_t ul_fault_source)
{ Assert(p_acc); p_acc->ACC_MR &= ~(ACC_MR_INV_EN | ACC_MR_FE_EN | ACC_MR_SELFS_OUTPUT); p_acc->ACC_MR |= ul_invert | ul_fault_source | ul_fault_enable; }
remotemcu/remcu-chip-sdks
C++
null
436
/* See Cycle bit rules. SW is the consumer for the event ring only. Don't make a ring full of link TRBs. That would be dumb and this would loop. */
static void inc_deq(struct xhci_ctrl *ctrl, struct xhci_ring *ring)
/* See Cycle bit rules. SW is the consumer for the event ring only. Don't make a ring full of link TRBs. That would be dumb and this would loop. */ static void inc_deq(struct xhci_ctrl *ctrl, struct xhci_ring *ring)
{ do { if (last_trb(ctrl, ring, ring->deq_seg, ring->dequeue)) { if (ring == ctrl->event_ring && last_trb_on_last_seg(ctrl, ring, ring->deq_seg, ring->dequeue)) { ring->cycle_state = (ring->cycle_state ? 0 : 1); } ring->deq_seg = ring->deq_seg->next; ring->dequeue = ring->deq_seg->trbs; ...
4ms/stm32mp1-baremetal
C++
Other
137
/* Reset USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_ResetEP(U32 EPNum)
/* Reset USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ void USBD_ResetEP(U32 EPNum)
{ ep_buffer_t *desc = get_desc(EPNum); EPNum &= EPNUM_MASK; MXC_USB->ep[EPNum] |= MXC_F_USB_EP_DT; if (ep_info[EPNum].type == MXC_S_USB_EP_DIR_OUT) { desc = get_desc(EPNum); desc->buf0_address = (uint32_t)ep_buffer[EPNum]; desc->buf0_desc = sizeof(ep_buffer[EPNum]); MXC_USB->out_owner = (1 << EP...
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* To reset the device, we use the KVM_VIRTIO_RESET hypercall, using the descriptor address. The Host will zero the status and all the features. */
static void kvm_reset(struct virtio_device *vdev)
/* To reset the device, we use the KVM_VIRTIO_RESET hypercall, using the descriptor address. The Host will zero the status and all the features. */ static void kvm_reset(struct virtio_device *vdev)
{ kvm_hypercall1(KVM_S390_VIRTIO_RESET, (unsigned long) to_kvmdev(vdev)->desc); }
robutest/uclinux
C++
GPL-2.0
60
/* bearer_push(): Resolve bearer congestion. Force the waiting links to push out their unsent packets, one packet per link per iteration, until all packets are gone or congestion reoccurs. 'tipc_net_lock' is read_locked when this function is called bearer.lock must be taken before calling Returns binary true(1) ore fal...
static int bearer_push(struct bearer *b_ptr)
/* bearer_push(): Resolve bearer congestion. Force the waiting links to push out their unsent packets, one packet per link per iteration, until all packets are gone or congestion reoccurs. 'tipc_net_lock' is read_locked when this function is called bearer.lock must be taken before calling Returns binary true(1) ore fal...
{ u32 res = 0; struct link *ln, *tln; if (b_ptr->publ.blocked) return 0; while (!list_empty(&b_ptr->cong_links) && (res != PUSH_FAILED)) { list_for_each_entry_safe(ln, tln, &b_ptr->cong_links, link_list) { res = tipc_link_push_packet(ln); if (res == PUSH_FAILED) break; if (res == PUSH_FINISHED) ...
EmcraftSystems/linux-emcraft
C++
Other
266