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 only returns error code if the device is not capable of generating PME# from both D3_hot and D3_cold, and the platform is unable to enable wake-up power for it. */
|
int pci_wake_from_d3(struct pci_dev *dev, bool enable)
|
/* This function only returns error code if the device is not capable of generating PME# from both D3_hot and D3_cold, and the platform is unable to enable wake-up power for it. */
int pci_wake_from_d3(struct pci_dev *dev, bool enable)
|
{
return pci_pme_capable(dev, PCI_D3cold) ?
pci_enable_wake(dev, PCI_D3cold, enable) :
pci_enable_wake(dev, PCI_D3hot, enable);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Disable the SPI interrupt of the specified SPI port. */
|
void SPIIntDisable(unsigned long ulBase, unsigned long ulIntFlags)
|
/* Disable the SPI interrupt of the specified SPI port. */
void SPIIntDisable(unsigned long ulBase, unsigned long ulIntFlags)
|
{
xASSERT(ulBase == SPI0_BASE);
xHWREG(ulBase + SPI_IIER) &= ~ulIntFlags;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* sw_guess_mode() checks the upper two button bits for toggling - indication of that the joystick is in 3-bit mode. This is documented behavior for 3DP ID packet, and for example the FSP does this in normal packets instead. Fun ... */
|
static int sw_guess_mode(unsigned char *buf, int len)
|
/* sw_guess_mode() checks the upper two button bits for toggling - indication of that the joystick is in 3-bit mode. This is documented behavior for 3DP ID packet, and for example the FSP does this in normal packets instead. Fun ... */
static int sw_guess_mode(unsigned char *buf, int len)
|
{
int i;
unsigned char xor = 0;
for (i = 1; i < len; i++)
xor |= (buf[i - 1] ^ buf[i]) & 6;
return !!xor * 2 + 1;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Configure the length setting for block and repeat mode. */
|
static void r_dtc_block_repeat_initialize(transfer_info_t *p_info)
|
/* Configure the length setting for block and repeat mode. */
static void r_dtc_block_repeat_initialize(transfer_info_t *p_info)
|
{
uint32_t i = 0;
do
{
if (TRANSFER_MODE_NORMAL != p_info[i].transfer_settings_word_b.mode)
{
uint8_t CRAL = p_info[i].length & DTC_PRV_MASK_CRAL;
p_info[i].length = (uint16_t) ((CRAL << DTC_PRV_OFFSET_CRAH) | CRAL);
}
} while (TRANSFER_CHAIN_MODE_DISABLED != p_info[i++].transfer_settings_word_b.chain_mode);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Make sure single step bits etc are not set. */
|
void ptrace_disable(struct task_struct *child)
|
/* Make sure single step bits etc are not set. */
void ptrace_disable(struct task_struct *child)
|
{
clear_tsk_thread_flag(child, TIF_LOAD_WATCH);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* The qTD might be still active (if it's part of a IN URB that resulted in a short read) so ensure it's deactivated. */
|
static void qset_remove_qtd(struct whc *whc, struct whc_qset *qset)
|
/* The qTD might be still active (if it's part of a IN URB that resulted in a short read) so ensure it's deactivated. */
static void qset_remove_qtd(struct whc *whc, struct whc_qset *qset)
|
{
qset->qtd[qset->td_start].status = 0;
if (++qset->td_start >= WHCI_QSET_TD_MAX)
qset->td_start = 0;
qset->ntds--;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Read RCA (relative card address) of SD card. */
|
static int sd_get_rca(uint32_t instance)
|
/* Read RCA (relative card address) of SD card. */
static int sd_get_rca(uint32_t instance)
|
{
command_t cmd;
int port, card_state, status = FAIL;
command_response_t response;
port = card_get_port(instance);
if (port == USDHC_NUMBER_PORTS) {
printf("Base address: 0x%x not in address table.\n", REGS_USDHC_BASE(instance));
return status;
}
card_cmd_config(&cmd, CMD3, NO_ARG, READ, RESPONSE_48, DATA_PRESENT_NONE, TRUE, TRUE);
usdhc_printf("Send CMD3.\n");
if (host_send_cmd(instance, &cmd) == SUCCESS) {
response.format = RESPONSE_48;
host_read_response(instance, &response);
usdhc_device[port].rca = response.cmd_rsp0 >> RCA_SHIFT;
card_state = CURR_CARD_STATE(response.cmd_rsp0);
if (card_state == IDENT) {
status = SUCCESS;
}
}
return status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* note This function must be called when the lock is not disabled. */
|
void XRDC2_LockMemSlotExclAccess(XRDC2_Type *base, xrdc2_mem_slot_t memSlot)
|
/* note This function must be called when the lock is not disabled. */
void XRDC2_LockMemSlotExclAccess(XRDC2_Type *base, xrdc2_mem_slot_t memSlot)
|
{
uint8_t curDomainID;
volatile uint32_t *lockReg = &(base->MSCI_MSAC_WK[(uint32_t)memSlot].MSC_MSAC_W1);
curDomainID = XRDC2_GetCurrentMasterDomainId(base);
while (true)
{
*lockReg = XRDC2_EAL_LOCKED;
if (curDomainID == XRDC2_GetMemSlotExclAccessLockDomainOwner(base, memSlot))
{
break;
}
}
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Check that the given (pin group, pin) pair is a valid LPC18xx pin. Returns 0 on success, -EINVAL otherwise. */
|
static int lpc18xx_validate_pin(const struct lpc18xx_iomux_dsc *dsc)
|
/* Check that the given (pin group, pin) pair is a valid LPC18xx pin. Returns 0 on success, -EINVAL otherwise. */
static int lpc18xx_validate_pin(const struct lpc18xx_iomux_dsc *dsc)
|
{
int rv;
rv = 0;
if (!dsc ||
((dsc->group >= LPC18XX_IOMUX_GROUPS ||
dsc->pin >= LPC18XX_IOMUX_GROUP_PINS) &&
(dsc->group != LPC18XX_IOMUX_CLK_GROUP ||
dsc->pin >= LPC18XX_IOMUX_CLK_PINS))) {
if (gd->have_console) {
printf("IOMUX: incorrect params %d.%d.\n",
dsc ? dsc->group : -1,
dsc ? dsc->pin : -1);
}
rv = -EINVAL;
}
return rv;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Converts a stop bit enum value to a Mode Register bit mask.
It is assumed that the Mode Register contents that are being modified within this function come with the bits modified by this function already masked out by the caller. */
|
static bool uart_xlnx_ps_cfg2ll_stopbits(uint32_t *mode_reg, enum uart_config_stop_bits stopbits)
|
/* Converts a stop bit enum value to a Mode Register bit mask.
It is assumed that the Mode Register contents that are being modified within this function come with the bits modified by this function already masked out by the caller. */
static bool uart_xlnx_ps_cfg2ll_stopbits(uint32_t *mode_reg, enum uart_config_stop_bits stopbits)
|
{
switch (stopbits) {
case UART_CFG_STOP_BITS_0_5:
return false;
default:
case UART_CFG_STOP_BITS_1:
*mode_reg |= XUARTPS_MR_STOPMODE_1_BIT;
break;
case UART_CFG_STOP_BITS_1_5:
*mode_reg |= XUARTPS_MR_STOPMODE_1_5_BIT;
break;
case UART_CFG_STOP_BITS_2:
*mode_reg |= XUARTPS_MR_STOPMODE_2_BIT;
break;
}
return true;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* If 64-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
|
UINT64 EFIAPI S3MmioBitFieldRead64(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
|
/* If 64-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT64 EFIAPI S3MmioBitFieldRead64(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
|
{
return InternalSaveMmioWrite64ValueToBootScript (Address, MmioBitFieldRead64 (Address, StartBit, EndBit));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Used by a driver to check whether a DIO device present in the system is in its list of supported devices. Returns the matching dio_device_id structure or NULL if there is no match. */
|
const struct dio_device_id* dio_match_device(const struct dio_device_id *ids, const struct dio_dev *d)
|
/* Used by a driver to check whether a DIO device present in the system is in its list of supported devices. Returns the matching dio_device_id structure or NULL if there is no match. */
const struct dio_device_id* dio_match_device(const struct dio_device_id *ids, const struct dio_dev *d)
|
{
while (ids->id) {
if (ids->id == DIO_WILDCARD)
return ids;
if (DIO_NEEDSSECID(ids->id & 0xff)) {
if (ids->id == d->id)
return ids;
} else {
if ((ids->id & 0xff) == (d->id & 0xff))
return ids;
}
ids++;
}
return NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param base DCDC peripheral base address. param enable Switcher to reset signal. True means reset signal. False means don't reset signal. */
|
void DCDC_ResetCurrentAlertSignal(DCDC_Type *base, bool enable)
|
/* param base DCDC peripheral base address. param enable Switcher to reset signal. True means reset signal. False means don't reset signal. */
void DCDC_ResetCurrentAlertSignal(DCDC_Type *base, bool enable)
|
{
if (enable)
{
base->REG0 |= DCDC_REG0_CURRENT_ALERT_RESET_MASK;
}
else
{
base->REG0 &= ~DCDC_REG0_CURRENT_ALERT_RESET_MASK;
}
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* return the block group that contains the given bytenr */
|
struct btrfs_block_group_cache* btrfs_lookup_block_group(struct btrfs_fs_info *info, u64 bytenr)
|
/* return the block group that contains the given bytenr */
struct btrfs_block_group_cache* btrfs_lookup_block_group(struct btrfs_fs_info *info, u64 bytenr)
|
{
struct btrfs_block_group_cache *cache;
cache = block_group_cache_tree_search(info, bytenr, 1);
return cache;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Registers the event callback functions that should be called by the CAN interface. */
|
static void SocketCanRegisterEvents(tCanEvents const *events)
|
/* Registers the event callback functions that should be called by the CAN interface. */
static void SocketCanRegisterEvents(tCanEvents const *events)
|
{
assert(events != NULL);
if (events != NULL)
{
socketCanEventsList = realloc((void *)socketCanEventsList,
(sizeof(tCanEvents) * (socketCanEventsEntries + 1)));
assert(socketCanEventsList != NULL);
if (socketCanEventsList != NULL)
{
socketCanEventsEntries++;
socketCanEventsList[socketCanEventsEntries - 1] = *events;
}
else
{
socketCanEventsEntries = 0;
}
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* The trick here is to kludge around well known problem with kernel Ooopsing when you try to capture PAL on a device node configure for NTSC. That's why we have to configure the device node for PAL, and then read only NTSC amount of data. */
|
static int dv1394_reset(struct dv1394_data *dv)
|
/* The trick here is to kludge around well known problem with kernel Ooopsing when you try to capture PAL on a device node configure for NTSC. That's why we have to configure the device node for PAL, and then read only NTSC amount of data. */
static int dv1394_reset(struct dv1394_data *dv)
|
{
struct dv1394_init init;
init.channel = dv->channel;
init.api_version = DV1394_API_VERSION;
init.n_frames = DV1394_RING_FRAMES;
init.format = DV1394_PAL;
if (ioctl(dv->fd, DV1394_INIT, &init) < 0)
return -1;
dv->avail = dv->done = 0;
return 0;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* This function calculates and returns the number of HBQs required to be configured. */
|
int lpfc_sli_hbq_count(void)
|
/* This function calculates and returns the number of HBQs required to be configured. */
int lpfc_sli_hbq_count(void)
|
{
return ARRAY_SIZE(lpfc_hbq_defs);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The following functions send requests to the VirtIo GPU device model, await the answer from the host, and return a status. They share the following interface details: */
|
EFI_STATUS VirtioGpuResourceCreate2d(IN OUT VGPU_DEV *VgpuDev, IN UINT32 ResourceId, IN VIRTIO_GPU_FORMATS Format, IN UINT32 Width, IN UINT32 Height)
|
/* The following functions send requests to the VirtIo GPU device model, await the answer from the host, and return a status. They share the following interface details: */
EFI_STATUS VirtioGpuResourceCreate2d(IN OUT VGPU_DEV *VgpuDev, IN UINT32 ResourceId, IN VIRTIO_GPU_FORMATS Format, IN UINT32 Width, IN UINT32 Height)
|
{
volatile VIRTIO_GPU_RESOURCE_CREATE_2D Request;
if (ResourceId == 0) {
return EFI_INVALID_PARAMETER;
}
Request.ResourceId = ResourceId;
Request.Format = (UINT32)Format;
Request.Width = Width;
Request.Height = Height;
return VirtioGpuSendCommand (
VgpuDev,
VirtioGpuCmdResourceCreate2d,
FALSE,
&Request.Header,
sizeof Request
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Configure the selected source to generate a global interrupt or not. */
|
uint8_t stmpe811_TS_ITStatus(uint16_t DeviceAddr)
|
/* Configure the selected source to generate a global interrupt or not. */
uint8_t stmpe811_TS_ITStatus(uint16_t DeviceAddr)
|
{
return(stmpe811_ReadGITStatus(DeviceAddr, STMPE811_TS_IT));
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* acpiphp_bus_trim - trim a bus from acpi subsystem @handle: handle to acpi namespace */
|
static int acpiphp_bus_trim(acpi_handle handle)
|
/* acpiphp_bus_trim - trim a bus from acpi subsystem @handle: handle to acpi namespace */
static int acpiphp_bus_trim(acpi_handle handle)
|
{
struct acpi_device *device;
int retval;
retval = acpi_bus_get_device(handle, &device);
if (retval) {
dbg("acpi_device not found\n");
return retval;
}
retval = acpi_bus_trim(device, 1);
if (retval)
err("cannot remove from acpi list\n");
return retval;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* UART MSP Initialization This function configures the hardware resources used in this example. */
|
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
|
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
|
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(huart->Instance==USART3)
{
__HAL_RCC_USART3_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
GPIO_InitStruct.Pin = STLK_RX_Pin|STLK_TX_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF7_USART3;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Disable the DMA of the specified SPI port.
The */
|
void xSPIDMADisable(unsigned long ulBase, unsigned long ulDmaMode)
|
/* Disable the DMA of the specified SPI port.
The */
void xSPIDMADisable(unsigned long ulBase, unsigned long ulDmaMode)
|
{
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) || (ulBase == SPI3_BASE));
xHWREG(ulBase + SPI_DMACTL) &= ~ulDmaMode;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Set the callback function which will be called when a transfer completes. If a NULL callback function is set, then no callback will occur. */
|
int dma_set_device_handler(DMA_Device_t dev, DMA_DeviceHandler_t devHandler, void *userData)
|
/* Set the callback function which will be called when a transfer completes. If a NULL callback function is set, then no callback will occur. */
int dma_set_device_handler(DMA_Device_t dev, DMA_DeviceHandler_t devHandler, void *userData)
|
{
DMA_DeviceAttribute_t *devAttr;
unsigned long flags;
if (!IsDeviceValid(dev)) {
return -ENODEV;
}
devAttr = &DMA_gDeviceAttribute[dev];
local_irq_save(flags);
devAttr->userData = userData;
devAttr->devHandler = devHandler;
local_irq_restore(flags);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Change any previous mappings from/to the new surface format */
|
void SDL_FormatChanged(SDL_Surface *surface)
|
/* Change any previous mappings from/to the new surface format */
void SDL_FormatChanged(SDL_Surface *surface)
|
{
static int format_version = 0;
++format_version;
if ( format_version < 0 ) {
format_version = 1;
}
surface->format_version = format_version;
SDL_InvalidateMap(surface->map);
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* This function returns the TLS/SSL server random data currently used in the specified TLS connection. */
|
VOID EFIAPI CryptoServiceTlsGetServerRandom(IN VOID *Tls, IN OUT UINT8 *ServerRandom)
|
/* This function returns the TLS/SSL server random data currently used in the specified TLS connection. */
VOID EFIAPI CryptoServiceTlsGetServerRandom(IN VOID *Tls, IN OUT UINT8 *ServerRandom)
|
{
CALL_VOID_BASECRYPTLIB (TlsGet.Services.ServerRandom, TlsGetServerRandom, (Tls, ServerRandom));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Function for changing the state of the state machine. */
|
static void state_machine_state_change(state_t new_state)
|
/* Function for changing the state of the state machine. */
static void state_machine_state_change(state_t new_state)
|
{
m_state = new_state;
state_entry_action_execute();
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Set DMA source PIP configuration used by a HDMA channel. */
|
void DMA_SPIPconfiguration(unsigned char channel, unsigned int pipHole, unsigned int pipBoundary)
|
/* Set DMA source PIP configuration used by a HDMA channel. */
void DMA_SPIPconfiguration(unsigned char channel, unsigned int pipHole, unsigned int pipBoundary)
|
{
unsigned int value;
ASSERT(channel < DMA_CHANNEL_NUM, "this channel does not exist");
value = AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CTRLB;
value &= ~ (AT91C_SRC_PIP);
value |= AT91C_SRC_PIP;
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CTRLB = value;
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_SPIP = (pipHole + 1) | pipBoundary <<16;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Set block length (in bytes) for read and write. */
|
int card_set_blklen(uint32_t instance, int len)
|
/* Set block length (in bytes) for read and write. */
int card_set_blklen(uint32_t instance, int len)
|
{
command_t cmd;
int status = FAIL;
card_cmd_config(&cmd, CMD16, len, READ, RESPONSE_48, DATA_PRESENT_NONE, TRUE, TRUE);
usdhc_printf("Send CMD16.\n");
if (host_send_cmd(instance, &cmd) == SUCCESS) {
status = SUCCESS;
}
return status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Set the source repeat size of the specified dma channel. */
|
en_result_t Dma_EnableDestinationRload(en_dma_channel_t enCh)
|
/* Set the source repeat size of the specified dma channel. */
en_result_t Dma_EnableDestinationRload(en_dma_channel_t enCh)
|
{
ASSERT(IS_VALID_CH(enCh));
if((!IS_VALID_CH(enCh)))
{
return ErrorInvalidParameter;
}
if(enCh == DmaCh0)
{
M0P_DMAC ->CONFB0_f.RD = 1;
}
else {
M0P_DMAC ->CONFB1_f.RD = 1; }
return Ok;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Works for both CAN and FDCAN DLC values. */
|
uint8_t fdcan_dlc_to_length(uint32_t dlc)
|
/* Works for both CAN and FDCAN DLC values. */
uint8_t fdcan_dlc_to_length(uint32_t dlc)
|
{
if (dlc <= 8) {
return dlc;
} else if (dlc <= 12) {
return 8 + ((dlc - 8) * 4);
} else {
return 16 + ((dlc - 12) * 16);
}
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* slave send target length data use DMA mode. */
|
int32_t spi_slave_write_stream_dma(spi_t *obj, char *tx_buffer, uint32_t length)
|
/* slave send target length data use DMA mode. */
int32_t spi_slave_write_stream_dma(spi_t *obj, char *tx_buffer, uint32_t length)
|
{
uint8_t spi_idx = obj->spi_idx &0x0F;
PHAL_SSI_ADAPTOR ssi_adapter = &ssi_adapter_g[spi_idx];
int32_t ret;
if (obj->state & SPI_STATE_TX_BUSY) {
DBG_PRINTF(MODULE_SPI, LEVEL_WARN, "spis dma tx: state(0x%x) is not ready\r\n",
obj->state);
return HAL_BUSY;
}
obj->state |= SPI_STATE_TX_BUSY;
ret = ssi_dma_send(ssi_adapter, (u8 *) tx_buffer, length);
if (ret != _TRUE) {
obj->state &= ~SPI_STATE_TX_BUSY;
}
return (ret == _TRUE) ? HAL_OK : HAL_BUSY;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France, Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod, 91893 Orsay, France */
|
int isl_map_is_transitively_closed(__isl_keep isl_map *map)
|
/* Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France, Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod, 91893 Orsay, France */
int isl_map_is_transitively_closed(__isl_keep isl_map *map)
|
{
isl_map *map2;
int closed;
map2 = isl_map_apply_range(isl_map_copy(map), isl_map_copy(map));
closed = isl_map_is_subset(map2, map);
isl_map_free(map2);
return closed;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Change Logs: Date Author Notes balanceTWK first version */
|
void main(void)
|
/* Change Logs: Date Author Notes balanceTWK first version */
void main(void)
|
{
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
while (1)
{
rt_pin_write(LED0_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LED0_PIN, PIN_LOW);
rt_thread_mdelay(500);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If this function returns, it means that the system does not support cold reset. */
|
VOID EFIAPI ResetCold(VOID)
|
/* If this function returns, it means that the system does not support cold reset. */
VOID EFIAPI ResetCold(VOID)
|
{
PeiServicesResetSystem2 (EfiResetCold, EFI_SUCCESS, 0, NULL);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
|
gboolean _g_freedesktop_dbus_call_get_name_owner_sync(_GFreedesktopDBus *proxy, const gchar *arg_name, gchar **out_unique_name, GCancellable *cancellable, GError **error)
|
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
gboolean _g_freedesktop_dbus_call_get_name_owner_sync(_GFreedesktopDBus *proxy, const gchar *arg_name, gchar **out_unique_name, GCancellable *cancellable, GError **error)
|
{
GVariant *_ret;
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
"GetNameOwner",
g_variant_new ("(s)",
arg_name),
G_DBUS_CALL_FLAGS_NONE,
-1,
cancellable,
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
|
/* Otherwise, the default value that was passed as the third argument is returned. */
|
static gint find_val_for_string(const char *needle, const enum_val_t *haystack, gint default_value)
|
/* Otherwise, the default value that was passed as the third argument is returned. */
static gint find_val_for_string(const char *needle, const enum_val_t *haystack, gint default_value)
|
{
int i;
for (i = 0; haystack[i].name != NULL; i++) {
if (g_ascii_strcasecmp(needle, haystack[i].name) == 0) {
return haystack[i].value;
}
}
for (i = 0; haystack[i].name != NULL; i++) {
if (g_ascii_strcasecmp(needle, haystack[i].description) == 0) {
return haystack[i].value;
}
}
return default_value;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
|
void Vector52_handler(void)
|
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector52_handler(void)
|
{
asm
{
LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (52 * 2))
JMP 0,X
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Configure Priority Flow Control for each traffic class. */
|
s32 ixgbe_dcb_config_pfc(struct ixgbe_hw *hw, struct ixgbe_dcb_config *dcb_config)
|
/* Configure Priority Flow Control for each traffic class. */
s32 ixgbe_dcb_config_pfc(struct ixgbe_hw *hw, struct ixgbe_dcb_config *dcb_config)
|
{
s32 ret = 0;
if (hw->mac.type == ixgbe_mac_82598EB)
ret = ixgbe_dcb_config_pfc_82598(hw, dcb_config);
else if (hw->mac.type == ixgbe_mac_82599EB)
ret = ixgbe_dcb_config_pfc_82599(hw, dcb_config);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* More recent versions of libcap are available from: */
|
static void warn_legacy_capability_use(void)
|
/* More recent versions of libcap are available from: */
static void warn_legacy_capability_use(void)
|
{
static int warned;
if (!warned) {
char name[sizeof(current->comm)];
printk(KERN_INFO "warning: `%s' uses 32-bit capabilities"
" (legacy support in use)\n",
get_task_comm(name, current));
warned = 1;
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Return with head node of the linked list. */
|
void* ramfs_ll_get_head(ramfs_ll_t *ll)
|
/* Return with head node of the linked list. */
void* ramfs_ll_get_head(ramfs_ll_t *ll)
|
{
void *head = NULL;
if (ll->head != NULL) {
head = ll->head;
}
return head;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Emulate floating-point pair loads and stores. Only POWER6 has these instructions, and it does true little-endian, so we don't need the address swizzling. */
|
static int emulate_fp_pair(unsigned char __user *addr, unsigned int reg, unsigned int flags)
|
/* Emulate floating-point pair loads and stores. Only POWER6 has these instructions, and it does true little-endian, so we don't need the address swizzling. */
static int emulate_fp_pair(unsigned char __user *addr, unsigned int reg, unsigned int flags)
|
{
char *ptr0 = (char *) ¤t->thread.TS_FPR(reg);
char *ptr1 = (char *) ¤t->thread.TS_FPR(reg+1);
int i, ret, sw = 0;
if (!(flags & F))
return 0;
if (reg & 1)
return 0;
if (flags & SW)
sw = 7;
ret = 0;
for (i = 0; i < 8; ++i) {
if (!(flags & ST)) {
ret |= __get_user(ptr0[i^sw], addr + i);
ret |= __get_user(ptr1[i^sw], addr + i + 8);
} else {
ret |= __put_user(ptr0[i^sw], addr + i);
ret |= __put_user(ptr1[i^sw], addr + i + 8);
}
}
if (ret)
return -EFAULT;
return 1;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Request exclusive access to a hash bucket for a given */
|
static struct hash_bucket* get_hash_bucket(struct dma_debug_entry *entry, unsigned long *flags)
|
/* Request exclusive access to a hash bucket for a given */
static struct hash_bucket* get_hash_bucket(struct dma_debug_entry *entry, unsigned long *flags)
|
{
int idx = hash_fn(entry);
unsigned long __flags;
spin_lock_irqsave(&dma_entry_hash[idx].lock, __flags);
*flags = __flags;
return &dma_entry_hash[idx];
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns number of bytes that could not be cleared. On success, this will be zero. */
|
unsigned long __clear_user(void __user *to, unsigned long n)
|
/* Returns number of bytes that could not be cleared. On success, this will be zero. */
unsigned long __clear_user(void __user *to, unsigned long n)
|
{
__do_clear_user(to, n);
return n;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Get the captured data for a sample sequence. */
|
unsigned long xADCDataGet(unsigned long ulBase, unsigned long *pulBuffer)
|
/* Get the captured data for a sample sequence. */
unsigned long xADCDataGet(unsigned long ulBase, unsigned long *pulBuffer)
|
{
unsigned long i;
unsigned long ulEnableChannels;
unsigned long ulValid;
unsigned long ulWrite;
xASSERT(ulBase == ADC_BASE);
xASSERT(pulBuffer != 0);
ulEnableChannels = (xHWREG(ulBase + ADC_CHER) & ADC_CHER_CHEN_M) >>
ADC_CHER_CHEN_S;
ulValid = (xHWREG(ulBase + ADC_SR) & ADC_SR_VALID_M) >> ADC_SR_VALID_S;
if(ulEnableChannels ^ ulValid)
{
return 0;
}
ulWrite = 0;
for(i = 0; i < 8; i++)
{
if(ulEnableChannels & (1 << i))
{
pulBuffer[ulWrite++] = xHWREG(ulBase + ADC_DR0 + (4 * i));
}
}
return ulWrite;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Configures a Timer Counter to operate in the given mode. Timer is stopped after configuration and must be restarted with TC_Start(). to obtain the target frequency. */
|
void TC_Configure(AT91S_TC *pTc, unsigned int mode)
|
/* Configures a Timer Counter to operate in the given mode. Timer is stopped after configuration and must be restarted with TC_Start(). to obtain the target frequency. */
void TC_Configure(AT91S_TC *pTc, unsigned int mode)
|
{
pTc->TC_CCR = AT91C_TC_CLKDIS;
pTc->TC_IDR = 0xFFFFFFFF;
pTc->TC_SR;
pTc->TC_CMR = mode;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* This function sets a new TLS/SSL method for a particular TLS object. */
|
EFI_STATUS EFIAPI TlsSetVersion(IN VOID *Tls, IN UINT8 MajorVer, IN UINT8 MinorVer)
|
/* This function sets a new TLS/SSL method for a particular TLS object. */
EFI_STATUS EFIAPI TlsSetVersion(IN VOID *Tls, IN UINT8 MajorVer, IN UINT8 MinorVer)
|
{
CALL_CRYPTO_SERVICE (TlsSetVersion, (Tls, MajorVer, MinorVer), EFI_UNSUPPORTED);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns first word of the unique device identifier (UID based on 96 bits) */
|
u32 Get_ChipsetUIDw0(void)
|
/* Returns first word of the unique device identifier (UID based on 96 bits) */
u32 Get_ChipsetUIDw0(void)
|
{
return(READ_REG(*((vu32*)UID_BASE)));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* set the interface value to the connected device */
|
usbh_status usbh_setdevfeature(usbh_host *uhost, uint8_t feature_selector, uint16_t windex)
|
/* set the interface value to the connected device */
usbh_status usbh_setdevfeature(usbh_host *uhost, uint8_t feature_selector, uint16_t windex)
|
{
usbh_status status = USBH_BUSY;
usbh_control *usb_ctl = &uhost->control;
if (CTL_IDLE == usb_ctl->ctl_state) {
usb_ctl->setup.req = (usb_req) {
.bmRequestType = USB_TRX_OUT | USB_RECPTYPE_DEV | USB_REQTYPE_STRD,
.bRequest = USB_SET_FEATURE,
.wValue = feature_selector,
.wIndex = windex,
.wLength = 0U
};
usbh_ctlstate_config (uhost, NULL, 0U);
}
status = usbh_ctl_handler (uhost);
return status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Disable the PWM output of the PWM module.
The */
|
void xPWMOutputDisable(unsigned long ulBase, unsigned long ulChannel)
|
/* Disable the PWM output of the PWM module.
The */
void xPWMOutputDisable(unsigned long ulBase, unsigned long ulChannel)
|
{
PWMOutputDisable(ulBase, ulChannel);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Get the MAC address of the current board. */
|
void KSZ8851SNL_MacAddressGet(uint8_t *macAddress)
|
/* Get the MAC address of the current board. */
void KSZ8851SNL_MacAddressGet(uint8_t *macAddress)
|
{
int i;
EFM_ASSERT(macAddress != NULL);
macAddress[0] = HIGH_QMU_MAC_H;
macAddress[1] = HIGH_QMU_MAC_L;
macAddress[2] = MID_QMU_MAC_H;
for (i = 0; i < 3; i++)
{
macAddress[5 - i] = (DEVINFO->UNIQUEL & (BYTE_MASK << i * BYTE_SIZE)) >> i * BYTE_SIZE;
}
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* This routine will release memory that had been previously lmb_reserved in early boot. The released memory becomes available for genreal use. */
|
static void release_memory_range(unsigned long start_pfn, unsigned long nr_pages)
|
/* This routine will release memory that had been previously lmb_reserved in early boot. The released memory becomes available for genreal use. */
static void release_memory_range(unsigned long start_pfn, unsigned long nr_pages)
|
{
struct page *rpage;
unsigned long end_pfn;
long i;
end_pfn = start_pfn + nr_pages;
for (i = start_pfn; i <= end_pfn; i++) {
rpage = pfn_to_page(i);
if (PageReserved(rpage)) {
ClearPageReserved(rpage);
init_page_count(rpage);
__free_page(rpage);
totalram_pages++;
}
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* deal with seq counter wrapping correctly. refer to timer_after() for jiffies wrapping handling */
|
static int tkip_replay_check(u32 iv32_n, u16 iv16_n, u32 iv32_o, u16 iv16_o)
|
/* deal with seq counter wrapping correctly. refer to timer_after() for jiffies wrapping handling */
static int tkip_replay_check(u32 iv32_n, u16 iv16_n, u32 iv32_o, u16 iv16_o)
|
{
if ((s32)iv32_n - (s32)iv32_o < 0 ||
(iv32_n == iv32_o && iv16_n <= iv16_o))
return 1;
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* According to Microsoft Zero Config Wireless Signal Stregth definition as belows. <= -90 No Signal <= -81 Very Low <= -71 Low <= -67 Good <= -57 Very Good */
|
void RTMPSetSignalLED(struct rt_rtmp_adapter *pAd, IN NDIS_802_11_RSSI Dbm)
|
/* According to Microsoft Zero Config Wireless Signal Stregth definition as belows. <= -90 No Signal <= -81 Very Low <= -71 Low <= -67 Good <= -57 Very Good */
void RTMPSetSignalLED(struct rt_rtmp_adapter *pAd, IN NDIS_802_11_RSSI Dbm)
|
{
u8 nLed = 0;
if (pAd->LedCntl.field.LedMode == LED_MODE_SIGNAL_STREGTH) {
if (Dbm <= -90)
nLed = 0;
else if (Dbm <= -81)
nLed = 1;
else if (Dbm <= -71)
nLed = 3;
else if (Dbm <= -67)
nLed = 7;
else if (Dbm <= -57)
nLed = 15;
else
nLed = 31;
if (pAd->LedIndicatorStrength != nLed) {
AsicSendCommandToMcu(pAd, 0x51, 0xff, nLed,
pAd->LedCntl.field.Polarity);
pAd->LedIndicatorStrength = nLed;
}
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Set the destination repeat size of the specified dma channel. */
|
en_result_t Dma_DisableSourceRload(en_dma_channel_t enCh)
|
/* Set the destination repeat size of the specified dma channel. */
en_result_t Dma_DisableSourceRload(en_dma_channel_t enCh)
|
{
ASSERT(IS_VALID_CH(enCh));
if(!IS_VALID_CH(enCh))
{
return ErrorInvalidParameter;
}
if(enCh == DmaCh0)
{
M0P_DMAC ->CONFB0_f.RS = 0;
}
else{
M0P_DMAC ->CONFB1_f.RS = 0; }
return Ok;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* STUSB1602 sets the VBUS_Range_State (EN or DIS) (bit4 0x2E */
|
STUSB1602_StatusTypeDef STUSB1602_VBUS_Range_State_Set(uint8_t Addr, VBUS_Range_State_TypeDef st)
|
/* STUSB1602 sets the VBUS_Range_State (EN or DIS) (bit4 0x2E */
STUSB1602_StatusTypeDef STUSB1602_VBUS_Range_State_Set(uint8_t Addr, VBUS_Range_State_TypeDef st)
|
{
STUSB1602_StatusTypeDef status = STUSB1602_OK;
STUSB1602_VBUS_MONITORING_CTRL_RegTypeDef reg;
STUSB1602_ReadReg(®.d8, Addr, STUSB1602_VBUS_MONITORING_CTRL_REG, 1);
reg.b.VBUS_RANGE_DISABLE = st;
status = STUSB1602_WriteReg(®.d8, Addr, STUSB1602_VBUS_MONITORING_CTRL_REG, 1);
return status;
}
|
st-one/X-CUBE-USB-PD
|
C++
| null | 110
|
/* Check whether the journal uses all of a given set of features. Return true (non-zero) if it does. */
|
int journal_check_used_features(journal_t *journal, unsigned long compat, unsigned long ro, unsigned long incompat)
|
/* Check whether the journal uses all of a given set of features. Return true (non-zero) if it does. */
int journal_check_used_features(journal_t *journal, unsigned long compat, unsigned long ro, unsigned long incompat)
|
{
journal_superblock_t *sb;
if (!compat && !ro && !incompat)
return 1;
if (journal->j_format_version == 1)
return 0;
sb = journal->j_superblock;
if (((be32_to_cpu(sb->s_feature_compat) & compat) == compat) &&
((be32_to_cpu(sb->s_feature_ro_compat) & ro) == ro) &&
((be32_to_cpu(sb->s_feature_incompat) & incompat) == incompat))
return 1;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* also note that seeking relative to the "end of file" isn't supported: it has no meaning, so it returns -EINVAL. */
|
static loff_t jsf_lseek(struct file *file, loff_t offset, int orig)
|
/* also note that seeking relative to the "end of file" isn't supported: it has no meaning, so it returns -EINVAL. */
static loff_t jsf_lseek(struct file *file, loff_t offset, int orig)
|
{
loff_t ret;
lock_kernel();
switch (orig) {
case 0:
file->f_pos = offset;
ret = file->f_pos;
break;
case 1:
file->f_pos += offset;
ret = file->f_pos;
break;
default:
ret = -EINVAL;
}
unlock_kernel();
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Locking: tty->termios_mutex is taken to ensure the winsize data is consistent. */
|
static int tiocgwinsz(struct tty_struct *tty, struct winsize __user *arg)
|
/* Locking: tty->termios_mutex is taken to ensure the winsize data is consistent. */
static int tiocgwinsz(struct tty_struct *tty, struct winsize __user *arg)
|
{
int err;
mutex_lock(&tty->termios_mutex);
err = copy_to_user(arg, &tty->winsize, sizeof(*arg));
mutex_unlock(&tty->termios_mutex);
return err ? -EFAULT: 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Sets whether the base stream will be closed when @stream is closed. */
|
void g_filter_output_stream_set_close_base_stream(GFilterOutputStream *stream, gboolean close_base)
|
/* Sets whether the base stream will be closed when @stream is closed. */
void g_filter_output_stream_set_close_base_stream(GFilterOutputStream *stream, gboolean close_base)
|
{
GFilterOutputStreamPrivate *priv;
g_return_if_fail (G_IS_FILTER_OUTPUT_STREAM (stream));
close_base = !!close_base;
priv = g_filter_output_stream_get_instance_private (stream);
if (priv->close_base != close_base)
{
priv->close_base = close_base;
g_object_notify (G_OBJECT (stream), "close-base-stream");
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Recursively refresh the style of the children. Go deeper until a not NULL style is found because the NULL styles are inherited from the parent */
|
static void refresh_children_style(lv_obj_t *obj)
|
/* Recursively refresh the style of the children. Go deeper until a not NULL style is found because the NULL styles are inherited from the parent */
static void refresh_children_style(lv_obj_t *obj)
|
{
lv_obj_t * child = lv_obj_get_child(obj, NULL);
while(child != NULL) {
if(child->style_p == NULL) {
refresh_children_style(child);
lv_obj_refresh_style(child);
} else if(child->style_p->glass) {
refresh_children_style(child);
}
child = lv_obj_get_child(obj, child);
}
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Read a property of size <prop_len>. Currently only supports 1 or 2 cells. */
|
static int fdt_read_prop(const fdt32_t *prop, int prop_len, int cell_off, uint64_t *val, int cells)
|
/* Read a property of size <prop_len>. Currently only supports 1 or 2 cells. */
static int fdt_read_prop(const fdt32_t *prop, int prop_len, int cell_off, uint64_t *val, int cells)
|
{
const fdt32_t *prop32 = &prop[cell_off];
const unaligned_fdt64_t *prop64 = (const fdt64_t *)&prop[cell_off];
if ((cell_off + cells) > prop_len)
return -FDT_ERR_NOSPACE;
switch (cells) {
case 1:
*val = fdt32_to_cpu(*prop32);
break;
case 2:
*val = fdt64_to_cpu(*prop64);
break;
default:
return -FDT_ERR_NOSPACE;
}
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Writes a value to the specified pin(s).
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
|
void GPIOPinWrite(unsigned long ulPort, unsigned long ulPins, unsigned char ucVal)
|
/* Writes a value to the specified pin(s).
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinWrite(unsigned long ulPort, unsigned long ulPins, unsigned char ucVal)
|
{
xASSERT(GPIOBaseValid(ulPort));
xHWREG(ulPort + GPIO_PDOR) = ((ucVal & 1) ?
(xHWREG(ulPort + GPIO_PDOR) | ulPins) :
(xHWREG(ulPort + GPIO_PDOR) & ~(ulPins)));
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Find occurrence of substr with length substr_len in pbuf p, start at offset start_offset WARNING: in contrast to strstr(), this one does not stop at the first \0 in the pbuf/source string! */
|
u16_t pbuf_strstr(const struct pbuf *p, const char *substr)
|
/* Find occurrence of substr with length substr_len in pbuf p, start at offset start_offset WARNING: in contrast to strstr(), this one does not stop at the first \0 in the pbuf/source string! */
u16_t pbuf_strstr(const struct pbuf *p, const char *substr)
|
{
size_t substr_len;
if ((substr == NULL) || (substr[0] == 0) || (p->tot_len == 0xFFFF)) {
return 0xFFFF;
}
substr_len = strlen(substr);
if (substr_len >= 0xFFFF) {
return 0xFFFF;
}
return pbuf_memfind(p, substr, (u16_t)substr_len, 0);
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* Clear the slave select pins of the specified SPI port. */
|
void SPISSClear(unsigned long ulBase)
|
/* Clear the slave select pins of the specified SPI port. */
void SPISSClear(unsigned long ulBase)
|
{
xASSERT(ulBase == SPI0_BASE);
xHWREG(ulBase + SPI_CNTRL0) &= ~SPI_CNTRL0_SSELC;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Sets the transfer count for an integrated USB DMA channel. */
|
void USBDMAChannelCountSet(uint32_t ui32Base, uint32_t ui32Channel, uint32_t ui32Count)
|
/* Sets the transfer count for an integrated USB DMA channel. */
void USBDMAChannelCountSet(uint32_t ui32Base, uint32_t ui32Channel, uint32_t ui32Count)
|
{
ASSERT(ui32Base == USB0_BASE);
ASSERT(ui32Channel < 8);
HWREG(ui32Base + USB_O_DMACOUNT0 + (0x10 * ui32Channel)) = ui32Count;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns: TRUE if the key did not exist yet */
|
static gboolean g_hash_table_insert_internal(GHashTable *hash_table, gpointer key, gpointer value, gboolean keep_new_key)
|
/* Returns: TRUE if the key did not exist yet */
static gboolean g_hash_table_insert_internal(GHashTable *hash_table, gpointer key, gpointer value, gboolean keep_new_key)
|
{
guint key_hash;
guint node_index;
g_return_val_if_fail (hash_table != NULL, FALSE);
node_index = g_hash_table_lookup_node (hash_table, key, &key_hash);
return g_hash_table_insert_node (hash_table, node_index, key_hash, key, value, keep_new_key, FALSE);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* For further information see John C. Bellamy's Digital Telephony, 1982, John Wiley & Sons, pps 98-111 and 472-476. */
|
unsigned char linear2alaw(int pcm_val)
|
/* For further information see John C. Bellamy's Digital Telephony, 1982, John Wiley & Sons, pps 98-111 and 472-476. */
unsigned char linear2alaw(int pcm_val)
|
{
int mask;
int seg;
unsigned char aval;
if (pcm_val >= 0) {
mask = 0xD5;
} else {
mask = 0x55;
pcm_val = -pcm_val - 8;
}
seg = search(pcm_val, seg_end, 8);
if (seg >= 8)
return (0x7F ^ mask);
else {
aval = seg << SEG_SHIFT;
if (seg < 2)
aval |= (pcm_val >> 4) & QUANT_MASK;
else
aval |= (pcm_val >> (seg + 3)) & QUANT_MASK;
return (aval ^ mask);
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Stripped-down 'require': After checking "loaded" table, calls 'openf' to open a module, registers the result in 'package.loaded' table and, if 'glb' is true, also registers the result in the global table. Leaves resulting module on the top. */
|
LUALIB_API void luaL_requiref(lua_State *L, const char *modname, lua_CFunction openf, int glb)
|
/* Stripped-down 'require': After checking "loaded" table, calls 'openf' to open a module, registers the result in 'package.loaded' table and, if 'glb' is true, also registers the result in the global table. Leaves resulting module on the top. */
LUALIB_API void luaL_requiref(lua_State *L, const char *modname, lua_CFunction openf, int glb)
|
{
luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE);
lua_getfield(L, -1, modname);
if (!lua_toboolean(L, -1)) {
lua_pop(L, 1);
lua_pushcfunction(L, openf);
lua_pushstring(L, modname);
lua_call(L, 1, 1);
lua_pushvalue(L, -1);
lua_setfield(L, -3, modname);
}
lua_remove(L, -2);
if (glb) {
lua_pushvalue(L, -1);
lua_setglobal(L, modname);
}
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */
|
UINT8 EFIAPI MmioOr8(IN UINTN Address, IN UINT8 OrData)
|
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */
UINT8 EFIAPI MmioOr8(IN UINTN Address, IN UINT8 OrData)
|
{
return MmioWrite8 (Address, (UINT8)(MmioRead8 (Address) | OrData));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Emulate BootRAM area. It is possible to do basic operation using BootRAM. */
|
static void onenand_bootram_handle(struct onenand_chip *this, int cmd)
|
/* Emulate BootRAM area. It is possible to do basic operation using BootRAM. */
static void onenand_bootram_handle(struct onenand_chip *this, int cmd)
|
{
switch (cmd) {
case ONENAND_CMD_READID:
writew(manuf_id, this->base);
writew(device_id, this->base + 2);
writew(version_id, this->base + 4);
break;
default:
break;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This API shall clear the ECC and VERIFICATION error status. */
|
void XMC_FLASH_ClearStatus(void)
|
/* This API shall clear the ECC and VERIFICATION error status. */
void XMC_FLASH_ClearStatus(void)
|
{
NVM->NVMPROG |= (uint16_t)((uint16_t)NVM_NVMPROG_RSTVERR_Msk | (uint16_t)NVM_NVMPROG_RSTECC_Msk);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* this is a little helper that is called by callers who have seen a problem with an sc and want to detach it from the nn if someone already hasn't beat them to it. if an error is given then the shutdown will be persistent and pending transmits will be canceled. */
|
static void o2net_ensure_shutdown(struct o2net_node *nn, struct o2net_sock_container *sc, int err)
|
/* this is a little helper that is called by callers who have seen a problem with an sc and want to detach it from the nn if someone already hasn't beat them to it. if an error is given then the shutdown will be persistent and pending transmits will be canceled. */
static void o2net_ensure_shutdown(struct o2net_node *nn, struct o2net_sock_container *sc, int err)
|
{
spin_lock(&nn->nn_lock);
if (nn->nn_sc == sc)
o2net_set_nn_state(nn, NULL, 0, err);
spin_unlock(&nn->nn_lock);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* write_u32 - Store 32 bit data on a buffer and return the size */
|
static void write_u32(void *buffer, size_t *off, uint32_t v)
|
/* write_u32 - Store 32 bit data on a buffer and return the size */
static void write_u32(void *buffer, size_t *off, uint32_t v)
|
{
if (buffer != NULL) {
memcpy((uint8_t *)buffer + *off, (uint8_t *)&v, sizeof(v));
} else {
print_u32(v);
}
*off = *off + sizeof(uint32_t);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Enables or Disables the RTC TimeStamp functionality with the specified time stamp pin stimulating edge. */
|
void RTC_EnableTimeStamp(uint32_t RTC_TimeStampEdge, FunctionalState Cmd)
|
/* Enables or Disables the RTC TimeStamp functionality with the specified time stamp pin stimulating edge. */
void RTC_EnableTimeStamp(uint32_t RTC_TimeStampEdge, FunctionalState Cmd)
|
{
uint32_t tmpregister = 0;
assert_param(IS_RTC_TIMESTAMP_EDGE_MODE(RTC_TimeStampEdge));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
tmpregister = (uint32_t)(RTC->CTRL & (uint32_t) ~(RTC_CTRL_TEDGE | RTC_CTRL_TSEN));
if (Cmd != DISABLE)
{
tmpregister |= (uint32_t)(RTC_TimeStampEdge | RTC_CTRL_TSEN);
}
else
{
tmpregister |= (uint32_t)(RTC_TimeStampEdge);
}
RTC->WRP = 0xCA;
RTC->WRP = 0x53;
RTC->CTRL = (uint32_t)tmpregister;
RTC->WRP = 0xFF;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Note that it also must deal with devices that don't exist. In this case it may probe for real hardware ("just in case") and add a device_node to the device tree if necessary. */
|
struct device_node* fetch_dev_dn(struct pci_dev *dev)
|
/* Note that it also must deal with devices that don't exist. In this case it may probe for real hardware ("just in case") and add a device_node to the device tree if necessary. */
struct device_node* fetch_dev_dn(struct pci_dev *dev)
|
{
struct device_node *orig_dn = dev->sysdata;
struct device_node *dn;
unsigned long searchval = (dev->bus->number << 8) | dev->devfn;
dn = traverse_pci_devices(orig_dn, is_devfn_node, (void *)searchval);
if (dn)
dev->sysdata = dn;
return dn;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Return code 0 - Successfully released lpfc DMA buffer (currently, always return 0) */
|
static int lpfc_els_free_bpl(struct lpfc_hba *phba, struct lpfc_dmabuf *buf_ptr)
|
/* Return code 0 - Successfully released lpfc DMA buffer (currently, always return 0) */
static int lpfc_els_free_bpl(struct lpfc_hba *phba, struct lpfc_dmabuf *buf_ptr)
|
{
lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys);
kfree(buf_ptr);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */
|
status_t HAL_CODEC_DA7212_Init(void *handle, void *config)
|
/* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */
status_t HAL_CODEC_DA7212_Init(void *handle, void *config)
|
{
assert((config != NULL) && (handle != NULL));
codec_config_t *codecConfig = (codec_config_t *)config;
da7212_config_t *da7212Config = (da7212_config_t *)(codecConfig->codecDevConfig);
da7212_handle_t *da7212Handle = (da7212_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle));
((codec_handle_t *)handle)->codecCapability = &s_da7212_capability;
return DA7212_Init(da7212Handle, da7212Config);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Enables the suspend state on the USB line. */
|
void ohci_bus_suspend(void)
|
/* Enables the suspend state on the USB line. */
void ohci_bus_suspend(void)
|
{
uint32_t temp_value;
OHCI->HcControl |= HC_CONTROL_RWE;
temp_value = OHCI->HcControl;
temp_value &= ~HC_CONTROL_HCFS;
temp_value |= HC_CONTROL_HCFS_USBSUSPEND;
OHCI->HcControl = temp_value;
OHCI->HcRhStatus = RH_HS_DRWE;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* tps65910_set_i2c_control() - Set the TPS65910 to be controlled via the I2C interface. */
|
int tps65910_set_i2c_control(void)
|
/* tps65910_set_i2c_control() - Set the TPS65910 to be controlled via the I2C interface. */
int tps65910_set_i2c_control(void)
|
{
int ret;
uchar buf;
ret = tps65910_read_reg(TPS65910_DEVCTRL_REG, &buf);
if (ret)
return ret;
buf |= TPS65910_DEVCTRL_REG_SR_CTL_I2C_SEL_CTL_I2C;
return tps65910_write_reg(TPS65910_DEVCTRL_REG, &buf);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* This function will set callback to be called when the network interface device status has been changed. */
|
void netdev_set_status_callback(struct netdev *netdev, netdev_callback_fn status_callback)
|
/* This function will set callback to be called when the network interface device status has been changed. */
void netdev_set_status_callback(struct netdev *netdev, netdev_callback_fn status_callback)
|
{
ASSERT(netdev);
ASSERT(status_callback);
netdev->status_callback = status_callback;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Writes a byte in the specific LCD RAM . */
|
void LCD_WriteRAM(LCD_RAMRegister_TypeDef LCD_RAMRegister, uint8_t LCD_Data)
|
/* Writes a byte in the specific LCD RAM . */
void LCD_WriteRAM(LCD_RAMRegister_TypeDef LCD_RAMRegister, uint8_t LCD_Data)
|
{
assert_param(IS_LCD_RAM_REGISTER(LCD_RAMRegister));
LCD->RAM[LCD_RAMRegister] = LCD_Data;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Find the ROSE device for the given address. */
|
struct net_device* rose_dev_get(rose_address *addr)
|
/* Find the ROSE device for the given address. */
struct net_device* rose_dev_get(rose_address *addr)
|
{
struct net_device *dev;
rcu_read_lock();
for_each_netdev_rcu(&init_net, dev) {
if ((dev->flags & IFF_UP) && dev->type == ARPHRD_ROSE && rosecmp(addr, (rose_address *)dev->dev_addr) == 0) {
dev_hold(dev);
goto out;
}
}
dev = NULL;
out:
rcu_read_unlock();
return dev;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Method to dissect the Init Command Request sent by the Initiator in the connection. This packet is defined by Section 2.3.1 */
|
void dissect_ptpIP_init_command_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 *offset)
|
/* Method to dissect the Init Command Request sent by the Initiator in the connection. This packet is defined by Section 2.3.1 */
void dissect_ptpIP_init_command_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 *offset)
|
{
*offset += 0;
col_set_str(
pinfo->cinfo,
COL_INFO,
"Init Command Request");
dissect_ptpIP_guid(tvb, pinfo, tree, offset);
dissect_ptpIP_unicode_name(tvb, pinfo, tree, offset);
dissect_ptpIP_protocol_version(tvb, tree, offset);
return;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Change Logs: Date Author Notes BalanceTWK add port file */
|
int w5500_spi_device_init()
|
/* Change Logs: Date Author Notes BalanceTWK add port file */
int w5500_spi_device_init()
|
{
__HAL_RCC_GPIOG_CLK_ENABLE();
return rt_hw_spi_device_attach("spi2","spi20",GET_PIN(G, 9));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If 64-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 64-bit boundary, then ASSERT(). */
|
UINT64 EFIAPI MmioWrite64(IN UINTN Address, IN UINT64 Value)
|
/* If 64-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 64-bit boundary, then ASSERT(). */
UINT64 EFIAPI MmioWrite64(IN UINTN Address, IN UINT64 Value)
|
{
CONST EFI_PEI_SERVICES **PeiServices;
EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
ASSERT (CpuIo != NULL);
ASSERT ((Address & 7) == 0);
CpuIo->MemWrite64 (PeiServices, CpuIo, (UINT64)Address, Value);
return Value;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Finish up a host controller reset and update the recorded state. */
|
static void finish_reset(struct uhci_hcd *uhci)
|
/* Finish up a host controller reset and update the recorded state. */
static void finish_reset(struct uhci_hcd *uhci)
|
{
int port;
for (port = 0; port < uhci->rh_numports; ++port)
outw(0, uhci->io_addr + USBPORTSC1 + (port * 2));
uhci->port_c_suspend = uhci->resuming_ports = 0;
uhci->rh_state = UHCI_RH_RESET;
uhci->is_stopped = UHCI_IS_STOPPED;
uhci_to_hcd(uhci)->state = HC_STATE_HALT;
uhci_to_hcd(uhci)->poll_rh = 0;
uhci->dead = 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* sys_brk() for the most part doesn't need the global kernel lock, except when an application is doing something nasty like trying to un-brk an area that has already been mapped to a regular file. in this case, the unmapping will need to invoke file system routines that need the global lock. */
|
SYSCALL_DEFINE1(brk, unsigned long, brk)
|
/* sys_brk() for the most part doesn't need the global kernel lock, except when an application is doing something nasty like trying to un-brk an area that has already been mapped to a regular file. in this case, the unmapping will need to invoke file system routines that need the global lock. */
SYSCALL_DEFINE1(brk, unsigned long, brk)
|
{
struct mm_struct *mm = current->mm;
if (brk < mm->start_brk || brk > mm->context.end_brk)
return mm->brk;
if (mm->brk == brk)
return mm->brk;
if (brk <= mm->brk) {
mm->brk = brk;
return brk;
}
flush_icache_range(mm->brk, brk);
return mm->brk = brk;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* When comes across an instruction which it cannot handle, it takes the undefined instruction trap. */
|
void rt_hw_trap_udef(struct rt_hw_exp_stack *regs)
|
/* When comes across an instruction which it cannot handle, it takes the undefined instruction trap. */
void rt_hw_trap_udef(struct rt_hw_exp_stack *regs)
|
{
rt_kprintf("undefined instruction\n");
rt_hw_show_register(regs);
if (rt_thread_self() != RT_NULL)
rt_kprintf("Current Thread: %s\n", rt_thread_self()->parent.name);
rt_hw_cpu_shutdown();
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Invoke event from I2C_SlaveTransferHandleIRQ().
Sets the event type to transfer structure and invokes the event callback, if it has been enabled by eventMask. */
|
static void I2C_SlaveInvokeEvent(I2C_Type *base, i2c_slave_handle_t *handle, i2c_slave_transfer_event_t event)
|
/* Invoke event from I2C_SlaveTransferHandleIRQ().
Sets the event type to transfer structure and invokes the event callback, if it has been enabled by eventMask. */
static void I2C_SlaveInvokeEvent(I2C_Type *base, i2c_slave_handle_t *handle, i2c_slave_transfer_event_t event)
|
{
uint32_t eventMask = handle->transfer.eventMask;
handle->transfer.event = event;
if (((handle->callback) != NULL) && ((eventMask & (uint32_t)event) != 0U))
{
handle->callback(base, &handle->transfer, handle->userData);
size_t txSize = handle->transfer.txSize;
size_t rxSize = handle->transfer.rxSize;
if (false == handle->isBusy)
{
if (((handle->transfer.txData != NULL) && (txSize != 0U)) ||
((handle->transfer.rxData != NULL) && (rxSize != 0U)))
{
handle->isBusy = true;
}
}
if ((event == kI2C_SlaveReceiveEvent) || (event == kI2C_SlaveTransmitEvent))
{
handle->transfer.transferredCount = 0;
}
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns the directory the file specified in the bootfile env variable is in. If bootfile isn't defined in the environment, return NULL, which should be interpreted as "don't prepend anything to paths". */
|
static int get_bootfile_path(const char *file_path, char *bootfile_path, size_t bootfile_path_size)
|
/* Returns the directory the file specified in the bootfile env variable is in. If bootfile isn't defined in the environment, return NULL, which should be interpreted as "don't prepend anything to paths". */
static int get_bootfile_path(const char *file_path, char *bootfile_path, size_t bootfile_path_size)
|
{
char *bootfile, *last_slash;
size_t path_len = 0;
if (file_path[0] == '/' && !is_pxe)
goto ret;
bootfile = from_env("bootfile");
if (!bootfile)
goto ret;
last_slash = strrchr(bootfile, '/');
if (!last_slash)
goto ret;
path_len = (last_slash - bootfile) + 1;
if (bootfile_path_size < path_len) {
printf("bootfile_path too small. (%zd < %zd)\n",
bootfile_path_size, path_len);
return -1;
}
strncpy(bootfile_path, bootfile, path_len);
ret:
bootfile_path[path_len] = '\0';
return 1;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Locate a capability instance in the parsed capabilities lists. */
|
RETURN_STATUS EFIAPI PciCapListFindCap(IN PCI_CAP_LIST *CapList, IN PCI_CAP_DOMAIN Domain, IN UINT16 CapId, IN UINT16 Instance, OUT PCI_CAP **Cap OPTIONAL)
|
/* Locate a capability instance in the parsed capabilities lists. */
RETURN_STATUS EFIAPI PciCapListFindCap(IN PCI_CAP_LIST *CapList, IN PCI_CAP_DOMAIN Domain, IN UINT16 CapId, IN UINT16 Instance, OUT PCI_CAP **Cap OPTIONAL)
|
{
PCI_CAP_KEY Key;
ORDERED_COLLECTION_ENTRY *PciCapEntry;
Key.Domain = Domain;
Key.CapId = CapId;
Key.Instance = Instance;
PciCapEntry = OrderedCollectionFind (CapList->Capabilities, &Key);
if (PciCapEntry == NULL) {
return RETURN_NOT_FOUND;
}
if (Cap != NULL) {
*Cap = OrderedCollectionUserStruct (PciCapEntry);
}
return RETURN_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* D8 - cfgerr D7 - dalign D6 - rip D5 - in_abort_l D4 - Always 1 D3 - Always 1 D2 - Always 1 D1 - Always 1 D0 - Done bit */
|
u32 buffer_icap_get_status(struct hwicap_drvdata *drvdata)
|
/* D8 - cfgerr D7 - dalign D6 - rip D5 - in_abort_l D4 - Always 1 D3 - Always 1 D2 - Always 1 D1 - Always 1 D0 - Done bit */
u32 buffer_icap_get_status(struct hwicap_drvdata *drvdata)
|
{
return in_be32(drvdata->base_address + XHI_STATUS_REG_OFFSET);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* When we and the controller are through with a QH, it becomes IDLE. This happens when a QH has been off the schedule (on the unlinking list) for more than one frame, or when an error occurs while adding the first URB onto a new QH. */
|
static void uhci_make_qh_idle(struct uhci_hcd *uhci, struct uhci_qh *qh)
|
/* When we and the controller are through with a QH, it becomes IDLE. This happens when a QH has been off the schedule (on the unlinking list) for more than one frame, or when an error occurs while adding the first URB onto a new QH. */
static void uhci_make_qh_idle(struct uhci_hcd *uhci, struct uhci_qh *qh)
|
{
WARN_ON(qh->state == QH_STATE_ACTIVE);
if (qh == uhci->next_qh)
uhci->next_qh = list_entry(qh->node.next, struct uhci_qh,
node);
list_move(&qh->node, &uhci->idle_qh_list);
qh->state = QH_STATE_IDLE;
if (qh->post_td) {
uhci_free_td(uhci, qh->post_td);
qh->post_td = NULL;
}
if (uhci->num_waiting)
wake_up_all(&uhci->waitqh);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns preferred place for a block (the goal). */
|
static ext2_fsblk_t ext2_find_goal(struct inode *inode, long block, Indirect *partial)
|
/* Returns preferred place for a block (the goal). */
static ext2_fsblk_t ext2_find_goal(struct inode *inode, long block, Indirect *partial)
|
{
struct ext2_block_alloc_info *block_i;
block_i = EXT2_I(inode)->i_block_alloc_info;
if (block_i && (block == block_i->last_alloc_logical_block + 1)
&& (block_i->last_alloc_physical_block != 0)) {
return block_i->last_alloc_physical_block + 1;
}
return ext2_find_near(inode, partial);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The callback is called when the state of the reservation changes from: */
|
struct uwb_rsv* uwb_rsv_create(struct uwb_rc *rc, uwb_rsv_cb_f cb, void *pal_priv)
|
/* The callback is called when the state of the reservation changes from: */
struct uwb_rsv* uwb_rsv_create(struct uwb_rc *rc, uwb_rsv_cb_f cb, void *pal_priv)
|
{
struct uwb_rsv *rsv;
rsv = uwb_rsv_alloc(rc);
if (!rsv)
return NULL;
rsv->callback = cb;
rsv->pal_priv = pal_priv;
return rsv;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* TIM2 MSP Initialization This function configures the hardware resources used in this example: */
|
void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim)
|
/* TIM2 MSP Initialization This function configures the hardware resources used in this example: */
void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim)
|
{
GPIO_InitTypeDef GPIO_InitStruct;
if(htim->Instance==TIM2)
{
__HAL_RCC_TIM2_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF1_TIM2;
GPIO_InitStruct.Pin = GPIO_PIN_0;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* This function sets the value of the PHY registers through the MII interface. */
|
int imx_enet_mii_write(volatile hw_enet_t *enet_reg, unsigned char phy_addr, unsigned char reg_addr, unsigned short int value)
|
/* This function sets the value of the PHY registers through the MII interface. */
int imx_enet_mii_write(volatile hw_enet_t *enet_reg, unsigned char phy_addr, unsigned char reg_addr, unsigned short int value)
|
{
unsigned long waiting = ENET_MII_TIMEOUT;
if (enet_reg->EIR.U & ENET_EVENT_MII) {
enet_reg->EIR.U = ENET_EVENT_MII;
}
enet_reg->MMFR.U = ENET_MII_WRITE(phy_addr, reg_addr, value);
while (1) {
if (enet_reg->EIR.U & ENET_EVENT_MII) {
enet_reg->EIR.U = ENET_EVENT_MII;
break;
}
if ((--waiting) == 0)
return -1;
hal_delay_us(ENET_MII_TICK);
}
return 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Parameter: card = pointer to card struct. ch = channel (0-based). */
|
static void isdnloop_kill_ctimer(isdnloop_card *card, int ch)
|
/* Parameter: card = pointer to card struct. ch = channel (0-based). */
static void isdnloop_kill_ctimer(isdnloop_card *card, int ch)
|
{
unsigned long flags;
spin_lock_irqsave(&card->isdnloop_lock, flags);
del_timer(&card->c_timer[ch]);
spin_unlock_irqrestore(&card->isdnloop_lock, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Configures the External High Speed oscillator (HSE). HSE can not be stopped if it is used directly or through the PLL as system clock. */
|
void RCC_HSEConfig(uint32_t RCC_HSE)
|
/* Configures the External High Speed oscillator (HSE). HSE can not be stopped if it is used directly or through the PLL as system clock. */
void RCC_HSEConfig(uint32_t RCC_HSE)
|
{
assert_param(IS_RCC_HSE(RCC_HSE));
RCC->CR &= CR_HSEON_Reset;
RCC->CR &= CR_HSEBYP_Reset;
switch(RCC_HSE)
{
case RCC_HSE_ON:
RCC->CR |= CR_HSEON_Set;
break;
case RCC_HSE_Bypass:
RCC->CR |= CR_HSEBYP_Set | CR_HSEON_Set;
break;
default:
break;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This routine stops all the timers associated with a HBA. This function is invoked before either putting a HBA offline or unloading the driver. */
|
void lpfc_stop_hba_timers(struct lpfc_hba *phba)
|
/* This routine stops all the timers associated with a HBA. This function is invoked before either putting a HBA offline or unloading the driver. */
void lpfc_stop_hba_timers(struct lpfc_hba *phba)
|
{
lpfc_stop_vport_timers(phba->pport);
del_timer_sync(&phba->sli.mbox_tmo);
del_timer_sync(&phba->fabric_block_timer);
del_timer_sync(&phba->eratt_poll);
del_timer_sync(&phba->hb_tmofunc);
phba->hb_outstanding = 0;
switch (phba->pci_dev_grp) {
case LPFC_PCI_DEV_LP:
del_timer_sync(&phba->fcp_poll_timer);
break;
case LPFC_PCI_DEV_OC:
break;
default:
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"0297 Invalid device group (x%x)\n",
phba->pci_dev_grp);
break;
}
return;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.