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
/* configure the PHY interface for the ethernet MAC */
void syscfg_enet_phy_interface_config(uint32_t syscfg_enet_phy_interface)
/* configure the PHY interface for the ethernet MAC */ void syscfg_enet_phy_interface_config(uint32_t syscfg_enet_phy_interface)
{ uint32_t reg; reg = SYSCFG_CFG1; reg &= ~SYSCFG_CFG1_ENET_PHY_SEL; SYSCFG_CFG1 = (reg | syscfg_enet_phy_interface); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Creates a bio that consists of range of complete bvecs. */
static struct bio* clone_bio(struct bio *bio, sector_t sector, unsigned short idx, unsigned short bv_count, unsigned int len, struct bio_set *bs)
/* Creates a bio that consists of range of complete bvecs. */ static struct bio* clone_bio(struct bio *bio, sector_t sector, unsigned short idx, unsigned short bv_count, unsigned int len, struct bio_set *bs)
{ struct bio *clone; clone = bio_alloc_bioset(GFP_NOIO, bio->bi_max_vecs, bs); __bio_clone(clone, bio); clone->bi_rw &= ~(1 << BIO_RW_BARRIER); clone->bi_destructor = dm_bio_destructor; clone->bi_sector = sector; clone->bi_idx = idx; clone->bi_vcnt = idx + bv_count; clone->bi_size = to_bytes(len); clone->bi_f...
robutest/uclinux
C++
GPL-2.0
60
/* Description: Add a new port record to the network address hash table. */
static void sel_netport_insert(struct sel_netport *port)
/* Description: Add a new port record to the network address hash table. */ static void sel_netport_insert(struct sel_netport *port)
{ unsigned int idx; idx = sel_netport_hashfn(port->psec.port); list_add_rcu(&port->list, &sel_netport_hash[idx].list); if (sel_netport_hash[idx].size == SEL_NETPORT_HASH_BKT_LIMIT) { struct sel_netport *tail; tail = list_entry( rcu_dereference(sel_netport_hash[idx].list.prev), struct sel_netport, list); ...
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function returns the size, in bytes, of the device path data structure specified by DevicePath including the end of device path node. If DevicePath is NULL, then 0 is returned. If the length of the device path is bigger than MaxSize, also return 0 to indicate this is an invalidate device path. */
UINTN BmGetDevicePathSizeEx(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN UINTN MaxSize)
/* This function returns the size, in bytes, of the device path data structure specified by DevicePath including the end of device path node. If DevicePath is NULL, then 0 is returned. If the length of the device path is bigger than MaxSize, also return 0 to indicate this is an invalidate device path. */ UINTN BmGetDev...
{ UINTN Size; UINTN NodeSize; if (DevicePath == NULL) { return 0; } Size = 0; while (!IsDevicePathEnd (DevicePath)) { NodeSize = DevicePathNodeLength (DevicePath); if (NodeSize == 0) { return 0; } Size += NodeSize; if (Size > MaxSize) { return 0; } DevicePath = ...
tianocore/edk2
C++
Other
4,240
/* scsi_device_type - Return 17 char string indicating device type. @type: type number to look up */
const char* scsi_device_type(unsigned type)
/* scsi_device_type - Return 17 char string indicating device type. @type: type number to look up */ const char* scsi_device_type(unsigned type)
{ if (type == 0x1e) return "Well-known LUN "; if (type == 0x1f) return "No Device "; if (type >= ARRAY_SIZE(scsi_device_types)) return "Unknown "; return scsi_device_types[type]; }
robutest/uclinux
C++
GPL-2.0
60
/* Return version of the clock management protocol supported by SCP firmware. */
STATIC EFI_STATUS ClockGetVersion(IN SCMI_CLOCK_PROTOCOL *This, OUT UINT32 *Version)
/* Return version of the clock management protocol supported by SCP firmware. */ STATIC EFI_STATUS ClockGetVersion(IN SCMI_CLOCK_PROTOCOL *This, OUT UINT32 *Version)
{ return ScmiGetProtocolVersion (ScmiProtocolIdClock, Version); }
tianocore/edk2
C++
Other
4,240
/* Returns zero if a value is available, non-zero otherwise. */
int smack_to_cipso(const char *smack, struct smack_cipso *cp)
/* Returns zero if a value is available, non-zero otherwise. */ int smack_to_cipso(const char *smack, struct smack_cipso *cp)
{ struct smack_known *kp; int found = 0; rcu_read_lock(); list_for_each_entry_rcu(kp, &smack_known_list, list) { if (kp->smk_known == smack || strcmp(kp->smk_known, smack) == 0) { found = 1; break; } } rcu_read_unlock(); if (found == 0 || kp->smk_cipso == NULL) return -ENOENT; memcpy(cp, kp->s...
EmcraftSystems/linux-emcraft
C++
Other
266
/* NOTE: Use put_device() to give up your reference instead of freeing @dev directly once you have called this function. */
void device_initialize(struct device *dev)
/* NOTE: Use put_device() to give up your reference instead of freeing @dev directly once you have called this function. */ void device_initialize(struct device *dev)
{ dev->kobj.kset = devices_kset; kobject_init(&dev->kobj, &device_ktype); INIT_LIST_HEAD(&dev->dma_pools); init_MUTEX(&dev->sem); spin_lock_init(&dev->devres_lock); INIT_LIST_HEAD(&dev->devres_head); device_init_wakeup(dev, 0); device_pm_init(dev); set_dev_node(dev, -1); }
robutest/uclinux
C++
GPL-2.0
60
/* This service is a wrapper for the PEI Service FfsGetFileInfo2(), except the pointer to the PEI Services Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface Specification for details. */
EFI_STATUS EFIAPI PeiServicesFfsGetFileInfo2(IN CONST EFI_PEI_FILE_HANDLE FileHandle, OUT EFI_FV_FILE_INFO2 *FileInfo)
/* This service is a wrapper for the PEI Service FfsGetFileInfo2(), except the pointer to the PEI Services Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface Specification for details. */ EFI_STATUS EFIAPI PeiServicesFfsGetFileInfo2(IN CONST EFI_PEI_FILE_HANDLE FileHandle, OUT...
{ return (*GetPeiServicesTablePointer ())->FfsGetFileInfo2 (FileHandle, FileInfo); }
tianocore/edk2
C++
Other
4,240
/* Initializes MCU, drivers and middleware in the project */
void atmel_start_init(void)
/* Initializes MCU, drivers and middleware in the project */ void atmel_start_init(void)
{ system_init(); usb_init(); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base FlexIO I2S base pointer. param bitWidth How many bits in a audio word, usually /32 bits. param txData Pointer to the data to be written. param size Bytes to be written. */
void FLEXIO_I2S_WriteBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *txData, size_t size)
/* param base FlexIO I2S base pointer. param bitWidth How many bits in a audio word, usually /32 bits. param txData Pointer to the data to be written. param size Bytes to be written. */ void FLEXIO_I2S_WriteBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *txData, size_t size)
{ uint32_t i = 0; uint8_t bytesPerWord = bitWidth / 8U; for (i = 0; i < size / bytesPerWord; i++) { while ((FLEXIO_I2S_GetStatusFlags(base) & kFLEXIO_I2S_TxDataRegEmptyFlag) == 0) { } FLEXIO_I2S_WriteNonBlocking(base, bitWidth, txData, bytesPerWord); txData += byt...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Task function for blinking the LED as a fixed timer interval. */
void LedBlinkTask(void)
/* Task function for blinking the LED as a fixed timer interval. */ void LedBlinkTask(void)
{ static blt_bool ledOn = BLT_FALSE; static blt_int32u nextBlinkEvent = 0; if (TimerGet() >= nextBlinkEvent) { if (ledOn == BLT_FALSE) { ledOn = BLT_TRUE; PTP_PTP6 = 0; } else { ledOn = BLT_FALSE; PTP_PTP6 = 1; } nextBlinkEvent = TimerGet() + ledBlinkIntervalM...
feaser/openblt
C++
GNU General Public License v3.0
601
/* Compare the Unicode and Ascii string pointed by String to the string pointed by String2. */
INTN EFIAPI StrCmpUnicodeAndAscii(IN CHAR16 *String, IN CHAR8 *String2)
/* Compare the Unicode and Ascii string pointed by String to the string pointed by String2. */ INTN EFIAPI StrCmpUnicodeAndAscii(IN CHAR16 *String, IN CHAR8 *String2)
{ while (*String != '\0') { if (*String != (CHAR16)*String2) { break; } String += 1; String2 += 1; } return (*String - (CHAR16)*String2); }
tianocore/edk2
C++
Other
4,240
/* Free lport service tag. This can be called anytime after an alloc. No need to wait for any pending login/logout completions. */
void bfa_lps_delete(struct bfa_lps_s *lps)
/* Free lport service tag. This can be called anytime after an alloc. No need to wait for any pending login/logout completions. */ void bfa_lps_delete(struct bfa_lps_s *lps)
{ bfa_sm_send_event(lps, BFA_LPS_SM_DELETE); }
robutest/uclinux
C++
GPL-2.0
60
/* Update the RATMASK setting of the flash buffer. */
static int32_t cn0503_flash_write_ratmask(struct cn0503_dev *dev, uint8_t *arg, uint8_t *buff)
/* Update the RATMASK setting of the flash buffer. */ static int32_t cn0503_flash_write_ratmask(struct cn0503_dev *dev, uint8_t *arg, uint8_t *buff)
{ uint8_t *error, check_val; check_val = strtol((char *)arg, (char **)&error, 16); if(error == arg) return FAILURE; sprintf((char *)buff, "%x", check_val); dev->sw_flash_buffer[CN0503_FLASH_RATM_IDX] = check_val; return SUCCESS; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* this function is useful to check whether the application is being asked to halt by the shell. */
BOOLEAN EFIAPI ShellGetExecutionBreakFlag(VOID)
/* this function is useful to check whether the application is being asked to halt by the shell. */ BOOLEAN EFIAPI ShellGetExecutionBreakFlag(VOID)
{ if (gEfiShellProtocol != NULL) { if (gBS->CheckEvent (gEfiShellProtocol->ExecutionBreak) != EFI_SUCCESS) { return (FALSE); } return (TRUE); } if (mEfiShellEnvironment2 != NULL) { return (mEfiShellEnvironment2->GetExecutionBreak ()); } return (FALSE); }
tianocore/edk2
C++
Other
4,240
/* This function will correctly stack and unstack nested scripts. */
SCRIPT_FILE* EFIAPI ShellCommandSetNewScript(IN SCRIPT_FILE *Script OPTIONAL)
/* This function will correctly stack and unstack nested scripts. */ SCRIPT_FILE* EFIAPI ShellCommandSetNewScript(IN SCRIPT_FILE *Script OPTIONAL)
{ SCRIPT_FILE_LIST *Node; if (Script == NULL) { if (IsListEmpty (&mScriptList.Link)) { return (NULL); } Node = (SCRIPT_FILE_LIST *)GetFirstNode (&mScriptList.Link); RemoveEntryList (&Node->Link); DeleteScriptFileStruct (Node->Data); FreePool (Node); } else { Node = AllocateZeroP...
tianocore/edk2
C++
Other
4,240
/* Perform INTx swizzling for a device behind one level of bridge. This is required by section 9.1 of the PCI-to-PCI bridge specification for devices behind bridges on add-in cards. For devices with ARI enabled, the slot number is always 0 (see the Implementation Note in section 2.2.8.1 of the PCI Express Base Specific...
u8 pci_swizzle_interrupt_pin(struct pci_dev *dev, u8 pin)
/* Perform INTx swizzling for a device behind one level of bridge. This is required by section 9.1 of the PCI-to-PCI bridge specification for devices behind bridges on add-in cards. For devices with ARI enabled, the slot number is always 0 (see the Implementation Note in section 2.2.8.1 of the PCI Express Base Specific...
{ int slot; if (pci_ari_enabled(dev->bus)) slot = 0; else slot = PCI_SLOT(dev->devfn); return (((pin - 1) + slot) % 4) + 1; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is a hook for Spi to disable BIOS Write Protect. */
EFI_STATUS EFIAPI DisableBiosWriteProtect(IN UINTN PchSpiBase, IN UINT8 CpuSmmBwp)
/* This function is a hook for Spi to disable BIOS Write Protect. */ EFI_STATUS EFIAPI DisableBiosWriteProtect(IN UINTN PchSpiBase, IN UINT8 CpuSmmBwp)
{ MmioOr8 (PchSpiBase + R_SPI_BCR + 1, (B_SPI_BCR_SYNC_SS >> 8)); MmioOr8 (PchSpiBase + R_SPI_BCR, B_SPI_BCR_BIOSWE); if (CpuSmmBwp != 0) { CpuSmmDisableBiosWriteProtect (TRUE); } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Enables or disables the EOC on each regular channel conversion. */
void ADC_EOCOnEachRegularChannelCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
/* Enables or disables the EOC on each regular channel conversion. */ void ADC_EOCOnEachRegularChannelCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { ADCx->CR2 |= ADC_CR2_EOCS; } else { ADCx->CR2 &= (uint32_t)~ADC_CR2_EOCS; } }
avem-labs/Avem
C++
MIT License
1,752
/* Get the element's address when read receive fifo 1. */
static uint32_t MCAN_GetRxFifo1ElementAddress(CAN_Type *base)
/* Get the element's address when read receive fifo 1. */ static uint32_t MCAN_GetRxFifo1ElementAddress(CAN_Type *base)
{ uint32_t eSize; eSize = (base->RXESC & CAN_RXESC_F1DS_MASK) >> CAN_RXESC_F1DS_SHIFT; if (eSize < 5U) { eSize += 4U; } else { eSize = eSize * 4U - 10U; } return (base->RXF1C & CAN_RXF1C_F1SA_MASK) + ((base->RXF1S & CAN_RXF1S_F1GI_MASK) >> CAN_RXF1S_F1GI_SH...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initialize the USB Device IP and the Endpoint 0. */
uint32_t USB_SilInit(void)
/* Initialize the USB Device IP and the Endpoint 0. */ uint32_t USB_SilInit(void)
{ _SetISTR(0); wInterrupt_Mask = IMR_MSK; _SetCNTR(wInterrupt_Mask); return 0; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Error interrupts. These are used extensively by the microengine drivers */
static void ixp2000_err_irq_handler(unsigned int irq, struct irq_desc *desc)
/* Error interrupts. These are used extensively by the microengine drivers */ static void ixp2000_err_irq_handler(unsigned int irq, struct irq_desc *desc)
{ int i; unsigned long status = *IXP2000_IRQ_ERR_STATUS; for(i = 31; i >= 0; i--) { if(status & (1 << i)) { generic_handle_irq(IRQ_IXP2000_DRAM0_MIN_ERR + i); } } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Tries to receive a character. If a character is unavailable the function returns -1. */
static int ug_raw_getc(void)
/* Tries to receive a character. If a character is unavailable the function returns -1. */ static int ug_raw_getc(void)
{ u32 data = ug_io_transaction(0xa0000000); if (data & 0x08000000) return (data >> 16) & 0xff; else return -1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Invoked by the network core when it requests for new packets from the driver */
static int ks8695_poll(struct napi_struct *napi, int budget)
/* Invoked by the network core when it requests for new packets from the driver */ static int ks8695_poll(struct napi_struct *napi, int budget)
{ struct ks8695_priv *ksp = container_of(napi, struct ks8695_priv, napi); unsigned long work_done; unsigned long isr = readl(KS8695_IRQ_VA + KS8695_INTEN); unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp); work_done = ks8695_rx(ksp, budget); if (work_done < budget) { unsigned long flags; spin_lock...
robutest/uclinux
C++
GPL-2.0
60
/* @wm8400: Pointer to wm8400 control structure @reg: Register to access @mask: Mask of bits to change @val: Value to set for masked bits */
int wm8400_set_bits(struct wm8400 *wm8400, u8 reg, u16 mask, u16 val)
/* @wm8400: Pointer to wm8400 control structure @reg: Register to access @mask: Mask of bits to change @val: Value to set for masked bits */ int wm8400_set_bits(struct wm8400 *wm8400, u8 reg, u16 mask, u16 val)
{ u16 tmp; int ret; mutex_lock(&wm8400->io_lock); ret = wm8400_read(wm8400, reg, 1, &tmp); tmp = (tmp & ~mask) | val; if (ret == 0) ret = wm8400_write(wm8400, reg, 1, &tmp); mutex_unlock(&wm8400->io_lock); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Driver to produce microcode measurement. Which install a callback function on ready to boot event. */
EFI_STATUS EFIAPI MicrocodeMeasurementDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* Driver to produce microcode measurement. Which install a callback function on ready to boot event. */ EFI_STATUS EFIAPI MicrocodeMeasurementDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_EVENT Event; EfiCreateEventReadyToBootEx ( TPL_CALLBACK, MeasureMicrocodePatches, NULL, &Event ); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Decrement the critical nesting count, and if it has reached zero, re-enable interrupts. */
void vPortExitCritical(void)
/* Decrement the critical nesting count, and if it has reached zero, re-enable interrupts. */ void vPortExitCritical(void)
{ if( ulCriticalNesting > 0 ) { ulCriticalNesting--; if( ulCriticalNesting == 0 ) { portENABLE_INTERRUPTS(); } } }
labapart/polymcu
C++
null
201
/* This API is used to get Slow Offset Threshold status in the register 0x31 bit 6 and 7. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_slow_offset_thres(u8 *v_offset_thres_u8)
/* This API is used to get Slow Offset Threshold status in the register 0x31 bit 6 and 7. */ BMG160_RETURN_FUNCTION_TYPE bmg160_get_slow_offset_thres(u8 *v_offset_thres_u8)
{ BMG160_RETURN_FUNCTION_TYPE comres = ERROR; u8 v_data_u8 = BMG160_INIT_VALUE; if (p_bmg160 == BMG160_NULL) { return E_BMG160_NULL_PTR; } else { comres = p_bmg160->BMG160_BUS_READ_FUNC(p_bmg160->dev_addr, BMG160_SLOW_OFFSET_T...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Called on completion of any requests the driver itself submitted for EP0 setup packets */
static void s3c_hsotg_complete_setup(struct usb_ep *ep, struct usb_request *req)
/* Called on completion of any requests the driver itself submitted for EP0 setup packets */ static void s3c_hsotg_complete_setup(struct usb_ep *ep, struct usb_request *req)
{ struct s3c_hsotg_ep *hs_ep = our_ep(ep); struct s3c_hsotg *hsotg = hs_ep->parent; if (req->status < 0) { dev_dbg(hsotg->dev, "%s: failed %d\n", __func__, req->status); return; } if (req->actual == 0) s3c_hsotg_enqueue_setup(hsotg); else s3c_hsotg_process_control(hsotg, req->buf); }
robutest/uclinux
C++
GPL-2.0
60
/* enable_NMI_through_LVT0 - enable NMI through local vector table 0 */
void __cpuinit enable_NMI_through_LVT0(void)
/* enable_NMI_through_LVT0 - enable NMI through local vector table 0 */ void __cpuinit enable_NMI_through_LVT0(void)
{ unsigned int v; v = APIC_DM_NMI; if (!lapic_is_integrated()) v |= APIC_LVT_LEVEL_TRIGGER; apic_write(APIC_LVT0, v); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This file is part of the Simba project. */
static ssize_t test_vprintf_wrapper(far_string_t fmt_p,...)
/* This file is part of the Simba project. */ static ssize_t test_vprintf_wrapper(far_string_t fmt_p,...)
{ ssize_t res; va_list ap; va_start(ap, fmt_p); res = std_vprintf(fmt_p, &ap); va_end(ap); return (res); }
eerimoq/simba
C++
Other
337
/* param base SAI base pointer param order Data order MSB or LSB */
void SAI_TxSetDataOrder(I2S_Type *base, sai_data_order_t order)
/* param base SAI base pointer param order Data order MSB or LSB */ void SAI_TxSetDataOrder(I2S_Type *base, sai_data_order_t order)
{ uint32_t val = (base->TCR4) & (~I2S_TCR4_MF_MASK); val |= I2S_TCR4_MF(order); base->TCR4 = val; }
eclipse-threadx/getting-started
C++
Other
310
/* An encoding of midnight at the end of the day as 24:00:00 - ie. midnight tomorrow - (allowable under ISO 8601) is supported. */
time64_t mktime64(const unsigned int year0, const unsigned int mon0, const unsigned int day, const unsigned int hour, const unsigned int min, const unsigned int sec)
/* An encoding of midnight at the end of the day as 24:00:00 - ie. midnight tomorrow - (allowable under ISO 8601) is supported. */ time64_t mktime64(const unsigned int year0, const unsigned int mon0, const unsigned int day, const unsigned int hour, const unsigned int min, const unsigned int sec)
{ unsigned int mon = mon0, year = year0; time64_t diff; if (0 >= (int)(mon -= 2)) { mon += 12; year -= 1; } return ((((time64_t) (year / 4 - year / 100 + year / 400 + 367 * mon / 12 + day) + year * 365 - 719499 ) * 24 + hour ) ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* 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(); PostInit(); while (1) { BootTask(); } return 0; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Set the second level IRQ handler, allow user to overwrite the default second level weak IRQ handler. */
void ENET_QOS_SetISRHandler(ENET_QOS_Type *base, enet_qos_isr_t ISRHandler)
/* Set the second level IRQ handler, allow user to overwrite the default second level weak IRQ handler. */ void ENET_QOS_SetISRHandler(ENET_QOS_Type *base, enet_qos_isr_t ISRHandler)
{ s_enetqosIsr = ISRHandler; (void)EnableIRQ(s_enetqosIrqId[ENET_QOS_GetInstance(base)]); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set a new ErrorString in published HSTI table. This API will update the HSTI table with indicated Role and ImplementationID, NULL ImplementationID means to find the first HSTI table with indicated Role. */
EFI_STATUS EFIAPI HstiLibSetErrorString(IN UINT32 Role, IN CHAR16 *ImplementationID OPTIONAL, IN CHAR16 *ErrorString)
/* Set a new ErrorString in published HSTI table. This API will update the HSTI table with indicated Role and ImplementationID, NULL ImplementationID means to find the first HSTI table with indicated Role. */ EFI_STATUS EFIAPI HstiLibSetErrorString(IN UINT32 Role, IN CHAR16 *ImplementationID OPTIONAL, IN CHAR16 *ErrorS...
{ return InternalHstiRecordErrorString ( Role, ImplementationID, ErrorString, FALSE ); }
tianocore/edk2
C++
Other
4,240
/* The DSP channel can be used either for input or output. Variable 'sb_irq_mode' will be set when the program calls read or write first time after open. Current version doesn't support mode changes without closing and reopening the device. Support for this feature may be implemented in a future version of this driver....
static int v_midi_open(int dev, int mode, void(*input)(int dev, unsigned char data), void(*output)(int dev))
/* The DSP channel can be used either for input or output. Variable 'sb_irq_mode' will be set when the program calls read or write first time after open. Current version doesn't support mode changes without closing and reopening the device. Support for this feature may be implemented in a future version of this driver....
{ vmidi_devc *devc = midi_devs[dev]->devc; unsigned long flags; if (devc == NULL) return -(ENXIO); spin_lock_irqsave(&devc->lock,flags); if (devc->opened) { spin_unlock_irqrestore(&devc->lock,flags); return -(EBUSY); } devc->opened = 1; spin_unlock_irqrestore(&devc->lock,flags); devc->intr_active = 1; ...
robutest/uclinux
C++
GPL-2.0
60
/* window is a user-supplied window and output buffer that is 64K bytes. */
int ZEXPORT inflateBack9Init_(z_stream FAR *strm, unsigned char FAR *window, const char *version, int stream_size)
/* window is a user-supplied window and output buffer that is 64K bytes. */ int ZEXPORT inflateBack9Init_(z_stream FAR *strm, unsigned char FAR *window, const char *version, int stream_size)
{ struct inflate_state FAR *state; if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || stream_size != (int)(sizeof(z_stream))) return Z_VERSION_ERROR; if (strm == Z_NULL || window == Z_NULL) return Z_STREAM_ERROR; strm->msg = Z_NULL; if (strm->zalloc == (alloc_func)0) {...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Called from the timer interrupt handler to charge one tick to the current process. user_tick is 1 if the tick is user time, 0 for system. */
void update_process_times(int user_tick)
/* Called from the timer interrupt handler to charge one tick to the current process. user_tick is 1 if the tick is user time, 0 for system. */ void update_process_times(int user_tick)
{ struct task_struct *p = current; int cpu = smp_processor_id(); account_process_tick(p, user_tick); run_local_timers(); rcu_check_callbacks(cpu, user_tick); printk_tick(); perf_event_do_pending(); scheduler_tick(); run_posix_cpu_timers(p); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */
SWIGRUNTIME const char* SWIG_TypePrettyName(const swig_type_info *type)
/* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char* SWIG_TypePrettyName(const swig_type_info *type)
{ const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Queue up a lock for blocking so that the GRANTED request can see it */
struct nlm_wait* nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl)
/* Queue up a lock for blocking so that the GRANTED request can see it */ struct nlm_wait* nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl)
{ struct nlm_wait *block; block = kmalloc(sizeof(*block), GFP_KERNEL); if (block != NULL) { block->b_host = host; block->b_lock = fl; init_waitqueue_head(&block->b_wait); block->b_status = nlm_lck_blocked; list_add(&block->b_list, &nlm_blocked); } return block; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is intended to be called from the dev->set_rx_mode function of layered software devices. */
int dev_unicast_sync(struct net_device *to, struct net_device *from)
/* This function is intended to be called from the dev->set_rx_mode function of layered software devices. */ int dev_unicast_sync(struct net_device *to, struct net_device *from)
{ int err = 0; if (to->addr_len != from->addr_len) return -EINVAL; netif_addr_lock_bh(to); err = __hw_addr_sync(&to->uc, &from->uc, to->addr_len); if (!err) __dev_set_rx_mode(to); netif_addr_unlock_bh(to); return err; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* IA64_IPI_DM_INT - pend an interrupt IA64_IPI_DM_PMI - pend a PMI IA64_IPI_DM_NMI - pend an NMI IA64_IPI_DM_INIT - pend an INIT interrupt */
void sn2_send_IPI(int cpuid, int vector, int delivery_mode, int redirect)
/* IA64_IPI_DM_INT - pend an interrupt IA64_IPI_DM_PMI - pend a PMI IA64_IPI_DM_NMI - pend an NMI IA64_IPI_DM_INIT - pend an INIT interrupt */ void sn2_send_IPI(int cpuid, int vector, int delivery_mode, int redirect)
{ long physid; int nasid; physid = cpu_physical_id(cpuid); nasid = cpuid_to_nasid(cpuid); if (unlikely(nasid == -1)) ia64_sn_get_sapic_info(physid, &nasid, NULL, NULL); sn_send_IPI_phys(nasid, physid, vector, delivery_mode); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* dasd_restore_device will schedule a call do do_restore_device to the kernel event daemon. */
static void do_restore_device(struct work_struct *)
/* dasd_restore_device will schedule a call do do_restore_device to the kernel event daemon. */ static void do_restore_device(struct work_struct *)
{ struct dasd_device *device = container_of(work, struct dasd_device, restore_device); device->cdev->drv->restore(device->cdev); dasd_put_device(device); }
robutest/uclinux
C++
GPL-2.0
60
/* Wait until gpio_get_value(gpio) returns the requested value or until we time out. The timeout value is expressed in microseconds. */
int gpio_wait_level_timeout(unsigned gpio, int value, int timeout)
/* Wait until gpio_get_value(gpio) returns the requested value or until we time out. The timeout value is expressed in microseconds. */ int gpio_wait_level_timeout(unsigned gpio, int value, int timeout)
{ while (timeout-- > 0) { if (gpio_get_value(gpio) == value) { timeout = 1; break; } udelay(1); } return timeout > 0 ? 0 : -ETIMEDOUT; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
{ if(huart->Instance==USART3) { __HAL_RCC_USART3_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOD, GPIO_PIN_8|GPIO_PIN_9); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Notifies the USB resume bus events to the device stack */
sl_status_t sli_usbd_core_resume_event(void)
/* Notifies the USB resume bus events to the device stack */ sl_status_t sli_usbd_core_resume_event(void)
{ usbd_core_set_event(SLI_USBD_EVENT_BUS_RESUME); return SL_STATUS_OK; }
nanoframework/nf-interpreter
C++
MIT License
293
/* UI handle function when user select a network to connect. */
EFI_STATUS WifiMgrUserSelectProfileToConnect(IN WIFI_MGR_PRIVATE_DATA *Private, IN UINT32 ProfileIndex)
/* UI handle function when user select a network to connect. */ EFI_STATUS WifiMgrUserSelectProfileToConnect(IN WIFI_MGR_PRIVATE_DATA *Private, IN UINT32 ProfileIndex)
{ WIFI_MGR_NETWORK_PROFILE *Profile; WIFI_MGR_DEVICE_DATA *Nic; Nic = Private->CurrentNic; if (Nic == NULL) { return EFI_INVALID_PARAMETER; } WifiMgrCleanUserInput (Private); Profile = WifiMgrGetProfileByProfileIndex (ProfileIndex, &Nic->ProfileList); if (Profile == NULL) { return EFI_NOT_...
tianocore/edk2
C++
Other
4,240
/* Split a page label into a text prefix and numeric suffix. Leading '0's are included in the prefix. eg "3" => NULL, 3 "cover" => "cover", 0 "A-2" => "A-", 2 "A-002" => "A-00", 2 */
static char* split_label(const char *label, int *num)
/* Split a page label into a text prefix and numeric suffix. Leading '0's are included in the prefix. eg "3" => NULL, 3 "cover" => "cover", 0 "A-2" => "A-", 2 "A-002" => "A-00", 2 */ static char* split_label(const char *label, int *num)
{ int len, i; *num = 0; len = strlen (label); if (len == 0) return NULL; i = len; while (i > 0 && _cairo_isdigit (label[i-1])) i--; while (i < len && label[i] == '0') i++; if (i < len) sscanf (label + i, "%d", num); if (i > 0) { char *s; s = _cairo_malloc (i + 1); if (!s) ...
xboot/xboot
C++
MIT License
779
/* Returns: 0 on success, negative error value on failure. */
static int eeprom_layout_update_field(struct eeprom_layout *layout, char *field_name, char *new_data)
/* Returns: 0 on success, negative error value on failure. */ static int eeprom_layout_update_field(struct eeprom_layout *layout, char *field_name, char *new_data)
{ int i, err; struct eeprom_field *fields = layout->fields; if (new_data == NULL) return 0; if (field_name == NULL) return -1; for (i = 0; i < layout->num_of_fields; i++) { if (fields[i].name == RESERVED_FIELDS || strcmp(fields[i].name, field_name)) continue; err = fields[i].update(&fields[i], new...
4ms/stm32mp1-baremetal
C++
Other
137
/* Initialize vector_irq on a new cpu. This function must be called with vector_lock held. */
void __setup_vector_irq(int cpu)
/* Initialize vector_irq on a new cpu. This function must be called with vector_lock held. */ void __setup_vector_irq(int cpu)
{ int irq, vector; for (vector = 0; vector < IA64_NUM_VECTORS; ++vector) per_cpu(vector_irq, cpu)[vector] = -1; for (irq = 0; irq < NR_IRQS; ++irq) { if (!cpu_isset(cpu, irq_cfg[irq].domain)) continue; vector = irq_to_vector(irq); per_cpu(vector_irq, cpu)[vector] = irq; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Select an interface to send the packet generated in the IP6 driver itself: that is, not by the requests of the IP6 child's consumer. Such packets include the ICMPv6 echo replies and other ICMPv6 error packets. */
IP6_INTERFACE* Ip6SelectInterface(IN IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *Destination, IN OUT EFI_IPv6_ADDRESS *Source)
/* Select an interface to send the packet generated in the IP6 driver itself: that is, not by the requests of the IP6 child's consumer. Such packets include the ICMPv6 echo replies and other ICMPv6 error packets. */ IP6_INTERFACE* Ip6SelectInterface(IN IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *Destination, IN OUT EFI_IPv...
{ EFI_STATUS Status; EFI_IPv6_ADDRESS SelectedSource; IP6_INTERFACE *IpIf; BOOLEAN Exist; NET_CHECK_SIGNATURE (IpSb, IP6_SERVICE_SIGNATURE); ASSERT (Destination != NULL && Source != NULL); if (NetIp6IsUnspecifiedAddr (Destination)) { return NULL; } if (!NetIp6IsUnspecifiedAdd...
tianocore/edk2
C++
Other
4,240
/* Initializes the LCD registers to their default reset values. */
void LCD_DeInit(void)
/* Initializes the LCD registers to their default reset values. */ void LCD_DeInit(void)
{ LCD->CTRL &= ~LCD_CTRL_EN; LCD->CTRL = LCD_CTRL_RSTValue; LCD->CTRL2 = LCD_CTRL2_RSTValue; LCD->SEGCTRL0 = LCD_SEGCTRL0_RSTValue; LCD->SEGCTRL1 = LCD_SEGCTRL1_RSTValue; LCD->SEGCTRL2 = LCD_SEGCTRL2_RSTValue; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* pm8001_task_prep_ata - the dispatcher function, prepare data for sata task @pm8001_ha: our hba card information @ccb: the ccb which attached to sata task */
static int pm8001_task_prep_ata(struct pm8001_hba_info *pm8001_ha, struct pm8001_ccb_info *ccb)
/* pm8001_task_prep_ata - the dispatcher function, prepare data for sata task @pm8001_ha: our hba card information @ccb: the ccb which attached to sata task */ static int pm8001_task_prep_ata(struct pm8001_hba_info *pm8001_ha, struct pm8001_ccb_info *ccb)
{ return PM8001_CHIP_DISP->sata_req(pm8001_ha, ccb); }
robutest/uclinux
C++
GPL-2.0
60
/* Change the mode of the USB controller to OTG. */
void USBOTGMode(unsigned long ulBase)
/* Change the mode of the USB controller to OTG. */ void USBOTGMode(unsigned long ulBase)
{ ASSERT(ulBase == USB0_BASE); HWREGB(ulBase + USB_O_GPCS) = 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function returns the TLS/SSL server random data currently used in the specified TLS connection. */
VOID EFIAPI TlsGetServerRandom(IN VOID *Tls, IN OUT UINT8 *ServerRandom)
/* This function returns the TLS/SSL server random data currently used in the specified TLS connection. */ VOID EFIAPI TlsGetServerRandom(IN VOID *Tls, IN OUT UINT8 *ServerRandom)
{ CALL_VOID_CRYPTO_SERVICE (TlsGetServerRandom, (Tls, ServerRandom)); }
tianocore/edk2
C++
Other
4,240
/* leave DFU mode and reset device to jump to user loaded code */
static void dfu_mode_leave(usb_dev *udev)
/* leave DFU mode and reset device to jump to user loaded code */ static void dfu_mode_leave(usb_dev *udev)
{ usbd_dfu_handler *dfu = (usbd_dfu_handler *)udev->dev.class_data[USBD_DFU_INTERFACE]; dfu->manifest_state = MANIFEST_COMPLETE; if (dfu_config_desc.dfu_func.bmAttributes & 0x04U) { dfu->bState = STATE_DFU_MANIFEST_SYNC; } else { dfu->bState = STATE_DFU_MANIFEST_WAIT_RESET; dfu_m...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Auto connect to recently used remote bluetooth device. */
tBtResult BTAutoConnect()
/* Auto connect to recently used remote bluetooth device. */ tBtResult BTAutoConnect()
{ char cDevAddrArray[TEL0026_MAX_SCAN_DEVICES*15]={""}; unsigned char ucDevCnt = 0; unsigned char i; unsigned char ucRes; ucDevCnt = BTScanRemoteDevice(1, 12, 16, cDevAddrArray); for(i=0; i<ucDevCnt*15; i+=15) { BTAddrConv(&cDevAddrArray[i]); ucRes = BTLocateAuthDevice(&cDevAddrArray[i]); if(ucRes == BT_ER...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Set the media capability of network adapter according to mii status register. It's necessary before auto-negotiate. */
static void sis900_set_capability(struct net_device *net_dev, struct mii_phy *phy)
/* Set the media capability of network adapter according to mii status register. It's necessary before auto-negotiate. */ static void sis900_set_capability(struct net_device *net_dev, struct mii_phy *phy)
{ u16 cap; u16 status; status = mdio_read(net_dev, phy->phy_addr, MII_STATUS); status = mdio_read(net_dev, phy->phy_addr, MII_STATUS); cap = MII_NWAY_CSMA_CD | ((phy->status & MII_STAT_CAN_TX_FDX)? MII_NWAY_TX_FDX:0) | ((phy->status & MII_STAT_CAN_TX) ? MII_NWAY_TX:0) | ((phy->status & MII_STAT_CAN_T_FDX)...
robutest/uclinux
C++
GPL-2.0
60
/* Returns the clock source which is used as system clock. */
RCM_SYSCLK_SEL_T RCM_ReadSYSCLKSource(void)
/* Returns the clock source which is used as system clock. */ RCM_SYSCLK_SEL_T RCM_ReadSYSCLKSource(void)
{ return (RCM_SYSCLK_SEL_T)RCM->CFG_B.SCLKSWSTS; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function for data erase state entry action. Function for data erase state entry action, which includes erasing the data flash page. */
static void state_data_erase_entry_run(void)
/* Function for data erase state entry action. Function for data erase state entry action, which includes erasing the data flash page. */ static void state_data_erase_entry_run(void)
{ flash_page_erase(m_current_page_id); }
labapart/polymcu
C++
null
201
/* Unregisters an interrupt handler for the LPC module. */
void LPCIntUnregister(unsigned long ulBase)
/* Unregisters an interrupt handler for the LPC module. */ void LPCIntUnregister(unsigned long ulBase)
{ ASSERT(ulBase == LPC0_BASE); IntDisable(INT_LPC0); IntUnregister(INT_LPC0); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Finds the MMI entry for the requested handler type. */
MMI_ENTRY* EFIAPI MmCoreFindMmiEntry(IN EFI_GUID *HandlerType, IN BOOLEAN Create)
/* Finds the MMI entry for the requested handler type. */ MMI_ENTRY* EFIAPI MmCoreFindMmiEntry(IN EFI_GUID *HandlerType, IN BOOLEAN Create)
{ LIST_ENTRY *Link; MMI_ENTRY *Item; MMI_ENTRY *MmiEntry; MmiEntry = NULL; for (Link = mMmiEntryList.ForwardLink; Link != &mMmiEntryList; Link = Link->ForwardLink) { Item = CR (Link, MMI_ENTRY, AllEntries, MMI_ENTRY_SIGNATURE); if (CompareGuid (&Item->HandlerType, HandlerType)) { ...
tianocore/edk2
C++
Other
4,240
/* Scan the tag table for this tag, and call its parse function. The tag table is built by the linker from all the __tagtable declarations. */
static int __init parse_tag(struct tag *tag)
/* Scan the tag table for this tag, and call its parse function. The tag table is built by the linker from all the __tagtable declarations. */ static int __init parse_tag(struct tag *tag)
{ extern struct tagtable __tagtable_begin, __tagtable_end; struct tagtable *t; for (t = &__tagtable_begin; t < &__tagtable_end; t++) if (tag->hdr.tag == t->tag) { t->parse(tag); break; } return t < &__tagtable_end; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return codes: int - number of scsi buffers that were allocated. 0 = failure, less than num_to_alloc is a partial failure. */
static int lpfc_new_scsi_buf(struct lpfc_vport *vport, int num_to_alloc)
/* Return codes: int - number of scsi buffers that were allocated. 0 = failure, less than num_to_alloc is a partial failure. */ static int lpfc_new_scsi_buf(struct lpfc_vport *vport, int num_to_alloc)
{ return vport->phba->lpfc_new_scsi_buf(vport, num_to_alloc); }
robutest/uclinux
C++
GPL-2.0
60
/* Find an interface that Ip is on that connected network. */
IP4_INTERFACE* Ip4FindNet(IN IP4_SERVICE *IpSb, IN IP4_ADDR Ip)
/* Find an interface that Ip is on that connected network. */ IP4_INTERFACE* Ip4FindNet(IN IP4_SERVICE *IpSb, IN IP4_ADDR Ip)
{ LIST_ENTRY *Entry; IP4_INTERFACE *IpIf; NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) { IpIf = NET_LIST_USER_STRUCT (Entry, IP4_INTERFACE, Link); if (IpIf->Configured && IP4_NET_EQUAL (Ip, IpIf->Ip, IpIf->SubnetMask)) { return IpIf; } } return NULL; }
tianocore/edk2
C++
Other
4,240
/* Note that using G_DATA_STREAM_NEWLINE_TYPE_ANY is slightly unsafe. If a read chunk ends in "CR" we must read an additional byte to know if this is "CR" or "CR LF", and this might block if there is no more data available. */
void g_data_input_stream_set_newline_type(GDataInputStream *stream, GDataStreamNewlineType type)
/* Note that using G_DATA_STREAM_NEWLINE_TYPE_ANY is slightly unsafe. If a read chunk ends in "CR" we must read an additional byte to know if this is "CR" or "CR LF", and this might block if there is no more data available. */ void g_data_input_stream_set_newline_type(GDataInputStream *stream, GDataStreamNewlineType t...
{ GDataInputStreamPrivate *priv; g_return_if_fail (G_IS_DATA_INPUT_STREAM (stream)); priv = stream->priv; if (priv->newline_type != type) { priv->newline_type = type; g_object_notify (G_OBJECT (stream), "newline-type"); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Uses USB I/O to check whether the device is a USB mouse device. */
BOOLEAN IsUsbMouse(IN EFI_USB_IO_PROTOCOL *UsbIo)
/* Uses USB I/O to check whether the device is a USB mouse device. */ BOOLEAN IsUsbMouse(IN EFI_USB_IO_PROTOCOL *UsbIo)
{ EFI_STATUS Status; EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor; Status = UsbIo->UsbGetInterfaceDescriptor ( UsbIo, &InterfaceDescriptor ); if (EFI_ERROR (Status)) { return FALSE; } if ((InterfaceDescriptor.InterfaceCl...
tianocore/edk2
C++
Other
4,240
/* Returns CR_OK upon succesful completion, an error code otherwise. */
enum CRStatus cr_parser_get_use_core_grammar(CRParser *a_this, gboolean *a_use_core_grammar)
/* Returns CR_OK upon succesful completion, an error code otherwise. */ enum CRStatus cr_parser_get_use_core_grammar(CRParser *a_this, gboolean *a_use_core_grammar)
{ g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR); *a_use_core_grammar = PRIVATE (a_this)->use_core_grammar; return CR_OK; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Ends ongoing transfer by releasing CS of QSPI peripheral. */
static void qspi_end_transfer(Qspi *qspi)
/* Ends ongoing transfer by releasing CS of QSPI peripheral. */ static void qspi_end_transfer(Qspi *qspi)
{ assert(qspi); while(!(qspi->QSPI_SR & QSPI_SR_TXEMPTY)); qspi->QSPI_CR = QSPI_CR_LASTXFER; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Platform drivers that implement mem suspend only and only need to check for that in their .valid callback can use this instead of rolling their own .valid callback. */
int suspend_valid_only_mem(suspend_state_t state)
/* Platform drivers that implement mem suspend only and only need to check for that in their .valid callback can use this instead of rolling their own .valid callback. */ int suspend_valid_only_mem(suspend_state_t state)
{ return state == PM_SUSPEND_MEM; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Performs a software reset of a peripheral. The */
void xSysCtlPeripheralReset(unsigned long ulPeripheral)
/* Performs a software reset of a peripheral. The */ void xSysCtlPeripheralReset(unsigned long ulPeripheral)
{ xASSERT((ulPeriphClkID == xSYSCTL_PERIPH_RTC) || (ulPeriphClkID == xSYSCTL_PERIPH_SPI0) || (ulPeriphClkID == xSYSCTL_PERIPH_TIMER0) || (ulPeriphClkID == xSYSCTL_PERIPH_TIMER1) || (ulPeriphClkID == xSYSCTL_PERIPH_UART0) || (ulPeriphClkID == xSYSCTL_PERIPH...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Initialize KEYSCAN config structure. Fill each pstcKeyscanInit with default value. */
int32_t KEYSCAN_StructInit(stc_keyscan_init_t *pstcKeyscanInit)
/* Initialize KEYSCAN config structure. Fill each pstcKeyscanInit with default value. */ int32_t KEYSCAN_StructInit(stc_keyscan_init_t *pstcKeyscanInit)
{ int32_t i32Ret = LL_OK; if (NULL == pstcKeyscanInit) { i32Ret = LL_ERR_INVD_PARAM; } else { pstcKeyscanInit->u32HizCycle = KEYSCAN_HIZ_CYCLE_4; pstcKeyscanInit->u32LowCycle = KEYSCAN_LOW_CYCLE_4; pstcKeyscanInit->u32KeyClock = KEYSCAN_CLK_HCLK; pstcKeyscanInit->u32K...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base WUU peripheral base address. param filterIndex A pin filter index, which starts from 1. return True if the flag is a source of the existing low-leakage power mode. */
bool WUU_GetPinFilterFlag(WUU_Type *base, uint8_t filterIndex)
/* param base WUU peripheral base address. param filterIndex A pin filter index, which starts from 1. return True if the flag is a source of the existing low-leakage power mode. */ bool WUU_GetPinFilterFlag(WUU_Type *base, uint8_t filterIndex)
{ bool ret = false; switch (filterIndex) { case 1: ret = ((base->FILT & WUU_FILT_FILTF1_MASK) != 0U); break; case 2: ret = ((base->FILT & WUU_FILT_FILTF2_MASK) != 0U); break; default: ret = false; break; } ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enable the specified ADC regular channel external trigger. */
void ADC_EnableExternalTrigConv(ADC_T *adc)
/* Enable the specified ADC regular channel external trigger. */ void ADC_EnableExternalTrigConv(ADC_T *adc)
{ adc->CTRL2_B.REGEXTTRGEN = BIT_SET; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Return an approximation of the amount of data we've read sequentially from the file so far. (gint64, in case that's 64 bits.) */
gint64 wtap_read_so_far(wtap *wth)
/* Return an approximation of the amount of data we've read sequentially from the file so far. (gint64, in case that's 64 bits.) */ gint64 wtap_read_so_far(wtap *wth)
{ return file_tell_raw(wth->fh); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Function for getting next page number to send. */
static ant_bsc_page_t next_page_number_get(ant_bsc_profile_t *p_profile)
/* Function for getting next page number to send. */ static ant_bsc_page_t next_page_number_get(ant_bsc_profile_t *p_profile)
{ ant_bsc_page_t page_number; if (p_profile->_cb.p_sens_cb->message_counter < (BACKGROUND_DATA_INTERVAL)) { page_number = p_profile->_cb.p_sens_cb->main_page_number; } else { page_number = p_profile->_cb.p_sens_cb->bkgd_page_number; } if ((p_profile->_cb.p_sens_cb->mess...
labapart/polymcu
C++
null
201
/* param base The I3C peripheral base address. param handle Pointer to the I3C slave driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */
void I3C_SlaveTransferCreateHandle(I3C_Type *base, i3c_slave_handle_t *handle, i3c_slave_transfer_callback_t callback, void *userData)
/* param base The I3C peripheral base address. param handle Pointer to the I3C slave driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */ void I3C_SlaveTransferCreateHandle(I3C_Type *base, i3c_slave_handle_t...
{ uint32_t instance; assert(NULL != handle); (void)memset(handle, 0, sizeof(*handle)); instance = I3C_GetInstance(base); handle->callback = callback; handle->userData = userData; s_i3cSlaveHandle[instance] = handle; s_i3cSlaveIsr = I3C_SlaveTransferHandleIRQ; I3C_SlaveDisableInterrup...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If we have specified it via mount option, then use the mount option value. If the value specified at mount time is greater than the blocks per group use the super block value. If the super block value is greater than blocks per group return 0. Allocator needs it be less than blocks per group. */
static unsigned long ext4_get_stripe_size(struct ext4_sb_info *sbi)
/* If we have specified it via mount option, then use the mount option value. If the value specified at mount time is greater than the blocks per group use the super block value. If the super block value is greater than blocks per group return 0. Allocator needs it be less than blocks per group. */ static unsigned lon...
{ unsigned long stride = le16_to_cpu(sbi->s_es->s_raid_stride); unsigned long stripe_width = le32_to_cpu(sbi->s_es->s_raid_stripe_width); if (sbi->s_stripe && sbi->s_stripe <= sbi->s_blocks_per_group) return sbi->s_stripe; if (stripe_width <= sbi->s_blocks_per_group) return stripe_width; if (stride <= sbi->...
robutest/uclinux
C++
GPL-2.0
60
/* Code is almost the same as rv34_inv_transform() but final coefficients are multiplied by 1.5 and have no rounding. */
static void rv34_inv_transform_noround(DCTELEM *block)
/* Code is almost the same as rv34_inv_transform() but final coefficients are multiplied by 1.5 and have no rounding. */ static void rv34_inv_transform_noround(DCTELEM *block)
{ const int z0= 13*(temp[4*0+i] + temp[4*2+i]); const int z1= 13*(temp[4*0+i] - temp[4*2+i]); const int z2= 7* temp[4*1+i] - 17*temp[4*3+i]; const int z3= 17* temp[4*1+i] + 7*temp[4*3+i]; block[i*8+0]= ((z0 + z3)*3)>>11; block[i*8+1]= ((z1 + z2)*3)>>11; bl...
DC-SWAT/DreamShell
C++
null
404
/* This function calculates and returns the number of eraseblocks which should be kept for index usage. */
int ubifs_calc_min_idx_lebs(struct ubifs_info *c)
/* This function calculates and returns the number of eraseblocks which should be kept for index usage. */ int ubifs_calc_min_idx_lebs(struct ubifs_info *c)
{ int idx_lebs, eff_leb_size = c->leb_size - c->max_idx_node_sz; long long idx_size; idx_size = c->old_idx_sz + c->budg_idx_growth + c->budg_uncommitted_idx; idx_size = idx_size + (idx_size << 1); idx_size += eff_leb_size - 1; idx_lebs = div_u64(idx_size, eff_leb_size); idx_lebs += 1; if (idx_lebs < MIN_INDEX_L...
EmcraftSystems/u-boot
C++
Other
181
/* Cleans off leading and trailing spaces and tabs. */
EFI_STATUS TrimSpaces(IN CHAR16 **String)
/* Cleans off leading and trailing spaces and tabs. */ EFI_STATUS TrimSpaces(IN CHAR16 **String)
{ ASSERT (String != NULL); ASSERT (*String != NULL); while (((*String)[0] == L' ') || ((*String)[0] == L'\t')) { CopyMem ((*String), (*String)+1, StrSize ((*String)) - sizeof ((*String)[0])); } while ((StrLen (*String) > 0) && (((*String)[StrLen ((*String))-1] == L' ') || ((*String)[StrLen ((*String))-1] ...
tianocore/edk2
C++
Other
4,240
/* This API reads the down sampling rates which is configured for Accel FIFO data. */
uint16_t bma4_get_fifo_down_accel(uint8_t *fifo_down, struct bma4_dev *dev)
/* This API reads the down sampling rates which is configured for Accel FIFO data. */ uint16_t bma4_get_fifo_down_accel(uint8_t *fifo_down, struct bma4_dev *dev)
{ uint16_t rslt = 0; uint8_t data = 0; if (dev == NULL) { rslt |= BMA4_E_NULL_PTR; } else { rslt |= bma4_read_regs(BMA4_FIFO_DOWN_ADDR, &data, 1, dev); if (rslt == BMA4_OK) *fifo_down = BMA4_GET_BITSLICE(data, BMA4_FIFO_DOWN_ACCEL); } return rslt; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* This function checks VarOffset and VarWidth is in the block range. */
BOOLEAN BlockArrayCheck(IN IFR_BLOCK_DATA *BlockArray, IN UINT16 VarOffset, IN UINT16 VarWidth)
/* This function checks VarOffset and VarWidth is in the block range. */ BOOLEAN BlockArrayCheck(IN IFR_BLOCK_DATA *BlockArray, IN UINT16 VarOffset, IN UINT16 VarWidth)
{ LIST_ENTRY *Link; IFR_BLOCK_DATA *BlockData; if (BlockArray == NULL) { return TRUE; } for (Link = BlockArray->Entry.ForwardLink; Link != &BlockArray->Entry; Link = Link->ForwardLink) { BlockData = BASE_CR (Link, IFR_BLOCK_DATA, Entry); if ((VarOffset >= BlockData->Offset) && ((VarOffset + ...
tianocore/edk2
C++
Other
4,240
/* param base Pointer to FLEXIO_I2C_Type structure param handle Pointer to flexio_i2c_master_handle_t structure which stores the transfer state */
void FLEXIO_I2C_MasterTransferAbort(FLEXIO_I2C_Type *base, flexio_i2c_master_handle_t *handle)
/* param base Pointer to FLEXIO_I2C_Type structure param handle Pointer to flexio_i2c_master_handle_t structure which stores the transfer state */ void FLEXIO_I2C_MasterTransferAbort(FLEXIO_I2C_Type *base, flexio_i2c_master_handle_t *handle)
{ assert(handle); FLEXIO_I2C_MasterDisableInterrupts(base, kFLEXIO_I2C_TxEmptyInterruptEnable | kFLEXIO_I2C_RxFullInterruptEnable); handle->state = kFLEXIO_I2C_Idle; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Configure HSI16 clock division factor to feed SYSCLK. */
void rcc_set_hsisys_div(uint32_t hsidiv)
/* Configure HSI16 clock division factor to feed SYSCLK. */ void rcc_set_hsisys_div(uint32_t hsidiv)
{ uint32_t reg32; reg32 = RCC_CR; reg32 &= ~(RCC_CR_HSIDIV_MASK << RCC_CR_HSIDIV_SHIFT); RCC_CR = (reg32 | (hsidiv << RCC_CR_HSIDIV_SHIFT)); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Slave 0 write operation is performed only at the first sensor hub cycle. This is effective if the Aux_sens_on field in SLAVE0_CONFIG(04h) is set to a value other than 00.. */
int32_t lsm6dsl_sh_write_mode_get(stmdev_ctx_t *ctx, lsm6dsl_write_once_t *val)
/* Slave 0 write operation is performed only at the first sensor hub cycle. This is effective if the Aux_sens_on field in SLAVE0_CONFIG(04h) is set to a value other than 00.. */ int32_t lsm6dsl_sh_write_mode_get(stmdev_ctx_t *ctx, lsm6dsl_write_once_t *val)
{ lsm6dsl_slave1_config_t slave1_config; int32_t ret; ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_BANK_A); if(ret == 0){ ret = lsm6dsl_read_reg(ctx, LSM6DSL_SLAVE1_CONFIG, (uint8_t*)&slave1_config, 1); if(ret == 0){ switch (slave1_config.write_once) { case LSM6DSL_E...
eclipse-threadx/getting-started
C++
Other
310
/* RETURNS: Pointer to the allocated area on success, NULL on failure. */
static void* pcpu_mem_alloc(size_t size)
/* RETURNS: Pointer to the allocated area on success, NULL on failure. */ static void* pcpu_mem_alloc(size_t size)
{ if (size <= PAGE_SIZE) return kzalloc(size, GFP_KERNEL); else { void *ptr = vmalloc(size); if (ptr) memset(ptr, 0, size); return ptr; } }
robutest/uclinux
C++
GPL-2.0
60
/* Enable or disable features/registers based on whether the processor supports them */
static bool mci_has_rwproof(void)
/* Enable or disable features/registers based on whether the processor supports them */ static bool mci_has_rwproof(void)
{ if (cpu_is_at91sam9261() || cpu_is_at91rm9200()) return false; else return true; }
robutest/uclinux
C++
GPL-2.0
60
/* This internal function extracts segment number and bus number data from address, and retrieves the corresponding PCI Root Bridge I/O Protocol instance. */
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL* PciSegmentLibSearchForRootBridge(IN UINT64 Address)
/* This internal function extracts segment number and bus number data from address, and retrieves the corresponding PCI Root Bridge I/O Protocol instance. */ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL* PciSegmentLibSearchForRootBridge(IN UINT64 Address)
{ UINTN Index; UINT64 SegmentNumber; UINT64 BusNumber; for (Index = 0; Index < mNumberOfPciRootBridges; Index++) { SegmentNumber = BitFieldRead64 (Address, 32, 63); if (SegmentNumber == mPciRootBridgeData[Index].SegmentNumber) { BusNumber = BitFieldRead64 (Address, 20, 27); if ((BusNumbe...
tianocore/edk2
C++
Other
4,240
/* Return value: 0 on success / other on failure */
static int cmm_set_disable(const char *val, struct kernel_param *kp)
/* Return value: 0 on success / other on failure */ static int cmm_set_disable(const char *val, struct kernel_param *kp)
{ int disable = simple_strtoul(val, NULL, 10); if (disable != 0 && disable != 1) return -EINVAL; if (disable && !cmm_disabled) { if (cmm_thread_ptr) kthread_stop(cmm_thread_ptr); cmm_thread_ptr = NULL; cmm_free_pages(loaned_pages); } else if (!disable && cmm_disabled) { cmm_thread_ptr = kthread_run(cmm...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Determines the length of the MQTT unsubscribe packet that would be produced using the supplied parameters */
static int unsubscribe_length(int count, mqtt_string_t topicFilters[])
/* Determines the length of the MQTT unsubscribe packet that would be produced using the supplied parameters */ static int unsubscribe_length(int count, mqtt_string_t topicFilters[])
{ int i; int len = 2; for (i = 0; i < count; ++i) len += 2 + mqtt_strlen(topicFilters[i]); return len; }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Wait for and read a character in a blocking call. */
int32_t usr_uart_read_char(struct uart_desc *desc, uint8_t *data)
/* Wait for and read a character in a blocking call. */ int32_t usr_uart_read_char(struct uart_desc *desc, uint8_t *data)
{ const uint32_t buf_size = 1; uint32_t error; return adi_uart_Read((ADI_UART_HANDLE const)h_uart_device, data, buf_size, DMA_NOT_USE, &error); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Remove window from parent's linked list. This function pulls out a window from the parent window's linked list of of child windows. This function is used when rearranging child windows. */
static void win_unlink(struct win_window *win)
/* Remove window from parent's linked list. This function pulls out a window from the parent window's linked list of of child windows. This function is used when rearranging child windows. */ static void win_unlink(struct win_window *win)
{ if (win->next_sibling == win) { win->parent->top_child = NULL; } else { if (win->parent->top_child == win) { win->parent->top_child = win->next_sibling; } win->next_sibling->prev_sibling = win->prev_sibling; win->prev_sibling->next_sibling = win->next_sibling; } win->parent = NULL; win->next_sibling...
memfault/zero-to-main
C++
null
200
/* Note: The background color is controlled by the shell command cls. */
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
/* Note: The background color is controlled by the shell command cls. */ EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
{ VA_LIST Marker; CHAR16 *HiiFormatString; EFI_STATUS RetVal; RetVal = EFI_DEVICE_ERROR; VA_START (Marker, HiiFormatHandle); HiiFormatString = HiiGetString (HiiFormatHandle, HiiFormatStringId, Language); if (HiiFormatString != NULL) { RetVal = InternalShellPrintWorker (Col, Row, HiiFormatStr...
tianocore/edk2
C++
Other
4,240
/* The reserve ratio obviously has absolutely no relation with the minimum watermarks. The lowmem reserve ratio can only make sense if in function of the boot time zone sizes. */
int lowmem_reserve_ratio_sysctl_handler(ctl_table *table, int write, void __user *buffer, size_t *length, loff_t *ppos)
/* The reserve ratio obviously has absolutely no relation with the minimum watermarks. The lowmem reserve ratio can only make sense if in function of the boot time zone sizes. */ int lowmem_reserve_ratio_sysctl_handler(ctl_table *table, int write, void __user *buffer, size_t *length, loff_t *ppos)
{ proc_dointvec_minmax(table, write, buffer, length, ppos); setup_per_zone_lowmem_reserve(); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Return: 0 on success or a negative error code on failure */
int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi)
/* Return: 0 on success or a negative error code on failure */ int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi)
{ ssize_t err; err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_TEAR_OFF, NULL, 0); if (err < 0) return err; return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Reports if the specified button has changed its state. */
bool button_changed(uint8_t pbutton)
/* Reports if the specified button has changed its state. */ bool button_changed(uint8_t pbutton)
{ return ui_button_state_toggle[pButton]; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Configures the TIMx Internal Trigger as External Clock. */
void TIM_ITRxExternalClockConfig(TIM_TypeDef *TIMx, uint16_t TIM_InputTriggerSource)
/* Configures the TIMx Internal Trigger as External Clock. */ void TIM_ITRxExternalClockConfig(TIM_TypeDef *TIMx, uint16_t TIM_InputTriggerSource)
{ assert_param(IS_TIM_LIST6_PERIPH(TIMx)); assert_param(IS_TIM_INTERNAL_TRIGGER_SELECTION(TIM_InputTriggerSource)); TIM_SelectInputTrigger(TIMx, TIM_InputTriggerSource); TIMx->SMCR |= TIM_SlaveMode_External1; }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51