OpenCores
URL https://opencores.org/ocsvn/usb_nand_reader/usb_nand_reader/trunk

Subversion Repositories usb_nand_reader

[/] [usb_nand_reader/] [trunk/] [mini32/] [CMD_ReadPage.cp] - Rev 7

Compare with Previous | Blame | View Log

#line 1 "H:/MINI32/MINI-32 Examples/MINI-32 mikroC PRO for PIC32 Examples/MINI32_NAND_Controller/CMD_ReadPage.c"
#line 1 "h:/mini32/mini-32 examples/mini-32 mikroc pro for pic32 examples/mini32_nand_controller/nandcontrol.h"



void init_nand_control_line();
int nand_is_ready();
void nand_wait_ready();
void nand_chip_select(int idx);
void nand_chip_unselect();

void nand_send_command(unsigned char cmd);
void nand_send_address(unsigned char* addr, int len);
void nand_write(unsigned char* buffer, int len);
void nand_read(unsigned char* buffer, int len);
void nand_toggle_wp();

void blink(int i);
#line 1 "h:/mini32/mini-32 examples/mini-32 mikroc pro for pic32 examples/mini32_nand_controller/cmd.h"
#line 38 "h:/mini32/mini-32 examples/mini-32 mikroc pro for pic32 examples/mini32_nand_controller/cmd.h"
void do_delay(int cycles);

void cmd_chip_enable(unsigned char* cmd);
void cmd_chip_disable();
void cmd_chip_reset();
void cmd_chip_read_id(unsigned char* outBuffer, int addr);
void cmd_chip_read_param_page(unsigned char* outBuffer);
void cmd_chip_read_page(unsigned char* inBuffer, unsigned char* outBuffer, int len, int addressCycles);
void cmd_chip_read_page_cache_sequential(unsigned char* inBuffer, unsigned char* outBuffer, int len, int addressCylces);
unsigned char cmd_chip_read_status();
unsigned char cmd_chip_read_status_enhanced(unsigned char* inBuffer, int addressCycles);
void cmd_chip_read_unique_id(unsigned char* outBuffer);
void cmd_chip_block_erase(unsigned char* inBuffer);
unsigned char cmd_chip_page_program(unsigned char* inBuffer, int addressCycles, int pageSize);
#line 5 "H:/MINI32/MINI-32 Examples/MINI-32 mikroC PRO for PIC32 Examples/MINI32_NAND_Controller/CMD_ReadPage.c"
void cmd_chip_read_page(unsigned char* inBuffer, unsigned char* outBuffer, int len, int addressCycles)
{
 nand_send_command( 0x00 );
 nand_send_address(inBuffer + 1, addressCycles);
 nand_send_command( 0x30 );
 do_delay(5);
 while(!nand_is_ready());


 {
 int i;
 for(i = 0; i < len; i += 64)
 {
 nand_read(outBuffer, 64);

 while(0 == HID_Write(outBuffer, 64))
 USB_Break();
 }
 }
}
#line 32 "H:/MINI32/MINI-32 Examples/MINI-32 mikroC PRO for PIC32 Examples/MINI32_NAND_Controller/CMD_ReadPage.c"
void cmd_chip_read_page_cache_sequential(unsigned char* inBuffer, unsigned char* outBuffer, int len, int addressCycles)
{
 int i = 0;
 int j = *(int*)(inBuffer + 6);

 nand_send_command( 0x00 );
 nand_send_address(inBuffer + 1, addressCycles);
 nand_send_command( 0x30 );
 do_delay(5);
 nand_wait_ready();
 while(j > 0)
 {
 nand_send_command( (j > 1)?  0x31  :  0x3F );
 j--;

 nand_wait_ready();

 for(i = 0; i < len; i += 64)
 {
 nand_read(outBuffer, 64);
 while(!HID_Write(outBuffer, 64));
 USB_Break();

 }
 }
}

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.