Home

PAL Reference Manual

image

Contents

1. 29 PalReconfigure sese e enee eeno 61 PalRS2ZZ2P OT eee eeeee enen nean n 29 PalRS232PortCount esee iino 29 PalRS232POrtCT eee e seen snen tano 29 PalRS232PortRequire 29 PalRS232PortUniqueCount 29 Paleventzeg 25 PalSevenSegCount ursrvnannvvnrvrrvnnnrnnnnnnnnnn 25 PalSevenSegCT mnnnrnnannvnnenvvnrnrrenannrnnenvennn 25 PalSevenSegDisable aieeeeeeeeeeeeeee eeen 25 PalevenGegtnable 25 PalSevenSegRequire 25 PalSevenSegUniqueCount 25 PalSevenSegWriteDigit 26 PalSevenSegWriteShape 26 Page 65 www celoxica com NEIEN 10 11 14 PalSlowRAM ssssnnanesnnsnssnnnnnnnnssnnnnnrnnnnnnena 36 Pal lowbiAMCoumt sese eeeeesseennno 36 PalSlowRAMCT sees esenee eeennneeennei 36 PalSlowRAMDisable sees seeeei 36 PDallowbAMtnable esee 36 PalSlowRAMGetAddressWidth 36 PalSlowRAMGetAddressWidthCT 36 PalSlowRAMGetDataWidih 36 PalSlowRAMGetDataWidthCT 36 PalSlowRAMGetMaxAddressWidthCT 36 PalSlowRAMGetMaxDataWidthCT 36 PalSlowRAMRead sese esenee 37 PalSlowRAMRegquire 36 PDallowbiAMtteset 36 PalSlowRAMRUn rernrrrrnnrvrrrnvrrrovvrsnavvrnnnver
2. 49 Platform Developer s Kit PDK PalVideoOutGetMaxColorWidthCT 44 PAL 7 PalVideoOutGetMaxXWidthCT 44 T PalVideoOutGetMaxYWidthCT 44 TOUCH SCNGEN UNE 61 PalVideoOutGetTotalX 46 TONDIS RES sauna a on 61 PalVideoOutGetTotalXCT 48 Vv KE EN eee KA vendor ID COdeS ii 20 PalVideoOutGetTotalYCT 48 version Numbers s sese ees eseeelnasannneo 19 PalVideoOutGetVBlank 49 PalVideoOutGetVisibleX 46 PalVideoOutGetVisibleXCT 47 PalVideoOutGetVisibleY 46 PalVideoOutGetVisibleYCT 47 PalVideoOutGetX e ee esieeeeesesieeo 48 PalVideoOutGetXWidth 44 PalVideoOutGetXWidthCT 44 PalVideoOutGetY sees iseeessssinnos 49 PalVideoOutGetYWidth 44 PalVideoOutGetYWidthCT 44 PalVideoOutOptimalCT 46 PalVideoOutRequire 44 PalVideoOutReset e 44 Page 66 sd www celoxica com Celoxica
3. 28 PalErrorHandlerRun 21 PalParallelPortUniqueCount 28 PalElhernet sm EE 58 PalPLIRAM eee eeeeeeeeeenneennnnenntio 32 PalEthernetCount cccccesseceeessteeeeeeeeaes 58 Pal 7PBAMCoumt esee eeeeeseeeenntos 32 PalEthernetCT eeeeeseseenneneneintoo 58 Pap IRAMCT esenee eeno neennneeenneio 32 PalEthernetDisable snnsnsennaeenn ee neen nenene 58 PalPL1 RAMDisable e sees seen 32 Palttbermettnable ees 58 PalPL1 RAMEnable esenee 32 PDaltibermetbead eseeton 59 PalPL1 RAMGetAddressWidth 32 PalEthernetReadBegin 59 PalPL1RAMGetAddressWidthCT 32 PalEthernetReadEnd 60 PalPL1 RAMGetDataWidtih 32 PalEthernetRequire 58 PalPL1IRAMGetDataWidthCT 32 PalEthernetUniqueCount 58 PalPLiRAMGetMaxAddressWidthCT 32 PalEthernetWrite eeee esee 60 PalPL1IRAMGetMaxDataWidthCT 32 PalEthernetWriteBegin 60 PalPL1RAMPortRequire 32 PDaltibermenrttetnd i 61 Pap 7PHAMead 35 PalFastRAM unarna 30 Pall PBAMbieset ee eneo esenee 32 PDaltaebAMcCoumt nenene nennnnn nna 30 PalPLIRAMRUn ererrvrrrnrrrrn
4. locks n toreGe tDataWidth toreGe tRAMGetAddressWidth toreGe toreGe tDataWidthCT toreGe tRAMGetAddressWidthCT toreGe tore tore set HandleCT ClockRate tDataWidth Handle Handle tAddressWidth Handle Handle tBlockLength Handle tDataWidthCT HandleCT HandleCT tAddressWidthCT HandleCT HandleCT tBlockLengthCT HandleCT Run HandleCT ClockRate see page 23 Reset Handle Handle torel able toreDisable isabl tore toreWrite Enable Handle Handle Handle e Handle Read Handle Address DataPtr Handle Address Data torel EraseBlock Handle BlockNumber PalBlockStoreGetMaxBlockLengthCT macro macro expr PalBlockStoreGetMaxLengthCT Arguments None Return value Description OG Integer compile time constant for specifying a width Returns the maximum length of a block for all of the block store devices on the platform at compile time This is typically but not always a power of two PalBlockStoreGetBlockLength macro macro expr PalBlockStoreGetLength Arguments Return value Description Handle Handle PalHandle to a BlockStore resource Integer value evaluated at runtime Returns the actual length of a block for the block store device used by the handle referred to at runtime Since this method works at runtime it can be used even when Handle is not a co
5. 52 data I O 27 PalAudioOutUniqueCounNt 51 Ethernet 58 PalBlockStore sesesese eee 38 LEDs 25 PDalb locktGtorecCount 38 parallel ports 28 PalBlockStoreCT EEE EE 38 PS 2 ports 2 PalBlockStoreDisable sara anima 38 D 9 RAM 30 32 34 36 38 52 PalBlockStoreEnable eeeeenenn 38 Reconfigure 61 PalBlockStoreEraseBlock 40 resource handles 19 PalBlockStoreGetAddressWidth 38 RS 232 29 PalBlockStoreGetAddressWidthCT 38 serial ports 29 PalBlockStoreGetBlockLength 39 seven segment displays 25 PalBlockStoreGetBlockLengthCT 39 switches 27 PalBlockStoreGetDataWidth 38 Page 63 sd www celoxica com Celoxica PAL API reference PalBlockStoreGetDataWidthCT 38 PDaltaebAMtsable eenen 30 PalBlockStoreGetMaxAddressWidthCT 38 PDaltaetiAMtnable 30 PalBlockStoreGetMaxBlockLengthCT 38 PalFastRAMGetAddressWidth 31 PalBlockStoreGetMaxDataWidthCT 38 PalFastRAMGetAddressWidthCT 31 PalBlockStoreRead eesis 39 PalFastRAMGetDataWidth 30 PalBlockStoreRequire icii 38 PalFastRAMGetDataWidthCT 30 Pal lockGtorebteset eesis 38 PalFastRAMGetMaxAddressWidthCT 30 PalBlockStoreRun sssssssssnnssssnnsnneerrnsernnn
6. Note that for the Raw touch screen methods the X and Y coordinates and corresponding widths are NOT scaled for the pixel dimensions of the display available on a given platform PalTouchScreenReadScaled Handle XPtr YPtr TouchPir macro macro proc PalTouchScreenReadScaled Handle XPtr XPtr TouchPtr Page 61 www celoxica com Celoxica PAL User Guide Arguments Handle PalHandle to a PalTouchScreen resource XPtr Pointer to an Ivalue of type unsigned PalTouchScreenGetScaledXWidthCT YPtr Pointer to an Ivalue of type unsigned PalTouchScreenGetScaledYWidthCT TouchPt r pointer to an Ivalue e g variable or signal of type unsigned PalTouchScreenGetTouchWidthCT Timing 1 or more cycles Description Reads the current state of the TouchScreen pointed to by Handle The call sets both the touch state value in TouchPtr and the X and Y coordinates of the captured pixel in XPtr and YPtr Note that for the Scaled touch screen methods the X and Y coordinates and corresponding widths are scaled for the pixel dimensions of the display available on a given platform Page 62 www celoxica com Celoxica PAL API reference version numbers 19 5 Index vr video input 40 E video output 44 PAL GOfeS sssigrsrr eeo enerenerenno vani tanevanasaus 9 12 idio 21 PAL Kilio aos pi ageet konon Seba ee ee 16 examples PAL 9 11 PAL resources mmmvvrravnnnrrnvrvrvnvnnnnannnnnverrnnnnnnr 19
7. Platform Developer s Kit PAL manual Page 2 PAL manual Celoxica the Celoxica logo and Handel C are trademarks of Celoxica Limited All other products or services mentioned herein may be trademarks of their respective owners Neither the whole nor any part of the information contained in or the product described in this document may be adapted or reproduced in any material form except with the prior written permission of the copyright holder The product described in this document is subject to continuous development and improvement All particulars of the product and its use contained in this document are given by Celoxica Limited in good faith However all warranties implied or express including but not limited to implied warranties of merchantability or fitness for purpose are excluded This document is intended only to assist the reader in the use of the product Celoxica Limited shall not be liable for any loss or damage arising from the use of any information in this document or any incorrect use of the product The information contained herein is subject to change without notice and is for general guidance only Copyright O 2005 Celoxica Limited All rights reserved Authors RG Document number 1 Customer Support at http www celoxica com support Celoxica in Europe Celoxica in Japan Celoxica in the Americas T 44 0 1235 863 656 T 81 0 45 331 0218 T 1 800 570 7004 E sales emea celoxica com E sales j
8. see page 22 Kal e macro expr PalEthernetUniqueCount Wei see macro expr PalXUniqueCount see page 22 Kal e macro proc PalEthernetRequire Count see macro proc PalXRequire Count see page 22 Kal e macro proc PalEthernetRun HandleCT MacAddress ClockRate Kal e macro proc PalEthernetReset Handle see macro proc PalXReset Handle Kal e macro proc PalEthernetEnable Handle see macro proc PalXEnable Handle Kal e macro proc PalEthernetDisable Handle See macro proc PalXDisable Handle e macro proc PalEthernetReadBegin Handle DestinationPtr SourcePtr TypePtr DataByteCountPtr ErrorPtr e macro proc PalEthernetRead Handle DataPtr ErrorPtr e macro proc PalEthernetReadEnd Handle ErrorPtr e macro proc PalEthernetWriteBegin Handle Destination Type DataByteCount ErrorPtr e macro proc PalEthernetWrite Handle Data ErrorPtr e macro proc PalEthernetWriteEnd Handle ErrorPtr PalEthernetRun macro macro proc PalEthernetRun HandleCT MacAddress ClockRate Arguments HandleCT constant PalHandle to a PalEthernet resource MacAddress Ethenet MAC address to be used by the network chip or type unsigned 48 ClockRate Clock rate of the clock domain of the call to this macro in Hz Timing Does not terminate in normal use Description Runs the device m
9. GetAddressWidthCT HandleCT HandleCT RAMGetAddressWidthCT HandleCT ClockRate HandleCT ClockRate Run see page 23 Reset Handle XReset Handle Handle macro proc 2Disable XEnable Handle Handle macro proc Pal ro proc Pal 2 2 1 1 XDisable Handle RAMSetReadAddress Handle Address RAMSetWriteAddress Handle Address RAMRead Handle DataPtr RAMWrite Handle Data PalPL2RAMSetReadAddress macro macro proc PalPL2RAMSetReadAddress Page 34 www celoxica com Handle Address TH Celoxica PAL User Guide Arguments Handle PalHandle to a PL2RAM resource Address Address of data to read of type unsigned PalPL2RAMGetMaxAddressWidthCT Timing 1 clock cycle Description Sets the address for a read that will occur two clock cycles later For example seq PalPL2RAMSetReadAddress Handle Addr delay PalPL2RAMRead Handle amp Data PalPL2RAMSetWriteAddress macro macro proc PalPL2RAMSetWriteAddress Handle Address Arguments Handle PalHandle to a PL2RAM resource Address Address of data to read of type unsigned PalPL2RAMGetMaxAddressWidthCT Timing 1 clock cycle Description Sets the address for a write that will occur two clock cycles later PalPL2RAMRead macro macro proc PalPL2RAMRead Handle DataPtr Arguments Handle PalHandle to a PL2RAM res
10. Handle e macro proc PalSevenSegWriteShape Handle ShapeMask e macro proc PalSevenSegWriteDigit Handle Value DecimalPoint PalSevenSegWriteShape macro macro proc PalSevenSegWriteShape Handle ShapeMask Arguments Handle PalHandle to a SevenSeg resource ShapeMask expression of type unsigned 8 Timing 1 clock cycle Description Set a particular shape in the seven segment display ShapeMask is a binary mask where 1 means ON and 0 means OFF Each of the eight bits corresponds to a segment of the display 7 segments for the digit and one for the decimal point PalSevenSegWriteDigit macro macro proc PalSevenSegWriteDigit Handle Value DecimalPoint Arguments Handle PalHandle to a SevenSeg resource Value expression of type unsigned 4 DecimalPoint expression of type unsigned 1 Timing 1 clock cycle Description Set a particular hexadecimal digit in the seven segment display Value is the hex value and DecimalPoint specifies whether the decimal point should be turned on 1 or off 0 4 3 3 Binary switches and buttons Switch API The switch API supports simple binary switches or buttons typically used for debugging More complex switches can be supported via the data port API e macro expr PalSwitch Index see macro expr PalX Index see page 21 e macro expr PalSwitchCT IndexCT See macro expr PalXCT IndexCT see page 21 e macro expr PalSwitchCount See macro e
11. for example SDRAM memory modules with different memory size Mobile SDRAM or replaceable modules this macro allows you to pass memory parameters defined in DEFINE SDRAM MEMORY PARAMETERS directly to the run macro from PAL layer PalSDRAMSetAddress macro macro proc PalSDRAMSetAddress Handle Address Arguments Handle PalHandle to an SDRAM resource Address Address of data to read of type unsigned PalSDRAMGetMaxAddressWidth Handle Timing 1 clock cycle Description Sets the address for a read or write For example seq PalSDRAMSetAddress Handle Addr PalSDRAMRead Handle amp Data PalSDRAMSetAddressMask macro macro proc PalSDRAMSetAddressMask Handle Address Mask Page 54 www celoxica com Celoxica PAL User Guide Arguments Handle PalHandle to an SDRAM resource Address Address of data to read of type unsigned PalSDRAMGetMaxAddressWidth Handle Mask Byte write enable signals Timing 1 clock cycle Description Sets the address for a read or write For example seq PalSDRAMSetAddressMask Handle Addr 0b0011 PalSDRAMWrite Handle Data PalSDRAMWrite macro macro proc PalSDRAMWrite Handle Data Arguments Handle PalHandle to an SDRAM resource Data Data to write Timing Variable number of clock cycles Because the refresh request generated internally has the highest priority the macro will wait until the refresh is finished Minimal latency is 1 clock cycl
12. Click OK to close the Tool Options dialog If you want to target a platform that is not currently supported by PAL you will need to create your own Platform Support Library This is described in the PSL Tutorial Guide 2 2 Supported platforms PAL version 1 3 has support for the following platforms Celoxic RC10 Celoxica RC100 Celoxica RC1000 Celoxica RC200 and RC200E Celoxica RC203 and RC203E Celoxica RC250 and RC250E Celoxica RC300 and RC300E Celoxica RC2000 ADM XRC II Altera Niosll development board stratix edition NDBS Memec MV2P Celoxica PALSim Virtual Platform 2 3 Supported devices PAL version 1 3 has support for the following devices Page 8 LEDs www celoxica com Celoxica Platform Abstraction Layer PAL e Seven segment displays e Switches and buttons e Data ports e Parallel ports e RS 232 serial ports e PS2 ports e Fast RAMs e Pipelined RAMs PL1 and PL2 e Slow RAMs e SDRAMs e Block storage devices such as flash memory e Video output devices e Video input devices e Ethernet e Audio input devices e Audio output devices See the PAL resource specific API reference see page 24 for more information 2 4 PAL examples PAL comes with several example projects which you can compile and run on the different PAL platforms There is also a PAL tutorial application To use the examples open the PAL Examples Workspace in DK by selecting Start gt Programs gt Celoxica gt
13. H PAL TouchScreen AP 61 Debt snus 18 nende EE EE E 19 Padin ss e e kand 50 NMS 8 TEE EE 50 DalAudiolntT sees snenennnnnnnnnoo 50 PG E 7 DalAudiolnftsable aanann nenna 50 compile time selection 15 PalAudiolnEnable sororrvrvrvrvvvsvsvreenenenennr 50 creating your own design 12 PalAudiolnGetDataWidth 50 data width abstraction 15 PalAudiolnGetMaxDataWidthCT 50 devices supported 8 PalAudiolnRead uses isnn neneeese ito 51 genene ES 12 PalAudiolnRequire esee ee seneese 50 neadan Mgs 8 PalAudiolnReset mnie ienis iio 50 LAL aperin d Pal udlolefun 1111s 11tsr ttnet asenn 50 e nis 8 PalAudiolnSetSampleRate 51 panonmesuppone 2 PalAudiolnUniqueCount 50 resource handles 14 PalAudioOut 51 mr we Pen indie ped PalAudioOutCount uun 51 setting up a device 16 l l PalAudioCutt Te 51 simulating 10 14 PalAudioOutDisabl 54 ER 13 14 al AudioCuiDtsable usar quide 42 PalAudioOutEnable 51 PAL API 18 PalAudioOutGetMaxDataWidthCT 51 ne Oe ee PalAudioOutRequire 51 audio input 50 i audio output 51 PalAudioOUtReset rrrnranavvvnnrrnarvvnrrnsrrnnennn 51 PalAudioOutRun s sessee enen 51 block storage 38 Buttons 27 PalAudioOutSetSampleRate
14. Message These messages warn you that actions may damage your hardware x Handy Note These messages draw your attention to crucial pieces of information Hexadecimal numbers will appear throughout this document The convention used is that of prefixing the number with Ox in common with standard C syntax Sections of code or commands that you must type are given in typewriter font like this void main Information about a type of object you must specify is given in italics like this copy SourceFileName DestinationFileName Optional elements are enclosed in square brackets like this struct type_Name Curly brackets around an element show that it is optional but it may be repeated any number of times string character www celoxica com Celoxica PAL manual Assumptions amp Omissions This manual assumes that you e have used Handel C or have the Handel C Language Reference Manual e are familiar with common programming terms e g functions e are familiar with your operating system Linux or MS Windows This manual does not include e instruction in VHDL or Verilog e instruction in the use of place and route tools e tutorial example programs These are provided in the Handel C User Manual Page 6 sd www celoxica com Celoxica Platform Abstraction Layer PAL 1 Platform Abstraction Layer PAL The Platform Abstraction Layer PAL is a component of the Platform Developer s Kit PAL i
15. Platform Developer s Kit gt PAL gt PAL Examples Workspace The workspace includes a set of configurations that will let you build the examples on platforms that feature the required peripherals You can choose the combination of project and platform from the drop down menus in the Build toolbar Alternatively you can select a configuration by clicking on the Build gt Set Active Configuration menu Once you have selected the configuration you wish to build click on the build icon or press F7 to start the compilation If you target a Celoxica supported platforms DK will automatically run the Xilinx or Altera place and route tools for you to produce a configuration file for these platforms You must already have the place and route software installed for this to work If you select the Celoxica Virtual Simulation platform Sim configuration you can simulate the example after building it by pressing F5 This will launch the PALSim application 2 5 PAL Cores PAL is augmented with a set of PAL Cores These are generic IP Cores that add functionality to the PAL devices The PAL Cores supplied with PAL version 1 2 are e Console a generic video console library e Framebuffer generic libraries for 16 and 8 bit frame buffers e Mouse driver a generic mouse driver library Page 9 www celoxica com Celoxica Platform Abstraction Layer PAL Page 10 e Keyboard driver a generic keyboard driver library The PAL Cores API may be
16. The frequency of the clock in the clock domain of the call to PalVideoOutRun in units of Hertz Return value Integer value evaluated at runtime Description Returns the actual horizontal resolution of the video output device used by the handle referred to at runtime Since this method works at runtime it can be used even when Handle is not a constant such as when it is passed through a function parameter However it cannot be used to set the width of variables PalVideoOutGetVisibleY macro macro expr PalVideoOutGetVisibleXY Handle Arguments Handle PalHandle to a VideoOut resource Return value Integer value evaluated at runtime Description Returns the actual vertical resolution of the video output device used by the handle referred to at runtime Since this method works at runtime it can be used even when Handle is not a constant such as when it is passed through a function parameter However it cannot be used to set the width of variables PalVideoOutGetTotalX macro macro expr PalVideoOutGetTotalX Handle ClockRate Arguments Handle PalHandle to a VideoOut resource ClockRate The frequency of the clock in the clock domain of the call to PalVideoOutRun In units of Hertz Return value Integer value evaluated at runtime Description Returns the actual total number of columns including the blanking period of the video output device used by the handle referred to at runtime Since this method works at r
17. at runtime Since this method works at runtime it can be used even when Handle is not a constant such as when it is passed through a function parameter However it cannot be used to set the width of variables PalVideolnGetColorWidth macro macro expr PalVideoInGetColorWidth Handle Page 41 sd www celoxica com Celoxica PAL User Guide Arguments Handle PalHandle to a Videoln resource Return value Integer value evaluated at runtime Description Returns the actual width of the pixel colour of the video input device used by the handle referred to at runtime Since this method works at runtime it can be used even when Handle is not a constant such as when it is passed through a function parameter However it cannot be used to set the width of variables PalVideolnGetXWidthCT macro macro expr PalVideoInGetXWidthCT HandleCT Arguments HandleCT constant PalHandle to a Videoln resource Return value Integer compile time constant for specifying a width Description Returns the actual width of the X co ordinate of the video input device that is used by the handle referred to at compile time Since this method works at compile time it can only be used where HandleCTisa constant and can be deduced to be a constant by the DK compiler So for instance this cannot be used if Hand1eCTis passed through a function parameter However since it returns a compile time constant it can be used to set variable widths and do conditi
18. in the debugger which will start PALSim as well 3 4 2 Stopping a PALSim simulation You can end a PALSim simulation by selecting Debug gt Stop debugging in DK or by pressing Shift F5 If you use the Shift F5 shortcut you must have the DK window in focus rather than the PALSim window It is also possible to close the PALSim window directly which will leave the DK simulation still running Note that if you do this you will need to restart the simulation in DK to get the PALSim window back again 3 5 Programming with PAL 3 5 1 Resource handles Resource handles provide abstraction over the peripherals on a platform An implementation of PAL provides each peripheral on a platform with at least one resource handle Every PAL implementation will provide macros that tell you how many resources of a particular type are present For example the macro PalLEDCount will return the number of LEDs there are on your target platform Even if there are no LEDs the macro is still implemented and will simply return 0 An implementation also provides macros for accessing resource handles For example the macro www celoxica com Celoxica Introduction to PAL PalLED Index takes an argument Index and returns the resource handle corresponding to a specific LED This enables you to write PAL applications that are parameterized to match the resources on the platform for which they are built You use the resource handle to specify which
19. it returns a compile time constant it can be used to set variable widths and do conditional compilation using select and ifselect PalVideoOutGetVisibleYCT macro macro expr PalVideoOutGetVisibleCT HandleCT Arguments HandleCT constant PalHandle to a VideoOut resource Return value Integer compile time constant Description Returns the actual vertical resolution of the video output device that is used by the handle referred to at compile time Since this method works at compile time it can only be used where HandlecT is a constant and can be deduced to be a constant by the DK compiler So for instance this cannot be used if HandlecT is passed through a function parameter However since it returns a compile time constant it can be used to set variable widths and do conditional compilation using select and ifselect PalVideoOutGetTotalXCT macro macro expr PalVideoOutGetTotalXCT HandleCT ClockRate Arguments HandleCT constant PalHandle to a VideoOut resource ClockRate The frequency of the clock in the clock domain of the call to PalVideoOutRun In units of Hertz Return value Integer compile time constant Description Returns the actual total number of columns including blanking period of the video output device that is used by the handle referred to at compile time Since this method works at compile time it can only be used where HandlecT is a constant and can be deduced to be a constant by the DK compiler So fo
20. peripheral you wish to access using other members of the PAL API For example the macro PalLEDWrite Handle Data sets a value on the LED referenced by Handle Resource handles are also used to select between different modes of operation that a peripheral has For example a video output resource that can operate in different resolutions will have a resource handle for each resolution mode The number of resources returned by PalXCount see page 22 may be greater than the number of physical X type resources on the platform You can query exactly how many different resources a platform has by using the macro Pal XUniqueCount see page 22 See the PAL API reference see page 18 for further information PAL resource handles example The following code example turns on all the LEDs on a platform in a platform independent fashion It uses PalLEDCount to return the number of LEDs on the platform Pal LED to geta handle to each resource and PalLEDWrite to set a value on each LED resource static unsigned log2ceil PalLEDCount 1 i 0 while i lt PalLEDCount PalLEDWrite PalLED i 1 i 3 5 2 Compile time and run time selection PAL provides macros for compile time and run time evaluation The compile time macros can be used to perform conditional compilation with ifselect and to set the widths of variables These macros take arguments which the DK compiler must be able to ev
21. proc PalLEDWrite macro macro proc PaLEDWrite Arguments macro proc PaLE DUniqueCount see page 21 IndexCT IndexCT see page 21 see page 22 OG PalXUniqueCount see page 22 EDRequire Count PalXRequire Count see page 22 EDWrite Handle Data Handle Data Handle PalHandle to an LED resource Data expression of type unsigned 1 Timing 1 clock Description cycle Statement Turns an LED on or off A value of 1 means on 0 means off 4 3 2 Seven segment displays SevenSeg API The seven segment display API supports standard seven segment plus decimal point displays More complex displays can be supported via the data port API e macro expr Pal See macro expr See macro expr See macro expr see macro expr See macro proc See macro expr macro expr Pal macro expr Pal macro expr Pal macro proc Pal macro proc Pal LSevenSeg PalX Index SevenSegCT PalXCT SevenSegCount PalXCount SevenSeg SevenSeg UniqueCount PalXUniqueCount Index see page 21 IndexCT IndexCT see page 21 0 see page 22 OG see page 22 Requir PalXRequire SevenSegEnable le PalXEnab Page 25 www celoxica com macro proc Pal Count SevenSegDisable Count see page 22 Handle Handle Handle er Celoxica PAL User Guide See macro expr PalXDisable
22. proc PalXRequire Count see page 22 Page 49 e www celoxica com Celoxica PAL User Guide e macro expr PalAudioOutGetMaxDataWidthCT 7 see macro expr PalXGetMaxDataWidthCT e macro expr PalAudioOutGetDataWidth Handle see macro expr PalXGetDataWidth Handle e macro expr PalAudioOutGetDataWidthCT HandleCT See macro expr PalXGetDataWidthCT HandleCT e macro proc PalAudioOutRun HandleCT ClockRate n ee macro proc PalXRun HandleCT ClockRate see page 23 e macro proc PalAudioOutReset Handle n ee macro proc PalXReset Handle e macro proc PalAudioOutEnable Handle wn ee macro proc PalXEnable Handle e macro proc PalAudioOutDisable Handle See macro proc PalXDisable Handle e macro proc PalAudioOutSetSampleRate Handle SampleRate e macro proc PalAudioOutWrite Handle Left Right PalAudioOutSetSampleRate macro macro proc PalAudioOutSetSampleRate Handle SampleRate Arguments Handle PalHandle to an AudioOut resource SampleRate integer constant equal to the number of samples per second that the output device should expect Timing 1 or more clock cycles Description Sets the sample rate of the audio output device If the sample rate requested is not supported by the device then the rate is left unchanged PalAudioOutWrite macro macro proc PalAudioOutWrite Handle Left Right Arguments Handle PalHandle to
23. subject to change in the future 2 6 PAL Virtual Platform PALSim PALSim allows you to simulate PAL designs When you run a simulation the PALSim application appears and provides a visual representation of the behaviour of devices such as a VGA screen RAM and LEDs PAL Virtual Platform E LEDs do wl vi wi Wi Us we vi Seven Segment Displays Hina Eee JE INOJ NII Je NION INGO Nik VGA 768 76Hz Mouse DataPort v Keyboard DataPort Mouse Buttons W LButton 4 MButton La Buttons 4 Button5 IO x Mouse Offset Keyboard Input Dettax 0 ALT CTRL Detay 0 Ser Dettaz 0 CAPS VGA 768 76Hz Current Update Line 167 Cursor position 0 0 RGB at last cursor position 0 0 0 PAL VIRTUAL PLATFORM PALSIM The following devices are included in the PALSim application e LEDs e Seven segment displays e Switches e Buttons e Generic data ports These can be used to simulate a parallel port or an RS232 serial port You can browse and select a file for input or output e Mouse Mouse input from your PC during a simulation is shown on as a cursor on the VGA simulation If you click the mouse buttons this information is sent to the data port and displayed in the Mouse Buttons area above the VGA screen e Keyboard You can type characters into a window on the PALSim application The information is sent to the data port and can be displayed on the VGA s
24. the library it is linked against Applications can ensure that they are compiling with a compatible API by calling PalVersionRequire Major Minor with the major and minor API version for which they were originally written 4 2 3 Library version information PalVendorCode macro macro expr PalVendorCode Arguments None Return value Integer constant Description Returns a specific integer code uniquely identifying a vendor Vendors should use their PCI vendor ID code if possible For instance Celoxica is 0x4144 Intel is 0x8086 Vendors without a PCI vendor ID code should use the space above 0x10000 contacting Celoxica before releasing a library in order to avoid conflicts PalVendorRelease macro macro expr PalVendorRelease Arguments None Return value Integer constant Description Returns a vendor specific integer code uniquely identifying a given library and release number Applications typically only need to check vendor code and release number to provide source level workarounds for known bugs in specific library releases PalVendorString macro macro expr PalVendorString Arguments None Return value String constant Description Returns a vendor specific string primarily for use in debugging Page 20 www celoxica com Celoxica PAL User Guide 4 2 4 Error handling in PAL PalErrorCode Description The type of PAL run time error codes Possible values are PAL ERROR OK No erro
25. to create a PAL application that targets a specific PAL platform you must include the platform specific header file in your source files and set DK to link your project with the following libraries e PAL library for your chosen target e g pal rc200 hcl e PSL for your chosen target e g rc200 hc1 e The standard Handel C library stdlib hcl You need to add these libraries to the Object Library modules box on the Linker tab in Project Settings The libraries are in Instal1Dir PDK Hardware Include PALSim see page 14 requires different settings 3 3 1 Saving project settings for different platforms You can save project settings for PAL projects as a new configuration This allows you to change the settings to build for different targets easily 1 Select Build gt Configurations and then click the Add button 2 Enter a name for your new configuration and select the configuration type that you wish to use as a base in the Copy settings from box Click OK 3 Click the Close box 4 Open the Project settings dialog select the new configuration and edit the settings as required The configuration will only be available in the project you defined it in 3 If you want to set a configuration for the RC300 RC200 RC100 RC1000 Nios or PALSim you can copy the project settings for the relevant configuration used in the PAL Examples workspace Page 13 www celoxica com TH Celoxica Introduction to PAL Page 14 3 4
26. 1 Running a PALSim simulston nnt 14 3 4 2 Stopping a PALSim simulation eeeeeesssnessennkeanktnaankteannktnnktaanknIaanktankktaaa 14 3 5 PROGRAMMING WITH PAL snnnnnnnvennnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnennnnnnnnnnnnnnnnnevennnnnnnnnnnnnnr 14 3 5 1 Resource handles ammineussrmsserinessi canesesdadvavsedaasusvasdaacadetdadwavald qasnvstlaadevstdaaccduaddaveasnadeneseaas 14 3 5 2 Compile time and run time selechon urene nretnnrneennnenennenennn 15 3 5 3 Data width abstraction esursseceuirarinuuinuuneu unina nenika nana ENEE EN KEENER AANE EARNE EENKEER NE K AEE EN 15 3 5 4 Setting up a PAL device nsrnnannvnrerrvrnnrrvnnnrnnnnnvnnrnrrennnrnnsnnnenerresnsrnesnnrnnnennenssrresnnnnsennensennernnn 16 3 5 5 PAL Kit workspace rrnrnnnnrrnnnnnnnnnnrvnnnrrennnrnnnnnnnrerrennnravennrenennenenrrnesnnnnnennnnrenresnnnneennnenennnennnn 16 4 PAL API REFERENCE maniok bakben URAN MARTAN KNA KU KR KAR ANKA rakG AN suu Kk 18 4 1 HEADER AND LIBRARY FILES ssecesssssssssssssnennnsssnunssssunnnnnnnnnnusssssnsnnnns 18 4 2 GENERIC API EE 19 4 2 Resource handles uns 19 4 2 2 API version NUMBERS sich aadnk cies nice ender masete 19 4 2 3 Library version Information 20 4 2 4 Error handling in PAL reeesnrrnnnnvononnvnnnnvrnnnnrnnnnnvnnnrrennnrenennrnenenresnsrnnsnnrnsennennenresnnrnessnnnnnenennnnn 21 4 2 5 Generic MONO ET 21 4 3 RESOURCE SPECIFIC API iectssicstscsenctatstanavansnsinsacesaneieceddncss
27. Address Address of data to be written of type unsigned PalFastRAMGetMaxAddressWidthCT Data expression of type unsigned PalFastRAMGetMaxDataWidthCT 0 Timing 1 clock cycle Description Writes a single item of data to the RAM at the specified address 4 3 9 Pipelined single cycle RAMs PL1RAM API PL1 RAMs are RAMs that can be read from or written to in exactly one clock cycle but with the address supplied one cycle earlier and hence pipelined This is typically as fast way of accessing RAMs in terms of combinational path length The PL1RAM API is suitable for standard zero bus turnaround ZBT synchronous static RAM e macro expr PalPLIRAM Index See macro expr PalX Index see page 21 e macro expr PalPLIRAMCT IndexCT See macro expr PalXCT IndexCT see page 21 e macro expr PalPLIRAMCount see macro expr PalXCount see page 22 Page 31 ss www celoxica com Celoxica PAL User Guide e macro expr PalPLIRAMUniqueCount see macro expr PalXUniqueCount see page 22 e macro proc PalPLIRAMRequire Count see macro proc PalXRequire Count see page 22 e macro expr PalPLIRAMGetMaxDataWidthCT n ee macro expr PalXGetMaxDataWidthCT e macro expr PalPLIRAMGetMaxAddressWidthCT n ee macro expr PalFastRAMGetMaxAddressWidthCT e macro expr PalPLIRAMGetDataWidth Handle n ee macro expr PalXGetDataW
28. DK screen and then select Sim as the build configuration in the box next to this Some of the examples take a long time to compile Quicker examples include sevenseg led videoout and fastram Page 11 e www celoxica com Celoxica Introduction to PAL 3 PAL User Guide 3 1 Creating your own PAL design You need to set up your project to use the correct header files and libraries You also need to include the relevant header files in your source code The quickest way to get started with PAL is to take one of the existing projects in the PAL Examples Workspace Start gt Programs gt Celoxica gt Platform Developer s Kit gt PAL gt PAL Examples Workspace and modify the code to meet your own design Alternatively you can use the Pal Kit Workspace Start gt Programs gt C eloxica gt Platform Developer s Kit gt PAL gt PAL Kit Workspace which contains empty implementations for each of the supported PAL devices If you need to create a new workspace and project you must manually set the project configurations in DK see page 13 The examples provided with the PAL distribution use a unified header file pal master hch This automatically includes one of the platform specific header files depending on C preprocessor defin macros that are set in the project configuration Different project configurations link against different libraries and set different def ine macros to enable you to switch between target platforms by changing the active
29. Index VideoOutCount PalXCount VideoOutUnique VideoOutRequir PalXRequire VideoOutOptima VideoOutGetMax PalVideoInGe VideoOutGetMax PalVideoInGe VideoOutGetMax PalXUniqueCount Count tMaxXWidthCT tMaxYWidt Index see page 21 Index see page 21 OG see page 22 Count OG Count OG see page 22 e see page 22 1CT ClockRate OG XWidthCI OG YWidthCT 7 ACT OG ColorWidthCT PalVideoInGe VideoOutGetXWi PalVideoInGe See macro expr Page 43 www celoxica com macro expr Pal VideoOutGetYWi PalVideoInGe tMaxColorWidthCT tXWidth tYWidth OG dth Handle Handle dth Handle Handle m Celoxica PAL User Guide e macro expr PalVideoOutGetColorWidth Handle see macro expr PalVideoInGetColorWidth Handle e macro expr PalVideoOutGetXWidthCT HandleCT see macro expr PalVideoInGetXWidthCT HandleCT e macro expr PalVideoOutGetYWidthCT HandleCT See macro expr PalVideoInGetYWidthCT HandleCT e macro expr PalVideoOutGetXColorWidthCT HandleCT See macro expr PalVideoInGetXColorWidthCT HandleCT e macro expr PalVideoOutGetVisibleX Handle ClockRate e macro expr PalVideoOutGetVisibleY Handle e macro expr PalVideoOutGetTotalX Handle ClockRate e macro expr PalVideoOutGetTotalY Handle e macro expr Pa
30. PalX Index see page 21 e macro expr PalReconfigureCT IndexCT See macro expr PalXCT IndexCT see page 21 e macro expr PalReconfigureCount see macro expr PalXCount see page 22 Page 58 www celoxica com Celoxica PAL User Guide e macro expr PalReconfigureUniqueCount see macro expr PalXUniqueCount see page 22 e macro proc PalReconfigureRequire Count see macro proc PalXRequire Count see page 22 e macro proc PalReconfigureNow Handle ImageAddress see macro proc PalReconfigureNow Handle ImageAddress 4 3 20 PAL TouchScreen API The touch screen API supports standard touch screen displays e macro expr PalTouchScreenPort Index see macro expr PalX Index see page 21 e macro expr PalTouchScreenCT IndexCT see macro expr PalXCT IndexCT see page 21 e macro expr PalTouchScreenCount see macro expr PalXCount see page 22 e macro expr PalTouchScreenUniqueCount see macro expr PalXUniqueCount see page 22 e macro proc PalTouchScreenRequire Count see macro proc PalXRequire Count see page 22 e macro proc PalTouchScreenReadScaled Handle XPtr YPtr TouchPtr see macro proc PalTouchScreenReadScaled Handle XPtr YPtr TouchPtr see page 61 e macro proc PalTouchScreenReadRaw Handle XPtr YPtr TouchPtr see macro proc PalTouchScreenReadRaw Handle XPtr YPtr TouchPtr se
31. Targeting the PALSim platform If you wish to target the PALSim virtual platform you must set your project to link with the PAL and PSL Handel C libraries You also need to add the following settings Open the Project gt Settings dialog and check that you are in Debug configuration 2 On the Linker tab add sim hcl and pal sim hcl to the Object library modules box and PalSim 1ib to the Additional C C Modules box These files are in InstallDirNPDKNHardwareNLib and InstallDirNPDKNSoftwareNLib 3 Onthe Preprocessor tab add USE SIMto the Preprocessor definitions box You can save these settings as a project configuration sim hcl is the PSL for the PALSim platform and pal sim hcl is the PAL library for PALSim PALSim lib is the linker library which connects to the PALSim application The PALSim virtual platform also requires the dynamic link library PalSim d11 to be in your system path This is copied into the windows system directory of your computer by the PAL installer If you want to simulate PAL Ethernet applications you need to have a packet driver installed on your PC The WinPCap packet driver is installed as part of PDK 3 4 1 Running a PALSim simulation To run a PALSim simulation make sure that your project has the correct project settings and then compile your code using the Debug configuration or your own PALSim configuration The PAL examples have a Sim configuration which you can use Press F5 to run the program
32. acro macro proc PalXReset Handle Arguments Handle PalHandle to resource of type X Timing 0 or more clock cycles Description Resets the resource i e brings the resource to a known state As far as possible this known state is the state of the resource immediately after initialization this is not always possible for some peripherals The statement finishes executing once the reset is complete PalXEnable macro macro proc PalXEnable Handle Arguments Handle PalHandle to resource of type X Timing 0 or more clock cycles Description Enables the resource This is typically needed to arbitrate between shared resources or resources on shared buses PalXDisable macro macro proc PalXDisable Handle Arguments Handle PalHandle to resource of type X Timing 0 or more clock cycles Description Disables the resource Reverses PalXEnable Page 23 www celoxica com Celoxica PAL User Guide PalXRead Handle DataPtr macro proc PalXRead Handle DataPtr Arguments Handle PalHandle to resource of type X DataPtr pointer to an lvalue a writable resource e g variable or signal of the appropriate type For many resources this is an unsigned int of width PalXGetMaxDataWidthCT Timing 1 or more clock cycles Description Reads a single item of data from the resource and stores it in the Ivalue pointed at by DataPtr PalXWrite macro macro proc PalXWrite Handle Data Arguments Ha
33. aluate at compile time so for instance they cannot be passed through a function parameter Macros which require arguments that can be evaluated at compile time are denoted by the suffix cT For example the macro PalX Index see page 21 takes a non constant argument Index and returns a non constant resource handle whereas Pal XCT IndexCT see page 21 requires the argument IndexCT to be a constant and returns a constant resource handle PAL run time macros can be used to dynamically index through a set of peripherals as shown in the PAL resource handles example 3 5 3 Data width abstraction PAL provides abstraction over the different data widths of peripherals You can use the PAL API to query the data widths of a resource and parameterize your code accordingly There are three general macros that you can use to abstract over data width e PalXGetMaxDataWidthCT e PalxXGetDataWidth Handle e PalXGetDataWidthCT HandleCT The first macro PalXGetMaxDataWidthCT returns the maximum width of the data for any devices of type X at compile time The PAL macros that access these devices expect arguments of this width Page 15 www celoxica com Celoxica Introduction to PAL Page 16 You can use this macro to define the widths of variables in your code and to perform conditional compilation The second macro PalXGetDataWidth Handle returns the actual data width of the resource referenced by Handle at run time The re
34. an AudioOut resource Left Right Expressions of type unsigned PalAudioOutGetMaxWidthCT Timing 1 or more clock cycles Description Writes a stereo pair of samples to the audio output device Will block until the device is ready to accept a new sample If Pa lAudioOutWrite is not called quickly enough gaps may occur in the audio output 4 3 17 PAL SDRAM API Synchronous dynamic random access memory SDRAM is a memory technology that uses a clock to synchronize signal input and output on a memory chip The SDRAM clock is coordinated with the Page 50 sd www celoxica com Celoxica PAL User Guide SDRAM controller clock so the timing of the memory chips and the timing of the controller are synchronized SDRAM delivers bursts of data at high speeds using the synchronous interface Its is actually SDR SDRAM single data rate SDRAM but is usually referred to as just SDRAM The summary in the controller is available in SDRAM controller library document e macro expr PalSDRAM Index See macro expr PalX Index see page 21 e macro expr PalSDRAMCT IndexCT See macro expr PalXCT IndexCT see page 21 e macro proc PalSDRAMRequire Count see macro proc PalXRequire Count see page 22 e macro expr PalSDRAMCount see macro expr PalXCount see page 22 e macro expr PalSDRAMUniqueCount n ee macro expr PalXUniqueCount see page 22 e macro expr PalSDRAMGetMaxDataWidthCT n ee mac
35. anagement tasks for the Ethernet interface Must always run in parallel with accesses to the device Page 56 e www celoxica com Celoxica PAL User Guide PalEthernetReadBegin macro macro proc PalEthernetReadBegin Handle DestinationPtr SourcePtr TypePtr DataByteCountPtr Arguments Timing Description ErrorPtr Handle PalHandle to a PalEthernet resource DestinationPtr Pointer to data of type unsigned 48 Will return the destination MAC address from the received packet SourcePtr Pointer to data of type unsigned 48 Will return the source MAC address from the received packet TypePtr Pointer to data of type unsigned 16 Will return the type of the received packet DataByteCountPtr Pointer to data of type unsigned 11 Will return the number of data bytes in the packet excluding the header ErrorPtr Pointer to data of unsigned 1 Returns success 0 failure 1 1 or more clock cycles Checks to see if a packet is waiting to be read and if it is initiates the read process and returns source destination etc This must be followed by calls to PalEthernetRead to get data from the packet and PalEthernetReadEnd to complete the process If no packet is waiting to be read the macro will return ErrorPtr as 1 indicating an error PalEthernetRead macro macro proc Pall Arguments Timing Description EthernetRead Handle DataPtr ErrorPtr Handle PalHandle to a PalEt
36. apan celoxica com E sales america celoxica com www celoxica com Celoxica PAL manual Contents 1 PLATFORM ABSTRACTION LAYER PAL nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn 7 2 INTRODUCTION TO P L sasasansnnesnnnnsnnnnnnennnnvednsnsnknmknnaddamkn dekkende da ka damn dn 8 2 1 PAL LIBRARY AND HEADER FILES css ao an bai kkk dildo ii 8 2 2 SUPPORTED PLATFORMS eege EES 8 SEENEN 8 24 PAL EXAMPLES usr ada kO NO eiea VA da RAKON NGE DA KR KA RAIN A KR KO Ea ait 9 SEET 9 2 6 PAL VIRTUAL PLATFORM PALSIM cccccccceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeseeeeeeeeeeeeeeeess 10 2 6 1 PALSIM examples innen clon adena korlo asketado aa adeta i een id iata 11 3 PAL USER GUIDE oeusosgeeeueuEugEuEEEOEEENEKENEEESEENEEEEEENEEENEREEKEEEEEEEENEKENEEEEEENEEENEENEEENEN 12 3 1 CREATING YOUR OWN PAL DESIGN rrnnnnnnnnvnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnen 12 3 1 1 Creating a generic PAL library rrrnonrrnrnrrrnnnnrnnrnvrnnrrrennnrnnnnnnnnerrennnnrnnnnnnnnenneersrresnnnnnnnnnennnnen 12 3 2 USING PAL GORES sistaddsssisnsssnsdaniteasnndadesoncscdsssienssanaasucsandiatadasunansesucssnsnsnaasneduaaae 12 3 3 TARGETING A SPECIFIC PLATFORM annnnnunnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnunnnnnnnnnnnnnnnnnuunener 13 3 3 1 Saving project settings for different platforms vnr nrnnnnnnnnnrrrennnrnnnnnnnnennn 13 3 4 TARGETING THE PALSIM PLATFORM sss ns mnnon annnka danas au mi meiii ankau anko a damao kiauajuaadankaa as 14 3 4
37. ation PalBlockStoreGetBlockLength Handle is the first entry in block 1 e macro expr PalBlockStore Index See macro expr PalX Index see page 21 lockStoreCT PalXCT macro expr Pal Index See macro expr Index see page 21 macro expr PalB kStoreCount OG oc OG see page 22 see macro expr PalXCount macro expr PalBlockStoreUniqueCount OG OG see page 22 see macro expr PalXUniqueCount macro proc Pal toreRequire Count Count see macro proc quire see page 22 KS tMaxDataWidthCT PalXGetMaxDat OG tMaxAddressWidthCT macro expr PalBlockStoreGe OG see macro expr aWidthCT macro expr PalBlockStoreGe OG O OG See macro expr PalFastRAMGetMaxAddressWidthCT B macro expr PalBlockStoreGetMaxBlockLengthCT Page 37 www celoxica com m Celoxica PAL User Guide 3 n ee macro expr 3 Vv ee macro expr 3 Vv ee macro expr m See macro expr m See macro proc m See macro proc m See macro proc See macro proc acro expr Pal locks acro expr Pal PalXGe locks PalFas locks acro expr Pal acro expr Pal locks acro expr Pal PalXGe locks macro expr Pal PalFas acro proc Pal acro proc Pal acro proc Pal macro proc Pal macro proc Pal macro proc Pal locks lockS macro proc Pal
38. axYWidthCT 41 PalXGOUNE ss sia asa 22 PalVideolnGetXWidth 42 PAIXO Toseta tako ia sla pa ur ane Sa Sa kanako 21 PalVideolnGetXWidthCT 43 PalX Disable esee ee see esennnnennnio 24 PalVideolnGetYWidth 42 PalX Enable uvisst 23 PalVideolnGetYWidthCT 43 PalvGettatauwidth erneer nere eneren 22 PaVideolnbtead sse iesee eseon tneo 44 PalXGetDataWidthCT 23 PalVideolnbteouire e 40 PalXGetMaxDataWidthCT 22 PalVideolnbteset se iseeeesssiitnoo 40 PAlXR6A cisiascecsvsiteccatssatscdevnastysavadesdetaaee cerns 24 PalVideolnbtun sees e seseesinee 40 PalXRegquire esse ee seennneeeni 22 PalVideolnUniqUeCoUnt 40 aleet siajo sudansk 23 PalVideoOUtICOUNt ee ennenen nennen 44 PAIX RUM aes akro Ska bb neek spede 23 PalVideoQUICT ee nesr resrneee nenene 44 PalXUniqueGount arvnannvnnrnvvnrvrrvnnnrnnrnnvenenr 22 PalVideoOutDisable 44 PAlXWIIlE is sra iaa 24 PalVideoOutEnable seel 44 PETRAM oiec peno nvta oO lakta mea radia iccderseecessd 32 PalVideoOutGetColorWidth 44 GEAR eege 34 PalVideoOutGetColorWidthCT 44 Platform Abstraction Layer PAL Vi PalVideoOutGetHBlank
39. creen simulation e Fast RAM www celoxica com m Celoxica Platform Abstraction Layer PAL e PL1 Pipelined RAM e Block storage devices These can be used to simulate Flash RAM e Video output devices You can simulate the following VGA outputs 480 at 60Hz refresh 480 at 75Hz refresh 600 at 60Hz refresh 600 at 72Hz refresh 768 at 60Hz refresh or 768 at 76Hz refresh e Video input devices You can simulate the following inputs 160 x 120 176 x 144 320 x 240 352 x 288 720 x 480 or 720 x 576 e Ethernet If you enable an Ethernet simulation it will detect any packets sent across the network to your computer For example if you open an external web page the packets for the page will be displayed in PALSim The following information is displayed the MAC address of computer the packets have come from the destination address your computer the size of packet the time and the type of packet The contents of the packet are also displayed and you can save this information in a file You can also view and capture packets as they are sent from an application onto the network e Audio input devices e Audio output devices 2 6 1 PALSim examples Most of the examples in the PAL examples workspace are configured to work with PALSim To open the examples workspace select Start gt Programs gt Celoxica gt Platform Developer s Kit gt PAL gt PAL Examples Workspace Choose a project in the left hand drop down box at the top of the
40. e PAL API contains methods for accessing the following devices e LEDs e Seven segment displays e Switches e Data ports e Parallel ports e RS 232 serial ports e PS 2 ports e Fast RAMs e Pipelined RAMs e Slow RAMs e SDRAM e Block storage devices e Video input devices e Video output devices e Audio input devices e Audio output devices e Ethernet devices e Audio e Touchscreen e Reconfiguration resources PAL defines a set of methods common to all of the devices the PAL generic API Device specific methods are described in the PAL resource specific API see page 24 4 1 Header and library files The PAL distribution contains the header file pal hch which contains the declarations of all the types and macros described in this document All applications and libraries that use PAL should include this header Applications must link to the appropriate PAL library for the platform they are targeting For instance pal rc200 hclis needed to target the Celoxica RC200 board This in turn requires the PSL library rc200 hcl and the standard library stdlib 1ib More information about choosing the appropriate libraries and header files is supplied in the PAL User Guide see page 12 Page 18 www celoxica com Celoxica PAL User Guide 4 2 Generic API 4 2 1 Resource handles PALHandle Description The type of references to PAL resources A PalHandle is used to distinguish a particular resource on a platform fr
41. e macro proc PalDataPortRun HandleCT ClockRate n ee macro proc PalXRun HandleCT ClockRate see page 23 e macro proc PalDataPortReset Handle n ee macro proc PalXReset Handle e macro proc PalDataPortEnable Handle See macro proc PalXEnable Handle e macro proc PalDataPortDisable Handle See macro proc PalXDisable Handle e macro proc PalDataPortRead Handle DataPtr e macro proc PalDataPortWrite Handle Data Page 27 sd www celoxica com Celoxica PAL User Guide PalDataPortRead macro macro proc PalDataPortRead Handle DataPtr Arguments Handle PalHandle to a DataPort resource DataPtr pointer to an lvalue e g variable or signal of type unsigned PalDataPortGetMaxDataWidthCT Timing 1 or more clock cycles Description Reads a single item of data from the data port and stores it in the Ivalue pointed at by DataPtr PalDataPortWrite macro macro proc PalDataPortWrite Handle Data Arguments Handle PalHandle to a DataPort resource Data expression of type unsigned PalDataPortGetMaxDataWidthCT Timing 1 or more clock cycles Description Writes a single item of data to the data port 4 3 5 Parallel port API These methods are used only for getting handles to parallel ports which otherwise implement the DataPort API e macro expr PalParallelPort Index see macro expr PalX Index see page 21 e macro expr PalParallelP
42. e more portable by using PL2 RAMs e macro expr PalPL2RAM Index see macro expr PalX Index see page 21 e macro expr PalPL2RAMCT IndexCT See macro expr PalXCT IndexCT see page 21 e macro expr PalPL2RAMCount see macro expr PalXCount see page 22 e macro expr PalPL2RAMUniqueCount Page 33 e www celoxica com Celoxica PAL User Guide see see see see see m see Vv ee Vv ee ac n ee mac see see see mac macro proc Pal macro expr Pal macro expr Pal macro expr acro expr acro expr acro expr macro proc Pal macro proc Pal macro proc Pal macro proc Pal macro proc Pal macro expr PalXUniqueCount macro proc macro expr macro expr Pal macro expr Pal PalXGet P 2 macro expr Pal PalFast P 2 macro expr Pal PalXGet P 2 macro expr ro proc Pal PalFast P 2 macro proc PalXRun D ro proc Pal macro proc 2Enable OG Count Count see page 22 RAMRequire XRequire see page 22 RAMGetMaxDataWidthCT OG tMaxAddressWidthCT XGetMaxDataWidthCT t RAMGe 0 FastRAMGetMaxAddressWidthCT RAMGetDataWidth Handle DataWidth Handle GetAddressWidth Handle RAMGetAddressWidth Handle GetDataWidthCT HandleCT DataWidthCT HandleCT
43. e page 60 e macro proc PalTouchScreenRun Handle ClockRate see macro proc PalXRun HandleCT ClockRate s page 23 e macro expr PalTouchScreenGetScaledXWidthCT see macro expr PalTouchScreenGetScaledXWidthCT see page 60 e macro expr PalTouchScreenGetScaledYWidthCT see macro expr PalTouchScreenGetScaledYWidthCT see page 61 e macro expr PalTouchScreenGetRawXWidthCT see macro expr PalTouchScreenGetRawXWidthCT see page 61 e macro expr Pall ouchScreenGetRawYWidthCT TouchScreenGetRawYWidthCT see page 61 see macro expr Pal e macro expr PalTouchScreenGetTouchWidthCT see macro expr PalTouchScreenGetTouchWidthCT see page 60 Page 59 BW www celoxica com Cel Oo XIca PAL User Guide PalTouchScreenGetScaledXWidthCT macro macro expr PalTouchScreenGetScaledXWidthCT Arguments Return value Description None Integer compile time constant for specifying a width Returns the maximum width of the X co ordinate of the last touch on the touch screen at compile time This is the width that should be used for the Ivalue that is pointed to by XPtr in the PalTouchScreenReadScaled method Note that for the Scaled touch screen methods the X and Y coordinates and corresponding widths are scaled for the pixel dimensions of the display available on a given platform PalTouchScreenReadRaw Handle XPtr YPtr TouchPir mac
44. econds Description Resets the SDRAM controller When reset is issued the first read write command will be accepted after POWER UP DELAY US set by the user in DEFINE SDRAM MEMORY PARAMETERS macro declared in sdram controller hch PalSDRAMRun macro proc PalSDRAMRun HandleCT BurstLength ClockRate Page 53 www celoxica com Celoxica PAL User Guide Arguments HandleCT constant PalHandle to an SDRAM resource BurstLength burst length to use for SDRAM data transfers ClockRate Clock rate of the clock domain of the call to this macro in Hz Timing Does not terminate in normal use Description Runs the device management tasks for the SDRAM interface Must always run in parallel with accesses to the device CAS latency is fixed at 2 If you need to use a different CAS setting see PalSDRAMRunEx macro see page 54 PalSDRAMRunEx macro macro proc PalSDRAMRunEx HandleCT MemoryName ClockRate Arguments HandleCT constant PalHandle to an SDRAM resource MemoryName SDRAM memory parameters defined using DEFINE_SDRAM_MEMORY_PARAMETERS macro declared in sdram controller hch ClockRate Clock rate of the clock domain of the call to this macro in Hz Timing Does not terminate in normal use Description Runs the device management tasks for the SDRAM interface Must always run in parallel with accesses to the device If you do not know what type or configuration of SDRAM memory will be connected to the FPGA chip
45. es Description Writes data to SDRAM memory Must be called as many times as the burst length is set For example seq i 0 i lt PalSDRAMGetBustLength Handle i PalSDRAMWrite Handle Data i PalSDRAMWriteBuffer macro macro proc PalSDRAMWriteBuffer Handle BufferPtr Arguments Handle PalHandle to an SDRAM resource BufferPtr Pointer to a buffer of lvalues e g variable or signal of the appropriate type For many uses this an unsigned of width PalSDRAMGetMaxDataWidthCT The size of the buffer is derived during compile time from burst length value set in the SDRAM run macro Timing Variable number of clock cycles Because the refresh request generated internally has the highest priority the macro will wait until the refresh is finished Minimal latency is 1 clock cycles Description Writes data buffer to SDRAM memory Waits until all data from the buffer are written to the SDRAM memory For example unsigned MyBuffer MyBuffer 0 OxDEAD PalSDRAMWriteBuffer Handle MyBuffer Page 55 e www celoxica com Celoxica PAL User Guide 4 3 18 Ethernet devices Ethernet API The Ethernet API supports generic Ethernet interface devices Kal e macro expr PalEthernet Index see macro expr PalX Index see page 21 Kal e macro expr PalEthernetCT Index see macro expr PalXCT Index see page 21 Kal e macro expr PalEthernetCount HU see macro expr PalXCount
46. hernet resource DataPtr Pointer to data of type unsigned 8 Will return a byte of data from the received packet ErrorPtr Pointer to data of type unsigned 1 Returns success 0 failure 1 One or more clock cycles Returns a single data byte from the packet currently being read Will return ErrorPtr 1 indicating an error if it is called when there is no data remaining in the packet PalEthernetReadEnd macro macro proc Pall Arguments Timing Description EthernetReadEnd Handle ErrorPtr Handle PalHandle to a PalEthernet resource ErrorPtr Pointer to data of type unsigned 1 Returns success 0 failure 1 One or more clock cycles Completes the process of reading a packet from the Ethernet device Must be called after all data has been read from a packet PalEthernetWriteBegin macro macro proc Pall ErrorPtr Page 57 www celoxica com EthernetWriteBegin Handle Destination Type DataByteCount TH Celoxica PAL User Guide Arguments Timing Description Handle PalHandle to a PalEthernet resource Destination Data of type unsigned 48 Specifies the destination MAC address for the packet Type Data of type unsigned 16 Specifies the type of the outgoing packet DataByteCount Data of type unsigned 11 Specifies the number of data bytes to be sent excluding the header ErrorPtr Pointer to data of type unsigned 1 Returns success 0 failure 1 One or mo
47. idth Handle e macro expr PalPLIGetAddressWidth Handle n ee macro expr PalFastRAMGetAddressWidth Handle e macro expr PalPLIGetDataWidthCT HandleCT n ee macro expr PalXGetDataWidthCT HandleCT e macro expr PalPLIGetAddressWidthCT HandleCT goj See macro expr PalFastRAMGetAddressWidthCT HandleCT e macro proc PalPLIRun HandleCT ClockRate see macro proc PalXRun HandleCT ClockRate see page 23 e macro proc PalPLiReset Handle See macro proc PalXReset Handle e macro proc PalPLiEnable Handle See macro proc PalXEnable Handle e macro proc PalPLIDisable Handle Vv ee macro proc PalXDisable Handle e macro proc PalPLIRAMSetReadAddress Handle Address e macro proc PalPLIRAMSetWriteAddress Handle Address e macro proc PalPLIRAMRead Handle DataPtr e macro proc Pal 1RAMWrite Handle Data PalPL1RAMSetReadAddress macro macro proc PalPLIRAMSetReadAddress Handle Address Arguments Handle PalHandle to a PL1RAM resource Address Address of data to read of type unsigned PalPLIRAMGetMaxAddressWidthCT Timing 1 clock cycle Description Sets the address for a read that will occur on the next clock cycle Page 32 www celoxica com Celoxica PAL User Guide PalPL1RAMSetWriteAddress macro macro proc PalPLIRAMSetWriteAddress Handle Address Arguments Handle PalHa
48. ite macro macro proc PalBlockStoreWrite Handle Address Data Arguments Handle PalHandle to a BlockStore resource Address Address of data to be written of type unsigned PalBlockStoreGetMaxAddressWidthCT Data expression of type unsigned PalBlockStoreGetMaxDataWidthCT 0 Timing 1 or more clock cycle Description Writes a single item of data to the block store device at the specified address PalBlockStoreEraseBlock macro macro proc PalBlockStoreErase Handle BlockNumber Arguments Handle PalHandle to a BlockStore resource BlockNumber Index of the block to erase of type unsigned PalBlockStoreGetMaxAddressWidthCT log2floor PalBlockStoreGetMaxBlockLengthCT Timing 1 or more clock cycles Description Statement that erases a complete block indexed by BlockNumber from the block store device used by Handle to prepare it for re writing Page 39 ss www celoxica com Celoxica PAL User Guide 4 3 13 Video capture devices Videoln API The Videoln API supports generic video capture devices e macro expr PalVideoIn Index See macro expr PalX Index see page 21 e macro expr PalVideoInCT Index see macro expr PalXCT Index see page 21 OG see page 22 e macro expr PalVideoInCount See macro expr PalXCount e macro expr PalVideoInUniqueCount see macro expr PalXUniqueCount see page 22 e macro proc PalVideoInRequire Count see macro pr
49. lVideoOutGetVisibleXCT Handle ClockRate e macro expr PalVideoOutGetVisibleYCT Handle e macro expr PalVideoOutGetTotalXCT Handle ClockRate e macro expr PalVideoOutGetTotalYCT Handle e macro proc PalVideoOutRun HandleCT ClockRate see macro proc PalXRun HandleCT ClockRate see page 23 e macro proc PalVideoOutReset Handle See macro proc PalXReset Handle e macro proc PalVideoOutEnable Handle See macro proc PalXEnable Handle e macro proc PalVideoOutDisable Handle See macro proc PalXDisable Handle e macro expr PalVideoOutGetX Handle e macro expr PalVideoOutGetY Handle e macro expr PalVideoOutGetHBlank Handle e macro expr PalVideoOutGetVBlank Handle e macro proc PalVideoOutWrite Handle Pixel PalVideoOutOptimalCT macro macro expr PalVideoOutOptimalCT ClockRate Arguments ClockRate The frequency of the clock in the clock domain of the call to PalVideoOutRun in units of Hertz Return value Constant PalHandle evaluated at compile time Description Returns the optimal handle to a display for a given clock frequency at compile time Typically this will be the video mode that results in output closest to the standard 4 3 ratio and therefore the most square pixels Page 44 www celoxica com m Celoxica PAL User Guide PalVideoOutGetVisibleX macro macro expr PalVideoOutGetVisibleX Handle ClockRate Arguments Handle PalHandle to a VideoOut resource ClockRate
50. le SampleRate e macro proc PalAudioInRead Handle LeftPtr RightPtr PalAudiolnSetSampleRate macro macro proc PalAudioInSetSampleRate Handle SampleRate Arguments Handle PalHandle to an Audioln resource SampleRate integer constant equal to the number of samples per second that the input device should generate Timing 1 or more clock cycles Description Sets the sample rate of the audio input device If the sample rate requested is not supported by the device then the rate is left unchanged PalAudiolnRead macro macro proc PalAudioInRead Handle LeftPtr RightPtr Arguments Handle PalHandle to an Audioln resource LeftPtr RightPtr Expressions of type signed PalAudioInGetMaxDataWidthCT Timing 1 or more clock cycles Description Reads a stereo pair of samples from the audio input device Will block until the device has a new sample If PalAudioInRead is not called quickly enough some samples may be missed 4 3 16 Audio output devices AudioOut API The AudioOut API supports generic audio output devices e macro expr PalAudioOut Index See macro expr PalX Index see page 21 e macro expr PalAudioOutCT Index See macro expr PalXCT Index see page 21 e macro expr PalAudioOutCount see macro expr PalXCount see page 22 e macro expr PalAudioOutUniqueCount see macro expr PalXUniqueCount see page 22 e macro proc PalAudioOutRequire Count see macro
51. nditional compilation using select and ifselect Page 42 sd www celoxica com Celoxica PAL User Guide PalVideolnRead macro macro proc PalVideoInRead Arguments Handle XPtr YPtr PixelPtr Handle PalHandle to a Videoln resource XPtr Pointer to an Ivalue of type unsigned PalVideoInGetMaxXWidthCT 0 YPtr Pointer to an Ivalue of type unsigned PalVideoInGetMaxYWidthCT 0 PixelPtr pointer to an Ivalue e g variable or signal of type unsigned PalVideoInGetMaxColorWidthCT Timing Description 1 or more clock cycles Reads a single pixel from the video input device The call sets both the color value in PixelPtr and the X and Y coordinates of the captured pixel in xPtr and yPtr Frames may be interlaced This function needs to be called repeatedly without delay in order to be sure of not missing pixels The video format is typically 888 RGB giving a width of 24 4 3 14 Video output devices VideoOut API The VideoOut API supports generic progressive scan video output such as VGA e macro expr Pal See macro expr See macro expr see macro expr See macro expr See macro proc See macro expr See macro expr see macro expr See macro expr macro expr Pal macro expr Pal macro expr Pal macro proc Pal macro expr Pal macro expr Pal macro expr Pal macro expr Pal macro expr Pal LVideoOut PalX Index VideoOutCT PalXCT
52. ndle Handle Handle HandleCT HandleCT HandleCT HandleCT HandleCT ClockRate ClockRate see page 23 Handle Handle Address DataPtr Address Data DataPtr si Celoxica PAL User Guide Arguments Handle PalHandle to a SlowRAM resource Address Address of data to read of type unsigned PalSlowRAMGetMaxAddressWidthCT DataPtr pointer to an lvalue e g variable or signal of type unsigned PalSlowRAMGetMaxDataWidthCT Timing Description 1 or more clock cycles Reads a single item of data from the RAM at the specified address and stores it in the lvalue pointed at by DataPtr PalSlowRAMWrite macro macro proc PalSlowRAMWrite Handle Address Data Arguments Handle PalHandle to SlowRAM resource Address Address of data to be written of type unsigned PalSlowRAMGetMaxAddressWidthCT Data expression of type unsigned PalSlowRAMGetMaxDataWidthCT 0 Timing 1 or more clock cycles Description Writes a single item of data to the RAM at the specified address 4 3 12 Block storage devices BlockStore API PalBlockStore is typically used by devices that have block oriented access and in particular require the user to erase a block of one or more locations before writing new data such as Flash memory The address space is treated as being the contiguous concatenation of all of the blocks i e address location O is first entry in block 0 address loc
53. ndle PalHandle to resource of type X Data expression of the appropriate type For many uses this is an unsigned int of width PalXGetMaxDataWidthCT Timing 1 or more clock cycles Description Statement that writes a single item of data to the resource 4 3 Resource specific API The following resource specific APIs are included in the current version of PAL e LED API e Seven segment API e Switch API binary switches and buttons e Generic data I O API e Parallel port API e RS 232 serial port API e PG serial port API e Single cycle RAM access API e Pipelined single cycle RAM access API e Pipelined PL2 RAM API e SlowRAM API RAMs without guaranteed timing e SDRAM Single Rate Synchronous dynamic random memory e Block storage device API e Video capture device API e Video output device API e Audio input device API e Audio output device API e Ethernet API e Reconfigure API Page 24 www celoxica com Celoxica PAL User Guide 4 3 1 PAL LED API The LED API supports simple binary LEDs More complex LEDs such as multicolour can be supported by using several LED resources in conjunction or via the data port API macro expr Pal ka D Index See macro expr macro expr Pal alX Index Se DCT See macro expr macro expr Pal alXCT T EDCount See macro expr macro expr Pal alXCount ial See macro expr macro proc Pal See macro
54. ndle to a PL1RAM resource Address Address of data to read of type unsigned PalPLIRAMGetMaxAddressWidthCT Timing 1 clock cycle Description Sets the address for a write that will occur on the next clock cycle PalPL1RAMRead macro macro proc PalPLIRAMRead Handle DataPtr Arguments Handle PalHandle to a PL1RAM resource DataPtr pointer to an lvalue e g variable or signal of type unsigned PalPLIRAMGetMaxWidthCT Timing 1 clock cycle Description Reads a single item of data from the address in the RAM set by PalPLIRAMSetReadAddress onthe previous clock cycle and stores it in the lvalue pointed at by DataPtr PalPL1RAMWrite macro macro proc PalPLIRAMWrite Handle Data Arguments Handle PalHandle to a PL1RAM resource Data expression of type unsigned PalPLIRAMGetMaxWidthCT Timing 1 clock cycle Description Writes a single item of data to the RAM at the address set by PalPLIRAMSetWriteAddress onthe previous clock cycle 4 3 10 Pipelined PL2 RAMs PL2 RAMs are similar to PL1 RAMs but the address must be set exactly two clock cycles before reading or writing data The RAMs can be read from or written to in exactly one clock cycle but with the address supplied two clock cycles earlier This is typically a fast way of accessing RAMs Some platforms such as the ADM XRC II RC2000 do not support PL1 RAMs However platforms which do support PL1 RAMs also support PL2 RAMs so you can make your cod
55. nnr 36 PalSlowRAMUniqUeCoUnt 36 PDalGlowbAMwWite sss eee sese 37 PAalSWIloh irrien 27 PalwitchCoumt sees seeenneneeenno 27 PAlSWIIONO Tas ease oseon eia o ee dE ee deia 27 PDalwitchead esee seeeeeesseeeto 27 Palzwitcheouire ties eien iio 27 PalSwitchUniqueCount 27 PalTouchScreenGetRawXWidthCT 64 PalTouchScreenGetRawYWidthCT 63 PalTouchScreenGetScaledXWidthCT 62 PalTouchScreenGetScaledYWidthCT 64 PalTouchScreenGetTouchWidthCT 63 PalTouchScreenReadRaw naissen 62 PalTouchScreenReadScaled 64 PDalVendortC ode 20 PalVendorRelease esenee 20 PalVendortzirimg esee seeeeeinnnei 20 PalVersionkMalor sees e seeneeisen it 19 PDalVersionkMimgor esse eeeeeseeennnto 19 PalVersionRequire ee iceo ii 19 PAlVI GOlN ss zeer esa sran oa siia 40 PDalVideolntoumt esse eeeeeseseenno 40 PDalVldeolnt T A0 PDalVideolnftsable ennenen A0 PalVideolnEnable ee sseeeeo 40 TH Celoxica PAL API reference PalVideolnGetColorWidth 42 PalVideoOutRun ssssssssnenseeennnennnnnnnnnnrre nnee 44 PalVideolnGetColorWidthCT 43 PalVideoOutUniqueCount 44 PalVideolnGetMaxColorWidthCT 42 PalVideoOutWrite sessseeeesseeeeo 49 PalVideolnGetMaxXWidthCT 41 Ee EA ELLE 21 PalVideolnGetM
56. nsssnstanstansiadaasusuedentncsane 24 423 1 PAL EDAPI 5 5 53 ctiess ch maren nape adan aaia a a Aai aa aaiae aiaa 25 4 3 2 Seven segment displays SevenSeg API r marnrnnnrnvvnnrrnnnnrnnnnnvnnerrnnnnrnnennnnnrrrreenrrnennnnenenne 25 4 3 3 Binary switches and buttons Switch AP 26 4 3 4 Generic data I O DataPort Al 27 4 3 5 Parallel Port EE 28 4 3 6 RS 232 serial ports RS232Port AP 28 4 3 7 PS 2 serial ports PS2Port Ab 29 4 3 8 Single cycle RAMs FastRAM Al 29 4 3 9 Pipelined single cycle RAMs PL1RAM API ccc ceeeeeeeeeeeeeeeeeeeeeeeeeaeeeeaaeseneeeesaeeseneeeeaes 31 4 3 10 Pipelined PL3RAMS ss esseseineneeannntaankntnnnteanantaanktlannnnnnnKankKIaankIIannkkankrtas 33 4 3 11 RAMs without guaranteed timing SIOWRAM AP 35 4 3 12 Block storage devices BlockStore AP 37 4 3 13 Video capture devices Videoln AP 40 4 3 14 Video output devices VideoOut Ab 43 4 3 15 Audio input devices Audioln Ab 48 Page 3 www celoxica com Celoxica PAL manual 4 3 16 Audio output devices AudioOut Ab 49 48 17 PALSDRAM API geesde cece bakben ek ke a debet gaa kne nana eis aan 50 4 3 18 Ethernet devices Ethernet AP 56 4 3 19 PAL Reconfigure AP 58 4 3 20 PAL TouchScreen AP 59 SINDEN EE aaeoa paaa iaa iaaea eaaa nasapian saiia anaana iaai 63 Page 4 www celoxica com Celoxica Page 5 PAL manual Conventions The following conventions are used in this document x Warning
57. nstant such as when it is passed through a function parameter However it cannot be used to set the width of variables Page 38 www celoxica com Celoxica PAL User Guide PalBlockStoreGetBlockLengthCT macro macro expr PalBlockStoreGetLengthCT HandleCT Arguments HandleCT constant PalHandle to a BlockStore resource Return value Integer compile time constant for specifying a width Description Returns the actual length of a block for the block storage device that is used by the handle referred to at compile time Since this method works at compile time it can only be used where Handle is a constant and can be deduced to be a constant by the DK compiler So for instance this cannot be used if Handle is passed through a function parameter However since it returns a compile time constant it can be used to set variable widths and do conditional compilation using select and ifselect PalBlockStoreRead macro macro proc PalBlockStoreRead Handle Address DataPtr Arguments Handle PalHandle to a BlockStore resource Address Address of data to read of type unsigned PalBlockStoreGetMaxAddressWidthCT DataPtr pointer to an lvalue e g variable or signal of type unsigned PalBlockStoreGetMaxDataWidthCT Timing 1 or more clock cycles Description Reads a single item of data from the block store device at the specified address and stores it in the lvalue pointed at by DataPtr PalBlockStoreWr
58. oc PalXRequire Count see page 22 e macro expr PalVideoInGetMaxXWidthCT e macro expr PalVideoInGetMaxYWidthCT e macro expr PalVideoInGetMaxColorWidthCT e macro expr PalVideoInGetXWidth Handle e macro expr PalVideoInGetYWidth Handle e macro expr PalVideoInGetColorWidth Handle e macro expr PalVideoInGetXWidthCT HandleCT e macro expr PalVideoInGetYWidthCT HandleCT e macro expr PalVideoInGetXColorWidthCT HandleCT e macro proc PalVideoInRun HandleCT ClockRate See macro proc PalXRun HandleCT ClockRate e macro proc PalVideoInReset Handle See macro proc PalXReset Handle e macro proc PalVideoInEnable Handle See macro proc PalXEnable Handle e macro proc PalVideoInDisable Handle See macro proc PalXDisable Handle e macro proc PalVideoInRead Handle XPtr YPtr PalVideolnGetMaxXWidthCT macro macro expr PalVideoInGetMaxXWidthCT see page 23 PixelPtr Arguments None Return value Integer compile time constant for specifying a width Description Returns the maximum width of the X co ordinate of all of the video input devices Page 40 www celoxica com on the platform at compile time This is the width that should be used for the lvalue that is pointed to by xPtrin the PalVideoInRead method m Celoxica PAL User Guide PalVideolnGetMax YWidthCT macro macro expr PalVideoInGetMaxYWidthCT Arguments None Return value Integer compile time con
59. om the other resources of the same type Handles to particular resources are obtained by the PalX and PalXCT family of macros All macros that need to refer to a particular resource take a PalHandle as their first argument 4 2 2 API version numbers PalVersionMajor macro macro expr PalVersionMajor Arguments None Return value Integer constant Description Expression that returns the major component of the API version number For example it would return 2 for API version 2 3 Changes in the major version may add and remove functionality or may change the behaviour of existing APIs Code written with one major number may or may not work with another PalVersionMinor macro macro expr PalVersionMinor Arguments None Return value Integer constant Description Expression that returns the minor component of the API version number For example it would return 3 for API version 2 3 Changes in the minor version may add functionality to the API but should not break existing code New APIs are therefore backwards compatible PalVersionRequire macro macro proc PalVersionRequire Major Minor Page 19 www celoxica com Celoxica PAL User Guide Arguments Major major API version number required Minor minor API version number required Timing 0 clock cycles Description Procedure that fails with a compile time assertion if the provided version number is incompatible with the API version of
60. onal compilation using select and ifselect PalVideolnGetYWidthCT macro macro expr PalVideoInGetYWidthCT HandleCT Arguments HandleCT constant Pal Handle to a Videoln resource Return value Integer compile time constant for specifying a width Description Returns the actual width of the Y co ordinate of the video input device that is used by the handle referred to at compile time Since this method works at compile time it can only be used where HandleCT is a constant and can be deduced to be a constant by the DK compiler So for instance this cannot be used if Hand1eCT is passed through a function parameter However since it returns a compile time constant it can be used to set variable widths and do conditional compilation using select and ifselect PalVideolnGetColorWidthCT macro macro expr PalVideoInGetColorWidthCT HandleCT Arguments HandleCT constant PalHandle to a Videoln resource Return value Compile time constant unsigned int for specifying a width Description Returns at the actual width of the pixel color of the video input device that is used by the handle referred to compile time Since this method works at compile time it can only be used where HandlecT is a constant and can be deduced to be a constant by the DK compiler So for instance this cannot be used if HandlecT is passed through a function parameter However since it returns a compile time constant it can be used to set variable widths and do co
61. ortCT IndexCT See macro expr PalXCT IndexCT see page 21 e macro expr PalParallelPortCount See macro expr PalXCount see page 22 e macro expr PalParallelPortUniqueCount see macro expr PalXUniqueCount see page 22 e macro proc PalParallelPortRequire Count see macro proc PalXRequire Count see page 22 4 3 6 RS 232 serial ports RS232Port API These methods are used only for getting handles to RS 232 serial ports which otherwise implement the DataPort API e macro expr PalRS232Port Index See macro expr PalX Index see page 21 e macro expr PalRS232PortCT IndexCT Page 28 e www celoxica com Celoxica PAL User Guide See macro expr macro expr Pal See macro expr See macro expr macro expr Pal See macro proc macro proc Pal 4 3 7 PS 2 serial ports PS2Port API PalXCT IndexCT see page 21 IRS232PortCount PalXCount see page 22 RS232PortUniqueCount PalXUniqueCount see page 22 RS232PortRequire Count PalXRequire Count see page 22 These methods are only used for getting handles to PS 2 serial ports which otherwise implement the DataPort API e See macro expr See macro expr macro expr Pal See macro expr See macro expr See macro proc 4 3 8 Single cycle RAMs FastRAM API macro expr Pal macro expr Pal macro expr Pal macro proc PalPS2Por PS2Po
62. ource DataPtr Pointer to a lvalue e g variable or signal of type unsigned PalPL2RAMGetMaxDataWidthCT Timing 1 clock cycle Description Reads a single item of data from the address in the RAM set by PalPL2RAMSetReadAddress two clock cycles earlier and stores it in the lvalue pointed at by DataPtr PalPL2RAMWrite macro macro proc PalPL2RAWrite Handle Data Arguments Handle PalHandle to a PL2RAM resource Data expression of type unsigned PalPL2RAMGetMaxDataWidthCT Timing 1 clock cycle Description Writes a single item of data to the RAM at the address set by PalPL2RAMSetWriteAddress two Clock cycles earlier 4 3 11 RAMs without guaranteed timing SlowRAM API Slow RAMs are RAMs that can be read from or written to in multiple clock cycles This is the most generic and platform independent interface to RAMs and other random access storage devices This Page 35 e www celoxica com Celoxica PAL User Guide API is suitable for accessing shared RAMs arbitrated by some external circuitry or for accessing RAMs which cannot guarantee timing due to refresh constraints such as DRAM macro expr Pal s See macro expr macro expr Pal s PalX See macro expr s PalXCT macro expr Pal See macro expr macro expr Pal PalXCo See macro expr macro proc Pal PalXUn lowRAMRequire Vv ee macro proc macro expr Pal PalXRe s n ee macro e
63. project configuration You are encouraged to follow this approach and extend the pal master hch header file to include any new PAL implementations that you create 3 1 1 Creating a generic PAL library If you wish to create a library that uses PAL and is not specific to any platform you only need to include the pal hch header in your source files When that library is used as part of an application to generate hardware or a simulation model the application will be linked against a specific PAL implementation and the application source will include the platform specific header file 3 2 Using PAL Cores If you wish to use PAL Cores in your application you should also include the appropriate headers in your source files and link with the appropriate library files The libraries and header files are in the Lib and Include directories within Instal1Dir PDK Hardware Some of the PAL examples see page 9 use PAL Cores Page 12 www celoxica com Celoxica Introduction to PAL Core Header file Library file Examples Console pal console hch pal console hcl console dumb terminal and keyboard 16 bit pal framebuffer16 hch pal framebuffer16 hcl blockstore Framebuffer framebuffer16 and videoin 8 bit pal framebuffer8 hch pal framebuffer8 hcl framebuffer8 Framebuffer Mouse pal mouse hch pal mouse hcl mouse Keyboard pal keyboard hch pal keyboard hcl dumb terminal keyboard 3 3 Targeting a specific platform If you wish
64. r PAL ERROR INVALID HANDLE method was passed a handle referring to a resource that is not of an allowed type for that method PAL ERROR DEVICE FAILURE A method has encountered physical device failure PalErrorHandlerRun macro macro proc PalErrorHandlerRun ErrorHandlerProc Arguments ErrorHandlerProc a macro proc taking a single argument of type PalErrorCode Timing Terminates after executing ErrorHandlerProc if an error occurs Description This procedure runs indefinitely until a runtime error condition is detected at which point it calls the error handler procedure with the error code as an argument The error handler procedure may for example reset the whole system or drive some form of external error reporting such as an LED 4 2 5 Generic methods PalX macro non constant PalHandle macro expr PalX Index Arguments Index an unsigned int index Return value Non constant PalHandle Description Returns the Index numbered PalHandle from all resources of type X available on the platform Index need not be a constant Index must be in the range 0 to PalXCount 1 inclusive PalXCT macro constant PalHandle macro expr PalXCT IndexCT Arguments IndexCT an integer constant index Return value Constant PalHandle Description Returns the IndexCT numbered PalHandle from all resources of type x available on the platform Index must be a constant in the
65. r However it cannot be used to set the width of variables PalFastRAMGetAddressWidthCT macro macro expr PalFastRAMGetAddressWidthCT HandleCT Page 30 e www celoxica com Celoxica PAL User Guide Arguments HandleCT constant PalHandle to FastRAM resource Return value Integer compile time constant for specifying a width Description Returns the actual width of the address bus of the RAM that is used by the handle referred to at compile time Since this method works at compile time it can only be used where Handle is a constant and can be deduced to be a constant by the DK compiler So for instance this cannot be used if Handle is passed through a function parameter However since it returns a compile time constant it can be used to set variable widths and do conditional compilation using select and ifselect PalFastRAMRead macro macro proc PalFastRAMRead Handle Address DataPtr Arguments Handle PalHandle to FastRAM resource Address Address of data to read of type unsigned PalFastRAMGetMaxAddressWidthCT DataPtr pointer to an lvalue e g variable or signal of type unsigned PalFastRAMGetMaxDataWidthCT Timing 1 clock cycle Description Reads a single item of data from the RAM at the specified address and stores it in the lvalue pointed at by DataPtr PalFastRAMWrite macro macro proc PalFastRAMWrite Handle Address Data Arguments Handle PalHandle to FastRAM resource
66. r instance this cannot be used if HandlecT is passed through a function parameter However since it returns a compile time constant it can be used to set variable widths and do conditional compilation using select and ifselect PalVideoOutGetTotalYCT macro macro expr PalVideoOutGetTotalYCT HandleCT Page 46 www celoxica com Celoxica PAL User Guide Arguments HandleCT constant PalHandle to a VideoOut resource Return value Integer compile time constant Description Returns the actual total number of rows including blanking period of the video output device that is used by the handle referred to at compile time Since this method works at compile time it can only be used where HandleCT is a constant and can be deduced to be a constant by the DK compiler So for instance this cannot be used if HandlecT is passed through a function parameter However since it returns a compile time constant it can be used to set variable widths and do conditional compilation using select and ifselect PalVideoOutGetX macro macro expr PalVideoOutGetX Handle Arguments Handle PalHandle to a VideoOut resource Return value unsigned int PalVideoOutGetMaxXWidthCT Description Returns the current horizontal scan position of the screen output A call to PalVideoOutWrite will write a pixel to position on the video output device returned by this method and PalVideoOutGetyY PalVideoOutGetY macro macro expr PalVideoOutGe
67. range 0 to PalXCount 1 inclusive Page 21 www celoxica com Celoxica PAL User Guide PalXCount macro macro expr PalXCount Arguments None Return value Integer constant Description Expression that returns the total number of resources of type X on the platform The resources are not necessarily unique the same physical resource may be referred to by several indices PalXUniqueCount macro macro expr PalXUniqueCount Arguments None Return value Integer constant Description Expression that returns the total number of unique resources of type X on the platform All unique resource indices map to distinct physical resources PalXRequire macro macro proc PalXRequire Count Arguments Count integer constant Timing 0 clock cycles Description Checks that at least Count resources of type X are available at compile time and produces a suitable error message if not PalXGetMaxDataWidthCT macro macro expr PalXGetMaxDataWidthCT Arguments None Return value Integer constant Description Returns the maximum width of data that is to be passed to or from resources of type x at compile time This is typically the width that should be used for read and write methods PalXGetDataWidth macro macro expr PalXGetDataWidth Handle Arguments Handle PalHandle to resource of type X Return value Integer value evaluated at runtime Description Returns the actual width of data tha
68. re clock cycles Initiates a packet write operation to send data to the network via the Ethernet device Destination is the MAC address to send the packet to and DataByteCount is the number of data bytes to be sent which must be in the range 46 1500 for Ethernet ErrorPtr will be set to 0 if the call was successful and 1 otherwise PalEthernetWrite macro macro proc Pall Arguments Timing Description EthernetWrite Handle Data ErrorPtr Handle PalHandle to a PalEthernet resource Data Data of type unsigned 8 containing a byte of data to write to the packet ErrorPtr Pointer to data of type unsigned 1 Returns success 0 failure 1 One or more clock cycles Writes a single byte to the Ethernet device to be added to the packet currently being written Will return ErrorPtr 1 indicating an error if called when the expected number of bytes has already been written to the packet PalEthernetWriteEnd macro macro proc PalEthernetWriteEnd Handle ErrorPtr Arguments Timing Description Handle PalHandle to a PalEthernet resource ErrorPtr Pointer to data of type unsigned 1 Returns success 0 failure 1 One or more clock cycles Completes the process of sending a packet Must be called after all data has been written to a packet 4 3 19 PAL Reconfigure API The Reconfigure API supports simple resource reconfiguration e macro expr PalReconfigure Index See macro expr
69. ription Writes a single pixel value to the video output device at the current scan position which can be obtained using the methods PalVideoOutGetX and PalVideoOutGetY 4 3 15 Audio input devices Audioln API The Audioln API supports generic audio input devices e macro expr PalAudioln Index See macro expr PalX Index see page 21 e macro expr PalAudioInCT Index See macro expr PalXCT Index see page 21 e macro expr PalAudioInCount see macro expr PalXCount see page 22 e macro expr PalAudioInUniqueCount see macro expr PalXUniqueCount see page 22 e macro proc PalAudioInRequire Count see macro proc PalXRequire Count see page 22 e macro expr PalAudioInGetMaxDataWidthCT see macro expr PalXGetMaxDataWidthCT e macro expr PalAudioInGetDataWidth Handle see macro expr PalXGetDataWidth Handle e macro expr PalAudioInGetDataWidthCT HandleCT See macro expr PalXGetDataWidthCT HandleCT e macro proc PalAudioInRun HandleCT ClockRate n ee macro proc PalXRun HandleCT ClockRate see page 23 e macro proc PalAudioInReset Handle See macro proc PalXReset Handle Page 48 sd www celoxica com Celoxica PAL User Guide e macro proc PalAudioInEnable Handle See macro proc PalXEnable Handle e macro proc PalAudioInDisable Handle see macro proc PalXDisable Handle e macro proc PalAudioInSetSampleRate Hand
70. rn value Integer compile time constant for specifying a width Description Returns the maximum width of the Y co ordinate of the last touch on the touch screen at compile time This is the width that should be used for the Ivalue that is pointed to by yPtr in the PalTouchScreenReadRaw method Note that for the Raw touch screen methods the X and Y coordinates and corresponding widths are NOT scaled for the pixel dimensions of the display available on a given platform PalTouchScreenGetScaledYWidthCT macro macro expr PalTouchScreenGetScaledYWidthcT Arguments None Return value Integer compile time constant for specifying a width Description Returns the maximum width of the Y co ordinate of the last touch on the touch screen at compile time This is the width that should be used for the Ivalue that is pointed to by yPtr in the PalTouchScreenReadScaled method Note that for the Scaled touch screen methods the X and Y coordinates and corresponding widths are scaled for the pixel dimensions of the display available on a given platform PalTouchScreenGetRawXWidthCT macro macro expr PalTouchScreenGetRawXWidthCT Arguments None Return value Integer compile time constant for specifying a width Description Returns the maximum width of the X co ordinate of the last touch on the touch screen at compile time This is the width that should be used for the Ivalue that is pointed to by XPtr in the PalTouchScreenReadRaw method
71. ro macro proc PalTouchScreenReadRaw Handle XPtr XPtr TouchPtr Arguments Timing Description Handle PalHandle to a PalTouchScreen resource XPtr Pointer to an lvalue of type unsigned PalTouchScreenGetRawXWidthCT YPtr Pointer to an Ivalue of type unsigned PalTouchScreenGetRawYWidthCT TouchPtr pointer to an Ivalue e g variable or signal of type unsigned PalTouchScreenGetTouchWidthCT 1 or more cycles Reads the current state of the TouchScreen pointed to by Handle The call sets both the touch state value in TouchPtr and the X and Y coordinates of the captured pixel in XPtr and YPtr Note that for the Raw touch screen methods the X and Y coordinates and corresponding widths are NOT scaled for the pixel dimensions of the display available on a given platform PalTouchScreenGetTouchWidthCT macro macro expr PalTouchScreenGetTouchWidthCT Arguments None Return value Integer compile time constant for specifying a width Description Returns the maximum touch screen touch status width at compile time This is the width that should be used for the Ivalue that is pointed to by yPt rin both the PalTouchScreenReadRaw and PalTouchScreenReadScaled methods Note that the Touch width is the same regardless of X and Y scaling Page 60 a www celoxica com Celoxica PAL User Guide PalTouchScreenGetRaw YWidthCT macro macro expr PalTouchScreenGetRawYWidthCT Arguments None Retu
72. ro expr PalXGetMaxDataWidthCT e macro expr PalSDRAMGetDataWidth Handle n ee macro expr PalXGetDataWidth Handle e macro expr PalSDRAMGetAddressWidth Handle s page 52 e macro expr PalSDRAMGetDataWidthCT HandleCT n ee macro expr PalXGetDataWidthCT HandleCT e macro expr PalSDRAMGetAddressWidthCT see page 52 e macro expr PalSDRAMGetMaxBurstLengthCT see page 52 e macro expr PalSDRAMGetBurstLengthCycles Handle see page 52 e macro proc PalSDRAMRUn HandleCT BurstLength ClockRate s pag 53 e macro proc PalSDRAMRunEx HandelCT MemoryName ClockRate see page 54 e macro proc PalSDRAMSetAddress Handle Address see page 54 e macro proc PalSDRAMSetAddressMask Handle Address Mask see page 54 e macro proc PalSDRAMWrite Handle Data see page 55 e macro proc PalSDRAMRead Handle DataPtr see page 52 e macro proc PalSDRAMWriteBuffer Handle BufferPtr see page 55 U RAMReadBuffer Handle BufferPtr see page 53 e macro proc PalSDRAMReset Handle s page 53 e macro proc PalSDRAMEnable Handle alXEnable Handle LS LS LS e macro proc PalS LS S P GI See macro proc e macro proc PalSDRAMDisable Handle see macro proc PalXDisable Handle Page 51 i www celoxica com Celox Ica PAL User Guide PalSDRAMGetAddress Width macro macro expr PalSDRAMGetAddre
73. rt Index PalX Index see page 21 PS2PortCT IndexCT PalXCT IndexCT see page 21 LPS2PortCount PalXCount see page 22 PS2PortUniqueCount PalXUniqueCount see page 22 tRequire Count PalXRequire Count see page 22 Fast RAMs are single cycle RAMs that can be read from or written to in exactly one clock cycle hence they are fast in terms of the clock cycles taken However FastRAMs often have a lower performance than pipelined PL1RAMs since they rely on a very short combinational path through the entire RAM access circuitry The FastRAM API is suitable for standard asynchronous static RAMs See macro expr See macro expr See macro expr macro expr Pal See macro expr macro proc Pal See macro proc Page 29 www celoxica com macro expr Pal macro expr Pal macro expr Pal Fast Fast FastRAM PalX Index FastRAMCT PalXCT RAMCount OG Fast PalXCount PalXUn RAMRequire PalXRequire RAMUniqueCount iqueCount Count Index see page 21 IndexCT IndexCT see page 21 OG see page 22 OG see page 22 Count see page 22 er Celoxica PAL User Guide e macro expr PalFastRAMGetMaxDataWidthCT 7 see macro expr PalXGetMaxDataWidthCT e macro expr PalFastRAMGetMaxAddressWidthCT e macro expr PalFastRAMGetDataWidth Handle See macro expr PalXGetDataWidth Handle e macro expr PalFas
74. s Handle PalHandle to an SDRAM resource DataPtr Pointer to variable to read into Timing Variable number of clock cycles Because the refresh request generated internally has the highest priority the macro will wait until the refresh is finished Minimal latency is CAS latency 2 clock cycles Description Reads data from the SDRAM resource Must be called as many times as the burst length is set For example seq i 0 i lt PalSDRAMGetBustLength Handle i PalSDRAMRead Handle sData i PalSDRAMReadBuffer macro macro proc PalSDRAMReadBuffer Handle BufferPtr Arguments Handle PalHandle to an SDRAM resource BufferPtr Pointer to a buffer e g variable or signal of the appropriate type For many uses this an unsigned of width PalSDRAMGetMaxDataWidthCT The size of the buffer is derived during compile time from burst length value set in the SDRAM run macro Timing Variable number of clock cycles Because the refresh request generated internally has the highest priority the macro will wait until the refresh is finished Minimal latency is CAS latency 2 clock cycles Description Reads data from SDRAM memory to buffer Waits until all data from the burst transfer are read into the buffer For example unsigned MyBuffer PalSDRAMReadBuffer Handle MyBuffer PalSDRAMReset macro macro proc PalSDRAMReset Handle Arguments Handle PalHandle to resource of type SDRAM Timing POWER UP DELAY US micros
75. s an Application Programming Interface API for peripherals The API offers a standard interface to hardware enabling you to write portable Handel C applications that can run on different FPGA PLD boards without modification PAL is implemented as a thin layer on top of a Platform Support Library PSL The Celoxica PAL distribution requires DK3 or later You can check which version of DK you have installed by launching DK and selecting Help gt About DK Design Suite Page 7 e www celoxica com Celoxica Platform Abstraction Layer PAL 2 Introduction to PAL 2 1 PAL library and header files The PAL implementation exists as a set of Handel C header files and library files The header file pal hch declares the general PAL API This is supplemented by platform specific header files pal rc100 hch pal ndb hch etc which provide information about clocking and the specific resources on a platform The library files contain PAL implementations for specific platforms The PAL header and library files are in the Include and Lib directories under your PDK Hardware installation directory To use PAL you need to set the paths to the library and include files for PAL in DK AARON Select Tools gt Options and open the Directories tab Click Add and browse to InstallDirNPDKNHardwareNInclude Then click OK Select Library modules in the Show directories for drop down list Click Add and browse to Insta11DirNPDKNHardwareNLib Then click OK
76. seen 38 PalFastRAMGetMaxDataWidthCT 30 PalBlockStoreUniqueCount 38 PalFastRAMRead sesiono 31 PalBlockStoreWrite 40 PalFastRAMRequire i 30 PalDataPort rrnornnrnnrrrnrrnanrnrnrrrsnnrnnrssnnnsen 27 PalFastRAMReset nnnnssnnnnesnnnneeennnnennn nenene 30 PalDataPortCount srnnrrronnrnrrrsnnrnrrsvrnnnnn 27 PalFastRAMRUun eerrnrovvrrrrsvrrrrrssrrrrrrrsrrnrnene 30 Paliatabortt TA 27 PaltaeiAMllnioueCoumt eessen 30 PalDataPortDisable esee 27 PalFastRAMWrite rorvnnrrnnrrrrnrrnsrrrnrrrsrrnnrens 31 PalDataPortEnable roronnrrrnnrrnnvornrrnvrnnnen 27 Palllandle sasa Sej 19 PalDataPortGetDataWidth 27 le E 25 PalDataPortGetDataWidthCT 27 PalLEDCount srvonrrnnrrrvnrrnarrvnnrssrrrnnrrrsreneene 25 PalDataPortGetMaxDataWidthCT 27 Pal ON 25 Palataborttiead 28 PalLEDRequire AA 25 Palataborttieouire nees 27 Pal EDUlniouetoumt i 25 Paliiataboribeset eseis 27 el EEN EI univers dE eege 25 Paltatabortbun ee sseeeeesiinnoo 27 PalParallelPort rrrnrvrnrrnnrrrrrrnsrrrnrrvsrrnnrenn 28 PalDataPortUniqueCount 27 PalParallelPortCount 28 PalDataPortWrite esee ses ieeeo 28 PalParallelPortCT esee esse 28 PalErrorCode ss sessseeeeeesernesrnesnnernernessnnns 21 PalParallelPortRequire
77. ssWidth Arguments Handle PalHandle to SDRAM resource Return value Integer value evaluated at runtime Description Returns the actual width of the address bus of the SDRAM that is used by the handle referred to at runtime Since this method works at runtime it can be used even when Handle is not a constant such as when it is passed through a function parameter However it cannot be used to set the width of variables PalSDRAMGetBurstLengthCycles macro macro expr PalSDRAMGetBurstLengthCycles Handle Arguments Handle PalHandle to SDRAM resource Return value Integer value for specifying a burst length in number of clock cycles Description Returns the burst length of the SDRAM at compile time PalSDRAMGetMaxAddressWidthCT macro macro expr PalSDRAMGetMaxAddressWidthCT Arguments None Return value Integer compile time constant for specifying a width Description Returns the maximum width of the address bus of the SDRAM at compile time This is the width that should be used for the address parameter to the RAM read and write methods PalSDRAMGetMaxBurstLengthCT macro macro expr PalSDRAMGetMaxBurstLengthCT Arguments None Return value Integer compile time constant for specifying a burst length Description Returns the maximum burst length of the SDRAM at compile time PalSDRAMRead macro macro proc PalSDRAMRead Handle DataPtr Page 52 www celoxica com Celoxica PAL User Guide Argument
78. stant for specifying a width Description Returns the maximum width of the Y co ordinate of all of the video input devices on the platform at compile time This is the width that should be used for the lvalue that is pointed to by YPtr in the PalVideoInRead method PalVideolnGetMaxColorWidthCT macro macro expr PalVideoInGetMaxYColorWidthCT Arguments None Return value Integer compile time constant for specifying a width Description Returns the maximum width of the pixel colour of all of the video input devices on the platform at compile time This is the width that should be used for the lvalue that is pointed to by PixelPtrin the PalVideoInRead method PalVideolnGetXWidth macro macro expr PalVideoInGetXWidth Handle Arguments Handle PalHandle to a Videoln resource Return value Integer value evaluated at runtime Description Returns the actual width of the X co ordinate of the video input device used by the handle referred to at runtime Since this method works at runtime it can be used even when Handle is not a constant such as when it is passed through a function parameter However it cannot be used to set the width of variables PalVideolnGetYWidth macro macro expr PalVideoInGetYWidth Handle Arguments Handle PalHandle to a Videoln resource Return value Integer value evaluated at runtime Description Returns the actual width of the Y co ordinate of the video input device used by the handle referred to
79. t is used by the handle referred to at runtime Since this method works at runtime it can be used even when Handle is not a constant such as when it is passed through a function parameter However it cannot be used to set the width of variables It may for example be used to choose suitable data formats at runtime Page 22 www celoxica com Celoxica PAL User Guide PalXGetData WidthCT macro macro expr PalXGetDataWidthCT HandleCT Arguments HandleCT constant PalHandle to resource of type X Return value Integer compile time constant for specifying a width Description Returns the actual width of data that is used by the handle referred to at compile time Since this method works at compile time it can only be used where the PAL Handle is a constant and can be deduced to be a constant by the DK compiler So for instance this cannot be used if HandlecT is passed through a function parameter However since it returns a compile time constant it can be used to set variable widths and do conditional compilation using select and ifselect PalXRun macro macro proc PalXRun HandleCT ClockRate Arguments HandleCT constant PalHandle to resource of type X ClockRate clock rate in Hertz of the domain in which the macro is being called Timing Does not terminate in normal use Description Runs the device management tasks for resource X Must always run in parallel with Enable Disable Read Write etc PalXReset m
80. tRAMGetAddressWidth Handle e macro expr PalFastRAMGetDataWidthCT HandleCT See macro expr PalXGetDataWidthCT HandleCT e macro expr PalFastRAMGetAddressWidthCT HandleCT e macro proc PalFastRAMRun HandleCT ClockRate see macro proc PalXRun HandleCT ClockRate see page 23 e macro proc PalFastRAMReset Handle See macro proc PalXReset Handle e macro proc PalFastRAMEnable Handle See macro proc PalXEnable Handle e macro proc PalFastRAMDisable Handle See macro proc PalXDisable Handle e macro proc PalFastRAMRead Handle Address DataPtr e macro proc PalFastRAMWrite Handle Address Data PalFastRAMGetMaxAddressWidthCT macro macro expr PalFastRAMGetMaxAddressWidthcT Arguments None Return value Integer compile time constant for specifying a width Description Returns the maximum width of the address bus of the RAM at compile time This is the width that should be used for the address parameter to the RAM read and write methods PalFastRAMGetAddressWidth macro macro expr PalFastRAMGetAddressWidth Arguments Handle PalHandle to FastRAM resource Return value Integer value evaluated at runtime Description Returns the actual width of the address bus of the RAM that is used by the handle referred to at runtime Since this method works at runtime it can be used even when Handle is not a constant such as when it is passed through a function paramete
81. tY Handle Arguments Handle PalHandle to a VideoOut resource Return value unsigned int PalVideoOutGetMaxYWidthCT Description Returns the current horizontal scan position of the screen output call to PalVideoOutWrite will write a pixel to position on the video output device returned by this method and Pa lVideoOutGetX PalVideoOutGetHBlank macro macro expr PalVideoOutGetHBlank Handle Arguments Handle PalHandle to a VideoOut resource Return value unsigned 1 Description Returns the horizontal blanking status of the current scan position A return value of 1 means the scan position is inside the blanking portion of the display A return value of 0 means the scan position is inside the visible portion of the display PalVideoOutGetVBlank macro macro expr PalVideoOutGetVBlank Handle Page 47 sd www celoxica com Celoxica PAL User Guide Arguments Handle PalHandle to a VideoOut resource Return value unsigned 1 Description Returns the vertical blanking status of the current scan position A return value of 1 means the scan position is inside the blanking portion of the display A return value of 0 means the scan position is inside the visible portion of the display PalVideoOutWrite macro macro proc PalVideoOutWrite Handle Pixel Arguments Handle PalHandle to a VideoOut resource Pixel An expression of type unsigned PalVideoOutGetMaxColorWidthCT Timing 1 clock cycle Desc
82. turn value is not a compile time constant and so it cannot be used to define the width of variables or with the Handel C take and drop operators However the argument Handle need not be a compile time constant and so it can be passed through a function parameter or stored in a run time variable The third macro PalXGetDataWidthCT HandleCT returns the actual data width of the resource referenced by HandlecT at compile time The return value can be used to define the width of variables and to perform conditional compilation The argument HandlecT must be a compile time constant A similar set of three macros is used to abstract over RAM address widths and other device characteristics such as the dimensions of blocks in a block store type device See the PAL API reference see page 18 for further information 3 5 4 Setting up a PAL device LEDs seven segment displays buttons and switches have a simplified interface in PAL To use them set up the PAL project and use the PAL access macros PalXWrite Handle Data and PalXRead Handle DataPtr More complex devices have a slightly more complex but standardized interface The generic pattern of use is par PalXRun Handle ClockRate PalXEnable Handle PalXRead Handle amp Data etc PalXDisable Handle The Pa lXRun Handle ClockRate see page 23 macro initializes the resource and then performs device management tasks This macro does not terminate and m
83. untime it can be used even when Handle is not a constant such as when it is passed through a function parameter However it cannot be used to set the width of variables PalVideoOutGetTotalY macro macro expr PalVideoOutGetTotalY Handle Arguments Handle PalHandle to a VideoOut resource Return value Integer value evaluated at runtime Description Returns the actual total number of rows including the blanking period of the video output device used by the handle referred to at runtime Since this method works at runtime it can be used even when Handle is not a constant such as when itis passed through a function parameter However it cannot be used to set the width of variables Page 45 sd www celoxica com Celoxica PAL User Guide PalVideoOutGetVisibleXCT macro macro expr PalVideoOutGetVisibleXCT HandleCT ClockRate Arguments HandleCT constant PalHandle to a VideoOut resource ClockRate The frequency of the clock in the clock domain of the call to PalVideoOutRun In units of Hertz Return value Integer compile time constant Description Returns the actual horizontal resolution of the video output device that is used by the handle referred to at compile time Since this method works at compile time it can only be used where HandlecT is a constant and can be deduced to be a constant by the DK compiler So for instance this cannot be used if HandleCT is passed through a function parameter However since
84. ust be run in parallel with other PAL macros that access the resource PalXEnable Handle ensures the device referenced by Handle is ready for use This macro will block until the initialization performed by PalXRun Handle ClockRate is complete On some platforms where separate devices share a common bus it may be necessary for you to disable one resource before you can successfully enable another The release notes for a specific PAL implementation will include this information PAL applications should always disable resources when they are not required 3 5 5 PAL Kit workspace The PAL distribution includes a PAL Kit workspace that you can use as a starting point for your implementation Start gt Programs zCeloxica Platform Developer s Kit gt PAL gt PAL Kit Workspace The PAL kit contains empty implementations for each of the supported PAL devices To create your own implementation copy the PAL kit header files and source files and replace the empty implementations with the devices that are present on your target platform The PAL kit project uses e www celoxica com Celoxica Introduction to PAL separate header files and source files to implement missing PAL devices You should use these to provide the default implementation for any missing resources on your own platform Page 17 sd www celoxica com Cel OMICAJ PAL User Guide 4 PAL API reference The Celoxica Platform Abstraction Layer Application Programming Interfac
85. vrrrorrrrnavvrnnnvnrrnr 32 PDaltaebAMCT nnna 20 PalPL1IRAMSetReadAddress 33 Page 64 sd www celoxica com Celoxica PAL API reference PalPL1RAMSetWriteAddress 33 PalPL1RAMUniqueCount 32 Palp 71RAMwWrtte esee esee neono 33 Pap 2RAM eee eseon seen enen enannnannnanoo 34 PalPL2RAMOount esee seen enen nean io 34 PalPL2RAMCT esee eee eeene seen nnnn tanon 34 PalPL2RAMDisable esee e eoo eoo 34 PalPL2RAMEnable see coo i 34 PalPL2RAMGetAddressWidth 34 PalPL2RAMGetAddressWidthCT 34 PalPL2RAMGetDataWidth 34 PalPL2RAMGetDataWidthCT 34 PalPL2RAMGetMaxAddressWidthCT 34 PalPL2RAMGetMaxDataWidthCT 34 PalPL2RAMPortRequire sseeeeeeeeeness 34 PalPL2RAMRead eee esee enen enoni 35 Pall 2pAMtieset oe eeeo eseon i 34 PalPL2RAMRUN eee seen enen eeann tano 34 PalPL2RAMSetReadAddress 35 PalPL2RAMUniqueCount 34 Palpl 2pAMwWrtte esee esee eee nenene 36 PalPL2SetWriteAddress 35 PalPS2 PONT geesde ibekso 29 PalPS2PortCount rrsrrrnnrrrrvnrnrrrrnnrnrrrrnnnnnn 29 PalPS2POrtCT eee ee seen eene enannnannntnoo 29 PalPS2PortRequire i i 29 PalPS2PortUniqueCount
86. xpr macro expr Pal PalXGe s n ee macro expr Pal PalFas s macro expr n ee macro expr macro expr Pal PalXGe s owGe n ee macro expr macro expr Pal PalFas s owGe Vv ee macro expr PalXGe SlowGe macro expr Pal See macro expr macro proc Pal PalFas s owRu See macro proc macro proc Pal P s alXRun owRe See macro proc macro proc Pal PalXReset s owEnable owRAM OWRAMCT owRAMCount OwRAMGe OwRAMGe OwRAMGe Index Index IndexCT IndexCT 0 unt lowRAMUniqueCount iqueCount quire Count tDataWidth tDataWidth tAddressWidth tDataWidthCT tDataWidthCT n HandleCT Handle Handle set Handle See macro proc macro proc Pal PalXEnable s owDi Handle sable n ee macro proc PalXDisable s macro proc Pal macro proc Pal s PalSlowRAMRead macro macro proc PalSlowRAMRead Page 36 www celoxica com owRAMRead owRAMWrite Handle tMaxDataWidthCT tMaxDataWidthCT tMaxAddressWidthCT tRAMGetMaxAddressWidthCT tRAMGetAddressWidth tAddressWidthCT tRAMGetAddressWidthCT Handle Handle Address see page 21 see page 21 see page 22 OG see page 22 Count see page 22 OG OG OG OG Handle Ha
87. xpr PalXCount see page 22 e macro expr PalSwitchUniqueCount see macro expr PalXUniqueCount see page 22 e macro proc PalSwitchRequire Count see macro proc PalXRequire Count see page 22 e macro proc PalSwitchRead Handle DataPtr Page 26 www celoxica com si Celoxica PAL User Guide PalSwitchRead macro macro proc PalSwitchReadPalSwitchRead Handle DataPtr Arguments Handle PalHandle to a Switch resource DataPtr pointer to an lvalue e g variable or signal of type unsigned 1 Timing 1 clock cycle Description Read the current state of a switch A value of 1 means ON or closed a value of 0 means OFF or open 4 3 4 Generic data I O DataPort API e macro expr PalDataPort Index See macro expr PalX Index see page 21 e macro expr PalDataPortCT IndexCT See macro expr PalXCT IndexCT see page 21 e macro expr PalDataPortCount see macro expr PalXCount see page 22 e macro expr PalDataPortUniqueCount see macro expr PalXUniqueCount see page 22 e macro proc PalDataPortRequire Count see macro proc PalXRequire Count see page 22 e macro expr PalDataPortGetMaxDataWidthCT see macro expr PalXGetMaxDataWidthCT e macro expr PalDataPortGetDataWidth Handle See macro expr PalXGetDataWidth Handle e macro expr PalDataPortGetDataWidthCT HandleCT See macro expr PalXGetDataWidthCT HandleCT

Download Pdf Manuals

image

Related Search

Related Contents

BLDCモータ・ベクトル制御開発プラットフォーム(概要)  取扱説明書ダウンロード  Manuel ego t shopclop  Dipartimento di Ingegneri Astronautica, Elettrica ed  Téléphone mobile  und Bedienungsanleitung Rollotron Pro standard ES  Targus BUS0119 notebook accessory  MAL-3735SBKマニュアル  保証基準 安全に関するご注意  NEC_uPD424260LE_RAM_..  

Copyright © All rights reserved.
Failed to retrieve file