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 |
|---|---|---|---|---|---|---|---|
/* Checks whether the specified RCC flag is set or not. */ | FlagStatus RCC_GetFlagStatus(uint8_t RCC_FLAG) | /* Checks whether the specified RCC flag is set or not. */
FlagStatus RCC_GetFlagStatus(uint8_t RCC_FLAG) | {
uint32_t tmp = 0;
uint32_t statusreg = 0;
FlagStatus bitstatus = RESET;
assert_param(IS_RCC_FLAG(RCC_FLAG));
tmp = RCC_FLAG >> 5;
if (tmp == 1)
{
statusreg = RCC->CR;
}
else if (tmp == 2)
{
statusreg = RCC->BDCR;
}
else
{
statusreg = RCC->CSR... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does no... | EFI_STATUS EFIAPI VirtualKeyboardComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName) | /* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does no... | {
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mVirtualKeyboardDriverNameTable,
DriverName,
(BOOLEAN)(This == &gVirtualKeyboardComponentName)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The default values are: code config->clockSource = kGPT_ClockSource_Periph; config->divider = 1U; config->enableRunInStop = true; config->enableRunInWait = true; config->enableRunInDoze = false; config->enableRunInDbg = false; config->enableFreeRun = false; config->enableMode = true; endcode param config Pointer to ... | void GPT_GetDefaultConfig(gpt_config_t *config) | /* The default values are: code config->clockSource = kGPT_ClockSource_Periph; config->divider = 1U; config->enableRunInStop = true; config->enableRunInWait = true; config->enableRunInDoze = false; config->enableRunInDbg = false; config->enableFreeRun = false; config->enableMode = true; endcode param config Pointer to ... | {
assert(NULL != config);
(void)memset(config, 0, sizeof(*config));
config->clockSource = kGPT_ClockSource_Periph;
config->divider = 1U;
config->enableRunInStop = true;
config->enableRunInWait = true;
config->enableRunInDoze = false;
config->enableRunInDbg = false;
confi... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* ak4396 mixers DAC volume attenuation mixer control (-64dB to 0dB) */ | static int ak4396_dac_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | /* ak4396 mixers DAC volume attenuation mixer control (-64dB to 0dB) */
static int ak4396_dac_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | {
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 2;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 0xFF;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Marks an iface as ready or unready and updates all associated state tracking. */ | static void conn_mgr_mon_set_ready(int idx, bool readiness) | /* Marks an iface as ready or unready and updates all associated state tracking. */
static void conn_mgr_mon_set_ready(int idx, bool readiness) | {
iface_states[idx] &= ~CONN_MGR_IF_READY;
if (readiness) {
iface_states[idx] |= CONN_MGR_IF_READY;
ready_count += 1;
last_iface_up = conn_mgr_mon_get_if_by_index(idx);
} else {
ready_count -= 1;
last_iface_down = conn_mgr_mon_get_if_by_index(idx);
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Serializes a pubrel packet into the supplied buffer. */ | int mqtt_serialize_pubrel(unsigned char *buf, int buflen, unsigned char dup, unsigned short packetid) | /* Serializes a pubrel packet into the supplied buffer. */
int mqtt_serialize_pubrel(unsigned char *buf, int buflen, unsigned char dup, unsigned short packetid) | {
return mqtt_serialize_ack(buf, buflen, MQTTPACKET_PUBREL, dup, packetid);
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* Caller enables or disables an AP from this point onward. */ | EFI_STATUS MpServicesUnitTestEnableDisableAP(IN MP_SERVICES MpServices, IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag) | /* Caller enables or disables an AP from this point onward. */
EFI_STATUS MpServicesUnitTestEnableDisableAP(IN MP_SERVICES MpServices, IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag) | {
return MpServices.Protocol->EnableDisableAP (MpServices.Protocol, ProcessorNumber, EnableAP, HealthFlag);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Change Logs: Date Author Notes GuEe-GUI first version */ | static rt_err_t fixed_clk_ofw_init(struct rt_platform_device *pdev, struct rt_clk_fixed_rate *clk_fixed) | /* Change Logs: Date Author Notes GuEe-GUI first version */
static rt_err_t fixed_clk_ofw_init(struct rt_platform_device *pdev, struct rt_clk_fixed_rate *clk_fixed) | {
rt_err_t err = RT_EOK;
rt_uint32_t rate, accuracy;
struct rt_ofw_node *np = pdev->parent.ofw_node;
const char *clk_name = np->name;
if (!rt_ofw_prop_read_u32(np, "clock-frequency", &rate))
{
rt_ofw_prop_read_u32(np, "clock-accuracy", &accuracy);
rt_ofw_prop_read_string(np, "clo... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function will create an usb interface object. */ | uintf_t rt_usbd_interface_new(udevice_t device, uintf_handler_t handler) | /* This function will create an usb interface object. */
uintf_t rt_usbd_interface_new(udevice_t device, uintf_handler_t handler) | {
uintf_t intf;
LOG_D("rt_usbd_interface_new");
RT_ASSERT(device != RT_NULL);
intf = (uintf_t)rt_malloc(sizeof(struct uinterface));
if(intf == RT_NULL)
{
rt_kprintf("alloc memory failed\n");
return RT_NULL;
}
intf->intf_num = device->nr_intf;
device->nr_intf++;
in... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* When unicore comes across an instruction which it cannot handle, it takes the extn instruction trap. */ | void rt_hw_trap_extn(struct rt_hw_register *regs) | /* When unicore comes across an instruction which it cannot handle, it takes the extn instruction trap. */
void rt_hw_trap_extn(struct rt_hw_register *regs) | {
rt_hw_show_register(regs);
rt_kprintf("extn instruction\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry);
rt_hw_cpu_shutdown();
} | armink/FreeModbus_Slave-Master-RTT-STM32 | C++ | Other | 1,477 |
/* USB Device HID Set Idle Request Callback Called automatically on USB Device HID Set Idle Request Parameters: None Return Value: TRUE - Success, FALSE - Error */ | BOOL USBD_HID_SetIdle(void) | /* USB Device HID Set Idle Request Callback Called automatically on USB Device HID Set Idle Request Parameters: None Return Value: TRUE - Success, FALSE - Error */
BOOL USBD_HID_SetIdle(void) | {
U8 i;
if (USBD_SetupPacket.wValueL) {
USBD_HID_IdleSet[USBD_SetupPacket.wValueL - 1] = USBD_SetupPacket.wValueH;
} else {
for (i = 0; i < usbd_hid_inreport_num; i++) {
USBD_HID_IdleSet[i] = USBD_SetupPacket.wValueH;
}
}
return (__TRUE);
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Change Logs: Date Author Notes Bernard first version Jianjia Ma add msh cmd */ | void seekdir_test(void) | /* Change Logs: Date Author Notes Bernard first version Jianjia Ma add msh cmd */
void seekdir_test(void) | {
DIR * dirp;
long save3 = 0;
int i = 0;
struct dirent *dp;
dirp = opendir ("/");
save3 = telldir(dirp);
for (dp = readdir(dirp); dp != RT_NULL; dp = readdir(dirp))
{
rt_kprintf("direntry: %s\n", dp->d_name);
if (i++ == 3)
{
save3 = telldir(dirp);
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Verifies that the received server response has the expected digest value. */ | static int rtmp_validate_digest(uint8_t *buf, int off) | /* Verifies that the received server response has the expected digest value. */
static int rtmp_validate_digest(uint8_t *buf, int off) | {
int i, digest_pos = 0;
uint8_t digest[32];
for (i = 0; i < 4; i++)
digest_pos += buf[i + off];
digest_pos = (digest_pos % 728) + off + 4;
rtmp_calc_digest(buf, RTMP_HANDSHAKE_PACKET_SIZE, digest_pos,
rtmp_server_key, SERVER_KEY_OPEN_PART_LEN,
diges... | DC-SWAT/DreamShell | C++ | null | 404 |
/* Comparator Interrupt Handler.
If users want to user the ACMP Interrupt Callback feature, Users should promise that the ACMP Handle in the vector table is ACMPIntHandler. */ | void ACMP_IRQHandler(void) | /* Comparator Interrupt Handler.
If users want to user the ACMP Interrupt Callback feature, Users should promise that the ACMP Handle in the vector table is ACMPIntHandler. */
void ACMP_IRQHandler(void) | {
unsigned long ulBase = ACMP_BASE;
unsigned long ulIntFlags;
ulIntFlags = xHWREG(ulBase + ACMP_SR);
xHWREG(ulBase + ACMP_SR) = ulIntFlags;
if((ulIntFlags & ACMP_SR_CMPF0) && g_pfnACMPHandlerCallbacks[0])
{
g_pfnACMPHandlerCallbacks[0](0, 0, 0, 0);
}
if((ulIntFlags & ACMP_SR_CMPF... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* configure RCU
, V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */ | void rcu_config(void) | /* configure RCU
, V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
void rcu_config(void) | {
rcu_periph_clock_enable(RCU_GPIOA);
rcu_periph_clock_enable(RCU_CFGCMP);
} | liuxuming/trochili | C++ | Apache License 2.0 | 132 |
/* BACnet Application PDUs chapter 21 BACnetPropertyArrayIndex::= ENUMERATED { */ | static guint fPropertyArrayIndex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) | /* BACnet Application PDUs chapter 21 BACnetPropertyArrayIndex::= ENUMERATED { */
static guint fPropertyArrayIndex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) | {
guint8 tag_no, tag_info;
guint32 lvt;
guint tag_len;
proto_tree *subtree;
tag_len = fTagHeader(tvb, pinfo, offset, &tag_no, &tag_info, &lvt);
if (fUnsigned32(tvb, offset + tag_len, lvt, (guint32 *)&propertyArrayIndex))
subtree = proto_tree_add_subtree_format(tree, tvb, o... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Converts a SATA device path structure to its string representative. */ | VOID DevPathToTextSata(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts) | /* Converts a SATA device path structure to its string representative. */
VOID DevPathToTextSata(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts) | {
SATA_DEVICE_PATH *Sata;
Sata = DevPath;
UefiDevicePathLibCatPrint (
Str,
L"Sata(0x%x,0x%x,0x%x)",
Sata->HBAPortNumber,
Sata->PortMultiplierPortNumber,
Sata->Lun
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function can be called from gtk_tree_view_column_set_cell_data_func() The user data must be the column number. Renders the const static string whose pointer is stored. */ | void str_ptr_data_func(GtkTreeViewColumn *column _U_, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data) | /* This function can be called from gtk_tree_view_column_set_cell_data_func() The user data must be the column number. Renders the const static string whose pointer is stored. */
void str_ptr_data_func(GtkTreeViewColumn *column _U_, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data) | {
const gchar *str = NULL;
gint data_column = GPOINTER_TO_INT(user_data);
gtk_tree_model_get(model, iter, data_column, &str, -1);
g_object_set(renderer, "text", str, NULL);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* qdict_get_obj(): Get a QObject of a specific type */ | static QObject* qdict_get_obj(const QDict *qdict, const char *key, qtype_code type) | /* qdict_get_obj(): Get a QObject of a specific type */
static QObject* qdict_get_obj(const QDict *qdict, const char *key, qtype_code type) | {
QObject *obj;
obj = qdict_get(qdict, key);
assert(obj != NULL);
assert(qobject_type(obj) == type);
return obj;
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Calculate the MaxSizeHint member for a PCI_CAP object. */ | STATIC VOID CalculatePciCapMaxSizeHint(IN OUT PCI_CAP *PciCap, IN PCI_CAP *NextPciCap OPTIONAL) | /* Calculate the MaxSizeHint member for a PCI_CAP object. */
STATIC VOID CalculatePciCapMaxSizeHint(IN OUT PCI_CAP *PciCap, IN PCI_CAP *NextPciCap OPTIONAL) | {
UINT16 ConfigSpaceSize;
ConfigSpaceSize = (PciCap->Key.Domain == PciCapNormal ?
PCI_MAX_CONFIG_OFFSET : PCI_EXP_MAX_CONFIG_OFFSET);
ASSERT (NextPciCap == NULL || PciCap->Offset < NextPciCap->Offset);
ASSERT (PciCap->Offset < ConfigSpaceSize);
if ((NextPciCap == NULL) || (NextPciCap->Of... | tianocore/edk2 | C++ | Other | 4,240 |
/* Sets whether a source can be called recursively. If @can_recurse is TRUE, then while the source is being dispatched then this source will be processed normally. Otherwise, all processing of this source is blocked until the dispatch function returns. */ | void g_source_set_can_recurse(GSource *source, gboolean can_recurse) | /* Sets whether a source can be called recursively. If @can_recurse is TRUE, then while the source is being dispatched then this source will be processed normally. Otherwise, all processing of this source is blocked until the dispatch function returns. */
void g_source_set_can_recurse(GSource *source, gboolean can_rec... | {
GMainContext *context;
g_return_if_fail (source != NULL);
context = source->context;
if (context)
LOCK_CONTEXT (context);
if (can_recurse)
source->flags |= G_SOURCE_CAN_RECURSE;
else
source->flags &= ~G_SOURCE_CAN_RECURSE;
if (context)
UNLOCK_CONTEXT (context);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* check if the input/output channel routing is enabled on the given bitmap. used for mixer unit parser */ | static int check_matrix_bitmap(unsigned char *bmap, int ich, int och, int num_outs) | /* check if the input/output channel routing is enabled on the given bitmap. used for mixer unit parser */
static int check_matrix_bitmap(unsigned char *bmap, int ich, int och, int num_outs) | {
int idx = ich * num_outs + och;
return bmap[idx >> 3] & (0x80 >> (idx & 7));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write to SSC Transmit Synchronization Holding Register. Send data through SSC Synchronization frame. If there is sync data that needs to be transmitted, call this function first to send out the sync data, and then call the */ | void ssc_write_sync_data(Ssc *p_ssc, uint32_t ul_frame) | /* Write to SSC Transmit Synchronization Holding Register. Send data through SSC Synchronization frame. If there is sync data that needs to be transmitted, call this function first to send out the sync data, and then call the */
void ssc_write_sync_data(Ssc *p_ssc, uint32_t ul_frame) | {
p_ssc->SSC_TSHR = ul_frame;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Get the capability data from the specified slot. */ | EFI_STATUS SdPeimHcGetCapability(IN UINTN Bar, OUT SD_HC_SLOT_CAP *Capability) | /* Get the capability data from the specified slot. */
EFI_STATUS SdPeimHcGetCapability(IN UINTN Bar, OUT SD_HC_SLOT_CAP *Capability) | {
EFI_STATUS Status;
UINT64 Cap;
Status = SdPeimHcRwMmio (Bar + SD_HC_CAP, TRUE, sizeof (Cap), &Cap);
if (EFI_ERROR (Status)) {
return Status;
}
CopyMem (Capability, &Cap, sizeof (Cap));
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function writes a node to reserved space of journal head @jhead. Returns zero in case of success and a negative error code in case of failure. */ | static int write_node(struct ubifs_info *c, int jhead, void *node, int len, int *lnum, int *offs) | /* This function writes a node to reserved space of journal head @jhead. Returns zero in case of success and a negative error code in case of failure. */
static int write_node(struct ubifs_info *c, int jhead, void *node, int len, int *lnum, int *offs) | {
struct ubifs_wbuf *wbuf = &c->jheads[jhead].wbuf;
ubifs_assert(jhead != GCHD);
*lnum = c->jheads[jhead].wbuf.lnum;
*offs = c->jheads[jhead].wbuf.offs + c->jheads[jhead].wbuf.used;
dbg_jnl("jhead %s, LEB %d:%d, len %d",
dbg_jhead(jhead), *lnum, *offs, len);
ubifs_prepare_node(c, node, len, 0);
return ubifs_wb... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask val... | UINT8 EFIAPI PciBitFieldAndThenOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData, IN UINT8 OrData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask val... | {
return mRunningOnQ35 ?
PciExpressBitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData) :
PciCf8BitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Disable an SGE completion queue. The caller is responsible for ensuring only one context operation occurs at a time. */ | int t3_sge_disable_cqcntxt(struct adapter *adapter, unsigned int id) | /* Disable an SGE completion queue. The caller is responsible for ensuring only one context operation occurs at a time. */
int t3_sge_disable_cqcntxt(struct adapter *adapter, unsigned int id) | {
if (t3_read_reg(adapter, A_SG_CONTEXT_CMD) & F_CONTEXT_CMD_BUSY)
return -EBUSY;
t3_write_reg(adapter, A_SG_CONTEXT_MASK0, V_CQ_SIZE(M_CQ_SIZE));
t3_write_reg(adapter, A_SG_CONTEXT_MASK1, 0);
t3_write_reg(adapter, A_SG_CONTEXT_MASK2, 0);
t3_write_reg(adapter, A_SG_CONTEXT_MASK3, 0);
t3_write_reg(adapter, A_SG_... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Linux gets into trouble when it executes poorly validated paths through the BIOS, so disable _GTS and _BFS by default, but do speak up and offer the option to enable them. */ | void __init acpi_gts_bfs_check(void) | /* Linux gets into trouble when it executes poorly validated paths through the BIOS, so disable _GTS and _BFS by default, but do speak up and offer the option to enable them. */
void __init acpi_gts_bfs_check(void) | {
acpi_handle dummy;
if (ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_OBJECT, METHOD_NAME__GTS, &dummy)))
{
printk(KERN_NOTICE PREFIX "BIOS offers _GTS\n");
printk(KERN_NOTICE PREFIX "If \"acpi.gts=1\" improves suspend, "
"please notify linux-acpi@vger.kernel.org\n");
}
if (ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Parse InterfaceId in string format and convert it to EFI_IP6_CONFIG_INTERFACE_ID. */ | EFI_STATUS Ip6ParseInterfaceIdFromString(IN CONST CHAR16 *String, OUT EFI_IP6_CONFIG_INTERFACE_ID *IfId) | /* Parse InterfaceId in string format and convert it to EFI_IP6_CONFIG_INTERFACE_ID. */
EFI_STATUS Ip6ParseInterfaceIdFromString(IN CONST CHAR16 *String, OUT EFI_IP6_CONFIG_INTERFACE_ID *IfId) | {
UINT8 Index;
CHAR16 *IfIdStr;
CHAR16 *TempStr;
UINTN NodeVal;
if ((String == NULL) || (IfId == NULL)) {
return EFI_INVALID_PARAMETER;
}
IfIdStr = (CHAR16 *)String;
ZeroMem (IfId, sizeof (EFI_IP6_CONFIG_INTERFACE_ID));
for (Index = 0; Index < 8; Index++) {
TempStr = IfIdStr;
while (... | tianocore/edk2 | C++ | Other | 4,240 |
/* 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 GPIOPinTypeLCD(uint32_t ui32Port, uint8_t ui8Pins) | /* 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 GPIOPinTypeLCD(uint32_t ui32Port, uint8_t ui8Pins) | {
ASSERT(_GPIOBaseValid(ui32Port));
GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);
GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* A state change on a connected socket means it's dying or dead. */ | static void svc_tcp_state_change(struct sock *sk) | /* A state change on a connected socket means it's dying or dead. */
static void svc_tcp_state_change(struct sock *sk) | {
struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;
dprintk("svc: socket %p TCP (connected) state change %d (svsk %p)\n",
sk, sk->sk_state, sk->sk_user_data);
if (!svsk)
printk("svc: socket %p: no user data\n", sk);
else {
set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags);
svc_xprt_enqueue(&svsk->sk_x... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* User-defined threshold value for xl interrupt event on generator 1. LSb = 16mg@2g / 32mg@4g / 62mg@8g / 186mg@16g. */ | int32_t lis2dh12_int1_gen_threshold_set(stmdev_ctx_t *ctx, uint8_t val) | /* User-defined threshold value for xl interrupt event on generator 1. LSb = 16mg@2g / 32mg@4g / 62mg@8g / 186mg@16g. */
int32_t lis2dh12_int1_gen_threshold_set(stmdev_ctx_t *ctx, uint8_t val) | {
lis2dh12_int1_ths_t int1_ths;
int32_t ret;
ret = lis2dh12_read_reg(ctx, LIS2DH12_INT1_THS, (uint8_t *)&int1_ths, 1);
if (ret == 0)
{
int1_ths.ths = val;
ret = lis2dh12_write_reg(ctx, LIS2DH12_INT1_THS, (uint8_t *)&int1_ths, 1);
}
return ret;
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Generates a 32 bits random value based on the RSSI readings. */ | uint32_t RadioRandom(void) | /* Generates a 32 bits random value based on the RSSI readings. */
uint32_t RadioRandom(void) | {
uint32_t rnd = 0;
RadioSetModem( MODEM_LORA );
SX126xSetDioIrqParams( IRQ_RADIO_NONE, IRQ_RADIO_NONE, IRQ_RADIO_NONE, IRQ_RADIO_NONE );
rnd = SX126xGetRandom( );
return rnd;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* @this: the instance of the Simple Network Protocol @int_status: interface status @txbuf: transmission buffer */ | static efi_status_t EFIAPI efi_net_get_status(struct efi_simple_network *this, u32 *int_status, void **txbuf) | /* @this: the instance of the Simple Network Protocol @int_status: interface status @txbuf: transmission buffer */
static efi_status_t EFIAPI efi_net_get_status(struct efi_simple_network *this, u32 *int_status, void **txbuf) | {
efi_status_t ret = EFI_SUCCESS;
EFI_ENTRY("%p, %p, %p", this, int_status, txbuf);
efi_timer_check();
if (!this) {
ret = EFI_INVALID_PARAMETER;
goto out;
}
switch (this->mode->state) {
case EFI_NETWORK_STOPPED:
ret = EFI_NOT_STARTED;
goto out;
case EFI_NETWORK_STARTED:
ret = EFI_DEVICE_ERROR;
goto ... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* LCD Light up or shut off Ring of Indicators. */ | void LCD_ARing(LCD_TypeDef *lcd, int anum, int on) | /* LCD Light up or shut off Ring of Indicators. */
void LCD_ARing(LCD_TypeDef *lcd, int anum, int on) | {
uint32_t com, bitvalue;
com = EFMDisplay.ARing.com[anum];
bitvalue = 1 << EFMDisplay.ARing.bit[anum];
if (on)
{
LCD_enableSegment(lcd, com, bitvalue);
}
else
{
LCD_disableSegment(lcd, com, bitvalue);
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* One function for each procedure in the NFS protocol. */ | static int nfs3_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr) | /* One function for each procedure in the NFS protocol. */
static int nfs3_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr) | {
struct rpc_message msg = {
.rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR],
.rpc_argp = fhandle,
.rpc_resp = fattr,
};
int status;
dprintk("NFS call getattr\n");
nfs_fattr_init(fattr);
status = rpc_call_sync(server->client, &msg, 0);
dprintk("NFS reply getattr: %d\n", status);
return status;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Deinitializes the LPUART peripheral registers to their default reset values. */ | void LPUART_DeInit(void) | /* Deinitializes the LPUART peripheral registers to their default reset values. */
void LPUART_DeInit(void) | {
RCC_EnableRETPeriphReset(RCC_RET_PERIPH_LPUART, ENABLE);
RCC_EnableRETPeriphReset(RCC_RET_PERIPH_LPUART, DISABLE);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Delete the tcb from the connection and destroy it. */ | VOID IScsiDelTcb(IN ISCSI_TCB *Tcb) | /* Delete the tcb from the connection and destroy it. */
VOID IScsiDelTcb(IN ISCSI_TCB *Tcb) | {
RemoveEntryList (&Tcb->Link);
FreePool (Tcb);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* configure the GPIO ports
, V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */ | void gpio_configuration(void) | /* configure the GPIO ports
, V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
void gpio_configuration(void) | {
rcu_periph_clock_enable(RCU_GPIOB);
gpio_mode_set(GPIOB, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_4);
gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ,GPIO_PIN_4);
gpio_af_set(GPIOB, GPIO_AF_1, GPIO_PIN_4);
gpio_mode_set(GPIOB, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_5);
gpio_outpu... | liuxuming/trochili | C++ | Apache License 2.0 | 132 |
/* Set the OFile's current directory cursor to the list head. */ | VOID FatResetODirCursor(IN FAT_OFILE *OFile) | /* Set the OFile's current directory cursor to the list head. */
VOID FatResetODirCursor(IN FAT_OFILE *OFile) | {
FAT_ODIR *ODir;
ODir = OFile->ODir;
ASSERT (ODir != NULL);
ODir->CurrentCursor = &(ODir->ChildList);
ODir->CurrentPos = 0;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enable or disable the power down mode during Sleep mode. */ | void FLASH_SLEEPPowerDownCmd(FunctionalState NewState) | /* Enable or disable the power down mode during Sleep mode. */
void FLASH_SLEEPPowerDownCmd(FunctionalState NewState) | {
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
FLASH->ACR |= FLASH_ACR_SLEEP_PD;
}
else
{
FLASH->ACR &= (uint32_t)(~((uint32_t)FLASH_ACR_SLEEP_PD));
}
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* terminate note - if free flag is true, free the terminated voice */ | static void terminate_note1(struct snd_emux *emu, int note, struct snd_midi_channel *chan, int free) | /* terminate note - if free flag is true, free the terminated voice */
static void terminate_note1(struct snd_emux *emu, int note, struct snd_midi_channel *chan, int free) | {
int i;
struct snd_emux_voice *vp;
unsigned long flags;
spin_lock_irqsave(&emu->voice_lock, flags);
for (i = 0; i < emu->max_voices; i++) {
vp = &emu->voices[i];
if (STATE_IS_PLAYING(vp->state) && vp->chan == chan &&
vp->key == note)
terminate_voice(emu, vp, free);
}
spin_unlock_irqrestore(&emu->v... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Find a network profile through its' SSId and securit type, and the SSId is an ascii string. */ | WIFI_MGR_NETWORK_PROFILE* WifiMgrGetProfileByAsciiSSId(IN CHAR8 *SSId, IN UINT8 SecurityType, IN LIST_ENTRY *ProfileList) | /* Find a network profile through its' SSId and securit type, and the SSId is an ascii string. */
WIFI_MGR_NETWORK_PROFILE* WifiMgrGetProfileByAsciiSSId(IN CHAR8 *SSId, IN UINT8 SecurityType, IN LIST_ENTRY *ProfileList) | {
CHAR16 SSIdUniCode[SSID_STORAGE_SIZE];
if (SSId == NULL) {
return NULL;
}
if (AsciiStrToUnicodeStrS (SSId, SSIdUniCode, SSID_STORAGE_SIZE) != RETURN_SUCCESS) {
return NULL;
}
return WifiMgrGetProfileByUnicodeSSId (SSIdUniCode, SecurityType, ProfileList);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Return: A string for indenting with two spaces per level is returned. */ | static const char* indent_string(int level) | /* Return: A string for indenting with two spaces per level is returned. */
static const char* indent_string(int level) | {
const char *indent = " ";
const int max = strlen(indent);
level = min(max, level * 2);
return &indent[max - level];
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This function is useful when dealing with flash, for checking whether a data block is erased and thus does not need to be programmed. */ | static int cros_ec_data_is_erased(const uint32_t *data, int size) | /* This function is useful when dealing with flash, for checking whether a data block is erased and thus does not need to be programmed. */
static int cros_ec_data_is_erased(const uint32_t *data, int size) | {
assert(!(size & 3));
size /= sizeof(uint32_t);
for (; size > 0; size -= 4, data++)
if (*data != -1U)
return 0;
return 1;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Function for dispatching the correct application main state entry action. */ | static void state_entry_action_run(void) | /* Function for dispatching the correct application main state entry action. */
static void state_entry_action_run(void) | {
switch (m_state)
{
case STATE_IDLE:
state_idle_entry_run();
break;
case STATE_STORE:
state_store_entry_run();
break;
case STATE_DATA_ERASE_WITH_SWAP:
state_data_erase_swap_entry_run();
break;
case STATE_DAT... | labapart/polymcu | C++ | null | 201 |
/* Enforce memory map attributes. This function will set EfiRuntimeServicesData/EfiMemoryMappedIO/EfiMemoryMappedIOPortSpace to be EFI_MEMORY_XP. */ | STATIC VOID EnforceMemoryMapAttribute(IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, IN UINTN MemoryMapSize, IN UINTN DescriptorSize) | /* Enforce memory map attributes. This function will set EfiRuntimeServicesData/EfiMemoryMappedIO/EfiMemoryMappedIOPortSpace to be EFI_MEMORY_XP. */
STATIC VOID EnforceMemoryMapAttribute(IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, IN UINTN MemoryMapSize, IN UINTN DescriptorSize) | {
EFI_MEMORY_DESCRIPTOR *MemoryMapEntry;
EFI_MEMORY_DESCRIPTOR *MemoryMapEnd;
MemoryMapEntry = MemoryMap;
MemoryMapEnd = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)MemoryMap + MemoryMapSize);
while ((UINTN)MemoryMapEntry < (UINTN)MemoryMapEnd) {
if (MemoryMapEntry->Attribute != 0) {
} else {
switch ... | tianocore/edk2 | C++ | Other | 4,240 |
/* The caller can determine if functions defined in the Arm TRNG ABI are present in the ABI implementation. */ | STATIC RETURN_STATUS EFIAPI GetArmTrngFeatures(IN CONST UINT32 FunctionId, OUT UINT32 *Capability OPTIONAL) | /* The caller can determine if functions defined in the Arm TRNG ABI are present in the ABI implementation. */
STATIC RETURN_STATUS EFIAPI GetArmTrngFeatures(IN CONST UINT32 FunctionId, OUT UINT32 *Capability OPTIONAL) | {
ARM_MONITOR_ARGS Parameters;
RETURN_STATUS Status;
ZeroMem (&Parameters, sizeof (Parameters));
Parameters.Arg0 = ARM_SMC_ID_TRNG_FEATURES;
Parameters.Arg1 = FunctionId;
ArmMonitorCall (&Parameters);
Status = TrngStatusToReturnStatus (Parameters.Arg0);
if (RETURN_ERROR (Status)) {
return Statu... | tianocore/edk2 | C++ | Other | 4,240 |
/* Sets the netlabel socket state on sk from parent */ | static int smack_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid) | /* Sets the netlabel socket state on sk from parent */
static int smack_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid) | {
struct netlbl_lsm_secattr secattr;
struct sock *sk;
char smack[SMK_LABELLEN];
int family = PF_INET;
u32 s;
int rc;
if (sock != NULL) {
sk = sock->sk;
if (sk->sk_family != PF_INET && sk->sk_family != PF_INET6)
return 0;
family = sk->sk_family;
}
netlbl_secattr_init(&secattr);
rc = netlbl_skbuff_geta... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Information regarding the number of caches and their sizes, frequency of operation, slot numbers is all considered platform-related information and is not provided by this service. */ | EFI_STATUS EFIAPI PeiGetProcessorInfo(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_MP_SERVICES_PPI *This, IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer) | /* Information regarding the number of caches and their sizes, frequency of operation, slot numbers is all considered platform-related information and is not provided by this service. */
EFI_STATUS EFIAPI PeiGetProcessorInfo(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_MP_SERVICES_PPI *This, IN UINTN ProcessorNu... | {
return MpInitLibGetProcessorInfo (ProcessorNumber, ProcessorInfoBuffer, NULL);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If 16-bit operations are not supported, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ | UINT16 EFIAPI BitFieldOr16(IN UINT16 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData) | /* If 16-bit operations are not supported, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI BitFiel... | {
ASSERT (EndBit < 16);
ASSERT (StartBit <= EndBit);
return (UINT16)InternalBaseLibBitFieldOrUint (Operand, StartBit, EndBit, OrData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Initializes the AES Keys according to the specified parameters in the AES_KeyInitStruct. */ | void AES_KeyInit(AES_KeyInitTypeDef *AES_KeyInitStruct) | /* Initializes the AES Keys according to the specified parameters in the AES_KeyInitStruct. */
void AES_KeyInit(AES_KeyInitTypeDef *AES_KeyInitStruct) | {
AES->KEYR0 = AES_KeyInitStruct->AES_Key0;
AES->KEYR1 = AES_KeyInitStruct->AES_Key1;
AES->KEYR2 = AES_KeyInitStruct->AES_Key2;
AES->KEYR3 = AES_KeyInitStruct->AES_Key3;
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* This request allows the host to specify typical asynchronous line-character formatting properties This request applies to asynchronous byte stream data class interfaces and endpoints. */ | static USBH_StatusTypeDef SetLineCoding(USBH_HandleTypeDef *phost, CDC_LineCodingTypeDef *linecodin) | /* This request allows the host to specify typical asynchronous line-character formatting properties This request applies to asynchronous byte stream data class interfaces and endpoints. */
static USBH_StatusTypeDef SetLineCoding(USBH_HandleTypeDef *phost, CDC_LineCodingTypeDef *linecodin) | {
phost->Control.setup.b.bmRequestType = USB_H2D | USB_REQ_TYPE_CLASS | \
USB_REQ_RECIPIENT_INTERFACE;
phost->Control.setup.b.bRequest = CDC_SET_LINE_CODING;
phost->Control.setup.b.wValue.w = 0;
phost->Control.setup.b.wIndex.w = 0;
phost->Control.setup.b.wLength.w = LINE_CODING_S... | labapart/polymcu | C++ | null | 201 |
/* Get call stack, return levels of call stack trace output buffer size buffer size offset which lvl start */ | int backtrace_now_get(void *trace[], int size, int offset) | /* Get call stack, return levels of call stack trace output buffer size buffer size offset which lvl start */
int backtrace_now_get(void *trace[], int size, int offset) | {
char *PC;
long *SP;
int lvl;
int ret;
SP = RHINO_GET_SP();
PC = RHINO_GET_PC();
memset(trace, 0, size * sizeof(void *));
for (lvl = 0; lvl < BT_LVL_LIMIT; lvl++) {
ret = backtraceFromStack(&SP, &PC, NULL);
if (ret != 0) {
break;
}
if (lv... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* The use of a stream makes this function safer than the version without stream. */ | UINT32 EFIAPI AmlRdStreamGetRdSize(IN CONST AML_STREAM *FStream) | /* The use of a stream makes this function safer than the version without stream. */
UINT32 EFIAPI AmlRdStreamGetRdSize(IN CONST AML_STREAM *FStream) | {
CONST AML_RD_HEADER *CurrRdElement;
if (!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream))
{
ASSERT (0);
return 0;
}
CurrRdElement = (CONST AML_RD_HEADER *)AmlStreamGetCurrPos (FStream);
if (CurrRdElement == NULL) {
ASSERT (0);
return 0... | tianocore/edk2 | C++ | Other | 4,240 |
/* Event handler for the CCID_PC_to_RDR_IccPowerOff message. This message is sent to the device whenever an application at the host wants to send a power off signal to a slot. */ | uint8_t CCID_IccPowerOff(uint8_t Slot, uint8_t *const Error) | /* Event handler for the CCID_PC_to_RDR_IccPowerOff message. This message is sent to the device whenever an application at the host wants to send a power off signal to a slot. */
uint8_t CCID_IccPowerOff(uint8_t Slot, uint8_t *const Error) | {
if (Slot == 0)
{
*Error = CCID_ERROR_NO_ERROR;
return CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR | CCID_ICCSTATUS_NOICCPRESENT;
}
else
{
*Error = CCID_ERROR_SLOT_NOT_FOUND;
return CCID_COMMANDSTATUS_FAILED | CCID_ICCSTATUS_NOICCPRESENT;
}
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ | RETURN_STATUS EFIAPI SafeIntnToInt32(IN INTN Operand, OUT INT32 *Result) | /* If the conversion results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeIntnToInt32(IN INTN Operand, OUT INT32 *Result) | {
if (Result == NULL) {
return RETURN_INVALID_PARAMETER;
}
if (sizeof (UINTN) == sizeof (UINT32)) {
*Result = (INT32)Operand;
return RETURN_SUCCESS;
}
return SafeInt64ToInt32 ((INT64)Operand, Result);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Execute a caller provided function on all enabled CPUs. */ | EFI_STATUS MpServicesUnitTestStartupAllCPUs(IN MP_SERVICES MpServices, IN EFI_AP_PROCEDURE Procedure, IN UINTN TimeoutInMicroSeconds, IN VOID *ProcedureArgument) | /* Execute a caller provided function on all enabled CPUs. */
EFI_STATUS MpServicesUnitTestStartupAllCPUs(IN MP_SERVICES MpServices, IN EFI_AP_PROCEDURE Procedure, IN UINTN TimeoutInMicroSeconds, IN VOID *ProcedureArgument) | {
return MpServices.Ppi->StartupAllCPUs (MpServices.Ppi, Procedure, TimeoutInMicroSeconds, ProcedureArgument);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set the PCI-express register to snoop for events enabled in 'no_snoop'. */ | void e1000e_set_pcie_no_snoop(struct e1000_hw *hw, u32 no_snoop) | /* Set the PCI-express register to snoop for events enabled in 'no_snoop'. */
void e1000e_set_pcie_no_snoop(struct e1000_hw *hw, u32 no_snoop) | {
u32 gcr;
if (no_snoop) {
gcr = er32(GCR);
gcr &= ~(PCIE_NO_SNOOP_ALL);
gcr |= no_snoop;
ew32(GCR, gcr);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Atomic compare-and-set primitive.
The reading of the original value at <target>, the comparison, and the write of the new value (if it occurs) all happen atomically with respect to both interrupts and accesses of other processors to <target>. */ | int atomic_cas(atomic_t *target, atomic_val_t old_value, atomic_val_t new_value) | /* Atomic compare-and-set primitive.
The reading of the original value at <target>, the comparison, and the write of the new value (if it occurs) all happen atomically with respect to both interrupts and accesses of other processors to <target>. */
int atomic_cas(atomic_t *target, atomic_val_t old_value, atomic_val_t ... | {
unsigned int key;
int ret = 0;
key = irq_lock();
if (*target == old_value) {
*target = new_value;
ret = 1;
}
irq_unlock(key);
return ret;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* this function is a POSIX compliant version, which shall perform a variety of control functions on devices. */ | int fcntl(int fildes, int cmd,...) | /* this function is a POSIX compliant version, which shall perform a variety of control functions on devices. */
int fcntl(int fildes, int cmd,...) | {
int ret = -1;
struct dfs_fd *d;
d = fd_get(fildes);
if (d)
{
void *arg;
va_list ap;
va_start(ap, cmd);
arg = va_arg(ap, void *);
va_end(ap);
ret = dfs_file_ioctl(d, cmd, arg);
fd_put(d);
}
else ret = -EBADF;
if (ret < 0)
{
... | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* brief Sets IRQ handler for given FLEXCOMM module. It is used by drivers register IRQ handler according to FLEXCOMM mode */ | void FLEXCOMM_SetIRQHandler(void *base, flexcomm_irq_handler_t handler, void *handle) | /* brief Sets IRQ handler for given FLEXCOMM module. It is used by drivers register IRQ handler according to FLEXCOMM mode */
void FLEXCOMM_SetIRQHandler(void *base, flexcomm_irq_handler_t handler, void *handle) | {
uint32_t instance;
instance = FLEXCOMM_GetInstance(base);
s_flexcommIrqHandler[instance] = NULL;
s_flexcommHandle[instance] = handle;
s_flexcommIrqHandler[instance] = handler;
SDK_ISR_EXIT_BARRIER;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Find dominator relationships. Assumes graph has been leveled. */ | static void find_dom(opt_state_t *opt_state, struct block *root) | /* Find dominator relationships. Assumes graph has been leveled. */
static void find_dom(opt_state_t *opt_state, struct block *root) | {
int i;
struct block *b;
bpf_u_int32 *x;
x = opt_state->all_dom_sets;
i = opt_state->n_blocks * opt_state->nodewords;
while (--i >= 0)
*x++ = 0xFFFFFFFFU;
for (i = opt_state->nodewords; --i >= 0;)
root->dom[i] = 0;
for (i = root->level; i >= 0; --i) {
for (b = opt_state->levels[i]; b; b = b->link) {
S... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Return the next available joystick instance ID This may be called by drivers from multiple threads, unprotected by any locks */ | SDL_JoystickID SDL_GetNextJoystickInstanceID() | /* Return the next available joystick instance ID This may be called by drivers from multiple threads, unprotected by any locks */
SDL_JoystickID SDL_GetNextJoystickInstanceID() | {
return SDL_AtomicIncRef(&SDL_next_joystick_instance_id);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Reads and returns the current value of FS. This function is only available on IA-32 and X64. */ | UINT16 EFIAPI AsmReadFs(VOID) | /* Reads and returns the current value of FS. This function is only available on IA-32 and X64. */
UINT16 EFIAPI AsmReadFs(VOID) | {
UINT16 Data;
__asm__ __volatile__ (
"mov %%fs, %0"
:"=a" (Data)
);
return Data;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The @minsec conversion range argument controls the time frame in seconds which must be covered by the runtime conversion with the calculated mult and shift factors. This guarantees that no 64bit overflow happens when the input value of the conversion is multiplied with the calculated mult factor. Larger ranges may r... | void clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec) | /* The @minsec conversion range argument controls the time frame in seconds which must be covered by the runtime conversion with the calculated mult and shift factors. This guarantees that no 64bit overflow happens when the input value of the conversion is multiplied with the calculated mult factor. Larger ranges may r... | {
u64 tmp;
u32 sft, sftacc= 32;
tmp = ((u64)minsec * from) >> 32;
while (tmp) {
tmp >>=1;
sftacc--;
}
for (sft = 32; sft > 0; sft--) {
tmp = (u64) to << sft;
do_div(tmp, from);
if ((tmp >> sftacc) == 0)
break;
}
*mult = tmp;
*shift = sft;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Callback for the Tx buffer reclaim timer. Runs with softirqs disabled. */ | static void sge_tx_reclaim_cb(unsigned long data) | /* Callback for the Tx buffer reclaim timer. Runs with softirqs disabled. */
static void sge_tx_reclaim_cb(unsigned long data) | {
int i;
struct sge *sge = (struct sge *)data;
for (i = 0; i < SGE_CMDQ_N; ++i) {
struct cmdQ *q = &sge->cmdQ[i];
if (!spin_trylock(&q->lock))
continue;
reclaim_completed_tx(sge, q);
if (i == 0 && q->in_use) {
writel(F_CMDQ0_ENABLE, sge->adapter->regs + A_SG_DOORBELL);
}
spin_unlock(&q->lock);
}
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ | UINT16 EFIAPI PciAndThenOr16(IN UINTN Address, IN UINT16 AndData, IN UINT16 OrData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciAndThenOr16(IN UINTN Address, IN UINT16 AndData, IN UINT16 OrData) | {
return PciCf8AndThenOr16 (Address, AndData, OrData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Clear USB Device Endpoint Buffer Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ | void USBD_ClearEPBuf(uint32_t EPNum) | /* Clear USB Device Endpoint Buffer Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_ClearEPBuf(uint32_t EPNum) | {
uint32_t cnt, i;
uint8_t *dataptr;
if (EPNum & USB_IN_MASK) {
EPNum &= ~USB_IN_MASK;
dataptr = (uint8_t *)EPBufInfo[EP_IN_IDX(EPNum)].buf_ptr;
cnt = EPBufInfo[EP_IN_IDX(EPNum)].buf_len;
for (i = 0; i < cnt; i++) {
dataptr[i] = 0;
}
} else... | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* must be called with the lock held and interrupts disabled. */ | static void enable_receive_interrupt(struct xircom_private *card) | /* must be called with the lock held and interrupts disabled. */
static void enable_receive_interrupt(struct xircom_private *card) | {
unsigned int val;
enter("enable_receive_interrupt");
val = inl(card->io_port + CSR7);
val = val | (1 << 6);
outl(val, card->io_port + CSR7);
leave("enable_receive_interrupt");
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Internal UARTs need to be initialized for the 8250 autoconfig to work properly. Note that the TX watermark initialization may not be needed once the 8250.c watermark handling code is merged. */ | static void __init omap_serial_reset(struct plat_serial8250_port *p) | /* Internal UARTs need to be initialized for the 8250 autoconfig to work properly. Note that the TX watermark initialization may not be needed once the 8250.c watermark handling code is merged. */
static void __init omap_serial_reset(struct plat_serial8250_port *p) | {
omap_serial_outp(p, UART_OMAP_MDR1, 0x07);
omap_serial_outp(p, UART_OMAP_SCR, 0x08);
omap_serial_outp(p, UART_OMAP_MDR1, 0x00);
if (!cpu_is_omap15xx()) {
omap_serial_outp(p, UART_OMAP_SYSC, 0x01);
while (!(omap_serial_in(p, UART_OMAP_SYSC) & 0x01));
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Detach a thread (thread storage can be reclaimed when thread terminates). */ | osStatus_t osThreadDetach(osThreadId_t thread_id) | /* Detach a thread (thread storage can be reclaimed when thread terminates). */
osStatus_t osThreadDetach(osThreadId_t thread_id) | {
EvrRtxThreadError(thread_id, (int32_t)osErrorISR);
status = osErrorISR;
} else {
status = __svcThreadDetach(thread_id);
}
return status;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Enable all interrupt lines previously disabled by suspend_device_irqs() that have the IRQ_SUSPENDED flag set. */ | void resume_device_irqs(void) | /* Enable all interrupt lines previously disabled by suspend_device_irqs() that have the IRQ_SUSPENDED flag set. */
void resume_device_irqs(void) | {
struct irq_desc *desc;
int irq;
for_each_irq_desc(irq, desc) {
unsigned long flags;
if (!(desc->status & IRQ_SUSPENDED))
continue;
raw_spin_lock_irqsave(&desc->lock, flags);
__enable_irq(desc, irq, true);
raw_spin_unlock_irqrestore(&desc->lock, flags);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Derive SHA256 HMAC-based Expand Key Derivation Function (HKDF). */ | BOOLEAN EFIAPI HkdfSha256Expand(IN CONST UINT8 *Prk, IN UINTN PrkSize, IN CONST UINT8 *Info, IN UINTN InfoSize, OUT UINT8 *Out, IN UINTN OutSize) | /* Derive SHA256 HMAC-based Expand Key Derivation Function (HKDF). */
BOOLEAN EFIAPI HkdfSha256Expand(IN CONST UINT8 *Prk, IN UINTN PrkSize, IN CONST UINT8 *Info, IN UINTN InfoSize, OUT UINT8 *Out, IN UINTN OutSize) | {
return HkdfMdExpand (EVP_sha256 (), Prk, PrkSize, Info, InfoSize, Out, OutSize);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Performs an atomic compare exchange operation on the 32-bit unsigned integer specified by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. The compare exchange operation must be performed using MP... | UINT32 EFIAPI InternalSyncCompareExchange32(IN volatile UINT32 *Value, IN UINT32 CompareValue, IN UINT32 ExchangeValue) | /* Performs an atomic compare exchange operation on the 32-bit unsigned integer specified by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. The compare exchange operation must be performed using MP... | {
return *Value != CompareValue ? *Value :
((*Value = ExchangeValue), CompareValue);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Only first 64MB of memory can be accessed via PCI. We use GFP_DMA to allocate safe buffers to do map/unmap. This is really ugly and we need a better way of specifying DMA-capable regions of memory. */ | void __init cmx2xx_pci_adjust_zones(int node, unsigned long *zone_size, unsigned long *zhole_size) | /* Only first 64MB of memory can be accessed via PCI. We use GFP_DMA to allocate safe buffers to do map/unmap. This is really ugly and we need a better way of specifying DMA-capable regions of memory. */
void __init cmx2xx_pci_adjust_zones(int node, unsigned long *zone_size, unsigned long *zhole_size) | {
unsigned int sz = SZ_64M >> PAGE_SHIFT;
if (machine_is_armcore()) {
pr_info("Adjusting zones for CM-X2XX\n");
if (node || (zone_size[0] <= sz))
return;
zone_size[1] = zone_size[0] - sz;
zone_size[0] = sz;
zhole_size[1] = zhole_size[0];
zhole_size[0] = 0;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* update the variables "mtdids" and "mtdparts" with boot, tee and user strings */ | static void board_set_mtdparts(const char *dev, char *mtdids, char *mtdparts, const char *boot, const char *tee, const char *user) | /* update the variables "mtdids" and "mtdparts" with boot, tee and user strings */
static void board_set_mtdparts(const char *dev, char *mtdids, char *mtdparts, const char *boot, const char *tee, const char *user) | {
if (mtdids[0] != '\0')
strcat(mtdids, ",");
strcat(mtdids, dev);
strcat(mtdids, "=");
strcat(mtdids, dev);
if (mtdparts[0] != '\0')
strncat(mtdparts, ";", MTDPARTS_LEN);
else
strcat(mtdparts, "mtdparts=");
strncat(mtdparts, dev, MTDPARTS_LEN);
strncat(mtdparts, ":", MTDPARTS_LEN);
if (boot) {
strncat... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Handle RX transaction on non-ISO endpoint. The ep argument is a physical endpoint number for a non-ISO IN endpoint in the range 1 to 15. */ | static void spear_udc_epn_rx(int ep) | /* Handle RX transaction on non-ISO endpoint. The ep argument is a physical endpoint number for a non-ISO IN endpoint in the range 1 to 15. */
static void spear_udc_epn_rx(int ep) | {
int nbytes = 0;
struct urb *urb;
struct usb_endpoint_instance *endpoint = spear_find_ep(ep);
if (endpoint) {
urb = endpoint->rcv_urb;
if (urb) {
u8 *cp = urb->buffer + urb->actual_length;
nbytes = (readl(&outep_regs_p[ep].endp_status) >> 11) &
0xfff;
usbgetpckfromfifo(ep, cp, nbytes);
usbd_... | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Enable allow_restart for a device if it is a disk. Adjust the queue_depth here also as is required by the documentation for struct scsi_host_template. */ | static int ibmvscsi_slave_configure(struct scsi_device *sdev) | /* Enable allow_restart for a device if it is a disk. Adjust the queue_depth here also as is required by the documentation for struct scsi_host_template. */
static int ibmvscsi_slave_configure(struct scsi_device *sdev) | {
struct Scsi_Host *shost = sdev->host;
unsigned long lock_flags = 0;
spin_lock_irqsave(shost->host_lock, lock_flags);
if (sdev->type == TYPE_DISK) {
sdev->allow_restart = 1;
blk_queue_rq_timeout(sdev->request_queue, 120 * HZ);
}
scsi_adjust_queue_depth(sdev, 0, shost->cmd_per_lun);
spin_unlock_irqrestore(sh... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Calculate the sum of two Big Numbers. Please note, all "out" Big number arguments should be properly initialized by calling to BigNumInit() or BigNumFromBin() functions. */ | BOOLEAN EFIAPI BigNumAdd(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes) | /* Calculate the sum of two Big Numbers. Please note, all "out" Big number arguments should be properly initialized by calling to BigNumInit() or BigNumFromBin() functions. */
BOOLEAN EFIAPI BigNumAdd(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes) | {
return (BOOLEAN)BN_add (BnRes, BnA, BnB);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* basic invalidatepage code, this waits on any locked or writeback ranges corresponding to the page, and then deletes any extent state records from the tree */ | int extent_invalidatepage(struct extent_io_tree *tree, struct page *page, unsigned long offset) | /* basic invalidatepage code, this waits on any locked or writeback ranges corresponding to the page, and then deletes any extent state records from the tree */
int extent_invalidatepage(struct extent_io_tree *tree, struct page *page, unsigned long offset) | {
u64 start = ((u64)page->index << PAGE_CACHE_SHIFT);
u64 end = start + PAGE_CACHE_SIZE - 1;
size_t blocksize = page->mapping->host->i_sb->s_blocksize;
start += (offset + blocksize - 1) & ~(blocksize - 1);
if (start > end)
return 0;
lock_extent(tree, start, end, GFP_NOFS);
wait_on_page_writeback(page);
clear_... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns the 4 bit value that specifies the given aspect ratio. This may be one of the standard aspect ratios or it specifies that the aspect will be stored explicitly later. */ | av_const int ff_h263_aspect_to_info(AVRational aspect) | /* Returns the 4 bit value that specifies the given aspect ratio. This may be one of the standard aspect ratios or it specifies that the aspect will be stored explicitly later. */
av_const int ff_h263_aspect_to_info(AVRational aspect) | {1,1};
for(i=1; i<6; i++){
if(av_cmp_q(ff_h263_pixel_aspect[i], aspect) == 0){
return i;
}
}
return FF_ASPECT_EXTENDED;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* The scsi_ioctl_get_pci() function places into arg the value pci_dev::slot_name (8 characters) for the PCI device (if any). Returns: 0 on success -ENXIO if there isn't a PCI device pointer (could be because the SCSI driver hasn't been updated yet, or because it isn't a SCSI device) any copy_to_user() error on failure... | static int scsi_ioctl_get_pci(struct scsi_device *sdev, void __user *arg) | /* The scsi_ioctl_get_pci() function places into arg the value pci_dev::slot_name (8 characters) for the PCI device (if any). Returns: 0 on success -ENXIO if there isn't a PCI device pointer (could be because the SCSI driver hasn't been updated yet, or because it isn't a SCSI device) any copy_to_user() error on failure... | {
struct device *dev = scsi_get_device(sdev->host);
const char *name;
if (!dev)
return -ENXIO;
name = dev_name(dev);
return copy_to_user(arg, name, min(strlen(name), (size_t)20))
? -EFAULT: 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Retire a pxa27x usb request. Endpoint must be locked. */ | static void req_done(struct pxa_ep *ep, struct pxa27x_request *req, int status) | /* Retire a pxa27x usb request. Endpoint must be locked. */
static void req_done(struct pxa_ep *ep, struct pxa27x_request *req, int status) | {
ep_del_request(ep, req);
if (likely(req->req.status == -EINPROGRESS))
req->req.status = status;
else
status = req->req.status;
if (status && status != -ESHUTDOWN)
ep_dbg(ep, "complete req %p stat %d len %u/%u\n",
&req->req, status,
req->req.actual, req->req.length);
req->req.complete(&req->udc_usb_ep... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ | SWIGRUNTIME swig_type_info* SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) | /* We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */
SWIGRUNTIME swig_type_info* SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) | {
swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
if (ret) {
return ret;
} else {
swig_module_info *iter = start;
do {
register size_t i = 0;
for (; i < iter->size; ++i) {
if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
return ... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* If HmacSha384Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI HmacSha384SetKey(OUT VOID *HmacSha384Context, IN CONST UINT8 *Key, IN UINTN KeySize) | /* If HmacSha384Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI HmacSha384SetKey(OUT VOID *HmacSha384Context, IN CONST UINT8 *Key, IN UINTN KeySize) | {
return HmacMdSetKey (EVP_sha384 (), HmacSha384Context, Key, KeySize);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Unregister function support of a USB device function.
Must be invoked when USB device is stopped. */ | void usbdc_unregister_function(struct usbdf_driver *func) | /* Unregister function support of a USB device function.
Must be invoked when USB device is stopped. */
void usbdc_unregister_function(struct usbdf_driver *func) | {
list_delete_element(&usbdc.func_list, func);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Check if transmitter in idle (tx reg empty) */ | static unsigned int a2f_port_tx_empty(struct uart_port *port) | /* Check if transmitter in idle (tx reg empty) */
static unsigned int a2f_port_tx_empty(struct uart_port *port) | {
volatile struct a2f_cuart_regs *regs = a2f_cuart_regs_ptr(port);
unsigned long flags;
u32 ret;
spin_lock_irqsave(&port->lock, flags);
ret = (regs->status & A2F_CORE_UART_ST_TXRDY) ? TIOCSER_TEMT : 0;
spin_unlock_irqrestore(&port->lock, flags);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* . Function: smc_enable . Purpose: let the chip talk to the outside work . Method: . 1. Enable the transmitter . 2. Enable the receiver . 3. Enable interrupts */ | static void smc_enable(int ioaddr) | /* . Function: smc_enable . Purpose: let the chip talk to the outside work . Method: . 1. Enable the transmitter . 2. Enable the receiver . 3. Enable interrupts */
static void smc_enable(int ioaddr) | {
SMC_SELECT_BANK( 0 );
outw( TCR_NORMAL, ioaddr + TCR );
outw( RCR_NORMAL, ioaddr + RCR );
SMC_SELECT_BANK( 2 );
outb( SMC_INTERRUPT_MASK, ioaddr + INT_MASK );
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns zero if successful, or a negative error code on failure. */ | int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, int type, struct device *data, size_t size, size_t max) | /* Returns zero if successful, or a negative error code on failure. */
int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, int type, struct device *data, size_t size, size_t max) | {
substream->dma_buffer.dev.type = type;
substream->dma_buffer.dev.dev = data;
return snd_pcm_lib_preallocate_pages1(substream, size, max);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set new limits for the move of the pointer */ | void POINTER_SetRect(s16 x, s16 y, s16 width, s16 height) | /* Set new limits for the move of the pointer */
void POINTER_SetRect(s16 x, s16 y, s16 width, s16 height) | {
POINTER_Info.X_PosMin = x;
if( POINTER_Info.xPos < POINTER_Info.X_PosMin )
{
POINTER_Info.xPos = POINTER_Info.X_PosMin;
}
POINTER_Info.X_PosMax = x + width - 1;
if( POINTER_Info.xPos > POINTER_Info.X_PosMax )
{
POINTER_Info.xPos = POINTER_Info.X_PosMax;
}
POINTER_Inf... | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* This function returns positive resulting integer in case of success and a negative error code in case of failure. */ | static int __init bytes_str_to_int(const char *str) | /* This function returns positive resulting integer in case of success and a negative error code in case of failure. */
static int __init bytes_str_to_int(const char *str) | {
char *endp;
unsigned long result;
result = simple_strtoul(str, &endp, 0);
if (str == endp || result >= INT_MAX) {
pr_err("UBI error: incorrect bytes count: \"%s\"\n", str);
return -EINVAL;
}
switch (*endp) {
case 'G':
result *= 1024;
case 'M':
result *= 1024;
case 'K':
result *= 1024;
if (endp[1]... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Spin wait for MSTATUS bit to be set.
This spins forever for the bits to be set. */ | static void mcux_i3c_status_wait(I3C_Type *base, uint32_t mask) | /* Spin wait for MSTATUS bit to be set.
This spins forever for the bits to be set. */
static void mcux_i3c_status_wait(I3C_Type *base, uint32_t mask) | {
while (!mcux_i3c_status_is_set(base, mask)) {
k_busy_wait(1);
};
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Sets or resets the analogue monitoring on VDDA Power source. */ | FLASH_Status FLASH_OB_VDDAConfig(uint8_t OB_VDDA_ANALOG) | /* Sets or resets the analogue monitoring on VDDA Power source. */
FLASH_Status FLASH_OB_VDDAConfig(uint8_t OB_VDDA_ANALOG) | {
FLASH_Status status = FLASH_COMPLETE;
assert_param(IS_OB_VDDA_ANALOG(OB_VDDA_ANALOG));
FLASH->OPTKEYR = FLASH_KEY1;
FLASH->OPTKEYR = FLASH_KEY2;
status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
if(status == FLASH_COMPLETE)
{
FLASH->CR |= FLASH_CR_OPTPG;
OB->USER = OB_VDDA_ANALOG |0xDF;
... | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */ | UINT8 EFIAPI MmioRead8(IN UINTN Address) | /* If 8-bit MMIO register operations are not supported, then ASSERT(). */
UINT8 EFIAPI MmioRead8(IN UINTN Address) | {
UINT8 Value;
BOOLEAN Flag;
Flag = FilterBeforeMmIoRead (FilterWidth8, Address, &Value);
if (Flag) {
Value = MmioRead8Internal (Address);
}
FilterAfterMmIoRead (FilterWidth8, Address, &Value);
return Value;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Change the direction of a GPIO pin to input */ | static int kinetis_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) | /* Change the direction of a GPIO pin to input */
static int kinetis_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) | {
KINETIS_GPIO(KINETIS_GPIO_GETPORT(gpio))->pddr &=
~(1 << KINETIS_GPIO_GETPIN(gpio));
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enables or disables the TIM peripheral Main Outputs. */ | void TIM_EnableCtrlPwmOutputs(TIM_Module *TIMx, FunctionalState Cmd) | /* Enables or disables the TIM peripheral Main Outputs. */
void TIM_EnableCtrlPwmOutputs(TIM_Module *TIMx, FunctionalState Cmd) | {
assert_param(IsTimList2Module(TIMx));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
TIMx->BKDT |= TIM_BKDT_MOEN;
}
else
{
TIMx->BKDT &= (uint16_t)(~((uint16_t)TIM_BKDT_MOEN));
}
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Notice that afterwards, you need to construct the context again anyway to parse another JSON object, and the callback is reset then to the main, schema-interpreting one. The construction action is very lightweight. */ | void lejp_change_callback(struct lejp_ctx *ctx, char(*callback)(struct lejp_ctx *ctx, char reason)) | /* Notice that afterwards, you need to construct the context again anyway to parse another JSON object, and the callback is reset then to the main, schema-interpreting one. The construction action is very lightweight. */
void lejp_change_callback(struct lejp_ctx *ctx, char(*callback)(struct lejp_ctx *ctx, char reason)... | {
ctx->callback(ctx, LEJPCB_DESTRUCTED);
ctx->callback = callback;
ctx->callback(ctx, LEJPCB_CONSTRUCTED);
ctx->callback(ctx, LEJPCB_START);
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* This function also checks for duplicate ACPI Processor UIDs. */ | STATIC EFI_STATUS AddGICCList(IN EFI_ACPI_6_5_GIC_STRUCTURE *Gicc, IN CONST CM_ARM_GICC_INFO *GicCInfo, IN UINT32 GicCCount, IN CONST UINT8 MadtRev) | /* This function also checks for duplicate ACPI Processor UIDs. */
STATIC EFI_STATUS AddGICCList(IN EFI_ACPI_6_5_GIC_STRUCTURE *Gicc, IN CONST CM_ARM_GICC_INFO *GicCInfo, IN UINT32 GicCCount, IN CONST UINT8 MadtRev) | {
BOOLEAN IsAcpiProcUidDuplicated;
ASSERT (Gicc != NULL);
ASSERT (GicCInfo != NULL);
IsAcpiProcUidDuplicated = FindDuplicateValue (
GicCInfo,
GicCCount,
sizeof (CM_ARM_GICC_INFO),
IsAcpiUidEq... | tianocore/edk2 | C++ | Other | 4,240 |
/* USBH_InterruptSendData Sends the data on Interrupt OUT Endpoint. */ | USBH_StatusTypeDef USBH_InterruptSendData(USBH_HandleTypeDef *phost, uint8_t *buff, uint8_t length, uint8_t pipe_num) | /* USBH_InterruptSendData Sends the data on Interrupt OUT Endpoint. */
USBH_StatusTypeDef USBH_InterruptSendData(USBH_HandleTypeDef *phost, uint8_t *buff, uint8_t length, uint8_t pipe_num) | {
USBH_LL_SubmitURB (phost,
pipe_num,
0,
USBH_EP_INTERRUPT,
USBH_PID_DATA,
buff,
length,
0);
return USBH... | micropython/micropython | C++ | Other | 18,334 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.