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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  n1 Y* v+ N; [/ }
  1. [code]EDMA sample test application: [6 ~7 |, }, T) }/ o. H
  2. /*7 m9 I' Z2 u/ U  c" W& o& z/ ^% g, \
  3. * edma_test.c) k+ w" V3 f6 ~4 K4 c
  4. *9 r+ R$ K& t9 F
  5. * brief  EDMA3 Test Application) h5 F7 L7 D# L: s2 I) h, D. N
  6. *
    ! l7 I! h$ k8 Q+ k1 @
  7. *   This file contains EDMA3 Test code.
    ; d& G7 Z7 j- L7 X! E
  8. *! S# T3 b5 z6 w! T8 U1 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 K! B1 m: x2 N. S( d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 v) w; i% P; Z* c" o. M& X
  11. *         TO CHANGE.
    8 h) {* f% X5 J" S" e" l2 j: p
  12. *
    : W: k# R% F" ], [) t$ n6 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# E- A# u: x7 s( o
  14. *
    0 |5 i# E  b, W& ?; w2 {
  15. * This program is free software; you can redistribute it and/or
    , e$ t. e% @& g
  16. * modify it under the terms of the GNU General Public License as
    : Y1 E7 M  q3 r  _7 e- P+ g; R2 d
  17. * published by the Free Software Foundation version 2.3 S8 y! u- K2 T" N* _  ~9 b
  18. *
    , S% d$ D# }4 \7 q' N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 j2 A& H. g; Q: ~% `* s) m
  20. * kind, whether express or implied; without even the implied warranty# e4 r$ U% X9 |0 R; J& q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 E. m7 E& N4 @/ |' ^2 d
  22. * GNU General Public License for more details.- R2 e3 c; W5 c* ~- I
  23. *// I  ~  ^$ Y2 T. ]3 N
  24. 8 g6 S) E; r% I- e" M1 d3 i
  25. #include <linux/module.h>
    , _0 t* S5 n% P0 X
  26. #include <linux/init.h>: ~# {7 k9 d" U' X, [9 x* V4 s
  27. #include <linux/errno.h>9 K* H* K! e& Y% V
  28. #include <linux/types.h>7 o2 z& S8 z  B; ^, Y7 H, G
  29. #include <linux/interrupt.h>+ b. m- Z5 _4 n$ P4 |5 m3 R4 j
  30. #include <asm/io.h>( {: d/ a7 i5 J2 ~+ E6 w
  31. #include <linux/moduleparam.h>
    4 H8 ~0 f8 Z5 Y
  32. #include <linux/sysctl.h>+ E: x5 u- p- e' U6 S2 Z0 V
  33. #include <linux/mm.h>2 j! [2 g- r# A% b
  34. #include <linux/dma-mapping.h>
    1 S% b9 s. v" S$ o, G
  35. 9 p7 J* K% c# }) c8 `& S$ v$ k4 M/ e
  36. #include <mach/memory.h>% o! e* e  w1 G, h" y
  37. #include <mach/hardware.h>$ q; v0 w2 W3 {  L( q6 |* W$ v
  38. #include <mach/irqs.h>3 ^0 k9 j$ V: R8 f
  39. #include <asm/hardware/edma.h>
    * o% j- h/ P3 G7 P

  40. + _  i( Y5 P& L
  41. #undef EDMA3_DEBUG0 I0 b+ D; f' ^! T6 v+ j/ h
  42. /*#define EDMA3_DEBUG*/
    * @+ [4 c* r; A9 h- d1 b( U

  43. 1 q: L# f. B3 y4 Q# y
  44. #ifdef EDMA3_DEBUG" x: [- s9 i: m/ `% k+ N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), Y9 S) M" k$ l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " y. K( f- K$ ]$ b7 C3 ]' g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 g  |: @/ o, ?* F" ^
  48. #else+ @2 \# o+ B5 q1 \+ a
  49. #define DMA_PRINTK( x... )
    , ^. i# `. b! R* ^! f
  50. #define DMA_FN_IN
    6 X8 f& V  m/ J) C8 q7 D! D
  51. #define DMA_FN_OUT, ^* z# C1 j' M3 {4 N& S
  52. #endif# T' V' U" H, t+ A9 p4 \
  53. 4 w3 G0 i2 u3 o# o0 ]: d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 w: C( s1 F) J& U# ]0 s
  55. #define STATIC_SHIFT                3
    / r7 \  |! B' e7 V3 p( N6 F& t) i6 _
  56. #define TCINTEN_SHIFT               20
    . H& O% C. \1 E7 F
  57. #define ITCINTEN_SHIFT              210 K& j6 K8 N  X6 n
  58. #define TCCHEN_SHIFT                229 T) k$ I# z, e( n' d, N3 y0 O8 a
  59. #define ITCCHEN_SHIFT               23
    ( w1 V/ L6 p5 s/ \9 R

  60. " b2 X% R( P: N% M2 Q& B
  61. static volatile int irqraised1 = 0;
    6 n$ d$ L! R. {
  62. static volatile int irqraised2 = 0;, o( [0 P, j1 j3 p  l

  63. $ c9 b! h( g& l7 l  [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! j  k5 Y( z6 u1 O' O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& R9 B' X( S4 i1 H: {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 @/ Y+ D( `, e

  67. + T8 [8 i* L9 e# y$ S$ s
  68. dma_addr_t dmaphyssrc1 = 0;
    0 Z9 R) T  O! B$ [
  69. dma_addr_t dmaphyssrc2 = 0;
    2 l+ t( }, J+ m& Z) o+ ^: `, I
  70. dma_addr_t dmaphysdest1 = 0;
    7 y1 i9 n7 P+ [0 n; Y
  71. dma_addr_t dmaphysdest2 = 0;, v8 I/ F1 Y+ Y& m& \" v
  72. 3 h: I' v3 |5 @4 z' F
  73. char *dmabufsrc1 = NULL;
    0 k3 `9 F1 W( s6 }2 p: ]5 w7 a
  74. char *dmabufsrc2 = NULL;
    ; Q3 l- z0 d( d' a
  75. char *dmabufdest1 = NULL;
    ; |- t* `8 m/ _7 L# u1 O; D8 f
  76. char *dmabufdest2 = NULL;
    8 o) l7 G% R. M5 T5 X

  77. 6 |5 f+ H! x1 b3 c* L, X! n
  78. static int acnt = 512;
    1 ]6 T* |' `8 \6 R/ R3 K: L) W9 {
  79. static int bcnt = 8;# ^) X7 O; m+ o. d2 J2 F8 u: g
  80. static int ccnt = 8;
    4 @, C2 f3 E$ X9 @+ Z& |

  81. - p- Q9 r1 L' D. j) U. m
  82. module_param(acnt, int, S_IRUGO);
    : L% I; S5 e/ |2 R' J
  83. module_param(bcnt, int, S_IRUGO);+ i+ o/ `6 P8 n" ]! r: H; a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" v& ~9 E1 }  [5 l
* M$ [9 b, O8 L7 S3 C+ ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 T8 g: ]  N" l" p4 P6 Q6 O* Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, G' ?; T# d! s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% P* }. Y. |! U1 m
4 S8 s8 N3 p, x0 v2 w7 @! d
6 y* L. ]- I7 J/ i- \8 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 04:39 , Processed in 0.039329 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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