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 |
|---|---|---|---|---|---|---|---|
/* This sample handler attempts to read the microcode update signature. */ | PRM_HANDLER_EXPORT(MsrAccessMicrocodeSignaturePrmHandler) | /* This sample handler attempts to read the microcode update signature. */
PRM_HANDLER_EXPORT(MsrAccessMicrocodeSignaturePrmHandler) | {
return EFI_NOT_FOUND;
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* We will eventually use the virtio console device to produce console output, but before that is set up we use LHCALL_NOTIFY on normal memory to produce console output. */ | static __init int early_put_chars(u32 vtermno, const char *buf, int count) | /* We will eventually use the virtio console device to produce console output, but before that is set up we use LHCALL_NOTIFY on normal memory to produce console output. */
static __init int early_put_chars(u32 vtermno, const char *buf, int count) | {
char scratch[17];
unsigned int len = count;
if (len > sizeof(scratch) - 1)
len = sizeof(scratch) - 1;
scratch[len] = '\0';
memcpy(scratch, buf, len);
kvm_hypercall1(LHCALL_NOTIFY, __pa(scratch));
return len;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Close B channel Called by "do_action" in ev-layer.c */ | static int gigaset_close_bchannel(struct bc_state *bcs) | /* Close B channel Called by "do_action" in ev-layer.c */
static int gigaset_close_bchannel(struct bc_state *bcs) | {
gigaset_bchannel_down(bcs);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set up a time that expires after 1/2 second. */ | static void etr_set_sync_timeout(void) | /* Set up a time that expires after 1/2 second. */
static void etr_set_sync_timeout(void) | {
mod_timer(&etr_timer, jiffies + HZ/2);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Sets a configuration or information value within a PCAN Channel. */ | static TPCANStatus PCanUsbLibFuncSetValue(TPCANHandle Channel, TPCANParameter Parameter, void *Buffer, DWORD BufferLength) | /* Sets a configuration or information value within a PCAN Channel. */
static TPCANStatus PCanUsbLibFuncSetValue(TPCANHandle Channel, TPCANParameter Parameter, void *Buffer, DWORD BufferLength) | {
TPCANStatus result = PCAN_ERROR_INITIALIZE;
assert(pCanUsbLibFuncSetValuePtr != NULL);
assert(pCanUsbDllHandle != NULL);
if ((pCanUsbLibFuncSetValuePtr != NULL) && (pCanUsbDllHandle != NULL))
{
result = pCanUsbLibFuncSetValuePtr(Channel, Parameter, Buffer, BufferLength);
}
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Sets the cursor to 0, 0 and resets the window size. */ | void ssd1351GoHome(void) | /* Sets the cursor to 0, 0 and resets the window size. */
void ssd1351GoHome(void) | {
ssd1351SetCursor(0, 0);
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* Routine: omap3_update_aux_cr_secure_rx51 Description: Modify the contents Auxiliary Control Register. Parameters: set_bits - bits to set in ACR clr_bits - bits to clear in ACR */ | static void omap3_update_aux_cr_secure_rx51(u32 set_bits, u32 clear_bits) | /* Routine: omap3_update_aux_cr_secure_rx51 Description: Modify the contents Auxiliary Control Register. Parameters: set_bits - bits to set in ACR clr_bits - bits to clear in ACR */
static void omap3_update_aux_cr_secure_rx51(u32 set_bits, u32 clear_bits) | {
u32 acr;
asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr));
acr &= ~clear_bits;
acr |= set_bits;
omap3_set_aux_cr_secure(acr);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This routine is invoked to free the driver hba data structure with an HBA device. */ | static void lpfc_hba_free(struct lpfc_hba *phba) | /* This routine is invoked to free the driver hba data structure with an HBA device. */
static void lpfc_hba_free(struct lpfc_hba *phba) | {
idr_remove(&lpfc_hba_index, phba->brd_no);
kfree(phba);
return;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* For licensing information, see the file 'LICENCE' in this directory. */ | static int jffs2_flash_setup(struct jffs2_sb_info *c) | /* For licensing information, see the file 'LICENCE' in this directory. */
static int jffs2_flash_setup(struct jffs2_sb_info *c) | {
if (!(c->mtd->flags & MTD_OOB_WRITEABLE))
printk(KERN_INFO "JFFS2 doesn't use OOB.\n");
ret = jffs2_nand_flash_setup(c);
if (ret)
return ret;
}
if (jffs2_dataflash(c)) {
ret = jffs2_dataflash_setup(c);
if (ret)
return ret;
}
if (jffs2_nor_wbuf_flash(c)) {
ret = jffs2_nor_wbuf_flash_setup(c);
if (ret)
return ret;
}
if (jffs2_ubivol(c)) {
ret = jffs2_ubivol_setup(c);
if (ret)
return ret;
}
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* param base Pointer to the FLEXIO_MCULCD_Type structure. param command The command to send. */ | void FLEXIO_MCULCD_WriteCommandBlocking(FLEXIO_MCULCD_Type *base, uint32_t command) | /* param base Pointer to the FLEXIO_MCULCD_Type structure. param command The command to send. */
void FLEXIO_MCULCD_WriteCommandBlocking(FLEXIO_MCULCD_Type *base, uint32_t command) | {
FLEXIO_Type *flexioBase = base->flexioBase;
base->setRSPin(false);
if (kFLEXIO_MCULCD_6800 == base->busType)
{
base->setRDWRPin(false);
}
FLEXIO_MCULCD_SetSingleBeatWriteConfig(base);
flexioBase->SHIFTBUF[base->txShifterStartIndex] = command;
while (!((1U << base->timerIndex) & FLEXIO_GetTimerStatusFlags(flexioBase)))
{
}
FLEXIO_MCULCD_ClearSingleBeatWriteConfig(base);
base->setRSPin(true);
if (kFLEXIO_MCULCD_6800 == base->busType)
{
base->setRDWRPin(true);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Report status code into runtime memory. If the runtime pool is full, roll back to the first record and overwrite it. */ | EFI_STATUS EFIAPI RtMemoryStatusCodeReportWorker(IN EFI_STATUS_CODE_TYPE CodeType, IN EFI_STATUS_CODE_VALUE Value, IN UINT32 Instance, IN EFI_GUID *CallerId, IN EFI_STATUS_CODE_DATA *Data OPTIONAL) | /* Report status code into runtime memory. If the runtime pool is full, roll back to the first record and overwrite it. */
EFI_STATUS EFIAPI RtMemoryStatusCodeReportWorker(IN EFI_STATUS_CODE_TYPE CodeType, IN EFI_STATUS_CODE_VALUE Value, IN UINT32 Instance, IN EFI_GUID *CallerId, IN EFI_STATUS_CODE_DATA *Data OPTIONAL) | {
MEMORY_STATUSCODE_RECORD *Record;
Record = (MEMORY_STATUSCODE_RECORD *)(mRtMemoryStatusCodeTable + 1);
Record = &Record[mRtMemoryStatusCodeTable->RecordIndex++];
Record->CodeType = CodeType;
Record->Value = Value;
Record->Instance = Instance;
mRtMemoryStatusCodeTable->NumberOfRecords++;
if (mRtMemoryStatusCodeTable->RecordIndex == mRtMemoryStatusCodeTable->MaxRecordsNumber) {
mRtMemoryStatusCodeTable->RecordIndex = 0;
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function fills in the output array with a human-readable path to a PA device. This string is compatible with that used by PDC, and may be printed on the outside of the box. */ | char* print_pa_hwpath(struct parisc_device *dev, char *output) | /* This function fills in the output array with a human-readable path to a PA device. This string is compatible with that used by PDC, and may be printed on the outside of the box. */
char* print_pa_hwpath(struct parisc_device *dev, char *output) | {
struct hardware_path path;
get_node_path(dev->dev.parent, &path);
path.mod = dev->hw_path;
return print_hwpath(&path, output);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function handles the control transfer out status phase */ | static int ctrlreq_out_status_phase(struct usb_device *dev) | /* This function handles the control transfer out status phase */
static int ctrlreq_out_status_phase(struct usb_device *dev) | {
u16 csr;
int result;
csr = readw(&musbr->txcsr);
csr |= (MUSB_CSR0_TXPKTRDY | MUSB_CSR0_H_STATUSPKT);
csr |= MUSB_CSR0_H_DIS_PING;
writew(csr, &musbr->txcsr);
result = wait_until_ep0_ready(dev, MUSB_CSR0_TXPKTRDY);
return result;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* If 8-bit I/O port operations are not supported, then ASSERT(). */ | UINT8 EFIAPI S3IoRead8(IN UINTN Port) | /* If 8-bit I/O port operations are not supported, then ASSERT(). */
UINT8 EFIAPI S3IoRead8(IN UINTN Port) | {
return InternalSaveIoWrite8ValueToBootScript (Port, IoRead8 (Port));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Status command helper function. Display the output coding of the ADC. */ | static int32_t cn0414_status_output_coding(struct cn0414_dev *dev) | /* Status command helper function. Display the output coding of the ADC. */
static int32_t cn0414_status_output_coding(struct cn0414_dev *dev) | {
int32_t ret;
ad717x_st_reg *temp_ptr;
temp_ptr = AD717X_GetReg(dev->ad4111_device, AD717X_SETUPCON0_REG);
ret = usr_uart_write_string(dev->uart_descriptor,
(uint8_t*)"ADC output coding: ");
if(ret != CN0414_SUCCESS)
return ret;
if((temp_ptr->value & AD717X_SETUP_CONF_REG_BI_UNIPOLAR) == 0)
return usr_uart_write_string(dev->uart_descriptor,
(uint8_t*)"UNIPOLAR\n");
else
return usr_uart_write_string(dev->uart_descriptor,
(uint8_t*)"BIPOLAR\n");
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* Intel provided a special instruction to clear the TS bit for people too cool to use write_cr0() to do it. This "clts" instruction is faster, because all the vowels have been optimized out. */ | static void lguest_clts(void) | /* Intel provided a special instruction to clear the TS bit for people too cool to use write_cr0() to do it. This "clts" instruction is faster, because all the vowels have been optimized out. */
static void lguest_clts(void) | {
lazy_hcall1(LHCALL_TS, 0);
current_cr0 &= ~X86_CR0_TS;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If AesContext is NULL, then return FALSE. If Key is NULL, then return FALSE. If KeyLength is not valid, then return FALSE. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI CryptoServiceAesInit(OUT VOID *AesContext, IN CONST UINT8 *Key, IN UINTN KeyLength) | /* If AesContext is NULL, then return FALSE. If Key is NULL, then return FALSE. If KeyLength is not valid, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceAesInit(OUT VOID *AesContext, IN CONST UINT8 *Key, IN UINTN KeyLength) | {
return CALL_BASECRYPTLIB (Aes.Services.Init, AesInit, (AesContext, Key, KeyLength), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* When the entry is in xattr block, xattr_bh indicates the storage place. While if the entry is in index b-tree, "bucket" indicates the real place of the xattr. */ | static void ocfs2_xattr_update_xattr_search(struct inode *inode, struct ocfs2_xattr_search *xs, struct buffer_head *old_bh) | /* When the entry is in xattr block, xattr_bh indicates the storage place. While if the entry is in index b-tree, "bucket" indicates the real place of the xattr. */
static void ocfs2_xattr_update_xattr_search(struct inode *inode, struct ocfs2_xattr_search *xs, struct buffer_head *old_bh) | {
char *buf = old_bh->b_data;
struct ocfs2_xattr_block *old_xb = (struct ocfs2_xattr_block *)buf;
struct ocfs2_xattr_header *old_xh = &old_xb->xb_attrs.xb_header;
int i;
xs->header = bucket_xh(xs->bucket);
xs->base = bucket_block(xs->bucket, 0);
xs->end = xs->base + inode->i_sb->s_blocksize;
if (xs->not_found)
return;
i = xs->here - old_xh->xh_entries;
xs->here = &xs->header->xh_entries[i];
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* USB Interrupt service routine.
This function serves as the USB interrupt service routine. */ | void USB_OTG1_IRQHandler(void) | /* USB Interrupt service routine.
This function serves as the USB interrupt service routine. */
void USB_OTG1_IRQHandler(void) | {
rt_interrupt_enter();
USB_DeviceEhciIsrFunction(ehci0_handle);
rt_interrupt_leave();
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The default values are as follows. code config->rtccalenable = false; config->rtccalvalue = 0U; config->PIFreq = 0U; endcode param config Pointer to the user's SNVS configuration structure. */ | void SNVS_HP_RTC_GetDefaultConfig(snvs_hp_rtc_config_t *config) | /* The default values are as follows. code config->rtccalenable = false; config->rtccalvalue = 0U; config->PIFreq = 0U; endcode param config Pointer to the user's SNVS configuration structure. */
void SNVS_HP_RTC_GetDefaultConfig(snvs_hp_rtc_config_t *config) | {
assert(config != NULL);
(void)memset(config, 0, sizeof(*config));
config->rtcCalEnable = false;
config->rtcCalValue = 0U;
config->periodicInterruptFreq = 0U;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Enable interrupt mode for the selected IO pin(s). */ | int32_t MFXSTM32L152_IO_EnablePinIT(MFXSTM32L152_Object_t *pObj, uint32_t IO_Pin) | /* Enable interrupt mode for the selected IO pin(s). */
int32_t MFXSTM32L152_IO_EnablePinIT(MFXSTM32L152_Object_t *pObj, uint32_t IO_Pin) | {
int32_t ret = MFXSTM32L152_OK;
if (MFXSTM32L152_reg24_setPinValue(pObj, MFXSTM32L152_REG_ADR_IRQ_GPI_SRC1, IO_Pin, 1) != MFXSTM32L152_OK)
{
ret = MFXSTM32L152_ERROR;
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* ib2ehca_qp_state maps IB to ehca qp_state returns ehca qp state corresponding to given ib qp state */ | static enum ehca_qp_state ib2ehca_qp_state(enum ib_qp_state ib_qp_state) | /* ib2ehca_qp_state maps IB to ehca qp_state returns ehca qp state corresponding to given ib qp state */
static enum ehca_qp_state ib2ehca_qp_state(enum ib_qp_state ib_qp_state) | {
switch (ib_qp_state) {
case IB_QPS_RESET:
return EHCA_QPS_RESET;
case IB_QPS_INIT:
return EHCA_QPS_INIT;
case IB_QPS_RTR:
return EHCA_QPS_RTR;
case IB_QPS_RTS:
return EHCA_QPS_RTS;
case IB_QPS_SQD:
return EHCA_QPS_SQD;
case IB_QPS_SQE:
return EHCA_QPS_SQE;
case IB_QPS_ERR:
return EHCA_QPS_ERR;
default:
ehca_gen_err("invalid ib_qp_state=%x", ib_qp_state);
return -EINVAL;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* However, if the first two or last two independent 64-bit keys are equal (k1 == k2 or k2 == k3), then the DES3 operation is simply the same as DES. Implementers MUST reject keys that exhibit this property. */ | static int des3_ede_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) | /* However, if the first two or last two independent 64-bit keys are equal (k1 == k2 or k2 == k3), then the DES3 operation is simply the same as DES. Implementers MUST reject keys that exhibit this property. */
static int des3_ede_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) | {
const u32 *K = (const u32 *)key;
struct des3_ede_ctx *dctx = crypto_tfm_ctx(tfm);
u32 *expkey = dctx->expkey;
u32 *flags = &tfm->crt_flags;
if (unlikely(!((K[0] ^ K[2]) | (K[1] ^ K[3])) ||
!((K[2] ^ K[4]) | (K[3] ^ K[5]))) &&
(*flags & CRYPTO_TFM_REQ_WEAK_KEY))
{
*flags |= CRYPTO_TFM_RES_WEAK_KEY;
return -EINVAL;
}
des_ekey(expkey, key); expkey += DES_EXPKEY_WORDS; key += DES_KEY_SIZE;
dkey(expkey, key); expkey += DES_EXPKEY_WORDS; key += DES_KEY_SIZE;
des_ekey(expkey, key);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Given a desired period and the clock period (both in ns), return the proper counter value (divider-1). Sets the original period to be the true value. Note: you have to check if the value is larger than the counter range! */ | static int rtd_ns_to_timer_base(unsigned int *nanosec, int round_mode, int base) | /* Given a desired period and the clock period (both in ns), return the proper counter value (divider-1). Sets the original period to be the true value. Note: you have to check if the value is larger than the counter range! */
static int rtd_ns_to_timer_base(unsigned int *nanosec, int round_mode, int base) | {
int divider;
switch (round_mode) {
case TRIG_ROUND_NEAREST:
default:
divider = (*nanosec + base / 2) / base;
break;
case TRIG_ROUND_DOWN:
divider = (*nanosec) / base;
break;
case TRIG_ROUND_UP:
divider = (*nanosec + base - 1) / base;
break;
}
if (divider < 2)
divider = 2;
*nanosec = base * divider;
return divider - 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function set detach state attribute in thread attributes object.
PTHREAD_CREATE_JOINABLE Default value, it causes all threads created with attr to be in the joinable state. */ | int pthread_attr_setdetachstate(pthread_attr_t *attr, int state) | /* This function set detach state attribute in thread attributes object.
PTHREAD_CREATE_JOINABLE Default value, it causes all threads created with attr to be in the joinable state. */
int pthread_attr_setdetachstate(pthread_attr_t *attr, int state) | {
RT_ASSERT(attr != RT_NULL);
if (state != PTHREAD_CREATE_JOINABLE && state != PTHREAD_CREATE_DETACHED)
return EINVAL;
attr->detachstate = state;
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Check the amount of space left in the FIFO.
This function returns the available space in the overall FIFO to accept new data. This takes into account the SRAM buffer and hardware FIFO */ | uint32_t am_hal_ios_fifo_space_left(void) | /* Check the amount of space left in the FIFO.
This function returns the available space in the overall FIFO to accept new data. This takes into account the SRAM buffer and hardware FIFO */
uint32_t am_hal_ios_fifo_space_left(void) | {
uint32_t ui32Val;
uint32_t ui32Primask;
ui32Primask = am_hal_interrupt_master_disable();
ui32Val = g_sSRAMBuffer.ui32Capacity + g_ui32HwFifoSize - 1;
ui32Val -= g_sSRAMBuffer.ui32Length;
ui32Val -= AM_BFR(IOSLAVE, FIFOPTR, FIFOSIZ);
am_hal_interrupt_master_set(ui32Primask);
return ui32Val;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Validate whether the value of protocol is illegal or not. Protocol is the 'Next Header' field in the last IPv6 extension header, or basic IPv6 header is there's no extension header. */ | BOOLEAN Ip6IsIllegalProtocol(IN UINT8 Protocol) | /* Validate whether the value of protocol is illegal or not. Protocol is the 'Next Header' field in the last IPv6 extension header, or basic IPv6 header is there's no extension header. */
BOOLEAN Ip6IsIllegalProtocol(IN UINT8 Protocol) | {
if ((Protocol == IP6_HOP_BY_HOP) || (Protocol == EFI_IP_PROTO_ICMP) || (Protocol == IP4_PROTO_IGMP)) {
return TRUE;
}
if ((Protocol == 41) || (Protocol == 43) || (Protocol == 44) || (Protocol == 59) || (Protocol == 60) || (Protocol == 124)) {
return TRUE;
}
return FALSE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ | UINT16 EFIAPI PciBitFieldAnd16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI PciBitFieldAnd16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData) | {
return PciWrite16 (
Address,
BitFieldAnd16 (PciRead16 (Address), StartBit, EndBit, AndData)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables or disables the RTC reference clock detection. */ | ErrorStatus RTC_RefClockCmd(FunctionalState NewState) | /* Enables or disables the RTC reference clock detection. */
ErrorStatus RTC_RefClockCmd(FunctionalState NewState) | {
ErrorStatus status = ERROR;
assert_param(IS_FUNCTIONAL_STATE(NewState));
RTC->WPR = 0xFF;
RTC->WPR = 0xCA;
RTC->WPR = 0x53;
if (RTC_EnterInitMode() == ERROR)
{
status = ERROR;
}
else
{
if (NewState != DISABLE)
{
RTC->CR |= RTC_CR_REFCKON;
}
else
{
RTC->CR &= ~RTC_CR_REFCKON;
}
RTC_ExitInitMode();
status = SUCCESS;
}
RTC->WPR = 0xFF;
return status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If a graphics console device is not associated with the ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned. If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no string is printed, and 0 is returned. If Format is NULL, then ASSERT(). If gST->ConsoleOutputHandle is NULL, then ASSERT(). */ | UINTN EFIAPI AsciiPrintXY(IN UINTN PointX, IN UINTN PointY, IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround OPTIONAL, IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround OPTIONAL, IN CONST CHAR8 *Format,...) | /* If a graphics console device is not associated with the ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned. If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no string is printed, and 0 is returned. If Format is NULL, then ASSERT(). If gST->ConsoleOutputHandle is NULL, then ASSERT(). */
UINTN EFIAPI AsciiPrintXY(IN UINTN PointX, IN UINTN PointY, IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround OPTIONAL, IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround OPTIONAL, IN CONST CHAR8 *Format,...) | {
VA_LIST Marker;
CHAR16 *Buffer;
UINTN BufferSize;
UINTN PrintNum;
UINTN ReturnNum;
ASSERT (Format != NULL);
VA_START (Marker, Format);
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
Buffer = (CHAR16 *)AllocatePool (BufferSize);
ASSERT (Buffer != NULL);
PrintNum = UnicodeSPrintAsciiFormat (Buffer, BufferSize, Format, Marker);
VA_END (Marker);
ReturnNum = InternalPrintGraphic (PointX, PointY, ForeGround, BackGround, Buffer, PrintNum);
FreePool (Buffer);
return ReturnNum;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function handles USB OTG FS Wakeup IRQ Handler. */ | void OTG_FS_WKUP_IRQHandler(void) | /* This function handles USB OTG FS Wakeup IRQ Handler. */
void OTG_FS_WKUP_IRQHandler(void) | {
if ((&hpcd)->Init.low_power_enable)
{
SCB->SCR &=
(uint32_t) ~
((uint32_t) (SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
SystemClock_Config();
__HAL_PCD_UNGATE_PHYCLOCK((&hpcd));
}
__HAL_USB_OTG_FS_WAKEUP_EXTI_CLEAR_FLAG();
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* param handle codec handle. return kStatus_Success is success, else de-initial failed. */ | status_t HAL_CODEC_WM8904_Deinit(void *handle) | /* param handle codec handle. return kStatus_Success is success, else de-initial failed. */
status_t HAL_CODEC_WM8904_Deinit(void *handle) | {
assert(handle != NULL);
return WM8904_Deinit((wm8904_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)));
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* This function serves as the entry point for APs when they are awakened by the stores in the memory address indicated by the MP_HANDOFF_INFO structure. */ | VOID EFIAPI DxeApEntryPoint(CPU_MP_DATA *CpuMpData) | /* This function serves as the entry point for APs when they are awakened by the stores in the memory address indicated by the MP_HANDOFF_INFO structure. */
VOID EFIAPI DxeApEntryPoint(CPU_MP_DATA *CpuMpData) | {
UINTN ProcessorNumber;
MSR_IA32_EFER_REGISTER EferMsr;
GetProcessorNumber (CpuMpData, &ProcessorNumber);
if (CpuMpData->EnableExecuteDisableForSwitchContext) {
EferMsr.Uint64 = AsmReadMsr64 (MSR_IA32_EFER);
EferMsr.Bits.NXE = 1;
AsmWriteMsr64 (MSR_IA32_EFER, EferMsr.Uint64);
}
RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegisters, FALSE);
InterlockedIncrement ((UINT32 *)&CpuMpData->FinishedCount);
PlaceAPInMwaitLoopOrRunLoop (
CpuMpData->ApLoopMode,
CpuMpData->CpuData[ProcessorNumber].StartupApSignal,
CpuMpData->ApTargetCState
);
ApWakeupFunction (CpuMpData, ProcessorNumber);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Look up qdisc by its handle in the provided cache */ | struct rtnl_qdisc* rtnl_qdisc_get(struct nl_cache *cache, int ifindex, uint32_t handle) | /* Look up qdisc by its handle in the provided cache */
struct rtnl_qdisc* rtnl_qdisc_get(struct nl_cache *cache, int ifindex, uint32_t handle) | {
struct rtnl_qdisc *q;
if (cache->c_ops != &rtnl_qdisc_ops)
return NULL;
nl_list_for_each_entry(q, &cache->c_items, ce_list) {
if (q->q_handle == handle && q->q_ifindex == ifindex) {
nl_object_get((struct nl_object *) q);
return q;
}
}
return NULL;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* 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};
if(huart->Instance==USART2)
{
__HAL_RCC_USART2_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Returns the last data output value of the selected DAC cahnnel. */ | uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel) | /* Returns the last data output value of the selected DAC cahnnel. */
uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel) | {
assert_param(IS_DAC_CHANNEL(DAC_Channel));
return (uint16_t) (*(__IO uint32_t*)(DAC_BASE + DOR_Offset + ((uint32_t)DAC_Channel >> 2)));
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Device might live on a subordinate PCI bus. XXX Walk up the chain of buses to find the slot number in sense of the bridge device register. XXX This also means multiple devices might rely on conflicting bridge settings. */ | static void pci_disable_swapping(struct pci_dev *dev) | /* Device might live on a subordinate PCI bus. XXX Walk up the chain of buses to find the slot number in sense of the bridge device register. XXX This also means multiple devices might rely on conflicting bridge settings. */
static void pci_disable_swapping(struct pci_dev *dev) | {
struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus);
bridge_t *bridge = bc->base;
int slot = PCI_SLOT(dev->devfn);
bridge->b_device[slot].reg &= ~BRIDGE_DEV_SWAP_DIR;
bridge->b_widget.w_tflush;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Can not be called in smt_reset_defaults, because it is not sure that the OEM ID is already defined. */ | static void set_oem_spec_val(struct s_smc *smc) | /* Can not be called in smt_reset_defaults, because it is not sure that the OEM ID is already defined. */
static void set_oem_spec_val(struct s_smc *smc) | {
struct fddi_mib *mib ;
mib = &smc->mib ;
if (OEMID(smc,0) == 'I') {
mib->fddiSMTConnectionPolicy = POLICY_MM ;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* returns: 0 on success Negative error code on failure */ | static int overlay_adjust_node_phandles(void *fdto, int node, uint32_t delta) | /* returns: 0 on success Negative error code on failure */
static int overlay_adjust_node_phandles(void *fdto, int node, uint32_t delta) | {
int child;
int ret;
ret = overlay_phandle_add_offset (fdto, node, "phandle", delta);
if (ret && (ret != -FDT_ERR_NOTFOUND)) {
return ret;
}
ret = overlay_phandle_add_offset (fdto, node, "linux,phandle", delta);
if (ret && (ret != -FDT_ERR_NOTFOUND)) {
return ret;
}
fdt_for_each_subnode (child, fdto, node) {
ret = overlay_adjust_node_phandles (fdto, child, delta);
if (ret) {
return ret;
}
}
return 0;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* We have a combining character DIACR here, followed by the character CH. If the combination occurs in the table, return the corresponding value. Otherwise, if CH is a space or equals DIACR, return DIACR. Otherwise, conclude that DIACR was not combining after all, queue it and return CH. */ | static unsigned int handle_diacr(struct kbd_data *kbd, unsigned int ch) | /* We have a combining character DIACR here, followed by the character CH. If the combination occurs in the table, return the corresponding value. Otherwise, if CH is a space or equals DIACR, return DIACR. Otherwise, conclude that DIACR was not combining after all, queue it and return CH. */
static unsigned int handle_diacr(struct kbd_data *kbd, unsigned int ch) | {
int i, d;
d = kbd->diacr;
kbd->diacr = 0;
for (i = 0; i < kbd->accent_table_size; i++) {
if (kbd->accent_table[i].diacr == d &&
kbd->accent_table[i].base == ch)
return kbd->accent_table[i].result;
}
if (ch == ' ' || ch == d)
return d;
kbd_put_queue(kbd->tty, d);
return ch;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns 0 for success else error. On error all resources can be freed with a call to snd_soc_card_free(). */ | int snd_soc_dapm_add_routes(struct snd_soc_codec *codec, const struct snd_soc_dapm_route *route, int num) | /* Returns 0 for success else error. On error all resources can be freed with a call to snd_soc_card_free(). */
int snd_soc_dapm_add_routes(struct snd_soc_codec *codec, const struct snd_soc_dapm_route *route, int num) | {
int i, ret;
for (i = 0; i < num; i++) {
ret = snd_soc_dapm_add_route(codec, route);
if (ret < 0) {
printk(KERN_ERR "Failed to add route %s->%s\n",
route->source,
route->sink);
return ret;
}
route++;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* IDL typedef struct { IDL long element_1; IDL TYPE_2 element_2; IDL } TYPE_1; */ | static int dissect_browser_TYPE_1(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | /* IDL typedef struct { IDL long element_1; IDL TYPE_2 element_2; IDL } TYPE_1; */
static int dissect_browser_TYPE_1(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | {
offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
hf_browser_unknown_long, NULL);
offset = dissect_browser_TYPE_2(tvb, offset, pinfo, tree, di, drep);
return offset;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This file is part of the Simba project. */ | int mock_write_network_interface_slip_module_init(int res) | /* This file is part of the Simba project. */
int mock_write_network_interface_slip_module_init(int res) | {
harness_mock_write("network_interface_slip_module_init()",
NULL,
0);
harness_mock_write("network_interface_slip_module_init(): return (res)",
&res,
sizeof(res));
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* Light up or shut off Ring of Indicators. */ | void SegmentLCD_ARing(int anum, int on) | /* Light up or shut off Ring of Indicators. */
void SegmentLCD_ARing(int anum, int on) | {
uint32_t com, bit;
com = EFM_Display.ARing.com[anum];
bit = EFM_Display.ARing.bit[anum];
if (on)
{
LCD_SegmentSet(com, bit, true);
}
else
{
LCD_SegmentSet(com, bit, false);
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* empty_log_bytes - calculate amount of empty space in the log. */ | static long long empty_log_bytes(const struct ubifs_info *c) | /* empty_log_bytes - calculate amount of empty space in the log. */
static long long empty_log_bytes(const struct ubifs_info *c) | {
long long h, t;
h = (long long)c->lhead_lnum * c->leb_size + c->lhead_offs;
t = (long long)c->ltail_lnum * c->leb_size;
if (h > t)
return c->log_bytes - h + t;
else if (h != t)
return t - h;
else if (c->lhead_lnum != c->ltail_lnum)
return 0;
else
return c->log_bytes;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Release all or part of the blocks occupied by the buffer. */ | static int release_tx_buffer(struct backend_data *dev_data, const uint8_t *buffer, int new_size) | /* Release all or part of the blocks occupied by the buffer. */
static int release_tx_buffer(struct backend_data *dev_data, const uint8_t *buffer, int new_size) | {
const struct icbmsg_config *conf = dev_data->conf;
size_t size;
int tx_block_index;
tx_block_index = buffer_to_index_validate(&conf->tx, buffer, &size);
if (tx_block_index < 0) {
return tx_block_index;
}
return release_tx_blocks(dev_data, tx_block_index, size, new_size);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Returns command index of last command for which response received. */ | uint8_t SDIO_GetCommandResponse(void) | /* Returns command index of last command for which response received. */
uint8_t SDIO_GetCommandResponse(void) | {
return (uint8_t)(SDIO->RESPCMD);
} | gcallipo/RadioDSP-Stm32f103 | C++ | Common Creative - Attribution 3.0 | 51 |
/* Serial sends a char.
This function will send a char to the UART */ | static int serial_putc(struct rt_serial_device *serial, char c) | /* Serial sends a char.
This function will send a char to the UART */
static int serial_putc(struct rt_serial_device *serial, char c) | {
struct usart_async_descriptor* desc;
RT_ASSERT(serial != RT_NULL);
desc = (struct usart_async_descriptor *)serial->parent.user_data;
RT_ASSERT(desc != RT_NULL);
while (usart_async_is_tx_empty(desc) == 0);
_usart_async_write_byte(&TARGET_IO.device, (uint8_t)c);
return 1;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function will return a file descriptor structure according to file descriptor. */ | struct dfs_file* fdt_get_file(struct dfs_fdtable *fdt, int fd) | /* This function will return a file descriptor structure according to file descriptor. */
struct dfs_file* fdt_get_file(struct dfs_fdtable *fdt, int fd) | {
struct dfs_file *f;
if (fd < 0 || fd >= (int)fdt->maxfd)
{
return NULL;
}
f = fdt->fds[fd];
if ((f == NULL) || (f->magic != DFS_FD_MAGIC))
{
return NULL;
}
return f;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Map the user space address into a bio suitable for io to a block device. Returns an error pointer in case of error. */ | struct bio* bio_map_user(struct request_queue *q, struct block_device *bdev, unsigned long uaddr, unsigned int len, int write_to_vm, gfp_t gfp_mask) | /* Map the user space address into a bio suitable for io to a block device. Returns an error pointer in case of error. */
struct bio* bio_map_user(struct request_queue *q, struct block_device *bdev, unsigned long uaddr, unsigned int len, int write_to_vm, gfp_t gfp_mask) | {
struct sg_iovec iov;
iov.iov_base = (void __user *)uaddr;
iov.iov_len = len;
return bio_map_user_iov(q, bdev, &iov, 1, write_to_vm, gfp_mask);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* inotify_inode_watched - returns nonzero if there are watches on this inode and zero otherwise. We call this lockless, we do not care if we race. */ | static int inotify_inode_watched(struct inode *inode) | /* inotify_inode_watched - returns nonzero if there are watches on this inode and zero otherwise. We call this lockless, we do not care if we race. */
static int inotify_inode_watched(struct inode *inode) | {
return !list_empty(&inode->inotify_watches);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables I2C wakeup from stop mode. */ | void I2C_StopModeCmd(I2C_TypeDef *I2Cx, FunctionalState NewState) | /* Enables or disables I2C wakeup from stop mode. */
void I2C_StopModeCmd(I2C_TypeDef *I2Cx, FunctionalState NewState) | {
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
I2Cx->CR1 |= I2C_CR1_WUPEN;
}
else
{
I2Cx->CR1 &= (uint32_t)~((uint32_t)I2C_CR1_WUPEN);
}
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Return value: static string, NULL if command/subcommand unknown */ | char* capi_cmd2str(u8 cmd, u8 subcmd) | /* Return value: static string, NULL if command/subcommand unknown */
char* capi_cmd2str(u8 cmd, u8 subcmd) | {
return mnames[command_2_index(cmd, subcmd)];
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* In blocking execution mode, BSP waits until all APs finish or TimeoutInMicroSeconds expires. */ | EFI_STATUS EFIAPI EdkiiPeiStartupAllAPs(IN EDKII_PEI_MP_SERVICES2_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 EdkiiPeiStartupAllAPs(IN EDKII_PEI_MP_SERVICES2_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 |
/* Set DAC Channel Trigger Source.
Sets the digital to analog converter trigger source, which can be taken from various timers, an external trigger or a software trigger. */ | void dac_set_trigger_source(uint32_t dac_trig_src) | /* Set DAC Channel Trigger Source.
Sets the digital to analog converter trigger source, which can be taken from various timers, an external trigger or a software trigger. */
void dac_set_trigger_source(uint32_t dac_trig_src) | {
DAC_CR |= dac_trig_src;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Read from USART Receive Holding Register. Before reading user should check if rx is ready. */ | uint32_t usart_getchar(Usart *p_usart, uint32_t *c) | /* Read from USART Receive Holding Register. Before reading user should check if rx is ready. */
uint32_t usart_getchar(Usart *p_usart, uint32_t *c) | {
while (!(p_usart->US_CSR & US_CSR_RXRDY)) {
}
*c = p_usart->US_RHR & US_RHR_RXCHR_Msk;
return 0;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Converts a text device path node to Media protocol device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextMedia(IN CHAR16 *TextDeviceNode) | /* Converts a text device path node to Media protocol device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextMedia(IN CHAR16 *TextDeviceNode) | {
CHAR16 *GuidStr;
MEDIA_PROTOCOL_DEVICE_PATH *Media;
GuidStr = GetNextParamStr (&TextDeviceNode);
Media = (MEDIA_PROTOCOL_DEVICE_PATH *)CreateDeviceNode (
MEDIA_DEVICE_PATH,
MEDIA_PROTOCOL_DP,
(UINT16)sizeof (MEDIA_PROTOCOL_DEVICE_PATH)
);
StrToGuid (GuidStr, &Media->Protocol);
return (EFI_DEVICE_PATH_PROTOCOL *)Media;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* timer_interrupt() needs to keep up the real-time clock, as well as call the "do_timer()" routine every clocktick */ | static irqreturn_t timer_interrupt(int irq, void *dev_id) | /* timer_interrupt() needs to keep up the real-time clock, as well as call the "do_timer()" routine every clocktick */
static irqreturn_t timer_interrupt(int irq, void *dev_id) | {
h8300_timer_tick();
ctrl_bclr(CMFA, _8BASE + _8TCSR);
return IRQ_HANDLED;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* OMAP2430 I2CHS CM_IDLEST bits are in CM_IDLEST1_CORE, but the CM_*CLKEN bits are in CM_{I,F}CLKEN2_CORE. This custom function passes back the correct CM_IDLEST register address for I2CHS modules. No return value. */ | static void omap2430_clk_i2chs_find_idlest(struct clk *clk, void __iomem **idlest_reg, u8 *idlest_bit) | /* OMAP2430 I2CHS CM_IDLEST bits are in CM_IDLEST1_CORE, but the CM_*CLKEN bits are in CM_{I,F}CLKEN2_CORE. This custom function passes back the correct CM_IDLEST register address for I2CHS modules. No return value. */
static void omap2430_clk_i2chs_find_idlest(struct clk *clk, void __iomem **idlest_reg, u8 *idlest_bit) | {
*idlest_reg = OMAP_CM_REGADDR(CORE_MOD, CM_IDLEST);
*idlest_bit = clk->enable_bit;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns 0 for success, negative error code on error. */ | int request_resource(struct resource *root, struct resource *new) | /* Returns 0 for success, negative error code on error. */
int request_resource(struct resource *root, struct resource *new) | {
struct resource *conflict;
write_lock(&resource_lock);
conflict = __request_resource(root, new);
write_unlock(&resource_lock);
return conflict ? -EBUSY : 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Like g_byte_array_sort(), but the comparison function takes an extra user data argument. */ | void g_byte_array_sort_with_data(GByteArray *array, GCompareDataFunc compare_func, gpointer user_data) | /* Like g_byte_array_sort(), but the comparison function takes an extra user data argument. */
void g_byte_array_sort_with_data(GByteArray *array, GCompareDataFunc compare_func, gpointer user_data) | {
g_array_sort_with_data ((GArray *)array, compare_func, user_data);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* You can use one thread per driver instance model or UDC driver workqueue, whichever model suits your needs best. If you decide to use the UDC workqueue, enable Kconfig option UDC_WORKQUEUE and remove the handler below and caller from the UDC_SKELETON_DEVICE_DEFINE macro. */ | static ALWAYS_INLINE void skeleton_thread_handler(void *const arg) | /* You can use one thread per driver instance model or UDC driver workqueue, whichever model suits your needs best. If you decide to use the UDC workqueue, enable Kconfig option UDC_WORKQUEUE and remove the handler below and caller from the UDC_SKELETON_DEVICE_DEFINE macro. */
static ALWAYS_INLINE void skeleton_thread_handler(void *const arg) | {
const struct device *dev = (const struct device *)arg;
LOG_DBG("Driver %p thread started", dev);
while (true) {
k_msleep(1000);
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Try to locate a physical channel to be used for this transfer. If all are taken return NULL and the requester will have to cope by using some fallback PIO mode or retrying later. */ | static struct pl08x_phy_chan* pl08x_get_phy_channel(struct pl08x_driver_data *pl08x, struct pl08x_dma_chan *virt_chan) | /* Try to locate a physical channel to be used for this transfer. If all are taken return NULL and the requester will have to cope by using some fallback PIO mode or retrying later. */
static struct pl08x_phy_chan* pl08x_get_phy_channel(struct pl08x_driver_data *pl08x, struct pl08x_dma_chan *virt_chan) | {
struct pl08x_phy_chan *ch = NULL;
unsigned long flags;
int i;
for (i = 0; i < pl08x->vd->channels; i++) {
ch = &pl08x->phy_chans[i];
spin_lock_irqsave(&ch->lock, flags);
if (!ch->locked && !ch->serving) {
ch->serving = virt_chan;
spin_unlock_irqrestore(&ch->lock, flags);
break;
}
spin_unlock_irqrestore(&ch->lock, flags);
}
if (i == pl08x->vd->channels) {
return NULL;
}
return ch;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This file is part of the Simba project. */ | int mock_write_random_module_init(int res) | /* This file is part of the Simba project. */
int mock_write_random_module_init(int res) | {
harness_mock_write("random_module_init()",
NULL,
0);
harness_mock_write("random_module_init(): return (res)",
&res,
sizeof(res));
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* Calculates and verifies the checksum that is currently present in the buffer. */ | static bool SharedParamsVerifyChecksum(void) | /* Calculates and verifies the checksum that is currently present in the buffer. */
static bool SharedParamsVerifyChecksum(void) | {
bool result = false;
if (SharedParamsCalculateChecksum() == sharedParamsBuffer.checksum)
{
result = true;
}
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* AK4524 on Delta 44 and 66 to choose the chip mask */ | static void delta_ak4524_lock(struct snd_akm4xxx *ak, int chip) | /* AK4524 on Delta 44 and 66 to choose the chip mask */
static void delta_ak4524_lock(struct snd_akm4xxx *ak, int chip) | {
struct snd_ak4xxx_private *priv = (void *)ak->private_value[0];
struct snd_ice1712 *ice = ak->private_data[0];
snd_ice1712_save_gpio_status(ice);
priv->cs_mask =
priv->cs_addr = chip == 0 ? ICE1712_DELTA_CODEC_CHIP_A :
ICE1712_DELTA_CODEC_CHIP_B;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base LPUART peripheral base address. param handle LPUART handle pointer. param count Receive bytes count. retval kStatus_NoTransferInProgress No receive in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */ | status_t LPUART_TransferGetReceiveCount(LPUART_Type *base, lpuart_handle_t *handle, uint32_t *count) | /* param base LPUART peripheral base address. param handle LPUART handle pointer. param count Receive bytes count. retval kStatus_NoTransferInProgress No receive in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */
status_t LPUART_TransferGetReceiveCount(LPUART_Type *base, lpuart_handle_t *handle, uint32_t *count) | {
assert(handle);
assert(count);
if (kLPUART_RxIdle == handle->rxState)
{
return kStatus_NoTransferInProgress;
}
*count = handle->rxDataSizeAll - handle->rxDataSize;
return kStatus_Success;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This API sets the no motion/slow motion interrupt of the sensor. Slow motion is similar to any motion interrupt.No motion interrupt occurs when slope bet. two accel values falls below preset threshold for preset duration. */ | static int8_t set_accel_no_motion_int(struct bmi160_int_settg *int_config, const struct bmi160_dev *dev) | /* This API sets the no motion/slow motion interrupt of the sensor. Slow motion is similar to any motion interrupt.No motion interrupt occurs when slope bet. two accel values falls below preset threshold for preset duration. */
static int8_t set_accel_no_motion_int(struct bmi160_int_settg *int_config, const struct bmi160_dev *dev) | {
int8_t rslt;
rslt = null_ptr_check(dev);
if ((rslt != BMI160_OK) || (int_config == NULL))
{
rslt = BMI160_E_NULL_PTR;
}
else
{
struct bmi160_acc_no_motion_int_cfg *no_mot_int_cfg = &(int_config->int_type_cfg.acc_no_motion_int);
rslt = enable_no_motion_int(no_mot_int_cfg, dev);
if (rslt == BMI160_OK)
{
rslt = config_no_motion_int_settg(int_config, no_mot_int_cfg, dev);
}
}
return rslt;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* This function handles external line 15_10 interrupt request. */ | void EXTI15_10_IRQHandler(void) | /* This function handles external line 15_10 interrupt request. */
void EXTI15_10_IRQHandler(void) | {
*(__IO uint32_t *) 0xA0002000 = 0xFF;
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Starts Pulse-Width Modulation signal output on a PWM pin */ | int32_t hal_pwm_start(pwm_dev_t *pwm) | /* Starts Pulse-Width Modulation signal output on a PWM pin */
int32_t hal_pwm_start(pwm_dev_t *pwm) | {
_HAL_PWM_PRIV_T *_cfg = (_HAL_PWM_PRIV_T *)pwm->priv;
if (_cfg->start == 0) {
if (hal_pwm_enable(_cfg->chan, &_cfg->pwm_cfg) == 0) {
_cfg->start = 1;
}
}
return 0;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Is called after a "threshold exceeded" interrupt occurred. Checks the sensor's status register for the limit exceeded flags and calls the trigger handler if one of the flags is set. */ | static void tids_process_threshold_interrupt(const struct device *dev) | /* Is called after a "threshold exceeded" interrupt occurred. Checks the sensor's status register for the limit exceeded flags and calls the trigger handler if one of the flags is set. */
static void tids_process_threshold_interrupt(const struct device *dev) | {
struct tids_data *data = dev->data;
TIDS_status_t status;
if (TIDS_getStatusRegister(&data->sensor_interface, &status) != WE_SUCCESS) {
LOG_ERR("Failed to read status register");
return;
}
if (data->threshold_handler != NULL &&
(status.upperLimitExceeded != 0 || status.lowerLimitExceeded != 0)) {
data->threshold_handler(dev, data->threshold_trigger);
}
if (data->threshold_handler != NULL) {
tids_setup_threshold_interrupt(dev, true);
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Aborts all ongoing jobs.
Aborts all ongoing jobs. */ | void m2m_abort_job(struct m2m_module *const m2m, enum m2m_job_type type) | /* Aborts all ongoing jobs.
Aborts all ongoing jobs. */
void m2m_abort_job(struct m2m_module *const m2m, enum m2m_job_type type) | {
Assert(m2m);
Assert(m2m->hw);
UNUSED(type);
m2m->hw->MEM2MEM_PTCR = (MEM2MEM_PTCR_RXTDIS | MEM2MEM_PTCR_TXTDIS);
m2m->hw->MEM2MEM_IDR = 0xFFFFFFFF;
m2m->job_status = ERR_ABORTED;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Gets the status of a job.
Gets the status of an ongoing or the last job. */ | enum status_code dac_chan_get_job_status(struct dac_module *module_inst, const enum dac_channel channel) | /* Gets the status of a job.
Gets the status of an ongoing or the last job. */
enum status_code dac_chan_get_job_status(struct dac_module *module_inst, const enum dac_channel channel) | {
Assert(module_inst);
return module_inst->job_status[channel];
} | memfault/zero-to-main | C++ | null | 200 |
/* Registers an interrupt handler for the specified PWM generator block. */ | void PWMGenIntRegister(uint32_t ui32Base, uint32_t ui32Gen, void(*pfnIntHandler)(void)) | /* Registers an interrupt handler for the specified PWM generator block. */
void PWMGenIntRegister(uint32_t ui32Base, uint32_t ui32Gen, void(*pfnIntHandler)(void)) | {
uint32_t ui32Int;
ASSERT(ui32Base == PWM0_BASE);
ASSERT(_PWMGenValid(ui32Gen));
ui32Int = _PWMGenIntNumberGet(ui32Base, ui32Gen);
ASSERT(ui32Int != 0);
IntRegister(ui32Int, pfnIntHandler);
IntEnable(ui32Int);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Exit deep power down mode.
The Release from RDP instruction is putting the device in the Stand-by Power mode. */ | enum status_code mx25v_exit_deep_powerdown(void) | /* Exit deep power down mode.
The Release from RDP instruction is putting the device in the Stand-by Power mode. */
enum status_code mx25v_exit_deep_powerdown(void) | {
enum status_code status;
uint8_t tx_buf[1] = {MX25V_CMD_RDP};
_mx25v_chip_select();
status = spi_write_buffer_wait(&_mx25v_spi, tx_buf, 1);
if (status != STATUS_OK) {
return STATUS_ERR_IO;
}
_mx25v_chip_deselect();
return STATUS_OK;
} | memfault/zero-to-main | C++ | null | 200 |
/* The stream current position is rewound according to the stream direction (forward, backward). A stream going forward will be rewound backward. */ | EFI_STATUS EFIAPI AmlStreamRewind(IN AML_STREAM *Stream, IN UINT32 Offset) | /* The stream current position is rewound according to the stream direction (forward, backward). A stream going forward will be rewound backward. */
EFI_STATUS EFIAPI AmlStreamRewind(IN AML_STREAM *Stream, IN UINT32 Offset) | {
if (!IS_STREAM (Stream) ||
(Offset == 0))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
if (AmlStreamGetIndex (Stream) < Offset) {
ASSERT (0);
return EFI_BUFFER_TOO_SMALL;
}
Stream->Index -= Offset;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Computes the 32-bit CRC of a given buffer of data word(32-bit). */ | u32 CRC_CalcBlockCRC(u32 *buffer, u32 length) | /* Computes the 32-bit CRC of a given buffer of data word(32-bit). */
u32 CRC_CalcBlockCRC(u32 *buffer, u32 length) | {
u32 i;
for (i = 0; i < length; i++) {
CRC->DR = buffer[i];
}
return (CRC->DR);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ | UINT32 EFIAPI S3PciBitFieldOr32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 OrData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI S3PciBitFieldOr32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 OrData) | {
return InternalSavePciWrite32ValueToBootScript (Address, PciBitFieldOr32 (Address, StartBit, EndBit, OrData));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function adds a socket to sk_list of a SAP. */ | void llc_sap_add_socket(struct llc_sap *sap, struct sock *sk) | /* This function adds a socket to sk_list of a SAP. */
void llc_sap_add_socket(struct llc_sap *sap, struct sock *sk) | {
llc_sap_hold(sap);
write_lock_bh(&sap->sk_list.lock);
llc_sk(sk)->sap = sap;
sk_add_node(sk, &sap->sk_list.list);
write_unlock_bh(&sap->sk_list.lock);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function iterates over all open file descriptors and sees if they are a directory in spufs. In that case we use spufs internal functionality to dump them without needing to actually open the files. */ | static struct spu_context* coredump_next_context(int *fd) | /* This function iterates over all open file descriptors and sees if they are a directory in spufs. In that case we use spufs internal functionality to dump them without needing to actually open the files. */
static struct spu_context* coredump_next_context(int *fd) | {
struct fdtable *fdt = files_fdtable(current->files);
struct file *file;
struct spu_context *ctx = NULL;
for (; *fd < fdt->max_fds; (*fd)++) {
if (!FD_ISSET(*fd, fdt->open_fds))
continue;
file = fcheck(*fd);
if (!file || file->f_op != &spufs_context_fops)
continue;
ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx;
if (ctx->flags & SPU_CREATE_NOSCHED)
continue;
break;
}
return ctx;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Sets the address of the frame buffer in the LCD controller DMA. When using dual-scan mode, this is the upper frame buffer. */ | void LCD_SetFrameBufferAddress(void *address) | /* Sets the address of the frame buffer in the LCD controller DMA. When using dual-scan mode, this is the upper frame buffer. */
void LCD_SetFrameBufferAddress(void *address) | {
AT91C_BASE_LCDC->LCDC_BA1 = (unsigned int) address;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Program the PAGESIZE register, initialize the device context array, create device contexts (?), set up a command ring segment (or two?), create event ring (one for now). */ | int xhci_init(struct usb_hcd *hcd) | /* Program the PAGESIZE register, initialize the device context array, create device contexts (?), set up a command ring segment (or two?), create event ring (one for now). */
int xhci_init(struct usb_hcd *hcd) | {
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
int retval = 0;
xhci_dbg(xhci, "xhci_init\n");
spin_lock_init(&xhci->lock);
if (link_quirk) {
xhci_dbg(xhci, "QUIRK: Not clearing Link TRB chain bits.\n");
xhci->quirks |= XHCI_LINK_TRB_QUIRK;
} else {
xhci_dbg(xhci, "xHCI doesn't need link TRB QUIRK\n");
}
retval = xhci_mem_init(xhci, GFP_KERNEL);
xhci_dbg(xhci, "Finished xhci_init\n");
return retval;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is called to read back the register backing store. */ | void ia64_sync_krbs(void) | /* This is called to read back the register backing store. */
void ia64_sync_krbs(void) | {
clear_tsk_thread_flag(current, TIF_RESTORE_RSE);
unw_init_running(do_sync_rbs, ia64_sync_kernel_rbs);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* pm_request_idle - Submit an idle notification request for given device. @dev: Device to handle. */ | int pm_request_idle(struct device *dev) | /* pm_request_idle - Submit an idle notification request for given device. @dev: Device to handle. */
int pm_request_idle(struct device *dev) | {
unsigned long flags;
int retval;
spin_lock_irqsave(&dev->power.lock, flags);
retval = __pm_request_idle(dev);
spin_unlock_irqrestore(&dev->power.lock, flags);
return retval;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base SPDIF base pointer param handle SPDIF eDMA handle pointer. */ | void SPDIF_TransferAbortReceiveEDMA(SPDIF_Type *base, spdif_edma_handle_t *handle) | /* param base SPDIF base pointer param handle SPDIF eDMA handle pointer. */
void SPDIF_TransferAbortReceiveEDMA(SPDIF_Type *base, spdif_edma_handle_t *handle) | {
assert(handle);
EDMA_AbortTransfer(handle->dmaLeftHandle);
EDMA_AbortTransfer(handle->dmaRightHandle);
SPDIF_EnableDMA(base, kSPDIF_RxDMAEnable, false);
memset(handle->spdifQueue, 0U, sizeof(handle->spdifQueue));
memset(handle->transferSize, 0U, sizeof(handle->transferSize));
handle->queueUser = 0U;
handle->queueDriver = 0U;
handle->state = kSPDIF_Idle;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The function is used to check GPT structure, include GPT header and GPT entry array. */ | BOOLEAN PartitionCheckGptStructure(IN PEI_FAT_PRIVATE_DATA *PrivateData, IN UINTN ParentBlockDevNo, IN BOOLEAN IsPrimary) | /* The function is used to check GPT structure, include GPT header and GPT entry array. */
BOOLEAN PartitionCheckGptStructure(IN PEI_FAT_PRIVATE_DATA *PrivateData, IN UINTN ParentBlockDevNo, IN BOOLEAN IsPrimary) | {
EFI_STATUS Status;
PEI_FAT_BLOCK_DEVICE *ParentBlockDev;
EFI_PARTITION_TABLE_HEADER *PartHdr;
EFI_PEI_LBA GptHeaderLBA;
ParentBlockDev = &(PrivateData->BlockDevice[ParentBlockDevNo]);
PartHdr = (EFI_PARTITION_TABLE_HEADER *)PrivateData->BlockData;
if (IsPrimary) {
GptHeaderLBA = PRIMARY_PART_HEADER_LBA;
} else {
GptHeaderLBA = ParentBlockDev->LastBlock;
}
Status = FatReadBlock (
PrivateData,
ParentBlockDevNo,
GptHeaderLBA,
ParentBlockDev->BlockSize,
PartHdr
);
if (EFI_ERROR (Status)) {
return FALSE;
}
if (!PartitionCheckGptHeader (PrivateData, ParentBlockDevNo, IsPrimary, PartHdr)) {
return FALSE;
}
if (!PartitionCheckGptEntryArray (PrivateData, ParentBlockDevNo, PartHdr)) {
return FALSE;
}
return TRUE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Gets a data element from the SPI interface. */ | void xSPIDataRead(unsigned long ulBase, void *pulRData, unsigned long ulLen) | /* Gets a data element from the SPI interface. */
void xSPIDataRead(unsigned long ulBase, void *pulRData, unsigned long ulLen) | {
unsigned long i;
unsigned char ucBitLength = xSPIBitLengthGet(ulBase);
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) || (ulBase == SPI3_BASE));
for (i=0; i<ulLen; i++)
{
if (ucBitLength <= 8)
{
((unsigned char*)pulRData)[i] =
xSPISingleDataReadWrite(ulBase, 0xFF);
}
else if (ucBitLength >= 8 && ucBitLength <= 16)
{
((unsigned short*)pulRData)[i] =
xSPISingleDataReadWrite(ulBase, 0xFFFF);
}
else
{
((unsigned long*)pulRData)[i] =
xSPISingleDataReadWrite(ulBase, 0xFFFFFF);
}
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* DMA2D MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef *hdma2d) | /* DMA2D MSP Initialization This function configures the hardware resources used in this example. */
void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef *hdma2d) | {
if(hdma2d->Instance==DMA2D)
{
__HAL_RCC_DMA2D_CLK_ENABLE();
HAL_NVIC_SetPriority(DMA2D_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(DMA2D_IRQn);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Gets the current interrupt status of the Hibernation module. */ | uint32_t HibernateIntStatus(bool bMasked) | /* Gets the current interrupt status of the Hibernation module. */
uint32_t HibernateIntStatus(bool bMasked) | {
if(bMasked == true)
{
return(HWREG(HIB_MIS) & 0x1f);
}
else
{
return(HWREG(HIB_RIS) & 0x1f);
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* param base Pointer to the FLEXIO_UART_Type structure. return FlexIO UART status flags. */ | uint32_t FLEXIO_UART_GetStatusFlags(FLEXIO_UART_Type *base) | /* param base Pointer to the FLEXIO_UART_Type structure. return FlexIO UART status flags. */
uint32_t FLEXIO_UART_GetStatusFlags(FLEXIO_UART_Type *base) | {
uint32_t status = 0;
status =
((FLEXIO_GetShifterStatusFlags(base->flexioBase) & (1U << base->shifterIndex[0])) >> base->shifterIndex[0]);
status |=
(((FLEXIO_GetShifterStatusFlags(base->flexioBase) & (1U << base->shifterIndex[1])) >> (base->shifterIndex[1]))
<< 1U);
status |=
(((FLEXIO_GetShifterErrorFlags(base->flexioBase) & (1U << base->shifterIndex[1])) >> (base->shifterIndex[1]))
<< 2U);
return status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function is weak-linked, so you can implement your own version to custom display pattern. */ | void __attribute__((weak)) | /* This function is weak-linked, so you can implement your own version to custom display pattern. */
void __attribute__((weak)) | {
ESP_LOGW(TAG, "Default %s has been called, %s", __func__, __FILE__);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Decrease reference count of bus operator and free it if it is the last reference. */ | static void mmc_bus_put(struct mmc_host *host) | /* Decrease reference count of bus operator and free it if it is the last reference. */
static void mmc_bus_put(struct mmc_host *host) | {
unsigned long flags;
spin_lock_irqsave(&host->lock, flags);
host->bus_refs--;
if ((host->bus_refs == 0) && host->bus_ops)
__mmc_release_bus(host);
spin_unlock_irqrestore(&host->lock, flags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* this function is a POSIX compliant version, which will return the information about a mounted file system. */ | int fstatfs(int fildes, struct statfs *buf) | /* this function is a POSIX compliant version, which will return the information about a mounted file system. */
int fstatfs(int fildes, struct statfs *buf) | {
struct dfs_file *d;
d = fd_get(fildes);
if (d == NULL)
{
rt_set_errno(-EBADF);
return -1;
}
return statfs(d->vnode->fullpath, buf);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ | UINT16 EFIAPI PciRead16(IN UINTN Address) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciRead16(IN UINTN Address) | {
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
return (UINT16)DxePciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint16);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get the offset value from a sample sequence. */ | unsigned long ADCOffsetDataGet(unsigned long ulBase, unsigned long *pulBuffer) | /* Get the offset value from a sample sequence. */
unsigned long ADCOffsetDataGet(unsigned long ulBase, unsigned long *pulBuffer) | {
unsigned long i, j;
unsigned long ulSeqLen,ulChannelNo[16];
unsigned long ulWrite;
xASSERT(ulBase == ADC_BASE);
xASSERT(pulBuffer != 0);
ulSeqLen = ((xHWREG(ulBase + ADC_CONV) & ADC_CONV_SEQL_M) >> ADC_CONV_SEQL_S) + 1;
for(i = 0; i < ulSeqLen; i++)
{
ulChannelNo[i] = (xHWREG(ulBase + ADC_LST0 + (i/4)*4) & (0x07<<(8*(i%4))))
>> (8*(i%4));
}
ulWrite = 0;
for(j = 0; j < ulSeqLen; j++)
{
while(!ADCIntStatus(ADC_BASE, ADC_INT_END_CONVERSION));
pulBuffer[ulWrite++] = xHWREG(ulBase + ADC_OFR0 + ulChannelNo[j]*4)
& ADC_ADOF0_M;
}
return ulWrite;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Insert the memory block to the pool's list of the blocks. */ | VOID SdPeimInsertMemBlockToPool(IN SD_PEIM_MEM_BLOCK *Head, IN SD_PEIM_MEM_BLOCK *Block) | /* Insert the memory block to the pool's list of the blocks. */
VOID SdPeimInsertMemBlockToPool(IN SD_PEIM_MEM_BLOCK *Head, IN SD_PEIM_MEM_BLOCK *Block) | {
ASSERT ((Head != NULL) && (Block != NULL));
Block->Next = Head->Next;
Head->Next = Block;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Truncate size of the array to @num_elements if less than the current size. No memory is actually freed. The stored objects beyond @num_elements are simply "forgotten". */ | void _cairo_array_truncate(cairo_array_t *array, unsigned int num_elements) | /* Truncate size of the array to @num_elements if less than the current size. No memory is actually freed. The stored objects beyond @num_elements are simply "forgotten". */
void _cairo_array_truncate(cairo_array_t *array, unsigned int num_elements) | {
if (num_elements < array->num_elements)
array->num_elements = num_elements;
} | xboot/xboot | C++ | MIT License | 779 |
/* Set the exact match register 'idx' to recognize the given Ethernet address. */ | static void set_addr_filter(struct cmac *mac, int idx, const u8 *addr) | /* Set the exact match register 'idx' to recognize the given Ethernet address. */
static void set_addr_filter(struct cmac *mac, int idx, const u8 *addr) | {
u32 addr_lo, addr_hi;
unsigned int oft = mac->offset + idx * 8;
addr_lo = (addr[3] << 24) | (addr[2] << 16) | (addr[1] << 8) | addr[0];
addr_hi = (addr[5] << 8) | addr[4];
t3_write_reg(mac->adapter, A_XGM_RX_EXACT_MATCH_LOW_1 + oft, addr_lo);
t3_write_reg(mac->adapter, A_XGM_RX_EXACT_MATCH_HIGH_1 + oft, addr_hi);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type. */ | mxml_node_t* mxmlLoadString(mxml_node_t *top, const char *s, mxml_load_cb_t cb) | /* The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type. */
mxml_node_t* mxmlLoadString(mxml_node_t *top, const char *s, mxml_load_cb_t cb) | {
return (mxml_load_data(top, (void *)&s, cb, mxml_string_getc, MXML_NO_CALLBACK,
NULL));
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Verify the current pointer points to a valid FV header. */ | EFI_STATUS VerifyFv(IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader) | /* Verify the current pointer points to a valid FV header. */
EFI_STATUS VerifyFv(IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader) | {
UINT16 Checksum;
if (FvHeader == NULL) {
return EFI_INVALID_PARAMETER;
}
if (FvHeader->Signature != EFI_FVH_SIGNATURE) {
Error (NULL, 0, 0006, "invalid FV header signature", NULL);
return EFI_VOLUME_CORRUPTED;
}
Checksum = CalculateSum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
if (Checksum != 0) {
Error (NULL, 0, 0006, "invalid FV header checksum", NULL);
return EFI_ABORTED;
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.