OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 Y. R" S* z: [1 f5 j* c
  1. [code]EDMA sample test application
    0 b5 U; K: V( L; K/ ]
  2. /*6 b7 B# k' d$ t- L
  3. * edma_test.c
    ' |# _) q9 Z2 p3 p& C9 s: F, g
  4. *
    ' W- K( i) B$ w- @" T/ ^2 C/ }
  5. * brief  EDMA3 Test Application& p; C$ D: n5 n2 y
  6. *9 t& u" C. s" O3 A! X% }/ h0 G' S: K2 r; z
  7. *   This file contains EDMA3 Test code.: V- g) k- T5 o2 Q
  8. *
    . D9 @  s; N- l5 z$ h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. U: r5 }$ c0 R1 u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 Z0 m8 w  Y/ r7 g/ E
  11. *         TO CHANGE.2 C; [& o0 b& z& t
  12. *
    - }+ s* Y* N; O. S- @3 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! H6 y; o% b( B( [3 g
  14. *
    2 }5 P4 P" v  W, v' j% ~
  15. * This program is free software; you can redistribute it and/or
    2 K* Q; p7 A4 N9 ], g
  16. * modify it under the terms of the GNU General Public License as
      o9 N) t4 P7 E& x( E2 c
  17. * published by the Free Software Foundation version 2.9 `+ c; B! X* g! a' J5 ~0 g
  18. *3 f# a! r0 Q" ?9 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . y4 r7 W7 j9 B7 v" I. w6 n
  20. * kind, whether express or implied; without even the implied warranty- a8 r9 m+ ]! ?. a- [" L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 F1 }' d& O- i- P4 r: {6 E- {
  22. * GNU General Public License for more details.
    ! w$ P/ h' r/ S# y3 S1 @* E
  23. */
    # o) Q1 H, D! y+ ^

  24. 8 D9 z  K5 q: Y( ]; r
  25. #include <linux/module.h>0 v3 b9 r2 }$ ~4 N
  26. #include <linux/init.h>$ h. N  w7 A  ^- K. ~! L
  27. #include <linux/errno.h>
    $ @, X# i4 O6 o% Y9 D# U( S( b/ u$ S
  28. #include <linux/types.h>
    , |# E2 F) X7 M: }1 U) X2 P
  29. #include <linux/interrupt.h>! m2 @! `# ]1 C; [+ @9 j: f
  30. #include <asm/io.h>
    5 H3 P% B: F% a- j0 H% w& O
  31. #include <linux/moduleparam.h>  A2 G0 d" j1 ~6 M3 o, ]1 w
  32. #include <linux/sysctl.h>) O1 h8 Z2 A9 y0 e0 W
  33. #include <linux/mm.h>0 s( q" b) n$ D" n
  34. #include <linux/dma-mapping.h>
    3 B0 \  ]; X' }: F9 T9 a

  35. 7 B& |) o5 ~# Y$ S; s! s
  36. #include <mach/memory.h>
    1 `+ m& a% K' ~) d% ?
  37. #include <mach/hardware.h>% a% T  P- P) h. m  v' n! a
  38. #include <mach/irqs.h>
    4 \* L6 `" L6 y5 Y
  39. #include <asm/hardware/edma.h>4 c% g9 D4 p$ }' G8 k# m8 ]4 `
  40. $ R# r1 x  B; E. I- k: m! `3 o1 Q
  41. #undef EDMA3_DEBUG
    ; h' x) J1 s7 I) a1 Q8 L8 X
  42. /*#define EDMA3_DEBUG*/
    8 R! [. }2 }* D2 g
  43. # d9 h# b4 L8 ~% b' u, e
  44. #ifdef EDMA3_DEBUG
    * o1 b4 w( q) n* K, c. B3 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 g- o4 ?" a9 Q* R6 m; c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 k0 X0 C5 B9 C- r% e9 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ]' O6 I8 g" W1 B
  48. #else
    & B- b0 X, H; G# y
  49. #define DMA_PRINTK( x... )2 f5 m0 d7 s! \
  50. #define DMA_FN_IN
    ) v8 _: q6 J0 u. ?( X
  51. #define DMA_FN_OUT
    / _9 ]+ \! M. l; A! j
  52. #endif" ]7 A' O( B% p; R  E& Z) c# [8 K

  53. & @- m8 Y1 p5 V. `8 ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 h$ \' x6 \. _5 ^
  55. #define STATIC_SHIFT                3
    8 g- }9 l9 N8 Y% W) j& F/ k
  56. #define TCINTEN_SHIFT               205 p* ?( T% Y% j' U1 U
  57. #define ITCINTEN_SHIFT              21' J/ o. O. X: G
  58. #define TCCHEN_SHIFT                22+ L; `: M' d3 i; m  B) {
  59. #define ITCCHEN_SHIFT               23
    & x0 ^# G( c( ]& B/ n
  60. % {7 ^0 f2 L+ ~9 S8 V& ]
  61. static volatile int irqraised1 = 0;
    5 P: V: U0 Z: H' l  O! c/ o- J( n
  62. static volatile int irqraised2 = 0;" ^7 G" y5 N! v/ N' s2 \& x" M
  63. : ~8 R$ X; L, e$ Z, M" \' G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & K; p5 W- T  \- @6 l# Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ N; @& R% O3 Z9 ^$ i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# u/ ]/ L1 I3 a# |

  67. & n" i9 r4 j& V  |1 o( O. C
  68. dma_addr_t dmaphyssrc1 = 0;9 W  P! A9 g6 s% _, ]( s
  69. dma_addr_t dmaphyssrc2 = 0;
    3 ]3 m' f( k1 ^& y' B: h
  70. dma_addr_t dmaphysdest1 = 0;; J: [( u; T2 i3 }. m
  71. dma_addr_t dmaphysdest2 = 0;4 }. ]1 T$ k4 c

  72. / i3 |/ Q: _" Z* \  N, g! }
  73. char *dmabufsrc1 = NULL;! ^5 ^$ `3 A7 c. K& G2 V, T) \
  74. char *dmabufsrc2 = NULL;+ N3 z- D& M1 e& J3 W  U2 r
  75. char *dmabufdest1 = NULL;
    ' G0 @. ^& a  r1 }; x$ O% p8 l" |
  76. char *dmabufdest2 = NULL;4 R7 A! O" z! t7 m4 A

  77. 5 y) k- F9 J1 R, \; a) |
  78. static int acnt = 512;
    1 A2 Q. u( u9 i, @
  79. static int bcnt = 8;& C) F4 X; `0 y' a
  80. static int ccnt = 8;' v, u, ^- X' y; @% `

  81. 2 L/ V  I- K- l6 L
  82. module_param(acnt, int, S_IRUGO);
    4 x1 \- a4 e5 r$ K! Z1 y8 C6 x# L- [
  83. module_param(bcnt, int, S_IRUGO);
    / z, }+ C: W. ^5 O: J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 H6 N& ^2 v- N$ f

3 k3 K( r$ e: B) o" T; |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ F! p: B, L* H8 I: carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 b5 U; q$ ^. E7 J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% @3 w3 o" }$ |
5 X, ~- I7 f* l4 E
$ s) K$ _  F3 A/ ~6 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 03:43 , Processed in 0.038619 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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