LP-89 - Port OP_15.05.01 fixes. Release notes:
[librepilot.git] / flight / libraries / PyMite / vm / img.h
blob3e8b513937f4a5be74043b02b778ea3972e8c450
1 /*
2 # This file is Copyright 2003, 2006, 2007, 2009, 2010 Dean Hall.
4 # This file is part of the PyMite VM.
5 # The PyMite VM is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU GENERAL PUBLIC LICENSE Version 2.
8 # The PyMite VM is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 # A copy of the GNU GENERAL PUBLIC LICENSE Version 2
12 # is seen in the file COPYING in this directory.
16 #ifndef __IMG_H__
17 #define __IMG_H__
20 /**
21 * \file
22 * \brief Image header
24 * Created to eliminate a circular include
25 * among mem, string and obj.
29 /** The maximum number of paths available in PmImgPaths */
30 #define PM_NUM_IMG_PATHS 4
33 typedef struct PmImgPaths_s
35 PmMemSpace_t memspace[PM_NUM_IMG_PATHS];
36 uint8_t const *pimg[PM_NUM_IMG_PATHS];
37 uint8_t pathcount;
39 PmImgPaths_t, *pPmImgPaths_t;
42 /**
43 * Code image object
45 * A type to hold code images in the heap.
46 * A code image with an object descriptor at the front.
47 * Used for storing image objects during ipm;
48 * the code object keeps a reference to this object.
50 typedef struct PmCodeImgObj_s
52 /** Object descriptor */
53 PmObjDesc_t od;
55 /** Null-term? char array */
56 uint8_t val[1];
57 } PmCodeImgObj_t,
58 *pPmCodeImgObj_t;
61 /**
62 * Iterates over all paths in the paths array until the named module is found.
63 * Returns the memspace,address of the head of the module.
65 * @param pname Pointer to the name of the desired module
66 * @param r_memspace Return by reference the memory space of the module
67 * @param r_imgaddr Return by reference the address of the module's image
68 * @return Return status
70 PmReturn_t img_findInPaths(pPmObj_t pname, PmMemSpace_t *r_memspace,
71 uint8_t const **r_imgaddr);
73 /**
74 * Appends the given memspace and address to the image path array
76 * @param memspace The memspace
77 * @param paddr The address
78 * @return Return status
80 PmReturn_t img_appendToPath(PmMemSpace_t memspace, uint8_t const * const paddr);
82 #endif /* __IMG_H__ */