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 |
|---|---|---|---|---|---|---|---|
/* Removes an interrupt handler for a GPIO port. */ | void GPIOPortIntUnregister(unsigned long ulPort) | /* Removes an interrupt handler for a GPIO port. */
void GPIOPortIntUnregister(unsigned long ulPort) | {
ASSERT(GPIOBaseValid(ulPort));
ulPort = GPIOGetIntNumber(ulPort);
IntDisable(ulPort);
IntUnregister(ulPort);
} | watterott/WebRadio | C++ | null | 71 |
/* @part_name: Named device to lookup @part_info: Pointer to returned part_info pointer @response: Pointer to fastboot response buffer */ | int fastboot_nand_get_part_info(const char *part_name, struct part_info **part_info, char *response) | /* @part_name: Named device to lookup @part_info: Pointer to returned part_info pointer @response: Pointer to fastboot response buffer */
int fastboot_nand_get_part_info(const char *part_name, struct part_info **part_info, char *response) | {
struct mtd_info *mtd = NULL;
return fb_nand_lookup(part_name, &mtd, part_info, response);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* NOTE: We use the same code as Vorbis here */ | static void wma_lsp_to_curve(WMACodecContext *s, float *out, float *val_max_ptr, int n, float *lsp) | /* NOTE: We use the same code as Vorbis here */
static void wma_lsp_to_curve(WMACodecContext *s, float *out, float *val_max_ptr, int n, float *lsp) | {
int i, j;
float p, q, w, v, val_max;
val_max = 0;
for(i=0;i<n;i++) {
p = 0.5f;
q = 0.5f;
w = s->lsp_cos_table[i];
for(j=1;j<NB_LSP_COEFS;j+=2){
q *= w - lsp[j - 1];
p *= w - lsp[j];
}
p *= p * (2.0f - w);
q *= q * (2.0f + w);
v = p + q;
v = pow_m1_4(s, v);
if (v > val_max)
val_max = v;
out[i] = v;
}
*val_max_ptr = val_max;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Request the PE to get a source capability extended. */ | USBPD_StatusTypeDef USBPD_DPM_RequestGetSourceCapabilityExt(uint8_t PortNum) | /* Request the PE to get a source capability extended. */
USBPD_StatusTypeDef USBPD_DPM_RequestGetSourceCapabilityExt(uint8_t PortNum) | {
return USBPD_PE_Request_CtrlMessage(PortNum, USBPD_CONTROLMSG_GET_SRC_CAPEXT, USBPD_SOPTYPE_SOP);
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* Change Logs: Date Author Notes GuEe-GUI first version */ | rt_atomic_t rt_hw_atomic_load(volatile rt_atomic_t *ptr) | /* Change Logs: Date Author Notes GuEe-GUI first version */
rt_atomic_t rt_hw_atomic_load(volatile rt_atomic_t *ptr) | {
rt_atomic_t ret;
__asm__ volatile (
" ldr %0, %1\n"
" dmb ish"
: "=r" (ret)
: "Q" (*ptr)
: "memory");
return ret;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enables or disables the DMA Rx Desc second address chained. */ | void ETH_EnableDmaRxDescSecondAddrChained(ETH_DMADescType *DMARxDesc, FunctionalState Cmd) | /* Enables or disables the DMA Rx Desc second address chained. */
void ETH_EnableDmaRxDescSecondAddrChained(ETH_DMADescType *DMARxDesc, FunctionalState Cmd) | {
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
DMARxDesc->CtrlOrBufSize |= ETH_DMA_RX_DESC_RCH;
}
else
{
DMARxDesc->CtrlOrBufSize &= (~(uint32_t)ETH_DMA_RX_DESC_RCH);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Calculate square modulo. Please note, all "out" Big number arguments should be properly initialized by calling to BigNumInit() or BigNumFromBin() functions. */ | BOOLEAN EFIAPI BigNumSqrMod(IN CONST VOID *BnA, IN CONST VOID *BnM, OUT VOID *BnRes) | /* Calculate square modulo. Please note, all "out" Big number arguments should be properly initialized by calling to BigNumInit() or BigNumFromBin() functions. */
BOOLEAN EFIAPI BigNumSqrMod(IN CONST VOID *BnA, IN CONST VOID *BnM, OUT VOID *BnRes) | {
BOOLEAN RetVal;
BN_CTX *Ctx;
Ctx = BN_CTX_new ();
if (Ctx == NULL) {
return FALSE;
}
RetVal = (BOOLEAN)BN_mod_sqr (BnRes, BnA, BnM, Ctx);
BN_CTX_free (Ctx);
return RetVal;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Description: Search the network interface table and return the record matching @ifindex. If an entry can not be found in the table return NULL. */ | static struct sel_netif* sel_netif_find(int ifindex) | /* Description: Search the network interface table and return the record matching @ifindex. If an entry can not be found in the table return NULL. */
static struct sel_netif* sel_netif_find(int ifindex) | {
int idx = sel_netif_hashfn(ifindex);
struct sel_netif *netif;
list_for_each_entry_rcu(netif, &sel_netif_hash[idx], list)
if (likely(netif->nsec.ifindex == ifindex))
return netif;
return NULL;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Parameters: ch FEC channel pa Physical (Hardware) Address for the selected FEC */ | static void fec_set_address(const uint8 *pa) | /* Parameters: ch FEC channel pa Physical (Hardware) Address for the selected FEC */
static void fec_set_address(const uint8 *pa) | {
uint8 crc;
MCF_FEC_PALR = (uint32)((pa[0]<<24) | (pa[1]<<16) | (pa[2]<<8) | pa[3]);
MCF_FEC_PAUR = (uint32)((pa[4]<<24) | (pa[5]<<16));
crc = fec_hash_address(pa);
if(crc >= 32)
{
MCF_FEC_IAUR |= (uint32)(1 << (crc - 32));
}
else
{
MCF_FEC_IALR |= (uint32)(1 << crc);
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* I2C MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c) | /* I2C MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c) | {
if(hi2c->Instance==I2C1)
{
__HAL_RCC_I2C1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_8);
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_9);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* <length2><value2> format. mbedtls doesn't need that though. We sanitize that here itself. So convert from: "\x02h2\x06spdy/1" to { {"h2"}, {"spdy/1}, {NULL}} */ | int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, unsigned protos_len) | /* <length2><value2> format. mbedtls doesn't need that though. We sanitize that here itself. So convert from: "\x02h2\x06spdy/1" to { {"h2"}, {"spdy/1}, {NULL}} */
int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, unsigned protos_len) | {
ctx->ssl_alpn.alpn_string = ssl_mem_zalloc(protos_len + 1);
if (! ctx->ssl_alpn.alpn_string) {
return 1;
}
ctx->ssl_alpn.alpn_status = ALPN_ENABLE;
memcpy(ctx->ssl_alpn.alpn_string, protos, protos_len);
char *ptr = ctx->ssl_alpn.alpn_string;
int i;
for (i = 0; i < ALPN_LIST_MAX - 1; i++) {
char len = *ptr;
*ptr = '\0';
ptr++;
protos_len--;
ctx->ssl_alpn.alpn_list[i] = ptr;
ptr += len;
protos_len -= len;
if (! protos_len) {
i++;
break;
}
}
ctx->ssl_alpn.alpn_list[i] = NULL;
return 0;
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Take the local apic timer and PIT/HPET into account. We don't know which one is active, when we have highres/dyntick on */ | static unsigned int get_timer_irqs(int cpu) | /* Take the local apic timer and PIT/HPET into account. We don't know which one is active, when we have highres/dyntick on */
static unsigned int get_timer_irqs(int cpu) | {
return per_cpu(irq_stat, cpu).apic_timer_irqs +
per_cpu(irq_stat, cpu).irq0_irqs;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* SYSCTRL Uart1 Bus Clock Enable and Reset Release. */ | void LL_SYSCTRL_UART1_ClkEnRstRelease(void) | /* SYSCTRL Uart1 Bus Clock Enable and Reset Release. */
void LL_SYSCTRL_UART1_ClkEnRstRelease(void) | {
__LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL);
__LL_SYSCTRL_UART1BusClk_En(SYSCTRL);
__LL_SYSCTRL_UART1SoftRst_Release(SYSCTRL);
__LL_SYSCTRL_Reg_Lock(SYSCTRL);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Deinitialization of the Hashcrypt engine.
This function sets MODE field in Hashcrypt Control register to zero - disabled. This reduces power consumption of HASHCRYPT. */ | static void hashcrypt_engine_deinit(HASHCRYPT_Type *base) | /* Deinitialization of the Hashcrypt engine.
This function sets MODE field in Hashcrypt Control register to zero - disabled. This reduces power consumption of HASHCRYPT. */
static void hashcrypt_engine_deinit(HASHCRYPT_Type *base) | {
base->CTRL &= ~(HASHCRYPT_CTRL_MODE_MASK);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Initialize new opaque EcGroup object. This object represents an EC curve and and is used for calculation within this group. This object should be freed using */ | VOID* EFIAPI EcGroupInit(IN UINTN CryptoNid) | /* Initialize new opaque EcGroup object. This object represents an EC curve and and is used for calculation within this group. This object should be freed using */
VOID* EFIAPI EcGroupInit(IN UINTN CryptoNid) | {
CALL_CRYPTO_SERVICE (EcGroupInit, (CryptoNid), NULL);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This API is used to get the fifo full interrupt1 in the register 0x1A bit 2. */ | BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_intr1_fifo_full(u8 *intr1_fifo_full_u8) | /* This API is used to get the fifo full interrupt1 in the register 0x1A bit 2. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_intr1_fifo_full(u8 *intr1_fifo_full_u8) | {
u8 data_u8 = BMA2x2_INIT_VALUE;
BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR;
if (p_bma2x2 == BMA2x2_NULL)
{
return E_BMA2x2_NULL_PTR;
}
else
{
com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC
(p_bma2x2->dev_addr,
BMA2x2_ENABLE_INTR1_PAD_FIFO_FULL_REG,
&data_u8, BMA2x2_GEN_READ_WRITE_LENGTH);
*intr1_fifo_full_u8 = BMA2x2_GET_BITSLICE
(data_u8, BMA2x2_ENABLE_INTR1_PAD_FIFO_FULL);
}
return com_rslt;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Called on each existing env var prior to the blanket update since removing a callback association should remove its callback. */ | static int clear_callback(struct env_entry *entry) | /* Called on each existing env var prior to the blanket update since removing a callback association should remove its callback. */
static int clear_callback(struct env_entry *entry) | {
entry->callback = NULL;
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* reset data register to the value of initializaiton data register */ | void crc_data_register_reset(void) | /* reset data register to the value of initializaiton data register */
void crc_data_register_reset(void) | {
CRC_CTL |= (uint32_t)CRC_CTL_RST;
} | liuxuming/trochili | C++ | Apache License 2.0 | 132 |
/* A callback function must be unregistered before it is deallocated. It is important that any registered callbacks that are not runtime complaint be unregistered when ExitBootServices() is called. */ | EFI_STATUS EFIAPI Unregister(IN EFI_RSC_HANDLER_CALLBACK Callback) | /* A callback function must be unregistered before it is deallocated. It is important that any registered callbacks that are not runtime complaint be unregistered when ExitBootServices() is called. */
EFI_STATUS EFIAPI Unregister(IN EFI_RSC_HANDLER_CALLBACK Callback) | {
LIST_ENTRY *Link;
RSC_HANDLER_CALLBACK_ENTRY *CallbackEntry;
if (Callback == NULL) {
return EFI_INVALID_PARAMETER;
}
for (Link = GetFirstNode (&mCallbackListHead); !IsNull (&mCallbackListHead, Link); Link = GetNextNode (&mCallbackListHead, Link)) {
CallbackEntry = CR (Link, RSC_HANDLER_CALLBACK_ENTRY, Node, RSC_HANDLER_CALLBACK_ENTRY_SIGNATURE);
if (CallbackEntry->RscHandlerCallback == Callback) {
if (CallbackEntry->Tpl != TPL_HIGH_LEVEL) {
FreePool ((VOID *)(UINTN)CallbackEntry->StatusCodeDataBuffer);
gBS->CloseEvent (CallbackEntry->Event);
}
RemoveEntryList (&CallbackEntry->Node);
FreePool (CallbackEntry);
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If the platform does not support Capsule Volume HOBs, then ASSERT(). If there is no additional space for HOB creation, then ASSERT(). */ | VOID EFIAPI BuildCvHob(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length) | /* If the platform does not support Capsule Volume HOBs, then ASSERT(). If there is no additional space for HOB creation, then ASSERT(). */
VOID EFIAPI BuildCvHob(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length) | {
EFI_HOB_UEFI_CAPSULE *Hob;
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_UEFI_CAPSULE, (UINT16)sizeof (EFI_HOB_UEFI_CAPSULE));
if (Hob == NULL) {
return;
}
Hob->BaseAddress = BaseAddress;
Hob->Length = Length;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* LEDs These functions actually update the LED's, and are called from a workqueue. By doing this as separate work rather than when the LED subsystem asks, we avoid messing with the Asus ACPI stuff during a potentially bad time, such as a timer interrupt. */ | static void tpd_led_update(struct work_struct *work) | /* LEDs These functions actually update the LED's, and are called from a workqueue. By doing this as separate work rather than when the LED subsystem asks, we avoid messing with the Asus ACPI stuff during a potentially bad time, such as a timer interrupt. */
static void tpd_led_update(struct work_struct *work) | {
struct eeepc_laptop *eeepc;
eeepc = container_of(work, struct eeepc_laptop, tpd_led_work);
set_acpi(eeepc, CM_ASL_TPD, eeepc->tpd_led_wk);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Sets the Rx FIFO level at which interrupts are generated. */ | void xUARTFIFORxLevelSet(unsigned long ulBase, unsigned long ulRxLevel) | /* Sets the Rx FIFO level at which interrupts are generated. */
void xUARTFIFORxLevelSet(unsigned long ulBase, unsigned long ulRxLevel) | {
UARTFIFOTriggerLevelSet(ulBase, ulRxLevel);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* : this draws a character on the frame buffer but not refresh */ | void iot_epaper_draw_char(epaper_handle_t dev, int x, int y, char ascii_char, epaper_font_t *font, int colored) | /* : this draws a character on the frame buffer but not refresh */
void iot_epaper_draw_char(epaper_handle_t dev, int x, int y, char ascii_char, epaper_font_t *font, int colored) | {
int i, j;
unsigned int char_offset = (ascii_char - ' ') * font->height * (font->width / 8 + (font->width % 8 ? 1 : 0));
const unsigned char* ptr = &font->font_table[char_offset];
epaper_dev_t* device = (epaper_dev_t*) dev;
xSemaphoreTakeRecursive(device->spi_mux, portMAX_DELAY);
for (j = 0; j < font->height; j++) {
for (i = 0; i < font->width; i++) {
if (*ptr & (0x80 >> (i % 8))) {
iot_epaper_draw_pixel(dev, x + i, y + j, colored);
}
if (i % 8 == 7) {
ptr++;
}
}
if (font->width % 8 != 0) {
ptr++;
}
}
xSemaphoreGiveRecursive(device->spi_mux);
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* If a completion is being used as a counting completion, attempt to decrement the counter without blocking. This enables us to avoid waiting if the resource the completion is protecting is not available. */ | bool try_wait_for_completion(struct completion *x) | /* If a completion is being used as a counting completion, attempt to decrement the counter without blocking. This enables us to avoid waiting if the resource the completion is protecting is not available. */
bool try_wait_for_completion(struct completion *x) | {
unsigned long flags;
int ret = 1;
spin_lock_irqsave(&x->wait.lock, flags);
if (!x->done)
ret = 0;
else
x->done--;
spin_unlock_irqrestore(&x->wait.lock, flags);
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enables or disables the Half cycle flash access. */ | void FLASH_HalfCycleAccessCmd(FunctionalState NewState) | /* Enables or disables the Half cycle flash access. */
void FLASH_HalfCycleAccessCmd(FunctionalState NewState) | {
assert_param(IS_FUNCTIONAL_STATE(NewState));
if(NewState != DISABLE)
{
FLASH->ACR |= FLASH_ACR_HLFCYA;
}
else
{
FLASH->ACR &= (uint32_t)(~((uint32_t)FLASH_ACR_HLFCYA));
}
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Disable the Capture of the PWM module.
The */ | void PWMCAPDisable(unsigned long ulBase, unsigned long ulChannel) | /* Disable the Capture of the PWM module.
The */
void PWMCAPDisable(unsigned long ulBase, unsigned long ulChannel) | {
unsigned long ulChannelTemp;
ulChannelTemp = ulChannel;
xASSERT((ulBase == PWMA_BASE));
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 5)));
xHWREG(ulBase + PWM_CAPCTL) &= ~(1 << ulChannelTemp);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Event function to signal to this module that the entire transfer completed. */ | static void TbxMbRtuTransmitComplete(tTbxMbUartPort port) | /* Event function to signal to this module that the entire transfer completed. */
static void TbxMbRtuTransmitComplete(tTbxMbUartPort port) | {
TBX_ASSERT(port < TBX_MB_UART_NUM_PORT);
if (port < TBX_MB_UART_NUM_PORT)
{
tTbxMbTpCtx volatile * tpCtx = tbxMbRtuCtx[port];
TBX_ASSERT(tpCtx != NULL)
if (tpCtx != NULL)
{
TbxCriticalSectionEnter();
uint8_t stateCopy = tpCtx->state;
TbxCriticalSectionExit();
TBX_ASSERT(stateCopy == TBX_MB_RTU_STATE_TRANSMISSION);
if (stateCopy == TBX_MB_RTU_STATE_TRANSMISSION)
{
TbxCriticalSectionEnter();
tpCtx->txDoneTime = TbxMbPortTimerCount();
TbxCriticalSectionExit();
tTbxMbEvent newEvent;
newEvent.context = (void *)tpCtx;
newEvent.id = TBX_MB_EVENT_ID_START_POLLING;
TbxMbOsalEventPost(&newEvent, TBX_TRUE);
}
}
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* This function can be called from gtk_tree_view_column_set_cell_data_func() the user data must be the column number. Present floats with two decimals */ | void float_data_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 floats with two decimals */
void float_data_func(GtkTreeViewColumn *column _U_, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data) | {
gfloat float_val;
gchar buf[20];
char *savelocale;
gint float_col = GPOINTER_TO_INT(user_data);
gtk_tree_model_get(model, iter, float_col, &float_val, -1);
savelocale = g_strdup(setlocale(LC_NUMERIC, NULL));
setlocale(LC_NUMERIC, "C");
g_snprintf(buf, sizeof(buf), "%.2f", float_val);
setlocale(LC_NUMERIC, savelocale);
g_free(savelocale);
g_object_set(renderer, "text", buf, NULL);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns %0 on success, and a negative error code on failure. */ | int insert_old_idx_znode(struct ubifs_info *c, struct ubifs_znode *znode) | /* Returns %0 on success, and a negative error code on failure. */
int insert_old_idx_znode(struct ubifs_info *c, struct ubifs_znode *znode) | {
if (znode->parent) {
struct ubifs_zbranch *zbr;
zbr = &znode->parent->zbranch[znode->iip];
if (zbr->len)
return insert_old_idx(c, zbr->lnum, zbr->offs);
} else
if (c->zroot.len)
return insert_old_idx(c, c->zroot.lnum,
c->zroot.offs);
return 0;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Enable or disable the specified count compare type of TMR4 event. */ | void TMR4_EVT_MatchCondCmd(CM_TMR4_TypeDef *TMR4x, uint32_t u32Ch, uint16_t u16Cond, en_functional_state_t enNewState) | /* Enable or disable the specified count compare type of TMR4 event. */
void TMR4_EVT_MatchCondCmd(CM_TMR4_TypeDef *TMR4x, uint32_t u32Ch, uint16_t u16Cond, en_functional_state_t enNewState) | {
__IO uint16_t *SCSR;
DDL_ASSERT(IS_TMR4_UNIT(TMR4x));
DDL_ASSERT(IS_TMR4_EVT_CH(u32Ch));
DDL_ASSERT(IS_TMR4_EVT_MATCH_COND(u16Cond));
DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState));
SCSR = TMR4_SCSR(TMR4x, u32Ch);
if (ENABLE == enNewState) {
SET_REG16_BIT(*SCSR, u16Cond);
} else {
CLR_REG16_BIT(*SCSR, u16Cond);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns the Number of SMM Delayed & Blocked & Disabled Thread Count. */ | VOID GetSmmDelayedBlockedDisabledCount(IN OUT UINT32 *DelayedCount, IN OUT UINT32 *BlockedCount, IN OUT UINT32 *DisabledCount) | /* Returns the Number of SMM Delayed & Blocked & Disabled Thread Count. */
VOID GetSmmDelayedBlockedDisabledCount(IN OUT UINT32 *DelayedCount, IN OUT UINT32 *BlockedCount, IN OUT UINT32 *DisabledCount) | {
UINTN Index;
for (Index = 0; Index < mNumberOfCpus; Index++) {
if (IsPackageFirstThread (Index)) {
if (DelayedCount != NULL) {
*DelayedCount += (UINT32)SmmCpuFeaturesGetSmmRegister (Index, SmmRegSmmDelayed);
}
if (BlockedCount != NULL) {
*BlockedCount += (UINT32)SmmCpuFeaturesGetSmmRegister (Index, SmmRegSmmBlocked);
}
if (DisabledCount != NULL) {
*DisabledCount += (UINT32)SmmCpuFeaturesGetSmmRegister (Index, SmmRegSmmEnable);
}
}
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Call a specific function in the thread context of tcpip_thread for easy access synchronization. A function called in that way may access lwIP core code without fearing concurrent access. */ | err_t tcpip_callback_with_block(void(*f)(void *ctx), void *ctx, u8_t block) | /* Call a specific function in the thread context of tcpip_thread for easy access synchronization. A function called in that way may access lwIP core code without fearing concurrent access. */
err_t tcpip_callback_with_block(void(*f)(void *ctx), void *ctx, u8_t block) | {
struct tcpip_msg *msg;
if (mbox != SYS_MBOX_NULL) {
msg = memp_malloc(MEMP_TCPIP_MSG_API);
if (msg == NULL) {
return ERR_MEM;
}
msg->type = TCPIP_MSG_CALLBACK;
msg->msg.cb.f = f;
msg->msg.cb.ctx = ctx;
if (block) {
sys_mbox_post(mbox, msg);
} else {
if (sys_mbox_trypost(mbox, msg) != ERR_OK) {
memp_free(MEMP_TCPIP_MSG_API, msg);
return ERR_MEM;
}
}
return ERR_OK;
}
return ERR_VAL;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* compat_count() counts the number of arguments/envelopes. It is basically a copy of count() from fs/exec.c, except that it works with 32 bit argv and envp pointers. */ | static int compat_count(compat_uptr_t __user *argv, int max) | /* compat_count() counts the number of arguments/envelopes. It is basically a copy of count() from fs/exec.c, except that it works with 32 bit argv and envp pointers. */
static int compat_count(compat_uptr_t __user *argv, int max) | {
int i = 0;
if (argv != NULL) {
for (;;) {
compat_uptr_t p;
if (get_user(p, argv))
return -EFAULT;
if (!p)
break;
argv++;
if (i++ >= max)
return -E2BIG;
}
}
return i;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This code gets the size of name of variable. */ | UINTN NameSizeOfVariable(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFlag) | /* This code gets the size of name of variable. */
UINTN NameSizeOfVariable(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFlag) | {
AUTHENTICATED_VARIABLE_HEADER *AuthVariable;
AuthVariable = (AUTHENTICATED_VARIABLE_HEADER *)Variable;
if (AuthFlag) {
if ((AuthVariable->State == (UINT8)(-1)) ||
(AuthVariable->DataSize == (UINT32)(-1)) ||
(AuthVariable->NameSize == (UINT32)(-1)) ||
(AuthVariable->Attributes == (UINT32)(-1)))
{
return 0;
}
return (UINTN)AuthVariable->NameSize;
} else {
if ((Variable->State == (UINT8)(-1)) ||
(Variable->DataSize == (UINT32)(-1)) ||
(Variable->NameSize == (UINT32)(-1)) ||
(Variable->Attributes == (UINT32)(-1)))
{
return 0;
}
return (UINTN)Variable->NameSize;
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set relative the position of an object (relative to the parent) */ | void lv_obj_set_pos(lv_obj_t *obj, lv_coord_t x, lv_coord_t y) | /* Set relative the position of an object (relative to the parent) */
void lv_obj_set_pos(lv_obj_t *obj, lv_coord_t x, lv_coord_t y) | {
lv_obj_t * par = obj->par;
x = x + par->coords.x1;
y = y + par->coords.y1;
lv_point_t diff;
diff.x = x - obj->coords.x1;
diff.y = y - obj->coords.y1;
if(diff.x == 0 && diff.y == 0) return;
lv_obj_invalidate(obj);
lv_area_t ori;
lv_obj_get_coords(obj, &ori);
obj->coords.x1 += diff.x;
obj->coords.y1 += diff.y;
obj->coords.x2 += diff.x;
obj->coords.y2 += diff.y;
refresh_childen_position(obj, diff.x, diff.y);
obj->signal_func(obj, LV_SIGNAL_CORD_CHG, &ori);
par->signal_func(par, LV_SIGNAL_CHILD_CHG, obj);
lv_obj_invalidate(obj);
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* This is common code that is called for each state that we're entering. Run suspend notifiers, allocate a console and stop all processes. */ | static int suspend_prepare(void) | /* This is common code that is called for each state that we're entering. Run suspend notifiers, allocate a console and stop all processes. */
static int suspend_prepare(void) | {
int error;
if (!suspend_ops || !suspend_ops->enter)
return -EPERM;
pm_prepare_console();
error = pm_notifier_call_chain(PM_SUSPEND_PREPARE);
if (error)
goto Finish;
error = usermodehelper_disable();
if (error)
goto Finish;
error = suspend_freeze_processes();
if (!error)
return 0;
suspend_thaw_processes();
usermodehelper_enable();
Finish:
pm_notifier_call_chain(PM_POST_SUSPEND);
pm_restore_console();
return error;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function waits until the SDIO DMA data transfer is finished. */ | void SD_ProcessDMAIRQ(void) | /* This function waits until the SDIO DMA data transfer is finished. */
void SD_ProcessDMAIRQ(void) | {
if(DMA2->ISR & DMA2_FLAG_TC4)
{
DMAEndOfTransfer = 0x01;
DMA_ClearFlag(DMA2_FLAG_TC4 | DMA2_FLAG_TE4 | DMA2_FLAG_HT4 | DMA2_FLAG_GL4);
}
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* \method callback(fun) Set the function to be called when the timer triggers. */ | STATIC mp_obj_t pyb_timer_callback(mp_obj_t self_in, mp_obj_t callback) | /* \method callback(fun) Set the function to be called when the timer triggers. */
STATIC mp_obj_t pyb_timer_callback(mp_obj_t self_in, mp_obj_t callback) | {
__HAL_TIM_DISABLE_IT(&self->tim, TIM_IT_UPDATE);
self->callback = mp_const_none;
} else if (mp_obj_is_callable(callback)) {
__HAL_TIM_DISABLE_IT(&self->tim, TIM_IT_UPDATE);
self->callback = callback;
__HAL_TIM_CLEAR_FLAG(&self->tim, TIM_IT_UPDATE);
HAL_TIM_Base_Stop(&self->tim);
HAL_TIM_Base_Start_IT(&self->tim);
HAL_NVIC_EnableIRQ(self->irqn);
} else {
mp_raise_ValueError(MP_ERROR_TEXT("callback must be None or a callable object"));
}
return mp_const_none;
} | micropython/micropython | C++ | Other | 18,334 |
/* Read a single byte from the serial port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */ | int serial_getc(void) | /* Read a single byte from the serial port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */
int serial_getc(void) | {
while (!(LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_DR));
return (char) RBR(CONFIG_SYS_IXP425_CONSOLE) & 0xff;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* If the dest flags is set with IP_VS_DEST_F_OVERLOAD, consider that the server is overloaded here. */ | static int is_overloaded(struct ip_vs_dest *dest) | /* If the dest flags is set with IP_VS_DEST_F_OVERLOAD, consider that the server is overloaded here. */
static int is_overloaded(struct ip_vs_dest *dest) | {
return dest->flags & IP_VS_DEST_F_OVERLOAD;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This doesn't change hardware matching, so needs to be overridden for most real devices. */ | int eth_mac_addr(struct net_device *dev, void *p) | /* This doesn't change hardware matching, so needs to be overridden for most real devices. */
int eth_mac_addr(struct net_device *dev, void *p) | {
struct sockaddr *addr = p;
if (netif_running(dev))
return -EBUSY;
if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL;
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Polls a serial device to see if there is any data waiting to be read. */ | BOOLEAN EFIAPI SerialPortPoll(VOID) | /* Polls a serial device to see if there is any data waiting to be read. */
BOOLEAN EFIAPI SerialPortPoll(VOID) | {
return mXenConsoleInterface &&
mXenConsoleInterface->in_cons != mXenConsoleInterface->in_prod;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Create a new child for a given parent node. */ | VOID MakeChild(IN NODE LoopVar6, IN UINT8 LoopVar5, IN NODE LoopVar4) | /* Create a new child for a given parent node. */
VOID MakeChild(IN NODE LoopVar6, IN UINT8 LoopVar5, IN NODE LoopVar4) | {
NODE LoopVar12;
NODE LoopVar10;
LoopVar12 = (NODE)HASH (LoopVar6, LoopVar5);
LoopVar10 = mNext[LoopVar12];
mNext[LoopVar12] = LoopVar4;
mNext[LoopVar4] = LoopVar10;
mPrev[LoopVar10] = LoopVar4;
mPrev[LoopVar4] = LoopVar12;
mParent[LoopVar4] = LoopVar6;
mChildCount[LoopVar6]++;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Sets the @attribute to contain the given @attr_value, if possible. */ | void g_file_info_set_attribute_byte_string(GFileInfo *info, const char *attribute, const char *attr_value) | /* Sets the @attribute to contain the given @attr_value, if possible. */
void g_file_info_set_attribute_byte_string(GFileInfo *info, const char *attribute, const char *attr_value) | {
g_return_if_fail (G_IS_FILE_INFO (info));
g_return_if_fail (attribute != NULL && *attribute != '\0');
g_return_if_fail (attr_value != NULL);
_g_file_info_set_attribute_byte_string_by_id (info,
lookup_attribute (attribute),
attr_value);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Unregisters an interrupt handler for the EPI module. */ | void EPIIntUnregister(unsigned long ulBase) | /* Unregisters an interrupt handler for the EPI module. */
void EPIIntUnregister(unsigned long ulBase) | {
ASSERT(ulBase == EPI0_BASE);
IntDisable(INT_EPI0);
IntUnregister(INT_EPI0);
} | watterott/WebRadio | C++ | null | 71 |
/* Sets the GMAC in loopback mode. When on GMAC operates in loop-back mode at GMII/MII. */ | void synopGMAC_loopback_on(synopGMACdevice *gmacdev) | /* Sets the GMAC in loopback mode. When on GMAC operates in loop-back mode at GMII/MII. */
void synopGMAC_loopback_on(synopGMACdevice *gmacdev) | {
synopGMACSetBits(gmacdev -> MacBase, GmacConfig, GmacLoopback);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* We go through and clear interrupt specific resources and reset the structure to pre-load conditions */ | void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter) | /* We go through and clear interrupt specific resources and reset the structure to pre-load conditions */
void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter) | {
kfree(adapter->tx_ring);
kfree(adapter->rx_ring);
adapter->tx_ring = NULL;
adapter->rx_ring = NULL;
ixgbe_free_q_vectors(adapter);
ixgbe_reset_interrupt_capability(adapter);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables asynchronous callback generation for a given channel and type.
Enables asynchronous callbacks for a given logical DAC channel and type. This must be called before a DAC channel will generate callback events. */ | enum status_code dac_chan_enable_callback(struct dac_module *const module_inst, const enum dac_channel channel, const enum dac_callback type) | /* Enables asynchronous callback generation for a given channel and type.
Enables asynchronous callbacks for a given logical DAC channel and type. This must be called before a DAC channel will generate callback events. */
enum status_code dac_chan_enable_callback(struct dac_module *const module_inst, const enum dac_channel channel, const enum dac_callback type) | {
Assert(module_inst);
if (module_inst->start_on_event[channel] == false) {
return STATUS_ERR_UNSUPPORTED_DEV;
}
module_inst->callback_enable[channel][type] = true;
return STATUS_OK;
} | memfault/zero-to-main | C++ | null | 200 |
/* This function will clear feature for the endpoint of the usb device. */ | rt_err_t rt_usbh_clear_feature(uinst_t device, int endpoint, int feature) | /* This function will clear feature for the endpoint of the usb device. */
rt_err_t rt_usbh_clear_feature(uinst_t device, int endpoint, int feature) | {
struct urequest setup;
int timeout = USB_TIMEOUT_BASIC;
RT_ASSERT(device != RT_NULL);
setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_STANDARD |
USB_REQ_TYPE_ENDPOINT;
setup.bRequest = USB_REQ_CLEAR_FEATURE;
setup.wIndex = endpoint;
setup.wLength = 0;
setup.wValue = feature;
if(rt_usb_hcd_setup_xfer(device->hcd, device->pipe_ep0_out, &setup, timeout) != 8)
{
return RT_ERROR;
}
return RT_EOK;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* We cannot have this as an inline function in bitmap.h because it needs linux/uaccess.h to get the access_ok() declaration and this causes cyclic dependencies. */ | int bitmap_parse_user(const char __user *ubuf, unsigned int ulen, unsigned long *maskp, int nmaskbits) | /* We cannot have this as an inline function in bitmap.h because it needs linux/uaccess.h to get the access_ok() declaration and this causes cyclic dependencies. */
int bitmap_parse_user(const char __user *ubuf, unsigned int ulen, unsigned long *maskp, int nmaskbits) | {
if (!access_ok(VERIFY_READ, ubuf, ulen))
return -EFAULT;
return __bitmap_parse((const char *)ubuf, ulen, 1, maskp, nmaskbits);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Tell the SoundScape to activate the AD1845 chip (I think). The AD1845 detection fails if we */ | static void activate_ad1845_unsafe(unsigned io_base) | /* Tell the SoundScape to activate the AD1845 chip (I think). The AD1845 detection fails if we */
static void activate_ad1845_unsafe(unsigned io_base) | {
unsigned char val = sscape_read_unsafe(io_base, GA_HMCTL_REG);
sscape_write_unsafe(io_base, GA_HMCTL_REG, (val & 0xcf) | 0x10);
sscape_write_unsafe(io_base, GA_CDCFG_REG, 0x80);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function depends on the pages to be flushed having the G (global) bit set in their pte. This is true for all PAGE_KERNEL(_RO) pages. */ | void flush_tlb_kernel_range(unsigned long start, unsigned long end) | /* This function depends on the pages to be flushed having the G (global) bit set in their pte. This is true for all PAGE_KERNEL(_RO) pages. */
void flush_tlb_kernel_range(unsigned long start, unsigned long end) | {
unsigned long flags;
int size;
size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
if (size > (MMU_DTLB_ENTRIES / 4)) {
flush_tlb_all();
} else {
unsigned long asid;
local_irq_save(flags);
asid = get_asid();
start &= PAGE_MASK;
end += (PAGE_SIZE - 1);
end &= PAGE_MASK;
while (start < end) {
__flush_tlb_page(asid, start);
start += PAGE_SIZE;
}
local_irq_restore(flags);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* s1 is either a simple 'name', or a 'name=value' pair. s2 is a 'name=value' pair. If the names match, return the value of s2, else NULL. */ | static char* envmatch(char *s1, char *s2) | /* s1 is either a simple 'name', or a 'name=value' pair. s2 is a 'name=value' pair. If the names match, return the value of s2, else NULL. */
static char* envmatch(char *s1, char *s2) | {
if (s1 == NULL || s2 == NULL)
return NULL;
while (*s1 == *s2++)
if (*s1++ == '=')
return s2;
if (*s1 == '\0' && *(s2 - 1) == '=')
return s2;
return NULL;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Steal interface name from another interface. This enable interface name swapping. This will work : 1) with kernel 2.6.X 2) if other interface is down Because of (2), it won't work with hotplug, but we don't need it with hotplug, only with static ifaces... */ | static int if_takeover_name(int skfd, const char *victimname) | /* Steal interface name from another interface. This enable interface name swapping. This will work : 1) with kernel 2.6.X 2) if other interface is down Because of (2), it won't work with hotplug, but we don't need it with hotplug, only with static ifaces... */
static int if_takeover_name(int skfd, const char *victimname) | {
char autoname[IFNAMSIZ+1];
int len;
struct ifreq ifr;
int ret;
len = strlen(victimname);
memcpy(autoname, victimname, len + 1);
if(len > (IFNAMSIZ - 2))
len = IFNAMSIZ - 2;
len--;
while(isdigit(autoname[len]))
len--;
strcpy(autoname + len + 1, "%d");
if(verbose)
fprintf(stderr, "Takeover : moving interface `%s' to `%s'.\n",
victimname, autoname);
bzero(&ifr, sizeof(struct ifreq));
strncpy(ifr.ifr_name, victimname, IFNAMSIZ);
strncpy(ifr.ifr_newname, autoname, IFNAMSIZ);
ret = ioctl(skfd, SIOCSIFNAME, &ifr);
if(!ret)
num_takeover++;
return(ret);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* De-select the given device on the SPI bus. */ | void usart_spi_deselect_device(volatile avr32_usart_t *p_usart, struct usart_spi_device *device) | /* De-select the given device on the SPI bus. */
void usart_spi_deselect_device(volatile avr32_usart_t *p_usart, struct usart_spi_device *device) | {
UNUSED(device);
usart_spi_unselectChip(p_usart);
} | memfault/zero-to-main | C++ | null | 200 |
/* Returns a pointer to the I2O device if found, otherwise NULL. */ | struct i2o_device* i2o_iop_find_device(struct i2o_controller *c, u16 tid) | /* Returns a pointer to the I2O device if found, otherwise NULL. */
struct i2o_device* i2o_iop_find_device(struct i2o_controller *c, u16 tid) | {
struct i2o_device *dev;
list_for_each_entry(dev, &c->devices, list)
if (dev->lct_data.tid == tid)
return dev;
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Given a frame_data structure, scroll to and select the row in the packet list corresponding to that frame. If there is no such row, return FALSE, otherwise return TRUE. */ | gboolean packet_list_select_row_from_data(frame_data *fdata_needle) | /* Given a frame_data structure, scroll to and select the row in the packet list corresponding to that frame. If there is no such row, return FALSE, otherwise return TRUE. */
gboolean packet_list_select_row_from_data(frame_data *fdata_needle) | {
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(packetlist->view));
GtkTreeIter iter;
if(!gtk_tree_model_get_iter_first(model, &iter))
return FALSE;
do {
frame_data *fdata;
fdata = packet_list_get_record(model, &iter);
if(fdata == fdata_needle) {
scroll_to_and_select_iter(model, NULL, &iter);
return TRUE;
}
} while (gtk_tree_model_iter_next(model, &iter));
return FALSE;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified. */ | void g_object_freeze_notify(GObject *object) | /* This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified. */
void g_object_freeze_notify(GObject *object) | {
g_return_if_fail (G_IS_OBJECT (object));
if (g_atomic_int_get (&object->ref_count) == 0)
return;
g_object_ref (object);
g_object_notify_queue_freeze (object, FALSE);
g_object_unref (object);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Verify the new serial_struct (for TIOCSSERIAL). The only change we allow are to the flags and type, and even then only between PORT_SA1100 and PORT_UNKNOWN */ | static int sa1100_verify_port(struct uart_port *port, struct serial_struct *ser) | /* Verify the new serial_struct (for TIOCSSERIAL). The only change we allow are to the flags and type, and even then only between PORT_SA1100 and PORT_UNKNOWN */
static int sa1100_verify_port(struct uart_port *port, struct serial_struct *ser) | {
struct sa1100_port *sport = (struct sa1100_port *)port;
int ret = 0;
if (ser->type != PORT_UNKNOWN && ser->type != PORT_SA1100)
ret = -EINVAL;
if (sport->port.irq != ser->irq)
ret = -EINVAL;
if (ser->io_type != SERIAL_IO_MEM)
ret = -EINVAL;
if (sport->port.uartclk / 16 != ser->baud_base)
ret = -EINVAL;
if ((void *)sport->port.mapbase != ser->iomem_base)
ret = -EINVAL;
if (sport->port.iobase != ser->port)
ret = -EINVAL;
if (ser->hub6 != 0)
ret = -EINVAL;
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* sends a piece of data in non-blocking way. */ | static void SAI_WriteNonBlocking(I2S_Type *base, uint32_t channel, uint32_t channelMask, uint32_t endChannel, uint32_t bitWidth, uint8_t *buffer, uint32_t size) | /* sends a piece of data in non-blocking way. */
static void SAI_WriteNonBlocking(I2S_Type *base, uint32_t channel, uint32_t channelMask, uint32_t endChannel, uint32_t bitWidth, uint8_t *buffer, uint32_t size) | {
uint32_t i = 0;
uint8_t j = 0, m = 0;
uint8_t bytesPerWord = bitWidth / 8U;
uint32_t data = 0;
uint32_t temp = 0;
for (i = 0; i < size / bytesPerWord; i++)
{
for (j = channel; j <= endChannel; j++)
{
if ((1U << j) & channelMask)
{
for (m = 0; m < bytesPerWord; m++)
{
temp = (uint32_t)(*buffer);
data |= (temp << (8U * m));
buffer++;
}
base->TDR[j] = data;
data = 0;
}
}
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Free a software acknowledge hardware resource by clearing its Pending bit. This will return a reply to the sender. If the message has timed out, a reply has already been sent by the hardware but the resource has not been released. In that case our clear of the Timeout bit (as well) will free the resource. No reply will be sent (the hardware will only do one reply per message). */ | static void uv_reply_to_message(int resource, struct bau_payload_queue_entry *msg, struct bau_msg_status *msp) | /* Free a software acknowledge hardware resource by clearing its Pending bit. This will return a reply to the sender. If the message has timed out, a reply has already been sent by the hardware but the resource has not been released. In that case our clear of the Timeout bit (as well) will free the resource. No reply will be sent (the hardware will only do one reply per message). */
static void uv_reply_to_message(int resource, struct bau_payload_queue_entry *msg, struct bau_msg_status *msp) | {
unsigned long dw;
dw = (1 << (resource + UV_SW_ACK_NPENDING)) | (1 << resource);
msg->replied_to = 1;
msg->sw_ack_vector = 0;
if (msp)
msp->seen_by.bits = 0;
uv_write_local_mmr(UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS, dw);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Register/Clear RX callback. Callback will be invoked after the next received frame.
This function is usually invoked from the RX callback itself with NULL callback, to unregister. Once the callback has resumed the application task, there is no need to invoke the callback again. */ | void gmac_dev_set_rx_callback(gmac_device_t *p_gmac_dev, gmac_quelist_t queue_idx, gmac_dev_tx_cb_t func_rx_cb) | /* Register/Clear RX callback. Callback will be invoked after the next received frame.
This function is usually invoked from the RX callback itself with NULL callback, to unregister. Once the callback has resumed the application task, there is no need to invoke the callback again. */
void gmac_dev_set_rx_callback(gmac_device_t *p_gmac_dev, gmac_quelist_t queue_idx, gmac_dev_tx_cb_t func_rx_cb) | {
Gmac *p_hw = p_gmac_dev->p_hw;
if (func_rx_cb == NULL) {
if(queue_idx == GMAC_QUE_0) {
gmac_disable_interrupt(p_hw, GMAC_IDR_RCOMP);
} else {
gmac_disable_priority_interrupt(p_hw, GMAC_IER_RCOMP, queue_idx);
}
p_gmac_dev->gmac_queue_list[queue_idx].func_rx_cb = NULL;
} else {
p_gmac_dev->gmac_queue_list[queue_idx].func_rx_cb = func_rx_cb;
if(queue_idx == GMAC_QUE_0) {
gmac_enable_interrupt(p_hw, GMAC_IER_RCOMP);
} else {
gmac_enable_priority_interrupt(p_hw, GMAC_IER_RCOMP, queue_idx);
}
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* curl_easy_cleanup() is the external interface to cleaning/freeing the given easy handle. */ | void curl_easy_cleanup(struct Curl_easy *data) | /* curl_easy_cleanup() is the external interface to cleaning/freeing the given easy handle. */
void curl_easy_cleanup(struct Curl_easy *data) | {
SIGPIPE_VARIABLE(pipe_st);
if(!data)
return;
sigpipe_ignore(data, &pipe_st);
Curl_close(data);
sigpipe_restore(&pipe_st);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Upon allocation, all the space are in the tail room of the buffer. Call this function to move some space to the header room. This function is quite limited in that it can only reserve space from the first block of an empty NET_BUF not built from the external. But it should be enough for the network stack. */ | VOID EFIAPI NetbufReserve(IN OUT NET_BUF *Nbuf, IN UINT32 Len) | /* Upon allocation, all the space are in the tail room of the buffer. Call this function to move some space to the header room. This function is quite limited in that it can only reserve space from the first block of an empty NET_BUF not built from the external. But it should be enough for the network stack. */
VOID EFIAPI NetbufReserve(IN OUT NET_BUF *Nbuf, IN UINT32 Len) | {
NET_CHECK_SIGNATURE (Nbuf, NET_BUF_SIGNATURE);
NET_CHECK_SIGNATURE (Nbuf->Vector, NET_VECTOR_SIGNATURE);
ASSERT ((Nbuf->BlockOpNum == 1) && (Nbuf->TotalSize == 0));
ASSERT ((Nbuf->Vector->Free == NULL) && (Nbuf->Vector->Len >= Len));
Nbuf->BlockOp[0].Head += Len;
Nbuf->BlockOp[0].Tail += Len;
ASSERT (Nbuf->BlockOp[0].Tail <= Nbuf->BlockOp[0].BlockTail);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Clears the specified interrupt(s) for the specified PWM generator block. */ | void PWMGenIntClear(uint32_t ui32Base, uint32_t ui32Gen, uint32_t ui32Ints) | /* Clears the specified interrupt(s) for the specified PWM generator block. */
void PWMGenIntClear(uint32_t ui32Base, uint32_t ui32Gen, uint32_t ui32Ints) | {
ASSERT((ui32Base == PWM0_BASE) || (ui32Base == PWM1_BASE));
ASSERT(_PWMGenValid(ui32Gen));
ASSERT((ui32Ints &
~(PWM_INT_CNT_ZERO | PWM_INT_CNT_LOAD | PWM_INT_CNT_AU |
PWM_INT_CNT_AD | PWM_INT_CNT_BU | PWM_INT_CNT_BD)) == 0);
HWREG(PWM_GEN_BADDR(ui32Base, ui32Gen) + PWM_O_X_ISC) = ui32Ints;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Free an allocated DMA resource.
This function will free an allocated DMA resource. */ | enum status_code dma_free(struct dma_resource *resource) | /* Free an allocated DMA resource.
This function will free an allocated DMA resource. */
enum status_code dma_free(struct dma_resource *resource) | {
if (dma_get_job_status(resource) == STATUS_BUSY) {
return STATUS_BUSY;
}
if (!(_dma_inst.allocated_channels & (1 << resource->channel_id))) {
return STATUS_ERR_NOT_INITIALIZED;
}
_dma_release_channel(resource->channel_id);
_dma_active_resource[resource->channel_id] = NULL;
return STATUS_OK;
} | memfault/zero-to-main | C++ | null | 200 |
/* Function used to read the Decryption Keys from the preferences and store them properly into the airpcap adapter. */ | static gboolean load_wlan_driver_wep_keys(void) | /* Function used to read the Decryption Keys from the preferences and store them properly into the airpcap adapter. */
static gboolean load_wlan_driver_wep_keys(void) | {
keys_cb_data_t* user_data;
wlan_prefs = prefs_find_module("wlan");
user_data = (keys_cb_data_t*)g_malloc(sizeof(keys_cb_data_t));
user_data->list = NULL;
user_data->current_index = 0;
user_data->number_of_keys= 0;
prefs_pref_foreach(wlan_prefs, get_wep_key, (gpointer)user_data);
wlan_prefs->prefs_changed = TRUE;
prefs_apply(wlan_prefs);
write_wlan_driver_wep_keys_to_registry(user_data->list);
g_list_foreach(user_data->list, (GFunc)free_key_string, NULL);
g_list_free(user_data->list);
g_free(user_data);
return TRUE;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns 0 on success or negative error code on failure. */ | static int __init i2o_scsi_init(void) | /* Returns 0 on success or negative error code on failure. */
static int __init i2o_scsi_init(void) | {
int rc;
printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
rc = i2o_driver_register(&i2o_scsi_driver);
if (rc) {
osm_err("Could not register SCSI driver\n");
return rc;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* renamed all functions and variables by prepending "gnu_" removed/redid a bunch of stuff under the assumption we're using a modern standard C compiler. renamed file to gnu_getopt_long.c (from gnu_getopt1.c) */ | int gnu_getopt_long(int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index) | /* renamed all functions and variables by prepending "gnu_" removed/redid a bunch of stuff under the assumption we're using a modern standard C compiler. renamed file to gnu_getopt_long.c (from gnu_getopt1.c) */
int gnu_getopt_long(int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index) | {
return _gnu_getopt_internal (argc, argv, options, long_options, opt_index, 0);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Constructs a new net device, complete with a private data area of size @sizeof_priv. A 32-byte (not bit) alignment is enforced for this private data area. */ | struct net_device* alloc_ltalkdev(int sizeof_priv) | /* Constructs a new net device, complete with a private data area of size @sizeof_priv. A 32-byte (not bit) alignment is enforced for this private data area. */
struct net_device* alloc_ltalkdev(int sizeof_priv) | {
return alloc_netdev(sizeof_priv, "lt%d", ltalk_setup);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function gets the maximum number of Virtual CPUs that are usable for Td Guest. */ | UINT32 EFIAPI TdMaxVCpuNum(VOID) | /* This function gets the maximum number of Virtual CPUs that are usable for Td Guest. */
UINT32 EFIAPI TdMaxVCpuNum(VOID) | {
if (mTdDataReturned) {
return mTdMaxVCpuNum;
}
return GetTdInfo () ? mTdMaxVCpuNum : 0;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Add or update an entry into the Mappings Database */ | int SDL_GameControllerAddMapping(const char *mappingString) | /* Add or update an entry into the Mappings Database */
int SDL_GameControllerAddMapping(const char *mappingString) | {
return SDL_PrivateGameControllerAddMapping(mappingString, SDL_CONTROLLER_MAPPING_PRIORITY_API);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* The modulated lapped transform, this takes transform coefficients and transforms them into timedomain samples. Apply transform window, overlap buffers, apply gain profile and buffer management. */ | static void imlt_gain(COOKContext *q, float *inbuffer, cook_gains *gains_ptr, float *previous_buffer) | /* The modulated lapped transform, this takes transform coefficients and transforms them into timedomain samples. Apply transform window, overlap buffers, apply gain profile and buffer management. */
static void imlt_gain(COOKContext *q, float *inbuffer, cook_gains *gains_ptr, float *previous_buffer) | {
float *buffer0 = q->mono_mdct_output;
float *buffer1 = q->mono_mdct_output + q->samples_per_channel;
int i;
ff_imdct_calc(&q->mdct_ctx, q->mono_mdct_output, inbuffer);
q->imlt_window (q, buffer1, gains_ptr, previous_buffer);
for (i = 0; i < 8; i++) {
if (gains_ptr->now[i] || gains_ptr->now[i + 1])
q->interpolate(q, &buffer1[q->gain_size_factor * i],
gains_ptr->now[i], gains_ptr->now[i + 1]);
}
memcpy(previous_buffer, buffer0, sizeof(float)*q->samples_per_channel);
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* snt_intr_getc - Get a character from the console, interrupt mode */ | static int snt_intr_getc(void) | /* snt_intr_getc - Get a character from the console, interrupt mode */
static int snt_intr_getc(void) | {
return ia64_sn_console_readc();
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Clears or safeguards the OCREF2 signal on an external event. */ | void TIM_ClearOC2Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear) | /* Clears or safeguards the OCREF2 signal on an external event. */
void TIM_ClearOC2Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear) | {
uint16_t tmpccmr1 = 0;
assert_param(IS_TIM_LIST3_PERIPH(TIMx));
assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear));
tmpccmr1 = TIMx->CCMR1;
tmpccmr1 &= (uint16_t)~((uint16_t)TIM_CCMR1_OC2CE);
tmpccmr1 |= (uint16_t)(TIM_OCClear << 8);
TIMx->CCMR1 = tmpccmr1;
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* This function will examines the signal mask of the calling thread. */ | int sigpending(sigset_t *set) | /* This function will examines the signal mask of the calling thread. */
int sigpending(sigset_t *set) | {
sigprocmask(SIG_SETMASK, RT_NULL, set);
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Turn off and clear EMU temperature related interrupts. */ | static void disableInterrupts(void) | /* Turn off and clear EMU temperature related interrupts. */
static void disableInterrupts(void) | {
EMU_IntClear(EMU_IFC_TEMPLOW | EMU_IFC_TEMPHIGH);
EMU_IntDisable(EMU_IFC_TEMPLOW | EMU_IFC_TEMPHIGH);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* param base DCP peripheral base address param handle Specifies the DCP channel used for hashing. param ctx Output hash context param algo Underlaying algorithm to use for hash computation. return Status of initialization */ | status_t DCP_HASH_Init(DCP_Type *base, dcp_handle_t *handle, dcp_hash_ctx_t *ctx, dcp_hash_algo_t algo) | /* param base DCP peripheral base address param handle Specifies the DCP channel used for hashing. param ctx Output hash context param algo Underlaying algorithm to use for hash computation. return Status of initialization */
status_t DCP_HASH_Init(DCP_Type *base, dcp_handle_t *handle, dcp_hash_ctx_t *ctx, dcp_hash_algo_t algo) | {
status_t status;
dcp_hash_ctx_internal_t *ctxInternal;
BUILD_ASSURE(sizeof(dcp_hash_ctx_t) >= sizeof(dcp_hash_ctx_internal_t), dcp_hash_ctx_t_size);
uint32_t i;
status = dcp_hash_check_input_args(base, ctx, algo);
if (status != kStatus_Success)
{
return status;
}
ctxInternal = (dcp_hash_ctx_internal_t *)ctx;
ctxInternal->algo = algo;
ctxInternal->blksz = 0u;
for (i = 0; i < sizeof(ctxInternal->blk.w) / sizeof(ctxInternal->blk.w[0]); i++)
{
ctxInternal->blk.w[0] = 0u;
}
ctxInternal->state = kDCP_StateHashInit;
ctxInternal->fullMessageSize = 0;
ctxInternal->handle = handle;
return status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns: The wanted inode number on success, else Zero. */ | static ino_t vxfs_inode_by_name(struct inode *dip, struct dentry *dp) | /* Returns: The wanted inode number on success, else Zero. */
static ino_t vxfs_inode_by_name(struct inode *dip, struct dentry *dp) | {
struct vxfs_direct *de;
struct page *pp;
ino_t ino = 0;
de = vxfs_find_entry(dip, dp, &pp);
if (de) {
ino = de->d_ino;
kunmap(pp);
page_cache_release(pp);
}
return (ino);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Merge the lists in b0 and b1, using the 'sense' field to indicate which of jt and jf is the link. */ | static void merge(struct block *, struct block *) | /* Merge the lists in b0 and b1, using the 'sense' field to indicate which of jt and jf is the link. */
static void merge(struct block *, struct block *) | {
register struct block **p = &b0;
while (*p)
p = !((*p)->sense) ? &JT(*p) : &JF(*p);
*p = b1;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* pm8001_chip_msix_interrupt_enable - enable PM8001 chip interrupt @pm8001_ha: our hba card information */ | static void pm8001_chip_msix_interrupt_enable(struct pm8001_hba_info *pm8001_ha, u32 int_vec_idx) | /* pm8001_chip_msix_interrupt_enable - enable PM8001 chip interrupt @pm8001_ha: our hba card information */
static void pm8001_chip_msix_interrupt_enable(struct pm8001_hba_info *pm8001_ha, u32 int_vec_idx) | {
u32 msi_index;
u32 value;
msi_index = int_vec_idx * MSIX_TABLE_ELEMENT_SIZE;
msi_index += MSIX_TABLE_BASE;
pm8001_cw32(pm8001_ha, 0, msi_index, MSIX_INTERRUPT_ENABLE);
value = (1 << int_vec_idx);
pm8001_cw32(pm8001_ha, 0, MSGU_ODCR, value);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Converts a text device path node to UART Flow Control device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUartFlowCtrl(IN CHAR16 *TextDeviceNode) | /* Converts a text device path node to UART Flow Control device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUartFlowCtrl(IN CHAR16 *TextDeviceNode) | {
CHAR16 *ValueStr;
UART_FLOW_CONTROL_DEVICE_PATH *UartFlowControl;
ValueStr = GetNextParamStr (&TextDeviceNode);
UartFlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *)CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_VENDOR_DP,
(UINT16)sizeof (UART_FLOW_CONTROL_DEVICE_PATH)
);
CopyGuid (&UartFlowControl->Guid, &gEfiUartDevicePathGuid);
if (StrCmp (ValueStr, L"XonXoff") == 0) {
UartFlowControl->FlowControlMap = 2;
} else if (StrCmp (ValueStr, L"Hardware") == 0) {
UartFlowControl->FlowControlMap = 1;
} else {
UartFlowControl->FlowControlMap = 0;
}
return (EFI_DEVICE_PATH_PROTOCOL *)UartFlowControl;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Draw bitmap (bitmap from BMP file without header) */ | int32_t GLCD_DrawBitmap(uint32_t x, uint32_t y, uint32_t width, uint32_t height, const uint8_t *bitmap) | /* Draw bitmap (bitmap from BMP file without header) */
int32_t GLCD_DrawBitmap(uint32_t x, uint32_t y, uint32_t width, uint32_t height, const uint8_t *bitmap) | {
for (j = 0; j < width; j++) {
frame_buf[dot] = *ptr_bmp++;
dot += GLCD_SWAP_XY * GLCD_HEIGHT + (!GLCD_SWAP_XY);
}
dot = GLCD_SWAP_XY * (x * GLCD_HEIGHT + y + (i + 1)) + (!GLCD_SWAP_XY) * ((y + i + 1) * GLCD_WIDTH + x);
ptr_bmp -= 2 * width;
}
return 0;
} | labapart/polymcu | C++ | null | 201 |
/* Check if the device instance of the selected address is already registered and return its index. */ | static uint8_t stmpe1600_GetInstance(uint16_t DeviceAddr) | /* Check if the device instance of the selected address is already registered and return its index. */
static uint8_t stmpe1600_GetInstance(uint16_t DeviceAddr) | {
uint8_t idx = 0;
for(idx = 0; idx < STMPE1600_MAX_INSTANCE ; idx ++)
{
if(stmpe1600[idx] == DeviceAddr)
{
return idx;
}
}
return 0xFF;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Clean up the assemble table by removing all of the fragments and assemble entries. */ | VOID Ip6CleanAssembleTable(IN OUT IP6_ASSEMBLE_TABLE *Table) | /* Clean up the assemble table by removing all of the fragments and assemble entries. */
VOID Ip6CleanAssembleTable(IN OUT IP6_ASSEMBLE_TABLE *Table) | {
LIST_ENTRY *Entry;
LIST_ENTRY *Next;
IP6_ASSEMBLE_ENTRY *Assemble;
UINT32 Index;
for (Index = 0; Index < IP6_ASSEMLE_HASH_SIZE; Index++) {
NET_LIST_FOR_EACH_SAFE (Entry, Next, &Table->Bucket[Index]) {
Assemble = NET_LIST_USER_STRUCT (Entry, IP6_ASSEMBLE_ENTRY, Link);
RemoveEntryList (Entry);
Ip6FreeAssembleEntry (Assemble);
}
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Start a new MMC command for a host, and wait for the command to complete. Return any error that occurred while the command was executing. Do not attempt to parse the response. */ | int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd, int retries) | /* Start a new MMC command for a host, and wait for the command to complete. Return any error that occurred while the command was executing. Do not attempt to parse the response. */
int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd, int retries) | {
struct mmc_request mrq;
WARN_ON(!host->claimed);
memset(&mrq, 0, sizeof(struct mmc_request));
memset(cmd->resp, 0, sizeof(cmd->resp));
cmd->retries = retries;
mrq.cmd = cmd;
cmd->data = NULL;
mmc_wait_for_req(host, &mrq);
return cmd->error;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Here we just change the flags value on the stack: we allow only the super-user to do it. This depends on the stack-layout on system-call entry - see also fork() and the signal handling code. */ | long sys_iopl(unsigned int level, struct pt_regs *regs) | /* Here we just change the flags value on the stack: we allow only the super-user to do it. This depends on the stack-layout on system-call entry - see also fork() and the signal handling code. */
long sys_iopl(unsigned int level, struct pt_regs *regs) | {
unsigned int old = (regs->flags >> 12) & 3;
struct thread_struct *t = ¤t->thread;
if (level > 3)
return -EINVAL;
if (level > old) {
if (!capable(CAP_SYS_RAWIO))
return -EPERM;
}
regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) | (level << 12);
t->iopl = level << 12;
set_iopl_mask(t->iopl);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* ADC Set the Sample Time for a Single Channel.
The sampling time can be selected in ADC clock cycles from 1.5 to 239.5. */ | void adc_set_sample_time(uint32_t adc, uint8_t channel, uint8_t time) | /* ADC Set the Sample Time for a Single Channel.
The sampling time can be selected in ADC clock cycles from 1.5 to 239.5. */
void adc_set_sample_time(uint32_t adc, uint8_t channel, uint8_t time) | {
uint32_t reg32;
if (channel < 10) {
reg32 = ADC_SMPR2(adc);
reg32 &= ~(0x7 << (channel * 3));
reg32 |= (time << (channel * 3));
ADC_SMPR2(adc) = reg32;
} else {
reg32 = ADC_SMPR1(adc);
reg32 &= ~(0x7 << ((channel - 10) * 3));
reg32 |= (time << ((channel - 10) * 3));
ADC_SMPR1(adc) = reg32;
}
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* See _g_freedesktop_dbus_call_list_queued_owners_sync() for the synchronous, blocking version of this method. */ | void _g_freedesktop_dbus_call_list_queued_owners(_GFreedesktopDBus *proxy, const gchar *arg_name, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) | /* See _g_freedesktop_dbus_call_list_queued_owners_sync() for the synchronous, blocking version of this method. */
void _g_freedesktop_dbus_call_list_queued_owners(_GFreedesktopDBus *proxy, const gchar *arg_name, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) | {
g_dbus_proxy_call (G_DBUS_PROXY (proxy),
"ListQueuedOwners",
g_variant_new ("(s)",
arg_name),
G_DBUS_CALL_FLAGS_NONE,
-1,
cancellable,
callback,
user_data);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function is called before the register_framebuffer so no locking is needed. */ | static void matroxfb_dh_init_fix(struct matroxfb_dh_fb_info *m2info) | /* This function is called before the register_framebuffer so no locking is needed. */
static void matroxfb_dh_init_fix(struct matroxfb_dh_fb_info *m2info) | {
struct fb_fix_screeninfo *fix = &m2info->fbcon.fix;
strcpy(fix->id, "MATROX DH");
fix->smem_start = m2info->video.base;
fix->smem_len = m2info->video.len_usable;
fix->ypanstep = 1;
fix->ywrapstep = 0;
fix->xpanstep = 8;
fix->mmio_start = m2info->mmio.base;
fix->mmio_len = m2info->mmio.len;
fix->accel = 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Pushes the new state onto the stack. The new state becomes the current state. This function will allocate the stack if necessary. */ | void yypush_buffer_state(YY_BUFFER_STATE new_buffer) | /* Pushes the new state onto the stack. The new state becomes the current state. This function will allocate the stack if necessary. */
void yypush_buffer_state(YY_BUFFER_STATE new_buffer) | {
if (new_buffer == NULL)
return;
yyensure_buffer_stack();
if ( YY_CURRENT_BUFFER )
{
*(yy_c_buf_p) = (yy_hold_char);
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
if (YY_CURRENT_BUFFER)
(yy_buffer_stack_top)++;
YY_CURRENT_BUFFER_LVALUE = new_buffer;
yy_load_buffer_state( );
(yy_did_buffer_switch_on_eof) = 1;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* This function is used to set output enable. */ | int tls_pwm_output_en_cmd(u8 channel, bool en) | /* This function is used to set output enable. */
int tls_pwm_output_en_cmd(u8 channel, bool en) | {
if(channel != 0 && channel != 4)
return WM_FAILED;
if (4 == channel)
{
if (ENABLE == en)
tls_reg_write32(HR_PWM_CAP2CTL, tls_reg_read32(HR_PWM_CAP2CTL) & (~BIT(2)));
else
tls_reg_write32(HR_PWM_CAP2CTL, tls_reg_read32(HR_PWM_CAP2CTL) | BIT(2));
}
else
{
if (ENABLE == en)
tls_reg_write32(HR_PWM_CTL, tls_reg_read32(HR_PWM_CTL) & (~BIT(12)));
else
tls_reg_write32(HR_PWM_CTL, tls_reg_read32(HR_PWM_CTL) | BIT(12));
}
return WM_SUCCESS;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Get to know the Tx FIFO is Empty or not from the specified port. */ | xtBoolean UARTFIFOTxIsEmpty(unsigned long ulBase) | /* Get to know the Tx FIFO is Empty or not from the specified port. */
xtBoolean UARTFIFOTxIsEmpty(unsigned long ulBase) | {
xASSERT(UARTBaseValid(ulBase));
return((xHWREG(ulBase + UART_FSR) & UART_FSR_TX_EF) ? xtrue : xfalse);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Initialise the TTP socket and initiate TTP connection */ | static int irnet_connect_tsap(irnet_socket *self) | /* Initialise the TTP socket and initiate TTP connection */
static int irnet_connect_tsap(irnet_socket *self) | {
int err;
DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self);
err = irnet_open_tsap(self);
if(err != 0)
{
clear_bit(0, &self->ttp_connect);
DERROR(IRDA_SR_ERROR, "connect aborted!\n");
return(err);
}
err = irttp_connect_request(self->tsap, self->dtsap_sel,
self->rsaddr, self->daddr, NULL,
self->max_sdu_size_rx, NULL);
if(err != 0)
{
clear_bit(0, &self->ttp_connect);
DERROR(IRDA_SR_ERROR, "connect aborted!\n");
return(err);
}
DEXIT(IRDA_SR_TRACE, "\n");
return(err);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* But we might still want to scale the dirty_ratio by how much memory the box has.. */ | void __init page_writeback_init(void) | /* But we might still want to scale the dirty_ratio by how much memory the box has.. */
void __init page_writeback_init(void) | {
int shift;
writeback_set_ratelimit();
register_cpu_notifier(&ratelimit_nb);
shift = calc_period_shift();
prop_descriptor_init(&vm_completions, shift);
prop_descriptor_init(&vm_dirties, shift);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Command response callback function for sd_ble_gap_encrypt BLE command.
Callback for decoding the output parameters and the command response return code. */ | static uint32_t gap_encrypt_rsp_dec(const uint8_t *p_buffer, uint16_t length) | /* Command response callback function for sd_ble_gap_encrypt BLE command.
Callback for decoding the output parameters and the command response return code. */
static uint32_t gap_encrypt_rsp_dec(const uint8_t *p_buffer, uint16_t length) | {
uint32_t result_code = 0;
const uint32_t err_code = ble_gap_encrypt_rsp_dec(p_buffer,
length,
&result_code);
APP_ERROR_CHECK(err_code);
return result_code;
} | labapart/polymcu | C++ | null | 201 |
/* Masks the S2MM error interrupt for the provided error mask value */ | int XAxiVdma_MaskS2MMErrIntr(XAxiVdma *InstancePtr, u32 ErrorMask, u16 Direction) | /* Masks the S2MM error interrupt for the provided error mask value */
int XAxiVdma_MaskS2MMErrIntr(XAxiVdma *InstancePtr, u32 ErrorMask, u16 Direction) | {
XAxiVdma_Channel *Channel;
if (Direction != XAXIVDMA_WRITE) {
return XST_INVALID_PARAM;
}
Channel = XAxiVdma_GetChannel(InstancePtr, Direction);
if (!Channel) {
return XST_INVALID_PARAM;
}
if (Channel->IsValid) {
XAxiVdma_WriteReg(Channel->ChanBase,
XAXIVDMA_S2MM_DMA_IRQ_MASK_OFFSET,
ErrorMask & XAXIVDMA_S2MM_IRQ_ERR_ALL_MASK);
return XST_SUCCESS;
}
return XST_DEVICE_NOT_FOUND;
} | ua1arn/hftrx | C++ | null | 69 |
/* Writes a value to the RF Management dynamic register. */ | int32_t ST25DV_WriteRFMngt_Dyn(ST25DV_Object_t *pObj, const uint8_t RF_Mngt) | /* Writes a value to the RF Management dynamic register. */
int32_t ST25DV_WriteRFMngt_Dyn(ST25DV_Object_t *pObj, const uint8_t RF_Mngt) | {
return st25dv_set_rf_mngt_dyn_all(&(pObj->Ctx), &RF_Mngt);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Since each UCS2 character can be represented by the format: \uXXXX, this function is used to retrieve the UCS2 character from a Unicode format. Call MUST make sure there are at least 6 Bytes in the input UTF8 buffer. */ | EFI_STATUS GetUCS2CharByFormat(IN CHAR8 *Utf8Buffer, OUT CHAR16 *Ucs2Char) | /* Since each UCS2 character can be represented by the format: \uXXXX, this function is used to retrieve the UCS2 character from a Unicode format. Call MUST make sure there are at least 6 Bytes in the input UTF8 buffer. */
EFI_STATUS GetUCS2CharByFormat(IN CHAR8 *Utf8Buffer, OUT CHAR16 *Ucs2Char) | {
UINT8 Num1;
UINT8 Num2;
UINT8 Index;
CHAR8 Ucs2CharFormat[UNICODE_FORMAT_CHAR_SIZE];
for (Index = 0; Index < 4; Index++) {
if ((*(Utf8Buffer + 2 + Index) & 0x80) != 0x00) {
return EFI_INVALID_PARAMETER;
}
}
ZeroMem (Ucs2CharFormat, UNICODE_FORMAT_CHAR_SIZE);
CopyMem (Ucs2CharFormat, Utf8Buffer + 2, UNICODE_FORMAT_CHAR_LEN);
Num1 = (UINT8)AsciiStrHexToUintn (Ucs2CharFormat);
CopyMem (Ucs2CharFormat, Utf8Buffer + 4, UNICODE_FORMAT_CHAR_LEN);
Num2 = (UINT8)AsciiStrHexToUintn (Ucs2CharFormat);
*((CHAR8 *)Ucs2Char) = Num2;
*(((CHAR8 *)Ucs2Char) + 1) = Num1;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Low-level data read callback for the simplified SSL I/O API. */ | static int sock_read(void *ctx, unsigned char *buf, size_t len) | /* Low-level data read callback for the simplified SSL I/O API. */
static int sock_read(void *ctx, unsigned char *buf, size_t len) | {
for (;;) {
ssize_t rlen;
rlen = read(*(int *)ctx, buf, len);
if (rlen <= 0) {
if (rlen < 0 && errno == EINTR) {
continue;
}
return -1;
}
return (int)rlen;
}
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.