66edcf5d03
PicoDVI in CP support 640x480 and 800x480 on Feather DVI, Pico and Pico W. 1 and 2 bit grayscale are full resolution. 8 and 16 bit color are half resolution. Memory layout is modified to give the top most 4k of ram to the second core. Its MPU is used to prevent flash access after startup. The port saved word is moved to a watchdog scratch register so that it doesn't get overwritten by other things in RAM. Right align status bar and scroll area. This normally gives a few pixels of padding on the left hand side and improves the odds it is readable in a case. Fixes #7562 Fixes c stack checking. The length was correct but the top was being set to the current stack pointer instead of the correct top. Fixes #7643 This makes Bitmap subscr raise IndexError instead of ValueError when the index arguments are wrong.
104 lines
3.8 KiB
C
104 lines
3.8 KiB
C
/*
|
|
* This file is part of the MicroPython project, http://micropython.org/
|
|
*
|
|
* The MIT License (MIT)
|
|
*
|
|
* Copyright (c) 2021 Scott Shawcroft for Adafruit Industries
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
* THE SOFTWARE.
|
|
*/
|
|
|
|
#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_RP2PIO_STATEMACHINE_H
|
|
#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_RP2PIO_STATEMACHINE_H
|
|
|
|
#include "py/obj.h"
|
|
|
|
#include "common-hal/microcontroller/Pin.h"
|
|
#include "src/rp2_common/hardware_pio/include/hardware/pio.h"
|
|
|
|
typedef struct sm_buf_info {
|
|
mp_obj_t obj;
|
|
mp_buffer_info_t info;
|
|
} sm_buf_info;
|
|
|
|
typedef struct {
|
|
mp_obj_base_t base;
|
|
uint32_t pins; // Bitmask of what pins this state machine uses.
|
|
int state_machine;
|
|
PIO pio;
|
|
const uint16_t *init;
|
|
size_t init_len;
|
|
uint32_t initial_pin_state;
|
|
uint32_t initial_pin_direction;
|
|
uint32_t pull_pin_up;
|
|
uint32_t pull_pin_down;
|
|
uint tx_dreq;
|
|
uint rx_dreq;
|
|
uint32_t actual_frequency;
|
|
pio_sm_config sm_config;
|
|
bool in;
|
|
bool out;
|
|
bool wait_for_txstall;
|
|
bool out_shift_right;
|
|
bool in_shift_right;
|
|
bool user_interruptible;
|
|
uint8_t offset;
|
|
|
|
// dma-related items
|
|
volatile int pending_buffers;
|
|
sm_buf_info current, once, loop;
|
|
int background_stride_in_bytes;
|
|
bool dma_completed, byteswap;
|
|
} rp2pio_statemachine_obj_t;
|
|
|
|
void reset_rp2pio_statemachine(void);
|
|
|
|
// Minimal internal version that only fails on pin error (not in use) or full PIO.
|
|
bool rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self,
|
|
const uint16_t *program, size_t program_len,
|
|
size_t frequency,
|
|
const uint16_t *init, size_t init_len,
|
|
const mcu_pin_obj_t *first_out_pin, uint8_t out_pin_count,
|
|
const mcu_pin_obj_t *first_in_pin, uint8_t in_pin_count,
|
|
uint32_t pull_pin_up, uint32_t pull_pin_down,
|
|
const mcu_pin_obj_t *first_set_pin, uint8_t set_pin_count,
|
|
const mcu_pin_obj_t *first_sideset_pin, uint8_t sideset_pin_count,
|
|
uint32_t initial_pin_state, uint32_t initial_pin_direction,
|
|
const mcu_pin_obj_t *jmp_pin,
|
|
uint32_t pins_we_use, bool tx_fifo, bool rx_fifo,
|
|
bool auto_pull, uint8_t pull_threshold, bool out_shift_right,
|
|
bool wait_for_txstall,
|
|
bool auto_push, uint8_t push_threshold, bool in_shift_right,
|
|
bool claim_pins,
|
|
bool interruptible,
|
|
bool sideset_enable,
|
|
int wrap_target, int wrap);
|
|
|
|
uint8_t rp2pio_statemachine_program_offset(rp2pio_statemachine_obj_t *self);
|
|
|
|
void rp2pio_statemachine_deinit(rp2pio_statemachine_obj_t *self, bool leave_pins);
|
|
void rp2pio_statemachine_dma_complete(rp2pio_statemachine_obj_t *self, int channel);
|
|
|
|
void rp2pio_statemachine_reset_ok(PIO pio, int sm);
|
|
void rp2pio_statemachine_never_reset(PIO pio, int sm);
|
|
|
|
extern const mp_obj_type_t rp2pio_statemachine_type;
|
|
|
|
#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_RP2PIO_STATEMACHINE_H
|