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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 N& H7 K4 D3 q% ]
  1. [code]EDMA sample test application7 _3 \4 V3 n; B: M) N8 l8 n% Q
  2. /*
    ) n/ C1 \' \3 c
  3. * edma_test.c) ?/ g4 V6 f! o* u7 F) G3 Q
  4. *
    - G) \$ G' I' @8 o- v: ?" @- l% |
  5. * brief  EDMA3 Test Application) t9 n' q: q' {& h: ?4 ], A
  6. *9 ^4 _/ W: J( ]
  7. *   This file contains EDMA3 Test code.8 |5 U4 x+ {: d5 x4 p; |
  8. *: j6 \( O. m5 r0 t3 w" i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 N7 V% B7 |  x$ ~/ Z8 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* b# g0 ?. J0 S  c4 m' P
  11. *         TO CHANGE.
    2 Z1 h0 R  d  E- I' E6 a
  12. ** |0 `0 j/ g* h' d7 X  j$ F+ }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( ~5 {0 J  E! [( o5 L7 L7 V( n
  14. *
    * I" |4 D% [; P6 s$ d- U' Q2 D1 o
  15. * This program is free software; you can redistribute it and/or
    4 U& \' F0 T+ W  X2 |
  16. * modify it under the terms of the GNU General Public License as" Y' ?7 B8 ^9 _0 s  P' e
  17. * published by the Free Software Foundation version 2.- @; |4 `( `/ |# R2 p- i
  18. *- ~+ ]5 A( \9 a1 w! U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  V. s+ k! h" `, F! g1 j/ e
  20. * kind, whether express or implied; without even the implied warranty
    & g" p1 W" v1 B/ b$ m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 s5 c8 |( L4 @1 G% }) E
  22. * GNU General Public License for more details.. t7 W9 V5 O! k9 E/ W. n
  23. */( ^1 n& D$ o8 r6 n( L

  24. 8 q) j  ^- u4 g% G( v, `! P7 n+ b
  25. #include <linux/module.h>
      O  }5 v* h: q7 R% q
  26. #include <linux/init.h># [/ J1 P8 m# g0 p# j$ P
  27. #include <linux/errno.h>! |6 ~5 \: k7 t% [3 o0 |
  28. #include <linux/types.h>
    1 E, y4 T& `* w# X9 S, Q3 w
  29. #include <linux/interrupt.h>
    2 Q) V' s4 j/ F  M) I
  30. #include <asm/io.h>
    , d9 ?: Q1 n0 _7 h+ v% A; d5 Z- a
  31. #include <linux/moduleparam.h>; c  S  {$ T: y0 p
  32. #include <linux/sysctl.h>
    * \' ?- x9 d# Q4 W0 l! O
  33. #include <linux/mm.h>
    / p9 O$ g7 p% @
  34. #include <linux/dma-mapping.h>
    ' u% n6 w0 v8 s% p2 v$ f
  35. $ w! L6 z4 ]7 F0 g+ ]
  36. #include <mach/memory.h>
    ( ^" b$ v' v6 G% p; O$ @' Y6 j) m
  37. #include <mach/hardware.h>
    1 d( u% K9 D4 [7 k7 e( f" m
  38. #include <mach/irqs.h>* b* J' K; E$ Y$ _; W) c
  39. #include <asm/hardware/edma.h>! U/ ^1 a1 h% f- N' x0 s+ _* X

  40. ; k" N1 @( L" n' B
  41. #undef EDMA3_DEBUG
    . _. g6 R# ?1 C1 ?+ S" K' _5 ]2 t3 W
  42. /*#define EDMA3_DEBUG*/
    . N$ E" s. e, }: A: b  u, k  ^# N

  43. ( e7 ]9 Y/ j4 E1 d
  44. #ifdef EDMA3_DEBUG
    & z1 F& |) g8 @* Q  Z. V2 L9 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 i9 L9 h) S3 o/ D5 d2 s5 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" _+ K( f2 }# ^& s) T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 i  x# t) z4 s4 @& ?
  48. #else
    ) H" j( s$ J  O1 b
  49. #define DMA_PRINTK( x... )
    / A7 K# o  }: F- B7 j& Y
  50. #define DMA_FN_IN
    # \* ^$ d  D. Z- A9 M
  51. #define DMA_FN_OUT. e3 Z/ {+ M! v% q# N
  52. #endif4 b9 }9 |5 ^# }/ ]9 e
  53. 2 `" |4 ^$ P0 [' o. [) L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 X5 V" M; A( `& r9 @% m  A
  55. #define STATIC_SHIFT                32 N% ^) n5 h3 N1 W( b
  56. #define TCINTEN_SHIFT               20
    : w# R8 d" Q* I- z
  57. #define ITCINTEN_SHIFT              21$ l6 d, \0 V* F& H, n
  58. #define TCCHEN_SHIFT                22
    ! Y0 `! P- U( i& c) W! `
  59. #define ITCCHEN_SHIFT               23
    0 f3 T1 E. Z8 L( L& W; ]+ n( z

  60. ! o& f1 W1 f6 V) e5 K; Y
  61. static volatile int irqraised1 = 0;/ ~7 ^* j0 r9 V
  62. static volatile int irqraised2 = 0;
    ( L, Z( f7 W6 R

  63. - \' u# G# C& s! i: c8 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" `1 P0 C0 Q; \7 z0 D# [, S9 A0 E& e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 O+ P8 C* m, x& q9 ~# z& E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 l% e4 Y/ P% H$ \; z

  67. ! l4 K9 c* x/ D  Y; B* o: s8 d
  68. dma_addr_t dmaphyssrc1 = 0;) K  C+ U0 y" ?
  69. dma_addr_t dmaphyssrc2 = 0;/ z1 d" W* }3 y& l' g/ v* w
  70. dma_addr_t dmaphysdest1 = 0;
    8 y% ?- M/ q9 r% R& V, \- e0 E
  71. dma_addr_t dmaphysdest2 = 0;3 B1 e, q" }! x

  72. % [% U8 g( h, x; T9 q* g
  73. char *dmabufsrc1 = NULL;# L7 `) ]/ b$ i7 y5 y
  74. char *dmabufsrc2 = NULL;! M" y, \' ]2 C/ {/ \0 k
  75. char *dmabufdest1 = NULL;& ?) B3 {- P) F/ ~: C1 }( ^" l
  76. char *dmabufdest2 = NULL;$ o# E7 J+ }( W) ~7 g8 I$ T
  77. 9 E3 e- S# }2 M) ]: _: `8 R4 G
  78. static int acnt = 512;
    9 c- R+ n" _  L) b
  79. static int bcnt = 8;
    8 E; ?/ }, q$ x/ M" G" Y) Q/ y" _+ i
  80. static int ccnt = 8;
    0 y9 C/ N: ~0 q7 ?) B; F. B: I
  81. 4 h8 Z3 h1 J, _" W
  82. module_param(acnt, int, S_IRUGO);
    0 L( @, e4 @: d  _
  83. module_param(bcnt, int, S_IRUGO);
    : |3 S8 U% E6 s: Q/ L9 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 q  X/ K$ u6 r, N# W! B+ c
( p! @8 z5 Y, M# e; h& H# L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- _; \' R5 V. J0 H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- I# J2 C9 N# L4 o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' d8 ]" f+ z5 x+ d4 g
5 J9 E1 L. A& u7 G

% \4 U; F+ }; v3 l9 c4 Z& B/ n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-26 09:11 , Processed in 0.040735 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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