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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 a7 ]7 {" I0 Y4 M5 _
  1. [code]EDMA sample test application2 H0 ]! c' x, I! x9 E: t+ F
  2. /*
    . L4 x6 s+ H. X
  3. * edma_test.c
    1 n9 X- B! `* g7 V3 r% t/ v
  4. *
    ( x! C  B$ H7 y
  5. * brief  EDMA3 Test Application
    % m9 F0 Z) n: U6 r' c
  6. *
    * @) G$ w3 ^( b' @3 M" P
  7. *   This file contains EDMA3 Test code.9 ]2 Z4 [3 @% ?' s# u
  8. *  N: A7 Z" ^& x- B3 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 M% Z* |. Q6 n0 g/ G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % h- e% J  ]1 }6 S* G6 g- K. R
  11. *         TO CHANGE.
    3 i  s9 @% Z9 W, J0 v
  12. *
    ; o( i  L$ b! i+ {- u9 O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ t% r$ B. z+ }- S
  14. *
    6 U4 B- T: p. g# w. `5 q6 S1 B
  15. * This program is free software; you can redistribute it and/or9 G2 h! ]6 z% c+ Z" l% @% y9 |
  16. * modify it under the terms of the GNU General Public License as
    # P& q  z% l2 |
  17. * published by the Free Software Foundation version 2.0 p7 D' \% @( m6 B/ C! u
  18. *
      Y3 U5 }3 }  o7 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# B/ R# K. ]* o* B% A/ u
  20. * kind, whether express or implied; without even the implied warranty; }# q8 g1 n, M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. O/ J$ p' B% `0 b2 c
  22. * GNU General Public License for more details.
    / k0 l" _$ b" c2 I) ?! L) ?
  23. */
    - Z. v! |, ]4 g9 e4 T  l

  24. 4 g; s  A5 }* u9 l- O: p
  25. #include <linux/module.h>
    / F8 g3 l5 z: a- M+ x- h9 q( d! Z
  26. #include <linux/init.h>
    + h0 P$ G+ C: W4 M0 k+ i
  27. #include <linux/errno.h>
    6 n$ |/ R" J! ]- q$ j1 ~. i
  28. #include <linux/types.h>
    ( l% d# f) {4 }* F; [
  29. #include <linux/interrupt.h>
    9 L3 r) y7 B% }/ @/ _
  30. #include <asm/io.h>
    0 u7 T- _8 f# M
  31. #include <linux/moduleparam.h>
    ( y# C. F% ?& ^/ i. }! Q! m
  32. #include <linux/sysctl.h>3 X' ~* q6 Y( O; n; n$ G" V
  33. #include <linux/mm.h>
    0 m& t& p7 v$ \; n% U$ u8 [- f
  34. #include <linux/dma-mapping.h>
    ( k+ e; j& x) q( @( N1 L* o

  35. ; c8 I" Y9 d+ L0 d% f" ]. b
  36. #include <mach/memory.h>
    % ?3 w) u9 ^. D' }
  37. #include <mach/hardware.h>/ c7 z- P: D* T  V1 \  ~% G7 U
  38. #include <mach/irqs.h>6 r  l/ P: F4 R% h. T  @; X
  39. #include <asm/hardware/edma.h>. e" C- a; z% J" M7 k! A

  40. 5 @7 s7 x: J; S) x
  41. #undef EDMA3_DEBUG  K& d1 k: a% _* R! f
  42. /*#define EDMA3_DEBUG*/
    " [5 l3 Y6 `' d) N

  43. + Y9 e1 M" j' @* p1 R
  44. #ifdef EDMA3_DEBUG
    7 h- o3 X% b$ I3 M/ H8 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). [4 Y7 g; l9 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 M8 i1 `! J+ F) F% V  [9 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); G) l/ s4 i6 ^$ E8 j
  48. #else
    % u( p) f$ b' ^+ o! I5 b
  49. #define DMA_PRINTK( x... )6 w9 v/ s$ k# ~* T; a4 ^& h9 y7 y
  50. #define DMA_FN_IN
    5 j) [9 U) t' I8 F% K% E. ?
  51. #define DMA_FN_OUT
    8 ?. k* R! t% Y% U9 u# G; ?
  52. #endif
    1 Z# w8 h0 [2 M# D5 c3 v
  53. 3 _7 R8 ]% h1 d% G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 o) @; r' U/ j/ e: x0 ]1 r& ^
  55. #define STATIC_SHIFT                3; u/ P9 e) ~# E
  56. #define TCINTEN_SHIFT               20
    9 Y, Q9 n1 }0 E0 z! c
  57. #define ITCINTEN_SHIFT              21
    3 e, z  q; u/ b6 n: u9 V
  58. #define TCCHEN_SHIFT                226 f: A/ q9 i6 @. i/ B0 w# t
  59. #define ITCCHEN_SHIFT               23+ q1 O% |' P! o( g- R
  60. 5 k: N4 z) U" m1 G/ W( F
  61. static volatile int irqraised1 = 0;
    ) \; ]  }; q2 S0 s% W- m* I1 \
  62. static volatile int irqraised2 = 0;) m% V5 B) ^% {! {6 l" ~" x- v) E. y

  63. ! ?5 K0 \6 z- D3 d. r* s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ a2 I2 @, C; C5 Q3 c% Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # N# z( h! L( U( Y% }; m* _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * T& x( H# x! K( O& K/ Z

  67. 3 n7 U+ ^+ i+ t6 y" G
  68. dma_addr_t dmaphyssrc1 = 0;
    ) @5 N/ [3 F& C6 m
  69. dma_addr_t dmaphyssrc2 = 0;! A  ~  }8 G9 p: U1 S- M
  70. dma_addr_t dmaphysdest1 = 0;
    $ N/ Y/ N1 W+ X1 N+ C7 `
  71. dma_addr_t dmaphysdest2 = 0;/ F! P9 y2 `- ^9 O

  72. % K) Q0 v$ {/ R9 W0 i4 i% a) h- r# A
  73. char *dmabufsrc1 = NULL;
    ( A1 _5 g8 v0 `. l  C$ @2 |) e
  74. char *dmabufsrc2 = NULL;
    # Z( z" }( q- X9 d4 y6 \# e
  75. char *dmabufdest1 = NULL;1 J4 @4 D9 k% E& Z: P
  76. char *dmabufdest2 = NULL;
    8 C" A( G$ e9 m

  77. / M% ^0 g9 t* @; a9 o- x, B; r
  78. static int acnt = 512;
    % J* o( z9 y+ x4 N% B
  79. static int bcnt = 8;5 L; o+ I% F+ @
  80. static int ccnt = 8;
    ) y( M1 w! @# z5 F% o

  81. . V+ a/ [5 r1 w# `5 q% M8 c
  82. module_param(acnt, int, S_IRUGO);" C. m& ?) S+ ?. M
  83. module_param(bcnt, int, S_IRUGO);3 g+ f% L6 t) \3 E  v" d5 p: o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 D$ `# h/ m) A6 q) m$ c; J
, N) n2 b$ r' u$ T7 t! q% }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& J) z/ r" ]+ A+ [% varm-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 E- z9 {9 R0 X7 |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 D& @8 p3 L6 b6 O& N$ t4 _
! o. ?0 |7 T# ^
& G6 M- D/ B" I4 h0 i/ Y4 {" S! z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 06:16 , Processed in 0.054310 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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