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 |
|---|---|---|---|---|---|---|---|
/* Just loops around incrementing the shared variable until the limit has been reached. Once the limit has been reached it suspends itself. */ | static portTASK_FUNCTION(vLimitedIncrementTask, pvParameters) | /* Just loops around incrementing the shared variable until the limit has been reached. Once the limit has been reached it suspends itself. */
static portTASK_FUNCTION(vLimitedIncrementTask, pvParameters) | {
unsigned long *pulCounter;
pulCounter = ( unsigned long * ) pvParameters;
vTaskSuspend( NULL );
for( ;; )
{
( *pulCounter )++; if( *pulCounter >= priMAX_COUNT )
{
vTaskSuspend( NULL );
} }
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Returns: (transfer full): A newly allocated #GBytes containing contents of @string; @string itself is freed Since: 2.34 */ | GBytes* g_string_free_to_bytes(GString *string) | /* Returns: (transfer full): A newly allocated #GBytes containing contents of @string; @string itself is freed Since: 2.34 */
GBytes* g_string_free_to_bytes(GString *string) | {
gsize len;
gchar *buf;
g_return_val_if_fail (string != NULL, NULL);
len = string->len;
buf = g_string_free (string, FALSE);
return g_bytes_new_take (buf, len);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* The ASL NameString is converted to an AML NameString before being compared with the ASL NameString. This allows to expand NameSegs shorter than 4 chars. E.g.: AslName: "DEV" will be expanded to "DEV_" before being compared. */ | BOOLEAN EFIAPI CompareAmlWithAslNameString(IN CONST CHAR8 *AmlName1, IN CONST CHAR8 *AslName2) | /* The ASL NameString is converted to an AML NameString before being compared with the ASL NameString. This allows to expand NameSegs shorter than 4 chars. E.g.: AslName: "DEV" will be expanded to "DEV_" before being compared. */
BOOLEAN EFIAPI CompareAmlWithAslNameString(IN CONST CHAR8 *AmlName1, IN CONST CHAR8 *AslName2) | {
EFI_STATUS Status;
CHAR8 *AmlName2;
BOOLEAN RetVal;
if ((AmlName1 == NULL) ||
(AslName2 == NULL))
{
ASSERT (0);
return FALSE;
}
Status = ConvertAmlNameToAslName (AslName2, &AmlName2);
if (EFI_ERROR (Status)) {
ASSERT (0);
return FALSE;
}
RetVal = AmlCompareNameString (AmlName1, AmlName2);
FreePool (AmlName2);
return RetVal;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* aoedev.c AoE device utility functions; maintains device list. */ | static void dummy_timer(ulong) | /* aoedev.c AoE device utility functions; maintains device list. */
static void dummy_timer(ulong) | {
struct aoedev *d;
d = (struct aoedev *)vp;
if (d->flags & DEVFL_TKILL)
return;
d->timer.expires = jiffies + HZ;
add_timer(&d->timer);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* 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);
SDMMCHOST_TRANSFER content = {0};
SDMMCHOST_COMMAND command = {0};
status_t error = kStatus_Success;
command.index = kSD_SendRelativeAddress;
command.argument = 0U;
command.responseType = kCARD_ResponseTypeR6;
content.command = &command;
content.data = NULL;
error = card->host.transfer(card->host.base, &content);
if (kStatus_Success == error)
{
card->relativeAddress = (command.response[0U] >> 16U);
}
else
{
SDMMC_LOG("\r\nError: send CMD3 failed with host error %d, response %x", error, command.response[0U]);
}
return error;
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Looks up the device configuration based on the unique device ID. A table contains the configuration info for each device in the system. */ | XIicPs_Config* XIicPs_LookupConfig(u16 DeviceId) | /* Looks up the device configuration based on the unique device ID. A table contains the configuration info for each device in the system. */
XIicPs_Config* XIicPs_LookupConfig(u16 DeviceId) | {
XIicPs_Config *CfgPtr = NULL;
s32 Index;
for (Index = 0; Index < XPAR_XIICPS_NUM_INSTANCES; Index++) {
if (XIicPs_ConfigTable[Index].DeviceId == DeviceId) {
CfgPtr = &XIicPs_ConfigTable[Index];
break;
}
}
return (XIicPs_Config *)CfgPtr;
}
/** @} | ua1arn/hftrx | C++ | null | 69 |
/* ubi_scan_rm_volume - delete scanning information about a volume. @si: scanning information @sv: the volume scanning information to delete */ | void ubi_scan_rm_volume(struct ubi_scan_info *si, struct ubi_scan_volume *sv) | /* ubi_scan_rm_volume - delete scanning information about a volume. @si: scanning information @sv: the volume scanning information to delete */
void ubi_scan_rm_volume(struct ubi_scan_info *si, struct ubi_scan_volume *sv) | {
struct rb_node *rb;
struct ubi_scan_leb *seb;
dbg_bld("remove scanning information about volume %d", sv->vol_id);
while ((rb = rb_first(&sv->root))) {
seb = rb_entry(rb, struct ubi_scan_leb, u.rb);
rb_erase(&seb->u.rb, &sv->root);
list_add_tail(&seb->u.list, &si->erase);
}
rb_erase(&sv->rb, &si->volumes);
kfree(sv);
si->vols_found -= 1;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* unlock_2_inodes - a wrapper for unlocking two UBIFS inodes. @inode1: first inode @inode2: second inode */ | static void unlock_2_inodes(struct inode *inode1, struct inode *inode2) | /* unlock_2_inodes - a wrapper for unlocking two UBIFS inodes. @inode1: first inode @inode2: second inode */
static void unlock_2_inodes(struct inode *inode1, struct inode *inode2) | {
mutex_unlock(&ubifs_inode(inode2)->ui_mutex);
mutex_unlock(&ubifs_inode(inode1)->ui_mutex);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Read response on SPI from PC.
return Status */ | enum status_code adp_interface_read_response(uint8_t *rx_buf, uint16_t length) | /* Read response on SPI from PC.
return Status */
enum status_code adp_interface_read_response(uint8_t *rx_buf, uint16_t length) | {
bool status;
adp_interface_send_start(); status = spi_read_buffer_wait(&edbg_spi, rx_buf, length, 0xFF);
adp_interface_send_stop();
return status;
} | memfault/zero-to-main | C++ | null | 200 |
/* RETURNS: Command allocated, or NULL if none available. */ | static struct ata_queued_cmd* ata_scsi_qc_new(struct ata_device *dev, struct scsi_cmnd *cmd, void(*done)(struct scsi_cmnd *)) | /* RETURNS: Command allocated, or NULL if none available. */
static struct ata_queued_cmd* ata_scsi_qc_new(struct ata_device *dev, struct scsi_cmnd *cmd, void(*done)(struct scsi_cmnd *)) | {
struct ata_queued_cmd *qc;
qc = ata_qc_new_init(dev);
if (qc) {
qc->scsicmd = cmd;
qc->scsidone = done;
qc->sg = scsi_sglist(cmd);
qc->n_elem = scsi_sg_count(cmd);
} else {
cmd->result = (DID_OK << 16) | (QUEUE_FULL << 1);
done(cmd);
}
return qc;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Select the start bank filter for slave CAN. */ | void CAN_SlaveStartBank(CAN_T *can, uint8_t bankNum) | /* Select the start bank filter for slave CAN. */
void CAN_SlaveStartBank(CAN_T *can, uint8_t bankNum) | {
can->FCTRL_B.FINITEN = SET;
can->FCTRL_B.CAN2BN = bankNum;
can->FCTRL_B.FINITEN = RESET;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Write datas element to the SPI interface. This function transmitted data to the interface of the specified SPI module . */ | void xSPIDataWrite(unsigned long ulBase, unsigned long *pulWData, unsigned long ulLen) | /* Write datas element to the SPI interface. This function transmitted data to the interface of the specified SPI module . */
void xSPIDataWrite(unsigned long ulBase, unsigned long *pulWData, unsigned long ulLen) | {
unsigned long i = 0;
xASSERT(ulBase == SPI0_BASE);
xASSERT(pulData != 0);
for(i = 0; i < ulLen; i++)
{
SPIDataReadWrite(ulBase, *pulWData++);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* fc_fcp_destory() - Tear down the FCP layer for a given local port @lport: The local port that no longer needs the FCP layer */ | void fc_fcp_destroy(struct fc_lport *lport) | /* fc_fcp_destory() - Tear down the FCP layer for a given local port @lport: The local port that no longer needs the FCP layer */
void fc_fcp_destroy(struct fc_lport *lport) | {
struct fc_fcp_internal *si = fc_get_scsi_internal(lport);
if (!list_empty(&si->scsi_pkt_queue))
printk(KERN_ERR "libfc: Leaked SCSI packets when destroying "
"port (%6x)\n", fc_host_port_id(lport->host));
mempool_destroy(si->scsi_pkt_pool);
kfree(si);
lport->scsi_priv = NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Called from mpparse code. mode = 0: prescan mode = 1: one mpc entry scanned */ | static void numaq_mpc_record(unsigned int mode) | /* Called from mpparse code. mode = 0: prescan mode = 1: one mpc entry scanned */
static void numaq_mpc_record(unsigned int mode) | {
if (!mode)
mpc_record = 0;
else
mpc_record++;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Set the WILC1000 device name which is used as P2P device name. */ | NMI_API sint8 m2m_wifi_set_device_name(uint8 *pu8DeviceName, uint8 u8DeviceNameLength) | /* Set the WILC1000 device name which is used as P2P device name. */
NMI_API sint8 m2m_wifi_set_device_name(uint8 *pu8DeviceName, uint8 u8DeviceNameLength) | {
tstrM2MDeviceNameConfig* pstrDeviceName = &guCtrlStruct.strM2MDeviceNameConfig;
if(u8DeviceNameLength >= M2M_DEVICE_NAME_MAX)
{
u8DeviceNameLength = M2M_DEVICE_NAME_MAX;
}
u8DeviceNameLength ++;
m2m_memcpy(pstrDeviceName->au8DeviceName, pu8DeviceName, u8DeviceNameLength);
return hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SET_DEVICE_NAME,
(uint8*)pstrDeviceName, sizeof(tstrM2MDeviceNameConfig), NULL, 0,0);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Creates a new PRM Module Image Context linked list entry. */ | PRM_HANDLER_CONTEXT_LIST_ENTRY* CreateNewPrmHandlerListEntry(VOID) | /* Creates a new PRM Module Image Context linked list entry. */
PRM_HANDLER_CONTEXT_LIST_ENTRY* CreateNewPrmHandlerListEntry(VOID) | {
PRM_HANDLER_CONTEXT_LIST_ENTRY *PrmHandlerContextListEntry;
PrmHandlerContextListEntry = AllocateZeroPool (sizeof (*PrmHandlerContextListEntry));
if (PrmHandlerContextListEntry == NULL) {
return NULL;
}
PrmHandlerContextListEntry->Signature = PRM_HANDLER_CONTEXT_LIST_ENTRY_SIGNATURE;
return PrmHandlerContextListEntry;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns: the transation of @str to the current locale */ | const gchar* glib_gettext(const gchar *str) | /* Returns: the transation of @str to the current locale */
const gchar* glib_gettext(const gchar *str) | {
ensure_gettext_initialized ();
return g_dgettext (GETTEXT_PACKAGE, str);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Enable/disable the DIV_ONE feature of the specified SPI port. */ | void SPI3WireFunction(unsigned long ulBase, xtBoolean xtEnable) | /* Enable/disable the DIV_ONE feature of the specified SPI port. */
void SPI3WireFunction(unsigned long ulBase, xtBoolean xtEnable) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) );
if (xtEnable)
{
xHWREG(ulBase + SPI_CNTRL2) |= SPI_CNTRL2_NOSLVSEL;
xHWREG(ulBase + SPI_SSR) |= SPI_SS_LTRIG;
}
else
{
xHWREG(ulBase + SPI_CNTRL2) &= ~SPI_CNTRL2_NOSLVSEL;
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* STUSB1602 sets the CURRENT_ADVERTISED on CC (bit7-6 0x18 */ | STUSB1602_StatusTypeDef STUSB1602_Current_Advertised_Set(uint8_t Addr, Current_Capability_Advertised_TypeDef curr_cap) | /* STUSB1602 sets the CURRENT_ADVERTISED on CC (bit7-6 0x18 */
STUSB1602_StatusTypeDef STUSB1602_Current_Advertised_Set(uint8_t Addr, Current_Capability_Advertised_TypeDef curr_cap) | {
STUSB1602_StatusTypeDef status = STUSB1602_OK;
STUSB1602_CC_CAPABILITY_CTRL_RegTypeDef reg;
STUSB1602_ReadReg(®.d8, Addr, STUSB1602_CC_CAPABILITY_CTRL_REG, 1);
reg.b.CC_CURRENT_ADVERTISED = curr_cap;
status = STUSB1602_WriteReg(®.d8, Addr, STUSB1602_CC_CAPABILITY_CTRL_REG, 1);
return status;
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* Note, that this routine does not check for buffer overflow, it's the caller who must assure enough space. */ | static void memsize_format(char *buf, u64 size) | /* Note, that this routine does not check for buffer overflow, it's the caller who must assure enough space. */
static void memsize_format(char *buf, u64 size) | {
#define SIZE_GB ((u32)1024*1024*1024)
#define SIZE_MB ((u32)1024*1024)
#define SIZE_KB ((u32)1024)
if ((size % SIZE_GB) == 0)
sprintf(buf, "%llug", size/SIZE_GB);
else if ((size % SIZE_MB) == 0)
sprintf(buf, "%llum", size/SIZE_MB);
else if (size % SIZE_KB == 0)
sprintf(buf, "%lluk", size/SIZE_KB);
else
sprintf(buf, "%llu", size);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Sets the @attribute to contain the given value, if possible. To unset the attribute, use G_ATTRIBUTE_TYPE_INVALID for @type. */ | void g_file_info_set_attribute(GFileInfo *info, const char *attribute, GFileAttributeType type, gpointer value_p) | /* Sets the @attribute to contain the given value, if possible. To unset the attribute, use G_ATTRIBUTE_TYPE_INVALID for @type. */
void g_file_info_set_attribute(GFileInfo *info, const char *attribute, GFileAttributeType type, gpointer value_p) | {
g_return_if_fail (G_IS_FILE_INFO (info));
g_return_if_fail (attribute != NULL && *attribute != '\0');
_g_file_info_set_attribute_by_id (info, lookup_attribute (attribute), type, value_p);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */ | int main(void) | /* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */
int main(void) | {
SetupHardware();
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
Audio_Device_USBTask(&Microphone_Audio_Interface);
USB_USBTask();
}
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Checks whether the specified I2C flag is set or not. */ | FlagStatus I2C_GetFlag(I2C_Module *I2Cx, uint32_t I2C_FLAG) | /* Checks whether the specified I2C flag is set or not. */
FlagStatus I2C_GetFlag(I2C_Module *I2Cx, uint32_t I2C_FLAG) | {
FlagStatus bitstatus = RESET;
__IO uint32_t i2creg = 0, i2cxbase = 0;
assert_param(IS_I2C_PERIPH(I2Cx));
assert_param(IS_I2C_GET_FLAG(I2C_FLAG));
i2cxbase = (uint32_t)I2Cx;
i2creg = I2C_FLAG >> 28;
I2C_FLAG &= FLAG_MASK;
if (i2creg != 0)
{
i2cxbase += 0x14;
}
else
{
I2C_FLAG = (uint32_t)(I2C_FLAG >> 16);
i2cxbase += 0x18;
}
if (((*(__IO uint32_t*)i2cxbase) & I2C_FLAG) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/*
Switch performance level to PL2 and GCLK0 is running at 48MHz. */ | static void performance_level_switch_test(void) | /*
Switch performance level to PL2 and GCLK0 is running at 48MHz. */
static void performance_level_switch_test(void) | {
struct system_gclk_gen_config gclk_conf;
system_switch_performance_level(SYSTEM_PERFORMANCE_LEVEL_2);
system_flash_set_waitstates(2);
system_gclk_gen_get_config_defaults(&gclk_conf);
gclk_conf.source_clock = SYSTEM_CLOCK_SOURCE_DFLL;
gclk_conf.division_factor = 1;
gclk_conf.run_in_standby = false;
gclk_conf.output_enable = true;
system_gclk_gen_set_config(GCLK_GENERATOR_0, &gclk_conf);
} | memfault/zero-to-main | C++ | null | 200 |
/* QSPI MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_QSPI_MspInit(QSPI_HandleTypeDef *hqspi) | /* QSPI MSP Initialization This function configures the hardware resources used in this example. */
void HAL_QSPI_MspInit(QSPI_HandleTypeDef *hqspi) | {
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(hqspi->Instance==QUADSPI)
{
__HAL_RCC_QSPI_CLK_ENABLE();
__HAL_RCC_GPIOE_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13
|GPIO_PIN_14|GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF10_QUADSPI;
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Dummy initialization function.
The local APIC is initialized via z_loapic_enable() long before the kernel runs through its device initializations, so this is unneeded. */ | static __boot_func int loapic_init(const struct device *unused) | /* Dummy initialization function.
The local APIC is initialized via z_loapic_enable() long before the kernel runs through its device initializations, so this is unneeded. */
static __boot_func int loapic_init(const struct device *unused) | {
ARG_UNUSED(unused);
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Return -a (or, equivalently, 0 - a), in quad. See subdi3.c. */ | quad_t __negdi2(quad_t a) | /* Return -a (or, equivalently, 0 - a), in quad. See subdi3.c. */
quad_t __negdi2(quad_t a) | {
union uu aa, res;
aa.q = a;
res.ul[L] = -aa.ul[L];
res.ul[H] = -aa.ul[H] - (res.ul[L] > 0);
return res.q;
} | labapart/polymcu | C++ | null | 201 |
/* Clear the PWM interrupt flag of the PWM module.
The */ | void PWMIntFlagClear(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType) | /* Clear the PWM interrupt flag of the PWM module.
The */
void PWMIntFlagClear(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType) | {
unsigned long ulChannelTemp;
ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4);
xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE));
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3)));
xASSERT((ulIntType == PWM_INT_CAP_BOTH) || (ulIntType == PWM_INT_CAP_FALL) ||
(ulIntType == PWM_INT_CAP_RISE) || (ulIntType == PWM_INT_PWM));
if (ulIntType == PWM_INT_PWM)
{
xHWREG(ulBase + PWM_PIIR) |= (PWM_PIER_PWMIE0 << ulChannelTemp);
}
else
{
xHWREG(ulBase + PWM_CCR0 + (ulChannelTemp >> 1)*4) |=
(PWM_CCR0_CAPIF0 << ((ulChannel % 2) ? 16 : 0)) ;
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* brief Return Frequency of I3C function Slow clock return Frequency of I3C function slow Clock */ | uint32_t CLOCK_GetI3cSClkFreq(uint32_t id) | /* brief Return Frequency of I3C function Slow clock return Frequency of I3C function slow Clock */
uint32_t CLOCK_GetI3cSClkFreq(uint32_t id) | {
uint32_t freq = 0U;
uint32_t div = 0U;
switch ((id == 0U) ? (SYSCON->I3C0FCLKSSEL) : (SYSCON->I3C1FCLKSSEL))
{
case 0U:
freq = CLOCK_GetClk1MFreq();
break;
default:
freq = 0U;
break;
}
div = ((id == 0U) ? ((SYSCON->I3C0FCLKSDIV & SYSCON_I3C0FCLKSDIV_DIV_MASK) + 1U) :
((SYSCON->I3C1FCLKSDIV & SYSCON_I3C1FCLKSDIV_DIV_MASK) + 1U));
return freq / div;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The tracer may use either the sequence operations or its own copy to user routines. This function records a simple string into a special buffer (@s) for later retrieval by a sequencer or other mechanism. */ | int trace_seq_puts(struct trace_seq *s, const char *str) | /* The tracer may use either the sequence operations or its own copy to user routines. This function records a simple string into a special buffer (@s) for later retrieval by a sequencer or other mechanism. */
int trace_seq_puts(struct trace_seq *s, const char *str) | {
int len = strlen(str);
if (s->full)
return 0;
if (len > ((PAGE_SIZE - 1) - s->len)) {
s->full = 1;
return 0;
}
memcpy(s->buffer + s->len, str, len);
s->len += len;
return len;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* pm8001_task_prep_smp - the dispatcher function, prepare data for smp task @pm8001_ha: our hba card information @ccb: the ccb which attached to smp task */ | static int pm8001_task_prep_smp(struct pm8001_hba_info *pm8001_ha, struct pm8001_ccb_info *ccb) | /* pm8001_task_prep_smp - the dispatcher function, prepare data for smp task @pm8001_ha: our hba card information @ccb: the ccb which attached to smp task */
static int pm8001_task_prep_smp(struct pm8001_hba_info *pm8001_ha, struct pm8001_ccb_info *ccb) | {
return PM8001_CHIP_DISP->smp_req(pm8001_ha, ccb);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* See the vsnprintf() documentation for format string extensions over C99. */ | int vscnprintf(char *buf, size_t size, const char *fmt, va_list args) | /* See the vsnprintf() documentation for format string extensions over C99. */
int vscnprintf(char *buf, size_t size, const char *fmt, va_list args) | {
int i;
i = vsnprintf(buf, size, fmt, args);
return (i >= size) ? (size - 1) : i;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base Pointer to the FLEXIO_MCULCD_Type structure. param mask Interrupts to enable, it is the OR'ed value of ref _flexio_mculcd_interrupt_enable. */ | void FLEXIO_MCULCD_EnableInterrupts(FLEXIO_MCULCD_Type *base, uint32_t mask) | /* param base Pointer to the FLEXIO_MCULCD_Type structure. param mask Interrupts to enable, it is the OR'ed value of ref _flexio_mculcd_interrupt_enable. */
void FLEXIO_MCULCD_EnableInterrupts(FLEXIO_MCULCD_Type *base, uint32_t mask) | {
uint32_t interrupts = 0U;
if (0U != (mask & (uint32_t)kFLEXIO_MCULCD_RxFullFlag))
{
interrupts |= (1UL << base->rxShifterEndIndex);
}
if (0U != (mask & (uint32_t)kFLEXIO_MCULCD_TxEmptyFlag))
{
interrupts |= (1UL << base->txShifterStartIndex);
}
FLEXIO_EnableShifterStatusInterrupts(base->flexioBase, interrupts);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Get configuration of the I3C hardware.
This can return cached config or probed hardware parameters, but it has to be up to date with current configuration. */ | static int mcux_i3c_config_get(const struct device *dev, enum i3c_config_type type, void *config) | /* Get configuration of the I3C hardware.
This can return cached config or probed hardware parameters, but it has to be up to date with current configuration. */
static int mcux_i3c_config_get(const struct device *dev, enum i3c_config_type type, void *config) | {
struct mcux_i3c_data *data = dev->data;
int ret = 0;
if ((type != I3C_CONFIG_CONTROLLER) || (config == NULL)) {
ret = -EINVAL;
goto out_configure;
}
(void)memcpy(config, &data->common.ctrl_config, sizeof(data->common.ctrl_config));
out_configure:
return ret;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Info region data write to indicate new image availability. */ | static void region_info_write(uint32_t u32Size) | /* Info region data write to indicate new image availability. */
static void region_info_write(uint32_t u32Size) | {
void *info_addr;
regions_info_t info;
info.length = u32Size;
info.trigger = TRIGGER_BOOTLAOAD;
memory_init();
info_addr = (void *)INFO_ADDR_START;
printf("Write info area ...\r\n");
memory_unlock(info_addr, (void *)((uint32_t)info_addr + INFO_SIZE - 1));
memory_erase(info_addr, INFO_SIZE);
memory_write(info_addr, &info);
memory_lock(info_addr, (void *)((uint32_t)info_addr + INFO_SIZE - 1));
printf("Write info area done\r\n");
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Returns a new message buffer containing an embedded message. The encapsulating message itself is left unchanged. */ | static struct sk_buff* buf_extract(struct sk_buff *skb, u32 from_pos) | /* Returns a new message buffer containing an embedded message. The encapsulating message itself is left unchanged. */
static struct sk_buff* buf_extract(struct sk_buff *skb, u32 from_pos) | {
struct tipc_msg *msg = (struct tipc_msg *)(skb->data + from_pos);
u32 size = msg_size(msg);
struct sk_buff *eb;
eb = buf_acquire(size);
if (eb)
skb_copy_to_linear_data(eb, msg, size);
return eb;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* enable the function that stop the read wait process(SD I/O only) */ | void sdio_stop_readwait_enable(void) | /* enable the function that stop the read wait process(SD I/O only) */
void sdio_stop_readwait_enable(void) | {
SDIO_DATACTL |= SDIO_DATACTL_RWSTOP;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Initializes an SPI peripheral slave device configuration structure to default values.
The default configuration is as follows: */ | void spi_slave_inst_get_config_defaults(struct spi_slave_inst_config *const config) | /* Initializes an SPI peripheral slave device configuration structure to default values.
The default configuration is as follows: */
void spi_slave_inst_get_config_defaults(struct spi_slave_inst_config *const config) | {
Assert(config);
config->ss_pin = PIN_LP_GPIO_12;
config->address_enabled = false;
config->address = 0;
} | memfault/zero-to-main | C++ | null | 200 |
/* Checks the provided @src_ops and @dst_ops for the necessary transaction capabilities that indicate whether or not a device will implement a destination ID register. Returns 1 if true or 0 if false. */ | static int rio_device_has_destid(struct rio_mport *port, int src_ops, int dst_ops) | /* Checks the provided @src_ops and @dst_ops for the necessary transaction capabilities that indicate whether or not a device will implement a destination ID register. Returns 1 if true or 0 if false. */
static int rio_device_has_destid(struct rio_mport *port, int src_ops, int dst_ops) | {
u32 mask = RIO_OPS_READ | RIO_OPS_WRITE | RIO_OPS_ATOMIC_TST_SWP | RIO_OPS_ATOMIC_INC | RIO_OPS_ATOMIC_DEC | RIO_OPS_ATOMIC_SET | RIO_OPS_ATOMIC_CLR;
return !!((src_ops | dst_ops) & mask);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* returns: 0, on success -ENOENT if the property could not be found */ | int fit_image_get_data_offset(const void *fit, int noffset, int *data_offset) | /* returns: 0, on success -ENOENT if the property could not be found */
int fit_image_get_data_offset(const void *fit, int noffset, int *data_offset) | {
const fdt32_t *val;
val = fdt_getprop(fit, noffset, FIT_DATA_OFFSET_PROP, NULL);
if (!val)
return -ENOENT;
*data_offset = fdt32_to_cpu(*val);
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* HP's Remote Management Console. The Diva chip came in several different versions. N-class, L2000 and A500 have two Diva chips, each with 3 UARTs (the third UART on the second chip is unused). Superdome and Keystone have one Diva chip with 3 UARTs. Some later machines have one Diva chip, but it has been expanded to 5 UARTs. */ | static int pci_hp_diva_init(struct pci_dev *dev) | /* HP's Remote Management Console. The Diva chip came in several different versions. N-class, L2000 and A500 have two Diva chips, each with 3 UARTs (the third UART on the second chip is unused). Superdome and Keystone have one Diva chip with 3 UARTs. Some later machines have one Diva chip, but it has been expanded to 5 UARTs. */
static int pci_hp_diva_init(struct pci_dev *dev) | {
int rc = 0;
switch (dev->subsystem_device) {
case PCI_DEVICE_ID_HP_DIVA_TOSCA1:
case PCI_DEVICE_ID_HP_DIVA_HALFDOME:
case PCI_DEVICE_ID_HP_DIVA_KEYSTONE:
case PCI_DEVICE_ID_HP_DIVA_EVEREST:
rc = 3;
break;
case PCI_DEVICE_ID_HP_DIVA_TOSCA2:
rc = 2;
break;
case PCI_DEVICE_ID_HP_DIVA_MAESTRO:
rc = 4;
break;
case PCI_DEVICE_ID_HP_DIVA_POWERBAR:
case PCI_DEVICE_ID_HP_DIVA_HURRICANE:
rc = 1;
break;
}
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Select the ACMP- input source of the comparator. */ | void xACMPConfigure(unsigned long ulBase, unsigned long ulComp, unsigned long ulSource) | /* Select the ACMP- input source of the comparator. */
void xACMPConfigure(unsigned long ulBase, unsigned long ulComp, unsigned long ulSource) | {
unsigned long ulCRAddr;
xASSERT(ulBase == ACMP_BASE);
xASSERT((ulComp >= 0) && (ulComp < 2));
xASSERT((ulSource == ACMP_ASRCN_PIN) || (ulSource == ACMP_ASRCN_REF));
ulCRAddr = ulBase + ACMP_CR0 + (4 * ulComp);
xHWREG(ulCRAddr) &= ~ACMP_CR_CN;
xHWREG(ulCRAddr) |= ulSource;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Internal function that places ASCII or Unicode character into the Buffer. */ | CHAR8* InternalPrintLibFillBuffer(OUT CHAR8 *Buffer, IN CHAR8 *EndBuffer, IN INTN Length, IN UINTN Character, IN INTN Increment) | /* Internal function that places ASCII or Unicode character into the Buffer. */
CHAR8* InternalPrintLibFillBuffer(OUT CHAR8 *Buffer, IN CHAR8 *EndBuffer, IN INTN Length, IN UINTN Character, IN INTN Increment) | {
INTN Index;
for (Index = 0; Index < Length && Buffer < EndBuffer; Index++) {
*Buffer = (CHAR8)Character;
if (Increment != 1) {
*(Buffer + 1) = (CHAR8)(Character >> 8);
}
Buffer += Increment;
}
return Buffer;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Write a 4 or 8 byte big endian cell */ | static void write_cell(u8 *addr, u64 val, int size) | /* Write a 4 or 8 byte big endian cell */
static void write_cell(u8 *addr, u64 val, int size) | {
int shift = (size - 1) * 8;
while (size-- > 0) {
*addr++ = (val >> shift) & 0xff;
shift -= 8;
}
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This function sets the FspSmmInit UPD data pointer. */ | VOID EFIAPI SetFspSmmInitUpdDataPointer(IN VOID *SmmInitUpdPtr) | /* This function sets the FspSmmInit UPD data pointer. */
VOID EFIAPI SetFspSmmInitUpdDataPointer(IN VOID *SmmInitUpdPtr) | {
FSP_GLOBAL_DATA *FspData;
FspData = GetFspGlobalDataPointer ();
FspData->SmmInitUpdPtr = SmmInitUpdPtr;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* ladder_do_selection - prepares private data for a state change @ldev: the ladder device @old_idx: the current state index @new_idx: the new target state index */ | static void ladder_do_selection(struct ladder_device *ldev, int old_idx, int new_idx) | /* ladder_do_selection - prepares private data for a state change @ldev: the ladder device @old_idx: the current state index @new_idx: the new target state index */
static void ladder_do_selection(struct ladder_device *ldev, int old_idx, int new_idx) | {
ldev->states[old_idx].stats.promotion_count = 0;
ldev->states[old_idx].stats.demotion_count = 0;
ldev->last_state_idx = new_idx;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Converts an Infini Band device path structure to its string representative. */ | VOID DevPathToTextInfiniBand(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts) | /* Converts an Infini Band device path structure to its string representative. */
VOID DevPathToTextInfiniBand(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts) | {
INFINIBAND_DEVICE_PATH *InfiniBand;
InfiniBand = DevPath;
UefiDevicePathLibCatPrint (
Str,
L"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
InfiniBand->ResourceFlags,
InfiniBand->PortGid,
InfiniBand->ServiceId,
InfiniBand->TargetPortId,
InfiniBand->DeviceId
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* USB Device HID Interrupt In/Out Endpoint Event Callback Parameters: event: USB Device Event USBD_EVT_IN: Input Event USBD_EVT_OUT: Output Event Return Value: None */ | void USBD_HID_EP_INT_Event(U32 event) | /* USB Device HID Interrupt In/Out Endpoint Event Callback Parameters: event: USB Device Event USBD_EVT_IN: Input Event USBD_EVT_OUT: Output Event Return Value: None */
void USBD_HID_EP_INT_Event(U32 event) | {
if (event & USBD_EVT_IN) {
USBD_HID_EP_INTIN_Event(event);
}
if (event & USBD_EVT_OUT) {
USBD_HID_EP_INTOUT_Event(event);
}
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* omap_get_dma_chain_src_pos - Get the source position of the ongoing DMA in chain */ | int omap_get_dma_chain_src_pos(int chain_id) | /* omap_get_dma_chain_src_pos - Get the source position of the ongoing DMA in chain */
int omap_get_dma_chain_src_pos(int chain_id) | {
int lch;
int *channels;
if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
printk(KERN_ERR "Invalid chain id\n");
return -EINVAL;
}
if (dma_linked_lch[chain_id].linked_dmach_q == NULL) {
printk(KERN_ERR "Chain doesn't exists\n");
return -EINVAL;
}
channels = dma_linked_lch[chain_id].linked_dmach_q;
lch = channels[dma_linked_lch[chain_id].q_head];
return dma_read(CSAC(lch));
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Name: ddr3_get_static_mc_value - Init Memory controller with static parameters Desc: Use this routine to init the controller without the HW training procedure User must provide compatible header file with registers data. Args: None. Notes: Returns: None. */ | u32 ddr3_get_static_mc_value(u32 reg_addr, u32 offset1, u32 mask1, u32 offset2, u32 mask2) | /* Name: ddr3_get_static_mc_value - Init Memory controller with static parameters Desc: Use this routine to init the controller without the HW training procedure User must provide compatible header file with registers data. Args: None. Notes: Returns: None. */
u32 ddr3_get_static_mc_value(u32 reg_addr, u32 offset1, u32 mask1, u32 offset2, u32 mask2) | {
u32 reg, tmp;
reg = reg_read(reg_addr);
tmp = (reg >> offset1) & mask1;
if (mask2)
tmp |= (reg >> offset2) & mask2;
return tmp;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* The idea is to avoid adding buffers to pages that don't already have them. So when the buffer is up to date and the page size == block size, this marks the page up to date instead of adding new buffers. */ | static void map_buffer_to_page(struct page *page, struct buffer_head *bh, int page_block) | /* The idea is to avoid adding buffers to pages that don't already have them. So when the buffer is up to date and the page size == block size, this marks the page up to date instead of adding new buffers. */
static void map_buffer_to_page(struct page *page, struct buffer_head *bh, int page_block) | {
struct inode *inode = page->mapping->host;
struct buffer_head *page_bh, *head;
int block = 0;
if (!page_has_buffers(page)) {
if (inode->i_blkbits == PAGE_CACHE_SHIFT &&
buffer_uptodate(bh)) {
SetPageUptodate(page);
return;
}
create_empty_buffers(page, 1 << inode->i_blkbits, 0);
}
head = page_buffers(page);
page_bh = head;
do {
if (block == page_block) {
page_bh->b_state = bh->b_state;
page_bh->b_bdev = bh->b_bdev;
page_bh->b_blocknr = bh->b_blocknr;
break;
}
page_bh = page_bh->b_this_page;
block++;
} while (page_bh != head);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The endpoint to prepare for transfer is specified as a physical endpoint number. For OUT (rx) endpoints 1 through 15, the corresponding endpoint configuration register is checked to see if the endpoint is ISO or not. If the OUT endpoint is valid and is non-ISO then its FIFO is enabled. No action is taken for endpoint 0 or for IN (tx) endpoints 16 through 30. */ | static void omap1510_prepare_endpoint_for_rx(int ep_addr) | /* The endpoint to prepare for transfer is specified as a physical endpoint number. For OUT (rx) endpoints 1 through 15, the corresponding endpoint configuration register is checked to see if the endpoint is ISO or not. If the OUT endpoint is valid and is non-ISO then its FIFO is enabled. No action is taken for endpoint 0 or for IN (tx) endpoints 16 through 30. */
static void omap1510_prepare_endpoint_for_rx(int ep_addr) | {
int ep_num = ep_addr & USB_ENDPOINT_NUMBER_MASK;
UDCDBGA ("omap1510_prepare_endpoint %x", ep_addr);
if (((ep_addr & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT)) {
if ((inw (UDC_EP_RX (ep_num)) &
(UDC_EPn_RX_Valid | UDC_EPn_RX_Iso)) ==
UDC_EPn_RX_Valid) {
outw (UDC_EP_Sel | ep_num, UDC_EP_NUM);
outw (UDC_Set_FIFO_En, UDC_CTRL);
outw (0, UDC_EP_NUM);
}
}
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* On exiting boot services we must make sure the SP805 Watchdog Timer is stopped. */ | STATIC VOID EFIAPI ExitBootServicesEvent(IN EFI_EVENT Event, IN VOID *Context) | /* On exiting boot services we must make sure the SP805 Watchdog Timer is stopped. */
STATIC VOID EFIAPI ExitBootServicesEvent(IN EFI_EVENT Event, IN VOID *Context) | {
SP805Unlock ();
SP805Stop ();
SP805Lock ();
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns the last ADCx conversion result data for regular channel. */ | uint16_t ADC_GetDat(ADC_Module *ADCx) | /* Returns the last ADCx conversion result data for regular channel. */
uint16_t ADC_GetDat(ADC_Module *ADCx) | {
assert_param(IsAdcModule(ADCx));
return (uint16_t)ADCx->DAT;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Check if a specific data message was received. */ | bool received_data_message(const struct device *dev, const union pd_header header, const enum pd_data_msg_type mt) | /* Check if a specific data message was received. */
bool received_data_message(const struct device *dev, const union pd_header header, const enum pd_data_msg_type mt) | {
struct usbc_port_data *data = dev->data;
struct protocol_layer_rx_t *prl_rx = data->prl_rx;
if (prl_rx->emsg.len > 0 && header.message_type == mt && header.extended == 0) {
return true;
}
return false;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Check if CRC is valid and (if yes) import the environment. Note that "buf" may or may not be aligned. */ | int env_import(const char *buf, int check) | /* Check if CRC is valid and (if yes) import the environment. Note that "buf" may or may not be aligned. */
int env_import(const char *buf, int check) | {
env_t *ep = (env_t *)buf;
if (check) {
uint32_t crc;
memcpy(&crc, &ep->crc, sizeof(crc));
if (crc32(0, ep->data, ENV_SIZE) != crc) {
env_set_default("bad CRC", 0);
return -ENOMSG;
}
}
if (himport_r(&env_htab, (char *)ep->data, ENV_SIZE, '\0', 0, 0,
0, NULL)) {
gd->flags |= GD_FLG_ENV_READY;
return 0;
}
pr_err("Cannot import environment: errno = %d\n", errno);
env_set_default("import failed", 0);
return -EIO;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Low-pass filter reset register. If the LPFP is active, in order to avoid the transitory phase, the filter can be reset by reading this register before generating pressure measurements.. */ | int32_t lps22hb_low_pass_rst_get(stmdev_ctx_t *ctx, uint8_t *buff) | /* Low-pass filter reset register. If the LPFP is active, in order to avoid the transitory phase, the filter can be reset by reading this register before generating pressure measurements.. */
int32_t lps22hb_low_pass_rst_get(stmdev_ctx_t *ctx, uint8_t *buff) | {
int32_t ret;
ret = lps22hb_read_reg(ctx, LPS22HB_LPFP_RES, (uint8_t*) buff, 1);
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Called after drive probe we use this to decide whether the Seagate fixup must be applied. This used to be in init_iops but that can occur before we know what drives are present. */ | static void sil_quirkproc(ide_drive_t *drive) | /* Called after drive probe we use this to decide whether the Seagate fixup must be applied. This used to be in init_iops but that can occur before we know what drives are present. */
static void sil_quirkproc(ide_drive_t *drive) | {
ide_hwif_t *hwif = drive->hwif;
if (!is_sata(hwif) || !is_dev_seagate_sata(drive))
hwif->rqsize = 128;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable the autonegotiation.
Enable the autonegotiation of the link speed and duplex mode */ | void phy_autoneg_enable(uint8_t phy) | /* Enable the autonegotiation.
Enable the autonegotiation of the link speed and duplex mode */
void phy_autoneg_enable(uint8_t phy) | {
eth_smi_bit_set(phy, PHY_REG_BCR, PHY_REG_BCR_AN | PHY_REG_BCR_ANRST);
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* CAN Initialize a 32bit Message ID Mask Filter. */ | void can_filter_id_mask_32bit_init(uint32_t nr, uint32_t id, uint32_t mask, uint32_t fifo, bool enable) | /* CAN Initialize a 32bit Message ID Mask Filter. */
void can_filter_id_mask_32bit_init(uint32_t nr, uint32_t id, uint32_t mask, uint32_t fifo, bool enable) | {
can_filter_init(nr, true, false, id, mask, fifo, enable);
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* Returns: (transfer none): the source, if one was found, otherwise NULL */ | GSource* g_main_context_find_source_by_funcs_user_data(GMainContext *context, GSourceFuncs *funcs, gpointer user_data) | /* Returns: (transfer none): the source, if one was found, otherwise NULL */
GSource* g_main_context_find_source_by_funcs_user_data(GMainContext *context, GSourceFuncs *funcs, gpointer user_data) | {
GSourceIter iter;
GSource *source;
g_return_val_if_fail (funcs != NULL, NULL);
if (context == NULL)
context = g_main_context_default ();
LOCK_CONTEXT (context);
g_source_iter_init (&iter, context, FALSE);
while (g_source_iter_next (&iter, &source))
{
if (!SOURCE_DESTROYED (source) &&
source->source_funcs == funcs &&
source->callback_funcs)
{
GSourceFunc callback;
gpointer callback_data;
source->callback_funcs->get (source->callback_data, source, &callback, &callback_data);
if (callback_data == user_data)
break;
}
}
g_source_iter_clear (&iter);
UNLOCK_CONTEXT (context);
return source;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This file is part of the Simba project. */ | int mock_write_errno_as_string(int errno, far_string_t res) | /* This file is part of the Simba project. */
int mock_write_errno_as_string(int errno, far_string_t res) | {
harness_mock_write("errno_as_string(errno)",
&errno,
sizeof(errno));
harness_mock_write("errno_as_string(): return (res)",
&res,
sizeof(res));
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* Update the current command call vector. Load the pointer to the list of recognized CLI commands. */ | void cli_load_command_calls(struct cli_desc *dev, uint8_t **command_calls) | /* Update the current command call vector. Load the pointer to the list of recognized CLI commands. */
void cli_load_command_calls(struct cli_desc *dev, uint8_t **command_calls) | {
dev->cmd_commands = command_calls;
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* Set the Number of Wait States.
Used to match the system clock to the FLASH memory access time. See the programming manual for more information on clock speed ranges. The latency must be changed to the appropriate value */ | void flash_set_ws(uint32_t ws) | /* Set the Number of Wait States.
Used to match the system clock to the FLASH memory access time. See the programming manual for more information on clock speed ranges. The latency must be changed to the appropriate value */
void flash_set_ws(uint32_t ws) | {
uint32_t reg32;
reg32 = FLASH_ACR;
reg32 &= ~(FLASH_ACR_LATENCY_MASK << FLASH_ACR_LATENCY_SHIFT);
reg32 |= (ws << FLASH_ACR_LATENCY_SHIFT);
FLASH_ACR = reg32;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Fills each RTC_TimeStruct member with its default value (Time = 00h:00min:00sec). */ | void RTC_TimeStructInit(RTC_TimeTypeDef *RTC_TimeStruct) | /* Fills each RTC_TimeStruct member with its default value (Time = 00h:00min:00sec). */
void RTC_TimeStructInit(RTC_TimeTypeDef *RTC_TimeStruct) | {
RTC_TimeStruct->RTC_H12 = RTC_H12_AM;
RTC_TimeStruct->RTC_Hours = 0;
RTC_TimeStruct->RTC_Minutes = 0;
RTC_TimeStruct->RTC_Seconds = 0;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* size must be a multiple of merging_snap's chunk_size. */ | static int origin_write_extent(struct dm_snapshot *merging_snap, sector_t sector, unsigned chunk_size) | /* size must be a multiple of merging_snap's chunk_size. */
static int origin_write_extent(struct dm_snapshot *merging_snap, sector_t sector, unsigned chunk_size) | {
int must_wait = 0;
sector_t n;
struct origin *o;
down_read(&_origins_lock);
o = __lookup_origin(merging_snap->origin->bdev);
for (n = 0; n < size; n += merging_snap->ti->split_io)
if (__origin_write(&o->snapshots, sector + n, NULL) ==
DM_MAPIO_SUBMITTED)
must_wait = 1;
up_read(&_origins_lock);
return must_wait;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Removes a callback function pair from the list of 'users' to be notified upon addition or removal of MTD devices. Causes the 'remove' callback to be immediately invoked for each MTD device currently present in the system. */ | int unregister_mtd_user(struct mtd_notifier *old) | /* Removes a callback function pair from the list of 'users' to be notified upon addition or removal of MTD devices. Causes the 'remove' callback to be immediately invoked for each MTD device currently present in the system. */
int unregister_mtd_user(struct mtd_notifier *old) | {
struct mtd_info *mtd;
mutex_lock(&mtd_table_mutex);
module_put(THIS_MODULE);
mtd_for_each_device(mtd)
old->remove(mtd);
list_del(&old->list);
mutex_unlock(&mtd_table_mutex);
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Unless required by applicable law or agreed to in writing, this software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ | static void bt_app_task_handler(void *arg) | /* Unless required by applicable law or agreed to in writing, this software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
static void bt_app_task_handler(void *arg) | {
bt_app_msg_t msg;
for (;;) {
if (pdTRUE == xQueueReceive(s_bt_app_task_queue, &msg, (portTickType)portMAX_DELAY)) {
ESP_LOGD(BT_APP_CORE_TAG, "%s, sig 0x%x, 0x%x", __func__, msg.sig, msg.event);
switch (msg.sig) {
case BT_APP_SIG_WORK_DISPATCH:
bt_app_work_dispatched(&msg);
break;
default:
ESP_LOGW(BT_APP_CORE_TAG, "%s, unhandled sig: %d", __func__, msg.sig);
break;
}
if (msg.param) {
free(msg.param);
}
}
}
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Obvious fact: You do not have a reference to any device that might be found by this function, so if that device is removed from the system right after this function is finished, the value will be stale. Use this function to find devices that are usually built into a system, or for a general hint as to if another device happens to be present at this specific moment in time. */ | int pci_dev_present(const struct pci_device_id *ids) | /* Obvious fact: You do not have a reference to any device that might be found by this function, so if that device is removed from the system right after this function is finished, the value will be stale. Use this function to find devices that are usually built into a system, or for a general hint as to if another device happens to be present at this specific moment in time. */
int pci_dev_present(const struct pci_device_id *ids) | {
struct pci_dev *found = NULL;
WARN_ON(in_interrupt());
while (ids->vendor || ids->subvendor || ids->class_mask) {
found = pci_get_dev_by_id(ids, NULL);
if (found)
goto exit;
ids++;
}
exit:
if (found)
return 1;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This programs up to N words of the Main array on one flash instance. */ | int am_hal_flash_program_main(uint32_t ui32Value, uint32_t *pui32Src, uint32_t *pui32Dst, uint32_t ui32NumWords) | /* This programs up to N words of the Main array on one flash instance. */
int am_hal_flash_program_main(uint32_t ui32Value, uint32_t *pui32Src, uint32_t *pui32Dst, uint32_t ui32NumWords) | {
return g_am_hal_flash.flash_program_main(ui32Value, pui32Src,
pui32Dst, ui32NumWords);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function is called when the socket is to be opened. */ | static int winc1500_get(sa_family_t family, enum net_sock_type type, enum net_ip_protocol ip_proto, struct net_context **context) | /* This function is called when the socket is to be opened. */
static int winc1500_get(sa_family_t family, enum net_sock_type type, enum net_ip_protocol ip_proto, struct net_context **context) | {
struct socket_data *sd;
SOCKET sock;
if (family != AF_INET) {
LOG_ERR("Only AF_INET is supported!");
return -1;
}
sock = socket(2, type, 0);
if (sock < 0) {
LOG_ERR("socket error!");
return -1;
}
(*context)->offload_context = (void *)(intptr_t)sock;
sd = &w1500_data.socket_data[sock];
k_sem_init(&sd->wait_sem, 0, 1);
sd->context = *context;
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Receive a piece of data in non-blocking way. */ | static void FLEXIO_I2S_ReadNonBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *rxData, size_t size) | /* Receive a piece of data in non-blocking way. */
static void FLEXIO_I2S_ReadNonBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *rxData, size_t size) | {
uint32_t i = 0;
uint8_t j = 0;
uint8_t bytesPerWord = bitWidth / 8U;
uint32_t data = 0;
for (i = 0; i < size / bytesPerWord; i++)
{
data = (base->flexioBase->SHIFTBUFBIS[base->rxShifterIndex]);
for (j = 0; j < bytesPerWord; j++)
{
*rxData = (data >> (8U * j)) & 0xFF;
rxData++;
}
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Program the Option Bytes This performs all operations necessary to program the option bytes. The option bytes do not need to be erased first. */ | void flash_program_option_bytes(uint32_t data) | /* Program the Option Bytes This performs all operations necessary to program the option bytes. The option bytes do not need to be erased first. */
void flash_program_option_bytes(uint32_t data) | {
flash_wait_for_last_operation();
if (FLASH_CR & FLASH_CR_OPTLOCK) {
flash_unlock_option_bytes();
}
FLASH_OPTR = data & ~0x3;
FLASH_OPTR |= FLASH_CR_OPTSTRT;
flash_wait_for_last_operation();
}
/**@} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Enables or disables the Low Speed APB (APB1) peripheral clock. */ | void RCC_EnableAPB1PeriphClk(uint32_t RCC_APB1Periph, FunctionalState Cmd) | /* Enables or disables the Low Speed APB (APB1) peripheral clock. */
void RCC_EnableAPB1PeriphClk(uint32_t RCC_APB1Periph, FunctionalState Cmd) | {
assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
RCC->APB1PCLKEN |= RCC_APB1Periph;
}
else
{
RCC->APB1PCLKEN &= ~RCC_APB1Periph;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function will return the length of a string, which terminate will null character. */ | rt_ubase_t rt_strlen(const char *s) | /* This function will return the length of a string, which terminate will null character. */
rt_ubase_t rt_strlen(const char *s) | {
const char *sc;
for (sc = s; *sc != '\0'; ++sc)
;
return sc - s;
} | armink/FreeModbus_Slave-Master-RTT-STM32 | C++ | Other | 1,477 |
/* Will print the current MAX and THRESHOLD values for the basic flow control. In addition it will report how many times the TX queue needed to be restarted since the last time this query was made. */ | static ssize_t wlp_tx_inflight_show(struct i1480u_tx_inflight *inflight, char *buf) | /* Will print the current MAX and THRESHOLD values for the basic flow control. In addition it will report how many times the TX queue needed to be restarted since the last time this query was made. */
static ssize_t wlp_tx_inflight_show(struct i1480u_tx_inflight *inflight, char *buf) | {
ssize_t result;
unsigned long sec_elapsed = (jiffies - inflight->restart_ts)/HZ;
unsigned long restart_count = atomic_read(&inflight->restart_count);
result = scnprintf(buf, PAGE_SIZE, "%lu %lu %d %lu %lu %lu\n"
"#read: threshold max inflight_count restarts "
"seconds restarts/sec\n"
"#write: threshold max\n",
inflight->threshold, inflight->max,
atomic_read(&inflight->count),
restart_count, sec_elapsed,
sec_elapsed == 0 ? 0 : restart_count/sec_elapsed);
inflight->restart_ts = jiffies;
atomic_set(&inflight->restart_count, 0);
return result;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* vio_unregister_driver - Remove registration of vio driver. @driver: The vio_driver struct to be removed form registration */ | void vio_unregister_driver(struct vio_driver *viodrv) | /* vio_unregister_driver - Remove registration of vio driver. @driver: The vio_driver struct to be removed form registration */
void vio_unregister_driver(struct vio_driver *viodrv) | {
driver_unregister(&viodrv->driver);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Determines whether the UART transmitter is busy or not. */ | bool UARTBusy(uint32_t ui32Base) | /* Determines whether the UART transmitter is busy or not. */
bool UARTBusy(uint32_t ui32Base) | {
ASSERT(_UARTBaseValid(ui32Base));
return((HWREG(ui32Base + UART_O_FR) & UART_FR_BUSY) ? true : false);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Function for handling callbacks from pstorage module.
Handles pstorage results for clear and storage operation. For detailed description of the parameters provided with the callback, please refer to pstorage_ntf_cb_t. */ | static void pstorage_callback_handler(pstorage_handle_t *p_handle, uint8_t op_code, uint32_t result, uint8_t *p_data, uint32_t data_len) | /* Function for handling callbacks from pstorage module.
Handles pstorage results for clear and storage operation. For detailed description of the parameters provided with the callback, please refer to pstorage_ntf_cb_t. */
static void pstorage_callback_handler(pstorage_handle_t *p_handle, uint8_t op_code, uint32_t result, uint8_t *p_data, uint32_t data_len) | {
if ((m_update_status == BOOTLOADER_SETTINGS_SAVING) && (op_code == PSTORAGE_STORE_OP_CODE))
{
m_update_status = BOOTLOADER_COMPLETE;
}
APP_ERROR_CHECK(result);
} | labapart/polymcu | C++ | null | 201 |
/* USB Device Connect Function Called by the User to Connect/Disconnect USB Device Parameters: con: Connect/Disconnect Return Value: None */ | void USBD_Connect(BOOL con) | /* USB Device Connect Function Called by the User to Connect/Disconnect USB Device Parameters: con: Connect/Disconnect Return Value: None */
void USBD_Connect(BOOL con) | {
if (con) {
CNTR = CNTR_FRES;
CNTR = 0;
ISTR = 0;
CNTR = CNTR_RESETM | CNTR_SUSPM | CNTR_WKUPM;
USB_CONNECT_ON();
} else {
CNTR = CNTR_FRES | CNTR_PDWN;
USB_CONNECT_OFF();
}
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Reads data from the specified data Backup Register immediately. */ | u16 exBKP_ImmRead(BKPDR_Typedef bkp_dr) | /* Reads data from the specified data Backup Register immediately. */
u16 exBKP_ImmRead(BKPDR_Typedef bkp_dr) | {
u16 dat;
RCC->BDCR |= RCC_BDCR_DBP;
dat = (*(vu16*)(BKP_BASE + bkp_dr));
RCC->BDCR &= ~RCC_BDCR_DBP;
return dat;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Figure out to which domain a cpu belongs and stick it there. Return the id of the domain used. */ | static int __cpuinit numa_setup_cpu(unsigned long lcpu) | /* Figure out to which domain a cpu belongs and stick it there. Return the id of the domain used. */
static int __cpuinit numa_setup_cpu(unsigned long lcpu) | {
int nid = 0;
struct device_node *cpu = of_get_cpu_node(lcpu, NULL);
if (!cpu) {
WARN_ON(1);
goto out;
}
nid = of_node_to_nid_single(cpu);
if (nid < 0 || !node_online(nid))
nid = any_online_node(NODE_MASK_ALL);
out:
map_cpu_to_node(lcpu, nid);
of_node_put(cpu);
return nid;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* sends a piece of data in non-blocking way. */ | static void FLEXIO_I2S_WriteNonBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *txData, size_t size) | /* sends a piece of data in non-blocking way. */
static void FLEXIO_I2S_WriteNonBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *txData, size_t size) | {
uint32_t i = 0;
uint8_t j = 0;
uint8_t bytesPerWord = bitWidth / 8U;
uint32_t data = 0;
uint32_t temp = 0;
for (i = 0; i < size / bytesPerWord; i++)
{
for (j = 0; j < bytesPerWord; j++)
{
temp = (uint32_t)(*txData);
data |= (temp << (8U * j));
txData++;
}
base->flexioBase->SHIFTBUFBIS[base->txShifterIndex] = (data << (32U - bitWidth));
data = 0;
}
} | labapart/polymcu | C++ | null | 201 |
/* slave mode tx data transmit phase adjust set. */ | void SPI_SlaveAdjust(SPI_TypeDef *SPIx, uint16_t AdjustValue) | /* slave mode tx data transmit phase adjust set. */
void SPI_SlaveAdjust(SPI_TypeDef *SPIx, uint16_t AdjustValue) | {
assert_param(IS_SPI_ALL_PERIPH(SPIx));
assert_param(IS_SPI_SlaveAdjust(AdjustValue));
SPIx->CCTL |= AdjustValue;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Reads data from the specified adc channel fifo. */ | float analogin_read(analogin_t *obj) | /* Reads data from the specified adc channel fifo. */
float analogin_read(analogin_t *obj) | {
float value;
uint32_t AnalogDatFull = 0xFFF;
uint8_t ChIdx = obj->adc_idx;
uint32_t data;
ADC->ADC_CHSW_LIST[0] = ChIdx;
ADC_ClearFIFO();
ADC_SWTrigCmd(ENABLE);
while(ADC_Readable()== 0);
ADC_SWTrigCmd(DISABLE);
data = ADC_Read();
value = (float)(data) / (float)(AnalogDatFull);
return (float)value;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Check if the RTOS kernel is already started. */ | int32_t osKernelRunning(void) | /* Check if the RTOS kernel is already started. */
int32_t osKernelRunning(void) | {
return (int32_t)os_running;
} else {
return __svcKernelRunning();
}
} | labapart/polymcu | C++ | null | 201 |
/* Detect the type of the SoC, this is done by reading the PHYCFG_OFS register, this register should contain non-zero value and it exists only in the 65 nano devices, when reading it from older devices we get 0. */ | static bool soc_is_65n(struct mv_host_priv *hpriv) | /* Detect the type of the SoC, this is done by reading the PHYCFG_OFS register, this register should contain non-zero value and it exists only in the 65 nano devices, when reading it from older devices we get 0. */
static bool soc_is_65n(struct mv_host_priv *hpriv) | {
void __iomem *port0_mmio = mv_port_base(hpriv->base, 0);
if (readl(port0_mmio + PHYCFG_OFS))
return true;
return false;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Circular burst-mode (rounding) read of the output registers.. */ | int32_t lsm6dso_rounding_mode_set(stmdev_ctx_t *ctx, lsm6dso_rounding_t val) | /* Circular burst-mode (rounding) read of the output registers.. */
int32_t lsm6dso_rounding_mode_set(stmdev_ctx_t *ctx, lsm6dso_rounding_t val) | {
lsm6dso_ctrl5_c_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL5_C, (uint8_t *)®, 1);
if (ret == 0) {
reg.rounding = (uint8_t)val;
ret = lsm6dso_write_reg(ctx, LSM6DSO_CTRL5_C, (uint8_t *)®, 1);
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Fills each CRYP_InitStruct member with its default value. */ | void CRYP_StructInit(CRYP_InitTypeDef *CRYP_InitStruct) | /* Fills each CRYP_InitStruct member with its default value. */
void CRYP_StructInit(CRYP_InitTypeDef *CRYP_InitStruct) | {
CRYP_InitStruct->CRYP_AlgoDir = CRYP_AlgoDir_Encrypt;
CRYP_InitStruct->CRYP_AlgoMode = CRYP_AlgoMode_TDES_ECB;
CRYP_InitStruct->CRYP_DataType = CRYP_DataType_32b;
CRYP_InitStruct->CRYP_KeySize = CRYP_KeySize_128b;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Hide an object. It won't be visible and clickable. */ | void lv_obj_set_hidden(lv_obj_t *obj, bool en) | /* Hide an object. It won't be visible and clickable. */
void lv_obj_set_hidden(lv_obj_t *obj, bool en) | {
if(!obj->hidden) lv_obj_invalidate(obj);
obj->hidden = en == false ? 0 : 1;
if(!obj->hidden) lv_obj_invalidate(obj);
lv_obj_t * par = lv_obj_get_parent(obj);
par->signal_cb(par, LV_SIGNAL_CHILD_CHG, obj);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* SPI nss pin high level in software mode. */ | void spi_nss_internal_high(uint32_t spi_periph) | /* SPI nss pin high level in software mode. */
void spi_nss_internal_high(uint32_t spi_periph) | {
SPI_CTL0(spi_periph) |= SPI_CTL0_SWNSS;
} | liuxuming/trochili | C++ | Apache License 2.0 | 132 |
/* Return the form id for the input hiihandle and formset. */ | EFI_FORM_ID GetFirstFormId(IN EFI_HII_HANDLE HiiHandle, IN EFI_GUID *FormSetGuid) | /* Return the form id for the input hiihandle and formset. */
EFI_FORM_ID GetFirstFormId(IN EFI_HII_HANDLE HiiHandle, IN EFI_GUID *FormSetGuid) | {
LIST_ENTRY *Link;
FORM_BROWSER_FORM *Form;
Link = GetFirstNode (&gCurrentSelection->FormSet->FormListHead);
Form = FORM_BROWSER_FORM_FROM_LINK (Link);
return Form->FormId;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* A parser parses a Device Tree to populate a specific CmObj type. None, one or many CmObj can be created by the parser. The created CmObj are then handed to the parser's caller through the HW_INFO_ADD_OBJECT interface. This can also be a dispatcher. I.e. a function that not parsing a Device Tree but calling other parsers. */ | STATIC EFI_STATUS EFIAPI MainDispatcher(IN CONST FDT_HW_INFO_PARSER_HANDLE FdtParserHandle, IN INT32 FdtBranch) | /* A parser parses a Device Tree to populate a specific CmObj type. None, one or many CmObj can be created by the parser. The created CmObj are then handed to the parser's caller through the HW_INFO_ADD_OBJECT interface. This can also be a dispatcher. I.e. a function that not parsing a Device Tree but calling other parsers. */
STATIC EFI_STATUS EFIAPI MainDispatcher(IN CONST FDT_HW_INFO_PARSER_HANDLE FdtParserHandle, IN INT32 FdtBranch) | {
EFI_STATUS Status;
UINT32 Index;
if (fdt_check_header (FdtParserHandle->Fdt) < 0) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
for (Index = 0; Index < ARRAY_SIZE (HwInfoParserTable); Index++) {
Status = HwInfoParserTable[Index](
FdtParserHandle,
FdtBranch
);
if (EFI_ERROR (Status) &&
(Status != EFI_NOT_FOUND))
{
ASSERT (0);
return Status;
}
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function can be called from gtk_tree_view_column_set_cell_data_func() the user data must be the column number. Present value as hexadecimal. */ | void present_as_hex_func(GtkTreeViewColumn *column _U_, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data) | /* This function can be called from gtk_tree_view_column_set_cell_data_func() the user data must be the column number. Present value as hexadecimal. */
void present_as_hex_func(GtkTreeViewColumn *column _U_, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data) | {
guint val;
gchar buf[35];
gint col = GPOINTER_TO_INT(user_data);
gtk_tree_model_get(model, iter, col, &val, -1);
g_snprintf(buf, sizeof(buf), "0x%02x", val);
g_object_set(renderer, "text", buf, NULL);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* param base ADC peripheral base address. param config Pointer to "adc_offest_config_t" structure. */ | void ADC_SetOffsetConfig(ADC_Type *base, const adc_offest_config_t *config) | /* param base ADC peripheral base address. param config Pointer to "adc_offest_config_t" structure. */
void ADC_SetOffsetConfig(ADC_Type *base, const adc_offest_config_t *config) | {
assert(NULL != config);
uint32_t tmp32;
tmp32 = ADC_OFS_OFS(config->offsetValue);
if (config->enableSigned)
{
tmp32 |= ADC_OFS_SIGN_MASK;
}
base->OFS = tmp32;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* This function returns volume table contents in case of success and a negative error code in case of failure. */ | static struct ubi_vtbl_record* create_empty_lvol(struct ubi_device *ubi, struct ubi_scan_info *si) | /* This function returns volume table contents in case of success and a negative error code in case of failure. */
static struct ubi_vtbl_record* create_empty_lvol(struct ubi_device *ubi, struct ubi_scan_info *si) | {
int i;
struct ubi_vtbl_record *vtbl;
vtbl = vmalloc(ubi->vtbl_size);
if (!vtbl)
return ERR_PTR(-ENOMEM);
memset(vtbl, 0, ubi->vtbl_size);
for (i = 0; i < ubi->vtbl_slots; i++)
memcpy(&vtbl[i], &empty_vtbl_record, UBI_VTBL_RECORD_SIZE);
for (i = 0; i < UBI_LAYOUT_VOLUME_EBS; i++) {
int err;
err = create_vtbl(ubi, si, i, vtbl);
if (err) {
vfree(vtbl);
return ERR_PTR(err);
}
}
return vtbl;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* bcm_rx_starttimer - enable timeout monitoring for CAN frame receiption */ | static void bcm_rx_starttimer(struct bcm_op *op) | /* bcm_rx_starttimer - enable timeout monitoring for CAN frame receiption */
static void bcm_rx_starttimer(struct bcm_op *op) | {
if (op->flags & RX_NO_AUTOTIMER)
return;
if (op->kt_ival1.tv64)
hrtimer_start(&op->timer, op->kt_ival1, HRTIMER_MODE_REL);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Redraw all help pages, to use a new font. */ | void help_redraw(void) | /* Redraw all help pages, to use a new font. */
void help_redraw(void) | {
GSList *help_page_ent;
help_page_t *help_page;
if (help_w != NULL) {
for (help_page_ent = help_text_pages; help_page_ent != NULL;
help_page_ent = g_slist_next(help_page_ent))
{
help_page = (help_page_t *)help_page_ent->data;
text_page_redraw(help_page->page, help_page->pathname);
}
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* I now DER encode the name and hash it. Since I cache the DER encoding, this is reasonably efficient. */ | unsigned long X509_NAME_hash_old(X509_NAME *x) | /* I now DER encode the name and hash it. Since I cache the DER encoding, this is reasonably efficient. */
unsigned long X509_NAME_hash_old(X509_NAME *x) | {
EVP_MD_CTX md_ctx;
unsigned long ret = 0;
unsigned char md[16];
i2d_X509_NAME(x, NULL);
EVP_MD_CTX_init(&md_ctx);
if (EVP_DigestInit_ex(&md_ctx, EVP_md5(), NULL)
&& EVP_DigestUpdate(&md_ctx, x->bytes->data, x->bytes->length)
&& EVP_DigestFinal_ex(&md_ctx, md, NULL))
ret = (((unsigned long)md[0]) | ((unsigned long)md[1] << 8L) |
((unsigned long)md[2] << 16L) | ((unsigned long)md[3] << 24L)
) & 0xffffffffL;
EVP_MD_CTX_cleanup(&md_ctx);
return (ret);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* A simple wrapper function that allows you to free a pbuf from interrupt context. */ | err_t pbuf_free_callback(struct pbuf *p) | /* A simple wrapper function that allows you to free a pbuf from interrupt context. */
err_t pbuf_free_callback(struct pbuf *p) | {
return tcpip_try_callback(pbuf_free_int, p);
} | ua1arn/hftrx | C++ | null | 69 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.