Example #1
0
void MCP23S17::digitalWrite(uint8_t pin, bool value)
{
    if(value)
        write_addr(GPIO, read_addr(GPIO) | 1<<pin );
    else
        write_addr(GPIO, read_addr(GPIO) & ~(1<<pin) );
}
Example #2
0
void MCP23S17::pinMode(uint8_t pin, bool mode)
{
    if(mode == INPUT)
        write_addr(IODIR, read_addr(IODIR) | 1<<pin );
    else
        write_addr(IODIR, read_addr(IODIR) & ~(1<<pin) );
}
void Annual_Routines::OnCbnKillfocusCombo1()
{
	CString strLabel=m_FlexGrid.get_TextMatrix(row_row,1);
	if(strLabel.IsEmpty())
		return;

	// TODO: 在此添加控件通知处理程序代码
	NET_WORK_SET_TIMER
	UpdateData(true);
	CString str_temp;
	m_combo_col_row.GetWindowText(str_temp);
	m_FlexGrid.put_TextMatrix(row_row,row_col,str_temp);
	m_combo_col_row.ShowWindow(SW_HIDE);
	UpdateData(false);
	if(m_before_focus_string!=str_temp)
		write_addr(row_row);
	if(row_col==2)
	{
		m_FlexGrid.put_Row(row_row);
		m_FlexGrid.put_Col(3);
		if(str_temp=="AUTO")
			m_FlexGrid.put_CellBackColor(FLEXGRID_CELL_GRAY_COLOR);
		else
			m_FlexGrid.put_CellBackColor(FLEXGRID_CELL_WHITE_COLOR);
		m_FlexGrid.put_Col(2);
	}
}
Example #4
0
static void address_sequence(unsigned int g4_page, unsigned int g4_index,
			     void __iomem *docptr)
{
	writew(DOCG4_SEQ_PAGE_READ, docptr + DOC_FLASHSEQUENCE);
	writew(DOCG4_CMD_PAGE_READ, docptr + DOC_FLASHCOMMAND);
	write_nop(docptr);
	write_addr(docptr, ((uint32_t)g4_page << 16) | g4_index);
	write_nop(docptr);
}
Example #5
0
static 
log_realloc (unsigned oldlen, unsigned newlen, unsigned bsize, char *addr)
{
	write_string ("realloc of ");
	write_int (oldlen);
	write_string ("at ");
	write_addr (addr);
	write_string ("\n");
	write_stack("x");

	write_string ("realloc-to of ");
	write_int (newlen);
	write_string ("gets ");
	write_int (bsize);
	write_string ("at ");
	write_addr (addr);
	write_string ("\n");
	write_stack("x");
}
Example #6
0
void MCP23S17::pinMode(bool mode)
{
    uint16_t input_pins;
    if(mode == INPUT)
        input_pins = 0xFFFF;
    else
        input_pins = 0x0000;

    write_addr(IODIR, input_pins);
}
void Annual_Routines::OnEnKillfocusEdit1()
{
	// TODO: 在此添加控件通知处理程序代码
	NET_WORK_SET_TIMER
	UpdateData(true);
	m_FlexGrid.put_TextMatrix(row_row,row_col,m_sChange);//设置文本信息
	m_Change.ShowWindow(SW_HIDE); //隐藏文本控件
	UpdateData(false);
	if(m_before_focus_string!=m_sChange)
		write_addr(row_row);
}
Example #8
0
MCP23S17::MCP23S17(uint8_t slave_select_pin, byte aaa_hw_addr)
{
    // Set the aaa hardware address for this chip by tying the
    // MCP23S17's pins (A0, A1, and A2) to either 5v or GND.
    setup_ss(slave_select_pin);

    // We enable HAEN on all connected devices before we can address them individually
    setup_device(0x00);
    write_addr(IOCON, read_addr(IOCON)|HAEN);

    // Remember the hardware address for this chip
    setup_device(aaa_hw_addr);
}
Example #9
0
//------------------------------------------------------------------------------
void* hook_iat(
    void* base,
    const char* dll,
    const char* func_name,
    void* hook,
    int find_by_name
)
{
    void* func_addr;
    void* prev_addr;
    void** imp;

    LOG_INFO("Attempting to hook IAT for module %p", base);
    LOG_INFO("Target is %s,%s (by_name=%d)", dll, func_name, find_by_name);
    
    // Find entry and replace it.
    if (find_by_name)
    {
        imp = get_import_by_name(base, NULL, func_name);
    }
    else
    {
        // Get the address of the function we're going to hook.
        func_addr = get_proc_addr(dll, func_name);
        if (func_addr == NULL)
        {
            LOG_INFO("Failed to find function '%s' in '%s'", func_name, dll);
            return NULL;
        }

        imp = get_import_by_addr(base, NULL, func_addr);
    }

    if (imp == NULL)
    {
        LOG_INFO("Unable to find import in IAT (by_name=%d)", find_by_name);
        return NULL;
    }

    LOG_INFO("Found import at %p (value = %p)", imp, *imp);

    prev_addr = *imp;
    write_addr(imp, hook);

    FlushInstructionCache(current_proc(), 0, 0);
    return prev_addr;
}
Example #10
0
void MCP23S17::port(uint16_t value)
{
    write_addr(GPIO,value);
}
Example #11
0
static u128 do_compraxrax(unsigned long addr, size_t byte)
{
    u128 inject = test_do_compraxrax(addr, byte);
    write_addr((u128 *)addr, &inject);
    return *(u128 *)addr;
}
Example #12
0
static u128 do_offbyone(unsigned long addr, size_t byte) 
{
    u128 inject = test_do_offbyone(addr, byte);
    write_addr((u128 *)addr, &inject);
    return *(u128 *)addr;
}