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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + S9 l% }, W1 [9 |, h/ o8 `
  1. [code]EDMA sample test application. B' P0 x7 _9 I) M+ c7 a
  2. /*: j9 Y. c; A& k  F' z4 Y4 L
  3. * edma_test.c6 l+ g8 @& H2 t; Z6 E7 P$ t
  4. *
    , |' F% i9 _  ?, ^4 @+ j
  5. * brief  EDMA3 Test Application
      K* f! ~% }) M- A- n( n- H
  6. *
    , G2 ?4 _0 ^/ {0 D
  7. *   This file contains EDMA3 Test code.
    + m; F# W$ u, K: I% Z
  8. *! N* `* x# t$ S9 J' U4 O! Z' C- l, ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 Z' v0 b7 @' b) O6 o6 O7 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ f, P/ s6 {/ ]
  11. *         TO CHANGE.
    - C1 \* F+ z7 M6 B% i; H1 y* s
  12. *
    + H6 w3 [$ y" y. `" D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// t3 k2 M2 p6 M1 ?* S( X
  14. ** J) ^6 O' T6 J
  15. * This program is free software; you can redistribute it and/or
    5 F! g5 x4 c$ V
  16. * modify it under the terms of the GNU General Public License as! M7 y+ q( G6 X( d+ N9 e0 U' z
  17. * published by the Free Software Foundation version 2.
    . o! \, b1 ]8 C& X' W
  18. *
    : L6 ?" y! Q9 I: a# D0 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' c/ u4 f$ a! j5 P' G6 ~
  20. * kind, whether express or implied; without even the implied warranty  d3 U  \! H6 N' I5 x/ B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : c3 k7 s! h% Q1 q/ X
  22. * GNU General Public License for more details.8 S! p( Q! i3 @0 ]" {, N; l3 B
  23. */
    % }( j/ M: m; \+ v, u

  24. 6 R( b! o  Y% G, U) T
  25. #include <linux/module.h>* \; t) E  l7 ^+ l* Z& A' ~2 S4 N
  26. #include <linux/init.h>3 x: ?1 E" l$ G
  27. #include <linux/errno.h>  l! B, d3 n* Z5 U; P5 K4 ~
  28. #include <linux/types.h>" Z# Y; [, B0 ?4 ^1 |$ M
  29. #include <linux/interrupt.h>
    ; }3 ^1 B+ c! ~* l! w
  30. #include <asm/io.h>" O+ m0 d  M! T- ?
  31. #include <linux/moduleparam.h>+ l; {4 k& o( i  i' g  U. m
  32. #include <linux/sysctl.h>
    4 ]( [, S) y5 ]
  33. #include <linux/mm.h>& {, s$ p# }. m& m$ o8 [; t5 _7 D/ L
  34. #include <linux/dma-mapping.h>
    4 k/ i+ }7 A4 v: L! H- t7 i0 t

  35. ( g2 p/ m8 m4 m  u- ^* h: T$ R3 t  l
  36. #include <mach/memory.h>
    : S2 L5 A) k2 Y0 `, |/ f9 M. c6 z
  37. #include <mach/hardware.h>, e4 L& k  m0 A4 v
  38. #include <mach/irqs.h>2 u2 `; W3 v4 v  m0 P5 ~$ [
  39. #include <asm/hardware/edma.h>
    2 n+ |/ ~) [: C/ I' G+ \
  40. 7 P  _8 [1 s; `" h+ A8 G( b- m* p
  41. #undef EDMA3_DEBUG
    # U' x( L) A5 E: [, k
  42. /*#define EDMA3_DEBUG*/% H  ?8 y) |4 B' `2 T& E+ ~
  43. , s4 P0 H8 y' ^+ `
  44. #ifdef EDMA3_DEBUG
    1 m# {5 i" f! v$ }1 h- P# n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* p0 k/ _! h) W! @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 D& z7 H' z) U; h/ |: a& }/ {3 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); W" I" m. P5 O. {( @
  48. #else
    2 F  @) I! ^0 Q7 n4 U. J9 B4 F
  49. #define DMA_PRINTK( x... )
    ! y0 L$ T/ J% V0 S4 A5 H; |+ N
  50. #define DMA_FN_IN. X* d( S/ x) p7 A
  51. #define DMA_FN_OUT$ e5 Q2 K* z0 y
  52. #endif9 U! w% ~! A8 w5 ^
  53. 1 \5 Y4 {/ d. b/ _. r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 O& y7 I6 S$ J1 \+ c! A- I
  55. #define STATIC_SHIFT                3
    6 ]  d0 a% n$ h2 g- b' B
  56. #define TCINTEN_SHIFT               20
    7 F0 _2 b- F; E: n" b4 x! B: o
  57. #define ITCINTEN_SHIFT              21; u# P' X3 W; r
  58. #define TCCHEN_SHIFT                22! V- A/ N1 D5 k& A
  59. #define ITCCHEN_SHIFT               234 J# g0 i( ~6 Q- f) ?
  60. / J6 ]/ l7 N. ^% F9 D+ \6 J' j
  61. static volatile int irqraised1 = 0;3 `7 z5 I1 Q# v
  62. static volatile int irqraised2 = 0;, z0 p7 w. h! j5 z9 k6 ]- ?
  63. $ Q3 d2 S: R+ l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 [6 k# _4 Y3 o9 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' O0 k! ?% Y- c1 |& [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' j" t! D! c2 a! g2 ?

  67. " s# B, h! c6 E; n3 ?0 J. E
  68. dma_addr_t dmaphyssrc1 = 0;
    2 w7 h# u' B- o( b! J5 _* s
  69. dma_addr_t dmaphyssrc2 = 0;
    ; {- C) u1 v0 K! _! O% I
  70. dma_addr_t dmaphysdest1 = 0;
    ' n& \/ u- k0 F; O
  71. dma_addr_t dmaphysdest2 = 0;; M0 @  U) g) X, A( s3 b

  72. - u0 j! ]2 A0 X1 T$ \8 e: G
  73. char *dmabufsrc1 = NULL;
    3 |7 R% |& A: N$ b" \
  74. char *dmabufsrc2 = NULL;
    ; @' v6 S' T7 |0 [  ?
  75. char *dmabufdest1 = NULL;7 G( ]+ @, k5 w* J3 v' i
  76. char *dmabufdest2 = NULL;
    ' [: G9 _  q7 ?* o. z; ^  l1 G, P

  77. - L! g0 W5 j  l% H, P! j3 u. t
  78. static int acnt = 512;
    7 P4 t- ?5 O1 _! c) V
  79. static int bcnt = 8;+ J$ |, p9 r! x7 c' }
  80. static int ccnt = 8;# r) }: s- u7 ]! ~" s/ e6 N
  81. 2 w8 A# Y1 G6 |' q
  82. module_param(acnt, int, S_IRUGO);
    # z* c* I& |$ ~# }: Y; `, j
  83. module_param(bcnt, int, S_IRUGO);  A+ Q+ w' M  V8 y- j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! h! p) ?2 ^% F; E5 i) D6 F6 N* I7 y. e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- U$ r1 r6 c- X6 d, v) Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 W# ?: T* Z! u4 |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; z+ s5 p. g# r
  u9 e0 f8 Z1 a( S  A! P" I3 \% v' U# F* N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 18:42 , Processed in 0.044505 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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