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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ n% R; J" {. q; z5 j
  1. [code]EDMA sample test application
    . O; N  C. u- |
  2. /*
    + m+ u5 j4 p0 R; C: l8 f6 g
  3. * edma_test.c
    4 p, i3 U( v% V: m( E3 n
  4. *+ J2 v2 W5 \# F1 n& C% c! X
  5. * brief  EDMA3 Test Application
    5 L6 [4 O" }( w2 M- X: q7 R
  6. *
    , ?, E* N- ^9 M! c$ x
  7. *   This file contains EDMA3 Test code.
    ! P# o, A2 K  v! W2 m( S6 M6 D
  8. *
    ' A1 {6 s7 v  ^. i# v/ ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / J" Q, T0 w, d3 m+ h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 ?/ d4 e  E' _) W9 y/ u
  11. *         TO CHANGE.
    8 g+ A. u" q! t% X! S- e# T7 X) ~
  12. *
    3 S3 I$ C) p8 @) t: _1 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . C3 o+ z( G0 k; X7 M' K
  14. *
    1 s6 B2 p/ e& y" o0 {; ~
  15. * This program is free software; you can redistribute it and/or. m: g- S/ g7 c- {
  16. * modify it under the terms of the GNU General Public License as  [3 P$ B2 g: l: Q* G. o: c
  17. * published by the Free Software Foundation version 2.
    , ^& c$ G1 _) B+ P% f7 W8 e" b: H
  18. *  D) \& p% \5 z1 [& y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      r5 i; }# u3 h' w* r
  20. * kind, whether express or implied; without even the implied warranty
    * D1 n% N! X7 E- L# I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + F- |+ d( X$ w+ z
  22. * GNU General Public License for more details.
    : t/ d6 [0 D( i) B. z
  23. */
    2 E6 P# `( P3 c' c1 n1 O2 ~; V

  24. , @/ |: a& Y- _% m. p
  25. #include <linux/module.h>
    8 V' M$ |1 u3 g! L5 J
  26. #include <linux/init.h>
    $ J: w" n. L4 z  t
  27. #include <linux/errno.h>; v5 x2 |% U: B5 i9 m( I
  28. #include <linux/types.h>
    ' ^3 K  N7 ^: R4 U
  29. #include <linux/interrupt.h>* f! K8 `0 [2 v9 c& ^
  30. #include <asm/io.h>
    , R1 U) [# Y. C5 O
  31. #include <linux/moduleparam.h>( q/ E/ W. \! J" q! e# x
  32. #include <linux/sysctl.h>
    # ~7 H. d3 [6 S$ ^. N
  33. #include <linux/mm.h>
    2 d$ h, M! V& y/ G. z
  34. #include <linux/dma-mapping.h>
    ! e# z# v  f$ E( w) ^+ W
  35. ' b7 N6 O3 K, R7 \! R5 Y7 c
  36. #include <mach/memory.h>
    - ^2 F. T, ?) r. V
  37. #include <mach/hardware.h>  N- T$ m& `  ^  G9 L
  38. #include <mach/irqs.h>
      z1 e  G9 g3 D, V" q
  39. #include <asm/hardware/edma.h>
    5 ?7 z0 E+ |4 Q4 W) X$ [
  40. 9 C! U2 B$ W1 P4 ]' I: V8 h
  41. #undef EDMA3_DEBUG& B4 A7 Z8 j1 x# S; P" u
  42. /*#define EDMA3_DEBUG*/9 }$ ~. u; K" b- [8 a: K9 s' U" X

  43. + K/ O4 o7 z1 v" X4 R
  44. #ifdef EDMA3_DEBUG! L, r' W+ ?$ r3 |* M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 }) Q* j4 C7 H: {6 s5 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " r, q! n+ b* n( ]+ Q4 u1 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " o2 f8 J8 X: m$ Q! X
  48. #else
    ( m$ m* \& l+ w! V/ N: _& T3 \
  49. #define DMA_PRINTK( x... )% T7 p) ]+ j- R( o. S8 N
  50. #define DMA_FN_IN
    4 l. v" c: n% s/ @
  51. #define DMA_FN_OUT6 ?5 P% ]2 s  N* d6 S' R- m
  52. #endif1 Q: ^& W2 N0 I

  53. 1 Z4 U9 m0 m) K1 |+ S  W/ a6 J6 r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); L% h; B$ J! S1 g
  55. #define STATIC_SHIFT                3
      X: g4 ^3 L, I$ v: d1 c& K
  56. #define TCINTEN_SHIFT               20
    7 h+ j% r+ h1 `" r3 L
  57. #define ITCINTEN_SHIFT              21+ c, ]2 f. N- I9 c: Q! ?4 N
  58. #define TCCHEN_SHIFT                22! M3 \3 F  S" ]7 k8 w
  59. #define ITCCHEN_SHIFT               23
    ; H. D/ p: X! V* u( l# W( d) @
  60. 5 `% C% ?& \2 U
  61. static volatile int irqraised1 = 0;& r% d- @3 y: m5 S6 I9 l
  62. static volatile int irqraised2 = 0;/ m( T. G, N6 E/ f2 I
  63. / j% T  _, V1 t1 e3 Q7 y/ K) S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 C& [3 b0 r( U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 n6 i3 K0 Z) _: l( P4 d. \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# B, @2 H' ?0 F6 d. N$ ^8 Y

  67. ; ?/ B& R+ }+ }& E, E
  68. dma_addr_t dmaphyssrc1 = 0;
    $ U5 U; {! G' N- S& L* ^+ A
  69. dma_addr_t dmaphyssrc2 = 0;
    % a8 h+ J* t! v5 K  k% R3 |7 p3 I/ g
  70. dma_addr_t dmaphysdest1 = 0;
    5 f, G% e. Y4 W
  71. dma_addr_t dmaphysdest2 = 0;+ l8 |, Z& F! n5 D5 t( ?# }

  72. 2 S8 j; L  {# L, Q, a- [7 v
  73. char *dmabufsrc1 = NULL;; C2 S/ o. n9 C2 B5 O# Z
  74. char *dmabufsrc2 = NULL;1 a; V5 I! a: c8 l
  75. char *dmabufdest1 = NULL;
    ' Q* B. S* P  u/ |8 d$ a! W
  76. char *dmabufdest2 = NULL;
    8 P9 \4 e6 ^% E: ^4 {
  77. 8 ^5 A! Z2 Y/ d4 O
  78. static int acnt = 512;
    / P! C  s: o2 d9 X% P, @
  79. static int bcnt = 8;4 n7 k% N, Y+ B2 A2 J/ [
  80. static int ccnt = 8;
    $ ?' G/ Q. \! \# K% j

  81. ( c8 p( f" `2 j; I3 O
  82. module_param(acnt, int, S_IRUGO);- q6 K# ]  h, p, v9 l, `
  83. module_param(bcnt, int, S_IRUGO);
    0 y3 c1 H- m/ `: {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" s. G- Y, A1 F. i' ?  M, k! \& j& Z$ ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ _8 @, ~  s, _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ Z( l  F. a5 q& Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: [% ^+ M5 u; z* }4 ^: g
+ Q7 T# H; }( y* `
$ ^8 o" F+ K, }" k0 ^% p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 22:42 , Processed in 0.037785 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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