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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   g' ?- \- F6 J, K7 J
  1. [code]EDMA sample test application# U3 B& P: Q1 ?7 ^6 D; D
  2. /*
    + `2 ]) e4 S% A" w# c5 i
  3. * edma_test.c
    ; N6 A; [  a8 D& W1 f
  4. *
    ( ^/ d) Q) }3 P" m  A
  5. * brief  EDMA3 Test Application
    ' j6 c4 b, `( Z
  6. *0 ~9 D/ i0 R# @8 n) @& g
  7. *   This file contains EDMA3 Test code.; R( v( U( U% W
  8. *
    . I2 j# H' n: b0 k  v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% m- Q/ F+ ]! b, [9 \/ O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 l: }5 \1 ~9 s# e# B& @
  11. *         TO CHANGE.
    - j0 B" l" h4 O1 |, t7 U9 i+ J* c: P
  12. *
    : O5 @- }8 i* e% ?/ r. \( O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 I9 ?& ~& D! g! a) {
  14. *5 ?; m8 i3 l3 r/ _8 n  T
  15. * This program is free software; you can redistribute it and/or
    ; }+ Z9 {* v/ \
  16. * modify it under the terms of the GNU General Public License as
    1 Q" w6 ~3 C2 Q4 s
  17. * published by the Free Software Foundation version 2.
    ! b6 C* [% i3 ^& b" W( K4 a1 _: s
  18. *
    % L6 t% ]% r) {, N4 D# `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + @& E  [0 V5 k; @
  20. * kind, whether express or implied; without even the implied warranty
      X6 R: u' U1 p1 N6 k% v# K" b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( |8 U9 E+ R7 r2 }
  22. * GNU General Public License for more details.4 N- K, ]+ S0 d' O, N
  23. */
    1 F2 K8 K: ^4 K4 u3 q; a3 v

  24. ) |2 E% ^8 Q2 o+ q( [
  25. #include <linux/module.h>; b7 m" N: R" h4 G, F* f/ u
  26. #include <linux/init.h>
    # b. `% e+ l7 u) W& N4 Z
  27. #include <linux/errno.h>
    8 U$ K: t' g! Z* t0 w
  28. #include <linux/types.h>
    / g0 W+ N0 [/ t" U: n/ O+ ~1 V) h; V
  29. #include <linux/interrupt.h>
    8 k$ v- B. B. L) u* }( c- j) M
  30. #include <asm/io.h>
    : H* C' n7 J$ l; m* s! a9 A7 B
  31. #include <linux/moduleparam.h>1 c6 E! T6 g- M
  32. #include <linux/sysctl.h>
    ) I1 C/ ]9 C- Z+ F
  33. #include <linux/mm.h>
    . y4 T' e6 g: D% L) E" s, F( d
  34. #include <linux/dma-mapping.h>$ y) s* s: l1 {* _/ p

  35.   O. m( s* D% D: [) z5 q1 m
  36. #include <mach/memory.h>5 A+ K/ Y; `5 P
  37. #include <mach/hardware.h>$ O$ a( W/ ?3 O
  38. #include <mach/irqs.h>
    $ d7 x6 y) K: w& P; i" a
  39. #include <asm/hardware/edma.h>
    6 y) O% D1 d+ u' x; G- a
  40. ( u9 |& `4 E9 {& d
  41. #undef EDMA3_DEBUG7 I5 C- {* l2 e( p- j# R& c( |
  42. /*#define EDMA3_DEBUG*/) v5 ^! i# t0 B* n  Y4 p% J* |

  43. - W! I# q) C/ T# J4 z/ t6 H
  44. #ifdef EDMA3_DEBUG" m! Q. u6 V1 H% n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( c! Z! q4 r& W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& {& d) |7 h* [/ g  F) |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % h. ^1 ~+ i* k1 ]) b) V
  48. #else
    # t% b% @( `) V
  49. #define DMA_PRINTK( x... )+ \5 B. O* L1 ?! H: O2 W
  50. #define DMA_FN_IN
      g8 n% n2 `& z( W/ m8 f% D
  51. #define DMA_FN_OUT
    5 W9 K( k  b/ r
  52. #endif( k, x# R$ x, D) P

  53. 7 F: g, \1 [' B& j  P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ B0 Z8 U# q& A8 ?
  55. #define STATIC_SHIFT                3
    ( h- n9 ?. i5 r( O0 d( |  d
  56. #define TCINTEN_SHIFT               20
    ; A3 f" y: T$ A$ M4 I4 O
  57. #define ITCINTEN_SHIFT              21
    , q- `' z2 K. T* g1 o
  58. #define TCCHEN_SHIFT                22
    ' X, C  [& t: `8 g. Y, E' \
  59. #define ITCCHEN_SHIFT               23$ w; A; E0 i' Q/ \
  60. ! @! h+ @& x6 }- s' K1 x
  61. static volatile int irqraised1 = 0;
    0 ^: q" U* E6 Z
  62. static volatile int irqraised2 = 0;
    - }/ s6 }  G$ ~" P5 ]
  63. ! p+ Q/ W: s+ u: x  N6 E& [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 c8 R- _9 t" q2 e3 E+ i6 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 T# k- D- o  @  t6 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& u( E( B# P7 o* @" u/ P/ B& E
  67. ' X6 }. A( I# G8 \# K# z4 z
  68. dma_addr_t dmaphyssrc1 = 0;
    9 B6 n4 x# g- J4 M+ S$ a
  69. dma_addr_t dmaphyssrc2 = 0;
    " Q/ [4 D+ i- {2 G+ Z% |! b( w* `
  70. dma_addr_t dmaphysdest1 = 0;
    7 Y) Y3 [6 ^" o
  71. dma_addr_t dmaphysdest2 = 0;8 W. g! ^; d$ ^8 r7 M, D' A
  72. ) q$ P2 g) n& O% O  A) u2 y6 o
  73. char *dmabufsrc1 = NULL;
    . r5 T+ a" }, C
  74. char *dmabufsrc2 = NULL;+ w$ l  g, \4 n; Z: W' h
  75. char *dmabufdest1 = NULL;
    * A9 ?1 p0 Y: i' V
  76. char *dmabufdest2 = NULL;$ C. ?6 E0 \, L% v: p; s9 b" r

  77. % c: h8 Q& F, T
  78. static int acnt = 512;9 f4 D- R) X# c" L4 y4 G1 ^+ H
  79. static int bcnt = 8;; f/ _  d, H& |9 t* L
  80. static int ccnt = 8;8 r3 ~7 M: c& r

  81. . b2 [) F0 K6 O6 U6 L) a# g* Z; y
  82. module_param(acnt, int, S_IRUGO);
    , S% e1 a  p# s, T( w
  83. module_param(bcnt, int, S_IRUGO);
    8 y6 l6 E- G( ^! A& c2 b  C$ Y2 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 e5 F# j6 a1 c* i! S% T* C/ E. t- S; j* V5 n4 K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 G% G  t+ P- d1 X1 L4 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 V9 j  y9 {; t- N, {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! K3 N: C% b8 H; M: Z
0 _& [6 ~! S6 b5 Q' N( O, t
) J6 M$ D. g' J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 03:11 , Processed in 0.039310 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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