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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* |" i+ ?2 y# u2 M+ p' U
  1. [code]EDMA sample test application1 X1 `- o( |' `" f: ~6 l
  2. /*0 n* a/ a  ]% n1 @) v) ?
  3. * edma_test.c3 F$ ^0 n0 g, }- L8 v
  4. *
    9 ]! c" {3 L# ~8 w7 w7 L
  5. * brief  EDMA3 Test Application, z  f& Z5 t- v; m& |: o& l
  6. *" t' A5 h" e; q4 h+ T
  7. *   This file contains EDMA3 Test code.
    ! z) L) P" ?, z. [! E
  8. *
    / b8 D7 W5 p0 |8 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 G6 D: {' |. R- C' A4 R1 X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 D5 T+ q, w* c- F0 u0 w* x
  11. *         TO CHANGE.
    $ s; `, T5 A; }  A( a0 m
  12. *
    ; e5 \( T0 N7 T6 D1 t0 d- Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 D9 w: w; Z$ @  d4 x- t0 _) H
  14. *5 Y$ n- a+ H3 \5 \" `
  15. * This program is free software; you can redistribute it and/or8 S' ]  F: L" T" h& o  m, Q& W, i5 q( n
  16. * modify it under the terms of the GNU General Public License as0 \* n5 \. x' X& b7 @3 W
  17. * published by the Free Software Foundation version 2.. f. _# y' F4 i8 E% |- V
  18. *& R) q6 f8 d* ]. ~; S% k6 F. U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - M) }0 u- S4 ]9 D) H! a: s
  20. * kind, whether express or implied; without even the implied warranty
    % n4 N$ Y0 ^( R4 ?0 e& a8 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) q* Y6 O  p5 ~! X
  22. * GNU General Public License for more details.5 ~; C& S& F$ r5 y* O
  23. */
    + F. O. P# _6 H% Z$ F- l; K/ y  g
  24. - N: x' q2 L' C0 \; `# F
  25. #include <linux/module.h>+ C' _" j3 g5 S, b
  26. #include <linux/init.h>' Z- r2 Y( B1 k+ Y- o
  27. #include <linux/errno.h>
    0 r. Q/ X4 D/ @7 a$ a9 [
  28. #include <linux/types.h>, X; ~2 N8 j) [, m* Z+ i
  29. #include <linux/interrupt.h>
    " [2 d, t3 V; s* v
  30. #include <asm/io.h>8 G) {0 g0 {4 f1 P9 W" K" ^
  31. #include <linux/moduleparam.h>8 a. g) d8 |2 }: L& O- l( y( w
  32. #include <linux/sysctl.h>( d, ^  H; I4 O5 Q
  33. #include <linux/mm.h>
    5 f: p! l# W: m1 d$ O) P
  34. #include <linux/dma-mapping.h>
    9 w% y* s4 X5 y- m4 m6 o; V

  35. $ }  P% L2 B& ~( Z
  36. #include <mach/memory.h>
    # N, A# M9 v5 l4 k
  37. #include <mach/hardware.h># `: S& Z; c# D; s( D0 @
  38. #include <mach/irqs.h>
    ; ~$ _, J% S" M! m, B
  39. #include <asm/hardware/edma.h># L/ u5 g+ c; j8 l- r
  40. 1 M! v% m2 H/ n' e2 s0 B
  41. #undef EDMA3_DEBUG6 L- P8 k0 o/ N3 G3 \, a
  42. /*#define EDMA3_DEBUG*/1 l. i# J1 H9 y! |' y6 a

  43.   t$ L5 C. P$ v2 p, I( J
  44. #ifdef EDMA3_DEBUG
    & e- \# L/ e7 n0 y4 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 v+ I  b) B- F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). e) S4 b( |5 q' N) N8 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! J1 E5 F3 x  z# N& A0 Z6 c
  48. #else& E+ F: G5 j0 h' ?
  49. #define DMA_PRINTK( x... )
    / N" ^. `# D3 c% f# T# k
  50. #define DMA_FN_IN6 x* L) u# F3 W6 D
  51. #define DMA_FN_OUT% o/ n' Q3 _- Y# r
  52. #endif, R! D6 u" d% w% E$ [0 ], t

  53. 3 y0 m1 z; ?: H# @2 J1 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ `. B/ f, y0 R. o% Q
  55. #define STATIC_SHIFT                3
    ) ~& j$ }& v7 G' i2 I8 j
  56. #define TCINTEN_SHIFT               206 b1 @* `" f+ p
  57. #define ITCINTEN_SHIFT              21
    1 V% C7 X8 m* F, r5 _. C
  58. #define TCCHEN_SHIFT                22) I7 b: r8 F" M$ a% k
  59. #define ITCCHEN_SHIFT               234 Z( O+ P6 {0 Y* x5 E, s

  60. 0 W, N3 r$ e) B! ]7 y
  61. static volatile int irqraised1 = 0;) I: Z# T, B+ Y0 C' q
  62. static volatile int irqraised2 = 0;: N9 f* `' n# U' O: ^6 e2 [
  63. 7 j8 O. `( X1 I- Q# O5 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( ~+ R4 e" {8 r3 L/ |8 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" U6 j+ D0 _! L- K  t- Q. u0 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 s( c- B8 {- E3 e* \2 O4 c

  67. 4 R2 p; `+ k( H6 N! _
  68. dma_addr_t dmaphyssrc1 = 0;2 |/ G7 ]4 a7 T$ `% g
  69. dma_addr_t dmaphyssrc2 = 0;
    ! V+ }2 e: {2 A- u1 j! f: X
  70. dma_addr_t dmaphysdest1 = 0;
    ) v5 ^: b9 {" L9 X; r) p1 y2 D
  71. dma_addr_t dmaphysdest2 = 0;
    7 p0 _# C, h( J, m7 b8 @; m
  72.   A+ L, t2 S) N0 e
  73. char *dmabufsrc1 = NULL;4 ]; x( d! V$ F- B* M) H
  74. char *dmabufsrc2 = NULL;9 V" \& H7 M0 T7 V9 O
  75. char *dmabufdest1 = NULL;' n' T3 y8 Z9 P/ @1 J* [( Q
  76. char *dmabufdest2 = NULL;
    5 q1 k+ x, B: F  f1 B9 R

  77. 5 v8 \/ i/ j* |: e7 F& _
  78. static int acnt = 512;
    - ^" @7 P1 `+ Q& a; H
  79. static int bcnt = 8;
    . J* d$ ~, d1 F* `2 j7 s" E
  80. static int ccnt = 8;
    7 Z' h% o$ `- \% i

  81. ' G0 O$ @- j- g9 V' D6 [) ]7 N8 ^' z
  82. module_param(acnt, int, S_IRUGO);
    2 G- I3 k* m) {1 }0 Y( T
  83. module_param(bcnt, int, S_IRUGO);  h: s/ d  S5 y2 u; A" ~5 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. L! A% z+ h& o2 z2 }' T0 _0 Q& g& x8 i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 X7 D+ h$ A. l/ o3 T8 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ p4 V2 j) c4 X  q  `8 @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 w% D% v5 S; f4 |0 L7 ~+ C6 U( C0 P
  n# j2 S2 `2 n# G& b$ H5 ^" O- i2 S! F" b+ C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-16 05:53 , Processed in 0.036957 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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