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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - y1 t  K2 f: L4 G' E) |
  1. [code]EDMA sample test application5 X0 l# L5 D' q6 [8 U( T2 c/ p5 h
  2. /*
    $ |# E& I2 Y% C) U7 H& P# T
  3. * edma_test.c. u3 i0 y0 ^1 o
  4. *
    5 ^6 N9 c6 e3 t" i  o& B
  5. * brief  EDMA3 Test Application
    ; D& O" `2 p( x' O% D, {
  6. *
    ; f. X* t- j( v( r+ C# ^
  7. *   This file contains EDMA3 Test code.
    ) }9 C1 E  Y  ?1 b
  8. *: ]2 d- f" D2 W2 _! k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ w% |" L3 P  h8 b" U: ?1 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 z  n2 x# k: M4 S# ?
  11. *         TO CHANGE.
    & m  D6 C  z, y
  12. *
    , x2 e; G" Z. z7 o  o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . R. ~: t4 B& l/ P( F2 ?& A
  14. */ n2 j9 Z, R" _/ A8 W6 L
  15. * This program is free software; you can redistribute it and/or& F) N5 c2 I( e# x
  16. * modify it under the terms of the GNU General Public License as( ]9 _( }  [! N0 A  B0 D, Z7 Z' v
  17. * published by the Free Software Foundation version 2.5 h. P2 r  d, l3 ?. w6 a
  18. *4 N. I1 ?: m$ z3 v& U$ t1 I! h; ^% T" N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 B/ P& W+ ?+ k  _, y
  20. * kind, whether express or implied; without even the implied warranty
    / o/ h9 I2 i% k  O8 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & ~2 l; {* Z2 Y: p4 U5 e
  22. * GNU General Public License for more details.
    & x/ o* s4 ]  i; I/ x# C, i
  23. */% d! Z  V4 r3 P, W  n# ~. E( w
  24. / ]1 I; J9 M- w& P* `. q
  25. #include <linux/module.h>6 H# m7 \. W% c7 |( V1 H$ S
  26. #include <linux/init.h>% H6 P7 Z7 b8 h, b
  27. #include <linux/errno.h>
    1 M' C( A( |/ v) N" T! X
  28. #include <linux/types.h>
    ( C/ G* l$ p; A$ A' m2 X
  29. #include <linux/interrupt.h>: W1 _2 @" }6 k- o4 I5 X7 }9 [8 c
  30. #include <asm/io.h>8 T! o+ w7 B6 T' N$ _+ P6 t' Q
  31. #include <linux/moduleparam.h>( E- v; M: a7 J5 m1 {
  32. #include <linux/sysctl.h>; y; O! s5 G$ C/ F# m
  33. #include <linux/mm.h>3 S# x9 y; g! \. M1 V
  34. #include <linux/dma-mapping.h>! G* M+ `0 {3 Z) W5 L1 f) h% s$ e

  35.   M4 @  `; p" P; I. T; S' ]
  36. #include <mach/memory.h>
    3 n6 E3 \' S' a! u; z: O8 `
  37. #include <mach/hardware.h>5 Q9 F7 U, c2 k( o6 o
  38. #include <mach/irqs.h>
    . x7 B& k. T% k: J
  39. #include <asm/hardware/edma.h>/ X. ]% e# Y6 v& B: ]) a

  40. 6 D/ M* _: Y; A& O
  41. #undef EDMA3_DEBUG
    , \6 y8 b1 [  ^
  42. /*#define EDMA3_DEBUG*/1 ^& S1 Z8 ]+ J$ Q

  43. 6 o& i8 ^) o1 B: q
  44. #ifdef EDMA3_DEBUG
    ( B3 L; ~. @3 E# Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- V; s5 M+ B. i9 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) r/ K9 H4 v2 F4 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      r0 \3 L' |7 P) U8 z, ]4 Q# l6 i
  48. #else: G3 k9 z. K' l8 ?2 T
  49. #define DMA_PRINTK( x... )4 S8 L, o' G- k7 D6 n
  50. #define DMA_FN_IN: O4 g0 _3 C( ?6 [
  51. #define DMA_FN_OUT
    2 d  w$ z& l7 H0 J" Y, L" p
  52. #endif
    2 B4 x" P7 l$ r2 s( t! @. @

  53. ' ?0 E, Q# z+ G% v* z. t3 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 C# l7 \( r! S  [4 ?# h
  55. #define STATIC_SHIFT                3+ B' Z3 J0 t- o6 k
  56. #define TCINTEN_SHIFT               20
    3 c0 x. T$ ]4 O- I' a9 a4 Q; |4 C5 E
  57. #define ITCINTEN_SHIFT              213 C* n% K" N$ o& J3 S/ ?
  58. #define TCCHEN_SHIFT                22; Z' C8 h) f8 ]& Y/ h( r
  59. #define ITCCHEN_SHIFT               238 B# x, H- e. W: p# l' Q5 b

  60. - U- V- t2 Q3 X* I  G
  61. static volatile int irqraised1 = 0;3 L! p- y2 ]( W8 i
  62. static volatile int irqraised2 = 0;$ Y7 `# A# y$ Z. u3 o
  63. : @- q1 ~: ~7 q7 t5 b+ M6 e. P: W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& J& @/ R2 K% z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 C9 ]3 v" z6 A) b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 u0 @% N6 U! W$ U2 H3 m" ]5 Q
  67. " D8 }- e" Y7 I; R; o# h6 Q1 T
  68. dma_addr_t dmaphyssrc1 = 0;
    ; c( u  s  a/ ~6 m
  69. dma_addr_t dmaphyssrc2 = 0;
    ) X' r  Q: P. v: Z$ Q
  70. dma_addr_t dmaphysdest1 = 0;
    ( o/ Y5 E$ v( M* I. `
  71. dma_addr_t dmaphysdest2 = 0;
    6 m' [& `3 i$ D; y
  72. # i8 X9 I! v+ [2 B2 S6 Y6 X
  73. char *dmabufsrc1 = NULL;
    ! Q! w6 i( S- a- `" k
  74. char *dmabufsrc2 = NULL;" o4 D+ f6 Q6 E! m! P1 _5 @) n
  75. char *dmabufdest1 = NULL;
    ' t# a: Q9 _* T& d
  76. char *dmabufdest2 = NULL;  e& ]8 I: g- f- q0 F7 [: d) v3 G6 F

  77. 9 B. w5 O; R. c5 b" }# E
  78. static int acnt = 512;
    * S" |! x; v. s  N% D. E: o1 F2 d
  79. static int bcnt = 8;
    - a* i5 t: j% [- q( h" d1 y
  80. static int ccnt = 8;
    " ]9 t2 W" ~; C+ N4 t) W, i
  81. : K" E$ S, X1 w) B5 A! ^0 }& y, ^9 t
  82. module_param(acnt, int, S_IRUGO);  T6 F! \" h1 A! l/ s
  83. module_param(bcnt, int, S_IRUGO);7 Z$ |4 F+ t  r; v' M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ i+ @: m  C( ]2 v) y  m* n- O( @! u4 ^) T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& d# M, u9 a! D: V. `) ^9 [1 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. c$ L" A. y0 N$ l& _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 y+ |( f. O9 V. I
3 N& X  s) x6 K* O; L5 m

# F7 V- j& @, V* N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 10:44 , Processed in 0.046539 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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