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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . e/ u0 l, r5 \, P
  1. [code]EDMA sample test application7 _' W7 s% W0 \- l$ C; e2 S
  2. /*9 ^+ o5 ]! n( b9 u8 l0 ?, m2 B
  3. * edma_test.c: }6 |) E" X+ j  u* u) c' J
  4. *
    " T" l8 K) h( Y! `* k/ P0 @6 U* Z' R, J
  5. * brief  EDMA3 Test Application
    9 X- r7 f$ L. g" K# W
  6. *& M$ `9 k( s$ t( ^, @
  7. *   This file contains EDMA3 Test code.
    1 k2 s$ {7 k4 J: `; K3 H! k9 U9 J, ]" P
  8. *
    ' V: \3 t/ Z% W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & P9 P) d! g0 ?: J9 K/ T, g, V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 w* z& B& v! [- I: p: Y0 x! E
  11. *         TO CHANGE.8 J" V5 q: B. W9 z. ]' d% P
  12. *
    & @! |) L- u% z; m- U- ]1 a- g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' ?1 o1 I: l0 P$ o/ \
  14. *
    * H6 K% Z8 P* Y! N! l- c9 `" P
  15. * This program is free software; you can redistribute it and/or4 F" |% v& q8 p) G# x
  16. * modify it under the terms of the GNU General Public License as: u' L- ?" f& G# B
  17. * published by the Free Software Foundation version 2.
    ; i8 `/ D# ~: z! x5 H  r1 e
  18. *, T9 l+ a9 M" I* \+ ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 x3 W5 s( q+ ^5 W7 R* i
  20. * kind, whether express or implied; without even the implied warranty
    " \5 H" k- A6 G- O1 Q* A6 c% g2 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. M  |. `# g! E6 a6 W' {
  22. * GNU General Public License for more details.
    " D7 Z: G  q7 k7 R& Y
  23. */
    6 y- C" r. Q) e2 y$ F

  24. 5 D  c' Z" E# U6 v$ f5 |
  25. #include <linux/module.h>8 ~! g* r# j1 Q  L# h
  26. #include <linux/init.h>
    & f, G8 H- [. f8 o
  27. #include <linux/errno.h>) m. Z6 P% J" f( c
  28. #include <linux/types.h>
    6 W' w! G7 z7 m8 j
  29. #include <linux/interrupt.h>
    5 `1 T& T4 u9 ^2 H2 B" X
  30. #include <asm/io.h>5 S% u) K6 v: V) |9 S  R5 Y
  31. #include <linux/moduleparam.h>
    ; U" u4 G6 z$ V  D$ E
  32. #include <linux/sysctl.h>* b" Z! T; h/ Y; \; ?
  33. #include <linux/mm.h># d0 H+ u& A. d: B9 Y
  34. #include <linux/dma-mapping.h>
    4 f# _$ r, y$ B( J
  35. + J. k3 T- V- ~
  36. #include <mach/memory.h>9 P  z- o5 {: i( L7 g6 D7 _7 I
  37. #include <mach/hardware.h>  Z& [& n8 p$ {+ K* ]+ Z: J
  38. #include <mach/irqs.h>" W' E( {6 E5 x+ N2 c4 S
  39. #include <asm/hardware/edma.h>* v2 s3 \2 D2 r# {  v. i! ]% G( S
  40. # K$ M( C" Z2 G
  41. #undef EDMA3_DEBUG' G, n! ~  x/ ^/ G6 k! t) L. I
  42. /*#define EDMA3_DEBUG*/. F9 K( S% M  c* h+ C
  43. ' g# a5 ?. |6 }+ l  b
  44. #ifdef EDMA3_DEBUG. S8 I7 |8 ~1 ]2 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; ^$ o- d1 E* j. Y5 F! Y% t3 R% E* }) a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! e+ [& }9 N: U& |4 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 b# ~/ P1 p& B' b; N* O' L' v
  48. #else0 B, h4 f8 N) S/ v" J/ K3 Z) A5 ?1 r
  49. #define DMA_PRINTK( x... )" P0 @, Q* i7 L! |
  50. #define DMA_FN_IN) _( C+ A3 ?1 e# x% W' }
  51. #define DMA_FN_OUT- T  A1 m2 |8 [
  52. #endif/ p( I( R6 J. v6 G" u

  53. 4 i9 T2 q" M1 N( K- P0 y8 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% H$ h; K. i. R
  55. #define STATIC_SHIFT                3. E0 ~3 Z. M- D5 _* C* T5 k
  56. #define TCINTEN_SHIFT               20
    $ ?( Q6 D7 z  D/ o
  57. #define ITCINTEN_SHIFT              214 w, A: {4 Q, }
  58. #define TCCHEN_SHIFT                22; s. Q! Y7 z, W5 f# s- k
  59. #define ITCCHEN_SHIFT               23
    + s6 p* p1 f' u, T, y! G! L

  60. 9 R) d' k$ j) |0 _
  61. static volatile int irqraised1 = 0;1 x6 n& O- _! g( \
  62. static volatile int irqraised2 = 0;: |3 M3 R9 v3 t

  63. ' X9 E$ h1 w5 _# }! s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Q/ [/ ]) I2 u' ]0 O. l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! F) X; K5 T3 K) ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 R$ m& f- \$ d$ r: O( f3 s
  67. / u) @3 H* Y5 f9 a, N
  68. dma_addr_t dmaphyssrc1 = 0;% V, C, u& X' |& D
  69. dma_addr_t dmaphyssrc2 = 0;/ f8 X# y* F3 v' r. [4 C% w* B6 e" W2 Y
  70. dma_addr_t dmaphysdest1 = 0;
    : W5 P" n! I% u: b
  71. dma_addr_t dmaphysdest2 = 0;
    9 n. G! ]  D8 s$ |: W; s" y9 H

  72. ) t/ F/ g5 Q9 f( i3 W( i
  73. char *dmabufsrc1 = NULL;/ x( R. M8 k5 r% J
  74. char *dmabufsrc2 = NULL;
    " ?9 L, y& i  ]5 q4 I( l1 B
  75. char *dmabufdest1 = NULL;3 g7 e& E, B1 J2 K3 s  K% F
  76. char *dmabufdest2 = NULL;
    8 D3 i. x- \3 H( w3 L
  77. / t" g/ ^7 d7 K1 C- r4 J
  78. static int acnt = 512;
    0 \% v" x4 l  _; K$ Z! B9 g6 ?
  79. static int bcnt = 8;/ J& J: [! \  e
  80. static int ccnt = 8;
    ) X) n# M( u7 B4 m# t

  81. " |3 N7 {* m' n5 l
  82. module_param(acnt, int, S_IRUGO);
    7 P" E! {2 V. [
  83. module_param(bcnt, int, S_IRUGO);
    , ^; i7 Z* Z% y: M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* `- @  X, |1 N) M* D! ?) m
( B2 S* S- k0 k5 V! p. ^' l" k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" b2 T7 s# z4 P) Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ V1 z: z* H$ \* N) G/ P# M+ i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) M3 a4 X. d  C5 ^0 S/ T
0 {1 ^, x  k! w
+ x5 H+ e  g8 m1 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 06:19 , Processed in 0.040259 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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