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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 l; s0 I7 O8 G0 f% R3 M. E
  1. [code]EDMA sample test application
    ) p- a$ z+ U% \0 {
  2. /*
    6 B" B; J; y/ T! n2 {2 M9 K& C
  3. * edma_test.c
    / j6 \# D8 ]  Z3 S) O5 Y
  4. *
    7 k1 t- i$ C# {; ^" A1 a
  5. * brief  EDMA3 Test Application! b: e% k( O/ {# t1 j- ?8 t+ g
  6. *# I  c( p& W  x0 F! Y
  7. *   This file contains EDMA3 Test code.
    $ t6 x. y% u- a3 }9 ?4 [
  8. *
    , p0 B: U' v, w3 I9 @; q3 Z. }0 y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. a6 d7 B3 K- r# C+ M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 I4 t* @8 x5 M! r2 j
  11. *         TO CHANGE.
    / H( ]: W; l6 K/ o! l5 l# j
  12. ** y# Y/ w2 G" m. K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; P, W9 e0 g, O: C
  14. *
    ' i. u0 G1 ]/ I6 Y7 K5 P7 G) Z+ g
  15. * This program is free software; you can redistribute it and/or
    1 z  n- V. E6 E" h4 c3 j
  16. * modify it under the terms of the GNU General Public License as
    6 ?. o: g( w0 F" P& W" a
  17. * published by the Free Software Foundation version 2.
    : |2 U: G3 Q5 @! s& p% |2 X
  18. *
    2 H1 O+ ^- R# C5 O; T$ x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 F: v& _1 z( T6 [
  20. * kind, whether express or implied; without even the implied warranty
    ' c4 E$ h# ~* e" W: y" \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . n% p) i- Q; ?+ S! {
  22. * GNU General Public License for more details.
    4 l& Z2 I5 L4 h4 l/ X0 N; h
  23. */
    ) V8 Q8 Q6 C! v" \2 z
  24. ) [# ]( C. P, c5 `
  25. #include <linux/module.h>
    8 {2 e0 w* ]8 B6 z
  26. #include <linux/init.h>/ J1 C& `) l2 {9 ]
  27. #include <linux/errno.h>4 [3 P8 @1 M( x+ u0 R1 z- e" |
  28. #include <linux/types.h>
    4 V2 W$ N$ _6 n  N& K
  29. #include <linux/interrupt.h>
    % N: R7 h! f; m% x- w
  30. #include <asm/io.h>) Q3 a9 s5 l2 o1 b2 n6 N
  31. #include <linux/moduleparam.h>
    # p0 p1 B+ ?4 d# J/ H" ~5 w
  32. #include <linux/sysctl.h>
    $ q/ |2 c, x: T7 b" ]( S& {
  33. #include <linux/mm.h>
    7 u1 g! |# E+ u+ W# l
  34. #include <linux/dma-mapping.h>
      o* t: B- s5 t" d

  35. & H) L' I9 k' s8 U. x7 S
  36. #include <mach/memory.h>
    8 y, C4 j. o8 f+ z
  37. #include <mach/hardware.h>! B1 w+ t! j5 F1 ~" V! B; t) f& S
  38. #include <mach/irqs.h>
    + ?# t* M, C5 N
  39. #include <asm/hardware/edma.h>0 y2 S8 A6 @! q5 U+ Z
  40. 5 v) n2 a+ h: w( x* F3 u0 q4 ?% s) E
  41. #undef EDMA3_DEBUG+ ]9 G+ B% {% C  s6 |! P
  42. /*#define EDMA3_DEBUG*/  f3 U. @, b. |; _

  43. + z* v5 e$ a9 Y: ?5 r7 j* j$ {7 Z
  44. #ifdef EDMA3_DEBUG# w/ j, q  m- Y5 [7 a+ B, j/ g$ A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 U' o7 o$ ^& i: s0 ?5 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! ^. }8 e$ d- `( g6 L  b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ n- y3 ]. P- E7 T  ~
  48. #else; |; [7 n$ ?+ }0 H. o( b! n3 }2 p
  49. #define DMA_PRINTK( x... )
    1 P- b$ Z9 G' F, W  O
  50. #define DMA_FN_IN$ X8 C- J* d  ?4 N' s" E
  51. #define DMA_FN_OUT
    9 n5 g& \- P( i' U& Z) I
  52. #endif7 u+ e* b, |- a) o" V$ R  q$ A
  53. $ V) |7 I) v4 s; J- ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); B# ?. ~. J; k3 W& m" C
  55. #define STATIC_SHIFT                3
    , W7 w. r2 A' R: L3 ^8 q4 I
  56. #define TCINTEN_SHIFT               20
    / z3 x8 b4 y6 H) L# W
  57. #define ITCINTEN_SHIFT              21# |+ r. v0 ]0 w6 I
  58. #define TCCHEN_SHIFT                22* j6 V( k5 {* A- w/ U
  59. #define ITCCHEN_SHIFT               23. v; S0 s9 g& \: _, B0 J" a

  60. 0 d! `# R4 E4 r- h- J# v
  61. static volatile int irqraised1 = 0;* o4 m* }; }: |% S6 o
  62. static volatile int irqraised2 = 0;& Y& h# i+ G- A/ O% n; i
  63. & f& ^, S. ^6 {$ I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! b6 Y" h, \8 E0 v2 }9 n3 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 q* K$ v6 z( I" P1 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 U8 S# d8 R/ K) W' ]; u1 ]

  67. 3 t4 i2 R" A1 U, z
  68. dma_addr_t dmaphyssrc1 = 0;
    ' x# _/ b- C# h8 t% N7 T- [
  69. dma_addr_t dmaphyssrc2 = 0;
    ! s. g( h! S& ]# h
  70. dma_addr_t dmaphysdest1 = 0;
    6 ?4 X1 `% l1 L6 A; v
  71. dma_addr_t dmaphysdest2 = 0;8 h+ x! j, q" }& @# g
  72. + X' U9 d1 @8 ]& u0 M5 v! n
  73. char *dmabufsrc1 = NULL;4 Q* R' f; U5 `6 i, e
  74. char *dmabufsrc2 = NULL;/ I1 ^0 j  b$ B7 q4 N4 _! I
  75. char *dmabufdest1 = NULL;
    , D! Q7 |8 \: j' v) {# ]
  76. char *dmabufdest2 = NULL;
    % O5 L: R1 p. Q' _  |
  77. 5 k" [! [2 l* Q( s
  78. static int acnt = 512;
    - o1 l& p' P0 f" y! @7 s* H
  79. static int bcnt = 8;4 f! L& _/ O5 z' g
  80. static int ccnt = 8;- z8 Z: b: [/ H6 V/ n
  81. & G$ V8 ]" \: M, b, W( @5 A4 r  g
  82. module_param(acnt, int, S_IRUGO);5 n8 ~! M6 P. s4 V* M) T/ @
  83. module_param(bcnt, int, S_IRUGO);
    0 z( C+ A1 Z8 |/ e% q1 S% y0 y  t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! ]) \' n9 Q$ s" |  n: h7 Z+ K

) g, B3 ^$ V3 D- {( p' ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% G* J0 M8 C- X/ r4 e1 H" Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 E8 O5 x$ C) Q" F9 h- |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) B7 a1 y: t$ L; T
+ ^( F* A5 Y# \" m6 i
; a. F& P' d$ q* ~3 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 07:32 , Processed in 0.041407 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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