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
|
|---|---|---|---|---|---|---|---|
/* This function will provide the caller with the specified block device's media information. If the media changes, calling this function will update the media information accordingly. */
|
EFI_STATUS EFIAPI BotGetMediaInfo2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo)
|
/* This function will provide the caller with the specified block device's media information. If the media changes, calling this function will update the media information accordingly. */
EFI_STATUS EFIAPI BotGetMediaInfo2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo)
|
{
PEI_BOT_DEVICE *PeiBotDev;
EFI_STATUS Status;
PeiBotDev = PEI_BOT_DEVICE2_FROM_THIS (This);
Status = BotGetMediaInfo (
PeiServices,
&PeiBotDev->BlkIoPpi,
DeviceIndex,
&PeiBotDev->Media
);
if (EFI_ERROR (Status)) {
return Status;
}
CopyMem (
MediaInfo,
&(PeiBotDev->Media2),
sizeof (EFI_PEI_BLOCK_IO2_MEDIA)
);
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Tell an upper layer that it needs to initiate an abort for a given task. This should only ever be called by an LLDD. */
|
void sas_task_abort(struct sas_task *task)
|
/* Tell an upper layer that it needs to initiate an abort for a given task. This should only ever be called by an LLDD. */
void sas_task_abort(struct sas_task *task)
|
{
struct scsi_cmnd *sc = task->uldd_task;
if (!sc) {
if (!del_timer(&task->timer))
return;
task->timer.function(task->timer.data);
return;
}
if (dev_is_sata(task->dev)) {
sas_ata_task_abort(task);
return;
}
blk_abort_request(sc->request);
scsi_schedule_eh(sc->device->host);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Destroy a dynamically created remote heap. Deallocate only if the areas are not static */
|
void rh_destroy(rh_info_t *info)
|
/* Destroy a dynamically created remote heap. Deallocate only if the areas are not static */
void rh_destroy(rh_info_t *info)
|
{
if ((info->flags & RHIF_STATIC_BLOCK) == 0 && info->block != NULL)
kfree(info->block);
if ((info->flags & RHIF_STATIC_INFO) == 0)
kfree(info);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function works like g_object_set_qdata(), but in addition, a void (*destroy) (gpointer) function may be specified which is called with @data as argument when the @object is finalized, or the data is being overwritten by a call to g_object_set_qdata() with the same @quark. */
|
void g_object_set_qdata_full(GObject *object, GQuark quark, gpointer data, GDestroyNotify destroy)
|
/* This function works like g_object_set_qdata(), but in addition, a void (*destroy) (gpointer) function may be specified which is called with @data as argument when the @object is finalized, or the data is being overwritten by a call to g_object_set_qdata() with the same @quark. */
void g_object_set_qdata_full(GObject *object, GQuark quark, gpointer data, GDestroyNotify destroy)
|
{
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (quark > 0);
g_datalist_id_set_data_full (&object->qdata, quark, data,
data ? destroy : (GDestroyNotify) NULL);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Function for error handling, which is called when an error has occurred. */
|
void app_error_handler(ret_code_t error_code, uint32_t line_num, const uint8_t *p_file_name)
|
/* Function for error handling, which is called when an error has occurred. */
void app_error_handler(ret_code_t error_code, uint32_t line_num, const uint8_t *p_file_name)
|
{
error_info_t error_info =
{
.line_num = line_num,
.p_file_name = p_file_name,
.err_code = error_code,
};
app_error_fault_handler(NRF_FAULT_ID_SDK_ERROR, 0, (uint32_t)(&error_info));
UNUSED_VARIABLE(error_info);
}
|
labapart/polymcu
|
C++
| null | 201
|
/* xs_set_port - reset the port number in the remote endpoint address @xprt: generic transport @port: new port number */
|
static void xs_set_port(struct rpc_xprt *xprt, unsigned short port)
|
/* xs_set_port - reset the port number in the remote endpoint address @xprt: generic transport @port: new port number */
static void xs_set_port(struct rpc_xprt *xprt, unsigned short port)
|
{
dprintk("RPC: setting port for xprt %p to %u\n", xprt, port);
rpc_set_port(xs_addr(xprt), port);
xs_update_peer_port(xprt);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Propagate changes of the SGE coalescing parameters to the HW. */
|
int t1_sge_set_coalesce_params(struct sge *sge, struct sge_params *p)
|
/* Propagate changes of the SGE coalescing parameters to the HW. */
int t1_sge_set_coalesce_params(struct sge *sge, struct sge_params *p)
|
{
sge->fixed_intrtimer = p->rx_coalesce_usecs *
core_ticks_per_usec(sge->adapter);
writel(sge->fixed_intrtimer, sge->adapter->regs + A_SG_INTRTIMER);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* crw_unregister_handler() - unregister a channel report word handler @rsc: reporting source code to handle */
|
void crw_unregister_handler(int rsc)
|
/* crw_unregister_handler() - unregister a channel report word handler @rsc: reporting source code to handle */
void crw_unregister_handler(int rsc)
|
{
if ((rsc < 0) || (rsc >= NR_RSCS))
return;
mutex_lock(&crw_handler_mutex);
crw_handlers[rsc] = NULL;
mutex_unlock(&crw_handler_mutex);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Configures internally by software the NSS pin for the selected SPI. */
|
void SPI_NSSInternalSoftwareConfig(SPI_TypeDef *SPIx, uint16_t SPI_NSSInternalSoft)
|
/* Configures internally by software the NSS pin for the selected SPI. */
void SPI_NSSInternalSoftwareConfig(SPI_TypeDef *SPIx, uint16_t SPI_NSSInternalSoft)
|
{
assert_param(IS_SPI_ALL_PERIPH(SPIx));
assert_param(IS_SPI_NSS_INTERNAL(SPI_NSSInternalSoft));
if (SPI_NSSInternalSoft != SPI_NSSInternalSoft_Reset)
{
SPIx->CR1 |= SPI_NSSInternalSoft_Set;
}
else
{
SPIx->CR1 &= SPI_NSSInternalSoft_Reset;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Unpack an integer with 'size' bytes and 'islittle' endianness. If size is smaller than the size of a Lua integer and integer is signed, must do sign extension (propagating the sign to the higher bits); if size is larger than the size of a Lua integer, it must check the unread bytes to see whether they do not cause an overflow. */
|
static lua_Integer unpackint(lua_State *L, const char *str, int islittle, int size, int issigned)
|
/* Unpack an integer with 'size' bytes and 'islittle' endianness. If size is smaller than the size of a Lua integer and integer is signed, must do sign extension (propagating the sign to the higher bits); if size is larger than the size of a Lua integer, it must check the unread bytes to see whether they do not cause an overflow. */
static lua_Integer unpackint(lua_State *L, const char *str, int islittle, int size, int issigned)
|
{
lua_Unsigned res = 0;
int i;
int limit = (size <= SZINT) ? size : SZINT;
for (i = limit - 1; i >= 0; i--) {
res <<= NB;
res |= (lua_Unsigned)(unsigned char)str[islittle ? i : size - 1 - i];
}
if (size < SZINT) {
if (issigned) {
lua_Unsigned mask = (lua_Unsigned)1 << (size*NB - 1);
res = ((res ^ mask) - mask);
}
}
else if (size > SZINT) {
int mask = (!issigned || (lua_Integer)res >= 0) ? 0 : MC;
for (i = limit; i < size; i++) {
if ((unsigned char)str[islittle ? i : size - 1 - i] != mask)
luaL_error(L, "%d-byte integer does not fit into Lua Integer", size);
}
}
return (lua_Integer)res;
}
|
nodemcu/nodemcu-firmware
|
C++
|
MIT License
| 7,566
|
/* For emulating an ethernet device, every received IP header has to be prefixed with an ethernet header. Fake it with the given protocol. */
|
static void i2400m_rx_fake_eth_header(struct net_device *net_dev, void *_eth_hdr, __be16 protocol)
|
/* For emulating an ethernet device, every received IP header has to be prefixed with an ethernet header. Fake it with the given protocol. */
static void i2400m_rx_fake_eth_header(struct net_device *net_dev, void *_eth_hdr, __be16 protocol)
|
{
struct i2400m *i2400m = net_dev_to_i2400m(net_dev);
struct ethhdr *eth_hdr = _eth_hdr;
memcpy(eth_hdr->h_dest, net_dev->dev_addr, sizeof(eth_hdr->h_dest));
memcpy(eth_hdr->h_source, i2400m->src_mac_addr,
sizeof(eth_hdr->h_source));
eth_hdr->h_proto = protocol;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Description: Set the target node name to the ndlp node name wwn or zero. */
|
static void lpfc_get_starget_node_name(struct scsi_target *starget)
|
/* Description: Set the target node name to the ndlp node name wwn or zero. */
static void lpfc_get_starget_node_name(struct scsi_target *starget)
|
{
struct lpfc_nodelist *ndlp = lpfc_get_node_by_target(starget);
fc_starget_node_name(starget) =
ndlp ? wwn_to_u64(ndlp->nlp_nodename.u.wwn) : 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* then we just return, if multiple IRQs are pending then we will just take another exception, big deal. */
|
asmlinkage void plat_irq_dispatch(void)
|
/* then we just return, if multiple IRQs are pending then we will just take another exception, big deal. */
asmlinkage void plat_irq_dispatch(void)
|
{
unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
int irq;
irq = irq_ffs(pending);
if (irq == MIPSCPU_INT_I8259A)
malta_hw0_irqdispatch();
else if (gic_present && ((1 << irq) & ipi_map[smp_processor_id()]))
malta_ipi_irqdispatch();
else if (irq >= 0)
do_IRQ(MIPS_CPU_IRQ_BASE + irq);
else
spurious_interrupt();
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Note that this function will also release all memory- and port-based resources owned by the device (@dev->resource). This function must */
|
void platform_device_del(struct platform_device *pdev)
|
/* Note that this function will also release all memory- and port-based resources owned by the device (@dev->resource). This function must */
void platform_device_del(struct platform_device *pdev)
|
{
int i;
if (pdev) {
device_del(&pdev->dev);
for (i = 0; i < pdev->num_resources; i++) {
struct resource *r = &pdev->resource[i];
unsigned long type = resource_type(r);
if (type == IORESOURCE_MEM || type == IORESOURCE_IO)
release_resource(r);
}
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Computes the minimum bounding box of the given list of boxes and assign it to the given boxes set. It also assigns that list as the list of limiting boxes in the box set. */
|
void _cairo_boxes_limit(cairo_boxes_t *boxes, const cairo_box_t *limits, int num_limits)
|
/* Computes the minimum bounding box of the given list of boxes and assign it to the given boxes set. It also assigns that list as the list of limiting boxes in the box set. */
void _cairo_boxes_limit(cairo_boxes_t *boxes, const cairo_box_t *limits, int num_limits)
|
{
int n;
boxes->limits = limits;
boxes->num_limits = num_limits;
if (boxes->num_limits) {
boxes->limit = limits[0];
for (n = 1; n < num_limits; n++) {
if (limits[n].p1.x < boxes->limit.p1.x)
boxes->limit.p1.x = limits[n].p1.x;
if (limits[n].p1.y < boxes->limit.p1.y)
boxes->limit.p1.y = limits[n].p1.y;
if (limits[n].p2.x > boxes->limit.p2.x)
boxes->limit.p2.x = limits[n].p2.x;
if (limits[n].p2.y > boxes->limit.p2.y)
boxes->limit.p2.y = limits[n].p2.y;
}
}
}
|
xboot/xboot
|
C++
|
MIT License
| 779
|
/* LPUART DMA receive finished callback function.
This function is called when LPUART DMA receive finished. It disables the LPUART RX DMA request and sends kStatus_LPUART_RxIdle to LPUART callback. */
|
static void LPUART_TransferReceiveDMACallback(dma_handle_t *handle, void *param)
|
/* LPUART DMA receive finished callback function.
This function is called when LPUART DMA receive finished. It disables the LPUART RX DMA request and sends kStatus_LPUART_RxIdle to LPUART callback. */
static void LPUART_TransferReceiveDMACallback(dma_handle_t *handle, void *param)
|
{
lpuart_dma_private_handle_t *lpuartPrivateHandle = (lpuart_dma_private_handle_t *)param;
LPUART_EnableRxDMA(lpuartPrivateHandle->base, false);
DMA_DisableInterrupts(lpuartPrivateHandle->handle->rxDmaHandle->base,
lpuartPrivateHandle->handle->rxDmaHandle->channel);
lpuartPrivateHandle->handle->rxState = kLPUART_RxIdle;
if (lpuartPrivateHandle->handle->callback)
{
lpuartPrivateHandle->handle->callback(lpuartPrivateHandle->base, lpuartPrivateHandle->handle,
kStatus_LPUART_RxIdle, lpuartPrivateHandle->handle->userData);
}
}
|
labapart/polymcu
|
C++
| null | 201
|
/* The Interrupt Enables command can be used to read and/or change the current external interrupt enable settings. */
|
VOID UndiInterruptEnable(IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
|
/* The Interrupt Enables command can be used to read and/or change the current external interrupt enable settings. */
VOID UndiInterruptEnable(IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
|
{
EFI_STATUS Status;
Cdb->StatCode = PXE_STATCODE_UNSUPPORTED;
if (Nic->UsbEth->UsbEthUndi.UsbEthUndiInterruptEnable != NULL) {
Status = Nic->UsbEth->UsbEthUndi.UsbEthUndiInterruptEnable (Cdb, Nic);
if (EFI_ERROR (Status)) {
Cdb->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
} else {
Cdb->StatFlags = PXE_STATFLAGS_COMMAND_COMPLETE;
Cdb->StatCode = PXE_STATCODE_SUCCESS;
}
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Enables or disables the APB2 peripheral clock during Low Power (SLEEP) mode. */
|
void RCC_APB2PeriphClockLPModeCmd(uint32_t RCC_APB2Periph, FunctionalState NewState)
|
/* Enables or disables the APB2 peripheral clock during Low Power (SLEEP) mode. */
void RCC_APB2PeriphClockLPModeCmd(uint32_t RCC_APB2Periph, FunctionalState NewState)
|
{
assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
RCC->APB2LPENR |= RCC_APB2Periph;
}
else
{
RCC->APB2LPENR &= ~RCC_APB2Periph;
}
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* configure and clear own address.the controller can be configured to multiple own address */
|
void cec_own_address_config(uint32_t address)
|
/* configure and clear own address.the controller can be configured to multiple own address */
void cec_own_address_config(uint32_t address)
|
{
if(CEC_OWN_ADDRESS_CLEAR == address){
CEC_CFG &= ~CEC_CFG_OWN_ADDRESS;
} else {
CEC_CFG |= address;
}
}
|
liuxuming/trochili
|
C++
|
Apache License 2.0
| 132
|
/* Flush the mmu and reset associated register to default values. */
|
void __init init_mmu(void)
|
/* Flush the mmu and reset associated register to default values. */
void __init init_mmu(void)
|
{
set_itlbcfg_register(0);
set_dtlbcfg_register(0);
flush_tlb_all();
set_rasid_register(ASID_USER_FIRST);
set_ptevaddr_register(PGTABLE_START);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* return The PER clock frequency value in hertz. */
|
uint32_t CLOCK_GetPerClkFreq(void)
|
/* return The PER clock frequency value in hertz. */
uint32_t CLOCK_GetPerClkFreq(void)
|
{
uint32_t freq;
if ((CCM->CSCMR1 & CCM_CSCMR1_PERCLK_CLK_SEL_MASK) != 0UL)
{
freq = CLOCK_GetOscFreq();
}
else
{
freq = CLOCK_GetIpgFreq();
}
freq /= (((CCM->CSCMR1 & CCM_CSCMR1_PERCLK_PODF_MASK) >> CCM_CSCMR1_PERCLK_PODF_SHIFT) + 1U);
return freq;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* To work around the problem, we backup the current DABT handler address and replace it with our own DABT handler, which only bounces right back into the code. */
|
static void imx_pcie_fix_dabt_handler(bool set)
|
/* To work around the problem, we backup the current DABT handler address and replace it with our own DABT handler, which only bounces right back into the code. */
static void imx_pcie_fix_dabt_handler(bool set)
|
{
extern uint32_t *_data_abort;
uint32_t *data_abort_addr = (uint32_t *)&_data_abort;
static const uint32_t data_abort_bounce_handler = 0xe25ef004;
uint32_t data_abort_bounce_addr = (uint32_t)&data_abort_bounce_handler;
static uint32_t data_abort_backup;
if (set) {
data_abort_backup = *data_abort_addr;
*data_abort_addr = data_abort_bounce_addr;
} else {
*data_abort_addr = data_abort_backup;
}
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Make the prev segment point to the next segment. Change the last TRB in the prev segment to be a Link TRB which points to the address of the next segment. The caller needs to set any Link TRB related flags, such as End TRB, Toggle Cycle, and no snoop. */
|
static void xhci_link_segments(struct xhci_segment *prev, struct xhci_segment *next, bool link_trbs)
|
/* Make the prev segment point to the next segment. Change the last TRB in the prev segment to be a Link TRB which points to the address of the next segment. The caller needs to set any Link TRB related flags, such as End TRB, Toggle Cycle, and no snoop. */
static void xhci_link_segments(struct xhci_segment *prev, struct xhci_segment *next, bool link_trbs)
|
{
u32 val;
u64 val_64 = 0;
if (!prev || !next)
return;
prev->next = next;
if (link_trbs) {
val_64 = (uintptr_t)next->trbs;
prev->trbs[TRBS_PER_SEGMENT-1].link.segment_ptr = val_64;
val = le32_to_cpu(prev->trbs[TRBS_PER_SEGMENT-1].link.control);
val &= ~TRB_TYPE_BITMASK;
val |= (TRB_LINK << TRB_TYPE_SHIFT);
prev->trbs[TRBS_PER_SEGMENT-1].link.control = cpu_to_le32(val);
}
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* get bit mask of enabled cs return bit mask of enabled cs: 1 - only cs0 enabled, 3 - both cs0 and cs1 enabled */
|
u32 mv_ddr_sys_env_get_cs_ena_from_reg(void)
|
/* get bit mask of enabled cs return bit mask of enabled cs: 1 - only cs0 enabled, 3 - both cs0 and cs1 enabled */
u32 mv_ddr_sys_env_get_cs_ena_from_reg(void)
|
{
return reg_read(DDR3_RANK_CTRL_REG) &
((CS_EXIST_MASK << CS_EXIST_OFFS(0)) |
(CS_EXIST_MASK << CS_EXIST_OFFS(1)) |
(CS_EXIST_MASK << CS_EXIST_OFFS(2)) |
(CS_EXIST_MASK << CS_EXIST_OFFS(3)));
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Swap reorganised , Asynchronous swapping added . Stephen Tweedie Removed race in async swapping. . Bruno Haible Add swap of shared pages through the page cache. . Stephen Tweedie Always use brw_page, life becomes simpler. 12 May 1998 Eric Biederman */
|
static struct bio* get_swap_bio(gfp_t gfp_flags, struct page *page, bio_end_io_t end_io)
|
/* Swap reorganised , Asynchronous swapping added . Stephen Tweedie Removed race in async swapping. . Bruno Haible Add swap of shared pages through the page cache. . Stephen Tweedie Always use brw_page, life becomes simpler. 12 May 1998 Eric Biederman */
static struct bio* get_swap_bio(gfp_t gfp_flags, struct page *page, bio_end_io_t end_io)
|
{
struct bio *bio;
bio = bio_alloc(gfp_flags, 1);
if (bio) {
bio->bi_sector = map_swap_page(page, &bio->bi_bdev);
bio->bi_sector <<= PAGE_SHIFT - 9;
bio->bi_io_vec[0].bv_page = page;
bio->bi_io_vec[0].bv_len = PAGE_SIZE;
bio->bi_io_vec[0].bv_offset = 0;
bio->bi_vcnt = 1;
bio->bi_idx = 0;
bio->bi_size = PAGE_SIZE;
bio->bi_end_io = end_io;
}
return bio;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Routine to write bytes to the Modem Management Controller. We start at the end because it is the way it should be! */
|
static void mmc_write(unsigned long ioaddr, u8 o, u8 *b, int n)
|
/* Routine to write bytes to the Modem Management Controller. We start at the end because it is the way it should be! */
static void mmc_write(unsigned long ioaddr, u8 o, u8 *b, int n)
|
{
o += n;
b += n;
while (n-- > 0)
mmc_out(ioaddr, --o, *(--b));
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The WM8350 has a hardware lock which can be used to prevent writes to some registers (generally those which can cause particularly serious problems if misused). This function enables that lock. */
|
int wm8350_reg_lock(struct wm8350 *wm8350)
|
/* The WM8350 has a hardware lock which can be used to prevent writes to some registers (generally those which can cause particularly serious problems if misused). This function enables that lock. */
int wm8350_reg_lock(struct wm8350 *wm8350)
|
{
u16 key = WM8350_LOCK_KEY;
int ret;
ldbg(__func__);
mutex_lock(&io_mutex);
ret = wm8350_write(wm8350, WM8350_SECURITY, 1, &key);
if (ret)
dev_err(wm8350->dev, "lock failed\n");
mutex_unlock(&io_mutex);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enables or disables a system reset when the CM0 lockup happened. */
|
void MISC_LockResetCmd(uint32_t NewState)
|
/* Enables or disables a system reset when the CM0 lockup happened. */
void MISC_LockResetCmd(uint32_t NewState)
|
{
assert_parameters(IS_FUNCTIONAL_STATE(NewState));
if (NewState == ENABLE)
{
MISC1->IRQLAT |= MISC1_IRQLAT_LOCKRESET;
}
else
{
MISC1->IRQLAT &= ~MISC1_IRQLAT_LOCKRESET;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This API used to get the status of External Trigger selection in the register 0x12h bits from 4 to 5. */
|
BMG160_RETURN_FUNCTION_TYPE bmg160_get_pmu_ext_tri_select(u8 *v_pwu_ext_tri_select_u8)
|
/* This API used to get the status of External Trigger selection in the register 0x12h bits from 4 to 5. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_pmu_ext_tri_select(u8 *v_pwu_ext_tri_select_u8)
|
{
BMG160_RETURN_FUNCTION_TYPE comres = ERROR;
u8 v_data_u8 = BMG160_INIT_VALUE;
if (p_bmg160 == BMG160_NULL)
{
return E_BMG160_NULL_PTR;
}
else
{
comres = p_bmg160->BMG160_BUS_READ_FUNC(p_bmg160->dev_addr,
BMG160_MODE_LPM2_ADDR_EXT_TRI_SELECT__REG,
&v_data_u8, BMG160_GEN_READ_WRITE_DATA_LENGTH);
*v_pwu_ext_tri_select_u8 = BMG160_GET_BITSLICE(v_data_u8,
BMG160_MODE_LPM2_ADDR_EXT_TRI_SELECT);
}
return comres;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Clear the port interrupt and error status. It will also clear HBA interrupt status. */
|
VOID EFIAPI AhciClearPortStatus(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Port)
|
/* Clear the port interrupt and error status. It will also clear HBA interrupt status. */
VOID EFIAPI AhciClearPortStatus(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Port)
|
{
UINT32 Offset;
Offset = EFI_AHCI_PORT_START + Port * EFI_AHCI_PORT_REG_WIDTH + EFI_AHCI_PORT_SERR;
AhciWriteReg (PciIo, Offset, AhciReadReg (PciIo, Offset));
Offset = EFI_AHCI_PORT_START + Port * EFI_AHCI_PORT_REG_WIDTH + EFI_AHCI_PORT_IS;
AhciWriteReg (PciIo, Offset, AhciReadReg (PciIo, Offset));
AhciWriteReg (PciIo, EFI_AHCI_IS_OFFSET, AhciReadReg (PciIo, EFI_AHCI_IS_OFFSET));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Time period register for step detection on delta time (r/w).. */
|
int32_t lsm6dso_pedo_steps_period_set(lsm6dso_ctx_t *ctx, uint8_t *buff)
|
/* Time period register for step detection on delta time (r/w).. */
int32_t lsm6dso_pedo_steps_period_set(lsm6dso_ctx_t *ctx, uint8_t *buff)
|
{
int32_t ret;
uint8_t index;
index = 0x00U;
ret = lsm6dso_ln_pg_write_byte(ctx, LSM6DSO_PEDO_SC_DELTAT_L, &buff[index]);
if (ret == 0) {
index++;
ret = lsm6dso_ln_pg_write_byte(ctx, LSM6DSO_PEDO_SC_DELTAT_H,
&buff[index]);
}
return ret;
}
|
alexander-g-dean/ESF
|
C++
| null | 41
|
/* Receives a byte that has been sent to the I2C Master. */
|
unsigned long I2CDataGet(unsigned long ulBase)
|
/* Receives a byte that has been sent to the I2C Master. */
unsigned long I2CDataGet(unsigned long ulBase)
|
{
xASSERT((ulBase == I2C1_BASE) || (ulBase == I2C2_BASE));
return(xHWREG(ulBase + I2C_DR));
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Find the MNP Service Data for given VLAN ID. */
|
MNP_SERVICE_DATA* MnpFindServiceData(IN MNP_DEVICE_DATA *MnpDeviceData, IN UINT16 VlanId)
|
/* Find the MNP Service Data for given VLAN ID. */
MNP_SERVICE_DATA* MnpFindServiceData(IN MNP_DEVICE_DATA *MnpDeviceData, IN UINT16 VlanId)
|
{
LIST_ENTRY *Entry;
MNP_SERVICE_DATA *MnpServiceData;
NET_LIST_FOR_EACH (Entry, &MnpDeviceData->ServiceList) {
MnpServiceData = MNP_SERVICE_DATA_FROM_LINK (Entry);
if (MnpServiceData->VlanId == VlanId) {
return MnpServiceData;
}
}
return NULL;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Function for handling the RR interval timer timeout.
This function will be called each time the RR interval timer expires. */
|
static void rr_interval_timeout_handler(void *p_context)
|
/* Function for handling the RR interval timer timeout.
This function will be called each time the RR interval timer expires. */
static void rr_interval_timeout_handler(void *p_context)
|
{
UNUSED_PARAMETER(p_context);
if (m_rr_interval_enabled)
{
uint16_t rr_interval;
rr_interval = (uint16_t)sensorsim_measure(&m_rr_interval_sim_state,
&m_rr_interval_sim_cfg);
ble_hrs_rr_interval_add(&m_hrs, rr_interval);
}
}
|
labapart/polymcu
|
C++
| null | 201
|
/* This function returns the address of the current thread errno. */
|
int* _rt_errno(void)
|
/* This function returns the address of the current thread errno. */
int* _rt_errno(void)
|
{
rt_thread_t tid = RT_NULL;
if (rt_interrupt_get_nest() != 0)
{
return (int *)&__rt_errno;
}
tid = rt_thread_self();
if (tid != RT_NULL)
{
return (int *) & (tid->error);
}
return (int *)&__rt_errno;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns the most recent received data by the USARTx peripheral. */
|
uint16_t USART_ReceiveData(USART_TypeDef *USARTx)
|
/* Returns the most recent received data by the USARTx peripheral. */
uint16_t USART_ReceiveData(USART_TypeDef *USARTx)
|
{
assert_param(IS_USART_ALL_PERIPH(USARTx));
return (uint16_t)(USARTx->RDR & (uint16_t)0x01FF);
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* Handle the ICMP packet. First validate the message format, then according to the message types, process it as query or error packet. */
|
EFI_STATUS Ip4IcmpHandle(IN IP4_SERVICE *IpSb, IN IP4_HEAD *Head, IN NET_BUF *Packet)
|
/* Handle the ICMP packet. First validate the message format, then according to the message types, process it as query or error packet. */
EFI_STATUS Ip4IcmpHandle(IN IP4_SERVICE *IpSb, IN IP4_HEAD *Head, IN NET_BUF *Packet)
|
{
IP4_ICMP_HEAD Icmp;
UINT16 Checksum;
if (Packet->TotalSize < sizeof (Icmp)) {
goto DROP;
}
NetbufCopy (Packet, 0, sizeof (Icmp), (UINT8 *)&Icmp);
if (Icmp.Type > ICMP_TYPE_MAX) {
goto DROP;
}
Checksum = (UINT16)(~NetbufChecksum (Packet));
if ((Icmp.Checksum != 0) && (Checksum != 0)) {
goto DROP;
}
if (mIcmpClass[Icmp.Type].IcmpClass == ICMP_ERROR_MESSAGE) {
return Ip4ProcessIcmpError (IpSb, Head, Packet);
} else if (mIcmpClass[Icmp.Type].IcmpClass == ICMP_QUERY_MESSAGE) {
return Ip4ProcessIcmpQuery (IpSb, Head, Packet);
}
DROP:
NetbufFree (Packet);
return EFI_INVALID_PARAMETER;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* DPM callback used to know user choice about Data Role Swap. */
|
USBPD_StatusTypeDef USBPD_DPM_EvaluateDataRoleSwap(uint8_t PortNum)
|
/* DPM callback used to know user choice about Data Role Swap. */
USBPD_StatusTypeDef USBPD_DPM_EvaluateDataRoleSwap(uint8_t PortNum)
|
{
USBPD_StatusTypeDef status = USBPD_REJECT;
if (USBPD_TRUE == DPM_USER_Settings[PortNum].PE_DataSwap)
{
STUSB16xx_HW_IF_DataRoleSwap(PortNum);
status = USBPD_ACCEPT;
}
return status;
}
|
st-one/X-CUBE-USB-PD
|
C++
| null | 110
|
/* Initializes circular shift configurations struct to defaults.
Initailizes circular shift configuration struct to predefined safe default settings. */
|
void slcd_circular_shift_get_config_defaults(struct slcd_circular_shift_config *const config)
|
/* Initializes circular shift configurations struct to defaults.
Initailizes circular shift configuration struct to predefined safe default settings. */
void slcd_circular_shift_get_config_defaults(struct slcd_circular_shift_config *const config)
|
{
Assert(config);
config->fc = SLCD_FRAME_COUNTER_0;
config->dir = SLCD_CIRCULAR_SHIFT_LEFT;
config->size = 0;
config->data = 0;
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Set new x,y offsets in the virtual display for the visible area and switch to the new mode. */
|
static int omapfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *fbi)
|
/* Set new x,y offsets in the virtual display for the visible area and switch to the new mode. */
static int omapfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *fbi)
|
{
struct omapfb_plane_struct *plane = fbi->par;
struct omapfb_device *fbdev = plane->fbdev;
int r = 0;
omapfb_rqueue_lock(fbdev);
if (var->xoffset != fbi->var.xoffset ||
var->yoffset != fbi->var.yoffset) {
struct fb_var_screeninfo *new_var = &fbdev->new_var;
memcpy(new_var, &fbi->var, sizeof(*new_var));
new_var->xoffset = var->xoffset;
new_var->yoffset = var->yoffset;
if (set_fb_var(fbi, new_var))
r = -EINVAL;
else {
memcpy(&fbi->var, new_var, sizeof(*new_var));
ctrl_change_mode(fbi);
}
}
omapfb_rqueue_unlock(fbdev);
return r;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Increment the pin count of the given buffer. This value is protected by ipinlock spinlock in the mount structure. */
|
void xfs_ipin(xfs_inode_t *ip)
|
/* Increment the pin count of the given buffer. This value is protected by ipinlock spinlock in the mount structure. */
void xfs_ipin(xfs_inode_t *ip)
|
{
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
atomic_inc(&ip->i_pincount);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* fcoe_destroy_work() - Destroy a FCoE port in a deferred work context @work: Handle to the FCoE port to be destroyed */
|
static void fcoe_destroy_work(struct work_struct *)
|
/* fcoe_destroy_work() - Destroy a FCoE port in a deferred work context @work: Handle to the FCoE port to be destroyed */
static void fcoe_destroy_work(struct work_struct *)
|
{
struct fcoe_port *port;
port = container_of(work, struct fcoe_port, destroy_work);
mutex_lock(&fcoe_config_mutex);
fcoe_if_destroy(port->lport);
mutex_unlock(&fcoe_config_mutex);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Read the config space of a given PCI device (both normal and extended). */
|
STATIC RETURN_STATUS EFIAPI ProtoDevReadConfig(IN PCI_CAP_DEV *PciDevice, IN UINT16 SourceOffset, OUT VOID *DestinationBuffer, IN UINT16 Size)
|
/* Read the config space of a given PCI device (both normal and extended). */
STATIC RETURN_STATUS EFIAPI ProtoDevReadConfig(IN PCI_CAP_DEV *PciDevice, IN UINT16 SourceOffset, OUT VOID *DestinationBuffer, IN UINT16 Size)
|
{
PROTO_DEV *ProtoDev;
ProtoDev = PROTO_DEV_FROM_PCI_CAP_DEV (PciDevice);
return ProtoDevTransferConfig (
ProtoDev->PciIo,
ProtoDev->PciIo->Pci.Read,
SourceOffset,
DestinationBuffer,
Size
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Sets the interruption time for serial port timeout.
@method UART_SetITTimeout */
|
void UART_SetITTimeout(UART_TypeDef *UARTx, uint16_t timeout)
|
/* Sets the interruption time for serial port timeout.
@method UART_SetITTimeout */
void UART_SetITTimeout(UART_TypeDef *UARTx, uint16_t timeout)
|
{
_ASSERT(IS_UART(UARTx));
UARTx->TIMEOUT_INT.reg = timeout;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* returns the status as in the dmac_cmd_status field of the descriptor */
|
static enum gelic_descr_dma_status gelic_descr_get_status(struct gelic_descr *descr)
|
/* returns the status as in the dmac_cmd_status field of the descriptor */
static enum gelic_descr_dma_status gelic_descr_get_status(struct gelic_descr *descr)
|
{
return be32_to_cpu(descr->dmac_cmd_status) & GELIC_DESCR_DMA_STAT_MASK;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Function to close a EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL on top of a SHELL_FILE_HANDLE to support redirecting output from a file. */
|
EFI_STATUS CloseSimpleTextOutOnFile(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut)
|
/* Function to close a EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL on top of a SHELL_FILE_HANDLE to support redirecting output from a file. */
EFI_STATUS CloseSimpleTextOutOnFile(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut)
|
{
EFI_STATUS Status;
if (SimpleTextOut == NULL) {
return (EFI_INVALID_PARAMETER);
}
Status = gBS->UninstallProtocolInterface (
((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)SimpleTextOut)->TheHandle,
&gEfiSimpleTextOutProtocolGuid,
&(((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)SimpleTextOut)->SimpleTextOut)
);
FreePool (SimpleTextOut->Mode);
FreePool (SimpleTextOut);
return (Status);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Initialization function for the Q31 Biquad cascade 32x64 filter. */
|
void arm_biquad_cas_df1_32x64_init_q31(arm_biquad_cas_df1_32x64_ins_q31 *S, uint8_t numStages, const q31_t *pCoeffs, q63_t *pState, uint8_t postShift)
|
/* Initialization function for the Q31 Biquad cascade 32x64 filter. */
void arm_biquad_cas_df1_32x64_init_q31(arm_biquad_cas_df1_32x64_ins_q31 *S, uint8_t numStages, const q31_t *pCoeffs, q63_t *pState, uint8_t postShift)
|
{
S->numStages = numStages;
S->postShift = postShift;
S->pCoeffs = pCoeffs;
memset(pState, 0, (4U * (uint32_t) numStages) * sizeof(q63_t));
S->pState = pState;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Sets the type of display used with the LCD controller. */
|
void LCD_SetDisplayType(unsigned int displayType)
|
/* Sets the type of display used with the LCD controller. */
void LCD_SetDisplayType(unsigned int displayType)
|
{
unsigned int value;
ASSERT((displayType & ~AT91C_LCDC_DISTYPE) == 0,
"LCD_SetDisplayType: Wrong display type value.\n\r");
value = AT91C_BASE_LCDC->LCDC_LCDCON2;
value &= ~AT91C_LCDC_DISTYPE;
value |= displayType;
AT91C_BASE_LCDC->LCDC_LCDCON2 = value;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* ibmvfc_init_event - Initialize fields in an event struct that are always required. @evt: The event @done: Routine to call when the event is responded to @format: SRP or MAD format */
|
static void ibmvfc_init_event(struct ibmvfc_event *evt, void(*done)(struct ibmvfc_event *), u8 format)
|
/* ibmvfc_init_event - Initialize fields in an event struct that are always required. @evt: The event @done: Routine to call when the event is responded to @format: SRP or MAD format */
static void ibmvfc_init_event(struct ibmvfc_event *evt, void(*done)(struct ibmvfc_event *), u8 format)
|
{
evt->cmnd = NULL;
evt->sync_iu = NULL;
evt->crq.format = format;
evt->done = done;
evt->eh_comp = NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Given <page, offset> pair, provide a derefrencable pointer. This is called from xv_malloc/xv_free path, so it needs to be fast. */
|
static void* get_ptr_atomic(struct page *page, u16 offset, enum km_type type)
|
/* Given <page, offset> pair, provide a derefrencable pointer. This is called from xv_malloc/xv_free path, so it needs to be fast. */
static void* get_ptr_atomic(struct page *page, u16 offset, enum km_type type)
|
{
unsigned char *base;
base = kmap_atomic(page, type);
return base + offset;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function handles USB-On-The-Go FS global interrupt request. */
|
void OTG_FS_IRQHandler(void)
|
/* This function handles USB-On-The-Go FS global interrupt request. */
void OTG_FS_IRQHandler(void)
|
{
HAL_PCD_IRQHandler(&hpcd);
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Configures the TIMx Output Compare 4 Fast feature. */
|
void TIM_OC4FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
|
/* Configures the TIMx Output Compare 4 Fast feature. */
void TIM_OC4FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
|
{
uint16_t tmpccmr2 = 0;
assert_param(IS_TIM_LIST3_PERIPH(TIMx));
assert_param(IS_TIM_OCFAST_STATE(TIM_OCFast));
tmpccmr2 = TIMx->CCMR2;
tmpccmr2 &= (uint16_t)~((uint16_t)TIM_CCMR2_OC4FE);
tmpccmr2 |= (uint16_t)(TIM_OCFast << 8);
TIMx->CCMR2 = tmpccmr2;
}
|
gcallipo/RadioDSP-Stm32f103
|
C++
|
Common Creative - Attribution 3.0
| 51
|
/* Function to allocate the block identified by block number 'block_index'. */
|
static void block_allocate(uint32_t block_index)
|
/* Function to allocate the block identified by block number 'block_index'. */
static void block_allocate(uint32_t block_index)
|
{
uint32_t x;
uint32_t y;
get_block_coordinates(block_index, &x, &y);
CLR_BIT(m_mem_pool[x], y);
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Returns: The length of the extent (minimum of one block) */
|
static unsigned int gfs2_extent_length(void *start, unsigned int len, __be64 *ptr, unsigned limit, int *eob)
|
/* Returns: The length of the extent (minimum of one block) */
static unsigned int gfs2_extent_length(void *start, unsigned int len, __be64 *ptr, unsigned limit, int *eob)
|
{
const __be64 *end = (start + len);
const __be64 *first = ptr;
u64 d = be64_to_cpu(*ptr);
*eob = 0;
do {
ptr++;
if (ptr >= end)
break;
if (limit && --limit == 0)
break;
if (d)
d++;
} while(be64_to_cpu(*ptr) == d);
if (ptr >= end)
*eob = 1;
return (ptr - first);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Setup an Address Translation Entry as specified. Use either the Bridge internal maps or the external map RAM, as appropriate. */
|
static u64 __iomem* pcibr_ate_addr(struct pcibus_info *pcibus_info, int ate_index)
|
/* Setup an Address Translation Entry as specified. Use either the Bridge internal maps or the external map RAM, as appropriate. */
static u64 __iomem* pcibr_ate_addr(struct pcibus_info *pcibus_info, int ate_index)
|
{
if (ate_index < pcibus_info->pbi_int_ate_size) {
return pcireg_int_ate_addr(pcibus_info, ate_index);
}
panic("pcibr_ate_addr: invalid ate_index 0x%x", ate_index);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Callback used to free an instance of airpcap_if_info_t */
|
static void free_airpcap_if_cb(gpointer data, gpointer user_data _U_)
|
/* Callback used to free an instance of airpcap_if_info_t */
static void free_airpcap_if_cb(gpointer data, gpointer user_data _U_)
|
{
airpcap_if_info_t *if_info = (airpcap_if_info_t *)data;
if (NULL == if_info)
return;
if (if_info->name != NULL)
g_free(if_info->name);
if (if_info->description != NULL)
g_free(if_info->description);
if (if_info->keysCollection != NULL)
{
g_free(if_info->keysCollection);
if_info->keysCollection = NULL;
}
if (if_info->ip_addr != NULL)
g_slist_free(if_info->ip_addr);
g_free(if_info);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Returns the length of the internal raw NULL terminated string of the current instance of #CRString. */
|
gint cr_string_peek_raw_str_len(CRString *a_this)
|
/* Returns the length of the internal raw NULL terminated string of the current instance of #CRString. */
gint cr_string_peek_raw_str_len(CRString *a_this)
|
{
g_return_val_if_fail (a_this && a_this->stryng,
-1) ;
return a_this->stryng->len ;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* get the cycle number for group2 as soon as a charge-transfer sequence completes */
|
uint16_t tsi_group2_cycle_get(void)
|
/* get the cycle number for group2 as soon as a charge-transfer sequence completes */
uint16_t tsi_group2_cycle_get(void)
|
{
return (uint16_t)TSI_G2CYCN;
}
|
liuxuming/trochili
|
C++
|
Apache License 2.0
| 132
|
/* Unregisters an asynchronous callback function with the driver.
Unregisters an asynchronous callback with the DAC driver, removing it from the internal callback registration table. */
|
enum status_code dac_unregister_callback(struct dac_module *const module_inst, const enum dac_channel channel, const enum dac_callback type)
|
/* Unregisters an asynchronous callback function with the driver.
Unregisters an asynchronous callback with the DAC driver, removing it from the internal callback registration table. */
enum status_code dac_unregister_callback(struct dac_module *const module_inst, const enum dac_channel channel, const enum dac_callback type)
|
{
Assert(module_inst);
UNUSED(channel);
if (module_inst->start_on_event == false) {
return STATUS_ERR_UNSUPPORTED_DEV;
}
if ((uint8_t)type < DAC_CALLBACK_N) {
module_inst->callback[(uint8_t)type] = NULL;
return STATUS_OK;
}
return STATUS_ERR_INVALID_ARG;
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Invalidate, but do not unhash, the inode. NB: must be called with inode->i_lock held! */
|
static void nfs_invalidate_inode(struct inode *)
|
/* Invalidate, but do not unhash, the inode. NB: must be called with inode->i_lock held! */
static void nfs_invalidate_inode(struct inode *)
|
{
set_bit(NFS_INO_STALE, &NFS_I(inode)->flags);
nfs_zap_caches_locked(inode);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Receive a piece of data for SPI master.
This function computes the number of data to receive from D register or Rx FIFO, and write the data to destination address. At the same time, this function updates the values in master handle structure. */
|
static void FLEXIO_SPI_TransferReceiveTransaction(FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle)
|
/* Receive a piece of data for SPI master.
This function computes the number of data to receive from D register or Rx FIFO, and write the data to destination address. At the same time, this function updates the values in master handle structure. */
static void FLEXIO_SPI_TransferReceiveTransaction(FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle)
|
{
uint16_t tmpData;
tmpData = FLEXIO_SPI_ReadData(base, handle->direction);
if (handle->rxData != NULL)
{
if (handle->bytePerFrame == 1U)
{
*handle->rxData = tmpData;
handle->rxData++;
}
else
{
if (handle->direction == kFLEXIO_SPI_MsbFirst)
{
*((uint16_t *)(handle->rxData)) = tmpData;
}
else
{
*((uint16_t *)(handle->rxData)) = (((tmpData << 8) & 0xff00U) | ((tmpData >> 8) & 0x00ffU));
}
handle->rxData += 2U;
}
}
handle->rxRemainingBytes -= handle->bytePerFrame;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Configures the routing interface to select which Timer to be routed. */
|
void SYSCFG_RITIMSelect(uint32_t TIM_Select)
|
/* Configures the routing interface to select which Timer to be routed. */
void SYSCFG_RITIMSelect(uint32_t TIM_Select)
|
{
uint32_t tmpreg = 0;
assert_param(IS_RI_TIM(TIM_Select));
tmpreg = RI->ICR;
tmpreg &= TIM_SELECT_MASK;
tmpreg |= (TIM_Select);
RI->ICR = tmpreg;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* "show" function for the bond_masters attribute. The class parameter is ignored. */
|
static ssize_t bonding_show_bonds(struct class *cls, char *buf)
|
/* "show" function for the bond_masters attribute. The class parameter is ignored. */
static ssize_t bonding_show_bonds(struct class *cls, char *buf)
|
{
struct net *net = current->nsproxy->net_ns;
struct bond_net *bn = net_generic(net, bond_net_id);
int res = 0;
struct bonding *bond;
rtnl_lock();
list_for_each_entry(bond, &bn->dev_list, bond_list) {
if (res > (PAGE_SIZE - IFNAMSIZ)) {
if ((PAGE_SIZE - res) > 10)
res = PAGE_SIZE - 10;
res += sprintf(buf + res, "++more++ ");
break;
}
res += sprintf(buf + res, "%s ", bond->dev->name);
}
if (res)
buf[res-1] = '\n';
rtnl_unlock();
return res;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Allocate a request for an endpoint. Reused by ep0 code. */
|
struct usb_request* musb_alloc_request(struct usb_ep *ep, gfp_t gfp_flags)
|
/* Allocate a request for an endpoint. Reused by ep0 code. */
struct usb_request* musb_alloc_request(struct usb_ep *ep, gfp_t gfp_flags)
|
{
struct musb_ep *musb_ep = to_musb_ep(ep);
struct musb_request *request = NULL;
request = kzalloc(sizeof *request, gfp_flags);
if (request) {
INIT_LIST_HEAD(&request->request.list);
request->request.dma = DMA_ADDR_INVALID;
request->epnum = musb_ep->current_epnum;
request->ep = musb_ep;
}
return &request->request;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* We can't use the standard memcpy due to the broken SlowPort address translation on rev A0 and A1 silicon and the fact that we have banked flash. */
|
static void ixp2000_flash_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
|
/* We can't use the standard memcpy due to the broken SlowPort address translation on rev A0 and A1 silicon and the fact that we have banked flash. */
static void ixp2000_flash_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
|
{
from = flash_bank_setup(map, from);
while(len--)
*(__u8 *) to++ = *(__u8 *)(map->map_priv_1 + from++);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Gets the interrupt status for a PWM module. */
|
uint32_t PWMIntStatus(uint32_t ui32Base, bool bMasked)
|
/* Gets the interrupt status for a PWM module. */
uint32_t PWMIntStatus(uint32_t ui32Base, bool bMasked)
|
{
ASSERT(ui32Base == PWM0_BASE);
if (bMasked == true)
{
return (HWREG(ui32Base + PWM_O_ISC));
}
else
{
return (HWREG(ui32Base + PWM_O_RIS));
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* STUSB1602 checks the VBUS_RANGE_DISABLE State (EN or DIS) (bit4 0x2E */
|
VBUS_Range_State_TypeDef STUSB1602_VBUS_Range_State_Get(uint8_t Addr)
|
/* STUSB1602 checks the VBUS_RANGE_DISABLE State (EN or DIS) (bit4 0x2E */
VBUS_Range_State_TypeDef STUSB1602_VBUS_Range_State_Get(uint8_t Addr)
|
{
STUSB1602_VBUS_MONITORING_CTRL_RegTypeDef reg;
STUSB1602_ReadReg(®.d8, Addr, STUSB1602_VBUS_MONITORING_CTRL_REG, 1);
return (VBUS_Range_State_TypeDef)(reg.b.VBUS_RANGE_DISABLE);
}
|
st-one/X-CUBE-USB-PD
|
C++
| null | 110
|
/* Free hardware specific device data This will be called by "gigaset_freecs" in common.c */
|
static void gigaset_freecshw(struct cardstate *cs)
|
/* Free hardware specific device data This will be called by "gigaset_freecs" in common.c */
static void gigaset_freecshw(struct cardstate *cs)
|
{
tasklet_kill(&cs->write_tasklet);
if (!cs->hw.ser)
return;
dev_set_drvdata(&cs->hw.ser->dev.dev, NULL);
platform_device_unregister(&cs->hw.ser->dev);
kfree(cs->hw.ser);
cs->hw.ser = NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Forces the TIMx output 1 waveform to active or inactive level. */
|
void TIM_ForcedOC1Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
|
/* Forces the TIMx output 1 waveform to active or inactive level. */
void TIM_ForcedOC1Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
|
{
uint16_t tmpccmr1 = 0;
assert_param(IS_TIM_LIST8_PERIPH(TIMx));
assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction));
tmpccmr1 = TIMx->CCMR1;
tmpccmr1 &= (uint16_t)~((uint16_t)TIM_CCMR1_OC1M);
tmpccmr1 |= TIM_ForcedAction;
TIMx->CCMR1 = tmpccmr1;
}
|
avem-labs/Avem
|
C++
|
MIT License
| 1,752
|
/* Set the clipping rectangle for a blittable surface */
|
SDL_bool SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect)
|
/* Set the clipping rectangle for a blittable surface */
SDL_bool SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect)
|
{
SDL_Rect full_rect;
if ( ! surface ) {
return SDL_FALSE;
}
full_rect.x = 0;
full_rect.y = 0;
full_rect.w = surface->w;
full_rect.h = surface->h;
if ( ! rect ) {
surface->clip_rect = full_rect;
return 1;
}
return SDL_IntersectRect(rect, &full_rect, &surface->clip_rect);
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* This function disables the stacking of floating-point registers s0-s15 when an interrupt is handled. When floating-point context stacking is disabled, floating-point operations performed in an interrupt handler destroy the floating-point context of the main thread of execution. */
|
void FPUStackingDisable(void)
|
/* This function disables the stacking of floating-point registers s0-s15 when an interrupt is handled. When floating-point context stacking is disabled, floating-point operations performed in an interrupt handler destroy the floating-point context of the main thread of execution. */
void FPUStackingDisable(void)
|
{
HWREG(NVIC_FPCC) &= ~(NVIC_FPCC_ASPEN | NVIC_FPCC_LSPEN);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* fills out function pointers in the net_device structure */
|
static void __devinit gelic_ether_setup_netdev_ops(struct net_device *netdev, struct napi_struct *napi)
|
/* fills out function pointers in the net_device structure */
static void __devinit gelic_ether_setup_netdev_ops(struct net_device *netdev, struct napi_struct *napi)
|
{
netdev->watchdog_timeo = GELIC_NET_WATCHDOG_TIMEOUT;
netif_napi_add(netdev, napi,
gelic_net_poll, GELIC_NET_NAPI_WEIGHT);
netdev->ethtool_ops = &gelic_ether_ethtool_ops;
netdev->netdev_ops = &gelic_netdevice_ops;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* nobh_write_begin()'s prereads are special: the buffer_heads are freed immediately, while under the page lock. So it needs a special end_io handler which does not touch the bh after unlocking it. */
|
static void end_buffer_read_nobh(struct buffer_head *bh, int uptodate)
|
/* nobh_write_begin()'s prereads are special: the buffer_heads are freed immediately, while under the page lock. So it needs a special end_io handler which does not touch the bh after unlocking it. */
static void end_buffer_read_nobh(struct buffer_head *bh, int uptodate)
|
{
__end_buffer_read_notouch(bh, uptodate);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If the contents of BufferA are identical to the contents of BufferB, then TRUE is returned. If the contents of BufferA are not identical to the contents of BufferB, then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, DescriptionA, and DescriptionB are recorded and FALSE is returned. */
|
BOOLEAN EFIAPI UnitTestAssertMemEqual(IN VOID *BufferA, IN VOID *BufferB, IN UINTN Length, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *DescriptionA, IN CONST CHAR8 *DescriptionB)
|
/* If the contents of BufferA are identical to the contents of BufferB, then TRUE is returned. If the contents of BufferA are not identical to the contents of BufferB, then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, DescriptionA, and DescriptionB are recorded and FALSE is returned. */
BOOLEAN EFIAPI UnitTestAssertMemEqual(IN VOID *BufferA, IN VOID *BufferB, IN UINTN Length, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *DescriptionA, IN CONST CHAR8 *DescriptionB)
|
{
CHAR8 TempStr[MAX_STRING_SIZE];
BOOLEAN Result;
Result = (CompareMem (BufferA, BufferB, Length) == 0);
snprintf (TempStr, sizeof (TempStr), "UT_ASSERT_MEM_EQUAL(%s:%p, %s:%p)", DescriptionA, BufferA, DescriptionB, BufferB);
_assert_true (Result, TempStr, FileName, (INT32)LineNumber);
return Result;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* determine_cpu_data() - Determine CPU information from hardware @dev: CPU device from which to read information */
|
static void determine_cpu_data(struct udevice *dev)
|
/* determine_cpu_data() - Determine CPU information from hardware @dev: CPU device from which to read information */
static void determine_cpu_data(struct udevice *dev)
|
{
struct mpc83xx_cpu_priv *priv = dev_get_priv(dev);
const u32 E_FLAG_MASK = 0x00010000;
u32 spridr = get_spridr();
determine_family(dev);
determine_type(dev);
determine_e300_type(dev);
determine_revid(dev);
if ((priv->family == FAMILY_834X ||
priv->family == FAMILY_836X) && priv->revid.major >= 2)
priv->is_a_variant = true;
priv->is_e_processor = !bitfield_extract_by_mask(spridr, E_FLAG_MASK);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Change Logs: Date Author Notes ArdaFu first version */
|
void Hw_UartDisable(HW_USART_TypeDef *uartBase)
|
/* Change Logs: Date Author Notes ArdaFu first version */
void Hw_UartDisable(HW_USART_TypeDef *uartBase)
|
{
uartBase->INTR[R_CLR] = ASM_UART_INTR_RXIEN | ASM_UART_INTR_TXIEN | ASM_UART_INTR_RTIS;
uartBase->CTRL2[R_CLR] = ASM_UART_CTRL2_TXE | ASM_UART_CTRL2_RXE;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function will ASSERT if the APIC timer intial count returned from */
|
VOID EFIAPI InternalX86Delay(IN UINTN ApicBase, IN UINT32 Delay)
|
/* This function will ASSERT if the APIC timer intial count returned from */
VOID EFIAPI InternalX86Delay(IN UINTN ApicBase, IN UINT32 Delay)
|
{
INT32 Ticks;
UINT32 Times;
UINT32 InitCount;
UINT32 StartTick;
InitCount = InternalX86GetInitTimerCount (ApicBase);
ASSERT (InitCount != 0);
Times = Delay / (InitCount / 2);
Delay = Delay % (InitCount / 2);
StartTick = InternalX86GetTimerTick (ApicBase);
do {
do {
CpuPause ();
Ticks = StartTick - InternalX86GetTimerTick (ApicBase);
if (Ticks < 0) {
Ticks += InitCount;
}
} while ((UINT32)Ticks < Delay);
StartTick -= (StartTick > Delay) ? Delay : (Delay - InitCount);
Delay = InitCount / 2;
} while (Times-- > 0);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Common Timer2 interrupt handler.
This function handles Timer2 counter overflow interrupt request */
|
void TIMER2_IRQHandler(void)
|
/* Common Timer2 interrupt handler.
This function handles Timer2 counter overflow interrupt request */
void TIMER2_IRQHandler(void)
|
{
if (TIMER2->IF & TIMER_IF_OF)
{
if (timerCbTable[2].cbFunc != RT_NULL)
{
(timerCbTable[2].cbFunc)(timerCbTable[2].userPtr);
}
BITBAND_Peripheral(&(TIMER2->IFC), _TIMER_IF_OF_SHIFT, 0x1UL);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* set_safe_settings - if the use_safe_settings option is set then set all values to the safe and slow values. */
|
static void __devinit set_safe_settings(void)
|
/* set_safe_settings - if the use_safe_settings option is set then set all values to the safe and slow values. */
static void __devinit set_safe_settings(void)
|
{
if (use_safe_settings)
{
int i;
dprintkl(KERN_INFO, "Using safe settings.\n");
for (i = 0; i < CFG_NUM; i++)
{
cfg_data[i].value = cfg_data[i].safe;
}
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* PPI interrupt cpu mask on bits are ignored. */
|
UINT32 EFIAPI FdtGetInterruptFlags(UINT32 CONST *Data)
|
/* PPI interrupt cpu mask on bits are ignored. */
UINT32 EFIAPI FdtGetInterruptFlags(UINT32 CONST *Data)
|
{
UINT32 IrqFlags;
UINT32 AcpiIrqFlags;
ASSERT (Data != NULL);
IrqFlags = fdt32_to_cpu (Data[IRQ_FLAGS_OFFSET]);
AcpiIrqFlags = DT_IRQ_IS_EDGE_TRIGGERED (IrqFlags) ? BIT0 : 0;
AcpiIrqFlags |= DT_IRQ_IS_ACTIVE_LOW (IrqFlags) ? BIT1 : 0;
return AcpiIrqFlags;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Entry point of the DHCP6 driver to install various protocols. */
|
EFI_STATUS EFIAPI Dhcp6DriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
/* Entry point of the DHCP6 driver to install various protocols. */
EFI_STATUS EFIAPI Dhcp6DriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
{
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gDhcp6DriverBinding,
ImageHandle,
&gDhcp6ComponentName,
&gDhcp6ComponentName2
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function will return the length of object list in object container. */
|
int rt_object_get_length(enum rt_object_class_type type)
|
/* This function will return the length of object list in object container. */
int rt_object_get_length(enum rt_object_class_type type)
|
{
int count = 0;
rt_ubase_t level;
struct rt_list_node *node = RT_NULL;
struct rt_object_information *information = RT_NULL;
information = rt_object_get_information((enum rt_object_class_type)type);
if (information == RT_NULL) return 0;
level = rt_hw_interrupt_disable();
rt_list_for_each(node, &(information->object_list))
{
count ++;
}
rt_hw_interrupt_enable(level);
return count;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Resume to Normal mode by exiting from low power mode. */
|
void sn65hvd234_disable_low_power(sn65hvd234_ctrl_t *p_component)
|
/* Resume to Normal mode by exiting from low power mode. */
void sn65hvd234_disable_low_power(sn65hvd234_ctrl_t *p_component)
|
{
ioport_set_pin_level(p_component->pio_rs_idx, CAN_RS_LOW);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Check if a color format is chroma keyed or not */
|
bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf)
|
/* Check if a color format is chroma keyed or not */
bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf)
|
{
bool is_chroma_keyed = false;
switch(cf) {
case LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED:
case LV_IMG_CF_RAW_CHROMA_KEYED:
is_chroma_keyed = true;
break;
default:
is_chroma_keyed = false;
break;
}
return is_chroma_keyed;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Event handler for the library USB Control Request reception event. */
|
void EVENT_USB_Device_ControlRequest(void)
|
/* Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void)
|
{
HID_Device_ProcessControlRequest(&Generic_HID_Interface);
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* DMA memory allocation, derived from pci_alloc_consistent. However, the Au1000 data cache is coherent (when programmed so), therefore we return KSEG0 address, not KSEG1. */
|
static void * dma_alloc(size_t, dma_addr_t *)
|
/* DMA memory allocation, derived from pci_alloc_consistent. However, the Au1000 data cache is coherent (when programmed so), therefore we return KSEG0 address, not KSEG1. */
static void * dma_alloc(size_t, dma_addr_t *)
|
{
void *ret;
int gfp = GFP_ATOMIC | GFP_DMA;
ret = (void *) __get_free_pages(gfp, get_order(size));
if (ret != NULL) {
memset(ret, 0, size);
*dma_handle = virt_to_bus(ret);
ret = (void *)KSEG0ADDR(ret);
}
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Checks whether the specified ETHERNET DMA flag is set or not. */
|
FlagStatus ETH_GetDmaFlagStatus(uint32_t ETH_DMA_FLAG)
|
/* Checks whether the specified ETHERNET DMA flag is set or not. */
FlagStatus ETH_GetDmaFlagStatus(uint32_t ETH_DMA_FLAG)
|
{
FlagStatus bitstatus = RESET;
assert_param(IS_ETH_DMA_GET_INT(ETH_DMA_FLAG));
if ((ETH->DMASTS & ETH_DMA_FLAG) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Translate the MAP operation code value to a text string Take into account the MAP version for ForwardSM */
|
const gchar * gsm_map_opr_code(guint32 val, proto_item *item)
|
/* Translate the MAP operation code value to a text string Take into account the MAP version for ForwardSM */
const gchar * gsm_map_opr_code(guint32 val, proto_item *item)
|
{
case 44:
case 46:
if (application_context_version < 3) {
proto_item_set_text(item, "%s (%d)", val_to_str_const(val, gsm_map_V1V2_opr_code_strings, "Unknown GSM-MAP opcode"), val);
return val_to_str_const(val, gsm_map_V1V2_opr_code_strings, "Unknown GSM-MAP opcode");
}
default:
return val_to_str_ext_const(val, &gsm_old_GSMMAPOperationLocalvalue_vals_ext, "Unknown GSM-MAP opcode");
break;
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Task function for blinking the LED as a fixed timer interval. */
|
void LedBlinkTask(void)
|
/* Task function for blinking the LED as a fixed timer interval. */
void LedBlinkTask(void)
|
{
static blt_bool ledOn = BLT_FALSE;
static blt_int32u nextBlinkEvent = 0;
if (TimerGet() >= nextBlinkEvent)
{
if (ledOn == BLT_FALSE)
{
ledOn = BLT_TRUE;
XMC_GPIO_SetOutputLevel(P4_0, XMC_GPIO_OUTPUT_LEVEL_LOW);
}
else
{
ledOn = BLT_FALSE;
XMC_GPIO_SetOutputLevel(P4_0, XMC_GPIO_OUTPUT_LEVEL_HIGH);
}
nextBlinkEvent = TimerGet() + ledBlinkIntervalMs;
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* At this point we only support a single shrink callback. Extend this if needed, perhaps using a linked list of callbacks. Note that this function is reentrant: many threads may try to swap out at any given time. */
|
static void ttm_shrink(struct ttm_mem_global *glob, bool from_wq, uint64_t extra)
|
/* At this point we only support a single shrink callback. Extend this if needed, perhaps using a linked list of callbacks. Note that this function is reentrant: many threads may try to swap out at any given time. */
static void ttm_shrink(struct ttm_mem_global *glob, bool from_wq, uint64_t extra)
|
{
int ret;
struct ttm_mem_shrink *shrink;
spin_lock(&glob->lock);
if (glob->shrink == NULL)
goto out;
while (ttm_zones_above_swap_target(glob, from_wq, extra)) {
shrink = glob->shrink;
spin_unlock(&glob->lock);
ret = shrink->do_shrink(shrink);
spin_lock(&glob->lock);
if (unlikely(ret != 0))
goto out;
}
out:
spin_unlock(&glob->lock);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Mark an image clean once it passes check or has been repaired */
|
static void qed_check_mark_clean(BDRVQEDState *s, BdrvCheckResult *result)
|
/* Mark an image clean once it passes check or has been repaired */
static void qed_check_mark_clean(BDRVQEDState *s, BdrvCheckResult *result)
|
{
if (result->corruptions > 0 || result->check_errors > 0) {
return;
}
if (!(s->header.features & QED_F_NEED_CHECK)) {
return;
}
bdrv_flush(s->bs);
s->header.features &= ~QED_F_NEED_CHECK;
qed_write_header_sync(s);
}
|
ve3wwg/teensy3_qemu
|
C++
|
Other
| 15
|
/* Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
|
VOID* EFIAPI AllocatePool(IN UINTN AllocationSize)
|
/* Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocatePool(IN UINTN AllocationSize)
|
{
return InternalAllocatePool (EfiRuntimeServicesData, AllocationSize);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* every callback is supposed to be called in chip->reg_lock spinlock */
|
static void atiixp_out_flush_dma(struct atiixp *chip)
|
/* every callback is supposed to be called in chip->reg_lock spinlock */
static void atiixp_out_flush_dma(struct atiixp *chip)
|
{
atiixp_write(chip, FIFO_FLUSH, ATI_REG_FIFO_OUT_FLUSH);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Truncate the given transfer width parameter to a value the current adapter type is capable of. */
|
static void ahc_validate_width(struct ahc_softc *ahc, struct ahc_initiator_tinfo *tinfo, u_int *bus_width, role_t role)
|
/* Truncate the given transfer width parameter to a value the current adapter type is capable of. */
static void ahc_validate_width(struct ahc_softc *ahc, struct ahc_initiator_tinfo *tinfo, u_int *bus_width, role_t role)
|
{
switch (*bus_width) {
default:
if (ahc->features & AHC_WIDE) {
*bus_width = MSG_EXT_WDTR_BUS_16_BIT;
break;
}
case MSG_EXT_WDTR_BUS_8_BIT:
*bus_width = MSG_EXT_WDTR_BUS_8_BIT;
break;
}
if (tinfo != NULL) {
if (role == ROLE_TARGET)
*bus_width = min((u_int)tinfo->user.width, *bus_width);
else
*bus_width = min((u_int)tinfo->goal.width, *bus_width);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Reset a Message Queue to initial empty state. */
|
osStatus_t osMessageQueueReset(osMessageQueueId_t mq_id)
|
/* Reset a Message Queue to initial empty state. */
osStatus_t osMessageQueueReset(osMessageQueueId_t mq_id)
|
{
EvrRtxMessageQueueError(mq_id, (int32_t)osErrorISR);
status = osErrorISR;
} else {
status = __svcMessageQueueReset(mq_id);
}
return status;
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* colreset the 7816 device obey the 7816-3 timing */
|
void wm_sc_colreset(void)
|
/* colreset the 7816 device obey the 7816-3 timing */
void wm_sc_colreset(void)
|
{
wm_sc_poweroff();
wm_sc_io_clk_config(1);
tls_gpio_write(sc_io.clk_pin_num, 0);
tls_gpio_write(sc_io.io_pin_num, 0);
wm_sc_rst_low();
wm_sc_poweron();
wm_sc_7816_mode(1);
wm_sc_io_clk_config(0);
wm_sc_set_frequency(5000000);
wm_sc_set_etu(WM_SC_DEFAULT_FD);
wm_sc_rst_high();
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Request the PE to perform a VDM Attention. */
|
USBPD_StatusTypeDef USBPD_DPM_RequestAttention(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID)
|
/* Request the PE to perform a VDM Attention. */
USBPD_StatusTypeDef USBPD_DPM_RequestAttention(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID)
|
{
return USBPD_PE_SVDM_RequestAttention(PortNum, SOPType, SVID);
}
|
st-one/X-CUBE-USB-PD
|
C++
| null | 110
|
/* Create a new aarp entry. This must use GFP_ATOMIC because it runs while holding spinlocks. */
|
static struct aarp_entry* aarp_alloc(void)
|
/* Create a new aarp entry. This must use GFP_ATOMIC because it runs while holding spinlocks. */
static struct aarp_entry* aarp_alloc(void)
|
{
struct aarp_entry *a = kmalloc(sizeof(*a), GFP_ATOMIC);
if (a)
skb_queue_head_init(&a->packet_queue);
return a;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Disables the PEC value calculation of the transferred bytes. */
|
void I2C_DisablePEC(I2C_T *i2c)
|
/* Disables the PEC value calculation of the transferred bytes. */
void I2C_DisablePEC(I2C_T *i2c)
|
{
i2c->CTRL1_B.PECEN = BIT_RESET;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* DESCRIPTION: This function causes the next available thread in the pend queue to be unblocked. If no thread is pending on this semaphore, the semaphore becomes 'full'. */
|
PUBLIC IX_STATUS ixOsalSemaphorePost(IxOsalSemaphore *sid)
|
/* DESCRIPTION: This function causes the next available thread in the pend queue to be unblocked. If no thread is pending on this semaphore, the semaphore becomes 'full'. */
PUBLIC IX_STATUS ixOsalSemaphorePost(IxOsalSemaphore *sid)
|
{
diag_printf("%s called\n", __FUNCTION__);
return IX_SUCCESS;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.