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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( d' {# y1 g8 @& X, R3 j# z
  1. [code]EDMA sample test application
    * F! [# x& l- V* Y/ D
  2. /*; e9 V1 m1 n8 U9 p. Z5 z: _4 R
  3. * edma_test.c
    ) K" A' l; j6 E
  4. *  n. a4 @9 _7 I
  5. * brief  EDMA3 Test Application
    ; i/ z6 Z! v  ~2 @4 t6 g
  6. *
    6 G9 [' U5 U, e- `; k
  7. *   This file contains EDMA3 Test code.
      \' y% t1 K5 b! B- j& C1 `
  8. *
    % ^, i) f- g/ U3 \% l2 }3 l' A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 q% s3 D  i$ E9 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 E$ t" O. S8 @% ^9 D, x; S
  11. *         TO CHANGE.2 Y& ~) k( H0 `" w5 @
  12. *" K  O- b# T, E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 n2 Q* p/ w& q* C7 Z' V3 B
  14. *0 K3 z. {2 C  ^. h4 U  L
  15. * This program is free software; you can redistribute it and/or# h# N$ q2 q/ i3 Z1 E% w
  16. * modify it under the terms of the GNU General Public License as
    1 e& u% x! n2 b% @& [* `
  17. * published by the Free Software Foundation version 2.
    " D$ P4 l- j& `" N8 w
  18. *' p, W+ P7 @. b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- Q1 D7 R. z- l9 I
  20. * kind, whether express or implied; without even the implied warranty
    ) d+ U2 K, W9 l6 v; }$ n% [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 w  l3 t/ {' H
  22. * GNU General Public License for more details.
    # A, B' s' }; X  V
  23. */+ D' j2 Q6 Q3 x# f
  24. ! W& ?7 t* _- g( W! l7 x
  25. #include <linux/module.h>4 p2 J3 v+ ]1 l, [+ V
  26. #include <linux/init.h>/ l% f3 s7 K* d* Q
  27. #include <linux/errno.h>: [' a, g0 g7 E9 o+ Y5 d
  28. #include <linux/types.h>( P  ~8 z7 l5 w+ G' F5 K
  29. #include <linux/interrupt.h>$ C5 y6 y- F" S8 b' E9 O2 j
  30. #include <asm/io.h>: N. N8 i) x& i  \8 I' ^
  31. #include <linux/moduleparam.h>& r& T0 T( i* }0 ?8 i
  32. #include <linux/sysctl.h>
    ! h/ k% E/ Y9 H7 t! D# b: n9 j" f
  33. #include <linux/mm.h>
    / O* u  _) H3 n$ g: u' ^  Q
  34. #include <linux/dma-mapping.h>4 U5 A; P6 x* s# ]

  35. % }7 l7 o) m. ?1 B0 _& N
  36. #include <mach/memory.h>& Z, a% m- K: P( Q4 {$ H* O
  37. #include <mach/hardware.h>
    5 w7 b* V4 T- {& x& H; s8 {' x
  38. #include <mach/irqs.h>
    ' c9 o# E6 z3 T0 e; A$ L( D/ ]
  39. #include <asm/hardware/edma.h>
    " u4 }7 N  y$ D$ M2 X& m4 M0 ?. P
  40.   U) g2 [* _, P. W& Y6 x
  41. #undef EDMA3_DEBUG
    : R/ N7 O1 s" D2 G
  42. /*#define EDMA3_DEBUG*/
    " q/ M0 [* s" e% ^# Q) i2 y

  43. 9 r! C6 g9 ~% ]3 n
  44. #ifdef EDMA3_DEBUG
    . B/ E* f7 E/ w+ `  B) `' H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 r$ k. k8 n* l& l9 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + V6 N- V7 x' w3 k6 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% o; W7 _1 y/ q, X' P% x
  48. #else
    ( v4 ]( X; g$ k! H, m
  49. #define DMA_PRINTK( x... )
    + K- P/ m. p4 J: |
  50. #define DMA_FN_IN) K; t* ?$ I# c& w
  51. #define DMA_FN_OUT! w7 V. e% O- X+ |4 q
  52. #endif! p8 n. f8 |: O6 l
  53. ' N* k: ^1 s9 ]3 m7 r6 a( j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); u8 J5 H* v3 f  Q
  55. #define STATIC_SHIFT                38 ?5 w  t( f( h) y/ P$ y: C$ `( \
  56. #define TCINTEN_SHIFT               20; X) ~' j3 u1 Y
  57. #define ITCINTEN_SHIFT              21
    8 S6 t7 E3 |* F2 G
  58. #define TCCHEN_SHIFT                22
    9 V- |9 u" m1 ~0 K" r. r
  59. #define ITCCHEN_SHIFT               23
    1 W1 f% Z0 t# V5 Y( `, G' i

  60. ; o: K; T+ `4 l. V
  61. static volatile int irqraised1 = 0;+ q+ S5 L- Z# K" c7 m
  62. static volatile int irqraised2 = 0;
    * s7 \4 |$ }; F6 Q
  63. 0 s- n) b7 |% ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # ~/ x: V9 R0 w: U( c+ M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; G1 i/ R4 W$ O9 Z" u5 C: A7 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 K5 I- k& a7 z4 k
  67. . s; J/ j3 p" y5 `4 U& H
  68. dma_addr_t dmaphyssrc1 = 0;- m; y7 x& t5 M/ ]% X9 e7 D/ ]9 f! V
  69. dma_addr_t dmaphyssrc2 = 0;: _+ }9 J% f4 j# L, B6 P) A+ _5 W( H
  70. dma_addr_t dmaphysdest1 = 0;
    : w- h* [0 |# J: h
  71. dma_addr_t dmaphysdest2 = 0;; I* @1 f# N" }) a
  72. * j  q; L! _6 X. t
  73. char *dmabufsrc1 = NULL;
    . i  @1 B3 \3 B1 z3 i/ e  ~
  74. char *dmabufsrc2 = NULL;
    ! f; x7 N  E& v& l
  75. char *dmabufdest1 = NULL;
    / I: R3 h+ J& M/ r
  76. char *dmabufdest2 = NULL;' i9 @- T) t" N) d8 \+ l
  77. 7 y1 e" J; `) K# v2 @
  78. static int acnt = 512;5 D1 Z6 e. ~6 W
  79. static int bcnt = 8;% g$ g0 @0 ?/ Q6 W1 l  i8 Z
  80. static int ccnt = 8;
    4 k% x- \* Z7 m0 R/ y0 V

  81. + j7 C1 C' L- p! w" q
  82. module_param(acnt, int, S_IRUGO);$ G9 F) J/ ~* s
  83. module_param(bcnt, int, S_IRUGO);
    6 ?" t+ w* j' u. i& h7 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ p& z9 O5 X( E" u/ W+ l9 B( ^: `
1 d! {! O7 [  K8 `' C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 k9 W9 A  g4 h8 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 e% l. {( U( S! q' }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 e8 i* C/ e) d  h' \# T& \; c$ }
+ P7 T/ J9 f5 c2 T! I8 f

0 K2 l% r- G7 ]- _2 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 07:34 , Processed in 0.043113 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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