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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , G+ t0 [+ @7 K. S, ]
  1. [code]EDMA sample test application3 J% ^3 ?$ \8 X+ z2 J/ h6 s) x
  2. /*; f) g4 g+ n& g0 U. i; X; P
  3. * edma_test.c% ]: q/ |5 |2 C$ w9 E; y
  4. *
      D5 G6 ]" j  i
  5. * brief  EDMA3 Test Application# J. [$ N$ X% L" A2 z3 t# C" V7 U. M
  6. *
    ; O. _1 V+ F5 w3 o& G; I9 w
  7. *   This file contains EDMA3 Test code.' c: u6 e: p9 }- m, T+ n+ ]1 t
  8. *
    ' i$ a( S* t0 F4 X8 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * O3 P: N' y7 g* D% |- E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- b9 F- p* Q, t$ B( S
  11. *         TO CHANGE.
    1 G& n; t' _! |2 ?
  12. *, E! |: r+ g1 r4 i6 C' h' _2 p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . @1 M- w2 ]7 q
  14. *2 L  L; C) T2 m: }9 K" A5 v, q+ r
  15. * This program is free software; you can redistribute it and/or
      g5 S$ K; |& R; P
  16. * modify it under the terms of the GNU General Public License as
    4 @' I$ w& P( s# n6 |* ?8 b5 j5 B
  17. * published by the Free Software Foundation version 2.
    ' b  _/ A9 r- w, I' k5 E
  18. *
    + p% B0 o6 l3 V7 A/ G8 v2 t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' _+ v! X! `$ b7 R
  20. * kind, whether express or implied; without even the implied warranty
    6 x; |# y+ r, c- ~! B& Z) U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 ]5 R: x( U4 t1 y
  22. * GNU General Public License for more details.* w  Z% U9 L2 q/ |# n; S7 X
  23. */
    / v' Q$ I1 g- z% D4 k/ V
  24. % w6 m6 V4 H$ |4 w
  25. #include <linux/module.h>
    1 s2 p- ^4 d# z  A* i" ~2 g
  26. #include <linux/init.h>% l# A1 I- m8 w( V  Q' t
  27. #include <linux/errno.h>
    # z% I3 h! [( W. ~1 Q& d
  28. #include <linux/types.h>
    9 Z/ P7 e, ^6 B7 N/ C* Z' o
  29. #include <linux/interrupt.h>
    : i" I2 S3 S: \$ C
  30. #include <asm/io.h>+ ?9 l" y1 \4 q$ Z, G: R
  31. #include <linux/moduleparam.h>+ b# p! g  B) [  }! L* W
  32. #include <linux/sysctl.h>
    + N, \# H$ X; e) z
  33. #include <linux/mm.h>, ^/ e- E) `- _3 w' Z
  34. #include <linux/dma-mapping.h>
    ; J  f2 U; d7 k

  35. % D, |& y# \, }% J
  36. #include <mach/memory.h>
    ! ^9 ?; F+ v) j- J) I
  37. #include <mach/hardware.h># S7 Y8 r$ F" ]$ p1 J
  38. #include <mach/irqs.h>
    % N; C7 y5 z4 Y. n' ?
  39. #include <asm/hardware/edma.h>
    : N+ y3 k: h5 ]

  40. 6 I) J: G. V! {6 ^: }
  41. #undef EDMA3_DEBUG
    2 v3 N! X( C/ w/ p6 Y
  42. /*#define EDMA3_DEBUG*/1 C( {- F6 K+ F

  43. & r4 Y% }( q5 G( V! L
  44. #ifdef EDMA3_DEBUG
    ! P: g; r+ \0 Z* f1 `0 i! H7 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 P+ @% Z2 P8 _$ ?0 ]0 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + d* z* [& U( q" T$ U9 W& D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" }: B! D" O9 E/ X* n8 {
  48. #else& F% H7 V+ s1 D: ]8 J
  49. #define DMA_PRINTK( x... )
    ; I' z+ Z+ I1 @0 O
  50. #define DMA_FN_IN4 k/ o  c2 n0 T9 o
  51. #define DMA_FN_OUT
    4 ?4 u; u9 }( K. c  R4 G
  52. #endif
    ) N: |/ ~1 {1 `2 A2 e
  53. ! W8 n! h1 X$ Q% E7 c: ~0 R, T5 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' x) g3 ~/ c( o
  55. #define STATIC_SHIFT                3
    8 A! A, J% o3 m. k
  56. #define TCINTEN_SHIFT               206 H% ^) W2 ?! h- I& ^
  57. #define ITCINTEN_SHIFT              21/ c+ I  R; c+ g. E* A) x
  58. #define TCCHEN_SHIFT                22. B0 e9 X: y" E# _" n, H
  59. #define ITCCHEN_SHIFT               233 O/ _% C, M! @& a. |0 F

  60. 2 A8 Q5 W" v5 @: r+ H; m
  61. static volatile int irqraised1 = 0;
    8 v! a' t8 L( h1 D* a
  62. static volatile int irqraised2 = 0;& B3 \5 P( R; O. r5 @% h! o
  63. % s/ M  ^5 A: i. D" P* ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 `6 z$ P* a9 {: G$ F1 d; r7 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ~/ N8 ]6 C5 d) g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 t2 E$ ]/ D0 t% X8 a: t/ X( ?

  67. ( d4 L2 \3 W5 w" f+ ]$ M
  68. dma_addr_t dmaphyssrc1 = 0;" h1 e7 b8 R/ [0 L% h0 p
  69. dma_addr_t dmaphyssrc2 = 0;( m9 o4 [7 A# z
  70. dma_addr_t dmaphysdest1 = 0;# Y7 p: B4 o5 w# A
  71. dma_addr_t dmaphysdest2 = 0;
    2 H* m/ J! {, Q" h1 n
  72. ; C" ~7 V2 x6 [2 W9 u, s) {
  73. char *dmabufsrc1 = NULL;
    + h. h$ S# O8 w) [9 l
  74. char *dmabufsrc2 = NULL;
    8 y" c4 j( l  e6 m) @0 S1 y
  75. char *dmabufdest1 = NULL;6 E6 B4 O& S$ A, {4 G
  76. char *dmabufdest2 = NULL;
    3 j2 O, L% n( I9 ^  A5 ]
  77. " O" O) @; p5 u9 J8 Q& y% l( R
  78. static int acnt = 512;
    ' I: w) K! P8 p6 S9 `$ }
  79. static int bcnt = 8;% C, e8 r1 L' f1 n4 A* Y
  80. static int ccnt = 8;( U# ~6 b" t" q; z3 Z
  81. # l7 [, r& \, h6 J
  82. module_param(acnt, int, S_IRUGO);
    7 W# i2 L0 |' C/ K# k
  83. module_param(bcnt, int, S_IRUGO);
    & v1 V& h- m/ P, z; a. l0 {; W1 f+ s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 [; @9 P0 _* ]4 I" [: B
( H) z* E1 u2 u4 S/ u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ l- D8 u4 y$ J% r; Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* l: {. [( l' ]8 D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ G7 S+ {9 ^0 a1 k
2 \2 Z; V+ \! D: s* }
8 ]! m" ]: H9 A' b2 `) t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 19:28 , Processed in 0.038633 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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