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
|
|---|---|---|---|---|---|---|---|
/* Map the user space address into a bio suitable for io to a block device. Returns an error pointer in case of error. */
|
struct bio* bio_map_user_iov(struct request_queue *q, struct block_device *bdev, struct sg_iovec *iov, int iov_count, int write_to_vm, gfp_t gfp_mask)
|
/* Map the user space address into a bio suitable for io to a block device. Returns an error pointer in case of error. */
struct bio* bio_map_user_iov(struct request_queue *q, struct block_device *bdev, struct sg_iovec *iov, int iov_count, int write_to_vm, gfp_t gfp_mask)
|
{
struct bio *bio;
bio = __bio_map_user_iov(q, bdev, iov, iov_count, write_to_vm,
gfp_mask);
if (IS_ERR(bio))
return bio;
bio_get(bio);
return bio;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* USB_OTG_DisableGlobalInt Enables the controller's Global Int in the AHB Config reg. */
|
USB_OTG_STS USB_OTG_DisableGlobalInt(USB_OTG_CORE_HANDLE *pdev)
|
/* USB_OTG_DisableGlobalInt Enables the controller's Global Int in the AHB Config reg. */
USB_OTG_STS USB_OTG_DisableGlobalInt(USB_OTG_CORE_HANDLE *pdev)
|
{
USB_OTG_STS status = USB_OTG_OK;
USB_OTG_GAHBCFG_TypeDef ahbcfg;
ahbcfg.d32 = 0;
ahbcfg.b.glblintrmsk = 1;
USB_OTG_MODIFY_REG32(&pdev->regs.GREGS->GAHBCFG, ahbcfg.d32, 0);
return status;
}
|
MaJerle/stm32f429
|
C++
| null | 2,036
|
/* Reload the watchdog timer. (ie, pat the watchdog) */
|
static void at91_wdt_reload(void)
|
/* Reload the watchdog timer. (ie, pat the watchdog) */
static void at91_wdt_reload(void)
|
{
at91_sys_write(AT91_ST_CR, AT91_ST_WDRST);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* destroy_done_tree - destroy the done tree. @done_tree: done tree to destroy */
|
static void destroy_done_tree(struct rb_root *done_tree)
|
/* destroy_done_tree - destroy the done tree. @done_tree: done tree to destroy */
static void destroy_done_tree(struct rb_root *done_tree)
|
{
struct rb_node *this = done_tree->rb_node;
struct done_ref *dr;
while (this) {
if (this->rb_left) {
this = this->rb_left;
continue;
} else if (this->rb_right) {
this = this->rb_right;
continue;
}
dr = rb_entry(this, struct done_ref, rb);
this = rb_parent(this);
if (this) {
if (this->rb_left == &dr->rb)
this->rb_left = NULL;
else
this->rb_right = NULL;
}
kfree(dr);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
|
EFI_STATUS EFIAPI Ps2MouseComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
|
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI Ps2MouseComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
|
{
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mPs2MouseDriverNameTable,
DriverName,
(BOOLEAN)(This == &gPs2MouseComponentName)
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Submit IO for the read-ahead request in file_ra_state. */
|
unsigned long ra_submit(struct file_ra_state *ra, struct address_space *mapping, struct file *filp)
|
/* Submit IO for the read-ahead request in file_ra_state. */
unsigned long ra_submit(struct file_ra_state *ra, struct address_space *mapping, struct file *filp)
|
{
int actual;
actual = __do_page_cache_readahead(mapping, filp,
ra->start, ra->size, ra->async_size);
return actual;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* LTDC MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc)
|
/* LTDC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc)
|
{
if(hltdc->Instance==LTDC)
{
__HAL_RCC_LTDC_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOK, GPIO_PIN_5|GPIO_PIN_4|GPIO_PIN_6|GPIO_PIN_3
|GPIO_PIN_7|GPIO_PIN_2|GPIO_PIN_0|GPIO_PIN_1);
HAL_GPIO_DeInit(GPIOJ, GPIO_PIN_15|GPIO_PIN_14|GPIO_PIN_12|GPIO_PIN_13
|GPIO_PIN_11|GPIO_PIN_10|GPIO_PIN_9|GPIO_PIN_0
|GPIO_PIN_8|GPIO_PIN_7|GPIO_PIN_6|GPIO_PIN_1
|GPIO_PIN_5|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4);
HAL_GPIO_DeInit(GPIOI, GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Function definition: ixFeatureCtrlSwConfigurationInit This function will only initialize software configuration once. */
|
PRIVATE void ixFeatureCtrlSwConfigurationInit(void)
|
/* Function definition: ixFeatureCtrlSwConfigurationInit This function will only initialize software configuration once. */
PRIVATE void ixFeatureCtrlSwConfigurationInit(void)
|
{
UINT32 i;
if (FALSE == swConfigurationFlag)
{
for (i=0; i<IX_FEATURECTRL_SWCONFIG_MAX ; i++)
{
swConfiguration[i]= TRUE ;
}
swConfigurationFlag = TRUE ;
}
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Converts a device path to its text representation. */
|
CHAR16* EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
|
/* Converts a device path to its text representation. */
CHAR16* EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
|
{
if (mDevicePathLibDevicePathToText == NULL) {
mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid);
}
if (mDevicePathLibDevicePathToText != NULL) {
return mDevicePathLibDevicePathToText->ConvertDevicePathToText (DevicePath, DisplayOnly, AllowShortcuts);
} else {
return NULL;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* The function is used to delete a JSON key from the given JSON bject */
|
EFI_STATUS EFIAPI JsonObjectDelete(IN EDKII_JSON_OBJECT JsonObj, IN CONST CHAR8 *Key)
|
/* The function is used to delete a JSON key from the given JSON bject */
EFI_STATUS EFIAPI JsonObjectDelete(IN EDKII_JSON_OBJECT JsonObj, IN CONST CHAR8 *Key)
|
{
if (json_object_del ((json_t *)JsonObj, (const char *)Key) != 0) {
return EFI_ABORTED;
} else {
return EFI_SUCCESS;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function delivers the datagrams enqueued in the instances. */
|
VOID Udp6DeliverDgram(IN UDP6_SERVICE_DATA *Udp6Service)
|
/* This function delivers the datagrams enqueued in the instances. */
VOID Udp6DeliverDgram(IN UDP6_SERVICE_DATA *Udp6Service)
|
{
LIST_ENTRY *Entry;
UDP6_INSTANCE_DATA *Instance;
NET_LIST_FOR_EACH (Entry, &Udp6Service->ChildrenList) {
Instance = NET_LIST_USER_STRUCT (Entry, UDP6_INSTANCE_DATA, Link);
if (!Instance->Configured) {
continue;
}
Udp6InstanceDeliverDgram (Instance);
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function restores the chip and board muxing to point to the DIU. */
|
static void set_mux_to_diu(void)
|
/* This function restores the chip and board muxing to point to the DIU. */
static void set_mux_to_diu(void)
|
{
ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
set_lbc_br(0, new_br0);
set_lbc_or(0, new_or0);
set_lbc_br(1, new_br1);
set_lbc_or(1, new_or1);
setbits_8(&pixis->csr, PX_CTL_ALTACC);
out_8(lbc_lcs0_ba, offsetof(ngpixis_t, brdcfg0));
out_8(lbc_lcs1_ba, px_brdcfg0 | PX_BRDCFG0_ELBC_DIU);
in_8(lbc_lcs1_ba);
out_be32(&gur->pmuxcr, pmuxcr);
in_be32(&gur->pmuxcr);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* compute_large_page_descs() computes how many additional descriptors are required to break down the stack's request. */
|
static unsigned int compute_large_page_tx_descs(struct sk_buff *skb)
|
/* compute_large_page_descs() computes how many additional descriptors are required to break down the stack's request. */
static unsigned int compute_large_page_tx_descs(struct sk_buff *skb)
|
{
unsigned int count = 0;
if (PAGE_SIZE > SGE_TX_DESC_MAX_PLEN) {
unsigned int nfrags = skb_shinfo(skb)->nr_frags;
unsigned int i, len = skb->len - skb->data_len;
while (len > SGE_TX_DESC_MAX_PLEN) {
count++;
len -= SGE_TX_DESC_MAX_PLEN;
}
for (i = 0; nfrags--; i++) {
skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
len = frag->size;
while (len > SGE_TX_DESC_MAX_PLEN) {
count++;
len -= SGE_TX_DESC_MAX_PLEN;
}
}
}
return count;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns: a new #GDesktopAppInfo, or NULL if no desktop file with that id */
|
GDesktopAppInfo* g_desktop_app_info_new(const char *desktop_id)
|
/* Returns: a new #GDesktopAppInfo, or NULL if no desktop file with that id */
GDesktopAppInfo* g_desktop_app_info_new(const char *desktop_id)
|
{
GDesktopAppInfo *appinfo = NULL;
guint i;
desktop_file_dirs_lock ();
for (i = 0; i < n_desktop_file_dirs; i++)
{
appinfo = desktop_file_dir_get_app (&desktop_file_dirs[i], desktop_id);
if (appinfo)
break;
}
desktop_file_dirs_unlock ();
if (appinfo == NULL)
return NULL;
g_free (appinfo->desktop_id);
appinfo->desktop_id = g_strdup (desktop_id);
if (g_desktop_app_info_get_is_hidden (appinfo))
{
g_object_unref (appinfo);
appinfo = NULL;
}
return appinfo;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Disable reverse output data.
Disables the reversal of the bit order of the output data. */
|
void crc_reverse_output_disable()
|
/* Disable reverse output data.
Disables the reversal of the bit order of the output data. */
void crc_reverse_output_disable()
|
{
CRC_CR &= ~CRC_CR_REV_OUT;
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* Calculate a hash key using a fast hash function that works well for low hash table fill. */
|
static unsigned long xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed)
|
/* Calculate a hash key using a fast hash function that works well for low hash table fill. */
static unsigned long xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed)
|
{
value += name[namelen - 1];
namelen = 10;
}
switch (namelen) {
case 10: value += name[9];
case 9: value += name[8];
case 8: value += name[7];
case 7: value += name[6];
case 6: value += name[5];
case 5: value += name[4];
case 4: value += name[3];
case 3: value += name[2];
case 2: value += name[1];
default: break;
}
return(value);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Enable time stamp snapshot for PTP over Ethernet frames. When enabled, time stamp snapshot is taken for PTP over Ethernet frames Reserved when "Advanced Time Stamp" is not selected */
|
void synopGMAC_TS_ptp_over_ethernet_enable(synopGMACdevice *gmacdev)
|
/* Enable time stamp snapshot for PTP over Ethernet frames. When enabled, time stamp snapshot is taken for PTP over Ethernet frames Reserved when "Advanced Time Stamp" is not selected */
void synopGMAC_TS_ptp_over_ethernet_enable(synopGMACdevice *gmacdev)
|
{
synopGMACSetBits(gmacdev->MacBase, GmacTSControl, GmacTSIPENA);
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The functions for inserting/removing us as a module. */
|
static int __init elo_init(void)
|
/* The functions for inserting/removing us as a module. */
static int __init elo_init(void)
|
{
return serio_register_driver(&elo_drv);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function is used to unlock the temper control registers. This function should be only used before calling API */
|
void HibernateTamperUnLock(void)
|
/* This function is used to unlock the temper control registers. This function should be only used before calling API */
void HibernateTamperUnLock(void)
|
{
HWREG(HIB_LOCK) = HIB_LOCK_HIBLOCK_KEY;
_HibernateWriteComplete();
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The value to return to flash_page_foreach() is stored in "bail_value" if the callback should exit early. */
|
static bool should_bail(const struct flash_pages_info *info, struct layout_data *data, bool *bail_value)
|
/* The value to return to flash_page_foreach() is stored in "bail_value" if the callback should exit early. */
static bool should_bail(const struct flash_pages_info *info, struct layout_data *data, bool *bail_value)
|
{
if (info->start_offset < data->area_off) {
*bail_value = true;
return true;
} else if (info->start_offset >= data->area_off + data->area_len) {
*bail_value = false;
return true;
} else if (data->ret_idx >= data->ret_len) {
data->status = -ENOMEM;
*bail_value = false;
return true;
}
return false;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Writes more than one byte to the M24Cxx with a single WRITE cycle. */
|
void M24CxxPageWrite(unsigned char *pucBuffer, unsigned short usWriteAddr, unsigned char ucNumByteToWrite)
|
/* Writes more than one byte to the M24Cxx with a single WRITE cycle. */
void M24CxxPageWrite(unsigned char *pucBuffer, unsigned short usWriteAddr, unsigned char ucNumByteToWrite)
|
{
xI2CMasterWriteS1(M24Cxx_PIN_I2C_PORT, M24Cxx_ADDRESS,
(unsigned char)((usWriteAddr & 0xFF00) >> 8),
xfalse);
xI2CMasterWriteS2(M24Cxx_PIN_I2C_PORT,
(unsigned char)(usWriteAddr & 0x00FF),
xfalse);
while(ucNumByteToWrite--)
{
if(ucNumByteToWrite == 0)
{
xI2CMasterWriteS2(M24Cxx_PIN_I2C_PORT, *pucBuffer, xtrue);
} else
{
xI2CMasterWriteS2(M24Cxx_PIN_I2C_PORT, *pucBuffer, xfalse);
pucBuffer++;
}
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
|
RETURN_STATUS EFIAPI SafeInt8ToUint16(IN INT8 Operand, OUT UINT16 *Result)
|
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeInt8ToUint16(IN INT8 Operand, OUT UINT16 *Result)
|
{
RETURN_STATUS Status;
if (Result == NULL) {
return RETURN_INVALID_PARAMETER;
}
if (Operand >= 0) {
*Result = (UINT16)Operand;
Status = RETURN_SUCCESS;
} else {
*Result = UINT16_ERROR;
Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* The response to a brown out on the VDD rail is set by using one of the following values: */
|
void SysCtlVoltageEventConfig(uint32_t ui32Config)
|
/* The response to a brown out on the VDD rail is set by using one of the following values: */
void SysCtlVoltageEventConfig(uint32_t ui32Config)
|
{
HWREG(SYSCTL_PTBOCTL) = ui32Config;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Change Logs: Date Author Notes Bernard The first version */
|
int main(void)
|
/* Change Logs: Date Author Notes Bernard The first version */
int main(void)
|
{
rt_kprintf("Hello, world\n");
return 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Lookup neighbour table by name and optional interface index */
|
struct rtnl_neightbl* rtnl_neightbl_get(struct nl_cache *cache, const char *name, int ifindex)
|
/* Lookup neighbour table by name and optional interface index */
struct rtnl_neightbl* rtnl_neightbl_get(struct nl_cache *cache, const char *name, int ifindex)
|
{
struct rtnl_neightbl *nt;
if (cache->c_ops != &rtnl_neightbl_ops)
return NULL;
nl_list_for_each_entry(nt, &cache->c_items, ce_list) {
if (!strcasecmp(nt->nt_name, name) &&
((!ifindex && !nt->nt_parms.ntp_ifindex) ||
(ifindex && ifindex == nt->nt_parms.ntp_ifindex))) {
nl_object_get((struct nl_object *) nt);
return nt;
}
}
return NULL;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Checks the unique counts of other tasks to ensure they are still operational. Returns pdTRUE if an error is detected, otherwise pdFALSE. */
|
static char prvCheckOtherTasksAreStillRunning(void)
|
/* Checks the unique counts of other tasks to ensure they are still operational. Returns pdTRUE if an error is detected, otherwise pdFALSE. */
static char prvCheckOtherTasksAreStillRunning(void)
|
{
char cErrorHasOccurred = ( char ) pdFALSE;
if( xIsCreateTaskStillRunning() != pdTRUE )
{
cErrorHasOccurred = ( char ) pdTRUE;
}
return cErrorHasOccurred;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* We do this unlocked - we only need to know whether there is anything in the AIL at the time we are called. We don't need to access the contents of any of the objects, so the lock is not needed. */
|
void xfs_trans_ail_push(struct xfs_ail *ailp, xfs_lsn_t threshold_lsn)
|
/* We do this unlocked - we only need to know whether there is anything in the AIL at the time we are called. We don't need to access the contents of any of the objects, so the lock is not needed. */
void xfs_trans_ail_push(struct xfs_ail *ailp, xfs_lsn_t threshold_lsn)
|
{
xfs_log_item_t *lip;
lip = xfs_ail_min(ailp);
if (lip && !XFS_FORCED_SHUTDOWN(ailp->xa_mount)) {
if (XFS_LSN_CMP(threshold_lsn, ailp->xa_target) > 0)
xfsaild_wakeup(ailp, threshold_lsn);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Connects to a data source. This driver provides two ways to connect to a data source: (1) giving the connection parameters as a set of pairs separated by whitespaces in a string (first method parameter) (2) giving one string for each connection parameter, said datasource, username, password, host and port. */
|
static int env_connect(lua_State *L)
|
/* Connects to a data source. This driver provides two ways to connect to a data source: (1) giving the connection parameters as a set of pairs separated by whitespaces in a string (first method parameter) (2) giving one string for each connection parameter, said datasource, username, password, host and port. */
static int env_connect(lua_State *L)
|
{
const char *username = luaL_optstring(L, 3, NULL);
const char *password = luaL_optstring(L, 4, NULL);
const char *pghost = luaL_optstring(L, 5, NULL);
const char *pgport = luaL_optstring(L, 6, NULL);
conn = PQsetdbLogin(pghost, pgport, NULL, NULL,
sourcename, username, password);
}
if (PQstatus(conn) == CONNECTION_BAD)
return luasql_faildirect(L, LUASQL_PREFIX"Error connecting to database.");
PQsetNoticeProcessor(conn, notice_processor, NULL);
return create_connection(L, 1, conn);
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* Called by regulator drivers to notify clients a regulator event has occurred. We also notify regulator clients downstream. Note lock must be held by caller. */
|
int regulator_notifier_call_chain(struct regulator_dev *rdev, unsigned long event, void *data)
|
/* Called by regulator drivers to notify clients a regulator event has occurred. We also notify regulator clients downstream. Note lock must be held by caller. */
int regulator_notifier_call_chain(struct regulator_dev *rdev, unsigned long event, void *data)
|
{
_notifier_call_chain(rdev, event, data);
return NOTIFY_DONE;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function is derived from PowerPC code (timebase clock frequency). On ARM it returns the number of timer ticks per second. */
|
ulong get_tbclk(void)
|
/* This function is derived from PowerPC code (timebase clock frequency). On ARM it returns the number of timer ticks per second. */
ulong get_tbclk(void)
|
{
return clock_get(CLOCK_SYSTICK);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Returns : OK if set trigger type succeeded, others if failed. */
|
s32 interrupt_set_nmi_trigger(u32 type)
|
/* Returns : OK if set trigger type succeeded, others if failed. */
s32 interrupt_set_nmi_trigger(u32 type)
|
{
u32 value;
pintc_regs->control = type;
value = pintc_regs->mask;
value |= 0x1;
pintc_regs->mask = value;
return OK;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* DMAMUX Get DMA Request Synchronization Overrun Interrupt Flag.
Get DMA Request Synchronization Overrun Interrupt for given DMA channel */
|
uint32_t dmamux_get_dma_request_sync_overrun(uint32_t dmamux, uint8_t channel)
|
/* DMAMUX Get DMA Request Synchronization Overrun Interrupt Flag.
Get DMA Request Synchronization Overrun Interrupt for given DMA channel */
uint32_t dmamux_get_dma_request_sync_overrun(uint32_t dmamux, uint8_t channel)
|
{
return DMAMUX_CSR(dmamux) & DMAMUX_CSR_SOF(channel);
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* Configures the I2C slave own address 2 and mask. */
|
void I2C_OwnAddress2Config(I2C_TypeDef *I2Cx, uint16_t Address, uint8_t Mask)
|
/* Configures the I2C slave own address 2 and mask. */
void I2C_OwnAddress2Config(I2C_TypeDef *I2Cx, uint16_t Address, uint8_t Mask)
|
{
uint32_t tmpreg = 0;
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
assert_param(IS_I2C_OWN_ADDRESS2(Address));
assert_param(IS_I2C_OWN_ADDRESS2_MASK(Mask));
tmpreg = I2Cx->OAR2;
tmpreg &= (uint32_t)~((uint32_t)(I2C_OAR2_OA2 | I2C_OAR2_OA2MSK));
tmpreg |= (uint32_t)(((uint32_t)Address & I2C_OAR2_OA2) | \
(((uint32_t)Mask << 8) & I2C_OAR2_OA2MSK)) ;
I2Cx->OAR2 = tmpreg;
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* Configures the MMC to rollover. Programs MMC interface so that counters will rollover after reaching maximum value. */
|
void synopGMAC_mmc_counters_enable_rollover(synopGMACdevice *gmacdev)
|
/* Configures the MMC to rollover. Programs MMC interface so that counters will rollover after reaching maximum value. */
void synopGMAC_mmc_counters_enable_rollover(synopGMACdevice *gmacdev)
|
{
synopGMACClearBits(gmacdev->MacBase, GmacMmcCntrl, GmacMmcCounterStopRollover);
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function is called during kernel startup to initialize the mvme16x IRQ handling routines. Should probably ensure that the base vectors for the VMEChip2 and PCCChip2 are valid. */
|
static void __init mvme16x_init_IRQ(void)
|
/* This function is called during kernel startup to initialize the mvme16x IRQ handling routines. Should probably ensure that the base vectors for the VMEChip2 and PCCChip2 are valid. */
static void __init mvme16x_init_IRQ(void)
|
{
m68k_setup_user_interrupt(VEC_USER, 192, NULL);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Returns: address of the node list if found NULL target not found */
|
static struct lpfc_nodelist* lpfc_get_node_by_target(struct scsi_target *starget)
|
/* Returns: address of the node list if found NULL target not found */
static struct lpfc_nodelist* lpfc_get_node_by_target(struct scsi_target *starget)
|
{
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
struct lpfc_nodelist *ndlp;
spin_lock_irq(shost->host_lock);
list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
if (NLP_CHK_NODE_ACT(ndlp) &&
ndlp->nlp_state == NLP_STE_MAPPED_NODE &&
starget->id == ndlp->nlp_sid) {
spin_unlock_irq(shost->host_lock);
return ndlp;
}
}
spin_unlock_irq(shost->host_lock);
return NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Detemine USI-SPI Receive FIFO is empty or not. */
|
u32 USI_SSI_Readable(USI_TypeDef *usi_dev)
|
/* Detemine USI-SPI Receive FIFO is empty or not. */
u32 USI_SSI_Readable(USI_TypeDef *usi_dev)
|
{
u32 Status = USI_SSI_GetRxFIFOStatus(usi_dev);
u32 Readable = (((Status & USI_RXFIFO_EMPTY) == 0) ? 1 : 0);
return Readable;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Return: 0 if all went well, else returns appropriate error value. */
|
static int ti_sci_cmd_set_board_config(const struct ti_sci_handle *handle, u64 addr, u32 size)
|
/* Return: 0 if all went well, else returns appropriate error value. */
static int ti_sci_cmd_set_board_config(const struct ti_sci_handle *handle, u64 addr, u32 size)
|
{
return cmd_set_board_config_using_msg(handle,
TI_SCI_MSG_BOARD_CONFIG,
addr, size);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Such as: Update console variable; Register new Driver#### or Boot####; Signal ReadyToLock event. */
|
VOID EFIAPI PlatformBootManagerBeforeConsole(VOID)
|
/* Such as: Update console variable; Register new Driver#### or Boot####; Signal ReadyToLock event. */
VOID EFIAPI PlatformBootManagerBeforeConsole(VOID)
|
{
EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Convert Memory and Peripheral to source and destination. */
|
unsigned long DMAPTOM(unsigned long ulControl)
|
/* Convert Memory and Peripheral to source and destination. */
unsigned long DMAPTOM(unsigned long ulControl)
|
{
unsigned long ulTemp;
ulTemp = ulControl & 0xFFFFF03F;
ulTemp |= ((ulControl & 0x300) << 2);
ulTemp |= ((ulControl & 0x040) << 1);
ulTemp |= ((ulControl & 0xC00) >> 2);
ulTemp |= ((ulControl & 0x080) >> 1);
return ulTemp;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* On HPA drives the capacity needs to be reinitilized on resume otherwise the disk can not be used and a hard reset is required */
|
static void ide_gd_resume(ide_drive_t *drive)
|
/* On HPA drives the capacity needs to be reinitilized on resume otherwise the disk can not be used and a hard reset is required */
static void ide_gd_resume(ide_drive_t *drive)
|
{
if (ata_id_hpa_enabled(drive->id))
(void)drive->disk_ops->get_capacity(drive);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* pdc2027x_port_enabled - Check PDC ATA control register to see whether the port is enabled. @ap: Port to check */
|
static int pdc2027x_port_enabled(struct ata_port *ap)
|
/* pdc2027x_port_enabled - Check PDC ATA control register to see whether the port is enabled. @ap: Port to check */
static int pdc2027x_port_enabled(struct ata_port *ap)
|
{
return ioread8(port_mmio(ap, PDC_ATA_CTL)) & 0x02;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function wraps EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.Pci.Read() service. It reads and returns the PCI configuration register specified by Address, the width of data is specified by Width. */
|
UINT32 DxePciLibPciRootBridgeIoReadWorker(IN UINTN Address, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width)
|
/* This function wraps EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.Pci.Read() service. It reads and returns the PCI configuration register specified by Address, the width of data is specified by Width. */
UINT32 DxePciLibPciRootBridgeIoReadWorker(IN UINTN Address, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width)
|
{
UINT32 Data;
mPciRootBridgeIo->Pci.Read (
mPciRootBridgeIo,
Width,
PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS (Address),
1,
&Data
);
return Data;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* When a retprobed function returns, trampoline_handler() is called, calling the kretprobe's handler. We construct a struct pt_regs to give a view of registers r0-r11 to the user return-handler. This is not a complete pt_regs structure, but that should be plenty sufficient for kretprobe handlers which should normally be interested in r0 only anyway. */
|
void __naked __kprobes kretprobe_trampoline(void)
|
/* When a retprobed function returns, trampoline_handler() is called, calling the kretprobe's handler. We construct a struct pt_regs to give a view of registers r0-r11 to the user return-handler. This is not a complete pt_regs structure, but that should be plenty sufficient for kretprobe handlers which should normally be interested in r0 only anyway. */
void __naked __kprobes kretprobe_trampoline(void)
|
{
__asm__ __volatile__ (
"stmdb sp!, {r0 - r11} \n\t"
"mov r0, sp \n\t"
"bl trampoline_handler \n\t"
"mov lr, r0 \n\t"
"ldmia sp!, {r0 - r11} \n\t"
"mov pc, lr \n\t"
: : : "memory");
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely. */
|
static void print_devices(int iscapture)
|
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely. */
static void print_devices(int iscapture)
|
{
const char *typestr = ((iscapture) ? "capture" : "output");
int n = SDL_GetNumAudioDevices(iscapture);
SDL_Log("Found %d %s device%s:\n", n, typestr, n != 1 ? "s" : "");
if (n == -1)
SDL_Log(" Driver can't detect specific %s devices.\n\n", typestr);
else if (n == 0)
SDL_Log(" No %s devices found.\n\n", typestr);
else {
int i;
for (i = 0; i < n; i++) {
const char *name = SDL_GetAudioDeviceName(i, iscapture);
if (name != NULL)
SDL_Log(" %d: %s\n", i, name);
else
SDL_Log(" %d Error: %s\n", i, SDL_GetError());
}
SDL_Log("\n");
}
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Delete a semaphore that was created by osSemaphoreCreate. */
|
osStatus_t osSemaphoreDelete(osSemaphoreId_t semaphore_id)
|
/* Delete a semaphore that was created by osSemaphoreCreate. */
osStatus_t osSemaphoreDelete(osSemaphoreId_t semaphore_id)
|
{
struct cv2_sem *semaphore = (struct cv2_sem *)semaphore_id;
if (semaphore_id == NULL) {
return osErrorParameter;
}
if (k_is_in_isr()) {
return osErrorISR;
}
k_mem_slab_free(&cv2_semaphore_slab, (void *)semaphore);
return osOK;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* This function gets the serial clock rate for the IIC device. The device must be idle rather than busy transferring data before setting these device options. */
|
u32 XIicPs_GetSClk(XIicPs *InstancePtr)
|
/* This function gets the serial clock rate for the IIC device. The device must be idle rather than busy transferring data before setting these device options. */
u32 XIicPs_GetSClk(XIicPs *InstancePtr)
|
{
u32 ControlReg;
u32 ActualFscl;
u32 Div_a;
u32 Div_b;
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == (u32)XIL_COMPONENT_IS_READY);
ControlReg = XIicPs_ReadReg(InstancePtr->Config.BaseAddress,
XIICPS_CR_OFFSET);
Div_a = (ControlReg & XIICPS_CR_DIV_A_MASK) >> XIICPS_CR_DIV_A_SHIFT;
Div_b = (ControlReg & XIICPS_CR_DIV_B_MASK) >> XIICPS_CR_DIV_B_SHIFT;
ActualFscl = (InstancePtr->Config.InputClockHz) /
(22U * (Div_a + 1U) * (Div_b + 1U));
return ActualFscl;
}
/** @}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* Enables SIR (IrDA) mode on the specified UART. */
|
void UARTEnableSIR(uint32_t ui32Base, bool bLowPower)
|
/* Enables SIR (IrDA) mode on the specified UART. */
void UARTEnableSIR(uint32_t ui32Base, bool bLowPower)
|
{
ASSERT(_UARTBaseValid(ui32Base));
if (bLowPower)
{
HWREG(ui32Base + UART_O_CTL) |= (UART_CTL_SIREN | UART_CTL_SIRLP);
}
else
{
HWREG(ui32Base + UART_O_CTL) |= (UART_CTL_SIREN);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Determine the number of SCBs available on the controller */
|
static int ahd_probe_scbs(struct ahd_softc *ahd)
|
/* Determine the number of SCBs available on the controller */
static int ahd_probe_scbs(struct ahd_softc *ahd)
|
{
int j;
ahd_set_scbptr(ahd, i);
ahd_outw(ahd, SCB_BASE, i);
for (j = 2; j < 64; j++)
ahd_outb(ahd, SCB_BASE+j, 0);
ahd_outb(ahd, SCB_CONTROL, MK_MESSAGE);
if (ahd_inw_scbram(ahd, SCB_BASE) != i)
break;
ahd_set_scbptr(ahd, 0);
if (ahd_inw_scbram(ahd, SCB_BASE) != 0)
break;
}
return (i);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Reads N bytes from the mailbox registers, starting at the specified I2C address. */
|
int32_t ST25DV_ReadMailboxRegister(ST25DV_Object_t *pObj, uint8_t *const pData, const uint16_t TarAddr, const uint16_t NbByte)
|
/* Reads N bytes from the mailbox registers, starting at the specified I2C address. */
int32_t ST25DV_ReadMailboxRegister(ST25DV_Object_t *pObj, uint8_t *const pData, const uint16_t TarAddr, const uint16_t NbByte)
|
{
int32_t status = ST25DV_ERROR;
if( (TarAddr >= ST25DV_GPO_DYN_REG) && (TarAddr <= ST25DV_MBLEN_DYN_REG) )
{
status = pObj->IO.Read( ST25DV_ADDR_DATA_I2C, TarAddr,pData, NbByte);
}
return status;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* On devices supporting extended PWM fault handling, the state the affected output pins are driven to can be configured with */
|
void PWMOutputFault(uint32_t ui32Base, uint32_t ui32PWMOutBits, bool bFaultSuppress)
|
/* On devices supporting extended PWM fault handling, the state the affected output pins are driven to can be configured with */
void PWMOutputFault(uint32_t ui32Base, uint32_t ui32PWMOutBits, bool bFaultSuppress)
|
{
ASSERT((ui32Base == PWM0_BASE) || (ui32Base == PWM1_BASE));
ASSERT(!(ui32PWMOutBits & ~(PWM_OUT_0_BIT | PWM_OUT_1_BIT | PWM_OUT_2_BIT |
PWM_OUT_3_BIT | PWM_OUT_4_BIT | PWM_OUT_5_BIT |
PWM_OUT_6_BIT | PWM_OUT_7_BIT)));
if(bFaultSuppress == true)
{
HWREG(ui32Base + PWM_O_FAULT) |= ui32PWMOutBits;
}
else
{
HWREG(ui32Base + PWM_O_FAULT) &= ~(ui32PWMOutBits);
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Post an VT event to interested VT handlers */
|
void vt_event_post(unsigned int event, unsigned int old, unsigned int new)
|
/* Post an VT event to interested VT handlers */
void vt_event_post(unsigned int event, unsigned int old, unsigned int new)
|
{
struct list_head *pos, *head;
unsigned long flags;
int wake = 0;
spin_lock_irqsave(&vt_event_lock, flags);
head = &vt_events;
list_for_each(pos, head) {
struct vt_event_wait *ve = list_entry(pos,
struct vt_event_wait, list);
if (!(ve->event.event & event))
continue;
ve->event.event = event;
ve->event.oldev = old + 1;
ve->event.newev = new + 1;
wake = 1;
ve->done = 1;
}
spin_unlock_irqrestore(&vt_event_lock, flags);
if (wake)
wake_up_interruptible(&vt_event_waitqueue);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Function for toggling sense level for specified pins. */
|
static void sense_level_toggle(gpiote_user_t *p_user, uint32_t pins)
|
/* Function for toggling sense level for specified pins. */
static void sense_level_toggle(gpiote_user_t *p_user, uint32_t pins)
|
{
uint32_t pin_no;
for (pin_no = 0; pin_no < NO_OF_PINS; pin_no++)
{
uint32_t pin_mask = (1 << pin_no);
if ((pins & pin_mask) != 0)
{
uint32_t sense;
if ((p_user->sense_high_pins & pin_mask) == 0)
{
sense = GPIO_PIN_CNF_SENSE_High << GPIO_PIN_CNF_SENSE_Pos;
p_user->sense_high_pins |= pin_mask;
}
else
{
sense = GPIO_PIN_CNF_SENSE_Low << GPIO_PIN_CNF_SENSE_Pos;
p_user->sense_high_pins &= ~pin_mask;
}
NRF_GPIO->PIN_CNF[pin_no] &= ~GPIO_PIN_CNF_SENSE_Msk;
NRF_GPIO->PIN_CNF[pin_no] |= sense;
}
}
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Number format defined by gcc: numbers are recorded in the 32 bit unsigned binary form of the endianness of the machine generating the file. 64 bit numbers are stored as two 32 bit numbers, the low part first. */
|
static int seq_write_gcov_u64(struct seq_file *seq, u64 v)
|
/* Number format defined by gcc: numbers are recorded in the 32 bit unsigned binary form of the endianness of the machine generating the file. 64 bit numbers are stored as two 32 bit numbers, the low part first. */
static int seq_write_gcov_u64(struct seq_file *seq, u64 v)
|
{
u32 data[2];
data[0] = (v & 0xffffffffUL);
data[1] = (v >> 32);
return seq_write(seq, data, sizeof(data));
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This routine performs a byte swap on a 32-bit word */
|
uint32_t swap32(uint32_t data)
|
/* This routine performs a byte swap on a 32-bit word */
uint32_t swap32(uint32_t data)
|
{
uint32_t temp = 0;
temp = (data & 0xff) << 24;
temp |= ((data & 0xff00) << 8);
temp |= ((data & 0xff0000) >> 8);
temp |= ((data & 0xff000000) >> 24);
return (temp);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function is making an assumption about the layout of the response, which should be checked against the docs. */
|
static bool intel_sdvo_get_trained_inputs(struct intel_output *intel_output, bool *input_1, bool *input_2)
|
/* This function is making an assumption about the layout of the response, which should be checked against the docs. */
static bool intel_sdvo_get_trained_inputs(struct intel_output *intel_output, bool *input_1, bool *input_2)
|
{
struct intel_sdvo_get_trained_inputs_response response;
u8 status;
intel_sdvo_write_cmd(intel_output, SDVO_CMD_GET_TRAINED_INPUTS, NULL, 0);
status = intel_sdvo_read_response(intel_output, &response, sizeof(response));
if (status != SDVO_CMD_STATUS_SUCCESS)
return false;
*input_1 = response.input0_trained;
*input_2 = response.input1_trained;
return true;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* free I2C in case of slave deadlock in case printer is resetted during I2C transmit, slave can deadlock it has not been resetted and is expecting clock to finish its command problem is that it can hold SDA in '0' - it blocks the bus so master cannot do start / stop condition this code generates a clock until SDA is in '1' and than master sdoes start + stop to end any slave communication */
|
static void i2c_free_bus_in_case_of_slave_deadlock(uint32_t clk, hw_pin sda, hw_pin scl)
|
/* free I2C in case of slave deadlock in case printer is resetted during I2C transmit, slave can deadlock it has not been resetted and is expecting clock to finish its command problem is that it can hold SDA in '0' - it blocks the bus so master cannot do start / stop condition this code generates a clock until SDA is in '1' and than master sdoes start + stop to end any slave communication */
static void i2c_free_bus_in_case_of_slave_deadlock(uint32_t clk, hw_pin sda, hw_pin scl)
|
{
set_pin_od(scl);
i2c_unblock_sda(clk, sda, scl);
}
set_pin_od(sda);
HAL_GPIO_WritePin(sda.port, sda.no, GPIO_PIN_RESET);
delay_us_precise(i2c_get_edge_us(clk));
HAL_GPIO_WritePin(sda.port, sda.no, GPIO_PIN_RESET);
delay_us_precise(i2c_get_edge_us(clk));
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* Reads a byte from the I2C receive FIFO. */
|
uint32_t I2CFIFODataGetNonBlocking(uint32_t ui32Base, uint8_t *pui8Data)
|
/* Reads a byte from the I2C receive FIFO. */
uint32_t I2CFIFODataGetNonBlocking(uint32_t ui32Base, uint8_t *pui8Data)
|
{
ASSERT(_I2CBaseValid(ui32Base));
if (HWREG(ui32Base + I2C_O_FIFOSTATUS) & I2C_FIFOSTATUS_RXFE)
{
return (0);
}
else
{
*pui8Data = HWREG(ui32Base + I2C_O_FIFODATA);
return (1);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Calculate remainder: BnRes = BnA % BnB Please note, all "out" Big number arguments should be properly initialized by calling to */
|
BOOLEAN EFIAPI BigNumMod(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes)
|
/* Calculate remainder: BnRes = BnA % BnB Please note, all "out" Big number arguments should be properly initialized by calling to */
BOOLEAN EFIAPI BigNumMod(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes)
|
{
CALL_CRYPTO_SERVICE (BigNumMod, (BnA, BnB, BnRes), FALSE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Initialise the struct stream_descr so that we can extract individual events from the event stream. */
|
void iw_init_event_stream(struct stream_descr *stream, char *data, int len)
|
/* Initialise the struct stream_descr so that we can extract individual events from the event stream. */
void iw_init_event_stream(struct stream_descr *stream, char *data, int len)
|
{
memset((char *) stream, '\0', sizeof(struct stream_descr));
stream->current = data;
stream->end = data + len;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* sg_init_one - Initialize a single entry sg list @sg: SG entry @buf: Virtual address for IO @buflen: IO length */
|
void sg_init_one(struct scatterlist *sg, const void *buf, unsigned int buflen)
|
/* sg_init_one - Initialize a single entry sg list @sg: SG entry @buf: Virtual address for IO @buflen: IO length */
void sg_init_one(struct scatterlist *sg, const void *buf, unsigned int buflen)
|
{
sg_init_table(sg, 1);
sg_set_buf(sg, buf, buflen);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Converts flags from OEM_DATA_AVAIL to RECEIVE_MSG_AVAIL Returns 1 indicating need to re-run handle_flags(). */
|
static int oem_data_avail_to_receive_msg_avail(struct smi_info *smi_info)
|
/* Converts flags from OEM_DATA_AVAIL to RECEIVE_MSG_AVAIL Returns 1 indicating need to re-run handle_flags(). */
static int oem_data_avail_to_receive_msg_avail(struct smi_info *smi_info)
|
{
smi_info->msg_flags = ((smi_info->msg_flags & ~OEM_DATA_AVAIL) |
RECEIVE_MSG_AVAIL);
return 1;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Fills each IrDA_InitStruct member with its default value. */
|
void USI_UARTIrDAStructInit(USI_UartIrDAInitTypeDef *IrDA_InitStruct)
|
/* Fills each IrDA_InitStruct member with its default value. */
void USI_UARTIrDAStructInit(USI_UartIrDAInitTypeDef *IrDA_InitStruct)
|
{
IrDA_InitStruct->USI_UARTIrDARxInv = DISABLE;
IrDA_InitStruct->USI_UARTIrDATxInv = DISABLE;
IrDA_InitStruct->USI_UARTLowShift = USI_UART_IRDA_PULSE_LEFT_SHIFT;
IrDA_InitStruct->USI_UARTLowShiftVal = 0;
IrDA_InitStruct->USI_UARTUpperShift = USI_UART_IRDA_PULSE_LEFT_SHIFT;
IrDA_InitStruct->USI_UARTUpperShiftVal = 0;
IrDA_InitStruct->USI_UARTRxFilterCmd = ENABLE;
IrDA_InitStruct->USI_UARTRxFilterThres = 7;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd)
|
/* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd)
|
{
if(hpcd->Instance==USB_OTG_FS)
{
__HAL_RCC_USB_OTG_FS_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_11|GPIO_PIN_12);
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* HP's Diva chip puts the 4th/5th serial port further out, and some serial ports are supposed to be hidden on certain models. */
|
static int pci_hp_diva_setup(struct serial_private *priv, const struct pciserial_board *board, struct uart_port *port, int idx)
|
/* HP's Diva chip puts the 4th/5th serial port further out, and some serial ports are supposed to be hidden on certain models. */
static int pci_hp_diva_setup(struct serial_private *priv, const struct pciserial_board *board, struct uart_port *port, int idx)
|
{
unsigned int offset = board->first_offset;
unsigned int bar = FL_GET_BASE(board->flags);
switch (priv->dev->subsystem_device) {
case PCI_DEVICE_ID_HP_DIVA_MAESTRO:
if (idx == 3)
idx++;
break;
case PCI_DEVICE_ID_HP_DIVA_EVEREST:
if (idx > 0)
idx++;
if (idx > 2)
idx++;
break;
}
if (idx > 2)
offset = 0x18;
offset += idx * board->uart_offset;
return setup_port(priv, port, bar, offset, board->reg_shift);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Function for handling the data from the Nordic UART Service.
This function will process the data received from the Nordic UART BLE Service and send it to the UART module. */
|
static void nus_data_handler(ble_nus_t *p_nus, uint8_t *p_data, uint16_t length)
|
/* Function for handling the data from the Nordic UART Service.
This function will process the data received from the Nordic UART BLE Service and send it to the UART module. */
static void nus_data_handler(ble_nus_t *p_nus, uint8_t *p_data, uint16_t length)
|
{
for (uint32_t i = 0; i < length; i++)
{
uint8_t data = p_data[i];
if (data == '\n') {
static const char thank_you[] = "Thank you!\n";
uint32_t err_code = ble_nus_string_send(p_nus, (uint8_t*)thank_you, strlen(thank_you) + 1);
if (err_code != NRF_ERROR_INVALID_STATE)
{
APP_ERROR_CHECK(err_code);
}
}
while(app_uart_put(data) != NRF_SUCCESS);
}
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Fills each SDIO_CmdInitStruct member with its default value. */
|
void SDIO_InitCmdStruct(SDIO_CmdInitType *SDIO_CmdInitStruct)
|
/* Fills each SDIO_CmdInitStruct member with its default value. */
void SDIO_InitCmdStruct(SDIO_CmdInitType *SDIO_CmdInitStruct)
|
{
SDIO_CmdInitStruct->CmdArgument = 0x00;
SDIO_CmdInitStruct->CmdIndex = 0x00;
SDIO_CmdInitStruct->ResponseType = SDIO_RESP_NO;
SDIO_CmdInitStruct->WaitType = SDIO_WAIT_NO;
SDIO_CmdInitStruct->CPSMConfig = SDIO_CPSM_DISABLE;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function decodes the Move to Saturation payload. */
|
static void dissect_zcl_color_control_move_to_saturation(tvbuff_t *tvb, proto_tree *tree, guint *offset)
|
/* This function decodes the Move to Saturation payload. */
static void dissect_zcl_color_control_move_to_saturation(tvbuff_t *tvb, proto_tree *tree, guint *offset)
|
{
proto_tree_add_item(tree, hf_zbee_zcl_color_control_saturation, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
*offset += 1;
proto_tree_add_item(tree, hf_zbee_zcl_color_control_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
*offset += 2;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* vdev_label_start returns the physical disk offset (in bytes) of label "l". */
|
static uint64_t vdev_label_start(uint64_t psize, int l)
|
/* vdev_label_start returns the physical disk offset (in bytes) of label "l". */
static uint64_t vdev_label_start(uint64_t psize, int l)
|
{
return (l * sizeof(vdev_label_t) + (l < VDEV_LABELS / 2 ?
0 : psize -
VDEV_LABELS * sizeof(vdev_label_t)));
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Attribute write call back for the Descriptor V8D3 attribute. */
|
static ssize_t write_des_v8d3(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
|
/* Attribute write call back for the Descriptor V8D3 attribute. */
static ssize_t write_des_v8d3(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
|
{
uint8_t *value = attr->user_data;
if (offset >= sizeof(des_v8d3_value))
return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET);
if (offset + len > sizeof(des_v8d3_value))
return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN);
memcpy(value + offset, buf, len);
return len;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* do_IRQ handles all normal device IRQ's (the special SMP cross-CPU interrupts have their own specific handlers). */
|
unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
|
/* do_IRQ handles all normal device IRQ's (the special SMP cross-CPU interrupts have their own specific handlers). */
unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
|
{
struct pt_regs *old_regs = set_irq_regs(regs);
unsigned vector = ~regs->orig_ax;
unsigned irq;
exit_idle();
irq_enter();
irq = __get_cpu_var(vector_irq)[vector];
if (!handle_irq(irq, regs)) {
ack_APIC_irq();
if (printk_ratelimit())
pr_emerg("%s: %d.%d No irq handler for vector (irq %d)\n",
__func__, smp_processor_id(), vector, irq);
}
irq_exit();
set_irq_regs(old_regs);
return 1;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Physical counter registers. Each physical counter can act as one 32-bit counter or two 16-bit counters. */
|
u32 cbe_read_phys_ctr(u32 cpu, u32 phys_ctr)
|
/* Physical counter registers. Each physical counter can act as one 32-bit counter or two 16-bit counters. */
u32 cbe_read_phys_ctr(u32 cpu, u32 phys_ctr)
|
{
u32 val_in_latch, val = 0;
if (phys_ctr < NR_PHYS_CTRS) {
READ_SHADOW_REG(val_in_latch, counter_value_in_latch);
if (val_in_latch & (1 << phys_ctr)) {
READ_SHADOW_REG(val, pm_ctr[phys_ctr]);
} else {
READ_MMIO_UPPER32(val, pm_ctr[phys_ctr]);
}
}
return val;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* find_or_create_page() returns the desired page's address, or zero on memory exhaustion. */
|
struct page* find_or_create_page(struct address_space *mapping, pgoff_t index, gfp_t gfp_mask)
|
/* find_or_create_page() returns the desired page's address, or zero on memory exhaustion. */
struct page* find_or_create_page(struct address_space *mapping, pgoff_t index, gfp_t gfp_mask)
|
{
struct page *page;
int err;
repeat:
page = find_lock_page(mapping, index);
if (!page) {
page = __page_cache_alloc(gfp_mask);
if (!page)
return NULL;
err = add_to_page_cache_lru(page, mapping, index,
(gfp_mask & GFP_RECLAIM_MASK));
if (unlikely(err)) {
page_cache_release(page);
page = NULL;
if (err == -EEXIST)
goto repeat;
}
}
return page;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* axon_ram_direct_access - direct_access() method for block device @device, @sector, @data: see block_device_operations method */
|
static int axon_ram_direct_access(struct block_device *device, sector_t sector, void **kaddr, unsigned long *pfn)
|
/* axon_ram_direct_access - direct_access() method for block device @device, @sector, @data: see block_device_operations method */
static int axon_ram_direct_access(struct block_device *device, sector_t sector, void **kaddr, unsigned long *pfn)
|
{
struct axon_ram_bank *bank = device->bd_disk->private_data;
loff_t offset;
offset = sector;
if (device->bd_part != NULL)
offset += device->bd_part->start_sect;
offset <<= AXON_RAM_SECTOR_SHIFT;
if (offset >= bank->size) {
dev_err(&bank->device->dev, "Access outside of address space\n");
return -ERANGE;
}
*kaddr = (void *)(bank->ph_addr + offset);
*pfn = virt_to_phys(kaddr) >> PAGE_SHIFT;
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Sets a callback that can discharge VCONN if the TCPC is unable to or the system is configured in a way that does not use the VCONN discharge capabilities of the TCPC. */
|
static void ucpd_set_vconn_discharge_cb(const struct device *dev, tcpc_vconn_discharge_cb_t cb)
|
/* Sets a callback that can discharge VCONN if the TCPC is unable to or the system is configured in a way that does not use the VCONN discharge capabilities of the TCPC. */
static void ucpd_set_vconn_discharge_cb(const struct device *dev, tcpc_vconn_discharge_cb_t cb)
|
{
struct tcpc_data *data = dev->data;
data->vconn_discharge_cb = cb;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Set up a timer that expires after the etr_tolec + 1.6 seconds if one of the ports needs an update. */
|
static void etr_set_tolec_timeout(unsigned long long now)
|
/* Set up a timer that expires after the etr_tolec + 1.6 seconds if one of the ports needs an update. */
static void etr_set_tolec_timeout(unsigned long long now)
|
{
unsigned long micros;
if ((!etr_eacr.p0 || etr_port0_uptodate) &&
(!etr_eacr.p1 || etr_port1_uptodate))
return;
micros = (now > etr_tolec) ? ((now - etr_tolec) >> 12) : 0;
micros = (micros > 1600000) ? 0 : 1600000 - micros;
mod_timer(&etr_timer, jiffies + (micros * HZ) / 1000000 + 1);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Context: Any context. Caller must prevent concurrent changes to the PRCI_CORECLKSEL_OFFSET register. */
|
static void __prci_coreclksel_use_corepll(struct __prci_data *pd)
|
/* Context: Any context. Caller must prevent concurrent changes to the PRCI_CORECLKSEL_OFFSET register. */
static void __prci_coreclksel_use_corepll(struct __prci_data *pd)
|
{
u32 r;
r = __prci_readl(pd, PRCI_CORECLKSEL_OFFSET);
r &= ~PRCI_CORECLKSEL_CORECLKSEL_MASK;
__prci_writel(r, PRCI_CORECLKSEL_OFFSET, pd);
r = __prci_readl(pd, PRCI_CORECLKSEL_OFFSET);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Returns the source or destination address for the specified integrated USB DMA channel. */
|
void* USBDMAChannelAddressGet(uint32_t ui32Base, uint32_t ui32Channel)
|
/* Returns the source or destination address for the specified integrated USB DMA channel. */
void* USBDMAChannelAddressGet(uint32_t ui32Base, uint32_t ui32Channel)
|
{
ASSERT(ui32Base == USB0_BASE);
ASSERT(ui32Channel < 8);
return((void *)HWREG(ui32Base + USB_O_DMAADDR0 + (0x10 * ui32Channel)));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* libc/string/strspn.c Finds in a string the first occurrence of a byte not in a set */
|
size_t strspn(const char *s, const char *accept)
|
/* libc/string/strspn.c Finds in a string the first occurrence of a byte not in a set */
size_t strspn(const char *s, const char *accept)
|
{
const char * p;
const char * a;
size_t count = 0;
for (p = s; *p != '\0'; ++p)
{
for (a = accept; *a != '\0'; ++a)
{
if (*p == *a)
break;
}
if (*a == '\0')
return count;
++count;
}
return count;
}
|
xboot/xboot
|
C++
|
MIT License
| 779
|
/* TIM_Encoder MSP Initialization This function configures the hardware resources used in this example. */
|
void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim_encoder)
|
/* TIM_Encoder MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim_encoder)
|
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(htim_encoder->Instance==TIM4)
{
__HAL_RCC_TIM4_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF2_TIM4;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Reduce the vid by the max of step or reqvid. Decreasing vid codes represent increasing voltages: vid of 0 is 1.550V, vid of 0x1e is 0.800V, vid of VID_OFF is off. */
|
static int decrease_vid_code_by_step(struct powernow_k8_data *data, u32 reqvid, u32 step)
|
/* Reduce the vid by the max of step or reqvid. Decreasing vid codes represent increasing voltages: vid of 0 is 1.550V, vid of 0x1e is 0.800V, vid of VID_OFF is off. */
static int decrease_vid_code_by_step(struct powernow_k8_data *data, u32 reqvid, u32 step)
|
{
if ((data->currvid - reqvid) > step)
reqvid = data->currvid - step;
if (write_new_vid(data, reqvid))
return 1;
count_off_vst(data);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Returns the size of the resulting target surface for a rotozoomSurface() call. */
|
void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth, int *dstheight)
|
/* Returns the size of the resulting target surface for a rotozoomSurface() call. */
void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth, int *dstheight)
|
{
double dummy_sanglezoom, dummy_canglezoom;
_rotozoomSurfaceSizeTrig(width, height, angle, zoom, zoom, dstwidth, dstheight, &dummy_sanglezoom, &dummy_canglezoom);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Search matching zones from preset table. The note can be rewritten by preset mapping (alias). The found zones are stored on 'table' array. max_layers defines the maximum number of elements in this array. This function returns the number of found zones. 0 if not found. */
|
int snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel, int preset, int bank, int def_preset, int def_bank, struct snd_sf_zone **table, int max_layers)
|
/* Search matching zones from preset table. The note can be rewritten by preset mapping (alias). The found zones are stored on 'table' array. max_layers defines the maximum number of elements in this array. This function returns the number of found zones. 0 if not found. */
int snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel, int preset, int bank, int def_preset, int def_bank, struct snd_sf_zone **table, int max_layers)
|
{
int nvoices;
unsigned long flags;
spin_lock_irqsave(&sflist->lock, flags);
if (sflist->presets_locked) {
spin_unlock_irqrestore(&sflist->lock, flags);
return 0;
}
nvoices = search_zones(sflist, notep, vel, preset, bank,
table, max_layers, 0);
if (! nvoices) {
if (preset != def_preset || bank != def_bank)
nvoices = search_zones(sflist, notep, vel,
def_preset, def_bank,
table, max_layers, 0);
}
spin_unlock_irqrestore(&sflist->lock, flags);
return nvoices;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function will be called in High prio ISRs. Returns true if the current core was in ISR context before calling into high prio ISR context. */
|
BaseType_t IRAM_ATTR xPortInterruptedFromISRContext()
|
/* This function will be called in High prio ISRs. Returns true if the current core was in ISR context before calling into high prio ISR context. */
BaseType_t IRAM_ATTR xPortInterruptedFromISRContext()
|
{
return (port_interruptNesting[xPortGetCoreID()] != 0);
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* Do a system call from kernel instead of calling sys_execve so we end up with proper pt_regs. */
|
int kernel_execve(const char *filename, char *const argv[], char *const envp[])
|
/* Do a system call from kernel instead of calling sys_execve so we end up with proper pt_regs. */
int kernel_execve(const char *filename, char *const argv[], char *const envp[])
|
{
long __res;
register long __g1 __asm__ ("g1") = __NR_execve;
register long __o0 __asm__ ("o0") = (long)(filename);
register long __o1 __asm__ ("o1") = (long)(argv);
register long __o2 __asm__ ("o2") = (long)(envp);
asm volatile ("t 0x10\n\t"
"bcc 1f\n\t"
"mov %%o0, %0\n\t"
"sub %%g0, %%o0, %0\n\t"
"1:\n\t"
: "=r" (__res), "=&r" (__o0)
: "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1)
: "cc");
return __res;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* If FirstString is NULL, then ASSERT(). If SecondString is NULL, then ASSERT(). If StartSearchString is NULL, then ASSERT(). If StopSearchString is NULL, then ASSERT(). */
|
BOOLEAN EFIAPI InternalHiiCompareSubString(IN CHAR16 *FirstString, IN CHAR16 *SecondString, IN CHAR16 *StartSearchString, IN CHAR16 *StopSearchString)
|
/* If FirstString is NULL, then ASSERT(). If SecondString is NULL, then ASSERT(). If StartSearchString is NULL, then ASSERT(). If StopSearchString is NULL, then ASSERT(). */
BOOLEAN EFIAPI InternalHiiCompareSubString(IN CHAR16 *FirstString, IN CHAR16 *SecondString, IN CHAR16 *StartSearchString, IN CHAR16 *StopSearchString)
|
{
CHAR16 *EndFirstString;
CHAR16 *EndSecondString;
ASSERT (FirstString != NULL);
ASSERT (SecondString != NULL);
ASSERT (StartSearchString != NULL);
ASSERT (StopSearchString != NULL);
FirstString = StrStr (FirstString, StartSearchString);
if (FirstString == NULL) {
return FALSE;
}
SecondString = StrStr (SecondString, StartSearchString);
if (SecondString == NULL) {
return FALSE;
}
EndFirstString = StrStr (FirstString, StopSearchString);
if (EndFirstString == NULL) {
return FALSE;
}
EndSecondString = StrStr (SecondString, StopSearchString);
if (EndSecondString == NULL) {
return FALSE;
}
if ((EndFirstString - FirstString) != (EndSecondString - SecondString)) {
return FALSE;
}
return (BOOLEAN)(StrnCmp (FirstString, SecondString, EndFirstString - FirstString) == 0);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* ‘P n...=r...’ Writes the new value of n-th register received into the input buffer to the n-th register */
|
VOID EFIAPI WriteNthRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *InBuffer)
|
/* ‘P n...=r...’ Writes the new value of n-th register received into the input buffer to the n-th register */
VOID EFIAPI WriteNthRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *InBuffer)
|
{
UINTN RegNumber;
CHAR8 RegNumBuffer[MAX_REG_NUM_BUF_SIZE];
CHAR8 *RegNumBufPtr;
CHAR8 *InBufPtr;
InBufPtr = &InBuffer[1];
RegNumBufPtr = RegNumBuffer;
while (*InBufPtr != '=') {
*RegNumBufPtr++ = *InBufPtr++;
}
*RegNumBufPtr = '\0';
RegNumber = AsciiStrHexToUintn (RegNumBuffer);
if ((RegNumber < 0) || (RegNumber >= MaxRegisterCount ())) {
SendError (GDB_EINVALIDREGNUM);
return;
}
InBufPtr++;
BasicWriteRegister (SystemContext, RegNumber, InBufPtr);
SendSuccess ();
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function handles the smartcard detection interrupt request. */
|
void SC_OFF_EXTI_IRQHandler(void)
|
/* This function handles the smartcard detection interrupt request. */
void SC_OFF_EXTI_IRQHandler(void)
|
{
HAL_GPIO_EXTI_IRQHandler(SC_OFF_PIN);
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Converts a text device path node to Hardware Controller device path structure. */
|
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextCtrl(IN CHAR16 *TextDeviceNode)
|
/* Converts a text device path node to Hardware Controller device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextCtrl(IN CHAR16 *TextDeviceNode)
|
{
CHAR16 *ControllerStr;
CONTROLLER_DEVICE_PATH *Controller;
ControllerStr = GetNextParamStr (&TextDeviceNode);
Controller = (CONTROLLER_DEVICE_PATH *)CreateDeviceNode (
HARDWARE_DEVICE_PATH,
HW_CONTROLLER_DP,
(UINT16)sizeof (CONTROLLER_DEVICE_PATH)
);
Controller->ControllerNumber = (UINT32)Strtoi (ControllerStr);
return (EFI_DEVICE_PATH_PROTOCOL *)Controller;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* The user Entry Point for module CapsuleUpdatePolicyDxe. The user code starts with this function. */
|
EFI_STATUS EFIAPI CapsuleUpdatePolicyInitialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
/* The user Entry Point for module CapsuleUpdatePolicyDxe. The user code starts with this function. */
EFI_STATUS EFIAPI CapsuleUpdatePolicyInitialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
{
EFI_STATUS Status;
ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEdkiiCapsuleUpdatePolicyProtocolGuid);
Status = gBS->InstallMultipleProtocolInterfaces (
&mHandle,
&gEdkiiCapsuleUpdatePolicyProtocolGuid,
&mCapsuleUpdatePolicy,
NULL
);
ASSERT_EFI_ERROR (Status);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Calculates the number of flits needed for a scatter/gather list that can hold the given number of entries. */
|
static unsigned int sgl_len(unsigned int n)
|
/* Calculates the number of flits needed for a scatter/gather list that can hold the given number of entries. */
static unsigned int sgl_len(unsigned int n)
|
{
return (3 * n) / 2 + (n & 1);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* get EXTI lines flag when the interrupt flag is set */
|
FlagStatus exti_interrupt_flag_get(exti_line_enum linex)
|
/* get EXTI lines flag when the interrupt flag is set */
FlagStatus exti_interrupt_flag_get(exti_line_enum linex)
|
{
uint32_t flag_left, flag_right;
flag_left = EXTI_PD & (uint32_t) linex;
flag_right = EXTI_INTEN & (uint32_t) linex;
if ((RESET != flag_left) && (RESET != flag_right)) {
return SET;
} else {
return RESET;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Update the DBX form base on the input file path info. */
|
BOOLEAN EFIAPI UpdateDBXFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
|
/* Update the DBX form base on the input file path info. */
BOOLEAN EFIAPI UpdateDBXFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
|
{
return UpdatePage (FilePath, SECUREBOOT_ENROLL_SIGNATURE_TO_DBX);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Initialization function for the Q15 IIR lattice filter. */
|
void arm_iir_lattice_init_q15(arm_iir_lattice_instance_q15 *S, uint16_t numStages, q15_t *pkCoeffs, q15_t *pvCoeffs, q15_t *pState, uint32_t blockSize)
|
/* Initialization function for the Q15 IIR lattice filter. */
void arm_iir_lattice_init_q15(arm_iir_lattice_instance_q15 *S, uint16_t numStages, q15_t *pkCoeffs, q15_t *pvCoeffs, q15_t *pState, uint32_t blockSize)
|
{
S->numStages = numStages;
S->pkCoeffs = pkCoeffs;
S->pvCoeffs = pvCoeffs;
memset(pState, 0, (numStages + blockSize) * sizeof(q15_t));
S->pState = pState;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* 7.3.2.5 End of sequence RBSP syntax end_of_seq_rbsp( ) {} */
|
static void dissect_h264_end_of_seq_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
|
/* 7.3.2.5 End of sequence RBSP syntax end_of_seq_rbsp( ) {} */
static void dissect_h264_end_of_seq_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
|
{
proto_tree_add_expert(tree, pinfo, &ei_h264_undecoded, tvb, offset, -1);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Check and set SMM feature lock bit and code check enable bit in S3 path. */
|
VOID SmmFeatureLockOnS3(VOID)
|
/* Check and set SMM feature lock bit and code check enable bit in S3 path. */
VOID SmmFeatureLockOnS3(VOID)
|
{
if (mSmmFeatureControl != 0) {
return;
}
mSmmFeatureControl = AsmReadMsr64 (MSR_SMM_FEATURE_CONTROL);
if ((mSmmFeatureControl & 0x5) != 0x5) {
AsmWriteMsr64 (MSR_SMM_FEATURE_CONTROL, mSmmFeatureControl | 0x5);
}
mSmmFeatureControl = AsmReadMsr64 (MSR_SMM_FEATURE_CONTROL);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Update internal data when incremental mode is using T2. */
|
IFX_STATIC void IfxGpt12_IncrEnc_updateFromT2(IfxGpt12_IncrEnc *driver)
|
/* Update internal data when incremental mode is using T2. */
IFX_STATIC void IfxGpt12_IncrEnc_updateFromT2(IfxGpt12_IncrEnc *driver)
|
{
Ifx_GPT12 *gpt12 = driver->module;
sint32 newPosition;
driver->direction = gpt12->T2CON.B.T2RDIR ? IfxStdIf_Pos_Dir_backward : IfxStdIf_Pos_Dir_forward;
newPosition = gpt12->T2.U;
newPosition = (newPosition + driver->offset);
if (newPosition >= driver->resolution)
{
newPosition %= driver->resolution;
}
else if (newPosition < 0)
{
newPosition = (newPosition + driver->resolution);
}
IfxGpt12_IncrEnc_updateSpeedFromT2(driver, newPosition);
driver->rawPosition = newPosition;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* This merely masks off the duplicates which appear in bytes 1-3. You */
|
static u32 stu300_r8(void __iomem *address)
|
/* This merely masks off the duplicates which appear in bytes 1-3. You */
static u32 stu300_r8(void __iomem *address)
|
{
return readl(address) & 0x000000FFU;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Given a user provided state, set ourselves up to match it. This will always reset the card if needed. */
|
static void lmc_hssi_set_status(lmc_softc_t *const, lmc_ctl_t *)
|
/* Given a user provided state, set ourselves up to match it. This will always reset the card if needed. */
static void lmc_hssi_set_status(lmc_softc_t *const, lmc_ctl_t *)
|
{
if (ctl == NULL)
{
sc->lmc_media->set_clock_source (sc, sc->ictl.clock_source);
lmc_set_protocol (sc, NULL);
return;
}
if (ctl->clock_source && !sc->ictl.clock_source)
{
sc->lmc_media->set_clock_source (sc, LMC_CTL_CLOCK_SOURCE_INT);
sc->lmc_timing = LMC_CTL_CLOCK_SOURCE_INT;
}
else if (!ctl->clock_source && sc->ictl.clock_source)
{
sc->lmc_timing = LMC_CTL_CLOCK_SOURCE_EXT;
sc->lmc_media->set_clock_source (sc, LMC_CTL_CLOCK_SOURCE_EXT);
}
lmc_set_protocol (sc, ctl);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Call window's event handler, if one is set.
This function is a small helper function that checks if a window has an event handler at all, and in that case, sends it an event for handling. If an event handler is present, and accepts the event, this function returns true. If the event handler rejects it, or there's no event handler present, this function returns false. */
|
static bool win_handle_event(struct win_window *win, enum win_event_type type, const void *data)
|
/* Call window's event handler, if one is set.
This function is a small helper function that checks if a window has an event handler at all, and in that case, sends it an event for handling. If an event handler is present, and accepts the event, this function returns true. If the event handler rejects it, or there's no event handler present, this function returns false. */
static bool win_handle_event(struct win_window *win, enum win_event_type type, const void *data)
|
{
win_event_handler_t handler = win->attributes.event_handler;
if (handler) {
return handler(win, type, data);
} else {
return false;
}
}
|
memfault/zero-to-main
|
C++
| null | 200
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.