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
/* The ST_CRTR is updated asynchronously to the master clock ... but the updates as seen by the CPU don't seem to be strictly monotonic. Waiting until we read the same value twice avoids glitching. */
static unsigned long read_CRTR(void)
/* The ST_CRTR is updated asynchronously to the master clock ... but the updates as seen by the CPU don't seem to be strictly monotonic. Waiting until we read the same value twice avoids glitching. */ static unsigned long read_CRTR(void)
{ unsigned long x1, x2; x1 = at91_sys_read(AT91_ST_CRTR); do { x2 = at91_sys_read(AT91_ST_CRTR); if (x1 == x2) break; x1 = x2; } while (1); return x1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Sets the seed for the random number generator #GRand to @seed. */
void g_rand_set_seed(GRand *rand, guint32 seed)
/* Sets the seed for the random number generator #GRand to @seed. */ void g_rand_set_seed(GRand *rand, guint32 seed)
{ g_return_if_fail (rand != NULL); switch (get_random_version ()) { case 20: if (seed == 0) seed = 0x6b842128; rand->mt[0]= seed; for (rand->mti=1; rand->mti<N; rand->mti++) rand->mt[rand->mti] = (69069 * rand->mt[rand->mti-1]); break; case 22: rand->mt[0]= seed; for (rand->mti=1; rand->mti<N; rand->mti++) rand->mt[rand->mti] = 1812433253UL * (rand->mt[rand->mti-1] ^ (rand->mt[rand->mti-1] >> 30)) + rand->mti; break; default: g_assert_not_reached (); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* returns 0 on success, -EINVAL if MTU is out of valid range. (valid range is 576 .. 65527). If VM is on the remote side, maximum MTU is 32760, however this is not checked here. */
static int ctcm_change_mtu(struct net_device *dev, int new_mtu)
/* returns 0 on success, -EINVAL if MTU is out of valid range. (valid range is 576 .. 65527). If VM is on the remote side, maximum MTU is 32760, however this is not checked here. */ static int ctcm_change_mtu(struct net_device *dev, int new_mtu)
{ struct ctcm_priv *priv; int max_bufsize; if (new_mtu < 576 || new_mtu > 65527) return -EINVAL; priv = dev->ml_priv; max_bufsize = priv->channel[READ]->max_bufsize; if (IS_MPC(priv)) { if (new_mtu > max_bufsize - TH_HEADER_LENGTH) return -EINVAL; dev->hard_header_len = TH_HEADER_LENGTH + PDU_HEADER_LENGTH; } else { if (new_mtu > max_bufsize - LL_HEADER_LENGTH - 2) return -EINVAL; dev->hard_header_len = LL_HEADER_LENGTH + 2; } dev->mtu = new_mtu; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Enable I2C wake up of the specified I2C port. The */
void I2CWakeupEnable(unsigned long ulBase)
/* Enable I2C wake up of the specified I2C port. The */ void I2CWakeupEnable(unsigned long ulBase)
{ xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE))); xHWREGB(ulBase + I2C_CON1) |= I2C_CON1_WUEN; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Created on: 12 feb. 2019 Author: Daniel Mårtensson Take power p, on all element on the diagonal of matrix A, who has the size row x column */
void diagpower(double *A, double p, int row, int column)
/* Created on: 12 feb. 2019 Author: Daniel Mårtensson Take power p, on all element on the diagonal of matrix A, who has the size row x column */ void diagpower(double *A, double p, int row, int column)
{ for(int j = 0; j < column; j++){ if(j == i){ *(A) = powf(*(A), p); A += column + 1; } } } }
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* Fills each SPI_Config_T member with its default value. */
void SPI_ConfigStructInit(SPI_Config_T *spiConfig)
/* Fills each SPI_Config_T member with its default value. */ void SPI_ConfigStructInit(SPI_Config_T *spiConfig)
{ spiConfig->direction = SPI_DIRECTION_2LINES_FULLDUPLEX; spiConfig->mode = SPI_MODE_SLAVE; spiConfig->length = SPI_DATA_LENGTH_8B; spiConfig->polarity = SPI_CLKPOL_LOW; spiConfig->phase = SPI_CLKPHA_1EDGE; spiConfig->nss = SPI_NSS_HARD; spiConfig->baudrateDiv = SPI_BAUDRATE_DIV_2; spiConfig->firstBit = SPI_FIRSTBIT_MSB; spiConfig->crcPolynomial = 7; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read data off the transport. This can be either an RPC_CALL or an RPC_REPLY. Relay the processing to helper functions. */
static void xs_tcp_read_data(struct rpc_xprt *xprt, struct xdr_skb_reader *desc)
/* Read data off the transport. This can be either an RPC_CALL or an RPC_REPLY. Relay the processing to helper functions. */ static void xs_tcp_read_data(struct rpc_xprt *xprt, struct xdr_skb_reader *desc)
{ struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); if (_xs_tcp_read_data(xprt, desc) == 0) xs_tcp_check_fraghdr(transport); else { transport->tcp_flags &= ~TCP_RCV_COPY_DATA; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ppc440spe_desc_init_null_xor - initialize the descriptor for NULL XOR pseudo operation */
static void ppc440spe_desc_init_null_xor(struct ppc440spe_adma_desc_slot *desc)
/* ppc440spe_desc_init_null_xor - initialize the descriptor for NULL XOR pseudo operation */ static void ppc440spe_desc_init_null_xor(struct ppc440spe_adma_desc_slot *desc)
{ memset(desc->hw_desc, 0, sizeof(struct xor_cb)); desc->hw_next = NULL; desc->src_cnt = 0; desc->dst_cnt = 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Wait the operation register's bit as specified by Bit to become set (or clear). */
EFI_STATUS EhcWaitOpRegBit(IN PEI_USB2_HC_DEV *Ehc, IN UINT32 Offset, IN UINT32 Bit, IN BOOLEAN WaitToSet, IN UINT32 Timeout)
/* Wait the operation register's bit as specified by Bit to become set (or clear). */ EFI_STATUS EhcWaitOpRegBit(IN PEI_USB2_HC_DEV *Ehc, IN UINT32 Offset, IN UINT32 Bit, IN BOOLEAN WaitToSet, IN UINT32 Timeout)
{ UINT32 Index; for (Index = 0; Index < Timeout / EHC_SYNC_POLL_INTERVAL + 1; Index++) { if (EHC_REG_BIT_IS_SET (Ehc, Offset, Bit) == WaitToSet) { return EFI_SUCCESS; } MicroSecondDelay (EHC_SYNC_POLL_INTERVAL); } return EFI_TIMEOUT; }
tianocore/edk2
C++
Other
4,240
/* This function parses the PCC Subspace type 0. */
STATIC VOID DumpPccSubspaceType0(IN UINT8 *Ptr, IN UINT8 Length)
/* This function parses the PCC Subspace type 0. */ STATIC VOID DumpPccSubspaceType0(IN UINT8 *Ptr, IN UINT8 Length)
{ ParseAcpi ( TRUE, 2, "Subspace Type 0", Ptr, Length, PARSER_PARAMS (PccSubspaceType0Parser) ); }
tianocore/edk2
C++
Other
4,240
/* Retrieve the status of the control bits on a serial device. */
RETURN_STATUS EFIAPI SerialPortGetControl(OUT UINT32 *Control)
/* Retrieve the status of the control bits on a serial device. */ RETURN_STATUS EFIAPI SerialPortGetControl(OUT UINT32 *Control)
{ if (!mXenConsoleInterface) { return RETURN_UNSUPPORTED; } *Control = 0; if (!SerialPortPoll ()) { *Control = EFI_SERIAL_INPUT_BUFFER_EMPTY; } return RETURN_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Returns 0 on success, a negative error code otherwise. */
int nand_exit_status_op(struct nand_chip *chip)
/* Returns 0 on success, a negative error code otherwise. */ int nand_exit_status_op(struct nand_chip *chip)
{ struct mtd_info *mtd = nand_to_mtd(chip); chip->cmdfunc(mtd, NAND_CMD_READ0, -1, -1); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* param base IRTC peripheral base address param compensationValue Compensation value is a 2's complement value. param compensationInterval Compensation interval. */
void IRTC_SetCoarseCompensation(RTC_Type *base, uint8_t compensationValue, uint8_t compensationInterval)
/* param base IRTC peripheral base address param compensationValue Compensation value is a 2's complement value. param compensationInterval Compensation interval. */ void IRTC_SetCoarseCompensation(RTC_Type *base, uint8_t compensationValue, uint8_t compensationInterval)
{ uint16_t reg; base->COMPEN = (uint16_t)compensationValue | ((uint16_t)compensationInterval << 8U); reg = base->CTRL; reg &= ~(uint16_t)RTC_CTRL_FINEEN_MASK; reg |= RTC_CTRL_COMP_EN_MASK; base->CTRL = reg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns zero on success; non-zero if the flag set is invalid */
static int ecryptfs_process_flags(struct ecryptfs_crypt_stat *crypt_stat, char *page_virt, int *bytes_read)
/* Returns zero on success; non-zero if the flag set is invalid */ static int ecryptfs_process_flags(struct ecryptfs_crypt_stat *crypt_stat, char *page_virt, int *bytes_read)
{ int rc = 0; int i; u32 flags; flags = get_unaligned_be32(page_virt); for (i = 0; i < ((sizeof(ecryptfs_flag_map) / sizeof(struct ecryptfs_flag_map_elem))); i++) if (flags & ecryptfs_flag_map[i].file_flag) { crypt_stat->flags |= ecryptfs_flag_map[i].local_flag; } else crypt_stat->flags &= ~(ecryptfs_flag_map[i].local_flag); crypt_stat->file_version = ((flags >> 24) & 0xFF); (*bytes_read) = 4; return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* Heuristic interpreter for the ZigBee IP beacon dissectors. */
static gboolean dissect_zbip_beacon_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
/* Heuristic interpreter for the ZigBee IP beacon dissectors. */ static gboolean dissect_zbip_beacon_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{ ieee802154_packet *packet = (ieee802154_packet *)data; if (!packet) return FALSE; if (packet->src_addr_mode != IEEE802154_FCF_ADDR_SHORT) return FALSE; if (tvb_get_guint8(tvb, 0) != ZBEE_IP_BEACON_PROTOCOL_ID) return FALSE; dissect_zbip_beacon(tvb, pinfo, tree, packet); return TRUE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The LCD is written two by more than one task so is controlled by a 'gatekeeper' task. This is the only task that is actually permitted to access the LCD directly. Other tasks wanting to display a message send the message to the gatekeeper. */
void vLCDTask(void *pvParameters)
/* The LCD is written two by more than one task so is controlled by a 'gatekeeper' task. This is the only task that is actually permitted to access the LCD directly. Other tasks wanting to display a message send the message to the gatekeeper. */ void vLCDTask(void *pvParameters)
{ xLCDMessage xMessage; prvConfigureLCD(); LCD_DrawMonoPict( ( unsigned portLONG * ) pcBitmap ); for( ;; ) { while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS ); printf( ( portCHAR const * ) xMessage.pcMessage ); } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Validate behavior of thread when it yields. Spawn cooperative threads equal to number of cores, so last thread would be pending, call yield() from main thread. Now, all threads must be executed */
ZTEST(smp, test_yield_threads)
/* Validate behavior of thread when it yields. Spawn cooperative threads equal to number of cores, so last thread would be pending, call yield() from main thread. Now, all threads must be executed */ ZTEST(smp, test_yield_threads)
{ unsigned int num_threads = arch_num_cpus(); spawn_threads(K_PRIO_COOP(10), num_threads, !EQUAL_PRIORITY, &thread_entry_fn, !THREAD_DELAY); k_yield(); k_busy_wait(DELAY_US); for (int i = 0; i < num_threads; i++) { zassert_true(tinfo[i].executed == 1, "thread %d did not execute", i); } abort_threads(num_threads); cleanup_resources(); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* param base UTICK peripheral base address. param cb callback scheduled for this instance of UTICK return none */
void UTICK_HandleIRQ(UTICK_Type *base, utick_callback_t cb)
/* param base UTICK peripheral base address. param cb callback scheduled for this instance of UTICK return none */ void UTICK_HandleIRQ(UTICK_Type *base, utick_callback_t cb)
{ UTICK_ClearStatusFlags(base); if (cb != NULL) { cb(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This code checks if variable header is valid or not. */
BOOLEAN IsValidVariableHeader(IN VARIABLE_HEADER *Variable)
/* This code checks if variable header is valid or not. */ BOOLEAN IsValidVariableHeader(IN VARIABLE_HEADER *Variable)
{ if ((Variable == NULL) || (Variable->StartId != VARIABLE_DATA)) { return FALSE; } return TRUE; }
tianocore/edk2
C++
Other
4,240
/* Commit pending interrupts (added via ehci_raise_irq), at the rate allowed by "Interrupt Threshold Control". */
static void ehci_commit_irq(EHCIState *s)
/* Commit pending interrupts (added via ehci_raise_irq), at the rate allowed by "Interrupt Threshold Control". */ static void ehci_commit_irq(EHCIState *s)
{ uint32_t itc; if (!s->usbsts_pending) { return; } if (s->usbsts_frindex > s->frindex) { return; } itc = (s->usbcmd >> 16) & 0xff; s->usbsts |= s->usbsts_pending; s->usbsts_pending = 0; s->usbsts_frindex = s->frindex + itc; ehci_update_irq(s); }
ve3wwg/teensy3_qemu
C++
Other
15
/* This is how the idle thread halts the CPU and gets halted until the HW models raise a new interrupt; and how the HW models awake the CPU, and wait for it to complete and go to idle. */
void posix_change_cpu_state_and_wait(bool halted)
/* This is how the idle thread halts the CPU and gets halted until the HW models raise a new interrupt; and how the HW models awake the CPU, and wait for it to complete and go to idle. */ void posix_change_cpu_state_and_wait(bool halted)
{ if (halted) { nce_halt_cpu(nce_st); } else { nce_wake_cpu(nce_st); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Convert an ASCII char representing an hexadecimal number to its integer value. */
UINT8 EFIAPI HexFromAscii(IN CHAR8 Char)
/* Convert an ASCII char representing an hexadecimal number to its integer value. */ UINT8 EFIAPI HexFromAscii(IN CHAR8 Char)
{ if ((Char >= '0') && (Char <= '9')) { return (UINT8)(Char - '0'); } if ((Char >= 'A') && (Char <= 'F')) { return (UINT8)(Char - 'A' + 10); } if ((Char >= 'a') && (Char <= 'f')) { return (UINT8)(Char - 'a' + 10); } ASSERT (FALSE); return (UINT8)-1; }
tianocore/edk2
C++
Other
4,240
/* Returns: (array length=n_children) (transfer full): Newly allocated and 0-terminated array of child types, free with g_free() */
GType* g_type_children(GType type, guint *n_children)
/* Returns: (array length=n_children) (transfer full): Newly allocated and 0-terminated array of child types, free with g_free() */ GType* g_type_children(GType type, guint *n_children)
{ TypeNode *node; node = lookup_type_node_I (type); if (node) { GType *children; G_READ_LOCK (&type_rw_lock); children = g_new (GType, node->n_children + 1); memcpy (children, node->children, sizeof (GType) * node->n_children); children[node->n_children] = 0; if (n_children) *n_children = node->n_children; G_READ_UNLOCK (&type_rw_lock); return children; } else { if (n_children) *n_children = 0; return NULL; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function is executed in case of error occurrence. */
static void Error_Handler(void)
/* This function is executed in case of error occurrence. */ static void Error_Handler(void)
{ BSP_LED_On(LED2); HAL_Delay(1000); BSP_LED_Off(LED2); HAL_Delay(1000); while(1) { } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This code gets the pointer to the next variable header. */
VARIABLE_HEADER* GetNextVariablePtr(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFormat)
/* This code gets the pointer to the next variable header. */ VARIABLE_HEADER* GetNextVariablePtr(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFormat)
{ UINTN Value; Value = (UINTN)GetVariableDataPtr (Variable, AuthFormat); Value += DataSizeOfVariable (Variable, AuthFormat); Value += GET_PAD_SIZE (DataSizeOfVariable (Variable, AuthFormat)); return (VARIABLE_HEADER *)HEADER_ALIGN (Value); }
tianocore/edk2
C++
Other
4,240
/* Programs a half word at a specified address. */
FMC_STATUS_T FMC_ProgramHalfWord(uint32_t address, uint16_t data)
/* Programs a half word at a specified address. */ FMC_STATUS_T FMC_ProgramHalfWord(uint32_t address, uint16_t data)
{ FMC_STATUS_T status = FMC_STATUS_COMPLETE; __set_PRIMASK(1); status = FMC_WaitForLastOperation(0x000B0000); if(status == FMC_STATUS_COMPLETE) { FMC->CTRL2_B.PG = BIT_SET; *(__IOM uint16_t *)address = data; status = FMC_WaitForLastOperation(0x000B0000); FMC->CTRL2_B.PG = BIT_RESET; } __set_PRIMASK(0); return status; }
pikasTech/PikaPython
C++
MIT License
1,403
/* ARMv7-specific implementation of memory unmapping at run-time Unmaps memory according to the parameters provided by the caller at run-time. */
static int __arch_mem_unmap(void *addr, size_t size)
/* ARMv7-specific implementation of memory unmapping at run-time Unmaps memory according to the parameters provided by the caller at run-time. */ static int __arch_mem_unmap(void *addr, size_t size)
{ uint32_t va = (uint32_t)addr; uint32_t rem_size = (uint32_t)size; int key; if (addr == NULL) { LOG_ERR("Cannot unmap virtual memory: invalid NULL pointer"); return -EINVAL; } if (size == 0) { LOG_ERR("Cannot unmap virtual memory at 0x%08X: invalid " "zero size", (uint32_t)addr); return -EINVAL; } key = arch_irq_lock(); while (rem_size > 0) { arm_mmu_l2_unmap_page(va); rem_size -= (rem_size >= KB(4)) ? KB(4) : rem_size; va += KB(4); } arch_irq_unlock(key); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Configures the discontinuous mode for the selected ADC regular group channel. */
void ADC_DiscModeChannelCountConfig(ADC_TypeDef *ADCx, uint8_t Number)
/* Configures the discontinuous mode for the selected ADC regular group channel. */ void ADC_DiscModeChannelCountConfig(ADC_TypeDef *ADCx, uint8_t Number)
{ uint32_t tmpreg1 = 0; uint32_t tmpreg2 = 0; assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_ADC_REGULAR_DISC_NUMBER(Number)); tmpreg1 = ADCx->CR1; tmpreg1 &= (uint32_t)(~ADC_CR1_DISCNUM); tmpreg2 = Number - 1; tmpreg1 |= tmpreg2 << 13; ADCx->CR1 = tmpreg1; }
avem-labs/Avem
C++
MIT License
1,752
/* param base FlexCAN peripheral base pointer. param rxFrame Pointer to CAN message frame structure for reception. retval kStatus_Success - Read Message from Rx FIFO successfully. retval kStatus_Fail - Rx FIFO is not enabled. */
status_t FLEXCAN_TransferReceiveFifoBlocking(CAN_Type *base, flexcan_frame_t *rxFrame)
/* param base FlexCAN peripheral base pointer. param rxFrame Pointer to CAN message frame structure for reception. retval kStatus_Success - Read Message from Rx FIFO successfully. retval kStatus_Fail - Rx FIFO is not enabled. */ status_t FLEXCAN_TransferReceiveFifoBlocking(CAN_Type *base, flexcan_frame_t *rxFrame)
{ status_t rxFifoStatus; while (!FLEXCAN_GetMbStatusFlags(base, kFLEXCAN_RxFifoFrameAvlFlag)) { } rxFifoStatus = FLEXCAN_ReadRxFifo(base, rxFrame); FLEXCAN_ClearMbStatusFlags(base, kFLEXCAN_RxFifoFrameAvlFlag); return rxFifoStatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function called from I2C IRQ Handler when STOP flag is set Function is in charge of checking data received, LED2 is On if data are correct. */
void Slave_Complete_Callback(void)
/* Function called from I2C IRQ Handler when STOP flag is set Function is in charge of checking data received, LED2 is On if data are correct. */ void Slave_Complete_Callback(void)
{ if(Buffercmp8((uint8_t*)aReceiveBuffer, (uint8_t*)aLedOn, (ubReceiveIndex-1)) == 0) { LED_On(); } else { Error_Callback(); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Function for scheduling a timer list update by generating a SWI interrupt. */
static void timer_list_handler_sched(void)
/* Function for scheduling a timer list update by generating a SWI interrupt. */ static void timer_list_handler_sched(void)
{ NVIC_SetPendingIRQ(SWI_IRQn); }
labapart/polymcu
C++
null
201
/* Invert byte order within each 16-bits of an array. */
TwoByteSwap(unsigned char *buf, size_t nbytes)
/* Invert byte order within each 16-bits of an array. */ TwoByteSwap(unsigned char *buf, size_t nbytes)
{ for ( ; nbytes >= 2; nbytes -= 2, buf += 2 ) { unsigned char c; c = buf[0]; buf[0] = buf[1]; buf[1] = c; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Hashes ip_vs_conn in ip_vs_conn_tab by proto,addr,port. returns bool success. */
static int ip_vs_conn_hash(struct ip_vs_conn *cp)
/* Hashes ip_vs_conn in ip_vs_conn_tab by proto,addr,port. returns bool success. */ static int ip_vs_conn_hash(struct ip_vs_conn *cp)
{ unsigned hash; int ret; hash = ip_vs_conn_hashkey(cp->af, cp->protocol, &cp->caddr, cp->cport); ct_write_lock(hash); if (!(cp->flags & IP_VS_CONN_F_HASHED)) { list_add(&cp->c_list, &ip_vs_conn_tab[hash]); cp->flags |= IP_VS_CONN_F_HASHED; atomic_inc(&cp->refcnt); ret = 1; } else { pr_err("%s(): request for already hashed, called from %pF\n", __func__, __builtin_return_address(0)); ret = 0; } ct_write_unlock(hash); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This API sets the auxiliary Mag(BMM150 or AKM9916) output data rate and offset. */
uint16_t bma4_set_aux_mag_config(const struct bma4_aux_mag_config *aux_mag, struct bma4_dev *dev)
/* This API sets the auxiliary Mag(BMM150 or AKM9916) output data rate and offset. */ uint16_t bma4_set_aux_mag_config(const struct bma4_aux_mag_config *aux_mag, struct bma4_dev *dev)
{ uint16_t rslt = 0; uint8_t data = 0; if (dev == NULL) { rslt |= BMA4_E_NULL_PTR; } else { if ((aux_mag->odr >= BMA4_OUTPUT_DATA_RATE_0_78HZ) && (aux_mag->odr <= BMA4_OUTPUT_DATA_RATE_1600HZ) && ((aux_mag->offset & BMA4_MAG_CONFIG_OFFSET_MSK) == 0x00)) { data = (uint8_t)(aux_mag->odr | ((aux_mag->offset << BMA4_MAG_CONFIG_OFFSET_POS))); rslt |= bma4_write_regs(BMA4_AUX_CONFIG_ADDR, &data, 1, dev); } else { rslt |= BMA4_E_OUT_OF_RANGE; } } return rslt; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* DevicePathNode must be SerialHDD Channel type and this will populate the MappingItem. */
EFI_STATUS DevPathSerialHardDrive(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
/* DevicePathNode must be SerialHDD Channel type and this will populate the MappingItem. */ EFI_STATUS DevPathSerialHardDrive(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
{ HARDDRIVE_DEVICE_PATH *Hd; ASSERT (DevicePathNode != NULL); ASSERT (MappingItem != NULL); Hd = (HARDDRIVE_DEVICE_PATH *)DevicePathNode; if (MappingItem->Mtd == MTDTypeUnknown) { MappingItem->Mtd = MTDTypeHardDisk; } return AppendCSDNum (MappingItem, Hd->PartitionNumber); }
tianocore/edk2
C++
Other
4,240
/* Through the threshold value judgment,per channel can redefine as the state mode . */
uint8_t GetChannelSensorState(uint8_t Ch)
/* Through the threshold value judgment,per channel can redefine as the state mode . */ uint8_t GetChannelSensorState(uint8_t Ch)
{ if (Ch == CHANNEL_0) { return ((uint8_t)((LPRCNT->CAL0 >> 8) & 0x3)); } else if (Ch == CHANNEL_1) { return ((uint8_t)((LPRCNT->CAL0 >> 24) & 0x3)); } else if (Ch == CHANNEL_2) { return ((uint8_t)((LPRCNT->CAL1 >> 8) & 0x3)); } else { return CHANNEL_ERROR; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ADC Disable The VBat Sensor. Disabling this will reduce power consumption from the battery voltage measurement. */
void adc_disable_vbat_sensor(void)
/* ADC Disable The VBat Sensor. Disabling this will reduce power consumption from the battery voltage measurement. */ void adc_disable_vbat_sensor(void)
{ ADC_CCR(ADC1) &= ~ADC_CCR_VBATEN; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Drain the reassembly queue. If we just cleared parted delivery, it is possible that the reassembly queue will contain already reassembled messages. Retrieve any such messages and give them to the user. */
static void sctp_ulpq_reasm_drain(struct sctp_ulpq *ulpq)
/* Drain the reassembly queue. If we just cleared parted delivery, it is possible that the reassembly queue will contain already reassembled messages. Retrieve any such messages and give them to the user. */ static void sctp_ulpq_reasm_drain(struct sctp_ulpq *ulpq)
{ struct sctp_ulpevent *event = NULL; struct sk_buff_head temp; if (skb_queue_empty(&ulpq->reasm)) return; while ((event = sctp_ulpq_retrieve_reassembled(ulpq)) != NULL) { if ((event) && (event->msg_flags & MSG_EOR)){ skb_queue_head_init(&temp); __skb_queue_tail(&temp, sctp_event2skb(event)); event = sctp_ulpq_order(ulpq, event); } if (event) sctp_ulpq_tail_event(ulpq, event); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* set the interface value to the connected device */
usbh_status usbh_setdevfeature(usbh_host *uhost, uint8_t feature_selector, uint16_t windex)
/* set the interface value to the connected device */ usbh_status usbh_setdevfeature(usbh_host *uhost, uint8_t feature_selector, uint16_t windex)
{ usbh_status status = USBH_BUSY; usbh_control *usb_ctl = &uhost->control; if (CTL_IDLE == usb_ctl->ctl_state) { usb_ctl->setup.req = (usb_req) { .bmRequestType = USB_TRX_OUT | USB_RECPTYPE_DEV | USB_REQTYPE_STRD, .bRequest = USB_SET_FEATURE, .wValue = feature_selector, .wIndex = windex, .wLength = 0U }; usbh_ctlstate_config (uhost, NULL, 0U); } status = usbh_ctl_handler (uhost); return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If the kobject was not able to be created, NULL will be returned. The kobject structure returned from here must be cleaned up with a call to kobject_put() and not kfree(), as kobject_init() has already been called on this structure. */
struct kobject* kobject_create(void)
/* If the kobject was not able to be created, NULL will be returned. The kobject structure returned from here must be cleaned up with a call to kobject_put() and not kfree(), as kobject_init() has already been called on this structure. */ struct kobject* kobject_create(void)
{ struct kobject *kobj; kobj = kzalloc(sizeof(*kobj), GFP_KERNEL); if (!kobj) return NULL; kobject_init(kobj, &dynamic_kobj_ktype); return kobj; }
robutest/uclinux
C++
GPL-2.0
60
/* This function finds the table specified by the buffer. */
EFI_ACPI_TABLE_LIST* FindTableByBuffer(IN VOID *Buffer)
/* This function finds the table specified by the buffer. */ EFI_ACPI_TABLE_LIST* FindTableByBuffer(IN VOID *Buffer)
{ EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance; LIST_ENTRY *CurrentLink; EFI_ACPI_TABLE_LIST *CurrentTableList; LIST_ENTRY *StartLink; AcpiTableInstance = SdtGetAcpiTableInstance (); StartLink = &AcpiTableInstance->TableList; CurrentLink = StartLink->ForwardLink; while (CurrentLink != StartLink) { CurrentTableList = EFI_ACPI_TABLE_LIST_FROM_LINK (CurrentLink); if (((UINTN)CurrentTableList->Table <= (UINTN)Buffer) && ((UINTN)CurrentTableList->Table + CurrentTableList->TableSize > (UINTN)Buffer)) { return CurrentTableList; } CurrentLink = CurrentLink->ForwardLink; } return NULL; }
tianocore/edk2
C++
Other
4,240
/* Most of these aren't static because they may be used by the parport_xxx_yyy macros. extern */
static void parport_pc_init_state(struct pardevice *dev, struct parport_state *s)
/* Most of these aren't static because they may be used by the parport_xxx_yyy macros. extern */ static void parport_pc_init_state(struct pardevice *dev, struct parport_state *s)
{ s->u.pc.ctr = 0xc; if (dev->irq_func && dev->port->irq != PARPORT_IRQ_NONE) s->u.pc.ctr |= 0x10; s->u.pc.ecr = 0x34; }
robutest/uclinux
C++
GPL-2.0
60
/* Some Titan cards are also a little weird */
static int titan_400l_800l_setup(struct serial_private *priv, const struct pciserial_board *board, struct uart_port *port, int idx)
/* Some Titan cards are also a little weird */ static int titan_400l_800l_setup(struct serial_private *priv, const struct pciserial_board *board, struct uart_port *port, int idx)
{ unsigned int bar, offset = board->first_offset; switch (idx) { case 0: bar = 1; break; case 1: bar = 2; break; default: bar = 4; offset = (idx - 2) * board->uart_offset; } return setup_port(priv, port, bar, offset, board->reg_shift); }
robutest/uclinux
C++
GPL-2.0
60
/* This is the entry point for Print DXE Driver. It installs the file explorer Protocol. */
EFI_STATUS EFIAPI FileExplorerEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* This is the entry point for Print DXE Driver. It installs the file explorer Protocol. */ EFI_STATUS EFIAPI FileExplorerEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; Status = gBS->InstallMultipleProtocolInterfaces ( &mFileExplorerThunkHandle, &gEfiFileExplorerProtocolGuid, &mFileExplorerProtocol, NULL ); ASSERT_EFI_ERROR (Status); return Status; }
tianocore/edk2
C++
Other
4,240
/* The function unregisters previously registered polled input device from input layer. Polling is stopped and device is ready to be freed with call to input_free_polled_device(). */
void input_unregister_polled_device(struct input_polled_dev *dev)
/* The function unregisters previously registered polled input device from input layer. Polling is stopped and device is ready to be freed with call to input_free_polled_device(). */ void input_unregister_polled_device(struct input_polled_dev *dev)
{ sysfs_remove_group(&dev->input->dev.kobj, &input_polldev_attribute_group); input_unregister_device(dev->input); }
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 ArpComponentNameGetDriverName(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 ArpComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mArpDriverNameTable, DriverName, (BOOLEAN)(This == &gArpComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* config the pmc mode among run, wait and stop modes. */
void PMC_SetMode(PMC_Type *pPMC, uint8_t u8PmcMode)
/* config the pmc mode among run, wait and stop modes. */ void PMC_SetMode(PMC_Type *pPMC, uint8_t u8PmcMode)
{ switch(u8PmcMode & 0x3) { case PmcModeRun: break; case PmcModeWait: wait(); break; case PmcModeStop4: pPMC->SPMSC1 |= (PMC_SPMSC1_LVDE_MASK | PMC_SPMSC1_LVDSE_MASK); stop(); break; case PmcModeStop3: pPMC->SPMSC1 &= ~(PMC_SPMSC1_LVDE_MASK | PMC_SPMSC1_LVDRE_MASK | PMC_SPMSC1_LVDSE_MASK); stop(); break; default: break; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The function is used to Select Low-Voltage Detect Voltage. The */
void SysCtlLVDVolSet(unsigned long ulVoltage)
/* The function is used to Select Low-Voltage Detect Voltage. The */ void SysCtlLVDVolSet(unsigned long ulVoltage)
{ xASSERT((ulVoltage == SYSCTL_LVD_DET_LOW) || (ulVoltage == SYSCTL_LVD_DET_HIGH)); xHWREGB(PMC_LVDSC1) &= ~PMC_LVDSC1_LVDV_M; xHWREGB(PMC_LVDSC1) |= ulVoltage; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Get bus(which USART mounts on) clock frequency value. */
static uint32_t USART_GetBusClockFreq(const CM_USART_TypeDef *USARTx)
/* Get bus(which USART mounts on) clock frequency value. */ static uint32_t USART_GetBusClockFreq(const CM_USART_TypeDef *USARTx)
{ uint32_t u32BusClock; (void)USARTx; u32BusClock = SystemCoreClock >> (READ_REG32_BIT(CM_CMU->SCFGR, CMU_SCFGR_PCLK1S) >> CMU_SCFGR_PCLK1S_POS); return u32BusClock; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Configures the PLL clock source and multiplication factor. */
void RCM_ConfigPLL(RCM_PLL_SEL_T pllSelect, RCM_PLLMF_T pllMf)
/* Configures the PLL clock source and multiplication factor. */ void RCM_ConfigPLL(RCM_PLL_SEL_T pllSelect, RCM_PLLMF_T pllMf)
{ RCM->CFG1_B.PLLMULCFG = pllMf; RCM->CFG1_B.PLLSRCSEL = pllSelect; }
pikasTech/PikaPython
C++
MIT License
1,403
/* stops the event processor Stops the event processor and frees the event queue semaphore Called by the component de-initialization function, ixEthDBUnload() */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBStopLearningFunction(void)
/* stops the event processor Stops the event processor and frees the event queue semaphore Called by the component de-initialization function, ixEthDBUnload() */ IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBStopLearningFunction(void)
{ ixEthDBLearningShutdown = TRUE; ixOsalSemaphorePost(&eventQueueSemaphore); if (ixOsalSemaphoreDestroy(&eventQueueSemaphore) != IX_SUCCESS) { return IX_ETH_DB_FAIL; } return IX_ETH_DB_SUCCESS; }
EmcraftSystems/u-boot
C++
Other
181
/* Decode an Interface type, and display it on the tree. */
void get_CDR_interface(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, gboolean stream_is_big_endian, int boundary)
/* Decode an Interface type, and display it on the tree. */ void get_CDR_interface(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, gboolean stream_is_big_endian, int boundary)
{ decode_IOR(tvb, pinfo, tree, offset, boundary, stream_is_big_endian); return; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Locks the CCile to prevent any RF write access. Needs the I2C Password presentation to be effective. */
int32_t BSP_NFCTAG_WriteLockCCFile(uint32_t Instance, const ST25DV_CCFILE_BLOCK NbBlockCCFile, const ST25DV_LOCK_STATUS LockCCFile)
/* Locks the CCile to prevent any RF write access. Needs the I2C Password presentation to be effective. */ int32_t BSP_NFCTAG_WriteLockCCFile(uint32_t Instance, const ST25DV_CCFILE_BLOCK NbBlockCCFile, const ST25DV_LOCK_STATUS LockCCFile)
{ UNUSED(Instance); return ST25DV_WriteLockCCFile(&NfcTagObj, NbBlockCCFile, LockCCFile); }
eclipse-threadx/getting-started
C++
Other
310
/* Returns the count of the fixed arguments for the input Node. */
UINT8 AmlGetFixedArgumentCount(IN AML_OBJECT_NODE *Node)
/* Returns the count of the fixed arguments for the input Node. */ UINT8 AmlGetFixedArgumentCount(IN AML_OBJECT_NODE *Node)
{ if (IS_AML_OBJECT_NODE (Node) && (Node->AmlByteEncoding != NULL)) { return (UINT8)Node->AmlByteEncoding->MaxIndex; } return 0; }
tianocore/edk2
C++
Other
4,240
/* SYSCTRL DALI Bus&Function Clock Disable and Reset Assert. */
void LL_SYSCTRL_DALI_ClkDisRstAssert(void)
/* SYSCTRL DALI Bus&Function Clock Disable and Reset Assert. */ void LL_SYSCTRL_DALI_ClkDisRstAssert(void)
{ __LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL); __LL_SYSCTRL_DALIBusClk_Dis(SYSCTRL); __LL_SYSCTRL_DALISoftRst_Assert(SYSCTRL); __LL_SYSCTRL_Reg_Lock(SYSCTRL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* WHCI starts MMCs based on there being a valid GTK so these need only start/stop the asynchronous and periodic schedules and send a channel stop command. */
int whc_wusbhc_start(struct wusbhc *wusbhc)
/* WHCI starts MMCs based on there being a valid GTK so these need only start/stop the asynchronous and periodic schedules and send a channel stop command. */ int whc_wusbhc_start(struct wusbhc *wusbhc)
{ struct whc *whc = wusbhc_to_whc(wusbhc); asl_start(whc); pzl_start(whc); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Check the status of the Tx buffer of the specified SPI port. */
xtBoolean SPIIsTxEmpty(unsigned long ulBase)
/* Check the status of the Tx buffer of the specified SPI port. */ xtBoolean SPIIsTxEmpty(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)); return ((xHWREG(ulBase + SPI_SR) & SPI_SR_TXBE)? xfalse : xtrue); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function sets schedpolicy attribute. SCHED_OTHER Default Linux time-sharing scheduling. */
int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
/* This function sets schedpolicy attribute. SCHED_OTHER Default Linux time-sharing scheduling. */ int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
{ RT_ASSERT(attr != RT_NULL); attr->schedpolicy = policy; return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Routine: get_sdio2_config Description: Return information about the wifi module connection Returns 0 if the module connects though a level translator Returns 1 if the module connects directly */
int get_sdio2_config(void)
/* Routine: get_sdio2_config Description: Return information about the wifi module connection Returns 0 if the module connects though a level translator Returns 1 if the module connects directly */ int get_sdio2_config(void)
{ int sdio_direct; if (!gpio_request(130, "") && !gpio_request(139, "")) { gpio_direction_output(130, 0); gpio_direction_input(139); sdio_direct = 1; gpio_set_value(130, 0); if (gpio_get_value(139) == 0) { gpio_set_value(130, 1); if (gpio_get_value(139) == 1) sdio_direct = 0; } gpio_direction_input(130); } else { puts("Error: unable to acquire sdio2 clk GPIOs\n"); sdio_direct = -1; } return sdio_direct; }
4ms/stm32mp1-baremetal
C++
Other
137
/* If ExtendedData is NULL, then ASSERT(). If ExtendedDataSize is 0, then ASSERT(). */
EFI_STATUS EFIAPI ReportStatusCodeWithExtendedData(IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_VALUE Value, IN CONST VOID *ExtendedData, IN UINTN ExtendedDataSize)
/* If ExtendedData is NULL, then ASSERT(). If ExtendedDataSize is 0, then ASSERT(). */ EFI_STATUS EFIAPI ReportStatusCodeWithExtendedData(IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_VALUE Value, IN CONST VOID *ExtendedData, IN UINTN ExtendedDataSize)
{ ASSERT (ExtendedData != NULL); ASSERT (ExtendedDataSize != 0); return ReportStatusCodeEx ( Type, Value, 0, NULL, NULL, ExtendedData, ExtendedDataSize ); }
tianocore/edk2
C++
Other
4,240
/* Disables ISO 7816 smart card mode on the specified UART. */
void UARTSmartCardDisable(unsigned long ulBase)
/* Disables ISO 7816 smart card mode on the specified UART. */ void UARTSmartCardDisable(unsigned long ulBase)
{ ASSERT(!CLASS_IS_SANDSTORM && !CLASS_IS_FURY && !CLASS_IS_DUSTDEVIL); ASSERT(UARTBaseValid(ulBase)); HWREG(ulBase + UART_O_CTL) &= ~UART_CTL_SMART; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Initializes the QNX video plugin. Creates the Screen context and event handles used for all window operations by the plugin. */
static int videoInit(_THIS)
/* Initializes the QNX video plugin. Creates the Screen context and event handles used for all window operations by the plugin. */ static int videoInit(_THIS)
{ SDL_VideoDisplay display; if (screen_create_context(&context, 0) < 0) { return -1; } if (screen_create_event(&event) < 0) { return -1; } SDL_zero(display); if (SDL_AddVideoDisplay(&display) < 0) { return -1; } _this->num_displays = 1; return 0; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Registers a callback. Registers a callback function which is implemented by the user. */
void uart_register_callback(struct uart_module *const module, uart_callback_t callback_func, enum uart_callback callback_type)
/* Registers a callback. Registers a callback function which is implemented by the user. */ void uart_register_callback(struct uart_module *const module, uart_callback_t callback_func, enum uart_callback callback_type)
{ Assert(module); Assert(callback_func); module->callback[callback_type] = callback_func; module->callback_reg_mask |= (1 << callback_type); }
memfault/zero-to-main
C++
null
200
/* sunxi_lcd_backlight_enable - enable the backlight of panel. @screen_id: The index of screen. */
void sunxi_lcd_backlight_enable(u32 screen_id)
/* sunxi_lcd_backlight_enable - enable the backlight of panel. @screen_id: The index of screen. */ void sunxi_lcd_backlight_enable(u32 screen_id)
{ if (g_lcd_drv.src_ops.sunxi_lcd_backlight_enable) g_lcd_drv.src_ops.sunxi_lcd_backlight_enable(screen_id); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ZigBee Device Profile dissector for the store simple descriptor */
void dissect_zbee_zdp_req_store_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
/* ZigBee Device Profile dissector for the store simple descriptor */ void dissect_zbee_zdp_req_store_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{ guint offset = 0; guint64 ext_addr; zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); zbee_parse_uint(tree, hf_zbee_zdp_simple_length, tvb, &offset, (int)sizeof(guint8), NULL); zdp_parse_simple_desc(tree, ett_zbee_zdp_simple, tvb, &offset, version); zbee_append_info(tree, pinfo, ", Device: %s", eui64_to_display(wmem_packet_scope(), ext_addr)); zdp_dump_excess(tvb, offset, pinfo, tree); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Update the DBT form base on the input file path info. */
BOOLEAN EFIAPI UpdateDBTFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
/* Update the DBT form base on the input file path info. */ BOOLEAN EFIAPI UpdateDBTFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
{ return UpdatePage (FilePath, SECUREBOOT_ENROLL_SIGNATURE_TO_DBT); }
tianocore/edk2
C++
Other
4,240
/* returns 0 if blkio_group was still on cgroup list. Otherwise returns 1 indicating that blk_group was unhashed by the time we got to it. */
int blkiocg_del_blkio_group(struct blkio_group *blkg)
/* returns 0 if blkio_group was still on cgroup list. Otherwise returns 1 indicating that blk_group was unhashed by the time we got to it. */ int blkiocg_del_blkio_group(struct blkio_group *blkg)
{ struct blkio_cgroup *blkcg; unsigned long flags; struct cgroup_subsys_state *css; int ret = 1; rcu_read_lock(); css = css_lookup(&blkio_subsys, blkg->blkcg_id); if (!css) goto out; blkcg = container_of(css, struct blkio_cgroup, css); spin_lock_irqsave(&blkcg->lock, flags); if (!hlist_unhashed(&blkg->blkcg_node)) { __blkiocg_del_blkio_group(blkg); ret = 0; } spin_unlock_irqrestore(&blkcg->lock, flags); out: rcu_read_unlock(); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set direction of IO pins in 'reg_bit' to corresponding value in 'data' 0 = output, 1 = input */
int tca642x_set_dir(uchar chip, uint8_t gpio_bank, uint8_t reg_bit, uint8_t data)
/* Set direction of IO pins in 'reg_bit' to corresponding value in 'data' 0 = output, 1 = input */ int tca642x_set_dir(uchar chip, uint8_t gpio_bank, uint8_t reg_bit, uint8_t data)
{ uint8_t config_reg = tca642x_regs[gpio_bank].configuration_reg; return tca642x_reg_write(chip, config_reg, reg_bit, data); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Convert one Null-terminated Unicode string to EFI_IPv6_ADDRESS and prefix length. The format of the string is defined in RFC 4291 - Text Representation of Addresses Prefixes: ipv6-address/prefix-length. */
EFI_STATUS EFIAPI NetLibStrToIp6andPrefix(IN CONST CHAR16 *String, OUT EFI_IPv6_ADDRESS *Ip6Address, OUT UINT8 *PrefixLength)
/* Convert one Null-terminated Unicode string to EFI_IPv6_ADDRESS and prefix length. The format of the string is defined in RFC 4291 - Text Representation of Addresses Prefixes: ipv6-address/prefix-length. */ EFI_STATUS EFIAPI NetLibStrToIp6andPrefix(IN CONST CHAR16 *String, OUT EFI_IPv6_ADDRESS *Ip6Address, OUT UINT8 *PrefixLength)
{ RETURN_STATUS Status; CHAR16 *EndPointer; Status = StrToIpv6Address (String, &EndPointer, Ip6Address, PrefixLength); if (RETURN_ERROR (Status) || (*EndPointer != L'\0')) { return EFI_INVALID_PARAMETER; } else { return EFI_SUCCESS; } }
tianocore/edk2
C++
Other
4,240
/* Include header files for all drivers that have been imported from Atmel Software Framework (ASF). Support and FAQ: visit */
int main(void)
/* Include header files for all drivers that have been imported from Atmel Software Framework (ASF). Support and FAQ: visit */ int main(void)
{ board_init(); while (1) { if (ioport_get_pin_level(BUTTON_0_PIN) == BUTTON_0_ACTIVE) { ioport_set_pin_level(LED_0_PIN, LED_0_ACTIVE); } else { ioport_set_pin_level(LED_0_PIN, !LED_0_ACTIVE); } } }
memfault/zero-to-main
C++
null
200
/* Created on: 21 feb. 2019 Author: Daniel Mårtensson Move the rows steps down or move the columns steps to right. The replacement will be zeros Matrix A have the size row x column */
void move(double *A, int row, int column, int down, int right)
/* Created on: 21 feb. 2019 Author: Daniel Mårtensson Move the rows steps down or move the columns steps to right. The replacement will be zeros Matrix A have the size row x column */ void move(double *A, int row, int column, int down, int right)
{ for (int j = column-1; j >= 0; j--){ if(i -down <= -1) *(B + i*column + j) = 0; else if(j - right >= 0) *(B + i*column + j) = *(A + (i-down)*column + j - right); } } memcpy(A, B, row*column*sizeof(double)); }
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* Specifies the operation which is operated after check error occurred. */
void SRAM_SetErrorMode(uint32_t u32SramSel, uint32_t u32ErrMode)
/* Specifies the operation which is operated after check error occurred. */ void SRAM_SetErrorMode(uint32_t u32SramSel, uint32_t u32ErrMode)
{ DDL_ASSERT(IS_SRAM_SEL(u32SramSel)); DDL_ASSERT(IS_SRAM_ERR_MD(u32ErrMode)); DDL_ASSERT(IS_SRAM_CKPR_UNLOCK()); if ((u32SramSel & (SRAM_SRAM12 | SRAM_SRAMR | SRAM_SRAMH)) != 0U) { WRITE_REG32(bCM_SRAMC->CKCR_b.PYOAD, u32ErrMode); } if ((u32SramSel & SRAM_SRAM3) != 0U) { WRITE_REG32(bCM_SRAMC->CKCR_b.ECCOAD, u32ErrMode); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Call hcd_buffer_destroy() to clean up after using those pools. */
int hcd_buffer_create(struct usb_hcd *hcd)
/* Call hcd_buffer_destroy() to clean up after using those pools. */ int hcd_buffer_create(struct usb_hcd *hcd)
{ char name[16]; int i, size; if (!hcd->self.controller->dma_mask && !(hcd->driver->flags & HCD_LOCAL_MEM)) return 0; for (i = 0; i < HCD_BUFFER_POOLS; i++) { size = pool_max[i]; if (!size) continue; snprintf(name, sizeof name, "buffer-%d", size); hcd->pool[i] = dma_pool_create(name, hcd->self.controller, size, size, 0); if (!hcd->pool [i]) { hcd_buffer_destroy(hcd); return -ENOMEM; } } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* UART MSP Initialization This function configures the hardware resources used in this example: */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
/* UART MSP Initialization This function configures the hardware resources used in this example: */ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{ GPIO_InitTypeDef GPIO_InitStruct; USARTx_TX_GPIO_CLK_ENABLE(); USARTx_RX_GPIO_CLK_ENABLE(); USARTx_CLK_ENABLE(); GPIO_InitStruct.Pin = USARTx_TX_PIN; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FAST; GPIO_InitStruct.Alternate = USARTx_TX_AF; HAL_GPIO_Init(USARTx_TX_GPIO_PORT, &GPIO_InitStruct); GPIO_InitStruct.Pin = USARTx_RX_PIN; GPIO_InitStruct.Alternate = USARTx_RX_AF; HAL_GPIO_Init(USARTx_RX_GPIO_PORT, &GPIO_InitStruct); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Write status register 1 byte Returns negative if error occurred. */
static int write_sr(struct spi_nor *nor, u8 val)
/* Write status register 1 byte Returns negative if error occurred. */ static int write_sr(struct spi_nor *nor, u8 val)
{ nor->cmd_buf[0] = val; return spi_nor_write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 1); }
4ms/stm32mp1-baremetal
C++
Other
137
/* The GetModeData() function returns the current operating mode and cached data packet for the MTFTP6 instance. */
EFI_STATUS EFIAPI EfiMtftp6GetModeData(IN EFI_MTFTP6_PROTOCOL *This, OUT EFI_MTFTP6_MODE_DATA *ModeData)
/* The GetModeData() function returns the current operating mode and cached data packet for the MTFTP6 instance. */ EFI_STATUS EFIAPI EfiMtftp6GetModeData(IN EFI_MTFTP6_PROTOCOL *This, OUT EFI_MTFTP6_MODE_DATA *ModeData)
{ MTFTP6_INSTANCE *Instance; EFI_TPL OldTpl; if ((This == NULL) || (ModeData == NULL)) { return EFI_INVALID_PARAMETER; } OldTpl = gBS->RaiseTPL (TPL_CALLBACK); Instance = MTFTP6_INSTANCE_FROM_THIS (This); if (Instance->Config != NULL) { CopyMem ( &ModeData->ConfigData, Instance->Config, sizeof (EFI_MTFTP6_CONFIG_DATA) ); } else { ZeroMem ( &ModeData->ConfigData, sizeof (EFI_MTFTP6_CONFIG_DATA) ); } ModeData->SupportedOptionCount = MTFTP6_SUPPORTED_OPTIONS_NUM; ModeData->SupportedOptions = (UINT8 **)mMtftp6SupportedOptions; gBS->RestoreTPL (OldTpl); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* For DLT_USBPCAP, the maximum is 1MiB, as per */
u_int max_snaplen_for_dlt(int dlt)
/* For DLT_USBPCAP, the maximum is 1MiB, as per */ u_int max_snaplen_for_dlt(int dlt)
{ switch (dlt) { case DLT_DBUS: return 128*1024*1024; case DLT_USBPCAP: return 1024*1024; default: return MAXIMUM_SNAPLEN; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function handles DMA1 Stream 0 interrupt request. */
void AUDIO_IN_I2Sx_DMAx_IRQHandler(void)
/* This function handles DMA1 Stream 0 interrupt request. */ void AUDIO_IN_I2Sx_DMAx_IRQHandler(void)
{ HAL_DMA_IRQHandler(haudio_i2s.hdmarx); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This routine is called to clear CapsuleOnDisk Relocation Info variable. Total Capsule On Disk length is recorded in this variable */
EFI_STATUS CoDClearCapsuleRelocationInfo(VOID)
/* This routine is called to clear CapsuleOnDisk Relocation Info variable. Total Capsule On Disk length is recorded in this variable */ EFI_STATUS CoDClearCapsuleRelocationInfo(VOID)
{ return gRT->SetVariable ( COD_RELOCATION_INFO_VAR_NAME, &gEfiCapsuleVendorGuid, 0, 0, NULL ); }
tianocore/edk2
C++
Other
4,240
/* If 16-bit MMIO register operations are not supported, then ASSERT(). */
UINT16 EFIAPI MmioRead16(IN UINTN Address)
/* If 16-bit MMIO register operations are not supported, then ASSERT(). */ UINT16 EFIAPI MmioRead16(IN UINTN Address)
{ ASSERT ((Address & 1) == 0); return (UINT16)MmioReadWorker (Address, SMM_IO_UINT16); }
tianocore/edk2
C++
Other
4,240
/* If HmacSha256Context is NULL, then return FALSE. If HmacValue is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceHmacSha256Final(IN OUT VOID *HmacSha256Context, OUT UINT8 *HmacValue)
/* If HmacSha256Context is NULL, then return FALSE. If HmacValue is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI CryptoServiceHmacSha256Final(IN OUT VOID *HmacSha256Context, OUT UINT8 *HmacValue)
{ return CALL_BASECRYPTLIB (HmacSha256.Services.Final, HmacSha256Final, (HmacSha256Context, HmacValue), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Sends the CBW packet of the scsi READ CAPACITY command. */
static void uhi_msc_scsi_read_capacity(uhi_msc_scsi_callback_t callback)
/* Sends the CBW packet of the scsi READ CAPACITY command. */ static void uhi_msc_scsi_read_capacity(uhi_msc_scsi_callback_t callback)
{ uhi_msc_scsi_callback = callback; uhi_msc_cbw.dCBWDataTransferLength = sizeof(struct sbc_read_capacity10_data); uhi_msc_cbw.bmCBWFlags = USB_CBW_DIRECTION_IN; uhi_msc_cbw.bCBWCBLength = 10; memset(uhi_msc_cbw.CDB, 0, sizeof(uhi_msc_cbw.CDB)); uhi_msc_cbw.CDB[0] = SBC_READ_CAPACITY10; uhi_msc_scsi(uhi_msc_scsi_read_capacity_done, (uint8_t*)&uhi_msc_capacity); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Attribute write call back for the Value V7 attribute. */
static ssize_t write_value_v7(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
/* Attribute write call back for the Value V7 attribute. */ static ssize_t write_value_v7(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
{ uint32_t *value = attr->user_data; uint32_t value_v7_conv = sys_cpu_to_le32(*value); if (offset >= sizeof(value_v7_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); if (offset + len > sizeof(value_v7_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); memcpy((uint8_t *)&value_v7_conv + offset, buf, len); *value = sys_le32_to_cpu(value_v7_conv); return len; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* it's best to have buff aligned on a 32-bit boundary */
__wsum csum_partial(const void *buff, int len, __wsum sum)
/* it's best to have buff aligned on a 32-bit boundary */ __wsum csum_partial(const void *buff, int len, __wsum sum)
{ unsigned long result = do_csum(buff, len); result += (__force u32)sum; result = (result & 0xffffffff) + (result >> 32); return (__force __wsum)result; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return Value: On success, a pointer to the allocated page is returned. On error, NULL is returned. */
struct page* nilfs_alloc_private_page(struct block_device *bdev, int size, unsigned long state)
/* Return Value: On success, a pointer to the allocated page is returned. On error, NULL is returned. */ struct page* nilfs_alloc_private_page(struct block_device *bdev, int size, unsigned long state)
{ struct buffer_head *bh, *head, *tail; struct page *page; page = alloc_page(GFP_NOFS); if (unlikely(!page)) return NULL; lock_page(page); head = alloc_page_buffers(page, size, 0); if (unlikely(!head)) { unlock_page(page); __free_page(page); return NULL; } bh = head; do { bh->b_state = (1UL << BH_NILFS_Allocated) | state; tail = bh; bh->b_bdev = bdev; bh = bh->b_this_page; } while (bh); tail->b_this_page = head; attach_page_buffers(page, head); return page; }
robutest/uclinux
C++
GPL-2.0
60
/* Like __bio_clone, only also allocates the returned bio */
struct bio* bio_clone(struct bio *bio, gfp_t gfp_mask)
/* Like __bio_clone, only also allocates the returned bio */ struct bio* bio_clone(struct bio *bio, gfp_t gfp_mask)
{ struct bio *b = bio_alloc_bioset(gfp_mask, bio->bi_max_vecs, fs_bio_set); if (!b) return NULL; b->bi_destructor = bio_fs_destructor; __bio_clone(b, bio); if (bio_integrity(bio)) { int ret; ret = bio_integrity_clone(b, bio, gfp_mask, fs_bio_set); if (ret < 0) { bio_put(b); return NULL; } } return b; }
robutest/uclinux
C++
GPL-2.0
60
/* ZigBee Device Profile dissector for the user descriptor */
void dissect_zbee_zdp_req_user_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* ZigBee Device Profile dissector for the user descriptor */ void dissect_zbee_zdp_req_user_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ guint offset = 0; guint16 device; device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); zbee_append_info(tree, pinfo, ", Device: 0x%04x", device); zdp_dump_excess(tvb, offset, pinfo, tree); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function enqueues the received datagram into the instances' receiving queues. */
UINTN Udp6EnqueueDgram(IN UDP6_SERVICE_DATA *Udp6Service, IN NET_BUF *Packet, IN EFI_UDP6_RECEIVE_DATA *RxData)
/* This function enqueues the received datagram into the instances' receiving queues. */ UINTN Udp6EnqueueDgram(IN UDP6_SERVICE_DATA *Udp6Service, IN NET_BUF *Packet, IN EFI_UDP6_RECEIVE_DATA *RxData)
{ LIST_ENTRY *Entry; UDP6_INSTANCE_DATA *Instance; UDP6_RXDATA_WRAP *Wrap; UINTN Enqueued; Enqueued = 0; NET_LIST_FOR_EACH (Entry, &Udp6Service->ChildrenList) { Instance = NET_LIST_USER_STRUCT (Entry, UDP6_INSTANCE_DATA, Link); if (!Instance->Configured) { continue; } if (Udp6MatchDgram (Instance, &RxData->UdpSession)) { Wrap = Udp6WrapRxData (Instance, Packet, RxData); if (Wrap == NULL) { continue; } NET_GET_REF (Packet); InsertTailList (&Instance->RcvdDgramQue, &Wrap->Link); Enqueued++; } } return Enqueued; }
tianocore/edk2
C++
Other
4,240
/* I2C Peripheral Disable. This must not be reset while in Master mode until a communication has finished. In Slave mode, the peripheral is disabled only after communication has ended. */
void i2c_peripheral_disable(uint32_t i2c)
/* I2C Peripheral Disable. This must not be reset while in Master mode until a communication has finished. In Slave mode, the peripheral is disabled only after communication has ended. */ void i2c_peripheral_disable(uint32_t i2c)
{ I2C_CR1(i2c) &= ~I2C_CR1_PE; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Get the status register value of the given RTT. */
uint32_t rtt_get_status(Rtt *p_rtt)
/* Get the status register value of the given RTT. */ uint32_t rtt_get_status(Rtt *p_rtt)
{ return p_rtt->RTT_SR; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Receives a data byte and store it in the RX data buffer. */
static void ucpd_rx_data_byte(const struct device *dev)
/* Receives a data byte and store it in the RX data buffer. */ static void ucpd_rx_data_byte(const struct device *dev)
{ struct tcpc_data *data = dev->data; const struct tcpc_config *const config = dev->config; if (data->ucpd_rx_byte_count < UCPD_BUF_LEN) { data->ucpd_rx_buffer[data->ucpd_rx_byte_count++] = LL_UCPD_ReadData(config->ucpd_port); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function tries to write BufferSize bytes data from the Buffer into the specified TLS connection. */
INTN EFIAPI TlsWrite(IN VOID *Tls, IN VOID *Buffer, IN UINTN BufferSize)
/* This function tries to write BufferSize bytes data from the Buffer into the specified TLS connection. */ INTN EFIAPI TlsWrite(IN VOID *Tls, IN VOID *Buffer, IN UINTN BufferSize)
{ TLS_CONNECTION *TlsConn; TlsConn = (TLS_CONNECTION *)Tls; if ((TlsConn == NULL) || (TlsConn->Ssl == NULL)) { return -1; } return SSL_write (TlsConn->Ssl, Buffer, (UINT32)BufferSize); }
tianocore/edk2
C++
Other
4,240
/* Disables an External Interrupt event output. Disables one or more output events from the External Interrupt module. See here for a list of events this module supports. */
void extint_disable_events(struct extint_events *const events)
/* Disables an External Interrupt event output. Disables one or more output events from the External Interrupt module. See here for a list of events this module supports. */ void extint_disable_events(struct extint_events *const events)
{ Assert(events); Eic *const eics[EIC_INST_NUM] = EIC_INSTS; _extint_disable(); for (uint32_t i = 0; i < EIC_INST_NUM; i++) { uint32_t event_mask = 0; for (uint32_t j = 0; j < 32; j++) { if (events->generate_event_on_detect[(32 * i) + j]) { event_mask |= (1UL << j); } } eics[i]->EVCTRL.reg &= ~event_mask; } _extint_enable(); }
memfault/zero-to-main
C++
null
200
/* The pressure offset value is 16-bit data that can be used to implement one-point calibration (OPC) after soldering.. */
int32_t lps22hh_pressure_offset_set(stmdev_ctx_t *ctx, int16_t val)
/* The pressure offset value is 16-bit data that can be used to implement one-point calibration (OPC) after soldering.. */ int32_t lps22hh_pressure_offset_set(stmdev_ctx_t *ctx, int16_t val)
{ uint8_t buff[2]; int32_t ret; buff[1] = (uint8_t) ((uint16_t)val / 256U); buff[0] = (uint8_t) ((uint16_t)val - (buff[1] * 256U)); ret = lps22hh_write_reg(ctx, LPS22HH_RPDS_L, buff, 2); return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* 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_set(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_set(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); slave1_config.write_once = (uint8_t) val; if(ret == 0){ ret = lsm6dsl_write_reg(ctx, LSM6DSL_SLAVE1_CONFIG, (uint8_t*)&slave1_config, 1); if(ret == 0){ ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_USER_BANK); } } } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* with 0 <= N < 64 and 0 <= M < 16 */
static void calc_ebrg(int baud, int *n_ret, int *m_ret)
/* with 0 <= N < 64 and 0 <= M < 16 */ static void calc_ebrg(int baud, int *n_ret, int *m_ret)
{ int n, m; if (baud == 0) { *n_ret = 0; *m_ret = 0; return; } n = (SAB_BASE_BAUD * 10) / baud; m = 0; while (n >= 640) { n = n / 2; m++; } n = (n+5) / 10; if ((m == 0) && ((n & 1) == 0)) { n = n / 2; m++; } *n_ret = n - 1; *m_ret = m; }
robutest/uclinux
C++
GPL-2.0
60
/* Writes and returns a new value to CR3. This function is only available on IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. */
UINTN EFIAPI AsmWriteCr3(UINTN Value)
/* Writes and returns a new value to CR3. This function is only available on IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. */ UINTN EFIAPI AsmWriteCr3(UINTN Value)
{ _asm { mov eax, Value mov cr3, eax } }
tianocore/edk2
C++
Other
4,240
/* Initialize ExtInt. Fill each pstcExtIntInit with default value. */
int32_t EXTINT_StructInit(stc_extint_init_t *pstcExtIntInit)
/* Initialize ExtInt. Fill each pstcExtIntInit with default value. */ int32_t EXTINT_StructInit(stc_extint_init_t *pstcExtIntInit)
{ int32_t i32Ret = LL_OK; if (NULL == pstcExtIntInit) { i32Ret = LL_ERR_INVD_PARAM; } else { pstcExtIntInit->u32Filter = EXTINT_FILTER_OFF; pstcExtIntInit->u32FilterClock = EXTINT_FCLK_DIV1; pstcExtIntInit->u32Edge = EXTINT_TRIG_FALLING; } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* @scsi_device: The new scsi device that we need to handle. */
static void dc395x_slave_destroy(struct scsi_device *scsi_device)
/* @scsi_device: The new scsi device that we need to handle. */ static void dc395x_slave_destroy(struct scsi_device *scsi_device)
{ struct AdapterCtlBlk *acb = (struct AdapterCtlBlk *)scsi_device->host->hostdata; struct DeviceCtlBlk *dcb = find_dcb(acb, scsi_device->id, scsi_device->lun); if (dcb) adapter_remove_and_free_device(acb, dcb); }
robutest/uclinux
C++
GPL-2.0
60
/* This function prepares a TLS object to work in client or server mode. */
EFI_STATUS EFIAPI CryptoServiceTlsSetConnectionEnd(IN VOID *Tls, IN BOOLEAN IsServer)
/* This function prepares a TLS object to work in client or server mode. */ EFI_STATUS EFIAPI CryptoServiceTlsSetConnectionEnd(IN VOID *Tls, IN BOOLEAN IsServer)
{ return CALL_BASECRYPTLIB (TlsSet.Services.ConnectionEnd, TlsSetConnectionEnd, (Tls, IsServer), EFI_UNSUPPORTED); }
tianocore/edk2
C++
Other
4,240