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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) u$ o0 H8 b( T) v! |: g, s
  1. [code]EDMA sample test application
    4 x3 A# j0 T5 {" P* Q8 X2 A
  2. /*
    1 ?& t, t% t6 |
  3. * edma_test.c, p% [  y4 A+ @/ w& c7 T: {
  4. *' |) {, \' S  ^1 T! ]% J4 x
  5. * brief  EDMA3 Test Application
    ' X& ?5 n1 L! w1 T& B
  6. *
    * v4 |' U) ]3 m( X+ s0 R" Y% |
  7. *   This file contains EDMA3 Test code.  h. I) s$ g9 F* D; Z
  8. *! m+ D3 r. x2 [1 v- G# L9 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , J; b- G. |: s2 j. |7 S2 Y6 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ W, E, s# n+ P
  11. *         TO CHANGE.8 F, p) ~  v: l9 H( c. w7 ^
  12. *
    $ \# l: \2 T5 Q, Q$ [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & B( E6 M( n& I# t2 S8 c" s$ H
  14. *
    2 s/ w& X2 ~; z; S9 o
  15. * This program is free software; you can redistribute it and/or1 U* i- ~6 h$ J9 P8 P* w* ]5 c- M7 A
  16. * modify it under the terms of the GNU General Public License as, F! N# L* I! `0 y+ Y( w
  17. * published by the Free Software Foundation version 2.$ u$ _' t/ j) M8 u( x4 x/ E( w
  18. *  t- N: Y* X4 [5 l3 p& @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 ~% q( D% [& t; t! x: o, t0 b7 p
  20. * kind, whether express or implied; without even the implied warranty5 v& n  C# W/ a- L# R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + c# V- n* O/ M! p
  22. * GNU General Public License for more details.) Q- j" q# X, c9 _2 O
  23. */
    1 n8 w% [7 O8 ^% B9 L0 ^6 O
  24. 3 U$ Z% s. E8 h, {, A
  25. #include <linux/module.h>8 A8 B* H; ~2 Z) E3 |
  26. #include <linux/init.h>) U7 O0 E" l% i2 _$ R4 b
  27. #include <linux/errno.h>- v' G( ?: u4 T$ _& s+ A% P1 p. b
  28. #include <linux/types.h>5 p3 }, ?( z! \: a3 I
  29. #include <linux/interrupt.h>5 o+ Q! ?) T# A" i* G
  30. #include <asm/io.h>+ b: m6 a+ z( g' |2 N+ r
  31. #include <linux/moduleparam.h># n2 u# e% F9 u0 w  ]
  32. #include <linux/sysctl.h>
    & F) ?9 p8 E8 [4 I# @  L
  33. #include <linux/mm.h>, V0 w6 Y" G0 p! P7 {
  34. #include <linux/dma-mapping.h>+ H9 [( C0 q  l+ H& M0 H% I# u
  35. / S) h$ q1 }; C. _2 e2 c
  36. #include <mach/memory.h>
    # q! x( j/ H8 f1 D' o
  37. #include <mach/hardware.h>
    & c0 |( Q* Z% Z
  38. #include <mach/irqs.h>
    / w; ~$ Y- \; D1 F% Q
  39. #include <asm/hardware/edma.h>
    ' b* X3 H8 I* ^
  40. ; e' n! |( Y( @& [
  41. #undef EDMA3_DEBUG
    : ^  f; T4 g+ V  d* d% u
  42. /*#define EDMA3_DEBUG*/* c- ^0 [! K0 ?  i# N7 v

  43. 4 e4 a9 S/ e3 e1 }' X7 U
  44. #ifdef EDMA3_DEBUG, q) O( d, e, v+ r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ ?- ?# L* m( n5 k, N! e! x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 C+ H! A& L. i3 ^/ {' A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / O! K  n+ R6 J9 F  K! S3 i
  48. #else: i7 A: j. k; |6 z( B3 J; m
  49. #define DMA_PRINTK( x... )
    0 o# V1 A# Y' _+ j: B) N* v: _
  50. #define DMA_FN_IN8 c1 S. o1 W/ S1 o( h7 n! Q1 E. ?6 M
  51. #define DMA_FN_OUT
    6 i5 q( H6 }. w! F: ^) Q/ Q! o
  52. #endif
    0 n4 y0 x6 w- I, u* M7 x1 B
  53. ( v% w, G; S; k% G6 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): }7 u$ ]7 |7 d+ j) M/ ~2 G' j0 t
  55. #define STATIC_SHIFT                3' D  V1 r1 x  n
  56. #define TCINTEN_SHIFT               20
    ! c6 k, R, V7 L# v
  57. #define ITCINTEN_SHIFT              21
    6 r* r2 W; N# e: @1 l
  58. #define TCCHEN_SHIFT                22- H2 ]1 Y3 Z, E3 r1 c
  59. #define ITCCHEN_SHIFT               23( q8 {! T' R. {+ [5 [' n) F
  60. " q5 G$ m0 N, A; Y9 N
  61. static volatile int irqraised1 = 0;( ?8 ~  L4 P: I/ ~+ Y: z/ V
  62. static volatile int irqraised2 = 0;) _* e$ Q3 f9 Z  C! p
  63. 2 N6 k$ l& A4 j7 o, v) I( {6 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " N+ S4 ?3 o* k$ ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ e$ V0 f, d8 O/ e* E5 v, ~0 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ~( U$ V/ p9 F" m4 y

  67. # m5 \, o  }) n7 T" F7 ]. P! `
  68. dma_addr_t dmaphyssrc1 = 0;$ }6 v% g3 s6 f  O$ c
  69. dma_addr_t dmaphyssrc2 = 0;9 G3 r/ h. X4 t* }4 t" s4 R- H( A
  70. dma_addr_t dmaphysdest1 = 0;
    ( n+ N( a1 S) |8 x
  71. dma_addr_t dmaphysdest2 = 0;; M8 Y- F" Q, a" ?$ H

  72. 7 q, r( Q3 i' Z# K6 o+ T8 |) F
  73. char *dmabufsrc1 = NULL;4 Y4 V3 R% G) n; c2 O
  74. char *dmabufsrc2 = NULL;
    1 J1 C: H% F9 M( o8 h
  75. char *dmabufdest1 = NULL;! ?& \: E+ O' H+ ]
  76. char *dmabufdest2 = NULL;, u/ U* m) f9 X/ Z4 ^0 ~3 ?
  77. ; Q; ~5 S  X0 E6 T: w6 j/ E; C
  78. static int acnt = 512;
    6 V# S- m* N* L+ h+ J- C% `4 \* r
  79. static int bcnt = 8;
    6 i4 N: l1 `, @& }8 Q+ o
  80. static int ccnt = 8;. B5 ]5 N' A1 b2 M: M4 K; l
  81. + {  E2 o  q' i
  82. module_param(acnt, int, S_IRUGO);
    . l* b# Q! _) P  y) F; E. u# J; L0 k
  83. module_param(bcnt, int, S_IRUGO);1 ?" }: M) e0 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 u3 {& W% |6 N/ [5 R7 M) I$ A# [6 g" r: b1 Y' ]- [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ `% s/ x5 U9 A: G/ ]; A" q' u5 iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# T3 W) A5 i, ~  R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 B* ^- [! y/ A8 r  R6 l
  ^& u$ p$ K, s# q  e- b% f$ n6 ~/ {0 w& d! R) S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 20:48 , Processed in 0.040775 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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