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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! e- `3 t1 H6 q1 R
  1. [code]EDMA sample test application
    2 k* f" A5 |: Y% F& B! \! q
  2. /*
    ) l* ]8 E) e( m0 m' h
  3. * edma_test.c
    1 ]' k! _% j. {% Q1 n8 ~
  4. *1 v$ {# [6 w2 Z5 [' f
  5. * brief  EDMA3 Test Application
    9 @+ \" T$ A5 E3 q: x1 P
  6. *# {2 P( G) |4 c7 e3 n3 p* k/ S6 q6 j
  7. *   This file contains EDMA3 Test code.6 Q# r3 H6 {# ~
  8. *; @' o6 j. R) B; G/ S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 {% x5 ^4 @2 X8 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      w0 K- t0 S6 q7 g& ]; [* B
  11. *         TO CHANGE.! @# e! \6 ~8 K2 C2 c
  12. *
    1 Z* V6 b2 K5 n+ @4 l% B9 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, Z  n7 f% B6 `( G
  14. *; R9 z) ~1 a3 A% Y; s  \
  15. * This program is free software; you can redistribute it and/or2 o% \& i" L, A+ u
  16. * modify it under the terms of the GNU General Public License as8 N; U- l7 e2 ?9 y* C: L! B
  17. * published by the Free Software Foundation version 2.
    & r: u5 j4 y* p4 E
  18. *! D2 ?# ~; {  N! U+ A7 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, V  g5 P+ d! U) E" U2 @
  20. * kind, whether express or implied; without even the implied warranty
    * s0 X$ t2 Z8 K: R6 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 I4 f8 i5 ~: N9 i
  22. * GNU General Public License for more details." Y' f+ z1 l/ A4 f' x" G3 p2 l
  23. */4 Z) u& n9 I  y9 t

  24. $ s( v* N2 v% e3 A' H! d; y
  25. #include <linux/module.h>
    5 N+ I8 w5 d4 m* N
  26. #include <linux/init.h>
    4 f! S- ?5 G* B; W: V  J  L
  27. #include <linux/errno.h>
    9 h) N% @% l+ |
  28. #include <linux/types.h>
    # k! B+ R; `7 g, }- W5 u7 s
  29. #include <linux/interrupt.h>) W) v" r: a2 g0 `3 A, R
  30. #include <asm/io.h>
    0 B+ ?, e/ t8 K( K% J7 F% S3 c; V
  31. #include <linux/moduleparam.h>
    % [1 m" e, S: I( |: o6 O  C1 o) M. @
  32. #include <linux/sysctl.h>' u+ ~# ^2 Y5 U" K9 _
  33. #include <linux/mm.h>- J9 `* W" w, Q2 d
  34. #include <linux/dma-mapping.h>% J1 w  y) X( ~8 \2 O

  35. + G, P$ Y4 `5 A7 W( N7 n) F
  36. #include <mach/memory.h>
    # w- n$ {8 G4 j: ~- N8 F
  37. #include <mach/hardware.h>
    - F4 R6 D5 C$ E
  38. #include <mach/irqs.h>
    8 v( |$ B. T7 c& w6 a7 i* N6 c
  39. #include <asm/hardware/edma.h>
    % y" ?8 ^$ H' q9 {' ~

  40. " J  h9 j- y7 ]5 X
  41. #undef EDMA3_DEBUG
    2 |: z# Y! q* n
  42. /*#define EDMA3_DEBUG*/  T) r1 O0 O" c* i, X( y8 [

  43. 7 e) i; b1 i! \9 P( {: V( e
  44. #ifdef EDMA3_DEBUG/ [: Y" ~8 S  Y; {. h0 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 d/ l2 H  v0 @2 r" y# d$ W5 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 l9 s; u; V6 D+ y2 ^# q" Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* R. r3 {9 C5 X" e
  48. #else+ K* {* a: h* i3 ~, U, Y. Y3 p
  49. #define DMA_PRINTK( x... )& u! z! d# ^2 z- S2 u; e1 {
  50. #define DMA_FN_IN& O/ s5 x' ^! O  [" R
  51. #define DMA_FN_OUT, g) K* A/ q$ p7 e5 s8 s8 L
  52. #endif6 _% U/ Y+ o3 |* j8 f1 f
  53. ; V4 o; [8 S8 T- P6 t6 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 W) ]( r# {' A# Y! r6 K  |  k
  55. #define STATIC_SHIFT                3
    * @% N+ E6 [; D
  56. #define TCINTEN_SHIFT               20
    % ]0 O  i1 \( z' o: A" ~, P
  57. #define ITCINTEN_SHIFT              21- C* ?7 D0 ^6 F. ~4 \* C
  58. #define TCCHEN_SHIFT                22+ I! p6 D7 `( W
  59. #define ITCCHEN_SHIFT               23
    # x( S+ \; Q* w; V2 {" [
  60. $ U& t6 d# e9 S0 A* I
  61. static volatile int irqraised1 = 0;
    6 \8 P0 Y+ t" w; E- y  W# y, ]) d
  62. static volatile int irqraised2 = 0;
    & \) {' G* r- n  j# R2 t2 ^: w
  63. 0 u' L5 f) w/ j& i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ p4 d: |6 P8 J9 k1 d/ a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 K3 n: O0 n( {$ O/ N5 t, |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 I, a% d$ P3 p; x
  67. " e4 d8 A0 ]7 e, g" T; G
  68. dma_addr_t dmaphyssrc1 = 0;. {+ \* E* g( s0 t- J7 P1 E
  69. dma_addr_t dmaphyssrc2 = 0;
    % @; D* ~% W/ T# e3 \
  70. dma_addr_t dmaphysdest1 = 0;
    : a9 @! Q' v4 o4 c' a+ E
  71. dma_addr_t dmaphysdest2 = 0;
      o* l- K6 p, T( w% e' {& G$ o$ N
  72. 5 Y2 f. u3 r  o. t( m# G# |
  73. char *dmabufsrc1 = NULL;
    8 p! c. a  z: Q. T0 T
  74. char *dmabufsrc2 = NULL;  z: H) l) i5 \6 @
  75. char *dmabufdest1 = NULL;. ?+ ?0 p& h2 c8 ^' b3 x
  76. char *dmabufdest2 = NULL;
    . R, l. r8 h4 x( A
  77. & h1 M: x$ ~" g6 i
  78. static int acnt = 512;
    ) c( B( `3 d7 f5 m) W* j: Y
  79. static int bcnt = 8;
    4 F' Y  X, G3 G' O
  80. static int ccnt = 8;+ B7 A2 \1 c1 u9 j% ^

  81. ' d7 s, }! Q' |3 I7 `0 ~8 n
  82. module_param(acnt, int, S_IRUGO);" t* E9 f& T" \  |, ^9 O
  83. module_param(bcnt, int, S_IRUGO);1 [' z; Y3 q4 p; h. g& j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) p% B* D' h. m4 G  M

" }5 s4 |- O6 ]5 ?9 p4 B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 t/ O& d( Q+ @3 S1 f- S+ _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ q# D; `- X4 S- y0 k6 G1 c0 q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- `4 F6 n# f. K- d6 ]
: M6 q+ Q9 [1 B$ Z# K% r. k# s, F; [
* S) ~$ @1 E* t, R7 n  \3 R! P* f; q# L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-26 22:40 , Processed in 0.063586 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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