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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  J6 y9 R/ _& l  h
  1. [code]EDMA sample test application4 d/ G/ S' O! N8 s( _3 H
  2. /*
    ! f. k8 K' P& v; Y% D
  3. * edma_test.c
    , d0 h% O; u! o, ~1 a# m1 ~
  4. *
    2 q( \5 B" ?$ \( z& b$ l1 C
  5. * brief  EDMA3 Test Application. s: t% L+ }) p* O
  6. *
    $ S9 W5 {' o* l! ^* s& R; E
  7. *   This file contains EDMA3 Test code.
    8 A5 l5 w7 Z) q7 \7 v6 g6 s
  8. *
    $ d) V4 \* a# Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. g3 \8 T& n7 k: ]7 j5 Y- K! n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# Z7 @3 ~9 H* Y4 K: f
  11. *         TO CHANGE.
    # i7 O, J5 u) ^6 e; \7 o1 r4 V: |, [
  12. *5 Q4 w" W0 M7 @4 U: e' ]+ {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  S4 h. [6 o5 s' O5 W! S
  14. *
    + h$ ^/ W2 i  A/ l7 s4 E# O
  15. * This program is free software; you can redistribute it and/or
    : a% G. S1 y  s) q# O
  16. * modify it under the terms of the GNU General Public License as$ R/ {6 z5 ]7 H7 D9 j* c) S
  17. * published by the Free Software Foundation version 2.
    ( S* }) G7 w1 {1 O* l
  18. *# s  ^( H6 |  B, Y$ {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ v/ q: X. r! X3 w3 g& G" _! p
  20. * kind, whether express or implied; without even the implied warranty
    % v( K% q0 Q" S% n0 e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, i0 `. f3 |! F
  22. * GNU General Public License for more details.  L+ R" w& p, W5 F
  23. */5 F- A5 s, z, u9 f7 X4 @

  24. " y! q% |9 d& n& }4 g1 z' `4 v9 H
  25. #include <linux/module.h>
    7 k" e( U: S  m% G0 b; q! Q
  26. #include <linux/init.h>! {( _; T- g- \
  27. #include <linux/errno.h>
    : O7 P! d- |5 k4 i/ u/ T+ M
  28. #include <linux/types.h>
    & w- Z, h4 a- Z( h7 k% V. c
  29. #include <linux/interrupt.h>
    ) ^7 {% }0 p+ c6 R
  30. #include <asm/io.h>
    ! s' v4 p7 Y6 Q3 C4 l
  31. #include <linux/moduleparam.h>, B; X; O; n" W# Y
  32. #include <linux/sysctl.h>2 H8 d6 |% J7 h/ V' N  w; Z
  33. #include <linux/mm.h>4 J3 t3 v8 J1 a. s- E. U
  34. #include <linux/dma-mapping.h>
    $ }; ^2 n  X8 v" ~& {- T3 K

  35. 2 s; _7 c5 {5 H  F
  36. #include <mach/memory.h>% y  N/ o3 G! ^/ b: j
  37. #include <mach/hardware.h>0 W* _; \* [. G/ e/ i  d
  38. #include <mach/irqs.h>  v5 K+ j6 E6 b6 L+ c
  39. #include <asm/hardware/edma.h>/ _* q- W8 g. @4 m
  40. % `8 h# U- Y' l" z  @/ b. B( Q
  41. #undef EDMA3_DEBUG7 t& x2 n- H' V& b- W
  42. /*#define EDMA3_DEBUG*/
    ) Q( ^" w1 ]% g' F  C. t, A: E

  43. 8 M" ^2 l' q  I" P, e& J( D
  44. #ifdef EDMA3_DEBUG3 ~  c$ }# a  O& w* {" D! e0 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  R) E+ [/ j4 D( w  V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 J4 m5 \6 v  H7 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 x# G: e4 f: R' z" a& V
  48. #else
    ! a: `( p% t+ f* {- a4 g- d
  49. #define DMA_PRINTK( x... )! Y* X5 p/ W: L' H
  50. #define DMA_FN_IN
    - s/ C7 p  p, `5 R7 P
  51. #define DMA_FN_OUT
    6 E. M9 s$ r" l( h
  52. #endif5 e# A  s) G2 [
  53. ' B" P( z% Z, n1 A" ]$ o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 R3 n0 V) d% J- @1 n. T
  55. #define STATIC_SHIFT                3
    * F2 p8 c1 S6 `8 e- |9 u
  56. #define TCINTEN_SHIFT               20
    % `3 B! p# a+ v7 d6 q) d! ~3 `' i! H
  57. #define ITCINTEN_SHIFT              21
    : D) c& a% @) B9 _
  58. #define TCCHEN_SHIFT                22
    . G  c$ ?9 g, X, b5 |$ @1 N7 J
  59. #define ITCCHEN_SHIFT               23# F! K, f" L6 ?6 F& u2 X, i4 ]8 ], h8 z

  60. 4 c4 |# J: m  }, p' M) B+ p8 M4 E
  61. static volatile int irqraised1 = 0;- M: O/ j! m* Y( y7 n( |$ o& z
  62. static volatile int irqraised2 = 0;
    6 d( V- _; @+ n9 M' N; H7 y" G& L' X

  63. 4 z% j* w' c( T' V; m! O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ G4 t! }' B  m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : Q) H4 F' s8 }2 J' O: ?/ ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 o: A9 g2 T# @  T% X4 w

  67. + L; c" D" s* Q" U' r
  68. dma_addr_t dmaphyssrc1 = 0;
    1 l7 ?. E+ O" r/ @8 E
  69. dma_addr_t dmaphyssrc2 = 0;
    " o7 m; q- u$ S! {9 o" c, v( U
  70. dma_addr_t dmaphysdest1 = 0;
    3 v+ O2 S1 F' r+ r; A- O
  71. dma_addr_t dmaphysdest2 = 0;
    3 k# q5 I, I7 N7 Y5 [

  72. 1 y, }) e0 P2 L! o: U6 b' l$ j/ A" g1 }
  73. char *dmabufsrc1 = NULL;% t8 Z$ u; Z' c! c, z$ N7 v, y
  74. char *dmabufsrc2 = NULL;
      Z3 d* |' w5 J, V
  75. char *dmabufdest1 = NULL;8 T- O. Q3 c& N# s
  76. char *dmabufdest2 = NULL;
    , x$ T) S2 H) W4 h, X( X+ U
  77. 8 S& a+ Q# Z# _+ m
  78. static int acnt = 512;
    7 I$ v, f! b+ x7 s( H9 [& I9 y( m( L% y
  79. static int bcnt = 8;
    ) n4 o  G  _8 F1 |0 @8 Z
  80. static int ccnt = 8;" o9 t  a9 W5 ^. ^" t

  81. 8 D: l3 w8 V+ J1 |' I1 r
  82. module_param(acnt, int, S_IRUGO);
    9 c1 X" ]# v5 f9 U4 `6 z& s& v0 e( X* v
  83. module_param(bcnt, int, S_IRUGO);/ N- b+ A) E- c! i# U! t% F8 W9 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' T3 ~. z6 o5 p' t* s" z, D1 r
0 M3 D9 c8 }; u7 d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* X2 O: k& L9 t$ Carm-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 J9 k6 k, Q6 t8 r& x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- F7 \4 P! b$ B& ]' [- I. G

2 T6 T8 i5 M( ?, q6 h4 c; t9 c- {5 y( ^  x) R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-8 23:59 , Processed in 0.040031 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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