OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 12049|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " O5 V  K3 |+ X3 T' n* ~9 y
  1. [code]EDMA sample test application
    % I' G( @8 `8 ~- v( x2 B* `
  2. /*
    2 j! F! Y  d3 \" ?) U- ~1 M
  3. * edma_test.c% ]) P; W2 D, D4 t: Y( M6 @. Y
  4. *. ^  [  o$ i7 [2 w2 w. y
  5. * brief  EDMA3 Test Application3 p, u0 S% S6 f
  6. *# O/ z+ v# M; J- ?) f6 |
  7. *   This file contains EDMA3 Test code.: P; h# S! m8 u
  8. *- H& |& n" X. ~1 w9 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 q( T4 n. ^  A; M# f0 K2 c; r3 B( G5 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" @2 H: @+ }8 f+ F& M9 r, t
  11. *         TO CHANGE.
    ; e2 V, t: [; e2 @8 X3 e
  12. *
    4 @" d. q/ P  b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! l/ N# H; ^& \* G* t! d2 Q. _
  14. *8 `  d" H% p0 b5 m
  15. * This program is free software; you can redistribute it and/or
    + P; c$ V7 T7 e. R" G9 v( c+ P9 |
  16. * modify it under the terms of the GNU General Public License as/ e5 v" @  j* e7 D
  17. * published by the Free Software Foundation version 2.& P' _* F$ ^$ q- y* e2 ?
  18. *
    2 G4 F' q+ T% K# D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " _6 f5 r: T  g0 Y8 n1 g  I( {% m
  20. * kind, whether express or implied; without even the implied warranty
    ! W& S2 _5 g" c, G. W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & k! V7 r) Z3 q% D( E% g
  22. * GNU General Public License for more details.
    2 H% V% d9 A& c& ]  }2 B3 H. j! h
  23. */
    4 a! i1 U" S. Z) n% W
  24. & O/ e8 u6 `$ u
  25. #include <linux/module.h>
    5 b, K- p5 t. l' ?! g  V/ e. j
  26. #include <linux/init.h>5 Q/ N9 g( a; ^* y$ k) _) h+ h
  27. #include <linux/errno.h>
    - ~5 M! O; W9 x* }8 \" @
  28. #include <linux/types.h>
    % u7 K6 D: P1 t% M: E1 `' H
  29. #include <linux/interrupt.h>
    ( i( c, O7 E6 Z$ D1 K
  30. #include <asm/io.h>
    % y5 J* s1 N8 d2 p& p/ ]
  31. #include <linux/moduleparam.h>5 L% w+ \' [6 u5 t6 |! F: g$ P
  32. #include <linux/sysctl.h>
    0 {; x' m  A! @  w% r
  33. #include <linux/mm.h>1 O5 h, V+ G7 D, g  n
  34. #include <linux/dma-mapping.h>
    # c4 n1 r9 I7 t8 e  T# K
  35. 8 t" t- k* R3 K* R+ k  r) i
  36. #include <mach/memory.h>* K+ R7 _- i3 D" |) T- w8 [
  37. #include <mach/hardware.h>$ B6 d" p2 K' k, }
  38. #include <mach/irqs.h>, q5 M& l' [; y9 m) W. h9 I% U9 e- T# l
  39. #include <asm/hardware/edma.h>/ b/ ?0 }( F# u  _/ o

  40. 5 C( ~, d; `5 Z& t. T1 ], F
  41. #undef EDMA3_DEBUG
    ' f- W: ?5 G* I! D1 S- d( z
  42. /*#define EDMA3_DEBUG*/& W( R9 r) T9 Z; c( |8 g- ]
  43. ) r/ Q* p0 @2 A. c
  44. #ifdef EDMA3_DEBUG5 B  B/ r$ o. O' A* l0 N6 G% k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / w$ |/ I7 R' X& n% D4 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; g6 C+ R, m# b3 E4 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), q" G  v' [* Z$ A5 F* X
  48. #else$ \7 }5 z* Y( A0 J: m; ?8 d9 i9 ?4 Z
  49. #define DMA_PRINTK( x... )
    7 s$ ]/ B3 L3 }) r: v" n
  50. #define DMA_FN_IN
    9 B% V+ D# A) a2 R
  51. #define DMA_FN_OUT( i0 I  g7 R% b  W( F  M
  52. #endif
    2 Q, X) m* q, w# K

  53. ) J. {# G+ e+ @6 Y8 K8 z1 X' Y7 Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); `. L1 @4 H" Z1 \% z: h! ^4 Y
  55. #define STATIC_SHIFT                3
    # N" s: U- H4 S' m+ m
  56. #define TCINTEN_SHIFT               20+ n& B+ L2 H1 J' E
  57. #define ITCINTEN_SHIFT              21: I( }: ]: T6 ]* a  w5 V8 |
  58. #define TCCHEN_SHIFT                225 |1 R# E. p2 U! G0 a/ u! L
  59. #define ITCCHEN_SHIFT               23- N" i4 G5 @% G* R) O0 l* v" J
  60. : ?& V8 p. e% R" D/ o! c8 Q
  61. static volatile int irqraised1 = 0;
    , W! N$ _7 _2 N2 t. U
  62. static volatile int irqraised2 = 0;
    : g* ~2 y, [* |7 M4 k5 p/ `$ N) C

  63. 0 @# b2 ?% W. i8 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 h# D8 p! @3 Z5 k- H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / Y( A+ N- F8 Z; }( d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 O8 C4 [* ^' h7 O- {* m
  67. 8 _) V: w* m. ^8 @
  68. dma_addr_t dmaphyssrc1 = 0;
    : W0 l( a9 c2 h$ v; w, @% N0 Y: V! X
  69. dma_addr_t dmaphyssrc2 = 0;1 ]* y( Y% n- v0 B" P! `
  70. dma_addr_t dmaphysdest1 = 0;5 p' Z, O# a6 v) M9 _
  71. dma_addr_t dmaphysdest2 = 0;; A6 V* m8 h! L4 S: W
  72. ; C2 T; x) ?) |7 f4 x4 t
  73. char *dmabufsrc1 = NULL;
    ' x& U& D( I5 r, z# J8 y
  74. char *dmabufsrc2 = NULL;
    . t, W) a( v* m6 O* p3 S
  75. char *dmabufdest1 = NULL;6 {$ ?7 n  f. h6 B6 ]# ~
  76. char *dmabufdest2 = NULL;  N* P/ _/ s# n4 D0 |( c

  77.   n+ r% m% \2 M5 A' P! l
  78. static int acnt = 512;9 D  A5 u: K* w% J7 K
  79. static int bcnt = 8;
    6 g: J- ?, O* t2 D, ?1 H! }/ \
  80. static int ccnt = 8;
    . g  \2 Q9 \0 h% o. A6 O

  81. * R5 j. @9 u( G$ Z, x
  82. module_param(acnt, int, S_IRUGO);
    - w4 R/ y1 a4 u4 q7 n# X+ |
  83. module_param(bcnt, int, S_IRUGO);% x% L8 m$ w% o+ g. ~) h8 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 ?% E' k( e3 D5 y3 n' Y3 ?5 P
: {2 y+ G1 m4 w; I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) H+ }+ v2 D# X0 z! K4 A6 _( O# b" L( [
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 e# I% ?, V$ q3 |4 s& x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ n/ l& M& r) C' q* t- `' E

- @/ l! w) y; P! F: a" y) g8 Y9 ]- G1 \% z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-3-1 11:21 , Processed in 0.043371 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表