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 |
|---|---|---|---|---|---|---|---|
/* Disables a Generic Clock Generator that was previously enabled.
Stops the clock generation of a Generic Clock Generator that was previously started via a call to */ | void system_gclk_gen_disable(const uint8_t generator) | /* Disables a Generic Clock Generator that was previously enabled.
Stops the clock generation of a Generic Clock Generator that was previously started via a call to */
void system_gclk_gen_disable(const uint8_t generator) | {
while (system_gclk_is_syncing()) {
};
system_interrupt_enter_critical_section();
*((uint8_t*)&GCLK->GENCTRL.reg) = generator;
while (system_gclk_is_syncing()) {
};
GCLK->GENCTRL.reg &= ~GCLK_GENCTRL_GENEN;
while (GCLK->GENCTRL.reg & GCLK_GENCTRL_GENEN) {
}
system_interrupt_leave_critical_section();
} | memfault/zero-to-main | C++ | null | 200 |
/* If in RAM: Free the mock buffer If in disk: unmap the flash file from RAM, close the file, and if configured to do so, delete the file. */ | void flash_mock_cleanup_native(bool flash_in_ram, int flash_fd, uint8_t *mock_flash, unsigned int size, const char *flash_file_path, bool flash_rm_at_exit) | /* If in RAM: Free the mock buffer If in disk: unmap the flash file from RAM, close the file, and if configured to do so, delete the file. */
void flash_mock_cleanup_native(bool flash_in_ram, int flash_fd, uint8_t *mock_flash, unsigned int size, const char *flash_file_path, bool flash_rm_at_exit) | {
if (flash_in_ram == true) {
if (mock_flash != NULL) {
free(mock_flash);
}
return;
}
if ((mock_flash != MAP_FAILED) && (mock_flash != NULL)) {
munmap(mock_flash, size);
}
if (flash_fd != -1) {
close(flash_fd);
}
if ((flash_rm_at_exit == true) && (flash_file_path != NULL)) {
(void) remove(flash_fi... | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Sets the filter value for the IRDA demodulator. */ | void USART_SetIrdaFilter(AT91S_USART *pUsart, unsigned char filter) | /* Sets the filter value for the IRDA demodulator. */
void USART_SetIrdaFilter(AT91S_USART *pUsart, unsigned char filter) | {
SANITY_CHECK(pUsart);
pUsart->US_IF = filter;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* param base FREQME peripheral base address. param refClkFrequency The frequency of reference clock. return The frequency of target clock, if the output result is 0, please check the module's operate mode. */ | uint32_t FREQME_CalculateTargetClkFreq(FREQME_Type *base, uint32_t refClkFrequency) | /* param base FREQME peripheral base address. param refClkFrequency The frequency of reference clock. return The frequency of target clock, if the output result is 0, please check the module's operate mode. */
uint32_t FREQME_CalculateTargetClkFreq(FREQME_Type *base, uint32_t refClkFrequency) | {
uint64_t measureResult = 0ULL;
uint32_t targetFreq = 0ULL;
uint64_t tmp64 = 0ULL;
while ((base->FREQMECTRL_R & FREQME_FREQMECTRL_R_MEASURE_IN_PROGRESS_MASK) != 0UL)
{
}
if (!FREQME_CheckOperateMode(base))
{
measureResult = (uint64_t)(base->FREQMECTRL_R & FREQME_FREQM... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Adds the given vlan id into the list for this vpath. see also: vxge_hw_vpath_vid_delete, vxge_hw_vpath_vid_get and vxge_hw_vpath_vid_get_next */ | enum vxge_hw_status vxge_hw_vpath_vid_add(struct __vxge_hw_vpath_handle *vp, u64 vid) | /* Adds the given vlan id into the list for this vpath. see also: vxge_hw_vpath_vid_delete, vxge_hw_vpath_vid_get and vxge_hw_vpath_vid_get_next */
enum vxge_hw_status vxge_hw_vpath_vid_add(struct __vxge_hw_vpath_handle *vp, u64 vid) | {
enum vxge_hw_status status = VXGE_HW_OK;
if (vp == NULL) {
status = VXGE_HW_ERR_INVALID_HANDLE;
goto exit;
}
status = __vxge_hw_vpath_rts_table_set(vp,
VXGE_HW_RTS_ACCESS_STEER_CTRL_ACTION_ADD_ENTRY,
VXGE_HW_RTS_ACCESS_STEER_CTRL_DATA_STRUCT_SEL_VID,
0, VXGE_HW_RTS_ACCESS_STEER_DATA0_VLAN_ID(vid), 0)... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns 1 if an ECP port is found, and 0 otherwise. This function actually checks if an Extended Control Register seems to be present. On successful return, the port is placed in SPP mode. */ | static __init unsigned int parport_ip32_ecp_supported(struct parport *p) | /* Returns 1 if an ECP port is found, and 0 otherwise. This function actually checks if an Extended Control Register seems to be present. On successful return, the port is placed in SPP mode. */
static __init unsigned int parport_ip32_ecp_supported(struct parport *p) | {
struct parport_ip32_private * const priv = p->physport->private_data;
unsigned int ecr;
ecr = ECR_MODE_PS2 | ECR_nERRINTR | ECR_SERVINTR;
writeb(ecr, priv->regs.ecr);
if (readb(priv->regs.ecr) != (ecr | ECR_F_EMPTY))
goto fail;
pr_probe(p, "Found working ECR register\n");
parport_ip32_set_mode(p, ECR_MODE_SP... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Computes a cycle count for a given time in nanoseconds. */ | static uint32_t LPI2C_GetCyclesForWidth(uint32_t sourceClock_Hz, uint32_t width_ns, uint32_t maxCycles, uint32_t prescaler) | /* Computes a cycle count for a given time in nanoseconds. */
static uint32_t LPI2C_GetCyclesForWidth(uint32_t sourceClock_Hz, uint32_t width_ns, uint32_t maxCycles, uint32_t prescaler) | {
assert(sourceClock_Hz > 0U);
assert(prescaler > 0U);
uint32_t busCycle_ns = 1000000U / (sourceClock_Hz / prescaler / 1000U);
uint32_t cycles = 0U;
while ((((cycles + 1U) * busCycle_ns) < width_ns) && (cycles + 1U < maxCycles))
{
++cycles;
}
if ((cycles == 0U) && (busCycle_... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Remove one pre-fetched key out of the Raw Data FIFO. */ | BOOLEAN RawFiFoRemoveOneKey(TERMINAL_DEV *TerminalDevice, UINT8 *Output) | /* Remove one pre-fetched key out of the Raw Data FIFO. */
BOOLEAN RawFiFoRemoveOneKey(TERMINAL_DEV *TerminalDevice, UINT8 *Output) | {
UINT8 Head;
Head = TerminalDevice->RawFiFo->Head;
if (IsRawFiFoEmpty (TerminalDevice)) {
*Output = 0;
return FALSE;
}
*Output = TerminalDevice->RawFiFo->Data[Head];
TerminalDevice->RawFiFo->Head = (UINT8)((Head + 1) % (RAW_FIFO_MAX_NUMBER + 1));
return TRUE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Reads the interrupt status.
This function reads the interrupt status in the systick timer. */ | uint32_t am_hal_systick_int_status_get(void) | /* Reads the interrupt status.
This function reads the interrupt status in the systick timer. */
uint32_t am_hal_systick_int_status_get(void) | {
return AM_REG(SYSTICK, SYSTCSR) & AM_REG_SYSTICK_SYSTCSR_COUNTFLAG_M;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Send a master data transmit request 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 xI2CMasterWriteRequestS2(unsigned long ulBase, unsigned char ucData, xtBoolean bEndTransmition) | /* Send a master data transmit request 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 xI2CMasterWriteRequestS2(unsigned long ulBase, unsigned char ucData, xtBoolean bEndTransmition) | {
xASSERT((ulBase == I2C0_BASE));
xHWREG(ulBase + I2C_O_DAT) = ucData;
xHWREG(ulBase + I2C_O_CON) &= ~(I2C_CON_AA | I2C_CON_EI);
if(bEndTransmition)
{
I2CStopSend(ulBase);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Returns unsigned register value on success, -errno on failure. */ | static int read_ad1843_reg(void *priv, int reg) | /* Returns unsigned register value on success, -errno on failure. */
static int read_ad1843_reg(void *priv, int reg) | {
struct snd_sgio2audio *chip = priv;
int val;
unsigned long flags;
spin_lock_irqsave(&chip->ad1843_lock, flags);
writeq((reg << CODEC_CONTROL_ADDRESS_SHIFT) |
CODEC_CONTROL_READ, &mace->perif.audio.codec_control);
wmb();
val = readq(&mace->perif.audio.codec_control);
udelay(200);
val = readq(&mace->pe... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ZigBee Device Profile dissector for the node descriptor */ | void dissect_zbee_zdp_rsp_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version) | /* ZigBee Device Profile dissector for the node descriptor */
void dissect_zbee_zdp_rsp_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version) | {
guint offset = 0;
guint8 status;
guint16 device;
status = zdp_parse_status(tree, tvb, &offset);
device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL);
if (status == ZBEE_ZDP_STATUS_SUCCESS) {
zdp_parse_node_desc(tree, ett_zbee_z... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* You must explicitly specifiy the @generation for which the node ID is valid, to avoid sending packets to the wrong nodes when we race with a bus reset. */ | int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation, u64 addr, quadlet_t *buffer, size_t length) | /* You must explicitly specifiy the @generation for which the node ID is valid, to avoid sending packets to the wrong nodes when we race with a bus reset. */
int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation, u64 addr, quadlet_t *buffer, size_t length) | {
struct hpsb_packet *packet;
int retval = 0;
if (length == 0)
return -EINVAL;
packet = hpsb_make_readpacket(host, node, addr, length);
if (!packet) {
return -ENOMEM;
}
packet->generation = generation;
retval = hpsb_send_packet_and_wait(packet);
if (retval < 0)
goto hpsb_read_fail;
retval = hpsb_packet_... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Clears the register array which contains the VLAN filter table by setting all the values to 0. */ | void igb_clear_vfta(struct e1000_hw *hw) | /* Clears the register array which contains the VLAN filter table by setting all the values to 0. */
void igb_clear_vfta(struct e1000_hw *hw) | {
u32 offset;
for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) {
array_wr32(E1000_VFTA, offset, 0);
wrfl();
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Count the number of clusters given a size. */ | STATIC UINTN FatSizeToClusters(IN FAT_VOLUME *Volume, IN UINTN Size) | /* Count the number of clusters given a size. */
STATIC UINTN FatSizeToClusters(IN FAT_VOLUME *Volume, IN UINTN Size) | {
UINTN Clusters;
Clusters = Size >> Volume->ClusterAlignment;
if ((Size & (Volume->ClusterSize - 1)) > 0) {
Clusters += 1;
}
return Clusters;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This routine handles slow-path WQ entry comsumed event by invoking the proper WQ release routine to the slow-path WQ. */ | static void lpfc_sli4_sp_handle_rel_wcqe(struct lpfc_hba *phba, struct lpfc_wcqe_release *wcqe) | /* This routine handles slow-path WQ entry comsumed event by invoking the proper WQ release routine to the slow-path WQ. */
static void lpfc_sli4_sp_handle_rel_wcqe(struct lpfc_hba *phba, struct lpfc_wcqe_release *wcqe) | {
if (bf_get(lpfc_wcqe_r_wq_id, wcqe) == phba->sli4_hba.els_wq->queue_id)
lpfc_sli4_wq_release(phba->sli4_hba.els_wq,
bf_get(lpfc_wcqe_r_wqe_index, wcqe));
else
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
"2579 Slow-path wqe consume event carries "
"miss-matched qid: wcqe-qid=x%x, sp-qid=x%x\n",... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ZigBee Device Profile dissector for the find node cache */ | void dissect_zbee_zdp_rsp_find_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) | /* ZigBee Device Profile dissector for the find node cache */
void dissect_zbee_zdp_rsp_find_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) | {
guint offset = 0;
guint16 cache;
guint16 device;
cache = zbee_parse_uint(tree, hf_zbee_zdp_cache, tvb, &offset, (int)sizeof(guint16), NULL);
device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr,... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* RETURNS: Pointer to @sd on success, NULL on failure. */ | struct sysfs_dirent* sysfs_get_active_two(struct sysfs_dirent *sd) | /* RETURNS: Pointer to @sd on success, NULL on failure. */
struct sysfs_dirent* sysfs_get_active_two(struct sysfs_dirent *sd) | {
if (sd) {
if (sd->s_parent && unlikely(!sysfs_get_active(sd->s_parent)))
return NULL;
if (unlikely(!sysfs_get_active(sd))) {
sysfs_put_active(sd->s_parent);
return NULL;
}
}
return sd;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets the Mac address in to GMAC register. This function sets the MAC address to the MAC register in question. */ | s32 synopGMAC_set_mac_addr(synopGMACdevice *gmacdev, u32 MacHigh, u32 MacLow, u8 *MacAddr) | /* Sets the Mac address in to GMAC register. This function sets the MAC address to the MAC register in question. */
s32 synopGMAC_set_mac_addr(synopGMACdevice *gmacdev, u32 MacHigh, u32 MacLow, u8 *MacAddr) | {
u32 data;
data = (MacAddr[5] << 8) | MacAddr[4];
synopGMACWriteReg(gmacdev->MacBase,MacHigh,data);
data = (MacAddr[3] << 24) | (MacAddr[2] << 16) | (MacAddr[1] << 8) | MacAddr[0] ;
synopGMACWriteReg(gmacdev->MacBase,MacLow,data);
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* param base The I3C peripheral base address. param handle Pointer to the I3C slave driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */ | void I3C_SlaveTransferCreateHandle(I3C_Type *base, i3c_slave_handle_t *handle, i3c_slave_transfer_callback_t callback, void *userData) | /* param base The I3C peripheral base address. param handle Pointer to the I3C slave driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */
void I3C_SlaveTransferCreateHandle(I3C_Type *base, i3c_slave_handle_t... | {
uint32_t instance;
assert(NULL != handle);
(void)memset(handle, 0, sizeof(*handle));
instance = I3C_GetInstance(base);
handle->callback = callback;
handle->userData = userData;
handle->txFifoSize =
2U << ((base->SCAPABILITIES & I3C_SCAPABILITIES_FIFOTX_MASK) >> I3C_SCAPABILITIES_FI... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Before you start, select your target, on the right of the "Load" button */ | int main(void) | /* Before you start, select your target, on the right of the "Load" button */
int main(void) | {
TM_DISCO_LedToggle(LED_GREEN);
Delayms(500);
}
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Accelerometer Y-axis user offset correction expressed in two’s complement, weight depends on USR_OFF_W in CTRL6_C (15h). The value must be in the range .. */ | int32_t lsm6dso_xl_usr_offset_y_get(lsm6dso_ctx_t *ctx, uint8_t *buff) | /* Accelerometer Y-axis user offset correction expressed in two’s complement, weight depends on USR_OFF_W in CTRL6_C (15h). The value must be in the range .. */
int32_t lsm6dso_xl_usr_offset_y_get(lsm6dso_ctx_t *ctx, uint8_t *buff) | {
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_Y_OFS_USR, buff, 1);
return ret;
} | alexander-g-dean/ESF | C++ | null | 41 |
/* Cable type is set via control register 7. Bit zero high for UTP, low for STP. */ | static void madgemc_setcabletype(struct net_device *dev, int type) | /* Cable type is set via control register 7. Bit zero high for UTP, low for STP. */
static void madgemc_setcabletype(struct net_device *dev, int type) | {
outb((type==0)?MC_CONTROL_REG7_CABLEUTP:MC_CONTROL_REG7_CABLESTP,
dev->base_addr + MC_CONTROL_REG7);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns the block index, from the start of the cluster which this hash belongs too. */ | static unsigned int __ocfs2_dx_dir_hash_idx(struct ocfs2_super *osb, u32 minor_hash) | /* Returns the block index, from the start of the cluster which this hash belongs too. */
static unsigned int __ocfs2_dx_dir_hash_idx(struct ocfs2_super *osb, u32 minor_hash) | {
return minor_hash & osb->osb_dx_mask;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns iocid and sets iocpp if iocid is found. Returns -1 if iocid is not found. */ | int mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp) | /* Returns iocid and sets iocpp if iocid is found. Returns -1 if iocid is not found. */
int mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp) | {
MPT_ADAPTER *ioc;
list_for_each_entry(ioc,&ioc_list,list) {
if (ioc->id == iocid) {
*iocpp =ioc;
return iocid;
}
}
*iocpp = NULL;
return -1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base SAI base pointer param order Data order MSB or LSB */ | void SAI_TxSetBitClockPolarity(I2S_Type *base, sai_clock_polarity_t polarity) | /* param base SAI base pointer param order Data order MSB or LSB */
void SAI_TxSetBitClockPolarity(I2S_Type *base, sai_clock_polarity_t polarity) | {
uint32_t val = (base->TCR2) & (~I2S_TCR2_BCP_MASK);
val |= I2S_TCR2_BCP(polarity);
base->TCR2 = val;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Shut off the Flash and execute the _WFI(), then power up the Flash after wake-up event. */ | void POWER_CycleCpuAndFlash(void) | /* Shut off the Flash and execute the _WFI(), then power up the Flash after wake-up event. */
void POWER_CycleCpuAndFlash(void) | {
lowpower_driver_interface_t *s_lowpowerDriver;
if (0UL == Chip_GetVersion())
{
s_lowpowerDriver = (lowpower_driver_interface_t *)(0x130010d4UL);
}
else
{
s_lowpowerDriver = (lowpower_driver_interface_t *)(0x13001204UL);
}
(*(s_lowpowerDriver->power_cycle_cpu_and_flash))... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Allocate a single block NET_BUF. Upon allocation, all the free space is in the tail room. */ | NET_BUF* EFIAPI NetbufAlloc(IN UINT32 Len) | /* Allocate a single block NET_BUF. Upon allocation, all the free space is in the tail room. */
NET_BUF* EFIAPI NetbufAlloc(IN UINT32 Len) | {
NET_BUF *Nbuf;
NET_VECTOR *Vector;
UINT8 *Bulk;
ASSERT (Len > 0);
Nbuf = NetbufAllocStruct (1, 1);
if (Nbuf == NULL) {
return NULL;
}
Bulk = AllocatePool (Len);
if (Bulk == NULL) {
goto FreeNBuf;
}
Vector = Nbuf->Vector;
Vector->Len = Len;
Vector->Block[0].Bulk = Bulk... | tianocore/edk2 | C++ | Other | 4,240 |
/* This function handles TIM1 update interrupt and TIM16 global interrupt. */ | void TIM1_UP_TIM16_IRQHandler(void) | /* This function handles TIM1 update interrupt and TIM16 global interrupt. */
void TIM1_UP_TIM16_IRQHandler(void) | {
HAL_TIM_IRQHandler(&htim1);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* unset all bits in union bitmap (bmap) that do not exist in share (from successful OPEN_DOWNGRADE) */ | static void reset_union_bmap_access(unsigned long access, unsigned long *bmap) | /* unset all bits in union bitmap (bmap) that do not exist in share (from successful OPEN_DOWNGRADE) */
static void reset_union_bmap_access(unsigned long access, unsigned long *bmap) | {
int i;
for (i = 1; i < 4; i++) {
if ((i & access) != i)
__clear_bit(i, bmap);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables the AHB peripheral clock during Low Power (SLEEP) mode. */ | void RCC_AHBPeriphClockLPModeCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState) | /* Enables or disables the AHB peripheral clock during Low Power (SLEEP) mode. */
void RCC_AHBPeriphClockLPModeCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState) | {
assert_param(IS_RCC_AHB_LPMODE_PERIPH(RCC_AHBPeriph));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
RCC->AHBLPENR |= RCC_AHBPeriph;
}
else
{
RCC->AHBLPENR &= ~RCC_AHBPeriph;
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* This function returns zero in case of success and a negative error code in case of failure. */ | int ubi_io_mark_bad(const struct ubi_device *ubi, int pnum) | /* This function returns zero in case of success and a negative error code in case of failure. */
int ubi_io_mark_bad(const struct ubi_device *ubi, int pnum) | {
int err;
struct mtd_info *mtd = ubi->mtd;
ubi_assert(pnum >= 0 && pnum < ubi->peb_count);
if (ubi->ro_mode) {
ubi_err("read-only mode");
return -EROFS;
}
if (!ubi->bad_allowed)
return 0;
err = mtd->block_markbad(mtd, (loff_t)pnum * ubi->peb_size);
if (err)
ubi_err("cannot mark PEB %d bad, error %d", p... | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Set up B channel structure This is called by "gigaset_initcs" in common.c */ | static int gigaset_initbcshw(struct bc_state *bcs) | /* Set up B channel structure This is called by "gigaset_initcs" in common.c */
static int gigaset_initbcshw(struct bc_state *bcs) | {
bcs->hw.ser = NULL;
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* We init chunking and trailer bits to their default values here immediately before receiving any header data for the current request. */ | static void do_complete(struct connectdata *conn) | /* We init chunking and trailer bits to their default values here immediately before receiving any header data for the current request. */
static void do_complete(struct connectdata *conn) | {
conn->data->req.chunk = FALSE;
Curl_pgrsTime(conn->data, TIMER_PRETRANSFER);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* The user Entry Point for module VirtualKeyboard. The user code starts with this function. */ | EFI_STATUS EFIAPI InitializeVirtualKeyboard(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* The user Entry Point for module VirtualKeyboard. The user code starts with this function. */
EFI_STATUS EFIAPI InitializeVirtualKeyboard(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gVirtualKeyboardDriverBinding,
ImageHandle,
&gVirtualKeyboardComponentName,
&gVirtualKeyboardComponentName2
);
ASSERT_EFI_... | tianocore/edk2 | C++ | Other | 4,240 |
/* Selection of any of the above modes enables the EPI module, except for */ | void EPIModeSet(uint32_t ui32Base, uint32_t ui32Mode) | /* Selection of any of the above modes enables the EPI module, except for */
void EPIModeSet(uint32_t ui32Base, uint32_t ui32Mode) | {
ASSERT(ui32Base == EPI0_BASE);
ASSERT((ui32Mode == EPI_MODE_GENERAL) ||
(ui32Mode == EPI_MODE_SDRAM) ||
(ui32Mode == EPI_MODE_HB8) ||
(ui32Mode == EPI_MODE_HB16) ||
(ui32Mode == EPI_MODE_DISABLE));
HWREG(ui32Base + EPI_O_CFG) = ui32Mode;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Helper function to add payload data to extended advertising PDU. */ | static void common_pdu_adv_data_set(struct pdu_adv *pdu, const uint8_t *data, uint8_t len) | /* Helper function to add payload data to extended advertising PDU. */
static void common_pdu_adv_data_set(struct pdu_adv *pdu, const uint8_t *data, uint8_t len) | {
struct pdu_adv_com_ext_adv *com_hdr;
uint8_t len_max;
uint8_t *dptr;
com_hdr = &pdu->adv_ext_ind;
dptr = &com_hdr->ext_hdr_adv_data[com_hdr->ext_hdr_len];
len_max = PDU_AC_PAYLOAD_SIZE_MAX - (dptr - pdu->payload);
zassert_false(len > len_max,
"Provided data length exceeds maximum supported payload leng... | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Initialize a controller that was newly discovered or has lost power or otherwise been reset while it was suspended. In none of these cases can we be sure of its previous state. */ | static void check_and_reset_hc(struct uhci_hcd *uhci) | /* Initialize a controller that was newly discovered or has lost power or otherwise been reset while it was suspended. In none of these cases can we be sure of its previous state. */
static void check_and_reset_hc(struct uhci_hcd *uhci) | {
if (uhci_check_and_reset_hc(to_pci_dev(uhci_dev(uhci)), uhci->io_addr))
finish_reset(uhci);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base XBARA peripheral address. param input XBARA input signal. param output XBARA output signal. */ | void XBARA_SetSignalsConnection(XBARA_Type *base, xbar_input_signal_t input, xbar_output_signal_t output) | /* param base XBARA peripheral address. param input XBARA input signal. param output XBARA output signal. */
void XBARA_SetSignalsConnection(XBARA_Type *base, xbar_input_signal_t input, xbar_output_signal_t output) | {
XBARA_WR_SELx_SELx(base, (((uint16_t)input) & 0xFFU), (((uint16_t)output) & 0xFFU));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The following 3 functions constitute our interface to the world */ | DVDemuxContext* dv_init_demux(AVFormatContext *s) | /* The following 3 functions constitute our interface to the world */
DVDemuxContext* dv_init_demux(AVFormatContext *s) | {
DVDemuxContext *c;
c = av_mallocz(sizeof(DVDemuxContext));
if (!c)
return NULL;
c->vst = av_new_stream(s, 0);
if (!c->vst) {
av_free(c);
return NULL;
}
c->sys = NULL;
c->fctx = s;
memset(c->ast, 0, sizeof(c->ast));
c->ach = 0;
c->frames = 0;
... | DC-SWAT/DreamShell | C++ | null | 404 |
/* This file contains code for allocating/freeing inodes and for read/writing the superblock. */ | static int sysv_sync_fs(struct super_block *sb, int wait) | /* This file contains code for allocating/freeing inodes and for read/writing the superblock. */
static int sysv_sync_fs(struct super_block *sb, int wait) | {
struct sysv_sb_info *sbi = SYSV_SB(sb);
unsigned long time = get_seconds(), old_time;
lock_super(sb);
old_time = fs32_to_cpu(sbi, *sbi->s_sb_time);
if (sbi->s_type == FSTYPE_SYSV4) {
if (*sbi->s_sb_state == cpu_to_fs32(sbi, 0x7c269d38 - old_time))
*sbi->s_sb_state = cpu_to_fs32(sbi, 0x7c269d38 - time);
*s... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ixgbe_setup_phy_link_speed_generic - Sets the auto advertised capabilities @hw: pointer to hardware structure @speed: new link speed @autoneg: true if autonegotiation enabled */ | s32 ixgbe_setup_phy_link_speed_generic(struct ixgbe_hw *hw, ixgbe_link_speed speed, bool autoneg, bool autoneg_wait_to_complete) | /* ixgbe_setup_phy_link_speed_generic - Sets the auto advertised capabilities @hw: pointer to hardware structure @speed: new link speed @autoneg: true if autonegotiation enabled */
s32 ixgbe_setup_phy_link_speed_generic(struct ixgbe_hw *hw, ixgbe_link_speed speed, bool autoneg, bool autoneg_wait_to_complete) | {
hw->phy.autoneg_advertised = 0;
if (speed & IXGBE_LINK_SPEED_10GB_FULL)
hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL;
if (speed & IXGBE_LINK_SPEED_1GB_FULL)
hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL;
hw->phy.ops.setup_link(hw);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Retrieve corresponding bits in bitmap table according to given memory range. */ | UINT64 GetGuardedMemoryBits(IN EFI_PHYSICAL_ADDRESS Address, IN UINTN NumberOfPages) | /* Retrieve corresponding bits in bitmap table according to given memory range. */
UINT64 GetGuardedMemoryBits(IN EFI_PHYSICAL_ADDRESS Address, IN UINTN NumberOfPages) | {
UINT64 *BitMap;
UINTN Bits;
UINT64 Result;
UINTN Shift;
UINTN BitsToUnitEnd;
ASSERT (NumberOfPages <= GUARDED_HEAP_MAP_ENTRY_BITS);
Result = 0;
Shift = 0;
while (NumberOfPages > 0) {
BitsToUnitEnd = FindGuardedMemoryMap (Address, FALSE, &BitMap);
if (NumberOfPages > BitsToUnitEnd) {... | tianocore/edk2 | C++ | Other | 4,240 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ | UINT8 EFIAPI PciBitFieldRead8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit) | /* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT8 EFIAPI PciBitFieldRead8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit) | {
return mRunningOnQ35 ?
PciExpressBitFieldRead8 (Address, StartBit, EndBit) :
PciCf8BitFieldRead8 (Address, StartBit, EndBit);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Writes value at the given offset in the register array which stores the VLAN filter table. */ | static void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) | /* Writes value at the given offset in the register array which stores the VLAN filter table. */
static void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) | {
array_wr32(E1000_VFTA, offset, value);
wrfl();
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */ | int main(void) | /* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void) | {
SetupHardware();
CmdState = CMD_STOP;
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
Read_Joystick_Status();
DiscardNextReport();
USB_USBTask();
}
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Forces the tim output 1 waveform to active or inactive level. */ | void TIM_ForcedOC1Config(TIM_TypeDef *tim, TIMOCMODE_Typedef forced_action) | /* Forces the tim output 1 waveform to active or inactive level. */
void TIM_ForcedOC1Config(TIM_TypeDef *tim, TIMOCMODE_Typedef forced_action) | {
MODIFY_REG(tim->CCMR1, TIM_CCMR1_OC1M, forced_action);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* LOCKING: Kernel thread context (may sleep). sysfs_mutex is locked on return. */ | void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *parent_sd) | /* LOCKING: Kernel thread context (may sleep). sysfs_mutex is locked on return. */
void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *parent_sd) | {
memset(acxt, 0, sizeof(*acxt));
acxt->parent_sd = parent_sd;
mutex_lock(&sysfs_mutex);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* bitrev32 - reverse the order of bits in a u32 value @x: value to be bit-reversed */ | u32 bitrev32(u32 x) | /* bitrev32 - reverse the order of bits in a u32 value @x: value to be bit-reversed */
u32 bitrev32(u32 x) | {
return (bitrev16(x & 0xffff) << 16) | bitrev16(x >> 16);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Change Logs: Date Author Notes flyingcys first version */ | int main(void) | /* Change Logs: Date Author Notes flyingcys first version */
int main(void) | {
while(1)
{
rt_kprintf("Hello, RISC-V!\n");
rt_thread_delay(5000);
}
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Writes and the current LDTR descriptor specified by Ldtr. This function is only available on IA-32 and X64. */ | VOID EFIAPI AsmWriteLdtr(IN UINT16 Ldtr) | /* Writes and the current LDTR descriptor specified by Ldtr. This function is only available on IA-32 and X64. */
VOID EFIAPI AsmWriteLdtr(IN UINT16 Ldtr) | {
__asm__ __volatile__ (
"lldtw %0"
:
: "g" (Ldtr)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Function for loading when there is no service registered. */ | static __INLINE ret_code_t no_service_context_load(pstorage_handle_t const *p_block_handle, dm_handle_t const *p_handle) | /* Function for loading when there is no service registered. */
static __INLINE ret_code_t no_service_context_load(pstorage_handle_t const *p_block_handle, dm_handle_t const *p_handle) | {
DM_LOG("[DM]: --> no_service_context_load\r\n");
return NRF_SUCCESS;
} | labapart/polymcu | C++ | null | 201 |
/* The range must be contiguous but may span node boundaries. */ | int __init reserve_bootmem(unsigned long addr, unsigned long size, int flags) | /* The range must be contiguous but may span node boundaries. */
int __init reserve_bootmem(unsigned long addr, unsigned long size, int flags) | {
unsigned long start, end;
start = PFN_DOWN(addr);
end = PFN_UP(addr + size);
return mark_bootmem(start, end, 1, flags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Swap two code sections in a single IMAGE_PROPERTIES_RECORD. */ | EFI_STATUS EFIAPI SwapImageRecordCodeSection(IN IMAGE_PROPERTIES_RECORD_CODE_SECTION *FirstImageRecordCodeSection, IN IMAGE_PROPERTIES_RECORD_CODE_SECTION *SecondImageRecordCodeSection) | /* Swap two code sections in a single IMAGE_PROPERTIES_RECORD. */
EFI_STATUS EFIAPI SwapImageRecordCodeSection(IN IMAGE_PROPERTIES_RECORD_CODE_SECTION *FirstImageRecordCodeSection, IN IMAGE_PROPERTIES_RECORD_CODE_SECTION *SecondImageRecordCodeSection) | {
IMAGE_PROPERTIES_RECORD_CODE_SECTION TempImageRecordCodeSection;
if ((FirstImageRecordCodeSection == NULL) || (SecondImageRecordCodeSection == NULL)) {
return EFI_INVALID_PARAMETER;
}
TempImageRecordCodeSection.CodeSegmentBase = FirstImageRecordCodeSection->CodeSegmentBase;
TempImageRecordCodeSection.C... | tianocore/edk2 | C++ | Other | 4,240 |
/* Return codes: NULL - Error Pointer to lpfc_scsi_buf - Success */ | static struct lpfc_scsi_buf* lpfc_get_scsi_buf(struct lpfc_hba *phba) | /* Return codes: NULL - Error Pointer to lpfc_scsi_buf - Success */
static struct lpfc_scsi_buf* lpfc_get_scsi_buf(struct lpfc_hba *phba) | {
struct lpfc_scsi_buf * lpfc_cmd = NULL;
struct list_head *scsi_buf_list = &phba->lpfc_scsi_buf_list;
unsigned long iflag = 0;
spin_lock_irqsave(&phba->scsi_buf_list_lock, iflag);
list_remove_head(scsi_buf_list, lpfc_cmd, struct lpfc_scsi_buf, list);
if (lpfc_cmd) {
lpfc_cmd->seg_cnt = 0;
lpfc_cmd->nonsg_ph... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* See mss_uart.h for details of how to use this function. */ | void MSS_UART_set_linbreak_handler(mss_uart_instance_t *this_uart, mss_uart_irq_handler_t handler) | /* See mss_uart.h for details of how to use this function. */
void MSS_UART_set_linbreak_handler(mss_uart_instance_t *this_uart, mss_uart_irq_handler_t handler) | {
ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1));
ASSERT(handler != INVALID_IRQ_HANDLER);
if(((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) &&
(handler != INVALID_IRQ_HANDLER))
{
this_uart->break_handler = handler;
NVIC_ClearPendingIRQ( this_uart-... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ | UINT16 EFIAPI S3PciRead16(IN UINTN Address) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI S3PciRead16(IN UINTN Address) | {
return InternalSavePciWrite16ValueToBootScript (Address, PciRead16 (Address));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If any reserved bits in Address are set, then ASSERT(). */ | UINT8 EFIAPI S3PciSegmentAndThenOr8(IN UINT64 Address, IN UINT8 AndData, IN UINT8 OrData) | /* If any reserved bits in Address are set, then ASSERT(). */
UINT8 EFIAPI S3PciSegmentAndThenOr8(IN UINT64 Address, IN UINT8 AndData, IN UINT8 OrData) | {
return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentAndThenOr8 (Address, AndData, OrData));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Context: Any context. Caller must prevent concurrent changes to the PRCI_CORECLKSEL_OFFSET register. */ | static void __prci_coreclksel_use_hfclk(struct __prci_data *pd) | /* Context: Any context. Caller must prevent concurrent changes to the PRCI_CORECLKSEL_OFFSET register. */
static void __prci_coreclksel_use_hfclk(struct __prci_data *pd) | {
u32 r;
r = __prci_readl(pd, PRCI_CORECLKSEL_OFFSET);
r |= PRCI_CORECLKSEL_CORECLKSEL_MASK;
__prci_writel(r, PRCI_CORECLKSEL_OFFSET, pd);
r = __prci_readl(pd, PRCI_CORECLKSEL_OFFSET);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Enables packet timestamping and starts the system clock running. */ | void EMACTimestampEnable(uint32_t ui32Base) | /* Enables packet timestamping and starts the system clock running. */
void EMACTimestampEnable(uint32_t ui32Base) | {
ASSERT(ui32Base == EMAC0_BASE);
HWREG(ui32Base + EMAC_O_TIMSTCTRL) |= EMAC_TIMSTCTRL_TSEN;
if (!(HWREG(ui32Base + EMAC_O_TIMSTCTRL) & EMAC_TIMSTCTRL_TSINIT))
{
HWREG(ui32Base + EMAC_O_TIMSTCTRL) |= EMAC_TIMSTCTRL_TSINIT;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns the most recent received data by the CEC peripheral. */ | uint8_t CEC_ReceiveData(void) | /* Returns the most recent received data by the CEC peripheral. */
uint8_t CEC_ReceiveData(void) | {
return (uint8_t)(CEC->RXDR);
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Function that performs simulated EEPROM clearing.
Function fills the EEPROM with 0xFF value. It is accessing the EEPROM writing only one byte at once. */ | static void do_clear_eeprom(void) | /* Function that performs simulated EEPROM clearing.
Function fills the EEPROM with 0xFF value. It is accessing the EEPROM writing only one byte at once. */
static void do_clear_eeprom(void) | {
uint8_t clear_val = 0xff;
size_t addr;
for (addr=0; addr<(EEPROM_SIM_SIZE); ++addr)
{
ret_code_t err_code;
err_code = eeprom_write(addr, &clear_val, 1);
if (NRF_SUCCESS != err_code)
{
NRF_LOG_WARNING("Communication error\r\n");
return;
}
... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Init LEUART.
Notice that pins used by the LEUART module must be properly configured by the user explicitly, in order for the LEUART to work as intended. (When configuring pins, one should remember to consider the sequence of configuration, in order to avoid unintended pulses/glitches on output pins.) */ | void LEUART_Init(LEUART_TypeDef *leuart, LEUART_Init_TypeDef *init) | /* Init LEUART.
Notice that pins used by the LEUART module must be properly configured by the user explicitly, in order for the LEUART to work as intended. (When configuring pins, one should remember to consider the sequence of configuration, in order to avoid unintended pulses/glitches on output pins.) */
void LEUART... | {
EFM_ASSERT(LEUART_REF_VALID(leuart));
LEUART_Sync(leuart, LEUART_SYNCBUSY_CMD);
leuart->CMD = LEUART_CMD_RXDIS | LEUART_CMD_TXDIS;
LEUART_FreezeEnable(leuart, true);
leuart->CTRL = (leuart->CTRL & ~(_LEUART_CTRL_PARITY_MASK |
_LEUART_CTRL_STOPBITS_MASK)) |
... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* st33zp24_i2c_write Send byte to the TIS register according to the ST33ZP24 I2C protocol. */ | static int st33zp24_i2c_write(struct udevice *dev, u8 tpm_register, const u8 *tpm_data, size_t tpm_size) | /* st33zp24_i2c_write Send byte to the TIS register according to the ST33ZP24 I2C protocol. */
static int st33zp24_i2c_write(struct udevice *dev, u8 tpm_register, const u8 *tpm_data, size_t tpm_size) | {
return st33zp24_i2c_write8_reg(dev, tpm_register | TPM_WRITE_DIRECTION,
tpm_data, tpm_size);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* klist_add_head - Initialize a klist_node and add it to front. */ | void klist_add_head(struct klist_node *n, struct klist *k) | /* klist_add_head - Initialize a klist_node and add it to front. */
void klist_add_head(struct klist_node *n, struct klist *k) | {
klist_node_init(k, n);
add_head(k, n);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set or reset (if NULL) the default handler for generic errors to the builtin error function. */ | void initGenericErrorDefaultFunc(xmlGenericErrorFunc *handler) | /* Set or reset (if NULL) the default handler for generic errors to the builtin error function. */
void initGenericErrorDefaultFunc(xmlGenericErrorFunc *handler) | {
if (handler == NULL)
xmlGenericError = xmlGenericErrorDefaultFunc;
else
xmlGenericError = (*handler);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* NOTE: it overwrites the output file without warning if it exists! */ | unsigned decodeBMP(std::vector< unsigned char > &image, unsigned &w, unsigned &h, const std::vector< unsigned char > &bmp) | /* NOTE: it overwrites the output file without warning if it exists! */
unsigned decodeBMP(std::vector< unsigned char > &image, unsigned &w, unsigned &h, const std::vector< unsigned char > &bmp) | {
unsigned bmpos = pixeloffset + (h - y - 1) * scanlineBytes + numChannels * x;
unsigned newpos = 4 * y * w + 4 * x;
if(numChannels == 3) {
image[newpos + 0] = bmp[bmpos + 2];
image[newpos + 1] = bmp[bmpos + 1];
image[newpos + 2] = bmp[bmpos + 0];
image[newpos + 3] = 255;
} else ... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Returns true if any domain can open @filename for reading, false otherwise. */ | static bool tomoyo_is_globally_readable_file(const struct tomoyo_path_info *filename) | /* Returns true if any domain can open @filename for reading, false otherwise. */
static bool tomoyo_is_globally_readable_file(const struct tomoyo_path_info *filename) | {
struct tomoyo_globally_readable_file_entry *ptr;
bool found = false;
down_read(&tomoyo_globally_readable_list_lock);
list_for_each_entry(ptr, &tomoyo_globally_readable_list, list) {
if (!ptr->is_deleted &&
tomoyo_path_matches_pattern(filename, ptr->filename)) {
found = true;
break;
}
}
up_read(&... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* RTC MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc) | /* RTC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc) | {
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* We don't want to have recursive SIGSEGV's etc, for example, that is why we also clear SIGNAL_UNKILLABLE. */ | int force_sig_info(int sig, struct siginfo *info, struct task_struct *t) | /* We don't want to have recursive SIGSEGV's etc, for example, that is why we also clear SIGNAL_UNKILLABLE. */
int force_sig_info(int sig, struct siginfo *info, struct task_struct *t) | {
unsigned long int flags;
int ret, blocked, ignored;
struct k_sigaction *action;
spin_lock_irqsave(&t->sighand->siglock, flags);
action = &t->sighand->action[sig-1];
ignored = action->sa.sa_handler == SIG_IGN;
blocked = sigismember(&t->blocked, sig);
if (blocked || ignored) {
action->sa.sa_handler = SIG_DFL;... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does no... | EFI_STATUS EFIAPI VlanConfigComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName) | /* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does no... | {
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mVlanConfigDriverNameTable,
DriverName,
(BOOLEAN)(This == &gVlanConfigComponentName)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Usb hub control transfer to get the (super speed) hub descriptor. */ | EFI_STATUS UsbHubCtrlGetHubDesc(IN USB_DEVICE *HubDev, OUT VOID *Buf, IN UINTN Len) | /* Usb hub control transfer to get the (super speed) hub descriptor. */
EFI_STATUS UsbHubCtrlGetHubDesc(IN USB_DEVICE *HubDev, OUT VOID *Buf, IN UINTN Len) | {
EFI_STATUS Status;
UINT8 DescType;
DescType = (HubDev->Speed == EFI_USB_SPEED_SUPER) ?
USB_DESC_TYPE_HUB_SUPER_SPEED :
USB_DESC_TYPE_HUB;
Status = UsbCtrlRequest (
HubDev,
EfiUsbDataIn,
USB_REQ_TYPE_CLASS,
USB_HUB_TARGET_HUB,... | tianocore/edk2 | C++ | Other | 4,240 |
/* Weight of XL user offset bits of registers X_OFS_USR (73h), Y_OFS_USR (74h), Z_OFS_USR (75h).. */ | int32_t lsm6dso_xl_offset_weight_get(stmdev_ctx_t *ctx, lsm6dso_usr_off_w_t *val) | /* Weight of XL user offset bits of registers X_OFS_USR (73h), Y_OFS_USR (74h), Z_OFS_USR (75h).. */
int32_t lsm6dso_xl_offset_weight_get(stmdev_ctx_t *ctx, lsm6dso_usr_off_w_t *val) | {
lsm6dso_ctrl6_c_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL6_C, (uint8_t *)®, 1);
switch (reg.usr_off_w) {
case LSM6DSO_LSb_1mg:
*val = LSM6DSO_LSb_1mg;
break;
case LSM6DSO_LSb_16mg:
*val = LSM6DSO_LSb_16mg;
break;
default:
*val = LSM6DSO_LSb_1mg;
... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* We only have one input - the sensor - so minimize the nonsense here. */ | static int cafe_vidioc_enum_input(struct file *filp, void *priv, struct v4l2_input *input) | /* We only have one input - the sensor - so minimize the nonsense here. */
static int cafe_vidioc_enum_input(struct file *filp, void *priv, struct v4l2_input *input) | {
if (input->index != 0)
return -EINVAL;
input->type = V4L2_INPUT_TYPE_CAMERA;
input->std = V4L2_STD_ALL;
strcpy(input->name, "Camera");
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* @params conn_handle The connection handle for the current connection. */ | void ble_svc_ans_on_gap_connect(uint16_t conn_handle) | /* @params conn_handle The connection handle for the current connection. */
void ble_svc_ans_on_gap_connect(uint16_t conn_handle) | {
ble_svc_ans_conn_handle = conn_handle;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Four stage 4 varieties: do_request(), do_convert(), do_unlock(), do_cancel() These are called on the master node for the given lock and from the central locking logic. */ | static int do_request(struct dlm_rsb *r, struct dlm_lkb *lkb) | /* Four stage 4 varieties: do_request(), do_convert(), do_unlock(), do_cancel() These are called on the master node for the given lock and from the central locking logic. */
static int do_request(struct dlm_rsb *r, struct dlm_lkb *lkb) | {
int error = 0;
if (can_be_granted(r, lkb, 1, NULL)) {
grant_lock(r, lkb);
queue_cast(r, lkb, 0);
goto out;
}
if (can_be_queued(lkb)) {
error = -EINPROGRESS;
add_lkb(r, lkb, DLM_LKSTS_WAITING);
send_blocking_asts(r, lkb);
add_timeout(lkb);
goto out;
}
error = -EAGAIN;
if (force_blocking_asts(lkb... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* NOTE: there are two "pages" of event masks; the first page is for event codes between 0 and 63 and the second page is for event codes 64 and greater. */ | bool ble_ll_hci_is_event_enabled(unsigned int evcode) | /* NOTE: there are two "pages" of event masks; the first page is for event codes between 0 and 63 and the second page is for event codes 64 and greater. */
bool ble_ll_hci_is_event_enabled(unsigned int evcode) | {
if (evcode >= 64) {
return g_ble_ll_hci_event_mask2 & (1ull << (evcode - 64));
}
return g_ble_ll_hci_event_mask & (1ull << (evcode - 1));
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* @dai: Array of DAIs to unregister @count: Number of DAIs */ | void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count) | /* @dai: Array of DAIs to unregister @count: Number of DAIs */
void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count) | {
int i;
for (i = 0; i < count; i++)
snd_soc_unregister_dai(&dai[i]);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function is called with no lock held. It always return zero after adding the buffer to the postbufq buffer list. */ | int lpfc_sli_ringpostbuf_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, struct lpfc_dmabuf *mp) | /* This function is called with no lock held. It always return zero after adding the buffer to the postbufq buffer list. */
int lpfc_sli_ringpostbuf_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, struct lpfc_dmabuf *mp) | {
spin_lock_irq(&phba->hbalock);
list_add_tail(&mp->list, &pring->postbufq);
pring->postbufq_cnt++;
spin_unlock_irq(&phba->hbalock);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Request the PE to send a GET_SNK_CAPA message. */ | USBPD_StatusTypeDef USBPD_DPM_RequestGetSinkCapability(uint8_t PortNum) | /* Request the PE to send a GET_SNK_CAPA message. */
USBPD_StatusTypeDef USBPD_DPM_RequestGetSinkCapability(uint8_t PortNum) | {
return USBPD_PE_Request_CtrlMessage(PortNum, USBPD_CONTROLMSG_GET_SNK_CAP, USBPD_SOPTYPE_SOP);
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* Encodes input (uint32_t) into output (uint8_t). Assumes len is a multiple of 4. */ | static void ICACHE_FLASH_ATTR Encode(uint8_t *output, uint32_t *input, uint32_t len) | /* Encodes input (uint32_t) into output (uint8_t). Assumes len is a multiple of 4. */
static void ICACHE_FLASH_ATTR Encode(uint8_t *output, uint32_t *input, uint32_t len) | {
uint32_t i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
{
output[j] = (uint8_t)(input[i] & 0xff);
output[j+1] = (uint8_t)((input[i] >> 8) & 0xff);
output[j+2] = (uint8_t)((input[i] >> 16) & 0xff);
output[j+3] = (uint8_t)((input[i] >> 24) & 0xff);
}
} | eerimoq/simba | C++ | Other | 337 |
/* Return value: SCSI result value to return for completed command */ | static int ibmvfc_get_err_result(struct ibmvfc_cmd *vfc_cmd) | /* Return value: SCSI result value to return for completed command */
static int ibmvfc_get_err_result(struct ibmvfc_cmd *vfc_cmd) | {
int err;
struct ibmvfc_fcp_rsp *rsp = &vfc_cmd->rsp;
int fc_rsp_len = rsp->fcp_rsp_len;
if ((rsp->flags & FCP_RSP_LEN_VALID) &&
((fc_rsp_len && fc_rsp_len != 4 && fc_rsp_len != 8) ||
rsp->data.info.rsp_code))
return DID_ERROR << 16;
err = ibmvfc_get_err_index(vfc_cmd->status, vfc_cmd->error);
if (e... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the total page numbers of RWWEE flash. */ | uint32_t _rww_flash_get_total_pages(struct _flash_device *const device) | /* Get the total page numbers of RWWEE flash. */
uint32_t _rww_flash_get_total_pages(struct _flash_device *const device) | {
(void)device;
return (uint32_t)NVMCTRL_RWWEE_PAGES;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Function for calculating the tail area size in number of 32-bit words. */ | static void tail_word_size_calculate(pstorage_size_t cmd_end_of_storage_address, pstorage_size_t end_of_storage_address) | /* Function for calculating the tail area size in number of 32-bit words. */
static void tail_word_size_calculate(pstorage_size_t cmd_end_of_storage_address, pstorage_size_t end_of_storage_address) | {
const uint32_t end_of_storage_area_page = end_of_storage_address /
PSTORAGE_FLASH_PAGE_SIZE;
const uint32_t command_end_of_storage_area_page = cmd_end_of_storage_address /
PSTORAGE_FLASH_P... | labapart/polymcu | C++ | null | 201 |
/* Returns a value for the Processor ID field that conforms to SMBIOS requirements. */ | UINT64 SmbiosGetProcessorId(VOID) | /* Returns a value for the Processor ID field that conforms to SMBIOS requirements. */
UINT64 SmbiosGetProcessorId(VOID) | {
INT32 Jep106Code;
INT32 SocRevision;
UINT64 ProcessorId;
if (HasSmcArm64SocId ()) {
SmbiosGetSmcArm64SocId (&Jep106Code, &SocRevision);
ProcessorId = ((UINT64)SocRevision << 32) | Jep106Code;
} else {
ProcessorId = ArmReadMidr ();
}
return ProcessorId;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns: TRUE if the unix mount is for a system path. */ | gboolean g_unix_mount_is_system_internal(GUnixMountEntry *mount_entry) | /* Returns: TRUE if the unix mount is for a system path. */
gboolean g_unix_mount_is_system_internal(GUnixMountEntry *mount_entry) | {
g_return_val_if_fail (mount_entry != NULL, FALSE);
return mount_entry->is_system_internal;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* param handle i2c master handle. param deviceAddress codec device address. param subAddress register address. param subaddressSize register address width. param txBuff tx buffer pointer. param txBuffSize tx buffer size. return kStatus_HAL_I2cSuccess is success, else send failed. */ | status_t CODEC_I2C_Send(void *handle, uint8_t deviceAddress, uint32_t subAddress, uint8_t subaddressSize, uint8_t *txBuff, uint8_t txBuffSize) | /* param handle i2c master handle. param deviceAddress codec device address. param subAddress register address. param subaddressSize register address width. param txBuff tx buffer pointer. param txBuffSize tx buffer size. return kStatus_HAL_I2cSuccess is success, else send failed. */
status_t CODEC_I2C_Send(void *hand... | {
hal_i2c_master_transfer_t masterXfer;
masterXfer.slaveAddress = deviceAddress;
masterXfer.direction = kHAL_I2cWrite;
masterXfer.subaddress = (uint32_t)subAddress;
masterXfer.subaddressSize = subaddressSize;
masterXfer.data = txBuff;
masterXfer.dataSize = txBuffSi... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Handle TX transaction on non-ISO endpoint. The ep argument is a physical endpoint number for a non-ISO IN endpoint in the range 16 to 30. */ | static void dw_udc_epn_tx(int ep) | /* Handle TX transaction on non-ISO endpoint. The ep argument is a physical endpoint number for a non-ISO IN endpoint in the range 16 to 30. */
static void dw_udc_epn_tx(int ep) | {
struct usb_endpoint_instance *endpoint = dw_find_ep(ep);
if (!endpoint)
return;
if (endpoint->tx_urb &&
(endpoint->last == endpoint->tx_packetSize) &&
(endpoint->tx_urb->actual_length - endpoint->sent -
endpoint->last == 0)) {
writel(0x0, &inep_regs_p[ep].write_done);
}
if (endpoint->tx_urb &... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Return an allocated memory block back to a specific memory pool. */ | osStatus sysPoolFree(osPoolId pool_id, void *block) | /* Return an allocated memory block back to a specific memory pool. */
osStatus sysPoolFree(osPoolId pool_id, void *block) | {
return osErrorParameter;
}
res = rt_free_box(pool_id, block);
if (res != 0) {
return osErrorValue;
}
return osOK;
} | labapart/polymcu | C++ | null | 201 |
/* Try to start the next IO and wake up processes waiting on the tty. */ | static void raw3215_next_io(struct raw3215_info *raw) | /* Try to start the next IO and wake up processes waiting on the tty. */
static void raw3215_next_io(struct raw3215_info *raw) | {
struct tty_struct *tty;
raw3215_mk_write_req(raw);
raw3215_try_io(raw);
tty = raw->tty;
if (tty != NULL &&
RAW3215_BUFFER_SIZE - raw->count >= RAW3215_MIN_SPACE) {
tty_wakeup(tty);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns a per @host and @hl driver data structure that was previously stored by hpsb_create_hostinfo. */ | void* hpsb_get_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host) | /* Returns a per @host and @hl driver data structure that was previously stored by hpsb_create_hostinfo. */
void* hpsb_get_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host) | {
struct hl_host_info *hi = hl_get_hostinfo(hl, host);
return hi ? hi->data : NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* USART enable data inversion.
Logical data from the data register are send/received in negative/inverse logic. (1=L, 0=H). The parity bit is also inverted. */ | void usart_enable_data_inversion(uint32_t usart) | /* USART enable data inversion.
Logical data from the data register are send/received in negative/inverse logic. (1=L, 0=H). The parity bit is also inverted. */
void usart_enable_data_inversion(uint32_t usart) | {
USART_CR2(usart) |= USART_CR2_DATAINV;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Description: calculate number of SCLK cycles to meet minimum timing */ | static unsigned short num_clocks_min(unsigned long tmin, unsigned long fsclk) | /* Description: calculate number of SCLK cycles to meet minimum timing */
static unsigned short num_clocks_min(unsigned long tmin, unsigned long fsclk) | {
unsigned long tmp ;
unsigned short result;
tmp = tmin * (fsclk/1000/1000) / 1000;
result = (unsigned short)tmp;
if ((tmp*1000*1000) < (tmin*(fsclk/1000))) {
result++;
}
return result;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Set Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ | void USBD_SetStallEP(U32 EPNum) | /* Set Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_SetStallEP(U32 EPNum) | {
U32 *ptr;
ptr = GetEpCmdStatPtr(EPNum);
if (EPNum & 0x7F) {
if (*ptr & BUF_ACTIVE) {
*ptr &= ~(BUF_ACTIVE);
}
} else {
if (EPNum & 0x80) {
EPNum &= ~0x80;
LPC_USB->EPSKIP |= (1 << EP_IN_IDX(EPNum));
while (LPC_USB->EPSKIP & (1 << ... | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* release an AFS file or directory and discard its key */ | int afs_release(struct inode *inode, struct file *file) | /* release an AFS file or directory and discard its key */
int afs_release(struct inode *inode, struct file *file) | {
struct afs_vnode *vnode = AFS_FS_I(inode);
_enter("{%x:%u},", vnode->fid.vid, vnode->fid.vnode);
key_put(file->private_data);
_leave(" = 0");
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is a simple wrapper which executes a usermode-helper function with a pipe as stdin. It is implemented entirely in terms of lower-level call_usermodehelper_* functions. */ | int call_usermodehelper_pipe(char *path, char **argv, char **envp, struct file **filp) | /* This is a simple wrapper which executes a usermode-helper function with a pipe as stdin. It is implemented entirely in terms of lower-level call_usermodehelper_* functions. */
int call_usermodehelper_pipe(char *path, char **argv, char **envp, struct file **filp) | {
struct subprocess_info *sub_info;
int ret;
sub_info = call_usermodehelper_setup(path, argv, envp, GFP_KERNEL);
if (sub_info == NULL)
return -ENOMEM;
ret = call_usermodehelper_stdinpipe(sub_info, filp);
if (ret < 0) {
call_usermodehelper_freeinfo(sub_info);
return ret;
}
ret = call_usermodehelper_exec(su... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Event handler for the library USB Disconnection event. */ | void EVENT_USB_Device_Disconnect(void) | /* Event handler for the library USB Disconnection event. */
void EVENT_USB_Device_Disconnect(void) | {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
OpenLogFile();
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Move a nodw before an other node in the same linked list */ | void lv_ll_move_before(lv_ll_t *ll_p, void *n_act, void *n_after) | /* Move a nodw before an other node in the same linked list */
void lv_ll_move_before(lv_ll_t *ll_p, void *n_act, void *n_after) | {
if(n_act == n_after) return;
void * n_before;
if(n_after != NULL)
n_before = lv_ll_get_prev(ll_p, n_after);
else
n_before = lv_ll_get_tail(ll_p);
if(n_act == n_before) return;
lv_ll_rem(ll_p, n_act);
node_set_next(ll_p, n_before, n_act);
node_set_prev(ll_p, n_act, n_bef... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Tells you if there is an active central GAP procedure (connect or discover). */ | int ble_gap_master_in_progress(void) | /* Tells you if there is an active central GAP procedure (connect or discover). */
int ble_gap_master_in_progress(void) | {
return ble_gap_master.op != BLE_GAP_OP_NULL;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* This function is a callback that a driver registers to do cleanup when the UnloadImage boot service function is called. */ | EFI_STATUS EFIAPI _DriverUnloadHandler(EFI_HANDLE ImageHandle) | /* This function is a callback that a driver registers to do cleanup when the UnloadImage boot service function is called. */
EFI_STATUS EFIAPI _DriverUnloadHandler(EFI_HANDLE ImageHandle) | {
EFI_STATUS Status;
Status = ProcessModuleUnloadList (ImageHandle);
if (!EFI_ERROR (Status)) {
ProcessLibraryDestructorList (ImageHandle, gST);
}
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.