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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' G0 F  q3 w3 {( p
  1. [code]EDMA sample test application' t# C4 ?! `* d% T. @$ x2 Y8 m
  2. /*
    ; y1 s( m' M/ t( E
  3. * edma_test.c. s" h6 E/ |; \* p7 H* S5 U0 u& o
  4. *
    $ u6 V$ q% c0 E! f1 X" `
  5. * brief  EDMA3 Test Application
    , B9 R/ [9 s4 e8 `% ~- C0 ^, n2 @9 f
  6. *: P, d& _0 A2 w
  7. *   This file contains EDMA3 Test code.
    9 e9 y4 M6 k4 P+ Y9 G, s
  8. *5 B0 [, E: A5 t: m" d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 Y$ f0 H: l8 I7 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' T) v' q: E% L2 M
  11. *         TO CHANGE.. d% ^. V- I' _& x0 b
  12. *; r9 H+ a* y8 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 x! U2 G% L0 E; }4 \6 o
  14. *, q5 O9 P  E. n* K8 j) g
  15. * This program is free software; you can redistribute it and/or/ o" y: C  }; W1 c* I- `9 j  u
  16. * modify it under the terms of the GNU General Public License as$ W) p8 g9 q. \/ _1 g" J  F* e
  17. * published by the Free Software Foundation version 2.
    2 N) [  f( F3 s" r9 \
  18. ** d: P9 w: C+ M4 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 l0 `9 Q% r$ ~4 }
  20. * kind, whether express or implied; without even the implied warranty
    ) c  `6 |$ d% N( B6 _1 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 K( T! y+ J- i; @% n8 m
  22. * GNU General Public License for more details.0 m7 S$ q/ a8 b6 M2 N8 c& N! k
  23. */
    * ]8 o0 d9 p" ]6 X
  24. ( p' T& \, }! z! a* G! [- t
  25. #include <linux/module.h>4 q& Y3 U" p1 f; m2 M
  26. #include <linux/init.h>
    , [( f1 o: u, o, A( ~( R
  27. #include <linux/errno.h>3 D% f8 p/ i! w+ T" g7 S
  28. #include <linux/types.h>
    , f1 d: U; n( D4 J
  29. #include <linux/interrupt.h>
    / c6 o! q) P( x  w  a! P
  30. #include <asm/io.h>' _2 }: h+ H8 A3 [
  31. #include <linux/moduleparam.h>
    , G" q6 W, N( E- m  k
  32. #include <linux/sysctl.h>+ l( J7 u! N1 I' z
  33. #include <linux/mm.h>; k- s) |) z: z+ @) d' i
  34. #include <linux/dma-mapping.h>2 i: J5 U( h- Y& {) q

  35. 9 E, I6 ^2 A( ?1 e0 X1 S/ e
  36. #include <mach/memory.h>
    ( L+ y6 \' c4 ]6 D! U
  37. #include <mach/hardware.h>
    - H5 Z6 A. B( L8 C1 G# ^) J" o8 z: A
  38. #include <mach/irqs.h># l& p7 g; m  S! o* |- G# t3 J9 ]
  39. #include <asm/hardware/edma.h>3 }: u: i4 S8 H$ {# G7 x& C
  40. / z% g) }* K0 D9 q3 H
  41. #undef EDMA3_DEBUG
    + B; r# t7 h7 d
  42. /*#define EDMA3_DEBUG*/
    7 [7 F( q( [9 G" d& L8 H
  43. " ]! Z) s. G- l/ W$ }. K
  44. #ifdef EDMA3_DEBUG& d# R8 n+ r& W  Z. O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * g- Z  o/ P9 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 Y! K2 }2 C5 C, i3 k. ~$ L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 A7 W2 V5 @' N5 a# {8 y* s
  48. #else) k8 |, ^, P1 g) r. `
  49. #define DMA_PRINTK( x... )) K7 Q+ x& n  j) f+ u. _
  50. #define DMA_FN_IN  g! C/ W/ _3 w- q3 C
  51. #define DMA_FN_OUT
    # O4 r! t$ y0 r2 |' Y
  52. #endif; V/ L! z: I3 f* Y% I. w

  53. 3 ?1 A6 w' G! A0 Y# m1 e9 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ `8 F+ M, e$ }% J* z( s
  55. #define STATIC_SHIFT                3: F4 V* O, |8 Z2 f9 w
  56. #define TCINTEN_SHIFT               201 `1 b" c9 i% e* S& |; d( Z
  57. #define ITCINTEN_SHIFT              21" u1 k. j: j2 g: [1 t& L- B
  58. #define TCCHEN_SHIFT                22
    + E: a/ x4 y4 m
  59. #define ITCCHEN_SHIFT               23
    2 u( Z# O2 q/ m) Q  X8 Y: O2 t

  60. 7 A  ?1 U& O" }2 Q' p
  61. static volatile int irqraised1 = 0;
    6 d6 x' l7 k' O1 p; a7 v" `' e/ B+ c
  62. static volatile int irqraised2 = 0;
    & [" F5 e# ?3 T# C. G

  63. 9 v2 t; c. |: I- ?* L" d  G  a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) a: H2 `5 ?- z6 F$ y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ?  E  Y* T# j9 W) o8 Z7 ~; Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; u8 o! K6 A# k0 M" V$ U

  67.   K% }# z6 V- o8 f
  68. dma_addr_t dmaphyssrc1 = 0;
    : v: E* N% d* t7 r4 n, F( d' v' v
  69. dma_addr_t dmaphyssrc2 = 0;0 v' o( X9 j/ R) l# I
  70. dma_addr_t dmaphysdest1 = 0;
    0 s. ?5 w( p- X( f8 L0 K: \4 A
  71. dma_addr_t dmaphysdest2 = 0;
    , @$ h  g6 `& t
  72. ' Z, Y1 T: c% J2 R0 N9 S9 S& M
  73. char *dmabufsrc1 = NULL;+ i3 n7 s" p( C, Y. _% d
  74. char *dmabufsrc2 = NULL;  f$ S/ E( g3 \" q! u/ N2 ^/ I
  75. char *dmabufdest1 = NULL;. d0 m" E6 s0 [, \- I
  76. char *dmabufdest2 = NULL;
    , H* O5 d1 D; O3 R0 z
  77. - _' s4 k3 s6 E0 L& ?
  78. static int acnt = 512;( Q1 M; T3 S& J, W4 F$ [
  79. static int bcnt = 8;
    ' k+ z' W9 V" W* U
  80. static int ccnt = 8;
    9 ^7 D: x% d0 P: h' S6 Y
  81.   L# ?4 g6 R. R# r; ^
  82. module_param(acnt, int, S_IRUGO);& p7 F0 n8 q% L6 K4 X- A  [
  83. module_param(bcnt, int, S_IRUGO);
    ' v- V7 j( H' ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* Q; M! H' k6 m: t/ i
+ X" M$ }9 v- g3 O9 l' I, t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, R0 z: F8 n1 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" O1 O2 ]5 @4 i+ _2 r: z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' a5 t- _+ _7 b8 i2 k
8 R( z# X* x+ r4 s
5 W9 Z6 l6 G% M/ h: }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 23:30 , Processed in 0.039783 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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