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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' _' t8 [8 Y; ~( Y2 p
  1. [code]EDMA sample test application7 ~! a- z2 M+ m, G0 K; ?+ M8 V7 ~
  2. /*
    8 Z+ E' g  G, [9 q2 [8 C
  3. * edma_test.c/ c* ]$ g2 h# }8 |/ ^% l
  4. ** Z/ h8 u8 ^1 W0 M; C( N' i0 e
  5. * brief  EDMA3 Test Application
    ! N9 s5 z, B) L3 y. s+ q
  6. *# ^& @" g8 P. |" l, z
  7. *   This file contains EDMA3 Test code.1 o! t8 T1 a8 m: E& Q
  8. *1 o: ~" q) i# B% }( C2 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % T) y$ E( T+ s. W; t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 ]5 `' k! o1 H6 m. J) _
  11. *         TO CHANGE." G, e0 U! T: q6 j
  12. *
    1 D4 L) m6 H/ _0 z3 i5 v& K9 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, d% B4 f/ s! l& |3 f0 n
  14. *
    . k: U  W2 D1 O, N
  15. * This program is free software; you can redistribute it and/or
    0 v& v( m7 b1 p4 @6 S5 {
  16. * modify it under the terms of the GNU General Public License as, c- v5 i/ \3 V' k! {
  17. * published by the Free Software Foundation version 2.
    1 \; t* g* t5 E! ^3 {0 a
  18. *$ @. N& F  X: d6 X6 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  w7 i' s- a6 ^+ X* m
  20. * kind, whether express or implied; without even the implied warranty
    6 r) N7 {- }8 Y3 r: S7 H" c" _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + [6 U" F- s9 b0 {) ?
  22. * GNU General Public License for more details.
    ( @5 N/ S: C# H2 w
  23. */
    3 n' J9 T+ e' x* t
  24. % t6 h9 K" b! H  g
  25. #include <linux/module.h>1 k0 |. y+ }8 ^0 r! `  l
  26. #include <linux/init.h>" R- Q9 w" a$ s5 y# ]6 X& ?+ a( w
  27. #include <linux/errno.h>
      S, w/ v- @$ f' F* \9 |' j# @3 m: @
  28. #include <linux/types.h>
    * t, x* p8 c( z7 @+ {( j( o
  29. #include <linux/interrupt.h>
      f; W4 f, V) E; K* i4 P
  30. #include <asm/io.h>
    & ]- Y* |# Q' D' t9 K5 Y: L
  31. #include <linux/moduleparam.h>
    ) T6 E" \* i! Z8 i) t
  32. #include <linux/sysctl.h>
    * ~. r* u9 \0 M  h- j2 U; y
  33. #include <linux/mm.h>
    ! f+ S; u# r( |  \. |- K( v+ T' Z
  34. #include <linux/dma-mapping.h>1 H0 t& [& z% w0 \; i5 c! }* K

  35. : R2 E! O4 x. u$ L' }
  36. #include <mach/memory.h>3 h1 D% v8 K; ^2 w. G: z0 R& b
  37. #include <mach/hardware.h>
    2 }$ \+ X. t4 P5 r9 F5 x( Q: A" T
  38. #include <mach/irqs.h>; a; h3 u; d# T- u  F! r+ _
  39. #include <asm/hardware/edma.h>
      Y; U5 l6 d8 \! l

  40. ! z: m8 b7 t, n7 T% T+ H2 u, X
  41. #undef EDMA3_DEBUG2 z$ [( q0 T7 C% a
  42. /*#define EDMA3_DEBUG*/
    2 W$ Y6 e6 ]9 G/ |
  43. 2 N! N+ x/ H( Z7 J- X
  44. #ifdef EDMA3_DEBUG8 ?1 B' d6 z0 }: O  H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! m3 l& g6 ^4 U( F0 q5 S2 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : o; y" |4 Q/ M% D5 e- `6 k5 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; m& O9 n9 A; A; z/ d, w' W' h; s
  48. #else" V$ W/ \+ ~% F. \
  49. #define DMA_PRINTK( x... )' K5 J! i4 a! N4 m  d2 b3 X3 z
  50. #define DMA_FN_IN
    $ B2 f7 S/ M) v0 Z8 H
  51. #define DMA_FN_OUT
    6 v* Y& A% W- t3 Q- a' n! }0 P" O
  52. #endif
    ; t' D* P) T1 K

  53. 1 E; K# R/ O. {# e& n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 m4 W0 K: c1 F* x7 _% ^: b: h1 T
  55. #define STATIC_SHIFT                3
    ! q) n, n; g( y2 L' V
  56. #define TCINTEN_SHIFT               20
    3 x! S2 L0 t0 _
  57. #define ITCINTEN_SHIFT              21
    ; `9 [* ^; U* X2 w' y
  58. #define TCCHEN_SHIFT                22
    $ o; e3 y9 F, {4 O
  59. #define ITCCHEN_SHIFT               239 d: Z$ ]5 `% F$ {; P" ]9 w
  60. 4 x0 R# y2 L( @* {0 G8 l
  61. static volatile int irqraised1 = 0;
    ( B6 u, n1 \. U4 z: K$ e3 f
  62. static volatile int irqraised2 = 0;# J9 I7 X7 ]' e: s1 S
  63. 5 v6 \) R% j* ^4 t! N5 x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & }4 ]0 t+ D3 B% u- ~/ c5 F, d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 I' }( ~! w. ]6 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      N" _3 U7 V* [) [1 y9 p! i

  67. - t# l8 [1 r# T+ r! h
  68. dma_addr_t dmaphyssrc1 = 0;
    8 T. e# C/ ]) z: R+ T
  69. dma_addr_t dmaphyssrc2 = 0;
    / D1 c3 R* p, X3 g
  70. dma_addr_t dmaphysdest1 = 0;
    7 `8 J; G+ s2 v3 p2 V" r# `, y1 d
  71. dma_addr_t dmaphysdest2 = 0;/ n) _1 V3 j, Z$ O5 s6 q, J
  72. # M# r0 D5 ^4 i( B/ ]6 {) t
  73. char *dmabufsrc1 = NULL;/ Q- O, Q% a1 P8 N# h
  74. char *dmabufsrc2 = NULL;
    / [5 [, a6 ?/ b4 w; O9 n
  75. char *dmabufdest1 = NULL;
    ) v# ]* n  K1 u% ]9 g& v+ B# U( N6 w
  76. char *dmabufdest2 = NULL;
    4 M; S. e% P- {+ |

  77. 2 c7 |: \% H+ L
  78. static int acnt = 512;. T" E; x' y7 ~% u8 P" x
  79. static int bcnt = 8;( L- i3 J( F/ F
  80. static int ccnt = 8;: u* P! a& u2 R4 g7 o- [
  81. $ w. S! [; I$ ~
  82. module_param(acnt, int, S_IRUGO);
    * ]: p6 o, Y; Y  d; [
  83. module_param(bcnt, int, S_IRUGO);' C1 j" |- v& t% `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 m4 t4 n3 s$ Z8 Y+ `. v4 G: b

0 q5 n3 n3 [9 B' o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  a4 p" i' V2 p' h* c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 U  ^& ?: d: `5 w. m0 @9 t3 W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) e8 V# y- m1 f' v4 m7 x
+ @0 J' Y. u- g

( k. ?7 a  ], [7 ?. A) x0 C$ X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-27 09:31 , Processed in 0.047445 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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