File tree Expand file tree Collapse file tree 5 files changed +14
-18
lines changed
Expand file tree Collapse file tree 5 files changed +14
-18
lines changed Original file line number Diff line number Diff line change @@ -98,10 +98,6 @@ static display_driver_t g_display_driver = {
9898int sdl_display_res_x = DISPLAY_RESX , sdl_display_res_y = DISPLAY_RESY ;
9999int sdl_touch_offset_x , sdl_touch_offset_y ;
100100
101- static void display_exit_handler (void ) {
102- display_deinit (DISPLAY_RESET_CONTENT );
103- }
104-
105101bool display_init (display_content_mode_t mode ) {
106102 display_driver_t * drv = & g_display_driver ;
107103
@@ -113,7 +109,6 @@ bool display_init(display_content_mode_t mode) {
113109 printf ("%s\n" , SDL_GetError ());
114110 error_shutdown ("SDL_Init error" );
115111 }
116- atexit (display_exit_handler );
117112
118113 char * window_title = NULL ;
119114 char * window_title_alloc = NULL ;
Original file line number Diff line number Diff line change 5454#ifdef KERNEL_MODE
5555
5656void sdcard_init (void );
57+
58+ void sdcard_deinit (void );
59+
5760secbool __wur sdcard_power_on_unchecked (bool low_speed );
5861
5962#endif
Original file line number Diff line number Diff line change 3939static uint8_t * sdcard_buffer = NULL ;
4040static secbool sdcard_powered = secfalse ;
4141
42- static void sdcard_exit (void ) {
43- int r = munmap (sdcard_buffer , SDCARD_SIZE );
44- ensure (sectrue * (r == 0 ), "munmap failed" );
45- sdcard_buffer = NULL ;
46- }
47-
4842void sdcard_init (void ) {
4943 if (sdcard_buffer != NULL ) {
5044 return ;
@@ -81,8 +75,12 @@ void sdcard_init(void) {
8175 }
8276
8377 sdcard_powered = secfalse ;
78+ }
8479
85- atexit (sdcard_exit );
80+ void sdcard_deinit (void ) {
81+ int r = munmap (sdcard_buffer , SDCARD_SIZE );
82+ ensure (sectrue * (r == 0 ), "munmap failed" );
83+ sdcard_buffer = NULL ;
8684}
8785
8886secbool sdcard_is_present (void ) { return sectrue ; }
Original file line number Diff line number Diff line change 3030
3131void flash_init (void );
3232
33+ void flash_deinit (void );
34+
3335extern const flash_area_t BOARDLOADER_AREA ;
3436extern const flash_area_t SECRET_AREA ;
3537extern const flash_area_t BHK_AREA ;
Original file line number Diff line number Diff line change @@ -82,11 +82,6 @@ static uint32_t FLASH_SECTOR_TABLE[FLASH_SECTOR_COUNT + 1] = {
8282static uint8_t * FLASH_BUFFER = NULL ;
8383static uint32_t FLASH_SIZE ;
8484
85- static void flash_exit (void ) {
86- int r = munmap (FLASH_BUFFER , FLASH_SIZE );
87- ensure (sectrue * (r == 0 ), "munmap failed" );
88- }
89-
9085void flash_init (void ) {
9186 if (FLASH_BUFFER ) return ;
9287
@@ -126,8 +121,11 @@ void flash_init(void) {
126121 ensure (sectrue * (map != MAP_FAILED ), "mmap failed" );
127122
128123 FLASH_BUFFER = (uint8_t * )map ;
124+ }
129125
130- atexit (flash_exit );
126+ void flash_deinit (void ) {
127+ int r = munmap (FLASH_BUFFER , FLASH_SIZE );
128+ ensure (sectrue * (r == 0 ), "munmap failed" );
131129}
132130
133131secbool flash_unlock_write (void ) { return sectrue ; }
You can’t perform that action at this time.
0 commit comments