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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 {" ~) T: l" N3 r2 i3 u- `
  1. [code]EDMA sample test application
    " t/ W  Z: y% O/ d, J
  2. /*) X0 l5 H8 L; }% L, T6 v7 p
  3. * edma_test.c
    . i2 I* Q/ j& z+ {/ U
  4. *, \8 s0 n5 r3 z9 z2 Q) v& v
  5. * brief  EDMA3 Test Application  x# q$ Y; T" E
  6. *; k9 A# W0 X; J! I
  7. *   This file contains EDMA3 Test code.1 g/ B& r1 l; {! r8 C" Y( G
  8. ** l% Z$ E) B8 u: b! \/ A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ Z6 N9 m2 a. v- R6 }5 N$ T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 S( v3 c( t9 G/ |5 i: O; T
  11. *         TO CHANGE.
    + n/ R& a1 F$ r( f8 A
  12. *
    9 E3 ?. y- R) l! ]" t2 q6 c) a# a, U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 s2 [3 J6 p9 T  |
  14. *
    * U) c9 I3 X, Y# J
  15. * This program is free software; you can redistribute it and/or
    2 k  R, h8 k' ~% I( [: Y5 u. V
  16. * modify it under the terms of the GNU General Public License as
    " X7 S" }, B4 U( q0 Q2 F5 x
  17. * published by the Free Software Foundation version 2.
    ' }8 s( `: N& r/ r
  18. *, \4 r2 P' k& r# U7 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ ?) t- z0 o+ b6 e0 k. o9 l* Y
  20. * kind, whether express or implied; without even the implied warranty8 z' T" p# R8 P0 Y9 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' G1 C6 f* ~9 i5 `3 D
  22. * GNU General Public License for more details.4 P) L& b' m4 ~! {/ W$ T9 u6 X
  23. */
    7 Y- U4 f* C# L; U$ o
  24. * j9 f' A4 D* f# s3 J9 W
  25. #include <linux/module.h>: `# p9 ~# Z0 t$ m' R+ ^
  26. #include <linux/init.h>
    1 m  v6 h! P4 v* L# F% E  u
  27. #include <linux/errno.h>
    6 P8 P' ]/ X4 J% V0 u! m
  28. #include <linux/types.h>
    ' l, o2 t: D9 W& _
  29. #include <linux/interrupt.h>
    * o3 S- B' R4 D
  30. #include <asm/io.h>- X' e# |, |, H' j
  31. #include <linux/moduleparam.h>) Y0 J& W2 a( Z9 z1 S
  32. #include <linux/sysctl.h>5 h( {1 `7 K/ c1 N% T
  33. #include <linux/mm.h>( w& b. S4 t" I( @
  34. #include <linux/dma-mapping.h>
    : i4 Y: y  Y/ c8 d5 k

  35. ) v4 i  w0 x8 P; N# G
  36. #include <mach/memory.h>
    * @4 I# ?1 \4 L/ ?; y( d) }3 B9 H
  37. #include <mach/hardware.h>
    * g5 C9 m  r7 T: D' G. d
  38. #include <mach/irqs.h>( q6 y6 f( [$ ~# P
  39. #include <asm/hardware/edma.h>
    - o  v' J5 D3 `+ P. g
  40. % v, G) [( f; X  _! p3 N/ B
  41. #undef EDMA3_DEBUG  x0 h& R- ?3 l: }# I
  42. /*#define EDMA3_DEBUG*/! H1 ?7 i* E& |, F) t' I' D6 `
  43. ) \$ Z. Z4 c8 X% ^
  44. #ifdef EDMA3_DEBUG. c2 D7 n( r5 t4 N8 p' }# C1 M4 ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# I! A; d& E9 {, L8 {& ~( @9 v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ y7 S* G9 D# b* H$ N3 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ V4 c( x$ x+ [' H7 m% l
  48. #else
    ( S* Z. G! m9 d/ A/ B; ~
  49. #define DMA_PRINTK( x... )4 q4 `- H1 w- I$ B# G* i
  50. #define DMA_FN_IN
    , @. \: X/ {7 X8 Z5 G4 p
  51. #define DMA_FN_OUT
    . V6 s" d1 O8 w0 q' \6 c3 a. e
  52. #endif
    2 l0 F5 m3 J' s
  53. 8 |6 d5 i* `& a! ^8 s3 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 ~0 G& y: D& b- l1 n, _
  55. #define STATIC_SHIFT                3% x( ?' e. E0 ?1 c  W; }4 R8 m: O
  56. #define TCINTEN_SHIFT               20, ^$ a4 \0 i1 I0 F1 t2 M
  57. #define ITCINTEN_SHIFT              21& ~- [4 F) h. }; p
  58. #define TCCHEN_SHIFT                22. d" S, g" {+ `+ s9 Q1 d
  59. #define ITCCHEN_SHIFT               237 W: ]9 S3 A. Z& \

  60. * p. `0 R) |; o2 {) n4 c
  61. static volatile int irqraised1 = 0;
    ! t+ U: W' ^+ {
  62. static volatile int irqraised2 = 0;
    ( i4 h" P8 l" d$ _! |
  63. & a& F* G0 H: v2 c% X4 B4 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 A5 G  Q5 H9 p$ }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) w+ S& s* a4 d; d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 j: _4 S/ ]" [* j) f, P1 k$ C" q
  67. + S. v/ C' k$ l) x7 p6 g4 {
  68. dma_addr_t dmaphyssrc1 = 0;
    2 i1 g, a0 c# I# i4 [2 h8 A' C
  69. dma_addr_t dmaphyssrc2 = 0;
    . u: {! Z& F* G2 p
  70. dma_addr_t dmaphysdest1 = 0;5 Z, b# n4 h7 M- J( m: R! ?
  71. dma_addr_t dmaphysdest2 = 0;
    4 s  y: ?$ F$ g0 T

  72. % d( J- V, s3 Z; z% a
  73. char *dmabufsrc1 = NULL;
    ; H5 @9 t' o: v% w
  74. char *dmabufsrc2 = NULL;
    % p' u" o# f, s8 ]2 E+ S1 u
  75. char *dmabufdest1 = NULL;
    # W7 l2 y/ p* `
  76. char *dmabufdest2 = NULL;2 s$ }3 D/ C1 o1 l" H" z  E

  77. 9 |6 f$ h% x- X; x3 d1 C
  78. static int acnt = 512;2 x, n' t$ n* W; \; f
  79. static int bcnt = 8;
    2 s( @0 m4 R6 Y( D" z% @4 i
  80. static int ccnt = 8;
    $ p1 _8 g& _; J, J" Z# ]
  81. 4 \. I. l+ U" D. V1 J
  82. module_param(acnt, int, S_IRUGO);
    - I/ b  I" c9 o  J6 p
  83. module_param(bcnt, int, S_IRUGO);$ Y& r! Y7 W/ A* o! z7 Z1 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 G! o, _) H- o1 Z! v& L$ p
6 e( L1 i1 Z  X2 D# N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ |( ]) ?4 `1 D* @- W) r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 ^7 [% A, w: Y6 K! z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, X$ C7 A: `  n1 n6 l) I

) p! P* F4 E# a6 I% z9 B! h8 ?* n# u2 W4 G$ X: t; E! y4 t0 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 00:42 , Processed in 0.039673 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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