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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 j& Z, G, e& h! X' L
  1. [code]EDMA sample test application3 B: ?! |( U- m" d% x  a( E3 @
  2. /*
    6 `0 [2 ~: J3 n9 h( ~
  3. * edma_test.c
    6 ^) s) t$ F7 L+ M1 T" D
  4. *4 z& G  V, h) P, x8 `8 S  e
  5. * brief  EDMA3 Test Application2 D, C7 y! S; J* }& R
  6. *
    8 M; V. c% Q$ K! J7 G8 {3 X' `
  7. *   This file contains EDMA3 Test code.
    * f- ?- r3 j) n- Y* r7 W
  8. *0 i3 [# K% V: h9 C1 b. t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 ~8 L* f$ z) H. O) K3 g8 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' i9 U9 C( y8 i) r3 x4 y# X
  11. *         TO CHANGE.0 z8 N8 P6 _1 e7 B  B
  12. *
    $ m0 d" F/ Z# f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 l, p( m, N1 l" V+ [
  14. ** K9 T3 Q- ~! B3 ^- |# N2 t
  15. * This program is free software; you can redistribute it and/or
    7 n7 k4 V; z- Q+ ?: c. N( @
  16. * modify it under the terms of the GNU General Public License as
    1 @- y' Z" A8 q
  17. * published by the Free Software Foundation version 2.+ ]7 z) T% C/ i! J+ H
  18. *
    ; {; {2 L) z+ ?/ [. D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: N7 L6 j0 K" F+ K6 f( A4 _. z
  20. * kind, whether express or implied; without even the implied warranty3 M7 q* @1 L( n7 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 ^- L2 n9 R* l1 ?' z+ E
  22. * GNU General Public License for more details.( r1 w# Y3 a0 T6 ~; Y
  23. */" ^; r2 `; B( B& F7 Y

  24. % ]$ |: c: e/ ^# e) M
  25. #include <linux/module.h>
    3 O$ J7 v" r8 w( t# I3 @
  26. #include <linux/init.h># k. @/ v5 E7 d
  27. #include <linux/errno.h>
    2 |, G+ a6 D) C5 P1 L5 M
  28. #include <linux/types.h>' J2 }6 W8 E/ N$ H7 G& N. ~
  29. #include <linux/interrupt.h>
    - L5 @7 h3 |0 K! W, y
  30. #include <asm/io.h>
    $ i. l1 q0 `0 h% E% w
  31. #include <linux/moduleparam.h>
    ; h+ [+ v% k6 g& V5 I9 ]; [
  32. #include <linux/sysctl.h>! c! L2 t2 }5 J/ ?7 o1 p: ~5 S
  33. #include <linux/mm.h>
    : S2 @2 _& Y2 @% t
  34. #include <linux/dma-mapping.h>0 H, C6 p4 A2 N3 p6 L6 q
  35. ' b/ o- C: s! `. K
  36. #include <mach/memory.h>
    3 P  k5 }+ [) U# Q) A/ g
  37. #include <mach/hardware.h>
    " q3 [/ m/ S9 S5 @
  38. #include <mach/irqs.h>
    # G* c- c0 m4 ~& E+ q' @2 G7 F
  39. #include <asm/hardware/edma.h>
    " G* ]1 x* ]& S1 A/ G! q( K- V
  40. . |% P7 s  Z+ ^5 k; C$ |
  41. #undef EDMA3_DEBUG
    8 [3 N" w; v" S5 K: k0 ?# c
  42. /*#define EDMA3_DEBUG*/
    2 ^& H" g% m2 X% o6 X4 u
  43. - Z: n9 T) [, H. V5 g* r& ~8 d, u4 ~
  44. #ifdef EDMA3_DEBUG
    1 @: l" w$ ~; T- ?, S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- a. S! u5 @* b+ |/ v/ P  j) i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 a/ p- t, n( q* _2 l* W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 p/ F# O8 k7 N( ^- L/ x
  48. #else
    : G+ s( \. f( _; \8 T
  49. #define DMA_PRINTK( x... )6 M5 ^( a* [0 E# t9 P
  50. #define DMA_FN_IN
    0 X6 a$ x! S  t+ p; T( ?. z3 i
  51. #define DMA_FN_OUT
    & k6 j1 r6 p8 j! m; f
  52. #endif+ K, z  e  B3 q7 V. j' y

  53. 8 z4 y$ R, ?( R; c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 s8 w$ Y; ?5 r) o7 J
  55. #define STATIC_SHIFT                3
    , R: U- N8 [5 Q4 g
  56. #define TCINTEN_SHIFT               20
    5 j/ Q- {% G) S0 h' {
  57. #define ITCINTEN_SHIFT              21
    . l( ]) ~# ~6 ?, Q+ b. ?
  58. #define TCCHEN_SHIFT                22& L/ Y" k* j; ]7 J8 E4 q8 c
  59. #define ITCCHEN_SHIFT               23
    + {9 s) _3 |4 O  S0 x* u+ l

  60. 0 A: |. O( ~& [5 j. D5 P
  61. static volatile int irqraised1 = 0;
    & L$ N  ?, a4 l8 f% L5 x
  62. static volatile int irqraised2 = 0;
    6 O; @  S& o1 Y$ y
  63. ( d9 b" X8 \5 ~! [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 p: `8 Z( b6 S0 J* j  _1 O$ q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 @; A7 @. e/ F  o% }8 i$ h' i% a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' @6 c, U% x4 a4 M
  67. ; H9 T0 K4 o; h3 Y% K
  68. dma_addr_t dmaphyssrc1 = 0;, M+ L5 E% D$ p' O+ v
  69. dma_addr_t dmaphyssrc2 = 0;* E+ I5 q, x% l2 S% B# c
  70. dma_addr_t dmaphysdest1 = 0;
    / I2 B# x9 e, {- S. @& L, R
  71. dma_addr_t dmaphysdest2 = 0;2 ~# q9 Y' j" r8 b, C
  72. % U" F9 a0 B: W& g$ J1 N! U
  73. char *dmabufsrc1 = NULL;
    ( l$ l2 O$ V6 L4 N( k4 ^1 ?# ]
  74. char *dmabufsrc2 = NULL;6 A4 p2 p/ k$ ]5 M/ L6 X- u) E, {
  75. char *dmabufdest1 = NULL;0 T) D; h/ r, p5 b4 Z+ a
  76. char *dmabufdest2 = NULL;  Z0 M6 K( @8 E0 |1 r. D7 M
  77. % ]( w6 `8 n0 u) y" H$ X0 H, K
  78. static int acnt = 512;
    + `! L; z3 Q4 u5 Q1 q
  79. static int bcnt = 8;
    9 v5 A) b$ Z. a6 n* v! N0 t, ?
  80. static int ccnt = 8;
    ; D# e$ |' e3 j, a- F, h8 P
  81. ) G4 j  v# E+ a# `) ]: B
  82. module_param(acnt, int, S_IRUGO);% m* N# F0 s6 ?6 s( T+ }( S; s
  83. module_param(bcnt, int, S_IRUGO);
    , V0 h6 `: ]# Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ N3 G) C* |. j# w; w7 ~) y8 r& R, j0 E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& I& ~9 x8 w5 ^* s# u, [- l) qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 U2 B" {4 B8 e3 w( e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 m+ k5 z; h+ |+ m( s- b' S, X
8 K- t0 p8 X, h; {2 R

3 Q6 |8 Y. u  E- G" G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 10:27 , Processed in 0.045643 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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