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 the maximum watchdog offset register value. */
|
STATIC UINT64 GetMaxWatchdogOffsetRegisterValue(VOID)
|
/* This function returns the maximum watchdog offset register value. */
STATIC UINT64 GetMaxWatchdogOffsetRegisterValue(VOID)
|
{
UINT64 MaxWatchdogOffsetValue;
UINT32 WatchdogIId;
UINT8 WatchdogArchRevision;
WatchdogIId = MmioRead32 (GENERIC_WDOG_IID_REG);
WatchdogArchRevision = (WatchdogIId >> GENERIC_WDOG_IID_ARCH_REV_SHIFT) & GENERIC_WDOG_IID_ARCH_REV_MASK;
if (WatchdogArchRevision == 0) {
MaxWatchdogOffsetValue = MAX_UINT32;
} else {
MaxWatchdogOffsetValue = MAX_UINT48;
}
return MaxWatchdogOffsetValue;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* socrates_nand_read_buf - read chip data into buffer @mtd: MTD device structure @buf: buffer to store date @len: number of bytes to read */
|
static void socrates_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
|
/* socrates_nand_read_buf - read chip data into buffer @mtd: MTD device structure @buf: buffer to store date @len: number of bytes to read */
static void socrates_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
|
{
int i;
struct nand_chip *this = mtd->priv;
struct socrates_nand_host *host = this->priv;
uint32_t val;
val = FPGA_NAND_ENABLE | FPGA_NAND_CMD_READ;
out_be32(host->io_base, val);
for (i = 0; i < len; i++) {
buf[i] = (in_be32(host->io_base) >>
FPGA_NAND_DATA_SHIFT) & 0xff;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function is an abstraction layer for implementation specific Mm buffer validation routine. */
|
BOOLEAN IsBufferOutsideMmValid(IN EFI_PHYSICAL_ADDRESS Buffer, IN UINT64 Length)
|
/* This function is an abstraction layer for implementation specific Mm buffer validation routine. */
BOOLEAN IsBufferOutsideMmValid(IN EFI_PHYSICAL_ADDRESS Buffer, IN UINT64 Length)
|
{
return SmmIsBufferOutsideSmmValid (Buffer, Length);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* NULL request string support depends on the ExportConfig interface of HiiConfigRouting protocol in UEFI specification. */
|
BOOLEAN EFIAPI HiiValidateSettings(IN CONST EFI_STRING Request OPTIONAL)
|
/* NULL request string support depends on the ExportConfig interface of HiiConfigRouting protocol in UEFI specification. */
BOOLEAN EFIAPI HiiValidateSettings(IN CONST EFI_STRING Request OPTIONAL)
|
{
return InternalHiiIfrValueAction (Request, 0, ACTION_VALIDATE_SETTING);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Receive a piece of data for SPI master.
This function computes the number of data to receive from D register or Rx FIFO, and write the data to destination address. At the same time, this function updates the values in master handle structure. */
|
static void FLEXIO_SPI_TransferReceiveTransaction(FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle)
|
/* Receive a piece of data for SPI master.
This function computes the number of data to receive from D register or Rx FIFO, and write the data to destination address. At the same time, this function updates the values in master handle structure. */
static void FLEXIO_SPI_TransferReceiveTransaction(FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle)
|
{
uint16_t tmpData;
tmpData = FLEXIO_SPI_ReadData(base, handle->direction);
if (handle->rxData != NULL)
{
if (handle->bytePerFrame == 1U)
{
*handle->rxData = (uint8_t)tmpData;
handle->rxData++;
}
else
{
if (handle->direction == kFLEXIO_SPI_MsbFirst)
{
*handle->rxData = (uint8_t)(tmpData >> 8);
handle->rxData++;
*handle->rxData = (uint8_t)tmpData;
}
else
{
*handle->rxData = (uint8_t)tmpData;
handle->rxData++;
*handle->rxData = (uint8_t)(tmpData >> 8);
}
handle->rxData++;
}
}
handle->rxRemainingBytes -= handle->bytePerFrame;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Deinitialize USTIMER driver.
Will disable interrupts and turn off the clock to the underlying hardware timer. */
|
Ecode_t USTIMER_DeInit(void)
|
/* Deinitialize USTIMER driver.
Will disable interrupts and turn off the clock to the underlying hardware timer. */
Ecode_t USTIMER_DeInit(void)
|
{
NVIC_DisableIRQ( TIMER_IRQ );
TIMER_IntDisable( TIMER, TIMER_IEN_CC0 );
TIMER_IntClear( TIMER, TIMER_IFC_CC0 );
NVIC_ClearPendingIRQ( TIMER_IRQ );
TIMER_Enable( TIMER, false );
CMU_ClockEnable( TIMER_CLK, false );
return ECODE_EMDRV_USTIMER_OK;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* X.25 dissector for use when "pinfo->pseudo_header" points to a "struct x25_phdr". */
|
static int dissect_x25_dir(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
/* X.25 dissector for use when "pinfo->pseudo_header" points to a "struct x25_phdr". */
static int dissect_x25_dir(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
{
dissect_x25_common(tvb, pinfo, tree,
(pinfo->pseudo_header->x25.flags & FROM_DCE) ? X25_FROM_DCE :
X25_FROM_DTE,
pinfo->pseudo_header->x25.flags & FROM_DCE);
return tvb_captured_length(tvb);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Reading from the trace_buffer. The trace buffer is two 64-bit registers. Reading from the second half automatically increments the trace_address. */
|
void cbe_read_trace_buffer(u32 cpu, u64 *buf)
|
/* Reading from the trace_buffer. The trace buffer is two 64-bit registers. Reading from the second half automatically increments the trace_address. */
void cbe_read_trace_buffer(u32 cpu, u64 *buf)
|
{
struct cbe_pmd_regs __iomem *pmd_regs = cbe_get_cpu_pmd_regs(cpu);
*buf++ = in_be64(&pmd_regs->trace_buffer_0_63);
*buf++ = in_be64(&pmd_regs->trace_buffer_64_127);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* @discussion This function creates an elementar object from local data pointer, which is specially useful for environment without filesystem support. */
|
ElmHandle ElmCreateObjectFromData(ELM_OBJECT_TYPE type, void *data, int size)
|
/* @discussion This function creates an elementar object from local data pointer, which is specially useful for environment without filesystem support. */
ElmHandle ElmCreateObjectFromData(ELM_OBJECT_TYPE type, void *data, int size)
|
{
return _create_object_from_data(type, data, size);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* retval kStatus_Success retval kStatus_I2S_Busy if all queue slots are occupied with buffers which are not full. */
|
status_t I2S_RxTransferNonBlocking(I2S_Type *base, i2s_handle_t *handle, i2s_transfer_t transfer)
|
/* retval kStatus_Success retval kStatus_I2S_Busy if all queue slots are occupied with buffers which are not full. */
status_t I2S_RxTransferNonBlocking(I2S_Type *base, i2s_handle_t *handle, i2s_transfer_t transfer)
|
{
assert(handle != NULL);
status_t result;
if (NULL == handle)
{
return kStatus_InvalidArgument;
}
result = I2S_ValidateBuffer(handle, &transfer);
if (result != kStatus_Success)
{
return result;
}
if (handle->i2sQueue[handle->queueUser].dataSize != 0UL)
{
return kStatus_I2S_Busy;
}
handle->i2sQueue[handle->queueUser].data = transfer.data;
handle->i2sQueue[handle->queueUser].dataSize = transfer.dataSize;
handle->queueUser = (handle->queueUser + 1U) % I2S_NUM_BUFFERS;
base->FIFOTRIG = (base->FIFOTRIG & (~I2S_FIFOTRIG_RXLVL_MASK)) | I2S_FIFOTRIG_RXLVL(handle->watermark);
I2S_RxEnable(base, true);
return kStatus_Success;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* start pending instances and check the scheduling ticks. when the scheduling ticks is changed set CHANGE flag to reprogram the timer. */
|
static void snd_timer_reschedule(struct snd_timer *timer, unsigned long ticks_left)
|
/* start pending instances and check the scheduling ticks. when the scheduling ticks is changed set CHANGE flag to reprogram the timer. */
static void snd_timer_reschedule(struct snd_timer *timer, unsigned long ticks_left)
|
{
struct snd_timer_instance *ti;
unsigned long ticks = ~0UL;
list_for_each_entry(ti, &timer->active_list_head, active_list) {
if (ti->flags & SNDRV_TIMER_IFLG_START) {
ti->flags &= ~SNDRV_TIMER_IFLG_START;
ti->flags |= SNDRV_TIMER_IFLG_RUNNING;
timer->running++;
}
if (ti->flags & SNDRV_TIMER_IFLG_RUNNING) {
if (ticks > ti->cticks)
ticks = ti->cticks;
}
}
if (ticks == ~0UL) {
timer->flags &= ~SNDRV_TIMER_FLG_RESCHED;
return;
}
if (ticks > timer->hw.ticks)
ticks = timer->hw.ticks;
if (ticks_left != ticks)
timer->flags |= SNDRV_TIMER_FLG_CHANGE;
timer->sticks = ticks;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Detects if VMX feature supported on current processor. */
|
BOOLEAN EFIAPI VmxSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
|
/* Detects if VMX feature supported on current processor. */
BOOLEAN EFIAPI VmxSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
|
{
return (CpuInfo->CpuIdVersionInfoEcx.Bits.VMX == 1);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Return if there is touch detected or not. */
|
uint8_t exc7200_TS_DetectTouch(uint16_t DeviceAddr)
|
/* Return if there is touch detected or not. */
uint8_t exc7200_TS_DetectTouch(uint16_t DeviceAddr)
|
{
IOE_ReadMultiple(DeviceAddr | 1, EXC7200_READ_CMD, aBufferTS, 10);
if (aBufferTS[1]==0x83)
{ return 1;
}
return 0;
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Dumps an @charset rule statement to a file. */
|
void cr_statement_dump_charset(CRStatement *a_this, FILE *a_fp, gulong a_indent)
|
/* Dumps an @charset rule statement to a file. */
void cr_statement_dump_charset(CRStatement *a_this, FILE *a_fp, gulong a_indent)
|
{
guchar *str = NULL;
g_return_if_fail (a_this && a_this->type == AT_CHARSET_RULE_STMT);
str = cr_statement_charset_to_string (a_this,
a_indent) ;
if (str) {
fprintf (a_fp, str) ;
g_free (str) ;
str = NULL ;
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Initialization function for the floating-point sparse FIR filter. */
|
void arm_fir_sparse_init_f32(arm_fir_sparse_instance_f32 *S, uint16_t numTaps, const float32_t *pCoeffs, float32_t *pState, int32_t *pTapDelay, uint16_t maxDelay, uint32_t blockSize)
|
/* Initialization function for the floating-point sparse FIR filter. */
void arm_fir_sparse_init_f32(arm_fir_sparse_instance_f32 *S, uint16_t numTaps, const float32_t *pCoeffs, float32_t *pState, int32_t *pTapDelay, uint16_t maxDelay, uint32_t blockSize)
|
{
S->numTaps = numTaps;
S->pCoeffs = pCoeffs;
S->pTapDelay = pTapDelay;
S->maxDelay = maxDelay;
S->stateIndex = 0U;
memset(pState, 0, (maxDelay + blockSize) * sizeof(float32_t));
S->pState = pState;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Aborts an ongoing job.
This function will abort the specified job type. */
|
void spi_abort_job(struct spi_module *const module)
|
/* Aborts an ongoing job.
This function will abort the specified job type. */
void spi_abort_job(struct spi_module *const module)
|
{
SercomSpi *const spi_hw
= &(module->hw->SPI);
spi_hw->INTENCLR.reg = SPI_INTERRUPT_FLAG_RX_COMPLETE |
SPI_INTERRUPT_FLAG_DATA_REGISTER_EMPTY |
SPI_INTERRUPT_FLAG_TX_COMPLETE;
module->status = STATUS_ABORTED;
module->remaining_rx_buffer_length = 0;
module->remaining_dummy_buffer_length = 0;
module->remaining_tx_buffer_length = 0;
module->dir = SPI_DIRECTION_IDLE;
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Enable output to the timer pin.
Valid values for ui32TimerSegment are: */
|
void am_hal_ctimer_pin_enable(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment)
|
/* Enable output to the timer pin.
Valid values for ui32TimerSegment are: */
void am_hal_ctimer_pin_enable(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment)
|
{
volatile uint32_t *pui32ConfigReg;
pui32ConfigReg = (uint32_t *)(AM_REG_CTIMERn(0) + AM_REG_CTIMER_CTRL0_O +
(ui32TimerNumber * TIMER_OFFSET));
AM_CRITICAL_BEGIN_ASM
AM_REGVAL(pui32ConfigReg) |= (ui32TimerSegment &
(AM_REG_CTIMER_CTRL0_TMRA0PE_M |
AM_REG_CTIMER_CTRL0_TMRB0PE_M));
AM_CRITICAL_END_ASM
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This call is not reentrant, and must not be made in parallel on the same endpoint. */
|
int rpcrdma_ep_disconnect(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia)
|
/* This call is not reentrant, and must not be made in parallel on the same endpoint. */
int rpcrdma_ep_disconnect(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia)
|
{
int rc;
rpcrdma_clean_cq(ep->rep_cq);
rc = rdma_disconnect(ia->ri_id);
if (!rc) {
wait_event_interruptible(ep->rep_connect_wait,
ep->rep_connected != 1);
dprintk("RPC: %s: after wait, %sconnected\n", __func__,
(ep->rep_connected == 1) ? "still " : "dis");
} else {
dprintk("RPC: %s: rdma_disconnect %i\n", __func__, rc);
ep->rep_connected = rc;
}
return rc;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* string date_func(void) Return the current system date. Description Our second function does not expects arguments and return the current system date. Parameter None Return value String: Current system date. Usage example <?php echo date_func(); //would return 14:53:30 ?> */
|
int date_func(ph7_context *pCtx, int argc, ph7_value **argv)
|
/* string date_func(void) Return the current system date. Description Our second function does not expects arguments and return the current system date. Parameter None Return value String: Current system date. Usage example <?php echo date_func(); //would return 14:53:30 ?> */
int date_func(ph7_context *pCtx, int argc, ph7_value **argv)
|
{
time_t tt;
struct tm *pNow;
time(&tt);
pNow = localtime(&tt);
ph7_result_string_format(pCtx,
"%04d-%02d-%02d %02d:%02d:%02d",
pNow->tm_year + 1900,
pNow->tm_mday,
pNow->tm_mon + 1,
pNow->tm_hour,
pNow->tm_min,
pNow->tm_sec
);
return PH7_OK;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* platform_pre_snapshot - prepare the machine for hibernation using the platform driver if so configured and return an error code if it fails */
|
static int platform_pre_snapshot(int platform_mode)
|
/* platform_pre_snapshot - prepare the machine for hibernation using the platform driver if so configured and return an error code if it fails */
static int platform_pre_snapshot(int platform_mode)
|
{
return (platform_mode && hibernation_ops) ?
hibernation_ops->pre_snapshot() : 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Cancel async packets that are no longer valid */
|
static void uhci_async_validate_end(UHCIState *s)
|
/* Cancel async packets that are no longer valid */
static void uhci_async_validate_end(UHCIState *s)
|
{
UHCIQueue *queue, *n;
QTAILQ_FOREACH_SAFE(queue, &s->queues, next, n) {
if (!queue->valid) {
uhci_queue_free(queue, "validate-end");
}
}
}
|
ve3wwg/teensy3_qemu
|
C++
|
Other
| 15
|
/* Disable time stamp snapshot for PTP over Ethernet frames. When disabled, time stamp snapshot is not taken for PTP over Ethernet frames Reserved when "Advanced Time Stamp" is not selected */
|
void synopGMAC_TS_ptp_over_ethernet_disable(synopGMACdevice *gmacdev)
|
/* Disable time stamp snapshot for PTP over Ethernet frames. When disabled, time stamp snapshot is not taken for PTP over Ethernet frames Reserved when "Advanced Time Stamp" is not selected */
void synopGMAC_TS_ptp_over_ethernet_disable(synopGMACdevice *gmacdev)
|
{
synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSIPENA);
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Called whenever an interrupt is generated by the velocity adapter IRQ line. We may not be the source of the interrupt and need to identify initially if we are, and if not exit as efficiently as possible. */
|
static irqreturn_t velocity_intr(int irq, void *dev_instance)
|
/* Called whenever an interrupt is generated by the velocity adapter IRQ line. We may not be the source of the interrupt and need to identify initially if we are, and if not exit as efficiently as possible. */
static irqreturn_t velocity_intr(int irq, void *dev_instance)
|
{
struct net_device *dev = dev_instance;
struct velocity_info *vptr = netdev_priv(dev);
u32 isr_status;
spin_lock(&vptr->lock);
isr_status = mac_read_isr(vptr->mac_regs);
if (isr_status == 0) {
spin_unlock(&vptr->lock);
return IRQ_NONE;
}
mac_write_isr(vptr->mac_regs, isr_status);
if (likely(napi_schedule_prep(&vptr->napi))) {
mac_disable_int(vptr->mac_regs);
__napi_schedule(&vptr->napi);
}
if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI)))
velocity_error(vptr, isr_status);
spin_unlock(&vptr->lock);
return IRQ_HANDLED;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This API checks the presence of non-valid frames in the read fifo data. */
|
static void check_frame_validity(uint16_t *data_index, const struct bmi160_dev *dev)
|
/* This API checks the presence of non-valid frames in the read fifo data. */
static void check_frame_validity(uint16_t *data_index, const struct bmi160_dev *dev)
|
{
if ((*data_index + 2) < dev->fifo->length)
{
if ((dev->fifo->data[*data_index] == FIFO_CONFIG_MSB_CHECK) &&
(dev->fifo->data[*data_index + 1] == FIFO_CONFIG_LSB_CHECK))
{
*data_index = dev->fifo->length;
}
}
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* base should point to a location where it's safe to store the file, and nest_level should indicate how many nested includes have occurred. For this include, nest_level has already been incremented and doesn't need to be incremented here. */
|
static int handle_include(cmd_tbl_t *cmdtp, char **c, unsigned long base, struct pxe_menu *cfg, int nest_level)
|
/* base should point to a location where it's safe to store the file, and nest_level should indicate how many nested includes have occurred. For this include, nest_level has already been incremented and doesn't need to be incremented here. */
static int handle_include(cmd_tbl_t *cmdtp, char **c, unsigned long base, struct pxe_menu *cfg, int nest_level)
|
{
char *include_path;
char *s = *c;
int err;
char *buf;
int ret;
err = parse_sliteral(c, &include_path);
if (err < 0) {
printf("Expected include path: %.*s\n", (int)(*c - s), s);
return err;
}
err = get_pxe_file(cmdtp, include_path, base);
if (err < 0) {
printf("Couldn't retrieve %s\n", include_path);
return err;
}
buf = map_sysmem(base, 0);
ret = parse_pxefile_top(cmdtp, buf, base, cfg, nest_level);
unmap_sysmem(buf);
return ret;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Displays a maximum of 20 char on the LCD. */
|
void LCD_DisplayStringLine(uint8_t Line, uint8_t *ptr)
|
/* Displays a maximum of 20 char on the LCD. */
void LCD_DisplayStringLine(uint8_t Line, uint8_t *ptr)
|
{
uint16_t refcolumn = 0;
int16_t deltacolumn;
refcolumn = 319;
deltacolumn = -LCD_Currentfonts->Width;
while (*ptr != 0)
{
LCD_DisplayChar(Line, refcolumn, *ptr);
refcolumn += deltacolumn;
ptr++;
}
}
|
avem-labs/Avem
|
C++
|
MIT License
| 1,752
|
/* Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
|
VOID* EFIAPI AllocatePages(IN UINTN Pages)
|
/* Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocatePages(IN UINTN Pages)
|
{
return AllocateAlignedPages (Pages, SIZE_4KB);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Initialize the hardware by resetting the hardware, filling the bus info structure and media type, clears all on chip counters, initializes receive address registers, multicast table, VLAN filter table, calls routine to set up link and flow control settings, and leaves transmit and receive units disabled and uninitialized */
|
s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw)
|
/* Initialize the hardware by resetting the hardware, filling the bus info structure and media type, clears all on chip counters, initializes receive address registers, multicast table, VLAN filter table, calls routine to set up link and flow control settings, and leaves transmit and receive units disabled and uninitialized */
s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw)
|
{
s32 status;
status = hw->mac.ops.reset_hw(hw);
if (status == 0) {
status = hw->mac.ops.start_hw(hw);
}
return status;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Interrupt handler for asynchronous events used with MSI-X. */
|
static irqreturn_t t3_async_intr_handler(int irq, void *cookie)
|
/* Interrupt handler for asynchronous events used with MSI-X. */
static irqreturn_t t3_async_intr_handler(int irq, void *cookie)
|
{
t3_slow_intr_handler(cookie);
return IRQ_HANDLED;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The function consider two load options are equal when the OptionType, Attributes, Description, FilePath and OptionalData are equal. */
|
INTN EFIAPI EfiBootManagerFindLoadOption(IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key, IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array, IN UINTN Count)
|
/* The function consider two load options are equal when the OptionType, Attributes, Description, FilePath and OptionalData are equal. */
INTN EFIAPI EfiBootManagerFindLoadOption(IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key, IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array, IN UINTN Count)
|
{
UINTN Index;
for (Index = 0; Index < Count; Index++) {
if ((Key->OptionType == Array[Index].OptionType) &&
(Key->Attributes == Array[Index].Attributes) &&
(StrCmp (Key->Description, Array[Index].Description) == 0) &&
(CompareMem (Key->FilePath, Array[Index].FilePath, GetDevicePathSize (Key->FilePath)) == 0) &&
(Key->OptionalDataSize == Array[Index].OptionalDataSize) &&
(CompareMem (Key->OptionalData, Array[Index].OptionalData, Key->OptionalDataSize) == 0))
{
return (INTN)Index;
}
}
return -1;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* The function initial system timer. Use local timer (== DNUM of a core) to generate a clock on TIMO0,interrupts are generated as well */
|
void rt_hw_system_timer_start(void)
|
/* The function initial system timer. Use local timer (== DNUM of a core) to generate a clock on TIMO0,interrupts are generated as well */
void rt_hw_system_timer_start(void)
|
{
Timer64_Config tmrCfg;
gp_bootcfg_regs->TOUTSEL = (DNUM*2) << CSL_BOOTCFG_TOUTSEL_TOUTSEL0_SHIFT;
tmrCfg.timer_num = DNUM;
tmrCfg.timerMode = TIMER_PERIODIC_CLOCK;
tmrCfg.period = (unsigned long long) RT_TICK_PER_SECOND * DSP_CORE_SPEED_HZ / 6000;
tmrCfg.reload_period = 0;
timer64_init(&tmrCfg);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* return kStatus_Success: Success in setting the time and starting the SNVS SRTC kStatus_InvalidArgument: Error because the datetime format is incorrect */
|
status_t SNVS_LP_SRTC_SetDatetime(SNVS_Type *base, const snvs_lp_srtc_datetime_t *datetime)
|
/* return kStatus_Success: Success in setting the time and starting the SNVS SRTC kStatus_InvalidArgument: Error because the datetime format is incorrect */
status_t SNVS_LP_SRTC_SetDatetime(SNVS_Type *base, const snvs_lp_srtc_datetime_t *datetime)
|
{
assert(datetime);
uint32_t seconds = 0U;
uint32_t tmp = base->LPCR;
SNVS_LP_SRTC_StopTimer(base);
if (!(SNVS_LP_CheckDatetimeFormat(datetime)))
{
return kStatus_InvalidArgument;
}
seconds = SNVS_LP_ConvertDatetimeToSeconds(datetime);
base->LPSRTCMR = (uint32_t)(seconds >> 17U);
base->LPSRTCLR = (uint32_t)(seconds << 15U);
if (tmp & SNVS_LPCR_SRTC_ENV_MASK)
{
SNVS_LP_SRTC_StartTimer(base);
}
return kStatus_Success;
}
|
nanoframework/nf-interpreter
|
C++
|
MIT License
| 293
|
/* Note: exit routine for fc_lport instance clean-up all the allocated memory and free up other system resources. */
|
int fc_lport_destroy(struct fc_lport *lport)
|
/* Note: exit routine for fc_lport instance clean-up all the allocated memory and free up other system resources. */
int fc_lport_destroy(struct fc_lport *lport)
|
{
mutex_lock(&lport->lp_mutex);
lport->state = LPORT_ST_DISABLED;
lport->link_up = 0;
lport->tt.frame_send = fc_frame_drop;
mutex_unlock(&lport->lp_mutex);
lport->tt.fcp_abort_io(lport);
lport->tt.disc_stop_final(lport);
lport->tt.exch_mgr_reset(lport, 0, 0);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Fills each SDIO_Config_T member with its default value. */
|
void SDIO_ConfigStructInit(SDIO_Config_T *sdioConfig)
|
/* Fills each SDIO_Config_T member with its default value. */
void SDIO_ConfigStructInit(SDIO_Config_T *sdioConfig)
|
{
sdioConfig->clockDiv = 0x00;
sdioConfig->clockEdge = SDIO_CLOCK_EDGE_RISING;
sdioConfig->clockBypass = SDIO_CLOCK_BYPASS_DISABLE;
sdioConfig->clockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE;
sdioConfig->busWide = SDIO_BUS_WIDE_1B;
sdioConfig->hardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_DISABLE;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Functions for getting the pages from a VMA. */
|
static void vm_get_page(struct dpages *dp, struct page **p, unsigned long *len, unsigned *offset)
|
/* Functions for getting the pages from a VMA. */
static void vm_get_page(struct dpages *dp, struct page **p, unsigned long *len, unsigned *offset)
|
{
*p = vmalloc_to_page(dp->context_ptr);
*offset = dp->context_u;
*len = PAGE_SIZE - dp->context_u;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Propagate event elapsed time into the generic event. Can only be executed on the CPU where the event is active. Returns the delta events processed. */
|
static u64 x86_perf_event_update(struct perf_event *event, struct hw_perf_event *hwc, int idx)
|
/* Propagate event elapsed time into the generic event. Can only be executed on the CPU where the event is active. Returns the delta events processed. */
static u64 x86_perf_event_update(struct perf_event *event, struct hw_perf_event *hwc, int idx)
|
{
int shift = 64 - x86_pmu.event_bits;
u64 prev_raw_count, new_raw_count;
s64 delta;
if (idx == X86_PMC_IDX_FIXED_BTS)
return 0;
again:
prev_raw_count = atomic64_read(&hwc->prev_count);
rdmsrl(hwc->event_base + idx, new_raw_count);
if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count,
new_raw_count) != prev_raw_count)
goto again;
delta = (new_raw_count << shift) - (prev_raw_count << shift);
delta >>= shift;
atomic64_add(delta, &event->count);
atomic64_sub(delta, &hwc->period_left);
return new_raw_count;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Check if the USART Transmit Holding Register is empty or not in SPI mode. */
|
uint32_t usart_spi_is_tx_ready(Usart *p_usart)
|
/* Check if the USART Transmit Holding Register is empty or not in SPI mode. */
uint32_t usart_spi_is_tx_ready(Usart *p_usart)
|
{
return usart_is_tx_ready(p_usart);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* FAL (Flash Abstraction Layer) initialization. It will initialize all flash device and all flash partition. */
|
int fal_init(void)
|
/* FAL (Flash Abstraction Layer) initialization. It will initialize all flash device and all flash partition. */
int fal_init(void)
|
{
extern int fal_flash_init(void);
extern int fal_partition_init(void);
int result;
result = fal_flash_init();
if (result < 0) {
goto __exit;
}
result = fal_partition_init();
__exit:
if ((result > 0) && (!init_ok))
{
init_ok = 1;
log_i("RT-Thread Flash Abstraction Layer initialize success.");
}
else if(result <= 0)
{
init_ok = 0;
log_e("RT-Thread Flash Abstraction Layer initialize failed.");
}
return result;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function is used to manage a USB device with the bulk transfer pipe. The endpoint is Bulk out. */
|
EFI_STATUS EFIAPI UsbEthEcmTransmit(IN PXE_CDB *Cdb, IN EDKII_USB_ETHERNET_PROTOCOL *This, IN VOID *Packet, IN OUT UINTN *PacketLength)
|
/* This function is used to manage a USB device with the bulk transfer pipe. The endpoint is Bulk out. */
EFI_STATUS EFIAPI UsbEthEcmTransmit(IN PXE_CDB *Cdb, IN EDKII_USB_ETHERNET_PROTOCOL *This, IN VOID *Packet, IN OUT UINTN *PacketLength)
|
{
EFI_STATUS Status;
USB_ETHERNET_DRIVER *UsbEthDriver;
EFI_USB_IO_PROTOCOL *UsbIo;
UINT32 TransStatus;
UsbEthDriver = USB_ETHERNET_DEV_FROM_THIS (This);
Status = gBS->HandleProtocol (
UsbEthDriver->UsbCdcDataHandle,
&gEfiUsbIoProtocolGuid,
(VOID **)&UsbIo
);
if (EFI_ERROR (Status)) {
return Status;
}
if (UsbEthDriver->BulkOutEndpoint == 0) {
GetEndpoint (UsbIo, UsbEthDriver);
}
Status = UsbIo->UsbBulkTransfer (
UsbIo,
UsbEthDriver->BulkOutEndpoint,
Packet,
PacketLength,
USB_ETHERNET_BULK_TIMEOUT,
&TransStatus
);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Allocate and initialize a IP6 route cache entry. */
|
IP6_ROUTE_CACHE_ENTRY* Ip6CreateRouteCacheEntry(IN EFI_IPv6_ADDRESS *Dst, IN EFI_IPv6_ADDRESS *Src, IN EFI_IPv6_ADDRESS *GateWay, IN UINTN Tag)
|
/* Allocate and initialize a IP6 route cache entry. */
IP6_ROUTE_CACHE_ENTRY* Ip6CreateRouteCacheEntry(IN EFI_IPv6_ADDRESS *Dst, IN EFI_IPv6_ADDRESS *Src, IN EFI_IPv6_ADDRESS *GateWay, IN UINTN Tag)
|
{
IP6_ROUTE_CACHE_ENTRY *RtCacheEntry;
RtCacheEntry = AllocatePool (sizeof (IP6_ROUTE_CACHE_ENTRY));
if (RtCacheEntry == NULL) {
return NULL;
}
RtCacheEntry->RefCnt = 1;
RtCacheEntry->Tag = Tag;
IP6_COPY_ADDRESS (&RtCacheEntry->Destination, Dst);
IP6_COPY_ADDRESS (&RtCacheEntry->Source, Src);
IP6_COPY_ADDRESS (&RtCacheEntry->NextHop, GateWay);
return RtCacheEntry;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns the block number on the device holding the inode that is the disk block number for the block of the file requested. That is, asked for block 4 of inode 1 the function will return the disk block relative to the disk start that holds that block of the file. */
|
sector_t bmap(struct inode *inode, sector_t block)
|
/* Returns the block number on the device holding the inode that is the disk block number for the block of the file requested. That is, asked for block 4 of inode 1 the function will return the disk block relative to the disk start that holds that block of the file. */
sector_t bmap(struct inode *inode, sector_t block)
|
{
sector_t res = 0;
if (inode->i_mapping->a_ops->bmap)
res = inode->i_mapping->a_ops->bmap(inode->i_mapping, block);
return res;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param config transceiver configurations. param bitWidth audio data bitWidth. param mode audio data channel. param saiChannelMask channel mask value to enable. */
|
void SAI_GetDSPConfig(sai_transceiver_t *config, sai_frame_sync_len_t frameSyncWidth, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)
|
/* param config transceiver configurations. param bitWidth audio data bitWidth. param mode audio data channel. param saiChannelMask channel mask value to enable. */
void SAI_GetDSPConfig(sai_transceiver_t *config, sai_frame_sync_len_t frameSyncWidth, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)
|
{
assert(NULL != config);
assert(saiChannelMask != 0U);
SAI_GetCommonConfig(config, bitWidth, mode, saiChannelMask);
switch (frameSyncWidth)
{
case kSAI_FrameSyncLenOneBitClk:
config->frameSync.frameSyncWidth = 1U;
break;
default:
assert(false);
}
config->frameSync.frameSyncEarly = false;
config->frameSync.frameSyncPolarity = kSAI_PolarityActiveHigh;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Return: 0 if all went well, else returns appropriate error value. */
|
static int ti_sci_cmd_proc_shutdown_no_wait(const struct ti_sci_handle *handle, u8 proc_id)
|
/* Return: 0 if all went well, else returns appropriate error value. */
static int ti_sci_cmd_proc_shutdown_no_wait(const struct ti_sci_handle *handle, u8 proc_id)
|
{
int ret;
ret = ti_sci_proc_wait_boot_status_no_wait(handle, proc_id,
U8_MAX, 100, U8_MAX, U8_MAX,
0, PROC_BOOT_STATUS_FLAG_R5_WFE | PROC_BOOT_STATUS_FLAG_R5_WFI,
0, 0);
if (ret) {
dev_err(info->dev, "Sending core %u wait message fail %d\n",
proc_id, ret);
return ret;
}
ret = ti_sci_set_device_state_no_wait(handle, proc_id, 0,
MSG_DEVICE_SW_STATE_AUTO_OFF);
if (ret)
dev_err(info->dev, "Sending core %u shutdown message fail %d\n",
proc_id, ret);
return ret;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Enabling MAM and setting number of clocks used for Flash memory fetch. */
|
static void init_mam(void)
|
/* Enabling MAM and setting number of clocks used for Flash memory fetch. */
static void init_mam(void)
|
{
MAMCR = 0x0000;
MAMTIM = 0x0003;
MAMCR = 0x0002;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* 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_ADC1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Turns on generation of HAL outputs. This should be called after */
|
inv_error_t inv_start_hal_outputs(void)
|
/* Turns on generation of HAL outputs. This should be called after */
inv_error_t inv_start_hal_outputs(void)
|
{
inv_error_t result;
result =
inv_register_data_cb(inv_generate_hal_outputs,
INV_PRIORITY_HAL_OUTPUTS,
INV_GYRO_NEW | INV_ACCEL_NEW | INV_MAG_NEW);
return result;
}
|
Luos-io/luos_engine
|
C++
|
MIT License
| 496
|
/* This is what a 'fresh' dquot inside a dquot chunk looks like on disk. */
|
STATIC void xfs_qm_dqinit_core(xfs_dqid_t id, uint type, xfs_dqblk_t *d)
|
/* This is what a 'fresh' dquot inside a dquot chunk looks like on disk. */
STATIC void xfs_qm_dqinit_core(xfs_dqid_t id, uint type, xfs_dqblk_t *d)
|
{
d->dd_diskdq.d_magic = cpu_to_be16(XFS_DQUOT_MAGIC);
d->dd_diskdq.d_version = XFS_DQUOT_VERSION;
d->dd_diskdq.d_id = cpu_to_be32(id);
d->dd_diskdq.d_flags = type;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Get maximum number of memory blocks in a Memory Pool. */
|
static uint32_t svcRtxMemoryPoolGetCapacity(osMemoryPoolId_t mp_id)
|
/* Get maximum number of memory blocks in a Memory Pool. */
static uint32_t svcRtxMemoryPoolGetCapacity(osMemoryPoolId_t mp_id)
|
{
EvrRtxMemoryPoolGetCapacity(mp, 0U);
return 0U;
}
EvrRtxMemoryPoolGetCapacity(mp, mp->mp_info.max_blocks);
return mp->mp_info.max_blocks;
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* Enable access to GPIO registers via the AHB aperture.
All GPIO registers are accessed in unicore-mx via the AHB aperture. It provides faster control over the older APB aperture. This aperture must be enabled before calling any other gpio_*() function. */
|
void gpio_enable_ahb_aperture(void)
|
/* Enable access to GPIO registers via the AHB aperture.
All GPIO registers are accessed in unicore-mx via the AHB aperture. It provides faster control over the older APB aperture. This aperture must be enabled before calling any other gpio_*() function. */
void gpio_enable_ahb_aperture(void)
|
{
SYSCTL_GPIOHBCTL = 0xffffffff;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Create a vf and its base vport implicitely. */
|
bfa_status_t bfad_vf_create(struct bfad_s *bfad, u16 vf_id, struct bfa_port_cfg_s *port_cfg)
|
/* Create a vf and its base vport implicitely. */
bfa_status_t bfad_vf_create(struct bfad_s *bfad, u16 vf_id, struct bfa_port_cfg_s *port_cfg)
|
{
struct bfad_vf_s *vf;
int rc = BFA_STATUS_OK;
vf = kzalloc(sizeof(struct bfad_vf_s), GFP_KERNEL);
if (!vf) {
rc = BFA_STATUS_FAILED;
goto ext;
}
rc = bfa_fcs_vf_create(&vf->fcs_vf, &bfad->bfa_fcs, vf_id, port_cfg,
vf);
if (rc != BFA_STATUS_OK)
kfree(vf);
ext:
return rc;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function is a stub Handler that is the default Handler that gets called if the application has not setup a Handler for a specific exception. The function interface has to match the interface specified for a Handler even though none of the arguments are used. */
|
static void Xil_ExceptionNullHandler(void *Data)
|
/* This function is a stub Handler that is the default Handler that gets called if the application has not setup a Handler for a specific exception. The function interface has to match the interface specified for a Handler even though none of the arguments are used. */
static void Xil_ExceptionNullHandler(void *Data)
|
{
(void) Data;
DieLoop: goto DieLoop;
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* Set when user wants to generate interrupt on count overflow event/every step.. */
|
int32_t lsm6dso_pedo_int_mode_set(stmdev_ctx_t *ctx, lsm6dso_carry_count_en_t val)
|
/* Set when user wants to generate interrupt on count overflow event/every step.. */
int32_t lsm6dso_pedo_int_mode_set(stmdev_ctx_t *ctx, lsm6dso_carry_count_en_t val)
|
{
lsm6dso_pedo_cmd_reg_t reg;
int32_t ret;
ret = lsm6dso_ln_pg_read_byte(ctx, LSM6DSO_PEDO_CMD_REG,
(uint8_t *)®);
if (ret == 0) {
reg.carry_count_en = (uint8_t)val;
ret = lsm6dso_ln_pg_write_byte(ctx, LSM6DSO_PEDO_CMD_REG,
(uint8_t *)®);
}
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Enables or disables the TIM Capture Compare Channel xN. */
|
void TIM_CCxNCmd(TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_CCxN)
|
/* Enables or disables the TIM Capture Compare Channel xN. */
void TIM_CCxNCmd(TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_CCxN)
|
{
uint16_t tmp = 0;
assert_param(IS_TIM_LIST2_PERIPH(TIMx));
assert_param(IS_TIM_COMPLEMENTARY_CHANNEL(TIM_Channel));
assert_param(IS_TIM_CCXN(TIM_CCxN));
tmp = CCER_CCNE_SET << TIM_Channel;
TIMx->CCER &= (uint16_t) ~tmp;
TIMx->CCER |= (uint16_t)(TIM_CCxN << TIM_Channel);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns the most recent received data by the CEC peripheral. */
|
uint8_t CEC_RxData(void)
|
/* Returns the most recent received data by the CEC peripheral. */
uint8_t CEC_RxData(void)
|
{
return (uint8_t)(CEC->RXDATA);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Adjusts the Internal High Speed 48 oscillator (HSI 48) calibration value. */
|
void CRS_AdjustHSI48CalibrationValue(uint8_t calibrationVal)
|
/* Adjusts the Internal High Speed 48 oscillator (HSI 48) calibration value. */
void CRS_AdjustHSI48CalibrationValue(uint8_t calibrationVal)
|
{
CRS->CTRL_B.HSI48TRM = calibrationVal;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* load the last error code in the error list */
|
void scsi_sense_code(usb_core_driver *udev, uint8_t lun, uint8_t skey, uint8_t asc)
|
/* load the last error code in the error list */
void scsi_sense_code(usb_core_driver *udev, uint8_t lun, uint8_t skey, uint8_t asc)
|
{
usbd_msc_handler *msc = (usbd_msc_handler *)udev->dev.class_data[USBD_MSC_INTERFACE];
msc->scsi_sense[msc->scsi_sense_tail].SenseKey = skey;
msc->scsi_sense[msc->scsi_sense_tail].ASC = asc << 8U;
msc->scsi_sense_tail++;
if (SENSE_LIST_DEEPTH == msc->scsi_sense_tail) {
msc->scsi_sense_tail = 0U;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Enables or disable the reverse operation on output data. The reverse operation on output data is performed on 32-bit. */
|
void CRC_ReverseOutputDataCmd(FunctionalState NewState)
|
/* Enables or disable the reverse operation on output data. The reverse operation on output data is performed on 32-bit. */
void CRC_ReverseOutputDataCmd(FunctionalState NewState)
|
{
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
CRC->CR |= CRC_CR_REV_OUT;
}
else
{
CRC->CR &= (uint32_t)~((uint32_t)CRC_CR_REV_OUT);
}
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* Return the approximate number of pages we can send to this target. There's no guarantee that you will be able to fit this number of pages into a bio, it does not account for dynamic restrictions that vary on offset. */
|
int bio_get_nr_vecs(struct block_device *bdev)
|
/* Return the approximate number of pages we can send to this target. There's no guarantee that you will be able to fit this number of pages into a bio, it does not account for dynamic restrictions that vary on offset. */
int bio_get_nr_vecs(struct block_device *bdev)
|
{
struct request_queue *q = bdev_get_queue(bdev);
int nr_pages;
nr_pages = ((queue_max_sectors(q) << 9) + PAGE_SIZE - 1) >> PAGE_SHIFT;
if (nr_pages > queue_max_phys_segments(q))
nr_pages = queue_max_phys_segments(q);
if (nr_pages > queue_max_hw_segments(q))
nr_pages = queue_max_hw_segments(q);
return nr_pages;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Called by the upper tty layer when tty buffers are ready to receive data again after a call to throttle. */
|
static void ntty_unthrottle(struct tty_struct *tty)
|
/* Called by the upper tty layer when tty buffers are ready to receive data again after a call to throttle. */
static void ntty_unthrottle(struct tty_struct *tty)
|
{
struct nozomi *dc = get_dc_by_tty(tty);
unsigned long flags;
DBG1("UNTHROTTLE");
spin_lock_irqsave(&dc->spin_mutex, flags);
enable_transmit_dl(tty->index % MAX_PORT, dc);
set_rts(tty, 1);
spin_unlock_irqrestore(&dc->spin_mutex, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param cardParams The configuration structure of type smartcard_interface_config_t. Function fill in members: Fi = 372; Di = 1; currentD = 1; WI = 0x0A; GTN = 0x00; with default values. */
|
void SMARTCARD_EMVSIM_GetDefaultConfig(smartcard_card_params_t *cardParams)
|
/* param cardParams The configuration structure of type smartcard_interface_config_t. Function fill in members: Fi = 372; Di = 1; currentD = 1; WI = 0x0A; GTN = 0x00; with default values. */
void SMARTCARD_EMVSIM_GetDefaultConfig(smartcard_card_params_t *cardParams)
|
{
(void)memset(cardParams, 0, sizeof(*cardParams));
cardParams->Fi = 372u;
cardParams->Di = 1u;
cardParams->currentD = 1u;
cardParams->WI = 0x0Au;
cardParams->GTN = 0x00u;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* get GC debt and convert it from Kb to 'work units' (avoid zero debt and overflows) */
|
static l_mem getdebt(global_State *g)
|
/* get GC debt and convert it from Kb to 'work units' (avoid zero debt and overflows) */
static l_mem getdebt(global_State *g)
|
{
debt = (debt / STEPMULADJ) + 1;
debt = (debt < MAX_LMEM / stepmul) ? debt * stepmul : MAX_LMEM;
return debt;
}
}
|
nodemcu/nodemcu-firmware
|
C++
|
MIT License
| 7,566
|
/* Return index of the last available xpram page. */
|
static unsigned long xpram_highest_page_index(void)
|
/* Return index of the last available xpram page. */
static unsigned long xpram_highest_page_index(void)
|
{
unsigned int page_index, add_bit;
unsigned long mem_page;
mem_page = (unsigned long) __get_free_page(GFP_KERNEL);
if (!mem_page)
return 0;
page_index = 0;
add_bit = 1ULL << (sizeof(unsigned int)*8 - 1);
while (add_bit > 0) {
if (xpram_page_in(mem_page, page_index | add_bit) == 0)
page_index |= add_bit;
add_bit >>= 1;
}
free_page (mem_page);
return page_index;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* USART Wait for Transmit Data Buffer Empty.
Blocks until the transmit data buffer becomes empty and is ready to accept the next data word. */
|
void usart_wait_send_ready(uint32_t usart)
|
/* USART Wait for Transmit Data Buffer Empty.
Blocks until the transmit data buffer becomes empty and is ready to accept the next data word. */
void usart_wait_send_ready(uint32_t usart)
|
{
while ((USART_SR(usart) & USART_SR_TXE) == 0);
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Uses the linked parser to save the dat stored in the segments of the linked list to the specified file. */
|
bool FirmwareSaveToFile(char const *firmwareFile)
|
/* Uses the linked parser to save the dat stored in the segments of the linked list to the specified file. */
bool FirmwareSaveToFile(char const *firmwareFile)
|
{
bool result = false;
assert(firmwareFile != NULL);
if (firmwareFile != NULL)
{
if (parserPtr != NULL)
{
if (parserPtr->SaveToFile != NULL)
{
result = parserPtr->SaveToFile(firmwareFile);
}
}
}
return result;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Returns 0 on success, a negative error code otherwise. */
|
int nand_change_write_column_op(struct nand_chip *chip, unsigned int offset_in_page, const void *buf, unsigned int len, bool force_8bit)
|
/* Returns 0 on success, a negative error code otherwise. */
int nand_change_write_column_op(struct nand_chip *chip, unsigned int offset_in_page, const void *buf, unsigned int len, bool force_8bit)
|
{
struct mtd_info *mtd = nand_to_mtd(chip);
if (len && !buf)
return -EINVAL;
if (offset_in_page + len > mtd->writesize + mtd->oobsize)
return -EINVAL;
chip->cmdfunc(mtd, NAND_CMD_RNDIN, offset_in_page, -1);
if (len)
chip->write_buf(mtd, buf, len);
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* I have NFC how to interpret the content of that register ;-). */
|
static ssize_t pdcs_diagnostic_read(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
/* I have NFC how to interpret the content of that register ;-). */
static ssize_t pdcs_diagnostic_read(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
{
char *out = buf;
u32 result;
if (!buf)
return -EINVAL;
if (pdc_stable_read(PDCS_ADDR_DIAG, &result, sizeof(result)) != PDC_OK)
return -EIO;
out += sprintf(out, "0x%.4x\n", (result >> 16));
return out - buf;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function returns the current setting for GPIO retention in the hibernate module. */
|
bool HibernateGPIORetentionGet(void)
|
/* This function returns the current setting for GPIO retention in the hibernate module. */
bool HibernateGPIORetentionGet(void)
|
{
if((HWREG(HIB_CTL) & (HIB_CTL_RETCLR | HIB_CTL_VDD3ON)) ==
(HIB_CTL_RETCLR | HIB_CTL_VDD3ON))
{
return(true);
}
return(false);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The modules that use fread() and fwrite() always invoke them through these macros. On some systems you may need to twiddle the argument casts. CAUTION: argument order is different from underlying functions! */
|
size_t read_file(JFILE *file, uint8_t *buf, uint32_t sizeofbuf)
|
/* The modules that use fread() and fwrite() always invoke them through these macros. On some systems you may need to twiddle the argument casts. CAUTION: argument order is different from underlying functions! */
size_t read_file(JFILE *file, uint8_t *buf, uint32_t sizeofbuf)
|
{
static size_t BytesReadfile ;
f_read (file, buf , sizeofbuf, &BytesReadfile);
return BytesReadfile;
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* The mode and control registers are restored before return. */
|
int XDmaPs_SelfTest(XDmaPs *InstPtr)
|
/* The mode and control registers are restored before return. */
int XDmaPs_SelfTest(XDmaPs *InstPtr)
|
{
u32 BaseAddr = InstPtr->Config.BaseAddress;
int i;
if (XDmaPs_ReadReg(BaseAddr, XDMAPS_DBGSTATUS_OFFSET)
& XDMAPS_DBGSTATUS_BUSY)
return XST_FAILURE;
for (i = 0; i < XDMAPS_CHANNELS_PER_DEV; i++) {
if (XDmaPs_ReadReg(BaseAddr,
XDmaPs_CSn_OFFSET(i)))
return XST_FAILURE;
}
return XST_SUCCESS;
}
/** @}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* Un-Register the Service B.3 and all its Characteristics... */
|
void service_b_3_1_remove(void)
|
/* Un-Register the Service B.3 and all its Characteristics... */
void service_b_3_1_remove(void)
|
{
bt_gatt_service_unregister(&service_b_3_1_svc);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* event input callback from ALSA sequencer: the echo event is processed here. */
|
int snd_seq_oss_event_input(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop)
|
/* event input callback from ALSA sequencer: the echo event is processed here. */
int snd_seq_oss_event_input(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop)
|
{
struct seq_oss_devinfo *dp = (struct seq_oss_devinfo *)private_data;
union evrec *rec;
if (ev->type != SNDRV_SEQ_EVENT_ECHO)
return snd_seq_oss_midi_input(ev, direct, private_data);
if (ev->source.client != dp->cseq)
return 0;
rec = (union evrec*)&ev->data;
if (rec->s.code == SEQ_SYNCTIMER) {
snd_seq_oss_writeq_wakeup(dp->writeq, rec->t.time);
} else {
if (dp->readq == NULL)
return 0;
snd_seq_oss_readq_put_event(dp->readq, rec);
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Helper routine to reset inode di_forkoff field when switching attribute fork from local to extent format - we reset it where possible to make space available for inline data fork extents. */
|
STATIC void xfs_bmap_forkoff_reset(xfs_mount_t *mp, xfs_inode_t *ip, int whichfork)
|
/* Helper routine to reset inode di_forkoff field when switching attribute fork from local to extent format - we reset it where possible to make space available for inline data fork extents. */
STATIC void xfs_bmap_forkoff_reset(xfs_mount_t *mp, xfs_inode_t *ip, int whichfork)
|
{
if (whichfork == XFS_ATTR_FORK &&
ip->i_d.di_format != XFS_DINODE_FMT_DEV &&
ip->i_d.di_format != XFS_DINODE_FMT_UUID &&
ip->i_d.di_format != XFS_DINODE_FMT_BTREE) {
uint dfl_forkoff = xfs_default_attroffset(ip) >> 3;
if (dfl_forkoff > ip->i_d.di_forkoff) {
ip->i_d.di_forkoff = dfl_forkoff;
ip->i_df.if_ext_max =
XFS_IFORK_DSIZE(ip) / sizeof(xfs_bmbt_rec_t);
ip->i_afp->if_ext_max =
XFS_IFORK_ASIZE(ip) / sizeof(xfs_bmbt_rec_t);
}
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* wm97xx IO access, all IO locking done by AC97 layer */
|
int wm97xx_reg_read(struct wm97xx *wm, u16 reg)
|
/* wm97xx IO access, all IO locking done by AC97 layer */
int wm97xx_reg_read(struct wm97xx *wm, u16 reg)
|
{
if (wm->ac97)
return wm->ac97->bus->ops->read(wm->ac97, reg);
else
return -1;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* We can't address 8 and 16 bit words directly. Instead we have to read/write a 32bit word and mask/modify the data we actually want. */
|
static int read_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 *val)
|
/* We can't address 8 and 16 bit words directly. Instead we have to read/write a 32bit word and mask/modify the data we actually want. */
static int read_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 *val)
|
{
u32 data;
int ret;
ret = config_access(PCI_ACCESS_READ, bus, devfn, where, &data);
*val = (data >> ((where & 3) << 3)) & 0xff;
return ret;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* tape_do_io/__tape_wake_up Add the request to the request queue, try to start it if the tape is idle and wait uninterruptible for its completion. */
|
static void __tape_wake_up(struct tape_request *request, void *data)
|
/* tape_do_io/__tape_wake_up Add the request to the request queue, try to start it if the tape is idle and wait uninterruptible for its completion. */
static void __tape_wake_up(struct tape_request *request, void *data)
|
{
request->callback = NULL;
wake_up((wait_queue_head_t *) data);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* stmmac_mdio_unregister @ndev: net device structure Description: it unregisters the MII bus */
|
int stmmac_mdio_unregister(struct net_device *ndev)
|
/* stmmac_mdio_unregister @ndev: net device structure Description: it unregisters the MII bus */
int stmmac_mdio_unregister(struct net_device *ndev)
|
{
struct stmmac_priv *priv = netdev_priv(ndev);
mdiobus_unregister(priv->mii);
priv->mii->priv = NULL;
kfree(priv->mii);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
|
gboolean _g_freedesktop_dbus_call_get_name_owner_finish(_GFreedesktopDBus *proxy, gchar **out_unique_name, GAsyncResult *res, GError **error)
|
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
gboolean _g_freedesktop_dbus_call_get_name_owner_finish(_GFreedesktopDBus *proxy, gchar **out_unique_name, GAsyncResult *res, GError **error)
|
{
GVariant *_ret;
_ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
if (_ret == NULL)
goto _out;
g_variant_get (_ret,
"(s)",
out_unique_name);
g_variant_unref (_ret);
_out:
return _ret != NULL;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Initializes gadget endpoint list, endpoints locks. No action is taken on the hardware. */
|
static __init void udc_init_data(struct pxa_udc *dev)
|
/* Initializes gadget endpoint list, endpoints locks. No action is taken on the hardware. */
static __init void udc_init_data(struct pxa_udc *dev)
|
{
int i;
struct pxa_ep *ep;
INIT_LIST_HEAD(&dev->gadget.ep_list);
INIT_LIST_HEAD(&dev->gadget.ep0->ep_list);
dev->udc_usb_ep[0].pxa_ep = &dev->pxa_ep[0];
ep0_idle(dev);
for (i = 0; i < NR_PXA_ENDPOINTS; i++) {
ep = &dev->pxa_ep[i];
ep->enabled = is_ep0(ep);
INIT_LIST_HEAD(&ep->queue);
spin_lock_init(&ep->lock);
}
for (i = 1; i < NR_USB_ENDPOINTS; i++)
list_add_tail(&dev->udc_usb_ep[i].usb_ep.ep_list,
&dev->gadget.ep_list);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If JoinFlag is FALSE and GroupAddress is NULL, all joined groups will be left. */
|
EFI_STATUS EFIAPI EfiIp6Groups(IN EFI_IP6_PROTOCOL *This, IN BOOLEAN JoinFlag, IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL)
|
/* If JoinFlag is FALSE and GroupAddress is NULL, all joined groups will be left. */
EFI_STATUS EFIAPI EfiIp6Groups(IN EFI_IP6_PROTOCOL *This, IN BOOLEAN JoinFlag, IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL)
|
{
EFI_TPL OldTpl;
EFI_STATUS Status;
IP6_PROTOCOL *IpInstance;
IP6_SERVICE *IpSb;
if ((This == NULL) || (JoinFlag && (GroupAddress == NULL))) {
return EFI_INVALID_PARAMETER;
}
if ((GroupAddress != NULL) && !IP6_IS_MULTICAST (GroupAddress)) {
return EFI_INVALID_PARAMETER;
}
IpInstance = IP6_INSTANCE_FROM_PROTOCOL (This);
IpSb = IpInstance->Service;
if (IpSb->LinkLocalDadFail) {
return EFI_DEVICE_ERROR;
}
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
if (IpInstance->State != IP6_STATE_CONFIGED) {
Status = EFI_NOT_STARTED;
goto ON_EXIT;
}
Status = Ip6Groups (IpInstance, JoinFlag, GroupAddress);
ON_EXIT:
gBS->RestoreTPL (OldTpl);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Request the PE to get a manufacturer infor. */
|
USBPD_StatusTypeDef USBPD_DPM_RequestGetManufacturerInfo(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint8_t *pManuInfoData)
|
/* Request the PE to get a manufacturer infor. */
USBPD_StatusTypeDef USBPD_DPM_RequestGetManufacturerInfo(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint8_t *pManuInfoData)
|
{
return USBPD_PE_SendExtendedMessage(PortNum, SOPType, USBPD_EXT_GET_MANUFACTURER_INFO, (uint8_t*)pManuInfoData, sizeof(USBPD_GMIDB_TypeDef));
}
|
st-one/X-CUBE-USB-PD
|
C++
| null | 110
|
/* This routine is called when the serial port gets closed. First, we wait for the last remaining data to be sent. Then, we unlink its async structure from the interrupt chain if necessary, and we free that IRQ if nothing is left in the chain. */
|
static void mxser_close(struct tty_struct *tty, struct file *filp)
|
/* This routine is called when the serial port gets closed. First, we wait for the last remaining data to be sent. Then, we unlink its async structure from the interrupt chain if necessary, and we free that IRQ if nothing is left in the chain. */
static void mxser_close(struct tty_struct *tty, struct file *filp)
|
{
struct mxser_port *info = tty->driver_data;
struct tty_port *port = &info->port;
if (tty->index == MXSER_PORTS)
return;
if (tty_port_close_start(port, tty, filp) == 0)
return;
mutex_lock(&port->mutex);
mxser_close_port(port);
mxser_flush_buffer(tty);
mxser_shutdown_port(port);
clear_bit(ASYNCB_INITIALIZED, &port->flags);
mutex_unlock(&port->mutex); tty_port_close_end(port, tty);
tty_port_tty_set(port, NULL);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* this function is used to calculate the params for resizing */
|
int32_t ipu_ic_calc_resize_coeffs(int32_t in_size, int32_t out_size, int32_t *resize_coeff, int32_t *downsize_coeff)
|
/* this function is used to calculate the params for resizing */
int32_t ipu_ic_calc_resize_coeffs(int32_t in_size, int32_t out_size, int32_t *resize_coeff, int32_t *downsize_coeff)
|
{
int32_t tempSize;
int32_t tempDownsize;
if ((out_size << 3) < in_size)
return -1;
tempDownsize = 0;
tempSize = in_size;
while (((tempSize >= out_size * 2) || (tempSize > 1024))
&& (tempDownsize < 2)) {
tempSize >>= 1;
tempDownsize++;
}
*downsize_coeff = tempDownsize;
*resize_coeff = (8192L * (tempSize - 1)) / (out_size - 1);
if (*resize_coeff >= 16384L) {
printf("Overflow on resize coeff %d.\n", *resize_coeff);
*resize_coeff = 0x3FFF;
}
return 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Create an empty RGB surface of the appropriate depth */
|
SDL_Surface* SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
|
/* Create an empty RGB surface of the appropriate depth */
SDL_Surface* SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
|
{
Uint32 format;
format = SDL_MasksToPixelFormatEnum(depth, Rmask, Gmask, Bmask, Amask);
if (format == SDL_PIXELFORMAT_UNKNOWN) {
SDL_SetError("Unknown pixel format");
return NULL;
}
return SDL_CreateRGBSurfaceWithFormat(flags, width, height, depth, format);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* USBD_CDC_RNDIS_ProcessHaltMsg Parse, extract data and check correctness of CDC_RNDIS Halt command. */
|
static uint8_t USBD_CDC_RNDIS_ProcessHaltMsg(USBD_HandleTypeDef *pdev, USBD_CDC_RNDIS_HaltMsgTypeDef *Msg)
|
/* USBD_CDC_RNDIS_ProcessHaltMsg Parse, extract data and check correctness of CDC_RNDIS Halt command. */
static uint8_t USBD_CDC_RNDIS_ProcessHaltMsg(USBD_HandleTypeDef *pdev, USBD_CDC_RNDIS_HaltMsgTypeDef *Msg)
|
{
USBD_CDC_RNDIS_HandleTypeDef *hcdc = (USBD_CDC_RNDIS_HandleTypeDef *)pdev->pClassData;
if (hcdc == NULL)
{
return (uint8_t)USBD_FAIL;
}
hcdc->State = CDC_RNDIS_STATE_UNINITIALIZED;
UNUSED(Msg);
return (uint8_t)USBD_OK;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Updates entire Multicast Table Array. The caller must have a packed mc_addr_list of multicast addresses. */
|
void igb_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list, u32 mc_addr_count)
|
/* Updates entire Multicast Table Array. The caller must have a packed mc_addr_list of multicast addresses. */
void igb_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list, u32 mc_addr_count)
|
{
u32 hash_value, hash_bit, hash_reg;
int i;
memset(&hw->mac.mta_shadow, 0, sizeof(hw->mac.mta_shadow));
for (i = 0; (u32) i < mc_addr_count; i++) {
hash_value = igb_hash_mc_addr(hw, mc_addr_list);
hash_reg = (hash_value >> 5) & (hw->mac.mta_reg_count - 1);
hash_bit = hash_value & 0x1F;
hw->mac.mta_shadow[hash_reg] |= (1 << hash_bit);
mc_addr_list += (ETH_ALEN);
}
for (i = hw->mac.mta_reg_count - 1; i >= 0; i--)
array_wr32(E1000_MTA, i, hw->mac.mta_shadow[i]);
wrfl();
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Gets the height in pixels of the LCD screen (varies depending on the current screen orientation) */
|
uint16_t lcdGetHeight(void)
|
/* Gets the height in pixels of the LCD screen (varies depending on the current screen orientation) */
uint16_t lcdGetHeight(void)
|
{
return s6b33b6xProperties.height;
}
|
microbuilder/LPC1343CodeBase
|
C++
|
Other
| 73
|
/* QSPI MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi)
|
/* QSPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi)
|
{
if(hqspi->Instance==QUADSPI)
{
__HAL_RCC_QSPI_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOF, GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9);
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_2|GPIO_PIN_6);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Deinitializes the SPI peripheral registers to their default reset values. */
|
void SPI_DeInit(SPI_TypeDef *SPIx)
|
/* Deinitializes the SPI peripheral registers to their default reset values. */
void SPI_DeInit(SPI_TypeDef *SPIx)
|
{
SPIx->CR1 = SPI_CR1_RESET_VALUE;
SPIx->CR2 = SPI_CR2_RESET_VALUE;
SPIx->CR3 = SPI_CR3_RESET_VALUE;
SPIx->SR = SPI_SR_RESET_VALUE;
SPIx->CRCPR = SPI_CRCPR_RESET_VALUE;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Open the NvVars file for reading or writing */
|
VOID NvVarsFileReadCheckup(IN EFI_FILE_HANDLE File, OUT BOOLEAN *Exists, OUT UINTN *Size)
|
/* Open the NvVars file for reading or writing */
VOID NvVarsFileReadCheckup(IN EFI_FILE_HANDLE File, OUT BOOLEAN *Exists, OUT UINTN *Size)
|
{
EFI_FILE_INFO *FileInfo;
*Exists = FALSE;
*Size = 0;
FileInfo = FileHandleGetInfo (File);
if (FileInfo == NULL) {
return;
}
if ((FileInfo->Attribute & EFI_FILE_DIRECTORY) != 0) {
FreePool (FileInfo);
return;
}
*Exists = TRUE;
*Size = (UINTN)FileInfo->FileSize;
FreePool (FileInfo);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Walk all dissector tables calling a user supplied function on each entry. */
|
static void dissector_all_tables_foreach(DATFunc func, gpointer user_data)
|
/* Walk all dissector tables calling a user supplied function on each entry. */
static void dissector_all_tables_foreach(DATFunc func, gpointer user_data)
|
{
dissector_foreach_info_t info;
info.caller_data = user_data;
info.caller_func = func;
info.next_func = dissector_table_foreach_func;
g_hash_table_foreach(dissector_tables, dissector_all_tables_foreach_func, &info);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Change Logs: Date Author Notes SummerGift first version Jiao change to fm33 */
|
void rt_hw_systick_init(void)
|
/* Change Logs: Date Author Notes SummerGift first version Jiao change to fm33 */
void rt_hw_systick_init(void)
|
{
SystemCoreClockUpdate();
SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
NVIC_SetPriority(SysTick_IRQn, 0xFF);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Retrieve IRQ number for the given hardware instance. */
|
static uint8_t _sercom_get_irq_num(const void *const hw)
|
/* Retrieve IRQ number for the given hardware instance. */
static uint8_t _sercom_get_irq_num(const void *const hw)
|
{
return SERCOM0_0_IRQn + (_sercom_get_hardware_index(hw) << 2);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Power role swap: Rd resitor on the CC line.
It requests Rd assertion on CC line as step of power role swap USB PD transaction */
|
USBPD_StatusTypeDef USBPD_HW_IF_PRS_Assert_Rd(uint8_t PortNum, USBPD_PortPowerRole_TypeDef CurrentRole)
|
/* Power role swap: Rd resitor on the CC line.
It requests Rd assertion on CC line as step of power role swap USB PD transaction */
USBPD_StatusTypeDef USBPD_HW_IF_PRS_Assert_Rd(uint8_t PortNum, USBPD_PortPowerRole_TypeDef CurrentRole)
|
{
CAD_HW_HandleTypeDef *_handle = &CAD_HW_Handles[PortNum];
if ((USBPD_FALSE == _handle->settings->CAD_RoleToggle) && (CurrentRole != USBPD_PORTPOWERROLE_SRC))
{
return USBPD_ERROR;
}
return (USBPD_StatusTypeDef)STUSB1602_Type_C_Command(STUSB1602_I2C_Add(PortNum), PD_PR_SWAP_RD_ASSERT_REQ);
}
|
st-one/X-CUBE-USB-PD
|
C++
| null | 110
|
/* See the Unified Extensible Firmware Interface (UEFI) specification for details. */
|
static void EFIAPI efi_set_mem(void *buffer, size_t size, uint8_t value)
|
/* See the Unified Extensible Firmware Interface (UEFI) specification for details. */
static void EFIAPI efi_set_mem(void *buffer, size_t size, uint8_t value)
|
{
EFI_ENTRY("%p, %ld, 0x%x", buffer, (unsigned long)size, value);
memset(buffer, value, size);
EFI_EXIT(EFI_SUCCESS);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Get Redfish default value with the given Schema and Configure Language. */
|
EFI_STATUS RedfishPlatformConfigGetDefaultValue(IN CHAR8 *Schema, IN CHAR8 *Version, IN EFI_STRING ConfigureLang, IN UINT16 DefaultClass, OUT EDKII_REDFISH_VALUE *Value)
|
/* Get Redfish default value with the given Schema and Configure Language. */
EFI_STATUS RedfishPlatformConfigGetDefaultValue(IN CHAR8 *Schema, IN CHAR8 *Version, IN EFI_STRING ConfigureLang, IN UINT16 DefaultClass, OUT EDKII_REDFISH_VALUE *Value)
|
{
if (mRedfishPlatformConfigLibPrivate.Protocol == NULL) {
return EFI_NOT_READY;
}
return mRedfishPlatformConfigLibPrivate.Protocol->GetDefaultValue (
mRedfishPlatformConfigLibPrivate.Protocol,
Schema,
Version,
ConfigureLang,
DefaultClass,
Value
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Registers an interrupt handler for a UART interrupt. */
|
void UARTIntRegister(unsigned long ulBase, void(*pfnHandler)(void))
|
/* Registers an interrupt handler for a UART interrupt. */
void UARTIntRegister(unsigned long ulBase, void(*pfnHandler)(void))
|
{
unsigned long ulInt;
ASSERT(UARTBaseValid(ulBase));
ulInt = UARTIntNumberGet(ulBase);
IntRegister(ulInt, pfnHandler);
IntEnable(ulInt);
}
|
micropython/micropython
|
C++
|
Other
| 18,334
|
/* GSM handling was purged from kernel. For history, this is the way to go : */
|
static int is_gsm_on(void)
|
/* GSM handling was purged from kernel. For history, this is the way to go : */
static int is_gsm_on(void)
|
{
int is_on;
is_on = !!gpio_get_value(GPIO25_GSM_MOD_ON_STATE);
return is_on;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Read 1 byte from the MMC. Optimised version for 1 byte, avoid using memory... */
|
static u_char mmc_in(u_long base, u_short o)
|
/* Read 1 byte from the MMC. Optimised version for 1 byte, avoid using memory... */
static u_char mmc_in(u_long base, u_short o)
|
{
int count = 0;
while((count++ < 100) && (inb(HASR(base)) & HASR_MMI_BUSY))
udelay(10);
outb(o << 1, MMR(base));
outb(0, MMD(base));
while((count++ < 100) && (inb(HASR(base)) & HASR_MMI_BUSY))
udelay(10);
return (u_char) (inb(MMD(base)));
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Read current date/time or alarm date/time from RTC setting. This function is to Read current date/time or alarm date/time from RTC setting. */
|
void xRTCTimeRead(xtTime *pxtTime, unsigned long ulTimeAlarm)
|
/* Read current date/time or alarm date/time from RTC setting. This function is to Read current date/time or alarm date/time from RTC setting. */
void xRTCTimeRead(xtTime *pxtTime, unsigned long ulTimeAlarm)
|
{
RTCTimeRead(tTime(pxtTime), ulTimeAlarm);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Initialize EIM controller.
Only setup the data port size and enable the chip select. */
|
uint32_t eim_init(uint32_t cs, uint32_t dsz, uint32_t mum, uint32_t aus)
|
/* Initialize EIM controller.
Only setup the data port size and enable the chip select. */
uint32_t eim_init(uint32_t cs, uint32_t dsz, uint32_t mum, uint32_t aus)
|
{
if (cs >= EIM_NUM_CS) {
printf("Invalid chip select.\n");
return FALSE;
}
if ((dsz > REG_CSCFG_MAX_DSZ) || (dsz < REG_CSCFG_MIN_DSZ)) {
printf("Invalid data port size.\n");
return FALSE;
}
HW_EIM_CS_REGS[cs].GCR1.B.DSZ = dsz;
HW_EIM_CS_REGS[cs].GCR1.B.MUM = mum;
HW_EIM_CS_REGS[cs].GCR1.B.AUS = aus;
HW_EIM_CS_REGS[cs].GCR1.B.CSEN = 1;
eim_iomux_config();
return TRUE;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.