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
|
|---|---|---|---|---|---|---|---|
/* XLlFifo_RxGetLen or XLlFifo_iRxGetLen must be called before calling XLlFifo_RxGetWord. Otherwise, the hardware will raise an */
|
u32 XLlFifo_RxGetWord(XLlFifo *InstancePtr)
|
/* XLlFifo_RxGetLen or XLlFifo_iRxGetLen must be called before calling XLlFifo_RxGetWord. Otherwise, the hardware will raise an */
u32 XLlFifo_RxGetWord(XLlFifo *InstancePtr)
|
{
if (InstancePtr->Datainterface)
return XLlFifo_ReadReg((InstancePtr)->Axi4BaseAddress,
XLLF_AXI4_RDFD_OFFSET);
else
return XLlFifo_ReadReg((InstancePtr)->Axi4BaseAddress,
XLLF_RDFD_OFFSET);
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* 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)(~TIM_CCMR2_OC4FE);
tmpccmr2 |= (uint16_t)(TIM_OCFast << 8);
TIMx->CCMR2 = tmpccmr2;
}
|
MaJerle/stm32f429
|
C++
| null | 2,036
|
/* Clears all of the LCDC interrupt pending bit. */
|
void LCDC_ClearAllINT(LCDC_TypeDef *LCDCx)
|
/* Clears all of the LCDC interrupt pending bit. */
void LCDC_ClearAllINT(LCDC_TypeDef *LCDCx)
|
{
assert_param(IS_LCDC_ALL_PERIPH(LCDCx));
LCDCx->LCDC_IRQ_STATUS = 0xFFFFFFFF;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Caution: This function may receive untrusted input. PE/COFF image is external input, so this function will make sure the PE/COFF image content read is within the image buffer. */
|
EFI_STATUS EFIAPI SecureBootConfigImageRead(IN VOID *FileHandle, IN UINTN FileOffset, IN OUT UINTN *ReadSize, OUT VOID *Buffer)
|
/* Caution: This function may receive untrusted input. PE/COFF image is external input, so this function will make sure the PE/COFF image content read is within the image buffer. */
EFI_STATUS EFIAPI SecureBootConfigImageRead(IN VOID *FileHandle, IN UINTN FileOffset, IN OUT UINTN *ReadSize, OUT VOID *Buffer)
|
{
UINTN EndPosition;
if ((FileHandle == NULL) || (ReadSize == NULL) || (Buffer == NULL)) {
return EFI_INVALID_PARAMETER;
}
if (MAX_ADDRESS - FileOffset < *ReadSize) {
return EFI_INVALID_PARAMETER;
}
EndPosition = FileOffset + *ReadSize;
if (EndPosition > mImageSize) {
*ReadSize = (UINT32)(mImageSize - FileOffset);
}
if (FileOffset >= mImageSize) {
*ReadSize = 0;
}
CopyMem (Buffer, (UINT8 *)((UINTN)FileHandle + FileOffset), *ReadSize);
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This can be called to have access to URBs which are to be executed without bothering to track them */
|
void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor)
|
/* This can be called to have access to URBs which are to be executed without bothering to track them */
void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor)
|
{
unsigned long flags;
spin_lock_irqsave(&anchor->lock, flags);
usb_get_urb(urb);
list_add_tail(&urb->anchor_list, &anchor->urb_list);
urb->anchor = anchor;
if (unlikely(anchor->poisoned)) {
atomic_inc(&urb->reject);
}
spin_unlock_irqrestore(&anchor->lock, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns to the caller: 0 - queue is empty or throttled. >0 - queue is not empty. */
|
static int qdisc_restart(struct Qdisc *q)
|
/* Returns to the caller: 0 - queue is empty or throttled. >0 - queue is not empty. */
static int qdisc_restart(struct Qdisc *q)
|
{
struct netdev_queue *txq;
struct net_device *dev;
spinlock_t *root_lock;
struct sk_buff *skb;
skb = dequeue_skb(q);
if (unlikely(!skb))
return 0;
root_lock = qdisc_lock(q);
dev = qdisc_dev(q);
txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
return sch_direct_xmit(skb, q, dev, txq, root_lock);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Main application function.
Start the sensor task then start the scheduler. */
|
int main(void)
|
/* Main application function.
Start the sensor task then start the scheduler. */
int main(void)
|
{
system_init();
configure_console();
delay_init();
if (SysTick_Config(system_cpu_clock_get_hz() / 1000)) {
puts("main: SysTick configuration error!");
while (1);
}
puts(STRING_HEADER);
demo_start();
return 0;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* CAN Initialize a 32bit Message ID List Filter. */
|
void can_filter_id_list_32bit_init(uint32_t nr, uint32_t id1, uint32_t id2, uint32_t fifo, bool enable)
|
/* CAN Initialize a 32bit Message ID List Filter. */
void can_filter_id_list_32bit_init(uint32_t nr, uint32_t id1, uint32_t id2, uint32_t fifo, bool enable)
|
{
can_filter_init(nr, true, true, id1, id2, fifo, enable);
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* Change the current location to the one saved in LOC. */
|
void loc_restore(Location *loc)
|
/* Change the current location to the one saved in LOC. */
void loc_restore(Location *loc)
|
{
Location *prev = cur_loc->prev;
assert(!loc->prev);
*cur_loc = *loc;
cur_loc->prev = prev;
}
|
ve3wwg/teensy3_qemu
|
C++
|
Other
| 15
|
/* As a side effect of the way this is implemented we're limited to interrupt handlers in the address range from KSEG0 <= x < KSEG0 + 256mb on the Nevada. Oh well ... */
|
void* set_except_vector(int n, void *addr)
|
/* As a side effect of the way this is implemented we're limited to interrupt handlers in the address range from KSEG0 <= x < KSEG0 + 256mb on the Nevada. Oh well ... */
void* set_except_vector(int n, void *addr)
|
{
unsigned long handler = (unsigned long) addr;
unsigned long old_handler = exception_handlers[n];
exception_handlers[n] = handler;
if (n == 0 && cpu_has_divec) {
*(u32 *)(ebase + 0x200) = 0x08000000 |
(0x03ffffff & (handler >> 2));
local_flush_icache_range(ebase + 0x200, ebase + 0x204);
}
return (void *)old_handler;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* A bfin atapi device has been unplugged. Perform the needed cleanup. Also called on module unload for any active devices. */
|
static int __devexit bfin_atapi_remove(struct platform_device *pdev)
|
/* A bfin atapi device has been unplugged. Perform the needed cleanup. Also called on module unload for any active devices. */
static int __devexit bfin_atapi_remove(struct platform_device *pdev)
|
{
struct device *dev = &pdev->dev;
struct ata_host *host = dev_get_drvdata(dev);
ata_host_detach(host);
dev_set_drvdata(&pdev->dev, NULL);
peripheral_free_list(atapi_io_port);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Initialize the conversion factor and the min/max deltas of the clock event structure and register the clock event source with the framework. */
|
void __init setup_pit_timer(void)
|
/* Initialize the conversion factor and the min/max deltas of the clock event structure and register the clock event source with the framework. */
void __init setup_pit_timer(void)
|
{
pit_ce.cpumask = cpumask_of(smp_processor_id());
pit_ce.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC, pit_ce.shift);
pit_ce.max_delta_ns = clockevent_delta2ns(0x7FFF, &pit_ce);
pit_ce.min_delta_ns = clockevent_delta2ns(0xF, &pit_ce);
clockevents_register_device(&pit_ce);
global_clock_event = &pit_ce;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* this routine send an ethernet frame out of the network interface */
|
static int mcs7830_send(struct eth_device *eth, void *packet, int length)
|
/* this routine send an ethernet frame out of the network interface */
static int mcs7830_send(struct eth_device *eth, void *packet, int length)
|
{
struct ueth_data *dev = eth->priv;
return mcs7830_send_common(dev, packet, length);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Exactly like fs/open.c:sys_openat(), except that it doesn't set the O_LARGEFILE flag. */
|
asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, int flags, int mode)
|
/* Exactly like fs/open.c:sys_openat(), except that it doesn't set the O_LARGEFILE flag. */
asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, int flags, int mode)
|
{
return do_sys_open(dfd, filename, flags, mode);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function sends a DevRev command to the device and receives its response. */
|
uint8_t sha204m_dev_rev(struct sha204_dev_rev_parameters *args)
|
/* This function sends a DevRev command to the device and receives its response. */
uint8_t sha204m_dev_rev(struct sha204_dev_rev_parameters *args)
|
{
if (!args->tx_buffer || !args->rx_buffer)
return SHA204_BAD_PARAM;
args->tx_buffer[SHA204_COUNT_IDX] = DEVREV_COUNT;
args->tx_buffer[SHA204_OPCODE_IDX] = SHA204_DEVREV;
args->tx_buffer[DEVREV_PARAM1_IDX] =
args->tx_buffer[DEVREV_PARAM2_IDX] =
args->tx_buffer[DEVREV_PARAM2_IDX + 1] = 0;
struct sha204_send_and_receive_parameters comm_parameters = {
.tx_buffer = args->tx_buffer,
.rx_buffer = args->rx_buffer,
.rx_size = DEVREV_RSP_SIZE,
.poll_delay = DEVREV_DELAY,
.poll_timeout = DEVREV_EXEC_MAX - DEVREV_DELAY
};
return sha204c_send_and_receive(&comm_parameters);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* ADC Start a Conversion Without Trigger.
Note that this is not available in other STM32F families. To ensure code compatibility, enable triggering and use a software trigger source */
|
void adc_start_conversion_direct(uint32_t adc)
|
/* ADC Start a Conversion Without Trigger.
Note that this is not available in other STM32F families. To ensure code compatibility, enable triggering and use a software trigger source */
void adc_start_conversion_direct(uint32_t adc)
|
{
if (ADC_CR2(adc) & ADC_CR2_ADON) {
ADC_CR2(adc) |= ADC_CR2_ADON;
}
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* O: Offset On: Offset (NULL) Ox: Offset Onx: Offset (NULL) */
|
otv_x_Ox(FT_Bytes table, OTV_Validator valid)
|
/* O: Offset On: Offset (NULL) Ox: Offset Onx: Offset (NULL) */
otv_x_Ox(FT_Bytes table, OTV_Validator valid)
|
{
FT_Bytes p = table;
FT_UInt Count;
OTV_Validate_Func func;
OTV_ENTER;
OTV_LIMIT_CHECK( 2 );
Count = FT_NEXT_USHORT( p );
OTV_TRACE(( " (Count = %d)\n", Count ));
OTV_LIMIT_CHECK( Count * 2 );
valid->nesting_level++;
func = valid->func[valid->nesting_level];
for ( ; Count > 0; Count-- )
func( table + FT_NEXT_USHORT( p ), valid );
valid->nesting_level--;
OTV_EXIT;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */
|
void isl_seq_clr(isl_int *p, unsigned len)
|
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */
void isl_seq_clr(isl_int *p, unsigned len)
|
{
int i;
for (i = 0; i < len; ++i)
isl_int_set_si(p[i], 0);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Initialize the extent tree @tree. Should be called for each new inode or other user of the extent_map interface. */
|
void extent_map_tree_init(struct extent_map_tree *tree, gfp_t mask)
|
/* Initialize the extent tree @tree. Should be called for each new inode or other user of the extent_map interface. */
void extent_map_tree_init(struct extent_map_tree *tree, gfp_t mask)
|
{
tree->map.rb_node = NULL;
rwlock_init(&tree->lock);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* De-initializes the FMC NAND Banks registers to their default reset values. */
|
void FMC_NANDDeInit(uint32_t FMC_Bank)
|
/* De-initializes the FMC NAND Banks registers to their default reset values. */
void FMC_NANDDeInit(uint32_t FMC_Bank)
|
{
assert_param(IS_FMC_NAND_BANK(FMC_Bank));
if(FMC_Bank == FMC_Bank2_NAND)
{
FMC_Bank2->PCR2 = 0x00000018;
FMC_Bank2->SR2 = 0x00000040;
FMC_Bank2->PMEM2 = 0xFCFCFCFC;
FMC_Bank2->PATT2 = 0xFCFCFCFC;
}
else
{
FMC_Bank3->PCR3 = 0x00000018;
FMC_Bank3->SR3 = 0x00000040;
FMC_Bank3->PMEM3 = 0xFCFCFCFC;
FMC_Bank3->PATT3 = 0xFCFCFCFC;
}
}
|
MaJerle/stm32f429
|
C++
| null | 2,036
|
/* Curl_add_buffer_init() sets up and returns a fine buffer struct */
|
Curl_send_buffer* Curl_add_buffer_init(void)
|
/* Curl_add_buffer_init() sets up and returns a fine buffer struct */
Curl_send_buffer* Curl_add_buffer_init(void)
|
{
return calloc(1, sizeof(Curl_send_buffer));
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* unset GIRQn interrupt source callback by device handle */
|
int mchp_ecia_unset_callback_by_dev(const struct device *dev_girq, int src)
|
/* unset GIRQn interrupt source callback by device handle */
int mchp_ecia_unset_callback_by_dev(const struct device *dev_girq, int src)
|
{
if ((dev_girq == NULL) || (src < 0) || (src > 31)) {
return -EINVAL;
}
const struct xec_girq_config *const cfg = DEV_GIRQ_CFG(dev_girq);
struct xec_girq_src_data *girq_data = DEV_GIRQ_DATA(dev_girq);
if (!(cfg->sources[src] & BIT(7))) {
return -EINVAL;
}
int idx = (int)(cfg->sources[src] & ~BIT(7));
girq_data[idx].cb = NULL;
girq_data[idx].data = NULL;
return 0;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* This function adds the CA-supplied certificate revocation list data for certificate validity checking. */
|
EFI_STATUS EFIAPI CryptoServiceTlsSetCertRevocationList(IN VOID *Data, IN UINTN DataSize)
|
/* This function adds the CA-supplied certificate revocation list data for certificate validity checking. */
EFI_STATUS EFIAPI CryptoServiceTlsSetCertRevocationList(IN VOID *Data, IN UINTN DataSize)
|
{
return CALL_BASECRYPTLIB (TlsSet.Services.CertRevocationList, TlsSetCertRevocationList, (Data, DataSize), EFI_UNSUPPORTED);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
|
UINT32 EFIAPI PciExpressOr32(IN UINTN Address, IN UINT32 OrData)
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciExpressOr32(IN UINTN Address, IN UINT32 OrData)
|
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
return (UINT32)-1;
}
return MmioOr32 (GetPciExpressAddress (Address), OrData);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* this is the main interrupt routine for the DZ chip. */
|
static irqreturn_t dz_interrupt(int irq, void *dev_id)
|
/* this is the main interrupt routine for the DZ chip. */
static irqreturn_t dz_interrupt(int irq, void *dev_id)
|
{
struct dz_mux *mux = dev_id;
struct dz_port *dport = &mux->dport[0];
u16 status;
status = dz_in(dport, DZ_CSR);
if ((status & (DZ_RDONE | DZ_RIE)) == (DZ_RDONE | DZ_RIE))
dz_receive_chars(mux);
if ((status & (DZ_TRDY | DZ_TIE)) == (DZ_TRDY | DZ_TIE))
dz_transmit_chars(mux);
return IRQ_HANDLED;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Free the PCI mappings and the memory allocated for FIB blocks on this adapter. */
|
void aac_fib_map_free(struct aac_dev *dev)
|
/* Free the PCI mappings and the memory allocated for FIB blocks on this adapter. */
void aac_fib_map_free(struct aac_dev *dev)
|
{
pci_free_consistent(dev->pdev,
dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB),
dev->hw_fib_va, dev->hw_fib_pa);
dev->hw_fib_va = NULL;
dev->hw_fib_pa = 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
|
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
|
{
if(huart->Instance==USART1)
{
__HAL_RCC_USART1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10);
}
else if(huart->Instance==USART2)
{
__HAL_RCC_USART2_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_5|GPIO_PIN_6);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Free a report and all registered fields. The field->usage and field->value table's are allocated behind the field, so we need only to free(field) itself. */
|
static void hid_free_report(usbHidReport_t *report)
|
/* Free a report and all registered fields. The field->usage and field->value table's are allocated behind the field, so we need only to free(field) itself. */
static void hid_free_report(usbHidReport_t *report)
|
{
unsigned int n;
for (n = 0; n < report->Maxfield; n++){
if(report->Field[n]){
if(report->Field[n]->usage){
hal_free(report->Field[n]->usage);
report->Field[n]->usage = NULL;
}
if(report->Field[n]->value){
hal_free(report->Field[n]->value);
report->Field[n]->value = NULL;
}
hal_free(report->Field[n]);
report->Field[n] = NULL;
}
}
hal_free(report);
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* configure the direction of data transfer on the channel */
|
void dma_transfer_direction_config(dma_channel_enum channelx, uint8_t direction)
|
/* configure the direction of data transfer on the channel */
void dma_transfer_direction_config(dma_channel_enum channelx, uint8_t direction)
|
{
if(DMA_PERIPHERA_TO_MEMORY == direction){
DMA_CHCTL(channelx) &= ~DMA_CHXCTL_TM;
} else {
DMA_CHCTL(channelx) |= DMA_CHXCTL_TM;
}
}
|
liuxuming/trochili
|
C++
|
Apache License 2.0
| 132
|
/* Write a value to a PHY register through the MDIO interface. */
|
int32_t ETH_PHY_IO_WriteReg(uint32_t DevAddr, uint32_t RegAddr, uint32_t RegVal)
|
/* Write a value to a PHY register through the MDIO interface. */
int32_t ETH_PHY_IO_WriteReg(uint32_t DevAddr, uint32_t RegAddr, uint32_t RegVal)
|
{
if(HAL_ETH_WritePHYRegister(&EthHandle, DevAddr, RegAddr, RegVal) != HAL_OK)
{
return -1;
}
return 0;
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* This function clears the specified interrupts in the Interrupt Status Register (IPISR). */
|
void XAdcPs_IntrClear(XAdcPs *InstancePtr, u32 Mask)
|
/* This function clears the specified interrupts in the Interrupt Status Register (IPISR). */
void XAdcPs_IntrClear(XAdcPs *InstancePtr, u32 Mask)
|
{
u32 RegValue;
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
RegValue = XAdcPs_ReadReg(InstancePtr->Config.BaseAddress,
XADCPS_INT_STS_OFFSET);
RegValue &= (Mask & XADCPS_INTX_ALL_MASK);
XAdcPs_WriteReg(InstancePtr->Config.BaseAddress, XADCPS_INT_STS_OFFSET,
RegValue);
}
/** @}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* @parts: Array containing the partitions that will be freed. @nparts: Size of @parts array. */
|
void mtd_free_parsed_partitions(struct mtd_partition *parts, unsigned int nparts)
|
/* @parts: Array containing the partitions that will be freed. @nparts: Size of @parts array. */
void mtd_free_parsed_partitions(struct mtd_partition *parts, unsigned int nparts)
|
{
int i;
for (i = 0; i < nparts; i++)
free((char *)parts[i].name);
free(parts);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Stops the TIMER Base generation in DMA mode. */
|
void ald_timer_base_stop_by_dma(ald_timer_handle_t *hperh)
|
/* Stops the TIMER Base generation in DMA mode. */
void ald_timer_base_stop_by_dma(ald_timer_handle_t *hperh)
|
{
assert_param(IS_TIMER_INSTANCE(hperh->perh));
ald_timer_dma_req_config(hperh, ALD_TIMER_DMA_UPDATE, DISABLE);
ALD_TIMER_DISABLE(hperh);
hperh->state = ALD_TIMER_STATE_READY;
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* ipu_select_buffer() - mark a channel's buffer as ready. @channel: channel ID. @buffer_n: buffer number to mark ready. */
|
static void ipu_select_buffer(enum ipu_channel channel, int buffer_n)
|
/* ipu_select_buffer() - mark a channel's buffer as ready. @channel: channel ID. @buffer_n: buffer number to mark ready. */
static void ipu_select_buffer(enum ipu_channel channel, int buffer_n)
|
{
if (buffer_n == 0)
idmac_write_ipureg(&ipu_data, 1UL << channel, IPU_CHA_BUF0_RDY);
else
idmac_write_ipureg(&ipu_data, 1UL << channel, IPU_CHA_BUF1_RDY);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Execute an SQL statement. Return a Cursor object if the statement is a query, otherwise return the number of tuples affected by the statement. */
|
static int conn_execute(lua_State *L)
|
/* Execute an SQL statement. Return a Cursor object if the statement is a query, otherwise return the number of tuples affected by the statement. */
static int conn_execute(lua_State *L)
|
{
OCIHandleFree ((dvoid *)stmthp, OCI_HTYPE_STMT);
return checkerr (L, status, conn->errhp);
}
if (type == OCI_STMT_SELECT) {
return create_cursor (L, 1, conn, stmthp, statement);
} else {
int rows_affected;
ASSERT (L, OCIAttrGet ((dvoid *)stmthp, (ub4)OCI_HTYPE_STMT,
(dvoid *)&rows_affected, (ub4 *)0,
(ub4)OCI_ATTR_ROW_COUNT, conn->errhp), conn->errhp);
OCIHandleFree ((dvoid *)stmthp, OCI_HTYPE_STMT);
lua_pushnumber (L, rows_affected);
return 1;
}
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
|
void Vector21_handler(void)
|
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector21_handler(void)
|
{
asm
{
LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (21 * 2))
JMP 0,X
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Returns the delta between the expiry time and now, which can be less than zero or 1usec for an pending expired timer */
|
static struct timeval itimer_get_remtime(struct hrtimer *timer)
|
/* Returns the delta between the expiry time and now, which can be less than zero or 1usec for an pending expired timer */
static struct timeval itimer_get_remtime(struct hrtimer *timer)
|
{
ktime_t rem = hrtimer_get_remaining(timer);
if (hrtimer_active(timer)) {
if (rem.tv64 <= 0)
rem.tv64 = NSEC_PER_USEC;
} else
rem.tv64 = 0;
return ktime_to_timeval(rem);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
|
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
|
{
if(hspi->Instance==SPI1)
{
__HAL_RCC_SPI1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);
}
else if(hspi->Instance==SPI2)
{
__HAL_RCC_SPI2_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15);
}
else if(hspi->Instance==SPI3)
{
__HAL_RCC_SPI3_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_3|GPIO_PIN_5);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* clock rate control specific control that scans the sample rates on the external plugs */
|
static int pcxhr_clock_rate_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
|
/* clock rate control specific control that scans the sample rates on the external plugs */
static int pcxhr_clock_rate_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
|
{
struct pcxhr_mgr *mgr = snd_kcontrol_chip(kcontrol);
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 3 + mgr->capture_chips;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 192000;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns 0 on success, errno on failure (as defined in errno.h) */
|
int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
|
/* Returns 0 on success, errno on failure (as defined in errno.h) */
int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
|
{
int status = 0;
struct et131x_adapter *etdev = netdev_priv(netdev);
struct mii_ioctl_data *data = if_mii(reqbuf);
switch (cmd) {
case SIOCGMIIPHY:
data->phy_id = etdev->Stats.xcvr_addr;
break;
case SIOCGMIIREG:
if (!capable(CAP_NET_ADMIN))
status = -EPERM;
else
status = MiRead(etdev,
data->reg_num, &data->val_out);
break;
case SIOCSMIIREG:
if (!capable(CAP_NET_ADMIN))
status = -EPERM;
else
status = MiWrite(etdev, data->reg_num,
data->val_in);
break;
default:
status = -EOPNOTSUPP;
}
return status;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
resource_size_t drm_get_resource_start(struct drm_device *dev, unsigned int resource)
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
resource_size_t drm_get_resource_start(struct drm_device *dev, unsigned int resource)
|
{
return pci_resource_start(dev->pdev, resource);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns the number of xmlChar contained in the ARRAY. */
|
int xmlStrlen(const xmlChar *str)
|
/* Returns the number of xmlChar contained in the ARRAY. */
int xmlStrlen(const xmlChar *str)
|
{
str++;
len++;
}
return(len);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Send a single uevent (scsi_event) to the associated scsi_device. */
|
static void scsi_evt_emit(struct scsi_device *sdev, struct scsi_event *evt)
|
/* Send a single uevent (scsi_event) to the associated scsi_device. */
static void scsi_evt_emit(struct scsi_device *sdev, struct scsi_event *evt)
|
{
int idx = 0;
char *envp[3];
switch (evt->evt_type) {
case SDEV_EVT_MEDIA_CHANGE:
envp[idx++] = "SDEV_MEDIA_CHANGE=1";
break;
default:
break;
}
envp[idx++] = NULL;
kobject_uevent_env(&sdev->sdev_gendev.kobj, KOBJ_CHANGE, envp);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* insn_init() - initialize struct insn @insn: &struct insn to be initialized @kaddr: address (in kernel memory) of instruction (or copy thereof) @x86_64: !0 for 64-bit kernel or 64-bit app */
|
void insn_init(struct insn *insn, const void *kaddr, int x86_64)
|
/* insn_init() - initialize struct insn @insn: &struct insn to be initialized @kaddr: address (in kernel memory) of instruction (or copy thereof) @x86_64: !0 for 64-bit kernel or 64-bit app */
void insn_init(struct insn *insn, const void *kaddr, int x86_64)
|
{
memset(insn, 0, sizeof(*insn));
insn->kaddr = kaddr;
insn->next_byte = kaddr;
insn->x86_64 = x86_64 ? 1 : 0;
insn->opnd_bytes = 4;
if (x86_64)
insn->addr_bytes = 8;
else
insn->addr_bytes = 4;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Do any tidying up before marking online and running the idle loop */
|
static void __cpuinit bcm1480_smp_finish(void)
|
/* Do any tidying up before marking online and running the idle loop */
static void __cpuinit bcm1480_smp_finish(void)
|
{
extern void sb1480_clockevent_init(void);
sb1480_clockevent_init();
local_irq_enable();
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function enables the Cortex A9 event counters. */
|
void Xpm_EnableEventCounters(void)
|
/* This function enables the Cortex A9 event counters. */
void Xpm_EnableEventCounters(void)
|
{
mtcp(XREG_CP15_COUNT_ENABLE_SET, 0x3f);
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* If 8-bit I/O port operations are not supported, 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 S3IoBitFieldRead8(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit)
|
/* If 8-bit I/O port operations are not supported, 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 S3IoBitFieldRead8(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit)
|
{
return InternalSaveIoWrite8ValueToBootScript (Port, IoBitFieldRead8 (Port, StartBit, EndBit));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function shall get the thread creation stack attributes stackaddr and stacksize in the attr object. */
|
int pthread_attr_getstack(pthread_attr_t const *attr, void **stack_base, size_t *stack_size)
|
/* This function shall get the thread creation stack attributes stackaddr and stacksize in the attr object. */
int pthread_attr_getstack(pthread_attr_t const *attr, void **stack_base, size_t *stack_size)
|
{
RT_ASSERT(attr != RT_NULL);
*stack_base = attr->stackaddr;
*stack_size = attr->stacksize;
return 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Subtract one value from another in F255. Partial reduction is performed (down to less than twice the modulus). */
|
static void f255_sub(uint32_t *d, const uint32_t *a, const uint32_t *b)
|
/* Subtract one value from another in F255. Partial reduction is performed (down to less than twice the modulus). */
static void f255_sub(uint32_t *d, const uint32_t *a, const uint32_t *b)
|
{
int i;
uint32_t cc, w;
cc = (uint32_t)-38;
for (i = 0; i < 20; i ++) {
w = a[i] - b[i] + cc;
d[i] = w & 0x1FFF;
cc = ARSH(w, 13);
}
cc = MUL15((w + 0x200) >> 8, 19);
d[19] &= 0xFF;
for (i = 0; i < 20; i ++) {
w = d[i] + cc;
d[i] = w & 0x1FFF;
cc = w >> 13;
}
}
|
RavenSystem/esp-homekit-devices
|
C++
|
Other
| 2,577
|
/* This helper function does everything that CreateBasicVariablePolicy() does, but also uses the passed in protocol to register the policy with the infrastructure. Does not return a buffer, does not require the caller to free anything. */
|
EFI_STATUS EFIAPI RegisterBasicVariablePolicy(IN EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy, IN CONST EFI_GUID *Namespace, IN CONST CHAR16 *Name OPTIONAL, IN UINT32 MinSize, IN UINT32 MaxSize, IN UINT32 AttributesMustHave, IN UINT32 AttributesCantHave, IN UINT8 LockPolicyType)
|
/* This helper function does everything that CreateBasicVariablePolicy() does, but also uses the passed in protocol to register the policy with the infrastructure. Does not return a buffer, does not require the caller to free anything. */
EFI_STATUS EFIAPI RegisterBasicVariablePolicy(IN EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy, IN CONST EFI_GUID *Namespace, IN CONST CHAR16 *Name OPTIONAL, IN UINT32 MinSize, IN UINT32 MaxSize, IN UINT32 AttributesMustHave, IN UINT32 AttributesCantHave, IN UINT8 LockPolicyType)
|
{
VARIABLE_POLICY_ENTRY *NewEntry;
EFI_STATUS Status;
if (VariablePolicy == NULL) {
return EFI_INVALID_PARAMETER;
}
NewEntry = NULL;
Status = CreateBasicVariablePolicy (
Namespace,
Name,
MinSize,
MaxSize,
AttributesMustHave,
AttributesCantHave,
LockPolicyType,
&NewEntry
);
if (!EFI_ERROR (Status)) {
Status = VariablePolicy->RegisterVariablePolicy (NewEntry);
}
if (NewEntry != NULL) {
FreePool (NewEntry);
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Convert the physical PCI Express MMIO addresses for all registered PCI devices to virtual addresses. */
|
VOID EFIAPI DxeRuntimePciExpressLibVirtualNotify(IN EFI_EVENT Event, IN VOID *Context)
|
/* Convert the physical PCI Express MMIO addresses for all registered PCI devices to virtual addresses. */
VOID EFIAPI DxeRuntimePciExpressLibVirtualNotify(IN EFI_EVENT Event, IN VOID *Context)
|
{
UINTN Index;
if (mDxeRuntimePciExpressLibRegistrationTable == NULL) {
return;
}
for (Index = 0; Index < mDxeRuntimePciExpressLibNumberOfRuntimeRanges; Index++) {
EfiConvertPointer (0, (VOID **)&(mDxeRuntimePciExpressLibRegistrationTable[Index].VirtualAddress));
}
EfiConvertPointer (0, (VOID **)&mDxeRuntimePciExpressLibRegistrationTable);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This is called when the buf log item is no longer needed. It should free the buf log item associated with the given buffer and clear the buffer's pointer to the buf log item. If there are no more items in the list, clear the b_iodone field of the buffer (see xfs_buf_attach_iodone() below). */
|
void xfs_buf_item_relse(xfs_buf_t *bp)
|
/* This is called when the buf log item is no longer needed. It should free the buf log item associated with the given buffer and clear the buffer's pointer to the buf log item. If there are no more items in the list, clear the b_iodone field of the buffer (see xfs_buf_attach_iodone() below). */
void xfs_buf_item_relse(xfs_buf_t *bp)
|
{
xfs_buf_log_item_t *bip;
trace_xfs_buf_item_relse(bp, _RET_IP_);
bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t*);
XFS_BUF_SET_FSPRIVATE(bp, bip->bli_item.li_bio_list);
if ((XFS_BUF_FSPRIVATE(bp, void *) == NULL) &&
(XFS_BUF_IODONE_FUNC(bp) != NULL)) {
XFS_BUF_CLR_IODONE_FUNC(bp);
}
xfs_buf_rele(bp);
xfs_buf_item_free(bip);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* ib_umem_release - release memory pinned with ib_umem_get @umem: umem struct to release */
|
void ib_umem_release(struct ib_umem *umem)
|
/* ib_umem_release - release memory pinned with ib_umem_get @umem: umem struct to release */
void ib_umem_release(struct ib_umem *umem)
|
{
struct ib_ucontext *context = umem->context;
struct mm_struct *mm;
unsigned long diff;
__ib_umem_release(umem->context->device, umem, 1);
mm = get_task_mm(current);
if (!mm) {
kfree(umem);
return;
}
diff = PAGE_ALIGN(umem->length + umem->offset) >> PAGE_SHIFT;
if (context->closing) {
if (!down_write_trylock(&mm->mmap_sem)) {
INIT_WORK(&umem->work, ib_umem_account);
umem->mm = mm;
umem->diff = diff;
schedule_work(&umem->work);
return;
}
} else
down_write(&mm->mmap_sem);
current->mm->locked_vm -= diff;
up_write(&mm->mmap_sem);
mmput(mm);
kfree(umem);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Create a PCI_CAP_DEV object from the PCI Segment:Bus:Device.Function quadruplet. The config space accessors are based upon PciSegmentLib. */
|
RETURN_STATUS EFIAPI PciCapPciSegmentDeviceInit(IN PCI_CAP_DOMAIN MaxDomain, IN UINT16 Segment, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Function, OUT PCI_CAP_DEV **PciDevice)
|
/* Create a PCI_CAP_DEV object from the PCI Segment:Bus:Device.Function quadruplet. The config space accessors are based upon PciSegmentLib. */
RETURN_STATUS EFIAPI PciCapPciSegmentDeviceInit(IN PCI_CAP_DOMAIN MaxDomain, IN UINT16 Segment, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Function, OUT PCI_CAP_DEV **PciDevice)
|
{
SEGMENT_DEV *SegmentDev;
if ((Device > PCI_MAX_DEVICE) || (Function > PCI_MAX_FUNC)) {
return RETURN_INVALID_PARAMETER;
}
SegmentDev = AllocatePool (sizeof *SegmentDev);
if (SegmentDev == NULL) {
return RETURN_OUT_OF_RESOURCES;
}
SegmentDev->Signature = SEGMENT_DEV_SIG;
SegmentDev->MaxDomain = MaxDomain;
SegmentDev->SegmentNr = Segment;
SegmentDev->BusNr = Bus;
SegmentDev->DeviceNr = Device;
SegmentDev->FunctionNr = Function;
SegmentDev->BaseDevice.ReadConfig = SegmentDevReadConfig;
SegmentDev->BaseDevice.WriteConfig = SegmentDevWriteConfig;
*PciDevice = &SegmentDev->BaseDevice;
return RETURN_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* ubi_put_device - drop an UBI device reference. @ubi: UBI device description object */
|
void ubi_put_device(struct ubi_device *ubi)
|
/* ubi_put_device - drop an UBI device reference. @ubi: UBI device description object */
void ubi_put_device(struct ubi_device *ubi)
|
{
spin_lock(&ubi_devices_lock);
ubi->ref_count -= 1;
put_device(&ubi->dev);
spin_unlock(&ubi_devices_lock);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* find an audio control unit with the given unit id */
|
static void* find_audio_control_unit(struct mixer_build *state, unsigned char unit)
|
/* find an audio control unit with the given unit id */
static void* find_audio_control_unit(struct mixer_build *state, unsigned char unit)
|
{
unsigned char *p;
p = NULL;
while ((p = snd_usb_find_desc(state->buffer, state->buflen, p,
USB_DT_CS_INTERFACE)) != NULL) {
if (p[0] >= 4 && p[2] >= INPUT_TERMINAL && p[2] <= EXTENSION_UNIT && p[3] == unit)
return p;
}
return NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
|
UINT64 EFIAPI AsmMsrBitFieldRead64(IN UINT32 Index, IN UINTN StartBit, IN UINTN EndBit)
|
/* If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT64 EFIAPI AsmMsrBitFieldRead64(IN UINT32 Index, IN UINTN StartBit, IN UINTN EndBit)
|
{
return BitFieldRead64 (AsmReadMsr64 (Index), StartBit, EndBit);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns: an enum env_location value on success, a negative error code otherwise */
|
__weak enum env_location env_get_location(enum env_operation op, int prio)
|
/* Returns: an enum env_location value on success, a negative error code otherwise */
__weak enum env_location env_get_location(enum env_operation op, int prio)
|
{
if (prio >= ARRAY_SIZE(env_locations))
return ENVL_UNKNOWN;
gd->env_load_prio = prio;
return env_locations[prio];
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Compute the key id of a KEY RR depending of the algorithm used. */
|
static guint16 compute_key_id(tvbuff_t *tvb, int offset, int size, guint8 algo)
|
/* Compute the key id of a KEY RR depending of the algorithm used. */
static guint16 compute_key_id(tvbuff_t *tvb, int offset, int size, guint8 algo)
|
{
guint32 ac;
guint8 c1, c2;
DISSECTOR_ASSERT(size >= 4);
switch( algo ) {
case DNS_ALGO_RSAMD5:
return (guint16)(tvb_get_guint8(tvb, offset + size - 3) << 8) + tvb_get_guint8( tvb, offset + size - 2 );
default:
for (ac = 0; size > 1; size -= 2, offset += 2) {
c1 = tvb_get_guint8( tvb, offset );
c2 = tvb_get_guint8( tvb, offset + 1 );
ac += (c1 << 8) + c2 ;
}
if (size > 0) {
c1 = tvb_get_guint8( tvb, offset );
ac += c1 << 8;
}
ac += (ac >> 16) & 0xffff;
return (guint16)(ac & 0xffff);
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Window Size Used with the Base register to set the address window size and location. Must be programmed from LSB to MSB as sequence of ones followed by sequence of zeros. The number of ones specifies the size of the window in 64 KByte granularity (e.g., a value of 0x00FF specifies 256 = 16 MByte). NOTE: A value of 0x0 specifies 64-KByte size. */
|
unsigned int kw_winctrl_calcsize(unsigned int sizeval)
|
/* Window Size Used with the Base register to set the address window size and location. Must be programmed from LSB to MSB as sequence of ones followed by sequence of zeros. The number of ones specifies the size of the window in 64 KByte granularity (e.g., a value of 0x00FF specifies 256 = 16 MByte). NOTE: A value of 0x0 specifies 64-KByte size. */
unsigned int kw_winctrl_calcsize(unsigned int sizeval)
|
{
int i;
unsigned int j = 0;
u32 val = sizeval >> 1;
for (i = 0; val >= 0x10000; i++) {
j |= (1 << i);
val = val >> 1;
}
return (0x0000ffff & j);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* chsc_chp_vary - propagate channel-path vary operation to subchannels @chpid: channl-path ID @on: non-zero for vary online, zero for vary offline */
|
int chsc_chp_vary(struct chp_id chpid, int on)
|
/* chsc_chp_vary - propagate channel-path vary operation to subchannels @chpid: channl-path ID @on: non-zero for vary online, zero for vary offline */
int chsc_chp_vary(struct chp_id chpid, int on)
|
{
struct chp_link link;
memset(&link, 0, sizeof(struct chp_link));
link.chpid = chpid;
css_wait_for_slow_path();
if (on)
for_each_subchannel_staged(s390_subchannel_vary_chpid_on,
__s390_vary_chpid_on, &link);
else
for_each_subchannel_staged(s390_subchannel_vary_chpid_off,
NULL, &link);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Call PnP BIOS with function 0x02, "set system device node" Input: *nodenum = desired node, boot = whether to set nonvolatile boot (!=0) or volatile current (0) config */
|
static int __pnp_bios_set_dev_node(u8 nodenum, char boot, struct pnp_bios_node *data)
|
/* Call PnP BIOS with function 0x02, "set system device node" Input: *nodenum = desired node, boot = whether to set nonvolatile boot (!=0) or volatile current (0) config */
static int __pnp_bios_set_dev_node(u8 nodenum, char boot, struct pnp_bios_node *data)
|
{
u16 status;
if (!pnp_bios_present())
return PNP_FUNCTION_NOT_SUPPORTED;
if (!boot && pnpbios_dont_use_current_config)
return PNP_FUNCTION_NOT_SUPPORTED;
status = call_pnp_bios(PNP_SET_SYS_DEV_NODE, nodenum, 0, PNP_TS1,
boot ? 2 : 1, PNP_DS, 0, 0, data, 65536, NULL,
0);
return status;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This interface uninstalls the iommu algorighm installed previously. */
|
void uninstall_iommu_arch(const struct iommu_functions *ops)
|
/* This interface uninstalls the iommu algorighm installed previously. */
void uninstall_iommu_arch(const struct iommu_functions *ops)
|
{
if (arch_iommu != ops)
pr_err("%s: not your arch\n", __func__);
arch_iommu = NULL;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Set the specified data to the data holding register of specified DAC channel. */
|
void DAC_SetChData(CM_DAC_TypeDef *DACx, uint16_t u16Ch, uint16_t u16Data)
|
/* Set the specified data to the data holding register of specified DAC channel. */
void DAC_SetChData(CM_DAC_TypeDef *DACx, uint16_t u16Ch, uint16_t u16Data)
|
{
__IO uint16_t *u16DADRx;
DDL_ASSERT(IS_VALID_UNIT(DACx));
DDL_ASSERT(IS_VALID_CH(u16Ch));
if (READ_REG16_BIT(DACx->DACR, DAC_DACR_DPSEL) == DAC_DATA_ALIGN_LEFT) {
DDL_ASSERT(IS_VALID_LEFT_ALIGNED_DATA(u16Data));
} else {
DDL_ASSERT(IS_VALID_RIGHT_ALIGNED_DATA(u16Data));
}
u16DADRx = (uint16_t *)((uint32_t) & (DACx->DADR1) + u16Ch * 2UL);
WRITE_REG16(*u16DADRx, u16Data);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Multibyte read from device. A register read begins with the address and autoincrements for each aditional byte in the transfer. */
|
int32_t adxl372_spi_reg_read_multiple(adxl372_dev *dev, uint8_t reg_addr, uint8_t *reg_data, uint16_t count)
|
/* Multibyte read from device. A register read begins with the address and autoincrements for each aditional byte in the transfer. */
int32_t adxl372_spi_reg_read_multiple(adxl372_dev *dev, uint8_t reg_addr, uint8_t *reg_data, uint16_t count)
|
{
uint8_t buf[1024];
uint16_t i;
int32_t ret;
buf[0] = ADXL372_REG_READ(reg_addr);
memset(&buf[1], 0x00, count);
ret = spi_write_and_read(dev->spi_desc, buf, count + 1);
for (i = 0; i <= count; i++)
reg_data[i] = buf[i+1];
return ret;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Get the port status. This function is required to ACK the port change bits although it will return the port changes in PortState. Bus enumeration code doesn't need to ACK the port change bits. */
|
EFI_STATUS UsbHubGetPortStatus(IN USB_INTERFACE *HubIf, IN UINT8 Port, OUT EFI_USB_PORT_STATUS *PortState)
|
/* Get the port status. This function is required to ACK the port change bits although it will return the port changes in PortState. Bus enumeration code doesn't need to ACK the port change bits. */
EFI_STATUS UsbHubGetPortStatus(IN USB_INTERFACE *HubIf, IN UINT8 Port, OUT EFI_USB_PORT_STATUS *PortState)
|
{
EFI_STATUS Status;
Status = UsbHubCtrlGetPortStatus (HubIf->Device, Port, PortState);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns CR_OK upon successful completion, an error code otherwise. */
|
enum CRStatus cr_input_get_cur_byte_addr(CRInput *a_this, guchar **a_offset)
|
/* Returns CR_OK upon successful completion, an error code otherwise. */
enum CRStatus cr_input_get_cur_byte_addr(CRInput *a_this, guchar **a_offset)
|
{
g_return_val_if_fail (a_this && PRIVATE (a_this) && a_offset,
CR_BAD_PARAM_ERROR);
if (!PRIVATE (a_this)->next_byte_index) {
return CR_START_OF_INPUT_ERROR;
}
*a_offset = cr_input_get_byte_addr
(a_this, PRIVATE (a_this)->next_byte_index - 1);
return CR_OK;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Returns %1 if the host is claimed, %0 otherwise. */
|
int mmc_try_claim_host(struct mmc_host *host)
|
/* Returns %1 if the host is claimed, %0 otherwise. */
int mmc_try_claim_host(struct mmc_host *host)
|
{
int claimed_host = 0;
unsigned long flags;
spin_lock_irqsave(&host->lock, flags);
if (!host->claimed || host->claimer == current) {
host->claimed = 1;
host->claimer = current;
host->claim_cnt += 1;
claimed_host = 1;
}
spin_unlock_irqrestore(&host->lock, flags);
return claimed_host;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check sense key to find if hardware error happens. */
|
BOOLEAN ScsiDiskIsHardwareError(IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts)
|
/* Check sense key to find if hardware error happens. */
BOOLEAN ScsiDiskIsHardwareError(IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts)
|
{
EFI_SCSI_SENSE_DATA *SensePtr;
UINTN Index;
BOOLEAN IsError;
IsError = FALSE;
SensePtr = SenseData;
for (Index = 0; Index < SenseCounts; Index++) {
if (SensePtr->Sense_Key == EFI_SCSI_SK_HARDWARE_ERROR) {
IsError = TRUE;
}
SensePtr++;
}
return IsError;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Check whether the value of a TPM chip register satisfies the input BIT setting. */
|
EFI_STATUS TisPcWaitRegisterBits(IN UINT8 *Register, IN UINT8 BitSet, IN UINT8 BitClear, IN UINT32 TimeOut)
|
/* Check whether the value of a TPM chip register satisfies the input BIT setting. */
EFI_STATUS TisPcWaitRegisterBits(IN UINT8 *Register, IN UINT8 BitSet, IN UINT8 BitClear, IN UINT32 TimeOut)
|
{
UINT8 RegRead;
UINT32 WaitTime;
for (WaitTime = 0; WaitTime < TimeOut; WaitTime += 30) {
RegRead = MmioRead8 ((UINTN)Register);
if (((RegRead & BitSet) == BitSet) && ((RegRead & BitClear) == 0)) {
return EFI_SUCCESS;
}
MicroSecondDelay (30);
}
return EFI_TIMEOUT;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Get the number of buttons on a joystick */
|
int SDL_JoystickNumButtons(SDL_Joystick *joystick)
|
/* Get the number of buttons on a joystick */
int SDL_JoystickNumButtons(SDL_Joystick *joystick)
|
{
if (!SDL_PrivateJoystickValid(joystick)) {
return -1;
}
return joystick->nbuttons;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Toggle SDA by changing the output value of the pin. This is only valid for pins configured as open drain (i.e. setting the value high effectively turns off the output driver.) */
|
static void i2c_gpio_setsda_val(void *data, int state)
|
/* Toggle SDA by changing the output value of the pin. This is only valid for pins configured as open drain (i.e. setting the value high effectively turns off the output driver.) */
static void i2c_gpio_setsda_val(void *data, int state)
|
{
struct i2c_gpio_platform_data *pdata = data;
gpio_set_value(pdata->sda_pin, state);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Add multicast addresses to the internal multicast-hash table. */
|
static void at91ether_sethashtable(struct net_device *dev)
|
/* Add multicast addresses to the internal multicast-hash table. */
static void at91ether_sethashtable(struct net_device *dev)
|
{
struct dev_mc_list *curr;
unsigned long mc_filter[2];
unsigned int i, bitnr;
mc_filter[0] = mc_filter[1] = 0;
curr = dev->mc_list;
for (i = 0; i < dev->mc_count; i++, curr = curr->next) {
if (!curr) break;
bitnr = hash_get_index(curr->dmi_addr);
mc_filter[bitnr >> 5] |= 1 << (bitnr & 31);
}
at91_emac_write(AT91_EMAC_HSL, mc_filter[0]);
at91_emac_write(AT91_EMAC_HSH, mc_filter[1]);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* "irq" really just serves to identify the device. Here is where we map this to the Cobalt APIC entry where it's physically wired. This is called via request_irq -> setup_irq -> irq_desc->startup() */
|
static unsigned int startup_cobalt_irq(unsigned int irq)
|
/* "irq" really just serves to identify the device. Here is where we map this to the Cobalt APIC entry where it's physically wired. This is called via request_irq -> setup_irq -> irq_desc->startup() */
static unsigned int startup_cobalt_irq(unsigned int irq)
|
{
unsigned long flags;
struct irq_desc *desc = irq_to_desc(irq);
spin_lock_irqsave(&cobalt_lock, flags);
if ((desc->status & (IRQ_DISABLED | IRQ_INPROGRESS | IRQ_WAITING)))
desc->status &= ~(IRQ_DISABLED | IRQ_INPROGRESS | IRQ_WAITING);
enable_cobalt_irq(irq);
spin_unlock_irqrestore(&cobalt_lock, flags);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Cleans up the LED blink driver. This is intended to be used upon program exit. */
|
void LedBlinkExit(void)
|
/* Cleans up the LED blink driver. This is intended to be used upon program exit. */
void LedBlinkExit(void)
|
{
LL_GPIO_ResetOutputPin(GPIOE, LL_GPIO_PIN_8);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* This is called to remove the extended PCICA driver information if an AP device is removed. */
|
static void zcrypt_pcica_remove(struct ap_device *ap_dev)
|
/* This is called to remove the extended PCICA driver information if an AP device is removed. */
static void zcrypt_pcica_remove(struct ap_device *ap_dev)
|
{
struct zcrypt_device *zdev = ap_dev->private;
zcrypt_device_unregister(zdev);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns the value of the requested RTC sub second match register. */
|
uint32_t HibernateRTCSSMatchGet(uint32_t ui32Match)
|
/* Returns the value of the requested RTC sub second match register. */
uint32_t HibernateRTCSSMatchGet(uint32_t ui32Match)
|
{
ASSERT(ui32Match == 0);
return (HWREG(HIB_RTCSS) >> HIB_RTCSS_RTCSSM_S);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Get the 4 bits ECC syndrome register value. */
|
int32_t EXMC_NFC_GetSyndrome(uint32_t u32Section, uint16_t au16Synd[], uint8_t u8Len)
|
/* Get the 4 bits ECC syndrome register value. */
int32_t EXMC_NFC_GetSyndrome(uint32_t u32Section, uint16_t au16Synd[], uint8_t u8Len)
|
{
uint32_t u32Status;
DDL_ASSERT(IS_EXMC_NFC_BANK(u32Bank));
WRITE_REG32(CM_NFC->CMDR, CMD_READ_STATUS(u32Bank));
u32Status = READ_REG32(CM_NFC->DATR_BASE);
EXMC_NFC_DeselectChip();
return u32Status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* here we handle the entire vertical page of the update. we write across lcd chips. update_page uses the upper/left values to decide which chip to select for the right. upper is needed for setting the page desired for the write. */
|
static void arcfb_lcd_update_vert(struct arcfb_par *par, unsigned int top, unsigned int bottom, unsigned int left, unsigned int right)
|
/* here we handle the entire vertical page of the update. we write across lcd chips. update_page uses the upper/left values to decide which chip to select for the right. upper is needed for setting the page desired for the write. */
static void arcfb_lcd_update_vert(struct arcfb_par *par, unsigned int top, unsigned int bottom, unsigned int left, unsigned int right)
|
{
unsigned int distance, upper, lower;
distance = (bottom - top) + 1;
upper = top;
lower = top + 7;
while (distance > 0) {
distance -= 8;
arcfb_lcd_update_page(par, upper, left, right, 8);
upper = lower + 1;
lower = upper + 7;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This file is part of the Simba project. */
|
static void print_node(struct binary_tree_node_t *node_p)
|
/* This file is part of the Simba project. */
static void print_node(struct binary_tree_node_t *node_p)
|
{
std_printf(FSTR("key = %d\r\n"), node_p->key);
if (node_p->left_p != NULL) {
std_printf(FSTR("left: "));
print_node(node_p->left_p);
}
if (node_p->right_p != NULL) {
std_printf(FSTR("right: "));
print_node(node_p->right_p);
}
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* open and close: just keep track of how many times the device is mapped, to use the proper memory allocation function. */
|
static void mon_bin_vma_open(struct vm_area_struct *vma)
|
/* open and close: just keep track of how many times the device is mapped, to use the proper memory allocation function. */
static void mon_bin_vma_open(struct vm_area_struct *vma)
|
{
struct mon_reader_bin *rp = vma->vm_private_data;
rp->mmap_active++;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
|
UINT32 EFIAPI PciWrite32(IN UINTN Address, IN UINT32 Value)
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciWrite32(IN UINTN Address, IN UINT32 Value)
|
{
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
return SmmPciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint32, Value);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Sends a setup request RESET ENDPOINT Used after a STALL received during a scsi command. */
|
static void uhi_msc_reset_endpoint(usb_ep_t endp, uhd_callback_setup_end_t callback)
|
/* Sends a setup request RESET ENDPOINT Used after a STALL received during a scsi command. */
static void uhi_msc_reset_endpoint(usb_ep_t endp, uhd_callback_setup_end_t callback)
|
{
usb_setup_req_t req;
req.bmRequestType = USB_REQ_RECIP_ENDPOINT
| USB_REQ_TYPE_STANDARD | USB_REQ_DIR_OUT;
req.bRequest = USB_REQ_CLEAR_FEATURE;
req.wValue = USB_EP_FEATURE_HALT;
req.wIndex = endp;
req.wLength = 0;
if (!uhd_setup_request(uhi_msc_dev_sel->dev->address,
&req, NULL, 0, NULL, callback)) {
callback(uhi_msc_dev_sel->dev->address,UHD_TRANS_DISCONNECT,0);
}
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* it's best to have buff aligned on a 32-bit boundary Egads... That thing apparently assumes that */
|
__wsum csum_partial(const void *buff, int len, __wsum sum)
|
/* it's best to have buff aligned on a 32-bit boundary Egads... That thing apparently assumes that */
__wsum csum_partial(const void *buff, int len, __wsum sum)
|
{
unsigned int result = do_csum(buff, len);
result += (__force u32)sum;
result = (result & 0xffff) + (result >> 16);
return (__force __wsum)result;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Data Nested TLB Fault @ Data Nested TLB Vector Refer to SDM Vol2 Table 5-6 & 8-1 */
|
void nested_dtlb(struct kvm_vcpu *vcpu)
|
/* Data Nested TLB Fault @ Data Nested TLB Vector Refer to SDM Vol2 Table 5-6 & 8-1 */
void nested_dtlb(struct kvm_vcpu *vcpu)
|
{
inject_guest_interruption(vcpu, IA64_DATA_NESTED_TLB_VECTOR);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Check if one transmit buffer is sent out. */
|
uint32_t uart_is_tx_buf_end(Uart *p_uart)
|
/* Check if one transmit buffer is sent out. */
uint32_t uart_is_tx_buf_end(Uart *p_uart)
|
{
return (p_uart->UART_SR & UART_SR_ENDTX) > 0;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* The work function is to set the DNS server list for the EFI IPv4 network stack running on the communication device that this EFI_IP4_CONFIG2_PROTOCOL manages. It is not configurable when the policy is Ip4Config2PolicyDhcp. The DNS server addresses must be unicast IPv4 addresses. */
|
EFI_STATUS Ip4Config2SetDnsServer(IN IP4_CONFIG2_INSTANCE *Instance, IN UINTN DataSize, IN VOID *Data)
|
/* The work function is to set the DNS server list for the EFI IPv4 network stack running on the communication device that this EFI_IP4_CONFIG2_PROTOCOL manages. It is not configurable when the policy is Ip4Config2PolicyDhcp. The DNS server addresses must be unicast IPv4 addresses. */
EFI_STATUS Ip4Config2SetDnsServer(IN IP4_CONFIG2_INSTANCE *Instance, IN UINTN DataSize, IN VOID *Data)
|
{
EFI_STATUS Status;
IP4_CONFIG2_DATA_ITEM *Item;
Status = EFI_SUCCESS;
Item = NULL;
if (Instance->Policy != Ip4Config2PolicyStatic) {
return EFI_WRITE_PROTECTED;
}
Item = &Instance->DataItem[Ip4Config2DataTypeDnsServer];
if (DATA_ATTRIB_SET (Item->Attribute, DATA_ATTRIB_VOLATILE)) {
REMOVE_DATA_ATTRIB (Item->Attribute, DATA_ATTRIB_VOLATILE);
}
if ((Data != NULL) && (DataSize != 0)) {
Status = Ip4Config2SetDnsServerWorker (Instance, DataSize, Data);
} else {
if (Item->Data.Ptr != NULL) {
FreePool (Item->Data.Ptr);
}
Item->Data.Ptr = NULL;
Item->DataSize = 0;
Item->Status = EFI_NOT_FOUND;
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
|
void GPIOPinTypeDIVSCLK(uint32_t ui32Port, uint8_t ui8Pins)
|
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeDIVSCLK(uint32_t ui32Port, uint8_t ui8Pins)
|
{
ASSERT(_GPIOBaseValid(ui32Port));
GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);
GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Disable the corresponding pwm output channel to stop the DC motor. */
|
void AMSDCMotorStop(unsigned long ulMotor)
|
/* Disable the corresponding pwm output channel to stop the DC motor. */
void AMSDCMotorStop(unsigned long ulMotor)
|
{
xASSERT((ulMotor == AMS_MOTOR_A) ||
(ulMotor == AMS_MOTOR_B));
if(ulMotor == AMS_MOTOR_A)
{
xPWMStop(sPWMB_BASE, xPWM_CHANNEL0);
xGPIOSPinWrite(sD9,1);
}
else if(ulMotor == AMS_MOTOR_B)
{
xPWMStop(sPWMA_BASE, xPWM_CHANNEL2);
xGPIOSPinWrite(sD8,1);
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Send STOP_TRANSMISSION command to card to stop ongoing data transferring. */
|
static status_t MMC_StopTransmission(mmc_card_t *card)
|
/* Send STOP_TRANSMISSION command to card to stop ongoing data transferring. */
static status_t MMC_StopTransmission(mmc_card_t *card)
|
{
assert(card);
return SDMMC_StopTransmission(card->host.base, card->host.transfer);
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Return the frequency in kHz corresponding to the given sync period factor. */
|
static u_int ahd_calc_syncsrate(u_int period_factor)
|
/* Return the frequency in kHz corresponding to the given sync period factor. */
static u_int ahd_calc_syncsrate(u_int period_factor)
|
{
int i;
for (i = 0; i < ARRAY_SIZE(scsi_syncrates); i++) {
if (period_factor == scsi_syncrates[i].period_factor) {
return (100000000 / scsi_syncrates[i].period);
}
}
return (10000000 / (period_factor * 4 * 10));
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Copies
All pointer and size alignments are supported. */
|
volatile void* flashcalw_memset16(volatile void *dst, uint16_t src, size_t nbytes, bool erase)
|
/* Copies
All pointer and size alignments are supported. */
volatile void* flashcalw_memset16(volatile void *dst, uint16_t src, size_t nbytes, bool erase)
|
{
return flashcalw_memset32(dst, src | (uint32_t)src << 16, nbytes,
erase);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Configures the I2C Bus Timeout A (SCL Timeout when TIDLE = 0 or Bus idle SCL and SDA high when TIDLE = 1). */
|
void I2C_TimeoutAConfig(I2C_TypeDef *I2Cx, uint16_t Timeout)
|
/* Configures the I2C Bus Timeout A (SCL Timeout when TIDLE = 0 or Bus idle SCL and SDA high when TIDLE = 1). */
void I2C_TimeoutAConfig(I2C_TypeDef *I2Cx, uint16_t Timeout)
|
{
uint32_t tmpreg = 0;
assert_param(IS_I2C_1_PERIPH(I2Cx));
assert_param(IS_I2C_TIMEOUT(Timeout));
tmpreg = I2Cx->TIMEOUTR;
tmpreg &= (uint32_t)~((uint32_t)I2C_TIMEOUTR_TIMEOUTA);
tmpreg |= (uint32_t)((uint32_t)Timeout & I2C_TIMEOUTR_TIMEOUTA) ;
I2Cx->TIMEOUTR = tmpreg;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Remove a connection from the control filesystem (if it exists). Caller must hold fuse_mutex */
|
void fuse_ctl_remove_conn(struct fuse_conn *fc)
|
/* Remove a connection from the control filesystem (if it exists). Caller must hold fuse_mutex */
void fuse_ctl_remove_conn(struct fuse_conn *fc)
|
{
int i;
if (!fuse_control_sb)
return;
for (i = fc->ctl_ndents - 1; i >= 0; i--) {
struct dentry *dentry = fc->ctl_dentry[i];
dentry->d_inode->i_private = NULL;
d_drop(dentry);
dput(dentry);
}
drop_nlink(fuse_control_sb->s_root->d_inode);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Description: Set a single bit in the bitmask. Returns zero on success, negative values on error. */
|
static void cipso_v4_bitmap_setbit(unsigned char *bitmap, u32 bit, u8 state)
|
/* Description: Set a single bit in the bitmask. Returns zero on success, negative values on error. */
static void cipso_v4_bitmap_setbit(unsigned char *bitmap, u32 bit, u8 state)
|
{
u32 byte_spot;
u8 bitmask;
byte_spot = bit / 8;
bitmask = 0x80 >> (bit % 8);
if (state)
bitmap[byte_spot] |= bitmask;
else
bitmap[byte_spot] &= ~bitmask;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* The result must be freed by the caller with kfree(). */
|
char* kobject_get_path(struct kobject *kobj, gfp_t gfp_mask)
|
/* The result must be freed by the caller with kfree(). */
char* kobject_get_path(struct kobject *kobj, gfp_t gfp_mask)
|
{
char *path;
int len;
len = get_kobj_path_length(kobj);
if (len == 0)
return NULL;
path = kzalloc(len, gfp_mask);
if (!path)
return NULL;
fill_kobj_path(kobj, path, len);
return path;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Get the DMIC instance from peripheral base address.
param base DMIC peripheral base address. return DMIC instance. */
|
uint32_t DMIC_GetInstance(DMIC_Type *base)
|
/* Get the DMIC instance from peripheral base address.
param base DMIC peripheral base address. return DMIC instance. */
uint32_t DMIC_GetInstance(DMIC_Type *base)
|
{
uint32_t instance;
for (instance = 0; instance < ARRAY_SIZE(s_dmicBases); instance++)
{
if (s_dmicBases[instance] == base)
{
break;
}
}
assert(instance < ARRAY_SIZE(s_dmicBases));
return instance;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Register a console early on... This is for output before even sn_sal_serial_cosnole_init is called. This function is called from setup.c. This allows us to do really early polled writes. When sn_sal_serial_console_init is called, this console is unregistered and a new one registered. */
|
int __init sn_serial_console_early_setup(void)
|
/* Register a console early on... This is for output before even sn_sal_serial_cosnole_init is called. This function is called from setup.c. This allows us to do really early polled writes. When sn_sal_serial_console_init is called, this console is unregistered and a new one registered. */
int __init sn_serial_console_early_setup(void)
|
{
if (!ia64_platform_is("sn2"))
return -1;
sal_console_port.sc_ops = &poll_ops;
spin_lock_init(&sal_console_port.sc_port.lock);
early_sn_setup();
register_console(&sal_console_early);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns a pointer to a free area with at least 'sz' bytes in buffer 'B'. 'boxidx' is the relative position in the stack where is the buffer's box or its placeholder. */
|
static char* prepbuffsize(luaL_Buffer *B, size_t sz, int boxidx)
|
/* Returns a pointer to a free area with at least 'sz' bytes in buffer 'B'. 'boxidx' is the relative position in the stack where is the buffer's box or its placeholder. */
static char* prepbuffsize(luaL_Buffer *B, size_t sz, int boxidx)
|
{
lua_State *L = B->L;
char *newbuff;
size_t newsize = newbuffsize(B, sz);
if (buffonstack(B))
newbuff = (char *)resizebox(L, boxidx, newsize);
else {
lua_remove(L, boxidx);
newbox(L);
lua_insert(L, boxidx);
lua_toclose(L, boxidx);
newbuff = (char *)resizebox(L, boxidx, newsize);
memcpy(newbuff, B->b, B->n * sizeof(char));
}
B->b = newbuff;
B->size = newsize;
return newbuff + B->n;
}
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Enable/disable the FIFO mode of the specified SPI port.
The */
|
void SPIFIFOModeSet(unsigned long ulBase, xtBoolean xtEnable, unsigned long ulInterval)
|
/* Enable/disable the FIFO mode of the specified SPI port.
The */
void SPIFIFOModeSet(unsigned long ulBase, xtBoolean xtEnable, unsigned long ulInterval)
|
{
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) );
xASSERT((ulInterval == 0) ||((ulInterval >= 2) && (ulInterval <= 15)));
if (xtEnable)
{
xHWREG(ulBase + SPI_CNTRL) &= ~SPI_CNTRL_SP_CYCLE_M;
xHWREG(ulBase + SPI_CNTRL) |= (ulInterval << SPI_CNTRL_SP_CYCLE_S);
xHWREG(ulBase + SPI_CNTRL) |= SPI_CNTRL_FIFO;
}
else
{
xHWREG(ulBase + SPI_CNTRL) &= ~SPI_CNTRL_FIFO;
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.