| Line No. | Rev | Author | Line |
|---|---|---|---|
| 1 | 32 | kaklik | /****************************************************************************** |
| 2 | * |
||
| 3 | * Microchip Memory Disk Drive File System |
||
| 4 | * |
||
| 5 | ****************************************************************************** |
||
| 6 | * FileName: CF- Bit transaction.h |
||
| 7 | * Dependencies: GenericTypeDefs.h |
||
| 8 | * FSDefs.h |
||
| 9 | * FSconfig.h |
||
| 10 | * Processor: PIC18/PIC24/dsPIC30/dsPIC33 |
||
| 11 | * Compiler: C18/C30 |
||
| 12 | * Company: Microchip Technology, Inc. |
||
| 13 | * |
||
| 14 | * Software License Agreement |
||
| 15 | * |
||
| 16 | * The software supplied herewith by Microchip Technology Incorporated |
||
| 17 | * (the Company) for its PICmicro® Microcontroller is intended and |
||
| 18 | * supplied to you, the Companys customer, for use solely and |
||
| 19 | * exclusively on Microchip PICmicro Microcontroller products. The |
||
| 20 | * software is owned by the Company and/or its supplier, and is |
||
| 21 | * protected under applicable copyright laws. All rights are reserved. |
||
| 22 | * Any use in violation of the foregoing restrictions may subject the |
||
| 23 | * user to criminal sanctions under applicable laws, as well as to |
||
| 24 | * civil liability for the breach of the terms and conditions of this |
||
| 25 | * license. |
||
| 26 | * |
||
| 27 | * THIS SOFTWARE IS PROVIDED IN AN AS IS CONDITION. NO WARRANTIES, |
||
| 28 | * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED |
||
| 29 | * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
||
| 30 | * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, |
||
| 31 | * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR |
||
| 32 | * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
||
| 33 | * |
||
| 34 | *****************************************************************************/ |
||
| 35 | //DOM-IGNORE-BEGIN |
||
| 36 | /******************************************************************** |
||
| 37 | Change History: |
||
| 38 | Rev Description |
||
| 39 | ---- ----------------------- |
||
| 40 | 1.2.4 - 1.2.6 No Change |
||
| 41 | ********************************************************************/ |
||
| 42 | //DOM-IGNORE-END |
||
| 43 | |||
| 44 | #include "GenericTypeDefs.h" |
||
| 45 | #include "FSconfig.h" |
||
| 46 | #include "FSDefs.h" |
||
| 47 | |||
| 48 | |||
| 49 | /********************************************************************************/ |
||
| 50 | /* Macros */ |
||
| 51 | /********************************************************************************/ |
||
| 52 | |||
| 53 | // Description: A macro to set the CF data bus TRIS register to outputs |
||
| 54 | #define MDD_CFBT_DATABoutput MDD_CFBT_DATADIR = 0; |
||
| 55 | // Description: A macro to set the CF data bus TRIS register to inputs |
||
| 56 | #define MDD_CFBT_DATABinput MDD_CFBT_DATADIR = 0xff; |
||
| 57 | |||
| 58 | |||
| 59 | |||
| 60 | |||
| 61 | |||
| 62 | |||
| 63 | /**********************************************************************************/ |
||
| 64 | /* Defines and structures */ |
||
| 65 | /**********************************************************************************/ |
||
| 66 | |||
| 67 | // Description: A macro for the data register offset for CF cards |
||
| 68 | #define R_DATA 0 |
||
| 69 | // Description: A macro for the error register offset for CF cards |
||
| 70 | #define R_ERROR 1 |
||
| 71 | // Description: A macro for the count register offset for CF cards |
||
| 72 | #define R_COUNT 2 |
||
| 73 | // Description: A macro for the sector register offset for CF cards |
||
| 74 | #define R_SECT 3 |
||
| 75 | // Description: A macro for the cylinder-low register offset for CF cards |
||
| 76 | #define R_CYLO 4 |
||
| 77 | // Description: A macro for the cylinder-high register offset for CF cards |
||
| 78 | #define R_CYHI 5 |
||
| 79 | // Description: A macro for the drive register offset for CF cards |
||
| 80 | #define R_DRIVE 6 |
||
| 81 | // Description: A macro for the command register offset for CF cards |
||
| 82 | #define R_CMD 7 |
||
| 83 | // Description: A macro for the status offset for CF cards |
||
| 84 | #define R_STATUS 7 |
||
| 85 | |||
| 86 | // Description: A macro for the CF read comment |
||
| 87 | #define C_SECTOR_READ 0x20 |
||
| 88 | // Description: A macro for the CF drive diagnostic command |
||
| 89 | #define C_DRIVE_DIAG 0x90 |
||
| 90 | // Description: A macro for the CF drive identify command |
||
| 91 | #define C_DRIVE_IDENT 0xEC |
||
| 92 | // Description: A macro for the CF write command |
||
| 93 | #define C_SECTOR_WRITE 0x30 |
||
| 94 | |||
| 95 | // Description: A macro indicating that the CF status register reports a ready condition |
||
| 96 | #define S_READY 0x58 |
||
| 97 | // Description: A macro indicating that the CF status register reports an error condition |
||
| 98 | #define S_ERROR 0x51 |
||
| 99 | |||
| 100 | // Description: A macro used to set TRIS register bits to "output" |
||
| 101 | #define OUTPUT 0 |
||
| 102 | // Description: A macro used to set TRIS register bits to "input" |
||
| 103 | #define INPUT 1 |
||
| 104 | |||
| 105 | #ifndef FALSE |
||
| 106 | #define FALSE 0 |
||
| 107 | #endif |
||
| 108 | #ifndef TRUE |
||
| 109 | #define TRUE !FALSE |
||
| 110 | #endif |
||
| 111 | |||
| 112 | /***************************************************************************/ |
||
| 113 | /* Prototypes */ |
||
| 114 | /***************************************************************************/ |
||
| 115 | |||
| 116 | void MDD_CFBT_InitIO( void); |
||
| 117 | BYTE MDD_CFBT_MediaDetect( void); |
||
| 118 | BYTE MDD_CFBT_WriteProtectState (void); |
||
| 119 | BYTE MDD_CFBT_CFread( BYTE add); |
||
| 120 | void MDD_CFBT_CFwrite( BYTE add, BYTE d); |
||
| 121 | void MDD_CFBT_CFwait(void); |
||
| 122 | |||
| 123 | BYTE MDD_CFBT_SectorRead( DWORD lda, BYTE * buf); |
||
| 124 | BYTE MDD_CFBT_SectorWrite( DWORD lda, BYTE * buf, BYTE allowWriteToZero); |
||
| 125 | MEDIA_INFORMATION * MDD_CFBT_MediaInitialize (void); |
||
| 126 | |||
| 127 | #ifdef __C30__ |
||
| 128 | extern BYTE ReadByte( BYTE* pBuffer, WORD index ); |
||
| 129 | extern WORD ReadWord( BYTE* pBuffer, WORD index ); |
||
| 130 | extern DWORD ReadDWord( BYTE* pBuffer, WORD index ); |
||
| 131 | #endif |
Powered by WebSVN v2.8.3