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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % ?& E9 P0 k3 f
  1. [code]EDMA sample test application& O$ {$ j! C! n# `' M& L
  2. /*$ ^9 [4 T2 ]- R4 x6 y
  3. * edma_test.c
    2 B% T# a, V) j% T* m+ i' p6 ?" U
  4. *
    % N% }2 V: H* P& z
  5. * brief  EDMA3 Test Application% n! V, }7 g+ L+ G
  6. *
    , q" V3 W4 \* Q, O& @
  7. *   This file contains EDMA3 Test code.
    + V' G- R! _: P# @, \
  8. *
    6 U4 V  o* D! O; q2 S  q8 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / y9 S6 T( [' f$ o# |$ K6 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; G) O$ j; ~) x- I
  11. *         TO CHANGE.) D1 O& q! j+ q, z9 y& _3 [
  12. *: c% A4 ?8 u9 W4 J9 t/ I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * T; Y" h$ I8 y5 n' I  `3 S
  14. *
    1 I( Q' G9 H3 b/ e5 C
  15. * This program is free software; you can redistribute it and/or+ M# O  G5 K4 |; b6 C
  16. * modify it under the terms of the GNU General Public License as" X; P8 G+ d0 C; `! x1 p$ ?+ ^
  17. * published by the Free Software Foundation version 2.# p$ b: b) u. r, }& x6 E1 K) |0 p
  18. *7 ?7 Y2 H1 Z4 a. |$ G/ |9 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 m% p4 D+ A) `% @
  20. * kind, whether express or implied; without even the implied warranty
    ! M" i4 T$ g. S# y0 r. m: t) M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- r$ h: d0 S3 I: D  j! D
  22. * GNU General Public License for more details./ N! X& V2 P; l, V3 d
  23. */5 @) ?% Y9 L# d: y

  24. : h4 N" j* h5 C% B
  25. #include <linux/module.h>8 s' P" m9 {6 Y& G
  26. #include <linux/init.h>. I5 n0 {, ?9 h, |; z
  27. #include <linux/errno.h>6 z% T5 x: v. O+ a
  28. #include <linux/types.h>) @/ `. ?) E9 G# c% C) A! A0 u
  29. #include <linux/interrupt.h>
    5 l# K0 r9 g" b& K0 W: u
  30. #include <asm/io.h>
    5 T  o4 I* |5 v! |
  31. #include <linux/moduleparam.h>
    + ^: l1 |1 D/ Q. N0 }% u  Z
  32. #include <linux/sysctl.h>5 e' M; S* @3 X4 T
  33. #include <linux/mm.h># }! h( Y6 S: Z: s9 p* m
  34. #include <linux/dma-mapping.h>
    0 j) j" M# b! Q1 y

  35. - m( a6 [( |9 \8 h% K* m+ I
  36. #include <mach/memory.h>
    " D. v% Z1 }9 W; o
  37. #include <mach/hardware.h>% s! C2 ]8 z9 }3 G  ]' q8 g6 k
  38. #include <mach/irqs.h>3 q9 n6 w# N6 O. u' d* d3 {
  39. #include <asm/hardware/edma.h>
    , q# {. I1 J+ z. c( u
  40. $ j  t- U/ |: ]- I9 K) e
  41. #undef EDMA3_DEBUG
    1 x: h- p9 v, F
  42. /*#define EDMA3_DEBUG*/
    ! p$ I( a& F. |
  43. / N' i. R0 E5 e9 G+ }8 v9 ]
  44. #ifdef EDMA3_DEBUG6 h; d. e0 o3 T3 V& O; R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) L3 ?7 R0 b9 }* M0 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ ~; \# [) l; f0 [' u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 w, O  P5 j5 l% v
  48. #else: T6 R! U- R3 H! Z
  49. #define DMA_PRINTK( x... )
    % M/ f1 n9 k- _4 a8 b
  50. #define DMA_FN_IN+ p. t/ q, H' `; G5 u4 M: z
  51. #define DMA_FN_OUT
    ' n5 b/ h. Q9 v( [
  52. #endif
    4 Q6 ?& \. [5 [0 r

  53. 4 _( f4 C& `3 h6 c1 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , I+ M' e; \7 y: s1 _
  55. #define STATIC_SHIFT                3$ b" @6 b9 X: Q! q; D2 X7 ^
  56. #define TCINTEN_SHIFT               20
    ) Z) P% t% n; ]) N: H; p
  57. #define ITCINTEN_SHIFT              213 [  g% A5 U" E5 G  e0 N9 V8 ]
  58. #define TCCHEN_SHIFT                224 p( q# b/ z7 {
  59. #define ITCCHEN_SHIFT               23
    5 a  |8 z+ A6 e% ~8 Q& f' J
  60.   k2 Q$ `% d! N6 M
  61. static volatile int irqraised1 = 0;
    & {; M9 R) y$ w+ u
  62. static volatile int irqraised2 = 0;
    2 R) H5 e  f/ k( j  Q# L
  63. / O) d9 u5 h4 u, g$ q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' N' \, ~* ^5 |" E! \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 A. ]6 a% Z6 K' I/ N  [; S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " L% i6 {1 g7 ^' }  _
  67. 1 w& A, [! L; ^
  68. dma_addr_t dmaphyssrc1 = 0;7 z/ _8 t8 Q+ D- M  Y
  69. dma_addr_t dmaphyssrc2 = 0;3 l9 E) A2 i" _) D6 B% |0 m
  70. dma_addr_t dmaphysdest1 = 0;/ S: u  r# p  x) v) p! V
  71. dma_addr_t dmaphysdest2 = 0;
    , I  p! I, _4 M7 ?2 \4 g# K

  72. 0 Y' [9 f& b8 |+ t% ?' p$ f
  73. char *dmabufsrc1 = NULL;
    % C3 g) M& v( ^0 _/ U1 m: v7 T
  74. char *dmabufsrc2 = NULL;
    6 ]$ M! y: s6 N$ p
  75. char *dmabufdest1 = NULL;4 X- G8 Z5 o2 p4 J) p  }; K6 R) L$ c
  76. char *dmabufdest2 = NULL;2 @3 Q3 {$ t2 G$ Z/ q% n$ Y

  77. ! k3 ~$ \$ w5 N
  78. static int acnt = 512;
    - X2 d* O) q4 c2 X; @
  79. static int bcnt = 8;9 v% [" D# {* }* }1 K5 U
  80. static int ccnt = 8;0 x8 C  t% T( t. u5 @" m+ D
  81. 8 c/ |" k' l: j
  82. module_param(acnt, int, S_IRUGO);
    4 e( V7 _% C7 T# X4 Q% x
  83. module_param(bcnt, int, S_IRUGO);* `6 D: ]6 x2 D/ @& t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( o- e( c- H  g$ X/ y) F
8 L# ]* j/ u. B8 P$ s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  C: k. v! P- b( _6 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 ~0 t' h' Y# P6 f- L' }4 L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# z& ]4 i! S/ D. O
6 V3 G1 v# q4 Y+ p! u8 e% Z- k  H  Z9 ?! ~6 W3 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-8 21:45 , Processed in 0.038347 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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