
#ifndef __BOOT_CMDS_H__
#define __BOOT_CMDS_H__

/*      commandname            cmd     params     reply params       */

#define BOOT_CMD_HELLO         0x20 /*            0xa0               */
	
#define BOOT_CMD_ADDRESS_SET   0x40 /* <address>  0xc0               */
#define BOOT_CMD_ADDRESS_GET   0x41 /*            0xc1  <address>    */
#define BOOT_CMD_READ_8        0x44 /*            0xc4  <data8>      */	
#define BOOT_CMD_READ_16       0x45 /*            0xc5  <data16>     */
#define BOOT_CMD_READ_32       0x46 /*            0xc6  <data32>     */
#define BOOT_CMD_WRITE_8       0x48 /* <data8>    0xc8               */
#define BOOT_CMD_WRITE_16      0x49 /* <data16>   0xc9               */	
#define BOOT_CMD_WRITE_32      0x4a /* <data32>   0xca               */
#define BOOT_CMD_RUN           0x4f /*            0xcf               */

#define BOOT_CMD_REPLY_BAD                        0x31
	
/* <address> means data32
 * <data32> means 4 bytes big endian
 * <data16> means 2 bytes big endian
 * <data8> means 1 byte
 *
 * if cmd is unrecogniced, 0x31 is returned
 */

#ifndef __ASSEMBLY__

int boot_address_set(int fd, unsigned int address);
int boot_read_n(int fd, int width, unsigned char *data);
int boot_write_n(int fd, int width, unsigned char *data);
int boot_run(int fd);
int boot_hello(int fd);

#endif /* __ASSEMBLY__ */

#endif /* __BOOT_CMDS_H__ */
