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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 Y+ H8 d5 x  ~7 O! T0 F
  1. [code]EDMA sample test application! C+ _$ q/ x" L5 {
  2. /*( ?: x3 S2 N& E0 d
  3. * edma_test.c$ S5 D$ F# x! N* d; X' i
  4. *4 l7 q6 K* a& v' o
  5. * brief  EDMA3 Test Application: v) T  |' g7 P4 G! X
  6. *0 N# b2 N6 A' G7 s7 ~7 s
  7. *   This file contains EDMA3 Test code.
    % ^, [. e5 ?" O2 M/ n) U. M
  8. *
    - d& ?: ]* h6 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      C1 v9 s$ Y* g4 f; N4 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 g. R+ W& h$ ]" Q
  11. *         TO CHANGE.- I" {- T6 N. M3 T" m) T3 n. S
  12. *
    8 @1 s1 Y4 C* z7 D6 y# F" ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% A( s8 q5 n. m/ z7 v8 w
  14. *
    * E1 b7 v. o9 ?0 H
  15. * This program is free software; you can redistribute it and/or) Y/ u+ p* v) ~5 ?' p9 q
  16. * modify it under the terms of the GNU General Public License as( k; U: B: a6 k/ Q5 E9 `- Y
  17. * published by the Free Software Foundation version 2.
    , C* g# B! ^  e: T) f- z4 `- ~
  18. *$ _7 W$ U. h* ^' ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! Y0 a1 k' `+ t  K1 |
  20. * kind, whether express or implied; without even the implied warranty3 ?. O" a4 d4 g/ i8 m, U; [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 h; d. f$ X7 |$ E1 s
  22. * GNU General Public License for more details.( u( o6 v# @3 X
  23. */
    - B3 u% k& C6 c8 h1 e% }7 S

  24. / l, G8 S! k# l% x1 n" l
  25. #include <linux/module.h>! d0 E: U" q. M4 U
  26. #include <linux/init.h>
    5 h9 M' n& b) o4 W! b+ e6 c, v
  27. #include <linux/errno.h>
    5 @5 E6 d, I9 f& m1 Z
  28. #include <linux/types.h>
    1 ^" q( J! e3 ]2 z
  29. #include <linux/interrupt.h>
    * T- l6 z& L; A) e/ }
  30. #include <asm/io.h>
    * ]5 J  v/ G8 u, G" E
  31. #include <linux/moduleparam.h>
    2 P# ~: x' g; |5 x
  32. #include <linux/sysctl.h>' U% l; z5 F) C: E" Z# r2 j
  33. #include <linux/mm.h>
    1 n7 @9 B' h, h8 Z: }
  34. #include <linux/dma-mapping.h>/ L) y1 m" \9 l( S" U

  35. % w! D5 o$ A8 i+ Q9 I5 c
  36. #include <mach/memory.h>
    * P" o) Q( a8 T- s- r; `' V
  37. #include <mach/hardware.h>. m" r% Z; U: ^. {" l
  38. #include <mach/irqs.h>+ I5 [! d/ f/ |& |! t: |
  39. #include <asm/hardware/edma.h>$ Y4 q2 S5 F7 u  V5 B+ O, Q3 S
  40. - r7 P9 L& B2 r/ d7 U) L: e/ U
  41. #undef EDMA3_DEBUG
    ; b: [5 n/ `6 U
  42. /*#define EDMA3_DEBUG*/+ x- C6 D  h: T* ~* v6 b3 _
  43. 0 A7 n1 [5 S4 D/ p! Y; S4 z: c+ {  [
  44. #ifdef EDMA3_DEBUG+ J: P' W5 H% \/ p3 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' J6 {& A* i" F; G' L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). W9 [3 Q) w+ c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & \; W. r5 z0 G1 j( x
  48. #else
    % L6 Q, k3 D, i# Y& _8 G* `
  49. #define DMA_PRINTK( x... )& ], n& U- e- Q: O7 z/ G. G/ ?4 a
  50. #define DMA_FN_IN; R" {2 o6 t/ w- B" V
  51. #define DMA_FN_OUT
    ( ~- l4 `5 R' @4 f" ]# E6 q" M
  52. #endif2 J3 o, H  I* ?* D
  53. 3 C, m# x% F2 O; D. ?" Y4 }- `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 {( Y. L, n# ]4 v5 Z
  55. #define STATIC_SHIFT                30 P4 m: n5 ^2 M/ q$ D4 n) o$ Z) Q7 m
  56. #define TCINTEN_SHIFT               20
    9 R' s- i! `8 j, R* g* f, \
  57. #define ITCINTEN_SHIFT              21
    : X0 E/ O. r$ V* M) x9 P
  58. #define TCCHEN_SHIFT                22
    * I: `9 T$ Y5 J$ v
  59. #define ITCCHEN_SHIFT               23
    & n2 c( v3 v, i, j' R# Z3 a
  60. # f) m# j# \" Q* x$ q  @
  61. static volatile int irqraised1 = 0;, P* e! H: n( C! u) e  i, K
  62. static volatile int irqraised2 = 0;# z1 \! O) _7 q9 S- Z

  63. ' M) d# ~$ `4 c$ \9 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: k/ |* m% m7 C8 s7 l" ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' ?* ]5 N5 d" |) x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( U7 T; v/ Y7 j7 L8 h% z

  67. 3 E5 t9 y: {; F) k" n; N
  68. dma_addr_t dmaphyssrc1 = 0;
    : Y* M- o" d& S1 w& r: Q
  69. dma_addr_t dmaphyssrc2 = 0;% s' {/ D  Q& ?2 l
  70. dma_addr_t dmaphysdest1 = 0;8 i4 l/ c8 `* M3 ^8 r7 \! h* r
  71. dma_addr_t dmaphysdest2 = 0;) R% B* q0 F0 T0 k

  72. . i, S. t+ ?) Z2 h+ U
  73. char *dmabufsrc1 = NULL;
    + ], v' F) ?1 u. o$ w7 ?
  74. char *dmabufsrc2 = NULL;9 R8 c2 X1 P+ x2 e# \1 L# R
  75. char *dmabufdest1 = NULL;
    . O$ @0 @2 H; W/ A" G1 ]
  76. char *dmabufdest2 = NULL;" t# [# l2 |; E+ `) r
  77. 7 ^* `% b' A: G& z
  78. static int acnt = 512;
    * @3 W4 N: X7 [5 ?5 ^5 }7 Y
  79. static int bcnt = 8;' @2 |% n& x3 w+ i3 a- E
  80. static int ccnt = 8;
    ) m6 M, j9 s+ r+ U6 ~
  81. 8 d, t$ j0 p! `$ ]+ ^! g
  82. module_param(acnt, int, S_IRUGO);
    , g, B4 n5 E' Q& f
  83. module_param(bcnt, int, S_IRUGO);4 f4 ^: }7 p: o" N" P" B+ y' t( x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. z+ m  [/ J" P/ h! a, a  [, J  K' E( X( ^% ]3 s0 @1 O6 E; t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* ]  X6 }) C, ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  y- c' x. Z- G9 ?: `/ ]% D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! i/ {% |3 |5 ?: V7 y* o/ z
% g4 `# ?( o- T6 O" c; ?; S6 {  Q

( M% J  \. ^, A" @# @" F/ M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 05:39 , Processed in 0.039028 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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