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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; ~8 T0 ]2 x$ [9 X7 A$ O6 E6 J
  1. [code]EDMA sample test application9 j1 K9 x8 M( |0 l# _
  2. /*
    5 o; o: u" P+ v7 S, |+ e/ w
  3. * edma_test.c* T/ r) m+ T/ O( u/ E
  4. *
    $ e; G$ h! C% ]8 K) a
  5. * brief  EDMA3 Test Application
    2 m# p4 J$ |. i! @* M3 Y2 v4 c
  6. *6 A4 U# }* t. ]
  7. *   This file contains EDMA3 Test code.
    ; M6 {. E" n/ T5 r
  8. *+ z! b+ v; c5 ^$ }: [* a. U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / o8 [' A) {, e( ~  l" Z: N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 f' E, c3 t( O1 d+ N- p$ q, D
  11. *         TO CHANGE.  K0 k; T8 E! J
  12. *0 ~4 u8 {2 s1 e! _  U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; D; k* p5 U. Q& ~$ B
  14. *
    + I) S" n0 g" x% w1 N  M
  15. * This program is free software; you can redistribute it and/or
    + O0 E! I1 d( o: B! B  I, Q6 b8 W
  16. * modify it under the terms of the GNU General Public License as) a, G6 Q9 T6 m+ s  c  N0 F: \
  17. * published by the Free Software Foundation version 2.; i+ N5 m% j- v! Y8 T" Y/ e
  18. *: H& B4 q7 ^4 _) N* n, p2 s: ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  l* V. ~4 @% L7 ~3 u. t6 }: G
  20. * kind, whether express or implied; without even the implied warranty
    8 Z7 \( g5 U& U: [& X9 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * U8 A/ _) ^: y$ `/ g3 l
  22. * GNU General Public License for more details.
    % W2 ]0 E/ d- l' ?3 H8 X
  23. *// N9 y/ e8 c0 |9 F5 ?

  24. " ]4 O2 h  t; K
  25. #include <linux/module.h>: ~  E% a8 x$ M3 q& {
  26. #include <linux/init.h>
    ! [$ ?0 X" G1 c9 d+ J
  27. #include <linux/errno.h>7 S# R5 V6 X! u; m3 @0 z7 \
  28. #include <linux/types.h>
    % o. G' l* b; K. ^' }4 n1 D* w
  29. #include <linux/interrupt.h>
    4 e2 [& S8 E5 @) I% a3 i% A5 v
  30. #include <asm/io.h>
      x2 N/ i! j0 I+ ], }
  31. #include <linux/moduleparam.h>
    6 o% V+ R3 i/ L) \9 w) K
  32. #include <linux/sysctl.h>
    5 E* M- ~) L" J* W1 g
  33. #include <linux/mm.h>
    , M' m2 C; w+ U2 J" ?2 H2 ~" a
  34. #include <linux/dma-mapping.h>
    6 `8 f+ |) E$ u! e8 A) a- s

  35. * N2 Z1 @6 @) M* D* B8 c
  36. #include <mach/memory.h>
    % }8 N3 x3 U% x) e2 n2 g
  37. #include <mach/hardware.h>
    6 |7 h' I" V. m
  38. #include <mach/irqs.h>
    ( R' M# H0 w6 b  k+ J3 k+ N' f8 w
  39. #include <asm/hardware/edma.h>
    2 n9 M& ]: C1 q( `
  40. 4 Y+ |( i3 f- r* b- K$ z6 W
  41. #undef EDMA3_DEBUG9 u. n, s3 Z1 o$ S5 Q
  42. /*#define EDMA3_DEBUG*/
    0 g) a% V5 s2 z! X4 m1 L

  43.   {4 v! H! @4 ~% q
  44. #ifdef EDMA3_DEBUG
    4 f" }2 H# E' r, A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  }0 K7 ?( U* y% {2 q+ {% m) ~, r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 ~/ p- B# Y& o' y7 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # |4 R/ m* D' L; x6 u
  48. #else
    " n5 |1 _. y2 M1 j: |
  49. #define DMA_PRINTK( x... )
    / U; ~. h/ I. N" ]
  50. #define DMA_FN_IN
    : l2 @) _4 S9 l4 ]" m) R! g
  51. #define DMA_FN_OUT
    - |$ C0 I/ t1 L; t
  52. #endif
    1 B, W' ~% f9 |) F

  53. " x- C0 B+ G; F- w. q2 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 M" U+ V% e) j9 N* c
  55. #define STATIC_SHIFT                3
    7 B1 @& H5 x! L( t" P9 B
  56. #define TCINTEN_SHIFT               202 r  S0 ~$ M6 R0 L: m/ H
  57. #define ITCINTEN_SHIFT              21
    7 `) k. X. c" Z+ ?1 B  {
  58. #define TCCHEN_SHIFT                227 \. ~" Q( x' W
  59. #define ITCCHEN_SHIFT               23$ ~% Z8 o, i: }. e

  60. & h( P/ f. \5 x1 F" g" W
  61. static volatile int irqraised1 = 0;/ A7 G7 p" V& a& e" E
  62. static volatile int irqraised2 = 0;; D8 x- l  n; {
  63. 8 \( X2 u: k5 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! g2 w9 G5 e. Z& E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  _8 b0 G+ Y3 E0 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " c2 V5 d2 O) x. \2 K$ B

  67. 9 E" k9 A0 [. t6 g
  68. dma_addr_t dmaphyssrc1 = 0;
    6 }6 Q( y. r& @% ~2 a
  69. dma_addr_t dmaphyssrc2 = 0;
    3 e7 E/ `, u# j8 s9 x- p- y, Q
  70. dma_addr_t dmaphysdest1 = 0;
    ; X. a# U, G- {! w
  71. dma_addr_t dmaphysdest2 = 0;& P: W! x( W" A! [/ h" t; P
  72. 7 C5 k) T$ K7 t9 C/ V) C
  73. char *dmabufsrc1 = NULL;
    0 ^" A# ]- w, P& `
  74. char *dmabufsrc2 = NULL;
    2 V5 M- k  |% b
  75. char *dmabufdest1 = NULL;
    " w! |7 d) d1 l; N1 K
  76. char *dmabufdest2 = NULL;
      j% k; G2 g; P
  77. * [: ?  T( C. Y) J% O1 W
  78. static int acnt = 512;
    4 n3 A% h$ _- t1 E6 M! o
  79. static int bcnt = 8;# z  n, y% B; Z: `2 H) |3 D
  80. static int ccnt = 8;. u% O( X. J1 ~5 ], p; c

  81. ( L3 [; G# R( r7 r* C& S
  82. module_param(acnt, int, S_IRUGO);* H/ p! Z3 u- g% T& V
  83. module_param(bcnt, int, S_IRUGO);1 {* m3 `9 Y) y: a8 ]) A8 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 C- Q8 Z9 G# k; E

3 r8 b- b" e" N) [7 S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; ~0 P! J- e$ \8 J* i" b  h. iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ P; E% F9 O; ?1 @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' M3 Y" M+ H+ `" g2 C' f! v/ K8 b+ P: }. v6 g

0 ^+ j# i: k. \! W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-25 13:37 , Processed in 0.046735 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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