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 |
|---|---|---|---|---|---|---|---|
/* Return to the beginning of the directory "stream". We simply call findclose and then reset things like an opendir. */ | void _trewinddir(_TDIR *dirp) | /* Return to the beginning of the directory "stream". We simply call findclose and then reset things like an opendir. */
void _trewinddir(_TDIR *dirp) | {
errno = 0;
if (!dirp)
{
errno = EFAULT;
return;
}
if (dirp->dd_handle != -1)
{
_findclose (dirp->dd_handle);
}
dirp->dd_handle = -1;
dirp->dd_stat = 0;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Enables or disables the selected DAC channel wave generation. */ | void DAC_WaveGenerationEnable(uint32_t DAC_Wave, FunctionalState Cmd) | /* Enables or disables the selected DAC channel wave generation. */
void DAC_WaveGenerationEnable(uint32_t DAC_Wave, FunctionalState Cmd) | {
__IO uint32_t tmp = 0;
assert_param(IS_DAC_WAVE(DAC_Wave));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
tmp=DAC->CTRL;
tmp&=~(3<<6);
if (Cmd != DISABLE)
{
tmp |= DAC_Wave;
}
else
{
tmp&=~(3<<6);
}
DAC->CTRL =tmp;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF US... | int ar9170_set_dyn_sifs_ack(struct ar9170 *ar) | /* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF US... | {
u32 val;
if (conf_is_ht40(&ar->hw->conf))
val = 0x010a;
else {
if (ar->hw->conf.channel->band == IEEE80211_BAND_2GHZ)
val = 0x105;
else
val = 0x104;
}
return ar9170_write_reg(ar, AR9170_MAC_REG_DYNAMIC_SIFS_ACK, val);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Called after some received data has been read. It returns RX credits to the HW for the amount of data processed. */ | void cxgb3i_c3cn_rx_credits(struct s3_conn *c3cn, int copied) | /* Called after some received data has been read. It returns RX credits to the HW for the amount of data processed. */
void cxgb3i_c3cn_rx_credits(struct s3_conn *c3cn, int copied) | {
struct t3cdev *cdev;
int must_send;
u32 credits, dack = 0;
if (c3cn->state != C3CN_STATE_ESTABLISHED)
return;
credits = c3cn->copied_seq - c3cn->rcv_wup;
if (unlikely(!credits))
return;
cdev = c3cn->cdev;
if (unlikely(cxgb3_rx_credit_thres == 0))
return;
dack = F_RX_DACK_CHANGE | V_RX_DACK_MODE(1);
mu... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return codes PCI_ERS_RESULT_RECOVERED - the device has been recovered PCI_ERS_RESULT_DISCONNECT - device could not be recovered */ | static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev) | /* Return codes PCI_ERS_RESULT_RECOVERED - the device has been recovered PCI_ERS_RESULT_DISCONNECT - device could not be recovered */
static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev) | {
struct Scsi_Host *shost = pci_get_drvdata(pdev);
struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
pci_ers_result_t rc = PCI_ERS_RESULT_DISCONNECT;
switch (phba->pci_dev_grp) {
case LPFC_PCI_DEV_LP:
rc = lpfc_io_slot_reset_s3(pdev);
break;
case LPFC_PCI_DEV_OC:
rc = lpfc_io_slot_reset_... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc) | /* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc) | {
if(hadc->Instance==ADC1)
{
__HAL_RCC_ADC_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_0|GPIO_PIN_1);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* atomically swap in the new signal mask, and wait for a signal. */ | asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, old_sigset_t mask) | /* atomically swap in the new signal mask, and wait for a signal. */
asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, old_sigset_t mask) | {
mask &= _BLOCKABLE;
spin_lock_irq(¤t->sighand->siglock);
current->saved_sigmask = current->blocked;
siginitset(¤t->blocked, mask);
recalc_sigpending();
spin_unlock_irq(¤t->sighand->siglock);
current->state = TASK_INTERRUPTIBLE;
schedule();
set_restore_sigmask();
return -ERESTARTNOHAND;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns 1 if the media was changed or 0 otherwise. */ | static int i2o_block_media_changed(struct gendisk *disk) | /* Returns 1 if the media was changed or 0 otherwise. */
static int i2o_block_media_changed(struct gendisk *disk) | {
struct i2o_block_device *p = disk->private_data;
if (p->media_change_flag) {
p->media_change_flag = 0;
return 1;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Reset stack pointer to begin of the stack. */ | VOID ResetScopeStack(VOID) | /* Reset stack pointer to begin of the stack. */
VOID ResetScopeStack(VOID) | {
mOpCodeScopeStackPointer = mOpCodeScopeStack;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* There are several options how the result buffer is handled: */ | static int cmpkey(const void *p1, const void *p2) | /* There are several options how the result buffer is handled: */
static int cmpkey(const void *p1, const void *p2) | {
struct env_entry *e1 = *(struct env_entry **)p1;
struct env_entry *e2 = *(struct env_entry **)p2;
return (strcmp(e1->key, e2->key));
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* \This function use extern interrupt to wake up mcu from sleep mode */ | void WakeUpFromPowerDown(void) | /* \This function use extern interrupt to wake up mcu from sleep mode */
void WakeUpFromPowerDown(void) | {
xIntEnable(INT_LPWUP);
xIntPrioritySet(INT_LPWUP, 1);
SysCtlWakeUpPinEnable(xtrue);
SysCtlWakeUpIntEnable(xtrue);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Configures the SSI advanced mode to de-assert the SSIFss signal after every byte transfer. */ | void SSIAdvFrameHoldDisable(uint32_t ui32Base) | /* Configures the SSI advanced mode to de-assert the SSIFss signal after every byte transfer. */
void SSIAdvFrameHoldDisable(uint32_t ui32Base) | {
ASSERT(_SSIBaseValid(ui32Base));
HWREG(ui32Base + SSI_O_CR1) &= ~(SSI_CR1_FSSHLDFRM);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Attribute write call back for the Value V7 attribute. */ | static ssize_t write_value_v7(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags) | /* Attribute write call back for the Value V7 attribute. */
static ssize_t write_value_v7(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags) | {
uint8_t *value = attr->user_data;
if (offset >= sizeof(value_v7_value))
return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET);
if (offset + len > sizeof(value_v7_value))
return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN);
memcpy(value + offset, buf, len);
return len;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Set I2C bus frequency.
Please refer to the reference manual, details on I2C clock generation, for max allowed theoretical frequencies for different modes. */ | void I2C_BusFreqSet(I2C_TypeDef *i2c, uint32_t refFreq, uint32_t freq, I2C_ClockHLR_TypeDef type) | /* Set I2C bus frequency.
Please refer to the reference manual, details on I2C clock generation, for max allowed theoretical frequencies for different modes. */
void I2C_BusFreqSet(I2C_TypeDef *i2c, uint32_t refFreq, uint32_t freq, I2C_ClockHLR_TypeDef type) | {
uint32_t n;
uint32_t div;
(void)type;
EFM_ASSERT(freq);
if (!freq)
{
return;
}
if (!refFreq)
{
refFreq = CMU_ClockFreqGet(cmuClock_HFPER);
}
n = (uint32_t)(i2cNSum[(i2c->CTRL & _I2C_CTRL_CLHR_MASK) >> _I2C_CTRL_CLHR_SHIFT]);
div = (refFreq - (4 * freq)) / (n * freq);
EFM_ASSERT(div);... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Get the later one of two timex representation */ | static timex_t get_max_timex(timex_t time_one, timex_t time_two) | /* Get the later one of two timex representation */
static timex_t get_max_timex(timex_t time_one, timex_t time_two) | {
if (timex_cmp(time_one, time_two) != -1) {
return time_one;
}
return time_two;
} | labapart/polymcu | C++ | null | 201 |
/* Writes a block of data to the Si1147 sensor. */ | uint32_t Si1147_Write_Block_Register(I2C_TypeDef *i2c, uint8_t addr, uint8_t reg, uint8_t length, uint8_t const *data) | /* Writes a block of data to the Si1147 sensor. */
uint32_t Si1147_Write_Block_Register(I2C_TypeDef *i2c, uint8_t addr, uint8_t reg, uint8_t length, uint8_t const *data) | {
I2C_TransferSeq_TypeDef seq;
I2C_TransferReturn_TypeDef ret;
uint8_t i2c_write_data[10];
uint8_t i2c_read_data[1];
int i;
seq.addr = addr;
seq.flags = I2C_FLAG_WRITE;
i2c_write_data[0] = reg;
for (i=0; i<length;i++)
{
i2c_write_data[i+1] = data[i];
}
seq.buf[0].data = i2c_write_data;
... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Disable the DMA of the specified SPI port.
The */ | void xSPIDMADisable(unsigned long ulBase, unsigned long ulDmaMode) | /* Disable the DMA of the specified SPI port.
The */
void xSPIDMADisable(unsigned long ulBase, unsigned long ulDmaMode) | {
xASSERT(ulBase == SPI0_BASE);
xHWREG(ulBase + SPI_DMA) &= ~ulDmaMode;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Send a master data transmit request when the master have obtained control of the bus.(Write Step2)
For this function returns immediately, it is always using in the interrupt hander. */ | void xI2CMasterWriteRequestS2(unsigned long ulBase, unsigned char ucData, xtBoolean bEndTransmition) | /* Send a master data transmit request when the master have obtained control of the bus.(Write Step2)
For this function returns immediately, it is always using in the interrupt hander. */
void xI2CMasterWriteRequestS2(unsigned long ulBase, unsigned char ucData, xtBoolean bEndTransmition) | {
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE));
xHWREG(ulBase + I2C_O_DAT) = ucData;
xHWREG(ulBase + I2C_O_CON) &= ~(I2C_CON_AA | I2C_CON_EI);
if(bEndTransmition)
{
I2CStopSend(ulBase);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Restore IO APIC entries which was saved in ioapic_entries. */ | int restore_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries) | /* Restore IO APIC entries which was saved in ioapic_entries. */
int restore_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries) | {
int apic, pin;
if (!ioapic_entries)
return -ENOMEM;
for (apic = 0; apic < nr_ioapics; apic++) {
if (!ioapic_entries[apic])
return -ENOMEM;
for (pin = 0; pin < nr_ioapic_registers[apic]; pin++)
ioapic_write_entry(apic, pin,
ioapic_entries[apic][pin]);
}
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Return PA for this VA if it is mapped by a CAM, or 0 */ | phys_addr_t v_mapped_by_tlbcam(unsigned long va) | /* Return PA for this VA if it is mapped by a CAM, or 0 */
phys_addr_t v_mapped_by_tlbcam(unsigned long va) | {
int b;
for (b = 0; b < tlbcam_index; ++b)
if (va >= tlbcam_addrs[b].start && va < tlbcam_addrs[b].limit)
return tlbcam_addrs[b].phys + (va - tlbcam_addrs[b].start);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* mx3fb_set_par() - set framebuffer parameters and change the operating mode. */ | static int mx3fb_set_par(void) | /* mx3fb_set_par() - set framebuffer parameters and change the operating mode. */
static int mx3fb_set_par(void) | {
int ret;
ret = sdc_init_panel(panel.plnSizeX, panel.plnSizeY,
IPU_PIX_FMT_RGB666, IPU_PANEL_TFT);
if (ret < 0)
return ret;
writel((mode->left_margin << 16) | mode->upper_margin, SDC_BG_POS);
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* param base eDMA peripheral base address. param channel eDMA channel number. param mask The mask of the interrupt source to be set. Use the defined edma_interrupt_enable_t type. */ | void EDMA_DisableChannelInterrupts(DMA_Type *base, uint32_t channel, uint32_t mask) | /* param base eDMA peripheral base address. param channel eDMA channel number. param mask The mask of the interrupt source to be set. Use the defined edma_interrupt_enable_t type. */
void EDMA_DisableChannelInterrupts(DMA_Type *base, uint32_t channel, uint32_t mask) | {
assert(channel < (uint32_t)FSL_FEATURE_EDMA_MODULE_CHANNEL);
if (0U != (mask & (uint32_t)kEDMA_ErrorInterruptEnable))
{
base->EEI &= (uint32_t)(~(0x1U << channel));
}
if (0U != (mask & (uint32_t)kEDMA_MajorInterruptEnable))
{
base->TCD[channel].CSR &= ~(uint16_t)DMA_CSR_INTMAJO... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Function to set the peer ID associated with a connection handle. */ | static void peer_id_set(uint16_t conn_handle, pm_peer_id_t peer_id) | /* Function to set the peer ID associated with a connection handle. */
static void peer_id_set(uint16_t conn_handle, pm_peer_id_t peer_id) | {
uint8_t conn_index = get_connection_by_conn_handle(conn_handle);
if (conn_index != IM_NO_INVALID_CONN_HANDLES)
{
m_im.connections[conn_index].peer_id = peer_id;
}
} | labapart/polymcu | C++ | null | 201 |
/* Check if SWPMI transceiver is enabled @rmtoll CR SWPEN LL_SWPMI_IsEnabledTransceiver. */ | uint32_t LL_SWPMI_IsEnabledTransceiver(SWPMI_TypeDef *SWPMIx) | /* Check if SWPMI transceiver is enabled @rmtoll CR SWPEN LL_SWPMI_IsEnabledTransceiver. */
uint32_t LL_SWPMI_IsEnabledTransceiver(SWPMI_TypeDef *SWPMIx) | {
return ((READ_BIT(SWPMIx->CR, SWPMI_CR_SWPEN) == (SWPMI_CR_SWPEN)) ? 1UL : 0UL);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* param base CMP peripheral base address. param positiveChannel Positive side input channel number. Available range is 0-7. param negativeChannel Negative side input channel number. Available range is 0-7. */ | void CMP_SetInputChannels(CMP_Type *base, uint8_t positiveChannel, uint8_t negativeChannel) | /* param base CMP peripheral base address. param positiveChannel Positive side input channel number. Available range is 0-7. param negativeChannel Negative side input channel number. Available range is 0-7. */
void CMP_SetInputChannels(CMP_Type *base, uint8_t positiveChannel, uint8_t negativeChannel) | {
uint8_t tmp8 = base->MUXCR;
tmp8 &= ~(CMP_MUXCR_PSEL_MASK | CMP_MUXCR_MSEL_MASK);
tmp8 |= CMP_MUXCR_PSEL(positiveChannel) | CMP_MUXCR_MSEL(negativeChannel);
base->MUXCR = tmp8;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function sets up the segment so that subsequent data is copied to the indicated sg entry, at the given offset. */ | static void iscsi_tcp_segment_init_sg(struct iscsi_segment *segment, struct scatterlist *sg, unsigned int offset) | /* This function sets up the segment so that subsequent data is copied to the indicated sg entry, at the given offset. */
static void iscsi_tcp_segment_init_sg(struct iscsi_segment *segment, struct scatterlist *sg, unsigned int offset) | {
segment->sg = sg;
segment->sg_offset = offset;
segment->size = min(sg->length - offset,
segment->total_size - segment->total_copied);
segment->data = NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If a big-endian PKTAP file ever shows up, and it comes from a big-endian machine, presumably these are host-endian, and we need to just fetch the fields in host byte order here but byte-swap them to host byte order in libwiretap. */ | static gboolean capture_pktap(const guchar *pd, int offset _U_, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_) | /* If a big-endian PKTAP file ever shows up, and it comes from a big-endian machine, presumably these are host-endian, and we need to just fetch the fields in host byte order here but byte-swap them to host byte order in libwiretap. */
static gboolean capture_pktap(const guchar *pd, int offset _U_, int len, capture_pa... | {
guint32 hdrlen, rectype, dlt;
hdrlen = pletoh32(pd);
if (hdrlen < MIN_PKTAP_HDR_LEN || !BYTES_ARE_IN_FRAME(0, len, hdrlen))
return FALSE;
rectype = pletoh32(pd+4);
if (rectype != PKT_REC_PACKET)
return FALSE;
dlt = pletoh32(pd+4);
switch (dlt) {
case 1:
return capture_eth(pd, hdrlen, len, cpinfo, pseud... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Created on: 19 feb. 2019 Author: Daniel Mårtensson This is the almost the same as powe, power on every element, but the difference is that this function does not take power on each element, it does A^n A will be size row x row. It must be square!!! A^n and n will be an integer */ | void mpower(double *A, int row, int n) | /* Created on: 19 feb. 2019 Author: Daniel Mårtensson This is the almost the same as powe, power on every element, but the difference is that this function does not take power on each element, it does A^n A will be size row x row. It must be square!!! A^n and n will be an integer */
void mpower(double *A, int row, int... | {
if (i == 0) {
eye(T, row, row);
} else if (i == 1) {
copy(A, T, row, row);
} else if (i == 2) {
mul(A, A, false, T, row, row, row);
} else {
mul(A, T, false, T2, row, row, row);
copy(T2, T, row, row);
}
}
copy(T, A, row, row);
} | DanielMartensson/EmbeddedLapack | C++ | MIT License | 129 |
/* The i8042_wait_read() and i8042_wait_write functions wait for the i8042 to be ready for reading values from it / writing values to it. Called always with i8042_lock held. */ | static int i8042_wait_read(void) | /* The i8042_wait_read() and i8042_wait_write functions wait for the i8042 to be ready for reading values from it / writing values to it. Called always with i8042_lock held. */
static int i8042_wait_read(void) | {
int i = 0;
while ((~i8042_read_status() & I8042_STR_OBF) && (i < I8042_CTL_TIMEOUT)) {
udelay(50);
i++;
}
return -(i == I8042_CTL_TIMEOUT);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: 1 if init will be retried / 0 if not */ | static int ibmvfc_retry_host_init(struct ibmvfc_host *vhost) | /* Returns: 1 if init will be retried / 0 if not */
static int ibmvfc_retry_host_init(struct ibmvfc_host *vhost) | {
int retry = 0;
if (vhost->action == IBMVFC_HOST_ACTION_INIT_WAIT) {
vhost->delay_init = 1;
if (++vhost->init_retries > IBMVFC_MAX_HOST_INIT_RETRIES) {
dev_err(vhost->dev,
"Host initialization retries exceeded. Taking adapter offline\n");
ibmvfc_link_down(vhost, IBMVFC_HOST_OFFLINE);
} else if (vhost... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return the section header specified by the range. */ | Elf64_Shdr* GetElf64SectionByRange(IN UINT8 *ImageBase, IN UINT64 Offset, IN UINT64 Size) | /* Return the section header specified by the range. */
Elf64_Shdr* GetElf64SectionByRange(IN UINT8 *ImageBase, IN UINT64 Offset, IN UINT64 Size) | {
UINT32 Index;
Elf64_Ehdr *Ehdr;
Elf64_Shdr *Shdr;
Ehdr = (Elf64_Ehdr *)ImageBase;
Shdr = (Elf64_Shdr *)(ImageBase + Ehdr->e_shoff);
for (Index = 0; Index < Ehdr->e_shnum; Index++) {
if ((Shdr->sh_offset == Offset) && (Shdr->sh_size == Size)) {
return Shdr;
}
Shdr = ELF_NEXT_ENTRY ... | tianocore/edk2 | C++ | Other | 4,240 |
/* RETURN: MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise. NOTE: This function does not modify the OperationMode field of control register. */ | static int mv_xor_ctrl_set(u32 chan, u32 xor_ctrl) | /* RETURN: MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise. NOTE: This function does not modify the OperationMode field of control register. */
static int mv_xor_ctrl_set(u32 chan, u32 xor_ctrl) | {
u32 val;
val = reg_read(XOR_CONFIG_REG(XOR_UNIT(chan), XOR_CHAN(chan)))
& XEXCR_OPERATION_MODE_MASK;
xor_ctrl &= ~XEXCR_OPERATION_MODE_MASK;
xor_ctrl |= val;
reg_write(XOR_CONFIG_REG(XOR_UNIT(chan), XOR_CHAN(chan)), xor_ctrl);
return MV_OK;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Enable/disable the 3 wire feature of the specified SPI port. */ | void SPI3WireFunction(unsigned long ulBase, xtBoolean xtEnable) | /* Enable/disable the 3 wire feature of the specified SPI port. */
void SPI3WireFunction(unsigned long ulBase, xtBoolean xtEnable) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) );
if (xtEnable)
{
xHWREG(ulBase + SPI_CNTRL) |= SPI_CNTRL_SLVSEL;
xHWREG(ulBase + SPI_SSR) |= SPI_SSR_SLV3WIRE;
}
else
{
xHWREG(ulBase + SPI_SSR) &= ~SPI_S... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Draw a character of the currently set font. */ | int characterRGBA(SDL_Surface *dst, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a) | /* Draw a character of the currently set font. */
int characterRGBA(SDL_Surface *dst, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a) | {
return (characterColor(dst, x, y, c, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* These routines maintain argument size conversion between 32bit and 64bit ioctls. */ | static int w_long(unsigned int fd, unsigned int cmd, compat_ulong_t __user *argp) | /* These routines maintain argument size conversion between 32bit and 64bit ioctls. */
static int w_long(unsigned int fd, unsigned int cmd, compat_ulong_t __user *argp) | {
mm_segment_t old_fs = get_fs();
int err;
unsigned long val;
set_fs (KERNEL_DS);
err = sys_ioctl(fd, cmd, (unsigned long)&val);
set_fs (old_fs);
if (!err && put_user(val, argp))
return -EFAULT;
return err;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* FSM long counter timeout register (r/w). The long counter timeout value is an unsigned integer value (16-bit format). When the long counter value reached this value, the FSM generates an interrupt.. */ | int32_t lsm6dso_long_cnt_int_value_get(lsm6dso_ctx_t *ctx, uint8_t *buff) | /* FSM long counter timeout register (r/w). The long counter timeout value is an unsigned integer value (16-bit format). When the long counter value reached this value, the FSM generates an interrupt.. */
int32_t lsm6dso_long_cnt_int_value_get(lsm6dso_ctx_t *ctx, uint8_t *buff) | {
int32_t ret;
uint8_t index;
index = 0x00U;
ret = lsm6dso_ln_pg_read_byte(ctx, LSM6DSO_FSM_LC_TIMEOUT_L, &buff[index]);
if (ret == 0) {
index++;
ret = lsm6dso_ln_pg_read_byte(ctx, LSM6DSO_FSM_LC_TIMEOUT_H,
&buff[index]);
}
return ret;
} | alexander-g-dean/ESF | C++ | null | 41 |
/* param base Pointer to the FLEXIO_MCULCD_Type structure. param mask Interrupts to disable, it is the OR'ed value of ref _flexio_mculcd_interrupt_enable. */ | void FLEXIO_MCULCD_DisableInterrupts(FLEXIO_MCULCD_Type *base, uint32_t mask) | /* param base Pointer to the FLEXIO_MCULCD_Type structure. param mask Interrupts to disable, it is the OR'ed value of ref _flexio_mculcd_interrupt_enable. */
void FLEXIO_MCULCD_DisableInterrupts(FLEXIO_MCULCD_Type *base, uint32_t mask) | {
uint32_t interrupts = 0U;
if (0U != (mask & (uint32_t)kFLEXIO_MCULCD_RxFullFlag))
{
interrupts |= (1UL << base->rxShifterEndIndex);
}
if (0U != (mask & (uint32_t)kFLEXIO_MCULCD_TxEmptyFlag))
{
interrupts |= (1UL << base->txShifterStartIndex);
}
FLEXIO_DisableShifterStat... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* This function determines when frame which is sent, is last frame of transmit window, if it is then this function return zero else return one. This function is used for sending last frame of transmit window as I-format command with p-bit set to one. Returns 0 if frame is last frame, 1 otherwise. */ | int llc_conn_ev_qlfy_last_frame_eq_1(struct sock *sk, struct sk_buff *skb) | /* This function determines when frame which is sent, is last frame of transmit window, if it is then this function return zero else return one. This function is used for sending last frame of transmit window as I-format command with p-bit set to one. Returns 0 if frame is last frame, 1 otherwise. */
int llc_conn_ev_q... | {
return !(skb_queue_len(&llc_sk(sk)->pdu_unack_q) + 1 == llc_sk(sk)->k);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function will check the SPIFLG register and handle any events that are detected there */ | static int davinci_spi_process_events(struct davinci_spi *dspi) | /* This function will check the SPIFLG register and handle any events that are detected there */
static int davinci_spi_process_events(struct davinci_spi *dspi) | {
u32 buf, status, errors = 0, spidat1;
buf = readl(dspi->base + SPIBUF);
if (dspi->rcount > 0 && !(buf & SPIBUF_RXEMPTY_MASK)) {
dspi->get_rx(buf & 0xFFFF, dspi);
dspi->rcount--;
}
status = readl(dspi->base + SPIFLG);
if (unlikely(status & SPIFLG_ERROR_MASK)) {
errors = ... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Clears or safeguards the OCREF4 signal on an external event. */ | void TIM_ClearOC4Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear) | /* Clears or safeguards the OCREF4 signal on an external event. */
void TIM_ClearOC4Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear) | {
uint32_t tmpccmr2 = 0;
assert_param(IS_TIM_LIST3_PERIPH(TIMx));
assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear));
tmpccmr2 = TIMx->CCMR2;
tmpccmr2 &= (uint32_t)~TIM_CCMR2_OC4CE;
tmpccmr2 |= ((uint32_t)TIM_OCClear << 8);
TIMx->CCMR2 = tmpccmr2;
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Put a byte into the ring buffer. If ring buffer is full, this operation will fail. */ | rt_size_t rt_ringbuffer_putchar(struct rt_ringbuffer *rb, const rt_uint8_t ch) | /* Put a byte into the ring buffer. If ring buffer is full, this operation will fail. */
rt_size_t rt_ringbuffer_putchar(struct rt_ringbuffer *rb, const rt_uint8_t ch) | {
RT_ASSERT(rb != RT_NULL);
if (!rt_ringbuffer_space_len(rb))
return 0;
rb->buffer_ptr[rb->write_index] = ch;
if (rb->write_index == rb->buffer_size-1)
{
rb->write_mirror = ~rb->write_mirror;
rb->write_index = 0;
}
else
{
rb->write_index++;
}
retur... | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Writes and returns a new value to CR0. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */ | UINTN EFIAPI AsmWriteCr0(UINTN Cr0) | /* Writes and returns a new value to CR0. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */
UINTN EFIAPI AsmWriteCr0(UINTN Cr0) | {
__asm__ __volatile__ (
"movl %0, %%cr0"
:
: "r" (Cr0)
);
return Cr0;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get Inquiry Data.
This funtion is used to get the most recent inquiry packet. */ | void adi_ble_GetInquiryData(ADI_BLER_INQUIRY_DATA *pInquiryData) | /* Get Inquiry Data.
This funtion is used to get the most recent inquiry packet. */
void adi_ble_GetInquiryData(ADI_BLER_INQUIRY_DATA *pInquiryData) | {
ASSERT(pInquiryData != NULL);
memcpy(pInquiryData, &pBLERadio->sInquiryData, sizeof(ADI_BLER_INQUIRY_DATA));
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* This function is called during kernel startup to initialize the mvme147 IRQ handling routines. */ | void __init mvme147_init_IRQ(void) | /* This function is called during kernel startup to initialize the mvme147 IRQ handling routines. */
void __init mvme147_init_IRQ(void) | {
m68k_setup_user_interrupt(VEC_USER, 192, NULL);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function is called as soon the LAPIC NMI watchdog driver has everything in place and it's ready to check if the NMIs belong to the NMI watchdog */ | void cpu_nmi_set_wd_enabled(void) | /* This function is called as soon the LAPIC NMI watchdog driver has everything in place and it's ready to check if the NMIs belong to the NMI watchdog */
void cpu_nmi_set_wd_enabled(void) | {
__get_cpu_var(wd_enabled) = 1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This API is used to get the fifo full interrupt2 in the register 0x1A bit 5. */ | BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_intr2_fifo_full(u8 *intr2_fifo_full_u8) | /* This API is used to get the fifo full interrupt2 in the register 0x1A bit 5. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_intr2_fifo_full(u8 *intr2_fifo_full_u8) | {
u8 data_u8 = BMA2x2_INIT_VALUE;
BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR;
if (p_bma2x2 == BMA2x2_NULL)
{
return E_BMA2x2_NULL_PTR;
}
else
{
com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC
(p_bma2x2->dev_addr,
BMA2x2_ENABLE_INTR2_PAD_FIFO... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Configures the processor for use with this demo. */ | static void prvSetupHardware(void) | /* Configures the processor for use with this demo. */
static void prvSetupHardware(void) | {
PLLCFG = ( mainPLL_MUL_5 | mainPLL_DIV_1 );
PLLCON = mainPLL_ENABLE;
PLLFEED = mainPLL_FEED_BYTE1;
PLLFEED = mainPLL_FEED_BYTE2;
while( !( PLLSTAT & mainPLL_LOCK ) );
PLLCON = mainPLL_CONNECT;
PLLFEED = mainPLL_FEED_BYTE1;
PLLFEED = mainPLL_FEED_BYTE2;
MAMTIM = mainMAM_TIM_3;
MAMCR = mainMAM_MODE_FULL;
APB... | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Called by rport when remote port is known to be an initiator from PRLI received. */ | void bfa_fcs_itnim_is_initiator(struct bfa_fcs_itnim_s *itnim) | /* Called by rport when remote port is known to be an initiator from PRLI received. */
void bfa_fcs_itnim_is_initiator(struct bfa_fcs_itnim_s *itnim) | {
bfa_trc(itnim->fcs, itnim->rport->pid);
itnim->stats.initiator++;
bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_INITIATOR);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Schedules a call to dasd_tasklet over the device tasklet. */ | void dasd_schedule_block_bh(struct dasd_block *block) | /* Schedules a call to dasd_tasklet over the device tasklet. */
void dasd_schedule_block_bh(struct dasd_block *block) | {
if (atomic_cmpxchg(&block->tasklet_scheduled, 0, 1) != 0)
return;
dasd_get_device(block->base);
tasklet_hi_schedule(&block->tasklet);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does no... | EFI_STATUS EFIAPI ConPlatformComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName) | /* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does no... | {
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mConPlatformDriverNameTable,
DriverName,
(BOOLEAN)(This == &gConPlatformComponentName)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function decodes the Get Zone Information payload. */ | static void dissect_zcl_ias_ace_get_zone_info(tvbuff_t *tvb, proto_tree *tree, guint *offset) | /* This function decodes the Get Zone Information payload. */
static void dissect_zcl_ias_ace_get_zone_info(tvbuff_t *tvb, proto_tree *tree, guint *offset) | {
proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_zone_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
*offset += 1;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Select a path having the minimum number of in-flight I/Os */ | static struct dm_path* ql_select_path(struct path_selector *ps, unsigned *repeat_count, size_t nr_bytes) | /* Select a path having the minimum number of in-flight I/Os */
static struct dm_path* ql_select_path(struct path_selector *ps, unsigned *repeat_count, size_t nr_bytes) | {
struct selector *s = ps->context;
struct path_info *pi = NULL, *best = NULL;
if (list_empty(&s->valid_paths))
return NULL;
list_move_tail(s->valid_paths.next, &s->valid_paths);
list_for_each_entry(pi, &s->valid_paths, list) {
if (!best ||
(atomic_read(&pi->qlen) < atomic_read(&best->qlen)))
best = p... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* These packets are seen only in a promiscuous capture: */ | static int dissect_ieee80211_centrino(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) | /* These packets are seen only in a promiscuous capture: */
static int dissect_ieee80211_centrino(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) | {
struct ieee_802_11_phdr phdr;
memset(&phdr, 0, sizeof(phdr));
phdr.decrypted = FALSE;
phdr.datapad = FALSE;
phdr.phy = PHDR_802_11_PHY_UNKNOWN;
dissect_ieee80211_common(tvb, pinfo, tree, IEEE80211_COMMON_OPT_IS_CENTRINO|IEEE80211_COMMON_OPT_NORMAL_QOS, &phdr);
return tvb_captured_length(tvb);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* 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 Vector42_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 Vector42_handler(void) | {
asm
{
LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (42 * 2))
JMP 0,X
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Translate the specified timeout in seconds into System Clock terms which is what the on-chip Watchdog requires. */ | static int bfin_wdt_set_timeout(unsigned long t) | /* Translate the specified timeout in seconds into System Clock terms which is what the on-chip Watchdog requires. */
static int bfin_wdt_set_timeout(unsigned long t) | {
u32 cnt, max_t, sclk;
unsigned long flags;
sclk = get_sclk();
max_t = -1 / sclk;
cnt = t * sclk;
stamp("maxtimeout=%us newtimeout=%lus (cnt=%#x)", max_t, t, cnt);
if (t > max_t) {
printk(KERN_WARNING PFX "timeout value is too large\n");
return -EINVAL;
}
spin_lock_irqsave(&bfin_wdt_spinlock, flags);
{
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Derived from Beagle Board and 3430 SDP code by Richard Woodruff <r-woodruff2 at ti.com> Syed Mohammed Khasim <khasim at ti.com> */ | void twl4030_led_init(unsigned char ledon_mask) | /* Derived from Beagle Board and 3430 SDP code by Richard Woodruff <r-woodruff2 at ti.com> Syed Mohammed Khasim <khasim at ti.com> */
void twl4030_led_init(unsigned char ledon_mask) | {
if (ledon_mask & TWL4030_LED_LEDEN_LEDAON)
ledon_mask |= TWL4030_LED_LEDEN_LEDAPWM;
if (ledon_mask & TWL4030_LED_LEDEN_LEDBON)
ledon_mask |= TWL4030_LED_LEDEN_LEDBPWM;
twl4030_i2c_write_u8(TWL4030_CHIP_LED, ledon_mask,
TWL4030_LED_LEDEN);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Disable the PWM output of the PWM module.
The */ | void xPWMOutputDisable(unsigned long ulBase, unsigned long ulChannel) | /* Disable the PWM output of the PWM module.
The */
void xPWMOutputDisable(unsigned long ulBase, unsigned long ulChannel) | {
unsigned long ulChannelTemp;
ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4);
xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE));
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3)));
xHWREG(ulBase + PWM_POE) &= ~(PWM_POE_PWM0 << (ulChannelTemp));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This function used to run the workqueues itself. Now we just wait for the helper threads to do it. */ | void flush_workqueue(struct workqueue_struct *wq) | /* This function used to run the workqueues itself. Now we just wait for the helper threads to do it. */
void flush_workqueue(struct workqueue_struct *wq) | {
const struct cpumask *cpu_map = wq_cpu_map(wq);
int cpu;
might_sleep();
lock_map_acquire(&wq->lockdep_map);
lock_map_release(&wq->lockdep_map);
for_each_cpu(cpu, cpu_map)
flush_cpu_workqueue(per_cpu_ptr(wq->cpu_wq, cpu));
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Implement the event wait interface for the eventpoll file. It is the kernel part of the user space epoll_wait(2). */ | SYSCALL_DEFINE4(epoll_wait, int, epfd, struct epoll_event __user *, events, int, maxevents, int, timeout) | /* Implement the event wait interface for the eventpoll file. It is the kernel part of the user space epoll_wait(2). */
SYSCALL_DEFINE4(epoll_wait, int, epfd, struct epoll_event __user *, events, int, maxevents, int, timeout) | {
int error;
struct file *file;
struct eventpoll *ep;
if (maxevents <= 0 || maxevents > EP_MAX_EVENTS)
return -EINVAL;
if (!access_ok(VERIFY_WRITE, events, maxevents * sizeof(struct epoll_event))) {
error = -EFAULT;
goto error_return;
}
error = -EBADF;
file = fget(epfd);
if (!file)
goto error_return;
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Throw away all pending data and cancel the corking. Socket is locked. */ | void udp_flush_pending_frames(struct sock *sk) | /* Throw away all pending data and cancel the corking. Socket is locked. */
void udp_flush_pending_frames(struct sock *sk) | {
struct udp_sock *up = udp_sk(sk);
if (up->pending) {
up->len = 0;
up->pending = 0;
ip_flush_pending_frames(sk);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Query the kernel for the MTU of the given interface. */ | static int iface_get_mtu(int fd, const char *device, char *ebuf) | /* Query the kernel for the MTU of the given interface. */
static int iface_get_mtu(int fd, const char *device, char *ebuf) | {
struct ifreq ifr;
if (!device)
return BIGGER_THAN_ALL_MTUS;
memset(&ifr, 0, sizeof(ifr));
pcap_strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
if (ioctl(fd, SIOCGIFMTU, &ifr) == -1) {
pcap_fmt_errmsg_for_errno(ebuf, PCAP_ERRBUF_SIZE,
errno, "SIOCGIFMTU");
return -1;
}
return ifr.ifr_mtu;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Register the security handler to provide TPM measure boot service. */ | EFI_STATUS EFIAPI DxeTpmMeasureBootLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* Register the security handler to provide TPM measure boot service. */
EFI_STATUS EFIAPI DxeTpmMeasureBootLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_HOB_GUID_TYPE *GuidHob;
GuidHob = NULL;
GuidHob = GetFirstGuidHob (&gMeasuredFvHobGuid);
if (GuidHob != NULL) {
mMeasuredHobData = GET_GUID_HOB_DATA (GuidHob);
}
return RegisterSecurity2Handler (
DxeTpmMeasureBootHandler,
EFI_AUTH_OPERATION_MEASURE_IMAGE | EFI_AUTH_OPERATION... | tianocore/edk2 | C++ | Other | 4,240 |
/* This is the entry point for the bootloader application and is called by the reset interrupt vector after the C-startup routines executed. */ | void main(void) | /* This is the entry point for the bootloader application and is called by the reset interrupt vector after the C-startup routines executed. */
void main(void) | {
Init();
BootComInit();
for (;;)
{
LedToggle();
BootComCheckActivationRequest();
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* qstring_append_chr(): Append a C char to a QString */ | void qstring_append_chr(QString *qstring, int c) | /* qstring_append_chr(): Append a C char to a QString */
void qstring_append_chr(QString *qstring, int c) | {
capacity_increase(qstring, 1);
qstring->string[qstring->length++] = c;
qstring->string[qstring->length] = 0;
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Returns the size of the Root Complex node. */ | STATIC UINT32 GetRootComplexNodeSize(IN CONST CM_ARM_ROOT_COMPLEX_NODE *Node) | /* Returns the size of the Root Complex node. */
STATIC UINT32 GetRootComplexNodeSize(IN CONST CM_ARM_ROOT_COMPLEX_NODE *Node) | {
ASSERT (Node != NULL);
return (UINT32)(sizeof (EFI_ACPI_6_0_IO_REMAPPING_RC_NODE) +
(Node->IdMappingCount *
sizeof (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE)));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* TIM_PWM MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim_pwm) | /* TIM_PWM MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim_pwm) | {
if(htim_pwm->Instance==TIM1)
{
__HAL_RCC_TIM1_CLK_DISABLE();
}
else if(htim_pwm->Instance==TIM3)
{
__HAL_RCC_TIM3_CLK_DISABLE();
}
else if(htim_pwm->Instance==TIM4)
{
__HAL_RCC_TIM4_CLK_DISABLE();
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* acpiphp_enable_slot - power on slot @slot: ACPI PHP slot */ | int acpiphp_enable_slot(struct acpiphp_slot *slot) | /* acpiphp_enable_slot - power on slot @slot: ACPI PHP slot */
int acpiphp_enable_slot(struct acpiphp_slot *slot) | {
int retval;
mutex_lock(&slot->crit_sect);
retval = power_on_slot(slot);
if (retval)
goto err_exit;
if (get_slot_status(slot) == ACPI_STA_ALL) {
retval = enable_device(slot);
if (retval)
power_off_slot(slot);
} else {
dbg("%s: Slot status is not ACPI_STA_ALL\n", __func__);
power_off_slot(slot);
}
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function returns all the memory mapped registers of the device. */ | static void amd8111e_read_regs(struct amd8111e_priv *lp, u32 *buf) | /* This function returns all the memory mapped registers of the device. */
static void amd8111e_read_regs(struct amd8111e_priv *lp, u32 *buf) | {
void __iomem *mmio = lp->mmio;
buf[0] = readl(mmio + XMT_RING_BASE_ADDR0);
buf[1] = readl(mmio + XMT_RING_LEN0);
buf[2] = readl(mmio + RCV_RING_BASE_ADDR0);
buf[3] = readl(mmio + RCV_RING_LEN0);
buf[4] = readl(mmio + CMD0);
buf[5] = readl(mmio + CMD2);
buf[6] = readl(mmio + CMD3);
buf[7] = readl(mmio + CMD7)... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* on newer systems PDC gives the address of the ROM in the additional address field addr while on older Systems the PDC stores it in page0->proc_sti */ | static int __devinit sticore_pa_init(struct parisc_device *dev) | /* on newer systems PDC gives the address of the ROM in the additional address field addr while on older Systems the PDC stores it in page0->proc_sti */
static int __devinit sticore_pa_init(struct parisc_device *dev) | {
char pa_path[21];
struct sti_struct *sti = NULL;
int hpa = dev->hpa.start;
if (dev->num_addrs && dev->addr[0])
sti = sti_try_rom_generic(dev->addr[0], hpa, NULL);
if (!sti)
sti = sti_try_rom_generic(hpa, hpa, NULL);
if (!sti)
sti = sti_try_rom_generic(PAGE0->proc_sti, hpa, NULL);
if (!sti)
return 1;
p... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* After "inc_cntr" times calling of this action, "npta" increase by one. this action tries to make vale of "npta" greater as possible; number of acknowledgements decreases by increasing of "npta". Returns 0 for success, 1 otherwise. */ | static int llc_conn_ac_inc_npta_value(struct sock *sk, struct sk_buff *skb) | /* After "inc_cntr" times calling of this action, "npta" increase by one. this action tries to make vale of "npta" greater as possible; number of acknowledgements decreases by increasing of "npta". Returns 0 for success, 1 otherwise. */
static int llc_conn_ac_inc_npta_value(struct sock *sk, struct sk_buff *skb) | {
struct llc_sock *llc = llc_sk(sk);
if (!llc->inc_cntr) {
llc->dec_step = 0;
llc->dec_cntr = llc->inc_cntr = 2;
++llc->npta;
if (llc->npta > (u8) ~LLC_2_SEQ_NBR_MODULO)
llc->npta = (u8) ~LLC_2_SEQ_NBR_MODULO;
} else
--llc->inc_cntr;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* initialize or add/subtract to second of the system time */ | void enet_ptp_timestamp_update_config(uint32_t sign, uint32_t second, uint32_t subsecond) | /* initialize or add/subtract to second of the system time */
void enet_ptp_timestamp_update_config(uint32_t sign, uint32_t second, uint32_t subsecond) | {
ENET_PTP_TSUH = second;
ENET_PTP_TSUL = sign | PTP_TSUL_TMSUSS(subsecond);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Print the hexical DWORD immediate data to instruction content. */ | UINTN EdbPrintImmData32(IN UINT32 Data) | /* Print the hexical DWORD immediate data to instruction content. */
UINTN EdbPrintImmData32(IN UINT32 Data) | {
EDBSPrintWithOffset (
mInstructionString.Content,
EDB_INSTRUCTION_CONTENT_MAX_SIZE,
mInstructionContentOffset,
L"(0x%08x)",
(UINTN)Data
);
mInstructionContentOffset += 12;
return mInstructionContentOffset;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Initialize the mfxstm32l152 and configure the needed hardware resources. */ | int32_t MFXSTM32L152_Init(MFXSTM32L152_Object_t *pObj) | /* Initialize the mfxstm32l152 and configure the needed hardware resources. */
int32_t MFXSTM32L152_Init(MFXSTM32L152_Object_t *pObj) | {
int32_t ret = MFXSTM32L152_OK;
if (pObj->IsInitialized == 0U)
{
pObj->IO.Init();
if (MFXSTM32L152_SetIrqOutPinPolarity(pObj, MFXSTM32L152_OUT_PIN_POLARITY_HIGH) != MFXSTM32L152_OK)
{
ret = MFXSTM32L152_ERROR;
}
else if (MFXSTM32L152_SetIrqOutPinType(pObj, MFXSTM32L152_OUT_PIN_TYPE_PUSH... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* wdt_supports_disable - determine if we are accessing a iop13xx watchdog or iop3xx by whether it has a disable command */ | static int wdt_supports_disable(void) | /* wdt_supports_disable - determine if we are accessing a iop13xx watchdog or iop3xx by whether it has a disable command */
static int wdt_supports_disable(void) | {
int can_disable;
if (IOP_WDTCR_EN_ARM != IOP_WDTCR_DIS_ARM)
can_disable = 1;
else
can_disable = 0;
return can_disable;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This routines are called before setting or resetting tty->stopped. */ | static void rs_stop(struct tty_struct *tty) | /* This routines are called before setting or resetting tty->stopped. */
static void rs_stop(struct tty_struct *tty) | {
struct m68k_serial *info = (struct m68k_serial *)tty->driver_data;
m68328_uart *uart = &uart_addr[info->line];
unsigned long flags;
if (serial_paranoia_check(info, tty->name, "rs_stop"))
return;
local_irq_save(flags);
uart->ustcnt &= ~USTCNT_TXEN;
local_irq_restore(flags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If DateTimeStr is NULL, then return FALSE. If DateTimeSize is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI CryptoServiceX509FormatDateTime(IN CONST CHAR8 *DateTimeStr, OUT VOID *DateTime, IN OUT UINTN *DateTimeSize) | /* If DateTimeStr is NULL, then return FALSE. If DateTimeSize is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceX509FormatDateTime(IN CONST CHAR8 *DateTimeStr, OUT VOID *DateTime, IN OUT UINTN *DateTimeSize) | {
return CALL_BASECRYPTLIB (X509.Services.FormatDateTime, X509FormatDateTime, (DateTimeStr, DateTime, DateTimeSize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Check amount of empty space in the IOM fifo. */ | uint8_t am_hal_iom_fifo_empty_slots(uint32_t ui32Module) | /* Check amount of empty space in the IOM fifo. */
uint8_t am_hal_iom_fifo_empty_slots(uint32_t ui32Module) | {
uint32_t ui32MaxFifoSize;
if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
{
return 0;
}
ui32MaxFifoSize = ((0 == AM_BFRn(IOMSTR, ui32Module, CFG, FULLDUP)) ? AM_HAL_IOM_MAX_FIFO_SIZE : AM_HAL_IOM_MAX_FIFO_SIZE / 2);
return (ui32MaxFifoSize - AM_BFRn(IOMSTR, ui32Module, FIFOPTR, FIFOSIZ)... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Implementation note The data byte is treated as two nibbles. The crc is generated in reverse, i.e., bits are fed into the register from the top. */ | static void bcsp_crc_update(u16 *crc, u8 d) | /* Implementation note The data byte is treated as two nibbles. The crc is generated in reverse, i.e., bits are fed into the register from the top. */
static void bcsp_crc_update(u16 *crc, u8 d) | {
u16 reg = *crc;
reg = (reg >> 4) ^ crc_table[(reg ^ d) & 0x000f];
reg = (reg >> 4) ^ crc_table[(reg ^ (d >> 4)) & 0x000f];
*crc = reg;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Struct op_entry is used during operations on the ring buffer while struct op_sample contains the data that is stored in the ring buffer. Struct entry can be uninitialized. The function reserves a data array that is specified by size. Use op_cpu_buffer_write_commit() after preparing the sample. In case of errors a nu... | struct op_sample* op_cpu_buffer_write_reserve(struct op_entry *entry, unsigned long size) | /* Struct op_entry is used during operations on the ring buffer while struct op_sample contains the data that is stored in the ring buffer. Struct entry can be uninitialized. The function reserves a data array that is specified by size. Use op_cpu_buffer_write_commit() after preparing the sample. In case of errors a nu... | {
entry->event = ring_buffer_lock_reserve
(op_ring_buffer_write, sizeof(struct op_sample) +
size * sizeof(entry->sample->data[0]));
if (entry->event)
entry->sample = ring_buffer_event_data(entry->event);
else
entry->sample = NULL;
if (!entry->sample)
return NULL;
entry->size = size;
entry->data = entry... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Handler for the EMAC peripheral. See the documentation for this port on */ | void vEMAC_ISR_Handler(void) | /* Handler for the EMAC peripheral. See the documentation for this port on */
void vEMAC_ISR_Handler(void) | {
prvResetMAC();
prvInitialiseDescriptors();
ETHERC.MAHR = ( ( unsigned long ) configMAC_ADDR0 << 24UL ) |
( ( unsigned long ) configMAC_ADDR1 << 16UL ) |
( ( unsigned long ) configMAC_ADDR2 << 8UL ) |
( unsigned long ) configMAC_ADDR3;
ETHERC.MALR.BIT.MA = ( ( unsigned long ) configMAC_ADDR4 << ... | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Retrieve the system clock frequency from eNVM spare page if available. Returns the frequency defined through SMARTFUSION_FCLK_FREQ if FCLK cannot be retrieved from eNVM spare pages. The FCLK frequency value selected in the MSS Configurator software tool is stored in eNVM spare pages as part of the Actel system boot ... | static unsigned int a2f_get_system_clock(void) | /* Retrieve the system clock frequency from eNVM spare page if available. Returns the frequency defined through SMARTFUSION_FCLK_FREQ if FCLK cannot be retrieved from eNVM spare pages. The FCLK frequency value selected in the MSS Configurator software tool is stored in eNVM spare pages as part of the Actel system boot ... | {
unsigned int fclk = 0;
unsigned int sysboot_version;
if (SYSBOOT_KEY_VALUE == readl(SYSBOOT_KEY_ADDR)) {
sysboot_version = readl(SYSBOOT_VERSION_ADDR);
sysboot_version &= SYSBOOT_VERSION_MASK;
if (sysboot_version >= MIN_SYSBOOT_VERSION) {
if (sysboot_version < SYSBOOT_VERSION_2_X) {
fclk = readl(SYSBO... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* USART pinmux initialization function.
Set each required pin to USART functionality */ | void TARGET_IO_PORT_init() | /* USART pinmux initialization function.
Set each required pin to USART functionality */
void TARGET_IO_PORT_init() | {
gpio_set_pin_function(PB26, PINMUX_PB26C_SERCOM2_PAD0);
gpio_set_pin_function(PB27, PINMUX_PB27C_SERCOM2_PAD1);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set the fields of structure stc_usart_smartcard_init_t to default values. */ | int32_t USART_SmartCard_StructInit(stc_usart_smartcard_init_t *pstcSmartCardInit) | /* Set the fields of structure stc_usart_smartcard_init_t to default values. */
int32_t USART_SmartCard_StructInit(stc_usart_smartcard_init_t *pstcSmartCardInit) | {
int32_t i32Ret = LL_ERR_INVD_PARAM;
if (NULL != pstcSmartCardInit) {
pstcSmartCardInit->u32ClockDiv = USART_CLK_DIV1;
pstcSmartCardInit->u32CKOutput = USART_CK_OUTPUT_DISABLE;
pstcSmartCardInit->u32Baudrate = USART_DEFAULT_BAUDRATE;
pstcSmartCardInit->u32FirstBit = USART_FIRST_... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function must be called with a TPL <= TPL_NOTIFY. If NameGuid is NULL, then ASSERT(). If Buffer is NULL, then ASSERT(). If Size is NULL, then ASSERT(). */ | EFI_STATUS EFIAPI GetSectionFromFv(IN CONST EFI_GUID *NameGuid, IN EFI_SECTION_TYPE SectionType, IN UINTN SectionInstance, OUT VOID **Buffer, OUT UINTN *Size) | /* This function must be called with a TPL <= TPL_NOTIFY. If NameGuid is NULL, then ASSERT(). If Buffer is NULL, then ASSERT(). If Size is NULL, then ASSERT(). */
EFI_STATUS EFIAPI GetSectionFromFv(IN CONST EFI_GUID *NameGuid, IN EFI_SECTION_TYPE SectionType, IN UINTN SectionInstance, OUT VOID **Buffer, OUT UINTN *Size... | {
return InternalGetSectionFromFv (
InternalImageHandleToFvHandle (gImageHandle),
NameGuid,
SectionType,
SectionInstance,
Buffer,
Size
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables or disables the specified DAC channel DMA request. */ | void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState) | /* Enables or disables the specified DAC channel DMA request. */
void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState) | {
assert_param(IS_DAC_CHANNEL(DAC_Channel));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
DAC->CR |= CR_DMAEN_Set << DAC_Channel;
}
else
{
DAC->CR &= ~(CR_DMAEN_Set << DAC_Channel);
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* mark a page as having been made dirty and thus needing writeback */ | int afs_set_page_dirty(struct page *page) | /* mark a page as having been made dirty and thus needing writeback */
int afs_set_page_dirty(struct page *page) | {
_enter("");
return __set_page_dirty_nobuffers(page);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the first readable byte of the ring buffer. */ | rt_size_t rt_ringbuffer_peak(struct rt_ringbuffer *rb, rt_uint8_t **ptr) | /* Get the first readable byte of the ring buffer. */
rt_size_t rt_ringbuffer_peak(struct rt_ringbuffer *rb, rt_uint8_t **ptr) | {
RT_ASSERT(rb != RT_NULL);
*ptr = RT_NULL;
rt_size_t size = rt_ringbuffer_data_len(rb);
if (size == 0)
return 0;
*ptr = &rb->buffer_ptr[rb->read_index];
if(rb->buffer_size - rb->read_index > size)
{
rb->read_index += size;
return size;
}
size = rb->buffer_siz... | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Start a setup transfer by changing the state-machine and initializing the required variables needed for the Control Transfer. */ | void usb_host_submitsetupreq(USBH_HOST *phost, uint8_t *buff, uint16_t length) | /* Start a setup transfer by changing the state-machine and initializing the required variables needed for the Control Transfer. */
void usb_host_submitsetupreq(USBH_HOST *phost, uint8_t *buff, uint16_t length) | {
phost->host_state_backup = phost->host_state;
phost->host_state = HOST_CTRL_TRANSMIT;
phost->ctrlparam.buff = buff;
phost->ctrlparam.length = length;
phost->ctrlparam.ctrl_state = CTRL_SETUP;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* param src USB HS does not care about the clock source, here must be ref kCLOCK_UsbSrcUnused. param freq USB HS does not care about the clock source, so this parameter is ignored. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */ | bool CLOCK_EnableUsbhs0Clock(clock_usb_src_t src, uint32_t freq) | /* param src USB HS does not care about the clock source, here must be ref kCLOCK_UsbSrcUnused. param freq USB HS does not care about the clock source, so this parameter is ignored. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */
bool CLOCK_EnableUsbhs... | {
uint32_t i;
CCM->CCGR6 |= CCM_CCGR6_CG0_MASK;
USB1->USBCMD |= USBHS_USBCMD_RST_MASK;
for (i = 0; i < 400000U; i++)
{
__ASM("nop");
}
PMU->REG_3P0 = (PMU->REG_3P0 & (~PMU_REG_3P0_OUTPUT_TRG_MASK)) |
(PMU_REG_3P0_OUTPUT_TRG(0x17) | PMU_REG_3P0_ENABLE_LINREG_MASK);
... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* This function will enable network interface device . */ | int netdev_set_up(struct netdev *netdev) | /* This function will enable network interface device . */
int netdev_set_up(struct netdev *netdev) | {
RT_ASSERT(netdev);
if (!netdev->ops || !netdev->ops->set_up)
{
LOG_E("The network interface device(%s) not support to set status.", netdev->name);
return -RT_ERROR;
}
if (netdev_is_up(netdev))
{
return RT_EOK;
}
return netdev->ops->set_up(netdev);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* USBH_FindInterface Find the interface index for a specific class. */ | uint8_t USBH_FindInterface(USBH_HandleTypeDef *phost, uint8_t Class, uint8_t SubClass, uint8_t Protocol) | /* USBH_FindInterface Find the interface index for a specific class. */
uint8_t USBH_FindInterface(USBH_HandleTypeDef *phost, uint8_t Class, uint8_t SubClass, uint8_t Protocol) | {
USBH_InterfaceDescTypeDef *pif;
USBH_CfgDescTypeDef *pcfg;
uint8_t if_ix = 0U;
pif = (USBH_InterfaceDescTypeDef *)NULL;
pcfg = &phost->device.CfgDesc;
while (if_ix < USBH_MAX_NUM_INTERFACES)
{
pif = &pcfg->Itf_Desc[if_ix];
if (((pif->bInterfaceClass == Class) || (Class == 0xFFU)) &&
((pi... | ua1arn/hftrx | C++ | null | 69 |
/* Read 64-bit timestamp value.
This function returns a 64-bit bit time stamp value that is clocked at the same frequency as the CPU. */ | uint64_t z_tsc_read(void) | /* Read 64-bit timestamp value.
This function returns a 64-bit bit time stamp value that is clocked at the same frequency as the CPU. */
uint64_t z_tsc_read(void) | {
unsigned int key;
uint64_t t;
uint32_t count;
key = arch_irq_lock();
t = (uint64_t)sys_clock_tick_get();
count = z_arc_v2_aux_reg_read(_ARC_V2_TMR0_COUNT);
arch_irq_unlock(key);
t *= k_ticks_to_cyc_floor64(1);
t += (uint64_t)count;
return t;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Waits to write a data word into the SDHost write buffer. */ | void SDHostDataWrite(unsigned long ulBase, unsigned long ulData) | /* Waits to write a data word into the SDHost write buffer. */
void SDHostDataWrite(unsigned long ulBase, unsigned long ulData) | {
while( !(HWREG(ulBase + MMCHS_O_PSTATE) & (1<<10)) )
{
}
HWREG(ulBase + MMCHS_O_DATA) = ulData;
} | micropython/micropython | C++ | Other | 18,334 |
/* Set the minutes and seconds from seconds value 'nowtime'. Fail if clock is out by > 30 minutes. Logic lifted from atari code. */ | static int q40_set_clock_mmss(unsigned long) | /* Set the minutes and seconds from seconds value 'nowtime'. Fail if clock is out by > 30 minutes. Logic lifted from atari code. */
static int q40_set_clock_mmss(unsigned long) | {
int retval = 0;
short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
int rtc_minutes;
rtc_minutes = bcd2bin(Q40_RTC_MINS);
if ((rtc_minutes < real_minutes ?
real_minutes - rtc_minutes :
rtc_minutes - real_minutes) < 30) {
Q40_RTC_CTRL |= Q40_RTC_WRITE;
Q40_RTC_MINS = bin2bcd(rea... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Decodes the result of scsi MODE SENSE 6 command. */ | static void uhi_msc_scsi_mode_sense6_done(bool b_cbw_succes) | /* Decodes the result of scsi MODE SENSE 6 command. */
static void uhi_msc_scsi_mode_sense6_done(bool b_cbw_succes) | {
if ((!b_cbw_succes) || (uhi_msc_csw.bCSWStatus != USB_CSW_STATUS_PASS)
|| (uhi_msc_csw.dCSWDataResidue < 4)) {
uhi_msc_lun_sel->b_write_protected = false;
uhi_msc_scsi_callback(true);
return;
}
uhi_msc_lun_sel->b_write_protected =
(uhi_msc_sense6.header.device_specific_parameter
& SCSI_MS_SBC_WP);
... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This is used by subsystems that don't want seekable file descriptors */ | int nonseekable_open(struct inode *inode, struct file *filp) | /* This is used by subsystems that don't want seekable file descriptors */
int nonseekable_open(struct inode *inode, struct file *filp) | {
filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Parse the options in the OACK packet to MTFTP4_OPTION which program can access directly. */ | EFI_STATUS Mtftp4ParseOptionOack(IN EFI_MTFTP4_PACKET *Packet, IN UINT32 PacketLen, IN UINT16 Operation, OUT MTFTP4_OPTION *MtftpOption) | /* Parse the options in the OACK packet to MTFTP4_OPTION which program can access directly. */
EFI_STATUS Mtftp4ParseOptionOack(IN EFI_MTFTP4_PACKET *Packet, IN UINT32 PacketLen, IN UINT16 Operation, OUT MTFTP4_OPTION *MtftpOption) | {
EFI_MTFTP4_OPTION *OptionList;
EFI_STATUS Status;
UINT32 Count;
MtftpOption->Exist = 0;
Status = Mtftp4ExtractOptions (Packet, PacketLen, &Count, &OptionList);
if (EFI_ERROR (Status) || (Count == 0)) {
return Status;
}
ASSERT (OptionList != NULL);
Status = Mtftp4ParseOption ... | tianocore/edk2 | C++ | Other | 4,240 |
/* Fast checksum update for possibly oddly-aligned UDP byte, from the code example in the draft. */ | static void fast_csum(__sum16 *csum, const unsigned char *optr, const unsigned char *nptr, int offset) | /* Fast checksum update for possibly oddly-aligned UDP byte, from the code example in the draft. */
static void fast_csum(__sum16 *csum, const unsigned char *optr, const unsigned char *nptr, int offset) | {
unsigned char s[4];
if (offset & 1) {
s[0] = s[2] = 0;
s[1] = ~*optr;
s[3] = *nptr;
} else {
s[1] = s[3] = 0;
s[0] = ~*optr;
s[2] = *nptr;
}
*csum = csum_fold(csum_partial(s, 4, ~csum_unfold(*csum)));
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Sends the XCP PROGRAM RESET command. Note that this command is a bit different as in it does not require a response. */ | static bool XcpLoaderSendCmdProgramReset(void) | /* Sends the XCP PROGRAM RESET command. Note that this command is a bit different as in it does not require a response. */
static bool XcpLoaderSendCmdProgramReset(void) | {
bool result = false;
tXcpTransportPacket cmdPacket;
tXcpTransportPacket resPacket;
assert(xcpSettings.transport != NULL);
if (xcpSettings.transport != NULL)
{
result = true;
cmdPacket.data[0] = XCPLOADER_CMD_PROGRAM_RESET;
cmdPacket.len = 1;
if (xcpSettings.transport->SendPacket(&cmdPacket... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Prototype: void acornscsi_intr(int irq, void *dev_id) Purpose : handle interrupts from Acorn SCSI card Params : irq - interrupt number dev_id - device specific data (AS_Host structure) */ | static irqreturn_t acornscsi_intr(int irq, void *dev_id) | /* Prototype: void acornscsi_intr(int irq, void *dev_id) Purpose : handle interrupts from Acorn SCSI card Params : irq - interrupt number dev_id - device specific data (AS_Host structure) */
static irqreturn_t acornscsi_intr(int irq, void *dev_id) | {
AS_Host *host = (AS_Host *)dev_id;
intr_ret_t ret;
int iostatus;
int in_irq = 0;
do {
ret = INTR_IDLE;
iostatus = readb(host->fast + INT_REG);
if (iostatus & 2) {
acornscsi_dma_intr(host);
iostatus = readb(host->fast + INT_REG);
}
if (iostatus & 8)
ret = acornscsi_sbicintr(host... | robutest/uclinux | C++ | GPL-2.0 | 60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.