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 |
|---|---|---|---|---|---|---|---|
/* function : de_vsu_set_reg_base(unsigned int sel, unsigned int chno, void *base) description : set vsu reg base parameters : sel <rtmx select> chno <overlay select> base <reg base> return : success */ | int de_vsu_set_reg_base(unsigned int sel, unsigned int chno, void *base) | /* function : de_vsu_set_reg_base(unsigned int sel, unsigned int chno, void *base) description : set vsu reg base parameters : sel <rtmx select> chno <overlay select> base <reg base> return : success */
int de_vsu_set_reg_base(unsigned int sel, unsigned int chno, void *base) | {
DE_INF("sel=%d, chno=%d, base=0x%p\n", sel, chno, base);
vsu_dev[sel][chno] = (struct __vsu_reg_t *) base;
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Determine if the device can support Fast Back to Back attribute. */ | EFI_STATUS GetFastBackToBackSupport(IN PCI_IO_DEVICE *PciIoDevice, IN UINT8 StatusIndex) | /* Determine if the device can support Fast Back to Back attribute. */
EFI_STATUS GetFastBackToBackSupport(IN PCI_IO_DEVICE *PciIoDevice, IN UINT8 StatusIndex) | {
EFI_PCI_IO_PROTOCOL *PciIo;
EFI_STATUS Status;
UINT32 StatusRegister;
PciIo = &PciIoDevice->PciIo;
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, StatusIndex, 1, &StatusRegister);
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
if ((StatusRegister & EFI_PCI_FAST_BACK_TO_BACK_CAPABLE) != 0) {
return EFI_SUCCESS;
} else {
return EFI_UNSUPPORTED;
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Return value: 1 if autosense was available / 0 if not */ | static int ipr_get_autosense(struct ipr_cmnd *ipr_cmd) | /* Return value: 1 if autosense was available / 0 if not */
static int ipr_get_autosense(struct ipr_cmnd *ipr_cmd) | {
struct ipr_ioasa *ioasa = &ipr_cmd->ioasa;
if ((be32_to_cpu(ioasa->ioasc_specific) & IPR_AUTOSENSE_VALID) == 0)
return 0;
memcpy(ipr_cmd->scsi_cmd->sense_buffer, ioasa->auto_sense.data,
min_t(u16, be16_to_cpu(ioasa->auto_sense.auto_sense_len),
SCSI_SENSE_BUFFERSIZE));
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Is a specified page validly mapped within a specified address region? */ | static int mpu_context_addr_valid_for_region(struct mm_struct *mm, mpu_addr_region_t *r, unsigned int a, unsigned int f) | /* Is a specified page validly mapped within a specified address region? */
static int mpu_context_addr_valid_for_region(struct mm_struct *mm, mpu_addr_region_t *r, unsigned int a, unsigned int f) | {
mpu_context_t *p = mpu_context_p(mm);
unsigned int *mask;
unsigned int page;
unsigned int idx;
unsigned int bit;
int i; int b = 0;
i = r - mpu_addr_region_tbl;
mask = p->page_tbl + mpu_page_tbl_off[i];
page = (a - r->bot) >> PAGE_SHIFT;
idx = page >> 5;
bit = 1 << (page & 31);
b = (mask[idx] & bit) ? 1 : 0;
return b;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Dump reserved exception information.
See z_arm_fault_dump() for example. */ | static void reserved_exception(const z_arch_esf_t *esf, int fault) | /* Dump reserved exception information.
See z_arm_fault_dump() for example. */
static void reserved_exception(const z_arch_esf_t *esf, int fault) | {
ARG_UNUSED(esf);
PR_FAULT_INFO("***** %s %d) *****",
fault < 16 ? "Reserved Exception (" : "Spurious interrupt (IRQ ",
fault - 16);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. param rxDmaHandle Handle for the eDMA receive channel. Created by the user prior to calling this function. param txDmaHandle Handle for the eDMA transmit channel. Created by the user prior to calling this function. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */ | void LPI2C_MasterCreateEDMAHandle(LPI2C_Type *base, lpi2c_master_edma_handle_t *handle, edma_handle_t *rxDmaHandle, edma_handle_t *txDmaHandle, lpi2c_master_edma_transfer_callback_t callback, void *userData) | /* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. param rxDmaHandle Handle for the eDMA receive channel. Created by the user prior to calling this function. param txDmaHandle Handle for the eDMA transmit channel. Created by the user prior to calling this function. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */
void LPI2C_MasterCreateEDMAHandle(LPI2C_Type *base, lpi2c_master_edma_handle_t *handle, edma_handle_t *rxDmaHandle, edma_handle_t *txDmaHandle, lpi2c_master_edma_transfer_callback_t callback, void *userData) | {
assert(handle);
assert(rxDmaHandle);
assert(txDmaHandle);
memset(handle, 0, sizeof(*handle));
handle->base = base;
handle->completionCallback = callback;
handle->userData = userData;
handle->rx = rxDmaHandle;
handle->tx = FSL_FEATURE_LPI2C_HAS_SEPARATE_DMA_RX_TX_REQn(base) ? txDmaHandle : rxDmaHandle;
EDMA_SetCallback(handle->rx, LPI2C_MasterEDMACallback, handle);
if (FSL_FEATURE_LPI2C_HAS_SEPARATE_DMA_RX_TX_REQn(base))
{
EDMA_SetCallback(handle->tx, LPI2C_MasterEDMACallback, handle);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Stops audio Codec playing. It powers down the codec. */ | static uint32_t Codec_Stop(uint32_t CodecPdwnMode) | /* Stops audio Codec playing. It powers down the codec. */
static uint32_t Codec_Stop(uint32_t CodecPdwnMode) | {
uint32_t counter = 0;
Codec_Mute(AUDIO_MUTE_ON);
if (CodecPdwnMode == CODEC_PDWN_SW)
{
counter += Codec_WriteRegister(0x02, 0x9F);
}
else
{
counter += Codec_WriteRegister(0x02, 0x9F);
Delay(0xFFF);
GPIO_WriteBit(AUDIO_RESET_GPIO, AUDIO_RESET_PIN, Bit_RESET);
}
return counter;
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* 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 = {0};
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
if(huart->Instance==USART1)
{
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART1;
PeriphClkInitStruct.Usart16ClockSelection = RCC_USART16CLKSOURCE_D2PCLK2;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
Error_Handler();
}
__HAL_RCC_USART1_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Error alert box, taking a format and a list of arguments. */ | void simple_error_message_box(const char *msg_format,...) | /* Error alert box, taking a format and a list of arguments. */
void simple_error_message_box(const char *msg_format,...) | {
va_list ap;
va_start(ap, msg_format);
vsimple_error_message_box(msg_format, ap);
va_end(ap);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* If there is no additional space for HOB creation, then ASSERT(). If the FvImage buffer is not at its required alignment, then ASSERT(). */ | VOID EFIAPI BuildFv2Hob(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN CONST EFI_GUID *FvName, IN CONST EFI_GUID *FileName) | /* If there is no additional space for HOB creation, then ASSERT(). If the FvImage buffer is not at its required alignment, then ASSERT(). */
VOID EFIAPI BuildFv2Hob(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN CONST EFI_GUID *FvName, IN CONST EFI_GUID *FileName) | {
EFI_HOB_FIRMWARE_VOLUME2 *Hob;
if (!InternalCheckFvAlignment (BaseAddress, Length)) {
ASSERT (FALSE);
return;
}
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV2, (UINT16)sizeof (EFI_HOB_FIRMWARE_VOLUME2));
if (Hob == NULL) {
return;
}
Hob->BaseAddress = BaseAddress;
Hob->Length = Length;
CopyGuid (&Hob->FvName, FvName);
CopyGuid (&Hob->FileName, FileName);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ | RETURN_STATUS EFIAPI SafeInt8ToUint32(IN INT8 Operand, OUT UINT32 *Result) | /* If the conversion results in an overflow or an underflow condition, then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeInt8ToUint32(IN INT8 Operand, OUT UINT32 *Result) | {
RETURN_STATUS Status;
if (Result == NULL) {
return RETURN_INVALID_PARAMETER;
}
if (Operand >= 0) {
*Result = (UINT32)Operand;
Status = RETURN_SUCCESS;
} else {
*Result = UINT32_ERROR;
Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Co-routines that are readied by an interrupt cannot be placed directly into the ready lists (there is no mutual exclusion). Instead they are placed in in the pending ready list in order that they can later be moved to the ready list by the co-routine scheduler. */ | static void prvCheckPendingReadyList(void) | /* Co-routines that are readied by an interrupt cannot be placed directly into the ready lists (there is no mutual exclusion). Instead they are placed in in the pending ready list in order that they can later be moved to the ready list by the co-routine scheduler. */
static void prvCheckPendingReadyList(void) | {
while( listLIST_IS_EMPTY( &xPendingReadyCoRoutineList ) == pdFALSE )
{
corCRCB *pxUnblockedCRCB;
PortDisableInt_NoNest();
{
pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyCoRoutineList) );
( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) );
}
PortEnableInt_NoNest();
( void ) uxListRemove( &( pxUnblockedCRCB->xGenericListItem ) );
prvAddCoRoutineToReadyQueue( pxUnblockedCRCB );
}
} | eerimoq/simba | C++ | Other | 337 |
/* This PDC call reads from the Stable Storage address supplied in staddr and copies count bytes to the memory address memaddr. The call will fail if staddr+count > PDC_STABLE size. */ | int pdc_stable_read(unsigned long staddr, void *memaddr, unsigned long count) | /* This PDC call reads from the Stable Storage address supplied in staddr and copies count bytes to the memory address memaddr. The call will fail if staddr+count > PDC_STABLE size. */
int pdc_stable_read(unsigned long staddr, void *memaddr, unsigned long count) | {
int retval;
unsigned long flags;
spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_READ, staddr,
__pa(pdc_result), count);
convert_to_wide(pdc_result);
memcpy(memaddr, pdc_result, count);
spin_unlock_irqrestore(&pdc_lock, flags);
return retval;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Determine if action frame is p2p action type */ | static bool brcmf_p2p_is_p2p_action(void *frame, u32 frame_len) | /* Determine if action frame is p2p action type */
static bool brcmf_p2p_is_p2p_action(void *frame, u32 frame_len) | {
struct brcmf_p2p_action_frame *act_frm;
if (frame == NULL)
return false;
act_frm = (struct brcmf_p2p_action_frame *)frame;
if (frame_len < sizeof(struct brcmf_p2p_action_frame) - 1)
return false;
if (act_frm->category == P2P_AF_CATEGORY &&
act_frm->type == P2P_VER &&
memcmp(act_frm->oui, P2P_OUI, P2P_OUI_LEN) == 0)
return true;
return false;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This Function Wait until Data RX Ready, and return Data Read from UART. */ | uint8_t uart_read(uart_num_t uart_num) | /* This Function Wait until Data RX Ready, and return Data Read from UART. */
uint8_t uart_read(uart_num_t uart_num) | {
uint32_t uart_port;
uint8_t uart_val;
uart_port = uart_num;
while ((UART_LSR(uart_port) & UART_LSR_RDR) == 0);
uart_val = (UART_RBR(uart_port) & UART_RBR_MASKBIT);
return uart_val;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */ | UINT8 EFIAPI MmioWrite8(IN UINTN Address, IN UINT8 Value) | /* If 8-bit MMIO register operations are not supported, then ASSERT(). */
UINT8 EFIAPI MmioWrite8(IN UINTN Address, IN UINT8 Value) | {
return (UINT8)MmioWriteWorker (Address, EfiCpuIoWidthUint8, Value);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* During start commit, the old_idx RB-tree is used to avoid overwriting index nodes that were in the index last commit but have since been deleted. This is necessary for recovery i.e. the old index must be kept intact until the new index is successfully written. The old-idx RB-tree is used for the in-the-gaps method of writing index nodes and is destroyed every commit. */ | void destroy_old_idx(struct ubifs_info *c) | /* During start commit, the old_idx RB-tree is used to avoid overwriting index nodes that were in the index last commit but have since been deleted. This is necessary for recovery i.e. the old index must be kept intact until the new index is successfully written. The old-idx RB-tree is used for the in-the-gaps method of writing index nodes and is destroyed every commit. */
void destroy_old_idx(struct ubifs_info *c) | {
struct rb_node *this = c->old_idx.rb_node;
struct ubifs_old_idx *old_idx;
while (this) {
if (this->rb_left) {
this = this->rb_left;
continue;
} else if (this->rb_right) {
this = this->rb_right;
continue;
}
old_idx = rb_entry(this, struct ubifs_old_idx, rb);
this = rb_parent(this);
if (this) {
if (this->rb_left == &old_idx->rb)
this->rb_left = NULL;
else
this->rb_right = NULL;
}
kfree(old_idx);
}
c->old_idx = RB_ROOT;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Write to SSC Transmit Holding Register. Send data through SSC Data frame. */ | uint32_t ssc_write(Ssc *p_ssc, uint32_t ul_frame) | /* Write to SSC Transmit Holding Register. Send data through SSC Data frame. */
uint32_t ssc_write(Ssc *p_ssc, uint32_t ul_frame) | {
uint32_t ul_timeout = SSC_DEFAULT_TIMEOUT;
while (!(p_ssc->SSC_SR & SSC_SR_TXEMPTY)) {
if (!ul_timeout--) {
return SSC_RC_ERROR;
}
}
p_ssc->SSC_THR = ul_frame;
return SSC_RC_OK;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Set L3 Destination/Source Address filter value of IPv6. */ | int32_t ETH_MAC_SetIpv6AddrFilterValue(const uint32_t au32Addr[]) | /* Set L3 Destination/Source Address filter value of IPv6. */
int32_t ETH_MAC_SetIpv6AddrFilterValue(const uint32_t au32Addr[]) | {
int32_t i32Ret = LL_OK;
if (NULL == au32Addr) {
i32Ret = LL_ERR_INVD_PARAM;
} else {
WRITE_REG32(CM_ETH->MAC_L3ADDRR0, au32Addr[0]);
WRITE_REG32(CM_ETH->MAC_L3ADDRR1, au32Addr[1]);
WRITE_REG32(CM_ETH->MAC_L3ADDRR2, au32Addr[2]);
WRITE_REG32(CM_ETH->MAC_L3ADDRR3, au32Addr[3]);
}
return i32Ret;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Compares two addresses contained into two sockaddr_storage structures.
This function will return '0' if the two addresses matches, '-1' if not. */ | int sock_cmpaddr(struct sockaddr_storage *first, struct sockaddr_storage *second) | /* Compares two addresses contained into two sockaddr_storage structures.
This function will return '0' if the two addresses matches, '-1' if not. */
int sock_cmpaddr(struct sockaddr_storage *first, struct sockaddr_storage *second) | {
if (first->ss_family == second->ss_family)
{
if (first->ss_family == AF_INET)
{
if (memcmp(&(((struct sockaddr_in *) first)->sin_addr),
&(((struct sockaddr_in *) second)->sin_addr),
sizeof(struct in_addr)) == 0)
return 0;
}
else
{
if (memcmp(&(((struct sockaddr_in6 *) first)->sin6_addr),
&(((struct sockaddr_in6 *) second)->sin6_addr),
sizeof(struct in6_addr)) == 0)
return 0;
}
}
return -1;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Retrieves the PCD info protocol from the handle database. */ | GET_PCD_INFO_PROTOCOL* GetPcdInfoProtocolPointer(VOID) | /* Retrieves the PCD info protocol from the handle database. */
GET_PCD_INFO_PROTOCOL* GetPcdInfoProtocolPointer(VOID) | {
EFI_STATUS Status;
if (mPcdInfo == NULL) {
Status = gBS->LocateProtocol (&gGetPcdInfoProtocolGuid, NULL, (VOID **)&mPcdInfo);
ASSERT_EFI_ERROR (Status);
ASSERT (mPcdInfo != NULL);
}
return mPcdInfo;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Configures the voltage threshold detected by the Power Voltage Detector(PVD).
The function is used to configures the voltage threshold detected by the Power Voltage Detector(PVD). */ | void SysCtlPVDLevelConfig(unsigned long ulConfig) | /* Configures the voltage threshold detected by the Power Voltage Detector(PVD).
The function is used to configures the voltage threshold detected by the Power Voltage Detector(PVD). */
void SysCtlPVDLevelConfig(unsigned long ulConfig) | {
xHWREG(PWR_CR) &= ~(PWR_CR_PVDE | PWR_CR_PLS_M);
xHWREG(PWR_CR) |= ulConfig;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* read 32 bit values, not 64 bit; for memories that only support 32 bit reads; usually a single dword. */ | static int ipath_read_umem32(struct ipath_devdata *dd, void __user *uaddr, const void __iomem *caddr, size_t count) | /* read 32 bit values, not 64 bit; for memories that only support 32 bit reads; usually a single dword. */
static int ipath_read_umem32(struct ipath_devdata *dd, void __user *uaddr, const void __iomem *caddr, size_t count) | {
const u32 __iomem *reg_addr = caddr;
const u32 __iomem *reg_end = reg_addr + (count / sizeof(u32));
int ret;
if (reg_addr < (u32 __iomem *) dd->ipath_kregbase ||
reg_end > (u32 __iomem *) dd->ipath_kregend) {
ret = -EINVAL;
goto bail;
}
while (reg_addr < reg_end) {
u32 data = readl(reg_addr);
if (copy_to_user(uaddr, &data, sizeof(data))) {
ret = -EFAULT;
goto bail;
}
reg_addr++;
uaddr += sizeof(u32);
}
ret = 0;
bail:
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* brief Return Frequency of Adc Clock return Frequency of Adc. */ | uint32_t CLOCK_GetAdcClkFreq(uint32_t id) | /* brief Return Frequency of Adc Clock return Frequency of Adc. */
uint32_t CLOCK_GetAdcClkFreq(uint32_t id) | {
uint32_t freq = 0U;
uint32_t div = 0U;
switch ((id == 0) ? (SYSCON->ADC0CLKSEL) : (SYSCON->ADC1CLKSEL))
{
case 0U:
freq = CLOCK_GetCoreSysClkFreq();
break;
case 1U:
freq = CLOCK_GetPll0OutFreq();
break;
case 2U:
freq = CLOCK_GetFroHfFreq();
break;
default:
freq = 0U;
break;
}
div = ((id == 0) ? ((SYSCON->ADC0CLKDIV & SYSCON_ADC0CLKDIV_DIV_MASK) + 1U) :
((SYSCON->ADC1CLKDIV & SYSCON_ADC1CLKDIV_DIV_MASK) + 1U));
return freq / div;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Check if a color format is chroma keyed or not */ | bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf) | /* Check if a color format is chroma keyed or not */
bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf) | {
bool is_chroma_keyed = false;
switch(cf) {
case LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED:
case LV_IMG_CF_RAW_CHROMA_KEYED:
case LV_IMG_CF_INDEXED_1BIT:
case LV_IMG_CF_INDEXED_2BIT:
case LV_IMG_CF_INDEXED_4BIT:
case LV_IMG_CF_INDEXED_8BIT:
is_chroma_keyed = true;
break;
default:
is_chroma_keyed = false;
break;
}
return is_chroma_keyed;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* LOW is XOR'ed with the corresponding bit in the software-pulse and the PRS input signal to generate. */ | void prs_software_level_low(enum prs_ch ch) | /* LOW is XOR'ed with the corresponding bit in the software-pulse and the PRS input signal to generate. */
void prs_software_level_low(enum prs_ch ch) | {
PRS_SWLEVEL &= ~PRS_SWLEVEL_CHxLEVEL(ch);
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* returns true if interrupts had been enabled before we disabled them */ | int disable_interrupts(void) | /* returns true if interrupts had been enabled before we disabled them */
int disable_interrupts(void) | {
int status = read_aux_reg(ARC_AUX_STATUS32);
int state = (status & (E1_MASK | E2_MASK)) ? 1 : 0;
status &= ~(E1_MASK | E2_MASK);
__asm__("flag %0" : : "r" (status));
return state;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Note: Only use this function to copy items that is word aligned. */ | void crypto4xx_memcpy_le(unsigned int *dst, const unsigned char *buf, int len) | /* Note: Only use this function to copy items that is word aligned. */
void crypto4xx_memcpy_le(unsigned int *dst, const unsigned char *buf, int len) | {
u8 *tmp;
for (; len >= 4; buf += 4, len -= 4)
*dst++ = cpu_to_le32(*(unsigned int *) buf);
tmp = (u8 *)dst;
switch (len) {
case 3:
*tmp++ = 0;
*tmp++ = *(buf+2);
*tmp++ = *(buf+1);
*tmp++ = *buf;
break;
case 2:
*tmp++ = 0;
*tmp++ = 0;
*tmp++ = *(buf+1);
*tmp++ = *buf;
break;
case 1:
*tmp++ = 0;
*tmp++ = 0;
*tmp++ = 0;
*tmp++ = *buf;
break;
default:
break;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* write a 1-byte data to a specific IDE port. */ | VOID EFIAPI IdeWritePortB(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT16 Port, IN UINT8 Data) | /* write a 1-byte data to a specific IDE port. */
VOID EFIAPI IdeWritePortB(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT16 Port, IN UINT8 Data) | {
ASSERT (PciIo != NULL);
PciIo->Io.Write (
PciIo,
EfiPciIoWidthUint8,
EFI_PCI_IO_PASS_THROUGH_BAR,
(UINT64)Port,
1,
&Data
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Receives a byte that has been sent to the I2C Master. */ | uint32_t I2CMasterDataGet(uint32_t ui32Base) | /* Receives a byte that has been sent to the I2C Master. */
uint32_t I2CMasterDataGet(uint32_t ui32Base) | {
ASSERT(_I2CBaseValid(ui32Base));
return(HWREG(ui32Base + I2C_O_MDR));
} | micropython/micropython | C++ | Other | 18,334 |
/* Get some file information by its file descriptor. */ | void _ku_file_information(int fd, int *is_dir, ino_t *inode) | /* Get some file information by its file descriptor. */
void _ku_file_information(int fd, int *is_dir, ino_t *inode) | {
g_assert (fd != -1);
struct stat st;
memset (&st, 0, sizeof (struct stat));
if (fstat (fd, &st) == -1)
{
KU_W ("fstat failed, assuming it is just a file");
is_dir = NULL;
return;
}
if (is_dir != NULL)
*is_dir = ((st.st_mode & S_IFDIR) == S_IFDIR) ? 1 : 0;
if (inode != NULL)
*inode = st.st_ino;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns the next prop/declaration pair of the list, or NULL if we reached end of list (or if an error occurs) */ | CRPropList* cr_prop_list_get_next(CRPropList *a_this) | /* Returns the next prop/declaration pair of the list, or NULL if we reached end of list (or if an error occurs) */
CRPropList* cr_prop_list_get_next(CRPropList *a_this) | {
g_return_val_if_fail (a_this && PRIVATE (a_this), NULL);
return PRIVATE (a_this)->next;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Create new file entry and allocate space on the NVMEM. Applies only to user files. Modify the size of file. If the entry is unallocated - allocate it to size ulNewLen (marked invalid). If it is allocated then deallocate it first. To just mark the file as invalid without resizing - set ulNewLen=0.
nvmem_create_entry */ | INT32 nvmem_create_entry(UINT32 ulFileId, UINT32 ulNewLen) | /* Create new file entry and allocate space on the NVMEM. Applies only to user files. Modify the size of file. If the entry is unallocated - allocate it to size ulNewLen (marked invalid). If it is allocated then deallocate it first. To just mark the file as invalid without resizing - set ulNewLen=0.
nvmem_create_entry */
INT32 nvmem_create_entry(UINT32 ulFileId, UINT32 ulNewLen) | {
UINT8 *ptr;
UINT8 *args;
UINT8 retval;
ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD);
args = UINT32_TO_STREAM(args, ulFileId);
args = UINT32_TO_STREAM(args, ulNewLen);
hci_command_send(HCI_CMND_NVMEM_CREATE_ENTRY,ptr, NVMEM_CREATE_PARAMS_LEN);
SimpleLinkWaitEvent(HCI_CMND_NVMEM_CREATE_ENTRY, &retval);
return(retval);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* This API reads the error status from the sensor. */ | uint16_t bma4_get_error_status(struct bma4_err_reg *err_reg, struct bma4_dev *dev) | /* This API reads the error status from the sensor. */
uint16_t bma4_get_error_status(struct bma4_err_reg *err_reg, struct bma4_dev *dev) | {
uint16_t rslt = 0;
uint8_t data = 0;
if (dev == NULL) {
rslt |= BMA4_E_NULL_PTR;
} else {
rslt |= bma4_read_regs(BMA4_ERROR_ADDR, &data, 1, dev);
if (rslt == BMA4_OK) {
err_reg->fatal_err = BMA4_GET_BITS_POS_0(data, BMA4_FATAL_ERR);
err_reg->cmd_err = BMA4_GET_BITSLICE(data, BMA4_CMD_ERR);
err_reg->err_code = BMA4_GET_BITSLICE(data, BMA4_ERR_CODE);
err_reg->fifo_err = BMA4_GET_BITSLICE(data, BMA4_FIFO_ERR);
err_reg->aux_err = BMA4_GET_BITSLICE(data, BMA4_AUX_ERR);
}
}
return rslt;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Enables or disables the Internal Low Speed oscillator (LSI). LSI can not be disabled if the IWDG is running. */ | void RCC_LSICmd(FunctionalState NewState) | /* Enables or disables the Internal Low Speed oscillator (LSI). LSI can not be disabled if the IWDG is running. */
void RCC_LSICmd(FunctionalState NewState) | {
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
RCC->CSR |= 0x00000001;
}
else
{
RCC->CSR &= 0xfffffffe;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Try to allocate a partial slab from a specific node. */ | static struct page* get_partial_node(struct kmem_cache_node *n) | /* Try to allocate a partial slab from a specific node. */
static struct page* get_partial_node(struct kmem_cache_node *n) | {
struct page *page;
if (!n || !n->nr_partial)
return NULL;
spin_lock(&n->list_lock);
list_for_each_entry(page, &n->partial, lru)
if (lock_and_freeze_slab(n, page))
goto out;
page = NULL;
out:
spin_unlock(&n->list_lock);
return page;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Maintained at www.Open-FCoE.org Frame allocation. Check the CRC in a frame. */ | u32 fc_frame_crc_check(struct fc_frame *fp) | /* Maintained at www.Open-FCoE.org Frame allocation. Check the CRC in a frame. */
u32 fc_frame_crc_check(struct fc_frame *fp) | {
u32 crc;
u32 error;
const u8 *bp;
unsigned int len;
WARN_ON(!fc_frame_is_linear(fp));
fr_flags(fp) &= ~FCPHF_CRC_UNCHECKED;
len = (fr_len(fp) + 3) & ~3;
bp = (const u8 *) fr_hdr(fp);
crc = ~crc32(~0, bp, len);
error = crc ^ fr_crc(fp);
return error;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Waits for I/O to complete on the buffer supplied. It returns immediately if no I/O is pending. It returns the I/O error code, if any, or 0 if there was no error. */ | int xfs_buf_iowait(xfs_buf_t *bp) | /* Waits for I/O to complete on the buffer supplied. It returns immediately if no I/O is pending. It returns the I/O error code, if any, or 0 if there was no error. */
int xfs_buf_iowait(xfs_buf_t *bp) | {
trace_xfs_buf_iowait(bp, _RET_IP_);
if (atomic_read(&bp->b_io_remaining))
blk_run_address_space(bp->b_target->bt_mapping);
wait_for_completion(&bp->b_iowait);
trace_xfs_buf_iowait_done(bp, _RET_IP_);
return bp->b_error;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return codes 0 - success. Any other value - error. */ | int lpfc_hba_down_post(struct lpfc_hba *phba) | /* Return codes 0 - success. Any other value - error. */
int lpfc_hba_down_post(struct lpfc_hba *phba) | {
return (*phba->lpfc_hba_down_post)(phba);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Display the prompt. Do the requesting of input. */ | VOID InputBarPrintInput(IN UINTN LastColumn, IN UINTN LastRow) | /* Display the prompt. Do the requesting of input. */
VOID InputBarPrintInput(IN UINTN LastColumn, IN UINTN LastRow) | {
UINTN Limit;
UINTN Size;
CHAR16 *Buffer;
UINTN Index;
UINTN mPromptLen;
mPromptLen = StrLen (mPrompt);
Limit = LastColumn - mPromptLen - 1;
Size = StrLen (mReturnString);
if (Size <= Limit) {
Buffer = mReturnString;
} else {
Buffer = mReturnString + Size - Limit;
}
gST->ConOut->EnableCursor (gST->ConOut, FALSE);
ShellPrintEx (((INT32)mPromptLen), ((INT32)LastRow) - 1, L"%s", Buffer);
Size = StrLen (Buffer);
for (Index = Size; Index < Limit; Index++) {
ShellPrintEx ((INT32)(mPromptLen + Size), ((INT32)LastRow) - 1, L" ");
}
gST->ConOut->EnableCursor (gST->ConOut, TRUE);
gST->ConOut->SetCursorPosition (gST->ConOut, Size + mPromptLen, LastRow - 1);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Note that the kernel may be running at an address which is different from the address that it was linked at, so we must use RELOC/PTRRELOC to access static data (including strings). */ | notrace unsigned long __init early_init(unsigned long dt_ptr) | /* Note that the kernel may be running at an address which is different from the address that it was linked at, so we must use RELOC/PTRRELOC to access static data (including strings). */
notrace unsigned long __init early_init(unsigned long dt_ptr) | {
unsigned long offset = reloc_offset();
struct cpu_spec *spec;
memset_io((void __iomem *)PTRRELOC(&__bss_start), 0,
__bss_stop - __bss_start);
spec = identify_cpu(offset, mfspr(SPRN_PVR));
do_feature_fixups(spec->cpu_features,
PTRRELOC(&__start___ftr_fixup),
PTRRELOC(&__stop___ftr_fixup));
do_feature_fixups(spec->mmu_features,
PTRRELOC(&__start___mmu_ftr_fixup),
PTRRELOC(&__stop___mmu_ftr_fixup));
do_lwsync_fixups(spec->cpu_features,
PTRRELOC(&__start___lwsync_fixup),
PTRRELOC(&__stop___lwsync_fixup));
return KERNELBASE + offset;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* we use a temporary buffer to write the captured data. since the length of written data is determined by host, we cannot write onto the pcm buffer directly... the data is thus copied later at complete callback to the global buffer. */ | static int prepare_capture_urb(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *urb) | /* we use a temporary buffer to write the captured data. since the length of written data is determined by host, we cannot write onto the pcm buffer directly... the data is thus copied later at complete callback to the global buffer. */
static int prepare_capture_urb(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *urb) | {
int i, offs;
struct snd_urb_ctx *ctx = urb->context;
offs = 0;
urb->dev = ctx->subs->dev;
for (i = 0; i < ctx->packets; i++) {
urb->iso_frame_desc[i].offset = offs;
urb->iso_frame_desc[i].length = subs->curpacksize;
offs += subs->curpacksize;
}
urb->transfer_buffer_length = offs;
urb->number_of_packets = ctx->packets;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* System reset should not return, if it returns, it means the system does not support warm reset. */ | VOID EFIAPI ResetWarm(VOID) | /* System reset should not return, if it returns, it means the system does not support warm reset. */
VOID EFIAPI ResetWarm(VOID) | {
IoWrite8 ((UINTN)PcdGet64 (PcdResetControlRegister), PcdGet8 (PcdResetControlValueColdReset));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Stop the automatic memory scanning thread. This function must be called with the scan_mutex held. */ | static void stop_scan_thread(void) | /* Stop the automatic memory scanning thread. This function must be called with the scan_mutex held. */
static void stop_scan_thread(void) | {
if (scan_thread) {
kthread_stop(scan_thread);
scan_thread = NULL;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* In Tdx guest there are 2 ways to access mmio, TdVmcall or direct access. For direct access, the shared bit of the PageTableEntry should be set. The mmio region information is retrieved from hob list. */ | EFI_STATUS SetMmioSharedBit(VOID) | /* In Tdx guest there are 2 ways to access mmio, TdVmcall or direct access. For direct access, the shared bit of the PageTableEntry should be set. The mmio region information is retrieved from hob list. */
EFI_STATUS SetMmioSharedBit(VOID) | {
EFI_PEI_HOB_POINTERS Hob;
Hob.Raw = (UINT8 *)GetHobList ();
while (!END_OF_HOB_LIST (Hob)) {
if ( (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR)
&& (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_MAPPED_IO))
{
MemEncryptTdxSetPageSharedBit (
0,
Hob.ResourceDescriptor->PhysicalStart,
EFI_SIZE_TO_PAGES (Hob.ResourceDescriptor->ResourceLength)
);
}
Hob.Raw = GET_NEXT_HOB (Hob);
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Switches blocks by programming the current one and initializing the next. */ | static tFlashBlockInfo * FlashSwitchBlock(tFlashBlockInfo *block, blt_addr base_addr) | /* Switches blocks by programming the current one and initializing the next. */
static tFlashBlockInfo * FlashSwitchBlock(tFlashBlockInfo *block, blt_addr base_addr) | {
if (block == &bootBlockInfo)
{
block = &blockInfo;
}
else if (base_addr == flashLayout[0].sector_start)
{
block = &bootBlockInfo;
base_addr = flashLayout[0].sector_start;
}
else
{
if (FlashWriteBlock(block) == BLT_FALSE)
{
return BLT_NULL;
}
}
if (FlashInitBlock(block, base_addr) == BLT_FALSE)
{
return BLT_NULL;
}
return block;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Calculate a checksum over a chain of pbufs (without pseudo-header, much like inet_chksum only pbufs are used). */ | u16_t inet_chksum_pbuf(struct pbuf *p) | /* Calculate a checksum over a chain of pbufs (without pseudo-header, much like inet_chksum only pbufs are used). */
u16_t inet_chksum_pbuf(struct pbuf *p) | {
u32_t acc;
struct pbuf *q;
int swapped = 0;
acc = 0;
for (q = p; q != NULL; q = q->next) {
acc += LWIP_CHKSUM(q->payload, q->len);
acc = FOLD_U32T(acc);
if (q->len % 2 != 0) {
swapped = !swapped;
acc = SWAP_BYTES_IN_WORD(acc);
}
}
if (swapped) {
acc = SWAP_BYTES_IN_WORD(acc);
}
return (u16_t)~(acc & 0xffffUL);
} | ua1arn/hftrx | C++ | null | 69 |
/* Fills each CAN_Peli_FilterInitStruct member with its default value. */ | void CAN_Peli_FilterStructInit(CAN_Peli_FilterInitTypeDef *CAN_Peli_FilterInitStruct) | /* Fills each CAN_Peli_FilterInitStruct member with its default value. */
void CAN_Peli_FilterStructInit(CAN_Peli_FilterInitTypeDef *CAN_Peli_FilterInitStruct) | {
CAN_Peli_FilterInitStruct->CAN_FilterId0 = 0;
CAN_Peli_FilterInitStruct->CAN_FilterId1 = 0;
CAN_Peli_FilterInitStruct->CAN_FilterId2 = 0;
CAN_Peli_FilterInitStruct->CAN_FilterId3 = 0;
CAN_Peli_FilterInitStruct->CAN_FilterMaskId0 = 0;
CAN_Peli_FilterInitStruct->CAN_FilterMaskId1 = 0;
CAN_Peli_FilterInitStruct->CAN_FilterMaskId2 = 0;
CAN_Peli_FilterInitStruct->CAN_FilterMaskId3 = 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Unmap the BAR regions that had been mapped earlier using map_bars() */ | static void unmap_bars(struct ape_dev *ape, struct pci_dev *dev) | /* Unmap the BAR regions that had been mapped earlier using map_bars() */
static void unmap_bars(struct ape_dev *ape, struct pci_dev *dev) | {
int i;
for (i = 0; i < APE_BAR_NUM; i++) {
if (ape->bar[i]) {
pci_iounmap(dev, ape->bar[i]);
ape->bar[i] = NULL;
}
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Find occurrence of substr with length substr_len in pbuf p, start at offset start_offset WARNING: in contrast to strstr(), this one does not stop at the first \0 in the pbuf/source string! */ | u16_t pbuf_strstr(struct pbuf *p, const char *substr) | /* Find occurrence of substr with length substr_len in pbuf p, start at offset start_offset WARNING: in contrast to strstr(), this one does not stop at the first \0 in the pbuf/source string! */
u16_t pbuf_strstr(struct pbuf *p, const char *substr) | {
size_t substr_len;
if ((substr == NULL) || (substr[0] == 0) || (p->tot_len == 0xFFFF)) {
return 0xFFFF;
}
substr_len = strlen(substr);
if (substr_len >= 0xFFFF) {
return 0xFFFF;
}
return pbuf_memfind(p, substr, (u16_t)substr_len, 0);
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* This function validates the Cache Type Structure (Type 1) Cache ID field. */ | STATIC VOID EFIAPI ValidateCacheId(IN UINT8 *Ptr, IN VOID *Context) | /* This function validates the Cache Type Structure (Type 1) Cache ID field. */
STATIC VOID EFIAPI ValidateCacheId(IN UINT8 *Ptr, IN VOID *Context) | {
UINT32 CacheId;
CacheId = *(UINT32 *)Ptr;
if (*(AcpiHdrInfo.Revision) < 3) {
return;
}
if (CacheFlags == NULL) {
IncrementErrorCount ();
Print (L"\nERROR: Cache Structure Flags were not successfully read.");
return;
}
if (CacheFlags->CacheIdValid == EFI_ACPI_6_4_PPTT_CACHE_ID_VALID) {
if (CacheId == 0) {
IncrementErrorCount ();
Print (L"\nERROR: 0 is not a valid Cache ID.");
return;
}
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Some pico-sdk drivers call panic on fatal error. This alternative implementation of panic handles the panic through Zephyr. */ | void __attribute__((noreturn)) | /* Some pico-sdk drivers call panic on fatal error. This alternative implementation of panic handles the panic through Zephyr. */
void __attribute__((noreturn)) | {
va_list args;
va_start(args, fmt);
vprintf(fmt, args);
k_fatal_halt(K_ERR_CPU_EXCEPTION);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* This function is used to stop the timer. */ | void tls_timer_stop(u8 timer_id) | /* This function is used to stop the timer. */
void tls_timer_stop(u8 timer_id) | {
if (!(wm_timer_bitmap & BIT(timer_id)))
return;
tls_reg_write32(HR_TIMER0_5_CSR, tls_reg_read32(HR_TIMER0_5_CSR)|TLS_TIMER_INT_CLR(timer_id));
tls_reg_write32(HR_TIMER0_5_CSR, tls_reg_read32(HR_TIMER0_5_CSR) &~ TLS_TIMER_EN(timer_id));
return;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* trigger_receive causes the card to check for empty frames in the descriptor list in which packets can be received. This is accomplished by writing to the CSR2 port. The documentation claims that the act of writing is sufficient and that the value is ignored; I chose zero. */ | static void trigger_receive(struct xircom_private *card) | /* trigger_receive causes the card to check for empty frames in the descriptor list in which packets can be received. This is accomplished by writing to the CSR2 port. The documentation claims that the act of writing is sufficient and that the value is ignored; I chose zero. */
static void trigger_receive(struct xircom_private *card) | {
unsigned int val;
enter("trigger_receive");
val = 0;
outl(val, card->io_port + CSR2);
leave("trigger_receive");
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write 4-bit data or command to the SPLC780D through PCA8574. */ | void SPLC780Write4Bit(unsigned char ucDat) | /* Write 4-bit data or command to the SPLC780D through PCA8574. */
void SPLC780Write4Bit(unsigned char ucDat) | {
ucDat = ucDat | ucBacklightState | SPLC780_RW_WRITE;
xI2CMasterWriteS1(ulMaster, SPLC780_I2C_Addr, ucDat, xfalse);
xI2CMasterWriteS2(ulMaster, (ucDat | SPLC780_E_ENABLE), xfalse);
xSysCtlDelay(200);
xI2CMasterWriteS2(ulMaster, (ucDat | SPLC780_E_DISABLE), xtrue);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* module init entry of u_platform_bus declared with BUS_DRIVER_ENTRY, which is 2nd level driver init entry */ | static int u_platform_init(void) | /* module init entry of u_platform_bus declared with BUS_DRIVER_ENTRY, which is 2nd level driver init entry */
static int u_platform_init(void) | {
int r = 0;
ddkc_dbg("u_platform_bus init\r\n");
r = u_bus_register(&u_platform_bus);
if (r) {
ddkc_err("u_platform_bus init failed, ret:%d\r\n", r);
return r;
}
r = u_platform_device_register(&u_platform_root_dev);
if (r) {
ddkc_err("u_platform_device_register failed, ret:%d\r\n", r);
u_bus_unregister(&u_platform_bus);
}
return r;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Get Redfish value with the given Schema and Configure Language. */ | EFI_STATUS RedfishPlatformConfigGetValue(IN CHAR8 *Schema, IN CHAR8 *Version, IN EFI_STRING ConfigureLang, OUT EDKII_REDFISH_VALUE *Value) | /* Get Redfish value with the given Schema and Configure Language. */
EFI_STATUS RedfishPlatformConfigGetValue(IN CHAR8 *Schema, IN CHAR8 *Version, IN EFI_STRING ConfigureLang, OUT EDKII_REDFISH_VALUE *Value) | {
if (mRedfishPlatformConfigLibPrivate.Protocol == NULL) {
return EFI_NOT_READY;
}
return mRedfishPlatformConfigLibPrivate.Protocol->GetValue (
mRedfishPlatformConfigLibPrivate.Protocol,
Schema,
Version,
ConfigureLang,
Value
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enumerate all devices of the given type on this bus. */ | STATIC VOID XenBusEnumerateDeviceType(XENBUS_DEVICE *Dev, CONST CHAR8 *Type) | /* Enumerate all devices of the given type on this bus. */
STATIC VOID XenBusEnumerateDeviceType(XENBUS_DEVICE *Dev, CONST CHAR8 *Type) | {
CONST CHAR8 **Directory;
UINTN Index;
UINT32 Count;
XENSTORE_STATUS Status;
Status = XenStoreListDirectory (
XST_NIL,
"device",
Type,
&Count,
&Directory
);
if (Status != XENSTORE_STATUS_SUCCESS) {
return;
}
for (Index = 0; Index < Count; Index++) {
XenBusAddDevice (Dev, Type, Directory[Index]);
}
FreePool ((VOID *)Directory);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The cooperative scheduler is being used so all we have to do is periodically increment the tick. This can just be a normal ISR and the "saveall" attribute is not required. */ | void vTickISR(void) | /* The cooperative scheduler is being used so all we have to do is periodically increment the tick. This can just be a normal ISR and the "saveall" attribute is not required. */
void vTickISR(void) | {
xTaskIncrementTick();
TSR1 &= ~0x01;
} | labapart/polymcu | C++ | null | 201 |
/* Wait for Watchdog module to reset.
Wait for CONF_WDT_RESET_WAIT_MS for Watchdog to reset the device */ | static void wait_for_wdt_reset(const struct test_case *test) | /* Wait for Watchdog module to reset.
Wait for CONF_WDT_RESET_WAIT_MS for Watchdog to reset the device */
static void wait_for_wdt_reset(const struct test_case *test) | {
if (wdr_flag == false) {
delay_ms(CONF_WDT_RESET_WAIT_MS);
}
} | memfault/zero-to-main | C++ | null | 200 |
/* FLEXSPI DMA transfer finished callback function.
This function is called when FLEXSPI DMA transfer finished. It disables the FLEXSPI TX/RX DMA request and sends status to FLEXSPI callback. */ | static void FLEXSPI_TransferDMACallback(dma_handle_t *handle, void *param, bool transferDone, uint32_t tcds) | /* FLEXSPI DMA transfer finished callback function.
This function is called when FLEXSPI DMA transfer finished. It disables the FLEXSPI TX/RX DMA request and sends status to FLEXSPI callback. */
static void FLEXSPI_TransferDMACallback(dma_handle_t *handle, void *param, bool transferDone, uint32_t tcds) | {
flexspi_dma_private_handle_t *flexspiPrivateHandle = (flexspi_dma_private_handle_t *)param;
handle = handle;
tcds = tcds;
if (transferDone)
{
while (!FLEXSPI_GetBusIdleStatus(flexspiPrivateHandle->base))
{
}
FLEXSPI_TransferAbortDMA(flexspiPrivateHandle->base, flexspiPrivateHandle->handle);
if (flexspiPrivateHandle->handle->completionCallback != NULL)
{
flexspiPrivateHandle->handle->completionCallback(flexspiPrivateHandle->base, flexspiPrivateHandle->handle,
kStatus_Success, flexspiPrivateHandle->handle->userData);
}
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Manufacturer-specific quirks. Add workarounds for geometry reversal, etc. here. */ | static void flash_fixup_amd(flash_info_t *info, struct cfi_qry *qry) | /* Manufacturer-specific quirks. Add workarounds for geometry reversal, etc. here. */
static void flash_fixup_amd(flash_info_t *info, struct cfi_qry *qry) | {
if (qry->num_erase_regions > 1) {
if (info->cfi_version < 0x3131) {
if ((info->device_id & 0x80) != 0)
cfi_reverse_geometry(qry);
} else if (flash_read_uchar(info, info->ext_addr + 0xf) == 3) {
cfi_reverse_geometry(qry);
}
}
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Stop Standard Error ConSplitter on ControllerHandle by closing Standard Error GUID. */ | EFI_STATUS EFIAPI ConSplitterStdErrDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer) | /* Stop Standard Error ConSplitter on ControllerHandle by closing Standard Error GUID. */
EFI_STATUS EFIAPI ConSplitterStdErrDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer) | {
EFI_STATUS Status;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut;
if (NumberOfChildren == 0) {
return EFI_SUCCESS;
}
Status = ConSplitterStop (
This,
ControllerHandle,
mStdErr.VirtualHandle,
&gEfiStandardErrorDeviceGuid,
&gEfiSimpleTextOutProtocolGuid,
(VOID **)&TextOut
);
if (EFI_ERROR (Status)) {
return Status;
}
return ConSplitterTextOutDeleteDevice (&mStdErr, TextOut);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Disable the RSE workaround by turning the conditional branch that we tagged in each place the workaround was used into an unconditional branch. */ | void __init ia64_patch_rse(unsigned long start, unsigned long end) | /* Disable the RSE workaround by turning the conditional branch that we tagged in each place the workaround was used into an unconditional branch. */
void __init ia64_patch_rse(unsigned long start, unsigned long end) | {
s32 *offp = (s32 *) start;
u64 ip, *b;
while (offp < (s32 *) end) {
ip = (u64) offp + *offp;
b = (u64 *)(ip & -16);
b[1] &= ~0xf800000L;
ia64_fc((void *) ip);
++offp;
}
ia64_sync_i();
ia64_srlz_i();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Task function for blinking the LED as a fixed timer interval. */ | void LedBlinkTask(void) | /* Task function for blinking the LED as a fixed timer interval. */
void LedBlinkTask(void) | {
static blt_bool ledOn = BLT_FALSE;
static blt_int32u nextBlinkEvent = 0;
if (TimerGet() >= nextBlinkEvent)
{
if (ledOn == BLT_FALSE)
{
ledOn = BLT_TRUE;
XMC_GPIO_SetOutputLevel(P5_9, XMC_GPIO_OUTPUT_LEVEL_HIGH);
}
else
{
ledOn = BLT_FALSE;
XMC_GPIO_SetOutputLevel(P5_9, XMC_GPIO_OUTPUT_LEVEL_LOW);
}
nextBlinkEvent = TimerGet() + ledBlinkIntervalMs;
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* USB Device MSC SCSI Synchronize Cache (10/16-Byte) Callback Parameters: None Return Value: None */ | void USBD_MSC_SynchronizeCache(void) | /* USB Device MSC SCSI Synchronize Cache (10/16-Byte) Callback Parameters: None Return Value: None */
void USBD_MSC_SynchronizeCache(void) | {
USBD_MSC_CSW.bStatus = CSW_CMD_PASSED;
USBD_MSC_SetCSW();
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Enables ODR CHANGE virtual sensor to be batched in FIFO.. */ | int32_t lsm6dso_fifo_virtual_sens_odr_chg_get(lsm6dso_ctx_t *ctx, uint8_t *val) | /* Enables ODR CHANGE virtual sensor to be batched in FIFO.. */
int32_t lsm6dso_fifo_virtual_sens_odr_chg_get(lsm6dso_ctx_t *ctx, uint8_t *val) | {
lsm6dso_fifo_ctrl2_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_FIFO_CTRL2, (uint8_t*)®, 1);
*val = reg.odrchg_en;
return ret;
} | alexander-g-dean/ESF | C++ | null | 41 |
/* Called when the driver needs to unlock its access */ | sl_status_t sl_wfx_host_unlock(void) | /* Called when the driver needs to unlock its access */
sl_status_t sl_wfx_host_unlock(void) | {
UINT status;
status = tx_mutex_put(&sl_wfx_host_mutex);
if (status != TX_SUCCESS) {
return SL_STATUS_FAIL;
}
return SL_STATUS_OK;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Performs the MAC and PHY actions needed to enable a port. */ | static void link_start(struct net_device *dev) | /* Performs the MAC and PHY actions needed to enable a port. */
static void link_start(struct net_device *dev) | {
struct t3_rx_mode rm;
struct port_info *pi = netdev_priv(dev);
struct cmac *mac = &pi->mac;
init_rx_mode(&rm, dev, dev->mc_list);
t3_mac_reset(mac);
t3_mac_set_num_ucast(mac, MAX_MAC_IDX);
t3_mac_set_mtu(mac, dev->mtu);
t3_mac_set_address(mac, LAN_MAC_IDX, dev->dev_addr);
t3_mac_set_address(mac, SAN_MAC_IDX, pi->iscsic.mac_addr);
t3_mac_set_rx_mode(mac, &rm);
t3_link_start(&pi->phy, mac, &pi->link_config);
t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base PDM base pointer param handle Pointer to the pdm_handle_t structure which stores the transfer state. */ | void PDM_TransferAbortReceive(PDM_Type *base, pdm_handle_t *handle) | /* param base PDM base pointer param handle Pointer to the pdm_handle_t structure which stores the transfer state. */
void PDM_TransferAbortReceive(PDM_Type *base, pdm_handle_t *handle) | {
assert(handle != NULL);
PDM_DisableInterrupts(base, (uint32_t)kPDM_FIFOInterruptEnable | (uint32_t)kPDM_ErrorInterruptEnable);
PDM_Enable(base, false);
handle->state = kStatus_PDM_Idle;
(void)memset(handle->pdmQueue, 0, sizeof(pdm_transfer_t) * PDM_XFER_QUEUE_SIZE);
handle->queueDriver = 0;
handle->queueUser = 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Description: Generate the NetLabel security attributes for a socket, making full use of the socket's attribute cache. Returns a pointer to the security attributes on success, NULL on failure. */ | static struct netlbl_lsm_secattr* selinux_netlbl_sock_genattr(struct sock *sk) | /* Description: Generate the NetLabel security attributes for a socket, making full use of the socket's attribute cache. Returns a pointer to the security attributes on success, NULL on failure. */
static struct netlbl_lsm_secattr* selinux_netlbl_sock_genattr(struct sock *sk) | {
int rc;
struct sk_security_struct *sksec = sk->sk_security;
struct netlbl_lsm_secattr *secattr;
if (sksec->nlbl_secattr != NULL)
return sksec->nlbl_secattr;
secattr = netlbl_secattr_alloc(GFP_ATOMIC);
if (secattr == NULL)
return NULL;
rc = security_netlbl_sid_to_secattr(sksec->sid, secattr);
if (rc != 0) {
netlbl_secattr_free(secattr);
return NULL;
}
sksec->nlbl_secattr = secattr;
return secattr;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Check if a CPUID leaf/function is indexed via ECX sub-leaf/sub-function */ | STATIC BOOLEAN IsFunctionIndexed(IN UINT32 EaxIn) | /* Check if a CPUID leaf/function is indexed via ECX sub-leaf/sub-function */
STATIC BOOLEAN IsFunctionIndexed(IN UINT32 EaxIn) | {
switch (EaxIn) {
case CPUID_CACHE_PARAMS:
case CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS:
case CPUID_EXTENDED_TOPOLOGY:
case CPUID_EXTENDED_STATE:
case CPUID_INTEL_RDT_MONITORING:
case CPUID_INTEL_RDT_ALLOCATION:
case CPUID_INTEL_SGX:
case CPUID_INTEL_PROCESSOR_TRACE:
case CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS:
case CPUID_V2_EXTENDED_TOPOLOGY:
case 0x8000001D:
return TRUE;
}
return FALSE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Soft iron 3x3 matrix. Value are expressed in sign-module format. (Es. SVVVVVVVb where S is the sign 0/+1/- and V is the value).. */ | int32_t lsm6dsl_mag_soft_iron_mat_set(stmdev_ctx_t *ctx, uint8_t *buff) | /* Soft iron 3x3 matrix. Value are expressed in sign-module format. (Es. SVVVVVVVb where S is the sign 0/+1/- and V is the value).. */
int32_t lsm6dsl_mag_soft_iron_mat_set(stmdev_ctx_t *ctx, uint8_t *buff) | {
int32_t ret;
ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_BANK_A);
if(ret == 0){
ret = lsm6dsl_write_reg(ctx, LSM6DSL_MAG_SI_XX, buff, 9);
if(ret == 0){
ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_USER_BANK);
}
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Return: 0 if all went fine, else return appropriate error. */ | static int ti_sci_cmd_get_resource_range_from_shost(const struct ti_sci_handle *handle, u32 dev_id, u8 subtype, u8 s_host, u16 *range_start, u16 *range_num) | /* Return: 0 if all went fine, else return appropriate error. */
static int ti_sci_cmd_get_resource_range_from_shost(const struct ti_sci_handle *handle, u32 dev_id, u8 subtype, u8 s_host, u16 *range_start, u16 *range_num) | {
return ti_sci_get_resource_range(handle, dev_id, subtype, s_host,
range_start, range_num);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* param base SPDIF base pointer param handle SPDIF handle pointer. param callback Pointer to the user callback function. param userData User parameter passed to the callback function */ | void SPDIF_TransferTxCreateHandle(SPDIF_Type *base, spdif_handle_t *handle, spdif_transfer_callback_t callback, void *userData) | /* param base SPDIF base pointer param handle SPDIF handle pointer. param callback Pointer to the user callback function. param userData User parameter passed to the callback function */
void SPDIF_TransferTxCreateHandle(SPDIF_Type *base, spdif_handle_t *handle, spdif_transfer_callback_t callback, void *userData) | {
assert(handle != NULL);
(void)memset(handle, 0, sizeof(*handle));
s_spdifHandle[SPDIF_GetInstance(base)][0] = handle;
handle->callback = callback;
handle->userData = userData;
handle->watermark =
s_spdif_tx_watermark[(base->SCR & SPDIF_SCR_TXFIFOEMPTY_SEL_MASK) >> SPDIF_SCR_TXFIFOEMPTY_SEL_SHIFT];
s_spdifTxIsr = SPDIF_TransferTxHandleIRQ;
(void)EnableIRQ(s_spdifIRQ[SPDIF_GetInstance(base)]);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* The input arguments Length and PkgLen represent, for the DefDevice: DefDevice := DeviceOp PkgLength NameString TermList |--- */ | EFI_STATUS EFIAPI AmlComputePkgLength(IN UINT32 Length, OUT UINT32 *PkgLen) | /* The input arguments Length and PkgLen represent, for the DefDevice: DefDevice := DeviceOp PkgLength NameString TermList |--- */
EFI_STATUS EFIAPI AmlComputePkgLength(IN UINT32 Length, OUT UINT32 *PkgLen) | {
UINT32 PkgLenWidth;
UINT32 ReComputedPkgLenWidth;
if (PkgLen == NULL) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
PkgLenWidth = AmlComputePkgLengthWidth (Length);
if (PkgLenWidth == 0) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
Length += PkgLenWidth;
ReComputedPkgLenWidth = AmlComputePkgLengthWidth (Length);
if (ReComputedPkgLenWidth != PkgLenWidth) {
if ((ReComputedPkgLenWidth != 0) &&
(ReComputedPkgLenWidth < 4))
{
Length += 1;
} else {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
}
*PkgLen = Length;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns false if the record is not valid. */ | static bool get_trace_record(unsigned int idx, TraceRecord **recordptr) | /* Returns false if the record is not valid. */
static bool get_trace_record(unsigned int idx, TraceRecord **recordptr) | {
uint64_t event_flag = 0;
TraceRecord record;
read_from_buffer(idx, &record, sizeof(event_flag));
if (!(record.event & TRACE_RECORD_VALID)) {
return false;
}
smp_rmb();
read_from_buffer(idx, &record, sizeof(TraceRecord));
*recordptr = malloc(record.length);
read_from_buffer(idx, *recordptr, record.length);
smp_rmb();
(*recordptr)->event &= ~TRACE_RECORD_VALID;
clear_buffer_range(idx, record.length);
return true;
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Checks whether the specified I2C TXFIFO flag is set or not. */ | u8 USI_I2C_CheckTXFIFOState(USI_TypeDef *USIx, u32 USI_I2C_TXFIFO_FLAG) | /* Checks whether the specified I2C TXFIFO flag is set or not. */
u8 USI_I2C_CheckTXFIFOState(USI_TypeDef *USIx, u32 USI_I2C_TXFIFO_FLAG) | {
u8 bit_status = 0;
assert_param(IS_USI_I2C_ALL_PERIPH(USIx));
if((USIx->TX_FIFO_STATUS & USI_I2C_TXFIFO_FLAG) != 0)
{
bit_status = 1;
}
return bit_status;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Callback from an iodev describing error.
Some assumptions are made and should have been validated on rtio_submit */ | void rtio_executor_err(struct rtio_iodev_sqe *iodev_sqe, int result) | /* Callback from an iodev describing error.
Some assumptions are made and should have been validated on rtio_submit */
void rtio_executor_err(struct rtio_iodev_sqe *iodev_sqe, int result) | {
rtio_executor_done(iodev_sqe, result, false);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Returns the number of remaining data units in the current DMAy Streamx transfer. */ | uint16_t DMA_GetCurrDataCounter(DMA_Stream_TypeDef *DMAy_Streamx) | /* Returns the number of remaining data units in the current DMAy Streamx transfer. */
uint16_t DMA_GetCurrDataCounter(DMA_Stream_TypeDef *DMAy_Streamx) | {
assert_param(IS_DMA_ALL_PERIPH(DMAy_Streamx));
return ((uint16_t)(DMAy_Streamx->NDTR));
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* handle sdio interrupt This function will call the SDIO interrupt callback */ | static void SDIF_TransferHandleSDIOInterrupt(sdif_handle_t *handle) | /* handle sdio interrupt This function will call the SDIO interrupt callback */
static void SDIF_TransferHandleSDIOInterrupt(sdif_handle_t *handle) | {
if (handle->callback.SDIOInterrupt != NULL)
{
handle->callback.SDIOInterrupt();
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Use a "constant-length" time compare function for this hash compare: */ | static int slow_equals(u8 *a, u8 *b, int len) | /* Use a "constant-length" time compare function for this hash compare: */
static int slow_equals(u8 *a, u8 *b, int len) | {
int diff = 0;
int i;
for (i = 0; i < len; i++)
diff |= a[i] ^ b[i];
return diff == 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* fast_aes_128_cbc_encrypt - AES-128 CBC encryption @key: Encryption key @iv: Encryption IV for CBC mode (16 bytes) @data: Data to encrypt in-place @data_len: Length of data in bytes (must be divisible by 16) Returns: 0 on success, -1 on failure */ | int fast_aes_128_cbc_encrypt(const uint8_t *key, const uint8_t *iv, uint8_t *data, size_t data_len) | /* fast_aes_128_cbc_encrypt - AES-128 CBC encryption @key: Encryption key @iv: Encryption IV for CBC mode (16 bytes) @data: Data to encrypt in-place @data_len: Length of data in bytes (must be divisible by 16) Returns: 0 on success, -1 on failure */
int fast_aes_128_cbc_encrypt(const uint8_t *key, const uint8_t *iv, uint8_t *data, size_t data_len) | {
int ret = 0;
mbedtls_aes_context ctx;
uint8_t cbc[AES_BLOCK_SIZE];
mbedtls_aes_init(&ctx);
ret = mbedtls_aes_setkey_enc(&ctx, key, 128);
if(ret < 0) {
mbedtls_aes_free(&ctx);
return ret;
}
os_memcpy(cbc, iv, AES_BLOCK_SIZE);
ret = mbedtls_aes_crypt_cbc(&ctx, MBEDTLS_AES_ENCRYPT, data_len, cbc, data, data);
mbedtls_aes_free(&ctx);
return ret;
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Returns: TRUE if stream was successfully closed, FALSE otherwise. */ | gboolean g_output_stream_close_finish(GOutputStream *stream, GAsyncResult *result, GError **error) | /* Returns: TRUE if stream was successfully closed, FALSE otherwise. */
gboolean g_output_stream_close_finish(GOutputStream *stream, GAsyncResult *result, GError **error) | {
g_return_val_if_fail (G_IS_OUTPUT_STREAM (stream), FALSE);
g_return_val_if_fail (g_task_is_valid (result, stream), FALSE);
g_return_val_if_fail (g_async_result_is_tagged (result, g_output_stream_close_async), FALSE);
return g_task_propagate_boolean (G_TASK (result), error);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Configures collision distance and flow control for fiber and serdes links. Upon successful setup, poll for link. */ | static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw) | /* Configures collision distance and flow control for fiber and serdes links. Upon successful setup, poll for link. */
static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw) | {
switch (hw->mac.type) {
case e1000_82571:
case e1000_82572:
ew32(SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK);
break;
default:
break;
}
return e1000e_setup_fiber_serdes_link(hw);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Gets the TIMx Capture Compare X register value. */ | u32 RTIM_CCRxGet(RTIM_TypeDef *TIMx, u16 TIM_Channel) | /* Gets the TIMx Capture Compare X register value. */
u32 RTIM_CCRxGet(RTIM_TypeDef *TIMx, u16 TIM_Channel) | {
assert_param(IS_TIM_CCM_TIM(TIMx));
assert_param(IS_TIM_CHANNEL(TIM_Channel));
return (TIMx->CCMRx[TIM_Channel] & TIM_CCMode_CCR);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Return with the pointer of the next node after 'n_act' */ | void* _lv_ll_get_next(const lv_ll_t *ll_p, const void *n_act) | /* Return with the pointer of the next node after 'n_act' */
void* _lv_ll_get_next(const lv_ll_t *ll_p, const void *n_act) | {
const lv_ll_node_t * n_act_d = n_act;
n_act_d += LL_NEXT_P_OFFSET(ll_p);
return *((lv_ll_node_t **)n_act_d);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Sets a Stall condition on an endpoint of the Low Level Driver. */ | USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) | /* Sets a Stall condition on an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) | {
HAL_PCD_EP_SetStall(pdev->pData, ep_addr);
return USBD_OK;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* The Timer 1 default IRQ, declared in start up code. */ | void TMR1_IRQHandler(void) | /* The Timer 1 default IRQ, declared in start up code. */
void TMR1_IRQHandler(void) | {
unsigned long ulBase = TIMER1_BASE;
unsigned long ulTemp0,ulTemp1;
ulTemp0 = (xHWREG(ulBase + TIMER_O_TISR) & TIMER_TISR_TIF);
xHWREG(ulBase + TIMER_O_TISR) = ulTemp0;
ulTemp1 = (xHWREG(ulBase + TIMER_O_TEISR) & TIMER_TISR_TIF);
xHWREG(ulBase + TIMER_O_TEISR) = ulTemp1;
if (g_pfnTimerHandlerCallbacks[1] != 0)
{
g_pfnTimerHandlerCallbacks[1](0, 0, ulTemp0 | ulTemp1, 0);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Remove the pernet operations structure from the list to be used when network namespaces are created or destroyed. In addition run the exit method for all existing network namespaces. */ | void unregister_pernet_subsys(struct pernet_operations *module) | /* Remove the pernet operations structure from the list to be used when network namespaces are created or destroyed. In addition run the exit method for all existing network namespaces. */
void unregister_pernet_subsys(struct pernet_operations *module) | {
mutex_lock(&net_mutex);
unregister_pernet_operations(module);
mutex_unlock(&net_mutex);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function starts a GCM encryption or decryption operation. */ | rt_err_t rt_hwcrypto_gcm_start(struct rt_hwcrypto_ctx *ctx, const rt_uint8_t *add, rt_size_t add_len) | /* This function starts a GCM encryption or decryption operation. */
rt_err_t rt_hwcrypto_gcm_start(struct rt_hwcrypto_ctx *ctx, const rt_uint8_t *add, rt_size_t add_len) | {
struct hwcrypto_gcm *gcm_ctx = (struct hwcrypto_gcm *)ctx;
if (gcm_ctx && gcm_ctx->ops->start)
{
return gcm_ctx->ops->start(gcm_ctx, add, add_len);
}
return -RT_EINVAL;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* The hinge switches generate an interrupt. We debounce the switches and pass them to the input system. */ | static irqreturn_t spitzkbd_hinge_isr(int irq, void *dev_id) | /* The hinge switches generate an interrupt. We debounce the switches and pass them to the input system. */
static irqreturn_t spitzkbd_hinge_isr(int irq, void *dev_id) | {
struct spitzkbd *spitzkbd_data = dev_id;
if (!timer_pending(&spitzkbd_data->htimer))
mod_timer(&spitzkbd_data->htimer, jiffies + msecs_to_jiffies(HINGE_SCAN_INTERVAL));
return IRQ_HANDLED;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Searches through the list of registers of the driver instance and retrieves a pointer to the register that matches the given address. */ | ad717x_st_reg* AD717X_GetReg(ad717x_dev *device, uint8_t reg_address) | /* Searches through the list of registers of the driver instance and retrieves a pointer to the register that matches the given address. */
ad717x_st_reg* AD717X_GetReg(ad717x_dev *device, uint8_t reg_address) | {
uint8_t i;
ad717x_st_reg *reg = 0;
if (!device || !device->regs)
return 0;
for (i = 0; i < device->num_regs; i++) {
if (device->regs[i].addr == reg_address) {
reg = &device->regs[i];
break;
}
}
return reg;
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* EDMA callback function for FLEXIO SPI send transfer. */ | static void FLEXIO_SPI_TxEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds) | /* EDMA callback function for FLEXIO SPI send transfer. */
static void FLEXIO_SPI_TxEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds) | {
tcds = tcds;
flexio_spi_master_edma_private_handle_t *spiPrivateHandle = (flexio_spi_master_edma_private_handle_t *)param;
if (transferDone)
{
FLEXIO_SPI_EnableDMA(spiPrivateHandle->base, kFLEXIO_SPI_TxDmaEnable, false);
spiPrivateHandle->handle->txInProgress = false;
if ((spiPrivateHandle->handle->txInProgress == false) && (spiPrivateHandle->handle->rxInProgress == false))
{
if (spiPrivateHandle->handle->callback)
{
(spiPrivateHandle->handle->callback)(spiPrivateHandle->base, spiPrivateHandle->handle, kStatus_Success,
spiPrivateHandle->handle->userData);
}
}
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get remain size of specified Key Store memory. */ | uint32_t KS_GetRemainSize(KS_MEM_Type mem) | /* Get remain size of specified Key Store memory. */
uint32_t KS_GetRemainSize(KS_MEM_Type mem) | {
uint32_t u32Reg;
uint32_t u32SramRemain, u32FlashRemain;
u32Reg = KS->REMAIN;
u32SramRemain = (u32Reg & KS_REMAIN_RRMNG_Msk) >> KS_REMAIN_RRMNG_Pos;
u32FlashRemain = (u32Reg & KS_REMAIN_FRMNG_Msk) >> KS_REMAIN_FRMNG_Pos;
if(mem == KS_SRAM)
return u32SramRemain;
else
return u32FlashRemain;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Return 1 if free pages are above 'mark'. This takes into account the order of the allocation. */ | int zone_watermark_ok(struct zone *z, int order, unsigned long mark, int classzone_idx, int alloc_flags) | /* Return 1 if free pages are above 'mark'. This takes into account the order of the allocation. */
int zone_watermark_ok(struct zone *z, int order, unsigned long mark, int classzone_idx, int alloc_flags) | {
long min = mark;
long free_pages = zone_page_state(z, NR_FREE_PAGES) - (1 << order) + 1;
int o;
if (alloc_flags & ALLOC_HIGH)
min -= min / 2;
if (alloc_flags & ALLOC_HARDER)
min -= min / 4;
if (free_pages <= min + z->lowmem_reserve[classzone_idx])
return 0;
for (o = 0; o < order; o++) {
free_pages -= z->free_area[o].nr_free << o;
min >>= 1;
if (free_pages <= min)
return 0;
}
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ubifs_destroy_size_tree - free resources related to the size tree. */ | void ubifs_destroy_size_tree(struct ubifs_info *c) | /* ubifs_destroy_size_tree - free resources related to the size tree. */
void ubifs_destroy_size_tree(struct ubifs_info *c) | {
struct rb_node *this = c->size_tree.rb_node;
struct size_entry *e;
while (this) {
if (this->rb_left) {
this = this->rb_left;
continue;
} else if (this->rb_right) {
this = this->rb_right;
continue;
}
e = rb_entry(this, struct size_entry, rb);
if (e->inode)
iput(e->inode);
this = rb_parent(this);
if (this) {
if (this->rb_left == &e->rb)
this->rb_left = NULL;
else
this->rb_right = NULL;
}
kfree(e);
}
c->size_tree = RB_ROOT;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function returns %0 on success or a negative error code on failure. */ | static int gc_sync_wbufs(struct ubifs_info *c) | /* This function returns %0 on success or a negative error code on failure. */
static int gc_sync_wbufs(struct ubifs_info *c) | {
int err, i;
for (i = 0; i < c->jhead_cnt; i++) {
if (i == GCHD)
continue;
err = ubifs_wbuf_sync(&c->jheads[i].wbuf);
if (err)
return err;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns the value of the register or a negative error code. */ | static int NCR5380_poll_politely(struct Scsi_Host *instance, int reg, int bit, int val, int t) | /* Returns the value of the register or a negative error code. */
static int NCR5380_poll_politely(struct Scsi_Host *instance, int reg, int bit, int val, int t) | {
NCR5380_local_declare();
int n = 500;
unsigned long end = jiffies + t;
int r;
NCR5380_setup(instance);
while( n-- > 0)
{
r = NCR5380_read(reg);
if((r & bit) == val)
return 0;
cpu_relax();
}
while(time_before(jiffies, end))
{
r = NCR5380_read(reg);
if((r & bit) == val)
return 0;
if(!in_interrupt())
cond_resched();
else
cpu_relax();
}
return -ETIMEDOUT;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The tracer may use either sequence operations or its own copy to user routines. To simplify formating of a trace trace_seq_printf is used to store strings into a special buffer (@s). Then the output may be either used by the sequencer or pulled into another buffer. */ | int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args) | /* The tracer may use either sequence operations or its own copy to user routines. To simplify formating of a trace trace_seq_printf is used to store strings into a special buffer (@s). Then the output may be either used by the sequencer or pulled into another buffer. */
int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args) | {
int len = (PAGE_SIZE - 1) - s->len;
int ret;
if (s->full || !len)
return 0;
ret = vsnprintf(s->buffer + s->len, len, fmt, args);
if (ret >= len) {
s->full = 1;
return 0;
}
s->len += ret;
return len;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.