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
/* Enables or Disables the Precharge of Tamper pin. */
void RTC_TamperPullUpCmd(FunctionalState NewState)
/* Enables or Disables the Precharge of Tamper pin. */ void RTC_TamperPullUpCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RTC->TAFCR &= (uint32_t)~RTC_TAFCR_TAMPPUDIS; } else { RTC->TAFCR |= (uint32_t)RTC_TAFCR_TAMPPUDIS; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Provides the controller-specific addresses required to access system memory from a DMA bus master. On SEV guest, the DMA operations must be performed on shared buffer hence we allocate a bounce buffer to map the HostAddress to a DeviceAddress. The Encryption attribute is removed from the DeviceAddress buffer. */
STATIC EFI_STATUS EFIAPI NonCoherentIoMmuMap(IN EDKII_IOMMU_PROTOCOL *This, IN EDKII_IOMMU_OPERATION Operation, IN VOID *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
/* Provides the controller-specific addresses required to access system memory from a DMA bus master. On SEV guest, the DMA operations must be performed on shared buffer hence we allocate a bounce buffer to map the HostAddress to a DeviceAddress. The Encryption attribute is removed from the DeviceAddress buffer. */ STATIC EFI_STATUS EFIAPI NonCoherentIoMmuMap(IN EDKII_IOMMU_PROTOCOL *This, IN EDKII_IOMMU_OPERATION Operation, IN VOID *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
{ DMA_MAP_OPERATION DmaOperation; switch (Operation) { case EdkiiIoMmuOperationBusMasterRead: case EdkiiIoMmuOperationBusMasterRead64: DmaOperation = MapOperationBusMasterRead; break; case EdkiiIoMmuOperationBusMasterWrite: case EdkiiIoMmuOperationBusMasterWrite64: DmaOperation = MapOperationBusMasterWrite; break; case EdkiiIoMmuOperationBusMasterCommonBuffer: case EdkiiIoMmuOperationBusMasterCommonBuffer64: DmaOperation = MapOperationBusMasterCommonBuffer; break; default: ASSERT (FALSE); return EFI_INVALID_PARAMETER; } return DmaMap ( DmaOperation, HostAddress, NumberOfBytes, DeviceAddress, Mapping ); }
tianocore/edk2
C++
Other
4,240
/* Routine: misc_init_r Description: A basic misc_init_r that just displays the die ID */
int __weak misc_init_r(void)
/* Routine: misc_init_r Description: A basic misc_init_r that just displays the die ID */ int __weak misc_init_r(void)
{ omap_die_id_display(); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns the matching connection to a given sid / cid tuple */
static struct iscsi_cls_conn* iscsi_conn_lookup(uint32_t sid, uint32_t cid)
/* Returns the matching connection to a given sid / cid tuple */ static struct iscsi_cls_conn* iscsi_conn_lookup(uint32_t sid, uint32_t cid)
{ unsigned long flags; struct iscsi_cls_conn *conn; spin_lock_irqsave(&connlock, flags); list_for_each_entry(conn, &connlist, conn_list) { if ((conn->cid == cid) && (iscsi_conn_get_sid(conn) == sid)) { spin_unlock_irqrestore(&connlock, flags); return conn; } } spin_unlock_irqrestore(&connlock, flags); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Sends a character to the specified port. This function replaces the original UARTCharNonBlockingPut() API and performs the same actions. A macro is provided in */
xtBoolean UARTCharPutNonBlocking(unsigned long ulBase, unsigned char ulData)
/* Sends a character to the specified port. This function replaces the original UARTCharNonBlockingPut() API and performs the same actions. A macro is provided in */ xtBoolean UARTCharPutNonBlocking(unsigned long ulBase, unsigned char ulData)
{ xtBoolean ulStatus = 0; xtBoolean ulResult = 0; xASSERT((ulBase == UART0_BASE) || (ulBase == UART1_BASE) || (ulBase == UART2_BASE) ); ulStatus = (xtBoolean) xHWREGB(ulBase + UART_012_S1) & UART_012_S1_TDRE_MASK; if(xtrue == ulStatus) { xHWREGB(ulBase + UART_012_D) = ulData; ulResult = xtrue; } else { ulResult = xfalse; } return (ulResult); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Set flash controller owner:I/D AHB or system AHB. */
__WEAK void ATTR_TCM_SECTION bflb_sf_ctrl_set_owner(uint8_t owner)
/* Set flash controller owner:I/D AHB or system AHB. */ __WEAK void ATTR_TCM_SECTION bflb_sf_ctrl_set_owner(uint8_t owner)
{ uint32_t reg_base = 0; uint32_t regval = 0; uint32_t time_out = 0; reg_base = BFLB_SF_CTRL_BASE; time_out = SF_CTRL_BUSY_STATE_TIMEOUT; while (bflb_sf_ctrl_get_busy_state()) { time_out--; if (time_out == 0) { return; } } regval = getreg32(reg_base + SF_CTRL_1_OFFSET); if (owner) { regval |= SF_CTRL_SF_IF_FN_SEL; } else { regval &= ~SF_CTRL_SF_IF_FN_SEL; } if (owner == SF_CTRL_OWNER_IAHB) { regval |= SF_CTRL_SF_AHB2SIF_EN; } else { regval &= ~SF_CTRL_SF_AHB2SIF_EN; } putreg32(regval, reg_base+SF_CTRL_1_OFFSET); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This comparator searches for the next Interface descriptor of the correct HID Class value. */
uint8_t DComp_NextHIDInterface(void *CurrentDescriptor)
/* This comparator searches for the next Interface descriptor of the correct HID Class value. */ uint8_t DComp_NextHIDInterface(void *CurrentDescriptor)
{ USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); if (Header->Type == DTYPE_Interface) { USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); if (Interface->Class == HID_CLASS) { return DESCRIPTOR_SEARCH_Found; } } return DESCRIPTOR_SEARCH_NotFound; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* I2C Set Peripheral Clock Frequency. Set the peripheral clock frequency: 2MHz to 36MHz (the APB frequency). Note that this is */
void i2c_set_clock_frequency(uint32_t i2c, uint8_t freq)
/* I2C Set Peripheral Clock Frequency. Set the peripheral clock frequency: 2MHz to 36MHz (the APB frequency). Note that this is */ void i2c_set_clock_frequency(uint32_t i2c, uint8_t freq)
{ uint16_t reg16; reg16 = I2C_CR2(i2c) & 0xffc0; reg16 |= freq; I2C_CR2(i2c) = reg16; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Initiates a read packet operation. Reads a data packet from the specified slave address on the I */
enum status_code i2c_master_read_packet_job(struct i2c_master_module *const module, struct i2c_master_packet *const packet)
/* Initiates a read packet operation. Reads a data packet from the specified slave address on the I */ enum status_code i2c_master_read_packet_job(struct i2c_master_module *const module, struct i2c_master_packet *const packet)
{ Assert(module); Assert(module->hw); Assert(packet); if (module->buffer_remaining > 0) { return STATUS_BUSY; } module->no_stop = false; return _i2c_master_read_packet(module, packet); }
memfault/zero-to-main
C++
null
200
/* vpif_buffer_queue: This function adds the buffer to DMA queue */
static void vpif_buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
/* vpif_buffer_queue: This function adds the buffer to DMA queue */ static void vpif_buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
{ struct vpif_fh *fh = q->priv_data; struct common_obj *common; common = &fh->channel->common[VPIF_VIDEO_INDEX]; list_add_tail(&vb->queue, &common->dma_queue); vb->state = VIDEOBUF_QUEUED; }
robutest/uclinux
C++
GPL-2.0
60
/* Function for generating a description of an NFC NDEF URI message. This function declares and initializes a static instance of an NFC NDEF message description and NFC NDEF records descriptions. */
static ret_code_t nfc_uri_msg_declare(nfc_uri_id_t uri_id_code, uint8_t const *const p_uri_data, uint8_t uri_data_len, nfc_ndef_msg_desc_t **pp_uri_msg_desc)
/* Function for generating a description of an NFC NDEF URI message. This function declares and initializes a static instance of an NFC NDEF message description and NFC NDEF records descriptions. */ static ret_code_t nfc_uri_msg_declare(nfc_uri_id_t uri_id_code, uint8_t const *const p_uri_data, uint8_t uri_data_len, nfc_ndef_msg_desc_t **pp_uri_msg_desc)
{ ret_code_t err_code; nfc_ndef_record_desc_t * p_uri_rec; NFC_NDEF_MSG_DEF(nfc_uri_msg, 1); nfc_ndef_msg_clear(&NFC_NDEF_MSG(nfc_uri_msg)); if(p_uri_data != NULL) { p_uri_rec = nfc_uri_rec_declare(uri_id_code, p_uri_data, uri_data_len); err_code = nfc_ndef_msg_record_add(&NFC_NDEF_MSG(nfc_uri_msg), p_uri_rec); if (err_code != NRF_SUCCESS) { return err_code; } } else { return NRF_ERROR_INVALID_PARAM; } *pp_uri_msg_desc = &NFC_NDEF_MSG(nfc_uri_msg); return NRF_SUCCESS; }
labapart/polymcu
C++
null
201
/* Function for handling behaviour when clear operation has completed. */
static void dfu_cleared_func_app(void)
/* Function for handling behaviour when clear operation has completed. */ static void dfu_cleared_func_app(void)
{ dfu_update_status_t update_status = {DFU_BANK_0_ERASED, }; bootloader_dfu_update_process(update_status); }
labapart/polymcu
C++
null
201
/* RNG MSP Initialization This function configures the hardware resources used in this example. */
void HAL_RNG_MspInit(RNG_HandleTypeDef *hrng)
/* RNG MSP Initialization This function configures the hardware resources used in this example. */ void HAL_RNG_MspInit(RNG_HandleTypeDef *hrng)
{ if(hrng->Instance==RNG) { __HAL_RCC_RNG_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* BusLogic_DriverInfo returns the Host Adapter Name to identify this SCSI Driver and Host Adapter. */
static const char* BusLogic_DriverInfo(struct Scsi_Host *Host)
/* BusLogic_DriverInfo returns the Host Adapter Name to identify this SCSI Driver and Host Adapter. */ static const char* BusLogic_DriverInfo(struct Scsi_Host *Host)
{ struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Host->hostdata; return HostAdapter->FullModelName; }
robutest/uclinux
C++
GPL-2.0
60
/* param base Pointer to FLEXIO_I2S_Type structure return Status flag, which are ORed by the enumerators in the _flexio_i2s_status_flags. */
uint32_t FLEXIO_I2S_GetStatusFlags(FLEXIO_I2S_Type *base)
/* param base Pointer to FLEXIO_I2S_Type structure return Status flag, which are ORed by the enumerators in the _flexio_i2s_status_flags. */ uint32_t FLEXIO_I2S_GetStatusFlags(FLEXIO_I2S_Type *base)
{ uint32_t status = 0; status = ((FLEXIO_GetShifterStatusFlags(base->flexioBase) & (1U << base->txShifterIndex)) >> base->txShifterIndex); status |= (((FLEXIO_GetShifterStatusFlags(base->flexioBase) & (1U << base->rxShifterIndex)) >> (base->rxShifterIndex)) << 1U); return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* flush - flush the FIFO to reach a clean state @pl022: SSP driver private data structure */
static int flush(struct pl022 *pl022)
/* flush - flush the FIFO to reach a clean state @pl022: SSP driver private data structure */ static int flush(struct pl022 *pl022)
{ unsigned long limit = loops_per_jiffy << 1; dev_dbg(&pl022->adev->dev, "flush\n"); do { while (readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_RNE) readw(SSP_DR(pl022->virtbase)); } while ((readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_BSY) && limit--); pl022->exp_fifo_level = 0; return limit; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Disables a GPIO pin as a trigger to start a DMA transaction. */
void GPIODMATriggerDisable(unsigned long ulPort, unsigned char ucPins)
/* Disables a GPIO pin as a trigger to start a DMA transaction. */ void GPIODMATriggerDisable(unsigned long ulPort, unsigned char ucPins)
{ ASSERT(GPIOBaseValid(ulPort)); HWREG(ulPort + GPIO_O_DMACTL) &= (~ucPins); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Return the linear address for the physical address. */
UINTN PciSegmentLibVirtualAddress(IN UINTN Address)
/* Return the linear address for the physical address. */ UINTN PciSegmentLibVirtualAddress(IN UINTN Address)
{ UINTN Index; if (!EfiGoneVirtual ()) { return Address; } if (mDxeRuntimePciSegmentLibRegistrationTable[mDxeRuntimePciSegmentLibLastRuntimeRange].PhysicalAddress == (Address & (~(UINTN)EFI_PAGE_MASK))) { return (Address & EFI_PAGE_MASK) + mDxeRuntimePciSegmentLibRegistrationTable[mDxeRuntimePciSegmentLibLastRuntimeRange].VirtualAddress; } for (Index = 0; Index < mDxeRuntimePciSegmentLibNumberOfRuntimeRanges; Index++) { if (mDxeRuntimePciSegmentLibRegistrationTable[Index].PhysicalAddress == (Address & (~(UINTN)EFI_PAGE_MASK))) { mDxeRuntimePciSegmentLibLastRuntimeRange = Index; return (Address & EFI_PAGE_MASK) + mDxeRuntimePciSegmentLibRegistrationTable[Index].VirtualAddress; } } ASSERT (FALSE); CpuBreakpoint (); return Address; }
tianocore/edk2
C++
Other
4,240
/* This is the create() entry in the inode_operations structure for regular HFS directories. The purpose is to create a new file in a directory and return a corresponding inode, given the inode for the directory and the name (and its length) of the new file. */
static int hfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd)
/* This is the create() entry in the inode_operations structure for regular HFS directories. The purpose is to create a new file in a directory and return a corresponding inode, given the inode for the directory and the name (and its length) of the new file. */ static int hfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd)
{ struct inode *inode; int res; inode = hfs_new_inode(dir, &dentry->d_name, mode); if (!inode) return -ENOSPC; res = hfs_cat_create(inode->i_ino, dir, &dentry->d_name, inode); if (res) { inode->i_nlink = 0; hfs_delete_inode(inode); iput(inode); return res; } d_instantiate(dentry, inode); mark_inode_dirty(inode); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Read current logic level of all IO pins */
int pca953x_get_val(uint8_t chip)
/* Read current logic level of all IO pins */ int pca953x_get_val(uint8_t chip)
{ uint8_t val; if (i2c_read(chip, 0, 1, &val, 1)) return -1; return (int)val; }
EmcraftSystems/u-boot
C++
Other
181
/* Checks if a bus off or bus heavy situation occurred. */
static bool VectorXlIsBusError(void)
/* Checks if a bus off or bus heavy situation occurred. */ static bool VectorXlIsBusError(void)
{ bool result = false; (void)xlCanRequestChipState(vectorXlPortHandle, vectorXLChannelMask); UtilCriticalSectionEnter(); if (vectorXlBusErrorDetected) { vectorXlBusErrorDetected = false; result = true; } UtilCriticalSectionExit(); return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* param base TDET peripheral base address param pinConfig Pointer to structure to be filled with tamper pins default parameters */
void TDET_PinGetDefaultConfig(DIGTMP_Type *base, tdet_pin_config_t *pinConfig)
/* param base TDET peripheral base address param pinConfig Pointer to structure to be filled with tamper pins default parameters */ void TDET_PinGetDefaultConfig(DIGTMP_Type *base, tdet_pin_config_t *pinConfig)
{ (void)memset(pinConfig, 0, sizeof(*pinConfig)); struct _tdet_pin_config myPinDefaultConfig = { kTDET_TamperPinPolarityExpectNormal, kTDET_TamperPinDirectionIn, false, kTDET_GlitchFilterSamplingEveryCycle8, kTDET_GlitchFilterSampleDisable, false, kTDET_GlitchFilterClock512Hz, 0, kTDET_GlitchFilterExpectedLogicZero, kTDET_GlitchFilterPullTypeAssert, }; *pinConfig = myPinDefaultConfig; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Compute BnA to the BnP-th power modulo BnM. Please note, all "out" Big number arguments should be properly initialized. by calling to BigNumInit() or BigNumFromBin() functions. */
BOOLEAN EFIAPI CryptoServiceBigNumExpMod(IN CONST VOID *BnA, IN CONST VOID *BnP, IN CONST VOID *BnM, OUT VOID *BnRes)
/* Compute BnA to the BnP-th power modulo BnM. Please note, all "out" Big number arguments should be properly initialized. by calling to BigNumInit() or BigNumFromBin() functions. */ BOOLEAN EFIAPI CryptoServiceBigNumExpMod(IN CONST VOID *BnA, IN CONST VOID *BnP, IN CONST VOID *BnM, OUT VOID *BnRes)
{ return CALL_BASECRYPTLIB (Bn.Services.ExpMod, BigNumExpMod, (BnA, BnP, BnM, BnRes), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Override the default 8250 read handler: mem_serial_in() Empty RX fifo read causes an abort on omap3630 and omap4 This function makes sure that an empty rx fifo is not read on these silicons (OMAP are not affected) */
static unsigned int serial_in_override(struct uart_port *up, int offset)
/* Override the default 8250 read handler: mem_serial_in() Empty RX fifo read causes an abort on omap3630 and omap4 This function makes sure that an empty rx fifo is not read on these silicons (OMAP are not affected) */ static unsigned int serial_in_override(struct uart_port *up, int offset)
{ if (UART_RX == offset) { unsigned int lsr; lsr = __serial_read_reg(up, UART_LSR); if (!(lsr & UART_LSR_DR)) return -EPERM; } return __serial_read_reg(up, offset); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Starts accepting slave transfers. Call this API after calling I2C_SlaveInit() and I2C_SlaveTransferCreateHandle() to start processing transactions driven by an I2C master. The slave monitors the I2C bus and pass events to the callback that was passed into the call to I2C_SlaveTransferCreateHandle(). The callback is always invoked from the interrupt context. */
static status_t I2C_SlaveTransferNonBlockingInternal(I2C_Type *base, i2c_slave_handle_t *handle, const void *txData, size_t txSize, void *rxData, size_t rxSize, uint32_t eventMask)
/* Starts accepting slave transfers. Call this API after calling I2C_SlaveInit() and I2C_SlaveTransferCreateHandle() to start processing transactions driven by an I2C master. The slave monitors the I2C bus and pass events to the callback that was passed into the call to I2C_SlaveTransferCreateHandle(). The callback is always invoked from the interrupt context. */ static status_t I2C_SlaveTransferNonBlockingInternal(I2C_Type *base, i2c_slave_handle_t *handle, const void *txData, size_t txSize, void *rxData, size_t rxSize, uint32_t eventMask)
{ status_t status; assert(handle); status = kStatus_Success; I2C_DisableInterrupts(base, kI2C_SlaveIrqFlags); if (handle->isBusy) { status = kStatus_I2C_Busy; } handle->transfer.txData = (const uint8_t *)(uintptr_t)txData; handle->transfer.txSize = txSize; handle->transfer.rxData = (uint8_t *)rxData; handle->transfer.rxSize = rxSize; handle->transfer.transferredCount = 0; handle->transfer.eventMask = eventMask | kI2C_SlaveTransmitEvent | kI2C_SlaveReceiveEvent; handle->isBusy = true; I2C_SlaveEnable(base, true); base->STAT |= 0u; I2C_EnableInterrupts(base, kI2C_SlaveIrqFlags); return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* It sets up a single environment variable DEV_TYPE which contains the hardware device type. */
static int ap_uevent(struct device *dev, struct kobj_uevent_env *env)
/* It sets up a single environment variable DEV_TYPE which contains the hardware device type. */ static int ap_uevent(struct device *dev, struct kobj_uevent_env *env)
{ struct ap_device *ap_dev = to_ap_dev(dev); int retval = 0; if (!ap_dev) return -ENODEV; retval = add_uevent_var(env, "DEV_TYPE=%04X", ap_dev->device_type); if (retval) return retval; retval = add_uevent_var(env, "MODALIAS=ap:t%02X", ap_dev->device_type); return retval; }
robutest/uclinux
C++
GPL-2.0
60
/* Lookup a virtual port. Excludes base port from lookup. */
struct bfa_fcs_vport_s* bfa_fcs_vport_lookup(struct bfa_fcs_s *fcs, u16 vf_id, wwn_t vpwwn)
/* Lookup a virtual port. Excludes base port from lookup. */ struct bfa_fcs_vport_s* bfa_fcs_vport_lookup(struct bfa_fcs_s *fcs, u16 vf_id, wwn_t vpwwn)
{ struct bfa_fcs_vport_s *vport; struct bfa_fcs_fabric_s *fabric; bfa_trc(fcs, vf_id); bfa_trc(fcs, vpwwn); fabric = bfa_fcs_vf_lookup(fcs, vf_id); if (!fabric) { bfa_trc(fcs, vf_id); return NULL; } vport = bfa_fcs_fabric_vport_lookup(fabric, vpwwn); return vport; }
robutest/uclinux
C++
GPL-2.0
60
/* Handles an incoming ATT error response for the specified read-characteristic-value proc. */
static void ble_gattc_read_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
/* Handles an incoming ATT error response for the specified read-characteristic-value proc. */ static void ble_gattc_read_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
{ ble_gattc_dbg_assert_proc_not_inserted(proc); ble_gattc_read_cb(proc, status, att_handle, NULL); }
Nicholas3388/LuaNode
C++
Other
1,055
/* returns SUCCESS if the VF has set the Status bit or else ERR_MBX */
static s32 igb_check_for_msg_pf(struct e1000_hw *hw, u16 vf_number)
/* returns SUCCESS if the VF has set the Status bit or else ERR_MBX */ static s32 igb_check_for_msg_pf(struct e1000_hw *hw, u16 vf_number)
{ s32 ret_val = -E1000_ERR_MBX; if (!igb_check_for_bit_pf(hw, E1000_MBVFICR_VFREQ_VF1 << vf_number)) { ret_val = 0; hw->mbx.stats.reqs++; } return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* Update sleep interval, based on results from hawkbit base polling resource */
static void hawkbit_update_sleep(struct hawkbit_ctl_res *hawkbit_res)
/* Update sleep interval, based on results from hawkbit base polling resource */ static void hawkbit_update_sleep(struct hawkbit_ctl_res *hawkbit_res)
{ uint32_t sleep_time; const char *sleep = hawkbit_res->config.polling.sleep; if (strlen(sleep) != HAWKBIT_SLEEP_LENGTH) { LOG_ERR("Invalid poll sleep: %s", sleep); } else { sleep_time = hawkbit_time2sec(sleep); if (sleep_time > 0 && poll_sleep != (MSEC_PER_SEC * sleep_time)) { LOG_DBG("New poll sleep %d seconds", sleep_time); poll_sleep = sleep_time * MSEC_PER_SEC; } } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* preemptively destroy all the peer records from a transport endpoint rather than waiting for them to time out */
void __exit rxrpc_destroy_all_peers(void)
/* preemptively destroy all the peer records from a transport endpoint rather than waiting for them to time out */ void __exit rxrpc_destroy_all_peers(void)
{ DECLARE_WAITQUEUE(myself,current); _enter(""); if (!list_empty(&rxrpc_peers)) { set_current_state(TASK_UNINTERRUPTIBLE); add_wait_queue(&rxrpc_peer_wq, &myself); while (!list_empty(&rxrpc_peers)) { schedule(); set_current_state(TASK_UNINTERRUPTIBLE); } remove_wait_queue(&rxrpc_peer_wq, &myself); set_current_state(TASK_RUNNING); } _leave(""); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check if we have enough auth data and capabilities to authenticate. */
bool Curl_sasl_can_authenticate(struct SASL *sasl, struct connectdata *conn)
/* Check if we have enough auth data and capabilities to authenticate. */ bool Curl_sasl_can_authenticate(struct SASL *sasl, struct connectdata *conn)
{ if(conn->bits.user_passwd) return TRUE; if(sasl->authmechs & sasl->prefmech & SASL_MECH_EXTERNAL) return TRUE; return FALSE; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* We don't link the push cursor because it is embedded in the struct xfs_ail and hence easily findable. */
STATIC void xfs_trans_ail_cursor_init(struct xfs_ail *ailp, struct xfs_ail_cursor *cur)
/* We don't link the push cursor because it is embedded in the struct xfs_ail and hence easily findable. */ STATIC void xfs_trans_ail_cursor_init(struct xfs_ail *ailp, struct xfs_ail_cursor *cur)
{ cur->item = NULL; if (cur == &ailp->xa_cursors) return; cur->next = ailp->xa_cursors.next; ailp->xa_cursors.next = cur; }
robutest/uclinux
C++
GPL-2.0
60
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI TerminalComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */ EFI_STATUS EFIAPI TerminalComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mTerminalDriverNameTable, DriverName, (BOOLEAN)(This == &gTerminalComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* Unregister decoder as an i2c client device and V4L2 device. Complement of tvp514x_probe(). */
static int tvp514x_remove(struct i2c_client *client)
/* Unregister decoder as an i2c client device and V4L2 device. Complement of tvp514x_probe(). */ static int tvp514x_remove(struct i2c_client *client)
{ struct v4l2_subdev *sd = i2c_get_clientdata(client); struct tvp514x_decoder *decoder = to_decoder(sd); v4l2_device_unregister_subdev(sd); kfree(decoder); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Retrieve and return the current locally administered address state. */
bool e1000e_get_laa_state_82571(struct e1000_hw *hw)
/* Retrieve and return the current locally administered address state. */ bool e1000e_get_laa_state_82571(struct e1000_hw *hw)
{ if (hw->mac.type != e1000_82571) return false; return hw->dev_spec.e82571.laa_is_present; }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the adc any channels conversion rank and channel. */
void ADC_ANY_CH_Config(ADC_TypeDef *adc, u8 rank, ADCCHANNEL_TypeDef adc_channel)
/* Configures the adc any channels conversion rank and channel. */ void ADC_ANY_CH_Config(ADC_TypeDef *adc, u8 rank, ADCCHANNEL_TypeDef adc_channel)
{ rank = rank & 0xF; if(rank < 8) { adc->CHANY0 &= ~(0x0F << (4 * rank)); adc->CHANY0 |= (adc_channel << (4 * rank)); } else { adc->CHANY1 &= ~(0x0F << (4 * (rank - 8))); adc->CHANY1 |= (adc_channel << (4 * (rank - 8))); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* __ftrace_set_clr_event(NULL, NULL, NULL, set) will set/unset all events. */
static int __ftrace_set_clr_event(const char *match, const char *sub, const char *event, int set)
/* __ftrace_set_clr_event(NULL, NULL, NULL, set) will set/unset all events. */ static int __ftrace_set_clr_event(const char *match, const char *sub, const char *event, int set)
{ struct ftrace_event_call *call; int ret = -EINVAL; mutex_lock(&event_mutex); list_for_each_entry(call, &ftrace_events, list) { if (!call->name || !call->regfunc) continue; if (match && strcmp(match, call->name) != 0 && strcmp(match, call->system) != 0) continue; if (sub && strcmp(sub, call->system) != 0) continue; if (event && strcmp(event, call->name) != 0) continue; ftrace_event_enable_disable(call, set); ret = 0; } mutex_unlock(&event_mutex); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function should be called in the close function of the device driver. */
void close_candev(struct net_device *dev)
/* This function should be called in the close function of the device driver. */ void close_candev(struct net_device *dev)
{ struct can_priv *priv = netdev_priv(dev); if (del_timer_sync(&priv->restart_timer)) dev_put(dev); can_flush_echo_skb(dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Disable one or more interrupts of PortA. Parameters: pinno: return: SUCCESS. */
static void gpio_irq_disable(gpio_pin_handle_t pin)
/* Disable one or more interrupts of PortA. Parameters: pinno: return: SUCCESS. */ static void gpio_irq_disable(gpio_pin_handle_t pin)
{ dw_gpio_pin_priv_t *gpio_pin_priv = pin; uint32_t offset = gpio_pin_priv->idx; dw_gpio_priv_t *port_handle = &gpio_handle[gpio_pin_priv->portidx]; dw_gpio_control_reg_t *gpio_control_reg = (dw_gpio_control_reg_t *)(port_handle->base + 0x30); uint32_t val = gpio_control_reg->INTEN; val &= ~(1 << offset); gpio_control_reg->INTEN = val; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* We need a special oob layout and handling even when ECC isn't checked. */
static void nand_write_page_raw_syndrome(struct mtd_info *mtd, struct nand_chip *chip, const uint8_t *buf)
/* We need a special oob layout and handling even when ECC isn't checked. */ static void nand_write_page_raw_syndrome(struct mtd_info *mtd, struct nand_chip *chip, const uint8_t *buf)
{ int eccsize = chip->ecc.size; int eccbytes = chip->ecc.bytes; uint8_t *oob = chip->oob_poi; int steps, size; for (steps = chip->ecc.steps; steps > 0; steps--) { chip->write_buf(mtd, buf, eccsize); buf += eccsize; if (chip->ecc.prepad) { chip->write_buf(mtd, oob, chip->ecc.prepad); oob += chip->ecc.prepad; } chip->read_buf(mtd, oob, eccbytes); oob += eccbytes; if (chip->ecc.postpad) { chip->write_buf(mtd, oob, chip->ecc.postpad); oob += chip->ecc.postpad; } } size = mtd->oobsize - (oob - chip->oob_poi); if (size) chip->write_buf(mtd, oob, size); }
EmcraftSystems/u-boot
C++
Other
181
/* I2C MSP De-Initialization This function frees the hardware resources used in this example: */
void HAL_FMPI2C_MspDeInit(FMPI2C_HandleTypeDef *hi2c)
/* I2C MSP De-Initialization This function frees the hardware resources used in this example: */ void HAL_FMPI2C_MspDeInit(FMPI2C_HandleTypeDef *hi2c)
{ static DMA_HandleTypeDef hdma_tx; static DMA_HandleTypeDef hdma_rx; I2Cx_FORCE_RESET(); I2Cx_RELEASE_RESET(); HAL_GPIO_DeInit(I2Cx_SCL_GPIO_PORT, I2Cx_SCL_PIN); HAL_GPIO_DeInit(I2Cx_SDA_GPIO_PORT, I2Cx_SDA_PIN); HAL_DMA_DeInit(&hdma_tx); HAL_DMA_DeInit(&hdma_rx); HAL_NVIC_DisableIRQ(I2Cx_DMA_TX_IRQn); HAL_NVIC_DisableIRQ(I2Cx_DMA_RX_IRQn); HAL_NVIC_DisableIRQ(I2Cx_ER_IRQn); HAL_NVIC_DisableIRQ(I2Cx_EV_IRQn); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* clear the specified DAC0 interrupt flag(DAC0 DMA underrun interrupt flag) */
void dac0_interrupt_flag_clear(void)
/* clear the specified DAC0 interrupt flag(DAC0 DMA underrun interrupt flag) */ void dac0_interrupt_flag_clear(void)
{ DAC_CTL &= ~DAC_CTL_DDUDRIE0; }
liuxuming/trochili
C++
Apache License 2.0
132
/* Return: 0 if all went well, else returns appropriate error value. */
static int ti_sci_cmd_clk_is_auto(const struct ti_sci_handle *handle, u32 dev_id, u8 clk_id, bool *req_state)
/* Return: 0 if all went well, else returns appropriate error value. */ static int ti_sci_cmd_clk_is_auto(const struct ti_sci_handle *handle, u32 dev_id, u8 clk_id, bool *req_state)
{ u8 state = 0; int ret; if (!req_state) return -EINVAL; ret = ti_sci_cmd_get_clock_state(handle, dev_id, clk_id, &state, NULL); if (ret) return ret; *req_state = (state == MSG_CLOCK_SW_STATE_AUTO); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* RCC Set HSI48 clock source to the RC48 (CRS) */
void rcc_set_hsi48_source_rc48(void)
/* RCC Set HSI48 clock source to the RC48 (CRS) */ void rcc_set_hsi48_source_rc48(void)
{ RCC_CCIPR |= RCC_CCIPR_HSI48SEL; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Switch programmable clock source selection to main clock. */
uint32_t pmc_switch_pck_to_mainck(uint32_t ul_id, uint32_t ul_pres)
/* Switch programmable clock source selection to main clock. */ uint32_t pmc_switch_pck_to_mainck(uint32_t ul_id, uint32_t ul_pres)
{ uint32_t ul_timeout; PMC->PMC_PCK[ul_id] = PMC_PCK_CSS_MAIN_CLK | ul_pres; for (ul_timeout = PMC_TIMEOUT; !(PMC->PMC_SR & (PMC_SR_PCKRDY0 << ul_id)); --ul_timeout) { if (ul_timeout == 0) { return 1; } } return 0; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Set the initial window size, round to next power of 2 and square for small size, x 4 for medium, and x 2 for large for 128k (32 page) max ra 1-8 page = 32k initial, > 8 page = 128k initial */
static unsigned long get_init_ra_size(unsigned long size, unsigned long max)
/* Set the initial window size, round to next power of 2 and square for small size, x 4 for medium, and x 2 for large for 128k (32 page) max ra 1-8 page = 32k initial, > 8 page = 128k initial */ static unsigned long get_init_ra_size(unsigned long size, unsigned long max)
{ unsigned long newsize = roundup_pow_of_two(size); if (newsize <= max / 32) newsize = newsize * 4; else if (newsize <= max / 4) newsize = newsize * 2; else newsize = max; return newsize; }
robutest/uclinux
C++
GPL-2.0
60
/* Change Logs: Date Author Notes Bernard the first version */
int pthread_spin_init(pthread_spinlock_t *lock, int pshared)
/* Change Logs: Date Author Notes Bernard the first version */ int pthread_spin_init(pthread_spinlock_t *lock, int pshared)
{ if (!lock) return EINVAL; lock->lock = 0; return 0; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Returns a pointer to the internal raw NULL terminated string of the current instance of #CRString. */
const gchar* cr_string_peek_raw_str(CRString *a_this)
/* Returns a pointer to the internal raw NULL terminated string of the current instance of #CRString. */ const gchar* cr_string_peek_raw_str(CRString *a_this)
{ g_return_val_if_fail (a_this, NULL) ; if (a_this->stryng && a_this->stryng->str) return a_this->stryng->str ; return NULL ; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Reallocate memory for the rolling filter data buffer. */
static int32_t cn0503_defparam_set_rflw(struct cn0503_dev *dev, uint8_t width, float **buff_ptr)
/* Reallocate memory for the rolling filter data buffer. */ static int32_t cn0503_defparam_set_rflw(struct cn0503_dev *dev, uint8_t width, float **buff_ptr)
{ float *err_check; err_check = (float *)realloc(*buff_ptr, width * sizeof(uint32_t)); if(!err_check) return FAILURE; *buff_ptr = err_check; return SUCCESS; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Use the VMGEXIT instruction to handle a RDPMC event. */
STATIC UINT64 RdpmcExit(IN OUT GHCB *Ghcb, IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs, IN CC_INSTRUCTION_DATA *InstructionData)
/* Use the VMGEXIT instruction to handle a RDPMC event. */ STATIC UINT64 RdpmcExit(IN OUT GHCB *Ghcb, IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs, IN CC_INSTRUCTION_DATA *InstructionData)
{ UINT64 Status; Ghcb->SaveArea.Rcx = Regs->Rcx; CcExitVmgSetOffsetValid (Ghcb, GhcbRcx); Status = CcExitVmgExit (Ghcb, SVM_EXIT_RDPMC, 0, 0); if (Status != 0) { return Status; } if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax) || !CcExitVmgIsOffsetValid (Ghcb, GhcbRdx)) { return UnsupportedExit (Ghcb, Regs, InstructionData); } Regs->Rax = Ghcb->SaveArea.Rax; Regs->Rdx = Ghcb->SaveArea.Rdx; return 0; }
tianocore/edk2
C++
Other
4,240
/* brief DMA instance 0, channel 9 IRQ handler. */
void EDMA_0_CH9_DriverIRQHandler(void)
/* brief DMA instance 0, channel 9 IRQ handler. */ void EDMA_0_CH9_DriverIRQHandler(void)
{ EDMA_DriverIRQHandler(0U, 9U); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* USBH_MTP_GetNumStorage Select the storage Unit to be used. */
USBH_StatusTypeDef USBH_MTP_GetNumStorage(USBH_HandleTypeDef *phost, uint8_t *storage_num)
/* USBH_MTP_GetNumStorage Select the storage Unit to be used. */ USBH_StatusTypeDef USBH_MTP_GetNumStorage(USBH_HandleTypeDef *phost, uint8_t *storage_num)
{ USBH_StatusTypeDef status = USBH_FAIL; MTP_HandleTypeDef *MTP_Handle = phost->pActiveClass->pData; if(MTP_Handle->is_ready > 0) { *storage_num = MTP_Handle->info.storids.n; status = USBH_OK; } return status; }
micropython/micropython
C++
Other
18,334
/* Compute the required header size. This function takes into account alignment of the q31 values that will follow the header. */
static uint32_t compute_header_size(int num_output_samples)
/* Compute the required header size. This function takes into account alignment of the q31 values that will follow the header. */ static uint32_t compute_header_size(int num_output_samples)
{ uint32_t size = sizeof(struct sensor_data_generic_header) + (num_output_samples * sizeof(enum sensor_channel)); return (size + 3) & ~0x3; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* We check the return of @cb each time. If it returns anything other than 0, we break out. */
void pci_walk_bus(struct pci_bus *top, int(*cb)(struct pci_dev *, void *), void *userdata)
/* We check the return of @cb each time. If it returns anything other than 0, we break out. */ void pci_walk_bus(struct pci_bus *top, int(*cb)(struct pci_dev *, void *), void *userdata)
{ struct pci_dev *dev; struct pci_bus *bus; struct list_head *next; int retval; bus = top; down_read(&pci_bus_sem); next = top->devices.next; for (;;) { if (next == &bus->devices) { if (bus == top) break; next = bus->self->bus_list.next; bus = bus->self->bus; continue; } dev = list_entry(next, struct pci_dev, bus_list); if (dev->subordinate) { next = dev->subordinate->devices.next; bus = dev->subordinate; } else next = dev->bus_list.next; down(&dev->dev.sem); retval = cb(dev, userdata); up(&dev->dev.sem); if (retval) break; } up_read(&pci_bus_sem); }
robutest/uclinux
C++
GPL-2.0
60
/* Parametrs: Elme - MLME message containing the received frame */
void PeerSpectrumAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem)
/* Parametrs: Elme - MLME message containing the received frame */ void PeerSpectrumAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem)
{ u8 Action = Elem->Msg[LENGTH_802_11 + 1]; if (pAd->CommonCfg.bIEEE80211H != TRUE) return; switch (Action) { case SPEC_MRQ: PeerMeasureReqAction(pAd, Elem); break; case SPEC_MRP: PeerMeasureReportAction(pAd, Elem); break; case SPEC_TPCRQ: PeerTpcReqAction(pAd, Elem); break; case SPEC_TPCRP: PeerTpcRepAction(pAd, Elem); break; case SPEC_CHANNEL_SWITCH: PeerChSwAnnAction(pAd, Elem); break; } return; }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables access to the RTC and backup registers. */
void PWR_BackupAccessCmd(FunctionalState NewState)
/* Enables or disables access to the RTC and backup registers. */ void PWR_BackupAccessCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if(NewState != DISABLE) { PWR->CR |= 0x00000100; } else { PWR->CR &= 0xfffffeff; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Retrieves the state of a port pin that is configured as an output. Reads the current logical output level of a port pin and returns the current level as a Boolean value. */
bool port_pin_get_output_level(const uint8_t gpio_pin)
/* Retrieves the state of a port pin that is configured as an output. Reads the current logical output level of a port pin and returns the current level as a Boolean value. */ bool port_pin_get_output_level(const uint8_t gpio_pin)
{ PortGroup *const port_base = port_get_group_from_gpio_pin(gpio_pin); uint32_t pin_mask = (1UL << (gpio_pin % 32)); return (port_base->OUT.reg & pin_mask); }
remotemcu/remcu-chip-sdks
C++
null
436
/* So what we do is to mark the page "pending dirty" and next time writepage is called, propagate that into the buffers appropriately. */
static int ext4_journalled_set_page_dirty(struct page *page)
/* So what we do is to mark the page "pending dirty" and next time writepage is called, propagate that into the buffers appropriately. */ static int ext4_journalled_set_page_dirty(struct page *page)
{ SetPageChecked(page); return __set_page_dirty_nobuffers(page); }
robutest/uclinux
C++
GPL-2.0
60
/* Submit a USB get interface request for the USB device specified by UsbIo, and Interface, and place the result in the buffer specified by AlternateSetting. The status of the transfer is returned in Status. If UsbIo is NULL, then ASSERT(). If AlternateSetting is NULL, then ASSERT(). If Status is NULL, then ASSERT(). */
EFI_STATUS EFIAPI UsbGetInterface(IN EFI_USB_IO_PROTOCOL *UsbIo, IN UINT16 Interface, OUT UINT16 *AlternateSetting, OUT UINT32 *Status)
/* Submit a USB get interface request for the USB device specified by UsbIo, and Interface, and place the result in the buffer specified by AlternateSetting. The status of the transfer is returned in Status. If UsbIo is NULL, then ASSERT(). If AlternateSetting is NULL, then ASSERT(). If Status is NULL, then ASSERT(). */ EFI_STATUS EFIAPI UsbGetInterface(IN EFI_USB_IO_PROTOCOL *UsbIo, IN UINT16 Interface, OUT UINT16 *AlternateSetting, OUT UINT32 *Status)
{ EFI_USB_DEVICE_REQUEST DevReq; ASSERT (UsbIo != NULL); ASSERT (AlternateSetting != NULL); ASSERT (Status != NULL); *AlternateSetting = 0; ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST)); DevReq.RequestType = USB_DEV_GET_INTERFACE_REQ_TYPE; DevReq.Request = USB_REQ_GET_INTERFACE; DevReq.Index = Interface; DevReq.Length = 1; return UsbIo->UsbControlTransfer ( UsbIo, &DevReq, EfiUsbDataIn, PcdGet32 (PcdUsbTransferTimeoutValue), AlternateSetting, 1, Status ); }
tianocore/edk2
C++
Other
4,240
/* If 8-bit I/O port operations are not supported, then ASSERT(). */
UINT8 EFIAPI IoRead8(IN UINTN Port)
/* If 8-bit I/O port operations are not supported, then ASSERT(). */ UINT8 EFIAPI IoRead8(IN UINTN Port)
{ return (UINT8)IoReadWorker (Port, EfiCpuIoWidthUint8); }
tianocore/edk2
C++
Other
4,240
/* Internal worker to determine whether there is a file system somewhere upon the device path specified. */
BOOLEAN InternalShellProtocolIsSimpleFileSystemPresent(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
/* Internal worker to determine whether there is a file system somewhere upon the device path specified. */ BOOLEAN InternalShellProtocolIsSimpleFileSystemPresent(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
{ EFI_DEVICE_PATH_PROTOCOL *DevicePathCopy; EFI_STATUS Status; EFI_HANDLE Handle; Handle = NULL; DevicePathCopy = (EFI_DEVICE_PATH_PROTOCOL *)DevicePath; Status = gBS->LocateDevicePath (&gEfiSimpleFileSystemProtocolGuid, &DevicePathCopy, &Handle); if ((Handle != NULL) && (!EFI_ERROR (Status))) { return (TRUE); } return (FALSE); }
tianocore/edk2
C++
Other
4,240
/* Initializes an AES configuration structure to defaults. Initializes the specified AES configuration structure to a set of known default values. */
void aes_get_config_defaults(struct aes_config *const config)
/* Initializes an AES configuration structure to defaults. Initializes the specified AES configuration structure to a set of known default values. */ void aes_get_config_defaults(struct aes_config *const config)
{ Assert(config); config->encrypt_mode = AES_ENCRYPTION; config->key_size = AES_KEY_SIZE_128; config->start_mode = AES_MANUAL_START; config->opmode= AES_ECB_MODE; config->cfb_size = AES_CFB_SIZE_128; config->ctype = AES_COUNTERMEASURE_TYPE_ALL; config->enable_xor_key = false; config->enable_key_gen = false; config->lod = false; }
memfault/zero-to-main
C++
null
200
/* If 64-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT64 EFIAPI S3IoBitFieldRead64(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit)
/* If 64-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ UINT64 EFIAPI S3IoBitFieldRead64(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit)
{ return InternalSaveIoWrite64ValueToBootScript (Port, IoBitFieldRead64 (Port, StartBit, EndBit)); }
tianocore/edk2
C++
Other
4,240
/* Returns NULL on error, a pointer to usb_usbvision else. */
static struct usb_usbvision* usbvision_alloc(struct usb_device *dev, struct usb_interface *intf)
/* Returns NULL on error, a pointer to usb_usbvision else. */ static struct usb_usbvision* usbvision_alloc(struct usb_device *dev, struct usb_interface *intf)
{ struct usb_usbvision *usbvision; usbvision = kzalloc(sizeof(struct usb_usbvision), GFP_KERNEL); if (usbvision == NULL) return NULL; usbvision->dev = dev; if (v4l2_device_register(&intf->dev, &usbvision->v4l2_dev)) goto err_free; mutex_init(&usbvision->lock); usbvision->ctrlUrb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL); if (usbvision->ctrlUrb == NULL) goto err_unreg; init_waitqueue_head(&usbvision->ctrlUrb_wq); usbvision_init_powerOffTimer(usbvision); return usbvision; err_unreg: v4l2_device_unregister(&usbvision->v4l2_dev); err_free: kfree(usbvision); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Allows power-up/down of the dc-to-dc converter, DAC and internal amplifiers for the selected channel. */
void ad5755_set_channel_power(struct ad5755_dev *dev, uint8_t channel, uint8_t pwr_status)
/* Allows power-up/down of the dc-to-dc converter, DAC and internal amplifiers for the selected channel. */ void ad5755_set_channel_power(struct ad5755_dev *dev, uint8_t channel, uint8_t pwr_status)
{ uint32_t old_dac_ctrl_reg = 0; uint32_t new_dac_ctrl_reg = 0; old_dac_ctrl_reg = ad5755_get_register_value(dev, AD5755_RD_CTRL_REG(channel)); old_dac_ctrl_reg &= ~(AD5755_DAC_INT_ENABLE | AD5755_DAC_DC_DC | AD5755_DAC_OUTEN); new_dac_ctrl_reg = old_dac_ctrl_reg | (pwr_status * (AD5755_DAC_INT_ENABLE | AD5755_DAC_DC_DC | AD5755_DAC_OUTEN)); ad5755_set_control_registers(dev, AD5755_CREG_DAC, AD5755_DAC_A, new_dac_ctrl_reg); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* This API reads the data ready status of Accel from the sensor. */
uint16_t bma4_get_accel_data_rdy(uint8_t *data_rdy, struct bma4_dev *dev)
/* This API reads the data ready status of Accel from the sensor. */ uint16_t bma4_get_accel_data_rdy(uint8_t *data_rdy, 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_STATUS_ADDR, &data, 1, dev); if (rslt == BMA4_OK) *data_rdy = BMA4_GET_BITSLICE(data, BMA4_STAT_DATA_RDY_ACCEL); } return rslt; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Sends a UI PDU to the MAC layer in response to a UNITDATA REQUEST primitive from the network layer. Verifies event is a primitive type of event. Verify the primitive is a UNITDATA REQUEST. */
int llc_sap_action_send_ui(struct llc_sap *sap, struct sk_buff *skb)
/* Sends a UI PDU to the MAC layer in response to a UNITDATA REQUEST primitive from the network layer. Verifies event is a primitive type of event. Verify the primitive is a UNITDATA REQUEST. */ int llc_sap_action_send_ui(struct llc_sap *sap, struct sk_buff *skb)
{ struct llc_sap_state_ev *ev = llc_sap_ev(skb); int rc; llc_pdu_header_init(skb, LLC_PDU_TYPE_U, ev->saddr.lsap, ev->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_ui_cmd(skb); rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); if (likely(!rc)) rc = dev_queue_xmit(skb); return rc; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* a3d_adc_close() is a callback from the input close routine. */
static void a3d_adc_close(struct gameport *gameport)
/* a3d_adc_close() is a callback from the input close routine. */ static void a3d_adc_close(struct gameport *gameport)
{ struct a3d *a3d = gameport->port_data; gameport_stop_polling(a3d->gameport); }
robutest/uclinux
C++
GPL-2.0
60
/* Return Value: TRUE if succeeded; FALSE if failed. */
BOOL IFRFbWriteEmbeded(DWORD_PTR dwIoBase, DWORD dwData)
/* Return Value: TRUE if succeeded; FALSE if failed. */ BOOL IFRFbWriteEmbeded(DWORD_PTR dwIoBase, DWORD dwData)
{ WORD ww; DWORD dwValue; VNSvOutPortD(dwIoBase + MAC_REG_IFREGCTL, dwData); for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortD(dwIoBase + MAC_REG_IFREGCTL, &dwValue); if (dwValue & IFREGCTL_DONE) break; } if (ww == W_MAX_TIMEOUT) { return FALSE; } return TRUE; }
robutest/uclinux
C++
GPL-2.0
60
/* This is done when the device goes off air. */
void wlp_eda_rm_node(struct wlp_eda *eda, const struct uwb_dev_addr *dev_addr)
/* This is done when the device goes off air. */ void wlp_eda_rm_node(struct wlp_eda *eda, const struct uwb_dev_addr *dev_addr)
{ struct wlp_eda_node *itr, *next; unsigned long flags; spin_lock_irqsave(&eda->lock, flags); list_for_each_entry_safe(itr, next, &eda->cache, list_node) { if (!memcmp(&itr->dev_addr, dev_addr, sizeof(itr->dev_addr))) { list_del(&itr->list_node); kfree(itr); break; } } spin_unlock_irqrestore(&eda->lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Pack values defined by a type string into a buffer. The buffer must have large enough space. */
int type_string_pack(const char *type_str, char *const values[], u8 *data)
/* Pack values defined by a type string into a buffer. The buffer must have large enough space. */ int type_string_pack(const char *type_str, char *const values[], u8 *data)
{ size_t offset; u32 value; for (offset = 0; *type_str; type_str++, values++) { value = simple_strtoul(values[0], NULL, 0); switch (*type_str) { case 'b': data[offset] = value; offset += 1; break; case 'w': put_unaligned_be16(value, data + offset); offset += 2; break; case 'd': put_unaligned_be32(value, data + offset); offset += 4; break; default: return -1; } } return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Gets a URB state from the low level driver. */
USBH_URBStateTypeDef USBH_LL_GetURBState(USBH_HandleTypeDef *phost, uint8_t pipe)
/* Gets a URB state from the low level driver. */ USBH_URBStateTypeDef USBH_LL_GetURBState(USBH_HandleTypeDef *phost, uint8_t pipe)
{ return (USBH_URBStateTypeDef)HAL_HCD_HC_GetURBState (phost->pData, pipe); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Use kmalloc if possible for the page list. Otherwise fall back to vmalloc. This speeds things up and also saves memory for small AGP regions. */
void agp_alloc_page_array(size_t size, struct agp_memory *mem)
/* Use kmalloc if possible for the page list. Otherwise fall back to vmalloc. This speeds things up and also saves memory for small AGP regions. */ void agp_alloc_page_array(size_t size, struct agp_memory *mem)
{ mem->pages = NULL; mem->vmalloc_flag = false; if (size <= 2*PAGE_SIZE) mem->pages = kmalloc(size, GFP_KERNEL | __GFP_NORETRY); if (mem->pages == NULL) { mem->pages = vmalloc(size); mem->vmalloc_flag = true; } }
robutest/uclinux
C++
GPL-2.0
60
/* enable or disable the monitor function in Low Power Rx Path( REG_MON_BAUD_CTRL ). */
void UART_RxMonitorCmd(UART_TypeDef *UARTx, u32 NewState)
/* enable or disable the monitor function in Low Power Rx Path( REG_MON_BAUD_CTRL ). */ void UART_RxMonitorCmd(UART_TypeDef *UARTx, u32 NewState)
{ if(NewState != DISABLE ){ UARTx->MON_BAUD_CTRL |= RUART_LP_RX_MON_ENABLE; } else { UARTx->MON_BAUD_CTRL &= (~ RUART_LP_RX_MON_ENABLE); } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Disable selected RTC interrupts. ui32Interrupt should be an OR of the following: */
void am_hal_rtc_int_disable(uint32_t ui32Interrupt)
/* Disable selected RTC interrupts. ui32Interrupt should be an OR of the following: */ void am_hal_rtc_int_disable(uint32_t ui32Interrupt)
{ AM_REG(RTC, INTEN) &= ~ui32Interrupt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Notes: We queue up an asynchronous "ALLOW MEDIUM REMOVAL" request on the head of the devices request queue, and continue. */
static void scsi_eh_lock_door(struct scsi_device *sdev)
/* Notes: We queue up an asynchronous "ALLOW MEDIUM REMOVAL" request on the head of the devices request queue, and continue. */ static void scsi_eh_lock_door(struct scsi_device *sdev)
{ struct request *req; req = blk_get_request(sdev->request_queue, READ, GFP_KERNEL); req->cmd[0] = ALLOW_MEDIUM_REMOVAL; req->cmd[1] = 0; req->cmd[2] = 0; req->cmd[3] = 0; req->cmd[4] = SCSI_REMOVAL_PREVENT; req->cmd[5] = 0; req->cmd_len = COMMAND_SIZE(req->cmd[0]); req->cmd_type = REQ_TYPE_BLOCK_PC; req->cmd_flags |= REQ_QUIET; req->timeout = 10 * HZ; req->retries = 5; blk_execute_rq_nowait(req->q, NULL, req, 1, eh_lock_door_done); }
robutest/uclinux
C++
GPL-2.0
60
/* VmbusChildDeviceAdd - Registers the child device with the vmbus */
int VmbusChildDeviceAdd(struct hv_device *ChildDevice)
/* VmbusChildDeviceAdd - Registers the child device with the vmbus */ int VmbusChildDeviceAdd(struct hv_device *ChildDevice)
{ struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver; return vmbusDriver->OnChildDeviceAdd(gDevice, ChildDevice); }
robutest/uclinux
C++
GPL-2.0
60
/* Sets the initialization vector in the DES module. */
bool DESIVSet(uint32_t ui32Base, uint32_t *pui32IVdata)
/* Sets the initialization vector in the DES module. */ bool DESIVSet(uint32_t ui32Base, uint32_t *pui32IVdata)
{ ASSERT(ui32Base == DES_BASE); if((HWREG(ui32Base + DES_O_CTRL) & DES_CTRL_CONTEXT) == 0) { return(false); } HWREG(ui32Base + DES_O_IV_L) = pui32IVdata[0]; HWREG(ui32Base + DES_O_IV_H) = pui32IVdata[1]; return(true); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* cxgb3i_setup_conn_host_pagesize - setup the conn.'s ddp page size @tdev: t3cdev adapter @tid: connection id @reply: request reply from h/w set up the ddp page size based on the host PAGE_SIZE for a connection identified by tid */
int cxgb3i_setup_conn_host_pagesize(struct t3cdev *tdev, unsigned int tid, int reply)
/* cxgb3i_setup_conn_host_pagesize - setup the conn.'s ddp page size @tdev: t3cdev adapter @tid: connection id @reply: request reply from h/w set up the ddp page size based on the host PAGE_SIZE for a connection identified by tid */ int cxgb3i_setup_conn_host_pagesize(struct t3cdev *tdev, unsigned int tid, int reply)
{ return setup_conn_pgidx(tdev, tid, page_idx, reply); }
robutest/uclinux
C++
GPL-2.0
60
/* Function called from SPI1 IRQ Handler when TXE flag is set Function is in charge to transmit byte on SPI lines. */
void SPI1_Tx_Callback(void)
/* Function called from SPI1 IRQ Handler when TXE flag is set Function is in charge to transmit byte on SPI lines. */ void SPI1_Tx_Callback(void)
{ LL_SPI_TransmitData8(SPI1, aTxBuffer[ubTransmitIndex++]); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* The function returns one of the following values: */
uint32_t USBModeGet(uint32_t ui32Base)
/* The function returns one of the following values: */ uint32_t USBModeGet(uint32_t ui32Base)
{ ASSERT(ui32Base == USB0_BASE); return (HWREGB(ui32Base + USB_O_DEVCTL) & (USB_DEVCTL_DEV | USB_DEVCTL_HOST | USB_DEVCTL_SESSION | USB_DEVCTL_VBUS_M)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Deinitializes the LCD Controller registers to their default reset values. */
void LCD_DeInit(void)
/* Deinitializes the LCD Controller registers to their default reset values. */ void LCD_DeInit(void)
{ uint8_t counter = 0; LCD->CR1 = LCD_CR1_RESET_VALUE; LCD->CR2 = LCD_CR2_RESET_VALUE; LCD->CR3 = LCD_CR3_RESET_VALUE; LCD->FRQ = LCD_FRQ_RESET_VALUE; for (counter = 0;counter < 0x05; counter++) { LCD->PM[counter] = LCD_PM_RESET_VALUE; } for (counter = 0;counter < 0x16; counter++) { LCD->RAM[counter] = LCD_RAM_RESET_VALUE; } LCD->CR4 = LCD_CR4_RESET_VALUE; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Sets the direction and mode of the specified pin. where */
void GPIODirModeSet(unsigned long ulPort, unsigned long ulBit, unsigned long ulPinIO)
/* Sets the direction and mode of the specified pin. where */ void GPIODirModeSet(unsigned long ulPort, unsigned long ulBit, unsigned long ulPinIO)
{ xASSERT(GPIOBaseValid(ulPort)); xASSERT((ulPinIO == GPIO_DIR_MODE_IN) || (ulPinIO == GPIO_DIR_MODE_OUT) || (ulPinIO == GPIO_DIR_MODE_HW) || (ulPinIO == GPIO_DIR_MODE_OD) || (ulPinIO == GPIO_DIR_MODE_QB)); xHWREG(ulPort + GPIO_PMD) = (xHWREG(ulPort + GPIO_PMD) & \ (~(3 << (ulBit * 2)))); xHWREG(ulPort + GPIO_PMD) = (xHWREG(ulPort + GPIO_PMD) | \ ((ulPinIO & GPIO_PMD_PMD0_M) << (ulBit * 2))); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Perform any hardware configuration necessary to generate the tick interrupt. */
static void prvSetupTimerInterrupt(void)
/* Perform any hardware configuration necessary to generate the tick interrupt. */ static void prvSetupTimerInterrupt(void)
{ counter1->reload = ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1; counter1->value = counter1->reload; counter1->mask = 1; irq[ IRQ_COUNTER1 ].ien = 1; }
labapart/polymcu
C++
null
201
/* Check if sector(s) have proper number and additionally check if they're allocated in bitmap. */
int hpfs_chk_sectors(struct super_block *s, secno start, int len, char *msg)
/* Check if sector(s) have proper number and additionally check if they're allocated in bitmap. */ int hpfs_chk_sectors(struct super_block *s, secno start, int len, char *msg)
{ if (start + len < start || start < 0x12 || start + len > hpfs_sb(s)->sb_fs_size) { hpfs_error(s, "sector(s) '%s' badly placed at %08x", msg, start); return 1; } if (hpfs_sb(s)->sb_chk>=2) { int i; for (i = 0; i < len; i++) if (chk_if_allocated(s, start + i, msg)) return 1; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Checks and adjusts current CPU features per dependency relationship. */
BOOLEAN InsertToAfterEntry(IN LIST_ENTRY *FeatureList, IN LIST_ENTRY *CurrentEntry, IN UINT8 *FeatureMask)
/* Checks and adjusts current CPU features per dependency relationship. */ BOOLEAN InsertToAfterEntry(IN LIST_ENTRY *FeatureList, IN LIST_ENTRY *CurrentEntry, IN UINT8 *FeatureMask)
{ LIST_ENTRY *CheckEntry; CPU_FEATURES_ENTRY *CheckFeature; BOOLEAN Swapped; Swapped = FALSE; CheckEntry = GetNextNode (FeatureList, CurrentEntry); while (!IsNull (FeatureList, CheckEntry)) { CheckFeature = CPU_FEATURE_ENTRY_FROM_LINK (CheckEntry); if (IsBitMaskMatchCheck (CheckFeature->FeatureMask, FeatureMask)) { AdjustEntry (FeatureList, CheckEntry, CurrentEntry, FALSE); Swapped = TRUE; break; } CheckEntry = CheckEntry->ForwardLink; } return Swapped; }
tianocore/edk2
C++
Other
4,240
/* Sets the receive address array register at index to the address passed in by addr. */
void e1000e_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
/* Sets the receive address array register at index to the address passed in by addr. */ void e1000e_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
{ u32 rar_low, rar_high; rar_low = ((u32) addr[0] | ((u32) addr[1] << 8) | ((u32) addr[2] << 16) | ((u32) addr[3] << 24)); rar_high = ((u32) addr[4] | ((u32) addr[5] << 8)); if (rar_low || rar_high) rar_high |= E1000_RAH_AV; ew32(RAL(index), rar_low); e1e_flush(); ew32(RAH(index), rar_high); e1e_flush(); }
robutest/uclinux
C++
GPL-2.0
60
/* Performs the touch-bit function, which writes a 0 or 1 and reads the level. */
static u8 ds2482_w1_touch_bit(void *data, u8 bit)
/* Performs the touch-bit function, which writes a 0 or 1 and reads the level. */ static u8 ds2482_w1_touch_bit(void *data, u8 bit)
{ struct ds2482_w1_chan *pchan = data; struct ds2482_data *pdev = pchan->pdev; int status = -1; mutex_lock(&pdev->access_lock); ds2482_wait_1wire_idle(pdev); if (pdev->w1_count > 1) ds2482_set_channel(pdev, pchan->channel); if (!ds2482_send_cmd_data(pdev, DS2482_CMD_1WIRE_SINGLE_BIT, bit ? 0xFF : 0)) status = ds2482_wait_1wire_idle(pdev); mutex_unlock(&pdev->access_lock); return (status & DS2482_REG_STS_SBR) ? 1 : 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function gets the FSP info header pointer using the API stack context. */
FSP_INFO_HEADER* EFIAPI GetFspInfoHeaderFromApiContext(VOID)
/* This function gets the FSP info header pointer using the API stack context. */ FSP_INFO_HEADER* EFIAPI GetFspInfoHeaderFromApiContext(VOID)
{ FSP_GLOBAL_DATA *FspData; FspData = GetFspGlobalDataPointer (); return (FSP_INFO_HEADER *)(*(UINTN *)(FspData->CoreStack + CONTEXT_STACK_OFFSET (FspInfoHeader))); }
tianocore/edk2
C++
Other
4,240
/* Migrate Single PPI Pointer from the temporary memory to PEI installed memory. */
VOID ConvertSinglePpiPointer(IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, IN PEI_CORE_INSTANCE *PrivateData, IN PEI_PPI_LIST_POINTERS *PpiPointer)
/* Migrate Single PPI Pointer from the temporary memory to PEI installed memory. */ VOID ConvertSinglePpiPointer(IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, IN PEI_CORE_INSTANCE *PrivateData, IN PEI_PPI_LIST_POINTERS *PpiPointer)
{ ConvertPointerInRanges (SecCoreData, PrivateData, &PpiPointer->Raw); ConvertPointerInRanges (SecCoreData, PrivateData, (VOID **)&PpiPointer->Ppi->Guid); ConvertPointerInRanges (SecCoreData, PrivateData, (VOID **)&PpiPointer->Ppi->Ppi); }
tianocore/edk2
C++
Other
4,240
/* Returns: the user name of the current user. */
const gchar* g_get_user_name(void)
/* Returns: the user name of the current user. */ const gchar* g_get_user_name(void)
{ UserDatabaseEntry *entry; entry = g_get_user_database_entry (); return entry->user_name; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function is called when the file is being removed from the task's fd array. POSIX locks belonging to this task are deleted at this time. */
void locks_remove_posix(struct file *filp, fl_owner_t owner)
/* This function is called when the file is being removed from the task's fd array. POSIX locks belonging to this task are deleted at this time. */ void locks_remove_posix(struct file *filp, fl_owner_t owner)
{ struct file_lock lock; if (!filp->f_path.dentry->d_inode->i_flock) return; lock.fl_type = F_UNLCK; lock.fl_flags = FL_POSIX | FL_CLOSE; lock.fl_start = 0; lock.fl_end = OFFSET_MAX; lock.fl_owner = owner; lock.fl_pid = current->tgid; lock.fl_file = filp; lock.fl_ops = NULL; lock.fl_lmops = NULL; vfs_lock_file(filp, F_SETLK, &lock, NULL); if (lock.fl_ops && lock.fl_ops->fl_release_private) lock.fl_ops->fl_release_private(&lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Copy pixels from SRAM to the screen. Limits have to be set prior to calling this function, e.g.: */
void ili9325_copy_raw_pixel_24bits_to_screen(const uint8_t *raw_pixels, uint32_t count)
/* Copy pixels from SRAM to the screen. Limits have to be set prior to calling this function, e.g.: */ void ili9325_copy_raw_pixel_24bits_to_screen(const uint8_t *raw_pixels, uint32_t count)
{ ili9325_color_t pixels; Assert(count > 0); LCD_IR(0); LCD_IR(ILI9325_GRAM_DATA_REG); while (count--) { pixels = (*raw_pixels) | (*(raw_pixels+1)) << 8 | *(raw_pixels+2)<<16; LCD_WD((pixels >> 16) & 0xFF); LCD_WD((pixels >> 8) & 0xFF); LCD_WD(pixels & 0xFF); raw_pixels +=3; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* destroy_done_tree - destroy the done tree. @done_tree: done tree to destroy */
static void destroy_done_tree(struct rb_root *done_tree)
/* destroy_done_tree - destroy the done tree. @done_tree: done tree to destroy */ static void destroy_done_tree(struct rb_root *done_tree)
{ struct done_ref *dr, *n; rbtree_postorder_for_each_entry_safe(dr, n, done_tree, rb) kfree(dr); }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function is called from setup_arch() to reserve the pages needed for ST-RAM management. */
void __init atari_stram_reserve_pages(void *start_mem)
/* This function is called from setup_arch() to reserve the pages needed for ST-RAM management. */ void __init atari_stram_reserve_pages(void *start_mem)
{ if (!kernel_in_stram) reserve_bootmem(0, PAGE_SIZE, BOOTMEM_DEFAULT); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns the interrupt number for a given ADC base address and sequence number. */
static uint_fast8_t _ADCIntNumberGet(uint32_t ui32Base, uint32_t ui32SequenceNum)
/* Returns the interrupt number for a given ADC base address and sequence number. */ static uint_fast8_t _ADCIntNumberGet(uint32_t ui32Base, uint32_t ui32SequenceNum)
{ uint_fast8_t ui8Int; ui8Int = ((ui32Base == ADC0_BASE) ? (INT_ADC0SS0 + ui32SequenceNum) : (INT_ADC1SS0 + ui32SequenceNum)); return (ui8Int); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read BMA222 device ID and revision numbers. This function reads the accelerometer hardware identification registers and returns these values in the specified data structure. */
static bool bma222_device_id(sensor_hal_t *hal, sensor_data_t *data)
/* Read BMA222 device ID and revision numbers. This function reads the accelerometer hardware identification registers and returns these values in the specified data structure. */ static bool bma222_device_id(sensor_hal_t *hal, sensor_data_t *data)
{ data->device.id = sensor_bus_get(hal, BMA222_CHIP_ID); data->device.version = 0; return (STATUS_OK == hal->bus.status); }
memfault/zero-to-main
C++
null
200
/* NWWN based Lookup for a R-Port in the Port R-Port Queue */
struct bfa_fcs_rport_s* bfa_fcs_port_get_rport_by_nwwn(struct bfa_fcs_port_s *port, wwn_t nwwn)
/* NWWN based Lookup for a R-Port in the Port R-Port Queue */ struct bfa_fcs_rport_s* bfa_fcs_port_get_rport_by_nwwn(struct bfa_fcs_port_s *port, wwn_t nwwn)
{ struct bfa_fcs_rport_s *rport; struct list_head *qe; list_for_each(qe, &port->rport_q) { rport = (struct bfa_fcs_rport_s *)qe; if (wwn_is_equal(rport->nwwn, nwwn)) return rport; } bfa_trc(port->fcs, nwwn); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Skip over an ASN.1 object type completely. Get ready to read the next object. */
int ICACHE_FLASH_ATTR asn1_skip_obj(const uint8_t *buf, int *offset, int obj_type)
/* Skip over an ASN.1 object type completely. Get ready to read the next object. */ int ICACHE_FLASH_ATTR asn1_skip_obj(const uint8_t *buf, int *offset, int obj_type)
{ int len; if (buf[*offset] != obj_type) return X509_NOT_OK; (*offset)++; len = get_asn1_length(buf, offset); *offset += len; return 0; }
eerimoq/simba
C++
Other
337