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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 F9 o% ?- v/ |& k& q3 J1 G& p
  1. [code]EDMA sample test application
    ! P& p( o5 X8 ^. {; H- \
  2. /*
    4 j# `" j7 E. w7 ?$ m) w3 |) g
  3. * edma_test.c2 B6 U$ Q. T/ x# A" s; x
  4. *5 Y$ ?# `4 l. {$ t; e
  5. * brief  EDMA3 Test Application
    - C/ l. G- o0 {, M. i( T
  6. *
    8 F( x3 ?3 T$ e. ?- x1 s
  7. *   This file contains EDMA3 Test code.
    - E& Z* D7 b& U5 F
  8. *9 Z$ h3 s+ A3 `2 }+ j0 p3 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . l$ w4 o4 I" _! J; Y6 }% i" x# W5 G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % k. F' M0 t$ ^# ~4 L8 k/ W
  11. *         TO CHANGE.( z6 s8 w) P- Z
  12. *' R' O; F. X* \7 ^, P9 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 S+ K7 p2 q& x1 D2 E
  14. *) J; k8 X# v& w4 g9 i
  15. * This program is free software; you can redistribute it and/or9 }0 M4 S" V  P2 C
  16. * modify it under the terms of the GNU General Public License as" g1 @) B& f$ b7 |4 g+ F8 |
  17. * published by the Free Software Foundation version 2.
      {/ x) {( z1 P9 g* F
  18. *) k- |; m# E0 y8 m! d4 {. v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 a- f: \0 \5 y
  20. * kind, whether express or implied; without even the implied warranty7 X4 o6 o4 p$ \/ e1 J3 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & \9 t% Q2 |, E$ s
  22. * GNU General Public License for more details.4 f0 F$ `' W2 G) a9 Y/ `
  23. */
    7 e3 L+ R1 g) h: x& v6 B

  24. 2 r+ f; F/ t3 O8 z' E, B! i
  25. #include <linux/module.h>
    + V$ \2 y& e7 Y2 y
  26. #include <linux/init.h># c4 r3 v: Q# ]: t: ~
  27. #include <linux/errno.h>
    1 i( O# X% _7 X4 W( }% d
  28. #include <linux/types.h>5 k, g$ j5 p+ I/ f2 V
  29. #include <linux/interrupt.h>+ B) L1 O" A' J' u/ l1 a
  30. #include <asm/io.h>* N" M/ k% s; |5 @) d$ S" g, g
  31. #include <linux/moduleparam.h>
    * d) ?( p/ K# [$ t/ {. K0 a
  32. #include <linux/sysctl.h>) H2 B9 ~- J/ y. z# p
  33. #include <linux/mm.h>
    ( F: g3 d4 B( a4 y) c' Z5 W( w2 i% X
  34. #include <linux/dma-mapping.h>
    ( O* I/ N! B, e- @5 ^
  35. , m, j" G8 m+ K, j* s. h' n
  36. #include <mach/memory.h>
    5 q4 ^& h6 P+ Y/ n# E- r  E
  37. #include <mach/hardware.h>- v0 A( u% @& s3 v( y- q4 k
  38. #include <mach/irqs.h>
    * I- t$ B& A7 l2 W6 u- I9 y: X* @
  39. #include <asm/hardware/edma.h>
    ) y& e4 }5 {1 _4 r
  40. % u$ P& Q# n1 N& |) q( ]2 W7 l
  41. #undef EDMA3_DEBUG% @4 W7 \3 D8 B* V
  42. /*#define EDMA3_DEBUG*/
    , F" a- f  F- n: s

  43.   K" }& r4 V) S0 i
  44. #ifdef EDMA3_DEBUG
    ) h7 C% @. p0 B2 d# S9 E' _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , a: Q6 ?% r3 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # V1 c6 v0 ]) f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' h+ D& k# [+ ~$ @
  48. #else" {2 ^3 ~6 \/ t+ @+ Z
  49. #define DMA_PRINTK( x... )) Y/ \% c  v2 X7 I  U2 i
  50. #define DMA_FN_IN7 `! }1 K9 q! T# e$ M  n
  51. #define DMA_FN_OUT7 P! W, r! |; D, Y% l8 M
  52. #endif( J" W3 R  A& D

  53. # d# ^) I0 N( ?3 C2 a* u4 T2 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) V: {. }( s' P7 f/ b
  55. #define STATIC_SHIFT                3' H4 P) F* `; F! F7 u/ E# i
  56. #define TCINTEN_SHIFT               20
    " V3 N9 D% X0 p$ i- N  V
  57. #define ITCINTEN_SHIFT              21
    / a# Y2 E  U. [1 D& ^" h
  58. #define TCCHEN_SHIFT                22
    ' T9 q' u( K9 L' o; g
  59. #define ITCCHEN_SHIFT               23
    7 z) [  d- \! L

  60. : C* Z4 N6 x2 e, a  d2 G6 x
  61. static volatile int irqraised1 = 0;- ]7 v+ S, Q9 e+ R8 C: H
  62. static volatile int irqraised2 = 0;
    . f# }6 t$ i/ R
  63. 6 j# S8 Q) M( J, e! F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 q9 ^" k) I% }: @7 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' T$ Q9 T+ y. C/ ?7 C& |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % N1 D+ T9 f+ E/ a, b' S8 Z* }

  67. * v* S. B, @" g5 l
  68. dma_addr_t dmaphyssrc1 = 0;3 _6 e- a/ f, R; i. v' k
  69. dma_addr_t dmaphyssrc2 = 0;" t  _  R5 e- ]3 z
  70. dma_addr_t dmaphysdest1 = 0;
    8 l6 d. B8 h, i  i  r8 Q3 e
  71. dma_addr_t dmaphysdest2 = 0;% d, \; q2 i  d- H

  72. ( ~9 u: ?+ H% T2 q6 B4 @
  73. char *dmabufsrc1 = NULL;
    1 S+ Q4 f; E! R8 N
  74. char *dmabufsrc2 = NULL;
    + p$ V. W" q. Q; {" \: Q
  75. char *dmabufdest1 = NULL;# `( ~8 k, b* A7 J  _
  76. char *dmabufdest2 = NULL;
    7 y/ `& m- I- P" ]+ c+ d4 C+ {: z- e
  77. + f& p4 x% g+ g1 e! G$ t
  78. static int acnt = 512;5 k/ _+ p! ?# Y( V% F/ d0 n
  79. static int bcnt = 8;( ^3 Z& y+ c# W5 y+ ]
  80. static int ccnt = 8;
    7 S/ @" `1 r; S8 V" \3 Q
  81. 2 X5 b" @. U4 N7 t- `( [& I3 f1 ]
  82. module_param(acnt, int, S_IRUGO);8 I7 q; p2 W2 ^: p4 g9 Z
  83. module_param(bcnt, int, S_IRUGO);
    - M1 h. r/ ]8 s% [) i7 l: m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# z* v4 {. @" ]% Q: @8 N
$ f3 b, M/ f' J; b' C2 v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- x; @  Z4 J( O. k* ^" {# b; P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( q/ f4 }. z7 Z. Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% {2 ^' A! T! X4 d

: b( h- ^6 V& d7 ?7 b. l( I0 K1 v6 D! }( |; b$ z, Z& C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 09:11 , Processed in 0.038763 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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