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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & s9 P& k. q6 h9 B  Q2 M- {
  1. [code]EDMA sample test application4 q8 h0 f; S+ P( o3 L2 t# m
  2. /*7 Q' L1 ~* |% f) E' [/ u
  3. * edma_test.c
    # g. E2 L7 J* L$ o' K# |; J
  4. *
    ! p  c4 a2 U- N! v) G) a
  5. * brief  EDMA3 Test Application* V( a0 D; ]  I: q) B) y: G# j
  6. *
    7 [( E8 E" B- J4 R2 B. N  o+ `" W& p
  7. *   This file contains EDMA3 Test code.
    - W" C' B2 V" `5 i
  8. *
    ( c3 o  h. f  u* ~. C. U* R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 |: y& P5 h- ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 p: L1 M: T5 _4 w6 W; ]9 T
  11. *         TO CHANGE.
    / ?& j( Q. @* C7 |+ v+ R
  12. *7 Q9 p3 ~1 \/ z/ n2 x# L: D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + C0 k: [/ {0 ~$ o& r% v
  14. *
    2 o9 ?* L6 S8 ~$ g6 l
  15. * This program is free software; you can redistribute it and/or
    $ Z& v" |* H2 C; u9 a
  16. * modify it under the terms of the GNU General Public License as1 T, W4 o' s  o, k
  17. * published by the Free Software Foundation version 2.# g% ?" E( m& b  U
  18. *3 z/ X! f# P# P( Y' Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 d4 d. D* _" W5 l  J
  20. * kind, whether express or implied; without even the implied warranty
    : m! m- H4 A8 V. f& M! B. [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) l/ `- I* B3 J
  22. * GNU General Public License for more details.% K9 t" f1 _& v' M: \! @) E
  23. */
    , s" `. Y. M! O5 I& @- C4 P
  24. # T( v& C) y. Y. }% g2 i
  25. #include <linux/module.h>" d6 J" E+ z2 q; {; m- i0 d7 p
  26. #include <linux/init.h>( C+ b. Z" {# i$ _3 s& M6 }- @
  27. #include <linux/errno.h>$ y; L- I; G4 I! ^
  28. #include <linux/types.h>; a$ I, }8 @. J; N. [7 c
  29. #include <linux/interrupt.h># b7 b& i2 ]5 J/ D' ]) V% H- P
  30. #include <asm/io.h>
    8 P6 c4 n- Z  R; [
  31. #include <linux/moduleparam.h>0 Z: v, g6 T6 o( m
  32. #include <linux/sysctl.h>
    : v  P) `* D& P! {% _
  33. #include <linux/mm.h>
    / e9 Q1 p/ f0 {9 M) `& v& v
  34. #include <linux/dma-mapping.h>. U2 ~' G3 J! U9 ~" e- |6 e: x5 I
  35. ( I4 f" z2 }. ~
  36. #include <mach/memory.h>" T6 q5 s/ [% J9 M
  37. #include <mach/hardware.h>. D1 r9 }; L5 T. e
  38. #include <mach/irqs.h>( q' f, M' I* `  l5 N9 c+ ?
  39. #include <asm/hardware/edma.h>
    3 a& \' ~5 I# {5 s

  40. ' w" [+ ]: x1 z4 f* w
  41. #undef EDMA3_DEBUG+ D! F2 h* G0 |5 u) o- g* E: L
  42. /*#define EDMA3_DEBUG*/4 E" A. L3 W. Z* ?# _, L% _- x0 g

  43. 5 o) k$ ?  K6 X7 r
  44. #ifdef EDMA3_DEBUG
    0 c: J; x9 P& m  ^* Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , K8 B# b* j' f% b: U) ~6 u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ x7 i8 O7 U; `% S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% {" ~$ E: P6 l7 ?4 l( V& }# X
  48. #else
    ( V3 m' G9 P; J2 p, `( W
  49. #define DMA_PRINTK( x... )
    * L8 B# x1 D: m1 |0 M
  50. #define DMA_FN_IN
    $ U5 @% Y, h/ K: T- J0 Z+ s5 X
  51. #define DMA_FN_OUT2 Y( I6 a9 i7 o' N, B! V
  52. #endif& r6 Z$ ^4 V$ f& {
  53. 1 K/ e8 p2 J6 D. I: a! q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 b4 _) |4 c. p# ?. w3 D
  55. #define STATIC_SHIFT                3. C% K( D3 b. s  {
  56. #define TCINTEN_SHIFT               20$ y1 Q8 x8 A. E, Y' ?3 b  p
  57. #define ITCINTEN_SHIFT              21% u# C8 B( d1 D- h, w0 u" h
  58. #define TCCHEN_SHIFT                22
    / z; y9 F. y( U" |
  59. #define ITCCHEN_SHIFT               23
    * _* Q$ V+ T* y) e) o7 G0 G+ {
  60. 5 y/ e! S  {) T) c* s5 R. b0 d
  61. static volatile int irqraised1 = 0;8 t# y5 q, ?' W; \( R
  62. static volatile int irqraised2 = 0;
    1 }. l; n7 }2 t; v( y2 n

  63. ' a% _. j$ f5 W3 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  v- d, Z" l" W, i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; i0 n  i  m5 E! K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / R- B7 a6 e1 T1 m8 O! o
  67. ( R. L' @+ `* d9 ^. S# d
  68. dma_addr_t dmaphyssrc1 = 0;
    2 T' W: x9 Y/ _: i. o& {0 ~; b$ y$ K
  69. dma_addr_t dmaphyssrc2 = 0;
    / [+ i- C1 x2 I3 _- m- A, C
  70. dma_addr_t dmaphysdest1 = 0;
    + [2 V  J/ Z' o
  71. dma_addr_t dmaphysdest2 = 0;
    8 l6 c- E+ f9 G
  72. : e2 b* |5 K6 U( {) Z% p9 U
  73. char *dmabufsrc1 = NULL;
    2 `& j8 l  ^1 p( X7 \& N  g
  74. char *dmabufsrc2 = NULL;4 t" R  g/ ?0 X! e' K, \$ m
  75. char *dmabufdest1 = NULL;
    $ \; V$ Z: E: _4 ~, E
  76. char *dmabufdest2 = NULL;5 o1 }& j" X. d- N

  77. 7 \5 L& F/ S7 K. G% Y2 U0 A
  78. static int acnt = 512;
    $ v1 G# K' l. C, |
  79. static int bcnt = 8;# c& Y. y8 o5 c
  80. static int ccnt = 8;
    9 q- N: Z' N$ `' W
  81. 8 `5 l9 E% ~+ e% B3 `& {
  82. module_param(acnt, int, S_IRUGO);
    % p1 N" x3 V% A3 g4 l
  83. module_param(bcnt, int, S_IRUGO);! `! {3 `5 A- m& m7 R3 F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 o, |+ D: z3 E, u

* t( p! _. ~3 v5 Y: u5 U. O+ T. _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& [% k* n2 j3 o; \2 E8 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: A  w6 c% I1 O- q- B) S8 C" h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( |$ t0 {4 ^' Y- _! W; e( v0 D0 G+ O1 v; m

4 U, z/ J* r$ g! ]$ v- I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 22:43 , Processed in 0.043066 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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