Added the missing struct and functions

This commit is contained in:
Lectem 2015-10-21 22:12:38 -04:00
parent 89fc70f076
commit 15bca44322
2 changed files with 230 additions and 7 deletions

View File

@ -112,6 +112,31 @@ typedef struct
u16 alpha; ///< Value passed to @ref Y2RU_SetAlpha u16 alpha; ///< Value passed to @ref Y2RU_SetAlpha
} Y2R_ConversionParams; } Y2R_ConversionParams;
/**
* @brief Dithering weights
*
*/
typedef struct
{
u16 w0_xEven_yEven;
u16 w0_xOdd_yEven;
u16 w0_xEven_yOdd;
u16 w0_xOdd_yOdd;
u16 w1_xEven_yEven;
u16 w1_xOdd_yEven;
u16 w1_xEven_yOdd;
u16 w1_xOdd_yOdd;
u16 w2_xEven_yEven;
u16 w2_xOdd_yEven;
u16 w2_xEven_yOdd;
u16 w2_xOdd_yOdd;
u16 w3_xEven_yEven;
u16 w3_xOdd_yEven;
u16 w3_xEven_yOdd;
u16 w3_xOdd_yOdd;
} Y2R_DitheringWeightParams;
/** /**
* @brief Initializes the y2r service. * @brief Initializes the y2r service.
@ -136,6 +161,7 @@ Result y2rExit(void);
*/ */
Result Y2RU_SetInputFormat(Y2R_InputFormat format); Result Y2RU_SetInputFormat(Y2R_InputFormat format);
Result Y2RU_GetInputFormat(Y2R_InputFormat* format);
/** /**
* @brief Used to configure the output format. * @brief Used to configure the output format.
@ -144,6 +170,8 @@ Result Y2RU_SetInputFormat(Y2R_InputFormat format);
*/ */
Result Y2RU_SetOutputFormat(Y2R_OutputFormat format); Result Y2RU_SetOutputFormat(Y2R_OutputFormat format);
Result Y2RU_GetOutputFormat(Y2R_OutputFormat* format);
/** /**
* @brief Used to configure the rotation of the output. * @brief Used to configure the rotation of the output.
* *
@ -153,6 +181,8 @@ Result Y2RU_SetOutputFormat(Y2R_OutputFormat format);
*/ */
Result Y2RU_SetRotation(Y2R_Rotation rotation); Result Y2RU_SetRotation(Y2R_Rotation rotation);
Result Y2RU_GetRotation(Y2R_Rotation* rotation);
/** /**
* @brief Used to configure the alignment of the output buffer. * @brief Used to configure the alignment of the output buffer.
* *
@ -160,6 +190,19 @@ Result Y2RU_SetRotation(Y2R_Rotation rotation);
*/ */
Result Y2RU_SetBlockAlignment(Y2R_BlockAlignment alignment); Result Y2RU_SetBlockAlignment(Y2R_BlockAlignment alignment);
Result Y2RU_GetBlockAlignment(Y2R_BlockAlignment* alignment);
///Sets the usage of spacial dithering
Result Y2RU_SetSpacialDithering(bool enable);
Result Y2RU_GetSpacialDithering(bool* enabled);
///Sets the usage of temporal dithering
Result Y2RU_SetTemporalDithering(bool enable);
Result Y2RU_GetTemporalDithering(bool* enabled);
/** /**
* @brief Used to configure the width of the image. * @brief Used to configure the width of the image.
* @param line_width Width of the image in pixels. Must be a multiple of 8, up to 1024. * @param line_width Width of the image in pixels. Must be a multiple of 8, up to 1024.
@ -168,6 +211,8 @@ Result Y2RU_SetBlockAlignment(Y2R_BlockAlignment alignment);
*/ */
Result Y2RU_SetInputLineWidth(u16 line_width); Result Y2RU_SetInputLineWidth(u16 line_width);
Result Y2RU_GetInputLineWidth(u16* line_width);
/** /**
* @brief Used to configure the height of the image. * @brief Used to configure the height of the image.
* @param num_lines Number of lines to be converted. * @param num_lines Number of lines to be converted.
@ -179,6 +224,8 @@ Result Y2RU_SetInputLineWidth(u16 line_width);
*/ */
Result Y2RU_SetInputLines(u16 num_lines); Result Y2RU_SetInputLines(u16 num_lines);
Result Y2RU_GetInputLines(u16* num_lines);
/** /**
* @brief Used to configure the color conversion formula. * @brief Used to configure the color conversion formula.
* *
@ -188,6 +235,8 @@ Result Y2RU_SetInputLines(u16 num_lines);
*/ */
Result Y2RU_SetCoefficients(const Y2R_ColorCoefficients* coefficients); Result Y2RU_SetCoefficients(const Y2R_ColorCoefficients* coefficients);
Result Y2RU_GetCoefficients(Y2R_ColorCoefficients* coefficients);
/** /**
* @brief Used to configure the color conversion formula with ITU stantards coefficients. * @brief Used to configure the color conversion formula with ITU stantards coefficients.
* *
@ -197,6 +246,9 @@ Result Y2RU_SetCoefficients(const Y2R_ColorCoefficients* coefficients);
*/ */
Result Y2RU_SetStandardCoefficient(Y2R_StandardCoefficient coefficient); Result Y2RU_SetStandardCoefficient(Y2R_StandardCoefficient coefficient);
///Retrieves the coeeficients associated to the given standard
Result Y2RU_GetStandardCoefficient(Y2R_ColorCoefficients* coefficients, Y2R_StandardCoefficient standardCoeff);
/** /**
* @brief Used to configure the alpha value of the output. * @brief Used to configure the alpha value of the output.
* @param alpha 8-bit value to be used for the output when the format requires it. * @param alpha 8-bit value to be used for the output when the format requires it.
@ -205,6 +257,8 @@ Result Y2RU_SetStandardCoefficient(Y2R_StandardCoefficient coefficient);
*/ */
Result Y2RU_SetAlpha(u16 alpha); Result Y2RU_SetAlpha(u16 alpha);
Result Y2RU_GetAlpha(u16* alpha);
/** /**
* @brief Used to enable the end of conversion interrupt. * @brief Used to enable the end of conversion interrupt.
* @param should_interrupt Enables the interrupt if true, disable it if false. * @param should_interrupt Enables the interrupt if true, disable it if false.
@ -217,6 +271,8 @@ Result Y2RU_SetAlpha(u16 alpha);
*/ */
Result Y2RU_SetTransferEndInterrupt(bool should_interrupt); Result Y2RU_SetTransferEndInterrupt(bool should_interrupt);
Result Y2RU_GetTransferEndInterrupt(bool* should_interrupt);
/** /**
* @brief Gets an handle to the end of conversion event. * @brief Gets an handle to the end of conversion event.
* @param end_event Pointer to the event handle to be set to the end of conversion event. It isn't necessary to create or close this handle. * @param end_event Pointer to the event handle to be set to the end of conversion event. It isn't necessary to create or close this handle.
@ -346,11 +402,11 @@ Result Y2RU_IsDoneSendingYUYV(bool* is_done);
*/ */
Result Y2RU_IsDoneReceiving(bool* is_done); Result Y2RU_IsDoneReceiving(bool* is_done);
/** /// Sets the dithering weights
* @brief Sets currently unknown parameters. Result Y2RU_SetDitheringWeightParams(const Y2R_DitheringWeightParams* params);
* @param params Unknown parameters.
*/ /// Retrieves the dithering weights
Result Y2RU_SetUnknownParams(const u16 params[16]); Result Y2RU_GetDitheringWeightParams(Y2R_DitheringWeightParams* params);
/** /**
* @brief Sets all the parameters of Y2R_ConversionParams at once. * @brief Sets all the parameters of Y2R_ConversionParams at once.

View File

@ -59,6 +59,17 @@ Result Y2RU_SetInputFormat(Y2R_InputFormat format)
return cmdbuf[1]; return cmdbuf[1];
} }
Result Y2RU_GetInputFormat(Y2R_InputFormat* format)
{
Result ret = 0;
u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x2,0,0); // 0x20000
if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
*format = cmdbuf[2] & 0xFF;
return cmdbuf[1];
}
Result Y2RU_SetOutputFormat(Y2R_OutputFormat format) Result Y2RU_SetOutputFormat(Y2R_OutputFormat format)
{ {
Result ret = 0; Result ret = 0;
@ -70,6 +81,17 @@ Result Y2RU_SetOutputFormat(Y2R_OutputFormat format)
return cmdbuf[1]; return cmdbuf[1];
} }
Result Y2RU_GetOutputFormat(Y2R_OutputFormat* format)
{
Result ret = 0;
u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x4,0,0); // 0x40000
if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
*format = cmdbuf[2] & 0xFF;
return cmdbuf[1];
}
Result Y2RU_SetRotation(Y2R_Rotation rotation) Result Y2RU_SetRotation(Y2R_Rotation rotation)
{ {
Result ret = 0; Result ret = 0;
@ -81,6 +103,17 @@ Result Y2RU_SetRotation(Y2R_Rotation rotation)
return cmdbuf[1]; return cmdbuf[1];
} }
Result Y2RU_GetRotation(Y2R_Rotation* rotation)
{
Result ret = 0;
u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x6,0,0); // 0x60000
if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
*rotation = cmdbuf[2] & 0xFF;
return cmdbuf[1];
}
Result Y2RU_SetBlockAlignment(Y2R_BlockAlignment alignment) Result Y2RU_SetBlockAlignment(Y2R_BlockAlignment alignment)
{ {
Result ret = 0; Result ret = 0;
@ -92,6 +125,61 @@ Result Y2RU_SetBlockAlignment(Y2R_BlockAlignment alignment)
return cmdbuf[1]; return cmdbuf[1];
} }
Result Y2RU_GetBlockAlignment(Y2R_BlockAlignment* alignment)
{
Result ret = 0;
u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x8,0,0); // 0x80000
if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
*alignment = cmdbuf[2] & 0xFF;
return cmdbuf[1];
}
Result Y2RU_SetSpacialDithering(bool enable)
{
Result ret = 0;
u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x9,1,0); // 0x90040
cmdbuf[1] = enable;
if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
return cmdbuf[1];
}
Result Y2RU_GetSpacialDithering(bool* enabled)
{
Result ret = 0;
u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0xA,0,0); // 0xA0000
if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
*enabled = cmdbuf[2] & 0xFF;
return cmdbuf[1];
}
Result Y2RU_SetTemporalDithering(bool enable)
{
Result ret = 0;
u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0xB,1,0); // 0xB0040
cmdbuf[1] = enable;
if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
return cmdbuf[1];
}
Result Y2RU_GetTemporalDithering(bool* enabled)
{
Result ret = 0;
u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0xC,0,0); // 0xC0000
if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
*enabled = cmdbuf[2] & 0xFF;
return cmdbuf[1];
}
Result Y2RU_SetTransferEndInterrupt(bool should_interrupt) Result Y2RU_SetTransferEndInterrupt(bool should_interrupt)
{ {
Result ret = 0; Result ret = 0;
@ -103,6 +191,17 @@ Result Y2RU_SetTransferEndInterrupt(bool should_interrupt)
return cmdbuf[1]; return cmdbuf[1];
} }
Result Y2RU_GetTransferEndInterrupt(bool* should_interrupt)
{
Result ret = 0;
u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0xE,0,0); // 0xE0000
if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
*should_interrupt = cmdbuf[2] & 0xFF;
return cmdbuf[1];
}
Result Y2RU_GetTransferEndEvent(Handle* end_event) Result Y2RU_GetTransferEndEvent(Handle* end_event)
{ {
if (*end_event != 0) if (*end_event != 0)
@ -267,6 +366,17 @@ Result Y2RU_SetInputLineWidth(u16 line_width)
return cmdbuf[1]; return cmdbuf[1];
} }
Result Y2RU_GetInputLineWidth(u16* line_width)
{
Result ret = 0;
u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x1B,0,0); // 0x1B0000
if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
*line_width = cmdbuf[2] & 0xFFFF;
return cmdbuf[1];
}
Result Y2RU_SetInputLines(u16 num_lines) Result Y2RU_SetInputLines(u16 num_lines)
{ {
Result ret = 0; Result ret = 0;
@ -278,6 +388,17 @@ Result Y2RU_SetInputLines(u16 num_lines)
return cmdbuf[1]; return cmdbuf[1];
} }
Result Y2RU_GetInputLines(u16* num_lines)
{
Result ret = 0;
u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x1D,0,0); // 0x1D0000
if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
*num_lines = cmdbuf[2] & 0xFFFF;
return cmdbuf[1];
}
Result Y2RU_SetCoefficients(const Y2R_ColorCoefficients* coefficients) Result Y2RU_SetCoefficients(const Y2R_ColorCoefficients* coefficients)
{ {
Result ret = 0; Result ret = 0;
@ -289,6 +410,17 @@ Result Y2RU_SetCoefficients(const Y2R_ColorCoefficients* coefficients)
return cmdbuf[1]; return cmdbuf[1];
} }
Result Y2RU_GetCoefficients(Y2R_ColorCoefficients* coefficients)
{
Result ret = 0;
u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x1F,0,0); // 0x1F0000
if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
memcpy(coefficients,cmdbuf + 2, sizeof(Y2R_ColorCoefficients));
return cmdbuf[1];
}
Result Y2RU_SetStandardCoefficient(Y2R_StandardCoefficient coefficient) Result Y2RU_SetStandardCoefficient(Y2R_StandardCoefficient coefficient)
{ {
Result ret = 0; Result ret = 0;
@ -300,6 +432,18 @@ Result Y2RU_SetStandardCoefficient(Y2R_StandardCoefficient coefficient)
return cmdbuf[1]; return cmdbuf[1];
} }
Result Y2RU_GetStandardCoefficient(Y2R_ColorCoefficients* coefficients, Y2R_StandardCoefficient standardCoeff)
{
Result ret = 0;
u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x21,1,0); // 0x210040
cmdbuf[1] = standardCoeff;
if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
memcpy(coefficients,cmdbuf + 2, sizeof(Y2R_ColorCoefficients));
return cmdbuf[1];
}
Result Y2RU_SetAlpha(u16 alpha) Result Y2RU_SetAlpha(u16 alpha)
{ {
Result ret = 0; Result ret = 0;
@ -311,17 +455,40 @@ Result Y2RU_SetAlpha(u16 alpha)
return cmdbuf[1]; return cmdbuf[1];
} }
Result Y2RU_SetUnknownParams(const u16 params[16]) Result Y2RU_GetAlpha(u16* alpha)
{
Result ret = 0;
u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x23,0,0); // 0x230000
if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
*alpha = cmdbuf[2] & 0xFFFF;
return cmdbuf[1];
}
Result Y2RU_SetDitheringWeightParams(const Y2R_DitheringWeightParams* params)
{ {
Result ret = 0; Result ret = 0;
u32* cmdbuf = getThreadCommandBuffer(); u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x24,8,0); // 0x240200 cmdbuf[0] = IPC_MakeHeader(0x24,8,0); // 0x240200
memcpy(&cmdbuf[1], params, sizeof(u16) * 16); memcpy(&cmdbuf[1], params, sizeof(Y2R_DitheringWeightParams));
if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret; if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
return cmdbuf[1]; return cmdbuf[1];
} }
Result Y2RU_GetDitheringWeightParams(Y2R_DitheringWeightParams* params)
{
Result ret = 0;
u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x25,0,0); // 0x250000
if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
memcpy(params,cmdbuf+2, sizeof(Y2R_DitheringWeightParams));
return cmdbuf[1];
}
Result Y2RU_StartConversion(void) Result Y2RU_StartConversion(void)
{ {
Result ret = 0; Result ret = 0;