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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; Z8 c3 }- U6 k1 R' ?
  1. [code]EDMA sample test application8 q2 ], C5 q8 n2 v- {
  2. /*5 V$ L# C( P1 p1 F
  3. * edma_test.c% h1 q8 B7 r* t1 N' D4 p
  4. *
    4 a0 v& q) V* N9 i" R1 K5 ~/ Y7 u8 N
  5. * brief  EDMA3 Test Application; L5 h$ d; e# i1 ?, {- z  ?- R/ x2 a! k
  6. *. j- ]) W, c2 B9 |$ g% s
  7. *   This file contains EDMA3 Test code.
    ( N$ g0 U) S6 R; W2 Q& l
  8. *1 d; Z4 \9 U2 F. ]! ~5 s  ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' f, J9 H7 b$ Z+ p: P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" ?# ~# }. Z7 m9 D- L* d; e  O
  11. *         TO CHANGE.! W) f- L& z" ^( ]  b  U
  12. *  p  I4 |' j  P4 g& h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) I+ D4 b0 c5 G! {
  14. */ o% P( w: W& ~% P1 w1 L
  15. * This program is free software; you can redistribute it and/or
    2 v" \+ F8 M& T5 h
  16. * modify it under the terms of the GNU General Public License as
    5 p, n+ R: S$ d6 o9 B, p- y
  17. * published by the Free Software Foundation version 2.
    " n* m; r- R4 p/ S
  18. ** e, G* {7 M! w: Z$ @- o9 r$ e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ V: @8 M# ~+ r- f1 o9 F+ n
  20. * kind, whether express or implied; without even the implied warranty, O; _/ V1 [( `, |1 J/ c9 j" r# t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 A3 z% v; A) b1 w) z6 j+ ~
  22. * GNU General Public License for more details.
    9 P) H; ]' ~% \4 D) P
  23. */
    : Q' O) ]1 Z' I. w8 T

  24. # ]9 Z6 A0 n0 v/ G* @
  25. #include <linux/module.h>' U# L! V3 n0 G7 }' T
  26. #include <linux/init.h>
    & w% W" f6 S2 z$ _
  27. #include <linux/errno.h>/ `) R$ x% Z+ v* Q
  28. #include <linux/types.h>
    ! y* W& D: F' r$ A$ h
  29. #include <linux/interrupt.h>9 K2 S: |; g; p9 x' n0 ]3 z
  30. #include <asm/io.h>4 L, s+ J" C7 O/ F- D
  31. #include <linux/moduleparam.h>; v2 q9 r! Z3 p, E
  32. #include <linux/sysctl.h>0 [, x7 i, e1 e
  33. #include <linux/mm.h>
    : H4 g# I3 l6 E- y" W5 v/ w
  34. #include <linux/dma-mapping.h>. \5 f2 [6 c9 _9 j1 R/ ]

  35. 9 D6 ^3 @5 _% l; z6 M1 `" M
  36. #include <mach/memory.h>
    ( C4 [6 s+ j! Q
  37. #include <mach/hardware.h>
    : t6 i9 Z8 Y8 B& w
  38. #include <mach/irqs.h>
    ' I* m( u4 q( H8 R
  39. #include <asm/hardware/edma.h># P- s! g- S; s( `8 O
  40. ) T) O$ a0 C! u% x$ b0 h( x( a' z3 s" Z9 K
  41. #undef EDMA3_DEBUG( i, ~  ]- ]- Z9 L* r$ m. n
  42. /*#define EDMA3_DEBUG*/) E3 f' p( @: g
  43. : R9 s* Q  W( M$ {& x
  44. #ifdef EDMA3_DEBUG
    0 l& x8 T2 x( g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # k  f& _! N9 \4 \6 b" O/ H) ?( D* }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! z6 J6 |5 q4 u: C- ~8 Y6 ]( M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . g5 n$ z/ }9 a2 h
  48. #else' y- o: F9 S3 L% C. R/ |
  49. #define DMA_PRINTK( x... )
      Z: u! W$ A5 K0 d% I! r7 e7 _
  50. #define DMA_FN_IN% |7 w) F0 w3 ]
  51. #define DMA_FN_OUT
      ~& \/ n5 G0 Z4 F, C
  52. #endif% s: E3 m% h0 ]6 I& K
  53. 1 c' {$ {& {" @# h; l# g) U- T6 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! g* b6 B7 E3 [+ ]+ ~
  55. #define STATIC_SHIFT                31 p' w& u  [& m' G
  56. #define TCINTEN_SHIFT               200 H( c7 D3 r; D& G/ G
  57. #define ITCINTEN_SHIFT              212 m5 F' p1 t" z( o, _) P
  58. #define TCCHEN_SHIFT                225 }; T* G& H& J2 N7 Q
  59. #define ITCCHEN_SHIFT               23* s. }' f: a5 F2 W) V+ B

  60. & V+ e2 ~/ c. n) `" `$ w/ {
  61. static volatile int irqraised1 = 0;
    0 y6 a. t3 o0 q
  62. static volatile int irqraised2 = 0;5 b4 P5 ~, H5 k. R! _" ^  ~' n

  63. 6 X6 n8 D1 v6 ]) M- s/ X: t' t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  B3 }; h- c/ |. s! U! M" I' F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 s# t6 S2 l  u; v7 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, {5 x3 I/ h. ~1 b/ r2 y2 d

  67. 7 h; }! Y8 ], ]2 g( V0 x# ~0 \
  68. dma_addr_t dmaphyssrc1 = 0;
    " b' w# l2 q, {4 n& Z* o+ ]
  69. dma_addr_t dmaphyssrc2 = 0;: N+ s- r$ C3 X
  70. dma_addr_t dmaphysdest1 = 0;
    + N  H" k; p( I, V/ |: h
  71. dma_addr_t dmaphysdest2 = 0;7 S8 j; h: ?. _
  72. 4 f) ]5 u, w! @
  73. char *dmabufsrc1 = NULL;2 n- L+ P5 j# ]' W' X) a1 O- q
  74. char *dmabufsrc2 = NULL;: M3 Q) \" Q( l2 P+ |
  75. char *dmabufdest1 = NULL;
    6 w1 s' ?0 m# Z  |
  76. char *dmabufdest2 = NULL;
    + G9 \! x* Q- X8 {( P+ m

  77. , k( j" Z% b; L
  78. static int acnt = 512;
    - i+ l# G) |( D/ u4 u
  79. static int bcnt = 8;# Y+ A6 D7 n0 _3 b1 L& |
  80. static int ccnt = 8;
    ' K! w# f6 h# F" w
  81. . {6 G& e9 C9 J; E( W2 k/ L/ Y
  82. module_param(acnt, int, S_IRUGO);( |; P" Y% E- ^- y6 y
  83. module_param(bcnt, int, S_IRUGO);
    - _+ r  M6 V% @+ K+ j/ W5 U, }( g  N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 C) n0 S8 i& k9 w5 s3 w1 Z
3 |6 ]$ I: f" w6 W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 J( p: @$ T8 }* Y* j& yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: A4 N: _0 V5 m$ d' v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: y0 ]/ o3 s7 T/ B' P, |6 y
( w1 M- k- y5 D# i
' @% Q1 R" b5 P0 y1 o: C( R) _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 01:04 , Processed in 0.040917 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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