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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + {! {2 T- U$ j# D5 h
  1. [code]EDMA sample test application; J8 x$ Y# o: t2 X# m9 T! o5 p
  2. /*& n: ?& ]! [# v8 t& v- T
  3. * edma_test.c
    5 @+ B* O# k! C( ^6 `  `
  4. *6 p7 ?2 ?  l7 \3 V1 r8 w
  5. * brief  EDMA3 Test Application* i7 X# e$ D- o4 Q  }- Q) W
  6. *% o; s5 m" W! [
  7. *   This file contains EDMA3 Test code.! T& n  s7 ^% l% }% |3 v+ {6 x
  8. *
    5 {# M5 L; G7 {3 R" H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% X. n4 X/ C! x' V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' c- t1 c7 G- E9 i; ]
  11. *         TO CHANGE.+ g3 V6 w+ g4 ]6 |: J
  12. *
    ; S9 \  d0 p( }. ]2 M& b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 r* k: [* x' S# h2 P
  14. *
    $ K3 F+ o; f+ z/ i
  15. * This program is free software; you can redistribute it and/or  T) ]; [+ @; _! \4 N, `! p
  16. * modify it under the terms of the GNU General Public License as
    : {9 h/ j5 t1 B6 A8 J. b& N
  17. * published by the Free Software Foundation version 2.
    9 q6 i0 z% Q' X6 c
  18. ** m5 b5 ^0 J( z, S; R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - n6 \$ ~0 _8 H- T8 ?) ?2 ?) F
  20. * kind, whether express or implied; without even the implied warranty" z3 i6 z8 W3 x5 ?/ w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + s, s9 r: y/ ?" }' h: @
  22. * GNU General Public License for more details.1 j$ P% u- V, m# Y5 q
  23. */
    $ |7 e5 `- t. Z3 R* X5 z8 a

  24. 2 F* u' ~4 q' S
  25. #include <linux/module.h>4 r- V; ^3 q: C( a3 a( w
  26. #include <linux/init.h># r9 P# {' N6 j  v' `( w5 x7 `
  27. #include <linux/errno.h>
    " m- [( H* ^6 {' ]$ {" O
  28. #include <linux/types.h>
    & A/ H$ {/ C9 }" z# x( z  u3 Z
  29. #include <linux/interrupt.h>
    % [0 Z' j" e4 M- J. q
  30. #include <asm/io.h>; _+ P6 ~, x% x+ f/ l* a2 w( G
  31. #include <linux/moduleparam.h>0 d" W6 ?" a8 |, ]
  32. #include <linux/sysctl.h>
    9 m$ {/ h& m) X* Z3 d
  33. #include <linux/mm.h># T: c8 R# t9 q. V/ {5 C7 q- E, O
  34. #include <linux/dma-mapping.h>
    , v! x, B% H4 W1 {6 t6 [5 W/ f
  35. ) F% e; R: X. w
  36. #include <mach/memory.h>
    8 D. H7 {: d" I7 E) H, M) O. b
  37. #include <mach/hardware.h>; {, V: s! o% h4 E  s( a% s
  38. #include <mach/irqs.h>
    8 E/ |# w$ ^; o
  39. #include <asm/hardware/edma.h>. o" n( d% n/ ^* a# j
  40. 2 d$ O  e1 Y0 Y8 f8 T8 C
  41. #undef EDMA3_DEBUG( b, X( q8 E2 y; j  x: a1 b
  42. /*#define EDMA3_DEBUG*/$ e, w4 u$ Z) d* \4 c$ r

  43. ; J/ O. ~* ?# D& y
  44. #ifdef EDMA3_DEBUG
    8 l" c% r3 d3 c! M$ b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- Y  L/ [7 h1 v4 Y/ W) D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! d# N5 T- ~) @  ]! a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / }8 m- I$ C( ?6 G- _% o
  48. #else
    & M7 o6 [' N+ K  ~. r" z: N
  49. #define DMA_PRINTK( x... )
    " D( T  L5 z4 B. O) ?4 ?
  50. #define DMA_FN_IN
    2 b1 B; i4 _' M, K
  51. #define DMA_FN_OUT
    : e- b9 W) ~" d) a* F6 a
  52. #endif
    , Y& u2 ]/ W2 X( S) V

  53. . ^2 d2 Z/ u! [1 s/ O6 |; [: W; u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % E3 y# `. r- a# R8 O' e
  55. #define STATIC_SHIFT                3* M0 p7 m5 E* F* j
  56. #define TCINTEN_SHIFT               20
      [8 _8 \+ ~) E% J" Y: P
  57. #define ITCINTEN_SHIFT              214 R" v5 k! s% Q
  58. #define TCCHEN_SHIFT                22
    0 U. `* V( c" i; Q( f% z
  59. #define ITCCHEN_SHIFT               23
    2 t0 D3 _0 T* f; X1 D2 X/ J+ o
  60. % }2 |5 H5 P. E: n* w
  61. static volatile int irqraised1 = 0;3 ?% V. W( t( M" N1 y
  62. static volatile int irqraised2 = 0;9 R8 y: \5 j8 e

  63. 0 K3 b' O/ k# t" x3 _. h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; f; D! G. S: @' o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# o9 c  ~' i, G* v, u8 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 P) h/ _" X0 N2 A) X( l

  67. # m! |6 Q7 F6 V  `; Z
  68. dma_addr_t dmaphyssrc1 = 0;% l* r' Y0 y4 z/ @
  69. dma_addr_t dmaphyssrc2 = 0;
    3 x$ @* m% m4 ^0 z( [
  70. dma_addr_t dmaphysdest1 = 0;
    $ p  t# v" P0 D% ?' V. [
  71. dma_addr_t dmaphysdest2 = 0;: M, b' X2 Q. g5 `3 F
  72. 9 |& t* Y( _* ^; C
  73. char *dmabufsrc1 = NULL;
    + f6 R" n8 k' e5 X& ?0 N; M0 i
  74. char *dmabufsrc2 = NULL;8 |" V; c+ j+ u# w6 X* h
  75. char *dmabufdest1 = NULL;
    3 `) {$ R$ U$ f+ b! `  K$ w. Q, R9 q
  76. char *dmabufdest2 = NULL;
    ( g* Q. M; E* g  ]
  77. 6 E4 @' @3 X9 r% y6 X3 c1 I6 |8 D
  78. static int acnt = 512;
    0 ^% k8 s# P  i
  79. static int bcnt = 8;0 e" x$ y- ?3 d6 R4 }* d5 }
  80. static int ccnt = 8;
    ( h! R) Z5 Q! U2 K$ S5 P4 ~

  81. + u: b: ?  ?! P$ V0 s
  82. module_param(acnt, int, S_IRUGO);: \1 {/ G8 A) F9 U& I) s
  83. module_param(bcnt, int, S_IRUGO);
    7 U; z+ n' F! B8 p* K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; R+ {3 M) `# @0 M3 F* E. e/ ^* ?  {; |! B" ?9 g8 N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, S3 O1 x7 Z5 y3 w4 n! S6 u( B4 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! Z. Y- c7 ?, Y7 {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) [+ n4 ~9 J9 c( R' u7 ^

4 }* P3 W" J8 v0 _5 d6 C' x! t) |. I% L( l4 t6 W7 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 10:51 , Processed in 0.043861 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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