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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. q4 X4 ^' ?" h  \( J% [
  1. [code]EDMA sample test application# K: d/ D; w3 h) }6 c
  2. /*
    ( u0 C% _9 {& Z; x( B0 G% t
  3. * edma_test.c+ R  V, ^9 W5 [% Z/ g9 m
  4. */ ~' j! U' N7 a) D9 L) `- b
  5. * brief  EDMA3 Test Application
    " q* b8 N7 l- c: ~# a5 q- }
  6. *; S: O  X2 J! G, K
  7. *   This file contains EDMA3 Test code.7 M7 w* V8 w9 ~6 e* k2 C9 ~
  8. *
    & n* r) s1 l. u$ A) U, j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( x0 D/ t, J7 E' ~0 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 g6 v& q' ~' x7 p: q+ B; N( F0 _
  11. *         TO CHANGE.
    " S2 h% r: ]( f! E! c! U; d
  12. *
    - h$ Z' }  Y- [+ P! o# A  M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 g9 n! F0 U! b+ Z! V7 {
  14. *: ~3 `) P+ ?/ s, P* {* D1 d2 S
  15. * This program is free software; you can redistribute it and/or: ~9 v4 O$ q+ _( ~0 F% L; W7 u
  16. * modify it under the terms of the GNU General Public License as  r. y9 x: ~" i8 I: X
  17. * published by the Free Software Foundation version 2.) I. E% N% v! J4 A4 S
  18. *0 @, x0 U* k/ P- ^- m4 ^( Y, F+ C( Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 a* ]% ?  a: [+ L: T+ C
  20. * kind, whether express or implied; without even the implied warranty
    7 }9 H( o) c2 O( n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 [* ~- O! N8 }6 Q# L
  22. * GNU General Public License for more details.
    % B# |  s& O$ r, w1 V% K$ s
  23. */
      R" H6 @- G- q' n# H2 \
  24. . e! F7 M# D5 R) J# R, n- A) P: ]4 Y9 w
  25. #include <linux/module.h>
    8 W1 ~, u# F5 V( ]" }5 R! u
  26. #include <linux/init.h>
    % E, E0 \. s2 Q6 J2 {
  27. #include <linux/errno.h>& S4 `6 M, G" [* b
  28. #include <linux/types.h>) o+ b; f* b* R( B7 e- D5 y; y0 A
  29. #include <linux/interrupt.h>
    " Y2 H0 R: u. X( X, L+ R/ ?; X- ^& R
  30. #include <asm/io.h>
    " G6 E2 }  C5 E: X
  31. #include <linux/moduleparam.h>$ b5 r! T* N# F
  32. #include <linux/sysctl.h>+ ^1 _* u0 j" e5 w) y
  33. #include <linux/mm.h>3 E2 `( F2 e) _$ D( e) ]
  34. #include <linux/dma-mapping.h>6 Y5 G2 B. @3 X: t9 W9 M& P

  35. , U! k; S3 b/ R8 M- C7 [
  36. #include <mach/memory.h>7 V( ~5 g2 I1 A7 X2 ?3 N0 x
  37. #include <mach/hardware.h>- t; ~6 \& C/ P0 M# S
  38. #include <mach/irqs.h>
    9 P+ i# N: ?; {2 A- K# N/ O
  39. #include <asm/hardware/edma.h>
    - t9 N- K, s1 d. q2 X

  40. 1 w, H9 a; j/ W" S. C& Q, t
  41. #undef EDMA3_DEBUG
    6 g9 o0 z6 v0 M- @
  42. /*#define EDMA3_DEBUG*/) b1 v) E4 p) J) N
  43. 6 P9 D' |5 J) [) U  D9 `6 q1 ~
  44. #ifdef EDMA3_DEBUG; M% y3 A# Q, h' p3 z' H4 o3 ]  S/ k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) \' U1 ]6 z/ d: I, `/ v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 t. \6 y% ]( `+ h% v/ |% l) s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & J* F" z& X  d$ \" x4 D
  48. #else% L* u, C" u& I$ q
  49. #define DMA_PRINTK( x... )
    3 [' v$ R; H% N! e! r) l
  50. #define DMA_FN_IN9 R6 u' w; q; c. y1 S. M2 a
  51. #define DMA_FN_OUT
    & D% w& l! v8 I. `9 o5 l
  52. #endif  m& e1 ^" {# Q; z( l
  53. 4 }3 a0 |, M8 h, P1 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , g  Y" I& D# C) W% s
  55. #define STATIC_SHIFT                3" H& t# q$ K6 D6 }( i2 W3 L& D8 O2 J
  56. #define TCINTEN_SHIFT               20
    7 x* |  @3 y1 Q
  57. #define ITCINTEN_SHIFT              21
    1 F9 u! f9 g& \
  58. #define TCCHEN_SHIFT                22- {  l. @; ]3 |5 m2 a! p  W
  59. #define ITCCHEN_SHIFT               23
    9 |3 U/ G% r0 o2 ~/ s3 A0 E
  60. . U# d2 i: k7 E: g! n7 `
  61. static volatile int irqraised1 = 0;  B6 s; ]7 Q3 A
  62. static volatile int irqraised2 = 0;
    0 ?' z/ E$ j8 m& K! ]

  63. * `) D' A) G- i. b& _9 Q- `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % e& |/ e' Z3 d; E2 Z# H; `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ~$ G0 l/ @8 n0 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 D) {3 T: e# A7 Z% T

  67. % b( Z( @6 H6 G. e" k& H- Z
  68. dma_addr_t dmaphyssrc1 = 0;
      F; L7 b  S, N1 H
  69. dma_addr_t dmaphyssrc2 = 0;- c3 E4 `0 E  m# d
  70. dma_addr_t dmaphysdest1 = 0;: Z0 ^4 C9 k# E( n- `" L/ {
  71. dma_addr_t dmaphysdest2 = 0;
    4 v0 |5 E% \4 ~, f
  72. 5 V( U3 g0 K, p
  73. char *dmabufsrc1 = NULL;9 N  u; {! U/ ?( }' S6 j, ]
  74. char *dmabufsrc2 = NULL;
    7 ~; m& o$ @* g# O* C
  75. char *dmabufdest1 = NULL;
    % m, `) J2 l- d
  76. char *dmabufdest2 = NULL;
    4 }/ ~, F! u, J" G# S4 N& f& z
  77. " `5 j* J+ M* S$ H( h0 i+ T
  78. static int acnt = 512;
    ! F' f8 v# c0 C. W
  79. static int bcnt = 8;* b4 l6 I$ q4 V
  80. static int ccnt = 8;
    % D" K' {( O* ?& C) }: D% r- |2 @
  81. 8 z! n$ z5 Q) K; A$ D
  82. module_param(acnt, int, S_IRUGO);
      Q' f9 e( X0 c) @, `# F8 L5 ]
  83. module_param(bcnt, int, S_IRUGO);
    ! v+ H; |! U6 F/ h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 U9 u8 z( t; Z
0 a: d" }+ l( s" K, P! ?( J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! v5 d" S) d) ~! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 {) ~$ ^6 S5 Y- B; Y/ p( e2 s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 P! U3 \, \+ \8 ?
* E0 i, z# f4 h4 H2 q

9 D! l7 K, J4 O+ P7 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-15 11:00 , Processed in 0.045619 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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