mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-17 21:58:33 +03:00
Compare commits
2 Commits
0.8.1
...
laforge/ca
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87c5bdf329 | ||
|
|
76c73aaa99 |
@@ -89,7 +89,7 @@
|
|||||||
/// \param condition Condition to verify.
|
/// \param condition Condition to verify.
|
||||||
#define ASSERT(condition) { \
|
#define ASSERT(condition) { \
|
||||||
if (!(condition)) { \
|
if (!(condition)) { \
|
||||||
printf("-F- ASSERT: %s %s:%d\n\r", #condition, __BASE_FILE__, __LINE__); \
|
printf_sync("-F- ASSERT: %s %s:%d\n\r", #condition, __BASE_FILE__, __LINE__); \
|
||||||
while (1); \
|
while (1); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ struct cardem_inst {
|
|||||||
const Pin pin_insert;
|
const Pin pin_insert;
|
||||||
#ifdef DETECT_VCC_BY_ADC
|
#ifdef DETECT_VCC_BY_ADC
|
||||||
uint32_t vcc_uv;
|
uint32_t vcc_uv;
|
||||||
|
uint32_t vcc_uv_last;
|
||||||
#endif
|
#endif
|
||||||
bool vcc_active;
|
bool vcc_active;
|
||||||
bool vcc_active_last;
|
bool vcc_active_last;
|
||||||
@@ -233,6 +234,7 @@ static uint16_t compute_next_timeout(struct cardem_inst *ci)
|
|||||||
* \param[in] inst_num Instance number, range 0..1 (some boards only '0' permitted) */
|
* \param[in] inst_num Instance number, range 0..1 (some boards only '0' permitted) */
|
||||||
static void usart_irq_rx(uint8_t inst_num)
|
static void usart_irq_rx(uint8_t inst_num)
|
||||||
{
|
{
|
||||||
|
OSMO_ASSERT(inst_num < ARRAY_SIZE(cardem_inst));
|
||||||
Usart *usart = get_usart_by_chan(inst_num);
|
Usart *usart = get_usart_by_chan(inst_num);
|
||||||
struct cardem_inst *ci = &cardem_inst[inst_num];
|
struct cardem_inst *ci = &cardem_inst[inst_num];
|
||||||
uint32_t csr;
|
uint32_t csr;
|
||||||
@@ -441,10 +443,14 @@ static int card_vcc_adc_init(void)
|
|||||||
|
|
||||||
static void process_vcc_adc(struct cardem_inst *ci)
|
static void process_vcc_adc(struct cardem_inst *ci)
|
||||||
{
|
{
|
||||||
if (ci->vcc_uv >= VCC_UV_THRESH_3V)
|
if (ci->vcc_uv >= VCC_UV_THRESH_3V &&
|
||||||
|
ci->vcc_uv_last < VCC_UV_THRESH_3V) {
|
||||||
ci->vcc_active = true;
|
ci->vcc_active = true;
|
||||||
else
|
} else if (ci->vcc_uv < VCC_UV_THRESH_3V &&
|
||||||
|
ci->vcc_uv_last >= VCC_UV_THRESH_3V) {
|
||||||
ci->vcc_active = false;
|
ci->vcc_active = false;
|
||||||
|
}
|
||||||
|
ci->vcc_uv_last = ci->vcc_uv;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ADC_IrqHandler(void)
|
void ADC_IrqHandler(void)
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ static osmo_panic_handler_t osmo_panic_handler = (void*)0;
|
|||||||
__attribute__ ((format (printf, 1, 0)))
|
__attribute__ ((format (printf, 1, 0)))
|
||||||
static void osmo_panic_default(const char *fmt, va_list args)
|
static void osmo_panic_default(const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
vfprintf(stderr, fmt, args);
|
vfprintf_sync(stderr, fmt, args);
|
||||||
osmo_generate_backtrace();
|
osmo_generate_backtrace();
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,20 @@
|
|||||||
#define PHONE_INT 2
|
#define PHONE_INT 2
|
||||||
#define PHONE_DATAOUT 3
|
#define PHONE_DATAOUT 3
|
||||||
|
|
||||||
|
/* stub for stdio */
|
||||||
|
signed int printf_sync(const char *pFormat, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
signed int result;
|
||||||
|
|
||||||
|
va_start(ap, pFormat);
|
||||||
|
result = vprintf(pFormat, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* stub functions required by card_emu.c
|
* stub functions required by card_emu.c
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|||||||
Reference in New Issue
Block a user