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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 b: r2 ]# L7 }3 |* Q
  1. [code]EDMA sample test application
    ; u5 u! r5 H7 K& Y
  2. /*& U+ V& b# T& U- \% ]8 G' @5 {2 h
  3. * edma_test.c
    , M) I9 G6 J9 O* m: F
  4. *
    6 p% t1 b: I, v' i' T
  5. * brief  EDMA3 Test Application
    # F- r5 \! P+ I) s4 Q1 f
  6. *3 w5 a# H5 ~: y" X% \4 n
  7. *   This file contains EDMA3 Test code., t7 G8 U3 y2 a7 F$ g. @1 i+ x
  8. */ H. ]: T7 r- w: u8 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, V/ c0 ?  ~' @$ ^% c0 _: k* V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 t! f9 R+ M' {$ d' y
  11. *         TO CHANGE.8 H9 R) I  i3 K
  12. *. e- y1 A. a& g' R9 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; E+ W" J9 \3 l2 K% a! z2 o
  14. *
    & ~/ T$ E- J6 @8 z9 S  v; ~
  15. * This program is free software; you can redistribute it and/or
    3 p  g, C; ?/ N7 l7 G6 k& P
  16. * modify it under the terms of the GNU General Public License as; D" x& f1 o/ [% _! e0 a
  17. * published by the Free Software Foundation version 2.3 G# [' \( y: ?# E3 C+ o# k% c& k
  18. *& k( g9 V. b) L9 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( V+ A7 Q0 }. n0 P  O. c
  20. * kind, whether express or implied; without even the implied warranty
    / K) y, Y6 B. P5 U: x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 h! [! }6 q0 X
  22. * GNU General Public License for more details.
    5 q' ?; v9 z$ T' f& N) u
  23. */% u3 m6 @! g3 i2 O0 s) v

  24. 7 T; S# b" c" w+ R
  25. #include <linux/module.h>
    ! [& Q; T7 h' Z
  26. #include <linux/init.h>7 ^; n1 f1 {! Z0 _2 s
  27. #include <linux/errno.h>/ l; q3 [9 q) }$ d
  28. #include <linux/types.h>
    6 X7 Q/ K! Z% G" x2 v
  29. #include <linux/interrupt.h>
    % X' U5 a  ]8 I- p' ~8 x1 d
  30. #include <asm/io.h>
    4 |8 G. x! v3 E) m
  31. #include <linux/moduleparam.h>9 }7 z! E2 x7 C6 R7 t1 n
  32. #include <linux/sysctl.h>1 @& K4 C3 V2 ?2 g
  33. #include <linux/mm.h>
    $ F2 D# l  n, J- Z! K! L% r1 [! e
  34. #include <linux/dma-mapping.h>" V2 r6 u+ I+ N
  35. 7 ?6 o6 j; c7 C( f& ?2 J+ o% t
  36. #include <mach/memory.h># F1 \, L$ [* n# G$ D% P* _& Q1 \
  37. #include <mach/hardware.h>! S7 R* }- K3 [
  38. #include <mach/irqs.h>. P  J) \2 A0 l; s! ]) @2 r
  39. #include <asm/hardware/edma.h># @/ j% A# ]% i: h
  40. , f+ V& j& U3 |2 I
  41. #undef EDMA3_DEBUG( h: X$ Q" L4 F3 U! j0 n- H
  42. /*#define EDMA3_DEBUG*/, u" z, m4 m9 B" ~$ U  s$ V4 {9 p

  43. 9 M; X* q4 h& u' e
  44. #ifdef EDMA3_DEBUG
    6 B5 L) ~' P* n- m7 R% J2 G) F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): V' A& F8 b5 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 f6 z- _7 k# J' S7 P1 P* u7 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 b+ {) M$ d& r+ O6 i; D* D* Z
  48. #else
    . e- P* }" v, N6 h: B! s
  49. #define DMA_PRINTK( x... )
    6 ^. f5 R: p3 j
  50. #define DMA_FN_IN" |9 f: e# y  l: Q  b) q- m
  51. #define DMA_FN_OUT1 I8 e, I. X* ~4 e" \9 Q3 G
  52. #endif
    ; z: [4 [0 P$ C/ P# U0 d/ d2 @6 f
  53. ! T! F9 U: p9 q5 j# O3 O. k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' q, O: P5 S# x( }
  55. #define STATIC_SHIFT                3( y4 Q! w( u1 S$ j! I
  56. #define TCINTEN_SHIFT               20& T: E5 z8 R% M. m% G& w( f; [
  57. #define ITCINTEN_SHIFT              21; ~0 N7 Y  Y# ?- s5 E3 D6 ?: Q
  58. #define TCCHEN_SHIFT                22
    4 N0 ~7 q/ t8 C2 b% |
  59. #define ITCCHEN_SHIFT               23
    5 L. M3 m! v! d6 Q% X

  60. 4 p0 @! H; N3 m! c
  61. static volatile int irqraised1 = 0;# O+ L$ ?0 Y$ D2 }& z8 b9 d% i! j
  62. static volatile int irqraised2 = 0;
    1 P, y; P$ Z. G4 Z: e# }
  63. . R' I- Q3 F/ Q: P. H. t1 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# u8 R1 \. w# K: p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! D9 D7 s# s) ?; r2 j1 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; l& n7 k& C: w( Q0 m/ y
  67. % m0 @4 i3 _9 m- C! P
  68. dma_addr_t dmaphyssrc1 = 0;
    . j- U4 F) L( i8 w3 L" w
  69. dma_addr_t dmaphyssrc2 = 0;
    & U: b; x8 f: v
  70. dma_addr_t dmaphysdest1 = 0;
    % j, i9 B( {# F: J+ u
  71. dma_addr_t dmaphysdest2 = 0;
    8 m" O) P5 ?# p$ R5 U" |

  72. % Z% v+ \* y" o  y6 h& D; ~$ O5 w
  73. char *dmabufsrc1 = NULL;
    ! G+ t. a, \, S" U& }- z, W
  74. char *dmabufsrc2 = NULL;
    ( G# a9 o1 x( P# P# g
  75. char *dmabufdest1 = NULL;
    . _) S! ~* \+ @  @- }) d' p. s
  76. char *dmabufdest2 = NULL;. `1 _1 T0 W2 s8 ^2 A" o, n5 m
  77. 3 ~; S- E" @' }
  78. static int acnt = 512;" X- H  I! P3 Z; P3 j
  79. static int bcnt = 8;
    - J6 R- z5 k7 m4 \- C
  80. static int ccnt = 8;' k( E0 [2 S/ K7 g/ V  W7 P
  81. * B# g9 G0 L2 }* E
  82. module_param(acnt, int, S_IRUGO);" x0 a; z( Y, ]8 m
  83. module_param(bcnt, int, S_IRUGO);
    % `' w# s: m5 _$ _+ w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" Z# s# I% P6 d( f/ H# a  v& U* T8 v- @$ ?' j2 u2 O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, ^' F  E, e: D. F# k. ^
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! P# R; A) ~  \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  P/ p1 y/ [. K- j5 v

1 B5 G2 _+ B. Q9 M6 m  w( `$ e: y( N. @# g1 u9 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 07:02 , Processed in 0.038965 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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