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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. O) x, n8 v' j' A3 @
  1. [code]EDMA sample test application8 i/ @+ [& c* M: f% ]: S
  2. /*0 a; h! s+ b" u- d" F) _
  3. * edma_test.c2 F5 f! ~, W* k2 G1 g! e6 Q
  4. *
      H1 Y5 I4 X. p9 b) D
  5. * brief  EDMA3 Test Application
    ' ^5 N/ o4 E! k' C$ U9 k
  6. *
    # x6 d, u$ R& y( u( j0 h+ D  ^
  7. *   This file contains EDMA3 Test code.
    2 h, I0 c: y& ^: Z
  8. *: p% Q' |) H0 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 C1 J0 L% Q& E, e$ K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ i. j1 i5 ~9 }0 l& g
  11. *         TO CHANGE.4 a; R+ [; g5 O8 P& u8 u
  12. *8 M, A: ~+ m0 n; o0 u: U( L! |, G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; [0 Z. w; k, e; g# g: |
  14. *
    ! r  \" ]4 l) J9 l" U4 ]
  15. * This program is free software; you can redistribute it and/or
    , r) P* `( t& v  ~' m& f8 L: o% E
  16. * modify it under the terms of the GNU General Public License as
    3 u* M" l+ G* E) G' A, e$ d
  17. * published by the Free Software Foundation version 2.2 R& s2 H" |  ?3 H: o
  18. *
    9 ~' H; N0 R  O" q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' K# J  U' W$ R9 O/ i9 l, K( j
  20. * kind, whether express or implied; without even the implied warranty
    - z; y. X+ M- r' M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . [8 H2 R) P0 ^& ]) ^
  22. * GNU General Public License for more details.
    - X% ]) r/ |/ P) }6 t3 [( W: |
  23. */
    . f4 R$ z  a; m, V7 U
  24. ! W  ?+ T2 o" E4 r
  25. #include <linux/module.h>
    2 t- }$ W3 J& ?" i3 q6 ]1 j* I
  26. #include <linux/init.h>
    7 I4 g. ^9 N9 `) o4 A' @2 l
  27. #include <linux/errno.h>
    * O) F8 U* u5 a' w
  28. #include <linux/types.h>
    ! c6 d/ g7 C5 K
  29. #include <linux/interrupt.h>6 p5 G, ~, b2 e5 `
  30. #include <asm/io.h>! a& [/ O" R* s, i( q9 q
  31. #include <linux/moduleparam.h>
    % @0 e+ K, u6 a% J' L
  32. #include <linux/sysctl.h>
    , d. i" X2 \& g0 y2 B
  33. #include <linux/mm.h>
    2 K/ D* P8 \+ j- x/ s7 F7 C7 z
  34. #include <linux/dma-mapping.h>
    * M- H8 p7 y2 D  K
  35. ) r& k' @( G) N& H3 m
  36. #include <mach/memory.h>& L9 F# g+ f2 R8 J, X
  37. #include <mach/hardware.h>
    1 K8 }2 z+ H: P2 r8 E6 i; I
  38. #include <mach/irqs.h>1 X. z! P5 [0 X9 y* C4 x8 d5 o
  39. #include <asm/hardware/edma.h>5 }$ f7 O; b$ Q( `% Z
  40. : x6 r, w+ `! d) r3 J
  41. #undef EDMA3_DEBUG
    ' B" _' c$ G9 H4 N* J
  42. /*#define EDMA3_DEBUG*/
    - S; [* Y+ d4 T' h/ |( P

  43. 9 {5 }) t' J6 w$ q
  44. #ifdef EDMA3_DEBUG
      ?# |% P. J* g2 }7 }# O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' W- l* V, q! D" c0 V+ b2 m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 V1 @* s: r$ V+ @9 _7 S* Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 b& B3 j2 Q) D: s3 y
  48. #else  F: M5 K+ d9 I  w* n# |
  49. #define DMA_PRINTK( x... )% D" p7 i& ~9 q8 i8 G2 B
  50. #define DMA_FN_IN
    ' \2 T2 B- f7 k6 q& ~- A
  51. #define DMA_FN_OUT7 ~: K. z' {- P1 G6 b
  52. #endif7 r2 x7 u  |9 J) _
  53. & X! H. O. a& Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - n# S  a+ f4 J
  55. #define STATIC_SHIFT                3& h  p. ?& }: f1 E- z- i
  56. #define TCINTEN_SHIFT               20( |! o9 i+ \7 T  a2 |
  57. #define ITCINTEN_SHIFT              21
    / z# ^7 O  X  u
  58. #define TCCHEN_SHIFT                22" x& Z/ \4 w' `4 X
  59. #define ITCCHEN_SHIFT               23
    7 S7 B) g& ~) V# F6 v

  60. 0 `1 S; c0 f- [1 k
  61. static volatile int irqraised1 = 0;
    & x; |3 @% `  h! i8 B: z
  62. static volatile int irqraised2 = 0;( N, K3 r6 z% `3 y: O
  63. 6 S! O* u4 _& B8 |5 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 A4 `3 c& M  q- ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 c, v1 \1 c0 c$ d% z' p$ ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 H6 O7 G2 i( ~$ {* N$ _

  67. 3 B$ T$ ?/ e# p2 E- }
  68. dma_addr_t dmaphyssrc1 = 0;
    ! n! C6 b8 F& v; ]2 `
  69. dma_addr_t dmaphyssrc2 = 0;" F5 z, {# P# {  I" i
  70. dma_addr_t dmaphysdest1 = 0;
    / r- r$ y1 y8 H6 L- k+ \
  71. dma_addr_t dmaphysdest2 = 0;% H& S- |5 i, S8 }/ b
  72. : g4 K% i5 S! b% x6 |3 H3 A
  73. char *dmabufsrc1 = NULL;6 i5 p( V" G' J4 f9 n8 N1 R
  74. char *dmabufsrc2 = NULL;' v2 \: w  H# H( ?- M1 w
  75. char *dmabufdest1 = NULL;
    ( D3 B, l! {) Z, q6 D9 _; L/ h
  76. char *dmabufdest2 = NULL;
    % ~8 o3 ~% s- `- S% l

  77. ( O  u8 ^2 y, ]0 x; U
  78. static int acnt = 512;( }7 ?& a% A3 X6 r- K1 p: D1 j6 Q* ]
  79. static int bcnt = 8;2 t! P% ~4 y9 L* [
  80. static int ccnt = 8;' |+ r8 O& `' c# e6 G! N2 t
  81. $ U( G; f6 Z% k+ O
  82. module_param(acnt, int, S_IRUGO);
    # n, D) z6 v0 L+ I3 Z8 X
  83. module_param(bcnt, int, S_IRUGO);' t) d4 A* a6 u4 b& v0 n6 [4 G' w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 h! \( g' N$ w6 j: C) U; ]  l2 t1 \" X) _8 f: a+ ~, y# P+ t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 n0 v5 S3 |+ B) n2 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- ~( w/ W/ W) S% z. ?" f  O5 i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, g1 e- V* `$ O3 J9 @  E$ ~. |  c

7 }. f8 W8 t2 k5 m) `( j5 V" C- s/ M/ O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-26 18:02 , Processed in 0.043896 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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