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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # t, R5 r! D# F
  1. [code]EDMA sample test application
    8 s# D" O4 i/ s
  2. /*/ C, T& u& C  c  G( K  x" a
  3. * edma_test.c  f$ h; I; @  J& ~; I9 j
  4. *# R" O, w5 q# q5 W2 L' P9 g
  5. * brief  EDMA3 Test Application
    . ]  j5 i4 E5 o$ s3 G  R$ `
  6. *
    - s  z( b$ k* A1 j
  7. *   This file contains EDMA3 Test code.
    ; D  u/ V" C9 n( {
  8. *6 ]0 ?, s( \* K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 b5 b' {* n  h, s) l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 `+ v7 V7 Z% E/ q
  11. *         TO CHANGE.
    , g# N3 m( u0 {& q: H: t: P
  12. *
    " u3 J$ S* N1 P4 j" g0 x: T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / K' N& i" o& I, I
  14. *% f; [. C7 L4 h  {
  15. * This program is free software; you can redistribute it and/or) a, L; j% U! x% c! O- m& w2 w
  16. * modify it under the terms of the GNU General Public License as$ ]" n2 @3 J# V" t- s1 T$ Z: u: t
  17. * published by the Free Software Foundation version 2.
    , u# F( G0 f: m) `" c2 v
  18. *. i3 C1 Q% R. I( v; B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * {% |! X( k2 c% U- j
  20. * kind, whether express or implied; without even the implied warranty
    % w8 R6 L$ h# j/ ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * @) t- e+ }0 a
  22. * GNU General Public License for more details.* v: K  @% l3 g6 t) l$ w
  23. */0 J: V0 {6 l$ i
  24. . T: Y# k* U4 _1 b( l
  25. #include <linux/module.h>4 e9 ]9 @- a2 E& k. j
  26. #include <linux/init.h>! M, m* r; E' w& R
  27. #include <linux/errno.h>- d7 _. ^& \  e: N4 }3 \5 {
  28. #include <linux/types.h>
    : _- K  y. t% o# ?$ k
  29. #include <linux/interrupt.h>0 S& ^$ A' C; q  `
  30. #include <asm/io.h>
    7 g6 s2 ]" n' m- _1 B
  31. #include <linux/moduleparam.h>" X: \/ y/ I  p# A& R! F, `" a
  32. #include <linux/sysctl.h>
    7 i) F0 q$ n1 t( F
  33. #include <linux/mm.h>  g. V; t' R& j' j5 q$ }# x
  34. #include <linux/dma-mapping.h>
      M- w+ P& S$ m7 Z) ]5 _) S
  35. 0 e! J# ]& l1 U6 O. w9 e
  36. #include <mach/memory.h>
    " S2 g1 O) P, E$ Q/ A) b2 O% b
  37. #include <mach/hardware.h>8 j: H' ?% O* G4 y
  38. #include <mach/irqs.h>
    ! e( d) {) ~: g# Z6 j$ X
  39. #include <asm/hardware/edma.h>
    ' |7 R' G3 J0 R0 v$ ^5 i6 ]
  40. ( p3 o1 h- c1 Q: n
  41. #undef EDMA3_DEBUG$ ~7 A9 S" G; ^7 S5 X- k
  42. /*#define EDMA3_DEBUG*/
    ! N" c8 X1 e8 ?% B

  43. % P+ U. C7 `8 F" q) e
  44. #ifdef EDMA3_DEBUG
    1 r5 I# |6 [( m2 E- G! q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 m% E9 G* E% z& }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ `" C3 \! Y5 ?& m4 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 v: `* P( Q3 H6 V# Y3 ?! a
  48. #else1 Z) m& r$ {6 y+ Q0 y
  49. #define DMA_PRINTK( x... )
    3 r+ u$ |" j5 ~0 |
  50. #define DMA_FN_IN
    , }1 p( T' a0 n. |. d
  51. #define DMA_FN_OUT
    , G% T# Q& z- n' S7 y/ ~
  52. #endif  K1 `* T7 a8 F/ Z8 R4 R4 K

  53. ; g) i9 {/ ^# t9 L% l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( r: h# U! l" C
  55. #define STATIC_SHIFT                3
    6 d$ F5 }+ m/ D
  56. #define TCINTEN_SHIFT               20. C- E1 r- ~) A( X# E# Q& d0 r7 q
  57. #define ITCINTEN_SHIFT              21
    * F, s. Q+ R, R' T' y. r
  58. #define TCCHEN_SHIFT                22
    5 J3 a  @' Z" Z+ R3 N
  59. #define ITCCHEN_SHIFT               23' ^0 J, f, E: F8 L% j

  60. ) p3 j8 W+ j& f/ v7 W; S
  61. static volatile int irqraised1 = 0;# G9 l4 c* |: w2 t7 o
  62. static volatile int irqraised2 = 0;" W, k2 ~" f3 q% i2 z+ R& H
  63. $ H( [1 A( U' S$ B; C) y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 O# r/ P& t/ a8 J# E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: d) y8 V, R$ \5 [+ I, X) m- U/ j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ B* B# M1 C" l. d% l2 ~

  67. & n  x. o1 w1 w0 Q9 P) |' ^
  68. dma_addr_t dmaphyssrc1 = 0;2 a; o+ W! S! m8 p( T
  69. dma_addr_t dmaphyssrc2 = 0;
    5 m2 q' L' S  V3 C
  70. dma_addr_t dmaphysdest1 = 0;
    9 F. M% u7 K8 b# O
  71. dma_addr_t dmaphysdest2 = 0;
    / w" ~; Q3 B2 _$ f! J2 I7 w

  72. ( X" [8 `+ U( o$ N
  73. char *dmabufsrc1 = NULL;
    5 C0 d9 ?" U  e7 U( D8 h$ |2 ~
  74. char *dmabufsrc2 = NULL;
    1 \; p4 V8 g5 b0 J' O& T! C5 W) ?
  75. char *dmabufdest1 = NULL;6 [) e7 I" ~' n7 `' r# V4 p) l
  76. char *dmabufdest2 = NULL;
    # C$ d& B; {1 R' p

  77. 9 v. h1 W1 t$ z& R
  78. static int acnt = 512;
    ) U( ~# L! |& d, B
  79. static int bcnt = 8;" R4 t  V$ g) O- d. T1 f
  80. static int ccnt = 8;
    , d/ G+ M, H! U. U

  81. ; c' p: s& t% s# Z! Y* ]
  82. module_param(acnt, int, S_IRUGO);
    * l/ y* e' i' q. n- \
  83. module_param(bcnt, int, S_IRUGO);  _+ Y, d% W" ^$ y. G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 Q% S- t( D* `6 B" e+ x9 _: y  x% [
1 ~4 \# `! c0 E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( H1 q+ B  ~+ \4 r# B3 Q2 X: karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" b2 n# t# J7 V& j' L  n. @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ R! p( ?$ K1 p+ i4 m: r
& Z' I/ Q3 c" u8 R! |  X
7 D* ]- {! t, L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 01:54 , Processed in 0.050272 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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