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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 |3 f+ a( N! Z, n9 V2 Q" o
  1. [code]EDMA sample test application$ G" z0 f+ M$ E: K7 g
  2. /*
    ; M! S; H; c6 }  k3 ^
  3. * edma_test.c
    3 q* b+ V3 ]5 M; D6 ?% A; V7 V
  4. *
    6 k6 _( C1 J$ g# s  H
  5. * brief  EDMA3 Test Application3 e, h# v7 r! e2 ~) ~" g
  6. *+ V3 E, J/ n7 t* c% q8 ?0 V9 Q# h( [
  7. *   This file contains EDMA3 Test code.  q" n9 n) b* d, H
  8. *
    7 ~$ H3 }7 N8 b' c  t# d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 X# P3 q) H7 u3 w6 d" b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # B1 j) _* r" p
  11. *         TO CHANGE.
    & z! d8 l. |9 ?3 Q. H! t* o  |( o8 I
  12. *5 E. i, ]! `- D1 x5 X) n. O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 l% l6 I8 Q1 f
  14. *3 s4 }/ V7 c. q
  15. * This program is free software; you can redistribute it and/or" c2 Q3 L& ?2 n6 u5 s5 d
  16. * modify it under the terms of the GNU General Public License as
    + T' g; x% x8 A/ j2 m0 V' D
  17. * published by the Free Software Foundation version 2.- D# `* v0 N5 m( X- o! u+ w5 y
  18. *
    ) Y, G4 t: Z" N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , d( N6 x( D* ^- V
  20. * kind, whether express or implied; without even the implied warranty- ?- W0 h5 N. U8 ^) B3 R& c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ @0 w. L2 y- U1 u
  22. * GNU General Public License for more details.2 c. E% r7 S1 _2 g% T2 U( ]
  23. */" Y* ~  j( N8 J* v

  24. . p: X6 \3 B$ J- Y8 }$ f" w
  25. #include <linux/module.h>0 D- g5 z, H" \+ \( Z3 i5 h
  26. #include <linux/init.h>
    , S* J$ Y6 U9 j! B$ s. A
  27. #include <linux/errno.h>0 k+ ?/ r5 |/ L- ^7 W# ~& T! x$ m4 n
  28. #include <linux/types.h>, s# e+ Z6 H% [" a- U' X
  29. #include <linux/interrupt.h>
    3 Z( \5 k: |5 Q6 Q( R+ ^7 |; Y/ f* f
  30. #include <asm/io.h>& D' X$ {7 ?0 c  o
  31. #include <linux/moduleparam.h>
    * y/ H" g. k# q
  32. #include <linux/sysctl.h>9 ?" u0 k+ l+ E3 [# j3 t+ I
  33. #include <linux/mm.h>8 E; f+ c/ o1 Z5 M0 n
  34. #include <linux/dma-mapping.h>8 S0 q0 U( B8 c' O% n2 \
  35. $ a# R& T" B3 @
  36. #include <mach/memory.h>
    * ~; n7 q; @' m8 {+ _1 a
  37. #include <mach/hardware.h>2 M  E( {, S& `1 B4 `
  38. #include <mach/irqs.h>$ B: k' Y) u& J
  39. #include <asm/hardware/edma.h>  R" X, ^+ y. e+ t- ]- h) ^

  40. & S3 h- M1 m( h- b! @
  41. #undef EDMA3_DEBUG4 j4 a8 C! Q* B0 m* f; X6 V1 \
  42. /*#define EDMA3_DEBUG*/
    + t1 I" a# x0 `9 i* [5 B; a9 k

  43. ( F3 ?: l/ o0 |/ x5 X
  44. #ifdef EDMA3_DEBUG
    $ l0 s% E( x6 ^7 l/ e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # P$ d- L! n, W& r. I1 z% a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : w% r1 N! A) W) Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), ?3 D( ^5 X, }3 ]
  48. #else4 _, H) ]1 u1 a3 n
  49. #define DMA_PRINTK( x... )2 z' L" s! J7 @9 ?( s' L
  50. #define DMA_FN_IN; e. H3 P3 C) Z% z
  51. #define DMA_FN_OUT# K% |: Q; {0 `; V
  52. #endif
    1 p/ p5 o" {) L

  53. + r+ i$ q0 ~5 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ _# F( y) l6 Y; n
  55. #define STATIC_SHIFT                3
    " j* P9 F! a9 ]3 ~& Z# ]9 ?
  56. #define TCINTEN_SHIFT               20+ a2 S5 P: t- y# f
  57. #define ITCINTEN_SHIFT              21
    6 x# H4 H0 Y9 L" s  C" B
  58. #define TCCHEN_SHIFT                22, k4 B: v3 a. d3 M. X" R
  59. #define ITCCHEN_SHIFT               23
    : W6 O, p+ C7 t

  60. 9 ~$ d1 W0 ^/ k. H' s$ K9 }
  61. static volatile int irqraised1 = 0;
    1 {* h7 C+ j) W3 E
  62. static volatile int irqraised2 = 0;3 r" l, a; s) T! l

  63. 9 O6 K7 B+ f5 d( P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, j; F  b, v* }- n9 R6 x2 H4 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ?. v8 U4 v, A3 z" k# ^4 r, `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 _/ `# R; m! X% u

  67. " y% t$ p; d. ~) X
  68. dma_addr_t dmaphyssrc1 = 0;
    + p/ m9 K- ^# _1 J3 v9 Y. y8 t
  69. dma_addr_t dmaphyssrc2 = 0;9 r8 ?4 S5 N3 K
  70. dma_addr_t dmaphysdest1 = 0;
    / B" |- W& w" O+ |3 ^  P
  71. dma_addr_t dmaphysdest2 = 0;8 [: ?8 |8 Q" Y) W

  72. % ^0 D% `) p( B$ u9 l" y% r
  73. char *dmabufsrc1 = NULL;
    , m" z  b( v2 z# O
  74. char *dmabufsrc2 = NULL;0 N8 w$ N9 C6 h2 D2 a' B  \3 K5 W6 P
  75. char *dmabufdest1 = NULL;
    : p. O7 d6 v( b0 [6 T
  76. char *dmabufdest2 = NULL;
    3 Y5 k4 k. G$ N- E

  77. : Z- e- P- n" x8 {7 ^8 D
  78. static int acnt = 512;; c4 q* ]! C$ h$ E
  79. static int bcnt = 8;
    $ U/ {$ s+ B( ?+ E
  80. static int ccnt = 8;& Y" Y; h; m, a7 G0 ^* d

  81. # u9 T8 U# q3 P1 O3 ~  Z; V4 T
  82. module_param(acnt, int, S_IRUGO);
    4 G* a1 c8 u. K  C# t
  83. module_param(bcnt, int, S_IRUGO);1 J' x4 r% N* F+ Z  W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" {4 Q8 A' s% c6 E9 E2 o& O8 O2 D5 v/ |. v' t& T! S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ x$ n# U! z5 m2 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 g8 n# O0 k9 R( c6 l  @* o8 ]# l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ?+ M* o' R& e- @
0 @3 ]! `/ Z$ j! K4 [0 z
. n2 k$ C. H! L" ?3 z: `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-6 16:39 , Processed in 0.044570 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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