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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: m9 X0 e; g+ n: g1 x
  1. [code]EDMA sample test application$ m1 e4 E2 g4 C* e- |- i( p" g
  2. /*
    $ d- g+ d5 e( a. M" n; q
  3. * edma_test.c
    / `# T0 Z1 k" j  @6 P# C
  4. *
    . ]7 o/ K7 z0 C0 |7 z
  5. * brief  EDMA3 Test Application
    # ]5 W  x. o4 q( A# B8 Q* K8 X
  6. *$ p4 N' q" F5 K$ b, I: m
  7. *   This file contains EDMA3 Test code.
      A7 M1 ~, |) G$ t( p) t# h
  8. *# ]6 F% N% T. t7 j2 _: t) Y; _( y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 l( ?8 M9 W. F% J. M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 u, _, A# g7 b4 F, M0 ~
  11. *         TO CHANGE.
    ; \# ]* o$ T7 \
  12. *8 M" r1 L+ o' @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. X+ m  G0 E- A1 Z  \
  14. *# e# |( t- T4 Z
  15. * This program is free software; you can redistribute it and/or9 F4 {/ }  U" C6 z
  16. * modify it under the terms of the GNU General Public License as
    1 W) M. l, }6 ^) e1 o3 D
  17. * published by the Free Software Foundation version 2.; C3 e; Q2 S3 R8 Y" G
  18. *
    # y$ g# L( U" x- c( c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  I: H9 Q& b# |: {/ d! C
  20. * kind, whether express or implied; without even the implied warranty  E, I1 q( e7 _! g( \/ o2 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 s) s9 V6 S6 z3 X
  22. * GNU General Public License for more details.' N4 u. R  Y: H, Y% V/ Y
  23. */
      }- K: Q" u: k% Y) \) Q

  24. 7 l. Q- O8 E  J8 N3 t
  25. #include <linux/module.h>2 E( Y7 |/ v. o5 Y8 K: r
  26. #include <linux/init.h>0 r  o3 R, ^' [/ A9 L* I% u
  27. #include <linux/errno.h>' m; d+ H- H* |3 W( _
  28. #include <linux/types.h>
    + T. r8 q/ y+ J, c
  29. #include <linux/interrupt.h>
    2 k! U9 y! X9 I# R- k1 O
  30. #include <asm/io.h>
    1 O1 q: s+ f9 A" }/ j6 N) `
  31. #include <linux/moduleparam.h>
    4 {6 [7 U1 I7 l" h7 A
  32. #include <linux/sysctl.h>
    8 T$ X' S; Z  t8 Q' {  x& z; E
  33. #include <linux/mm.h>
    + c% ]% Q& ~- x. F
  34. #include <linux/dma-mapping.h>
    1 k6 ?5 h6 c8 Y1 m

  35.   T7 b- C* X/ i$ J; ^, R' Z, L
  36. #include <mach/memory.h>. z  Y! }; N. I* Y" F" N& L3 M
  37. #include <mach/hardware.h>
    " q; k% W' _: j, d: C
  38. #include <mach/irqs.h>" d! K' K) k6 K& n5 m3 C
  39. #include <asm/hardware/edma.h># n8 t7 a: \7 y3 I7 M

  40. % J. q, {2 b0 j! }
  41. #undef EDMA3_DEBUG( x/ q* m& I) \# w) _& g
  42. /*#define EDMA3_DEBUG*/( y3 L4 }4 ?% t4 {# z1 ~: C
  43. 6 `$ |5 Z, H$ T2 `, k
  44. #ifdef EDMA3_DEBUG2 S3 o7 z. ~4 t7 }* ~- g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 t0 k; i% R( v! ~! `/ X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , j% F9 Z- c) [0 f& u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 _* Q, e5 D8 h
  48. #else9 H2 w" ?# V. U* U/ l3 @, m3 }: V+ T- E
  49. #define DMA_PRINTK( x... ): w) I& y0 F- \* c: t
  50. #define DMA_FN_IN
    9 b$ M% c. X  {
  51. #define DMA_FN_OUT
    + t8 _* a: d9 T6 S+ s
  52. #endif/ D6 ^7 ?7 n* @; G9 H6 H  p' b
  53.   p- T$ X" g5 n1 J; ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 k+ D+ f7 K6 K5 e! c2 r0 J
  55. #define STATIC_SHIFT                3& w' y- T/ t/ N7 D' M( p; X
  56. #define TCINTEN_SHIFT               20' X* m- ^" L# x8 l* W+ y6 J
  57. #define ITCINTEN_SHIFT              219 T% U$ L- O1 N8 y8 D2 W( k
  58. #define TCCHEN_SHIFT                22
    ) O, M; R* u" T& N
  59. #define ITCCHEN_SHIFT               23
    1 G; E' t) t' i0 t  `0 n( s

  60. / a9 \+ I+ a$ w8 @* u! T$ q$ t
  61. static volatile int irqraised1 = 0;
    1 A9 U' [$ i% o/ i
  62. static volatile int irqraised2 = 0;
    9 B  C2 I% d  E6 I  z( R
  63. 8 j/ O4 Z/ H  ?: G' ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 l- _; q8 |0 S& B6 V& c; v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 r0 h9 u2 }5 [5 ]1 T0 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : g' E7 x; q$ k( l! J
  67. , Q( X. h3 z$ h! V% d
  68. dma_addr_t dmaphyssrc1 = 0;
    : I2 z1 s5 a9 o+ M" k
  69. dma_addr_t dmaphyssrc2 = 0;9 [$ h2 `8 u" l! J+ E
  70. dma_addr_t dmaphysdest1 = 0;* @8 Z4 O  g- B* C5 o0 p
  71. dma_addr_t dmaphysdest2 = 0;+ B5 c6 o7 d, K+ s
  72. - k! b0 P4 ]0 Q/ _
  73. char *dmabufsrc1 = NULL;
    ; w" H+ n. [- l- p# g( I' t
  74. char *dmabufsrc2 = NULL;1 `4 o* s( C! a/ b% r2 B1 z9 K
  75. char *dmabufdest1 = NULL;+ s" x; ]% i+ S- ]  f
  76. char *dmabufdest2 = NULL;
    + [5 V% h$ _1 Y  C
  77. ) c0 f( W+ Y8 ?* g
  78. static int acnt = 512;
    - E5 e/ O+ q* S
  79. static int bcnt = 8;
    * l- w: E9 Q  {) O$ F2 B
  80. static int ccnt = 8;
    ; b, _* Y9 E% D( ]& b
  81. 3 q/ }. n4 S: F' \, a
  82. module_param(acnt, int, S_IRUGO);4 f8 _- m& N9 Z
  83. module_param(bcnt, int, S_IRUGO);
    7 F  h& A  k$ w; H- s- O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% j6 d- v: v) m" D2 Q* m4 i% g

% y* ~% j' Y+ o6 y1 E4 G: |1 X$ S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 p! y5 r" ]2 w: x: Z/ marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 O7 h% r; X' E4 B6 V3 t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! y# g9 h& Q; ~1 n7 U. A) A# j, n+ b% \- I; c
  u" Y# C' H* m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-9 18:32 , Processed in 0.040811 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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