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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . {, H+ U' J& E) K  F. u( G
  1. [code]EDMA sample test application
    2 f1 x' H( b8 Q' k! S/ z
  2. /*
    * X& _# c& y% m; W
  3. * edma_test.c
    5 k* [- w+ N2 G- z
  4. *1 a/ @7 [+ E0 d; k- T
  5. * brief  EDMA3 Test Application
    : A5 N. g" D8 l! z8 L9 ?
  6. *
    ( a) v/ R' S- M! Q
  7. *   This file contains EDMA3 Test code.
    % _4 h+ Q: i3 {! Q- y2 v- M% w
  8. *7 L6 b+ E  ?- \/ x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 J0 @( R- |5 x; h/ X+ L! `( n5 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, E; f3 P$ W% I- ~
  11. *         TO CHANGE.
    % {5 d. i! H7 `' ~. D
  12. *
    7 E' g0 X$ {, m. ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) k* X# ?8 ~3 a" ]4 S6 c
  14. *
    , A$ G. I+ b+ b2 y# f. G% A
  15. * This program is free software; you can redistribute it and/or
    / A* O3 T( W9 B' Y+ C# N% @' e
  16. * modify it under the terms of the GNU General Public License as
    5 U4 o" E" m0 a- {2 I; p* y
  17. * published by the Free Software Foundation version 2.' `5 O+ K. W1 h8 ]1 z; T* J
  18. *
    ! |7 B4 R5 N/ C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! A- t$ z9 G. C* s6 [( N
  20. * kind, whether express or implied; without even the implied warranty
    $ A8 u( S8 M6 e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% o. I# v$ T; G( i
  22. * GNU General Public License for more details.& _5 v6 O2 s1 Y5 J& m3 T% }& g
  23. */& B0 N: e  V: p: O. C9 L
  24. ) d7 ^  }% f9 o6 H+ I
  25. #include <linux/module.h>! O( S& x/ M; I, S) |% }( Y
  26. #include <linux/init.h>+ x3 s1 ?% ~. n  E- Z" `
  27. #include <linux/errno.h># ~/ h: k" b2 ~; {
  28. #include <linux/types.h>2 _* u. q- ~3 y3 c4 G5 R9 l
  29. #include <linux/interrupt.h>
    1 @4 v- G  W9 y" y+ b: b
  30. #include <asm/io.h>
    9 }. t( @$ b2 @+ U3 i1 N* s! h
  31. #include <linux/moduleparam.h>% F: V& u3 s  d5 Q! k  u
  32. #include <linux/sysctl.h>5 ~% E# c# Z0 ?1 Z! r1 D% v
  33. #include <linux/mm.h>. L* @0 k# U  d' f: a; _) N8 D
  34. #include <linux/dma-mapping.h>. ~5 N" }. U# m; }5 w
  35. 9 O" d" W* e& e  y
  36. #include <mach/memory.h>- Z7 d# {( c' U; N" u# i( J, n; c
  37. #include <mach/hardware.h>" Y( B0 E0 ^$ b# L- `
  38. #include <mach/irqs.h>, W% X7 x6 A$ v+ V& a
  39. #include <asm/hardware/edma.h>
    % Y0 q7 c: r( @, |0 e1 b, B7 C

  40. ! k/ y5 l  j$ X, c, W* Y
  41. #undef EDMA3_DEBUG# [' ]. A' U8 Z+ t. |
  42. /*#define EDMA3_DEBUG*/
    / ?" w+ S# _% V9 g1 |

  43. ) r0 x# t+ x% p+ {+ f1 @/ p" b
  44. #ifdef EDMA3_DEBUG& I8 b3 c) v9 y- k6 P; u* ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) m! E) o( f7 u8 ?1 r. D6 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 P! b& U9 [% K  p+ d0 i; J5 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) C! j7 K5 ^4 g% }1 v( p
  48. #else, B, c) ?$ s- i
  49. #define DMA_PRINTK( x... )3 U3 j% _: H% s- I. Y3 ?2 b
  50. #define DMA_FN_IN
    . p8 h( y1 N0 |5 g) H
  51. #define DMA_FN_OUT
    $ E- h& T1 V% Q
  52. #endif( r- O7 z/ K$ T2 b6 m* s, ^8 s
  53. - g, N$ X, O7 }! b: V) t! ]+ h$ {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 V8 ?: A5 v- e0 f, t/ Q, P
  55. #define STATIC_SHIFT                3
    8 k9 I/ @' P- X6 R+ n
  56. #define TCINTEN_SHIFT               20
    7 Y% B5 _7 Y- J0 S- o8 S( A
  57. #define ITCINTEN_SHIFT              21& G* k, Z8 |0 ^0 I* |( P; m9 C
  58. #define TCCHEN_SHIFT                22
    " V) K- p( Q% V, c
  59. #define ITCCHEN_SHIFT               23
    - R% p* i5 Y3 a8 H; R+ J3 m/ H

  60. 3 m6 Z8 p1 m  e
  61. static volatile int irqraised1 = 0;
    ; S& w+ v6 D6 ]* f9 X0 x# J  b6 V
  62. static volatile int irqraised2 = 0;5 o- |' W+ V: ?) m/ w6 v

  63. 4 ~* O8 Y6 V- o/ z5 X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " K. v% D/ `5 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 j% ^! i5 U5 n) w# T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % R4 M7 a3 a7 B) L4 ^. S5 o

  67. 4 e- i/ B% O) q) _8 P
  68. dma_addr_t dmaphyssrc1 = 0;
    0 T" ]5 N" V0 g/ L
  69. dma_addr_t dmaphyssrc2 = 0;
    ; E+ C# W& h" B
  70. dma_addr_t dmaphysdest1 = 0;
    ; b" _0 @- q2 S& s* b* x
  71. dma_addr_t dmaphysdest2 = 0;6 K! T' i# a) d% e4 G7 F; D# o
  72.   I3 @! t. m  t
  73. char *dmabufsrc1 = NULL;" @3 Y/ p0 L" O' @# r: H
  74. char *dmabufsrc2 = NULL;
    ; {, J; \: g/ E% d) s
  75. char *dmabufdest1 = NULL;
    0 N2 F& l% e/ O  ^' b# J0 e
  76. char *dmabufdest2 = NULL;
    # |. b! p- q; r# Q7 q: W, S$ W
  77. ' R1 Q7 {! l# \( J
  78. static int acnt = 512;
    2 }1 ^* `, C8 _  i4 Y+ t; ^) o
  79. static int bcnt = 8;% G/ T; @' \/ p' C! ?* Q& Q  ]
  80. static int ccnt = 8;0 P$ g* p/ a- V4 M- B
  81. 8 t3 Q$ H6 L8 Z# Z" `# J
  82. module_param(acnt, int, S_IRUGO);) u3 C. b" t8 B5 z! v8 _; _
  83. module_param(bcnt, int, S_IRUGO);1 v  ^$ e2 s( P# Y  ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& J; N  U3 o9 s$ }+ t- L) y
! x6 ?2 ~5 I  T% `9 b6 U/ {4 L1 @2 u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 w/ J% g6 @5 I4 D( h* ?! X" u/ d7 F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 O- g+ _5 K+ q/ \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, L: V% u/ p% D/ r- v) t  n
- |8 E. ~1 [/ `% t- @3 k! r$ I

% g) M5 g6 {  q' k7 G+ K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 14:01 , Processed in 0.039083 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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