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
|
|---|---|---|---|---|---|---|---|
/* Set 4 7-bit slave address mask of the specified I2C port.
The */
|
void I2CSlaveOwnAddressMaskSet(unsigned long ulBase, unsigned char ucSlaveNum, unsigned char ucSlaveAddrMask)
|
/* Set 4 7-bit slave address mask of the specified I2C port.
The */
void I2CSlaveOwnAddressMaskSet(unsigned long ulBase, unsigned char ucSlaveNum, unsigned char ucSlaveAddrMask)
|
{
unsigned long ulTemp[4] = {0x24, 0x28, 0x2C, 0x30};
xASSERT((ulBase == I2C0_BASE));
xASSERT((ucSlaveNum == 0) || (ucSlaveNum == 1) ||
(ucSlaveNum == 2) || (ucSlaveNum == 3));
xHWREG(ulBase + ulTemp[ucSlaveNum]) |= (ucSlaveAddrMask << 1);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Locks the watchdog configuration and starts the watchdog timer.
This function sets the watchdog "lock" register, which prevents software from re-configuring the watchdog. This action will also set the enable bit for the watchdog timer, so it will start counting immediately. */
|
void am_hal_wdt_lock_and_start(void)
|
/* Locks the watchdog configuration and starts the watchdog timer.
This function sets the watchdog "lock" register, which prevents software from re-configuring the watchdog. This action will also set the enable bit for the watchdog timer, so it will start counting immediately. */
void am_hal_wdt_lock_and_start(void)
|
{
AM_REGn(WDT, 0, LOCK) = AM_REG_WDT_LOCK_LOCK_KEYVALUE;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* In blocking execution mode, BSP waits until all APs finish or TimeoutInMicroSeconds expires. */
|
EFI_STATUS EFIAPI PeiStartupAllAPs(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_MP_SERVICES_PPI *This, IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, IN UINTN TimeoutInMicroSeconds, IN VOID *ProcedureArgument OPTIONAL)
|
/* In blocking execution mode, BSP waits until all APs finish or TimeoutInMicroSeconds expires. */
EFI_STATUS EFIAPI PeiStartupAllAPs(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_MP_SERVICES_PPI *This, IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, IN UINTN TimeoutInMicroSeconds, IN VOID *ProcedureArgument OPTIONAL)
|
{
return MpInitLibStartupAllAPs (
Procedure,
SingleThread,
NULL,
TimeoutInMicroSeconds,
ProcedureArgument,
NULL
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Write contents of register REGNO in task TASK. */
|
static int put_reg(struct task_struct *task, int regno, unsigned long data)
|
/* Write contents of register REGNO in task TASK. */
static int put_reg(struct task_struct *task, int regno, unsigned long data)
|
{
struct user_context *user = task->thread.user;
if (regno < 0 || regno >= PT__END)
return -EIO;
switch (regno) {
case PT_GR(0):
return 0;
case PT_PSR:
case PT__STATUS:
return -EIO;
default:
((unsigned long *) user)[regno] = data;
return 0;
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* The rates are in lbs_bg_rates, but for the 802.11b rates the high bit isn't set. */
|
static int lbs_scan_add_rates_tlv(uint8_t *tlv)
|
/* The rates are in lbs_bg_rates, but for the 802.11b rates the high bit isn't set. */
static int lbs_scan_add_rates_tlv(uint8_t *tlv)
|
{
int i;
struct mrvl_ie_rates_param_set *rate_tlv = (void *)tlv;
rate_tlv->header.type = cpu_to_le16(TLV_TYPE_RATES);
tlv += sizeof(rate_tlv->header);
for (i = 0; i < MAX_RATES; i++) {
*tlv = lbs_bg_rates[i];
if (*tlv == 0)
break;
if (*tlv == 0x02 || *tlv == 0x04 ||
*tlv == 0x0b || *tlv == 0x16)
*tlv |= 0x80;
tlv++;
}
rate_tlv->header.len = cpu_to_le16(i);
return sizeof(rate_tlv->header) + i;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* HRPWM negative edge adjust enable or disable for specified channel. */
|
void HRPWM_ChNegativeAdjustCmd(uint32_t u32Ch, en_functional_state_t enNewState)
|
/* HRPWM negative edge adjust enable or disable for specified channel. */
void HRPWM_ChNegativeAdjustCmd(uint32_t u32Ch, en_functional_state_t enNewState)
|
{
__IO uint32_t *CRx;
DDL_ASSERT(IS_VALID_HRPWM_CH(u32Ch));
DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState));
CRx = (__IO uint32_t *)(((uint32_t)&CM_HRPWM->CR1) + 4UL * (u32Ch - 1UL));
if (ENABLE == enNewState) {
SET_REG32_BIT(*CRx, HRPWM_CR_NE);
} else {
CLR_REG32_BIT(*CRx, HRPWM_CR_NE);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If there are no connections, signals completion of the stop procedure. */
|
static int ble_hs_stop_gap_event(struct ble_gap_event *event, void *arg)
|
/* If there are no connections, signals completion of the stop procedure. */
static int ble_hs_stop_gap_event(struct ble_gap_event *event, void *arg)
|
{
if (event->type == BLE_GAP_EVENT_DISCONNECT ||
event->type == BLE_GAP_EVENT_TERM_FAILURE) {
ble_hs_stop_conn_cnt--;
if (ble_hs_stop_conn_cnt == 0) {
ble_hs_stop_done(0);
}
}
return 0;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Wait for the frequency EEPROM to complete a command. I hope this one will be optimally inlined. */
|
static void fee_wait(unsigned long ioaddr, int delay, int number)
|
/* Wait for the frequency EEPROM to complete a command. I hope this one will be optimally inlined. */
static void fee_wait(unsigned long ioaddr, int delay, int number)
|
{
int count = 0;
while ((count++ < number) &&
(mmc_in(ioaddr, mmroff(0, mmr_fee_status)) &
MMR_FEE_STATUS_BUSY)) udelay(delay);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* MTD methods which simply translate the effective address and pass through to the */
|
static int part_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf)
|
/* MTD methods which simply translate the effective address and pass through to the */
static int part_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf)
|
{
struct mtd_part *part = PART(mtd);
struct mtd_ecc_stats stats;
int res;
stats = part->master->ecc_stats;
if (from >= mtd->size)
len = 0;
else if (from + len > mtd->size)
len = mtd->size - from;
res = part->master->read(part->master, from + part->offset,
len, retlen, buf);
if (unlikely(res)) {
if (res == -EUCLEAN)
mtd->ecc_stats.corrected += part->master->ecc_stats.corrected - stats.corrected;
if (res == -EBADMSG)
mtd->ecc_stats.failed += part->master->ecc_stats.failed - stats.failed;
}
return res;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Check the busy status of the specified SPI port. */
|
xtBoolean SPIIsBusy(unsigned long ulBase)
|
/* Check the busy status of the specified SPI port. */
xtBoolean SPIIsBusy(unsigned long ulBase)
|
{
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE));
return ((xHWREG(ulBase + SPI_SR) & SPI_SR_BUSY) ? xtrue : xfalse);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Currently we punt and implement it as a normal copy, see pipe_to_user(). */
|
SYSCALL_DEFINE4(vmsplice, int, fd, const struct iovec __user *, iov, unsigned long, nr_segs, unsigned int, flags)
|
/* Currently we punt and implement it as a normal copy, see pipe_to_user(). */
SYSCALL_DEFINE4(vmsplice, int, fd, const struct iovec __user *, iov, unsigned long, nr_segs, unsigned int, flags)
|
{
struct file *file;
long error;
int fput;
if (unlikely(nr_segs > UIO_MAXIOV))
return -EINVAL;
else if (unlikely(!nr_segs))
return 0;
error = -EBADF;
file = fget_light(fd, &fput);
if (file) {
if (file->f_mode & FMODE_WRITE)
error = vmsplice_to_pipe(file, iov, nr_segs, flags);
else if (file->f_mode & FMODE_READ)
error = vmsplice_to_user(file, iov, nr_segs, flags);
fput_light(file, fput);
}
return error;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Decimation of read operation on Slave 2 starting from the sensor hub trigger.. */
|
int32_t lsm6dsl_sh_slave_2_dec_set(stmdev_ctx_t *ctx, lsm6dsl_slave2_rate_t val)
|
/* Decimation of read operation on Slave 2 starting from the sensor hub trigger.. */
int32_t lsm6dsl_sh_slave_2_dec_set(stmdev_ctx_t *ctx, lsm6dsl_slave2_rate_t val)
|
{
lsm6dsl_slave2_config_t slave2_config;
int32_t ret;
ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_BANK_A);
if(ret == 0){
ret = lsm6dsl_read_reg(ctx, LSM6DSL_SLAVE2_CONFIG,
(uint8_t*)&slave2_config, 1);
if(ret == 0){
slave2_config.slave2_rate =(uint8_t) val;
ret = lsm6dsl_write_reg(ctx, LSM6DSL_SLAVE2_CONFIG,
(uint8_t*)&slave2_config, 1);
if(ret == 0){
ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_USER_BANK);
}
}
}
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Fills each DMA_InitStruct member with its default value. */
|
void DMA_StructInit(DMA_InitTypeDef *DMA_InitStruct)
|
/* Fills each DMA_InitStruct member with its default value. */
void DMA_StructInit(DMA_InitTypeDef *DMA_InitStruct)
|
{
DMA_InitStruct->DMA_PeripheralBaseAddr = 0;
DMA_InitStruct->DMA_MemoryBaseAddr = 0;
DMA_InitStruct->DMA_DIR = DMA_DIR_PeripheralSRC;
DMA_InitStruct->DMA_BufferSize = 0;
DMA_InitStruct->DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStruct->DMA_MemoryInc = DMA_MemoryInc_Disable;
DMA_InitStruct->DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
DMA_InitStruct->DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
DMA_InitStruct->DMA_Mode = DMA_Mode_Normal;
DMA_InitStruct->DMA_Priority = DMA_Priority_Low;
DMA_InitStruct->DMA_M2M = DMA_M2M_Disable;
}
|
gcallipo/RadioDSP-Stm32f103
|
C++
|
Common Creative - Attribution 3.0
| 51
|
/* Reads a 32 bit integer from the address space of a given SDIO function. If there is a problem reading the address, 0xffffffff is returned and @err_ret will contain the error code. */
|
u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret)
|
/* Reads a 32 bit integer from the address space of a given SDIO function. If there is a problem reading the address, 0xffffffff is returned and @err_ret will contain the error code. */
u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret)
|
{
int ret;
if (err_ret)
*err_ret = 0;
ret = sdio_memcpy_fromio(func, func->tmpbuf, addr, 4);
if (ret) {
if (err_ret)
*err_ret = ret;
return 0xFFFFFFFF;
}
return le32_to_cpup((__le32 *)func->tmpbuf);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* I2S MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_I2S_MspDeInit(I2S_HandleTypeDef *hi2s)
|
/* I2S MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_I2S_MspDeInit(I2S_HandleTypeDef *hi2s)
|
{
if(hi2s->Instance==SPI3)
{
__HAL_RCC_SPI3_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_3);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_15);
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_6);
HAL_NVIC_DisableIRQ(SPI3_IRQn);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Gather affected IO requests and task management commands. */
|
static void bfa_tskim_cleanup_ios(struct bfa_tskim_s *tskim)
|
/* Gather affected IO requests and task management commands. */
static void bfa_tskim_cleanup_ios(struct bfa_tskim_s *tskim)
|
{
struct bfa_ioim_s *ioim;
struct list_head *qe, *qen;
bfa_wc_init(&tskim->wc, bfa_tskim_cleanp_comp, tskim);
list_for_each_safe(qe, qen, &tskim->io_q) {
ioim = (struct bfa_ioim_s *) qe;
bfa_wc_up(&tskim->wc);
bfa_ioim_cleanup_tm(ioim, tskim);
}
bfa_wc_wait(&tskim->wc);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* RTC interrupt handler. Clear the RTC interrupt flag and execute the callback function. */
|
void RTCIntHandler(void)
|
/* RTC interrupt handler. Clear the RTC interrupt flag and execute the callback function. */
void RTCIntHandler(void)
|
{
unsigned long ulEventFlags;
ulEventFlags = xHWREG(RTC_CRL);
if(ulEventFlags&0x0001) {
xHWREG(RTC_CRL) &= (~0x0001);
}
if(ulEventFlags&0x0002)
{
xHWREG(RTC_CRL) &= (~0x0002);
}
while(!(xHWREG(RTC_CRL) & RTC_CRL_RTOFF));
if(g_pfnRTCHandlerCallbacks[0] != 0)
{
g_pfnRTCHandlerCallbacks[0](0, 0, ulEventFlags, 0);
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* EC Point addition. EcPointResult = EcPointA + EcPointB. */
|
BOOLEAN EFIAPI CryptoServiceEcPointAdd(IN CONST VOID *EcGroup, OUT VOID *EcPointResult, IN CONST VOID *EcPointA, IN CONST VOID *EcPointB, IN VOID *BnCtx)
|
/* EC Point addition. EcPointResult = EcPointA + EcPointB. */
BOOLEAN EFIAPI CryptoServiceEcPointAdd(IN CONST VOID *EcGroup, OUT VOID *EcPointResult, IN CONST VOID *EcPointA, IN CONST VOID *EcPointB, IN VOID *BnCtx)
|
{
return CALL_BASECRYPTLIB (Ec.Services.PointAdd, EcPointAdd, (EcGroup, EcPointResult, EcPointA, EcPointB, BnCtx), FALSE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Enables or disables the ADC DMA request after last transfer (Single-ADC mode). */
|
void ADC_DMARequestAfterLastTransferCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
|
/* Enables or disables the ADC DMA request after last transfer (Single-ADC mode). */
void ADC_DMARequestAfterLastTransferCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
|
{
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
ADCx->CR2 |= ADC_CR2_DDS;
}
else
{
ADCx->CR2 &= (uint32_t)~ADC_CR2_DDS;
}
}
|
avem-labs/Avem
|
C++
|
MIT License
| 1,752
|
/* This routine checks whether more Registration State Change Notifications (RSCNs) came in while the discovery state machine was in the FC_RSCN_MODE. If so, the lpfc_els_handle_rscn() routine will be invoked to handle the additional RSCNs for the @vport. Otherwise, the FC_RSCN_MODE bit will be cleared with the @vport to mark as the end of handling the RSCNs. */
|
void lpfc_end_rscn(struct lpfc_vport *vport)
|
/* This routine checks whether more Registration State Change Notifications (RSCNs) came in while the discovery state machine was in the FC_RSCN_MODE. If so, the lpfc_els_handle_rscn() routine will be invoked to handle the additional RSCNs for the @vport. Otherwise, the FC_RSCN_MODE bit will be cleared with the @vport to mark as the end of handling the RSCNs. */
void lpfc_end_rscn(struct lpfc_vport *vport)
|
{
struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
if (vport->fc_flag & FC_RSCN_MODE) {
if (vport->fc_rscn_id_cnt ||
(vport->fc_flag & FC_RSCN_DISCOVERY) != 0)
lpfc_els_handle_rscn(vport);
else {
spin_lock_irq(shost->host_lock);
vport->fc_flag &= ~FC_RSCN_MODE;
spin_unlock_irq(shost->host_lock);
}
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Callback function for AFEC enter compasion window interrupt. */
|
static void afec_print_comp_result(void)
|
/* Callback function for AFEC enter compasion window interrupt. */
static void afec_print_comp_result(void)
|
{
uint16_t us_adc;
afec_disable_interrupt(AFEC0, AFEC_INTERRUPT_COMP_ERROR);
us_adc = afec_channel_get_value(AFEC0, AFEC_CHANNEL_POTENTIOMETER);
printf("-ISR-:Potentiometer voltage %d mv is in the comparison "
"window:%d -%d mv!\n\r",
(int)(us_adc * VOLT_REF / MAX_DIGITAL),
(int)(gs_us_low_threshold * VOLT_REF / MAX_DIGITAL),
(int)(gs_us_high_threshold * VOLT_REF / MAX_DIGITAL));
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Write one byte into the RX buffer. This function will write one byte into the array index specified by the write pointer and increment the write index. If the write index exceeds the max buffer size, then it will roll over to zero. */
|
void uartRxBufferWrite(uint8_t data)
|
/* Write one byte into the RX buffer. This function will write one byte into the array index specified by the write pointer and increment the write index. If the write index exceeds the max buffer size, then it will roll over to zero. */
void uartRxBufferWrite(uint8_t data)
|
{
uart_pcb_t *pcb = uartGetPCB();
pcb->rxfifo.buf[pcb->rxfifo.wr_ptr] = data;
pcb->rxfifo.wr_ptr = (pcb->rxfifo.wr_ptr + 1) % CFG_UART_BUFSIZE;
pcb->rxfifo.len++;
}
|
microbuilder/LPC1343CodeBase
|
C++
|
Other
| 73
|
/* ipath_ht_quiet_serdes - set serdes to txidle @dd: the infinipath device driver is being unloaded */
|
static void ipath_ht_quiet_serdes(struct ipath_devdata *dd)
|
/* ipath_ht_quiet_serdes - set serdes to txidle @dd: the infinipath device driver is being unloaded */
static void ipath_ht_quiet_serdes(struct ipath_devdata *dd)
|
{
u64 val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_serdesconfig0);
val |= INFINIPATH_SERDC0_TXIDLE;
ipath_dbg("Setting TxIdleEn on serdes (config0 = %llx)\n",
(unsigned long long) val);
ipath_write_kreg(dd, dd->ipath_kregs->kr_serdesconfig0, val);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* get first 1 from u64, then clear it */
|
static BL_Err_Type GLB_Get_And_Clr_First_Set_From_U64(uint64_t *val, uint32_t *bit)
|
/* get first 1 from u64, then clear it */
static BL_Err_Type GLB_Get_And_Clr_First_Set_From_U64(uint64_t *val, uint32_t *bit)
|
{
if (!*val) {
return ERROR;
}
for (uint8_t i = 0; i < 64; i++) {
if ((*val) & ((uint64_t)1 << i)) {
*bit = i;
(*val) &= ~((uint64_t)1 << i);
break;
}
}
return SUCCESS;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param base Pointer to the FLEXIO_SPI_Type structure. return status flag; Use the status flag to AND the following flag mask and get the status. arg kFLEXIO_SPI_TxEmptyFlag arg kFLEXIO_SPI_RxEmptyFlag */
|
uint32_t FLEXIO_SPI_GetStatusFlags(FLEXIO_SPI_Type *base)
|
/* param base Pointer to the FLEXIO_SPI_Type structure. return status flag; Use the status flag to AND the following flag mask and get the status. arg kFLEXIO_SPI_TxEmptyFlag arg kFLEXIO_SPI_RxEmptyFlag */
uint32_t FLEXIO_SPI_GetStatusFlags(FLEXIO_SPI_Type *base)
|
{
uint32_t shifterStatus = FLEXIO_GetShifterStatusFlags(base->flexioBase);
uint32_t status = 0;
status = ((shifterStatus & (1U << base->shifterIndex[0])) >> base->shifterIndex[0]);
status |= (((shifterStatus & (1U << base->shifterIndex[1])) >> (base->shifterIndex[1])) << 1U);
return status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This reads the keyboard status port, and does the appropriate action. */
|
unsigned char handle_kbd_event(void)
|
/* This reads the keyboard status port, and does the appropriate action. */
unsigned char handle_kbd_event(void)
|
{
unsigned char status = kbd_read_status ();
unsigned int work = 10000;
while ((--work > 0) && (status & KBD_STAT_OBF)) {
unsigned char scancode;
scancode = kbd_read_input ();
if (!(status & (KBD_STAT_GTO | KBD_STAT_PERR))) {
if (status & KBD_STAT_MOUSE_OBF);
else
handle_keyboard_event (scancode);
}
status = kbd_read_status ();
}
if (!work)
PRINTF ("pc_keyb: controller jammed (0x%02X).\n", status);
return status;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* copy the kernel address into a bio suitable for io to a block device. Returns an error pointer in case of error. */
|
struct bio* bio_copy_kern(struct request_queue *q, void *data, unsigned int len, gfp_t gfp_mask, int reading)
|
/* copy the kernel address into a bio suitable for io to a block device. Returns an error pointer in case of error. */
struct bio* bio_copy_kern(struct request_queue *q, void *data, unsigned int len, gfp_t gfp_mask, int reading)
|
{
struct bio *bio;
struct bio_vec *bvec;
int i;
bio = bio_copy_user(q, NULL, (unsigned long)data, len, 1, gfp_mask);
if (IS_ERR(bio))
return bio;
if (!reading) {
void *p = data;
bio_for_each_segment(bvec, bio, i) {
char *addr = page_address(bvec->bv_page);
memcpy(addr, p, bvec->bv_len);
p += bvec->bv_len;
}
}
bio->bi_end_io = bio_copy_kern_endio;
return bio;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Removes the last directory or file entry in a path by changing the last L'\' to a CHAR_NULL. */
|
BOOLEAN EFIAPI RemoveLastItemFromPath(IN OUT CHAR16 *Path)
|
/* Removes the last directory or file entry in a path by changing the last L'\' to a CHAR_NULL. */
BOOLEAN EFIAPI RemoveLastItemFromPath(IN OUT CHAR16 *Path)
|
{
CHAR16 *Walker;
CHAR16 *LastSlash;
for ( Walker = Path, LastSlash = NULL
; Walker != NULL && *Walker != CHAR_NULL
; Walker++
)
{
if ((*Walker == L'\\') && (*(Walker + 1) != CHAR_NULL)) {
LastSlash = Walker + 1;
}
}
if (LastSlash != NULL) {
*LastSlash = CHAR_NULL;
return (TRUE);
}
return (FALSE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Retrieve the EC Private Key from the password-protected PEM key data. */
|
BOOLEAN EFIAPI EcGetPrivateKeyFromPem(IN CONST UINT8 *PemData, IN UINTN PemSize, IN CONST CHAR8 *Password, OUT VOID **EcContext)
|
/* Retrieve the EC Private Key from the password-protected PEM key data. */
BOOLEAN EFIAPI EcGetPrivateKeyFromPem(IN CONST UINT8 *PemData, IN UINTN PemSize, IN CONST CHAR8 *Password, OUT VOID **EcContext)
|
{
CALL_CRYPTO_SERVICE (EcGetPrivateKeyFromPem, (PemData, PemSize, Password, EcContext), FALSE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns the realpath of @pathname on success, NULL otherwise. */
|
char* tomoyo_realpath_nofollow(const char *pathname)
|
/* Returns the realpath of @pathname on success, NULL otherwise. */
char* tomoyo_realpath_nofollow(const char *pathname)
|
{
struct path path;
if (pathname && kern_path(pathname, 0, &path) == 0) {
char *buf = tomoyo_realpath_from_path(&path);
path_put(&path);
return buf;
}
return NULL;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Number of free bytes in the Send buffer. */
|
int32_t USBD_CDC_ACM_DataFree(void)
|
/* Number of free bytes in the Send buffer. */
int32_t USBD_CDC_ACM_DataFree(void)
|
{
return ((int32_t)usbd_cdc_acm_sendbuf_sz) - (data_to_send_wr - data_to_send_rd);
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* check if the netlink message fits into the remaining bytes */
|
int nlmsg_ok(const struct nlmsghdr *nlh, int remaining)
|
/* check if the netlink message fits into the remaining bytes */
int nlmsg_ok(const struct nlmsghdr *nlh, int remaining)
|
{
return (remaining >= (int)sizeof(struct nlmsghdr) &&
nlh->nlmsg_len >= sizeof(struct nlmsghdr) &&
nlh->nlmsg_len <= remaining);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Called on each existing env var prior to the blanket update since removing a flag in the flag list should remove its flags. */
|
static int clear_flags(struct env_entry *entry)
|
/* Called on each existing env var prior to the blanket update since removing a flag in the flag list should remove its flags. */
static int clear_flags(struct env_entry *entry)
|
{
entry->flags = 0;
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* This routine can be called from a FC LLD scsi_eh callback. It blocks the scsi_eh thread until the fc_rport leaves the FC_PORTSTATE_BLOCKED. This is necessary to avoid the scsi_eh failing recovery actions for blocked rports which would lead to offlined SCSI devices. */
|
void fc_block_scsi_eh(struct scsi_cmnd *cmnd)
|
/* This routine can be called from a FC LLD scsi_eh callback. It blocks the scsi_eh thread until the fc_rport leaves the FC_PORTSTATE_BLOCKED. This is necessary to avoid the scsi_eh failing recovery actions for blocked rports which would lead to offlined SCSI devices. */
void fc_block_scsi_eh(struct scsi_cmnd *cmnd)
|
{
struct Scsi_Host *shost = cmnd->device->host;
struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));
unsigned long flags;
spin_lock_irqsave(shost->host_lock, flags);
while (rport->port_state == FC_PORTSTATE_BLOCKED) {
spin_unlock_irqrestore(shost->host_lock, flags);
msleep(1000);
spin_lock_irqsave(shost->host_lock, flags);
}
spin_unlock_irqrestore(shost->host_lock, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* set the ETM moule clock source and prescale.
@无返回 */
|
void ETM_ClockSet(ETM_Type *pETM, uint8_t u8ClockSource, uint8_t u8ClockPrescale)
|
/* set the ETM moule clock source and prescale.
@无返回 */
void ETM_ClockSet(ETM_Type *pETM, uint8_t u8ClockSource, uint8_t u8ClockPrescale)
|
{
uint8_t u8Temp;
u8Temp = (pETM->SC & 0xE0);
u8Temp |= (ETM_SC_CLKS(u8ClockSource & 0x3) | ETM_SC_PS(u8ClockPrescale & 0x7));
pETM->SC = u8Temp;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* check for SWO disabled.
Use this function to determine if the SWO is disabled. */
|
bool am_hal_flash_swo_disable_check(void)
|
/* check for SWO disabled.
Use this function to determine if the SWO is disabled. */
bool am_hal_flash_swo_disable_check(void)
|
{
if ( customer_info_signature_erased() )
{
return false;
}
if ( !am_hal_flash_customer_info_signature_check() )
{
return false;
}
return AM_REGVAL(AM_HAL_FLASH_INFO_SECURITY_ADDR) &
AM_HAL_FLASH_INFO_SECURITY_SWOCTRL_M ? false : true;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Decode the four-byte gesture data and execute any callbacks. */
|
static int decode_gesture(unsigned char *gesture)
|
/* Decode the four-byte gesture data and execute any callbacks. */
static int decode_gesture(unsigned char *gesture)
|
{
unsigned char tap, android_orient;
android_orient = gesture[3] & 0xC0;
tap = 0x3F & gesture[3];
if (gesture[1] & INT_SRC_TAP) {
unsigned char direction, count;
direction = tap >> 3;
count = (tap % 8) + 1;
if (dmp.tap_cb)
dmp.tap_cb(direction, count);
}
if (gesture[1] & INT_SRC_ANDROID_ORIENT) {
if (dmp.android_orient_cb)
dmp.android_orient_cb(android_orient >> 6);
}
return 0;
}
|
Luos-io/luos_engine
|
C++
|
MIT License
| 496
|
/* Init the ARM global timer to a microsecond-frequency clock. */
|
void time_init_global_timer()
|
/* Init the ARM global timer to a microsecond-frequency clock. */
void time_init_global_timer()
|
{
uint32_t periphClock = get_main_clock(CPU_CLK) / 2;
uint32_t prescaler = (periphClock / 1000000) - 1;
g_microsecondTimerMultiple = 1;
while (prescaler > 0xff)
{
prescaler /= 2;
++g_microsecondTimerMultiple;
}
HW_ARMGLOBALTIMER_CONTROL.B.TIMER_ENABLE = 0;
HW_ARMGLOBALTIMER_COUNTERn_WR(0, 0);
HW_ARMGLOBALTIMER_COUNTERn_WR(1, 0);
HW_ARMGLOBALTIMER_CONTROL_WR(BF_ARMGLOBALTIMER_CONTROL_PRESCALER(prescaler));
HW_ARMGLOBALTIMER_CONTROL.B.TIMER_ENABLE = 1;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Non-destructive peek of nth (zero indexed) element of queue. */
|
memq_link_t* memq_peek_n(memq_link_t *head, memq_link_t *tail, uint8_t n, void **mem)
|
/* Non-destructive peek of nth (zero indexed) element of queue. */
memq_link_t* memq_peek_n(memq_link_t *head, memq_link_t *tail, uint8_t n, void **mem)
|
{
do {
head = memq_peek(head, tail, mem);
if (head == NULL) {
return NULL;
}
head = head->next;
} while (n--);
return head;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Get the I2C interrupt flag of the specified I2C port.
The */
|
unsigned long xI2CMasterIntFlagGet(unsigned long ulBase)
|
/* Get the I2C interrupt flag of the specified I2C port.
The */
unsigned long xI2CMasterIntFlagGet(unsigned long ulBase)
|
{
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE) ||
(ulBase == I2C2_BASE) || (ulBase == I2C3_BASE) ||
(ulBase == I2C4_BASE));
return ((xHWREG(ulBase + I2C_CON) & I2C_CON_SI) ? xtrue : xfalse);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
|
gboolean _g_freedesktop_dbus_call_update_activation_environment_sync(_GFreedesktopDBus *proxy, GVariant *arg_environment, GCancellable *cancellable, GError **error)
|
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
gboolean _g_freedesktop_dbus_call_update_activation_environment_sync(_GFreedesktopDBus *proxy, GVariant *arg_environment, GCancellable *cancellable, GError **error)
|
{
GVariant *_ret;
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
"UpdateActivationEnvironment",
g_variant_new ("(@a{ss})",
arg_environment),
G_DBUS_CALL_FLAGS_NONE,
-1,
cancellable,
error);
if (_ret == NULL)
goto _out;
g_variant_get (_ret,
"()");
g_variant_unref (_ret);
_out:
return _ret != NULL;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* DSI MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_DSI_MspDeInit(DSI_HandleTypeDef *hdsi)
|
/* DSI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_DSI_MspDeInit(DSI_HandleTypeDef *hdsi)
|
{
if(hdsi->Instance==DSI)
{
__HAL_RCC_DSI_CLK_DISABLE();
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* insert a new ref into the rbtree. This returns any existing refs for the same (bytenr,parent) tuple, or NULL if the new node was properly inserted. */
|
static struct btrfs_delayed_ref_node* tree_insert(struct rb_root *root, struct rb_node *node)
|
/* insert a new ref into the rbtree. This returns any existing refs for the same (bytenr,parent) tuple, or NULL if the new node was properly inserted. */
static struct btrfs_delayed_ref_node* tree_insert(struct rb_root *root, struct rb_node *node)
|
{
struct rb_node **p = &root->rb_node;
struct rb_node *parent_node = NULL;
struct btrfs_delayed_ref_node *entry;
struct btrfs_delayed_ref_node *ins;
int cmp;
ins = rb_entry(node, struct btrfs_delayed_ref_node, rb_node);
while (*p) {
parent_node = *p;
entry = rb_entry(parent_node, struct btrfs_delayed_ref_node,
rb_node);
cmp = comp_entry(entry, ins);
if (cmp < 0)
p = &(*p)->rb_left;
else if (cmp > 0)
p = &(*p)->rb_right;
else
return entry;
}
rb_link_node(node, parent_node, p);
rb_insert_color(node, root);
return NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enable fault detect deglitch function of selected channel. */
|
void EPWM_EnableFaultDetectDeglitch(EPWM_T *epwm, uint32_t u32ChannelNum, uint32_t u32DeglitchSmpCycle)
|
/* Enable fault detect deglitch function of selected channel. */
void EPWM_EnableFaultDetectDeglitch(EPWM_T *epwm, uint32_t u32ChannelNum, uint32_t u32DeglitchSmpCycle)
|
{
(epwm)->FDCTL[(u32ChannelNum)] = ((epwm)->FDCTL[(u32ChannelNum)] & (~EPWM_FDCTL0_DGSMPCYC_Msk)) | \
(EPWM_FDCTL0_FDDGEN_Msk | ((u32DeglitchSmpCycle) << EPWM_FDCTL0_DGSMPCYC_Pos));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Send data visualizer data packet with 1 data field.
This routine constructs a data visualizer data packet with one data value field and then transmits it. All multi-byte transmitted values use little endian byte order. */
|
void adv_data_send_1(uint8_t stream_num, uint32_t timestamp, int32_t value)
|
/* Send data visualizer data packet with 1 data field.
This routine constructs a data visualizer data packet with one data value field and then transmits it. All multi-byte transmitted values use little endian byte order. */
void adv_data_send_1(uint8_t stream_num, uint32_t timestamp, int32_t value)
|
{
struct {
adv_data_start_t start;
adv_data_field_t field;
adv_data_end_t end;
} packet;
packet.start.header1 = ADV_PKT_HEADER_1;
packet.start.header2 = ADV_PKT_HEADER_2;
packet.start.length = cpu_to_le16(sizeof(packet));
packet.start.type = ADV_PKT_DATA;
packet.start.stream_num = stream_num;
packet.start.time_stamp = cpu_to_le32(timestamp);
packet.field.value = cpu_to_le32(value);
packet.end.crc = 0x00;
packet.end.mark = ADV_PKT_END;
adv_write_buf((uint8_t*)&packet, sizeof(packet));
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Initialize the boards on-board LEDs (LD4,LD5 and LD6)
The LEDs are connected to the following pins: */
|
static void leds_init(void)
|
/* Initialize the boards on-board LEDs (LD4,LD5 and LD6)
The LEDs are connected to the following pins: */
static void leds_init(void)
|
{
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
LED_PORT->MODER &= ~(0x000000FC);
LED_PORT->MODER |= 0x00000054;
LED_PORT->OSPEEDR |= 0x000000FC;
LED_PORT->OTYPER &= ~(0x000E);
LED_PORT->PUPDR &= ~(0x000000FC);
LED_PORT->BSRRL = 0x00E;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Internal clip-encoding routine.
Calculates a segement-based clipping encoding for a point against a rectangle. */
|
static int _clipEncode(Sint16 x, Sint16 y, Sint16 left, Sint16 top, Sint16 right, Sint16 bottom)
|
/* Internal clip-encoding routine.
Calculates a segement-based clipping encoding for a point against a rectangle. */
static int _clipEncode(Sint16 x, Sint16 y, Sint16 left, Sint16 top, Sint16 right, Sint16 bottom)
|
{
int code = 0;
if (x < left) {
code |= CLIP_LEFT_EDGE;
} else if (x > right) {
code |= CLIP_RIGHT_EDGE;
}
if (y < top) {
code |= CLIP_TOP_EDGE;
} else if (y > bottom) {
code |= CLIP_BOTTOM_EDGE;
}
return code;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* USBH_MSC_ClassRequest This function will only initialize the MSC state machine. */
|
static USBH_Status USBH_MSC_ClassRequest(USB_OTG_CORE_HANDLE *pdev, void *phost)
|
/* USBH_MSC_ClassRequest This function will only initialize the MSC state machine. */
static USBH_Status USBH_MSC_ClassRequest(USB_OTG_CORE_HANDLE *pdev, void *phost)
|
{
USBH_Status status = USBH_OK ;
USBH_MSC_BOTXferParam.MSCState = USBH_MSC_BOT_INIT_STATE;
return status;
}
|
MaJerle/stm32f429
|
C++
| null | 2,036
|
/* Clear the PWM interrupt flag of the PWM module.
The */
|
void PWMIntFlagClear(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
|
/* Clear the PWM interrupt flag of the PWM module.
The */
void PWMIntFlagClear(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
|
{
unsigned long ulChannelTemp;
ulChannelTemp = ulChannel;
xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE));
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 5)));
if (ulIntType & PWM_INT_PWM)
{
xHWREG(ulBase + PWM_INTSTS) |= (1 << ulChannelTemp);
}
if (ulIntType & PWM_INT_DUTY)
{
xHWREG(ulBase + PWM_INTSTS) |= (0x100 << ulChannelTemp);
}
if (ulIntType & PWM_INT_CAP_BOTH)
{
xHWREG(ulBase + PWM_INTSTS) |= (0x01010000 << ulChannelTemp);
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Detects if SMX feature supported on current processor. */
|
BOOLEAN EFIAPI SmxSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
|
/* Detects if SMX feature supported on current processor. */
BOOLEAN EFIAPI SmxSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
|
{
return (CpuInfo->CpuIdVersionInfoEcx.Bits.SMX == 1);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Disable the DMA Tx Desc padding for frame shorter than 64 bytes. */
|
void ETH_DisableDMATxDescShortFramePadding(ETH_DMADescConfig_T *DMATxDesc)
|
/* Disable the DMA Tx Desc padding for frame shorter than 64 bytes. */
void ETH_DisableDMATxDescShortFramePadding(ETH_DMADescConfig_T *DMATxDesc)
|
{
DMATxDesc->Status |= ETH_DMATXDESC_DISP;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns current time from boot in nsecs. It's OK for this to wrap around for now, as it's just a relative time stamp. */
|
unsigned long long sched_clock(void)
|
/* Returns current time from boot in nsecs. It's OK for this to wrap around for now, as it's just a relative time stamp. */
unsigned long long sched_clock(void)
|
{
return clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k),
clocksource_32k.mult, clocksource_32k.shift);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Mask DRDY on pin (both XL & Gyro) until filter settling ends (XL and Gyro independently masked).. */
|
int32_t lsm6dsl_filter_settling_mask_set(stmdev_ctx_t *ctx, uint8_t val)
|
/* Mask DRDY on pin (both XL & Gyro) until filter settling ends (XL and Gyro independently masked).. */
int32_t lsm6dsl_filter_settling_mask_set(stmdev_ctx_t *ctx, uint8_t val)
|
{
lsm6dsl_ctrl4_c_t ctrl4_c;
int32_t ret;
ret = lsm6dsl_read_reg(ctx, LSM6DSL_CTRL4_C, (uint8_t*)&ctrl4_c, 1);
if(ret == 0){
ctrl4_c.drdy_mask = val;
ret = lsm6dsl_write_reg(ctx, LSM6DSL_CTRL4_C, (uint8_t*)&ctrl4_c, 1);
}
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Applies the specified number of pulses to TCK. */
|
void ispVMClocks(unsigned short Clocks)
|
/* Applies the specified number of pulses to TCK. */
void ispVMClocks(unsigned short Clocks)
|
{
unsigned short iClockIndex = 0;
for (iClockIndex = 0; iClockIndex < Clocks; iClockIndex++) {
sclock();
}
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Input: buf: C string containing an unsigned integer value representing the new NFS blksize size: non-zero length of C string in @buf Output: On success: passed-in buffer filled with ' */
|
static ssize_t write_maxblksize(struct file *file, char *buf, size_t size)
|
/* Input: buf: C string containing an unsigned integer value representing the new NFS blksize size: non-zero length of C string in @buf Output: On success: passed-in buffer filled with ' */
static ssize_t write_maxblksize(struct file *file, char *buf, size_t size)
|
{
char *mesg = buf;
if (size > 0) {
int bsize;
int rv = get_int(&mesg, &bsize);
if (rv)
return rv;
if (bsize < 1024)
bsize = 1024;
if (bsize > NFSSVC_MAXBLKSIZE)
bsize = NFSSVC_MAXBLKSIZE;
bsize &= ~(1024-1);
mutex_lock(&nfsd_mutex);
if (nfsd_serv && nfsd_serv->sv_nrthreads) {
mutex_unlock(&nfsd_mutex);
return -EBUSY;
}
nfsd_max_blksize = bsize;
mutex_unlock(&nfsd_mutex);
}
return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%d\n",
nfsd_max_blksize);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns: (transfer none): the user data pointer set, or NULL */
|
gpointer g_param_spec_get_qdata(GParamSpec *pspec, GQuark quark)
|
/* Returns: (transfer none): the user data pointer set, or NULL */
gpointer g_param_spec_get_qdata(GParamSpec *pspec, GQuark quark)
|
{
g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), NULL);
return quark ? g_datalist_id_get_data (&pspec->qdata, quark) : NULL;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* ads7846_dev_init : Requests & sets GPIO line for pen-irq */
|
static void ads7846_dev_init(void)
|
/* ads7846_dev_init : Requests & sets GPIO line for pen-irq */
static void ads7846_dev_init(void)
|
{
if (gpio_request(ts_gpio, "ADS7846 pendown") < 0) {
printk(KERN_ERR "can't get ads746 pen down GPIO\n");
return;
}
gpio_direction_input(ts_gpio);
omap_set_gpio_debounce(ts_gpio, 1);
omap_set_gpio_debounce_time(ts_gpio, 0xa);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Fills each clockConfig member with its default value. */
|
void USART_ConfigClockStructInit(USART_ClockConfig_T *clockConfig)
|
/* Fills each clockConfig member with its default value. */
void USART_ConfigClockStructInit(USART_ClockConfig_T *clockConfig)
|
{
clockConfig->clock = USART_CLKEN_DISABLE;
clockConfig->phase = USART_CLKPHA_1EDGE;
clockConfig->polarity = USART_CLKPOL_LOW;
clockConfig->lastBit = USART_LBCP_DISABLE;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* This comparator searches for the next Interrupt or Bulk Endpoint descriptor of the current SI interface, aborting the search if another interface descriptor is found before the next endpoint. */
|
uint8_t DComp_NextStillImageInterfaceDataEndpoint(void *CurrentDescriptor)
|
/* This comparator searches for the next Interrupt or Bulk Endpoint descriptor of the current SI interface, aborting the search if another interface descriptor is found before the next endpoint. */
uint8_t DComp_NextStillImageInterfaceDataEndpoint(void *CurrentDescriptor)
|
{
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
if (Header->Type == DTYPE_Endpoint)
{
USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t);
if (((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_BULK) ||
((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_INTERRUPT))
{
return DESCRIPTOR_SEARCH_Found;
}
}
else if (Header->Type == DTYPE_Interface)
{
return DESCRIPTOR_SEARCH_Fail;
}
return DESCRIPTOR_SEARCH_NotFound;
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* Resets the RCC clock configuration to the default reset state. */
|
void RCC_DeInit(void)
|
/* Resets the RCC clock configuration to the default reset state. */
void RCC_DeInit(void)
|
{
RCC->CR |= (uint32_t)0x00000001;
RCC->CFGR &= (uint32_t)0xF8FFC000;
RCC->CR &= (uint32_t)0xFEF6FFFF;
RCC->CR &= (uint32_t)0xFFFBFFFF;
RCC->CFGR &= (uint32_t)0xFF80FFFF;
RCC->CFGR2 &= (uint32_t)0xFFFFC000;
RCC->CFGR3 &= (uint32_t)0xF00FCCC;
RCC->CIR = 0x00000000;
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* Context switch functions. These are both interrupt service routines. Manual context switch forced by calling portYIELD(). This is the SWI handler. */
|
void interrupt vPortYield(void)
|
/* Context switch functions. These are both interrupt service routines. Manual context switch forced by calling portYIELD(). This is the SWI handler. */
void interrupt vPortYield(void)
|
{
portSAVE_CONTEXT();
vTaskSwitchContext();
portRESTORE_CONTEXT();
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Reads data from the serial port in a blocking manner. */
|
bool SerialPortRead(uint8_t *data, uint32_t length)
|
/* Reads data from the serial port in a blocking manner. */
bool SerialPortRead(uint8_t *data, uint32_t length)
|
{
bool result = false;
DWORD dwRead = 0;
assert(data != NULL);
assert(length > 0);
if ( (data != NULL) && (length > 0) )
{
if (ReadFile(hUart, data, length, &dwRead, NULL))
{
if (dwRead == length)
{
result = true;
}
}
}
return result;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Initializes the GCLK driver.
Initializes the Generic Clock module, disabling and resetting all active Generic Clock Generators and Channels to their power-on default values. */
|
void system_gclk_init(void)
|
/* Initializes the GCLK driver.
Initializes the Generic Clock module, disabling and resetting all active Generic Clock Generators and Channels to their power-on default values. */
void system_gclk_init(void)
|
{
system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBA, MCLK_APBAMASK_GCLK);
GCLK->CTRLA.reg = GCLK_CTRLA_SWRST;
while (GCLK->CTRLA.reg & GCLK_CTRLA_SWRST) {
}
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
|
UINT32 EFIAPI PciOr32(IN UINTN Address, IN UINT32 OrData)
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciOr32(IN UINTN Address, IN UINT32 OrData)
|
{
return PciWrite32 (Address, PciRead32 (Address) | OrData);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* e1000_tx_timeout - Respond to a Tx Hang @netdev: network interface device structure */
|
static void e1000_tx_timeout(struct net_device *dev)
|
/* e1000_tx_timeout - Respond to a Tx Hang @netdev: network interface device structure */
static void e1000_tx_timeout(struct net_device *dev)
|
{
struct e1000_adapter *adapter = netdev_priv(netdev);
adapter->tx_timeout_count++;
schedule_work(&adapter->reset_task);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Sets or clears the selected data port bit. */
|
void GPIO_WriteBitValue(GPIO_T *port, uint16_t pin, GPIO_BSRET_T bitVal)
|
/* Sets or clears the selected data port bit. */
void GPIO_WriteBitValue(GPIO_T *port, uint16_t pin, GPIO_BSRET_T bitVal)
|
{
if (bitVal != Bit_RESET)
{
port->BSC = pin;
}
else
{
port->BR = pin ;
}
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* hw - Struct containing variables accessed by shared code */
|
int atl1c_read_mac_addr(struct atl1c_hw *hw)
|
/* hw - Struct containing variables accessed by shared code */
int atl1c_read_mac_addr(struct atl1c_hw *hw)
|
{
int err = 0;
err = atl1c_get_permanent_address(hw);
if (err)
random_ether_addr(hw->perm_mac_addr);
memcpy(hw->mac_addr, hw->perm_mac_addr, sizeof(hw->perm_mac_addr));
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Read RX register using non-blocking method.
This function reads data from the TX register directly, upper layer must make sure the RX register is full or TX FIFO has data before calling this function. */
|
static void LPUART_ReadNonBlocking(LPUART_Type *base, uint8_t *data, size_t length)
|
/* Read RX register using non-blocking method.
This function reads data from the TX register directly, upper layer must make sure the RX register is full or TX FIFO has data before calling this function. */
static void LPUART_ReadNonBlocking(LPUART_Type *base, uint8_t *data, size_t length)
|
{
size_t i;
for (i = 0; i < length; i++)
{
data[i] = base->DATA;
}
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Fetch an array of LONG or SLONG values. */
|
static int TIFFFetchLongArray(TIFF *tif, TIFFDirEntry *dir, uint32 *v)
|
/* Fetch an array of LONG or SLONG values. */
static int TIFFFetchLongArray(TIFF *tif, TIFFDirEntry *dir, uint32 *v)
|
{
if (dir->tdir_count == 1) {
v[0] = dir->tdir_offset;
return (1);
} else
return (TIFFFetchData(tif, dir, (char*) v) != 0);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Returns true if current thread is essential, false if it is not. */
|
bool z_is_thread_essential(void)
|
/* Returns true if current thread is essential, false if it is not. */
bool z_is_thread_essential(void)
|
{
return (_current->base.user_options & K_ESSENTIAL) == K_ESSENTIAL;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Enable the input direction of the specified GPIO. */
|
int32_t gpio_direction_input(struct gpio_desc *desc)
|
/* Enable the input direction of the specified GPIO. */
int32_t gpio_direction_input(struct gpio_desc *desc)
|
{
uint16_t pin;
uint8_t port;
gpio_get_portpin(desc, &pin, &port);
return adi_gpio_InputEnable(port, pin, true);
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Comparator function for two opaque pointers, ordering on (unsigned) pointer value itself. Can be used as both Key and UserStruct comparator. */
|
STATIC INTN EFIAPI PointerCompare(IN CONST VOID *Pointer1, IN CONST VOID *Pointer2)
|
/* Comparator function for two opaque pointers, ordering on (unsigned) pointer value itself. Can be used as both Key and UserStruct comparator. */
STATIC INTN EFIAPI PointerCompare(IN CONST VOID *Pointer1, IN CONST VOID *Pointer2)
|
{
if (Pointer1 == Pointer2) {
return 0;
}
if ((UINTN)Pointer1 < (UINTN)Pointer2) {
return -1;
}
return 1;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Reads multiple words of data from the IDE data port. Call the IO abstraction once to do the complete read, not one word at a time */
|
VOID EFIAPI IdeReadPortWMultiple(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT16 Port, IN UINTN Count, IN VOID *Buffer)
|
/* Reads multiple words of data from the IDE data port. Call the IO abstraction once to do the complete read, not one word at a time */
VOID EFIAPI IdeReadPortWMultiple(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT16 Port, IN UINTN Count, IN VOID *Buffer)
|
{
ASSERT (PciIo != NULL);
ASSERT (Buffer != NULL);
PciIo->Io.Read (
PciIo,
EfiPciIoWidthFifoUint16,
EFI_PCI_IO_PASS_THROUGH_BAR,
(UINT64)Port,
Count,
(UINT16 *)Buffer
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function handles interrupts of RX timer associated to port 0.
This timer is used to trigger the data decoding procedure on port 0 */
|
void USBPD_RX_PORT0_COUNTTIM_IRQHandler(void)
|
/* This function handles interrupts of RX timer associated to port 0.
This timer is used to trigger the data decoding procedure on port 0 */
void USBPD_RX_PORT0_COUNTTIM_IRQHandler(void)
|
{
uint8_t PortNum = 0;
SINGLE_TIM_IRQHandler(&(Ports[PortNum].htimcountrx), RX_COUNTTIMCH_ITFLAG(PortNum), RX_COUNTTIMCH_TIMIT(PortNum) );
}
|
st-one/X-CUBE-USB-PD
|
C++
| null | 110
|
/* The path must have already been setup for deleting the leaf, including all the proper balancing. path->nodes must be locked. */
|
static noinline int btrfs_del_leaf(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_path *path, struct extent_buffer *leaf)
|
/* The path must have already been setup for deleting the leaf, including all the proper balancing. path->nodes must be locked. */
static noinline int btrfs_del_leaf(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_path *path, struct extent_buffer *leaf)
|
{
int ret;
WARN_ON(btrfs_header_generation(leaf) != trans->transid);
ret = del_ptr(trans, root, path, 1, path->slots[1]);
if (ret)
return ret;
btrfs_unlock_up_safe(path, 0);
ret = btrfs_free_tree_block(trans, root, leaf->start, leaf->len,
0, root->root_key.objectid, 0);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Disable Multicast frames. When disabled multicast frame filtering depends on HMC bit. */
|
void synopGMAC_multicast_disable(synopGMACdevice *gmacdev)
|
/* Disable Multicast frames. When disabled multicast frame filtering depends on HMC bit. */
void synopGMAC_multicast_disable(synopGMACdevice *gmacdev)
|
{
synopGMACClearBits(gmacdev -> MacBase, GmacFrameFilter, GmacMulticastFilter);
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Config the ADC peripheral according to the specified parameters in the adcConfig. */
|
void ADC_Config(ADC_T *adc, ADC_Config_T *adcConfig)
|
/* Config the ADC peripheral according to the specified parameters in the adcConfig. */
void ADC_Config(ADC_T *adc, ADC_Config_T *adcConfig)
|
{
uint32_t reg;
reg = adc->CTRL1;
reg &= 0xFFF0FEFF;
reg |= (uint32_t)((adcConfig->mode) | ((uint32_t)adcConfig->scanConvMode << 8));
adc->CTRL1 = reg;
reg = adc->CTRL2;
reg &= 0xFFF1F7FD;
reg |= (uint32_t)(adcConfig->dataAlign | adcConfig->externalTrigConv |
((uint32_t)adcConfig->continuosConvMode << 1));
adc->CTRL2 = reg;
reg = adc->REGSEQ1;
reg &= 0xFF0FFFFF;
reg |= (uint32_t)((adcConfig->nbrOfChannel - (uint8_t)1) << 20);
adc->REGSEQ1 = reg;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Checks whether value 'o' came from an upvalue. (That can only happen with instructions OP_GETTABUP/OP_SETTABUP, which operate directly on upvalues.) */
|
static const char* getupvalname(CallInfo *ci, const TValue *o, const char **name)
|
/* Checks whether value 'o' came from an upvalue. (That can only happen with instructions OP_GETTABUP/OP_SETTABUP, which operate directly on upvalues.) */
static const char* getupvalname(CallInfo *ci, const TValue *o, const char **name)
|
{
LClosure *c = ci_func(ci);
int i;
for (i = 0; i < c->nupvalues; i++) {
if (c->upvals[i]->v == o) {
*name = upvalname(c->p, i);
return "upvalue";
}
}
return NULL;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* e1000_release_hw_control resets {CTRL_EXT|SWSM}:DRV_LOAD bit. For ASF and Pass Through versions of f/w this means that the driver is no longer loaded. For AMT version (only with 82573) i of the f/w this means that the network i/f is closed. */
|
static void e1000_release_hw_control(struct e1000_adapter *adapter)
|
/* e1000_release_hw_control resets {CTRL_EXT|SWSM}:DRV_LOAD bit. For ASF and Pass Through versions of f/w this means that the driver is no longer loaded. For AMT version (only with 82573) i of the f/w this means that the network i/f is closed. */
static void e1000_release_hw_control(struct e1000_adapter *adapter)
|
{
struct e1000_hw *hw = &adapter->hw;
u32 ctrl_ext;
u32 swsm;
if (adapter->flags & FLAG_HAS_SWSM_ON_LOAD) {
swsm = er32(SWSM);
ew32(SWSM, swsm & ~E1000_SWSM_DRV_LOAD);
} else if (adapter->flags & FLAG_HAS_CTRLEXT_ON_LOAD) {
ctrl_ext = er32(CTRL_EXT);
ew32(CTRL_EXT, ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Function called in case of error detected in USART IT Handler. */
|
void Error_Callback(void)
|
/* Function called in case of error detected in USART IT Handler. */
void Error_Callback(void)
|
{
__IO uint32_t sr_reg;
NVIC_DisableIRQ(USARTx_IRQn);
sr_reg = LL_USART_ReadReg(USARTx_INSTANCE, SR);
if (sr_reg & LL_USART_SR_NE)
{
LL_USART_ClearFlag_NE(USARTx_INSTANCE);
}
else
{
LED_Blinking(LED_BLINK_ERROR);
}
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Returns: (array zero-terminated=1) (transfer full): a NULL-terminated array of strings containing kinds of identifiers. Use g_strfreev() to free. */
|
char** g_volume_enumerate_identifiers(GVolume *volume)
|
/* Returns: (array zero-terminated=1) (transfer full): a NULL-terminated array of strings containing kinds of identifiers. Use g_strfreev() to free. */
char** g_volume_enumerate_identifiers(GVolume *volume)
|
{
GVolumeIface *iface;
g_return_val_if_fail (G_IS_VOLUME (volume), NULL);
iface = G_VOLUME_GET_IFACE (volume);
if (iface->enumerate_identifiers == NULL)
return NULL;
return (* iface->enumerate_identifiers) (volume);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* SSP macro: read 2 bytes from FIFO buffer */
|
STATIC void SSP_Read1BFifo(LPC_SSP_T *pSSP, Chip_SSP_DATA_SETUP_T *xf_setup)
|
/* SSP macro: read 2 bytes from FIFO buffer */
STATIC void SSP_Read1BFifo(LPC_SSP_T *pSSP, Chip_SSP_DATA_SETUP_T *xf_setup)
|
{
uint16_t rDat;
while ((Chip_SSP_GetStatus(pSSP, SSP_STAT_RNE) == SET) &&
(xf_setup->rx_cnt < xf_setup->length)) {
rDat = Chip_SSP_ReceiveFrame(pSSP);
if (xf_setup->rx_data) {
*(uint8_t *) ((uint32_t) xf_setup->rx_data + xf_setup->rx_cnt) = rDat;
}
xf_setup->rx_cnt++;
}
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Returns index of method in sip_headers Header namne should be in lower case */
|
static gint sip_is_known_sip_header(gchar *header_name, guint header_len)
|
/* Returns index of method in sip_headers Header namne should be in lower case */
static gint sip_is_known_sip_header(gchar *header_name, guint header_len)
|
{
guint pos;
if(header_len>1){
pos = GPOINTER_TO_UINT(g_hash_table_lookup(sip_headers_hash, header_name));
if (pos!=0)
return pos;
}
for (pos = 1; pos < array_length(sip_headers); pos++) {
if (sip_headers[pos].compact_name != NULL &&
header_len == strlen(sip_headers[pos].compact_name) &&
g_ascii_strncasecmp(header_name, sip_headers[pos].compact_name, header_len) == 0)
return pos;
}
return -1;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Reads a block of data from the FSMC SRAM memory. */
|
void SRAM_ReadBuffer(uint16_t *pBuffer, uint32_t ReadAddr, uint32_t NumHalfwordToRead)
|
/* Reads a block of data from the FSMC SRAM memory. */
void SRAM_ReadBuffer(uint16_t *pBuffer, uint32_t ReadAddr, uint32_t NumHalfwordToRead)
|
{
for(; NumHalfwordToRead != 0; NumHalfwordToRead--)
{
*pBuffer++ = *(__IO uint16_t*) (Bank1_SRAM3_ADDR + ReadAddr);
ReadAddr += 2;
}
}
|
avem-labs/Avem
|
C++
|
MIT License
| 1,752
|
/* Configures LCD control lines in Output Push-Pull mode. */
|
void LCD_CtrlLinesConfig(void)
|
/* Configures LCD control lines in Output Push-Pull mode. */
void LCD_CtrlLinesConfig(void)
|
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHBPeriphClockCmd(LCD_NCS_GPIO_CLK, ENABLE);
GPIO_InitStructure.GPIO_Pin = LCD_NCS_PIN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(LCD_NCS_GPIO_PORT, &GPIO_InitStructure);
LCD_CtrlLinesWrite(LCD_NCS_GPIO_PORT, LCD_NCS_PIN, Bit_SET);
}
|
avem-labs/Avem
|
C++
|
MIT License
| 1,752
|
/* This function is used to handle flash write ipc interrupt. */
|
IMAGE2_RAM_TEXT_SECTION void FLASH_Write_IPC_Int(VOID *Data, u32 IrqStatus, u32 ChanNum)
|
/* This function is used to handle flash write ipc interrupt. */
IMAGE2_RAM_TEXT_SECTION void FLASH_Write_IPC_Int(VOID *Data, u32 IrqStatus, u32 ChanNum)
|
{
( void ) Data;
( void ) IrqStatus;
( void ) ChanNum;
if(__get_PRIMASK() == 0) { asm volatile ("cpsid i" : : : "memory");
asm volatile ("wfe");
asm volatile ("wfe");
asm volatile ("cpsie i" : : : "memory");
} else { asm volatile ("wfe");
asm volatile ("wfe");
}
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Addition in the field. Source operands shall fit on 257 bits; output will be lower than twice the modulus. */
|
static void add_f256(uint32_t *d, const uint32_t *a, const uint32_t *b)
|
/* Addition in the field. Source operands shall fit on 257 bits; output will be lower than twice the modulus. */
static void add_f256(uint32_t *d, const uint32_t *a, const uint32_t *b)
|
{
uint32_t w, cc;
int i;
cc = 0;
for (i = 0; i < 9; i ++) {
w = a[i] + b[i] + cc;
d[i] = w & 0x3FFFFFFF;
cc = w >> 30;
}
w >>= 16;
d[8] &= 0xFFFF;
d[3] -= w << 6;
d[6] -= w << 12;
d[7] += w << 14;
cc = w;
for (i = 0; i < 9; i ++) {
w = d[i] + cc;
d[i] = w & 0x3FFFFFFF;
cc = ARSH(w, 30);
}
}
|
RavenSystem/esp-homekit-devices
|
C++
|
Other
| 2,577
|
/* Change Logs: Date Author Notes flyingcys first version */
|
static void system_clock_init(void)
|
/* Change Logs: Date Author Notes flyingcys first version */
static void system_clock_init(void)
|
{
GLB_Set_System_CLK(GLB_DLL_XTAL_32M, GLB_SYS_CLK_DLL144M);
GLB_Set_MTimer_CLK(1, GLB_MTIMER_CLK_BCLK, 71);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Clear the state of the voltage comparator interrupt status bits.
AM_HAL_VCOMP_INT_OUTHI AM_HAL_VCOMP_INT_OUTLO */
|
void am_hal_vcomp_int_clear(uint32_t ui32Interrupt)
|
/* Clear the state of the voltage comparator interrupt status bits.
AM_HAL_VCOMP_INT_OUTHI AM_HAL_VCOMP_INT_OUTLO */
void am_hal_vcomp_int_clear(uint32_t ui32Interrupt)
|
{
AM_REG(VCOMP, INTCLR) = ui32Interrupt;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param isMute true is mute, false is unmute. return kStatus_Success is success, else configure failed. */
|
status_t HAL_CODEC_WM8960_SetMute(void *handle, uint32_t playChannel, bool isMute)
|
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param isMute true is mute, false is unmute. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_WM8960_SetMute(void *handle, uint32_t playChannel, bool isMute)
|
{
assert(handle != NULL);
status_t retVal = kStatus_Success;
if (((playChannel & (uint32_t)kWM8960_HeadphoneLeft) != 0U) ||
((playChannel & (uint32_t)kWM8960_HeadphoneRight) != 0U))
{
retVal = WM8960_SetMute((wm8960_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)),
kWM8960_ModuleHP, isMute);
}
if (((playChannel & (uint32_t)kWM8960_SpeakerLeft) != 0U) || ((playChannel & (uint32_t)kWM8960_SpeakerRight) != 0U))
{
retVal = WM8960_SetMute((wm8960_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)),
kWM8960_ModuleSpeaker, isMute);
}
return retVal;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Remove Text Ex Device from Consplitter Text Input Ex list. */
|
EFI_STATUS ConSplitterTextInExDeleteDevice(IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private, IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx)
|
/* Remove Text Ex Device from Consplitter Text Input Ex list. */
EFI_STATUS ConSplitterTextInExDeleteDevice(IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private, IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx)
|
{
UINTN Index;
for (Index = 0; Index < Private->CurrentNumberOfExConsoles; Index++) {
if (Private->TextInExList[Index] == TextInEx) {
for ( ; Index < Private->CurrentNumberOfExConsoles - 1; Index++) {
Private->TextInExList[Index] = Private->TextInExList[Index + 1];
}
Private->CurrentNumberOfExConsoles--;
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This is the entry point for the bootloader application and is called by the reset interrupt vector after the C-startup routines executed. */
|
void main(void)
|
/* This is the entry point for the bootloader application and is called by the reset interrupt vector after the C-startup routines executed. */
void main(void)
|
{
Init();
BootInit();
PostInit();
while (1)
{
BootTask();
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* enable EXTI interrupt for specific line specified by parameter encoded with MCHP_XEC_ECIA macro. */
|
int mchp_xec_ecia_info_enable(int ecia_info)
|
/* enable EXTI interrupt for specific line specified by parameter encoded with MCHP_XEC_ECIA macro. */
int mchp_xec_ecia_info_enable(int ecia_info)
|
{
uint8_t girq = (uint8_t)MCHP_XEC_ECIA_GIRQ(ecia_info);
uint8_t src = (uint8_t)MCHP_XEC_ECIA_GIRQ_POS(ecia_info);
return mchp_xec_ecia_enable(girq, src);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* curl_slist_append() appends a string to the linked list. It always returns the address of the first record, so that you can use this function as an initialization function as well as an append function. If you find this bothersome, then simply create a separate _init function and call it appropriately from within the program. */
|
struct curl_slist* curl_slist_append(struct curl_slist *list, const char *data)
|
/* curl_slist_append() appends a string to the linked list. It always returns the address of the first record, so that you can use this function as an initialization function as well as an append function. If you find this bothersome, then simply create a separate _init function and call it appropriately from within the program. */
struct curl_slist* curl_slist_append(struct curl_slist *list, const char *data)
|
{
char *dupdata = strdup(data);
if(!dupdata)
return NULL;
list = Curl_slist_append_nodup(list, dupdata);
if(!list)
free(dupdata);
return list;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* RETURNS: Zero on success, AC_ERR_* mask on failure */
|
unsigned int ata_do_simple_cmd(struct ata_device *dev, u8 cmd)
|
/* RETURNS: Zero on success, AC_ERR_* mask on failure */
unsigned int ata_do_simple_cmd(struct ata_device *dev, u8 cmd)
|
{
struct ata_taskfile tf;
ata_tf_init(dev, &tf);
tf.command = cmd;
tf.flags |= ATA_TFLAG_DEVICE;
tf.protocol = ATA_PROT_NODATA;
return ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* 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 ScsiBusComponentNameGetDriverName(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 ScsiBusComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
|
{
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mScsiBusDriverNameTable,
DriverName,
(BOOLEAN)(This == &gScsiBusComponentName)
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Writes and returns a new value to DR6. 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 AsmWriteDr6(IN UINTN Value)
|
/* Writes and returns a new value to DR6. 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 AsmWriteDr6(IN UINTN Value)
|
{
_asm {
mov eax, Value
mov dr6, eax
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Get the numbers of segments on the ooseq list */
|
static int tcp_oos_count(struct tcp_pcb *pcb)
|
/* Get the numbers of segments on the ooseq list */
static int tcp_oos_count(struct tcp_pcb *pcb)
|
{
int num = 0;
struct tcp_seg* seg = pcb->ooseq;
while(seg != NULL) {
num++;
seg = seg->next;
}
return num;
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* Enables or disables the selected DAC channel software trigger. */
|
void DAC_SoftTrgEnable(uint32_t DAC_Channel, FunctionalState Cmd)
|
/* Enables or disables the selected DAC channel software trigger. */
void DAC_SoftTrgEnable(uint32_t DAC_Channel, FunctionalState Cmd)
|
{
assert_param(IS_DAC_CHANNEL(DAC_Channel));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
DAC->SOTTR |= (uint32_t)DAC_SOTTR_TR1EN << (DAC_Channel >> 4);
}
else
{
DAC->SOTTR &= ~((uint32_t)DAC_SOTTR_TR1EN << (DAC_Channel >> 4));
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* I2C MSP De-Initialization This function frees the hardware resources used in this example: */
|
void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c)
|
/* I2C MSP De-Initialization This function frees the hardware resources used in this example: */
void HAL_I2C_MspDeInit(I2C_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_ER_IRQn);
HAL_NVIC_DisableIRQ(I2Cx_EV_IRQn);
HAL_NVIC_DisableIRQ(I2Cx_DMA_TX_IRQn);
HAL_NVIC_DisableIRQ(I2Cx_DMA_RX_IRQn);
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.