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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # `/ J( G- o" q5 g4 e
  1. [code]EDMA sample test application) l$ U7 D) G- c- }" w# Z* b) z
  2. /*
    % o+ f* u6 S+ `; j# a6 u. j) h
  3. * edma_test.c
    1 p( j# E- M( l) c8 x
  4. *
    9 r& W, c& R* t! \8 A4 }
  5. * brief  EDMA3 Test Application3 I5 k7 l/ _* D2 H# H! B- g
  6. *
    - W- \$ F2 d) U. ^4 Z
  7. *   This file contains EDMA3 Test code.
    % \: G8 \+ W9 _
  8. *
    % ]4 ], b, _. w+ O$ ^6 p7 T: l, k0 v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - d) \8 N! t' e1 k* [6 r7 \) E- [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  {  r4 t# C5 R4 X$ P$ j7 @0 ?( [' z
  11. *         TO CHANGE.
      ?/ V6 ?/ Y# v- p1 `# y
  12. *
      W* H% C1 D. D4 U8 X  ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 A3 a& ]  X9 y  u6 c0 d/ ~" s
  14. *7 e- B3 L4 ^3 t7 {' `" P4 W
  15. * This program is free software; you can redistribute it and/or) B' I1 X8 T9 b+ C' ?* h
  16. * modify it under the terms of the GNU General Public License as' ^5 |8 D7 M& `# Y. ?3 L& `; j& {
  17. * published by the Free Software Foundation version 2.& Z8 Z5 }/ t5 `5 v" f
  18. *: J* S- f4 p+ K% j8 m' H6 \# G0 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 l& D, y) r- F9 \
  20. * kind, whether express or implied; without even the implied warranty( i* I5 k' i6 I' R7 r6 V% t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* `5 ]) X% T: V
  22. * GNU General Public License for more details.
    ! [4 N# j4 S( i% ]1 j5 V
  23. */
    % D4 k+ A% G, s  L. `- x

  24. 0 c8 q8 _2 p; V
  25. #include <linux/module.h>/ |+ ?4 G3 G" d4 u
  26. #include <linux/init.h>0 Z9 G, E" U, f% x: g
  27. #include <linux/errno.h>
    - z, J# S: _; K$ I4 f
  28. #include <linux/types.h>
    ; {1 f& R$ N0 @# d
  29. #include <linux/interrupt.h>
    8 k, m4 O: e- D# g& ~! ]
  30. #include <asm/io.h>7 y3 a4 d! w. |
  31. #include <linux/moduleparam.h>
    $ \6 e' D  g5 G# L
  32. #include <linux/sysctl.h>
    : O5 p- X  P7 X, V6 a% O2 Q
  33. #include <linux/mm.h>9 K. T1 z- v( I8 I
  34. #include <linux/dma-mapping.h># r: y' a" R7 o! c

  35. , U; P/ z* c; T5 Q. a; I  A" b5 c* N
  36. #include <mach/memory.h>
    $ Z7 s5 B: E% Y- d3 c& @% U
  37. #include <mach/hardware.h>
    3 L! f8 t% c3 [: \
  38. #include <mach/irqs.h>
    1 V9 }* D4 @! ]' P4 e# v
  39. #include <asm/hardware/edma.h>
    : t6 u% g, }6 _
  40. " Z$ S' s7 N1 W/ _# @* v
  41. #undef EDMA3_DEBUG& |5 b$ d5 q1 i. H: b6 i0 E
  42. /*#define EDMA3_DEBUG*/
    3 N0 I# y; k. Q+ [4 I3 u
  43. 1 O$ K# m' D$ S! y& O9 R; t
  44. #ifdef EDMA3_DEBUG
    8 L  L5 n+ Q5 g1 }6 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # Y% w  y  z& A! Y- U0 h. F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + o5 S, Z9 H. K; P& L6 n' O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) Q& c" ~/ U- u/ d  `2 M
  48. #else
    5 H3 g5 V' R4 J( t, Z" G0 O
  49. #define DMA_PRINTK( x... )
    . E0 s+ N8 }6 \) W$ n: z' R6 z9 S6 m6 @
  50. #define DMA_FN_IN, V5 ?- ]; M! P$ F% k* j
  51. #define DMA_FN_OUT
    : J8 ~- m6 ?6 v/ l& @/ q
  52. #endif1 I% ]* T, h' ?0 l+ K

  53. 6 B8 p8 D, M! d  Q- R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * `& c- P7 Q( ^; G5 @6 v: H* r+ S
  55. #define STATIC_SHIFT                3" r* ?' ?! \! |# N
  56. #define TCINTEN_SHIFT               20: C: _2 l3 _9 W3 s: e9 d
  57. #define ITCINTEN_SHIFT              215 e! [8 q/ }! U& U6 X; ^
  58. #define TCCHEN_SHIFT                22% F! G7 P; Q/ S# J' Y. {/ a: ~" Q
  59. #define ITCCHEN_SHIFT               23
    # x' A* }) `$ e. P2 O! h. z' p
  60.   R7 I1 k5 b) x) Z" d* Y
  61. static volatile int irqraised1 = 0;( b/ P1 O! q( u( P+ j' X
  62. static volatile int irqraised2 = 0;& g" H3 f$ O2 {3 }: ]/ C
  63. / N3 w: k" p/ y7 p  j" q1 H( o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 N) c! T# {7 Z- i7 y8 S% O  C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 X5 {1 N; f; u# t2 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! C2 {$ I0 c5 H, Z' W$ _5 a

  67. " P% s! D9 ?( Q  f0 x
  68. dma_addr_t dmaphyssrc1 = 0;
    1 d% ?8 h: F& Z4 A
  69. dma_addr_t dmaphyssrc2 = 0;1 ?: {. x( q9 K( s
  70. dma_addr_t dmaphysdest1 = 0;
    2 @: x1 k* R' b, ~; F& m1 H3 P9 M: b
  71. dma_addr_t dmaphysdest2 = 0;5 B" g9 g9 x& f+ v+ P  L
  72. % V$ D+ I- X4 v9 n* P% M( I' u7 R7 P
  73. char *dmabufsrc1 = NULL;9 s0 n* K7 |/ H4 _( ]6 u( g" p
  74. char *dmabufsrc2 = NULL;4 t( r- e0 o; Y7 _. p
  75. char *dmabufdest1 = NULL;7 p5 o( S* M9 r4 J+ H: H' R6 z
  76. char *dmabufdest2 = NULL;3 K5 B, J- d* N  b! S' \
  77. - O0 R4 r% M2 n: m
  78. static int acnt = 512;: d. M$ H. v) c8 m
  79. static int bcnt = 8;4 y/ P. z! x3 P# J# _# z
  80. static int ccnt = 8;5 ^1 d4 [- o! F( B8 E; X0 N$ A6 c
  81. - o, j& }. Q* @2 V7 z# X$ N
  82. module_param(acnt, int, S_IRUGO);# x( d1 ^% P0 p. U0 R& n8 N' I! j
  83. module_param(bcnt, int, S_IRUGO);; \5 R" j+ V. H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 K8 B. ~; T; f7 C. w  [
( D4 F, a  t' v9 u) M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( N1 a5 H! b, e5 f3 g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ F9 a" Z" {. [. ~, {5 I; t% P3 S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& e( g2 b1 }5 G: Y5 |

1 A- k2 L- T2 s7 h
0 x' a6 v  W" o* C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 12:26 , Processed in 0.038839 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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