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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 f4 x7 ~! P! q5 ]: d" [7 j
  1. [code]EDMA sample test application
    % H0 z3 ]) m# z: Y9 Q  U4 C/ {
  2. /*
    ! h9 T# N" f" J
  3. * edma_test.c
    * U4 B1 f7 u4 h& u9 t
  4. *, Q+ D# Z5 u% M/ q: }
  5. * brief  EDMA3 Test Application8 W) E7 T- \5 _2 V! R" M
  6. *! ?* Z" ^& n* \" {$ t6 g
  7. *   This file contains EDMA3 Test code.5 V; H  R: r/ _) Z3 k
  8. *
    2 {& x# Y1 l2 z# C& h$ Z7 w) N4 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 h9 B. v5 h3 Y, l8 K  |5 Y! t  w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( C, |- P5 H- ]3 M
  11. *         TO CHANGE.& ^% ?  S+ n% j, h! v$ z
  12. *
    # m6 L# f* ?$ j7 t! {+ M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 F5 a) j# [' Z3 X  b" S
  14. *& U% n5 m% l/ F8 U* c
  15. * This program is free software; you can redistribute it and/or# i( M/ r+ s8 N  u: p
  16. * modify it under the terms of the GNU General Public License as6 v: n# t0 X* m; |: ?6 @& \8 F
  17. * published by the Free Software Foundation version 2.$ O$ H/ m3 h% d; l& Y5 v% A
  18. *
    + }0 j; `7 j0 F! z) D4 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& }9 |8 Y9 P) h
  20. * kind, whether express or implied; without even the implied warranty9 A6 Z  M+ @5 o2 d" @6 K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" z8 U$ j# }8 r$ j* j
  22. * GNU General Public License for more details.; g( g8 `( p! s5 x7 q
  23. */
    & i" c' e; B3 S: U# G
  24. 8 E- W# G- A+ z& V$ J
  25. #include <linux/module.h>
    4 m7 f- q0 ~  m; a
  26. #include <linux/init.h>+ t0 `7 A" S# T2 f. T* K. J
  27. #include <linux/errno.h>
    , V! U4 ?' L% M4 W( M9 b
  28. #include <linux/types.h>
      C5 m+ F* A8 `( w2 [7 z
  29. #include <linux/interrupt.h>
    3 V& G+ Z( U9 _+ X, Q( b
  30. #include <asm/io.h>/ H3 A4 o9 }0 i
  31. #include <linux/moduleparam.h>
    * ?# r" D, [- A7 I- d% `# \  [, H8 D
  32. #include <linux/sysctl.h>' o+ g$ ?: o5 P0 o+ e8 d' J9 F) E
  33. #include <linux/mm.h>+ ~5 S  Y) j) Q
  34. #include <linux/dma-mapping.h>
    - M; ?. N) L$ j/ X
  35. 3 S+ A9 D5 o% p( }
  36. #include <mach/memory.h>' G; n( o/ j! T, z* O
  37. #include <mach/hardware.h>
    9 T. W4 c5 l: B% l% K6 Y
  38. #include <mach/irqs.h>
    6 `% Y" D. B: ~; q! [' W6 f
  39. #include <asm/hardware/edma.h>
    ; V0 R! {6 Z7 ^& A
  40. 1 F" K5 ^- q! r( F, [9 x  L' Q
  41. #undef EDMA3_DEBUG" U, R; U! L1 C
  42. /*#define EDMA3_DEBUG*/
    8 e3 b" {' k$ x- M

  43. 8 I7 x6 L& w2 \* H3 M* P. B
  44. #ifdef EDMA3_DEBUG* I; y2 k2 r1 Y3 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); |% X2 C0 J' [5 }2 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 S( I2 ?9 g0 Y& M! X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 S2 L0 c, D: t5 ]$ z* d3 `
  48. #else* R3 H  W/ }/ R
  49. #define DMA_PRINTK( x... )3 `5 R$ O/ @- w2 x. H. f
  50. #define DMA_FN_IN3 e- J! X6 f- o
  51. #define DMA_FN_OUT
    1 Z/ g/ S7 n) R3 w' B1 f* s0 T
  52. #endif. V9 V- D% M* ^) ?
  53. 3 M4 d) [6 J2 G7 j, X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). h- `4 v  i1 E
  55. #define STATIC_SHIFT                3# [! n' _, Q0 B/ d" M
  56. #define TCINTEN_SHIFT               20  J  z( [, X; G" B
  57. #define ITCINTEN_SHIFT              211 \" [# \  o% c5 g
  58. #define TCCHEN_SHIFT                226 h$ r: o+ o, }: f: Y
  59. #define ITCCHEN_SHIFT               23
    + N. a( Q) X1 L# Z) o% [8 Y
  60. 6 |3 v) d) y" P$ d$ v
  61. static volatile int irqraised1 = 0;
    5 Y' m: g/ T( m$ {* R7 K
  62. static volatile int irqraised2 = 0;, g- p! l& Q. _1 p9 W6 s
  63. $ G1 m" ^" c! m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 b, t( G& o0 J5 t0 |6 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ O6 C7 a7 D4 @. @$ Y2 I$ _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ^4 h2 x) N" M) e; x6 b6 E
  67. ! j8 e5 F& k- `- A" f
  68. dma_addr_t dmaphyssrc1 = 0;8 ?, ^% p8 O) I8 ]4 ~8 d$ Z
  69. dma_addr_t dmaphyssrc2 = 0;& y6 c/ ^0 J3 |" [6 a
  70. dma_addr_t dmaphysdest1 = 0;
      K% O9 z2 U2 Z  o; {
  71. dma_addr_t dmaphysdest2 = 0;
    " E2 H3 j9 G, M" \
  72. , J- X5 [1 I+ q! ~* C% K8 {9 `
  73. char *dmabufsrc1 = NULL;& q+ u& U. W/ _% D% Y6 E+ P
  74. char *dmabufsrc2 = NULL;
    3 U1 o4 M. h. Q6 E
  75. char *dmabufdest1 = NULL;
    0 W2 Z3 v7 p0 Q; R) l% J( Z
  76. char *dmabufdest2 = NULL;; A) n/ a, U: A

  77. : q! a0 i& @7 ?- r1 E
  78. static int acnt = 512;
    + W- q0 L) U) M5 d* b7 e! D
  79. static int bcnt = 8;
    8 O* Y/ j( e* n- g
  80. static int ccnt = 8;
    2 m" L6 `5 E- @5 E" ^8 _. K& |1 }

  81. " k0 r9 n8 |- A- e
  82. module_param(acnt, int, S_IRUGO);7 x. {& \4 n. \! V0 O
  83. module_param(bcnt, int, S_IRUGO);9 R+ j" k- p0 P* k( C/ K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( G, `6 u' e' N; G) @2 N# n, C
  G3 u& m. D3 A7 E' d: S3 c% p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 {9 z& }# s$ p% B# J- o7 l9 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! a- J  k2 N- z) O$ h. ~, L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 z! F# ~5 O. K+ u- i! D  m& A7 _& ]$ X3 f6 K& D
7 a: c5 I8 d% t/ O" T) q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-21 08:29 , Processed in 0.050316 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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