OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . `; E4 B: e& Z; M; i
  1. [code]EDMA sample test application3 L. ?! F% c, `; G6 B$ n8 d
  2. /*
    % O) d5 {) Y1 h4 S- W" }% T2 W- C
  3. * edma_test.c
    + U3 |  L2 b/ s& j; p/ i: e
  4. */ J$ q/ \: V/ h" Y+ x
  5. * brief  EDMA3 Test Application
    - ?. z8 m" u* N; {% C; a- [. x
  6. *, p4 e( g- `2 C& n+ b3 X
  7. *   This file contains EDMA3 Test code.
    $ D* Q3 e1 Z, r+ R) E4 F1 S
  8. *
    * a6 w; Y: b2 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * m: i+ a* N  h3 v" v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  I' G9 t; T7 Z
  11. *         TO CHANGE.
    * o( q0 s3 a0 t6 {3 V
  12. */ ]: i7 I( P; a5 p5 `6 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' z* Y2 I# q  E- K
  14. *
    . E6 s" a. o) M
  15. * This program is free software; you can redistribute it and/or+ j* V' Q% U9 m) }. I1 L4 ?! R
  16. * modify it under the terms of the GNU General Public License as
    " M8 U$ `: |9 U, w: G) S% n4 [
  17. * published by the Free Software Foundation version 2.
    + v8 }5 X  u/ X) C  T* f
  18. *4 e3 C6 Z$ k) A7 B  z! B7 u2 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; H' p- W  }. B. t/ [% r# k4 [& ]
  20. * kind, whether express or implied; without even the implied warranty
    3 D, v2 ~4 g6 D* k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ I5 T! M: M- a* y0 A/ D1 j/ `# B
  22. * GNU General Public License for more details.- ~) {0 Q, @) T' w% Z7 ^
  23. */
    0 M9 ?8 P) f6 v+ I

  24. & H! w) q6 g5 a! K: g; m/ O
  25. #include <linux/module.h>
    : P* @; h. C5 ^! N# W$ w$ X9 S
  26. #include <linux/init.h>
    - E) T; n+ X7 G7 B1 V& e& y' j
  27. #include <linux/errno.h>
    / ?; e1 N7 L8 u  g9 f. {
  28. #include <linux/types.h>) W5 y# Y. H: E6 k/ r, W6 d2 a1 t
  29. #include <linux/interrupt.h>
    ( ^  G+ |1 L- a8 {
  30. #include <asm/io.h>: T4 G7 j* t9 G. X4 [
  31. #include <linux/moduleparam.h>4 h; j- O. P8 |" q  N, [4 c
  32. #include <linux/sysctl.h>
    9 ^4 s& a  J8 k
  33. #include <linux/mm.h>4 S: R8 r$ x( _6 z& Z
  34. #include <linux/dma-mapping.h>( {& @& b2 a& |2 f

  35. 2 B& z# _) q- t
  36. #include <mach/memory.h>
    & n6 F. N4 n# b4 x7 n3 o
  37. #include <mach/hardware.h>2 l  ~5 }# f0 M5 K
  38. #include <mach/irqs.h>
    ; U8 C' x1 S* c
  39. #include <asm/hardware/edma.h>
    9 a  f( q; @9 W3 U

  40. & B$ _/ ?2 ~) p, W2 \
  41. #undef EDMA3_DEBUG
    0 G/ F, u& R7 h7 L, F! M0 n
  42. /*#define EDMA3_DEBUG*/
    0 S1 V- V2 O  |, G) R
  43. ) s% g- E( R% \
  44. #ifdef EDMA3_DEBUG2 I5 S3 q( c. m* \! O; g" l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- ?3 }$ v& _( v) a4 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( Q" u1 F7 U+ k  @& \! J! m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 c- U2 b& n" @2 N: X
  48. #else( w& w" S) J: ]$ G
  49. #define DMA_PRINTK( x... )+ f& y' w6 v& J" x8 n) {4 |
  50. #define DMA_FN_IN
    : B; S. g# K  b# C& O, [
  51. #define DMA_FN_OUT
    ) n3 }0 z- `0 `( @4 ^
  52. #endif; m0 F! G( n7 j. w
  53.   H9 k  [, E- q: H: S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- T1 ]1 a0 O, p4 U: ^3 r! ^0 J
  55. #define STATIC_SHIFT                3, p, ]7 B7 t3 Y6 Z  t1 L
  56. #define TCINTEN_SHIFT               20
    / \# N# J- s( |" j
  57. #define ITCINTEN_SHIFT              21. e; X1 j" X3 S
  58. #define TCCHEN_SHIFT                22
      I. \& t" j2 R" b5 r( v
  59. #define ITCCHEN_SHIFT               23
    ) n: G* ]4 f; F% E" ~

  60. : R" W* E" i& f1 }9 ?
  61. static volatile int irqraised1 = 0;+ N0 E7 l; g; ~- c# E
  62. static volatile int irqraised2 = 0;) F8 ^  E+ `9 J& ^9 V. W/ {  t9 f+ ~9 y
  63. 0 o/ d  C$ Z' o7 B/ {% Q$ ?; n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  x5 [. J+ G5 E; \2 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ?& g; J7 F2 l+ S/ g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* N% r  B5 y/ W4 a

  67. 4 h8 i0 `9 i0 K0 M5 p3 M" `% p/ n
  68. dma_addr_t dmaphyssrc1 = 0;: z2 H5 ~8 L( ~; \
  69. dma_addr_t dmaphyssrc2 = 0;* \7 V8 e, o; X6 N- s0 P) X
  70. dma_addr_t dmaphysdest1 = 0;0 `' K# q% \) I; Q$ r+ U
  71. dma_addr_t dmaphysdest2 = 0;0 h6 Q1 Q/ W  A1 \5 f$ h% N& h# k

  72. . a5 ?% p' ~% G/ ?0 N: y
  73. char *dmabufsrc1 = NULL;
    5 u% }/ g$ m4 g6 g' ~+ I+ l( x
  74. char *dmabufsrc2 = NULL;
    " G. j6 O- k8 O* c) C; Z
  75. char *dmabufdest1 = NULL;
    : o5 Y6 K. ]- o2 t/ j/ w
  76. char *dmabufdest2 = NULL;
    ! c6 F1 T) L! `0 F9 D/ l7 E" W" m

  77. 7 Y0 p4 N' b! p5 w: y( W: ^
  78. static int acnt = 512;
    5 f4 D) l5 d* {8 [2 E! y- Z
  79. static int bcnt = 8;! z1 c, i" j! T  S2 |
  80. static int ccnt = 8;
    4 L. N, q0 Q. o4 |" t

  81. 1 d) F/ e2 n% G$ I# Z
  82. module_param(acnt, int, S_IRUGO);
    . \6 P3 }  x* X4 Y
  83. module_param(bcnt, int, S_IRUGO);* d0 q' I8 A# ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% f6 z' Q9 x! O' ^. T( E/ w
; y/ B8 h7 c/ S" b% x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 F' w1 s9 U& V- v. E* k& J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( _% E8 M" G) |$ C" c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* G+ Z0 J) C; {: c+ R5 m$ i3 G. _; D* g/ }

+ G0 m% d8 G2 i5 C, \; q/ F  q6 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-27 19:24 , Processed in 0.038232 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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