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 |
|---|---|---|---|---|---|---|---|
/* If the security protocol command completes without an error, the function shall return EFI_SUCCESS. If the security protocol command completes with an error, the function shall return EFI_DEVICE_ERROR. */ | EFI_STATUS EFIAPI EmmcSecurityProtocolIn(IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This, IN UINT32 MediaId, IN UINT64 Timeout, IN UINT8 SecurityProtocolId, IN UINT16 SecurityProtocolSpecificData, IN UINTN PayloadBufferSize, OUT VOID *PayloadBuffer, OUT UINTN *PayloadTransferSize) | /* If the security protocol command completes without an error, the function shall return EFI_SUCCESS. If the security protocol command completes with an error, the function shall return EFI_DEVICE_ERROR. */
EFI_STATUS EFIAPI EmmcSecurityProtocolIn(IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This, IN UINT32 MediaId, IN UINT64 Timeout, IN UINT8 SecurityProtocolId, IN UINT16 SecurityProtocolSpecificData, IN UINTN PayloadBufferSize, OUT VOID *PayloadBuffer, OUT UINTN *PayloadTransferSize) | {
EFI_STATUS Status;
if ((PayloadTransferSize == NULL) && (PayloadBufferSize != 0)) {
return EFI_INVALID_PARAMETER;
}
Status = EmmcSecurityProtocolInOut (
This,
MediaId,
Timeout,
SecurityProtocolId,
SecurityProtocolSpecificData,
PayloadBufferSize,
PayloadBuffer,
PayloadTransferSize,
TRUE
);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Shift records one index left/right inside a single btree block. */ | STATIC void xfs_btree_shift_recs(struct xfs_btree_cur *cur, union xfs_btree_rec *rec, int dir, int numrecs) | /* Shift records one index left/right inside a single btree block. */
STATIC void xfs_btree_shift_recs(struct xfs_btree_cur *cur, union xfs_btree_rec *rec, int dir, int numrecs) | {
char *dst_rec;
ASSERT(numrecs >= 0);
ASSERT(dir == 1 || dir == -1);
dst_rec = (char *)rec + (dir * cur->bc_ops->rec_len);
memmove(dst_rec, rec, numrecs * cur->bc_ops->rec_len);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* USART IRQ handler.
Interrupt handler for USART. After reception is done, set g_ul_recv_done to true, and if transmission is done, set g_ul_sent_done to true. */ | void USART0_Handler(void) | /* USART IRQ handler.
Interrupt handler for USART. After reception is done, set g_ul_recv_done to true, and if transmission is done, set g_ul_sent_done to true. */
void USART0_Handler(void) | {
uint32_t ul_status;
uint8_t uc_char;
ul_status = usart_get_status(BOARD_USART);
if(ul_status & (US_IER_TXRDY | US_IER_TXEMPTY)) {
usart_disable_interrupt(BOARD_USART, (US_IER_TXRDY | US_IER_TXEMPTY));
}
if((g_uc_state == STATE_READ) && (usart_read(BOARD_USART, (uint32_t *)&uc_char) == 0)) {
*p_revdata++ = uc_char;
g_ulcount++;
if(g_ulcount >= BUFFER_SIZE) {
usart_disable_interrupt(BOARD_USART, US_IER_RXRDY);
g_ul_recv_done = true;
}
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Fast approximation to the trigonometric sine function for floating-point data. */ | float32_t arm_sin_f32(float32_t x) | /* Fast approximation to the trigonometric sine function for floating-point data. */
float32_t arm_sin_f32(float32_t x) | {
float32_t sinVal, fract, in;
uint16_t index;
float32_t a, b;
int32_t n;
float32_t findex;
in = x * 0.159154943092f;
n = (int32_t) in;
if(x < 0.0f)
{
n--;
}
in = in - (float32_t) n;
findex = (float32_t) FAST_MATH_TABLE_SIZE * in;
index = ((uint16_t)findex) & 0x1ff;
fract = findex - (float32_t) index;
a = sinTable_f32[index];
b = sinTable_f32[index+1];
sinVal = (1.0f-fract)*a + fract*b;
return (sinVal);
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Emit 'note' formatted message on configured 'errors' stream, if verbose was selected. */ | void notef(struct GlobalConfig *config, const char *fmt,...) | /* Emit 'note' formatted message on configured 'errors' stream, if verbose was selected. */
void notef(struct GlobalConfig *config, const char *fmt,...) | {
va_list ap;
va_start(ap, fmt);
if(config->tracetype)
voutf(config, NOTE_PREFIX, fmt, ap);
va_end(ap);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Description: Some devices are naturally misaligned to compensate for things like the legacy DOS partition table 63-sector offset. Low-level drivers should call this function for devices whose first sector is not naturally aligned. */ | void blk_queue_alignment_offset(struct request_queue *q, unsigned int offset) | /* Description: Some devices are naturally misaligned to compensate for things like the legacy DOS partition table 63-sector offset. Low-level drivers should call this function for devices whose first sector is not naturally aligned. */
void blk_queue_alignment_offset(struct request_queue *q, unsigned int offset) | {
q->limits.alignment_offset =
offset & (q->limits.physical_block_size - 1);
q->limits.misaligned = 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Waits until the RTC registers (RTC_CNT, RTC_ALR and RTC_PRL) are synchronized with RTC APB clock. */ | void RTC_WaitForSynchro(void) | /* Waits until the RTC registers (RTC_CNT, RTC_ALR and RTC_PRL) are synchronized with RTC APB clock. */
void RTC_WaitForSynchro(void) | {
RTC->CRL &= (uint16_t)~RTC_FLAG_RSF;
while ((RTC->CRL & RTC_FLAG_RSF) == (uint16_t)RESET)
{
}
} | gcallipo/RadioDSP-Stm32f103 | C++ | Common Creative - Attribution 3.0 | 51 |
/* Responds to 16/32-bit data word read command from remote CPU system. to read into a write-protected word on the remote CPU system. */ | void IPCRtoLDataRead_Protected(volatile tIpcController *psController, tIpcMessage *psMessage, uint16_t bBlock) | /* Responds to 16/32-bit data word read command from remote CPU system. to read into a write-protected word on the remote CPU system. */
void IPCRtoLDataRead_Protected(volatile tIpcController *psController, tIpcMessage *psMessage, uint16_t bBlock) | {
unsigned long ulReaddata;
uint16_t usLength;
usLength = (uint16_t)psMessage->uldataw1;
if (usLength == IPC_LENGTH_16_BITS)
{
ulReaddata = (unsigned long)(*(volatile uint16_t *)psMessage->uladdress);
}
else if (usLength == IPC_LENGTH_32_BITS)
{
ulReaddata = *(unsigned long *)psMessage->uladdress;
}
IPCLtoRDataWrite_Protected(psController, psMessage->uldataw2, ulReaddata,
usLength, bBlock,
(psMessage->uldataw1 & 0xFFFF0000));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* configure the frequency division of RTC clock when HXTAL was selected as its clock source */ | void rcu_rtc_div_config(uint32_t rtc_div) | /* configure the frequency division of RTC clock when HXTAL was selected as its clock source */
void rcu_rtc_div_config(uint32_t rtc_div) | {
uint32_t reg;
reg = RCU_CFG0;
reg &= ~RCU_CFG0_RTCDIV;
RCU_CFG0 = (reg | rtc_div);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns: 0 on success (all glocks acquired), errno on failure (no glocks acquired) */ | static int nq_m_sync(unsigned int num_gh, struct gfs2_holder *ghs, struct gfs2_holder **p) | /* Returns: 0 on success (all glocks acquired), errno on failure (no glocks acquired) */
static int nq_m_sync(unsigned int num_gh, struct gfs2_holder *ghs, struct gfs2_holder **p) | {
unsigned int x;
int error = 0;
for (x = 0; x < num_gh; x++)
p[x] = &ghs[x];
sort(p, num_gh, sizeof(struct gfs2_holder *), glock_compare, NULL);
for (x = 0; x < num_gh; x++) {
p[x]->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC);
error = gfs2_glock_nq(p[x]);
if (error) {
while (x--)
gfs2_glock_dq(p[x]);
break;
}
}
return error;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Used for both the chipsets with an external AR2133/AR5133 radios and single-chip devices. */ | void ath9k_hw_write_regs(struct ath_hw *ah, u32 freqIndex, int regWrites) | /* Used for both the chipsets with an external AR2133/AR5133 radios and single-chip devices. */
void ath9k_hw_write_regs(struct ath_hw *ah, u32 freqIndex, int regWrites) | {
REG_WRITE_ARRAY(&ah->iniBB_RfGain, freqIndex, regWrites);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Invalidate the mentioned cache line in CMCC module. */ | int32_t _cmcc_invalidate_by_line(const void *hw, uint8_t way_num, uint8_t line_num) | /* Invalidate the mentioned cache line in CMCC module. */
int32_t _cmcc_invalidate_by_line(const void *hw, uint8_t way_num, uint8_t line_num) | {
int32_t return_value;
if ((way_num < CMCC_WAY_NOS) && (line_num < CMCC_LINE_NOS)) {
_cmcc_disable(hw);
while (!(_is_cache_disabled(hw)))
;
hri_cmcc_write_MAINT1_reg(hw, (CMCC_MAINT1_INDEX(line_num) | CMCC_MAINT1_WAY(way_num)));
return_value = ERR_NONE;
} else {
return_value = ERR_INVALID_ARG;
}
return return_value;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Translates the LUN status from UHI MSC to CTRL ACCESS module. */ | static Ctrl_status uhi_msc_mem_translate_status(lun_status_t status) | /* Translates the LUN status from UHI MSC to CTRL ACCESS module. */
static Ctrl_status uhi_msc_mem_translate_status(lun_status_t status) | {
switch (status) {
case LUN_GOOD:
return CTRL_GOOD;
case LUN_NOT_PRESENT:
return CTRL_NO_PRESENT;
case LUN_BUSY:
return CTRL_BUSY;
case LUN_FAIL:
default:
return CTRL_FAIL;
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Resumes the DMA Transmission. the DmaTxPollDemand is written. (the data writeen could be anything). This forces the DMA to resume transmission. */ | void synopGMAC_resume_dma_tx(synopGMACdevice *gmacdev) | /* Resumes the DMA Transmission. the DmaTxPollDemand is written. (the data writeen could be anything). This forces the DMA to resume transmission. */
void synopGMAC_resume_dma_tx(synopGMACdevice *gmacdev) | {
synopGMACWriteReg(gmacdev->DmaBase, DmaTxPollDemand, 0);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Unregisters an interrupt handler for the synchronous serial interface. */ | void SSIIntUnregister(unsigned long ulBase) | /* Unregisters an interrupt handler for the synchronous serial interface. */
void SSIIntUnregister(unsigned long ulBase) | {
unsigned long ulInt;
ASSERT((ulBase == SSI0_BASE) || (ulBase == SSI1_BASE));
ulInt = (ulBase == SSI0_BASE) ? INT_SSI0 : INT_SSI1;
IntDisable(ulInt);
IntUnregister(ulInt);
} | watterott/WebRadio | C++ | null | 71 |
/* If Alignment is not a power of two and Alignment is not zero, then ASSERT(). If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). */ | VOID* EFIAPI AllocateAlignedPages(IN UINTN Pages, IN UINTN Alignment) | /* If Alignment is not a power of two and Alignment is not zero, then ASSERT(). If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). */
VOID* EFIAPI AllocateAlignedPages(IN UINTN Pages, IN UINTN Alignment) | {
VOID *Buffer;
Buffer = InternalAllocateAlignedPages (EfiBootServicesData, Pages, Alignment);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_PAGES,
EfiBootServicesData,
Buffer,
EFI_PAGES_TO_SIZE (Pages),
NULL
);
}
return Buffer;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The profiling data set associated with this node is being unloaded. Store a copy of the profiling data and turn this node into a "ghost". */ | static int ghost_node(struct gcov_node *node) | /* The profiling data set associated with this node is being unloaded. Store a copy of the profiling data and turn this node into a "ghost". */
static int ghost_node(struct gcov_node *node) | {
node->ghost = gcov_info_dup(node->info);
if (!node->ghost) {
pr_warning("could not save data for '%s' (out of memory)\n",
node->info->filename);
return -ENOMEM;
}
node->info = NULL;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* acpi_dock_match - see if a device has a _DCK method */ | static int acpi_dock_match(struct acpi_device *device) | /* acpi_dock_match - see if a device has a _DCK method */
static int acpi_dock_match(struct acpi_device *device) | {
acpi_handle tmp;
return acpi_get_handle(device->handle, "_DCK", &tmp);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param config Pointer to configuration structure. See to "dcdc_loop_control_config_t" */ | void DCDC_GetDefaultLoopControlConfig(dcdc_loop_control_config_t *config) | /* param config Pointer to configuration structure. See to "dcdc_loop_control_config_t" */
void DCDC_GetDefaultLoopControlConfig(dcdc_loop_control_config_t *config) | {
assert(NULL != config);
memset(config, 0, sizeof(*config));
config->enableCommonHysteresis = false;
config->enableCommonThresholdDetection = false;
config->enableInvertHysteresisSign = false;
config->enableRCThresholdDetection = false;
config->enableRCScaleCircuit = 0U;
config->complementFeedForwardStep = 0U;
config->controlParameterMagnitude = 2U;
config->integralProportionalRatio = 2U;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* add a fully filled in leaf ref struct remove all the refs older than a given root generation */ | int btrfs_add_leaf_ref(struct btrfs_root *root, struct btrfs_leaf_ref *ref, int shared) | /* add a fully filled in leaf ref struct remove all the refs older than a given root generation */
int btrfs_add_leaf_ref(struct btrfs_root *root, struct btrfs_leaf_ref *ref, int shared) | {
int ret = 0;
struct rb_node *rb;
struct btrfs_leaf_ref_tree *tree = root->ref_tree;
if (shared)
tree = &root->fs_info->shared_ref_tree;
spin_lock(&tree->lock);
rb = tree_insert(&tree->root, ref->bytenr, &ref->rb_node);
if (rb) {
ret = -EEXIST;
} else {
atomic_inc(&ref->usage);
ref->tree = tree;
ref->in_tree = 1;
list_add_tail(&ref->list, &tree->list);
}
spin_unlock(&tree->lock);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Configures the slave address to be transmitted after start generation. */ | void I2C_SlaveAddressConfig(I2C_TypeDef *I2Cx, uint16_t Address) | /* Configures the slave address to be transmitted after start generation. */
void I2C_SlaveAddressConfig(I2C_TypeDef *I2Cx, uint16_t Address) | {
uint32_t tmpreg = 0;
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
assert_param(IS_I2C_SLAVE_ADDRESS(Address));
tmpreg = I2Cx->CR2;
tmpreg &= (uint32_t)~((uint32_t)I2C_CR2_SADD);
tmpreg |= (uint32_t)((uint32_t)Address & I2C_CR2_SADD);
I2Cx->CR2 = tmpreg;
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Checks whether the TIM interrupt has occurred or not. */ | ITStatus TIM_GetITStatus(TIM_TypeDef *tim, TIMIT_TypeDef it) | /* Checks whether the TIM interrupt has occurred or not. */
ITStatus TIM_GetITStatus(TIM_TypeDef *tim, TIMIT_TypeDef it) | {
return (((tim->SR & it) && (tim->DIER & it)) ? SET : RESET);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Call back function to DhcpIterateOptions to compute each option's length. It just adds the data length of all the occurrences of this Tag. Context is an array of 256 DHCP_OPTION_COUNT. */ | EFI_STATUS DhcpGetOptionLen(IN UINT8 Tag, IN UINT8 Len, IN UINT8 *Data, IN VOID *Context) | /* Call back function to DhcpIterateOptions to compute each option's length. It just adds the data length of all the occurrences of this Tag. Context is an array of 256 DHCP_OPTION_COUNT. */
EFI_STATUS DhcpGetOptionLen(IN UINT8 Tag, IN UINT8 Len, IN UINT8 *Data, IN VOID *Context) | {
DHCP_OPTION_COUNT *OpCount;
OpCount = (DHCP_OPTION_COUNT *)Context;
OpCount[Tag].Offset = (UINT16)(OpCount[Tag].Offset + Len);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns the current Halt status of an endpoint. */ | unsigned char USBD_IsHalted(unsigned char bEndpoint) | /* Returns the current Halt status of an endpoint. */
unsigned char USBD_IsHalted(unsigned char bEndpoint) | {
Endpoint *pEndpoint = &(endpoints[bEndpoint]);
unsigned char status = 0;
if (pEndpoint->state == UDP_ENDPOINT_HALTED) {
status = 1;
}
return( status );
} | opentx/opentx | C++ | GNU General Public License v2.0 | 2,025 |
/* Don't call this function directly. It is a utility helper for the of_property_read_string*() family of functions. */ | int dtb_node_property_read_string_helper(const struct dtb_node *dn, const char *propname, const char **out_strs, size_t sz, int skip) | /* Don't call this function directly. It is a utility helper for the of_property_read_string*() family of functions. */
int dtb_node_property_read_string_helper(const struct dtb_node *dn, const char *propname, const char **out_strs, size_t sz, int skip) | {
const struct dtb_property *prop = dtb_node_get_dtb_node_property(dn, propname, NULL);
int l = 0, i = 0;
const char *p, *end;
if (!prop)
return -EINVAL;
if (!prop->value)
return -ENODATA;
p = prop->value;
end = p + prop->size;
for (i = 0; p < end && (!out_strs || i < skip + sz); i++, p += l)
{
l = strnlen(p, end - p) + 1;
if (p + l > end)
return -EILSEQ;
if (out_strs && i >= skip)
*out_strs++ = p;
}
i -= skip;
return i <= 0 ? -ENODATA : i;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Config DMA to make peripheral-to-memory transfer scrolling string to SLCD memory. */ | static void configure_dma(void) | /* Config DMA to make peripheral-to-memory transfer scrolling string to SLCD memory. */
static void configure_dma(void) | {
configure_dma_resource(&example_resource);
setup_transfer_descriptor(&example_descriptor);
if (STATUS_OK != dma_add_descriptor(&example_resource,
&example_descriptor)) {
printf("Descriptor status error\n\n\r");
}
dma_register_callback(&example_resource, dma_callback,
DMA_CALLBACK_TRANSFER_DONE);
dma_enable_callback(&example_resource, DMA_CALLBACK_TRANSFER_DONE);
} | memfault/zero-to-main | C++ | null | 200 |
/* uwb_drp_avail_reserve - reserve MAS for an established reservation @rc: the radio controller @mas: the MAS to reserve */ | void uwb_drp_avail_reserve(struct uwb_rc *rc, struct uwb_mas_bm *mas) | /* uwb_drp_avail_reserve - reserve MAS for an established reservation @rc: the radio controller @mas: the MAS to reserve */
void uwb_drp_avail_reserve(struct uwb_rc *rc, struct uwb_mas_bm *mas) | {
bitmap_or(rc->drp_avail.pending, rc->drp_avail.pending, mas->bm, UWB_NUM_MAS);
bitmap_andnot(rc->drp_avail.local, rc->drp_avail.local, mas->bm, UWB_NUM_MAS);
rc->drp_avail.ie_valid = false;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is in a tight loop, better inline it, so need to be prior to callers. (2000 bytes on P6 200MHz, non-inlined ~370us, inline ~170us) - Jean II */ | static int stuff_byte(__u8 byte, __u8 *buf) | /* This is in a tight loop, better inline it, so need to be prior to callers. (2000 bytes on P6 200MHz, non-inlined ~370us, inline ~170us) - Jean II */
static int stuff_byte(__u8 byte, __u8 *buf) | {
switch (byte) {
case BOF:
case EOF:
case CE:
buf[0] = CE;
buf[1] = byte^IRDA_TRANS;
return 2;
default:
buf[0] = byte;
return 1;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get the signal strength of the last packets received. */ | sl_status_t sl_wfx_get_signal_strength(uint32_t *signal_strength) | /* Get the signal strength of the last packets received. */
sl_status_t sl_wfx_get_signal_strength(uint32_t *signal_strength) | {
sl_status_t result;
sl_wfx_get_signal_strength_cnf_t *reply = NULL;
result = sl_wfx_send_command(SL_WFX_GET_SIGNAL_STRENGTH_REQ_ID,
NULL,
0,
SL_WFX_STA_INTERFACE,
(sl_wfx_generic_confirmation_t **)&reply);
if (result == SL_STATUS_OK) {
result = sl_wfx_get_status_code(sl_wfx_htole32(reply->body.status), SL_WFX_GET_SIGNAL_STRENGTH_REQ_ID);
*signal_strength = sl_wfx_htole32(reply->body.rcpi);
}
return result;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Disable the ADC converter and release the ADC semaphore. */ | void ucb1x00_adc_disable(struct ucb1x00 *ucb) | /* Disable the ADC converter and release the ADC semaphore. */
void ucb1x00_adc_disable(struct ucb1x00 *ucb) | {
ucb->adc_cr &= ~UCB_ADC_ENA;
ucb1x00_reg_write(ucb, UCB_ADC_CR, ucb->adc_cr);
ucb1x00_disable(ucb);
up(&ucb->adc_sem);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Validate the partition by calculationg the md5 checksum for the partition and compare with checksum present in checksum offset of partition */ | int zynq_validate_partition(u32 start_addr, u32 len, u32 chksum_off) | /* Validate the partition by calculationg the md5 checksum for the partition and compare with checksum present in checksum offset of partition */
int zynq_validate_partition(u32 start_addr, u32 len, u32 chksum_off) | {
u8 checksum[MD5_CHECKSUM_SIZE];
u8 calchecksum[MD5_CHECKSUM_SIZE];
memcpy(&checksum[0], (u32 *)chksum_off, MD5_CHECKSUM_SIZE);
md5_wd((u8 *)start_addr, len, &calchecksum[0], 0x10000);
if (!memcmp(checksum, calchecksum, MD5_CHECKSUM_SIZE))
return 0;
printf("Error: Partition DataChecksum\n");
return -1;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Fills the buffer with used material in grams Example: 15,34,-,-,- g */ | static void print_used_material_g(std::span< char > buffer, GCodeInfo &gcode) | /* Fills the buffer with used material in grams Example: 15,34,-,-,- g */
static void print_used_material_g(std::span< char > buffer, GCodeInfo &gcode) | {
const auto &extruder_info = gcode.get_extruder_info(extruder);
if (extruder_info.used() && extruder_info.filament_used_g.has_value()) {
return snprintf(item_buffer.data(), item_buffer.size(), "%1.0f", static_cast<double>(extruder_info.filament_used_g.value()));
} else {
return snprintf(item_buffer.data(), item_buffer.size(), "-");
}
});
snprintf(buffer.data(), buffer.size(), " g");
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Return the number of entries in the gRegisters */ | UINTN MaxRegisterCount(VOID) | /* Return the number of entries in the gRegisters */
UINTN MaxRegisterCount(VOID) | {
return sizeof (gRegisterOffsets)/sizeof (UINTN);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This API is used to get the ranges(g values) of the sensor in the register 0x0F bit from 0 to 3. */ | BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_range(u8 *range_u8) | /* This API is used to get the ranges(g values) of the sensor in the register 0x0F bit from 0 to 3. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_range(u8 *range_u8) | {
BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR;
u8 data_u8 = BMA2x2_INIT_VALUE;
if (p_bma2x2 == BMA2x2_NULL)
{
return E_BMA2x2_NULL_PTR;
}
else
{
com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC(p_bma2x2->dev_addr,
BMA2x2_RANGE_SELECT_REG, &data_u8,
BMA2x2_GEN_READ_WRITE_LENGTH);
data_u8 = BMA2x2_GET_BITSLICE(data_u8, BMA2x2_RANGE_SELECT);
*range_u8 = data_u8;
}
return com_rslt;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* iis3dhhc_handle_interrupt - handle the drdy event read data and call handler if registered any */ | static void iis3dhhc_handle_interrupt(const struct device *dev) | /* iis3dhhc_handle_interrupt - handle the drdy event read data and call handler if registered any */
static void iis3dhhc_handle_interrupt(const struct device *dev) | {
struct iis3dhhc_data *iis3dhhc = dev->data;
const struct iis3dhhc_config *cfg = dev->config;
if (iis3dhhc->handler_drdy != NULL) {
iis3dhhc->handler_drdy(dev, iis3dhhc->trig_drdy);
}
gpio_pin_interrupt_configure_dt(&cfg->int_gpio, GPIO_INT_EDGE_TO_ACTIVE);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Enables or disables the tim peripheral Preload register on CCR3. */ | void TIM_OC3PreloadConfig(TIM_TypeDef *tim, TIMOCPE_Typedef preload) | /* Enables or disables the tim peripheral Preload register on CCR3. */
void TIM_OC3PreloadConfig(TIM_TypeDef *tim, TIMOCPE_Typedef preload) | {
MODIFY_REG(tim->CCMR2, TIM_CCMR2_OC3PEN, preload);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Latch interrupt request on INT1_SRC (31h), with INT1_SRC(31h) register cleared by reading INT1_SRC (31h) itself.. */ | int32_t lis2dh12_int1_pin_notification_mode_set(stmdev_ctx_t *ctx, lis2dh12_lir_int1_t val) | /* Latch interrupt request on INT1_SRC (31h), with INT1_SRC(31h) register cleared by reading INT1_SRC (31h) itself.. */
int32_t lis2dh12_int1_pin_notification_mode_set(stmdev_ctx_t *ctx, lis2dh12_lir_int1_t val) | {
lis2dh12_ctrl_reg5_t ctrl_reg5;
int32_t ret;
ret = lis2dh12_read_reg(ctx, LIS2DH12_CTRL_REG5,
(uint8_t *)&ctrl_reg5, 1);
if (ret == 0)
{
ctrl_reg5.lir_int1 = (uint8_t)val;
ret = lis2dh12_write_reg(ctx, LIS2DH12_CTRL_REG5,
(uint8_t *)&ctrl_reg5, 1);
}
return ret;
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Free a block created with ipc_alloc(). The caller must know the size used in the allocation call. */ | void ipc_free(void *ptr, int size) | /* Free a block created with ipc_alloc(). The caller must know the size used in the allocation call. */
void ipc_free(void *ptr, int size) | {
if(size > PAGE_SIZE)
vfree(ptr);
else
kfree(ptr);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function enables the specified channels in the ADC Channel Selection Sequencer Registers. The sequencer must be disabled before writing to these regsiters. */ | int XAdcPs_SetSeqChEnables(XAdcPs *InstancePtr, u32 ChEnableMask) | /* This function enables the specified channels in the ADC Channel Selection Sequencer Registers. The sequencer must be disabled before writing to these regsiters. */
int XAdcPs_SetSeqChEnables(XAdcPs *InstancePtr, u32 ChEnableMask) | {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
if ((XAdcPs_GetSequencerMode(InstancePtr) != XADCPS_SEQ_MODE_SAFE)) {
return XST_FAILURE;
}
XAdcPs_WriteInternalReg(InstancePtr,
XADCPS_SEQ00_OFFSET,
(ChEnableMask & XADCPS_SEQ00_CH_VALID_MASK));
XAdcPs_WriteInternalReg(InstancePtr,
XADCPS_SEQ01_OFFSET,
(ChEnableMask >> XADCPS_SEQ_CH_AUX_SHIFT) &
XADCPS_SEQ01_CH_VALID_MASK);
return XST_SUCCESS;
} | ua1arn/hftrx | C++ | null | 69 |
/* Checks whether the packet is accepted or not. Returns: 0 - drop, !=0 - accept */ | static int check_filter(struct tap_filter *filter, const struct sk_buff *skb) | /* Checks whether the packet is accepted or not. Returns: 0 - drop, !=0 - accept */
static int check_filter(struct tap_filter *filter, const struct sk_buff *skb) | {
if (!filter->count)
return 1;
return run_filter(filter, skb);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* CAN MSP Initialization This function configures the hardware resources used in this example: */ | void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan) | /* CAN MSP Initialization This function configures the hardware resources used in this example: */
void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan) | {
GPIO_InitTypeDef GPIO_InitStruct;
CANx_CLK_ENABLE();
CANx_GPIO_CLK_ENABLE();
GPIO_InitStruct.Pin = CANx_TX_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Alternate = CANx_TX_AF;
HAL_GPIO_Init(CANx_TX_GPIO_PORT, &GPIO_InitStruct);
GPIO_InitStruct.Pin = CANx_RX_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Alternate = CANx_RX_AF;
HAL_GPIO_Init(CANx_TX_GPIO_PORT, &GPIO_InitStruct);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Send GET_RCA command to get card relative address. */ | static status_t SD_SendRca(sd_card_t *card) | /* Send GET_RCA command to get card relative address. */
static status_t SD_SendRca(sd_card_t *card) | {
assert(card);
sdhc_transfer_t content = {0};
sdhc_command_t command = {0};
command.index = kSD_SendRelativeAddress;
command.argument = 0U;
command.responseType = kSDHC_ResponseTypeR6;
content.command = &command;
content.data = NULL;
if (kStatus_Success == card->host.transfer(card->host.base, &content))
{
card->relativeAddress = (command.response[0U] >> 16U);
return kStatus_Success;
}
return kStatus_SDMMC_TransferFailed;
} | labapart/polymcu | C++ | null | 201 |
/* Callback function which provided by user to remove one node in NetDestroyLinkList process. */ | EFI_STATUS EFIAPI Mtftp4DestroyChildEntryInHandleBuffer(IN LIST_ENTRY *Entry, IN VOID *Context) | /* Callback function which provided by user to remove one node in NetDestroyLinkList process. */
EFI_STATUS EFIAPI Mtftp4DestroyChildEntryInHandleBuffer(IN LIST_ENTRY *Entry, IN VOID *Context) | {
MTFTP4_PROTOCOL *Instance;
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
UINTN NumberOfChildren;
EFI_HANDLE *ChildHandleBuffer;
if ((Entry == NULL) || (Context == NULL)) {
return EFI_INVALID_PARAMETER;
}
Instance = NET_LIST_USER_STRUCT_S (Entry, MTFTP4_PROTOCOL, Link, MTFTP4_PROTOCOL_SIGNATURE);
ServiceBinding = ((MTFTP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->ServiceBinding;
NumberOfChildren = ((MTFTP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->NumberOfChildren;
ChildHandleBuffer = ((MTFTP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->ChildHandleBuffer;
if (!NetIsInHandleBuffer (Instance->Handle, NumberOfChildren, ChildHandleBuffer)) {
return EFI_SUCCESS;
}
return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function will be invoked by BSP, when enter interrupt service routine. */ | rt_weak void rt_interrupt_enter(void) | /* This function will be invoked by BSP, when enter interrupt service routine. */
rt_weak void rt_interrupt_enter(void) | {
rt_atomic_add(&(rt_interrupt_nest), 1);
RT_OBJECT_HOOK_CALL(rt_interrupt_enter_hook,());
LOG_D("irq has come..., irq current nest:%d",
(rt_int32_t)rt_atomic_load(&(rt_interrupt_nest)));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Initialize the FLASH HAL instance and hardware for callback mode. */ | int32_t flash_init(struct flash_descriptor *flash, void *const hw) | /* Initialize the FLASH HAL instance and hardware for callback mode. */
int32_t flash_init(struct flash_descriptor *flash, void *const hw) | {
int32_t rc;
ASSERT(flash && hw);
rc = _flash_init(&flash->dev, hw);
if (rc) {
return rc;
}
flash->dev.flash_cb.ready_cb = flash_ready;
flash->dev.flash_cb.error_cb = flash_error;
return ERR_NONE;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Logic for a wm8731 as connected on a Sharp SL-C7x0 Device */ | static int corgi_wm8731_init(struct snd_soc_codec *codec) | /* Logic for a wm8731 as connected on a Sharp SL-C7x0 Device */
static int corgi_wm8731_init(struct snd_soc_codec *codec) | {
int err;
snd_soc_dapm_nc_pin(codec, "LLINEIN");
snd_soc_dapm_nc_pin(codec, "RLINEIN");
err = snd_soc_add_controls(codec, wm8731_corgi_controls,
ARRAY_SIZE(wm8731_corgi_controls));
if (err < 0)
return err;
snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets,
ARRAY_SIZE(wm8731_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync(codec);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets the register pointer with specified reg value. */ | void at30tse_set_register_pointer(uint8_t reg, uint8_t reg_type) | /* Sets the register pointer with specified reg value. */
void at30tse_set_register_pointer(uint8_t reg, uint8_t reg_type) | {
uint8_t buffer[] = {reg | reg_type};
struct i2c_master_packet transfer = {
.address = AT30TSE_TEMPERATURE_TWI_ADDR,
.data_length = 1,
.data = buffer,
};
i2c_master_write_packet_wait(&dev_inst_at30tse75x, &transfer);
} | memfault/zero-to-main | C++ | null | 200 |
/* Set up the PCI and controller side of the IDE interface. This brings up the PCI side of the device, checks that the device is enabled and enables it if need be */ | static int ide_setup_pci_controller(struct pci_dev *dev, const struct ide_port_info *d, int noisy) | /* Set up the PCI and controller side of the IDE interface. This brings up the PCI side of the device, checks that the device is enabled and enables it if need be */
static int ide_setup_pci_controller(struct pci_dev *dev, const struct ide_port_info *d, int noisy) | {
int ret;
u16 pcicmd;
if (noisy)
ide_setup_pci_noise(dev, d);
ret = ide_pci_enable(dev, d);
if (ret < 0)
goto out;
ret = pci_read_config_word(dev, PCI_COMMAND, &pcicmd);
if (ret < 0) {
printk(KERN_ERR "%s %s: error accessing PCI regs\n",
d->name, pci_name(dev));
goto out;
}
if (!(pcicmd & PCI_COMMAND_IO)) {
ret = ide_pci_configure(dev, d);
if (ret < 0)
goto out;
printk(KERN_INFO "%s %s: device enabled (Linux)\n",
d->name, pci_name(dev));
}
out:
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Sha1Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI Sha1Init(OUT VOID *Sha1Context) | /* If Sha1Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI Sha1Init(OUT VOID *Sha1Context) | {
CALL_CRYPTO_SERVICE (Sha1Init, (Sha1Context), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Registers a callback.
Registers a callback function which is implemented by the user. */ | void wdt_register_callback(struct wdt_module *const module, wdt_callback_t callback_func, enum wdt_callback callback_type) | /* Registers a callback.
Registers a callback function which is implemented by the user. */
void wdt_register_callback(struct wdt_module *const module, wdt_callback_t callback_func, enum wdt_callback callback_type) | {
Assert(module);
Assert(callback_func);
module->callback[callback_type] = callback_func;
module->callback_reg_mask |= (1 << callback_type);
} | memfault/zero-to-main | C++ | null | 200 |
/* Enables or disables TIMx peripheral Preload register on ARR. */ | void RTIM_ARRPreloadConfig(RTIM_TypeDef *TIMx, u32 NewState) | /* Enables or disables TIMx peripheral Preload register on ARR. */
void RTIM_ARRPreloadConfig(RTIM_TypeDef *TIMx, u32 NewState) | {
assert_param(IS_TIM_ALL_TIM(TIMx));
if (NewState != DISABLE) {
TIMx->CR |= TIM_CR_ARPE;
} else {
TIMx->CR &= ~TIM_CR_ARPE;
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Get the captured data for a sample sequence. */ | unsigned long xADCDataGet(unsigned long ulBase, unsigned long *pulBuffer) | /* Get the captured data for a sample sequence. */
unsigned long xADCDataGet(unsigned long ulBase, unsigned long *pulBuffer) | {
unsigned long i;
unsigned long ulEnableChannels;
unsigned long ulValid;
unsigned long ulWrite;
xASSERT(ulBase == ADC_BASE);
xASSERT(pulBuffer != 0);
ulEnableChannels = (xHWREG(ulBase + ADC_CHER) & ADC_CHER_CHEN_M) >>
ADC_CHER_CHEN_S;
ulValid = (xHWREG(ulBase + ADC_SR) & ADC_SR_VALID) >> 8;
if(ulValid == 0)
{
return 0;
}
ulWrite = 0;
for(i = 0; i < 8; i++)
{
if(ulEnableChannels & (1 << i))
{
pulBuffer[ulWrite++] = xHWREG(ulBase + ADC_DR0 + (4 * i));
break;
}
}
return ulWrite;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Show and set the number of unsolicited NA's to send after a failover event. */ | static ssize_t bonding_show_n_unsol_na(struct device *d, struct device_attribute *attr, char *buf) | /* Show and set the number of unsolicited NA's to send after a failover event. */
static ssize_t bonding_show_n_unsol_na(struct device *d, struct device_attribute *attr, char *buf) | {
struct bonding *bond = to_bond(d);
return sprintf(buf, "%d\n", bond->params.num_unsol_na);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The function is used to Get BOD state. */ | xtBoolean SysCtlBODStateGet(void) | /* The function is used to Get BOD state. */
xtBoolean SysCtlBODStateGet(void) | {
return (xHWREG(PWRCU_LVDCSR) & PWRCU_LVDCSR_BODF)>>3;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* hcu_led_set value to be placed into the LEDs (max 6 bit) */ | void hcu_led_set(u32 value) | /* hcu_led_set value to be placed into the LEDs (max 6 bit) */
void hcu_led_set(u32 value) | {
out_be16((u16 *)MCU25_LED_REGISTER_ADDRESS, value);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ | UINT32 EFIAPI PciExpressRead32(IN UINTN Address) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciExpressRead32(IN UINTN Address) | {
if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
return (UINT32)-1;
}
return MmioRead32 (GetPciExpressAddress (Address));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* process_text_message processes a <CR>-terminated block of data received from the radio that doesn't begin with a '*' character. All normal Starmode communication messages with the radio begin with a '*', so any text that does not indicates a serial port error, a radio that is in Hayes command mode instead of Starmode, or a radio with really old firmware that doesn't frame its Starmode responses properly. */ | static void process_text_message(struct strip *strip_info) | /* process_text_message processes a <CR>-terminated block of data received from the radio that doesn't begin with a '*' character. All normal Starmode communication messages with the radio begin with a '*', so any text that does not indicates a serial port error, a radio that is in Hayes command mode instead of Starmode, or a radio with really old firmware that doesn't frame its Starmode responses properly. */
static void process_text_message(struct strip *strip_info) | {
__u8 *msg = strip_info->sx_buff;
int len = strip_info->sx_count;
if (len == 9 && get_radio_address(strip_info, msg) == 0)
return;
if (text_equal(msg, len, "OK"))
return;
if (text_equal(msg, len, "ERROR"))
return;
if (has_prefix(msg, len, "ate0q1"))
return;
if (has_prefix(msg, len, "ERR_")) {
RecvErr_Message(strip_info, NULL, &msg[4], len - 4);
return;
}
RecvErr("No initial *", strip_info);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns a node pointer with refcount incremented, use of_node_put() on it when done. */ | struct device_node* of_find_all_nodes(struct device_node *prev) | /* Returns a node pointer with refcount incremented, use of_node_put() on it when done. */
struct device_node* of_find_all_nodes(struct device_node *prev) | {
struct device_node *np;
read_lock(&devtree_lock);
np = prev ? prev->allnext : allnodes;
for (; np != NULL; np = np->allnext)
if (of_node_get(np))
break;
of_node_put(prev);
read_unlock(&devtree_lock);
return np;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Return 1 if a character can be read in DBGU. */ | unsigned int DBGU_IsRxReady() | /* Return 1 if a character can be read in DBGU. */
unsigned int DBGU_IsRxReady() | {
return (AT91C_BASE_DBGU->DBGU_CSR & AT91C_US_RXRDY);
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* All four ethernets are brought out to connectors; six serial ports (a pair from each of the first three IOC3s) are brought out to MiniDINs; all other subdevices are left swinging in the wind, leave them disabled. */ | static int ioc3_adjacent_is_ioc3(struct pci_dev *pdev, int slot) | /* All four ethernets are brought out to connectors; six serial ports (a pair from each of the first three IOC3s) are brought out to MiniDINs; all other subdevices are left swinging in the wind, leave them disabled. */
static int ioc3_adjacent_is_ioc3(struct pci_dev *pdev, int slot) | {
struct pci_dev *dev = pci_get_slot(pdev->bus, PCI_DEVFN(slot, 0));
int ret = 0;
if (dev) {
if (dev->vendor == PCI_VENDOR_ID_SGI &&
dev->device == PCI_DEVICE_ID_SGI_IOC3)
ret = 1;
pci_dev_put(dev);
}
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns the current status register of the given DMA peripheral, but masking interrupt sources which are not currently enabled. */ | unsigned int DMA_GetMaskedStatus(void) | /* Returns the current status register of the given DMA peripheral, but masking interrupt sources which are not currently enabled. */
unsigned int DMA_GetMaskedStatus(void) | {
unsigned int status;
status = AT91C_BASE_HDMA->HDMA_EBCISR;
status &= AT91C_BASE_HDMA->HDMA_EBCIMR;
return status;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Get the current state of a button on a joystick */ | Uint8 SDL_JoystickGetButton(SDL_Joystick *joystick, int button) | /* Get the current state of a button on a joystick */
Uint8 SDL_JoystickGetButton(SDL_Joystick *joystick, int button) | {
Uint8 state;
if (!SDL_PrivateJoystickValid(joystick)) {
return 0;
}
if (button < joystick->nbuttons) {
state = joystick->buttons[button];
} else {
SDL_SetError("Joystick only has %d buttons", joystick->nbuttons);
state = 0;
}
return state;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Initializes the DMA Tx descriptors in chain mode. */ | void ETH_ConfigDMATxDescChain(ETH_DMADescConfig_T *DMATxDescTab, uint8_t *txBuff, uint32_t txBuffcount) | /* Initializes the DMA Tx descriptors in chain mode. */
void ETH_ConfigDMATxDescChain(ETH_DMADescConfig_T *DMATxDescTab, uint8_t *txBuff, uint32_t txBuffcount) | {
uint32_t i = 0;
ETH_DMADescConfig_T *DMATxDesc;
DMATxDescToSet = DMATxDescTab;
for(i=0; i< txBuffcount; i++)
{
DMATxDesc = DMATxDescTab+i;
DMATxDesc->Status = ETH_DMATXDESC_TXCH;
DMATxDesc->Buffer1Addr = (uint32_t)(&txBuff[i*ETH_TX_BUF_SIZE]);
if(i < (txBuffcount-1))
{
DMATxDesc->Buffer2NextDescAddr = (uint32_t)(DMATxDescTab+i+1);
}
else
{
DMATxDesc->Buffer2NextDescAddr = (uint32_t)(DMATxDescTab);
}
}
ETH->DMATXDLADDR = (uint32_t) DMATxDescTab;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Individual device operations. sa1111_enable_device - enable an on-chip SA1111 function block @sadev: SA1111 function block device to enable */ | void sa1111_enable_device(struct sa1111_dev *sadev) | /* Individual device operations. sa1111_enable_device - enable an on-chip SA1111 function block @sadev: SA1111 function block device to enable */
void sa1111_enable_device(struct sa1111_dev *sadev) | {
struct sa1111 *sachip = sa1111_chip_driver(sadev);
unsigned long flags;
unsigned int val;
spin_lock_irqsave(&sachip->lock, flags);
val = sa1111_readl(sachip->base + SA1111_SKPCR);
sa1111_writel(val | sadev->skpcr_mask, sachip->base + SA1111_SKPCR);
spin_unlock_irqrestore(&sachip->lock, flags);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If arg_element->dest points to a place to store a possible value, read it If there is a callback registered, call it after */ | static void nsi_cmd_handle_this_matched_arg(char *argv, int offset, struct args_struct_t *arg_element) | /* If arg_element->dest points to a place to store a possible value, read it If there is a callback registered, call it after */
static void nsi_cmd_handle_this_matched_arg(char *argv, int offset, struct args_struct_t *arg_element) | {
if (arg_element->dest != NULL) {
if (arg_element->is_switch) {
if (arg_element->type == 'b') {
*(bool *)arg_element->dest = true;
} else {
nsi_print_error_and_exit(CMD_ERR_BOOL_SWI);
}
} else {
nsi_cmd_read_option_value(&argv[offset],
arg_element->dest,
arg_element->type,
arg_element->option);
}
}
if (arg_element->call_when_found) {
arg_element->call_when_found(argv, offset);
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* \method prescaler() Get or set the prescaler for the timer. */ | STATIC mp_obj_t pyb_timer_prescaler(size_t n_args, const mp_obj_t *args) | /* \method prescaler() Get or set the prescaler for the timer. */
STATIC mp_obj_t pyb_timer_prescaler(size_t n_args, const mp_obj_t *args) | {
return mp_obj_new_int(self->tim.Instance->PSC & 0xffff);
} else {
self->tim.Instance->PSC = mp_obj_get_int(args[1]) & 0xffff;
return mp_const_none;
}
} | micropython/micropython | C++ | Other | 18,334 |
/* Enables or disables the window mode. In window mode: */ | void COMP_WindowCmd(FunctionalState NewState) | /* Enables or disables the window mode. In window mode: */
void COMP_WindowCmd(FunctionalState NewState) | {
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
COMP->CSR |= (uint32_t) COMP_CSR_WNDWE;
}
else
{
COMP->CSR &= (uint32_t)(~COMP_CSR_WNDWE);
}
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Configures the CAN_Basic reception filter according to the specified parameters in the CAN_Basic_FilterInitStruct. */ | void CAN_FilterInit(CAN_TypeDef *CANx, CAN_Basic_FilterInitTypeDef *CAN_Basic_FilterInitStruct) | /* Configures the CAN_Basic reception filter according to the specified parameters in the CAN_Basic_FilterInitStruct. */
void CAN_FilterInit(CAN_TypeDef *CANx, CAN_Basic_FilterInitTypeDef *CAN_Basic_FilterInitStruct) | {
CANx->ACR = CAN_Basic_FilterInitStruct->CAN_FilterId;
CANx->AMR = CAN_Basic_FilterInitStruct->CAN_FilterMaskId;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* RTC driver for XMC microcontroller family.
Initialize the RTC peripheral */ | XMC_RTC_STATUS_t XMC_RTC_Init(const XMC_RTC_CONFIG_t *const config) | /* RTC driver for XMC microcontroller family.
Initialize the RTC peripheral */
XMC_RTC_STATUS_t XMC_RTC_Init(const XMC_RTC_CONFIG_t *const config) | {
if (XMC_RTC_IsRunning() == false)
{
if (XMC_RTC_IsEnabled() == false)
{
XMC_RTC_Enable();
}
XMC_RTC_SetPrescaler(config->prescaler);
while ((XMC_SCU_GetMirrorStatus() & (SCU_GENERAL_MIRRSTS_RTC_TIM0_Msk | SCU_GENERAL_MIRRSTS_RTC_TIM1_Msk)) != 0U)
{
}
RTC->TIM0 = config->time.raw0;
RTC->TIM1 = config->time.raw1;
while ((XMC_SCU_GetMirrorStatus() & (SCU_GENERAL_MIRRSTS_RTC_ATIM0_Msk | SCU_GENERAL_MIRRSTS_RTC_ATIM1_Msk)) != 0U)
{
}
RTC->ATIM0 = config->alarm.raw0;
RTC->ATIM1 = config->alarm.raw1;
}
return XMC_RTC_STATUS_OK;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Check if rfmon mode is supported on the pcap_t for Windows systems. */ | static int pcap_can_set_rfmon_npf(pcap_t *p) | /* Check if rfmon mode is supported on the pcap_t for Windows systems. */
static int pcap_can_set_rfmon_npf(pcap_t *p) | {
return (PacketIsMonitorModeSupported(p->opt.device) == 1);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Get the status of the dcp channel.
@para ch the channel index */ | int dcp_start_channel(uint32_t ch, uint32_t pkt_num) | /* Get the status of the dcp channel.
@para ch the channel index */
int dcp_start_channel(uint32_t ch, uint32_t pkt_num) | {
HW_DCP_CHnSEMA_WR(ch, pkt_num);
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* gfs2_attach_bufdata - attach a struct gfs2_bufdata structure to a buffer @gl: the glock the buffer belongs to @bh: The buffer to be attached to @meta: Flag to indicate whether its metadata or not */ | void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh, int meta) | /* gfs2_attach_bufdata - attach a struct gfs2_bufdata structure to a buffer @gl: the glock the buffer belongs to @bh: The buffer to be attached to @meta: Flag to indicate whether its metadata or not */
void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh, int meta) | {
struct gfs2_bufdata *bd;
if (meta)
lock_page(bh->b_page);
if (bh->b_private) {
if (meta)
unlock_page(bh->b_page);
return;
}
bd = kmem_cache_zalloc(gfs2_bufdata_cachep, GFP_NOFS | __GFP_NOFAIL);
bd->bd_bh = bh;
bd->bd_gl = gl;
INIT_LIST_HEAD(&bd->bd_list_tr);
if (meta)
lops_init_le(&bd->bd_le, &gfs2_buf_lops);
else
lops_init_le(&bd->bd_le, &gfs2_databuf_lops);
bh->b_private = bd;
if (meta)
unlock_page(bh->b_page);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ufshcd_get_ufs_version - Get the UFS version supported by the HBA */ | static u32 ufshcd_get_ufs_version(struct ufs_hba *hba) | /* ufshcd_get_ufs_version - Get the UFS version supported by the HBA */
static u32 ufshcd_get_ufs_version(struct ufs_hba *hba) | {
return ufshcd_readl(hba, REG_UFS_VERSION);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Do a system call from kernel instead of calling sys_execve so we end up with proper pt_regs. */ | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | /* Do a system call from kernel instead of calling sys_execve so we end up with proper pt_regs. */
int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | {
register const char *__a __asm__("r5") = filename;
register const void *__b __asm__("r6") = argv;
register const void *__c __asm__("r7") = envp;
register unsigned long __syscall __asm__("r12") = __NR_execve;
register unsigned long __ret __asm__("r3");
__asm__ __volatile__ ("brki r14, 0x8"
: "=r" (__ret), "=r" (__syscall)
: "1" (__syscall), "r" (__a), "r" (__b), "r" (__c)
: "r4", "r8", "r9",
"r10", "r11", "r14", "cc", "memory");
return __ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* restore the FPU state from a signal context */ | int fpu_restore_sigcontext(struct fpucontext *fpucontext) | /* restore the FPU state from a signal context */
int fpu_restore_sigcontext(struct fpucontext *fpucontext) | {
struct task_struct *tsk = current;
int ret;
ret = copy_from_user(&tsk->thread.fpu_state,
fpucontext,
min(sizeof(struct fpu_state_struct),
sizeof(struct fpucontext)));
if (!ret)
set_using_fpu(tsk);
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Event notification function for SIMPLE_TEXT_IN.WaitForKey event Signal the event if there is key available */ | VOID EFIAPI VirtualKeyboardWaitForKey(IN EFI_EVENT Event, IN VOID *Context) | /* Event notification function for SIMPLE_TEXT_IN.WaitForKey event Signal the event if there is key available */
VOID EFIAPI VirtualKeyboardWaitForKey(IN EFI_EVENT Event, IN VOID *Context) | {
gBS->Stall (1000);
VirtualKeyboardTimerHandler (NULL, VIRTUAL_KEYBOARD_DEV_FROM_THIS (Context));
if (!EFI_ERROR (VirtualKeyboardCheckForKey (Context))) {
gBS->SignalEvent (Event);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* List up to 25 file on the root directory with extension .BMP. */ | uint32_t Storage_GetDirectoryBitmapFiles(const char *DirName, char *Files[]) | /* List up to 25 file on the root directory with extension .BMP. */
uint32_t Storage_GetDirectoryBitmapFiles(const char *DirName, char *Files[]) | {
FRESULT res;
uint32_t index = 0;
if(f_mount(&fs, (TCHAR const*)"",0) != FR_OK)
{
return 0;
}
res = f_findfirst(&MyDirectory, &MyFileInfo, DirName, "*.bmp");
while (MyFileInfo.fname[0])
{
if(res == FR_OK)
{
if(index < MAX_BMP_FILES)
{
sprintf (Files[index++], "%s", MyFileInfo.fname);
}
res = f_findnext(&MyDirectory, &MyFileInfo);
}
else
{
index = 0;
break;
}
}
f_closedir(&MyDirectory);
return index;
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Enables or disables the TIMx peripheral Preload register on CCR4. */ | void TIM_OC4PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload) | /* Enables or disables the TIMx peripheral Preload register on CCR4. */
void TIM_OC4PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload) | {
uint16_t tmpccmr2 = 0;
assert_param(IS_TIM_LIST3_PERIPH(TIMx));
assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload));
tmpccmr2 = TIMx->CCMR2;
tmpccmr2 &= (uint16_t)~((uint16_t)TIM_CCMR2_OC4PE);
tmpccmr2 |= (uint16_t)(TIM_OCPreload << 8);
TIMx->CCMR2 = tmpccmr2;
} | gcallipo/RadioDSP-Stm32f103 | C++ | Common Creative - Attribution 3.0 | 51 |
/* return The status flags. This is the logical OR of members of the enumeration ::pwm_status_flags_t */ | uint32_t PWM_GetStatusFlags(PWM_Type *base, pwm_submodule_t subModule) | /* return The status flags. This is the logical OR of members of the enumeration ::pwm_status_flags_t */
uint32_t PWM_GetStatusFlags(PWM_Type *base, pwm_submodule_t subModule) | {
uint32_t statusFlags;
statusFlags = base->SM[subModule].STS;
statusFlags |= ((uint32_t)(base->FSTS & PWM_FSTS_FFLAG_MASK) << 16U);
return statusFlags;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Sets the state of a gpio pin that is configured as an output.
Sets the current output level of a gpio pin to a given logic level. */ | void gpio_pin_set_output_level(const uint8_t gpio_pin, const bool level) | /* Sets the state of a gpio pin that is configured as an output.
Sets the current output level of a gpio pin to a given logic level. */
void gpio_pin_set_output_level(const uint8_t gpio_pin, const bool level) | {
if (gpio_pin < 16) {
if(level) {
GPIO0->DATAOUT.reg |= (1 << gpio_pin);
} else {
GPIO0->DATAOUT.reg &= ~(1 << gpio_pin);
}
} else if (gpio_pin < 32) {
if(level) {
GPIO1->DATAOUT.reg |= (1 << (gpio_pin % 16));
} else {
GPIO1->DATAOUT.reg &= ~(1 << (gpio_pin % 16));
}
} else {
if(level) {
GPIO2->DATAOUT.reg |= (1 << (gpio_pin % 16));
} else {
GPIO2->DATAOUT.reg &= ~(1 << (gpio_pin % 16));
}
}
} | memfault/zero-to-main | C++ | null | 200 |
/* User can (and should) define the platform from U-Boot */ | static int __init a2f_platform_parse(char *s) | /* User can (and should) define the platform from U-Boot */
static int __init a2f_platform_parse(char *s) | {
if (!strcmp(s, "a2f-lnx-evb")) {
a2f_platform = PLATFORM_A2F_LNX_EVB;
}
else if (!strcmp(s, "a2f200-som")) {
a2f_platform = PLATFORM_A2F200_SOM;
}
else if (!strcmp(s, "a2f500-som")) {
a2f_platform = PLATFORM_A2F500_SOM;
}
else if (!strcmp(s, "a2f-actel-dev-brd")) {
a2f_platform = PLATFORM_A2F_ACTEL_DEV_BRD;
}
else if (!strcmp(s, "a2f-hoermann-brd")) {
a2f_platform = PLATFORM_A2F_HOERMANN_BRD;
}
return 1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Read one bit phy data from PHY controller */ | static u16 phy_read_1bit(unsigned long, u32) | /* Read one bit phy data from PHY controller */
static u16 phy_read_1bit(unsigned long, u32) | {
u16 phy_data;
outl(0x50000 , ioaddr);
udelay(1);
phy_data = ( inl(ioaddr) >> 19 ) & 0x1;
outl(0x40000 , ioaddr);
udelay(1);
return phy_data;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ibmvfc_map_sg_list - Initialize scatterlist @scmd: scsi command struct @nseg: number of scatterlist segments @md: memory descriptor list to initialize */ | static void ibmvfc_map_sg_list(struct scsi_cmnd *scmd, int nseg, struct srp_direct_buf *md) | /* ibmvfc_map_sg_list - Initialize scatterlist @scmd: scsi command struct @nseg: number of scatterlist segments @md: memory descriptor list to initialize */
static void ibmvfc_map_sg_list(struct scsi_cmnd *scmd, int nseg, struct srp_direct_buf *md) | {
int i;
struct scatterlist *sg;
scsi_for_each_sg(scmd, sg, nseg, i) {
md[i].va = sg_dma_address(sg);
md[i].len = sg_dma_len(sg);
md[i].key = 0;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Forces the TIMx output 5 waveform to active or inactive level. */ | void TIM_ForcedOC5Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction) | /* Forces the TIMx output 5 waveform to active or inactive level. */
void TIM_ForcedOC5Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction) | {
uint32_t tmpccmr3 = 0;
assert_param(IS_TIM_LIST4_PERIPH(TIMx));
assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction));
tmpccmr3 = TIMx->CCMR3;
tmpccmr3 &= (uint32_t)~TIM_CCMR3_OC5M;
tmpccmr3 |= (uint32_t)(TIM_ForcedAction);
TIMx->CCMR3 = tmpccmr3;
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* time stamp Initialize This function Loads/Initializes h the value specified in the Timestamp High Update and Timestamp Low Update register. */ | s32 synopGMAC_TS_timestamp_init(synopGMACdevice *gmacdev, u32 high_value, u32 low_value) | /* time stamp Initialize This function Loads/Initializes h the value specified in the Timestamp High Update and Timestamp Low Update register. */
s32 synopGMAC_TS_timestamp_init(synopGMACdevice *gmacdev, u32 high_value, u32 low_value) | {
u32 loop_variable;
synopGMACWriteReg(gmacdev->MacBase, GmacTSHighUpdate, high_value);
synopGMACWriteReg(gmacdev->MacBase, GmacTSLowUpdate, low_value);
for (loop_variable = 0; loop_variable < DEFAULT_LOOP_VARIABLE; loop_variable++)
{
if (!((synopGMACReadReg(gmacdev->MacBase, GmacTSControl)) & GmacTSINT))
{
break;
}
plat_delay(DEFAULT_DELAY_VARIABLE);
}
if (loop_variable < DEFAULT_LOOP_VARIABLE)
synopGMACSetBits(gmacdev->MacBase, GmacTSControl, GmacTSINT);
else
{
TR("Error::: The TSADDREG bit is not getting cleared !!!!!!\n");
return -ESYNOPGMACPHYERR;
}
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Obtain the current power status from the APM BIOS. We return a status which gives the rough battery status, and current power source. The bat value returned give an estimate as a percentage of life and a status value for the battery. The estimated life if reported is a lifetime in secodnds/minutes at current powwer consumption. */ | static int apm_get_power_status(u_short *status, u_short *bat, u_short *life) | /* Obtain the current power status from the APM BIOS. We return a status which gives the rough battery status, and current power source. The bat value returned give an estimate as a percentage of life and a status value for the battery. The estimated life if reported is a lifetime in secodnds/minutes at current powwer consumption. */
static int apm_get_power_status(u_short *status, u_short *bat, u_short *life) | {
struct apm_bios_call call;
call.func = APM_FUNC_GET_STATUS;
call.ebx = APM_DEVICE_ALL;
call.ecx = 0;
if (apm_info.get_power_status_broken)
return APM_32_UNSUPPORTED;
if (apm_bios_call(&call))
return call.err;
*status = call.ebx;
*bat = call.ecx;
if (apm_info.get_power_status_swabinminutes) {
*life = swab16((u16)call.edx);
*life |= 0x8000;
} else
*life = call.edx;
return APM_SUCCESS;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Do AND operation with the value of AHCI Operation register. */ | VOID AhciAndReg(IN UINTN AhciBar, IN UINT32 Offset, IN UINT32 AndData) | /* Do AND operation with the value of AHCI Operation register. */
VOID AhciAndReg(IN UINTN AhciBar, IN UINT32 Offset, IN UINT32 AndData) | {
UINT32 Data;
Data = AhciReadReg (AhciBar, Offset);
Data &= AndData;
AhciWriteReg (AhciBar, Offset, Data);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Obtain a mask of pins that are configured as GPIO_OUTPUT.
The caller must ensure that */ | static gpio_port_pins_t get_output_pins(const struct device *port) | /* Obtain a mask of pins that are configured as GPIO_OUTPUT.
The caller must ensure that */
static gpio_port_pins_t get_output_pins(const struct device *port) | {
return get_pins_with_flags(port, GPIO_OUTPUT, GPIO_OUTPUT);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Register user interrupt callback function for the Watchdog timer. */ | void xWDTIntCallbackInit(unsigned long ulBase, xtEventCallback xtWDTCallback) | /* Register user interrupt callback function for the Watchdog timer. */
void xWDTIntCallbackInit(unsigned long ulBase, xtEventCallback xtWDTCallback) | {
WDTimerIntCallbackInit(xtWDTCallback);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* The WM8350 has a hardware lock which can be used to prevent writes to some registers (generally those which can cause particularly serious problems if misused). This function disables that lock so updates can be performed. For maximum safety this should be done only when required. */ | int wm8350_reg_unlock(struct wm8350 *wm8350) | /* The WM8350 has a hardware lock which can be used to prevent writes to some registers (generally those which can cause particularly serious problems if misused). This function disables that lock so updates can be performed. For maximum safety this should be done only when required. */
int wm8350_reg_unlock(struct wm8350 *wm8350) | {
u16 key = WM8350_UNLOCK_KEY;
int ret;
ldbg(__func__);
mutex_lock(&io_mutex);
ret = wm8350_write(wm8350, WM8350_SECURITY, 1, &key);
if (ret)
dev_err(wm8350->dev, "unlock failed\n");
mutex_unlock(&io_mutex);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Gets the states of the RTS modem control signals and trigger level.
The */ | unsigned long UARTModemControlGet(unsigned long ulBase) | /* Gets the states of the RTS modem control signals and trigger level.
The */
unsigned long UARTModemControlGet(unsigned long ulBase) | {
xASSERT(ulBase == UART0_BASE);
return(xHWREG(ulBase + USART_MCR) & (USART_MCR_DTR_L | USART_MCR_RTS_L));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* The MSI-X interrupt handler for an SGE response queue for the NAPI case (i.e., response queue serviced by NAPI polling). */ | static irqreturn_t t3_sge_intr_msix_napi(int irq, void *cookie) | /* The MSI-X interrupt handler for an SGE response queue for the NAPI case (i.e., response queue serviced by NAPI polling). */
static irqreturn_t t3_sge_intr_msix_napi(int irq, void *cookie) | {
struct sge_qset *qs = cookie;
struct sge_rspq *q = &qs->rspq;
spin_lock(&q->lock);
if (handle_responses(qs->adap, q) < 0)
q->unhandled_irqs++;
spin_unlock(&q->lock);
return IRQ_HANDLED;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Receive a piece of data in non-blocking way. */ | static void SAI_ReadNonBlocking(I2S_Type *base, uint32_t channel, uint32_t channelMask, uint32_t endChannel, uint32_t bitWidth, uint8_t *buffer, uint32_t size) | /* Receive a piece of data in non-blocking way. */
static void SAI_ReadNonBlocking(I2S_Type *base, uint32_t channel, uint32_t channelMask, uint32_t endChannel, uint32_t bitWidth, uint8_t *buffer, uint32_t size) | {
uint32_t i = 0;
uint8_t j = 0, m = 0;
uint8_t bytesPerWord = bitWidth / 8U;
uint32_t data = 0;
for (i = 0; i < size / bytesPerWord; i++)
{
for (j = channel; j <= endChannel; j++)
{
if ((1U << j) & channelMask)
{
data = base->RDR[j];
for (m = 0; m < bytesPerWord; m++)
{
*buffer = (data >> (8U * m)) & 0xFF;
buffer++;
}
}
}
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ | RETURN_STATUS EFIAPI SafeUintnToInt8(IN UINTN Operand, OUT INT8 *Result) | /* If the conversion results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUintnToInt8(IN UINTN Operand, OUT INT8 *Result) | {
RETURN_STATUS Status;
if (Result == NULL) {
return RETURN_INVALID_PARAMETER;
}
if (Operand <= MAX_INT8) {
*Result = (INT8)Operand;
Status = RETURN_SUCCESS;
} else {
*Result = INT8_ERROR;
Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This internal function checks if a Unicode character is a numeric character. The valid hexadecimal characters are L'0' to L'9', L'a' to L'f', or L'A' to L'F'. */ | BOOLEAN EFIAPI ShellIsHexaDecimalDigitCharacter(IN CHAR16 Char) | /* This internal function checks if a Unicode character is a numeric character. The valid hexadecimal characters are L'0' to L'9', L'a' to L'f', or L'A' to L'F'. */
BOOLEAN EFIAPI ShellIsHexaDecimalDigitCharacter(IN CHAR16 Char) | {
return (BOOLEAN)((Char >= L'0' && Char <= L'9') || (Char >= L'A' && Char <= L'F') || (Char >= L'a' && Char <= L'f'));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Function called in case of error detected in I2C IT Handler. */ | void Error_Callback(void) | /* Function called in case of error detected in I2C IT Handler. */
void Error_Callback(void) | {
LED_Blinking(LED_BLINK_ERROR);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* FINSH_OPTION_ECHO=0x01 is echo mode, other values are none-echo mode. */ | void finsh_set_echo(rt_uint32_t echo) | /* FINSH_OPTION_ECHO=0x01 is echo mode, other values are none-echo mode. */
void finsh_set_echo(rt_uint32_t echo) | {
RT_ASSERT(shell != RT_NULL);
shell->echo_mode = (rt_uint8_t)echo;
} | armink/FreeModbus_Slave-Master-RTT-STM32 | C++ | Other | 1,477 |
/* ADC group regular end of unitary conversion interruption callback. */ | void AdcGrpRegularUnitaryConvComplete_Callback() | /* ADC group regular end of unitary conversion interruption callback. */
void AdcGrpRegularUnitaryConvComplete_Callback() | {
uhADCxConvertedData = LL_ADC_REG_ReadConversionData12(ADC1);
uhADCxConvertedData_Voltage_mVolt = __LL_ADC_CALC_DATA_TO_VOLTAGE(VDDA_APPLI, uhADCxConvertedData, LL_ADC_RESOLUTION_12B);
ubAdcGrpRegularUnitaryConvStatus = 1;
LED_On();
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* This function is called before dram_init_banksize(), so we can't simply return gd->bd->bi_dram.start + gd->bd->bi_dram.size. */ | ulong board_get_usable_ram_top(ulong total_size) | /* This function is called before dram_init_banksize(), so we can't simply return gd->bd->bi_dram.start + gd->bd->bi_dram.size. */
ulong board_get_usable_ram_top(ulong total_size) | {
ulong ram_top;
ram_top = cboot_get_usable_ram_top(total_size);
if (ram_top > 0)
return ram_top;
return CONFIG_SYS_SDRAM_BASE + usable_ram_size_below_4g();
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Free send-queue completely. Parameter: card = pointer to card struct channel = channel number */ | static void icn_free_queue(icn_card *card, int channel) | /* Free send-queue completely. Parameter: card = pointer to card struct channel = channel number */
static void icn_free_queue(icn_card *card, int channel) | {
struct sk_buff_head *queue = &card->spqueue[channel];
struct sk_buff *skb;
skb_queue_purge(queue);
card->xlen[channel] = 0;
card->sndcount[channel] = 0;
if ((skb = card->xskb[channel])) {
card->xskb[channel] = NULL;
dev_kfree_skb(skb);
}
} | 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.