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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ x% r  P+ l( h; n: ]
  1. [code]EDMA sample test application
    . K$ W* ]# S  s1 `+ H, Y& X
  2. /** v+ p: t- T! W, B! a( ?
  3. * edma_test.c& e& y6 V- y/ H9 ]
  4. *) P& @. o# w" a& N- E4 F+ i
  5. * brief  EDMA3 Test Application6 N1 v" Z+ d! [0 y! G
  6. *
    ! C2 ~. w* x% t4 e6 q
  7. *   This file contains EDMA3 Test code.6 M& A7 m, h' E  h
  8. *
    5 G: Q! O2 \$ i, z# `! [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 u8 B, g$ j8 b* n- M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( y3 B. t% N. V+ \; [
  11. *         TO CHANGE.5 W0 C: m4 X% a9 Z
  12. *
    7 Y! ?8 {1 W( @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 c" o$ d( |. W2 Y) e, J4 _; w
  14. *
    5 Z! _( P! J& |, E2 j) l
  15. * This program is free software; you can redistribute it and/or
    ( N  i7 j) M+ y; t/ ?1 S
  16. * modify it under the terms of the GNU General Public License as
    6 ~( m$ f6 D1 U+ x* \
  17. * published by the Free Software Foundation version 2.
    + z8 o0 c$ }0 U+ K4 b
  18. *
    ) U7 f6 B) z! R1 u2 J; k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 y; u6 V) y5 s3 u9 T
  20. * kind, whether express or implied; without even the implied warranty
      |) ~; R/ f9 d7 H. H9 }# T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % t* r: R, Z0 c. P
  22. * GNU General Public License for more details.
    4 Y8 W, v. Y8 X6 t
  23. */! x, U. q0 W  X- h6 A

  24. ! ~1 Y, Z! y$ B' {6 p$ y
  25. #include <linux/module.h>4 @7 d: u$ B  O  c$ _% E) p
  26. #include <linux/init.h>. o" }4 L' ]5 a6 x: C
  27. #include <linux/errno.h>8 g7 K" {+ s  m; T4 R
  28. #include <linux/types.h>0 w0 }2 \1 j) J: \
  29. #include <linux/interrupt.h>
    " M* X- L9 `) A
  30. #include <asm/io.h>
    6 F' u3 |2 P" N! k- B
  31. #include <linux/moduleparam.h>
    3 r, R! x% {( j- e
  32. #include <linux/sysctl.h>( B3 P0 _( @0 O
  33. #include <linux/mm.h>
    & W) C# q6 n3 ]- g0 h
  34. #include <linux/dma-mapping.h>* E  ^9 {. V0 o, {

  35. * L% o: m2 u$ V/ c- q
  36. #include <mach/memory.h>! `+ \6 n& `) H/ d. }4 V) ~
  37. #include <mach/hardware.h>
    ' E; s: U# w( q  T' j
  38. #include <mach/irqs.h>
    / z: `. v% W9 t- i. q; A1 G% n+ Y
  39. #include <asm/hardware/edma.h>
    $ `# r3 ^1 _- |7 [5 l7 D, t+ g

  40. * ]8 x  F! z8 z* D4 I8 M' o
  41. #undef EDMA3_DEBUG
    # n8 I; I1 |% A
  42. /*#define EDMA3_DEBUG*/
    4 c1 v5 Y: c# c& z5 \# V

  43. 1 s" u( g' z9 ?2 u$ s
  44. #ifdef EDMA3_DEBUG
    0 {% k5 e, x. D; f9 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# V- H7 d( Y& W  N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; \4 p7 P- B' m/ k% d( K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 C  E! u  C( f3 A3 s; n8 J
  48. #else0 c, ]( T8 X; {! D# V, I
  49. #define DMA_PRINTK( x... )
    , _4 _( B; `# [& c/ }0 t  ~3 p' F
  50. #define DMA_FN_IN
    1 c& Y1 R9 `$ I" W( m! a
  51. #define DMA_FN_OUT! I+ m8 r4 {% D) D
  52. #endif
    + t5 o* X' Z* L! w2 [0 ?

  53. * n( I) x. l1 U6 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; [8 _6 W# g4 r2 z& g
  55. #define STATIC_SHIFT                3
    - C( X# g7 Y! r
  56. #define TCINTEN_SHIFT               202 m4 B$ \. E+ Q' }+ U% I* }  G
  57. #define ITCINTEN_SHIFT              211 d: S$ b- J$ i/ j, [+ Y
  58. #define TCCHEN_SHIFT                22
    - r& @* i7 X8 b. F9 t6 F) @
  59. #define ITCCHEN_SHIFT               233 t6 E0 s) f% b; g; l9 r6 b
  60. 6 n& q8 d2 G( ^9 G% Y! O7 A' i
  61. static volatile int irqraised1 = 0;
    # g2 Y# s8 S& z9 n
  62. static volatile int irqraised2 = 0;1 J' e$ \+ k/ r/ N+ {! F& d$ K) }

  63. ; d2 Q. O' L" V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ x) K; P$ r9 Z' |+ J$ d% W- ]* V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" I! P5 X+ o! R/ O* M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* O9 E' Z& ?9 m2 a5 e
  67.   P. ?9 X9 }7 `; b
  68. dma_addr_t dmaphyssrc1 = 0;
    ; k0 j. z3 ]) ?# N- h- P
  69. dma_addr_t dmaphyssrc2 = 0;( p! v9 I' r7 d" s
  70. dma_addr_t dmaphysdest1 = 0;; y7 {( @$ g. B
  71. dma_addr_t dmaphysdest2 = 0;) z, ]+ |  v* k4 Q  |/ N. v

  72. + M1 \# A- ?$ k
  73. char *dmabufsrc1 = NULL;  V( W% \7 m: S5 Y
  74. char *dmabufsrc2 = NULL;
    + p, k0 e5 N* S
  75. char *dmabufdest1 = NULL;
    + z- \9 v% K- I5 `  T- f% U3 f) }$ B1 |
  76. char *dmabufdest2 = NULL;7 `% j4 E: X4 H- Y$ u
  77. $ W- m: k, ^& ?" y
  78. static int acnt = 512;/ S3 s! i$ M: j' W' r
  79. static int bcnt = 8;
    ! g5 g: T' x# ~. u$ y
  80. static int ccnt = 8;
    / Q4 E  B6 f! q& Z5 q. l+ Q  D: [
  81. " n0 _- Q1 Z* b* Z4 A& y
  82. module_param(acnt, int, S_IRUGO);
    $ T; g' H  f; P
  83. module_param(bcnt, int, S_IRUGO);# x+ J0 b0 X( {5 U0 P+ U6 C) p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 ]0 w& d! f8 |, {) V0 V
5 H" u1 E4 f0 g+ X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 D4 J; F' c0 V3 z+ P2 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 x1 l# K9 @2 R  c9 A0 [$ f6 n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- j- ^$ I9 q7 Z' @6 n7 G, N* f# G! t2 Y
* F7 Y8 [3 M# J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-10 01:00 , Processed in 0.040713 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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