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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% d' d5 w1 D9 r& V% ^
  1. [code]EDMA sample test application
    8 Q/ J5 U6 l* @# p' w8 L/ k
  2. /*4 ~' P4 V! U8 W) x! k* R5 J
  3. * edma_test.c, d& S0 k7 _( C
  4. *# j, o4 B! _" h
  5. * brief  EDMA3 Test Application' ^3 x( q* @( n. }  p
  6. ** O4 b" g1 Z. h6 V5 f7 U$ f, F+ I
  7. *   This file contains EDMA3 Test code.
    " U  N0 x1 y3 }/ ~& G1 s1 l$ e' N
  8. *$ y* O: z% ~1 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; }; ^* N" i# P1 j4 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) a) M% @9 `3 `/ _; |$ D2 ?' W
  11. *         TO CHANGE.
    / b, G8 S1 R1 l: f
  12. *) I- j$ c8 Y! E. ~! q, Q6 Y1 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 n" K0 H2 B( L( d# @8 V. E
  14. *
    ' e( v2 R4 |; B2 d" V
  15. * This program is free software; you can redistribute it and/or
    ! J! H( A$ A3 a3 u' b5 E
  16. * modify it under the terms of the GNU General Public License as3 w# d; t4 @2 v% T8 ]) I
  17. * published by the Free Software Foundation version 2.
    + r: d1 K* B+ F/ S) u& l$ Q. n% N
  18. *
    0 |6 x/ ~7 k# ~' q! T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! ~4 y' t7 R5 L9 p
  20. * kind, whether express or implied; without even the implied warranty5 I5 _0 k$ l8 ~% X0 u6 a0 _, q4 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 `3 N- k9 |' h7 z% m" i
  22. * GNU General Public License for more details.% ?7 K2 p8 G/ ?) ?$ Q
  23. */7 H) G: K- w: w4 q' w/ Q$ H
  24. # z4 s' Y- X7 K5 \2 t. c
  25. #include <linux/module.h>
    # }; I" F  n& p8 f" W1 d
  26. #include <linux/init.h>; _0 N5 ]2 m0 q7 T) o3 F
  27. #include <linux/errno.h>
    7 l& ~; e$ H1 x) _1 |( R% h& v* h
  28. #include <linux/types.h>) h' R5 ?  z/ k2 C9 ~
  29. #include <linux/interrupt.h>
    " J1 f# _  Z5 d4 ^! D$ ?
  30. #include <asm/io.h>0 M4 k8 A' F& B" E
  31. #include <linux/moduleparam.h>9 y* p* r( k4 _# j; ^
  32. #include <linux/sysctl.h>
    ; F2 W- ~; @3 `( Y' i1 P% m
  33. #include <linux/mm.h>
    . t- l3 x' m  I8 M/ g, W
  34. #include <linux/dma-mapping.h>, l+ {) c; }% W
  35. 5 T/ p3 `) e8 J! G& D8 e
  36. #include <mach/memory.h>
    ! ?/ ~- r; ^& u0 j! H6 w, L
  37. #include <mach/hardware.h>! z) s" E2 b# Z% w# D9 S
  38. #include <mach/irqs.h>
    9 S6 ~8 {' H& d, e! F; ^1 g$ e
  39. #include <asm/hardware/edma.h>4 ]3 s  \  D- H: q- J4 _. v8 Q
  40. 5 U" T5 k7 z( w9 r
  41. #undef EDMA3_DEBUG
    2 f+ d3 D+ Q$ G* O. J+ [, I
  42. /*#define EDMA3_DEBUG*/& p) {* s& b) }& }; P# m

  43. ( `) s  Q! i1 P, M3 }, h
  44. #ifdef EDMA3_DEBUG
    % M5 v2 L3 l3 V7 i. d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + A+ U- x& I( ~7 _4 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" H' a8 h& W9 @, v+ v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; K+ M9 P$ \# q
  48. #else; e$ p! K; q# b, |! I  V8 q- e7 g3 V0 [
  49. #define DMA_PRINTK( x... )( s5 V5 ]) }9 F$ q* r
  50. #define DMA_FN_IN7 I4 O+ Y" @% \# Z
  51. #define DMA_FN_OUT
    7 i  \7 r9 L! H- N% d& R, P, a+ U
  52. #endif
    1 r9 e: q- q3 ?" M9 ~$ O, T

  53. " G1 e) b( R+ O5 k' z2 c4 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! e( S$ k9 ]2 v, `9 x2 J
  55. #define STATIC_SHIFT                3. a* q. Z5 n9 [% F/ A  E
  56. #define TCINTEN_SHIFT               20, `  j* m1 M, }1 X& l0 ~
  57. #define ITCINTEN_SHIFT              21% H. \3 R3 u1 i1 |! E! s# \4 G8 A
  58. #define TCCHEN_SHIFT                22
    % K6 O3 h+ T, T0 N
  59. #define ITCCHEN_SHIFT               23* q3 P" G. B- {! ^: j

  60. 2 m3 e& ^5 ^9 q1 M3 G* v9 S" m
  61. static volatile int irqraised1 = 0;8 M# G9 I- Z' Q! b  e! j0 k" x$ w8 k
  62. static volatile int irqraised2 = 0;$ N# a3 c. z* S' U/ A, N& D% ?
  63. 0 }/ k; ?7 e3 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : [$ C5 I0 R. ^* v2 J% s( l3 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ]6 Q8 Y- {! o; e& f7 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + x/ M7 O' n' f: [; I* G: k0 F

  67. 9 I0 W6 J$ z# J
  68. dma_addr_t dmaphyssrc1 = 0;
    * e8 ?$ x/ I7 P, z1 @
  69. dma_addr_t dmaphyssrc2 = 0;* e, Z; f- o, U* v8 C
  70. dma_addr_t dmaphysdest1 = 0;
    & F2 ~9 x  r* n' Y+ }- N
  71. dma_addr_t dmaphysdest2 = 0;
    7 ~9 P) d# y; B5 D" x7 G

  72. 1 P! N) \! b# I/ y1 A4 W, U
  73. char *dmabufsrc1 = NULL;
    9 m1 R! z) b$ q
  74. char *dmabufsrc2 = NULL;
    ( X% ^, y. \7 [; Z
  75. char *dmabufdest1 = NULL;
      @9 h$ Z" C6 {+ i
  76. char *dmabufdest2 = NULL;6 G; A# s- g$ H4 a/ U5 C& P

  77. 7 i* _& P( [( K3 @
  78. static int acnt = 512;
    7 n: {+ R2 Z) E) N$ }
  79. static int bcnt = 8;+ Y. v7 X! i) M+ h, }$ U" P
  80. static int ccnt = 8;6 j4 H) \* g6 M6 W
  81. 3 M' r' }- v9 j# B
  82. module_param(acnt, int, S_IRUGO);
    . E8 O5 x( `' t3 O; M: k' X
  83. module_param(bcnt, int, S_IRUGO);
    3 J3 i; N% v4 Q( F5 _8 F0 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ z0 m. ^5 M( v
3 x4 c) D* `& \6 ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, }4 L  U+ }& w  q) @4 C+ I: X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ }3 j4 G- K  N5 k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ `+ ~' T' [6 F/ s! k, N6 b; a
; u( Y% R% d! r7 H4 I
6 L3 A8 x1 j* k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-27 01:33 , Processed in 0.040510 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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