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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 }7 n4 K7 X, D7 K4 S" G  f5 r- M
  1. [code]EDMA sample test application
    / }* D0 b7 M8 M1 W5 V' J* Q
  2. /*
    ( B# i, @% w5 w0 s
  3. * edma_test.c/ G1 s6 i& O; j7 k( Q3 H' ?  |
  4. *  y' h6 c% [) Y+ \
  5. * brief  EDMA3 Test Application
    - W; f9 O  ^8 r, z/ h
  6. *
    & d  ~( O. w- R+ C$ J- Z
  7. *   This file contains EDMA3 Test code.% N+ o6 N! P% f! ]: Q7 W& c; \
  8. *
    7 {% ^$ v6 ?+ c" I3 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 v, l. i" C; z1 ]( o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: X# G8 l6 Y+ O+ B" H
  11. *         TO CHANGE.
    2 `0 @* e: A! I) q( F2 a
  12. *
    5 V, [$ r7 \3 r% O! L1 e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 g2 ]- Z9 J" y- O" G& O
  14. *8 V, G0 \, X5 b9 O+ w) e  J( p
  15. * This program is free software; you can redistribute it and/or
    0 C; {0 }# c% B
  16. * modify it under the terms of the GNU General Public License as2 y; F3 L7 B( T, ]
  17. * published by the Free Software Foundation version 2.$ g3 E# e2 W9 v, r$ k6 t
  18. *
    : b4 k) a9 d+ Z1 H) d) U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - c! e, y1 g2 S. |2 d' }4 _* v  B' }
  20. * kind, whether express or implied; without even the implied warranty
    2 e0 C" g$ l( j4 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: p* P" o, `/ J$ s9 R% y
  22. * GNU General Public License for more details.+ e3 T  _/ T; C" {  ^
  23. */) G4 s, u' s7 {$ E, e

  24.   U$ d5 h$ s$ [! k
  25. #include <linux/module.h>3 |. Z) C& g3 m0 h0 l' o6 D6 R
  26. #include <linux/init.h>& f( e! P! m: c/ n2 T
  27. #include <linux/errno.h>
    2 |! n; S# _% y+ k* D
  28. #include <linux/types.h>
    / g" g7 M8 H, H9 q1 Y
  29. #include <linux/interrupt.h>. }! B' S( I' R. x* a" B
  30. #include <asm/io.h>
    , M7 R- f' A" e/ Q
  31. #include <linux/moduleparam.h>5 m2 }, w9 O' ?" O% ~, ?' y! w, q
  32. #include <linux/sysctl.h>
    0 ~' b" U$ H; b3 c. u( z4 _8 A: W9 I
  33. #include <linux/mm.h>
    4 H2 I1 D/ k6 \' C- O
  34. #include <linux/dma-mapping.h>' ]$ P5 ]: E6 g+ H5 O/ e; e. S
  35. 8 V$ H! b, G* r% d4 G
  36. #include <mach/memory.h>& i: T+ B5 s  M9 E0 T, s
  37. #include <mach/hardware.h>
    2 ~! E8 k2 \& U7 _5 a. v( W
  38. #include <mach/irqs.h>
    ; Z6 a' c0 j" o8 K
  39. #include <asm/hardware/edma.h>
    + ?' e) s, w" e, H& G, h! c
  40. 4 u% Q6 `; w  S9 a1 t
  41. #undef EDMA3_DEBUG! Z3 m5 u* ~* ?6 y/ r5 d  D
  42. /*#define EDMA3_DEBUG*/
    7 L4 I  ]2 `' A( G% o" X

  43. / r8 _6 B7 m5 h% w+ t5 _
  44. #ifdef EDMA3_DEBUG, V7 P! I" r& s6 E# H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 C  V% A: K$ v& L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * S" Z. P( l6 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / T" b; ?* u0 o2 c& B7 H& U
  48. #else9 k/ e( _- i# ]# V6 b/ `
  49. #define DMA_PRINTK( x... )# D* w$ L( z  U1 T3 k7 ?% n
  50. #define DMA_FN_IN
    - o3 L- `  ~0 m4 C
  51. #define DMA_FN_OUT
    5 T, w0 X# l& \
  52. #endif% v* @) S4 i: O2 L! g& P
  53. - t1 w7 W9 j" c0 @' }* y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " c6 j7 p% r) A
  55. #define STATIC_SHIFT                3
    % o/ o7 E# ?( z1 \7 Y0 P
  56. #define TCINTEN_SHIFT               20' [3 }* X9 o  w& F
  57. #define ITCINTEN_SHIFT              219 H  q/ {6 @' f( o$ g4 s* ^
  58. #define TCCHEN_SHIFT                222 e' r: q0 D9 h& Q
  59. #define ITCCHEN_SHIFT               23( e9 j9 R8 B9 T7 [! E5 U

  60. 2 u: \' Z6 @: p0 k0 g' b# n1 e
  61. static volatile int irqraised1 = 0;7 y: S5 }1 D  ^: U& n
  62. static volatile int irqraised2 = 0;
    " X) d: p; J, u" r+ E, @
  63. & ?3 C+ \7 T7 K+ y7 T5 G$ `* l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Z% t* l* y) ]+ w! j# X: ]: R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 F( b3 N2 A0 J+ r+ {; ]5 V0 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " L# Z  h( H3 |5 G6 [
  67. 9 Y, |1 u8 ^  C" y6 {: m! [! s
  68. dma_addr_t dmaphyssrc1 = 0;( V( T' c  o- C/ r- r2 {! ^; B
  69. dma_addr_t dmaphyssrc2 = 0;: G7 r0 V7 ]/ b, d6 J8 \; i/ O
  70. dma_addr_t dmaphysdest1 = 0;
    0 x/ {" b; Z2 |- o$ Y- t5 r8 O/ N
  71. dma_addr_t dmaphysdest2 = 0;7 S6 G$ y2 G" I6 q6 u9 W' o0 Z+ J

  72. # v' f' {5 ?. R0 C7 X
  73. char *dmabufsrc1 = NULL;
    $ |3 L/ m. \7 S) T: a" V8 |
  74. char *dmabufsrc2 = NULL;
    / r" T  u7 @& }8 J; S5 |1 ~
  75. char *dmabufdest1 = NULL;
    ! x8 ~2 Z8 i+ |5 P* Y. u
  76. char *dmabufdest2 = NULL;
    / X, V: C2 u; d, R
  77. 9 c+ J9 A' i. D' e& P
  78. static int acnt = 512;
    5 r* V1 l% I$ D
  79. static int bcnt = 8;- \% F0 J; N/ x/ y  c$ V
  80. static int ccnt = 8;
    $ c! ^# K; ^( ^4 o' K" G% k: l/ f
  81. ( `. ?8 L: W! F% O1 B9 [' P  b
  82. module_param(acnt, int, S_IRUGO);- Q6 b2 A0 N3 u/ R6 s- K% r+ g
  83. module_param(bcnt, int, S_IRUGO);
    ; w' }. W, l- d, D8 z' P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' m9 c: H3 g: |2 J, V( t
$ w2 F9 \. _2 F& `9 H  T9 H# g2 c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. o( F; x& w9 Q% M6 Z4 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 N# @- q; s* P" ^2 R, d+ W2 n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* i! u9 t4 t% c. V% P
1 b' |' i0 l* D6 F8 `- k+ W
* L7 O' Z! r! Z3 r( z( H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 03:17 , Processed in 0.040824 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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