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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 V% [( Y, l7 k6 h2 I4 B
  1. [code]EDMA sample test application/ L' g3 g! l$ G( }) p, \5 V5 g
  2. /*
    7 [% |) x1 |7 u' a6 j. g& D
  3. * edma_test.c/ I7 G0 L: k5 h3 |6 o
  4. *
    - e5 b7 F- ~7 m: |
  5. * brief  EDMA3 Test Application9 ?0 \% f9 G7 D/ M* f8 \
  6. *; s7 Q" V* ^# G8 a) d
  7. *   This file contains EDMA3 Test code.) t3 e& n* M- t$ v
  8. *$ R! w; y  D5 P1 F6 x6 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 ?% y" r  @& k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) @. o$ {1 C! h! F9 \( x5 _" |
  11. *         TO CHANGE.9 @' V+ J3 O( ?' j  Y! S
  12. *
    7 q# g5 {* B, T( G1 u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% {1 d0 G/ b+ W/ K8 L, P" \/ e
  14. *+ q/ J$ y! A1 f! Y
  15. * This program is free software; you can redistribute it and/or
    & m  Q3 [0 g7 s% b" k2 @
  16. * modify it under the terms of the GNU General Public License as
    ' Z" S- u3 S/ I6 j
  17. * published by the Free Software Foundation version 2.1 H, O( A+ F# f$ [3 j) d! T- V
  18. *
    ' o. U# W* D$ S+ X9 Y0 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 J7 i* M; B, W; D; Y9 \4 n( ?& L+ W
  20. * kind, whether express or implied; without even the implied warranty5 @6 n% A' d- t# u. K) x  D7 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" b5 j( Q5 w$ j+ O$ a
  22. * GNU General Public License for more details.
    7 K- ?) \1 ?* `9 z7 }
  23. */
    8 j, [9 |" {" }+ l& Z
  24. ) v. ], h9 ]( g
  25. #include <linux/module.h>: _1 t3 x7 G- G  y8 Z
  26. #include <linux/init.h>
      x& H3 m" f5 `& |- _# }
  27. #include <linux/errno.h>2 ^5 G6 M6 C( e& p( n9 a
  28. #include <linux/types.h>
    2 q! V, G2 y$ ~! Z! ^# Q/ @) R
  29. #include <linux/interrupt.h>
    3 x# Z9 B+ Z9 `1 P1 ~4 J! S- P
  30. #include <asm/io.h>. ^: l) x6 [0 V* Y' |
  31. #include <linux/moduleparam.h>
    + O3 z  m$ U) O, Z
  32. #include <linux/sysctl.h>
    ( b$ s9 T3 O9 i1 i6 s
  33. #include <linux/mm.h>
    2 ~: n% l7 {$ [$ k" d1 m$ }
  34. #include <linux/dma-mapping.h>* M+ O  f- Q8 h7 r

  35. " j' O* B8 P) y% a
  36. #include <mach/memory.h>' V# J/ z: G4 M" H  O# x! w) k4 C
  37. #include <mach/hardware.h>) o3 ?; a( F- f$ d# h7 E3 J
  38. #include <mach/irqs.h>; \0 g  M7 S' }4 k) ]$ t
  39. #include <asm/hardware/edma.h>
    * b/ Q. W+ `  L% R! y; A4 E& W

  40. ' O* [4 ?6 h  M
  41. #undef EDMA3_DEBUG
    1 @; n# s8 X( a
  42. /*#define EDMA3_DEBUG*/
    6 L2 }1 o2 g- Q/ {9 C- d

  43. * G& _  A9 p7 N2 b0 I( y
  44. #ifdef EDMA3_DEBUG9 ?3 v4 q' v' E( n( I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ |4 L( |7 t) C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 t& S& Q) m+ ]0 o  n! o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" B1 h9 @* U3 [
  48. #else6 h- P* e; ?/ p9 F* A4 N5 i; y! G. T
  49. #define DMA_PRINTK( x... )
    4 y. {. a; {- G# Z+ K, A6 T+ e
  50. #define DMA_FN_IN
    2 l+ @1 B' t6 R- P" q  n
  51. #define DMA_FN_OUT$ L4 @6 T9 ]) q0 v7 Y! h8 t
  52. #endif
    + d& A# {/ w" d- W; M. V
  53. $ K; n: Y  G3 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ R3 J/ C) r% E0 Y) [( e
  55. #define STATIC_SHIFT                3
      j0 f4 H5 U! F4 x
  56. #define TCINTEN_SHIFT               208 ~; h9 P) z( p8 L. p
  57. #define ITCINTEN_SHIFT              21
    " o4 q, C( h% ?) r9 i1 R
  58. #define TCCHEN_SHIFT                22  H4 d9 ~8 \; T2 Y1 a1 b
  59. #define ITCCHEN_SHIFT               23
    ) s  y+ `& u5 f" `

  60. ' W1 c: _3 }3 h  n! F/ c1 f
  61. static volatile int irqraised1 = 0;
    % V9 _( O+ m. w' h+ s
  62. static volatile int irqraised2 = 0;2 s* m+ }% J- `& |4 z) c0 _
  63. : Y" @8 y" o0 V; `- ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 w! \' }# R% r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 m$ Y7 z- B- F! i* p1 z, P) l! s( o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Z( y0 @+ T5 c! R- ~3 m2 `
  67. / Q6 h! \0 j0 |% s2 X4 V. k: h
  68. dma_addr_t dmaphyssrc1 = 0;
    . W8 F; K: W- {" ~2 A# P3 o
  69. dma_addr_t dmaphyssrc2 = 0;0 `- X6 ]3 T' T5 V$ a! s
  70. dma_addr_t dmaphysdest1 = 0;
    3 @. s/ R- r1 u+ F$ ^
  71. dma_addr_t dmaphysdest2 = 0;
    # h9 M' b5 c5 a. u; _

  72. 3 l4 G  ?% |9 a8 E7 Q
  73. char *dmabufsrc1 = NULL;
    9 B& V/ l' w$ h- j" x+ H
  74. char *dmabufsrc2 = NULL;
    $ p4 h, K! O! a( g$ Z3 q
  75. char *dmabufdest1 = NULL;
    - _7 m, r$ O7 A1 x$ V
  76. char *dmabufdest2 = NULL;5 U+ n# }# }8 I6 X
  77. - E) ^- r! q5 N/ |# u$ ^4 F( U
  78. static int acnt = 512;8 P) J  Z* `$ e; G
  79. static int bcnt = 8;0 U2 P/ M' G$ h/ [
  80. static int ccnt = 8;
    ( z2 [6 [1 B. J8 {4 X# N
  81. ! b2 j, i. G; O3 e4 M# W8 x
  82. module_param(acnt, int, S_IRUGO);$ V) s& m2 z$ V4 y9 Z$ C, N! A
  83. module_param(bcnt, int, S_IRUGO);
    6 M2 `1 j' k. q5 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 ?1 N6 B/ v) J2 t+ }4 U+ k* e* ?4 X. V" I4 A) R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 g; R4 g, e5 @, ^+ z; X. F* o: qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 E2 b/ i, Q2 y: ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 ?3 }  l& M6 S4 I" p  b( I$ a' O5 f: e; _# _" o
% `+ E  ~2 A/ z# \" ]8 z. k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-5 19:26 , Processed in 0.038700 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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