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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 ?) m) }, ?/ F
  1. [code]EDMA sample test application
      N1 j) T3 w* C$ D) Y6 g6 O4 ?
  2. /*; z! X& b+ L8 l+ E4 b
  3. * edma_test.c7 l* c) \+ j+ f6 j3 {
  4. *- n/ M* Y# K8 C1 O8 Y: p
  5. * brief  EDMA3 Test Application
    3 G4 o. P7 C( f! T
  6. *
      r; d: t8 e/ o* B, m' ]
  7. *   This file contains EDMA3 Test code.0 e5 F% y4 j! l
  8. *! D) }% s) i2 O( S$ `; l$ q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 I1 J+ S& D" Q7 p3 o+ |; R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  c. F3 }! V! a" N. ?; }
  11. *         TO CHANGE.
    ' K4 j) O& y( T8 i" E
  12. *. g; Q; ~! R. k- `+ Q8 d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + ~0 c* r$ ^& W% e, ~
  14. *
    8 ?% z' R: g# x: `
  15. * This program is free software; you can redistribute it and/or
    % f/ Z1 \0 W  o* z7 k% A, N( w- F
  16. * modify it under the terms of the GNU General Public License as7 m- }& X* y: Q4 `  F6 F) d* r( P: Z
  17. * published by the Free Software Foundation version 2.
    ' J5 h- c# u! r5 A/ p, r5 @
  18. *
    4 _% A* n) r0 P6 W0 l3 t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  \2 C+ u$ i3 ?; A4 s4 j4 g: }, O
  20. * kind, whether express or implied; without even the implied warranty4 i+ [9 o& c. T+ i+ X8 F% U0 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ B9 y9 O) u3 r
  22. * GNU General Public License for more details.
    9 Z6 w: L/ N$ X7 q/ k# c0 ~- P  d- s
  23. */2 d' n* X) f& X' X; X

  24. # s$ n& Z# y8 s" i
  25. #include <linux/module.h>; O' t& M6 X8 h5 Q5 p  N
  26. #include <linux/init.h>( w; T% [4 L; N+ V% C) n. x
  27. #include <linux/errno.h>
    2 C7 o/ R' \; J4 H- O2 B3 V7 ?5 I
  28. #include <linux/types.h>+ Z! `/ `( e; V
  29. #include <linux/interrupt.h>% D. ?4 _3 d. `- Y* j. J4 L" u  ]
  30. #include <asm/io.h>6 P  t. R7 G4 }! S' [6 U- ]3 j
  31. #include <linux/moduleparam.h>
    ( @2 }9 }) v: m* A  k8 a# E) m
  32. #include <linux/sysctl.h>
    ; X' K6 X# f2 \- ^% c- u
  33. #include <linux/mm.h>- T7 M7 |1 x& V& ?0 z& K2 ^  V5 R! i
  34. #include <linux/dma-mapping.h>4 C: c( {2 C- V7 e

  35. 7 n! @, C$ U7 _' {' I
  36. #include <mach/memory.h>1 h: T/ Y% ]- L1 Z
  37. #include <mach/hardware.h>$ @- q, O, q  j' m
  38. #include <mach/irqs.h>
    " e& h% ?) ]9 e$ ^1 @7 P. i  i
  39. #include <asm/hardware/edma.h>
    / w" ]3 R' ^  O. n  N* W8 M

  40. ; q$ d& ~5 P% l- H  k( h
  41. #undef EDMA3_DEBUG: l1 ~! L6 u1 f+ |1 h8 q
  42. /*#define EDMA3_DEBUG*/' o) a2 X# B2 }' c* `5 E! k( Q

  43. + z* Z* l( h* Q; e
  44. #ifdef EDMA3_DEBUG
    % Z$ }' v& R; d# e: E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 [6 [7 a$ W% w( W& @9 P6 e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 d- o! h, x& [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% H( i+ N( w; W& v& M, o
  48. #else
    - `  s9 }6 I; l" r0 H
  49. #define DMA_PRINTK( x... )
    $ q. T4 a1 l) \7 e9 P
  50. #define DMA_FN_IN- f: ]4 `. V% R' o3 l0 p4 {3 T
  51. #define DMA_FN_OUT
    * l3 v6 L% I& w7 j
  52. #endif
    ' c  |2 A' u* b6 S, A. Y- ]& P3 J* p
  53. 0 W$ \5 l- m9 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), Z4 P  P% x# H
  55. #define STATIC_SHIFT                3: [' Y, O8 g. ]* I. D- x
  56. #define TCINTEN_SHIFT               20
    5 \0 R$ M5 I  f: J) L6 |
  57. #define ITCINTEN_SHIFT              21
    : n, e$ Y# w+ K9 A
  58. #define TCCHEN_SHIFT                22# U' I* t8 `. G6 x
  59. #define ITCCHEN_SHIFT               236 {6 V, C/ S$ S/ h7 [
  60. 7 l$ s2 @/ h& O& M( _& G" d9 L( g
  61. static volatile int irqraised1 = 0;) B# g: F, |+ I* J3 A' Q& g5 e
  62. static volatile int irqraised2 = 0;
    , A2 m# U* g3 {
  63. % o; n0 K+ t2 N- q1 X" _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 W3 X9 y$ }2 {( T$ g6 W( ^- |" S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( q& o7 M9 Q8 Z* G: W  c9 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( @+ w2 n) J: ]
  67. 8 k9 d% a5 ]7 v0 f4 ~
  68. dma_addr_t dmaphyssrc1 = 0;! c# Q6 [/ Z7 L( K! u( q
  69. dma_addr_t dmaphyssrc2 = 0;/ }) B/ G8 E" m6 _
  70. dma_addr_t dmaphysdest1 = 0;) q( X+ \! X/ t% ?5 _+ X+ _( D
  71. dma_addr_t dmaphysdest2 = 0;
    0 Z/ O% A: L/ ]7 g
  72. 2 i; x$ L' a. x' H7 a7 q
  73. char *dmabufsrc1 = NULL;
    + c, i9 j. b. Y& H6 o
  74. char *dmabufsrc2 = NULL;! h( i9 b3 G# w* K  ^5 n- _( F, `1 j
  75. char *dmabufdest1 = NULL;
    ! o8 Y7 x7 M- D. W' V- Q5 s
  76. char *dmabufdest2 = NULL;/ r" |4 c; O( E
  77. * J9 j/ i, q' f; A9 ~/ d4 q
  78. static int acnt = 512;
    " |: e1 S/ k5 e/ J" }% |! S
  79. static int bcnt = 8;- F  B3 k1 j0 U8 k1 X* H
  80. static int ccnt = 8;# N/ W4 `/ W. W4 l

  81. ) F. c7 T' _! A" r7 E& v7 n
  82. module_param(acnt, int, S_IRUGO);$ S8 v; }; ^" P& U. p
  83. module_param(bcnt, int, S_IRUGO);
    0 ^/ ?# g3 w. I8 D8 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* m) v# F- z: D- z  s
, R: O2 }3 i" j1 `$ k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- E; n# i* L5 p' j, yarm-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 X' x+ G5 I" B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 {7 h2 t( f8 U' p; A/ {
+ R* P/ F# w( W0 F5 l% U; J, j
+ l7 K( m. E8 p6 ~) o; c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 03:11 , Processed in 0.039554 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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