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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 f/ `# P4 j/ ?( n; H8 O5 M. s
  1. [code]EDMA sample test application
    # _! {2 @+ K: W6 a0 l. D5 E. k
  2. /*0 D! s6 G/ h% P8 @1 c3 V  ]! {* t# N) s- q
  3. * edma_test.c7 n2 [3 I$ ]1 v: w& h( v5 l
  4. */ l( k1 D# B" Y
  5. * brief  EDMA3 Test Application$ V9 p) N' l- }! Z, x) W8 H
  6. *' ~$ o( w5 r* P4 K6 j& t
  7. *   This file contains EDMA3 Test code.
    ' @! Y5 t6 i8 B
  8. *) y0 Z( K  c0 ?" E/ W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . ?9 w( ?) g( K% w" F* m) e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% H1 R* O! H# p( S+ B
  11. *         TO CHANGE.
    : f2 }$ v0 [" Q1 P: U7 I
  12. *
    ; h+ b# T; U5 n8 s8 {6 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ ~8 k/ z: L: q. D9 A
  14. *) o% I  l$ @# U& X) k4 n7 |
  15. * This program is free software; you can redistribute it and/or8 e/ ?9 m  _0 R1 Z
  16. * modify it under the terms of the GNU General Public License as% N# P9 h8 N! V$ x
  17. * published by the Free Software Foundation version 2.# ?3 V1 m3 ^1 F
  18. *$ d" S' M/ U  L% \+ ~1 B% v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- A3 v. {  D, U
  20. * kind, whether express or implied; without even the implied warranty
    - {: P( ~2 |' f8 I7 h$ k  V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' K% R& F; R0 I+ ]4 t
  22. * GNU General Public License for more details.& G" s6 s3 k* |& M* g" L
  23. */
    ; y) |" o$ O, s: t
  24. ! h* o1 _9 Z8 G
  25. #include <linux/module.h>
    , {! r" V' e0 U* n- T# }. |2 P
  26. #include <linux/init.h>
    - H4 g9 }7 R' u6 L* p
  27. #include <linux/errno.h>% D5 [* R& K: F
  28. #include <linux/types.h>
    7 R1 r0 C0 Y( o. q3 Y
  29. #include <linux/interrupt.h># y& w& j& W8 A4 C- R; d
  30. #include <asm/io.h>! |& L4 S; I; {4 a
  31. #include <linux/moduleparam.h>
    ' M* I9 M) \" K* b% E* q  n
  32. #include <linux/sysctl.h>
    % z4 r' g- ]4 i/ _3 {5 F1 p% R
  33. #include <linux/mm.h>! c) D% G; f3 X1 ?# h+ O
  34. #include <linux/dma-mapping.h>4 P# o$ O3 e4 [& f8 Y

  35. ! ~; X$ P) q& `- @, ?" ~
  36. #include <mach/memory.h>
    6 i3 R5 p. T& d# a
  37. #include <mach/hardware.h>
    7 O- }+ l* V% R
  38. #include <mach/irqs.h>
    1 M1 P& V6 U+ e% T. X, d5 u
  39. #include <asm/hardware/edma.h># K: N2 l# |9 a/ R
  40. 4 ~$ @3 |; Q7 V6 s7 ^- T
  41. #undef EDMA3_DEBUG
    7 }$ f+ z& S, ]1 Y& B$ }
  42. /*#define EDMA3_DEBUG*/
    5 M5 w$ |/ M6 J* E; S' r

  43. + Y0 Q5 d3 J# {3 q" r8 e* [$ u
  44. #ifdef EDMA3_DEBUG9 H9 g5 `$ `1 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 g7 P  w/ k# B) w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- O2 Z% E9 C3 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( @5 y' J3 v% V3 w( D% t9 V! h
  48. #else$ z8 ]8 L7 j' P# m" q: W" t
  49. #define DMA_PRINTK( x... )7 C7 j" N, S0 }4 B: W
  50. #define DMA_FN_IN
    . E6 k. J5 ~$ `" N4 O" K( `% ^
  51. #define DMA_FN_OUT
    ; F5 K3 l' F2 m( X2 h
  52. #endif6 {4 }! I. z1 x( l: ^

  53. 6 O' B% z8 G, c) r; j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) r0 T1 }1 _! O5 S+ `
  55. #define STATIC_SHIFT                3# v/ ?# S8 a* b: K5 A: L8 K3 R
  56. #define TCINTEN_SHIFT               20( z  P+ ^$ ]0 l1 z
  57. #define ITCINTEN_SHIFT              21
    / w. x) X, b% x! _
  58. #define TCCHEN_SHIFT                224 S: L  H( n0 w
  59. #define ITCCHEN_SHIFT               238 e4 W' T. Z# v( B4 ]
  60. 1 I3 q* z5 ~- y7 N, u
  61. static volatile int irqraised1 = 0;
    % d; S2 V' v" ?/ O( l3 F
  62. static volatile int irqraised2 = 0;, A- t& W$ K6 r

  63. 9 P6 V8 K4 ?# l( m2 D! e( v7 Q. d- M& v3 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- j& e. n9 J( ~3 g6 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( u$ U) a* k% M/ @4 x4 h+ c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 D6 Q' {$ K, z/ Y4 h' Z3 Q  K# p5 y, E
  67. - y& y1 z4 H/ ^1 Y. a: n
  68. dma_addr_t dmaphyssrc1 = 0;
    2 n, [) ^* R1 c+ m) ?4 E
  69. dma_addr_t dmaphyssrc2 = 0;/ t2 ~8 W; {7 S4 e2 q& u4 w, W
  70. dma_addr_t dmaphysdest1 = 0;* U0 n: {+ K# ^' b2 l; y
  71. dma_addr_t dmaphysdest2 = 0;, W' A& w( X3 }' u

  72. 9 I5 R; j+ c1 i# a; D: E3 D
  73. char *dmabufsrc1 = NULL;1 c/ }) V! F: E; M' J3 L! c
  74. char *dmabufsrc2 = NULL;
    & N& a. _5 [5 ]- B: X( ^3 Q5 I
  75. char *dmabufdest1 = NULL;3 M/ b; E( R7 j+ a# s1 r$ ]
  76. char *dmabufdest2 = NULL;
    ' B/ m, K; z$ I- H5 R2 L

  77. ' Y' Y. {* u- G$ I' B
  78. static int acnt = 512;3 o! o6 P' W5 K) C
  79. static int bcnt = 8;" c' h$ D  `% ?3 Q2 Z0 k- M
  80. static int ccnt = 8;
    , [: c( }/ r- h' @# n- f

  81. ) s' `  O8 Y# D2 ~
  82. module_param(acnt, int, S_IRUGO);
    9 c7 _8 Z, w* |1 L
  83. module_param(bcnt, int, S_IRUGO);
    ( N  F3 M! v& U, B! Z' t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 W# G. Y5 ?! `& N9 B# }0 g
0 Z  t" S/ W% W: Z$ t, G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) G9 N2 I$ w( z- @$ ?& ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& V8 R; T; U" p2 W  V% R; H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( a; U) h+ h1 J8 `
  t" T& a' L0 Y( X' {5 n' u, H/ {2 f% s% {$ g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 20:20 , Processed in 0.039035 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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