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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 i4 I6 i5 S  z* _! o" y4 I; P
  1. [code]EDMA sample test application
    ! g3 l# Q5 p. t3 Y8 S1 t6 h
  2. /*
    . t" c6 K% r' q' @+ H* C& z! X
  3. * edma_test.c
    6 r4 i. ~1 Z  a) g$ o. m" h
  4. *
    ! J3 y& z6 F  C# x7 w( n# y! b
  5. * brief  EDMA3 Test Application
    8 r$ ^1 h) e4 ]9 C
  6. *1 c0 k) z' r2 d9 G
  7. *   This file contains EDMA3 Test code.
      M$ G% I, d+ M. x2 a/ ?/ ?
  8. *
    . ^& c+ P0 b) T) X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # P% k( E6 F/ N) W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : u( X- B8 A. e5 I' v5 S
  11. *         TO CHANGE.7 r: r" K) s" @/ l
  12. *1 t: x6 n& D3 N2 b+ j. E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 J& e/ u" [% ?! B7 s" g  B& s
  14. *
      y1 c  V$ E7 q& k8 n1 K' a
  15. * This program is free software; you can redistribute it and/or) T" `& D; q' t/ q$ W1 z0 l
  16. * modify it under the terms of the GNU General Public License as) P/ w! X' R! d  n2 h. l3 M
  17. * published by the Free Software Foundation version 2.  Y) I4 b* p7 q- ^
  18. *& J( h. K7 H$ c, \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + x4 l4 {) u( a7 ]8 X( ~* e
  20. * kind, whether express or implied; without even the implied warranty
    $ I" V; u" F0 d/ @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 \& X" P; W: s4 P
  22. * GNU General Public License for more details.
    : t/ a1 c5 r5 u$ S% P" b
  23. */" l( k" ~- q! i3 B. o% I1 r, I7 p7 `
  24. " N# N. Q* t" }, j& Q: k3 `) n
  25. #include <linux/module.h>
    2 v  N& n/ m- V+ \4 e
  26. #include <linux/init.h>" X; i6 N! Z9 ~9 y8 w- U4 t
  27. #include <linux/errno.h>, \$ h% N4 Y( W/ U( G2 m
  28. #include <linux/types.h>3 @5 l" s6 @) W/ S- n
  29. #include <linux/interrupt.h>
    7 n* T" k  }* A4 `( c9 Z6 {
  30. #include <asm/io.h>% z! j5 h$ _3 \$ x) p
  31. #include <linux/moduleparam.h>- r' n' N# K+ }. W; e
  32. #include <linux/sysctl.h># q9 f6 }! S, |( o. e' U1 l% F$ o, x
  33. #include <linux/mm.h>: _! Y; ?6 _- {, E
  34. #include <linux/dma-mapping.h>8 H3 S7 @, o& {& G: b
  35. 2 c  I( B9 T  w$ @& }
  36. #include <mach/memory.h>
    0 n# @; h2 R0 l! S  q( }7 ^
  37. #include <mach/hardware.h>
    ; I1 S, \0 E) g2 X
  38. #include <mach/irqs.h>" L) B/ ]1 q' D3 @
  39. #include <asm/hardware/edma.h>: |( D' q7 a- E! g0 E
  40. $ j$ L6 u- i/ o+ A, j6 D
  41. #undef EDMA3_DEBUG
      z$ N% Z, l* K" f( p7 U7 g
  42. /*#define EDMA3_DEBUG*/- w/ S, M5 n- }" \3 V8 t

  43. 0 c/ k) k/ R& C9 }: S& Z
  44. #ifdef EDMA3_DEBUG3 K" s- l3 Q8 H9 e3 a6 T/ ~( Z$ x) ?5 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , H, [" h, g. e2 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 W$ @1 |2 h' S7 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * S! b! B: L; `6 M& H$ w$ t3 F! P! o
  48. #else
    ; U- l$ Q8 d5 Z1 X; T% g3 u+ X
  49. #define DMA_PRINTK( x... )
    & `6 V& H; {4 n* w
  50. #define DMA_FN_IN+ s: J4 ]5 M8 D. z! y
  51. #define DMA_FN_OUT5 f5 g4 o9 M. m) T2 }& S) G
  52. #endif6 [8 H5 R8 w) h* {

  53. ) p" q" f1 t6 d# H. ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; f: K  i2 o2 I, A$ d. X, E
  55. #define STATIC_SHIFT                3
    4 ^1 X# f* s. z0 o- u
  56. #define TCINTEN_SHIFT               20+ V- l# ^# y. V' n0 @7 i. t1 Y
  57. #define ITCINTEN_SHIFT              21
    . x( H: w1 V+ x' t% L+ Z7 d
  58. #define TCCHEN_SHIFT                22
    ; C9 j* h. V8 z! {
  59. #define ITCCHEN_SHIFT               23
    % m: k) _! W8 x* x+ j; Y# \
  60. 9 @' L: b$ g0 |2 D" o' Y
  61. static volatile int irqraised1 = 0;
    5 s8 v" l$ W5 `0 r2 K& I
  62. static volatile int irqraised2 = 0;
    * \: ^  b) p$ \. l$ R! B: I

  63. 8 h9 K: v. T: e2 g. ]3 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 F: s4 g6 P0 \+ f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ?8 L  e" K7 q8 n6 a; ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ }8 J: j/ ^$ k* ?
  67. $ h2 r) b% c( D7 m7 Y, C/ S2 G
  68. dma_addr_t dmaphyssrc1 = 0;
    7 A. [' k7 U7 R; Z
  69. dma_addr_t dmaphyssrc2 = 0;
    0 X1 M3 z" w- E! ]8 ?
  70. dma_addr_t dmaphysdest1 = 0;
    - _% h/ {9 i8 U  A' i# u* M
  71. dma_addr_t dmaphysdest2 = 0;
    7 F$ b  {4 _/ q

  72. + \. i3 D- A7 b, q6 U
  73. char *dmabufsrc1 = NULL;4 D+ w( E* q* F1 N* j
  74. char *dmabufsrc2 = NULL;4 q8 A2 d$ _4 _; O' C: t. Z8 |
  75. char *dmabufdest1 = NULL;
    4 _6 o+ Y; M. {4 M- E6 v
  76. char *dmabufdest2 = NULL;
    * |/ \& I, G: h) {

  77. 8 q5 f3 w7 z3 f( e4 Y8 c
  78. static int acnt = 512;7 h  }2 O" u* D7 v1 n
  79. static int bcnt = 8;
    + r' y; f4 O1 s; f' |
  80. static int ccnt = 8;
    1 U% \% z! D* i% U" d1 B+ x
  81. ' X! `; f* z3 r: L  j, `$ p: c
  82. module_param(acnt, int, S_IRUGO);; s/ |0 b4 w& g
  83. module_param(bcnt, int, S_IRUGO);6 O7 y. ]- F8 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 s/ s/ q& U9 n$ {
5 C6 w1 {/ j( x  J5 h! O! ]) K4 W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 s2 v5 Z" C$ q- Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ O; b! s( Z' }, M1 P& L6 e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: n' R5 y+ y2 N' K9 v) R
6 Q6 z" K2 @7 H/ z% _: {
- R% R$ d1 `( w) h; W2 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 03:58 , Processed in 0.039392 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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