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
|
|---|---|---|---|---|---|---|---|
/* Fills each RTC_InitStruct member with its default value Hour format = 24h / Prescalers configured to their reset values. */
|
void RTC_StructInit(RTC_InitTypeDef *RTC_InitStruct)
|
/* Fills each RTC_InitStruct member with its default value Hour format = 24h / Prescalers configured to their reset values. */
void RTC_StructInit(RTC_InitTypeDef *RTC_InitStruct)
|
{
RTC_InitStruct->RTC_HourFormat = RTC_HourFormat_24;
RTC_InitStruct->RTC_AsynchPrediv = RTC_APRER_RESET_VALUE;
RTC_InitStruct->RTC_SynchPrediv = RTC_SPRERL_RESET_VALUE;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Set clock prescalers to safe values.
This should be done before switching to FLL/PLL as clock source to ensure that all clocks remain within the specified limits. */
|
static void set_safe_clock_dividers(void)
|
/* Set clock prescalers to safe values.
This should be done before switching to FLL/PLL as clock source to ensure that all clocks remain within the specified limits. */
static void set_safe_clock_dividers(void)
|
{
SIM->CLKDIV1 = (
SIM_CLKDIV1_OUTDIV1(CONFIG_CLOCK_K60_SYS_DIV) |
SIM_CLKDIV1_OUTDIV2(CONFIG_CLOCK_K60_BUS_DIV) |
SIM_CLKDIV1_OUTDIV3(CONFIG_CLOCK_K60_FB_DIV) |
SIM_CLKDIV1_OUTDIV4(CONFIG_CLOCK_K60_FLASH_DIV));
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Selects the clock input for the Hibernation module. */
|
void HibernateClockSelect(unsigned long ulClockInput)
|
/* Selects the clock input for the Hibernation module. */
void HibernateClockSelect(unsigned long ulClockInput)
|
{
ASSERT((ulClockInput == HIBERNATE_CLOCK_SEL_RAW) ||
(ulClockInput == HIBERNATE_CLOCK_SEL_DIV128));
HWREG(HIB_CTL) = ulClockInput | (HWREG(HIB_CTL) & ~HIB_CTL_CLKSEL);
}
|
watterott/WebRadio
|
C++
| null | 71
|
/* STUSB1602 checks the VCONN_MONITORING Enabling bit (bit7 0x20 */
|
VCONN_Monitoring_TypeDef STUSB1602_VCONN_Monitor_Status_Get(uint8_t Addr)
|
/* STUSB1602 checks the VCONN_MONITORING Enabling bit (bit7 0x20 */
VCONN_Monitoring_TypeDef STUSB1602_VCONN_Monitor_Status_Get(uint8_t Addr)
|
{
STUSB1602_VCONN_MONITORING_CTRL_RegTypeDef reg;
STUSB1602_ReadReg(®.d8, Addr, STUSB1602_VCONN_MONITORING_CTRL_REG, 1);
return (VCONN_Monitoring_TypeDef)(reg.b.VCONN_MONITORING_EN);
}
|
st-one/X-CUBE-USB-PD
|
C++
| null | 110
|
/* Writes data to the specified GPIO data port. */
|
void GPIO_Write(GPIO_Module *GPIOx, uint16_t PortVal)
|
/* Writes data to the specified GPIO data port. */
void GPIO_Write(GPIO_Module *GPIOx, uint16_t PortVal)
|
{
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
GPIOx->POD = PortVal;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Flushes a partially written page of data to physical FLASH, if a page boundary has been crossed. */
|
static void FlushPageIfRequired(void)
|
/* Flushes a partially written page of data to physical FLASH, if a page boundary has been crossed. */
static void FlushPageIfRequired(void)
|
{
if (!PageDirty)
return;
uint32_t NewPageStartAddress = (HEXParser.CurrAddress & ~(SPM_PAGESIZE - 1));
if (HEXParser.PageStartAddress != NewPageStartAddress)
{
BootloaderAPI_WritePage(HEXParser.PageStartAddress);
HEXParser.PageStartAddress = NewPageStartAddress;
PageDirty = false;
}
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* Calculates the altitude (in meters) from the specified atmospheric pressure (in hPa), sea-level pressure (in hPa), and temperature (in °C) */
|
float pressureToAltitude(float seaLevel, float atmospheric, float temp)
|
/* Calculates the altitude (in meters) from the specified atmospheric pressure (in hPa), sea-level pressure (in hPa), and temperature (in °C) */
float pressureToAltitude(float seaLevel, float atmospheric, float temp)
|
{
return (((float)pow((seaLevel/atmospheric), 0.190223F) - 1.0F)
* (temp + 273.15F)) / 0.0065F;
}
|
microbuilder/LPC11U_LPC13U_CodeBase
|
C++
|
Other
| 54
|
/* This function handles external line 0 interrupt request. */
|
void EXTI0_IRQHandler(void)
|
/* This function handles external line 0 interrupt request. */
void EXTI0_IRQHandler(void)
|
{
HAL_GPIO_EXTI_IRQHandler(USER_BUTTON_PIN);
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Just insert an item and return any "bits" bit key that hasn't been used before. */
|
int drm_ht_just_insert_please(struct drm_open_hash *ht, struct drm_hash_item *item, unsigned long seed, int bits, int shift, unsigned long add)
|
/* Just insert an item and return any "bits" bit key that hasn't been used before. */
int drm_ht_just_insert_please(struct drm_open_hash *ht, struct drm_hash_item *item, unsigned long seed, int bits, int shift, unsigned long add)
|
{
int ret;
unsigned long mask = (1 << bits) - 1;
unsigned long first, unshifted_key;
unshifted_key = hash_long(seed, bits);
first = unshifted_key;
do {
item->key = (unshifted_key << shift) + add;
ret = drm_ht_insert_item(ht, item);
if (ret)
unshifted_key = (unshifted_key + 1) & mask;
} while(ret && (unshifted_key != first));
if (ret) {
DRM_ERROR("Available key bit space exhausted\n");
return -EINVAL;
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Basic board specific setup. Pinmux has been handled already. */
|
int board_init(void)
|
/* Basic board specific setup. Pinmux has been handled already. */
int board_init(void)
|
{
gpio_request(ESC_KEY, "boot-key");
if (power_tps65217_init(0))
printf("WARN: cannot setup PMIC 0x24 @ bus #0, not found!.\n");
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* This function returns %0 on success and a negative error code on failure. */
|
int ubifs_recover_inl_heads(struct ubifs_info *c, void *sbuf)
|
/* This function returns %0 on success and a negative error code on failure. */
int ubifs_recover_inl_heads(struct ubifs_info *c, void *sbuf)
|
{
int err;
ubifs_assert(!c->ro_mount || c->remounting_rw);
dbg_rcvry("checking index head at %d:%d", c->ihead_lnum, c->ihead_offs);
err = recover_head(c, c->ihead_lnum, c->ihead_offs, sbuf);
if (err)
return err;
dbg_rcvry("checking LPT head at %d:%d", c->nhead_lnum, c->nhead_offs);
return recover_head(c, c->nhead_lnum, c->nhead_offs, sbuf);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Function for resetting the module variable(s) of the GSCM module. */
|
static void internal_state_reset(gscm_t *p_gscm)
|
/* Function for resetting the module variable(s) of the GSCM module. */
static void internal_state_reset(gscm_t *p_gscm)
|
{
memset(p_gscm, 0, sizeof(gscm_t));
p_gscm->current_sc_store_peer_id = PM_PEER_ID_INVALID;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Calculate time required to transmit buffer at a specific rate */
|
int rtnl_tc_calc_txtime(int bufsize, int rate)
|
/* Calculate time required to transmit buffer at a specific rate */
int rtnl_tc_calc_txtime(int bufsize, int rate)
|
{
double tx_time_secs;
tx_time_secs = (double) bufsize / (double) rate;
return tx_time_secs * 1000000.;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This is the same as __round_jiffies_relative() except that it will never round down. This is useful for timeouts for which the exact time of firing does not matter too much, as long as they don't fire too early. */
|
unsigned long __round_jiffies_up_relative(unsigned long j, int cpu)
|
/* This is the same as __round_jiffies_relative() except that it will never round down. This is useful for timeouts for which the exact time of firing does not matter too much, as long as they don't fire too early. */
unsigned long __round_jiffies_up_relative(unsigned long j, int cpu)
|
{
unsigned long j0 = jiffies;
return round_jiffies_common(j + j0, cpu, true) - j0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This subroutine resets the the soft iron transformation to unity matrix and disable the soft iron transformation process by default. */
|
void inv_reset_compass_soft_iron_matrix(void)
|
/* This subroutine resets the the soft iron transformation to unity matrix and disable the soft iron transformation process by default. */
void inv_reset_compass_soft_iron_matrix(void)
|
{
sensors.soft_iron.matrix_f[i] = 0.0f;
}
memset(&sensors.soft_iron.matrix_d,0,sizeof(sensors.soft_iron.matrix_d));
for (i=0; i<3; i++) {
sensors.soft_iron.matrix_f[i*4] = 1.0;
sensors.soft_iron.matrix_d[i*4] = ROT_MATRIX_SCALE_LONG;
}
inv_disable_compass_soft_iron_matrix();
}
|
Luos-io/luos_engine
|
C++
|
MIT License
| 496
|
/* Write a character trought UART in a blocking call. */
|
static int32_t usr_uart_write_block(struct uart_desc *desc, uint8_t data)
|
/* Write a character trought UART in a blocking call. */
static int32_t usr_uart_write_block(struct uart_desc *desc, uint8_t data)
|
{
int32_t ret;
const uint32_t buf_size = 1;
uint32_t hw_error;
if(desc->has_callback) {
ret = adi_uart_SubmitTxBuffer((ADI_UART_HANDLE const)h_uart_device,
&data, buf_size, DMA_NOT_USE);
if(ret != ADI_UART_SUCCESS)
return ret;
uart_tx_flying++;
while(uart_tx_flying > 0);
if(uart_tx_flying == 0)
return 0;
else
return -1;
} else {
return adi_uart_Write((ADI_UART_HANDLE const)h_uart_device, &data,
buf_size, DMA_NOT_USE, &hw_error);
}
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Used by the upper layer to verify the data in NAND Flash with the data in the buf. */
|
static int mxc_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
|
/* Used by the upper layer to verify the data in NAND Flash with the data in the buf. */
static int mxc_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
|
{
u_char tmp[256];
uint bsize;
while (len) {
bsize = min(len, 256);
mxc_nand_read_buf(mtd, tmp, bsize);
if (memcmp(buf, tmp, bsize))
return 1;
buf += bsize;
len -= bsize;
}
return 0;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Enable One-Shot mode and perform a single temperature measure. */
|
uint32_t mcp980x_one_shot_mode(void)
|
/* Enable One-Shot mode and perform a single temperature measure. */
uint32_t mcp980x_one_shot_mode(void)
|
{
uint8_t uc_config_reg = 0;
uint32_t ul_retval = mcp980x_get_configuration(&uc_config_reg);
if (ul_retval != TWI_SUCCESS) {
return ul_retval;
}
if (!(uc_config_reg & MCP980X_CONFIG_SHUTDOWN_ENABLE)) {
ul_retval = mcp980x_disable();
if (ul_retval != TWI_SUCCESS) {
return ul_retval;
}
uc_config_reg &= (~MCP980X_CONFIG_SHUTDOWN_ENABLE);
}
return mcp980x_set_configuration(MCP980X_CONFIG_ONE_SHOT_ENABLE | uc_config_reg);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Must be called with interrupt disabled and spinlock held */
|
static void dwc2_kill_urbs_in_qh_list(struct dwc2_hsotg *hsotg, struct list_head *qh_list)
|
/* Must be called with interrupt disabled and spinlock held */
static void dwc2_kill_urbs_in_qh_list(struct dwc2_hsotg *hsotg, struct list_head *qh_list)
|
{
struct dwc2_qh *qh, *qh_tmp;
struct dwc2_qtd *qtd, *qtd_tmp;
list_for_each_entry_safe(qh, qh_tmp, qh_list, qh_list_entry) {
list_for_each_entry_safe(qtd, qtd_tmp, &qh->qtd_list,
qtd_list_entry) {
dwc2_host_complete(hsotg, qtd, -ETIMEDOUT);
dwc2_hcd_qtd_unlink_and_free(hsotg, qtd, qh);
}
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* \classmethod af_list() Returns an array of alternate functions available for this pin. */
|
STATIC mp_obj_t pin_af_list(mp_obj_t self_in)
|
/* \classmethod af_list() Returns an array of alternate functions available for this pin. */
STATIC mp_obj_t pin_af_list(mp_obj_t self_in)
|
{
mp_obj_list_append(result, MP_OBJ_FROM_PTR(af));
}
return result;
}
|
micropython/micropython
|
C++
|
Other
| 18,334
|
/* Light weight way to stop tracing. Use in conjunction with tracing_start. */
|
void tracing_stop(void)
|
/* Light weight way to stop tracing. Use in conjunction with tracing_start. */
void tracing_stop(void)
|
{
struct ring_buffer *buffer;
unsigned long flags;
ftrace_stop();
spin_lock_irqsave(&tracing_start_lock, flags);
if (trace_stop_count++)
goto out;
buffer = global_trace.buffer;
if (buffer)
ring_buffer_record_disable(buffer);
buffer = max_tr.buffer;
if (buffer)
ring_buffer_record_disable(buffer);
out:
spin_unlock_irqrestore(&tracing_start_lock, flags);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Read the output port width of the TPIU.
This function uses the */
|
uint32_t am_hal_tpiu_port_width_get(void)
|
/* Read the output port width of the TPIU.
This function uses the */
uint32_t am_hal_tpiu_port_width_get(void)
|
{
uint32_t ui32Temp;
uint32_t ui32Width;
ui32Width = 1;
ui32Temp = AM_REG(TPIU, CSPSR);
while ( !(ui32Temp & 1) )
{
ui32Temp = ui32Temp >> 1;
ui32Width++;
if (ui32Width > 32)
{
ui32Width = 0;
break;
}
}
return ui32Width;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Clears the designated bits in a 16-bit write-protected data word at remote CPU system address */
|
uint16_t IPCLtoRClearBits_Protected(volatile tIpcController *psController, uint32_t ulAddress, uint32_t ulMask, uint16_t usLength, uint16_t bBlock)
|
/* Clears the designated bits in a 16-bit write-protected data word at remote CPU system address */
uint16_t IPCLtoRClearBits_Protected(volatile tIpcController *psController, uint32_t ulAddress, uint32_t ulMask, uint16_t usLength, uint16_t bBlock)
|
{
uint16_t status;
tIpcMessage sMessage;
sMessage.ulcommand = IPC_CLEAR_BITS_PROTECTED;
sMessage.uladdress = ulAddress;
sMessage.uldataw1 = (uint32_t)usLength;
sMessage.uldataw2 = ulMask;
status = IpcPut (psController, &sMessage, bBlock);
return status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This routine is called just prior to a HARD RESET to return all outstanding commands back to the Operating System. Caller should make sure that the following locks are released before this calling routine: Hardware lock, and io_request_lock. */
|
static void qla4xxx_flush_active_srbs(struct scsi_qla_host *ha)
|
/* This routine is called just prior to a HARD RESET to return all outstanding commands back to the Operating System. Caller should make sure that the following locks are released before this calling routine: Hardware lock, and io_request_lock. */
static void qla4xxx_flush_active_srbs(struct scsi_qla_host *ha)
|
{
struct srb *srb;
int i;
unsigned long flags;
spin_lock_irqsave(&ha->hardware_lock, flags);
for (i = 0; i < ha->host->can_queue; i++) {
srb = qla4xxx_del_from_active_array(ha, i);
if (srb != NULL) {
srb->cmd->result = DID_RESET << 16;
qla4xxx_srb_compl(ha, srb);
}
}
spin_unlock_irqrestore(&ha->hardware_lock, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Helper function for checking if particular entity is a part of the audio device.
This function checks if given entity is a part of given audio device. If so then true is returned and audio_dev_data is considered correct device data. */
|
static bool is_entity_valid(struct usb_audio_dev_data *audio_dev_data, struct usb_audio_entity *entity)
|
/* Helper function for checking if particular entity is a part of the audio device.
This function checks if given entity is a part of given audio device. If so then true is returned and audio_dev_data is considered correct device data. */
static bool is_entity_valid(struct usb_audio_dev_data *audio_dev_data, struct usb_audio_entity *entity)
|
{
const struct cs_ac_if_descriptor *header;
const struct feature_unit_descriptor *fu;
header = audio_dev_data->desc_hdr;
fu = (struct feature_unit_descriptor *)((uint8_t *)header +
header->bLength +
INPUT_TERMINAL_DESC_SIZE);
if (fu->bUnitID == entity->id) {
entity->subtype = fu->bDescriptorSubtype;
return true;
}
if (header->bInCollection == 2) {
fu = (struct feature_unit_descriptor *)((uint8_t *)fu +
fu->bLength +
INPUT_TERMINAL_DESC_SIZE +
OUTPUT_TERMINAL_DESC_SIZE);
if (fu->bUnitID == entity->id) {
entity->subtype = fu->bDescriptorSubtype;
return true;
}
}
return false;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* On paper, memory read barriers may be needed here to prevent out of order LOADs by the CPU from having prefetched stale data prior to DMA having occurred. */
|
static int sym_wakeup_done(struct sym_hcb *np)
|
/* On paper, memory read barriers may be needed here to prevent out of order LOADs by the CPU from having prefetched stale data prior to DMA having occurred. */
static int sym_wakeup_done(struct sym_hcb *np)
|
{
struct sym_ccb *cp;
int i, n;
u32 dsa;
n = 0;
i = np->dqueueget;
while (1) {
dsa = scr_to_cpu(np->dqueue[i]);
if (!dsa)
break;
np->dqueue[i] = 0;
if ((i = i+2) >= MAX_QUEUE*2)
i = 0;
cp = sym_ccb_from_dsa(np, dsa);
if (cp) {
MEMORY_READ_BARRIER();
sym_complete_ok (np, cp);
++n;
}
else
printf ("%s: bad DSA (%x) in done queue.\n",
sym_name(np), (u_int) dsa);
}
np->dqueueget = i;
return n;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Serializes the current instance of #CRSelector to a file. */
|
void cr_selector_dump(CRSelector *a_this, FILE *a_fp)
|
/* Serializes the current instance of #CRSelector to a file. */
void cr_selector_dump(CRSelector *a_this, FILE *a_fp)
|
{
guchar *tmp_buf = NULL;
if (a_this) {
tmp_buf = cr_selector_to_string (a_this);
if (tmp_buf) {
fprintf (a_fp, "%s", tmp_buf);
g_free (tmp_buf);
tmp_buf = NULL;
}
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This function tries to make a free PEB by means of synchronous execution of pending works. This may be needed if, for example the background thread is disabled. Returns zero in case of success and a negative error code in case of failure. */
|
static int produce_free_peb(struct ubi_device *ubi)
|
/* This function tries to make a free PEB by means of synchronous execution of pending works. This may be needed if, for example the background thread is disabled. Returns zero in case of success and a negative error code in case of failure. */
static int produce_free_peb(struct ubi_device *ubi)
|
{
int err;
while (!ubi->free.rb_node && ubi->works_count) {
spin_unlock(&ubi->wl_lock);
dbg_wl("do one work synchronously");
err = do_work(ubi);
spin_lock(&ubi->wl_lock);
if (err)
return err;
}
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Lock the scheduler when preemptive threads are running.
Create 3 threads and lock the scheduler. Make sure that the threads are not executed. Call k_sleep() and check if the threads have executed. */
|
ZTEST(threads_scheduling, test_lock_preemptible)
|
/* Lock the scheduler when preemptive threads are running.
Create 3 threads and lock the scheduler. Make sure that the threads are not executed. Call k_sleep() and check if the threads have executed. */
ZTEST(threads_scheduling, test_lock_preemptible)
|
{
init_prio = 0;
setup_threads();
k_sched_lock();
spawn_threads(0);
k_busy_wait(100000);
for (int i = 0; i < THREADS_NUM; i++) {
zassert_true(tdata[i].executed == 0);
}
k_sleep(K_MSEC(100));
for (int i = 0; i < THREADS_NUM; i++) {
zassert_true(tdata[i].executed == 1);
}
teardown_threads();
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Return: 0 if successful. A negative error code otherwise. */
|
void usb_gen_hcd_init(void)
|
/* Return: 0 if successful. A negative error code otherwise. */
void usb_gen_hcd_init(void)
|
{
usb_bus_list_lock = hal_sem_create(1);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If a user window larger than sensor window is requested, we'll increase the sensor window. */
|
static int mt9t031_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
/* If a user window larger than sensor window is requested, we'll increase the sensor window. */
static int mt9t031_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
{
v4l_bound_align_image(
&mf->width, MT9T031_MIN_WIDTH, MT9T031_MAX_WIDTH, 1,
&mf->height, MT9T031_MIN_HEIGHT, MT9T031_MAX_HEIGHT, 1, 0);
mf->code = V4L2_MBUS_FMT_SBGGR10_1X10;
mf->colorspace = V4L2_COLORSPACE_SRGB;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Attempt to send a target reset message to the device that timed out. */
|
static int ahc_linux_dev_reset(struct scsi_cmnd *cmd)
|
/* Attempt to send a target reset message to the device that timed out. */
static int ahc_linux_dev_reset(struct scsi_cmnd *cmd)
|
{
int error;
error = ahc_linux_queue_recovery_cmd(cmd, SCB_DEVICE_RESET);
if (error != 0)
printf("aic7xxx_dev_reset returns 0x%x\n", error);
return (error);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Initializes the CMP user configuration structure.
This function initializes the user configuration structure to these default values. */
|
void CMP_GetDefaultConfig(cmp_config_t *config)
|
/* Initializes the CMP user configuration structure.
This function initializes the user configuration structure to these default values. */
void CMP_GetDefaultConfig(cmp_config_t *config)
|
{
(void)memset(config, 0, sizeof(*config));
config->enableHysteresis = true;
config->enableLowPower = true;
config->filterClockDivider = kCMP_FilterClockDivide1;
config->filterSampleMode = kCMP_FilterSampleMode0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Written 1992,1993 by Werner Almesberger - Fixed fat_date_unix2dos for dates earlier than and date_dos2unix for date==0 by Igor Zhbanov( */
|
void fat_fs_error(struct super_block *s, const char *fmt,...)
|
/* Written 1992,1993 by Werner Almesberger - Fixed fat_date_unix2dos for dates earlier than and date_dos2unix for date==0 by Igor Zhbanov( */
void fat_fs_error(struct super_block *s, const char *fmt,...)
|
{
struct fat_mount_options *opts = &MSDOS_SB(s)->options;
va_list args;
printk(KERN_ERR "FAT: Filesystem error (dev %s)\n", s->s_id);
printk(KERN_ERR " ");
va_start(args, fmt);
vprintk(fmt, args);
va_end(args);
printk("\n");
if (opts->errors == FAT_ERRORS_PANIC)
panic(" FAT fs panic from previous error\n");
else if (opts->errors == FAT_ERRORS_RO && !(s->s_flags & MS_RDONLY)) {
s->s_flags |= MS_RDONLY;
printk(KERN_ERR " File system has been set read-only\n");
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Prepares a host channel for transferring packets to/from a specific endpoint. The HCCHARn register is set up with the characteristics specified in _hc. Host channel interrupts that may need to be serviced while this transfer is in progress are enabled. */
|
static void dwc_otg_hc_init(struct dwc2_core_regs *regs, uint8_t hc_num, struct usb_device *dev, uint8_t dev_addr, uint8_t ep_num, uint8_t ep_is_in, uint8_t ep_type, uint16_t max_packet)
|
/* Prepares a host channel for transferring packets to/from a specific endpoint. The HCCHARn register is set up with the characteristics specified in _hc. Host channel interrupts that may need to be serviced while this transfer is in progress are enabled. */
static void dwc_otg_hc_init(struct dwc2_core_regs *regs, uint8_t hc_num, struct usb_device *dev, uint8_t dev_addr, uint8_t ep_num, uint8_t ep_is_in, uint8_t ep_type, uint16_t max_packet)
|
{
struct dwc2_hc_regs *hc_regs = ®s->hc_regs[hc_num];
uint32_t hcchar = (dev_addr << DWC2_HCCHAR_DEVADDR_OFFSET) |
(ep_num << DWC2_HCCHAR_EPNUM_OFFSET) |
(ep_is_in << DWC2_HCCHAR_EPDIR_OFFSET) |
(ep_type << DWC2_HCCHAR_EPTYPE_OFFSET) |
(max_packet << DWC2_HCCHAR_MPS_OFFSET);
if (dev->speed == USB_SPEED_LOW)
hcchar |= DWC2_HCCHAR_LSPDDEV;
writel(hcchar, &hc_regs->hcchar);
writel(0, &hc_regs->hcsplt);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Function that performs the command of writing string to EEPROM.
Function gets user input and writes given string to EEPROM starting from address 0. It is accessing EEPROM using maximum allowed number of bytes in sequence. */
|
static void do_string_write(void)
|
/* Function that performs the command of writing string to EEPROM.
Function gets user input and writes given string to EEPROM starting from address 0. It is accessing EEPROM using maximum allowed number of bytes in sequence. */
static void do_string_write(void)
|
{
char str[(EEPROM_SIM_SIZE) + 1];
size_t addr = 0;
NRF_LOG_RAW_INFO("Waiting for string to write:\r\n");
NRF_LOG_FLUSH();
safe_gets(str, sizeof(str) - 1);
while (1)
{
ret_code_t err_code;
size_t to_write = safe_strlen(str + addr, EEPROM_SIM_SEQ_WRITE_MAX);
if (0 == to_write)
break;
err_code = eeprom_write(addr, (uint8_t const *)str + addr, to_write);
if (NRF_SUCCESS != err_code)
{
NRF_LOG_WARNING("Communication error\r\n");
return;
}
addr += to_write;
}
NRF_LOG_RAW_INFO("OK\r\n");
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* If Length > 0 and Buffer is NULL, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
|
VOID* EFIAPI ScanMem8(IN CONST VOID *Buffer, IN UINTN Length, IN UINT8 Value)
|
/* If Length > 0 and Buffer is NULL, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
VOID* EFIAPI ScanMem8(IN CONST VOID *Buffer, IN UINTN Length, IN UINT8 Value)
|
{
if (Length == 0) {
return NULL;
}
ASSERT (Buffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
return (VOID *)InternalMemScanMem8 (Buffer, Length, Value);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* These are the "repeat MMIO read/write" functions. Note the "__raw" accesses, since we don't want to convert to CPU byte order. We write in "IO byte
order" (we also don't have IO barriers). */
|
static void mmio_insb(void __iomem *addr, u8 *dst, int count)
|
/* These are the "repeat MMIO read/write" functions. Note the "__raw" accesses, since we don't want to convert to CPU byte order. We write in "IO byte
order" (we also don't have IO barriers). */
static void mmio_insb(void __iomem *addr, u8 *dst, int count)
|
{
while (--count >= 0) {
u8 data = __raw_readb(addr);
*dst = data;
dst++;
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Initializes the SPI in master mode.
Support and FAQ: visit */
|
void spi_master_init(volatile void *spi)
|
/* Initializes the SPI in master mode.
Support and FAQ: visit */
void spi_master_init(volatile void *spi)
|
{
sysclk_enable_module(POWER_RED_REG0, PRSPI_bm);
spi_enable_master_mode(spi);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Failure to call this function after a reset may lead to incorrect operation or permanent data loss if the EEPROM is later written. */
|
uint32_t EEPROMInit(void)
|
/* Failure to call this function after a reset may lead to incorrect operation or permanent data loss if the EEPROM is later written. */
uint32_t EEPROMInit(void)
|
{
uint32_t ui32Status;
SysCtlDelay(2);
_EEPROMWaitForDone();
ui32Status = HWREG(EEPROM_EESUPP);
if(ui32Status & (EEPROM_EESUPP_PRETRY | EEPROM_EESUPP_ERETRY))
{
SysCtlPeripheralReset(SYSCTL_PERIPH_EEPROM0);
SysCtlDelay(2);
_EEPROMWaitForDone();
ui32Status = HWREG(EEPROM_EESUPP);
if(ui32Status & (EEPROM_EESUPP_PRETRY | EEPROM_EESUPP_ERETRY))
{
return(EEPROM_INIT_ERROR);
}
else
{
return(EEPROM_INIT_RETRY);
}
}
return(EEPROM_INIT_OK);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* btrfs_search_slot will keep the lock held on higher nodes in a few corner cases, such as COW of the block at slot zero in the node. This ignores those rules, and it should only be called when there are no more updates to be done higher up in the tree. */
|
noinline void btrfs_unlock_up_safe(struct btrfs_path *path, int level)
|
/* btrfs_search_slot will keep the lock held on higher nodes in a few corner cases, such as COW of the block at slot zero in the node. This ignores those rules, and it should only be called when there are no more updates to be done higher up in the tree. */
noinline void btrfs_unlock_up_safe(struct btrfs_path *path, int level)
|
{
int i;
if (path->keep_locks)
return;
for (i = level; i < BTRFS_MAX_LEVEL; i++) {
if (!path->nodes[i])
continue;
if (!path->locks[i])
continue;
btrfs_tree_unlock(path->nodes[i]);
path->locks[i] = 0;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Find the CacheEntry which matches the requirements in the specified CacheTable. */
|
ARP_CACHE_ENTRY* ArpFindNextCacheEntryInTable(IN LIST_ENTRY *CacheTable, IN LIST_ENTRY *StartEntry, IN FIND_OPTYPE FindOpType, IN NET_ARP_ADDRESS *ProtocolAddress OPTIONAL, IN NET_ARP_ADDRESS *HardwareAddress OPTIONAL)
|
/* Find the CacheEntry which matches the requirements in the specified CacheTable. */
ARP_CACHE_ENTRY* ArpFindNextCacheEntryInTable(IN LIST_ENTRY *CacheTable, IN LIST_ENTRY *StartEntry, IN FIND_OPTYPE FindOpType, IN NET_ARP_ADDRESS *ProtocolAddress OPTIONAL, IN NET_ARP_ADDRESS *HardwareAddress OPTIONAL)
|
{
LIST_ENTRY *Entry;
ARP_CACHE_ENTRY *CacheEntry;
if (StartEntry == NULL) {
StartEntry = CacheTable;
}
for (Entry = StartEntry->ForwardLink; Entry != CacheTable; Entry = Entry->ForwardLink) {
CacheEntry = NET_LIST_USER_STRUCT (Entry, ARP_CACHE_ENTRY, List);
if ((FindOpType & MATCH_SW_ADDRESS) != 0) {
if (!ArpMatchAddress (ProtocolAddress, &CacheEntry->Addresses[Protocol])) {
continue;
}
}
if ((FindOpType & MATCH_HW_ADDRESS) != 0) {
if (!ArpMatchAddress (HardwareAddress, &CacheEntry->Addresses[Hardware])) {
continue;
}
}
return CacheEntry;
}
return NULL;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* In this function the global data, responsible for internal representation of the ext4 data are initialized to the reset state. Without this, during replacement of the smaller file with the bigger truncation of new file was performed. */
|
void ext4fs_reinit_global(void)
|
/* In this function the global data, responsible for internal representation of the ext4 data are initialized to the reset state. Without this, during replacement of the smaller file with the bigger truncation of new file was performed. */
void ext4fs_reinit_global(void)
|
{
if (ext4fs_indir1_block != NULL) {
free(ext4fs_indir1_block);
ext4fs_indir1_block = NULL;
ext4fs_indir1_size = 0;
ext4fs_indir1_blkno = -1;
}
if (ext4fs_indir2_block != NULL) {
free(ext4fs_indir2_block);
ext4fs_indir2_block = NULL;
ext4fs_indir2_size = 0;
ext4fs_indir2_blkno = -1;
}
if (ext4fs_indir3_block != NULL) {
free(ext4fs_indir3_block);
ext4fs_indir3_block = NULL;
ext4fs_indir3_size = 0;
ext4fs_indir3_blkno = -1;
}
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Clean up device state and report to callback. */
|
static void ccwreq_stop(struct ccw_device *cdev, int rc)
|
/* Clean up device state and report to callback. */
static void ccwreq_stop(struct ccw_device *cdev, int rc)
|
{
struct ccw_request *req = &cdev->private->req;
if (req->done)
return;
req->done = 1;
ccw_device_set_timeout(cdev, 0);
memset(&cdev->private->irb, 0, sizeof(struct irb));
if (rc && rc != -ENODEV && req->drc)
rc = req->drc;
req->callback(cdev, req->data, rc);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Convenience function for receiving data from the AC97 codec. */
|
unsigned short AC97C_ReadCodec(unsigned char address)
|
/* Convenience function for receiving data from the AC97 codec. */
unsigned short AC97C_ReadCodec(unsigned char address)
|
{
unsigned int sample;
sample = AT91C_AC97C_READ | (address << 16);
AC97C_Transfer(AC97C_CODEC_TRANSFER, (unsigned char *) &sample, 1, 0, 0);
while (!AC97C_IsFinished(AC97C_CODEC_TRANSFER));
return sample;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Reads and returns the current value of the EFLAGS register. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */
|
UINTN EFIAPI AsmReadEflags(VOID)
|
/* Reads and returns the current value of the EFLAGS register. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */
UINTN EFIAPI AsmReadEflags(VOID)
|
{
__asm {
pushfd
pop eax
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Disable USB Endpoint Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
|
void USBD_DisableEP(U32 EPNum)
|
/* Disable USB Endpoint Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_DisableEP(U32 EPNum)
|
{
EP_Status(EPNum, EP_TX_DIS | EP_RX_DIS);
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* Send GET_INTERFACE_CONDITION command.
This function checks card interface condition, which includes host supply voltage information and asks the card whether it supports voltage. */
|
static status_t SDSPI_SendInterfaceCondition(sdspi_card_t *card, uint8_t pattern, uint8_t *response)
|
/* Send GET_INTERFACE_CONDITION command.
This function checks card interface condition, which includes host supply voltage information and asks the card whether it supports voltage. */
static status_t SDSPI_SendInterfaceCondition(sdspi_card_t *card, uint8_t pattern, uint8_t *response)
|
{
assert(card);
assert(card->host);
sdspi_command_t command = {0};
sdspi_host_t *host;
host = card->host;
command.index = kSD_SendInterfaceCondition;
command.argument = (0x100U | (pattern & 0xFFU));
command.responseType = kSDSPI_ResponseTypeR7;
if (kStatus_Success != SDSPI_SendCommand(host, &command, FSL_SDSPI_TIMEOUT))
{
return kStatus_SDSPI_SendCommandFailed;
}
memcpy(response, command.response, sizeof(command.response));
return kStatus_Success;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* ixgbe_set_vmdq_82598 - Associate a VMDq set index with a rx address @hw: pointer to hardware struct @rar: receive address register index to associate with a VMDq index @vmdq: VMDq set index */
|
static s32 ixgbe_set_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
|
/* ixgbe_set_vmdq_82598 - Associate a VMDq set index with a rx address @hw: pointer to hardware struct @rar: receive address register index to associate with a VMDq index @vmdq: VMDq set index */
static s32 ixgbe_set_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
|
{
u32 rar_high;
rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(rar));
rar_high &= ~IXGBE_RAH_VIND_MASK;
rar_high |= ((vmdq << IXGBE_RAH_VIND_SHIFT) & IXGBE_RAH_VIND_MASK);
IXGBE_WRITE_REG(hw, IXGBE_RAH(rar), rar_high);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Derived from Beagle Board and 3430 SDP code by Richard Woodruff <r-woodruff2 at ti.com> Syed Mohammed Khasim <khasim at ti.com> Power Reset */
|
void twl4030_power_reset_init(void)
|
/* Derived from Beagle Board and 3430 SDP code by Richard Woodruff <r-woodruff2 at ti.com> Syed Mohammed Khasim <khasim at ti.com> Power Reset */
void twl4030_power_reset_init(void)
|
{
u8 val = 0;
if (twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER, &val,
TWL4030_PM_MASTER_P1_SW_EVENTS)) {
printf("Error:TWL4030: failed to read the power register\n");
printf("Could not initialize hardware reset\n");
} else {
val |= TWL4030_PM_MASTER_SW_EVENTS_STOPON_PWRON;
if (twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, val,
TWL4030_PM_MASTER_P1_SW_EVENTS)) {
printf("Error:TWL4030: failed to write the power register\n");
printf("Could not initialize hardware reset\n");
}
}
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* list_del_init - deletes entry from list and reinitialize it. @entry: the element to delete from the list. */
|
static void list_del_init(struct list_head *entry)
|
/* list_del_init - deletes entry from list and reinitialize it. @entry: the element to delete from the list. */
static void list_del_init(struct list_head *entry)
|
{
__list_del(entry->prev, entry->next);
INIT_LIST_HEAD(entry);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function returns the data to be stored in non-volatile memory between power off */
|
static inv_error_t inv_db_save_func(unsigned char *data)
|
/* This function returns the data to be stored in non-volatile memory between power off */
static inv_error_t inv_db_save_func(unsigned char *data)
|
{
memcpy(data, &inv_data_builder.save, sizeof(inv_data_builder.save));
return INV_SUCCESS;
}
|
Luos-io/luos_engine
|
C++
|
MIT License
| 496
|
/* Read Data from RXD register.
Reads one byte from reception buffer. This API is only available if I2C_MODE_LEGACY is activated. */
|
uint8_t i2c_get_data(uint32_t i2c)
|
/* Read Data from RXD register.
Reads one byte from reception buffer. This API is only available if I2C_MODE_LEGACY is activated. */
uint8_t i2c_get_data(uint32_t i2c)
|
{
return (uint8_t)I2C_RXD(i2c);
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* checks whether destination address filter failed in the rx frame. */
|
bool synopGMAC_is_da_filter_failed(DmaDesc *desc)
|
/* checks whether destination address filter failed in the rx frame. */
bool synopGMAC_is_da_filter_failed(DmaDesc *desc)
|
{
return ((desc -> status & DescDAFilterFail) == DescDAFilterFail);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Initialize both the 32-bit and 31-bit LFSRs with a non-zero seed value. */
|
static void TbxRandomInitLFSRs(void)
|
/* Initialize both the 32-bit and 31-bit LFSRs with a non-zero seed value. */
static void TbxRandomInitLFSRs(void)
|
{
uint32_t seedLFSR32 = 0xABCDEUL;
uint32_t seedLFSR31 = 0x23456789UL;
if (tbxRandomSeedInitHandler != NULL)
{
seedLFSR32 = tbxRandomSeedInitHandler();
seedLFSR31 = tbxRandomSeedInitHandler();
}
if (seedLFSR32 == 0U)
{
seedLFSR32 = 0xABCDEUL;
}
if (seedLFSR31 == 0U)
{
seedLFSR31 = 0x23456789UL;
}
tbxRandomNumberLFSR32 = seedLFSR32;
tbxRandomNumberLFSR31 = seedLFSR31;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Get the current state of a hat on a joystick */
|
Uint8 SDL_JoystickGetHat(SDL_Joystick *joystick, int hat)
|
/* Get the current state of a hat on a joystick */
Uint8 SDL_JoystickGetHat(SDL_Joystick *joystick, int hat)
|
{
Uint8 state;
if ( ! ValidJoystick(&joystick) ) {
return(0);
}
if ( hat < joystick->nhats ) {
state = joystick->hats[hat];
} else {
SDL_SetError("Joystick only has %d hats", joystick->nhats);
state = 0;
}
return(state);
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* Release the PMU if this is the last perf_event. */
|
static void hw_perf_event_destroy(struct perf_event *event)
|
/* Release the PMU if this is the last perf_event. */
static void hw_perf_event_destroy(struct perf_event *event)
|
{
if (!atomic_add_unless(&num_events, -1, 1)) {
mutex_lock(&pmc_reserve_mutex);
if (atomic_dec_return(&num_events) == 0)
release_pmc_hardware();
mutex_unlock(&pmc_reserve_mutex);
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* returns: 0 on success Negative error code on failure */
|
static int overlay_adjust_local_phandles(void *fdto, uint32_t delta)
|
/* returns: 0 on success Negative error code on failure */
static int overlay_adjust_local_phandles(void *fdto, uint32_t delta)
|
{
return overlay_adjust_node_phandles(fdto, 0, delta);
}
|
xboot/xboot
|
C++
|
MIT License
| 779
|
/* UART MSP Initialization This function configures the hardware resources used in this example. */
|
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
|
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
|
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(huart->Instance==USART1)
{
__HAL_RCC_USART1_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_10;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
HAL_NVIC_SetPriority(USART1_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(USART1_IRQn);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Prepend drive letters to path names This function returns new path path pointers, pointing to a temporary buffer inside ctx. */
|
static void prepend_drive_to_path(vfs_fat_ctx_t *ctx, const char **path, const char **path2)
|
/* Prepend drive letters to path names This function returns new path path pointers, pointing to a temporary buffer inside ctx. */
static void prepend_drive_to_path(vfs_fat_ctx_t *ctx, const char **path, const char **path2)
|
{
snprintf(ctx->tmp_path_buf2, sizeof(ctx->tmp_path_buf2), "%s%s", ((vfs_fat_ctx_t*)ctx)->fat_drive, *path2);
*path2 = ctx->tmp_path_buf2;
}
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* Configure the timestamp capture point, at the start or the end of frame. */
|
void can_set_timestamp_capture_point(Can *p_can, uint32_t ul_flag)
|
/* Configure the timestamp capture point, at the start or the end of frame. */
void can_set_timestamp_capture_point(Can *p_can, uint32_t ul_flag)
|
{
if (ul_flag) {
p_can->CAN_MR |= CAN_MR_TEOF;
} else {
p_can->CAN_MR &= ~CAN_MR_TEOF;
}
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* The drop_overlaps_that_are_ok() call here isn't really needed. It would be needed if we had two colliding 'overlap_ok' reservations, so that the second such would not panic on the overlap with the first. We don't have any such as of this writing, but might as well tolerate such if it happens in the future. */
|
void __init reserve_early_overlap_ok(u64 start, u64 end, char *name)
|
/* The drop_overlaps_that_are_ok() call here isn't really needed. It would be needed if we had two colliding 'overlap_ok' reservations, so that the second such would not panic on the overlap with the first. We don't have any such as of this writing, but might as well tolerate such if it happens in the future. */
void __init reserve_early_overlap_ok(u64 start, u64 end, char *name)
|
{
drop_overlaps_that_are_ok(start, end);
__reserve_early(start, end, name, 1);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Sets the value of the real time clock (RTC) counter. */
|
void HibernateRTCSet(uint32_t ui32RTCValue)
|
/* Sets the value of the real time clock (RTC) counter. */
void HibernateRTCSet(uint32_t ui32RTCValue)
|
{
HWREG(HIB_LOCK) = HIB_LOCK_HIBLOCK_KEY;
_HibernateWriteComplete();
HWREG(HIB_RTCLD) = ui32RTCValue;
_HibernateWriteComplete();
HWREG(HIB_LOCK) = 0;
_HibernateWriteComplete();
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Translate an array of OpenFirmware device nodes to a UEFI device path fragment. */
|
STATIC RETURN_STATUS TranslateOfwNodes(IN CONST OFW_NODE *OfwNode, IN UINTN NumNodes, IN CONST EXTRA_ROOT_BUS_MAP *ExtraPciRoots, OUT CHAR16 *Translated, IN OUT UINTN *TranslatedSize)
|
/* Translate an array of OpenFirmware device nodes to a UEFI device path fragment. */
STATIC RETURN_STATUS TranslateOfwNodes(IN CONST OFW_NODE *OfwNode, IN UINTN NumNodes, IN CONST EXTRA_ROOT_BUS_MAP *ExtraPciRoots, OUT CHAR16 *Translated, IN OUT UINTN *TranslatedSize)
|
{
RETURN_STATUS Status;
Status = RETURN_UNSUPPORTED;
if (FeaturePcdGet (PcdQemuBootOrderPciTranslation)) {
Status = TranslatePciOfwNodes (
OfwNode,
NumNodes,
ExtraPciRoots,
Translated,
TranslatedSize
);
}
if ((Status == RETURN_UNSUPPORTED) &&
FeaturePcdGet (PcdQemuBootOrderMmioTranslation))
{
Status = TranslateMmioOfwNodes (
OfwNode,
NumNodes,
Translated,
TranslatedSize
);
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* memory allocation using multiple pages (for synth) Unlike the DMA allocation above, non-contiguous pages are assined. allocate a synth sample area */
|
struct snd_util_memblk* snd_emu10k1_synth_alloc(struct snd_emu10k1 *hw, unsigned int size)
|
/* memory allocation using multiple pages (for synth) Unlike the DMA allocation above, non-contiguous pages are assined. allocate a synth sample area */
struct snd_util_memblk* snd_emu10k1_synth_alloc(struct snd_emu10k1 *hw, unsigned int size)
|
{
struct snd_emu10k1_memblk *blk;
struct snd_util_memhdr *hdr = hw->memhdr;
mutex_lock(&hdr->block_mutex);
blk = (struct snd_emu10k1_memblk *)__snd_util_mem_alloc(hdr, size);
if (blk == NULL) {
mutex_unlock(&hdr->block_mutex);
return NULL;
}
if (synth_alloc_pages(hw, blk)) {
__snd_util_mem_free(hdr, (struct snd_util_memblk *)blk);
mutex_unlock(&hdr->block_mutex);
return NULL;
}
snd_emu10k1_memblk_map(hw, blk);
mutex_unlock(&hdr->block_mutex);
return (struct snd_util_memblk *)blk;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enable hw supervised mode for all clockdomains if it's supported. Initiate sleep transition for other clockdomains, if they are not used */
|
static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
|
/* Enable hw supervised mode for all clockdomains if it's supported. Initiate sleep transition for other clockdomains, if they are not used */
static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
|
{
if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO)
omap2_clkdm_allow_idle(clkdm);
else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
atomic_read(&clkdm->usecount) == 0)
omap2_clkdm_sleep(clkdm);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Level triggered interrupts on GPIO lines can only be cleared when the interrupt condition disappears. */
|
static void ixp23xx_irq_level_unmask(unsigned int irq)
|
/* Level triggered interrupts on GPIO lines can only be cleared when the interrupt condition disappears. */
static void ixp23xx_irq_level_unmask(unsigned int irq)
|
{
volatile unsigned long *intr_reg;
ixp23xx_irq_ack(irq);
if (irq >= 56)
irq += 8;
intr_reg = IXP23XX_INTR_EN1 + (irq / 32);
*intr_reg |= (1 << (irq % 32));
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* triggers start of the disconnect procedures and wait for them to be done */
|
void iser_conn_terminate(struct iser_conn *ib_conn)
|
/* triggers start of the disconnect procedures and wait for them to be done */
void iser_conn_terminate(struct iser_conn *ib_conn)
|
{
int err = 0;
iser_conn_state_comp_exch(ib_conn, ISER_CONN_UP, ISER_CONN_TERMINATING);
err = rdma_disconnect(ib_conn->cma_id);
if (err)
iser_err("Failed to disconnect, conn: 0x%p err %d\n",
ib_conn,err);
wait_event_interruptible(ib_conn->wait,
ib_conn->state == ISER_CONN_DOWN);
iser_conn_put(ib_conn);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* switch in system clock out of ISR context. */
|
static void SwitchSystemClock(void)
|
/* switch in system clock out of ISR context. */
static void SwitchSystemClock(void)
|
{
if (__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSI)
{
SystemClockHSE_Config();
}
else if (__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSE)
{
SystemClockHSI_Config();
}
SwitchClock = RESET;
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Function for aborting current application/bootloader jump to to other app/bootloader.
This functions will use the address provide to swap the stack pointer and then load the address of the reset handler to be executed. It will check current system mode (thread/handler) and if in thread mode it will reset into other application. If in handler mode isr_abort will be executed to ensure correct exit of handler mode and jump into reset handler of other application. */
|
void bootloader_util_app_start(uint32_t start_addr)
|
/* Function for aborting current application/bootloader jump to to other app/bootloader.
This functions will use the address provide to swap the stack pointer and then load the address of the reset handler to be executed. It will check current system mode (thread/handler) and if in thread mode it will reset into other application. If in handler mode isr_abort will be executed to ensure correct exit of handler mode and jump into reset handler of other application. */
void bootloader_util_app_start(uint32_t start_addr)
|
{
bootloader_util_reset(start_addr);
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Find the handler for the prefix and dispatch its set() operation to remove any associated extended attribute. */
|
int generic_removexattr(struct dentry *dentry, const char *name)
|
/* Find the handler for the prefix and dispatch its set() operation to remove any associated extended attribute. */
int generic_removexattr(struct dentry *dentry, const char *name)
|
{
struct xattr_handler *handler;
handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
if (!handler)
return -EOPNOTSUPP;
return handler->set(dentry, name, NULL, 0,
XATTR_REPLACE, handler->flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* ISR called when the SPI peripheral transitions from the transferring state to the IDLE state. */
|
void spi_tei_isr(void)
|
/* ISR called when the SPI peripheral transitions from the transferring state to the IDLE state. */
void spi_tei_isr(void)
|
{
FSP_CONTEXT_SAVE;
IRQn_Type irq = R_FSP_CurrentIrqGet();
R_BSP_IrqStatusClear(irq);
spi_instance_ctrl_t * p_ctrl = (spi_instance_ctrl_t *) R_FSP_IsrContextGet(irq);
if ((0 == p_ctrl->p_regs->SPSR_b.IDLNF) || (SPI_MODE_SLAVE == p_ctrl->p_cfg->operating_mode))
{
R_BSP_IrqDisable(irq);
p_ctrl->p_regs->SPCR_b.SPE = 0;
r_spi_call_callback(p_ctrl, SPI_EVENT_TRANSFER_COMPLETE);
}
FSP_CONTEXT_RESTORE;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Check interrupt flag of RXC and update transaction runtime information. */
|
static bool _spi_rx_check_and_receive(void *const hw, const uint32_t iflag, struct _spi_trans_ctrl *ctrl)
|
/* Check interrupt flag of RXC and update transaction runtime information. */
static bool _spi_rx_check_and_receive(void *const hw, const uint32_t iflag, struct _spi_trans_ctrl *ctrl)
|
{
uint32_t data;
if (!(iflag & SERCOM_SPI_INTFLAG_RXC)) {
return false;
}
data = hri_sercomspi_read_DATA_reg(hw);
if (ctrl->rxbuf) {
*ctrl->rxbuf++ = (uint8_t)data;
if (ctrl->char_size > 1) {
*ctrl->rxbuf++ = (uint8_t)(data >> 8);
}
}
ctrl->rxcnt++;
return true;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Check whether one IP address equals the other. */
|
BOOLEAN TcpIsIpEqual(IN EFI_IP_ADDRESS *Ip1, IN EFI_IP_ADDRESS *Ip2, IN UINT8 Version)
|
/* Check whether one IP address equals the other. */
BOOLEAN TcpIsIpEqual(IN EFI_IP_ADDRESS *Ip1, IN EFI_IP_ADDRESS *Ip2, IN UINT8 Version)
|
{
ASSERT ((Version == IP_VERSION_4) || (Version == IP_VERSION_6));
if (Version == IP_VERSION_4) {
return (BOOLEAN)(Ip1->Addr[0] == Ip2->Addr[0]);
} else {
return (BOOLEAN)EFI_IP6_EQUAL (&Ip1->v6, &Ip2->v6);
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* e1000_clean_all_tx_rings - Free Tx Buffers for all queues @adapter: board private structure */
|
static void e1000_clean_all_tx_rings(struct e1000_adapter *adapter)
|
/* e1000_clean_all_tx_rings - Free Tx Buffers for all queues @adapter: board private structure */
static void e1000_clean_all_tx_rings(struct e1000_adapter *adapter)
|
{
int i;
for (i = 0; i < adapter->num_tx_queues; i++)
e1000_clean_tx_ring(adapter, &adapter->tx_ring[i]);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Set address/length pair to ccw of a request. */
|
void raw3270_request_set_data(struct raw3270_request *rq, void *data, size_t size)
|
/* Set address/length pair to ccw of a request. */
void raw3270_request_set_data(struct raw3270_request *rq, void *data, size_t size)
|
{
rq->ccw.cda = __pa(data);
rq->ccw.count = size;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enables the selected ADC software start conversion of the injected channels. */
|
void ADC_EnableSoftwareStartInjectedConv(ADC_T *adc)
|
/* Enables the selected ADC software start conversion of the injected channels. */
void ADC_EnableSoftwareStartInjectedConv(ADC_T *adc)
|
{
adc->CTRL2_B.INJCHSC = BIT_SET;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function returns %0 on success and a negative error code on failure. */
|
static int free_unused_idx_lebs(struct ubifs_info *c)
|
/* This function returns %0 on success and a negative error code on failure. */
static int free_unused_idx_lebs(struct ubifs_info *c)
|
{
int i, err = 0, lnum, er;
for (i = c->ileb_nxt; i < c->ileb_cnt; i++) {
lnum = c->ilebs[i];
dbg_cmt("LEB %d", lnum);
er = ubifs_change_one_lp(c, lnum, LPROPS_NC, LPROPS_NC, 0,
LPROPS_INDEX | LPROPS_TAKEN, 0);
if (!err)
err = er;
}
return err;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Cause a processor trigger for a sample sequence of Regular channel. */
|
void ADCProcessorTrigger(unsigned long ulBase)
|
/* Cause a processor trigger for a sample sequence of Regular channel. */
void ADCProcessorTrigger(unsigned long ulBase)
|
{
xASSERT((ulBase == ADC1_BASE) || (ulBase == ADC2_BASE) || (ulBase == ADC3_BASE));
xHWREG(ulBase + ADC_CR2) |= ADC_CR2_SWSTART;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* This function will install a interrupt service routine to a interrupt. */
|
void rt_hw_interrupt_install(int vector, rt_isr_handler_t new_handler, rt_isr_handler_t *old_handler)
|
/* This function will install a interrupt service routine to a interrupt. */
void rt_hw_interrupt_install(int vector, rt_isr_handler_t new_handler, rt_isr_handler_t *old_handler)
|
{
XIntc_Config *CfgPtr;
CfgPtr = &XIntc_ConfigTable[0];
if(vector >= 0 && vector < MAX_HANDLERS)
{
if (*old_handler != RT_NULL) *old_handler = (rt_isr_handler_t)CfgPtr->HandlerTable[vector].Handler;
if (new_handler != RT_NULL) CfgPtr->HandlerTable[vector].Handler = (XInterruptHandler)new_handler;
}
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Set the specified data holding register value for DAC channel 2. */
|
void DAC_ConfigChannel2Data(DAC_ALIGN_T align, uint16_t data)
|
/* Set the specified data holding register value for DAC channel 2. */
void DAC_ConfigChannel2Data(DAC_ALIGN_T align, uint16_t data)
|
{
__IO uint32_t tmp = 0;
tmp = (uint32_t)DAC_BASE;
tmp += 0x00000014 + align;
*(__IO uint32_t *) tmp = data;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* returns result of the compare as with xmlStrncmp */
|
int xmlUTF8Charcmp(const xmlChar *utf1, const xmlChar *utf2)
|
/* returns result of the compare as with xmlStrncmp */
int xmlUTF8Charcmp(const xmlChar *utf1, const xmlChar *utf2)
|
{
if (utf2 == NULL)
return 0;
return -1;
}
return xmlStrncmp(utf1, utf2, xmlUTF8Size(utf1));
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This function configures the source of stm32cube time base. Cube HAL expects a 1ms tick which matches with k_uptime_get_32. Tick interrupt priority is not used. */
|
uint32_t HAL_GetTick(void)
|
/* This function configures the source of stm32cube time base. Cube HAL expects a 1ms tick which matches with k_uptime_get_32. Tick interrupt priority is not used. */
uint32_t HAL_GetTick(void)
|
{
return k_uptime_get_32();
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Initialize progress reporting. If @enabled is false, actual reporting is suppressed. The user can still trigger a report by sending a SIGUSR1. Reports are also suppressed unless we've had at least @min_skip percent progress since the last report. */
|
void qemu_progress_init(int enabled, float min_skip)
|
/* Initialize progress reporting. If @enabled is false, actual reporting is suppressed. The user can still trigger a report by sending a SIGUSR1. Reports are also suppressed unless we've had at least @min_skip percent progress since the last report. */
void qemu_progress_init(int enabled, float min_skip)
|
{
state.min_skip = min_skip;
if (enabled) {
progress_simple_init();
} else {
progress_dummy_init();
}
}
|
ve3wwg/teensy3_qemu
|
C++
|
Other
| 15
|
/* Update the MODE setting of the flash buffer. */
|
static int32_t cn0503_flash_write_mode(struct cn0503_dev *dev, uint8_t *arg, uint8_t *buff)
|
/* Update the MODE setting of the flash buffer. */
static int32_t cn0503_flash_write_mode(struct cn0503_dev *dev, uint8_t *arg, uint8_t *buff)
|
{
int8_t i = 0;
while(arg[i]) {
arg[i] = toupper(arg[i]);
i++;
}
i = 0;
while(cn0503_ascii_modes[i][0] != 0) {
if(strncmp((char *)arg, (char *)cn0503_ascii_modes[i], 5) == 0)
break;
i++;
}
if(i > CN0503_INS2)
return FAILURE;
sprintf((char *)buff, "%s", cn0503_ascii_modes[i]);
dev->sw_flash_buffer[CN0503_FLASH_MODE_IDX] = i;
return SUCCESS;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Called by the driver when there's room for more data. If we have more packets to send, we send them here. */
|
static void mkiss_write_wakeup(struct tty_struct *tty)
|
/* Called by the driver when there's room for more data. If we have more packets to send, we send them here. */
static void mkiss_write_wakeup(struct tty_struct *tty)
|
{
struct mkiss *ax = mkiss_get(tty);
int actual;
if (!ax)
return;
if (ax->xleft <= 0) {
clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
netif_wake_queue(ax->dev);
goto out;
}
actual = tty->ops->write(tty, ax->xhead, ax->xleft);
ax->xleft -= actual;
ax->xhead += actual;
out:
mkiss_put(ax);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* restart the current transfer due to an error */
|
static void restart(const char *msg)
|
/* restart the current transfer due to an error */
static void restart(const char *msg)
|
{
printf("\n%s; starting again\n", msg);
net_start_again();
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Returns 0 if successful, or a negative error code. */
|
int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex)
|
/* Returns 0 if successful, or a negative error code. */
int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex)
|
{
struct hda_bus_unsolicited *unsol;
unsigned int wp;
unsol = bus->unsol;
if (!unsol)
return 0;
wp = (unsol->wp + 1) % HDA_UNSOL_QUEUE_SIZE;
unsol->wp = wp;
wp <<= 1;
unsol->queue[wp] = res;
unsol->queue[wp + 1] = res_ex;
queue_work(bus->workq, &unsol->work);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* ADC MSP De-Initialization This function frees the hardware resources used in this application: */
|
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
|
/* ADC MSP De-Initialization This function frees the hardware resources used in this application: */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
|
{
static DMA_HandleTypeDef hdma_adc;
ADCx_FORCE_RESET();
ADCx_RELEASE_RESET();
HAL_GPIO_DeInit(ADCx_CHANNEL_GPIO_PORT, ADCx_CHANNEL_PIN);
HAL_DMA_DeInit(&hdma_adc);
HAL_NVIC_DisableIRQ(ADCx_DMA_IRQn);
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* The function is synchronous and does not return until the erase operation has completed. */
|
uint32_t EEPROMMassErase(void)
|
/* The function is synchronous and does not return until the erase operation has completed. */
uint32_t EEPROMMassErase(void)
|
{
if(CLASS_IS_TM4C123 && REVISION_IS_A0)
{
_EEPROMSectorMaskClear();
}
HWREG(EEPROM_EEDBGME) = EEPROM_MASS_ERASE_KEY | EEPROM_EEDBGME_ME;
_EEPROMWaitForDone();
SysCtlPeripheralReset(SYSCTL_PERIPH_EEPROM0);
SysCtlDelay(2);
_EEPROMWaitForDone();
return(HWREG(EEPROM_EEDONE));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* USBH_IsocSendData Sends the data on Isochronous OUT Endpoint. */
|
USBH_Status USBH_IsocSendData(USB_OTG_CORE_HANDLE *pdev, uint8_t *buff, uint32_t length, uint8_t hc_num)
|
/* USBH_IsocSendData Sends the data on Isochronous OUT Endpoint. */
USBH_Status USBH_IsocSendData(USB_OTG_CORE_HANDLE *pdev, uint8_t *buff, uint32_t length, uint8_t hc_num)
|
{
pdev->host.hc[hc_num].ep_is_in = 0;
pdev->host.hc[hc_num].xfer_buff = buff;
pdev->host.hc[hc_num].xfer_len = length;
pdev->host.hc[hc_num].data_pid = HC_PID_DATA0;
HCD_SubmitRequest (pdev , hc_num);
return USBH_OK;
}
|
MaJerle/stm32f429
|
C++
| null | 2,036
|
/* Compare two conversation keys for an exact match. */
|
static gint conversation_match_exact(gconstpointer v, gconstpointer w)
|
/* Compare two conversation keys for an exact match. */
static gint conversation_match_exact(gconstpointer v, gconstpointer w)
|
{
const conversation_key *v1 = (const conversation_key *)v;
const conversation_key *v2 = (const conversation_key *)w;
if (v1->ptype != v2->ptype)
return 0;
if (v1->port1 == v2->port1 &&
v1->port2 == v2->port2 &&
addresses_equal(&v1->addr1, &v2->addr1) &&
addresses_equal(&v1->addr2, &v2->addr2)) {
return 1;
}
if (v1->port2 == v2->port1 &&
v1->port1 == v2->port2 &&
addresses_equal(&v1->addr2, &v2->addr1) &&
addresses_equal(&v1->addr1, &v2->addr2)) {
return 1;
}
return 0;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* We can make the GIC behave in the way that Linux expects by making our "acknowledge" routine disable the interrupt, then mark it as complete. */
|
static void gic_ack_irq(unsigned int irq)
|
/* We can make the GIC behave in the way that Linux expects by making our "acknowledge" routine disable the interrupt, then mark it as complete. */
static void gic_ack_irq(unsigned int irq)
|
{
u32 mask = 1 << (irq % 32);
spin_lock(&irq_controller_lock);
writel(mask, gic_dist_base(irq) + GIC_DIST_ENABLE_CLEAR + (gic_irq(irq) / 32) * 4);
writel(gic_irq(irq), gic_cpu_base(irq) + GIC_CPU_EOI);
spin_unlock(&irq_controller_lock);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Get Pending Interrupt Different from CMSIS implementation, returns zero/non-zero, not zero/one. */
|
rt_uint32_t NVIC_GetPendingIRQ(rt_int32_t irqno)
|
/* Get Pending Interrupt Different from CMSIS implementation, returns zero/non-zero, not zero/one. */
rt_uint32_t NVIC_GetPendingIRQ(rt_int32_t irqno)
|
{
return NVIC_ISPR & (1UL << (irqno & 0x1f));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function is used for copying data between driver memory and the SLI memory. This function also changes the endianness of each word if native endianness is different from SLI endianness. This function can be called with or without lock. */
|
void lpfc_sli_pcimem_bcopy(void *srcp, void *destp, uint32_t cnt)
|
/* This function is used for copying data between driver memory and the SLI memory. This function also changes the endianness of each word if native endianness is different from SLI endianness. This function can be called with or without lock. */
void lpfc_sli_pcimem_bcopy(void *srcp, void *destp, uint32_t cnt)
|
{
uint32_t *src = srcp;
uint32_t *dest = destp;
uint32_t ldata;
int i;
for (i = 0; i < (int)cnt; i += sizeof (uint32_t)) {
ldata = *src;
ldata = le32_to_cpu(ldata);
*dest = ldata;
src++;
dest++;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns zero on success, a negative error code otherwise. */
|
int mtd_ooblayout_find_eccregion(struct mtd_info *mtd, int eccbyte, int *section, struct mtd_oob_region *oobregion)
|
/* Returns zero on success, a negative error code otherwise. */
int mtd_ooblayout_find_eccregion(struct mtd_info *mtd, int eccbyte, int *section, struct mtd_oob_region *oobregion)
|
{
return mtd_ooblayout_find_region(mtd, eccbyte, section, oobregion,
mtd_ooblayout_ecc);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
|
int main(void)
|
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void)
|
{
SetupHardware();
puts_P(PSTR(ESC_FG_CYAN "MIDI Host Demo running.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
JoystickHost_Task();
MIDI_Host_USBTask(&Keyboard_MIDI_Interface);
USB_USBTask();
}
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* function to calculate the average returns the average as a gdouble , time base is milli seconds */
|
gdouble get_average(const nstime_t *sum, guint32 num)
|
/* function to calculate the average returns the average as a gdouble , time base is milli seconds */
gdouble get_average(const nstime_t *sum, guint32 num)
|
{
gdouble average;
if(num > 0) {
average = (double)sum->secs*1000 + (double)sum->nsecs/1000000;
average /= num;
}
else {
average = 0;
}
return average;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Initialize PWM Interface. 1. Initializes the resources needed for the PWM interface 2.registers event callback function. */
|
pwm_handle_t drv_pwm_initialize(pin_t pwm_pin)
|
/* Initialize PWM Interface. 1. Initializes the resources needed for the PWM interface 2.registers event callback function. */
pwm_handle_t drv_pwm_initialize(pin_t pwm_pin)
|
{
uint32_t base = 0u;
uint32_t irq = 0u;
uint32_t ch_num = 0u;
int32_t idx = target_pwm_init(pwm_pin, &ch_num, &base, &irq);
if (idx < 0 || idx >= CONFIG_PWM_NUM) {
return NULL;
}
ck_pwm_priv_t *pwm_priv = &pwm_instance[idx];
pwm_priv->base = base;
pwm_priv->irq = irq;
pwm_priv->ch_num = ch_num;
return pwm_priv;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
|
VOID* EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
|
/* Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
|
{
return InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize);
}
|
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.