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 |
|---|---|---|---|---|---|---|---|
/* Retrieve the system clock frequency from eNVM spare page if available. Returns the frequency defined through SMARTFUSION_FCLK_FREQ if FCLK cannot be retrieved from eNVM spare pages. The FCLK frequency value selected in the MSS Configurator software tool is stored in eNVM spare pages as part of the Actel system boot ... | static unsigned long clock_get_fclk(void) | /* Retrieve the system clock frequency from eNVM spare page if available. Returns the frequency defined through SMARTFUSION_FCLK_FREQ if FCLK cannot be retrieved from eNVM spare pages. The FCLK frequency value selected in the MSS Configurator software tool is stored in eNVM spare pages as part of the Actel system boot ... | {
unsigned long fclk = 0;
unsigned long sysboot_version;
if (SYSBOOT_KEY_VALUE == readl(SYSBOOT_KEY_ADDR)) {
sysboot_version = readl(SYSBOOT_VERSION_ADDR);
sysboot_version &= SYSBOOT_VERSION_MASK;
if (sysboot_version >= MIN_SYSBOOT_VERSION) {
if (sysboot_version < SYSBOOT_VERSION_2_X) {
fclk = readl(SYS... | EmcraftSystems/u-boot | C++ | Other | 181 |
/* 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;
... | armink/FreeModbus_Slave-Master-RTT-STM32 | C++ | Other | 1,477 |
/* Returns: (transfer full): #GAppInfo for given @uri_scheme or NULL on error. */ | GAppInfo* g_app_info_get_default_for_uri_scheme(const char *uri_scheme) | /* Returns: (transfer full): #GAppInfo for given @uri_scheme or NULL on error. */
GAppInfo* g_app_info_get_default_for_uri_scheme(const char *uri_scheme) | {
GAppInfo *app_info;
char *content_type, *scheme_down;
scheme_down = g_ascii_strdown (uri_scheme, -1);
content_type = g_strdup_printf ("x-scheme-handler/%s", scheme_down);
g_free (scheme_down);
app_info = g_app_info_get_default_for_type (content_type, FALSE);
g_free (content_type);
return app_info;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Initializes the GPIO device port, include data direction registers. */ | void port_init(port_t *obj, PortName port, int mask, PinDirection dir) | /* Initializes the GPIO device port, include data direction registers. */
void port_init(port_t *obj, PortName port, int mask, PinDirection dir) | {
assert_param(port < GPIO_PORT_NUM);
obj->port = port;
obj->mask = mask;
port_dir(obj, dir);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* AES128 decryption: Given AES128 key and 16 bytes cipher text, plain text of 16 bytes is computed The AES implementation is in mode ECB (Electronic Code Book).
aes_decrypt */ | void aes_decrypt(UINT8 *state, UINT8 *key) | /* AES128 decryption: Given AES128 key and 16 bytes cipher text, plain text of 16 bytes is computed The AES implementation is in mode ECB (Electronic Code Book).
aes_decrypt */
void aes_decrypt(UINT8 *state, UINT8 *key) | {
expandKey(expandedKey, key);
aes_decr(state, expandedKey);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Note: This function is based on FreeRTOS API, because no equivalent CMSIS-RTOS API is available */ | void sys_arch_unprotect(sys_prot_t pval) | /* Note: This function is based on FreeRTOS API, because no equivalent CMSIS-RTOS API is available */
void sys_arch_unprotect(sys_prot_t pval) | {
( void ) pval;
osMutexRelease(lwip_sys_mutex);
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Return codes 0 - successful EIO - The mailbox failed to complete successfully. When this error occurs, the driver is not guaranteed to have any rpi regions posted to the device and must either attempt to repost the regions or take a fatal error. */ | int lpfc_sli4_post_all_rpi_hdrs(struct lpfc_hba *phba) | /* Return codes 0 - successful EIO - The mailbox failed to complete successfully. When this error occurs, the driver is not guaranteed to have any rpi regions posted to the device and must either attempt to repost the regions or take a fatal error. */
int lpfc_sli4_post_all_rpi_hdrs(struct lpfc_hba *phba) | {
struct lpfc_rpi_hdr *rpi_page;
uint32_t rc = 0;
list_for_each_entry(rpi_page, &phba->sli4_hba.lpfc_rpi_hdr_list, list) {
rc = lpfc_sli4_post_rpi_hdr(phba, rpi_page);
if (rc != MBX_SUCCESS) {
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
"2008 Error %d posting all rpi "
"headers\n", rc);
rc = -EIO;
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function returns the capacity of the ATA device if it follows ATA 6 to support 48 bit addressing. */ | EFI_LBA GetAtapi6Capacity(IN ATA_IDENTIFY_DATA *IdentifyData) | /* This function returns the capacity of the ATA device if it follows ATA 6 to support 48 bit addressing. */
EFI_LBA GetAtapi6Capacity(IN ATA_IDENTIFY_DATA *IdentifyData) | {
EFI_LBA Capacity;
EFI_LBA TmpLba;
UINTN Index;
if ((IdentifyData->command_set_supported_83 & BIT10) == 0) {
return 0;
}
Capacity = 0;
for (Index = 0; Index < 4; Index++) {
TmpLba = IdentifyData->maximum_lba_for_48bit_addressing[Index];
Capacity |= LShiftU64 (TmpLba, 16 * Index);
}
... | tianocore/edk2 | C++ | Other | 4,240 |
/* Merge 2 ranges (normal and prefetchable) into a single aperture comprehending the addresses encompassed by both of them. If both ranges are not empty they must be contiguous for correctness. */ | STATIC EFI_STATUS MergeHostBridgeApertures(IN UINT64 Start, IN UINT64 Size, IN UINT64 PStart, IN UINT64 PSize, IN UINT64 MaxValue, OUT PCI_ROOT_BRIDGE_APERTURE *Aperture) | /* Merge 2 ranges (normal and prefetchable) into a single aperture comprehending the addresses encompassed by both of them. If both ranges are not empty they must be contiguous for correctness. */
STATIC EFI_STATUS MergeHostBridgeApertures(IN UINT64 Start, IN UINT64 Size, IN UINT64 PStart, IN UINT64 PSize, IN UINT64 Ma... | {
UINT64 PEnd;
if (Aperture == NULL) {
if (!IS_RANGE_INVALID (Start, Size, MaxValue) ||
!IS_RANGE_INVALID (PStart, PSize, MaxValue))
{
return EFI_INVALID_PARAMETER;
}
return EFI_WARN_BUFFER_TOO_SMALL;
}
InvalidateRootBridgeAperture (Aperture);
if (!IS_RANGE_INVALID (Start, Size,... | tianocore/edk2 | C++ | Other | 4,240 |
/* Read the Parameter Storage Area from the WaveLAN card's memory */ | static void psa_read(struct net_device *dev, int o, u_char *b, int n) | /* Read the Parameter Storage Area from the WaveLAN card's memory */
static void psa_read(struct net_device *dev, int o, u_char *b, int n) | {
net_local *lp = netdev_priv(dev);
u_char __iomem *ptr = lp->mem + PSA_ADDR + (o << 1);
while(n-- > 0)
{
*b++ = readb(ptr);
ptr += 2;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Outputs a formatted message via the error message handler. The default handler simply outputs the message to stderr, without appending a trailing new-line character. Typically, @format should end with its own new-line character. */ | void g_printerr(const gchar *format,...) | /* Outputs a formatted message via the error message handler. The default handler simply outputs the message to stderr, without appending a trailing new-line character. Typically, @format should end with its own new-line character. */
void g_printerr(const gchar *format,...) | {
va_list args;
gchar *string;
GPrintFunc local_glib_printerr_func;
g_return_if_fail (format != NULL);
va_start (args, format);
string = g_strdup_vprintf (format, args);
va_end (args);
g_mutex_lock (&g_messages_lock);
local_glib_printerr_func = glib_printerr_func;
g_mutex_unlock (&g_messages_lock);
... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns the end of the internal content or NULL in case of error */ | xmlChar* xmlBufEnd(xmlBufPtr buf) | /* Returns the end of the internal content or NULL in case of error */
xmlChar* xmlBufEnd(xmlBufPtr buf) | {
if ((!buf) || (buf->error))
return NULL;
CHECK_COMPAT(buf)
return(&buf->content[buf->use]);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Deselect the micro SD card and release the SPI bus. */ | void MICROSD_Deselect(void) | /* Deselect the micro SD card and release the SPI bus. */
void MICROSD_Deselect(void) | {
GPIO->P[ MICROSD_GPIOPORT ].DOUTSET = 1 << MICROSD_CSPIN;
MICROSD_XferSpi(0xff);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* ioat2_cleanup - clean finished descriptors (advance tail pointer) @chan: ioat channel to be cleaned up */ | static void ioat2_cleanup(struct ioat2_dma_chan *ioat) | /* ioat2_cleanup - clean finished descriptors (advance tail pointer) @chan: ioat channel to be cleaned up */
static void ioat2_cleanup(struct ioat2_dma_chan *ioat) | {
struct ioat_chan_common *chan = &ioat->base;
unsigned long phys_complete;
prefetch(chan->completion);
if (!spin_trylock_bh(&chan->cleanup_lock))
return;
if (!ioat_cleanup_preamble(chan, &phys_complete)) {
spin_unlock_bh(&chan->cleanup_lock);
return;
}
if (!spin_trylock_bh(&ioat->ring_lock)) {
spin_unlo... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* strncmp - Compare two length-limited strings @cs: One string @ct: Another string @count: The maximum number of bytes to compare */ | int strncmp(const char *cs, const char *ct, size_t count) | /* strncmp - Compare two length-limited strings @cs: One string @ct: Another string @count: The maximum number of bytes to compare */
int strncmp(const char *cs, const char *ct, size_t count) | {
unsigned char c1, c2;
while (count) {
c1 = *cs++;
c2 = *ct++;
if (c1 != c2)
return c1 < c2 ? -1 : 1;
if (!c1)
break;
count--;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: the length of data that have been completed by DDP */ | static int fcoe_ddp_done(struct fc_lport *, u16) | /* Returns: the length of data that have been completed by DDP */
static int fcoe_ddp_done(struct fc_lport *, u16) | {
struct net_device *netdev = fcoe_netdev(lport);
if (netdev->netdev_ops->ndo_fcoe_ddp_done)
return netdev->netdev_ops->ndo_fcoe_ddp_done(netdev, xid);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns 0 on success or -1 with the statistic lock released if the room in the socket buffer was not sufficient. */ | int gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic_packed *b) | /* Returns 0 on success or -1 with the statistic lock released if the room in the socket buffer was not sufficient. */
int gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic_packed *b) | {
if (d->compat_tc_stats) {
d->tc_stats.bytes = b->bytes;
d->tc_stats.packets = b->packets;
}
if (d->tail) {
struct gnet_stats_basic sb;
memset(&sb, 0, sizeof(sb));
sb.bytes = b->bytes;
sb.packets = b->packets;
return gnet_stats_copy(d, TCA_STATS_BASIC, &sb, sizeof(sb));
}
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Compute a path for the given arc (defined in the negative direction) and append it onto the current path within @cr. The arc will be accurate within the current tolerance and given the current transformation. */ | void _cairo_arc_path_negative(cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2) | /* Compute a path for the given arc (defined in the negative direction) and append it onto the current path within @cr. The arc will be accurate within the current tolerance and given the current transformation. */
void _cairo_arc_path_negative(cairo_t *cr, double xc, double yc, double radius, double angle1, double an... | {
_cairo_arc_in_direction (cr, xc, yc,
radius,
angle2, angle1,
CAIRO_DIRECTION_REVERSE);
} | xboot/xboot | C++ | MIT License | 779 |
/* Runs through the given path (or query) segment and checks if percent-encodings are correct. This function returns */ | static int check_segment(const unsigned char *s, size_t length) | /* Runs through the given path (or query) segment and checks if percent-encodings are correct. This function returns */
static int check_segment(const unsigned char *s, size_t length) | {
if (*s == '%') {
if (length < 2 || !(isxdigit(s[1]) && isxdigit(s[2])))
return -1;
s += 2;
length -= 2;
}
++s; ++n; --length;
}
return n;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Pre operation attributes. Print only if vflag > 1. */ | static const uint32_t* parse_pre_op_attr(netdissect_options *ndo, const uint32_t *dp, int verbose) | /* Pre operation attributes. Print only if vflag > 1. */
static const uint32_t* parse_pre_op_attr(netdissect_options *ndo, const uint32_t *dp, int verbose) | {
ND_TCHECK(dp[0]);
if (!EXTRACT_32BITS(&dp[0]))
return (dp + 1);
dp++;
ND_TCHECK2(*dp, 24);
if (verbose > 1) {
return parse_wcc_attr(ndo, dp);
} else {
return (dp + 6);
}
trunc:
return (NULL);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* return the number of times the character was encountered in the string */ | static int count_char_occurence(const char *input, const char char_to_count) | /* return the number of times the character was encountered in the string */
static int count_char_occurence(const char *input, const char char_to_count) | {
if (*current == char_to_count) occur++;
current++;
}
return occur;
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* Disable time stamp snapshot for IPV6 frames. When disabled, time stamp snapshot is not taken for IPV6 frames Reserved when "Advanced Time Stamp" is not selected */ | void synopGMAC_TS_IPV6_disable(synopGMACdevice *gmacdev) | /* Disable time stamp snapshot for IPV6 frames. When disabled, time stamp snapshot is not taken for IPV6 frames Reserved when "Advanced Time Stamp" is not selected */
void synopGMAC_TS_IPV6_disable(synopGMACdevice *gmacdev) | {
synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSIPV6ENA);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Never call this function except to cancel the effect of a previous call to g_application_hold(). */ | void g_application_release(GApplication *application) | /* Never call this function except to cancel the effect of a previous call to g_application_hold(). */
void g_application_release(GApplication *application) | {
g_return_if_fail (G_IS_APPLICATION (application));
g_return_if_fail (application->priv->use_count > 0);
application->priv->use_count--;
if (application->priv->use_count == 0 && application->priv->inactivity_timeout)
application->priv->inactivity_timeout_id = g_timeout_add (application->priv->inactivity_ti... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Clear the status of the specified ADC flag. */ | void ADC_ClearStatus(CM_ADC_TypeDef *ADCx, uint8_t u8Flag) | /* Clear the status of the specified ADC flag. */
void ADC_ClearStatus(CM_ADC_TypeDef *ADCx, uint8_t u8Flag) | {
DDL_ASSERT(IS_ADC_UNIT(ADCx));
DDL_ASSERT(IS_ADC_FLAG(u8Flag));
CLR_REG8_BIT(ADCx->ISR, u8Flag);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Clears or safeguards the OCREF1 signal on an external event. */ | void TIM_ClrOc1Ref(TIM_Module *TIMx, uint16_t TIM_OCClear) | /* Clears or safeguards the OCREF1 signal on an external event. */
void TIM_ClrOc1Ref(TIM_Module *TIMx, uint16_t TIM_OCClear) | {
uint16_t tmpccmr1 = 0;
assert_param(IsTimList3Module(TIMx));
assert_param(IsTimOcClrState(TIM_OCClear));
tmpccmr1 = TIMx->CCMOD1;
tmpccmr1 &= (uint16_t) ~((uint16_t)TIM_CCMOD1_OC1CEN);
tmpccmr1 |= TIM_OCClear;
TIMx->CCMOD1 = tmpccmr1;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* This API reads the data ready status of Mag from the sensor. The status get reset when Mag data register is read. */ | uint16_t bma4_get_mag_data_rdy(uint8_t *data_rdy, struct bma4_dev *dev) | /* This API reads the data ready status of Mag from the sensor. The status get reset when Mag data register is read. */
uint16_t bma4_get_mag_data_rdy(uint8_t *data_rdy, struct bma4_dev *dev) | {
uint16_t rslt = 0;
uint8_t data = 0;
if (dev == NULL) {
rslt |= BMA4_E_NULL_PTR;
} else {
rslt |= bma4_read_regs(BMA4_STATUS_ADDR, &data, 1, dev);
if (rslt == BMA4_OK)
*data_rdy = BMA4_GET_BITSLICE(data, BMA4_STAT_DATA_RDY_MAG);
}
return rslt;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* This function is called while kernel-module is loaded */ | static int __init usb_gigaset_init(void) | /* This function is called while kernel-module is loaded */
static int __init usb_gigaset_init(void) | {
int result;
driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS,
GIGASET_MODULENAME, GIGASET_DEVNAME,
&ops, THIS_MODULE);
if (driver == NULL)
goto error;
result = usb_register(&gigaset_usb_driver);
if (result < 0) {
pr_err("error %d registering USB driver\n", -result);
goto error;
}
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Base64-encodes a small chunk of data and transmits it. The data must be no larger than three bytes. */ | static int mcumgr_serial_tx_small(const void *data, int len, mcumgr_serial_tx_cb cb) | /* Base64-encodes a small chunk of data and transmits it. The data must be no larger than three bytes. */
static int mcumgr_serial_tx_small(const void *data, int len, mcumgr_serial_tx_cb cb) | {
uint8_t b64[4 + 1];
size_t dst_len;
int rc;
rc = base64_encode(b64, sizeof(b64), &dst_len, data, len);
__ASSERT_NO_MSG(rc == 0);
__ASSERT_NO_MSG(dst_len == 4);
return cb(b64, 4);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Submits register request to kgameportd for subsequent execution. Note that port registration is always asynchronous. */ | void __gameport_register_port(struct gameport *gameport, struct module *owner) | /* Submits register request to kgameportd for subsequent execution. Note that port registration is always asynchronous. */
void __gameport_register_port(struct gameport *gameport, struct module *owner) | {
gameport_init_port(gameport);
gameport_queue_event(gameport, owner, GAMEPORT_REGISTER_PORT);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Call all neighbour notifier blocks. Parameters and return value are as for notifier_call_chain(). */ | int call_netevent_notifiers(unsigned long val, void *v) | /* Call all neighbour notifier blocks. Parameters and return value are as for notifier_call_chain(). */
int call_netevent_notifiers(unsigned long val, void *v) | {
return atomic_notifier_call_chain(&netevent_notif_chain, val, v);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function initializes clock module by opening the CGC Module and Changes the System Clock to MOSC. */ | static fsp_err_t init_cgc(void) | /* This function initializes clock module by opening the CGC Module and Changes the System Clock to MOSC. */
static fsp_err_t init_cgc(void) | {
fsp_err_t err = FSP_SUCCESS;
cgc_clock_t lsys_clock_source = {RESET_VALUE};
cgc_divider_cfg_t sys_divider_cf = {RESET_VALUE};
err = R_CGC_Open(&g_cgc0_ctrl, &g_cgc0_cfg);
if (FSP_SUCCESS == err)
{
err = R_CGC_SystemClockGet(&g_cgc0_ctrl, &lsys_clock_source, &sys_divider_cf);
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* configure the delayed sample clock of read data */ | void exmc_sdram_readsample_config(uint32_t delay_cell, uint32_t extra_hclk) | /* configure the delayed sample clock of read data */
void exmc_sdram_readsample_config(uint32_t delay_cell, uint32_t extra_hclk) | {
uint32_t sdrsctl = 0U;
sdrsctl = EXMC_SDRSCTL & (~(EXMC_SDRSCTL_SDSC | EXMC_SDRSCTL_SSCR));
sdrsctl |= (uint32_t)(delay_cell | extra_hclk);
EXMC_SDRSCTL = sdrsctl;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set the an array of points for LV_INDEV_TYPE_BUTTON. These points will be assigned to the buttons to press a specific point on the screen */ | void lv_indev_set_button_points(lv_indev_t *indev, const lv_point_t *points) | /* Set the an array of points for LV_INDEV_TYPE_BUTTON. These points will be assigned to the buttons to press a specific point on the screen */
void lv_indev_set_button_points(lv_indev_t *indev, const lv_point_t *points) | {
if(indev->driver.type == LV_INDEV_TYPE_BUTTON) {
indev->btn_points = points;
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Enable stop detected only address is matched in slave mode. */ | void SCI2C_EnableStopDetectAddressed(SCI2C_T *i2c) | /* Enable stop detected only address is matched in slave mode. */
void SCI2C_EnableStopDetectAddressed(SCI2C_T *i2c) | {
i2c->CTRL1_B.DSA = BIT_SET;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Enable or disable PWM channel output. Make sure PWM clock is ON for writing registers. */ | static void pwm_channel_enable(struct rt_device_pwm *device, uint32_t channel, rt_bool_t enable) | /* Enable or disable PWM channel output. Make sure PWM clock is ON for writing registers. */
static void pwm_channel_enable(struct rt_device_pwm *device, uint32_t channel, rt_bool_t enable) | {
struct pwm_device *pwm_device = (struct pwm_device *)device;
volatile struct pwm_registers *pxreg = pwm_device->reg_base;
uint8_t ctrl_mod, polar;
if (enable)
{
ctrl_mod = pxreg->CTRL_MOD.reg;
pxreg->CTRL_MOD.reg = ctrl_mod | (RB_PWM0_OUT_EN << channel);
}
else
{
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Implements SIMPLE_TEXT_OUTPUT.QueryMode(). It returnes information for an available text mode that the Graphics Console supports. In this driver,we only support text mode 80x25, which is defined as mode 0. */ | EFI_STATUS EFIAPI GraphicsConsoleConOutQueryMode(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN ModeNumber, OUT UINTN *Columns, OUT UINTN *Rows) | /* Implements SIMPLE_TEXT_OUTPUT.QueryMode(). It returnes information for an available text mode that the Graphics Console supports. In this driver,we only support text mode 80x25, which is defined as mode 0. */
EFI_STATUS EFIAPI GraphicsConsoleConOutQueryMode(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN ModeNumb... | {
GRAPHICS_CONSOLE_DEV *Private;
EFI_STATUS Status;
EFI_TPL OldTpl;
if (ModeNumber >= (UINTN)This->Mode->MaxMode) {
return EFI_UNSUPPORTED;
}
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
Status = EFI_SUCCESS;
Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
*Columns = Pri... | tianocore/edk2 | C++ | Other | 4,240 |
/* Check the status of the Tx buffer of the specified SPI port. */ | xtBoolean SPIIsTxEmpty(unsigned long ulBase) | /* Check the status of the Tx buffer of the specified SPI port. */
xtBoolean SPIIsTxEmpty(unsigned long ulBase) | {
xASSERT((ulBase == SPI3_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE));
return ((xHWREG(ulBase + SPI_SR) & SPI_SR_TXE) ? xtrue : xfalse);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Initialize a memory block that was declared with MEMB(). */ | void memb_init(struct memb_blocks *m) | /* Initialize a memory block that was declared with MEMB(). */
void memb_init(struct memb_blocks *m) | {
memset(m->mem, (m->size + 1) * m->num, 0);
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* This function searches EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL instance with the given EFI_REDFISH_DISCOVER_NETWORK_INTERFACE. */ | EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL* GetTargetNetworkInterfaceInternal(IN EFI_REDFISH_DISCOVER_NETWORK_INTERFACE *TargetNetworkInterface) | /* This function searches EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL instance with the given EFI_REDFISH_DISCOVER_NETWORK_INTERFACE. */
EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL* GetTargetNetworkInterfaceInternal(IN EFI_REDFISH_DISCOVER_NETWORK_INTERFACE *TargetNetworkInterface) | {
EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *ThisNetworkInterface;
if (IsListEmpty (&mEfiRedfishDiscoverNetworkInterface)) {
return NULL;
}
ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode (&mEfiRedfishDiscoverNetworkInterface);
while (TRUE) {
if ((MAC_COMP... | tianocore/edk2 | C++ | Other | 4,240 |
/* Local CPU Clears Local to Remote IPC Flag */ | void IPCLtoRFlagClear(uint32_t ulFlags) | /* Local CPU Clears Local to Remote IPC Flag */
void IPCLtoRFlagClear(uint32_t ulFlags) | {
IpcRegs.IPCCLR.all |= ulFlags;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* We have done the truncate/delete so we can go ahead and remove the orphan item for this particular inode. */ | int btrfs_orphan_del(struct btrfs_trans_handle *trans, struct inode *inode) | /* We have done the truncate/delete so we can go ahead and remove the orphan item for this particular inode. */
int btrfs_orphan_del(struct btrfs_trans_handle *trans, struct inode *inode) | {
struct btrfs_root *root = BTRFS_I(inode)->root;
int ret = 0;
spin_lock(&root->list_lock);
if (list_empty(&BTRFS_I(inode)->i_orphan)) {
spin_unlock(&root->list_lock);
return 0;
}
list_del_init(&BTRFS_I(inode)->i_orphan);
if (!trans) {
spin_unlock(&root->list_lock);
return 0;
}
spin_unlock(&root->list_... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Input : vpn : virtual page number Output: PTE index within the page table of the entry -1 on failure */ | static long iSeries_hpte_find(unsigned long vpn) | /* Input : vpn : virtual page number Output: PTE index within the page table of the entry -1 on failure */
static long iSeries_hpte_find(unsigned long vpn) | {
struct hash_pte hpte;
long slot;
slot = HvCallHpt_findValid(&hpte, vpn);
if (hpte.v & HPTE_V_VALID) {
if (slot < 0) {
slot &= 0x7fffffffffffffff;
slot = -slot;
}
} else
slot = -1;
return slot;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The following statfs calls are copies of code from fs/open.c and should be checked against those from time to time */ | asmlinkage long compat_sys_statfs(const char __user *pathname, struct compat_statfs __user *buf) | /* The following statfs calls are copies of code from fs/open.c and should be checked against those from time to time */
asmlinkage long compat_sys_statfs(const char __user *pathname, struct compat_statfs __user *buf) | {
struct path path;
int error;
error = user_path(pathname, &path);
if (!error) {
struct kstatfs tmp;
error = vfs_statfs(path.dentry, &tmp);
if (!error)
error = put_compat_statfs(buf, &tmp);
path_put(&path);
}
return error;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* After we have successfully emulated an instruction, we have to check if the instruction was being single-stepped, and if so, pretend we got a single-step exception. This was pointed out by Kumar Gala. */ | static void emulate_single_step(struct pt_regs *regs) | /* After we have successfully emulated an instruction, we have to check if the instruction was being single-stepped, and if so, pretend we got a single-step exception. This was pointed out by Kumar Gala. */
static void emulate_single_step(struct pt_regs *regs) | {
if (single_stepping(regs)) {
clear_single_step(regs);
_exception(SIGTRAP, regs, TRAP_TRACE, 0);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Disables the EOC on each regular channel conversion. */ | void ADC_DisableEOCOnEachChannel(ADC_T *adc) | /* Disables the EOC on each regular channel conversion. */
void ADC_DisableEOCOnEachChannel(ADC_T *adc) | {
adc->CTRL2_B.EOCSEL = BIT_RESET;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Checks whether the specified DMA Channelx interrupt has occurred or not. */ | INTStatus DMA_GetIntStatus(uint32_t DMA_IT, DMA_Module *DMAy) | /* Checks whether the specified DMA Channelx interrupt has occurred or not. */
INTStatus DMA_GetIntStatus(uint32_t DMA_IT, DMA_Module *DMAy) | {
INTStatus bitstatus = RESET;
uint32_t tmpregister = 0;
assert_param(IS_DMA_GET_IT(DMA_IT));
tmpregister = DMAy->INTSTS;
if ((tmpregister & DMA_IT) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Return Value 0 in case of success, otherwise appropriate error code */ | static long pmcraid_ioctl_driver(struct pmcraid_instance *pinstance, unsigned int cmd, unsigned int buflen, void __user *user_buffer) | /* Return Value 0 in case of success, otherwise appropriate error code */
static long pmcraid_ioctl_driver(struct pmcraid_instance *pinstance, unsigned int cmd, unsigned int buflen, void __user *user_buffer) | {
int rc = -ENOSYS;
if (!access_ok(VERIFY_READ, user_buffer, _IOC_SIZE(cmd))) {
pmcraid_err("ioctl_driver: access fault in request buffer \n");
return -EFAULT;
}
switch (cmd) {
case PMCRAID_IOCTL_RESET_ADAPTER:
pmcraid_reset_bringup(pinstance);
rc = 0;
break;
default:
break;
}
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ZigBee Device Profile dissector for the find node cache */ | void dissect_zbee_zdp_req_find_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) | /* ZigBee Device Profile dissector for the find node cache */
void dissect_zbee_zdp_req_find_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) | {
guint offset = 0;
guint64 ext_addr; zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL);
ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL);
zbee_append_info(tree, pinfo, ", Device: %s", eui64_to_display(wmem_packet_scope... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* QSPI MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi) | /* QSPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi) | {
if(hqspi->Instance==QUADSPI)
{
__HAL_RCC_QSPI_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_6);
HAL_GPIO_DeInit(GPIOF, GPIO_PIN_7|GPIO_PIN_6|GPIO_PIN_10|GPIO_PIN_9
|GPIO_PIN_8);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Create vme slave window (access: vme -> crg) */ | int tsi148_vme_crg_window(unsigned int vmeAddr, int vam) | /* Create vme slave window (access: vme -> crg) */
int tsi148_vme_crg_window(unsigned int vmeAddr, int vam) | {
int result;
unsigned int ctl;
result = 0;
if (NULL == dev) {
result = 1;
} else {
__raw_writel(htonl(vmeAddr), &dev->uregs->cbal);
__raw_writel(0x00000000, &dev->uregs->cbau);
ctl = tsi148_eval_vam(vam);
ctl |= 0x00000080;
__raw_writel(htonl(ctl), &dev->uregs->crgat);
}
return result;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* If JumpBuffer is NULL, then ASSERT(). For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT(). */ | VOID EFIAPI InternalAssertJumpBuffer(IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer) | /* If JumpBuffer is NULL, then ASSERT(). For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT(). */
VOID EFIAPI InternalAssertJumpBuffer(IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer) | {
ASSERT (JumpBuffer != NULL);
ASSERT (((UINTN)JumpBuffer & (BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT - 1)) == 0);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Stops the Low Level portion of the Device driver. */ | USBD_StatusTypeDef USBD_LL_Stop(USBD_HandleTypeDef *pdev) | /* Stops the Low Level portion of the Device driver. */
USBD_StatusTypeDef USBD_LL_Stop(USBD_HandleTypeDef *pdev) | {
HAL_PCD_Stop(pdev->pData);
return USBD_OK;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Get the MMIO base address of UFS host controller. */ | EFI_STATUS EFIAPI GetUfsHcMmioBar(IN EDKII_UFS_HOST_CONTROLLER_PPI *This, IN UINT8 ControllerId, OUT UINTN *MmioBar) | /* Get the MMIO base address of UFS host controller. */
EFI_STATUS EFIAPI GetUfsHcMmioBar(IN EDKII_UFS_HOST_CONTROLLER_PPI *This, IN UINT8 ControllerId, OUT UINTN *MmioBar) | {
UFS_HC_PEI_PRIVATE_DATA *Private;
if ((This == NULL) || (MmioBar == NULL)) {
return EFI_INVALID_PARAMETER;
}
Private = UFS_HC_PEI_PRIVATE_DATA_FROM_THIS (This);
if (ControllerId >= Private->TotalUfsHcs) {
return EFI_INVALID_PARAMETER;
}
*MmioBar = (UINTN)Private->UfsHcPciAddr[ControllerId];
r... | tianocore/edk2 | C++ | Other | 4,240 |
/* Note: the +2 is for the destination buffers of the ddf/raid6 case where we calculate over all devices (not just the data blocks), using zeros in place of the P and Q blocks. */ | static size_t scribble_len(int num) | /* Note: the +2 is for the destination buffers of the ddf/raid6 case where we calculate over all devices (not just the data blocks), using zeros in place of the P and Q blocks. */
static size_t scribble_len(int num) | {
size_t len;
len = sizeof(struct page *) * (num+2) + sizeof(addr_conv_t) * (num+2);
return len;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This routine prepares the mailbox command for clearing HBA link attention information. */ | void lpfc_clear_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | /* This routine prepares the mailbox command for clearing HBA link attention information. */
void lpfc_clear_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | {
MAILBOX_t *mb;
mb = &pmb->u.mb;
memset(pmb, 0, sizeof (LPFC_MBOXQ_t));
mb->un.varClearLA.eventTag = phba->fc_eventTag;
mb->mbxCommand = MBX_CLEAR_LA;
mb->mbxOwner = OWN_HOST;
return;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Compute how many strips are in an image. */ | uint32 TIFFNumberOfStrips(TIFF *tif) | /* Compute how many strips are in an image. */
uint32 TIFFNumberOfStrips(TIFF *tif) | {
TIFFDirectory *td = &tif->tif_dir;
uint32 nstrips;
nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 :
TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip));
if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
nstrips = _TIFFMultiply32(tif, nstrips, (uint32)td->td_samplesperpixel,
"TIFFNumberOfStri... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Prototype: cmdtype_t acornscsi_cmdtype(int command) Purpose : differentiate READ from WRITE from other commands Params : command - command to interpret Returns : CMD_READ - command reads data, CMD_WRITE - command writes data, CMD_MISC - everything else */ | static cmdtype_t acornscsi_cmdtype(int command) | /* Prototype: cmdtype_t acornscsi_cmdtype(int command) Purpose : differentiate READ from WRITE from other commands Params : command - command to interpret Returns : CMD_READ - command reads data, CMD_WRITE - command writes data, CMD_MISC - everything else */
static cmdtype_t acornscsi_cmdtype(int command) | {
switch (command) {
case WRITE_6: case WRITE_10: case WRITE_12:
return CMD_WRITE;
case READ_6: case READ_10: case READ_12:
return CMD_READ;
default:
return CMD_MISC;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Command response callback function for sd_ble_gatts_value_get BLE command.
Callback for decoding the output parameters and the command response return code. */ | static uint32_t gatts_value_get_rsp_dec(const uint8_t *p_buffer, uint16_t length) | /* Command response callback function for sd_ble_gatts_value_get BLE command.
Callback for decoding the output parameters and the command response return code. */
static uint32_t gatts_value_get_rsp_dec(const uint8_t *p_buffer, uint16_t length) | {
uint32_t result_code;
const uint32_t err_code = ble_gatts_value_get_rsp_dec(p_buffer,
length,
(ble_gatts_value_t *)mp_out_params[0],
&re... | labapart/polymcu | C++ | null | 201 |
/* This routine is used by the input routines when a key is pressed at the IR. The scancode is received and needs to be converted into a keycode. If the key is not found, it returns KEY_UNKNOWN. Otherwise, returns the corresponding keycode from the table. */ | u32 ir_g_keycode_from_table(struct input_dev *dev, u32 scancode) | /* This routine is used by the input routines when a key is pressed at the IR. The scancode is received and needs to be converted into a keycode. If the key is not found, it returns KEY_UNKNOWN. Otherwise, returns the corresponding keycode from the table. */
u32 ir_g_keycode_from_table(struct input_dev *dev, u32 scanc... | {
struct ir_input_dev *ir_dev = input_get_drvdata(dev);
struct ir_scancode_table *rc_tab = &ir_dev->rc_tab;
struct ir_scancode *keymap = rc_tab->scan;
int elem;
elem = ir_seek_table(rc_tab, scancode);
if (elem >= 0) {
IR_dprintk(1, "%s: scancode 0x%04x keycode 0x%02x\n",
dev->name, scancode, keymap[elem].... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function will take the led on board on. */ | void rt_hw_board_led_on(rt_uint32_t led) | /* This function will take the led on board on. */
void rt_hw_board_led_on(rt_uint32_t led) | {
led_data |= led;
XGpio_DiscreteWrite(&gpio_output, 1, led_data);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Configure the number of phase state changed for the position accumulation counter. */ | void QDEC_SetCntSC(QDEC_TypeDef *QDec, u32 cnt_sc) | /* Configure the number of phase state changed for the position accumulation counter. */
void QDEC_SetCntSC(QDEC_TypeDef *QDec, u32 cnt_sc) | {
u32 reg_ctrl;
assert_param(IS_QDEC_ALL_PERIPH(QDec));
assert_param(IS_QD_PC_PHASE_COUTER(cnt_sc));
reg_ctrl = QDec->QDEC_CTRL;
reg_ctrl &= ~QD_CNT_SC;
reg_ctrl |= cnt_sc;
QDec->QDEC_CTRL = reg_ctrl;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Create a device which is on the parent's ParentPort port. */ | USB_DEVICE* UsbCreateDevice(IN USB_INTERFACE *ParentIf, IN UINT8 ParentPort) | /* Create a device which is on the parent's ParentPort port. */
USB_DEVICE* UsbCreateDevice(IN USB_INTERFACE *ParentIf, IN UINT8 ParentPort) | {
USB_DEVICE *Device;
ASSERT (ParentIf != NULL);
Device = AllocateZeroPool (sizeof (USB_DEVICE));
if (Device == NULL) {
return NULL;
}
Device->Bus = ParentIf->Device->Bus;
Device->MaxPacket0 = 8;
Device->ParentAddr = ParentIf->Device->Address;
Device->ParentIf = ParentIf;
Device->Paren... | tianocore/edk2 | C++ | Other | 4,240 |
/* unlock the FMC bank1 operation this function can be used for GD32F10x_XD and GD32F10x_CL with flash more than 512KB. */ | void fmc_bank1_unlock(void) | /* unlock the FMC bank1 operation this function can be used for GD32F10x_XD and GD32F10x_CL with flash more than 512KB. */
void fmc_bank1_unlock(void) | {
if((RESET != (FMC_CTL1 & FMC_CTL1_LK))){
FMC_KEY1 = UNLOCK_KEY0;
FMC_KEY1 = UNLOCK_KEY1;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The GetAcpiTable() function returns a pointer to a buffer containing the ACPI table associated with the Index that was input. The following structures are not considered elements in the list of ACPI tables: */ | EFI_STATUS EFIAPI GetAcpiTable2(IN UINTN Index, OUT EFI_ACPI_SDT_HEADER **Table, OUT EFI_ACPI_TABLE_VERSION *Version, OUT UINTN *TableKey) | /* The GetAcpiTable() function returns a pointer to a buffer containing the ACPI table associated with the Index that was input. The following structures are not considered elements in the list of ACPI tables: */
EFI_STATUS EFIAPI GetAcpiTable2(IN UINTN Index, OUT EFI_ACPI_SDT_HEADER **Table, OUT EFI_ACPI_TABLE_VERSION... | {
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
ASSERT (Table != NULL);
ASSERT (Version != NULL);
ASSERT (TableKey != NULL);
AcpiTableInstance = SdtGetAcpiTableInstance ();
return SdtGetAcpiTable (AcpiTableInstance, Index, Table, Version, TableKey);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function sends a carriage return and linefeed over USART.
Support and FAQ: visit */ | void usart_write_crlf(void) | /* This function sends a carriage return and linefeed over USART.
Support and FAQ: visit */
void usart_write_crlf(void) | {
usart_serial_write_packet(USART_SHA204, (uint8_t *) "\r\n", 2);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Get one byte from the specified position in a pbuf WARNING: returns zero for offset >= p->tot_len */ | u8_t pbuf_get_at(const struct pbuf *p, u16_t offset) | /* Get one byte from the specified position in a pbuf WARNING: returns zero for offset >= p->tot_len */
u8_t pbuf_get_at(const struct pbuf *p, u16_t offset) | {
int ret = pbuf_try_get_at(p, offset);
if (ret >= 0) {
return (u8_t)ret;
}
return 0;
} | ua1arn/hftrx | C++ | null | 69 |
/* Reset Wakeup frame filter register pointer.
Power Management(PMT) functions */ | void ETH_ResetWakeUpFrameFilterRegisterPointer(void) | /* Reset Wakeup frame filter register pointer.
Power Management(PMT) functions */
void ETH_ResetWakeUpFrameFilterRegisterPointer(void) | {
ETH->PMTCTRLSTS_B.WKUPFRST = SET;
ETH_Delay(ETH_REG_WRITE_DELAY);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* brief Initialize the I2S MCLK clock to given frequency. param iFreq : Desired frequency (must be equal to exact rate in Hz) return returns success or fail status. */ | status_t CLOCK_SetupI2SMClkClocking(uint32_t iFreq) | /* brief Initialize the I2S MCLK clock to given frequency. param iFreq : Desired frequency (must be equal to exact rate in Hz) return returns success or fail status. */
status_t CLOCK_SetupI2SMClkClocking(uint32_t iFreq) | {
s_I2S_Mclk_Freq = iFreq;
return kStatus_Success;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Clear data in Trace Hub MMIO addr + 0x30. */ | VOID EFIAPI MipiSystWriteFlag(IN VOID *MipiSystHandle) | /* Clear data in Trace Hub MMIO addr + 0x30. */
VOID EFIAPI MipiSystWriteFlag(IN VOID *MipiSystHandle) | {
MIPI_SYST_HANDLE *MipiSystH;
MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle;
MmioWrite32 ((UINTN)(MipiSystH->systh_platform.TraceHubPlatformData.MmioAddr + 0x30), 0x0);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Reads the interrupt status register of the device. */ | uint32_t SI1133_getIrqStatus(uint8_t *irqStatus) | /* Reads the interrupt status register of the device. */
uint32_t SI1133_getIrqStatus(uint8_t *irqStatus) | {
uint32_t retval;
retval = SI1133_registerRead( SI1133_REG_IRQ_STATUS, irqStatus );
return retval;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Select the given device on the SPI bus. */ | void usart_spi_select_device(Usart *p_usart, struct usart_spi_device *device) | /* Select the given device on the SPI bus. */
void usart_spi_select_device(Usart *p_usart, struct usart_spi_device *device) | {
UNUSED(device);
usart_spi_force_chip_select(p_usart);
} | memfault/zero-to-main | C++ | null | 200 |
/* vx_set_mic_boost - set mic boost level (on vxp440 only) @boost: 0 = 20dB, 1 = +38dB */ | void vx_set_mic_boost(struct vx_core *chip, int boost) | /* vx_set_mic_boost - set mic boost level (on vxp440 only) @boost: 0 = 20dB, 1 = +38dB */
void vx_set_mic_boost(struct vx_core *chip, int boost) | {
struct snd_vxpocket *pchip = (struct snd_vxpocket *)chip;
unsigned long flags;
if (chip->chip_status & VX_STAT_IS_STALE)
return;
spin_lock_irqsave(&chip->lock, flags);
if (pchip->regCDSP & P24_CDSP_MICS_SEL_MASK) {
if (boost) {
pchip->regCDSP &= ~P24_CDSP_MIC20_SEL_MASK;
pchip->regCDSP |= P24_CDSP_MIC... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is usually used for a single qword NOTE: This assumes the chip address is 64-bit aligned. */ | static int ipath_write_umem64(struct ipath_devdata *dd, void __iomem *caddr, const void __user *uaddr, size_t count) | /* This is usually used for a single qword NOTE: This assumes the chip address is 64-bit aligned. */
static int ipath_write_umem64(struct ipath_devdata *dd, void __iomem *caddr, const void __user *uaddr, size_t count) | {
u64 __iomem *reg_addr = caddr;
const u64 __iomem *reg_end = reg_addr + (count / sizeof(u64));
int ret;
if (reg_addr < dd->ipath_kregbase || reg_end > dd->ipath_kregend) {
ret = -EINVAL;
goto bail;
}
while (reg_addr < reg_end) {
u64 data;
if (copy_from_user(&data, uaddr, sizeof(data))) {
ret = -EFAULT... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This routine is called when a particular tty device is closed. */ | static void sclp_vt220_close(struct tty_struct *tty, struct file *filp) | /* This routine is called when a particular tty device is closed. */
static void sclp_vt220_close(struct tty_struct *tty, struct file *filp) | {
if (tty->count == 1) {
sclp_vt220_tty = NULL;
kfree(tty->driver_data);
tty->driver_data = NULL;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function will take the led on board on. */ | void rt_hw_board_led_on(int n) | /* This function will take the led on board on. */
void rt_hw_board_led_on(int n) | {
if (n >= 0 && n < 4)
{
AT91C_BASE_PIOB->PIO_CODR = leds[n];
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* It returns zero on success, or a standard errno code on error. */ | int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl) | /* It returns zero on success, or a standard errno code on error. */
int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl) | {
*dst = NULL;
return ip6_dst_lookup_tail(sk, dst, fl);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The IRQ can be one of the following states: */ | static void s3cmci_enable_irq(struct s3cmci_host *host, bool more) | /* The IRQ can be one of the following states: */
static void s3cmci_enable_irq(struct s3cmci_host *host, bool more) | {
unsigned long flags;
bool enable = false;
local_irq_save(flags);
host->irq_enabled = more;
host->irq_disabled = false;
enable = more | host->sdio_irqen;
if (host->irq_state != enable) {
host->irq_state = enable;
if (enable)
enable_irq(host->irq);
else
disable_irq(host->irq);
}
local_irq_restore(f... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Configures the FIFO feature. Uses ADXL367_14B_CHID read mode as default. */ | int adxl367_fifo_setup(const struct device *dev, enum adxl367_fifo_mode mode, enum adxl367_fifo_format format, enum adxl367_fifo_read_mode read_mode, uint8_t sets_nb) | /* Configures the FIFO feature. Uses ADXL367_14B_CHID read mode as default. */
int adxl367_fifo_setup(const struct device *dev, enum adxl367_fifo_mode mode, enum adxl367_fifo_format format, enum adxl367_fifo_read_mode read_mode, uint8_t sets_nb) | {
int ret;
ret = adxl367_set_fifo_mode(dev, mode);
if (ret != 0) {
return ret;
}
ret = adxl367_set_fifo_format(dev, format);
if (ret != 0) {
return ret;
}
ret = adxl367_set_fifo_sample_sets_nb(dev, sets_nb);
if (ret != 0) {
return ret;
}
return adxl367_set_fifo_read_mode(dev, read_mode);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Sets the frequency to the specified value in Hz. */ | void tea5767SetFrequency(uint32_t frequency) | /* Sets the frequency to the specified value in Hz. */
void tea5767SetFrequency(uint32_t frequency) | {
uint32_t pllValue;
uint8_t buffer[5] = { 0, 0, 0, 0, 0 };
if (!_tea5767Initialised) tea5767Init();
pllValue = (4 * (frequency + 225000)) / 32768;
buffer[0] = (pllValue >> 8) & 0x3F;
buffer[1] = (pllValue & 0xFF);
buffer[2] = TEA5767_WBYTE3_HLSI;
buffer[3] = TEA5767_WBYTE4_XTAL;
buffer[4] = 0;
tea5... | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* This gets called before we allocate a new thread and copy the current task into it. */ | void prepare_to_copy(struct task_struct *tsk) | /* This gets called before we allocate a new thread and copy the current task into it. */
void prepare_to_copy(struct task_struct *tsk) | {
flush_fp_to_thread(current);
flush_altivec_to_thread(current);
flush_vsx_to_thread(current);
flush_spe_to_thread(current);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* param base ASRC base pointer. param handle ASRC eDMA handle pointer. */ | void ASRC_TransferOutTerminalEDMA(ASRC_Type *base, asrc_edma_handle_t *handle) | /* param base ASRC base pointer. param handle ASRC eDMA handle pointer. */
void ASRC_TransferOutTerminalEDMA(ASRC_Type *base, asrc_edma_handle_t *handle) | {
assert(handle != NULL);
ASRC_TransferOutAbortEDMA(base, handle);
if ((handle->out.peripheralConfig != NULL) && (handle->out.peripheralConfig->startPeripheral != NULL))
{
handle->out.peripheralConfig->startPeripheral(false);
}
(void)memset(handle->out.tcd, 0, sizeof(handle->out.tcd));
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This routine is used to return substring before period '.' or '\0' Caller should respsonsible of substr space allocation & free */ | static VOID GetSubStringBeforePeriod(IN CHAR16 *Str, OUT CHAR16 *SubStr, OUT UINTN *SubStrLen) | /* This routine is used to return substring before period '.' or '\0' Caller should respsonsible of substr space allocation & free */
static VOID GetSubStringBeforePeriod(IN CHAR16 *Str, OUT CHAR16 *SubStr, OUT UINTN *SubStrLen) | {
UINTN Index;
for (Index = 0; Str[Index] != L'.' && Str[Index] != L'\0'; Index++) {
SubStr[Index] = Str[Index];
}
SubStr[Index] = L'\0';
*SubStrLen = Index;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* called from OPEN, CLAIM_PREVIOUS with a new clientid. */ | static struct nfs4_client_reclaim* nfs4_find_reclaim_client(clientid_t *clid) | /* called from OPEN, CLAIM_PREVIOUS with a new clientid. */
static struct nfs4_client_reclaim* nfs4_find_reclaim_client(clientid_t *clid) | {
unsigned int strhashval;
struct nfs4_client *clp;
struct nfs4_client_reclaim *crp = NULL;
clp = find_confirmed_client(clid);
if (clp == NULL)
return NULL;
dprintk("NFSD: nfs4_find_reclaim_client for %.*s with recdir %s\n",
clp->cl_name.len, clp->cl_name.data,
clp->cl_recdir);
strhashval ... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Destroys iSCSI session instance and releases resources allocated for it. */ | void beiscsi_session_destroy(struct iscsi_cls_session *cls_session) | /* Destroys iSCSI session instance and releases resources allocated for it. */
void beiscsi_session_destroy(struct iscsi_cls_session *cls_session) | {
struct iscsi_session *sess = cls_session->dd_data;
struct beiscsi_session *beiscsi_sess = sess->dd_data;
pci_pool_destroy(beiscsi_sess->bhs_pool);
iscsi_session_teardown(cls_session);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Add a character to the tty read_buf queue. This is done under the read_lock to serialize character addition and also to protect us against parallel reads or flushes */ | static void put_tty_queue(unsigned char c, struct tty_struct *tty) | /* Add a character to the tty read_buf queue. This is done under the read_lock to serialize character addition and also to protect us against parallel reads or flushes */
static void put_tty_queue(unsigned char c, struct tty_struct *tty) | {
unsigned long flags;
spin_lock_irqsave(&tty->read_lock, flags);
put_tty_queue_nolock(c, tty);
spin_unlock_irqrestore(&tty->read_lock, flags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* SPI MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi) | /* SPI MSP Initialization This function configures the hardware resources used in this example. */
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi) | {
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(hspi->Instance==SPI2)
{
__HAL_RCC_SPI2_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOB, &GPIO_In... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If mm is currently active_mm, we can't really drop it. Instead, we will get a new one for it. */ | static void drop_mmu_context(struct mm_struct *mm) | /* If mm is currently active_mm, we can't really drop it. Instead, we will get a new one for it. */
static void drop_mmu_context(struct mm_struct *mm) | {
unsigned long flags;
local_irq_save(flags);
get_new_mmu_context(mm);
pevn_set(mm->context & ASID_MASK);
local_irq_restore(flags);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns negative errno, or else the number of bytes written. */ | int i2c_master_send(struct i2c_client *client, const char *buf, int count) | /* Returns negative errno, or else the number of bytes written. */
int i2c_master_send(struct i2c_client *client, const char *buf, int count) | {
int ret;
struct i2c_adapter *adap=client->adapter;
struct i2c_msg msg;
msg.addr = client->addr;
msg.flags = client->flags & I2C_M_TEN;
msg.len = count;
msg.buf = (char *)buf;
ret = i2c_transfer(adap, &msg, 1);
return (ret == 1) ? count : ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is the mii register read function provided to the mii interface. */ | static int amd8111e_mdio_read(struct net_device *dev, int phy_id, int reg_num) | /* This is the mii register read function provided to the mii interface. */
static int amd8111e_mdio_read(struct net_device *dev, int phy_id, int reg_num) | {
struct amd8111e_priv* lp = netdev_priv(dev);
unsigned int reg_val;
amd8111e_read_phy(lp,phy_id,reg_num,®_val);
return reg_val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Read a field stored at a device register or memory address.
This routine reads a specified value from a bit field within a 1-Byte device register or memory address. The set bits in the mask parameter determine the field location. For example, if the mask is 30h and the value AFh is stored in the register, the value... | uint8_t bus_reg_fieldget(bus_desc_t *bus, uint8_t addr, uint8_t mask) | /* Read a field stored at a device register or memory address.
This routine reads a specified value from a bit field within a 1-Byte device register or memory address. The set bits in the mask parameter determine the field location. For example, if the mask is 30h and the value AFh is stored in the register, the value... | {
uint8_t const value = mask & bus_get(bus, addr);
return (value / (mask & ~(mask << 1)));
} | memfault/zero-to-main | C++ | null | 200 |
/* Set read polarity of IO pins in 'mask' to corresponding value in 'data' 0 = read pin value, 1 = read inverted pin value */ | int pca953x_set_pol(uint8_t chip, uint mask, uint data) | /* Set read polarity of IO pins in 'mask' to corresponding value in 'data' 0 = read pin value, 1 = read inverted pin value */
int pca953x_set_pol(uint8_t chip, uint mask, uint data) | {
return pca953x_reg_write(chip, PCA953X_POL, mask, data);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This function posts a non-offload doorbell to doorbell FIFO */ | static void __vxge_hw_non_offload_db_post(struct __vxge_hw_fifo *fifo, u64 txdl_ptr, u32 num_txds, u32 no_snoop) | /* This function posts a non-offload doorbell to doorbell FIFO */
static void __vxge_hw_non_offload_db_post(struct __vxge_hw_fifo *fifo, u64 txdl_ptr, u32 num_txds, u32 no_snoop) | {
struct __vxge_hw_channel *channel;
channel = &fifo->channel;
writeq(VXGE_HW_NODBW_TYPE(VXGE_HW_NODBW_TYPE_NODBW) |
VXGE_HW_NODBW_LAST_TXD_NUMBER(num_txds) |
VXGE_HW_NODBW_GET_NO_SNOOP(no_snoop),
&fifo->nofl_db->control_0);
mmiowb();
writeq(txdl_ptr, &fifo->nofl_db->txdl_ptr);
mmiowb();
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If the enabled interrupt is pending, it will immediately vector to its interrupt handler and continue (maybe with some swap() before) */ | void hw_irq_ctrl_enable_irq(unsigned int irq) | /* If the enabled interrupt is pending, it will immediately vector to its interrupt handler and continue (maybe with some swap() before) */
void hw_irq_ctrl_enable_irq(unsigned int irq) | {
irq_mask |= ((uint64_t)1<<irq);
if (irq_premask & ((uint64_t)1<<irq)) {
hw_irq_ctrl_raise_im_from_sw(irq);
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Return the current simulated RTC time in microseconds */ | int64_t hwtimer_get_simu_rtc_time(void) | /* Return the current simulated RTC time in microseconds */
int64_t hwtimer_get_simu_rtc_time(void) | {
return hwm_get_time() + rtc_offset;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Prepares and returns a bio for indirect user io, bouncing data to/from kernel pages as necessary. Must be paired with call bio_uncopy_user() on io completion. */ | struct bio* bio_copy_user(struct request_queue *q, struct rq_map_data *map_data, unsigned long uaddr, unsigned int len, int write_to_vm, gfp_t gfp_mask) | /* Prepares and returns a bio for indirect user io, bouncing data to/from kernel pages as necessary. Must be paired with call bio_uncopy_user() on io completion. */
struct bio* bio_copy_user(struct request_queue *q, struct rq_map_data *map_data, unsigned long uaddr, unsigned int len, int write_to_vm, gfp_t gfp_mask) | {
struct sg_iovec iov;
iov.iov_base = (void __user *)uaddr;
iov.iov_len = len;
return bio_copy_user_iov(q, map_data, &iov, 1, write_to_vm, gfp_mask);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function is called from the lpfc_prep_task_mgmt_cmd function to set the last bit in the response sge entry. */ | static void lpfc_sli4_set_rsp_sgl_last(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) | /* This function is called from the lpfc_prep_task_mgmt_cmd function to set the last bit in the response sge entry. */
static void lpfc_sli4_set_rsp_sgl_last(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) | {
struct sli4_sge *sgl = (struct sli4_sge *)lpfc_cmd->fcp_bpl;
if (sgl) {
sgl += 1;
sgl->word2 = le32_to_cpu(sgl->word2);
bf_set(lpfc_sli4_sge_last, sgl, 1);
sgl->word2 = cpu_to_le32(sgl->word2);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The following set of functions are used for the sending and receiving of IRQs (also known as IPIs). There are two flavors of IRQs, one that is associated with partition activity (SGI_XPC_ACTIVATE) and the other that is associated with channel activity (SGI_XPC_NOTIFY). */ | static u64 xpc_receive_IRQ_amo_sn2(struct amo *amo) | /* The following set of functions are used for the sending and receiving of IRQs (also known as IPIs). There are two flavors of IRQs, one that is associated with partition activity (SGI_XPC_ACTIVATE) and the other that is associated with channel activity (SGI_XPC_NOTIFY). */
static u64 xpc_receive_IRQ_amo_sn2(struct a... | {
return FETCHOP_LOAD_OP(TO_AMO((u64)&amo->variable), FETCHOP_CLEAR);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* We are freeing all blocks refered from that array (numbers are stored as little-endian 32-bit) and updating @inode->i_blocks appropriately. */ | static void ext2_free_data(struct inode *inode, __le32 *p, __le32 *q) | /* We are freeing all blocks refered from that array (numbers are stored as little-endian 32-bit) and updating @inode->i_blocks appropriately. */
static void ext2_free_data(struct inode *inode, __le32 *p, __le32 *q) | {
unsigned long block_to_free = 0, count = 0;
unsigned long nr;
for ( ; p < q ; p++) {
nr = le32_to_cpu(*p);
if (nr) {
*p = 0;
if (count == 0)
goto free_this;
else if (block_to_free == nr - count)
count++;
else {
mark_inode_dirty(inode);
ext2_free_blocks (inode, block_to_free, count);... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* File creation. Allocate an inode, and we're done.. */ | static int hugetlbfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) | /* File creation. Allocate an inode, and we're done.. */
static int hugetlbfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) | {
struct inode *inode;
int error = -ENOSPC;
gid_t gid;
if (dir->i_mode & S_ISGID) {
gid = dir->i_gid;
if (S_ISDIR(mode))
mode |= S_ISGID;
} else {
gid = current_fsgid();
}
inode = hugetlbfs_get_inode(dir->i_sb, current_fsuid(), gid, mode, dev);
if (inode) {
dir->i_ctime = dir->i_mtime = CURRENT_TIME;... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Extract the data for the public key algorithm */ | int x509_extract_key_data(void *context, size_t hdrlen, unsigned char tag, const void *value, size_t vlen) | /* Extract the data for the public key algorithm */
int x509_extract_key_data(void *context, size_t hdrlen, unsigned char tag, const void *value, size_t vlen) | {
struct x509_parse_context *ctx = context;
ctx->key_algo = ctx->last_oid;
if (ctx->last_oid == OID_rsaEncryption)
ctx->cert->pub->pkey_algo = "rsa";
else if (ctx->last_oid == OID_gost2012PKey256 ||
ctx->last_oid == OID_gost2012PKey512)
ctx->cert->pub->pkey_algo = "ecrdsa";
else
return -ENOPKG;
if (vlen ... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.