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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) P# w- t1 s/ K# d+ |  G
  1. [code]EDMA sample test application
    5 _7 v) S3 I3 e* H% }
  2. /*
    - D" R, q* S/ p  n
  3. * edma_test.c
    + h( t% _# l' P, |' X! i8 ]
  4. *  i) v' G8 g8 V, ?6 b# ?
  5. * brief  EDMA3 Test Application
    $ l) i( H( X5 F
  6. *
    - |7 B' U! j9 G5 Z  _+ P
  7. *   This file contains EDMA3 Test code.$ d6 h, q7 S) t
  8. *
    3 ?' l) L2 i) P! U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, W; Y! @2 C( j2 l8 ~# h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. K8 F. ]/ t  y/ Y, i* q
  11. *         TO CHANGE.
    4 s5 _% q1 U/ k5 L+ F2 d
  12. ** w. r( E$ B; ]2 M* U3 }' a- d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      b4 o) M" k. S( H* P+ n
  14. *- V" G! v9 p; h1 D/ @6 R
  15. * This program is free software; you can redistribute it and/or  e5 {2 O7 M. Q1 B" d) y1 _
  16. * modify it under the terms of the GNU General Public License as; E4 f+ R! ^  v
  17. * published by the Free Software Foundation version 2.' I( Q; L1 [1 p+ [" ?
  18. *3 ]# c9 h8 F/ k) F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ |: n9 d* |( w3 w* i9 F  h
  20. * kind, whether express or implied; without even the implied warranty
    ! v5 {; v* h0 S: U) X5 ]* @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 F8 s" t! j4 t- O0 S8 q- {
  22. * GNU General Public License for more details.
    # u" z" g2 [; V! q
  23. */
    1 k$ r5 n1 r$ A# e: O* g

  24. 0 @7 i. K/ W8 V  B
  25. #include <linux/module.h>
    & Y$ z2 f2 R+ ?
  26. #include <linux/init.h>
    $ r* H' L3 h# u3 O) ?2 E5 p% G
  27. #include <linux/errno.h>
    5 X, H, W2 [! @  Z
  28. #include <linux/types.h>
    . u: S+ z6 a7 E6 ]
  29. #include <linux/interrupt.h>. H. c9 J6 \0 x5 B( L8 r. e( ^
  30. #include <asm/io.h>
    . @7 t! i" O1 l
  31. #include <linux/moduleparam.h>
    , Y9 [. l2 M- O9 _
  32. #include <linux/sysctl.h>4 [: A4 b3 _, f. t( K. M& t
  33. #include <linux/mm.h>
    . N, D1 G) |( O2 h1 C! H& ?
  34. #include <linux/dma-mapping.h>' V, `, u% b2 {1 y& G6 S  Q. {

  35. ( p+ l0 @! y" [6 V* T5 p0 `
  36. #include <mach/memory.h>
    ! o+ Z/ n& c2 q$ U& r* B) u) g; N
  37. #include <mach/hardware.h>
    + [. D9 z: t6 D% Q7 I9 C
  38. #include <mach/irqs.h>
    ! n8 F8 s: ^. @& {! X
  39. #include <asm/hardware/edma.h>
    ( l( w0 D1 l/ [: ~5 U5 n: p
  40. / _; \; }$ P! g. I/ ~
  41. #undef EDMA3_DEBUG
    4 M5 B. n: }/ @! S" l) f
  42. /*#define EDMA3_DEBUG*/
    : @5 ~2 D) F" [/ `2 ~3 \- g
  43. ) ?. P# p3 p2 A6 u% h, f# A
  44. #ifdef EDMA3_DEBUG
    ; x3 F8 `9 d" |; M) O- _# u7 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ F) [. y8 Q, ]. n" X2 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): P5 p4 X0 k8 F+ V) T9 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); T8 Z& m7 C& ]; S% V* G# d
  48. #else
    $ }0 O! g2 t. H4 H/ L& T
  49. #define DMA_PRINTK( x... )9 ?  M  k9 X8 f8 q
  50. #define DMA_FN_IN
    # }7 o# T& v; F) P
  51. #define DMA_FN_OUT
    0 o% l. G$ {) M' ^' ?; Z
  52. #endif
    5 v% A. V/ j0 C; E& ]' y! [+ P# ?. C

  53. ; n# z3 J+ d5 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( U+ J9 t" @; G5 `. I, l
  55. #define STATIC_SHIFT                32 s3 n+ R$ Q# Z; U  L6 H
  56. #define TCINTEN_SHIFT               20* h  Z& d/ F& N+ N2 F! r* g) ~
  57. #define ITCINTEN_SHIFT              21
    8 T  N' V& `3 f2 O$ l
  58. #define TCCHEN_SHIFT                22
    , U7 R" r1 F4 B+ U
  59. #define ITCCHEN_SHIFT               23/ P7 @2 m6 y/ T: J& G& r& y

  60. ; [- a6 \. Y" _8 G+ a+ j& l
  61. static volatile int irqraised1 = 0;# O+ \, v) R4 C
  62. static volatile int irqraised2 = 0;9 J( q" _  ]2 r( X

  63.   {9 K$ N5 e7 u+ |" Q! [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 K/ d7 g2 n9 v& I: Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( w: a* {& E  |! X  p6 o/ m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / A+ U1 W. r% F. D: x5 M& H9 i9 J
  67. ) ], ^4 a* `6 l5 r4 k7 O
  68. dma_addr_t dmaphyssrc1 = 0;
    + D! Z2 M; n5 X( p
  69. dma_addr_t dmaphyssrc2 = 0;
    9 E3 V# K6 K% ]$ x/ y. z  g& s2 ^  y
  70. dma_addr_t dmaphysdest1 = 0;
    ' v1 w3 o0 l* ?* M6 t! h
  71. dma_addr_t dmaphysdest2 = 0;: n, o4 [. }0 c4 o2 k
  72. 2 J0 A9 z6 I7 y& V
  73. char *dmabufsrc1 = NULL;
    ; W$ s/ j% E2 |5 z1 ]% d
  74. char *dmabufsrc2 = NULL;
    $ ?  C/ t, ~( v! Z7 ^" |+ e
  75. char *dmabufdest1 = NULL;
    4 _) v, `0 X  {) |/ x8 I$ k9 t, x
  76. char *dmabufdest2 = NULL;* D. I$ g6 |- G# f

  77. 3 V$ D! m0 i+ g7 k2 F5 A0 _) V& ~* n
  78. static int acnt = 512;
    0 Z; t! B3 t' W& z2 ?3 m7 ~, \
  79. static int bcnt = 8;
    $ w" H9 V/ D$ [5 D: x
  80. static int ccnt = 8;
    8 V( o1 V2 J; o
  81. ! o# \+ h3 d9 {- L# t) y8 g- c* H1 ]
  82. module_param(acnt, int, S_IRUGO);* ]+ M3 {, r. `& f
  83. module_param(bcnt, int, S_IRUGO);" m. g! u$ Q* m  M# `# l  H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, R% f1 e' I8 r6 @3 J: c
. B9 U& C9 p- ]* J! S5 f; r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 Q# N/ ?" D' d* a7 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' u& p7 _% r) m6 I& o; r- d3 s7 L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 S# u5 y, `: C0 E9 X" j7 a* d# {# C( X" H& d/ Z  R
0 r8 x+ i, Q7 y+ G$ s5 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-16 13:43 , Processed in 0.041074 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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