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 |
|---|---|---|---|---|---|---|---|
/* Starts the TIMER Input Capture measurement in interrupt mode. */ | void ald_timer_ic_start_by_it(ald_timer_handle_t *hperh, ald_timer_channel_t ch) | /* Starts the TIMER Input Capture measurement in interrupt mode. */
void ald_timer_ic_start_by_it(ald_timer_handle_t *hperh, ald_timer_channel_t ch) | {
assert_param(IS_TIMER_CCX_INSTANCE(hperh->perh, ch));
switch (ch) {
case ALD_TIMER_CHANNEL_1:
ald_timer_interrupt_config(hperh, ALD_TIMER_IT_CC1, ENABLE);
break;
case ALD_TIMER_CHANNEL_2:
ald_timer_interrupt_config(hperh, ALD_TIMER_IT_CC2, ENABLE);
break;
case ALD_T... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, 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(). If OrData is larger than the bitmask val... | UINT8 EFIAPI PciBitFieldAndThenOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData, IN UINT8 OrData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, 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(). If OrData is larger than the bitmask val... | {
return PciCf8BitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Sets the baud rate, receive FIFO depth, transmit/receive time out, parity, data buts, and stop bits on a serial device. This call is optional as the serial port will be set up with defaults base on PCD values. */ | RETURN_STATUS EFIAPI GdbSerialInit(IN UINT64 BaudRate, IN UINT8 Parity, IN UINT8 DataBits, IN UINT8 StopBits) | /* Sets the baud rate, receive FIFO depth, transmit/receive time out, parity, data buts, and stop bits on a serial device. This call is optional as the serial port will be set up with defaults base on PCD values. */
RETURN_STATUS EFIAPI GdbSerialInit(IN UINT64 BaudRate, IN UINT8 Parity, IN UINT8 DataBits, IN UINT8 Stop... | {
UINTN Divisor;
UINT8 OutputData;
UINT8 Data;
UINT8 BreakSet = 0;
Data = (UINT8)(DataBits - (UINT8)5);
Divisor = 115200/(UINTN)BaudRate;
OutputData = (UINT8)((DLAB << 7) | ((BreakSet << 6) | ((Parity << 3) | ((StopBits << 2) | Data))));
IoWrite8 (gPort + LCR_OFFSET, OutputData);
IoWrite8 (gPort +... | tianocore/edk2 | C++ | Other | 4,240 |
/* Enable the FLASH Prefetch Buffer.
Note carefully the restrictions under which the prefetch buffer may be enabled or disabled. Prefetch is only available when 64-bit access is enabled. */ | void flash_prefetch_enable(void) | /* Enable the FLASH Prefetch Buffer.
Note carefully the restrictions under which the prefetch buffer may be enabled or disabled. Prefetch is only available when 64-bit access is enabled. */
void flash_prefetch_enable(void) | {
FLASH_ACR |= FLASH_ACR_PRFTEN;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* param base FlexCAN peripheral base address. param handle Pointer to flexcan_edma_handle_t structure. param callback The callback function. param userData The parameter of the callback function. param rxFifoEdmaHandle User-requested DMA handle for Rx FIFO DMA transfer. */ | void FLEXCAN_TransferCreateHandleEDMA(CAN_Type *base, flexcan_edma_handle_t *handle, flexcan_edma_transfer_callback_t callback, void *userData, edma_handle_t *rxFifoEdmaHandle) | /* param base FlexCAN peripheral base address. param handle Pointer to flexcan_edma_handle_t structure. param callback The callback function. param userData The parameter of the callback function. param rxFifoEdmaHandle User-requested DMA handle for Rx FIFO DMA transfer. */
void FLEXCAN_TransferCreateHandleEDMA(CAN_Ty... | {
assert(NULL != handle);
uint32_t instance = FLEXCAN_GetInstance(base);
s_flexcanEdmaPrivateHandle[instance].base = base;
s_flexcanEdmaPrivateHandle[instance].handle = handle;
(void)memset(handle, 0, sizeof(flexcan_edma_handle_t));
handle->rxFifoState = (uint8_t... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* If 8-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, 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(). If OrData is... | UINT8 EFIAPI S3MmioBitFieldAndThenOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData, IN UINT8 OrData) | /* If 8-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, 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(). If OrData is... | {
return InternalSaveMmioWrite8ValueToBootScript (Address, MmioBitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get the value of the packet count threshold for this driver/device. The packet count threshold is used for interrupt coalescing, which reduces the frequency of interrupts from the device to the processor. In this case, the scatter-gather DMA engine only interrupts when the packet count threshold is reached, instead ... | XStatus XEmac_GetPktThreshold(XEmac *InstancePtr, u32 Direction, u8 *ThreshPtr) | /* Get the value of the packet count threshold for this driver/device. The packet count threshold is used for interrupt coalescing, which reduces the frequency of interrupts from the device to the processor. In this case, the scatter-gather DMA engine only interrupts when the packet count threshold is reached, instead ... | {
XASSERT_NONVOID(InstancePtr != NULL);
XASSERT_NONVOID(Direction == XEM_SEND || Direction == XEM_RECV);
XASSERT_NONVOID(ThreshPtr != NULL);
XASSERT_NONVOID(InstancePtr->IsReady == XCOMPONENT_IS_READY);
if (!XEmac_mIsSgDma(InstancePtr)) {
return XST_NOT_SGDMA;
}
switch (Direction) {
case XEM_SEND:
*ThreshPt... | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Command response callback function for sd_ble_gap_ppcp_set BLE command.
Callback for decoding the command response return code. */ | static uint32_t gap_ppcp_set_rsp_dec(const uint8_t *p_buffer, uint16_t length) | /* Command response callback function for sd_ble_gap_ppcp_set BLE command.
Callback for decoding the command response return code. */
static uint32_t gap_ppcp_set_rsp_dec(const uint8_t *p_buffer, uint16_t length) | {
uint32_t result_code;
const uint32_t err_code = ble_gap_ppcp_set_rsp_dec(p_buffer, length, &result_code);
APP_ERROR_CHECK(err_code);
return result_code;
} | labapart/polymcu | C++ | null | 201 |
/* Initializes the GPIO device, include mode/direction/pull control registers. */ | void gpio_init(gpio_t *obj, PinName pin) | /* Initializes the GPIO device, include mode/direction/pull control registers. */
void gpio_init(gpio_t *obj, PinName pin) | {
GPIO_InitTypeDef GPIO_InitStruct;
if (pin == (PinName)NC)
return;
obj->pin = pin;
GPIO_InitStruct.GPIO_Pin = obj->pin;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(&GPIO_InitStruct);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Master finish up a transfer. It would call back if there is callback function and set the state to idle. This is not a public API. */ | static void LPSPI_MasterTransferComplete(LPSPI_Type *base, lpspi_master_handle_t *handle) | /* Master finish up a transfer. It would call back if there is callback function and set the state to idle. This is not a public API. */
static void LPSPI_MasterTransferComplete(LPSPI_Type *base, lpspi_master_handle_t *handle) | {
assert(handle);
LPSPI_DisableInterrupts(base, kLPSPI_AllInterruptEnable);
handle->state = kLPSPI_Idle;
if (handle->callback)
{
handle->callback(base, handle, kStatus_Success, handle->userData);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Return length of padding at the tail of the attribute. */ | int nla_padlen(int payload) | /* Return length of padding at the tail of the attribute. */
int nla_padlen(int payload) | {
return nla_total_size(payload) - nla_attr_size(payload);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Function called at completion of last byte transmission. */ | void USART_CharTransmitComplete_Callback(void) | /* Function called at completion of last byte transmission. */
void USART_CharTransmitComplete_Callback(void) | {
if(ubSend == sizeof(aStringToSend))
{
ubSend = 0;
LL_USART_DisableIT_TC(USARTx_INSTANCE);
LED_On();
}
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* dram_init - sets uboots idea of sdram size */ | int dram_init(void) | /* dram_init - sets uboots idea of sdram size */
int dram_init(void) | {
gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Returns CR_OK upon successful completion, an error code otherwise. */ | enum CRStatus cr_input_get_end_of_file(CRInput *a_this, gboolean *a_eof) | /* Returns CR_OK upon successful completion, an error code otherwise. */
enum CRStatus cr_input_get_end_of_file(CRInput *a_this, gboolean *a_eof) | {
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_eof, CR_BAD_PARAM_ERROR);
*a_eof = PRIVATE (a_this)->end_of_input;
return CR_OK;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Reset a lv_task. It will be called the previously set period milliseconds later. */ | void lv_task_reset(lv_task_t *task) | /* Reset a lv_task. It will be called the previously set period milliseconds later. */
void lv_task_reset(lv_task_t *task) | {
task->last_run = lv_tick_get();
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Query and save all resolutions supported by the GOP. */ | STATIC EFI_STATUS EFIAPI QueryGopModes(IN EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop, OUT UINTN *NumGopModes, OUT GOP_MODE **GopModes) | /* Query and save all resolutions supported by the GOP. */
STATIC EFI_STATUS EFIAPI QueryGopModes(IN EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop, OUT UINTN *NumGopModes, OUT GOP_MODE **GopModes) | {
EFI_STATUS Status;
UINT32 ModeNumber;
if (Gop->Mode->MaxMode == 0) {
return EFI_UNSUPPORTED;
}
*NumGopModes = Gop->Mode->MaxMode;
*GopModes = AllocatePool (Gop->Mode->MaxMode * sizeof **GopModes);
if (*GopModes == NULL) {
return EFI_OUT_OF_RESOURCES;
}
for (ModeNumber = 0; ModeNumber <... | tianocore/edk2 | C++ | Other | 4,240 |
/* brief SDIF send initialize 80 clocks for SD card after initial param base SDIF peripheral base address. param timeout value */ | bool SDIF_SendCardActive(SDIF_Type *base, uint32_t timeout) | /* brief SDIF send initialize 80 clocks for SD card after initial param base SDIF peripheral base address. param timeout value */
bool SDIF_SendCardActive(SDIF_Type *base, uint32_t timeout) | {
bool enINT = false;
if ((base->CTRL & SDIF_CTRL_INT_ENABLE_MASK) == SDIF_CTRL_INT_ENABLE_MASK)
{
enINT = true;
base->CTRL &= ~SDIF_CTRL_INT_ENABLE_MASK;
}
SDIF_ClearInterruptStatus(base, kSDIF_CommandDone);
SDIF_EnableInterrupt(base, kSDIF_CommandDone);
if (SDIF_SetCommandR... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Offset for hard-iron compensation register (r/w). The value is expressed as a 16-bit word in two’s complement.. */ | int32_t lsm6dsl_mag_offset_set(stmdev_ctx_t *ctx, uint8_t *buff) | /* Offset for hard-iron compensation register (r/w). The value is expressed as a 16-bit word in two’s complement.. */
int32_t lsm6dsl_mag_offset_set(stmdev_ctx_t *ctx, uint8_t *buff) | {
int32_t ret;
ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_BANK_A);
if(ret == 0){
ret = lsm6dsl_write_reg(ctx, LSM6DSL_MAG_OFFX_L, buff, 6);
if(ret == 0){
ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_USER_BANK);
}
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Returns result of operation - value, or negative errno */ | int dm355evm_msp_read(u8 reg) | /* Returns result of operation - value, or negative errno */
int dm355evm_msp_read(u8 reg) | {
return i2c_smbus_read_byte_data(msp430, reg);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks whether the specified LTDC's flag is set or not. */ | FlagStatus LTDC_GetCDStatus(uint32_t LTDC_CD) | /* Checks whether the specified LTDC's flag is set or not. */
FlagStatus LTDC_GetCDStatus(uint32_t LTDC_CD) | {
FlagStatus bitstatus;
assert_param(IS_LTDC_GET_CD(LTDC_CD));
if ((LTDC->CDSR & LTDC_CD) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Parse the flags string from a .flags attribute list into the varaccess enum. */ | enum env_flags_varaccess env_flags_parse_varaccess(const char *flags) | /* Parse the flags string from a .flags attribute list into the varaccess enum. */
enum env_flags_varaccess env_flags_parse_varaccess(const char *flags) | {
char *access;
if (strlen(flags) <= ENV_FLAGS_VARACCESS_LOC)
return env_flags_varaccess_any;
access = strchr(env_flags_varaccess_rep,
flags[ENV_FLAGS_VARACCESS_LOC]);
if (access != NULL)
return (enum env_flags_varaccess)
(access - &env_flags_varaccess_rep[0]);
printf("## Warning: Unknown environment vari... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Check if current cpu operation mode is handler mode. */ | SL_WEAK bool CORE_InIrqContext(void) | /* Check if current cpu operation mode is handler mode. */
SL_WEAK bool CORE_InIrqContext(void) | {
return (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) != 0;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Get next available HCI events from the input-copy queue. */ | static void get_events(uint16_t size) | /* Get next available HCI events from the input-copy queue. */
static void get_events(uint16_t size) | {
uint16_t response = sys_cpu_to_le16(CMD_GET_EVENT_RSP);
struct net_buf *buf;
uint8_t count = m_events;
read_excess_bytes(size);
size = 0;
edtt_write((uint8_t *)&response, sizeof(response), EDTTT_BLOCK);
edtt_write((uint8_t *)&count, sizeof(count), EDTTT_BLOCK);
while (count--) {
buf = net_buf_get(&event_que... | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Locking: - The runlist must be unlocked on entry and is unlocked on return. */ | int ntfs_map_runlist(ntfs_inode *ni, VCN vcn) | /* Locking: - The runlist must be unlocked on entry and is unlocked on return. */
int ntfs_map_runlist(ntfs_inode *ni, VCN vcn) | {
int err = 0;
down_write(&ni->runlist.lock);
if (likely(ntfs_rl_vcn_to_lcn(ni->runlist.rl, vcn) <=
LCN_RL_NOT_MAPPED))
err = ntfs_map_runlist_nolock(ni, vcn, NULL);
up_write(&ni->runlist.lock);
return err;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks to make sure the joystick is valid. */ | SDL_bool SDL_PrivateJoystickValid(SDL_Joystick *joystick) | /* Checks to make sure the joystick is valid. */
SDL_bool SDL_PrivateJoystickValid(SDL_Joystick *joystick) | {
SDL_bool valid;
if (joystick == NULL) {
SDL_SetError("Joystick hasn't been opened yet");
valid = SDL_FALSE;
} else {
valid = SDL_TRUE;
}
return valid;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Reverses the order of the children of a #GNode. (It doesn't change the order of the grandchildren.) */ | void g_node_reverse_children(GNode *node) | /* Reverses the order of the children of a #GNode. (It doesn't change the order of the grandchildren.) */
void g_node_reverse_children(GNode *node) | {
GNode *child;
GNode *last;
g_return_if_fail (node != NULL);
child = node->children;
last = NULL;
while (child)
{
last = child;
child = last->next;
last->next = last->prev;
last->prev = child;
}
node->children = last;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* If the current execution mode is not 64-bit paged mode, then ASSERT(). If EntryPoint is 0, then ASSERT(). If NewStack is 0, then ASSERT(). */ | VOID EFIAPI UnitTestHostBaseLibAsmDisablePaging64(IN UINT16 Cs, IN UINT32 EntryPoint, IN UINT32 Context1 OPTIONAL, IN UINT32 Context2 OPTIONAL, IN UINT32 NewStack) | /* If the current execution mode is not 64-bit paged mode, then ASSERT(). If EntryPoint is 0, then ASSERT(). If NewStack is 0, then ASSERT(). */
VOID EFIAPI UnitTestHostBaseLibAsmDisablePaging64(IN UINT16 Cs, IN UINT32 EntryPoint, IN UINT32 Context1 OPTIONAL, IN UINT32 Context2 OPTIONAL, IN UINT32 NewStack) | {
SWITCH_STACK_ENTRY_POINT NewEntryPoint;
NewEntryPoint = (SWITCH_STACK_ENTRY_POINT)(UINTN)(EntryPoint);
NewEntryPoint ((VOID *)(UINTN)Context1, (VOID *)(UINTN)Context2);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* called when an entry is deleted, need to clear the bits in the bitmaps. */ | static void omfs_delete_inode(struct inode *inode) | /* called when an entry is deleted, need to clear the bits in the bitmaps. */
static void omfs_delete_inode(struct inode *inode) | {
truncate_inode_pages(&inode->i_data, 0);
if (S_ISREG(inode->i_mode)) {
inode->i_size = 0;
omfs_shrink_inode(inode);
}
omfs_clear_range(inode->i_sb, inode->i_ino, 2);
clear_inode(inode);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* initialize higher level parts of CPU like time base and timers */ | int cpu_init_r(void) | /* initialize higher level parts of CPU like time base and timers */
int cpu_init_r(void) | {
LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
leon2->Scaler_Counter = leon2->Scaler_Reload =
(((CONFIG_SYS_CLK_FREQ / 1000) + 500) / 1000) - 1;
return (0);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This function traces 4 bytes of data as specified in the format string. */ | VOID EFIAPI DumpUint32(IN CONST CHAR16 *Format, IN UINT8 *Ptr) | /* This function traces 4 bytes of data as specified in the format string. */
VOID EFIAPI DumpUint32(IN CONST CHAR16 *Format, IN UINT8 *Ptr) | {
Print (Format, *(UINT32 *)Ptr);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Send SET_RCA command to set the relative address of the card. */ | static status_t MMC_SetRelativeAddress(mmc_card_t *card) | /* Send SET_RCA command to set the relative address of the card. */
static status_t MMC_SetRelativeAddress(mmc_card_t *card) | {
assert(card);
assert(card->host.transfer);
sdhc_command_t command = {0};
sdhc_transfer_t content = {0};
command.index = kMMC_SetRelativeAddress;
command.argument = (MMC_DEFAULT_RELATIVE_ADDRESS << 16U);
command.responseType = kSDHC_ResponseTypeR1;
content.command = &command;
conten... | labapart/polymcu | C++ | null | 201 |
/* Enables and configures parameters related to FDCAN transmission. This function allows configuration of bitrate switching, FDCAN frame format and fast mode timing. This function can only be called if FDCAN block is in INIT mode. It is safe to call this function on previously configured block in order to enable/disabl... | void fdcan_set_fdcan(uint32_t canport, bool brs_enable, bool fd_op_enable, uint32_t f_sjw, uint32_t f_ts1, uint32_t f_ts2, uint32_t f_br_presc) | /* Enables and configures parameters related to FDCAN transmission. This function allows configuration of bitrate switching, FDCAN frame format and fast mode timing. This function can only be called if FDCAN block is in INIT mode. It is safe to call this function on previously configured block in order to enable/disabl... | {
FDCAN_DBTP(canport) = (f_sjw << FDCAN_DBTP_DSJW_SHIFT)
| (f_ts1 << FDCAN_DBTP_DTSEG1_SHIFT)
| (f_ts2 << FDCAN_DBTP_DTSEG2_SHIFT)
| (f_br_presc << FDCAN_DBTP_DBRP_SHIFT);
if (fd_op_enable) {
FDCAN_CCCR(canport) |= FDCAN_CCCR_FDOE;
} else {
FDCAN_CCCR(canport) &= ~FDCAN_CCCR_FDOE;
}
if (brs_enable) {
F... | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* Return the 512-bit message digest into the user's array */ | void ICACHE_FLASH_ATTR SHA512_Final(uint8_t *digest, SHA512_CTX *ctx) | /* Return the 512-bit message digest into the user's array */
void ICACHE_FLASH_ATTR SHA512_Final(uint8_t *digest, SHA512_CTX *ctx) | {
int i;
size_t paddingSize;
uint64_t totalSize;
uint8_t *padding_ram = malloc(128);
memcpy(padding_ram, padding, 128);
totalSize = ctx->totalSize * 8;
paddingSize = (ctx->size < 112) ? (112 - ctx->size) :
(128 + 112 - ctx->size);
SHA512_Update(ct... | eerimoq/simba | C++ | Other | 337 |
/* If any reserved bits in Address are set, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, 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(). */ | UINT8 EFIAPI PciSegmentBitFieldOr8(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 OrData) | /* If any reserved bits in Address are set, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, 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(). */
UINT8 EFIAPI PciSegmen... | {
UINTN Count;
PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldOr8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, OrData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get the DMA Current Source Address of a channel. */ | unsigned long DMACurrentSourceAddrGet(unsigned long ulChannelID) | /* Get the DMA Current Source Address of a channel. */
unsigned long DMACurrentSourceAddrGet(unsigned long ulChannelID) | {
xASSERT(xDMAChannelIDValid(ulChannelID));
return xHWREG(g_psDMAChannelAddress[ulChannelID] + DMA_SAR);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* MTFSF: Forward space over 'count' file marks. The tape is positioned at the EOT (End of Tape) side of the file mark. */ | int tape_std_mtfsf(struct tape_device *device, int mt_count) | /* MTFSF: Forward space over 'count' file marks. The tape is positioned at the EOT (End of Tape) side of the file mark. */
int tape_std_mtfsf(struct tape_device *device, int mt_count) | {
struct tape_request *request;
struct ccw1 *ccw;
request = tape_alloc_request(mt_count + 2, 0);
if (IS_ERR(request))
return PTR_ERR(request);
request->op = TO_FSF;
ccw = tape_ccw_cc(request->cpaddr, MODE_SET_DB, 1,
device->modeset_byte);
ccw = tape_ccw_repeat(ccw, FORSPACEFILE, mt_count);
ccw = tape_ccw... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The author disclaims all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the author be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of c... | static void HD44780_WriteNibble(const uint8_t nib) | /* The author disclaims all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the author be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of c... | {
PORTD = (PORTD & ~(ENABLE | LO4_MASK)) | (nib & LO4_MASK);
asm volatile("nop\n\t"
"nop\n\t"
:: );
PORTD |= ENABLE;
asm volatile("nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
... | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Config the filter type for the ETH MAC address. */ | void ETH_ConfigMACAddressMaskBytesFilter(ETH_MAC_ADDRESS_T macAddr, uint32_t maskByte) | /* Config the filter type for the ETH MAC address. */
void ETH_ConfigMACAddressMaskBytesFilter(ETH_MAC_ADDRESS_T macAddr, uint32_t maskByte) | {
__IO uint32_t temp = 0;
(*(__IO uint32_t *) (ETH_MAC_ADDR_HBASE + macAddr)) &=(~(uint32_t)0x3F000000);
temp = (*(__IO uint32_t *) (ETH_MAC_ADDR_HBASE + macAddr));
ETH_Delay(ETH_REG_WRITE_DELAY);
(*(__IO uint32_t *) (ETH_MAC_ADDR_HBASE + macAddr)) = temp;
(*(__IO uint32_t *) (ETH_MAC_ADDR_HBASE... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Check if a color format is chroma keyed or not */ | bool lv_img_color_format_is_chroma_keyed(lv_img_cf_t cf) | /* Check if a color format is chroma keyed or not */
bool lv_img_color_format_is_chroma_keyed(lv_img_cf_t cf) | {
bool is_chroma_keyed = false;
switch(cf) {
case LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED:
case LV_IMG_CF_RAW_CHROMA_KEYED:
case LV_IMG_CF_INDEXED_1BIT:
case LV_IMG_CF_INDEXED_2BIT:
case LV_IMG_CF_INDEXED_4BIT:
case LV_IMG_CF_INDEXED_8BIT: is_chroma_keyed = true; break;... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Returns alignment on success, 0 (invalid alignment) on failure. */ | resource_size_t resource_alignment(struct resource *res) | /* Returns alignment on success, 0 (invalid alignment) on failure. */
resource_size_t resource_alignment(struct resource *res) | {
switch (res->flags & (IORESOURCE_SIZEALIGN | IORESOURCE_STARTALIGN)) {
case IORESOURCE_SIZEALIGN:
return resource_size(res);
case IORESOURCE_STARTALIGN:
return res->start;
default:
return 0;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function processes the results of changes in configuration. */ | EFI_STATUS EFIAPI RouteConfig(CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, CONST EFI_STRING Configuration, EFI_STRING *Progress) | /* This function processes the results of changes in configuration. */
EFI_STATUS EFIAPI RouteConfig(CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, CONST EFI_STRING Configuration, EFI_STRING *Progress) | {
if ((Configuration == NULL) || (Progress == NULL)) {
return (EFI_INVALID_PARAMETER);
}
*Progress = Configuration;
if (!HiiIsConfigHdrMatch (Configuration, &gHiiSetupVariableGuid, OpalPasswordStorageName)) {
return EFI_NOT_FOUND;
}
*Progress = Configuration + StrLen (Configuration);
return EFI_SU... | tianocore/edk2 | C++ | Other | 4,240 |
/* Reads N bytes of Data, starting from the specified I2C address. */ | static int32_t ST25DV_ReadData(ST25DV_Object_t *pObj, uint8_t *const pData, const uint16_t TarAddr, const uint16_t NbByte) | /* Reads N bytes of Data, starting from the specified I2C address. */
static int32_t ST25DV_ReadData(ST25DV_Object_t *pObj, uint8_t *const pData, const uint16_t TarAddr, const uint16_t NbByte) | {
return pObj->IO.Read(ST25DV_ADDR_DATA_I2C, TarAddr, pData, NbByte );
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* init_rs - Find a matching or allocate a new rs control structure @symsize: the symbol size (number of bits) @gfpoly: the extended Galois field generator polynomial coefficients, with the 0th coefficient in the low order bit. The polynomial must be primitive; @fcr: the first consecutive root of the rs code generator ... | struct rs_control* init_rs(int symsize, int gfpoly, int fcr, int prim, int nroots) | /* init_rs - Find a matching or allocate a new rs control structure @symsize: the symbol size (number of bits) @gfpoly: the extended Galois field generator polynomial coefficients, with the 0th coefficient in the low order bit. The polynomial must be primitive; @fcr: the first consecutive root of the rs code generator ... | {
return init_rs_internal(symsize, gfpoly, NULL, fcr, prim, nroots);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Fills each SPI_InitStruct member with its default value. */ | void SPI_InitStruct(SPI_InitType *SPI_InitStruct) | /* Fills each SPI_InitStruct member with its default value. */
void SPI_InitStruct(SPI_InitType *SPI_InitStruct) | {
SPI_InitStruct->DataDirection = SPI_DIR_DOUBLELINE_FULLDUPLEX;
SPI_InitStruct->SpiMode = SPI_MODE_SLAVE;
SPI_InitStruct->DataLen = SPI_DATA_SIZE_8BITS;
SPI_InitStruct->CLKPOL = SPI_CLKPOL_LOW;
SPI_InitStruct->CLKPHA = SPI_CLKPHA_FIRST_EDGE;
SPI_InitStruct->NSS = SPI_NSS_HARD;
SPI_InitStruc... | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Programs a byte (8-bit) at a specified address. */ | FLASH_Status FLASH_ProgramByte(uint32_t Address, uint8_t Data) | /* Programs a byte (8-bit) at a specified address. */
FLASH_Status FLASH_ProgramByte(uint32_t Address, uint8_t Data) | {
FLASH_Status status = FLASH_COMPLETE;
assert_param(IS_FLASH_ADDRESS(Address));
status = FLASH_WaitForLastOperation();
if(status == FLASH_COMPLETE)
{
FLASH->CR &= CR_PSIZE_MASK;
FLASH->CR |= FLASH_PSIZE_BYTE;
FLASH->CR |= FLASH_CR_PG;
*(__IO uint8_t*)Address = Data;
status = FLASH_WaitFor... | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Check if file extension is used in this heuristic */ | static gboolean heuristic_uses_extension(unsigned int i, const char *extension) | /* Check if file extension is used in this heuristic */
static gboolean heuristic_uses_extension(unsigned int i, const char *extension) | {
gchar **extensionp;
if (open_routines[i].extensions == NULL)
return FALSE;
for (extensionp = open_routines[i].extensions_set; *extensionp != NULL;
extensionp++) {
if (strcmp(extension, *extensionp) == 0) {
return TRUE;
}
}
return FALSE;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Configure TC for 2-bit Gray Counter for Stepper Motor. */ | uint32_t tc_init_2bit_gray(Tc *p_tc, uint32_t ul_channel, uint32_t ul_steppermode) | /* Configure TC for 2-bit Gray Counter for Stepper Motor. */
uint32_t tc_init_2bit_gray(Tc *p_tc, uint32_t ul_channel, uint32_t ul_steppermode) | {
Assert(p_tc);
Assert(ul_channel <
(sizeof(p_tc->TC_CHANNEL) / sizeof(p_tc->TC_CHANNEL[0])));
p_tc->TC_CHANNEL[ul_channel].TC_SMMR = ul_steppermode;
return 0;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Disable Slave resume interrupt @rmtoll IER SRIE LL_SWPMI_DisableIT_SR. */ | void LL_SWPMI_DisableIT_SR(SWPMI_TypeDef *SWPMIx) | /* Disable Slave resume interrupt @rmtoll IER SRIE LL_SWPMI_DisableIT_SR. */
void LL_SWPMI_DisableIT_SR(SWPMI_TypeDef *SWPMIx) | {
CLEAR_BIT(SWPMIx->IER, SWPMI_IER_SRIE);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Resets the RCC clock configuration to the default reset state. */ | void RCC_DeInit(void) | /* Resets the RCC clock configuration to the default reset state. */
void RCC_DeInit(void) | {
RCC->CR |= (uint32_t)0x00000001;
RCC->CFGR = 0x00000000;
RCC->CR &= (uint32_t)0xFEF6FFFF;
RCC->PLLCFGR = 0x24003010;
RCC->CR &= (uint32_t)0xFFFBFFFF;
RCC->CIR = 0x00000000;
} | opentx/opentx | C++ | GNU General Public License v2.0 | 2,025 |
/* returns TRUE if the char is part of an hexa num char: i.e hexa_char ::= */ | gboolean cr_utils_is_hexa_char(guint32 a_char) | /* returns TRUE if the char is part of an hexa num char: i.e hexa_char ::= */
gboolean cr_utils_is_hexa_char(guint32 a_char) | {
if ((a_char >= '0' && a_char <= '9')
|| (a_char >= 'A' && a_char <= 'F')) {
return TRUE;
}
return FALSE;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Note: if fifo_cnt is 0, we will tell the input layer that no keys are pressed. */ | static void process_fifo(struct tegra_kbd_priv *priv, int fifo_cnt) | /* Note: if fifo_cnt is 0, we will tell the input layer that no keys are pressed. */
static void process_fifo(struct tegra_kbd_priv *priv, int fifo_cnt) | {
int fifo[KBC_MAX_KPENT];
int cnt = 0;
do {
if (fifo_cnt)
cnt = tegra_kbc_find_keys(priv, fifo, KBC_MAX_KPENT);
input_send_keycodes(priv->input, fifo, cnt);
} while (--fifo_cnt > 0);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Returns the FLASH Write Protection Option Bytes value. */ | uint32_t FLASH_OB_GetWRP(void) | /* Returns the FLASH Write Protection Option Bytes value. */
uint32_t FLASH_OB_GetWRP(void) | {
return (uint32_t)(FLASH->WRPR);
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* This function reads the host status register and compares with the provided bit mask to check if HBA completed the restart. This function will wait in a loop for the HBA to complete restart. If the HBA does not restart within 15 iterations, the function will reset the HBA again. The function returns 1 when HBA fail ... | static int lpfc_sli_brdready_s3(struct lpfc_hba *phba, uint32_t mask) | /* This function reads the host status register and compares with the provided bit mask to check if HBA completed the restart. This function will wait in a loop for the HBA to complete restart. If the HBA does not restart within 15 iterations, the function will reset the HBA again. The function returns 1 when HBA fail ... | {
uint32_t status;
int i = 0;
int retval = 0;
status = readl(phba->HSregaddr);
while (((status & mask) != mask) &&
!(status & HS_FFERM) &&
i++ < 20) {
if (i <= 5)
msleep(10);
else if (i <= 10)
msleep(500);
else
msleep(2500);
if (i == 15) {
phba->pport->port_state = LPFC_VPORT_UN... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If compat_yield is turned on then we requeue to the end of the tree. */ | static void yield_task_fair(struct rq *rq) | /* If compat_yield is turned on then we requeue to the end of the tree. */
static void yield_task_fair(struct rq *rq) | {
struct task_struct *curr = rq->curr;
struct cfs_rq *cfs_rq = task_cfs_rq(curr);
struct sched_entity *rightmost, *se = &curr->se;
if (unlikely(cfs_rq->nr_running == 1))
return;
clear_buddies(cfs_rq, se);
if (likely(!sysctl_sched_compat_yield) && curr->policy != SCHED_BATCH) {
update_rq_clock(rq);
update_cu... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* See the documentation at the top of this file. Also see the standard FLOP demo task documentation for the rationale of these tasks. */ | static void vFLOPCheck1(void *pvParameters) | /* See the documentation at the top of this file. Also see the standard FLOP demo task documentation for the rationale of these tasks. */
static void vFLOPCheck1(void *pvParameters) | {
volatile portFLOAT fVal1, fVal2, fResult;
( void ) pvParameters;
for( ;; )
{
fVal1 = ( portFLOAT ) -1234.5678;
fVal2 = ( portFLOAT ) 2345.6789;
fResult = fVal1 + fVal2;
if( ( fResult > ( portFLOAT ) 1111.15 ) || ( fResult < ( portFLOAT ) 1111.05 ) )
{
mainLATCH_ERROR();
}
fResult = fVal1 / fVal2;... | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* put a little endian short (16bits) to a pointer
Caller should ensure parameters are valid. */ | void BytesPutLe16(void *ptr, uint16_t v) | /* put a little endian short (16bits) to a pointer
Caller should ensure parameters are valid. */
void BytesPutLe16(void *ptr, uint16_t v) | {
uint8_t *p = (uint8_t *)ptr;
p[0] = v & 0xff;
p[1] = (v >> 8) & 0xff;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Not so, for quite unobvious reasons - register pressure. In user mode vfork() cannot have a stack frame, and if done by calling the "clone()" system call directly, you do not have enough call-clobbered registers to hold all the information you need. */ | SYSCALL_DEFINE0(vfork) | /* Not so, for quite unobvious reasons - register pressure. In user mode vfork() cannot have a stack frame, and if done by calling the "clone()" system call directly, you do not have enough call-clobbered registers to hold all the information you need. */
SYSCALL_DEFINE0(vfork) | {
struct pt_regs *regs = task_pt_regs(current);
return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD,
regs->gprs[15], regs, 0, NULL, NULL);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Save CPU exception context when handling EFI_VECTOR_HANDOFF_HOOK_AFTER case. */ | VOID ArchSaveExceptionContext(IN UINTN ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext, IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData) | /* Save CPU exception context when handling EFI_VECTOR_HANDOFF_HOOK_AFTER case. */
VOID ArchSaveExceptionContext(IN UINTN ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext, IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData) | {
IA32_EFLAGS32 Eflags;
RESERVED_VECTORS_DATA *ReservedVectors;
ReservedVectors = ExceptionHandlerData->ReservedVectors;
ReservedVectors[ExceptionType].OldSs = SystemContext.SystemContextX64->Ss;
ReservedVectors[ExceptionType].OldSp = SystemContext.SystemContextX64->Rsp;
ReservedVe... | tianocore/edk2 | C++ | Other | 4,240 |
/* This function disables power to PUF SRAM and peripheral clock. */ | void PUF_Deinit(PUF_Type *base, puf_config_t *conf) | /* This function disables power to PUF SRAM and peripheral clock. */
void PUF_Deinit(PUF_Type *base, puf_config_t *conf) | {
base->SRAM_CFG = 0x0u;
RESET_SetPeripheralReset(kPUF_RST_SHIFT_RSTn);
CLOCK_DisableClock(kCLOCK_Puf);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns number of bytes read or error code, as appropriate */ | static ssize_t smk_read_logging(struct file *filp, char __user *buf, size_t count, loff_t *ppos) | /* Returns number of bytes read or error code, as appropriate */
static ssize_t smk_read_logging(struct file *filp, char __user *buf, size_t count, loff_t *ppos) | {
char temp[32];
ssize_t rc;
if (*ppos != 0)
return 0;
sprintf(temp, "%d\n", log_policy);
rc = simple_read_from_buffer(buf, count, ppos, temp, strlen(temp));
return rc;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* See _g_freedesktop_dbus_call_update_activation_environment_sync() for the synchronous, blocking version of this method. */ | void _g_freedesktop_dbus_call_update_activation_environment(_GFreedesktopDBus *proxy, GVariant *arg_environment, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) | /* See _g_freedesktop_dbus_call_update_activation_environment_sync() for the synchronous, blocking version of this method. */
void _g_freedesktop_dbus_call_update_activation_environment(_GFreedesktopDBus *proxy, GVariant *arg_environment, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) | {
g_dbus_proxy_call (G_DBUS_PROXY (proxy),
"UpdateActivationEnvironment",
g_variant_new ("(@a{ss})",
arg_environment),
G_DBUS_CALL_FLAGS_NONE,
-1,
cancellable,
callback,
user_data);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Distribution data is a variable size payload containing signed 16 bit values. */ | static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr) | /* Distribution data is a variable size payload containing signed 16 bit values. */
static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr) | {
struct netem_sched_data *q = qdisc_priv(sch);
unsigned long n = nla_len(attr)/sizeof(__s16);
const __s16 *data = nla_data(attr);
spinlock_t *root_lock;
struct disttable *d;
int i;
if (n > 65536)
return -EINVAL;
d = kmalloc(sizeof(*d) + n*sizeof(d->table[0]), GFP_KERNEL);
if (!d)
return -ENOMEM;
d->size ... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Given a PCI domain, bus, and slot/function number, the desired PCI device is located in the list of PCI devices. If the device is found, its reference count is increased and this function returns a pointer to its data structure. The caller must decrement the reference count by calling pci_dev_put(). If no device is ... | struct pci_dev* pci_get_domain_bus_and_slot(int domain, unsigned int bus, unsigned int devfn) | /* Given a PCI domain, bus, and slot/function number, the desired PCI device is located in the list of PCI devices. If the device is found, its reference count is increased and this function returns a pointer to its data structure. The caller must decrement the reference count by calling pci_dev_put(). If no device is ... | {
struct pci_dev *dev = NULL;
while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
if (pci_domain_nr(dev->bus) == domain &&
(dev->bus->number == bus && dev->devfn == devfn))
return dev;
}
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Mark search as finished and remove it from search chain. */ | static void _mdns_search_finish(mdns_search_once_t *search) | /* Mark search as finished and remove it from search chain. */
static void _mdns_search_finish(mdns_search_once_t *search) | {
search->state = SEARCH_OFF;
queueDetach(mdns_search_once_t, _mdns_server->search_once, search);
xSemaphoreGive(search->lock);
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Return value: 1, if there was a resume request pending and the device had to be woken up, 0, otherwise */ | int pm_runtime_barrier(struct device *dev) | /* Return value: 1, if there was a resume request pending and the device had to be woken up, 0, otherwise */
int pm_runtime_barrier(struct device *dev) | {
int retval = 0;
pm_runtime_get_noresume(dev);
spin_lock_irq(&dev->power.lock);
if (dev->power.request_pending
&& dev->power.request == RPM_REQ_RESUME) {
__pm_runtime_resume(dev, false);
retval = 1;
}
__pm_runtime_barrier(dev);
spin_unlock_irq(&dev->power.lock);
pm_runtime_put_noidle(dev);
return ret... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Converts the command line to its post-processed form. this replaces variables and alias' per UEFI Shell spec. */ | EFI_STATUS ProcessCommandLineToFinal(IN OUT CHAR16 **CmdLine) | /* Converts the command line to its post-processed form. this replaces variables and alias' per UEFI Shell spec. */
EFI_STATUS ProcessCommandLineToFinal(IN OUT CHAR16 **CmdLine) | {
EFI_STATUS Status;
TrimSpaces (CmdLine);
Status = ShellSubstituteAliases (CmdLine);
if (EFI_ERROR (Status)) {
return (Status);
}
TrimSpaces (CmdLine);
Status = ShellSubstituteVariables (CmdLine);
if (EFI_ERROR (Status)) {
return (Status);
}
ASSERT (*CmdLine != NULL);
TrimSpaces (CmdLine... | tianocore/edk2 | C++ | Other | 4,240 |
/* Reads a set of data from the battery-backed memory of the Hibernation module. */ | void HibernateDataGet(uint32_t *pui32Data, uint32_t ui32Count) | /* Reads a set of data from the battery-backed memory of the Hibernation module. */
void HibernateDataGet(uint32_t *pui32Data, uint32_t ui32Count) | {
uint32_t ui32Idx;
ASSERT(ui32Count <= 64);
ASSERT(pui32Data != 0);
for (ui32Idx = 0; ui32Idx < ui32Count; ui32Idx++)
{
pui32Data[ui32Idx] = HWREG(HIB_DATA + (ui32Idx * 4));
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* given the alg's descriptor header template, determine whether descriptor type and primary/secondary execution units required match the hw capabilities description provided in the device tree node. */ | static int hw_supports(struct device *dev, __be32 desc_hdr_template) | /* given the alg's descriptor header template, determine whether descriptor type and primary/secondary execution units required match the hw capabilities description provided in the device tree node. */
static int hw_supports(struct device *dev, __be32 desc_hdr_template) | {
struct talitos_private *priv = dev_get_drvdata(dev);
int ret;
ret = (1 << DESC_TYPE(desc_hdr_template) & priv->desc_types) &&
(1 << PRIMARY_EU(desc_hdr_template) & priv->exec_units);
if (SECONDARY_EU(desc_hdr_template))
ret = ret && (1 << SECONDARY_EU(desc_hdr_template)
& priv->exec_units... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Duplicate implementation of CLOCK_SetDiv() provided by SDK. This function must be linked to ITCM, as it will be used to change the clocks of the FLEXSPI and SEMC peripherals. Any function called from this function must also reside in ITCM */ | static void clock_set_div(clock_div_t divider, uint32_t value) | /* Duplicate implementation of CLOCK_SetDiv() provided by SDK. This function must be linked to ITCM, as it will be used to change the clocks of the FLEXSPI and SEMC peripherals. Any function called from this function must also reside in ITCM */
static void clock_set_div(clock_div_t divider, uint32_t value) | {
uint32_t busy_shift;
busy_shift = CCM_TUPLE_BUSY_SHIFT(divider);
CCM_TUPLE_REG(CCM, divider) = (CCM_TUPLE_REG(CCM, divider) & (~CCM_TUPLE_MASK(divider))) |
(((uint32_t)((value) << CCM_TUPLE_SHIFT(divider))) & CCM_TUPLE_MASK(divider));
if (busy_shift != CCM_NO_BUSY_WAIT) {
while ((CCM->CDHIPR & ((uint32_t)(1UL... | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Append new selector key to match a 16-bit number */ | int rtnl_u32_add_key_uint16(struct rtnl_cls *cls, uint16_t val, uint16_t mask, int off, int offmask) | /* Append new selector key to match a 16-bit number */
int rtnl_u32_add_key_uint16(struct rtnl_cls *cls, uint16_t val, uint16_t mask, int off, int offmask) | {
int shift = ((off & 3) == 0 ? 16 : 0);
if (off % 2)
return -NLE_INVAL;
return rtnl_u32_add_key(cls, htonl((uint32_t)val << shift),
htonl((uint32_t)mask << shift),
off & ~3, offmask);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Clears the specified interrupt(s) for the specified PWM generator block. */ | void PWMGenIntClear(unsigned long ulBase, unsigned long ulGen, unsigned long ulInts) | /* Clears the specified interrupt(s) for the specified PWM generator block. */
void PWMGenIntClear(unsigned long ulBase, unsigned long ulGen, unsigned long ulInts) | {
ASSERT((ulBase == PWM0_BASE) || (ulBase == PWM1_BASE));
ASSERT(PWMGenValid(ulGen));
ASSERT((ulInts & ~(PWM_INT_CNT_ZERO | PWM_INT_CNT_LOAD | PWM_INT_CNT_AU |
PWM_INT_CNT_AD | PWM_INT_CNT_BU | PWM_INT_CNT_BD)) ==
0);
HWREG(PWM_GEN_BADDR(ulBase, ulGen) + PWM_O_X_ISC) = ... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Requests a DMA channel to start a transfer. */ | void DMAChannelRequest(unsigned long ulChannelID) | /* Requests a DMA channel to start a transfer. */
void DMAChannelRequest(unsigned long ulChannelID) | {
xASSERT(xDMAChannelIDValid(ulChannelID));
xHWREG(g_psDMAChannelAddress[ulChannelID] + DMA_DCR) |=
(DMA_DCR_CS | DMA_DCR_ERQ | DMA_DCR_D_REQ | DMA_DCR_EADREQ);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* RETURNS: Associated ATA device, or NULL if not found. */ | static struct ata_device * ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev) | /* RETURNS: Associated ATA device, or NULL if not found. */
static struct ata_device * ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev) | {
struct ata_device *dev = __ata_scsi_find_dev(ap, scsidev);
if (unlikely(!dev || !ata_dev_enabled(dev)))
return NULL;
return dev;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Used during enumeration to read the Host Device ID Lock CSR on a RIO device. Returns the value of the lock register. */ | static u16 rio_get_host_deviceid_lock(struct rio_mport *port, u8 hopcount) | /* Used during enumeration to read the Host Device ID Lock CSR on a RIO device. Returns the value of the lock register. */
static u16 rio_get_host_deviceid_lock(struct rio_mport *port, u8 hopcount) | {
u32 result;
rio_mport_read_config_32(port, RIO_ANY_DESTID(port->sys_size), hopcount,
RIO_HOST_DID_LOCK_CSR, &result);
return (u16) (result & 0xffff);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get minimum priority value for a given policy.
See IEEE 1003.1 */ | int sched_get_priority_min(int policy) | /* Get minimum priority value for a given policy.
See IEEE 1003.1 */
int sched_get_priority_min(int policy) | {
if (!valid_posix_policy(policy)) {
errno = EINVAL;
return -1;
}
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Figure out what the alignment of the objects will be. */ | static unsigned long calculate_alignment(unsigned long flags, unsigned long align, unsigned long size) | /* Figure out what the alignment of the objects will be. */
static unsigned long calculate_alignment(unsigned long flags, unsigned long align, unsigned long size) | {
if (flags & SLAB_HWCACHE_ALIGN) {
unsigned long ralign = cache_line_size();
while (size <= ralign / 2)
ralign /= 2;
align = max(align, ralign);
}
if (align < ARCH_SLAB_MINALIGN)
align = ARCH_SLAB_MINALIGN;
return ALIGN(align, sizeof(void *));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enters a critical section. The functions UtilCriticalSectionEnter and UtilCriticalSectionExit should always be used in a pair. */ | void UtilCriticalSectionEnter(void) | /* Enters a critical section. The functions UtilCriticalSectionEnter and UtilCriticalSectionExit should always be used in a pair. */
void UtilCriticalSectionEnter(void) | {
assert(criticalSectionInitialized);
if (criticalSectionInitialized)
{
(void)pthread_mutex_lock((pthread_mutex_t *)&mtxCritSect);
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* class_compat_create_link - create a compatibility class device link to a bus device @cls: the compatibility class @dev: the target bus device @device_link: an optional device to which a "device" link should be created */ | int class_compat_create_link(struct class_compat *cls, struct device *dev, struct device *device_link) | /* class_compat_create_link - create a compatibility class device link to a bus device @cls: the compatibility class @dev: the target bus device @device_link: an optional device to which a "device" link should be created */
int class_compat_create_link(struct class_compat *cls, struct device *dev, struct device *devic... | {
int error;
error = sysfs_create_link(cls->kobj, &dev->kobj, dev_name(dev));
if (error)
return error;
if (device_link) {
error = sysfs_create_link(&dev->kobj, &device_link->kobj,
"device");
if (error)
sysfs_remove_link(cls->kobj, dev_name(dev));
}
return error;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Fills each CEC_InitStruct member with its default value. */ | void CEC_ConfigStructInit(CEC_Config_T *cecConfig) | /* Fills each CEC_InitStruct member with its default value. */
void CEC_ConfigStructInit(CEC_Config_T *cecConfig) | {
cecConfig->signalFreeTime = CEC_SINGANL_FREETIME_STANDARD;
cecConfig->RxTolerance = CEC_RX_TOLERANCE_STANDARD;
cecConfig->stopReception = CEC_STOP_RECEPTION_OFF;
cecConfig->bitRisingError = CEC_BIT_RISING_ERR_OFF;
cecConfig->longPeriodError = CEC_LONG_PERIOD_ERR_OFF;
cec... | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Arguments: hub : input. 待处理的hub Return value: void note: void */ | void kick_khubd(struct usb_hub *hub) | /* Arguments: hub : input. 待处理的hub Return value: void note: void */
void kick_khubd(struct usb_hub *hub) | {
uint32_t flags;
flags = hal_spin_lock_irqsave(&hub_event_lock);
if (hub)
{
list_head_malloc_and_add(hub, &hub_event_list);
hub_thread_wakeup(&hub_thread_cont);
}
hal_spin_unlock_irqrestore(&hub_event_lock, flags);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns the hclk frequency of different on chip clocks. */ | u32 RCC_GetHCLKFreq(void) | /* Returns the hclk frequency of different on chip clocks. */
u32 RCC_GetHCLKFreq(void) | {
return (RCC_GetSysClockFreq() >> tbPresc[(RCC->CFGR & RCC_CFGR_HPRE) >> RCC_CFGR_HPRE_Pos]);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This is the serial driver's interrupt routine for a single port */ | static irqreturn_t rs_interrupt_single(int irq, void *dev_id) | /* This is the serial driver's interrupt routine for a single port */
static irqreturn_t rs_interrupt_single(int irq, void *dev_id) | {
struct async_struct * info;
info = IRQ_ports[irq];
if (!info || !info->tty) {
printk(KERN_INFO "simrs_interrupt_single: info|tty=0 info=%p problem\n", info);
return IRQ_NONE;
}
receive_chars(info->tty);
return IRQ_HANDLED;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* ADC Read the End-of-Conversion Flag for Injected Conversion.
This flag is set after all channels of an injected group have been converted. */ | bool adc_eoc_injected(uint32_t adc) | /* ADC Read the End-of-Conversion Flag for Injected Conversion.
This flag is set after all channels of an injected group have been converted. */
bool adc_eoc_injected(uint32_t adc) | {
return (ADC_SR(adc) & ADC_SR_JEOC) != 0;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Add a character or operation byte to the echo buffer. */ | rt_inline void add_echo_byte(unsigned char c, struct n_tty_data *ldata) | /* Add a character or operation byte to the echo buffer. */
rt_inline void add_echo_byte(unsigned char c, struct n_tty_data *ldata) | {
*echo_buf_addr(ldata, ldata->echo_head++) = c;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Change Logs: Date Author Notes Bernard first implementation xuzhuoyi modify for TMS320F28379D version qiyu modify the entry function */ | int main(void) | /* Change Logs: Date Author Notes Bernard first implementation xuzhuoyi modify for TMS320F28379D version qiyu modify the entry function */
int main(void) | {
unsigned long x=10000;
while(x)
{
x--;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Clears or safeguards the OCREF2 signal on an external event. */ | void TIM_ClearOC2Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear) | /* Clears or safeguards the OCREF2 signal on an external event. */
void TIM_ClearOC2Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear) | {
uint16_t tmpccmr1 = 0;
assert_param(IS_TIM_LIST2_PERIPH(TIMx));
assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear));
tmpccmr1 = TIMx->CCMR1;
tmpccmr1 &= (uint16_t)~TIM_CCMR1_OC2CE;
tmpccmr1 |= (uint16_t)(TIM_OCClear << 8);
TIMx->CCMR1 = tmpccmr1;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* frees a mac tree node back into the pool */ | void ixEthDBPoolFreeMacTreeNode(MacTreeNode *macNode) | /* frees a mac tree node back into the pool */
void ixEthDBPoolFreeMacTreeNode(MacTreeNode *macNode) | {
if (macNode != NULL)
{
LOCK_TREE_POOL;
macNode->nextFree = treePool;
treePool = macNode;
UNLOCK_TREE_POOL;
}
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This function is used to manage a USB device with the bulk transfer pipe. The endpoint is Bulk in. */ | EFI_STATUS EFIAPI UsbEthEcmReceive(IN PXE_CDB *Cdb, IN EDKII_USB_ETHERNET_PROTOCOL *This, IN OUT VOID *Packet, IN OUT UINTN *PacketLength) | /* This function is used to manage a USB device with the bulk transfer pipe. The endpoint is Bulk in. */
EFI_STATUS EFIAPI UsbEthEcmReceive(IN PXE_CDB *Cdb, IN EDKII_USB_ETHERNET_PROTOCOL *This, IN OUT VOID *Packet, IN OUT UINTN *PacketLength) | {
EFI_STATUS Status;
USB_ETHERNET_DRIVER *UsbEthDriver;
EFI_USB_IO_PROTOCOL *UsbIo;
UINT32 TransStatus;
UsbEthDriver = USB_ETHERNET_DEV_FROM_THIS (This);
Status = gBS->HandleProtocol (
UsbEthDriver->UsbCdcDataHandle,
&gEfiUsbIoProtocolGuid,
... | tianocore/edk2 | C++ | Other | 4,240 |
/* param base eDMA peripheral base address. param channel eDMA channel number. param bandWidth A bandwidth setting, which can be one of the following: arg kEDMABandwidthStallNone arg kEDMABandwidthStall4Cycle arg kEDMABandwidthStall8Cycle */ | void EDMA_SetBandWidth(DMA_Type *base, uint32_t channel, edma_bandwidth_t bandWidth) | /* param base eDMA peripheral base address. param channel eDMA channel number. param bandWidth A bandwidth setting, which can be one of the following: arg kEDMABandwidthStallNone arg kEDMABandwidthStall4Cycle arg kEDMABandwidthStall8Cycle */
void EDMA_SetBandWidth(DMA_Type *base, uint32_t channel, edma_bandwidth_t ban... | {
assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
base->TCD[channel].CSR = (base->TCD[channel].CSR & (~DMA_CSR_BWC_MASK)) | DMA_CSR_BWC(bandWidth);
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* retval kStatus_Success Enable IO High Voltage Detect successfully. */ | status_t SPC_EnableActiveModeIOHighVoltageDetect(SPC_Type *base, bool enable) | /* retval kStatus_Success Enable IO High Voltage Detect successfully. */
status_t SPC_EnableActiveModeIOHighVoltageDetect(SPC_Type *base, bool enable) | {
status_t status = kStatus_Success;
if (enable)
{
base->ACTIVE_CFG |= SPC_ACTIVE_CFG_IO_HVDE_MASK;
}
else
{
base->ACTIVE_CFG &= ~SPC_ACTIVE_CFG_IO_HVDE_MASK;
}
return status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Read characters from UART until line end is detected. Afterwards push the data to the message queue. */ | void serial_cb(const struct device *dev, void *user_data) | /* Read characters from UART until line end is detected. Afterwards push the data to the message queue. */
void serial_cb(const struct device *dev, void *user_data) | {
uint8_t c;
if (!uart_irq_update(uart_dev)) {
return;
}
if (!uart_irq_rx_ready(uart_dev)) {
return;
}
while (uart_fifo_read(uart_dev, &c, 1) == 1) {
if ((c == '\n' || c == '\r') && rx_buf_pos > 0) {
rx_buf[rx_buf_pos] = '\0';
k_msgq_put(&uart_msgq, &rx_buf, K_NO_WAIT);
rx_buf_pos = 0;
} else if ... | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Returns: the index of the region on success, else -1 on error. */ | static int centaur_get_free_region(unsigned long base, unsigned long size, int replace_reg) | /* Returns: the index of the region on success, else -1 on error. */
static int centaur_get_free_region(unsigned long base, unsigned long size, int replace_reg) | {
unsigned long lbase, lsize;
mtrr_type ltype;
int i, max;
max = num_var_ranges;
if (replace_reg >= 0 && replace_reg < max)
return replace_reg;
for (i = 0; i < max; ++i) {
if (centaur_mcr_reserved & (1 << i))
continue;
mtrr_if->get(i, &lbase, &lsize, <ype);
if (lsize == 0)
return i;
}
return -EN... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Same as __wake_up but called with the spinlock in wait_queue_head_t held. */ | void __wake_up_locked(wait_queue_head_t *q, unsigned int mode) | /* Same as __wake_up but called with the spinlock in wait_queue_head_t held. */
void __wake_up_locked(wait_queue_head_t *q, unsigned int mode) | {
__wake_up_common(q, mode, 1, 0, NULL);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* We queue a work item to process this offer synchronously */ | static void VmbusChannelOnOfferRescind(struct vmbus_channel_message_header *hdr) | /* We queue a work item to process this offer synchronously */
static void VmbusChannelOnOfferRescind(struct vmbus_channel_message_header *hdr) | {
struct vmbus_channel_rescind_offer *rescind;
struct vmbus_channel *channel;
DPRINT_ENTER(VMBUS);
rescind = (struct vmbus_channel_rescind_offer *)hdr;
channel = GetChannelFromRelId(rescind->ChildRelId);
if (channel == NULL) {
DPRINT_DBG(VMBUS, "channel not found for relId %d",
rescind->ChildRelId);
ret... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ubi_wl_close - close the wear-leveling sub-system. @ubi: UBI device description object */ | void ubi_wl_close(struct ubi_device *ubi) | /* ubi_wl_close - close the wear-leveling sub-system. @ubi: UBI device description object */
void ubi_wl_close(struct ubi_device *ubi) | {
dbg_wl("close the WL sub-system");
cancel_pending(ubi);
protection_queue_destroy(ubi);
tree_destroy(&ubi->used);
tree_destroy(&ubi->erroneous);
tree_destroy(&ubi->free);
tree_destroy(&ubi->scrub);
kfree(ubi->lookuptbl);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* check that an address falls within the bounds of the target process's memory mappings */ | static int is_user_addr_valid(struct task_struct *child, unsigned long start, unsigned long len) | /* check that an address falls within the bounds of the target process's memory mappings */
static int is_user_addr_valid(struct task_struct *child, unsigned long start, unsigned long len) | {
struct vm_area_struct *vma;
struct sram_list_struct *sraml;
if (start + len < start)
return -EIO;
vma = find_vma(child->mm, start);
if (vma && start >= vma->vm_start && start + len <= vma->vm_end)
return 0;
for (sraml = child->mm->context.sram_list; sraml; sraml = sraml->next)
if (start >= (unsigned long... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Event handler for the library USB Configuration Changed event. */ | void EVENT_USB_Device_ConfigurationChanged(void) | /* Event handler for the library USB Configuration Changed event. */
void EVENT_USB_Device_ConfigurationChanged(void) | {
bool ConfigSuccess = true;
ConfigSuccess &= RNDIS_Device_ConfigureEndpoints(&Ethernet_RNDIS_Interface);
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Request the memory region(s) being used by 'port' */ | static int pl010_request_port(struct uart_port *port) | /* Request the memory region(s) being used by 'port' */
static int pl010_request_port(struct uart_port *port) | {
return request_mem_region(port->mapbase, SZ_4K, "uart-pl011")
!= NULL ? 0 : -EBUSY;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* use_diag controls whether the driver should use diag rather than ssch to talk to the device */ | static ssize_t dasd_use_diag_show(struct device *dev, struct device_attribute *attr, char *buf) | /* use_diag controls whether the driver should use diag rather than ssch to talk to the device */
static ssize_t dasd_use_diag_show(struct device *dev, struct device_attribute *attr, char *buf) | {
struct dasd_devmap *devmap;
int use_diag;
devmap = dasd_find_busid(dev_name(dev));
if (!IS_ERR(devmap))
use_diag = (devmap->features & DASD_FEATURE_USEDIAG) != 0;
else
use_diag = (DASD_FEATURE_DEFAULT & DASD_FEATURE_USEDIAG) != 0;
return sprintf(buf, use_diag ? "1\n" : "0\n");
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA384 use. */ | VOID* EFIAPI HmacSha384New(VOID) | /* Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA384 use. */
VOID* EFIAPI HmacSha384New(VOID) | {
CALL_CRYPTO_SERVICE (HmacSha384New, (), NULL);
} | 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.