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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) t3 p, T1 T# c' S# `0 p8 w
  1. [code]EDMA sample test application
    % D5 C) V% j7 C: D9 f) B
  2. /*
    3 j" z# {% }$ s* q+ z: b1 J
  3. * edma_test.c( g( y. R8 M1 z
  4. *
    " x+ L" k# z7 y% o, F3 U6 R# o- ^
  5. * brief  EDMA3 Test Application5 a" u# r0 V  G
  6. *9 C1 g! u' x. d7 c0 _
  7. *   This file contains EDMA3 Test code.
    7 I* B( ?& _( J6 Y% ]" J% c
  8. *% G- I2 \* K  B" w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * w: x. u3 U+ _% X8 t, x& x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 F% C  M9 m' a  k+ B$ s8 h
  11. *         TO CHANGE.+ K; a: H% {" E* f% n
  12. *( Q- ^$ l/ c1 W9 |# z( \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' N( l5 [5 P( [& p
  14. *
    + R. C+ q. [% f* Y5 a
  15. * This program is free software; you can redistribute it and/or
    ) O$ f# W  r' ]7 `, l
  16. * modify it under the terms of the GNU General Public License as5 k6 Y' P7 D7 I% M, M2 D
  17. * published by the Free Software Foundation version 2.1 o& Z3 v* B: E0 n1 l  f" e
  18. *
    4 ?0 x8 B7 Y- f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& D- D1 z2 T+ n  I
  20. * kind, whether express or implied; without even the implied warranty
    / v( G2 L" C0 I! u! W' }& K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  ^' ~6 J; I7 {4 k. {4 r
  22. * GNU General Public License for more details.
    / D# N, ?% G5 I* l9 R2 @! H  F
  23. */" X! M. ^4 A, Q5 P$ Z" B

  24. 2 ?! _  [2 s7 F
  25. #include <linux/module.h>
    1 ~  H9 d) H- I# M
  26. #include <linux/init.h>
    " D  @2 b7 t2 P3 G+ e( e' d
  27. #include <linux/errno.h>  b! k4 t! s, ^5 i* ?4 {
  28. #include <linux/types.h>7 L& c: q7 r( J
  29. #include <linux/interrupt.h>
    $ b. l* K* k9 ?( K: _- o' K
  30. #include <asm/io.h>
    - y: P+ l+ F( Q: O# v
  31. #include <linux/moduleparam.h>
    9 J! y! L5 c; [% n" S
  32. #include <linux/sysctl.h>7 I# E5 n: b. o5 A+ q3 t8 d3 |0 ?
  33. #include <linux/mm.h>; `2 p' @! j" W% H6 h+ y: @
  34. #include <linux/dma-mapping.h>
    2 j9 ~+ _5 C( ?3 ~

  35. 1 o; h( N. S* G1 n2 k. D" _
  36. #include <mach/memory.h>
    ' P+ v0 Z7 O- G3 J1 g0 E  T
  37. #include <mach/hardware.h>6 K- h9 J8 Z0 T% j$ Y/ Q6 J
  38. #include <mach/irqs.h>  K! k: S4 h) j7 I$ v1 z2 S) b
  39. #include <asm/hardware/edma.h># P  L8 A8 I6 w9 X. K: E# |
  40. / N7 u" Z/ _0 _" q! }/ q
  41. #undef EDMA3_DEBUG
    6 A. E* z$ `. l% c0 t
  42. /*#define EDMA3_DEBUG*/
    ; {3 S+ E$ ~* O

  43. ' L5 {; q* j0 y/ P+ y
  44. #ifdef EDMA3_DEBUG
    . E; R! ]3 e! w% B: |; G* D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" ^* b+ g7 l* K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  r. J+ Z) h, E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" U0 S$ A  d% U7 U
  48. #else4 u6 A4 i; n3 m0 Y2 d3 ~4 Q
  49. #define DMA_PRINTK( x... )3 k0 L; K5 O' I8 t
  50. #define DMA_FN_IN
    2 Q: T0 N; [7 g% W: Q2 L8 e
  51. #define DMA_FN_OUT
    $ c$ k3 l5 V9 F+ H4 n$ U
  52. #endif' R4 f  g8 j1 n, T
  53. ! D# _- z: ?# r" m3 Q$ ~5 k8 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 f$ M$ S& b7 K
  55. #define STATIC_SHIFT                3
      d! s1 V, B8 U5 P8 L
  56. #define TCINTEN_SHIFT               20
    # z) v' X: n) n; u, d  K- j/ i6 s
  57. #define ITCINTEN_SHIFT              210 z- t) G& R/ R+ D. G% H
  58. #define TCCHEN_SHIFT                22, t. p! B+ F* E: W
  59. #define ITCCHEN_SHIFT               23
      @6 q0 U7 t" H. h  B

  60. 2 G) ~; L# j1 @- ?1 C( H
  61. static volatile int irqraised1 = 0;
    0 o( Z3 E( A5 d( b
  62. static volatile int irqraised2 = 0;2 U6 l* ]- D* m. I/ e4 ^/ H
  63. 2 J+ V6 \+ R9 I% U3 n4 O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 I7 i5 o' f# n- D6 {7 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 b, ~5 k+ l: C* B' b8 _+ V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ b+ p! h$ e1 X7 h5 b) V

  67. 9 H2 k& J  F" W5 f6 |7 e: Z
  68. dma_addr_t dmaphyssrc1 = 0;) d" Y- u1 a: Z2 \( b( h. r+ l$ z
  69. dma_addr_t dmaphyssrc2 = 0;
    . G. o1 I9 n/ l8 B) L$ a
  70. dma_addr_t dmaphysdest1 = 0;$ Z0 b/ H3 V$ h- A) d
  71. dma_addr_t dmaphysdest2 = 0;
    7 A4 O& R, m2 c7 ~8 U" U8 g
  72. 9 C; B: |& ?" A
  73. char *dmabufsrc1 = NULL;
    # s" q" A0 n% \" |
  74. char *dmabufsrc2 = NULL;
    * W2 e) h0 f1 p4 Q1 P% j
  75. char *dmabufdest1 = NULL;
    ' r: z7 K& v. p5 O
  76. char *dmabufdest2 = NULL;
    - o3 G9 z. e3 f8 m
  77. 1 Q3 `2 ~' [* }! S# \1 X
  78. static int acnt = 512;# y* y( h; l4 o/ v% ~7 T+ V' q
  79. static int bcnt = 8;# O8 G+ \2 _! G  E
  80. static int ccnt = 8;3 F! j" {* D1 v+ d& ?1 W) f
  81. # a! o  p; _& K( a/ b/ F
  82. module_param(acnt, int, S_IRUGO);
    * s" c+ A" y/ ~* k
  83. module_param(bcnt, int, S_IRUGO);
    6 o: c& y% N6 {5 [' B3 V$ g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; n# N/ z( \0 L5 e. G& k# G2 P9 K  d4 ?, r0 J4 W. u+ `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% a3 q# f1 ~/ S6 K# O: ^' c+ tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) M% ~; s' L. _, S! G% e9 [6 f2 @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 u: D& q- t$ |6 Q5 k

; {( y0 ~) q- ?7 X) s% k# ^2 \+ ~
% g$ M; H3 c1 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-9 13:39 , Processed in 0.039584 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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