OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) E  Y7 n8 Z9 R5 Q+ N4 |$ E# k
  1. [code]EDMA sample test application
    8 R# g4 B8 a. e5 h
  2. /*- P" [% P8 ?8 Y8 {. b( \
  3. * edma_test.c4 r3 |& U9 u# G+ K
  4. *, R" J3 e8 h0 v3 d
  5. * brief  EDMA3 Test Application
    " c, I3 a9 L2 [- D$ S: C" k) c0 D
  6. *
    9 `; f3 x- R. M4 ~
  7. *   This file contains EDMA3 Test code.( W  ]( A- N" f' l5 G$ @" n- }
  8. *# t. m$ F! c) s3 O5 \: h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: b% a, H& g5 H$ X$ K7 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , q6 i4 w) c+ f9 \! {
  11. *         TO CHANGE.
    " R# R& [. E* }2 [* }5 i" q
  12. *) p% T. B( v( \, S5 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 D$ I. c2 p! o/ D
  14. *% {# R& ?5 F7 h6 _# G1 Z
  15. * This program is free software; you can redistribute it and/or. H* a, T' e# B
  16. * modify it under the terms of the GNU General Public License as7 h( A( Q5 }' J% {. i
  17. * published by the Free Software Foundation version 2.
    3 Z0 r% ~! a0 o% o5 u  R- S
  18. *1 {4 S" T5 g* C- q5 A% v, L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 |' O/ M+ k# x4 ?; K
  20. * kind, whether express or implied; without even the implied warranty. w  o# E# L7 ^  u  h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 y5 K! A5 {# m* c+ H/ h
  22. * GNU General Public License for more details.9 ~4 v4 t- W) M6 v! E0 ^
  23. */
    2 I3 c3 f+ D& ?9 u

  24. 8 O+ f$ q3 l  u/ c, J& p" {. y; f
  25. #include <linux/module.h>2 e# M4 V3 Y4 R* R3 c
  26. #include <linux/init.h>6 v% ?/ F( W. ?) k4 {
  27. #include <linux/errno.h>
    / j3 h% {% B1 [
  28. #include <linux/types.h>
    $ u8 p1 y2 b6 O& I2 c$ q( i* z
  29. #include <linux/interrupt.h>
    9 G& z# K, k# x% [( I2 X: E
  30. #include <asm/io.h>
    8 z% P  O1 L. D2 v; F1 M- Q% g7 e
  31. #include <linux/moduleparam.h>/ T+ e+ C. q: `& a  V+ y
  32. #include <linux/sysctl.h>
    * F3 f( I* e. E+ t) L
  33. #include <linux/mm.h>
    ( [+ C! L; _+ b) f/ }. b; i
  34. #include <linux/dma-mapping.h>- ]4 a8 s7 Z# c6 J

  35. " u! j6 w7 x( H) u. c
  36. #include <mach/memory.h>
    5 u2 @0 P2 N. }# ~$ E
  37. #include <mach/hardware.h>% x- F6 T& w6 H$ J0 e0 V% _# _
  38. #include <mach/irqs.h>& }" h) e! q! U2 n5 R% r+ K- S
  39. #include <asm/hardware/edma.h>' `" B  m0 M% c7 P9 n

  40. % s" d+ M2 }2 q: [
  41. #undef EDMA3_DEBUG
    7 H5 z) u1 m& F& h5 r* N4 `2 s) C. @, x
  42. /*#define EDMA3_DEBUG*/
    ; B6 {% u0 C1 u; h0 u* m9 x
  43. % I$ n% l9 l* c
  44. #ifdef EDMA3_DEBUG7 U5 G6 h3 d! f$ Z0 [5 O/ s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; x4 N, b$ t: X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( I* l' f# J5 g' H- }) K" W5 P5 [, G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); J) T5 r4 S) m$ B$ M
  48. #else
    3 H) ~; L, j; D0 |
  49. #define DMA_PRINTK( x... )
    ) X/ e* A2 w8 R7 j6 S" A$ q" D
  50. #define DMA_FN_IN2 B' S. q" e8 A% I' Q( R
  51. #define DMA_FN_OUT
    , M, m* _& d; }( L
  52. #endif9 e, O& _$ ~" {) t5 T% V

  53. " C% ]) z9 s: f2 v- p3 T" X7 Y9 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & m0 b! o5 Y6 \; j7 s* m9 T
  55. #define STATIC_SHIFT                3
    ! N: X. k: }# x# d
  56. #define TCINTEN_SHIFT               20$ {3 s" S# n* O+ i$ }; l0 J3 o4 m
  57. #define ITCINTEN_SHIFT              215 c1 A& ?- v6 r9 P% t* V
  58. #define TCCHEN_SHIFT                22
    8 z% ?1 _1 J3 c% i8 D8 z
  59. #define ITCCHEN_SHIFT               23$ c* z, _" ]0 j. f1 y" i

  60. 0 h- {5 J" e3 Q
  61. static volatile int irqraised1 = 0;
      M+ w$ Q9 S3 C0 K  N8 D- k3 u
  62. static volatile int irqraised2 = 0;! Z3 f" [; |  }& |6 T( Q
  63. * p+ @7 {$ [6 e9 s- }2 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 r! F( `6 e% {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- n' p. T, {) |0 C5 J4 T3 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . Y. d! p0 T' ?+ F

  67. " f: H; u$ w, T7 C  k: m& P
  68. dma_addr_t dmaphyssrc1 = 0;
    0 \9 G  {7 e; _7 c' q% x
  69. dma_addr_t dmaphyssrc2 = 0;
    ; d7 h% @- Z+ R1 l) c
  70. dma_addr_t dmaphysdest1 = 0;
    5 ^) o" a- w/ q' F
  71. dma_addr_t dmaphysdest2 = 0;6 ~% U6 q; w2 o

  72. 0 C0 Z5 S9 M5 Z
  73. char *dmabufsrc1 = NULL;: o: R8 m1 X# d
  74. char *dmabufsrc2 = NULL;
    , ~7 z( A. z/ C. N
  75. char *dmabufdest1 = NULL;' S+ B- z& h; N/ J
  76. char *dmabufdest2 = NULL;
    7 i6 h- ]0 z# c

  77. ! Y' y) U" N1 A0 S: E" Y' W
  78. static int acnt = 512;, T% f. m7 |9 [  w! G( P0 Z
  79. static int bcnt = 8;
    5 {2 |$ y* p$ O
  80. static int ccnt = 8;
    ( }  D; M2 K2 w8 c0 @$ l
  81. # a7 z! }% z. h4 R# f( l4 `" e" O
  82. module_param(acnt, int, S_IRUGO);
    0 A( ]% k- ]4 c7 @6 N  @; L
  83. module_param(bcnt, int, S_IRUGO);
    ' ^" F$ V) r5 k2 o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 q' H1 Q, t' ?  |8 w4 d9 H/ ?9 E! ?( H1 E! Q3 A/ d/ ?# i: l0 `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) l. @) b( V; ~: O. M" Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" E5 x% x/ O: j+ [% f; p3 }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' [0 X8 d: M) Q5 k& K, P! Q
/ ~$ A8 ?2 S& W4 N
6 e/ v5 F! W: {. k: t+ C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 21:35 , Processed in 0.036633 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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