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
|
|---|---|---|---|---|---|---|---|
/* Read the block at 'phys' which belongs to this directory inode. This function does no virtual->physical block translation - what's passed in is assumed to be a valid directory block. */
|
static int ocfs2_read_dir_block_direct(struct inode *dir, u64 phys, struct buffer_head **bh)
|
/* Read the block at 'phys' which belongs to this directory inode. This function does no virtual->physical block translation - what's passed in is assumed to be a valid directory block. */
static int ocfs2_read_dir_block_direct(struct inode *dir, u64 phys, struct buffer_head **bh)
|
{
int ret;
struct buffer_head *tmp = *bh;
ret = ocfs2_read_block(INODE_CACHE(dir), phys, &tmp,
ocfs2_validate_dir_block);
if (ret) {
mlog_errno(ret);
goto out;
}
if (ocfs2_supports_dir_trailer(dir)) {
ret = ocfs2_check_dir_trailer(dir, tmp);
if (ret) {
if (!*bh)
brelse(tmp);
mlog_errno(ret);
goto out;
}
}
if (!ret && !*bh)
*bh = tmp;
out:
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check the peripheral read / write access permission on Domain . */
|
int imx_rdc_check_permission(int per_id, int dom_id)
|
/* Check the peripheral read / write access permission on Domain . */
int imx_rdc_check_permission(int per_id, int dom_id)
|
{
struct rdc_regs *imx_rdc = (struct rdc_regs *)RDC_BASE_ADDR;
u32 reg;
reg = readl(&imx_rdc->pdap[per_id]);
if (!(reg & RDC_PDAP_DRW_MASK(dom_id)))
return -EACCES;
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Clear one or more interrupts of PortA. Parameters: pinno: return: SUCCESS. */
|
static void gpio_irq_clear(uint32_t idx)
|
/* Clear one or more interrupts of PortA. Parameters: pinno: return: SUCCESS. */
static void gpio_irq_clear(uint32_t idx)
|
{
gpio_control_reg->PORTA_EOI = idx;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Configures the interrupt associated with the given source, using the specified mode and interrupt handler. */
|
void AIC_ConfigureIT(unsigned int source, unsigned int mode, void(*handler)(void))
|
/* Configures the interrupt associated with the given source, using the specified mode and interrupt handler. */
void AIC_ConfigureIT(unsigned int source, unsigned int mode, void(*handler)(void))
|
{
AT91C_BASE_AIC->AIC_IDCR = 1 << source;
AT91C_BASE_AIC->AIC_SMR[source] = mode;
AT91C_BASE_AIC->AIC_SVR[source] = (unsigned int) handler;
AT91C_BASE_AIC->AIC_ICCR = 1 << source;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Writes a single byte to the EZRadio SPI port. */
|
void ezradio_hal_SpiWriteByte(uint8_t byteToWrite)
|
/* Writes a single byte to the EZRadio SPI port. */
void ezradio_hal_SpiWriteByte(uint8_t byteToWrite)
|
{
SPIDRV_MTransmitB(ezradioSpiHandlePtr, &byteToWrite, 1);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* param base CSI peripheral base address. param fifo The FIFO to clear. */
|
void CSI_ClearFifo(CSI_Type *base, csi_fifo_t fifo)
|
/* param base CSI peripheral base address. param fifo The FIFO to clear. */
void CSI_ClearFifo(CSI_Type *base, csi_fifo_t fifo)
|
{
uint32_t cr1;
uint32_t mask = 0U;
cr1 = CSI_REG_CR1(base);
CSI_REG_CR1(base) = (cr1 & ~CSI_CSICR1_FCC_MASK);
if (0U != ((uint32_t)fifo & (uint32_t)kCSI_RxFifo))
{
mask |= CSI_CSICR1_CLR_RXFIFO_MASK;
}
if (0U != ((uint32_t)fifo & (uint32_t)kCSI_StatFifo))
{
mask |= CSI_CSICR1_CLR_STATFIFO_MASK;
}
CSI_REG_CR1(base) = (cr1 & ~CSI_CSICR1_FCC_MASK) | mask;
while (0U != (CSI_REG_CR1(base) & mask))
{
}
CSI_REG_CR1(base) = cr1;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Please refer to your PHY manual for registers and their meanings. mii_read() polls for the FEC's MII interrupt event and clears it. If after a suitable amount of time the event isn't triggered, a value of 0 is returned. */
|
static int fec_mii_read(int phy_addr, int reg_addr, unsigned short *data)
|
/* Please refer to your PHY manual for registers and their meanings. mii_read() polls for the FEC's MII interrupt event and clears it. If after a suitable amount of time the event isn't triggered, a value of 0 is returned. */
static int fec_mii_read(int phy_addr, int reg_addr, unsigned short *data)
|
{
int timeout;
unsigned long eimr;
EIR = 0xffffffff;
eimr = EIMR;
EIMR &= ~EIMR_MII;
MMFR = ( unsigned long ) ( FEC_MMFR_ST_01 | FEC_MMFR_OP_READ | FEC_MMFR_PA(phy_addr) | FEC_MMFR_RA(reg_addr) | FEC_MMFR_TA_10 );
for (timeout = 0; timeout < FEC_MII_TIMEOUT; timeout++)
{
if (EIR)
{
break;
}
}
if(timeout == FEC_MII_TIMEOUT)
{
return 0;
}
EIR = EIR_MII;
EIMR = eimr;
*data = (unsigned short)(MMFR & 0x0000FFFF);
return 1;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Checks whether the specified CEC interrupt has occurred or not. */
|
uint8_t CEC_ReadIntFlag(uint16_t flag)
|
/* Checks whether the specified CEC interrupt has occurred or not. */
uint8_t CEC_ReadIntFlag(uint16_t flag)
|
{
uint32_t intEnable;
uint32_t intStatus;
intEnable = (CEC->INTEN & flag);
intStatus = (CEC->STS & flag);
if((intStatus != (uint32_t)RESET) && intEnable)
{
return SET;
}
else
{
return RESET;
}
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Returns the raw monotonic time (completely un-modified by ntp) */
|
void getrawmonotonic(struct timespec *ts)
|
/* Returns the raw monotonic time (completely un-modified by ntp) */
void getrawmonotonic(struct timespec *ts)
|
{
unsigned long seq;
s64 nsecs;
do {
seq = read_seqbegin(&xtime_lock);
nsecs = timekeeping_get_ns_raw();
*ts = raw_time;
} while (read_seqretry(&xtime_lock, seq));
timespec_add_ns(ts, nsecs);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Configure ADC convert array. This function is used to fill ADC convert array, so you can use it to support ADC burst mode. */
|
void xADCStepConfigure(unsigned long ulBase, unsigned long ulStep, unsigned long ulConfig)
|
/* Configure ADC convert array. This function is used to fill ADC convert array, so you can use it to support ADC burst mode. */
void xADCStepConfigure(unsigned long ulBase, unsigned long ulStep, unsigned long ulConfig)
|
{
xASSERT(ulBase == xADC0_BASE);
xASSERT(ulStep <= 6);
xASSERT( (ulConfig == xADC_CTL_CH0) ||
(ulConfig == xADC_CTL_CH1) ||
(ulConfig == xADC_CTL_CH2) ||
(ulConfig == xADC_CTL_CH3) ||
(ulConfig == xADC_CTL_CH4) ||
(ulConfig == xADC_CTL_CH5) ||
(ulConfig == xADC_CTL_CH6) );
_ADC_Channels |= ulConfig;
xHWREG(ulBase + AD_CR) |= ulConfig;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* This function sets the verification mode flags for the TLS connection. */
|
VOID EFIAPI TlsSetVerify(IN VOID *Tls, IN UINT32 VerifyMode)
|
/* This function sets the verification mode flags for the TLS connection. */
VOID EFIAPI TlsSetVerify(IN VOID *Tls, IN UINT32 VerifyMode)
|
{
CALL_VOID_CRYPTO_SERVICE (TlsSetVerify, (Tls, VerifyMode));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Pick a random link local IP address on 169.254/16, except that the first and last 256 addresses are reserved. */
|
static struct in_addr pick(void)
|
/* Pick a random link local IP address on 169.254/16, except that the first and last 256 addresses are reserved. */
static struct in_addr pick(void)
|
{
unsigned tmp;
struct in_addr ip;
do {
tmp = rand_r(&seed) & IN_CLASSB_HOST;
} while (tmp > (IN_CLASSB_HOST - 0x0200));
ip.s_addr = htonl((LINKLOCAL_ADDR + 0x0100) + tmp);
return ip;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Sets the number of data units in the current DMAy Channelx transfer. */
|
void DMA_SetCurrDataCounter(DMA_ChannelType *DMAChx, uint16_t DataNumber)
|
/* Sets the number of data units in the current DMAy Channelx transfer. */
void DMA_SetCurrDataCounter(DMA_ChannelType *DMAChx, uint16_t DataNumber)
|
{
assert_param(IS_DMA_ALL_PERIPH(DMAChx));
DMAChx->TXNUM = DataNumber;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* the instruction disassembly implemented here matches the instruction encoding classifications in chapter 3 (C3) of the ARM Architecture Reference Manual (DDI0487A_a) */
|
static void disas_uncond_b_imm(DisasContext *s, uint32_t insn)
|
/* the instruction disassembly implemented here matches the instruction encoding classifications in chapter 3 (C3) of the ARM Architecture Reference Manual (DDI0487A_a) */
static void disas_uncond_b_imm(DisasContext *s, uint32_t insn)
|
{
uint64_t addr = s->pc + sextract32(insn, 0, 26) * 4 - 4;
if (insn & (1 << 31)) {
tcg_gen_movi_i64(cpu_reg(s, 30), s->pc);
}
gen_goto_tb(s, 0, addr);
}
|
ve3wwg/teensy3_qemu
|
C++
|
Other
| 15
|
/* Program a 32 bit Word to FLASH This performs all operations necessary to program a 32 bit word to FLASH memory. The program error flag should be checked separately for the event that memory was not properly erased. */
|
void flash_program_word(uint32_t address, uint32_t data)
|
/* Program a 32 bit Word to FLASH This performs all operations necessary to program a 32 bit word to FLASH memory. The program error flag should be checked separately for the event that memory was not properly erased. */
void flash_program_word(uint32_t address, uint32_t data)
|
{
flash_wait_for_last_operation();
FLASH_CR |= FLASH_CR_PG;
MMIO32(address) = data;
flash_wait_for_last_operation();
FLASH_CR &= ~FLASH_CR_PG;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* ETH MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
|
/* ETH MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
|
{
if(heth->Instance==ETH)
{
__HAL_RCC_ETH_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_7);
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_11);
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_13|GPIO_PIN_14);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function traces FADT Flags fields. If no format string is specified the Format must be NULL. */
|
VOID EFIAPI DumpFadtFlags(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr)
|
/* This function traces FADT Flags fields. If no format string is specified the Format must be NULL. */
VOID EFIAPI DumpFadtFlags(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr)
|
{
if (Format != NULL) {
Print (Format, *(UINT32 *)Ptr);
return;
}
Print (L"0x%X\n", *(UINT32 *)Ptr);
ParseAcpiBitFields (
TRUE,
2,
NULL,
Ptr,
4,
PARSER_PARAMS (FadtFlagParser)
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function is used to initialize after power-up the radio chip. Before this function ezradio_reset should be called. */
|
void ezradio_power_up(uint8_t boot_options, uint8_t xtal_options, uint32_t xo_freq)
|
/* This function is used to initialize after power-up the radio chip. Before this function ezradio_reset should be called. */
void ezradio_power_up(uint8_t boot_options, uint8_t xtal_options, uint32_t xo_freq)
|
{
uint8_t ezradioCmd[7u];
ezradioCmd[0] = EZRADIO_CMD_ID_POWER_UP;
ezradioCmd[1] = boot_options;
ezradioCmd[2] = xtal_options;
ezradioCmd[3] = (uint8_t)(xo_freq >> 24);
ezradioCmd[4] = (uint8_t)(xo_freq >> 16);
ezradioCmd[5] = (uint8_t)(xo_freq >> 8);
ezradioCmd[6] = (uint8_t)(xo_freq);
ezradio_comm_SendCmd( EZRADIO_CMD_ARG_COUNT_POWER_UP, ezradioCmd );
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Validate the Boot####, Driver####, SysPrep#### and PlatformRecovery#### variable (VendorGuid/Name) */
|
BOOLEAN BmValidateOption(UINT8 *Variable, UINTN VariableSize)
|
/* Validate the Boot####, Driver####, SysPrep#### and PlatformRecovery#### variable (VendorGuid/Name) */
BOOLEAN BmValidateOption(UINT8 *Variable, UINTN VariableSize)
|
{
UINT16 FilePathSize;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
UINTN DescriptionSize;
if (VariableSize <= sizeof (UINT16) + sizeof (UINT32)) {
return FALSE;
}
Variable += sizeof (UINT32);
FilePathSize = ReadUnaligned16 ((UINT16 *)Variable);
Variable += sizeof (UINT16);
DescriptionSize = BmStrSizeEx ((CHAR16 *)Variable, VariableSize - sizeof (UINT16) - sizeof (UINT32));
Variable += DescriptionSize;
DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)Variable;
if ((FilePathSize == 0) || (DescriptionSize == 0)) {
return FALSE;
}
if (sizeof (UINT32) + sizeof (UINT16) + DescriptionSize + FilePathSize > VariableSize) {
return FALSE;
}
return (BOOLEAN)(BmGetDevicePathSizeEx (DevicePath, FilePathSize) != 0);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* We're in laptop mode and we've just synced. The sync's writes will have caused another writeback to be scheduled by laptop_io_completion. Nothing needs to be written back anymore, so we unschedule the writeback. */
|
void laptop_sync_completion(void)
|
/* We're in laptop mode and we've just synced. The sync's writes will have caused another writeback to be scheduled by laptop_io_completion. Nothing needs to be written back anymore, so we unschedule the writeback. */
void laptop_sync_completion(void)
|
{
del_timer(&laptop_mode_wb_timer);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Read a single byte from the serial port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */
|
int serial_getc(void)
|
/* Read a single byte from the serial port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */
int serial_getc(void)
|
{
int rv;
for(;;) {
rv = serial_tstc();
if(rv > 0)
return URXH0;
}
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Configures the data size for the selected SPI. */
|
void SPI_DataSizeConfig(SPI_TypeDef *SPIx, uint16_t SPI_DataSize)
|
/* Configures the data size for the selected SPI. */
void SPI_DataSizeConfig(SPI_TypeDef *SPIx, uint16_t SPI_DataSize)
|
{
uint16_t tmpreg = 0;
assert_param(IS_SPI_ALL_PERIPH(SPIx));
assert_param(IS_SPI_DATA_SIZE(SPI_DataSize));
tmpreg = SPIx->CR2;
tmpreg &= (uint16_t)~SPI_CR2_DS;
tmpreg |= SPI_DataSize;
SPIx->CR2 = tmpreg;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* nilfs_dirty_inode() loads a inode block containing the specified @inode and copies data from a nilfs_inode to a corresponding inode entry in the inode block. This operation is excluded from the segment construction. This function can be called both as a single operation and as a part of indivisible file operations. */
|
void nilfs_dirty_inode(struct inode *inode)
|
/* nilfs_dirty_inode() loads a inode block containing the specified @inode and copies data from a nilfs_inode to a corresponding inode entry in the inode block. This operation is excluded from the segment construction. This function can be called both as a single operation and as a part of indivisible file operations. */
void nilfs_dirty_inode(struct inode *inode)
|
{
struct nilfs_transaction_info ti;
if (is_bad_inode(inode)) {
nilfs_warning(inode->i_sb, __func__,
"tried to mark bad_inode dirty. ignored.\n");
dump_stack();
return;
}
nilfs_transaction_begin(inode->i_sb, &ti, 0);
nilfs_mark_inode_dirty(inode);
nilfs_transaction_commit(inode->i_sb);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The software interrupt instruction (SWI) is used for entering Supervisor mode, usually to request a particular supervisor function. */
|
void rt_hw_trap_swi(struct rt_hw_register *regs)
|
/* The software interrupt instruction (SWI) is used for entering Supervisor mode, usually to request a particular supervisor function. */
void rt_hw_trap_swi(struct rt_hw_register *regs)
|
{
rt_kprintf("software interrupt\n");
rt_hw_show_register(regs);
if (rt_thread_self() != RT_NULL)
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
rt_hw_cpu_shutdown();
}
|
armink/FreeModbus_Slave-Master-RTT-STM32
|
C++
|
Other
| 1,477
|
/* Assigns the desired input slots to a particular channel. */
|
void AC97C_AssignInputSlots(unsigned char channel, unsigned int slots)
|
/* Assigns the desired input slots to a particular channel. */
void AC97C_AssignInputSlots(unsigned char channel, unsigned int slots)
|
{
unsigned int value;
unsigned int i;
SANITY_CHECK(channel <= AC97C_CHANNEL_B);
slots >>= 3;
for (i = 3; i < 15; i++) {
if (slots & 1) {
value = AT91C_BASE_AC97C->AC97C_ICA;
value &= ~(0x07 << ((i - 3) * 3));
value |= channel << ((i - 3) * 3);
AT91C_BASE_AC97C->AC97C_ICA = value;
}
slots >>= 1;
}
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Given an ucs4 string, this function returns the size (in bytes) this string would have occupied if it was encoded in utf-8. */
|
enum CRStatus cr_utils_ucs4_str_len_as_utf8(const guint32 *a_in_start, const guint32 *a_in_end, gulong *a_len)
|
/* Given an ucs4 string, this function returns the size (in bytes) this string would have occupied if it was encoded in utf-8. */
enum CRStatus cr_utils_ucs4_str_len_as_utf8(const guint32 *a_in_start, const guint32 *a_in_end, gulong *a_len)
|
{
gint len = 0;
guint32 *char_ptr = NULL;
g_return_val_if_fail (a_in_start && a_in_end && a_len,
CR_BAD_PARAM_ERROR);
for (char_ptr = (guint32 *) a_in_start;
char_ptr <= a_in_end; char_ptr++) {
if (*char_ptr <= 0x7F) {
len += 1;
} else if (*char_ptr <= 0x7FF) {
len += 2;
} else if (*char_ptr <= 0xFFFF) {
len += 3;
} else if (*char_ptr <= 0x1FFFFF) {
len += 4;
} else if (*char_ptr <= 0x3FFFFFF) {
len += 5;
} else if (*char_ptr <= 0x7FFFFFFF) {
len += 6;
}
}
*a_len = len;
return CR_OK;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Initialize the IrTTP layer. Called by module initialization code */
|
int __init irttp_init(void)
|
/* Initialize the IrTTP layer. Called by module initialization code */
int __init irttp_init(void)
|
{
irttp = kzalloc(sizeof(struct irttp_cb), GFP_KERNEL);
if (irttp == NULL)
return -ENOMEM;
irttp->magic = TTP_MAGIC;
irttp->tsaps = hashbin_new(HB_LOCK);
if (!irttp->tsaps) {
IRDA_ERROR("%s: can't allocate IrTTP hashbin!\n",
__func__);
kfree(irttp);
return -ENOMEM;
}
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Writes user data to the specified Data Backup Register. */
|
void BKP_WriteBackupRegister(uint16_t BKP_DR, uint16_t Data)
|
/* Writes user data to the specified Data Backup Register. */
void BKP_WriteBackupRegister(uint16_t BKP_DR, uint16_t Data)
|
{
__IO uint32_t tmp = 0;
assert_param(IS_BKP_DR(BKP_DR));
tmp = (uint32_t)BKP_BASE;
tmp += BKP_DR;
*(__IO uint32_t *) tmp = Data;
}
|
gcallipo/RadioDSP-Stm32f103
|
C++
|
Common Creative - Attribution 3.0
| 51
|
/* Send Identify Drive command to a specific device. */
|
EFI_STATUS AhciIdentify(IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINT8 Port, IN UINT8 PortMultiplier, IN UINT8 FisIndex, IN ATA_IDENTIFY_DATA *Buffer)
|
/* Send Identify Drive command to a specific device. */
EFI_STATUS AhciIdentify(IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINT8 Port, IN UINT8 PortMultiplier, IN UINT8 FisIndex, IN ATA_IDENTIFY_DATA *Buffer)
|
{
EFI_STATUS Status;
EFI_ATA_COMMAND_BLOCK Acb;
EFI_ATA_STATUS_BLOCK Asb;
if (Buffer == NULL) {
return EFI_INVALID_PARAMETER;
}
ZeroMem (&Acb, sizeof (EFI_ATA_COMMAND_BLOCK));
ZeroMem (&Asb, sizeof (EFI_ATA_STATUS_BLOCK));
Acb.AtaCommand = ATA_CMD_IDENTIFY_DRIVE;
Acb.AtaSectorCount = 1;
Status = AhciPioTransfer (
Private,
Port,
PortMultiplier,
FisIndex,
TRUE,
&Acb,
&Asb,
Buffer,
sizeof (ATA_IDENTIFY_DATA),
ATA_TIMEOUT
);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* The function is invoked before SMBASE relocation in S3 path. It does first time microcode load and restores MTRRs for both BSP and APs. */
|
VOID InitializeCpuBeforeRebase(IN BOOLEAN IsBsp)
|
/* The function is invoked before SMBASE relocation in S3 path. It does first time microcode load and restores MTRRs for both BSP and APs. */
VOID InitializeCpuBeforeRebase(IN BOOLEAN IsBsp)
|
{
LoadMtrrData (mAcpiCpuData.MtrrTable);
SetRegister (TRUE);
ProgramVirtualWireMode ();
if (!IsBsp) {
DisableLvtInterrupts ();
}
InterlockedDecrement (&mNumberToFinish);
if (IsBsp) {
while (mNumberToFinish > 0) {
CpuPause ();
}
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If @cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be set */
|
void g_file_input_stream_query_info_async(GFileInputStream *stream, const char *attributes, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
|
/* If @cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be set */
void g_file_input_stream_query_info_async(GFileInputStream *stream, const char *attributes, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
|
{
GFileInputStreamClass *klass;
GInputStream *input_stream;
GError *error = NULL;
g_return_if_fail (G_IS_FILE_INPUT_STREAM (stream));
input_stream = G_INPUT_STREAM (stream);
if (!g_input_stream_set_pending (input_stream, &error))
{
g_task_report_error (stream, callback, user_data,
g_file_input_stream_query_info_async,
error);
return;
}
klass = G_FILE_INPUT_STREAM_GET_CLASS (stream);
stream->priv->outstanding_callback = callback;
g_object_ref (stream);
klass->query_info_async (stream, attributes, io_priority, cancellable,
async_ready_callback_wrapper, user_data);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Set SWP Voltage Class @rmtoll OR CLASS LL_SWPMI_SetVoltageClass. */
|
void LL_SWPMI_SetVoltageClass(SWPMI_TypeDef *SWPMIx, uint32_t VoltageClass)
|
/* Set SWP Voltage Class @rmtoll OR CLASS LL_SWPMI_SetVoltageClass. */
void LL_SWPMI_SetVoltageClass(SWPMI_TypeDef *SWPMIx, uint32_t VoltageClass)
|
{
MODIFY_REG(SWPMIx->OR, SWPMI_OR_CLASS, VoltageClass);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* This file exports one global function: void mips_cpu_irq_init(void); */
|
static void unmask_mips_irq(unsigned int irq)
|
/* This file exports one global function: void mips_cpu_irq_init(void); */
static void unmask_mips_irq(unsigned int irq)
|
{
set_c0_status(0x100 << (irq - MIPS_CPU_IRQ_BASE));
irq_enable_hazard();
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Asynchronous version of g_subprocess_communicate_utf8(). Complete invocation with g_subprocess_communicate_utf8_finish(). */
|
void g_subprocess_communicate_utf8_async(GSubprocess *subprocess, const char *stdin_buf, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
|
/* Asynchronous version of g_subprocess_communicate_utf8(). Complete invocation with g_subprocess_communicate_utf8_finish(). */
void g_subprocess_communicate_utf8_async(GSubprocess *subprocess, const char *stdin_buf, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
|
{
GBytes *stdin_bytes;
size_t stdin_buf_len = 0;
g_return_if_fail (G_IS_SUBPROCESS (subprocess));
g_return_if_fail (stdin_buf == NULL || (subprocess->flags & G_SUBPROCESS_FLAGS_STDIN_PIPE));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
if (stdin_buf != NULL)
stdin_buf_len = strlen (stdin_buf);
stdin_bytes = g_bytes_new (stdin_buf, stdin_buf_len);
g_subprocess_communicate_internal (subprocess, TRUE, stdin_bytes, cancellable, callback, user_data);
g_bytes_unref (stdin_bytes);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Closes an endpoint of the low level driver. */
|
USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
/* Closes an endpoint of the low level driver. */
USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
{
HAL_StatusTypeDef hal_status = HAL_OK;
USBD_StatusTypeDef usb_status = USBD_OK;
hal_status = HAL_PCD_EP_Close(pdev->pData, ep_addr);
usb_status = USBD_Get_USB_Status(hal_status);
return usb_status;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Before you start, select your target, on the right of the "Load" button */
|
int main(void)
|
/* Before you start, select your target, on the right of the "Load" button */
int main(void)
|
{
sprintf(str, "%4d: %4d\n\r", TM_ADC_Read(ADC1, ADC_Channel_0), TM_ADC_Read(ADC1, ADC_Channel_3));
TM_USART_Puts(USART1, str);
Delayms(100);
}
}
|
MaJerle/stm32f429
|
C++
| null | 2,036
|
/* Enables a GPIO pin as a trigger to start an ADC capture. */
|
void GPIOADCTriggerEnable(uint32_t ui32Port, uint8_t ui8Pins)
|
/* Enables a GPIO pin as a trigger to start an ADC capture. */
void GPIOADCTriggerEnable(uint32_t ui32Port, uint8_t ui8Pins)
|
{
ASSERT(_GPIOBaseValid(ui32Port));
HWREGB(ui32Port + GPIO_O_ADCCTL) |= ui8Pins;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Try to convert a value to a float. The float case is already handled by the macro 'tonumber'. */
|
int luaV_tonumber_(const TValue *obj, lua_Number *n)
|
/* Try to convert a value to a float. The float case is already handled by the macro 'tonumber'. */
int luaV_tonumber_(const TValue *obj, lua_Number *n)
|
{
*n = cast_num(ivalue(obj));
return 1;
}
else if (l_strton(obj, &v)) {
*n = nvalue(&v);
return 1;
}
else
return 0;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Free-fall duration event. 1LSb = 1 / ODR. */
|
int32_t lsm6dso_ff_dur_get(lsm6dso_ctx_t *ctx, uint8_t *val)
|
/* Free-fall duration event. 1LSb = 1 / ODR. */
int32_t lsm6dso_ff_dur_get(lsm6dso_ctx_t *ctx, uint8_t *val)
|
{
lsm6dso_wake_up_dur_t wake_up_dur;
lsm6dso_free_fall_t free_fall;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_WAKE_UP_DUR, (uint8_t*)&wake_up_dur, 1);
if (ret == 0) {
ret = lsm6dso_read_reg(ctx, LSM6DSO_FREE_FALL, (uint8_t*)&free_fall, 1);
*val = (wake_up_dur.ff_dur << 5) + free_fall.ff_dur;
}
return ret;
}
|
alexander-g-dean/ESF
|
C++
| null | 41
|
/* Configure the packet.
See the data sheet for details. */
|
void radio_configure_packet(uint8_t lf_len_bits, uint8_t s0_len_bytes, uint8_t s1_len_bits)
|
/* Configure the packet.
See the data sheet for details. */
void radio_configure_packet(uint8_t lf_len_bits, uint8_t s0_len_bytes, uint8_t s1_len_bits)
|
{
RADIO_PCNF0 = RADIO_PCNF0_LFLEN_MASKED(lf_len_bits)
| RADIO_PCNF0_S0LEN_MASKED(s0_len_bytes)
| RADIO_PCNF0_S1LEN_MASKED(s1_len_bits);
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* USBH_TEMPLATE_Process The function is for managing state machine for TEMPLATE data transfers. */
|
static USBH_StatusTypeDef USBH_TEMPLATE_Process(USBH_HandleTypeDef *phost)
|
/* USBH_TEMPLATE_Process The function is for managing state machine for TEMPLATE data transfers. */
static USBH_StatusTypeDef USBH_TEMPLATE_Process(USBH_HandleTypeDef *phost)
|
{
UNUSED(phost);
return USBH_OK;
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* get a directory entry. Note that the caller is responsible for holding the relevant locks. */
|
static int __adfs_dir_get(struct adfs_dir *dir, int pos, struct object_info *obj)
|
/* get a directory entry. Note that the caller is responsible for holding the relevant locks. */
static int __adfs_dir_get(struct adfs_dir *dir, int pos, struct object_info *obj)
|
{
struct super_block *sb = dir->sb;
struct adfs_direntry de;
int thissize, buffer, offset;
buffer = pos >> sb->s_blocksize_bits;
if (buffer > dir->nr_buffers)
return -EINVAL;
offset = pos & (sb->s_blocksize - 1);
thissize = sb->s_blocksize - offset;
if (thissize > 26)
thissize = 26;
memcpy(&de, dir->bh[buffer]->b_data + offset, thissize);
if (thissize != 26)
memcpy(((char *)&de) + thissize, dir->bh[buffer + 1]->b_data,
26 - thissize);
if (!de.dirobname[0])
return -ENOENT;
adfs_dir2obj(obj, &de);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This routine is used to initialize the bar of a PCI device. */
|
VOID InitializePciDevice(IN PCI_IO_DEVICE *PciIoDevice)
|
/* This routine is used to initialize the bar of a PCI device. */
VOID InitializePciDevice(IN PCI_IO_DEVICE *PciIoDevice)
|
{
EFI_PCI_IO_PROTOCOL *PciIo;
UINT8 Offset;
PciIo = &(PciIoDevice->PciIo);
for (Offset = 0x10; Offset <= 0x24; Offset += sizeof (UINT32)) {
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, Offset, 1, &gAllOne);
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* returns 0 on success, < 0 on failure */
|
static int __devinit gelic_card_alloc_rx_skbs(struct gelic_card *card)
|
/* returns 0 on success, < 0 on failure */
static int __devinit gelic_card_alloc_rx_skbs(struct gelic_card *card)
|
{
struct gelic_descr_chain *chain;
int ret;
chain = &card->rx_chain;
ret = gelic_card_fill_rx_chain(card);
chain->tail = card->rx_top->prev;
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Functions for getting the pages from kernel memory. */
|
static void km_get_page(struct dpages *dp, struct page **p, unsigned long *len, unsigned *offset)
|
/* Functions for getting the pages from kernel memory. */
static void km_get_page(struct dpages *dp, struct page **p, unsigned long *len, unsigned *offset)
|
{
*p = virt_to_page(dp->context_ptr);
*offset = dp->context_u;
*len = PAGE_SIZE - dp->context_u;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* switch in system clock out of ISR context. */
|
static void SwitchSystemClock(void)
|
/* switch in system clock out of ISR context. */
static void SwitchSystemClock(void)
|
{
if (__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSI)
{
SystemClockHSEbypass_Config();
}
else if (__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSE)
{
SystemClockHSI_Config();
}
SwitchClock = RESET;
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Configure the QSPI peripheral according to the specified parameters in the qspiConfig. */
|
void QSPI_Config(QSPI_Config_T *qspiConfig)
|
/* Configure the QSPI peripheral according to the specified parameters in the qspiConfig. */
void QSPI_Config(QSPI_Config_T *qspiConfig)
|
{
QSPI->CTRL1_B.CPHA = qspiConfig->clockPhase;
QSPI->CTRL1_B.CPOL = qspiConfig->clockPolarity;
QSPI->CTRL1_B.FRF = qspiConfig->frameFormat;
QSPI->CTRL1_B.DFS = qspiConfig->dataFrameSize;;
QSPI->CTRL1_B.SSTEN = qspiConfig->selectSlaveToggle;
QSPI->BR = qspiConfig->clockDiv;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Removes all keys and values from the #GTree and decreases its reference count by one. If keys and/or values are dynamically allocated, you should either free them first or create the #GTree using g_tree_new_full(). In the latter case the destroy functions you supplied will be called on all keys and values before destroying the #GTree. */
|
void g_tree_destroy(GTree *tree)
|
/* Removes all keys and values from the #GTree and decreases its reference count by one. If keys and/or values are dynamically allocated, you should either free them first or create the #GTree using g_tree_new_full(). In the latter case the destroy functions you supplied will be called on all keys and values before destroying the #GTree. */
void g_tree_destroy(GTree *tree)
|
{
g_return_if_fail (tree != NULL);
g_tree_remove_all (tree);
g_tree_unref (tree);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Implement PR_CAPBSET_DROP. Attempt to remove the specified capability from the current task's bounding set. Returns 0 on success, -ve on error. */
|
static long cap_prctl_drop(struct cred *new, unsigned long cap)
|
/* Implement PR_CAPBSET_DROP. Attempt to remove the specified capability from the current task's bounding set. Returns 0 on success, -ve on error. */
static long cap_prctl_drop(struct cred *new, unsigned long cap)
|
{
if (!capable(CAP_SETPCAP))
return -EPERM;
if (!cap_valid(cap))
return -EINVAL;
cap_lower(new->cap_bset, cap);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* We're addressing a 16-bit peripheral which transfers odd addresses on the high ISA byte lane. */
|
u8 __inb16(unsigned int port)
|
/* We're addressing a 16-bit peripheral which transfers odd addresses on the high ISA byte lane. */
u8 __inb16(unsigned int port)
|
{
unsigned int offset;
if (SUPERIO_PORT(port))
offset = port << 2;
else
offset = (port & ~1) << 1 | (port & 1);
return __raw_readb((void __iomem *)ISAIO_BASE + offset);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Here the chapter D F9-field of the system-journal is decoded. */
|
static int decode_sj_chapter_d_f9(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset)
|
/* Here the chapter D F9-field of the system-journal is decoded. */
static int decode_sj_chapter_d_f9(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset)
|
{
proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_count, tvb, offset, 1, ENC_BIG_ENDIAN );
offset++;
f9length--;
}
if ( f9flags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_L ) {
proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_legal, tvb, offset, f9length, ENC_NA );
offset += f9length;
f9length = 0;
}
if ( f9length > 0 ) {
proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_data, tvb, offset, f9length, ENC_NA );
offset += f9length;
}
return offset-start_offset;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* If @old was empty, it will be overwritten. */
|
static void list_replace(struct list_head *old, struct list_head *new)
|
/* If @old was empty, it will be overwritten. */
static void list_replace(struct list_head *old, struct list_head *new)
|
{
new->next = old->next;
new->next->prev = new;
new->prev = old->prev;
new->prev->next = new;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Return code 0 - driver suspended the device Error otherwise */
|
static int lpfc_pci_suspend_one(struct pci_dev *pdev, pm_message_t msg)
|
/* Return code 0 - driver suspended the device Error otherwise */
static int lpfc_pci_suspend_one(struct pci_dev *pdev, pm_message_t msg)
|
{
struct Scsi_Host *shost = pci_get_drvdata(pdev);
struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
int rc = -ENODEV;
switch (phba->pci_dev_grp) {
case LPFC_PCI_DEV_LP:
rc = lpfc_pci_suspend_one_s3(pdev, msg);
break;
case LPFC_PCI_DEV_OC:
rc = lpfc_pci_suspend_one_s4(pdev, msg);
break;
default:
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"1425 Invalid PCI device group: 0x%x\n",
phba->pci_dev_grp);
break;
}
return rc;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* USBH_MTP_IsReady Select the storage Unit to be used. */
|
uint8_t USBH_MTP_IsReady(USBH_HandleTypeDef *phost)
|
/* USBH_MTP_IsReady Select the storage Unit to be used. */
uint8_t USBH_MTP_IsReady(USBH_HandleTypeDef *phost)
|
{
MTP_HandleTypeDef *MTP_Handle = (MTP_HandleTypeDef *)phost->pActiveClass->pData;
return (MTP_Handle->is_ready);
}
|
labapart/polymcu
|
C++
| null | 201
|
/* atari_register_vme_int() returns the number of a free interrupt vector for hardware with a programmable int vector (probably a VME board). */
|
unsigned long atari_register_vme_int(void)
|
/* atari_register_vme_int() returns the number of a free interrupt vector for hardware with a programmable int vector (probably a VME board). */
unsigned long atari_register_vme_int(void)
|
{
int i;
for (i = 0; i < 32; i++)
if ((free_vme_vec_bitmap & (1 << i)) == 0)
break;
if (i == 16)
return 0;
free_vme_vec_bitmap |= 1 << i;
return VME_SOURCE_BASE + i;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* We in fact take an additional increment on ->b_count as a convenience, because the caller usually wants to do additional things with the bh after calling here. The caller of jbd2_journal_remove_journal_head() */
|
void jbd2_journal_remove_journal_head(struct buffer_head *bh)
|
/* We in fact take an additional increment on ->b_count as a convenience, because the caller usually wants to do additional things with the bh after calling here. The caller of jbd2_journal_remove_journal_head() */
void jbd2_journal_remove_journal_head(struct buffer_head *bh)
|
{
jbd_lock_bh_journal_head(bh);
__journal_remove_journal_head(bh);
jbd_unlock_bh_journal_head(bh);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This routine does path mtu discovery as defined in RFC1191. */
|
static void dccp_do_pmtu_discovery(struct sock *sk, const struct iphdr *iph, u32 mtu)
|
/* This routine does path mtu discovery as defined in RFC1191. */
static void dccp_do_pmtu_discovery(struct sock *sk, const struct iphdr *iph, u32 mtu)
|
{
struct dst_entry *dst;
const struct inet_sock *inet = inet_sk(sk);
const struct dccp_sock *dp = dccp_sk(sk);
if (sk->sk_state == DCCP_LISTEN)
return;
if ((dst = __sk_dst_check(sk, 0)) == NULL)
return;
dst->ops->update_pmtu(dst, mtu);
if (mtu < dst_mtu(dst) && ip_dont_fragment(sk, dst))
sk->sk_err_soft = EMSGSIZE;
mtu = dst_mtu(dst);
if (inet->pmtudisc != IP_PMTUDISC_DONT &&
inet_csk(sk)->icsk_pmtu_cookie > mtu) {
dccp_sync_mss(sk, mtu);
dccp_send_sync(sk, dp->dccps_gsr, DCCP_PKT_SYNC);
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Therefore we do two reads. The first time we write 0 to the (read-only) register before reading and the second time we write 0xff first. If the two reads do not match or they read back as 0xff or 0x00 then we have version 1 hardware. */
|
static u8 viper_hw_version(void)
|
/* Therefore we do two reads. The first time we write 0 to the (read-only) register before reading and the second time we write 0xff first. If the two reads do not match or they read back as 0xff or 0x00 then we have version 1 hardware. */
static u8 viper_hw_version(void)
|
{
u8 v1, v2;
unsigned long flags;
local_irq_save(flags);
VIPER_VERSION = 0;
v1 = VIPER_VERSION;
VIPER_VERSION = 0xff;
v2 = VIPER_VERSION;
v1 = (v1 != v2 || v1 == 0xff) ? 0 : v1;
local_irq_restore(flags);
return v1;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Performs basic configuration of the adapter. hw - Struct containing variables accessed by shared code Assumes that the controller has previously been reset and is in a post-reset uninitialized state. Initializes multicast table, and Calls routines to setup link Leaves the transmit and receive units disabled and uninitialized. */
|
static s32 atl1_init_hw(struct atl1_hw *hw)
|
/* Performs basic configuration of the adapter. hw - Struct containing variables accessed by shared code Assumes that the controller has previously been reset and is in a post-reset uninitialized state. Initializes multicast table, and Calls routines to setup link Leaves the transmit and receive units disabled and uninitialized. */
static s32 atl1_init_hw(struct atl1_hw *hw)
|
{
u32 ret_val = 0;
iowrite32(0, hw->hw_addr + REG_RX_HASH_TABLE);
iowrite32(0, (hw->hw_addr + REG_RX_HASH_TABLE) + (1 << 2));
atl1_init_flash_opcode(hw);
if (!hw->phy_configured) {
ret_val = atl1_write_phy_reg(hw, 18, 0xC00);
if (ret_val)
return ret_val;
ret_val = atl1_phy_leave_power_saving(hw);
if (ret_val)
return ret_val;
ret_val = atl1_setup_link(hw);
}
return ret_val;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Converts a text device path node to ACPI HID device path structure. */
|
EFI_DEVICE_PATH_PROTOCOL* ConvertFromTextAcpi(IN CHAR16 *TextDeviceNode, IN UINT32 PnPId)
|
/* Converts a text device path node to ACPI HID device path structure. */
EFI_DEVICE_PATH_PROTOCOL* ConvertFromTextAcpi(IN CHAR16 *TextDeviceNode, IN UINT32 PnPId)
|
{
CHAR16 *UIDStr;
ACPI_HID_DEVICE_PATH *Acpi;
UIDStr = GetNextParamStr (&TextDeviceNode);
Acpi = (ACPI_HID_DEVICE_PATH *)CreateDeviceNode (
ACPI_DEVICE_PATH,
ACPI_DP,
(UINT16)sizeof (ACPI_HID_DEVICE_PATH)
);
Acpi->HID = EFI_PNP_ID (PnPId);
Acpi->UID = (UINT32)Strtoi (UIDStr);
return (EFI_DEVICE_PATH_PROTOCOL *)Acpi;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Pass control to next thread that is in READY state. */
|
osStatus_t osThreadYield(void)
|
/* Pass control to next thread that is in READY state. */
osStatus_t osThreadYield(void)
|
{
if (k_is_in_isr()) {
return osErrorISR;
}
k_yield();
return osOK;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Enables or disables the adc injected channels conversion through external trigger. */
|
void ADC_ExternalTrigInjectedConvCmd(ADC_TypeDef *adc, FunctionalState state)
|
/* Enables or disables the adc injected channels conversion through external trigger. */
void ADC_ExternalTrigInjectedConvCmd(ADC_TypeDef *adc, FunctionalState state)
|
{
(state) ? (adc->ANYCR |= ADC_ANY_CR_JTRGEN) : (adc->ANYCR &= ~ADC_ANY_CR_JTRGEN);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This allows us to split the item in place, keeping a lock on the leaf the entire time. */
|
int btrfs_split_item(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_path *path, struct btrfs_key *new_key, unsigned long split_offset)
|
/* This allows us to split the item in place, keeping a lock on the leaf the entire time. */
int btrfs_split_item(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_path *path, struct btrfs_key *new_key, unsigned long split_offset)
|
{
int ret;
ret = setup_leaf_for_split(trans, root, path,
sizeof(struct btrfs_item));
if (ret)
return ret;
ret = split_item(trans, root, path, new_key, split_offset);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* 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)));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Convert UINT64 data of the FDT blob to little-endian */
|
UINT64 EFIAPI Fdt64ToCpu(IN UINT64 Value)
|
/* Convert UINT64 data of the FDT blob to little-endian */
UINT64 EFIAPI Fdt64ToCpu(IN UINT64 Value)
|
{
return fdt64_to_cpu (Value);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* wps_is_20 - Check whether WPS attributes claim support for WPS 2.0 */
|
int wps_is_20(const struct wpabuf *msg)
|
/* wps_is_20 - Check whether WPS attributes claim support for WPS 2.0 */
int wps_is_20(const struct wpabuf *msg)
|
{
struct wps_parse_attr *attr;
int ret;
attr = (struct wps_parse_attr *)os_zalloc(sizeof(struct wps_parse_attr));
if (attr == NULL)
return 0;
if (msg == NULL || wps_parse_msg(msg, attr) < 0) {
ret = 0;
} else {
ret = (attr->version2 != NULL);
}
os_free(attr);
return ret;
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* Configures PWM a channel with the given parameters. The PWM controller must have been clocked in the PMC prior to calling this function. */
|
void PWMC_ConfigureChannel(unsigned char channel, unsigned int prescaler, unsigned int alignment, unsigned int polarity)
|
/* Configures PWM a channel with the given parameters. The PWM controller must have been clocked in the PMC prior to calling this function. */
void PWMC_ConfigureChannel(unsigned char channel, unsigned int prescaler, unsigned int alignment, unsigned int polarity)
|
{
SANITY_CHECK(prescaler < AT91C_PWMC_CPRE_MCKB);
SANITY_CHECK((alignment & ~AT91C_PWMC_CALG) == 0);
SANITY_CHECK((polarity & ~AT91C_PWMC_CPOL) == 0);
AT91C_BASE_PWMC->PWMC_DIS = 1 << channel;
AT91C_BASE_PWMC->PWMC_CH[channel].PWMC_CMR = prescaler | alignment | polarity;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Check whether the provided memory range is covered by a single entry of type EfiGcdSystemMemory in the GCD memory map. */
|
STATIC BOOLEAN RegionIsSystemMemory(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length)
|
/* Check whether the provided memory range is covered by a single entry of type EfiGcdSystemMemory in the GCD memory map. */
STATIC BOOLEAN RegionIsSystemMemory(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length)
|
{
EFI_GCD_MEMORY_SPACE_DESCRIPTOR GcdDescriptor;
EFI_PHYSICAL_ADDRESS GcdEndAddress;
EFI_STATUS Status;
Status = gDS->GetMemorySpaceDescriptor (BaseAddress, &GcdDescriptor);
if (EFI_ERROR (Status) ||
(GcdDescriptor.GcdMemoryType != EfiGcdMemoryTypeSystemMemory))
{
return FALSE;
}
GcdEndAddress = GcdDescriptor.BaseAddress + GcdDescriptor.Length;
return GcdEndAddress >= (BaseAddress + Length);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This interface conveys state information out of the Security (SEC) phase into PEI. */
|
EFI_STATUS EFIAPI SecPlatformInformationPostMemory(IN CONST EFI_PEI_SERVICES **PeiServices, IN OUT UINT64 *StructureSize, OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord)
|
/* This interface conveys state information out of the Security (SEC) phase into PEI. */
EFI_STATUS EFIAPI SecPlatformInformationPostMemory(IN CONST EFI_PEI_SERVICES **PeiServices, IN OUT UINT64 *StructureSize, OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord)
|
{
SEC_PLATFORM_INFORMATION_CONTEXT_HOB *SecPlatformInformationContexHob;
if (StructureSize == NULL) {
return EFI_INVALID_PARAMETER;
}
SecPlatformInformationContexHob = GetFirstGuidHob (&gEfiCallerIdGuid);
if (SecPlatformInformationContexHob == NULL) {
return EFI_NOT_FOUND;
}
if (*StructureSize < SecPlatformInformationContexHob->Context.StructureSize) {
*StructureSize = SecPlatformInformationContexHob->Context.StructureSize;
return EFI_BUFFER_TOO_SMALL;
}
if (PlatformInformationRecord == NULL) {
return EFI_INVALID_PARAMETER;
}
*StructureSize = SecPlatformInformationContexHob->Context.StructureSize;
CopyMem (
(VOID *)PlatformInformationRecord,
(VOID *)SecPlatformInformationContexHob->Context.PlatformInformationRecord,
(UINTN)SecPlatformInformationContexHob->Context.StructureSize
);
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns the slot id for a device that resides inside an enclosure. */
|
static int _transport_get_bay_identifier(struct sas_rphy *rphy)
|
/* Returns the slot id for a device that resides inside an enclosure. */
static int _transport_get_bay_identifier(struct sas_rphy *rphy)
|
{
struct MPT2SAS_ADAPTER *ioc = rphy_to_ioc(rphy);
struct _sas_device *sas_device;
unsigned long flags;
spin_lock_irqsave(&ioc->sas_device_lock, flags);
sas_device = mpt2sas_scsih_sas_device_find_by_sas_address(ioc,
rphy->identify.sas_address);
spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
if (!sas_device)
return -ENXIO;
return sas_device->slot;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Return true if two symbols are the same. */
|
PRIVATE int same_symbol(struct symbol *a, struct symbol *b)
|
/* Return true if two symbols are the same. */
PRIVATE int same_symbol(struct symbol *a, struct symbol *b)
|
{
int i;
if( a==b ) return 1;
if( a->type!=MULTITERMINAL ) return 0;
if( b->type!=MULTITERMINAL ) return 0;
if( a->nsubsym!=b->nsubsym ) return 0;
for(i=0; i<a->nsubsym; i++){
if( a->subsym[i]!=b->subsym[i] ) return 0;
}
return 1;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Insert character into the screen at the current position with the current color and highlight. This function does NOT do cursor movement. */
|
static void tty3270_put_character(struct tty3270 *tp, char ch)
|
/* Insert character into the screen at the current position with the current color and highlight. This function does NOT do cursor movement. */
static void tty3270_put_character(struct tty3270 *tp, char ch)
|
{
struct tty3270_line *line;
struct tty3270_cell *cell;
line = tp->screen + tp->cy;
if (line->len <= tp->cx) {
while (line->len < tp->cx) {
cell = line->cells + line->len;
cell->character = tp->view.ascebc[' '];
cell->highlight = tp->highlight;
cell->f_color = tp->f_color;
line->len++;
}
line->len++;
}
cell = line->cells + tp->cx;
cell->character = tp->view.ascebc[(unsigned int) ch];
cell->highlight = tp->highlight;
cell->f_color = tp->f_color;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This helper uses call_dissector_only which will NOT call the default "data" dissector if the packet was rejected. Our caller is responsible to call the data dissector explicitly in case this function returns FALSE. */
|
gboolean try_conversation_dissector(const address *addr_a, const address *addr_b, const port_type ptype, const guint32 port_a, const guint32 port_b, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
/* This helper uses call_dissector_only which will NOT call the default "data" dissector if the packet was rejected. Our caller is responsible to call the data dissector explicitly in case this function returns FALSE. */
gboolean try_conversation_dissector(const address *addr_a, const address *addr_b, const port_type ptype, const guint32 port_a, const guint32 port_b, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
{
conversation_t *conversation;
conversation = find_conversation(pinfo->num, addr_a, addr_b, ptype, port_a,
port_b, 0);
if (conversation != NULL) {
int ret;
dissector_handle_t handle = (dissector_handle_t)wmem_tree_lookup32_le(conversation->dissector_tree, pinfo->num);
if (handle == NULL)
return FALSE;
ret=call_dissector_only(handle, tvb, pinfo, tree, data);
if(!ret) {
return FALSE;
}
return TRUE;
}
return FALSE;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This function assumes: dst is 8 byte aligned src is unaligned stirde is a multiple of 8 rounding is ignored */
|
void interpolate8x8_halfpel_add_altivec_c(uint8_t *dst, const uint8_t *src, const uint32_t stride, const uint32_t rouding)
|
/* This function assumes: dst is 8 byte aligned src is unaligned stirde is a multiple of 8 rounding is ignored */
void interpolate8x8_halfpel_add_altivec_c(uint8_t *dst, const uint8_t *src, const uint32_t stride, const uint32_t rouding)
|
{
interpolate8x8_avg2_altivec_c(dst, dst, src, stride, 0, 8);
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* vxge_ethtool_setpause_data - set/reset pause frame generation. @dev : device pointer. @ep : pointer to the structure with pause parameters given by ethtool. Description: It can be used to set or reset Pause frame generation or reception support of the NIC. Return value: int, returns 0 on Success */
|
static int vxge_ethtool_setpause_data(struct net_device *dev, struct ethtool_pauseparam *ep)
|
/* vxge_ethtool_setpause_data - set/reset pause frame generation. @dev : device pointer. @ep : pointer to the structure with pause parameters given by ethtool. Description: It can be used to set or reset Pause frame generation or reception support of the NIC. Return value: int, returns 0 on Success */
static int vxge_ethtool_setpause_data(struct net_device *dev, struct ethtool_pauseparam *ep)
|
{
struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
struct __vxge_hw_device *hldev = (struct __vxge_hw_device *)
pci_get_drvdata(vdev->pdev);
vxge_hw_device_setpause_data(hldev, 0, ep->tx_pause, ep->rx_pause);
vdev->config.tx_pause_enable = ep->tx_pause;
vdev->config.rx_pause_enable = ep->rx_pause;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Initializes an USB device endpoint configuration structure to defaults.
The default configuration is as follows: */
|
void usb_device_endpoint_get_config_defaults(struct usb_device_endpoint_config *ep_config)
|
/* Initializes an USB device endpoint configuration structure to defaults.
The default configuration is as follows: */
void usb_device_endpoint_get_config_defaults(struct usb_device_endpoint_config *ep_config)
|
{
Assert(ep_config);
ep_config->ep_address = 0;
ep_config->ep_size = USB_ENDPOINT_8_BYTE;
ep_config->auto_zlp = false;
ep_config->ep_type = USB_DEVICE_ENDPOINT_TYPE_CONTROL;
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Auxiliary function for checking event bit inside given flags value.
Function used here to check presence of the event inside given flags value. It transforms given event to bit possition and then checks if in given variable it is cleared. */
|
static bool nrf_drv_twis_check_bit(uint32_t flags, nrf_twis_event_t ev)
|
/* Auxiliary function for checking event bit inside given flags value.
Function used here to check presence of the event inside given flags value. It transforms given event to bit possition and then checks if in given variable it is cleared. */
static bool nrf_drv_twis_check_bit(uint32_t flags, nrf_twis_event_t ev)
|
{
return 0 != (flags & (1U<<nrf_drv_event_to_bitpos(ev)));
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Init the first element of a channel in quantized_coeffs with data from packet 10 (quantized_coeffs). This is similar to process_subpacket_9, but for a single channel and for element same VLC tables as process_subpacket_9 are used. */
|
static void init_quantized_coeffs_elem0(int8_t *quantized_coeffs, GetBitContext *gb, int length)
|
/* Init the first element of a channel in quantized_coeffs with data from packet 10 (quantized_coeffs). This is similar to process_subpacket_9, but for a single channel and for element same VLC tables as process_subpacket_9 are used. */
static void init_quantized_coeffs_elem0(int8_t *quantized_coeffs, GetBitContext *gb, int length)
|
{
int i, k, run, level, diff;
if (BITS_LEFT(length,gb) < 16)
return;
level = qdm2_get_vlc(gb, &vlc_tab_level, 0, 2);
quantized_coeffs[0] = level;
for (i = 0; i < 7; ) {
if (BITS_LEFT(length,gb) < 16)
break;
run = qdm2_get_vlc(gb, &vlc_tab_run, 0, 1) + 1;
if (BITS_LEFT(length,gb) < 16)
break;
diff = qdm2_get_se_vlc(&vlc_tab_diff, gb, 2);
for (k = 1; k <= run; k++)
quantized_coeffs[i + k] = (level + ((k * diff) / run));
level += diff;
i += run;
}
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* If the cached PEI Services Table pointer is NULL, then ASSERT(). */
|
CONST EFI_PEI_SERVICES** EFIAPI GetPeiServicesTablePointer(VOID)
|
/* If the cached PEI Services Table pointer is NULL, then ASSERT(). */
CONST EFI_PEI_SERVICES** EFIAPI GetPeiServicesTablePointer(VOID)
|
{
mPeiServicesPointer = &mPeiServices;
return (CONST EFI_PEI_SERVICES **)&mPeiServicesPointer;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully enumerated by the host and is now ready to be used by the application. */
|
void EVENT_USB_Host_DeviceEnumerationComplete(void)
|
/* Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully enumerated by the host and is now ready to be used by the application. */
void EVENT_USB_Host_DeviceEnumerationComplete(void)
|
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
if (ProcessConfigurationDescriptor() != SuccessfulConfigRead)
{
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
return;
}
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
{
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
return;
}
LEDs_SetAllLEDs(LEDMASK_USB_READY);
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* Return the next free slob block pointer after this one. */
|
static slob_t* slob_next(slob_t *s)
|
/* Return the next free slob block pointer after this one. */
static slob_t* slob_next(slob_t *s)
|
{
slob_t *base = (slob_t *)((unsigned long)s & PAGE_MASK);
slobidx_t next;
if (s[0].units < 0)
next = -s[0].units;
else
next = s[1].units;
return base+next;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Description: Looks up the scsi_device with the specified @lun for a given @starget. The returned scsi_device has an additional reference that needs to be released with scsi_device_put once you're done with it. */
|
struct scsi_device* scsi_device_lookup_by_target(struct scsi_target *starget, uint lun)
|
/* Description: Looks up the scsi_device with the specified @lun for a given @starget. The returned scsi_device has an additional reference that needs to be released with scsi_device_put once you're done with it. */
struct scsi_device* scsi_device_lookup_by_target(struct scsi_target *starget, uint lun)
|
{
struct scsi_device *sdev;
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
unsigned long flags;
spin_lock_irqsave(shost->host_lock, flags);
sdev = __scsi_device_lookup_by_target(starget, lun);
if (sdev && scsi_device_get(sdev))
sdev = NULL;
spin_unlock_irqrestore(shost->host_lock, flags);
return sdev;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param base MCAN peripheral base address. param config The transmit buffer configuration structure. */
|
void MCAN_SetTxBufferConfig(CAN_Type *base, const mcan_tx_buffer_config_t *config)
|
/* param base MCAN peripheral base address. param config The transmit buffer configuration structure. */
void MCAN_SetTxBufferConfig(CAN_Type *base, const mcan_tx_buffer_config_t *config)
|
{
assert((config->dedicatedSize + config->fqSize) <= 32U);
base->TXBC |= CAN_TXBC_TBSA(config->address >> CAN_TXBC_TBSA_SHIFT) | CAN_TXBC_NDTB(config->dedicatedSize) |
CAN_TXBC_TFQS(config->fqSize) | CAN_TXBC_TFQM(config->mode);
base->TXESC |= CAN_TXESC_TBDS(config->datafieldSize);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param base DMA peripheral base address. param channel DMA channel number. return The number of bytes which have not been transferred yet. */
|
uint32_t DMA_GetRemainingBytes(DMA_Type *base, uint32_t channel)
|
/* param base DMA peripheral base address. param channel DMA channel number. return The number of bytes which have not been transferred yet. */
uint32_t DMA_GetRemainingBytes(DMA_Type *base, uint32_t channel)
|
{
assert(FSL_FEATURE_DMA_NUMBER_OF_CHANNELSn(base) != -1);
assert(channel < (uint32_t)FSL_FEATURE_DMA_NUMBER_OF_CHANNELSn(base));
if ((!DMA_ChannelIsActive(base, channel)) &&
(0x3FFUL == ((base->CHANNEL[channel].XFERCFG & DMA_CHANNEL_XFERCFG_XFERCOUNT_MASK) >>
DMA_CHANNEL_XFERCFG_XFERCOUNT_SHIFT)))
{
return 0UL;
}
return ((base->CHANNEL[channel].XFERCFG & DMA_CHANNEL_XFERCFG_XFERCOUNT_MASK) >>
DMA_CHANNEL_XFERCFG_XFERCOUNT_SHIFT) +
1UL;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Output: void, but we will add to proto tree if !NULL. */
|
static void dissect_hello_local_mtu_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int length)
|
/* Output: void, but we will add to proto tree if !NULL. */
static void dissect_hello_local_mtu_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int length)
|
{
if (length < 4) {
proto_tree_add_expert_format(tree, pinfo, &ei_nlsp_short_packet, tvb, offset, -1,
"Short link info entry");
return;
}
proto_tree_add_item(tree, hf_nlsp_hello_local_mtu_mtu_size, tvb, offset, 4, ENC_BIG_ENDIAN);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Get RX Data from rx data duplicate register. */
|
u32 SGPIO_GetRXData(SGPIO_TypeDef *SGPIOx)
|
/* Get RX Data from rx data duplicate register. */
u32 SGPIO_GetRXData(SGPIO_TypeDef *SGPIOx)
|
{
assert_param(IS_SGPIO_ALL_PERIPH(SGPIOx));
return SGPIOx->SGPIO_RXDATA_DP;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Convert kernel virtual addresses to physical addresses so they don't potentially conflict with the chip addresses used as mmap offsets. It doesn't really matter what mmap offset we use as long as we can interpret it correctly. */
|
static u64 cvt_kvaddr(void *p)
|
/* Convert kernel virtual addresses to physical addresses so they don't potentially conflict with the chip addresses used as mmap offsets. It doesn't really matter what mmap offset we use as long as we can interpret it correctly. */
static u64 cvt_kvaddr(void *p)
|
{
struct page *page;
u64 paddr = 0;
page = vmalloc_to_page(p);
if (page)
paddr = page_to_pfn(page) << PAGE_SHIFT;
return paddr;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* In the case of a PHY power down to save power, or to turn off link during a driver unload, or wake on lan is not enabled, remove the link. */
|
static void e1000_power_down_phy_copper_ich8lan(struct e1000_hw *hw)
|
/* In the case of a PHY power down to save power, or to turn off link during a driver unload, or wake on lan is not enabled, remove the link. */
static void e1000_power_down_phy_copper_ich8lan(struct e1000_hw *hw)
|
{
if (!(hw->mac.ops.check_mng_mode(hw) ||
hw->phy.ops.check_reset_block(hw)))
e1000_power_down_phy_copper(hw);
return;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param base LPSPI peripheral address. param handle pointer to lpspi_slave_handle_t structure which stores the transfer state. */
|
void LPSPI_SlaveTransferAbort(LPSPI_Type *base, lpspi_slave_handle_t *handle)
|
/* param base LPSPI peripheral address. param handle pointer to lpspi_slave_handle_t structure which stores the transfer state. */
void LPSPI_SlaveTransferAbort(LPSPI_Type *base, lpspi_slave_handle_t *handle)
|
{
assert(handle);
LPSPI_DisableInterrupts(base, (uint32_t)kLPSPI_TxInterruptEnable | (uint32_t)kLPSPI_RxInterruptEnable);
LPSPI_Reset(base);
handle->state = (uint8_t)kLPSPI_Idle;
handle->txRemainingByteCount = 0U;
handle->rxRemainingByteCount = 0U;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Create all the ISA child devices on the ISA bus controller (PCI to ISA bridge). */
|
UINT32 SioCreateAllChildDevices(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath)
|
/* Create all the ISA child devices on the ISA bus controller (PCI to ISA bridge). */
UINT32 SioCreateAllChildDevices(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath)
|
{
UINT32 Index;
UINT32 ChildDeviceNumber;
EFI_STATUS Status;
ChildDeviceNumber = 0;
for (Index = 0; Index < ARRAY_SIZE (mDevicesInfo); Index++) {
Status = SioCreateChildDevice (
This,
Controller,
PciIo,
ParentDevicePath,
Index
);
if (!EFI_ERROR (Status)) {
ChildDeviceNumber++;
}
}
return ChildDeviceNumber;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
|
UINT32 EFIAPI PciSegmentWrite32(IN UINT64 Address, IN UINT32 Value)
|
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciSegmentWrite32(IN UINT64 Address, IN UINT32 Value)
|
{
UINTN Count;
PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioWrite32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), Value);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Notify an object about its style is modified */
|
void lv_obj_refresh_style(lv_obj_t *obj)
|
/* Notify an object about its style is modified */
void lv_obj_refresh_style(lv_obj_t *obj)
|
{
lv_obj_invalidate(obj);
obj->signal_cb(obj, LV_SIGNAL_STYLE_CHG, NULL);
lv_obj_invalidate(obj);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* pm8001_hw_event_ack_req- For PM8001,some events need to acknowage to FW. @pm8001_ha: our hba card information @Qnum: the outbound queue message number. @SEA: source of event to ack @port_id: port id. @phyId: phy id. */
|
static void pm8001_hw_event_ack_req(struct pm8001_hba_info *pm8001_ha, u32 Qnum, u32 SEA, u32 port_id, u32 phyId, u32 param0, u32 param1)
|
/* pm8001_hw_event_ack_req- For PM8001,some events need to acknowage to FW. @pm8001_ha: our hba card information @Qnum: the outbound queue message number. @SEA: source of event to ack @port_id: port id. @phyId: phy id. */
static void pm8001_hw_event_ack_req(struct pm8001_hba_info *pm8001_ha, u32 Qnum, u32 SEA, u32 port_id, u32 phyId, u32 param0, u32 param1)
|
{
struct hw_event_ack_req payload;
u32 opc = OPC_INB_SAS_HW_EVENT_ACK;
struct inbound_queue_table *circularQ;
memset((u8 *)&payload, 0, sizeof(payload));
circularQ = &pm8001_ha->inbnd_q_tbl[Qnum];
payload.tag = 1;
payload.sea_phyid_portid = cpu_to_le32(((SEA & 0xFFFF) << 8) |
((phyId & 0x0F) << 4) | (port_id & 0x0F));
payload.param0 = cpu_to_le32(param0);
payload.param1 = cpu_to_le32(param1);
mpi_build_cmd(pm8001_ha, circularQ, opc, &payload);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param base LPSPI peripheral address. param dummyData Data to be transferred when tx buffer is NULL. Note: This API has no effect when LPSPI in slave interrupt mode, because driver will set the TXMSK bit to 1 if txData is NULL, no data is loaded from transmit FIFO and output pin is tristated. */
|
void LPSPI_SetDummyData(LPSPI_Type *base, uint8_t dummyData)
|
/* param base LPSPI peripheral address. param dummyData Data to be transferred when tx buffer is NULL. Note: This API has no effect when LPSPI in slave interrupt mode, because driver will set the TXMSK bit to 1 if txData is NULL, no data is loaded from transmit FIFO and output pin is tristated. */
void LPSPI_SetDummyData(LPSPI_Type *base, uint8_t dummyData)
|
{
uint32_t instance = LPSPI_GetInstance(base);
g_lpspiDummyData[instance] = dummyData;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Configurate The WatchDog Timer(WDT)'s Timer Interval. This function is to configure The WatchDog Timer(WDT)'s Timer Interval. There are three factors to determine the Timer Interval, they are: */
|
void xWDTInit(unsigned long ulBase, unsigned long ulConfig, unsigned long ulReload)
|
/* Configurate The WatchDog Timer(WDT)'s Timer Interval. This function is to configure The WatchDog Timer(WDT)'s Timer Interval. There are three factors to determine the Timer Interval, they are: */
void xWDTInit(unsigned long ulBase, unsigned long ulConfig, unsigned long ulReload)
|
{
xASSERT(ulBase == xWDT_BASE);
xASSERT((ulConfig == WDT_INTERVAL_2_4T) ||
(ulConfig == WDT_INTERVAL_2_6T) ||
(ulConfig == WDT_INTERVAL_2_8T) ||
(ulConfig == WDT_INTERVAL_2_10T) ||
(ulConfig == WDT_INTERVAL_2_12T) ||
(ulConfig == WDT_INTERVAL_2_14T) ||
(ulConfig == WDT_INTERVAL_2_16T) ||
(ulConfig == WDT_INTERVAL_2_18T));
SysCtlKeyAddrUnlock();
xHWREG(WDT_WTCR) &= ~WDT_WTCR_WTE;
xHWREG(WDT_WTCR) &= ~WDT_WTCR_WTIS_M;
xHWREG(WDT_WTCR) |= ulReload;
SysCtlKeyAddrLock();
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* For example, an image four columns wide and sixteen scan lines tall would be arranged as follows (showing how the eight bytes of the image would appear on the display): */
|
void OSRAMImageDraw(const unsigned char *pucImage, unsigned long ulX, unsigned long ulY, unsigned long ulWidth, unsigned long ulHeight)
|
/* For example, an image four columns wide and sixteen scan lines tall would be arranged as follows (showing how the eight bytes of the image would appear on the display): */
void OSRAMImageDraw(const unsigned char *pucImage, unsigned long ulX, unsigned long ulY, unsigned long ulWidth, unsigned long ulHeight)
|
{
ASSERT(ulX < 96);
ASSERT(ulY < 2);
ASSERT((ulX + ulWidth) <= 96);
ASSERT((ulY + ulHeight) <= 2);
ulX += 36;
while(ulHeight--)
{
OSRAMWriteFirst(0x80);
OSRAMWriteByte((ulY == 0) ? 0xb0 : 0xb1);
OSRAMWriteByte(0x80);
OSRAMWriteByte(ulX & 0x0f);
OSRAMWriteByte(0x80);
OSRAMWriteByte(0x10 | ((ulX >> 4) & 0x0f));
OSRAMWriteByte(0x40);
OSRAMWriteArray(pucImage, ulWidth - 1);
OSRAMWriteFinal(pucImage[ulWidth - 1]);
pucImage += ulWidth;
ulY++;
}
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* The functions for inserting/removing us as a module. */
|
static int __init spaceorb_init(void)
|
/* The functions for inserting/removing us as a module. */
static int __init spaceorb_init(void)
|
{
return serio_register_driver(&spaceorb_drv);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function ensures that the corrupted node at @offs is the last thing written to a LEB. This function returns %1 if more data is not found and %0 if more data is found. */
|
static int no_more_nodes(const struct ubifs_info *c, void *buf, int len, int lnum, int offs)
|
/* This function ensures that the corrupted node at @offs is the last thing written to a LEB. This function returns %1 if more data is not found and %0 if more data is found. */
static int no_more_nodes(const struct ubifs_info *c, void *buf, int len, int lnum, int offs)
|
{
struct ubifs_ch *ch = buf;
int skip, dlen = le32_to_cpu(ch->len);
skip = ALIGN(offs + UBIFS_CH_SZ, c->min_io_size) - offs;
if (is_empty(buf + skip, len - skip))
return 1;
if (ubifs_check_node(c, buf, lnum, offs, 1, 0) != -EUCLEAN) {
dbg_rcvry("unexpected bad common header at %d:%d", lnum, offs);
return 0;
}
skip = ALIGN(offs + dlen, c->min_io_size) - offs;
if (is_empty(buf + skip, len - skip))
return 1;
dbg_rcvry("unexpected data at %d:%d", lnum, offs + skip);
return 0;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* update == 0 : just check if throttled data is available (any irq context) update == 1 : check and send throttled data to userspace (soft_irq context) */
|
static int bcm_rx_thr_flush(struct bcm_op *op, int update)
|
/* update == 0 : just check if throttled data is available (any irq context) update == 1 : check and send throttled data to userspace (soft_irq context) */
static int bcm_rx_thr_flush(struct bcm_op *op, int update)
|
{
int updated = 0;
if (op->nframes > 1) {
int i;
for (i = 1; i < op->nframes; i++)
updated += bcm_rx_do_flush(op, update, i);
} else {
updated += bcm_rx_do_flush(op, update, 0);
}
return updated;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Switch to X plate resistance mode. Set MX to ground, PX to supply. Measure current. */
|
static unsigned int ucb1x00_ts_read_xres(struct ucb1x00_ts *ts)
|
/* Switch to X plate resistance mode. Set MX to ground, PX to supply. Measure current. */
static unsigned int ucb1x00_ts_read_xres(struct ucb1x00_ts *ts)
|
{
ucb1x00_reg_write(ts->ucb, UCB_TS_CR,
UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW |
UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
return ucb1x00_adc_read(ts->ucb, 0, ts->adcsync);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.