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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 L2 V; I9 H8 G, {7 u  f4 k( w. y9 c
  1. [code]EDMA sample test application( r! w# C1 _1 ?7 _( |$ V
  2. /*6 y' `% H1 }% s
  3. * edma_test.c4 o% u. \7 @+ U; P4 ^. G9 B9 y
  4. *
    8 @/ V6 }+ |/ V, B" L, q
  5. * brief  EDMA3 Test Application( {* k) K* J1 u) L0 f
  6. *
    7 l. o" G5 [0 r2 m
  7. *   This file contains EDMA3 Test code.# q; p/ ^$ B' a3 D# D* ]& }, M
  8. *
    & h; E& r0 p% }) X/ S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- j; d1 b  r) z4 O$ G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " f  S+ k1 R' d! u* @& O
  11. *         TO CHANGE.) h# t. {& Y4 P( X, t
  12. *) x; `6 |5 t4 n( Q  S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  I! N* d) G, B5 _  V; o- q
  14. *) y; H2 ~0 s2 M0 [
  15. * This program is free software; you can redistribute it and/or% Y3 O/ C2 I$ G
  16. * modify it under the terms of the GNU General Public License as
    + B  C: P& s- @1 b$ _5 g, k
  17. * published by the Free Software Foundation version 2.0 t- y  \* z' M( ?  m$ O$ G- `0 `
  18. *5 _5 D2 b9 x- V1 T! f' Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 ?- t9 g  ]# G! x
  20. * kind, whether express or implied; without even the implied warranty' t( L' r% |6 }  P, Z, s6 D$ `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' `# v# `3 c$ C( {" R2 s2 K
  22. * GNU General Public License for more details.8 A8 [, g3 w' f+ T+ H( [
  23. */
    7 k7 X$ C. [3 A; M9 X
  24. ! h. M+ S8 O! e) h
  25. #include <linux/module.h>- e( L* i8 E' I
  26. #include <linux/init.h>
    , d8 i" X+ O0 L1 C# |
  27. #include <linux/errno.h>
    ' q8 t1 K4 O2 G. T% y5 ]
  28. #include <linux/types.h>
    / q1 h; ~3 S& m* v' Z+ V
  29. #include <linux/interrupt.h>
    . c2 A! A% Q3 N4 I& ~  h1 T
  30. #include <asm/io.h>
    5 e& D2 `  q) q$ M9 ^' ~  \2 k" v7 y
  31. #include <linux/moduleparam.h>
    8 }* I8 w+ L- h8 N$ v
  32. #include <linux/sysctl.h>
    # a! z. o7 ~6 B7 V
  33. #include <linux/mm.h>5 c6 c9 I) ?& ^3 c5 g( ]
  34. #include <linux/dma-mapping.h>
    5 t7 P# V# J$ C+ c
  35. " H' p: P5 l! N
  36. #include <mach/memory.h>
    - Q) X8 {4 L7 j( F
  37. #include <mach/hardware.h>
    3 c' g8 n5 Q: N$ x  |( T$ g! N
  38. #include <mach/irqs.h>/ L) d* E. }( ^. s- F# O8 t
  39. #include <asm/hardware/edma.h>+ ], ?8 Q# E9 C$ }: M' a

  40. ) Q+ p, U/ w3 X$ ?2 h
  41. #undef EDMA3_DEBUG% H% y) D9 ]9 H! d
  42. /*#define EDMA3_DEBUG*/- I/ x4 s) o$ @$ w* `/ p5 n

  43. ( L- K$ \8 I' `
  44. #ifdef EDMA3_DEBUG
    6 t. T: I2 A7 @8 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# \' E% g3 M. q  V, Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- l. ^+ y4 r/ `' D$ j- e! E$ a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 y1 \! t1 l5 _6 x+ Y% s
  48. #else
    9 i1 m/ b( G- ?1 J
  49. #define DMA_PRINTK( x... )4 h/ Q3 X1 L5 q- D. y
  50. #define DMA_FN_IN: _9 c1 T- M0 A6 I7 |
  51. #define DMA_FN_OUT
    2 Z7 G) Q8 z+ _8 u  m5 y& W% e
  52. #endif
    4 r4 g) O& \. ?, }4 `

  53. % s% u, O' N7 s' J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; m  |8 F/ z3 d" e
  55. #define STATIC_SHIFT                3
    ' R7 d( B1 c+ R+ M4 J2 L6 n
  56. #define TCINTEN_SHIFT               20
    8 S6 \" s# \* x8 S* B; |
  57. #define ITCINTEN_SHIFT              21
    6 |" Z$ s3 D% f) `8 M, j. q
  58. #define TCCHEN_SHIFT                22
    % J2 q7 {* Y- z
  59. #define ITCCHEN_SHIFT               233 ?* u7 x" ]: y! c7 ^# o# L! |  S/ X

  60. ) R7 I" [- C3 m! O& [1 a& h
  61. static volatile int irqraised1 = 0;, J7 |( x" c0 T6 k! u) C: b
  62. static volatile int irqraised2 = 0;1 O9 s, j! p1 o! E$ F

  63. 0 F, O! D6 a! g5 z. _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - V8 @; U7 a5 }4 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 `; B# Q/ b1 |7 S( o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( S8 M7 {3 ?% @. E7 `# p
  67. 1 c, i( ]* E; Z# [/ @+ B
  68. dma_addr_t dmaphyssrc1 = 0;
    : X4 l5 b; a4 S
  69. dma_addr_t dmaphyssrc2 = 0;3 {+ r& X. Z  X
  70. dma_addr_t dmaphysdest1 = 0;/ [* i5 }. E3 o
  71. dma_addr_t dmaphysdest2 = 0;2 m' k/ [: ?7 k2 o; [& w9 s2 }

  72. . u1 d7 F. ?/ J4 e9 J9 L3 X# k
  73. char *dmabufsrc1 = NULL;3 W" l6 W; j' g' g, ?) ?3 Y& c
  74. char *dmabufsrc2 = NULL;
    8 `4 \0 e, ]9 U- w( c: ^4 w, I
  75. char *dmabufdest1 = NULL;
    , {: {) C$ h+ d
  76. char *dmabufdest2 = NULL;; r) q2 a+ q/ g3 q& a

  77. 7 C5 J' j4 S5 ^1 E
  78. static int acnt = 512;
    " J: \& C) C; |! Z8 i
  79. static int bcnt = 8;
    0 n  T; S: ]! Y6 c' R. Z" d! l0 M0 |. ^
  80. static int ccnt = 8;" K1 E% l* @0 @7 X) R" m# q& D
  81. ( [$ z8 Q) @  \" q$ E6 {( I0 o
  82. module_param(acnt, int, S_IRUGO);
    5 X% l7 R0 z. d6 V0 S
  83. module_param(bcnt, int, S_IRUGO);
    5 P* O/ q6 s  p( @0 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 p, v9 r+ a$ X( }& T6 ]
$ ^* x3 X$ B( S0 Q& |. i* Z& C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 D, Q8 u# s- D; s- D3 f) ~. I" c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' k' Q2 F' n  v' F& ?( D0 _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 M0 J2 }8 o0 R2 ~- x) A% s; R. x( _4 Q

; _3 v: ?  U: _" e% k/ p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 16:59 , Processed in 0.039039 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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