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 |
|---|---|---|---|---|---|---|---|
/* Message: CloseReceiveChannelMessage Opcode: 0x0106 Type: MediaControl Direction: pbx2dev VarLength: no */ | static void handle_CloseReceiveChannelMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | /* Message: CloseReceiveChannelMessage Opcode: 0x0106 Type: MediaControl Direction: pbx2dev VarLength: no */
static void handle_CloseReceiveChannelMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | {
ptvcursor_add(cursor, hf_skinny_conferenceID, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_passThruPartyID, 4, ENC_LITTLE_ENDIAN);
si->callId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
ptvcursor_add(cursor, hf_skinny_callReference, 4, ENC_LITTLE_ENDIAN);
ptvcurso... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Initializes the block by setting it to be free. */ | static void block_init(uint32_t block_index) | /* Initializes the block by setting it to be free. */
static void block_init(uint32_t block_index) | {
uint32_t x;
uint32_t y;
get_block_coordinates(block_index, &x, &y);
SET_BIT(m_mem_pool[x], y);
} | labapart/polymcu | C++ | null | 201 |
/* Initializes the HRTIMx timer in basic time base mode. */ | void HRTIM_SimpleBase_Init(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx, HRTIM_BaseInitTypeDef *HRTIM_BaseInitStruct) | /* Initializes the HRTIMx timer in basic time base mode. */
void HRTIM_SimpleBase_Init(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx, HRTIM_BaseInitTypeDef *HRTIM_BaseInitStruct) | {
assert_param(IS_HRTIM_TIMERINDEX(TimerIdx));
assert_param(IS_HRTIM_MODE(HRTIM_BaseInitStruct->Mode));
if (TimerIdx == HRTIM_TIMERINDEX_MASTER)
{
HRTIM_MasterBase_Config(HRTIMx, HRTIM_BaseInitStruct);
}
else
{
HRTIM_TimingUnitBase_Config(HRTIMx, TimerIdx, HRTIM_BaseInitStruct);
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Returns: a string containing the @appinfo's application binaries name */ | const char* g_app_info_get_executable(GAppInfo *appinfo) | /* Returns: a string containing the @appinfo's application binaries name */
const char* g_app_info_get_executable(GAppInfo *appinfo) | {
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), NULL);
iface = G_APP_INFO_GET_IFACE (appinfo);
return (* iface->get_executable) (appinfo);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Stop audio Codec playing. It powers down the codec. */ | uint32_t cs42l51_Stop(uint16_t DeviceAddr, uint32_t CodecPdwnMode) | /* Stop audio Codec playing. It powers down the codec. */
uint32_t cs42l51_Stop(uint16_t DeviceAddr, uint32_t CodecPdwnMode) | {
uint32_t counter = 0;
uint8_t Value;
counter += CODEC_IO_Write(DeviceAddr, 0x02, 0x7E);
Value = AUDIO_IO_Read(DeviceAddr, 0x03);
counter += CODEC_IO_Write(DeviceAddr, 0x03, (Value | 0x0E));
Value = AUDIO_IO_Read(DeviceAddr, 0x09);
counter += CODEC_IO_Write(DeviceAddr, 0x09, (Value & 0xFC));
Value = A... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Routine to get the next Handle, when you are searching for all handles. */ | IHANDLE* UnitTestGetNextLocateAllHandles(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface) | /* Routine to get the next Handle, when you are searching for all handles. */
IHANDLE* UnitTestGetNextLocateAllHandles(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface) | {
IHANDLE *Handle;
Position->Position = Position->Position->ForwardLink;
Handle = NULL;
*Interface = NULL;
if (Position->Position != &gHandleList) {
Handle = CR (Position->Position, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE);
}
return Handle;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Tries to start B-device HNP negotiation if enabled via sysfs */ | static void musb_try_b_hnp_enable(struct musb *musb) | /* Tries to start B-device HNP negotiation if enabled via sysfs */
static void musb_try_b_hnp_enable(struct musb *musb) | {
void __iomem *mbase = musb->mregs;
u8 devctl;
DBG(1, "HNP: Setting HR\n");
devctl = musb_readb(mbase, MUSB_DEVCTL);
musb_writeb(mbase, MUSB_DEVCTL, devctl | MUSB_DEVCTL_HR);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* NB: this is absolutely and utterly different from the vt1618. dunno about the 1616. */ | static int snd_ac97_vt1617a_smart51_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | /* NB: this is absolutely and utterly different from the vt1618. dunno about the 1616. */
static int snd_ac97_vt1617a_smart51_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | {
static const char* texts[] = { "LineIn Mic1", "LineIn Mic1 Mic3",
"Surr LFE/C Mic3", "LineIn LFE/C Mic3",
"LineIn Mic2", "LineIn Mic2 Mic1",
"Surr LFE Mic1", "Surr LFE Mic1 Mic2"};
return ac97_enum_text_info(kcontrol, uinfo, texts, 8);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Interpret the data as if it were a num_blocks x line_len matrix and for each line do a cyclic permutation, i.e. abcdefghijklm -> defghijklmabc where the amount to be shifted is evaluated depending on the column. */ | static void permutate_in_line(int16_t *tab, int num_vect, int num_blocks, int block_size, const uint8_t line_len[2], int length_div, enum FrameType ftype) | /* Interpret the data as if it were a num_blocks x line_len matrix and for each line do a cyclic permutation, i.e. abcdefghijklm -> defghijklmabc where the amount to be shifted is evaluated depending on the column. */
static void permutate_in_line(int16_t *tab, int num_vect, int num_blocks, int block_size, const uint8... | {
int i,j;
for (i = 0; i < line_len[0]; i++) {
int shift;
if (num_blocks == 1 ||
(ftype == FT_LONG && num_vect % num_blocks) ||
(ftype != FT_LONG && num_vect & 1 ) ||
i == line_len[1]) {
shift = 0;
} else if (ftype == FT_LONG) {
... | DC-SWAT/DreamShell | C++ | null | 404 |
/* Send a master data receive request with an NACK when the master have obtained control of the bus(Write Step2).
For this function returns immediately, it is always using in the interrupt hander. */ | void xI2CMasterReadLastRequestS2(unsigned long ulBase) | /* Send a master data receive request with an NACK when the master have obtained control of the bus(Write Step2).
For this function returns immediately, it is always using in the interrupt hander. */
void xI2CMasterReadLastRequestS2(unsigned long ulBase) | {
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE));
xHWREG(ulBase + I2C_CON) &= ~I2C_CON_AA;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This function is called when user wants to send data to peer host. */ | static int winc1500_send(struct net_pkt *pkt, net_context_send_cb_t cb, int32_t timeout, void *user_data) | /* This function is called when user wants to send data to peer host. */
static int winc1500_send(struct net_pkt *pkt, net_context_send_cb_t cb, int32_t timeout, void *user_data) | {
struct net_context *context = pkt->context;
SOCKET socket = (int)context->offload_context;
int ret = 0;
struct net_buf *buf;
buf = net_buf_alloc(&winc1500_tx_pool, WINC1500_BUF_TIMEOUT);
if (!buf) {
return -ENOBUFS;
}
if (net_pkt_read(pkt, buf->data, net_pkt_get_len(pkt))) {
ret = -ENOBUFS;
goto out;
}... | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Redraw the invalidated areas now. Normally the redrawing is periodically executed in */ | void lv_refr_now(lv_disp_t *disp) | /* Redraw the invalidated areas now. Normally the redrawing is periodically executed in */
void lv_refr_now(lv_disp_t *disp) | {
lv_anim_refr_now();
if(disp) {
_lv_disp_refr_timer(disp->refr_timer);
}
else {
lv_disp_t * d;
d = lv_disp_get_next(NULL);
while(d) {
_lv_disp_refr_timer(d->refr_timer);
d = lv_disp_get_next(d);
}
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Resets the clock configuration to the default state. */ | void RCM_Reset(void) | /* Resets the clock configuration to the default state. */
void RCM_Reset(void) | {
RCM->CTRL_B.HSIEN = BIT_SET;
RCM->CFG = (uint32_t)0x00000000;
RCM->CTRL &= (uint32_t)0xEAF6FFFF;
RCM->PLL1CFG = 0x24003010;
RCM->PLL2CFG = 0x20003000;
RCM->CTRL_B.HSEBCFG = BIT_RESET;
RCM->INT = 0x00000000;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* set DAC concurrent mode data holding register value */ | void dac_concurrent_data_set(uint32_t dac_align, uint16_t data0, uint16_t data1) | /* set DAC concurrent mode data holding register value */
void dac_concurrent_data_set(uint32_t dac_align, uint16_t data0, uint16_t data1) | {
uint32_t data = 0U;
switch(dac_align){
case DAC_ALIGN_12B_R:
data = ((uint32_t)data1 << DH_12BIT_OFFSET) | data0;
DACC_R12DH = data;
break;
case DAC_ALIGN_12B_L:
data = ((uint32_t)data1 << DH_12BIT_OFFSET) | data0;
DACC_L12DH = data;
break;
case DAC_... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* A callback from the upper layers for PIO-only tuning. */ | static void cs5535_set_pio_mode(ide_drive_t *drive, const u8 pio) | /* A callback from the upper layers for PIO-only tuning. */
static void cs5535_set_pio_mode(ide_drive_t *drive, const u8 pio) | {
cs5535_set_speed(drive, XFER_PIO_0 + pio);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Determines the flash bank that the address belongs to. */ | static blt_int32u FlashGetBank(blt_addr address) | /* Determines the flash bank that the address belongs to. */
static blt_int32u FlashGetBank(blt_addr address) | {
blt_int32u result = FLASH_BANK_1;
ASSERT_RT(address >= FLASH_BASE);
ASSERT_RT((address - FLASH_BASE) < FLASH_SIZE);
if ((address - FLASH_BASE) >= FLASH_BANK_SIZE)
{
result = FLASH_BANK_2;
}
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Recover QUOTAOFF records. We simply make a note of it in the xlog_t structure, so that we know not to do any dquot item or dquot buffer recovery, of that type. */ | STATIC int xlog_recover_do_quotaoff_trans(xlog_t *log, xlog_recover_item_t *item, int pass) | /* Recover QUOTAOFF records. We simply make a note of it in the xlog_t structure, so that we know not to do any dquot item or dquot buffer recovery, of that type. */
STATIC int xlog_recover_do_quotaoff_trans(xlog_t *log, xlog_recover_item_t *item, int pass) | {
xfs_qoff_logformat_t *qoff_f;
if (pass == XLOG_RECOVER_PASS2) {
return (0);
}
qoff_f = (xfs_qoff_logformat_t *)item->ri_buf[0].i_addr;
ASSERT(qoff_f);
if (qoff_f->qf_flags & XFS_UQUOTA_ACCT)
log->l_quotaoffs_flag |= XFS_DQ_USER;
if (qoff_f->qf_flags & XFS_PQUOTA_ACCT)
log->l_quotaoffs_flag |= XFS_DQ_PROJ... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Upon exit, ctx->ptr may be zero only if it was already zero on entry, and len == 0. In all other situations, ctx->ptr will be non-zero on exit (and may have value 16). */ | static void do_cbcmac_chunk(br_eax_context *ctx, const void *data, size_t len) | /* Upon exit, ctx->ptr may be zero only if it was already zero on entry, and len == 0. In all other situations, ctx->ptr will be non-zero on exit (and may have value 16). */
static void do_cbcmac_chunk(br_eax_context *ctx, const void *data, size_t len) | {
size_t ptr;
if (len == 0) {
return;
}
ptr = len & (size_t)15;
if (ptr == 0) {
len -= 16;
ptr = 16;
} else {
len -= ptr;
}
if (ctx->ptr == 16) {
(*ctx->bctx)->mac(ctx->bctx, ctx->cbcmac,
ctx->buf, sizeof ctx->buf);
}
(*ctx->bctx)->mac(ctx->bctx, ctx->cbcmac, data, len);
memcpy(ctx->buf, (const ... | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Locking Note: Called without the rport lock held. This function will hold the rport lock, call an */ | int fc_rport_logoff(struct fc_rport_priv *rdata) | /* Locking Note: Called without the rport lock held. This function will hold the rport lock, call an */
int fc_rport_logoff(struct fc_rport_priv *rdata) | {
mutex_lock(&rdata->rp_mutex);
FC_RPORT_DBG(rdata, "Remove port\n");
if (rdata->rp_state == RPORT_ST_DELETE) {
FC_RPORT_DBG(rdata, "Port in Delete state, not removing\n");
goto out;
}
if (rdata->rp_state == RPORT_ST_RESTART)
FC_RPORT_DBG(rdata, "Port in Restart state, deleting\n");
else
fc_rport_enter_lo... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The phy may be powered down to save power and turn off link when the driver is unloaded and wake on lan is not enabled (among others) *** this routine MUST be followed by a call to e1000_reset *** */ | void e1000_power_up_phy(struct e1000_adapter *adapter) | /* The phy may be powered down to save power and turn off link when the driver is unloaded and wake on lan is not enabled (among others) *** this routine MUST be followed by a call to e1000_reset *** */
void e1000_power_up_phy(struct e1000_adapter *adapter) | {
struct e1000_hw *hw = &adapter->hw;
u16 mii_reg = 0;
if (hw->media_type == e1000_media_type_copper) {
e1000_read_phy_reg(hw, PHY_CTRL, &mii_reg);
mii_reg &= ~MII_CR_POWER_DOWN;
e1000_write_phy_reg(hw, PHY_CTRL, mii_reg);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function handles DMA1 channel 4, 5, 6 and 7 interrupts. */ | void DMA1_Channel4_5_6_7_IRQHandler(void) | /* This function handles DMA1 channel 4, 5, 6 and 7 interrupts. */
void DMA1_Channel4_5_6_7_IRQHandler(void) | {
HAL_DMA_IRQHandler(&hdma_usart3_rx);
} | Luos-io/luos_engine | C++ | MIT License | 496 |
/* returns 0 if successful, or a negative error code. */ | int pcxhr_send_msg(struct pcxhr_mgr *mgr, struct pcxhr_rmh *rmh) | /* returns 0 if successful, or a negative error code. */
int pcxhr_send_msg(struct pcxhr_mgr *mgr, struct pcxhr_rmh *rmh) | {
unsigned long flags;
int err;
spin_lock_irqsave(&mgr->msg_lock, flags);
err = pcxhr_send_msg_nolock(mgr, rmh);
spin_unlock_irqrestore(&mgr->msg_lock, flags);
return err;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Delays number of milliseconds in sleep mode (EM2) using the RTC but but returns if an event wakes up the MCU. */ | uint32_t UTIL_waitForEvent(uint32_t timeout) | /* Delays number of milliseconds in sleep mode (EM2) using the RTC but but returns if an event wakes up the MCU. */
uint32_t UTIL_waitForEvent(uint32_t timeout) | {
uint32_t remaining;
rtcComplete = false;
RTCDRV_StartTimer( rtcId, rtcdrvTimerTypeOneshot, timeout, rtcCb, 0 );
EMU_EnterEM2( true );
if( rtcComplete ){
remaining = 0;
}
else {
RTCDRV_TimeRemaining( rtcId, &remaining );
}
return remaining;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Get the time-base counter reached its maximum value flag of selected channel. */ | uint32_t EPWM_GetWrapAroundFlag(EPWM_T *epwm, uint32_t u32ChannelNum) | /* Get the time-base counter reached its maximum value flag of selected channel. */
uint32_t EPWM_GetWrapAroundFlag(EPWM_T *epwm, uint32_t u32ChannelNum) | {
return (((epwm)->STATUS & (EPWM_STATUS_CNTMAXF0_Msk << u32ChannelNum)) ? 1UL : 0UL);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* process the cdc data send/receive state machine and user application */ | static HOST_STATUS usb_host_cdc_class_process(usb_core_instance *pdev, void *phost) | /* process the cdc data send/receive state machine and user application */
static HOST_STATUS usb_host_cdc_class_process(usb_core_instance *pdev, void *phost) | {
HOST_STATUS status = HSTATUS_OK;
USBH_HOST *pphost = phost;
pphost->user_callbk->huser_application();
if (CDC_ReqState == CDC_SET_LINE_CODING_RQUEST) {
return status;
}
usb_host_cdc_senddata_process(pdev, pphost);
usb_host_cdc_receivedata_process(pdev, pphost);
return status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This API used to get the sensor SPI mode(communication type) in the register 0xF5 bit 0. */ | BMP280_RETURN_FUNCTION_TYPE bmp280_get_spi3(u8 *v_enable_disable_u8) | /* This API used to get the sensor SPI mode(communication type) in the register 0xF5 bit 0. */
BMP280_RETURN_FUNCTION_TYPE bmp280_get_spi3(u8 *v_enable_disable_u8) | {
BMP280_RETURN_FUNCTION_TYPE com_rslt = ERROR;
u8 v_data_u8 = BMP280_INIT_VALUE;
if (p_bmp280 == BMP280_NULL) {
com_rslt = E_BMP280_NULL_PTR;
} else {
com_rslt = p_bmp280->BMP280_BUS_READ_FUNC(p_bmp280->dev_addr,
BMP280_CONFIG_REG_SPI3_ENABLE__REG, &v_data_u8,
BMP280_GEN_READ_WRITE_DATA_LENGTH);
*v_e... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Get iostream instance handle for a given name */ | sl_iostream_t* sl_iostream_get_handle(char *name) | /* Get iostream instance handle for a given name */
sl_iostream_t* sl_iostream_get_handle(char *name) | {
for (uint32_t i = 0; i < sl_iostream_instances_count; i++) {
if (strcmp(sl_iostream_instances_info[i]->name, name) == 0) {
return sl_iostream_instances_info[i]->handle;
}
}
return NULL;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* pop an existing item off the free queue, or create a new one */ | static lv_lru_item_t * lv_lru_pop_or_create_item(lv_lru_t *cache) | /* pop an existing item off the free queue, or create a new one */
static lv_lru_item_t * lv_lru_pop_or_create_item(lv_lru_t *cache) | {
lv_lru_item_t * item = NULL;
if(cache->free_items) {
item = cache->free_items;
cache->free_items = item->next;
lv_memset_00(item, sizeof(lv_lru_item_t));
}
else {
item = (lv_lru_item_t *) lv_mem_alloc(sizeof(lv_lru_item_t));
lv_memset_00(item, sizeof(lv_lru_item... | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Select the ACMP- input source of the comparator. */ | void ACMPNegativeSrcSet(unsigned long ulBase, unsigned long ulComp, unsigned long ulSource) | /* Select the ACMP- input source of the comparator. */
void ACMPNegativeSrcSet(unsigned long ulBase, unsigned long ulComp, unsigned long ulSource) | {
unsigned long ulCRAddr;
xASSERT(ulBase == ACMP_BASE);
xASSERT((ulComp >= 0) && (ulComp < 2));
ulCRAddr = ulBase + ACMP_CR0 + (4 * ulComp);
xHWREG(ulCRAddr) &= ~ACMP_CR_CN;
xHWREG(ulCRAddr) |= (ulSource << 4);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Reads and returns the current value of CR0. This function is only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on X64. */ | UINTN EFIAPI AsmReadCr0(VOID) | /* Reads and returns the current value of CR0. This function is only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on X64. */
UINTN EFIAPI AsmReadCr0(VOID) | {
UINTN Data;
__asm__ __volatile__ (
"mov %%cr0,%0"
: "=r" (Data)
);
return Data;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Reset the PHY. This PHY completes reset immediately so we never wait. */ | static int vsc8211_reset(struct cphy *cphy, int wait) | /* Reset the PHY. This PHY completes reset immediately so we never wait. */
static int vsc8211_reset(struct cphy *cphy, int wait) | {
return t3_phy_reset(cphy, MDIO_DEVAD_NONE, 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return: the contents of the register described by @pd and @offs. */ | static u32 __prci_readl(struct __prci_data *pd, u32 offs) | /* Return: the contents of the register described by @pd and @offs. */
static u32 __prci_readl(struct __prci_data *pd, u32 offs) | {
return readl(pd->va + offs);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Show a specific icon on the LCD glass.
This function will show a specific icon. */ | void xpro_lcd_show_icon(uint8_t icon_com, uint8_t icon_seg) | /* Show a specific icon on the LCD glass.
This function will show a specific icon. */
void xpro_lcd_show_icon(uint8_t icon_com, uint8_t icon_seg) | {
slcd_set_pixel(icon_com, icon_seg);
} | memfault/zero-to-main | C++ | null | 200 |
/* Initialize DMA hardware.
DMA control block, requires proper alignment. */ | void rt_hw_dma_init(void) | /* Initialize DMA hardware.
DMA control block, requires proper alignment. */
void rt_hw_dma_init(void) | {
DMA_Init_TypeDef dmaInit;
DMA_Reset();
dmaInit.hprot = 0;
dmaInit.controlBlock = (DMA_DESCRIPTOR_TypeDef *)&dmaControlBlock;
DMA_Init(&dmaInit);
NVIC_SetPriority(DMA_IRQn, EFM32_IRQ_PRI_DEFAULT);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Attribute read call back for the Long descriptor V2D1 attribute. */ | static ssize_t read_long_des_v2d1_1(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) | /* Attribute read call back for the Long descriptor V2D1 attribute. */
static ssize_t read_long_des_v2d1_1(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) | {
const uint8_t *value = attr->user_data;
return bt_gatt_attr_read(conn, attr, buf, len, offset, value,
sizeof(long_des_v2d1_1_value));
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Writes and returns a new value to DR5. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */ | UINTN EFIAPI AsmWriteDr5(UINTN Dr5) | /* Writes and returns a new value to DR5. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */
UINTN EFIAPI AsmWriteDr5(UINTN Dr5) | {
__asm__ __volatile__ (
"mov %0, %%dr5"
:
: "r" (Dr5)
);
return Dr5;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Called very early, MMU is off, device-tree isn't unflattened */ | static int __init mpc837x_rdb_probe(void) | /* Called very early, MMU is off, device-tree isn't unflattened */
static int __init mpc837x_rdb_probe(void) | {
unsigned long root = of_get_flat_dt_root();
return of_flat_dt_is_compatible(root, "fsl,mpc8377rdb") ||
of_flat_dt_is_compatible(root, "fsl,mpc8378rdb") ||
of_flat_dt_is_compatible(root, "fsl,mpc8379rdb") ||
of_flat_dt_is_compatible(root, "fsl,mpc8377wlan");
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Mark the block reservation window as not allocated, and unlink it from the filesystem reservation window rb tree. Must be called with rsv_lock held. */ | static void rsv_window_remove(struct super_block *sb, struct ext2_reserve_window_node *rsv) | /* Mark the block reservation window as not allocated, and unlink it from the filesystem reservation window rb tree. Must be called with rsv_lock held. */
static void rsv_window_remove(struct super_block *sb, struct ext2_reserve_window_node *rsv) | {
rsv->rsv_start = EXT2_RESERVE_WINDOW_NOT_ALLOCATED;
rsv->rsv_end = EXT2_RESERVE_WINDOW_NOT_ALLOCATED;
rsv->rsv_alloc_hit = 0;
rb_erase(&rsv->rsv_node, &EXT2_SB(sb)->s_rsv_window_root);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* We can access without locking, as the value is (for now) orthogonal to other values. */ | ssize_t uwb_pca_base_priority_store(struct wlp_options *options, const char *buf, size_t size) | /* We can access without locking, as the value is (for now) orthogonal to other values. */
ssize_t uwb_pca_base_priority_store(struct wlp_options *options, const char *buf, size_t size) | {
ssize_t result = -EINVAL;
u8 pca_base_priority;
result = sscanf(buf, "%hhu\n", &pca_base_priority);
if (result != 1) {
result = -EINVAL;
goto out;
}
result = -EINVAL;
if (pca_base_priority >= 8)
goto out;
options->pca_base_priority = pca_base_priority;
if (result >= 0 && (wlp_tx_hdr_delivery_id_type(&o... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns true if the utf8 character 'c' is a multibyte continuation character. We use this to correctly compute the on screen size of the character when printing */ | rt_inline int is_utf8_continuation(unsigned char c) | /* Returns true if the utf8 character 'c' is a multibyte continuation character. We use this to correctly compute the on screen size of the character when printing */
rt_inline int is_utf8_continuation(unsigned char c) | {
return (c & 0xc0) == 0x80;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get the touch screen X and Y positions values. */ | void stmpe811_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y) | /* Get the touch screen X and Y positions values. */
void stmpe811_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y) | {
uint8_t dataXYZ[4];
uint32_t uldataXYZ;
IOE_ReadMultiple(DeviceAddr, STMPE811_REG_TSC_DATA_NON_INC, dataXYZ, sizeof(dataXYZ)) ;
uldataXYZ = (dataXYZ[0] << 24)|(dataXYZ[1] << 16)|(dataXYZ[2] << 8)|(dataXYZ[3] << 0);
*X = (uldataXYZ >> 20) & 0x00000FFF;
*Y = (uldataXYZ >> 8) & 0x00000FFF;
IOE_... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* the CRC routines are stolen from WAMPES by Dieter Deyke */ | static int check_crc_ccitt(const unsigned char *buf, int cnt) | /* the CRC routines are stolen from WAMPES by Dieter Deyke */
static int check_crc_ccitt(const unsigned char *buf, int cnt) | {
return (crc_ccitt(0xffff, buf, cnt) & 0xffff) == 0xf0b8;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write 8 bytes to Trace Hub MMIO addr + 0x0. */ | VOID EFIAPI MipiSystWriteD64(IN VOID *MipiSystHandle, IN UINT64 Data) | /* Write 8 bytes to Trace Hub MMIO addr + 0x0. */
VOID EFIAPI MipiSystWriteD64(IN VOID *MipiSystHandle, IN UINT64 Data) | {
MIPI_SYST_HANDLE *MipiSystH;
MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle;
MmioWrite64 ((UINTN)(MipiSystH->systh_platform.TraceHubPlatformData.MmioAddr + 0x0), Data);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Creates the metatables for the objects and registers the driver open method. */ | LUASQL_API int luaopen_luasql_odbc(lua_State *L) | /* Creates the metatables for the objects and registers the driver open method. */
LUASQL_API int luaopen_luasql_odbc(lua_State *L) | {
{"odbc", create_environment},
{NULL, NULL},
};
create_metatables (L);
luaL_openlib (L, LUASQL_TABLENAME, driver, 0);
luasql_set_info (L);
return 1;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* ADC Initialize Calibration Registers.
This resets the calibration registers. It is not clear if this is required to be done before every calibration operation. */ | void adc_reset_calibration(uint32_t adc) | /* ADC Initialize Calibration Registers.
This resets the calibration registers. It is not clear if this is required to be done before every calibration operation. */
void adc_reset_calibration(uint32_t adc) | {
ADC_CR2(adc) |= ADC_CR2_RSTCAL;
while (ADC_CR2(adc) & ADC_CR2_RSTCAL);
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* This function is called by iget5_locked() to distinguish reiserfs inodes having the same inode numbers. Such inodes can only exist due to some error condition. One of them should be bad. Inodes with identical inode numbers (objectids) are distinguished by parent directory ids. */ | int reiserfs_find_actor(struct inode *inode, void *opaque) | /* This function is called by iget5_locked() to distinguish reiserfs inodes having the same inode numbers. Such inodes can only exist due to some error condition. One of them should be bad. Inodes with identical inode numbers (objectids) are distinguished by parent directory ids. */
int reiserfs_find_actor(struct inod... | {
struct reiserfs_iget_args *args;
args = opaque;
return (inode->i_ino == args->objectid) &&
(le32_to_cpu(INODE_PKEY(inode)->k_dir_id) == args->dirid);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Fills each CMP_INTTypeDef member with its default value. */ | void CMP_INTStructInit(CMP_INTTypeDef *InitStruct) | /* Fills each CMP_INTTypeDef member with its default value. */
void CMP_INTStructInit(CMP_INTTypeDef *InitStruct) | {
InitStruct->INTNumSel = CMP_INTNUM_EVERY;
InitStruct->SubSel = CMP_COUNT_NOSUB;
InitStruct->THRNum = 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Show and set the up and down delays. These must be multiples of the MII monitoring value, and are stored internally as the multiplier. Thus, we must translate to MS for the real world. */ | static ssize_t bonding_show_downdelay(struct device *d, struct device_attribute *attr, char *buf) | /* Show and set the up and down delays. These must be multiples of the MII monitoring value, and are stored internally as the multiplier. Thus, we must translate to MS for the real world. */
static ssize_t bonding_show_downdelay(struct device *d, struct device_attribute *attr, char *buf) | {
struct bonding *bond = to_bond(d);
return sprintf(buf, "%d\n", bond->params.downdelay * bond->params.miimon);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get a free channel number so that can be distributed to a device endpoint. */ | uint16_t usb_host_getfreech(usb_core_instance *pdev) | /* Get a free channel number so that can be distributed to a device endpoint. */
uint16_t usb_host_getfreech(usb_core_instance *pdev) | {
uint8_t tmp_idx;
uint16_t u16Ret = HC_ERROR;
for (tmp_idx = 0U ; tmp_idx < USB_MAX_CH_NUM ; tmp_idx++) {
if ((pdev->host.channel[tmp_idx & (USB_MAX_TX_FIFOS - 1U)] & HC_USED) == 0U) {
u16Ret = HC_OK;
break;
}
}
if (u16Ret == HC_OK) {
u16Ret = tmp_idx... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* In this case, the no-indeterminism principle is lost. Runs of native_posix will depend on the host load and the interactions with those real host peripherals. */ | void posix_exit(int exit_code) | /* In this case, the no-indeterminism principle is lost. Runs of native_posix will depend on the host load and the interactions with those real host peripherals. */
void posix_exit(int exit_code) | {
static int max_exit_code;
max_exit_code = MAX(exit_code, max_exit_code);
posix_soc_clean_up();
hwm_cleanup();
native_cleanup_cmd_line();
exit(max_exit_code);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Initialize the memory management pool for the host controller. */ | EFI_STATUS UfsPeimInitMemPool(IN UFS_PEIM_HC_PRIVATE_DATA *Private) | /* Initialize the memory management pool for the host controller. */
EFI_STATUS UfsPeimInitMemPool(IN UFS_PEIM_HC_PRIVATE_DATA *Private) | {
UFS_PEIM_MEM_POOL *Pool;
EFI_STATUS Status;
VOID *TempPtr;
TempPtr = NULL;
Pool = NULL;
Status = PeiServicesAllocatePool (sizeof (UFS_PEIM_MEM_POOL), &TempPtr);
if (EFI_ERROR (Status)) {
return EFI_OUT_OF_RESOURCES;
}
ZeroMem ((VOID *)(UINTN)TempPtr, sizeof (UFS_PEIM_ME... | tianocore/edk2 | C++ | Other | 4,240 |
/* Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct. */ | void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef *DAC_InitStruct) | /* Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct. */
void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef *DAC_InitStruct) | {
uint32_t tmpreg1 = 0, tmpreg2 = 0;
assert_param(IS_DAC_TRIGGER(DAC_InitStruct->DAC_Trigger));
assert_param(IS_DAC_GENERATE_WAVE(DAC_InitStruct->DAC_WaveGeneration));
assert_param(IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude));
assert_param(IS_DAC_OUTPUT_BU... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Fills each gpioConfig member with its default value. */ | void GPIO_ConfigStructInit(GPIO_Config_T *gpioConfig) | /* Fills each gpioConfig member with its default value. */
void GPIO_ConfigStructInit(GPIO_Config_T *gpioConfig) | {
gpioConfig->pin = GPIO_PIN_ALL;
gpioConfig->speed = GPIO_SPEED_2MHz;
gpioConfig->mode = GPIO_MODE_IN_FLOATING;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Check whether the device path node is ISA Serial Node. */ | BOOLEAN IsIsaSerialNode(IN ACPI_HID_DEVICE_PATH *Acpi) | /* Check whether the device path node is ISA Serial Node. */
BOOLEAN IsIsaSerialNode(IN ACPI_HID_DEVICE_PATH *Acpi) | {
return (BOOLEAN)(
(DevicePathType (Acpi) == ACPI_DEVICE_PATH) &&
(DevicePathSubType (Acpi) == ACPI_DP) &&
(ReadUnaligned32 (&Acpi->HID) == EISA_PNP_ID (0x0501))
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Clears or safeguards the OCREF2 signal on an external event. */ | void TIM_ClearOC2Ref(TIM_TypeDef *tim, TIMOCCE_Typedef clear) | /* Clears or safeguards the OCREF2 signal on an external event. */
void TIM_ClearOC2Ref(TIM_TypeDef *tim, TIMOCCE_Typedef clear) | {
MODIFY_REG(tim->CCMR1, TIM_CCMR1_OC2CEN, clear << 8);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* RCC Reset the Backup Domain.
The backup domain registers are reset to disable RTC controls and clear user data. */ | void rcc_backupdomain_reset(void) | /* RCC Reset the Backup Domain.
The backup domain registers are reset to disable RTC controls and clear user data. */
void rcc_backupdomain_reset(void) | {
RCC_BDCR |= RCC_BDCR_BDRST;
RCC_BDCR &= ~RCC_BDCR_BDRST;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Puts the processor into sleep mode.
This function places the processor into sleep mode; it will not return until the processor returns to run mode. The peripherals that are enabled via SysCtlPeripheralSleepEnable() continue to operate and can wake up the processor (if automatic clock gating is enabled with SysCtlPe... | void SysCtlSleep(void) | /* Puts the processor into sleep mode.
This function places the processor into sleep mode; it will not return until the processor returns to run mode. The peripherals that are enabled via SysCtlPeripheralSleepEnable() continue to operate and can wake up the processor (if automatic clock gating is enabled with SysCtlPe... | {
SysCtlPowerDownEnable(1);
SysCtlPowerDownWaitCPUSet(1);
xCPUwfi();
SysCtlPowerDownEnable(0);
SysCtlPowerDownWaitCPUSet(0);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Sets the states of the RTS modem control signals and trigger level.
The */ | void UARTModemControlSet(unsigned long ulBase, unsigned long ulControl) | /* Sets the states of the RTS modem control signals and trigger level.
The */
void UARTModemControlSet(unsigned long ulBase, unsigned long ulControl) | {
xASSERT((ulBase == UART0_BASE));
xHWREG(ulBase + UART_MCR) &= ~(UART_MCR_RTS | UART_MCR_LEV_RTS);
xHWREG(ulBase + UART_MCR) |= (ulControl);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Returns the stack index and buffer assosicated with the Handle parameter. */ | EFI_STATUS GetEBCStack(IN EFI_HANDLE Handle, OUT VOID **StackBuffer, OUT UINTN *BufferIndex) | /* Returns the stack index and buffer assosicated with the Handle parameter. */
EFI_STATUS GetEBCStack(IN EFI_HANDLE Handle, OUT VOID **StackBuffer, OUT UINTN *BufferIndex) | {
UINTN Index;
EFI_TPL OldTpl;
OldTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
for (Index = 0; Index < mStackNum; Index++) {
if (mStackBufferIndex[Index] == NULL) {
mStackBufferIndex[Index] = Handle;
break;
}
}
gBS->RestoreTPL (OldTpl);
if (Index == mStackNum) {
return EFI_OUT_OF_RESO... | tianocore/edk2 | C++ | Other | 4,240 |
/* analog_open() is a callback from the input open routine. */ | static int analog_open(struct input_dev *dev) | /* analog_open() is a callback from the input open routine. */
static int analog_open(struct input_dev *dev) | {
struct analog_port *port = input_get_drvdata(dev);
gameport_start_polling(port->gameport);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* utf8len(s ]]) --> number of characters that start in the range , or nil + current position if 's' is not well formed in that interval */ | static int utflen(lua_State *L) | /* utf8len(s ]]) --> number of characters that start in the range , or nil + current position if 's' is not well formed in that interval */
static int utflen(lua_State *L) | {
const char *s1 = utf8_decode(s + posi, NULL, !lax);
if (s1 == NULL) {
luaL_pushfail(L);
lua_pushinteger(L, posi + 1);
return 2;
}
posi = s1 - s;
n++;
}
lua_pushinteger(L, n);
return 1;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Clears the states of the RTS modem control signals.
The */ | void UARTModemControlClear(unsigned long ulBase, unsigned long ulControl) | /* Clears the states of the RTS modem control signals.
The */
void UARTModemControlClear(unsigned long ulBase, unsigned long ulControl) | {
xASSERT((ulBase == UART0_BASE));
xHWREG(ulBase + UART_MCR) &= ~(ulControl & UART_MCR_RTS);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Get memory block size in a Memory Pool. */ | uint32_t osMemoryPoolGetBlockSize(osMemoryPoolId_t mp_id) | /* Get memory block size in a Memory Pool. */
uint32_t osMemoryPoolGetBlockSize(osMemoryPoolId_t mp_id) | {
block_size = svcRtxMemoryPoolGetBlockSize(mp_id);
} else {
block_size = __svcMemoryPoolGetBlockSize(mp_id);
}
return block_size;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* for each connection, pre-allocate skbs needed for close/abort requests. So that we can service the request right away. */ | static void c3cn_free_cpl_skbs(struct s3_conn *c3cn) | /* for each connection, pre-allocate skbs needed for close/abort requests. So that we can service the request right away. */
static void c3cn_free_cpl_skbs(struct s3_conn *c3cn) | {
if (c3cn->cpl_close)
kfree_skb(c3cn->cpl_close);
if (c3cn->cpl_abort_req)
kfree_skb(c3cn->cpl_abort_req);
if (c3cn->cpl_abort_rpl)
kfree_skb(c3cn->cpl_abort_rpl);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return a pointer to the n-th key in the btree block. */ | STATIC union xfs_btree_key* xfs_btree_key_addr(struct xfs_btree_cur *cur, int n, struct xfs_btree_block *block) | /* Return a pointer to the n-th key in the btree block. */
STATIC union xfs_btree_key* xfs_btree_key_addr(struct xfs_btree_cur *cur, int n, struct xfs_btree_block *block) | {
return (union xfs_btree_key *)
((char *)block + xfs_btree_key_offset(cur, n));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Allocate a memory block from a memory pool. */ | void* osPoolAlloc(osPoolId pool_id) | /* Allocate a memory block from a memory pool. */
void* osPoolAlloc(osPoolId pool_id) | {
return sysPoolAlloc(pool_id, 0);
} else {
return __sysPoolAlloc(pool_id, 0);
}
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* As an example, to set a region with the following attributes: size of 32 KB, execution enabled, read-only for both privileged and user, one sub-region disabled, and initially enabled; the */ | void MPURegionSet(uint32_t ui32Region, uint32_t ui32Addr, uint32_t ui32Flags) | /* As an example, to set a region with the following attributes: size of 32 KB, execution enabled, read-only for both privileged and user, one sub-region disabled, and initially enabled; the */
void MPURegionSet(uint32_t ui32Region, uint32_t ui32Addr, uint32_t ui32Flags) | {
ASSERT(ui32Region < 8);
ASSERT(ui32Addr ==
(ui32Addr & ~0 << (((ui32Flags & NVIC_MPU_ATTR_SIZE_M) >> 1) + 1)));
HWREG(NVIC_MPU_BASE) = ui32Addr | ui32Region | NVIC_MPU_BASE_VALID;
HWREG(NVIC_MPU_ATTR) = ((ui32Flags & ~(NVIC_MPU_ATTR_TEX_M |
NVIC_MP... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ | void GPIOPinTypeGPIOOutputOD(unsigned long ulPort, unsigned char ucPins) | /* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeGPIOOutputOD(unsigned long ulPort, unsigned char ucPins) | {
ASSERT(GPIOBaseValid(ulPort));
GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_OD);
GPIODirModeSet(ulPort, ucPins, GPIO_DIR_MODE_OUT);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* This is ugly, but preserves the userspace API for existing cpuset users. If someone tries to mount the "cpuset" filesystem, we silently switch it to mount "cgroup" instead */ | static int cpuset_get_sb(struct file_system_type *fs_type, int flags, const char *unused_dev_name, void *data, struct vfsmount *mnt) | /* This is ugly, but preserves the userspace API for existing cpuset users. If someone tries to mount the "cpuset" filesystem, we silently switch it to mount "cgroup" instead */
static int cpuset_get_sb(struct file_system_type *fs_type, int flags, const char *unused_dev_name, void *data, struct vfsmount *mnt) | {
struct file_system_type *cgroup_fs = get_fs_type("cgroup");
int ret = -ENODEV;
if (cgroup_fs) {
char mountopts[] =
"cpuset,noprefix,"
"release_agent=/sbin/cpuset_release_agent";
ret = cgroup_fs->get_sb(cgroup_fs, flags,
unused_dev_name, mountopts, mnt);
put_filesystem(cgroup_fs);
}
return ret... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Have we just finished recovery? If so, and if we are mounting (or remounting) the filesystem readonly, then we will end up with a consistent fs on disk. Record that fact. */ | static void ext3_mark_recovery_complete(struct super_block *sb, struct ext3_super_block *es) | /* Have we just finished recovery? If so, and if we are mounting (or remounting) the filesystem readonly, then we will end up with a consistent fs on disk. Record that fact. */
static void ext3_mark_recovery_complete(struct super_block *sb, struct ext3_super_block *es) | {
journal_t *journal = EXT3_SB(sb)->s_journal;
journal_lock_updates(journal);
if (journal_flush(journal) < 0)
goto out;
if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER) &&
sb->s_flags & MS_RDONLY) {
EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER);
ext3_commit_super(sb, es, ... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This driver will not work with a 2.4 kernel. */ | static u8 ReadByteFromHwPort(unsigned long addr) | /* This driver will not work with a 2.4 kernel. */
static u8 ReadByteFromHwPort(unsigned long addr) | {
u8 result = inb(addr);
return result;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function parses the Memory Proximity Domain Attributes Structure (Type 0). */ | STATIC VOID DumpMpda(IN UINT8 *Ptr, IN UINT32 Length) | /* This function parses the Memory Proximity Domain Attributes Structure (Type 0). */
STATIC VOID DumpMpda(IN UINT8 *Ptr, IN UINT32 Length) | {
ParseAcpi (
TRUE,
2,
"Memory Proximity Domain Attributes Structure",
Ptr,
Length,
PARSER_PARAMS (MemProximityDomainAttributeParser)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Reads the hardware revision of the IO expander. */ | uint8_t BOARD_picGetHwRevision(void) | /* Reads the hardware revision of the IO expander. */
uint8_t BOARD_picGetHwRevision(void) | {
uint8_t rev;
BOARD_picReadReg( BOARD_PIC_REG_BOARD_REV, &rev );
return rev;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Slave 0 write operation is performed only at the first sensor hub cycle.. */ | int32_t lsm6dso_sh_write_mode_get(stmdev_ctx_t *ctx, lsm6dso_write_once_t *val) | /* Slave 0 write operation is performed only at the first sensor hub cycle.. */
int32_t lsm6dso_sh_write_mode_get(stmdev_ctx_t *ctx, lsm6dso_write_once_t *val) | {
lsm6dso_master_config_t reg;
int32_t ret;
ret = lsm6dso_mem_bank_set(ctx, LSM6DSO_SENSOR_HUB_BANK);
if (ret == 0) {
ret = lsm6dso_read_reg(ctx, LSM6DSO_MASTER_CONFIG, (uint8_t *)®,
1);
}
if (ret == 0) {
switch (reg.write_once) {
case LSM6DSO_EACH_SH_CYCLE:
... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Return: 0 on success or a negative error code on failure. */ | int mipi_dsi_dcs_get_pixel_format(struct mipi_dsi_device *dsi, u8 *format) | /* Return: 0 on success or a negative error code on failure. */
int mipi_dsi_dcs_get_pixel_format(struct mipi_dsi_device *dsi, u8 *format) | {
ssize_t err;
err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_PIXEL_FORMAT, format,
sizeof(*format));
if (err <= 0) {
if (err == 0)
err = -ENODATA;
return err;
}
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Set the filter type for the specified ETHERNET MAC address. */ | void ETH_ConfigMacAddrFilter(uint32_t MacAddr, uint32_t Filter) | /* Set the filter type for the specified ETHERNET MAC address. */
void ETH_ConfigMacAddrFilter(uint32_t MacAddr, uint32_t Filter) | {
assert_param(IS_ETH_MAC_ADDR123(MacAddr));
assert_param(IS_ETH_MAC_ADDR_FILTER(Filter));
if (Filter != ETH_MAC_ADDR_FILTER_DA)
{
(*(__IO uint32_t*)(ETH_MAC_ADDR_HBASE + MacAddr)) |= ETH_MACADDR1HI_SA;
}
else
{
(*(__IO uint32_t*)(ETH_MAC_ADDR_HBASE + MacAddr)) &= (~(uint32_t... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */ | void encodeBMP(std::vector< unsigned char > &bmp, const unsigned char *image, int w, int h) | /* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */
void encodeBMP(std::vector< unsigned char > &bmp, const unsigned char *image, int w, int h) | {
int c = 0;
for(int x = 0; x < imagerowbytes; x++) {
if(x < w * outputChannels) {
int inc = c;
if(c == 0) inc = 2;
else if(c == 2) inc = 0;
bmp.push_back(image[inputChannels * (w * y + x / outputChannels) + inc]);
}
else bmp.push_back(0);
c++;
if(c ... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Concatenate two pbufs (each may be a pbuf chain) and take over the caller's reference of the tail pbuf. */ | void pbuf_cat(struct pbuf *h, struct pbuf *t) | /* Concatenate two pbufs (each may be a pbuf chain) and take over the caller's reference of the tail pbuf. */
void pbuf_cat(struct pbuf *h, struct pbuf *t) | {
struct pbuf *p;
LWIP_ASSERT("h != NULL (programmer violates API)", h != NULL);
LWIP_ASSERT("t != NULL (programmer violates API)", t != NULL);
if ((h == NULL) || (t == NULL)) return;
for (p = h; p->next != NULL; p = p->next) {
p->tot_len += t->tot_len;
}
LWIP_ASSERT("p->tot_len == p->len (of last pbu... | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* param base LPUART peripheral base address. param handle LPUART handle pointer. param ringBuffer Start address of ring buffer for background receiving. Pass NULL to disable the ring buffer. param ringBufferSize size of the ring buffer. */ | void LPUART_TransferStartRingBuffer(LPUART_Type *base, lpuart_handle_t *handle, uint8_t *ringBuffer, size_t ringBufferSize) | /* param base LPUART peripheral base address. param handle LPUART handle pointer. param ringBuffer Start address of ring buffer for background receiving. Pass NULL to disable the ring buffer. param ringBufferSize size of the ring buffer. */
void LPUART_TransferStartRingBuffer(LPUART_Type *base, lpuart_handle_t *handle... | {
assert(NULL != handle);
assert(NULL != ringBuffer);
handle->rxRingBuffer = ringBuffer;
handle->rxRingBufferSize = ringBufferSize;
handle->rxRingBufferHead = 0U;
handle->rxRingBufferTail = 0U;
uint32_t irqMask = DisableGlobalIRQ();
base->CTRL |= (uint32_t)(LPUART_CTRL_RIE_MASK | LPU... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Queue all expired dirty inodes for io, eldest first. */ | static void queue_io(struct bdi_writeback *wb, unsigned long *older_than_this) | /* Queue all expired dirty inodes for io, eldest first. */
static void queue_io(struct bdi_writeback *wb, unsigned long *older_than_this) | {
list_splice_init(&wb->b_more_io, wb->b_io.prev);
move_expired_inodes(&wb->b_dirty, &wb->b_io, older_than_this);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Description: Register the CIPSOv4 packet NetLabel component with the Generic NETLINK mechanism. Returns zero on success, negative values on failure. */ | int __init netlbl_cipsov4_genl_init(void) | /* Description: Register the CIPSOv4 packet NetLabel component with the Generic NETLINK mechanism. Returns zero on success, negative values on failure. */
int __init netlbl_cipsov4_genl_init(void) | {
return genl_register_family_with_ops(&netlbl_cipsov4_gnl_family,
netlbl_cipsov4_ops, ARRAY_SIZE(netlbl_cipsov4_ops));
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The phy_id is ignored as the driver will probe for it. */ | static int __init parse_tag_ethernet(struct tag *tag) | /* The phy_id is ignored as the driver will probe for it. */
static int __init parse_tag_ethernet(struct tag *tag) | {
int i = tag->u.ethernet.mac_index;
if (i < ARRAY_SIZE(hw_addr))
memcpy(hw_addr[i].addr, tag->u.ethernet.hw_address,
sizeof(hw_addr[i].addr));
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If the cached PEI Services Table pointer is NULL, then ASSERT(). */ | CONST EFI_PEI_SERVICES** EFIAPI GetPeiServicesTablePointer(VOID) | /* If the cached PEI Services Table pointer is NULL, then ASSERT(). */
CONST EFI_PEI_SERVICES** EFIAPI GetPeiServicesTablePointer(VOID) | {
CONST EFI_PEI_SERVICES **PeiServices;
IA32_DESCRIPTOR Idtr;
AsmReadIdtr (&Idtr);
PeiServices = (CONST EFI_PEI_SERVICES **)(*(UINTN *)(Idtr.Base - sizeof (UINTN)));
ASSERT (PeiServices != NULL);
return PeiServices;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Allocate and initialise a new MMC card structure. */ | struct mmc_card* mmc_alloc_card(struct mmc_host *host, struct device_type *type) | /* Allocate and initialise a new MMC card structure. */
struct mmc_card* mmc_alloc_card(struct mmc_host *host, struct device_type *type) | {
struct mmc_card *card;
card = kzalloc(sizeof(struct mmc_card), GFP_KERNEL);
if (!card)
return ERR_PTR(-ENOMEM);
card->host = host;
device_initialize(&card->dev);
card->dev.parent = mmc_classdev(host);
card->dev.bus = &mmc_bus_type;
card->dev.release = mmc_release_card;
card->dev.type = type;
return card;
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* zfcp_dbf_rec_port - trace event for port state change @id: identifier for trigger of state change additional reference (e.g. request) @port: port */ | void zfcp_dbf_rec_port(char *id, void *ref, struct zfcp_port *port) | /* zfcp_dbf_rec_port - trace event for port state change @id: identifier for trigger of state change additional reference (e.g. request) @port: port */
void zfcp_dbf_rec_port(char *id, void *ref, struct zfcp_port *port) | {
struct zfcp_dbf *dbf = port->adapter->dbf;
zfcp_dbf_rec_target(id, ref, dbf, &port->status,
&port->erp_counter, port->wwpn, port->d_id,
0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The hardware priority mechanism will only look at the upper N bits of the priority level (where N is 3 for the Stellaris family), so any prioritization must be performed in those bits. The remaining bits can be used to sub-prioritize the interrupt sources, and may be used by the hardware priority mechanism on a futu... | void xIntPrioritySet(unsigned long ulInterrupt, unsigned char ucPriority) | /* The hardware priority mechanism will only look at the upper N bits of the priority level (where N is 3 for the Stellaris family), so any prioritization must be performed in those bits. The remaining bits can be used to sub-prioritize the interrupt sources, and may be used by the hardware priority mechanism on a futu... | {
xASSERT((ulInterrupt >= 4) && (ulInterrupt < NUM_INTERRUPTS));
if(ulInterrupt < 4){
return ;
} else if(ulInterrupt < 16){
xHWREGB(NVIC_SYS_PRI1 + (ulInterrupt - 4)) = ((ucPriority << (8 - NUM_PRIORITY_BITS)) & 0xFF);
} else {
xHWREGB(NVIC_PRI0 + (ulInterrupt - 16)) = ((ucPriority << ... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* If the requested operation results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ | RETURN_STATUS EFIAPI SafeIntnMult(IN INTN Multiplicand, IN INTN Multiplier, OUT INTN *Result) | /* If the requested operation results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeIntnMult(IN INTN Multiplicand, IN INTN Multiplier, OUT INTN *Result) | {
return SafeInt64Mult ((INT64)Multiplicand, (INT64)Multiplier, (INT64 *)Result);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* param base SPDIF base pointer. param handle Pointer to the spdif_handle_t structure which stores the transfer state. param count Bytes count sent. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress. */ | status_t SPDIF_TransferGetSendCount(SPDIF_Type *base, spdif_handle_t *handle, size_t *count) | /* param base SPDIF base pointer. param handle Pointer to the spdif_handle_t structure which stores the transfer state. param count Bytes count sent. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress. */
status_t SPD... | {
assert(handle != NULL);
status_t status = kStatus_Success;
uint8_t queueDriver = handle->queueDriver;
if (handle->state != (uint32_t)kSPDIF_Busy)
{
status = kStatus_NoTransferInProgress;
}
else
{
*count = (handle->transferSize[queueDriver] - handle->spdifQueue[queue... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* RETURNS: Percpu pointer to the allocated area on success, NULL on failure. */ | void* __alloc_reserved_percpu(size_t size, size_t align) | /* RETURNS: Percpu pointer to the allocated area on success, NULL on failure. */
void* __alloc_reserved_percpu(size_t size, size_t align) | {
return pcpu_alloc(size, align, true);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Routine to receive the current CSW from the device. */ | static uint8_t MassStore_GetReturnedStatus(MS_CommandStatusWrapper_t *const SCSICommandStatus) | /* Routine to receive the current CSW from the device. */
static uint8_t MassStore_GetReturnedStatus(MS_CommandStatusWrapper_t *const SCSICommandStatus) | {
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
if ((ErrorCode = MassStore_WaitForDataReceived()) != PIPE_RWSTREAM_NoError)
return ErrorCode;
Pipe_SelectPipe(MASS_STORE_DATA_IN_PIPE);
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(MS_CommandStatusWrapper_t), NULL)) !=
... | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Copy a packet header from one mbuf to another. */ | static void _os_mbuf_copypkthdr(struct os_mbuf *new_buf, struct os_mbuf *old_buf) | /* Copy a packet header from one mbuf to another. */
static void _os_mbuf_copypkthdr(struct os_mbuf *new_buf, struct os_mbuf *old_buf) | {
assert(new_buf->om_len == 0);
memcpy(&new_buf->om_databuf[0], &old_buf->om_databuf[0],
old_buf->om_pkthdr_len);
new_buf->om_pkthdr_len = old_buf->om_pkthdr_len;
new_buf->om_data = new_buf->om_databuf + old_buf->om_pkthdr_len;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* RETURN: MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise. NOTE: This function does not modify the Operation_mode field of control register. */ | int mv_xor_ctrl_set(u32 chan, u32 xor_ctrl) | /* RETURN: MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise. NOTE: This function does not modify the Operation_mode field of control register. */
int mv_xor_ctrl_set(u32 chan, u32 xor_ctrl) | {
u32 old_value;
old_value = reg_read(XOR_CONFIG_REG(XOR_UNIT(chan), XOR_CHAN(chan))) &
XEXCR_OPERATION_MODE_MASK;
xor_ctrl &= ~XEXCR_OPERATION_MODE_MASK;
xor_ctrl |= old_value;
reg_write(XOR_CONFIG_REG(XOR_UNIT(chan), XOR_CHAN(chan)), xor_ctrl);
return MV_OK;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Generic command send function for invalidaing TLB entries */ | static int iommu_queue_inv_iommu_pages(struct amd_iommu *iommu, u64 address, u16 domid, int pde, int s) | /* Generic command send function for invalidaing TLB entries */
static int iommu_queue_inv_iommu_pages(struct amd_iommu *iommu, u64 address, u16 domid, int pde, int s) | {
struct iommu_cmd cmd;
int ret;
__iommu_build_inv_iommu_pages(&cmd, address, domid, pde, s);
ret = iommu_queue_command(iommu, &cmd);
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Configure the Rx unit of the MAC after a reset. */ | static void igb_configure_rx(struct igb_adapter *) | /* Configure the Rx unit of the MAC after a reset. */
static void igb_configure_rx(struct igb_adapter *) | {
int i;
igb_set_uta(adapter);
igb_rar_set_qsel(adapter, adapter->hw.mac.addr, 0,
adapter->vfs_allocated_count);
for (i = 0; i < adapter->num_rx_queues; i++)
igb_configure_rx_ring(adapter, &adapter->rx_ring[i]);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This file is part of the Simba project. */ | int mock_write_pcint_module_init(int res) | /* This file is part of the Simba project. */
int mock_write_pcint_module_init(int res) | {
harness_mock_write("pcint_module_init()",
NULL,
0);
harness_mock_write("pcint_module_init(): return (res)",
&res,
sizeof(res));
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* The Opti uses magic 'trapdoor' register accesses to do configuration rather than using PCI space as other controllers do. The double inw on the error register activates configuration mode. We can then write the control register */ | static void opti_write_reg(struct ata_port *ap, u8 val, int reg) | /* The Opti uses magic 'trapdoor' register accesses to do configuration rather than using PCI space as other controllers do. The double inw on the error register activates configuration mode. We can then write the control register */
static void opti_write_reg(struct ata_port *ap, u8 val, int reg) | {
void __iomem *regio = ap->ioaddr.cmd_addr;
ioread16(regio + 1);
ioread16(regio + 1);
iowrite8(3, regio + 2);
iowrite8(val, regio + reg);
iowrite8(0x83, regio + 2);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns: the position of @child with respect to its siblings */ | gint g_node_child_position(GNode *node, GNode *child) | /* Returns: the position of @child with respect to its siblings */
gint g_node_child_position(GNode *node, GNode *child) | {
guint n = 0;
g_return_val_if_fail (node != NULL, -1);
g_return_val_if_fail (child != NULL, -1);
g_return_val_if_fail (child->parent == node, -1);
node = node->children;
while (node)
{
if (node == child)
return n;
n++;
node = node->next;
}
return -1;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* So - be sure to only use dynamically allocated memory for the members of the pxe_label struct, unless you want to clean it up first. These are currently only created by the pxe file parsing code. */ | static void label_destroy(struct pxe_label *label) | /* So - be sure to only use dynamically allocated memory for the members of the pxe_label struct, unless you want to clean it up first. These are currently only created by the pxe file parsing code. */
static void label_destroy(struct pxe_label *label) | {
if (label->name)
free(label->name);
if (label->kernel)
free(label->kernel);
if (label->config)
free(label->config);
if (label->append)
free(label->append);
if (label->initrd)
free(label->initrd);
if (label->fdt)
free(label->fdt);
if (label->fdtdir)
free(label->fdtdir);
free(label);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Function called for achieving next TX Byte sending. */ | void USART_TXEmpty_Callback(void) | /* Function called for achieving next TX Byte sending. */
void USART_TXEmpty_Callback(void) | {
if(ubSend == (ubSizeToSend - 1))
{
LL_USART_DisableIT_TXE(USARTx_INSTANCE);
LL_USART_EnableIT_TC(USARTx_INSTANCE);
}
LL_USART_TransmitData8(USARTx_INSTANCE, aStringToSend[ubSend++]);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Read n 72-bit words from MC5 memory from the given start location. */ | int t3_read_mc5_range(const struct mc5 *mc5, unsigned int start, unsigned int n, u32 *buf) | /* Read n 72-bit words from MC5 memory from the given start location. */
int t3_read_mc5_range(const struct mc5 *mc5, unsigned int start, unsigned int n, u32 *buf) | {
u32 read_cmd;
int err = 0;
struct adapter *adap = mc5->adapter;
if (mc5->part_type == IDT75P52100)
read_cmd = IDT_CMD_READ;
else if (mc5->part_type == IDT75N43102)
read_cmd = IDT4_CMD_READ;
else
return -EINVAL;
mc5_dbgi_mode_enable(mc5);
while (n--) {
t3_write_reg(adap, A_MC5_DB_DBGI_REQ_ADDR0, start+... | robutest/uclinux | C++ | GPL-2.0 | 60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.