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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 e9 i& |: t  x. q4 N; f
  1. [code]EDMA sample test application" \$ F* Y$ _, I' M- P; \4 Q& U
  2. /*
    * E8 A6 C- I/ D
  3. * edma_test.c
    ) V& ]% ?5 h# p3 `% \6 ~* a
  4. *
    ! d! W* ?+ G! C8 _2 }
  5. * brief  EDMA3 Test Application6 k/ K4 b% ?$ E2 }' z# }; Y
  6. *, r. M: I  ?! m: T
  7. *   This file contains EDMA3 Test code.# n4 Q) v# ^+ t
  8. *- U  o  L/ g6 e7 G2 U( l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ S; C# q$ K# `$ ~1 f% ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* X& X2 f, ]8 ~' j# ]5 J2 ?
  11. *         TO CHANGE.1 R, n% \7 g5 s& A% y$ q
  12. *! B0 ^  l. y# _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" `/ w, M3 r( a- _: I8 w, Y* Y
  14. *
    5 V3 K$ j* s6 D0 H- o1 t4 B  U& \
  15. * This program is free software; you can redistribute it and/or  z9 L$ M: w2 {' J5 r! X# P
  16. * modify it under the terms of the GNU General Public License as( ?) J1 y1 ^( |1 J' H; F, V' S  K) c
  17. * published by the Free Software Foundation version 2.' r" R- _) ^+ H9 @5 @4 E
  18. *
    * B+ E( Y4 ]- _9 B' }* c7 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / L0 C* A% @- d! ?' j
  20. * kind, whether express or implied; without even the implied warranty! X! ?# G$ D- F+ Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 y% n: j# [/ f$ P* j! _
  22. * GNU General Public License for more details.+ ?/ E% h1 S. ]8 g# C6 [1 U6 Y
  23. */
    9 y7 |3 z( `0 [. d$ l
  24. ' A; e$ n' ]# p
  25. #include <linux/module.h>1 n$ Y" H  U( w, _  a! X
  26. #include <linux/init.h>. W7 y6 }3 j9 c5 L1 a$ U" L
  27. #include <linux/errno.h>
    # w* L' E9 _1 U
  28. #include <linux/types.h>: R4 U- f9 G5 t% }# J4 ?0 I# `
  29. #include <linux/interrupt.h>
    ; N. F& d" }# x: {# b4 a" ?
  30. #include <asm/io.h>, v0 }0 v/ q5 `8 l
  31. #include <linux/moduleparam.h>. Q% @* U# N" U- ^7 L$ @' z4 j; u
  32. #include <linux/sysctl.h>
    ; l8 J$ j1 u& ]. W* X+ X  l# A
  33. #include <linux/mm.h>
    3 p1 G7 }5 w- {8 `, M  p
  34. #include <linux/dma-mapping.h>
      n# U1 T; t7 ?+ U) \& h  J

  35. , i( t8 Y  s7 C) z# R& {" ^' {6 l) I
  36. #include <mach/memory.h>6 E3 D- v. _6 q8 `! Z4 N
  37. #include <mach/hardware.h>
    , ~2 F6 b/ B% n3 [
  38. #include <mach/irqs.h>
    2 y8 V8 y0 n( g4 c9 X. ?* E  {
  39. #include <asm/hardware/edma.h>) F( ], |/ ^2 ^
  40. & A% ], K% J  S* j
  41. #undef EDMA3_DEBUG
    ) R1 v% j0 [: a" w7 p4 d
  42. /*#define EDMA3_DEBUG*/$ a6 r; s! o' D( }5 X9 F
  43. % }+ }' H2 p+ B. _3 k; Y  P
  44. #ifdef EDMA3_DEBUG4 Z! q1 B. t3 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# c2 x7 Q4 l7 n) @1 C. x  {( N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 y/ V; v) P4 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), F% e; w8 f! {( t: F7 y
  48. #else
    0 u. |" u( \4 T9 u  S
  49. #define DMA_PRINTK( x... )1 m% \# U9 c( R6 E) n
  50. #define DMA_FN_IN0 M  v) L6 |' n0 r
  51. #define DMA_FN_OUT
    2 b8 o: R$ y8 i: I( |
  52. #endif  C2 D0 o  ^& a( N6 N8 ^( Y7 c
  53. & W7 O8 H7 t. S3 Q" E4 Y' ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 h& R6 e2 c# x2 D
  55. #define STATIC_SHIFT                3
    5 W( c- u# s! @9 Z9 l
  56. #define TCINTEN_SHIFT               20
      K1 J: @- d! b% ~. q
  57. #define ITCINTEN_SHIFT              21
    $ z! O3 y4 T" U: }# Y
  58. #define TCCHEN_SHIFT                220 S; b# z: w9 }9 ?0 L& p& c7 _
  59. #define ITCCHEN_SHIFT               23
    % C6 s2 w' K' p6 l3 H

  60. 1 \- L# C3 M) o5 s, S" a
  61. static volatile int irqraised1 = 0;
    6 C  W& v4 M6 V7 p/ H
  62. static volatile int irqraised2 = 0;
    3 j5 V: F/ U, k4 u! o+ N
  63. ( l6 w# h! A0 [6 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 N5 [0 J2 A# Y( C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : _$ w  ^0 Y! ^0 B- W5 d! }5 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & W5 L5 Z: [7 n3 o1 f
  67. # ~- }( P4 T- ~: y5 f
  68. dma_addr_t dmaphyssrc1 = 0;
    % `  s% R5 x/ k: I1 P
  69. dma_addr_t dmaphyssrc2 = 0;
    ) Z* h+ h1 M+ U. f# F- X) C
  70. dma_addr_t dmaphysdest1 = 0;  O5 ?: d2 k" n' g$ `, e2 x
  71. dma_addr_t dmaphysdest2 = 0;- T4 U9 s8 P1 ]# f% P8 d
  72. 6 z3 z, [7 Y4 ]8 f4 N$ m
  73. char *dmabufsrc1 = NULL;
    & A  _) G4 |  M0 W: z
  74. char *dmabufsrc2 = NULL;
    7 b4 u/ {8 O/ l; w/ [6 ~: b
  75. char *dmabufdest1 = NULL;5 {# [  C) i, m" d
  76. char *dmabufdest2 = NULL;
    " Q1 j! \9 ?& U+ o5 I

  77. / n! `& L  v7 ^  p3 b; v1 H; A
  78. static int acnt = 512;; h# Z6 [2 [/ q5 |: D- ]  ~
  79. static int bcnt = 8;8 d6 z4 C6 u' |- W/ P6 {
  80. static int ccnt = 8;
    / l& o/ x/ @& Q+ h9 V

  81. " u/ V7 v$ S2 g/ y) x1 i
  82. module_param(acnt, int, S_IRUGO);. l- q# o) }% `! s) K
  83. module_param(bcnt, int, S_IRUGO);
    4 `. o! \) Y) G8 n2 G$ S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) m9 ?. P' b: v

! O$ g! }$ X. ^4 @5 v; b, \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 g" A9 q% J8 ^- g9 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 q6 |; D% H1 s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 n: y, t0 e% w

2 g) X# G: X5 p# v# r( b' D6 v2 i$ m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 14:17 , Processed in 0.038961 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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