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 returns if all capsule images are processed. */
|
BOOLEAN AreAllImagesProcessed(VOID)
|
/* This function returns if all capsule images are processed. */
BOOLEAN AreAllImagesProcessed(VOID)
|
{
UINTN Index;
for (Index = 0; Index < mCapsuleTotalNumber; Index++) {
if (mCapsuleStatusArray[Index] == EFI_NOT_READY) {
return FALSE;
}
}
return TRUE;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Conversion functions: convert a page and protection to a page entry, and a page entry and page directory to the page they refer to. */
|
static pte_t sun4c_mk_pte(struct page *page, pgprot_t pgprot)
|
/* Conversion functions: convert a page and protection to a page entry, and a page entry and page directory to the page they refer to. */
static pte_t sun4c_mk_pte(struct page *page, pgprot_t pgprot)
|
{
return __pte(page_to_pfn(page) | pgprot_val(pgprot));
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* beiscsi_put_cid - Free the cid @phba: The phba for which the cid is being freed @cid: The cid to free */
|
static void beiscsi_put_cid(struct beiscsi_hba *phba, unsigned short cid)
|
/* beiscsi_put_cid - Free the cid @phba: The phba for which the cid is being freed @cid: The cid to free */
static void beiscsi_put_cid(struct beiscsi_hba *phba, unsigned short cid)
|
{
phba->avlbl_cids++;
phba->cid_array[phba->cid_free++] = cid;
if (phba->cid_free == phba->params.cxns_per_ctrl)
phba->cid_free = 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function handles RTC Auto wake-up interrupt request. */
|
void RTC_WKUP_IRQHandler(void)
|
/* This function handles RTC Auto wake-up interrupt request. */
void RTC_WKUP_IRQHandler(void)
|
{
if(RTC_GetITStatus(RTC_IT_WUT) != RESET)
{
STM_EVAL_LEDToggle(LED4);
RTC_ClearITPendingBit(RTC_IT_WUT);
EXTI_ClearITPendingBit(EXTI_Line22);
}
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Finish the table access 'val = t'. if 'slot' is NULL, 't' is not a table; otherwise, 'slot' points to t entry (which must be nil). */
|
void luaV_finishget(lua_State *L, const TValue *t, TValue *key, StkId val, const TValue *slot)
|
/* Finish the table access 'val = t'. if 'slot' is NULL, 't' is not a table; otherwise, 'slot' points to t entry (which must be nil). */
void luaV_finishget(lua_State *L, const TValue *t, TValue *key, StkId val, const TValue *slot)
|
{
int loop;
const TValue *tm;
for (loop = 0; loop < MAXTAGLOOP; loop++) {
if (slot == NULL) {
lua_assert(!ttistable(t));
tm = luaT_gettmbyobj(L, t, TM_INDEX);
if (ttisnil(tm))
luaG_typeerror(L, t, "index");
}
else {
lua_assert(ttisnil(slot));
tm = fasttm(L, hvalue(t)->metatable, TM_INDEX);
if (tm == NULL) {
setnilvalue(val);
return;
}
}
if (ttisfunction(tm)) {
luaT_callTM(L, tm, t, key, val, 1);
return;
}
t = tm;
if (luaV_fastget(L,t,key,slot,luaH_get)) {
setobj2s(L, val, slot);
return;
}
}
luaG_runerror(L, "'__index' chain too long; possible loop");
}
|
nodemcu/nodemcu-firmware
|
C++
|
MIT License
| 7,566
|
/* generic_file_read updates the atime of upper layer inode. But, it doesn't give us a chance to update the atime of the lower layer inode. This function is a wrapper to generic_file_read. It updates the atime of the lower level inode if generic_file_read returns without any errors. This is to be used only for file reads. The function to be used for directory reads is ecryptfs_read. */
|
static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos)
|
/* generic_file_read updates the atime of upper layer inode. But, it doesn't give us a chance to update the atime of the lower layer inode. This function is a wrapper to generic_file_read. It updates the atime of the lower level inode if generic_file_read returns without any errors. This is to be used only for file reads. The function to be used for directory reads is ecryptfs_read. */
static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos)
|
{
int rc;
struct dentry *lower_dentry;
struct vfsmount *lower_vfsmount;
struct file *file = iocb->ki_filp;
rc = generic_file_aio_read(iocb, iov, nr_segs, pos);
if (-EIOCBQUEUED == rc)
rc = wait_on_sync_kiocb(iocb);
if (rc >= 0) {
lower_dentry = ecryptfs_dentry_to_lower(file->f_path.dentry);
lower_vfsmount = ecryptfs_dentry_to_lower_mnt(file->f_path.dentry);
touch_atime(lower_vfsmount, lower_dentry);
}
return rc;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Processes a single SMP packet and sends the corresponding response(s). */
|
static int smp_process_packet(struct smp_transport *smpt, struct net_buf *nb)
|
/* Processes a single SMP packet and sends the corresponding response(s). */
static int smp_process_packet(struct smp_transport *smpt, struct net_buf *nb)
|
{
struct cbor_nb_reader reader;
struct cbor_nb_writer writer;
struct smp_streamer streamer;
int rc;
streamer = (struct smp_streamer) {
.reader = &reader,
.writer = &writer,
.smpt = smpt,
};
rc = smp_process_request_packet(&streamer, nb);
return rc;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Returns 0 or -EOPNOTSUPP if no transceiver is handling the udc */
|
static int pxa_udc_vbus_draw(struct usb_gadget *_gadget, unsigned mA)
|
/* Returns 0 or -EOPNOTSUPP if no transceiver is handling the udc */
static int pxa_udc_vbus_draw(struct usb_gadget *_gadget, unsigned mA)
|
{
struct pxa_udc *udc;
udc = to_gadget_udc(_gadget);
if (udc->transceiver)
return otg_set_power(udc->transceiver, mA);
return -EOPNOTSUPP;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Waits for data from the specified data line. */
|
void I2SDataGet(unsigned long ulBase, unsigned long ulDataLine, unsigned long *pulData)
|
/* Waits for data from the specified data line. */
void I2SDataGet(unsigned long ulBase, unsigned long ulDataLine, unsigned long *pulData)
|
{
ulDataLine = (ulDataLine-1) << 2;
while(!(HWREG(ulBase + MCASP_O_RXSTAT) & MCASP_RXSTAT_RDATA))
{
}
*pulData = HWREG(ulBase + MCASP_O_RXBUF0 + ulDataLine);
}
|
micropython/micropython
|
C++
|
Other
| 18,334
|
/* 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==LPUART1)
{
__HAL_RCC_LPUART1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOG, ARD_D0_Pin|ARD_D1_Pin);
}
else if(huart->Instance==USART1)
{
__HAL_RCC_USART1_CLK_DISABLE();
HAL_GPIO_DeInit(USART1_TX_GPIO_Port, USART1_TX_Pin);
HAL_GPIO_DeInit(GPIOG, UART1_RX_Pin|UART1_CTS_Pin|UART1_RTS_Pin);
}
else if(huart->Instance==USART2)
{
__HAL_RCC_USART2_CLK_DISABLE();
HAL_GPIO_DeInit(USART2_RX_GPIO_Port, USART2_RX_Pin);
HAL_GPIO_DeInit(USART2_TX_GPIO_Port, USART2_TX_Pin);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* efi_is_runtime_service_pointer() - check if pointer points to runtime table */
|
static bool efi_is_runtime_service_pointer(void *p)
|
/* efi_is_runtime_service_pointer() - check if pointer points to runtime table */
static bool efi_is_runtime_service_pointer(void *p)
|
{
return (p >= (void *)&efi_runtime_services.get_time &&
p <= (void *)&efi_runtime_services.query_variable_info) ||
p == (void *)&efi_events.prev ||
p == (void *)&efi_events.next;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Get the DMA remaining Byte Count of a channel. */
|
unsigned long DMARemainTransferCountGet(unsigned long ulChannelID)
|
/* Get the DMA remaining Byte Count of a channel. */
unsigned long DMARemainTransferCountGet(unsigned long ulChannelID)
|
{
xASSERT(xDMAChannelIDValid(ulChannelID));
return xHWREG(g_psDMAChannel[ulChannelID] + 4);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Implementation of handler named in startup code.
Passes 0 to generic PWM IRQ handler. */
|
void PWMA_RELOAD2_IRQHandler(void)
|
/* Implementation of handler named in startup code.
Passes 0 to generic PWM IRQ handler. */
void PWMA_RELOAD2_IRQHandler(void)
|
{
PWM_HAL_ClearReloadFlag(g_pwmBase[0], 2U);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* this is called from uncommit in the forced-shutdown path. we need to check to see if the reference count on the log item is going to drop to zero. If so, unpin will free the log item so we need to free the item's descriptor (that points to the item) in the transaction. */
|
STATIC void xfs_buf_item_unpin_remove(xfs_buf_log_item_t *bip, xfs_trans_t *tp)
|
/* this is called from uncommit in the forced-shutdown path. we need to check to see if the reference count on the log item is going to drop to zero. If so, unpin will free the log item so we need to free the item's descriptor (that points to the item) in the transaction. */
STATIC void xfs_buf_item_unpin_remove(xfs_buf_log_item_t *bip, xfs_trans_t *tp)
|
{
xfs_buf_t *bp;
xfs_log_item_desc_t *lidp;
int stale = 0;
bp = bip->bli_buf;
if ((atomic_read(&bip->bli_refcount) == 1) &&
(bip->bli_flags & XFS_BLI_STALE)) {
ASSERT(XFS_BUF_VALUSEMA(bip->bli_buf) <= 0);
trace_xfs_buf_item_unpin_stale(bip);
lidp = xfs_trans_find_item(tp, (xfs_log_item_t *) bip);
stale = lidp->lid_flags & XFS_LID_BUF_STALE;
xfs_trans_free_item(tp, lidp);
XFS_BUF_SET_FSPRIVATE2(bp, NULL);
}
xfs_buf_item_unpin(bip, stale);
return;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Command response callback function for sd_ble_gap_scan_stop BLE command.
Callback for decoding the output parameters and the command response return code. */
|
static uint32_t gap_scan_stop_rsp_dec(const uint8_t *p_buffer, uint16_t length)
|
/* Command response callback function for sd_ble_gap_scan_stop BLE command.
Callback for decoding the output parameters and the command response return code. */
static uint32_t gap_scan_stop_rsp_dec(const uint8_t *p_buffer, uint16_t length)
|
{
uint32_t result_code = 0;
const uint32_t err_code = ble_gap_scan_stop_rsp_dec(p_buffer,
length,
&result_code);
APP_ERROR_CHECK(err_code);
return result_code;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* If the requested operation results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
|
RETURN_STATUS EFIAPI SafeIntnAdd(IN INTN Augend, IN INTN Addend, OUT INTN *Result)
|
/* If the requested operation results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeIntnAdd(IN INTN Augend, IN INTN Addend, OUT INTN *Result)
|
{
return SafeInt64Add ((INT64)Augend, (INT64)Addend, (INT64 *)Result);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns: 0 on success < 0 on error */
|
int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info)
|
/* Returns: 0 on success < 0 on error */
int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info)
|
{
struct aggregator *aggregator = NULL;
struct port *port;
for (port = __get_first_port(bond); port; port = __get_next_port(port)) {
if (port->aggregator && port->aggregator->is_active) {
aggregator = port->aggregator;
break;
}
}
if (aggregator) {
ad_info->aggregator_id = aggregator->aggregator_identifier;
ad_info->ports = aggregator->num_of_ports;
ad_info->actor_key = aggregator->actor_oper_aggregator_key;
ad_info->partner_key = aggregator->partner_oper_aggregator_key;
memcpy(ad_info->partner_system, aggregator->partner_system.mac_addr_value, ETH_ALEN);
return 0;
}
return -1;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Registers an interrupt handler for the LPC module. */
|
void LPCIntRegister(unsigned long ulBase, void(*pfnHandler)(void))
|
/* Registers an interrupt handler for the LPC module. */
void LPCIntRegister(unsigned long ulBase, void(*pfnHandler)(void))
|
{
ASSERT(ulBase == LPC0_BASE);
ASSERT(pfnHandler != 0);
IntRegister(INT_LPC0, pfnHandler);
IntEnable(INT_LPC0);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Start of encryption or decryption on data buffers.
This blocking method transfers input buffer of specified length to the cryptographic coprocessor, and instructs him to begin of ciphering or deciphering. It waits for data to be ready, and then fills the processed data to output buffer. */
|
uint32_t crypto_process_block(uint32_t *inp, uint32_t *outp, uint32_t length)
|
/* Start of encryption or decryption on data buffers.
This blocking method transfers input buffer of specified length to the cryptographic coprocessor, and instructs him to begin of ciphering or deciphering. It waits for data to be ready, and then fills the processed data to output buffer. */
uint32_t crypto_process_block(uint32_t *inp, uint32_t *outp, uint32_t length)
|
{
uint32_t rd = 0, wr = 0;
while (rd != length) {
if ((wr < length) && (CRYP_SR & CRYP_SR_IFNF)) {
CRYP_DIN = *inp++;
wr++;
}
if (CRYP_SR & CRYP_SR_OFNE) {
*outp++ = CRYP_DOUT;
rd++;
}
}
crypto_wait_busy();
return wr;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Read an SGE egress context. The caller is responsible for ensuring only one context operation occurs at a time. */
|
static int t3_sge_read_context(unsigned int type, struct adapter *adapter, unsigned int id, u32 data[4])
|
/* Read an SGE egress context. The caller is responsible for ensuring only one context operation occurs at a time. */
static int t3_sge_read_context(unsigned int type, struct adapter *adapter, unsigned int id, u32 data[4])
|
{
if (t3_read_reg(adapter, A_SG_CONTEXT_CMD) & F_CONTEXT_CMD_BUSY)
return -EBUSY;
t3_write_reg(adapter, A_SG_CONTEXT_CMD,
V_CONTEXT_CMD_OPCODE(0) | type | V_CONTEXT(id));
if (t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, 0,
SG_CONTEXT_CMD_ATTEMPTS, 1))
return -EIO;
data[0] = t3_read_reg(adapter, A_SG_CONTEXT_DATA0);
data[1] = t3_read_reg(adapter, A_SG_CONTEXT_DATA1);
data[2] = t3_read_reg(adapter, A_SG_CONTEXT_DATA2);
data[3] = t3_read_reg(adapter, A_SG_CONTEXT_DATA3);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */
|
UINT8 EFIAPI S3MmioAnd8(IN UINTN Address, IN UINT8 AndData)
|
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */
UINT8 EFIAPI S3MmioAnd8(IN UINTN Address, IN UINT8 AndData)
|
{
return InternalSaveMmioWrite8ValueToBootScript (Address, MmioAnd8 (Address, AndData));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Reads the current X position using the ADC. */
|
uint32_t tsReadX(void)
|
/* Reads the current X position using the ADC. */
uint32_t tsReadX(void)
|
{
if (!_tsInitialised) tsInit();
TS_XP_FUNC_GPIO;
TS_XM_FUNC_GPIO;
TS_YM_FUNC_GPIO;
gpioSetDir (TS_XP_PORT, TS_XP_PIN, 1);
gpioSetDir (TS_XM_PORT, TS_XM_PIN, 1);
gpioSetDir (TS_YM_PORT, TS_YM_PIN, 0);
gpioSetValue(TS_XP_PORT, TS_XP_PIN, 1);
gpioSetValue(TS_XM_PORT, TS_XM_PIN, 0);
TS_YP_FUNC_ADC;
return adcRead(TS_YP_ADC_CHANNEL);
}
|
microbuilder/LPC1343CodeBase
|
C++
|
Other
| 73
|
/* Returns the last ADC1 and ADC2 OR last ADC3 and ADC4 conversion result data in dual mode. */
|
uint32_t ADC_GetDualModeConversionDat(ADC_Module *ADCx)
|
/* Returns the last ADC1 and ADC2 OR last ADC3 and ADC4 conversion result data in dual mode. */
uint32_t ADC_GetDualModeConversionDat(ADC_Module *ADCx)
|
{
assert_param(IsAdcModule(ADCx));
if ((ADCx==ADC1) | (ADCx==ADC2))
return (uint32_t)ADC1->DAT;
else
return (uint32_t)ADC3->DAT;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* memcmp - Compare two areas of memory @cs: One area of memory @ct: Another area of memory @count: The size of the area. */
|
int memcmp(const void *cs, const void *ct, size_t n)
|
/* memcmp - Compare two areas of memory @cs: One area of memory @ct: Another area of memory @count: The size of the area. */
int memcmp(const void *cs, const void *ct, size_t n)
|
{
register unsigned long r2 asm("2") = (unsigned long) cs;
register unsigned long r3 asm("3") = (unsigned long) n;
register unsigned long r4 asm("4") = (unsigned long) ct;
register unsigned long r5 asm("5") = (unsigned long) n;
int ret;
asm volatile ("0: clcle %1,%3,0\n"
" jo 0b\n"
" ipm %0\n"
" srl %0,28"
: "=&d" (ret), "+a" (r2), "+a" (r3), "+a" (r4), "+a" (r5)
: : "cc" );
if (ret)
ret = *(char *) r2 - *(char *) r4;
return ret;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This routine is called, for example, when the rmmod command is executed. The device may or may not be electrically present. If it is present, the driver stops device processing. Any resources used on behalf of this device are freed. */
|
static void dwc2_driver_remove(struct pci_dev *dev)
|
/* This routine is called, for example, when the rmmod command is executed. The device may or may not be electrically present. If it is present, the driver stops device processing. Any resources used on behalf of this device are freed. */
static void dwc2_driver_remove(struct pci_dev *dev)
|
{
struct dwc2_hsotg *hsotg = pci_get_drvdata(dev);
dwc2_hcd_remove(hsotg);
pci_disable_device(dev);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Convert the absolute value of Bn into big-endian form and store it at Buf. The Buf array should have at least */
|
INTN EFIAPI BigNumToBin(IN CONST VOID *Bn, OUT UINT8 *Buf)
|
/* Convert the absolute value of Bn into big-endian form and store it at Buf. The Buf array should have at least */
INTN EFIAPI BigNumToBin(IN CONST VOID *Bn, OUT UINT8 *Buf)
|
{
CALL_CRYPTO_SERVICE (BigNumToBin, (Bn, Buf), -1);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base Quad Timer peripheral base address param channel Quad Timer channel number param mask The DMA to enable. This is a logical OR of members of the enumeration ::qtmr_dma_enable_t */
|
void QTMR_DisableDma(TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask)
|
/* param base Quad Timer peripheral base address param channel Quad Timer channel number param mask The DMA to enable. This is a logical OR of members of the enumeration ::qtmr_dma_enable_t */
void QTMR_DisableDma(TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask)
|
{
uint16_t reg;
reg = base->CHANNEL[channel].DMA;
if ((mask & (uint32_t)kQTMR_InputEdgeFlagDmaEnable) != 0U)
{
reg &= ~(uint16_t)TMR_DMA_IEFDE_MASK;
}
if ((mask & (uint32_t)kQTMR_ComparatorPreload1DmaEnable) != 0U)
{
reg &= ~(uint16_t)TMR_DMA_CMPLD1DE_MASK;
}
if ((mask & (uint32_t)kQTMR_ComparatorPreload2DmaEnable) != 0U)
{
reg &= ~(uint16_t)TMR_DMA_CMPLD2DE_MASK;
}
base->CHANNEL[channel].DMA = reg;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* This routine is called by the kernel to write a series of characters to the tty device. The characters may come from user space or kernel space. This routine will return the number of characters actually accepted for writing. */
|
static int sclp_tty_write(struct tty_struct *tty, const unsigned char *buf, int count)
|
/* This routine is called by the kernel to write a series of characters to the tty device. The characters may come from user space or kernel space. This routine will return the number of characters actually accepted for writing. */
static int sclp_tty_write(struct tty_struct *tty, const unsigned char *buf, int count)
|
{
if (sclp_tty_chars_count > 0) {
sclp_tty_write_string(sclp_tty_chars, sclp_tty_chars_count, 0);
sclp_tty_chars_count = 0;
}
return sclp_tty_write_string(buf, count, 1);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Update an ARM MOVT or MOVW immediate instruction immediate data. */
|
VOID ThumbMovtImmediatePatch(IN OUT UINT16 *Instruction, IN UINT16 Address)
|
/* Update an ARM MOVT or MOVW immediate instruction immediate data. */
VOID ThumbMovtImmediatePatch(IN OUT UINT16 *Instruction, IN UINT16 Address)
|
{
UINT16 Patch;
Patch = ((Address >> 12) & 0x000f);
Patch |= (((Address & BIT11) != 0) ? BIT10 : 0);
*Instruction = (*Instruction & ~0x040f) | Patch;
Patch = Address & 0x000000ff;
Patch |= ((Address << 4) & 0x00007000);
Instruction++;
*Instruction = (*Instruction & ~0x70ff) | Patch;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Make sure the internal PRNG is initialised (but not necessarily seeded properly yet). */
|
static int rng_init(br_ssl_engine_context *cc)
|
/* Make sure the internal PRNG is initialised (but not necessarily seeded properly yet). */
static int rng_init(br_ssl_engine_context *cc)
|
{
const br_hash_class *h;
if (cc->rng_init_done != 0) {
return 1;
}
h = br_multihash_getimpl(&cc->mhash, br_sha256_ID);
if (!h) {
h = br_multihash_getimpl(&cc->mhash, br_sha384_ID);
if (!h) {
h = br_multihash_getimpl(&cc->mhash,
br_sha1_ID);
if (!h) {
br_ssl_engine_fail(cc, BR_ERR_BAD_STATE);
return 0;
}
}
}
br_hmac_drbg_init(&cc->rng, h, NULL, 0);
cc->rng_init_done = 1;
return 1;
}
|
arendst/Tasmota
|
C++
|
GNU General Public License v3.0
| 21,318
|
/* Returns pointer to stats struct of this interface. */
|
static struct net_device_stats* netiucv_stats(struct net_device *dev)
|
/* Returns pointer to stats struct of this interface. */
static struct net_device_stats* netiucv_stats(struct net_device *dev)
|
{
struct netiucv_priv *priv = netdev_priv(dev);
IUCV_DBF_TEXT(trace, 5, __func__);
return &priv->stats;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Now that the traversal is complete, we need to remove the cursor from the list of traversing cursors. Avoid removing the embedded push cursor, but use the fact it is always present to make the list deletion simple. */
|
void xfs_trans_ail_cursor_done(struct xfs_ail *ailp, struct xfs_ail_cursor *done)
|
/* Now that the traversal is complete, we need to remove the cursor from the list of traversing cursors. Avoid removing the embedded push cursor, but use the fact it is always present to make the list deletion simple. */
void xfs_trans_ail_cursor_done(struct xfs_ail *ailp, struct xfs_ail_cursor *done)
|
{
struct xfs_ail_cursor *prev = NULL;
struct xfs_ail_cursor *cur;
done->item = NULL;
if (done == &ailp->xa_cursors)
return;
prev = &ailp->xa_cursors;
for (cur = prev->next; cur; prev = cur, cur = prev->next) {
if (cur == done) {
prev->next = cur->next;
break;
}
}
ASSERT(cur);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Set the specified data holding register value for DAC channel2. */
|
void DAC_SetChannel2Data(DAC_TypeDef *DACx, uint32_t DAC_Align, uint16_t Data)
|
/* Set the specified data holding register value for DAC channel2. */
void DAC_SetChannel2Data(DAC_TypeDef *DACx, uint32_t DAC_Align, uint16_t Data)
|
{
__IO uint32_t tmp = 0;
assert_param(IS_DAC_LIST1_PERIPH(DACx));
assert_param(IS_DAC_ALIGN(DAC_Align));
assert_param(IS_DAC_DATA(Data));
tmp = (uint32_t)DACx;
tmp += DHR12R2_OFFSET + DAC_Align;
*(__IO uint32_t *)tmp = Data;
}
|
avem-labs/Avem
|
C++
|
MIT License
| 1,752
|
/* Check if the RTOS kernel is already started. */
|
int32_t osKernelRunning(void)
|
/* Check if the RTOS kernel is already started. */
int32_t osKernelRunning(void)
|
{
return z_has_thread_started(&z_main_thread);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
|
EFI_STATUS EFIAPI FatComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
|
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI FatComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
|
{
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mFatDriverNameTable,
DriverName,
(BOOLEAN)(This == &gFatComponentName)
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Resets a network adapter and leaves it in a state that is safe for another driver to initialize. */
|
EFI_STATUS EmuSnpShutdown(IN EMU_SNP_PROTOCOL *This)
|
/* Resets a network adapter and leaves it in a state that is safe for another driver to initialize. */
EFI_STATUS EmuSnpShutdown(IN EMU_SNP_PROTOCOL *This)
|
{
EMU_SNP_PRIVATE *Private;
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
return EFI_UNSUPPORTED;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Some parts are based on David Boucher's viafb ( */
|
void svga_wcrt_multi(const struct vga_regset *regset, u32 value)
|
/* Some parts are based on David Boucher's viafb ( */
void svga_wcrt_multi(const struct vga_regset *regset, u32 value)
|
{
regval = vga_rcrt(NULL, regset->regnum);
bitnum = regset->lowbit;
while (bitnum <= regset->highbit) {
bitval = 1 << bitnum;
regval = regval & ~bitval;
if (value & 1) regval = regval | bitval;
bitnum ++;
value = value >> 1;
}
vga_wcrt(NULL, regset->regnum, regval);
regset ++;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function get the thread creation stacksize attribute in the attr object. */
|
int pthread_attr_getstacksize(pthread_attr_t const *attr, size_t *stack_size)
|
/* This function get the thread creation stacksize attribute in the attr object. */
int pthread_attr_getstacksize(pthread_attr_t const *attr, size_t *stack_size)
|
{
RT_ASSERT(attr != RT_NULL);
*stack_size = attr->stacksize;
return 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns 0 if no waiting is needed or when no waiting is needed but the starting point should be reset (to current); or the number of milliseconds to wait to get back under the speed limit. */
|
timediff_t Curl_pgrsLimitWaitTime(curl_off_t cursize, curl_off_t startsize, curl_off_t limit, struct curltime start, struct curltime now)
|
/* Returns 0 if no waiting is needed or when no waiting is needed but the starting point should be reset (to current); or the number of milliseconds to wait to get back under the speed limit. */
timediff_t Curl_pgrsLimitWaitTime(curl_off_t cursize, curl_off_t startsize, curl_off_t limit, struct curltime start, struct curltime now)
|
{
curl_off_t size = cursize - startsize;
time_t minimum;
time_t actual;
if(!limit || !size)
return 0;
if(size < CURL_OFF_T_MAX/1000)
minimum = (time_t) (CURL_OFF_T_C(1000) * size / limit);
else {
minimum = (time_t) (size / limit);
if(minimum < TIME_T_MAX/1000)
minimum *= 1000;
else
minimum = TIME_T_MAX;
}
actual = Curl_timediff(now, start);
if(actual < minimum) {
return (minimum - actual);
}
return 0;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Interrupts use a ring buffer on r6xx/r7xx hardware. It works pretty the same as the CP ring buffer, but in reverse. Rather than the CPU writing to the ring and the GPU consuming, the GPU writes to the ring and host consumes. As the host irq handler processes interrupts, it increments the rptr. When the rptr catches up with the wptr, all the current interrupts have been processed. */
|
void r600_ih_ring_init(struct radeon_device *rdev, unsigned ring_size)
|
/* Interrupts use a ring buffer on r6xx/r7xx hardware. It works pretty the same as the CP ring buffer, but in reverse. Rather than the CPU writing to the ring and the GPU consuming, the GPU writes to the ring and host consumes. As the host irq handler processes interrupts, it increments the rptr. When the rptr catches up with the wptr, all the current interrupts have been processed. */
void r600_ih_ring_init(struct radeon_device *rdev, unsigned ring_size)
|
{
u32 rb_bufsz;
rb_bufsz = drm_order(ring_size / 4);
ring_size = (1 << rb_bufsz) * 4;
rdev->ih.ring_size = ring_size;
rdev->ih.ptr_mask = rdev->ih.ring_size - 1;
rdev->ih.rptr = 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* brief Clear the error flag for locked 1MHz clock out. */
|
void CLOCK_OSC_ClearLocked1MHzErrorFlag(void)
|
/* brief Clear the error flag for locked 1MHz clock out. */
void CLOCK_OSC_ClearLocked1MHzErrorFlag(void)
|
{
ANATOP_AI_Write(kAI_Itf_400m, kAI_RCOSC400M_CTRL3_SET, AI_RCOSC400M_CTRL3_CLR_ERR_MASK);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The PWMB default IRQ, declared in StartUp code. */
|
void PWM1CH3_IRQHandler(void)
|
/* The PWMB default IRQ, declared in StartUp code. */
void PWM1CH3_IRQHandler(void)
|
{
unsigned long ulPWMStastus;
unsigned long ulBase = PWMB_BASE;
ulPWMStastus = xHWREG(ulBase + PWM_INTSTS) & 0x08080808;
xHWREG(ulBase + PWM_INTSTS) = ulPWMStastus;
if (g_pfnPWMHandlerCallbacks[0] != 0)
{
if(ulPWMStastus & 0x0808)
{
g_pfnPWMHandlerCallbacks[1](0, PWM_EVENT_PWM, ulPWMStastus, 0);
}
if((ulPWMStastus & 0x08080000))
{
g_pfnPWMHandlerCallbacks[1](0, PWM_EVENT_CAP, (1 << PWM_CHANNEL3), 0);
}
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* tears down and the main mci kobject from the mc_kset */
|
void edac_mc_unregister_sysfs_main_kobj(struct mem_ctl_info *mci)
|
/* tears down and the main mci kobject from the mc_kset */
void edac_mc_unregister_sysfs_main_kobj(struct mem_ctl_info *mci)
|
{
kobject_put(&mci->edac_mci_kobj);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Sets a new pseudo to a PSEUDO additional selector. */
|
void cr_additional_sel_set_pseudo(CRAdditionalSel *a_this, CRPseudo *a_pseudo)
|
/* Sets a new pseudo to a PSEUDO additional selector. */
void cr_additional_sel_set_pseudo(CRAdditionalSel *a_this, CRPseudo *a_pseudo)
|
{
g_return_if_fail (a_this
&& a_this->type == PSEUDO_CLASS_ADD_SELECTOR);
if (a_this->content.pseudo) {
cr_pseudo_destroy (a_this->content.pseudo);
}
a_this->content.pseudo = a_pseudo;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Send a master data receive request with an NACK when the master have obtained control of the bus(Write Step2).
For this function returns immediately, it is always using in the interrupt hander. */
|
void xI2CMasterReadLastRequestS2(unsigned long ulBase)
|
/* Send a master data receive request with an NACK when the master have obtained control of the bus(Write Step2).
For this function returns immediately, it is always using in the interrupt hander. */
void xI2CMasterReadLastRequestS2(unsigned long ulBase)
|
{
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE) ||
(ulBase == I2C2_BASE) || (ulBase == I2C3_BASE) ||
(ulBase == I2C4_BASE));
xHWREG(ulBase + I2C_CON) &= ~I2C_CON_AA;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Clear the VSP control panel. Used to "erase" an SRC that was previously displayed. */
|
static void mf_clear_src(void)
|
/* Clear the VSP control panel. Used to "erase" an SRC that was previously displayed. */
static void mf_clear_src(void)
|
{
signal_ce_msg_simple(0x4b, NULL);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Set the specified data holding register value for DAC channel 2. */
|
void DAC_ConfigChannel2Data(DAC_ALIGN_T align, uint16_t data)
|
/* Set the specified data holding register value for DAC channel 2. */
void DAC_ConfigChannel2Data(DAC_ALIGN_T align, uint16_t data)
|
{
__IO uint32_t temp = 0;
temp = (uint32_t)DAC_BASE;
temp += 0x00000014 + align;
*(__IO uint32_t *) temp = data;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Waits for the given number of milliseconds (using the g_ul_ms_ticks generated by the SAM's microcontrollers's system tick). */
|
static void mdelay(uint32_t ul_dly_ticks)
|
/* Waits for the given number of milliseconds (using the g_ul_ms_ticks generated by the SAM's microcontrollers's system tick). */
static void mdelay(uint32_t ul_dly_ticks)
|
{
uint32_t ul_cur_ticks;
ul_cur_ticks = g_ul_ms_ticks;
while ((g_ul_ms_ticks - ul_cur_ticks) < ul_dly_ticks);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Write the config space of a given PCI device (both normal and extended). */
|
STATIC RETURN_STATUS EFIAPI SegmentDevWriteConfig(IN PCI_CAP_DEV *PciDevice, IN UINT16 DestinationOffset, IN VOID *SourceBuffer, IN UINT16 Size)
|
/* Write the config space of a given PCI device (both normal and extended). */
STATIC RETURN_STATUS EFIAPI SegmentDevWriteConfig(IN PCI_CAP_DEV *PciDevice, IN UINT16 DestinationOffset, IN VOID *SourceBuffer, IN UINT16 Size)
|
{
SEGMENT_DEV *SegmentDev;
UINT16 ConfigSpaceSize;
UINT64 DestinationAddress;
SegmentDev = SEGMENT_DEV_FROM_PCI_CAP_DEV (PciDevice);
ConfigSpaceSize = (SegmentDev->MaxDomain == PciCapNormal ?
PCI_MAX_CONFIG_OFFSET : PCI_EXP_MAX_CONFIG_OFFSET);
if (DestinationOffset + Size > ConfigSpaceSize) {
return RETURN_UNSUPPORTED;
}
DestinationAddress = PCI_SEGMENT_LIB_ADDRESS (
SegmentDev->SegmentNr,
SegmentDev->BusNr,
SegmentDev->DeviceNr,
SegmentDev->FunctionNr,
DestinationOffset
);
PciSegmentWriteBuffer (DestinationAddress, Size, SourceBuffer);
return RETURN_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Send a SYN-ACK after having received a SYN. This still operates on a request_sock only, not on a big socket. */
|
static int __tcp_v4_send_synack(struct sock *sk, struct dst_entry *dst, struct request_sock *req, struct request_values *rvp)
|
/* Send a SYN-ACK after having received a SYN. This still operates on a request_sock only, not on a big socket. */
static int __tcp_v4_send_synack(struct sock *sk, struct dst_entry *dst, struct request_sock *req, struct request_values *rvp)
|
{
const struct inet_request_sock *ireq = inet_rsk(req);
int err = -1;
struct sk_buff * skb;
if (!dst && (dst = inet_csk_route_req(sk, req)) == NULL)
return -1;
skb = tcp_make_synack(sk, dst, req, rvp);
if (skb) {
struct tcphdr *th = tcp_hdr(skb);
th->check = tcp_v4_check(skb->len,
ireq->loc_addr,
ireq->rmt_addr,
csum_partial(th, skb->len,
skb->csum));
err = ip_build_and_send_pkt(skb, sk, ireq->loc_addr,
ireq->rmt_addr,
ireq->opt);
err = net_xmit_eval(err);
}
dst_release(dst);
return err;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* 5.29 Packet Channel Description IE CSN.1 binary representation of the channel parameters as described in TS 44.018 (CCCH) or TS 44.060 (PCCCH) plus padding bits (binary 0) as required to achieve 4 complete octets */
|
static guint16 de_pkt_ch_desc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
|
/* 5.29 Packet Channel Description IE CSN.1 binary representation of the channel parameters as described in TS 44.018 (CCCH) or TS 44.060 (PCCCH) plus padding bits (binary 0) as required to achieve 4 complete octets */
static guint16 de_pkt_ch_desc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
|
{
guint32 curr_offset;
curr_offset = offset;
proto_tree_add_expert(tree, pinfo, &ei_gsm_bsslap_not_decoded_yet, tvb, curr_offset, len);
return(len);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* In the case where rpc clients have been cloned, we want to make sure that we use the program number/version etc of the actual owner of the xprt. To do so, we walk back up the tree of parents to find whoever created the transport and/or whoever has the autobind flag set. */
|
static struct rpc_clnt* rpcb_find_transport_owner(struct rpc_clnt *clnt)
|
/* In the case where rpc clients have been cloned, we want to make sure that we use the program number/version etc of the actual owner of the xprt. To do so, we walk back up the tree of parents to find whoever created the transport and/or whoever has the autobind flag set. */
static struct rpc_clnt* rpcb_find_transport_owner(struct rpc_clnt *clnt)
|
{
struct rpc_clnt *parent = clnt->cl_parent;
while (parent != clnt) {
if (parent->cl_xprt != clnt->cl_xprt)
break;
if (clnt->cl_autobind)
break;
clnt = parent;
parent = parent->cl_parent;
}
return clnt;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Add a Previous Interface Name selector to a mapping */
|
static int mapping_addprevname(struct if_mapping *ifnode, int *active, char *pos, size_t len, struct add_extra *extra, int linenum)
|
/* Add a Previous Interface Name selector to a mapping */
static int mapping_addprevname(struct if_mapping *ifnode, int *active, char *pos, size_t len, struct add_extra *extra, int linenum)
|
{
extra = extra;
if(len >= sizeof(ifnode->prevname))
{
fprintf(stderr, "Old Interface Name too long at line %d\n", linenum);
return(-1);
}
memcpy(ifnode->prevname, string, len + 1);
ifnode->active[SELECT_PREVNAME] = 1;
active[SELECT_PREVNAME] = 1;
if(verbose)
fprintf(stderr,
"Parsing : Added Old Interface Name `%s' from line %d.\n",
ifnode->prevname, linenum);
return(0);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Initializes the DMA channel peripheral registers to their default reset values. */
|
void DMA_DeInit(uint32_t Channel)
|
/* Initializes the DMA channel peripheral registers to their default reset values. */
void DMA_DeInit(uint32_t Channel)
|
{
__IO uint32_t *addr;
assert_parameters(IS_DMA_CHANNEL(Channel));
addr = &DMA->C0CTL + Channel*4;
*addr &= ~(DMA_CCTL_EN | DMA_CCTL_STOP);
DMA->IE &= ~((1<<(Channel))\
|(1<<(Channel+4))\
|(1<<(Channel+8)));
DMA->STS = (1<<(Channel+4))\
|(1<<(Channel+8))\
|(1<<(Channel+12));
addr = &DMA->C0CTL + Channel*4;
*addr = DMA_CxCTL_RSTValue;
addr = &DMA->C0SRC + Channel*4;
*addr = DMA_CxSRC_RSTValue;
addr = &DMA->C0DST + Channel*4;
*addr = DMA_CxDST_RSTValue;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Write a buffer of data to a selected endpoint. */
|
uint32_t USB_SilWrite(uint8_t bEpAddr, uint8_t *pBufferPointer, uint32_t wBufferSize)
|
/* Write a buffer of data to a selected endpoint. */
uint32_t USB_SilWrite(uint8_t bEpAddr, uint8_t *pBufferPointer, uint32_t wBufferSize)
|
{
USB_CopyUserToPMABuf(pBufferPointer, USB_GetEpTxAddr(bEpAddr & 0x7F), wBufferSize);
USB_SetEpTxCnt((bEpAddr & 0x7F), wBufferSize);
return 0;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* This function will check if the specified TLS handshake was done. */
|
BOOLEAN EFIAPI TlsInHandshake(IN VOID *Tls)
|
/* This function will check if the specified TLS handshake was done. */
BOOLEAN EFIAPI TlsInHandshake(IN VOID *Tls)
|
{
CALL_CRYPTO_SERVICE (TlsInHandshake, (Tls), FALSE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* DMAMUX Set Request Generator Trigger GNBREQ.
Set number of request to generate (minus 1). This must be configured while given Request Generator is disabled. */
|
void dmamux_set_request_generator_trigger_gnbreq(uint32_t dmamux, uint8_t rg_channel, uint8_t gnbreq)
|
/* DMAMUX Set Request Generator Trigger GNBREQ.
Set number of request to generate (minus 1). This must be configured while given Request Generator is disabled. */
void dmamux_set_request_generator_trigger_gnbreq(uint32_t dmamux, uint8_t rg_channel, uint8_t gnbreq)
|
{
uint32_t reg32 = DMAMUX_RGxCR(dmamux, rg_channel);
reg32 &= ~(DMAMUX_RGxCR_GNBREQ_MASK << DMAMUX_RGxCR_GNBREQ_SHIFT);
reg32 |= ((gnbreq & DMAMUX_RGxCR_GNBREQ_MASK) << DMAMUX_RGxCR_GNBREQ_SHIFT);
DMAMUX_RGxCR(dmamux, rg_channel) = reg32;
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* Forces the TIMx output 5 waveform to active or inactive level. */
|
void TIM_ConfigForcedOc5(TIM_Module *TIMx, uint16_t TIM_ForcedAction)
|
/* Forces the TIMx output 5 waveform to active or inactive level. */
void TIM_ConfigForcedOc5(TIM_Module *TIMx, uint16_t TIM_ForcedAction)
|
{
uint16_t tmpccmr3 = 0;
assert_param(IsTimList1Module(TIMx));
assert_param(IsTimForceActive(TIM_ForcedAction));
tmpccmr3 = TIMx->CCMOD3;
tmpccmr3 &= (uint16_t) ~((uint16_t)TIM_CCMOD3_OC5MD);
tmpccmr3 |= (uint16_t)(TIM_ForcedAction);
TIMx->CCMOD3 = tmpccmr3;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Check the status of the Tx buffer of the specified SPI port. */
|
xtBoolean xSPIIsTxFull(unsigned long ulBase)
|
/* Check the status of the Tx buffer of the specified SPI port. */
xtBoolean xSPIIsTxFull(unsigned long ulBase)
|
{
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) );
return ((xHWREG(ulBase + SPI_STATUS) & SPI_STATUS_TX_FULL)? xtrue : xfalse);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Stop capture and restart it. I.e. reset the camera during use. */
|
static void omap24xxcam_reset(struct omap24xxcam_device *cam)
|
/* Stop capture and restart it. I.e. reset the camera during use. */
static void omap24xxcam_reset(struct omap24xxcam_device *cam)
|
{
omap24xxcam_capture_stop(cam);
omap24xxcam_capture_cont(cam);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Clears or safeguards the OCREF4 signal on an external event. */
|
void TIM_ClearOC5Ref(TIM_TypeDef *tim, TIMOCCE_Typedef clear)
|
/* Clears or safeguards the OCREF4 signal on an external event. */
void TIM_ClearOC5Ref(TIM_TypeDef *tim, TIMOCCE_Typedef clear)
|
{
MODIFY_REG(tim->CCMR3, TIM_CCMR3_OC5CEN, clear);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* retrieves the Egress VLAN tagging table (the Transmit Tagging Information table) */
|
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBEgressVlanTaggingEnabledGet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
|
/* retrieves the Egress VLAN tagging table (the Transmit Tagging Information table) */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBEgressVlanTaggingEnabledGet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
|
{
IX_ETH_DB_CHECK_PORT(portID);
IX_ETH_DB_CHECK_SINGLE_NPE(portID);
return ixEthDBVlanTableGet(portID, ixEthDBPortInfo[portID].transmitTaggingInfo, vlanSet);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Write data to the specified page in AT24MACXX. */
|
uint32_t at24macxx_write_page(uint32_t u32_page_address, uint32_t u32_page_size, uint8_t const *p_wr_buffer)
|
/* Write data to the specified page in AT24MACXX. */
uint32_t at24macxx_write_page(uint32_t u32_page_address, uint32_t u32_page_size, uint8_t const *p_wr_buffer)
|
{
twihs_package_t twihs_package;
uint32_t start_address = (u32_page_address * u32_page_size) & 0xFFFF;
twihs_package.chip = BOARD_AT24MAC_ADDRESS;
at24mac_build_word_address(twihs_package.addr, start_address);
twihs_package.addr_length = AT24MAC_MEM_ADDR_LEN;
twihs_package.buffer = (uint8_t *)p_wr_buffer;
twihs_package.length = u32_page_size;
if (twihs_master_write(BOARD_AT24MAC_TWIHS_INSTANCE, &twihs_package) !=
TWIHS_SUCCESS) {
return AT24MAC_WRITE_FAIL;
}
at24macxx_acknowledge_polling(&twihs_package);
return AT24MAC_WRITE_SUCCESS;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Helper function for processing pointer events.
This function is a helper function for the */
|
static void win_process_pointer_event(struct win_pointer_event *event)
|
/* Helper function for processing pointer events.
This function is a helper function for the */
static void win_process_pointer_event(struct win_pointer_event *event)
|
{
event->last_pos = win_last_pointer_pos;
if (event->is_relative) {
event->pos.x += win_last_pointer_pos.x;
event->pos.y += win_last_pointer_pos.y;
event->is_relative = false;
}
win_last_pointer_pos = event->pos;
if (win_pointer_grabber != NULL) {
win_handle_event(win_pointer_grabber,
WIN_EVENT_POINTER, event);
} else {
win_handle_pointer_event(&win_root,
event, &win_last_pointer_pos);
}
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* . Set or Get the default context (SCTP_CONTEXT) (chapter and verse is quoted at sctp_setsockopt_context()) */
|
static int sctp_getsockopt_context(struct sock *sk, int len, char __user *optval, int __user *optlen)
|
/* . Set or Get the default context (SCTP_CONTEXT) (chapter and verse is quoted at sctp_setsockopt_context()) */
static int sctp_getsockopt_context(struct sock *sk, int len, char __user *optval, int __user *optlen)
|
{
struct sctp_assoc_value params;
struct sctp_sock *sp;
struct sctp_association *asoc;
if (len < sizeof(struct sctp_assoc_value))
return -EINVAL;
len = sizeof(struct sctp_assoc_value);
if (copy_from_user(¶ms, optval, len))
return -EFAULT;
sp = sctp_sk(sk);
if (params.assoc_id != 0) {
asoc = sctp_id2assoc(sk, params.assoc_id);
if (!asoc)
return -EINVAL;
params.assoc_value = asoc->default_rcv_context;
} else {
params.assoc_value = sp->default_rcv_context;
}
if (put_user(len, optlen))
return -EFAULT;
if (copy_to_user(optval, ¶ms, len))
return -EFAULT;
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Change Logs: Date Author Notes weety first version */
|
static rt_err_t i2c_bus_device_init(rt_device_t dev)
|
/* Change Logs: Date Author Notes weety first version */
static rt_err_t i2c_bus_device_init(rt_device_t dev)
|
{
struct rt_i2c_bus_device *bus = (struct rt_i2c_bus_device *)dev->user_data;
RT_ASSERT(bus != RT_NULL);
return RT_EOK;
}
|
armink/FreeModbus_Slave-Master-RTT-STM32
|
C++
|
Other
| 1,477
|
/* The constructor function installs gTcg2MmSwSmiRegisteredGuid to notify readiness of StandaloneMM Tcg2 module. */
|
EFI_STATUS EFIAPI Tcg2MmDependencyDxeEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
/* The constructor function installs gTcg2MmSwSmiRegisteredGuid to notify readiness of StandaloneMM Tcg2 module. */
EFI_STATUS EFIAPI Tcg2MmDependencyDxeEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
{
EFI_STATUS Status;
EFI_HANDLE Handle;
Handle = NULL;
Status = gBS->InstallProtocolInterface (
&Handle,
&gTcg2MmSwSmiRegisteredGuid,
EFI_NATIVE_INTERFACE,
NULL
);
ASSERT_EFI_ERROR (Status);
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This file is part of the Simba project. */
|
int event_init(struct event_t *self_p)
|
/* This file is part of the Simba project. */
int event_init(struct event_t *self_p)
|
{
ASSERTN(self_p != NULL, EINVAL);
chan_init(&self_p->base,
(ssize_t (*)(void *, void *, size_t))event_read,
(ssize_t (*)(void *, const void *, size_t))event_write,
(size_t (*)(void *))event_size);
self_p->mask = 0;
self_p->reader_mask = 0;
return (0);
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* ZigBee Device Profile dissector for the store node descriptor */
|
void dissect_zbee_zdp_req_store_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
|
/* ZigBee Device Profile dissector for the store node descriptor */
void dissect_zbee_zdp_req_store_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
|
{
guint offset = 0;
guint64 ext_addr; zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL);
ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL);
zdp_parse_node_desc(tree, ett_zbee_zdp_node, tvb, &offset, version);
zbee_append_info(tree, pinfo, ", Device: %s", eui64_to_display(wmem_packet_scope(), ext_addr));
zdp_dump_excess(tvb, offset, pinfo, tree);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Enable or Disable the I2C wake-up function of the specified I2C port.
The */
|
void I2CWakeupEnable(unsigned long ulBase, xtBoolean bEnable)
|
/* Enable or Disable the I2C wake-up function of the specified I2C port.
The */
void I2CWakeupEnable(unsigned long ulBase, xtBoolean bEnable)
|
{
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE));
if(bEnable){
xHWREG(ulBase + I2C_WKUPCON) |= I2C_WKUPCON_WKUPEN;
} else {
xHWREG(ulBase + I2C_WKUPCON) &= ~I2C_WKUPCON_WKUPEN;
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Duplicate either a given File Entry or a given Extended File Entry. */
|
VOID DuplicateFe(IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN UDF_VOLUME_INFO *Volume, IN VOID *FileEntry, OUT VOID **NewFileEntry)
|
/* Duplicate either a given File Entry or a given Extended File Entry. */
VOID DuplicateFe(IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN UDF_VOLUME_INFO *Volume, IN VOID *FileEntry, OUT VOID **NewFileEntry)
|
{
*NewFileEntry = AllocateCopyPool (Volume->FileEntrySize, FileEntry);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base The I3C peripheral base address. param handle Pointer to the I3C master driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */
|
void I3C_MasterTransferCreateHandle(I3C_Type *base, i3c_master_handle_t *handle, const i3c_master_transfer_callback_t *callback, void *userData)
|
/* param base The I3C peripheral base address. param handle Pointer to the I3C master driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */
void I3C_MasterTransferCreateHandle(I3C_Type *base, i3c_master_handle_t *handle, const i3c_master_transfer_callback_t *callback, void *userData)
|
{
uint32_t instance;
assert(NULL != handle);
(void)memset(handle, 0, sizeof(*handle));
instance = I3C_GetInstance(base);
handle->callback = *callback;
handle->userData = userData;
s_i3cMasterHandle[instance] = handle;
s_i3cMasterIsr = I3C_MasterTransferHandleIRQ;
I3C_MasterClearErrorStatusFlags(base, (uint32_t)kMasterErrorFlags);
I3C_MasterClearStatusFlags(base, (uint32_t)kMasterClearFlags);
base->MDATACTRL |= I3C_MDATACTRL_FLUSHTB_MASK | I3C_MDATACTRL_FLUSHFB_MASK;
(void)EnableIRQ(kI3cIrqs[instance]);
I3C_MasterEnableInterrupts(base, (uint32_t)kMasterIrqFlags);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Write directly to the data register on the Z8530 */
|
static void write_zsdata(struct z8530_channel *c, u8 val)
|
/* Write directly to the data register on the Z8530 */
static void write_zsdata(struct z8530_channel *c, u8 val)
|
{
z8530_write_port(c->dataio, val);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Inform the application about the Bulk IN transfer completion. */
|
static void usbd_vendor_write_bulk_async_complete(uint8_t ep_addr, void *p_buf, uint32_t buf_len, uint32_t xfer_len, void *p_arg, sl_status_t status)
|
/* Inform the application about the Bulk IN transfer completion. */
static void usbd_vendor_write_bulk_async_complete(uint8_t ep_addr, void *p_buf, uint32_t buf_len, uint32_t xfer_len, void *p_arg, sl_status_t status)
|
{
sli_usbd_vendor_ctrl_t *p_ctrl;
void *p_callback_arg;
(void)&ep_addr;
p_ctrl = (sli_usbd_vendor_ctrl_t *)p_arg;
p_callback_arg = p_ctrl->bulk_write_async_arg_ptr;
p_ctrl->comm_ptr->data_bulk_in_active_transfer = false;
p_ctrl->bulk_write_async_function(p_ctrl->class_nbr,
p_buf,
buf_len,
xfer_len,
p_callback_arg,
status);
}
|
nanoframework/nf-interpreter
|
C++
|
MIT License
| 293
|
/* handle program when an rx no empty interrupt flag arrived in non block mode */
|
static void __i2s_recv_by_it(ald_i2s_handle_t *hperh)
|
/* handle program when an rx no empty interrupt flag arrived in non block mode */
static void __i2s_recv_by_it(ald_i2s_handle_t *hperh)
|
{
while (READ_BITS(hperh->perh->STAT, SPI_STAT_RXFLV_MSK, SPI_STAT_RXFLV_POSS)) {
*(hperh->rx_buf++) = hperh->perh->DATA;
--hperh->rx_count;
}
if (hperh->rx_count == 0) {
ald_i2s_interrupt_config(hperh, ALD_I2S_IT_RXTH, DISABLE);
hperh->state = ALD_I2S_STATE_READY;
if (hperh->rx_cplt_cbk)
hperh->rx_cplt_cbk(hperh);
}
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns 1 if the given PCM format is big-endian, 0 if little-endian, or a negative error code if endian not specified. */
|
int snd_pcm_format_big_endian(snd_pcm_format_t format)
|
/* Returns 1 if the given PCM format is big-endian, 0 if little-endian, or a negative error code if endian not specified. */
int snd_pcm_format_big_endian(snd_pcm_format_t format)
|
{
int val;
val = snd_pcm_format_little_endian(format);
if (val < 0)
return val;
return !val;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The data transfer will be stopped immediately (CC_CTRL_CC_RST). The core internal state machines will be reset. Use CC_CTRL_CC_FRAME_TRIG instead if you want to transfer the current frame completely. */
|
static void omap24xxcam_core_disable(const struct omap24xxcam_device *cam)
|
/* The data transfer will be stopped immediately (CC_CTRL_CC_RST). The core internal state machines will be reset. Use CC_CTRL_CC_FRAME_TRIG instead if you want to transfer the current frame completely. */
static void omap24xxcam_core_disable(const struct omap24xxcam_device *cam)
|
{
omap24xxcam_reg_out(cam->mmio_base + CC_REG_OFFSET, CC_CTRL,
CC_CTRL_CC_RST);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check whether a channels can be used by an application. */
|
__STATIC_INLINE bool are_app_channels(uint32_t channel_mask)
|
/* Check whether a channels can be used by an application. */
__STATIC_INLINE bool are_app_channels(uint32_t channel_mask)
|
{
return ((~(NRF_PPI_ALL_APP_CHANNELS_MASK) & channel_mask) == 0);
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Shortcut to read one word (4 bytes) out of the EEPROM and convert it to our CPU byte-order. */
|
static u32 rr_read_eeprom_word(struct rr_private *rrpriv, size_t offset)
|
/* Shortcut to read one word (4 bytes) out of the EEPROM and convert it to our CPU byte-order. */
static u32 rr_read_eeprom_word(struct rr_private *rrpriv, size_t offset)
|
{
__be32 word;
if ((rr_read_eeprom(rrpriv, offset,
(unsigned char *)&word, 4) == 4))
return be32_to_cpu(word);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* X.25 dissector for use when "pinfo->pseudo_header" doesn't point to a "struct x25_phdr". */
|
static int dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
/* X.25 dissector for use when "pinfo->pseudo_header" doesn't point to a "struct x25_phdr". */
static int dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
{
int direction;
direction = cmp_address(&pinfo->src, &pinfo->dst);
if (direction == 0)
direction = (pinfo->srcport > pinfo->destport)*2 - 1;
dissect_x25_common(tvb, pinfo, tree, X25_UNKNOWN, direction > 0);
return tvb_captured_length(tvb);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Sets the crytographic data length in the DES module. */
|
void DESDataLengthSet(uint32_t ui32Base, uint32_t ui32Length)
|
/* Sets the crytographic data length in the DES module. */
void DESDataLengthSet(uint32_t ui32Base, uint32_t ui32Length)
|
{
ASSERT(ui32Base == DES_BASE);
HWREG(ui32Base + DES_O_LENGTH) = ui32Length;
}
|
micropython/micropython
|
C++
|
Other
| 18,334
|
/* Internal helper functions Read the status register, returning its value in the location Return the status register value. Returns negative if error occurred. */
|
static int read_sr(struct m25p_spifi *flash)
|
/* Internal helper functions Read the status register, returning its value in the location Return the status register value. Returns negative if error occurred. */
static int read_sr(struct m25p_spifi *flash)
|
{
ssize_t retval;
u8 code = OPCODE_RDSR;
u8 val;
retval = spifi_opcode_read(flash, code, &val, 1);
if (retval < 0) {
dev_err(&flash->pdev->dev, "error %d reading SR\n",
(int) retval);
return retval;
}
return val;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* If the width/height is the standard one then it's coded as a 3-bit index. Otherwise it is coded as escaped 8-bit portions. */
|
static int get_dimension(GetBitContext *gb, const int *dim)
|
/* If the width/height is the standard one then it's coded as a 3-bit index. Otherwise it is coded as escaped 8-bit portions. */
static int get_dimension(GetBitContext *gb, const int *dim)
|
{
int t = get_bits(gb, 3);
int val = dim[t];
if(val < 0)
val = dim[get_bits1(gb) - val];
if(!val){
do{
t = get_bits(gb, 8);
val += t << 2;
}while(t == 0xFF);
}
return val;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* genphy_restart_aneg - Enable and Restart Autonegotiation @phydev: target phy_device struct */
|
int genphy_restart_aneg(struct phy_device *phydev)
|
/* genphy_restart_aneg - Enable and Restart Autonegotiation @phydev: target phy_device struct */
int genphy_restart_aneg(struct phy_device *phydev)
|
{
int ctl;
ctl = phy_read(phydev, MII_BMCR);
if (ctl < 0)
return ctl;
ctl |= (BMCR_ANENABLE | BMCR_ANRESTART);
ctl &= ~(BMCR_ISOLATE);
ctl = phy_write(phydev, MII_BMCR, ctl);
return ctl;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd)
|
/* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd)
|
{
if(hpcd->Instance==USB_OTG_FS)
{
__HAL_RCC_USB_OTG_FS_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, USB_SOF_Pin|USB_VBUS_Pin|USB_ID_Pin|USB_DM_Pin
|USB_DP_Pin);
if(__HAL_RCC_PWR_IS_CLK_DISABLED())
{
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWREx_DisableVddUSB();
__HAL_RCC_PWR_CLK_DISABLE();
}
else
{
HAL_PWREx_DisableVddUSB();
}
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* On systems with i8259-style interrupt controllers we assume for driver compatibility reasons interrupts 0 - 15 to be the i8259 interrupts even if the hardware uses a different interrupt numbering. */
|
void __init init_i8259_irqs(void)
|
/* On systems with i8259-style interrupt controllers we assume for driver compatibility reasons interrupts 0 - 15 to be the i8259 interrupts even if the hardware uses a different interrupt numbering. */
void __init init_i8259_irqs(void)
|
{
int i;
insert_resource(&ioport_resource, &pic1_io_resource);
insert_resource(&ioport_resource, &pic2_io_resource);
init_8259A(0);
for (i = I8259A_IRQ_BASE; i < I8259A_IRQ_BASE + 16; i++) {
set_irq_chip_and_handler(i, &i8259A_chip, handle_level_irq);
set_irq_probe(i);
}
setup_irq(I8259A_IRQ_BASE + PIC_CASCADE_IR, &irq2);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* The software interrupt instruction (SWI) is used for entering Supervisor mode, usually to request a particular supervisor function. */
|
void rt_hw_trap_swi(struct rt_hw_register *regs)
|
/* The software interrupt instruction (SWI) is used for entering Supervisor mode, usually to request a particular supervisor function. */
void rt_hw_trap_swi(struct rt_hw_register *regs)
|
{
rt_kprintf("software interrupt\n");
rt_hw_show_register(regs);
if (rt_thread_self() != RT_NULL)
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
rt_hw_cpu_shutdown();
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Created on: 20-Apr-2016 Author: Description: File acts as interface between LUFA USB stack and the USB low level driver. It implements some of the LUFA API functions and callback functions. */
|
static int32_t USB_Host_ResetDevice(void)
|
/* Created on: 20-Apr-2016 Author: Description: File acts as interface between LUFA USB stack and the USB low level driver. It implements some of the LUFA API functions and callback functions. */
static int32_t USB_Host_ResetDevice(void)
|
{
return Driver_USBH0.PortReset(0U);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Return a pointer to an unused buffer, marking the returned buffer as now in use. */
|
static unsigned char * prvGetNextBuffer(void)
|
/* Return a pointer to an unused buffer, marking the returned buffer as now in use. */
static unsigned char * prvGetNextBuffer(void)
|
{
portBASE_TYPE x;
unsigned char *ucReturn = NULL;
unsigned long ulAttempts = 0;
while( ucReturn == NULL )
{
for( x = 0; x < uipNUM_BUFFERS; x++ )
{
if( ucBufferInUse[ x ] == pdFALSE )
{
ucBufferInUse[ x ] = pdTRUE;
ucReturn = &( ucMACBuffers[ x ][ 0 ] );
break;
}
}
if( ucReturn == NULL )
{
ulAttempts++;
if( ulAttempts >= uipBUFFER_WAIT_ATTEMPTS )
{
break;
}
vTaskDelay( uipBUFFER_WAIT_DELAY );
}
}
return ucReturn;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Draws a single pixel at the specified X/Y location. */
|
void lcdDrawPixel(uint16_t x, uint16_t y, uint16_t color)
|
/* Draws a single pixel at the specified X/Y location. */
void lcdDrawPixel(uint16_t x, uint16_t y, uint16_t color)
|
{
if ((x >= s6b33b6xProperties.width) || (y >= s6b33b6xProperties.height))
return;
s6b33b6xSetCursor((uint8_t)x, (uint8_t)y);
DATA(color >> 8);
DATA(color);
}
|
microbuilder/LPC1343CodeBase
|
C++
|
Other
| 73
|
/* RETURNS: 0 when ATAPI DMA can be used 1 otherwise */
|
static int pdc2027x_check_atapi_dma(struct ata_queued_cmd *qc)
|
/* RETURNS: 0 when ATAPI DMA can be used 1 otherwise */
static int pdc2027x_check_atapi_dma(struct ata_queued_cmd *qc)
|
{
struct scsi_cmnd *cmd = qc->scsicmd;
u8 *scsicmd = cmd->cmnd;
int rc = 1;
switch (scsicmd[0]) {
case READ_10:
case WRITE_10:
case READ_12:
case WRITE_12:
case READ_6:
case WRITE_6:
case 0xad:
case 0xbe:
rc = 0;
break;
default:
;
}
return rc;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* The event handle for IP4 auto reconfiguration. The original default interface and route table will be removed as the default. */
|
VOID EFIAPI Ip4AutoReconfigCallBackDpc(IN VOID *Context)
|
/* The event handle for IP4 auto reconfiguration. The original default interface and route table will be removed as the default. */
VOID EFIAPI Ip4AutoReconfigCallBackDpc(IN VOID *Context)
|
{
IP4_SERVICE *IpSb;
IpSb = (IP4_SERVICE *)Context;
NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);
if (IpSb->State > IP4_SERVICE_UNSTARTED) {
IpSb->State = IP4_SERVICE_UNSTARTED;
}
IpSb->Reconfig = TRUE;
Ip4StartAutoConfig (&IpSb->Ip4Config2Instance);
return;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Calibrate x position (to obtain X = calibrated(x)) */
|
uint16_t TouchScreen_Get_Calibrated_X(uint16_t x)
|
/* Calibrate x position (to obtain X = calibrated(x)) */
uint16_t TouchScreen_Get_Calibrated_X(uint16_t x)
|
{
int32_t ret=CALIB_RES(x,aLogX[0],aPhysX[0],aLogX[1],aPhysX[1]);
if (ret<0) ret=0;
else if (ret>240) ret=239;
return ret;
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Write resolution into configuration struct, but don't write it to the sensor yet. */
|
static void ds18b20_set_resolution(const struct device *dev, uint8_t resolution)
|
/* Write resolution into configuration struct, but don't write it to the sensor yet. */
static void ds18b20_set_resolution(const struct device *dev, uint8_t resolution)
|
{
struct ds18b20_data *data = dev->data;
data->scratchpad.config &= ~DS18B20_RESOLUTION_MASK;
data->scratchpad.config |= DS18B20_RESOLUTION(resolution);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* This deallocates the parameter RAM slot allocated by edma_alloc_slot(). Callers are responsible for ensuring the slot is inactive, and will not be activated. */
|
void edma_free_slot(unsigned slot)
|
/* This deallocates the parameter RAM slot allocated by edma_alloc_slot(). Callers are responsible for ensuring the slot is inactive, and will not be activated. */
void edma_free_slot(unsigned slot)
|
{
unsigned ctlr;
ctlr = EDMA_CTLR(slot);
slot = EDMA_CHAN_SLOT(slot);
if (slot < edma_cc[ctlr]->num_channels ||
slot >= edma_cc[ctlr]->num_slots)
return;
rt_memcpy((void *)(edmacc_regs_base[ctlr] + PARM_OFFSET(slot)),
&dummy_paramset, PARM_SIZE);
clear_bit(slot, edma_cc[ctlr]->edma_inuse);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Stop DFSDM2 audio clock as clock source for the bitstream clock. */
|
void Pulse_Skipper_Bitstream_Stop(void)
|
/* Stop DFSDM2 audio clock as clock source for the bitstream clock. */
void Pulse_Skipper_Bitstream_Stop(void)
|
{
HAL_DFSDM_BitstreamClock_Stop();
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Get LPTIMx clock source @rmtoll CCIPR LPTIMxSEL RCC_GetLPTIMClockSource. */
|
__STATIC_INLINE uint32_t RCC_GetLPTIMClockSource(uint32_t LPTIMx)
|
/* Get LPTIMx clock source @rmtoll CCIPR LPTIMxSEL RCC_GetLPTIMClockSource. */
__STATIC_INLINE uint32_t RCC_GetLPTIMClockSource(uint32_t LPTIMx)
|
{
return (uint32_t)(READ_BIT(RCC->RDCTRL, LPTIMx));
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* If -EBUSY is returned continue to call this function until 0 is returned. */
|
int hvcs_free_connection(uint32_t unit_address)
|
/* If -EBUSY is returned continue to call this function until 0 is returned. */
int hvcs_free_connection(uint32_t unit_address)
|
{
long retval;
retval = plpar_hcall_norets(H_FREE_VTERM, unit_address);
return hvcs_convert(retval);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* param base The LPI2C peripheral base address. param config Settings for the data match feature. */
|
void LPI2C_MasterConfigureDataMatch(LPI2C_Type *base, const lpi2c_data_match_config_t *config)
|
/* param base The LPI2C peripheral base address. param config Settings for the data match feature. */
void LPI2C_MasterConfigureDataMatch(LPI2C_Type *base, const lpi2c_data_match_config_t *config)
|
{
bool wasEnabled = (base->MCR & LPI2C_MCR_MEN_MASK) >> LPI2C_MCR_MEN_SHIFT;
LPI2C_MasterEnable(base, false);
base->MCFGR1 = (base->MCFGR1 & ~LPI2C_MCFGR1_MATCFG_MASK) | LPI2C_MCFGR1_MATCFG(config->matchMode);
base->MCFGR0 = (base->MCFGR0 & ~LPI2C_MCFGR0_RDMO_MASK) | LPI2C_MCFGR0_RDMO(config->rxDataMatchOnly);
base->MDMR = LPI2C_MDMR_MATCH0(config->match0) | LPI2C_MDMR_MATCH1(config->match1);
if (wasEnabled)
{
LPI2C_MasterEnable(base, true);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Links a compatible diskio driver/lun id and increments the number of active linked drivers. */
|
uint8_t FATFS_LinkDriverEx(const Diskio_drvTypeDef *drv, char *path, uint8_t lun)
|
/* Links a compatible diskio driver/lun id and increments the number of active linked drivers. */
uint8_t FATFS_LinkDriverEx(const Diskio_drvTypeDef *drv, char *path, uint8_t lun)
|
{
uint8_t ret = 1;
uint8_t DiskNum = 0;
if(disk.nbr < FF_VOLUMES)
{
disk.is_initialized[disk.nbr] = 0;
disk.drv[disk.nbr] = drv;
disk.lun[disk.nbr] = lun;
DiskNum = disk.nbr++;
path[0] = DiskNum + '0';
path[1] = ':';
path[2] = '/';
path[3] = 0;
ret = 0;
}
return ret;
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.