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
/* Initialize so that sf_write() will output to the given stream. */
pcap_dumper_t* pcap_dump_fopen(pcap_t *p, FILE *f)
/* Initialize so that sf_write() will output to the given stream. */ pcap_dumper_t* pcap_dump_fopen(pcap_t *p, FILE *f)
{ int linktype; linktype = dlt_to_linktype(p->linktype); if (linktype == -1) { pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "stream: link-layer type %d isn't supported in savefiles", p->linktype); return (NULL); } linktype |= p->linktype_ext; return (pcap_setup_dump(p, linktype, f, "stream")); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* 4.1.2 The floating-point helper functions Table 2, Standard aeabi_double_t precision floating-point arithmetic helper functions */
aeabi_double_t __aeabi_dadd(aeabi_double_t a, aeabi_double_t b)
/* 4.1.2 The floating-point helper functions Table 2, Standard aeabi_double_t precision floating-point arithmetic helper functions */ aeabi_double_t __aeabi_dadd(aeabi_double_t a, aeabi_double_t b)
{ return f64_to_d (f64_add (f64_from_d (a), f64_from_d (b))); }
tianocore/edk2
C++
Other
4,240
/* whether stop receive message when detected bit rising error */
void cec_stop_receive_bre_config(uint32_t rxbrestp)
/* whether stop receive message when detected bit rising error */ void cec_stop_receive_bre_config(uint32_t rxbrestp)
{ if(CEC_STOP_RISING_ERROR_BIT_ON == rxbrestp){ CEC_CFG |= CEC_CFG_RBRESTP; } else { CEC_CFG &= ~CEC_CFG_RBRESTP; } }
liuxuming/trochili
C++
Apache License 2.0
132
/* Initialize the memory management pool for the host controller. */
EFI_STATUS SdPeimInitMemPool(IN SD_PEIM_HC_PRIVATE_DATA *Private)
/* Initialize the memory management pool for the host controller. */ EFI_STATUS SdPeimInitMemPool(IN SD_PEIM_HC_PRIVATE_DATA *Private)
{ SD_PEIM_MEM_POOL *Pool; EFI_STATUS Status; VOID *TempPtr; TempPtr = NULL; Pool = NULL; Status = PeiServicesAllocatePool (sizeof (SD_PEIM_MEM_POOL), &TempPtr); if (EFI_ERROR (Status)) { return EFI_OUT_OF_RESOURCES; } ZeroMem ((VOID *)(UINTN)TempPtr, sizeof (SD_PEIM_MEM_POO...
tianocore/edk2
C++
Other
4,240
/* AmlCodeGenDefinitionBlock (TableSignature, OemID, TableID, OEMRevision) is equivalent to the following ASL code: DefinitionBlock (AMLFileName, TableSignature, ComplianceRevision, OemID, TableID, OEMRevision) {} with the ComplianceRevision set to 2 and the AMLFileName is ignored. */
EFI_STATUS EFIAPI AmlCodeGenDefinitionBlock(IN CONST CHAR8 *TableSignature, IN CONST CHAR8 *OemId, IN CONST CHAR8 *OemTableId, IN UINT32 OemRevision, OUT AML_ROOT_NODE **NewRootNode)
/* AmlCodeGenDefinitionBlock (TableSignature, OemID, TableID, OEMRevision) is equivalent to the following ASL code: DefinitionBlock (AMLFileName, TableSignature, ComplianceRevision, OemID, TableID, OEMRevision) {} with the ComplianceRevision set to 2 and the AMLFileName is ignored. */ EFI_STATUS EFIAPI AmlCodeGenDefini...
{ EFI_STATUS Status; EFI_ACPI_DESCRIPTION_HEADER AcpiHeader; if ((TableSignature == NULL) || (OemId == NULL) || (OemTableId == NULL) || (NewRootNode == NULL)) { ASSERT (0); return EFI_INVALID_PARAMETER; } CopyMem (&AcpiHeader.Signature, TableSigna...
tianocore/edk2
C++
Other
4,240
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
{ if(hadc->Instance==ADC1) { __HAL_RCC_ADC1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_3); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ADC Enable Automatic Injected Conversions. The ADC converts a defined injected group of channels immediately after the regular channels have been converted. The external trigger on the injected channels is disabled as required. */
void adc_enable_automatic_injected_group_conversion(uint32_t adc)
/* ADC Enable Automatic Injected Conversions. The ADC converts a defined injected group of channels immediately after the regular channels have been converted. The external trigger on the injected channels is disabled as required. */ void adc_enable_automatic_injected_group_conversion(uint32_t adc)
{ adc_disable_external_trigger_injected(adc); ADC_CFGR1(adc) |= ADC_CFGR1_JAUTO; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* reg_pair_from_64() - Split a 64-bit value into two 32-bit values @reg0: High bits of @val @reg1: Low bits of @val @val: The value to split */
static void reg_pair_from_64(u32 *reg0, u32 *reg1, u64 val)
/* reg_pair_from_64() - Split a 64-bit value into two 32-bit values @reg0: High bits of @val @reg1: Low bits of @val @val: The value to split */ static void reg_pair_from_64(u32 *reg0, u32 *reg1, u64 val)
{ *reg0 = val >> 32; *reg1 = val; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This is the entry point for the bootloader application and is called by the reset interrupt vector after the C-startup routines executed. */
int main(void)
/* This is the entry point for the bootloader application and is called by the reset interrupt vector after the C-startup routines executed. */ int main(void)
{ Init(); BootInit(); while (1) { BootTask(); } return 0; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUint8ToInt8(IN UINT8 Operand, OUT INT8 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUint8ToInt8(IN UINT8 Operand, OUT INT8 *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if (Operand <= MAX_INT8) { *Result = (INT8)Operand; Status = RETURN_SUCCESS; } else { *Result = INT8_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* This is an internal function for use by the other search functions in this file. */
static struct pci_dev* pci_get_dev_by_id(const struct pci_device_id *id, struct pci_dev *from)
/* This is an internal function for use by the other search functions in this file. */ static struct pci_dev* pci_get_dev_by_id(const struct pci_device_id *id, struct pci_dev *from)
{ struct device *dev; struct device *dev_start = NULL; struct pci_dev *pdev = NULL; WARN_ON(in_interrupt()); if (from) dev_start = &from->dev; dev = bus_find_device(&pci_bus_type, dev_start, (void *)id, match_pci_dev_by_id); if (dev) pdev = to_pci_dev(dev); if (from) pci_dev_put(from); return pd...
robutest/uclinux
C++
GPL-2.0
60
/* This method will free @invocation, you cannot use it afterwards. */
void _g_freedesktop_dbus_complete_request_name(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation, guint value)
/* This method will free @invocation, you cannot use it afterwards. */ void _g_freedesktop_dbus_complete_request_name(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation, guint value)
{ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(u)", value)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Function: int queue_probetgtlun (queue, target, lun) Purpose : check to see if we have a command in the queue for the specified target/lun. Params : queue - queue to look in target - target we want to probe lun - lun on target Returns : 0 if not found, != 0 if found */
int queue_probetgtlun(Queue_t *queue, int target, int lun)
/* Function: int queue_probetgtlun (queue, target, lun) Purpose : check to see if we have a command in the queue for the specified target/lun. Params : queue - queue to look in target - target we want to probe lun - lun on target Returns : 0 if not found, != 0 if found */ int queue_probetgtlun(Queue_t *queue, int targ...
{ unsigned long flags; struct list_head *l; int found = 0; spin_lock_irqsave(&queue->queue_lock, flags); list_for_each(l, &queue->head) { QE_t *q = list_entry(l, QE_t, list); if (q->SCpnt->device->id == target && q->SCpnt->device->lun == lun) { found = 1; break; } } spin_unlock_irqrestore(&queue->que...
robutest/uclinux
C++
GPL-2.0
60
/* ACPI 6.3 specification, s20.2.2. "Name Objects Encoding": NameChar := DigitChar | LeadNameChar LeadNameChar := 'A'-'Z' | 'a'-'z' | '_' DigitChar := '0'-'9' */
BOOLEAN EFIAPI AmlIsNameChar(IN CHAR8 Ch)
/* ACPI 6.3 specification, s20.2.2. "Name Objects Encoding": NameChar := DigitChar | LeadNameChar LeadNameChar := 'A'-'Z' | 'a'-'z' | '_' DigitChar := '0'-'9' */ BOOLEAN EFIAPI AmlIsNameChar(IN CHAR8 Ch)
{ if (AmlIsLeadNameChar (Ch) || ((Ch >= '0') && (Ch <= '9'))) { return TRUE; } else { return FALSE; } }
tianocore/edk2
C++
Other
4,240
/* Return value: SCSI bus speed in units of 100KHz, 1600 is 160 MHz For a 2-byte wide SCSI bus, the maximum transfer speed is twice the maximum transfer rate (e.g. for a wide enabled bus, max 160MHz = max 320MB/sec). */
static u32 ipr_get_max_scsi_speed(struct ipr_ioa_cfg *ioa_cfg, u8 bus, u8 bus_width)
/* Return value: SCSI bus speed in units of 100KHz, 1600 is 160 MHz For a 2-byte wide SCSI bus, the maximum transfer speed is twice the maximum transfer rate (e.g. for a wide enabled bus, max 160MHz = max 320MB/sec). */ static u32 ipr_get_max_scsi_speed(struct ipr_ioa_cfg *ioa_cfg, u8 bus, u8 bus_width)
{ struct ipr_resource_entry *res; const struct ipr_ses_table_entry *ste; u32 max_xfer_rate = IPR_MAX_SCSI_RATE(bus_width); list_for_each_entry(res, &ioa_cfg->used_res_q, queue) { if (!(IPR_IS_SES_DEVICE(res->cfgte.std_inq_data))) continue; if (bus != res->cfgte.res_addr.bus) continue; if (!(ste = ipr_fi...
robutest/uclinux
C++
GPL-2.0
60
/* The constructor function caches the pointer to the SMM Periodic Timer Dispatch 2 Protocol and collects the list SMI tick rates that the hardware supports. */
EFI_STATUS EFIAPI SmmPeriodicSmiLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The constructor function caches the pointer to the SMM Periodic Timer Dispatch 2 Protocol and collects the list SMI tick rates that the hardware supports. */ EFI_STATUS EFIAPI SmmPeriodicSmiLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ LIST_ENTRY *Link; PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler; if (gSmiTickPeriodTable != NULL) { FreePool (gSmiTickPeriodTable); } for (Link = GetFirstNode (&gPeriodicSmiLibraryHandlers); !IsNull (&gPeriodicSmiLibraryHandlers, Link);) { PeriodicSmiLib...
tianocore/edk2
C++
Other
4,240
/* Function called in case of error detected in I2C IT Handler. */
void Error_Callback(void)
/* Function called in case of error detected in I2C IT Handler. */ void Error_Callback(void)
{ NVIC_DisableIRQ(I2C1_EV_IRQn); NVIC_DisableIRQ(I2C1_ER_IRQn); LED_Blinking(LED_BLINK_ERROR); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This function registers all serial port drivers that are compiled into the U-Boot binary with the serial core, thus making them available to U-Boot to use. Lastly, this function assigns a default serial port to the serial core. That serial port is then used as a default output. */
void serial_initialize(void)
/* This function registers all serial port drivers that are compiled into the U-Boot binary with the serial core, thus making them available to U-Boot to use. Lastly, this function assigns a default serial port to the serial core. That serial port is then used as a default output. */ void serial_initialize(void)
{ atmel_serial_initialize(); mcf_serial_initialize(); mpc85xx_serial_initialize(); mxc_serial_initialize(); ns16550_serial_initialize(); pl01x_serial_initialize(); pxa_serial_initialize(); sh_serial_initialize(); mtk_serial_initialize(); serial_assign(default_serial_console()->name); }
4ms/stm32mp1-baremetal
C++
Other
137
/* sas_release_transport - release SAS transport template instance @t: transport template instance */
void sas_release_transport(struct scsi_transport_template *t)
/* sas_release_transport - release SAS transport template instance @t: transport template instance */ void sas_release_transport(struct scsi_transport_template *t)
{ struct sas_internal *i = to_sas_internal(t); transport_container_unregister(&i->t.host_attrs); transport_container_unregister(&i->phy_attr_cont); transport_container_unregister(&i->port_attr_cont); transport_container_unregister(&i->rphy_attr_cont); transport_container_unregister(&i->end_dev_attr_cont); transp...
robutest/uclinux
C++
GPL-2.0
60
/* See __i2400m_dev_reset_handle() for details; that takes care of reinitializing the driver to handle the reset, calling into the bus-specific functions ops as needed. */
int i2400m_dev_reset_handle(struct i2400m *i2400m, const char *reason)
/* See __i2400m_dev_reset_handle() for details; that takes care of reinitializing the driver to handle the reset, calling into the bus-specific functions ops as needed. */ int i2400m_dev_reset_handle(struct i2400m *i2400m, const char *reason)
{ i2400m->boot_mode = 1; wmb(); return i2400m_schedule_work(i2400m, __i2400m_dev_reset_handle, GFP_ATOMIC, &reason, sizeof(reason)); }
robutest/uclinux
C++
GPL-2.0
60
/* Check validity of internal software context. This function checks if the internal context structure looks correct. */
static status_t dcp_hash_check_context(dcp_hash_ctx_internal_t *ctxInternal, const uint8_t *message)
/* Check validity of internal software context. This function checks if the internal context structure looks correct. */ static status_t dcp_hash_check_context(dcp_hash_ctx_internal_t *ctxInternal, const uint8_t *message)
{ if ((NULL == message) || (NULL == ctxInternal) || (kStatus_Success != dcp_hash_check_input_alg(ctxInternal->algo))) { return kStatus_InvalidArgument; } return kStatus_Success; }
eclipse-threadx/getting-started
C++
Other
310
/* Find a free area with specified alignment in a specific range. */
u64 __init find_e820_area(u64 start, u64 end, u64 size, u64 align)
/* Find a free area with specified alignment in a specific range. */ u64 __init find_e820_area(u64 start, u64 end, u64 size, u64 align)
{ int i; for (i = 0; i < e820.nr_map; i++) { struct e820entry *ei = &e820.map[i]; u64 addr, last; u64 ei_last; if (ei->type != E820_RAM) continue; addr = round_up(ei->addr, align); ei_last = ei->addr + ei->size; if (addr < start) addr = round_up(start, align); if (addr >= ei_last) continue; ...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check if the given bluetooth devices address is in the authenticated device list. */
tBtResult BTLocateAuthDevice(char *pDevAddr)
/* Check if the given bluetooth devices address is in the authenticated device list. */ tBtResult BTLocateAuthDevice(char *pDevAddr)
{ ClearRecBuf(); s_cCmdBuffer[0] = 0; StrCat(s_cCmdBuffer, BtCmdLocSelDev); StrCat(s_cCmdBuffer, pDevAddr); BTSendCmdString(s_cCmdBuffer); return (BTGetResponse()); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Wrap Read register component function to Bus IO function. */
static int32_t ReadRegWrap(void *Handle, uint8_t Reg, uint8_t *pData, uint16_t Length)
/* Wrap Read register component function to Bus IO function. */ static int32_t ReadRegWrap(void *Handle, uint8_t Reg, uint8_t *pData, uint16_t Length)
{ LPS22HH_Object_t *pObj = (LPS22HH_Object_t *)Handle; return pObj->IO.ReadReg(pObj->IO.Address, Reg, pData, Length); }
eclipse-threadx/getting-started
C++
Other
310
/* Get the century RTC address from the ACPI FADT table. */
UINT8 GetCenturyRtcAddress(VOID)
/* Get the century RTC address from the ACPI FADT table. */ UINT8 GetCenturyRtcAddress(VOID)
{ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt; Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *)EfiLocateFirstAcpiTable ( EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE ); if ((Fadt != NULL...
tianocore/edk2
C++
Other
4,240
/* Locking: takes tty_ldisc_lock to guard against ldisc races */
int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc)
/* Locking: takes tty_ldisc_lock to guard against ldisc races */ int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc)
{ unsigned long flags; int ret = 0; if (disc < N_TTY || disc >= NR_LDISCS) return -EINVAL; spin_lock_irqsave(&tty_ldisc_lock, flags); tty_ldiscs[disc] = new_ldisc; new_ldisc->num = disc; new_ldisc->refcount = 0; spin_unlock_irqrestore(&tty_ldisc_lock, flags); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Attribute write call back for the Value V9 (128-bit UUID) attribute. */
static ssize_t write_value_v9__128_bit_uuid(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
/* Attribute write call back for the Value V9 (128-bit UUID) attribute. */ static ssize_t write_value_v9__128_bit_uuid(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
{ uint8_t *value = attr->user_data; if (offset >= sizeof(value_v9__128_bit_uuid_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); if (offset + len > sizeof(value_v9__128_bit_uuid_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); memcpy(value + offset, buf, len); return len; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function gets the PageLevel according to the input page size. */
UINT32 GetGpaPageLevel(UINT32 PageSize)
/* This function gets the PageLevel according to the input page size. */ UINT32 GetGpaPageLevel(UINT32 PageSize)
{ UINT32 Index; for (Index = 0; Index < ARRAY_SIZE (mTdxAcceptPageLevelMap); Index++) { if (mTdxAcceptPageLevelMap[Index] == PageSize) { break; } } return Index; }
tianocore/edk2
C++
Other
4,240
/* This function is used to set modules trigger by timer interrupt. */
void TIMER_SetTriggerTarget(TIMER_T *timer, uint32_t u32Mask)
/* This function is used to set modules trigger by timer interrupt. */ void TIMER_SetTriggerTarget(TIMER_T *timer, uint32_t u32Mask)
{ timer->TRGCTL = (timer->TRGCTL & ~(TIMER_TRGCTL_TRGEPWM_Msk | TIMER_TRGCTL_TRGDAC_Msk | TIMER_TRGCTL_TRGEADC_Msk | TIMER_TRGCTL_TRGPDMA_Msk)) | u32Mask; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* atl2_phy_config - Timer Call-back @data: pointer to netdev cast into an unsigned long */
static void atl2_phy_config(unsigned long data)
/* atl2_phy_config - Timer Call-back @data: pointer to netdev cast into an unsigned long */ static void atl2_phy_config(unsigned long data)
{ struct atl2_adapter *adapter = (struct atl2_adapter *) data; struct atl2_hw *hw = &adapter->hw; unsigned long flags; spin_lock_irqsave(&adapter->stats_lock, flags); atl2_write_phy_reg(hw, MII_ADVERTISE, hw->mii_autoneg_adv_reg); atl2_write_phy_reg(hw, MII_BMCR, MII_CR_RESET | MII_CR_AUTO_NEG_EN | MII_CR_RESTA...
robutest/uclinux
C++
GPL-2.0
60
/* get the clock stabilization and periphral reset flags */
FlagStatus rcu_flag_get(rcu_flag_enum flag)
/* get the clock stabilization and periphral reset flags */ FlagStatus rcu_flag_get(rcu_flag_enum flag)
{ if(RESET != (RCU_REG_VAL(flag) & BIT(RCU_BIT_POS(flag)))){ return SET; }else{ return RESET; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function will set a configuration to the usb device. */
rt_err_t rt_usbh_set_configure(uinst_t device, int config)
/* This function will set a configuration to the usb device. */ rt_err_t rt_usbh_set_configure(uinst_t device, int config)
{ struct urequest setup; int timeout = USB_TIMEOUT_BASIC; RT_ASSERT(device != RT_NULL); setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_STANDARD | USB_REQ_TYPE_DEVICE; setup.bRequest = USB_REQ_SET_CONFIGURATION; setup.wIndex = 0; setup.wLength = 0; setup.wValue = config;...
pikasTech/PikaPython
C++
MIT License
1,403
/* Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocatePool(IN UINTN AllocationSize)
/* Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ VOID* EFIAPI AllocatePool(IN U...
{ return InternalAllocatePool (EfiBootServicesData, AllocationSize); }
tianocore/edk2
C++
Other
4,240
/* Used as a "done" callback by when sending enable fast fail. Gets called by ibmvscsi_handle_crq() */
static void fast_fail_rsp(struct srp_event_struct *evt_struct)
/* Used as a "done" callback by when sending enable fast fail. Gets called by ibmvscsi_handle_crq() */ static void fast_fail_rsp(struct srp_event_struct *evt_struct)
{ struct ibmvscsi_host_data *hostdata = evt_struct->hostdata; u8 status = evt_struct->xfer_iu->mad.fast_fail.common.status; if (status == VIOSRP_MAD_NOT_SUPPORTED) dev_err(hostdata->dev, "fast_fail not supported in server\n"); else if (status == VIOSRP_MAD_FAILED) dev_err(hostdata->dev, "fast_fail request faile...
robutest/uclinux
C++
GPL-2.0
60
/* This API read interrupt status of flat, orient, single tap, double tap, slow no motion, slope, highg and lowg from location 09h. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_intr_stat(u8 *intr_stat_u8)
/* This API read interrupt status of flat, orient, single tap, double tap, slow no motion, slope, highg and lowg from location 09h. */ BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_intr_stat(u8 *intr_stat_u8)
{ BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR; if (p_bma2x2 == BMA2x2_NULL) { return E_BMA2x2_NULL_PTR; } else { com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC( p_bma2x2->dev_addr, BMA2x2_STAT1_ADDR, intr_stat_u8, B...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Fills each CAN_Basic_InitStruct member with its default value. */
void CAN_StructInit(CAN_Basic_InitTypeDef *CAN_Basic_InitStruct)
/* Fills each CAN_Basic_InitStruct member with its default value. */ void CAN_StructInit(CAN_Basic_InitTypeDef *CAN_Basic_InitStruct)
{ CAN_Basic_InitStruct->BRP = 0x0; CAN_Basic_InitStruct->SJW = 0x0; CAN_Basic_InitStruct->TESG1 = 0x0; CAN_Basic_InitStruct->TESG2 = 0x0; CAN_Basic_InitStruct->SAM = RESET; CAN_Basic_InitStruct->GTS = DISABLE; CAN_Basic_InitStruct->CDCLK = 0x0; CAN_Basic_InitStruct->CLOSE_OPEN_CLK = 0x0;...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Allocate the next handle id and return it. */
static uint16_t ble_att_svr_next_id(void)
/* Allocate the next handle id and return it. */ static uint16_t ble_att_svr_next_id(void)
{ BLE_HS_DBG_ASSERT(ble_att_svr_id != UINT16_MAX); return ++ble_att_svr_id; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Try to find one Tcb whose <Ip, Port> equals to <IN Addr, IN Port>. */
BOOLEAN TcpFindTcbByPeer(IN EFI_IP_ADDRESS *Addr, IN TCP_PORTNO Port, IN UINT8 Version)
/* Try to find one Tcb whose <Ip, Port> equals to <IN Addr, IN Port>. */ BOOLEAN TcpFindTcbByPeer(IN EFI_IP_ADDRESS *Addr, IN TCP_PORTNO Port, IN UINT8 Version)
{ TCP_PORTNO LocalPort; LIST_ENTRY *Entry; TCP_CB *Tcb; ASSERT ((Addr != NULL) && (Port != 0)); LocalPort = HTONS (Port); NET_LIST_FOR_EACH (Entry, &mTcpListenQue) { Tcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List); if ((Version == Tcb->Sk->IpVersion) && TcpIsIpEqual (Addr, &Tcb->Loca...
tianocore/edk2
C++
Other
4,240
/* Computes a cycle count for a given time in nanoseconds. */
static uint32_t LPI2C_GetCyclesForWidth(uint32_t sourceClock_Hz, uint32_t width_ns, uint32_t minCycles, uint32_t maxCycles, uint32_t prescaler)
/* Computes a cycle count for a given time in nanoseconds. */ static uint32_t LPI2C_GetCyclesForWidth(uint32_t sourceClock_Hz, uint32_t width_ns, uint32_t minCycles, uint32_t maxCycles, uint32_t prescaler)
{ assert(sourceClock_Hz > 0U); uint32_t divider = 1U; while (prescaler != 0U) { divider *= 2U; prescaler--; } uint32_t busCycle_ns = 1000000U / (sourceClock_Hz / divider / 1000U); uint32_t cycles = (width_ns * 10U / busCycle_ns + 5U) / 10U; if (cycles < minCycles) { ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* data is the pointer that init_timer will store for us. This function is associated with init_timer to see if there is any console traffic. Obviously not used in interrupt mode */
static void sn_sal_timer_poll(unsigned long data)
/* data is the pointer that init_timer will store for us. This function is associated with init_timer to see if there is any console traffic. Obviously not used in interrupt mode */ static void sn_sal_timer_poll(unsigned long data)
{ struct sn_cons_port *port = (struct sn_cons_port *)data; unsigned long flags; if (!port) return; if (!port->sc_port.irq) { spin_lock_irqsave(&port->sc_port.lock, flags); if (sn_process_input) sn_receive_chars(port, flags); sn_transmit_chars(port, TRANSMIT_RAW); spin_unlock_irqrestore(&port->sc_port.l...
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified I2S interrupt has occurred or not. */
it_status_t ald_i2s_get_it_status(ald_i2s_handle_t *hperh, ald_i2s_it_t it)
/* Checks whether the specified I2S interrupt has occurred or not. */ it_status_t ald_i2s_get_it_status(ald_i2s_handle_t *hperh, ald_i2s_it_t it)
{ assert_param(IS_I2S(hperh->perh)); assert_param(IS_I2S_IT(it)); if (hperh->perh->IVS & it) return SET; return RESET; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the bit number to set in the MAC hash filter corresponding to a given MAC address. */
uint32_t EMACHashFilterBitCalculate(uint8_t *pui8MACAddr)
/* Returns the bit number to set in the MAC hash filter corresponding to a given MAC address. */ uint32_t EMACHashFilterBitCalculate(uint8_t *pui8MACAddr)
{ uint32_t ui32CRC, ui32Mask, ui32Loop; ASSERT(pui8MACAddr); ui32CRC = Crc32(0xFFFFFFFF, pui8MACAddr, 6); ui32CRC ^= 0xFFFFFFFF; ui32Mask = 0; for(ui32Loop = 0; ui32Loop < 6; ui32Loop++) { ui32Mask <<= 1; ui32Mask |= (ui32CRC & 1); ui32CRC >>= 1; } return(ui32...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Description: Remove all entries from the network address table. */
static void sel_netport_flush(void)
/* Description: Remove all entries from the network address table. */ static void sel_netport_flush(void)
{ unsigned int idx; struct sel_netport *port, *port_tmp; spin_lock_bh(&sel_netport_lock); for (idx = 0; idx < SEL_NETPORT_HASH_SIZE; idx++) { list_for_each_entry_safe(port, port_tmp, &sel_netport_hash[idx].list, list) { list_del_rcu(&port->list); call_rcu(&port->rcu, sel_netport_free); } sel_netpo...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reset the DMA controller. This functions will disable the DMA controller and set it to a reset state. */
void DMA_Reset(void)
/* Reset the DMA controller. This functions will disable the DMA controller and set it to a reset state. */ void DMA_Reset(void)
{ int i; NVIC_DisableIRQ(DMA_IRQn); DMA->CONFIG = _DMA_CONFIG_RESETVALUE; DMA->CHUSEBURSTC = _DMA_CHUSEBURSTC_MASK; DMA->CHREQMASKC = _DMA_CHREQMASKC_MASK; DMA->CHENC = _DMA_CHENC_MASK; DMA->CHALTC = _DMA_CHALTC_MASK; DMA->CHPRIC = _DMA_CHPRIC_MASK; DMA->ERRORC = DMA_ERRORC_...
feaser/openblt
C++
GNU General Public License v3.0
601
/* This function make QSPI module be ready to transfer. */
static void QSPI_SetSrcClkToPCLK(QSPI_T *qspi)
/* This function make QSPI module be ready to transfer. */ static void QSPI_SetSrcClkToPCLK(QSPI_T *qspi)
{ uint32_t u32ClkSelMsk = 0U, u32ClkSelPos = 0U; if (qspi == QSPI0) { u32ClkSelMsk = CLK_CLKSEL4_QSPI0SEL_Msk; u32ClkSelPos = CLK_CLKSEL4_QSPI0SEL_Pos; } else if (qspi == QSPI1) { u32ClkSelMsk = CLK_CLKSEL4_QSPI1SEL_Msk; u32ClkSelPos = CLK_CLKSEL4_QSPI1SEL_Pos; ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Over-ride default table to free additional IRQs for use by PCI e.g. acpi_irq_pci=7,15 Used for acpi_irq_balance to free up IRQs to reduce PCI IRQ sharing. */
static int __init acpi_irq_pci(char *str)
/* Over-ride default table to free additional IRQs for use by PCI e.g. acpi_irq_pci=7,15 Used for acpi_irq_balance to free up IRQs to reduce PCI IRQ sharing. */ static int __init acpi_irq_pci(char *str)
{ return acpi_irq_penalty_update(str, 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Force HC to halt state from unknown (EHCI spec section 2.3). Must be called with interrupts enabled and the lock not held. */
int ehci_halt(struct ehci_hcd *ehci)
/* Force HC to halt state from unknown (EHCI spec section 2.3). Must be called with interrupts enabled and the lock not held. */ int ehci_halt(struct ehci_hcd *ehci)
{ u32 temp; uint32_t cpusr; hal_spin_lock(&ehci->lock); ehci_writel(ehci, 0, &ehci->regs->intr_enable); ehci->command &= ~CMD_RUN; temp = ehci_readl(ehci, &ehci->regs->command); temp &= ~(CMD_RUN | CMD_IAAD); ehci_writel(ehci, temp, &ehci->regs->command); hal_spin_unlock(&ehci->lock)...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Static function to get the expected throughput from an iwl_scale_tbl_info that wraps a NULL pointer check */
static s32 get_expected_tpt(struct iwl_scale_tbl_info *tbl, int rs_index)
/* Static function to get the expected throughput from an iwl_scale_tbl_info that wraps a NULL pointer check */ static s32 get_expected_tpt(struct iwl_scale_tbl_info *tbl, int rs_index)
{ if (tbl->expected_tpt) return tbl->expected_tpt[rs_index]; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* If 32-bit I/O port operations are not supported, then ASSERT(). */
VOID EFIAPI IoReadFifo32(IN UINTN Port, IN UINTN Count, OUT VOID *Buffer)
/* If 32-bit I/O port operations are not supported, then ASSERT(). */ VOID EFIAPI IoReadFifo32(IN UINTN Port, IN UINTN Count, OUT VOID *Buffer)
{ UINT32 *Buffer32; ASSERT ((Port & 3) == 0); Buffer32 = (UINT32 *)Buffer; while (Count-- > 0) { *Buffer32++ = IoRead32 (Port); } }
tianocore/edk2
C++
Other
4,240
/* The function register DTPM2.0 instance and caches current active TPM interface type. */
EFI_STATUS EFIAPI Tpm2InstanceLibDTpmConstructor(VOID)
/* The function register DTPM2.0 instance and caches current active TPM interface type. */ EFI_STATUS EFIAPI Tpm2InstanceLibDTpmConstructor(VOID)
{ EFI_STATUS Status; Status = Tpm2RegisterTpm2DeviceLib (&mDTpm2InternalTpm2Device); if ((Status == EFI_SUCCESS) || (Status == EFI_UNSUPPORTED)) { if (Status == EFI_SUCCESS) { Status = InternalTpm2DeviceLibDTpmCommonConstructor (); DumpPtpInfo ((VOID *)(UINTN)PcdGet64 (PcdTpmBaseAddress)); } ...
tianocore/edk2
C++
Other
4,240
/* This function retrieves the WiFi interface's IP address. */
WIFI_Status_t WIFI_GetIP_Address(uint8_t *ipaddr)
/* This function retrieves the WiFi interface's IP address. */ WIFI_Status_t WIFI_GetIP_Address(uint8_t *ipaddr)
{ WIFI_Status_t ret = WIFI_STATUS_ERROR; if (ES_WIFI_IsConnected(&EsWifiObj) == 1) { memcpy(ipaddr, EsWifiObj.NetSettings.IP_Addr, 4); ret = WIFI_STATUS_OK; } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Convert the hex array pointed to by buf into binary to be placed in mem. Return a pointer to the character AFTER the last byte written. May return an error. */
int kgdb_hex2mem(char *buf, char *mem, int count)
/* Convert the hex array pointed to by buf into binary to be placed in mem. Return a pointer to the character AFTER the last byte written. May return an error. */ int kgdb_hex2mem(char *buf, char *mem, int count)
{ char *tmp_raw; char *tmp_hex; tmp_raw = buf + count * 2; tmp_hex = tmp_raw - 1; while (tmp_hex >= buf) { tmp_raw--; *tmp_raw = hex(*tmp_hex--); *tmp_raw |= hex(*tmp_hex--) << 4; } return probe_kernel_write(mem, tmp_raw, count); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If the volume is damaged because of an interrupted update this function just returns immediately with %-EBADF code. */
int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum)
/* If the volume is damaged because of an interrupted update this function just returns immediately with %-EBADF code. */ int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum)
{ struct ubi_volume *vol = desc->vol; struct ubi_device *ubi = vol->ubi; int err; dbg_gen("erase 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 -EBAD...
robutest/uclinux
C++
GPL-2.0
60
/* Change Logs: Date Author Notes ArdaFu first version */
void led_init(void)
/* Change Logs: Date Author Notes ArdaFu first version */ void led_init(void)
{ outl(((1UL<<25) | (1UL<<4)) , REG_SET(HW_AHBCLKCTRL0)); HW_SetPinMux(16,7,0); HW_GpioSetDir(16,7,1); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* There are cases when the host controller fails to enable the port due to, for example, insufficient power that can be supplied to the device from the USB bus. In those cases, the messages printed here are not helpful. */
static int ehci_xilinx_port_handed_over(struct usb_hcd *hcd, int portnum)
/* There are cases when the host controller fails to enable the port due to, for example, insufficient power that can be supplied to the device from the USB bus. In those cases, the messages printed here are not helpful. */ static int ehci_xilinx_port_handed_over(struct usb_hcd *hcd, int portnum)
{ dev_warn(hcd->self.controller, "port %d cannot be enabled\n", portnum); if (hcd->has_tt) { dev_warn(hcd->self.controller, "Maybe you have connected a low speed device?\n"); dev_warn(hcd->self.controller, "We do not support low speed devices\n"); } else { dev_warn(hcd->self.controller, "Maybe your de...
robutest/uclinux
C++
GPL-2.0
60
/* VmbusChannelReleaseUnattachedChannels - Release channels that are unattached/unconnected ie (no drivers associated) */
void VmbusChannelReleaseUnattachedChannels(void)
/* VmbusChannelReleaseUnattachedChannels - Release channels that are unattached/unconnected ie (no drivers associated) */ void VmbusChannelReleaseUnattachedChannels(void)
{ struct vmbus_channel *channel, *pos; struct vmbus_channel *start = NULL; unsigned long flags; spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); list_for_each_entry_safe(channel, pos, &gVmbusConnection.ChannelList, ListEntry) { if (channel == start) break; if (!channel->DeviceObject->Driver) {...
robutest/uclinux
C++
GPL-2.0
60
/* Move the cursor n unit to the right. */
void HD44780CursorRightMove(unsigned char n)
/* Move the cursor n unit to the right. */ void HD44780CursorRightMove(unsigned char n)
{ int i = n; while(i--) { while(HD44780Busy()); HD44780WriteCmd(HD44780_CMD_CURSOR_DISPLAY_SHIFT( HD44780_CURSOR_DISPLAY_SHIFT_SC_C | HD44780_CURSOR_DISPLAY_SHIFT_RL_R)); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Cause a processor trigger for a sample sequence. */
void ADCProcessorTrigger(unsigned long ulBase)
/* Cause a processor trigger for a sample sequence. */ void ADCProcessorTrigger(unsigned long ulBase)
{ xASSERT(ulBase == ADC_BASE); xHWREG(ulBase + ADC_TCR) |= ADC_TCR_ADSW_EN; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Reset the actual path elements so that we can re-use the structure to build another path. Generally, this involves freeing the buffer heads. */
void ocfs2_reinit_path(struct ocfs2_path *path, int keep_root)
/* Reset the actual path elements so that we can re-use the structure to build another path. Generally, this involves freeing the buffer heads. */ void ocfs2_reinit_path(struct ocfs2_path *path, int keep_root)
{ int i, start = 0, depth = 0; struct ocfs2_path_item *node; if (keep_root) start = 1; for(i = start; i < path_num_items(path); i++) { node = &path->p_node[i]; brelse(node->bh); node->bh = NULL; node->el = NULL; } if (keep_root) depth = le16_to_cpu(path_root_el(path)->l_tree_depth); else path_root_...
robutest/uclinux
C++
GPL-2.0
60
/* Translate an interface index to the corresponding link name */
char* rtnl_link_i2name(struct nl_cache *cache, int ifindex, char *dst, size_t len)
/* Translate an interface index to the corresponding link name */ char* rtnl_link_i2name(struct nl_cache *cache, int ifindex, char *dst, size_t len)
{ struct rtnl_link *link = rtnl_link_get(cache, ifindex); if (link) { strncpy(dst, link->l_name, len - 1); rtnl_link_put(link); return dst; } return NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The function fills in the provided Buffer with the level 0 discovery Header of the device specified. */
TCG_RESULT EFIAPI OpalRetrieveLevel0DiscoveryHeader(OPAL_SESSION *Session, UINTN BufferSize, VOID *BuffAddress)
/* The function fills in the provided Buffer with the level 0 discovery Header of the device specified. */ TCG_RESULT EFIAPI OpalRetrieveLevel0DiscoveryHeader(OPAL_SESSION *Session, UINTN BufferSize, VOID *BuffAddress)
{ return (OpalTrustedRecv ( Session->Sscp, Session->MediaId, TCG_OPAL_SECURITY_PROTOCOL_1, TCG_SP_SPECIFIC_PROTOCOL_LEVEL0_DISCOVERY, BuffAddress, BufferSize, 0 )); }
tianocore/edk2
C++
Other
4,240
/* is_hpet_enabled - check whether the hpet timer interrupt is enabled */
int is_hpet_enabled(void)
/* is_hpet_enabled - check whether the hpet timer interrupt is enabled */ int is_hpet_enabled(void)
{ return is_hpet_capable() && hpet_legacy_int_enabled; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns 0 if current has the requested access, error code otherwise */
static int smack_msg_queue_associate(struct msg_queue *msq, int msqflg)
/* Returns 0 if current has the requested access, error code otherwise */ static int smack_msg_queue_associate(struct msg_queue *msq, int msqflg)
{ int may; may = smack_flags_to_may(msqflg); return smk_curacc_msq(msq, may); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Ack the hub change bits. If these bits are not ACKed, Hub will always return changed bit map from its interrupt endpoint. */
EFI_STATUS UsbHubAckHubStatus(IN USB_DEVICE *HubDev)
/* Ack the hub change bits. If these bits are not ACKed, Hub will always return changed bit map from its interrupt endpoint. */ EFI_STATUS UsbHubAckHubStatus(IN USB_DEVICE *HubDev)
{ EFI_USB_PORT_STATUS HubState; EFI_STATUS Status; Status = UsbHubCtrlGetHubStatus (HubDev, (UINT32 *)&HubState); if (EFI_ERROR (Status)) { return Status; } if (USB_BIT_IS_SET (HubState.PortChangeStatus, USB_HUB_STAT_C_LOCAL_POWER)) { UsbHubCtrlClearHubFeature (HubDev, USB_HUB_C_HUB_LOCAL...
tianocore/edk2
C++
Other
4,240
/* This function provides a standard way to execute Smbus script as defined in the SmBus Specification. The data can either be of the Length byte, word, or a block of data. */
UINTN InternalSmBusExec(IN EFI_SMBUS_OPERATION SmbusOperation, IN UINTN SmBusAddress, IN UINTN Length, IN OUT VOID *Buffer, OUT RETURN_STATUS *Status OPTIONAL)
/* This function provides a standard way to execute Smbus script as defined in the SmBus Specification. The data can either be of the Length byte, word, or a block of data. */ UINTN InternalSmBusExec(IN EFI_SMBUS_OPERATION SmbusOperation, IN UINTN SmBusAddress, IN UINTN Length, IN OUT VOID *Buffer, OUT RETURN_STATUS *S...
{ EFI_PEI_SMBUS2_PPI *SmbusPpi; RETURN_STATUS ReturnStatus; EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress; SmbusPpi = InternalGetSmbusPpi (); SmbusDeviceAddress.SmbusDeviceAddress = SMBUS_LIB_SLAVE_ADDRESS (SmBusAddress); ReturnStatus = SmbusPpi->Execute ( ...
tianocore/edk2
C++
Other
4,240
/* Overhead of the TLSF structures in a given memory block passed to lv_tlsf_add_pool, equal to the overhead of a free block and the sentinel block. */
size_t lv_tlsf_pool_overhead(void)
/* Overhead of the TLSF structures in a given memory block passed to lv_tlsf_add_pool, equal to the overhead of a free block and the sentinel block. */ size_t lv_tlsf_pool_overhead(void)
{ return 2 * block_header_overhead; }
pikasTech/PikaPython
C++
MIT License
1,403
/* set the interface value to the connected device */
usbh_status usbh_setinterface(usbh_host *puhost, uint8_t itf_num, uint8_t set)
/* set the interface value to the connected device */ usbh_status usbh_setinterface(usbh_host *puhost, uint8_t itf_num, uint8_t set)
{ usbh_status status = USBH_BUSY; usbh_control *usb_ctl = &puhost->control; if (CTL_IDLE == usb_ctl->ctl_state) { usb_ctl->setup.req = (usb_req) { .bmRequestType = USB_TRX_OUT | USB_RECPTYPE_ITF | USB_REQTYPE_STRD, .bRequest = USB_SET_INTERFACE, .wValue ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* yaffsfs_GetInodeIdForObject Grab an inode entry when opening a new inode. */
static int yaffsfs_GetInodeIdForObject(struct yaffs_obj *obj)
/* yaffsfs_GetInodeIdForObject Grab an inode entry when opening a new inode. */ static int yaffsfs_GetInodeIdForObject(struct yaffs_obj *obj)
{ int i; int ret; struct yaffsfs_Inode *in = NULL; if (obj) obj = yaffs_get_equivalent_obj(obj); ret = yaffsfs_FindInodeIdForObject(obj); for (i = 0; i < YAFFSFS_N_HANDLES && ret < 0; i++) { if (!yaffsfs_inode[i].iObj) ret = i; } if (ret >= 0) { in = &yaffsfs_inode[ret]; if (!in->iObj) in->count =...
4ms/stm32mp1-baremetal
C++
Other
137
/* ADC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
/* ADC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hadc->Instance==ADC1) { __HAL_RCC_ADC1_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_1; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read a value from a PHY's MII register. */
int mii_read(int ch, int phy_addr, int reg_addr, int *data)
/* Read a value from a PHY's MII register. */ int mii_read(int ch, int phy_addr, int reg_addr, int *data)
{ int timeout; ENET_EIR = ENET_EIR_MII_MASK; ENET_MMFR = 0 | ENET_MMFR_ST(0x01) | ENET_MMFR_OP(0x2) | ENET_MMFR_PA(phy_addr) | ENET_MMFR_RA(reg_addr) | ENET_MMFR_TA(0x02); for (timeout = 0; timeout < MII_TIMEOUT; timeout++) { if (ENET_EIR & ENET_EIR_MII_MASK) break; } if(timeout == MII_TIMEOUT) ...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Initializes the user program application. Should be called once during software program initialization. */
void AppInit(void)
/* Initializes the user program application. Should be called once during software program initialization. */ void AppInit(void)
{ TimerInit(); LedInit(); SharedParamsInit(); NetInit(); BootComInit(); SharedParamsWriteByIndex(0, 0); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* convert the colour format of a given tile to rgb565 */
arm_fsm_rt_t arm_2dp_convert_colour_to_rgb565(arm_2d_op_cl_convt_t *ptOP, const arm_2d_tile_t *ptSource, const arm_2d_tile_t *ptTarget)
/* convert the colour format of a given tile to rgb565 */ arm_fsm_rt_t arm_2dp_convert_colour_to_rgb565(arm_2d_op_cl_convt_t *ptOP, const arm_2d_tile_t *ptSource, const arm_2d_tile_t *ptTarget)
{ assert(NULL != ptSource); assert(NULL != ptTarget); ARM_2D_IMPL(arm_2d_op_cl_convt_t, ptOP); if (!__arm_2d_op_acquire((arm_2d_op_core_t *)ptThis)) { return arm_fsm_rt_on_going; } OP_CORE.ptOp = &ARM_2D_OP_CONVERT_TO_RGB565; this.Target.ptTile = ptTarget; this.Target.ptRegion = ...
pikasTech/PikaPython
C++
MIT License
1,403
/* Interrupt handler for TC0. Record the number of bytes received, and then restart a read transfer on the USART if the transfer was stopped. */
void TC0_Handler(void)
/* Interrupt handler for TC0. Record the number of bytes received, and then restart a read transfer on the USART if the transfer was stopped. */ void TC0_Handler(void)
{ tc_get_status(TC0, 0); lin_master_task_ID12(); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Get available stack space of a thread based on stack watermark recording during execution. */
uint32_t osThreadGetStackSpace(osThreadId_t thread_id)
/* Get available stack space of a thread based on stack watermark recording during execution. */ uint32_t osThreadGetStackSpace(osThreadId_t thread_id)
{ EvrRtxThreadGetStackSpace(thread_id, 0U); stack_space = 0U; } else { stack_space = __svcThreadGetStackSpace(thread_id); } return stack_space; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Disable the UART. This routine disables the given UART. */
static void disable(const struct device *dev)
/* Disable the UART. This routine disables the given UART. */ static void disable(const struct device *dev)
{ const struct uart_stellaris_config *config = dev->config; config->uart->ctl &= ~UARTCTL_UARTEN; while (config->uart->fr & UARTFR_BUSY) { } config->uart->lcrh &= ~UARTLCRH_FEN; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Derive SHA384 HMAC-based Expand Key Derivation Function (HKDF). */
BOOLEAN EFIAPI HkdfSha384Expand(IN CONST UINT8 *Prk, IN UINTN PrkSize, IN CONST UINT8 *Info, IN UINTN InfoSize, OUT UINT8 *Out, IN UINTN OutSize)
/* Derive SHA384 HMAC-based Expand Key Derivation Function (HKDF). */ BOOLEAN EFIAPI HkdfSha384Expand(IN CONST UINT8 *Prk, IN UINTN PrkSize, IN CONST UINT8 *Info, IN UINTN InfoSize, OUT UINT8 *Out, IN UINTN OutSize)
{ return HkdfMdExpand (EVP_sha384 (), Prk, PrkSize, Info, InfoSize, Out, OutSize); }
tianocore/edk2
C++
Other
4,240
/* Called after each bus is probed, but before its children are examined. */
void __devinit pcibios_fixup_bus(struct pci_bus *bus)
/* Called after each bus is probed, but before its children are examined. */ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
{ struct pci_dev *dev = bus->self; struct list_head *ln; struct pci_channel *chan = bus->sysdata; if (!dev) { bus->resource[0] = chan->io_resource; bus->resource[1] = chan->mem_resource; } for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) { dev = pci_dev_b(ln); if ((dev->class >> 8) != PCI_...
EmcraftSystems/linux-emcraft
C++
Other
266
/* sdio_unregister_driver - unregister a function driver @drv: SDIO function driver */
void sdio_unregister_driver(struct sdio_driver *drv)
/* sdio_unregister_driver - unregister a function driver @drv: SDIO function driver */ void sdio_unregister_driver(struct sdio_driver *drv)
{ drv->drv.bus = &sdio_bus_type; driver_unregister(&drv->drv); }
robutest/uclinux
C++
GPL-2.0
60
/* Read a single color from the graphical memory. Limits have to be set prior to calling this function, e.g.: */
ili9341_color_t ili9341_read_gram(void)
/* Read a single color from the graphical memory. Limits have to be set prior to calling this function, e.g.: */ ili9341_color_t ili9341_read_gram(void)
{ uint8_t red, green, blue; ili9341_send_command(ILI9341_CMD_MEMORY_READ); red = ili9341_read_byte(); red = ili9341_read_byte(); green = ili9341_read_byte(); blue = ili9341_read_byte(); ili9341_deselect_chip(); return ILI9341_COLOR(red, green, blue); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Read volume information on a medium which contains a valid UDF file system. */
EFI_STATUS ReadUdfVolumeInformation(IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, OUT UDF_VOLUME_INFO *Volume)
/* Read volume information on a medium which contains a valid UDF file system. */ EFI_STATUS ReadUdfVolumeInformation(IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, OUT UDF_VOLUME_INFO *Volume)
{ EFI_STATUS Status; Status = ReadVolumeFileStructure ( BlockIo, DiskIo, Volume ); if (EFI_ERROR (Status)) { return Status; } Status = FindFileSetDescriptor (BlockIo, DiskIo, Volume); if (EFI_ERROR (Status)) { return Status; } return Status; }
tianocore/edk2
C++
Other
4,240
/* Returns zero on success, a negative error code otherwise. */
int mtd_ooblayout_count_freebytes(struct mtd_info *mtd)
/* Returns zero on success, a negative error code otherwise. */ int mtd_ooblayout_count_freebytes(struct mtd_info *mtd)
{ return mtd_ooblayout_count_bytes(mtd, mtd_ooblayout_free); }
4ms/stm32mp1-baremetal
C++
Other
137
/* The function is used to Enable frequency clock output and set its divider value. */
void SysCtlFreqDividerOutputEnable(xtBoolean bEnable, unsigned char u8Divider)
/* The function is used to Enable frequency clock output and set its divider value. */ void SysCtlFreqDividerOutputEnable(xtBoolean bEnable, unsigned char u8Divider)
{ xASSERT(u8Divider <= 15); if(bEnable) { xHWREG(SYSCLK_FRQDIV) &= ~SYSCLK_FRQDIV_FSEL_M; xHWREG(SYSCLK_FRQDIV) |= u8Divider; xHWREG(SYSCLK_FRQDIV) |= SYSCLK_FRQDIV_EN; xSysCtlPeripheralEnable(SYSCTL_PERIPH_FDIV); } else { xHWREG(SYSCLK_FRQDIV) &= ~SYSCLK_...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Do inverse transform on 8x4 part of block */
static void vc1_inv_trans_8x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
/* Do inverse transform on 8x4 part of block */ static void vc1_inv_trans_8x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
{ int i; int dc = block[0]; const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; dc = ( 3 * dc + 1) >> 1; dc = (17 * dc + 64) >> 7; for(i = 0; i < 4; i++){ dest[0] = cm[dest[0]+dc]; dest[1] = cm[dest[1]+dc]; dest[2] = cm[dest[2]+dc]; dest[3] = cm[dest[3]+dc]; d...
DC-SWAT/DreamShell
C++
null
404
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI PciBitFieldWrite8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 Value)
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT8 EFIAPI PciBitFieldWrite8(IN UINTN...
{ return PciExpressBitFieldWrite8 (Address, StartBit, EndBit, Value); }
tianocore/edk2
C++
Other
4,240
/* early_platform_add_devices - add a numbers of early platform devices @devs: array of early platform devices to add @num: number of early platform devices in array */
void __init early_platform_add_devices(struct platform_device **devs, int num)
/* early_platform_add_devices - add a numbers of early platform devices @devs: array of early platform devices to add @num: number of early platform devices in array */ void __init early_platform_add_devices(struct platform_device **devs, int num)
{ struct device *dev; int i; for (i = 0; i < num; i++) { dev = &devs[i]->dev; if (!dev->devres_head.next) { INIT_LIST_HEAD(&dev->devres_head); list_add_tail(&dev->devres_head, &early_platform_device_list); } } }
robutest/uclinux
C++
GPL-2.0
60
/* This function is derived from PowerPC code (timebase clock frequency). On ARM it returns the number of timer ticks per second. */
ulong get_tbclk(void)
/* This function is derived from PowerPC code (timebase clock frequency). On ARM it returns the number of timer ticks per second. */ ulong get_tbclk(void)
{ return (ulong)(timer_load_val / 100); }
EmcraftSystems/u-boot
C++
Other
181
/* Fills each LTDC_colorkeying_InitStruct member with its default value. */
void LTDC_ColorKeyingStructInit(LTDC_ColorKeying_InitTypeDef *LTDC_colorkeying_InitStruct)
/* Fills each LTDC_colorkeying_InitStruct member with its default value. */ void LTDC_ColorKeyingStructInit(LTDC_ColorKeying_InitTypeDef *LTDC_colorkeying_InitStruct)
{ LTDC_colorkeying_InitStruct->LTDC_ColorKeyBlue = 0x00; LTDC_colorkeying_InitStruct->LTDC_ColorKeyGreen = 0x00; LTDC_colorkeying_InitStruct->LTDC_ColorKeyRed = 0x00; }
MaJerle/stm32f429
C++
null
2,036
/* This service enables PEIMs to ascertain the present value of the boot mode. */
EFI_STATUS EFIAPI PeiGetBootMode(IN CONST EFI_PEI_SERVICES **PeiServices, IN OUT EFI_BOOT_MODE *BootMode)
/* This service enables PEIMs to ascertain the present value of the boot mode. */ EFI_STATUS EFIAPI PeiGetBootMode(IN CONST EFI_PEI_SERVICES **PeiServices, IN OUT EFI_BOOT_MODE *BootMode)
{ PEI_CORE_INSTANCE *PrivateData; EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; if (BootMode == NULL) { return EFI_INVALID_PARAMETER; } PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices); HandOffHob = (PrivateData->HobList.HandoffInformationTable); *BootMode = HandOffHob->BootMode; retu...
tianocore/edk2
C++
Other
4,240
/* Enable or disable inverting serial input function of IrDA on UART peripheral. */
void UART_IrDAInvtInputCmd(LPC_UART_TypeDef *UARTx, FunctionalState NewState)
/* Enable or disable inverting serial input function of IrDA on UART peripheral. */ void UART_IrDAInvtInputCmd(LPC_UART_TypeDef *UARTx, FunctionalState NewState)
{ if (NewState == ENABLE) { UARTx->ICR |= UART_ICR_IRDAINV; } else if (NewState == DISABLE) { UARTx->ICR &= (~UART_ICR_IRDAINV) & UART_ICR_BITMASK; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* 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 GPIOPinTypeGPIOInput(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 GPIOPinTypeGPIOInput(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_STD); }
watterott/WebRadio
C++
null
71
/* This API maps the actual burst read length set by user. */
static int8_t map_read_len(uint16_t *len, const struct bmi160_dev *dev)
/* This API maps the actual burst read length set by user. */ static int8_t map_read_len(uint16_t *len, const struct bmi160_dev *dev)
{ int8_t rslt = BMI160_OK; switch (dev->aux_cfg.aux_rd_burst_len) { case BMI160_AUX_READ_LEN_0: *len = 1; break; case BMI160_AUX_READ_LEN_1: *len = 2; break; case BMI160_AUX_READ_LEN_2: *len = 6; break; c...
eclipse-threadx/getting-started
C++
Other
310
/* Returns: the number of bytes forming the character returned. */
int _cairo_utf8_get_char_validated(const char *p, uint32_t *unicode)
/* Returns: the number of bytes forming the character returned. */ int _cairo_utf8_get_char_validated(const char *p, uint32_t *unicode)
{ int i, mask = 0, len; uint32_t result; unsigned char c = (unsigned char) *p; UTF8_COMPUTE (c, mask, len); if (len == -1) { if (unicode) *unicode = (uint32_t)-1; return 1; } UTF8_GET (result, p, i, mask, len); if (unicode) *unicode = result; return len; }
xboot/xboot
C++
MIT License
779
/* Converts an orientation matrix made up of 0,+1,and -1 to a scalar representation. */
unsigned short inv_orientation_matrix_to_scalar(const signed char *mtx)
/* Converts an orientation matrix made up of 0,+1,and -1 to a scalar representation. */ unsigned short inv_orientation_matrix_to_scalar(const signed char *mtx)
{ unsigned short scalar; scalar = inv_row_2_scale(mtx); scalar |= inv_row_2_scale(mtx + 3) << 3; scalar |= inv_row_2_scale(mtx + 6) << 6; return scalar; }
Luos-io/luos_engine
C++
MIT License
496
/* Read FSB from chipset If bootfsb != 0, return FSB at boot-time */
static unsigned int nforce2_fsb_read(int bootfsb)
/* Read FSB from chipset If bootfsb != 0, return FSB at boot-time */ static unsigned int nforce2_fsb_read(int bootfsb)
{ struct pci_dev *nforce2_sub5; u32 fsb, temp = 0; nforce2_sub5 = pci_get_subsys(PCI_VENDOR_ID_NVIDIA, 0x01EF, PCI_ANY_ID, PCI_ANY_ID, NULL); if (!nforce2_sub5) return 0; pci_read_config_dword(nforce2_sub5, NFORCE2_BOOTFSB, &fsb); fsb /= 1000000; pci_read_config_byte(nforce2_dev, NFORCE2_PLLENABLE, (u8 *)&...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Gets the status of a job. Gets the status of an ongoing or the last job. */
enum status_code sdadc_get_job_status(struct sdadc_module *module_inst, enum sdadc_job_type type)
/* Gets the status of a job. Gets the status of an ongoing or the last job. */ enum status_code sdadc_get_job_status(struct sdadc_module *module_inst, enum sdadc_job_type type)
{ Assert(module_inst); if (type == SDADC_JOB_READ_BUFFER ) { return module_inst->job_status; } else { return STATUS_ERR_INVALID_ARG; } }
memfault/zero-to-main
C++
null
200
/* Find the deferred image which matches the device path. */
DEFERRED_3RD_PARTY_IMAGE_INFO* LookupImage(IN CONST EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath, IN BOOLEAN BootOption)
/* Find the deferred image which matches the device path. */ DEFERRED_3RD_PARTY_IMAGE_INFO* LookupImage(IN CONST EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath, IN BOOLEAN BootOption)
{ UINTN Index; UINTN DevicePathSize; DevicePathSize = GetDevicePathSize (ImageDevicePath); for (Index = 0; Index < mDeferred3rdPartyImage.Count; Index++) { if (CompareMem (ImageDevicePath, mDeferred3rdPartyImage.ImageInfo[Index].ImageDevicePath, DevicePathSize) == 0) { ASSERT (mDeferred3rdPartyImage...
tianocore/edk2
C++
Other
4,240
/* Glue received frame with previous fragments of packet. Indicate packet when last frame would be accepted. */
static int append_frame_to_pkt(struct net_device *, unsigned, u32)
/* Glue received frame with previous fragments of packet. Indicate packet when last frame would be accepted. */ static int append_frame_to_pkt(struct net_device *, unsigned, u32)
{ struct net_local *nl = netdev_priv(dev); u8 *p; if( nl->inppos + framelen > ETHER_MAX_LEN ) return 0; if( !nl->rx_buf_p && !(nl->rx_buf_p = get_rx_buf( dev )) ) return 0; p = nl->rx_buf_p->data + nl->inppos; insb( dev->base_addr + DAT, p, framelen ); if( calc_crc32( crc, p, framelen ) != CRC32_REMA...
robutest/uclinux
C++
GPL-2.0
60
/* Given a cluster count of len, pad it out so that it is a multiple of contig_clusters. */
static unsigned int ocfs2_cow_align_length(struct super_block *sb, unsigned int len)
/* Given a cluster count of len, pad it out so that it is a multiple of contig_clusters. */ static unsigned int ocfs2_cow_align_length(struct super_block *sb, unsigned int len)
{ unsigned int padded = (len + (ocfs2_cow_contig_clusters(sb) - 1)) & ocfs2_cow_contig_mask(sb); if (padded < len) padded = UINT_MAX; return padded; }
robutest/uclinux
C++
GPL-2.0
60
/* Perform get_thread_area on behalf of the traced child. */
int ptrace_get_thread_area(struct task_struct *child, int idx, struct user_desc __user *user_desc)
/* Perform get_thread_area on behalf of the traced child. */ int ptrace_get_thread_area(struct task_struct *child, int idx, struct user_desc __user *user_desc)
{ struct user_desc info; int ret; if (!host_supports_tls) return -EIO; ret = get_tls_entry(child, &info, idx); if (ret < 0) goto out; if (copy_to_user(user_desc, &info, sizeof(info))) ret = -EFAULT; out: return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This routine is entry point of ScriptSave driver. */
EFI_STATUS EFIAPI InitializeSmmS3SaveState(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* This routine is entry point of ScriptSave driver. */ EFI_STATUS EFIAPI InitializeSmmS3SaveState(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_HANDLE Handle; if (!PcdGetBool (PcdAcpiS3Enable)) { return EFI_UNSUPPORTED; } Handle = NULL; return gSmst->SmmInstallProtocolInterface ( &Handle, &gEfiS3SmmSaveStateProtocolGuid, EFI_NATIVE_INTERFACE, &mS3SmmSaveState ...
tianocore/edk2
C++
Other
4,240