36 #define _________________________________________TYPES_SECTION______________________________________________________________________________ 53 #undef _________________________________________TYPES_SECTION______________________________________________________________________________ 60 #define _________________________________________VARIABLES_SECTION__________________________________________________________________________ 71 #undef _________________________________________VARIABLES_SECTION__________________________________________________________________________ 79 #define _________________________________________INTERFACE_FUNCTIONS_SECTION________________________________________________________________ 104 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
107 ErrorCondition( isaddresscorrect(Driver) , oC_ErrorCode_WrongAddress )
108 && ErrorCondition( oC_Driver_GetDriverType(Driver) == GRAPHICS_DRIVER , oC_ErrorCode_NotGraphicDriver )
109 && ErrorCondition( isaddresscorrect(Driver) , oC_ErrorCode_WrongAddress )
110 && ErrorCondition( isaddresscorrect(Name) , oC_ErrorCode_WrongAddress )
113 screen = kmalloc(
sizeof(
struct Screen_t) , &Allocator , AllocationFlags_CanWait1Second | AllocationFlags_ZeroFill);
119 screen->
Config = kmalloc(Driver->ConfigurationSize,&Allocator, AllocationFlags_CanWait1Second);
125 strncpy(screen->
Name,Name,
sizeof(screen->
Name));
126 memcpy(screen->
Config,Config,Driver->ConfigurationSize);
130 oC_SaveIfFalse(
"Screen::new: cannot release screen memory", kfree(screen,AllocationFlags_CanWait1Second) , oC_ErrorCode_ReleaseError);
131 oC_SaveError(
"Screen::new: cannot allocate memory for config" , oC_ErrorCode_AllocationError);
136 oC_SaveError(
"Screen::new: cannot allocate memory for screen" , oC_ErrorCode_AllocationError);
141 oC_SaveError(
"Screen::new: Cannot create screen - " , errorCode);
187 bool deleted =
false;
195 oC_SaveIfErrorOccur(
"Screen::delete: Cannot unconfigure screen - " , oC_Driver_Unconfigure(localScreen->
Driver,localScreen->
Config,&localScreen->
Context));
198 deleted = kfree(localScreen->
Config,AllocationFlags_CanWait1Second);
202 oC_SaveError(
"Screen::delete: Cannot release config memory - " , oC_ErrorCode_ReleaseError);
205 if(kfree(localScreen,AllocationFlags_CanWait1Second))
207 deleted = deleted &&
true;
211 oC_SaveError(
"Screen::delete: Cannot release screen memory - " , oC_ErrorCode_ReleaseError);
259 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
263 && ErrorCondition( Screen->
Configured ==
false , oC_ErrorCode_AlreadyConfigured )
264 && oC_AssignErrorCode(&errorCode , oC_Driver_Configure(Screen->
Driver,Screen->
Config,&Screen->
Context))
268 errorCode = oC_ErrorCode_None;
294 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
298 && ErrorCondition( Screen->
Configured ==
true , oC_ErrorCode_NotConfiguredYet )
299 && oC_AssignErrorCode(&errorCode , oC_Driver_Unconfigure(Screen->
Driver,Screen->
Config,&Screen->
Context))
303 errorCode = oC_ErrorCode_None;
326 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
330 && ErrorCondition( Screen->
Configured ==
true , oC_ErrorCode_NotConfiguredYet )
331 && ErrorCondition( isram(outColorMap) , oC_ErrorCode_OutputAddressNotInRAM )
334 errorCode = oC_Driver_ReadColorMap(Screen->
Driver,Screen->
Context,outColorMap);
358 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
362 && ErrorCondition( Screen->
Configured ==
true , oC_ErrorCode_NotConfiguredYet )
363 && ErrorCondition( isram(outWidth) , oC_ErrorCode_OutputAddressNotInRAM )
364 && ErrorCondition( isram(outHeight) , oC_ErrorCode_OutputAddressNotInRAM )
367 errorCode = oC_Driver_ReadResolution(Screen->
Driver,Screen->
Context,outWidth,outHeight);
388 const char * name =
"unknown";
417 oC_Driver_t driver =
NULL;
428 #undef _________________________________________INTERFACE_FUNCTIONS_SECTION________________________________________________________________ const char * oC_Screen_GetName(oC_Screen_t Screen)
returns name of the screen
char Name[30]
Name of the screen - useful for screen identification.
identifier for allocations
oC_Screen_t oC_Screen_New(oC_Driver_t Driver, const void *Config, const char *Name)
creates new screen object
bool oC_Screen_Delete(oC_Screen_t *Screen)
Destroys the Screen object.
void * Context
Pointer to the driver context.
static const oC_Allocator_t Allocator
the allocator definition for identify the module allocations
oC_ErrorCode_t oC_Screen_ReadResolution(oC_Screen_t Screen, oC_Pixel_ResolutionUInt_t *outWidth, oC_Pixel_ResolutionUInt_t *outHeight)
reads resolution of the screen
The file with helper macros for managing objects.
bool Configured
This flag is set to true if the driver configuration was done and was finished with successful result...
uint32_t oC_ObjectControl_t
stores object control value
stores screen object data
oC_Driver_t Driver
Pointer to the graphic driver that handles the screen.
File with interface for the screen objects.
static oC_ObjectControl_t oC_CountObjectControl(void *ObjectPointer, oC_ObjectId_t ObjectId)
counts object control for object
static bool oC_CheckObjectControl(void *ObjectPointer, oC_ObjectId_t ObjectId, oC_ObjectControl_t ObjectControl)
checks if object control is correct
bool oC_Screen_IsConfigured(oC_Screen_t Screen)
checks if the screen is configured to work
oC_ErrorCode_t oC_Screen_Configure(oC_Screen_t Screen)
configures graphics driver to work
oC_Driver_t oC_Screen_GetDriver(oC_Screen_t Screen)
returns driver associated with the screen
The file with interface for string library.
bool oC_Screen_IsCorrect(oC_Screen_t Screen)
checks if the Screen object is correct
oC_ErrorCode_t oC_Screen_ReadColorMap(oC_Screen_t Screen, oC_ColorMap_t **outColorMap)
reads pointer to the color map
oC_ObjectControl_t ObjectControl
Magic number counted by the Object module.
void * Config
Pointer to the screen configuration.
oC_ErrorCode_t oC_Screen_Unconfigure(oC_Screen_t Screen)
unconfigures graphics driver
#define NULL
pointer to a zero