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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 I" k$ j& O9 l. f$ S0 [& L
  1. [code]EDMA sample test application
    ' c6 |4 p+ Q$ n  _1 G
  2. /*
    ) j' W' @( H$ P8 O8 f
  3. * edma_test.c
    . A8 y/ m6 Y. y
  4. *- w, t" W2 z" k4 f; U" \
  5. * brief  EDMA3 Test Application( \8 `- B  @) U7 U' U: H
  6. *) T+ o( x. x$ f
  7. *   This file contains EDMA3 Test code.4 B- |  d5 L, c( W0 }/ o
  8. *
    . A4 j- g1 O1 ?2 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 Z5 l9 C1 _( h. ]6 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      c/ w  R/ L  ]$ u7 t& z7 h. u% I& V( K2 j
  11. *         TO CHANGE./ ~1 y) ]& S) X: F0 l7 i
  12. *- u8 H, ~  C- K$ q$ F( C9 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( ~$ t, e3 u8 J
  14. *. }* o) @7 ]. U  Z
  15. * This program is free software; you can redistribute it and/or
    1 L8 @8 |) b) p* T! r
  16. * modify it under the terms of the GNU General Public License as+ V4 N( U) t- C2 `) K' Q
  17. * published by the Free Software Foundation version 2.
    ; ]8 g5 A( g' `8 }" J2 f1 }
  18. *7 }5 k/ q/ l7 E. @: \$ z7 Q8 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, X, ?" V2 E, r. H1 B& Q4 c+ q5 i
  20. * kind, whether express or implied; without even the implied warranty6 n; h9 ?; a( l, N1 u8 D6 L+ R( @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# B+ `2 K5 n* ?9 t( G
  22. * GNU General Public License for more details.7 k3 P  F! ^9 ], T
  23. */% X  i& A* ?- E8 F6 I7 j
  24. 4 _! ^8 B8 C- m. x* A
  25. #include <linux/module.h>
    ) B7 m/ Q* o9 t* S- H
  26. #include <linux/init.h>
    ( s8 M% m  a7 k3 ~2 |" o6 ~
  27. #include <linux/errno.h>
    - ^2 o; g" l1 B3 r: Q: a
  28. #include <linux/types.h>. D7 H! E) ~- n/ x/ m# Q0 D
  29. #include <linux/interrupt.h>0 J+ ?% y# m3 F/ o5 U; |' z3 C
  30. #include <asm/io.h>2 V9 B$ w3 D- g8 l
  31. #include <linux/moduleparam.h>3 U" ], W: m4 X8 j( j% J5 T2 [# J; M
  32. #include <linux/sysctl.h>9 q- f( }- _/ j# [! \; n; u
  33. #include <linux/mm.h>% g1 Z$ B2 t+ j" d( N
  34. #include <linux/dma-mapping.h>( |3 ~; x5 f# N; L8 X

  35. / b- T1 n) R% @- b  ~
  36. #include <mach/memory.h>+ P3 H0 X3 r( q! e
  37. #include <mach/hardware.h>6 n# I2 T- j. p
  38. #include <mach/irqs.h>$ B) }; q- m' ?! ~3 W4 o- M
  39. #include <asm/hardware/edma.h>2 T: d: S+ k! l* i1 V- [- `
  40. % E0 I; h1 y+ n$ B( Q% ~! a  w
  41. #undef EDMA3_DEBUG' \, i! t3 {( e4 Q- k0 p- T$ m9 A
  42. /*#define EDMA3_DEBUG*/
    4 K, T7 n$ W1 u3 H1 f  {

  43. ! ~2 `2 X2 z, e: V7 _# x/ H
  44. #ifdef EDMA3_DEBUG. W, U0 w5 m: H, X2 L! y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % l+ H1 c' \0 G1 |5 X& Q* a' U9 K/ [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) J" v5 J9 f; d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- ^$ e! t  Y4 X0 _% w' T8 }- a
  48. #else% U- [" T. U9 Q1 u( B& U
  49. #define DMA_PRINTK( x... )) u* v3 E) a; {; L7 g9 t
  50. #define DMA_FN_IN6 @! k) p# W% t' r- b# w
  51. #define DMA_FN_OUT
    / z/ S4 X0 m, o# I8 U. {: q9 W
  52. #endif
    / Z6 Y+ y( I1 y" F

  53. ' ~% R$ c5 T. M9 F' l8 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- }  f& f/ m% N8 E0 K, z" w' l
  55. #define STATIC_SHIFT                3
    2 K+ _* F+ P# z" d
  56. #define TCINTEN_SHIFT               20; @, h7 N) s+ q: I: X
  57. #define ITCINTEN_SHIFT              21
    / A9 n4 I7 N. y, F! D% x& ~
  58. #define TCCHEN_SHIFT                22- A0 T$ g/ a& x" {
  59. #define ITCCHEN_SHIFT               23& F1 y" k' ~, I% `/ i# k& _

  60. $ ?1 m+ l5 B7 d3 }
  61. static volatile int irqraised1 = 0;
    ; Y% l; ?. P' G# f2 _# M
  62. static volatile int irqraised2 = 0;
    & Q4 G; g7 u/ o, ]3 b
  63. " \6 B  {+ H5 \- ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & w, ]6 W8 L! c- V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 D9 w4 c  g* i9 W- A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " ^8 `/ A3 e9 p/ B1 a" `
  67. 8 X( `4 h" S4 F0 d8 i5 o) L
  68. dma_addr_t dmaphyssrc1 = 0;
    9 ]8 z& N+ L; u, n2 L8 D
  69. dma_addr_t dmaphyssrc2 = 0;
    ( ^8 H: P7 l2 |0 v& c4 G; M& R
  70. dma_addr_t dmaphysdest1 = 0;& F# ^4 b" P% ^$ @5 A
  71. dma_addr_t dmaphysdest2 = 0;
      [: p: ~+ ~! b5 g& k) p
  72.   ]% e- T8 k- l) K- ]& R
  73. char *dmabufsrc1 = NULL;
    : h( H# P) O& J( ?% P
  74. char *dmabufsrc2 = NULL;
    ; }  \4 r) _7 O/ x; Q4 d8 y
  75. char *dmabufdest1 = NULL;$ V: W( c7 ^, }& g; s+ }
  76. char *dmabufdest2 = NULL;
    % i- r1 `8 Q% @7 S% O
  77. 1 w$ r  a/ q* o1 {. j
  78. static int acnt = 512;0 F- W0 z, A1 _1 J1 o0 K
  79. static int bcnt = 8;4 G" F' g9 O% B2 G* [4 x; o
  80. static int ccnt = 8;" x) b7 K! ~& ^/ _9 ]  R" ~

  81. : ~* W6 t' g# b4 f  N, t
  82. module_param(acnt, int, S_IRUGO);' C% c" P0 j" X, V+ M2 o, R
  83. module_param(bcnt, int, S_IRUGO);
    5 n1 d5 @& `. K% @# w3 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ o3 n% L: _. m2 D0 ]7 K1 r  g$ b1 j

% e, J4 z+ r8 T- ^) h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: h2 o& J9 y' a0 n* T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 h$ M# R# w3 _! A/ I2 \* D- g9 H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ p- J8 L  f6 N* h  M% |8 U
& A0 `' ]# a& X' ~# s; {
% s; _5 F" d$ ~, P0 y/ L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-7 21:52 , Processed in 0.066240 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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