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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ N9 N% L, w: Z" I
  1. [code]EDMA sample test application
    0 w, F3 W1 T- f
  2. /*
    $ L, R$ k" J& Y7 M  a" c
  3. * edma_test.c
    ! l0 m# x/ i# g# }# o( C+ g% A
  4. *3 F4 n' j- r( ]0 r
  5. * brief  EDMA3 Test Application
    ( v% G) J0 ?8 K$ b$ y
  6. *4 A% `% P% J+ z) z7 R  X& S  m
  7. *   This file contains EDMA3 Test code.
    ! x. d3 j) o4 B; l% A
  8. *
    ! ]- r3 g$ h. I3 t& f2 r2 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ d4 R- K/ h3 n8 M3 o0 w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + b( C  P6 X3 l# H/ y% S3 c
  11. *         TO CHANGE.
    / q/ G3 T! R! v; a0 c
  12. *( i$ e6 I; ^, W9 W% ^* D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 I- g& k0 ^0 O1 u7 d( Y) F
  14. *
    ! t/ P& k4 P4 e  V- O6 T
  15. * This program is free software; you can redistribute it and/or
    ! U$ m6 l  k6 s5 Q. l/ e+ [
  16. * modify it under the terms of the GNU General Public License as7 ?) U0 c% A) a4 j( h) Y- D# j
  17. * published by the Free Software Foundation version 2.* Y- A: s$ d' C. H
  18. *
    3 o! B' O9 j6 s- l- h9 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / G& H+ w4 F- X7 G* I5 w
  20. * kind, whether express or implied; without even the implied warranty9 [/ m! _" W: i* E' j, r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % E* a5 i; B* H) c6 U9 ]! c& R
  22. * GNU General Public License for more details.$ ^, I8 ]' d# x/ Z; X. W
  23. */9 P" D8 P+ r/ G; @- m

  24. % a' R) ^0 O3 c) ]. a
  25. #include <linux/module.h>2 }6 Q4 O7 ]# d2 r! c
  26. #include <linux/init.h>0 r, T  H- l6 X& }" Y
  27. #include <linux/errno.h>0 M9 \& a# W4 E1 o" P* \& M/ n
  28. #include <linux/types.h>8 s& C) `; G* U% r; W
  29. #include <linux/interrupt.h>3 k9 h- f2 P3 j: ]6 T% T8 N2 y/ P
  30. #include <asm/io.h>$ g1 G- R. L; D) L. W1 q1 z" A
  31. #include <linux/moduleparam.h>
    % k, n) V. k$ L# \
  32. #include <linux/sysctl.h>! U+ T/ E  L5 D) b; _. Q, |* Q2 ?; b
  33. #include <linux/mm.h>
    7 Z' D5 k; L1 b" L; {; {
  34. #include <linux/dma-mapping.h>! k% a' X* E3 b0 ?" ~4 I8 a" ?# b/ h

  35. 2 ^+ H, E! b6 ?% u# m
  36. #include <mach/memory.h>
    9 u1 q. B, j6 d! w9 {5 Y, w; A
  37. #include <mach/hardware.h>
      D* `% r$ H/ A) W7 e
  38. #include <mach/irqs.h>
    ' o. U  f/ _" r8 |
  39. #include <asm/hardware/edma.h>
    ; M- a8 w1 d, x0 K# ^- |- z: Z
  40. 0 |5 Q2 i5 D* A) L
  41. #undef EDMA3_DEBUG
    - U$ i8 @- c9 n; l
  42. /*#define EDMA3_DEBUG*/
    3 T' A" N4 S" W% D/ n4 _

  43. + t( \1 E& r; ~( [
  44. #ifdef EDMA3_DEBUG9 C% E' `5 y: y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ m! A3 t' S% {7 j# ?: B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 @- t1 a8 n+ [' x- e  C3 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) W) W2 Q( b% [% t- L0 \. K
  48. #else# ^  ]  G6 v. w, a) [
  49. #define DMA_PRINTK( x... )
    , K$ I* h5 ~4 F0 l# h  q/ i1 Z
  50. #define DMA_FN_IN/ H1 b7 H' n4 n. k% N4 q0 Z! k5 I) u
  51. #define DMA_FN_OUT# Q1 u, J, X/ J  N: ?
  52. #endif
    1 ~4 w# ]9 w- V* ]( P! N
  53. 3 z/ H1 T4 A% o' b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 X) p+ Q: X3 p# e
  55. #define STATIC_SHIFT                37 ]: B4 q5 T3 w+ t  F! ]3 Y
  56. #define TCINTEN_SHIFT               20  x' ]8 G+ X! C; s
  57. #define ITCINTEN_SHIFT              21! d& {7 f  I& |) j" V1 N6 u
  58. #define TCCHEN_SHIFT                22
    . s0 J6 J) Q3 a* w# b
  59. #define ITCCHEN_SHIFT               23
    - K8 m2 Y3 k7 h, R3 R+ J/ t
  60. % f# e2 N& L' i2 P& z5 i" p9 s/ ?& ]4 p" z
  61. static volatile int irqraised1 = 0;
    7 \6 H  B1 e+ s
  62. static volatile int irqraised2 = 0;
    3 ^! x$ w! I$ l
  63. 2 L, n) L( z( y3 ]8 M" S8 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; A7 y6 l6 b) p# {9 z3 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 U! G5 a* ]* ?7 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 z4 [9 R4 L9 ?  Q

  67. ; B2 H6 V) W( G% Z' o
  68. dma_addr_t dmaphyssrc1 = 0;
    * j0 I2 Y8 U1 }2 ?# B  U) c
  69. dma_addr_t dmaphyssrc2 = 0;
    : o$ r* d  o8 [/ j6 C
  70. dma_addr_t dmaphysdest1 = 0;
    7 @9 q, g& f" G" w0 g- ~# F8 `2 t
  71. dma_addr_t dmaphysdest2 = 0;
    - y; @6 d2 y! S% F
  72. 0 d2 c! p& ~1 p7 O, M/ L1 j# d
  73. char *dmabufsrc1 = NULL;: |5 J( \1 |; X; ~5 W
  74. char *dmabufsrc2 = NULL;  s( D7 X: r* _4 k
  75. char *dmabufdest1 = NULL;8 R2 F  z; n$ w  z
  76. char *dmabufdest2 = NULL;
    , Z" v0 H4 {- s  ~  H2 y9 X
  77. 9 F1 U$ l- {+ y
  78. static int acnt = 512;
    ) r0 o* |6 p2 O8 q
  79. static int bcnt = 8;
    6 u6 t) [3 v. P$ p- t
  80. static int ccnt = 8;0 ?5 w1 y6 p' V! @& R0 P  Y

  81. 7 S1 M$ D5 A: l* y' ?
  82. module_param(acnt, int, S_IRUGO);
    6 z2 y+ U# d7 H$ V1 e. Z! c# h
  83. module_param(bcnt, int, S_IRUGO);9 F* ~% Y2 @! l5 w7 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 {: {: q) ^8 ^! O( v" m& y9 ]3 H
% K' U% H9 n+ b1 W/ r) _( I/ G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 a8 @' y2 @$ Q% Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 {* d3 d) H% H) K1 ^- c, D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 I& z% J) U4 t* l! Z
) `! N+ K# w! F5 h" [! M" ^1 @5 K( b

  [0 ]( Y. Z/ D2 ?0 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-8 22:12 , Processed in 0.036662 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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