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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 g2 z  O( x9 l' i6 T
  1. [code]EDMA sample test application. o; `0 U0 j& K- _: v; I0 d, L. X
  2. /*
    ; O" X# O3 a( l$ m7 w' O
  3. * edma_test.c
    ' `' y0 I" l5 I0 i! o9 l  g! m+ }
  4. *0 l; V- v6 C5 Q3 w
  5. * brief  EDMA3 Test Application( M3 F  B9 W: d, ]
  6. *+ a' H/ F2 G  b: A# [+ S
  7. *   This file contains EDMA3 Test code.0 T  C% G* ~  x' x
  8. *
    . m. n  r1 O0 l2 |* X0 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. g( G7 u- G* C, h1 i* K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ B! f5 f9 Q, j. K
  11. *         TO CHANGE.- k/ }/ J9 ]5 T: N3 q
  12. *
    , e; f# b" g6 f1 ?4 U" f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' ]$ U6 t: {% |
  14. *. ~( T* m. o( p
  15. * This program is free software; you can redistribute it and/or( _. A5 y5 C& m  X2 J4 T
  16. * modify it under the terms of the GNU General Public License as4 J9 M3 L3 U7 s! l/ X/ l
  17. * published by the Free Software Foundation version 2.7 R  R/ V2 b( n+ N- w( l- Q
  18. *$ m7 e7 s, ]$ ?  M+ c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - h3 R- l' z4 T$ G! h3 R
  20. * kind, whether express or implied; without even the implied warranty
    1 |6 P5 w. y7 A1 t, R, s. Z$ j4 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . C1 K' _3 {% l  J
  22. * GNU General Public License for more details.
    - i" i8 R; V8 l% N# P; L
  23. */! J6 @/ `3 k* M1 {3 ~4 _7 \

  24. ) k' q$ R6 N# m2 S
  25. #include <linux/module.h>
    - a# q/ \" s. b+ w
  26. #include <linux/init.h>( \; ?9 A5 |/ ~; Q/ G
  27. #include <linux/errno.h>+ g( s; g. v. I
  28. #include <linux/types.h>
    1 _; O7 l" [+ G
  29. #include <linux/interrupt.h>
    6 O1 g  v, E0 P0 w; A3 D* e
  30. #include <asm/io.h>* q3 s6 P3 A. w, B1 k* s. y
  31. #include <linux/moduleparam.h>7 L) g# a$ }$ j
  32. #include <linux/sysctl.h>* J7 [2 r0 y6 U) z( X' q# w/ _3 A. o+ r# O
  33. #include <linux/mm.h>
    * Q8 [4 a' ~. b6 y3 C
  34. #include <linux/dma-mapping.h>
    # f' {; j2 N4 h: ^* h; x5 T3 C

  35. 5 Q9 G- f$ G  @$ W5 r( o/ N" W, T
  36. #include <mach/memory.h>
    & e1 B) K3 N- X; h7 x+ R  V' s
  37. #include <mach/hardware.h>
    4 p6 O% K# q* H0 ~% D* D
  38. #include <mach/irqs.h>8 ^( ]% |& e( m+ w) B0 ^
  39. #include <asm/hardware/edma.h>
    % k/ y- H5 `9 t5 b6 \7 ]; b1 o
  40. 3 r. y7 U' D2 {, [
  41. #undef EDMA3_DEBUG
    . `! J( x# o' \9 W. x) t' j
  42. /*#define EDMA3_DEBUG*/
    : L2 W. s: q4 f0 U- f/ B- m
  43. # b4 z  F2 ], S+ c! A
  44. #ifdef EDMA3_DEBUG, E1 N8 [' e; I( N8 H/ p2 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' c4 g9 l/ U3 @; i: Q9 S) U3 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# Z' }9 A8 \* y3 C+ o! L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( `6 }& U3 T3 F6 P7 O% ]; T6 g
  48. #else! g% W% q8 J- f3 m
  49. #define DMA_PRINTK( x... )# w/ I0 R' p' p0 F) g" T: S4 ?
  50. #define DMA_FN_IN; c1 e; ^; [/ W! `8 J
  51. #define DMA_FN_OUT
    # z' R- \7 D% q. @
  52. #endif, X% _% ~$ Q  [, ?* C9 b" o

  53. . `2 j( V: N: [& H( z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% h6 B, i3 s3 y. r8 W
  55. #define STATIC_SHIFT                3( P! W7 s- l; t- ~( S, M5 Q9 R8 U
  56. #define TCINTEN_SHIFT               20
    " j1 O% X; ?: f# I2 f4 O
  57. #define ITCINTEN_SHIFT              21
    6 H) n9 Q; z4 k
  58. #define TCCHEN_SHIFT                22+ S" d" G8 a+ C$ J9 w
  59. #define ITCCHEN_SHIFT               23
    2 @- M; m: c' ~5 f4 M

  60. $ f8 @8 N0 a9 Q& ^4 \4 m
  61. static volatile int irqraised1 = 0;
    ( d5 D. e% T  P. m4 @
  62. static volatile int irqraised2 = 0;! p& Q& q7 Y% d7 Q3 V! N4 J8 j

  63. . M$ |- S3 y* W. l4 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ E. ]: l' W4 B6 Y0 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, B# c. L1 V0 [9 R; u- h( X/ U$ S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) {4 n+ s3 ~- ^

  67. 4 _+ U7 W4 U+ E2 s5 ?$ e$ \* _! y1 V5 k
  68. dma_addr_t dmaphyssrc1 = 0;/ t4 y( D! D4 I$ ~1 H
  69. dma_addr_t dmaphyssrc2 = 0;7 M' ^; `4 u) s0 [: _
  70. dma_addr_t dmaphysdest1 = 0;* \( f+ {/ D8 A9 G
  71. dma_addr_t dmaphysdest2 = 0;
    5 O6 N) M+ H* ]+ P0 J- H

  72. + _. L1 s0 V; |
  73. char *dmabufsrc1 = NULL;
    " v6 N6 S1 B. t/ u* q
  74. char *dmabufsrc2 = NULL;+ ~/ H7 P& f( S6 P% }* x
  75. char *dmabufdest1 = NULL;
    3 W* Z8 r8 _9 C% |& _; b' o. A! h. ?
  76. char *dmabufdest2 = NULL;
    + G1 U! G; E8 b

  77.   v# \3 l0 r& q) |2 [
  78. static int acnt = 512;3 n6 v$ m8 K; V' G. R1 X8 A  h
  79. static int bcnt = 8;
    7 |# s7 N1 r5 \6 d6 O6 G
  80. static int ccnt = 8;
    8 U  Q, |! H: M- r" m
  81. , c2 J7 R3 @! M. [  g
  82. module_param(acnt, int, S_IRUGO);* B/ _0 n4 D  \! z; t4 j+ `1 j
  83. module_param(bcnt, int, S_IRUGO);
    : t) U- a: Y5 l" F" y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% e# A$ p. u1 R5 w. Y! n: ?

3 B% p2 f' c" g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  G9 p$ F: e0 O0 a! Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, D; t2 k) w8 r+ ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 h3 ?+ d% {2 N8 z. y$ e8 ^* z' @1 O6 i; E$ D
6 n  i4 {) o1 L6 h  J7 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 16:28 , Processed in 0.058267 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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