Page printer memory allocation

Abstract: A memory management system for a page printer controller (11) which includes random access memory (17) allocated among bit map memory (30), page buffer memory (29), and user memory (28). The memory management system allocates the random access memory to provide either a large bit map memory or, responsive to needs of the controller (11) for increased memory for other uses, for allocating the random access memory (17) to provide a small bit map memory and place more memory in the page buffer memory (29) and user memory (28).

Description: Field of the Invention This invention relates generally to page printers and more particularly concerns the allocation of memory in such printers among various memory uses. The invention is disclosed particularly in relation to an electrophotographic laser printer in which a memory allocation arrangement is used to allocate memory among bit map memory, a page buffer, and user memory. Description of the Prior Art In order to minimize system memory, and therefore cost, most manufacturers of page printers make a tradeoff in the allocation of memory between memory for user features and memory available for page bit mapping. More memory for user features permits a user to have greater numbers of download fonts and macros, for example. Greater memory for bit maps enhances complex page performance. Increasing the number of user features requires a reduction in complex page performance, while increasing complex page performance forces the number of user features to be reduced. As mentioned, one feature of most page printers is the ability to download custom fonts and macros into the printer's memory. Another feature of page printers is the ability to print graphics, or all points addressable (APA) data. However, APA data requires a large amount of memory and therefore dramatically reduces the size of memory available for other uses. Converting datastream commands to a printed page is a three-stage process. First, data from the host connection is manipulated and saved in an area of printer memory known as the page buffer. Second, the contents of the page buffer are rasterized into the image of the page to be printed and stored in either a partial page or a full page bit map memory. Third, the data from the bit map memory is serialized and sent to the print engine for printing. In a laser printer, for example, the data from the bit map is used to modulate the laser as the laser beam is swept across a photoconductor. One approach to maintaining a relatively low cost for a basic page printer, while permitting enhanced user features, if desired, is to provide a basic page printer with a certain amount of memory and to permit the addition of memory, such as through the use of plug-in memory cards, at an additional cost. Such memory cards typically increase the amount of user memory available for downloading fonts and macros. In the absence of download fonts and macros to utilize the additional memory, this memory often remains idle. EP-A-0310712 discloses a front-end system for a raster output scanner, such as a laser printer. A DRAM is used for local storage of the program code for the CPU, and the storage capacity of the DRAM may be enhanced by utilizing a portion of the bitmap memory, which is not used for the bitmap itself, for storing a part of the font library. EP-A-0311111 discloses apparatus for assembling data for supply to a scanning output device. The device supports multiple fonts, mixed text and graphics, and texturing of output on a single page by providing a four-interface architecture for high-speed printing control. It is the general aim of the invention to provide a technique for making better use of free memory in page printers of the foregoing type. Summary of the Invention According to the invention there is provided a page printer comprising a print engine and a controller for the print engine having a random access memory allocated among (a) bit map memory containing a bit image of page data to be serialized to the print engine for printing, (b) page buffer memory containing page description information to be rasterized into the bit map memory, and (c) user memory, characterised in that the controller has a memory management arrangement including means for allocating the random access memory to provide a larger or a smaller bit map memory depending on the needs of the controller for memory for the page buffer memory and the user memory, such that when a smaller bit map memory is provided, an increased amount of random access memory is available for the page buffer memory and the user memory. Other objects and advantages of the invention will become apparent upon reading the following detailed description given by way of example only, and upon reference to the drawings, in which: Brief Description of the Figures Fig. 1 is a schematic block diagram of a page printer engine and controller embodying the present invention; Figs. 2a-2c illustrate diagrammatically the allocation of memory to increase user memory; Figs. 3a-3b illustrate diagrammatically the allocation of memory from user memory and page buffer memory to bit map memory; Fig. 4 illustrates diagrammatically the contents of a memory block; Fig. 5 is a high level flowchart of the process for allocating memory to user memory; Fig. 6 is a more detailed flowchart of a routine implementing the operation illustrated in Fig. 5; Fig. 7 illustrates diagrammatically used and unused areas of a user memory and page buffer; Fig. 8 is a flowchart of a subroutine used in the routine of Fig. 6; Figs. 9a-9d provide a diagrammatic illustration of the deletion of memory from user memory; Fig. 10 is a flowchart of a second subroutine used in the routine of Fig. 6; Fig. 11 is a flowchart of a routine for logically deleting memory from the user memory; and Fig. 12 is a flowchart of a routine for physically deleting memory from the user memory. Detailed Description With initial reference to Fig. 1, a laser page printer includes a printer controller 11 containing a microprocessor 12 and associated read only memory (ROM) 13 and random access memory (RAM) 14. In the present printer, the microprocessor 12 is a Motorola 68000 microprocessor. The ROM 13 contains the instructions executed by the microprocessor 12 to cooperate with the balance of the controller 11 to control the print engine 16 of the page printer in response to commands and data received from a host computer. The print engine 16 is the non-controller portion of the page printer, including, in the present instance, a laser printhead driven by the controller 11, a photoconductor, developer material, a drive motor, and so on. The RAM 14 in the controller 11 contains system memory 15, as well as user memory, a page buffer, and bit map memory, all of which are collectively designated 17 in the Figure. The RAM 14, in the exemplary printer described herein, is 2.5 megabytes, two megabytes of which may be provided on a memory expansion card (not shown). The system memory 15 is a portion of the available memory which is utilized by the microprocessor 12 for system pointers, buffers and other storage. In the subsequent description and accompanying illustrations of allocation of random access memory, only the non-system portion 17 of the RAM 14 will be discussed as the random access memory in the controller 11 (except for incidental reference to pointers which reside in the system memory). The page printer controller 11 produces an image (called a bit map) of a page in the RAM memory 17 into which the data to be printed is rasterized and out of which the bits to be printed are serialized. A large amount of memory is required to hold an image of an entire page at one time. In order to reduce memory costs, most lower cost page printers hold only a portion of a page at one time, rasterizing into this portion in real time while serializing data to the printhead. A complex page error occurs when the controller 11 cannot complete the necessary rasterization by the time the bit data is needed to be serialized to the printhead. In the illustrated page printer, the bit map memory is divided into two swaths. Data is serialized out of one swath while the next data to be printed is rasterized into the other swath. Both processes must occur in real time while the paper to receive the image from the photoconductor is moving continuously through the printer. The larger the swaths, the fewer the passes that must be made in rasterizing the page information held in the page buffer and the more complex the page that can be processed without a complex page error occurring. When the swaths are enlarged enough to cover a full page, the entire page can be rasterized before starting the paper moving past the print point and complex page errors can be eliminated. The page buffer memory is used to hold the description of the page in the format used for rasterizing. For example, in the present instance, text is stored in the page buffer as alphanumeric characters, while corresponding bit map images for each of the characters are stored in the user memory or in ROM. When the text is rasterized into the bit map memory, the bit image for each character is written into the proper location in the bit map memory. If a page description should overflow the page buffer, the page buffer must be emptied before the rest of the page can be received and placed into the buffer. If a full page bit map is available, the page can be rasterized into the bit map, freeing up page buffer space from the page description, which process can continue until an arbitrarily large page is completely processed without error. If the bit map is smaller than a full page size, the partial page is printed, and a partial page error occurs. User memory is usually allocated out of the page buffer memory. Existing printers, for example, use optional memory cards to provide more memory in the form of page buffer memory, download font space, and macro space. With dynamic memory allocation, in accordance with the present invention, the illustrated page printer is as efficient as existing printers at providing user memory when memory is enlarged, such as by the addition of optional memory cards, while still providing partial page and complex page benefits in many cases. In the present printer, when additional user memory is required, and the optional memory is being used in the bit map, the bit map memory is reduced in size and the freed memory is allocated to user memory. Should the user memory be freed, such as by deleting a download font, the freed memory is returned to the bit map memory. In essence, when the user does not require a large amount of memory, the printer puts it to use in the bit map, reducing complex and partial page errors and making rasterizing more efficient. In the illustrated controller 11, the RAM 17 is divided among bit map, page buffer and user memory. The bit map memory can be in a large size or a small size. In the large bit map configuration, enough memory is allocated to the bit map to contain the data for an entire page. In the small bit map configuration, the bit map contains enough memory to print a small section of a page. This small memory section is reused multiple times in order to print an entire page. In practice, the large bit map memory contains two seven-inch swaths, so that an entire 14-inch page can be rasterized into the bit map memory. The small bit map memory contains two swaths, each of which can hold the raster data for about six-tenths of an inch of the page. When the total amount of system memory is large enough to allow it, a large bit map memory area is allocated. This guarantees that any page, regardless of its complexity, can be printed. Initially, the page buffer is allocated the remaining printer memory, while initially the user memory has no memory allocated. When the datastream to the printer contains a command that requires user memory, that amount of memory is removed from the page buffer allocation and allocated to the user memory area. Each required quantity of memory allocated or reallocated shall be referred to herein as a block of memory. The structure of a memory block shall be discussed in more detail subsequently. If the datastream to the printer contains a request for memory of such a size that the page buffer would be reduced below a minimum size, one of two outcomes is possible. If the printer has a large bit map, the bit map is reduced to its small size. The memory freed from the bit map is allocated to the page buffer and a required memory block is obtained by reducing the page buffer allocation by the amount needed for user memory. On the other hand, if the bit map memory is already at its small size, a memory full indication is provided to the user. The requested user function cannot be performed, and it is ignored. A minimum size for the page buffer is maintained in order to insure that at least the largest datastream command can be processed to the page buffer. When a user function executed by the microprocessor 12 no longer needs a memory block, it can request that the controller delete the block. In response to the request, the microprocessor executes a memory manager routine to free the memory that was in the deleted block and to return it to the page buffer or to available user memory. If the page buffer at some time becomes larger than a selected maximum size, and the bit map is in its small size, the extra memory is added to the bit map, returning the bit map to its large size, allowing the printing of a page of unlimited complexity. The allocation of memory blocks is shown schematically in Figs. 2 and 3. In an arbitrary memory allocation, shown in Fig. 2a, user memory and page buffer memory have a certain size, and the bit map memory is in its large size. As requests for user memory are processed, blocks of memory are placed one after the other in front of the page buffer and the page buffer is reduced in size from the top (the left as shown in Fig. 2b). When a request for user memory is received that would reduce the size of the page buffer below a preset minimum size, the bit map memory is reduced in size and the freed memory is given to the page buffer. As shown in Fig. 2c, the requested memory block is then removed from the now-enlarged page buffer and added to the user memory. The de-allocation of memory blocks from user memory is shown in Fig. 3. As a memory block is no longer needed, the routine that was using the memory block requests the memory manager software to delete it. The memory manager, starting with a memory allocation as shown in Fig. 2c, for example, deletes user memory to expand the page buffer as shown in Fig. 3a. If the size of the page buffer reaches a preset maximum size, the bit map memory is returned to its large size, and the size of the page buffer is reduced, as shown in Fig. 3b. There is hysteresis built into this aspect of the memory manager software so that it is not continuously switching between small and large bit map allocations. Considering the structure of a memory block in more detail, and with reference to Fig. 4, a typical memory block 21 includes a block header 22 and a user area 23. In the present instance, the block header is 8 bytes in length and contains information used by the memory manager software for doing block movement or removal. In the illustrated block header 22, the block length field 24 is 3 bytes long and indicates the length of the block, including the header. The block length information is used by the memory manager software to locate the next block. The block type field 25 is 4 bits in length. The memory blocks may be substantially regarded as either static pointer blocks or dynamic pointer blocks. The block type field indicates whether the block is a static pointer block or a dynamic pointer block. Static pointer blocks are accessed by pointers that are in static (non-moveable) system memory. Dynamic pointer blocks are accessed by pointers that are themselves contained in a memory manager allocated block. Due to this difference, dynamic pointer blocks must be processed differently from static pointer blocks, necessitating the block type field in the block header 22. The delete pending flag (DPF) block 26 is a single bit. Due to the architecture of the present printer, it is not desirable to move memory while a page is being printed. Therefore, when a block is to be deleted from user memory, this bit 26 is set (to a logic one in the present instance) in the block's header, indicating that it is to be removed as soon as allowable. The pointer address field 27 is 4 bytes in length and is the absolute address of the requesting function's pointer to this block. When the block is moved, the requesting function's pointer is updated to point to the block's new location. The user area 23 is the space where the requesting function stores its data. The user area 23 may be considerably longer than the header 22, depending upon the amount of data to be stored in the memory block 21. The pointer to the block contains the address of the first byte of the user area. Considering the allocation of memory to provide a memory block in user memory in more detail, and with reference to Fig. 5, when a request for a memory block is received (such as, for example, from a font download or a macro download routine), the available memory is checked to see if the request can be honored. As shown in Fig. 5, if the request can be honored, a memory block is allocated to the requesting routine and the microprocessor returns to the routine. If the request cannot be honored, a "memory full" indication is produced. The routine in the memory manager software for checking for available memory is set forth in the flowchart of Fig. 6. This "check for available memory" routine has access to the information provided by a routine calling for a block of memory. This information includes the size of the memory block needed and the address of the pointer which will direct the calling routine to this memory block. The "check for available memory" routine first determines if the requested block of memory will fit in a free area of user memory. If so, a block is allocated from the free area of user memory. The block header information is placed in the block, including the pointer address, and the block address is returned for use by the requesting function. To facilitate an understanding of the flow chart of Fig. 6 and subsequent flow charts, Fig. 7 shows used and unused areas of the user memory 28 and page buffer 29 in an exemplary configuration of RAM 17. Fig. 7 also shows a bit map memory portion 30 of the RAM 17. In Fig. 7, an unused portion 31 of the user memory 28 is available for use (in whole or in part) as a memory block. The unused portion 31 of the user memory 28 lies between the end 36 of "used" user memory and the top 34 of the page buffer 29. Pointers are maintained in the system memory to the "end of user memory" 36 and to the top 34 of the page buffer. When a memory block is allocated, the pointer to the end of user memory 36 is adjusted by the size of the allocated block. Returning to the "check for memory" routine, if the requested block will not fit in a free area of user memory, the routine next determines if the block will fit in unused memory at the top of the page buffer area. As shown in Fig. 7, this unused memory area 32 is between the top 34 of the page buffer 29 and the beginning of page buffer data 37 which is needed by the controller for pages not yet fully rasterized and printed. If the requested memory block will fit within the free area 31 of user memory 28, added to some or all of the unused page buffer area 32, then the routine changes the pointer (in system memory) to the top 34 of the page buffer to move the top of the page buffer (to the right as shown in Fig. 7). The top of the page buffer is moved the necessary amount to expand the user memory so that the requested memory block can be allocated from user memory. Returning to Fig. 6, if the requested block will not fit in unused page buffer memory at the top of the page buffer, the routine next determines if the print engine is idle. In order not to disturb memory during printing, with resultant printing errors, memory is not moved when the print engine is running. Also while the print engine is running, the size of the bit map memory is not adjusted. Therefore, the routine loops back to the beginning, waiting for the print engine to become idle or sufficient user or page buffer memory to become free. When the print engine is idle, the routine next determines if any blocks of user memory have been marked for deletion. To do this, the status of a "delete pending" indicator, or flag, is checked. If any blocks in user memory have been marked for deletion, this "delete pending" indicator is set. If there are memory blocks to delete, the blocks which are not deleted are compressed at the top of the user memory. In order to compress blocks in user memory, the subroutine of Fig. 8 is executed. In this subroutine, the first one or more contiguous blocks marked for deletion are deleted. To do this, the subroutine finds the first block in user memory that is marked for deletion. An exemplary user memory containing memory blocks lettered A through I is shown in Fig. 9a. The delete pending flags are shown for each of the blocks, with a "1" indicating that the block is to be deleted. The subroutine of Fig. 8 loops through this step until reaching the end of user memory. Assuming initially that there are blocks to be deleted from the user memory and the end of the user memory has not yet been reached, the subroutine combines all contiguous blocks for deletion into one block. This is illustrated in Fig. 9b, in which blocks C, D and E have been combined into a single block to be deleted. The subroutine stops combining blocks at that point since memory block F has not been marked for deletion. If this combined C, D and E block is not the last user block, which is the case as shown in Fig. 9b, the subroutine then adjusts all pointers to blocks in user memory which will be moved when block CDE is deleted. The pointers are adjusted by the size of the CDE block which is to be deleted. The pointers to be adjusted may be in fixed locations in system memory or in memory blocks in the user memory area. The pointer locations are found in the headers of the blocks being moved. Next the contents of the user area are moved (to the left as shown in Fig. 9) by the size of the deleted block. This transition is shown in the change from the memory allocation in Fig. 9b to that of Fig. 9c. In Fig. 9c, the blocks C, D and E have been deleted, and blocks F through I moved to the left so that the block F is adjacent to the block B. The block movement is accomplished by rewriting the block data for the blocks F through I beginning at the end of the block B. A pointer in system memory pointing to the end 36 of user memory is then adjusted by the size of the deleted block so that the free area 31 of user memory 28 (Fig. 7) is expanded. The subroutine of Fig. 8 executes in a loop until reaching the end of the user memory. If, after the step of combining all contiguous blocks marked for deletion into one block, the subroutine determines that the block which is now being deleted is the last user block, instead of adjusting pointers and moving memory contents, the subroutine merely adjusts the pointer to the end 36 of user memory, since there is no undeleted memory to be moved below the block being deleted. Once the subroutine of Fig. 8 reaches the end of user memory, the subroutine clears the delete pending indicator and returns. The result of the execution of the subroutine is to reduce the allocated user memory to memory blocks not marked for deletion, such as the exemplary memory blocks shown in Fig. 9d, and to adjust the pointer to the end 36 of user memory to indicate that free user memory 31 has been expanded. Returning to the routine of Fig. 6, after all undeleted blocks have been compressed in user memory, the routine is re-executed to now determine if the requested memory block will fit in the free area of user memory. This may now be the case since the area 31 was expanded or created by the routine of Fig. 6. Additionally, (in the "will block fit at the top of page buffer" decision and in the "adjust page buffer pointers" step) the unused page buffer area 32 may be added to the free area of user memory 31 in an attempt to satisfy the request for memory. Returning to the determination in the routine of Fig. 6 of whether any blocks are marked for deletion, if no blocks in the user memory are marked for deletion, the routine next determines if the requested block is of such a size that it would fit in unused page buffer memory, including the unused portion 33 (Fig. 7) below the page buffer data still needed for unprinted pages. If so, the subroutine of Fig. 10 is executed. Considering the movement of the page buffer to allocate a memory block in more detail, and with reference to Fig. 7 as well as Fig. 10, in order to move the page buffer, first the page headers in the page buffer are adjusted. More than one page may be stored in the page buffer, and each page has a header including a pointer to the next page. These pointers are adjusted by the amount that the page buffer data must be shifted in the page buffer memory to provide enough memory for the requested block. After the page headers are adjusted, the page buffer memory contents 37 are rewritten to a lower portion (to the right as shown in Fig. 7) of the page buffer memory. Then the pointers to the page buffer in system memory are adjusted for the amount of the offset of the page buffer contents. The top of page buffer boundary 34 is moved to expand the user memory by the necessary amount, and the requested block of memory is allocated from the now-expanded user memory. Returning to Fig. 6, if it is determined that the block will not fit in unused areas of the user memory and of the page buffer, the routine of Fig. 6 then determines if the bit map memory is in its large swath configuration. If not, a memory full error is produced and the routine returns. If the bit map memory is in the large swath orientation, the routine changes the bit map memory to small swath sizes and adds the freed memory to the page buffer. This is illustrated diagrammatically in the change in bit map memory size from Fig. 2b to Fig. 2c. The page buffer data is then moved, as described earlier with regard to Fig. 10, to permit placement of the requested block in user memory. As a memory block is no longer needed, the function using the memory block requests the memory manager software to delete the block. In response to such a request, the memory manager software executes a routine to set the delete pending flag (DPF) of the block (Fig. 11). The memory manager software in this routine first sets the delete pending flag in the block's header. The routine next checks to see if all blocks past the one marked for deletion are also marked for deletion. If so, the end of user memory pointer is moved to the beginning of this block. This permits the "quick deletion" of memory, which can occur even if the print engine is not idle. The top 34 of the page buffer is not moved at this time. Instead, the free user memory area 31 (Fig. 7) is expanded or created. If all blocks past the one marked for deletion are not also marked for deletion, the delete pending indicator is set. If a delete request is for an actual deletion of memory, implying that the print engine is idle, rather than merely for a logical deletion, the memory manager software executes the routine of Fig. 12. This routine is typically called when the controller is idle. In executing the routine of Fig. 12, first the user memory is compressed using the subroutine of Fig. 8. The top of the page buffer is then moved to the end of user memory. The routine then checks to see if the/page buffer is larger than a predetermined maximum amount and if the bit map memory is in its small size. The routine at this time also determines if the amount of additional memory needed to change from the small bit map size to the large bit map size is present in unused areas 32,33 (Fig. 7) of the page buffer. If these conditions are not all true, the routine returns. If all of the conditions are true, the routine changes the bit map memory from its small size to its large size. In making this change, should the unused area 33 of the page buffer be insufficient to accommodate the large bit map memory size, the page buffer information 37 is moved as necessary into the unused page buffer area 32, increasing the area 33. The routine then returns. While the invention has been disclosed in terms of changing the bit map memory between two sizes, it will be understood that it is also applicable to varying the bit map memory among three or more sizes.

