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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % F; }0 G2 V) G: @' R* a5 J
  1. [code]EDMA sample test application
    8 i4 i4 b" y9 S- J0 x& l
  2. /*3 m5 z6 Z& c0 a5 S" V  c- f8 h
  3. * edma_test.c% G5 d. b! {8 u3 ~( o( Y9 m
  4. *' P% b7 c- c. L  `0 j  F% e
  5. * brief  EDMA3 Test Application. d6 f; P% I* l# e6 ~' K4 }7 _
  6. *
    , N4 M7 d7 X  j
  7. *   This file contains EDMA3 Test code.- j1 E  C/ n. `* U1 X6 m5 \* d
  8. *
    ( J1 y2 ~! o( S8 c& R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * N) {( i1 l) f5 s( F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * i& Y. W9 [) S/ ^
  11. *         TO CHANGE.$ c0 j' b1 q3 Q3 e( X6 n
  12. *
    0 ^/ b( V9 f6 S4 {% \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 x. ~  g  {6 N; t8 n* d: x
  14. *
    * m( ^' [0 l( \' @' N  _) U
  15. * This program is free software; you can redistribute it and/or
    ( b0 |! S  P$ m' t' v2 v
  16. * modify it under the terms of the GNU General Public License as
    # j6 F1 R3 r' K8 f1 P/ R  ?9 V
  17. * published by the Free Software Foundation version 2.
    ( ^* W3 W- z/ e' J* C
  18. *% b* K1 m! k1 Q, b" t; c. J1 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & _% f$ m6 ~& }+ @3 u. z& l
  20. * kind, whether express or implied; without even the implied warranty
    6 z: B" y4 t( S! ~4 o1 ?- S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 `# C0 T) `; H3 j3 l
  22. * GNU General Public License for more details.
    ; u+ l% k, j( w9 k6 j$ b
  23. */- E# l2 j  t4 {0 T" k1 |

  24. . C7 ]3 z9 J8 ]: k
  25. #include <linux/module.h>0 H6 b; \9 U  p
  26. #include <linux/init.h>! [  s" X4 o  \7 m( D
  27. #include <linux/errno.h>
    6 `0 x5 q4 ~( ?! ^5 b) p
  28. #include <linux/types.h>
    0 s( y1 F8 n2 V) [" z" h2 _+ G" V, g
  29. #include <linux/interrupt.h>
    6 }/ |% `/ J! I
  30. #include <asm/io.h>
    - n; r' d! k" F' u* i5 k& a7 K$ f4 g
  31. #include <linux/moduleparam.h>
    4 V2 U% |1 w, ~
  32. #include <linux/sysctl.h>: O9 Q7 i7 @7 J- v
  33. #include <linux/mm.h>  n, O" x* U* T5 K
  34. #include <linux/dma-mapping.h>
    " t7 N0 n" S9 A/ w4 s  J- a

  35. ) b: |5 u* E8 Z- E: o2 {
  36. #include <mach/memory.h>, p1 [! z; |" ?* @! f
  37. #include <mach/hardware.h>
      T7 }  o8 s# M1 n
  38. #include <mach/irqs.h>
    " R4 `) ~6 ]% v+ o# V* o7 t$ H
  39. #include <asm/hardware/edma.h>8 m( O, Z) g. c! `/ s+ O

  40. 7 b& [0 f0 J& W' H9 j! _
  41. #undef EDMA3_DEBUG2 `( R. v0 J) _+ w  N6 m
  42. /*#define EDMA3_DEBUG*/
    / ?5 G  h- g; B  b
  43. . d7 z* s' ~% e; i) Q
  44. #ifdef EDMA3_DEBUG5 p2 t% [" G/ }' Y8 W% ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% ~/ \0 A) G/ ~/ x! d8 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ Y/ W/ L8 D) ]) m# H: w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & U* C( I8 V0 V
  48. #else
    9 Y/ w8 z6 M( s9 [$ w, K8 \
  49. #define DMA_PRINTK( x... )5 R2 s. c7 Q' r; q( K2 Y
  50. #define DMA_FN_IN- c' h' \0 S/ j5 K
  51. #define DMA_FN_OUT3 Y6 Y) L3 o! F
  52. #endif7 H, z% M8 ^6 D7 U" T+ c* Z+ i  l

  53. ; H1 `% E: g7 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 K! K3 J0 w5 C1 }) Y! p! J
  55. #define STATIC_SHIFT                3+ ?8 }; l  k6 D7 R! y# H: h
  56. #define TCINTEN_SHIFT               20
    5 c( y. H3 H, U( j5 v
  57. #define ITCINTEN_SHIFT              21, D3 ]. i* q% I; u
  58. #define TCCHEN_SHIFT                22, @% [8 y2 q7 b. }7 |
  59. #define ITCCHEN_SHIFT               237 @% d# o# X  Q! U- {
  60. 3 ^/ r+ ^- ~# x7 s! y- C( |! W
  61. static volatile int irqraised1 = 0;
    # `( \/ Q( E- e9 h' y# o6 h/ }
  62. static volatile int irqraised2 = 0;
    7 P' N; Y; z5 F& b

  63. ; F0 q6 O- T6 C0 Y2 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ], \- z/ ]) S$ e* q7 G" C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 `! L4 H4 K  k# {, T9 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; W/ ]3 {) b. F

  67. ( S, [/ [7 h2 G# j) k# u+ w
  68. dma_addr_t dmaphyssrc1 = 0;- A5 [8 n% X& T- f% C2 f& y! k3 w
  69. dma_addr_t dmaphyssrc2 = 0;
    * i7 s# c  C2 }3 Y) f$ N& x
  70. dma_addr_t dmaphysdest1 = 0;9 q7 O- d2 U2 f( h3 c: E
  71. dma_addr_t dmaphysdest2 = 0;
    , G3 {. Z; T2 a. p; P9 y

  72. & O% p) M' B, u
  73. char *dmabufsrc1 = NULL;3 t. n7 e1 q( S0 F; `. e% ^9 R
  74. char *dmabufsrc2 = NULL;" e9 x$ {% L' ?* p% u0 U
  75. char *dmabufdest1 = NULL;
    . P# D9 _$ _! l, K$ G
  76. char *dmabufdest2 = NULL;8 S  Q2 @& U* R& H

  77. * [' Y, O' B9 ^) b
  78. static int acnt = 512;3 c7 i" v1 d# i% s3 o
  79. static int bcnt = 8;/ K- u# p) i, l& n  p9 j
  80. static int ccnt = 8;( }* L% P  L! H* d. W8 U
  81. 7 G* ^2 `/ c) A7 r( y  b% i
  82. module_param(acnt, int, S_IRUGO);
    / h' l9 j3 B5 G' N2 |
  83. module_param(bcnt, int, S_IRUGO);$ O- \" Z; u+ d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 d( _5 v/ `' t. f' t9 |
0 Z; J6 V" A$ @- @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 C" v: h- z6 M9 I5 l9 C% Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# q1 h* I. w( H% \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 `- P0 @( X/ v9 p( h+ \

% R9 y- V% L4 S  n' }7 e6 c
7 O6 D. x4 Z2 Y: h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 12:33 , Processed in 0.039406 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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