docstring
stringlengths 22
576
| signature
stringlengths 9
317
| prompt
stringlengths 57
886
| code
stringlengths 20
1.36k
| repository
stringclasses 49
values | language
stringclasses 2
values | license
stringclasses 9
values | stars
int64 15
21.3k
|
|---|---|---|---|---|---|---|---|
/* This API is used to get the sleep duration in the register 0x11 bit 1 to 3. */
|
BMG160_RETURN_FUNCTION_TYPE bmg160_get_sleep_durn(u8 *v_durn_u8)
|
/* This API is used to get the sleep duration in the register 0x11 bit 1 to 3. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_sleep_durn(u8 *v_durn_u8)
|
{
BMG160_RETURN_FUNCTION_TYPE comres = ERROR;
u8 v_data_u8 = BMG160_INIT_VALUE;
if (p_bmg160 == BMG160_NULL)
{
return E_BMG160_NULL_PTR;
}
else
{
comres = p_bmg160->BMG160_BUS_READ_FUNC(p_bmg160->dev_addr,
BMG160_MODELPM1_ADDR_SLEEP_DURN__REG,
&v_data_u8, BMG160_GEN_READ_WRITE_DATA_LENGTH);
*v_durn_u8 = BMG160_GET_BITSLICE(v_data_u8,
BMG160_MODELPM1_ADDR_SLEEP_DURN);
}
return comres;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* And one of the values is included from this group: */
|
uint32_t HibernateTamperStatusGet(void)
|
/* And one of the values is included from this group: */
uint32_t HibernateTamperStatusGet(void)
|
{
uint32_t ui32Status, ui32Reg;
ui32Reg = HWREG(HIB_TPSTAT);
ui32Status = (ui32Reg & (HIB_TPSTAT_XOSCST | HIB_TPSTAT_XOSCFAIL));
ui32Status |= ((ui32Reg & HIB_TPSTAT_XOSCST) ? 0 :
HIBERNATE_TAMPER_STATUS_EXT_OSC_ACTIVE);
ui32Status |= ((ui32Reg & HIB_TPSTAT_XOSCFAIL) ? 0 :
HIBERNATE_TAMPER_STATUS_EXT_OSC_VALID);
ui32Status |= ((ui32Reg & HIB_TPSTAT_STATE_M) << 3);
if ((ui32Reg & HIB_TPSTAT_STATE_M) == 0)
{
ui32Status |= HIBERNATE_TAMPER_STATUS_INACTIVE;
}
return (ui32Status);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns the current value of the hash filter used to control reception of VLAN-tagged frames. */
|
uint32_t EMACVLANHashFilterGet(uint32_t ui32Base)
|
/* Returns the current value of the hash filter used to control reception of VLAN-tagged frames. */
uint32_t EMACVLANHashFilterGet(uint32_t ui32Base)
|
{
ASSERT(ui32Base == EMAC0_BASE);
return (HWREG(ui32Base + EMAC_O_VLANHASH));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Obtain the GPIO descriptor from the number specified in param. */
|
int32_t gpio_get(struct gpio_desc **desc, const struct gpio_init_param *param)
|
/* Obtain the GPIO descriptor from the number specified in param. */
int32_t gpio_get(struct gpio_desc **desc, const struct gpio_init_param *param)
|
{
if (!desc || !param)
return FAILURE;
(*desc) = calloc(1, sizeof(**desc));
if (!(*desc))
return FAILURE;
(*desc)->number = param->number;
if (nb_gpio == 0)
if (SUCCESS != adi_gpio_Init(mem_gpio_handler,
ADI_GPIO_MEMORY_SIZE)) {
free(*desc);
*desc = NULL;
return FAILURE;
}
nb_gpio++;
return SUCCESS;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Fails with error message from ODBC Inputs: type: type of handle used in operation handle: handle used in operation */
|
static int fail(lua_State *L, const SQLSMALLINT type, const SQLHANDLE handle)
|
/* Fails with error message from ODBC Inputs: type: type of handle used in operation handle: handle used in operation */
static int fail(lua_State *L, const SQLSMALLINT type, const SQLHANDLE handle)
|
{
ret = SQLGetDiagRec(type, handle, i, State, &NativeError, Msg,
sizeof(Msg), &MsgSize);
if (ret == SQL_NO_DATA) break;
luaL_addlstring(&b, Msg, MsgSize);
luaL_putchar(&b, '\n');
i++;
}
luaL_pushresult(&b);
return 2;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* Enables SIR (IrDA) mode on the specified UART. */
|
void UARTEnableIrDA(unsigned long ulBase)
|
/* Enables SIR (IrDA) mode on the specified UART. */
void UARTEnableIrDA(unsigned long ulBase)
|
{
xASSERT(UARTBaseValid(ulBase));
xHWREG(ulBase + UART_FUN_SEL) = UART_FUN_SEL_IRDA_EN;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Note that with only one concurrent reader and one concurrent writer, you don't need extra locking to use these functions. */
|
int kfifo_from_user(struct kfifo *fifo, const void __user *from, unsigned int len, unsigned *total)
|
/* Note that with only one concurrent reader and one concurrent writer, you don't need extra locking to use these functions. */
int kfifo_from_user(struct kfifo *fifo, const void __user *from, unsigned int len, unsigned *total)
|
{
int ret;
len = min(kfifo_avail(fifo), len);
ret = __kfifo_from_user_data(fifo, from, len, 0, total);
if (ret)
return ret;
__kfifo_add_in(fifo, len);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Returns: a signed 64-bit/8-byte value read from @stream or %0 if an error occurred. */
|
gint64 g_data_input_stream_read_int64(GDataInputStream *stream, GCancellable *cancellable, GError **error)
|
/* Returns: a signed 64-bit/8-byte value read from @stream or %0 if an error occurred. */
gint64 g_data_input_stream_read_int64(GDataInputStream *stream, GCancellable *cancellable, GError **error)
|
{
gint64 v;
g_return_val_if_fail (G_IS_DATA_INPUT_STREAM (stream), 0);
if (read_data (stream, &v, 8, cancellable, error))
{
switch (stream->priv->byte_order)
{
case G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN:
v = GINT64_FROM_BE (v);
break;
case G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN:
v = GINT64_FROM_LE (v);
break;
case G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN:
default:
break;
}
return v;
}
return 0;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Intel recommends to set DFR, LDR and TPR before enabling an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel document number 292116). So here it goes... */
|
static void bigsmp_init_apic_ldr(void)
|
/* Intel recommends to set DFR, LDR and TPR before enabling an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel document number 292116). So here it goes... */
static void bigsmp_init_apic_ldr(void)
|
{
unsigned long val;
int cpu = smp_processor_id();
apic_write(APIC_DFR, APIC_DFR_FLAT);
val = calculate_ldr(cpu);
apic_write(APIC_LDR, val);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Heuristically dissect a tvbuff containing a JXTA UDP Message */
|
static gboolean dissect_jxta_UDP_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
/* Heuristically dissect a tvbuff containing a JXTA UDP Message */
static gboolean dissect_jxta_UDP_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
{
int save_desegment_offset;
guint32 save_desegment_len;
int ret;
if (tvb_strneql(tvb, 0, JXTA_UDP_SIG, sizeof (JXTA_UDP_SIG)) != 0) {
return FALSE;
}
save_desegment_offset = pinfo->desegment_offset;
save_desegment_len = pinfo->desegment_len;
ret = dissect_jxta_udp(tvb, pinfo, tree, NULL);
if (ret < 0) {
pinfo->desegment_offset = save_desegment_offset;
pinfo->desegment_len = save_desegment_len;
return FALSE;
} else if (ret == 0) {
pinfo->desegment_offset = save_desegment_offset;
pinfo->desegment_len = save_desegment_len;
return FALSE;
} else {
return TRUE;
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* SCLP panic notifier: If we are suspended, we thaw SCLP in order to be able to print the panic message. */
|
static int sclp_panic_notify(struct notifier_block *self, unsigned long event, void *data)
|
/* SCLP panic notifier: If we are suspended, we thaw SCLP in order to be able to print the panic message. */
static int sclp_panic_notify(struct notifier_block *self, unsigned long event, void *data)
|
{
if (sclp_suspend_state == sclp_suspend_state_suspended)
sclp_undo_suspend(SCLP_PM_EVENT_THAW);
return NOTIFY_OK;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If 16-bit MMIO register operations are not supported, then ASSERT(). */
|
UINT16 EFIAPI S3MmioWrite16(IN UINTN Address, IN UINT16 Value)
|
/* If 16-bit MMIO register operations are not supported, then ASSERT(). */
UINT16 EFIAPI S3MmioWrite16(IN UINTN Address, IN UINT16 Value)
|
{
return InternalSaveMmioWrite16ValueToBootScript (Address, MmioWrite16 (Address, Value));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If EntryPoint is NULL, then ASSERT(). If NewStack is NULL, then ASSERT(). */
|
VOID EFIAPI InternalSwitchStack(IN SWITCH_STACK_ENTRY_POINT EntryPoint, IN VOID *Context1 OPTIONAL, IN VOID *Context2 OPTIONAL, IN VOID *NewStack, IN VA_LIST Marker)
|
/* If EntryPoint is NULL, then ASSERT(). If NewStack is NULL, then ASSERT(). */
VOID EFIAPI InternalSwitchStack(IN SWITCH_STACK_ENTRY_POINT EntryPoint, IN VOID *Context1 OPTIONAL, IN VOID *Context2 OPTIONAL, IN VOID *NewStack, IN VA_LIST Marker)
|
{
BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
JumpBuffer.Eip = (UINTN)EntryPoint;
JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID *);
JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2);
((VOID **)JumpBuffer.Esp)[1] = Context1;
((VOID **)JumpBuffer.Esp)[2] = Context2;
LongJump (&JumpBuffer, (UINTN)-1);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Disable compare match interrupt (CMPMIE). @rmtoll IER CMPMIE LPTIM_DisableIT_CMPM. */
|
void LPTIM_DisableIT_CMPM(LPTIM_Module *LPTIMx)
|
/* Disable compare match interrupt (CMPMIE). @rmtoll IER CMPMIE LPTIM_DisableIT_CMPM. */
void LPTIM_DisableIT_CMPM(LPTIM_Module *LPTIMx)
|
{
CLEAR_BIT(LPTIMx->INTEN, LPTIM_INTEN_CMPMIE);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Get the local APIC ID of the executing processor. */
|
UINT32 EFIAPI GetApicId(VOID)
|
/* Get the local APIC ID of the executing processor. */
UINT32 EFIAPI GetApicId(VOID)
|
{
UINT32 ApicId;
ASSERT (GetApicMode () == LOCAL_APIC_MODE_XAPIC);
if ((ApicId = GetInitialApicId ()) < 0x100) {
ApicId = ReadLocalApicReg (XAPIC_ID_OFFSET);
ApicId >>= 24;
}
return ApicId;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Function used to save the WEP keys for a selected interface */
|
void airpcap_if_save_driver_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info)
|
/* Function used to save the WEP keys for a selected interface */
void airpcap_if_save_driver_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info)
|
{
if (if_info->keysCollection != NULL)
airpcap_if_set_driver_keys(ad,if_info->keysCollection);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Reload the watchdog timer. (ie, pat the watchdog) */
|
static void at91_wdt_reset(void)
|
/* Reload the watchdog timer. (ie, pat the watchdog) */
static void at91_wdt_reset(void)
|
{
at91_sys_write(AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Fills each SDIO_CmdInitStruct member with its default value. */
|
void SDIO_CmdStructInit(SDIO_CmdInitTypeDef *SDIO_CmdInitStruct)
|
/* Fills each SDIO_CmdInitStruct member with its default value. */
void SDIO_CmdStructInit(SDIO_CmdInitTypeDef *SDIO_CmdInitStruct)
|
{
SDIO_CmdInitStruct->SDIO_Argument = 0x00;
SDIO_CmdInitStruct->SDIO_CmdIndex = 0x00;
SDIO_CmdInitStruct->SDIO_Response = SDIO_Response_No;
SDIO_CmdInitStruct->SDIO_Wait = SDIO_Wait_No;
SDIO_CmdInitStruct->SDIO_CPSM = SDIO_CPSM_Disable;
}
|
gcallipo/RadioDSP-Stm32f103
|
C++
|
Common Creative - Attribution 3.0
| 51
|
/* If Buffer is NULL, then ASSERT(). If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
|
VOID* EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
|
/* If Buffer is NULL, then ASSERT(). If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
VOID* EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
|
{
return InternalAllocateCopyPool (EfiBootServicesData, AllocationSize, Buffer);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Endpoint TX buffer release callback for nocopy sending. */
|
static int drop_tx_buffer(const struct device *instance, void *token, const void *data)
|
/* Endpoint TX buffer release callback for nocopy sending. */
static int drop_tx_buffer(const struct device *instance, void *token, const void *data)
|
{
struct backend_data *dev_data = instance->data;
int r;
r = release_tx_buffer(dev_data, data, -1);
if (r < 0) {
return r;
}
return 0;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Returns a pointer to the descriptor right after the given one, when parsing a Configuration descriptor. */
|
USBGenericDescriptor* USBGenericDescriptor_GetNextDescriptor(const USBGenericDescriptor *descriptor)
|
/* Returns a pointer to the descriptor right after the given one, when parsing a Configuration descriptor. */
USBGenericDescriptor* USBGenericDescriptor_GetNextDescriptor(const USBGenericDescriptor *descriptor)
|
{
return (USBGenericDescriptor *)
(((char *) descriptor) + USBGenericDescriptor_GetLength(descriptor));
}
|
opentx/opentx
|
C++
|
GNU General Public License v2.0
| 2,025
|
/* Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value in the target buffer. */
|
CONST VOID* EFIAPI InternalMemScanMem8(IN CONST VOID *Buffer, IN UINTN Length, IN UINT8 Value)
|
/* Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value in the target buffer. */
CONST VOID* EFIAPI InternalMemScanMem8(IN CONST VOID *Buffer, IN UINTN Length, IN UINT8 Value)
|
{
CONST UINT8 *Pointer;
Pointer = (CONST UINT8 *)Buffer;
do {
if (*Pointer == Value) {
return Pointer;
}
++Pointer;
} while (--Length != 0);
return NULL;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* @id: Pointer for hub id output, may be NULL */
|
int net_hub_id_for_client(NetClientState *nc, int *id)
|
/* @id: Pointer for hub id output, may be NULL */
int net_hub_id_for_client(NetClientState *nc, int *id)
|
{
NetHubPort *port;
if (nc->info->type == NET_CLIENT_OPTIONS_KIND_HUBPORT) {
port = DO_UPCAST(NetHubPort, nc, nc);
} else if (nc->peer != NULL && nc->peer->info->type ==
NET_CLIENT_OPTIONS_KIND_HUBPORT) {
port = DO_UPCAST(NetHubPort, nc, nc->peer);
} else {
return -ENOENT;
}
if (id) {
*id = port->hub->id;
}
return 0;
}
|
ve3wwg/teensy3_qemu
|
C++
|
Other
| 15
|
/* param base ASRC base pointer. param channelPair ASRC channel pair param handle ASRC eDMA handle pointer. param callback Pointer to user callback function. param txDmaHandle ASRC send edma handle pointer. param periphConfig peripheral configuration. param userData User parameter passed to the callback function. */
|
void ASRC_TransferInCreateHandleEDMA(ASRC_Type *base, asrc_edma_handle_t *handle, asrc_channel_pair_t channelPair, asrc_edma_callback_t callback, edma_handle_t *inDmaHandle, const asrc_p2p_edma_config_t *periphConfig, void *userData)
|
/* param base ASRC base pointer. param channelPair ASRC channel pair param handle ASRC eDMA handle pointer. param callback Pointer to user callback function. param txDmaHandle ASRC send edma handle pointer. param periphConfig peripheral configuration. param userData User parameter passed to the callback function. */
void ASRC_TransferInCreateHandleEDMA(ASRC_Type *base, asrc_edma_handle_t *handle, asrc_channel_pair_t channelPair, asrc_edma_callback_t callback, edma_handle_t *inDmaHandle, const asrc_p2p_edma_config_t *periphConfig, void *userData)
|
{
assert((handle != NULL) && (inDmaHandle != NULL));
uint32_t instance = ASRC_GetInstance(base);
(void)memset(&handle->in, 0, sizeof(asrc_in_edma_handle_t));
handle->in.inDmaHandle = inDmaHandle;
handle->callback = callback;
handle->userData = userData;
handle->in.state = kStatus_ASRCIdle;
handle->channelPair = channelPair;
handle->in.peripheralConfig = periphConfig;
s_edmaPrivateHandle[instance][channelPair].base = base;
s_edmaPrivateHandle[instance][channelPair].handle = handle;
EDMA_InstallTCDMemory(inDmaHandle, (edma_tcd_t *)(STCD_ADDR(handle->in.tcd)), ASRC_XFER_OUT_QUEUE_SIZE);
EDMA_SetCallback(inDmaHandle, ASRC_InEDMACallback, &s_edmaPrivateHandle[instance][channelPair]);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If this fails due to allocation or transmit congestion, assume the originator will repeat the sequence. */
|
static void fc_seq_ls_rjt(struct fc_seq *, enum fc_els_rjt_reason, enum fc_els_rjt_explan)
|
/* If this fails due to allocation or transmit congestion, assume the originator will repeat the sequence. */
static void fc_seq_ls_rjt(struct fc_seq *, enum fc_els_rjt_reason, enum fc_els_rjt_explan)
|
{
struct fc_seq *sp;
struct fc_els_ls_rjt *rjt;
struct fc_frame *fp;
sp = fc_seq_start_next(req_sp);
fp = fc_frame_alloc(fc_seq_exch(sp)->lp, sizeof(*rjt));
if (fp) {
rjt = fc_frame_payload_get(fp, sizeof(*rjt));
memset(rjt, 0, sizeof(*rjt));
rjt->er_cmd = ELS_LS_RJT;
rjt->er_reason = reason;
rjt->er_explan = explan;
fc_seq_send_last(sp, fp, FC_RCTL_ELS_REP, FC_TYPE_ELS);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Make RAID-6 tables. This is a host user space program to be run at compile time. */
|
static uint8_t gfmul(uint8_t a, uint8_t b)
|
/* Make RAID-6 tables. This is a host user space program to be run at compile time. */
static uint8_t gfmul(uint8_t a, uint8_t b)
|
{
uint8_t v = 0;
while (b) {
if (b & 1)
v ^= a;
a = (a << 1) ^ (a & 0x80 ? 0x1d : 0);
b >>= 1;
}
return v;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Initializes SLCD blink configurations struct to defaults.
Initailizes SLCD blink configuration struct to predefined safe default settings. */
|
void slcd_blink_get_config_defaults(struct slcd_blink_config *blink_config)
|
/* Initializes SLCD blink configurations struct to defaults.
Initailizes SLCD blink configuration struct to predefined safe default settings. */
void slcd_blink_get_config_defaults(struct slcd_blink_config *blink_config)
|
{
Assert(blink_config);
blink_config->fc = SLCD_FRAME_COUNTER_0;
blink_config->blink_all_seg = true;
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Wait for transmitter & holding register to empty */
|
static void wait_for_xmitr(struct uart_8250_port *up, int bits)
|
/* Wait for transmitter & holding register to empty */
static void wait_for_xmitr(struct uart_8250_port *up, int bits)
|
{
unsigned int status, tmout = 10000;
do {
status = serial_in(up, UART_LSR);
up->lsr_saved_flags |= status & LSR_SAVE_FLAGS;
if (--tmout == 0)
break;
udelay(1);
} while ((status & bits) != bits);
if (up->port.flags & UPF_CONS_FLOW) {
unsigned int tmout;
for (tmout = 1000000; tmout; tmout--) {
unsigned int msr = serial_in(up, UART_MSR);
up->msr_saved_flags |= msr & MSR_SAVE_FLAGS;
if (msr & UART_MSR_CTS)
break;
udelay(1);
touch_nmi_watchdog();
}
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* enable/disable the multi-driver; This is only valid for output and allows the output pin to run as an open collector output. */
|
int __init_or_module at91_set_multi_drive(unsigned pin, int is_on)
|
/* enable/disable the multi-driver; This is only valid for output and allows the output pin to run as an open collector output. */
int __init_or_module at91_set_multi_drive(unsigned pin, int is_on)
|
{
void __iomem *pio = pin_to_controller(pin);
unsigned mask = pin_to_mask(pin);
if (!pio)
return -EINVAL;
__raw_writel(mask, pio + (is_on ? PIO_MDER : PIO_MDDR));
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Detects whether the Smartcard is present or not. */
|
static uint8_t SC_Detect(void)
|
/* Detects whether the Smartcard is present or not. */
static uint8_t SC_Detect(void)
|
{
return HAL_GPIO_ReadPin(SC_OFF_GPIO_PORT, SC_OFF_PIN);
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Wait for one or more Signal Flags to become signaled for the current RUNNING thread. */
|
os_InRegs osEvent_type svcSignalWait(int32_t signals, uint32_t millisec)
|
/* Wait for one or more Signal Flags to become signaled for the current RUNNING thread. */
os_InRegs osEvent_type svcSignalWait(int32_t signals, uint32_t millisec)
|
{
ret.status = osErrorValue;
return osEvent_ret_status;
}
if (signals != 0) {
res = rt_evt_wait(signals, rt_ms2tick(millisec), __TRUE);
} else {
res = rt_evt_wait(0xFFFF, rt_ms2tick(millisec), __FALSE);
}
if (res == OS_R_EVT) {
ret.status = osEventSignal;
ret.value.signals = signals ? signals : os_tsk.run->waits;
} else {
ret.status = millisec ? osEventTimeout : osOK;
ret.value.signals = 0;
}
return osEvent_ret_value;
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* Releases a Modbus RTU transport layer object, previously created with */
|
void TbxMbRtuFree(tTbxMbTp transport)
|
/* Releases a Modbus RTU transport layer object, previously created with */
void TbxMbRtuFree(tTbxMbTp transport)
|
{
TBX_ASSERT(transport != NULL);
if (transport != NULL)
{
tTbxMbTpCtx * tpCtx = (tTbxMbTpCtx *)transport;
TBX_ASSERT(tpCtx->type == TBX_MB_RTU_CONTEXT_TYPE);
TbxMbOsalSemFree(tpCtx->initStateExitSem);
TbxCriticalSectionEnter();
tbxMbRtuCtx[tpCtx->port] = NULL;
tpCtx->type = 0U;
tpCtx->pollFcn = NULL;
tpCtx->processFcn = NULL;
TbxCriticalSectionExit();
TbxMemPoolRelease(tpCtx);
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Get OEM/Vendor specific grayed out text color attribute. */
|
UINT8 EFIAPI GetGrayedTextColor(VOID)
|
/* Get OEM/Vendor specific grayed out text color attribute. */
UINT8 EFIAPI GetGrayedTextColor(VOID)
|
{
return FIELD_TEXT_GRAYED | FIELD_BACKGROUND;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Snoop PTP packet for version 2 format When set the PTP packets are snooped using the version 2 format. */
|
void synopGMAC_TS_pkt_snoop_ver2(synopGMACdevice *gmacdev)
|
/* Snoop PTP packet for version 2 format When set the PTP packets are snooped using the version 2 format. */
void synopGMAC_TS_pkt_snoop_ver2(synopGMACdevice *gmacdev)
|
{
synopGMACSetBits(gmacdev->MacBase, GmacTSControl, GmacTSVER2ENA);
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Insert the memory block to the pool's list of the blocks. */
|
VOID EmmcPeimInsertMemBlockToPool(IN EMMC_PEIM_MEM_BLOCK *Head, IN EMMC_PEIM_MEM_BLOCK *Block)
|
/* Insert the memory block to the pool's list of the blocks. */
VOID EmmcPeimInsertMemBlockToPool(IN EMMC_PEIM_MEM_BLOCK *Head, IN EMMC_PEIM_MEM_BLOCK *Block)
|
{
ASSERT ((Head != NULL) && (Block != NULL));
Block->Next = Head->Next;
Head->Next = Block;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Select the LCD page where the data will be writen. */
|
void LCD_PageSelect(LCD_PageSelection_TypeDef LCD_PageSelection)
|
/* Select the LCD page where the data will be writen. */
void LCD_PageSelect(LCD_PageSelection_TypeDef LCD_PageSelection)
|
{
assert_param(IS_LCD_PAGE_SELECT(LCD_PageSelection));
LCD->CR4 &= (uint8_t)(~LCD_CR4_PAGECOM);
LCD->CR4 |= LCD_PageSelection;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Set the pulse width of the specified channel in milliseconds. */
|
void pwmout_pulsewidth_ms(pwmout_t *obj, int ms)
|
/* Set the pulse width of the specified channel in milliseconds. */
void pwmout_pulsewidth_ms(pwmout_t *obj, int ms)
|
{
pwmout_pulsewidth_us(obj, ms * 1000);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Read the next filename form a directory. The name of the directories will begin with '/' */
|
static lv_fs_res_t fs_dir_read(lv_fs_drv_t *drv, void *rddir_p, char *fn)
|
/* Read the next filename form a directory. The name of the directories will begin with '/' */
static lv_fs_res_t fs_dir_read(lv_fs_drv_t *drv, void *rddir_p, char *fn)
|
{
FRESULT res;
FILINFO fno;
fn[0] = '\0';
do {
res = f_readdir(rddir_p, &fno);
if(res != FR_OK) return LV_FS_RES_UNKNOWN;
if(fno.fattrib & AM_DIR) {
fn[0] = '/';
strcpy(&fn[1], fno.fname);
} else
strcpy(fn, fno.fname);
} while(strcmp(fn, "/.") == 0 || strcmp(fn, "/..") == 0);
return LV_FS_RES_OK;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Return an allocated memory block back to a Memory Pool. */
|
osStatus_t osMemoryPoolFree(osMemoryPoolId_t mp_id, void *block)
|
/* Return an allocated memory block back to a Memory Pool. */
osStatus_t osMemoryPoolFree(osMemoryPoolId_t mp_id, void *block)
|
{
status = isrRtxMemoryPoolFree(mp_id, block);
} else {
status = __svcMemoryPoolFree(mp_id, block);
}
return status;
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* Loads an elf section into a PE For now only supports loading a section to dmem (all PE's), pmem (class and tmu PE's), DDDR (util PE code) */
|
int pe_load_elf_section(int id, const void *data, Elf32_Shdr *shdr)
|
/* Loads an elf section into a PE For now only supports loading a section to dmem (all PE's), pmem (class and tmu PE's), DDDR (util PE code) */
int pe_load_elf_section(int id, const void *data, Elf32_Shdr *shdr)
|
{
u32 addr = be32_to_cpu(shdr->sh_addr);
u32 size = be32_to_cpu(shdr->sh_size);
if (IS_DMEM(addr, size))
return pe_load_dmem_section(id, data, shdr);
else if (IS_PMEM(addr, size))
return pe_load_pmem_section(id, data, shdr);
else if (IS_PFE_LMEM(addr, size))
return 0;
else if (IS_PHYS_DDR(addr, size))
return pe_load_ddr_section(id, data, shdr);
else if (IS_PE_LMEM(addr, size))
return pe_load_pe_lmem_section(id, data, shdr);
printf("%s: unsupported memory range(%x)\n", __func__, addr);
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Returns: the (possibly changed) start of the #GList */
|
GList* g_list_insert_sorted(GList *list, gpointer data, GCompareFunc func)
|
/* Returns: the (possibly changed) start of the #GList */
GList* g_list_insert_sorted(GList *list, gpointer data, GCompareFunc func)
|
{
return g_list_insert_sorted_real (list, data, (GFunc) func, NULL);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* brief Return Frequency of ENET TX CLK return Frequency of ENET TX CLK */
|
uint32_t CLOCK_GetEnetTxClkFreq(void)
|
/* brief Return Frequency of ENET TX CLK return Frequency of ENET TX CLK */
uint32_t CLOCK_GetEnetTxClkFreq(void)
|
{
return s_Enet_Tx_Clk_Freq;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function does not return until the block has been erased. */
|
int32_t FlashErase(uint32_t ui32Address)
|
/* This function does not return until the block has been erased. */
int32_t FlashErase(uint32_t ui32Address)
|
{
ASSERT(!(ui32Address & (FLASH_ERASE_SIZE - 1)));
HWREG(FLASH_FCMISC) = (FLASH_FCMISC_AMISC | FLASH_FCMISC_VOLTMISC |
FLASH_FCMISC_ERMISC);
HWREG(FLASH_FMA) = ui32Address;
HWREG(FLASH_FMC) = FLASH_FMC_WRKEY | FLASH_FMC_ERASE;
while (HWREG(FLASH_FMC) & FLASH_FMC_ERASE)
{
}
if (HWREG(FLASH_FCRIS) & (FLASH_FCRIS_ARIS | FLASH_FCRIS_VOLTRIS |
FLASH_FCRIS_ERRIS))
{
return (-1);
}
return (0);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param base TSC peripheral base address. param selection Select alternative measure value which is Y coordinate value or X coordinate value. See "tsc_corrdinate_value_selection_t". return If selection is "kTSC_XCoordinateValueSelection", the API returns x-coordinate vlaue. If selection is "kTSC_YCoordinateValueSelection", the API returns y-coordinate vlaue. */
|
uint32_t TSC_GetMeasureValue(TSC_Type *base, tsc_corrdinate_value_selection_t selection)
|
/* param base TSC peripheral base address. param selection Select alternative measure value which is Y coordinate value or X coordinate value. See "tsc_corrdinate_value_selection_t". return If selection is "kTSC_XCoordinateValueSelection", the API returns x-coordinate vlaue. If selection is "kTSC_YCoordinateValueSelection", the API returns y-coordinate vlaue. */
uint32_t TSC_GetMeasureValue(TSC_Type *base, tsc_corrdinate_value_selection_t selection)
|
{
uint32_t tmp32 = 0;
if (selection == kTSC_XCoordinateValueSelection)
{
tmp32 = ((base->MEASEURE_VALUE) & TSC_MEASEURE_VALUE_X_VALUE_MASK) >> TSC_MEASEURE_VALUE_X_VALUE_SHIFT;
}
else if (selection == kTSC_YCoordinateValueSelection)
{
tmp32 = ((base->MEASEURE_VALUE) & TSC_MEASEURE_VALUE_Y_VALUE_MASK) >> TSC_MEASEURE_VALUE_Y_VALUE_SHIFT;
}
else
{
}
return tmp32;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Verifies an erasure of the desired flash area at a specified margin level.
This function checks the appropriate number of flash sectors based on the desired start address and length to check whether the flash is erased to the specified read margin level. */
|
status_t FLASH_VerifyErase(flash_config_t *config, uint32_t start, uint32_t lengthInBytes)
|
/* Verifies an erasure of the desired flash area at a specified margin level.
This function checks the appropriate number of flash sectors based on the desired start address and length to check whether the flash is erased to the specified read margin level. */
status_t FLASH_VerifyErase(flash_config_t *config, uint32_t start, uint32_t lengthInBytes)
|
{
assert(BOOTLOADER_API_TREE_POINTER);
return BOOTLOADER_API_TREE_POINTER->flashDriver->flash_verify_erase(config, start, lengthInBytes);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Verify that string is non-empty and does not exceed max length. */
|
static int exp_verify_string(char *cp, int max)
|
/* Verify that string is non-empty and does not exceed max length. */
static int exp_verify_string(char *cp, int max)
|
{
int i;
for (i = 0; i < max; i++)
if (!cp[i])
return i;
cp[i] = 0;
printk(KERN_NOTICE "nfsd: couldn't validate string %s\n", cp);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Read at most 'len' characters, blocking for at most 'timeout' ms */
|
int mbedtls_net_recv_timeout(void *ctx, unsigned char *buf, size_t len, uint32_t timeout)
|
/* Read at most 'len' characters, blocking for at most 'timeout' ms */
int mbedtls_net_recv_timeout(void *ctx, unsigned char *buf, size_t len, uint32_t timeout)
|
{
int ret;
struct timeval tv;
fd_set read_fds;
int fd = ((mbedtls_net_context *) ctx)->fd;
if( fd < 0 )
return( MBEDTLS_ERR_NET_INVALID_CONTEXT );
FD_ZERO( &read_fds );
FD_SET( fd, &read_fds );
tv.tv_sec = timeout / 1000;
tv.tv_usec = ( timeout % 1000 ) * 1000;
ret = select( fd + 1, &read_fds, NULL, NULL, timeout == 0 ? NULL : &tv );
if( ret == 0 )
return( MBEDTLS_ERR_SSL_TIMEOUT );
if( ret < 0 )
{
if( errno == EINTR )
return( MBEDTLS_ERR_SSL_WANT_READ );
return( MBEDTLS_ERR_NET_RECV_FAILED );
}
return( mbedtls_net_recv( ctx, buf, len ) );
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* We first have drop_overlaps_that_are_ok() drop any pre-existing 'overlap_ok' ranges, so that we can then reserve this memory range without risk of panic'ing on an overlapping overlap_ok early reservation. */
|
void __init reserve_early(u64 start, u64 end, char *name)
|
/* We first have drop_overlaps_that_are_ok() drop any pre-existing 'overlap_ok' ranges, so that we can then reserve this memory range without risk of panic'ing on an overlapping overlap_ok early reservation. */
void __init reserve_early(u64 start, u64 end, char *name)
|
{
if (start >= end)
return;
drop_overlaps_that_are_ok(start, end);
__reserve_early(start, end, name, 0);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* mux the pin to the "GPIO" peripheral role. */
|
int at91_set_pio_periph(unsigned port, unsigned pin, int use_pullup)
|
/* mux the pin to the "GPIO" peripheral role. */
int at91_set_pio_periph(unsigned port, unsigned pin, int use_pullup)
|
{
struct at91_port *at91_port = at91_pio_get_port(port);
u32 mask;
if (at91_port && (pin < GPIO_PER_BANK)) {
mask = 1 << pin;
writel(mask, &at91_port->idr);
at91_set_pio_pullup(port, pin, use_pullup);
writel(mask, &at91_port->per);
}
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Return whether there are any free extents in the size range given by low and high, for the bitmap block bbno. */
|
STATIC int xfs_rtany_summary(xfs_mount_t *, xfs_trans_t *, int, int, xfs_rtblock_t, xfs_buf_t **, xfs_fsblock_t *, int *)
|
/* Return whether there are any free extents in the size range given by low and high, for the bitmap block bbno. */
STATIC int xfs_rtany_summary(xfs_mount_t *, xfs_trans_t *, int, int, xfs_rtblock_t, xfs_buf_t **, xfs_fsblock_t *, int *)
|
{
int error;
int log;
xfs_suminfo_t sum;
for (log = low; log <= high; log++) {
error = xfs_rtget_summary(mp, tp, log, bbno, rbpp, rsb, &sum);
if (error) {
return error;
}
if (sum) {
*stat = 1;
return 0;
}
}
*stat = 0;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* look up the first VMA exactly that exactly matches addr */
|
static struct vm_area_struct* find_vma_exact(struct mm_struct *mm, unsigned long addr, unsigned long len)
|
/* look up the first VMA exactly that exactly matches addr */
static struct vm_area_struct* find_vma_exact(struct mm_struct *mm, unsigned long addr, unsigned long len)
|
{
struct vm_area_struct *vma;
struct rb_node *n = mm->mm_rb.rb_node;
unsigned long end = addr + len;
vma = mm->mmap_cache;
if (vma && vma->vm_start == addr && vma->vm_end == end)
return vma;
for (n = rb_first(&mm->mm_rb); n; n = rb_next(n)) {
vma = rb_entry(n, struct vm_area_struct, vm_rb);
if (vma->vm_start < addr)
continue;
if (vma->vm_start > addr)
return NULL;
if (vma->vm_end == end) {
mm->mmap_cache = vma;
return vma;
}
}
return NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* There are a maximum of 32 gpios in each gpio controller. */
|
static struct ppc4xx_gpio_chip* to_ppc4xx_gpiochip(struct of_mm_gpio_chip *mm_gc)
|
/* There are a maximum of 32 gpios in each gpio controller. */
static struct ppc4xx_gpio_chip* to_ppc4xx_gpiochip(struct of_mm_gpio_chip *mm_gc)
|
{
return container_of(mm_gc, struct ppc4xx_gpio_chip, mm_gc);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* note This must be called after all the ENET initilization. And should be called when the ENET receive/transmit is required. */
|
void ENET_QOS_UpdateRxDescriptor(enet_qos_rx_bd_struct_t *rxDesc, void *buffer1, void *buffer2, bool intEnable, bool doubleBuffEnable)
|
/* note This must be called after all the ENET initilization. And should be called when the ENET receive/transmit is required. */
void ENET_QOS_UpdateRxDescriptor(enet_qos_rx_bd_struct_t *rxDesc, void *buffer1, void *buffer2, bool intEnable, bool doubleBuffEnable)
|
{
assert(rxDesc != NULL);
uint32_t control = ENET_QOS_RXDESCRIP_RD_OWN_MASK | ENET_QOS_RXDESCRIP_RD_BUFF1VALID_MASK;
if (intEnable)
{
control |= ENET_QOS_RXDESCRIP_RD_IOC_MASK;
}
if (doubleBuffEnable)
{
control |= ENET_QOS_RXDESCRIP_RD_BUFF2VALID_MASK;
}
if (buffer1 != NULL)
{
rxDesc->buff1Addr = (uint32_t)(uintptr_t)(uint8_t *)buffer1;
}
if (buffer2 != NULL)
{
rxDesc->buff2Addr = (uint32_t)(uintptr_t)(uint8_t *)buffer2;
}
else
{
rxDesc->buff2Addr = 0;
}
rxDesc->reserved = 0;
__DMB();
rxDesc->control = control;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Waits infinitely for initialization flag to be set in RTC_ISR.
Requires unlocking backup domain write protection (PWR_CR_DBP) */
|
void rtc_wait_for_init_ready(void)
|
/* Waits infinitely for initialization flag to be set in RTC_ISR.
Requires unlocking backup domain write protection (PWR_CR_DBP) */
void rtc_wait_for_init_ready(void)
|
{
while (!rtc_init_flag_is_ready());
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* Must be called with target->scsi_host->host_lock held to protect req_lim and tx_head. */
|
static int __srp_post_send(struct srp_target_port *target, struct srp_iu *iu, int len)
|
/* Must be called with target->scsi_host->host_lock held to protect req_lim and tx_head. */
static int __srp_post_send(struct srp_target_port *target, struct srp_iu *iu, int len)
|
{
struct ib_sge list;
struct ib_send_wr wr, *bad_wr;
int ret = 0;
list.addr = iu->dma;
list.length = len;
list.lkey = target->srp_host->srp_dev->mr->lkey;
wr.next = NULL;
wr.wr_id = target->tx_head & SRP_SQ_SIZE;
wr.sg_list = &list;
wr.num_sge = 1;
wr.opcode = IB_WR_SEND;
wr.send_flags = IB_SEND_SIGNALED;
ret = ib_post_send(target->qp, &wr, &bad_wr);
if (!ret) {
++target->tx_head;
--target->req_lim;
}
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function returns zero in case of success and a %-ENOMEM in case of failure. */
|
static int schedule_erase(struct ubi_device *ubi, struct ubi_wl_entry *e, int torture)
|
/* This function returns zero in case of success and a %-ENOMEM in case of failure. */
static int schedule_erase(struct ubi_device *ubi, struct ubi_wl_entry *e, int torture)
|
{
struct ubi_work *wl_wrk;
dbg_wl("schedule erasure of PEB %d, EC %d, torture %d",
e->pnum, e->ec, torture);
wl_wrk = kmalloc(sizeof(struct ubi_work), GFP_NOFS);
if (!wl_wrk)
return -ENOMEM;
wl_wrk->func = &erase_worker;
wl_wrk->e = e;
wl_wrk->torture = torture;
schedule_ubi_work(ubi, wl_wrk);
return 0;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Select the RTC output source to output on the Tamper pin. */
|
void BKP_RTCOutputConfig(BKPRTCOUTPUTSRC_Typedef rtc_output_source)
|
/* Select the RTC output source to output on the Tamper pin. */
void BKP_RTCOutputConfig(BKPRTCOUTPUTSRC_Typedef rtc_output_source)
|
{
MODIFY_REG(BKP->RTCCR, BKP_RTCCR_CCO | BKP_RTCCR_ASOE | BKP_RTCCR_ASOS, rtc_output_source);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Turn the dentry into a negative dentry if possible, otherwise remove it from the hash queues so it can be deleted later */
|
void d_delete(struct dentry *dentry)
|
/* Turn the dentry into a negative dentry if possible, otherwise remove it from the hash queues so it can be deleted later */
void d_delete(struct dentry *dentry)
|
{
int isdir = 0;
spin_lock(&dcache_lock);
spin_lock(&dentry->d_lock);
isdir = S_ISDIR(dentry->d_inode->i_mode);
if (atomic_read(&dentry->d_count) == 1) {
dentry_iput(dentry);
fsnotify_nameremove(dentry, isdir);
return;
}
if (!d_unhashed(dentry))
__d_drop(dentry);
spin_unlock(&dentry->d_lock);
spin_unlock(&dcache_lock);
fsnotify_nameremove(dentry, isdir);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Inputs : board_num - logical board number 0-3, port - base address */
|
static void __init enable_board(int board_num, unsigned short port)
|
/* Inputs : board_num - logical board number 0-3, port - base address */
static void __init enable_board(int board_num, unsigned short port)
|
{
outb( 0xbc + board_num, MASTER_ADDRESS_PTR );
outb( port >> 2, MASTER_ADDRESS_PTR );
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Clear transfer and IBI related bits in MSTATUS.
This spins forever for those bits to be cleared; */
|
static void mcux_i3c_status_clear_all(I3C_Type *base)
|
/* Clear transfer and IBI related bits in MSTATUS.
This spins forever for those bits to be cleared; */
static void mcux_i3c_status_clear_all(I3C_Type *base)
|
{
uint32_t mask = I3C_MSTATUS_SLVSTART_MASK |
I3C_MSTATUS_MCTRLDONE_MASK |
I3C_MSTATUS_COMPLETE_MASK |
I3C_MSTATUS_IBIWON_MASK |
I3C_MSTATUS_ERRWARN_MASK;
mcux_i3c_status_clear(base, mask);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Main application function.
Application entry point. Initialize board and WINC3400 Wi-Fi module. Display WINC3400 chip id and rf revision id. */
|
int main(void)
|
/* Main application function.
Application entry point. Initialize board and WINC3400 Wi-Fi module. Display WINC3400 chip id and rf revision id. */
int main(void)
|
{
tstrWifiInitParam param;
int8_t ret;
sysclk_init();
board_init();
configure_console();
printf(STRING_HEADER);
nm_bsp_init();
memset((uint8_t *)¶m, 0, sizeof(tstrWifiInitParam));
ret = m2m_wifi_init(¶m);
if (M2M_SUCCESS != ret) {
printf("main: m2m_wifi_init call error!(%d)\r\n", ret);
while (1) {
}
}
printf("Chip ID : \r\t\t\t%x\r\n", (unsigned int)nmi_get_chipid());
printf("RF Revision ID : \r\t\t\t%x\r\n", (unsigned int)nmi_get_rfrevid());
printf("Done.\r\n\r\n");
while (1) {
}
return 0;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Writes and returns a new value to CR2. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */
|
UINTN EFIAPI AsmWriteCr2(UINTN Cr2)
|
/* Writes and returns a new value to CR2. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */
UINTN EFIAPI AsmWriteCr2(UINTN Cr2)
|
{
__asm__ __volatile__ (
"mov %0, %%cr2"
:
: "r" (Cr2)
);
return Cr2;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Enables or disables the TIM Capture Compare Channel x. */
|
void RTIM_CCxCmd(RTIM_TypeDef *TIMx, u16 TIM_Channel, u32 TIM_CCx)
|
/* Enables or disables the TIM Capture Compare Channel x. */
void RTIM_CCxCmd(RTIM_TypeDef *TIMx, u16 TIM_Channel, u32 TIM_CCx)
|
{
u32 tmpccmr = TIMx->CCMRx[TIM_Channel];
assert_param(IS_TIM_CCM_TIM(TIMx));
assert_param(IS_TIM_CHANNEL(TIM_Channel));
assert_param(IS_TIM_CCX(TIM_CCx));
tmpccmr &= ~TIM_CCER_CCxE;
tmpccmr |= TIM_CCx;
TIMx->CCMRx[TIM_Channel] = tmpccmr;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */
|
status_t CODEC_Init(codec_handle_t *handle, codec_config_t *config)
|
/* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */
status_t CODEC_Init(codec_handle_t *handle, codec_config_t *config)
|
{
assert((config != NULL) && (handle != NULL));
handle->codecConfig = config;
return HAL_CODEC_Init(handle, config);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Enable pedometer step counter and timestamp as 4th FIFO data set.. */
|
int32_t lsm6dsl_fifo_pedo_and_timestamp_batch_set(stmdev_ctx_t *ctx, uint8_t val)
|
/* Enable pedometer step counter and timestamp as 4th FIFO data set.. */
int32_t lsm6dsl_fifo_pedo_and_timestamp_batch_set(stmdev_ctx_t *ctx, uint8_t val)
|
{
lsm6dsl_fifo_ctrl2_t fifo_ctrl2;
int32_t ret;
ret = lsm6dsl_read_reg(ctx, LSM6DSL_FIFO_CTRL2, (uint8_t*)&fifo_ctrl2, 1);
if(ret == 0){
fifo_ctrl2.timer_pedo_fifo_en = val;
ret = lsm6dsl_write_reg(ctx, LSM6DSL_FIFO_CTRL2,
(uint8_t*)&fifo_ctrl2, 1);
}
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Check whether a handle is a valid EFI_HANDLE */
|
EFI_STATUS SmmValidateHandle(IN EFI_HANDLE UserHandle)
|
/* Check whether a handle is a valid EFI_HANDLE */
EFI_STATUS SmmValidateHandle(IN EFI_HANDLE UserHandle)
|
{
IHANDLE *Handle;
Handle = (IHANDLE *)UserHandle;
if (Handle == NULL) {
return EFI_INVALID_PARAMETER;
}
if (Handle->Signature != EFI_HANDLE_SIGNATURE) {
return EFI_INVALID_PARAMETER;
}
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Deinitializes the Global MSP. This function is called from HAL_DeInit() function to perform system level Deinitialization (GPIOs, clock, DMA, interrupt). */
|
void HAL_MspDeInit(void)
|
/* Deinitializes the Global MSP. This function is called from HAL_DeInit() function to perform system level Deinitialization (GPIOs, clock, DMA, interrupt). */
void HAL_MspDeInit(void)
|
{
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_12, GPIO_PIN_SET);
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_12);
__HAL_RCC_GPIOC_CLK_DISABLE();
__HAL_RCC_PWR_CLK_DISABLE();
__HAL_RCC_AFIO_CLK_DISABLE();
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Routine: start_cpu_fan Description: Enable/start PWM CPU fan on P2571 */
|
void start_cpu_fan(void)
|
/* Routine: start_cpu_fan Description: Enable/start PWM CPU fan on P2571 */
void start_cpu_fan(void)
|
{
gpio_request(TEGRA_GPIO(E, 4), "FAN_VDD");
gpio_direction_output(TEGRA_GPIO(E, 4), 1);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Returns the current (relative) position of the Primer. Only X-Y axis are considered here. */
|
void MEMS_GetPosition(s16 *pX, s16 *pY)
|
/* Returns the current (relative) position of the Primer. Only X-Y axis are considered here. */
void MEMS_GetPosition(s16 *pX, s16 *pY)
|
{
*pX = MEMS_Info.OutX - XInit;
*pY = MEMS_Info.OutY - YInit;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* submit the BULK type of request to the USB Device */
|
static int _xhci_submit_bulk_msg(struct usb_device *udev, unsigned long pipe, void *buffer, int length)
|
/* submit the BULK type of request to the USB Device */
static int _xhci_submit_bulk_msg(struct usb_device *udev, unsigned long pipe, void *buffer, int length)
|
{
if (usb_pipetype(pipe) != PIPE_BULK) {
printf("non-bulk pipe (type=%lu)", usb_pipetype(pipe));
return -EINVAL;
}
return xhci_bulk_tx(udev, pipe, length, buffer);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Compute the value to fill in the window size field of the outgoing segment. */
|
UINT16 TcpComputeWnd(IN OUT TCP_CB *Tcb, IN BOOLEAN Syn)
|
/* Compute the value to fill in the window size field of the outgoing segment. */
UINT16 TcpComputeWnd(IN OUT TCP_CB *Tcb, IN BOOLEAN Syn)
|
{
UINT32 Wnd;
if (Syn) {
Wnd = GET_RCV_BUFFSIZE (Tcb->Sk);
} else {
Wnd = TcpRcvWinNow (Tcb);
Tcb->RcvWnd = Wnd;
}
Wnd = MIN (Wnd >> Tcb->RcvWndScale, 0xffff);
return NTOHS ((UINT16)Wnd);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If BufferSize is 0, then no output buffer is produced and 0 is returned. */
|
UINTN EFIAPI AsciiBSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString, IN BASE_LIST Marker)
|
/* If BufferSize is 0, then no output buffer is produced and 0 is returned. */
UINTN EFIAPI AsciiBSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString, IN BASE_LIST Marker)
|
{
return mPrint2SProtocol->AsciiBSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Make sure we log the unaligned access, so that user/sysadmin can notice it and eventually fix the program. However, we don't want to do that for every access so we pace it with jiffies. This isn't really MP-safe, but it doesn't really have to be either... */
|
static int within_logging_rate_limit(void)
|
/* Make sure we log the unaligned access, so that user/sysadmin can notice it and eventually fix the program. However, we don't want to do that for every access so we pace it with jiffies. This isn't really MP-safe, but it doesn't really have to be either... */
static int within_logging_rate_limit(void)
|
{
static unsigned long count, last_time;
if (time_after(jiffies, last_time + 5 * HZ))
count = 0;
if (count < 5) {
last_time = jiffies;
count++;
return 1;
}
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Enable Timer Capture/Compare Control Preload.
The capture/compare control bits CCxE, CCxNE and OCxM are set to be preloaded when a COM event occurs. */
|
void timer_enable_preload_complementry_enable_bits(uint32_t timer_peripheral)
|
/* Enable Timer Capture/Compare Control Preload.
The capture/compare control bits CCxE, CCxNE and OCxM are set to be preloaded when a COM event occurs. */
void timer_enable_preload_complementry_enable_bits(uint32_t timer_peripheral)
|
{
TIM_CR2(timer_peripheral) |= TIM_CR2_CCPC;
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* retval kStatus_Success Enable System High Voltage Detect in low power mode successfully. */
|
status_t SPC_EnableLowPowerModeSystemHighVoltageDetect(SPC_Type *base, bool enable)
|
/* retval kStatus_Success Enable System High Voltage Detect in low power mode successfully. */
status_t SPC_EnableLowPowerModeSystemHighVoltageDetect(SPC_Type *base, bool enable)
|
{
status_t status = kStatus_Success;
if (enable)
{
base->LP_CFG |= SPC_LP_CFG_SYS_HVDE_MASK;
}
else
{
base->LP_CFG &= ~SPC_LP_CFG_SYS_HVDE_MASK;
}
return status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Get the DMA of a channel busy or not. */
|
xtBoolean DMAChannelIsBusy(unsigned long ulChannelID)
|
/* Get the DMA of a channel busy or not. */
xtBoolean DMAChannelIsBusy(unsigned long ulChannelID)
|
{
xASSERT(xDMAChannelIDValid(ulChannelID));
return ((xHWREG(g_psDMAChannelAddress[ulChannelID] + DMA_DSR_BCR)
| DMA_DSR_BCR_BSY) ? xtrue : xfalse);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* USBH_Connected USB Connect callback function from the Interrupt. */
|
uint8_t USBH_Connected(USB_OTG_CORE_HANDLE *pdev)
|
/* USBH_Connected USB Connect callback function from the Interrupt. */
uint8_t USBH_Connected(USB_OTG_CORE_HANDLE *pdev)
|
{
pdev->host.ConnSts = 1;
return 0;
}
|
MaJerle/stm32f429
|
C++
| null | 2,036
|
/* This function will enable network interface device . */
|
int netdev_set_up(struct netdev *netdev)
|
/* This function will enable network interface device . */
int netdev_set_up(struct netdev *netdev)
|
{
if (!netdev->ops || !netdev->ops->set_up)
{
LOGE(TAG, "The network interface device(%s) not support to set status.", netdev->name);
return -1;
}
if (netdev_is_up(netdev))
{
return 0;
}
return netdev->ops->set_up(netdev);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Registers an interrupt handler for the uDMA controller. */
|
void uDMAIntRegister(uint32_t ui32IntChannel, void(*pfnHandler)(void))
|
/* Registers an interrupt handler for the uDMA controller. */
void uDMAIntRegister(uint32_t ui32IntChannel, void(*pfnHandler)(void))
|
{
ASSERT(pfnHandler);
ASSERT((ui32IntChannel == UDMA_INT_SW) ||
(ui32IntChannel == UDMA_INT_ERR));
IntRegister(ui32IntChannel, pfnHandler);
IntEnable(ui32IntChannel);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Byte.Bit 00.1 - Status change: The controller or headset has connected/disconnected Bits 01.7 and 01.6 are valid 01.7 - Controller present 01.6 - Headset present 01.1 - Pad state (Bytes 4+) valid */
|
static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *data)
|
/* Byte.Bit 00.1 - Status change: The controller or headset has connected/disconnected Bits 01.7 and 01.6 are valid 01.7 - Controller present 01.6 - Headset present 01.1 - Pad state (Bytes 4+) valid */
static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *data)
|
{
if (data[0] & 0x08) {
if (data[1] & 0x80) {
xpad->pad_present = 1;
usb_submit_urb(xpad->bulk_out, GFP_ATOMIC);
} else
xpad->pad_present = 0;
}
if (!(data[1] & 0x1))
return;
xpad360_process_packet(xpad, cmd, &data[4]);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* compare a key against an existing item's key */
|
static int lv_lru_cmp_keys(lv_lru_item_t *item, const void *key, uint32_t key_length)
|
/* compare a key against an existing item's key */
static int lv_lru_cmp_keys(lv_lru_item_t *item, const void *key, uint32_t key_length)
|
{
if(key_length != item->key_length) {
return 1;
}
else {
return memcmp(key, item->key, key_length);
}
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* This function returns LEB properties for a freeable LEB or NULL if the function is unable to find a freeable LEB quickly. */
|
const struct ubifs_lprops* ubifs_fast_find_freeable(struct ubifs_info *c)
|
/* This function returns LEB properties for a freeable LEB or NULL if the function is unable to find a freeable LEB quickly. */
const struct ubifs_lprops* ubifs_fast_find_freeable(struct ubifs_info *c)
|
{
struct ubifs_lprops *lprops;
ubifs_assert(mutex_is_locked(&c->lp_mutex));
if (list_empty(&c->freeable_list))
return NULL;
lprops = list_entry(c->freeable_list.next, struct ubifs_lprops, list);
ubifs_assert(!(lprops->flags & LPROPS_TAKEN));
ubifs_assert(!(lprops->flags & LPROPS_INDEX));
ubifs_assert(lprops->free + lprops->dirty == c->leb_size);
ubifs_assert(c->freeable_cnt > 0);
return lprops;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Sets the pin mode and configures the pin for use by I2S peripheral */
|
void PinTypeI2S(unsigned long ulPin, unsigned long ulPinMode)
|
/* Sets the pin mode and configures the pin for use by I2S peripheral */
void PinTypeI2S(unsigned long ulPin, unsigned long ulPinMode)
|
{
PinModeSet(ulPin,ulPinMode);
PinConfigSet(ulPin,PIN_STRENGTH_2MA|PIN_STRENGTH_4MA,PIN_TYPE_STD);
}
|
micropython/micropython
|
C++
|
Other
| 18,334
|
/* Wait for the given number of milliseconds (using the ul_ms_ticks generated by the SAM microcontroller system tick). */
|
static void mdelay(uint32_t ul_dly_ticks)
|
/* Wait for the given number of milliseconds (using the ul_ms_ticks generated by the SAM microcontroller system tick). */
static void mdelay(uint32_t ul_dly_ticks)
|
{
uint32_t ul_cur_ticks;
ul_cur_ticks = ul_ms_ticks;
while ((ul_ms_ticks - ul_cur_ticks) < ul_dly_ticks) {
}
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Copy pixels from the screen to a pixel buffer.
Limits have to be set prior to calling this function, e.g.: */
|
void ili9325_copy_pixels_from_screen(ili9325_color_t *pixels, uint32_t count)
|
/* Copy pixels from the screen to a pixel buffer.
Limits have to be set prior to calling this function, e.g.: */
void ili9325_copy_pixels_from_screen(ili9325_color_t *pixels, uint32_t count)
|
{
UNUSED(pixels);
UNUSED(count);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* param handle The RTOS LPI2C handle, the pointer to an allocated space for RTOS context. param base The pointer base address of the LPI2C instance to initialize. param masterConfig Configuration structure to set-up LPI2C in master mode. param srcClock_Hz Frequency of input clock of the LPI2C module. return status of the operation. */
|
status_t LPI2C_RTOS_Init(lpi2c_rtos_handle_t *handle, LPI2C_Type *base, const lpi2c_master_config_t *masterConfig, uint32_t srcClock_Hz)
|
/* param handle The RTOS LPI2C handle, the pointer to an allocated space for RTOS context. param base The pointer base address of the LPI2C instance to initialize. param masterConfig Configuration structure to set-up LPI2C in master mode. param srcClock_Hz Frequency of input clock of the LPI2C module. return status of the operation. */
status_t LPI2C_RTOS_Init(lpi2c_rtos_handle_t *handle, LPI2C_Type *base, const lpi2c_master_config_t *masterConfig, uint32_t srcClock_Hz)
|
{
if (handle == NULL)
{
return kStatus_InvalidArgument;
}
if (base == NULL)
{
return kStatus_InvalidArgument;
}
(void)memset(handle, 0, sizeof(lpi2c_rtos_handle_t));
handle->mutex = xSemaphoreCreateMutex();
if (handle->mutex == NULL)
{
return kStatus_Fail;
}
handle->semaphore = xSemaphoreCreateBinary();
if (handle->semaphore == NULL)
{
vSemaphoreDelete(handle->mutex);
return kStatus_Fail;
}
handle->base = base;
LPI2C_MasterInit(handle->base, masterConfig, srcClock_Hz);
LPI2C_MasterTransferCreateHandle(base, &handle->drv_handle, LPI2C_RTOS_Callback, (void *)handle);
return kStatus_Success;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Schedule link for sending of messages after the bearer has been deblocked by 'continue()'. This method is called when somebody tries to send a message via this link while the bearer is congested. 'tipc_net_lock' is in read_lock here, bearer.lock is free */
|
void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr)
|
/* Schedule link for sending of messages after the bearer has been deblocked by 'continue()'. This method is called when somebody tries to send a message via this link while the bearer is congested. 'tipc_net_lock' is in read_lock here, bearer.lock is free */
void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr)
|
{
spin_lock_bh(&b_ptr->publ.lock);
tipc_bearer_schedule_unlocked(b_ptr, l_ptr);
spin_unlock_bh(&b_ptr->publ.lock);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Initialize the stmpe811 and configure the needed hardware resources. */
|
void stmpe811_Init(uint16_t DeviceAddr)
|
/* Initialize the stmpe811 and configure the needed hardware resources. */
void stmpe811_Init(uint16_t DeviceAddr)
|
{
uint8_t instance;
uint8_t empty;
instance = stmpe811_GetInstance(DeviceAddr);
if(instance == 0xFF)
{
empty = stmpe811_GetInstance(0);
if(empty < STMPE811_MAX_INSTANCE)
{
stmpe811[empty] = DeviceAddr;
IOE_Init();
stmpe811_Reset(DeviceAddr);
}
}
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Reloads IWDG counter with value defined in the reload register (write access to IWDG_PR and IWDG_RLR registers disabled). */
|
void IWDG_ReloadCounter(void)
|
/* Reloads IWDG counter with value defined in the reload register (write access to IWDG_PR and IWDG_RLR registers disabled). */
void IWDG_ReloadCounter(void)
|
{
IWDG->KR = KR_KEY_Reload;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* function to be used with macro "fasttm": optimized for absence of tag methods */
|
const TValue* luaT_gettm(Table *events, TMS event, TString *ename)
|
/* function to be used with macro "fasttm": optimized for absence of tag methods */
const TValue* luaT_gettm(Table *events, TMS event, TString *ename)
|
{
if (!luaR_isrotable(events))
events->flags |= cast_byte(1u<<event);
return NULL;
}
else return tm;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* reclen sysfs attribute - The record length to be used for write CCWs */
|
static ssize_t ur_attr_reclen_show(struct device *dev, struct device_attribute *attr, char *buf)
|
/* reclen sysfs attribute - The record length to be used for write CCWs */
static ssize_t ur_attr_reclen_show(struct device *dev, struct device_attribute *attr, char *buf)
|
{
struct urdev *urd;
int rc;
urd = urdev_get_from_cdev(to_ccwdev(dev));
if (!urd)
return -ENODEV;
rc = sprintf(buf, "%zu\n", urd->reclen);
urdev_put(urd);
return rc;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Each item entry is configured in the defined order. If configuration of any item fails, -1 is returned and none of the following items are configured. On success, 0 is returned. */
|
int davinci_configure_pin_mux_items(const struct pinmux_resource *item, const int n_items)
|
/* Each item entry is configured in the defined order. If configuration of any item fails, -1 is returned and none of the following items are configured. On success, 0 is returned. */
int davinci_configure_pin_mux_items(const struct pinmux_resource *item, const int n_items)
|
{
int i;
for (i = 0; i < n_items; i++) {
if (davinci_configure_pin_mux(item[i].pins,
item[i].n_pins) != 0)
return -1;
}
return 0;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* If the conversion results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
|
RETURN_STATUS EFIAPI SafeIntnToChar8(IN INTN Operand, OUT CHAR8 *Result)
|
/* If the conversion results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeIntnToChar8(IN INTN Operand, OUT CHAR8 *Result)
|
{
RETURN_STATUS Status;
if (Result == NULL) {
return RETURN_INVALID_PARAMETER;
}
if ((Operand >= 0) && (Operand <= MAX_INT8)) {
*Result = (CHAR8)Operand;
Status = RETURN_SUCCESS;
} else {
*Result = CHAR8_ERROR;
Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* ip6_tnl_dev_init_gen - general initializer for all tunnel devices @dev: virtual device associated with tunnel */
|
static void ip6_tnl_dev_init_gen(struct net_device *dev)
|
/* ip6_tnl_dev_init_gen - general initializer for all tunnel devices @dev: virtual device associated with tunnel */
static void ip6_tnl_dev_init_gen(struct net_device *dev)
|
{
struct ip6_tnl *t = netdev_priv(dev);
t->dev = dev;
strcpy(t->parms.name, dev->name);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* The interrupt block recognition checks data after/before the hard-iron correction to discover the interrupt.. */
|
int32_t lis2mdl_offset_int_conf_set(stmdev_ctx_t *ctx, lis2mdl_int_on_dataoff_t val)
|
/* The interrupt block recognition checks data after/before the hard-iron correction to discover the interrupt.. */
int32_t lis2mdl_offset_int_conf_set(stmdev_ctx_t *ctx, lis2mdl_int_on_dataoff_t val)
|
{
lis2mdl_cfg_reg_b_t reg;
int32_t ret;
ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_B, (uint8_t*)®, 1);
if(ret == 0){
reg.int_on_dataoff = (uint8_t)val;
ret = lis2mdl_write_reg(ctx, LIS2MDL_CFG_REG_B, (uint8_t*)®, 1);
}
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Deferred destructor for a user namespace. This is required because free_user_ns() may be called with uidhash_lock held, but we need to call back to free_uid() which will want to take the lock again. */
|
static void free_user_ns_work(struct work_struct *work)
|
/* Deferred destructor for a user namespace. This is required because free_user_ns() may be called with uidhash_lock held, but we need to call back to free_uid() which will want to take the lock again. */
static void free_user_ns_work(struct work_struct *work)
|
{
struct user_namespace *ns =
container_of(work, struct user_namespace, destroyer);
free_uid(ns->creator);
kfree(ns);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function De registers an interrupt in NVIC table. */
|
void osi_InterruptDeRegister(int iIntrNum)
|
/* This function De registers an interrupt in NVIC table. */
void osi_InterruptDeRegister(int iIntrNum)
|
{
MAP_IntDisable(iIntrNum);
MAP_IntUnregister(iIntrNum);
}
|
micropython/micropython
|
C++
|
Other
| 18,334
|
/* Handles parsing a 'kernel' label. expecting "filename" or "<fit_filename>#cfg" */
|
static int parse_label_kernel(char **c, struct pxe_label *label)
|
/* Handles parsing a 'kernel' label. expecting "filename" or "<fit_filename>#cfg" */
static int parse_label_kernel(char **c, struct pxe_label *label)
|
{
char *s;
int err;
err = parse_sliteral(c, &label->kernel);
if (err < 0)
return err;
s = strstr(label->kernel, "#");
if (!s)
return 1;
label->config = malloc(strlen(s) + 1);
if (!label->config)
return -ENOMEM;
strcpy(label->config, s);
*s = 0;
return 1;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Returns the last ADCx conversion result data for regular channel. */
|
uint16_t ADC_GetConversionValue(ADC_TypeDef *ADCx)
|
/* Returns the last ADCx conversion result data for regular channel. */
uint16_t ADC_GetConversionValue(ADC_TypeDef *ADCx)
|
{
assert_param(IS_ADC_ALL_PERIPH(ADCx));
if(((ADCx->ADCFG&0x000000380)>>7)==0)
return (uint16_t) ADCx->ADDATA;
else if(((ADCx->ADCFG&0x000000380)>>7)==1)
return (uint16_t) (ADCx->ADDATA>>1);
else if(((ADCx->ADCFG&0x000000380)>>7)==2)
return (uint16_t) (ADCx->ADDATA>>2);
else if(((ADCx->ADCFG&0x000000380)>>7)==3)
return (uint16_t) (ADCx->ADDATA>>3);
else if(((ADCx->ADCFG&0x000000380)>>7)==4)
return (uint16_t) (ADCx->ADDATA>>4);
return (uint16_t) ADCx->ADDATA;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
|
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
|
{
if(huart->Instance==LPUART1)
{
__HAL_RCC_LPUART1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_3|GPIO_PIN_2);
}
else if(huart->Instance==USART1)
{
__HAL_RCC_USART1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_7|GPIO_PIN_6);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.