Claims: A page printer comprising a print engine (16) and a controller (11) for the print engine having a random access memory (14) allocated among (a) bit map memory (30) containing a bit image of page data to be serialized to the print engine for printing, (b) page buffer memory (29) containing page description information to be rasterized into the bit map memory, and (c) user memory (28), characterised in that the controller (11) has a memory management arrangement including means (12) for allocating the random access memory (14) to provide a larger or a smaller bit map memory (30) depending on the needs of the controller for memory for the page buffer memory (29) and the user memory (28), such that when a smaller bit map memory is provided, an increased amount of random access memory is available for the page buffer memory and the user memory. The printer of claim 1 in which the larger bit map memory (30) comprises a full page bit map memory. The printer of claim 1 in which the page buffer memory (29) contains character representations and the user memory (28) contains bit image data for characters represented in the page buffer memory, and the bit map memory is rasterized by writing bit image data from the user memory into the bit map memory in accordance with the character representations in the page buffer memory.

Inventors: BECK JAMES LEE, BROWN III JOHN KNOX, COLE CARL PRICE, HOLLOWAY II WALLACE LEE, OLIVER LYNN MARVIN, TROYER STEPHEN RAY, BECK, JAMES LEE, BROWN III, JOHN KNOX, COLE, CARL PRICE, HOLLOWAY II, WALLACE LEE, OLIVER, LYNN MARVIN, TROYER, STEPHEN RAY
Applicants: LEXMARK INT INC, LEXMARK INTERNATIONAL, INC.
Application year: 1990
Main classification: G06K15
IPC codes: B41J5, B41J29, G06F3, G06K15