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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 c8 d. u* P& {  ^1 Q7 k
  1. [code]EDMA sample test application5 F; u3 K: e( R' T
  2. /*& J5 ^" d0 t7 y8 h5 A
  3. * edma_test.c. L1 ^- }$ `5 l* s3 ?& \
  4. *% u( X3 N- `' j2 N  t
  5. * brief  EDMA3 Test Application2 n( U4 y& W9 @2 }& |# G0 }
  6. *
    0 R: A6 M) K! E- Y
  7. *   This file contains EDMA3 Test code.6 E+ h4 _2 d9 y
  8. *1 D! a& V& B/ {( e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 Q4 l  `9 J: p) e2 {4 A+ R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * M6 I- q/ e5 l/ `' e9 p; f
  11. *         TO CHANGE.
    . S0 B  @3 L  Z% j, {
  12. *
    * K3 e4 {4 J* r* v0 Y$ A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) J, n4 U) `  S+ s. c
  14. *
    2 G2 g9 p  ~: \; `+ f
  15. * This program is free software; you can redistribute it and/or
    5 S$ f/ u. H4 J! _
  16. * modify it under the terms of the GNU General Public License as
    # N  \% F, O# D  x
  17. * published by the Free Software Foundation version 2.. W. A0 u* ~  v; J" N$ C. U
  18. *9 |' }: t& G1 X/ T9 l- _, Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- H- ]' a7 N. a
  20. * kind, whether express or implied; without even the implied warranty
    - u/ ^/ O( Z# ?8 Q9 f" \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 K9 \# ?  u' |9 ^  A, @- U
  22. * GNU General Public License for more details.
    ; y: O  J2 n+ }1 V, V
  23. */
    & K5 Q9 x9 e/ W! z' q

  24. 4 Y9 W$ C( y) s! F
  25. #include <linux/module.h>
    & O7 y: O: [6 t) C: g0 \# r
  26. #include <linux/init.h>
      P) a+ r$ ?7 R1 Z
  27. #include <linux/errno.h>
      ]& L' e  I5 k) r4 ^3 M# T4 h: q
  28. #include <linux/types.h>
    $ U, x) m% n8 G. I
  29. #include <linux/interrupt.h>
    - g' `* j, j% C8 H1 C0 B
  30. #include <asm/io.h>
    ) g2 |/ b6 x( I& K. I0 }
  31. #include <linux/moduleparam.h>
    0 h( t+ X5 N* j. s' R
  32. #include <linux/sysctl.h>
    : C! [9 F$ v0 e* q/ A4 Q
  33. #include <linux/mm.h>
    : u; ^0 ~; G: M7 ?
  34. #include <linux/dma-mapping.h>, Q; `# J3 |, f
  35. - n* @8 S, X; j; y# d
  36. #include <mach/memory.h>3 L7 o4 l/ q1 P2 n5 V
  37. #include <mach/hardware.h>
    9 J: p4 N# `1 t9 F7 b+ [; d6 D5 w" _
  38. #include <mach/irqs.h>/ I7 @/ B7 Y3 Z  i0 I) K  B
  39. #include <asm/hardware/edma.h>* T: y! Y$ n" l5 K+ {" F# b

  40. # Z( S5 _* J# F9 r2 I9 e3 @
  41. #undef EDMA3_DEBUG
    1 ~$ `: v1 j0 J1 e% p) C; P
  42. /*#define EDMA3_DEBUG*/8 a2 d4 B6 @% Y0 K

  43. ; j4 b) I% l, i+ `" \
  44. #ifdef EDMA3_DEBUG
    ) w: I, c! p/ N- x& k6 q; S* b( w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 B' U0 G" b0 d6 U0 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; w& w$ x! A7 E4 Z' C* N* S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + I3 I: H. @; o! Y0 i: ^1 L/ D
  48. #else4 p2 j" y% \5 L) [' d: |
  49. #define DMA_PRINTK( x... )+ x1 h: K  [8 \6 V: m' B4 }
  50. #define DMA_FN_IN6 ]2 f6 y8 b' r) {8 |4 p; U9 v
  51. #define DMA_FN_OUT- j4 O' r$ \, V
  52. #endif: D# m; y" D! |0 t# p& J" Z

  53. ' `7 O0 D/ i& a' B1 y/ J5 d1 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) g7 J" x+ Z4 t6 `7 B) e# v
  55. #define STATIC_SHIFT                3
    1 u- x8 J: C! W) l
  56. #define TCINTEN_SHIFT               20/ Q& B; D* n% ]: M  z! `
  57. #define ITCINTEN_SHIFT              212 I; f. n* n9 q5 l4 K3 _
  58. #define TCCHEN_SHIFT                22
    6 \* }( F. q* k* W
  59. #define ITCCHEN_SHIFT               23% Y: M) h- J" r& P! y  p
  60. ( B- S  \7 [  [( k
  61. static volatile int irqraised1 = 0;- T$ R1 j' w8 c* O5 E. A; K  T
  62. static volatile int irqraised2 = 0;5 k6 V; q7 S% J5 s7 t8 `6 k

  63. ' d8 q) U, c, x* S( B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& v  I+ S# F& S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 \  s7 P! \6 M8 o' p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 A( J+ s+ b' T9 U% X: k

  67. . b& b. T" s  d1 i. W
  68. dma_addr_t dmaphyssrc1 = 0;
    - v, G! k: a) l8 P
  69. dma_addr_t dmaphyssrc2 = 0;+ n0 B9 J. Z- K- c: z% d
  70. dma_addr_t dmaphysdest1 = 0;& }" n0 @( w# L( t
  71. dma_addr_t dmaphysdest2 = 0;
    3 T: e- K& o' g/ x/ b( \) _1 e
  72. 8 j4 P) u) r4 @% ?/ k" |6 a
  73. char *dmabufsrc1 = NULL;& b, i) G+ ]8 B5 o: W+ u
  74. char *dmabufsrc2 = NULL;
    % q. e2 u6 L/ }" q9 g) f
  75. char *dmabufdest1 = NULL;
    0 w# d2 _* @& A9 z
  76. char *dmabufdest2 = NULL;' H: d  A! _$ x& M% H

  77. 7 p" \! k2 z7 Y" K$ e+ \
  78. static int acnt = 512;/ }4 g7 {9 y5 i
  79. static int bcnt = 8;
    * G' g; c1 N9 F% E3 c
  80. static int ccnt = 8;
    / {( P' N% G6 g
  81. ! P1 T/ a6 y! L; G* f
  82. module_param(acnt, int, S_IRUGO);* @8 q/ z3 x9 Y  i! \
  83. module_param(bcnt, int, S_IRUGO);
    9 Y( g) {8 Z1 W' ]1 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 X' J9 J+ G6 |$ P7 M2 ?
. _# b1 M( E. F- [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 p( Y: y) V: t, B8 Z4 m/ A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ X: y4 z2 R5 `- O$ y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- W: v% c$ i1 E; F+ @  I% X

( @( v, K. h( V$ x0 A
5 h( ~) F+ ?  I% _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-25 05:07 , Processed in 0.040503 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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