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
|
|---|---|---|---|---|---|---|---|
/* Handles the GET_DESCRIPTOR callback. All required descriptors must be handled here. */
|
static const USBDescriptor* get_descriptor(USBDriver *usbp, uint8_t dtype, uint8_t dindex, uint16_t lang)
|
/* Handles the GET_DESCRIPTOR callback. All required descriptors must be handled here. */
static const USBDescriptor* get_descriptor(USBDriver *usbp, uint8_t dtype, uint8_t dindex, uint16_t lang)
|
{
(void)usbp;
(void)lang;
switch (dtype)
{
case USB_DESCRIPTOR_DEVICE:
return &vcom_device_descriptor;
case USB_DESCRIPTOR_CONFIGURATION:
return &vcom_configuration_descriptor;
case USB_DESCRIPTOR_STRING:
if (dindex < 4)
{
if (dindex == 3)
{
Get_SerialNum((uint8_t *)&usb_serial_number.bPropertyData[INDEX_OF_WCHAR_FOR_UNIQUE_ID]);
}
return &vcom_strings[dindex];
}
}
return NULL;
}
|
nanoframework/nf-interpreter
|
C++
|
MIT License
| 293
|
/* Preset and Initialize the MMC counters to almost-hal value: 0x7FFF_FFF0 (half - 16) */
|
void ETH_PresetMMCCounterHalf(void)
|
/* Preset and Initialize the MMC counters to almost-hal value: 0x7FFF_FFF0 (half - 16) */
void ETH_PresetMMCCounterHalf(void)
|
{
ETH->CTRL_B.MCNTP = SET;
ETH->CTRL_B.MCNTVALP = RESET;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param base Quad Timer peripheral base address param channel Quad Timer channel number param ticks Timer period in units of ticks */
|
void QTMR_SetTimerPeriod(TMR_Type *base, qtmr_channel_selection_t channel, uint16_t ticks)
|
/* param base Quad Timer peripheral base address param channel Quad Timer channel number param ticks Timer period in units of ticks */
void QTMR_SetTimerPeriod(TMR_Type *base, qtmr_channel_selection_t channel, uint16_t ticks)
|
{
base->CHANNEL[channel].CTRL |= TMR_CTRL_LENGTH_MASK;
if (base->CHANNEL[channel].CTRL & TMR_CTRL_DIR_MASK)
{
base->CHANNEL[channel].COMP2 = ticks;
}
else
{
base->CHANNEL[channel].COMP1 = ticks;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Deinitializes the SDIO peripheral registers to their default reset values. */
|
void SDIO_DeInit(void)
|
/* Deinitializes the SDIO peripheral registers to their default reset values. */
void SDIO_DeInit(void)
|
{
SDIO->POWER = 0x00000000;
SDIO->CLKCR = 0x00000000;
SDIO->ARG = 0x00000000;
SDIO->CMD = 0x00000000;
SDIO->DTIMER = 0x00000000;
SDIO->DLEN = 0x00000000;
SDIO->DCTRL = 0x00000000;
SDIO->ICR = 0x00C007FF;
SDIO->MASK = 0x00000000;
}
|
gcallipo/RadioDSP-Stm32f103
|
C++
|
Common Creative - Attribution 3.0
| 51
|
/* Register a uat 'preference'. It adds a button that opens the uat's window in the preferences tab of the module. */
|
void prefs_register_uat_preference(module_t *module, const char *name, const char *title, const char *description, uat_t *uat)
|
/* Register a uat 'preference'. It adds a button that opens the uat's window in the preferences tab of the module. */
void prefs_register_uat_preference(module_t *module, const char *name, const char *title, const char *description, uat_t *uat)
|
{
pref_t* preference = register_preference(module, name, title, description, PREF_UAT);
preference->varp.uat = uat;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Done Handler is called when dev stat = DEVICE-END (successful operation) */
|
static int tape_34xx_done(struct tape_request *request)
|
/* Done Handler is called when dev stat = DEVICE-END (successful operation) */
static int tape_34xx_done(struct tape_request *request)
|
{
DBF_EVENT(6, "%s done\n", tape_op_verbose[request->op]);
switch (request->op) {
case TO_DSE:
case TO_RUN:
case TO_WRI:
case TO_WTM:
case TO_ASSIGN:
case TO_UNASSIGN:
tape_34xx_delete_sbid_from(request->device, 0);
break;
default:
;
}
return TAPE_IO_SUCCESS;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns: the ID (greater than 0) for the source within the #GMainContext. */
|
guint g_source_attach(GSource *source, GMainContext *context)
|
/* Returns: the ID (greater than 0) for the source within the #GMainContext. */
guint g_source_attach(GSource *source, GMainContext *context)
|
{
guint result = 0;
g_return_val_if_fail (source->context == NULL, 0);
g_return_val_if_fail (!SOURCE_DESTROYED (source), 0);
TRACE (GLIB_MAIN_SOURCE_ATTACH (g_source_get_name (source)));
if (!context)
context = g_main_context_default ();
LOCK_CONTEXT (context);
result = g_source_attach_unlocked (source, context, TRUE);
UNLOCK_CONTEXT (context);
return result;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* set the security data for a kernel service */
|
static int selinux_kernel_act_as(struct cred *new, u32 secid)
|
/* set the security data for a kernel service */
static int selinux_kernel_act_as(struct cred *new, u32 secid)
|
{
struct task_security_struct *tsec = new->security;
u32 sid = current_sid();
int ret;
ret = avc_has_perm(sid, secid,
SECCLASS_KERNEL_SERVICE,
KERNEL_SERVICE__USE_AS_OVERRIDE,
NULL);
if (ret == 0) {
tsec->sid = secid;
tsec->create_sid = 0;
tsec->keycreate_sid = 0;
tsec->sockcreate_sid = 0;
}
return ret;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* mpc52xx_restart: ppc_md->restart hook for mpc5200 using the watchdog timer */
|
void mpc52xx_restart(char *cmd)
|
/* mpc52xx_restart: ppc_md->restart hook for mpc5200 using the watchdog timer */
void mpc52xx_restart(char *cmd)
|
{
local_irq_disable();
if (mpc52xx_wdt) {
out_be32(&mpc52xx_wdt->mode, 0x00000000);
out_be32(&mpc52xx_wdt->count, 0x000000ff);
out_be32(&mpc52xx_wdt->mode, 0x00009004);
} else
printk(KERN_ERR __FILE__ ": "
"mpc52xx_restart: Can't access wdt. "
"Restart impossible, system halted.\n");
while (1);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Switch all modem-channels who are online and got a valid escape-sequence 1.5 seconds ago, to command-mode. This function is called every second via timer-interrupt from within timer-dispatcher isdn_timer_function() */
|
void isdn_tty_modem_escape(void)
|
/* Switch all modem-channels who are online and got a valid escape-sequence 1.5 seconds ago, to command-mode. This function is called every second via timer-interrupt from within timer-dispatcher isdn_timer_function() */
void isdn_tty_modem_escape(void)
|
{
int ton = 0;
int i;
int midx;
for (i = 0; i < ISDN_MAX_CHANNELS; i++)
if (USG_MODEM(dev->usage[i]))
if ((midx = dev->m_idx[i]) >= 0) {
modem_info *info = &dev->mdm.info[midx];
if (info->online) {
ton = 1;
if ((info->emu.pluscount == 3) &&
time_after(jiffies , info->emu.lastplus + PLUSWAIT2)) {
info->emu.pluscount = 0;
info->online = 0;
isdn_tty_modem_result(RESULT_OK, info);
}
}
}
isdn_timer_ctrl(ISDN_TIMER_MODEMPLUS, ton);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Clears the interrupt.
This function clears the timer interrupt */
|
void tmrHw_clearInterrupt(tmrHw_ID_t timerId)
|
/* Clears the interrupt.
This function clears the timer interrupt */
void tmrHw_clearInterrupt(tmrHw_ID_t timerId)
|
{
pTmrHw[timerId].InterruptClear = 0x1;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Configure the processor for use with the Keil demo board. This is very minimal as most of the setup is managed by the settings in the project file. */
|
static void prvSetupHardware(void)
|
/* Configure the processor for use with the Keil demo board. This is very minimal as most of the setup is managed by the settings in the project file. */
static void prvSetupHardware(void)
|
{
PINSEL0 |= mainTX_ENABLE;
PINSEL0 |= mainRX_ENABLE;
IODIR1 = mainLED_TO_OUTPUT;
VPBDIV = mainBUS_CLK_FULL;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Disables GPIO pins and USART2 from FPGA register access. */
|
static void spiDisable(void)
|
/* Disables GPIO pins and USART2 from FPGA register access. */
static void spiDisable(void)
|
{
USART_TypeDef *usart = USART2;
GPIO_TypeDef *gpio = GPIO;
usart->CTRL = _USART_CTRL_RESETVALUE;
usart->ROUTE = _USART_ROUTE_RESETVALUE;
usart->CMD = USART_CMD_MASTERDIS | USART_CMD_TXDIS | USART_CMD_RXDIS;
gpio->P[2].MODEH &= ~(_GPIO_P_MODEH_MODE13_MASK);
gpio->P[2].MODEL &= ~(_GPIO_P_MODEL_MODE2_MASK |
_GPIO_P_MODEL_MODE3_MASK |
_GPIO_P_MODEL_MODE4_MASK |
_GPIO_P_MODEL_MODE5_MASK);
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Check the status of the Tx buffer of the specified SPI port. */
|
xtBoolean SPIIsTxFull(unsigned long ulBase)
|
/* Check the status of the Tx buffer of the specified SPI port. */
xtBoolean SPIIsTxFull(unsigned long ulBase)
|
{
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE));
return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_TX_FULL)? xtrue : xfalse);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Determine whether the sequencer has halted code execution. Returns non-zero status if the sequencer is stopped. */
|
int ahc_is_paused(struct ahc_softc *ahc)
|
/* Determine whether the sequencer has halted code execution. Returns non-zero status if the sequencer is stopped. */
int ahc_is_paused(struct ahc_softc *ahc)
|
{
return ((ahc_inb(ahc, HCNTRL) & PAUSE) != 0);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Jensen-Shannon distance between two vectors.
When the function is computing x log (x / y) with x == 0 and y == 0, it will compute the right result (0) but a division by zero will occur and should be ignored in client code. */
|
float32_t arm_jensenshannon_distance_f32(const float32_t *pA, const float32_t *pB, uint32_t blockSize)
|
/* Jensen-Shannon distance between two vectors.
When the function is computing x log (x / y) with x == 0 and y == 0, it will compute the right result (0) but a division by zero will occur and should be ignored in client code. */
float32_t arm_jensenshannon_distance_f32(const float32_t *pA, const float32_t *pB, uint32_t blockSize)
|
{
float32_t left, right,sum, result, tmp;
uint32_t i;
left = 0.0f;
right = 0.0f;
for(i=0; i < blockSize; i++)
{
tmp = (pA[i] + pB[i]) / 2.0f;
left += rel_entr(pA[i], tmp);
right += rel_entr(pB[i], tmp);
}
sum = left + right;
arm_sqrt_f32(sum/2.0f, &result);
return(result);
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Start the virtual CPU timer on the current CPU. */
|
void init_cpu_vtimer(void)
|
/* Start the virtual CPU timer on the current CPU. */
void init_cpu_vtimer(void)
|
{
struct vtimer_queue *vq;
vq = &__get_cpu_var(virt_cpu_timer);
INIT_LIST_HEAD(&vq->list);
spin_lock_init(&vq->lock);
__ctl_set_bit(0,10);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Enable/disable the DIV_ONE feature of the specified SPI port. */
|
void SPIDivOneFunction(unsigned long ulBase, xtBoolean xtEnable)
|
/* Enable/disable the DIV_ONE feature of the specified SPI port. */
void SPIDivOneFunction(unsigned long ulBase, xtBoolean xtEnable)
|
{
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) || (ulBase == SPI3_BASE));
if (xtEnable)
{
xHWREG(ulBase + SPI_CNTRL2) |= SPI_CNTRL2_DIV_ONE;
xHWREG(ulBase + SPI_CNTRL) &= ~SPI_CNTRL_VARCLK_EN;
xHWREG(ulBase + SPI_CNTRL) &= (~SPI_CNTRL_REORDER_M);
}
else
{
xHWREG(ulBase + SPI_CNTRL2) &= ~SPI_CNTRL2_DIV_ONE;
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* PM callbacks are typically implemented at SoC level and run the actual code to enter the given PM state. */
|
void pm_state_set(enum pm_state state, uint8_t substate_id)
|
/* PM callbacks are typically implemented at SoC level and run the actual code to enter the given PM state. */
void pm_state_set(enum pm_state state, uint8_t substate_id)
|
{
LOG_INF("Entering %s{%u}", state2str(state), substate_id);
k_cpu_idle();
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Event handler for the library USB Suspend event. */
|
void EVENT_USB_Device_Disconnect(void)
|
/* Event handler for the library USB Suspend event. */
void EVENT_USB_Device_Disconnect(void)
|
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* Extract the Wireless Protocol from a live interface */
|
static int mapping_getiwproto(int skfd, const char *ifname, struct if_mapping *target, int flag)
|
/* Extract the Wireless Protocol from a live interface */
static int mapping_getiwproto(int skfd, const char *ifname, struct if_mapping *target, int flag)
|
{
struct iwreq wrq;
flag = flag;
if(iw_get_ext(skfd, ifname, SIOCGIWNAME, &wrq) < 0)
return(-1);
strncpy(target->iwproto, wrq.u.name, IFNAMSIZ);
target->iwproto[IFNAMSIZ] = '\0';
target->active[SELECT_IWPROTO] = 1;
if(verbose)
fprintf(stderr,
"Querying %s : Got Wireless Protocol `%s'.\n",
ifname, target->iwproto);
return(0);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Execute FMC_ISPCMD_BANK_ERASE command to erase a flash block. */
|
int32_t FMC_Erase_Bank(uint32_t u32BankAddr)
|
/* Execute FMC_ISPCMD_BANK_ERASE command to erase a flash block. */
int32_t FMC_Erase_Bank(uint32_t u32BankAddr)
|
{
int32_t ret = 0;
FMC->ISPCMD = FMC_ISPCMD_BANK_ERASE;
FMC->ISPADDR = u32BankAddr;
FMC->ISPTRG = FMC_ISPTRG_ISPGO_Msk;
while (FMC->ISPTRG & FMC_ISPTRG_ISPGO_Msk) { }
if (FMC->ISPCTL & FMC_ISPCTL_ISPFF_Msk)
{
FMC->ISPCTL |= FMC_ISPCTL_ISPFF_Msk;
ret = -1;
}
return ret;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Retrieve HII package list from ImageHandle and publish to HII database. */
|
EFI_HII_HANDLE InitializeHiiPackage(IN EFI_HANDLE ImageHandle)
|
/* Retrieve HII package list from ImageHandle and publish to HII database. */
EFI_HII_HANDLE InitializeHiiPackage(IN EFI_HANDLE ImageHandle)
|
{
EFI_STATUS Status;
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
EFI_HII_HANDLE HiiHandle;
Status = gBS->OpenProtocol (
ImageHandle,
&gEfiHiiPackageListProtocolGuid,
(VOID **)&PackageList,
ImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
ASSERT_EFI_ERROR (Status);
if (EFI_ERROR (Status)) {
return NULL;
}
Status = gHiiDatabase->NewPackageList (
gHiiDatabase,
PackageList,
NULL,
&HiiHandle
);
ASSERT_EFI_ERROR (Status);
if (EFI_ERROR (Status)) {
return NULL;
}
return HiiHandle;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Write 2 bytes to Trace Hub MMIO mmio addr + 0x0. */
|
VOID EFIAPI MipiSystWriteD16(IN VOID *MipiSystHandle, IN UINT16 Data)
|
/* Write 2 bytes to Trace Hub MMIO mmio addr + 0x0. */
VOID EFIAPI MipiSystWriteD16(IN VOID *MipiSystHandle, IN UINT16 Data)
|
{
MIPI_SYST_HANDLE *MipiSystH;
MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle;
MmioWrite16 ((UINTN)(MipiSystH->systh_platform.TraceHubPlatformData.MmioAddr + 0x0), Data);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Return _TRUE dump packet directly ok _FALSE temporary can't transmit packets to hardware */
|
s32 rtl8188eu_hal_xmit(_adapter *padapter, struct xmit_frame *pxmitframe)
|
/* Return _TRUE dump packet directly ok _FALSE temporary can't transmit packets to hardware */
s32 rtl8188eu_hal_xmit(_adapter *padapter, struct xmit_frame *pxmitframe)
|
{
return pre_xmitframe(padapter, pxmitframe);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* The following two functions absolutely depend on the fact, that there can be only one camera on i.MX1/i.MXL camera sensor interface */
|
static int mx1_camera_add_device(struct soc_camera_device *icd)
|
/* The following two functions absolutely depend on the fact, that there can be only one camera on i.MX1/i.MXL camera sensor interface */
static int mx1_camera_add_device(struct soc_camera_device *icd)
|
{
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
struct mx1_camera_dev *pcdev = ici->priv;
int ret;
if (pcdev->icd) {
ret = -EBUSY;
goto ebusy;
}
dev_info(icd->dev.parent, "MX1 Camera driver attached to camera %d\n",
icd->devnum);
mx1_camera_activate(pcdev);
pcdev->icd = icd;
ebusy:
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Frees all URBs in the free list and marks the transmission as disabled. */
|
void zd_usb_disable_tx(struct zd_usb *usb)
|
/* Frees all URBs in the free list and marks the transmission as disabled. */
void zd_usb_disable_tx(struct zd_usb *usb)
|
{
struct zd_usb_tx *tx = &usb->tx;
unsigned long flags;
struct list_head *pos, *n;
spin_lock_irqsave(&tx->lock, flags);
list_for_each_safe(pos, n, &tx->free_urb_list) {
list_del(pos);
usb_free_urb(list_entry(pos, struct urb, urb_list));
}
tx->enabled = 0;
tx->submitted_urbs = 0;
spin_unlock_irqrestore(&tx->lock, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
|
VOID* EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
|
/* Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
|
{
VOID *Buffer;
Buffer = InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ZERO_POOL,
EfiRuntimeServicesData,
Buffer,
AllocationSize,
NULL
);
}
return Buffer;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* alarm callback function
This function clears the SLCD display and back light toggling */
|
void rtc_match_callback(void)
|
/* alarm callback function
This function clears the SLCD display and back light toggling */
void rtc_match_callback(void)
|
{
LCD_BACKLIGHT_OFF;
rtc_calendar_disable_callback(&rtc_instance, RTC_CALENDAR_CALLBACK_ALARM_0);
slcd_clear_display_memory();
tcc_disable(&tcc_instance);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
|
int main(void)
|
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void)
|
{
SetupHardware();
puts_P(PSTR(ESC_FG_CYAN "Mass Storage Host Demo running.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
MassStorageHost_Task();
MS_Host_USBTask(&FlashDisk_MS_Interface);
USB_USBTask();
}
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
|
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
|
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
|
{
if(htim_base->Instance==TIM2)
{
__HAL_RCC_TIM2_CLK_ENABLE();
}
else if(htim_base->Instance==TIM3)
{
__HAL_RCC_TIM3_CLK_ENABLE();
}
else if(htim_base->Instance==TIM4)
{
__HAL_RCC_TIM4_CLK_ENABLE();
}
else if(htim_base->Instance==TIM8)
{
__HAL_RCC_TIM8_CLK_ENABLE();
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Virtual: truncate_fn Returns: TRUE if successful. If an error has occurred, this function will return FALSE and set @error appropriately if present. */
|
gboolean g_seekable_truncate(GSeekable *seekable, goffset offset, GCancellable *cancellable, GError **error)
|
/* Virtual: truncate_fn Returns: TRUE if successful. If an error has occurred, this function will return FALSE and set @error appropriately if present. */
gboolean g_seekable_truncate(GSeekable *seekable, goffset offset, GCancellable *cancellable, GError **error)
|
{
GSeekableIface *iface;
g_return_val_if_fail (G_IS_SEEKABLE (seekable), FALSE);
iface = G_SEEKABLE_GET_IFACE (seekable);
return (* iface->truncate_fn) (seekable, offset, cancellable, error);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Disable Off-State in Idle Mode.
Disables the off-state in idle mode for the break function of an advanced timer. When the master output is disabled the output is also disabled. */
|
void timer_set_disabled_off_state_in_idle_mode(uint32_t timer_peripheral)
|
/* Disable Off-State in Idle Mode.
Disables the off-state in idle mode for the break function of an advanced timer. When the master output is disabled the output is also disabled. */
void timer_set_disabled_off_state_in_idle_mode(uint32_t timer_peripheral)
|
{
TIM_BDTR(timer_peripheral) &= ~TIM_BDTR_OSSI;
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* Write a data buffer to internal Flash. Note that we need for this function to reside in RAM since it will be used to self-upgrade U-boot in internal Flash. */
|
u32 __attribute__((section(".ramcode")))
|
/* Write a data buffer to internal Flash. Note that we need for this function to reside in RAM since it will be used to self-upgrade U-boot in internal Flash. */
u32 __attribute__((section(".ramcode")))
|
{
if (STM32_FLASH_REGS->cr & STM32_FLASH_CR_LOCK) {
STM32_FLASH_REGS->keyr = STM32_FLASH_KEYR_KEY1;
STM32_FLASH_REGS->keyr = STM32_FLASH_KEYR_KEY2;
}
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* clear_active_flags() is a helper for shrink_active_list(), clearing any active bits from the pages in the list. */
|
static unsigned long clear_active_flags(struct list_head *page_list, unsigned int *count)
|
/* clear_active_flags() is a helper for shrink_active_list(), clearing any active bits from the pages in the list. */
static unsigned long clear_active_flags(struct list_head *page_list, unsigned int *count)
|
{
int nr_active = 0;
int lru;
struct page *page;
list_for_each_entry(page, page_list, lru) {
lru = page_lru_base_type(page);
if (PageActive(page)) {
lru += LRU_ACTIVE;
ClearPageActive(page);
nr_active++;
}
count[lru]++;
}
return nr_active;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param base PMU peripheral base address. param mode The control mode of the PLL LDO. Please refer to pmu_control_mode_t. */
|
void PMU_SetPllLdoControlMode(ANADIG_PMU_Type *base, pmu_control_mode_t mode)
|
/* param base PMU peripheral base address. param mode The control mode of the PLL LDO. Please refer to pmu_control_mode_t. */
void PMU_SetPllLdoControlMode(ANADIG_PMU_Type *base, pmu_control_mode_t mode)
|
{
if (mode == kPMU_StaticMode)
{
base->PMU_LDO_PLL &= ~ANADIG_PMU_PMU_LDO_PLL_LDO_PLL_CONTROL_MODE_MASK;
}
else
{
base->PMU_LDO_PLL |= ANADIG_PMU_PMU_LDO_PLL_LDO_PLL_CONTROL_MODE_MASK;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Parse the flag charachters from the .flags attribute list into the binary form to be stored in the environment entry->flags field. */
|
static int env_parse_flags_to_bin(const char *flags)
|
/* Parse the flag charachters from the .flags attribute list into the binary form to be stored in the environment entry->flags field. */
static int env_parse_flags_to_bin(const char *flags)
|
{
int binflags;
binflags = env_flags_parse_vartype(flags) & ENV_FLAGS_VARTYPE_BIN_MASK;
binflags |= env_flags_varaccess_mask[env_flags_parse_varaccess(flags)];
return binflags;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* The following are the status flags for device mode: */
|
uint32_t USBEndpointStatus(uint32_t ui32Base, uint32_t ui32Endpoint)
|
/* The following are the status flags for device mode: */
uint32_t USBEndpointStatus(uint32_t ui32Base, uint32_t ui32Endpoint)
|
{
uint32_t ui32Status;
ASSERT(ui32Base == USB0_BASE);
ASSERT((ui32Endpoint == USB_EP_0) || (ui32Endpoint == USB_EP_1) ||
(ui32Endpoint == USB_EP_2) || (ui32Endpoint == USB_EP_3) ||
(ui32Endpoint == USB_EP_4) || (ui32Endpoint == USB_EP_5) ||
(ui32Endpoint == USB_EP_6) || (ui32Endpoint == USB_EP_7));
ui32Status = HWREGH(ui32Base + EP_OFFSET(ui32Endpoint) + USB_O_TXCSRL1);
ui32Status |=
((HWREGH(ui32Base + EP_OFFSET(ui32Endpoint) + USB_O_RXCSRL1)) <<
USB_RX_EPSTATUS_SHIFT);
return(ui32Status);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Advanced decoding functions : _usingDict() : These decoding functions work the same as "_continue" ones, the dictionary must be explicitly provided within parameters */
|
int LZ4_decompress_safe_usingDict(const char *source, char *dest, int compressedSize, int maxOutputSize, const char *dictStart, int dictSize)
|
/* Advanced decoding functions : _usingDict() : These decoding functions work the same as "_continue" ones, the dictionary must be explicitly provided within parameters */
int LZ4_decompress_safe_usingDict(const char *source, char *dest, int compressedSize, int maxOutputSize, const char *dictStart, int dictSize)
|
{
if (dictSize==0)
return LZ4_decompress_safe(source, dest, compressedSize, maxOutputSize);
if (dictStart+dictSize == dest) {
if (dictSize >= 64 KB - 1)
return LZ4_decompress_safe_withPrefix64k(source, dest, compressedSize, maxOutputSize);
return LZ4_decompress_safe_withSmallPrefix(source, dest, compressedSize, maxOutputSize, dictSize);
}
return LZ4_decompress_safe_extDict(source, dest, compressedSize, maxOutputSize, dictStart, dictSize);
}
|
xboot/xboot
|
C++
|
MIT License
| 779
|
/* Function: int msgqueue_addmsg(MsgQueue_t *msgq, int length, ...) Purpose : add a message onto a message queue Params : msgq - queue to add message on length - length of message ... - message bytes Returns : != 0 if successful */
|
int msgqueue_addmsg(MsgQueue_t *msgq, int length,...)
|
/* Function: int msgqueue_addmsg(MsgQueue_t *msgq, int length, ...) Purpose : add a message onto a message queue Params : msgq - queue to add message on length - length of message ... - message bytes Returns : != 0 if successful */
int msgqueue_addmsg(MsgQueue_t *msgq, int length,...)
|
{
struct msgqueue_entry *mq = mqe_alloc(msgq);
va_list ap;
if (mq) {
struct msgqueue_entry **mqp;
int i;
va_start(ap, length);
for (i = 0; i < length; i++)
mq->msg.msg[i] = va_arg(ap, unsigned int);
va_end(ap);
mq->msg.length = length;
mq->msg.fifo = 0;
mq->next = NULL;
mqp = &msgq->qe;
while (*mqp)
mqp = &(*mqp)->next;
*mqp = mq;
}
return mq != NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Description: Search the DOI definition list for a DOI definition with a DOI value that matches @doi. The caller is responsibile for calling rcu_read_lock(). Returns a pointer to the DOI definition on success and NULL on failure. */
|
static struct cipso_v4_doi* cipso_v4_doi_search(u32 doi)
|
/* Description: Search the DOI definition list for a DOI definition with a DOI value that matches @doi. The caller is responsibile for calling rcu_read_lock(). Returns a pointer to the DOI definition on success and NULL on failure. */
static struct cipso_v4_doi* cipso_v4_doi_search(u32 doi)
|
{
struct cipso_v4_doi *iter;
list_for_each_entry_rcu(iter, &cipso_v4_doi_list, list)
if (iter->doi == doi && atomic_read(&iter->refcount))
return iter;
return NULL;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* CRC16 compute for DDR3 SPD Copied from DDR3 SPD spec. */
|
static int crc16(char *ptr, int count)
|
/* CRC16 compute for DDR3 SPD Copied from DDR3 SPD spec. */
static int crc16(char *ptr, int count)
|
{
int crc, i;
crc = 0;
while (--count >= 0) {
crc = crc ^ (int)*ptr++ << 8;
for (i = 0; i < 8; ++i)
if (crc & 0x8000)
crc = crc << 1 ^ 0x1021;
else
crc = crc << 1;
}
return crc & 0xffff;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* This function cleans up all outstanding received sequences. This is called by the driver when a link event or user action invalidates all the received sequences. */
|
void lpfc_cleanup_rcv_buffers(struct lpfc_vport *vport)
|
/* This function cleans up all outstanding received sequences. This is called by the driver when a link event or user action invalidates all the received sequences. */
void lpfc_cleanup_rcv_buffers(struct lpfc_vport *vport)
|
{
struct lpfc_dmabuf *h_buf, *hnext;
struct lpfc_dmabuf *d_buf, *dnext;
struct hbq_dmabuf *dmabuf = NULL;
list_for_each_entry_safe(h_buf, hnext, &vport->rcv_buffer_list, list) {
dmabuf = container_of(h_buf, struct hbq_dmabuf, hbuf);
list_del_init(&dmabuf->hbuf.list);
list_for_each_entry_safe(d_buf, dnext,
&dmabuf->dbuf.list, list) {
list_del_init(&d_buf->list);
lpfc_in_buf_free(vport->phba, d_buf);
}
lpfc_in_buf_free(vport->phba, &dmabuf->dbuf);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If recovery is not required, then the orphans from the previous session are not needed. This function locates the LEBs used to record orphans, and un-maps them. */
|
int ubifs_clear_orphans(struct ubifs_info *c)
|
/* If recovery is not required, then the orphans from the previous session are not needed. This function locates the LEBs used to record orphans, and un-maps them. */
int ubifs_clear_orphans(struct ubifs_info *c)
|
{
int lnum, err;
for (lnum = c->orph_first; lnum <= c->orph_last; lnum++) {
err = ubifs_leb_unmap(c, lnum);
if (err)
return err;
}
c->ohead_lnum = c->orph_first;
c->ohead_offs = 0;
return 0;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Check if the Trb is a transaction of the URB. */
|
BOOLEAN IsTransferRingTrb(IN USB_XHCI_INSTANCE *Xhc, IN TRB_TEMPLATE *Trb, IN URB *Urb)
|
/* Check if the Trb is a transaction of the URB. */
BOOLEAN IsTransferRingTrb(IN USB_XHCI_INSTANCE *Xhc, IN TRB_TEMPLATE *Trb, IN URB *Urb)
|
{
LINK_TRB *LinkTrb;
TRB_TEMPLATE *CheckedTrb;
UINTN Index;
EFI_PHYSICAL_ADDRESS PhyAddr;
CheckedTrb = Urb->TrbStart;
for (Index = 0; Index < Urb->TrbNum; Index++) {
if (Trb == CheckedTrb) {
return TRUE;
}
CheckedTrb++;
if (CheckedTrb->Type == TRB_TYPE_LINK) {
LinkTrb = (LINK_TRB *)CheckedTrb;
PhyAddr = (EFI_PHYSICAL_ADDRESS)(LinkTrb->PtrLo | LShiftU64 ((UINT64)LinkTrb->PtrHi, 32));
CheckedTrb = (TRB_TEMPLATE *)(UINTN)UsbHcGetHostAddrForPciAddr (Xhc->MemPool, (VOID *)(UINTN)PhyAddr, sizeof (TRB_TEMPLATE), FALSE);
ASSERT (CheckedTrb == Urb->Ring->RingSeg0);
}
}
return FALSE;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Used by a driver to check whether a Zorro device present in the system is in its list of supported devices. Returns the matching zorro_device_id structure or NULL if there is no match. */
|
const struct zorro_device_id* zorro_match_device(const struct zorro_device_id *ids, const struct zorro_dev *z)
|
/* Used by a driver to check whether a Zorro device present in the system is in its list of supported devices. Returns the matching zorro_device_id structure or NULL if there is no match. */
const struct zorro_device_id* zorro_match_device(const struct zorro_device_id *ids, const struct zorro_dev *z)
|
{
while (ids->id) {
if (ids->id == ZORRO_WILDCARD || ids->id == z->id)
return ids;
ids++;
}
return NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Converts a multicast IP address to a multicast HW MAC address. */
|
EFI_STATUS EFIAPI EmuSnpMcastIptoMac(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN Ipv6, IN EFI_IP_ADDRESS *Ip, OUT EFI_MAC_ADDRESS *Mac)
|
/* Converts a multicast IP address to a multicast HW MAC address. */
EFI_STATUS EFIAPI EmuSnpMcastIptoMac(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN Ipv6, IN EFI_IP_ADDRESS *Ip, OUT EFI_MAC_ADDRESS *Mac)
|
{
EFI_STATUS Status;
EMU_SNP_PRIVATE_DATA *Private;
Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This);
Status = Private->Io->MCastIpToMac (Private->Io, Ipv6, Ip, Mac);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Common NMI and Exception handler entry.
This function provided a command entry for NMI and exception. Silicon Vendor could modify this template implementation according to requirement. */
|
uint32_t core_exception_handler(unsigned long mcause, unsigned long sp)
|
/* Common NMI and Exception handler entry.
This function provided a command entry for NMI and exception. Silicon Vendor could modify this template implementation according to requirement. */
uint32_t core_exception_handler(unsigned long mcause, unsigned long sp)
|
{
uint32_t EXCn = (uint32_t)(mcause & 0X00000fff);
EXC_HANDLER exc_handler;
if ((EXCn < MAX_SYSTEM_EXCEPTION_NUM) && (EXCn > 0)) {
exc_handler = (EXC_HANDLER)SystemExceptionHandlers[EXCn];
} else if (EXCn == NMI_EXCn) {
exc_handler = (EXC_HANDLER)SystemExceptionHandlers[MAX_SYSTEM_EXCEPTION_NUM];
} else {
exc_handler = (EXC_HANDLER)system_default_exception_handler;
}
if (exc_handler != NULL) {
exc_handler(mcause, sp);
}
return 0;
}
/** @}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* Checks whether the specified I2C flag is set or not. */
|
FlagStatus I2C_GetFlagStatus(I2C_TypeDef *I2Cx, uint32_t I2C_FLAG)
|
/* Checks whether the specified I2C flag is set or not. */
FlagStatus I2C_GetFlagStatus(I2C_TypeDef *I2Cx, uint32_t I2C_FLAG)
|
{
uint32_t tmpreg = 0;
FlagStatus bitstatus = RESET;
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
assert_param(IS_I2C_GET_FLAG(I2C_FLAG));
tmpreg = I2Cx->ISR;
tmpreg &= I2C_FLAG;
if (tmpreg != 0)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Resets the RCC clock configuration to the default reset state. */
|
void RCC_DeInit(void)
|
/* Resets the RCC clock configuration to the default reset state. */
void RCC_DeInit(void)
|
{
RCC->CR |= (uint32_t)0x00000001;
RCC->CFGR &= (uint32_t)0x08FFB80C;
RCC->CR &= (uint32_t)0xFEF6FFFF;
RCC->CR &= (uint32_t)0xFFFBFFFF;
RCC->CFGR &= (uint32_t)0xFFC0FFFF;
RCC->CFGR2 &= (uint32_t)0xFFFFFFF0;
RCC->CFGR3 &= (uint32_t)0xFFF0FEAC;
RCC->CR2 &= (uint32_t)0xFFFFFFFE;
RCC->CIR = 0x00000000;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* brief Creates the SDIF handle. register call back function for interrupt and enable the interrupt param base SDIF peripheral base address. param handle SDIF handle pointer. param callback Structure pointer to contain all callback functions. param userData Callback function parameter. */
|
void SDIF_TransferCreateHandle(SDIF_Type *base, sdif_handle_t *handle, sdif_transfer_callback_t *callback, void *userData)
|
/* brief Creates the SDIF handle. register call back function for interrupt and enable the interrupt param base SDIF peripheral base address. param handle SDIF handle pointer. param callback Structure pointer to contain all callback functions. param userData Callback function parameter. */
void SDIF_TransferCreateHandle(SDIF_Type *base, sdif_handle_t *handle, sdif_transfer_callback_t *callback, void *userData)
|
{
assert(handle != NULL);
assert(callback != NULL);
(void)memset(handle, 0, sizeof(*handle));
handle->callback.SDIOInterrupt = callback->SDIOInterrupt;
handle->callback.DMADesUnavailable = callback->DMADesUnavailable;
handle->callback.CommandReload = callback->CommandReload;
handle->callback.TransferComplete = callback->TransferComplete;
handle->callback.cardInserted = callback->cardInserted;
handle->callback.cardRemoved = callback->cardRemoved;
handle->userData = userData;
s_sdifHandle[SDIF_GetInstance(base)] = handle;
s_sdifIsr = SDIF_TransferHandleIRQ;
SDIF_EnableGlobalInterrupt(base, true);
(void)EnableIRQ(s_sdifIRQ[SDIF_GetInstance(base)]);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Disable a peripheral. Peripherals are disabled with this function. Once disabled, they will not operate or respond to register reads/writes. */
|
void xSysCtlPeripheralDisable(unsigned long ulPeripheralID)
|
/* Disable a peripheral. Peripherals are disabled with this function. Once disabled, they will not operate or respond to register reads/writes. */
void xSysCtlPeripheralDisable(unsigned long ulPeripheralID)
|
{
SysCtlPeripheralDisable(ulPeripheralID);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Brief This function handles I2C1 (Slave) error interrupt request. Param None Retval None */
|
void I2C1_ER_IRQHandler(void)
|
/* Brief This function handles I2C1 (Slave) error interrupt request. Param None Retval None */
void I2C1_ER_IRQHandler(void)
|
{
if((ubNbDataToTransmit == 0) && (LL_I2C_IsActiveFlag_AF(I2C1)))
{
LL_I2C_ClearFlag_AF(I2C1);
Slave_Complete_Callback();
}
else
{
Error_Callback();
}
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* If 16-bit operations are not supported, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT16 EFIAPI BitFieldAnd16(IN UINT16 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData)
|
/* If 16-bit operations are not supported, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI BitFieldAnd16(IN UINT16 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData)
|
{
ASSERT (EndBit < 16);
ASSERT (StartBit <= EndBit);
return (UINT16)InternalBaseLibBitFieldAndUint (Operand, StartBit, EndBit, AndData);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Shuts down the LCD display and hdisables the USCI communication. */
|
void halLcdShutDown(void)
|
/* Shuts down the LCD display and hdisables the USCI communication. */
void halLcdShutDown(void)
|
{
halLcdStandby();
LCD_CS_RST_DIR |= LCD_CS_PIN | LCD_RESET_PIN ;
LCD_CS_RST_OUT &= ~(LCD_CS_PIN | LCD_RESET_PIN );
LCD_CS_RST_OUT &= ~LCD_RESET_PIN;
LCD_SPI_SEL &= ~(LCD_MOSI_PIN + LCD_CLK_PIN + LCD_MISO_PIN);
LCD_CS_RST_DIR |= LCD_MOSI_PIN + LCD_CLK_PIN + LCD_MISO_PIN;
LCD_CS_RST_OUT &= ~(LCD_MOSI_PIN + LCD_CLK_PIN + LCD_MISO_PIN);
UCB2CTL0 = UCSWRST;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* LPTIM MSP Initialization This function configures the hardware resources used in this example. */
|
void HAL_LPTIM_MspInit(LPTIM_HandleTypeDef *hlptim)
|
/* LPTIM MSP Initialization This function configures the hardware resources used in this example. */
void HAL_LPTIM_MspInit(LPTIM_HandleTypeDef *hlptim)
|
{
if(hlptim->Instance==LPTIM1)
{
__HAL_RCC_LPTIM1_CLK_ENABLE();
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* atomically swap in the new signal mask, and wait for a signal. */
|
asmlinkage long sys_sigsuspend(int history0, int history1, old_sigset_t mask)
|
/* atomically swap in the new signal mask, and wait for a signal. */
asmlinkage long sys_sigsuspend(int history0, int history1, 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_thread_flag(TIF_RESTORE_SIGMASK);
return -ERESTARTNOHAND;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
|
long GPIOPinRead(unsigned long ulPort, unsigned char ucPins)
|
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
long GPIOPinRead(unsigned long ulPort, unsigned char ucPins)
|
{
ASSERT(GPIOBaseValid(ulPort));
return(HWREG(ulPort + (GPIO_O_DATA + (ucPins << 2))));
}
|
watterott/WebRadio
|
C++
| null | 71
|
/* VSPrint function to process format and place the results in Buffer. Since a VA_LIST is used this routine allows the nesting of Vararg routines. Thus this is the main print working routine */
|
UINTN EFIAPI BasePrintLibSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN UINTN Flags, IN CONST CHAR8 *FormatString,...)
|
/* VSPrint function to process format and place the results in Buffer. Since a VA_LIST is used this routine allows the nesting of Vararg routines. Thus this is the main print working routine */
UINTN EFIAPI BasePrintLibSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN UINTN Flags, IN CONST CHAR8 *FormatString,...)
|
{
VA_LIST Marker;
UINTN NumberOfPrinted;
VA_START (Marker, FormatString);
NumberOfPrinted = BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, Flags, FormatString, Marker, NULL);
VA_END (Marker);
return NumberOfPrinted;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base Pointer to the FLEXIO_UART_Type structure. param rxData The buffer to store the received bytes. param rxSize The number of data bytes to be received. */
|
void FLEXIO_UART_ReadBlocking(FLEXIO_UART_Type *base, uint8_t *rxData, size_t rxSize)
|
/* param base Pointer to the FLEXIO_UART_Type structure. param rxData The buffer to store the received bytes. param rxSize The number of data bytes to be received. */
void FLEXIO_UART_ReadBlocking(FLEXIO_UART_Type *base, uint8_t *rxData, size_t rxSize)
|
{
assert(rxData);
assert(rxSize);
while (rxSize--)
{
while (!(FLEXIO_UART_GetStatusFlags(base) & kFLEXIO_UART_RxDataRegFullFlag))
{
}
*rxData++ = base->flexioBase->SHIFTBUFBYS[base->shifterIndex[1]];
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* retval kStatus_Success Enable IO High Voltage Detect in low power mode successfully. */
|
status_t SPC_EnableLowPowerModeIOHighVoltageDetect(SPC_Type *base, bool enable)
|
/* retval kStatus_Success Enable IO High Voltage Detect in low power mode successfully. */
status_t SPC_EnableLowPowerModeIOHighVoltageDetect(SPC_Type *base, bool enable)
|
{
status_t status = kStatus_Success;
if (enable)
{
base->LP_CFG |= SPC_LP_CFG_IO_HVDE_MASK;
}
else
{
base->LP_CFG &= ~SPC_LP_CFG_IO_HVDE_MASK;
}
return status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function "opens" SMRAM so that it is visible while not inside of SMM. The function should return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. The function should return EFI_DEVICE_ERROR if the SMRAM configuration is locked. */
|
STATIC EFI_STATUS EFIAPI SmmAccess2DxeOpen(IN EFI_SMM_ACCESS2_PROTOCOL *This)
|
/* This function "opens" SMRAM so that it is visible while not inside of SMM. The function should return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. The function should return EFI_DEVICE_ERROR if the SMRAM configuration is locked. */
STATIC EFI_STATUS EFIAPI SmmAccess2DxeOpen(IN EFI_SMM_ACCESS2_PROTOCOL *This)
|
{
return SmramAccessOpen (&This->LockState, &This->OpenState);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Set write enable latch with Write Enable command. Returns negative if error occurred. */
|
static int smi_write_enable(int bank)
|
/* Set write enable latch with Write Enable command. Returns negative if error occurred. */
static int smi_write_enable(int bank)
|
{
u32 ctrlreg1;
int timeout = WMODE_TOUT;
ctrlreg1 = readl(&smicntl->smi_cr1);
writel(readl(&smicntl->smi_cr1) & ~SW_MODE, &smicntl->smi_cr1);
writel((bank << BANKSEL_SHIFT) | WE, &smicntl->smi_cr2);
smi_wait_xfer_finish(XFER_FINISH_TOUT);
writel(ctrlreg1, &smicntl->smi_cr1);
while (timeout--) {
if (smi_read_sr(bank) & (1 << (bank + WM_SHIFT)))
break;
udelay(1000);
}
if (timeout)
return 0;
return -1;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* inotify_inode_is_dead - an inode has been deleted, cleanup any watches @inode: inode that is about to be removed */
|
void inotify_inode_is_dead(struct inode *inode)
|
/* inotify_inode_is_dead - an inode has been deleted, cleanup any watches @inode: inode that is about to be removed */
void inotify_inode_is_dead(struct inode *inode)
|
{
struct inotify_watch *watch, *next;
mutex_lock(&inode->inotify_mutex);
list_for_each_entry_safe(watch, next, &inode->inotify_watches, i_list) {
struct inotify_handle *ih = watch->ih;
mutex_lock(&ih->mutex);
inotify_remove_watch_locked(ih, watch);
mutex_unlock(&ih->mutex);
}
mutex_unlock(&inode->inotify_mutex);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The function is used to Set BOD threshold voltage.
The */
|
void SysCtlBODVoltSelect(unsigned char ulVoltage)
|
/* The function is used to Set BOD threshold voltage.
The */
void SysCtlBODVoltSelect(unsigned char ulVoltage)
|
{
xASSERT((ulVoltage == SYSCTL_BOD_2_7) ||
(ulVoltage == SYSCTL_BOD_3_8));
SysCtlKeyAddrUnlock();
xHWREG(GCR_BODCR) &= ~GCR_BODCR_BOD_VL_M;
xHWREG(GCR_BODCR) |= ulVoltage;
SysCtlKeyAddrLock();
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Returns: TRUE if @group_name is a part of @key_file, FALSE otherwise. Since: 2.6 */
|
gboolean g_key_file_has_group(GKeyFile *key_file, const gchar *group_name)
|
/* Returns: TRUE if @group_name is a part of @key_file, FALSE otherwise. Since: 2.6 */
gboolean g_key_file_has_group(GKeyFile *key_file, const gchar *group_name)
|
{
g_return_val_if_fail (key_file != NULL, FALSE);
g_return_val_if_fail (group_name != NULL, FALSE);
return g_key_file_lookup_group (key_file, group_name) != NULL;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Reads and return a packet of data on the specified USART peripheral. This function operates asynchronously, so it waits until some data has been received. */
|
unsigned short USART_Read(AT91S_USART *usart, volatile unsigned int timeOut)
|
/* Reads and return a packet of data on the specified USART peripheral. This function operates asynchronously, so it waits until some data has been received. */
unsigned short USART_Read(AT91S_USART *usart, volatile unsigned int timeOut)
|
{
if (timeOut == 0) {
while ((usart->US_CSR & AT91C_US_RXRDY) == 0);
}
else {
while ((usart->US_CSR & AT91C_US_RXRDY) == 0) {
if (timeOut == 0) {
TRACE_ERROR("USART_Read: Timed out.\n\r");
return 0;
}
timeOut--;
}
}
return usart->US_RHR;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Reset the SDMMC with the RCC.SDMMCxRST register bit. This will reset the SDMMC to the reset state and the CPSM and DPSM to the Idle state. SDMMC is disabled, Signals Hiz. */
|
static void stm32_sdmmc2_reset(struct stm32_sdmmc2_priv *priv)
|
/* Reset the SDMMC with the RCC.SDMMCxRST register bit. This will reset the SDMMC to the reset state and the CPSM and DPSM to the Idle state. SDMMC is disabled, Signals Hiz. */
static void stm32_sdmmc2_reset(struct stm32_sdmmc2_priv *priv)
|
{
reset_assert(&priv->reset_ctl);
udelay(2);
reset_deassert(&priv->reset_ctl);
writel(priv->pwr_reg_msk, priv->base + SDMMC_POWER);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Note that "task" can be NULL. Another task is awoken to use the transport if the transport's congestion window allows it. */
|
void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task)
|
/* Note that "task" can be NULL. Another task is awoken to use the transport if the transport's congestion window allows it. */
void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task)
|
{
if (xprt->snd_task == task) {
xprt_clear_locked(xprt);
__xprt_lock_write_next_cong(xprt);
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Place a packet after a given packet in a list. The list locks are taken and this function is atomic with respect to other list locked calls. A buffer cannot be placed on two lists at the same time. */
|
void skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list)
|
/* Place a packet after a given packet in a list. The list locks are taken and this function is atomic with respect to other list locked calls. A buffer cannot be placed on two lists at the same time. */
void skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list)
|
{
unsigned long flags;
spin_lock_irqsave(&list->lock, flags);
__skb_queue_after(list, old, newsk);
spin_unlock_irqrestore(&list->lock, flags);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Called when no more references to WSS exist: wlp_wss_release() wlp_wss_reset() */
|
size_t wlp_wss_key_print(char *buf, size_t bufsize, u8 *key)
|
/* Called when no more references to WSS exist: wlp_wss_release() wlp_wss_reset() */
size_t wlp_wss_key_print(char *buf, size_t bufsize, u8 *key)
|
{
size_t result;
result = scnprintf(buf, bufsize,
"%02x %02x %02x %02x %02x %02x "
"%02x %02x %02x %02x %02x %02x "
"%02x %02x %02x %02x",
key[0], key[1], key[2], key[3],
key[4], key[5], key[6], key[7],
key[8], key[9], key[10], key[11],
key[12], key[13], key[14], key[15]);
return result;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param handle i2c master handle. return kStatus_HAL_I2cSuccess is success, else deinitial failed. */
|
status_t CODEC_I2C_Deinit(void *handle)
|
/* param handle i2c master handle. return kStatus_HAL_I2cSuccess is success, else deinitial failed. */
status_t CODEC_I2C_Deinit(void *handle)
|
{
return HAL_I2cMasterDeinit((hal_i2c_master_handle_t *)handle);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Dispose of the state data for the backside control loop */
|
static void dispose_backside_state(struct backside_pid_state *state)
|
/* Dispose of the state data for the backside control loop */
static void dispose_backside_state(struct backside_pid_state *state)
|
{
if (state->monitor == NULL)
return;
device_remove_file(&of_dev->dev, &dev_attr_backside_temperature);
device_remove_file(&of_dev->dev, &dev_attr_backside_fan_pwm);
state->monitor = NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Disable a specified APIC interrupt input line.
This routine disables a specified APIC interrupt input line. */
|
__pinned_func void z_ioapic_irq_disable(unsigned int irq)
|
/* Disable a specified APIC interrupt input line.
This routine disables a specified APIC interrupt input line. */
__pinned_func void z_ioapic_irq_disable(unsigned int irq)
|
{
IoApicRedUpdateLo(irq, IOAPIC_INT_MASK, IOAPIC_INT_MASK);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Check if Receive buffer full interrupt is enabled @rmtoll IER RXBFIE LL_SWPMI_IsEnabledIT_RXBF. */
|
uint32_t LL_SWPMI_IsEnabledIT_RXBF(SWPMI_TypeDef *SWPMIx)
|
/* Check if Receive buffer full interrupt is enabled @rmtoll IER RXBFIE LL_SWPMI_IsEnabledIT_RXBF. */
uint32_t LL_SWPMI_IsEnabledIT_RXBF(SWPMI_TypeDef *SWPMIx)
|
{
return ((READ_BIT(SWPMIx->IER, SWPMI_IER_RXBFIE) == (SWPMI_IER_RXBFIE)) ? 1UL : 0UL);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* If 16-bit MMIO register operations are not supported, then ASSERT(). */
|
UINT16 EFIAPI S3MmioOr16(IN UINTN Address, IN UINT16 OrData)
|
/* If 16-bit MMIO register operations are not supported, then ASSERT(). */
UINT16 EFIAPI S3MmioOr16(IN UINTN Address, IN UINT16 OrData)
|
{
return InternalSaveMmioWrite16ValueToBootScript (Address, MmioOr16 (Address, OrData));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Enables tracing on a given set of ITM ports. */
|
void am_hal_itm_trace_port_enable(uint8_t ui8portNum)
|
/* Enables tracing on a given set of ITM ports. */
void am_hal_itm_trace_port_enable(uint8_t ui8portNum)
|
{
AM_REGVAL(AM_REG_ITM_TPR_O) |= (0x00000001 << (ui8portNum>>3));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Convert text to the binary representation of a device node. */
|
EFI_DEVICE_PATH_PROTOCOL* ConvertTextToDeviceNode(CONST CHAR16 *TextDeviceNode)
|
/* Convert text to the binary representation of a device node. */
EFI_DEVICE_PATH_PROTOCOL* ConvertTextToDeviceNode(CONST CHAR16 *TextDeviceNode)
|
{
return UefiDevicePathLibConvertTextToDeviceNode (TextDeviceNode);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This is the completion handler for driver's configuring asynchronous event mailbox command to the device. If the mailbox command returns successfully, it will set internal async event support flag to 1; otherwise, it will set internal async event support flag to 0. */
|
static void lpfc_config_async_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
|
/* This is the completion handler for driver's configuring asynchronous event mailbox command to the device. If the mailbox command returns successfully, it will set internal async event support flag to 1; otherwise, it will set internal async event support flag to 0. */
static void lpfc_config_async_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
|
{
if (pmboxq->u.mb.mbxStatus == MBX_SUCCESS)
phba->temp_sensor_support = 1;
else
phba->temp_sensor_support = 0;
mempool_free(pmboxq, phba->mbox_mem_pool);
return;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function requests that the block layer start recovery for the request by deleting the timer and calling the q's timeout function. LLDDs who implement their own error recovery MAY ignore the timeout event if they generated blk_abort_req. Must hold queue lock. */
|
void blk_abort_request(struct request *req)
|
/* This function requests that the block layer start recovery for the request by deleting the timer and calling the q's timeout function. LLDDs who implement their own error recovery MAY ignore the timeout event if they generated blk_abort_req. Must hold queue lock. */
void blk_abort_request(struct request *req)
|
{
if (blk_mark_rq_complete(req))
return;
blk_delete_timer(req);
blk_rq_timed_out(req);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Retrieve the Key Usage from one X.509 certificate. */
|
BOOLEAN EFIAPI X509GetKeyUsage(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINTN *Usage)
|
/* Retrieve the Key Usage from one X.509 certificate. */
BOOLEAN EFIAPI X509GetKeyUsage(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINTN *Usage)
|
{
BOOLEAN Status;
X509 *X509Cert;
if ((Cert == NULL) || (Usage == NULL)) {
return FALSE;
}
X509Cert = NULL;
Status = FALSE;
Status = X509ConstructCertificate (Cert, CertSize, (UINT8 **)&X509Cert);
if ((X509Cert == NULL) || (!Status)) {
goto _Exit;
}
*Usage = X509_get_key_usage (X509Cert);
if (*Usage == NID_undef) {
goto _Exit;
}
Status = TRUE;
_Exit:
if (X509Cert != NULL) {
X509_free (X509Cert);
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* __vxge_hw_vpath_reset This routine resets the vpath on the device */
|
enum vxge_hw_status __vxge_hw_vpath_reset(struct __vxge_hw_device *hldev, u32 vp_id)
|
/* __vxge_hw_vpath_reset This routine resets the vpath on the device */
enum vxge_hw_status __vxge_hw_vpath_reset(struct __vxge_hw_device *hldev, u32 vp_id)
|
{
u64 val64;
enum vxge_hw_status status = VXGE_HW_OK;
val64 = VXGE_HW_CMN_RSTHDLR_CFG0_SW_RESET_VPATH(1 << (16 - vp_id));
__vxge_hw_pio_mem_write32_upper((u32)vxge_bVALn(val64, 0, 32),
&hldev->common_reg->cmn_rsthdlr_cfg0);
return status;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Set up the clock source and clock events devices */
|
void __init mps_timer_init(unsigned int timer_irq)
|
/* Set up the clock source and clock events devices */
void __init mps_timer_init(unsigned int timer_irq)
|
{
u32 val;
val = readl(__io_address(MPS_SCTL_BASE));
writel((MPS_TIMCLK << MPS_TIMER1_EnSel) |
(MPS_TIMCLK << MPS_TIMER2_EnSel) |
(MPS_TIMCLK << MPS_TIMER3_EnSel) |
(MPS_TIMCLK << MPS_TIMER4_EnSel) | val,
__io_address(MPS_SCTL_BASE));
writel(0, timer0_va_base + TIMER_CTRL);
writel(0, timer1_va_base + TIMER_CTRL);
writel(0, timer2_va_base + TIMER_CTRL);
writel(0, timer3_va_base + TIMER_CTRL);
setup_irq(timer_irq, &mps_timer_irq);
mps_clocksource_init();
mps_clockevents_init(timer_irq);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This file is part of the Simba project. */
|
int mock_write_fs_module_init(int res)
|
/* This file is part of the Simba project. */
int mock_write_fs_module_init(int res)
|
{
harness_mock_write("fs_module_init()",
NULL,
0);
harness_mock_write("fs_module_init(): return (res)",
&res,
sizeof(res));
return (0);
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* Function used to load the WEP keys for a selected interface */
|
gboolean airpcap_if_load_driver_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info)
|
/* Function used to load the WEP keys for a selected interface */
gboolean airpcap_if_load_driver_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info)
|
{
if_info->keysCollectionSize = 0;
if_info->keysCollection = NULL;
if (!airpcap_if_get_driver_keys(ad, NULL, &(if_info->keysCollectionSize)))
{
if (if_info->keysCollectionSize == 0)
{
if_info->keysCollection = NULL;
airpcap_if_close(ad);
return FALSE;
}
if_info->keysCollection = (PAirpcapKeysCollection)g_malloc(if_info->keysCollectionSize);
if (!if_info->keysCollection)
{
if_info->keysCollectionSize = 0;
if_info->keysCollection = NULL;
airpcap_if_close(ad);
return FALSE;
}
airpcap_if_get_driver_keys(ad, if_info->keysCollection, &(if_info->keysCollectionSize));
return TRUE;
}
airpcap_if_close(ad);
return FALSE;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Configures a chip select of a SPI peripheral. The chip select configuration is computed using the definition provided by the LibV3 (AT91C_SPI_*). */
|
void SPI_ConfigureNPCS(AT91S_SPI *spi, unsigned int npcs, unsigned int configuration)
|
/* Configures a chip select of a SPI peripheral. The chip select configuration is computed using the definition provided by the LibV3 (AT91C_SPI_*). */
void SPI_ConfigureNPCS(AT91S_SPI *spi, unsigned int npcs, unsigned int configuration)
|
{
spi->SPI_CSR[npcs] = configuration;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* ADC internal TemperatureSensor mode.
This function enables the internal temperature sensor for ADC input and displays the current room temperature in serial console after the calculation done using ADC result. */
|
void adc_temp_sensor(void)
|
/* ADC internal TemperatureSensor mode.
This function enables the internal temperature sensor for ADC input and displays the current room temperature in serial console after the calculation done using ADC result. */
void adc_temp_sensor(void)
|
{
float temp;
system_voltage_reference_enable(SYSTEM_VOLTAGE_REFERENCE_TEMPSENSE);
configure_adc_temp();
load_calibration_data();
raw_result = adc_start_read_result();
temp = calculate_temperature(raw_result);
printf("\nThe current temperature is = %f degree Celsius", temp);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Compose string with hostname. buf is assumed to have enough space, and be null-terminated. */
|
static void compose_hostname(hw_id_t hw_id, char *buf)
|
/* Compose string with hostname. buf is assumed to have enough space, and be null-terminated. */
static void compose_hostname(hw_id_t hw_id, char *buf)
|
{
char *p;
strncat(buf, &hw_id[PCB_NAME][0], hw_id_format[PCB_NAME].length);
strncat(buf, "_", 1);
strncat(buf, &hw_id[FORM][0], hw_id_format[FORM].length);
strncat(buf, &hw_id[VERSION][0], hw_id_format[VERSION].length);
for (p = buf; *p; ++p)
*p = tolower(*p);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* UART MSP Initialization This function configures the hardware resources used in this example. */
|
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim)
|
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim)
|
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(htim->Instance==TIM1)
{
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_0;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF2_TIM1;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_13;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF6_TIM1;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* configure counter value, window value, and prescaler divider value */
|
void wwdgt_config(uint16_t counter, uint16_t window, uint32_t prescaler)
|
/* configure counter value, window value, and prescaler divider value */
void wwdgt_config(uint16_t counter, uint16_t window, uint32_t prescaler)
|
{
uint32_t reg_cfg = 0U, reg_ctl = 0U;
reg_cfg = (WWDGT_CFG &(~(WWDGT_CFG_WIN|WWDGT_CFG_PSC)));
reg_ctl = (WWDGT_CTL &(~WWDGT_CTL_CNT));
reg_cfg |= CFG_WIN(window);
reg_cfg |= prescaler;
reg_ctl |= CTL_CNT(counter);
WWDGT_CTL = reg_ctl;
WWDGT_CFG = reg_cfg;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
|
UINT8 EFIAPI S3PciBitFieldRead8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT8 EFIAPI S3PciBitFieldRead8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
|
{
return InternalSavePciWrite8ValueToBootScript (Address, PciBitFieldRead8 (Address, StartBit, EndBit));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This is called to pin the inode associated with the inode log item in memory so it cannot be written out. Do this by calling xfs_ipin() to bump the pin count in the inode while holding the inode pin lock. */
|
STATIC void xfs_inode_item_pin(xfs_inode_log_item_t *iip)
|
/* This is called to pin the inode associated with the inode log item in memory so it cannot be written out. Do this by calling xfs_ipin() to bump the pin count in the inode while holding the inode pin lock. */
STATIC void xfs_inode_item_pin(xfs_inode_log_item_t *iip)
|
{
ASSERT(xfs_isilocked(iip->ili_inode, XFS_ILOCK_EXCL));
xfs_ipin(iip->ili_inode);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Free the DMA program buffer that is pointed by the GeneratedDmaProg field of the command. */
|
int XDmaPs_FreeDmaProg(XDmaPs *InstPtr, unsigned int Channel, XDmaPs_Cmd *Cmd)
|
/* Free the DMA program buffer that is pointed by the GeneratedDmaProg field of the command. */
int XDmaPs_FreeDmaProg(XDmaPs *InstPtr, unsigned int Channel, XDmaPs_Cmd *Cmd)
|
{
void *Buf;
XDmaPs_ChannelData *ChanData;
Xil_AssertNonvoid(InstPtr != NULL);
Xil_AssertNonvoid(Cmd != NULL);
if (Channel > XDMAPS_CHANNELS_PER_DEV)
return XST_FAILURE;
Buf = (void *)Cmd->GeneratedDmaProg;
ChanData = InstPtr->Chans + Channel;
if (Buf) {
XDmaPs_BufPool_Free(ChanData->ProgBufPool, Buf);
Cmd->GeneratedDmaProg = 0;
Cmd->GeneratedDmaProgLength = 0;
}
return XST_SUCCESS;
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* This file implement the IRDA interface of IrNET. Basically, we sit on top of IrTTP. We set up IrTTP, IrIAS properly, and exchange frames with IrTTP. PPP disconnect work: we need to make sure we're in process context when calling ppp_unregister_channel(). */
|
static void irnet_ppp_disconnect(struct work_struct *work)
|
/* This file implement the IRDA interface of IrNET. Basically, we sit on top of IrTTP. We set up IrTTP, IrIAS properly, and exchange frames with IrTTP. PPP disconnect work: we need to make sure we're in process context when calling ppp_unregister_channel(). */
static void irnet_ppp_disconnect(struct work_struct *work)
|
{
irnet_socket * self =
container_of(work, irnet_socket, disconnect_work);
if (self == NULL)
return;
if (self->ppp_open && !self->ttp_open && !self->ttp_connect) {
ppp_unregister_channel(&self->chan);
self->ppp_open = 0;
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Message: MediaResourceNotificationMessage Opcode: 0x002c Type: MediaControl Direction: dev2pbx VarLength: no */
|
static void handle_MediaResourceNotificationMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
/* Message: MediaResourceNotificationMessage Opcode: 0x002c Type: MediaControl Direction: dev2pbx VarLength: no */
static void handle_MediaResourceNotificationMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
{
ptvcursor_add(cursor, hf_skinny_deviceType, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_numberOfInServiceStreams, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_maxStreamsPerConf, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_numberOfOutOfServiceStreams, 4, ENC_LITTLE_ENDIAN);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Note, 'end' is 1 byte beyond the end of the range to flush. */
|
static void sh5_flush_cache_range(void *args)
|
/* Note, 'end' is 1 byte beyond the end of the range to flush. */
static void sh5_flush_cache_range(void *args)
|
{
struct flusher_data *data = args;
struct vm_area_struct *vma;
unsigned long start, end;
vma = data->vma;
start = data->addr1;
end = data->addr2;
sh64_dcache_purge_user_range(vma->vm_mm, start, end);
sh64_icache_inv_user_page_range(vma->vm_mm, start, end);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Enable the High Speed APB (APB2) peripheral clock. */
|
void RCM_EnableAPB2PeriphClock(uint32_t APB2Periph)
|
/* Enable the High Speed APB (APB2) peripheral clock. */
void RCM_EnableAPB2PeriphClock(uint32_t APB2Periph)
|
{
RCM->APB2CLKEN |= APB2Periph;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Compute the hash value for a given address/port pairs if the match is to be exact. */
|
static guint host_hash(gconstpointer v)
|
/* Compute the hash value for a given address/port pairs if the match is to be exact. */
static guint host_hash(gconstpointer v)
|
{
const host_key_t *key = (const host_key_t *)v;
guint hash_val;
hash_val = 0;
hash_val = add_address_to_hash(hash_val, &key->myaddress);
hash_val += key->port;
return hash_val;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This enet related pin-muxing and GPIO handling is done in SPL U-Boot. For early initialization. And to give the PHY some time to come out of reset before the U-Boot ethernet driver tries to access its registers via MDIO. */
|
int platinum_setup_enet(void)
|
/* This enet related pin-muxing and GPIO handling is done in SPL U-Boot. For early initialization. And to give the PHY some time to come out of reset before the U-Boot ethernet driver tries to access its registers via MDIO. */
int platinum_setup_enet(void)
|
{
struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
unsigned phy_reset = IMX_GPIO_NR(1, 19);
imx_iomux_v3_setup_pad(phy_reset_pad);
gpio_direction_output(phy_reset, 0);
imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
mdelay(10);
gpio_set_value(phy_reset, 1);
udelay(100);
setbits_le32(&iomux->gpr[1], IOMUXC_GPR1_ENET_CLK_SEL_MASK);
return enable_fec_anatop_clock(0, ENET_50MHZ);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Returns the write protection status of user flash area. */
|
uint16_t FLASH_If_GetWriteProtectionStatus(void)
|
/* Returns the write protection status of user flash area. */
uint16_t FLASH_If_GetWriteProtectionStatus(void)
|
{
uint32_t ProtectedSECTOR = 0xFFF;
FLASH_OBProgramInitTypeDef OptionsBytesStruct;
HAL_FLASH_Unlock();
HAL_FLASHEx_OBGetConfig(&OptionsBytesStruct);
HAL_FLASH_Lock();
ProtectedSECTOR = ~(OptionsBytesStruct.WRPSector) & FLASH_SECTOR_TO_BE_PROTECTED;
if(ProtectedSECTOR != 0)
{
return FLASHIF_PROTECTION_WRPENABLED;
}
else
{
return FLASHIF_PROTECTION_NONE;
}
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.