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
/* Writes PE internal data memory (DMEM) from the host through indirect access registers. */
void pe_dmem_write(int id, u32 val, u32 addr, u8 size)
/* Writes PE internal data memory (DMEM) from the host through indirect access registers. */ void pe_dmem_write(int id, u32 val, u32 addr, u8 size)
{ u32 offset = addr & 0x3; addr = pe[id].dmem_base_addr | (addr & ~0x3) | PE_MEM_ACCESS_WRITE | PE_MEM_ACCESS_DMEM | PE_MEM_ACCESS_BYTE_ENABLE(offset, size); writel(cpu_to_be32(val << (offset << 3)), pe[id].mem_access_wdata); writel(addr, pe[id].mem_access_addr); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Enable/disable the DIV_ONE feature of the specified SPI port. When this fuction is enabled, both the REORDER field and the VARCLK_EN field must be configured as 0. In other words, the byte-reorder function, byte suspend function and variable clock function must be disable. */
void SPIDivOneFunction(unsigned long ulBase, xtBoolean xtEnable)
/* Enable/disable the DIV_ONE feature of the specified SPI port. When this fuction is enabled, both the REORDER field and the VARCLK_EN field must be configured as 0. In other words, the byte-reorder function, byte suspend function and variable clock function must be disable. */ void SPIDivOneFunction(unsigned long ul...
{ xASSERT(ulBase == SPI0_BASE); if (xtEnable) { xHWREG(ulBase + SPI_CNTRL2) |= SPI_CNTRL2_DIV_ONE; xHWREG(ulBase + SPI_CNTRL) &= ~SPI_CNTRL_VARCLK_EN; xHWREG(ulBase + SPI_CNTRL) &= (~SPI_CNTRL_REORDER_M); } else { xHWREG(ulBase + SPI_CNTRL2) &= ~SPI_CNTRL2_DIV_ON...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Selects the clock source to output on MCO1 pin. */
void RCM_ConfigMCO1(RCM_MCO1_SEL_T mco1Select, RCM_MCO1_DIV_T mco1Div)
/* Selects the clock source to output on MCO1 pin. */ void RCM_ConfigMCO1(RCM_MCO1_SEL_T mco1Select, RCM_MCO1_DIV_T mco1Div)
{ RCM->CFG_B.MCO1SEL = mco1Select; RCM->CFG_B.MCO1PRE = mco1Div; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enable the output direction of the specified GPIO. */
int32_t gpio_direction_output(gpio_desc *desc, uint8_t value)
/* Enable the output direction of the specified GPIO. */ int32_t gpio_direction_output(gpio_desc *desc, uint8_t value)
{ int32_t ret; uint16_t pin; uint8_t port; gpio_get_portpin(desc, &pin, &port); ret = adi_gpio_OutputEnable(port, pin, true); if(ret < 0) return ret; if(value == 1) return adi_gpio_SetHigh(port, pin); else return adi_gpio_SetLow(port, pin); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Called from the LLD when the network link is ready. */
void fcoe_ctlr_link_up(struct fcoe_ctlr *fip)
/* Called from the LLD when the network link is ready. */ void fcoe_ctlr_link_up(struct fcoe_ctlr *fip)
{ spin_lock_bh(&fip->lock); if (fip->state == FIP_ST_NON_FIP || fip->state == FIP_ST_AUTO) { fip->last_link = 1; fip->link = 1; spin_unlock_bh(&fip->lock); fc_linkup(fip->lp); } else if (fip->state == FIP_ST_LINK_WAIT) { fip->state = fip->mode; fip->last_link = 1; fip->link = 1; spin_unlock_bh(&fip->...
robutest/uclinux
C++
GPL-2.0
60
/* UART DMA send finished callback function. This function is called when UART DMA send finished. It disables the UART TX DMA request and sends kStatus_UART_TxIdle to UART callback. */
static void UART_TransferSendDMACallback(dma_handle_t *handle, void *param)
/* UART DMA send finished callback function. This function is called when UART DMA send finished. It disables the UART TX DMA request and sends kStatus_UART_TxIdle to UART callback. */ static void UART_TransferSendDMACallback(dma_handle_t *handle, void *param)
{ assert(handle); assert(param); uart_dma_private_handle_t *uartPrivateHandle = (uart_dma_private_handle_t *)param; UART_EnableTxDMA(uartPrivateHandle->base, false); DMA_DisableInterrupts(handle->base, handle->channel); uartPrivateHandle->handle->txState = kUART_TxIdle; if (uartPrivateHandle...
labapart/polymcu
C++
null
201
/* Returns mmrbc: maximum memory read count in bytes or appropriate error value. */
int pcix_get_mmrbc(struct pci_dev *dev)
/* Returns mmrbc: maximum memory read count in bytes or appropriate error value. */ int pcix_get_mmrbc(struct pci_dev *dev)
{ int ret, cap; u32 cmd; cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); if (!cap) return -EINVAL; ret = pci_read_config_dword(dev, cap + PCI_X_CMD, &cmd); if (!ret) ret = 512 << ((cmd & PCI_X_CMD_MAX_READ) >> 2); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Errors which originate from within the journaling layer will NOT supply an errno; a null errno implies that absolutely no further writes are done to the journal (unless there are any already in progress). */
void jbd2_journal_abort(journal_t *journal, int errno)
/* Errors which originate from within the journaling layer will NOT supply an errno; a null errno implies that absolutely no further writes are done to the journal (unless there are any already in progress). */ void jbd2_journal_abort(journal_t *journal, int errno)
{ __journal_abort_soft(journal, errno); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns command index of last command for which response received. */
uint8_t SDIO_GetCmdResp(void)
/* Returns command index of last command for which response received. */ uint8_t SDIO_GetCmdResp(void)
{ return (uint8_t)(SDIO->CMDRESP); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Forces or releases Low Speed APB (APB1) peripheral reset. */
void RCC_APB1PeriphResetCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
/* Forces or releases Low Speed APB (APB1) peripheral reset. */ void RCC_APB1PeriphResetCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
{ assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RCC->APB1RSTR |= RCC_APB1Periph; } else { RCC->APB1RSTR &= ~RCC_APB1Periph; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Prepare the machine for transition to protected mode. Invoke the realmode switch hook if present; otherwise disable all interrupts. */
static void realmode_switch_hook(void)
/* Prepare the machine for transition to protected mode. Invoke the realmode switch hook if present; otherwise disable all interrupts. */ static void realmode_switch_hook(void)
{ if (boot_params.hdr.realmode_swtch) { asm volatile("lcallw *%0" : : "m" (boot_params.hdr.realmode_swtch) : "eax", "ebx", "ecx", "edx"); } else { asm volatile("cli"); outb(0x80, 0x70); io_delay(); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* De-initializes the RNG peripheral registers to their default reset values. */
void RNG_DeInit(void)
/* De-initializes the RNG peripheral registers to their default reset values. */ void RNG_DeInit(void)
{ RCC_AHB2PeriphResetCmd(RCC_AHB2Periph_RNG, ENABLE); RCC_AHB2PeriphResetCmd(RCC_AHB2Periph_RNG, DISABLE); }
MaJerle/stm32f429
C++
null
2,036
/* Probe for a maXTouch connected to a specific TWI line. */
status_code_t mxt_probe_device(twihs_master_t interface, uint8_t chip_adr)
/* Probe for a maXTouch connected to a specific TWI line. */ status_code_t mxt_probe_device(twihs_master_t interface, uint8_t chip_adr)
{ struct mxt_info_object info; uint8_t status; twihs_package_t packet = { .addr[0] = MXT_MEM_ADDR, .addr[1] = MXT_MEM_ADDR >> 8, .addr_length = sizeof(mxt_memory_adr), .chip = chip_adr, .buffer = &info, .length = sizeof(info) }; status = twihs_master_read(interface, &pack...
remotemcu/remcu-chip-sdks
C++
null
436
/* Clears or safeguards the OCREF1 signal on an external event. */
void TIM_ClearOC1Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
/* Clears or safeguards the OCREF1 signal on an external event. */ void TIM_ClearOC1Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
{ uint16_t tmpccmr1 = 0; assert_param(IS_TIM_123458_PERIPH(TIMx)); assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear)); tmpccmr1 = TIMx->CCMR1; tmpccmr1 &= CCMR_OC13CE_Reset; tmpccmr1 |= TIM_OCClear; TIMx->CCMR1 = tmpccmr1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Clear Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_ClrStallEP(uint32_t EPNum)
/* Clear Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ void USBD_ClrStallEP(uint32_t EPNum)
{ uint32_t *ptr; ptr = GetEpCmdStatPtr(EPNum); if (EPNum & USB_IN_MASK) { *ptr &= ~EP_STALL; } else { *ptr &= ~EP_STALL; *ptr |= EP_BUF_ACTIVE; } USBD_ResetEP(EPNum); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* return < 0 -> Error >= 0 -> Data */
int usbvision_read_reg(struct usb_usbvision *usbvision, unsigned char reg)
/* return < 0 -> Error >= 0 -> Data */ int usbvision_read_reg(struct usb_usbvision *usbvision, unsigned char reg)
{ int errCode = 0; unsigned char buffer[1]; if (!USBVISION_IS_OPERATIONAL(usbvision)) return -1; errCode = usb_control_msg(usbvision->dev, usb_rcvctrlpipe(usbvision->dev, 1), USBVISION_OP_CODE, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT, 0, (__u16) reg, buffer, 1, HZ); if (errCode < 0) { dev...
robutest/uclinux
C++
GPL-2.0
60
/* Simple function to provide early output, before even sn_sal_serial_console_init is called. Referenced in the console struct registerd in sn_serial_console_early_setup. */
static void __init sn_sal_console_write_early(struct console *co, const char *s, unsigned count)
/* Simple function to provide early output, before even sn_sal_serial_console_init is called. Referenced in the console struct registerd in sn_serial_console_early_setup. */ static void __init sn_sal_console_write_early(struct console *co, const char *s, unsigned count)
{ puts_raw_fixed(sal_console_port.sc_ops->sal_puts_raw, s, count); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the endpoint interrupt status on a given USB controller. */
uint32_t USBIntStatusEndpoint(uint32_t ui32Base)
/* Returns the endpoint interrupt status on a given USB controller. */ uint32_t USBIntStatusEndpoint(uint32_t ui32Base)
{ uint32_t ui32Status; ASSERT(ui32Base == USB0_BASE); ui32Status = HWREGH(ui32Base + USB_O_TXIS); ui32Status |= (HWREGH(ui32Base + USB_O_RXIS) << USB_INTEP_RX_SHIFT); return(ui32Status); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Format the data in the tvb from offset for length ... */
gchar* tvb_format_text(tvbuff_t *tvb, const gint offset, const gint size)
/* Format the data in the tvb from offset for length ... */ gchar* tvb_format_text(tvbuff_t *tvb, const gint offset, const gint size)
{ const guint8 *ptr; gint len; len = (size > 0) ? size : 0; ptr = ensure_contiguous(tvb, offset, size); return format_text(ptr, len); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Read the whole usb hub descriptor. It is necessary to do it in two steps because hub descriptor is of variable length. */
EFI_STATUS UsbHubReadDesc(IN USB_DEVICE *HubDev, OUT EFI_USB_HUB_DESCRIPTOR *HubDesc)
/* Read the whole usb hub descriptor. It is necessary to do it in two steps because hub descriptor is of variable length. */ EFI_STATUS UsbHubReadDesc(IN USB_DEVICE *HubDev, OUT EFI_USB_HUB_DESCRIPTOR *HubDesc)
{ EFI_STATUS Status; Status = UsbHubCtrlGetHubDesc (HubDev, HubDesc, 2); if (EFI_ERROR (Status)) { return Status; } return UsbHubCtrlGetHubDesc (HubDev, HubDesc, HubDesc->Length); }
tianocore/edk2
C++
Other
4,240
/* Draws a single pixel at the specified X/Y location. */
void lcdDrawPixel(uint16_t x, uint16_t y, uint16_t color)
/* Draws a single pixel at the specified X/Y location. */ void lcdDrawPixel(uint16_t x, uint16_t y, uint16_t color)
{ ili9325SetCursor(x, y); ili9325WriteCmd(ILI9325_COMMANDS_WRITEDATATOGRAM); ili9325WriteData(color); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* This file is part of the Simba project. */
int mock_write_adc_module_init(int res)
/* This file is part of the Simba project. */ int mock_write_adc_module_init(int res)
{ harness_mock_write("adc_module_init()", NULL, 0); harness_mock_write("adc_module_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* xprt_get - return a reference to an RPC transport. @xprt: pointer to the transport */
struct rpc_xprt* xprt_get(struct rpc_xprt *xprt)
/* xprt_get - return a reference to an RPC transport. @xprt: pointer to the transport */ struct rpc_xprt* xprt_get(struct rpc_xprt *xprt)
{ kref_get(&xprt->kref); return xprt; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* USB Device Remote Wakeup Function Called automatically on USB Device Remote Wakeup Return Value: None */
void USBD_WakeUp(void)
/* USB Device Remote Wakeup Function Called automatically on USB Device Remote Wakeup Return Value: None */ void USBD_WakeUp(void)
{ LPC_SYSCON->USBCLKCTRL = 1; LPC_USB->DEVCMDSTAT &= ~(1UL << 17); while (LPC_USB->DEVCMDSTAT & (1UL << 17)); LPC_SYSCON->USBCLKCTRL = 0; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* In this function, we check whether the target bundle modifies IP or it triggers an exception. If so, it cannot be boostable. */
static int __kprobes can_boost(bundle_t *bundle, uint slot, unsigned long bundle_addr)
/* In this function, we check whether the target bundle modifies IP or it triggers an exception. If so, it cannot be boostable. */ static int __kprobes can_boost(bundle_t *bundle, uint slot, unsigned long bundle_addr)
{ unsigned int template = bundle->quad0.template; do { if (search_exception_tables(bundle_addr + slot) || __is_ia64_break_inst(bundle, slot)) return 0; } while ((++slot) < 3); template &= 0x1e; if (template >= 0x10 || template == 0x04 || template == 0x06) return 0; return 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This is called at sys_setup time, after memory and the console are initialized. It must be possible to call kmalloc(..., GFP_KERNEL) from this function, hence the call from sys_setup. */
void __init console_map_init(void)
/* This is called at sys_setup time, after memory and the console are initialized. It must be possible to call kmalloc(..., GFP_KERNEL) from this function, hence the call from sys_setup. */ void __init console_map_init(void)
{ int i; for (i = 0; i < MAX_NR_CONSOLES; i++) if (vc_cons_allocated(i) && !*vc_cons[i].d->vc_uni_pagedir_loc) con_set_default_unimap(vc_cons[i].d); }
robutest/uclinux
C++
GPL-2.0
60
/* Set Value of given Name in a NameValue Storage. */
EFI_STATUS SetValueByName(IN HII_FORMSET_STORAGE *Storage, IN CHAR16 *Name, IN CHAR16 *Value, OUT HII_NAME_VALUE_NODE **ReturnNode)
/* Set Value of given Name in a NameValue Storage. */ EFI_STATUS SetValueByName(IN HII_FORMSET_STORAGE *Storage, IN CHAR16 *Name, IN CHAR16 *Value, OUT HII_NAME_VALUE_NODE **ReturnNode)
{ LIST_ENTRY *Link; HII_NAME_VALUE_NODE *Node; CHAR16 *Buffer; Link = GetFirstNode (&Storage->NameValueList); while (!IsNull (&Storage->NameValueList, Link)) { Node = HII_NAME_VALUE_NODE_FROM_LINK (Link); if (StrCmp (Name, Node->Name) == 0) { Buffer = Node->Value; ...
tianocore/edk2
C++
Other
4,240
/* be very careful here. This is being called as the condition in wait_event_*() needs to cope with being called many times. */
static int rds_next_incoming(struct rds_sock *rs, struct rds_incoming **inc)
/* be very careful here. This is being called as the condition in wait_event_*() needs to cope with being called many times. */ static int rds_next_incoming(struct rds_sock *rs, struct rds_incoming **inc)
{ unsigned long flags; if (*inc == NULL) { read_lock_irqsave(&rs->rs_recv_lock, flags); if (!list_empty(&rs->rs_recv_queue)) { *inc = list_entry(rs->rs_recv_queue.next, struct rds_incoming, i_item); rds_inc_addref(*inc); } read_unlock_irqrestore(&rs->rs_recv_lock, flags); } return *inc !...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return : return 1 if Panda ES Rev B3 , else return 0 */
u8 is_panda_es_rev_b3(void)
/* Return : return 1 if Panda ES Rev B3 , else return 0 */ u8 is_panda_es_rev_b3(void)
{ int processor_rev = omap_revision(); int ret = 0; if ((processor_rev >= OMAP4460_ES1_0 && processor_rev <= OMAP4460_ES1_1)) { writew((IEN | M3), (*ctrl)->control_padconf_core_base + UNIPRO_TX0); ret = gpio_get_value(PANDA_BOARD_ID_2_GPIO); ...
4ms/stm32mp1-baremetal
C++
Other
137
/* Restore the audio codec state to default state and free all used resources. */
static uint32_t Codec_DeInit(void)
/* Restore the audio codec state to default state and free all used resources. */ static uint32_t Codec_DeInit(void)
{ uint32_t counter = 0; Codec_Reset(); counter += Codec_WriteRegister(0x02, 0x01); Codec_GPIO_DeInit(); Codec_CtrlInterface_DeInit(); Codec_AudioInterface_DeInit(); return counter; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Inits the unity mappings required for a specific device */
static int init_unity_mappings_for_device(struct dma_ops_domain *dma_dom, u16 devid)
/* Inits the unity mappings required for a specific device */ static int init_unity_mappings_for_device(struct dma_ops_domain *dma_dom, u16 devid)
{ struct unity_map_entry *e; int ret; list_for_each_entry(e, &amd_iommu_unity_map, list) { if (!(devid >= e->devid_start && devid <= e->devid_end)) continue; ret = dma_ops_unity_map(dma_dom, e); if (ret) return ret; } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ConfirmedPrivateTransfer-ACK ::= SEQUENCE { vendorID Unsigned, serviceNumber Unsigned, resultBlock ABSTRACT-SYNTAX.&Type OPTIONAL } */
static guint fConfirmedPrivateTransferAck(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
/* ConfirmedPrivateTransfer-ACK ::= SEQUENCE { vendorID Unsigned, serviceNumber Unsigned, resultBlock ABSTRACT-SYNTAX.&Type OPTIONAL } */ static guint fConfirmedPrivateTransferAck(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
{ return fConfirmedPrivateTransferRequest(tvb, pinfo, tree, offset); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function removes the multicast group specified by Arg from the Map. */
EFI_STATUS EFIAPI Udp4LeaveGroup(IN OUT NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Arg OPTIONAL)
/* This function removes the multicast group specified by Arg from the Map. */ EFI_STATUS EFIAPI Udp4LeaveGroup(IN OUT NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Arg OPTIONAL)
{ EFI_IPv4_ADDRESS *McastIp; McastIp = Arg; if ((McastIp != NULL) && (!EFI_IP4_EQUAL (McastIp, &(Item->Key)))) { return EFI_SUCCESS; } NetMapRemoveItem (Map, Item, NULL); if (McastIp != NULL) { return EFI_ABORTED; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* request a key with auxiliary data for the upcaller (allow async construction) */
struct key* request_key_async_with_auxdata(struct key_type *type, const char *description, const void *callout_info, size_t callout_len, void *aux)
/* request a key with auxiliary data for the upcaller (allow async construction) */ struct key* request_key_async_with_auxdata(struct key_type *type, const char *description, const void *callout_info, size_t callout_len, void *aux)
{ return request_key_and_link(type, description, callout_info, callout_len, aux, NULL, KEY_ALLOC_IN_QUOTA); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* tlsv1_set_cert - Set certificate @cred: TLSv1 credentials from tlsv1_cred_alloc() @cert: File or reference name for X.509 certificate in PEM or DER format @cert_blob: cert as inlined data or NULL if not used @cert_blob_len: cert_blob length Returns: 0 on success, -1 on failure */
int tlsv1_set_cert(struct tlsv1_credentials *cred, const char *cert, const u8 *cert_blob, size_t cert_blob_len)
/* tlsv1_set_cert - Set certificate @cred: TLSv1 credentials from tlsv1_cred_alloc() @cert: File or reference name for X.509 certificate in PEM or DER format @cert_blob: cert as inlined data or NULL if not used @cert_blob_len: cert_blob length Returns: 0 on success, -1 on failure */ int tlsv1_set_cert(struct tlsv1_cre...
{ return tlsv1_set_cert_chain(&cred->cert, cert, cert_blob, cert_blob_len); }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Handle Alert message recorded in BufferIn. If BufferIn is NULL and BufferInSize is zero, TLS session has errors and the response packet needs to be Alert message based on error type. */
EFI_STATUS EFIAPI TlsHandleAlert(IN VOID *Tls, IN UINT8 *BufferIn OPTIONAL, IN UINTN BufferInSize OPTIONAL, OUT UINT8 *BufferOut OPTIONAL, IN OUT UINTN *BufferOutSize)
/* Handle Alert message recorded in BufferIn. If BufferIn is NULL and BufferInSize is zero, TLS session has errors and the response packet needs to be Alert message based on error type. */ EFI_STATUS EFIAPI TlsHandleAlert(IN VOID *Tls, IN UINT8 *BufferIn OPTIONAL, IN UINTN BufferInSize OPTIONAL, OUT UINT8 *BufferOut OP...
{ CALL_CRYPTO_SERVICE (TlsHandleAlert, (Tls, BufferIn, BufferInSize, BufferOut, BufferOutSize), EFI_UNSUPPORTED); }
tianocore/edk2
C++
Other
4,240
/* return the number of words already written into the IN FIFO */
uint32_t hau_infifo_words_num_get(void)
/* return the number of words already written into the IN FIFO */ uint32_t hau_infifo_words_num_get(void)
{ uint32_t ret = 0U; ret = GET_CTL_NWIF(HAU_CTL); return ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enables or disables the selected ADC automatic injected group conversion after regular one. */
void ADC_AutoInjectedConvCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
/* Enables or disables the selected ADC automatic injected group conversion after regular one. */ void ADC_AutoInjectedConvCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { ADCx->CFGR |= ADC_CFGR_JAUTO; } else { ADCx->CFGR &= ~ADC_CFGR_JAUTO; } }
ajhc/demo-cortex-m3
C++
null
38
/* vx_write_one_cbit - write one bit to UER config @index: the bit index @val: bit value, 0 or 1 */
static void vx_write_one_cbit(struct vx_core *chip, int index, int val)
/* vx_write_one_cbit - write one bit to UER config @index: the bit index @val: bit value, 0 or 1 */ static void vx_write_one_cbit(struct vx_core *chip, int index, int val)
{ unsigned long flags; val = !!val; spin_lock_irqsave(&chip->lock, flags); if (vx_is_pcmcia(chip)) { vx_outb(chip, CSUER, 0); vx_outb(chip, RUER, (val << 7) | (index & XX_UER_CBITS_OFFSET_MASK)); } else { vx_outl(chip, CSUER, 0); vx_outl(chip, RUER, (val << 7) | (index & XX_UER_CBITS_OFFSET_MASK)); } spi...
robutest/uclinux
C++
GPL-2.0
60
/* Set the specified data holding register value for dual channel DAC. */
void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1)
/* Set the specified data holding register value for dual channel DAC. */ void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1)
{ uint32_t data = 0, tmp = 0; assert_param(IS_DAC_ALIGN(DAC_Align)); assert_param(IS_DAC_DATA(Data1)); assert_param(IS_DAC_DATA(Data2)); if (DAC_Align == DAC_Align_8b_R) { data = ((uint32_t)Data2 << 8) | Data1; } else { data = ((uint32_t)Data2 << 16) | Data1; } tmp = (uint32_t)DAC_BASE; ...
ajhc/demo-cortex-m3
C++
null
38
/* Send a master data receive request with an NACK when the master have For this function returns immediately, it is always using in the interrupt hander. */
void I2CMasterReadLastRequestS2(unsigned long ulBase)
/* Send a master data receive request with an NACK when the master have For this function returns immediately, it is always using in the interrupt hander. */ void I2CMasterReadLastRequestS2(unsigned long ulBase)
{ xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE))); xHWREGB(ulBase + I2C_CON1) |= I2C_CON1_TXAK; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function is called when upper layer wants to send a XID pdu. Returns 0 for success, 1 otherwise. */
void llc_build_and_send_xid_pkt(struct llc_sap *sap, struct sk_buff *skb, u8 *dmac, u8 dsap)
/* This function is called when upper layer wants to send a XID pdu. Returns 0 for success, 1 otherwise. */ void llc_build_and_send_xid_pkt(struct llc_sap *sap, struct sk_buff *skb, u8 *dmac, u8 dsap)
{ struct llc_sap_state_ev *ev = llc_sap_ev(skb); ev->saddr.lsap = sap->laddr.lsap; ev->daddr.lsap = dsap; memcpy(ev->saddr.mac, skb->dev->dev_addr, IFHWADDRLEN); memcpy(ev->daddr.mac, dmac, IFHWADDRLEN); ev->type = LLC_SAP_EV_TYPE_PRIM; ev->prim = LLC_XID_PRIM; ev->prim_type = LLC_PRIM_TYPE_REQ; llc_...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Atomic get-and-set primitive. is atomically written at <target> and the previous value at <target> is returned. */
atomic_val_t atomic_set(atomic_t *target, atomic_val_t value)
/* Atomic get-and-set primitive. is atomically written at <target> and the previous value at <target> is returned. */ atomic_val_t atomic_set(atomic_t *target, atomic_val_t value)
{ unsigned int key; atomic_val_t ret; key = irq_lock(); ret = *target; *target = value; irq_unlock(key); return ret; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Set the given Cobalt APIC Redirection Table entry to point to the given IDT vector/index. */
static void co_apic_set(int entry, int irq)
/* Set the given Cobalt APIC Redirection Table entry to point to the given IDT vector/index. */ static void co_apic_set(int entry, int irq)
{ co_apic_write(CO_APIC_LO(entry), CO_APIC_LEVEL | (irq + FIRST_EXTERNAL_VECTOR)); co_apic_write(CO_APIC_HI(entry), 0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables ADC, starts conversion of insert group. Interruptions enabled in this function: None. */
ald_status_t ald_adc_insert_start(ald_adc_handle_t *hperh)
/* Enables ADC, starts conversion of insert group. Interruptions enabled in this function: None. */ ald_status_t ald_adc_insert_start(ald_adc_handle_t *hperh)
{ assert_param(IS_ADC_TYPE(hperh->perh)); ALD_ADC_ENABLE(hperh); WRITE_REG(hperh->perh->CLR, ALD_ADC_FLAG_ICH); if (!(READ_BIT(hperh->perh->CON0, ADC_CON0_IAUTO_MSK))) SET_BIT(hperh->perh->CON1, ADC_CON1_ICHTRG_MSK); return ALD_OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* if StartupRoutine >= 1M, then ASSERT. if StartupRoutine is not multiple of 4K, then ASSERT. */
VOID EFIAPI SendInitSipiSipi(IN UINT32 ApicId, IN UINT32 StartupRoutine)
/* if StartupRoutine >= 1M, then ASSERT. if StartupRoutine is not multiple of 4K, then ASSERT. */ VOID EFIAPI SendInitSipiSipi(IN UINT32 ApicId, IN UINT32 StartupRoutine)
{ LOCAL_APIC_ICR_LOW IcrLow; ASSERT (StartupRoutine < 0x100000); ASSERT ((StartupRoutine & 0xfff) == 0); SendInitIpi (ApicId); MicroSecondDelay (PcdGet32 (PcdCpuInitIpiDelayInMicroSeconds)); IcrLow.Uint32 = 0; IcrLow.Bits.Vector = (StartupRoutine >> 12); IcrLow.Bits.DeliveryMode = LOCA...
tianocore/edk2
C++
Other
4,240
/* Check whether the specified channel interrupt is set or reset. */
it_status_t ald_dma_get_it_status(uint8_t channel, ald_dma_it_flag_t it)
/* Check whether the specified channel interrupt is set or reset. */ it_status_t ald_dma_get_it_status(uint8_t channel, ald_dma_it_flag_t it)
{ assert_param(IS_DMA_CHANNEL(channel)); assert_param(IS_DMA_IT_TYPE(it)); if (READ_BIT(DMA->IVS, 1 << (channel * 2U + it))) return SET; return RESET; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Parses a "property" as specified by the css2 spec at : property : IDENT S*; */
static enum CRStatus cr_parser_parse_property(CRParser *a_this, CRString **a_property)
/* Parses a "property" as specified by the css2 spec at : property : IDENT S*; */ static enum CRStatus cr_parser_parse_property(CRParser *a_this, CRString **a_property)
{ enum CRStatus status = CR_OK; CRInputPos init_pos; g_return_val_if_fail (a_this && PRIVATE (a_this) && PRIVATE (a_this)->tknzr && a_property, CR_BAD_PARAM_ERROR); RECORD_INITIAL_POS (a_this, &ini...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function returns zero in case of success and a negative error code in case of failure. If the volume is damaged because of an interrupted update this function just returns immediately with %-EBADF code. */
int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum)
/* This function returns zero in case of success and a negative error code in case of failure. If the volume is damaged because of an interrupted update this function just returns immediately with %-EBADF code. */ int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum)
{ struct ubi_volume *vol = desc->vol; struct ubi_device *ubi = vol->ubi; dbg_gen("unmap LEB %d:%d", vol->vol_id, lnum); if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) return -EROFS; if (lnum < 0 || lnum >= vol->reserved_pebs) return -EINVAL; if (vol->upd_marker) return -EBADF; return...
robutest/uclinux
C++
GPL-2.0
60
/* USBH_MSC_InterfaceDeInit De-Initialize interface by freeing host channels allocated to interface. */
void USBH_MSC_InterfaceDeInit(USB_OTG_CORE_HANDLE *pdev, void *phost)
/* USBH_MSC_InterfaceDeInit De-Initialize interface by freeing host channels allocated to interface. */ void USBH_MSC_InterfaceDeInit(USB_OTG_CORE_HANDLE *pdev, void *phost)
{ if ( MSC_Machine.hc_num_out) { USB_OTG_HC_Halt(pdev, MSC_Machine.hc_num_out); USBH_Free_Channel (pdev, MSC_Machine.hc_num_out); MSC_Machine.hc_num_out = 0; } if ( MSC_Machine.hc_num_in) { USB_OTG_HC_Halt(pdev, MSC_Machine.hc_num_in); USBH_Free_Channel (pdev, MSC_Machine.hc_num_in); ...
MaJerle/stm32f429
C++
null
2,036
/* Configure the sensor to match the parameters we have. Caller should hold s_mutex */
static int cafe_cam_set_flip(struct cafe_camera *cam)
/* Configure the sensor to match the parameters we have. Caller should hold s_mutex */ static int cafe_cam_set_flip(struct cafe_camera *cam)
{ struct v4l2_control ctrl; memset(&ctrl, 0, sizeof(ctrl)); ctrl.id = V4L2_CID_VFLIP; ctrl.value = flip; return sensor_call(cam, core, s_ctrl, &ctrl); }
robutest/uclinux
C++
GPL-2.0
60
/* This file is part of the Simba project. */
int mock_write_cond_module_init(int res)
/* This file is part of the Simba project. */ int mock_write_cond_module_init(int res)
{ harness_mock_write("cond_module_init()", NULL, 0); harness_mock_write("cond_module_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* This function is the implementation of SPI0 handler named in startup code. It passes the instance to the shared DSPI IRQ handler. */
void SPI0_IRQHandler(void)
/* This function is the implementation of SPI0 handler named in startup code. It passes the instance to the shared DSPI IRQ handler. */ void SPI0_IRQHandler(void)
{ DSPI_DRV_EdmaIRQHandler(SPI0_IDX); }
remotemcu/remcu-chip-sdks
C++
null
436
/* This function will do USB_REQ_CLEAR_FEATURE request for the device instance to clear feature of the hub port. */
rt_err_t rt_usb_hub_clear_port_feature(uhubinst_t uhub, rt_uint16_t port, rt_uint16_t feature)
/* This function will do USB_REQ_CLEAR_FEATURE request for the device instance to clear feature of the hub port. */ rt_err_t rt_usb_hub_clear_port_feature(uhubinst_t uhub, rt_uint16_t port, rt_uint16_t feature)
{ struct ureqest setup; int timeout = 100; RT_ASSERT(uhub != RT_NULL); if(uhub->is_roothub) { rt_usb_hcd_hub_control(uhub->hcd, port, RH_CLEAR_PORT_FEATURE, (void*)feature); return RT_EOK; } setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | ...
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* This function tranfers 1 data sector from memory to RAM. */
Ctrl_status nand_flash_mem_2_ram(uint32_t addr, void *ram)
/* This function tranfers 1 data sector from memory to RAM. */ Ctrl_status nand_flash_mem_2_ram(uint32_t addr, void *ram)
{ if (nand_flash_status == NAND_FLASH_READY) { if (!nand_flash_read((addr * SECTOR_SIZE), ram, SECTOR_SIZE)) { return CTRL_GOOD; } return CTRL_FAIL; } return CTRL_BUSY; }
remotemcu/remcu-chip-sdks
C++
null
436
/* determine new setting for operational value if limit is lower than mib use limit else use mib NOTE : numbers are negative, negate comparison ! */
static int set_min_max(int maxflag, u_long mib, u_long limit, u_long *oper)
/* determine new setting for operational value if limit is lower than mib use limit else use mib NOTE : numbers are negative, negate comparison ! */ static int set_min_max(int maxflag, u_long mib, u_long limit, u_long *oper)
{ u_long old ; old = *oper ; if ((limit > mib) ^ maxflag) *oper = limit ; else *oper = mib ; return(old != *oper) ; }
robutest/uclinux
C++
GPL-2.0
60
/* Don't call this function unless you are bound to one of the interfaces on this device or you have locked the device! */
struct usb_interface* usb_ifnum_to_if(struct usb_host_virt_dev *dev, u32 ifnum)
/* Don't call this function unless you are bound to one of the interfaces on this device or you have locked the device! */ struct usb_interface* usb_ifnum_to_if(struct usb_host_virt_dev *dev, u32 ifnum)
{ struct usb_host_virt_config *config = dev->actconfig; int i; if (!config) { __err("ERR: input = NULL"); return NULL; } for (i = 0; i < config->desc.bNumInterfaces; i++) { if (config->interfac[i]->altsetting[0].desc.bInterfaceNumber == ifnum) { re...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Configures for the selected ADC channel and its sampling time. */
void ADC_ConfigChannel(uint32_t channel, uint8_t sampleTime)
/* Configures for the selected ADC channel and its sampling time. */ void ADC_ConfigChannel(uint32_t channel, uint8_t sampleTime)
{ ADC->CHSEL |= (uint32_t)channel; ADC->SMPTIM |= (uint8_t)sampleTime; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read and write a data element from and to the SPI interface. */
unsigned long xSPISingleDataReadWrite(unsigned long ulBase, unsigned long ulWData)
/* Read and write a data element from and to the SPI interface. */ unsigned long xSPISingleDataReadWrite(unsigned long ulBase, unsigned long ulWData)
{ unsigned long ulReadTemp; xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) || (ulBase == SPI3_BASE)); while((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY)) { } xHWREG(ulBase + SPI_TX0) = ulWData; xHWREG(ulBase + SPI_CNTRL) |= SPI_CNTRL_GO_BUSY; ...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Called when a pkt transmission doesn't complete in a reasonable period Device reset may sleep - do it outside of interrupt context (delayed) */
void i1480u_tx_timeout(struct net_device *net_dev)
/* Called when a pkt transmission doesn't complete in a reasonable period Device reset may sleep - do it outside of interrupt context (delayed) */ void i1480u_tx_timeout(struct net_device *net_dev)
{ struct i1480u *i1480u = netdev_priv(net_dev); wlp_reset_all(&i1480u->wlp); }
robutest/uclinux
C++
GPL-2.0
60
/* Get the data type of the DataNode. The Node must be a data node. */
EFI_STATUS EFIAPI AmlGetNodeDataType(IN AML_DATA_NODE *DataNode, OUT EAML_NODE_DATA_TYPE *DataType)
/* Get the data type of the DataNode. The Node must be a data node. */ EFI_STATUS EFIAPI AmlGetNodeDataType(IN AML_DATA_NODE *DataNode, OUT EAML_NODE_DATA_TYPE *DataType)
{ if (!IS_AML_DATA_NODE (DataNode) || (DataType == NULL)) { ASSERT (0); return EFI_INVALID_PARAMETER; } *DataType = DataNode->DataType; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Callback function executed when the EndOfDxe event group is signaled. */
VOID EFIAPI RedfishCredentialEndOfDxeEventNotify(IN EFI_EVENT Event, OUT VOID *Context)
/* Callback function executed when the EndOfDxe event group is signaled. */ VOID EFIAPI RedfishCredentialEndOfDxeEventNotify(IN EFI_EVENT Event, OUT VOID *Context)
{ LibCredentialEndOfDxeNotify ((EDKII_REDFISH_CREDENTIAL_PROTOCOL *)Context); gBS->CloseEvent (Event); }
tianocore/edk2
C++
Other
4,240
/* EXTINT Ch.3 as BSP Key row 1 callback function. */
static void BSP_KEY_ROW1_IrqCallback(void)
/* EXTINT Ch.3 as BSP Key row 1 callback function. */ static void BSP_KEY_ROW1_IrqCallback(void)
{ uint8_t u8Idx = (uint8_t)KEYSCAN_GetKeyoutIdx(); if (SET == EXTINT_GetExtIntStatus(BSP_KEYIN_PORT_PIN[1].ch)) { for (;;) { if (PIN_RESET == GPIO_ReadInputPins(BSP_KEYIN_PORT_PIN[1].port, BSP_KEYIN_PORT_PIN[1].pin)) { m_u32GlobalKey |= (0x10UL) << u8Idx; } else {...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function will suspend a thread to a IPC object list. */
rt_inline rt_err_t _ipc_list_suspend(rt_list_t *list, struct rt_thread *thread, rt_uint8_t flag)
/* This function will suspend a thread to a IPC object list. */ rt_inline rt_err_t _ipc_list_suspend(rt_list_t *list, struct rt_thread *thread, rt_uint8_t flag)
{ rt_thread_suspend(thread); switch (flag) { case RT_IPC_FLAG_FIFO: rt_list_insert_before(list, &(thread->tlist)); break; case RT_IPC_FLAG_PRIO: { struct rt_list_node *n; struct rt_thread *sthread; for (n = list->next; n != list; n = n->nex...
pikasTech/PikaPython
C++
MIT License
1,403
/* DMA2D MSP De-Initialization This function frees the hardware resources used in this example: */
void HAL_DMA2D_MspDeInit(DMA2D_HandleTypeDef *hdma2d)
/* DMA2D MSP De-Initialization This function frees the hardware resources used in this example: */ void HAL_DMA2D_MspDeInit(DMA2D_HandleTypeDef *hdma2d)
{ __HAL_RCC_DMA2D_FORCE_RESET(); __HAL_RCC_DMA2D_RELEASE_RESET(); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Set or clear the mask for an individual endpoint's interrupt request. */
static void s3c_hsotg_ctrl_epint(struct s3c_hsotg *hsotg, unsigned int ep, unsigned int dir_in, unsigned int en)
/* Set or clear the mask for an individual endpoint's interrupt request. */ static void s3c_hsotg_ctrl_epint(struct s3c_hsotg *hsotg, unsigned int ep, unsigned int dir_in, unsigned int en)
{ unsigned long flags; u32 bit = 1 << ep; u32 daint; if (!dir_in) bit <<= 16; local_irq_save(flags); daint = readl(hsotg->regs + DAINTMSK); if (en) daint |= bit; else daint &= ~bit; writel(daint, hsotg->regs + DAINTMSK); local_irq_restore(flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ks_start_rx - ready to serve pkts @ks : The chip information */
static void ks_start_rx(struct ks_net *ks)
/* ks_start_rx - ready to serve pkts @ks : The chip information */ static void ks_start_rx(struct ks_net *ks)
{ u16 cntl; cntl = ks_rdreg16(ks, KS_RXCR1); cntl |= RXCR1_RXE ; ks_wrreg16(ks, KS_RXCR1, cntl); }
robutest/uclinux
C++
GPL-2.0
60
/* Signal sysrq helper function. Sends a signal to all user processes. */
static void send_sig_all(int sig)
/* Signal sysrq helper function. Sends a signal to all user processes. */ static void send_sig_all(int sig)
{ struct task_struct *p; for_each_process(p) { if (p->mm && !is_global_init(p)) force_sig(sig, p); } }
robutest/uclinux
C++
GPL-2.0
60
/* Compare two positions in the boot script table and return their relative position. */
RETURN_STATUS EFIAPI S3BootScriptCompare(IN UINT8 *Position1, IN UINT8 *Position2, OUT UINTN *RelativePosition)
/* Compare two positions in the boot script table and return their relative position. */ RETURN_STATUS EFIAPI S3BootScriptCompare(IN UINT8 *Position1, IN UINT8 *Position2, OUT UINTN *RelativePosition)
{ UINT8 *Script; UINT32 TableLength; if (!mS3BootScriptAcpiS3Enable) { return RETURN_SUCCESS; } if (RelativePosition == NULL) { return EFI_INVALID_PARAMETER; } Script = S3BootScriptGetEntryAddAddress (0); if (Script == NULL) { return RETURN_OUT_OF_RESOURCES; } Script = mS3BootScriptTa...
tianocore/edk2
C++
Other
4,240
/* Returns pointer to the I2O controller on success or NULL if not found. */
struct i2o_controller* i2o_find_iop(int unit)
/* Returns pointer to the I2O controller on success or NULL if not found. */ struct i2o_controller* i2o_find_iop(int unit)
{ struct i2o_controller *c; list_for_each_entry(c, &i2o_controllers, list) { if (c->unit == unit) return c; } return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* 3.b Cell Identifier List Segment for established cells */
static guint16 be_cell_id_lst_seg_f_est_cells(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
/* 3.b Cell Identifier List Segment for established cells */ static guint16 be_cell_id_lst_seg_f_est_cells(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
{ guint32 curr_offset; curr_offset = offset; proto_tree_add_bits_item(tree, hf_gsm_a_bssmap_spare_bits, tvb, curr_offset<<3, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_gsm_a_bssap_cell_id_list_seg_cell_id_disc, tvb, curr_offset, 1, ENC_BIG_ENDIAN); curr_offset++; proto_tree_add_expert(tree...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Deinitializes the SPIx peripheral registers to their default reset values . */
void SPI_DeInit(SPI_TypeDef *SPIx)
/* Deinitializes the SPIx peripheral registers to their default reset values . */ void SPI_DeInit(SPI_TypeDef *SPIx)
{ assert_param(IS_SPI_ALL_PERIPH(SPIx)); switch (*(uint32_t*)&SPIx) { case SPI1_BASE: RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, DISABLE); break; case SPI2_BASE: RCC_APB1PeriphResetCmd(RCC_A...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* XXX - the only reason why we limit it to <= INT_MAX is so that it fits in p->snapshot, and the only reason that p->snapshot is signed is that pcap_snapshot() returns an int, not an unsigned int. */
bpf_u_int32 pcap_adjust_snapshot(bpf_u_int32 linktype, bpf_u_int32 snaplen)
/* XXX - the only reason why we limit it to <= INT_MAX is so that it fits in p->snapshot, and the only reason that p->snapshot is signed is that pcap_snapshot() returns an int, not an unsigned int. */ bpf_u_int32 pcap_adjust_snapshot(bpf_u_int32 linktype, bpf_u_int32 snaplen)
{ if (snaplen == 0 || snaplen > INT_MAX) { snaplen = max_snaplen_for_dlt(linktype); } return snaplen; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* PARAMETER erp current erp_head sense current sense data RETURN VALUES erp modified erp_head */
static struct dasd_ccw_req* dasd_3990_erp_action_10_32(struct dasd_ccw_req *erp, char *sense)
/* PARAMETER erp current erp_head sense current sense data RETURN VALUES erp modified erp_head */ static struct dasd_ccw_req* dasd_3990_erp_action_10_32(struct dasd_ccw_req *erp, char *sense)
{ struct dasd_device *device = erp->startdev; erp->retries = 256; erp->function = dasd_3990_erp_action_10_32; DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Perform logging requested"); return erp; }
robutest/uclinux
C++
GPL-2.0
60
/* Transform a policer type number into a character string (Reentrant). */
char* nl_police2str(int type, char *buf, size_t len)
/* Transform a policer type number into a character string (Reentrant). */ char* nl_police2str(int type, char *buf, size_t len)
{ return __type2str(type, buf, len, police_types, ARRAY_SIZE(police_types)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This routine is called at the destruction of the "Decode As:Show" dialog box. It clears the pointer maintained by this file, so that the next time the user clicks the "Decode As:Show" button a new dialog box will be created. */
static void decode_show_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_)
/* This routine is called at the destruction of the "Decode As:Show" dialog box. It clears the pointer maintained by this file, so that the next time the user clicks the "Decode As:Show" button a new dialog box will be created. */ static void decode_show_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_)
{ decode_show_w = NULL; g_slist_foreach(da_entries, free_da_entry, NULL); g_slist_free(da_entries); da_entries = NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Writes the CLOCKACTIVITY bits @clockact to the hwmod @oh OCP_SYSCONFIG register. Must be called with omap_hwmod_mutex held. Returns -EINVAL if the hwmod is in the wrong state or returns 0. */
static int _setup(struct omap_hwmod *oh)
/* Writes the CLOCKACTIVITY bits @clockact to the hwmod @oh OCP_SYSCONFIG register. Must be called with omap_hwmod_mutex held. Returns -EINVAL if the hwmod is in the wrong state or returns 0. */ static int _setup(struct omap_hwmod *oh)
{ struct omap_hwmod_ocp_if *os; int i; if (!oh) return -EINVAL; if (oh->slaves_cnt > 0) { for (i = 0, os = *oh->slaves; i < oh->slaves_cnt; i++, os++) { struct clk *c = os->_clk; if (!c || IS_ERR(c)) continue; if (os->flags & OCPIF_SWSUP_IDLE) { } else { clk_enable(c); } } } oh->_stat...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set QSPI to SPI mode (Master mode only). */
static void qspi_set_spi_mode(Qspi *qspi)
/* Set QSPI to SPI mode (Master mode only). */ static void qspi_set_spi_mode(Qspi *qspi)
{ qspi->QSPI_MR &= (~QSPI_MR_SMM_SPI); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Converts a media text device path node to media device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextMediaPath(CHAR16 *TextDeviceNode)
/* Converts a media text device path node to media device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextMediaPath(CHAR16 *TextDeviceNode)
{ return DevPathFromTextGenericPath (MEDIA_DEVICE_PATH, TextDeviceNode); }
tianocore/edk2
C++
Other
4,240
/* Set TPM chip to ready state by sending ready command TIS_PC_STS_READY to Status Register in time. */
EFI_STATUS Tpm12TisPcPrepareCommand(IN TIS_PC_REGISTERS_PTR TisReg)
/* Set TPM chip to ready state by sending ready command TIS_PC_STS_READY to Status Register in time. */ EFI_STATUS Tpm12TisPcPrepareCommand(IN TIS_PC_REGISTERS_PTR TisReg)
{ EFI_STATUS Status; if (TisReg == NULL) { return EFI_INVALID_PARAMETER; } MmioWrite8 ((UINTN)&TisReg->Status, TIS_PC_STS_READY); Status = Tpm12TisPcWaitRegisterBits ( &TisReg->Status, TIS_PC_STS_READY, 0, TIS_TIMEOUT_B ); return Status; ...
tianocore/edk2
C++
Other
4,240
/* G/S_PARM. Most of this is done by the sensor, but we are the level which controls the number of read buffers. */
static int cafe_vidioc_g_parm(struct file *filp, void *priv, struct v4l2_streamparm *parms)
/* G/S_PARM. Most of this is done by the sensor, but we are the level which controls the number of read buffers. */ static int cafe_vidioc_g_parm(struct file *filp, void *priv, struct v4l2_streamparm *parms)
{ struct cafe_camera *cam = priv; int ret; mutex_lock(&cam->s_mutex); ret = sensor_call(cam, video, g_parm, parms); mutex_unlock(&cam->s_mutex); parms->parm.capture.readbuffers = n_dma_bufs; return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Triggers a pending transmit for the specified discover-all-services proc. */
static int ble_gattc_disc_all_svcs_tx(struct ble_gattc_proc *proc)
/* Triggers a pending transmit for the specified discover-all-services proc. */ static int ble_gattc_disc_all_svcs_tx(struct ble_gattc_proc *proc)
{ ble_uuid16_t uuid = BLE_UUID16_INIT(BLE_ATT_UUID_PRIMARY_SERVICE); int rc; ble_gattc_dbg_assert_proc_not_inserted(proc); rc = ble_att_clt_tx_read_group_type(proc->conn_handle, proc->disc_all_svcs.prev_handle + 1, 0xffff, &...
Nicholas3388/LuaNode
C++
Other
1,055
/* Various routines support external extension of the tag set, and other application extension capabilities. */
int TIFFGetTagListCount(TIFF *tif)
/* Various routines support external extension of the tag set, and other application extension capabilities. */ int TIFFGetTagListCount(TIFF *tif)
{ TIFFDirectory* td = &tif->tif_dir; return td->td_customValueCount; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function handles External lines 9 to 5 interrupt request. */
void EXTI9_5_IRQHandler(void)
/* This function handles External lines 9 to 5 interrupt request. */ void EXTI9_5_IRQHandler(void)
{ if (EXTI_GetITStatus(KEY_BUTTON_EXTI_LINE) != RESET) { EXTI_ClearITPendingBit(KEY_BUTTON_EXTI_LINE); *(__IO uint32_t *) 0x000000FF = 0xFF; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Add the NewNode after the Node in the variable list of arguments of the Node's parent. */
EFI_STATUS EFIAPI AmlVarListAddAfter(IN AML_NODE_HEADER *Node, IN AML_NODE_HEADER *NewNode)
/* Add the NewNode after the Node in the variable list of arguments of the Node's parent. */ EFI_STATUS EFIAPI AmlVarListAddAfter(IN AML_NODE_HEADER *Node, IN AML_NODE_HEADER *NewNode)
{ EFI_STATUS Status; AML_NODE_HEADER *ParentNode; UINT32 NewSize; if ((!IS_AML_DATA_NODE (NewNode) && !IS_AML_OBJECT_NODE (NewNode)) || !AML_NODE_IS_DETACHED (NewNode)) { ASSERT (0); return EFI_INVALID_PARAMETER; } ParentNode = AmlGetParent (Node); if (!I...
tianocore/edk2
C++
Other
4,240
/* Function for handling the Battery measurement timer timeout. This function will be called each time the battery level measurement timer expires. */
static void battery_level_meas_timeout_handler(void *p_context)
/* Function for handling the Battery measurement timer timeout. This function will be called each time the battery level measurement timer expires. */ static void battery_level_meas_timeout_handler(void *p_context)
{ UNUSED_PARAMETER(p_context); battery_level_update(); }
labapart/polymcu
C++
null
201
/* ZigBee ZCL Appliance Identification cluster dissector for wireshark. */
static int dissect_zbee_zcl_appl_idt(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_)
/* ZigBee ZCL Appliance Identification cluster dissector for wireshark. */ static int dissect_zbee_zcl_appl_idt(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_)
{ return tvb_captured_length(tvb); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Retrieve HII package list from ImageHandle and publish to HII database. */
EFI_HII_HANDLE InitializeHiiPackage(EFI_HANDLE ImageHandle)
/* Retrieve HII package list from ImageHandle and publish to HII database. */ EFI_HII_HANDLE InitializeHiiPackage(EFI_HANDLE ImageHandle)
{ EFI_STATUS Status; EFI_HII_PACKAGE_LIST_HEADER *PackageList; EFI_HII_HANDLE HiiHandle; Status = gBS->OpenProtocol ( ImageHandle, &gEfiHiiPackageListProtocolGuid, (VOID **)&PackageList, ImageHandle, ...
tianocore/edk2
C++
Other
4,240
/* This function gets the baro ODR according to HZ */
static uint8_t drv_baro_bosch_bmp380_hz2odr(int hz)
/* This function gets the baro ODR according to HZ */ static uint8_t drv_baro_bosch_bmp380_hz2odr(int hz)
{ if (hz > 100) return BMP380_ODR_200_HZ; else if (hz > 50) return BMP380_ODR_100_HZ; else if (hz > 25) return BMP380_ODR_50_HZ; else if (hz > 12) return BMP380_ODR_25_HZ; else if (hz > 6) return BMP380_ODR_12_5_HZ; else if (hz > 3) return BMP380_O...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* igbvf_receive_skb - helper function to handle Rx indications @adapter: board private structure @status: descriptor status field as written by hardware @vlan: descriptor vlan field as written by hardware (no le/be conversion) @skb: pointer to sk_buff to be indicated to stack */
static void igbvf_receive_skb(struct igbvf_adapter *adapter, struct net_device *netdev, struct sk_buff *skb, u32 status, u16 vlan)
/* igbvf_receive_skb - helper function to handle Rx indications @adapter: board private structure @status: descriptor status field as written by hardware @vlan: descriptor vlan field as written by hardware (no le/be conversion) @skb: pointer to sk_buff to be indicated to stack */ static void igbvf_receive_skb(struct i...
{ if (adapter->vlgrp && (status & E1000_RXD_STAT_VP)) vlan_hwaccel_receive_skb(skb, adapter->vlgrp, le16_to_cpu(vlan) & E1000_RXD_SPC_VLAN_MASK); else netif_receive_skb(skb); }
robutest/uclinux
C++
GPL-2.0
60
/* STUSB1602 checks the Bus Idle Status on CC (bit3 0x17 */
Bus_Idle_TypeDef STUSB1602_Bus_Idle_Status_Get(uint8_t Addr)
/* STUSB1602 checks the Bus Idle Status on CC (bit3 0x17 */ Bus_Idle_TypeDef STUSB1602_Bus_Idle_Status_Get(uint8_t Addr)
{ PHY_STATUS_RegTypeDef reg; STUSB1602_ReadReg(&reg.d8, Addr, STUSB1602_PHY_STATUS_REG, 1); return (Bus_Idle_TypeDef)(reg.b.BUS_IDLE); }
st-one/X-CUBE-USB-PD
C++
null
110
/* End of code taken from D. J. Bernstein's reference implementation. */
static int setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keysize)
/* End of code taken from D. J. Bernstein's reference implementation. */ static int setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keysize)
{ struct salsa20_ctx *ctx = crypto_tfm_ctx(tfm); salsa20_keysetup(ctx, key, keysize); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set the allocation and offset of the vector table. */
static void NVIC_SetVectorTable(rt_uint32_t NVIC_VectTab, rt_uint32_t Offset)
/* Set the allocation and offset of the vector table. */ static void NVIC_SetVectorTable(rt_uint32_t NVIC_VectTab, rt_uint32_t Offset)
{ RT_ASSERT(IS_NVIC_VECTTAB(NVIC_VectTab)); RT_ASSERT(IS_NVIC_OFFSET(Offset)); SCB->VTOR = NVIC_VectTab | (Offset & (rt_uint32_t)0x1FFFFF80); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This is only for internal llist manipulation where we know the prev/next entries already! */
void __llist_del(llist_head *prev, llist_head *next)
/* This is only for internal llist manipulation where we know the prev/next entries already! */ void __llist_del(llist_head *prev, llist_head *next)
{ next->prev = prev; prev->next = next; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This method will free @invocation, you cannot use it afterwards. */
void _g_freedesktop_dbus_complete_update_activation_environment(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation)
/* This method will free @invocation, you cannot use it afterwards. */ void _g_freedesktop_dbus_complete_update_activation_environment(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation)
{ g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Wake up a queued task while the queue lock is being held */
static void rpc_wake_up_task_queue_locked(struct rpc_wait_queue *queue, struct rpc_task *task)
/* Wake up a queued task while the queue lock is being held */ static void rpc_wake_up_task_queue_locked(struct rpc_wait_queue *queue, struct rpc_task *task)
{ if (RPC_IS_QUEUED(task) && task->tk_waitqueue == queue) __rpc_do_wake_up_task(queue, task); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* USBH_AUDIO_Process The function is for managing state machine for Audio data transfers. */
static USBH_StatusTypeDef USBH_AUDIO_Process(USBH_HandleTypeDef *phost)
/* USBH_AUDIO_Process The function is for managing state machine for Audio data transfers. */ static USBH_StatusTypeDef USBH_AUDIO_Process(USBH_HandleTypeDef *phost)
{ USBH_StatusTypeDef status = USBH_BUSY; AUDIO_HandleTypeDef *AUDIO_Handle = (AUDIO_HandleTypeDef *) phost->pActiveClass->pData; if(AUDIO_Handle->headphone.supported == 1) { USBH_AUDIO_OutputStream (phost); } if(AUDIO_Handle->microphone.supported == 1) { USBH_AUDIO_InputStream (phost); } ...
labapart/polymcu
C++
null
201
/* Write ECC information in a spare area, using the given scheme. */
void nand_flash_spare_scheme_write_ecc(const struct nand_flash_spare_scheme *scheme, uint8_t *spare, const uint8_t *ecc)
/* Write ECC information in a spare area, using the given scheme. */ void nand_flash_spare_scheme_write_ecc(const struct nand_flash_spare_scheme *scheme, uint8_t *spare, const uint8_t *ecc)
{ uint32_t i; for (i = 0; i < scheme->ecc_byte_number; i++) { spare[scheme->ecc_bytes_positions[i]] = ecc[i]; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Reset control endpoint management. Called after a USB line reset or at the end of SETUP request (after ZLP) */
static void udd_ctrl_init(void)
/* Reset control endpoint management. Called after a USB line reset or at the end of SETUP request (after ZLP) */ static void udd_ctrl_init(void)
{ udd_g_ctrlreq.callback = NULL; udd_g_ctrlreq.over_under_run = NULL; udd_g_ctrlreq.payload_size = 0; udd_ep_control_state = UDD_EPCTRL_SETUP; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Resolve the referenced port number into a port struct pointer. */
static struct stlport* stl_getport(int brdnr, int panelnr, int portnr)
/* Resolve the referenced port number into a port struct pointer. */ static struct stlport* stl_getport(int brdnr, int panelnr, int portnr)
{ struct stlbrd *brdp; struct stlpanel *panelp; if (brdnr < 0 || brdnr >= STL_MAXBRDS) return NULL; brdp = stl_brds[brdnr]; if (brdp == NULL) return NULL; if (panelnr < 0 || (unsigned int)panelnr >= brdp->nrpanels) return NULL; panelp = brdp->panels[panelnr]; if (panelp == NULL) return NULL; if (portnr...
robutest/uclinux
C++
GPL-2.0
60