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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 ?2 D5 T. U$ h8 v1 N0 [
  1. [code]EDMA sample test application' y) q! B/ d8 d3 g- ~2 M$ V: c
  2. /*
    , C; q6 a7 v/ I& ^
  3. * edma_test.c
      T8 f& s) o8 F. Q/ K5 T5 U6 c( c
  4. *
    9 V% V  o( X# n, p4 u% T0 Y; w
  5. * brief  EDMA3 Test Application: i, _! Y# U' _1 T& ^! M5 [
  6. *
    , t, q, \8 N. M/ g; t; q. H' M8 ~9 \
  7. *   This file contains EDMA3 Test code.
    ' u' i( ^% A& w  H) o
  8. *3 W' x7 \1 q( [1 q6 T0 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # X, i; }6 D8 [  G* @  c. C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 x& @( P% N1 X1 h! x! b
  11. *         TO CHANGE.( k- D8 G% s, u7 F. |( R# _
  12. *
    ' u7 L7 B; \' V- B3 ~/ Z% ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# n1 w2 o/ {  Y8 ?0 n7 B8 j
  14. *
    ! X, }1 p4 U1 k$ S/ Z/ b" r. a
  15. * This program is free software; you can redistribute it and/or. r% y6 \3 U# R
  16. * modify it under the terms of the GNU General Public License as5 Q) S$ [$ R$ V8 `5 L3 s
  17. * published by the Free Software Foundation version 2.! t/ _% T6 Q, \; k$ v
  18. *
    : d5 `6 z3 H: ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 N  H% G9 X0 y6 _  j3 [7 d+ a  g
  20. * kind, whether express or implied; without even the implied warranty
    " V+ K6 P* e5 o9 S0 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 o. m2 m) I  Z: i
  22. * GNU General Public License for more details.
    0 U7 {3 j( f( y0 T
  23. */
    / b- s3 N4 h: a

  24. " C) b- M( P$ l2 @4 |. k0 g
  25. #include <linux/module.h>
    8 q, l; z3 X: _$ B' k# Q
  26. #include <linux/init.h>+ }" I! f* Z  N5 w
  27. #include <linux/errno.h>  t* r  P9 R# _6 g: f- l
  28. #include <linux/types.h>: a: ?# z6 M6 ?/ E$ |& S
  29. #include <linux/interrupt.h>
    ' V! {; D- u+ `
  30. #include <asm/io.h>
    2 c, H* C- O4 N& Y' N
  31. #include <linux/moduleparam.h>
    2 |2 o; Q* q' P' D& m8 a
  32. #include <linux/sysctl.h># d) I7 S  l) I
  33. #include <linux/mm.h>
    * T5 I% X! f2 t
  34. #include <linux/dma-mapping.h>
    : z/ s$ V. k0 t) ^  d

  35. 7 E, ~, g" J, [& Y- W
  36. #include <mach/memory.h>
    % F; M. J1 @4 X" Q
  37. #include <mach/hardware.h>$ \2 r' h' f0 J7 a. b  w# L
  38. #include <mach/irqs.h>: M+ ~% m5 }+ N, t1 ]3 V# N
  39. #include <asm/hardware/edma.h>
    " ?3 d; g0 D- E. S& U$ _: I0 ]

  40. 7 l" I$ q/ |- u7 q) @% x
  41. #undef EDMA3_DEBUG2 k7 h0 _$ f$ P5 W, c. L6 R
  42. /*#define EDMA3_DEBUG*/6 v4 O' P" m9 P* p1 @/ ?) k

  43. # `8 \  X! e: z+ N
  44. #ifdef EDMA3_DEBUG
    ( e6 _0 N* `3 y+ a+ k9 N: p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ d3 D% G& g! }+ B: u4 Z; c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 b) v( l+ [+ U7 d& i9 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( N; [! {' L8 c  f2 W! \
  48. #else+ j, b7 [) H, y( I1 G5 j
  49. #define DMA_PRINTK( x... )
      y3 f9 f% w0 P$ I: x
  50. #define DMA_FN_IN2 \- P/ R- C% L# A1 R, v/ J$ C
  51. #define DMA_FN_OUT
    ; v; E; N; Y6 u+ \! [! k
  52. #endif
    ' p9 G  J$ Z4 c2 I* N

  53. 7 y- ?3 {! r) i- N' t1 g& o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- z+ U( o7 Z/ O; U( X
  55. #define STATIC_SHIFT                3
    % k  a1 X4 g) n% {
  56. #define TCINTEN_SHIFT               20  l8 E3 F/ `- r0 M% d
  57. #define ITCINTEN_SHIFT              21
    8 E+ p! d4 G, X! P( I; u
  58. #define TCCHEN_SHIFT                22
    * k% G1 y8 U$ D# `5 Y
  59. #define ITCCHEN_SHIFT               23
    + L2 W+ F% y7 v5 b
  60. ; }4 P! u7 m4 a* q
  61. static volatile int irqraised1 = 0;# r# f4 N' a4 K/ Z- H- `7 M4 I1 c
  62. static volatile int irqraised2 = 0;
    ' @$ x7 G! T$ K  ~

  63. 2 [! b6 Q( G6 V! P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& J2 F: {3 F4 r: |( C4 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : e3 k/ i( G4 N* c/ ]( p: H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' i: ], l1 I1 R! f* ^' \

  67. 8 n1 _% f; T( n7 K3 L- m
  68. dma_addr_t dmaphyssrc1 = 0;
    ; m$ \3 d8 ^( F0 F! b$ K9 L2 y( C
  69. dma_addr_t dmaphyssrc2 = 0;
    3 f8 R& g8 R; p+ n, a/ e
  70. dma_addr_t dmaphysdest1 = 0;
    ( c7 a  J, n6 n  M0 m
  71. dma_addr_t dmaphysdest2 = 0;
    ! Y% F1 s- g' Q: [

  72. 0 p( f; s$ L4 Q/ B- M* z
  73. char *dmabufsrc1 = NULL;
    2 W+ b& N) t5 t& c9 [
  74. char *dmabufsrc2 = NULL;5 C, |  q2 K/ u0 M- I
  75. char *dmabufdest1 = NULL;
    ' B/ A+ i7 V; L8 ]1 i
  76. char *dmabufdest2 = NULL;
    ; ^% U  Z0 S' J3 c
  77. 2 u' s) d3 }7 Y( K# K& T- p/ G+ [
  78. static int acnt = 512;# |' e: U8 x* F5 m- b1 n
  79. static int bcnt = 8;" P& d* Y' O% i! [
  80. static int ccnt = 8;
    6 g# Y- Q# ]7 ~: N

  81. 1 r' d* {* x) A1 d; E
  82. module_param(acnt, int, S_IRUGO);
    8 Q7 o* q2 [4 F9 J0 g2 Z
  83. module_param(bcnt, int, S_IRUGO);6 ?6 p3 n; y4 k* c, h, u2 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, C' [' p: T2 @
8 c( z1 v2 w5 s; ~' S/ Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& K% W$ \4 F1 D& Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ V, k$ r% b/ b  b- |. e6 _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 D+ E' D/ O: e5 ]2 J$ y3 J
+ u; e( {9 W7 {$ N" O  F
9 _3 \4 q6 G! Y3 k, `# ]) q) u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 09:29 , Processed in 0.043268 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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