diff options
| author | 2016-03-04 10:11:09 -0500 | |
|---|---|---|
| committer | 2016-03-04 10:11:09 -0500 | |
| commit | 878562c2916ddfb916a37cb5e6e6decf138b60b1 (patch) | |
| tree | e001c308df982c61d5fb4dce70e91b81bfc605da /src | |
| parent | Merge pull request #1448 from bunnei/remove-glfw (diff) | |
| parent | Service/CAM: Add doxycomments to all service functions (diff) | |
| download | yuzu-878562c2916ddfb916a37cb5e6e6decf138b60b1.tar.gz yuzu-878562c2916ddfb916a37cb5e6e6decf138b60b1.tar.xz yuzu-878562c2916ddfb916a37cb5e6e6decf138b60b1.zip | |
Merge pull request #1389 from yuriks/stub-cam
Stub CAM:U service
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/cam/cam.cpp | 282 | ||||
| -rw-r--r-- | src/core/hle/service/cam/cam.h | 262 | ||||
| -rw-r--r-- | src/core/hle/service/cam/cam_u.cpp | 39 |
3 files changed, 563 insertions, 20 deletions
diff --git a/src/core/hle/service/cam/cam.cpp b/src/core/hle/service/cam/cam.cpp index 360bcfca4..4d714037f 100644 --- a/src/core/hle/service/cam/cam.cpp +++ b/src/core/hle/service/cam/cam.cpp | |||
| @@ -4,16 +4,287 @@ | |||
| 4 | 4 | ||
| 5 | #include "common/logging/log.h" | 5 | #include "common/logging/log.h" |
| 6 | 6 | ||
| 7 | #include "core/hle/service/service.h" | 7 | #include "core/hle/kernel/event.h" |
| 8 | #include "core/hle/service/cam/cam.h" | 8 | #include "core/hle/service/cam/cam.h" |
| 9 | #include "core/hle/service/cam/cam_c.h" | 9 | #include "core/hle/service/cam/cam_c.h" |
| 10 | #include "core/hle/service/cam/cam_q.h" | 10 | #include "core/hle/service/cam/cam_q.h" |
| 11 | #include "core/hle/service/cam/cam_s.h" | 11 | #include "core/hle/service/cam/cam_s.h" |
| 12 | #include "core/hle/service/cam/cam_u.h" | 12 | #include "core/hle/service/cam/cam_u.h" |
| 13 | #include "core/hle/service/service.h" | ||
| 13 | 14 | ||
| 14 | namespace Service { | 15 | namespace Service { |
| 15 | namespace CAM { | 16 | namespace CAM { |
| 16 | 17 | ||
| 18 | static const u32 TRANSFER_BYTES = 5 * 1024; | ||
| 19 | |||
| 20 | static Kernel::SharedPtr<Kernel::Event> completion_event_cam1; | ||
| 21 | static Kernel::SharedPtr<Kernel::Event> completion_event_cam2; | ||
| 22 | static Kernel::SharedPtr<Kernel::Event> interrupt_error_event; | ||
| 23 | static Kernel::SharedPtr<Kernel::Event> vsync_interrupt_error_event; | ||
| 24 | |||
| 25 | void StartCapture(Service::Interface* self) { | ||
| 26 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 27 | |||
| 28 | u8 port = cmd_buff[1] & 0xFF; | ||
| 29 | |||
| 30 | cmd_buff[0] = IPC::MakeHeader(0x1, 1, 0); | ||
| 31 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 32 | |||
| 33 | LOG_WARNING(Service_CAM, "(STUBBED) called, port=%d", port); | ||
| 34 | } | ||
| 35 | |||
| 36 | void StopCapture(Service::Interface* self) { | ||
| 37 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 38 | |||
| 39 | u8 port = cmd_buff[1] & 0xFF; | ||
| 40 | |||
| 41 | cmd_buff[0] = IPC::MakeHeader(0x2, 1, 0); | ||
| 42 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 43 | |||
| 44 | LOG_WARNING(Service_CAM, "(STUBBED) called, port=%d", port); | ||
| 45 | } | ||
| 46 | |||
| 47 | void GetVsyncInterruptEvent(Service::Interface* self) { | ||
| 48 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 49 | |||
| 50 | u8 port = cmd_buff[1] & 0xFF; | ||
| 51 | |||
| 52 | cmd_buff[0] = IPC::MakeHeader(0x5, 1, 2); | ||
| 53 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 54 | cmd_buff[2] = IPC::MoveHandleDesc(); | ||
| 55 | cmd_buff[3] = Kernel::g_handle_table.Create(vsync_interrupt_error_event).MoveFrom(); | ||
| 56 | |||
| 57 | LOG_WARNING(Service_CAM, "(STUBBED) called, port=%d", port); | ||
| 58 | } | ||
| 59 | |||
| 60 | void GetBufferErrorInterruptEvent(Service::Interface* self) { | ||
| 61 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 62 | |||
| 63 | u8 port = cmd_buff[1] & 0xFF; | ||
| 64 | |||
| 65 | cmd_buff[0] = IPC::MakeHeader(0x6, 1, 2); | ||
| 66 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 67 | cmd_buff[2] = IPC::MoveHandleDesc(); | ||
| 68 | cmd_buff[3] = Kernel::g_handle_table.Create(interrupt_error_event).MoveFrom(); | ||
| 69 | |||
| 70 | LOG_WARNING(Service_CAM, "(STUBBED) called, port=%d", port); | ||
| 71 | } | ||
| 72 | |||
| 73 | void SetReceiving(Service::Interface* self) { | ||
| 74 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 75 | |||
| 76 | VAddr dest = cmd_buff[1]; | ||
| 77 | u8 port = cmd_buff[2] & 0xFF; | ||
| 78 | u32 image_size = cmd_buff[3]; | ||
| 79 | u16 trans_unit = cmd_buff[4] & 0xFFFF; | ||
| 80 | |||
| 81 | Kernel::Event* completion_event = (Port)port == Port::Cam2 ? | ||
| 82 | completion_event_cam2.get() : completion_event_cam1.get(); | ||
| 83 | |||
| 84 | completion_event->Signal(); | ||
| 85 | |||
| 86 | cmd_buff[0] = IPC::MakeHeader(0x7, 1, 2); | ||
| 87 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 88 | cmd_buff[2] = IPC::MoveHandleDesc(); | ||
| 89 | cmd_buff[3] = Kernel::g_handle_table.Create(completion_event).MoveFrom(); | ||
| 90 | |||
| 91 | LOG_WARNING(Service_CAM, "(STUBBED) called, addr=0x%X, port=%d, image_size=%d, trans_unit=%d", | ||
| 92 | dest, port, image_size, trans_unit); | ||
| 93 | } | ||
| 94 | |||
| 95 | void SetTransferLines(Service::Interface* self) { | ||
| 96 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 97 | |||
| 98 | u8 port = cmd_buff[1] & 0xFF; | ||
| 99 | u16 transfer_lines = cmd_buff[2] & 0xFFFF; | ||
| 100 | u16 width = cmd_buff[3] & 0xFFFF; | ||
| 101 | u16 height = cmd_buff[4] & 0xFFFF; | ||
| 102 | |||
| 103 | cmd_buff[0] = IPC::MakeHeader(0x9, 1, 0); | ||
| 104 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 105 | |||
| 106 | LOG_WARNING(Service_CAM, "(STUBBED) called, port=%d, lines=%d, width=%d, height=%d", | ||
| 107 | port, transfer_lines, width, height); | ||
| 108 | } | ||
| 109 | |||
| 110 | void GetMaxLines(Service::Interface* self) { | ||
| 111 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 112 | |||
| 113 | u16 width = cmd_buff[1] & 0xFFFF; | ||
| 114 | u16 height = cmd_buff[2] & 0xFFFF; | ||
| 115 | |||
| 116 | cmd_buff[0] = IPC::MakeHeader(0xA, 2, 0); | ||
| 117 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 118 | cmd_buff[2] = TRANSFER_BYTES / (2 * width); | ||
| 119 | |||
| 120 | LOG_WARNING(Service_CAM, "(STUBBED) called, width=%d, height=%d, lines = %d", | ||
| 121 | width, height, cmd_buff[2]); | ||
| 122 | } | ||
| 123 | |||
| 124 | void GetTransferBytes(Service::Interface* self) { | ||
| 125 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 126 | |||
| 127 | u8 port = cmd_buff[1] & 0xFF; | ||
| 128 | |||
| 129 | cmd_buff[0] = IPC::MakeHeader(0xC, 2, 0); | ||
| 130 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 131 | cmd_buff[2] = TRANSFER_BYTES; | ||
| 132 | |||
| 133 | LOG_WARNING(Service_CAM, "(STUBBED) called, port=%d", port); | ||
| 134 | } | ||
| 135 | |||
| 136 | void SetTrimming(Service::Interface* self) { | ||
| 137 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 138 | |||
| 139 | u8 port = cmd_buff[1] & 0xFF; | ||
| 140 | bool trim = (cmd_buff[2] & 0xFF) != 0; | ||
| 141 | |||
| 142 | cmd_buff[0] = IPC::MakeHeader(0xE, 1, 0); | ||
| 143 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 144 | |||
| 145 | LOG_WARNING(Service_CAM, "(STUBBED) called, port=%d, trim=%d", port, trim); | ||
| 146 | } | ||
| 147 | |||
| 148 | void SetTrimmingParamsCenter(Service::Interface* self) { | ||
| 149 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 150 | |||
| 151 | u8 port = cmd_buff[1] & 0xFF; | ||
| 152 | s16 trimW = cmd_buff[2] & 0xFFFF; | ||
| 153 | s16 trimH = cmd_buff[3] & 0xFFFF; | ||
| 154 | s16 camW = cmd_buff[4] & 0xFFFF; | ||
| 155 | s16 camH = cmd_buff[5] & 0xFFFF; | ||
| 156 | |||
| 157 | cmd_buff[0] = IPC::MakeHeader(0x12, 1, 0); | ||
| 158 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 159 | |||
| 160 | LOG_WARNING(Service_CAM, "(STUBBED) called, port=%d, trimW=%d, trimH=%d, camW=%d, camH=%d", | ||
| 161 | port, trimW, trimH, camW, camH); | ||
| 162 | } | ||
| 163 | |||
| 164 | void Activate(Service::Interface* self) { | ||
| 165 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 166 | |||
| 167 | u8 cam_select = cmd_buff[1] & 0xFF; | ||
| 168 | |||
| 169 | cmd_buff[0] = IPC::MakeHeader(0x13, 1, 0); | ||
| 170 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 171 | |||
| 172 | LOG_WARNING(Service_CAM, "(STUBBED) called, cam_select=%d", | ||
| 173 | cam_select); | ||
| 174 | } | ||
| 175 | |||
| 176 | void FlipImage(Service::Interface* self) { | ||
| 177 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 178 | |||
| 179 | u8 cam_select = cmd_buff[1] & 0xFF; | ||
| 180 | u8 flip = cmd_buff[2] & 0xFF; | ||
| 181 | u8 context = cmd_buff[3] & 0xFF; | ||
| 182 | |||
| 183 | cmd_buff[0] = IPC::MakeHeader(0x1D, 1, 0); | ||
| 184 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 185 | |||
| 186 | LOG_WARNING(Service_CAM, "(STUBBED) called, cam_select=%d, flip=%d, context=%d", | ||
| 187 | cam_select, flip, context); | ||
| 188 | } | ||
| 189 | |||
| 190 | void SetSize(Service::Interface* self) { | ||
| 191 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 192 | |||
| 193 | u8 cam_select = cmd_buff[1] & 0xFF; | ||
| 194 | u8 size = cmd_buff[2] & 0xFF; | ||
| 195 | u8 context = cmd_buff[3] & 0xFF; | ||
| 196 | |||
| 197 | cmd_buff[0] = IPC::MakeHeader(0x1F, 1, 0); | ||
| 198 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 199 | |||
| 200 | LOG_WARNING(Service_CAM, "(STUBBED) called, cam_select=%d, size=%d, context=%d", | ||
| 201 | cam_select, size, context); | ||
| 202 | } | ||
| 203 | |||
| 204 | void SetFrameRate(Service::Interface* self) { | ||
| 205 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 206 | |||
| 207 | u8 cam_select = cmd_buff[1] & 0xFF; | ||
| 208 | u8 frame_rate = cmd_buff[2] & 0xFF; | ||
| 209 | |||
| 210 | cmd_buff[0] = IPC::MakeHeader(0x20, 1, 0); | ||
| 211 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 212 | |||
| 213 | LOG_WARNING(Service_CAM, "(STUBBED) called, cam_select=%d, frame_rate=%d", | ||
| 214 | cam_select, frame_rate); | ||
| 215 | } | ||
| 216 | |||
| 217 | void GetStereoCameraCalibrationData(Service::Interface* self) { | ||
| 218 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 219 | |||
| 220 | // Default values taken from yuriks' 3DS. Valid data is required here or games using the | ||
| 221 | // calibration get stuck in an infinite CPU loop. | ||
| 222 | StereoCameraCalibrationData data = {}; | ||
| 223 | data.isValidRotationXY = 0; | ||
| 224 | data.scale = 1.001776f; | ||
| 225 | data.rotationZ = 0.008322907f; | ||
| 226 | data.translationX = -87.70484f; | ||
| 227 | data.translationY = -7.640977f; | ||
| 228 | data.rotationX = 0.0f; | ||
| 229 | data.rotationY = 0.0f; | ||
| 230 | data.angleOfViewRight = 64.66875f; | ||
| 231 | data.angleOfViewLeft = 64.76067f; | ||
| 232 | data.distanceToChart = 250.0f; | ||
| 233 | data.distanceCameras = 35.0f; | ||
| 234 | data.imageWidth = 640; | ||
| 235 | data.imageHeight = 480; | ||
| 236 | |||
| 237 | cmd_buff[0] = IPC::MakeHeader(0x2B, 17, 0); | ||
| 238 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 239 | memcpy(&cmd_buff[2], &data, sizeof(data)); | ||
| 240 | |||
| 241 | LOG_TRACE(Service_CAM, "called"); | ||
| 242 | } | ||
| 243 | |||
| 244 | void GetSuitableY2rStandardCoefficient(Service::Interface* self) { | ||
| 245 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 246 | |||
| 247 | cmd_buff[0] = IPC::MakeHeader(0x36, 2, 0); | ||
| 248 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 249 | cmd_buff[2] = 0; | ||
| 250 | |||
| 251 | LOG_WARNING(Service_CAM, "(STUBBED) called"); | ||
| 252 | } | ||
| 253 | |||
| 254 | void PlayShutterSound(Service::Interface* self) { | ||
| 255 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 256 | |||
| 257 | u8 sound_id = cmd_buff[1] & 0xFF; | ||
| 258 | |||
| 259 | cmd_buff[0] = IPC::MakeHeader(0x38, 1, 0); | ||
| 260 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 261 | |||
| 262 | LOG_WARNING(Service_CAM, "(STUBBED) called, sound_id=%d", sound_id); | ||
| 263 | } | ||
| 264 | |||
| 265 | void DriverInitialize(Service::Interface* self) { | ||
| 266 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 267 | |||
| 268 | completion_event_cam1->Clear(); | ||
| 269 | completion_event_cam2->Clear(); | ||
| 270 | interrupt_error_event->Clear(); | ||
| 271 | vsync_interrupt_error_event->Clear(); | ||
| 272 | |||
| 273 | cmd_buff[0] = IPC::MakeHeader(0x39, 1, 0); | ||
| 274 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 275 | |||
| 276 | LOG_WARNING(Service_CAM, "(STUBBED) called"); | ||
| 277 | } | ||
| 278 | |||
| 279 | void DriverFinalize(Service::Interface* self) { | ||
| 280 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 281 | |||
| 282 | cmd_buff[0] = IPC::MakeHeader(0x3A, 1, 0); | ||
| 283 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 284 | |||
| 285 | LOG_WARNING(Service_CAM, "(STUBBED) called"); | ||
| 286 | } | ||
| 287 | |||
| 17 | void Init() { | 288 | void Init() { |
| 18 | using namespace Kernel; | 289 | using namespace Kernel; |
| 19 | 290 | ||
| @@ -21,9 +292,18 @@ void Init() { | |||
| 21 | AddService(new CAM_Q_Interface); | 292 | AddService(new CAM_Q_Interface); |
| 22 | AddService(new CAM_S_Interface); | 293 | AddService(new CAM_S_Interface); |
| 23 | AddService(new CAM_U_Interface); | 294 | AddService(new CAM_U_Interface); |
| 295 | |||
| 296 | completion_event_cam1 = Kernel::Event::Create(RESETTYPE_ONESHOT, "CAM_U::completion_event_cam1"); | ||
| 297 | completion_event_cam2 = Kernel::Event::Create(RESETTYPE_ONESHOT, "CAM_U::completion_event_cam2"); | ||
| 298 | interrupt_error_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "CAM_U::interrupt_error_event"); | ||
| 299 | vsync_interrupt_error_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "CAM_U::vsync_interrupt_error_event"); | ||
| 24 | } | 300 | } |
| 25 | 301 | ||
| 26 | void Shutdown() { | 302 | void Shutdown() { |
| 303 | completion_event_cam1 = nullptr; | ||
| 304 | completion_event_cam2 = nullptr; | ||
| 305 | interrupt_error_event = nullptr; | ||
| 306 | vsync_interrupt_error_event = nullptr; | ||
| 27 | } | 307 | } |
| 28 | 308 | ||
| 29 | } // namespace CAM | 309 | } // namespace CAM |
diff --git a/src/core/hle/service/cam/cam.h b/src/core/hle/service/cam/cam.h index 23d0c9c59..2f4923728 100644 --- a/src/core/hle/service/cam/cam.h +++ b/src/core/hle/service/cam/cam.h | |||
| @@ -4,7 +4,12 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "common/common_funcs.h" | ||
| 7 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "common/swap.h" | ||
| 10 | |||
| 11 | #include "core/hle/kernel/kernel.h" | ||
| 12 | #include "core/hle/service/service.h" | ||
| 8 | 13 | ||
| 9 | namespace Service { | 14 | namespace Service { |
| 10 | namespace CAM { | 15 | namespace CAM { |
| @@ -140,6 +145,26 @@ enum class OutputFormat : u8 { | |||
| 140 | RGB565 = 1 | 145 | RGB565 = 1 |
| 141 | }; | 146 | }; |
| 142 | 147 | ||
| 148 | /// Stereo camera calibration data. | ||
| 149 | struct StereoCameraCalibrationData { | ||
| 150 | u8 isValidRotationXY; ///< Bool indicating whether the X and Y rotation data is valid. | ||
| 151 | INSERT_PADDING_BYTES(3); | ||
| 152 | float_le scale; ///< Scale to match the left camera image with the right. | ||
| 153 | float_le rotationZ; ///< Z axis rotation to match the left camera image with the right. | ||
| 154 | float_le translationX; ///< X axis translation to match the left camera image with the right. | ||
| 155 | float_le translationY; ///< Y axis translation to match the left camera image with the right. | ||
| 156 | float_le rotationX; ///< X axis rotation to match the left camera image with the right. | ||
| 157 | float_le rotationY; ///< Y axis rotation to match the left camera image with the right. | ||
| 158 | float_le angleOfViewRight; ///< Right camera angle of view. | ||
| 159 | float_le angleOfViewLeft; ///< Left camera angle of view. | ||
| 160 | float_le distanceToChart; ///< Distance between cameras and measurement chart. | ||
| 161 | float_le distanceCameras; ///< Distance between left and right cameras. | ||
| 162 | s16_le imageWidth; ///< Image width. | ||
| 163 | s16_le imageHeight; ///< Image height. | ||
| 164 | INSERT_PADDING_BYTES(16); | ||
| 165 | }; | ||
| 166 | static_assert(sizeof(StereoCameraCalibrationData) == 64, "StereoCameraCalibrationData structure size is wrong"); | ||
| 167 | |||
| 143 | struct PackageParameterCameraSelect { | 168 | struct PackageParameterCameraSelect { |
| 144 | CameraSelect camera; | 169 | CameraSelect camera; |
| 145 | s8 exposure; | 170 | s8 exposure; |
| @@ -165,6 +190,243 @@ struct PackageParameterCameraSelect { | |||
| 165 | 190 | ||
| 166 | static_assert(sizeof(PackageParameterCameraSelect) == 28, "PackageParameterCameraSelect structure size is wrong"); | 191 | static_assert(sizeof(PackageParameterCameraSelect) == 28, "PackageParameterCameraSelect structure size is wrong"); |
| 167 | 192 | ||
| 193 | /** | ||
| 194 | * Unknown | ||
| 195 | * Inputs: | ||
| 196 | * 0: 0x00010040 | ||
| 197 | * 1: u8 Camera port (`Port` enum) | ||
| 198 | * Outputs: | ||
| 199 | * 0: 0x00010040 | ||
| 200 | * 1: ResultCode | ||
| 201 | */ | ||
| 202 | void StartCapture(Service::Interface* self); | ||
| 203 | |||
| 204 | /** | ||
| 205 | * Unknown | ||
| 206 | * Inputs: | ||
| 207 | * 0: 0x00020040 | ||
| 208 | * 1: u8 Camera port (`Port` enum) | ||
| 209 | * Outputs: | ||
| 210 | * 0: 0x00020040 | ||
| 211 | * 1: ResultCode | ||
| 212 | */ | ||
| 213 | void StopCapture(Service::Interface* self); | ||
| 214 | |||
| 215 | /** | ||
| 216 | * Unknown | ||
| 217 | * Inputs: | ||
| 218 | * 0: 0x00050040 | ||
| 219 | * 1: u8 Camera port (`Port` enum) | ||
| 220 | * Outputs: | ||
| 221 | * 0: 0x00050042 | ||
| 222 | * 1: ResultCode | ||
| 223 | * 2: Descriptor: Handle | ||
| 224 | * 3: Event handle | ||
| 225 | */ | ||
| 226 | void GetVsyncInterruptEvent(Service::Interface* self); | ||
| 227 | |||
| 228 | /** | ||
| 229 | * Unknown | ||
| 230 | * Inputs: | ||
| 231 | * 0: 0x00060040 | ||
| 232 | * 1: u8 Camera port (`Port` enum) | ||
| 233 | * Outputs: | ||
| 234 | * 0: 0x00060042 | ||
| 235 | * 1: ResultCode | ||
| 236 | * 2: Descriptor: Handle | ||
| 237 | * 3: Event handle | ||
| 238 | */ | ||
| 239 | void GetBufferErrorInterruptEvent(Service::Interface* self); | ||
| 240 | |||
| 241 | /** | ||
| 242 | * Sets the target buffer to receive a frame of image data and starts the transfer. Each camera | ||
| 243 | * port has its own event to signal the end of the transfer. | ||
| 244 | * | ||
| 245 | * Inputs: | ||
| 246 | * 0: 0x00070102 | ||
| 247 | * 1: Destination address in calling process | ||
| 248 | * 2: u8 Camera port (`Port` enum) | ||
| 249 | * 3: Image size (in bytes?) | ||
| 250 | * 4: u16 Transfer unit size (in bytes?) | ||
| 251 | * 5: Descriptor: Handle | ||
| 252 | * 6: Handle to destination process | ||
| 253 | * Outputs: | ||
| 254 | * 0: 0x00070042 | ||
| 255 | * 1: ResultCode | ||
| 256 | * 2: Descriptor: Handle | ||
| 257 | * 3: Handle to event signalled when transfer finishes | ||
| 258 | */ | ||
| 259 | void SetReceiving(Service::Interface* self); | ||
| 260 | |||
| 261 | /** | ||
| 262 | * Unknown | ||
| 263 | * Inputs: | ||
| 264 | * 0: 0x00090100 | ||
| 265 | * 1: u8 Camera port (`Port` enum) | ||
| 266 | * 2: u16 Number of lines to transfer | ||
| 267 | * 3: u16 Width | ||
| 268 | * 4: u16 Height | ||
| 269 | * Outputs: | ||
| 270 | * 0: 0x00090040 | ||
| 271 | * 1: ResultCode | ||
| 272 | */ | ||
| 273 | void SetTransferLines(Service::Interface* self); | ||
| 274 | |||
| 275 | /** | ||
| 276 | * Unknown | ||
| 277 | * Inputs: | ||
| 278 | * 0: 0x000A0080 | ||
| 279 | * 1: u16 Width | ||
| 280 | * 2: u16 Height | ||
| 281 | * Outputs: | ||
| 282 | * 0: 0x000A0080 | ||
| 283 | * 1: ResultCode | ||
| 284 | * 2: Maximum number of lines that fit in the buffer(?) | ||
| 285 | */ | ||
| 286 | void GetMaxLines(Service::Interface* self); | ||
| 287 | |||
| 288 | /** | ||
| 289 | * Unknown | ||
| 290 | * Inputs: | ||
| 291 | * 0: 0x000C0040 | ||
| 292 | * 1: u8 Camera port (`Port` enum) | ||
| 293 | * Outputs: | ||
| 294 | * 0: 0x000C0080 | ||
| 295 | * 1: ResultCode | ||
| 296 | * 2: Total number of bytes for each frame with current settings(?) | ||
| 297 | */ | ||
| 298 | void GetTransferBytes(Service::Interface* self); | ||
| 299 | |||
| 300 | /** | ||
| 301 | * Unknown | ||
| 302 | * Inputs: | ||
| 303 | * 0: 0x000E0080 | ||
| 304 | * 1: u8 Camera port (`Port` enum) | ||
| 305 | * 2: u8 bool Enable trimming if true | ||
| 306 | * Outputs: | ||
| 307 | * 0: 0x000E0040 | ||
| 308 | * 1: ResultCode | ||
| 309 | */ | ||
| 310 | void SetTrimming(Service::Interface* self); | ||
| 311 | |||
| 312 | /** | ||
| 313 | * Unknown | ||
| 314 | * Inputs: | ||
| 315 | * 0: 0x00120140 | ||
| 316 | * 1: u8 Camera port (`Port` enum) | ||
| 317 | * 2: s16 Trim width(?) | ||
| 318 | * 3: s16 Trim height(?) | ||
| 319 | * 4: s16 Camera width(?) | ||
| 320 | * 5: s16 Camera height(?) | ||
| 321 | * Outputs: | ||
| 322 | * 0: 0x00120040 | ||
| 323 | * 1: ResultCode | ||
| 324 | */ | ||
| 325 | void SetTrimmingParamsCenter(Service::Interface* self); | ||
| 326 | |||
| 327 | /** | ||
| 328 | * Selects up to two physical cameras to enable. | ||
| 329 | * Inputs: | ||
| 330 | * 0: 0x00130040 | ||
| 331 | * 1: u8 Cameras to activate (`CameraSelect` enum) | ||
| 332 | * Outputs: | ||
| 333 | * 0: 0x00130040 | ||
| 334 | * 1: ResultCode | ||
| 335 | */ | ||
| 336 | void Activate(Service::Interface* self); | ||
| 337 | |||
| 338 | /** | ||
| 339 | * Unknown | ||
| 340 | * Inputs: | ||
| 341 | * 0: 0x001D00C0 | ||
| 342 | * 1: u8 Camera select (`CameraSelect` enum) | ||
| 343 | * 2: u8 Type of flipping to perform (`Flip` enum) | ||
| 344 | * 3: u8 Context (`Context` enum) | ||
| 345 | * Outputs: | ||
| 346 | * 0: 0x001D0040 | ||
| 347 | * 1: ResultCode | ||
| 348 | */ | ||
| 349 | void FlipImage(Service::Interface* self); | ||
| 350 | |||
| 351 | /** | ||
| 352 | * Unknown | ||
| 353 | * Inputs: | ||
| 354 | * 0: 0x001F00C0 | ||
| 355 | * 1: u8 Camera select (`CameraSelect` enum) | ||
| 356 | * 2: u8 Camera frame resolution (`Size` enum) | ||
| 357 | * 3: u8 Context id (`Context` enum) | ||
| 358 | * Outputs: | ||
| 359 | * 0: 0x001F0040 | ||
| 360 | * 1: ResultCode | ||
| 361 | */ | ||
| 362 | void SetSize(Service::Interface* self); | ||
| 363 | |||
| 364 | /** | ||
| 365 | * Unknown | ||
| 366 | * Inputs: | ||
| 367 | * 0: 0x00200080 | ||
| 368 | * 1: u8 Camera select (`CameraSelect` enum) | ||
| 369 | * 2: u8 Camera framerate (`FrameRate` enum) | ||
| 370 | * Outputs: | ||
| 371 | * 0: 0x00200040 | ||
| 372 | * 1: ResultCode | ||
| 373 | */ | ||
| 374 | void SetFrameRate(Service::Interface* self); | ||
| 375 | |||
| 376 | /** | ||
| 377 | * Returns calibration data relating the outside cameras to eachother, for use in AR applications. | ||
| 378 | * | ||
| 379 | * Inputs: | ||
| 380 | * 0: 0x002B0000 | ||
| 381 | * Outputs: | ||
| 382 | * 0: 0x002B0440 | ||
| 383 | * 1: ResultCode | ||
| 384 | * 2-17: `StereoCameraCalibrationData` structure with calibration values | ||
| 385 | */ | ||
| 386 | void GetStereoCameraCalibrationData(Service::Interface* self); | ||
| 387 | |||
| 388 | /** | ||
| 389 | * Unknown | ||
| 390 | * Inputs: | ||
| 391 | * 0: 0x00360000 | ||
| 392 | * Outputs: | ||
| 393 | * 0: 0x00360080 | ||
| 394 | * 1: ResultCode | ||
| 395 | * 2: ? | ||
| 396 | */ | ||
| 397 | void GetSuitableY2rStandardCoefficient(Service::Interface* self); | ||
| 398 | |||
| 399 | /** | ||
| 400 | * Unknown | ||
| 401 | * Inputs: | ||
| 402 | * 0: 0x00380040 | ||
| 403 | * 1: u8 Sound ID | ||
| 404 | * Outputs: | ||
| 405 | * 0: 0x00380040 | ||
| 406 | * 1: ResultCode | ||
| 407 | */ | ||
| 408 | void PlayShutterSound(Service::Interface* self); | ||
| 409 | |||
| 410 | /** | ||
| 411 | * Initializes the camera driver. Must be called before using other functions. | ||
| 412 | * Inputs: | ||
| 413 | * 0: 0x00390000 | ||
| 414 | * Outputs: | ||
| 415 | * 0: 0x00390040 | ||
| 416 | * 1: ResultCode | ||
| 417 | */ | ||
| 418 | void DriverInitialize(Service::Interface* self); | ||
| 419 | |||
| 420 | /** | ||
| 421 | * Shuts down the camera driver. | ||
| 422 | * Inputs: | ||
| 423 | * 0: 0x003A0000 | ||
| 424 | * Outputs: | ||
| 425 | * 0: 0x003A0040 | ||
| 426 | * 1: ResultCode | ||
| 427 | */ | ||
| 428 | void DriverFinalize(Service::Interface* self); | ||
| 429 | |||
| 168 | /// Initialize CAM service(s) | 430 | /// Initialize CAM service(s) |
| 169 | void Init(); | 431 | void Init(); |
| 170 | 432 | ||
diff --git a/src/core/hle/service/cam/cam_u.cpp b/src/core/hle/service/cam/cam_u.cpp index 9d59c55fb..a1070ebb2 100644 --- a/src/core/hle/service/cam/cam_u.cpp +++ b/src/core/hle/service/cam/cam_u.cpp | |||
| @@ -2,31 +2,32 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/hle/service/cam/cam.h" | ||
| 5 | #include "core/hle/service/cam/cam_u.h" | 6 | #include "core/hle/service/cam/cam_u.h" |
| 6 | 7 | ||
| 7 | namespace Service { | 8 | namespace Service { |
| 8 | namespace CAM { | 9 | namespace CAM { |
| 9 | 10 | ||
| 10 | const Interface::FunctionInfo FunctionTable[] = { | 11 | const Interface::FunctionInfo FunctionTable[] = { |
| 11 | {0x00010040, nullptr, "StartCapture"}, | 12 | {0x00010040, StartCapture, "StartCapture"}, |
| 12 | {0x00020040, nullptr, "StopCapture"}, | 13 | {0x00020040, StopCapture, "StopCapture"}, |
| 13 | {0x00030040, nullptr, "IsBusy"}, | 14 | {0x00030040, nullptr, "IsBusy"}, |
| 14 | {0x00040040, nullptr, "ClearBuffer"}, | 15 | {0x00040040, nullptr, "ClearBuffer"}, |
| 15 | {0x00050040, nullptr, "GetVsyncInterruptEvent"}, | 16 | {0x00050040, GetVsyncInterruptEvent, "GetVsyncInterruptEvent"}, |
| 16 | {0x00060040, nullptr, "GetBufferErrorInterruptEvent"}, | 17 | {0x00060040, GetBufferErrorInterruptEvent, "GetBufferErrorInterruptEvent"}, |
| 17 | {0x00070102, nullptr, "SetReceiving"}, | 18 | {0x00070102, SetReceiving, "SetReceiving"}, |
| 18 | {0x00080040, nullptr, "IsFinishedReceiving"}, | 19 | {0x00080040, nullptr, "IsFinishedReceiving"}, |
| 19 | {0x00090100, nullptr, "SetTransferLines"}, | 20 | {0x00090100, SetTransferLines, "SetTransferLines"}, |
| 20 | {0x000A0080, nullptr, "GetMaxLines"}, | 21 | {0x000A0080, GetMaxLines, "GetMaxLines"}, |
| 21 | {0x000B0100, nullptr, "SetTransferBytes"}, | 22 | {0x000B0100, nullptr, "SetTransferBytes"}, |
| 22 | {0x000C0040, nullptr, "GetTransferBytes"}, | 23 | {0x000C0040, GetTransferBytes, "GetTransferBytes"}, |
| 23 | {0x000D0080, nullptr, "GetMaxBytes"}, | 24 | {0x000D0080, nullptr, "GetMaxBytes"}, |
| 24 | {0x000E0080, nullptr, "SetTrimming"}, | 25 | {0x000E0080, SetTrimming, "SetTrimming"}, |
| 25 | {0x000F0040, nullptr, "IsTrimming"}, | 26 | {0x000F0040, nullptr, "IsTrimming"}, |
| 26 | {0x00100140, nullptr, "SetTrimmingParams"}, | 27 | {0x00100140, nullptr, "SetTrimmingParams"}, |
| 27 | {0x00110040, nullptr, "GetTrimmingParams"}, | 28 | {0x00110040, nullptr, "GetTrimmingParams"}, |
| 28 | {0x00120140, nullptr, "SetTrimmingParamsCenter"}, | 29 | {0x00120140, SetTrimmingParamsCenter, "SetTrimmingParamsCenter"}, |
| 29 | {0x00130040, nullptr, "Activate"}, | 30 | {0x00130040, Activate, "Activate"}, |
| 30 | {0x00140080, nullptr, "SwitchContext"}, | 31 | {0x00140080, nullptr, "SwitchContext"}, |
| 31 | {0x00150080, nullptr, "SetExposure"}, | 32 | {0x00150080, nullptr, "SetExposure"}, |
| 32 | {0x00160080, nullptr, "SetWhiteBalance"}, | 33 | {0x00160080, nullptr, "SetWhiteBalance"}, |
| @@ -36,10 +37,10 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 36 | {0x001A0040, nullptr, "IsAutoExposure"}, | 37 | {0x001A0040, nullptr, "IsAutoExposure"}, |
| 37 | {0x001B0080, nullptr, "SetAutoWhiteBalance"}, | 38 | {0x001B0080, nullptr, "SetAutoWhiteBalance"}, |
| 38 | {0x001C0040, nullptr, "IsAutoWhiteBalance"}, | 39 | {0x001C0040, nullptr, "IsAutoWhiteBalance"}, |
| 39 | {0x001D00C0, nullptr, "FlipImage"}, | 40 | {0x001D00C0, FlipImage, "FlipImage"}, |
| 40 | {0x001E0200, nullptr, "SetDetailSize"}, | 41 | {0x001E0200, nullptr, "SetDetailSize"}, |
| 41 | {0x001F00C0, nullptr, "SetSize"}, | 42 | {0x001F00C0, SetSize, "SetSize"}, |
| 42 | {0x00200080, nullptr, "SetFrameRate"}, | 43 | {0x00200080, SetFrameRate, "SetFrameRate"}, |
| 43 | {0x00210080, nullptr, "SetPhotoMode"}, | 44 | {0x00210080, nullptr, "SetPhotoMode"}, |
| 44 | {0x002200C0, nullptr, "SetEffect"}, | 45 | {0x002200C0, nullptr, "SetEffect"}, |
| 45 | {0x00230080, nullptr, "SetContrast"}, | 46 | {0x00230080, nullptr, "SetContrast"}, |
| @@ -50,7 +51,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 50 | {0x00280080, nullptr, "SetNoiseFilter"}, | 51 | {0x00280080, nullptr, "SetNoiseFilter"}, |
| 51 | {0x00290080, nullptr, "SynchronizeVsyncTiming"}, | 52 | {0x00290080, nullptr, "SynchronizeVsyncTiming"}, |
| 52 | {0x002A0080, nullptr, "GetLatestVsyncTiming"}, | 53 | {0x002A0080, nullptr, "GetLatestVsyncTiming"}, |
| 53 | {0x002B0000, nullptr, "GetStereoCameraCalibrationData"}, | 54 | {0x002B0000, GetStereoCameraCalibrationData, "GetStereoCameraCalibrationData"}, |
| 54 | {0x002C0400, nullptr, "SetStereoCameraCalibrationData"}, | 55 | {0x002C0400, nullptr, "SetStereoCameraCalibrationData"}, |
| 55 | {0x002D00C0, nullptr, "WriteRegisterI2c"}, | 56 | {0x002D00C0, nullptr, "WriteRegisterI2c"}, |
| 56 | {0x002E00C0, nullptr, "WriteMcuVariableI2c"}, | 57 | {0x002E00C0, nullptr, "WriteMcuVariableI2c"}, |
| @@ -61,11 +62,11 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 61 | {0x003302C0, nullptr, "SetPackageParameterWithoutContext"}, | 62 | {0x003302C0, nullptr, "SetPackageParameterWithoutContext"}, |
| 62 | {0x00340140, nullptr, "SetPackageParameterWithContext"}, | 63 | {0x00340140, nullptr, "SetPackageParameterWithContext"}, |
| 63 | {0x003501C0, nullptr, "SetPackageParameterWithContextDetail"}, | 64 | {0x003501C0, nullptr, "SetPackageParameterWithContextDetail"}, |
| 64 | {0x00360000, nullptr, "GetSuitableY2rStandardCoefficient"}, | 65 | {0x00360000, GetSuitableY2rStandardCoefficient, "GetSuitableY2rStandardCoefficient"}, |
| 65 | {0x00370202, nullptr, "PlayShutterSoundWithWave"}, | 66 | {0x00370202, nullptr, "PlayShutterSoundWithWave"}, |
| 66 | {0x00380040, nullptr, "PlayShutterSound"}, | 67 | {0x00380040, PlayShutterSound, "PlayShutterSound"}, |
| 67 | {0x00390000, nullptr, "DriverInitialize"}, | 68 | {0x00390000, DriverInitialize, "DriverInitialize"}, |
| 68 | {0x003A0000, nullptr, "DriverFinalize"}, | 69 | {0x003A0000, DriverFinalize, "DriverFinalize"}, |
| 69 | {0x003B0000, nullptr, "GetActivatedCamera"}, | 70 | {0x003B0000, nullptr, "GetActivatedCamera"}, |
| 70 | {0x003C0000, nullptr, "GetSleepCamera"}, | 71 | {0x003C0000, nullptr, "GetSleepCamera"}, |
| 71 | {0x003D0040, nullptr, "SetSleepCamera"}, | 72 | {0x003D0040, nullptr, "SetSleepCamera"}, |