add bulk sram write
This commit is contained in:
parent
465ea1fbfe
commit
1b2b7ecbed
@ -104,27 +104,27 @@ void sram_bulk_read_start(uint32_t addr)
|
||||
#endif
|
||||
avr_data_in();
|
||||
|
||||
AVR_CS_PORT &= ~(1 << AVR_CS_PIN);
|
||||
|
||||
AVR_WR_PORT |= (1 << AVR_WR_PIN);
|
||||
AVR_RD_PORT |= (1 << AVR_RD_PIN);
|
||||
AVR_CS_PORT &= ~(1 << AVR_CS_PIN);
|
||||
|
||||
sreg_set(addr);
|
||||
|
||||
AVR_RD_PORT &= ~(1 << AVR_RD_PIN);
|
||||
asm volatile ("nop");
|
||||
asm volatile ("nop");
|
||||
asm volatile ("nop");
|
||||
asm volatile ("nop");
|
||||
asm volatile ("nop");
|
||||
asm volatile ("nop");
|
||||
asm volatile ("nop");
|
||||
asm volatile ("nop");
|
||||
|
||||
}
|
||||
|
||||
void sram_bulk_read_end(void)
|
||||
inline void sram_bulk_read_next(void)
|
||||
{
|
||||
#ifdef DEBUG_SRAM
|
||||
printf("sram_bulk_read_end:");
|
||||
#endif
|
||||
AVR_CS_PORT |= (1 << AVR_CS_PIN);
|
||||
avr_data_in();
|
||||
}
|
||||
|
||||
inline uint8_t sram_bulk_read(void)
|
||||
{
|
||||
uint8_t byte;
|
||||
AVR_RD_PORT |= (1 << AVR_RD_PIN);
|
||||
counter_up();
|
||||
AVR_RD_PORT &= ~(1 << AVR_RD_PIN);
|
||||
@ -138,11 +138,27 @@ inline uint8_t sram_bulk_read(void)
|
||||
asm volatile ("nop");
|
||||
asm volatile ("nop");
|
||||
|
||||
}
|
||||
|
||||
|
||||
inline uint8_t sram_bulk_read(void)
|
||||
{
|
||||
uint8_t byte;
|
||||
|
||||
byte = AVR_DATA_PIN;
|
||||
AVR_RD_PORT |= (1 << AVR_RD_PIN);
|
||||
return byte;
|
||||
}
|
||||
|
||||
void sram_bulk_read_end(void)
|
||||
{
|
||||
#ifdef DEBUG_SRAM
|
||||
printf("sram_bulk_read_end:");
|
||||
#endif
|
||||
AVR_CS_PORT |= (1 << AVR_CS_PIN);
|
||||
avr_data_in();
|
||||
}
|
||||
|
||||
uint8_t sram_read(uint32_t addr)
|
||||
{
|
||||
uint8_t byte;
|
||||
@ -153,6 +169,7 @@ uint8_t sram_read(uint32_t addr)
|
||||
avr_data_in();
|
||||
|
||||
AVR_CS_PORT &= ~(1 << AVR_CS_PIN);
|
||||
|
||||
AVR_WR_PORT |= (1 << AVR_WR_PIN);
|
||||
AVR_RD_PORT |= (1 << AVR_RD_PIN);
|
||||
|
||||
@ -179,6 +196,50 @@ uint8_t sram_read(uint32_t addr)
|
||||
|
||||
}
|
||||
|
||||
void sram_bulk_write_start(uint32_t addr)
|
||||
{
|
||||
#ifdef DEBUG_SRAM
|
||||
printf("sram_bulk_write_start: addr=0x%08lx\n\r", addr);
|
||||
#endif
|
||||
|
||||
avr_data_out();
|
||||
|
||||
AVR_CS_PORT &= ~(1 << AVR_CS_PIN);
|
||||
AVR_WR_PORT |= (1 << AVR_WR_PIN);
|
||||
AVR_RD_PORT |= (1 << AVR_RD_PIN);
|
||||
|
||||
sreg_set(addr);
|
||||
|
||||
AVR_WR_PORT &= ~(1 << AVR_WR_PIN);
|
||||
}
|
||||
|
||||
inline void sram_bulk_write_next(void)
|
||||
{
|
||||
AVR_RD_PORT |= (1 << AVR_RD_PIN);
|
||||
|
||||
counter_up();
|
||||
|
||||
AVR_WR_PORT &= ~(1 << AVR_WR_PIN);
|
||||
}
|
||||
|
||||
inline void sram_bulk_write( uint8_t data)
|
||||
{
|
||||
AVR_DATA_PORT = data;
|
||||
|
||||
AVR_WR_PORT |= (1 << AVR_WR_PIN);
|
||||
}
|
||||
|
||||
void sram_bulk_write_end(void)
|
||||
{
|
||||
#ifdef DEBUG_SRAM
|
||||
printf("sram_bulk_write_end:");
|
||||
#endif
|
||||
AVR_CS_PORT |= (1 << AVR_CS_PIN);
|
||||
|
||||
avr_data_in();
|
||||
}
|
||||
|
||||
|
||||
void sram_write(uint32_t addr, uint8_t data)
|
||||
{
|
||||
|
||||
@ -204,6 +265,7 @@ void sram_write(uint32_t addr, uint8_t data)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void sram_clear(uint32_t addr, uint32_t len)
|
||||
{
|
||||
|
||||
|
||||
@ -148,8 +148,16 @@ void sram_clear(uint32_t addr, uint32_t len);
|
||||
void sram_copy(uint32_t addr,uint8_t *src, uint32_t len);
|
||||
|
||||
void sram_bulk_read_start(uint32_t addr);
|
||||
void sram_bulk_read_end(void);
|
||||
inline void sram_bulk_read_next(void);
|
||||
inline void sram_bulk_read_end(void);
|
||||
uint8_t sram_bulk_read(void);
|
||||
|
||||
void sram_bulk_write_start(uint32_t addr);
|
||||
inline void sram_bulk_read_next(void);
|
||||
inline void sram_bulk_write_end(void);
|
||||
void sram_bulk_write(uint8_t data);
|
||||
|
||||
|
||||
|
||||
void sram_read_buffer(uint32_t addr,uint8_t *dst, uint32_t len);
|
||||
uint8_t sram_check(uint8_t *buffer, uint32_t len);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user