OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 D5 t& E0 I; a; X& u
  1. [code]EDMA sample test application/ K8 y' x3 O: p3 X: ?
  2. /*, F5 K/ U: g* {
  3. * edma_test.c. b4 k) d# f; }. @: V, z# [
  4. *- r) W+ u8 j& O$ t6 O) l
  5. * brief  EDMA3 Test Application( {: T! G! J8 C2 t2 z
  6. *
    + x" \; a$ t1 @% U! f
  7. *   This file contains EDMA3 Test code.
    . m2 {* j: E# z/ \, K' D
  8. *
    5 D, A+ l  x3 `7 |. T5 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' q  f/ z+ g- m6 y' j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 A# g. }2 W' p% n, M
  11. *         TO CHANGE.
    : s% L# b+ S; I: e0 Q
  12. *; t' W- p. K5 |" C; S) Z7 O) T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( G( V, G' [% `( y( w
  14. *# D+ R; f, u6 J5 }
  15. * This program is free software; you can redistribute it and/or, Y) t- Z5 s: D* f
  16. * modify it under the terms of the GNU General Public License as8 _) p0 z7 T5 c+ k. B
  17. * published by the Free Software Foundation version 2.% n& I- m3 ^5 W, w' m, q3 X0 x
  18. *) m0 X9 O# @9 U5 X3 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; H3 J# b% j' \0 \$ g; k7 t' t
  20. * kind, whether express or implied; without even the implied warranty
    ' J# |: i$ H7 a' G5 b6 K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / D& Z( J) C6 x0 ?8 X. E
  22. * GNU General Public License for more details., ^% W7 _3 q5 e, g
  23. */
    1 _+ E2 G, f: w# ~5 M2 h; p
  24. 4 G0 r# K% `& N' c
  25. #include <linux/module.h>
    2 l) ~$ }- A3 `- m% ]$ \) k
  26. #include <linux/init.h>, T1 y) r1 W# H  c8 l$ d" g
  27. #include <linux/errno.h>' l7 J) w; ~, q) F
  28. #include <linux/types.h>
    4 a" G/ k  L, O% A8 ?
  29. #include <linux/interrupt.h>6 T" C$ Q$ p+ }: V
  30. #include <asm/io.h>
    8 r) i" R; M9 E9 t- q: p6 t' k
  31. #include <linux/moduleparam.h>1 C. E, q+ N3 }! s
  32. #include <linux/sysctl.h>
    % h0 b& {, X5 @  I- u& y
  33. #include <linux/mm.h># q- T- z3 J4 [1 v; _& v/ _4 z) ?
  34. #include <linux/dma-mapping.h>
    - c6 P3 n3 W0 r) B

  35. " K# O' F$ I3 q& b( J) |" J- H' _# h
  36. #include <mach/memory.h>
    , e( s; L/ z; C% x. ~* L
  37. #include <mach/hardware.h>
    . u/ f4 ?7 B  P3 |5 i0 n
  38. #include <mach/irqs.h>" K! K! s5 g# H0 {' Q
  39. #include <asm/hardware/edma.h># |9 J, h; B, U; o

  40. $ y( Z! ~# e# b. ~9 [) f% m
  41. #undef EDMA3_DEBUG  e4 m& w& P/ j+ X
  42. /*#define EDMA3_DEBUG*/& k) x6 ?) _# _& P$ D

  43. 8 K) h  W% ?: k( p
  44. #ifdef EDMA3_DEBUG: ~4 B& f8 X4 t( G. I# K0 I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 q& g* _1 ^4 b! t3 f  m7 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 y: t% T7 \: d. r9 p& Q, z- F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" f) F# p- k2 E$ F7 G  d
  48. #else$ s! f8 U7 d) V+ I
  49. #define DMA_PRINTK( x... )2 Y' g* @3 `) [1 }1 W2 S
  50. #define DMA_FN_IN
    # k5 X) P% t6 G# [- D
  51. #define DMA_FN_OUT$ R' p4 n) f; p3 i
  52. #endif
    - s; t* p3 p. y& M

  53. 4 W6 Z9 X( x0 ]. ]' Q1 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * i# _: r- \/ K* {& s
  55. #define STATIC_SHIFT                3# N0 y' z# C. N& d/ ]
  56. #define TCINTEN_SHIFT               20/ H+ G2 C, F1 H  j- ~$ O
  57. #define ITCINTEN_SHIFT              21
    , l0 T! _3 A5 Q8 L8 O$ f5 W4 y' {
  58. #define TCCHEN_SHIFT                22, e7 |- c, i3 x
  59. #define ITCCHEN_SHIFT               238 d( e1 R2 \& P) a7 i' }

  60. + R- y0 `/ ~( p+ a" T) B
  61. static volatile int irqraised1 = 0;/ H- v, Q' E2 o
  62. static volatile int irqraised2 = 0;
    3 f6 w$ Y6 B' Y

  63. 9 F9 a/ `- ^1 t+ R0 v7 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . X% l. }: Z+ L' e* b# Y: j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; U! }* k% Z1 u' b% X' G, ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 A* b; t( U( z7 w( b7 C

  67. 2 g9 l" \8 O# w% w
  68. dma_addr_t dmaphyssrc1 = 0;! a2 G1 \9 G$ T% X( j
  69. dma_addr_t dmaphyssrc2 = 0;
    / I4 l- M8 Y3 Y0 C
  70. dma_addr_t dmaphysdest1 = 0;. q+ w6 U* N  Z
  71. dma_addr_t dmaphysdest2 = 0;' h6 U$ g7 v: f% X3 X+ P
  72. 0 N$ ~4 B( u, \8 }9 k3 K) b
  73. char *dmabufsrc1 = NULL;
    " J( h. L' [, Y# j7 ]) G
  74. char *dmabufsrc2 = NULL;
    + l$ G( g" H3 k1 `) g6 O
  75. char *dmabufdest1 = NULL;- j- x3 H$ W8 ^; }$ I1 A. b! M
  76. char *dmabufdest2 = NULL;1 Q9 A- C# l5 |9 p: G+ d
  77. 7 N9 A& |; l: V0 j& `: \2 S
  78. static int acnt = 512;! P- p- K; H) u4 J2 d, x7 y2 M
  79. static int bcnt = 8;
    $ O( P# [- P2 ~
  80. static int ccnt = 8;$ M8 c3 r& w" [! }0 N3 J

  81. + o7 T: `( ]% @% p
  82. module_param(acnt, int, S_IRUGO);
    " f7 x  L9 ~1 N+ o
  83. module_param(bcnt, int, S_IRUGO);
    # S' W* N* C0 _8 r, J5 `1 a: A8 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* y. U7 d. v5 |/ W" [9 W9 X6 W8 d# }+ _# Z" w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 [1 t/ k. W# e7 V3 l& F
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 S) q& t& r% h. o% `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% r3 K5 ?  R5 Z8 F& l0 B( w- f- G
  r* _# ~4 i3 w/ r- q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-16 19:43 , Processed in 0.039178 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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